Imported Upstream version 2.6.1 upstream/2.6.1
authorBdale Garbee <bdale@gag.com>
Sun, 15 Feb 2009 19:41:13 +0000 (12:41 -0700)
committerBdale Garbee <bdale@gag.com>
Sun, 15 Feb 2009 19:41:13 +0000 (12:41 -0700)
664 files changed:
ChangeLog
DEVELOPING
Makefile.am
Makefile.in
NEWS
ReleaseNotes
aclocal.m4
amandad-src/Makefile.am
amandad-src/Makefile.in
amandad-src/amandad.c
amar-src/Makefile.am [new file with mode: 0644]
amar-src/Makefile.in [new file with mode: 0644]
amar-src/amar-test.c [new file with mode: 0644]
amar-src/amar.c [new file with mode: 0644]
amar-src/amar.h [new file with mode: 0644]
amar-src/amarchiver.c [new file with mode: 0644]
amplot/Makefile.in
application-src/Makefile.am [new file with mode: 0644]
application-src/Makefile.in [new file with mode: 0644]
application-src/amgtar.c [new file with mode: 0644]
application-src/amgtar_perl.pl [new file with mode: 0644]
application-src/amlog-script.pl [new file with mode: 0644]
application-src/amsamba.pl [new file with mode: 0644]
application-src/amstar.c [new file with mode: 0644]
application-src/amzfs-sendrecv.pl [new file with mode: 0644]
application-src/amzfs-snapshot.pl [new file with mode: 0644]
application-src/script-email.pl [new file with mode: 0644]
application-src/teecount.c [new file with mode: 0644]
autogen
changer-src/Makefile.am
changer-src/Makefile.in
changer-src/chg-chs.sh
changer-src/chg-glue.pl [new file with mode: 0644]
changer-src/chg-juke.sh
changer-src/chg-lib.sh.in
changer-src/chg-manual.sh
changer-src/chg-multi.sh
changer-src/chg-scsi-chio.c
changer-src/chg-scsi.c
changer-src/chg-zd-mtx.sh
changer-src/scsi-changer-driver.c
client-src/Makefile.am
client-src/Makefile.in
client-src/amandates.c
client-src/client_util.c
client-src/client_util.h
client-src/noop.c
client-src/runtar.c
client-src/selfcheck.c
client-src/sendbackup-dump.c
client-src/sendbackup-gnutar.c
client-src/sendbackup.c
client-src/sendbackup.h
client-src/sendsize.c
common-src/Makefile.am
common-src/Makefile.in
common-src/amaespipe.sh
common-src/amanda-sh-lib.sh.in
common-src/amanda.h
common-src/amcryptsimple.pl
common-src/amfeatures.c
common-src/amfeatures.h
common-src/amflock-test.c
common-src/amgetconf.pl [new file with mode: 0644]
common-src/amgpgcrypt.pl
common-src/amxml.c [new file with mode: 0644]
common-src/amxml.h [new file with mode: 0644]
common-src/bsd-security.c
common-src/clock.c
common-src/clock.h
common-src/conffile.c
common-src/conffile.h
common-src/debug.c
common-src/debug.h
common-src/dgram.c
common-src/event-test.c [new file with mode: 0644]
common-src/event.c
common-src/event.h
common-src/file.c
common-src/fileheader.c
common-src/fileheader.h
common-src/genversion.c
common-src/genversion.h
common-src/glib-util.c
common-src/glib-util.h
common-src/krb4-security.c
common-src/krb5-security.c
common-src/local-security.c
common-src/match.c
common-src/pipespawn.c
common-src/pipespawn.h
common-src/protocol.c
common-src/queueing-test.c [new file with mode: 0644]
common-src/queueing.c [new file with mode: 0644]
common-src/queueing.h [new file with mode: 0644]
common-src/quoting-test.c [new file with mode: 0644]
common-src/rsh-security.c
common-src/security-util.c
common-src/security-util.h
common-src/semaphore-test.c [new file with mode: 0644]
common-src/semaphore.c [new file with mode: 0644]
common-src/semaphore.h [new file with mode: 0644]
common-src/simpleprng.c [new file with mode: 0644]
common-src/simpleprng.h [new file with mode: 0644]
common-src/sockaddr-util.c
common-src/sockaddr-util.h
common-src/ssh-security.c
common-src/stream.c
common-src/svn-info.h
common-src/testutils.c [new file with mode: 0644]
common-src/testutils.h [new file with mode: 0644]
common-src/timestamp.c
common-src/token.c [deleted file]
common-src/token.h [deleted file]
common-src/util.c
common-src/util.h
common-src/versuff.c
config/Makefile.in
config/amanda/bsd-security.m4
config/amanda/bsdtcp-security.m4
config/amanda/bsdudp-security.m4
config/amanda/changer.m4
config/amanda/compress.m4
config/amanda/debugging.m4
config/amanda/defaults.m4
config/amanda/dirs.m4
config/amanda/dumpers.m4
config/amanda/file-list
config/amanda/flags.m4
config/amanda/flock.m4
config/amanda/ipv6.m4
config/amanda/krb4-security.m4
config/amanda/krb5-security.m4
config/amanda/libs.m4
config/amanda/net.m4
config/amanda/progs.m4
config/amanda/ps.m4 [new file with mode: 0644]
config/amanda/rsh-security.m4
config/amanda/s3-device.m4
config/amanda/ssh-security.m4
config/amanda/swig.m4
config/amanda/tape.m4
config/amanda/types.m4
config/amanda/userid.m4
config/automake/installperms.am
config/automake/scripts.am
config/automake/vars.am
config/config.h.in
config/config.rpath
config/gnulib/alloca.m4
config/gnulib/file-list
config/gnulib/float_h.m4
config/gnulib/getaddrinfo.m4
config/gnulib/getopt.m4 [new file with mode: 0644]
config/gnulib/gnulib-cache.m4
config/gnulib/gnulib-common.m4
config/gnulib/gnulib-comp.m4
config/gnulib/intmax_t.m4
config/gnulib/lib-link.m4
config/gnulib/lock.m4
config/gnulib/longlong.m4
config/gnulib/socklen.m4
config/gnulib/stdint.m4
config/gnulib/stdio_h.m4
config/gnulib/stdlib_h.m4
config/gnulib/string_h.m4
config/gnulib/ulonglong.m4 [deleted file]
config/gnulib/unistd_h.m4
config/gnulib/vasnprintf.m4
config/gnulib/wint_t.m4
config/macro-archive/ac_perl_module_version.m4 [new file with mode: 0644]
config/macro-archive/docbook-dtd.m4
config/macro-archive/docbook-xslt-min.m4
config/macro-archive/docbook-xslt.m4
config/macro-archive/file-list
config/macro-archive/xsltproc.m4
configure
configure.in
device-src/Makefile.am
device-src/Makefile.in
device-src/activate-devpay.c
device-src/amtapetype.pl [new file with mode: 0644]
device-src/device-queueing.c [new file with mode: 0644]
device-src/device-queueing.h [new file with mode: 0644]
device-src/device.c
device-src/device.h
device-src/null-device.c
device-src/null-device.h [deleted file]
device-src/property.c
device-src/property.h
device-src/queueing.c [deleted file]
device-src/queueing.h [deleted file]
device-src/rait-device.c
device-src/rait-device.h [deleted file]
device-src/s3-device.c
device-src/s3-device.h [deleted file]
device-src/s3-util.c [new file with mode: 0644]
device-src/s3-util.h [new file with mode: 0644]
device-src/s3.c
device-src/s3.h
device-src/semaphore.c [deleted file]
device-src/semaphore.h [deleted file]
device-src/tape-aix.c
device-src/tape-device.c
device-src/tape-device.h
device-src/tape-ops.h
device-src/tape-posix.c
device-src/tape-uware.c
device-src/tape-xenix.c
device-src/tests/Makefile.am [deleted file]
device-src/tests/Makefile.in [deleted file]
device-src/tests/device_test.c [deleted file]
device-src/tests/queue_test.c [deleted file]
device-src/tests/semaphore-test.c [deleted file]
device-src/tests/vfs_test.c [deleted file]
device-src/vfs-device.c
device-src/vfs-device.h [deleted file]
device-src/vfs-test.c [new file with mode: 0644]
dumper-src/Makefile.am [deleted file]
dumper-src/Makefile.in [deleted file]
dumper-src/amgtar.pl [deleted file]
dumper-src/generic-dumper.pl [deleted file]
example/Makefile.am
example/Makefile.in
example/amanda-client.conf
example/amanda-client.conf.in
example/amanda.conf
example/amanda.conf.in
example/inetd.conf.amandaclient
example/inetd.conf.amandaclient.in [new file with mode: 0644]
example/inetd.conf.amandaserver [new file with mode: 0644]
example/inetd.conf.amandaserver.in [new file with mode: 0644]
example/template.d/advanced.conf
example/template.d/advanced.conf.in
example/template.d/amanda-S3.conf
example/template.d/amanda-S3.conf.in
example/template.d/amanda-harddisk.conf
example/template.d/amanda-harddisk.conf.in
example/template.d/amanda-single-tape.conf
example/template.d/amanda-single-tape.conf.in
example/template.d/amanda-tape-changer.conf
example/template.d/amanda-tape-changer.conf.in
example/template.d/dumptypes
example/template.d/tapetypes
example/xinetd.amandaclient
example/xinetd.amandaclient.in [new file with mode: 0644]
example/xinetd.amandaserver
example/xinetd.amandaserver.in [new file with mode: 0644]
gnulib/Makefile.am
gnulib/Makefile.in
gnulib/alloca.in.h [new file with mode: 0644]
gnulib/alloca_.h [deleted file]
gnulib/asnprintf.c
gnulib/base64.c
gnulib/base64.h
gnulib/float+.h
gnulib/float.in.h [new file with mode: 0644]
gnulib/float_.h [deleted file]
gnulib/fsusage.c
gnulib/fsusage.h
gnulib/full-read.c
gnulib/full-read.h
gnulib/full-write.c
gnulib/full-write.h
gnulib/gai_strerror.c
gnulib/getaddrinfo.c
gnulib/getaddrinfo.h
gnulib/getopt.c [new file with mode: 0644]
gnulib/getopt.in.h [new file with mode: 0644]
gnulib/getopt1.c [new file with mode: 0644]
gnulib/getopt_int.h [new file with mode: 0644]
gnulib/gettext.h
gnulib/gettimeofday.c
gnulib/inet_ntop.c
gnulib/inet_ntop.h
gnulib/lock.c
gnulib/lock.h
gnulib/malloc.c
gnulib/mkdtemp.c
gnulib/netinet_in.in.h [new file with mode: 0644]
gnulib/netinet_in_.h [deleted file]
gnulib/physmem.c
gnulib/physmem.h
gnulib/printf-args.c
gnulib/printf-args.h
gnulib/printf-parse.c
gnulib/printf-parse.h
gnulib/regenerate/no-restrict.patch [new file with mode: 0644]
gnulib/regenerate/regenerate
gnulib/safe-read.c
gnulib/safe-read.h
gnulib/safe-write.c
gnulib/safe-write.h
gnulib/size_max.h
gnulib/snprintf.c
gnulib/stdbool.in.h [new file with mode: 0644]
gnulib/stdbool_.h [deleted file]
gnulib/stdint.in.h [new file with mode: 0644]
gnulib/stdint_.h [deleted file]
gnulib/stdio.in.h [new file with mode: 0644]
gnulib/stdio_.h [deleted file]
gnulib/stdlib.in.h [new file with mode: 0644]
gnulib/stdlib_.h [deleted file]
gnulib/strdup.c
gnulib/string.in.h [new file with mode: 0644]
gnulib/string_.h [deleted file]
gnulib/sys_socket.in.h [new file with mode: 0644]
gnulib/sys_socket_.h [deleted file]
gnulib/sys_stat.in.h [new file with mode: 0644]
gnulib/sys_stat_.h [deleted file]
gnulib/sys_time.in.h [new file with mode: 0644]
gnulib/sys_time_.h [deleted file]
gnulib/tempname.c
gnulib/tempname.h
gnulib/unistd.in.h [new file with mode: 0644]
gnulib/unistd_.h [deleted file]
gnulib/vasnprintf.c
gnulib/vasnprintf.h
gnulib/wchar.in.h [new file with mode: 0644]
gnulib/wchar_.h [deleted file]
gnulib/xsize.h
installcheck/Amanda_Archive.pl [new file with mode: 0644]
installcheck/Amanda_Changer.pl
installcheck/Amanda_Changer_compat.pl [new file with mode: 0644]
installcheck/Amanda_Changer_disk.pl [new file with mode: 0644]
installcheck/Amanda_Changer_single.pl [new file with mode: 0644]
installcheck/Amanda_Cmdline.pl
installcheck/Amanda_Config.pl
installcheck/Amanda_DB_Catalog.pl [new file with mode: 0644]
installcheck/Amanda_Debug.pl [new file with mode: 0644]
installcheck/Amanda_Device.pl [new file with mode: 0644]
installcheck/Amanda_Logfile.pl
installcheck/Amanda_MainLoop.pl [new file with mode: 0644]
installcheck/Amanda_Process.pl [new file with mode: 0644]
installcheck/Amanda_Tapelist.pl [new file with mode: 0644]
installcheck/Amanda_Types.pl
installcheck/Amanda_Util.pl [new file with mode: 0644]
installcheck/Amanda_Xfer.pl [new file with mode: 0644]
installcheck/Amconfig.pm.in [deleted file]
installcheck/Installcheck/Config.pm [new file with mode: 0644]
installcheck/Installcheck/Run.pm [new file with mode: 0644]
installcheck/Makefile.am
installcheck/Makefile.in
installcheck/amarchiver.pl [new file with mode: 0644]
installcheck/amcheckdump.pl
installcheck/amdevcheck.pl
installcheck/amdump.pl [new file with mode: 0644]
installcheck/amfetchdump.pl [new file with mode: 0644]
installcheck/amgetconf.pl
installcheck/amservice.pl [new file with mode: 0644]
installcheck/amstatus.pl [new file with mode: 0644]
installcheck/amtapetype.pl [new file with mode: 0644]
installcheck/bigint.pl [new file with mode: 0644]
installcheck/pp-scripts.pl [new file with mode: 0644]
man/Makefile.am
man/Makefile.in
man/amaddclient.8
man/amadmin.8
man/amaespipe.8
man/amanda-applications.7 [new file with mode: 0644]
man/amanda-archive-format.5 [new file with mode: 0644]
man/amanda-auth.7 [new file with mode: 0644]
man/amanda-changers.7 [new file with mode: 0644]
man/amanda-client.conf.5
man/amanda-devices.7 [new file with mode: 0644]
man/amanda-scripts.7 [new file with mode: 0644]
man/amanda.8
man/amanda.conf.5
man/amarchiver.8 [new file with mode: 0644]
man/amcheck.8
man/amcheckdb.8
man/amcheckdump.8
man/amcleanup.8
man/amcrypt-ossl-asym.8
man/amcrypt-ossl.8
man/amcrypt.8
man/amcryptsimple.8
man/amdd.8 [deleted file]
man/amdevcheck.8
man/amdump.8
man/amfetchdump.8
man/amflush.8
man/amgetconf.8
man/amgpgcrypt.8
man/amgtar.8 [new file with mode: 0644]
man/amlabel.8
man/ammt.8 [deleted file]
man/amoverview.8
man/amplot.8
man/amrecover.8
man/amreport.8
man/amrestore.8
man/amrmtape.8
man/amsamba.8 [new file with mode: 0644]
man/amserverconfig.8
man/amservice.8 [new file with mode: 0644]
man/amstar.8 [new file with mode: 0644]
man/amstatus.8
man/amtape.8
man/amtapetype.8
man/amtoc.8
man/amvault.8 [new file with mode: 0644]
man/amverify.8 [deleted file]
man/amverifyrun.8 [deleted file]
man/amzfs-sendrecv.8 [new file with mode: 0644]
man/amzfs-snapshot.8 [new file with mode: 0644]
man/disklist.5 [new file with mode: 0644]
man/entities/global.entities [deleted file]
man/entities/global.entities.in [new file with mode: 0644]
man/script-email.8 [new file with mode: 0644]
man/tapelist.5 [new file with mode: 0644]
man/xml-source/amaddclient.8.xml
man/xml-source/amadmin.8.xml
man/xml-source/amaespipe.8.xml
man/xml-source/amanda-applications.7.xml [new file with mode: 0644]
man/xml-source/amanda-archive-format.5.xml [new file with mode: 0644]
man/xml-source/amanda-auth.7.xml [new file with mode: 0644]
man/xml-source/amanda-changers.7.xml [new file with mode: 0644]
man/xml-source/amanda-client.conf.5.xml
man/xml-source/amanda-devices.7.xml [new file with mode: 0644]
man/xml-source/amanda-scripts.7.xml [new file with mode: 0644]
man/xml-source/amanda.8.xml
man/xml-source/amanda.conf.5.xml
man/xml-source/amarchiver.8.xml [new file with mode: 0644]
man/xml-source/amcheck.8.xml
man/xml-source/amcheckdb.8.xml
man/xml-source/amcheckdump.8.xml
man/xml-source/amcleanup.8.xml
man/xml-source/amcrypt-ossl-asym.8.xml
man/xml-source/amcrypt-ossl.8.xml
man/xml-source/amcrypt.8.xml
man/xml-source/amcryptsimple.8.xml
man/xml-source/amdd.8.xml [deleted file]
man/xml-source/amdevcheck.8.xml
man/xml-source/amdump.8.xml
man/xml-source/amfetchdump.8.xml
man/xml-source/amflush.8.xml
man/xml-source/amgetconf.8.xml
man/xml-source/amgpgcrypt.8.xml
man/xml-source/amgtar.8.xml [new file with mode: 0644]
man/xml-source/amlabel.8.xml
man/xml-source/ammt.8.xml [deleted file]
man/xml-source/amoverview.8.xml
man/xml-source/amplot.8.xml
man/xml-source/amrecover.8.xml
man/xml-source/amreport.8.xml
man/xml-source/amrestore.8.xml
man/xml-source/amrmtape.8.xml
man/xml-source/amsamba.8.xml [new file with mode: 0644]
man/xml-source/amserverconfig.8.xml
man/xml-source/amservice.8.xml [new file with mode: 0644]
man/xml-source/amstar.8.xml [new file with mode: 0644]
man/xml-source/amstatus.8.xml
man/xml-source/amtape.8.xml
man/xml-source/amtapetype.8.xml
man/xml-source/amtoc.8.xml
man/xml-source/amvault.8.xml [new file with mode: 0644]
man/xml-source/amverify.8.xml [deleted file]
man/xml-source/amverifyrun.8.xml [deleted file]
man/xml-source/amzfs-sendrecv.8.xml [new file with mode: 0644]
man/xml-source/amzfs-snapshot.8.xml [new file with mode: 0644]
man/xml-source/disklist.5.xml [new file with mode: 0644]
man/xml-source/script-email.8.xml [new file with mode: 0644]
man/xml-source/tapelist.5.xml [new file with mode: 0644]
man/xslt/html.xsl.in
man/xslt/man.xsl.in
oldrecover-src/Makefile.am
oldrecover-src/Makefile.in
oldrecover-src/amrecover.c
oldrecover-src/extract_list.c
oldrecover-src/uscan.c
packaging/Makefile.in
packaging/deb/amanda-backup-client.install
packaging/deb/amanda-backup-client.lintian
packaging/deb/amanda-backup-client.postinst [changed mode: 0755->0644]
packaging/deb/amanda-backup-client.postrm [changed mode: 0755->0644]
packaging/deb/amanda-backup-server.install
packaging/deb/amanda-backup-server.postinst [changed mode: 0755->0644]
packaging/deb/amanda-backup-server.postrm [changed mode: 0755->0644]
packaging/deb/buildpkg
packaging/deb/changelog
packaging/deb/rules
packaging/rpm/amanda.spec
packaging/rpm/buildpkg
perl/Amanda/Application.c [new file with mode: 0644]
perl/Amanda/Application.pm [new file with mode: 0644]
perl/Amanda/Application.swg [new file with mode: 0644]
perl/Amanda/Application/Zfs.pm [new file with mode: 0644]
perl/Amanda/Archive.c [new file with mode: 0644]
perl/Amanda/Archive.pm [new file with mode: 0644]
perl/Amanda/Archive.swg [new file with mode: 0644]
perl/Amanda/BigIntCompat.pm [new file with mode: 0644]
perl/Amanda/Changer.pm
perl/Amanda/Changer/compat.pm [new file with mode: 0644]
perl/Amanda/Changer/disk.pm [new file with mode: 0644]
perl/Amanda/Changer/single.pm [new file with mode: 0644]
perl/Amanda/Cmdline.c
perl/Amanda/Cmdline.pm
perl/Amanda/Cmdline.swg
perl/Amanda/Config.c
perl/Amanda/Config.pm
perl/Amanda/Config.swg
perl/Amanda/Constants.pm.in [new file with mode: 0644]
perl/Amanda/DB/Catalog.pm [new file with mode: 0644]
perl/Amanda/Debug.c
perl/Amanda/Debug.pm
perl/Amanda/Debug.swg
perl/Amanda/Device.c
perl/Amanda/Device.pm
perl/Amanda/Device.swg
perl/Amanda/Logfile.c
perl/Amanda/Logfile.pm
perl/Amanda/Logfile.swg
perl/Amanda/MainLoop.c [new file with mode: 0644]
perl/Amanda/MainLoop.pm [new file with mode: 0644]
perl/Amanda/MainLoop.swg [new file with mode: 0644]
perl/Amanda/Paths.pm.in
perl/Amanda/Process.pm [new file with mode: 0644]
perl/Amanda/Script.pm [new file with mode: 0644]
perl/Amanda/Script_App.pm [new file with mode: 0644]
perl/Amanda/Tapefile.c [deleted file]
perl/Amanda/Tapefile.pm [deleted file]
perl/Amanda/Tapefile.swg [deleted file]
perl/Amanda/Tapelist.c [new file with mode: 0644]
perl/Amanda/Tapelist.pm [new file with mode: 0644]
perl/Amanda/Tapelist.swg [new file with mode: 0644]
perl/Amanda/Tests.c [new file with mode: 0644]
perl/Amanda/Tests.pm [new file with mode: 0644]
perl/Amanda/Tests.swg [new file with mode: 0644]
perl/Amanda/Types.c
perl/Amanda/Types.pm
perl/Amanda/Types.swg
perl/Amanda/Util.c
perl/Amanda/Util.pm
perl/Amanda/Util.swg
perl/Amanda/Xfer.c [new file with mode: 0644]
perl/Amanda/Xfer.pm [new file with mode: 0644]
perl/Amanda/Xfer.swg [new file with mode: 0644]
perl/Makefile.am
perl/Makefile.in
perl/amglue/amglue.h
perl/amglue/amglue.swg
perl/amglue/bigint.c
perl/amglue/constants.swg
perl/amglue/exports.swg
perl/amglue/ghashtable.c
perl/amglue/glib.swg
perl/amglue/integers.swg
perl/amglue/source.c [new file with mode: 0644]
po/Makefile.in
recover-src/Makefile.am
recover-src/Makefile.in
recover-src/amrecover.c
recover-src/amrecover.h
recover-src/extract_list.c
recover-src/set_commands.c
recover-src/uscan.c
restore-src/Makefile.am
restore-src/Makefile.in
restore-src/amfetchdump.c
restore-src/amidxtaped.c
restore-src/amrestore.c
restore-src/restore.c
restore-src/restore.h
server-src/Makefile.am
server-src/Makefile.in
server-src/amaddclient.pl
server-src/amadmin.c
server-src/amcheck.c
server-src/amcheckdump.pl
server-src/amcleanup.pl [new file with mode: 0644]
server-src/amcleanup.sh [deleted file]
server-src/amcleanupdisk.c
server-src/amdevcheck.pl
server-src/amdump.sh
server-src/amflush.c
server-src/amindexd.c
server-src/amlabel.c
server-src/amlogroll.c
server-src/amoverview.pl
server-src/amrmtape.sh
server-src/amserverconfig.pl
server-src/amservice.c [new file with mode: 0644]
server-src/amstatus.pl
server-src/amtape.c
server-src/amtoc.pl
server-src/amtrmidx.c
server-src/amtrmlog.c
server-src/amvault.pl [new file with mode: 0644]
server-src/amverify.sh [deleted file]
server-src/amverifyrun.sh [deleted file]
server-src/changer.c
server-src/chunker.c
server-src/cmdline.c
server-src/cmdline.h
server-src/diskfile.c
server-src/diskfile.h
server-src/driver.c
server-src/driverio.c
server-src/driverio.h
server-src/dumper.c
server-src/find.c
server-src/find.h
server-src/getconf.c [deleted file]
server-src/holding.c
server-src/holding.h
server-src/infofile.c
server-src/logfile.c
server-src/logfile.h
server-src/planner.c
server-src/reporter.c
server-src/server_util.c
server-src/server_util.h
server-src/tapefile.c
server-src/tapefile.h
server-src/taper-disk-port-source.c
server-src/taper-disk-port-source.h
server-src/taper-file-source.c
server-src/taper-file-source.h
server-src/taper-mem-port-source.c
server-src/taper-mem-port-source.h
server-src/taper-port-source.c
server-src/taper-port-source.h
server-src/taper-source-test.c
server-src/taper-source.c
server-src/taper-source.h
server-src/taper.c
server-src/taperscan.c
server-src/taperscan.h
tape-src/Makefile.am [deleted file]
tape-src/Makefile.in [deleted file]
tape-src/amdd.c [deleted file]
tape-src/ammt.c [deleted file]
tape-src/output-file.c [deleted file]
tape-src/output-file.h [deleted file]
tape-src/output-null.c [deleted file]
tape-src/output-null.h [deleted file]
tape-src/output-rait.c [deleted file]
tape-src/output-rait.h [deleted file]
tape-src/output-tape.c [deleted file]
tape-src/output-tape.h [deleted file]
tape-src/tapeio.c [deleted file]
tape-src/tapeio.h [deleted file]
tape-src/tapetype.c [deleted file]
xfer-src/Makefile.am [new file with mode: 0644]
xfer-src/Makefile.in [new file with mode: 0644]
xfer-src/amxfer.h [new file with mode: 0644]
xfer-src/dest-device.c [new file with mode: 0644]
xfer-src/dest-fd.c [new file with mode: 0644]
xfer-src/dest-null.c [new file with mode: 0644]
xfer-src/element-glue.c [new file with mode: 0644]
xfer-src/element-glue.h [new file with mode: 0644]
xfer-src/filter-xor.c [new file with mode: 0644]
xfer-src/source-device.c [new file with mode: 0644]
xfer-src/source-fd.c [new file with mode: 0644]
xfer-src/source-pattern.c [new file with mode: 0644]
xfer-src/source-random.c [new file with mode: 0644]
xfer-src/xfer-element.c [new file with mode: 0644]
xfer-src/xfer-element.h [new file with mode: 0644]
xfer-src/xfer-test.c [new file with mode: 0644]
xfer-src/xfer.c [new file with mode: 0644]
xfer-src/xfer.h [new file with mode: 0644]
xfer-src/xmsg.c [new file with mode: 0644]
xfer-src/xmsg.h [new file with mode: 0644]

index e671971a8cdbcfc14a817bad211e0b90a74e51a6..a37ffb6261fa3ed2268e00063d908612dedffec4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
-2008-08-22  Jean-Louis Martineau <martineau@zmanda.com>
-       * configure.in, packaging/deb/rules,
-         packaging/deb/buildpkg, packaging/rpm/buildpkg,
-         packaging/rpm/amanda.spec: Change release to 2.6.0p2
-       * NEWS: News in 2.6.0p2
+2009-01-22  Jean-Louis Martineau <martineau@zmanda.com>
+       * configure.in: AM_INIT_AUTOMAKE(amanda, "2.6.1")
+       * packaging/deb/rules, packaging/deb/buildpkg, packaging/deb/changelog,
+         packaging/rpm/buildpkg,
+         packaging/rpm/amanda.spec: Change version to 2.6.1.
+
+2009-01-22  Jean-Louis Martineau <martineau@zmanda.com>
+       * man/xml-source/amstar.8.xml: Typo.
+
+2009-01-21  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/driver.c: Add call to short_dump_state().
+
+2009-01-21  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/reporter.c: Set exit_status to STATUS_TAPE if taper crash.
+
+2009-01-21  Jean-Louis Martineau <martineau@zmanda.com>,
+           Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/fileheader.c: Remove strquotedstr function.
+       * common-src/quoting-test.c: Test strquotedstr function.
+       * common-src/util.c: Add prototype for strquotedstr function.
+       * common-src/util.h: Add new strquotedstr function.
+
+2009-01-21  Jean-Louis Martineau <martineau@zmanda.com>
+       * application-src/Makefile.am: Typo
+
+2009-01-21  Dustin J. Mitchell <dustin@zmanda.com>
+       Patch suggested by Ingo Schaefer <ingo@ingo-schaefer.de>
+       * packaging/rpm/amanda.spec: detect and properly support suse11.1,
+         with a temporary hack to support suse11, too
+
+2009-01-21  Jean-Louis Martineau <martineau@zmanda.com>
+       * packaging/rpm/amanda.spec: Typo.
+
+2009-01-21  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/amstatus.pl: Fix use of %free and %qlen keys.
+
+2009-01-20 Dan Locks <dwlocks@zmanda.com>
+       * packaging/rpm/amanda.spec: add missing BuildRequires, conditionalize 
+         libtermcap.so.2 for fedora, change tar requirement to %{tarver}
+
+2009-01-20 Dan Locks <dwlocks@zmanda.com>
+       * packaging/rpm/amanda.spec: add %{PERLSITELIB} to %files section to
+         install perl for the client package add "directory mode" to defattr
+         statements where appropriate.
+
+2009-01-19  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/diskfile.c: Use dp->hostnext to scan dles of a host.
+
+2009-01-19  Jean-Louis Martineau <martineau@zmanda.com>
+       * device-src/vfs-device.c: robust_open can return fd 0.
+
+2009-01-19  Tom Robinson <tom.robinson@constantstream.com>
+       * server-src/amoverview.pl: fix parsing of filenames containing colons
+
+2009-01-19  Jean-Louis Martineau <martineau@zmanda.com>
+       * application-src/amzfs-sendrecv.pl: Handle incremental,
+                                            new KEEP-SNAPSHOT property.
+       * man/xml-source/amzfs-sendrecv.8.xml: Document it.
+       * application-src/teecount.c: New program.
+       * application-src/Makefile.am: Add teecount.
+       * perl/Amanda/Application/Zfs.pm: Work with 'current' snapshot.
+       * common-src/amanda.h: include "safe-read.h"
+
+2009-01-17  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/amstatus.pl: Don't add 'dump to tape' in the 'dumped'
+                                 result.
+
+2009-01-16 Dan Locks <dwlocks@zmanda.com>
+       * packaging/rpm/amanda.spec: fix the fedora 10 fix for other distros
+
+2009-01-16  Dustin J. Mitchell <dustin@zmanda.com>
+       * device-src/vfs-device.c: don't cache the dir_handle, as
+         such caching does not work on some network filesystems
+
+2009-01-16  Jean-Louis Martineau <martineau@zmanda.com>
+       * packaging/rpm/amanda.spec: Fix for fedora 10.
+
+2009-01-16  Dustin J. Mitchell <dustin@zmanda.com>
+       * device-src/amtapetype.pl: remove call to old device function
+
+2009-01-16  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/driver.c: Use bitwise NOT for taper_state.
+
+2009-01-16  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/taper.c: Go to next tape if device_start_file fail.
+       * device-src/tape-device.c: write a filemark when a file is finished.
+       * device-src/tape-device.h (TapeDevice): Remove first_file.
+
+2009-01-16  Jean-Louis Martineau <martineau@zmanda.com>
+       * client-src/sendbackup.c: Fix for no index with application.
+       * application-src/amstar.c: Improve error reporting.
+       * application-src/amgtar.c: Improve error reporting.
+
+2009-01-14  Jean-Louis Martineau <martineau@zmanda.com>
+       * application-src/amgtar.c: Add TAR-BLOCKSIZE property.
+       * man/xml-source/amgtar.8.xml; document TAR-BLOCKSIZE property.
+
+2009-01-13  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/amcheck.c: Check fallback_splitsize is smaller than
+                               physmem_total().
+       * server-src/taper-mem-port-source.c: Dont; check physmem_available.
+
+2009-01-12  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/server_util.c: New get_pending_cmd function.
+       * server-src/server_util.h: get_pending_cmd prototype.
+       * server-src/driver.c: Send message to dumper in ABORT command.
+       * server-src/driverio.c: Send message to dumper in ABORT command.
+       * server-src/dumper.c: Check for ABORT cmd.
+       * server-src/reporter.c: Don't log duplicate
+                                'Not enough holding disk space' error
+
+2009-01-12  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/driver.c: Fix result_argv subscript.
+
+2009-01-08  Jean-Louis Martineau <martineau@zmanda.com>
+       * restore-src/amfetchdump.c: Write to stderr.
+
+2009-01-06  Jean-Louis Martineau <martineau@zmanda.com>
+       * device-src/tape-device.c (tape_device_seek_file): Set is_eof to FALSE
+         after it is use.
+
+2009-01-06  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/taper.c: Don't call changer_label() if a changer is not
+                             in use.
+
+2009-01-06  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/driverio.c: Set *result_argv to NULL on EOF.
+       * server-src/taper-mem-port-source.c: Set an error if the memory can't
+         be allocated for the memory buffer.
+
+2009-01-05  Dustin J. Mitchell <dustin@zmanda.com>
+       * client-src/runtar.c: remove unnecessary check for existence of
+         CLIENT_LOGIN
+
+2009-01-05  Jean-Louis Martineau <martineau@zmanda.com>
+       * perl/Amanda/Archive.swg, perl/Amanda/Device.swg,
+         perl/Amanda/Xfer.swg: Fix compiler warning.
+
+2009-01-05  Jean-Louis Martineau <martineau@zmanda.com>
+       * config/automake/scripts.am: Remove 'use lib' line before doing check.
+
+2008-12-22  Jean-Louis Martineau <martineau@zmanda.com>
+       * configure.in: AM_INIT_AUTOMAKE(amanda, "2.6.1b2")
+       * packaging/deb/rules, packaging/deb/buildpkg,
+         packaging/deb/changelog, packaging/rpm/buildpkg,
+         packaging/rpm/amanda.spec: Change version to 2.6.1b2.
+
+2008-12-22  Paul Yeatman <pyeatman@zmanda.com>
+       * man/entities/global.entities.in: added author/email entity for me
+       * man/xml-source/amanda-auth.7.xml: newly added man page
+       * man/Makefile.am: added amanda-auth to section 7
+       * man/xml-source/amanda.conf.5.xml: removed details on auth parameter
+       and added link to amanda-auth man page 
+       * man/xml-source/amanda.conf.5.xml: moved AUTHORIZATION section to
+       amanda-auth and added link to amanda-auth man page 
+
+2008-12-22  Nikolas Coukouma <atrus@zmanda.com>
+       * device-src/s3.c: retry on CURLE_GOT_NOTHING (52) to handle "connection reset by peer"
+
+2008-12-22  Dustin J. Mitchell <dustin@zmanda.com>
+       * device-src/s3.c: translate error code 0 to "None", not NULL
+
+2008-12-22  Dustin J. Mitchell <dustin@zmanda.com>
+       * application-src/amgtar.c,
+         application-src/amstar.c: Use sizeof(line) for argument to fgets.
+
+2008-12-22  Jean-Louis Martineau <martineau@zmanda.com>
+       * man/xml-source/amarchiver.8.xml: amanda-archive-format man page is
+                                          in section 5.
+
+2008-12-22  Dustin J. Mitchell <dustin@zmanda.com>
+       * installcheck/Installcheck/Dumpcache.pm
+         installcheck/Installcheck/Run.pm installcheck/amdump.pl
+         installcheck/pp-scripts.pl: move amdump_diag to Installcheck::Run, fix
+         it, and use it in amdump and pp-scripts
+       * application-src/amlog-script.pl: don't pretend to be script-email
+       * man/Makefile.am: amanda-archive-format should be section 5
+       * man/xml-source/amanda-archive-format.5.xml: small tweaks
+       * man/xml-source/amanda-changers.7.xml: fix authorship
+       * man/xml-source/amanda.8.xml: add link to amvault(8)
+       * man/xml-source/amvault.8.xml: enumerate limitations of this version
+       * perl/Amanda/Config.swg: fix mem leak in config_dir_relative wrapper
+
+2008-12-22  Dustin J. Mitchell <dustin@zmanda.com>
+       * config/amanda/dirs.m4: add --with-amdatadir
+       * example/Makefile.am: use it for examples and templates
+       * perl/Amanda/Paths.pm.in: add $amdatadir
+       * server-src/amserverconfig.pl: use it
+       * packaging/deb/rules packaging/rpm/amanda.spec: packaging changes
+         so that built packages still put examples and templates in
+         /var/lib/amanda
+
+2008-12-22  Jean-Louis Martineau <martineau@zmanda.com>
+       * application-src/amstar.c: Use fgets to read star output.
+       * application-src/amgtar.c: Use fgets to read gtar output.
+
+2008-12-22  Jean-Louis Martineau <martineau@zmanda.com>, 
+           Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/util.c: Convert underscore in application and script
+                            property name to dash.
+       * device-src/property.c: Make underscore and dash equal in device
+                                property name.
+       * installcheck/Amanda_Device.pl: Check device property name with
+                                        mixed case and dash.
+       * installcheck/pp-scripts.pl: Check property name with underscore.
+
+2008-12-22  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/reporter.c: Fix reporting of FLUSH.
+
+2008-12-19  Nikolas Coukouma <atrus@zmanda.com>, Dustin J. Mitchell <dustin@zmanda.com>
+       * device-src/s3-device.c, device-src/s3.c, device-src/s3.h:
+         Reset read and write when retrying a failed request
+
+2008-12-19  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/holding.c (holding_get_file_chunks): Set fullpaths to 1.
+
+2008-12-18  Jean-Louis Martineau <martineau@zmanda.com>
+       * common-src/security-util.c: Don't free 'rc'.
+
+2008-12-18  Jean-Louis Martineau <martineau@zmanda.com>
+       * man/xml-source/amgtar.8.xml: Improve documentation of regex.
+
+2008-12-18  Jean-Louis Martineau <martineau@zmanda.com>
+       * common-src/conffile.h (anonymous_value): New prototype.
+       * common-src/conffile.c (anonymous_value): New function.
+       * common-src/conffile.c: Use anonymous_value.
+       * server-src/diskfile.c: Use anonymous_value.
+
+2008-12-17  Jean-Louis Martineau <martineau@zmanda.com>
+       * perl/Amanda/Script_App.pm: Fix infinite loop.
+       * perl/Amanda/Application/Zfs.pm: Fix for freebsd.
+
+2008-12-17  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/planner.c: Run script only if todo is set.
+
+2008-12-17  Jean-Louis Martineau <martineau@zmanda.com>
+       * installcheck/amfetchdump.pl: chdir() before rmtree().
+
+2008-12-17  Jean-Louis Martineau <martineau@zmanda.com>
+       * common-src/pipespawn.c: Remove bogus g_debug().
+
+2008-12-17  Jean-Louis Martineau <martineau@zmanda.com>
+       * installcheck/amarchiver.pl: chdir() before rmtree().
+       * installcheck/amcheckdump.pl: Add reason to BAIL_OUT.
+       * installcheck/amdevcheck.pl: Add reason to BAIL_OUT.
+
+2008-12-07  Satya Ganga <gsat@zmanda.com>
+       * changer-src/chg-lib.sh.in: Remove dependency on ggrep and use mtx
+         offline command instead of "eject" which is not supported on solaris.
+
+2008-12-17 Dan Locks <dwlocks@zmanda.com>
+       * config/amanda/changer.m4: update AC_CHECK_HEADERS to get rid of
+         "present but cannot be compiled" warning during debian packaging.
+
+2008-12-17 Dan Locks <dwlocks@zmanda.com>
+       * packaging/rpm/amanda.spec: add detection for SLES11 (Beta)
+
+2008-12-17  Dustin J. Mitchell <dustin@zmanda.com>
+       * man/xml-source/amgtar.8.xml: atime_preserve -> atime-preserve
+       * installcheck/pp-scripts.pl: add atime-preserve property, remove
+         references to Installcheck::Dumpcache, which isn't in this release
+
+2008-12-16  Dustin J. Mitchell <dustin@zmanda.com>
+       * man/xslt/html.xsl.in: add <div class="refentry" /> for the benefit
+         of amanda.css.
+
+2008-12-16  Jean-Louis Martineau <martineau@zmanda.com>
+       * common-src/security-util.c: Don't close if it's not open.
+
+2008-12-16  Jean-Louis Martineau <martineau@zmanda.com>
+       * application-src/Makefile.am: Add amlog-script.
+       * application-src/amlog-script.pl: New scripts.
+       * server-src/amcheck.c , server-src/planner.c,
+         server-src/server_util.c, server-src/server_util.h,
+         server-src/driver.c: Add level argument to run_server_scripts().
+         The script is executed with that level argument.
+       * installcheck/pp-scripts.pl: Check scripts.
+       * installcheck/Makefile.am: Add pp-scripts.
+
+2008-12-16  Dustin J. Mitchell <dustin@zmanda.com>
+       * man/Makefile.am man/xml-source/amanda-changers.7.xml
+         man/xml-source/amanda-devices.7.xml man/xml-source/amanda.8.xml
+         man/xml-source/amanda.conf.5.xml: new documentation
+       * perl/Amanda/Changer.pm: not finished yet!
+       * perl/Amanda/Changer/compat.pm: fix error message
+       * server-src/changer.c changer-src/chg-glue.pl:
+         better error handling
+
+2008-12-16  Dustin J. Mitchell <dustin@zmanda.com>
+       * changer-src/chg-glue.pl: add labelling support
+       * perl/Amanda/Changer/compat.pm: only call '-label' on chg-zd-mtx if
+         the changer is not seekable (hack to make slotinfofile work)
+       * changer-src/chg-zd-mtx.sh: provide optional slotinfofile mapping
+         slots to labels on a best-information-available basis
+
+2008-12-15  Jean-Louis Martineau <martineau@zmanda.com>
+       * amandad-src/amandad.c: Set wait_30s to 0 for local auth.
+
+2008-12-15  Dustin J. Mitchell <dustin@zmanda.com>
+       * installcheck/Amanda_Config.pl: work around buggy sort() in perl-5.6
+       * installcheck/Amanda_DB_Catalog.pl installcheck/Amanda_Logfile.pl:
+         stringify bigints in is_deeply arguments
+       * perl/Amanda/Archive.swg: grok_number is not in perl-5.6
+       * perl/Amanda/BigIntCompat.pm: additional overloads and methods for
+         BigIntCompat for perl-5.6 compatibility
+
+2008-12-14  Dustin J. Mitchell <dustin@zmanda.com>
+       * man/Makefile.am: change manpage build process
+       * man/entities/global.entities.in: generate with config.status
+       * man/xslt/html.xsl.in: new templates to handle authors
+       * man/xslt/man.xsl.in: new templates to handle authors
+       * man/xml-source/*.xml: change specification of authors
+       * man/xml-source/amanda-applications.7.xml: add links to apps
+       * man/xml-source/amanda-scripts.7.xml: add links to scripts
+
+2008-12-12  John Hein <jhein@timing.com>
+       * server-src/amdump.sh: fix Open3 invocation to work on
+         FreeBSD-4.x
+
+2008-12-12  Jean-Louis Martineau <martineau@zmanda.com>
+       * man/xml-source/amanda.conf.5.xml: Fix use of <programlisting>, it must
+                                           always be at the beginning of the line.
+
+2008-12-12  Jean-Louis Martineau <martineau@zmanda.com>
+       * application-src/amgtar.c: Fix coredump if GNUTAR is not set.
+
+2008-12-12  Dustin J. Mitchell <dustin@zmanda.com>
+       * client-src/sendbackup-dump.c: fix previous commit to not use
+         precompiler directives in the middle of a macro invocation
+
+2008-12-12  Jean-Louis Martineau <martineau@zmanda.com>
+       * NEWS, ReleaseNotes: Add amzfs-sendrecv.
+       * client-src/sendbackup.c: Fix indexd test.
+       * man/Makefile.am: Add amzfs-sendrecv.8.
+       * man/xml-source/amzfs-snapshot.8.xml: Add DLE format example.
+       * man/xml-source/amanda-applications.7.xml: Add amzfs-sendrecv.8.
+       * man/xml-source/amanda.8.xml: Add amzfs-sendrecv.8.
+       * man/xml-source/amzfs-sendrecv.8.xml: New man page.
+       * application-src/amzfs-sendrecv.pl: New application.
+       * application-src/amzfs-snapshot.pl: Fix to use
+                                            Amanda::Application::Zfs
+       * application-src/Makefile.am: Add amzfs-sendrecv.
+       * perl/Amanda/Script_App.pm: Exit instead of die.
+       * perl/Amanda/Application/Zfs.pm: New perl module for zfs.
+       * perl/Makefile.am: Add Amanda/Application and
+                           Amanda/Application/Zfs.pm
+
+2008-12-12  Jean-Louis Martineau <martineau@zmanda.com>
+       * recover-src/extract_list.c: Wait to read at least one byte from the
+                                     data stream before forking the child.
+
+2008-12-12  Jun Kuriyama <kuriyama@freebsd.org>, Göran Löwkran
+       * changer-src/chg-zd-mtx.sh: fix bashisms
+       * client-src/sendbackup-dump.c: use -L on systems that support it
+
+2008-12-11  Jean-Louis Martineau <martineau@zmanda.com>
+       * NEWS, ReleaseNotes: Add amsamba.
+
+2008-12-11  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/driver.c: Check start_t before doing a dump to tape.
+
+2008-12-09  C R Ritson.
+       * server-src/reporter.c: Add threshold to small and big estimate.
+
+2008-12-09  Jean-Louis Martineau <martineau@zmanda.com>
+       * client-src/client_util.c: Parse RECOVER-MODE application support.
+       * client-src/client_util.h (backup_support_option_t):
+                                  Add smb_recover_mode.
+       * client-src/sendsize.c: Fix size.
+       * man/Makefile.am: Add amsamba.8.
+       * man/xml-source/amsamba.8.xml: New man page.
+       * man/xml-source/amanda-applications.7.xml: List amsamba.
+       * man/xml-source/amanda.8.xml: List amsamba.
+       * application-src/Makefile.am (CHECK_PERL): Add amsamba
+       * application-src/amsamba.pl: New application.
+       * recover-src/extract_list.c: Get support option from application
+         and set --recover-mode if needed.
+       * recover-src/amrecover.h: Remove some "#ifdef SAMBA_CLIENT".
+       * recover-src/set_commands.c: Remove some "#ifdef SAMBA_CLIENT".
+       * perl/Amanda/Paths.pm.in: Add $sysconfdir.
+       * perl/Amanda/Util.swg: Add skip_quoted_string.
+
+2008-12-09  Jean-Louis Martineau <martineau@zmanda.com>
+       * man/xml-source/amstar.8.xml: Typo.
+
+2008-12-09  Jean-Louis Martineau <martineau@zmanda.com>
+       * man/xml-source/amanda.conf.5.xml: Fix plugin location.
+
+2008-12-07  Dustin J. Mitchell <dustin@zmanda.com>
+       * server-src/Makefile.am server-src/amvault.pl: new, experimental
+         script to copy data from secondary to tertiary volumes
+       * common-src/fileheader.c: strip spurious ' ' from headers
+       * man/Makefile.am man/xml-source/amvault.8.xml: docs
+       * perl/Amanda/DB/Catalog.pm: add kbps calculation
+       * perl/Amanda/Device.swg: add volume_header() method
+
+2008-12-05  Dustin J. Mitchell <dustin@zmanda.com>
+       * server-src/taper.c: remove dead code that can cause compiler errors
+
+2008-12-05  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/driverio.c: Send a message with NO-NEW-TAPE.
+       * server-src/driver.c: Generate message for NO-NEW-TAPE, call
+         start_degraded_mode when sending NO-NEW-TAPE, Fix a subscript error 
+         for INPUT-ERROR and TAPE-ERROR
+       * server-src/taper.c: Get message from NO-NEW-TAPE command and log it.
+
+2008-12-03  Jean-Louis Martineau <martineau@zmanda.com>
+       * man/xml-source/amanda.conf.5.xml: Provide default unit.
+
+2008-12-03  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/amcheckdump.pl: Use GNUTAR to validate smbclient image.
+
+2008-12-01  Nikolas Coukouma <atrus@zmanda.com>
+       * device-src/s3.c: fix signedness
+
+2008-12-01  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/util.c: fix mishandling of trailing backslash in
+         unquote_string
+
+2008-12-01  Nikolas Coukouma <atrus@zmanda.com>
+       * device-src/s3.c, device-src/s3.h: Fix segmentation fault within s3_make_bucket
+         by adding some "null-op" read and write functions.
+
+2008-11-27  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/amstatus.pl: Correctly parse degraded size.
+
+2008-11-26  Jean-Louis Martineau <martineau@zmanda.com>
+       * client-src/sendbackup.c: Set application in extraction command.
+
+2008-11-25  Jean-Louis Martineau <martineau@zmanda.com>
+       * configure.in: AM_INIT_AUTOMAKE(amanda, "2.6.1b1")
+       * ReleaseNotes: Release notes for 2.6.1b1.
+       * NEWS: News for 2.6.1b1.
+       * packaging/deb/rules, packaging/deb/buildpkg,
+         packaging/rpm/buildpkg,
+         packaging/rpm/amanda.spec: Change version to 2.6.1b1.
+
+2008-11-25  Jean-Louis Martineau <martineau@zmanda.com>
+       * config/amanda/bsd-security.m4: Fix.
+       * config/amanda/bsdtcp-security.m4: Enable --with-bsdtcp-secutiy by
+                                           default.
+       * config/amanda/ssh-security.m4: Enable --with-ssh-security by default.
+
+2008-11-25  Dustin J. Mitchell <dustin@zmanda.com>
+       * changer-src/Makefile.am changer-src/chg-glue.pl:
+         add new c-to-perl glue script
+       * server-src/changer.c: interface with new script
+       * server-src/amtape.c man/xml-source/amtape.8.xml:
+         remove 'slot last' and 'slot prev'
+       * perl/Amanda/Changer.pm perl/Amanda/Changer/compat.pm
+         perl/Amanda/Changer/disk.pm perl/Amanda/Changer/single.pm: updates to
+         new Changer API
+       * installcheck/Amanda_Changer.pl installcheck/Amanda_Changer_compat.pl
+         installcheck/Amanda_Changer_disk.pl installcheck/Amanda_Changer_single.pl
+         installcheck/Makefile.am: tests for all of it
+
+2008-11-25  Dustin J. Mitchell <dustin@zmanda.com>
+       * example/template.d/advanced.conf.in: don't imply that
+         maxdumpsize is in bytes
+
+2008-11-21  Nikolas Coukouma <atrus@zmanda.com>
+       * device-src/s3.c: work around a bug in Amazon's HTTP implementation
+         by avoiding HEAD requests.
+
+2008-11-21  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/diskfile.c (clean_dle_str_for_client): Return NULL if
+                                                           argument is NULL.
+       * restore-src/restore.c: Also check for F_EMPTY.
+
+2008-11-21  Jean-Louis Martineau <martineau@zmanda.com>
+       * amandad-src/amandad.c: Wait up to 5 seconds dwfor only for process
+                                that should terminate.
+
+2008-11-21  Dustin J. Mitchell <dustin@zmanda.com>
+       * restore-src/restore.c: Continue if setting PROPERTY_READ_BUFFER_SIZE
+                                fail.
+
+2008-11-20  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/server_util.c: Skip one field in parsing INFO pid line.
+
+2008-11-20  Jean-Louis Martineau <martineau@zmanda.com>
+       * oldrecover-src/extract_list.c: Use config.
+       * server-src/dumper.c: Check dle_str for NULL.
+
+2008-11-20  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/amdump.sh: Run amreport if the 'log' file already exist.
+
+2008-11-20  Urs Schurer <urs@sitb.de>
+       * server-src/amindexd.c: remove unnecessary stralloc()/free() calls
+         in process_ls_dump
+
+2008-11-19 Satya Ganga <gsat@zmanda.com>
+       * example/inetd.conf.amandaserver.in: Add serverconfig file
+       * configure.in,example/Makefile.am: Include inetd.conf.amandaserver
+
+2008-11-18 Dan Locks <dwlocks@zmanda.com>
+       * packaging/rpm/amanda.spec: removed conditionals around
+         perl(ExtUtils::Embed) so that buildrequires applies to all platforms
+
+2008-11-18  Satya Ganga <gsat@zmanda.com>
+       * device-src/tape-device.c: Remove O_NONBLOCK flag from all tape open calls.
+
+2008-11-18  Jean-Louis Martineau <martineau@zmanda.com>
+       * application-src/amstar.c: Free qdisk after the loop.
+       * application-src/amgtar.c: Free qdisk after the loop.
+
+2008-11-17  Jean-Louis Martineau <martineau@zmanda.com>
+       * man/xml-source/amgtar.8.xml: Update for ATIME-PRESERVE default.
+
+2008-11-17  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/taper.c: Fix formating.
+
+2008-11-17  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/amstatus.pl: Parse "taper: using label ..." line.
+       * server-src/driver.c: Print tape size.
+       * server-src/amtoc.pl: Fix for new log format.
+       * server-src/reporter.c: Increase field width.
+       * server-src/taper.c: Print number of kbytes written to each tape.
+
+2008-11-14  Dustin J. Mitchell <dustin@zmanda.com>
+       * device-src/s3-device.c: eliminate an extra buffer copy in the
+         common case where the caller supplies a large enough buffer
+       * device-src/s3.h: tweak a comment
+
+2008-11-14  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/holding.h: Improve comment.
+       * server-src/reporter.c: Print holding disk size in displyaunit.
+
+2008-11-14  Jean-Louis Martineau <martineau@zmanda.com>
+       * client-src/client_util.c: Get stderr of scripts and send it to
+                                   server.
+       * client-src/client_util.h: Add err in client_script_result_t.
+       * client-src/sendbackup.c: Call run_client_scripts with mesgstream.
+       * client-src/sendsize.c: Fix.
+       * server-src/planner.c: Get WARNING line from client.
+       * server-src/reporter.c: Don't mark the dumper as FAILED if the
+                                planner FAILED.
+       * common-src/amfeatures.h (fe_sendsize_rep_warning): New amfeature
+       * common-src/amfeatures.c: Add fe_sendsize_rep_warning.
+
+2008-11-12  Dustin J. Mitchell <dustin@zmanda.com>
+       * man/xml-source/amfetchdump.8.xml: fix ugly HTML formatting
+
+2008-11-11  Jean-Louis Martineau <martineau@zmanda.com>
+       * amandad-src/amandad.c: Check that something is ready to be read
+                                before calling errfd_recv.
+
+2008-11-11  Dustin J. Mitchell <dustin@zmanda.com>
+       * changer-src/chg-manual.sh: fix typo
+
+2008-11-11 Dan Locks <dwlocks@zmanda.com>
+       * packaging/rpm/amanda.spec: add fedora 9 detection, add
+         BuildRequires: perl(ExtUtils::Embed), fix %{dist}=unknown when
+         undetected instead of at all times
+
+2008-11-11  Dustin J. Mitchell <dustin@zmanda.com>
+       * installcheck/Makefile.am installcheck/amfetchdump.pl: build all
+         active test scripts; add a DLE in the amfetchdump installcheck
+
+2008-11-11  Dustin J. Mitchell <dustin@zmanda.com>
+       * config/macro-archive/ac_perl_module_version.m4: new macro
+       * config/amanda/swig.m4: check for ExtUtils::Embed
+
+2008-11-11  Dustin J. Mitchell <dustin@zmanda.com>
+       * installcheck/amarchiver.pl: quote $sbindir from regexp
+         interpretation
+
+2008-11-11  Jean-Louis Martineau <martineau@zmanda.com>
+       * perl/Makefile.am: Don't add Amanda/Script_App.pm and Amanda/Script.pm
+                           to DISTCLEANFILES.
+
+2008-11-11  Jean-Louis Martineau <martineau@zmanda.com>
+       * installcheck/amdump.pl: Set property "ATIME-PRESERVE" to "NO" in
+                                 amgtar application.
+
+2008-11-11  Jean-Louis Martineau <martineau@zmanda.com>
+       * client-src/selfcheck.c: fix.
+       * amandad-src/amandad.c: Read stderr of server and report it to server.
+       * server-src/planner.c: Keep first line only.
+
+2008-11-10  Dustin J. Mitchell <dustin@zmanda.com>
+       * amar-src/amarchiver.c: fix filesize printf conversion
+
+2008-11-10  Jean-Louis Martineau <martineau@zmanda.com>
+       * client-src/sendbackup.c, client-src/selfcheck.c: Check return
+                                                          value of pipe.
+
+2008-11-10  Dustin J. Mitchell <dustin@zmanda.com>
+       * installcheck/Installcheck/Run.pm: change default DLEs
+       * installcheck/amcheckdump.pl: add DLE explicitly
+       * installcheck/amdevcheck.pl: add DLE explicitly
+       * installcheck/amdump.pl: use the amgtar application in a dump
+
+2008-11-10  Dustin J. Mitchell <dustin@zmanda.com>
+       * installcheck/Makefile.am: only test amfetchdump if it was built
+       * installcheck/amfetchdump.pl: use arguments in the right order
+
+2008-11-10  Dustin J. Mitchell <dustin@zmanda.com>
+       * perl/Amanda/Archive.swg amar-src/amar.c amar-src/amar.h: bugfixes
+       * man/Makefile.am man/xml-source/amarchiver.8.xml
+         amar-src/Makefile.am amar-src/amarchiver.c: new application
+       * installcheck/Makefile.am installcheck/amarchiver.pl: tests
+
+2008-11-10  Dustin J. Mitchell <dustin@zmanda.com>
+       * installcheck/Installcheck/Run.pm: add Expect support
+       * installcheck/Makefile.am installcheck/amfetchdump.pl: amfetchdump
+         installcheck, using Expect support
+
+2008-11-10  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/amgetconf.pl: don't setup_application() in dbclose
+
+2008-11-10  Jean-Louis Martineau <martineau@zmanda.com>
+       * perl/Makefile.am: Build Amanda::Application only if WANT_CLIENT.
+
+2008-11-08  Dustin J. Mitchell <dustin@zmanda.com>
+       * perl/Amanda/Changer.pm perl/Amanda/Changer/compat.pm
+         perl/Amanda/Changer/disk.pm perl/Amanda/Changer/single.pm
+         perl/Makefile.am: entirely new perl-based changer API
+       * perl/Amanda/Config.swg common-src/conffile.c common-src/conffile.h:
+         add changer subsections
+       * man/xml-source/amanda.conf.5.xml: document them
+       * server-src/amcheckdump.pl: use the new changer API
+       * installcheck/Amanda_Changer.pl installcheck/Amanda_Changer_Compat.pl
+         installcheck/Amanda_Changer_Single.pl installcheck/Amanda_Config.pl
+         installcheck/Installcheck/Config.pm installcheck/Makefile.am
+         installcheck/Amanda_Changer_Disk.pl: new/updated tests
+
+2008-11-07  Jean-Louis Martineau <martineau@zmanda.com>
+       * application-src/amstar.c: fix.
+
+2008-11-07  Jean-Louis Martineau <martineau@zmanda.com>
+       * perl/Amanda/Application.swg: Remove %init.
+
+2008-11-07  Jean-Louis Martineau <martineau@zmanda.com>
+       * application-src/amgtar.c, application-src/amgtar_perl.pl,
+         application-src/amstar.c: Write backup image to fd3 and index to fd4.
+       * perl/Amanda/Script_App.pm: Use $self->{mesgout}.
+       * recover-src/extract_list.c: Add more check.
+       * client-src/client_util.c (backup_support_option): Get stderr of
+         application and put it in errarray,
+       * client-src/client_util.h (backup_support_option): New prototype.
+       * client-src/selfcheck.c, client-src/sendbackup.c,
+         client-src/sendsize.c: Get stderr of application and send it to
+                                server.
+       * server-src/dumper.c: Log the first error message.
+       * server-src/planner.c: Log the first error message.
+       * server-src/reporter.c: Don't print some error in report.
+
+2008-11-07  Jean-Louis Martineau <martineau@zmanda.com>
+       * client-src/client_util.c: Parse CALCSIZE and MULTI-ESTIMATE.
+       * client-src/client_util.c (run_calcsize): New function.
+       * client-src/client_util.h (run_calcsize): Prototype.
+       * client-src/sendbackup.c: Update amandates.
+       * client-src/sendsize.c: Handling of calcsize and multi-estimate.
+       * client-src/selfcheck.c: Check calcsize for application.
+       * application-src/amgtar_perl.pl, application-src/amstar.c,
+       * application-src/amgtar.c: handling of calcsize and multi-estimate.
+       * perl/Amanda/Script_App.pm: Add a check.
+       * perl/Amanda/Application.swg: Add run_calcsize.
+       * perl/Amanda/Application.pm: Delete
+       * perl/Makefile.am: Built from Application.swg
+       * client-src/calcsize.c: Handling of STAR program.
+
+2008-11-06  Jean-Louis Martineau <martineau@zmanda.com>
+       * man/xml-source/amgtar.8.xml: Document new properties.
+       * application-src/amgtar.c: Remove ifdef IGNORE_TAR_ERRORS.
+
+2008-11-06  Jean-Louis Martineau <martineau@zmanda.com>
+       * changer-src/chg-zd-mtx.sh: Return first line of mtx output if mtx
+                                    exit with a status != 0.
+       * server-src/amtape.c: Display changer error.
+
+2008-11-06  Jean-Louis Martineau <martineau@zmanda.com>
+       * application-src/amgtar.c: Add exit-handling property.
+
+2008-11-06  Jean-Louis Martineau <martineau@zmanda.com>
+       * application-src/amgtar.c: Add normal, ignore and strange property.
+
+2008-11-04  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/amcheck.c: Check tape_splitsize < tape length.
+
+2008-10-30  Dustin J. Mitchell <dustin@zmanda.com>
+       * server-src/find.c server-src/find.h man/xml-source/amadmin.8.xml:
+         add new sort key, 'w', for write_timestamp
+       * server-src/amadmin.c: use it
+       * server-src/amindexd.c restore-src/amfetchdump.c: use 'w' to prefer
+         the oldest-written copy of a dump
+
+2008-10-30  Jean-Louis Martineau <martineau@zmanda.com>
+       * application-src/amgtar_perl.pl, application-src/amstar.c,
+         application-src/amgtar.c: Implement validate command.
+       * server-src/amcheckdump.pl: Execute the validate command of an
+                                    application.
+       * perl/Amanda/Script_App.pm (print_to_server): Add validate.
+       * perl/Amanda/Application.pm (known_commands): Add validate.
+       * common-src/security-util.c: Fix typo.
+
+2008-10-29  Dustin J. Mitchell <dustin@zmanda.com>
+       * man/xml-source/amanda.conf.5.xml
+         man/xml-source/amanda-devices.7.xml: improve device property
+         documentation
+
+2008-10-29  Dustin J. Mitchell <dustin@zmanda.com>
+       * man/xml-source/amanda.conf.5.xml: taperflush params can be
+         greater than 100%
+
+2008-10-27  Jean-Louis Martineau <martineau@zmanda.com>
+       * common-src/fileheader.c (dumpfile_free_data): New function.
+       * common-src/fileheader.h (dumpfile_free_data): New prototype.
+       * server-src/cmdline.c, server-src/dumper.c,
+         server-src/planner.c, server-src/amadmin.c,
+         server-src/amflush.c, server-src/holding.c,
+         server-src/driver.c, server-src/find.c,
+         server-src/taper-source.c, server-src/taper-file-source.c
+         server-src/taper.c: Call dumpfile_free or dumpfile_free_data.
+
+2008-10-27  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/glib-util.c: check library version at runtime
+
+2008-10-27  Jean-Louis Martineau <martineau@zmanda.com>
+       * perl/Amanda/Device.swg (start_file): Remove const for jobInfo.
+
+2008-10-24  Dustin J. Mitchell <dustin@zmanda.com>
+       * installcheck/Amanda_Archive.pl: fix to also test for identity of
+         $user_data on perls that recognize such things
+
+2008-10-24  Dustin J. Mitchell <dustin@zmanda.com>
+       * amar-src/amar-test.c: don't ignore the return value of write()
+
+2008-08-14  Nikolas Coukouma <atrus@zmanda.com>
+            Jean-Louis Martineau <martineau@zmanda.com>
+       * amar-src/amar.c: fix mis-aligned memory accesses
+       * amar-src/amar-test.c: fix test_pipe
+
+2008-10-24  Jean-Louis Martineau <martineau@zmanda.com>
+       * perl/Amanda/Script_App.pm: New base module for script and application.
+       * perl/Amanda/Script.pm: New base module for script.
+       * perl/Amanda/Application.pm: New base module for application.
+       * perl/Makefile.am: Add Amanda::Script_app, Amanda::Script And
+                               Amanda::Application.
+       * application-src/generic-dumper.pl: Remove file.
+       * application-src/generic-script.pl: Remove file.
+       * application-src/script-email.pl: Use Amanda::Script.
+       * application-src/amgtar_perl.pl: Use Amanda::Application.
+       * application-src/amzfs-snapshot.pl: Use Amanda::Script.
+       * application-src/Makefile.am: Remove generic-*.pl files.
+
+2008-10-24  Dustin J. Mitchell <dustin@zmanda.com>
+       * perl/Amanda/Archive.swg perl/Makefile.am: add a Perl interface to
+         libamar
+       * installcheck/Amanda_Archive.pl installcheck/Makefile.am: test it.
+
+2008-10-24  Dustin J. Mitchell <dustin@zmanda.com>
+       * */Makefile.am: change @AMLINT@ to $(AMLINT), similarly for
+         $(AMLINTFLAGS), and strip $(EXEEXT) from program names when running
+         lint
+       * config/amanda/libs.m4: put GLIB_CFLAGS in AMANDA_CPPFLAGS
+
+2008-10-23  Dustin J. Mitchell <dustin@zmanda.com>
+       * amar-src/Makefile.am: add amar.h to noinst_HEADERS
+
+2008-10-23  Dustin J. Mitchell <dustin@zmanda.com>
+       * configure.in Makefile.am amar-src/Makefile.am: new directory
+       * amar-src/amar.c amar-src/amar.h: amanda archive library
+       * amar-src/amar-test.c: tests for library
+       * common-src/security-util.c common-src/security-util.h
+         common-src/util.c common-src/util.h: move net_writev to
+         util.c, rename to full_writev
+       * man/Makefile.am man/xml-source/amanda-archive-format.7.xml
+         man/xml-source/amanda.8.xml: new manpage to describe the format
+
+2008-10-20 Nikolas Coukouma <atrus@zmanda.com>
+       * configure.in: add tests for more headers, plus some defines
+         for the presence of Amanda's headers
+       * device-src/s3-util.c, device-src/s3-util.h: Use defines to switch between
+         POSIX regex API and a GRegex (PCRE) call-compatability layer.
+       * device-src/s3.c, device-src/s3.h: Add a curl progress callback.
+         Use callbacks to write and read data. Provide callbacks for
+         memory buffers and files. The callbacks for files are currently
+         Windows-specific.
+       * device-src/s3-device.c: update to use new API
+
+2008-10-20  Dustin J. Mitchell <dustin@zmanda.com>
+       * perl/Makefile.am: remove spurious variables
+
+2008-10-17  Jean-Louis Martineau <martineau@zmanda.com>
+       * changer-src/chg-multi.sh: Check permission on the statefile and its
+                                   directory.
+
+2008-10-17  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/planner.c: Set i to 0.
+
+2008-10-17  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/amcheck.c, server-src/dumper.c
+         server-src/planner.c: Don't send appliaciton-api request if the
+                               client doesn't use the xml protocol.
+
+2008-10-15  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/reporter.c: print space instead of N/A, dumper stats are
+                                set to "FLUSH" if it is a flush.
+
+2008-10-13  Dustin J. Mitchell <dustin@zmanda.com>
+       * device-src/vfs-device.c: re-open the dir handle on every
+         device start or read label
+       * installcheck/Amanda_Device.pl: adjust tests to degrade the
+         VFS device *after* it is started
+
+2008-10-13  Jean-Louis Martineau <martineau@zmanda.com>
+       * perl/Makefile.am: Moce EXTRA_DIST out of conditionals.
+
+2008-10-13  Jean-Louis Martineau <martineau@zmanda.com>
+       * installcheck/Makefile.am: revert previous commit.
+       * config/automake/scripts.am: Check for a server perl module.
+
+2008-10-13  Jean-Louis Martineau <martineau@zmanda.com>
+       * installcheck/Makefile.am: SCRIPTS_PERL = $(tests).
+
+2008-10-13  Jean-Louis Martineau <martineau@zmanda.com>
+       * perl/Makefile.am: Don't check Amanda/Config files.
+
+2008-10-11  Jean-Louis Martineau <martineau@zmanda.com>
+       * perl/Makefile.am: Check file in top_srcdir if they are not
+                           in top_builddir.
+
+2008-10-10  Jean-Louis Martineau <martineau@zmanda.com>
+       * common-src/amgetconf.pl: remove 'use Amanda::Device qw( :constants);'
+
+2008-10-10  Jean-Louis Martineau <martineau@zmanda.com>
+       * perl/Makefile.am: test for libConfig.so before doing check.
+
+2008-10-10  Jean-Louis Martineau <martineau@zmanda.com>
+       * config/automake/scripts.am: Check perl scripts on compilation.
+         Add -I... to 'make check' to access perl module in build tree.
+         Add installcheck rules to check perl scripts with installed perl
+         modules.
+       * application-src/amstar_perl.pl: Remove file.
+       * device-src/Makefile.am, application-src/Makefile.am,
+         server-src/Makefile.am, installcheck/Makefile.am,
+         common-src/Makefile.am: Move most perl scripts to CHECK_PERL.
+       * installcheck/Makefile.am:
+         Add "CHECK_PERL_FLAGS=-I$(top_srcdir)/installcheck".
+       * perl/Makefile.am: Add rules to check all .pm files for check-local.
+       * device-src/amtapetype.pl, server-src/amaddclient.pl,
+         common-src/amgetconf.pl: Fix syntax errors.
+
+2008-10-10  Jean-Louis Martineau <martineau@zmanda.com>
+       * application-src/amzfs-snapshot.pl, application-src/amoracle.pl
+         application-src/script-email.pl, application-src/amgtar_perl.pl:
+           fix typos.
+
+2008-10-10  Nick Smith <nick.smith@techop.ch>
+       * application-src/amzfs-snapshot.pl: fix typos
+
+2008-10-08  Dustin J. Mitchell <dustin@zmanda.com>
+       * perl/Amanda/DB/Catalog.pm: manage the tapelist internally
+       * perl/Amanda/Tapelist.swg: fix error message, re-read C tapelist
+         after writing
+       * server-src/amcheckdump.pl: don't read tapelist
+       * installcheck/Amanda_DB_Catalog.pl: don't read tapelist first
+
+2008-10-08  Nick Smith <nick.smith@techop.ch>
+       * server-src/driver.c: set degr_mesg to NULL when not degraded
+
+2008-10-06  Jean-Louis Martineau <martineau@zmanda.com>
+       * application-src/amzfs-snapshot.pl: Accept execute-where argument.
+       * application-src/script-email.pl: Accept execute-where argument.
+       * client-src/client_util.c: Send execute-where argument to script.
+       * server-src/server_util.c: Send execute-where argument to script.
+
+2008-10-06  Jean-Louis Martineau <martineau@zmanda.com>
+       * application-src/amzfs-snapshot.pl: Add PFEXEC-PATH and PFEXEC
+                                            properties.
+       * man/xml-source/amzfs-snapshot.8.xml: Document new properties.
+
+2008-10-03  Dustin J. Mitchell <dustin@zmanda.com>
+       * perl/Amanda/Util.swg: add Amanda::Util::generate_timestamp
+       * common-src/timestamp.c: add comment
+
+2008-10-02  Dustin J. Mitchell <dustin@zmanda.com>
+       * perl/Amanda/DB/Catalog.pm: add rudimentary ability to read logfiles
+       * installcheck/Amanda_DB_Catalog.pl: test it
+       * perl/Amanda/Logfile.swg: fix typo
+
+2008-10-01  Nikolas Coukouma <atrus@zmanda.com>
+       * device-src/s3-device.c, device-src/s3.c, device-src/s3.h:
+         Add new property, S3_SSL, to control the use of SSL/TLS when
+         connecting to Amazon S3
+       * man/xml-source/amanda-devices.7.xml:
+         document S3_SSL and S3_BUCKET_LOCATION
+
+2008-10-01  Nikolas Coukouma <atrus@zmanda.com>
+       * device-src/s3-util.c: Re-implement s3_hex_encode() to avoid OpenSSL weirdness.
+
+2008-10-01  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/amanda.h common-src/conffile.c
+         oldrecover-src/extract_list.c recover-src/extract_list.c
+         server-src/amcheck.c server-src/amflush.c server-src/planner.c:
+         use g_ascii_isspace, as we assume ASCII (for now) and isspace()
+         is affected by locale and encoding settings.  Thanks to Michael
+         Reuland for helping track this down.
+
+2008-09-30  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/diskfile.h (xml_optionstr): New prototype.
+       * server-src/diskfile.h (clean_dle_str_for_client): Prototype.
+       * server-src/amindexd.c: Pass 0 to new argument of xml_optionstr.
+       * server-src/amcheck.c: Pass 0 to new argument of xml_optionstr.
+       * server-src/planner.c: Pass 0 to new argument of xml_optionstr.
+       * server-src/driverio.c: Pass 1 to new argument of xml_optionstr.
+       * server-src/dumper.c: Call clean_dle_str_for_client.
+       * server-src/diskfile.c (xml_optionstr): Work for ENCRYPT_SERV_CUST.
+       * server-src/diskfile.c (clean_dle_str_for_client): New function.
+       * restore-src/restore.c: Call clean_dle_str_for_client.
+       * common-src/amxml.c: Fix parsing.
+       * common-src/amanda.h (match_no_newline): Prototype.
+       * common-src/match.c (match_no_newline): New function.
+
+2008-09-30  Dustin J. Mitchell <dustin@zmanda.com>
+       * restore-src/restore.c: set data.flags for use by the changer_find
+         callback
+
+2008-09-30  Dustin J. Mitchell <dustin@zmanda.com>
+       * perl/Amanda/MainLoop.swg: add call_later()
+       * installcheck/Amanda_MainLoop.pl: test it
+
+2008-09-30  Dustin J. Mitchell <dustin@zmanda.com>
+       * device-src/rait-device.c: fix typos
+
+2008-09-30  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/semaphore.h: fix typo
+       * device-src/rait-device.c: add a private threadpool-like
+         implementation for old glibs, where GThreadPool is susceptible to
+         deadlock
+
+2008-09-29  Dustin J. Mitchell <dustin@zmanda.com>
+       * device-src/device.c device-src/device.h device-src/null-device.c
+         device-src/property.c device-src/property.h device-src/rait-device.c
+         device-src/s3-device.c device-src/tape-aix.c device-src/tape-device.c
+         device-src/tape-device.h device-src/tape-ops.h device-src/tape-posix.c
+         device-src/tape-uware.c device-src/tape-xenix.c
+         device-src/vfs-device.c: add a 'configure' method to the Device API;
+         revamp device property handling to add source and surety and make
+         implementation easier
+       * device-src/rait-device.h device-src/rait-device.c: make RAIT device
+         calculate block sized based on child devices, if they were configured
+         explicitly.
+       * man/xml-source/amanda-devices.7.xml: note that common properties are
+         not implemented on all devices
+       * common-src/glib-util.c common-src/glib-util.h: add helpers for
+         case-insensitive hashes
+       * changer-src/scsi-changer-driver.c installcheck/Amanda_Device.pl
+         perl/Amanda/Device.swg restore-src/restore.c server-src/amcheck.c
+         server-src/amlabel.c server-src/amtape.c server-src/taper.c
+         server-src/taperscan.c: use new API
+
+2008-09-29  Dustin J. Mitchell <dustin@zmanda.com>
+       * server-src/find.c: handle find_result->label == NULL
+       * perl/Amanda/DB/Catalog.pm: filter out bogus results with NULL label
+
+2008-09-26  Dustin J. Mitchell <dustin@zmanda.com>
+       * perl/amglue/ghashtable.c: #include conffile.h, not conffile.c (!)
+
+2008-09-26  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/driver.c: Parse dumpsize from taper result.
+
+2008-09-26  Jean-Louis Martineau <martineau@zmanda.com>
+       * client-src/selfcheck.c: Set qdevice on common_exit path.
+
+2008-09-25  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/fileheader.c: fix headers_are_equal
+
+2008-09-25  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/fileheader.c common-src/fileheader.h: allow blocksize=0
+       * device-src/device.c device-src/device.h: set blocksize in tape
+         header
+       * device-src/null-device.c device-src/s3-device.c
+         device-src/tape-device.c device-src/vfs-device.c: set blocksize
+         in headers when starting files
+       * device-src/rait-device.c: duplicate headers for child devices, since
+         they are no longer const
+       * server-src/dumper.c: set blocksize on holding-disk files to
+         DISK_BLOCK_BYTES
+
+2008-09-25  Dustin J. Mitchell <dustin@zmanda.com>
+       * device-src/tape-device.c: mark device as non-appendable temporarily,
+         since file numbers are incorrect when appending
+       * installcheck/Amanda_Device.pl: handle non-appendable devices
+
+2008-09-24  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/driverio.c (dumper_cmd, chunker_cmd): Take new mesg
+         argument.
+       * server-src/server_util.h (dumper_cmd, chunker_cmd): New prototype.
+       * server-src/chunker.c: Get mesg from ABORT cmd and log it.
+       * server-src/driver.c: Add the mesg argument to all dumper_cmd and
+                              chunker_cmd.
+
+2008-09-24  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/planner.c: Set degr_mesg and send it to driver.
+       * server-src/driverio.h (sched_t): Add degr_mesg field.
+       * server-src/driver.c: Parse message if no degraded estimate.
+
+2008-09-23  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/conffile.c common-src/conffile.h: store a struct
+         containing both filename and line number for each parameter, and use
+         it when reporting errors and warnings
+
+2008-09-23  Dustin J. Mitchell <dustin@zmanda.com>
+       * device-src/device.c: make 'unimplemented method' an assertion
+
+2008-09-23  Dustin J. Mitchell <dustin@zmanda.com>
+       * device-src/s3.c: use max_keys, instead of maximum body size (which
+         doesn't work) to limit the number of keys listed
+
+2008-09-22  Jean-Louis Martineau <martineau@zmanda.com>
+       * common-src/fileheader.c (fh_init): Set default type to F_EMPTY.
+       * changer-src/chg-zd-mtx.sh: Allow to remove barcode from barcode file.
+       * server-src/taperscan.c: Check type != F_EMPTY.
+       * server-src/taper.c: Call changer_label().
+       * server-src/amlabel.c: iCheck type != F_EMPTY. Call changer_label().
+
+2008-09-22  Jean-Louis Martineau <martineau@zmanda.com>
+       * device-src/device.c: Don't g_value_unset a bzero value.
+
+2008-09-22  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/driver.c: Set result_argv=NULL, Fix typo.
+
+2008-09-22  Dustin J. Mitchell <dustin@zmanda.com>
+       * config/amanda/ps.m4: give up on runtime detection and just special-
+         case the 'ps' arguments for various systems
+       * perl/Amanda/Constants.pm.in: add $PS
+       * perl/Amanda/Process.pm: use $PS
+
+2008-09-19  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/reporter.c (addline): Done it constant time.
+
+2008-09-19  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/Makefile.am common-src/quoting-test.c: new tests
+       * common-src/token.c common-src/token.h: removed
+       * common-src/util.c common-src/util.h: new home for quoting functions
+       * configure.in: don't check for shquote
+       * man/xml-source/amanda.conf.5.xml: info on quoting
+       * perl/Amanda/Config/Server.pm: note about incompatibility
+       * server-src/amcheck.c server-src/amindexd.c server-src/chunker.c
+         server-src/driver.c server-src/driverio.c server-src/driverio.h
+         server-src/dumper.c server-src/infofile.c server-src/server_util.c
+         server-src/server_util.h server-src/taper-file-source.c
+         server-src/taper-port-source.c server-src/taper.c: use new/updated
+         quoting functions
+
+2008-09-19  Nick Smith <nick.smith@techop.ch>
+       * example/amanda.conf.in: fix incorrect execute_on examples
+
+2008-09-18  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/dumper.c: Call security_close_connection before
+                              checking if pkt == NULL.
+
+2008-09-18  Jean-Louis Martineau <martineau@zmanda.com>
+       Patch by Nick Smith
+       * server-src/diskfile.c: Fix vstrextend use, Patch by Nick Smith.
+       * server-src/diskfile.c: Init xml_app.result to stralloc("").
+
+2008-09-16 Dan Locks <dwlocks@zmanda.com>
+       * packaging/rpm/amanda.spec:  Added detection of CentOS 4 and 5 as 
+         suggested by dswartz.  added graceful failure when Distro/version is 
+         not detected correctly
+
+2008-09-15  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/conffile.c: uninit apps, pp_scripts, and device_configs
+
+2008-09-14  Dustin J. Mitchell <dustin@zmanda.com>
+       * server-src/tapefile.c server-src/tapefile.h: add comments to
+         tapelist
+       * perl/Amanda/Tapelist.swg: perl tapelist parser, too
+       * installcheck/Amanda_Tapelist.pl: tests
+       * man/xml-source/tapelist.5.xml: docs
+       * server-src/amlabel.c: no initial comments when labeling
+       * server-src/taper.c: maintain comment when relabeling
+
+2008-09-12  Jean-Louis Martineau <martineau@zmanda.com>
+       * amandad-src/amandad.c: Fix typo: authetication -> authentication.
+
+2008-09-05  Dustin J. Mitchell <dustin@zmanda.com>
+       * man/xml-source/amanda.conf.5.xml: fix inequalities; thanks to
+         Mike McConnell for spotting these
+
+2008-09-05  Dustin J. Mitchell <dustin@zmanda.com>
+       * server-src/taper.c: improve handling of device errors in taper
+
+2008-09-02  Jean-Louis Martineau <martineau@zmanda.com>
+       * restore-src/amrestore.c: Load a default server config.
+
+2008-08-29  Dustin J. Mitchell <dustin@zmanda.com>
+       * autogen: revert glib's configure-time requirement for
+         pkg-config-0.16
+
+2008-08-28  Dustin J. Mitchell <dustin@zmanda.com>
+       * device-src/tape-device.c: use the correct blocksize while reading
+       * device-src/rait-device.c: fix typo
+       * installcheck/Amanda_Device.pl: use the VFS device in RAIT tests, not
+         the tape device
+
+2008-08-28  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/dumper.c: Reset the MESG buffer for a new dump.
+
+2008-08-27  Dustin J. Mitchell <dustin@zmanda.com>
+       * server-src/amcheck.c: make the check for tapelist result in a NOTE,
+         not a failure
+       * server-src/tapefile.c: make a missing tapelist equivalent to an
+         empty one
+
+2008-08-27  Dustin J. Mitchell <dustin@zmanda.com>
+       * config/amanda/types.m4: always include sys/types.h, if it exists,
+         before trying other headers (fixes builds of FreeBSD-4.x); thanks
+         to John Hein <jhein@timing.com>
+       * perl/Amanda/MainLoop.swg server-src/driverio.h: include amanda.h
+         before event.h
 
 2008-08-22  Dustin J. Mitchell <dustin@zmanda.com>
        * perl/amglue/bigint.c: add #include "stdint.h"
 
+2008-08-22  Dustin J. Mitchell <dustin@zmanda.com>
+       * config/amanda/ps.m4: search multiple ps invocations; thanks
+         to John Hein <jhein@timing.com>
+
 2008-08-22  Jean-Louis Martineau <martineau@zmanda.com>
-       * server-src/amadmin.c (tape): Correctly print next tape to use.
+       * server-src/amadmin.ci (tape): Correctly print next tape to use.
        * server-src/tapefile.c (print_new_tapes): New function to print new
-                                                  tapes.
+                                                  tapes.
        * server-src/tapefile.h (print_new_tapes): Prototype.
        * server-src/reporter.c: Correctly print next tape to use.
 
 2008-08-22  Dustin J. Mitchell <dustin@zmanda.com>
-       Thanks to Stefan G. Weichinger <sgw@amanda.org>
-       * server-src/taper.c: check errors from device, and handle them by
-         either requesting a new tape or just using the next tape in the
-         changer
-
-2008-08-22  Olivier Nicole <on@cs.ait.ac.th>
-       * changer-src/chg-disk.sh: replace == with =
+       * common-src/conffile.c common-src/conffile.h perl/Amanda/Config.swg:
+         add new 'define device' config section
+       * perl/Makefile.am perl/Amanda/Config/Server.pm
+         perl/Amanda/Config/Server/Devices.pm
+         perl/Amanda/Config/Server/Grammar: ditto
+       * device-src/device.c device-src/device.h: configure devices from
+         device definitions, with better error handling
+       * device-src/rait-device.c: handle child devices better
+       * installcheck/Amanda_Config.pl installcheck/Amanda_Config_Server.pl
+         installcheck/Amanda_Xfer.pl installcheck/Installcheck/Config.pm
+         installcheck/amgetconf.pl: new tests, modifications to work with the
+         new system
+       * man/xml-source/amanda-devices.7.xml
+         man/xml-source/amanda.conf.5.xml: corresponding documentation updates
+       * perl/Amanda/Changer.pm perl/Amanda/Device.swg
+         restore-src/amrestore.c restore-src/restore.c server-src/amcheck.c
+         server-src/amcheckdump.pl server-src/amdevcheck.pl
+         server-src/amlabel.c server-src/amtape.c server-src/taper.c
+         server-src/taperscan.c: remove calls to
+         set_startup_properties_from_config
+       * device-src/vfs-test.c: load config before trying to use a device
+       * common-src/conffile.c: fix use of uninitialized variable
 
 2008-08-22  Dustin J. Mitchell <dustin@zmanda.com>
+       * changer-src/chg-disk.sh: replace == with =
        * changer-src/chg-lib.sh.in: fix sed invocation for BSD's sed
 
 2008-08-22  Jean-Louis Martineau <martineau@zmanda.com>
        * server-src/reporter.c: Fix computation of compression ratio.
 
-2008-08-21  Jean-Louis Martineau <martineau@zmanda.com>
-       * common-src/krb5-security.c: Fix security_seterror use.
+2008-08-22  Jean-Louis Martineau <martineau@zmanda.com>
+       * client-src/sendbackup.h: Add DMP_IGNORE and AM_IGNORE_RE.
+       * application-src/amgtar.c, application-src/amgtar_perl.pl:
+         Ignore "Directory is new" and "Directory has been renamed".
 
 2008-08-21  Jean-Louis Martineau <martineau@zmanda.com>
-       * device-src/queueing.c: Fix compiler warning.
+       * common-src/krb5-security.c: Fix security_seterror use.
 
 2008-08-19  Dustin J. Mitchell <dustin@zmanda.com>
        * configure.in: check for getgrgid_r and getpwuid_r
        * common-src/version.h: remove #include of config.h
        * device-src/vfs-device.c: #include amanda.h first
 
+2008-08-18  Dustin J. Mitchell <dustin@zmanda.com>
+       * device-src/Makefile.am device-src/amtapetype.pl: new perl amtapetype
+       * installcheck/Installcheck/Run.pm: report exit status
+       * installcheck/Makefile.am installcheck/amtapetype.pl: new test
+       * man/xml-source/amtapetype.8.xml: updated manpage
+       * device-src/s3-device.c device-src/vfs-device.c
+         device-src/tape-device.c: add compression property
+       * perl/Amanda/Xfer.swg: add POD for the cancel() method
+       * xfer-src/dest-device.c: add a default for max_memory
+
+2008-08-18  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/conffile.c: make find_multiplier case-insensitive
+       * device-src/device.c: reorder assertions
+       * device-src/tape-device.c: don't set access_mode twice, but
+         set in_file = FALSE in start
+       * device-src/s3-device.c: fix property registration
+       * perl/Amanda/MainLoop.swg: remove attach() from example
+       * perl/Amanda/Xfer.swg: more detail in POD
+       * xfer-src/source-pattern.c: operate byte-for-byte, like the random
+         source, instead of using lots of memcpys and reallocs
+       * xfer-src/source-random.c: remove redundant check
+
+2008-08-18  Dustin J. Mitchell <dustin@zmanda.com>
+       * configure.in Makefile.am tape-src/*: remove tape-src
+       * changer-src/Makefile.am: don't link with libamtape
+       * changer-src/chg-scsi.c: don't use libamtape
+       * changer-src/scsi-changer-driver.c: don't use libamtape
+       * config/amanda/tape.m4: fix comment
+       * example/amanda.conf.in example/template.d/tapetypes: fix outdated
+         comments
+       * man/Makefile.am man/xml-source/amdd.8.xml man/xml-source/ammt.8.xml:
+         remove amdd and ammt manpages
+       * restore-src/Makefile.am: remove refs to tape-src/
+       * server-src/Makefile.am: remove refs to tape-src/
+
+2008-08-18  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/krb4-security.c common-src/krb5-security.c
+         config/amanda/tape.m4 common-src/amanda.h: remove
+         --with-maxtapeblocksize
+       * common-src/conffile.c: deprecate file-pad
+       * device-src/device-queueing.c device-src/device-queueing.h
+         device-src/device.c device-src/device.h device-src/null-device.c
+         device-src/property.c device-src/property.h device-src/rait-device.c
+         device-src/s3-device.c device-src/tape-device.c
+         device-src/tape-device.h device-src/vfs-device.c server-src/amcheck.c
+         server-src/taper.c tape-src/tapeio.c xfer-src/dest-device.c
+         xfer-src/source-device.c perl/Amanda/Device.swg: devices have
+         {min,max,current} block sizes; remove the short_block parameter from
+         device_write_block; fix property initialization; rename
+         PROPERTY_MEDIUM_TYPE to PROPERTY_MEDIUM_ACCESS_TYPE
+       * device-src/rait-device.c: set child block sizes explicitly
+       * installcheck/Amanda_Device.pl: tests; better S3 test count
+         calculations
+       * installcheck/Amanda_Xfer.pl: tests
+       * man/xml-source/amanda-devices.7.xml: update block sizes
+         documentation
+       * man/xml-source/amanda.conf.5.xml: refer to block size properties
+       * restore-src/amrestore.c: use set_restore_device_read_buffer_size
+       * restore-src/restore.h restore-src/restore.c: add
+         set_restore_device_read_buffer_size
+
+2008-08-16  Dustin J. Mitchell <dustin@zmanda.com>
+       * server-src/driver.c: handle taper_{input,tape}_error memory
+         correctly, and add taper_tape_error to the trace log
+
+2008-08-16  Dustin J. Mitchell <dustin@zmanda.com>
+       * application-src/amzfs-snapshot.pl application-src/script-email.pl:
+         remove unnecessary 'use Amanda::Device'
+
+2008-08-16  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/amgetconf.pl: use filename-safe characters for $appname
+       * installcheck/amgetconf.pl: test it
+
+2008-08-16  Dustin J. Mitchell <dustin@zmanda.com>
+       * man/entities/global.entities: add manpage refs
+       * packaging/rpm/amanda_enterprise.spec
+         packaging/rpm/amanda_enterprise_client.spec
+         man/xml-source/disklist.5.xml man/xml-source/tapelist.5.xml
+         man/Makefile.am: add disklist(5), tapelist(5)
+       * man/xml-source/amaddclient.8.xml man/xml-source/amadmin.8.xml
+         man/xml-source/amanda-client.conf.5.xml man/xml-source/amanda.8.xml
+         man/xml-source/amanda.conf.5.xml man/xml-source/amcheck.8.xml
+         man/xml-source/amcheckdb.8.xml man/xml-source/amdevcheck.8.xml
+         man/xml-source/amflush.8.xml man/xml-source/amlabel.8.xml
+         man/xml-source/amrecover.8.xml man/xml-source/amrmtape.8.xml:
+         - remove references to "output drivers" in favor of "device drivers"
+         - add more inter-page references
+         - fix typos
+         - add client_login to amanda-client.conf(5)
+         - reformat informaltables, which don't render well in HTML or nroff,
+           into variablelists, with fixes for bad xml->man conversion
+         - fix funky replacement entities in HTML output
+       * perl/Amanda/DB/Catalog.pm: mention $dump->{kb} and ->{sec}
+       * perl/Amanda/Device.swg: fix typo
+       * perl/Amanda/MainLoop.swg: add hints for writing async functions
+       * perl/Amanda/Types.swg: fix bad POD
+       * perl/Amanda/Util.swg: POD fix: use $CONTEXT_* rather than strings
+       * perl/Amanda/Xfer.swg: tweaks
+       * server-src/taper.c: fix typo
+       * server-src/taperscan.c: remove "(previously non-amanda)", as Amanda
+         will no longer overwrite such tapes
+
+2008-08-16  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/debug.c: lock debug logging on a per-line basis
+
+2008-08-16  Dustin J. Mitchell <dustin@zmanda.com>
+       * device-src/rait-device.c: parse RAIT names with internal {..}
+       * installcheck/Amanda_Device.pl: light testing
+
 2008-08-15  Dustin J. Mitchell <dustin@zmanda.com>
        * common-src/debug.c: include backtraces on fatal errors
        * config/amanda/debugging.m4: look for glibc's backtrace support
        * configure.in: ditto
 
-2008-08-05 Dan Locks <dwlocks@zmanda.com>
-       * packaging/rpm/amanda.spec:  Merged fixes from trunk .spec for
-         parsing redhat-release for fedora versions correctly.
+2008-08-14  Dustin J. Mitchell <dustin@zmanda.com>
+       * device-src/tape-aix.c device-src/tape-ops.h device-src/tape-uware.c
+         device-src/tape-xenix.c: bring non-POSIX tape-ops implementations up
+         to date with function signatures
+
+2008-08-14  Dustin J. Mitchell <dustin@zmanda.com>,
+           Nikolas Coukouma <atrus@zmanda.com>
+       * xfer-src/*: add support for asynchronous cancellation of transfers
+         and use it for error-handling
+       * perl/Amanda/Xfer.swg: reflect into perl
+       * installcheck/Amanda_Xfer.pl: test cancellation
+
+2008-08-12  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/Makefile.am: clean up svn-info.h on maintainer-clean
+       * man/Makefile.am: remove config.log after running config.status
+
+2008-08-07 Nikolas Coukouma <atrus@zmanda.com>
+       * common-src/conffile.c: cleaner fix for signed compared to unsigned
+         errors on older versions of GCC.
+
+2008-08-06  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/Makefile.am: second fix
+
+2008-08-06  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/Makefile.am: don't syntax-check amgetconf, since
+         it uses Amanda::* modules
+
+2008-08-06 Nikolas Coukouma <atrus@zmanda.com>
+       * server-src/amgetconf.pl, common-src/amgetconf.pl:
+         Add --execute-where=client|server and --client options
+         to make amgetconf query the client configuration
+         instead. Move from server-src to common-src.
+       * man/xml-source/amgetconf.8.xml: Document the new options.
+       * installcheck/amgetconf.pl: Test the new options.
+       * server-src/Makefile.am, common-src/Makefile.am:
+         Updated Makefiles for move.
+       * packaging/deb/amanda-enterprise-backup-client.install,
+         packaging/sun-pkg/i386/client/prototype:
+         Add amgetconf to client packages.
 
 2008-08-04 Dan Locks <dwlocks@zmanda.com>
        * packaging/rpm/amanda.spec:  add %{tarver} macro and set the correct
          minimum version per distro (Thanks to Jesse Angell for the rhel4 tip)
 
-2008-07-30  Dustin J. Mitchell <dustin@zmanda.com>
-       * perl/Amanda/Changer.pm perl/Amanda/Cmdline.swg
-         perl/Amanda/Config.swg perl/Amanda/DB/Catalog.pm
-         perl/Amanda/Device.swg perl/Amanda/Logfile.swg 
-         perl/Amanda/Util.swg: POD cleanup
-       * perl/Makefile.am: new files, rules to make HTML
-       * perl/amperl.css: CSS file for online POD
-       * perl/make_html.pl: make online POD
+2008-08-04  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/conffile.c: workaround gcc<4.1.0 problems with long
+         constants, don't use G_MAXINT64 in precompiler expressions
 
-2008-07-30  Dustin J. Mitchell <dustin@zmanda.com>
-       * man/Makefile.am man/amanda.css man/index.php man/xslt/html.xsl.in:
-         new files for HTML output
-       * man/xslt/man.xsl.in: substitute XSLT_VERS
-       * man/xml-source/amanda-devices.7.xml: tweaks
-       * man/xml-source/amanda.8.xml: tweaks
-       * man/xml-source/amanda.conf.5.xml: tweaks
-       * man/xml-source/amgetconf.8.xml: tweaks
-       * man/xml-source/amtoc.8.xml: tweaks
+2008-08-03  Dustin J. Mitchell <dustin@zmanda.com>
+       * server-src/amrmtape.sh: use shell redirection with shell functions
 
-2008-07-30 Dan Locks <dwlocks@zmanda.com>
-       * packaging/rpm/amanda.spec: removed activate-devpay from %files section
+2008-08-03  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/util.c: if !WORKING_IPV6, request AF_INET, not AF_NATIVE
+       * common-src/dgram.c: address family debugging
+       * common-src/stream.c: address family debugging
 
-2008-07-30 Dan Locks <dwlocks@zmanda.com>
-       * device-src/s3.c: Merged changes from 968 to work around a libcurl bug.
-       * config/amanda/s3-device.m4: Same
+2008-08-03  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/amanda.h common-src/conffile.c common-src/conffile.h
+         installcheck/Amanda_Config.pl perl/Amanda/Config.swg
+         server-src/planner.c: replace am64 type with gint64; also replace
+         some uses of off_t
+
+2008-08-01 Nikolas Coukouma <atrus@zmanda.com>
+       * perl/Amanda/BigIntCompat.pm: Add a module to make 'Math::BigInt's
+         stringify consistently (no '+' prefixing positive numbers).
+       * perl/Makefile.am: Add Amanda/BigIntCompat.pm for installation, etc.
+       * installcheck/bigint.pl, perl/amglue/bigint.c:
+         Use Amanda::BigIntCompat everywhere we use bigint.
+
+2008-08-01 Nikolas Coukouma <atrus@zmanda.com>
+       * common-src/match.c: Correct array index to be within bounds
+
+2008-08-01 Nikolas Coukouma <atrus@zmanda.com>
+       * config/amanda/flags.m4: Rename AMANDA_TEST_GCC_WARNING_FLAG to
+         AMANDA_TEST_GCC_FLAG and use AMANDA_ENABLE_GCC_WARNING where
+         appropriate. Add AMANDA_DISABLE_GCC_FEATURE. Disable strict-aliasing
+         (which causes errors).
 
 2008-07-30  Dustin J. Mitchell <dustin@zmanda.com>
        * installcheck/Amanda_Config.pl: add + to avoid perl-5.6.0 parsing bug
        * installcheck/amgetconf.pl: ditto
 
+2008-07-29 Dan Locks <dwlocks@zmanda.com>
+       * packaging/rpm/amanda.spec:  Merged fixes from enterprise .spec for
+         parsing redhat-release for fedora versions correctly.
+
+2007-07-28 Nikolas Coukouma <atrus@zmanda.com>
+       * config/amanda/flags.m4: Add proper detection of flags for GCC 4.3+
+
+2007-07-28 Nikolas Coukouma <atrus@zmanda.com>
+       * device-src/s3.c: Calculate and send the MD5 hash when uploading data.
+         Also check the returned ETag to make sure it matches the sent MD5 hash.
+         Use simpler s3_base64_encode() instead of base64_encode().
+         Correct the use of character classes in several regular expressions.
+       * device-src/s3-util.h, device-src/s3-util.c: Add utility functions
+         s3_base64_encode(), s3_hex_encode(), and s3_compute_md5_hash() as well
+         as some constants. Move regexec_wrap() into this and rename it to
+         s3_regexec_wrap().
+       * device-src/Makefile.am: add s3-util.c and s3-util.h
+
+2008-07-28  Dustin J. Mitchell <dustin@zmanda.com>
+       * installcheck/Installcheck/Config.pm: don't set default tapetype
+         unless not set explicitly.
+       * installcheck/Amanda_Config.pl: test changes
+       * man/xml-source/amanda-client.conf.5.xml
+         man/xml-source/amanda.conf.5.xml: encourage, but don't require,
+         quoted identifiers
+
 2008-07-28  Dustin J. Mitchell <dustin@zmanda.com>
-       * client-src/sendsize.c: remove cruft causing compile errors on HP/UX
+       * server-src/amserverconfig.pl: apply perltidy, factor some common
+         code, and create the config dir and changer conf only after the check
+         for mtx is performed
 
 2008-07-28  Dustin J. Mitchell <dustin@zmanda.com>
        * device-src/tests/semaphore-test.c: move function call out of
          libcurl-dev, libssl-dev.  Updated server and client dependency for curl
          to libcurl3
 
-2008-07-23  Dustin J. Mitchell <dustin@zmanda.com>
-       * common-src/conffile.c: fix handling for config overwrites of
-         non-string parameters
+2008-07-18 Dan Locks <dwlocks@zmanda.com>
+       *  configure.in:  add format-security to gcc compile flags
+       *  server-src/amindexd.c,
+          server-src/dumper.c,
+          server-src/reporter.c,
+          restore-src/restore.c,
+          common-src/security-util.c,
+          common-src/bsd-security.c:  replacemented unquoted strings in
+          function arguments with "%s", arg.  jrfranks's suggestion, dustin provided
+          syntax for the fix.
+
+2008-07-17 Dan Locks <dwlocks@zmanda.com>
+       * packaging/debian/amanda-enterprise-backup-*.install: added entries for
+         applications and devices man pages.
+         
+2008-07-17  Jean-Louis Martineau <martineau@zmanda.com>
+       * man/Makefile.am: Add amzfs-snapshot.8
+       * man/xml-source/amzfs-snapshot.8.xml: New man page.
+       * man/xml-source/amanda.8.xml: Add amzfs-snapshot.8
+       * man/xml-source/amanda-scripts.7.xml: Add amzfs-snapshot.8
+       * application-src/amzfs-snapshot.pl: New script
+       * application-src/Makefile.am: Add amzfs-snapshot
+       * perl/Amanda/Util.swg: Add sanitise_filename.
 
 2008-07-17  Jean-Louis Martineau <martineau@zmanda.com>
        * amandad-src/amandad.c: amandad must be run by root for krb5 auth.
 
-200i-07-14 Dan Locks <dwlocks@zmanda.com>
+2008-07-16  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/driver.c: Improve message in failure to dump in degraded
+                              mode.
+
+2008-07-16 Dan Locks <dwlocks@zmanda.com>
+       * packaging/deb/control,
+         packaging/rpm/amanda.spec: added explicit dependency on openssl, and a 
+         build dependency for openssl and curl development files.
+
+2008-07-15  Dustin J. Mitchell <dustin@zmanda.com>
+       * example/xinetd.amandaserver.in example/xinetd.amandaclient.in:
+         specifying both IPv{4,6} does not work; remove IPv4
+
+2008-07-15  Jean-Louis Martineau <martineau@zmanda.com>
+       * man/Makefile.am: Add new man pages.
+       * man/xml-source/script-email.8.xml: New man page.
+       * man/xml-source/amanda.8.xml: List new man pages.
+       * man/xml-source/amanda-scripts.7.xml: New man page.
+
+2008-07-15  Dustin J. Mitchell <dustin@zmanda.com>
+       * configure.in: generate (x)inetd files
+       * example/inetd.conf.amandaclient.in example/xinetd.amandaclient.in
+         example/xinetd.amandaserver.in: give appropriate path for amandad,
+         from configure (fixes builds on 64-bit machines)
+2008-07-15  Dustin J. Mitchell <dustin@zmanda.com>
+       * client-src/client_util.c: #include "glib-util.h"
+       * common-src/glib-util.c: New g_ptr_array_foreach fucntion.
+       * common-src/glib-util.h: Prototype of g_ptr_array_foreach.
+       * device-src/rait-device.c: Remove g_ptr_array_foreach.
+
+2008-07-15  Jean-Louis Martineau <martineau@zmanda.com>
+       * client-src/client_util.c: Read stdout of scripts.
+       * client-src/client_util.h: New prototype for run_client_scripts,
+                                   New client_script_result_t struct.
+       * client-src/sendbackup.c: Send scripts properties to application.
+       * client-src/sendsize.c: Send scripts properties to application.
+       * client-src/selfcheck.c: Send scripts properties to application.
+       * recover-src/extract_list.c: Send scripts properties to application.
+       * common-src/amxml.h (script_t) Add field to keep result of script.
+       * common-src/amxml.c: Set script->result to NULL.
+
+2008-07-14 Dan Locks <dwlocks@zmanda.com>
+       * packaging/rpm/amanda.spec: fix macro detection of fedora version
+
+2008-07-14 Dan Locks <dwlocks@zmanda.com>
        * packaging/rpm/amanda.spec: fix distribution detection, add
        activate-devpay to server files list
 
 2008-07-11  Dustin J. Mitchell <dustin@zmanda.com>
-       * device-src/rait-device.c: fix RAIT file numbers; don't pass
-         block-size-related properties down to child devices (we set the block
-         size in find_block_size); don't use union_robust for checking whether
-         labels changed, as it causes spurious failures
+       * installcheck/Amanda_Changer.pl: set up and parse a config, now that
+         Amanda::Changer needs one
 
 2008-07-11  Dustin J. Mitchell <dustin@zmanda.com>
-       Thanks to Stefan G. Weichinger <sgw@amanda.org>
-       * device-src/tape-*.c: return DEVICE_ERROR|VOLUME_MISSING on EIO while
-         checking tape_is_tape_device
-       * changer-src/chg-lib.sh.in: keep waiting for a device if it *might*
-         be busy or offline
+       * perl/Amanda/Changer.pm: set device properties when testing device
+         labels in the changer
 
-2008-07-09  Dustin J. Mitchell <dustin@zmanda.com>
-       * device-src/rait-device.c: rewrite g_ptr_array_union_robust to
-         correctly detect and handle child device failures
+2008-07-11  Jean-Louis Martineau <martineau@zmanda.com>
+       * application-src/amgtar.c: Add a DIRECTORY property.
+       * man/xml-source/amgtar.8.xml: Document DIRECTORY property.
+
+2008-07-11  Dustin J. Mitchell <dustin@zmanda.com>
+       * changer-src/chg-lib.sh.in: remove bogus Log() invocations
 
-2008-07-09  Dustin J. Mitchell <dustin@zmanda.com>
-       * perl/Amanda/Logfile.swg: POD tweaks
+2008-07-11  Dustin J. Mitchell <dustin@zmanda.com>
+       * man/xml-source/amanda.8.xml: fix amanda(8) formatting and add links
+         to new manpages
+
+2008-07-11  Dustin J. Mitchell <dustin@zmanda.com>
+       * installcheck/Amanda_Device.pl: be more liberal in the flags that are
+         accepted from S3's read_label; this will reduce false failures
+
+2008-07-11  Jean-Louis Martineau <martineau@zmanda.com>
+       * client-src/client_util.c: Remove unused output_tool_property function.
+       * client-src/client_util.h: Remove output_tool_property prototype.
+       * man/xml-source/amanda-client.conf.5.xml: Add application and script
+                                                  sections.
+       * man/xml-source/amanda.conf.5.xml: Improve application and script
+                                           sections.
+       * device-src/device.c: Fix for new property_t.
+       * server-src/diskfile.h: Change prototype for xml_application and
+                                xml_scripts.
+       * server-src/diskfile.c: Add <priority> tag if client support it.
+       * server-src/amindexd.c: Fix call to xml_application.
+       * server-src/amcheck.c: Fix call to xml_application.
+       * server-src/planner.c: Fix call to xml_application.
+       * server-src/driverio.c: Fix call to xml_application.
+       * server-src/server_util.c: Remove code to write property to stdin of
+                                   script.
+       * perl/Amanda/Config.swg: Fix for new property_t.
+       * perl/amglue/amglue.h: Prototype for g_hash_table_to_hashref_property.
+       * perl/amglue/ghashtable.c: New g_hash_table_to_hashref_property
+                                   function.
+       * installcheck/Amanda_Config.pl: Fix for new property_t.
+       * common-src/util.c: Remove unused output_tool_proplist fucntion,
+                            Fix for new property_t.
+       * common-src/util.h: Remove output_tool_proplist prototype.
+       * common-src/amxml.c:Fix for new property_t, parse priority of property.
+       * common-src/conffile.c: Parse priority of a property,
+                         Add application and script to amanda-client.conf.
+       * common-src/conffile.h: New property_t struct.
+       * common-src/amfeatures.h: New fe_xml_property_priority amfeature.
+       * common-src/amfeatures.c: New fe_xml_property_priority amfeature.
+
+2008-07-11  Jean-Louis Martineau <martineau@zmanda.com>
+       * man/entities/global.entities: Add ENTITY email.jlm.
+       * man/Makefile.am (CLIENT_MAN_PAGES): Set to amanda-applications.7,
+         amgtar.8 and amstar.8.
+       * man/xml-source/amanda.conf.5.xml: Fix </programlisting>, it must be
+                                           at the begining of a line.
+       * man/xml-source/amanda-applications.7.xml: New page.
+       * man/xml-source/amgtar.8.xml: New page.
+       * man/xml-source/amstar.8.xml: New page.
+
+2008-07-09  Ian Turner <ian@zmanda.com>
+       * device-src/device.h: Clarify documentation of device_read_label().
+       * device-src/s3-device.c, device-src/tape-device.c,
+         device-src/vfs-device.c (device_read_label): Always clear volume
+         labels, even if device is in error.
+       * device-src/rait-device.c: Ditto; also properly handle properties
+         that change device labels.
+
+2007-07-09 Nikolas Coukouma <nikolas@zmanda.com>
+       * man/xml-source/amanda-devices.7.xml: Document the S3_BUCKET_LOCATION
+         property (for setting location constraints).
+
+2008-07-08  Dustin J. Mitchell <dustin@zmanda.com>
+       * device-src/vfs-device.c device-src/tape-device.c: do not autofinish
+         when EOF occurs on writing
+
+2008-07-08  Dustin J. Mitchell <dustin@zmanda.com>, 
+           Nikolas Coukouma <nikolas@zmanda.com>,
+           Ian Turner <ian@zmanda.com>,
+           Jean-Louis Martineau <martineau@zmanda.com>
+       Amanda has been analyzed with Klocwork source code analysis, the most
+       accurate and comprehensive tool for finding critical programming
+       errors and security vulnerabilities.
+       * amandad-src/amandad.c changer-src/chg-scsi.c
+         client-src/client_util.c client-src/selfcheck.c
+         client-src/sendbackup.c client-src/sendsize.c common-src/amfeatures.c
+         common-src/bsd-security.c common-src/fileheader.c
+         common-src/local-security.c common-src/queueing.c
+         common-src/security-util.c device-src/property.c
+         device-src/rait-device.c device-src/tape-device.c
+         device-src/vfs-device.c recover-src/set_commands.c
+         restore-src/amidxtaped.c restore-src/amrestore.c restore-src/restore.c
+         server-src/amadmin.c server-src/amcheck.c server-src/amindexd.c
+         server-src/changer.c server-src/chunker.c server-src/cmdline.c
+         server-src/driver.c server-src/holding.c server-src/logfile.c
+         server-src/reporter.c server-src/server_util.c
+         server-src/taper-file-source.c: fix many issues identified
+         by Klockwork, ranging in severity from stylistic to minor.
+          - many memory leaks in error paths and application shutdown
+          - better handling of incorrect commandline arguments
+          - better resource management (file descriptors, etc.)
+
+2008-07-07 Nikolas Coukouma <nikolas@zmanda.com>
+       * device-src/Makefile.am: conditionalize activate-devpay on
+         WANT_S3_DEVICE
+
+2007-07-06 Nikolas Coukouma <nikolas@zmanda.com>
+       * device-src/s3-device.c, device-src/s3.c, device-src/s3.h,
+         device-src/activate-devpay.c, device-src/Makefile.am:
+         Allow both regular S3 and S3-with-DevPay to be used in
+         the same installation. Remove WANT_DEVPAY macro.
+       * device-src/s3-device.c: Added a flag, is_devpay, to the device
+         and handled divergent cases. Removed useless device_error_set calls.
+       * device-src/s3.c: Use DevPay authentication iff user_token is set.
+         Replaced some if statements about non-NULL pointers with assertions.
+       * config/amanda/s3-device.m4, device-src/Makefile.am:
+         remove devpay flag and WANT_DEVPAY definition.
+       * installcheck/Amanda_Device.pl: add tests for DevPay, refactor
+         other S3 tests.
+
+2007-07-06 Nikolas Coukouma <nikolas@zmanda.com>
+       * device-src/s3.c: wait for bucket to appear after creation, treat
+         missing bucket as temporary error, increase retries from 5 to 14
+         (about 3min), explicitly handle HTTP verbs as libcurl expects.
+       * installcheck/Amanda_Device.pl: remove (now-irrelvant) note about
+         buckets taking too long to appear.
 
 2008-07-06 Dan Locks <dwlocks@zmanda.com>
        * packaging/deb/amanda-backup-server.postrm
        * packaging/deb/rules: added specific preinst and postrm scripts for
          client and server.
 
-2008-07-04 Dan Locks <dwlocks@zmanda.com>
-       * packaging/rpm/buildpkg: add lines to copy rpms to root of the build dir.
+2008-07-03  Dustin J. Mitchell <dustin@zmanda.com>
+       * man/Makefile.am man/amanda.css man/index.php man/xslt/html.xsl.in:
+         new files for HTML output
+       * man/xslt/man.xsl.in: substitute XSLT_VERS
+       * man/xml-source/amanda-devices.7.xml: tweaks
+       * man/xml-source/amanda.8.xml: tweaks
+       * man/xml-source/amanda.conf.5.xml: tweaks
+       * man/xml-source/amgetconf.8.xml: tweaks
+       * man/xml-source/amtoc.8.xml: tweaks
 
-2008-06-30  Ian Turner <ian@zmanda.com>
+2008-07-03  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/genversion.c: correctly represent available amflock
+         implementations
+
+2008-07-03  Jean-Louis Martineau <martineau@zmanda.com>
+       * perl/Amanda/Xfer.swg: #include "glib-util.h"
+
+2008-07-02  Dustin J. Mitchell <dustin@zmanda.com>
+       * device-src/rait-device.c: don't use self->device_name in open_device
+
+2008-07-02  Dustin J. Mitchell <dustin@zmanda.com>
+       * installcheck/amgetconf.pl: supply a plugin for scripts
+
+2008-07-02  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/diskfile.c: Check an application is set if
+                                program == "APPLICATION".
+       * common-src/amxml.c: Check plugin is set for application and script.
+       * common-src/conffile.c: Check plugin is set for application and script
+
+2008-07-02  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/amstatus.pl: Fix printing of config path on error.
+
+2008-07-02  Dustin J. Mitchell <dustin@zmanda.com>
+       * installcheck/Amanda_Device.pl: test that start(READ) without first
+         reading the label doesn't cause errors 
+       * device-src/s3-device.c: call s3_device_read_label directly
+
+2008-07-02  Ian Turner <ian@zmanda.com>
+       * man/xml-source/amanda.8.xml: Document how to override device
+         properties.
+
+2008-07-02  Ian Turner <ian@zmanda.com>
+       Dustin J. Mitchell <dustin@zmanda.com> contributed code and thoughts
+       to this patch.
+       * man/xml-source/amanda-devices.7.xml: Document new ERROR flag
+         to start RAIT device in degraded mode.
+       * device/device.c: Be a little more forgiving of NULL devices.
+       * device-src/vfs-device.c: Fix a bug where vfs_device_start()
+         would sometimes throw an erroneous assertion.
+       * device-src/rait-device.c: Be much more robust in error handling;
+         new feature to start a RAIT device in degraded mode.
+       * installcheck/Amanda_Device.pl: Enable more RAIT device tests.
+
+2008-07-02  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/amanda.h: remove unused #include <alloca.h>
+
+2008-07-02  Dustin J. Mitchell <dustin@zmanda.com>
+       * device-src/tape-device.c: add "user" and "good" to feature flags
+       * man/xml-source/amanda-devices.7.xml: document it
+
+2008-07-01  Dustin J. Mitchell <dustin@zmanda.com>
+       * device-src/device.h: fix comments to reflect removal of
+         autofinishing
+       * device-src/tape-device.c: remove autofinishing
+
+2008-07-01  Dustin J. Mitchell <dustin@zmanda.com>
+       * changer-src/chg-lib.sh.in: also handle bare tape dev names
+
+2008-07-01  Dustin J. Mitchell <dustin@zmanda.com>
+       * changer-src/chg-lib.sh.in: fix tape_device_filename to not use perl
+       * changer-src/chg-zd-mtx.sh: always use the unqualified hostname to
+         open the debug file
+
+2008-06-30  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/match.c: fix multiple bugs in match_datestamp
+
+2008-06-29  Dustin J. Mitchell <dustin@zmanda.com>
+       * perl/Amanda/Changer.pm perl/Amanda/Cmdline.swg
+         perl/Amanda/Config.swg perl/Amanda/DB/Catalog.pm
+         perl/Amanda/Device.swg perl/Amanda/Logfile.swg 
+         perl/Amanda/Util.swg: POD cleanup
+       * perl/Makefile.am: new files, rules to make HTML
+       * perl/amperl.css: CSS file for online POD
+       * perl/make_html.pl: make online POD
+
+2008-06-29  Dustin J. Mitchell <dustin@zmanda.com>
+       * installcheck/Makefile.am installcheck/amstatus.pl: new check
+
+2008-06-27  Ian Turner <ian@zmanda.com>
+       * server-src/taper.c: fix printing a NULL pointer in the error path
+
+2008-06-27  Dustin J. Mitchell <dustin@zmanda.com>
+       * device-src/device.c: check for and fail on multiple
+         short writes to the same file
+       * device-src/null-device.c device-src/rait-device.c
+         device-src/s3-device.c device-src/tape-device.c
+         device-src/vfs-device.c: do not autofinish files
+       * installcheck/Amanda_Device.pl installcheck/Amanda_Xfer.pl: don't
+         expect devices to autofinish anymore
+       * server-src/taper.c xfer-src/dest-device.c: finish files explicitly
+       * device-src/device-queueing.c: comments
+       * xfer-src/xfer-element.h: comments
+
+2008-06-27  Nikolas Coukouma <atrus@zmanda.com>
+       * device-src/s3.c device-src/s3.h device-src/s3-device.c installcheck/Amanda_Device.pl:
+         Add support for bucket location constraints
+       * device-src/s3-device.c: Add S3_BUCKET_LOCATION device property
+       * device-src/s3.c device-src/s3.h device-src/s3-device.c:
+         Checks for libcurl and bucket name compatability with location constraints
+       * device-src/s3.c: make s3_init() threadsafe,
+         refactor regex compilation and calling,
+         refactor perform_request() functions to construct URL later,
+         use GString to tidy string generation
+       * installcheck/Amanda_Device.pl: Add tests for location constraints
+
+2008-06-27  Ian Turner <ian@zmanda.com>
+       * device-src/rait-device.c: Fix a memory corruption issue on the last
+         block of a file.
+
+2008-06-27  Ian Turner <ian@zmanda.com>
        * device-src/rait-device.c: Fix a memory corruption issue on the last
          block of a file.
+
+2008-06-27  Ian Turner <ian@zmanda.com>
        * device-src/rait-device.c: Track file numbers properly when child
          devices change them (that is, in rait_device_start_file() and
          rait_device_seek_file()).
+       * installcheck/Amanda_Device.pl: Enable primary set of RAIT tests.
 
-2008-06-27  Ian Turner <ian@zmanda.com>
-       * device-src/rait-device.c (rait_device_start): Check for consistent
-         volume label on all child devices, otherwise fail
+2008-06-27  Jean-Louis Martineau <martineau@zmanda.com>
+       * device-src/s3-device.c (s3_device_read_label): Don't set
+         volume_header if nothing is read.
 
-2008-06-27  Ian Turner <ian@zmanda.com>
-       * device-src/rait-device.c: Silence a compiler warning.
+2008-06-27  Jean-Louis Martineau <martineau@zmanda.com>
+       * device-src/device.c: Don't log is flag is DEVICE_STATUS_SUCCESS.
 
 2008-06-27  Dustin J. Mitchell <dustin@zmanda.com>
+       * device-src/tape-posix.c: return DEVICE_ERROR|DEVICE_BUSY on EIO
+       * changer-src/chg-lib.sh.in: keep waiting for a device if it *might*
+         be busy or offline
+
+2008-06-26  Jean-Louis Martineau <martineau@zmanda.com>
+       * application-src/amstar.c: Use local start_time variable.
+       * application-src/amgtar.c: Use local start_time variable.
+       * common-src/clock.h: Remove times_zero and start_time extern.
+       * common-src/clock.c: Remove times_zero.
+
+2008-06-25  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/diskfile.c: Don't send encryption in xml req packet for
+                                server encryption.
+
+2008-06-25  Dustin J. Mitchell <dustin@zmanda.com>
+       * application-src/amgtar.c: revert --atime-preserve change
+
+2008-06-22  Dustin J. Mitchell <dustin@zmanda.com>
+       * application-src/amgtar.c: change --atime-preserve=system to
+         --atime-preserve
+
+2008-06-20  Dustin J. Mitchell <dustin@zmanda.com>
+       * installcheck/amdump.pl: fix checks to refresh the test configuration
+
+2008-06-20  Dustin J. Mitchell <dustin@zmanda.com>, Ian Turner <ian@zmanda.com>
+       * server-src/amdump.sh: correctly handle error exits from planner
+       * server-src/planner.c: fail if planning fails
+       * installcheck/amdump.pl: test changes
+
+2008-06-20 Dan Locks <dwlocks@zmanda.com>
+       * packaging/rpm/amanda.spec: typo amanda-devices.7.gz
+
+2008-06-20 Dan Locks <dwlocks@zmanda.com>
+       * packaging/rpm/amanda.spec: added %{MANDIR}/man7/amanda-device.7.gz
+
+2008-06-20  Jean-Louis Martineau <martineau@zmanda.com>
+       * client-src/client_util.c: Call check_access() only
+                                   if getuid() == geteuid().
+       * application-src/amgtar.c: check_dir(argument->dle.device, R_OK)
+
+2008-06-19  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/amcleanup.pl: Correctly rename amdump files.
+
+2008-06-19  Dustin J. Mitchell <dustin@zmanda.com>, Ian Turner <ian@zmanda.com>
+       * man/Makefile.am man/xml-source/amanda-devices.7.xml: new manpage
+       * man/entities/global.entities: emails for dustin and ian
+       * man/xml-source/amanda.8.xml: refer to new manpage
+       * man/xml-source/amanda.conf.5.xml: refer to new manpage
+       * man/xml-source/amrecover.8.xml: refer to new manpage
+       * server-src/amcheck.c: fix message regarding WORM media
+
+2008-06-19  Dustin J. Mitchell <dustin@zmanda.com>
+       * server-src/amgetconf.pl: fail on bad parameters or subsections, but
+         not empty values or subsection lists
+       * perl/Amanda/Config.swg: publish a list of subsections
+       * installcheck/amgetconf.pl: test it
+
+2008-06-19  Dustin J. Mitchell <dustin@zmanda.com>
+       * example/template.d/amanda-single-tape.conf.in
+         example/template.d/amanda-harddisk.conf.in
+         example/template.d/amanda-tape-changer.conf.in
+         example/template.d/dumptypes example/template.d/amanda-S3.conf.in:
+         use application amgtar instead of program GNUTAR
+
+2008-06-19  Dustin J. Mitchell <dustin@zmanda.com>
+       * config/amanda/net.m4: AC_SUBST port ranges; update comments
+
+2008-06-19  Satya Ganga <gsat@zmanda.com>
+       * example/template.d/amanda-single-tape.conf.in
+         example/template.d/advanced.conf.in: update displayunit to "g" and
+         remove chg-manual for single tape configurations.
+
+2008-06-19  Ian Turner <ian@zmanda.com>
+       * device-src/rait-device.c (rait_device_start): Check for consistent
+         volume label on all child devices, fail with
+         DEVICE_STATUS_DEVICE_ERROR otherwise.
+       * installcheck/Amanda_Device.pl: Test for foregoing.
+
+2008-06-19  Paddy Sreenivasan <paddy@zmanda.com>
+       * device-src/s3.h: use "https://ls.amazonaws.com/" as STS endpoint
+
+2008-06-19  Dustin J. Mitchell <dustin@zmanda.com>
+       * installcheck/Makefile.am: remove test_utils from SCRIPTS_PERL
+       * config/automake/scripts.am: explain why
+
+2008-06-18  Jean-Louis Martineau <martineau@zmanda.com>
+       * changer-src/chg-manual.sh: Make it interruptible.
+
+2008-06-18  Jean-Louis Martineau <martineau@zmanda.com>
+       * application-src/amgtar.c: Remove check for amandates file.
+
+2008-06-18  Jean-Louis Martineau <martineau@zmanda.com>
+       * common-src/amanda.h: Fix skip_quoted_string for "\\".
+       * common-src/file.c: Fix debug_agets for "\\".
+
+2008-06-18  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/amstatus.pl: Report size of PART taped on 'dump to tape'.
+
+2008-06-18  Jean-Louis Martineau <martineau@zmanda.com>
+       * client-src/sendsize.c: Report error from application to server.
+       * application-src/amgtar.c: Report exit status of tar.
+
+2008-06-16  Dustin J. Mitchell <dustin@zmanda.com>
+       * perl/Amanda/Xfer.swg xfer-src/Makefile.am xfer-src/xfer-element.h
+         xfer-src/dest-device.c xfer-src/source-device.c: new elements
+         Amanda::Xfer:{Dest,Source}::Device
+       * perl/Amanda/Xfer.swg: POD fix for Amanda::Xfer:Filter::Xor
+       * installcheck/Amanda_Xfer.pl: tests for new elements
+
+2008-06-16  Dustin J. Mitchell <dustin@zmanda.com>
+       * installcheck/amservice.pl: add invocations of selfcheck for GNUTAR
+         and amgtar
+       * installcheck/amservice.pl: put -f switches first
+
+2008-06-15  Dustin J. Mitchell <dustin@zmanda.com>
+       * installcheck/Amanda_Config.pl: test config overwrites
+       * common-src/conffile.c: don't segfault applying config overwrites
+         after config_init(0, NULL)
+
+2008-06-13  Jean-Louis Martineau <martineau@zmanda.com>
+       * client-src/sendbackup.c: Run compression and encryption for
+                                  application-api.
+
+2008-06-13  Jean-Louis Martineau <martineau@zmanda.com>
+       * perl/Amanda/Util.swg: Expose get_original_cwd.
+       * application-src/amgtar_perl.pl, application-src/amoracle.pl:
+         chdir(get_original_cwd()) before restore.
+
+2008-06-13  Dustin J. Mitchell <dustin@zmanda.com>
+       * device-src/property.c device-src/property.h: remove tape properties
+       * device-src/tape-device.c device-src/tape-device.h: add tape
+         properties
+
+2008-06-12 Dan Locks <dwlocks@zmanda.com>
+       * packaging/rpm/amanda_enterprise.spec,
+         packaging/rpm/amanda_enterprise_client.spec,
+         packaging/deb/rules: install amgtar and amstar suid root
+
+2008-06-12  Jean-Louis Martineau <martineau@zmanda.com>
+       * client-src/selfcheck.c: Typo.
+
+2008-06-11  Jean-Louis Martineau <martineau@zmanda.com>
+       * client-src/sendsize.c: Check MAX-LEVEL from application.
+       * server-src/planner.c: Ask for estimate even if SERVER, estimate is
+         valid if client return -1 and invelid if client return -2.
+       * common-src/amfeatures.h: New fe_xml_estimate amfeature.
+       * common-src/amxml.c: Parse <estimate> tag.
+       * common-src/amxml.h (dle_t): New estimate field.
+       * common-src/amfeatures.c: Set fe_xml_estimate.
+
+2008-06-11  Jean-Louis Martineau <martineau@zmanda.com>
+       * client-src/client_util.c (application_property_add_to_argv):
+                                  Add include and exclude.
+       * client-src/client_util.h (application_property_add_to_argv):
+                                  New prototype.
+       * client-src/sendbackup.c, client-src/sendsize.c,
+         client-src/selfcheck.c, recover-src/extract_list.c:
+         Add bsu param to application_property_add_to_argv.
+       * client-src/selfcheck.c: Check if application support includ/exclude.
+       * application-src/amgtar_perl.pl: Don't support include/exclude.
+       * application-src/amgtar.c: Support include-optional and
+                                   exclude-optional.
+       * common-src/amxml.c: Fix include/exclude parsing.
+
+2008-06-11  Jean-Louis Martineau <martineau@zmanda.com>
+       * application-src/Makefile.am: Install amgtar and amstar suid root.
+
+2008-06-11  Jean-Louis Martineau <martineau@zmanda.com>
+       * client-src/selfcheck.c: Print cmdline before execing the application.
+       * application-src/generic-dumper.pl: Cleanup.
+       * application-src/script-oracle.pl: Cleanup.
+       * application-src/script-email.pl: Cleanup.
+       * application-src/amgtar_perl.pl: Cleanup.
+       * application-src/generic-script.pl: Cleanup.
+       * application-src/Makefile.am: Remove all scripts from CHECK_PERL.
+       * perl/Amanda/Debug.swg: Typo.
+
+2008-06-10  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/Makefile.am: don't use $(builddir), fix comparison
+       * installcheck/Makefile.am: don't use $(builddir)
+
+2008-06-10  Ian Turner <ian@zmanda.com>
+       * common-src/fileheader.c: Silence a compiler warning.
+       * device-src/rait-device.c: ditto.
+
+2008-06-10  Dustin J. Mitchell <dustin@zmanda.com>
        * device-src/rait-device.c: hack around glib bug in versions <2.10.2
+         using the precompiler macro instead of glib_check_version, which
+         doesn't exist in every version of glib
+
+2008-06-10 Dan Locks <dwlocks@zmanda.com>
+       * packaging/rpm/amanda.spec:  Replaced individual SBINDIR/am... entries 
+         with SBINDIR/am* in %%files
+
+2008-06-10  Jean-Louis Martineau <martineau@zmanda.com>
+       * man/xml-source/amanda.conf.5.xml: Add pre&post recover scripts.
+
+2008-06-09 Dan Locks <dwlocks@zmanda.com>
+       * packaging/rpm/buildpkg: added "|| exit 1" to any command which should
+         cause the script to fail.
+
+2008-06-09 Dan Locks <dwlocks@zmanda.com>
+       * packaging/rpm/amanda.spec: Changed individual SBINDIR/am... entries to
+         use a single SBINDIR/am* entry in %files
 
 2008-06-09  Dustin J. Mitchell <dustin@zmanda.com>
-       * common-src/conffile.c: don't complain about a missing client conf
-         file, as the complaint interferes with the network communication
-         ("invalid size: could not open conf file")
+       * common-src/fileheader.c: correctly free dle_str
+       * device-src/device.c device-src/device.h: add volume_header Device
+         attributes
+       * device-src/rait-device.c device-src/s3-device.c
+         device-src/tape-device.c device-src/vfs-device.c: populate
+         volume_header
+       * server-src/amlabel.c: use volume_header to detect a non-empty tape
+         and require a force (-f) to overwrite it
+       * server-src/taperscan.c: use volume_header to detect a non-empty tape
+         and require 'amlabel -f' to overwrite it
+       * device-src/tape-device.c device-src/vfs-device.c: fix read_label
+         return values and remove useless chain-up calls
+
+2008-06-09  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/amservice.c: Open input file in read mode, prepend
+                                 get_original_cwd() to relative path.
+       * installcheck/Makefile.am: Check amservice only on server.
+
+2008-06-09  Dustin J. Mitchell <dustin@zmanda.com>
+       * installcheck/Amanda_Device.pl: skip all RAIT tests temporarily
+
+2008-06-09  Dustin J. Mitchell <dustin@zmanda.com>
+       * man/xml-source/amanda.8.xml: add links to amservice
+
+2008-06-07  Dustin J. Mitchell <dustin@zmanda.com>
+       * config/amanda/ipv6.m4: remove redundant AC_SOCKADDR_STORAGE
+       * configure.in: don't call AC_SOCKADDR_STORAGE
+
+2008-06-07  Dustin J. Mitchell <dustin@zmanda.com>
+       * installcheck/Amanda_Xfer.pl: make AMANDA_TMPDIR if it doesn't exist
+
+2008-06-07  Dustin J. Mitchell <dustin@zmanda.com>
+       * installcheck/Installcheck/Run.pm: fix Installcheck::Run vtape
+         handling so that checks can load/unload vtapes "manually"
+
+2008-06-07  Dustin J. Mitchell <dustin@zmanda.com>
+       * server-src/amdevcheck.pl: apply config_overwrites before printing
+         config errors
+
+2008-06-07  Dustin J. Mitchell <dustin@zmanda.com>
+       * application-src/amgtar_perl.pl application-src/amstar_perl.pl
+         application-src/generic-dumper.pl application-src/generic-script.pl
+         application-src/script-email.pl server-src/amgetconf.pl: add GPL
+         notice
+
+2008-06-06  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/amservice.c: Exit with 1 if the connection fail.
+       * man/xml-source/amservice.8.xml: Document exit code.
+
+2008-06-06  Dustin J. Mitchell <dustin@zmanda.com>
+       * device-src/device.c: make device_set_error bulletproof to NULLs
+       * device-src/tape-posix.c: fix compilation error when GMT_ONLINE is
+         not defined
+
+2008-06-06  Jean-Louis Martineau <martineau@zmanda.com>
+       * man/Makefile.am: Add amservice.8.
+       * man/xml-source/amservice.8.xml: New man page for amservice.
+       * server-src/amservice.c: New program to execute an amanda service
+                                 on a client.
+       * server-src/Makefile.am: Add amservice
+       * installcheck/amservice.pl: New check for amservice program.
+       * installcheck/Makefile.am: Add amservice
+
+2008-06-06  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/dumper.c: Don't quote dle_str.
+       * common-src/fileheader.c: DLE= in header is like heredoc.
 
 2008-06-06  Dustin J. Mitchell <dustin@zmanda.com>
-       * device-src/*: bugfixes backported from trunk r1087
-         - device_read_block returns an int, not a gboolean, and sets in_file
-           = FALSE on EOF
-         - tape device only requires a label in READ and APPEND modes
-         - tape device isn't opened until start or read_label
-         - rait sets self->file correctly in start
-         - rait compares child devices' labels and times correctly
-         - vfs correctly chains up in property_get
-         - vfs sets self->file correctly in start with ACCESS_APPEND
+       * device-src/*: major overhaul:
+         - add device_set_error to set error status and message for Device
+         - every error return from a device API method sets error status
+         - device_status_error is now threadsave
+         - a device in an error state will not perform further operations
+         - ensure Device attributes are set correctly by member functions
+         - device_open never returns NULL, but may return a null device with
+           error status set
+         - clearly define $device_name="$device_type:$device_node"
+         - send RAIT logging to the debug log
+         - vfs, tape devices don't touch the device until read_label or start
+         - on out-of-space in write, set is_eof, finish the file, and return
+           FALSE
+         - use accessor functions in Amanda::Device
+         - move device-specific properties to live with their devices
+         - change g_return_val_if_fail to g_assert or explicit checks
+         - remove most default Device methods, as they were more confusing
+           than helpful
+         - misc. other cleanup
+       * device-src/null-device.h device-src/rait-device.h
+         device-src/s3-device.h device-src/vfs-device.h: removed to make most
+         device class declarations local to the source file
+       * perl/Amanda/Device.swg: new error handling
+       * perl/Amanda/Changer.pm restore-src/amrestore.c restore-src/restore.c
+         server-src/amcheck.c server-src/amcheckdump.pl
+         server-src/amdevcheck.pl server-src/amlabel.c server-src/amtape.c
+         server-src/taperscan.c: use new device error-handling
+       * server-src/taper-file-source.c server-src/taper-port-source.c
+         server-src/taper-source.c: rename GObject constants (typo)
+       * server-src/taper-source.h:
+       * server-src/taper.c: handle opening devices better, log on EOM
+       * common-src/glib-util.c: g_english_strjoinv: handle one-element lists
+         correctly
+       * installcheck/amdevcheck.pl: volume-unlabeled message has changed
+       * installcheck/Amanda_Device.pl perl/Amanda/Tests.swg: test all device
+         classes
+       * configure.in device-src/tests/: removed
+       * device-src/vfs-test.c: moved from device-src/tests/
+
+2008-06-06  Jean-Louis Martineau <martineau@zmanda.com>
+       * client-src/sendbackup.c: Don't write the uncompression program if
+                                  it is not client compressed.
+
+2008-06-05  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/taper.c: Log no-tape line.
+
+2008-06-05  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/reporter.c: Improve formating.
+
+2008-06-05  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/driver.c: start the degraded mode if it receive
+                              NO-NEW-TAPE from taper.
+
+2008-06-05  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/amcheckdump.pl: Check log fiels in directory if find_log
+                                    find no log for the timestamps.
+
+2008-06-05  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/conffile.c common-src/conffile.h: expose config_add_error
+       * server-src/diskfile.c server-src/diskfile.h: use config_add_error
+         to send diskfile errors to conffile's error-handling mechanism
+       * restore-src/amfetchdump.c server-src/amadmin.c server-src/amcheck.c
+         server-src/amcleanupdisk.c server-src/amflush.c server-src/amindexd.c
+         server-src/amtrmidx.c server-src/amtrmlog.c server-src/driver.c
+         server-src/planner.c: parse disklist along with config
+
+2008-06-04  Jean-Louis Martineau <martineau@zmanda.com>
+       And Dustin J. Mitchell <dustin@zmanda.com>
+       * man/xml-source/amanda-client.conf.5.xml: Document property.
+       * installcheck/Amanda_Config.pl: Add test for client property.
+       * common-src/conffile.c (client_var): Add CONF_PROPERTY.
+
+2008-06-03  Jean-Louis Martineau <martineau@zmanda.com>
+       * perl/Amanda/Types.swg: Add dle_str to dumpfile_t.
+       * common-src/fileheader.c: Don't print NULL dle_str.
+
+2008-06-03  Jean-Louis Martineau <martineau@zmanda.com>
+       * common-src/amfeatures.h: Rename fe_amrecover_dle to fe_amindexd_DLE,
+                                  add fe_amrecover_dle_in_header.
+       * common-src/amfeatures.c: Set fe_amrecover_dle_in_header.
+       * recover-src/set_commands.c: Use fe_amindexd_DLE.
+       * server-src/dumper.c: Set dle_str and add it to the header.
+       * restore-src/restore.c: Remove dle_str is client doesn't have
+                                fe_amrecover_dle_in_header.
+       * common-src/fileheader.c: Parse and set dle_str from header.
+       * common-src/fileheader.h: Add dle_str in dumpfile_t.
 
 2008-06-03  Jean-Louis Martineau <martineau@zmanda.com>
        * man/xml-source/amdump.8.xml, man/xml-source/amreport.8.xml,
          man/xml-source/amcheck.8.xml, man/xml-source/amflush.8.xml,
          man/xml-source/amstatus.8.xml: Add "EXIT CODE" section".
 
+2008-06-03  Jean-Louis Martineau <martineau@zmanda.com>
+       * common-src/conffile.c (parm_key_info): Don't fold '-' to '_' in
+                                                subsec_name.
+       * installcheck/amgetconf.pl: Fix and add more tests.
+
+2008-06-03  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/amxml.c: give parse error on an empty "disk" element
+       * server-src/diskfile.c: give parse error on an empty "disk" element
+
 2008-05-30  Jean-Louis Martineau <martineau@zmanda.com>
        * common-src/security-util.c: Remove unneeded pointer cast.
        * common-src/stream.c: Fix compiler error.
 
+2008-05-30  Dustin J. Mitchell <dustin@zmanda.com>
+       * installcheck/Installcheck/Config.pm: fix subsection inheritance
+
 2008-05-30  Dustin J. Mitchell <dustin@zmanda.com>
        * common-src/amanda.h, common-src/bsd-security.c,
          common-src/bsdtcp-security.c, common-src/bsdudp-security.c,
          restore-src/amidxtaped.c, server-src/amindexd.c: add sockaddr_union,
          change all relevant functions to use it, to avoid aliasing violations
 
+2008-05-30  Jean-Louis Martineau <martineau@zmanda.com>
+       * common-src/conffile.c (lookup_keyword): Use temporary variable.
+       * installcheck/Amanda_Config.pl:  Check insentivity of -/_ in amanda
+                                         keyword.
+       * installcheck/Installcheck/Config.pm: Adjust to make the subsection
+                                              inheritance work.
+
+2008-05-30  Jean-Louis Martineau <martineau@zmanda.com>
+       * recover-src/extract_list.c: Send properties from dump_dle to
+                                     application plugin.
+
+2008-05-30  Jean-Louis Martineau <martineau@zmanda.com>
+       * client-src/client_util.c: New *-RECOVER scripts.
+       * application-src/script-email.pl: Add new *-RECOVER scripts.
+       * application-src/generic-script.pl: Add new *-RECOVER scripts.
+       * application-src/amstar.c: Fix.
+       * application-src/amgtar.c: Fix.
+       * recover-src/amrecover.c: Add a global dump_dle variable.
+       * recover-src/extract_list.c: Call run_client_scripts for *-RECOVER
+                                     scripts.
+       * recover-src/amrecover.h: Add an extern dump_dle variable.
+       * recover-src/set_commands.c: Send to amindexd the DLE command.
+       * server-src/amindexd.c: Handle the DLE command.
+       * server-src/server_util.c: Add *-RECOVER scripts, they can't be
+                                   executed on server.
+       * server-src/diskfile.c (xml_scripts): Add *-RECOVER scripts.
+       * common-src/amfeatures.h: New fe_amrecover_dle amfeature.
+       * common-src/amfeatures.c (am_init_feature_set): Add fe_amrecover_dle.
+       * common-src/amxml.c: Add *-RECOVER scripts.
+       * common-src/conffile.c: Add *-RECOVER scripts.
+       * common-src/conffile.h: Add *-RECOVER scripts.
+
+2008-05-29  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/conffile.c: make config insensitive to
+         differences between '-' and '_'
+       * man/xml-source/amanda-client.conf.5.xml
+         man/xml-source/amanda.conf.5.xml 
+         man/xml-source/amgetconf.8.xml: document it
+       * installcheck/Amanda_Config.pl installcheck/amgetconf.pl: update
+         tests
+
 2008-05-29  Orion Poplawski <orion@cora.nwra.com>
-       * device-src/tests/semaphore-test.c: fix call to amanda_thread_init
-       * device-src/tests/vfs_test.c: fix call to amanda_thread_init
        * server-src/chunker.c: fix buffer overrun
 
 2008-05-29  Jean-Louis Martineau <martineau@zmanda.com>
        * device-src/rait-device.c: rait-device returns correct size when
          blocksize is too small
 
+2008-05-28  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/reporter.c: Fix ignoring pid line.
+
+2008-05-27  Jean-Louis Martineau <martineau@zmanda.com>
+       * config/amanda/ps.m4: Define PS_ARGUMENT to CYGWIN on cygwin.
+       * perl/Amanda/Process.pm: Works with PS_ARGUMENT eq "CYGWIN".
+
+2008-05-25  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/amstatus.pl: use lib '@amperldir@';
+       * perl/Amanda/Process.pm: use Amanda::Constants;
+
+2008-05-26  Dustin J. Mitchell <dustin@zmanda.com>
+       * device-src/rait-device.c: temporarily remove the call to set the
+         BLOCK_SIZE property on all RAIT children, as it fails with VFS
+         devices
+       * device-src/rait-device.c: rewrite g_ptr_array_union_robust to
+         correctly detect and handle child device failures
+       * common-src/fileheader.c: fix parse_file_header to be threadsafe
+
+2008-05-25  Jean-Louis Martineau <martineau@zmanda.com>
+       * device-src/tape-aix.c, device-src/tape-xenix.c
+         device-src/tape-posix.c: tape_is_ready take a (TapeDevice *) argument
+       * device-src/tape-posix.c (tape_is_ready): Check for broken_gmt_online.
+       * device-src/property.c: Add broken_gmt_online property.
+       * device-src/property.h: Add PROPERTY_BROKEN_GMT_ONLINE.
+       * device-src/tape-device.c: Use broken_gmt_online property.
+       * device-src/tape-device.h (TapeDevice): Add broken_gmt_online field.
+       * device-src/tape-ops.h (tape_is_ready): Change prototype.
+
 2008-05-25  Jean-Louis Martineau <martineau@zmanda.com>
        * changer-src/chg-zd-mtx.sh: Fix logging.
 
 2008-05-25  Jean-Louis Martineau <martineau@zmanda.com>
-        * packaging/rpm/amanda.spec: Fix output message.
+       * packaging/rpm/amanda.spec: Fix output message.
+
+2008-05-25  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/Makefile.am common-src/simpleprng.c
+         common-src/simpleprng.h: new simple PRNG module for
+         reproducible use in tests (bitlength bug fixed).
+       * xfer-src/dest-null.c: verify stream against PRNG
+       * xfer-src/source-random.c: use PRNG to create stream
+       * installcheck/Amanda_Xfer.pl: verify streams in xfers
+       * perl/Amanda/Xfer.swg: use PRNG
+       * xfer-src/xfer-element.h xfer-src/xfer-test.c: use
+         PRNG to test glue elements
+
+2008-05-23  Dustin J. Mitchell <dustin@zmanda.com>
+       * installcheck/Amanda_MainLooop.pl: handle SIGCHILD while
+         reading from dying child
+
+2008-05-22  Dustin J. Mitchell <dustin@zmanda.com>
+       * xfer-src/xfer-test.c: don't try to write to a file in the
+         source directory
+
+2008-05-22  Jean-Louis Martineau <martineau@zmanda.com>
+       * perl/Amanda/Process.pm (load_ps_table): Fix split.
+
+2008-05-22  Jean-Louis Martineau <martineau@zmanda.com>
+       * configure.in: Call AMANDA_PS_ARGUMENT
+       * config/amanda/ps.m4 (AMANDA_PS_ARGUMENT): New macro to find ps
+                                                   argument.
+       * perl/Amanda/Constants.pm.in: Add PS_ARGUMENT.
+       * perl/Amanda/Process.pm (load_ps_table): Use PS_ARGUMENT.
+
+2008-05-22  Jean-Louis Martineau <martineau@zmanda.com>
+       * perl/Amanda/Process.pm: process_alive return '' if the process is
+                                 dead.
+       * installcheck/Amanda_Process.pl: New module to check Amanda::Process.
+       * installcheck/Makefile.am (server_tests): Add Amanda_Process.
+
+2008-05-21  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/amstatus.pl: Add "failed: killed while" to some status if
+                                 the driver process is dead.
+       * perl/Amanda/Process.pm: New process_alive function.
+
+2008-05-21  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/dumper.c server-src/planner.c, server-src/chunker.c,
+         server-src/amflush.c, server-src/driver.c, server-src/taper.c,
+         restore-src/amidxtaped.c, restore-src/restore.c,
+         restore-src/amfetchdump.c: Convert all pid_t to long before printing.
+
+2008-05-21  Jean-Louis Martineau <martineau@zmanda.com>
+       * man/xml-source/amcleanup.8.xml: Document new -p option.
+       * server-src/logfile.c (program_str): Add many programs.
+       * server-src/logfile.h (program_e): Add many programs.
+       * server-src/dumper.c, server-src/planner.c,
+         server-src/chunker.c, server-src/amflush.c,
+         server-src/driver.c, server-src/taper.c,
+         restore-src/amidxtaped.c, restore-src/restore.c,
+         restore-src/amfetchdump.c,
+         server-src/amdump.sh: Log pid and pid-done lines, call run_amclenup.
+       * server-src/server_util.c (run_amcleanup): New function to run
+                                                   amcleanup.
+       * server-src/server_util.c (get_master_process): New function get the
+                                name of the first pid line in a log file.
+       * server-src/server_util.h (run_amcleanup): Prototype.
+       * server-src/server_util.h (get_master_process): Prototype.
+       * server-src/reporter.c: Ignore pid and pid-done lines.
+       * server-src/amcleanup.pl: New amcleanup program written in perl.
+       * server-src/Makefile.am: Move amcleanup from SCRIPTS_SHELL to
+                                 SCRIPTS_PERL.
+       * server-src/amcleanup.sh: Old program removed.
+       * perl/Amanda/Process.pm: New module to hanlde amanda process.
+       * perl/Makefile.am: Add Amanda/Process.pm to Amanda_DATA and EXTRA_DIST
 
 2008-05-21  Jean-Louis Martineau <martineau@zmanda.com>
        * server-src/driver.c: Fix quoting of diskname.
          common-src/krb5-security.c common-src/dgram.c common-src/stream.c:
          use the type instead of socklen_t
 
-2008-05-14  Dustin J. Mitchell <dustin@zmanda.com>
-       * client-src/amhpfixdevs.sh client-src/Makefile.am
-         client-src/amsinixfixdevs.sh config/amanda/devprefix.m4:
-         permanently remove amsinixfixdevs and amhpfixdevs
+2008-05-20  Jean-Louis Martineau <martineau@zmanda.com>
+           Dustin J. Mitchell <dustin@zmanda.com>
+           John Franks <jrfranks@zmanda.com>
+       * server-src/amstatus.pl: quote disknames in amstatus
+       * server-src/Makefile.am: don't check amstatus (since it
+         uses Amanda::* libs)
+       * perl/Amanda/Util.swg: add (un)quote_string
+       * installcheck/Amanda_Util.pl installcheck/Makefile.am: test it
 
 2008-05-16  Jean-Louis Martineau <martineau@zmanda.com>
        * common-src/conffile.c: Fix conf_parserror use.
 
-2008-05-13 Dan Locks <dwlocks@zmanda.com>
-       * packaging/deb/buildpkg: modified build script to create unsigned
-         packages
+2008-05-15  Dustin J. Mitchell <dustin@zmanda.com>
+       * perl/Makefile.am installcheck/Makefile.am Makefile.am: only build
+         XFA in server builds
+
+2008-05-15  Jean-Louis Martineau <martineau@zmanda.com>
+       * common-src/conffile.c: Parse send-amreport-on.
+       * common-src/conffile.h (send_amreport_t): New enum for possible value
+                                                  of send-amreport-on.
+       * server-src/reporter.c: Use send-amreport-on setting.
+       * perl/Amanda/Config.swg: Define send_amreport_on_t constants.
+       * man/xml-source/amanda.conf.5.xml: Document send-amreport-on.
+
+2008-05-15  Jean-Louis Martineau <martineau@zmanda.com>
+       * client-src/client_util.c (application_property_argv_size): New
+         function to count the number of argument needed to store all
+         properties of an application for + * a dle in an ARGV.
+       * client-src/client_util.c (application_property_add_to_argv): New
+         function to add all properties of an application for a dle to an ARGV.
+       * client-src/client_util.h (application_property_argv_size,
+                                 application_property_add_to_argv): Prototype.
+       * client-src/sendbackup.c, client-src/sendsize.c,
+         client-src/selfcheck.c: Use new functions to pass properties as
+                                 argument to application plugin.
+       * application-src/script-email.pl, application-src/amstar.c,
+         application-src/generic-script.pl,
+         application-src/amgtar.c: Get properties from command line.
+       * server-src/server_util.c: Use new functions to pass properties as
+                                   argument to pre/post script.
+       * common-src/util.c (count_proplist): Callback function to count the
+                                             number of values of a property.
+       * common-src/util.c (proplist_add_to_argv): callback function to store a
+                                       property and it's value in an ARGV.
+       * common-src/util.h (count_proplist, proplist_add_to_argv): Prototype.
+       * common-src/conffile.c (property_argv_size): New function to count the
+                                                     number of properties.
+       * common-src/conffile.c (property_add_to_argv): New function to store a
+                                       property and it's value in an ARGV.
+       * common-src/conffile.h (property_argv_size,
+                                property_add_to_argv): Prototype.
+
+2008-05-15  Dustin J. Mitchell <dustin@zmanda.com>
+       * xfer-src/Makefile.am: add element-glue.h to the distribution
+       * xfer-src/element-glue.h: add 'extern'
+       * xfer-src/xfer-test.c: fix test elements
+       * xfer-src/xfer.c: don't use the sometimes-undefined constant
+         G_MAXINT32
+       * xfer-src/source-random.c: Only use 'prolong' for threads, not
+         push/pull methods
+       * installcheck/Amanda_Xfer.pl: Check the content of $msg->{message} in
+         XMSG_INFO
+
+2008-05-14  Dustin J. Mitchell <dustin@zmanda.com>
+       * xfer-src/xfer-element.h xfer-src/xfer.c xfer-src/dest-null.c
+         xfer-src/source-random.c xfer-src/xfer-test.c
+         xfer-src/element-glue.c xfer-src/xmsg.h xfer-src/dest-fd.c
+         xfer-src/source-fd.c xfer-src/element-glue.h
+         xfer-src/Makefile.am xfer-src/filter-xor.c
+         xfer-src/xfer-element.c perl/Amanda/Xfer.swg: new organization
+         of transfer mechansims and new algorithm for linking xfers, with
+         expanded unit tests to exercise new glue elements
+       * installcheck/Amanda_Xfer.pl: updated installchecks
+       * common-src/semaphore.h: fix comment typo
+       * common-src/testutils.c common-src/testutils.h: optionally skip
+         timeouts (-t), and only show g_debug messages if -d is given
+
+2008-05-14  Dustin J. Mitchell <dustin@zmanda.com>
+       * client-src/amhpfixdevs.sh client-src/Makefile.am
+         client-src/amsinixfixdevs.sh config/amanda/devprefix.m4:
+         permanently remove amsinixfixdevs and amhpfixdevs
 
 2008-05-12  Jean-Louis Martineau <martineau@zmanda.com>
          Patch by Orion Poplawski
        * server-src/planner.c: Warn about overwrite of last level 1, and
          force backup of level 1 if overwrite on this run.
 
-2008-05-12  Dustin J. Mitchell <dustin@zmanda.com>
-       * server-src/dumper.c server-src/server_util.c
-         server-src/infofile.c server-src/amtrmlog.c common-src/debug.c
-         common-src/file.c: Always call mkpdir without the 02000 bit set,
-         as it is not needed and causes problems on MacOS X.
-
 2008-05-08  Jean-Louis Martineau <martineau@zmanda.com>
-       * packaging/deb/buildpkg packaging/rpm/buildpkg: AMVER=amanda-2.6.0p1
-       * packaging/deb/changelog: amanda (2.6.0p1-1)
-       * packaging/deb/rules: AMVER=2.6.0p1
-       * packaging/rpm/amanda.spec: amanda_version 2.6.0p1, amanda_release 1
-       * NEWS: Update for 2.6.0p1
-       * configure.in: AM_INIT_AUTOMAKE(amanda, "2.6.0p1")
+       * common-src/conffile.c: Define default tapetype.
 
 2008-05-08  Jean-Louis Martineau <martineau@zmanda.com>
-       * common-src/conffile.c: Define default tapetype.
+       * device-src/tape-device.c (tape_validate_properties): New function to
+         validate properties.
+
+2008-05-07  Jean-Louis Martineau <martineau@zmanda.com>
+       * man/xml-source/amdevcheck.8.xml: Add an OUTPUT section.
 
 2008-05-07  Jean-Louis Martineau <martineau@zmanda.com>
        * common-src/conffile.c: Check the tapetype is defined.
 
 2008-05-07  Jean-Louis Martineau <martineau@zmanda.com>
        * device-src/tape-device.c: Allow user to set "read_buffer_size"
-                                   property.
+                                   property.
        * restore-src/amrestore.c: Don't limit blocksize to
-                                  --with-maxtapeblocksize.
+                                  --with-maxtapeblocksize.
        * common-src/conffile.c: Increase readblocksize to blocksize.
          blocksize and readblocksize can be bigger than
          --with-maxtapeblocksize.
 
+2008-05-06  Jean-Louis Martineau <martineau@zmanda.com>
+       * common-src/conffile.c: Add a 'mailer' config parameter.
+       * common-src/conffile.h: Add CNF_MAILER.
+       * changer-src/chg-scsi-chio.c, changer-src/chg-scsi.c
+         changer-src/chg-manual.sh, application-src/script-email.pl
+         server-src/amcheck.c server-src/amgetconf.pl
+         server-src/reporter.c: Use mailer from config.
+       * perl/Amanda/Config.swg: amglue_add_constant(CNF_MAILER, confparm_key)
+       * config/amanda/progs.m4: Set DEFAULT_MAILER.
+       * common-src/amanda-sh-lib.sh.in: Don't set MAILER.
+       * man/xml-source/amanda-client.conf.5.xml,
+         man/xml-source/amanda.conf.5.xml,
+         man/xml-source/amgetconf.8.xml: Update man pages.
+
 2008-05-02 Dan Locks <dwlocks@zmanda.com>
-       * packaging/rpm/amanda.spec:  Replace ${ with %{ where applicable.
+       * packaging/rpm/amanda.spec:  Replace ${ with %{ where applicable.
+2008-05-02 Dan Locks <dwlocks@zmanda.com>
+       *  packaging/deb/amanda-enterprise-backup-server.postinst
+          packaging/rpm/amanda_enterprise.spec:  Change .am_passphrase to a
+          semi-random number in both packages. 
+
+2008-04-29  Dustin J. Mitchell <dustin@zmanda.com>
+       * config/amanda/dirs.m4: note that --with-dumperdir is 
+         deprecated in ./configure --help
+
+
+2008-04-24  Jean-Louis Martineau <martineau@zmanda.com>
+       * restore-src/restore.c: Fix test for DEVICE_STATUS_SUCCESS.
+
+2008-04-28  Dustin J. Mitchell <dustin@zmanda.com>
+       * xfer-src/Makefile.am xfer-src/xfer-element.h xfer-src/dest-fd.c
+         xfer-src/source-fd.c perl/Amanda/Xfer.swg: add new
+         Amanda::Xfer::Source::Fd, Amanda::Xfer::Dest::Fd
+       * xfer-src/source-random.c xfer-src/xfer.c xfer-src/dest-null.c
+         xfer-src/xfer.h xfer-src/filter-xor.c xfer-src/xfer-element.c:
+         reorganize detection of transfer completion, to handle cases where
+         elements don't do any active processing
+       * installcheck/Amanda_Xfer.pl: test it all
+
+2008-04-24  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/reporter.c: Correctly print truncated quoted diskname.
+
+2008-04-23  Dustin J. Mitchell <dustin@zmanda.com>
+       * installcheck/Amanda_MainLoop.pl common-src/event-test.c
+         common-src/queueing-test.c: try to make tests more resilient
+         to heavily-loaded, slow machines
 
 2008-04-23  Jean-Louis Martineau <martineau@zmanda.com>
        * common-src/security-util.c: Typo.
 
 2008-04-23  Jean-Louis Martineau <martineau@zmanda.com>
        * server-src/driver.c: Always sent a FAILED to taper if dumper failed.
+       * common-src/event.c: Check event is not dead before fire it.
 
 2008-04-23  Jean-Louis Martineau <martineau@zmanda.com>
        * server-src/planner.c: Fix vstrextend use.
 
+2008-04-23  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/event.c: use internal child_watch_source
+         for glib <2.6.0; versions 2.4.0 to 2.6.0 use unreliable
+         signals and are thus unreliable
+
+2008-04-22  Dustin J. Mitchell <dustin@zmanda.com>
+       * perl/Amanda/Logfile.swg server-src/find.c server-src/find.h: add
+         parsing of 'sec' and 'kb' from logfile messages
+       * perl/Amanda/DB/Catalog.pm perl/Makefile.am: new module
+       * installcheck/Amanda_DB_Catalog.pl installcheck/Makefile.am: checks
+         for new module
+
+2008-04-22  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/event.c: on glib <2.4.0, use a simple polling 
+         child_watch_source; on more recent glib, use glib's own
+         child_watch_source
+
+2008-04-22  Dustin J. Mitchell <dustin@zmanda.com>
+       * xfer-src/source-random.c xfer-src/xmsg.c xfer-src/xfer-element.h
+         xfer-src/xfer-dest.c xfer-src/xfer-test.c xfer-src/xmsg.h
+         xfer-src/xfer.c xfer-src/xfer-dest.h xfer-src/dest-null.c
+         xfer-src/xfer.h xfer-src/filter-xor.c xfer-src/xfer-element.c:
+         - flatten XferElement hierarchy to one level
+         - change test element argument order
+         - rename XMsg.src to Xmsg.elt
+         - Improve memory management (refcounting, perl interface)
+       * perl/Amanda/Changer.pm perl/Amanda/Xfer.swg
+         perl/Amanda/MainLoop.swg perl/Makefile.am
+         perl/amglue/amglue.h perl/amglue/source.c:
+         - rewrite handling of amglue_Source for better refcounting
+         - Amanda::MainLoop callbacks get the event source as 1st argument,
+           and will be called even if the event source goes out of scope in
+           perl
+         - MainLoop.swg significantly rewritten to get refcounting right
+       * installcheck/Amanda_Xfer.pl: new checks (without excessive use of
+         file descriptors)
+       * installcheck/Amanda_MainLoop.pl installcheck/Makefile.am: updated
+          checks
+
+2008-04-22  Jean-Louis Martineau <martineau@zmanda.com>
+       * device-src/tape-posix.c: Don't return DEVICE_STATUS_VOLUME_MISSING
+                                  on ioctl error.
+       * changer-src/chg-lib.sh.in (amdevcheck_status): return 1 only if the
+                        possible errors are VOLUME_MISSING or DEVICE_BUSY.
+
+2008-04-22  Kevin Zembower <kzembowe@jhuccp.org>
+       * man/xml-source/amflush.8.xml: add amflush example
+
+2008-04-22  Jean-Louis Martineau <martineau@zmanda.com>
+       * device-src/tape-device.c: Move all device access from
+         tape_device_open_device to tape_device_read_label.
+         tape_device_start read the label if it is not already read.
+       * device-src/vfs-device.c (vfs_device_open_device): remove read of the
+                                                           label.
+
+2008-04-22  Jean-Louis Martineau <martineau@zmanda.com>
+       * device-src/tape-device.c (check_resetofs): Compilation fix if
+                                                    NEED_RESETOFS is defined.
+       * device-src/tape-posix.c: Handle no ENOMEDIUM.
+
+2008-04-21  Dan Locks <dwlocks@zmanda.com>
+       * packaging/deb/buildpkg: modified build script to create unsigned
+         packages
+
+2008-04-21  Jean-Louis Martineau <martineau@zmanda.com>
+       * changer-src/chg-lib.sh.in (amdevcheck_status):
+         Set amdevcheck_message.
+       * changer-src/chg-chs.sh, changer-src/chg-juke.sh,
+         changer-src/chg-manual.sh, changer-src/chg-zd-mtx.sh,
+         changer-src/chg-multi.sh: Output amdevcheck_message
+       * device-src/device.c: Set errmsg and status.
+         device_open always return a device, the status and errmsg are set.
+       * device-src/device.h: Define DeviceStatusFlags.
+       * device-src/null-device.c, device-src/s3-device.c,
+         device-src/tape-device.c, device-src/vfs-device.c,
+         device-src/rait-device.c: Set errmsg and status.
+       * device-src/tape-posix.c: Return status for VOLUME_MISSING.
+       * device-src/tape-ops.h: Remove TapeCheckResult.
+       * server-src/taper-source.h (_TaperSource): Add errmsg.
+       * server-src/taper-source.c: Set errmsg
+       * server-src/amcheck.c, server-src/amtape.c, server-src/amlabel.c,
+         server-src/taperscan.c, restore-src/amrestore.c,
+         restore-src/restore.c: Use status and errmsg of a device.
+       * server-src/taper-disk-port-source.c: Set errmsg.
+       * server-src/reporter.c: Fix parsing of taper PARTIAL line.
+       * server-src/taper.c: Use errmsg for device and _TaperSource.
+       * server-src/taper-file-source.c: Set errmsg.
+       * server-src/amcheckdump.pl,
+         server-src/amdevcheck.pl: Use status and errmsg from device.
+       * perl/Amanda/Changer.pm: Fix for DEVICE_STATUS_*.
+       * perl/Amanda/Device.swg: New interface.
+       * installcheck/Makefile.am: Don't print some commands.
+       * installcheck/Amanda_Device.pl: Check new device api.
+       * common-src/queueing.c: Use new queue_fd_t.
+       * common-src/queueing.h (queue_fd_t): new struct.
+       * common-src/amanda-sh-lib.sh.in: Fix bug.
+       * common-src/queueing-test.c: Use queue_fd_t.
+
+2008-04-21  Dustin J. Mitchell <dustin@zmanda.com>
+       * installcheck/amgetconf.pl: properly quote filenames in
+         regex, to avoid spurious failures when e.g., '+' appears
+         in the filename
+
+2008-04-18  Dustin J. Mitchell <dustin@zmanda.com>
+       * perl/Amanda/Changer.pm: rewrite Amanda::Changer to use
+         Amanda::MainLoop, allowing asynchronous operation of 
+         changers
+       * server-src/amcheckdump.pl: use new Amanda::Changer 
+         interface (synchronously, until we have Amanda::Xfer)
+       * installcheck/Amanda_Changer.pl: test new interface
+
+2008-04-18  Dustin J. Mitchell <dustin@zmanda.com>
+       * installcheck/Makefile.am: build $(full_tests) too
+
+2008-04-18  Cyrille Bollu <Cyrille.Bollu@fedasil.be>
+       * client-src/sendsize.c: use --numeric-owner during 'sendsize'
+
+2008-04-17  Dustin J. Mitchell <dustin@zmanda.com>
+       * installcheck/Makefile.am: segregate installchecks that require
+         both client and server components
+
+2008-04-17  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/debug.c: add Amanda version to debug logs
+
+2008-04-16  Dustin J. Mitchell <dustin@zmanda.com>
+       * perl/Amanda/Util.swg common-src/util.c common-src/util.h: add
+         process type and context process attributes
+       * perl/Amanda/Debug.swg common-src/debug.c common-src/debug.h: add
+         debug_init to set up debugging according to the process context, and
+         log nothing in CONTEXT_SCRIPTUTIL
+       * server-src/amgetconf.pl server-src/amdevcheck.pl:
+         CONTEXT_SCRIPTUTIL
+       * server-src/amcheckdump.pl: use new $CONSTANT_CMDLINE variable
+       * installcheck/Amanda_Debug.pl: add comment
+
 2008-04-16  Dan Locks <dwlocks@zmanda.com>
        * Fixes to debian package reported by daniel_P
        * packaging/deb/preinst: remove spaces near ${amanda_group}
        * packaging/deb/buildpkg: removed extraneous configure step
        * packaging/deb/amanda-backup-server.postinst: added check for correct
          permissions on /tmp/amanda
-         
+
+2008-04-16  Dan Locks <dwlocks@zmanda.com>
+       * packaging/deb/rules packaging/rpm/amanda.spec: remove --with-gnutar=
+         from configure invocation.  no longer necessary.
+
+2008-04-16  Dustin J. Mitchell <dustin@zmanda.com>
+       * device-src/s3.c config/amanda/s3-device.m4: test curl features
+         at runtime, instead of compile time, and always use SSL if it
+         is available.
+
 2008-04-16  Jean-Louis Martineau <martineau@zmanda.com>
        * server-src/amadmin.c: Improve message.
        * man/xml-source/amanda.conf.5.xml: Fix man page.
-       * server-src/planner.c: Fix DS_INCRONLY and FORCE_FULL
+       * server-src/planner.c: Fix DS_INCRONLY and FORCE_FULL.
 
 2008-04-16  Dustin J. Mitchell <dustin@zmanda.com>
        * config/amanda/dumpers.m4: continue searching for gnutar if we
        * common-src/debug.c (debug_logging_handler, debug_printf): Don't print
          msg_timestamp() to stderr.
 
+2008-04-15  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/dumper.c: Call error() only after set_logerror is done.
+       * server-src/planner.c: Call error() only after set_logerror is done.
+       * server-src/chunker.c: Report a better error message.
+       * common-src/stream.c: Set errno to ETIMEDOUT after a timeout.
+
 2008-04-15  Jean-Louis Martineau <martineau@zmanda.com>
        * server-src/find.c (dumps_match_dumpspecs): New function to only keep
          dumps that match a dumpspecs, using it simplify amfetchdump.
        * perl/Amanda/Cmdline.swg: cmdline_parse_dumpspecs.
        * perl/amglue/dumpspecs.swg: Map dumpspecs to perl.
        * perl/Makefile.am (AMGLUE_SWG): Add amglue/dumpspecs.swg.
+       * installcheck/Amanda_Logfile.pl: Add many tests.
 
 2008-04-15  Jean-Louis Martineau <martineau@zmanda.com>
        * tape-src/tapetype.c: Initialize an default config.
        * common-src/util.c (connect_portrange, connect_port, bind_portrange):
          Return the latest errno reported.
 
+2008-04-08  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/conffile.c common-src/conffile.h 
+         perl/Amanda/Config.swg installcheck/Amanda_Config.pl:
+         new interface for config errors, re-introduce rawtapedev for
+         deprectation purposes
+       * installcheck/Installcheck/Config.pm: support test
+         amanda-client.conf files
+       * installcheck/Installcheck/Run.pm: add get_stdout, get_stderr
+       * client-src/client_util.c client-src/client_util.h: add
+         config_errors_to_error_string
+       * server-src/dumper.c server-src/planner.c: handle ERRORs and NAKs
+         better, so users see client-side config errors
+       * oldrecover-src/amrecover.c changer-src/chg-scsi-chio.c
+         changer-src/chg-scsi.c client-src/sendbackup.c client-src/sendsize.c
+         client-src/selfcheck.c amandad-src/amandad.c application-src/amstar.c
+         application-src/amgtar.c recover-src/amrecover.c
+         server-src/amlogroll.c server-src/amindexd.c server-src/amcheck.c
+         server-src/amgetconf.pl server-src/chunker.c server-src/amadmin.c
+         server-src/amtape.c server-src/amcheckdump.pl
+         server-src/amcleanupdisk.c server-src/amflush.c server-src/amtrmlog.c
+         server-src/driver.c server-src/reporter.c server-src/taper.c
+         server-src/amdevcheck.pl server-src/amtrmidx.c server-src/diskfile.c
+         server-src/amlabel.c installcheck/Amanda_Changer.pl
+         installcheck/Amanda_Device.pl installcheck/Amanda_Logfile.pl
+         installcheck/Amanda_Tapelist.pl restore-src/amidxtaped.c
+         restore-src/amrestore.c restore-src/amfetchdump.c: adapt to new config
+         error interface
+
+2008-04-08  Dustin J. Mitchell <dustin@zmanda.com>
+       * server-src/diskfile.c: improve messages when client does not
+         support required features
+
+2008-04-08  Dustin J. Mitchell <dustin@zmanda.com>
+       * installcheck/Amanda_Config.pl common-src/conffile.c
+         common-src/conffile.h: fix deprecation of keywords to
+         actually issue a warning.  'netusage' is no longer
+         deprecated.
+
+2008-04-08  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/event.c: use SA_RESTART for child_watch_source
+
+2008-04-07  Dustin J. Mitchell <dustin@zmanda.com>
+       * perl/Amanda/MainLoop.swg perl/amglue/source.c
+         installcheck/Amanda_MainLoop.pl: wrap GMainLoop and the 
+         GSources defined in event.c, using an extensible model
+       * common-src/event.c: check whether child_watch_source's signal
+         handler has been replaced, and issue a warning if it has.
+
+2008-04-07  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/queueing.c: fix condition (thanks to Jean-Louis
+         Martineau)
+
+2008-04-07  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/Makefile.am common-src/queueing-test.c: new tests
+       * device-src/tests/queue_test.c device-src/tests/Makefile.am: remove
+       * common-src/queueing.c: fix two bugs:
+         - spurious in-place memmove on every buffer copy
+         - silent discard of a final packet if the consumer does not
+           completely consume it
+       * common-src/queueing.h: update comments
+       * common-src/testutils.h: add header-protection macros
+
+2008-04-07  Dustin J. Mitchell <dustin@zmanda.com>
+       * installcheck/Makefile.am installcheck/Amanda_Device.pl: Add tests
+         for Amanda::Device
+
+2008-04-07  Dustin J. Mitchell <dustin@zmanda.com>
+       * man/xml-source/amanda.conf.5.xml: fix typos
+
 2008-04-04  Jean-Louis Martineau <martineau@zmanda.com>
        * man/xml-source/*.xml: Use ulink tag to link to wiki.zmanda.com.
 
 2008-04-04  Jean-Louis Martineau <martineau@zmanda.com>
        * restore-src/restore.c: Check last_header->type != F_UNKNOWN.
 
+2008-04-01  Dustin J. Mitchell <dustin@zmanda.com>
+       Suggested by Sunil Sawant <sunil@zmanda.com>
+       * man/xml-source/amrecover.8.xml: suggest including a config in the
+         amrecover command line
+
+2008-04-01  John Franks <jfranks@zmanda.com>
+       * gnulib/regenerate/regenerate gnulib/regenerate/no-restrict.patch:
+         Patches to reapply after gnulib updates.
+       * gnulib/inet_ntop.c gnulib/inet_ntop.h gnulib/string.in.h
+         gnulib/gettimeofday.c gnulib/sys_time.in.h gnulib/base64.c
+         gnulib/getaddrinfo.c gnulib/Makefile.am gnulib/base64.h
+         gnulib/getaddrinfo.h:
+         Remove restricted keywords from source files.
+
+2008-04-01  Satya Ganga <gsat@zmanda.com>
+       * example/template.d/amanda-S3.conf.in: S3 device should have
+         "infinite" tape length
+
+2008-03-31  John Franks <jfranks@zmanda.com>
+       * common-src/stream.c
+         Fix warning about ininitialized variables.
+
+2008-03-31  John Franks <jfranks@zmanda.com>
+       * oldrecover-src/Makefile.am xfer-src/Makefile.am
+         recover-src/Makefile.am server-src/Makefile.am
+         restore-src/Makefile.am:
+         Fix build problems with multiply defined symbols.
+
 2008-03-31  Dan Locks <dwlocks@zmanda.com>
-       * packaging/deb/buildpkg
+       * packaging/deb/buildpkg
          packaging/rpm/buildpkg: added -p to cp to preserve file timestamps.
 
+2008-03-31  Dustin J. Mitchell <dustin@zmanda.com>, Jean-Louis Martineau <martineau@zmanda.com>
+       * client-src/sendbackup-gnutar.c client-src/sendsize.c
+         client-src/selfcheck.c: update amandates whenever possible, but only
+         complain when it is really needed: when using calcsize, or when
+         using GNUTAR and --without-gnutar-listdir.
+       * client-src/amandates.c: Set errno before return of start_amandates
+       * perl/Amanda/Paths.pm.in: always terminate a perl mod with '1;'
+
+2008-03-31  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/amgetconf.pl: Parse config after setup_applccation call.
+
+2008-03-31  Jean-Louis Martineau <martineau@zmanda.com>
+       * server-src/amcheck.c: Check errno after full_read.
+
 2008-03-31  Dan Locks <dwlocks@zmanda.com>
        * packaging/Makefile.am: add deb subdirectory.
 
+2008-03-31  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/rsh-security.c common-src/ssh-security.c: improve error
+         messages for resolve_hostname calls
+
+2008-03-27  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/util.c common-src/util.h: remove fullread(), fullwrite()
+       * gnulib/regenerate/regenerate gnulib/Makefile.am
+         config/gnulib/gnulib-cache.m4: add full-read, full-write modules
+       * oldrecover-src/extract_list.c client-src/noop.c
+         client-src/sendbackup-gnutar.c client-src/sendbackup.c
+         client-src/sendsize.c client-src/selfcheck.c amandad-src/amandad.c
+         application-src/amgtar.c recover-src/extract_list.c
+         server-src/changer.c server-src/logfile.c server-src/amindexd.c
+         server-src/amcheck.c server-src/dumper.c server-src/chunker.c
+         server-src/taper-port-source.c server-src/driverio.c
+         server-src/holding.c server-src/driver.c
+         server-src/taper-file-source.c restore-src/restore.c
+         common-src/security-util.c common-src/amanda.h 
+         tape-src/output-file.c: use gnulib full_read, full_write functions,
+         which have slightly different error semantics than the corresponding
+         Amanda functions.
+
+2008-03-27  Jean-Louis Martineau <martineau@zmanda.com>
+       * application-src/amgtar.c: Add 'CHECK-DEVICE' property.
+
 2008-03-27  Jean-Louis Martineau <martineau@zmanda.com>
        * device-src/activate-devpay.c (parse_commandline): Always return.
 
        * perl/Makefile.am (install-data-hook): Copy cygwin ddl if
          WANT_CYGWIN_COPY_PERL_DLL.
 
+2008-03-25  Jean-Louis Martineau <martineau@zmanda.com>
+       * common-src/conffile.c: Fix typo and remove unused prefix.
+
 2008-03-25  Jean-Louis Martineau <martineau@zmanda.com>
        * server-src/reporter.c: Check difference between origsize and outsize
          to find if the image is compressed.
 2008-03-25  Jean-Louis Martineau <martineau@zmanda.com>
        Greg Troxel reported the bug and possible solution.
        * common-src/stream.c (stream_server): New family argument, it is used
-                                              to create the socket.
+                                              to create the socket.
        * common-src/stream.h (stream_server): New prototype.
        * server-src/chunker.c, server-src/taper.c: Call stream_server with
          family of 'localhost', it's the name dumper use to contact them.
        * common-src/bsd-security.c, common-src/security-util.c: Call
          stream_server with family of incoming packet.
 
+2008-03-25  Jean-Louis Martineau <martineau@zmanda.com>
+       Davor Ocelic reported the problem.
+       * application-src/Makefile.am: Use applicationexec_PROGRAMS and
+         applicationexec_SCRIPTS to install executable.
+
 2008-03-25  Jean-Louis Martineau <martineau@zmanda.com>
        * common-src/security-util.c (show_stat_info): Use getpwuid_r
                                                       and getgrgid_r.
-
 2008-03-25  Dustin J. Mitchell <dustin@zmanda.com>
        * config/amanda/swig.m4: fix the fix to the fix for FreeBSD systems'
          peculiar linking of threading libraries.
          overrides
        * packaging/deb/amanda-backup-client.dirs: removed var/amanda
 
-2008-03-18  Jean-Louis Martineau <martineau@zmanda.com>
-       * Amanda 2.6.0 released.
-       * configure.in: AM_INIT_AUTOMAKE(amanda, "2.6.0")
-       * packaging/rpm/amanda.spec: %define amanda_version 2.6.0
-       * packaging/rpm/buildpkg: AMVER=amanda-2.6.0
+2008-03-18  Dustin J. Mitchell <dustin@zmanda.com>
+       * device-src/activate-devpay.c: fix type warning
 
 2008-03-17  Jean-Louis Martineau <martineau@zmanda.com>
        * server-src/diskfile.c: Correctly check if two hosts map to the same
                                 name.
 
+2008-03-15  Dustin J. Mitchell <dustin@zmanda.com>
+       * perl/Makefile.am perl/amglue/mainloop.c perl/amglue/amglue.h
+         perl/amglue/source.c: rename mainloop.c to source.c to avoid
+         conflicts with MainLoop.c on case-insensitive filesystems
+
 2008-03-14  Dan Locks <dwlocks@zmanda.com>
-       * packaging/deb/*: Initial debian package release.  This package is 
-         based on Bdale Garbee's work as the official debian maintainer for 
-         amanda.
+       * Initial debian release: This package is based on Bdale Garbee's
+         work as the official debian maintainer for amanda.
+
+2008-03-14  Jean-Louis Martineau <martineau@zmanda.com>
+       * man/xml-source/amanda.conf.5.xml: Document global and by dumptype
+                                           property.
+       * server-src/server_util.c: Rename _proplist to _property.
+       * server-src/diskfile.c: Rename _proplist to _property.
+       * server-src/amadmin.c (disklist_one): Print property.
+       * perl/Amanda/Config.swg: Add new constants to Amanda::Config
+       * installcheck/Amanda_Config.pl: Test global property.
+       * common-src/conffile.c: Add global and by dumptype property.
+       * common-src/conffile.h: Add global and by dumptype property.
+
+2008-03-14  Dustin J. Mitchell <dustin@zmanda.com>
+       * perl/Amanda/MainLoop.swg perl/Makefile.am: new perl module
+       * perl/amglue/amglue.h perl/amglue/mainloop.c: support for new module
+       * installcheck/Amanda_MainLoop.pl installcheck/Makefile.am: tests for
+         new module
+       * common-src/event.h: fix typo in comment
+
+2008-03-14  Dustin J. Mitchell <dustin@zmanda.com>
+       * xfer-src/dest-null.c: fix Solaris 8 compilation problem: isprint()
+         expects an int, not a char.
 
 2008-03-13  Dan Locks <dwlocks@zmanda.com>
        * packaging/rpm/amanda.spec: changed the PKG_CONFIG_PATH macro so that
          it works with rpm versions earlier than 4.4
 
+2008-03-13  Dustin J. Mitchell <dustin@zmanda.com>
+       * device-src/device-queueing.c device-src/device-queueing.h
+         server-src/taper-source.c server-src/taper-source.h
+         server-src/taper-source-test.c server-src/taper.c
+         common-src/queueing.c common-src/queueing.h: change ints in
+         consumer/producer to (s)size_t
+       * device-src/device.c device-src/device-queueing.c
+         device-src/tests/semaphore-test.c device-src/tests/Makefile.am
+         device-src/queueing.c device-src/semaphore.c
+         device-src/device-queueing.h device-src/queueing.h
+         device-src/Makefile.am device-src/semaphore.h
+         device-src/property.h server-src/taper.c common-src/queueing.c
+         common-src/queueing.h common-src/semaphore-test.c
+         common-src/semaphore.c common-src/semaphore.h
+         common-src/Makefile.am: move queueing and semaphore into
+         common-src, along with their tests
+       * configure.in xfer-src/source-random.c xfer-src/xfer-element.h
+         xfer-src/xfer-dest.c xfer-src/xfer-test.c xfer-src/xfer.c
+         xfer-src/xfer-dest.h xfer-src/amxfer.h xfer-src/dest-null.c
+         xfer-src/Makefile.am xfer-src/xfer.h xfer-src/xfer-element.c
+         xfer-src/filter-xor.c Makefile.am: introduce transfer architecture
+       * xfer-src/xmsg.c xfer-src/xfer-element.h xfer-src/xfer-test.c
+         xfer-src/xmsg.h xfer-src/xfer.c xfer-src/amxfer.h
+         xfer-src/Makefile.am xfer-src/xfer.h: support for sending
+         and receiving XMsgs.
+       * common-src/event.c common-src/event.h: add default_event_loop().
+       * device-src/device.c server-src/taper-source-test.c common-src/util.c
+         common-src/util.h common-src/glib-util.c common-src/glib-util.h:
+         create new glib_init() to do g_type_init(), initialize threads, etc.
+
+2008-03-13  Jean-Louis Martineau <martineau@zmanda.com>
+       * client-src/sendsize.c: Don't use sscanf for est->qamname because it
+                                can have a '%'.
+       * server-src/diskfile.c: Clean the diskname before using it as a regex.
+       * common-src/protocol.c: Fix bug if packet have a '%' character.
+
+2008-03-13  Jean-Louis Martineau <martineau@zmanda.com>
+       * installcheck/Installcheck/Run.pm: Increase size of TAPE.
+
+2008-03-12  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/event.c: Use %jd to print a pid_t, since it may be
+         larger on some platforms.
+
+2008-03-12  Jean-Louis Martineau <martineau@zmanda.com>
+       * common-src/conffile.c: Fix solaris 8 cc warning.
+
+2008-03-12  Jean-Louis Martineau <martineau@zmanda.com>
+       * client-src/sendbackup.c: Set stroptions to "".
+
+2008-03-12  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/event.c common-src/event.h common-src/event-test.c:
+         add two new GSources: child_watch_source (sends events when a child
+         dies) and fdsource (sends events when file descriptors match
+         conditions).  Thanks to Jean-Louis Martineau for finding and fixing
+         a race condition.
+
+2008-03-12  Dustin J. Mitchell <dustin@zmanda.com>
+       * gnulib/regenerate/regenerate gnulib/Makefile.am DEVELOPING: update
+         documentation to reflect use of gnulib's git repository
+
+2008-03-12  Jean-Louis Martineau <martineau@zmanda.com>
+       * installcheck/Makefile.am: Remove CONFIG_CLOBBER_MY_CONFIG,
+                                   it is done automaticaly.
+       * config/amanda/defaults.m4: AC_SUBST(CONFIG_CLOBBER_MY_CONFIG) to not
+                                    conflict with make CLOBBER_MY_CONFIG.
+
+2008-03-12  Jean-Louis Martineau <martineau@zmanda.com>
+       * installcheck/Makefile.am: Use CONFIG_CLOBBER_MY_CONFIG for Makefile
+                                   variable.
+
+2008-03-11  Dan Locks <dwlocks@zmanda.com>
+       * packaging/rpm/buildpkg: made the script quieter
+
 2008-03-12  Dan Locks <dwlocks@zmanda.com>
-       * packaging/rpm/buildpkg: made the script quieter, simplified its
-         usage by creating the required tarball on the fly.
        * packaging/rpm/amanda.spec: fixed a number of complaints from rpmlint,
          added --quiet to the configure invocation
 
 2008-03-10  Jean-Louis Martineau <martineau@zmanda.com>
-       * device-src/tests/semaphore-test.c,
-         device-src/tests/vfs_test.c: Call amanda_thread_init(NULL).
+       * gnulib: Update to latest version, add getopt module.
 
 2008-03-07  Jean-Louis Martineau <martineau@zmanda.com>
-       * Amanda 2.6.0b3 released.
-       * configure.in: AM_INIT_AUTOMAKE(amanda, "2.6.0b3")
-       * packaging/rpm/amanda.spec: %define amanda_version 2.6.0b3
-       * packaging/rpm/buildpkg: AMVER=amanda-2.6.0b3
+       * oldrecover-src/Makefile.am, example/Makefile.am,
+         amandad-src/Makefile.am, recover-src/Makefile.am,
+         restore-src/Makefile.am, Makefile.am: Include config/automake/vars.am.
+       * installcheck/Amanda_Config.pl: Check config_filename.
+       * installcheck/Installcheck/Config.pm: Use local amandates and
+                                              gnutar_listdir.
+       * installcheck/Makefile.am: Take a copy of amanda-client.conf
+       * config/amanda/defaults.m4: AC_SUBST(CLOBBER_MY_CONFIG)
+       * config/automake/scripts.am: DISTCLEANFILES += $(SCRIPTS_INCLUDE)
+       * config/automake/installperms.am: installperms.sh in top_builddir,
+                                          DISTCLEANFILES += $(installperms_sh)
+       * Makefile.am: add '--without-amperldir CLOBBER_MY_CONFIG=OK' to
+                      DISTCHECK_CONFIGURE_FLAGS.
+       * common-src/Makefile.am: distclean-local: remove svn-info.h.
+
+2008-03-07  Dan Locks <dwlocks@zmanda.com>
+       * packaging/rpm/buildpkg:  Simplified usage of packaging script by
+         creating a tarball from existing source.
+
+2008-03-06  Jean-Louis Martineau <martineau@zmanda.com>
+       * installcheck/Installcheck/Run.pm: merge from application-api.
+       * installcheck/Installcheck/Config.pm: merge from application-api.
+
+2008-03-06  Jean-Louis Martineau <martineau@zmanda.com>
+       * merge application-api
 
 2008-03-06  Jean-Louis Martineau <martineau@zmanda.com>
        * common-src/Makefile.am: dest=$(amlibexecdir).
        * packaging/rpm/amanda.spec: Add %{PERLSITELIB} in %files sections.
 
 2008-03-05  Jean-Louis Martineau <martineau@zmanda.com>
-       * restore-src/amidxtaped: Use default config if amrecover doesn't send                         a config name.  (amoldrecover doesn't send a config).
-       * restore-src/restore.c: amrecover from 2.4.5 doesn't send the filenum,          so desired_tape->numfiles == 0.
+       * restore-src/amidxtaped: Use default config if amrecover doesn't send
+                       a config name.  (amoldrecover doesn't send a config).
+       * restore-src/restore.c: amrecover from 2.4.5 doesn't send the filenum,
+         so desired_tape->numfiles == 0.
          If amidxtaped is launched directly from xinetd, then
          flags->pipe_to_fd == STDOUT_FILENO, but this test should only
          succeed for amrestore of amfetchdump.
        * config/amanda/dumpers.m4: Typo.
 
 2008-03-03  Jean-Louis Martineau <martineau@zmanda.com>
-       * device-src/tests/vfs_test.c: Fix ignoring
+       * device-src/tests/vfs_test.c, common-src/event-test.c: Fix ignoring
          return value of 'pipe', declared with attribute warn_unused_result.
 
 2008-02-29  Dustin J. Mitchell <dustin@zmanda.com>
        * common-src/amanda.h: add <stdint.h>
 
-2008-02-29  Dustin J. Mitchell <dustin@zmanda.com>
-       * installcheck/Amanda_Config.pl: fix Amanda_Config's use of the
-         missing Amanda::Tests
-
-2008-02-29  Dustin J. Mitchell <dustin@zmanda.com>
-       * installcheck/Makefile.am: remove Amconfig.pm from EXTRA_DIST, as it
-         is a generated file.
+2008-02-28  Dustin J. Mitchell <dustin@zmanda.com>
+       * config/automake/installperms.am: --without-installperms now
+         generates a shell-parsable list of desired permissions
+       * Makefile.am: erase installperms.sh before beginning a 'make 
+         install'
+       * oldrecover-src/Makefile.am client-src/Makefile.am
+         recover-src/Makefile.am server-src/Makefile.am: give mode
+         bits in octal
 
 2008-02-28  Dustin J. Mitchell <dustin@zmanda.com>
        Thanks to John E. Hein <jhein@timing.com> for identifying this problem
+       * perl/Amanda/Tests.swg: expose sizeof(size_t) to perl
        * installcheck/Amanda_Config.pl: use a properly-sized constant to
          check parsing of large configuration values
 
+
 2008-02-28  Jean-Louis Martineau <martineau@zmanda.com>
        * server-src/amindexd.c: Compute maxpart, call clean_dump.
        * server-src/disk_history.h (DUMP_ITEM): Add maxpart field.
                                        DUMP_ITEM if all part are not added.
        * common-src/tapelist.h (tapelist_t): Add partnum field.
        * common-src/tapelist.h (append_to_tapelist): New prototype,
-                                                     add partnum argument.
+                                                     add partnum argument.
        * common-src/tapelist.c (append_to_tapelist): New partnum argument.
        * restore-src/amfetchdump.c: Use new append_to_tapelist prototype.
 
+2008-02-28  Jean-Louis Martineau <martineau@zmanda.com>
+       * common-src/security-util.c: Don't write unclaimed warning if we have
+                                     an accept function.
+
+2008-02-27  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/testutils.c common-src/testutils.h
+         common-src/Makefile.am: add libtestutils.la
+       * common-src/event-test.c common-src/amflock-test.c:
+         use libtestutils.la
+
 2008-02-27  Jean-Louis Martineau <martineau@zmanda.com>
        * server-src/find.c: Use sort_key in switch statement.
 
 2008-02-26  Jean-Louis Martineau <martineau@zmanda.com>
        * NEWS, ReleaseNotes: Document --with-amlibdir.
        * config/amanda/dirs.m4: Add AS_HELP_STRING for --without-amlibdir and
-                               --without-amlibexecdir,
-                               Set AMPERLLIB to $amlibdir/perl.
+                                --without-amlibexecdir,
+                                Set AMPERLLIB to $amlibdir/perl.
+
+2008-02-26  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/event-test.c: a more robust and effective test of
+         EV_READFD; thanks to Jean-Louis Martineau for the suggestions.
 
 2008-02-26  Dustin J. Mitchell <dustin@zmanda.com>
        * perl/Makefile.am config/amanda/dirs.m4 config/amanda/summary.m4:
 
 2008-02-20  Jean-Louis Martineau <martineau@zmanda.com>
        * config/amanda/dirs.m4: Add --with-amlibdir and --with-amlibexecdir.
-       * NEWS, ReleaseNotes: Document it.
 
 2008-02-20  Jean-Louis Martineau <martineau@zmanda.com>
        * server-src/amcheck.c, server-src/dumper.c,
        * server-src/find.c: fix compiler warning on Solaris 8
 
 2008-02-15  Jean-Louis Martineau <martineau@zmanda.com>
-       * packaging/rpm/amanda.spec: Fix typo.
+       * packaging/rpm/amanda.spec: Remove amverify*
 
 2008-02-15  Jean-Louis Martineau <martineau@zmanda.com>
        * oldrecover-src/Makefile.am: Build all files in the build directory.
        * file server-src/infofile.c: Use %jd to print intmax_t value.
        * file server-src/driver.c: Use 'long long' and '%lld' to sscanf.
 
+2008-02-15  Jean-Louis Martineau <martineau@zmanda.com>
+       * packaging/rpm/amanda.spec: Fix typo.
+
 2008-02-15  Jean-Louis Martineau <martineau@zmanda.com>
        * server-src/amdump.sh: Don't use 'date -d', use sed.
 
+2008-02-14  Dustin J. Mitchell <dustin@zmanda.com>
+       * installcheck/Installcheck/Run.pm: run test dumps of a smaller
+         directory, to avoid overflowing test tapes
+
+2008-02-14  Dustin J. Mitchell <dustin@zmanda.com>
+       * dumper-src/amstar.pl dumper-src/amgtar.pl
+         device-src/tests/get-activation-key.pl server-src/amcheckdump.pl
+         server-src/amdevcheck.pl: add GPL header
+
+2008-02-14  Dustin J. Mitchell <dustin@zmanda.com>
+       * installcheck/Makefile.am installcheck/amdump.pl: add a check
+         that runs 'amdump' directly, since that fails often
+
+2008-02-14  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/event-test.c: make tests more robust to environmental
+         variations, clean up forked children
+
+2008-02-13  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/security-util.c 
+         common-src/security-util.h: don't cast pointers to
+         integers for tcp_conn event id's
+
 2008-02-13  Dan Locks <dwlocks@zmanda.com>
         * packaging/rpm/amanda.spec: added a check for PKG_CONFIG_PATH in the
           build environment as well as if provided on rpmbuild commandline.
           Conditionalized this var to handle cross compiling on FC8.
 
+2008-02-12  Dustin J. Mitchell <dustin@zmanda.com>
+       * amandad-src/amandad.c: use sizeof() instead of strlen()
+         in a constant expression
+
+2008-02-12  Dustin J. Mitchell <dustin@zmanda.com>
+       * amandad-src/amandad.c: initialize as->service
+       * common-src/event.c common-src/event.h: new GMainLoop-based
+         version of the event library, allowing GMainLoop-based and 
+         event-based processes to co-exist peacefully
+
+2008-02-12  Dustin J. Mitchell <dustin@zmanda.com>
+       * installcheck/amcheckdump.pl: fix typo
+
 2008-02-12  Jean-Louis Martineau <martineau@zmanda.com>
        * server-src/dumper.c: Fail if no header or no data.
 
        * server-src/amstatus.pl: Report failure if dumper succeed and
                                  chunker failed.
 
-2008-02-07  Jean-Louis Martineau <martineau@zmanda.com>
-       * NEWS, ReleaseNotes: Add notes about rsh/ssh and amandad_path.
+2008-02-12  Jean-Louis Martineau <martineau@zmanda.com>
+       * common-src/conffile.h (config_name, config_dir, config_filename):
+                                Remove extern declaration.
+       * common-src/conffile.h (get_config_name, get_config_dir,
+                                get_config_filename): New prototype.
+       * common-src/conffile.c (config_name, config_dir, config_filename):
+                                Declare static.
+       * common-src/conffile.h (get_config_name, get_config_dir,
+                                get_config_filename): New functions.
+       * perl/Amanda/Config.swg: Don't inline the functions.
+       * oldrecover-src/extract_list.c, client-src/sendbackup.c,
+         client-src/sendsize.c, client-src/selfcheck.c,
+         recover-src/amrecover.c, recover-src/extract_list.c,
+         server-src/changer.c, server-src/amlogroll.c,
+         server-src/amindexd.c, server-src/amcheck.c,
+         server-src/dumper.c, server-src/planner.c,
+         server-src/chunker.c, server-src/amadmin.c,
+         server-src/amtape.c, server-src/amcleanupdisk.c,
+         server-src/amflush.c, server-src/amtrmlog.c,
+         server-src/driverio.c, server-src/driver.c,
+         server-src/reporter.c, server-src/taper.c,
+         server-src/amtrmidx.c, server-src/diskfile.c,
+         server-src/amlabel.c,
+         restore-src/amfetchdump.c: Use new functions.
 
-2008-02-07  Jean-Louis Martineau <martineau@zmanda.com>
-       * Amanda 2.6.0b2 released.
-       * configure.in: AM_INIT_AUTOMAKE(amanda, "2.6.0b2")
-       * packaging/rpm/amanda.spec: %define amanda_version 2.6.0b2
-       * packaging/rpm/buildpkg: AMVER=amanda-2.6.0b2
+2008-02-12  Dustin J. Mitchell <dustin@zmanda.com>
+       * common-src/event-test.c common-src/Makefile.am: add checks
+         for the event module
+
+2008-02-12  Dustin J. Mitchell <dustin@zmanda.com>
+       * server-src/dumper.c server-src/server_util.c
+         server-src/infofile.c server-src/amtrmlog.c common-src/debug.c
+         common-src/file.c: Always call mkpdir without the 02000 bit set,
+         as it is not needed and causes problems on MacOS X.
+
+2008-02-11  Dustin J. Mitchell <dustin@zmanda.com>
+       * all source files: update GPL dates
+       * perl/*: use LGPL instead of GPL
+
+2008-02-11  Dustin J. Mitchell <dustin@zmanda.com>
+       * amandad-src/amandad.c: fix use of non-constant array size
+
+2008-02-11  Dustin J. Mitchell <dustin@zmanda.com>
+       * amandad-src/amandad.c: add hack to avoid a race condition in
+         sendbackup operation
+       * common-src/security-util.c: issue debug log message when data
+         tokens are dropped by the security API
 
 2008-02-07  Jean-Louis Martineau <martineau@zmanda.com>
        * recover-src/amrecover.c: Use tapedev from server if it is not set
-                                  in amanda.client.conf
+                                  in amanda.client.conf
        * example/amanda-client.conf.in: Document it.
 
 2008-02-07  Jean-Louis Martineau <martineau@zmanda.com>
-        * device-src/tape-device.c (tape_device_init): Init min_block_size
-          and fixed_block_size to 32768.
-
-2008-02-07  Jean-Louis Martineau <martineau@zmanda.com>
-       * device-src/tape-posix.c (tape_is_ready): Don't use GMT_ONLINE.
+       * device-src/tape-device.c (tape_device_init): Init min_block_size
+         and fixed_block_size to 32768.
 
 2008-02-07  Dustin J. Mitchell <dustin@zmanda.com>
-       * man/xml-source/amcheckdump.8.xml: add -o option
-       * man/Makefile.am: build amcheckdump manpage
+       * packaging/rpm/amanda_enterprise.spec man/Makefile.am
+         man/xml-source/amverify.8.xml man/xml-source/amverifyrun.8.xml
+         man/xml-source/amcheckdump.8.xml server-src/amverifyrun.sh
+         server-src/amverify.sh server-src/Makefile.am: remove amverify*
        * server-src/amdevcheck.pl: tweak @ARGV parsing
        * server-src/amcheckdump.pl installcheck/Installcheck/Run.pm
          installcheck/amcheckdump.pl: significant rewrite to catch more errors
          and not loop for ever on some errors.
 
+2008-02-01  Dustin J. Mitchell <dustin@zmanda.com>
+       * server-src/amgetconf.pl installcheck/amgetconf.pl
+         common-src/conffile.c: fix and test amgetconf to allow extra
+         command-line arguments (undocumented), to allow -o options without a
+         space, and to correctly return empty results for empty build
+         variables
+
 2008-02-01  Dan Locks <dwlocks@zmanda.com>
        * packaging/rpm/amanda.spec: added amdumpcheck.8.gz to the %files list
          for both client and server, removed amplot from client, added missing
          directory %{SYSCONFDIR}/amanda
 
 2008-01-29  Dan Locks <dwlocks@zmanda.com>
-       * packaging/rpm/amanda.spec: changed %{SYSCONFDIR} to %{LOCALSTATEDIR}
-         where amanda/amandates is concerned.  also added %{LOCALSTATEDIR} to
-         the %files list.
+        * packaging/rpm/amanda.spec: changed %{SYSCONFDIR} to %{LOCALSTATEDIR}
+          where amanda/amandates is concerned.  also added %{LOCALSTATEDIR} to
+          the %files list.
 
 2008-01-29  Dan Locks <dwlocks@zmanda.com>
-       * man/xml-src/*: added wiki.zmanda.com to "see also" section of all
-         man pages.
+       * man/xml-source/* added http://wiki.zmanda.com to the "see also"
+         section
 
 2008-01-29  Jean-Louis Martineau <martineau@zmanda.com>
        * client-src/sendbackup.c: Check for g_options.
 
 2008-01-28  Dustin J. Mitchell <dustin@zmanda.com>
        * configure.in config/amanda/ipv6.m4 common-src/amanda.h: check
-         for netinet/in.h and in_port_t, and define the latter if
+         for netinet/in.h and in_port_t, and define the latter if 
          necessary.  Thanks to Craig Dewick <cdewick@lios.apana.org.au>
          for the suggestion.
 
 2008-01-22  Dustin J. Mitchell <dustin@zmanda.com>
        * configure.in config/amanda/userid.m4: add --with-single-userid
 
+2008-01-22  Dustin J. Mitchell <dustin@zmanda.com>
+       * server-src/amfreetapes.sh: remove unused script
+
 2008-01-22  Dustin J. Mitchell <dustin@zmanda.com>
        * perl/amglue/amglue.h perl/amglue/bigint.c: Include integer limits
          for all amglue files where they are missing from glib headers
        * config/amanda/dumpers.m4: eliminate strange warning when
          --without-smbclient is given
 
+2008-01-18  Dustin J. Mitchell <dustin@zmanda.com>
+       * server-src/amgetconf.pl perl/Amanda/Constants.pm.in
+         installcheck/Amanda_Types.pl installcheck/Amanda_Config.pl
+         installcheck/Amanda_Tapelist.pl installcheck/Amanda_Debug.pl
+         installcheck/Amanda_Changer.pl installcheck/amdevcheck.pl
+         installcheck/Installcheck/Config.pm
+         installcheck/Amanda_Cmdline.pl installcheck/amcheckdump.pl
+         installcheck/Amanda_Logfile.pl installcheck/amgetconf.pl:
+         accumulated tweaks and updates to installchecks
+
+2008-01-18  Dustin J. Mitchell <dustin@zmanda.com>
+       * perl/Amanda/Tests.swg perl/Makefile.am installcheck/bigint.pl
+         installcheck/Makefile.am: new tests for integer-handling
+         SWIG support, including an installed module (Amanda::Test) that
+         is not used except by this test.
+
+2008-01-18  Dustin J. Mitchell <dustin@zmanda.com>
+       * installcheck/Amanda_Types.pl
+         installcheck/Amanda_Config.pl installcheck/Amanda_Changer.pl
+         installcheck/Amconfig.pm.in installcheck/amdevcheck.pl
+         installcheck/Installcheck installcheck/Installcheck/Run.pm
+         installcheck/Installcheck/Config.pm installcheck/Makefile.am
+         installcheck/amcheckdump.pl installcheck/Amanda_Logfile.pl
+         installcheck/amgetconf.pl: tweaks:
+          - Move installcheck utilities to the Installcheck::* namespace
+          - add Installcheck::Run to help with setting up amdump runs, and
+            running applications in general
+          - Add complete runs to amdevcheck, amcheckdump
+          - Return a nonzero exit status from amgetconf when an invalid 
+            configuration parameter is specified.
+
+2008-01-18  Dustin J. Mitchell <dustin@zmanda.com>
+       * perl/Amanda/Tapelist.swg perl/Amanda/Tapefile.swg perl/Makefile.am:
+         new module (Tapelist) replaces old stub (Tapefile)
+       * installcheck/Amanda_Tapelist.pl installcheck/Makefile.am: test new
+         module
+       * server-src/amcheckdump.pl installcheck/Amanda_Logfile.pl: use new
+         module
+
+2008-01-18  Dustin J. Mitchell <dustin@zmanda.com>
+       * perl/Makefile.am perl/Amanda/Debug.swg: handle die() and warn() with
+         critical() and warning(), respectively
+       * server-src/amgetconf.pl server-src/amcheckdump.pl
+         server-src/amdevcheck.pl: use die()
+       * installcheck/Amanda_Config.pl installcheck/Amanda_Changer.pl
+         installcheck/Amanda_Debug.pl installcheck/Makefile.am: new/updated
+         unit tests
+
+2008-01-18  Dustin J. Mitchell <dustin@zmanda.com>
+       * man/xml-source/amgetconf.8.xml server-src/amgetconf.pl
+         server-src/getconf.c server-src/Makefile.am: rewrite amgetconf in
+         Perl, and add the ability to list available build variables.
+       * config/amanda/krb4-security.m4 config/amanda/krb5-security.m4
+         config/amanda/bsd-security.m4 config/amanda/dumpers.m4
+         config/amanda/bsdtcp-security.m4 config/amanda/userid.m4
+         config/amanda/rsh-security.m4 config/amanda/ssh-security.m4
+         config/amanda/bsdudp-security.m4 config/amanda/compress.m4
+         config/amanda/debugging.m4 config/amanda/flock.m4: AC_SUBST a bunch
+         of constants for use in Amanda::Constants
+       * perl/Makefile.am perl/Amanda/Paths.pm.in
+         perl/Amanda/Constants.pm.in: add new constants
+       * perl/Amanda/Config.swg: add getconf_byname_strs
+       * installcheck/amgetconf.pl: check new functionality
+       * perl/Amanda/Util.swg common-src/util.c common-src/util.h: add
+         RUNNING_AS_ANY
+
+2008-01-17  Jean-Louis Martineau <martineau@zmanda.com>
+       * packaging/rpm/buildpkg, packaging/rpm/amanda.spec,
+         configure.in: Set for release 2.6.1alpha.
+
 2008-01-16  Dustin J. Mitchell <dustin@zmanda.com>
        * installcheck/Makefile.am: Require user to specify
          CLOBBER_MY_CONFIG=OK when running installchecks
index 8ba7d324c8b323d7c38b603b01e2d8c8247f857f..583205b420bd40af1ceb714250b82916cc58c477 100644 (file)
@@ -18,15 +18,25 @@ This should probably be done after most releases, so that we have
 adequate time to uncover any bugs or problems in the new gnulib before
 we make another release.
 
-To update the gnulib files included with Amanda, you'll first need a
-CVS checkout of gnulib; let's call it $GNULIB_CO.  Then, in the root
-of the Amanda source, run
+To update the gnulib files included with Amanda, you'll first need a git
+working copy of gnulib; let's call it $GNULIB_BR:
 
-  GNULIB_TOOL=$GNULIB_CO/gnulib-tool ./gnulib/regenerate/regenerate
+  cd /tmp
+  git clone git://git.savannah.gnu.org/gnulib.git
+  GNULIB_BR=/tmp/gnulib
+
+See http://www.gnu.org/software/gnulib/ for more information.  Then, in the
+root of the Amanda source, run
+
+  GNULIB_TOOL=$GNULIB_BR/gnulib-tool ./gnulib/regenerate/regenerate
 
 Use 'svn status' to figure out what changed, and 'svn add' / 'svn rm'
 to inform Subversion.  Then re-run autogen, configure, make, and test
-the result.  If all is well, commit.
+the result.
+
+Get the object ID of the latest commit, using 'git show', and replace the
+previous object ID in Amanda's gnulib/regenerate/regenerate, so that other
+developers can access the same "release" of gnulib as you did.
 
 Updating Libtool
 ----------------
index b6824ac0578d82e12055982a74c3687032f5e64a..dcbb1bc30da175a5f7e133d01ae9cb17fa5db135 100644 (file)
@@ -1,16 +1,16 @@
 ## Process this file with automake to produce Makefile.in
 AUTOMAKE_OPTIONS = 1.4 foreign
 
+include $(top_srcdir)/config/automake/vars.am
+include $(top_srcdir)/config/automake/installperms.am
+
 ACLOCAL_AMFLAGS = --force -I . -I config -I config/gettext-macros -I config/gnulib -I config/amanda -I config/macro-archive
 
 if WANT_CLIENT
-CLIENT_SUBDIRS = client-src dumper-src
-endif
-if WANT_TAPE
-TAPE_SUBDIRS = tape-src
+CLIENT_SUBDIRS = client-src application-src
 endif
 if WANT_SERVER
-SERVER_SUBDIRS = device-src server-src changer-src
+SERVER_SUBDIRS = device-src server-src changer-src xfer-src
 endif
 if WANT_RESTORE
 RESTORE_SUBDIRS = restore-src
@@ -22,10 +22,11 @@ if WANT_AMPLOT
 PLOT_SUBDIRS = amplot
 endif
 # order is significant, don't change it arbitrarily
-SUBDIRS = \
+SUBDIRS = \
        gnulib \
        config \
        common-src \
+       amar-src \
        amandad-src \
        $(TAPE_SUBDIRS) \
        $(CLIENT_SUBDIRS) \
@@ -46,7 +47,7 @@ pkgdata_DATA = \
        NEWS            \
        ChangeLog
 
-EXTRA_DIST = $(SNAPSHOT_STAMP) \
+EXTRA_DIST += $(SNAPSHOT_STAMP) \
        $(pkgdata_DATA)                 \
         autogen                        \
        contrib/README                  \
@@ -74,6 +75,10 @@ EXTRA_DIST = $(SNAPSHOT_STAMP) \
 libtool: $(LIBTOOL_DEPS)
        $(SHELL) ./config.status --recheck
 
+# empty out the installperms manifest file when we start
+install-exec-local: installperms-init
+install-data-local: installperms-init
+
 ## This is only meaningful for snapshots, but it won't hurt releases.
 CONFIG_STATUS = config.status
 $(CONFIG_STATUS): $(SNAPSHOT_STAMP)
@@ -89,7 +94,7 @@ lint:
        (cd recover-src; make lint)
        (cd restore-src; make lint)
        (cd server-src; make lint)
-       (cd tape-src; make lint)
+       (cd xfer-src; make lint)
 
 ## Do not release the *.test.c sources.  They get built on the fly and
 ## would contain a path from the distribution machine, which will just
@@ -100,4 +105,4 @@ dist-hook:
 
 # ensure that configure gets the right arguments for distcheck; this keeps the
 # user/group through to the distcheck, rather than defaulting back to 'amanda'.
-DISTCHECK_CONFIGURE_FLAGS = --with-user=$(CLIENT_LOGIN) --with-group=$(SETUID_GROUP) --with-owner=$(BINARY_OWNER) --disable-installperms --without-force-uid --with-tmpdir=$(AMANDA_TMPDIR) SINGLE_USERID=yes
+DISTCHECK_CONFIGURE_FLAGS = --with-user=$(CLIENT_LOGIN) --with-group=$(SETUID_GROUP) --with-owner=$(BINARY_OWNER) --disable-installperms --without-amperldir --without-force-uid --with-tmpdir=$(AMANDA_TMPDIR) SINGLE_USERID=yes CLOBBER_MY_CONFIG=OK
index ac65c5e70b58582f2b4528d9c6bab7b0a7345be2..b1884a3e612aca2b429af34ef165db593a08063b 100644 (file)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  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.
 
 @SET_MAKE@
 
+# vim:ft=automake
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+# 
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License version 2.1 as 
+# published by the Free Software Foundation.
+# 
+# This 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 this library; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+# 
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+# simple include file to pre-define variables which are then +='d by other
+# scripts in this directory.
+
+# vim:ft=automake
+#
+# Adjust post-install permissions settings.  This rule works off two
+# specially-formatted variables, INSTALLPERMS_exec and INSTALLPERMS_data. 
+# Each is a whitespace-separated list of commands, all of which are either
+# a variable assignment or a filename.  Three variables are available:
+#
+#  - dest= sets the destination directory to e.g., $(sbindir)
+#  - chown= controls changes in ownership; value is first argument to chown
+#  - chmod= controls changes in permissions; value is first argument to chmod
+#
+# As a special case, chown=amanda is taken as equivalent to 
+# chown=$(BINARY_OWNER):$(SETUID_GROUP), which may otherwise have problems with
+# whitespace in the user/group names.
+# 
+# when a filename is seen, the currently active variables are applied.
+#
+# Note that scripts are data, not executables!
+#
+# EXAMPLE
+#
+# sbin_PROGRAMS = foo bar bing
+# libexec_PROGRAMS = pro gram
+# sbin_SCRIPTS = sk ript
+# INSTALLPERMS_exec = \
+#      dest=$(sbindir) chown=amanda chmod= \
+#              foo bar \
+#      chmod=07450 \
+#              bing
+#      dest=$(libexecdir) chmod= \
+#              $(libexec_PROGRAMS)
+# INSTALLPERMS_data = \
+#      dest=$(sbindir) chown=amanda chmod= \
+#              $(sbin_SCRIPTS)
+#
+# This whole operation is not required when making builds for packaging,
+# and can be disabled with --disable-installperms, via the WANT_INSTALLPERMS
+# AM_CONDITIONAL.  When disabled, the file 'installperms.sh' in the top-level
+# build directory is populated with a format suitable for shell interpretation,
+# with lines like this:
+#   installperm "amanda:disk" "04750" "/usr/local/sbin/bing"
+# the arguments being, respectively, owner:group, mode, and filename.  There will
+# be exactly one line for each file which has specific permissions.  The intention
+# is that this file be used by packaging scripts to set correct permissions at install
+# time.  Note that files which have no special permissions requirements do not appear 
+# in this file at all, due to limitations of Automake.
+
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -33,18 +102,22 @@ POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = .
 DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
-       $(srcdir)/Makefile.in $(top_srcdir)/configure \
+       $(srcdir)/Makefile.in \
+       $(top_srcdir)/config/automake/installperms.am \
+       $(top_srcdir)/config/automake/vars.am $(top_srcdir)/configure \
        $(top_srcdir)/example/template.d/advanced.conf.in \
        $(top_srcdir)/example/template.d/amanda-S3.conf.in \
        $(top_srcdir)/example/template.d/amanda-harddisk.conf.in \
        $(top_srcdir)/example/template.d/amanda-single-tape.conf.in \
        $(top_srcdir)/example/template.d/amanda-tape-changer.conf.in \
        AUTHORS ChangeLog INSTALL NEWS
+@WANT_INSTALLPERMS_FALSE@am__append_1 = $(installperms_sh)
+subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps =  \
        $(top_srcdir)/config/macro-archive/ac_define_dir.m4 \
+       $(top_srcdir)/config/macro-archive/ac_perl_module_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_perl_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_swig.m4 \
        $(top_srcdir)/config/macro-archive/ax_compare_version.m4 \
@@ -78,6 +151,7 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/amanda/libs.m4 \
        $(top_srcdir)/config/amanda/net.m4 \
        $(top_srcdir)/config/amanda/progs.m4 \
+       $(top_srcdir)/config/amanda/ps.m4 \
        $(top_srcdir)/config/amanda/readdir.m4 \
        $(top_srcdir)/config/amanda/readline.m4 \
        $(top_srcdir)/config/amanda/rsh-security.m4 \
@@ -100,7 +174,9 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/float_h.m4 \
        $(top_srcdir)/config/gnulib/fsusage.m4 \
        $(top_srcdir)/config/gnulib/getaddrinfo.m4 \
+       $(top_srcdir)/config/gnulib/getopt.m4 \
        $(top_srcdir)/config/gnulib/gettimeofday.m4 \
+       $(top_srcdir)/config/gnulib/gnulib-common.m4 \
        $(top_srcdir)/config/gnulib/gnulib-comp.m4 \
        $(top_srcdir)/config/gnulib/include_next.m4 \
        $(top_srcdir)/config/gnulib/inet_ntop.m4 \
@@ -128,7 +204,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/sys_stat_h.m4 \
        $(top_srcdir)/config/gnulib/sys_time_h.m4 \
        $(top_srcdir)/config/gnulib/tempname.m4 \
-       $(top_srcdir)/config/gnulib/ulonglong.m4 \
        $(top_srcdir)/config/gnulib/unistd_h.m4 \
        $(top_srcdir)/config/gnulib/vasnprintf.m4 \
        $(top_srcdir)/config/gnulib/visibility.m4 \
@@ -139,7 +214,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gettext-macros/lib-ld.m4 \
        $(top_srcdir)/config/gettext-macros/lib-link.m4 \
        $(top_srcdir)/config/gettext-macros/lib-prefix.m4 \
-       $(top_srcdir)/config/gettext-macros/longlong.m4 \
        $(top_srcdir)/config/gettext-macros/nls.m4 \
        $(top_srcdir)/config/gettext-macros/po.m4 \
        $(top_srcdir)/config/gettext-macros/progtest.m4 \
@@ -155,8 +229,8 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
  configure.lineno config.status.lineno
 mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/config/config.h
-CONFIG_CLEAN_FILES = example/template.d/amanda-S3.conf \
-       example/template.d/advanced.conf \
+CONFIG_CLEAN_FILES = example/template.d/advanced.conf \
+       example/template.d/amanda-S3.conf \
        example/template.d/amanda-harddisk.conf \
        example/template.d/amanda-single-tape.conf \
        example/template.d/amanda-tape-changer.conf
@@ -182,10 +256,10 @@ RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive   \
   distclean-recursive maintainer-clean-recursive
 ETAGS = etags
 CTAGS = ctags
-DIST_SUBDIRS = gnulib config common-src amandad-src tape-src \
-       client-src dumper-src device-src server-src changer-src \
-       restore-src recover-src oldrecover-src amplot perl po man \
-       example packaging installcheck
+DIST_SUBDIRS = . gnulib config common-src amar-src amandad-src \
+       client-src application-src device-src server-src changer-src \
+       xfer-src restore-src recover-src oldrecover-src amplot perl po \
+       man example packaging installcheck
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 distdir = $(PACKAGE)-$(VERSION)
 top_distdir = $(distdir)
@@ -198,6 +272,7 @@ GZIP_ENV = --best
 distuninstallcheck_listfiles = find . -type f -print
 distcleancheck_listfiles = find . -type f -print
 ACLOCAL = @ACLOCAL@
+AIX_BACKUP = @AIX_BACKUP@
 ALLOCA = @ALLOCA@
 ALLOCA_H = @ALLOCA_H@
 AMANDA_DBGDIR = @AMANDA_DBGDIR@
@@ -212,8 +287,10 @@ AMPLOT_CAT_GZIP = @AMPLOT_CAT_GZIP@
 AMPLOT_CAT_PACK = @AMPLOT_CAT_PACK@
 AMPLOT_COMPRESS = @AMPLOT_COMPRESS@
 AMTAR = @AMTAR@
+APPLICATION_DIR = @APPLICATION_DIR@
 AR = @AR@
 ARPA_INET_H = @ARPA_INET_H@
+ASSERTIONS = @ASSERTIONS@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -225,16 +302,28 @@ BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@
 BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@
 BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@
 BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@
+BSDTCP_SECURITY = @BSDTCP_SECURITY@
+BSDUDP_SECURITY = @BSDUDP_SECURITY@
+BSD_SECURITY = @BSD_SECURITY@
 CAT = @CAT@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
+CHECK_USERID = @CHECK_USERID@
 CHIO = @CHIO@
 CHS = @CHS@
+CLIENT_HOST_INSTANCE = @CLIENT_HOST_INSTANCE@
+CLIENT_HOST_KEY_FILE = @CLIENT_HOST_KEY_FILE@
+CLIENT_HOST_PRINCIPAL = @CLIENT_HOST_PRINCIPAL@
 CLIENT_LOGIN = @CLIENT_LOGIN@
 CLIENT_SCRIPTS_OPT = @CLIENT_SCRIPTS_OPT@
 COMPRESS = @COMPRESS@
+COMPRESS_BEST_OPT = @COMPRESS_BEST_OPT@
+COMPRESS_FAST_OPT = @COMPRESS_FAST_OPT@
+COMPRESS_PATH = @COMPRESS_PATH@
+COMPRESS_SUFFIX = @COMPRESS_SUFFIX@
+CONFIG_CLOBBER_MY_CONFIG = @CONFIG_CLOBBER_MY_CONFIG@
 CONFIG_DIR = @CONFIG_DIR@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
@@ -248,6 +337,7 @@ DD = @DD@
 DEFAULT_AMANDATES_FILE = @DEFAULT_AMANDATES_FILE@
 DEFAULT_CHANGER_DEVICE = @DEFAULT_CHANGER_DEVICE@
 DEFAULT_CONFIG = @DEFAULT_CONFIG@
+DEFAULT_MAILER = @DEFAULT_MAILER@
 DEFAULT_SERVER = @DEFAULT_SERVER@
 DEFAULT_TAPE_DEVICE = @DEFAULT_TAPE_DEVICE@
 DEFAULT_TAPE_SERVER = @DEFAULT_TAPE_SERVER@
@@ -255,7 +345,7 @@ DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DOC_BUILD_DATE = @DOC_BUILD_DATE@
 DUMP = @DUMP@
-DUMPER_DIR = @DUMPER_DIR@
+DUMP_RETURNS_1 = @DUMP_RETURNS_1@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -268,6 +358,7 @@ F77 = @F77@
 FFLAGS = @FFLAGS@
 FLOAT_H = @FLOAT_H@
 GETCONF = @GETCONF@
+GETOPT_H = @GETOPT_H@
 GETTEXT = @GETTEXT@
 GLIB_CFLAGS = @GLIB_CFLAGS@
 GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
@@ -278,9 +369,12 @@ GMSGFMT_015 = @GMSGFMT_015@
 GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
 GNULIB_CHOWN = @GNULIB_CHOWN@
 GNULIB_DUP2 = @GNULIB_DUP2@
+GNULIB_ENVIRON = @GNULIB_ENVIRON@
 GNULIB_FCHDIR = @GNULIB_FCHDIR@
 GNULIB_FFLUSH = @GNULIB_FFLUSH@
+GNULIB_FOPEN = @GNULIB_FOPEN@
 GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
+GNULIB_FREOPEN = @GNULIB_FREOPEN@
 GNULIB_FSEEK = @GNULIB_FSEEK@
 GNULIB_FSEEKO = @GNULIB_FSEEKO@
 GNULIB_FTELL = @GNULIB_FTELL@
@@ -290,6 +384,7 @@ GNULIB_GETCWD = @GNULIB_GETCWD@
 GNULIB_GETDELIM = @GNULIB_GETDELIM@
 GNULIB_GETLINE = @GNULIB_GETLINE@
 GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
+GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@
 GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
 GNULIB_LCHOWN = @GNULIB_LCHOWN@
 GNULIB_LSEEK = @GNULIB_LSEEK@
@@ -314,8 +409,10 @@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
 GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
 GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
 GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
+GNULIB_PUTENV = @GNULIB_PUTENV@
 GNULIB_READLINK = @GNULIB_READLINK@
 GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@
+GNULIB_SETENV = @GNULIB_SETENV@
 GNULIB_SLEEP = @GNULIB_SLEEP@
 GNULIB_SNPRINTF = @GNULIB_SNPRINTF@
 GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@
@@ -324,11 +421,15 @@ GNULIB_STPNCPY = @GNULIB_STPNCPY@
 GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
 GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
 GNULIB_STRDUP = @GNULIB_STRDUP@
+GNULIB_STRERROR = @GNULIB_STRERROR@
 GNULIB_STRNDUP = @GNULIB_STRNDUP@
 GNULIB_STRNLEN = @GNULIB_STRNLEN@
 GNULIB_STRPBRK = @GNULIB_STRPBRK@
 GNULIB_STRSEP = @GNULIB_STRSEP@
+GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@
+GNULIB_STRSTR = @GNULIB_STRSTR@
 GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
+GNULIB_UNSETENV = @GNULIB_UNSETENV@
 GNULIB_VASPRINTF = @GNULIB_VASPRINTF@
 GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@
 GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
@@ -342,6 +443,7 @@ GOBJECT_QUERY = @GOBJECT_QUERY@
 GREP = @GREP@
 GZIP = @GZIP@
 HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@
+HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@
 HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@
 HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@
 HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
@@ -350,9 +452,10 @@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
 HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@
 HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
 HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
-HAVE_DECL_STRNCASECMP = @HAVE_DECL_STRNCASECMP@
+HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@
 HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
 HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
+HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@
 HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
 HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
 HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
@@ -360,7 +463,9 @@ HAVE_DUP2 = @HAVE_DUP2@
 HAVE_FSEEKO = @HAVE_FSEEKO@
 HAVE_FTELLO = @HAVE_FTELLO@
 HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
+HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
 HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
+HAVE_GZIP = @HAVE_GZIP@
 HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
 HAVE_IO_H = @HAVE_IO_H@
 HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
@@ -369,8 +474,10 @@ HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@
 HAVE_MEMPCPY = @HAVE_MEMPCPY@
 HAVE_MKDTEMP = @HAVE_MKDTEMP@
 HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@
+HAVE_OS_H = @HAVE_OS_H@
 HAVE_READLINK = @HAVE_READLINK@
 HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@
+HAVE_SETENV = @HAVE_SETENV@
 HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
 HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
 HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
@@ -378,7 +485,6 @@ HAVE_SLEEP = @HAVE_SLEEP@
 HAVE_STDINT_H = @HAVE_STDINT_H@
 HAVE_STPCPY = @HAVE_STPCPY@
 HAVE_STPNCPY = @HAVE_STPNCPY@
-HAVE_STRCASECMP = @HAVE_STRCASECMP@
 HAVE_STRCASESTR = @HAVE_STRCASESTR@
 HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
 HAVE_STRNDUP = @HAVE_STRNDUP@
@@ -387,10 +493,12 @@ HAVE_STRSEP = @HAVE_STRSEP@
 HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@
 HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
 HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
+HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
 HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
 HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
 HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
 HAVE_UNISTD_H = @HAVE_UNISTD_H@
+HAVE_UNSETENV = @HAVE_UNSETENV@
 HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
 HAVE_VASPRINTF = @HAVE_VASPRINTF@
 HAVE_VISIBILITY = @HAVE_VISIBILITY@
@@ -406,6 +514,8 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 INTLLIBS = @INTLLIBS@
 INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+KRB4_SECURITY = @KRB4_SECURITY@
+KRB5_SECURITY = @KRB5_SECURITY@
 LDFLAGS = @LDFLAGS@
 LEX = @LEX@
 LEXLIB = @LEXLIB@
@@ -422,6 +532,8 @@ LIBTHREAD = @LIBTHREAD@
 LIBTOOL = @LIBTOOL@
 LIBTOOL_DEPS = @LIBTOOL_DEPS@
 LN_S = @LN_S@
+LOCKING = @LOCKING@
+LOW_TCPPORTRANGE = @LOW_TCPPORTRANGE@
 LTLIBICONV = @LTLIBICONV@
 LTLIBINTL = @LTLIBINTL@
 LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
@@ -430,7 +542,6 @@ LTLIBPTH = @LTLIBPTH@
 LTLIBTHREAD = @LTLIBTHREAD@
 MAILER = @MAILER@
 MAKEINFO = @MAKEINFO@
-MAXTAPEBLOCKSIZE = @MAXTAPEBLOCKSIZE@
 MCUTIL = @MCUTIL@
 MKDIR_P = @MKDIR_P@
 MSGFMT = @MSGFMT@
@@ -466,26 +577,37 @@ PERL_INC = @PERL_INC@
 PKG_CONFIG = @PKG_CONFIG@
 POSUB = @POSUB@
 PRINT = @PRINT@
+PS = @PS@
+PS_ARGUMENT = @PS_ARGUMENT@
 PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
 RANLIB = @RANLIB@
 READLINE_LIBS = @READLINE_LIBS@
 REPLACE_CHOWN = @REPLACE_CHOWN@
 REPLACE_FCHDIR = @REPLACE_FCHDIR@
 REPLACE_FFLUSH = @REPLACE_FFLUSH@
+REPLACE_FOPEN = @REPLACE_FOPEN@
 REPLACE_FPRINTF = @REPLACE_FPRINTF@
+REPLACE_FREOPEN = @REPLACE_FREOPEN@
 REPLACE_FSEEK = @REPLACE_FSEEK@
 REPLACE_FSEEKO = @REPLACE_FSEEKO@
 REPLACE_FTELL = @REPLACE_FTELL@
 REPLACE_FTELLO = @REPLACE_FTELLO@
 REPLACE_GETCWD = @REPLACE_GETCWD@
 REPLACE_GETLINE = @REPLACE_GETLINE@
+REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
 REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
 REPLACE_LCHOWN = @REPLACE_LCHOWN@
 REPLACE_LSEEK = @REPLACE_LSEEK@
+REPLACE_MEMMEM = @REPLACE_MEMMEM@
 REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
 REPLACE_PRINTF = @REPLACE_PRINTF@
+REPLACE_PUTENV = @REPLACE_PUTENV@
 REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
 REPLACE_SPRINTF = @REPLACE_SPRINTF@
+REPLACE_STRCASESTR = @REPLACE_STRCASESTR@
+REPLACE_STRERROR = @REPLACE_STRERROR@
+REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@
+REPLACE_STRSTR = @REPLACE_STRSTR@
 REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
 REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
 REPLACE_VPRINTF = @REPLACE_VPRINTF@
@@ -493,7 +615,11 @@ REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
 REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
 REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
 RESTORE = @RESTORE@
+RSH_SECURITY = @RSH_SECURITY@
 SAMBA_CLIENT = @SAMBA_CLIENT@
+SERVER_HOST_INSTANCE = @SERVER_HOST_INSTANCE@
+SERVER_HOST_KEY_FILE = @SERVER_HOST_KEY_FILE@
+SERVER_HOST_PRINCIPAL = @SERVER_HOST_PRINCIPAL@
 SERVICE_SUFFIX = @SERVICE_SUFFIX@
 SETUID_GROUP = @SETUID_GROUP@
 SET_MAKE = @SET_MAKE@
@@ -503,6 +629,7 @@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
 SNAPSHOT_STAMP = @SNAPSHOT_STAMP@
 SORT = @SORT@
 SSH = @SSH@
+SSH_SECURITY = @SSH_SECURITY@
 STDBOOL_H = @STDBOOL_H@
 STDINT_H = @STDINT_H@
 STRIP = @STRIP@
@@ -512,7 +639,14 @@ SWIG_LIB = @SWIG_LIB@
 SYS_SOCKET_H = @SYS_SOCKET_H@
 SYS_STAT_H = @SYS_STAT_H@
 SYS_TIME_H = @SYS_TIME_H@
+TCPPORTRANGE = @TCPPORTRANGE@
+TICKET_LIFETIME = @TICKET_LIFETIME@
+UDPPORTRANGE = @UDPPORTRANGE@
+UNCOMPRESS_OPT = @UNCOMPRESS_OPT@
+UNCOMPRESS_PATH = @UNCOMPRESS_PATH@
+USE_AMANDAHOSTS = @USE_AMANDAHOSTS@
 USE_NLS = @USE_NLS@
+USE_RUNDUMP = @USE_RUNDUMP@
 USE_VERSION_SUFFIXES = @USE_VERSION_SUFFIXES@
 VDUMP = @VDUMP@
 VERSION = @VERSION@
@@ -521,6 +655,7 @@ VERSION_MAJOR = @VERSION_MAJOR@
 VERSION_MINOR = @VERSION_MINOR@
 VERSION_PATCH = @VERSION_PATCH@
 VERSION_SUFFIX = @VERSION_SUFFIX@
+VOID_UNSETENV = @VOID_UNSETENV@
 VRESTORE = @VRESTORE@
 VXDUMP = @VXDUMP@
 VXRESTORE = @VXRESTORE@
@@ -549,6 +684,7 @@ am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+amdatadir = @amdatadir@
 amincludedir = @amincludedir@
 amlibdir = @amlibdir@
 amlibexecdir = @amlibexecdir@
@@ -567,6 +703,8 @@ dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 gl_LIBOBJS = @gl_LIBOBJS@
 gl_LTLIBOBJS = @gl_LTLIBOBJS@
+gltests_LIBOBJS = @gltests_LIBOBJS@
+gltests_LTLIBOBJS = @gltests_LTLIBOBJS@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
@@ -596,21 +734,60 @@ target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 AUTOMAKE_OPTIONS = 1.4 foreign
+SUFFIXES = 
+EXTRA_DIST = $(SNAPSHOT_STAMP) $(pkgdata_DATA) autogen contrib/README \
+       contrib/dbbackup.README contrib/dbbackup.ksh \
+       contrib/dbbackup.sql contrib/dbbackup.tcl contrib/mkamandisk \
+       contrib/set_prod_link.pl contrib/gsc/README \
+       contrib/gsc/cfggsc.c contrib/gsc/defgsc.c contrib/gsc/gsc.add \
+       contrib/gsc/gscdd.c contrib/gsc/gscdds.h contrib/gsc/makefile \
+       contrib/gsc/tstinq.c contrib/gsc/ucfggsc.c \
+       patches/regex-3.6alpha.patch patches/samba-largefs.patch \
+       patches/tar-1.12.patch UPGRADING DEVELOPING
+BUILT_SOURCES = 
+MOSTLYCLEANFILES = 
+CLEANFILES = 
+DISTCLEANFILES = $(am__append_1)
+MAINTAINERCLEANFILES = 
+
+# sed expression to strip leading directories from a filename; this converts e.g.,
+# src/foo/bar.so to bar.so.
+strip_leading_dirs = s|^.*/||
+@WANT_INSTALLPERMS_FALSE@do_file = pa="$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
+@WANT_INSTALLPERMS_FALSE@    echo "installperm \"$$chown\" \"$$chmod\" \"$$pa\"" >> "$(installperms_sh)"
+
+
+# define a snippet of the scripts below to either perform a chown/chmod operation,
+# or record that operation in the logfile.  On entry to the snippet, $$dest is the
+# destination directory, $$cmd is the srcdir-relative pathname of the target file,
+# $$chown is the ownership, and $$chmod is the permission pattern.
+@WANT_INSTALLPERMS_TRUE@do_file = pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
+@WANT_INSTALLPERMS_TRUE@    if test -n "$$chown"; then \
+@WANT_INSTALLPERMS_TRUE@       echo chown "$$chown" "$$pa"; \
+@WANT_INSTALLPERMS_TRUE@       chown "$$chown" "$$pa" || exit 1; \
+@WANT_INSTALLPERMS_TRUE@    fi; \
+@WANT_INSTALLPERMS_TRUE@    if test -n "$$chmod"; then \
+@WANT_INSTALLPERMS_TRUE@       echo chmod "$$chmod" "$$pa"; \
+@WANT_INSTALLPERMS_TRUE@       chmod "$$chmod" "$$pa" || exit 1; \
+@WANT_INSTALLPERMS_TRUE@    fi 
+
+@WANT_INSTALLPERMS_FALSE@installperms_sh = "$(top_builddir)/installperms.sh"
 ACLOCAL_AMFLAGS = --force -I . -I config -I config/gettext-macros -I config/gnulib -I config/amanda -I config/macro-archive
-@WANT_CLIENT_TRUE@CLIENT_SUBDIRS = client-src dumper-src
-@WANT_TAPE_TRUE@TAPE_SUBDIRS = tape-src
-@WANT_SERVER_TRUE@SERVER_SUBDIRS = device-src server-src changer-src
+@WANT_CLIENT_TRUE@CLIENT_SUBDIRS = client-src application-src
+@WANT_SERVER_TRUE@SERVER_SUBDIRS = device-src server-src changer-src xfer-src
 @WANT_RESTORE_TRUE@RESTORE_SUBDIRS = restore-src
 @WANT_RECOVER_TRUE@RECOVER_SUBDIRS = recover-src oldrecover-src
 @WANT_AMPLOT_TRUE@PLOT_SUBDIRS = amplot
 # order is significant, don't change it arbitrarily
-SUBDIRS = \
+SUBDIRS = \
        gnulib \
        config \
        common-src \
+       amar-src \
        amandad-src \
        $(TAPE_SUBDIRS) \
        $(CLIENT_SUBDIRS) \
@@ -631,42 +808,19 @@ pkgdata_DATA = \
        NEWS            \
        ChangeLog
 
-EXTRA_DIST = $(SNAPSHOT_STAMP) \
-       $(pkgdata_DATA)                 \
-        autogen                        \
-       contrib/README                  \
-       contrib/dbbackup.README         \
-       contrib/dbbackup.ksh            \
-       contrib/dbbackup.sql            \
-       contrib/dbbackup.tcl            \
-       contrib/mkamandisk              \
-       contrib/set_prod_link.pl        \
-       contrib/gsc/README              \
-       contrib/gsc/cfggsc.c            \
-       contrib/gsc/defgsc.c            \
-       contrib/gsc/gsc.add             \
-       contrib/gsc/gscdd.c             \
-       contrib/gsc/gscdds.h            \
-       contrib/gsc/makefile            \
-       contrib/gsc/tstinq.c            \
-       contrib/gsc/ucfggsc.c           \
-       patches/regex-3.6alpha.patch    \
-       patches/samba-largefs.patch     \
-       patches/tar-1.12.patch          \
-       UPGRADING                       \
-       DEVELOPING
-
 CONFIG_STATUS = config.status
 
 # ensure that configure gets the right arguments for distcheck; this keeps the
 # user/group through to the distcheck, rather than defaulting back to 'amanda'.
-DISTCHECK_CONFIGURE_FLAGS = --with-user=$(CLIENT_LOGIN) --with-group=$(SETUID_GROUP) --with-owner=$(BINARY_OWNER) --disable-installperms --without-force-uid --with-tmpdir=$(AMANDA_TMPDIR) SINGLE_USERID=yes
-all: all-recursive
+DISTCHECK_CONFIGURE_FLAGS = --with-user=$(CLIENT_LOGIN) --with-group=$(SETUID_GROUP) --with-owner=$(BINARY_OWNER) --disable-installperms --without-amperldir --without-force-uid --with-tmpdir=$(AMANDA_TMPDIR) SINGLE_USERID=yes CLOBBER_MY_CONFIG=OK
+all: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) all-recursive
 
 .SUFFIXES:
+.SUFFIXES: 
 am--refresh:
        @:
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(top_srcdir)/config/automake/vars.am $(top_srcdir)/config/automake/installperms.am $(am__configure_deps)
        @for dep in $?; do \
          case '$(am__configure_deps)' in \
            *$$dep*) \
@@ -697,10 +851,10 @@ $(top_srcdir)/configure:  $(am__configure_deps)
        cd $(srcdir) && $(AUTOCONF)
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
        cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
-example/template.d/amanda-S3.conf: $(top_builddir)/config.status $(top_srcdir)/example/template.d/amanda-S3.conf.in
-       cd $(top_builddir) && $(SHELL) ./config.status $@
 example/template.d/advanced.conf: $(top_builddir)/config.status $(top_srcdir)/example/template.d/advanced.conf.in
        cd $(top_builddir) && $(SHELL) ./config.status $@
+example/template.d/amanda-S3.conf: $(top_builddir)/config.status $(top_srcdir)/example/template.d/amanda-S3.conf.in
+       cd $(top_builddir) && $(SHELL) ./config.status $@
 example/template.d/amanda-harddisk.conf: $(top_builddir)/config.status $(top_srcdir)/example/template.d/amanda-harddisk.conf.in
        cd $(top_builddir) && $(SHELL) ./config.status $@
 example/template.d/amanda-single-tape.conf: $(top_builddir)/config.status $(top_srcdir)/example/template.d/amanda-single-tape.conf.in
@@ -809,8 +963,8 @@ ID: $(HEADERS) $(SOURCES) $(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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
        mkid -fID $$unique
 tags: TAGS
 
@@ -835,8 +989,8 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
        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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { 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) \
@@ -846,13 +1000,12 @@ ctags: CTAGS
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
                $(TAGS_FILES) $(LISP)
        tags=; \
-       here=`pwd`; \
        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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
        test -z "$(CTAGS_ARGS)$$tags$$unique" \
          || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
             $$tags $$unique
@@ -926,6 +1079,10 @@ dist-bzip2: distdir
        tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
        $(am__remove_distdir)
 
+dist-lzma: distdir
+       tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
+       $(am__remove_distdir)
+
 dist-tarZ: distdir
        tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
        $(am__remove_distdir)
@@ -952,6 +1109,8 @@ distcheck: dist
          GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
        *.tar.bz2*) \
          bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+       *.tar.lzma*) \
+         unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\
        *.tar.Z*) \
          uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
        *.shar.gz*) \
@@ -1011,14 +1170,16 @@ distcleancheck: distclean
               $(distcleancheck_listfiles) ; \
               exit 1; } >&2
 check-am: all-am
-check: check-recursive
+check: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) check-recursive
 all-am: Makefile $(DATA)
 installdirs: installdirs-recursive
 installdirs-am:
        for dir in "$(DESTDIR)$(pkgdatadir)"; do \
          test -z "$$dir" || $(MKDIR_P) "$$dir"; \
        done
-install: install-recursive
+install: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) install-recursive
 install-exec: install-exec-recursive
 install-data: install-data-recursive
 uninstall: uninstall-recursive
@@ -1033,15 +1194,20 @@ install-strip:
          `test -z '$(STRIP)' || \
            echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
+       -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
 
 clean-generic:
+       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
        -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+       -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
 
 maintainer-clean-generic:
        @echo "This command is intended for maintainers to use"
        @echo "it deletes files that may require special tools to rebuild."
+       -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+       -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
 clean: clean-recursive
 
 clean-am: clean-generic clean-libtool mostlyclean-am
@@ -1062,11 +1228,15 @@ info: info-recursive
 
 info-am:
 
-install-data-am: install-pkgdataDATA
+install-data-am: install-data-local install-pkgdataDATA
+       @$(NORMAL_INSTALL)
+       $(MAKE) $(AM_MAKEFLAGS) install-data-hook
 
 install-dvi: install-dvi-recursive
 
-install-exec-am:
+install-exec-am: install-exec-local
+       @$(NORMAL_INSTALL)
+       $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
 
 install-html: install-html-recursive
 
@@ -1101,28 +1271,68 @@ ps-am:
 uninstall-am: uninstall-pkgdataDATA
 
 .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
-       install-strip
+       install-data-am install-exec-am install-strip
 
 .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
        all all-am am--refresh check check-am clean clean-generic \
        clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
-       dist-gzip dist-hook dist-shar dist-tarZ dist-zip distcheck \
-       distclean distclean-generic distclean-libtool distclean-tags \
-       distcleancheck distdir distuninstallcheck dvi dvi-am html \
-       html-am info info-am install install-am install-data \
-       install-data-am install-dvi install-dvi-am install-exec \
-       install-exec-am install-html install-html-am install-info \
-       install-info-am install-man install-pdf install-pdf-am \
-       install-pkgdataDATA install-ps install-ps-am install-strip \
-       installcheck installcheck-am installdirs installdirs-am \
-       maintainer-clean maintainer-clean-generic mostlyclean \
-       mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-       tags tags-recursive uninstall uninstall-am \
-       uninstall-pkgdataDATA
+       dist-gzip dist-hook dist-lzma dist-shar dist-tarZ dist-zip \
+       distcheck distclean distclean-generic distclean-libtool \
+       distclean-tags distcleancheck distdir distuninstallcheck dvi \
+       dvi-am html html-am info info-am install install-am \
+       install-data install-data-am install-data-hook \
+       install-data-local install-dvi install-dvi-am install-exec \
+       install-exec-am install-exec-hook install-exec-local \
+       install-html install-html-am install-info install-info-am \
+       install-man install-pdf install-pdf-am install-pkgdataDATA \
+       install-ps install-ps-am install-strip installcheck \
+       installcheck-am installdirs installdirs-am maintainer-clean \
+       maintainer-clean-generic mostlyclean mostlyclean-generic \
+       mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+       uninstall uninstall-am uninstall-pkgdataDATA
 
 
+installperms-exec:
+       @installperms="$(INSTALLPERMS_exec)"; \
+       test -n "$$installperms" && echo "Setting installation permissions on executables"; \
+       dest=; chown=; chmod=; \
+       for cmd in $$installperms; do \
+           case "$$cmd" in \
+               chown=amanda) \
+                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
+               dest=*|chown=*|chmod=*) \
+                       echo "  ($$cmd)"; eval $$cmd;; \
+               *) $(do_file) ;; \
+           esac; \
+       done
+
+installperms-data:
+       @installperms="$(INSTALLPERMS_data)"; \
+       dest=; chown=; chmod=; \
+       for cmd in $$installperms; do \
+           case "$$cmd" in \
+               chown=amanda) \
+                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
+               dest=*|chown=*|chmod=*) \
+                       echo "  ($$cmd)"; eval $$cmd;; \
+               *)  $(do_file) ;; \
+           esac; \
+       done
+
+install-exec-hook: installperms-exec
+install-data-hook: installperms-data
+
+# define a rule to initialize the installperms manifest file
+@WANT_INSTALLPERMS_TRUE@installperms-init:
+@WANT_INSTALLPERMS_FALSE@installperms-init:
+@WANT_INSTALLPERMS_FALSE@      rm -f "$(installperms_sh)"
+
 libtool: $(LIBTOOL_DEPS)
        $(SHELL) ./config.status --recheck
+
+# empty out the installperms manifest file when we start
+install-exec-local: installperms-init
+install-data-local: installperms-init
 $(CONFIG_STATUS): $(SNAPSHOT_STAMP)
 SNAPSHOT:
        : SNAPSHOT file was removed, will reconfigure...
@@ -1136,7 +1346,7 @@ lint:
        (cd recover-src; make lint)
        (cd restore-src; make lint)
        (cd server-src; make lint)
-       (cd tape-src; make lint)
+       (cd xfer-src; make lint)
 
 dist-hook:
        find $(distdir)/. -name '*.test.c' -exec rm {} \;
diff --git a/NEWS b/NEWS
index a039ad819cf41aa1fdd68a0da0426225d7c49fa9..54cf7b5f46b07a90467fc2723b36bee3b5dd78a1 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,18 +1,40 @@
-Changes in release 2.6.0p2
-
-   * Bugs fix only:
-         o Various device-api fix
-         o Compilation on various platform
-         o others small fixes.
-
-Changes in release 2.6.0p1
-
-   * Bugs fix only:
-        o amfetchdump -p
-        o amtapetype crash
-        o Fix DS_INCRONLY and FORCE_FULL
-        o planner crash 
-        o others small bugs
+Changes in release 2.6.1
+
+   * Application API: Allow to easily write wrappers around any backup program,
+     See the 'amanda-applications' man page.
+      o amgtar: Use GNU tar, it is a lot more configurable than the GNUTAR
+        program. See 'amgtar' man page.
+      o amstar: Use star to do a backup, it work only on a partition. See
+        'amstar' man page.
+      o amsamba: Use smbclient to backup a cifs share, see amsamba man page.
+      o amzfs-sendrecv: Do a backup of a ZFS filesystem with 'zfs send'.
+   * Script API: Allow to run script before and after amanda process, see the
+     'amanda-scripts' man page.
+      o amzfs-snapshot: Do a snapshot of a ZFS filesystem, then 'amgtar'
+        application will backup the snapshot. See 'amzfs-snapshot' man page.
+      o script-email: Simple script to send email. see 'script-email' man page.
+   * Changer API v2.0: perl-based changer interface supporting concurrent
+     use of multiple devices and changers.
+      o currently operating in "compatibility mode," calling old changer
+        shell scripts.
+      o under active development.
+   * Xfer API: generic library to move and filter data with maximal efficiency
+      o can read from and write to arbitrary devices, files, etc.
+      o only used in some applications.
+   * Amanda archive format: A simple archive format that an application can
+     use to create backup image.
+   * 'amarchiver' program to manipulate file in amanda archive format.
+   * Many improvements to report better error message to user.
+   * amtape subcommands 'slot prev' and 'slot last' are removed.
+   * Dozens more perl libraries, with more stable interfaces.
+   * Many bugs fixed and improvement.
+   * amgetconf '--client' option to retrieve config from
+     amanda-client.conf on a client.
+   * Amanda configuration file changes
+       o new application-tool section
+       o new script-tool section
+       o new device section
+       o new changer section
 
 Changes in release 2.6.0
 
@@ -24,18 +46,14 @@ Changes in release 2.6.0
    * 'amdd' and 'ammt' are deprecated.
    * Some Amanda files are now installed in new "amanda/" subdirectories:
      libraries are now installed in $libdir/amanda and internal programs
-     are now installed in $libexecdir/amanda. You can set --with-amlibdir
-     and --with-amlibexecdir if you don't want the amanda suffix.
-     If you mix 2.6.0 and earlier version with rsh/ssh auth, you need to
-     add an 'amandad_path' to the dumptype and to amanda-client.conf
+     are now installed in $libexecdir/amanda.
    * The amandates file, previously at /etc/amandates, is now at
      $localstatedir/amanda/amandates.  You may want to move your existing
      /etc/amandates when you upgrade Amanda.
    * New 'amcryptsimple', 'amgpgcrypt' - encryption plugins based on gpg.
    * New 'amserverconfig', 'amaddclient' - Initial Amanda configuration tools
      these tools make assumptions, please see man page.
-   * Many bugs fixed and code rewrite/cleanup.
-     Speedup in 'amrecover find' and starting amrecover.
+   * Many bugs fixed and code rewrite/cleanup
    * glib is required to compile and run amanda.
    * Device API: pluggable interface to storage devices, supporting tapes,
      vtapes, RAIT, and Amazon S3
index e6f11b26a9e126fa8854ea44e024b022ff00afa3..ff5f136c8f5441d9aaa97aa420678afe92606881 100644 (file)
@@ -1,3 +1,35 @@
+               Release Notes for amanda-2.6.1
+
+amgtar, amstar, amsamba, amzfs-sendrecv
+  Four new programs implementing application-api.
+  Swithching from the program "GNUTAR" to the application "amgtar" have some
+  advantage:
+   - amgtar use by default the gtar --atime-preserve=system option, you must
+     disable it if you gtar relase doesn't have that option.
+   - Can be configured to cross filesystem.
+   - Can be configured to not check the device number on newer gtar
+     (--no-check-device of gtar).
+   - You can configure error message from gtar you don't want to see in the
+     report.
+
+amzfs-snapshot, script-email
+  Two new scripts implementing script-api.
+  The 'zfs-snapshot' script must be used only with the 'amgtar' application.
+
+amarchiver
+  New program to manipulate file in amanda archive format.
+
+New perl Module:
+  Application (perl utility functions for Applications)
+  Archive (Perl access to the  amanda archive library)
+  Constants (perl access to build-time configuration values)
+  MainLoop (Perl interface to the Glib MainLoop)
+  Process (interface to process), used by amcleanup.
+  Script (perl utility functions for Scripts)
+  Tapelist (Manipulate the Amanda tapelist)
+  Xfer (Xfer-api)
+
+
                Release Notes for amanda-2.6.0
 
 amcheckdump
@@ -18,7 +50,7 @@ Deprecated programs
 
 Configure options
   --disable-shared doesn't work because perl modules require shared library.
-  Instead, use --with-static-binaries to build statically linked binaries.
+  Instead, use --with-static-binaries to build staticailly linked binaries.
   --with-amlibdir, libraries are now installed in $amlibdir
     --without-amlibdir              : amlibdir=$libdir
     --with-amlibdir=yes             : amlibdir=$libdir/amanda  (default value)
index 09703f0811d81a4135cb92a7eb00708d14475f67..23863fcc9ccfb2cb2a7bab3d0283b83c30e1f1e2 100644 (file)
@@ -1,7 +1,7 @@
-# generated automatically by aclocal 1.10 -*- Autoconf -*-
+# generated automatically by aclocal 1.10.1 -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006  Free Software Foundation, Inc.
+# 2005, 2006, 2007, 2008  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.
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 # PARTICULAR PURPOSE.
 
-m4_if(m4_PACKAGE_VERSION, [2.61],,
-[m4_fatal([this file was generated for autoconf 2.61.
-You have another version of autoconf.  If you want to use that,
-you should regenerate the build system entirely.], [63])])
+m4_ifndef([AC_AUTOCONF_VERSION],
+  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+m4_if(AC_AUTOCONF_VERSION, [2.63],,
+[m4_warning([this file was generated for autoconf 2.63.
+You have another version of autoconf.  It may work, but is not guaranteed to.
+If you have problems, you may need to regenerate the build system entirely.
+To do so, use the procedure documented by the package, typically `autoreconf'.])])
 
 # Configure paths for GLIB
 # Owen Taylor     1997-2001
 
 dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
-dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject or 
-dnl gthread is specified in MODULES, pass to pkg-config
+dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject,
+dnl gthread, or gio is specified in MODULES, pass to pkg-config
 dnl
 AC_DEFUN([AM_PATH_GLIB_2_0],
 [dnl 
@@ -46,10 +49,13 @@ AC_ARG_ENABLE(glibtest, [  --disable-glibtest      do not try to compile and run
          gthread) 
              pkg_config_args="$pkg_config_args gthread-2.0"
          ;;
+         gio*) 
+             pkg_config_args="$pkg_config_args $module-2.0"
+         ;;
       esac
   done
 
-  PKG_PROG_PKG_CONFIG([0.16])
+  PKG_PROG_PKG_CONFIG([0.7])
 
   no_glib=""
 
@@ -293,16 +299,14 @@ fi])
 # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
 # ---------------------------------------------
 m4_define([_PKG_CONFIG],
-[if test -n "$PKG_CONFIG"; then
-    if test -n "$$1"; then
-        pkg_cv_[]$1="$$1"
-    else
-        PKG_CHECK_EXISTS([$3],
-                         [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
-                        [pkg_failed=yes])
-    fi
-else
-       pkg_failed=untried
+[if test -n "$$1"; then
+    pkg_cv_[]$1="$$1"
+ elif test -n "$PKG_CONFIG"; then
+    PKG_CHECK_EXISTS([$3],
+                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
+                    [pkg_failed=yes])
+ else
+    pkg_failed=untried
 fi[]dnl
 ])# _PKG_CONFIG
 
@@ -346,9 +350,9 @@ See the pkg-config man page for more details.])
 if test $pkg_failed = yes; then
         _PKG_SHORT_ERRORS_SUPPORTED
         if test $_pkg_short_errors_supported = yes; then
-               $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
+               $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
         else 
-               $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
+               $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
         fi
        # Put the nasty error message in config.log where it belongs
        echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
@@ -383,7 +387,7 @@ else
 fi[]dnl
 ])# PKG_CHECK_MODULES
 
-# Copyright (C) 2002, 2003, 2005, 2006  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2005, 2006, 2007  Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -398,7 +402,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
 [am__api_version='1.10'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.10], [],
+m4_if([$1], [1.10.1], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -414,8 +418,10 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.10])dnl
-_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)])
+[AM_AUTOMAKE_VERSION([1.10.1])dnl
+m4_ifndef([AC_AUTOCONF_VERSION],
+  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
@@ -687,7 +693,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
   # each Makefile.in and add a new line on top of each file to say so.
   # Grep'ing the whole file is not good either: AIX grep has a line
   # limit of 2048, but all sed's we know have understand at least 4000.
-  if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then
+  if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
     dirpart=`AS_DIRNAME("$mf")`
   else
     continue
@@ -735,13 +741,13 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
 # Do all the work for Automake.                             -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006 Free Software Foundation, Inc.
+# 2005, 2006, 2008 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
+# serial 13
 
 # 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.
@@ -846,16 +852,17 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJC],
 # our stamp files there.
 AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
 [# Compute $1's index in $config_headers.
+_am_arg=$1
 _am_stamp_count=1
 for _am_header in $config_headers :; do
   case $_am_header in
-    $1 | $1:* )
+    $_am_arg | $_am_arg:* )
       break ;;
     * )
       _am_stamp_count=`expr $_am_stamp_count + 1` ;;
   esac
 done
-echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
+echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
 # Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
 #
@@ -1148,7 +1155,7 @@ AC_SUBST([INSTALL_STRIP_PROGRAM])])
 
 # _AM_SUBST_NOTMAKE(VARIABLE)
 # ---------------------------
-# Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in.
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
 # This macro is traced by Automake.
 AC_DEFUN([_AM_SUBST_NOTMAKE])
 
@@ -1249,6 +1256,7 @@ AC_SUBST([am__untar])
 ]) # _AM_PROG_TAR
 
 m4_include([config/macro-archive/ac_define_dir.m4])
+m4_include([config/macro-archive/ac_perl_module_version.m4])
 m4_include([config/macro-archive/ac_prog_perl_version.m4])
 m4_include([config/macro-archive/ac_prog_swig.m4])
 m4_include([config/macro-archive/ax_compare_version.m4])
@@ -1282,6 +1290,7 @@ m4_include([config/amanda/lfs.m4])
 m4_include([config/amanda/libs.m4])
 m4_include([config/amanda/net.m4])
 m4_include([config/amanda/progs.m4])
+m4_include([config/amanda/ps.m4])
 m4_include([config/amanda/readdir.m4])
 m4_include([config/amanda/readline.m4])
 m4_include([config/amanda/rsh-security.m4])
@@ -1304,7 +1313,9 @@ m4_include([config/gnulib/extensions.m4])
 m4_include([config/gnulib/float_h.m4])
 m4_include([config/gnulib/fsusage.m4])
 m4_include([config/gnulib/getaddrinfo.m4])
+m4_include([config/gnulib/getopt.m4])
 m4_include([config/gnulib/gettimeofday.m4])
+m4_include([config/gnulib/gnulib-common.m4])
 m4_include([config/gnulib/gnulib-comp.m4])
 m4_include([config/gnulib/include_next.m4])
 m4_include([config/gnulib/inet_ntop.m4])
@@ -1332,7 +1343,6 @@ m4_include([config/gnulib/sys_socket_h.m4])
 m4_include([config/gnulib/sys_stat_h.m4])
 m4_include([config/gnulib/sys_time_h.m4])
 m4_include([config/gnulib/tempname.m4])
-m4_include([config/gnulib/ulonglong.m4])
 m4_include([config/gnulib/unistd_h.m4])
 m4_include([config/gnulib/vasnprintf.m4])
 m4_include([config/gnulib/visibility.m4])
@@ -1343,7 +1353,6 @@ m4_include([config/gettext-macros/inttypes_h.m4])
 m4_include([config/gettext-macros/lib-ld.m4])
 m4_include([config/gettext-macros/lib-link.m4])
 m4_include([config/gettext-macros/lib-prefix.m4])
-m4_include([config/gettext-macros/longlong.m4])
 m4_include([config/gettext-macros/nls.m4])
 m4_include([config/gettext-macros/po.m4])
 m4_include([config/gettext-macros/progtest.m4])
index f62a51e0f32624e02845801f794581396967f3ed..768d0bbc26184284d2a9d0ff6909a17844eec2cd 100644 (file)
@@ -1,5 +1,6 @@
 # Makefile for Amanda client programs.
 
+include $(top_srcdir)/config/automake/vars.am
 include $(top_srcdir)/config/automake/installperms.am
 include $(top_srcdir)/config/automake/precompile.am
 
@@ -10,8 +11,8 @@ INCLUDES =    -I$(top_builddir)/common-src \
 AM_CFLAGS = $(AMANDA_WARNING_CFLAGS)
 AM_LDFLAGS = $(AMANDA_STATIC_LDFLAGS)
 
-LINT=@AMLINT@
-LINTFLAGS=@AMLINTFLAGS@
+LINT=$(AMLINT)
+LINTFLAGS=$(AMLINTFLAGS)
 
 amlib_LTLIBRARIES =       libamandad.la
 LIB_EXTENSION = la
@@ -46,6 +47,7 @@ INSTALLPERMS_data = \
 
 lint:
        @ for p in $(amlibexec_PROGRAMS); do                                    \
+               p=`basename $$p $(EXEEXT)`;                                     \
                f="$$p.c $(libamandad_la_SOURCES)";                             \
                (cd ../common-src; make listlibsrc);                            \
                f="$$f "`cat ../common-src/listlibsrc.output`;                  \
index 489ef144308d37a014c2d70c60213a66828e8ec3..a281709385dce0eae8d831e93535b6884703a8cc 100644 (file)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  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.
 
 # Makefile for Amanda client programs.
 
+# vim:ft=automake
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+# 
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License version 2.1 as 
+# published by the Free Software Foundation.
+# 
+# This 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 this library; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+# 
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+# simple include file to pre-define variables which are then +='d by other
+# scripts in this directory.
+
 # vim:ft=automake
 #
 # Adjust post-install permissions settings.  This rule works off two
@@ -43,7 +65,7 @@
 # INSTALLPERMS_exec = \
 #      dest=$(sbindir) chown=amanda chmod= \
 #              foo bar \
-#      chmod=u+s,o-rwx \
+#      chmod=07450 \
 #              bing
 #      dest=$(libexecdir) chmod= \
 #              $(libexec_PROGRAMS)
 #
 # This whole operation is not required when making builds for packaging,
 # and can be disabled with --disable-installperms, via the WANT_INSTALLPERMS
-# AM_CONDITIONAL.
+# AM_CONDITIONAL.  When disabled, the file 'installperms.sh' in the top-level
+# build directory is populated with a format suitable for shell interpretation,
+# with lines like this:
+#   installperm "amanda:disk" "04750" "/usr/local/sbin/bing"
+# the arguments being, respectively, owner:group, mode, and filename.  There will
+# be exactly one line for each file which has specific permissions.  The intention
+# is that this file be used by packaging scripts to set correct permissions at install
+# time.  Note that files which have no special permissions requirements do not appear 
+# in this file at all, due to limitations of Automake.
 
 # vim:ft=automake
 
@@ -81,12 +111,15 @@ target_triplet = @target@
 DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
        $(srcdir)/Makefile.in \
        $(top_srcdir)/config/automake/installperms.am \
-       $(top_srcdir)/config/automake/precompile.am
+       $(top_srcdir)/config/automake/precompile.am \
+       $(top_srcdir)/config/automake/vars.am
+@WANT_INSTALLPERMS_FALSE@am__append_1 = $(installperms_sh)
 amlibexec_PROGRAMS = amandad$(EXEEXT)
 subdir = amandad-src
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps =  \
        $(top_srcdir)/config/macro-archive/ac_define_dir.m4 \
+       $(top_srcdir)/config/macro-archive/ac_perl_module_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_perl_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_swig.m4 \
        $(top_srcdir)/config/macro-archive/ax_compare_version.m4 \
@@ -120,6 +153,7 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/amanda/libs.m4 \
        $(top_srcdir)/config/amanda/net.m4 \
        $(top_srcdir)/config/amanda/progs.m4 \
+       $(top_srcdir)/config/amanda/ps.m4 \
        $(top_srcdir)/config/amanda/readdir.m4 \
        $(top_srcdir)/config/amanda/readline.m4 \
        $(top_srcdir)/config/amanda/rsh-security.m4 \
@@ -142,7 +176,9 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/float_h.m4 \
        $(top_srcdir)/config/gnulib/fsusage.m4 \
        $(top_srcdir)/config/gnulib/getaddrinfo.m4 \
+       $(top_srcdir)/config/gnulib/getopt.m4 \
        $(top_srcdir)/config/gnulib/gettimeofday.m4 \
+       $(top_srcdir)/config/gnulib/gnulib-common.m4 \
        $(top_srcdir)/config/gnulib/gnulib-comp.m4 \
        $(top_srcdir)/config/gnulib/include_next.m4 \
        $(top_srcdir)/config/gnulib/inet_ntop.m4 \
@@ -170,7 +206,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/sys_stat_h.m4 \
        $(top_srcdir)/config/gnulib/sys_time_h.m4 \
        $(top_srcdir)/config/gnulib/tempname.m4 \
-       $(top_srcdir)/config/gnulib/ulonglong.m4 \
        $(top_srcdir)/config/gnulib/unistd_h.m4 \
        $(top_srcdir)/config/gnulib/vasnprintf.m4 \
        $(top_srcdir)/config/gnulib/visibility.m4 \
@@ -181,7 +216,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gettext-macros/lib-ld.m4 \
        $(top_srcdir)/config/gettext-macros/lib-link.m4 \
        $(top_srcdir)/config/gettext-macros/lib-prefix.m4 \
-       $(top_srcdir)/config/gettext-macros/longlong.m4 \
        $(top_srcdir)/config/gettext-macros/nls.m4 \
        $(top_srcdir)/config/gettext-macros/po.m4 \
        $(top_srcdir)/config/gettext-macros/progtest.m4 \
@@ -220,7 +254,7 @@ amandad_DEPENDENCIES = ../common-src/libamanda.$(LIB_EXTENSION) \
        libamandad.$(LIB_EXTENSION) \
        ../common-src/libamanda.$(LIB_EXTENSION) \
        ../gnulib/libgnu.$(LIB_EXTENSION)
-DEFAULT_INCLUDES = -I. -I$(top_builddir)/config@am__isrc@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/config
 depcomp = $(SHELL) $(top_srcdir)/config/depcomp
 am__depfiles_maybe = depfiles
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
@@ -239,6 +273,7 @@ ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
+AIX_BACKUP = @AIX_BACKUP@
 ALLOCA = @ALLOCA@
 ALLOCA_H = @ALLOCA_H@
 AMANDA_DBGDIR = @AMANDA_DBGDIR@
@@ -253,8 +288,10 @@ AMPLOT_CAT_GZIP = @AMPLOT_CAT_GZIP@
 AMPLOT_CAT_PACK = @AMPLOT_CAT_PACK@
 AMPLOT_COMPRESS = @AMPLOT_COMPRESS@
 AMTAR = @AMTAR@
+APPLICATION_DIR = @APPLICATION_DIR@
 AR = @AR@
 ARPA_INET_H = @ARPA_INET_H@
+ASSERTIONS = @ASSERTIONS@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -266,16 +303,28 @@ BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@
 BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@
 BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@
 BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@
+BSDTCP_SECURITY = @BSDTCP_SECURITY@
+BSDUDP_SECURITY = @BSDUDP_SECURITY@
+BSD_SECURITY = @BSD_SECURITY@
 CAT = @CAT@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
+CHECK_USERID = @CHECK_USERID@
 CHIO = @CHIO@
 CHS = @CHS@
+CLIENT_HOST_INSTANCE = @CLIENT_HOST_INSTANCE@
+CLIENT_HOST_KEY_FILE = @CLIENT_HOST_KEY_FILE@
+CLIENT_HOST_PRINCIPAL = @CLIENT_HOST_PRINCIPAL@
 CLIENT_LOGIN = @CLIENT_LOGIN@
 CLIENT_SCRIPTS_OPT = @CLIENT_SCRIPTS_OPT@
 COMPRESS = @COMPRESS@
+COMPRESS_BEST_OPT = @COMPRESS_BEST_OPT@
+COMPRESS_FAST_OPT = @COMPRESS_FAST_OPT@
+COMPRESS_PATH = @COMPRESS_PATH@
+COMPRESS_SUFFIX = @COMPRESS_SUFFIX@
+CONFIG_CLOBBER_MY_CONFIG = @CONFIG_CLOBBER_MY_CONFIG@
 CONFIG_DIR = @CONFIG_DIR@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
@@ -289,6 +338,7 @@ DD = @DD@
 DEFAULT_AMANDATES_FILE = @DEFAULT_AMANDATES_FILE@
 DEFAULT_CHANGER_DEVICE = @DEFAULT_CHANGER_DEVICE@
 DEFAULT_CONFIG = @DEFAULT_CONFIG@
+DEFAULT_MAILER = @DEFAULT_MAILER@
 DEFAULT_SERVER = @DEFAULT_SERVER@
 DEFAULT_TAPE_DEVICE = @DEFAULT_TAPE_DEVICE@
 DEFAULT_TAPE_SERVER = @DEFAULT_TAPE_SERVER@
@@ -296,7 +346,7 @@ DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DOC_BUILD_DATE = @DOC_BUILD_DATE@
 DUMP = @DUMP@
-DUMPER_DIR = @DUMPER_DIR@
+DUMP_RETURNS_1 = @DUMP_RETURNS_1@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -309,6 +359,7 @@ F77 = @F77@
 FFLAGS = @FFLAGS@
 FLOAT_H = @FLOAT_H@
 GETCONF = @GETCONF@
+GETOPT_H = @GETOPT_H@
 GETTEXT = @GETTEXT@
 GLIB_CFLAGS = @GLIB_CFLAGS@
 GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
@@ -319,9 +370,12 @@ GMSGFMT_015 = @GMSGFMT_015@
 GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
 GNULIB_CHOWN = @GNULIB_CHOWN@
 GNULIB_DUP2 = @GNULIB_DUP2@
+GNULIB_ENVIRON = @GNULIB_ENVIRON@
 GNULIB_FCHDIR = @GNULIB_FCHDIR@
 GNULIB_FFLUSH = @GNULIB_FFLUSH@
+GNULIB_FOPEN = @GNULIB_FOPEN@
 GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
+GNULIB_FREOPEN = @GNULIB_FREOPEN@
 GNULIB_FSEEK = @GNULIB_FSEEK@
 GNULIB_FSEEKO = @GNULIB_FSEEKO@
 GNULIB_FTELL = @GNULIB_FTELL@
@@ -331,6 +385,7 @@ GNULIB_GETCWD = @GNULIB_GETCWD@
 GNULIB_GETDELIM = @GNULIB_GETDELIM@
 GNULIB_GETLINE = @GNULIB_GETLINE@
 GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
+GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@
 GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
 GNULIB_LCHOWN = @GNULIB_LCHOWN@
 GNULIB_LSEEK = @GNULIB_LSEEK@
@@ -355,8 +410,10 @@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
 GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
 GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
 GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
+GNULIB_PUTENV = @GNULIB_PUTENV@
 GNULIB_READLINK = @GNULIB_READLINK@
 GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@
+GNULIB_SETENV = @GNULIB_SETENV@
 GNULIB_SLEEP = @GNULIB_SLEEP@
 GNULIB_SNPRINTF = @GNULIB_SNPRINTF@
 GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@
@@ -365,11 +422,15 @@ GNULIB_STPNCPY = @GNULIB_STPNCPY@
 GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
 GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
 GNULIB_STRDUP = @GNULIB_STRDUP@
+GNULIB_STRERROR = @GNULIB_STRERROR@
 GNULIB_STRNDUP = @GNULIB_STRNDUP@
 GNULIB_STRNLEN = @GNULIB_STRNLEN@
 GNULIB_STRPBRK = @GNULIB_STRPBRK@
 GNULIB_STRSEP = @GNULIB_STRSEP@
+GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@
+GNULIB_STRSTR = @GNULIB_STRSTR@
 GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
+GNULIB_UNSETENV = @GNULIB_UNSETENV@
 GNULIB_VASPRINTF = @GNULIB_VASPRINTF@
 GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@
 GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
@@ -383,6 +444,7 @@ GOBJECT_QUERY = @GOBJECT_QUERY@
 GREP = @GREP@
 GZIP = @GZIP@
 HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@
+HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@
 HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@
 HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@
 HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
@@ -391,9 +453,10 @@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
 HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@
 HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
 HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
-HAVE_DECL_STRNCASECMP = @HAVE_DECL_STRNCASECMP@
+HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@
 HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
 HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
+HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@
 HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
 HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
 HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
@@ -401,7 +464,9 @@ HAVE_DUP2 = @HAVE_DUP2@
 HAVE_FSEEKO = @HAVE_FSEEKO@
 HAVE_FTELLO = @HAVE_FTELLO@
 HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
+HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
 HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
+HAVE_GZIP = @HAVE_GZIP@
 HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
 HAVE_IO_H = @HAVE_IO_H@
 HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
@@ -410,8 +475,10 @@ HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@
 HAVE_MEMPCPY = @HAVE_MEMPCPY@
 HAVE_MKDTEMP = @HAVE_MKDTEMP@
 HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@
+HAVE_OS_H = @HAVE_OS_H@
 HAVE_READLINK = @HAVE_READLINK@
 HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@
+HAVE_SETENV = @HAVE_SETENV@
 HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
 HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
 HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
@@ -419,7 +486,6 @@ HAVE_SLEEP = @HAVE_SLEEP@
 HAVE_STDINT_H = @HAVE_STDINT_H@
 HAVE_STPCPY = @HAVE_STPCPY@
 HAVE_STPNCPY = @HAVE_STPNCPY@
-HAVE_STRCASECMP = @HAVE_STRCASECMP@
 HAVE_STRCASESTR = @HAVE_STRCASESTR@
 HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
 HAVE_STRNDUP = @HAVE_STRNDUP@
@@ -428,10 +494,12 @@ HAVE_STRSEP = @HAVE_STRSEP@
 HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@
 HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
 HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
+HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
 HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
 HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
 HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
 HAVE_UNISTD_H = @HAVE_UNISTD_H@
+HAVE_UNSETENV = @HAVE_UNSETENV@
 HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
 HAVE_VASPRINTF = @HAVE_VASPRINTF@
 HAVE_VISIBILITY = @HAVE_VISIBILITY@
@@ -447,6 +515,8 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 INTLLIBS = @INTLLIBS@
 INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+KRB4_SECURITY = @KRB4_SECURITY@
+KRB5_SECURITY = @KRB5_SECURITY@
 LDFLAGS = @LDFLAGS@
 LEX = @LEX@
 LEXLIB = @LEXLIB@
@@ -463,6 +533,8 @@ LIBTHREAD = @LIBTHREAD@
 LIBTOOL = @LIBTOOL@
 LIBTOOL_DEPS = @LIBTOOL_DEPS@
 LN_S = @LN_S@
+LOCKING = @LOCKING@
+LOW_TCPPORTRANGE = @LOW_TCPPORTRANGE@
 LTLIBICONV = @LTLIBICONV@
 LTLIBINTL = @LTLIBINTL@
 LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
@@ -471,7 +543,6 @@ LTLIBPTH = @LTLIBPTH@
 LTLIBTHREAD = @LTLIBTHREAD@
 MAILER = @MAILER@
 MAKEINFO = @MAKEINFO@
-MAXTAPEBLOCKSIZE = @MAXTAPEBLOCKSIZE@
 MCUTIL = @MCUTIL@
 MKDIR_P = @MKDIR_P@
 MSGFMT = @MSGFMT@
@@ -507,26 +578,37 @@ PERL_INC = @PERL_INC@
 PKG_CONFIG = @PKG_CONFIG@
 POSUB = @POSUB@
 PRINT = @PRINT@
+PS = @PS@
+PS_ARGUMENT = @PS_ARGUMENT@
 PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
 RANLIB = @RANLIB@
 READLINE_LIBS = @READLINE_LIBS@
 REPLACE_CHOWN = @REPLACE_CHOWN@
 REPLACE_FCHDIR = @REPLACE_FCHDIR@
 REPLACE_FFLUSH = @REPLACE_FFLUSH@
+REPLACE_FOPEN = @REPLACE_FOPEN@
 REPLACE_FPRINTF = @REPLACE_FPRINTF@
+REPLACE_FREOPEN = @REPLACE_FREOPEN@
 REPLACE_FSEEK = @REPLACE_FSEEK@
 REPLACE_FSEEKO = @REPLACE_FSEEKO@
 REPLACE_FTELL = @REPLACE_FTELL@
 REPLACE_FTELLO = @REPLACE_FTELLO@
 REPLACE_GETCWD = @REPLACE_GETCWD@
 REPLACE_GETLINE = @REPLACE_GETLINE@
+REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
 REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
 REPLACE_LCHOWN = @REPLACE_LCHOWN@
 REPLACE_LSEEK = @REPLACE_LSEEK@
+REPLACE_MEMMEM = @REPLACE_MEMMEM@
 REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
 REPLACE_PRINTF = @REPLACE_PRINTF@
+REPLACE_PUTENV = @REPLACE_PUTENV@
 REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
 REPLACE_SPRINTF = @REPLACE_SPRINTF@
+REPLACE_STRCASESTR = @REPLACE_STRCASESTR@
+REPLACE_STRERROR = @REPLACE_STRERROR@
+REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@
+REPLACE_STRSTR = @REPLACE_STRSTR@
 REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
 REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
 REPLACE_VPRINTF = @REPLACE_VPRINTF@
@@ -534,7 +616,11 @@ REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
 REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
 REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
 RESTORE = @RESTORE@
+RSH_SECURITY = @RSH_SECURITY@
 SAMBA_CLIENT = @SAMBA_CLIENT@
+SERVER_HOST_INSTANCE = @SERVER_HOST_INSTANCE@
+SERVER_HOST_KEY_FILE = @SERVER_HOST_KEY_FILE@
+SERVER_HOST_PRINCIPAL = @SERVER_HOST_PRINCIPAL@
 SERVICE_SUFFIX = @SERVICE_SUFFIX@
 SETUID_GROUP = @SETUID_GROUP@
 SET_MAKE = @SET_MAKE@
@@ -544,6 +630,7 @@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
 SNAPSHOT_STAMP = @SNAPSHOT_STAMP@
 SORT = @SORT@
 SSH = @SSH@
+SSH_SECURITY = @SSH_SECURITY@
 STDBOOL_H = @STDBOOL_H@
 STDINT_H = @STDINT_H@
 STRIP = @STRIP@
@@ -553,7 +640,14 @@ SWIG_LIB = @SWIG_LIB@
 SYS_SOCKET_H = @SYS_SOCKET_H@
 SYS_STAT_H = @SYS_STAT_H@
 SYS_TIME_H = @SYS_TIME_H@
+TCPPORTRANGE = @TCPPORTRANGE@
+TICKET_LIFETIME = @TICKET_LIFETIME@
+UDPPORTRANGE = @UDPPORTRANGE@
+UNCOMPRESS_OPT = @UNCOMPRESS_OPT@
+UNCOMPRESS_PATH = @UNCOMPRESS_PATH@
+USE_AMANDAHOSTS = @USE_AMANDAHOSTS@
 USE_NLS = @USE_NLS@
+USE_RUNDUMP = @USE_RUNDUMP@
 USE_VERSION_SUFFIXES = @USE_VERSION_SUFFIXES@
 VDUMP = @VDUMP@
 VERSION = @VERSION@
@@ -562,6 +656,7 @@ VERSION_MAJOR = @VERSION_MAJOR@
 VERSION_MINOR = @VERSION_MINOR@
 VERSION_PATCH = @VERSION_PATCH@
 VERSION_SUFFIX = @VERSION_SUFFIX@
+VOID_UNSETENV = @VOID_UNSETENV@
 VRESTORE = @VRESTORE@
 VXDUMP = @VXDUMP@
 VXRESTORE = @VXRESTORE@
@@ -590,6 +685,7 @@ am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+amdatadir = @amdatadir@
 amincludedir = @amincludedir@
 amlibdir = @amlibdir@
 amlibexecdir = @amlibexecdir@
@@ -608,6 +704,8 @@ dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 gl_LIBOBJS = @gl_LIBOBJS@
 gl_LTLIBOBJS = @gl_LTLIBOBJS@
+gltests_LIBOBJS = @gltests_LIBOBJS@
+gltests_LTLIBOBJS = @gltests_LTLIBOBJS@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
@@ -637,20 +735,47 @@ target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
+SUFFIXES = 
+EXTRA_DIST = 
+BUILT_SOURCES = 
+MOSTLYCLEANFILES = 
+CLEANFILES = 
+DISTCLEANFILES = $(am__append_1)
+MAINTAINERCLEANFILES = 
 
 # sed expression to strip leading directories from a filename; this converts e.g.,
 # src/foo/bar.so to bar.so.
 strip_leading_dirs = s|^.*/||
+@WANT_INSTALLPERMS_FALSE@do_file = pa="$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
+@WANT_INSTALLPERMS_FALSE@    echo "installperm \"$$chown\" \"$$chmod\" \"$$pa\"" >> "$(installperms_sh)"
+
+
+# define a snippet of the scripts below to either perform a chown/chmod operation,
+# or record that operation in the logfile.  On entry to the snippet, $$dest is the
+# destination directory, $$cmd is the srcdir-relative pathname of the target file,
+# $$chown is the ownership, and $$chmod is the permission pattern.
+@WANT_INSTALLPERMS_TRUE@do_file = pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
+@WANT_INSTALLPERMS_TRUE@    if test -n "$$chown"; then \
+@WANT_INSTALLPERMS_TRUE@       echo chown "$$chown" "$$pa"; \
+@WANT_INSTALLPERMS_TRUE@       chown "$$chown" "$$pa" || exit 1; \
+@WANT_INSTALLPERMS_TRUE@    fi; \
+@WANT_INSTALLPERMS_TRUE@    if test -n "$$chmod"; then \
+@WANT_INSTALLPERMS_TRUE@       echo chmod "$$chmod" "$$pa"; \
+@WANT_INSTALLPERMS_TRUE@       chmod "$$chmod" "$$pa" || exit 1; \
+@WANT_INSTALLPERMS_TRUE@    fi 
+
+@WANT_INSTALLPERMS_FALSE@installperms_sh = "$(top_builddir)/installperms.sh"
 INCLUDES = -I$(top_builddir)/common-src \
                -I$(top_srcdir)/common-src \
                -I$(top_srcdir)/gnulib
 
 AM_CFLAGS = $(AMANDA_WARNING_CFLAGS)
 AM_LDFLAGS = $(AMANDA_STATIC_LDFLAGS)
-LINT = @AMLINT@
-LINTFLAGS = @AMLINTFLAGS@
+LINT = $(AMLINT)
+LINTFLAGS = $(AMLINTFLAGS)
 amlib_LTLIBRARIES = libamandad.la
 LIB_EXTENSION = la
 libamandad_la_SOURCES = amandad_util.c
@@ -677,11 +802,12 @@ INSTALLPERMS_data = \
        dest=$(amlibexecdir) chown=amanda \
                $(amlibexec_SCRIPTS)
 
-all: all-am
+all: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) all-am
 
 .SUFFIXES:
 .SUFFIXES: .c .lo .o .obj
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(top_srcdir)/config/automake/installperms.am $(top_srcdir)/config/automake/precompile.am $(am__configure_deps)
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(top_srcdir)/config/automake/vars.am $(top_srcdir)/config/automake/installperms.am $(top_srcdir)/config/automake/precompile.am $(am__configure_deps)
        @for dep in $?; do \
          case '$(am__configure_deps)' in \
            *$$dep*) \
@@ -716,8 +842,8 @@ install-amlibLTLIBRARIES: $(amlib_LTLIBRARIES)
        @list='$(amlib_LTLIBRARIES)'; for p in $$list; do \
          if test -f $$p; then \
            f=$(am__strip_dir) \
-           echo " $(LIBTOOL) --mode=install $(amlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(amlibdir)/$$f'"; \
-           $(LIBTOOL) --mode=install $(amlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(amlibdir)/$$f"; \
+           echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(amlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(amlibdir)/$$f'"; \
+           $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(amlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(amlibdir)/$$f"; \
          else :; fi; \
        done
 
@@ -725,8 +851,8 @@ uninstall-amlibLTLIBRARIES:
        @$(NORMAL_UNINSTALL)
        @list='$(amlib_LTLIBRARIES)'; for p in $$list; do \
          p=$(am__strip_dir) \
-         echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(amlibdir)/$$p'"; \
-         $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(amlibdir)/$$p"; \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(amlibdir)/$$p'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(amlibdir)/$$p"; \
        done
 
 clean-amlibLTLIBRARIES:
@@ -748,8 +874,8 @@ install-amlibexecPROGRAMS: $(amlibexec_PROGRAMS)
             || test -f $$p1 \
          ; then \
            f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
-          echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(amlibexecPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(amlibexecdir)/$$f'"; \
-          $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(amlibexecPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(amlibexecdir)/$$f" || exit 1; \
+          echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(amlibexecPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(amlibexecdir)/$$f'"; \
+          $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(amlibexecPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(amlibexecdir)/$$f" || exit 1; \
          else :; fi; \
        done
 
@@ -812,8 +938,8 @@ ID: $(HEADERS) $(SOURCES) $(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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
        mkid -fID $$unique
 tags: TAGS
 
@@ -825,8 +951,8 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
        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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { 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) \
@@ -836,13 +962,12 @@ ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
                $(TAGS_FILES) $(LISP)
        tags=; \
-       here=`pwd`; \
        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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
        test -z "$(CTAGS_ARGS)$$tags$$unique" \
          || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
             $$tags $$unique
@@ -882,13 +1007,15 @@ distdir: $(DISTFILES)
          fi; \
        done
 check-am: all-am
-check: check-am
+check: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) check-am
 all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS)
 installdirs:
        for dir in "$(DESTDIR)$(amlibdir)" "$(DESTDIR)$(amlibexecdir)"; do \
          test -z "$$dir" || $(MKDIR_P) "$$dir"; \
        done
-install: install-am
+install: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) install-am
 install-exec: install-exec-am
 install-data: install-data-am
 uninstall: uninstall-am
@@ -903,17 +1030,20 @@ install-strip:
          `test -z '$(STRIP)' || \
            echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
+       -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
 
 clean-generic:
+       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
        -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+       -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
 
 maintainer-clean-generic:
        @echo "This command is intended for maintainers to use"
        @echo "it deletes files that may require special tools to rebuild."
-@WANT_INSTALLPERMS_FALSE@install-exec-hook:
-@WANT_INSTALLPERMS_FALSE@install-data-hook:
+       -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+       -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
 clean: clean-am
 
 clean-am: clean-amlibLTLIBRARIES clean-amlibexecPROGRAMS clean-generic \
@@ -997,52 +1127,40 @@ uninstall-am: uninstall-amlibLTLIBRARIES uninstall-amlibexecPROGRAMS
        uninstall-amlibexecPROGRAMS
 
 
-@WANT_INSTALLPERMS_TRUE@installperms-exec:
-@WANT_INSTALLPERMS_TRUE@       @installperms="$(INSTALLPERMS_exec)"; \
-@WANT_INSTALLPERMS_TRUE@       test -n "$$installperms" && echo "Setting installation permissions on executables"; \
-@WANT_INSTALLPERMS_TRUE@       dest=; chown=; chmod=; \
-@WANT_INSTALLPERMS_TRUE@       for cmd in $$installperms; do \
-@WANT_INSTALLPERMS_TRUE@           case "$$cmd" in \
-@WANT_INSTALLPERMS_TRUE@               chown=amanda) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
-@WANT_INSTALLPERMS_TRUE@               dest=*|chown=*|chmod=*) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; eval $$cmd;; \
-@WANT_INSTALLPERMS_TRUE@               *)  pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chown"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chown "$$chown" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chown "$$chown" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chmod"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chmod "$$chmod" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chmod "$$chmod" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@           esac; \
-@WANT_INSTALLPERMS_TRUE@       done
-
-@WANT_INSTALLPERMS_TRUE@installperms-data:
-@WANT_INSTALLPERMS_TRUE@       @installperms="$(INSTALLPERMS_data)"; \
-@WANT_INSTALLPERMS_TRUE@       test -n "$$installperms" && echo "Setting installation permissions on data"; \
-@WANT_INSTALLPERMS_TRUE@       dest=; chown=; chmod=; \
-@WANT_INSTALLPERMS_TRUE@       for cmd in $$installperms; do \
-@WANT_INSTALLPERMS_TRUE@           case "$$cmd" in \
-@WANT_INSTALLPERMS_TRUE@               chown=amanda) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
-@WANT_INSTALLPERMS_TRUE@               dest=*|chown=*|chmod=*) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; eval $$cmd;; \
-@WANT_INSTALLPERMS_TRUE@               *)  pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chown"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chown "$$chown" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chown "$$chown" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chmod"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chmod "$$chmod" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chmod "$$chmod" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@           esac; \
-@WANT_INSTALLPERMS_TRUE@       done
-
-@WANT_INSTALLPERMS_TRUE@install-exec-hook: installperms-exec
-@WANT_INSTALLPERMS_TRUE@install-data-hook: installperms-data
+installperms-exec:
+       @installperms="$(INSTALLPERMS_exec)"; \
+       test -n "$$installperms" && echo "Setting installation permissions on executables"; \
+       dest=; chown=; chmod=; \
+       for cmd in $$installperms; do \
+           case "$$cmd" in \
+               chown=amanda) \
+                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
+               dest=*|chown=*|chmod=*) \
+                       echo "  ($$cmd)"; eval $$cmd;; \
+               *) $(do_file) ;; \
+           esac; \
+       done
+
+installperms-data:
+       @installperms="$(INSTALLPERMS_data)"; \
+       dest=; chown=; chmod=; \
+       for cmd in $$installperms; do \
+           case "$$cmd" in \
+               chown=amanda) \
+                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
+               dest=*|chown=*|chmod=*) \
+                       echo "  ($$cmd)"; eval $$cmd;; \
+               *)  $(do_file) ;; \
+           esac; \
+       done
+
+install-exec-hook: installperms-exec
+install-data-hook: installperms-data
+
+# define a rule to initialize the installperms manifest file
+@WANT_INSTALLPERMS_TRUE@installperms-init:
+@WANT_INSTALLPERMS_FALSE@installperms-init:
+@WANT_INSTALLPERMS_FALSE@      rm -f "$(installperms_sh)"
 
 # A rule to make precompiler output from C files.  This is not used during
 # ordinary builds, but but can very useful in debugging problems on strange
@@ -1056,6 +1174,7 @@ uninstall-am: uninstall-amlibLTLIBRARIES uninstall-amlibexecPROGRAMS
 
 lint:
        @ for p in $(amlibexec_PROGRAMS); do                                    \
+               p=`basename $$p $(EXEEXT)`;                                     \
                f="$$p.c $(libamandad_la_SOURCES)";                             \
                (cd ../common-src; make listlibsrc);                            \
                f="$$f "`cat ../common-src/listlibsrc.output`;                  \
index 430f2b7f6a5a33990c396891725f6a1f8f171e92..cfb7a47948ec7edeb04786fe85e9058f389a468c 100644 (file)
@@ -47,6 +47,7 @@
 
 #define        REP_TIMEOUT     (6*60*60)       /* secs for service to reply */
 #define        ACK_TIMEOUT     10              /* XXX should be configurable */
+#define STDERR_PIPE (DATA_FD_COUNT + 1)
 
 #define amandad_debug(i, ...) do {     \
        if ((i) <= debug_amandad) {     \
@@ -67,6 +68,37 @@ typedef enum { A_START, A_RECVPKT, A_RECVREP, A_PENDING, A_FINISH, A_CONTINUE,
 struct active_service;
 typedef action_t (*state_t)(struct active_service *, action_t, pkt_t *);
 
+/* string that we scan for in sendbackup's MESG stream */
+static const char info_end_str[] = "sendbackup: info end\n";
+#define INFO_END_LEN (sizeof(info_end_str)-1)
+
+/* 
+ * Here are the services that we allow.
+ * Must be in the same order as services[].
+ */
+typedef enum {
+    SERVICE_NOOP,
+    SERVICE_SENDSIZE,
+    SERVICE_SENDBACKUP,
+    SERVICE_SELFCHECK,
+    SERVICE_AMINDEXD,
+    SERVICE_AMIDXTAPED
+} service_t;
+
+static struct services {
+    char *name;
+    int  active;
+    service_t service;
+} services[] = {
+   { "noop", 1, SERVICE_NOOP },
+   { "sendsize", 1, SERVICE_SENDSIZE },
+   { "sendbackup", 1, SERVICE_SENDBACKUP },
+   { "selfcheck", 1, SERVICE_SELFCHECK },
+   { "amindexd", 0, SERVICE_AMINDEXD },
+   { "amidxtaped", 0, SERVICE_AMIDXTAPED }
+};
+#define        NSERVICES       (int)(sizeof(services) / sizeof(services[0]))
+
 /*
  * This structure describes an active running service.
  *
@@ -76,6 +108,7 @@ typedef action_t (*state_t)(struct active_service *, action_t, pkt_t *);
  * for communications with the amanda server.
  */
 struct active_service {
+    service_t service;                 /* service name */
     char *cmd;                         /* name of command we ran */
     char *arguments;                   /* arguments we sent it */
     security_handle_t *security_handle;        /* remote server */
@@ -84,13 +117,19 @@ struct active_service {
     int send_partial_reply;            /* send PREP packet */
     int reqfd;                         /* pipe to write requests */
     int repfd;                         /* pipe to read replies */
+    int errfd;                         /* pipe to read stderr */
     event_handle_t *ev_repfd;          /* read event handle for repfd */
     event_handle_t *ev_reptimeout;     /* timeout for rep data */
+    event_handle_t *ev_errfd;          /* read event handle for errfd */
     pkt_t rep_pkt;                     /* rep packet we're sending out */
+    char *errbuf;                      /* buffer to read the err into */
     char *repbuf;                      /* buffer to read the rep into */
     size_t bufsize;                    /* length of repbuf */
     size_t repbufsize;                 /* length of repbuf */
     int repretry;                      /* times we'll retry sending the rep */
+    int seen_info_end;                 /* have we seen "sendbackup info end\n"? */
+    char info_end_buf[INFO_END_LEN];   /* last few bytes read, used for scanning for info end */
+
     /*
      * General user streams to the process, and their equivalent
      * network streams.
@@ -107,22 +146,6 @@ struct active_service {
     TAILQ_ENTRY(active_service) tq;    /* queue handle */
 };
 
-/* 
- * Here are the services that we allow.
- */
-static struct services {
-    char *name;
-    int  active;
-} services[] = {
-    { "noop", 1 },
-    { "sendsize", 1 },
-    { "sendbackup", 1 },
-    { "selfcheck", 1 },
-    { "amindexd", 0 },
-    { "amidxtaped", 0 }
-};
-#define        NSERVICES       (int)(sizeof(services) / sizeof(services[0]))
-
 /*
  * Queue of outstanding requests that we are running.
  */
@@ -152,12 +175,13 @@ static action_t s_sendrep(struct active_service *, action_t, pkt_t *);
 static action_t s_ackwait(struct active_service *, action_t, pkt_t *);
 
 static void repfd_recv(void *);
+static void errfd_recv(void *);
 static void timeout_repfd(void *);
 static void protocol_recv(void *, pkt_t *, security_status_t);
 static void process_readnetfd(void *);
 static void process_writenetfd(void *, void *, ssize_t);
 static struct active_service *service_new(security_handle_t *,
-    const char *, const char *);
+    const char *, service_t, const char *);
 static void service_delete(struct active_service *);
 static int writebuf(struct active_service *, const void *, size_t);
 static ssize_t do_sendpkt(security_handle_t *handle, pkt_t *pkt);
@@ -216,6 +240,7 @@ main(
     /* Don't die when child closes pipe */
     signal(SIGPIPE, SIG_IGN);
 
+    /* Parse the configuration; we'll handle errors later */
     config_init(CONFIG_INIT_CLIENT, NULL);
 
     if (geteuid() == 0) {
@@ -412,6 +437,7 @@ main(
 
     if(strcasecmp(auth, "rsh") == 0 ||
        strcasecmp(auth, "ssh") == 0 ||
+       strcasecmp(auth, "local") == 0 ||
        strcasecmp(auth, "bsdtcp") == 0) {
        wait_30s = 0;
        exit_on_qlength = 1;
@@ -419,12 +445,12 @@ main(
 
     if (getuid() == 0) {
        if (strcasecmp(auth, "krb5") != 0) {
-           error(_("Amanda must be run as user '%s' when using '%s' authetication"),
+           error(_("Amanda must be run as user '%s' when using '%s' authentication"),
                  CLIENT_LOGIN, auth);
        }
     } else {
        if (strcasecmp(auth, "krb5") == 0) {
-           error(_("Amanda must be run as user 'root' when using 'krb5' authetication"));
+           error(_("Amanda must be run as user 'root' when using 'krb5' authentication"));
        }
     }
 
@@ -514,6 +540,7 @@ protocol_accept(
     struct active_service *as;
     char *pktbody, *tok, *service, *arguments;
     char *service_path = NULL;
+    GSList *errlist = NULL;
     int i;
 
     pkt_out.body = NULL;
@@ -525,6 +552,32 @@ protocol_accept(
        return;
     }
 
+    /*
+     * If we have errors (not warnings) from the config file, let the server
+     * know immediately.  Unfortunately, we only get one ERROR line, so if there
+     * are multiple errors, we just show the first.
+     */
+    if (config_errors(&errlist) >= CFGERR_ERRORS) {
+       GSList *iter = errlist;
+       char *errmsg;
+       gboolean multiple_errors = FALSE;
+
+       if (iter) {
+           errmsg = (char *)iter->data;
+           if (iter->next)
+               multiple_errors = TRUE;
+       } else {
+           errmsg = "(no error message)";
+       }
+
+       pkt_init(&pkt_out, P_NAK, "ERROR %s%s", errmsg,
+           multiple_errors? _(" (additional errors not displayed)"):"");
+       do_sendpkt(handle, &pkt_out);
+       amfree(pkt_out.body);
+       security_close(handle);
+       return;
+    }
+
     /*
      * If pkt is NULL, then there was a problem with the new connection.
      */
@@ -612,7 +665,7 @@ protocol_accept(
      * the request pipe.
      */
     dbprintf(_("creating new service: %s\n%s\n"), service, arguments);
-    as = service_new(handle, service_path, arguments);
+    as = service_new(handle, service_path, services[i].service, arguments);
     if (writebuf(as, arguments, strlen(arguments)) < 0) {
        const char *errmsg = strerror(errno);
        dbprintf(_("error sending arguments to %s: %s\n"), service, errmsg);
@@ -759,6 +812,8 @@ s_sendack(
     as->ev_repfd = event_register((event_id_t)as->repfd, EV_READFD, repfd_recv, as);
     as->ev_reptimeout = event_register(REP_TIMEOUT, EV_TIME,
        timeout_repfd, as);
+    as->errbuf = NULL;
+    as->ev_errfd = event_register((event_id_t)as->errfd, EV_READFD, errfd_recv, as);
     security_recvpkt(as->security_handle, protocol_recv, as, -1);
     return (A_PENDING);
 }
@@ -779,7 +834,6 @@ s_repwait(
     char     *what;
     char     *msg;
     int       code = 0;
-    int       t;
     int       pid;
     amwait_t  retstat;
 
@@ -835,14 +889,36 @@ s_repwait(
 
     /* If end of service, wait for process status */
     if (n == 0) {
-       t = 0;
        pid = waitpid(as->pid, &retstat, WNOHANG);
-       while (t<5 && pid == 0) {
-           sleep(1);
-           t++;
-           pid = waitpid(as->pid, &retstat, WNOHANG);
+       if (as->service  == SERVICE_NOOP ||
+           as->service  == SERVICE_SENDSIZE ||
+           as->service  == SERVICE_SELFCHECK) {
+           int t = 0;
+           while (t<5 && pid == 0) {
+               sleep(1);
+               t++;
+               pid = waitpid(as->pid, &retstat, WNOHANG);
+           }
+       }
+
+       /* Process errfd before sending the REP packet */
+       if (as->ev_errfd) {
+           SELECT_ARG_TYPE readset;
+           struct timeval  tv;
+           int             nfound;
+
+           memset(&tv, 0, SIZEOF(tv));
+           FD_ZERO(&readset);
+           FD_SET(as->errfd, &readset);
+           nfound = select(as->errfd+1, &readset, NULL, NULL, &tv);
+           if (nfound && FD_ISSET(as->errfd, &readset)) {
+               errfd_recv(as);
+           }
        }
 
+       if (pid == 0)
+           pid = waitpid(as->pid, &retstat, WNOHANG);
+
        if (pid > 0) {
            what = NULL;
            if (! WIFEXITED(retstat)) {
@@ -870,6 +946,7 @@ s_repwait(
                }
                strcpy(as->repbuf + as->repbufsize, msg);
                as->repbufsize += strlen(msg);
+                amfree(msg);
            }
        }
     }
@@ -1077,9 +1154,18 @@ s_ackwait(
            dh->netfd = NULL;
            continue;
        }
-       /* setup an event for reads from it */
-       dh->ev_read = event_register((event_id_t)dh->fd_read, EV_READFD,
-                                    process_readnetfd, dh);
+
+       /* setup an event for reads from it.  As a special case, don't start
+        * listening on as->data[0] until we read some data on another fd, if
+        * the service is sendbackup.  This ensures that we send a MESG or 
+        * INDEX token before any DATA tokens, as dumper assumes. This is a
+        * hack, if that wasn't already obvious! */
+       if (dh != &as->data[0] || as->service != SERVICE_SENDBACKUP) {
+           dh->ev_read = event_register((event_id_t)dh->fd_read, EV_READFD,
+                                        process_readnetfd, dh);
+       } else {
+           amandad_debug(1, "Skipping registration of sendbackup's data FD\n");
+       }
 
        security_stream_read(dh->netfd, process_writenetfd, dh);
 
@@ -1132,6 +1218,79 @@ repfd_recv(
     state_machine(as, A_RECVREP, NULL);
 }
 
+/*
+ * Called when a errfd has received data
+ */
+static void
+errfd_recv(
+    void *     cookie)
+{
+    struct active_service *as = cookie;
+    char  buf[32769];
+    int   n;
+    char *r;
+
+    assert(as != NULL);
+    assert(as->ev_errfd != NULL);
+
+    n = read(as->errfd, &buf, 32768);
+    /* merge buffer */
+    if (n > 0) {
+       /* Terminate it with '\0' */
+       buf[n+1] = '\0';
+
+       if (as->errbuf) {
+           as->errbuf = vstrextend(&as->errbuf, buf, NULL);
+       } else {
+           as->errbuf = stralloc(buf);
+       }
+    } else if (n == 0) {
+       event_release(as->ev_errfd);
+       as->ev_errfd = NULL;
+    } else { /* n < 0 */
+       event_release(as->ev_errfd);
+       as->ev_errfd = NULL;
+       g_snprintf(buf, 32768,
+                  "error reading stderr or service: %s\n", strerror(errno));
+    }
+
+    /* for each line terminate by '\n' */
+    while (as->errbuf != NULL  && (r = index(as->errbuf, '\n')) != NULL) {
+       char *s;
+
+       *r = '\0';
+       s = vstrallocf("ERROR service %s: %s\n",
+                      services[as->service].name, as->errbuf);
+
+       /* Add to repbuf, error message will be in the REP packet if it
+        * is not already sent
+        */
+       n = strlen(s);
+       if (as->bufsize == 0) {
+           as->bufsize = NETWORK_BLOCK_BYTES;
+           as->repbuf = alloc(as->bufsize);
+       }
+       while (as->bufsize < as->repbufsize + n) {
+           char *repbuf_temp;
+           as->bufsize *= 2;
+           repbuf_temp = alloc(as->bufsize);
+           memcpy(repbuf_temp, as->repbuf, as->repbufsize + 1);
+           amfree(as->repbuf);
+           as->repbuf = repbuf_temp;
+       }
+       memcpy(as->repbuf + as->repbufsize, s, n);
+       as->repbufsize += n;
+
+       dbprintf("%s", s);
+
+       /* remove first line from buffer */
+       r++;
+       s = stralloc(r);
+       amfree(as->errbuf);
+       as->errbuf = s;
+    }
+}
+
 /*
  * Called when a repfd has timed out
  */
@@ -1222,6 +1381,34 @@ process_readnetfd(
        service_delete(as);
        return;
     }
+
+    /* Handle the special case of recognizing "sendbackup info end"
+     * from sendbackup's MESG fd */
+    if (as->service == SERVICE_SENDBACKUP && !as->seen_info_end && dh == &as->data[1]) {
+       /* make a buffer containing the combined data from info_end_buf
+        * and what we've read this time, and search it for info_end_strj
+        * This includes a NULL byte for strstr's sanity. */
+       char *combined_buf = malloc(INFO_END_LEN + n + 1);
+       memcpy(combined_buf, as->info_end_buf, INFO_END_LEN);
+       memcpy(combined_buf+INFO_END_LEN, as->databuf, n);
+       combined_buf[INFO_END_LEN+n] = '\0';
+
+       as->seen_info_end = (strstr(combined_buf, info_end_str) != NULL);
+
+       /* fill info_end_buf from the tail end of combined_buf */
+       memcpy(as->info_end_buf, combined_buf + n, INFO_END_LEN);
+
+       /* if we did see info_end_str, start reading the data fd (fd 0) */
+       if (as->seen_info_end) {
+           struct datafd_handle *dh = &as->data[0];
+           amandad_debug(1, "Opening datafd to sendbackup (delayed until sendbackup sent header info)\n");
+           dh->ev_read = event_register((event_id_t)dh->fd_read, EV_READFD,
+                                        process_readnetfd, dh);
+       } else {
+           amandad_debug(1, "sendbackup header info still not complete\n");
+       }
+    }
+
     if (security_stream_write(dh->netfd, as->databuf, (size_t)n) < 0) {
        /* stream has croaked */
        pkt_init(&nak, P_NAK, _("ERROR write error on stream %d: %s\n"),
@@ -1255,7 +1442,7 @@ process_writenetfd(
     if (dh->fd_write <= 0) {
        dbprintf(_("process_writenetfd: dh->fd_write <= 0\n"));
     } else if (size > 0) {
-       fullwrite(dh->fd_write, buf, (size_t)size);
+       full_write(dh->fd_write, buf, (size_t)size);
        security_stream_read(dh->netfd, process_writenetfd, dh);
     }
     else {
@@ -1314,11 +1501,12 @@ static struct active_service *
 service_new(
     security_handle_t *        security_handle,
     const char *       cmd,
+    service_t          service,
     const char *       arguments)
 {
     int i;
-    int data_read[DATA_FD_COUNT + 1][2];
-    int data_write[DATA_FD_COUNT + 1][2];
+    int data_read[DATA_FD_COUNT + 2][2];
+    int data_write[DATA_FD_COUNT + 2][2];
     struct active_service *as;
     pid_t pid;
     int newfd;
@@ -1328,6 +1516,13 @@ service_new(
     assert(arguments != NULL);
 
     /* a plethora of pipes */
+    /* data_read[0]                : stdin
+     * data_write[0]               : stdout
+     * data_read[1], data_write[1] : first  stream
+     * data_read[2], data_write[2] : second stream
+     * data_read[3], data_write[3] : third stream
+     * data_write[4]               : stderr
+     */
     for (i = 0; i < DATA_FD_COUNT + 1; i++) {
        if (pipe(data_read[i]) < 0) {
            error(_("pipe: %s\n"), strerror(errno));
@@ -1338,6 +1533,10 @@ service_new(
            /*NOTREACHED*/
        }
     }
+    if (pipe(data_write[STDERR_PIPE]) < 0) {
+       error(_("pipe: %s\n"), strerror(errno));
+       /*NOTREACHED*/
+    }
 
     switch(pid = fork()) {
     case -1:
@@ -1347,14 +1546,18 @@ service_new(
        /*
         * The parent.  Close the far ends of our pipes and return.
         */
-       as = alloc(SIZEOF(*as));
+       as = g_new0(struct active_service, 1);
        as->cmd = stralloc(cmd);
        as->arguments = stralloc(arguments);
        as->security_handle = security_handle;
        as->state = NULL;
+       as->service = service;
        as->pid = pid;
        as->send_partial_reply = 0;
-       if(strcmp(cmd+(strlen(cmd)-8), "sendsize") == 0) {
+       as->seen_info_end = FALSE;
+       /* fill in info_end_buf with non-null characters */
+       memset(as->info_end_buf, '-', sizeof(as->info_end_buf));
+       if(service == SERVICE_SENDSIZE) {
            g_option_t *g_options;
            char *option_str, *p;
 
@@ -1386,6 +1589,14 @@ service_new(
        as->repretry = 0;
        as->rep_pkt.body = NULL;
 
+       /*
+        * read from the stderr pipe
+        */
+       as->errfd = data_write[STDERR_PIPE][0];
+       aclose(data_write[STDERR_PIPE][1]);
+       as->ev_errfd = NULL;
+       as->errbuf = NULL;
+
        /*
         * read from the rest of the general-use pipes
         * (netfds are opened as the client requests them)
@@ -1482,7 +1693,9 @@ service_new(
 
        /* close all unneeded fd */
        close(STDERR_FILENO);
-       debug_dup_stderr_to_debug();
+       dup2(data_write[STDERR_PIPE][1], 2);
+        aclose(data_write[STDERR_PIPE][0]);
+        aclose(data_write[STDERR_PIPE][1]);
        safe_fd(DATA_FD_OFFSET, DATA_FD_COUNT*2);
 
        execle(cmd, cmd, "amandad", auth, (char *)NULL, safe_env());
@@ -1572,7 +1785,7 @@ writebuf(
     size_t                     size)
 {
     pid_t pid;
-    ssize_t    writesize;
+    size_t    writesize;
 
     switch (pid=fork()) {
     case -1:
@@ -1584,8 +1797,8 @@ writebuf(
 
     case 0:                            /* this is the child */
        close(as->repfd);
-       writesize = fullwrite(as->reqfd, bufp, size);
-       exit(writesize != (ssize_t)size);
+       writesize = full_write(as->reqfd, bufp, size);
+       exit(writesize != size);
        /* NOTREACHED */
     }
     return -1;
diff --git a/amar-src/Makefile.am b/amar-src/Makefile.am
new file mode 100644 (file)
index 0000000..92f2c88
--- /dev/null
@@ -0,0 +1,39 @@
+# Makefile for Amanda archive library
+
+include $(top_srcdir)/config/automake/vars.am
+include $(top_srcdir)/config/automake/scripts.am
+include $(top_srcdir)/config/automake/installperms.am
+include $(top_srcdir)/config/automake/precompile.am
+
+INCLUDES =      -I$(top_builddir)/common-src \
+                -I$(top_srcdir)/common-src \
+                -I$(top_srcdir)/gnulib
+
+AM_CFLAGS = $(AMANDA_WARNING_CFLAGS)
+AM_LDFLAGS = $(AMANDA_STATIC_LDFLAGS)
+
+LINT=@AMLINT@
+LINTFLAGS=@AMLINTFLAGS@
+
+amlib_LTLIBRARIES =     libamar.la
+
+libamar_la_SOURCES = amar.c
+libamar_la_LDFLAGS =  -release $(VERSION)
+libamar_la_LIBADD = ../common-src/libamanda.la
+
+noinst_HEADERS = \
+       amar.h
+
+sbin_PROGRAMS = amarchiver
+
+amarchiver_SOURCES = amarchiver.c
+amarchiver_LDADD = libamar.la
+
+# automake-style tests
+
+TESTS = amar-test
+noinst_PROGRAMS = $(TESTS)
+
+amar_test_SOURCES = amar-test.c
+amar_test_LDADD = libamar.la \
+       ../common-src/libtestutils.la
diff --git a/amar-src/Makefile.in b/amar-src/Makefile.in
new file mode 100644 (file)
index 0000000..381cfd8
--- /dev/null
@@ -0,0 +1,1423 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008  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@
+
+# Makefile for Amanda archive library
+
+# vim:ft=automake
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+# 
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License version 2.1 as 
+# published by the Free Software Foundation.
+# 
+# This 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 this library; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+# 
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+# simple include file to pre-define variables which are then +='d by other
+# scripts in this directory.
+
+# vim:ft=automake
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+# 
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License version 2.1 as 
+# published by the Free Software Foundation.
+# 
+# This 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 this library; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+# 
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+# SYNOPSIS:
+#
+# Automake magic to handle the various tasks of building scripts.  Scripts can
+# be built down to extensionless executables (e.g., foo.pl -> foo), or to 
+# files with the usual extension (foo-lib.sh.in -> foo.sh).
+#
+# Files which support it are syntax-checked when the user invokes 'make check'.
+#
+# All *target* filenames must be listed in SCRIPTS_SHELL, SCRIPTS_PERL, and 
+# SCRIPTS_AWK to support 'make check', 'make dist', and 'make distclean'. No
+# files which are not substituted by config.status should be included in
+# SCRIPTS_PERL, SCRIPTS_SHELL, or SCRIPTS_AWK.  If non-generated files are listed
+# for installation, then Automake will figure out that they should be distributed;
+# otherwise, include them in EXTRA_DIST.
+#
+# USAGE:
+#
+#   include $(top_srcdir)/config/automake/vars.am
+#   include $(top_srcdir)/config/automake/scripts.am
+#   ...
+#   SCRIPTS_PERL = fooscript barscript perl-lib.pl perlmod.pm
+#   SCRIPTS_SHELL = shell1 shell2 sh-lib.sh
+#   SCRIPTS_AWK = talk balk chalk awk-lib.awk
+#   sbin_SCRIPTS = not-subbed
+#   EXTRA_DIST = util-script.pl
+#
+# with the corresponding files in the repository:
+#
+#   fooscript.pl barscript.pl perl-lib.pl.in perlmod.pm.in
+#   shell1.sh shell2.sh sh-lib.sh.in
+#   talk.awk balk.awk chalk.awk awk-lib.awk.in
+#   not-subbed util-script.pl
+#
+# by default, all shell and perl scripts are syntax checked.  If this is
+# a problem (for example, perl scripts depending on Amanda extension 
+# modules), then assign to CHECK_{PERL,SHELL} the list of files you wish
+# to be checked (which can be empty).
+#
+# To add extra flags to the perl checks (e.g., to add new -I flags), set
+# CHECK_PERL_FLAGS.
+
+# Implementation note:
+#
+# This file uses config.status to substitute @foo@ in those scripts while
+# converting them. It also adds the executable bits (a+x) to extensionless
+# files.  The substitution works even though the files are not listed in 
+# configure.in
+
+# vim:ft=automake
+#
+# Adjust post-install permissions settings.  This rule works off two
+# specially-formatted variables, INSTALLPERMS_exec and INSTALLPERMS_data. 
+# Each is a whitespace-separated list of commands, all of which are either
+# a variable assignment or a filename.  Three variables are available:
+#
+#  - dest= sets the destination directory to e.g., $(sbindir)
+#  - chown= controls changes in ownership; value is first argument to chown
+#  - chmod= controls changes in permissions; value is first argument to chmod
+#
+# As a special case, chown=amanda is taken as equivalent to 
+# chown=$(BINARY_OWNER):$(SETUID_GROUP), which may otherwise have problems with
+# whitespace in the user/group names.
+# 
+# when a filename is seen, the currently active variables are applied.
+#
+# Note that scripts are data, not executables!
+#
+# EXAMPLE
+#
+# sbin_PROGRAMS = foo bar bing
+# libexec_PROGRAMS = pro gram
+# sbin_SCRIPTS = sk ript
+# INSTALLPERMS_exec = \
+#      dest=$(sbindir) chown=amanda chmod= \
+#              foo bar \
+#      chmod=07450 \
+#              bing
+#      dest=$(libexecdir) chmod= \
+#              $(libexec_PROGRAMS)
+# INSTALLPERMS_data = \
+#      dest=$(sbindir) chown=amanda chmod= \
+#              $(sbin_SCRIPTS)
+#
+# This whole operation is not required when making builds for packaging,
+# and can be disabled with --disable-installperms, via the WANT_INSTALLPERMS
+# AM_CONDITIONAL.  When disabled, the file 'installperms.sh' in the top-level
+# build directory is populated with a format suitable for shell interpretation,
+# with lines like this:
+#   installperm "amanda:disk" "04750" "/usr/local/sbin/bing"
+# the arguments being, respectively, owner:group, mode, and filename.  There will
+# be exactly one line for each file which has specific permissions.  The intention
+# is that this file be used by packaging scripts to set correct permissions at install
+# time.  Note that files which have no special permissions requirements do not appear 
+# in this file at all, due to limitations of Automake.
+
+# vim:ft=automake
+
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+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@
+target_triplet = @target@
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+       $(srcdir)/Makefile.in \
+       $(top_srcdir)/config/automake/installperms.am \
+       $(top_srcdir)/config/automake/precompile.am \
+       $(top_srcdir)/config/automake/scripts.am \
+       $(top_srcdir)/config/automake/vars.am
+@WANT_INSTALLPERMS_FALSE@am__append_1 = $(installperms_sh)
+sbin_PROGRAMS = amarchiver$(EXEEXT)
+TESTS = amar-test$(EXEEXT)
+noinst_PROGRAMS = $(am__EXEEXT_1)
+subdir = amar-src
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps =  \
+       $(top_srcdir)/config/macro-archive/ac_define_dir.m4 \
+       $(top_srcdir)/config/macro-archive/ac_perl_module_version.m4 \
+       $(top_srcdir)/config/macro-archive/ac_prog_perl_version.m4 \
+       $(top_srcdir)/config/macro-archive/ac_prog_swig.m4 \
+       $(top_srcdir)/config/macro-archive/ax_compare_version.m4 \
+       $(top_srcdir)/config/macro-archive/docbook-dtd.m4 \
+       $(top_srcdir)/config/macro-archive/docbook-xslt-min.m4 \
+       $(top_srcdir)/config/macro-archive/docbook-xslt.m4 \
+       $(top_srcdir)/config/macro-archive/xsltproc.m4 \
+       $(top_srcdir)/config/amanda/amplot.m4 \
+       $(top_srcdir)/config/amanda/bsd-security.m4 \
+       $(top_srcdir)/config/amanda/bsdtcp-security.m4 \
+       $(top_srcdir)/config/amanda/bsdudp-security.m4 \
+       $(top_srcdir)/config/amanda/changer.m4 \
+       $(top_srcdir)/config/amanda/components.m4 \
+       $(top_srcdir)/config/amanda/compress.m4 \
+       $(top_srcdir)/config/amanda/config.m4 \
+       $(top_srcdir)/config/amanda/debugging.m4 \
+       $(top_srcdir)/config/amanda/defaults.m4 \
+       $(top_srcdir)/config/amanda/devprefix.m4 \
+       $(top_srcdir)/config/amanda/dirs.m4 \
+       $(top_srcdir)/config/amanda/documentation.m4 \
+       $(top_srcdir)/config/amanda/dumpers.m4 \
+       $(top_srcdir)/config/amanda/flags.m4 \
+       $(top_srcdir)/config/amanda/flock.m4 \
+       $(top_srcdir)/config/amanda/funcs.m4 \
+       $(top_srcdir)/config/amanda/getfsent.m4 \
+       $(top_srcdir)/config/amanda/i18n.m4 \
+       $(top_srcdir)/config/amanda/ipv6.m4 \
+       $(top_srcdir)/config/amanda/krb4-security.m4 \
+       $(top_srcdir)/config/amanda/krb5-security.m4 \
+       $(top_srcdir)/config/amanda/lfs.m4 \
+       $(top_srcdir)/config/amanda/libs.m4 \
+       $(top_srcdir)/config/amanda/net.m4 \
+       $(top_srcdir)/config/amanda/progs.m4 \
+       $(top_srcdir)/config/amanda/ps.m4 \
+       $(top_srcdir)/config/amanda/readdir.m4 \
+       $(top_srcdir)/config/amanda/readline.m4 \
+       $(top_srcdir)/config/amanda/rsh-security.m4 \
+       $(top_srcdir)/config/amanda/s3-device.m4 \
+       $(top_srcdir)/config/amanda/shmem.m4 \
+       $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \
+       $(top_srcdir)/config/amanda/ssh-security.m4 \
+       $(top_srcdir)/config/amanda/summary.m4 \
+       $(top_srcdir)/config/amanda/swig.m4 \
+       $(top_srcdir)/config/amanda/syshacks.m4 \
+       $(top_srcdir)/config/amanda/tape.m4 \
+       $(top_srcdir)/config/amanda/types.m4 \
+       $(top_srcdir)/config/amanda/userid.m4 \
+       $(top_srcdir)/config/amanda/version.m4 \
+       $(top_srcdir)/config/gnulib/alloca.m4 \
+       $(top_srcdir)/config/gnulib/arpa_inet_h.m4 \
+       $(top_srcdir)/config/gnulib/base64.m4 \
+       $(top_srcdir)/config/gnulib/eoverflow.m4 \
+       $(top_srcdir)/config/gnulib/extensions.m4 \
+       $(top_srcdir)/config/gnulib/float_h.m4 \
+       $(top_srcdir)/config/gnulib/fsusage.m4 \
+       $(top_srcdir)/config/gnulib/getaddrinfo.m4 \
+       $(top_srcdir)/config/gnulib/getopt.m4 \
+       $(top_srcdir)/config/gnulib/gettimeofday.m4 \
+       $(top_srcdir)/config/gnulib/gnulib-common.m4 \
+       $(top_srcdir)/config/gnulib/gnulib-comp.m4 \
+       $(top_srcdir)/config/gnulib/include_next.m4 \
+       $(top_srcdir)/config/gnulib/inet_ntop.m4 \
+       $(top_srcdir)/config/gnulib/intmax_t.m4 \
+       $(top_srcdir)/config/gnulib/lock.m4 \
+       $(top_srcdir)/config/gnulib/longlong.m4 \
+       $(top_srcdir)/config/gnulib/malloc.m4 \
+       $(top_srcdir)/config/gnulib/mkdtemp.m4 \
+       $(top_srcdir)/config/gnulib/netinet_in_h.m4 \
+       $(top_srcdir)/config/gnulib/onceonly_2_57.m4 \
+       $(top_srcdir)/config/gnulib/physmem.m4 \
+       $(top_srcdir)/config/gnulib/safe-read.m4 \
+       $(top_srcdir)/config/gnulib/safe-write.m4 \
+       $(top_srcdir)/config/gnulib/snprintf.m4 \
+       $(top_srcdir)/config/gnulib/socklen.m4 \
+       $(top_srcdir)/config/gnulib/sockpfaf.m4 \
+       $(top_srcdir)/config/gnulib/ssize_t.m4 \
+       $(top_srcdir)/config/gnulib/stdbool.m4 \
+       $(top_srcdir)/config/gnulib/stdint.m4 \
+       $(top_srcdir)/config/gnulib/stdio_h.m4 \
+       $(top_srcdir)/config/gnulib/stdlib_h.m4 \
+       $(top_srcdir)/config/gnulib/strdup.m4 \
+       $(top_srcdir)/config/gnulib/string_h.m4 \
+       $(top_srcdir)/config/gnulib/sys_socket_h.m4 \
+       $(top_srcdir)/config/gnulib/sys_stat_h.m4 \
+       $(top_srcdir)/config/gnulib/sys_time_h.m4 \
+       $(top_srcdir)/config/gnulib/tempname.m4 \
+       $(top_srcdir)/config/gnulib/unistd_h.m4 \
+       $(top_srcdir)/config/gnulib/vasnprintf.m4 \
+       $(top_srcdir)/config/gnulib/visibility.m4 \
+       $(top_srcdir)/config/gnulib/wchar.m4 \
+       $(top_srcdir)/config/gettext-macros/gettext.m4 \
+       $(top_srcdir)/config/gettext-macros/iconv.m4 \
+       $(top_srcdir)/config/gettext-macros/inttypes_h.m4 \
+       $(top_srcdir)/config/gettext-macros/lib-ld.m4 \
+       $(top_srcdir)/config/gettext-macros/lib-link.m4 \
+       $(top_srcdir)/config/gettext-macros/lib-prefix.m4 \
+       $(top_srcdir)/config/gettext-macros/nls.m4 \
+       $(top_srcdir)/config/gettext-macros/po.m4 \
+       $(top_srcdir)/config/gettext-macros/progtest.m4 \
+       $(top_srcdir)/config/gettext-macros/size_max.m4 \
+       $(top_srcdir)/config/gettext-macros/stdint_h.m4 \
+       $(top_srcdir)/config/gettext-macros/wchar_t.m4 \
+       $(top_srcdir)/config/gettext-macros/wint_t.m4 \
+       $(top_srcdir)/config/gettext-macros/xsize.m4 \
+       $(top_srcdir)/config/libtool.m4 $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config/config.h
+CONFIG_CLEAN_FILES =
+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|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(amlibdir)" "$(DESTDIR)$(sbindir)"
+amlibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(amlib_LTLIBRARIES)
+libamar_la_DEPENDENCIES = ../common-src/libamanda.la
+am_libamar_la_OBJECTS = amar.lo
+libamar_la_OBJECTS = $(am_libamar_la_OBJECTS)
+libamar_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+       $(libamar_la_LDFLAGS) $(LDFLAGS) -o $@
+am__EXEEXT_1 = amar-test$(EXEEXT)
+sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(noinst_PROGRAMS) $(sbin_PROGRAMS)
+am_amar_test_OBJECTS = amar-test.$(OBJEXT)
+amar_test_OBJECTS = $(am_amar_test_OBJECTS)
+amar_test_DEPENDENCIES = libamar.la ../common-src/libtestutils.la
+am_amarchiver_OBJECTS = amarchiver.$(OBJEXT)
+amarchiver_OBJECTS = $(am_amarchiver_OBJECTS)
+amarchiver_DEPENDENCIES = libamar.la
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/config
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+       --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+       $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+       --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+       $(LDFLAGS) -o $@
+SOURCES = $(libamar_la_SOURCES) $(amar_test_SOURCES) \
+       $(amarchiver_SOURCES)
+DIST_SOURCES = $(libamar_la_SOURCES) $(amar_test_SOURCES) \
+       $(amarchiver_SOURCES)
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AIX_BACKUP = @AIX_BACKUP@
+ALLOCA = @ALLOCA@
+ALLOCA_H = @ALLOCA_H@
+AMANDA_DBGDIR = @AMANDA_DBGDIR@
+AMANDA_DEBUG_DAYS = @AMANDA_DEBUG_DAYS@
+AMANDA_STATIC_LDFLAGS = @AMANDA_STATIC_LDFLAGS@
+AMANDA_TMPDIR = @AMANDA_TMPDIR@
+AMANDA_WARNING_CFLAGS = @AMANDA_WARNING_CFLAGS@
+AMLINT = @AMLINT@
+AMLINTFLAGS = @AMLINTFLAGS@
+AMPLOT_CAT_COMPRESS = @AMPLOT_CAT_COMPRESS@
+AMPLOT_CAT_GZIP = @AMPLOT_CAT_GZIP@
+AMPLOT_CAT_PACK = @AMPLOT_CAT_PACK@
+AMPLOT_COMPRESS = @AMPLOT_COMPRESS@
+AMTAR = @AMTAR@
+APPLICATION_DIR = @APPLICATION_DIR@
+AR = @AR@
+ARPA_INET_H = @ARPA_INET_H@
+ASSERTIONS = @ASSERTIONS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASH = @BASH@
+BINARY_OWNER = @BINARY_OWNER@
+BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@
+BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@
+BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@
+BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@
+BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@
+BSDTCP_SECURITY = @BSDTCP_SECURITY@
+BSDUDP_SECURITY = @BSDUDP_SECURITY@
+BSD_SECURITY = @BSD_SECURITY@
+CAT = @CAT@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
+CHECK_USERID = @CHECK_USERID@
+CHIO = @CHIO@
+CHS = @CHS@
+CLIENT_HOST_INSTANCE = @CLIENT_HOST_INSTANCE@
+CLIENT_HOST_KEY_FILE = @CLIENT_HOST_KEY_FILE@
+CLIENT_HOST_PRINCIPAL = @CLIENT_HOST_PRINCIPAL@
+CLIENT_LOGIN = @CLIENT_LOGIN@
+CLIENT_SCRIPTS_OPT = @CLIENT_SCRIPTS_OPT@
+COMPRESS = @COMPRESS@
+COMPRESS_BEST_OPT = @COMPRESS_BEST_OPT@
+COMPRESS_FAST_OPT = @COMPRESS_FAST_OPT@
+COMPRESS_PATH = @COMPRESS_PATH@
+COMPRESS_SUFFIX = @COMPRESS_SUFFIX@
+CONFIG_CLOBBER_MY_CONFIG = @CONFIG_CLOBBER_MY_CONFIG@
+CONFIG_DIR = @CONFIG_DIR@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CURL_CONFIG = @CURL_CONFIG@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DD = @DD@
+DEFAULT_AMANDATES_FILE = @DEFAULT_AMANDATES_FILE@
+DEFAULT_CHANGER_DEVICE = @DEFAULT_CHANGER_DEVICE@
+DEFAULT_CONFIG = @DEFAULT_CONFIG@
+DEFAULT_MAILER = @DEFAULT_MAILER@
+DEFAULT_SERVER = @DEFAULT_SERVER@
+DEFAULT_TAPE_DEVICE = @DEFAULT_TAPE_DEVICE@
+DEFAULT_TAPE_SERVER = @DEFAULT_TAPE_SERVER@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DOC_BUILD_DATE = @DOC_BUILD_DATE@
+DUMP = @DUMP@
+DUMP_RETURNS_1 = @DUMP_RETURNS_1@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EOVERFLOW = @EOVERFLOW@
+EXAMPLE_TAPEDEV = @EXAMPLE_TAPEDEV@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FLOAT_H = @FLOAT_H@
+GETCONF = @GETCONF@
+GETOPT_H = @GETOPT_H@
+GETTEXT = @GETTEXT@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+GLIB_LIBS = @GLIB_LIBS@
+GLIB_MKENUMS = @GLIB_MKENUMS@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
+GNULIB_CHOWN = @GNULIB_CHOWN@
+GNULIB_DUP2 = @GNULIB_DUP2@
+GNULIB_ENVIRON = @GNULIB_ENVIRON@
+GNULIB_FCHDIR = @GNULIB_FCHDIR@
+GNULIB_FFLUSH = @GNULIB_FFLUSH@
+GNULIB_FOPEN = @GNULIB_FOPEN@
+GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
+GNULIB_FREOPEN = @GNULIB_FREOPEN@
+GNULIB_FSEEK = @GNULIB_FSEEK@
+GNULIB_FSEEKO = @GNULIB_FSEEKO@
+GNULIB_FTELL = @GNULIB_FTELL@
+GNULIB_FTELLO = @GNULIB_FTELLO@
+GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@
+GNULIB_GETCWD = @GNULIB_GETCWD@
+GNULIB_GETDELIM = @GNULIB_GETDELIM@
+GNULIB_GETLINE = @GNULIB_GETLINE@
+GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
+GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@
+GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
+GNULIB_LCHOWN = @GNULIB_LCHOWN@
+GNULIB_LSEEK = @GNULIB_LSEEK@
+GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@
+GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@
+GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@
+GNULIB_MBSCHR = @GNULIB_MBSCHR@
+GNULIB_MBSCSPN = @GNULIB_MBSCSPN@
+GNULIB_MBSLEN = @GNULIB_MBSLEN@
+GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@
+GNULIB_MBSNLEN = @GNULIB_MBSNLEN@
+GNULIB_MBSPBRK = @GNULIB_MBSPBRK@
+GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@
+GNULIB_MBSRCHR = @GNULIB_MBSRCHR@
+GNULIB_MBSSEP = @GNULIB_MBSSEP@
+GNULIB_MBSSPN = @GNULIB_MBSSPN@
+GNULIB_MBSSTR = @GNULIB_MBSSTR@
+GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@
+GNULIB_MEMMEM = @GNULIB_MEMMEM@
+GNULIB_MEMPCPY = @GNULIB_MEMPCPY@
+GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
+GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
+GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
+GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
+GNULIB_PUTENV = @GNULIB_PUTENV@
+GNULIB_READLINK = @GNULIB_READLINK@
+GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@
+GNULIB_SETENV = @GNULIB_SETENV@
+GNULIB_SLEEP = @GNULIB_SLEEP@
+GNULIB_SNPRINTF = @GNULIB_SNPRINTF@
+GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@
+GNULIB_STPCPY = @GNULIB_STPCPY@
+GNULIB_STPNCPY = @GNULIB_STPNCPY@
+GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
+GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
+GNULIB_STRDUP = @GNULIB_STRDUP@
+GNULIB_STRERROR = @GNULIB_STRERROR@
+GNULIB_STRNDUP = @GNULIB_STRNDUP@
+GNULIB_STRNLEN = @GNULIB_STRNLEN@
+GNULIB_STRPBRK = @GNULIB_STRPBRK@
+GNULIB_STRSEP = @GNULIB_STRSEP@
+GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@
+GNULIB_STRSTR = @GNULIB_STRSTR@
+GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
+GNULIB_UNSETENV = @GNULIB_UNSETENV@
+GNULIB_VASPRINTF = @GNULIB_VASPRINTF@
+GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@
+GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
+GNULIB_VSNPRINTF = @GNULIB_VSNPRINTF@
+GNULIB_VSPRINTF_POSIX = @GNULIB_VSPRINTF_POSIX@
+GNULIB_WCWIDTH = @GNULIB_WCWIDTH@
+GNUPLOT = @GNUPLOT@
+GNUTAR = @GNUTAR@
+GNUTAR_LISTED_INCREMENTAL_DIR = @GNUTAR_LISTED_INCREMENTAL_DIR@
+GOBJECT_QUERY = @GOBJECT_QUERY@
+GREP = @GREP@
+GZIP = @GZIP@
+HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@
+HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@
+HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@
+HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@
+HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
+HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@
+HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
+HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@
+HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
+HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
+HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@
+HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
+HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
+HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@
+HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
+HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
+HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
+HAVE_DUP2 = @HAVE_DUP2@
+HAVE_FSEEKO = @HAVE_FSEEKO@
+HAVE_FTELLO = @HAVE_FTELLO@
+HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
+HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
+HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
+HAVE_GZIP = @HAVE_GZIP@
+HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
+HAVE_IO_H = @HAVE_IO_H@
+HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
+HAVE_LSTAT = @HAVE_LSTAT@
+HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@
+HAVE_MEMPCPY = @HAVE_MEMPCPY@
+HAVE_MKDTEMP = @HAVE_MKDTEMP@
+HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@
+HAVE_OS_H = @HAVE_OS_H@
+HAVE_READLINK = @HAVE_READLINK@
+HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@
+HAVE_SETENV = @HAVE_SETENV@
+HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
+HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
+HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
+HAVE_SLEEP = @HAVE_SLEEP@
+HAVE_STDINT_H = @HAVE_STDINT_H@
+HAVE_STPCPY = @HAVE_STPCPY@
+HAVE_STPNCPY = @HAVE_STPNCPY@
+HAVE_STRCASESTR = @HAVE_STRCASESTR@
+HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
+HAVE_STRNDUP = @HAVE_STRNDUP@
+HAVE_STRPBRK = @HAVE_STRPBRK@
+HAVE_STRSEP = @HAVE_STRSEP@
+HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@
+HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
+HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
+HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
+HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
+HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
+HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
+HAVE_UNISTD_H = @HAVE_UNISTD_H@
+HAVE_UNSETENV = @HAVE_UNSETENV@
+HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
+HAVE_VASPRINTF = @HAVE_VASPRINTF@
+HAVE_VISIBILITY = @HAVE_VISIBILITY@
+HAVE_WCHAR_H = @HAVE_WCHAR_H@
+HAVE_WINSOCK2_H = @HAVE_WINSOCK2_H@
+HAVE_WS2TCPIP_H = @HAVE_WS2TCPIP_H@
+HAVE__BOOL = @HAVE__BOOL@
+INCLUDE_NEXT = @INCLUDE_NEXT@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+KRB4_SECURITY = @KRB4_SECURITY@
+KRB5_SECURITY = @KRB5_SECURITY@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBCURL = @LIBCURL@
+LIBCURL_CPPFLAGS = @LIBCURL_CPPFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBMULTITHREAD = @LIBMULTITHREAD@
+LIBOBJS = @LIBOBJS@
+LIBPTH = @LIBPTH@
+LIBS = @LIBS@
+LIBTHREAD = @LIBTHREAD@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LN_S = @LN_S@
+LOCKING = @LOCKING@
+LOW_TCPPORTRANGE = @LOW_TCPPORTRANGE@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
+LTLIBOBJS = @LTLIBOBJS@
+LTLIBPTH = @LTLIBPTH@
+LTLIBTHREAD = @LTLIBTHREAD@
+MAILER = @MAILER@
+MAKEINFO = @MAKEINFO@
+MCUTIL = @MCUTIL@
+MKDIR_P = @MKDIR_P@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+MT = @MT@
+MTX = @MTX@
+MT_FILE_FLAG = @MT_FILE_FLAG@
+NETINET_IN_H = @NETINET_IN_H@
+NEXT_FLOAT_H = @NEXT_FLOAT_H@
+NEXT_NETINET_IN_H = @NEXT_NETINET_IN_H@
+NEXT_STDINT_H = @NEXT_STDINT_H@
+NEXT_STDIO_H = @NEXT_STDIO_H@
+NEXT_STDLIB_H = @NEXT_STDLIB_H@
+NEXT_STRING_H = @NEXT_STRING_H@
+NEXT_SYS_SOCKET_H = @NEXT_SYS_SOCKET_H@
+NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@
+NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@
+NEXT_UNISTD_H = @NEXT_UNISTD_H@
+NEXT_WCHAR_H = @NEXT_WCHAR_H@
+OBJEXT = @OBJEXT@
+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@
+PCAT = @PCAT@
+PERL = @PERL@
+PERLEXTLIBS = @PERLEXTLIBS@
+PERL_INC = @PERL_INC@
+PKG_CONFIG = @PKG_CONFIG@
+POSUB = @POSUB@
+PRINT = @PRINT@
+PS = @PS@
+PS_ARGUMENT = @PS_ARGUMENT@
+PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
+RANLIB = @RANLIB@
+READLINE_LIBS = @READLINE_LIBS@
+REPLACE_CHOWN = @REPLACE_CHOWN@
+REPLACE_FCHDIR = @REPLACE_FCHDIR@
+REPLACE_FFLUSH = @REPLACE_FFLUSH@
+REPLACE_FOPEN = @REPLACE_FOPEN@
+REPLACE_FPRINTF = @REPLACE_FPRINTF@
+REPLACE_FREOPEN = @REPLACE_FREOPEN@
+REPLACE_FSEEK = @REPLACE_FSEEK@
+REPLACE_FSEEKO = @REPLACE_FSEEKO@
+REPLACE_FTELL = @REPLACE_FTELL@
+REPLACE_FTELLO = @REPLACE_FTELLO@
+REPLACE_GETCWD = @REPLACE_GETCWD@
+REPLACE_GETLINE = @REPLACE_GETLINE@
+REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
+REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
+REPLACE_LCHOWN = @REPLACE_LCHOWN@
+REPLACE_LSEEK = @REPLACE_LSEEK@
+REPLACE_MEMMEM = @REPLACE_MEMMEM@
+REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
+REPLACE_PRINTF = @REPLACE_PRINTF@
+REPLACE_PUTENV = @REPLACE_PUTENV@
+REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
+REPLACE_SPRINTF = @REPLACE_SPRINTF@
+REPLACE_STRCASESTR = @REPLACE_STRCASESTR@
+REPLACE_STRERROR = @REPLACE_STRERROR@
+REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@
+REPLACE_STRSTR = @REPLACE_STRSTR@
+REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
+REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
+REPLACE_VPRINTF = @REPLACE_VPRINTF@
+REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
+REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
+REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
+RESTORE = @RESTORE@
+RSH_SECURITY = @RSH_SECURITY@
+SAMBA_CLIENT = @SAMBA_CLIENT@
+SERVER_HOST_INSTANCE = @SERVER_HOST_INSTANCE@
+SERVER_HOST_KEY_FILE = @SERVER_HOST_KEY_FILE@
+SERVER_HOST_PRINCIPAL = @SERVER_HOST_PRINCIPAL@
+SERVICE_SUFFIX = @SERVICE_SUFFIX@
+SETUID_GROUP = @SETUID_GROUP@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@
+SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
+SNAPSHOT_STAMP = @SNAPSHOT_STAMP@
+SORT = @SORT@
+SSH = @SSH@
+SSH_SECURITY = @SSH_SECURITY@
+STDBOOL_H = @STDBOOL_H@
+STDINT_H = @STDINT_H@
+STRIP = @STRIP@
+SVN = @SVN@
+SWIG = @SWIG@
+SWIG_LIB = @SWIG_LIB@
+SYS_SOCKET_H = @SYS_SOCKET_H@
+SYS_STAT_H = @SYS_STAT_H@
+SYS_TIME_H = @SYS_TIME_H@
+TCPPORTRANGE = @TCPPORTRANGE@
+TICKET_LIFETIME = @TICKET_LIFETIME@
+UDPPORTRANGE = @UDPPORTRANGE@
+UNCOMPRESS_OPT = @UNCOMPRESS_OPT@
+UNCOMPRESS_PATH = @UNCOMPRESS_PATH@
+USE_AMANDAHOSTS = @USE_AMANDAHOSTS@
+USE_NLS = @USE_NLS@
+USE_RUNDUMP = @USE_RUNDUMP@
+USE_VERSION_SUFFIXES = @USE_VERSION_SUFFIXES@
+VDUMP = @VDUMP@
+VERSION = @VERSION@
+VERSION_COMMENT = @VERSION_COMMENT@
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MINOR = @VERSION_MINOR@
+VERSION_PATCH = @VERSION_PATCH@
+VERSION_SUFFIX = @VERSION_SUFFIX@
+VOID_UNSETENV = @VOID_UNSETENV@
+VRESTORE = @VRESTORE@
+VXDUMP = @VXDUMP@
+VXRESTORE = @VXRESTORE@
+WCHAR_H = @WCHAR_H@
+WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@
+WINT_T_SUFFIX = @WINT_T_SUFFIX@
+XFSDUMP = @XFSDUMP@
+XFSRESTORE = @XFSRESTORE@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+XSLREL = @XSLREL@
+XSLTPROC = @XSLTPROC@
+XSLTPROC_FLAGS = @XSLTPROC_FLAGS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+_libcurl_config = @_libcurl_config@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amdatadir = @amdatadir@
+amincludedir = @amincludedir@
+amlibdir = @amlibdir@
+amlibexecdir = @amlibexecdir@
+amperldir = @amperldir@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+gl_LIBOBJS = @gl_LIBOBJS@
+gl_LTLIBOBJS = @gl_LTLIBOBJS@
+gltests_LIBOBJS = @gltests_LIBOBJS@
+gltests_LTLIBOBJS = @gltests_LTLIBOBJS@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+SUFFIXES = 
+EXTRA_DIST = 
+BUILT_SOURCES = 
+MOSTLYCLEANFILES = 
+
+# config.status leaves config.log files around
+CLEANFILES = config.log
+
+# and we'll need to clean up our generated files for distclean
+DISTCLEANFILES = $(SCRIPTS_SHELL) $(SCRIPTS_PERL) $(SCRIPTS_AWK) \
+       $(SCRIPTS_INCLUDE) $(am__append_1)
+MAINTAINERCLEANFILES = 
+
+# syntax-check shell scripts on 'make check'
+CHECK_SHELL = $(SCRIPTS_SHELL)
+
+# sed expression to strip leading directories from a filename; this converts e.g.,
+# src/foo/bar.so to bar.so.
+strip_leading_dirs = s|^.*/||
+@WANT_INSTALLPERMS_FALSE@do_file = pa="$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
+@WANT_INSTALLPERMS_FALSE@    echo "installperm \"$$chown\" \"$$chmod\" \"$$pa\"" >> "$(installperms_sh)"
+
+
+# define a snippet of the scripts below to either perform a chown/chmod operation,
+# or record that operation in the logfile.  On entry to the snippet, $$dest is the
+# destination directory, $$cmd is the srcdir-relative pathname of the target file,
+# $$chown is the ownership, and $$chmod is the permission pattern.
+@WANT_INSTALLPERMS_TRUE@do_file = pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
+@WANT_INSTALLPERMS_TRUE@    if test -n "$$chown"; then \
+@WANT_INSTALLPERMS_TRUE@       echo chown "$$chown" "$$pa"; \
+@WANT_INSTALLPERMS_TRUE@       chown "$$chown" "$$pa" || exit 1; \
+@WANT_INSTALLPERMS_TRUE@    fi; \
+@WANT_INSTALLPERMS_TRUE@    if test -n "$$chmod"; then \
+@WANT_INSTALLPERMS_TRUE@       echo chmod "$$chmod" "$$pa"; \
+@WANT_INSTALLPERMS_TRUE@       chmod "$$chmod" "$$pa" || exit 1; \
+@WANT_INSTALLPERMS_TRUE@    fi 
+
+@WANT_INSTALLPERMS_FALSE@installperms_sh = "$(top_builddir)/installperms.sh"
+INCLUDES = -I$(top_builddir)/common-src \
+                -I$(top_srcdir)/common-src \
+                -I$(top_srcdir)/gnulib
+
+AM_CFLAGS = $(AMANDA_WARNING_CFLAGS)
+AM_LDFLAGS = $(AMANDA_STATIC_LDFLAGS)
+LINT = @AMLINT@
+LINTFLAGS = @AMLINTFLAGS@
+amlib_LTLIBRARIES = libamar.la
+libamar_la_SOURCES = amar.c
+libamar_la_LDFLAGS = -release $(VERSION)
+libamar_la_LIBADD = ../common-src/libamanda.la
+noinst_HEADERS = \
+       amar.h
+
+amarchiver_SOURCES = amarchiver.c
+amarchiver_LDADD = libamar.la
+amar_test_SOURCES = amar-test.c
+amar_test_LDADD = libamar.la \
+       ../common-src/libtestutils.la
+
+all: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(top_srcdir)/config/automake/vars.am $(top_srcdir)/config/automake/scripts.am $(top_srcdir)/config/automake/installperms.am $(top_srcdir)/config/automake/precompile.am $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  amar-src/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  amar-src/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-amlibLTLIBRARIES: $(amlib_LTLIBRARIES)
+       @$(NORMAL_INSTALL)
+       test -z "$(amlibdir)" || $(MKDIR_P) "$(DESTDIR)$(amlibdir)"
+       @list='$(amlib_LTLIBRARIES)'; for p in $$list; do \
+         if test -f $$p; then \
+           f=$(am__strip_dir) \
+           echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(amlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(amlibdir)/$$f'"; \
+           $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(amlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(amlibdir)/$$f"; \
+         else :; fi; \
+       done
+
+uninstall-amlibLTLIBRARIES:
+       @$(NORMAL_UNINSTALL)
+       @list='$(amlib_LTLIBRARIES)'; for p in $$list; do \
+         p=$(am__strip_dir) \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(amlibdir)/$$p'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(amlibdir)/$$p"; \
+       done
+
+clean-amlibLTLIBRARIES:
+       -test -z "$(amlib_LTLIBRARIES)" || rm -f $(amlib_LTLIBRARIES)
+       @list='$(amlib_LTLIBRARIES)'; for p in $$list; do \
+         dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+         test "$$dir" != "$$p" || dir=.; \
+         echo "rm -f \"$${dir}/so_locations\""; \
+         rm -f "$${dir}/so_locations"; \
+       done
+libamar.la: $(libamar_la_OBJECTS) $(libamar_la_DEPENDENCIES) 
+       $(libamar_la_LINK) -rpath $(amlibdir) $(libamar_la_OBJECTS) $(libamar_la_LIBADD) $(LIBS)
+
+clean-noinstPROGRAMS:
+       @list='$(noinst_PROGRAMS)'; for p in $$list; do \
+         f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+         echo " rm -f $$p $$f"; \
+         rm -f $$p $$f ; \
+       done
+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 \
+            || test -f $$p1 \
+         ; then \
+           f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+          echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \
+          $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(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:
+       @list='$(sbin_PROGRAMS)'; for p in $$list; do \
+         f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+         echo " rm -f $$p $$f"; \
+         rm -f $$p $$f ; \
+       done
+amar-test$(EXEEXT): $(amar_test_OBJECTS) $(amar_test_DEPENDENCIES) 
+       @rm -f amar-test$(EXEEXT)
+       $(LINK) $(amar_test_OBJECTS) $(amar_test_LDADD) $(LIBS)
+amarchiver$(EXEEXT): $(amarchiver_OBJECTS) $(amarchiver_DEPENDENCIES) 
+       @rm -f amarchiver$(EXEEXT)
+       $(LINK) $(amarchiver_OBJECTS) $(amarchiver_LDADD) $(LIBS)
+
+mostlyclean-compile:
+       -rm -f *.$(OBJEXT)
+
+distclean-compile:
+       -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amar-test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amar.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amarchiver.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@   $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@   mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@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@   $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@   mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@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) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@   $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@   mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+       -rm -f *.lo
+
+clean-libtool:
+       -rm -rf .libs _libs
+
+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; nonemtpy = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       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; nonempty = 1; } \
+             END { if (nonempty) { 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:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       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; nonempty = 1; } \
+             END { if (nonempty) { 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
+
+check-TESTS: $(TESTS)
+       @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[        ]'; \
+       srcdir=$(srcdir); export srcdir; \
+       list=' $(TESTS) '; \
+       if test -n "$$list"; then \
+         for tst in $$list; do \
+           if test -f ./$$tst; then dir=./; \
+           elif test -f $$tst; then dir=; \
+           else dir="$(srcdir)/"; fi; \
+           if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+             all=`expr $$all + 1`; \
+             case " $(XFAIL_TESTS) " in \
+             *$$ws$$tst$$ws*) \
+               xpass=`expr $$xpass + 1`; \
+               failed=`expr $$failed + 1`; \
+               echo "XPASS: $$tst"; \
+             ;; \
+             *) \
+               echo "PASS: $$tst"; \
+             ;; \
+             esac; \
+           elif test $$? -ne 77; then \
+             all=`expr $$all + 1`; \
+             case " $(XFAIL_TESTS) " in \
+             *$$ws$$tst$$ws*) \
+               xfail=`expr $$xfail + 1`; \
+               echo "XFAIL: $$tst"; \
+             ;; \
+             *) \
+               failed=`expr $$failed + 1`; \
+               echo "FAIL: $$tst"; \
+             ;; \
+             esac; \
+           else \
+             skip=`expr $$skip + 1`; \
+             echo "SKIP: $$tst"; \
+           fi; \
+         done; \
+         if test "$$failed" -eq 0; then \
+           if test "$$xfail" -eq 0; then \
+             banner="All $$all tests passed"; \
+           else \
+             banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
+           fi; \
+         else \
+           if test "$$xpass" -eq 0; then \
+             banner="$$failed of $$all tests failed"; \
+           else \
+             banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
+           fi; \
+         fi; \
+         dashes="$$banner"; \
+         skipped=""; \
+         if test "$$skip" -ne 0; then \
+           skipped="($$skip tests were not run)"; \
+           test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+             dashes="$$skipped"; \
+         fi; \
+         report=""; \
+         if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+           report="Please report to $(PACKAGE_BUGREPORT)"; \
+           test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+             dashes="$$report"; \
+         fi; \
+         dashes=`echo "$$dashes" | sed s/./=/g`; \
+         echo "$$dashes"; \
+         echo "$$banner"; \
+         test -z "$$skipped" || echo "$$skipped"; \
+         test -z "$$report" || echo "$$report"; \
+         echo "$$dashes"; \
+         test "$$failed" -eq 0; \
+       else :; fi
+
+distdir: $(DISTFILES)
+       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       list='$(DISTFILES)'; \
+         dist_files=`for file in $$list; do echo $$file; done | \
+         sed -e "s|^$$srcdirstrip/||;t" \
+             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+       case $$dist_files in \
+         */*) $(MKDIR_P) `echo "$$dist_files" | \
+                          sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+                          sort -u` ;; \
+       esac; \
+       for file in $$dist_files; do \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         if test -d $$d/$$file; then \
+           dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+           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
+       $(MAKE) $(AM_MAKEFLAGS) \
+         top_distdir="$(top_distdir)" distdir="$(distdir)" \
+         dist-hook
+check-am: all-am
+       $(MAKE) $(AM_MAKEFLAGS) check-TESTS check-local
+check: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS)
+installdirs:
+       for dir in "$(DESTDIR)$(amlibdir)" "$(DESTDIR)$(sbindir)"; do \
+         test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+       done
+install: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+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:
+       -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+
+clean-generic:
+       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+       -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+       -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+       -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-am
+
+clean-am: clean-amlibLTLIBRARIES clean-generic clean-libtool \
+       clean-noinstPROGRAMS clean-sbinPROGRAMS mostlyclean-am
+
+distclean: distclean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+       distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-amlibLTLIBRARIES
+       @$(NORMAL_INSTALL)
+       $(MAKE) $(AM_MAKEFLAGS) install-data-hook
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-sbinPROGRAMS
+       @$(NORMAL_INSTALL)
+       $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am: installcheck-local
+
+maintainer-clean: maintainer-clean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+       mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-amlibLTLIBRARIES uninstall-sbinPROGRAMS
+
+.MAKE: install-am install-data-am install-exec-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am check-local \
+       clean clean-amlibLTLIBRARIES clean-generic clean-libtool \
+       clean-noinstPROGRAMS clean-sbinPROGRAMS ctags dist-hook \
+       distclean distclean-compile distclean-generic \
+       distclean-libtool distclean-tags distdir dvi dvi-am html \
+       html-am info info-am install install-am \
+       install-amlibLTLIBRARIES install-data install-data-am \
+       install-data-hook install-dvi install-dvi-am install-exec \
+       install-exec-am install-exec-hook install-html install-html-am \
+       install-info install-info-am install-man install-pdf \
+       install-pdf-am install-ps install-ps-am install-sbinPROGRAMS \
+       install-strip installcheck installcheck-am installcheck-local \
+       installdirs maintainer-clean maintainer-clean-generic \
+       mostlyclean mostlyclean-compile mostlyclean-generic \
+       mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+       uninstall-am uninstall-amlibLTLIBRARIES uninstall-sbinPROGRAMS
+
+
+# Perl
+%: %.pl $(top_builddir)/config.status
+       $(top_builddir)/config.status --file=$@:$<
+       chmod a+x $@
+       @if test -f $(top_builddir)/perl/.libs/libCmdline.so -o -f $(top_builddir)/perl/libCmdline.so; then \
+               grep -v '^use lib' $@ > $@.nouselib; \
+               $(PERL) $(CHECK_PERL_FLAGS) -I$(top_builddir)/perl -I$(top_builddir)/perl/.libs -I$(top_srcdir)/perl -c -w -T $@.nouselib || exit 1; \
+               rm $@.nouselib; \
+       fi
+
+%.pl: %.pl.in $(top_builddir)/config.status
+       $(top_builddir)/config.status --file=$@:$<
+
+%.pm: %.pm.in $(top_builddir)/config.status
+       $(top_builddir)/config.status --file=$@:$<
+
+# Shell
+%: %.sh $(top_builddir)/config.status
+       $(top_builddir)/config.status --file=$@:$<
+       chmod a+x $@
+
+%.sh: %.sh.in $(top_builddir)/config.status
+       $(top_builddir)/config.status --file=$@:$<
+
+# Awk
+%: %.awk $(top_builddir)/config.status
+       $(top_builddir)/config.status --file=$@:$<
+       chmod a+x $@
+
+%.awk: %.awk.in $(top_builddir)/config.status
+       $(top_builddir)/config.status --file=$@:$<
+
+# syntax-check perl scripts on 'make check'
+check-perl: $(CHECK_PERL)
+       @CHECK_PERL="$(CHECK_PERL)"; \
+       if test -f $(top_builddir)/perl/.libs/libCmdline.so -o -f $(top_builddir)/perl/libCmdline.so; then \
+               if test -n "$(PERL)"; then \
+                       for perlobj in $$CHECK_PERL; do \
+                               grep -v '^use lib' $$perlobj > $$perlobj.nouselib; \
+                               $(PERL) $(CHECK_PERL_FLAGS) -I$(top_builddir)/perl -I$(top_builddir)/perl/.libs -I$(top_srcdir)/perl -c -w -T $$perlobj.nouselib || exit 1; \
+                               rm $$perlobj.nouselib; \
+                       done; \
+               fi \
+       fi
+check-local: check-perl
+
+# syntax-check perl scripts on 'make installcheck'
+installcheck-perl: $(CHECK_PERL)
+       @CHECK_PERL="$(CHECK_PERL)"; \
+       if test -n "$(PERL)"; then \
+               for perlobj in $$CHECK_PERL; do \
+                       $(PERL) $(CHECK_PERL_FLAGS) -c -w -T $$perlobj || exit 1; \
+               done; \
+       fi
+installcheck-local: installcheck-perl
+check-shell: $(CHECK_SHELL)
+       @CHECK_SHELL="$(CHECK_SHELL)"; \
+       if test -n "$$CHECK_SHELL"; then \
+               if test -n "$(BASH)"; then \
+                       for shobj in $$CHECK_SHELL; do \
+                               if $(BASH) -n $$shobj; then \
+                                       echo "$$shobj syntax OK"; \
+                               else \
+                                       echo "$$shobj syntax error"; \
+                                       exit 1; \
+                               fi; \
+                       done; \
+               else \
+                       echo "No 'bash' available -- cannot syntax-check shell scripts"; \
+               fi; \
+       fi
+check-local: check-shell
+
+# make sure that the sources for all shell and perl scripts get included
+# in the distribution
+dist-scripts:
+       SCRIPTS_PERL="$(SCRIPTS_PERL)"; SCRIPTS_SHELL="$(SCRIPTS_SHELL)"; SCRIPTS_AWK="$(SCRIPTS_AWK)"; \
+       for script in $$SCRIPTS_PERL; do \
+               test -f $(srcdir)/$${script}.pl && { cp -p $(srcdir)/$${script}.pl $(distdir)/ || exit 1; } \
+       done; \
+       for script in $$SCRIPTS_SHELL; do \
+               test -f $(srcdir)/$${script}.sh && { cp -p $(srcdir)/$${script}.sh $(distdir)/ || exit 1; } \
+       done; \
+       for script in $$SCRIPTS_AWK; do \
+               test -f $(srcdir)/$${script}.awk && { cp -p $(srcdir)/$${script}.awk $(distdir)/ || exit 1; } \
+       done; \
+       for script in $$SCRIPTS_SHELL $$SCRIPTS_PERL $$SCRIPTS_AWK; do \
+               test -f $(srcdir)/$${script}.in && { cp -p $(srcdir)/$${script}.in $(distdir)/ || exit 1; } \
+       done; \
+       true
+dist-hook: dist-scripts
+
+installperms-exec:
+       @installperms="$(INSTALLPERMS_exec)"; \
+       test -n "$$installperms" && echo "Setting installation permissions on executables"; \
+       dest=; chown=; chmod=; \
+       for cmd in $$installperms; do \
+           case "$$cmd" in \
+               chown=amanda) \
+                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
+               dest=*|chown=*|chmod=*) \
+                       echo "  ($$cmd)"; eval $$cmd;; \
+               *) $(do_file) ;; \
+           esac; \
+       done
+
+installperms-data:
+       @installperms="$(INSTALLPERMS_data)"; \
+       dest=; chown=; chmod=; \
+       for cmd in $$installperms; do \
+           case "$$cmd" in \
+               chown=amanda) \
+                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
+               dest=*|chown=*|chmod=*) \
+                       echo "  ($$cmd)"; eval $$cmd;; \
+               *)  $(do_file) ;; \
+           esac; \
+       done
+
+install-exec-hook: installperms-exec
+install-data-hook: installperms-data
+
+# define a rule to initialize the installperms manifest file
+@WANT_INSTALLPERMS_TRUE@installperms-init:
+@WANT_INSTALLPERMS_FALSE@installperms-init:
+@WANT_INSTALLPERMS_FALSE@      rm -f "$(installperms_sh)"
+
+# A rule to make precompiler output from C files.  This is not used during
+# ordinary builds, but but can very useful in debugging problems on strange
+# architectures.  With this rule, we can ask users to 'make foo.i' and send
+# the result to us.
+#
+# It touches some automake internals ($COMPILE), but since it's not
+# build-critical, that's OK.
+%.i : %.c
+       $(COMPILE) -E -o $@ $<
+# 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/amar-src/amar-test.c b/amar-src/amar-test.c
new file mode 100644 (file)
index 0000000..d69b7be
--- /dev/null
@@ -0,0 +1,1121 @@
+/*
+ * Amanda, The Advanced Maryland Automatic Network Disk Archiver
+ * Copyright (c) 1991-1998 University of Maryland at College Park
+ * All Rights Reserved.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of U.M. not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  U.M. makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as is"
+ * without express or implied warranty.
+ *
+ * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M.
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors: the Amanda Development Team.  Its members are listed in a
+ * file named AUTHORS, in the root directory of this distribution.
+ */
+
+#include "amanda.h"
+#include "amar.h"
+#include "testutils.h"
+#include "simpleprng.h"
+
+static char *temp_filename = NULL;
+
+/****
+ * Macros for creating files with a particular structure
+ */
+
+#define WRITE_HEADER(fd, version) do { \
+    char hdr[28]; \
+    bzero(hdr, 28); \
+    snprintf(hdr, 28, "AMANDA ARCHIVE FORMAT %d", (version)); \
+    g_assert(full_write((fd), hdr, 28) == 28); \
+} while(0);
+
+#define WRITE_RECORD(fd, filenum, attrid, size, eoa, data) do { \
+    struct { uint16_t f; uint16_t a; uint32_t s; } rec; \
+    rec.f = htons((filenum)); \
+    rec.a = htons((attrid)); \
+    rec.s = htonl((size) | (eoa? 0x80000000 : 0)); \
+    g_assert(full_write((fd), &rec, sizeof(rec)) == sizeof(rec)); \
+    g_assert(full_write((fd), (data), (size)) == (size)); \
+} while(0);
+
+#define WRITE_RECORD_STR(fd, filenum, attrid, eoa, str) do { \
+    size_t len = strlen((str)); \
+    WRITE_RECORD((fd), (filenum), (attrid), len, (eoa), (str)); \
+} while(0);
+
+/****
+ * Assertions for amanda_read_archive callbacks
+ */
+
+typedef enum {
+    EXP_END,
+    EXP_START_FILE,
+    EXP_ATTRDATA,
+    EXP_FINISH_FILE,
+} expected_kind_t;
+
+typedef struct {
+    expected_kind_t kind;
+    uint16_t filenum;
+    uint16_t attrid;
+    char *data;
+    size_t datasize;
+    gboolean multipart_ok;
+    gboolean eoa;
+    gboolean truncated;
+    gboolean should_ignore;
+    gboolean isstr;
+} expected_step_t;
+
+typedef struct {
+    expected_step_t *steps;
+    int curstep;
+} expected_state_t;
+
+#define EXPECT_START_FILE(filenum, data, datasize, should_ignore) \
+    { EXP_START_FILE, (filenum), 0, (data), (datasize), 0, 0, 0, (should_ignore), 0 }
+
+#define EXPECT_START_FILE_STR(filenum, filename, should_ignore) \
+    { EXP_START_FILE, (filenum), 0, (filename), strlen((filename)), 0, 0, 0, (should_ignore), 1 }
+
+#define EXPECT_ATTR_DATA(filenum, attrid, data, datasize, eoa, truncated) \
+    { EXP_ATTRDATA, (filenum), (attrid), (data), (datasize), 0, (eoa), (truncated), 0, 0 }
+
+#define EXPECT_ATTR_DATA_MULTIPART(filenum, attrid, data, datasize, eoa, truncated) \
+    { EXP_ATTRDATA, (filenum), (attrid), (data), (datasize), 1, (eoa), (truncated), 0, 0 }
+
+#define EXPECT_ATTR_DATA_STR(filenum, attrid, datastr, eoa, truncated) \
+    { EXP_ATTRDATA, (filenum), (attrid), (datastr), strlen((datastr)), 0, (eoa), (truncated), 0, 1 }
+
+#define EXPECT_FINISH_FILE(filenum, truncated) \
+    { EXP_FINISH_FILE, (filenum), 0, 0, 0, 0, 0, (truncated), 0, 0 }
+
+#define EXPECT_END() \
+    { EXP_END, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
+
+#define EXPECT_FAILURE(fmt, ...) do { \
+    fprintf(stderr, fmt "\n", __VA_ARGS__); \
+    exit(1); \
+} while(0)
+
+static gboolean
+file_start_cb(
+       gpointer user_data,
+       uint16_t filenum,
+       gpointer filename,
+       gsize filename_len,
+       gboolean *ignore,
+       gpointer *file_data G_GNUC_UNUSED)
+{
+    expected_state_t *state = user_data;
+    expected_step_t *step = state->steps + state->curstep;
+
+    tu_dbg("file_start_cb(NULL, %d, '%s', %zd, .., ..)\n",
+       (int)filenum, (char *)filename, filename_len);
+
+    if (step->kind != EXP_START_FILE)
+       EXPECT_FAILURE("step %d: unexpected new file with fileid %d",
+                       state->curstep, (int)filenum);
+
+    if (step->filenum != filenum)
+       EXPECT_FAILURE("step %d: expected new file with filenum %d; got filenum %d",
+                       state->curstep, (int)step->filenum, (int)filenum);
+
+    if (filename_len != step->datasize)
+       EXPECT_FAILURE("step %d: filename lengths do not match: got %zd, expected %zd",
+                       state->curstep, filename_len, step->datasize);
+
+    if (memcmp(filename, step->data, filename_len)) {
+       if (step->isstr) {
+           EXPECT_FAILURE("step %d: new file's filename does not match: got '%*s', expected '%*s'",
+                           state->curstep, (int)filename_len, (char *)filename,
+                           (int)step->datasize, (char *)step->data);
+       } else {
+           EXPECT_FAILURE("step %d: new file's filename does not match",
+                           state->curstep);
+       }
+    }
+
+    *ignore = step->should_ignore;
+    state->curstep++;
+
+    return TRUE;
+}
+
+static gboolean
+file_finish_cb(
+       gpointer user_data,
+       uint16_t filenum,
+       gpointer *file_data G_GNUC_UNUSED,
+       gboolean truncated)
+{
+    expected_state_t *state = user_data;
+    expected_step_t *step = state->steps + state->curstep;
+
+    tu_dbg("file_finish_cb(NULL, %d, NULL, %d)\n",
+       (int)filenum, truncated);
+
+    if (step->kind != EXP_FINISH_FILE)
+       EXPECT_FAILURE("step %d: unexpected file finish with fileid %d",
+                       state->curstep, (int)filenum);
+
+    if (step->truncated && !truncated)
+       EXPECT_FAILURE("step %d: file %d was unexpectedly not truncated",
+                       state->curstep, (int)filenum);
+
+    if (step->truncated && !truncated)
+       EXPECT_FAILURE("step %d: file %d was unexpectedly truncated",
+                       state->curstep, (int)filenum);
+
+    state->curstep++;
+
+    return TRUE;
+}
+
+static gboolean
+frag_cb(
+       gpointer user_data,
+       uint16_t filenum,
+       gpointer file_data G_GNUC_UNUSED,
+       uint16_t attrid,
+       gpointer attrid_data G_GNUC_UNUSED,
+       gpointer *attr_data G_GNUC_UNUSED,
+       gpointer data,
+       gsize datasize,
+       gboolean eoa,
+       gboolean truncated)
+{
+    expected_state_t *state = user_data;
+    expected_step_t *step = state->steps + state->curstep;
+
+    tu_dbg("file_finish_cb(NULL, %d, NULL, %d, %p, %zd, %d, %d)\n",
+       (int)filenum, (int)attrid, data, datasize, eoa, truncated);
+
+    if (step->kind != EXP_ATTRDATA)
+       EXPECT_FAILURE("step %d: unexpected attribute data with fileid %d, attrid %d",
+                       state->curstep, (int)filenum, (int)attrid);
+
+    if (step->filenum != filenum)
+       EXPECT_FAILURE("step %d: expected attribute data with filenum %d; got filenum %d",
+                       state->curstep, (int)step->filenum, (int)filenum);
+
+    if (step->attrid != attrid)
+       EXPECT_FAILURE("step %d: expected attribute data with attrid %d; got attrid %d",
+                       state->curstep, (int)step->attrid, (int)attrid);
+
+    /* if we're accepting multiple fragments of the attribute here (due to internal
+     * buffering by the reader), then handle that specially */
+    if (step->multipart_ok && datasize < step->datasize) {
+       if (eoa)
+           EXPECT_FAILURE("step %d: file %d attribute %d: early EOA in multipart attribute",
+                           state->curstep, (int)filenum, (int)attrid);
+
+       if (memcmp(data, step->data, datasize)) {
+           EXPECT_FAILURE("step %d: attribute's data does not match",
+                           state->curstep);
+       }
+       step->data += datasize;
+       step->datasize -= datasize;
+       return TRUE;
+    }
+
+    if (step->eoa && !eoa)
+       EXPECT_FAILURE("step %d: file %d attribute %d: expected EOA did not appear",
+                       state->curstep, (int)filenum, (int)attrid);
+
+    if (!step->eoa && eoa)
+       EXPECT_FAILURE("step %d: file %d attribute %d: unexpected EOA",
+                       state->curstep, (int)filenum, (int)attrid);
+
+    if (!step->truncated && truncated)
+       EXPECT_FAILURE("step %d: file %d attribute %d was unexpectedly truncated",
+                       state->curstep, (int)filenum, (int)attrid);
+
+    if (step->truncated && !truncated)
+       EXPECT_FAILURE("step %d: file %d attribute %d was unexpectedly not truncated",
+                       state->curstep, (int)filenum, (int)attrid);
+
+    if (datasize != step->datasize)
+       EXPECT_FAILURE("step %d: file %d attribute %d lengths do not match: "
+                      "got %zd, expected %zd",
+                       state->curstep, (int)filenum, (int)attrid,
+                       datasize, step->datasize);
+
+    if (memcmp(data, step->data, datasize)) {
+       if (step->isstr) {
+           EXPECT_FAILURE("step %d: attribute's data does not match: got '%*s', expected '%*s'",
+                           state->curstep, (int)datasize, (char *)data,
+                           (int)step->datasize, (char *)step->data);
+       } else {
+           EXPECT_FAILURE("step %d: attribute's data does not match",
+                           state->curstep);
+       }
+    }
+
+    state->curstep++;
+
+    return TRUE;
+}
+
+/****
+ * Utilities
+ */
+
+static int
+open_temp(gboolean write)
+{
+    int fd = open(temp_filename, write? O_WRONLY|O_CREAT|O_TRUNC : O_RDONLY, 0777);
+    if (fd < 0) {
+       perror("open temporary file");
+       exit(1);
+    }
+
+    return fd;
+}
+
+static void
+check_gerror_(
+    gboolean ok,
+    GError *error,
+    const char *fn)
+{
+    if (ok && !error)
+       return;
+
+    if (ok)
+       EXPECT_FAILURE(
+               "'%s' set 'error' but did not indicate an error condition: %s (%s)\n",
+               fn, error->message, strerror(error->code));
+    else if (!error)
+       EXPECT_FAILURE(
+               "'%s' indicated an error condition but did not set 'error'.\n", fn);
+    else
+       EXPECT_FAILURE(
+               "'%s' error: %s (%s)\n", fn, error->message, strerror(error->code));
+
+    exit(1);
+}
+
+#define check_gerror(ok, error, fn) check_gerror_((ok)!=0, (error), (fn))
+
+static void
+check_gerror_matches_(
+    gboolean ok,
+    GError *error,
+    const char *matches,
+    const char *fn)
+{
+    if (!ok && error) {
+       if (0 != strcmp(matches, error->message)) {
+           EXPECT_FAILURE(
+                   "%s produced error '%s' but expected '%s'\n",
+                   fn, error->message, matches);
+           exit(1);
+       }
+       return;
+    }
+
+    if (ok)
+       EXPECT_FAILURE(
+               "'%s' correctly set 'error' but did not indicate an error condition: %s (%s)\n",
+               fn, error->message, strerror(error->code));
+    else /* (!error) */
+       EXPECT_FAILURE(
+               "'%s' correctly indicated an error condition but did not set 'error'.\n", fn);
+
+    exit(1);
+}
+
+#define check_gerror_matches(ok, error, match, fn) \
+    check_gerror_matches_((ok)!=0, (error), (match), (fn))
+
+static void
+try_reading_fd(
+       expected_step_t *steps,
+       amar_attr_handling_t *handling,
+        int fd)
+{
+    amar_t *ar;
+    expected_state_t state = { steps, 0 };
+    GError *error = NULL;
+    gboolean ok;
+
+    ar = amar_new(fd, O_RDONLY, &error);
+    check_gerror(ar, error, "amar_new");
+    ok = amar_read(ar, &state, handling, file_start_cb, file_finish_cb, &error);
+    if (ok || error)
+       check_gerror(ok, error, "amar_read");
+    if (steps[state.curstep].kind != EXP_END)
+       EXPECT_FAILURE("Stopped reading early at step %d", state.curstep);
+    ok = amar_close(ar, &error);
+    check_gerror(ok, error, "amar_close");
+}
+
+static void
+try_reading(
+       expected_step_t *steps,
+       amar_attr_handling_t *handling)
+{
+    int fd;
+
+    fd = open_temp(0);
+    try_reading_fd(steps, handling, fd);
+    close(fd);
+}
+
+static void
+try_reading_with_error(
+       expected_step_t *steps,
+       amar_attr_handling_t *handling,
+       const char *message)
+{
+    amar_t *ar;
+    expected_state_t state = { steps, 0 };
+    int fd;
+    GError *error = NULL;
+    gboolean ok;
+
+    fd = open_temp(0);
+    ar = amar_new(fd, O_RDONLY, &error);
+    check_gerror(ar, error, "amar_new");
+    ok = amar_read(ar, &state, handling, file_start_cb, file_finish_cb, &error);
+    check_gerror_matches(ok, error, message, "amar_read");
+    amar_close(ar, NULL);
+    close(fd);
+}
+
+/****
+ * Test various valid inputs
+ */
+
+static int
+test_simple_read(void)
+{
+    int fd;
+
+    fd = open_temp(1);
+    WRITE_HEADER(fd, 1);
+    WRITE_RECORD_STR(fd, 1, AMAR_ATTR_FILENAME, 1, "/first/filename");
+    WRITE_RECORD_STR(fd, 1, 18, 1, "eighteen");
+    WRITE_HEADER(fd, 1);
+    WRITE_RECORD_STR(fd, 1, 19, 0, "nine");
+    WRITE_RECORD_STR(fd, 1, 20, 0, "twen");
+    WRITE_RECORD_STR(fd, 1, 19, 1, "teen");
+    WRITE_RECORD_STR(fd, 1, 20, 1, "ty");
+    WRITE_RECORD_STR(fd, 1, AMAR_ATTR_EOF, 1, "");
+    close(fd);
+
+    {
+       amar_attr_handling_t handling[] = {
+           { 19, 256, frag_cb, NULL }, /* reassemble this attribute */
+           { 20, 0, frag_cb, NULL }, /* but pass along each fragment of this */
+           { 0, 256, frag_cb, NULL },
+       };
+       expected_step_t steps[] = {
+           EXPECT_START_FILE_STR(1, "/first/filename", 0),
+           EXPECT_ATTR_DATA_STR(1, 18, "eighteen", 1, 0),
+           EXPECT_ATTR_DATA_STR(1, 20, "twen", 0, 0),
+           EXPECT_ATTR_DATA_STR(1, 19, "nineteen", 1, 0),
+           EXPECT_ATTR_DATA_STR(1, 20, "ty", 1, 0),
+           EXPECT_FINISH_FILE(1, 0),
+           EXPECT_END(),
+       };
+       try_reading(steps, handling);
+    }
+
+    return 1;
+}
+
+static int
+test_read_buffering(void)
+{
+    int fd;
+
+    fd = open_temp(1);
+    WRITE_HEADER(fd, 1);
+    WRITE_RECORD_STR(fd, 1, AMAR_ATTR_FILENAME, 1, "file1");
+    WRITE_HEADER(fd, 1);
+    WRITE_RECORD_STR(fd, 2, AMAR_ATTR_FILENAME, 1, "file2");
+    WRITE_RECORD_STR(fd, 2, 19, 0, "1"); /* one byte at a time, for 12 bytes */
+    WRITE_RECORD_STR(fd, 2, 19, 0, "9");
+    WRITE_RECORD_STR(fd, 2, 21, 1, "012345678901234567890123456789"); /* thirty bytes exactly */
+    WRITE_RECORD_STR(fd, 2, 19, 0, "1");
+    WRITE_RECORD_STR(fd, 1, 18, 0, "ATTR");
+    WRITE_RECORD_STR(fd, 2, 19, 0, "9");
+    WRITE_RECORD_STR(fd, 2, 19, 0, "1");
+    WRITE_RECORD_STR(fd, 2, 19, 0, "9");
+    WRITE_HEADER(fd, 1);
+    WRITE_RECORD_STR(fd, 1, 20, 0, "TWENTYTWE"); /* nine bytes, then three in the next frag */
+    WRITE_RECORD_STR(fd, 2, 19, 0, "1");
+    WRITE_RECORD_STR(fd, 1, 20, 1, "NTY");
+    WRITE_RECORD_STR(fd, 2, 19, 0, "9");
+    WRITE_RECORD_STR(fd, 1, 18, 0, "181818"); /* hit ten bytes exactly */
+    WRITE_RECORD_STR(fd, 2, 19, 0, "1");
+    WRITE_RECORD_STR(fd, 2, 19, 0, "9");
+    WRITE_RECORD_STR(fd, 1, 18, 0, "ATTR");
+    WRITE_RECORD_STR(fd, 1, 22, 0, "012345678"); /* nine bytes followed by 20 */
+    WRITE_RECORD_STR(fd, 1, 18, 1, "18");
+    WRITE_RECORD_STR(fd, 1, 22, 1, "01234567890123456789");
+    WRITE_RECORD_STR(fd, 2, 19, 0, "1");
+    WRITE_RECORD_STR(fd, 1, AMAR_ATTR_EOF, 1, "");
+    WRITE_RECORD_STR(fd, 2, 19, 1, "9");
+    WRITE_RECORD_STR(fd, 2, AMAR_ATTR_EOF, 1, "");
+
+    close(fd);
+
+    {
+       amar_attr_handling_t handling[] = {
+           { 0, 10, frag_cb, NULL },   /* reassemble all fragments in 10-byte chunks */
+       };
+       expected_step_t steps[] = {
+           EXPECT_START_FILE_STR(1, "file1", 0),
+           EXPECT_START_FILE_STR(2, "file2", 0),
+           EXPECT_ATTR_DATA_STR(2, 21, "012345678901234567890123456789", 1, 0),
+           EXPECT_ATTR_DATA_STR(1, 20, "TWENTYTWENTY", 1, 0),
+           EXPECT_ATTR_DATA_STR(1, 18, "ATTR181818", 0, 0),
+           EXPECT_ATTR_DATA_STR(2, 19, "1919191919", 0, 0),
+           EXPECT_ATTR_DATA_STR(1, 18, "ATTR18", 1, 0),
+           EXPECT_ATTR_DATA_STR(1, 22, "01234567801234567890123456789", 1, 0),
+           EXPECT_FINISH_FILE(1, 0),
+           EXPECT_ATTR_DATA_STR(2, 19, "19", 1, 0),
+           EXPECT_FINISH_FILE(2, 0),
+           EXPECT_END(),
+       };
+       try_reading(steps, handling);
+    }
+
+    return 1;
+}
+
+static int
+test_missing_eoa(void)
+{
+    int fd;
+
+    fd = open_temp(1);
+    WRITE_HEADER(fd, 1);
+    WRITE_RECORD_STR(fd, 1, AMAR_ATTR_FILENAME, 1, "file1");
+    WRITE_RECORD_STR(fd, 1, 21, 0, "attribu"); /* note no EOA */
+    WRITE_RECORD_STR(fd, 1, AMAR_ATTR_EOF, 1, "");
+
+    close(fd);
+
+    {
+       amar_attr_handling_t handling[] = {
+           { 0, 1024, frag_cb, NULL },
+       };
+       expected_step_t steps[] = {
+           EXPECT_START_FILE_STR(1, "file1", 0),
+           EXPECT_ATTR_DATA_STR(1, 21, "attribu", 1, 1),
+           EXPECT_FINISH_FILE(1, 0),
+           EXPECT_END(),
+       };
+       try_reading(steps, handling);
+    }
+
+    return 1;
+}
+
+static int
+test_ignore(void)
+{
+    int fd;
+
+    fd = open_temp(1);
+    WRITE_HEADER(fd, 1);
+    WRITE_RECORD_STR(fd, 1, AMAR_ATTR_FILENAME, 1, "file1");
+    WRITE_HEADER(fd, 1);
+    WRITE_RECORD_STR(fd, 2, AMAR_ATTR_FILENAME, 1, "file2");
+    WRITE_RECORD_STR(fd, 2, 20, 1, "attr20");
+    WRITE_RECORD_STR(fd, 1, 21, 0, "attr");
+    WRITE_RECORD_STR(fd, 1, 21, 1, "21");
+    WRITE_HEADER(fd, 1);
+    WRITE_RECORD_STR(fd, 3, AMAR_ATTR_FILENAME, 1, "file3");
+    WRITE_HEADER(fd, 1);
+    WRITE_RECORD_STR(fd, 4, AMAR_ATTR_FILENAME, 1, "file4");
+    WRITE_RECORD_STR(fd, 3, 22, 1, "attr22");
+    WRITE_RECORD_STR(fd, 4, 23, 1, "attr23");
+    WRITE_RECORD_STR(fd, 4, AMAR_ATTR_EOF, 1, "");
+    WRITE_RECORD_STR(fd, 3, AMAR_ATTR_EOF, 1, "");
+    WRITE_RECORD_STR(fd, 2, AMAR_ATTR_EOF, 1, "");
+    WRITE_RECORD_STR(fd, 1, AMAR_ATTR_EOF, 1, "");
+
+    close(fd);
+
+    {
+       amar_attr_handling_t handling[] = {
+           { 0, 10, frag_cb, NULL },   /* reassemble all fragments in 10-byte chunks */
+       };
+       expected_step_t steps[] = {
+           EXPECT_START_FILE_STR(1, "file1", 1),
+           EXPECT_START_FILE_STR(2, "file2", 0),
+           EXPECT_ATTR_DATA_STR(2, 20, "attr20", 1, 0),
+           EXPECT_START_FILE_STR(3, "file3", 1),
+           EXPECT_START_FILE_STR(4, "file4", 0),
+           EXPECT_ATTR_DATA_STR(4, 23, "attr23", 1, 0),
+           EXPECT_FINISH_FILE(4, 0),
+           EXPECT_FINISH_FILE(2, 0),
+           EXPECT_END(),
+       };
+       try_reading(steps, handling);
+    }
+
+    return 1;
+}
+
+static int
+test_missing_eof(void)
+{
+    int fd;
+
+    fd = open_temp(1);
+    WRITE_HEADER(fd, 1);
+    WRITE_RECORD_STR(fd, 1, AMAR_ATTR_FILENAME, 1, "file!");
+    WRITE_RECORD_STR(fd, 1, 20, 1, "attribute");
+    WRITE_RECORD_STR(fd, 1, 21, 0, "attribu"); /* note no EOA */
+
+    close(fd);
+
+    {
+       amar_attr_handling_t handling[] = {
+           { 0, 1024, frag_cb, NULL },
+       };
+       expected_step_t steps[] = {
+           EXPECT_START_FILE_STR(1, "file!", 0),
+           EXPECT_ATTR_DATA_STR(1, 20, "attribute", 1, 0),
+           EXPECT_ATTR_DATA_STR(1, 21, "attribu", 1, 1),
+           EXPECT_FINISH_FILE(1, 0),
+           EXPECT_END(),
+       };
+       try_reading(steps, handling);
+    }
+
+    return 1;
+}
+
+static int
+test_extra_records(void)
+{
+    int fd;
+
+    fd = open_temp(1);
+    WRITE_HEADER(fd, 1);
+    WRITE_RECORD_STR(fd, 4, AMAR_ATTR_EOF, 1, "");
+    WRITE_RECORD_STR(fd, 5, 20, 1, "old attribute");
+    WRITE_RECORD_STR(fd, 6, AMAR_ATTR_FILENAME, 1, "file!");
+    WRITE_RECORD_STR(fd, 6, 21, 0, "attribu"); /* note no EOA */
+    WRITE_RECORD_STR(fd, 5, AMAR_ATTR_EOF, 1, "");
+    WRITE_RECORD_STR(fd, 6, 21, 1, "te");
+    WRITE_RECORD_STR(fd, 6, AMAR_ATTR_EOF, 1, "");
+    close(fd);
+
+    {
+       amar_attr_handling_t handling[] = {
+           { 0, 1024, frag_cb, NULL },
+       };
+       expected_step_t steps[] = {
+           EXPECT_START_FILE_STR(6, "file!", 0),
+           EXPECT_ATTR_DATA_STR(6, 21, "attribute", 1, 0),
+           EXPECT_FINISH_FILE(6, 0),
+           EXPECT_END(),
+       };
+       try_reading(steps, handling);
+    }
+
+    return 1;
+}
+
+static gboolean
+early_exit_frag_cb(
+       gpointer user_data G_GNUC_UNUSED,
+       uint16_t filenum G_GNUC_UNUSED,
+       gpointer file_data G_GNUC_UNUSED,
+       uint16_t attrid G_GNUC_UNUSED,
+       gpointer attrid_data G_GNUC_UNUSED,
+       gpointer *attr_data G_GNUC_UNUSED,
+       gpointer data G_GNUC_UNUSED,
+       gsize datasize G_GNUC_UNUSED,
+       gboolean eoa G_GNUC_UNUSED,
+       gboolean truncated G_GNUC_UNUSED)
+{
+    return FALSE;
+}
+
+static int
+test_early_exit(void)
+{
+    int fd;
+
+    fd = open_temp(1);
+    WRITE_HEADER(fd, 1);
+    WRITE_RECORD_STR(fd, 6, AMAR_ATTR_FILENAME, 1, "file!");
+    WRITE_RECORD_STR(fd, 6, 21, 1, "attribu");
+    WRITE_RECORD_STR(fd, 6, AMAR_ATTR_EOF, 1, "");
+    close(fd);
+
+    {
+       amar_attr_handling_t handling[] = {
+           { 0, 0, early_exit_frag_cb, NULL },
+       };
+       expected_step_t steps[] = {
+           EXPECT_START_FILE_STR(6, "file!", 0),
+           EXPECT_FINISH_FILE(6, 1),
+           EXPECT_END(),
+       };
+       try_reading(steps, handling);
+    }
+
+    return 1;
+}
+
+/****
+ * Test the write side, using round trips.
+ */
+
+/* just try to execute most of the writing code */
+static int
+test_writing_coverage(void)
+{
+    int fd, fd2;
+    off_t posn, fdsize;
+    char buf[16300];
+    char buf2[16300];
+    char *bigbuf;
+    size_t bigbuf_size = 1024*50+93;
+    simpleprng_state_t prng;
+    gsize i;
+    guint16 attrid = 20;
+    amar_t *arch = NULL;
+    amar_file_t *af = NULL, *af2 = NULL;
+    amar_attr_t *at = NULL, *at2 = NULL;
+    GError *error = NULL;
+    gboolean ok;
+
+    /* set up some data buffers */
+    for (i = 0; i < sizeof(buf); i++) {
+       buf[i] = 0xfe;
+       buf2[i] = 0xaa;
+    }
+
+    bigbuf = g_malloc(bigbuf_size);
+    simpleprng_seed(&prng, 0xfeaa);
+    simpleprng_fill_buffer(&prng, bigbuf, bigbuf_size);
+
+    fd = open("amar-test.big", O_CREAT|O_WRONLY|O_TRUNC, 0777);
+    g_assert(fd >= 0);
+    g_assert(full_write(fd, bigbuf, bigbuf_size) == bigbuf_size);
+    close(fd);
+
+    fd = open_temp(1);
+
+    arch = amar_new(fd, O_WRONLY, &error);
+    check_gerror(arch, error, "amar_new");
+    g_assert(arch != NULL);
+
+    af = amar_new_file(arch, "MyFile", 0, &posn, &error);
+    check_gerror(af, error, "amar_new_file");
+    tu_dbg("MyFile starts at 0x%x\n", (int)posn)
+    g_assert(af != NULL);
+
+    /* by character with EOA */
+    at = amar_new_attr(af, attrid++, &error);
+    check_gerror(at, error, "amar_new_attr");
+    g_assert(at != NULL);
+    ok = amar_attr_add_data_buffer(at, buf, sizeof(buf), 1, &error);
+    check_gerror(ok, error, "amar_attr_add_data_buffer");
+    ok = amar_attr_close(at, &error);
+    check_gerror(ok, error, "amar_attr_close");
+
+    /* by character without EOA */
+    at = amar_new_attr(af, attrid++, &error);
+    check_gerror(at, error, "amar_new_attr");
+    g_assert(at != NULL);
+    ok = amar_attr_add_data_buffer(at, buf2, sizeof(buf2), 0, &error);
+    check_gerror(ok, error, "amar_attr_add_data_buffer");
+    ok = amar_attr_close(at, &error);
+    check_gerror(ok, error, "amar_attr_close");
+
+    /* open up a new file, for fun */
+    af2 = amar_new_file(arch, "MyOtherFile", 0, &posn, &error);
+    check_gerror(af2, error, "amar_new_file");
+    tu_dbg("MyOtherFile starts at 0x%x\n", (int)posn)
+
+    /* by file descriptor, to the first file */
+    at = amar_new_attr(af, attrid++, &error);
+    check_gerror(at, error, "amar_new_attr");
+    fd2 = open("amar-test.big", O_RDONLY);
+    g_assert(fd2 >= 0);
+    fdsize = amar_attr_add_data_fd(at, fd2, 0, &error);
+    check_gerror(fdsize != -1, error, "amar_attr_add_data_fd");
+    g_assert(fdsize > 0);
+    close(fd2);
+    unlink("amar-test.big");
+    ok = amar_attr_close(at, &error);
+    check_gerror(ok, error, "amar_attr_close");
+
+    ok = amar_file_close(af, &error);
+    check_gerror(ok, error, "amar_file_close");
+
+    /* interlaeave two attributes */
+    at = amar_new_attr(af2, attrid++, &error);
+    check_gerror(at, error, "amar_new_attr");
+    at2 = amar_new_attr(af2, attrid++, &error);
+    check_gerror(at2, error, "amar_new_attr");
+    ok = amar_attr_add_data_buffer(at, buf, 72, 0, &error);
+    check_gerror(ok, error, "amar_attr_add_data_buffer");
+    ok = amar_attr_add_data_buffer(at2, buf2, 72, 0, &error);
+    check_gerror(ok, error, "amar_attr_add_data_buffer");
+    ok = amar_attr_add_data_buffer(at, buf, 13, 0, &error);
+    check_gerror(ok, error, "amar_attr_add_data_buffer");
+    ok = amar_attr_add_data_buffer(at2, buf2, 13, 1, &error);
+    check_gerror(ok, error, "amar_attr_add_data_buffer");
+    ok = amar_attr_close(at, &error);
+    check_gerror(ok, error, "amar_attr_close");
+    ok = amar_attr_close(at2, &error);
+    check_gerror(ok, error, "amar_attr_close");
+
+    ok = amar_file_close(af2, &error);
+    check_gerror(ok, error, "amar_file_close");
+
+    ok = amar_close(arch, &error);
+    check_gerror(ok, error, "amar_close");
+    close(fd);
+
+    {
+       amar_attr_handling_t handling[] = {
+           { 22, bigbuf_size+1, frag_cb, NULL }, /* buffer the big attr */
+           { 0, 0, frag_cb, NULL },    /* don't buffer other records */
+       };
+       expected_step_t steps[] = {
+           EXPECT_START_FILE_STR(1, "MyFile", 0),
+           EXPECT_ATTR_DATA_MULTIPART(1, 20, buf, sizeof(buf), 1, 0),
+           EXPECT_ATTR_DATA_MULTIPART(1, 21, buf2, sizeof(buf2), 0, 0),
+           EXPECT_ATTR_DATA_MULTIPART(1, 21, buf2, 0, 1, 0), /* trailing EOA */
+           EXPECT_START_FILE_STR(2, "MyOtherFile", 0),
+           EXPECT_ATTR_DATA(1, 22, bigbuf, bigbuf_size, 1, 0),
+           EXPECT_FINISH_FILE(1, 0),
+           EXPECT_ATTR_DATA_MULTIPART(2, 23, buf, 72, 0, 0),
+           EXPECT_ATTR_DATA_MULTIPART(2, 24, buf2, 72, 0, 0),
+           EXPECT_ATTR_DATA_MULTIPART(2, 23, buf+72, 13, 0, 0),
+           EXPECT_ATTR_DATA_MULTIPART(2, 24, buf2+72, 13, 1, 0),
+           EXPECT_ATTR_DATA_MULTIPART(2, 23, buf, 0, 1, 0),
+           EXPECT_FINISH_FILE(2, 0),
+           EXPECT_END(),
+       };
+       try_reading(steps, handling);
+    }
+
+    return 1;
+}
+
+/* test big attributes */
+static int
+test_big_attr(void)
+{
+    int fd, fd2;
+    off_t fdsize;
+    char *bigbuf;
+    const size_t max_record_data_size = 4*1024*1024;
+    size_t bigbuf_size = max_record_data_size + 1274; /* a record and a bit */
+    simpleprng_state_t prng;
+    guint16 attrid = 20;
+    amar_t *arch = NULL;
+    amar_file_t *af = NULL;
+    amar_attr_t *at = NULL;
+    GError *error = NULL;
+    gboolean ok;
+
+    /* set up some data buffers */
+    bigbuf = g_malloc(bigbuf_size);
+    simpleprng_seed(&prng, 0xb001);
+    simpleprng_fill_buffer(&prng, bigbuf, bigbuf_size);
+
+    fd = open("amar-test.big", O_CREAT|O_WRONLY|O_TRUNC, 0777);
+    g_assert(fd >= 0);
+    g_assert(full_write(fd, bigbuf, bigbuf_size) == bigbuf_size);
+    close(fd);
+
+    fd = open_temp(1);
+
+    arch = amar_new(fd, O_WRONLY, &error);
+    check_gerror(arch, error, "amar_new");
+
+    af = amar_new_file(arch, "bigstuff", 0, NULL, &error);
+    check_gerror(af, error, "amar_new_file");
+
+    /* by character */
+    at = amar_new_attr(af, attrid++, &error);
+    check_gerror(at, error, "amar_new_attr");
+    ok = amar_attr_add_data_buffer(at, bigbuf, bigbuf_size, 1, &error);
+    check_gerror(ok, error, "amar_attr_add_data_buffer");
+    ok = amar_attr_close(at, &error);
+    check_gerror(ok, error, "amar_attr_close");
+
+    /* by file descriptor */
+    at = amar_new_attr(af, attrid++, &error);
+    check_gerror(at, error, "amar_new_attr");
+    fd2 = open("amar-test.big", O_RDONLY);
+    g_assert(fd2 >= 0);
+    fdsize = amar_attr_add_data_fd(at, fd2, 1, &error);
+    check_gerror(fdsize != -1, error, "amar_attr_add_data_fd");
+    g_assert(fdsize > 0);
+    close(fd2);
+    unlink("amar-test.big");
+    ok = amar_attr_close(at, &error);
+    check_gerror(ok, error, "amar_attr_close");
+
+    ok = amar_file_close(af, &error);
+    check_gerror(ok, error, "amar_file_close");
+
+    ok = amar_close(arch, &error);
+    check_gerror(ok, error, "amar_close");
+    close(fd);
+
+    {
+       amar_attr_handling_t handling[] = {
+           { 0, 0, frag_cb, NULL },    /* don't buffer records */
+       };
+       expected_step_t steps[] = {
+           EXPECT_START_FILE_STR(1, "bigstuff", 0),
+           EXPECT_ATTR_DATA_MULTIPART(1, 20, bigbuf, max_record_data_size, 0, 0),
+           EXPECT_ATTR_DATA_MULTIPART(1, 20, bigbuf+max_record_data_size, bigbuf_size-max_record_data_size, 1, 0),
+           EXPECT_ATTR_DATA_MULTIPART(1, 21, bigbuf, max_record_data_size, 0, 0),
+           EXPECT_ATTR_DATA_MULTIPART(1, 21, bigbuf+max_record_data_size, bigbuf_size-max_record_data_size, 1, 0),
+           EXPECT_FINISH_FILE(1, 0),
+           EXPECT_END(),
+       };
+       try_reading(steps, handling);
+    }
+
+    return 1;
+}
+
+/* like test_big_attr, but using a pipe and ignoring one of the attrs in hopes
+ * of triggering an lseek(), which will fail on a pipe. */
+static int
+test_pipe(void)
+{
+    int fd;
+    int p[2];
+    off_t fdsize;
+    char *bigbuf;
+    const size_t max_record_data_size = 4*1024*1024;
+    size_t bigbuf_size = max_record_data_size + 1274; /* a record and a bit */
+    simpleprng_state_t prng;
+    guint16 attrid = 20;
+    amar_t *arch = NULL;
+    amar_file_t *af = NULL;
+    amar_attr_t *at = NULL;
+    GError *error = NULL;
+    gboolean ok;
+
+    /* set up some data buffers */
+    bigbuf = g_malloc(bigbuf_size);
+    simpleprng_seed(&prng, 0xb001);
+    simpleprng_fill_buffer(&prng, bigbuf, bigbuf_size);
+
+    fd = open("amar-test.big", O_CREAT|O_WRONLY|O_TRUNC, 0777);
+    g_assert(fd >= 0);
+    g_assert(full_write(fd, bigbuf, bigbuf_size) == bigbuf_size);
+    close(fd);
+
+    g_assert(pipe(p) >= 0);
+
+    switch (fork()) {
+       case 0: /* child */
+           close(p[0]);
+           arch = amar_new(p[1], O_WRONLY, &error);
+           check_gerror(arch, error, "amar_new");
+           g_assert(arch != NULL);
+
+           af = amar_new_file(arch, "bigstuff", 0, NULL, &error);
+           check_gerror(af, error, "amar_new_file");
+
+           /* by character */
+           at = amar_new_attr(af, attrid++, &error);
+           check_gerror(at, error, "amar_new_attr");
+           ok = amar_attr_add_data_buffer(at, bigbuf, bigbuf_size, 1, &error);
+           check_gerror(ok, error, "amar_attr_add_data_buffer");
+           ok = amar_attr_close(at, &error);
+           check_gerror(ok, error, "amar_attr_close");
+
+           /* by file descriptor */
+           at = amar_new_attr(af, attrid++, &error);
+           check_gerror(at, error, "amar_new_attr");
+           fd = open("amar-test.big", O_RDONLY);
+           g_assert(fd >= 0);
+           fdsize = amar_attr_add_data_fd(at, fd, 1, &error);
+           check_gerror(fdsize != -1, error, "amar_attr_add_data_fd");
+           g_assert(fdsize > 0);
+           close(fd);
+           unlink("amar-test.big");
+           ok = amar_attr_close(at, &error);
+           check_gerror(ok, error, "amar_attr_close");
+
+           ok = amar_file_close(af, &error);
+           check_gerror(ok, error, "amar_file_close");
+
+           ok = amar_close(arch, &error);
+           check_gerror(ok, error, "amar_close");
+           close(p[1]);
+           exit(0);
+
+       case -1:
+           perror("fork");
+           exit(1);
+
+       default: { /* parent */
+           amar_attr_handling_t handling[] = {
+               { 20, 0, NULL, NULL },          /* ignore attr 20 */
+               { 0, 0, frag_cb, NULL },        /* don't buffer records */
+           };
+           expected_step_t steps[] = {
+               EXPECT_START_FILE_STR(1, "bigstuff", 0),
+               EXPECT_ATTR_DATA_MULTIPART(1, 21, bigbuf, max_record_data_size, 0, 0),
+               EXPECT_ATTR_DATA_MULTIPART(1, 21, bigbuf+max_record_data_size, bigbuf_size-max_record_data_size, 1, 0),
+               EXPECT_FINISH_FILE(1, 0),
+               EXPECT_END(),
+           };
+            int status;
+           close(p[1]);
+           try_reading_fd(steps, handling, p[0]);
+           close(p[0]);
+            wait(&status);
+            if(WIFSIGNALED(status)) {
+                printf("child was terminated by signal %d\n", WTERMSIG(status));
+                exit(1);
+            }
+       }
+    }
+
+    return 1;
+}
+
+/****
+ * Invalid inputs - test error returns
+ */
+
+static int
+test_no_header(void)
+{
+    int fd;
+
+    fd = open_temp(1);
+    WRITE_RECORD_STR(fd, 1, AMAR_ATTR_FILENAME, 1, "/first/filename");
+    close(fd);
+
+    {
+       amar_attr_handling_t handling[] = {
+           { 0, 0, frag_cb, NULL },
+       };
+       expected_step_t steps[] = {
+           EXPECT_END(),
+       };
+       try_reading_with_error(steps, handling,
+                   "Archive read does not begin at a header record");
+    }
+
+    return 1;
+}
+
+static int
+test_invalid_eof(void)
+{
+    int fd;
+
+    fd = open_temp(1);
+    WRITE_HEADER(fd, 1);
+    WRITE_RECORD_STR(fd, 1, AMAR_ATTR_FILENAME, 1, "hi");
+    WRITE_RECORD_STR(fd, 1, AMAR_ATTR_EOF, 1, "abc");
+    close(fd);
+
+    {
+       amar_attr_handling_t handling[] = {
+           { 0, 0, frag_cb, NULL },
+       };
+       expected_step_t steps[] = {
+           EXPECT_START_FILE_STR(1, "hi", 0),
+           EXPECT_END(),
+       };
+       try_reading_with_error(steps, handling,
+                   "Archive contains an EOF record with nonzero size");
+    }
+
+    return 1;
+}
+
+static int
+test_header_vers(void)
+{
+    int fd;
+    char hdr[32];
+
+    bzero(hdr, sizeof(hdr));
+    strcpy(hdr, "AMANDA ARCHIVE FORMAT 2");
+
+    fd = open_temp(1);
+    if (full_write(fd, hdr, sizeof(hdr)) < sizeof(hdr)) {
+       perror("full_write");
+       exit(1);
+    }
+    close(fd);
+
+    {
+       amar_attr_handling_t handling[] = {
+           { 0, 0, frag_cb, NULL },
+       };
+       expected_step_t steps[] = {
+           EXPECT_END(),
+       };
+       try_reading_with_error(steps, handling,
+                   "Archive version 2 is not supported");
+    }
+
+    return 1;
+}
+
+/****
+ * Driver
+ */
+
+int
+main(int argc, char **argv)
+{
+    int rv;
+    char *cwd = g_get_current_dir();
+    static TestUtilsTest tests[] = {
+       TU_TEST(test_simple_read, 10),
+       TU_TEST(test_read_buffering, 10),
+       TU_TEST(test_missing_eoa, 10),
+       TU_TEST(test_ignore, 10),
+       TU_TEST(test_missing_eof, 10),
+       TU_TEST(test_extra_records, 10),
+       TU_TEST(test_early_exit, 10),
+       TU_TEST(test_writing_coverage, 10),
+       TU_TEST(test_big_attr, 20),
+       TU_TEST(test_pipe, 20),
+       TU_TEST(test_no_header, 10),
+       TU_TEST(test_invalid_eof, 10),
+       TU_TEST(test_header_vers, 10),
+       TU_END()
+    };
+
+    temp_filename = vstralloc(cwd, "/amar-test.tmp", NULL);
+
+    rv = testutils_run_tests(argc, argv, tests);
+    unlink(temp_filename);
+    return rv;
+}
diff --git a/amar-src/amar.c b/amar-src/amar.c
new file mode 100644 (file)
index 0000000..a39854d
--- /dev/null
@@ -0,0 +1,1069 @@
+/*
+ * Copyright (c) Zmanda, Inc.  All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ *
+ * This 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 this library; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+ *
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+ */
+
+#include "amanda.h"
+#include "util.h"
+#include "amar.h"
+
+/* Each block in an archive is made up of one or more records, where each
+ * record is either a header record or a data record.  The two are
+ * distinguished by the header magic string; the string 'AM' is
+ * explicitly excluded as an allowed filenum to prevent ambiguity. */
+
+#define HEADER_MAGIC "AMANDA ARCHIVE FORMAT"
+#define MAGIC_FILENUM 0x414d
+#define HEADER_VERSION 1
+#define EOA_BIT 0x80000000
+
+typedef struct header_s {
+    /* magic is HEADER_MAGIC + ' ' + decimal version, NUL padded */
+    char     magic[28];
+} header_t;
+#define HEADER_SIZE (SIZEOF(header_t))
+
+typedef struct record_s {
+    uint16_t filenum;
+    uint16_t attrid;
+    uint32_t size;
+} record_t;
+#define RECORD_SIZE (SIZEOF(record_t))
+#define MAX_RECORD_DATA_SIZE (4*1024*1024)
+
+#define MKRECORD(ptr, f, a, s, eoa) do { \
+    record_t r; \
+    uint32_t size = s; \
+    if (eoa) size |= EOA_BIT; \
+    r.filenum = htons(f); \
+    r.attrid = htons(a); \
+    r.size = htonl(size); \
+    memcpy(ptr, &r, sizeof(record_t)); \
+} while(0)
+
+/* N.B. - f, a, s, and eoa must be simple lvalues */
+#define GETRECORD(ptr, f, a, s, eoa) do { \
+    record_t r; \
+    memcpy(&r, ptr, sizeof(record_t)); \
+    s = ntohl(r.size); \
+    if (s & EOA_BIT) { \
+       eoa = TRUE; \
+       s &= ~EOA_BIT; \
+    } else { \
+       eoa = FALSE; \
+    } \
+    f = ntohs(r.filenum); \
+    a = ntohs(r.attrid); \
+} while(0)
+
+/* performance knob: how much data will we buffer before just
+ * writing straight out of the user's buffers? */
+#define WRITE_BUFFER_SIZE (512*1024)
+
+struct amar_s {
+    int       fd;              /* file descriptor                      */
+    mode_t    mode;            /* mode O_RDONLY or O_WRONLY            */
+    uint16_t  maxfilenum;      /* Next file number to allocate         */
+    header_t  hdr;             /* pre-constructed header               */
+    off_t     position;                /* current position in the archive      */
+    GHashTable *files;         /* List of all amar_file_t      */
+    gboolean  seekable;                /* does lseek() work on this fd? */
+
+    /* internal buffer; on writing, this is WRITE_BUFFER_SIZE bytes, and
+     * always has at least RECORD_SIZE bytes free. */
+    gpointer buf;
+    size_t buf_len;
+    size_t buf_size;
+};
+
+struct amar_file_s {
+    amar_t *archive;           /* archive for this file        */
+    gint             filenum;          /* filenum of this file; gint is required by hash table */
+    GHashTable       *attributes;      /* all attributes for this file */
+};
+
+struct amar_attr_s {
+    amar_file_t *file; /* file for this attribute      */
+    gint attrid;       /* id of this attribute         */
+    gboolean wrote_eoa;        /* If the attribute is finished */
+};
+
+/*
+ * Internal functions
+ */
+
+GQuark
+amar_error_quark(void)
+{
+    static GQuark q;
+    if (!q)
+       q = g_quark_from_static_string("amar_error");
+    return q;
+}
+
+static gboolean
+flush_buffer(
+       amar_t *archive,
+       GError **error)
+{
+    if (archive->buf_len) {
+       if (full_write(archive->fd, archive->buf, archive->buf_len) != archive->buf_len) {
+           g_set_error(error, amar_error_quark(), errno,
+                       "Error writing to amanda archive: %s", strerror(errno));
+           return FALSE;
+       }
+       archive->buf_len = 0;
+    }
+
+    return TRUE;
+}
+
+static gboolean
+write_header(
+       amar_t *archive,
+       GError **error)
+{
+    /* if it won't fit in the buffer, take the easy way out and flush it */
+    if (archive->buf_len + HEADER_SIZE >= WRITE_BUFFER_SIZE - RECORD_SIZE) {
+       if (!flush_buffer(archive, error))
+           return FALSE;
+    }
+
+    memcpy(archive->buf + archive->buf_len, &archive->hdr, HEADER_SIZE);
+    archive->buf_len += HEADER_SIZE;
+    archive->position += HEADER_SIZE;
+
+    return TRUE;
+}
+
+static gboolean
+write_record(
+       amar_t *archive,
+       uint16_t filenum,
+       uint16_t attrid,
+       gboolean eoa,
+       gpointer data,
+       gsize data_size,
+       GError **error)
+{
+    /* the buffer always has room for a new record header */
+    MKRECORD(archive->buf + archive->buf_len, filenum, attrid, data_size, eoa);
+    archive->buf_len += RECORD_SIZE;
+
+    /* is it worth copying this record into the buffer? */
+    if (archive->buf_len + RECORD_SIZE + data_size < WRITE_BUFFER_SIZE - RECORD_SIZE) {
+       /* yes, it is */
+       if (data_size)
+           memcpy(archive->buf + archive->buf_len, data, data_size);
+       archive->buf_len += data_size;
+    } else {
+       /* no, it's not */
+       struct iovec iov[2];
+
+       /* flush the buffer and write the new data, all in one syscall */
+       iov[0].iov_base = archive->buf;
+       iov[0].iov_len = archive->buf_len;
+       iov[1].iov_base = data;
+       iov[1].iov_len = data_size;
+       if (full_writev(archive->fd, iov, 2) < 0) {
+           g_set_error(error, amar_error_quark(), errno,
+                       "Error writing to amanda archive: %s", strerror(errno));
+           return FALSE;
+       }
+       archive->buf_len = 0;
+    }
+
+    archive->position += data_size + RECORD_SIZE;
+    return TRUE;
+}
+
+/*
+ * Public functions
+ */
+
+amar_t *
+amar_new(
+    int       fd,
+    mode_t mode,
+    GError **error)
+{
+    amar_t *archive = malloc(SIZEOF(amar_t));
+
+    /* make some sanity checks first */
+    g_assert(fd >= 0);
+    g_assert(mode == O_RDONLY || mode == O_WRONLY);
+
+    archive->fd = fd;
+    archive->mode = mode;
+    archive->maxfilenum = 0;
+    archive->position = 0;
+    archive->seekable = TRUE; /* assume seekable until lseek() fails */
+    archive->files = g_hash_table_new(g_int_hash, g_int_equal);
+    archive->buf = NULL;
+
+    if (mode == O_WRONLY) {
+       archive->buf = g_malloc(WRITE_BUFFER_SIZE);
+       archive->buf_size = WRITE_BUFFER_SIZE;
+    }
+    archive->buf_len = 0;
+
+    if (mode == O_WRONLY) {
+       /* preformat a header with our version number */
+       bzero(archive->hdr.magic, HEADER_SIZE);
+       snprintf(archive->hdr.magic, HEADER_SIZE,
+           HEADER_MAGIC " %d", HEADER_VERSION);
+
+       /* and write it out to start the file */
+       if (!write_header(archive, error)) {
+           amar_close(archive, NULL); /* flushing buffer won't fail */
+           return NULL;
+       }
+    }
+
+    return archive;
+}
+
+gboolean
+amar_close(
+    amar_t *archive,
+    GError **error)
+{
+    gboolean success = TRUE;
+
+    /* verify all files are done */
+    g_assert(g_hash_table_size(archive->files) == 0);
+
+    if (!flush_buffer(archive, error))
+       success = FALSE;
+
+    g_hash_table_destroy(archive->files);
+    if (archive->buf) g_free(archive->buf);
+    amfree(archive);
+
+    return success;
+}
+
+/*
+ * Writing
+ */
+
+amar_file_t *
+amar_new_file(
+    amar_t *archive,
+    char *filename_buf,
+    gsize filename_len,
+    off_t *header_offset,
+    GError **error)
+{
+    amar_file_t *file = NULL;
+
+    g_assert(archive->mode == O_WRONLY);
+    g_assert(filename_buf != NULL);
+
+    /* set filename_len if it wasn't specified */
+    if (!filename_len)
+       filename_len = strlen(filename_buf);
+    g_assert(filename_len != 0);
+
+    if (filename_len > MAX_RECORD_DATA_SIZE) {
+       g_set_error(error, amar_error_quark(), ENOSPC,
+                   "filename is too long for an amanda archive");
+       return NULL;
+    }
+
+    /* pick a new, unused filenum */
+
+    if (g_hash_table_size(archive->files) == 65535) {
+       g_set_error(error, amar_error_quark(), ENOSPC,
+                   "No more file numbers available");
+       return NULL;
+    }
+
+    do {
+       gint filenum;
+
+       archive->maxfilenum++;
+
+       /* MAGIC_FILENUM can't be used because it matches the header record text */
+       if (archive->maxfilenum == MAGIC_FILENUM) {
+           continue;
+       }
+
+       /* see if this fileid is already in use */
+       filenum = archive->maxfilenum;
+       if (g_hash_table_lookup(archive->files, &filenum))
+           continue;
+
+    } while (0);
+
+    file = g_new0(amar_file_t, 1);
+    file->archive = archive;
+    file->filenum = archive->maxfilenum;
+    file->attributes = g_hash_table_new_full(g_int_hash, g_int_equal, NULL, g_free);
+    g_hash_table_insert(archive->files, &file->filenum, file);
+
+    /* record the current position and write a header there, if desired */
+    if (header_offset) {
+       *header_offset = archive->position;
+       if (!write_header(archive, error))
+           goto error_exit;
+    }
+
+    /* add a filename record */
+    if (!write_record(archive, file->filenum, AMAR_ATTR_FILENAME,
+                     1, filename_buf, filename_len, error))
+       goto error_exit;
+
+    return file;
+
+error_exit:
+    if (file) {
+       g_hash_table_remove(archive->files, &file->filenum);
+       g_hash_table_destroy(file->attributes);
+       g_free(file);
+    }
+    return NULL;
+}
+
+static void
+foreach_attr_close(
+       gpointer key G_GNUC_UNUSED,
+       gpointer value,
+       gpointer user_data)
+{
+    amar_attr_t *attr = value;
+    GError **error = user_data;
+
+    /* return immediately if we've already seen an error */
+    if (*error)
+       return;
+
+    if (!attr->wrote_eoa) {
+       amar_attr_close(attr, error);
+    }
+}
+
+gboolean
+amar_file_close(
+    amar_file_t *file,
+    GError **error)
+{
+    gboolean success = TRUE;
+    amar_t *archive = file->archive;
+
+    /* close all attributes that haven't already written EOA */
+    g_hash_table_foreach(file->attributes, foreach_attr_close, error);
+    if (*error)
+       success = FALSE;
+
+    /* write an EOF record */
+    if (success) {
+       if (!write_record(archive, file->filenum, AMAR_ATTR_EOF, 1,
+                         NULL, 0, error))
+           success = FALSE;
+    }
+
+    /* remove from archive->file list */
+    g_hash_table_remove(archive->files, &file->filenum);
+
+    /* clean up */
+    g_hash_table_destroy(file->attributes);
+    amfree(file);
+
+    return success;
+}
+
+amar_attr_t *
+amar_new_attr(
+    amar_file_t *file,
+    uint16_t attrid,
+    GError **error G_GNUC_UNUSED)
+{
+    amar_attr_t *attribute;
+    gint attrid_gint = attrid;
+
+    /* make sure this attrid isn't already present */
+    g_assert(attrid >= AMAR_ATTR_APP_START);
+    g_assert(g_hash_table_lookup(file->attributes, &attrid_gint) == NULL);
+
+    attribute = malloc(SIZEOF(amar_attr_t));
+    attribute->file = file;
+    attribute->attrid = attrid;
+    attribute->wrote_eoa = FALSE;
+    g_hash_table_replace(file->attributes, &attribute->attrid, attribute);
+
+    /* (note this function cannot currently return an error) */
+
+    return attribute;
+}
+
+gboolean
+amar_attr_close(
+    amar_attr_t *attribute,
+    GError **error)
+{
+    amar_file_t   *file    = attribute->file;
+    amar_t        *archive = file->archive;
+    gboolean rv = TRUE;
+
+    /* write an empty record with EOA_BIT set if we haven't ended
+     * this attribute already */
+    if (!attribute->wrote_eoa) {
+       if (!write_record(archive, file->filenum, attribute->attrid,
+                         1, NULL, 0, error))
+           rv = FALSE;
+       attribute->wrote_eoa = TRUE;
+    }
+
+    return rv;
+}
+
+gboolean
+amar_attr_add_data_buffer(
+    amar_attr_t *attribute,
+    gpointer data, gsize size,
+    gboolean eoa,
+    GError **error)
+{
+    amar_file_t *file = attribute->file;
+    amar_t *archive = file->archive;
+
+    g_assert(!attribute->wrote_eoa);
+
+    /* write records until we've consumed all of the buffer */
+    while (size) {
+       gsize rec_data_size;
+       gboolean rec_eoa = FALSE;
+
+       if (size > MAX_RECORD_DATA_SIZE) {
+           rec_data_size = MAX_RECORD_DATA_SIZE;
+       } else {
+           rec_data_size = size;
+           if (eoa)
+               rec_eoa = TRUE;
+       }
+
+       if (!write_record(archive, file->filenum, attribute->attrid,
+                         rec_eoa, data, rec_data_size, error))
+           return FALSE;
+
+       data += rec_data_size;
+       size -= rec_data_size;
+    }
+
+    if (eoa) {
+       attribute->wrote_eoa = TRUE;
+    }
+
+    return TRUE;
+}
+
+off_t
+amar_attr_add_data_fd(
+    amar_attr_t *attribute,
+    int fd,
+    gboolean eoa,
+    GError **error)
+{
+    amar_file_t   *file    = attribute->file;
+    amar_t        *archive = file->archive;
+    gssize size;
+    off_t filesize = 0;
+    gpointer buf = g_malloc(MAX_RECORD_DATA_SIZE);
+
+    g_assert(!attribute->wrote_eoa);
+
+    /* read and write until reaching EOF */
+    while ((size = full_read(fd, buf, MAX_RECORD_DATA_SIZE)) >= 0) {
+       if (!write_record(archive, file->filenum, attribute->attrid,
+                           eoa && (size < MAX_RECORD_DATA_SIZE), buf, size, error))
+           goto error_exit;
+
+       filesize += size;
+
+       if (size < MAX_RECORD_DATA_SIZE)
+           break;
+    }
+
+    if (size < 0) {
+       g_set_error(error, amar_error_quark(), errno,
+                   "Error reading from fd %d: %s", fd, strerror(errno));
+       goto error_exit;
+    }
+    g_free(buf);
+
+    attribute->wrote_eoa = eoa;
+
+    return filesize;
+
+error_exit:
+    g_free(buf);
+    return -1;
+}
+
+/*
+ * Reading
+ */
+
+/* Note that this implementation assumes that an archive will have a "small"
+ * number of open files at any time, and a limited number of attributes for
+ * each file. */
+
+typedef struct attr_state_s {
+    uint16_t attrid;
+    amar_attr_handling_t *handling;
+    gpointer buf;
+    gsize buf_len;
+    gsize buf_size;
+    gpointer attr_data;
+    gboolean wrote_eoa;
+} attr_state_t;
+
+typedef struct file_state_s {
+    uint16_t filenum;
+    gpointer file_data; /* user's data */
+    gboolean ignore;
+
+    GSList *attr_states;
+} file_state_t;
+
+typedef struct handling_params_s {
+    /* parameters from the user */
+    gpointer user_data;
+    amar_attr_handling_t *handling_array;
+    amar_file_start_callback_t file_start_cb;
+    amar_file_finish_callback_t file_finish_cb;
+
+    /* tracking for open files and attributes */
+    GSList *file_states;
+
+    /* read buffer */
+    gpointer buf;
+    gsize buf_size; /* allocated size */
+    gsize buf_len; /* number of active bytes .. */
+    gsize buf_offset; /* ..starting at buf + buf_offset */
+    gboolean got_eof;
+    gboolean just_lseeked; /* did we just call lseek? */
+} handling_params_t;
+
+/* buffer-handling macros and functions */
+
+/* Ensure that the archive buffer contains at least ATLEAST bytes.  Returns
+ * FALSE if that many bytes are not available due to EOF or another error. */
+static gboolean
+buf_atleast_(
+    amar_t *archive,
+    handling_params_t *hp,
+    gsize atleast)
+{
+    gsize to_read;
+    gsize bytes_read;
+
+    /* easy case of hp->buf_len >= atleast is taken care of by the macro, below */
+
+    if (hp->got_eof)
+       return FALSE;
+
+    /* If we just don't have space for this much data yet, then we'll have to reallocate
+     * the buffer */
+    if (hp->buf_size < atleast) {
+       if (hp->buf_offset == 0) {
+           hp->buf = g_realloc(hp->buf, atleast);
+       } else {
+           gpointer newbuf = g_malloc(atleast);
+           if (hp->buf) {
+               memcpy(newbuf, hp->buf+hp->buf_offset, hp->buf_len);
+               g_free(hp->buf);
+           }
+           hp->buf = newbuf;
+           hp->buf_offset = 0;
+       }
+       hp->buf_size = atleast;
+    }
+
+    /* if we have space in this buffer to satisfy the request, but not without moving
+     * the existing data around, then move the data around */
+    else if (hp->buf_size - hp->buf_offset < atleast) {
+       memmove(hp->buf, hp->buf+hp->buf_offset, hp->buf_len);
+       hp->buf_offset = 0;
+    }
+
+    /* as an optimization, if we just called lseek, then only read the requested
+     * bytes in case we're going to lseek again. */
+    if (hp->just_lseeked)
+       to_read = atleast - hp->buf_len;
+    else
+       to_read = hp->buf_size - hp->buf_offset - hp->buf_len;
+
+    bytes_read = full_read(archive->fd,
+                          hp->buf+hp->buf_offset+hp->buf_len,
+                          to_read);
+    if (bytes_read < to_read)
+       hp->got_eof = TRUE;
+    hp->just_lseeked = FALSE;
+
+    hp->buf_len += bytes_read;
+
+    return hp->buf_len >= atleast;
+}
+
+#define buf_atleast(archive, hp, atleast) \
+    (((hp)->buf_len >= (atleast))? TRUE : buf_atleast_((archive), (hp), (atleast)))
+
+/* Skip the buffer ahead by SKIPBYTES bytes.  This will discard data from the
+ * buffer, and may call lseek() if some of the skipped bytes have not yet been
+ * read.  Returns FALSE if the requisite bytes cannot be skipped due to EOF or
+ * another error. */
+static gboolean
+buf_skip_(
+    amar_t *archive,
+    handling_params_t *hp,
+    gsize skipbytes)
+{
+    /* easy case of buf_len > skipbytes is taken care of by the macro, below,
+     * so we know we're clearing out the entire buffer here */
+
+    skipbytes -= hp->buf_len;
+    hp->buf_len = 0;
+
+    hp->buf_offset = 0;
+
+retry:
+    if (archive->seekable) {
+       if (lseek(archive->fd, skipbytes, SEEK_CUR) < 0) {
+           /* did we fail because archive->fd is a pipe or something? */
+           if (errno == ESPIPE) {
+               archive->seekable = FALSE;
+               goto retry;
+           }
+           hp->got_eof = TRUE;
+           return FALSE;
+       }
+    } else {
+       while (skipbytes) {
+           gsize toread = MIN(skipbytes, hp->buf_size);
+           gsize bytes_read = full_read(archive->fd, hp->buf, toread);
+
+           if (bytes_read < toread) {
+               hp->got_eof = TRUE;
+               return FALSE;
+           }
+
+           skipbytes -= bytes_read;
+       }
+    }
+
+    return TRUE;
+}
+
+#define buf_skip(archive, hp, skipbytes) \
+    (((skipbytes) <= (hp)->buf_len) ? \
+       ((hp)->buf_len -= (skipbytes), \
+        (hp)->buf_offset += (skipbytes), \
+        TRUE) \
+      : buf_skip_((archive), (hp), (skipbytes)))
+
+/* Get a pointer to the current position in the buffer */
+#define buf_ptr(hp) ((hp)->buf + (hp)->buf_offset)
+
+/* Get the amount of data currently available in the buffer */
+#define buf_avail(hp) ((hp)->buf_len)
+
+static gboolean
+finish_attr(
+    handling_params_t *hp,
+    file_state_t *fs,
+    attr_state_t *as,
+    gboolean truncated)
+{
+    gboolean success = TRUE;
+    if (!as->wrote_eoa && as->handling && as->handling->callback) {
+       success = as->handling->callback(hp->user_data, fs->filenum,
+                       fs->file_data, as->attrid, as->handling->attrid_data,
+                       &as->attr_data, as->buf, as->buf_len, TRUE, truncated);
+    }
+    amfree(as->buf);
+    amfree(as);
+
+    return success;
+}
+
+static gboolean
+finish_file(
+    handling_params_t *hp,
+    file_state_t *fs,
+    gboolean truncated)
+{
+    GSList *iter;
+    gboolean success = TRUE;
+
+    /* free up any attributes not yet ended */
+    for (iter = fs->attr_states; iter; iter = iter->next) {
+       attr_state_t *as = (attr_state_t *)iter->data;
+       success = success && finish_attr(hp, fs, as, TRUE);
+    }
+    g_slist_free(fs->attr_states);
+    fs->attr_states = NULL;
+
+    if (hp->file_finish_cb && !fs->ignore)
+       success = success && hp->file_finish_cb(hp->user_data, fs->filenum, &fs->file_data, truncated);
+
+    amfree(fs);
+    return success;
+}
+
+/* buffer the data and/or call the callback for this attribute */
+static gboolean
+handle_hunk(
+    handling_params_t *hp,
+    file_state_t *fs,
+    attr_state_t *as,
+    amar_attr_handling_t *hdl,
+    gpointer buf,
+    gsize len,
+    gboolean eoa)
+{
+    gboolean success = TRUE;
+
+    /* capture any conditions where we don't have to copy into the buffer */
+    if (hdl->min_size == 0 || (as->buf_len == 0 && len >= hdl->min_size)) {
+       success = success && hdl->callback(hp->user_data, fs->filenum,
+               fs->file_data, as->attrid, hdl->attrid_data, &as->attr_data,
+               buf, len, eoa, FALSE);
+       as->wrote_eoa = eoa;
+    } else {
+       /* ok, copy into the buffer */
+       if (as->buf_len + len > as->buf_size) {
+           gpointer newbuf = g_malloc(as->buf_len + len);
+           if (as->buf) {
+               memcpy(newbuf, as->buf, as->buf_len);
+               g_free(as->buf);
+           }
+           as->buf = newbuf;
+           as->buf_size = as->buf_len + len;
+       }
+       memcpy(as->buf + as->buf_len, buf, len);
+       as->buf_len += len;
+
+       /* and call the callback if we have enough data or if this is the last attr */
+       if (as->buf_len >= hdl->min_size || eoa) {
+           success = success && hdl->callback(hp->user_data, fs->filenum,
+                   fs->file_data, as->attrid, hdl->attrid_data, &as->attr_data,
+                   as->buf, as->buf_len, eoa, FALSE);
+           as->buf_len = 0;
+           as->wrote_eoa = eoa;
+       }
+    }
+
+    return success;
+}
+
+gboolean
+amar_read(
+       amar_t *archive,
+       gpointer user_data,
+       amar_attr_handling_t *handling_array,
+       amar_file_start_callback_t file_start_cb,
+       amar_file_finish_callback_t file_finish_cb,
+       GError **error)
+{
+    file_state_t *fs = NULL;
+    attr_state_t *as = NULL;
+    GSList *iter;
+    handling_params_t hp;
+    uint16_t filenum;
+    uint16_t attrid;
+    uint32_t datasize;
+    gboolean eoa;
+    amar_attr_handling_t *hdl;
+    gboolean success = TRUE;
+
+    g_assert(archive->mode == O_RDONLY);
+
+    hp.user_data = user_data;
+    hp.handling_array = handling_array;
+    hp.file_start_cb = file_start_cb;
+    hp.file_finish_cb = file_finish_cb;
+    hp.file_states = NULL;
+    hp.buf_len = 0;
+    hp.buf_offset = 0;
+    hp.buf_size = 1024; /* use a 1K buffer to start */
+    hp.buf = g_malloc(hp.buf_size);
+    hp.got_eof = FALSE;
+    hp.just_lseeked = FALSE;
+
+    /* check that we are starting at a header record, but don't advance
+     * the buffer past it */
+    if (buf_atleast(archive, &hp, RECORD_SIZE)) {
+       GETRECORD(buf_ptr(&hp), filenum, attrid, datasize, eoa);
+       if (filenum != MAGIC_FILENUM) {
+           g_set_error(error, amar_error_quark(), EINVAL,
+                       "Archive read does not begin at a header record");
+           return FALSE;
+       }
+    }
+
+    while (1) {
+       if (!buf_atleast(archive, &hp, RECORD_SIZE))
+           break;
+
+       GETRECORD(buf_ptr(&hp), filenum, attrid, datasize, eoa);
+
+       /* handle headers specially */
+       if (G_UNLIKELY(filenum == MAGIC_FILENUM)) {
+           int vers;
+
+           /* bail if an EOF occurred in the middle of the header */
+           if (!buf_atleast(archive, &hp, HEADER_SIZE))
+               break;
+
+           if (sscanf(buf_ptr(&hp), HEADER_MAGIC " %d", &vers) != 1) {
+               g_set_error(error, amar_error_quark(), EINVAL,
+                           "Invalid archive header");
+               return FALSE;
+           }
+
+           if (vers > HEADER_VERSION) {
+               g_set_error(error, amar_error_quark(), EINVAL,
+                           "Archive version %d is not supported", vers);
+               return FALSE;
+           }
+
+           buf_skip(archive, &hp, HEADER_SIZE);
+
+           continue;
+       }
+
+       buf_skip(archive, &hp, RECORD_SIZE);
+
+       if (datasize > MAX_RECORD_DATA_SIZE) {
+           g_set_error(error, amar_error_quark(), EINVAL,
+                       "Invalid record: data size must be less than %d",
+                       MAX_RECORD_DATA_SIZE);
+           return FALSE;
+       }
+
+       /* find the file_state_t, if it exists */
+       if (!fs || fs->filenum != filenum) {
+           fs = NULL;
+           for (iter = hp.file_states; iter; iter = iter->next) {
+               if (((file_state_t *)iter->data)->filenum == filenum) {
+                   fs = (file_state_t *)iter->data;
+                   break;
+               }
+           }
+       }
+
+       /* get the "special" attributes out of the way */
+       if (G_UNLIKELY(attrid < AMAR_ATTR_APP_START)) {
+           if (attrid == AMAR_ATTR_EOF) {
+               if (datasize != 0) {
+                   g_set_error(error, amar_error_quark(), EINVAL,
+                               "Archive contains an EOF record with nonzero size");
+                   return FALSE;
+               }
+               if (fs) {
+                   success = finish_file(&hp, fs, FALSE);
+                   hp.file_states = g_slist_remove(hp.file_states, fs);
+                   as = NULL;
+                   fs = NULL;
+                   if (!success)
+                       break;
+               }
+               continue;
+           } else if (attrid == AMAR_ATTR_FILENAME) {
+               /* for filenames, we need the whole filename in the buffer */
+               if (!buf_atleast(archive, &hp, datasize))
+                   break;
+
+               if (fs) {
+                   /* TODO: warn - previous file did not end correctly */
+                   success = finish_file(&hp, fs, TRUE);
+                   hp.file_states = g_slist_remove(hp.file_states, fs);
+                   as = NULL;
+                   fs = NULL;
+                   if (!success)
+                       break;
+               }
+
+               if (!datasize) {
+                   g_set_error(error, amar_error_quark(), EINVAL,
+                               "Archive file %d has an empty filename",
+                               (int)filenum);
+                   return FALSE;
+               }
+
+               if (!eoa) {
+                   g_set_error(error, amar_error_quark(), EINVAL,
+                               "Filename record for fileid %d does "
+                               "not have its EOA bit set", (int)filenum);
+                   return FALSE;
+               }
+
+               fs = g_new0(file_state_t, 1);
+               fs->filenum = filenum;
+               hp.file_states = g_slist_prepend(hp.file_states, fs);
+
+               if (hp.file_start_cb) {
+                   success = hp.file_start_cb(hp.user_data, filenum,
+                           buf_ptr(&hp), datasize,
+                           &fs->ignore, &fs->file_data);
+                   if (!success)
+                       break;
+               }
+
+               buf_skip(archive, &hp, datasize);
+
+               continue;
+           } else {
+               g_set_error(error, amar_error_quark(), EINVAL,
+                           "Unknown attribute id %d in archive file %d",
+                           (int)attrid, (int)filenum);
+               return FALSE;
+           }
+       }
+
+       /* if this is an unrecognized file or a known file that's being
+        * ignored, then skip it. */
+       if (!fs || fs->ignore) {
+           buf_skip(archive, &hp, datasize);
+           continue;
+       }
+
+       /* ok, this is an application attribute.  Look up its as, if it exists. */
+       if (!as || as->attrid != attrid) {
+           as = NULL;
+           for (iter = fs->attr_states; iter; iter = iter->next) {
+               if (((attr_state_t *)(iter->data))->attrid == attrid) {
+                   as = (attr_state_t *)(iter->data);
+                   break;
+               }
+           }
+       }
+
+       /* and get the proper handling for that attribute */
+       if (as) {
+           hdl = as->handling;
+       } else {
+           hdl = hp.handling_array;
+           for (hdl = hp.handling_array; hdl->attrid != 0; hdl++) {
+               if (hdl->attrid == attrid)
+                   break;
+           }
+       }
+
+       /* As a shortcut, if this is a one-record attribute, handle it without
+        * creating a new attribute_state_t. */
+       if (eoa && !as) {
+           gpointer tmp = NULL;
+           if (hdl->callback) {
+               /* a simple single-part callback */
+               if (buf_avail(&hp) >= datasize) {
+                   success = hdl->callback(hp.user_data, filenum, fs->file_data, attrid,
+                           hdl->attrid_data, &tmp, buf_ptr(&hp), datasize, eoa, FALSE);
+                   if (!success)
+                       break;
+                   buf_skip(archive, &hp, datasize);
+                   continue;
+               }
+
+               /* we only have part of the data, but if it's big enough to exceed
+                * the attribute's min_size, then just call the callback for each
+                * part of the data */
+               else if (buf_avail(&hp) >= hdl->min_size) {
+                   gsize firstpart = buf_avail(&hp);
+                   gsize lastpart = datasize - firstpart;
+
+                   success = hdl->callback(hp.user_data, filenum, fs->file_data, attrid,
+                           hdl->attrid_data, &tmp, buf_ptr(&hp), firstpart, FALSE, FALSE);
+                   if (!success)
+                       break;
+                   buf_skip(archive, &hp, firstpart);
+
+                   if (!buf_atleast(archive, &hp, lastpart))
+                       break;
+
+                   success = hdl->callback(hp.user_data, filenum, fs->file_data, attrid,
+                           hdl->attrid_data, &tmp, buf_ptr(&hp), lastpart, eoa, FALSE);
+                   if (!success)
+                       break;
+                   buf_skip(archive, &hp, lastpart);
+                   continue;
+               }
+           } else {
+               /* no callback -> just skip it */
+               buf_skip(archive, &hp, datasize);
+               continue;
+           }
+       }
+
+       /* ok, set up a new attribute state */
+       if (!as) {
+           as = g_new0(attr_state_t, 1);
+           as->attrid = attrid;
+           as->handling = hdl;
+           fs->attr_states = g_slist_prepend(fs->attr_states, as);
+       }
+
+       if (hdl->callback) {
+           /* handle the data as one or two hunks, depending on whether it's
+            * all in the buffer right now */
+           if (buf_avail(&hp) >= datasize) {
+               success = handle_hunk(&hp, fs, as, hdl, buf_ptr(&hp), datasize, eoa);
+               if (!success)
+                   break;
+               buf_skip(archive, &hp, datasize);
+           } else {
+               gsize hunksize = buf_avail(&hp);
+               success = handle_hunk(&hp, fs, as, hdl, buf_ptr(&hp), hunksize, FALSE);
+               if (!success)
+                   break;
+               buf_skip(archive, &hp, hunksize);
+
+               hunksize = datasize - hunksize;
+               if (!buf_atleast(archive, &hp, hunksize))
+                   break;
+
+               handle_hunk(&hp, fs, as, hdl, buf_ptr(&hp), hunksize, eoa);
+               buf_skip(archive, &hp, hunksize);
+           }
+       } else {
+           buf_skip(archive, &hp, datasize);
+       }
+
+       /* finish the attribute if this is its last record */
+       if (eoa) {
+           success = finish_attr(&hp, fs, as, FALSE);
+           fs->attr_states = g_slist_remove(fs->attr_states, as);
+           if (!success)
+               break;
+           as = NULL;
+       }
+    }
+
+    /* close any open files, assuming that they have been truncated */
+
+    for (iter = hp.file_states; iter; iter = iter->next) {
+       file_state_t *fs = (file_state_t *)iter->data;
+       finish_file(&hp, fs, TRUE);
+    }
+    g_slist_free(hp.file_states);
+    g_free(hp.buf);
+
+    return success;
+}
diff --git a/amar-src/amar.h b/amar-src/amar.h
new file mode 100644 (file)
index 0000000..288bdbf
--- /dev/null
@@ -0,0 +1,251 @@
+/*
+ * Copyright (c) Zmanda, Inc.  All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ *
+ * This 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 this library; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+ *
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+ */
+
+#include <glib.h>
+
+/* A note regarding error handling in this module.  Amar returns errors via the
+ * Glib GError mechanism.  Most functions return a boolean, where TRUE
+ * indicates success, and FALSE indicates an error which is indicated in the
+ * 'error' parameter.
+ *
+ * Fatal programming errors are handled with assertions and error exits; any
+ * fatal format or system errors are handled via GError.  Some format errors
+ * (e.g., missing EOAs at the end of a file) are handled without any
+ * acknowledgement.
+ *
+ * The domain for amar errors is that returned from amar_error_quark, and error
+ * codes are system error codes (e.g., EINVAL, ENOSPC). */
+
+GQuark amar_error_quark(void);
+
+/* opaque types for archives, files, and attributes */
+
+typedef struct amar_s amar_t;
+typedef struct amar_file_s amar_file_t;
+typedef struct amar_attr_s amar_attr_t;
+
+/* Application attribute IDs should start at AMAR_ATTR_APP_START */
+
+enum {
+    /* internal-use only attributes */
+    AMAR_ATTR_FILENAME = 0,
+    AMAR_ATTR_EOF = 1,
+
+    /* anything above this value can be used by the application */
+    AMAR_ATTR_APP_START = 16,
+    AMAR_ATTR_GENERIC_DATA = AMAR_ATTR_APP_START,
+};
+
+/* Create an object to read/write an amanda archive on the file descriptor fd.
+ * @param fd: file descriptor of the file, it must already be opened
+ * @mode: O_RDONLY for reading, O_WRONLY for writing
+ * @returns: NULL on error
+ */
+amar_t *amar_new(int fd, mode_t mode, GError **error);
+
+/* Finish writing to this fd.  All buffers are flushed, but the file descriptor
+ * is not closed -- the user must close it. */
+gboolean amar_close(amar_t *archive, GError **error);
+
+/* create a new 'file' object on the archive.  The filename is treated as a
+ * binary blob, but if filename_len is zero, then its length will be calculated
+ * with strlen().  A zero-length filename_buf is not allowed.
+ *
+ * Note that a header record will only be written if header_offset is non-NULL,
+ * as this represents a location to which a reader could seek.
+ *
+ * @param archive: the archive containing this file
+ * @param filename_buf: filename to include in the file
+ * @param filename_len: length of the filename_buf, or 0 to calculate
+ * @param header_offset (output): offset of the header record preceding
+ *     this file; pass NULL to ignore.
+ * @returns: NULL on error, otherwise a file object
+ */
+amar_file_t *amar_new_file(
+           amar_t *archive,
+           char *filename_buf,
+           gsize filename_len,
+           off_t *header_offset,
+           GError **error);
+
+/* Flush all buffer the 'file' object and write a record with ID=2 */
+gboolean amar_file_close(
+           amar_file_t *file,
+           GError **error);
+
+/* create a new 'attribute' object with attrid attached to the file
+ *
+ * @returns: NULL on error, otherwise an attribute object
+ */
+amar_attr_t *amar_new_attr(
+           amar_file_t *file,
+           uint16_t attrid,
+           GError **error);
+
+/* flush all buffers and mark the end of the attribute */
+gboolean amar_attr_close(
+           amar_attr_t *attribute,
+           GError **error);
+
+/* Add 'size' byte of data from 'data' to the attribute.  If this is the
+ * last data in this attribute, set eoa to TRUE.  This will save space by
+ * writing and end-of-attribute indication in this record, instead of adding
+ * an empty EOA record.
+ */
+gboolean amar_attr_add_data_buffer(
+           amar_attr_t *attribute,
+           gpointer data,
+           gsize size,
+           gboolean eoa,
+           GError **error);
+
+/* This function reads from the file descriptor 'fd' until EOF and adds
+ * the resulting data to the attribute.  The end of the attribute is
+ * flagged appropriately if EOA is true.
+ *
+ * @param attribute: the attribute for the data
+ * @param fd: the file descriptor from which to read
+ * @param eoa: add an EOA bit to the end?
+ * @returns: number of bytes read from fd, or -1 on error
+ */
+off_t amar_attr_add_data_fd(
+           amar_attr_t *attribute,
+           int fd,
+           gboolean eoa,
+           GError **error);
+
+/* When reading files, the handling of each attribute can be configured
+ * separately.  Some attributes may always be short enough to fit in memory,
+ * and in this case the archive interface will take care of assembling any
+ * fragments for you.  Some attributes should be ignored, while others
+ * will call a function for each fragment.
+ *
+ * There are a a number of xx_data options available here, that deserve some
+ * disambiguation.
+ *  - user_data is global to the entire read operation (it is a parameter to
+ *    amar_read)
+ *  - file_data is specific to the current file; it is set by the start_file
+ *    callback and freed by the finish_file callback.
+ *  - attrid_data is specific this the current attribute ID, across all files;
+ *    it comes from the amar_attr_handling_t struct.
+ *  - attr_data is specific to the current instance of the particular
+ *    attribute.  It points to a NULL pointer on the first call to the fragment
+ *    callback, and can be set at that time.  It should be freed when the EOA
+ *    argument is TRUE.
+ *
+ * @param user_data: the pointer passed to amar_read
+ * @param filenum: the file number for this record
+ * @param file_data: the file_data pointer returned from the start_file callback
+ * @param attrid: the attribute id for this record
+ * @param attrid_data: the data from the handling array
+ * @param attr_data (in/out): data for this attribute; this will be the same
+ *       pointer for every callback for a particular instance of an attribute.
+ *       Any resources should be freed when eoa is true.
+ * @param data: the data for this fragment
+ * @param size: the size of data
+ * @param eoa: TRUE iff this is the last fragment for this attribute
+ * @param truncated: TRUE if this attribute is likely to be incomplete (e.g.,
+ *       in an error situation)
+ * @returns: FALSE if the amar_read call should be aborted
+ */
+typedef gboolean (*amar_fragment_callback_t)(
+       gpointer user_data,
+       uint16_t filenum,
+       gpointer file_data,
+       uint16_t attrid,
+       gpointer attrid_data,
+       gpointer *attr_data,
+       gpointer data,
+       gsize size,
+       gboolean eoa,
+       gboolean truncated);
+
+/* amar_read takes an array of this struct, terminated by an entry
+ * with attrid 0.  This final entry is used as the "catchall" for attributes
+ * not matching any other array entries. */
+typedef struct amar_attr_handling_s {
+    uint16_t attrid;
+
+    /* if nonzero, this is the minimum size fragment that will be passed to the
+     * callback.  Use SIZE_MAX for no limit, although this may result in
+     * excessive memory use while parsing a malicious or corrupt archive. */
+    gsize min_size;
+
+    /* if non-NULL, this function will be called for each fragment
+     * with this attribute ID */
+    amar_fragment_callback_t callback;
+
+    /* this value is passed as the attr_data parameter to the callback */
+    gpointer attrid_data;
+} amar_attr_handling_t;
+
+/* This function is called for each new file, and can decide whether to ignore
+ * the file, or set up file-specific data.
+ *
+ * @param user_data: the pointer passed to amar_read
+ * @param filenum: the file number for this record
+ * @param filename_buf: the filename of this file
+ * @param filename_len: the length of the filename
+ * @param ignore (output): if set to TRUE, ignore all attributes for this file.
+ * @param file_data (output): space to store file-specific data
+ * @returns: FALSE if the amar_read call should be aborted
+ */
+typedef gboolean (*amar_file_start_callback_t)(
+       gpointer user_data,
+       uint16_t filenum,
+       gpointer filename_buf,
+       gsize filename_len,
+       gboolean *ignore,
+       gpointer *file_data);
+
+/* This function is called for each new file, and can decide whether to ignore
+ * the file, or set up file-specific data.
+ *
+ * @param user_data: the pointer passed to amar_read
+ * @param filenum: the file number for this record
+ * @param file_data (output): space to store file-specific data
+ * @param truncated: TRUE if this file is likely to be incomplete (e.g.,
+ *       in an error situation, or at an early EOF)
+ * @returns: FALSE if the amar_read call should be aborted
+ */
+typedef gboolean (*amar_file_finish_callback_t)(
+       gpointer user_data,
+       uint16_t filenum,
+       gpointer *file_data,
+       gboolean truncated);
+
+/* This function actually performs the read operation, calling all of the
+ * above callbacks.  If any of the callbacks return FALSE, this function
+ * returns FALSE but does not set its error parameter.
+ *
+ * @param user_data: passed to all callbacks
+ * @param handling_array: array giving handling information
+ * @param file_start_cb: callback for file starts
+ * @param file_finish_cb: callback for file finishs
+ * @param error (output): the error result
+ * @returns: FALSE on error or an early exit, otherwise TRUE
+ */
+gboolean amar_read(
+       amar_t *archive,
+       gpointer user_data,
+       amar_attr_handling_t *handling_array,
+       amar_file_start_callback_t file_start_cb,
+       amar_file_finish_callback_t file_finish_cb,
+       GError **error);
diff --git a/amar-src/amarchiver.c b/amar-src/amarchiver.c
new file mode 100644 (file)
index 0000000..2d08816
--- /dev/null
@@ -0,0 +1,359 @@
+/*
+ * Copyright (c) Zmanda, Inc.  All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ *
+ * This 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 this library; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+ *
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+ */
+
+#include "amanda.h"
+#include "getopt.h"
+#include "version.h"
+#include "amar.h"
+
+static struct option long_options[] = {
+    {"create"          , 0, NULL,  1},
+    {"extract"         , 0, NULL,  2},
+    {"list"            , 0, NULL,  3},
+    {"verbose"         , 0, NULL,  4},
+    {"file"            , 1, NULL,  5},
+    {"version"         , 0, NULL,  6},
+    {NULL, 0, NULL, 0}
+};
+
+static void
+usage(void)
+{
+    printf("Usage: amarchiver [--version|--create|--list|--extract] [--verbose]* [--file file]\n");
+    printf("            [filename]*\n");
+}
+
+static void
+error_exit(const char *action, GError *error)
+{
+    const char *msg = error->message? error->message : "(unknown)";
+    g_fprintf(stderr, "%s: %s\n", action, msg);
+    exit(1);
+}
+
+static void
+do_create(char *opt_file, int opt_verbose, int argc, char **argv)
+{
+    FILE *output = stdout;
+    amar_t *archive;
+    amar_file_t *file;
+    amar_attr_t *attribute;
+    GError *error = NULL;
+    int i, fd_out, fd_in;
+    off_t filesize = 0;
+
+    if (opt_file != NULL && strcmp(opt_file,"-") != 0) {
+       fd_out = open(opt_file, O_CREAT|O_WRONLY|O_TRUNC, 0660);
+       if (fd_out <= 0) {
+           error("open of '%s' failed: %s\n", opt_file, strerror(errno));
+       }
+    } else {
+       fd_out = fileno(stdout);
+       output = stderr;
+    }
+    archive = amar_new(fd_out, O_WRONLY, &error);
+    if (!archive)
+       error_exit("amar_new", error);
+
+    i = 0;
+    while (i<argc) {
+       fd_in = open(argv[i], O_RDONLY);
+       if (fd_in <= 0) {
+           g_fprintf(stderr, "open of '%s' failed: %s\n", argv[i], strerror(errno));
+           i++;
+           continue;
+       }
+       filesize = 0;
+       file = amar_new_file(archive, argv[i], strlen(argv[i]), NULL, &error);
+       if (error)
+           error_exit("amar_new_file", error);
+       attribute = amar_new_attr(file, AMAR_ATTR_GENERIC_DATA, &error);
+       if (error)
+           error_exit("amar_new_attr", error);
+
+       filesize += amar_attr_add_data_fd(attribute, fd_in, 1, &error);
+       if (error)
+           error_exit("amar_attr_add_data_fd", error);
+
+       if (!amar_attr_close(attribute, &error))
+           error_exit("amar_attr_close", error);
+       if (!amar_file_close(file, &error))
+           error_exit("amar_file_close", error);
+
+       if (opt_verbose == 1) {
+           g_fprintf(output,"%s\n", argv[i]);
+       } else if (opt_verbose > 1) {
+           g_fprintf(output,"%llu %s\n", (unsigned long long)filesize, argv[i]);
+       }
+       close(fd_in);
+       i++;
+    }
+
+    if (!amar_close(archive, &error))
+       error_exit("amar_close", error);
+    close(fd_out);
+}
+
+struct read_user_data {
+    gboolean verbose;
+    char **argv;
+    int argc;
+};
+
+static gboolean
+extract_file_start_cb(
+       gpointer user_data,
+       uint16_t filenum G_GNUC_UNUSED,
+       gpointer filename_buf,
+       gsize filename_len,
+       gboolean *ignore G_GNUC_UNUSED,
+       gpointer *file_data)
+{
+    struct read_user_data *ud = user_data;
+    int i;
+
+    /* keep the filename for later */
+    *file_data = g_strndup(filename_buf, filename_len);
+
+    if (ud->argc) {
+       *ignore = TRUE;
+       for (i = 0; i < ud->argc; i++) {
+           if (strlen(ud->argv[i]) == filename_len
+               && 0 == strcmp(ud->argv[i], *file_data))
+               *ignore = FALSE;
+       }
+    }
+
+    return TRUE;
+}
+
+static gboolean
+extract_file_finish_cb(
+       gpointer user_data G_GNUC_UNUSED,
+       uint16_t filenum G_GNUC_UNUSED,
+       gpointer *file_data,
+       gboolean truncated)
+{
+    if (truncated)
+       g_fprintf(stderr, _("Data for '%s' may have been truncated\n"),
+               (char *)*file_data);
+
+    g_free(*file_data);
+
+    return TRUE;
+}
+
+static gboolean
+extract_frag_cb(
+       gpointer user_data G_GNUC_UNUSED,
+       uint16_t filenum G_GNUC_UNUSED,
+       gpointer file_data,
+       uint16_t attrid,
+       gpointer attrid_data G_GNUC_UNUSED,
+       gpointer *attr_data,
+       gpointer data,
+       gsize datasize,
+       gboolean eoa,
+       gboolean truncated)
+{
+    struct read_user_data *ud = user_data;
+    int fd = GPOINTER_TO_INT(*attr_data);
+
+    if (!fd) {
+       char *filename = g_strdup_printf("%s.%d", (char *)file_data, attrid);
+       fd = open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0660);
+       if (fd < 0) {
+           g_fprintf(stderr, _("Could not open '%s' for writing: %s"),
+                   filename, strerror(errno));
+       }
+       if (ud->verbose)
+           g_fprintf(stderr, "%s\n", filename);
+       g_free(filename);
+       *attr_data = GINT_TO_POINTER(fd);
+    }
+
+    if (full_write(fd, data, datasize) != datasize) {
+       g_fprintf(stderr, _("while writing '%s.%d': %s"),
+               (char *)file_data, attrid, strerror(errno));
+       return FALSE;
+    }
+
+    if (eoa) {
+       if (truncated) {
+           g_fprintf(stderr, _("'%s.%d' may be truncated\n"),
+                   (char *)file_data, attrid);
+       }
+       close(fd);
+    }
+
+    return TRUE;
+}
+
+static void
+do_extract(
+       char *opt_file,
+       int opt_verbose,
+       int argc,
+       char **argv)
+{
+    amar_t *archive;
+    GError *error = NULL;
+    int fd_in;
+    amar_attr_handling_t handling[] = {
+       { 0, 0, extract_frag_cb, NULL },
+    };
+    struct read_user_data ud;
+
+    ud.argv = argv;
+    ud.argc = argc;
+    ud.verbose = opt_verbose;
+
+    if (opt_file && strcmp(opt_file,"-") != 0) {
+       fd_in = open(opt_file, O_RDONLY);
+       if (fd_in <= 0) {
+           error("open of '%s' failed: %s\n", opt_file, strerror(errno));
+       }
+    } else {
+       fd_in = fileno(stdin);
+    }
+
+    archive = amar_new(fd_in, O_RDONLY, &error);
+    if (!archive)
+       error_exit("amar_new", error);
+
+    if (!amar_read(archive, &ud, handling, extract_file_start_cb,
+                  extract_file_finish_cb, &error)) {
+       if (error)
+           error_exit("amar_read", error);
+       else
+           /* one of the callbacks already printed an error message */
+           exit(1);
+    }
+}
+
+static gboolean
+list_file_start_cb(
+       gpointer user_data G_GNUC_UNUSED,
+       uint16_t filenum G_GNUC_UNUSED,
+       gpointer filename_buf,
+       gsize filename_len,
+       gboolean *ignore,
+       gpointer *file_data G_GNUC_UNUSED)
+{
+    g_printf("%.*s\n", (int)filename_len, (char *)filename_buf);
+    *ignore = TRUE;
+
+    return TRUE;
+}
+static void
+do_list(
+       char *opt_file,
+       int opt_verbose G_GNUC_UNUSED)
+{
+    amar_t *archive;
+    GError *error = NULL;
+    int fd_in;
+    amar_attr_handling_t handling[] = {
+       { 0, 0, NULL, NULL },
+    };
+
+    if (opt_file && strcmp(opt_file,"-") != 0) {
+       fd_in = open(opt_file, O_RDONLY);
+       if (fd_in <= 0) {
+           error("open of '%s' failed: %s\n", opt_file, strerror(errno));
+       }
+    } else {
+       fd_in = fileno(stdin);
+    }
+
+    archive = amar_new(fd_in, O_RDONLY, &error);
+    if (!archive)
+       error_exit("amar_new", error);
+
+    if (!amar_read(archive, NULL, handling, list_file_start_cb,
+                  NULL, &error)) {
+       if (error)
+           error_exit("amar_read", error);
+       else
+           /* one of the callbacks already printed an error message */
+           exit(1);
+    }
+}
+
+int main(
+    int    argc,
+    char **argv)
+{
+    int   opt_create    = 0;
+    int   opt_extract   = 0;
+    int   opt_list      = 0;
+    int   opt_verbose   = 0;
+    char *opt_file      = NULL;
+
+    while(1) {
+       int option_index = 0;
+       int c = getopt_long (argc, argv, "", long_options, &option_index);
+       if (c == -1) {
+           break;
+       }
+       switch (c) {
+       case 1: opt_create = 1;
+               break;
+       case 2: opt_extract = 1;
+               break;
+       case 3: opt_list = 1;
+               break;
+       case 4: opt_verbose += 1;
+               break;
+       case 5: opt_file = stralloc(optarg);
+               break;
+       case 6: printf("amarchiver %s\n", version());
+               exit(0);
+               break;
+       }
+    }
+    argc -= optind;
+    argv += optind;
+
+    /* check those arguments */
+    if (opt_create + opt_extract + opt_list == 0) {
+       g_fprintf(stderr,"--create, --list or --extract must be provided\n");
+       usage();
+    }
+    if (opt_create + opt_extract + opt_list > 1) {
+       g_fprintf(stderr,"Only one of --create, --list or --extract must be provided\n");
+       usage();
+    }
+    if (opt_list > 1) {
+       if (argc) {
+           g_fprintf(stderr, "--list does not take any additional filenames\n");
+           usage();
+       }
+    }
+
+    if (opt_create > 0)
+       do_create(opt_file, opt_verbose, argc, argv);
+    else if (opt_extract > 0)
+       do_extract(opt_file, opt_verbose, argc, argv);
+    else if (opt_list > 0)
+       do_list(opt_file, opt_verbose);
+
+    return 0;
+}
index f2e6b09beb74962be2b2a1f73160bb717f86626e..7824ef58ae1b96d462eda822f24a303b84872d18 100644 (file)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  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.
@@ -17,7 +17,7 @@
 # Makefile for amplot.
 
 # vim:ft=automake
-# Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
 # 
 # This library is free software; you can redistribute it and/or modify it
 # under the terms of the GNU Lesser General Public License version 2.1 as 
 # along with this library; if not, write to the Free Software Foundation,
 # Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
 # 
-# Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
-# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 
 # simple include file to pre-define variables which are then +='d by other
 # scripts in this directory.
 
 # vim:ft=automake
-# Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
 # 
 # This library is free software; you can redistribute it and/or modify it
 # under the terms of the GNU Lesser General Public License version 2.1 as 
@@ -54,8 +54,8 @@
 # along with this library; if not, write to the Free Software Foundation,
 # Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
 # 
-# Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
-# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 
 # SYNOPSIS:
 #
 # Files which support it are syntax-checked when the user invokes 'make check'.
 #
 # All *target* filenames must be listed in SCRIPTS_SHELL, SCRIPTS_PERL, and 
-# SCRIPTS_AWK to support 'make check', 'make dist', and 'make distclean'.
+# SCRIPTS_AWK to support 'make check', 'make dist', and 'make distclean'. No
+# files which are not substituted by config.status should be included in
+# SCRIPTS_PERL, SCRIPTS_SHELL, or SCRIPTS_AWK.  If non-generated files are listed
+# for installation, then Automake will figure out that they should be distributed;
+# otherwise, include them in EXTRA_DIST.
 #
 # USAGE:
 #
 #   SCRIPTS_PERL = fooscript barscript perl-lib.pl perlmod.pm
 #   SCRIPTS_SHELL = shell1 shell2 sh-lib.sh
 #   SCRIPTS_AWK = talk balk chalk awk-lib.awk
+#   sbin_SCRIPTS = not-subbed
+#   EXTRA_DIST = util-script.pl
 #
 # with the corresponding files in the repository:
 #
 #   fooscript.pl barscript.pl perl-lib.pl.in perlmod.pm.in
 #   shell1.sh shell2.sh sh-lib.sh.in
 #   talk.awk balk.awk chalk.awk awk-lib.awk.in
+#   not-subbed util-script.pl
 #
 # by default, all shell and perl scripts are syntax checked.  If this is
 # a problem (for example, perl scripts depending on Amanda extension 
 # INSTALLPERMS_exec = \
 #      dest=$(sbindir) chown=amanda chmod= \
 #              foo bar \
-#      chmod=u+s,o-rwx \
+#      chmod=07450 \
 #              bing
 #      dest=$(libexecdir) chmod= \
 #              $(libexec_PROGRAMS)
 #
 # This whole operation is not required when making builds for packaging,
 # and can be disabled with --disable-installperms, via the WANT_INSTALLPERMS
-# AM_CONDITIONAL.
+# AM_CONDITIONAL.  When disabled, the file 'installperms.sh' in the top-level
+# build directory is populated with a format suitable for shell interpretation,
+# with lines like this:
+#   installperm "amanda:disk" "04750" "/usr/local/sbin/bing"
+# the arguments being, respectively, owner:group, mode, and filename.  There will
+# be exactly one line for each file which has specific permissions.  The intention
+# is that this file be used by packaging scripts to set correct permissions at install
+# time.  Note that files which have no special permissions requirements do not appear 
+# in this file at all, due to limitations of Automake.
 
 # vim:ft=automake
 
@@ -164,10 +179,12 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
        $(top_srcdir)/config/automake/precompile.am \
        $(top_srcdir)/config/automake/scripts.am \
        $(top_srcdir)/config/automake/vars.am
+@WANT_INSTALLPERMS_FALSE@am__append_1 = $(installperms_sh)
 subdir = amplot
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps =  \
        $(top_srcdir)/config/macro-archive/ac_define_dir.m4 \
+       $(top_srcdir)/config/macro-archive/ac_perl_module_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_perl_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_swig.m4 \
        $(top_srcdir)/config/macro-archive/ax_compare_version.m4 \
@@ -201,6 +218,7 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/amanda/libs.m4 \
        $(top_srcdir)/config/amanda/net.m4 \
        $(top_srcdir)/config/amanda/progs.m4 \
+       $(top_srcdir)/config/amanda/ps.m4 \
        $(top_srcdir)/config/amanda/readdir.m4 \
        $(top_srcdir)/config/amanda/readline.m4 \
        $(top_srcdir)/config/amanda/rsh-security.m4 \
@@ -223,7 +241,9 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/float_h.m4 \
        $(top_srcdir)/config/gnulib/fsusage.m4 \
        $(top_srcdir)/config/gnulib/getaddrinfo.m4 \
+       $(top_srcdir)/config/gnulib/getopt.m4 \
        $(top_srcdir)/config/gnulib/gettimeofday.m4 \
+       $(top_srcdir)/config/gnulib/gnulib-common.m4 \
        $(top_srcdir)/config/gnulib/gnulib-comp.m4 \
        $(top_srcdir)/config/gnulib/include_next.m4 \
        $(top_srcdir)/config/gnulib/inet_ntop.m4 \
@@ -251,7 +271,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/sys_stat_h.m4 \
        $(top_srcdir)/config/gnulib/sys_time_h.m4 \
        $(top_srcdir)/config/gnulib/tempname.m4 \
-       $(top_srcdir)/config/gnulib/ulonglong.m4 \
        $(top_srcdir)/config/gnulib/unistd_h.m4 \
        $(top_srcdir)/config/gnulib/vasnprintf.m4 \
        $(top_srcdir)/config/gnulib/visibility.m4 \
@@ -262,7 +281,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gettext-macros/lib-ld.m4 \
        $(top_srcdir)/config/gettext-macros/lib-link.m4 \
        $(top_srcdir)/config/gettext-macros/lib-prefix.m4 \
-       $(top_srcdir)/config/gettext-macros/longlong.m4 \
        $(top_srcdir)/config/gettext-macros/nls.m4 \
        $(top_srcdir)/config/gettext-macros/po.m4 \
        $(top_srcdir)/config/gettext-macros/progtest.m4 \
@@ -292,6 +310,7 @@ amplotDATA_INSTALL = $(INSTALL_DATA)
 DATA = $(amplot_DATA)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
+AIX_BACKUP = @AIX_BACKUP@
 ALLOCA = @ALLOCA@
 ALLOCA_H = @ALLOCA_H@
 AMANDA_DBGDIR = @AMANDA_DBGDIR@
@@ -306,8 +325,10 @@ AMPLOT_CAT_GZIP = @AMPLOT_CAT_GZIP@
 AMPLOT_CAT_PACK = @AMPLOT_CAT_PACK@
 AMPLOT_COMPRESS = @AMPLOT_COMPRESS@
 AMTAR = @AMTAR@
+APPLICATION_DIR = @APPLICATION_DIR@
 AR = @AR@
 ARPA_INET_H = @ARPA_INET_H@
+ASSERTIONS = @ASSERTIONS@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -319,16 +340,28 @@ BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@
 BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@
 BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@
 BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@
+BSDTCP_SECURITY = @BSDTCP_SECURITY@
+BSDUDP_SECURITY = @BSDUDP_SECURITY@
+BSD_SECURITY = @BSD_SECURITY@
 CAT = @CAT@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
+CHECK_USERID = @CHECK_USERID@
 CHIO = @CHIO@
 CHS = @CHS@
+CLIENT_HOST_INSTANCE = @CLIENT_HOST_INSTANCE@
+CLIENT_HOST_KEY_FILE = @CLIENT_HOST_KEY_FILE@
+CLIENT_HOST_PRINCIPAL = @CLIENT_HOST_PRINCIPAL@
 CLIENT_LOGIN = @CLIENT_LOGIN@
 CLIENT_SCRIPTS_OPT = @CLIENT_SCRIPTS_OPT@
 COMPRESS = @COMPRESS@
+COMPRESS_BEST_OPT = @COMPRESS_BEST_OPT@
+COMPRESS_FAST_OPT = @COMPRESS_FAST_OPT@
+COMPRESS_PATH = @COMPRESS_PATH@
+COMPRESS_SUFFIX = @COMPRESS_SUFFIX@
+CONFIG_CLOBBER_MY_CONFIG = @CONFIG_CLOBBER_MY_CONFIG@
 CONFIG_DIR = @CONFIG_DIR@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
@@ -342,6 +375,7 @@ DD = @DD@
 DEFAULT_AMANDATES_FILE = @DEFAULT_AMANDATES_FILE@
 DEFAULT_CHANGER_DEVICE = @DEFAULT_CHANGER_DEVICE@
 DEFAULT_CONFIG = @DEFAULT_CONFIG@
+DEFAULT_MAILER = @DEFAULT_MAILER@
 DEFAULT_SERVER = @DEFAULT_SERVER@
 DEFAULT_TAPE_DEVICE = @DEFAULT_TAPE_DEVICE@
 DEFAULT_TAPE_SERVER = @DEFAULT_TAPE_SERVER@
@@ -349,7 +383,7 @@ DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DOC_BUILD_DATE = @DOC_BUILD_DATE@
 DUMP = @DUMP@
-DUMPER_DIR = @DUMPER_DIR@
+DUMP_RETURNS_1 = @DUMP_RETURNS_1@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -362,6 +396,7 @@ F77 = @F77@
 FFLAGS = @FFLAGS@
 FLOAT_H = @FLOAT_H@
 GETCONF = @GETCONF@
+GETOPT_H = @GETOPT_H@
 GETTEXT = @GETTEXT@
 GLIB_CFLAGS = @GLIB_CFLAGS@
 GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
@@ -372,9 +407,12 @@ GMSGFMT_015 = @GMSGFMT_015@
 GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
 GNULIB_CHOWN = @GNULIB_CHOWN@
 GNULIB_DUP2 = @GNULIB_DUP2@
+GNULIB_ENVIRON = @GNULIB_ENVIRON@
 GNULIB_FCHDIR = @GNULIB_FCHDIR@
 GNULIB_FFLUSH = @GNULIB_FFLUSH@
+GNULIB_FOPEN = @GNULIB_FOPEN@
 GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
+GNULIB_FREOPEN = @GNULIB_FREOPEN@
 GNULIB_FSEEK = @GNULIB_FSEEK@
 GNULIB_FSEEKO = @GNULIB_FSEEKO@
 GNULIB_FTELL = @GNULIB_FTELL@
@@ -384,6 +422,7 @@ GNULIB_GETCWD = @GNULIB_GETCWD@
 GNULIB_GETDELIM = @GNULIB_GETDELIM@
 GNULIB_GETLINE = @GNULIB_GETLINE@
 GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
+GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@
 GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
 GNULIB_LCHOWN = @GNULIB_LCHOWN@
 GNULIB_LSEEK = @GNULIB_LSEEK@
@@ -408,8 +447,10 @@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
 GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
 GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
 GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
+GNULIB_PUTENV = @GNULIB_PUTENV@
 GNULIB_READLINK = @GNULIB_READLINK@
 GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@
+GNULIB_SETENV = @GNULIB_SETENV@
 GNULIB_SLEEP = @GNULIB_SLEEP@
 GNULIB_SNPRINTF = @GNULIB_SNPRINTF@
 GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@
@@ -418,11 +459,15 @@ GNULIB_STPNCPY = @GNULIB_STPNCPY@
 GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
 GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
 GNULIB_STRDUP = @GNULIB_STRDUP@
+GNULIB_STRERROR = @GNULIB_STRERROR@
 GNULIB_STRNDUP = @GNULIB_STRNDUP@
 GNULIB_STRNLEN = @GNULIB_STRNLEN@
 GNULIB_STRPBRK = @GNULIB_STRPBRK@
 GNULIB_STRSEP = @GNULIB_STRSEP@
+GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@
+GNULIB_STRSTR = @GNULIB_STRSTR@
 GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
+GNULIB_UNSETENV = @GNULIB_UNSETENV@
 GNULIB_VASPRINTF = @GNULIB_VASPRINTF@
 GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@
 GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
@@ -436,6 +481,7 @@ GOBJECT_QUERY = @GOBJECT_QUERY@
 GREP = @GREP@
 GZIP = @GZIP@
 HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@
+HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@
 HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@
 HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@
 HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
@@ -444,9 +490,10 @@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
 HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@
 HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
 HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
-HAVE_DECL_STRNCASECMP = @HAVE_DECL_STRNCASECMP@
+HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@
 HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
 HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
+HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@
 HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
 HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
 HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
@@ -454,7 +501,9 @@ HAVE_DUP2 = @HAVE_DUP2@
 HAVE_FSEEKO = @HAVE_FSEEKO@
 HAVE_FTELLO = @HAVE_FTELLO@
 HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
+HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
 HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
+HAVE_GZIP = @HAVE_GZIP@
 HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
 HAVE_IO_H = @HAVE_IO_H@
 HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
@@ -463,8 +512,10 @@ HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@
 HAVE_MEMPCPY = @HAVE_MEMPCPY@
 HAVE_MKDTEMP = @HAVE_MKDTEMP@
 HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@
+HAVE_OS_H = @HAVE_OS_H@
 HAVE_READLINK = @HAVE_READLINK@
 HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@
+HAVE_SETENV = @HAVE_SETENV@
 HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
 HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
 HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
@@ -472,7 +523,6 @@ HAVE_SLEEP = @HAVE_SLEEP@
 HAVE_STDINT_H = @HAVE_STDINT_H@
 HAVE_STPCPY = @HAVE_STPCPY@
 HAVE_STPNCPY = @HAVE_STPNCPY@
-HAVE_STRCASECMP = @HAVE_STRCASECMP@
 HAVE_STRCASESTR = @HAVE_STRCASESTR@
 HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
 HAVE_STRNDUP = @HAVE_STRNDUP@
@@ -481,10 +531,12 @@ HAVE_STRSEP = @HAVE_STRSEP@
 HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@
 HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
 HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
+HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
 HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
 HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
 HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
 HAVE_UNISTD_H = @HAVE_UNISTD_H@
+HAVE_UNSETENV = @HAVE_UNSETENV@
 HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
 HAVE_VASPRINTF = @HAVE_VASPRINTF@
 HAVE_VISIBILITY = @HAVE_VISIBILITY@
@@ -500,6 +552,8 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 INTLLIBS = @INTLLIBS@
 INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+KRB4_SECURITY = @KRB4_SECURITY@
+KRB5_SECURITY = @KRB5_SECURITY@
 LDFLAGS = @LDFLAGS@
 LEX = @LEX@
 LEXLIB = @LEXLIB@
@@ -516,6 +570,8 @@ LIBTHREAD = @LIBTHREAD@
 LIBTOOL = @LIBTOOL@
 LIBTOOL_DEPS = @LIBTOOL_DEPS@
 LN_S = @LN_S@
+LOCKING = @LOCKING@
+LOW_TCPPORTRANGE = @LOW_TCPPORTRANGE@
 LTLIBICONV = @LTLIBICONV@
 LTLIBINTL = @LTLIBINTL@
 LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
@@ -524,7 +580,6 @@ LTLIBPTH = @LTLIBPTH@
 LTLIBTHREAD = @LTLIBTHREAD@
 MAILER = @MAILER@
 MAKEINFO = @MAKEINFO@
-MAXTAPEBLOCKSIZE = @MAXTAPEBLOCKSIZE@
 MCUTIL = @MCUTIL@
 MKDIR_P = @MKDIR_P@
 MSGFMT = @MSGFMT@
@@ -560,26 +615,37 @@ PERL_INC = @PERL_INC@
 PKG_CONFIG = @PKG_CONFIG@
 POSUB = @POSUB@
 PRINT = @PRINT@
+PS = @PS@
+PS_ARGUMENT = @PS_ARGUMENT@
 PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
 RANLIB = @RANLIB@
 READLINE_LIBS = @READLINE_LIBS@
 REPLACE_CHOWN = @REPLACE_CHOWN@
 REPLACE_FCHDIR = @REPLACE_FCHDIR@
 REPLACE_FFLUSH = @REPLACE_FFLUSH@
+REPLACE_FOPEN = @REPLACE_FOPEN@
 REPLACE_FPRINTF = @REPLACE_FPRINTF@
+REPLACE_FREOPEN = @REPLACE_FREOPEN@
 REPLACE_FSEEK = @REPLACE_FSEEK@
 REPLACE_FSEEKO = @REPLACE_FSEEKO@
 REPLACE_FTELL = @REPLACE_FTELL@
 REPLACE_FTELLO = @REPLACE_FTELLO@
 REPLACE_GETCWD = @REPLACE_GETCWD@
 REPLACE_GETLINE = @REPLACE_GETLINE@
+REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
 REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
 REPLACE_LCHOWN = @REPLACE_LCHOWN@
 REPLACE_LSEEK = @REPLACE_LSEEK@
+REPLACE_MEMMEM = @REPLACE_MEMMEM@
 REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
 REPLACE_PRINTF = @REPLACE_PRINTF@
+REPLACE_PUTENV = @REPLACE_PUTENV@
 REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
 REPLACE_SPRINTF = @REPLACE_SPRINTF@
+REPLACE_STRCASESTR = @REPLACE_STRCASESTR@
+REPLACE_STRERROR = @REPLACE_STRERROR@
+REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@
+REPLACE_STRSTR = @REPLACE_STRSTR@
 REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
 REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
 REPLACE_VPRINTF = @REPLACE_VPRINTF@
@@ -587,7 +653,11 @@ REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
 REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
 REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
 RESTORE = @RESTORE@
+RSH_SECURITY = @RSH_SECURITY@
 SAMBA_CLIENT = @SAMBA_CLIENT@
+SERVER_HOST_INSTANCE = @SERVER_HOST_INSTANCE@
+SERVER_HOST_KEY_FILE = @SERVER_HOST_KEY_FILE@
+SERVER_HOST_PRINCIPAL = @SERVER_HOST_PRINCIPAL@
 SERVICE_SUFFIX = @SERVICE_SUFFIX@
 SETUID_GROUP = @SETUID_GROUP@
 SET_MAKE = @SET_MAKE@
@@ -597,6 +667,7 @@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
 SNAPSHOT_STAMP = @SNAPSHOT_STAMP@
 SORT = @SORT@
 SSH = @SSH@
+SSH_SECURITY = @SSH_SECURITY@
 STDBOOL_H = @STDBOOL_H@
 STDINT_H = @STDINT_H@
 STRIP = @STRIP@
@@ -606,7 +677,14 @@ SWIG_LIB = @SWIG_LIB@
 SYS_SOCKET_H = @SYS_SOCKET_H@
 SYS_STAT_H = @SYS_STAT_H@
 SYS_TIME_H = @SYS_TIME_H@
+TCPPORTRANGE = @TCPPORTRANGE@
+TICKET_LIFETIME = @TICKET_LIFETIME@
+UDPPORTRANGE = @UDPPORTRANGE@
+UNCOMPRESS_OPT = @UNCOMPRESS_OPT@
+UNCOMPRESS_PATH = @UNCOMPRESS_PATH@
+USE_AMANDAHOSTS = @USE_AMANDAHOSTS@
 USE_NLS = @USE_NLS@
+USE_RUNDUMP = @USE_RUNDUMP@
 USE_VERSION_SUFFIXES = @USE_VERSION_SUFFIXES@
 VDUMP = @VDUMP@
 VERSION = @VERSION@
@@ -615,6 +693,7 @@ VERSION_MAJOR = @VERSION_MAJOR@
 VERSION_MINOR = @VERSION_MINOR@
 VERSION_PATCH = @VERSION_PATCH@
 VERSION_SUFFIX = @VERSION_SUFFIX@
+VOID_UNSETENV = @VOID_UNSETENV@
 VRESTORE = @VRESTORE@
 VXDUMP = @VXDUMP@
 VXRESTORE = @VXRESTORE@
@@ -643,6 +722,7 @@ am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+amdatadir = @amdatadir@
 amincludedir = @amincludedir@
 amlibdir = @amlibdir@
 amlibexecdir = @amlibexecdir@
@@ -661,6 +741,8 @@ dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 gl_LIBOBJS = @gl_LIBOBJS@
 gl_LTLIBOBJS = @gl_LTLIBOBJS@
+gltests_LIBOBJS = @gltests_LIBOBJS@
+gltests_LTLIBOBJS = @gltests_LTLIBOBJS@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
@@ -690,6 +772,7 @@ target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 SUFFIXES = 
@@ -702,7 +785,7 @@ CLEANFILES = config.log amplot.gp.new
 
 # and we'll need to clean up our generated files for distclean
 DISTCLEANFILES = $(SCRIPTS_SHELL) $(SCRIPTS_PERL) $(SCRIPTS_AWK) \
-       amplot.gp
+       $(SCRIPTS_INCLUDE) $(am__append_1) amplot.gp
 MAINTAINERCLEANFILES = 
 
 # syntax-check shell scripts on 'make check'
@@ -711,6 +794,25 @@ CHECK_SHELL = $(SCRIPTS_SHELL)
 # sed expression to strip leading directories from a filename; this converts e.g.,
 # src/foo/bar.so to bar.so.
 strip_leading_dirs = s|^.*/||
+@WANT_INSTALLPERMS_FALSE@do_file = pa="$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
+@WANT_INSTALLPERMS_FALSE@    echo "installperm \"$$chown\" \"$$chmod\" \"$$pa\"" >> "$(installperms_sh)"
+
+
+# define a snippet of the scripts below to either perform a chown/chmod operation,
+# or record that operation in the logfile.  On entry to the snippet, $$dest is the
+# destination directory, $$cmd is the srcdir-relative pathname of the target file,
+# $$chown is the ownership, and $$chmod is the permission pattern.
+@WANT_INSTALLPERMS_TRUE@do_file = pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
+@WANT_INSTALLPERMS_TRUE@    if test -n "$$chown"; then \
+@WANT_INSTALLPERMS_TRUE@       echo chown "$$chown" "$$pa"; \
+@WANT_INSTALLPERMS_TRUE@       chown "$$chown" "$$pa" || exit 1; \
+@WANT_INSTALLPERMS_TRUE@    fi; \
+@WANT_INSTALLPERMS_TRUE@    if test -n "$$chmod"; then \
+@WANT_INSTALLPERMS_TRUE@       echo chmod "$$chmod" "$$pa"; \
+@WANT_INSTALLPERMS_TRUE@       chmod "$$chmod" "$$pa" || exit 1; \
+@WANT_INSTALLPERMS_TRUE@    fi 
+
+@WANT_INSTALLPERMS_FALSE@installperms_sh = "$(top_builddir)/installperms.sh"
 SCRIPTS_SHELL = amplot
 SCRIPTS_AWK = amcat.awk
 sbin_SCRIPTS = $(SCRIPTS_SHELL)
@@ -871,8 +973,6 @@ maintainer-clean-generic:
        @echo "it deletes files that may require special tools to rebuild."
        -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
        -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-@WANT_INSTALLPERMS_FALSE@install-exec-hook:
-@WANT_INSTALLPERMS_FALSE@install-data-hook:
 clean: clean-am
 
 clean-am: clean-generic clean-libtool mostlyclean-am
@@ -911,7 +1011,7 @@ install-pdf: install-pdf-am
 
 install-ps: install-ps-am
 
-installcheck-am:
+installcheck-am: installcheck-local
 
 maintainer-clean: maintainer-clean-am
        -rm -f Makefile
@@ -942,16 +1042,21 @@ uninstall-am: uninstall-amplotDATA uninstall-sbinSCRIPTS
        install-html-am install-info install-info-am install-man \
        install-pdf install-pdf-am install-ps install-ps-am \
        install-sbinSCRIPTS install-strip installcheck installcheck-am \
-       installdirs maintainer-clean maintainer-clean-generic \
-       mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
-       ps ps-am uninstall uninstall-am uninstall-amplotDATA \
-       uninstall-sbinSCRIPTS
+       installcheck-local installdirs maintainer-clean \
+       maintainer-clean-generic mostlyclean mostlyclean-generic \
+       mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+       uninstall-amplotDATA uninstall-sbinSCRIPTS
 
 
 # Perl
 %: %.pl $(top_builddir)/config.status
        $(top_builddir)/config.status --file=$@:$<
        chmod a+x $@
+       @if test -f $(top_builddir)/perl/.libs/libCmdline.so -o -f $(top_builddir)/perl/libCmdline.so; then \
+               grep -v '^use lib' $@ > $@.nouselib; \
+               $(PERL) $(CHECK_PERL_FLAGS) -I$(top_builddir)/perl -I$(top_builddir)/perl/.libs -I$(top_srcdir)/perl -c -w -T $@.nouselib || exit 1; \
+               rm $@.nouselib; \
+       fi
 
 %.pl: %.pl.in $(top_builddir)/config.status
        $(top_builddir)/config.status --file=$@:$<
@@ -977,13 +1082,27 @@ uninstall-am: uninstall-amplotDATA uninstall-sbinSCRIPTS
 
 # syntax-check perl scripts on 'make check'
 check-perl: $(CHECK_PERL)
+       @CHECK_PERL="$(CHECK_PERL)"; \
+       if test -f $(top_builddir)/perl/.libs/libCmdline.so -o -f $(top_builddir)/perl/libCmdline.so; then \
+               if test -n "$(PERL)"; then \
+                       for perlobj in $$CHECK_PERL; do \
+                               grep -v '^use lib' $$perlobj > $$perlobj.nouselib; \
+                               $(PERL) $(CHECK_PERL_FLAGS) -I$(top_builddir)/perl -I$(top_builddir)/perl/.libs -I$(top_srcdir)/perl -c -w -T $$perlobj.nouselib || exit 1; \
+                               rm $$perlobj.nouselib; \
+                       done; \
+               fi \
+       fi
+check-local: check-perl
+
+# syntax-check perl scripts on 'make installcheck'
+installcheck-perl: $(CHECK_PERL)
        @CHECK_PERL="$(CHECK_PERL)"; \
        if test -n "$(PERL)"; then \
                for perlobj in $$CHECK_PERL; do \
                        $(PERL) $(CHECK_PERL_FLAGS) -c -w -T $$perlobj || exit 1; \
                done; \
        fi
-check-local: check-perl
+installcheck-local: installcheck-perl
 check-shell: $(CHECK_SHELL)
        @CHECK_SHELL="$(CHECK_SHELL)"; \
        if test -n "$$CHECK_SHELL"; then \
@@ -1021,52 +1140,40 @@ dist-scripts:
        true
 dist-hook: dist-scripts
 
-@WANT_INSTALLPERMS_TRUE@installperms-exec:
-@WANT_INSTALLPERMS_TRUE@       @installperms="$(INSTALLPERMS_exec)"; \
-@WANT_INSTALLPERMS_TRUE@       test -n "$$installperms" && echo "Setting installation permissions on executables"; \
-@WANT_INSTALLPERMS_TRUE@       dest=; chown=; chmod=; \
-@WANT_INSTALLPERMS_TRUE@       for cmd in $$installperms; do \
-@WANT_INSTALLPERMS_TRUE@           case "$$cmd" in \
-@WANT_INSTALLPERMS_TRUE@               chown=amanda) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
-@WANT_INSTALLPERMS_TRUE@               dest=*|chown=*|chmod=*) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; eval $$cmd;; \
-@WANT_INSTALLPERMS_TRUE@               *)  pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chown"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chown "$$chown" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chown "$$chown" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chmod"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chmod "$$chmod" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chmod "$$chmod" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@           esac; \
-@WANT_INSTALLPERMS_TRUE@       done
-
-@WANT_INSTALLPERMS_TRUE@installperms-data:
-@WANT_INSTALLPERMS_TRUE@       @installperms="$(INSTALLPERMS_data)"; \
-@WANT_INSTALLPERMS_TRUE@       test -n "$$installperms" && echo "Setting installation permissions on data"; \
-@WANT_INSTALLPERMS_TRUE@       dest=; chown=; chmod=; \
-@WANT_INSTALLPERMS_TRUE@       for cmd in $$installperms; do \
-@WANT_INSTALLPERMS_TRUE@           case "$$cmd" in \
-@WANT_INSTALLPERMS_TRUE@               chown=amanda) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
-@WANT_INSTALLPERMS_TRUE@               dest=*|chown=*|chmod=*) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; eval $$cmd;; \
-@WANT_INSTALLPERMS_TRUE@               *)  pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chown"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chown "$$chown" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chown "$$chown" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chmod"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chmod "$$chmod" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chmod "$$chmod" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@           esac; \
-@WANT_INSTALLPERMS_TRUE@       done
-
-@WANT_INSTALLPERMS_TRUE@install-exec-hook: installperms-exec
-@WANT_INSTALLPERMS_TRUE@install-data-hook: installperms-data
+installperms-exec:
+       @installperms="$(INSTALLPERMS_exec)"; \
+       test -n "$$installperms" && echo "Setting installation permissions on executables"; \
+       dest=; chown=; chmod=; \
+       for cmd in $$installperms; do \
+           case "$$cmd" in \
+               chown=amanda) \
+                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
+               dest=*|chown=*|chmod=*) \
+                       echo "  ($$cmd)"; eval $$cmd;; \
+               *) $(do_file) ;; \
+           esac; \
+       done
+
+installperms-data:
+       @installperms="$(INSTALLPERMS_data)"; \
+       dest=; chown=; chmod=; \
+       for cmd in $$installperms; do \
+           case "$$cmd" in \
+               chown=amanda) \
+                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
+               dest=*|chown=*|chmod=*) \
+                       echo "  ($$cmd)"; eval $$cmd;; \
+               *)  $(do_file) ;; \
+           esac; \
+       done
+
+install-exec-hook: installperms-exec
+install-data-hook: installperms-data
+
+# define a rule to initialize the installperms manifest file
+@WANT_INSTALLPERMS_TRUE@installperms-init:
+@WANT_INSTALLPERMS_FALSE@installperms-init:
+@WANT_INSTALLPERMS_FALSE@      rm -f "$(installperms_sh)"
 
 # A rule to make precompiler output from C files.  This is not used during
 # ordinary builds, but but can very useful in debugging problems on strange
diff --git a/application-src/Makefile.am b/application-src/Makefile.am
new file mode 100644 (file)
index 0000000..ef88154
--- /dev/null
@@ -0,0 +1,62 @@
+# Makefile for Amanda wrapper programs.
+
+include $(top_srcdir)/config/automake/vars.am
+include $(top_srcdir)/config/automake/scripts.am
+include $(top_srcdir)/config/automake/installperms.am
+include $(top_srcdir)/config/automake/precompile.am
+
+INCLUDES =     -I$(top_builddir)/common-src \
+               -I$(top_srcdir)/common-src \
+               -I$(top_srcdir)/client-src \
+               -I$(top_srcdir)/amandad-src \
+               -I$(top_srcdir)/gnulib
+
+LINT=$(AMLINT)
+LINTFLAGS=$(AMLINTFLAGS)
+
+LIB_EXTENSION = la
+
+AM_CFLAGS = $(AMANDA_WARNING_CFLAGS)
+AM_LDFLAGS = $(AMANDA_STATIC_LDFLAGS)
+
+CHECK_PERL = amgtar_perl \
+            script-email \
+            amlog-script \
+            amzfs-sendrecv \
+            amzfs-snapshot \
+            amsamba
+
+SCRIPTS_PERL = $(CHECK_PERL)
+
+SCRIPTS_SHELL = $(amlibexec_SCRIPTS)
+
+amlibexec_PROGRAMS = teecount
+
+#We use two variables, applicationdir applicationexecdir, to segregate the
+#platform-independent (applicationdir) files installed by install-data from the
+#platform-dependent files (applicationexecdir) installed by install-exec. 
+#Automake recognizes the 'exec' substring in the variable name.  From the
+#Automake manual: "Any variable using a user-defined directory prefix with
+#‘exec’ in the name (e.g., myexecbin_PROGRAMS) is installed by install-exec.
+#All other user-defined prefixes are installed by install-data." (section 12.2)
+applicationexecdir = $(APPLICATION_DIR)
+applicationdir = $(APPLICATION_DIR)
+applicationexec_PROGRAMS = amgtar amstar
+applicationexec_SCRIPTS = $(SCRIPTS_PERL)
+
+LDADD = ../common-src/libamanda.$(LIB_EXTENSION) \
+       ../client-src/libamclient.$(LIB_EXTENSION) \
+       ../amandad-src/libamandad.$(LIB_EXTENSION) \
+       ../common-src/libamanda.$(LIB_EXTENSION) \
+       ../gnulib/libgnu.$(LIB_EXTENSION)
+
+INSTALLPERMS_exec = dest=$(amlibexecdir) chown=amanda $(amlibexec_PROGRAMS) \
+                   dest=$(applicationdir) chown=amanda $(applicationexec_PROGRAMS) \
+                   dest=$(applicationdir) chown=amanda $(applicationexec_SCRIPTS)
+
+INSTALLPERMS_data = dest=$(amlibexecdir) chown=amanda $(amlibexec_SCRIPTS)
+
+if WANT_SETUID_CLIENT
+INSTALLPERMS_exec += dest=$(applicationdir) chown=root chmod=04750 \
+                    amgtar amstar
+endif
diff --git a/application-src/Makefile.in b/application-src/Makefile.in
new file mode 100644 (file)
index 0000000..c83ca6f
--- /dev/null
@@ -0,0 +1,1395 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008  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@
+
+# Makefile for Amanda wrapper programs.
+
+# vim:ft=automake
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+# 
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License version 2.1 as 
+# published by the Free Software Foundation.
+# 
+# This 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 this library; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+# 
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+# simple include file to pre-define variables which are then +='d by other
+# scripts in this directory.
+
+# vim:ft=automake
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+# 
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License version 2.1 as 
+# published by the Free Software Foundation.
+# 
+# This 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 this library; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+# 
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+# SYNOPSIS:
+#
+# Automake magic to handle the various tasks of building scripts.  Scripts can
+# be built down to extensionless executables (e.g., foo.pl -> foo), or to 
+# files with the usual extension (foo-lib.sh.in -> foo.sh).
+#
+# Files which support it are syntax-checked when the user invokes 'make check'.
+#
+# All *target* filenames must be listed in SCRIPTS_SHELL, SCRIPTS_PERL, and 
+# SCRIPTS_AWK to support 'make check', 'make dist', and 'make distclean'. No
+# files which are not substituted by config.status should be included in
+# SCRIPTS_PERL, SCRIPTS_SHELL, or SCRIPTS_AWK.  If non-generated files are listed
+# for installation, then Automake will figure out that they should be distributed;
+# otherwise, include them in EXTRA_DIST.
+#
+# USAGE:
+#
+#   include $(top_srcdir)/config/automake/vars.am
+#   include $(top_srcdir)/config/automake/scripts.am
+#   ...
+#   SCRIPTS_PERL = fooscript barscript perl-lib.pl perlmod.pm
+#   SCRIPTS_SHELL = shell1 shell2 sh-lib.sh
+#   SCRIPTS_AWK = talk balk chalk awk-lib.awk
+#   sbin_SCRIPTS = not-subbed
+#   EXTRA_DIST = util-script.pl
+#
+# with the corresponding files in the repository:
+#
+#   fooscript.pl barscript.pl perl-lib.pl.in perlmod.pm.in
+#   shell1.sh shell2.sh sh-lib.sh.in
+#   talk.awk balk.awk chalk.awk awk-lib.awk.in
+#   not-subbed util-script.pl
+#
+# by default, all shell and perl scripts are syntax checked.  If this is
+# a problem (for example, perl scripts depending on Amanda extension 
+# modules), then assign to CHECK_{PERL,SHELL} the list of files you wish
+# to be checked (which can be empty).
+#
+# To add extra flags to the perl checks (e.g., to add new -I flags), set
+# CHECK_PERL_FLAGS.
+
+# Implementation note:
+#
+# This file uses config.status to substitute @foo@ in those scripts while
+# converting them. It also adds the executable bits (a+x) to extensionless
+# files.  The substitution works even though the files are not listed in 
+# configure.in
+
+# vim:ft=automake
+#
+# Adjust post-install permissions settings.  This rule works off two
+# specially-formatted variables, INSTALLPERMS_exec and INSTALLPERMS_data. 
+# Each is a whitespace-separated list of commands, all of which are either
+# a variable assignment or a filename.  Three variables are available:
+#
+#  - dest= sets the destination directory to e.g., $(sbindir)
+#  - chown= controls changes in ownership; value is first argument to chown
+#  - chmod= controls changes in permissions; value is first argument to chmod
+#
+# As a special case, chown=amanda is taken as equivalent to 
+# chown=$(BINARY_OWNER):$(SETUID_GROUP), which may otherwise have problems with
+# whitespace in the user/group names.
+# 
+# when a filename is seen, the currently active variables are applied.
+#
+# Note that scripts are data, not executables!
+#
+# EXAMPLE
+#
+# sbin_PROGRAMS = foo bar bing
+# libexec_PROGRAMS = pro gram
+# sbin_SCRIPTS = sk ript
+# INSTALLPERMS_exec = \
+#      dest=$(sbindir) chown=amanda chmod= \
+#              foo bar \
+#      chmod=07450 \
+#              bing
+#      dest=$(libexecdir) chmod= \
+#              $(libexec_PROGRAMS)
+# INSTALLPERMS_data = \
+#      dest=$(sbindir) chown=amanda chmod= \
+#              $(sbin_SCRIPTS)
+#
+# This whole operation is not required when making builds for packaging,
+# and can be disabled with --disable-installperms, via the WANT_INSTALLPERMS
+# AM_CONDITIONAL.  When disabled, the file 'installperms.sh' in the top-level
+# build directory is populated with a format suitable for shell interpretation,
+# with lines like this:
+#   installperm "amanda:disk" "04750" "/usr/local/sbin/bing"
+# the arguments being, respectively, owner:group, mode, and filename.  There will
+# be exactly one line for each file which has specific permissions.  The intention
+# is that this file be used by packaging scripts to set correct permissions at install
+# time.  Note that files which have no special permissions requirements do not appear 
+# in this file at all, due to limitations of Automake.
+
+# vim:ft=automake
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+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@
+target_triplet = @target@
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+       $(top_srcdir)/config/automake/installperms.am \
+       $(top_srcdir)/config/automake/precompile.am \
+       $(top_srcdir)/config/automake/scripts.am \
+       $(top_srcdir)/config/automake/vars.am
+@WANT_INSTALLPERMS_FALSE@am__append_1 = $(installperms_sh)
+amlibexec_PROGRAMS = teecount$(EXEEXT)
+applicationexec_PROGRAMS = amgtar$(EXEEXT) amstar$(EXEEXT)
+@WANT_SETUID_CLIENT_TRUE@am__append_2 = dest=$(applicationdir) chown=root chmod=04750 \
+@WANT_SETUID_CLIENT_TRUE@                   amgtar amstar
+
+subdir = application-src
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps =  \
+       $(top_srcdir)/config/macro-archive/ac_define_dir.m4 \
+       $(top_srcdir)/config/macro-archive/ac_perl_module_version.m4 \
+       $(top_srcdir)/config/macro-archive/ac_prog_perl_version.m4 \
+       $(top_srcdir)/config/macro-archive/ac_prog_swig.m4 \
+       $(top_srcdir)/config/macro-archive/ax_compare_version.m4 \
+       $(top_srcdir)/config/macro-archive/docbook-dtd.m4 \
+       $(top_srcdir)/config/macro-archive/docbook-xslt-min.m4 \
+       $(top_srcdir)/config/macro-archive/docbook-xslt.m4 \
+       $(top_srcdir)/config/macro-archive/xsltproc.m4 \
+       $(top_srcdir)/config/amanda/amplot.m4 \
+       $(top_srcdir)/config/amanda/bsd-security.m4 \
+       $(top_srcdir)/config/amanda/bsdtcp-security.m4 \
+       $(top_srcdir)/config/amanda/bsdudp-security.m4 \
+       $(top_srcdir)/config/amanda/changer.m4 \
+       $(top_srcdir)/config/amanda/components.m4 \
+       $(top_srcdir)/config/amanda/compress.m4 \
+       $(top_srcdir)/config/amanda/config.m4 \
+       $(top_srcdir)/config/amanda/debugging.m4 \
+       $(top_srcdir)/config/amanda/defaults.m4 \
+       $(top_srcdir)/config/amanda/devprefix.m4 \
+       $(top_srcdir)/config/amanda/dirs.m4 \
+       $(top_srcdir)/config/amanda/documentation.m4 \
+       $(top_srcdir)/config/amanda/dumpers.m4 \
+       $(top_srcdir)/config/amanda/flags.m4 \
+       $(top_srcdir)/config/amanda/flock.m4 \
+       $(top_srcdir)/config/amanda/funcs.m4 \
+       $(top_srcdir)/config/amanda/getfsent.m4 \
+       $(top_srcdir)/config/amanda/i18n.m4 \
+       $(top_srcdir)/config/amanda/ipv6.m4 \
+       $(top_srcdir)/config/amanda/krb4-security.m4 \
+       $(top_srcdir)/config/amanda/krb5-security.m4 \
+       $(top_srcdir)/config/amanda/lfs.m4 \
+       $(top_srcdir)/config/amanda/libs.m4 \
+       $(top_srcdir)/config/amanda/net.m4 \
+       $(top_srcdir)/config/amanda/progs.m4 \
+       $(top_srcdir)/config/amanda/ps.m4 \
+       $(top_srcdir)/config/amanda/readdir.m4 \
+       $(top_srcdir)/config/amanda/readline.m4 \
+       $(top_srcdir)/config/amanda/rsh-security.m4 \
+       $(top_srcdir)/config/amanda/s3-device.m4 \
+       $(top_srcdir)/config/amanda/shmem.m4 \
+       $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \
+       $(top_srcdir)/config/amanda/ssh-security.m4 \
+       $(top_srcdir)/config/amanda/summary.m4 \
+       $(top_srcdir)/config/amanda/swig.m4 \
+       $(top_srcdir)/config/amanda/syshacks.m4 \
+       $(top_srcdir)/config/amanda/tape.m4 \
+       $(top_srcdir)/config/amanda/types.m4 \
+       $(top_srcdir)/config/amanda/userid.m4 \
+       $(top_srcdir)/config/amanda/version.m4 \
+       $(top_srcdir)/config/gnulib/alloca.m4 \
+       $(top_srcdir)/config/gnulib/arpa_inet_h.m4 \
+       $(top_srcdir)/config/gnulib/base64.m4 \
+       $(top_srcdir)/config/gnulib/eoverflow.m4 \
+       $(top_srcdir)/config/gnulib/extensions.m4 \
+       $(top_srcdir)/config/gnulib/float_h.m4 \
+       $(top_srcdir)/config/gnulib/fsusage.m4 \
+       $(top_srcdir)/config/gnulib/getaddrinfo.m4 \
+       $(top_srcdir)/config/gnulib/getopt.m4 \
+       $(top_srcdir)/config/gnulib/gettimeofday.m4 \
+       $(top_srcdir)/config/gnulib/gnulib-common.m4 \
+       $(top_srcdir)/config/gnulib/gnulib-comp.m4 \
+       $(top_srcdir)/config/gnulib/include_next.m4 \
+       $(top_srcdir)/config/gnulib/inet_ntop.m4 \
+       $(top_srcdir)/config/gnulib/intmax_t.m4 \
+       $(top_srcdir)/config/gnulib/lock.m4 \
+       $(top_srcdir)/config/gnulib/longlong.m4 \
+       $(top_srcdir)/config/gnulib/malloc.m4 \
+       $(top_srcdir)/config/gnulib/mkdtemp.m4 \
+       $(top_srcdir)/config/gnulib/netinet_in_h.m4 \
+       $(top_srcdir)/config/gnulib/onceonly_2_57.m4 \
+       $(top_srcdir)/config/gnulib/physmem.m4 \
+       $(top_srcdir)/config/gnulib/safe-read.m4 \
+       $(top_srcdir)/config/gnulib/safe-write.m4 \
+       $(top_srcdir)/config/gnulib/snprintf.m4 \
+       $(top_srcdir)/config/gnulib/socklen.m4 \
+       $(top_srcdir)/config/gnulib/sockpfaf.m4 \
+       $(top_srcdir)/config/gnulib/ssize_t.m4 \
+       $(top_srcdir)/config/gnulib/stdbool.m4 \
+       $(top_srcdir)/config/gnulib/stdint.m4 \
+       $(top_srcdir)/config/gnulib/stdio_h.m4 \
+       $(top_srcdir)/config/gnulib/stdlib_h.m4 \
+       $(top_srcdir)/config/gnulib/strdup.m4 \
+       $(top_srcdir)/config/gnulib/string_h.m4 \
+       $(top_srcdir)/config/gnulib/sys_socket_h.m4 \
+       $(top_srcdir)/config/gnulib/sys_stat_h.m4 \
+       $(top_srcdir)/config/gnulib/sys_time_h.m4 \
+       $(top_srcdir)/config/gnulib/tempname.m4 \
+       $(top_srcdir)/config/gnulib/unistd_h.m4 \
+       $(top_srcdir)/config/gnulib/vasnprintf.m4 \
+       $(top_srcdir)/config/gnulib/visibility.m4 \
+       $(top_srcdir)/config/gnulib/wchar.m4 \
+       $(top_srcdir)/config/gettext-macros/gettext.m4 \
+       $(top_srcdir)/config/gettext-macros/iconv.m4 \
+       $(top_srcdir)/config/gettext-macros/inttypes_h.m4 \
+       $(top_srcdir)/config/gettext-macros/lib-ld.m4 \
+       $(top_srcdir)/config/gettext-macros/lib-link.m4 \
+       $(top_srcdir)/config/gettext-macros/lib-prefix.m4 \
+       $(top_srcdir)/config/gettext-macros/nls.m4 \
+       $(top_srcdir)/config/gettext-macros/po.m4 \
+       $(top_srcdir)/config/gettext-macros/progtest.m4 \
+       $(top_srcdir)/config/gettext-macros/size_max.m4 \
+       $(top_srcdir)/config/gettext-macros/stdint_h.m4 \
+       $(top_srcdir)/config/gettext-macros/wchar_t.m4 \
+       $(top_srcdir)/config/gettext-macros/wint_t.m4 \
+       $(top_srcdir)/config/gettext-macros/xsize.m4 \
+       $(top_srcdir)/config/libtool.m4 $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config/config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(amlibexecdir)" \
+       "$(DESTDIR)$(applicationexecdir)" \
+       "$(DESTDIR)$(applicationexecdir)"
+amlibexecPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+applicationexecPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(amlibexec_PROGRAMS) $(applicationexec_PROGRAMS)
+amgtar_SOURCES = amgtar.c
+amgtar_OBJECTS = amgtar.$(OBJEXT)
+amgtar_LDADD = $(LDADD)
+amgtar_DEPENDENCIES = ../common-src/libamanda.$(LIB_EXTENSION) \
+       ../client-src/libamclient.$(LIB_EXTENSION) \
+       ../amandad-src/libamandad.$(LIB_EXTENSION) \
+       ../common-src/libamanda.$(LIB_EXTENSION) \
+       ../gnulib/libgnu.$(LIB_EXTENSION)
+amstar_SOURCES = amstar.c
+amstar_OBJECTS = amstar.$(OBJEXT)
+amstar_LDADD = $(LDADD)
+amstar_DEPENDENCIES = ../common-src/libamanda.$(LIB_EXTENSION) \
+       ../client-src/libamclient.$(LIB_EXTENSION) \
+       ../amandad-src/libamandad.$(LIB_EXTENSION) \
+       ../common-src/libamanda.$(LIB_EXTENSION) \
+       ../gnulib/libgnu.$(LIB_EXTENSION)
+teecount_SOURCES = teecount.c
+teecount_OBJECTS = teecount.$(OBJEXT)
+teecount_LDADD = $(LDADD)
+teecount_DEPENDENCIES = ../common-src/libamanda.$(LIB_EXTENSION) \
+       ../client-src/libamclient.$(LIB_EXTENSION) \
+       ../amandad-src/libamandad.$(LIB_EXTENSION) \
+       ../common-src/libamanda.$(LIB_EXTENSION) \
+       ../gnulib/libgnu.$(LIB_EXTENSION)
+applicationexecSCRIPT_INSTALL = $(INSTALL_SCRIPT)
+SCRIPTS = $(applicationexec_SCRIPTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/config
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+       --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+       $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+       --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+       $(LDFLAGS) -o $@
+SOURCES = amgtar.c amstar.c teecount.c
+DIST_SOURCES = amgtar.c amstar.c teecount.c
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AIX_BACKUP = @AIX_BACKUP@
+ALLOCA = @ALLOCA@
+ALLOCA_H = @ALLOCA_H@
+AMANDA_DBGDIR = @AMANDA_DBGDIR@
+AMANDA_DEBUG_DAYS = @AMANDA_DEBUG_DAYS@
+AMANDA_STATIC_LDFLAGS = @AMANDA_STATIC_LDFLAGS@
+AMANDA_TMPDIR = @AMANDA_TMPDIR@
+AMANDA_WARNING_CFLAGS = @AMANDA_WARNING_CFLAGS@
+AMLINT = @AMLINT@
+AMLINTFLAGS = @AMLINTFLAGS@
+AMPLOT_CAT_COMPRESS = @AMPLOT_CAT_COMPRESS@
+AMPLOT_CAT_GZIP = @AMPLOT_CAT_GZIP@
+AMPLOT_CAT_PACK = @AMPLOT_CAT_PACK@
+AMPLOT_COMPRESS = @AMPLOT_COMPRESS@
+AMTAR = @AMTAR@
+APPLICATION_DIR = @APPLICATION_DIR@
+AR = @AR@
+ARPA_INET_H = @ARPA_INET_H@
+ASSERTIONS = @ASSERTIONS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASH = @BASH@
+BINARY_OWNER = @BINARY_OWNER@
+BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@
+BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@
+BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@
+BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@
+BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@
+BSDTCP_SECURITY = @BSDTCP_SECURITY@
+BSDUDP_SECURITY = @BSDUDP_SECURITY@
+BSD_SECURITY = @BSD_SECURITY@
+CAT = @CAT@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
+CHECK_USERID = @CHECK_USERID@
+CHIO = @CHIO@
+CHS = @CHS@
+CLIENT_HOST_INSTANCE = @CLIENT_HOST_INSTANCE@
+CLIENT_HOST_KEY_FILE = @CLIENT_HOST_KEY_FILE@
+CLIENT_HOST_PRINCIPAL = @CLIENT_HOST_PRINCIPAL@
+CLIENT_LOGIN = @CLIENT_LOGIN@
+CLIENT_SCRIPTS_OPT = @CLIENT_SCRIPTS_OPT@
+COMPRESS = @COMPRESS@
+COMPRESS_BEST_OPT = @COMPRESS_BEST_OPT@
+COMPRESS_FAST_OPT = @COMPRESS_FAST_OPT@
+COMPRESS_PATH = @COMPRESS_PATH@
+COMPRESS_SUFFIX = @COMPRESS_SUFFIX@
+CONFIG_CLOBBER_MY_CONFIG = @CONFIG_CLOBBER_MY_CONFIG@
+CONFIG_DIR = @CONFIG_DIR@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CURL_CONFIG = @CURL_CONFIG@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DD = @DD@
+DEFAULT_AMANDATES_FILE = @DEFAULT_AMANDATES_FILE@
+DEFAULT_CHANGER_DEVICE = @DEFAULT_CHANGER_DEVICE@
+DEFAULT_CONFIG = @DEFAULT_CONFIG@
+DEFAULT_MAILER = @DEFAULT_MAILER@
+DEFAULT_SERVER = @DEFAULT_SERVER@
+DEFAULT_TAPE_DEVICE = @DEFAULT_TAPE_DEVICE@
+DEFAULT_TAPE_SERVER = @DEFAULT_TAPE_SERVER@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DOC_BUILD_DATE = @DOC_BUILD_DATE@
+DUMP = @DUMP@
+DUMP_RETURNS_1 = @DUMP_RETURNS_1@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EOVERFLOW = @EOVERFLOW@
+EXAMPLE_TAPEDEV = @EXAMPLE_TAPEDEV@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FLOAT_H = @FLOAT_H@
+GETCONF = @GETCONF@
+GETOPT_H = @GETOPT_H@
+GETTEXT = @GETTEXT@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+GLIB_LIBS = @GLIB_LIBS@
+GLIB_MKENUMS = @GLIB_MKENUMS@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
+GNULIB_CHOWN = @GNULIB_CHOWN@
+GNULIB_DUP2 = @GNULIB_DUP2@
+GNULIB_ENVIRON = @GNULIB_ENVIRON@
+GNULIB_FCHDIR = @GNULIB_FCHDIR@
+GNULIB_FFLUSH = @GNULIB_FFLUSH@
+GNULIB_FOPEN = @GNULIB_FOPEN@
+GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
+GNULIB_FREOPEN = @GNULIB_FREOPEN@
+GNULIB_FSEEK = @GNULIB_FSEEK@
+GNULIB_FSEEKO = @GNULIB_FSEEKO@
+GNULIB_FTELL = @GNULIB_FTELL@
+GNULIB_FTELLO = @GNULIB_FTELLO@
+GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@
+GNULIB_GETCWD = @GNULIB_GETCWD@
+GNULIB_GETDELIM = @GNULIB_GETDELIM@
+GNULIB_GETLINE = @GNULIB_GETLINE@
+GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
+GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@
+GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
+GNULIB_LCHOWN = @GNULIB_LCHOWN@
+GNULIB_LSEEK = @GNULIB_LSEEK@
+GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@
+GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@
+GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@
+GNULIB_MBSCHR = @GNULIB_MBSCHR@
+GNULIB_MBSCSPN = @GNULIB_MBSCSPN@
+GNULIB_MBSLEN = @GNULIB_MBSLEN@
+GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@
+GNULIB_MBSNLEN = @GNULIB_MBSNLEN@
+GNULIB_MBSPBRK = @GNULIB_MBSPBRK@
+GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@
+GNULIB_MBSRCHR = @GNULIB_MBSRCHR@
+GNULIB_MBSSEP = @GNULIB_MBSSEP@
+GNULIB_MBSSPN = @GNULIB_MBSSPN@
+GNULIB_MBSSTR = @GNULIB_MBSSTR@
+GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@
+GNULIB_MEMMEM = @GNULIB_MEMMEM@
+GNULIB_MEMPCPY = @GNULIB_MEMPCPY@
+GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
+GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
+GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
+GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
+GNULIB_PUTENV = @GNULIB_PUTENV@
+GNULIB_READLINK = @GNULIB_READLINK@
+GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@
+GNULIB_SETENV = @GNULIB_SETENV@
+GNULIB_SLEEP = @GNULIB_SLEEP@
+GNULIB_SNPRINTF = @GNULIB_SNPRINTF@
+GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@
+GNULIB_STPCPY = @GNULIB_STPCPY@
+GNULIB_STPNCPY = @GNULIB_STPNCPY@
+GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
+GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
+GNULIB_STRDUP = @GNULIB_STRDUP@
+GNULIB_STRERROR = @GNULIB_STRERROR@
+GNULIB_STRNDUP = @GNULIB_STRNDUP@
+GNULIB_STRNLEN = @GNULIB_STRNLEN@
+GNULIB_STRPBRK = @GNULIB_STRPBRK@
+GNULIB_STRSEP = @GNULIB_STRSEP@
+GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@
+GNULIB_STRSTR = @GNULIB_STRSTR@
+GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
+GNULIB_UNSETENV = @GNULIB_UNSETENV@
+GNULIB_VASPRINTF = @GNULIB_VASPRINTF@
+GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@
+GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
+GNULIB_VSNPRINTF = @GNULIB_VSNPRINTF@
+GNULIB_VSPRINTF_POSIX = @GNULIB_VSPRINTF_POSIX@
+GNULIB_WCWIDTH = @GNULIB_WCWIDTH@
+GNUPLOT = @GNUPLOT@
+GNUTAR = @GNUTAR@
+GNUTAR_LISTED_INCREMENTAL_DIR = @GNUTAR_LISTED_INCREMENTAL_DIR@
+GOBJECT_QUERY = @GOBJECT_QUERY@
+GREP = @GREP@
+GZIP = @GZIP@
+HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@
+HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@
+HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@
+HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@
+HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
+HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@
+HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
+HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@
+HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
+HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
+HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@
+HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
+HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
+HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@
+HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
+HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
+HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
+HAVE_DUP2 = @HAVE_DUP2@
+HAVE_FSEEKO = @HAVE_FSEEKO@
+HAVE_FTELLO = @HAVE_FTELLO@
+HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
+HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
+HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
+HAVE_GZIP = @HAVE_GZIP@
+HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
+HAVE_IO_H = @HAVE_IO_H@
+HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
+HAVE_LSTAT = @HAVE_LSTAT@
+HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@
+HAVE_MEMPCPY = @HAVE_MEMPCPY@
+HAVE_MKDTEMP = @HAVE_MKDTEMP@
+HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@
+HAVE_OS_H = @HAVE_OS_H@
+HAVE_READLINK = @HAVE_READLINK@
+HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@
+HAVE_SETENV = @HAVE_SETENV@
+HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
+HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
+HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
+HAVE_SLEEP = @HAVE_SLEEP@
+HAVE_STDINT_H = @HAVE_STDINT_H@
+HAVE_STPCPY = @HAVE_STPCPY@
+HAVE_STPNCPY = @HAVE_STPNCPY@
+HAVE_STRCASESTR = @HAVE_STRCASESTR@
+HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
+HAVE_STRNDUP = @HAVE_STRNDUP@
+HAVE_STRPBRK = @HAVE_STRPBRK@
+HAVE_STRSEP = @HAVE_STRSEP@
+HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@
+HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
+HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
+HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
+HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
+HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
+HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
+HAVE_UNISTD_H = @HAVE_UNISTD_H@
+HAVE_UNSETENV = @HAVE_UNSETENV@
+HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
+HAVE_VASPRINTF = @HAVE_VASPRINTF@
+HAVE_VISIBILITY = @HAVE_VISIBILITY@
+HAVE_WCHAR_H = @HAVE_WCHAR_H@
+HAVE_WINSOCK2_H = @HAVE_WINSOCK2_H@
+HAVE_WS2TCPIP_H = @HAVE_WS2TCPIP_H@
+HAVE__BOOL = @HAVE__BOOL@
+INCLUDE_NEXT = @INCLUDE_NEXT@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+KRB4_SECURITY = @KRB4_SECURITY@
+KRB5_SECURITY = @KRB5_SECURITY@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBCURL = @LIBCURL@
+LIBCURL_CPPFLAGS = @LIBCURL_CPPFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBMULTITHREAD = @LIBMULTITHREAD@
+LIBOBJS = @LIBOBJS@
+LIBPTH = @LIBPTH@
+LIBS = @LIBS@
+LIBTHREAD = @LIBTHREAD@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LN_S = @LN_S@
+LOCKING = @LOCKING@
+LOW_TCPPORTRANGE = @LOW_TCPPORTRANGE@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
+LTLIBOBJS = @LTLIBOBJS@
+LTLIBPTH = @LTLIBPTH@
+LTLIBTHREAD = @LTLIBTHREAD@
+MAILER = @MAILER@
+MAKEINFO = @MAKEINFO@
+MCUTIL = @MCUTIL@
+MKDIR_P = @MKDIR_P@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+MT = @MT@
+MTX = @MTX@
+MT_FILE_FLAG = @MT_FILE_FLAG@
+NETINET_IN_H = @NETINET_IN_H@
+NEXT_FLOAT_H = @NEXT_FLOAT_H@
+NEXT_NETINET_IN_H = @NEXT_NETINET_IN_H@
+NEXT_STDINT_H = @NEXT_STDINT_H@
+NEXT_STDIO_H = @NEXT_STDIO_H@
+NEXT_STDLIB_H = @NEXT_STDLIB_H@
+NEXT_STRING_H = @NEXT_STRING_H@
+NEXT_SYS_SOCKET_H = @NEXT_SYS_SOCKET_H@
+NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@
+NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@
+NEXT_UNISTD_H = @NEXT_UNISTD_H@
+NEXT_WCHAR_H = @NEXT_WCHAR_H@
+OBJEXT = @OBJEXT@
+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@
+PCAT = @PCAT@
+PERL = @PERL@
+PERLEXTLIBS = @PERLEXTLIBS@
+PERL_INC = @PERL_INC@
+PKG_CONFIG = @PKG_CONFIG@
+POSUB = @POSUB@
+PRINT = @PRINT@
+PS = @PS@
+PS_ARGUMENT = @PS_ARGUMENT@
+PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
+RANLIB = @RANLIB@
+READLINE_LIBS = @READLINE_LIBS@
+REPLACE_CHOWN = @REPLACE_CHOWN@
+REPLACE_FCHDIR = @REPLACE_FCHDIR@
+REPLACE_FFLUSH = @REPLACE_FFLUSH@
+REPLACE_FOPEN = @REPLACE_FOPEN@
+REPLACE_FPRINTF = @REPLACE_FPRINTF@
+REPLACE_FREOPEN = @REPLACE_FREOPEN@
+REPLACE_FSEEK = @REPLACE_FSEEK@
+REPLACE_FSEEKO = @REPLACE_FSEEKO@
+REPLACE_FTELL = @REPLACE_FTELL@
+REPLACE_FTELLO = @REPLACE_FTELLO@
+REPLACE_GETCWD = @REPLACE_GETCWD@
+REPLACE_GETLINE = @REPLACE_GETLINE@
+REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
+REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
+REPLACE_LCHOWN = @REPLACE_LCHOWN@
+REPLACE_LSEEK = @REPLACE_LSEEK@
+REPLACE_MEMMEM = @REPLACE_MEMMEM@
+REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
+REPLACE_PRINTF = @REPLACE_PRINTF@
+REPLACE_PUTENV = @REPLACE_PUTENV@
+REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
+REPLACE_SPRINTF = @REPLACE_SPRINTF@
+REPLACE_STRCASESTR = @REPLACE_STRCASESTR@
+REPLACE_STRERROR = @REPLACE_STRERROR@
+REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@
+REPLACE_STRSTR = @REPLACE_STRSTR@
+REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
+REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
+REPLACE_VPRINTF = @REPLACE_VPRINTF@
+REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
+REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
+REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
+RESTORE = @RESTORE@
+RSH_SECURITY = @RSH_SECURITY@
+SAMBA_CLIENT = @SAMBA_CLIENT@
+SERVER_HOST_INSTANCE = @SERVER_HOST_INSTANCE@
+SERVER_HOST_KEY_FILE = @SERVER_HOST_KEY_FILE@
+SERVER_HOST_PRINCIPAL = @SERVER_HOST_PRINCIPAL@
+SERVICE_SUFFIX = @SERVICE_SUFFIX@
+SETUID_GROUP = @SETUID_GROUP@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@
+SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
+SNAPSHOT_STAMP = @SNAPSHOT_STAMP@
+SORT = @SORT@
+SSH = @SSH@
+SSH_SECURITY = @SSH_SECURITY@
+STDBOOL_H = @STDBOOL_H@
+STDINT_H = @STDINT_H@
+STRIP = @STRIP@
+SVN = @SVN@
+SWIG = @SWIG@
+SWIG_LIB = @SWIG_LIB@
+SYS_SOCKET_H = @SYS_SOCKET_H@
+SYS_STAT_H = @SYS_STAT_H@
+SYS_TIME_H = @SYS_TIME_H@
+TCPPORTRANGE = @TCPPORTRANGE@
+TICKET_LIFETIME = @TICKET_LIFETIME@
+UDPPORTRANGE = @UDPPORTRANGE@
+UNCOMPRESS_OPT = @UNCOMPRESS_OPT@
+UNCOMPRESS_PATH = @UNCOMPRESS_PATH@
+USE_AMANDAHOSTS = @USE_AMANDAHOSTS@
+USE_NLS = @USE_NLS@
+USE_RUNDUMP = @USE_RUNDUMP@
+USE_VERSION_SUFFIXES = @USE_VERSION_SUFFIXES@
+VDUMP = @VDUMP@
+VERSION = @VERSION@
+VERSION_COMMENT = @VERSION_COMMENT@
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MINOR = @VERSION_MINOR@
+VERSION_PATCH = @VERSION_PATCH@
+VERSION_SUFFIX = @VERSION_SUFFIX@
+VOID_UNSETENV = @VOID_UNSETENV@
+VRESTORE = @VRESTORE@
+VXDUMP = @VXDUMP@
+VXRESTORE = @VXRESTORE@
+WCHAR_H = @WCHAR_H@
+WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@
+WINT_T_SUFFIX = @WINT_T_SUFFIX@
+XFSDUMP = @XFSDUMP@
+XFSRESTORE = @XFSRESTORE@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+XSLREL = @XSLREL@
+XSLTPROC = @XSLTPROC@
+XSLTPROC_FLAGS = @XSLTPROC_FLAGS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+_libcurl_config = @_libcurl_config@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amdatadir = @amdatadir@
+amincludedir = @amincludedir@
+amlibdir = @amlibdir@
+amlibexecdir = @amlibexecdir@
+amperldir = @amperldir@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+gl_LIBOBJS = @gl_LIBOBJS@
+gl_LTLIBOBJS = @gl_LTLIBOBJS@
+gltests_LIBOBJS = @gltests_LIBOBJS@
+gltests_LTLIBOBJS = @gltests_LTLIBOBJS@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+SUFFIXES = 
+EXTRA_DIST = 
+BUILT_SOURCES = 
+MOSTLYCLEANFILES = 
+
+# config.status leaves config.log files around
+CLEANFILES = config.log
+
+# and we'll need to clean up our generated files for distclean
+DISTCLEANFILES = $(SCRIPTS_SHELL) $(SCRIPTS_PERL) $(SCRIPTS_AWK) \
+       $(SCRIPTS_INCLUDE) $(am__append_1)
+MAINTAINERCLEANFILES = 
+
+# syntax-check shell scripts on 'make check'
+CHECK_SHELL = $(SCRIPTS_SHELL)
+
+# sed expression to strip leading directories from a filename; this converts e.g.,
+# src/foo/bar.so to bar.so.
+strip_leading_dirs = s|^.*/||
+@WANT_INSTALLPERMS_FALSE@do_file = pa="$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
+@WANT_INSTALLPERMS_FALSE@    echo "installperm \"$$chown\" \"$$chmod\" \"$$pa\"" >> "$(installperms_sh)"
+
+
+# define a snippet of the scripts below to either perform a chown/chmod operation,
+# or record that operation in the logfile.  On entry to the snippet, $$dest is the
+# destination directory, $$cmd is the srcdir-relative pathname of the target file,
+# $$chown is the ownership, and $$chmod is the permission pattern.
+@WANT_INSTALLPERMS_TRUE@do_file = pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
+@WANT_INSTALLPERMS_TRUE@    if test -n "$$chown"; then \
+@WANT_INSTALLPERMS_TRUE@       echo chown "$$chown" "$$pa"; \
+@WANT_INSTALLPERMS_TRUE@       chown "$$chown" "$$pa" || exit 1; \
+@WANT_INSTALLPERMS_TRUE@    fi; \
+@WANT_INSTALLPERMS_TRUE@    if test -n "$$chmod"; then \
+@WANT_INSTALLPERMS_TRUE@       echo chmod "$$chmod" "$$pa"; \
+@WANT_INSTALLPERMS_TRUE@       chmod "$$chmod" "$$pa" || exit 1; \
+@WANT_INSTALLPERMS_TRUE@    fi 
+
+@WANT_INSTALLPERMS_FALSE@installperms_sh = "$(top_builddir)/installperms.sh"
+INCLUDES = -I$(top_builddir)/common-src \
+               -I$(top_srcdir)/common-src \
+               -I$(top_srcdir)/client-src \
+               -I$(top_srcdir)/amandad-src \
+               -I$(top_srcdir)/gnulib
+
+LINT = $(AMLINT)
+LINTFLAGS = $(AMLINTFLAGS)
+LIB_EXTENSION = la
+AM_CFLAGS = $(AMANDA_WARNING_CFLAGS)
+AM_LDFLAGS = $(AMANDA_STATIC_LDFLAGS)
+CHECK_PERL = amgtar_perl \
+            script-email \
+            amlog-script \
+            amzfs-sendrecv \
+            amzfs-snapshot \
+            amsamba
+
+SCRIPTS_PERL = $(CHECK_PERL)
+SCRIPTS_SHELL = $(amlibexec_SCRIPTS)
+
+#We use two variables, applicationdir applicationexecdir, to segregate the
+#platform-independent (applicationdir) files installed by install-data from the
+#platform-dependent files (applicationexecdir) installed by install-exec. 
+#Automake recognizes the 'exec' substring in the variable name.  From the
+#Automake manual: "Any variable using a user-defined directory prefix with
+#‘exec’ in the name (e.g., myexecbin_PROGRAMS) is installed by install-exec.
+#All other user-defined prefixes are installed by install-data." (section 12.2)
+applicationexecdir = $(APPLICATION_DIR)
+applicationdir = $(APPLICATION_DIR)
+applicationexec_SCRIPTS = $(SCRIPTS_PERL)
+LDADD = ../common-src/libamanda.$(LIB_EXTENSION) \
+       ../client-src/libamclient.$(LIB_EXTENSION) \
+       ../amandad-src/libamandad.$(LIB_EXTENSION) \
+       ../common-src/libamanda.$(LIB_EXTENSION) \
+       ../gnulib/libgnu.$(LIB_EXTENSION)
+
+INSTALLPERMS_exec = dest=$(amlibexecdir) chown=amanda \
+       $(amlibexec_PROGRAMS) dest=$(applicationdir) chown=amanda \
+       $(applicationexec_PROGRAMS) dest=$(applicationdir) \
+       chown=amanda $(applicationexec_SCRIPTS) $(am__append_2)
+INSTALLPERMS_data = dest=$(amlibexecdir) chown=amanda $(amlibexec_SCRIPTS)
+all: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(top_srcdir)/config/automake/vars.am $(top_srcdir)/config/automake/scripts.am $(top_srcdir)/config/automake/installperms.am $(top_srcdir)/config/automake/precompile.am $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  application-src/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  application-src/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-amlibexecPROGRAMS: $(amlibexec_PROGRAMS)
+       @$(NORMAL_INSTALL)
+       test -z "$(amlibexecdir)" || $(MKDIR_P) "$(DESTDIR)$(amlibexecdir)"
+       @list='$(amlibexec_PROGRAMS)'; for p in $$list; do \
+         p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+         if test -f $$p \
+            || test -f $$p1 \
+         ; then \
+           f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+          echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(amlibexecPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(amlibexecdir)/$$f'"; \
+          $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(amlibexecPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(amlibexecdir)/$$f" || exit 1; \
+         else :; fi; \
+       done
+
+uninstall-amlibexecPROGRAMS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(amlibexec_PROGRAMS)'; for p in $$list; do \
+         f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+         echo " rm -f '$(DESTDIR)$(amlibexecdir)/$$f'"; \
+         rm -f "$(DESTDIR)$(amlibexecdir)/$$f"; \
+       done
+
+clean-amlibexecPROGRAMS:
+       @list='$(amlibexec_PROGRAMS)'; for p in $$list; do \
+         f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+         echo " rm -f $$p $$f"; \
+         rm -f $$p $$f ; \
+       done
+install-applicationexecPROGRAMS: $(applicationexec_PROGRAMS)
+       @$(NORMAL_INSTALL)
+       test -z "$(applicationexecdir)" || $(MKDIR_P) "$(DESTDIR)$(applicationexecdir)"
+       @list='$(applicationexec_PROGRAMS)'; for p in $$list; do \
+         p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+         if test -f $$p \
+            || test -f $$p1 \
+         ; then \
+           f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+          echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(applicationexecPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(applicationexecdir)/$$f'"; \
+          $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(applicationexecPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(applicationexecdir)/$$f" || exit 1; \
+         else :; fi; \
+       done
+
+uninstall-applicationexecPROGRAMS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(applicationexec_PROGRAMS)'; for p in $$list; do \
+         f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+         echo " rm -f '$(DESTDIR)$(applicationexecdir)/$$f'"; \
+         rm -f "$(DESTDIR)$(applicationexecdir)/$$f"; \
+       done
+
+clean-applicationexecPROGRAMS:
+       @list='$(applicationexec_PROGRAMS)'; for p in $$list; do \
+         f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+         echo " rm -f $$p $$f"; \
+         rm -f $$p $$f ; \
+       done
+amgtar$(EXEEXT): $(amgtar_OBJECTS) $(amgtar_DEPENDENCIES) 
+       @rm -f amgtar$(EXEEXT)
+       $(LINK) $(amgtar_OBJECTS) $(amgtar_LDADD) $(LIBS)
+amstar$(EXEEXT): $(amstar_OBJECTS) $(amstar_DEPENDENCIES) 
+       @rm -f amstar$(EXEEXT)
+       $(LINK) $(amstar_OBJECTS) $(amstar_LDADD) $(LIBS)
+teecount$(EXEEXT): $(teecount_OBJECTS) $(teecount_DEPENDENCIES) 
+       @rm -f teecount$(EXEEXT)
+       $(LINK) $(teecount_OBJECTS) $(teecount_LDADD) $(LIBS)
+install-applicationexecSCRIPTS: $(applicationexec_SCRIPTS)
+       @$(NORMAL_INSTALL)
+       test -z "$(applicationexecdir)" || $(MKDIR_P) "$(DESTDIR)$(applicationexecdir)"
+       @list='$(applicationexec_SCRIPTS)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         if test -f $$d$$p; then \
+           f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+           echo " $(applicationexecSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(applicationexecdir)/$$f'"; \
+           $(applicationexecSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(applicationexecdir)/$$f"; \
+         else :; fi; \
+       done
+
+uninstall-applicationexecSCRIPTS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(applicationexec_SCRIPTS)'; for p in $$list; do \
+         f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+         echo " rm -f '$(DESTDIR)$(applicationexecdir)/$$f'"; \
+         rm -f "$(DESTDIR)$(applicationexecdir)/$$f"; \
+       done
+
+mostlyclean-compile:
+       -rm -f *.$(OBJEXT)
+
+distclean-compile:
+       -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amgtar.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amstar.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/teecount.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@   $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@   mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@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@   $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@   mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@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) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@   $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@   mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+       -rm -f *.lo
+
+clean-libtool:
+       -rm -rf .libs _libs
+
+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; nonemtpy = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       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; nonempty = 1; } \
+             END { if (nonempty) { 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:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       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; nonempty = 1; } \
+             END { if (nonempty) { 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)
+       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       list='$(DISTFILES)'; \
+         dist_files=`for file in $$list; do echo $$file; done | \
+         sed -e "s|^$$srcdirstrip/||;t" \
+             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+       case $$dist_files in \
+         */*) $(MKDIR_P) `echo "$$dist_files" | \
+                          sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+                          sort -u` ;; \
+       esac; \
+       for file in $$dist_files; do \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         if test -d $$d/$$file; then \
+           dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+           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
+       $(MAKE) $(AM_MAKEFLAGS) \
+         top_distdir="$(top_distdir)" distdir="$(distdir)" \
+         dist-hook
+check-am: all-am
+       $(MAKE) $(AM_MAKEFLAGS) check-local
+check: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(PROGRAMS) $(SCRIPTS)
+installdirs:
+       for dir in "$(DESTDIR)$(amlibexecdir)" "$(DESTDIR)$(applicationexecdir)" "$(DESTDIR)$(applicationexecdir)"; do \
+         test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+       done
+install: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+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:
+       -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+
+clean-generic:
+       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+       -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+       -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+       -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-am
+
+clean-am: clean-amlibexecPROGRAMS clean-applicationexecPROGRAMS \
+       clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+       distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+       @$(NORMAL_INSTALL)
+       $(MAKE) $(AM_MAKEFLAGS) install-data-hook
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-amlibexecPROGRAMS \
+       install-applicationexecPROGRAMS install-applicationexecSCRIPTS
+       @$(NORMAL_INSTALL)
+       $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am: installcheck-local
+
+maintainer-clean: maintainer-clean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+       mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-amlibexecPROGRAMS \
+       uninstall-applicationexecPROGRAMS \
+       uninstall-applicationexecSCRIPTS
+
+.MAKE: install-am install-data-am install-exec-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am check-local clean \
+       clean-amlibexecPROGRAMS clean-applicationexecPROGRAMS \
+       clean-generic clean-libtool ctags dist-hook distclean \
+       distclean-compile distclean-generic distclean-libtool \
+       distclean-tags distdir dvi dvi-am html html-am info info-am \
+       install install-am install-amlibexecPROGRAMS \
+       install-applicationexecPROGRAMS install-applicationexecSCRIPTS \
+       install-data install-data-am install-data-hook install-dvi \
+       install-dvi-am install-exec install-exec-am install-exec-hook \
+       install-html install-html-am install-info install-info-am \
+       install-man install-pdf install-pdf-am install-ps \
+       install-ps-am install-strip installcheck installcheck-am \
+       installcheck-local installdirs maintainer-clean \
+       maintainer-clean-generic mostlyclean mostlyclean-compile \
+       mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+       tags uninstall uninstall-am uninstall-amlibexecPROGRAMS \
+       uninstall-applicationexecPROGRAMS \
+       uninstall-applicationexecSCRIPTS
+
+
+# Perl
+%: %.pl $(top_builddir)/config.status
+       $(top_builddir)/config.status --file=$@:$<
+       chmod a+x $@
+       @if test -f $(top_builddir)/perl/.libs/libCmdline.so -o -f $(top_builddir)/perl/libCmdline.so; then \
+               grep -v '^use lib' $@ > $@.nouselib; \
+               $(PERL) $(CHECK_PERL_FLAGS) -I$(top_builddir)/perl -I$(top_builddir)/perl/.libs -I$(top_srcdir)/perl -c -w -T $@.nouselib || exit 1; \
+               rm $@.nouselib; \
+       fi
+
+%.pl: %.pl.in $(top_builddir)/config.status
+       $(top_builddir)/config.status --file=$@:$<
+
+%.pm: %.pm.in $(top_builddir)/config.status
+       $(top_builddir)/config.status --file=$@:$<
+
+# Shell
+%: %.sh $(top_builddir)/config.status
+       $(top_builddir)/config.status --file=$@:$<
+       chmod a+x $@
+
+%.sh: %.sh.in $(top_builddir)/config.status
+       $(top_builddir)/config.status --file=$@:$<
+
+# Awk
+%: %.awk $(top_builddir)/config.status
+       $(top_builddir)/config.status --file=$@:$<
+       chmod a+x $@
+
+%.awk: %.awk.in $(top_builddir)/config.status
+       $(top_builddir)/config.status --file=$@:$<
+
+# syntax-check perl scripts on 'make check'
+check-perl: $(CHECK_PERL)
+       @CHECK_PERL="$(CHECK_PERL)"; \
+       if test -f $(top_builddir)/perl/.libs/libCmdline.so -o -f $(top_builddir)/perl/libCmdline.so; then \
+               if test -n "$(PERL)"; then \
+                       for perlobj in $$CHECK_PERL; do \
+                               grep -v '^use lib' $$perlobj > $$perlobj.nouselib; \
+                               $(PERL) $(CHECK_PERL_FLAGS) -I$(top_builddir)/perl -I$(top_builddir)/perl/.libs -I$(top_srcdir)/perl -c -w -T $$perlobj.nouselib || exit 1; \
+                               rm $$perlobj.nouselib; \
+                       done; \
+               fi \
+       fi
+check-local: check-perl
+
+# syntax-check perl scripts on 'make installcheck'
+installcheck-perl: $(CHECK_PERL)
+       @CHECK_PERL="$(CHECK_PERL)"; \
+       if test -n "$(PERL)"; then \
+               for perlobj in $$CHECK_PERL; do \
+                       $(PERL) $(CHECK_PERL_FLAGS) -c -w -T $$perlobj || exit 1; \
+               done; \
+       fi
+installcheck-local: installcheck-perl
+check-shell: $(CHECK_SHELL)
+       @CHECK_SHELL="$(CHECK_SHELL)"; \
+       if test -n "$$CHECK_SHELL"; then \
+               if test -n "$(BASH)"; then \
+                       for shobj in $$CHECK_SHELL; do \
+                               if $(BASH) -n $$shobj; then \
+                                       echo "$$shobj syntax OK"; \
+                               else \
+                                       echo "$$shobj syntax error"; \
+                                       exit 1; \
+                               fi; \
+                       done; \
+               else \
+                       echo "No 'bash' available -- cannot syntax-check shell scripts"; \
+               fi; \
+       fi
+check-local: check-shell
+
+# make sure that the sources for all shell and perl scripts get included
+# in the distribution
+dist-scripts:
+       SCRIPTS_PERL="$(SCRIPTS_PERL)"; SCRIPTS_SHELL="$(SCRIPTS_SHELL)"; SCRIPTS_AWK="$(SCRIPTS_AWK)"; \
+       for script in $$SCRIPTS_PERL; do \
+               test -f $(srcdir)/$${script}.pl && { cp -p $(srcdir)/$${script}.pl $(distdir)/ || exit 1; } \
+       done; \
+       for script in $$SCRIPTS_SHELL; do \
+               test -f $(srcdir)/$${script}.sh && { cp -p $(srcdir)/$${script}.sh $(distdir)/ || exit 1; } \
+       done; \
+       for script in $$SCRIPTS_AWK; do \
+               test -f $(srcdir)/$${script}.awk && { cp -p $(srcdir)/$${script}.awk $(distdir)/ || exit 1; } \
+       done; \
+       for script in $$SCRIPTS_SHELL $$SCRIPTS_PERL $$SCRIPTS_AWK; do \
+               test -f $(srcdir)/$${script}.in && { cp -p $(srcdir)/$${script}.in $(distdir)/ || exit 1; } \
+       done; \
+       true
+dist-hook: dist-scripts
+
+installperms-exec:
+       @installperms="$(INSTALLPERMS_exec)"; \
+       test -n "$$installperms" && echo "Setting installation permissions on executables"; \
+       dest=; chown=; chmod=; \
+       for cmd in $$installperms; do \
+           case "$$cmd" in \
+               chown=amanda) \
+                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
+               dest=*|chown=*|chmod=*) \
+                       echo "  ($$cmd)"; eval $$cmd;; \
+               *) $(do_file) ;; \
+           esac; \
+       done
+
+installperms-data:
+       @installperms="$(INSTALLPERMS_data)"; \
+       dest=; chown=; chmod=; \
+       for cmd in $$installperms; do \
+           case "$$cmd" in \
+               chown=amanda) \
+                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
+               dest=*|chown=*|chmod=*) \
+                       echo "  ($$cmd)"; eval $$cmd;; \
+               *)  $(do_file) ;; \
+           esac; \
+       done
+
+install-exec-hook: installperms-exec
+install-data-hook: installperms-data
+
+# define a rule to initialize the installperms manifest file
+@WANT_INSTALLPERMS_TRUE@installperms-init:
+@WANT_INSTALLPERMS_FALSE@installperms-init:
+@WANT_INSTALLPERMS_FALSE@      rm -f "$(installperms_sh)"
+
+# A rule to make precompiler output from C files.  This is not used during
+# ordinary builds, but but can very useful in debugging problems on strange
+# architectures.  With this rule, we can ask users to 'make foo.i' and send
+# the result to us.
+#
+# It touches some automake internals ($COMPILE), but since it's not
+# build-critical, that's OK.
+%.i : %.c
+       $(COMPILE) -E -o $@ $<
+# 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/application-src/amgtar.c b/application-src/amgtar.c
new file mode 100644 (file)
index 0000000..c3e5966
--- /dev/null
@@ -0,0 +1,1214 @@
+/*
+ * Amanda, The Advanced Maryland Automatic Network Disk Archiver
+ * Copyright (c) 1991-1998 University of Maryland at College Park
+ * All Rights Reserved.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of U.M. not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  U.M. makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as is"
+ * without express or implied warranty.
+ *
+ * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M.
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors: the Amanda Development Team.  Its members are listed in a
+ * file named AUTHORS, in the root directory of this distribution.
+ */
+/* 
+ * $Id: amgtar.c 8888 2007-10-02 13:40:42Z martineau $
+ *
+ * send estimated backup sizes using dump
+ */
+
+/* PROPERTY:
+ *
+ * GNUTAR-PATH     (default GNUTAR)
+ * GNUTAR-LISTDIR  (default CNF_GNUTAR_LIST_DIR)
+ * DIRECTORY       (no default, if set, the backup will be from that directory
+ *                 instead of from the --device)
+ * ONE-FILE-SYSTEM (default YES)
+ * SPARSE          (default YES)
+ * ATIME-PRESERVE  (default YES)
+ * CHECK-DEVICE    (default YES)
+ * INCLUDE-FILE
+ * INCLUDE-LIST
+ * INCLUDE-OPTIONAL
+ * EXCLUDE-FILE
+ * EXCLUDE-LIST
+ * EXCLUDE-OPTIONAL
+ * NORMAL
+ * IGNORE
+ * STRANGE
+ * EXIT-HANDLING   (1=GOOD 2=BAD)
+ * TAR-BLOCKSIZE   (default does not add --blocking-factor option,
+ *                  using tar's default)
+ */
+
+#include "amanda.h"
+#include "pipespawn.h"
+#include "amfeatures.h"
+#include "clock.h"
+#include "util.h"
+#include "getfsent.h"
+#include "version.h"
+#include "client_util.h"
+#include "conffile.h"
+#include "amandad.h"
+#include "getopt.h"
+#include "sendbackup.h"
+
+int debug_application = 1;
+#define application_debug(i, ...) do { \
+       if ((i) <= debug_application) { \
+           dbprintf(__VA_ARGS__);      \
+       }                               \
+} while (0)
+
+static amregex_t init_re_table[] = {
+  /* tar prints the size in bytes */
+  AM_SIZE_RE("^ *Total bytes written: [0-9][0-9]*", 1, 1),
+  AM_NORMAL_RE("^could not open conf file"),
+  AM_NORMAL_RE("^Elapsed time:"),
+  AM_NORMAL_RE("^Throughput"),
+  AM_IGNORE_RE(": Directory is new$"),
+  AM_IGNORE_RE(": Directory has been renamed"),
+
+  /* GNU tar 1.13.17 will print this warning when (not) backing up a
+     Unix named socket.  */
+  AM_NORMAL_RE(": socket ignored$"),
+
+  /* GNUTAR produces a few error messages when files are modified or
+     removed while it is running.  They may cause data to be lost, but
+     then they may not.  We shouldn't consider them NORMAL until
+     further investigation.  */
+  AM_NORMAL_RE(": File .* shrunk by [0-9][0-9]* bytes, padding with zeros"),
+  AM_NORMAL_RE(": Cannot add file .*: No such file or directory$"),
+  AM_NORMAL_RE(": Error exit delayed from previous errors"),
+  
+  /* catch-all: DMP_STRANGE is returned for all other lines */
+  AM_STRANGE_RE(NULL)
+};
+static amregex_t *re_table;
+
+/* local functions */
+int main(int argc, char **argv);
+
+typedef struct application_argument_s {
+    char      *config;
+    char      *host;
+    int        message;
+    int        collection;
+    int        calcsize;
+    char      *tar_blocksize;
+    GSList    *level;
+    dle_t      dle;
+    int        argc;
+    char     **argv;
+} application_argument_t;
+
+enum { CMD_ESTIMATE, CMD_BACKUP };
+
+static void amgtar_support(application_argument_t *argument);
+static void amgtar_selfcheck(application_argument_t *argument);
+static void amgtar_estimate(application_argument_t *argument);
+static void amgtar_backup(application_argument_t *argument);
+static void amgtar_restore(application_argument_t *argument);
+static void amgtar_validate(application_argument_t *argument);
+static void amgtar_build_exinclude(dle_t *dle, int verbose,
+                                  int *nb_exclude, char **file_exclude,
+                                  int *nb_include, char **file_include);
+static char *amgtar_get_incrname(application_argument_t *argument, int level);
+static char **amgtar_build_argv(application_argument_t *argument,
+                               char *incrname, int command);
+static amregex_t *build_re_table(amregex_t *orig_re_table,
+                                GSList *normal_message,
+                                GSList *ignore_message,
+                                GSList *strange_message);
+static void add_type_table(dmpline_t typ,
+                          amregex_t **re_table, amregex_t *orig_re_table,
+                          GSList *normal_message, GSList *ignore_message,
+                          GSList *strange_message);
+static void add_list_table(dmpline_t typ, amregex_t **re_table,
+                         GSList *message);
+static char *gnutar_path;
+static char *gnutar_listdir;
+static char *gnutar_directory;
+static int gnutar_onefilesystem;
+static int gnutar_atimepreserve;
+static int gnutar_checkdevice;
+static int gnutar_sparse;
+static GSList *normal_message = NULL;
+static GSList *ignore_message = NULL;
+static GSList *strange_message = NULL;
+static char   *exit_handling;
+static int    exit_value[256];
+
+static struct option long_options[] = {
+    {"config"          , 1, NULL,  1},
+    {"host"            , 1, NULL,  2},
+    {"disk"            , 1, NULL,  3},
+    {"device"          , 1, NULL,  4},
+    {"level"           , 1, NULL,  5},
+    {"index"           , 1, NULL,  6},
+    {"message"         , 1, NULL,  7},
+    {"collection"      , 0, NULL,  8},
+    {"record"          , 0, NULL,  9},
+    {"gnutar-path"     , 1, NULL, 10},
+    {"gnutar-listdir"  , 1, NULL, 11},
+    {"one-file-system" , 1, NULL, 12},
+    {"sparse"          , 1, NULL, 13},
+    {"atime-preserve"  , 1, NULL, 14},
+    {"check-device"    , 1, NULL, 15},
+    {"include-file"    , 1, NULL, 16},
+    {"include-list"    , 1, NULL, 17},
+    {"include-optional", 1, NULL, 18},
+    {"exclude-file"    , 1, NULL, 19},
+    {"exclude-list"    , 1, NULL, 20},
+    {"exclude-optional", 1, NULL, 21},
+    {"directory"       , 1, NULL, 22},
+    {"normal"          , 1, NULL, 23},
+    {"ignore"          , 1, NULL, 24},
+    {"strange"         , 1, NULL, 25},
+    {"exit-handling"   , 1, NULL, 26},
+    {"calcsize"        , 0, NULL, 27},
+    {"tar-blocksize"   , 1, NULL, 28},
+    {NULL, 0, NULL, 0}
+};
+
+
+void
+add_type_table(
+    dmpline_t   typ,
+    amregex_t **re_table,
+    amregex_t  *orig_re_table,
+    GSList     *normal_message,
+    GSList     *ignore_message,
+    GSList     *strange_message)
+{
+    amregex_t *rp;
+
+    for(rp = orig_re_table; rp->regex != NULL; rp++) {
+       if (rp->typ == typ) {
+           int     found = 0;
+           GSList *mes;
+
+           for (mes = normal_message; mes != NULL; mes = mes->next) {
+               if (strcmp(rp->regex, (char *)mes->data) == 0)
+                   found = 1;
+           }
+           for (mes = ignore_message; mes != NULL; mes = mes->next) {
+               if (strcmp(rp->regex, (char *)mes->data) == 0)
+                   found = 1;
+           }
+           for (mes = strange_message; mes != NULL; mes = mes->next) {
+               if (strcmp(rp->regex, (char *)mes->data) == 0)
+                   found = 1;
+           }
+           if (found == 0) {
+               (*re_table)->regex   = rp->regex;
+               (*re_table)->srcline = rp->srcline;
+               (*re_table)->scale   = rp->scale;
+               (*re_table)->field   = rp->field;
+               (*re_table)->typ     = rp->typ;
+               (*re_table)++;
+           }
+       }
+    }
+}
+
+void
+add_list_table(
+    dmpline_t   typ,
+    amregex_t **re_table,
+    GSList     *message)
+{
+    GSList *mes;
+
+    for (mes = message; mes != NULL; mes = mes->next) {
+       (*re_table)->regex = (char *)mes->data;
+       (*re_table)->srcline = 0;
+       (*re_table)->scale   = 0;
+       (*re_table)->field   = 0;
+       (*re_table)->typ     = typ;
+       (*re_table)++;
+    }
+}
+
+amregex_t *
+build_re_table(
+    amregex_t *orig_re_table,
+    GSList    *normal_message,
+    GSList    *ignore_message,
+    GSList    *strange_message)
+{
+    int        nb = 0;
+    amregex_t *rp;
+    amregex_t *re_table, *new_re_table;
+
+    for(rp = orig_re_table; rp->regex != NULL; rp++) {
+       nb++;
+    }
+    nb += g_slist_length(normal_message);
+    nb += g_slist_length(ignore_message);
+    nb += g_slist_length(strange_message);
+    nb ++;
+
+    re_table =  new_re_table = malloc(nb * sizeof(amregex_t));
+    
+    /* add SIZE from orig_re_table */
+    add_type_table(DMP_SIZE, &re_table, orig_re_table,
+                  normal_message, ignore_message, strange_message);
+
+    /* add ignore_message */
+    add_list_table(DMP_IGNORE, &re_table, ignore_message);
+
+    /* add IGNORE from orig_re_table */
+    add_type_table(DMP_IGNORE, &re_table, orig_re_table,
+                  normal_message, ignore_message, strange_message);
+
+    /* add normal_message */
+    add_list_table(DMP_NORMAL, &re_table, normal_message);
+
+    /* add NORMAL from orig_re_table */
+    add_type_table(DMP_NORMAL, &re_table, orig_re_table,
+                  normal_message, ignore_message, strange_message);
+
+    /* add strange_message */
+    add_list_table(DMP_STRANGE, &re_table, strange_message);
+
+    /* add STRANGE from orig_re_table */
+    add_type_table(DMP_STRANGE, &re_table, orig_re_table,
+                  normal_message, ignore_message, strange_message);
+
+    /* Add DMP_STRANGE with NULL regex,       */
+    /* it is not copied by previous statement */
+    re_table->regex = NULL;
+    re_table->srcline = 0;
+    re_table->scale = 0;
+    re_table->field = 0;
+    re_table->typ = DMP_STRANGE;
+
+    return new_re_table;
+}
+
+int
+main(
+    int                argc,
+    char **    argv)
+{
+    int c;
+    char *command;
+    application_argument_t argument;
+    int i;
+
+#ifdef GNUTAR
+    gnutar_path = GNUTAR;
+#else
+    gnutar_path = NULL;
+#endif
+    gnutar_directory = NULL;
+    gnutar_onefilesystem = 1;
+    gnutar_atimepreserve = 1;
+    gnutar_checkdevice = 1;
+    gnutar_sparse = 1;
+    exit_handling = NULL;
+
+    /* initialize */
+
+    /*
+     * Configure program for internationalization:
+     *   1) Only set the message locale for now.
+     *   2) Set textdomain for all amanda related programs to "amanda"
+     *      We don't want to be forced to support dozens of message catalogs.
+     */  
+    setlocale(LC_MESSAGES, "C");
+    textdomain("amanda"); 
+
+    /* drop root privileges */
+    if (!set_root_privs(0)) {
+       error(_("amgtar must be run setuid root"));
+    }
+
+    safe_fd(3, 2);
+
+    set_pname("amgtar");
+
+    /* Don't die when child closes pipe */
+    signal(SIGPIPE, SIG_IGN);
+
+#if defined(USE_DBMALLOC)
+    malloc_size_1 = malloc_inuse(&malloc_hist_1);
+#endif
+
+    erroutput_type = (ERR_INTERACTIVE|ERR_SYSLOG);
+    dbopen(DBG_SUBDIR_CLIENT);
+    startclock();
+    dbprintf(_("version %s\n"), version());
+
+    config_init(CONFIG_INIT_CLIENT, NULL);
+
+    //check_running_as(RUNNING_AS_DUMPUSER_PREFERRED);
+    //root for amrecover
+    //RUNNING_AS_CLIENT_LOGIN from selfcheck, sendsize, sendbackup
+
+    /* parse argument */
+    command = argv[1];
+
+    argument.config     = NULL;
+    argument.host       = NULL;
+    argument.message    = 0;
+    argument.collection = 0;
+    argument.calcsize   = 0;
+    argument.tar_blocksize = NULL;
+    argument.level      = NULL;
+    init_dle(&argument.dle);
+
+    while (1) {
+       int option_index = 0;
+       c = getopt_long (argc, argv, "", long_options, &option_index);
+       if (c == -1) {
+           break;
+       }
+       switch (c) {
+       case 1: argument.config = stralloc(optarg);
+               break;
+       case 2: argument.host = stralloc(optarg);
+               break;
+       case 3: argument.dle.disk = stralloc(optarg);
+               break;
+       case 4: argument.dle.device = stralloc(optarg);
+               break;
+       case 5: argument.level = g_slist_append(argument.level,
+                                               GINT_TO_POINTER(atoi(optarg)));
+               break;
+       case 6: argument.dle.create_index = 1;
+               break;
+       case 7: argument.message = 1;
+               break;
+       case 8: argument.collection = 1;
+               break;
+       case 9: argument.dle.record = 1;
+               break;
+       case 10: gnutar_path = stralloc(optarg);
+                break;
+       case 11: gnutar_listdir = stralloc(optarg);
+                break;
+       case 12: if (optarg && strcasecmp(optarg, "YES") != 0)
+                    gnutar_onefilesystem = 0;
+                break;
+       case 13: if (optarg && strcasecmp(optarg, "YES") != 0)
+                    gnutar_sparse = 0;
+                break;
+       case 14: if (optarg && strcasecmp(optarg, "YES") != 0)
+                    gnutar_atimepreserve = 0;
+                break;
+       case 15: if (optarg && strcasecmp(optarg, "YES") != 0)
+                    gnutar_checkdevice = 0;
+                break;
+       case 16: if (optarg)
+                    argument.dle.include_file =
+                        append_sl(argument.dle.include_file, optarg);
+                break;
+       case 17: if (optarg)
+                    argument.dle.include_list =
+                        append_sl(argument.dle.include_list, optarg);
+                break;
+       case 18: argument.dle.include_optional = 1;
+                break;
+       case 19: if (optarg)
+                    argument.dle.exclude_file =
+                        append_sl(argument.dle.exclude_file, optarg);
+                break;
+       case 20: if (optarg)
+                    argument.dle.exclude_list =
+                        append_sl(argument.dle.exclude_list, optarg);
+                break;
+       case 21: argument.dle.exclude_optional = 1;
+                break;
+       case 22: gnutar_directory = stralloc(optarg);
+                break;
+       case 23: if (optarg)
+                    normal_message = 
+                        g_slist_append(normal_message, optarg);
+                break;
+       case 24: if (optarg)
+                    ignore_message = 
+                        g_slist_append(ignore_message, optarg);
+                break;
+       case 25: if (optarg)
+                    strange_message = 
+                        g_slist_append(strange_message, optarg);
+                break;
+       case 26: if (optarg)
+                    exit_handling = stralloc(optarg);
+                break;
+       case 27: argument.calcsize = 1;
+                break;
+       case 28: argument.tar_blocksize = stralloc(optarg);
+       case ':':
+       case '?':
+               break;
+       }
+    }
+
+    argument.argc = argc - optind;
+    argument.argv = argv + optind;
+
+    if (argument.config) {
+       config_init(CONFIG_INIT_CLIENT | CONFIG_INIT_EXPLICIT_NAME | CONFIG_INIT_OVERLAY,
+                   argument.config);
+       dbrename(get_config_name(), DBG_SUBDIR_CLIENT);
+    }
+
+    if (config_errors(NULL) >= CFGERR_ERRORS) {
+       g_critical(_("errors processing config file"));
+    }
+
+    re_table = build_re_table(init_re_table, normal_message, ignore_message,
+                             strange_message);
+
+    for(i=0;i<256;i++)
+       exit_value[i] = 1; /* BAD  */
+    exit_value[0] = 0;     /* GOOD */
+    exit_value[1] = 0;     /* GOOD */
+    if (exit_handling) {
+       char *s = exit_handling;
+       while (s) {
+           char *r = index(s, '=');
+           if (r) {
+               int j = atoi(s);
+               if (j >= 0 && j < 256) {
+                   r++;
+                   if (strncasecmp(r, "GOOD", 4) == 0) {
+                       exit_value[j] = 0;
+                   }
+                   s = index(s, ' ');
+               }
+           }
+       }
+    }
+
+    gnutar_listdir = getconf_str(CNF_GNUTAR_LIST_DIR);
+    if (strlen(gnutar_listdir) == 0)
+       gnutar_listdir = NULL;
+
+    if (gnutar_path) {
+       dbprintf("GNUTAR-PATH %s\n", gnutar_path);
+    } else {
+       dbprintf("GNUTAR-PATH is not set\n");
+    }
+    if (gnutar_listdir) {
+           dbprintf("GNUTAR-LISTDIR %s\n", gnutar_listdir);
+    } else {
+       dbprintf("GNUTAR-LISTDIR is not set\n");
+    }
+    if (gnutar_directory) {
+       dbprintf("DIRECTORY %s\n", gnutar_directory);
+    }
+    dbprintf("ONE-FILE-SYSTEM %s\n", gnutar_onefilesystem? "yes":"no");
+    dbprintf("SPARSE %s\n", gnutar_sparse? "yes":"no");
+    dbprintf("ATIME-PRESERVE %s\n", gnutar_atimepreserve? "yes":"no");
+    dbprintf("CHECK-DEVICE %s\n", gnutar_checkdevice? "yes":"no");
+    {
+       amregex_t *rp;
+       for (rp = re_table; rp->regex != NULL; rp++) {
+           switch (rp->typ) {
+               case DMP_NORMAL : dbprintf("NORMAL %s\n", rp->regex); break;
+               case DMP_IGNORE : dbprintf("IGNORE %s\n", rp->regex); break;
+               case DMP_STRANGE: dbprintf("STRANGE %s\n", rp->regex); break;
+               case DMP_SIZE   : dbprintf("SIZE %s\n", rp->regex); break;
+               case DMP_ERROR  : dbprintf("ERROR %s\n", rp->regex); break;
+           }
+       }
+    }
+
+    if (strcmp(command, "support") == 0) {
+       amgtar_support(&argument);
+    } else if (strcmp(command, "selfcheck") == 0) {
+       amgtar_selfcheck(&argument);
+    } else if (strcmp(command, "estimate") == 0) {
+       amgtar_estimate(&argument);
+    } else if (strcmp(command, "backup") == 0) {
+       amgtar_backup(&argument);
+    } else if (strcmp(command, "restore") == 0) {
+       amgtar_restore(&argument);
+    } else if (strcmp(command, "validate") == 0) {
+       amgtar_validate(&argument);
+    } else {
+       dbprintf("Unknown command `%s'.\n", command);
+       fprintf(stderr, "Unknown command `%s'.\n", command);
+       exit (1);
+    }
+    return 0;
+}
+
+static void
+amgtar_support(
+    application_argument_t *argument)
+{
+    (void)argument;
+    fprintf(stdout, "CONFIG YES\n");
+    fprintf(stdout, "HOST YES\n");
+    fprintf(stdout, "DISK YES\n");
+    fprintf(stdout, "MAX-LEVEL 9\n");
+    fprintf(stdout, "INDEX-LINE YES\n");
+    fprintf(stdout, "INDEX-XML NO\n");
+    fprintf(stdout, "MESSAGE-LINE YES\n");
+    fprintf(stdout, "MESSAGE-XML NO\n");
+    fprintf(stdout, "RECORD YES\n");
+    fprintf(stdout, "INCLUDE-FILE YES\n");
+    fprintf(stdout, "INCLUDE-LIST YES\n");
+    fprintf(stdout, "INCLUDE-OPTIONAL YES\n");
+    fprintf(stdout, "EXCLUDE-FILE YES\n");
+    fprintf(stdout, "EXCLUDE-LIST YES\n");
+    fprintf(stdout, "EXCLUDE-OPTIONAL YES\n");
+    fprintf(stdout, "COLLECTION NO\n");
+    fprintf(stdout, "MULTI-ESTIMATE YES\n");
+    fprintf(stdout, "CALCSIZE YES\n");
+}
+
+static void
+amgtar_selfcheck(
+    application_argument_t *argument)
+{
+    amgtar_build_exinclude(&argument->dle, 1, NULL, NULL, NULL, NULL);
+
+    if (gnutar_path) {
+       check_file(gnutar_path, X_OK);
+    } else {
+       printf(_("ERROR [GNUTAR program not available]\n"));
+    }
+
+    set_root_privs(1);
+    if (gnutar_listdir && strlen(gnutar_listdir) == 0)
+       gnutar_listdir = NULL;
+    if (gnutar_listdir) {
+       check_dir(gnutar_listdir, R_OK|W_OK);
+    } else {
+       printf(_("ERROR [No GNUTAR-LISTDIR]\n"));
+    }
+
+    fprintf(stdout, "OK %s\n", argument->dle.disk);
+    if (gnutar_directory) {
+       check_dir(gnutar_directory, R_OK);
+    } else {
+       check_dir(argument->dle.device, R_OK);
+    }
+    set_root_privs(0);
+}
+
+static void
+amgtar_estimate(
+    application_argument_t *argument)
+{
+    char  *incrname = NULL;
+    char **my_argv = NULL;
+    char  *cmd = NULL;
+    int    nullfd = -1;
+    int    pipefd = -1;
+    FILE  *dumpout = NULL;
+    off_t  size = -1;
+    char   line[32768];
+    char  *errmsg = NULL;
+    char  *qerrmsg = NULL;
+    char  *qdisk;
+    amwait_t wait_status;
+    int tarpid;
+    amregex_t *rp;
+    times_t start_time;
+    int     level;
+    GSList *levels;
+
+    qdisk = quote_string(argument->dle.disk);
+
+    if (argument->calcsize) {
+       char *dirname;
+       char *file_exclude;
+       char *file_include;
+       int   nb_exclude;
+       int   nb_include;
+
+       if (gnutar_directory) {
+           dirname = gnutar_directory;
+       } else {
+           dirname = amname_to_dirname(argument->dle.device);
+       }
+       amgtar_build_exinclude(&argument->dle, 1,
+                              &nb_exclude, &file_exclude,
+                              &nb_include, &file_include);
+
+       run_calcsize(argument->config, "GNUTAR", argument->dle.disk, dirname,
+                    argument->level, file_exclude, file_include);
+       return;
+    }
+
+    if (!gnutar_path) {
+       errmsg = vstrallocf(_("GNUTAR-PATH not defined"));
+       goto common_error;
+    }
+
+    if (!gnutar_listdir) {
+       errmsg = vstrallocf(_("GNUTAR-LISTDIR not defined"));
+       goto common_error;
+    }
+
+    for (levels = argument->level; levels != NULL; levels = levels->next) {
+       level = GPOINTER_TO_INT(levels->data);
+       incrname = amgtar_get_incrname(argument, level);
+       cmd = stralloc(gnutar_path);
+       my_argv = amgtar_build_argv(argument, incrname, CMD_ESTIMATE);
+
+       start_time = curclock();
+
+       if ((nullfd = open("/dev/null", O_RDWR)) == -1) {
+           errmsg = vstrallocf(_("Cannot access /dev/null : %s"),
+                               strerror(errno));
+           goto common_exit;
+       }
+
+       tarpid = pipespawnv(cmd, STDERR_PIPE, 1,
+                           &nullfd, &nullfd, &pipefd, my_argv);
+
+       dumpout = fdopen(pipefd,"r");
+       if (!dumpout) {
+           error(_("Can't fdopen: %s"), strerror(errno));
+           /*NOTREACHED*/
+       }
+
+       size = (off_t)-1;
+       while (size < 0 && (fgets(line, sizeof(line), dumpout) != NULL)) {
+           if (line[strlen(line)-1] == '\n') /* remove trailling \n */
+               line[strlen(line)-1] = '\0';
+           if (line[0] == '\0')
+               continue;
+           dbprintf("%s\n", line);
+           /* check for size match */
+           /*@ignore@*/
+           for(rp = re_table; rp->regex != NULL; rp++) {
+               if(match(rp->regex, line)) {
+                   if (rp->typ == DMP_SIZE) {
+                       size = ((the_num(line, rp->field)*rp->scale+1023.0)/1024.0);
+                       if(size < 0.0)
+                           size = 1.0;             /* found on NeXT -- sigh */
+                   }
+                   break;
+               }
+           }
+           /*@end@*/
+       }
+
+       while (fgets(line, sizeof(line), dumpout) != NULL) {
+           dbprintf("%s", line);
+       }
+
+       dbprintf(".....\n");
+       dbprintf(_("estimate time for %s level %d: %s\n"),
+                qdisk,
+                level,
+                walltime_str(timessub(curclock(), start_time)));
+       if(size == (off_t)-1) {
+           errmsg = vstrallocf(_("no size line match in %s output"),
+                               my_argv[0]);
+           dbprintf(_("%s for %s\n"), errmsg, qdisk);
+           dbprintf(".....\n");
+       } else if(size == (off_t)0 && argument->level == 0) {
+           dbprintf(_("possible %s problem -- is \"%s\" really empty?\n"),
+                     my_argv[0], argument->dle.disk);
+           dbprintf(".....\n");
+       }
+       dbprintf(_("estimate size for %s level %d: %lld KB\n"),
+                qdisk,
+                level,
+                (long long)size);
+
+       kill(-tarpid, SIGTERM);
+
+       dbprintf(_("waiting for %s \"%s\" child\n"), my_argv[0], qdisk);
+       waitpid(tarpid, &wait_status, 0);
+       if (WIFSIGNALED(wait_status)) {
+           errmsg = vstrallocf(_("%s terminated with signal %d: see %s"),
+                               cmd, WTERMSIG(wait_status), dbfn());
+       } else if (WIFEXITED(wait_status)) {
+           if (exit_value[WEXITSTATUS(wait_status)] == 1) {
+               errmsg = vstrallocf(_("%s exited with status %d: see %s"),
+                                   cmd, WEXITSTATUS(wait_status), dbfn());
+           } else {
+               /* Normal exit */
+           }
+       } else {
+           errmsg = vstrallocf(_("%s got bad exit: see %s"),
+                               cmd, dbfn());
+       }
+       dbprintf(_("after %s %s wait\n"), my_argv[0], qdisk);
+
+common_exit:
+       if (errmsg) {
+           dbprintf("%s", errmsg);
+           fprintf(stdout, "ERROR %s\n", errmsg);
+       }
+
+       if (incrname) {
+           unlink(incrname);
+       }
+       amfree(my_argv);
+       amfree(cmd);
+
+       aclose(nullfd);
+       afclose(dumpout);
+
+       fprintf(stdout, "%d %lld 1\n", level, (long long)size);
+    }
+    amfree(qdisk);
+    return;
+
+common_error:
+    qerrmsg = quote_string(errmsg);
+    amfree(qdisk);
+    dbprintf("%s", errmsg);
+    fprintf(stdout, "ERROR %s\n", qerrmsg);
+    amfree(errmsg);
+    amfree(qerrmsg);
+    return;
+}
+
+static void
+amgtar_backup(
+    application_argument_t *argument)
+{
+    int dumpin;
+    char *cmd = NULL;
+    char *qdisk;
+    char *incrname;
+    char line[32768];
+    amregex_t *rp;
+    off_t dump_size = -1;
+    char *type;
+    char startchr;
+
+    int dataf = 1;
+    int mesgf = 3;
+    int indexf = 4;
+    int outf;
+    FILE *mesgstream;
+    FILE *indexstream = NULL;
+    FILE *outstream;
+    char *errmsg = NULL;
+    amwait_t wait_status;
+
+    char **my_argv;
+    int tarpid;
+
+    if (!gnutar_path) {
+       error(_("GNUTAR-PATH not defined"));
+    }
+    if (!gnutar_listdir) {
+       error(_("GNUTAR-LISTDIR not defined"));
+    }
+
+    qdisk = quote_string(argument->dle.disk);
+
+    incrname = amgtar_get_incrname(argument,
+                                  GPOINTER_TO_INT(argument->level->data));
+    cmd = stralloc(gnutar_path);
+    my_argv = amgtar_build_argv(argument, incrname, CMD_BACKUP);
+
+    tarpid = pipespawnv(cmd, STDIN_PIPE|STDERR_PIPE, 1,
+                       &dumpin, &dataf, &outf, my_argv);
+    /* close the write ends of the pipes */
+
+    aclose(dumpin);
+    aclose(dataf);
+    if (argument->dle.create_index) {
+       indexstream = fdopen(indexf, "w");
+       if (!indexstream) {
+           error(_("error indexstream(%d): %s\n"), indexf, strerror(errno));
+       }
+    }
+    mesgstream = fdopen(mesgf, "w");
+    if (!mesgstream) {
+       error(_("error mesgstream(%d): %s\n"), mesgf, strerror(errno));
+    }
+    outstream = fdopen(outf, "r");
+    if (!outstream) {
+       error(_("error outstream(%d): %s\n"), outf, strerror(errno));
+    }
+
+    while (fgets(line, sizeof(line), outstream) != NULL) {
+       if (line[strlen(line)-1] == '\n') /* remove trailling \n */
+           line[strlen(line)-1] = '\0';
+       if (*line == '.' && *(line+1) == '/') { /* filename */
+           if (argument->dle.create_index) {
+               fprintf(indexstream, "%s\n", &line[1]); /* remove . */
+           }
+       } else { /* message */
+           for(rp = re_table; rp->regex != NULL; rp++) {
+               if(match(rp->regex, line)) {
+                   break;
+               }
+           }
+           if(rp->typ == DMP_SIZE) {
+               dump_size = (long)((the_num(line, rp->field)* rp->scale+1023.0)/1024.0);
+           }
+           switch(rp->typ) {
+           case DMP_NORMAL:
+               type = "normal";
+               startchr = '|';
+               break;
+           case DMP_IGNORE:
+               continue;
+           case DMP_STRANGE:
+               type = "strange";
+               startchr = '?';
+               break;
+           case DMP_SIZE:
+               type = "size";
+               startchr = '|';
+               break;
+           case DMP_ERROR:
+               type = "error";
+               startchr = '?';
+               break;
+           default:
+               type = "unknown";
+               startchr = '!';
+               break;
+           }
+           dbprintf("%3d: %7s(%c): %s\n", rp->srcline, type, startchr, line);
+           fprintf(mesgstream,"%c %s\n", startchr, line);
+        }
+    }
+
+    waitpid(tarpid, &wait_status, 0);
+    if (WIFSIGNALED(wait_status)) {
+       errmsg = vstrallocf(_("%s terminated with signal %d: see %s"),
+                           cmd, WTERMSIG(wait_status), dbfn());
+    } else if (WIFEXITED(wait_status)) {
+       if (exit_value[WEXITSTATUS(wait_status)] == 1) {
+           errmsg = vstrallocf(_("%s exited with status %d: see %s"),
+                               cmd, WEXITSTATUS(wait_status), dbfn());
+       } else {
+           /* Normal exit */
+       }
+    } else {
+       errmsg = vstrallocf(_("%s got bad exit: see %s"),
+                           cmd, dbfn());
+    }
+    dbprintf(_("after %s %s wait\n"), my_argv[0], qdisk);
+    dbprintf(_("amgtar: %s: pid %ld\n"), cmd, (long)tarpid);
+    if (errmsg) {
+       dbprintf("%s", errmsg);
+       g_fprintf(mesgstream, "sendbackup: error [%s]\n", errmsg);
+    }
+
+    if (incrname && strlen(incrname) > 4) {
+       char *nodotnew;
+       nodotnew = stralloc(incrname);
+       nodotnew[strlen(nodotnew)-4] = '\0';
+       if (rename(incrname, nodotnew)) {
+           dbprintf(_("%s: warning [renaming %s to %s: %s]\n"),
+                    get_pname(), incrname, nodotnew, strerror(errno));
+           g_fprintf(mesgstream, _("? warning [renaming %s to %s: %s]\n"),
+                     incrname, nodotnew, strerror(errno));
+       }
+       amfree(nodotnew);
+    }
+
+    dbprintf("sendbackup: size %lld\n", (long long)dump_size);
+    fprintf(mesgstream, "sendbackup: size %lld\n", (long long)dump_size);
+    dbprintf("sendbackup: end\n");
+    fprintf(mesgstream, "sendbackup: end\n");
+
+    if (argument->dle.create_index)
+       fclose(indexstream);
+
+    fclose(mesgstream);
+
+    amfree(incrname);
+    amfree(qdisk);
+    amfree(cmd);
+}
+
+static void
+amgtar_restore(
+    application_argument_t *argument)
+{
+    char  *cmd;
+    char **my_argv;
+    char **env;
+    int    i, j;
+    char  *e;
+
+    if (!gnutar_path) {
+       error(_("GNUTAR-PATH not defined"));
+    }
+
+    cmd = stralloc(gnutar_path);
+    my_argv = alloc(SIZEOF(char *) * (6 + argument->argc));
+    i = 0;
+    my_argv[i++] = stralloc(gnutar_path);
+    my_argv[i++] = stralloc("--numeric-owner");
+    my_argv[i++] = stralloc("-xpGvf");
+    my_argv[i++] = stralloc("-");
+
+    for (j=1; j< argument->argc; j++) {
+       my_argv[i++] = stralloc(argument->argv[j]);
+    }
+    my_argv[i++] = NULL;
+
+    env = safe_env();
+    become_root();
+    execve(cmd, my_argv, env);
+    e = strerror(errno);
+    error(_("error [exec %s: %s]"), cmd, e);
+}
+
+static void
+amgtar_validate(
+    application_argument_t *argument G_GNUC_UNUSED)
+{
+    char  *cmd;
+    char **my_argv;
+    char **env;
+    int    i;
+    char  *e;
+
+    if (!gnutar_path) {
+       error(_("GNUTAR-PATH not defined"));
+    }
+
+    cmd = stralloc(gnutar_path);
+    my_argv = alloc(SIZEOF(char *) * 4);
+    i = 0;
+    my_argv[i++] = stralloc(gnutar_path);
+    my_argv[i++] = stralloc("-tf");
+    my_argv[i++] = stralloc("-");
+    my_argv[i++] = NULL;
+
+    env = safe_env();
+    execve(cmd, my_argv, env);
+    e = strerror(errno);
+    error(_("error [exec %s: %s]"), cmd, e);
+}
+
+static void
+amgtar_build_exinclude(
+    dle_t  *dle,
+    int     verbose,
+    int    *nb_exclude,
+    char  **file_exclude,
+    int    *nb_include,
+    char  **file_include)
+{
+    int n_exclude = 0;
+    int n_include = 0;
+    char *exclude = NULL;
+    char *include = NULL;
+
+    if (dle->exclude_file) n_exclude += dle->exclude_file->nb_element;
+    if (dle->exclude_list) n_exclude += dle->exclude_list->nb_element;
+    if (dle->include_file) n_include += dle->include_file->nb_element;
+    if (dle->include_list) n_include += dle->include_list->nb_element;
+
+    if (n_exclude > 0) exclude = build_exclude(dle, verbose);
+    if (n_include > 0) include = build_include(dle, verbose);
+
+    if (nb_exclude)
+       *nb_exclude = n_exclude;
+    if (file_exclude)
+       *file_exclude = exclude;
+    else
+       amfree(exclude);
+
+    if (nb_include)
+       *nb_include = n_include;
+    if (file_include)
+       *file_include = include;
+    else
+       amfree(include);
+}
+
+static char *
+amgtar_get_incrname(
+    application_argument_t *argument,
+    int                     level)
+{
+    char *basename = NULL;
+    char *incrname = NULL;
+    int   infd, outfd;
+    ssize_t   nb;
+    char *inputname = NULL;
+    char *errmsg = NULL;
+    char *buf;
+
+    if (gnutar_listdir) {
+       char number[NUM_STR_SIZE];
+       int baselevel;
+       char *sdisk = sanitise_filename(argument->dle.disk);
+
+       basename = vstralloc(gnutar_listdir,
+                            "/",
+                            argument->host,
+                            sdisk,
+                            NULL);
+       amfree(sdisk);
+
+       snprintf(number, SIZEOF(number), "%d", level);
+       incrname = vstralloc(basename, "_", number, ".new", NULL);
+       unlink(incrname);
+
+       /*
+        * Open the listed incremental file from the previous level.  Search
+        * backward until one is found.  If none are found (which will also
+        * be true for a level 0), arrange to read from /dev/null.
+        */
+       baselevel = level;
+       infd = -1;
+       while (infd == -1) {
+           if (--baselevel >= 0) {
+               snprintf(number, SIZEOF(number), "%d", baselevel);
+               inputname = newvstralloc(inputname,
+                                        basename, "_", number, NULL);
+           } else {
+               inputname = newstralloc(inputname, "/dev/null");
+           }
+           if ((infd = open(inputname, O_RDONLY)) == -1) {
+
+               errmsg = vstrallocf(_("amgtar: error opening %s: %s"),
+                                    inputname, strerror(errno));
+               dbprintf("%s\n", errmsg);
+               if (baselevel < 0) {
+                   return NULL;
+               }
+               amfree(errmsg);
+           }
+       }
+
+       /*
+        * Copy the previous listed incremental file to the new one.
+        */
+       if ((outfd = open(incrname, O_WRONLY|O_CREAT, 0600)) == -1) {
+           errmsg = vstrallocf(_("opening %s: %s"),
+                                incrname, strerror(errno));
+           dbprintf("%s\n", errmsg);
+           return NULL;
+       }
+
+       while ((nb = read(infd, &buf, SIZEOF(buf))) > 0) {
+           if (full_write(outfd, &buf, (size_t)nb) < (size_t)nb) {
+               errmsg = vstrallocf(_("writing to %s: %s"),
+                                    incrname, strerror(errno));
+               dbprintf("%s\n", errmsg);
+               return NULL;
+           }
+       }
+
+       if (nb < 0) {
+           errmsg = vstrallocf(_("reading from %s: %s"),
+                                inputname, strerror(errno));
+           dbprintf("%s\n", errmsg);
+           return NULL;
+       }
+
+       if (close(infd) != 0) {
+           errmsg = vstrallocf(_("closing %s: %s"),
+                                inputname, strerror(errno));
+           dbprintf("%s\n", errmsg);
+           return NULL;
+       }
+       if (close(outfd) != 0) {
+           errmsg = vstrallocf(_("closing %s: %s"),
+                                incrname, strerror(errno));
+           dbprintf("%s\n", errmsg);
+           return NULL;
+       }
+
+       amfree(inputname);
+       amfree(basename);
+    }
+    return incrname;
+}
+
+char **amgtar_build_argv(
+    application_argument_t *argument,
+    char *incrname,
+    int   command)
+{
+    int    i;
+    int    nb_exclude;
+    int    nb_include;
+    char  *file_exclude;
+    char  *file_include;
+    char  *dirname;
+    char   tmppath[PATH_MAX];
+    char **my_argv;
+
+    amgtar_build_exinclude(&argument->dle, 1,
+                          &nb_exclude, &file_exclude,
+                          &nb_include, &file_include);
+
+    if (gnutar_directory) {
+       dirname = gnutar_directory;
+    } else {
+       dirname = amname_to_dirname(argument->dle.device);
+    }
+
+    my_argv = alloc(SIZEOF(char *) * 23);
+    i = 0;
+
+    my_argv[i++] = gnutar_path;
+
+    my_argv[i++] = "--create";
+    if (command == CMD_BACKUP && argument->dle.create_index)
+       my_argv[i++] = "--verbose";
+    my_argv[i++] = "--file";
+    if (command == CMD_ESTIMATE) {
+       my_argv[i++] = "/dev/null";
+    } else {
+       my_argv[i++] = "-";
+    }
+    my_argv[i++] = "--directory";
+    canonicalize_pathname(dirname, tmppath);
+    my_argv[i++] = stralloc(tmppath);
+    if (gnutar_onefilesystem)
+       my_argv[i++] = "--one-file-system";
+    if (gnutar_atimepreserve)
+       my_argv[i++] = "--atime-preserve=system";
+    if (!gnutar_checkdevice)
+       my_argv[i++] = "--no-check-device";
+    my_argv[i++] = "--listed-incremental";
+    my_argv[i++] = incrname;
+    if (gnutar_sparse)
+       my_argv[i++] = "--sparse";
+    if (argument->tar_blocksize) {
+       my_argv[i++] = "--blocking-factor";
+       my_argv[i++] = argument->tar_blocksize;
+    }
+    my_argv[i++] = "--ignore-failed-read";
+    my_argv[i++] = "--totals";
+
+    if(file_exclude) {
+       my_argv[i++] = "--exclude-from";
+       my_argv[i++] = file_exclude;
+    }
+
+    if(file_include) {
+       my_argv[i++] = "--files-from";
+       my_argv[i++] = file_include;
+    }
+    else {
+       my_argv[i++] = ".";
+    }
+    my_argv[i++] = NULL;
+
+    return(my_argv);
+}
+
diff --git a/application-src/amgtar_perl.pl b/application-src/amgtar_perl.pl
new file mode 100644 (file)
index 0000000..ad0d182
--- /dev/null
@@ -0,0 +1,350 @@
+#!@PERL@ 
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+use lib '@amperldir@';
+use strict;
+use Getopt::Long;
+
+package Amanda::Application::amgtar_perl;
+use base qw(Amanda::Application);
+use File::Copy;
+use File::Path;
+use IPC::Open3;
+use Sys::Hostname;
+use Symbol;
+use Amanda::Constants;
+use Amanda::Config qw( :init :getconf  config_dir_relative );
+use Amanda::Debug qw( :logging );
+use Amanda::Paths;
+use Amanda::Util qw( :constants );
+
+sub new {
+    my $class = shift;
+    my ($config, $host, $disk, $device, $level, $index, $message, $collection, $record, $calcsize) = @_;
+    my $self = $class->SUPER::new();
+
+    $self->{runtar}  = ${Amanda::Paths::amlibexecdir} ."/runtar" .
+                      $self->{'suf'};
+    $self->{gnulist} = $Amanda::Paths::GNUTAR_LISTED_INCREMENTAL_DIR;
+    $self->{gnutar}  = $Amanda::Constants::GNUTAR;
+
+    $self->{config}     = $config;
+    $self->{host}       = $host;
+    $self->{disk}       = $disk;
+    $self->{device}     = $device;
+    $self->{level}      = [ @{$level} ];
+    $self->{index}      = $index;
+    $self->{message}    = $message;
+    $self->{collection} = $collection;
+    $self->{record}     = $record;
+    $self->{calcsize}   = $calcsize;
+
+    return $self;
+}
+
+sub command_support {
+   my $self = shift;
+
+   print "CONFIG YES\n";
+   print "HOST YES\n";
+   print "DISK YES\n";
+   print "MAX-LEVEL 9\n";
+   print "INDEX-LINE YES\n";
+   print "INDEX-XML NO\n";
+   print "MESSAGE-LINE YES\n";
+   print "MESSAGE-XML NO\n";
+   print "RECORD YES\n";
+   print "COLLECTION NO\n";
+   print "MULTI-ESTIMATE YES\n";
+   print "CALCSIZE YES\n";
+}
+
+sub command_selfcheck {
+   my $self = shift;
+
+   print "OK " . $self->{disk} . "\n";
+   print "OK " . $self->{device} . "\n";
+   #check binary
+   #check statefile
+   #check amdevice
+   #check property include/exclude
+}
+
+sub command_estimate {
+   my $self = shift;
+
+   if (defined $self->{calcsize}) {
+      $self->run_calcsize("GNUTAR", undef);
+      return;
+   }
+
+   my($listdir) = $self->{'host'} . $self->{'disk'};
+   $listdir     =~ s/\//_/g;
+   my $gnufile;
+   my $level;
+   while (defined ($level = shift @{$self->{level}})) {
+      if($level == 0) {
+         open($gnufile, ">$self->{gnulist}/${listdir}_${level}.new") || die();
+         close($gnufile) || die();
+      }
+      else {
+         my($prev_level) = $level - 1;
+         if (-f "$self->{gnulist}/${listdir}_${prev_level}") {
+           copy("$self->{gnulist}/${listdir}_${prev_level}", "$self->{gnulist}/${listdir}_${level}.new");
+         } else {
+           open($gnufile, ">$self->{gnulist}/${listdir}_${level}.new") || die();
+           close($gnufile) || die();
+       #print "ERROR file $self->{gnulist}/${listdir}_${level}.new doesn't exist\n";
+         }
+      }
+      my($size) = -1;
+      my(@cmd) = ($self->{runtar}, $self->{'config'}, $self->{'gnutar'}, "--create", "--directory", $self->{'device'}, "--listed-incremental", "$self->{gnulist}/${listdir}_${level}.new", "--sparse", "--one-file-system", "--ignore-failed-read", "--totals", "--file", "/dev/null", ".");
+      debug("cmd:" . join(" ", @cmd));
+      my $wtrfh;
+      my $estimate_fd = Symbol::gensym;
+      my $pid = open3($wtrfh, '>&STDOUT', $estimate_fd, @cmd);
+      close($wtrfh);
+
+      $size = parse_estimate($estimate_fd);
+      close($estimate_fd);
+      output_size($level, $size);
+      unlink "$self->{gnulist}/${listdir}_${level}.new";
+      waitpid $pid, 0;
+   }
+   exit 0;
+}
+
+sub parse_estimate {
+   my($fh) = @_;
+   my($size) = -1;
+   while(<$fh>) {
+      if ($_ =~ /^Total bytes written: (\d*)/) {
+         $size = $1;
+         last;
+      }
+   }
+   return $size;
+}
+
+sub output_size {
+   my($level) = shift;
+   my($size) = shift;
+   if($size == -1) {
+      print "$level -1 -1\n";
+      #exit 2;
+   }
+   else {
+      my($ksize) = int $size / (1024);
+      $ksize=32 if ($ksize<32);
+      print "$level $ksize 1\n";
+   }
+}
+
+sub command_backup {
+   my $self = shift;
+
+   my($listdir) = $self->{'host'} . $self->{'disk'};
+   my($verbose) = "";
+   $listdir     =~ s/\//_/g;
+   my($level) = $self->{level}[0];
+   if($level == 0) {
+      open(GNULIST, ">$self->{gnulist}/${listdir}_${level}.new") || die();
+      close(GNULIST) || die();
+   }
+   else {
+      my($prev_level) = $level - 1;
+      copy("$self->{gnulist}/${listdir}_${prev_level}", 
+           "$self->{gnulist}/${listdir}_${level}.new");
+   }
+
+   my $mesgout_fd;
+   open($mesgout_fd, '>&=3') || die();
+   $self->{mesgout} = $mesgout_fd;
+
+   if(defined($self->{index})) {
+      $verbose = "--verbose";
+   }
+   my(@cmd) = ($self->{runtar}, $self->{config}, $self->{gnutar}, "--create", $verbose, "--directory", $self->{device}, "--listed-incremental", "$self->{gnulist}/${listdir}_${level}.new", "--sparse", "--one-file-system", "--ignore-failed-read", "--totals", "--file", "-", ".");
+
+   debug("cmd:" . join(" ", @cmd));
+
+   my $wtrfh;
+   my $index_fd = Symbol::gensym;
+   my $pid = open3($wtrfh, '>&STDOUT', $index_fd, @cmd) || die();
+   close($wtrfh);
+
+   if(defined($self->{index})) {
+      my $indexout_fd;
+      open($indexout_fd, '>&=4') || die();
+      $self->parse_backup($index_fd, $mesgout_fd, $indexout_fd);
+      close($indexout_fd);
+   }
+   else {
+      $self->parse_backup($index_fd, $mesgout_fd, undef);
+   }
+   close($index_fd);
+
+   if(defined($self->{record})) {
+      debug("rename $self->{gnulist}/${listdir}_${level}.new $self->{gnulist}/${listdir}_${level}");
+      rename "$self->{gnulist}/${listdir}_${level}.new", 
+             "$self->{gnulist}/${listdir}_${level}";
+   }
+   else {
+      debug("unlink $self->{gnulist}/${listdir}_${level}.new");
+      unlink "$self->{gnulist}/${listdir}_${level}.new";
+   }
+   waitpid $pid, 0;
+   if( $? != 0 ){
+       print $mesgout_fd "? $self->{gnutar} returned error\n";
+       die();
+   }
+   exit 0;
+}
+
+sub parse_backup {
+   my $self = shift;
+   my($fhin, $fhout, $indexout) = @_;
+   my $size  = -1;
+   my $ksize = -1;
+   while(<$fhin>) {
+      if ( /^\.\//) {
+         if(defined($indexout)) {
+           if(defined($self->{index})) {
+               s/^\.//;
+               print $indexout $_;
+           }
+         }
+      }
+      else {
+            if (/^Total bytes written: (\d*)/) {
+               $size = $1;
+              $ksize = int ($size / 1024);
+            }
+            elsif(defined($fhout)) {
+              if (/: Directory is new$/ ||
+                  /: Directory has been renamed/) {
+                 # ignore
+              } else { # strange
+                  print $fhout "? $_";
+              }
+            }
+      }
+   }
+   if(defined($fhout)) {
+      if ($size == -1) {
+      }
+      else {
+         my($ksize) = int ($size/1024);
+         print $fhout "sendbackup: size $ksize\n";
+         print $fhout "sendbackup: end\n";
+      }
+   }
+}
+
+sub command_index_from_output {
+   index_from_output(0, 1);
+   exit 0;
+}
+
+sub index_from_output {
+   my($fhin, $fhout) = @_;
+   my($size) = -1;
+   while(<$fhin>) {
+      next if /^Total bytes written:/;
+      next if !/^\.\//;
+      s/^\.//;
+      print $fhout $_;
+   }
+}
+
+sub command_index_from_image {
+   my $self = shift;
+   my $index_fd;
+   open($index_fd, "$self->{gnutar} --list --file - |") || die();
+   index_from_output($index_fd, 1);
+}
+
+sub command_restore {
+   my $self = shift;
+
+   chdir(Amanda::Util::get_original_cwd());
+   my(@cmd) = ($self->{gnutar}, "--numeric-owner", "-xpGvf", "-");
+   for(my $i=1;defined $ARGV[$i]; $i++) {
+      my $param = $ARGV[$i];
+      $param =~ /^(.*)$/;
+      push @cmd, $1;
+   }
+   debug("cmd:" . join(" ", @cmd));
+   exec { $cmd[0] } @cmd;
+   die("Can't exec '", $cmd[0], "'");
+}
+
+sub command_validate {
+   my $self = shift;
+
+   my(@cmd) = ($self->{gnutar}, "-tf", "-");
+   debug("cmd:" . join(" ", @cmd));
+   my $pid = open3('>&STDIN', '>&STDOUT', '>&STDERR', @cmd) || die("validate", "Unable to run @cmd");
+   waitpid $pid, 0;
+   if( $? != 0 ){
+       die("validate", "$self->{gnutar} returned error");
+   }
+   exit(0);
+}
+
+sub command_print_command {
+}
+
+package main;
+
+sub usage {
+    print <<EOF;
+Usage: amgtar_perl <command> --config=<config> --host=<host> --disk=<disk> --device=<device> --level=<level> --index=<yes|no> --message=<text> --collection=<no> --record=<yes|no> --calcsize.
+EOF
+    exit(1);
+}
+
+my $opt_config;
+my $opt_host;
+my $opt_disk;
+my $opt_device;
+my @opt_level;
+my $opt_index;
+my $opt_message;
+my $opt_collection;
+my $opt_record;
+my $opt_calcsize;
+
+Getopt::Long::Configure(qw{bundling});
+GetOptions(
+    'config=s'     => \$opt_config,
+    'host=s'       => \$opt_host,
+    'disk=s'       => \$opt_disk,
+    'device=s'     => \$opt_device,
+    'level=s'      => \@opt_level,
+    'index=s'      => \$opt_index,
+    'message=s'    => \$opt_message,
+    'collection=s' => \$opt_collection,
+    'record'       => \$opt_record,
+    'calcsize'     => \$opt_calcsize,
+) or usage();
+
+my $application = Amanda::Application::amgtar_perl->new($opt_config, $opt_host, $opt_disk, $opt_device, \@opt_level, $opt_index, $opt_message, $opt_collection, $opt_record, $opt_calcsize);
+
+$application->do($ARGV[0]);
diff --git a/application-src/amlog-script.pl b/application-src/amlog-script.pl
new file mode 100644 (file)
index 0000000..40dc3e6
--- /dev/null
@@ -0,0 +1,268 @@
+#!@PERL@
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+use lib '@amperldir@';
+use strict;
+use Getopt::Long;
+use File::Basename;
+
+package Amanda::Script::amlog_script;
+use base qw(Amanda::Script);
+use Amanda::Config qw( :getconf :init );
+use Amanda::Debug qw( :logging );
+use Amanda::Util qw( :constants );
+use Amanda::Paths;
+use Amanda::Constants;
+
+
+sub new {
+    my $class = shift;
+    my ($execute_where, $config, $host, $disk, $device, $level, $index, $message, $collection, $record, $logfile) = @_;
+    my $self = $class->SUPER::new($execute_where);
+
+    $self->{execute_where} = $execute_where;
+    $self->{config}        = $config;
+    $self->{host}          = $host;
+    $self->{disk}          = $disk;
+    $self->{device}        = $device;
+    $self->{level}         = [ @{$level} ]; # Copy the array
+    $self->{index}         = $index;
+    $self->{message}       = $message;
+    $self->{collection}    = $collection;
+    $self->{record}        = $record;
+    $self->{logfile}       = $logfile;
+
+    return $self;
+}
+
+sub setup() {
+    my $self = shift;
+
+    if (!defined $self->{logfile}) {
+       $self->print_to_server_and_die($self->{action}, "property LOGFILE not set", $Amanda::Script_App::ERROR);
+    }
+
+    my $dirname = File::Basename::dirname($self->{logfile});
+    if (! -e $dirname) {
+       $self->print_to_server_and_die($self->{action}, "Directory '$dirname' doesn't exist", $Amanda::Script_App::ERROR);
+    }
+    if (! -d $dirname) {
+       $self->print_to_server_and_die($self->{action}, "Directory '$dirname' is not a directory", $Amanda::Script_App::ERROR);
+    }
+}
+
+sub command_support {
+   my $self = shift;
+
+   print "CONFIG YES\n";
+   print "HOST YES\n";
+   print "DISK YES\n";
+   print "MESSAGE-LINE YES\n";
+   print "MESSAGE-XML NO\n";
+   print "EXECUTE-WHERE YES\n";
+}
+
+#define a execute_on_* function for every execute_on you want the script to do
+#something
+sub command_pre_dle_amcheck {
+   my $self = shift;
+
+   $self->{action} = "check";
+   $self->setup();
+   $self->log_data("pre-dle-amcheck");
+}
+
+sub command_pre_host_amcheck {
+   my $self = shift;
+
+   $self->{action} = "check";
+   $self->setup();
+   $self->log_data("pre-host-amcheck");
+}
+
+sub command_post_dle_amcheck {
+   my $self = shift;
+
+   $self->{action} = "check";
+   $self->setup();
+   $self->log_data("post-dle-amcheck");
+}
+
+sub command_post_host_amcheck {
+   my $self = shift;
+
+   $self->{action} = "check";
+   $self->setup();
+   $self->log_data("post-host-amcheck");
+}
+
+sub command_pre_dle_estimate {
+   my $self = shift;
+
+   $self->{action} = "estimate";
+   $self->setup();
+   $self->log_data("pre-dle-estimate");
+}
+
+sub command_pre_host_estimate {
+   my $self = shift;
+
+   $self->{action} = "estimate";
+   $self->setup();
+   $self->log_data("pre-host-estimate");
+}
+
+sub command_post_dle_estimate {
+   my $self = shift;
+
+   $self->{action} = "estimate";
+   $self->setup();
+   $self->log_data("post-dle-estimate");
+}
+
+sub command_post_host_estimate {
+   my $self = shift;
+
+   $self->{action} = "estimate";
+   $self->setup();
+   $self->log_data("post-host-estimate");
+}
+
+sub command_pre_dle_backup {
+   my $self = shift;
+
+   $self->{action} = "backup";
+   $self->setup();
+   $self->log_data("pre-dle-backup");
+}
+
+sub command_pre_host_backup {
+   my $self = shift;
+
+   $self->{action} = "backup";
+   $self->setup();
+   $self->log_data("pre-host-backup");
+}
+
+sub command_post_dle_backup {
+   my $self = shift;
+
+   $self->{action} = "backup";
+   $self->setup();
+   $self->log_data("post-dle-backup");
+}
+
+sub command_post_host_backup {
+   my $self = shift;
+
+   $self->{action} = "backup";
+   $self->setup();
+   $self->log_data("post-host-backup");
+}
+
+sub command_pre_recover {
+   my $self = shift;
+
+   $self->{action} = "restore";
+   $self->setup();
+   $self->log_data("pre-recover");
+}
+
+sub command_post_recover {
+   my $self = shift;
+
+   $self->{action} = "restore";
+   $self->setup();
+   $self->log_data("post-recover");
+}
+
+sub command_pre_level_recover {
+   my $self = shift;
+
+   $self->{action} = "restore";
+   $self->setup();
+   $self->log_data("pre-level-recover");
+}
+
+sub command_post_level_recover {
+   my $self = shift;
+
+   $self->{action} = "restore";
+   $self->setup();
+   $self->log_data("post-level-recover");
+}
+
+sub command_inter_level_recover {
+   my $self = shift;
+
+   $self->{action} = "restore";
+   $self->setup();
+   $self->log_data("inter-level-recover");
+}
+
+sub log_data {
+   my $self = shift;
+   my($function) = shift;
+   my $log;
+
+   open($log, ">>$self->{logfile}") || $self->print_to_server_and_die($self->{action}, "Can't open logfile '$self->{logfile}' for append: $!", $Amanda::Script_App::ERROR);
+   print $log "$self->{config} $function $self->{execute_where} $self->{host} $self->{disk} $self->{device} ", join (" ", @{$self->{level}}), "\n";
+   close $log;
+}
+
+package main;
+
+sub usage {
+    print <<EOF;
+Usage: amlog-script <command> --execute-where=<client|server> --config=<config> --host=<host> --disk=<disk> --device=<device> --level=<level> --index=<yes|no> --message=<text> --collection=<no> --record=<yes|no> --logfile=<filename>.
+EOF
+    exit(1);
+}
+
+my $opt_execute_where;
+my $opt_config;
+my $opt_host;
+my $opt_disk;
+my $opt_device;
+my @opt_level;
+my $opt_index;
+my $opt_message;
+my $opt_collection;
+my $opt_record;
+my $opt_logfile;
+
+Getopt::Long::Configure(qw{bundling});
+GetOptions(
+    'execute-where=s' => \$opt_execute_where,
+    'config=s'        => \$opt_config,
+    'host=s'          => \$opt_host,
+    'disk=s'          => \$opt_disk,
+    'device=s'        => \$opt_device,
+    'level=s'         => \@opt_level,
+    'index=s'         => \$opt_index,
+    'message=s'       => \$opt_message,
+    'collection=s'    => \$opt_collection,
+    'record=s'        => \$opt_record,
+    'logfile=s'       => \$opt_logfile
+) or usage();
+
+my $script = Amanda::Script::amlog_script->new($opt_execute_where, $opt_config, $opt_host, $opt_disk, $opt_device, \@opt_level, $opt_index, $opt_message, $opt_collection, $opt_record, $opt_logfile);
+
+$script->do($ARGV[0]);
+
diff --git a/application-src/amsamba.pl b/application-src/amsamba.pl
new file mode 100644 (file)
index 0000000..ba45e27
--- /dev/null
@@ -0,0 +1,691 @@
+#!@PERL@ 
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+use lib '@amperldir@';
+use strict;
+use Getopt::Long;
+
+package Amanda::Application::Amsamba;
+use base qw(Amanda::Application);
+use File::Copy;
+use File::Path;
+use IPC::Open2;
+use IPC::Open3;
+use Sys::Hostname;
+use Symbol;
+use IO::Handle;
+use Amanda::Constants;
+use Amanda::Config qw( :init :getconf  config_dir_relative );
+use Amanda::Debug qw( :logging );
+use Amanda::Paths;
+use Amanda::Util qw( :constants :quoting);
+
+sub new {
+    my $class = shift;
+    my ($config, $host, $disk, $device, $level, $index, $message, $collection, $record, $calcsize, $gnutar_path, $smbclient_path, $amandapass, $exclude_file, $exclude_list, $exclude_optional, $include_file, $include_list, $include_optional, $recover_mode) = @_;
+    my $self = $class->SUPER::new();
+
+    if (defined $gnutar_path) {
+       $self->{gnutar}     = $gnutar_path;
+    } else {
+       $self->{gnutar}     = $Amanda::Constants::GNUTAR;
+    }
+    if (defined $smbclient_path) {
+       $self->{smbclient}  = $smbclient_path;
+    } else {
+       $self->{smbclient}  = $Amanda::Constants::SAMBA_CLIENT;
+    }
+    if (defined $amandapass) {
+       $self->{amandapass}  = $amandapass;
+    } else {
+       $self->{amandapass}  = "$Amanda::Paths::sysconfdir/amandapass";
+    }
+
+    $self->{config}           = $config;
+    $self->{host}             = $host;
+    $self->{disk}             = $disk;
+    $self->{device}           = $device;
+    $self->{level}            = [ @{$level} ];
+    $self->{index}            = $index;
+    $self->{message}          = $message;
+    $self->{collection}       = $collection;
+    $self->{record}           = $record;
+    $self->{calcsize}         = $calcsize;
+    $self->{exclude_file}     = [ @{$exclude_file} ];
+    $self->{exclude_list}     = [ @{$exclude_list} ];
+    $self->{exclude_optional} = $exclude_optional;
+    $self->{include_file}     = [ @{$include_file} ];
+    $self->{include_list}     = [ @{$include_list} ];
+    $self->{include_optional} = $include_optional;
+    $self->{recover_mode}     = $recover_mode;
+
+    return $self;
+}
+
+# on entry:
+#   $self->{exclude_file}
+#   $self->{exclude_list}
+#   $self->{include_file}
+#   $self->{include_list}
+#on exit:
+#  $self->{exclude}
+#  $self->{include}
+sub validate_inexclude {
+    my $self = shift;
+
+    if ($#{$self->{exclude_file}} + $#{$self->{exclude_list}} >= -1 &&
+       $#{$self->{include_file}} + $#{$self->{include_list}} >= -1) {
+       $self->print_to_server_and_die($self->{action},
+                                      "Can't have both include and exclude",
+                                      $Amanda::Script_App::ERROR);
+    }
+
+    if ($#{$self->{exclude_file}} >= 0) {
+       $self->{exclude} = [ @{$self->{exclude_file}} ];
+    }
+    foreach my $file (@{$self->{exclude_list}}) {
+       if (!open(FF, $file)) {
+           if ($self->{action} eq 'check' && !$self->{exclude_optional}) {
+               $self->print_to_server($self->{action},
+                                      "Open of '$file' failed: $!",
+                                      $Amanda::Script_App::ERROR);
+           }
+           next;
+       }
+       while (<FF>) {
+           chomp;
+           push @{$self->{exclude}}, $_;
+       }
+       close(FF);
+    }
+    if ($#{$self->{include_file}} >= 0) {
+       $self->{include} = [ @{$self->{include_file}} ];
+    }
+    foreach my $file (@{$self->{include_list}}) {
+       if (open(FF, $file)) {
+           if ($self->{action} eq 'check') {
+               $self->print_to_server($self->{action},
+                                      "Open of '$file' failed: $!",
+                                      $Amanda::Script_App::ERROR);
+           }
+           next;
+       }
+       while (<FF>) {
+           chomp;
+           push @{$self->{include}}, $_;
+       }
+       close(FF);
+    }
+}
+
+# on entry:
+#   $self->disk == //host/share/subdir
+# on exit:
+#   self->{cifshost} = //host
+#   $self->{share} = //host/share
+#   $self->{sambashare} = \\host\share
+#   $self->{subdir} = subdir
+sub parsesharename {
+    my $self = shift;
+
+    return if !defined $self->{disk};
+
+    if ($self->{disk} =~ m,^(//[^/]+/[^/]+)/(.*)$,) {
+       $self->{share} = $1;
+       $self->{subdir} = $2
+    } else {
+       $self->{share} = $self->{disk};
+    }
+    $self->{sambashare} = $self->{share};
+    $self->{sambashare} =~ s,/,\\,g;
+    $self->{disk} =~ m,^(//[^/]+)/[^/]+,;
+    $self->{cifshost} = $1;
+}
+
+
+# Read $self->{amandapass} file.
+# on entry:
+#   $self->{share} == //host/share
+# on exit:
+#   $self->{domain}   = domain to connect to.
+#   $self->{username} = username (-U)
+#   $self->{password} = password
+sub findpass {
+    my $self = shift;
+
+    my $amandapass;
+    my $line;
+
+    open($amandapass, $self->{amandapass});
+    while ($line = <$amandapass>) {
+       chomp $line;
+       next if $line =~ /^#/;
+       my ($diskname, $userdomain) = Amanda::Util::skip_quoted_string($line);
+       if (defined $diskname &&
+           ($diskname eq '*' ||
+            ($diskname =~ m,^(//[^/]+)/\*$, && $1 eq $self->{cifshost}) ||
+            $diskname eq $self->{share} ||
+            $diskname eq $self->{sambashare})) {
+           my ($userpasswd, $domain) = split ' ', $userdomain;
+           $self->{domain} = $domain;
+           my ($username, $password) = split('%', $userpasswd);
+           $self->{username} = $username;
+           $self->{password} = $password;
+           close($amandapass);
+           return;
+       }
+    }
+    close($amandapass);
+    $self->print_to_server_and_die($self->{action},"Cannot find password for share $self->{share} in $self->{amandapass}", $Amanda::Script_App::ERROR);
+}
+
+sub command_support {
+    my $self = shift;
+
+    print "CONFIG YES\n";
+    print "HOST YES\n";
+    print "DISK YES\n";
+    print "MAX-LEVEL 1\n";
+    print "INDEX-LINE YES\n";
+    print "INDEX-XML NO\n";
+    print "MESSAGE-LINE YES\n";
+    print "MESSAGE-XML NO\n";
+    print "RECORD YES\n";
+    print "COLLECTION NO\n";
+    print "MULTI-ESTIMATE NO\n";
+    print "CALCSIZE NO\n";
+    print "EXCLUDE-FILE YES\n";
+    print "EXCLUDE-LIST YES\n";
+    print "EXCLUDE-OPTIONAL YES\n";
+    print "INCLUDE-FILE YES\n";
+    print "INCLUDE-LIST YES\n";
+    print "INCLUDE-OPTIONAL YES\n";
+    print "RECOVER-MODE SMB\n";
+}
+
+sub command_selfcheck {
+    my $self = shift;
+
+    $self->{action} = 'check';
+    $self->parsesharename();
+    $self->findpass();
+    $self->validate_inexclude();
+
+    print "OK " . $self->{share} . "\n";
+    print "OK " . $self->{disk} . "\n";
+    print "OK " . $self->{device} . "\n";
+
+    my ($child_rdr, $parent_wtr);
+    $^F=10;
+    pipe($child_rdr,  $parent_wtr);
+    $parent_wtr->autoflush(1);
+    my($wtr, $rdr, $err);
+    $err = Symbol::gensym;
+    my $pid = open3($wtr, $rdr, $err, "-");
+    if ($pid == 0) {
+       #child
+       my $ff = $child_rdr->fileno;
+       debug("child_rdr $ff");
+       $parent_wtr->close();
+       $ENV{PASSWD_FD} = $child_rdr->fileno;
+       close(1);
+       close(2);
+       my @ARGV = ();
+       push @ARGV, $self->{smbclient}, $self->{share},
+                   "-U", $self->{username},
+                   "-E";
+       if (defined $self->{domain}) {
+           push @ARGV, "-W", $self->{domain},
+       }
+       if (defined $self->{subdir}) {
+           push @ARGV, "-D", $self->{subdir},
+       }
+       push @ARGV, "-c", "quit";
+       debug("execute: " . $self->{smbclient} . " " .
+             join(" ", @ARGV));
+       exec {$self->{smbclient}} @ARGV;
+    }
+    #parent
+    my $ff = $parent_wtr->fileno;
+    debug("parent_wtr $ff");
+    debug("password $self->{password}");
+    $parent_wtr->print($self->{password});
+    $parent_wtr->close();
+    $child_rdr->close();
+    close($wtr);
+    close($rdr);
+    while (<$err>) {
+       chomp;
+       debug("stderr: " . $_);
+       next if /^Domain=/;
+       $self->print_to_server($self->{action}, "smbclient: $_",
+                              $Amanda::Script_App::ERROR);
+    }
+    close($err);
+    waitpid($pid, 0);
+    #check binary
+    #check statefile
+    #check amdevice
+}
+
+sub command_estimate {
+    my $self = shift;
+
+    $self->{action} = 'estimate';
+    $self->parsesharename();
+    $self->findpass();
+    $self->validate_inexclude();
+
+    my $level = $self->{level}[0];
+    my ($child_rdr, $parent_wtr);
+    $^F=10;
+    pipe($child_rdr,  $parent_wtr);
+    $parent_wtr->autoflush(1);
+    my($wtr, $rdr, $err);
+    $err = Symbol::gensym;
+    my $pid = open3($wtr, $rdr, $err, "-");
+    if ($pid == 0) {
+       #child
+       my $ff = $child_rdr->fileno;
+       debug("child_rdr $ff");
+       $parent_wtr->close();
+       $ENV{PASSWD_FD} = $child_rdr->fileno;
+       close(0);
+       close(1);
+       my @ARGV = ();
+       push @ARGV, $self->{smbclient}, $self->{share},
+                   "-d", "0",
+                   "-U", $self->{username},
+                   "-E";
+       if (defined $self->{domain}) {
+           push @ARGV, "-W", $self->{domain},
+       }
+       if (defined $self->{subdir}) {
+           push @ARGV, "-D", $self->{subdir},
+       }
+       if ($level == 0) {
+           push @ARGV, "-c", "archive 0;recurse;du";
+       } else {
+           push @ARGV, "-c", "archive 1;recurse;du";
+       }
+       debug("execute: " . $self->{smbclient} . " " .
+             join(" ", @ARGV));
+       exec {$self->{smbclient}} @ARGV;
+    }
+    #parent
+    my $ff = $parent_wtr->fileno;
+    debug("parent_wtr $ff");
+    debug("password $self->{password}");
+    $parent_wtr->print($self->{password});
+    $parent_wtr->close();
+    $child_rdr->close();
+    close($wtr);
+    close($rdr);
+    my $size = $self->parse_estimate($err);
+    close($err);
+    output_size($level, $size);
+    waitpid($pid, 0);
+}
+
+sub parse_estimate {
+    my $self = shift;
+    my($fh)  = shift;
+    my($size) = -1;
+    while(<$fh>) {
+       chomp;
+       next if /^\s*$/;
+       next if /blocks of size/;
+       next if /blocks available/;
+       next if /^\s*$/;
+       next if /^Domain=/;
+       next if /dumped \d+ files and directories/;
+       debug("stderr: $_");
+       if ($_ =~ /^Total number of bytes: (\d*)/) {
+           $size = $1;
+           last;
+       } else {
+           $self->print_to_server($self->{action}, "smbclient: $_",
+                                  $Amanda::Script_App::ERROR);
+       }
+    }
+    return $size;
+}
+
+sub output_size {
+   my($level) = shift;
+   my($size) = shift;
+   if($size == -1) {
+      print "$level -1 -1\n";
+      #exit 2;
+   }
+   else {
+      my($ksize) = int $size / (1024);
+      $ksize=32 if ($ksize<32);
+      print "$level $ksize 1\n";
+   }
+}
+
+sub command_backup {
+    my $self = shift;
+
+    $self->{action} = 'backup';
+    $self->parsesharename();
+    $self->findpass();
+    $self->validate_inexclude();
+
+    my $level = $self->{level}[0];
+    my $mesgout_fd;
+    open($mesgout_fd, '>&=3') || die();
+    $self->{mesgout} = $mesgout_fd;
+
+    my $pid_tee = open3(\*INDEX_IN, '>&STDOUT', \*INDEX_TEE, "-");
+    if ($pid_tee == 0) {
+       close(INDEX_IN);
+       close(INDEX_TEE);
+       my $buf;
+       my $size = -1;
+       while (($size = POSIX::read(0, $buf, 32768)) > 0) {
+           POSIX::write(1, $buf, $size);
+           POSIX::write(2, $buf, $size);
+       }
+       exit 0;
+    }
+    my ($child_rdr, $parent_wtr);
+    $^F=10;
+    pipe($child_rdr,  $parent_wtr);
+    $^F=2;
+    $parent_wtr->autoflush(1);
+    my($wtr, $err);
+    $err = Symbol::gensym;
+    my $pid = open3($wtr, ">&INDEX_IN", $err, "-");
+    if ($pid == 0) {
+       #child
+       my $ff = $child_rdr->fileno;
+       debug("child_rdr $ff");
+       $parent_wtr->close();
+       $ENV{PASSWD_FD} = $child_rdr->fileno;
+       close(0);
+       my @ARGV = ();
+       push @ARGV, $self->{smbclient}, $self->{share},
+                   "-d", "0",
+                   "-U", $self->{username},
+                   "-E";
+       if (defined $self->{domain}) {
+           push @ARGV, "-W", $self->{domain},
+       }
+       if (defined $self->{subdir}) {
+           push @ARGV, "-D", $self->{subdir},
+       }
+       my $comm ;
+       if ($level == 0) {
+           $comm = "-Tqca";
+       } else {
+           $comm = "-Tqcg";
+       }
+       if ($#{$self->{exclude}} >= 0) {
+           $comm .= "X";
+       }
+       if ($#{$self->{include}} >= 0) {
+           $comm .= "I";
+       }
+       push @ARGV, $comm, "-";
+       if ($#{$self->{exclude}} >= 0) {
+           push @ARGV, @{$self->{exclude}};
+       }
+       if ($#{$self->{include}} >= 0) {
+           push @ARGV, @{$self->{include}};
+       }
+       debug("execute: " . $self->{smbclient} . " " .
+             join(" ", @ARGV));
+       exec {$self->{smbclient}} @ARGV;
+    }
+
+    my $ff = $parent_wtr->fileno;
+    debug("parent_wtr $ff");
+    debug("password $self->{password}");
+    $parent_wtr->print($self->{password});
+    $parent_wtr->close();
+    $child_rdr->close();
+    close($wtr);
+
+    #index process 
+    my $index;
+    debug("$self->{gnutar} -tf -");
+    my $pid_index1 = open2($index, '<&INDEX_TEE', $self->{gnutar}, "-tf", "-");
+    close(INDEX_IN);
+    my $size = -1;
+    my $index_fd = $index->fileno;
+    debug("index $index_fd");
+    if (defined($self->{index})) {
+       my $indexout_fd;
+       open($indexout_fd, '>&=4') || die();
+       $self->parse_backup($index, $mesgout_fd, $indexout_fd);
+       close($indexout_fd);
+    }
+    else {
+       $self->parse_backup($index_fd, $mesgout_fd, undef);
+    }
+    close($index);
+
+    while (<$err>) {
+       chomp;
+       debug("stderr: " . $_);
+       next if /^Domain=/;
+       next if /dumped (\d+) files and directories/;
+       if (/^Total bytes written: (\d*)/) {
+           $size = $1;
+       } else {
+           $self->print_to_server($self->{action}, "smbclient: $_",
+                                  $Amanda::Script_App::ERROR);
+       }
+    }
+    if ($size >= 0) {
+       my $ksize = $size / 1024;
+       if ($ksize < 32) {
+           $ksize = 32;
+       }
+       print $mesgout_fd "sendbackup: size $ksize\n";
+       print $mesgout_fd "sendbackup: end\n";
+    }
+
+    waitpid $pid, 0;
+    if ($? != 0) {
+       $self->print_to_server_and_die($self->{action},
+                                      "smbclient returned error",
+                                      $Amanda::Script_App::ERROR);
+    }
+    exit 0;
+}
+
+sub parse_backup {
+    my $self = shift;
+    my($fhin, $fhout, $indexout) = @_;
+    my $size  = -1;
+    while(<$fhin>) {
+       if ( /^\.\//) {
+           if(defined($indexout)) {
+               if(defined($self->{index})) {
+                   s/^\.//;
+                   print $indexout $_;
+               }
+           }
+       }
+       else {
+           print $fhout "? $_";
+       }
+    }
+}
+
+sub command_index_from_output {
+   index_from_output(0, 1);
+   exit 0;
+}
+
+sub index_from_output {
+   my($fhin, $fhout) = @_;
+   my($size) = -1;
+   while(<$fhin>) {
+      next if /^Total bytes written:/;
+      next if !/^\.\//;
+      s/^\.//;
+      print $fhout $_;
+   }
+}
+
+sub command_index_from_image {
+   my $self = shift;
+   my $index_fd;
+   open($index_fd, "$self->{gnutar} --list --file - |") || die();
+   index_from_output($index_fd, 1);
+}
+
+sub command_restore {
+    my $self = shift;
+    my @cmd = ();
+
+    $self->{restore} = 'backup';
+    $self->parsesharename();
+    chdir(Amanda::Util::get_original_cwd());
+
+    if ($self->{recover_mode} eq "smb") {
+       $self->findpass();
+       push @cmd, $self->{smbclient}, $self->{share},
+                  "-d", "0",
+                  "-U", $self->{username};
+       
+       if (defined $self->{domain}) {
+           push @cmd, "-W", $self->{domain};
+       }
+       push @cmd, "-Tx", "-";
+       for(my $i=1;defined $ARGV[$i]; $i++) {
+           my $param = $ARGV[$i];
+           $param =~ /^(.*)$/;
+           push @cmd, $1;
+       }
+       my ($parent_rdr, $child_wtr);
+       $^F=10;
+       pipe($parent_rdr,  $child_wtr);
+       $child_wtr->autoflush(1);
+       my($wtr, $rdr, $err);
+       $err = Symbol::gensym;
+       my $pid = open3($wtr, $rdr, $err, "-");
+       if ($pid == 0) {
+           $child_wtr->print($self->{password});
+           $child_wtr->close();
+           exit 0;
+       }
+       $child_wtr->close();
+       $ENV{PASSWD_FD} = $parent_rdr->fileno;
+       debug("cmd:" . join(" ", @cmd));
+       exec { $cmd[0] } @cmd;
+       die("Can't exec '", $cmd[0], "'");
+    } else {
+       push @cmd, $self->{gnutar}, "-xpvf", "-";
+       for(my $i=1;defined $ARGV[$i]; $i++) {
+           my $param = $ARGV[$i];
+           $param =~ /^(.*)$/;
+           push @cmd, $1;
+       }
+       debug("cmd:" . join(" ", @cmd));
+       exec { $cmd[0] } @cmd;
+       die("Can't exec '", $cmd[0], "'");
+    }
+}
+
+sub command_validate {
+   my $self = shift;
+
+   $self->{validate} = 'backup';
+   my(@cmd) = ($self->{gnutar}, "-tf", "-");
+   debug("cmd:" . join(" ", @cmd));
+   my $pid = open3('>&STDIN', '>&STDOUT', '>&STDERR', @cmd) || die("validate", "Unable to run @cmd");
+   waitpid $pid, 0;
+   if( $? != 0 ){
+       die("validate", "$self->{gnutar} returned error");
+   }
+   exit(0);
+}
+
+sub command_print_command {
+}
+
+package main;
+
+sub usage {
+    print <<EOF;
+Usage: amsamba <command> --config=<config> --host=<host> --disk=<disk> --device=<device> --level=<level> --index=<yes|no> --message=<text> --collection=<no> --record=<yes|no> --calcsize.
+EOF
+    exit(1);
+}
+
+my $opt_version;
+my $opt_config;
+my $opt_host;
+my $opt_disk;
+my $opt_device;
+my @opt_level;
+my $opt_index;
+my $opt_message;
+my $opt_collection;
+my $opt_record;
+my $opt_calcsize;
+my $opt_gnutar_path;
+my $opt_smbclient_path;
+my $opt_amandapass;
+my @opt_exclude_file;
+my @opt_exclude_list;
+my $opt_exclude_optional;
+my @opt_include_file;
+my @opt_include_list;
+my $opt_include_optional;
+my $opt_recover_mode;
+
+Getopt::Long::Configure(qw{bundling});
+GetOptions(
+    'version'            => \$opt_version,
+    'config=s'           => \$opt_config,
+    'host=s'             => \$opt_host,
+    'disk=s'             => \$opt_disk,
+    'device=s'           => \$opt_device,
+    'level=s'            => \@opt_level,
+    'index=s'            => \$opt_index,
+    'message=s'          => \$opt_message,
+    'collection=s'       => \$opt_collection,
+    'record'             => \$opt_record,
+    'calcsize'           => \$opt_calcsize,
+    'gnutar_path'        => \$opt_gnutar_path,
+    'smbclient_path'     => \$opt_smbclient_path,
+    'amandapass'         => \$opt_amandapass,
+    'exclude-file=s'     => \@opt_exclude_file,
+    'exclude-list=s'     => \@opt_exclude_list,
+    'exclude-optional=s' => \$opt_exclude_optional,
+    'include-file=s'     => \@opt_include_file,
+    'include-list=s'     => \@opt_include_list,
+    'include-optional=s' => \$opt_include_optional,
+    'recover-mode=s'     => \$opt_recover_mode,
+) or usage();
+
+if (defined $opt_version) {
+    print "amsamba-" . $Amanda::Constants::VERSION , "\n";
+    exit(0);
+}
+
+my $application = Amanda::Application::Amsamba->new($opt_config, $opt_host, $opt_disk, $opt_device, \@opt_level, $opt_index, $opt_message, $opt_collection, $opt_record, $opt_calcsize, $opt_gnutar_path, $opt_smbclient_path, $opt_amandapass, \@opt_exclude_file, \@opt_exclude_list, $opt_exclude_optional, \@opt_include_file, \@opt_include_list, $opt_include_optional, $opt_recover_mode);
+
+$application->do($ARGV[0]);
diff --git a/application-src/amstar.c b/application-src/amstar.c
new file mode 100644 (file)
index 0000000..eb6e494
--- /dev/null
@@ -0,0 +1,797 @@
+/*
+ * Amanda, The Advanced Maryland Automatic Network Disk Archiver
+ * Copyright (c) 1991-1998 University of Maryland at College Park
+ * All Rights Reserved.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of U.M. not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  U.M. makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as is"
+ * without express or implied warranty.
+ *
+ * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M.
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors: the Amanda Development Team.  Its members are listed in a
+ * file named AUTHORS, in the root directory of this distribution.
+ */
+/* 
+ * $Id: amstar.c 8888 2007-10-02 13:40:42Z martineau $
+ *
+ * send estimated backup sizes using dump
+ */
+
+/* PROPERTY:
+ *
+ * STAR-PATH (default STAR)
+ * STAR-TARDUMP
+ * STAR-DLE-TARDUMP
+ * ONE-FILE-SYSTEM
+ * SPARSE
+ */
+
+#include "amanda.h"
+#include "pipespawn.h"
+#include "amfeatures.h"
+#include "amandates.h"
+#include "clock.h"
+#include "util.h"
+#include "getfsent.h"
+#include "version.h"
+#include "client_util.h"
+#include "conffile.h"
+#include "amandad.h"
+#include "getopt.h"
+#include "sendbackup.h"
+
+int debug_application = 1;
+#define application_debug(i, ...) do { \
+       if ((i) <= debug_application) { \
+           dbprintf(__VA_ARGS__);      \
+       }                               \
+} while (0)
+
+static amregex_t re_table[] = {
+  /* tar prints the size in bytes */
+  AM_SIZE_RE("star: [0-9][0-9]* blocks", 10240, 1),
+  AM_NORMAL_RE("^could not open conf file"),
+  AM_NORMAL_RE("^Type of this level "),
+  AM_NORMAL_RE("^Date of this level "),
+  AM_NORMAL_RE("^Date of last level "),
+  AM_NORMAL_RE("^Dump record  level "),
+  AM_NORMAL_RE("^Throughput"),
+  AM_NORMAL_RE("^.*is sparse$"),
+
+#ifdef IGNORE_TAR_ERRORS
+  AM_NORMAL_RE("^.*shrunk*$"),
+  AM_NORMAL_RE("^.*changed size.*$"),
+  AM_NORMAL_RE("^.*Cannot listxattr for.*$"),
+  AM_NORMAL_RE("^.Cannot: stat .*$"),
+  AM_NORMAL_RE("^.Missing links .*$"),
+  AM_NORMAL_RE("^.Cannot get xattr.*$"),
+  AM_NORMAL_RE("^.Cannot.*acl.*$"),
+#endif
+
+  AM_NORMAL_RE("^star: dumped [0-9][0-9]* (tar )?files"),
+  AM_NORMAL_RE("^.*The following problems occurred during .* processing.*$"),
+  AM_NORMAL_RE("^.*Processed all possible files, despite earlier errors.*$"),
+  AM_NORMAL_RE("^.*not written due to problems during backup.*$"),
+
+  AM_STRANGE_RE("^Perform a level 0 dump first.*$"),
+
+  /* catch-all: DMP_STRANGE is returned for all other lines */
+  AM_STRANGE_RE(NULL)
+};
+
+/* local functions */
+int main(int argc, char **argv);
+
+typedef struct application_argument_s {
+    char      *config;
+    char      *host;
+    int        message;
+    int        collection;
+    int        calcsize;
+    GSList    *level;
+    dle_t      dle;
+    int        argc;
+    char     **argv;
+} application_argument_t;
+
+enum { CMD_ESTIMATE, CMD_BACKUP };
+
+static void amstar_support(application_argument_t *argument);
+static void amstar_selfcheck(application_argument_t *argument);
+static void amstar_estimate(application_argument_t *argument);
+static void amstar_backup(application_argument_t *argument);
+static void amstar_restore(application_argument_t *argument);
+static void amstar_validate(application_argument_t *argument);
+static char **amstar_build_argv(application_argument_t *argument,
+                               int level,
+                               int command);
+char *star_path;
+char *star_tardumps;
+int   star_dle_tardumps;
+int   star_onefilesystem;
+int   star_sparse;
+
+static struct option long_options[] = {
+    {"config"          , 1, NULL,  1},
+    {"host"            , 1, NULL,  2},
+    {"disk"            , 1, NULL,  3},
+    {"device"          , 1, NULL,  4},
+    {"level"           , 1, NULL,  5},
+    {"index"           , 1, NULL,  6},
+    {"message"         , 1, NULL,  7},
+    {"collection"      , 0, NULL,  8},
+    {"record"          , 0, NULL,  9},
+    {"star-path"       , 1, NULL, 10},
+    {"star-tardump"    , 1, NULL, 11},
+    {"star-dle-tardump", 1, NULL, 12},
+    {"one-file-system" , 1, NULL, 13},
+    {"sparse"          , 1, NULL, 14},
+    {"calcsize"        , 0, NULL, 15},
+    { NULL, 0, NULL, 0}
+};
+
+
+int
+main(
+    int                argc,
+    char **    argv)
+{
+    int c;
+    char *command;
+    application_argument_t argument;
+
+#ifdef STAR
+    star_path = STAR;
+#else
+    star_path = NULL;
+#endif
+    star_tardumps = "/etc/tardumps";
+    star_dle_tardumps = 0;
+    star_onefilesystem = 1;
+    star_sparse = 1;
+
+    /* initialize */
+
+    /*
+     * Configure program for internationalization:
+     *   1) Only set the message locale for now.
+     *   2) Set textdomain for all amanda related programs to "amanda"
+     *      We don't want to be forced to support dozens of message catalogs.
+     */  
+    setlocale(LC_MESSAGES, "C");
+    textdomain("amanda"); 
+
+    /* drop root privileges */
+
+    if (!set_root_privs(0)) {
+       error(_("amstar must be run setuid root"));
+    }
+
+    safe_fd(3, 2);
+
+    set_pname("amstar");
+
+    /* Don't die when child closes pipe */
+    signal(SIGPIPE, SIG_IGN);
+
+#if defined(USE_DBMALLOC)
+    malloc_size_1 = malloc_inuse(&malloc_hist_1);
+#endif
+
+    erroutput_type = (ERR_INTERACTIVE|ERR_SYSLOG);
+    dbopen(DBG_SUBDIR_CLIENT);
+    startclock();
+    dbprintf(_("version %s\n"), version());
+
+    config_init(CONFIG_INIT_CLIENT, NULL);
+
+    //check_running_as(RUNNING_AS_DUMPUSER_PREFERRED);
+    //root for amrecover
+    //RUNNING_AS_CLIENT_LOGIN from selfcheck, sendsize, sendbackup
+
+    /* parse argument */
+    command = argv[1];
+
+    argument.config     = NULL;
+    argument.host       = NULL;
+    argument.message    = 0;
+    argument.collection = 0;
+    argument.calcsize   = 0;
+    argument.level      = NULL;
+    init_dle(&argument.dle);
+
+    opterr = 0;
+    while (1) {
+       int option_index = 0;
+       c = getopt_long (argc, argv, "", long_options, &option_index);
+       if (c == -1)
+           break;
+
+       switch (c) {
+       case 1: argument.config = stralloc(optarg);
+               break;
+       case 2: argument.host = stralloc(optarg);
+               break;
+       case 3: argument.dle.disk = stralloc(optarg);
+               break;
+       case 4: argument.dle.device = stralloc(optarg);
+               break;
+       case 5: argument.level = g_slist_append(argument.level,
+                                               GINT_TO_POINTER(atoi(optarg)));
+               break;
+       case 6: argument.dle.create_index = 1;
+               break;
+       case 7: argument.message = 1;
+               break;
+       case 8: argument.collection = 1;
+               break;
+       case 9: argument.dle.record = 1;
+               break;
+       case 10: star_path = stralloc(optarg);
+                break;
+       case 11: star_tardumps = stralloc(optarg);
+                break;
+       case 12: if (optarg && strcasecmp(optarg, "YES") == 0)
+                    star_dle_tardumps = 1;
+                break;
+       case 13: if (optarg && strcasecmp(optarg, "YES") != 0)
+                    star_onefilesystem = 0;
+                break;
+       case 14: if (optarg && strcasecmp(optarg, "YES") != 0)
+                    star_sparse = 1;
+                break;
+       case 15: argument.calcsize = 1;
+                break;
+       case ':':
+       case '?':
+               break;
+       }
+    }
+
+    argument.argc = argc - optind;
+    argument.argv = argv + optind;
+
+    if (argument.config) {
+       /* overlay this configuration on the existing (nameless) configuration */
+       config_init(CONFIG_INIT_CLIENT | CONFIG_INIT_EXPLICIT_NAME | CONFIG_INIT_OVERLAY,
+                   argument.config);
+       dbrename(get_config_name(), DBG_SUBDIR_CLIENT);
+
+    }
+
+    if (config_errors(NULL) >= CFGERR_ERRORS) {
+       g_critical(_("errors processing config file"));
+    }
+
+    if (strcmp(command, "support") == 0) {
+       amstar_support(&argument);
+    } else if (strcmp(command, "selfcheck") == 0) {
+       amstar_selfcheck(&argument);
+    } else if (strcmp(command, "estimate") == 0) {
+       amstar_estimate(&argument);
+    } else if (strcmp(command, "backup") == 0) {
+       amstar_backup(&argument);
+    } else if (strcmp(command, "restore") == 0) {
+       amstar_restore(&argument);
+    } else if (strcmp(command, "validate") == 0) {
+       amstar_validate(&argument);
+    } else {
+       fprintf(stderr, "Unknown command `%s'.\n", command);
+       exit (1);
+    }
+    return 0;
+}
+
+static void
+amstar_support(
+    application_argument_t *argument)
+{
+    (void)argument;
+    fprintf(stdout, "CONFIG YES\n");
+    fprintf(stdout, "HOST YES\n");
+    fprintf(stdout, "DISK YES\n");
+    fprintf(stdout, "MAX-LEVEL 9\n");
+    fprintf(stdout, "INDEX-LINE YES\n");
+    fprintf(stdout, "INDEX-XML NO\n");
+    fprintf(stdout, "MESSAGE-LINE YES\n");
+    fprintf(stdout, "MESSAGE-XML NO\n");
+    fprintf(stdout, "RECORD YES\n");
+    fprintf(stdout, "INCLUDE-FILE NO\n");
+    fprintf(stdout, "INCLUDE-LIST NO\n");
+    fprintf(stdout, "EXCLUDE-FILE YES\n");
+    fprintf(stdout, "EXCLUDE-LIST YES\n");
+    fprintf(stdout, "COLLECTION NO\n");
+    fprintf(stdout, "MULTI-ESTIMATE YES\n");
+    fprintf(stdout, "CALCSIZE YES\n");
+}
+
+static void
+amstar_selfcheck(
+    application_argument_t *argument)
+{
+    char   *qdisk;
+    char   *qdevice;
+
+    qdisk = quote_string(argument->dle.disk);
+    qdevice = quote_string(argument->dle.device);
+    fprintf(stdout, "OK %s\n", qdisk);
+    fprintf(stdout, "OK %s\n", qdevice);
+
+    if (!star_path) {
+       fprintf(stdout, "ERROR STAR-PATH not defined\n");
+    } else {
+       check_file(star_path, X_OK);
+    }
+
+    {
+       char *amandates_file;
+       amandates_file = getconf_str(CNF_AMANDATES);
+       check_file(amandates_file, R_OK|W_OK);
+    }
+
+}
+
+static void
+amstar_estimate(
+    application_argument_t *argument)
+{
+    char **my_argv = NULL;
+    char  *cmd = NULL;
+    int    nullfd;
+    int    pipefd;
+    FILE  *dumpout = NULL;
+    off_t  size = -1;
+    char   line[32768];
+    char  *errmsg = NULL;
+    char  *qerrmsg;
+    char  *qdisk;
+    amwait_t wait_status;
+    int    starpid;
+    amregex_t *rp;
+    times_t start_time;
+    int     level = 0;
+    GSList *levels = NULL;
+
+    qdisk = quote_string(argument->dle.disk);
+    if (argument->calcsize) {
+       char *dirname;
+
+       dirname = amname_to_dirname(argument->dle.device);
+       run_calcsize(argument->config, "STAR", argument->dle.disk, dirname,
+                    argument->level, NULL, NULL);
+       return;
+    }
+
+    if (!star_path) {
+       errmsg = vstrallocf(_("STAR-PATH not defined"));
+       goto common_error;
+    }
+    cmd = stralloc(star_path);
+
+    start_time = curclock();
+
+    for (levels = argument->level; levels != NULL; levels = levels->next) {
+       level = GPOINTER_TO_INT(levels->data);
+       my_argv = amstar_build_argv(argument, level, CMD_ESTIMATE);
+
+       if ((nullfd = open("/dev/null", O_RDWR)) == -1) {
+           errmsg = vstrallocf(_("Cannot access /dev/null : %s"),
+                               strerror(errno));
+           goto common_error;
+       }
+
+       starpid = pipespawnv(cmd, STDERR_PIPE, 1,
+                            &nullfd, &nullfd, &pipefd, my_argv);
+
+       dumpout = fdopen(pipefd,"r");
+       if (!dumpout) {
+           errmsg = vstrallocf(_("Can't fdopen: %s"), strerror(errno));
+           goto common_error;
+       }
+
+       size = (off_t)-1;
+       while (size < 0 && (fgets(line, sizeof(line), dumpout)) != NULL) {
+           if (line[strlen(line)-1] == '\n') /* remove trailling \n */
+               line[strlen(line)-1] = '\0';
+           if (line[0] == '\0')
+               continue;
+           dbprintf("%s\n", line);
+           /* check for size match */
+           /*@ignore@*/
+           for(rp = re_table; rp->regex != NULL; rp++) {
+               if(match(rp->regex, line)) {
+                   if (rp->typ == DMP_SIZE) {
+                       size = ((the_num(line, rp->field)*rp->scale+1023.0)/1024.0);
+                       if(size < 0.0)
+                           size = 1.0;             /* found on NeXT -- sigh */
+                   }
+                   break;
+               }
+           }
+           /*@end@*/
+       }
+
+       while ((fgets(line, sizeof(line), dumpout)) != NULL) {
+           dbprintf("%s", line);
+       }
+
+       dbprintf(".....\n");
+       dbprintf(_("estimate time for %s level %d: %s\n"),
+                qdisk,
+                level,
+                walltime_str(timessub(curclock(), start_time)));
+       if(size == (off_t)-1) {
+           errmsg = vstrallocf(_("no size line match in %s output"),
+                               my_argv[0]);
+           dbprintf(_("%s for %s\n"), errmsg, qdisk);
+           dbprintf(".....\n");
+       } else if(size == (off_t)0 && argument->level == 0) {
+           dbprintf(_("possible %s problem -- is \"%s\" really empty?\n"),
+                     my_argv[0], argument->dle.disk);
+           dbprintf(".....\n");
+       }
+       dbprintf(_("estimate size for %s level %d: %lld KB\n"),
+                qdisk,
+                level,
+                (long long)size);
+
+       kill(-starpid, SIGTERM);
+
+       dbprintf(_("waiting for %s \"%s\" child\n"), my_argv[0], qdisk);
+       waitpid(starpid, &wait_status, 0);
+       if (WIFSIGNALED(wait_status)) {
+           errmsg = vstrallocf(_("%s terminated with signal %d: see %s"),
+                               cmd, WTERMSIG(wait_status), dbfn());
+       } else if (WIFEXITED(wait_status)) {
+           if (WEXITSTATUS(wait_status) != 0) {
+               errmsg = vstrallocf(_("%s exited with status %d: see %s"),
+                                   cmd, WEXITSTATUS(wait_status), dbfn());
+           } else {
+               /* Normal exit */
+           }
+       } else {
+           errmsg = vstrallocf(_("%s got bad exit: see %s"), cmd, dbfn());
+       }
+       dbprintf(_("after %s %s wait\n"), my_argv[0], qdisk);
+
+       amfree(my_argv);
+
+       aclose(nullfd);
+       afclose(dumpout);
+
+       fprintf(stdout, "%d %lld 1\n", level, (long long)size);
+    }
+    amfree(qdisk);
+    amfree(cmd);
+    return;
+
+common_error:
+    dbprintf("%s\n", errmsg);
+    qerrmsg = quote_string(errmsg);
+    amfree(qdisk);
+    dbprintf("%s", errmsg);
+    fprintf(stdout, "ERROR %s\n", qerrmsg);
+    amfree(errmsg);
+    amfree(qerrmsg);
+    amfree(cmd);
+}
+
+static void
+amstar_backup(
+    application_argument_t *argument)
+{
+    int dumpin;
+    char *cmd = NULL;
+    char *qdisk;
+    char  line[32768];
+    amregex_t *rp;
+    off_t dump_size = -1;
+    char *type;
+    char startchr;
+    char **my_argv;
+    int starpid;
+    int dataf = 1;
+    int mesgf = 3;
+    int indexf = 4;
+    int outf;
+    FILE *mesgstream;
+    FILE *indexstream = NULL;
+    FILE *outstream;
+    int level = GPOINTER_TO_INT(argument->level->data);
+
+    qdisk = quote_string(argument->dle.disk);
+
+    my_argv = amstar_build_argv(argument, level, CMD_BACKUP);
+
+    cmd = stralloc(star_path);
+
+    starpid = pipespawnv(cmd, STDIN_PIPE|STDERR_PIPE, 1,
+                        &dumpin, &dataf, &outf, my_argv);
+
+    /* close the write ends of the pipes */
+    aclose(dumpin);
+    aclose(dataf);
+    if (argument->dle.create_index) {
+       indexstream = fdopen(indexf, "w");
+       if (!indexstream) {
+           error(_("error indexstream(%d): %s\n"), indexf, strerror(errno));
+       }
+    }
+    mesgstream = fdopen(mesgf, "w");
+    if (!mesgstream) {
+       error(_("error mesgstream(%d): %s\n"), mesgf, strerror(errno));
+    }
+    outstream = fdopen(outf, "r");
+    if (!outstream) {
+       error(_("error outstream(%d): %s\n"), outf, strerror(errno));
+    }
+
+    while ((fgets(line, sizeof(line), outstream)) != NULL) {
+       regmatch_t regmatch[3];
+       regex_t regex;
+        int got_match = 0;
+
+       if (line[strlen(line)-1] == '\n') /* remove trailling \n */
+           line[strlen(line)-1] = '\0';
+
+       regcomp(&regex, "^a \\.\\/ directory$", REG_EXTENDED|REG_NEWLINE);
+       if (regexec(&regex, line, 1, regmatch, 0) == 0) {
+           got_match = 1;
+           if (argument->dle.create_index)
+               fprintf(indexstream, "%s\n", "/\n");
+       }
+       regfree(&regex);
+
+       regcomp(&regex, "^a (.*) directory$", REG_EXTENDED|REG_NEWLINE);
+       if (regexec(&regex, line, 3, regmatch, 0) == 0) {
+           got_match = 1;
+           if (argument->dle.create_index && regmatch[1].rm_so == 2) {
+               line[regmatch[1].rm_eo+1]='\0';
+               fprintf(indexstream, "/%s\n", &line[regmatch[1].rm_so]);
+           }
+       }
+       regfree(&regex);
+
+       regcomp(&regex, "^a (.*) (.*) bytes", REG_EXTENDED|REG_NEWLINE);
+       if (regexec(&regex, line, 3, regmatch, 0) == 0) {
+           got_match = 1;
+           if (argument->dle.create_index && regmatch[1].rm_so == 2) {
+               line[regmatch[1].rm_eo]='\0';
+               fprintf(indexstream, "/%s\n", &line[regmatch[1].rm_so]);
+           }
+       }
+       regfree(&regex);
+
+       regcomp(&regex, "^a (.*) special", REG_EXTENDED|REG_NEWLINE);
+       if (regexec(&regex, line, 3, regmatch, 0) == 0) {
+           got_match = 1;
+           if (argument->dle.create_index && regmatch[1].rm_so == 2) {
+               line[regmatch[1].rm_eo]='\0';
+               fprintf(indexstream, "/%s\n", &line[regmatch[1].rm_so]);
+           }
+       }
+       regfree(&regex);
+
+       regcomp(&regex, "^a (.*) symbolic", REG_EXTENDED|REG_NEWLINE);
+       if (regexec(&regex, line, 3, regmatch, 0) == 0) {
+           got_match = 1;
+           if (argument->dle.create_index && regmatch[1].rm_so == 2) {
+               line[regmatch[1].rm_eo]='\0';
+               fprintf(indexstream, "/%s\n", &line[regmatch[1].rm_so]);
+           }
+       }
+       regfree(&regex);
+
+       if (got_match == 0) { /* message */
+           for(rp = re_table; rp->regex != NULL; rp++) {
+               if(match(rp->regex, line)) {
+                   break;
+               }
+           }
+           if(rp->typ == DMP_SIZE) {
+               dump_size = (long)((the_num(line, rp->field)* rp->scale+1023.0)/1024.0);
+           }
+           switch(rp->typ) {
+           case DMP_NORMAL:
+               type = "normal";
+               startchr = '|';
+               break;
+           case DMP_STRANGE:
+               type = "strange";
+               startchr = '?';
+               break;
+           case DMP_SIZE:
+               type = "size";
+               startchr = '|';
+               break;
+           case DMP_ERROR:
+               type = "error";
+               startchr = '?';
+               break;
+           default:
+               type = "unknown";
+               startchr = '!';
+               break;
+           }
+           dbprintf("%3d: %7s(%c): %s\n", rp->srcline, type, startchr, line);
+           fprintf(mesgstream,"%c %s\n", startchr, line);
+        }
+    }
+
+    dbprintf(_("gnutar: %s: pid %ld\n"), cmd, (long)starpid);
+
+    dbprintf("sendbackup: size %lld\n", (long long)dump_size);
+    fprintf(mesgstream, "sendbackup: size %lld\n", (long long)dump_size);
+    dbprintf("sendbackup: end\n");
+    fprintf(mesgstream, "sendbackup: end\n");
+
+    fclose(mesgstream);
+    if (argument->dle.create_index)
+       fclose(indexstream);
+
+    amfree(qdisk);
+    amfree(cmd);
+}
+
+static void
+amstar_restore(
+    application_argument_t *argument)
+{
+    char  *cmd;
+    char **my_argv;
+    char **env;
+    int    i, j;
+    char  *e;
+
+    if (!star_path) {
+       error(_("STAR-PATH not defined"));
+    }
+
+    cmd = stralloc(star_path);
+    my_argv = alloc(SIZEOF(char *) * (11 + argument->argc));
+    i = 0;
+    my_argv[i++] = stralloc(star_path);
+    my_argv[i++] = stralloc("-x");
+    my_argv[i++] = stralloc("-v");
+    my_argv[i++] = stralloc("-xattr");
+    my_argv[i++] = stralloc("-acl");
+    my_argv[i++] = stralloc("errctl=WARN|SAMEFILE|SETTIME|DIFF|SETACL|SETXATTR|SETMODE|BADACL *");
+    my_argv[i++] = stralloc("-no-fifo");
+    my_argv[i++] = stralloc("-f");
+    my_argv[i++] = stralloc("-");
+
+    for (j=1; j< argument->argc; j++)
+       my_argv[i++] = stralloc(argument->argv[j]+2); /* remove ./ */
+    my_argv[i++] = NULL;
+
+    env = safe_env();
+    become_root();
+    execve(cmd, my_argv, env);
+    e = strerror(errno);
+    error(_("error [exec %s: %s]"), cmd, e);
+
+}
+
+static void
+amstar_validate(
+    application_argument_t *argument G_GNUC_UNUSED)
+{
+    char  *cmd;
+    char **my_argv;
+    char **env;
+    int    i;
+    char  *e;
+
+    if (!star_path) {
+       error(_("STAR-PATH not defined"));
+    }
+
+    cmd = stralloc(star_path);
+    my_argv = alloc(SIZEOF(char *) * 5);
+    i = 0;
+    my_argv[i++] = stralloc(star_path);
+    my_argv[i++] = stralloc("-t");
+    my_argv[i++] = stralloc("-f");
+    my_argv[i++] = stralloc("-");
+    my_argv[i++] = NULL;
+
+    env = safe_env();
+    execve(cmd, my_argv, env);
+    e = strerror(errno);
+    error(_("error [exec %s: %s]"), cmd, e);
+
+}
+
+char **amstar_build_argv(
+    application_argument_t *argument,
+    int   level,
+    int   command)
+{
+    int    i;
+    char  *dirname;
+    char  *fsname;
+    char  levelstr[NUM_STR_SIZE+7];
+    char **my_argv;
+    char *s;
+    char *tardumpfile;
+
+    dirname = amname_to_dirname(argument->dle.device);
+    fsname = vstralloc("fs-name=", dirname, NULL);
+    for (s = fsname; *s != '\0'; s++) {
+       if (iscntrl((int)*s))
+           *s = '-';
+    }
+    snprintf(levelstr, SIZEOF(levelstr), "-level=%d", level);
+
+    if (star_dle_tardumps) {
+       char *sdisk = sanitise_filename(argument->dle.disk);
+       tardumpfile = vstralloc(star_tardumps, sdisk, NULL);
+       amfree(sdisk);
+    } else {
+       tardumpfile = stralloc(star_tardumps);
+    }
+
+    my_argv = alloc(SIZEOF(char *) * 32);
+    i = 0;
+    
+    my_argv[i++] = star_path;
+
+    my_argv[i++] = stralloc("-c");
+    my_argv[i++] = stralloc("-f");
+    if (command == CMD_ESTIMATE) {
+       my_argv[i++] = stralloc("/dev/null");
+    } else {
+       my_argv[i++] = stralloc("-");
+    }
+    my_argv[i++] = stralloc("-C");
+#if defined(__CYGWIN__)
+    {
+       char tmppath[PATH_MAX];
+
+       cygwin_conv_to_full_posix_path(dirname, tmppath);
+       my_argv[i++] = stralloc(tmppath);
+    }
+#else
+    my_argv[i++] = stralloc(dirname);
+#endif
+    my_argv[i++] = stralloc(fsname);
+    if (star_onefilesystem)
+       my_argv[i++] = stralloc("-xdev");
+    my_argv[i++] = stralloc("-link-dirs");
+    my_argv[i++] = stralloc(levelstr);
+    my_argv[i++] = stralloc2("tardumps=", tardumpfile);
+    if (command == CMD_BACKUP)
+       my_argv[i++] = stralloc("-wtardumps");
+    my_argv[i++] = stralloc("-xattr");
+    my_argv[i++] = stralloc("-acl");
+    my_argv[i++] = stralloc("H=exustar");
+    my_argv[i++] = stralloc("errctl=WARN|SAMEFILE|DIFF|GROW|SHRINK|SPECIALFILE|GETXATTR|BADACL *");
+    if (star_sparse)
+       my_argv[i++] = stralloc("-sparse");
+    my_argv[i++] = stralloc("-dodesc");
+
+    if (command == CMD_BACKUP && argument->dle.create_index)
+       my_argv[i++] = stralloc("-v");
+
+    my_argv[i++] = stralloc(".");
+
+    my_argv[i] = NULL;
+
+    amfree(tardumpfile);
+    amfree(fsname);
+    amfree(dirname);
+
+    return(my_argv);
+}
diff --git a/application-src/amzfs-sendrecv.pl b/application-src/amzfs-sendrecv.pl
new file mode 100644 (file)
index 0000000..628f3af
--- /dev/null
@@ -0,0 +1,302 @@
+#!@PERL@
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+use lib '@amperldir@';
+use strict;
+use Getopt::Long;
+
+package Amanda::Application::Amzfs_sendrecv;
+use base qw(Amanda::Application Amanda::Application::Zfs);
+use File::Copy;
+use File::Path;
+use IPC::Open3;
+use Sys::Hostname;
+use Symbol;
+use Amanda::Constants;
+use Amanda::Config qw( :init :getconf  config_dir_relative );
+use Amanda::Debug qw( :logging );
+use Amanda::Paths;
+use Amanda::Util qw( :constants );
+
+sub new {
+    my $class = shift;
+    my ($config, $host, $disk, $device, $level, $index, $message, $collection, $record, $df_path, $zfs_path, $pfexec_path, $pfexec, $keep_snapshot) = @_;
+    my $self = $class->SUPER::new();
+
+    $self->{config}     = $config;
+    $self->{host}       = $host;
+    $self->{disk}       = $disk;
+    $self->{device}     = $device;
+    $self->{level}      = [ @{$level} ];
+    $self->{index}      = $index;
+    $self->{message}    = $message;
+    $self->{collection} = $collection;
+    $self->{record}     = $record;
+    $self->{df_path}       = $df_path;
+    $self->{zfs_path}      = $zfs_path;
+    $self->{pfexec_path}   = $pfexec_path;
+    $self->{pfexec}        = $pfexec;
+    $self->{keep_snapshot} = $keep_snapshot;
+    $self->{pfexec_cmd}    = undef;
+
+    if ($self->{keep_snapshot} =~ /^YES$/i) {
+        $self->{keep_snapshot} = "YES";
+       if (!defined $self->{record}) {
+           $self->{keep_snapshot} = "NO";
+       }
+    }
+
+    return $self;
+}
+
+sub check_for_backup_failure {
+   my $self = shift;
+   my $action = shift;
+
+   $self->zfs_destroy_snapshot($action);
+}
+
+sub command_support {
+   my $self = shift;
+
+   print "CONFIG YES\n";
+   print "HOST YES\n";
+   print "DISK YES\n";
+   print "MAX-LEVEL 9\n";
+   print "INDEX-LINE NO\n";
+   print "INDEX-XML NO\n";
+   print "MESSAGE-LINE YES\n";
+   print "MESSAGE-XML NO\n";
+   print "RECORD YES\n";
+   print "COLLECTION NO\n";
+}
+
+sub command_selfcheck {
+    my $self = shift;
+
+    $self->zfs_set_value("check");
+    if ($self->{error_status} == $Amanda::Script_App::GOOD) {
+       $self->zfs_create_snapshot("check");
+       $self->zfs_destroy_snapshot("check");
+       print "OK " . $self->{disk} . "\n";
+       print "OK " . $self->{device} . "\n";
+    }
+}
+
+sub command_estimate() {
+    my $self = shift;
+
+    my $level = 0;
+
+    $self->zfs_set_value("estimate");
+    $self->zfs_create_snapshot("estimate");
+
+    while (defined ($level = shift @{$self->{level}})) {
+      debug "Estimate of level $level";
+      my $size = $self->estimate_snapshot($level);
+      output_size($level, $size);
+    }
+
+    $self->zfs_destroy_snapshot("estimate");
+
+    exit 0;
+}
+
+sub output_size {
+   my($level) = shift;
+   my($size) = shift;
+   if($size == -1) {
+      print "$level -1 -1\n";
+      #exit 2;
+   }
+   else {
+      my($ksize) = int $size / (1024);
+      $ksize=32 if ($ksize<32);
+      print "$level $ksize 1\n";
+   }
+}
+
+sub command_backup {
+    my $self = shift;
+
+    my $mesgout_fd;
+    open($mesgout_fd, '>&=3') || die();
+    $self->{mesgout} = $mesgout_fd;
+
+    $self->zfs_set_value("backup");
+    $self->zfs_create_snapshot("backup");
+
+    my $size = -1;
+    my $level = $self->{level}[0];
+    my $cmd;
+    debug "Backup of level $level";
+    if ($level == 0) {
+       $cmd = "$self->{pfexec_cmd} $self->{zfs_path} send $self->{filesystem}\@$self->{snapshot} | $Amanda::Paths::amlibexecdir/teecount";
+    } else {
+      my $refsnapshotname = $self->zfs_find_snapshot_level($level-1);
+      debug "Referenced snapshot name: $refsnapshotname|";
+      if ($refsnapshotname ne "") {
+        $cmd = "$self->{pfexec_cmd} $self->{zfs_path} send -i $refsnapshotname $self->{filesystem}\@$self->{snapshot} | $Amanda::Paths::amlibexecdir/teecount";
+      } else {
+        $self->print_to_server_and_die("sendbackup", "cannot backup snapshot '$self->{filesystem}\@$self->{snapshot}': reference snapshot doesn't exists for level $level", $Amanda::Script_App::ERROR);
+      }
+    }
+
+    debug "running (backup): $cmd";
+    my($wtr, $err, $pid);
+    my($errmsg);
+    $err = Symbol::gensym;
+    $pid = open3($wtr, '>&STDOUT', $err, $cmd);
+    close $wtr;
+    $errmsg = <$err>;
+    waitpid $pid, 0;
+    close $err;
+    if ($? !=  0) {
+        if (defined $errmsg) {
+            $self->print_to_server_and_die("sendbackup", $errmsg, $Amanda::Script_App::ERROR);
+        } else {
+            $self->print_to_server_and_die("sendbackup", "cannot backup snapshot '$self->{filesystem}\@$self->{snapshot}': unknown reason", $Amanda::Script_App::ERROR);
+        }
+    }
+    $size = $errmsg;
+    debug "Dump done";
+
+    my($ksize) = int ($size/1024);
+    $ksize=32 if ($ksize<32);
+
+    print $mesgout_fd "sendbackup: size $ksize\n";
+    print $mesgout_fd "sendbackup: end\n";
+
+    # destroy all snapshot of this level and higher
+    $self->zfs_purge_snapshot($level, 9, "backup");
+
+    if ($self->{keep_snapshot} eq 'YES') {
+       $self->zfs_rename_snapshot($level, "backup");
+    } else {
+       $self->zfs_destroy_snapshot("backup");
+    }
+
+    exit 0;
+}
+
+sub estimate_snapshot
+{
+    my $self = shift;
+    my $level = shift;
+    my $action = shift;
+
+    debug "\$filesystem = $self->{filesystem}";
+    debug "\$snapshot = $self->{snapshot}";
+    debug "\$level = $level";
+
+    my $cmd;
+    if ($level == 0) {
+      $cmd = "$self->{pfexec_cmd} $self->{zfs_path} get -Hp -o value referenced $self->{filesystem}\@$self->{snapshot}";
+    } else {
+      my $refsnapshotname = $self->zfs_find_snapshot_level($level-1);
+      debug "Referenced snapshot name: $refsnapshotname|";
+      if ($refsnapshotname ne "") {
+        $cmd = "$self->{pfexec_cmd} $self->{zfs_path} send -i $refsnapshotname $self->{filesystem}\@$self->{snapshot} | /usr/bin/wc -c";
+      } else {
+        return "-1";
+      }
+    }
+    debug "running (estimate): $cmd";
+    my($wtr, $rdr, $err, $pid);
+    $err = Symbol::gensym;
+    $pid = open3($wtr, $rdr, $err, $cmd);
+    close $wtr;
+    my ($msg) = <$rdr>;
+    my ($errmsg) = <$err>;
+    waitpid $pid, 0;
+    close $rdr;
+    close $err;
+    if ($? !=  0) {
+        if (defined $msg && defined $errmsg) {
+            $self->print_to_server_and_die($action, "$msg, $errmsg", $Amanda::Script_App::ERROR);
+        } elsif (defined $msg) {
+            $self->print_to_server_and_die($action, $msg, $Amanda::Script_App::ERROR);
+        } elsif (defined $errmsg) {
+            $self->print_to_server_and_die($action, $errmsg, $Amanda::Script_App::ERROR);
+        } else {
+               $self->print_to_server_and_die($action, "cannot estimate snapshot '$self->{snapshot}\@$self->{snapshot}': unknown reason", $Amanda::Script_App::ERROR);
+       }
+    }
+
+    return $msg;
+}
+
+sub command_index_from_output {
+}
+
+sub command_index_from_image {
+}
+
+sub command_restore {
+}
+
+sub command_print_command {
+}
+
+package main;
+
+sub usage {
+    print <<EOF;
+Usage: amzfs-sendrecv <command> --config=<config> --host=<host> --disk=<disk> --device=<device> --level=<level> --index=<yes|no> --message=<text> --collection=<no> --record=<yes|no> --df-path=<path/to/df> --zfs-path=<path/to/zfs> --pfexec-path=<path/to/pfexec> --pfexec=<yes|no> --keep-snapshot=<yes|no>.
+EOF
+    exit(1);
+}
+
+my $opt_config;
+my $opt_host;
+my $opt_disk;
+my $opt_device;
+my @opt_level;
+my $opt_index;
+my $opt_message;
+my $opt_collection;
+my $opt_record;
+my $df_path  = 'df';
+my $zfs_path = 'zfs';
+my $pfexec_path = 'pfexec';
+my $pfexec = "NO";
+my $opt_keep_snapshot = "YES";
+
+Getopt::Long::Configure(qw{bundling});
+GetOptions(
+    'config=s'        => \$opt_config,
+    'host=s'          => \$opt_host,
+    'disk=s'          => \$opt_disk,
+    'device=s'        => \$opt_device,
+    'level=s'         => \@opt_level,
+    'index=s'         => \$opt_index,
+    'message=s'       => \$opt_message,
+    'collection=s'    => \$opt_collection,
+    'record'          => \$opt_record,
+    'df-path=s'       => \$df_path,
+    'zfs-path=s'      => \$zfs_path,
+    'pfexec-path=s'   => \$pfexec_path,
+    'pfexec=s'        => \$pfexec,
+    'keep-snapshot=s' => \$opt_keep_snapshot
+) or usage();
+
+my $application = Amanda::Application::Amzfs_sendrecv->new($opt_config, $opt_host, $opt_disk, $opt_device, \@opt_level, $opt_index, $opt_message, $opt_collection, $opt_record, $df_path, $zfs_path, $pfexec_path, $pfexec, $opt_keep_snapshot);
+
+$application->do($ARGV[0]);
+
diff --git a/application-src/amzfs-snapshot.pl b/application-src/amzfs-snapshot.pl
new file mode 100644 (file)
index 0000000..fefd25a
--- /dev/null
@@ -0,0 +1,191 @@
+#!@PERL@
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+# PROPERTY:
+#
+#    DF-PATH    (Default from PATH): Path to the 'df' binary
+#    ZFS-PATH   (Default from PATH): Path to the 'zfs' binary
+#    PFEXEC-PATH (Default from PATH): Path to the 'pfexec' binary
+#    PFEXEC     (Default NO): Set to "YES" if you want to use pfexec
+#
+use lib '@amperldir@';
+use strict;
+use Getopt::Long;
+
+package Amanda::Script::Amzfs_snapshot;
+use base qw(Amanda::Script Amanda::Application::Zfs);
+use Symbol;
+use IPC::Open3;
+use Amanda::Config qw( :getconf :init );
+use Amanda::Debug qw( :logging );
+use Amanda::Util qw( :constants );
+use Amanda::Paths;
+use Amanda::Constants;
+
+sub new {
+    my $class = shift;
+    my ($execute_where, $config, $host, $disk, $device, $level, $index, $message, $collection, $record, $df_path, $zfs_path, $pfexec_path, $pfexec) = @_;
+    my $self = $class->SUPER::new($execute_where);
+
+    $self->{execute_where} = $execute_where;
+    $self->{config}        = $config;
+    $self->{host}          = $host;
+    $self->{disk}          = $disk;
+    $self->{device}        = $device;
+    $self->{level}         = [ @{$level} ]; # Copy the array
+    $self->{index}         = $index;
+    $self->{message}       = $message;
+    $self->{collection}    = $collection;
+    $self->{record}        = $record;
+    $self->{df_path}       = $df_path;
+    $self->{zfs_path}      = $zfs_path;
+    $self->{pfexec_path}   = $pfexec_path;
+    $self->{pfexec}        = $pfexec;
+    $self->{pfexec_cmd}    = undef;
+
+    return $self;
+}
+
+sub zfs_snapshot_set_value() {
+   my $self   = shift;
+   my $action = shift;
+
+   $self->zfs_set_value($action);
+
+   if (!defined $self->{mountpoint}) {
+       $self->print_to_server($action, "$self->{disk} is not a directory", $Amanda::Script_App::ERROR);
+       
+   }
+}
+
+sub command_support {
+   my $self = shift;
+
+   print "CONFIG YES\n";
+   print "HOST YES\n";
+   print "DISK YES\n";
+   print "MESSAGE-LINE YES\n";
+   print "MESSAGE-XML NO\n";
+   print "EXECUTE-WHERE YES\n";
+}
+
+#define a execute_on_* function for every execute_on you want the script to do
+#something
+sub command_pre_dle_amcheck {
+    my $self = shift;
+
+    $self->zfs_snapshot_set_value("check");
+
+    if ($self->{error_status} == $Amanda::Script_App::GOOD) {
+       if (defined $self->{mountpoint}) {
+           $self->print_to_server("check", "mountpoint $self->{mountpoint}", $Amanda::Script_App::GOOD);
+           $self->print_to_server("check", "directory $self->{directory}", $Amanda::Script_App::GOOD);
+           $self->print_to_server("check", "dir $self->{dir}", $Amanda::Script_App::GOOD);
+       }
+       $self->print_to_server("check", "snapshot $self->{snapshot}", $Amanda::Script_App::GOOD);
+       $self->zfs_create_snapshot("check");
+       print "PROPERTY directory $self->{directory}\n";
+    }
+}
+
+sub command_post_dle_amcheck {
+    my $self = shift;
+
+    $self->zfs_snapshot_set_value("check");
+    $self->zfs_destroy_snapshot("check");
+}
+
+sub command_pre_dle_estimate {
+    my $self = shift;
+
+    $self->zfs_snapshot_set_value("estimate");
+    if ($self->{error_status} == $Amanda::Script_App::GOOD) {
+       $self->zfs_create_snapshot("estimate");
+       print "PROPERTY directory $self->{directory}\n";
+    }
+}
+
+sub command_post_dle_estimate {
+    my $self = shift;
+
+    $self->zfs_snapshot_set_value("estimate");
+    $self->zfs_destroy_snapshot("estimate");
+}
+
+sub command_pre_dle_backup {
+    my $self = shift;
+
+    $self->zfs_snapshot_set_value("backup");
+    if ($self->{error_status} == $Amanda::Script_App::GOOD) {
+       $self->zfs_create_snapshot("backup");
+       print "PROPERTY directory $self->{directory}\n";
+    }
+}
+
+sub command_post_dle_backup {
+    my $self = shift;
+
+    $self->zfs_snapshot_set_value("backup");
+    $self->zfs_destroy_snapshot("backup");
+}
+
+package main;
+
+sub usage {
+    print <<EOF;
+Usage: amzfs-snapshot <command> --execute-where=client --config=<config> --host=<host> --disk=<disk> --device=<device> --level=<level> --index=<yes|no> --message=<text> --collection=<no> --record=<yes|no> --df-path=<path/to/df> --zfs-path=<path/to/zfs> --pfexec-path=<path/to/pfexec> --pfexec=<yes|no>.
+EOF
+    exit(1);
+}
+
+my $opt_execute_where;
+my $opt_config;
+my $opt_host;
+my $opt_disk;
+my $opt_device;
+my @opt_level;
+my $opt_index;
+my $opt_message;
+my $opt_collection;
+my $opt_record;
+my $df_path  = 'df';
+my $zfs_path = 'zfs';
+my $pfexec_path = 'pfexec';
+my $pfexec = "NO";
+
+Getopt::Long::Configure(qw{bundling});
+GetOptions(
+    'execute-where=s'  => \$opt_execute_where,
+    'config=s'         => \$opt_config,
+    'host=s'           => \$opt_host,
+    'disk=s'           => \$opt_disk,
+    'device=s'         => \$opt_device,
+    'level=s'          => \@opt_level,
+    'index=s'          => \$opt_index,
+    'message=s'        => \$opt_message,
+    'collection=s'     => \$opt_collection,
+    'record=s'         => \$opt_record,
+    'df-path=s'        => \$df_path,
+    'zfs-path=s'       => \$zfs_path,
+    'pfexec-path=s'    => \$pfexec_path,
+    'pfexec=s'         => \$pfexec
+) or usage();
+
+my $script = Amanda::Script::Amzfs_snapshot->new($opt_execute_where, $opt_config, $opt_host, $opt_disk, $opt_device, \@opt_level, $opt_index, $opt_message, $opt_collection, $opt_record, $df_path, $zfs_path, $pfexec_path, $pfexec);
+$script->do($ARGV[0]);
diff --git a/application-src/script-email.pl b/application-src/script-email.pl
new file mode 100644 (file)
index 0000000..b16f6a6
--- /dev/null
@@ -0,0 +1,210 @@
+#!@PERL@
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+use lib '@amperldir@';
+use strict;
+use Getopt::Long;
+
+package Amanda::Script::Script_email;
+use base qw(Amanda::Script);
+use Amanda::Config qw( :getconf :init );
+use Amanda::Debug qw( :logging );
+use Amanda::Util qw( :constants );
+use Amanda::Paths;
+use Amanda::Constants;
+
+
+sub new {
+    my $class = shift;
+    my ($execute_where, $config, $host, $disk, $device, $level, $index, $message, $collection, $record, $mailto) = @_;
+    my $self = $class->SUPER::new($execute_where);
+
+    $self->{execute_where} = $execute_where;
+    $self->{config}        = $config;
+    $self->{host}          = $host;
+    $self->{disk}          = $disk;
+    $self->{device}        = $device;
+    $self->{level}         = [ @{$level} ]; # Copy the array
+    $self->{index}         = $index;
+    $self->{message}       = $message;
+    $self->{collection}    = $collection;
+    $self->{record}        = $record;
+    $self->{mailto}        = [ @{$mailto} ]; # Copy the array
+
+    return $self;
+}
+
+sub command_support {
+   my $self = shift;
+
+   print "CONFIG YES\n";
+   print "HOST YES\n";
+   print "DISK YES\n";
+   print "MESSAGE-LINE YES\n";
+   print "MESSAGE-XML NO\n";
+   print "EXECUTE-WHERE YES\n";
+}
+
+#define a execute_on_* function for every execute_on you want the script to do
+#something
+sub command_pre_dle_amcheck {
+   my $self = shift;
+   $self->sendmail("pre-dle-amcheck");
+}
+
+sub command_pre_host_amcheck {
+   my $self = shift;
+   $self->sendmail("pre-host-amcheck");
+}
+
+sub command_post_dle_amcheck {
+   my $self = shift;
+   $self->sendmail("post-dle-amcheck");
+}
+
+sub command_post_host_amcheck {
+   my $self = shift;
+   $self->sendmail("post-host-amcheck");
+}
+
+sub command_pre_dle_estimate {
+   my $self = shift;
+   $self->sendmail("pre-dle-estimate");
+}
+
+sub command_pre_host_estimate {
+   my $self = shift;
+   $self->sendmail("pre-host-estimate");
+}
+
+sub command_post_dle_estimate {
+   my $self = shift;
+   $self->sendmail("post-dle-estimate");
+}
+
+sub command_post_host_estimate {
+   my $self = shift;
+   $self->sendmail("post-host-estimate");
+}
+
+sub command_pre_dle_backup {
+   my $self = shift;
+   $self->sendmail("pre-dle-backup");
+}
+
+sub command_pre_host_backup {
+   my $self = shift;
+   $self->sendmail("pre-host-backup");
+}
+
+sub command_post_dle_backup {
+   my $self = shift;
+   $self->sendmail("post-dle-backup");
+}
+
+sub command_post_host_backup {
+   my $self = shift;
+   $self->sendmail("post-host-backup");
+}
+
+sub command_pre_recover {
+   my $self = shift;
+   $self->sendmail("pre-recover");
+}
+
+sub command_post_recover {
+   my $self = shift;
+   $self->sendmail("post-recover");
+}
+
+sub command_pre_level_recover {
+   my $self = shift;
+   $self->sendmail("pre-level-recover");
+}
+
+sub command_post_level_recover {
+   my $self = shift;
+   $self->sendmail("post-level-recover");
+}
+
+sub command_inter_level_recover {
+   my $self = shift;
+   $self->sendmail("inter-level-recover");
+}
+
+sub sendmail {
+   my $self = shift;
+   my($function) = @_;
+   my $dest;
+   if ($self->{mailto}) {
+      my $destcheck = join ',', @{$self->{mailto}};
+      $destcheck =~ /^([a-zA-Z,]*)$/;
+      $dest = $1;
+   } else {
+      $dest = "root";
+   }
+   my @args = ( "-s", "$self->{config} $function $self->{host} $self->{disk} $self->{device} " . join (" ", @{$self->{level}}), $dest );
+   my $args = join(" ", @args);
+   debug("cmd: $Amanda::Constants::MAILER $args\n");
+   my $mail;
+   open $mail, '|-', $Amanda::Constants::MAILER, @args;
+   print $mail "$self->{config} $function $self->{host} $self->{disk} $self->{device} ", join (" ", @{$self->{level}}), "\n";
+   close $mail;
+}
+
+package main;
+
+sub usage {
+    print <<EOF;
+Usage: script-email <command> --execute-where=<client|server> --config=<config> --host=<host> --disk=<disk> --device=<device> --level=<level> --index=<yes|no> --message=<text> --collection=<no> --record=<yes|no> --mailto=<email>.
+EOF
+    exit(1);
+}
+
+my $opt_execute_where;
+my $opt_config;
+my $opt_host;
+my $opt_disk;
+my $opt_device;
+my @opt_level;
+my $opt_index;
+my $opt_message;
+my $opt_collection;
+my $opt_record;
+my @opt_mailto;
+
+Getopt::Long::Configure(qw{bundling});
+GetOptions(
+    'execute-where=s' => \$opt_execute_where,
+    'config=s'        => \$opt_config,
+    'host=s'          => \$opt_host,
+    'disk=s'          => \$opt_disk,
+    'device=s'        => \$opt_device,
+    'level=s'         => \@opt_level,
+    'index=s'         => \$opt_index,
+    'message=s'       => \$opt_message,
+    'collection=s'    => \$opt_collection,
+    'record=s'        => \$opt_record,
+    'mailto=s'        => \@opt_mailto
+) or usage();
+
+my $script = Amanda::Script::Script_email->new($opt_execute_where, $opt_config, $opt_host, $opt_disk, $opt_device, \@opt_level, $opt_index, $opt_message, $opt_collection, $opt_record, \@opt_mailto);
+
+$script->do($ARGV[0]);
+
diff --git a/application-src/teecount.c b/application-src/teecount.c
new file mode 100644 (file)
index 0000000..fc0c4c0
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Amanda, The Advanced Maryland Automatic Network Disk Archiver
+ * Copyright (c) 1991-1998 University of Maryland at College Park
+ * All Rights Reserved.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of U.M. not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  U.M. makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as is"
+ * without express or implied warranty.
+ *
+ * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M.
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors: the Amanda Development Team.  Its members are listed in a
+ * file named AUTHORS, in the root directory of this distribution.
+ */
+/*
+ * $Id: teecount.c $
+ *
+ * read stdin and write to to stdout
+ * print on stderr the number of bytes copied
+ */
+
+#include "amanda.h"
+
+#define BUFFER 262144
+
+int main(int argc, char **argv);
+int
+main(
+    int argc G_GNUC_UNUSED,
+    char **argv G_GNUC_UNUSED)
+{
+    char  buffer[BUFFER];
+    off_t total = 0;
+    off_t size;
+    off_t sizew;
+
+    while ((size = safe_read(0, buffer, BUFFER)) > 0) {
+       if ((sizew = full_write(1, buffer, size)) < size) {
+           total += sizew;
+           fprintf(stderr, "%ju", (uintmax_t)total);
+           exit (-1);
+       }
+       total += size;
+    }
+    fprintf(stderr, "%ju", (uintmax_t)total);
+    if (size < 0) {
+       exit(-1);
+    }
+    return 0;
+}
diff --git a/autogen b/autogen
index 2e6bf5a19a32bdc5d0896669215420c6d8d9e74b..c1204ee97198bfb4763553254f8b85a573cb1f11 100755 (executable)
--- a/autogen
+++ b/autogen
@@ -35,6 +35,17 @@ echo "..creating file lists"
 echo "..aclocal"
 aclocal $includes || die "aclocal failed"
 
+echo "...aclocal patches"
+# See http://bugzilla.gnome.org/show_bug.cgi?id=418778
+#
+# The Glib developers are a bit over-eager in their version requirements, requiring
+# an unnecessarily high verison of pkg-config at configure time, when they really
+# only need it at autogen time.  This patch resets the version number in the file
+# just generated by aclocal to the version we've been requiring all along.
+sed --in-place -e  \
+     's/PKG_PROG_PKG_CONFIG(\[0\.16\])/PKG_PROG_PKG_CONFIG([0.7])/g' \
+     aclocal.m4
+
 echo "..autoconf"
 autoconf || die "autoconf failed"
 
index 8fa0c371c69832da8bac98c88f0493538e204422..d37ef2df72bf8a3fa6ec5f7a1bf5a1a6c4611b00 100644 (file)
@@ -7,7 +7,7 @@ include $(top_srcdir)/config/automake/precompile.am
 
 INCLUDES =     -I$(top_builddir)/common-src \
                -I$(top_srcdir)/common-src   \
-               -I$(top_srcdir)/tape-src     \
+               -I$(top_srcdir)/device-src   \
                -I$(top_srcdir)/gnulib
 
 AM_CFLAGS = $(AMANDA_WARNING_CFLAGS)
@@ -28,6 +28,7 @@ amlibexec_PROGRAMS =  $(CHG_SCSI)
 EXTRA_PROGRAMS =       $(CHIO_SCSI)
 
 CHECK_PERL = \
+               chg-glue \
                chg-chio \
                chg-iomega \
                chg-rth
@@ -48,7 +49,6 @@ SCRIPTS_SHELL = \
 
 SCRIPTS_INCLUDE = \
                chg-lib.sh
-
 EXTRA_DIST += chg-lib.sh.in
 
 amlibexec_SCRIPTS = $(SCRIPTS_PERL) $(SCRIPTS_SHELL)
@@ -62,8 +62,8 @@ amlibexec_DATA = $(SCRIPTS_INCLUDE)
 ###
 
 LDADD = ../common-src/libamanda.la \
-       ../tape-src/libamtape.la \
        ../common-src/libamanda.la \
+       ../device-src/libamdevice.la \
        ../gnulib/libgnu.la \
        $(READLINE_LIBS)
 
@@ -115,13 +115,12 @@ INSTALLPERMS_data = \
 
 lint:
        @ for p in $(amlibexec_PROGRAMS) $(EXTRA_PROGRAMS); do                  \
+               p=`basename $$p $(EXEEXT)`;                                     \
                f="$$p.c $(libamandad_la_SOURCES)";                             \
                (cd ../common-src; make listlibsrc);                            \
                f="$$f "`cat ../common-src/listlibsrc.output`;                  \
                (cd ../server-src; make listlibsrc);                            \
                f="$$f "`cat ../server-src/listlibsrc.output`;                  \
-               (cd ../tape-src; make listlibsrc);                              \
-               f="$$f "`cat ../tape-src/listlibsrc.output`;                    \
                echo $(LINT) $$f;                                               \
                $(LINT) $(LINTFLAGS) $(CPPFLAGS) $(DEFS) -I. -I$(top_builddir)/config   \
                    $(INCLUDES) $$f;                                            \
index fb70087469307b02e1ab7d10e345d7f16506b73b..24d8dcebdde1955857c877593dee032b49230b16 100644 (file)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  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.
@@ -17,7 +17,7 @@
 # Makefile for Amanda tape changer programs.
 
 # vim:ft=automake
-# Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
 # 
 # This library is free software; you can redistribute it and/or modify it
 # under the terms of the GNU Lesser General Public License version 2.1 as 
 # along with this library; if not, write to the Free Software Foundation,
 # Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
 # 
-# Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
-# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 
 # simple include file to pre-define variables which are then +='d by other
 # scripts in this directory.
 
 # vim:ft=automake
-# Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
 # 
 # This library is free software; you can redistribute it and/or modify it
 # under the terms of the GNU Lesser General Public License version 2.1 as 
@@ -54,8 +54,8 @@
 # along with this library; if not, write to the Free Software Foundation,
 # Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
 # 
-# Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
-# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 
 # SYNOPSIS:
 #
 # Files which support it are syntax-checked when the user invokes 'make check'.
 #
 # All *target* filenames must be listed in SCRIPTS_SHELL, SCRIPTS_PERL, and 
-# SCRIPTS_AWK to support 'make check', 'make dist', and 'make distclean'.
+# SCRIPTS_AWK to support 'make check', 'make dist', and 'make distclean'. No
+# files which are not substituted by config.status should be included in
+# SCRIPTS_PERL, SCRIPTS_SHELL, or SCRIPTS_AWK.  If non-generated files are listed
+# for installation, then Automake will figure out that they should be distributed;
+# otherwise, include them in EXTRA_DIST.
 #
 # USAGE:
 #
 #   SCRIPTS_PERL = fooscript barscript perl-lib.pl perlmod.pm
 #   SCRIPTS_SHELL = shell1 shell2 sh-lib.sh
 #   SCRIPTS_AWK = talk balk chalk awk-lib.awk
+#   sbin_SCRIPTS = not-subbed
+#   EXTRA_DIST = util-script.pl
 #
 # with the corresponding files in the repository:
 #
 #   fooscript.pl barscript.pl perl-lib.pl.in perlmod.pm.in
 #   shell1.sh shell2.sh sh-lib.sh.in
 #   talk.awk balk.awk chalk.awk awk-lib.awk.in
+#   not-subbed util-script.pl
 #
 # by default, all shell and perl scripts are syntax checked.  If this is
 # a problem (for example, perl scripts depending on Amanda extension 
 # INSTALLPERMS_exec = \
 #      dest=$(sbindir) chown=amanda chmod= \
 #              foo bar \
-#      chmod=u+s,o-rwx \
+#      chmod=07450 \
 #              bing
 #      dest=$(libexecdir) chmod= \
 #              $(libexec_PROGRAMS)
 #
 # This whole operation is not required when making builds for packaging,
 # and can be disabled with --disable-installperms, via the WANT_INSTALLPERMS
-# AM_CONDITIONAL.
+# AM_CONDITIONAL.  When disabled, the file 'installperms.sh' in the top-level
+# build directory is populated with a format suitable for shell interpretation,
+# with lines like this:
+#   installperm "amanda:disk" "04750" "/usr/local/sbin/bing"
+# the arguments being, respectively, owner:group, mode, and filename.  There will
+# be exactly one line for each file which has specific permissions.  The intention
+# is that this file be used by packaging scripts to set correct permissions at install
+# time.  Note that files which have no special permissions requirements do not appear 
+# in this file at all, due to limitations of Automake.
 
 # vim:ft=automake
 
@@ -165,21 +180,23 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
        $(top_srcdir)/config/automake/precompile.am \
        $(top_srcdir)/config/automake/scripts.am \
        $(top_srcdir)/config/automake/vars.am
+@WANT_INSTALLPERMS_FALSE@am__append_1 = $(installperms_sh)
 amlibexec_PROGRAMS = $(am__EXEEXT_2)
 EXTRA_PROGRAMS = $(am__EXEEXT_1)
-@WANT_SCSI_AIX_TRUE@am__append_1 = scsi-aix.c
-@WANT_SCSI_HPUX_NEW_TRUE@am__append_2 = scsi-hpux_new.c
-@WANT_SCSI_IRIX_TRUE@am__append_3 = scsi-irix.c
-@WANT_SCSI_LINUX_TRUE@am__append_4 = scsi-linux.c
-@WANT_SCSI_SOLARIS_TRUE@am__append_5 = scsi-solaris.c
-@WANT_SCSI_BSD_TRUE@am__append_6 = scsi-bsd.c
-@WANT_SCSI_CAM_TRUE@am__append_7 = scsi-cam.c
-@WANT_SCSI_HPUX_TRUE@am__append_8 = scsi-hpux.c
-@WANT_SCSI_CHIO_TRUE@am__append_9 = scsi-chio.c
+@WANT_SCSI_AIX_TRUE@am__append_2 = scsi-aix.c
+@WANT_SCSI_HPUX_NEW_TRUE@am__append_3 = scsi-hpux_new.c
+@WANT_SCSI_IRIX_TRUE@am__append_4 = scsi-irix.c
+@WANT_SCSI_LINUX_TRUE@am__append_5 = scsi-linux.c
+@WANT_SCSI_SOLARIS_TRUE@am__append_6 = scsi-solaris.c
+@WANT_SCSI_BSD_TRUE@am__append_7 = scsi-bsd.c
+@WANT_SCSI_CAM_TRUE@am__append_8 = scsi-cam.c
+@WANT_SCSI_HPUX_TRUE@am__append_9 = scsi-hpux.c
+@WANT_SCSI_CHIO_TRUE@am__append_10 = scsi-chio.c
 subdir = changer-src
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps =  \
        $(top_srcdir)/config/macro-archive/ac_define_dir.m4 \
+       $(top_srcdir)/config/macro-archive/ac_perl_module_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_perl_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_swig.m4 \
        $(top_srcdir)/config/macro-archive/ax_compare_version.m4 \
@@ -213,6 +230,7 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/amanda/libs.m4 \
        $(top_srcdir)/config/amanda/net.m4 \
        $(top_srcdir)/config/amanda/progs.m4 \
+       $(top_srcdir)/config/amanda/ps.m4 \
        $(top_srcdir)/config/amanda/readdir.m4 \
        $(top_srcdir)/config/amanda/readline.m4 \
        $(top_srcdir)/config/amanda/rsh-security.m4 \
@@ -235,7 +253,9 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/float_h.m4 \
        $(top_srcdir)/config/gnulib/fsusage.m4 \
        $(top_srcdir)/config/gnulib/getaddrinfo.m4 \
+       $(top_srcdir)/config/gnulib/getopt.m4 \
        $(top_srcdir)/config/gnulib/gettimeofday.m4 \
+       $(top_srcdir)/config/gnulib/gnulib-common.m4 \
        $(top_srcdir)/config/gnulib/gnulib-comp.m4 \
        $(top_srcdir)/config/gnulib/include_next.m4 \
        $(top_srcdir)/config/gnulib/inet_ntop.m4 \
@@ -263,7 +283,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/sys_stat_h.m4 \
        $(top_srcdir)/config/gnulib/sys_time_h.m4 \
        $(top_srcdir)/config/gnulib/tempname.m4 \
-       $(top_srcdir)/config/gnulib/ulonglong.m4 \
        $(top_srcdir)/config/gnulib/unistd_h.m4 \
        $(top_srcdir)/config/gnulib/vasnprintf.m4 \
        $(top_srcdir)/config/gnulib/visibility.m4 \
@@ -274,7 +293,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gettext-macros/lib-ld.m4 \
        $(top_srcdir)/config/gettext-macros/lib-link.m4 \
        $(top_srcdir)/config/gettext-macros/lib-prefix.m4 \
-       $(top_srcdir)/config/gettext-macros/longlong.m4 \
        $(top_srcdir)/config/gettext-macros/nls.m4 \
        $(top_srcdir)/config/gettext-macros/po.m4 \
        $(top_srcdir)/config/gettext-macros/progtest.m4 \
@@ -314,7 +332,7 @@ chg_scsi_OBJECTS = $(am_chg_scsi_OBJECTS)
 chg_scsi_LDADD = $(LDADD)
 am__DEPENDENCIES_1 =
 chg_scsi_DEPENDENCIES = ../common-src/libamanda.la \
-       ../tape-src/libamtape.la ../common-src/libamanda.la \
+       ../common-src/libamanda.la ../device-src/libamdevice.la \
        ../gnulib/libgnu.la $(am__DEPENDENCIES_1)
 am__chg_scsi_chio_SOURCES_DIST = libscsi.h chg-scsi-chio.c scsi-hpux.c \
        scsi-chio.c
@@ -326,11 +344,11 @@ am_chg_scsi_chio_OBJECTS = $(am__objects_11)
 chg_scsi_chio_OBJECTS = $(am_chg_scsi_chio_OBJECTS)
 chg_scsi_chio_LDADD = $(LDADD)
 chg_scsi_chio_DEPENDENCIES = ../common-src/libamanda.la \
-       ../tape-src/libamtape.la ../common-src/libamanda.la \
+       ../common-src/libamanda.la ../device-src/libamdevice.la \
        ../gnulib/libgnu.la $(am__DEPENDENCIES_1)
 amlibexecSCRIPT_INSTALL = $(INSTALL_SCRIPT)
 SCRIPTS = $(amlibexec_SCRIPTS)
-DEFAULT_INCLUDES = -I. -I$(top_builddir)/config@am__isrc@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/config
 depcomp = $(SHELL) $(top_srcdir)/config/depcomp
 am__depfiles_maybe = depfiles
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
@@ -357,6 +375,7 @@ ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
+AIX_BACKUP = @AIX_BACKUP@
 ALLOCA = @ALLOCA@
 ALLOCA_H = @ALLOCA_H@
 AMANDA_DBGDIR = @AMANDA_DBGDIR@
@@ -371,8 +390,10 @@ AMPLOT_CAT_GZIP = @AMPLOT_CAT_GZIP@
 AMPLOT_CAT_PACK = @AMPLOT_CAT_PACK@
 AMPLOT_COMPRESS = @AMPLOT_COMPRESS@
 AMTAR = @AMTAR@
+APPLICATION_DIR = @APPLICATION_DIR@
 AR = @AR@
 ARPA_INET_H = @ARPA_INET_H@
+ASSERTIONS = @ASSERTIONS@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -384,16 +405,28 @@ BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@
 BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@
 BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@
 BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@
+BSDTCP_SECURITY = @BSDTCP_SECURITY@
+BSDUDP_SECURITY = @BSDUDP_SECURITY@
+BSD_SECURITY = @BSD_SECURITY@
 CAT = @CAT@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
+CHECK_USERID = @CHECK_USERID@
 CHIO = @CHIO@
 CHS = @CHS@
+CLIENT_HOST_INSTANCE = @CLIENT_HOST_INSTANCE@
+CLIENT_HOST_KEY_FILE = @CLIENT_HOST_KEY_FILE@
+CLIENT_HOST_PRINCIPAL = @CLIENT_HOST_PRINCIPAL@
 CLIENT_LOGIN = @CLIENT_LOGIN@
 CLIENT_SCRIPTS_OPT = @CLIENT_SCRIPTS_OPT@
 COMPRESS = @COMPRESS@
+COMPRESS_BEST_OPT = @COMPRESS_BEST_OPT@
+COMPRESS_FAST_OPT = @COMPRESS_FAST_OPT@
+COMPRESS_PATH = @COMPRESS_PATH@
+COMPRESS_SUFFIX = @COMPRESS_SUFFIX@
+CONFIG_CLOBBER_MY_CONFIG = @CONFIG_CLOBBER_MY_CONFIG@
 CONFIG_DIR = @CONFIG_DIR@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
@@ -407,6 +440,7 @@ DD = @DD@
 DEFAULT_AMANDATES_FILE = @DEFAULT_AMANDATES_FILE@
 DEFAULT_CHANGER_DEVICE = @DEFAULT_CHANGER_DEVICE@
 DEFAULT_CONFIG = @DEFAULT_CONFIG@
+DEFAULT_MAILER = @DEFAULT_MAILER@
 DEFAULT_SERVER = @DEFAULT_SERVER@
 DEFAULT_TAPE_DEVICE = @DEFAULT_TAPE_DEVICE@
 DEFAULT_TAPE_SERVER = @DEFAULT_TAPE_SERVER@
@@ -414,7 +448,7 @@ DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DOC_BUILD_DATE = @DOC_BUILD_DATE@
 DUMP = @DUMP@
-DUMPER_DIR = @DUMPER_DIR@
+DUMP_RETURNS_1 = @DUMP_RETURNS_1@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -427,6 +461,7 @@ F77 = @F77@
 FFLAGS = @FFLAGS@
 FLOAT_H = @FLOAT_H@
 GETCONF = @GETCONF@
+GETOPT_H = @GETOPT_H@
 GETTEXT = @GETTEXT@
 GLIB_CFLAGS = @GLIB_CFLAGS@
 GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
@@ -437,9 +472,12 @@ GMSGFMT_015 = @GMSGFMT_015@
 GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
 GNULIB_CHOWN = @GNULIB_CHOWN@
 GNULIB_DUP2 = @GNULIB_DUP2@
+GNULIB_ENVIRON = @GNULIB_ENVIRON@
 GNULIB_FCHDIR = @GNULIB_FCHDIR@
 GNULIB_FFLUSH = @GNULIB_FFLUSH@
+GNULIB_FOPEN = @GNULIB_FOPEN@
 GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
+GNULIB_FREOPEN = @GNULIB_FREOPEN@
 GNULIB_FSEEK = @GNULIB_FSEEK@
 GNULIB_FSEEKO = @GNULIB_FSEEKO@
 GNULIB_FTELL = @GNULIB_FTELL@
@@ -449,6 +487,7 @@ GNULIB_GETCWD = @GNULIB_GETCWD@
 GNULIB_GETDELIM = @GNULIB_GETDELIM@
 GNULIB_GETLINE = @GNULIB_GETLINE@
 GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
+GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@
 GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
 GNULIB_LCHOWN = @GNULIB_LCHOWN@
 GNULIB_LSEEK = @GNULIB_LSEEK@
@@ -473,8 +512,10 @@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
 GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
 GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
 GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
+GNULIB_PUTENV = @GNULIB_PUTENV@
 GNULIB_READLINK = @GNULIB_READLINK@
 GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@
+GNULIB_SETENV = @GNULIB_SETENV@
 GNULIB_SLEEP = @GNULIB_SLEEP@
 GNULIB_SNPRINTF = @GNULIB_SNPRINTF@
 GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@
@@ -483,11 +524,15 @@ GNULIB_STPNCPY = @GNULIB_STPNCPY@
 GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
 GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
 GNULIB_STRDUP = @GNULIB_STRDUP@
+GNULIB_STRERROR = @GNULIB_STRERROR@
 GNULIB_STRNDUP = @GNULIB_STRNDUP@
 GNULIB_STRNLEN = @GNULIB_STRNLEN@
 GNULIB_STRPBRK = @GNULIB_STRPBRK@
 GNULIB_STRSEP = @GNULIB_STRSEP@
+GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@
+GNULIB_STRSTR = @GNULIB_STRSTR@
 GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
+GNULIB_UNSETENV = @GNULIB_UNSETENV@
 GNULIB_VASPRINTF = @GNULIB_VASPRINTF@
 GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@
 GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
@@ -501,6 +546,7 @@ GOBJECT_QUERY = @GOBJECT_QUERY@
 GREP = @GREP@
 GZIP = @GZIP@
 HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@
+HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@
 HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@
 HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@
 HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
@@ -509,9 +555,10 @@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
 HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@
 HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
 HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
-HAVE_DECL_STRNCASECMP = @HAVE_DECL_STRNCASECMP@
+HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@
 HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
 HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
+HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@
 HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
 HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
 HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
@@ -519,7 +566,9 @@ HAVE_DUP2 = @HAVE_DUP2@
 HAVE_FSEEKO = @HAVE_FSEEKO@
 HAVE_FTELLO = @HAVE_FTELLO@
 HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
+HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
 HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
+HAVE_GZIP = @HAVE_GZIP@
 HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
 HAVE_IO_H = @HAVE_IO_H@
 HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
@@ -528,8 +577,10 @@ HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@
 HAVE_MEMPCPY = @HAVE_MEMPCPY@
 HAVE_MKDTEMP = @HAVE_MKDTEMP@
 HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@
+HAVE_OS_H = @HAVE_OS_H@
 HAVE_READLINK = @HAVE_READLINK@
 HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@
+HAVE_SETENV = @HAVE_SETENV@
 HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
 HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
 HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
@@ -537,7 +588,6 @@ HAVE_SLEEP = @HAVE_SLEEP@
 HAVE_STDINT_H = @HAVE_STDINT_H@
 HAVE_STPCPY = @HAVE_STPCPY@
 HAVE_STPNCPY = @HAVE_STPNCPY@
-HAVE_STRCASECMP = @HAVE_STRCASECMP@
 HAVE_STRCASESTR = @HAVE_STRCASESTR@
 HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
 HAVE_STRNDUP = @HAVE_STRNDUP@
@@ -546,10 +596,12 @@ HAVE_STRSEP = @HAVE_STRSEP@
 HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@
 HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
 HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
+HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
 HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
 HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
 HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
 HAVE_UNISTD_H = @HAVE_UNISTD_H@
+HAVE_UNSETENV = @HAVE_UNSETENV@
 HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
 HAVE_VASPRINTF = @HAVE_VASPRINTF@
 HAVE_VISIBILITY = @HAVE_VISIBILITY@
@@ -565,6 +617,8 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 INTLLIBS = @INTLLIBS@
 INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+KRB4_SECURITY = @KRB4_SECURITY@
+KRB5_SECURITY = @KRB5_SECURITY@
 LDFLAGS = @LDFLAGS@
 LEX = @LEX@
 LEXLIB = @LEXLIB@
@@ -581,6 +635,8 @@ LIBTHREAD = @LIBTHREAD@
 LIBTOOL = @LIBTOOL@
 LIBTOOL_DEPS = @LIBTOOL_DEPS@
 LN_S = @LN_S@
+LOCKING = @LOCKING@
+LOW_TCPPORTRANGE = @LOW_TCPPORTRANGE@
 LTLIBICONV = @LTLIBICONV@
 LTLIBINTL = @LTLIBINTL@
 LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
@@ -589,7 +645,6 @@ LTLIBPTH = @LTLIBPTH@
 LTLIBTHREAD = @LTLIBTHREAD@
 MAILER = @MAILER@
 MAKEINFO = @MAKEINFO@
-MAXTAPEBLOCKSIZE = @MAXTAPEBLOCKSIZE@
 MCUTIL = @MCUTIL@
 MKDIR_P = @MKDIR_P@
 MSGFMT = @MSGFMT@
@@ -625,26 +680,37 @@ PERL_INC = @PERL_INC@
 PKG_CONFIG = @PKG_CONFIG@
 POSUB = @POSUB@
 PRINT = @PRINT@
+PS = @PS@
+PS_ARGUMENT = @PS_ARGUMENT@
 PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
 RANLIB = @RANLIB@
 READLINE_LIBS = @READLINE_LIBS@
 REPLACE_CHOWN = @REPLACE_CHOWN@
 REPLACE_FCHDIR = @REPLACE_FCHDIR@
 REPLACE_FFLUSH = @REPLACE_FFLUSH@
+REPLACE_FOPEN = @REPLACE_FOPEN@
 REPLACE_FPRINTF = @REPLACE_FPRINTF@
+REPLACE_FREOPEN = @REPLACE_FREOPEN@
 REPLACE_FSEEK = @REPLACE_FSEEK@
 REPLACE_FSEEKO = @REPLACE_FSEEKO@
 REPLACE_FTELL = @REPLACE_FTELL@
 REPLACE_FTELLO = @REPLACE_FTELLO@
 REPLACE_GETCWD = @REPLACE_GETCWD@
 REPLACE_GETLINE = @REPLACE_GETLINE@
+REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
 REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
 REPLACE_LCHOWN = @REPLACE_LCHOWN@
 REPLACE_LSEEK = @REPLACE_LSEEK@
+REPLACE_MEMMEM = @REPLACE_MEMMEM@
 REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
 REPLACE_PRINTF = @REPLACE_PRINTF@
+REPLACE_PUTENV = @REPLACE_PUTENV@
 REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
 REPLACE_SPRINTF = @REPLACE_SPRINTF@
+REPLACE_STRCASESTR = @REPLACE_STRCASESTR@
+REPLACE_STRERROR = @REPLACE_STRERROR@
+REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@
+REPLACE_STRSTR = @REPLACE_STRSTR@
 REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
 REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
 REPLACE_VPRINTF = @REPLACE_VPRINTF@
@@ -652,7 +718,11 @@ REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
 REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
 REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
 RESTORE = @RESTORE@
+RSH_SECURITY = @RSH_SECURITY@
 SAMBA_CLIENT = @SAMBA_CLIENT@
+SERVER_HOST_INSTANCE = @SERVER_HOST_INSTANCE@
+SERVER_HOST_KEY_FILE = @SERVER_HOST_KEY_FILE@
+SERVER_HOST_PRINCIPAL = @SERVER_HOST_PRINCIPAL@
 SERVICE_SUFFIX = @SERVICE_SUFFIX@
 SETUID_GROUP = @SETUID_GROUP@
 SET_MAKE = @SET_MAKE@
@@ -662,6 +732,7 @@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
 SNAPSHOT_STAMP = @SNAPSHOT_STAMP@
 SORT = @SORT@
 SSH = @SSH@
+SSH_SECURITY = @SSH_SECURITY@
 STDBOOL_H = @STDBOOL_H@
 STDINT_H = @STDINT_H@
 STRIP = @STRIP@
@@ -671,7 +742,14 @@ SWIG_LIB = @SWIG_LIB@
 SYS_SOCKET_H = @SYS_SOCKET_H@
 SYS_STAT_H = @SYS_STAT_H@
 SYS_TIME_H = @SYS_TIME_H@
+TCPPORTRANGE = @TCPPORTRANGE@
+TICKET_LIFETIME = @TICKET_LIFETIME@
+UDPPORTRANGE = @UDPPORTRANGE@
+UNCOMPRESS_OPT = @UNCOMPRESS_OPT@
+UNCOMPRESS_PATH = @UNCOMPRESS_PATH@
+USE_AMANDAHOSTS = @USE_AMANDAHOSTS@
 USE_NLS = @USE_NLS@
+USE_RUNDUMP = @USE_RUNDUMP@
 USE_VERSION_SUFFIXES = @USE_VERSION_SUFFIXES@
 VDUMP = @VDUMP@
 VERSION = @VERSION@
@@ -680,6 +758,7 @@ VERSION_MAJOR = @VERSION_MAJOR@
 VERSION_MINOR = @VERSION_MINOR@
 VERSION_PATCH = @VERSION_PATCH@
 VERSION_SUFFIX = @VERSION_SUFFIX@
+VOID_UNSETENV = @VOID_UNSETENV@
 VRESTORE = @VRESTORE@
 VXDUMP = @VXDUMP@
 VXRESTORE = @VXRESTORE@
@@ -708,6 +787,7 @@ am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+amdatadir = @amdatadir@
 amincludedir = @amincludedir@
 amlibdir = @amlibdir@
 amlibexecdir = @amlibexecdir@
@@ -726,6 +806,8 @@ dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 gl_LIBOBJS = @gl_LIBOBJS@
 gl_LTLIBOBJS = @gl_LTLIBOBJS@
+gltests_LIBOBJS = @gltests_LIBOBJS@
+gltests_LTLIBOBJS = @gltests_LTLIBOBJS@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
@@ -755,6 +837,7 @@ target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 SUFFIXES = 
@@ -766,7 +849,8 @@ MOSTLYCLEANFILES =
 CLEANFILES = config.log
 
 # and we'll need to clean up our generated files for distclean
-DISTCLEANFILES = $(SCRIPTS_SHELL) $(SCRIPTS_PERL) $(SCRIPTS_AWK)
+DISTCLEANFILES = $(SCRIPTS_SHELL) $(SCRIPTS_PERL) $(SCRIPTS_AWK) \
+       $(SCRIPTS_INCLUDE) $(am__append_1)
 MAINTAINERCLEANFILES = 
 
 # syntax-check shell scripts on 'make check'
@@ -775,9 +859,28 @@ CHECK_SHELL = $(SCRIPTS_SHELL)
 # sed expression to strip leading directories from a filename; this converts e.g.,
 # src/foo/bar.so to bar.so.
 strip_leading_dirs = s|^.*/||
+@WANT_INSTALLPERMS_FALSE@do_file = pa="$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
+@WANT_INSTALLPERMS_FALSE@    echo "installperm \"$$chown\" \"$$chmod\" \"$$pa\"" >> "$(installperms_sh)"
+
+
+# define a snippet of the scripts below to either perform a chown/chmod operation,
+# or record that operation in the logfile.  On entry to the snippet, $$dest is the
+# destination directory, $$cmd is the srcdir-relative pathname of the target file,
+# $$chown is the ownership, and $$chmod is the permission pattern.
+@WANT_INSTALLPERMS_TRUE@do_file = pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
+@WANT_INSTALLPERMS_TRUE@    if test -n "$$chown"; then \
+@WANT_INSTALLPERMS_TRUE@       echo chown "$$chown" "$$pa"; \
+@WANT_INSTALLPERMS_TRUE@       chown "$$chown" "$$pa" || exit 1; \
+@WANT_INSTALLPERMS_TRUE@    fi; \
+@WANT_INSTALLPERMS_TRUE@    if test -n "$$chmod"; then \
+@WANT_INSTALLPERMS_TRUE@       echo chmod "$$chmod" "$$pa"; \
+@WANT_INSTALLPERMS_TRUE@       chmod "$$chmod" "$$pa" || exit 1; \
+@WANT_INSTALLPERMS_TRUE@    fi 
+
+@WANT_INSTALLPERMS_FALSE@installperms_sh = "$(top_builddir)/installperms.sh"
 INCLUDES = -I$(top_builddir)/common-src \
                -I$(top_srcdir)/common-src   \
-               -I$(top_srcdir)/tape-src     \
+               -I$(top_srcdir)/device-src   \
                -I$(top_srcdir)/gnulib
 
 AM_CFLAGS = $(AMANDA_WARNING_CFLAGS)
@@ -787,6 +890,7 @@ LINTFLAGS = $(AMLINTFLAGS)
 @WANT_CHG_SCSI_CHIO_TRUE@CHIO_SCSI = chg-scsi-chio
 @WANT_CHG_SCSI_TRUE@CHG_SCSI = chg-scsi
 CHECK_PERL = \
+               chg-glue \
                chg-chio \
                chg-iomega \
                chg-rth
@@ -817,17 +921,17 @@ amlibexec_DATA = $(SCRIPTS_INCLUDE)
 # routines, and second to pick up any references in the other libraries.
 ###
 LDADD = ../common-src/libamanda.la \
-       ../tape-src/libamtape.la \
        ../common-src/libamanda.la \
+       ../device-src/libamdevice.la \
        ../gnulib/libgnu.la \
        $(READLINE_LIBS)
 
 chg_scsi_CSRC = chg-scsi.c scsi-changer-driver.c sense.c \
-       $(am__append_1) $(am__append_2) $(am__append_3) \
-       $(am__append_4) $(am__append_5) $(am__append_6) \
-       $(am__append_7)
+       $(am__append_2) $(am__append_3) $(am__append_4) \
+       $(am__append_5) $(am__append_6) $(am__append_7) \
+       $(am__append_8)
 chg_scsi_SOURCES = libscsi.h scsi-defs.h $(chg_scsi_CSRC)
-chg_scsi_chio_CSRC = chg-scsi-chio.c $(am__append_8) $(am__append_9)
+chg_scsi_chio_CSRC = chg-scsi-chio.c $(am__append_9) $(am__append_10)
 chg_scsi_chio_SOURCES = libscsi.h $(chg_scsi_chio_CSRC)
 INSTALLPERMS_exec = \
        chown=amanda \
@@ -882,8 +986,8 @@ install-amlibexecPROGRAMS: $(amlibexec_PROGRAMS)
             || test -f $$p1 \
          ; then \
            f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
-          echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(amlibexecPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(amlibexecdir)/$$f'"; \
-          $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(amlibexecPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(amlibexecdir)/$$f" || exit 1; \
+          echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(amlibexecPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(amlibexecdir)/$$f'"; \
+          $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(amlibexecPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(amlibexecdir)/$$f" || exit 1; \
          else :; fi; \
        done
 
@@ -996,8 +1100,8 @@ ID: $(HEADERS) $(SOURCES) $(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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
        mkid -fID $$unique
 tags: TAGS
 
@@ -1009,8 +1113,8 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
        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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { 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) \
@@ -1020,13 +1124,12 @@ ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
                $(TAGS_FILES) $(LISP)
        tags=; \
-       here=`pwd`; \
        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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
        test -z "$(CTAGS_ARGS)$$tags$$unique" \
          || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
             $$tags $$unique
@@ -1107,8 +1210,6 @@ maintainer-clean-generic:
        @echo "it deletes files that may require special tools to rebuild."
        -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
        -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-@WANT_INSTALLPERMS_FALSE@install-exec-hook:
-@WANT_INSTALLPERMS_FALSE@install-data-hook:
 clean: clean-am
 
 clean-am: clean-amlibexecPROGRAMS clean-generic clean-libtool \
@@ -1151,7 +1252,7 @@ install-pdf: install-pdf-am
 
 install-ps: install-ps-am
 
-installcheck-am:
+installcheck-am: installcheck-local
 
 maintainer-clean: maintainer-clean-am
        -rm -rf ./$(DEPDIR)
@@ -1187,10 +1288,10 @@ uninstall-am: uninstall-amlibexecDATA uninstall-amlibexecPROGRAMS \
        install-html install-html-am install-info install-info-am \
        install-man install-pdf install-pdf-am install-ps \
        install-ps-am install-strip installcheck installcheck-am \
-       installdirs maintainer-clean maintainer-clean-generic \
-       mostlyclean mostlyclean-compile mostlyclean-generic \
-       mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
-       uninstall-am uninstall-amlibexecDATA \
+       installcheck-local installdirs maintainer-clean \
+       maintainer-clean-generic mostlyclean mostlyclean-compile \
+       mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+       tags uninstall uninstall-am uninstall-amlibexecDATA \
        uninstall-amlibexecPROGRAMS uninstall-amlibexecSCRIPTS
 
 
@@ -1198,6 +1299,11 @@ uninstall-am: uninstall-amlibexecDATA uninstall-amlibexecPROGRAMS \
 %: %.pl $(top_builddir)/config.status
        $(top_builddir)/config.status --file=$@:$<
        chmod a+x $@
+       @if test -f $(top_builddir)/perl/.libs/libCmdline.so -o -f $(top_builddir)/perl/libCmdline.so; then \
+               grep -v '^use lib' $@ > $@.nouselib; \
+               $(PERL) $(CHECK_PERL_FLAGS) -I$(top_builddir)/perl -I$(top_builddir)/perl/.libs -I$(top_srcdir)/perl -c -w -T $@.nouselib || exit 1; \
+               rm $@.nouselib; \
+       fi
 
 %.pl: %.pl.in $(top_builddir)/config.status
        $(top_builddir)/config.status --file=$@:$<
@@ -1223,13 +1329,27 @@ uninstall-am: uninstall-amlibexecDATA uninstall-amlibexecPROGRAMS \
 
 # syntax-check perl scripts on 'make check'
 check-perl: $(CHECK_PERL)
+       @CHECK_PERL="$(CHECK_PERL)"; \
+       if test -f $(top_builddir)/perl/.libs/libCmdline.so -o -f $(top_builddir)/perl/libCmdline.so; then \
+               if test -n "$(PERL)"; then \
+                       for perlobj in $$CHECK_PERL; do \
+                               grep -v '^use lib' $$perlobj > $$perlobj.nouselib; \
+                               $(PERL) $(CHECK_PERL_FLAGS) -I$(top_builddir)/perl -I$(top_builddir)/perl/.libs -I$(top_srcdir)/perl -c -w -T $$perlobj.nouselib || exit 1; \
+                               rm $$perlobj.nouselib; \
+                       done; \
+               fi \
+       fi
+check-local: check-perl
+
+# syntax-check perl scripts on 'make installcheck'
+installcheck-perl: $(CHECK_PERL)
        @CHECK_PERL="$(CHECK_PERL)"; \
        if test -n "$(PERL)"; then \
                for perlobj in $$CHECK_PERL; do \
                        $(PERL) $(CHECK_PERL_FLAGS) -c -w -T $$perlobj || exit 1; \
                done; \
        fi
-check-local: check-perl
+installcheck-local: installcheck-perl
 check-shell: $(CHECK_SHELL)
        @CHECK_SHELL="$(CHECK_SHELL)"; \
        if test -n "$$CHECK_SHELL"; then \
@@ -1267,52 +1387,40 @@ dist-scripts:
        true
 dist-hook: dist-scripts
 
-@WANT_INSTALLPERMS_TRUE@installperms-exec:
-@WANT_INSTALLPERMS_TRUE@       @installperms="$(INSTALLPERMS_exec)"; \
-@WANT_INSTALLPERMS_TRUE@       test -n "$$installperms" && echo "Setting installation permissions on executables"; \
-@WANT_INSTALLPERMS_TRUE@       dest=; chown=; chmod=; \
-@WANT_INSTALLPERMS_TRUE@       for cmd in $$installperms; do \
-@WANT_INSTALLPERMS_TRUE@           case "$$cmd" in \
-@WANT_INSTALLPERMS_TRUE@               chown=amanda) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
-@WANT_INSTALLPERMS_TRUE@               dest=*|chown=*|chmod=*) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; eval $$cmd;; \
-@WANT_INSTALLPERMS_TRUE@               *)  pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chown"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chown "$$chown" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chown "$$chown" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chmod"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chmod "$$chmod" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chmod "$$chmod" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@           esac; \
-@WANT_INSTALLPERMS_TRUE@       done
-
-@WANT_INSTALLPERMS_TRUE@installperms-data:
-@WANT_INSTALLPERMS_TRUE@       @installperms="$(INSTALLPERMS_data)"; \
-@WANT_INSTALLPERMS_TRUE@       test -n "$$installperms" && echo "Setting installation permissions on data"; \
-@WANT_INSTALLPERMS_TRUE@       dest=; chown=; chmod=; \
-@WANT_INSTALLPERMS_TRUE@       for cmd in $$installperms; do \
-@WANT_INSTALLPERMS_TRUE@           case "$$cmd" in \
-@WANT_INSTALLPERMS_TRUE@               chown=amanda) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
-@WANT_INSTALLPERMS_TRUE@               dest=*|chown=*|chmod=*) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; eval $$cmd;; \
-@WANT_INSTALLPERMS_TRUE@               *)  pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chown"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chown "$$chown" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chown "$$chown" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chmod"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chmod "$$chmod" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chmod "$$chmod" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@           esac; \
-@WANT_INSTALLPERMS_TRUE@       done
-
-@WANT_INSTALLPERMS_TRUE@install-exec-hook: installperms-exec
-@WANT_INSTALLPERMS_TRUE@install-data-hook: installperms-data
+installperms-exec:
+       @installperms="$(INSTALLPERMS_exec)"; \
+       test -n "$$installperms" && echo "Setting installation permissions on executables"; \
+       dest=; chown=; chmod=; \
+       for cmd in $$installperms; do \
+           case "$$cmd" in \
+               chown=amanda) \
+                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
+               dest=*|chown=*|chmod=*) \
+                       echo "  ($$cmd)"; eval $$cmd;; \
+               *) $(do_file) ;; \
+           esac; \
+       done
+
+installperms-data:
+       @installperms="$(INSTALLPERMS_data)"; \
+       dest=; chown=; chmod=; \
+       for cmd in $$installperms; do \
+           case "$$cmd" in \
+               chown=amanda) \
+                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
+               dest=*|chown=*|chmod=*) \
+                       echo "  ($$cmd)"; eval $$cmd;; \
+               *)  $(do_file) ;; \
+           esac; \
+       done
+
+install-exec-hook: installperms-exec
+install-data-hook: installperms-data
+
+# define a rule to initialize the installperms manifest file
+@WANT_INSTALLPERMS_TRUE@installperms-init:
+@WANT_INSTALLPERMS_FALSE@installperms-init:
+@WANT_INSTALLPERMS_FALSE@      rm -f "$(installperms_sh)"
 
 # A rule to make precompiler output from C files.  This is not used during
 # ordinary builds, but but can very useful in debugging problems on strange
@@ -1326,13 +1434,12 @@ dist-hook: dist-scripts
 
 lint:
        @ for p in $(amlibexec_PROGRAMS) $(EXTRA_PROGRAMS); do                  \
+               p=`basename $$p $(EXEEXT)`;                                     \
                f="$$p.c $(libamandad_la_SOURCES)";                             \
                (cd ../common-src; make listlibsrc);                            \
                f="$$f "`cat ../common-src/listlibsrc.output`;                  \
                (cd ../server-src; make listlibsrc);                            \
                f="$$f "`cat ../server-src/listlibsrc.output`;                  \
-               (cd ../tape-src; make listlibsrc);                              \
-               f="$$f "`cat ../tape-src/listlibsrc.output`;                    \
                echo $(LINT) $$f;                                               \
                $(LINT) $(LINTFLAGS) $(CPPFLAGS) $(DEFS) -I. -I$(top_builddir)/config   \
                    $(INCLUDES) $$f;                                            \
index 8679711de05d9f8f05eea7ac1a8c5c4af5832086..683b12aba73ad2f7467309ec52759ae023eeb690 100644 (file)
@@ -377,7 +377,7 @@ echo curloaded $curloaded                   >> $ourstate
 # return slot info
 
 if [ $slotempty -eq 1 ]; then
-       answer=`_ '<none> %s: %s slot is empty' "$pname" "$newslot"`
+       answer=`_ '<none> %s: %s slot is empty: %s' "$pname" "$newslot" "$amdevcheck_message"`
        echo `_ 'Exit ->'` $answer >> $logfile
        echo $answer
        exit 1
diff --git a/changer-src/chg-glue.pl b/changer-src/chg-glue.pl
new file mode 100644 (file)
index 0000000..fe7e6a6
--- /dev/null
@@ -0,0 +1,275 @@
+#! @PERL@
+# Copyright (c) 2008 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+use lib '@amperldir@';
+use strict;
+
+# This script interfaces the C changer library to Amanda::Perl.  It reads
+# commands from its stdin that are identical to those that would be passed as
+# arguments to a changer script, and replies with an encoded exit status and
+# the response of the script.
+#
+# Specifically, the conversation is (P = Parent, C = Child)
+# P>C: -$cmd $args
+# C>P: EXITSTATUS $exitstatus
+# C>P: $slot $message
+# P>C: -$cmd $args
+# C>P: EXITSTATUS $exitstatus
+# C>P: $slot $message
+# P>C: (EOF)
+#
+# The script exits as soon as it reads an EOF on its standard input.
+
+use Amanda::Changer;
+use Amanda::MainLoop;
+use Amanda::Config qw( :init );
+use Amanda::Util qw( :constants );
+
+my $chg;
+my $res;
+
+sub release_and_then {
+    my ($release_opts, $andthen) = @_;
+    if ($res) {
+       # release the current reservation, then call andthen
+       $res->release(@$release_opts,
+           finished_cb => sub {
+               my ($error) = @_;
+               $res = undef;
+
+               if ($error) {
+                   print "EXITSTATUS 1\n";
+                   print "<error> $error\n";
+                   Amanda::MainLoop::call_later(\&getcmd);
+               } else {
+                   $andthen->();
+               }
+           }
+       );
+    } else {
+       # no reservation to release
+       $andthen->();
+    }
+}
+
+sub do_slot {
+    my ($slot) = @_;
+
+    # handle the special cases we support
+    if ($slot eq "next" or $slot eq "advance") {
+       if (!$res) {
+            $slot = "next";
+       } else {
+           $slot = $res->{'next_slot'};
+       }
+    } elsif ($slot eq "first") {
+       do_reset();
+       return;
+    } elsif ($slot eq "prev" or $slot eq "last") {
+       print "EXITSTATUS 1\n";
+       print "<error> slot specifier '$slot' is not valid\n";
+       Amanda::MainLoop::call_later(\&getcmd);
+       return;
+    }
+
+    my $load_slot = sub {
+       $chg->load(slot => $slot, set_current => 1,
+           res_cb => sub {
+               (my $error, $res) = @_;
+               if ($error) {
+                   print "EXITSTATUS 1\n";
+                   print "<error> $error\n";
+               } else {
+                   print "EXITSTATUS 0\n";
+                   print $res->{'this_slot'}, " ", $res->{'device_name'}, "\n";
+               }
+               Amanda::MainLoop::call_later(\&getcmd);
+           }
+       );
+    };
+
+    release_and_then([], $load_slot);
+}
+
+sub do_info {
+    $chg->info(info => [ 'num_slots' ],
+        info_cb => sub {
+            my $error = shift;
+            my %results = @_;
+
+            if ($error) {
+                print "EXITSTATUS 1\n";
+                print "<error> $error\n";
+            } else {
+                my $nslots = $results{'num_slots'};
+                $nslots = 0 unless defined $nslots;
+                print "EXITSTATUS 0\n";
+                print "current $nslots 0 1\n";
+            }
+            Amanda::MainLoop::call_later(\&getcmd);
+        }
+    );
+}
+
+sub do_reset {
+    my $do_reset = sub {
+       $chg->reset(
+           finished_cb => sub {
+               my ($error) = @_;
+               if ($error) {
+                   print "EXITSTATUS 1\n";
+                   print "<error> $error\n";
+                   Amanda::MainLoop::call_later(\&getcmd);
+               } else {
+                   do_slot("current");
+               }
+           }
+       );
+    };
+    release_and_then([], $do_reset);
+}
+
+sub do_eject {
+    release_and_then([ eject => 1 ],
+       sub {
+           print "EXITSTATUS 0\n";
+           print "<none> OK: no volume loaded\n";
+           Amanda::MainLoop::call_later(\&getcmd);
+       }
+    );
+}
+
+sub do_search {
+    my ($label) = @_;
+    my $load_label = sub {
+       $chg->load(label => $label, set_current => 1,
+           res_cb => sub {
+               (my $error, $res) = @_;
+               if ($error) {
+                   print "EXITSTATUS 1\n";
+                   print "<error> $error\n";
+               } else {
+                   print "EXITSTATUS 0\n";
+                   print $res->{'this_slot'}, " ", $res->{'device_name'}, "\n";
+               }
+               Amanda::MainLoop::call_later(\&getcmd);
+           }
+       );
+    };
+
+    release_and_then([], $load_label);
+}
+
+sub do_label {
+    my ($label) = @_;
+    if ($res) {
+        $res->set_label(label => $label,
+            finished_cb => sub {
+                my ($err) = @_;
+                if ($err) {
+                   print "EXITSTATUS 1\n";
+                   print "<error> $err\n";
+               } else {
+                   print "EXITSTATUS 0\n";
+                   print $res->{'this_slot'}, " ", $res->{'device_name'}, "\n";
+               }
+                Amanda::MainLoop::call_later(\&getcmd);
+            }
+        );
+    } else {
+       print "EXITSTATUS 1\n";
+       print "<error> No volume loaded\n";
+       Amanda::MainLoop::call_later(\&getcmd);
+    }
+}
+
+sub getcmd {
+    my ($slot, $label);
+    my $command = <STDIN>;
+    if (!defined($command)) {
+       finish();
+       return;
+    }
+
+    if (($slot) = ($command =~ /^-slot (.*)$/)) {
+       do_slot($slot);
+    } elsif ($command =~ /^-info$/) {
+       do_info();
+    } elsif ($command =~ /^-reset$/) {
+       do_reset();
+    } elsif ($command =~ /^-eject$/) {
+       do_eject();
+    } elsif (($label) = ($command =~ /^-search (.*)/)) {
+       do_search($label);
+    } elsif (($label) = ($command =~ /^-label (.*)/)) {
+       do_label($label);
+    } else {
+       print "EXITSTATUS 2\n";
+       print "<error> unknown command '$command'\n";
+       finish();
+    }
+}
+
+sub finish {
+    if ($res) {
+       $res->release(
+           finished_cb => sub {
+               $res = undef;
+               Amanda::MainLoop::quit();
+           }
+       );
+    } else {
+       Amanda::MainLoop::quit();
+    }
+}
+
+Amanda::Util::setup_application("chg-glue", "server", $CONTEXT_SCRIPTUTIL);
+
+die("$0 is for internal use only") if (@ARGV < 1);
+my $config_name = $ARGV[0];
+
+# override die to print a changer-compatible message
+$SIG{__DIE__} = sub {
+    my ($msg) = @_;
+    die $msg unless defined $^S;
+    print "EXITSTATUS 2\n";
+    print "<error> $msg\n";
+    exit 1;
+};
+
+config_init($CONFIG_INIT_EXPLICIT_NAME, $config_name);
+my ($cfgerr_level, @cfgerr_errors) = config_errors();
+if ($cfgerr_level >= $CFGERR_WARNINGS) {
+    config_print_errors();
+    if ($cfgerr_level >= $CFGERR_ERRORS) {
+       die("errors processing config file");
+    }
+}
+Amanda::Util::finish_setup($RUNNING_AS_DUMPUSER);
+
+# select unbuffered communication
+$| = 1;
+
+$chg = Amanda::Changer->new();
+
+Amanda::MainLoop::call_later(\&getcmd);
+Amanda::MainLoop::run();
+if ($res) {
+    $res->release();
+}
index 9e3809b9c9a75736d5e19410fa7bde0717916e00..35c7a6853ba42b23015fe3b6169550d4685befbd 100755 (executable)
@@ -153,7 +153,7 @@ load_drives() {
        count=`expr $count + 1`
        if [ $count -gt 24 ] 
        then
-           echo `_ '%s %s never came online' "$slot" "$tapedev"`
+           echo `_ '%s %s never came online: %s' "$slot" "$tapedev" "$amdevcheck_message"`
            exit 1
        fi
        sleep 5
index 791154c70243ce2cb8ea3b4d8ff9d09a73c18c77..9c6632030fe2429d3a708406efc8774d63b7eeac 100644 (file)
@@ -84,16 +84,22 @@ try_find_mt() {
 # This function strips the tape: from the front of device names.
 # Capture its output with ``.
 tape_device_filename() {
-    # Easy (?) to express this in Perl.
-    perl -e '$ARGV[0] =~ /^(?:([^:]+):)?(.*)$/;
-             print $2 if ($1 || "tape") eq "tape"' "$1"
+    if echo "$1"|grep '^tape:' >/dev/null; then
+       echo "$1" | sed 's/^tape://'
+    else
+       if echo "$1"|grep '^/' >/dev/null; then
+           echo "$1"
+       fi
+    fi
 }
 
-# Runs amdevcheck to find out if a particular device is usable. Finds the
-# config name based on pwd, so run it from the config directory. The sole
-# argument should be the device name to check. Note that amdevcheck can FP
-# on device status, since some devices can't differentiate between device
-# problems and an unlabeled volume.
+# Invoke amdevcheck to determine whether the device is ready for use.
+#
+# @return 0 if a tape is loaded or error
+# @return 1 if a tape is tape offline or busy
+#
+# @side-effect: $amdevcheck_message is the contents of all MESSAGE lines from
+#               amdevcheck, suitable for use in higher-level error messages
 amdevcheck_status() {
     amdevcheck_message=
     local amdevcheck_config_dir=`pwd`
@@ -109,7 +115,7 @@ amdevcheck_status() {
     # Return 1 if it's possible that the device is offline or busy; if the device cannot
     # distinguish this state from an error condition, then our caller will just have to
     # time out
-    if echo "$amdevcheck_output" | $EGREP "VOLUME_MISSING" > /dev/null; then
+    if echo "$amdevcheck_output" | $EGREP "VOLUME_MISSING|DEVICE_BUSY" > /dev/null; then
        return 1
     else
        return 0
@@ -121,7 +127,7 @@ amdevcheck_status() {
 # be extended at some later time.
 
 try_eject_device() {
-    if echo "$1" | grep -e '^tape:' > /dev/null; then
+    if echo "$1" | grep '^tape:' > /dev/null; then
         try_eject_device_tape="`echo \"$1\" | cut -b6-`"
     elif echo "$1" | grep -v : > /dev/null; then
         try_eject_device_tape="$1"
@@ -131,7 +137,7 @@ try_eject_device() {
 
     if test -n "$try_eject_device_tape"; then
         if try_find_mt; then
-            $MT $MTF "$try_eject_device_tape" eject
+            $MT $MTF "$try_eject_device_tape" offline
         fi
     else
         # Technically we failed to eject the device, but we presume that's
index d480de976568da4a95e6d59f802ed1bb68837542..1490a4d7a345aa2e54c2e503e5ddcbe45ad4f29d 100644 (file)
@@ -26,14 +26,13 @@ amlibexecdir=@amlibexecdir@
 #
 #
 
-
 if [ -d "@AMANDA_DBGDIR@" ]; then
        logfile=@AMANDA_DBGDIR@/changer.debug
 else
        logfile=/dev/null
 fi
 
-myname=$0
+myname=`basename $0`
 
 EGREP='@EGREP@'
 
@@ -42,9 +41,9 @@ if ! error=`try_find_mt`; then
     exit 2
 fi
 
-MAILER=@MAILER@
 ONLINEREGEX="ONLINE|READY|sense[_ ]key[(]0x0[)]|sense key error = 0|^er=0$|, mt_erreg: 0x0|^Current Driver State: at rest$"
 REPORTTO=`amgetconf mailto`
+MAILER=`amgetconf mailer`
 tape=`amgetconf tapedev`
 
 if [ -z "$tape" ]; then
@@ -58,6 +57,8 @@ firstslot=1
 lastslot=99
 resend_mail=900                # 15 minutes
 timeout_mail=604800    # 7 days
+abort_file="chg-manual.abort"
+abort_dir=`pwd`
 
 changerfile=`amgetconf changerfile`
 
@@ -83,11 +84,23 @@ slot=`cat $slotfile`
 
 request_tty() {
        if > /dev/tty; then
-               echo -n `_ 'Insert tape into slot %s and press return' "$1"` > /dev/tty
+               echo "$amdevcheck_message" >> /dev/tty
+               # message parsed by ZMC:
+               echo `_ 'Insert tape into slot %s and press return' "$1"` > /dev/tty
+               echo `_ ' or type "NONE" to abort'` > /dev/tty
                read ANSWER < /dev/tty
+               if [ X"$ANSWER" = X"NONE" ]; then
+                       echo `_ 'Aborting request'` > /dev/tty
+                       answer=`_ '<none> Aborting request'`
+                       echo `_ 'Exit ->'` $answer >> $logfile
+                       echo $answer
+                       exit 2
+               fi
        else
-               echo -n `_ 'no /dev/tty to ask to change tape'`
-               exit 1
+               answer=`_ '<none> no /dev/tty to ask to change tape'`
+               echo `_ 'Exit ->'` $answer >> $logfile
+               echo $answer
+               exit 2
        fi
 }
 
@@ -103,13 +116,23 @@ request_email() {
        # the E-mail once an hour in case it gets lost.
        timeout=0
        gtimeout=$timeout_mail
+       rm -f $abort_filename
        while true;do
            if [ $gtimeout -le 0 ]; then
-               echo -n `_ 'timeout waiting for tape online'`
-               exit 1;
+               answer=`_ '%s %s: timeout waiting for tape online' "$load" "$myname"`
+               echo `_ 'Exit ->'` $answer >> $logfile
+               echo $answer
+               exit 2;
+           fi
+           if [ -f $abort_filename ]; then
+               rm -f $abort_filename
+               answer=`_ '<none> Aborting request'`
+               echo `_ 'Exit ->'` $answer >> $logfile
+               echo $answer
+               exit 2
            fi
            if [ $timeout -le 0 ]; then
-               msg=`_ 'insert Amanda tape into slot %s (%s)' "$1" "$tape"`
+               msg=`_ '%s\nInsert Amanda tape into slot %s (%s)\nor \`touch %s\` to abort.' "$amdevcheck_message" "$1" "$tape" "$abort_filename"` 
                subject=`_ '%s AMANDA TAPE MOUNT REQUEST FOR SLOT %s' "$ORG" "$1"`
                echo "$msg" | $MAILER -s "$subject" $REPORTTO
                timeout=$resend_mail
@@ -126,8 +149,7 @@ request_email() {
 
 request_tty_email() {
        if > /dev/tty; then
-               echo -n `_ 'Insert tape into slot %s and press return' "$1"` > /dev/tty
-               read ANSWER < /dev/tty
+               request_tty "$1"
        else
                request_email "$1"
        fi
@@ -158,7 +180,7 @@ if test -z "$MAILER"; then
        answer=`_ "<none> %s: Can't send email because MAILER is not defined" "$myname"`
        echo `_ 'Exit ->'` $answer >> $logfile
        echo $answer
-       exit 1
+       exit 2
     fi
 fi
 
@@ -172,7 +194,7 @@ eject() {
            answer="$slot $tape"
            code=0
        else
-           answer=`_ '<none> %s: Drive was not loaded' "$myname"`
+           answer=`_ '<none> %s: %s' "$myname" "$amdevcheck_message"`
            code=1
        fi
        echo `_ 'Exit ->'` $answer >> $logfile
@@ -180,6 +202,8 @@ eject() {
        exit $code
 }
 
+abort_filename="$abort_dir/$abort_file"
+
 #
 
 reset() {
@@ -187,7 +211,7 @@ reset() {
         if amdevcheck_status $tape; then
                answer="$slot $tape"
        else
-               answer="0 $tape"
+               answer="0 $tape $amdevcheck_message"
        fi
        echo `_ 'Exit ->'` $answer >> $logfile
        echo $answer
@@ -206,9 +230,6 @@ loadslot() {
        case $whichslot in
        current)
                load=$slot
-               [ $load -eq 0 ] && load=$firstslot
-               [ $load -gt $lastslot ] && load=$firstslot
-               [ $load -lt $firstslot ] && load=$lastslot
                ;;
        next|advance)
                load=`expr $slot + 1`
@@ -249,6 +270,13 @@ loadslot() {
                exit 0
        fi
 
+       if [ X"$whichslot" = X"current" ]; then
+               answer="<none> Current slot not loaded"
+               echo `_ 'Exit ->'` $answer>> $logfile
+               echo $answer
+               exit 1
+       fi
+
        expr $accesscount + 1 > $accessfile
 
        if [ $tape_status -eq 0 ]; then
@@ -313,7 +341,7 @@ while [ $# -ge 1 ];do
                eject
                ;;
        *)
-               fmt`gettext "<none> %s: Unknown option %s\n"`
+               fmt=`gettext "<none> %s: Unknown option %s\n"`
                printf $fmt $myname $1
                exit 2
                ;;
index ddb5301698c7515e500e5453c3993493b5a49913..19ffb4122b2e3116988446e12eb25176c3b50cdd 100644 (file)
@@ -125,6 +125,42 @@ if [ -z "$ourstate" ]; then
        exit 2
 fi
 
+if [ -f "$ourstate" -a ! -r "$ourstate" ]; then
+       answer=`_ "<none> %s: Can't read the statefile %s" "$pname" "$ourstate"`
+       echo `_ 'Exit ->'` $answer >> $logfile
+       echo $answer
+       exit 2
+fi
+
+if [ -f "$ourstate" -a ! -w "$ourstate" ]; then
+       answer=`_ "<none> %s: Can't write the statefile %s" "$pname" "$ourstate"`
+       echo `_ 'Exit ->'` $answer >> $logfile
+       echo $answer
+       exit 2
+fi
+
+dirstate=`dirname $ourstate`
+if [ ! -e "$dirstate" ]; then
+       answer=`_ "<none> %s: Directory %s doesn't exist" "$pname" "$dirstate"`
+       echo `_ 'Exit ->'` $answer >> $logfile
+       echo $answer
+       exit 2
+fi
+
+if [ ! -d "$dirstate" ]; then
+       answer=`_ '<none> %s: %s must be a directory' "$pname" "$dirstate"`
+       echo `_ 'Exit ->'` $answer >> $logfile
+       echo $answer
+       exit 2
+fi
+
+if [ ! -w "$dirstate" ]; then
+       answer=`_ "<none> %s: Can't write to %s directory" "$pname" "$dirstate"`
+       echo `_ 'Exit ->'` $answer >> $logfile
+       echo $answer
+       exit 2
+fi
+
 # needeject and multieject are incompatible
 if [ $needeject -eq 1 ] && [ $multieject -eq 1 ] ; then
        answer=`_ '<none> %s: needeject and multieject cannot be both enabled in %s' "$pname" "$ourconf"`
@@ -405,7 +441,7 @@ echo curloaded $curloaded                    >> $ourstate
 # return slot info
 
 if [ $slotempty -eq 1 ]; then
-       answer=`_ '%s %s: slot is empty' "$newslot" "$pname"`
+       answer=`_ '%s %s: slot is empty: %s' "$newslot" "$pname" "$amdevcheck_message"`
        echo `_ 'Exit ->'` $answer >> $logfile
        echo $answer
        exit 1
index b5b76bdfee84c59a650aab7f4a94f5e1ccd12d07..3489c67ef4730d35357495e3bbc3768e227d48da 100644 (file)
@@ -634,11 +634,14 @@ clean_tape(
     char *     usagetime)
 {
   int counter;
+  char *mailer;
 
   if (cleancart == -1 ){
     return;
   }
 
+  mailer = getconf_str(CNF_MAILER);
+
   /* Now we should increment the counter */
   if (cnt_file != NULL){
     counter = get_current_slot(cnt_file);
@@ -648,29 +651,29 @@ clean_tape(
       char *mail_cmd;
       FILE *mailf;
       int mail_pipe_opened = 1;
-#ifdef MAILER
-      if(getconf_seen(CNF_MAILTO) && strlen(getconf_str(CNF_MAILTO)) > 0 && 
-         validate_mailto(getconf_str(CNF_MAILTO))) {
-        mail_cmd = vstralloc(MAILER,
-                           " -s", " \"", _("AMANDA PROBLEM: PLEASE FIX"), "\"",
-                           " ", getconf_str(CNF_MAILTO),
-                           NULL);
-        if((mailf = popen(mail_cmd, "w")) == NULL){
-               g_printf(_("Mail failed\n"));
-               error(_("could not open pipe to \"%s\": %s"),
-               mail_cmd, strerror(errno));
-               /*NOTREACHED*/
-       }
+      if (mailer && *mailer != '\0') {
+        if (getconf_seen(CNF_MAILTO) && strlen(getconf_str(CNF_MAILTO)) > 0 && 
+           validate_mailto(getconf_str(CNF_MAILTO))) {
+          mail_cmd = vstralloc(mailer,
+                             " -s", " \"", _("AMANDA PROBLEM: PLEASE FIX"), "\"",
+                             " ", getconf_str(CNF_MAILTO),
+                             NULL);
+          if ((mailf = popen(mail_cmd, "w")) == NULL) {
+                 g_printf(_("Mail failed\n"));
+                 error(_("could not open pipe to \"%s\": %s"),
+                       mail_cmd, strerror(errno));
+                 /*NOTREACHED*/
+         }
+        } else {
+          mail_pipe_opened = 0;
+          mailf = stderr;
+           g_fprintf(mailf, _("\nNo mail recipient specified, output redirected to stderr"));
+        }
       } else {
-        mail_pipe_opened = 0;
-        mailf = stderr;
-         g_fprintf(mailf, _("\nNo mail recipient specified, output redirected to stderr"));
+        mail_pipe_opened = 0;
+        mailf = stderr;
+        g_fprintf(mailf, _("\nNo mailer specified; output redirected to stderr"));
       }
-#else
-      mail_pipe_opened = 0;
-      mailf = stderr;
-      g_fprintf(mailf, _("\nNo mailer specified; output redirected to stderr"));
-#endif
       g_fprintf(mailf, _("\nThe usage count of your cleaning tape in slot %d"),
              cleancart);
       g_fprintf(mailf,_("\nis more than %d. (cleanmax)"),maxclean);
@@ -749,7 +752,14 @@ main(
   parse_args(argc,argv,&com);
 
   changer = alloc(SIZEOF(changer_t));
-  config_init(CONFIG_INIT_USE_CWD | CONFIG_INIT_FATAL, NULL);
+  config_init(CONFIG_INIT_USE_CWD, NULL);
+
+  if (config_errors(NULL) >= CFGERR_WARNINGS) {
+    config_print_errors();
+    if (config_errors(NULL) >= CFGERR_ERRORS) {
+      g_critical(_("errors processing config file"));
+    }
+  }
 
   changer_dev = getconf_str(CNF_CHANGERDEV);
   changer_file = getconf_str(CNF_CHANGERFILE);
index 46d4801621da68e7c6a0a6cc0b9f25680f3741a5..221f47669ccc7b18f2a0bdc60f2a2aca6954530e 100644 (file)
@@ -69,7 +69,6 @@ static char rcsid[] = "$Id: chg-scsi.c,v 1.52 2006/07/25 18:18:46 martinea Exp $
 #include "conffile.h"
 #include "libscsi.h"
 #include "scsi-defs.h"
-#include "tapeio.h"
 
 char *tapestatfile = NULL;
 FILE *debug_file = NULL;
@@ -370,6 +369,11 @@ read_config(
           chg->emubarcode = 1;
           break;
         case DEBUGLEVEL:
+          if (chg->debuglevel != NULL) {
+              g_fprintf(stderr,_("Error: debuglevel is specified twice "
+                                 "(%s then %s).\n"), chg->debuglevel, value);
+              amfree(chg->debuglevel);
+          }
           chg->debuglevel = stralloc(value);
           break;
         case EJECT:
@@ -382,9 +386,19 @@ read_config(
           chg->sleep = (unsigned)atoi(value);
           break;
         case LABELFILE:
+          if (chg->labelfile != NULL) {
+              g_fprintf(stderr,_("Error: labelfile is specified twice "
+                                 "(%s then %s).\n"), chg->labelfile, value);
+              amfree(chg->labelfile);
+          }
           chg->labelfile = stralloc(value);
           break;
         case CHANGERDEV:
+          if (chg->device != NULL) {
+              g_fprintf(stderr,_("Error: changerdev is specified twice "
+                                 "(%s then %s).\n"), chg->device, value);
+              amfree(chg->device);
+          }
           chg->device = stralloc(value);
           break;
         case SCSITAPEDEV:
@@ -1082,6 +1096,7 @@ clean_tape(
     char *usagetime)
 {
   int counter;
+  char *mailer;
 
   if (cleancart == -1 ){
     return;
@@ -1089,6 +1104,7 @@ clean_tape(
 
   /* Now we should increment the counter */
   if (cnt_file != NULL){
+    mailer = getconf_str(CNF_MAILER);
     counter = get_current_slot(cnt_file);
     counter++;
     if (counter>=maxclean){
@@ -1096,29 +1112,29 @@ clean_tape(
       char *mail_cmd = NULL;
       FILE *mailf = NULL;
       int mail_pipe_opened = 1;
-#ifdef MAILER
-      if(getconf_seen(CNF_MAILTO) && strlen(getconf_str(CNF_MAILTO)) > 0 &&
-         validate_mailto(getconf_str(CNF_MAILTO))) {
-        mail_cmd = vstralloc(MAILER,
-                           " -s", " \"", _("AMANDA PROBLEM: PLEASE FIX"), "\"",
-                           " ", getconf_str(CNF_MAILTO),
-                           NULL);
-        if((mailf = popen(mail_cmd, "w")) == NULL){
-               g_printf(_("Mail failed\n"));
-               error(_("could not open pipe to \"%s\": %s"),
+      if (mailer && *mailer != '\0') {
+        if (getconf_seen(CNF_MAILTO) && strlen(getconf_str(CNF_MAILTO)) > 0 &&
+           validate_mailto(getconf_str(CNF_MAILTO))) {
+          mail_cmd = vstralloc(mailer,
+                             " -s", " \"", _("AMANDA PROBLEM: PLEASE FIX"), "\"",
+                             " ", getconf_str(CNF_MAILTO),
+                             NULL);
+          if ((mailf = popen(mail_cmd, "w")) == NULL) {
+                 g_printf(_("Mail failed\n"));
+                 error(_("could not open pipe to \"%s\": %s"),
                        mail_cmd, strerror(errno));
-               /*NOTREACHED*/
-       }
+                 /*NOTREACHED*/
+          }
+        } else {
+         mail_pipe_opened = 0;
+          mailf = stderr;
+          g_fprintf(mailf, _("\nNo mail recipient specified, output redirected to stderr"));
+        }
       } else {
-       mail_pipe_opened = 0;
+        mail_pipe_opened = 0;
         mailf = stderr;
-        g_fprintf(mailf, _("\nNo mail recipient specified, output redirected to stderr"));
-      }   
-#else
-      mail_pipe_opened = 0;
-      mailf = stderr;
-      g_fprintf(mailf, _("\nNo mailer specified; output redirected to stderr"));
-#endif
+        g_fprintf(mailf, _("\nNo mailer specified; output redirected to stderr"));
+      }
       g_fprintf(mailf,_("\nThe usage count of your cleaning tape in slot %d"),
               cleancart);
       g_fprintf(mailf,_("\nis more than %d. (cleanmax)"),maxclean);
@@ -1254,7 +1270,14 @@ main(
       break;
     }
 
-  config_init(CONFIG_INIT_USE_CWD | CONFIG_INIT_FATAL, NULL);
+  config_init(CONFIG_INIT_USE_CWD, NULL);
+
+  if (config_errors(NULL) >= CFGERR_WARNINGS) {
+    config_print_errors();
+    if (config_errors(NULL) >= CFGERR_ERRORS) {
+      g_critical(_("errors processing config file"));
+    }
+  }
 
   chg_scsi_conf = getconf_str(CNF_CHANGERFILE);
   tape_device = getconf_str(CNF_TAPEDEV);
index 464c07519537bdc4053e16dde5b0b92f11e124f9..dd26273daf9cdc607b6a35c0d3f2eb55d62c4f4f 100644 (file)
 # initial_poll_delay=NN            #### initial delay after load before polling for
 #                          #### readiness
 #
+# slotinfofile=FILENAME            #### record slot information to this file, in
+#                          #### the line-based format "SLOT LABEL\n"
+#
 ####
 
 ####
@@ -376,7 +379,7 @@ Exit() {
        if [ $call_type = Return ]; then
                return $code
        fi
-       amgetconf dbclose.$argv0:$DBGFILE > /dev/null 2>&1
+       amgetconf dbclose.$myname:$DBGFILE > /dev/null 2>&1
        exit $code
 }
 
@@ -411,7 +414,7 @@ Run() {
 
 IsNumeric() {
        test -z "$1" && return 1
-       x="`expr "$1" : '\([-0-9][0-9]*\)' 2>/dev/null`"
+       x="`expr -- "$1" : "\([-0-9][0-9]*\)" 2>/dev/null`"
        return `expr X"$1" != X"$x"`
 }
 
@@ -431,6 +434,11 @@ get_mtx_status() {
        if [ $status -eq 0 ]; then
                mtx_status_valid=1
        fi
+
+       # shim this in here so that we get a completely new slotinfofile
+       # every time we run mtx status
+       regenerate_slotinfo_from_mtx
+
        return $status
 }
 
@@ -443,6 +451,12 @@ get_mtx_status() {
 get_loaded_info() {
        test -n "$DEBUG" && set -x
        get_mtx_status
+       if [ $mtx_status_valid -eq 0 ]; then
+               Exit 2 \
+                    `_ '<none>'` \
+                    `head -1 $mtx_status`
+               return $?
+       fi
 
        set x `sed -n '
 /^Data Transfer Element:Empty/                          {
@@ -560,6 +574,12 @@ get_slot_list() {
                return
        fi
        get_mtx_status
+       if [ $mtx_status_valid -eq 0 ]; then
+               Exit 2 \
+                    `_ '<none>'` \
+                    `head -1 $mtx_status`
+               return $?
+       fi
        slot_list=`sed -n '
 /^Data Transfer Element:Full (Storage Element \([0-9][0-9]*\) Loaded)/ {
     s/.*(Storage Element \([0-9][0-9]*\) Loaded).*/\1/p
@@ -628,7 +648,195 @@ get_slot_list() {
        slot_list="$amanda_slot_list"
 }
 
-DBGFILE=`amgetconf dbopen.$argv0 2>/dev/null`
+###
+# Read the labelfile and scan for a particular entry.
+###
+
+read_labelfile() {
+       labelfile_entry_found=0
+       labelfile_label=
+       labelfile_barcode=
+
+       lbl_search=$1
+       bc_search=$2
+
+       line=0
+       while read lbl bc junk; do
+               line=`expr $line + 1`
+               if [ -z "$lbl" -o -z "$bc" -o -n "$junk" ]; then
+                       Log       `_ 'ERROR    -> Line %s malformed: %s %s %s' "$line" "$lbl" "$bc" "$junk"`
+                       LogAppend `_ '         -> Remove %s and run "%s %s update"' "$labelfile" "$sbindir/amtape" "$config"`
+                       Exit 2 \
+                            `_ '<none>'` \
+                            `_ 'Line %s malformed in %s: %s %s %s' "$line" "$labelfile" "$lbl" "$bc" "$junk"`
+                       return $?               # in case we are internal
+               fi
+               if [ $lbl = "$lbl_search" -o $bc = "$bc_search" ]; then
+                       if [ $labelfile_entry_found -ne 0 ]; then
+                               Log       `_ 'ERROR    -> Duplicate entries: %s line %s' "$labelfile" "$line"`
+                               LogAppend `_ '         -> Remove %s and run "%s %s update"' "$labelfile" "$sbindir/amtape" "$config"`
+                               Exit 2 \
+                                    `_ '<none>'` \
+                                    `_ 'Duplicate entries: %s line %s' "$labelfile" "$line"`
+                               return $?       # in case we are internal
+                       fi
+                       labelfile_entry_found=1
+                       labelfile_label=$lbl
+                       labelfile_barcode=$bc
+               fi
+       done
+}
+
+lookup_label_by_barcode() {
+    [ -z "$1" ] && return
+    read_labelfile "" "$1" < $labelfile
+    echo "$labelfile_label"
+}
+
+lookup_barcode_by_label() {
+    [ -z "$1" ] && return
+    read_labelfile "$1" "" < $labelfile
+    echo "$labelfile_barcode"
+}
+
+remove_from_labelfile() {
+       labelfile=$1
+       lbl_search=$2
+       bc_search=$3
+
+       internal_remove_from_labelfile "$lbl_search" "$bc_search" < $labelfile >$labelfile.new
+       if [ $labelfile_entry_found -ne 0 ]; then
+               mv -f $labelfile.new $labelfile
+               LogAppend `_ 'Removed Entry "%s %s" from barcode database' "$labelfile_label" "$labelfile_barcode"`
+       fi
+}
+
+internal_remove_from_labelfile() {
+       labelfile_entry_found=0
+       labelfile_label=
+       labelfile_barcode=
+
+       lbl_search=$1
+       bc_search=$2
+
+       line=0
+       while read lbl bc junk; do
+               line=`expr $line + 1`
+               if [ -z "$lbl" -o -z "$bc" -o -n "$junk" ]; then
+                       Log       `_ 'ERROR    -> Line %s malformed: %s %s %s' "$line" "$lbl" "$bc" "$junk"`
+                       LogAppend `_ '         -> Remove %s and run "%s %s update"' "$labelfile" "$sbindir/amtape" "$config"`
+                       Exit 2 \
+                            `_ '<none>'` \
+                            `_ 'Line %s malformed in %s: %s %s %s' "$line" "$labelfile" "$lbl" "$bc" "$junk"`
+                       return $?               # in case we are internal
+               fi
+               if [ $lbl = "$lbl_search" -o $bc = "$bc_search" ]; then
+                       if [ $labelfile_entry_found -ne 0 ]; then
+                               Log       `_ 'ERROR    -> Duplicate entries: %s line %s' "$labelfile" "$line"`
+                               LogAppend `_ '         -> Remove %s and run "%s %s update"' "$labelfile" "$sbindir/amtape" "$config"`
+                               Exit 2 \
+                                    `_ '<none>'` \
+                                    `_ 'Duplicate entries: %s line %s' "$labelfile" "$line"`
+                               return $?       # in case we are internal
+                       fi
+                       labelfile_entry_found=1
+                       labelfile_label=$lbl
+                       labelfile_barcode=$bc
+               else
+                       echo $lbl $bc
+               fi
+       done
+}
+
+###
+# Add a new slot -> label correspondance to the slotinfo file, removing any previous
+# information about that slot.
+###
+
+record_label_in_slot() {
+    [ -z "$slotinfofile" ] && return
+    newlabel="$1"
+    newslot="$2"
+
+    (
+       if [ -f "$slotinfofile" ]; then
+               grep -v "^$newslot " < "$slotinfofile"
+       fi
+       echo "$newslot $newlabel"
+    ) > "$slotinfofile~"
+    mv "$slotinfofile~" "$slotinfofile"
+}
+
+###
+# Remove a slot from the slotinfo file
+###
+
+remove_slot_from_slotinfo() {
+    [ -z "$slotinfofile" ] && return
+    emptyslot="$1"
+
+    (
+       if [ -f "$slotinfofile" ]; then
+               grep -v "^$emptyslot " < "$slotinfofile"
+       fi
+    ) > "$slotinfofile~"
+    mv "$slotinfofile~" "$slotinfofile"
+}
+
+###
+# Assuming get_mtx_status has been run,
+# - if we have barcodes, regenerate the slotinfo file completely by
+#   mapping barcodes in the status into labels using the labelfile
+# - otherwise, remove all empty slots from the slotinfo file
+###
+
+regenerate_slotinfo_from_mtx() {
+    [ -z "$slotinfofile" ] && return
+    [ "$mtx_status_valid" = "1" ] || return
+
+    if [ "$havereader" = "1" ]; then
+       # rewrite slotinfo entirely based on the status, since it has barcodes
+       :> "$slotinfofile~"
+       sed -n '/.*Storage Element \([0-9][0-9]*\).*VolumeTag *= *\([^ ]*\) *$/{
+s/.*Storage Element \([0-9][0-9]*\).*VolumeTag *= *\([^ ]*\) *$/\1 \2/
+p
+}' < $mtx_status | while read newslot newbarcode; do
+               newlabel=`lookup_label_by_barcode "$newbarcode"`
+               if [ -n "$newlabel" ]; then
+                   echo "$newslot $newlabel" >> "$slotinfofile~"
+               fi
+           done
+       mv "$slotinfofile~" "$slotinfofile"
+    else
+       # just remove empty slots from slotinfo
+
+       # first determine which slots are not really empty, but are
+       # loaded into a data transfer element
+loadedslots=`sed -n '/.*(Storage Element \([0-9][0-9]*\) Loaded).*/{
+s/.*(Storage Element \([0-9][0-9]*\) Loaded).*/\1/g
+p
+}' < $mtx_status`
+
+       # now look for any slots which are empty, but which aren't
+       # in the set of loaded slots
+       sed -n '/.*Storage Element \([0-9][0-9]*\): *Empty.*/{
+s/.*Storage Element \([0-9][0-9]*\): *Empty.*/\1/g
+p
+}' < $mtx_status | while read emptyslot; do
+           reallyempty=1
+           if [ -n "$loadedslots" ]; then
+               for loadedslot in $loadedslots; do
+                   [ "$loadedslot" = "$emptyslot" ] && reallyempty=0
+               done
+           fi
+           if [ "$reallyempty" = "1" ]; then
+               remove_slot_from_slotinfo "$emptyslot"
+           fi
+       done
+    fi
+}
+
+DBGFILE=`amgetconf dbopen.$myname 2>/dev/null`
 if [ -z "$DBGFILE" ]
 then
        DBGFILE=/dev/null                       # will try this again below
@@ -698,6 +906,7 @@ cleanfile=$changerfile-clean
 accessfile=$changerfile-access
 slotfile=$changerfile-slot
 labelfile=$changerfile-barcodes
+slotinfofile=""
 [ ! -s $cleanfile ] && echo 0 > $cleanfile
 [ ! -s $accessfile ] && echo 0 > $accessfile
 [ ! -s $slotfile ] && echo -1 > $slotfile
@@ -723,6 +932,7 @@ varlist="$varlist driveslot"
 varlist="$varlist poll_drive_ready"
 varlist="$varlist initial_poll_delay"
 varlist="$varlist max_drive_wait"
+varlist="$varlist slotinfofile"
 
 for var in $varlist
 do
@@ -797,7 +1007,7 @@ initial_poll_delay=${initial_poll_delay:-'0'}              # default: zero zeconds
 max_drive_wait=${max_drive_wait:-'120'}                        # default: two minutes
 
 # check MT and MTX for sanity
-if test "${MTX:0:1}" = "/"; then
+if test "${MTX%${MTX#?}}" = "/"; then
     if ! test -f "${MTX}"; then
        Exit 2 \
            `_ '<none>'` \
@@ -831,6 +1041,8 @@ for var in $varlist; do
                continue                        # old name
        elif [ $var = "AUTOCLEAN" ]; then
                continue                        # old name
+       elif [ $var = "slotinfofile" ]; then
+               continue                        # not numeric
        fi
        eval val=\"'$'$var\"
        if [ -z "$val" ]; then
@@ -1132,7 +1344,7 @@ loadslot() {
                waittime=`expr $waittime + $poll_drive_ready`
        done
        if [ $ready -eq 0 ]; then
-               Exit 2 "$loadslot" `_ 'Drive not ready after %s seconds, rewind said "%s"' "$max_drive_wait" "$result"`
+               Exit 2 "$loadslot" `_ 'Drive not ready after %s seconds: %s' "$max_drive_wait" "$amdevcheck_message"`
                return $?                       # in case we are internal
        fi
 
@@ -1179,45 +1391,6 @@ info() {
        return $?                               # in case we are internal
 }
 
-###
-# Read the labelfile and scan for a particular entry.
-###
-
-read_labelfile() {
-       labelfile_entry_found=0
-       labelfile_label=
-       labelfile_barcode=
-
-       lbl_search=$1
-       bc_search=$2
-
-       line=0
-       while read lbl bc junk; do
-               line=`expr $line + 1`
-               if [ -z "$lbl" -o -z "$bc" -o -n "$junk" ]; then
-                       Log       `_ 'ERROR    -> Line %s malformed: %s %s %s' "$line" "$lbl" "$bc" "$junk"`
-                       LogAppend `_ '         -> Remove %s and run "%s %s update"' "$labelfile" "$sbindir/amtape" "$config"`
-                       Exit 2 \
-                            `_ '<none>'` \
-                            `_ 'Line %s malformed in %s: %s %s %s' "$line" "$labelfile" "$lbl" "$bc" "$junk"`
-                       return $?               # in case we are internal
-               fi
-               if [ $lbl = "$lbl_search" -o $bc = "$bc_search" ]; then
-                       if [ $labelfile_entry_found -ne 0 ]; then
-                               Log       `_ 'ERROR    -> Duplicate entries: %s line %s' "$labelfile" "$line"`
-                               LogAppend `_ '         -> Remove %s and run "%s %s update"' "$labelfile" "$sbindir/amtape" "$config"`
-                               Exit 2 \
-                                    `_ '<none>'` \
-                                    `_ 'Duplicate entries: %s line %s' "$labelfile" "$line"`
-                               return $?       # in case we are internal
-                       fi
-                       labelfile_entry_found=1
-                       labelfile_label=$lbl
-                       labelfile_barcode=$bc
-               fi
-       done
-}
-
 ###
 # Adds the label and barcode for the currently loaded tape to the
 # barcode file.  Return an error if the database is messed up.
@@ -1230,15 +1403,16 @@ addlabel() {
                return $?                       # in case we are internal
        fi
         tapelabel=$1
-       if [ $havereader -eq 0 ]; then
-               Exit 2 `_ '<none>'` `_ 'Not configured with barcode reader'`
-               return $?                       # in case we are internal
-       fi
         get_loaded_info
        if [ $loadedslot -lt 0 ]; then
                Exit 1 `_ '<none>'` `_ 'No tape currently loaded'`
                return $?                       # in case we are internal
        fi
+       record_label_in_slot "$tapelabel" "$loadedslot"
+       if [ $havereader -eq 0 ]; then
+               Exit 0 "$loadedslot" "$rawtape" # that's all we needed
+               return $?                       # in case we are internal
+       fi
        if [ -z "$loadedbarcode" ]; then
                Exit 1 `_ '<none>'` `_ 'No barcode found for tape %s.' $tapelabel`
                return $?                       # in case we are internal
@@ -1261,14 +1435,16 @@ addlabel() {
                        new_val=$tapelabel
                fi
                if [ -n "$lf_val" ]; then
-                       LogAppend `_ 'ERROR    -> !!! Label database corrupted !!!'`
-                       LogAppend `_ '         -> "%s" conflicts with new %s "%s" for %s "%s"' "$old_val" "$val_type" "$new_val" "$lf_type" "$lf_val"`
-                       Exit 2 \
-                            `_ '<none>'` \
-                            `_ '%s: "%s" conflicts with new %s "%s" for %s "%s"' "$tapelabel" "$old_val" "$val_type" "$new_val" "$lf_type" "$lf_val"`
-                       return $?               # in case we are internal
+                       if [ "$val_type" = "barcode" ]; then
+                               remove_from_labelfile $labelfile "" "$old_val"
+                       else
+                               remove_from_labelfile $labelfile "$old_val" ""
+                       fi
+                       echo "$tapelabel $loadedbarcode" >> $labelfile
+                       LogAppend `_ '         -> appended %s entry: %s %s' "$labelfile" "$tapelabel" "$loadedbarcode"`
+               else
+                       LogAppend `_ "         -> already synced"`
                fi
-               LogAppend `_ "         -> already synced"`
        else
                echo "$tapelabel $loadedbarcode" >> $labelfile
                LogAppend `_ '         -> appended %s entry: %s %s' "$labelfile" "$tapelabel" "$loadedbarcode"`
@@ -1305,6 +1481,12 @@ searchtape() {
        fi
        LogAppend `_ '         -> barcode is "%s"' "$labelfile_barcode"`
        get_mtx_status
+       if [ $mtx_status_valid -eq 0 ]; then
+               Exit 2 \
+                    `_ '<none>'` \
+                    `head -1 $mtx_status`
+               return $?
+       fi
        foundslot=`sed -n '
 /VolumeTag *= *'$labelfile_barcode' *$/                        {
        s/.*Storage Element \([0-9][0-9]*\).*/\1/p
index 93ed793d7d61123f4475b1f99c6ab5b05176802e..d53c804457ec7783a13a35c86869a24c23c45cd9 100644 (file)
@@ -11,7 +11,7 @@ static char rcsid[] = "$Id: scsi-changer-driver.c,v 1.52 2006/07/21 00:25:50 mar
 
 #include "scsi-defs.h"
 
-#include "tapeio.h"
+#include "device.h"
 
 extern FILE *debug_file;
 extern changer_t *changer;    /* Needed for the infos about emubarcode and labelfile */
@@ -452,6 +452,38 @@ char *chgscsi_datestamp = NULL;       /* Result pointer for tape_rdlabel */
 char *chgscsi_label = NULL;           /* Result pointer for tape_rdlabel */
 char *chgscsi_result = NULL;          /* Needed for the result string of MapBarCode */
 
+/*
+ * This used to be in tape-src/tapeio.c; this is the Device API version.
+ */
+
+static char *
+tape_rdlabel(
+    char *devname,
+    char **datestamp,
+    char **label)
+{
+    Device *dev;
+    char *r = NULL;
+
+    dev = device_open(devname);
+    if (dev->status != DEVICE_STATUS_SUCCESS) {
+       r = g_strdup(device_error_or_status(dev));
+       g_object_unref(dev);
+       return r;
+    }
+
+    if (!device_configure(dev, TRUE) || !device_read_label(dev)) {
+       r = g_strdup(device_error_or_status(dev));
+       g_object_unref(dev);
+       return r;
+    }
+
+    *datestamp = g_strdup(dev->volume_time);
+    *label = g_strdup(dev->volume_label);
+
+    return NULL;
+}
+
 /*
  * First all functions which are called from extern
  */
@@ -2592,7 +2624,6 @@ GenericRewind(
   CDB_T CDB;
   extern OpenFiles_T *pDev;
   RequestSense_T *pRequestSense;
-  char *errstr;                    /* Used by tape_rewind */
   int ret;
   int cnt = 0;
   int done;
@@ -2790,15 +2821,7 @@ GenericRewind(
          DebugPrint(DEBUG_INFO, SECTION_TAPE,_("Close Device\n"));
          SCSI_CloseDevice(DeviceFD);
        }
-      /* We don't retry if it fails; that is left to the vtape driver. */
-      if ((errstr = tape_rewind(pDev[DeviceFD].dev)) == NULL) {
-          DebugPrint(DEBUG_INFO, SECTION_TAPE,_("Rewind OK,\n"), cnt);
-      } else {
-          DebugPrint(DEBUG_ERROR, SECTION_TAPE,_("Rewind failed %s\n"),errstr);
-          DebugPrint(DEBUG_INFO, SECTION_TAPE,_("##### STOP GenericRewind (-1)\n"));
-          return(-1);
-         /*NOTREACHED*/
-      }
+      /* no actual rewind operation here -- the device itself will handle that */
       DebugPrint(DEBUG_INFO, SECTION_TAPE,_("##### STOP GenericRewind (0)\n"));
     }
 
index e21b7bb51cebde6278ab62901c52875b7db451ce..b0942bde921d3032c76947c2fb7296e2f6fdbe90 100644 (file)
@@ -70,12 +70,13 @@ INSTALLPERMS_data = chown=amanda \
        dest=$(amlibexecdir) $(amlibexec_SCRIPTS)
 
 if WANT_SETUID_CLIENT
-INSTALLPERMS_exec += dest=$(amlibexecdir) chown=root chmod=u+s,o-rwx \
+INSTALLPERMS_exec += dest=$(amlibexecdir) chown=root chmod=04750 \
                calcsize killpgrp rundump runtar
 endif
 
 lint:
        @ for p in $(amlibexec_PROGRAMS); do                                    \
+               p=`basename $$p $(EXEEXT)`;                                     \
                f="$$p.c $(libamclient_la_SOURCES)";                            \
                (cd ../common-src; make listlibsrc);                            \
                f="$$f "`cat ../common-src/listlibsrc.output`;                  \
index e830366671f9fb0578c9b67a9f881ea817a70cd3..57cde7042129e36043c4ab997134b5677f017ff3 100644 (file)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  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.
@@ -17,7 +17,7 @@
 # Makefile for Amanda client programs.
 
 # vim:ft=automake
-# Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
 # 
 # This library is free software; you can redistribute it and/or modify it
 # under the terms of the GNU Lesser General Public License version 2.1 as 
 # along with this library; if not, write to the Free Software Foundation,
 # Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
 # 
-# Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
-# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 
 # simple include file to pre-define variables which are then +='d by other
 # scripts in this directory.
 
 # vim:ft=automake
-# Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
 # 
 # This library is free software; you can redistribute it and/or modify it
 # under the terms of the GNU Lesser General Public License version 2.1 as 
@@ -54,8 +54,8 @@
 # along with this library; if not, write to the Free Software Foundation,
 # Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
 # 
-# Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
-# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 
 # SYNOPSIS:
 #
 # Files which support it are syntax-checked when the user invokes 'make check'.
 #
 # All *target* filenames must be listed in SCRIPTS_SHELL, SCRIPTS_PERL, and 
-# SCRIPTS_AWK to support 'make check', 'make dist', and 'make distclean'.
+# SCRIPTS_AWK to support 'make check', 'make dist', and 'make distclean'. No
+# files which are not substituted by config.status should be included in
+# SCRIPTS_PERL, SCRIPTS_SHELL, or SCRIPTS_AWK.  If non-generated files are listed
+# for installation, then Automake will figure out that they should be distributed;
+# otherwise, include them in EXTRA_DIST.
 #
 # USAGE:
 #
 #   SCRIPTS_PERL = fooscript barscript perl-lib.pl perlmod.pm
 #   SCRIPTS_SHELL = shell1 shell2 sh-lib.sh
 #   SCRIPTS_AWK = talk balk chalk awk-lib.awk
+#   sbin_SCRIPTS = not-subbed
+#   EXTRA_DIST = util-script.pl
 #
 # with the corresponding files in the repository:
 #
 #   fooscript.pl barscript.pl perl-lib.pl.in perlmod.pm.in
 #   shell1.sh shell2.sh sh-lib.sh.in
 #   talk.awk balk.awk chalk.awk awk-lib.awk.in
+#   not-subbed util-script.pl
 #
 # by default, all shell and perl scripts are syntax checked.  If this is
 # a problem (for example, perl scripts depending on Amanda extension 
 # INSTALLPERMS_exec = \
 #      dest=$(sbindir) chown=amanda chmod= \
 #              foo bar \
-#      chmod=u+s,o-rwx \
+#      chmod=07450 \
 #              bing
 #      dest=$(libexecdir) chmod= \
 #              $(libexec_PROGRAMS)
 #
 # This whole operation is not required when making builds for packaging,
 # and can be disabled with --disable-installperms, via the WANT_INSTALLPERMS
-# AM_CONDITIONAL.
+# AM_CONDITIONAL.  When disabled, the file 'installperms.sh' in the top-level
+# build directory is populated with a format suitable for shell interpretation,
+# with lines like this:
+#   installperm "amanda:disk" "04750" "/usr/local/sbin/bing"
+# the arguments being, respectively, owner:group, mode, and filename.  There will
+# be exactly one line for each file which has specific permissions.  The intention
+# is that this file be used by packaging scripts to set correct permissions at install
+# time.  Note that files which have no special permissions requirements do not appear 
+# in this file at all, due to limitations of Automake.
 
 # vim:ft=automake
 
@@ -167,18 +182,20 @@ DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
        $(top_srcdir)/config/automake/precompile.am \
        $(top_srcdir)/config/automake/scripts.am \
        $(top_srcdir)/config/automake/vars.am
+@WANT_INSTALLPERMS_FALSE@am__append_1 = $(installperms_sh)
 amlibexec_PROGRAMS = noop$(EXEEXT) calcsize$(EXEEXT) killpgrp$(EXEEXT) \
        rundump$(EXEEXT) runtar$(EXEEXT) selfcheck$(EXEEXT) \
        sendbackup$(EXEEXT) sendsize$(EXEEXT) versionsuffix$(EXEEXT)
-@WANT_SAMBA_TRUE@am__append_1 = findpass.c
+@WANT_SAMBA_TRUE@am__append_2 = findpass.c
 EXTRA_PROGRAMS = $(am__EXEEXT_1)
-@WANT_SETUID_CLIENT_TRUE@am__append_2 = dest=$(amlibexecdir) chown=root chmod=u+s,o-rwx \
+@WANT_SETUID_CLIENT_TRUE@am__append_3 = dest=$(amlibexecdir) chown=root chmod=04750 \
 @WANT_SETUID_CLIENT_TRUE@              calcsize killpgrp rundump runtar
 
 subdir = client-src
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps =  \
        $(top_srcdir)/config/macro-archive/ac_define_dir.m4 \
+       $(top_srcdir)/config/macro-archive/ac_perl_module_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_perl_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_swig.m4 \
        $(top_srcdir)/config/macro-archive/ax_compare_version.m4 \
@@ -212,6 +229,7 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/amanda/libs.m4 \
        $(top_srcdir)/config/amanda/net.m4 \
        $(top_srcdir)/config/amanda/progs.m4 \
+       $(top_srcdir)/config/amanda/ps.m4 \
        $(top_srcdir)/config/amanda/readdir.m4 \
        $(top_srcdir)/config/amanda/readline.m4 \
        $(top_srcdir)/config/amanda/rsh-security.m4 \
@@ -234,7 +252,9 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/float_h.m4 \
        $(top_srcdir)/config/gnulib/fsusage.m4 \
        $(top_srcdir)/config/gnulib/getaddrinfo.m4 \
+       $(top_srcdir)/config/gnulib/getopt.m4 \
        $(top_srcdir)/config/gnulib/gettimeofday.m4 \
+       $(top_srcdir)/config/gnulib/gnulib-common.m4 \
        $(top_srcdir)/config/gnulib/gnulib-comp.m4 \
        $(top_srcdir)/config/gnulib/include_next.m4 \
        $(top_srcdir)/config/gnulib/inet_ntop.m4 \
@@ -262,7 +282,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/sys_stat_h.m4 \
        $(top_srcdir)/config/gnulib/sys_time_h.m4 \
        $(top_srcdir)/config/gnulib/tempname.m4 \
-       $(top_srcdir)/config/gnulib/ulonglong.m4 \
        $(top_srcdir)/config/gnulib/unistd_h.m4 \
        $(top_srcdir)/config/gnulib/vasnprintf.m4 \
        $(top_srcdir)/config/gnulib/visibility.m4 \
@@ -273,7 +292,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gettext-macros/lib-ld.m4 \
        $(top_srcdir)/config/gettext-macros/lib-link.m4 \
        $(top_srcdir)/config/gettext-macros/lib-prefix.m4 \
-       $(top_srcdir)/config/gettext-macros/longlong.m4 \
        $(top_srcdir)/config/gettext-macros/nls.m4 \
        $(top_srcdir)/config/gettext-macros/po.m4 \
        $(top_srcdir)/config/gettext-macros/progtest.m4 \
@@ -374,7 +392,7 @@ versionsuffix_DEPENDENCIES = ../common-src/libamanda.la libamclient.la \
        ../gnulib/libgnu.la
 amlibexecSCRIPT_INSTALL = $(INSTALL_SCRIPT)
 SCRIPTS = $(amlibexec_SCRIPTS)
-DEFAULT_INCLUDES = -I. -I$(top_builddir)/config@am__isrc@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/config
 depcomp = $(SHELL) $(top_srcdir)/config/depcomp
 am__depfiles_maybe = depfiles
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
@@ -397,6 +415,7 @@ ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
+AIX_BACKUP = @AIX_BACKUP@
 ALLOCA = @ALLOCA@
 ALLOCA_H = @ALLOCA_H@
 AMANDA_DBGDIR = @AMANDA_DBGDIR@
@@ -411,8 +430,10 @@ AMPLOT_CAT_GZIP = @AMPLOT_CAT_GZIP@
 AMPLOT_CAT_PACK = @AMPLOT_CAT_PACK@
 AMPLOT_COMPRESS = @AMPLOT_COMPRESS@
 AMTAR = @AMTAR@
+APPLICATION_DIR = @APPLICATION_DIR@
 AR = @AR@
 ARPA_INET_H = @ARPA_INET_H@
+ASSERTIONS = @ASSERTIONS@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -424,16 +445,28 @@ BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@
 BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@
 BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@
 BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@
+BSDTCP_SECURITY = @BSDTCP_SECURITY@
+BSDUDP_SECURITY = @BSDUDP_SECURITY@
+BSD_SECURITY = @BSD_SECURITY@
 CAT = @CAT@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
+CHECK_USERID = @CHECK_USERID@
 CHIO = @CHIO@
 CHS = @CHS@
+CLIENT_HOST_INSTANCE = @CLIENT_HOST_INSTANCE@
+CLIENT_HOST_KEY_FILE = @CLIENT_HOST_KEY_FILE@
+CLIENT_HOST_PRINCIPAL = @CLIENT_HOST_PRINCIPAL@
 CLIENT_LOGIN = @CLIENT_LOGIN@
 CLIENT_SCRIPTS_OPT = @CLIENT_SCRIPTS_OPT@
 COMPRESS = @COMPRESS@
+COMPRESS_BEST_OPT = @COMPRESS_BEST_OPT@
+COMPRESS_FAST_OPT = @COMPRESS_FAST_OPT@
+COMPRESS_PATH = @COMPRESS_PATH@
+COMPRESS_SUFFIX = @COMPRESS_SUFFIX@
+CONFIG_CLOBBER_MY_CONFIG = @CONFIG_CLOBBER_MY_CONFIG@
 CONFIG_DIR = @CONFIG_DIR@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
@@ -447,6 +480,7 @@ DD = @DD@
 DEFAULT_AMANDATES_FILE = @DEFAULT_AMANDATES_FILE@
 DEFAULT_CHANGER_DEVICE = @DEFAULT_CHANGER_DEVICE@
 DEFAULT_CONFIG = @DEFAULT_CONFIG@
+DEFAULT_MAILER = @DEFAULT_MAILER@
 DEFAULT_SERVER = @DEFAULT_SERVER@
 DEFAULT_TAPE_DEVICE = @DEFAULT_TAPE_DEVICE@
 DEFAULT_TAPE_SERVER = @DEFAULT_TAPE_SERVER@
@@ -454,7 +488,7 @@ DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DOC_BUILD_DATE = @DOC_BUILD_DATE@
 DUMP = @DUMP@
-DUMPER_DIR = @DUMPER_DIR@
+DUMP_RETURNS_1 = @DUMP_RETURNS_1@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -467,6 +501,7 @@ F77 = @F77@
 FFLAGS = @FFLAGS@
 FLOAT_H = @FLOAT_H@
 GETCONF = @GETCONF@
+GETOPT_H = @GETOPT_H@
 GETTEXT = @GETTEXT@
 GLIB_CFLAGS = @GLIB_CFLAGS@
 GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
@@ -477,9 +512,12 @@ GMSGFMT_015 = @GMSGFMT_015@
 GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
 GNULIB_CHOWN = @GNULIB_CHOWN@
 GNULIB_DUP2 = @GNULIB_DUP2@
+GNULIB_ENVIRON = @GNULIB_ENVIRON@
 GNULIB_FCHDIR = @GNULIB_FCHDIR@
 GNULIB_FFLUSH = @GNULIB_FFLUSH@
+GNULIB_FOPEN = @GNULIB_FOPEN@
 GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
+GNULIB_FREOPEN = @GNULIB_FREOPEN@
 GNULIB_FSEEK = @GNULIB_FSEEK@
 GNULIB_FSEEKO = @GNULIB_FSEEKO@
 GNULIB_FTELL = @GNULIB_FTELL@
@@ -489,6 +527,7 @@ GNULIB_GETCWD = @GNULIB_GETCWD@
 GNULIB_GETDELIM = @GNULIB_GETDELIM@
 GNULIB_GETLINE = @GNULIB_GETLINE@
 GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
+GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@
 GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
 GNULIB_LCHOWN = @GNULIB_LCHOWN@
 GNULIB_LSEEK = @GNULIB_LSEEK@
@@ -513,8 +552,10 @@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
 GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
 GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
 GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
+GNULIB_PUTENV = @GNULIB_PUTENV@
 GNULIB_READLINK = @GNULIB_READLINK@
 GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@
+GNULIB_SETENV = @GNULIB_SETENV@
 GNULIB_SLEEP = @GNULIB_SLEEP@
 GNULIB_SNPRINTF = @GNULIB_SNPRINTF@
 GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@
@@ -523,11 +564,15 @@ GNULIB_STPNCPY = @GNULIB_STPNCPY@
 GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
 GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
 GNULIB_STRDUP = @GNULIB_STRDUP@
+GNULIB_STRERROR = @GNULIB_STRERROR@
 GNULIB_STRNDUP = @GNULIB_STRNDUP@
 GNULIB_STRNLEN = @GNULIB_STRNLEN@
 GNULIB_STRPBRK = @GNULIB_STRPBRK@
 GNULIB_STRSEP = @GNULIB_STRSEP@
+GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@
+GNULIB_STRSTR = @GNULIB_STRSTR@
 GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
+GNULIB_UNSETENV = @GNULIB_UNSETENV@
 GNULIB_VASPRINTF = @GNULIB_VASPRINTF@
 GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@
 GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
@@ -541,6 +586,7 @@ GOBJECT_QUERY = @GOBJECT_QUERY@
 GREP = @GREP@
 GZIP = @GZIP@
 HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@
+HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@
 HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@
 HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@
 HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
@@ -549,9 +595,10 @@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
 HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@
 HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
 HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
-HAVE_DECL_STRNCASECMP = @HAVE_DECL_STRNCASECMP@
+HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@
 HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
 HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
+HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@
 HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
 HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
 HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
@@ -559,7 +606,9 @@ HAVE_DUP2 = @HAVE_DUP2@
 HAVE_FSEEKO = @HAVE_FSEEKO@
 HAVE_FTELLO = @HAVE_FTELLO@
 HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
+HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
 HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
+HAVE_GZIP = @HAVE_GZIP@
 HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
 HAVE_IO_H = @HAVE_IO_H@
 HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
@@ -568,8 +617,10 @@ HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@
 HAVE_MEMPCPY = @HAVE_MEMPCPY@
 HAVE_MKDTEMP = @HAVE_MKDTEMP@
 HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@
+HAVE_OS_H = @HAVE_OS_H@
 HAVE_READLINK = @HAVE_READLINK@
 HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@
+HAVE_SETENV = @HAVE_SETENV@
 HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
 HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
 HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
@@ -577,7 +628,6 @@ HAVE_SLEEP = @HAVE_SLEEP@
 HAVE_STDINT_H = @HAVE_STDINT_H@
 HAVE_STPCPY = @HAVE_STPCPY@
 HAVE_STPNCPY = @HAVE_STPNCPY@
-HAVE_STRCASECMP = @HAVE_STRCASECMP@
 HAVE_STRCASESTR = @HAVE_STRCASESTR@
 HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
 HAVE_STRNDUP = @HAVE_STRNDUP@
@@ -586,10 +636,12 @@ HAVE_STRSEP = @HAVE_STRSEP@
 HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@
 HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
 HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
+HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
 HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
 HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
 HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
 HAVE_UNISTD_H = @HAVE_UNISTD_H@
+HAVE_UNSETENV = @HAVE_UNSETENV@
 HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
 HAVE_VASPRINTF = @HAVE_VASPRINTF@
 HAVE_VISIBILITY = @HAVE_VISIBILITY@
@@ -605,6 +657,8 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 INTLLIBS = @INTLLIBS@
 INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+KRB4_SECURITY = @KRB4_SECURITY@
+KRB5_SECURITY = @KRB5_SECURITY@
 LDFLAGS = @LDFLAGS@
 LEX = @LEX@
 LEXLIB = @LEXLIB@
@@ -621,6 +675,8 @@ LIBTHREAD = @LIBTHREAD@
 LIBTOOL = @LIBTOOL@
 LIBTOOL_DEPS = @LIBTOOL_DEPS@
 LN_S = @LN_S@
+LOCKING = @LOCKING@
+LOW_TCPPORTRANGE = @LOW_TCPPORTRANGE@
 LTLIBICONV = @LTLIBICONV@
 LTLIBINTL = @LTLIBINTL@
 LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
@@ -629,7 +685,6 @@ LTLIBPTH = @LTLIBPTH@
 LTLIBTHREAD = @LTLIBTHREAD@
 MAILER = @MAILER@
 MAKEINFO = @MAKEINFO@
-MAXTAPEBLOCKSIZE = @MAXTAPEBLOCKSIZE@
 MCUTIL = @MCUTIL@
 MKDIR_P = @MKDIR_P@
 MSGFMT = @MSGFMT@
@@ -665,26 +720,37 @@ PERL_INC = @PERL_INC@
 PKG_CONFIG = @PKG_CONFIG@
 POSUB = @POSUB@
 PRINT = @PRINT@
+PS = @PS@
+PS_ARGUMENT = @PS_ARGUMENT@
 PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
 RANLIB = @RANLIB@
 READLINE_LIBS = @READLINE_LIBS@
 REPLACE_CHOWN = @REPLACE_CHOWN@
 REPLACE_FCHDIR = @REPLACE_FCHDIR@
 REPLACE_FFLUSH = @REPLACE_FFLUSH@
+REPLACE_FOPEN = @REPLACE_FOPEN@
 REPLACE_FPRINTF = @REPLACE_FPRINTF@
+REPLACE_FREOPEN = @REPLACE_FREOPEN@
 REPLACE_FSEEK = @REPLACE_FSEEK@
 REPLACE_FSEEKO = @REPLACE_FSEEKO@
 REPLACE_FTELL = @REPLACE_FTELL@
 REPLACE_FTELLO = @REPLACE_FTELLO@
 REPLACE_GETCWD = @REPLACE_GETCWD@
 REPLACE_GETLINE = @REPLACE_GETLINE@
+REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
 REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
 REPLACE_LCHOWN = @REPLACE_LCHOWN@
 REPLACE_LSEEK = @REPLACE_LSEEK@
+REPLACE_MEMMEM = @REPLACE_MEMMEM@
 REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
 REPLACE_PRINTF = @REPLACE_PRINTF@
+REPLACE_PUTENV = @REPLACE_PUTENV@
 REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
 REPLACE_SPRINTF = @REPLACE_SPRINTF@
+REPLACE_STRCASESTR = @REPLACE_STRCASESTR@
+REPLACE_STRERROR = @REPLACE_STRERROR@
+REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@
+REPLACE_STRSTR = @REPLACE_STRSTR@
 REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
 REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
 REPLACE_VPRINTF = @REPLACE_VPRINTF@
@@ -692,7 +758,11 @@ REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
 REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
 REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
 RESTORE = @RESTORE@
+RSH_SECURITY = @RSH_SECURITY@
 SAMBA_CLIENT = @SAMBA_CLIENT@
+SERVER_HOST_INSTANCE = @SERVER_HOST_INSTANCE@
+SERVER_HOST_KEY_FILE = @SERVER_HOST_KEY_FILE@
+SERVER_HOST_PRINCIPAL = @SERVER_HOST_PRINCIPAL@
 SERVICE_SUFFIX = @SERVICE_SUFFIX@
 SETUID_GROUP = @SETUID_GROUP@
 SET_MAKE = @SET_MAKE@
@@ -702,6 +772,7 @@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
 SNAPSHOT_STAMP = @SNAPSHOT_STAMP@
 SORT = @SORT@
 SSH = @SSH@
+SSH_SECURITY = @SSH_SECURITY@
 STDBOOL_H = @STDBOOL_H@
 STDINT_H = @STDINT_H@
 STRIP = @STRIP@
@@ -711,7 +782,14 @@ SWIG_LIB = @SWIG_LIB@
 SYS_SOCKET_H = @SYS_SOCKET_H@
 SYS_STAT_H = @SYS_STAT_H@
 SYS_TIME_H = @SYS_TIME_H@
+TCPPORTRANGE = @TCPPORTRANGE@
+TICKET_LIFETIME = @TICKET_LIFETIME@
+UDPPORTRANGE = @UDPPORTRANGE@
+UNCOMPRESS_OPT = @UNCOMPRESS_OPT@
+UNCOMPRESS_PATH = @UNCOMPRESS_PATH@
+USE_AMANDAHOSTS = @USE_AMANDAHOSTS@
 USE_NLS = @USE_NLS@
+USE_RUNDUMP = @USE_RUNDUMP@
 USE_VERSION_SUFFIXES = @USE_VERSION_SUFFIXES@
 VDUMP = @VDUMP@
 VERSION = @VERSION@
@@ -720,6 +798,7 @@ VERSION_MAJOR = @VERSION_MAJOR@
 VERSION_MINOR = @VERSION_MINOR@
 VERSION_PATCH = @VERSION_PATCH@
 VERSION_SUFFIX = @VERSION_SUFFIX@
+VOID_UNSETENV = @VOID_UNSETENV@
 VRESTORE = @VRESTORE@
 VXDUMP = @VXDUMP@
 VXRESTORE = @VXRESTORE@
@@ -748,6 +827,7 @@ am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+amdatadir = @amdatadir@
 amincludedir = @amincludedir@
 amlibdir = @amlibdir@
 amlibexecdir = @amlibexecdir@
@@ -766,6 +846,8 @@ dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 gl_LIBOBJS = @gl_LIBOBJS@
 gl_LTLIBOBJS = @gl_LTLIBOBJS@
+gltests_LIBOBJS = @gltests_LIBOBJS@
+gltests_LTLIBOBJS = @gltests_LTLIBOBJS@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
@@ -795,6 +877,7 @@ target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 SUFFIXES = 
@@ -806,7 +889,8 @@ MOSTLYCLEANFILES =
 CLEANFILES = config.log *.test.c
 
 # and we'll need to clean up our generated files for distclean
-DISTCLEANFILES = $(SCRIPTS_SHELL) $(SCRIPTS_PERL) $(SCRIPTS_AWK)
+DISTCLEANFILES = $(SCRIPTS_SHELL) $(SCRIPTS_PERL) $(SCRIPTS_AWK) \
+       $(SCRIPTS_INCLUDE) $(am__append_1)
 MAINTAINERCLEANFILES = 
 
 # syntax-check shell scripts on 'make check'
@@ -815,6 +899,25 @@ CHECK_SHELL = $(SCRIPTS_SHELL)
 # sed expression to strip leading directories from a filename; this converts e.g.,
 # src/foo/bar.so to bar.so.
 strip_leading_dirs = s|^.*/||
+@WANT_INSTALLPERMS_FALSE@do_file = pa="$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
+@WANT_INSTALLPERMS_FALSE@    echo "installperm \"$$chown\" \"$$chmod\" \"$$pa\"" >> "$(installperms_sh)"
+
+
+# define a snippet of the scripts below to either perform a chown/chmod operation,
+# or record that operation in the logfile.  On entry to the snippet, $$dest is the
+# destination directory, $$cmd is the srcdir-relative pathname of the target file,
+# $$chown is the ownership, and $$chmod is the permission pattern.
+@WANT_INSTALLPERMS_TRUE@do_file = pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
+@WANT_INSTALLPERMS_TRUE@    if test -n "$$chown"; then \
+@WANT_INSTALLPERMS_TRUE@       echo chown "$$chown" "$$pa"; \
+@WANT_INSTALLPERMS_TRUE@       chown "$$chown" "$$pa" || exit 1; \
+@WANT_INSTALLPERMS_TRUE@    fi; \
+@WANT_INSTALLPERMS_TRUE@    if test -n "$$chmod"; then \
+@WANT_INSTALLPERMS_TRUE@       echo chmod "$$chmod" "$$pa"; \
+@WANT_INSTALLPERMS_TRUE@       chmod "$$chmod" "$$pa" || exit 1; \
+@WANT_INSTALLPERMS_TRUE@    fi 
+
+@WANT_INSTALLPERMS_FALSE@installperms_sh = "$(top_builddir)/installperms.sh"
 INCLUDES = -I$(top_builddir)/common-src \
                -I$(top_srcdir)/common-src   \
                -I$(top_srcdir)/amandad-src  \
@@ -830,7 +933,7 @@ CHECK_PERL = $(sbin_SCRIPTS)
 SCRIPTS_PERL = $(CHECK_PERL)
 SCRIPTS_SHELL = $(amlibexec_SCRIPTS)
 libamclient_la_SOURCES = amandates.c getfsent.c unctime.c \
-       client_util.c $(am__append_1)
+       client_util.c $(am__append_2)
 libamclient_la_LDFLAGS = -release $(VERSION)
 libamclient_la_LIBADD = ../common-src/libamanda.la
 
@@ -856,7 +959,7 @@ noinst_HEADERS = amandates.h        getfsent.h      \
                        findpass.h      client_util.h
 
 INSTALLPERMS_exec = chown=amanda dest=$(amlibexecdir) \
-       $(amlibexec_PROGRAMS) $(am__append_2)
+       $(amlibexec_PROGRAMS) $(am__append_3)
 INSTALLPERMS_data = chown=amanda \
        dest=$(sbindir) $(sbin_SCRIPTS) \
        dest=$(amlibexecdir) $(amlibexec_SCRIPTS)
@@ -902,8 +1005,8 @@ install-amlibLTLIBRARIES: $(amlib_LTLIBRARIES)
        @list='$(amlib_LTLIBRARIES)'; for p in $$list; do \
          if test -f $$p; then \
            f=$(am__strip_dir) \
-           echo " $(LIBTOOL) --mode=install $(amlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(amlibdir)/$$f'"; \
-           $(LIBTOOL) --mode=install $(amlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(amlibdir)/$$f"; \
+           echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(amlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(amlibdir)/$$f'"; \
+           $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(amlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(amlibdir)/$$f"; \
          else :; fi; \
        done
 
@@ -911,8 +1014,8 @@ uninstall-amlibLTLIBRARIES:
        @$(NORMAL_UNINSTALL)
        @list='$(amlib_LTLIBRARIES)'; for p in $$list; do \
          p=$(am__strip_dir) \
-         echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(amlibdir)/$$p'"; \
-         $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(amlibdir)/$$p"; \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(amlibdir)/$$p'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(amlibdir)/$$p"; \
        done
 
 clean-amlibLTLIBRARIES:
@@ -934,8 +1037,8 @@ install-amlibexecPROGRAMS: $(amlibexec_PROGRAMS)
             || test -f $$p1 \
          ; then \
            f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
-          echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(amlibexecPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(amlibexecdir)/$$f'"; \
-          $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(amlibexecPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(amlibexecdir)/$$f" || exit 1; \
+          echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(amlibexecPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(amlibexecdir)/$$f'"; \
+          $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(amlibexecPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(amlibexecdir)/$$f" || exit 1; \
          else :; fi; \
        done
 
@@ -1059,8 +1162,8 @@ ID: $(HEADERS) $(SOURCES) $(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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
        mkid -fID $$unique
 tags: TAGS
 
@@ -1072,8 +1175,8 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
        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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { 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) \
@@ -1083,13 +1186,12 @@ ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
                $(TAGS_FILES) $(LISP)
        tags=; \
-       here=`pwd`; \
        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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
        test -z "$(CTAGS_ARGS)$$tags$$unique" \
          || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
             $$tags $$unique
@@ -1170,8 +1272,6 @@ maintainer-clean-generic:
        @echo "it deletes files that may require special tools to rebuild."
        -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
        -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-@WANT_INSTALLPERMS_FALSE@install-exec-hook:
-@WANT_INSTALLPERMS_FALSE@install-data-hook:
 clean: clean-am
 
 clean-am: clean-amlibLTLIBRARIES clean-amlibexecPROGRAMS clean-generic \
@@ -1213,7 +1313,7 @@ install-pdf: install-pdf-am
 
 install-ps: install-ps-am
 
-installcheck-am:
+installcheck-am: installcheck-local
 
 maintainer-clean: maintainer-clean-am
        -rm -rf ./$(DEPDIR)
@@ -1249,17 +1349,23 @@ uninstall-am: uninstall-amlibLTLIBRARIES uninstall-amlibexecPROGRAMS \
        install-exec-am install-exec-hook install-html install-html-am \
        install-info install-info-am install-man install-pdf \
        install-pdf-am install-ps install-ps-am install-strip \
-       installcheck installcheck-am installdirs maintainer-clean \
-       maintainer-clean-generic mostlyclean mostlyclean-compile \
-       mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-       tags uninstall uninstall-am uninstall-amlibLTLIBRARIES \
-       uninstall-amlibexecPROGRAMS uninstall-amlibexecSCRIPTS
+       installcheck installcheck-am installcheck-local installdirs \
+       maintainer-clean maintainer-clean-generic mostlyclean \
+       mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+       pdf pdf-am ps ps-am tags uninstall uninstall-am \
+       uninstall-amlibLTLIBRARIES uninstall-amlibexecPROGRAMS \
+       uninstall-amlibexecSCRIPTS
 
 
 # Perl
 %: %.pl $(top_builddir)/config.status
        $(top_builddir)/config.status --file=$@:$<
        chmod a+x $@
+       @if test -f $(top_builddir)/perl/.libs/libCmdline.so -o -f $(top_builddir)/perl/libCmdline.so; then \
+               grep -v '^use lib' $@ > $@.nouselib; \
+               $(PERL) $(CHECK_PERL_FLAGS) -I$(top_builddir)/perl -I$(top_builddir)/perl/.libs -I$(top_srcdir)/perl -c -w -T $@.nouselib || exit 1; \
+               rm $@.nouselib; \
+       fi
 
 %.pl: %.pl.in $(top_builddir)/config.status
        $(top_builddir)/config.status --file=$@:$<
@@ -1285,13 +1391,27 @@ uninstall-am: uninstall-amlibLTLIBRARIES uninstall-amlibexecPROGRAMS \
 
 # syntax-check perl scripts on 'make check'
 check-perl: $(CHECK_PERL)
+       @CHECK_PERL="$(CHECK_PERL)"; \
+       if test -f $(top_builddir)/perl/.libs/libCmdline.so -o -f $(top_builddir)/perl/libCmdline.so; then \
+               if test -n "$(PERL)"; then \
+                       for perlobj in $$CHECK_PERL; do \
+                               grep -v '^use lib' $$perlobj > $$perlobj.nouselib; \
+                               $(PERL) $(CHECK_PERL_FLAGS) -I$(top_builddir)/perl -I$(top_builddir)/perl/.libs -I$(top_srcdir)/perl -c -w -T $$perlobj.nouselib || exit 1; \
+                               rm $$perlobj.nouselib; \
+                       done; \
+               fi \
+       fi
+check-local: check-perl
+
+# syntax-check perl scripts on 'make installcheck'
+installcheck-perl: $(CHECK_PERL)
        @CHECK_PERL="$(CHECK_PERL)"; \
        if test -n "$(PERL)"; then \
                for perlobj in $$CHECK_PERL; do \
                        $(PERL) $(CHECK_PERL_FLAGS) -c -w -T $$perlobj || exit 1; \
                done; \
        fi
-check-local: check-perl
+installcheck-local: installcheck-perl
 check-shell: $(CHECK_SHELL)
        @CHECK_SHELL="$(CHECK_SHELL)"; \
        if test -n "$$CHECK_SHELL"; then \
@@ -1329,52 +1449,40 @@ dist-scripts:
        true
 dist-hook: dist-scripts
 
-@WANT_INSTALLPERMS_TRUE@installperms-exec:
-@WANT_INSTALLPERMS_TRUE@       @installperms="$(INSTALLPERMS_exec)"; \
-@WANT_INSTALLPERMS_TRUE@       test -n "$$installperms" && echo "Setting installation permissions on executables"; \
-@WANT_INSTALLPERMS_TRUE@       dest=; chown=; chmod=; \
-@WANT_INSTALLPERMS_TRUE@       for cmd in $$installperms; do \
-@WANT_INSTALLPERMS_TRUE@           case "$$cmd" in \
-@WANT_INSTALLPERMS_TRUE@               chown=amanda) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
-@WANT_INSTALLPERMS_TRUE@               dest=*|chown=*|chmod=*) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; eval $$cmd;; \
-@WANT_INSTALLPERMS_TRUE@               *)  pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chown"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chown "$$chown" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chown "$$chown" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chmod"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chmod "$$chmod" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chmod "$$chmod" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@           esac; \
-@WANT_INSTALLPERMS_TRUE@       done
-
-@WANT_INSTALLPERMS_TRUE@installperms-data:
-@WANT_INSTALLPERMS_TRUE@       @installperms="$(INSTALLPERMS_data)"; \
-@WANT_INSTALLPERMS_TRUE@       test -n "$$installperms" && echo "Setting installation permissions on data"; \
-@WANT_INSTALLPERMS_TRUE@       dest=; chown=; chmod=; \
-@WANT_INSTALLPERMS_TRUE@       for cmd in $$installperms; do \
-@WANT_INSTALLPERMS_TRUE@           case "$$cmd" in \
-@WANT_INSTALLPERMS_TRUE@               chown=amanda) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
-@WANT_INSTALLPERMS_TRUE@               dest=*|chown=*|chmod=*) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; eval $$cmd;; \
-@WANT_INSTALLPERMS_TRUE@               *)  pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chown"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chown "$$chown" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chown "$$chown" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chmod"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chmod "$$chmod" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chmod "$$chmod" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@           esac; \
-@WANT_INSTALLPERMS_TRUE@       done
-
-@WANT_INSTALLPERMS_TRUE@install-exec-hook: installperms-exec
-@WANT_INSTALLPERMS_TRUE@install-data-hook: installperms-data
+installperms-exec:
+       @installperms="$(INSTALLPERMS_exec)"; \
+       test -n "$$installperms" && echo "Setting installation permissions on executables"; \
+       dest=; chown=; chmod=; \
+       for cmd in $$installperms; do \
+           case "$$cmd" in \
+               chown=amanda) \
+                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
+               dest=*|chown=*|chmod=*) \
+                       echo "  ($$cmd)"; eval $$cmd;; \
+               *) $(do_file) ;; \
+           esac; \
+       done
+
+installperms-data:
+       @installperms="$(INSTALLPERMS_data)"; \
+       dest=; chown=; chmod=; \
+       for cmd in $$installperms; do \
+           case "$$cmd" in \
+               chown=amanda) \
+                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
+               dest=*|chown=*|chmod=*) \
+                       echo "  ($$cmd)"; eval $$cmd;; \
+               *)  $(do_file) ;; \
+           esac; \
+       done
+
+install-exec-hook: installperms-exec
+install-data-hook: installperms-data
+
+# define a rule to initialize the installperms manifest file
+@WANT_INSTALLPERMS_TRUE@installperms-init:
+@WANT_INSTALLPERMS_FALSE@installperms-init:
+@WANT_INSTALLPERMS_FALSE@      rm -f "$(installperms_sh)"
 
 # A rule to make precompiler output from C files.  This is not used during
 # ordinary builds, but but can very useful in debugging problems on strange
@@ -1388,6 +1496,7 @@ dist-hook: dist-scripts
 
 lint:
        @ for p in $(amlibexec_PROGRAMS); do                                    \
+               p=`basename $$p $(EXEEXT)`;                                     \
                f="$$p.c $(libamclient_la_SOURCES)";                            \
                (cd ../common-src; make listlibsrc);                            \
                f="$$f "`cat ../common-src/listlibsrc.output`;                  \
index abbef3626c19d5a40deb41586cc20733b0b0f63d..c16b246fb81904e92dd9c1861236ceea760820bf 100644 (file)
@@ -57,8 +57,10 @@ start_amandates(
     int ch;
     char *qname;
 
-    if (amandates_file == NULL)
+    if (amandates_file == NULL) {
+       errno = 0;
        return 0;
+    }
 
     /* clean up from previous invocation */
 
index 7765532e1e0dd525729736246d271d767a574df9..ef28c1a87ed0e881a69b9d76e2fb569cf97d0e2e 100644 (file)
 #include "client_util.h"
 #include "getfsent.h"
 #include "util.h"
+#include "glib-util.h"
 #include "timestamp.h"
 #include "pipespawn.h"
+#include "amxml.h"
+#include "glob.h"
+#include "clock.h"
+#include "amandates.h"
+#include "version.h"
 
 #define MAXMAXDUMPS 16
 
@@ -210,7 +216,8 @@ add_include(
     int nb_exp=0;
     char *quoted, *file;
 
-    (void)disk;        /* Quiet unused parameter warning */
+    (void)disk;                /* Quiet unused parameter warning */
+    (void)device;      /* Quiet unused parameter warning */
 
     l = strlen(ainc);
     if(ainc[l-1] == '\n') {
@@ -227,8 +234,11 @@ add_include(
     }
     else {
        char *incname = ainc+2;
+       int set_root;
 
-       if(strchr(incname, '/')) {
+        set_root = set_root_privs(1);
+       /* Take as is if not root && many '/' */
+       if(!set_root && strchr(incname, '/')) {
             file = quoted = quote_string(ainc);
            if (*file == '"') {
                file[strlen(file) - 1] = '\0';
@@ -239,40 +249,34 @@ add_include(
            nb_exp++;
        }
        else {
-           char *regex;
-           DIR *d;
-           struct dirent *entry;
-
-           regex = glob_to_regex(incname);
-           if((d = opendir(device)) == NULL) {
-               quoted = quote_string(device);
-               dbprintf(_("Can't open disk %s\n"), quoted);
-               if(verbose) {
-                   g_printf(_("ERROR [Can't open disk %s]\n"), quoted);
-               }
-               amfree(quoted);
+           int nb;
+           glob_t globbuf;
+           char *cwd;
+
+           globbuf.gl_offs = 0;
+
+           cwd = g_get_current_dir();
+           if (chdir(device) != 0) {
+               error(_("Failed to chdir(%s): %s\n"), device, strerror(errno));
            }
-           else {
-               while((entry = readdir(d)) != NULL) {
-                   if(is_dot_or_dotdot(entry->d_name)) {
-                       continue;
-                   }
-                   if(match(regex, entry->d_name)) {
-                       incname = vstralloc("./", entry->d_name, NULL);
-                       file = quoted = quote_string(incname);
-                       if (*file == '"') {
-                           file[strlen(file) - 1] = '\0';
-                           file++;
-                       }
-                       g_fprintf(file_include, "%s\n", file);
-                       amfree(quoted);
-                       amfree(incname);
-                       nb_exp++;
-                   }
+           glob(incname, 0, NULL, &globbuf);
+           if (chdir(cwd) != 0) {
+               error(_("Failed to chdir(%s): %s\n"), cwd, strerror(errno));
+           }
+           if (set_root)
+               set_root_privs(0);
+           nb_exp = globbuf.gl_pathc;
+           for (nb=0; nb < nb_exp; nb++) {
+               file = stralloc2("./", globbuf.gl_pathv[nb]);
+               quoted = quote_string(file);
+               if (*file == '"') {
+                   file[strlen(file) - 1] = '\0';
+                   file++;
                }
-               closedir(d);
+               g_fprintf(file_include, "%s\n", file);
+               amfree(quoted);
+               amfree(file);
            }
-           amfree(regex);
        }
     }
     return nb_exp;
@@ -280,10 +284,8 @@ add_include(
 
 char *
 build_exclude(
-    char *     disk,
-    char *     device,
-    option_t * options,
-    int                verbose)
+    dle_t   *dle,
+    int             verbose)
 {
     char *filename;
     FILE *file_exclude;
@@ -293,26 +295,26 @@ build_exclude(
     int nb_exclude = 0;
     char *quoted;
 
-    if(options->exclude_file) nb_exclude += options->exclude_file->nb_element;
-    if(options->exclude_list) nb_exclude += options->exclude_list->nb_element;
+    if (dle->exclude_file) nb_exclude += dle->exclude_file->nb_element;
+    if (dle->exclude_list) nb_exclude += dle->exclude_list->nb_element;
 
-    if(nb_exclude == 0) return NULL;
+    if (nb_exclude == 0) return NULL;
 
-    if((filename = build_name(disk, "exclude", verbose)) != NULL) {
-       if((file_exclude = fopen(filename,"w")) != NULL) {
+    if ((filename = build_name(dle->disk, "exclude", verbose)) != NULL) {
+       if ((file_exclude = fopen(filename,"w")) != NULL) {
 
-           if(options->exclude_file) {
-               for(excl = options->exclude_file->first; excl != NULL;
+           if (dle->exclude_file) {
+               for(excl = dle->exclude_file->first; excl != NULL;
                    excl = excl->next) {
                    add_exclude(file_exclude, excl->name,
-                               verbose && options->exclude_optional == 0);
+                               verbose && dle->exclude_optional == 0);
                }
            }
 
-           if(options->exclude_list) {
-               for(excl = options->exclude_list->first; excl != NULL;
+           if (dle->exclude_list) {
+               for(excl = dle->exclude_list->first; excl != NULL;
                    excl = excl->next) {
-                   char *exclname = fixup_relative(excl->name, device);
+                   char *exclname = fixup_relative(excl->name, dle->device);
                    if((exclude = fopen(exclname, "r")) != NULL) {
                        while ((aexc = agets(exclude)) != NULL) {
                            if (aexc[0] == '\0') {
@@ -320,7 +322,7 @@ build_exclude(
                                continue;
                            }
                            add_exclude(file_exclude, aexc,
-                                       verbose && options->exclude_optional == 0);
+                                       verbose && dle->exclude_optional == 0);
                            amfree(aexc);
                        }
                        fclose(exclude);
@@ -329,7 +331,7 @@ build_exclude(
                        quoted = quote_string(exclname);
                        dbprintf(_("Can't open exclude file %s (%s)\n"),
                                  quoted, strerror(errno));
-                       if(verbose && (options->exclude_optional == 0 ||
+                       if(verbose && (dle->exclude_optional == 0 ||
                                       errno != ENOENT)) {
                            g_printf(_("ERROR [Can't open exclude file %s (%s)]\n"),
                                   quoted, strerror(errno));
@@ -340,12 +342,11 @@ build_exclude(
                }
            }
             fclose(file_exclude);
-       }
-       else {
+       } else {
            quoted = quote_string(filename);
            dbprintf(_("Can't create exclude file %s (%s)\n"),
                      quoted, strerror(errno));
-           if(verbose) {
+           if (verbose) {
                g_printf(_("ERROR [Can't create exclude file %s (%s)]\n"),
                        quoted, strerror(errno));
            }
@@ -358,10 +359,8 @@ build_exclude(
 
 char *
 build_include(
-    char *     disk,
-    char *     device,
-    option_t * options,
-    int                verbose)
+    dle_t   *dle,
+    int             verbose)
 {
     char *filename;
     FILE *file_include;
@@ -372,36 +371,36 @@ build_include(
     int nb_exp = 0;
     char *quoted;
 
-    if(options->include_file) nb_include += options->include_file->nb_element;
-    if(options->include_list) nb_include += options->include_list->nb_element;
+    if (dle->include_file) nb_include += dle->include_file->nb_element;
+    if (dle->include_list) nb_include += dle->include_list->nb_element;
 
-    if(nb_include == 0) return NULL;
+    if (nb_include == 0) return NULL;
 
-    if((filename = build_name(disk, "include", verbose)) != NULL) {
-       if((file_include = fopen(filename,"w")) != NULL) {
+    if ((filename = build_name(dle->disk, "include", verbose)) != NULL) {
+       if ((file_include = fopen(filename,"w")) != NULL) {
 
-           if(options->include_file) {
-               for(incl = options->include_file->first; incl != NULL;
+           if (dle->include_file) {
+               for (incl = dle->include_file->first; incl != NULL;
                    incl = incl->next) {
-                   nb_exp += add_include(disk, device, file_include,
+                   nb_exp += add_include(dle->disk, dle->device, file_include,
                                  incl->name,
-                                 verbose && options->include_optional == 0);
+                                 verbose && dle->include_optional == 0);
                }
            }
 
-           if(options->include_list) {
-               for(incl = options->include_list->first; incl != NULL;
+           if (dle->include_list) {
+               for (incl = dle->include_list->first; incl != NULL;
                    incl = incl->next) {
-                   char *inclname = fixup_relative(incl->name, device);
-                   if((include = fopen(inclname, "r")) != NULL) {
+                   char *inclname = fixup_relative(incl->name, dle->device);
+                   if ((include = fopen(inclname, "r")) != NULL) {
                        while ((ainc = agets(include)) != NULL) {
                            if (ainc[0] == '\0') {
                                amfree(ainc);
                                continue;
                            }
-                           nb_exp += add_include(disk, device,
+                           nb_exp += add_include(dle->disk, dle->device,
                                                  file_include, ainc,
-                                                 verbose && options->include_optional == 0);
+                                                 verbose && dle->include_optional == 0);
                            amfree(ainc);
                        }
                        fclose(include);
@@ -410,7 +409,7 @@ build_include(
                        quoted = quote_string(inclname);
                        dbprintf(_("Can't open include file %s (%s)\n"),
                                  quoted, strerror(errno));
-                       if(verbose && (options->include_optional == 0 ||
+                       if (verbose && (dle->include_optional == 0 ||
                                       errno != ENOENT)) {
                            g_printf(_("ERROR [Can't open include file %s (%s)]\n"),
                                   quoted, strerror(errno));
@@ -421,12 +420,11 @@ build_include(
                }
            }
             fclose(file_include);
-       }
-       else {
+       } else {
            quoted = quote_string(filename);
            dbprintf(_("Can't create include file %s (%s)\n"),
                      quoted, strerror(errno));
-           if(verbose) {
+           if (verbose) {
                g_printf(_("ERROR [Can't create include file %s (%s)]\n"),
                        quoted, strerror(errno));
            }
@@ -434,10 +432,10 @@ build_include(
        }
     }
        
-    if(nb_exp == 0) {
-       quoted = quote_string(disk);
+    if (nb_exp == 0) {
+       quoted = quote_string(dle->disk);
        dbprintf(_("No include for %s\n"), quoted);
-       if(verbose && options->include_optional == 0) {
+       if (verbose && dle->include_optional == 0) {
            g_printf(_("ERROR [No include for %s]\n"), quoted);
        }
        amfree(quoted);
@@ -448,59 +446,24 @@ build_include(
 
 
 void
-init_options(
-    option_t *options)
-{
-    options->str = NULL;
-    options->compress = COMP_NONE;
-    options->srvcompprog = NULL;
-    options->clntcompprog = NULL;
-    options->encrypt = ENCRYPT_NONE;
-    options->kencrypt = 0;
-    options->srv_encrypt = NULL;
-    options->clnt_encrypt = NULL;
-    options->srv_decrypt_opt = NULL;
-    options->clnt_decrypt_opt = NULL;
-    options->no_record = 0;
-    options->createindex = 0;
-    options->auth = NULL;
-    options->exclude_file = NULL;
-    options->exclude_list = NULL;
-    options->include_file = NULL;
-    options->include_list = NULL;
-    options->exclude_optional = 0;
-    options->include_optional = 0;
-}
-
-
-option_t *
 parse_options(
-    char *str,
-    char *disk,
-    char *device,
+    char         *str,
+    dle_t        *dle,
     am_feature_t *fs,
-    int verbose)
+    int           verbose)
 {
     char *exc;
     char *inc;
-    option_t *options;
     char *p, *tok;
     char *quoted;
 
-    (void)disk;                /* Quiet unused parameter warning */
-    (void)device;      /* Quiet unused parameter warning */
-
-    options = alloc(SIZEOF(option_t));
-    init_options(options);
-    options->str = stralloc(str);
-
     p = stralloc(str);
     tok = strtok(p,";");
 
     while (tok != NULL) {
        if(am_has_feature(fs, fe_options_auth)
           && BSTRNCMP(tok,"auth=") == 0) {
-           if(options->auth != NULL) {
+           if (dle->auth != NULL) {
                quoted = quote_string(tok + 5);
                dbprintf(_("multiple auth option %s\n"), quoted);
                if(verbose) {
@@ -508,174 +471,174 @@ parse_options(
                }
                amfree(quoted);
            }
-           options->auth = stralloc(&tok[5]);
+           dle->auth = stralloc(&tok[5]);
        }
        else if(am_has_feature(fs, fe_options_bsd_auth)
           && BSTRNCMP(tok, "bsd-auth") == 0) {
-           if(options->auth != NULL) {
+           if (dle->auth != NULL) {
                dbprintf(_("multiple auth option\n"));
-               if(verbose) {
+               if (verbose) {
                    g_printf(_("ERROR [multiple auth option]\n"));
                }
            }
-           options->auth = stralloc("bsd");
+           dle->auth = stralloc("bsd");
        }
-       else if(am_has_feature(fs, fe_options_krb4_auth)
+       else if (am_has_feature(fs, fe_options_krb4_auth)
           && BSTRNCMP(tok, "krb4-auth") == 0) {
-           if(options->auth != NULL) {
+           if (dle->auth != NULL) {
                dbprintf(_("multiple auth option\n"));
-               if(verbose) {
+               if (verbose) {
                    g_printf(_("ERROR [multiple auth option]\n"));
                }
            }
-           options->auth = stralloc("krb4");
+           dle->auth = stralloc("krb4");
        }
-       else if(BSTRNCMP(tok, "compress-fast") == 0) {
-           if(options->compress != COMP_NONE) {
+       else if (BSTRNCMP(tok, "compress-fast") == 0) {
+           if (dle->compress != COMP_NONE) {
                dbprintf(_("multiple compress option\n"));
-               if(verbose) {
+               if (verbose) {
                    g_printf(_("ERROR [multiple compress option]\n"));
                }
            }
-           options->compress = COMP_FAST;
+           dle->compress = COMP_FAST;
        }
-       else if(BSTRNCMP(tok, "compress-best") == 0) {
-           if(options->compress != COMP_NONE) {
+       else if (BSTRNCMP(tok, "compress-best") == 0) {
+           if (dle->compress != COMP_NONE) {
                dbprintf(_("multiple compress option\n"));
-               if(verbose) {
+               if (verbose) {
                    g_printf(_("ERROR [multiple compress option]\n"));
                }
            }
-           options->compress = COMP_BEST;
+           dle->compress = COMP_BEST;
        }
-       else if(BSTRNCMP(tok, "srvcomp-fast") == 0) {
-           if(options->compress != COMP_NONE) {
+       else if (BSTRNCMP(tok, "srvcomp-fast") == 0) {
+           if (dle->compress != COMP_NONE) {
                dbprintf(_("multiple compress option\n"));
-               if(verbose) {
+               if (verbose) {
                    g_printf(_("ERROR [multiple compress option]\n"));
                }
            }
-           options->compress = COMP_SERVER_FAST;
+           dle->compress = COMP_SERVER_FAST;
        }
-       else if(BSTRNCMP(tok, "srvcomp-best") == 0) {
-           if(options->compress != COMP_NONE) {
+       else if (BSTRNCMP(tok, "srvcomp-best") == 0) {
+           if (dle->compress != COMP_NONE) {
                dbprintf(_("multiple compress option\n"));
-               if(verbose) {
+               if (verbose) {
                    g_printf(_("ERROR [multiple compress option]\n"));
                }
            }
-           options->compress = COMP_SERVER_BEST;
+           dle->compress = COMP_SERVER_BEST;
        }
-       else if(BSTRNCMP(tok, "srvcomp-cust=") == 0) {
-           if(options->compress != COMP_NONE) {
+       else if (BSTRNCMP(tok, "srvcomp-cust=") == 0) {
+           if (dle->compress != COMP_NONE) {
                dbprintf(_("multiple compress option\n"));
-               if(verbose) {
+               if (verbose) {
                    g_printf(_("ERROR [multiple compress option]\n"));
                }
            }
-           options->srvcompprog = stralloc(tok + SIZEOF("srvcomp-cust=") -1);
-           options->compress = COMP_SERVER_CUST;
+           dle->compprog = stralloc(tok + SIZEOF("srvcomp-cust=") -1);
+           dle->compress = COMP_SERVER_CUST;
        }
-       else if(BSTRNCMP(tok, "comp-cust=") == 0) {
-           if(options->compress != COMP_NONE) {
+       else if (BSTRNCMP(tok, "comp-cust=") == 0) {
+           if (dle->compress != COMP_NONE) {
                dbprintf(_("multiple compress option\n"));
-               if(verbose) {
+               if (verbose) {
                    g_printf(_("ERROR [multiple compress option]\n"));
                }
            }
-           options->clntcompprog = stralloc(tok + SIZEOF("comp-cust=") -1);
-           options->compress = COMP_CUST;
+           dle->compprog = stralloc(tok + SIZEOF("comp-cust=") -1);
+           dle->compress = COMP_CUST;
            /* parse encryption options */
        } 
-       else if(BSTRNCMP(tok, "encrypt-serv-cust=") == 0) {
-           if(options->encrypt != ENCRYPT_NONE) {
+       else if (BSTRNCMP(tok, "encrypt-serv-cust=") == 0) {
+           if (dle->encrypt != ENCRYPT_NONE) {
                dbprintf(_("multiple encrypt option\n"));
-               if(verbose) {
+               if (verbose) {
                    g_printf(_("ERROR [multiple encrypt option]\n"));
                }
            }
-           options->srv_encrypt = stralloc(tok + SIZEOF("encrypt-serv-cust=") -1);
-           options->encrypt = ENCRYPT_SERV_CUST;
+           dle->srv_encrypt = stralloc(tok + SIZEOF("encrypt-serv-cust=") -1);
+           dle->encrypt = ENCRYPT_SERV_CUST;
        } 
-       else if(BSTRNCMP(tok, "encrypt-cust=") == 0) {
-           if(options->encrypt != ENCRYPT_NONE) {
+       else if (BSTRNCMP(tok, "encrypt-cust=") == 0) {
+           if (dle->encrypt != ENCRYPT_NONE) {
                dbprintf(_("multiple encrypt option\n"));
-               if(verbose) {
+               if (verbose) {
                    g_printf(_("ERROR [multiple encrypt option]\n"));
                }
            }
-           options->clnt_encrypt= stralloc(tok + SIZEOF("encrypt-cust=") -1);
-           options->encrypt = ENCRYPT_CUST;
+           dle->clnt_encrypt= stralloc(tok + SIZEOF("encrypt-cust=") -1);
+           dle->encrypt = ENCRYPT_CUST;
        } 
-       else if(BSTRNCMP(tok, "server-decrypt-option=") == 0) {
-         options->srv_decrypt_opt = stralloc(tok + SIZEOF("server-decrypt-option=") -1);
+       else if (BSTRNCMP(tok, "server-decrypt-option=") == 0) {
+         dle->srv_decrypt_opt = stralloc(tok + SIZEOF("server-decrypt-option=") -1);
        }
-       else if(BSTRNCMP(tok, "client-decrypt-option=") == 0) {
-         options->clnt_decrypt_opt = stralloc(tok + SIZEOF("client-decrypt-option=") -1);
+       else if (BSTRNCMP(tok, "client-decrypt-option=") == 0) {
+         dle->clnt_decrypt_opt = stralloc(tok + SIZEOF("client-decrypt-option=") -1);
        }
-       else if(BSTRNCMP(tok, "no-record") == 0) {
-           if(options->no_record != 0) {
+       else if (BSTRNCMP(tok, "no-record") == 0) {
+           if (dle->record != 1) {
                dbprintf(_("multiple no-record option\n"));
-               if(verbose) {
+               if (verbose) {
                    g_printf(_("ERROR [multiple no-record option]\n"));
                }
            }
-           options->no_record = 1;
+           dle->record = 0;
        }
-       else if(BSTRNCMP(tok, "index") == 0) {
-           if(options->createindex != 0) {
+       else if (BSTRNCMP(tok, "index") == 0) {
+           if (dle->create_index != 0) {
                dbprintf(_("multiple index option\n"));
-               if(verbose) {
+               if (verbose) {
                    g_printf(_("ERROR [multiple index option]\n"));
                }
            }
-           options->createindex = 1;
+           dle->create_index = 1;
        }
-       else if(BSTRNCMP(tok, "exclude-optional") == 0) {
-           if(options->exclude_optional != 0) {
+       else if (BSTRNCMP(tok, "exclude-optional") == 0) {
+           if (dle->exclude_optional != 0) {
                dbprintf(_("multiple exclude-optional option\n"));
-               if(verbose) {
+               if (verbose) {
                    g_printf(_("ERROR [multiple exclude-optional option]\n"));
                }
            }
-           options->exclude_optional = 1;
+           dle->exclude_optional = 1;
        }
-       else if(strcmp(tok, "include-optional") == 0) {
-           if(options->include_optional != 0) {
+       else if (strcmp(tok, "include-optional") == 0) {
+           if (dle->include_optional != 0) {
                dbprintf(_("multiple include-optional option\n"));
-               if(verbose) {
+               if (verbose) {
                    g_printf(_("ERROR [multiple include-optional option]\n"));
                }
            }
-           options->include_optional = 1;
+           dle->include_optional = 1;
        }
-       else if(BSTRNCMP(tok,"exclude-file=") == 0) {
+       else if (BSTRNCMP(tok,"exclude-file=") == 0) {
            exc = unquote_string(&tok[13]);
-           options->exclude_file = append_sl(options->exclude_file, exc);
+           dle->exclude_file = append_sl(dle->exclude_file, exc);
            amfree(exc);
        }
-       else if(BSTRNCMP(tok,"exclude-list=") == 0) {
+       else if (BSTRNCMP(tok,"exclude-list=") == 0) {
            exc = unquote_string(&tok[13]);
-           options->exclude_list = append_sl(options->exclude_list, exc);
+           dle->exclude_list = append_sl(dle->exclude_list, exc);
            amfree(exc);
        }
-       else if(BSTRNCMP(tok,"include-file=") == 0) {
+       else if (BSTRNCMP(tok,"include-file=") == 0) {
            inc = unquote_string(&tok[13]);
-           options->include_file = append_sl(options->include_file, inc);
+           dle->include_file = append_sl(dle->include_file, inc);
            amfree(inc);
        }
-       else if(BSTRNCMP(tok,"include-list=") == 0) {
+       else if (BSTRNCMP(tok,"include-list=") == 0) {
            inc = unquote_string(&tok[13]);
-           options->include_list = append_sl(options->include_list, inc);
+           dle->include_list = append_sl(dle->include_list, inc);
            amfree(inc);
        }
-       else if(BSTRNCMP(tok,"kencrypt") == 0) {
-           options->kencrypt = 1;
+       else if (BSTRNCMP(tok,"kencrypt") == 0) {
+           dle->kencrypt = 1;
        }
-       else if(strcmp(tok,"|") != 0) {
+       else if (strcmp(tok,"|") != 0) {
            quoted = quote_string(tok);
            dbprintf(_("unknown option %s\n"), quoted);
-           if(verbose) {
+           if (verbose) {
                g_printf(_("ERROR [unknown option: %s]\n"), quoted);
            }
            amfree(quoted);
@@ -683,64 +646,93 @@ parse_options(
        tok = strtok(NULL, ";");
     }
     amfree(p);
-    return options;
 }
 
-void
-output_tool_property(
-    FILE     *tool,
-    option_t *options)
+int
+application_property_argv_size(dle_t *dle) {
+    int nb;
+
+    nb = 0;
+    if (dle->include_list)
+       nb += dle->include_list->nb_element;
+    if (dle->include_file)
+       nb += dle->include_file->nb_element;
+    nb++; /* include optional */
+    if (dle->exclude_list)
+       nb += dle->exclude_list->nb_element;
+    if (dle->exclude_file)
+       nb += dle->exclude_file->nb_element;
+    nb++; /* exclude optional */
+    nb *= 2;  /*name + value */
+    nb += property_argv_size(dle->application_property);
+
+    return nb;
+}
+
+int
+application_property_add_to_argv(
+    char **argvchild,
+    dle_t *dle,
+    backup_support_option_t *bsu)
 {
-    sle_t *sle;
-    char *q;
+    char **argv = argvchild;
+    sle_t *incl, *excl;
 
-    if (!is_empty_sl(options->exclude_file)) {
-       for(sle = options->exclude_file->first ; sle != NULL; sle=sle->next) {
-           q = quote_string(sle->name);
-           g_fprintf(tool, "EXCLUDE-FILE %s\n", q);
-           amfree(q);
+    if (bsu) {
+       if (bsu->include_file && dle->include_file) {
+           for (incl = dle->include_file->first; incl != NULL;
+                incl = incl->next) {
+               *argv = stralloc("--include-file");
+               argv++;
+               *argv = stralloc(incl->name);
+               argv++;
+           }
        }
-    }
-
-    if (!is_empty_sl(options->exclude_list)) {
-       for(sle = options->exclude_list->first ; sle != NULL; sle=sle->next) {
-           q = quote_string(sle->name);
-           g_fprintf(tool, "EXCLUDE-LIST %s\n", q);
-           amfree(q);
+       if (bsu->include_list && dle->include_list) {
+           for (incl = dle->include_list->first; incl != NULL;
+                incl = incl->next) {
+               *argv = stralloc("--include-list");
+               argv++;
+               *argv = stralloc(incl->name);
+               argv++;
+           }
        }
-    }
-
-    if (!is_empty_sl(options->include_file)) {
-       for(sle = options->include_file->first ; sle != NULL; sle=sle->next) {
-           q = quote_string(sle->name);
-           g_fprintf(tool, "INCLUDE-FILE %s\n", q);
-           amfree(q);
+       if (bsu->include_optional && dle->include_optional) {
+           *argv = stralloc("--include-optional");
+           argv++;
+           *argv = stralloc("yes");
+           argv++;
        }
-    }
 
-    if (!is_empty_sl(options->include_list)) {
-       for(sle = options->include_list->first ; sle != NULL; sle=sle->next) {
-           q = quote_string(sle->name);
-           g_fprintf(tool, "INCLUDE-LIST %s\n", q);
-           amfree(q);
+       if (bsu->exclude_file && dle->exclude_file) {
+           for (excl = dle->exclude_file->first; excl != NULL;
+                excl = excl->next) {
+               *argv = stralloc("--exclude-file");
+               argv++;
+               *argv = stralloc(excl->name);
+               argv++;
+           }
+       }
+       if (bsu->exclude_list && dle->exclude_list) {
+           for (excl = dle->exclude_list->first; excl != NULL;
+               excl = excl->next) {
+               *argv = stralloc("--exclude-list");
+               argv++;
+               *argv = stralloc(excl->name);
+               argv++;
+           }
+       }
+       if (bsu->exclude_optional && dle->exclude_optional) {
+           *argv = stralloc("--exclude-optional");
+           argv++;
+           *argv = stralloc("yes");
+           argv++;
        }
     }
 
-    if (!is_empty_sl(options->exclude_file) ||
-       !is_empty_sl(options->exclude_list)) {
-       if (options->exclude_optional)
-           g_fprintf(tool, "EXCLUDE-OPTIONAL YES\n");
-       else
-           g_fprintf(tool, "EXCLUDE-OPTIONAL NO\n");
-    }
-
-    if (!is_empty_sl(options->include_file) ||
-       !is_empty_sl(options->include_list)) {
-       if (options->include_optional)
-           g_fprintf(tool, "INCLUDE-OPTIONAL YES\n");
-       else
-           g_fprintf(tool, "INCLUDE-OPTIONAL NO\n");
-    }
+    g_hash_table_foreach(dle->application_property,
+                       &proplist_add_to_argv, &argv);
+    return (argv - argvchild);
 }
 
 backup_support_option_t *
@@ -748,7 +740,8 @@ backup_support_option(
     char       *program,
     g_option_t *g_options,
     char       *disk,
-    char       *amdevice)
+    char       *amdevice,
+    GPtrArray **errarray)
 {
     pid_t   supportpid;
     int     supportin, supportout, supporterr;
@@ -756,11 +749,15 @@ backup_support_option(
     char  **argvchild;
     int     i;
     FILE   *streamout;
+    FILE   *streamerr;
     char   *line;
+    int     status;
+    char   *err = NULL;
     backup_support_option_t *bsu;
 
-    cmd = vstralloc(DUMPER_DIR, "/", program, NULL);
-    argvchild = malloc(5 * SIZEOF(char *));
+    *errarray = g_ptr_array_new();
+    cmd = vstralloc(APPLICATION_DIR, "/", program, NULL);
+    argvchild = g_new0(char *, 12);
     i = 0;
     argvchild[i++] = program;
     argvchild[i++] = "support";
@@ -778,19 +775,25 @@ backup_support_option(
     }
     if (amdevice) {
        argvchild[i++] = "--device";
-       argvchild[i++] = amdevice;
+       argvchild[i++] = stralloc(amdevice);
     }
     argvchild[i++] = NULL;
 
     supporterr = fileno(stderr);
-    supportpid = pipespawnv(cmd, STDIN_PIPE|STDOUT_PIPE, &supportin,
-                           &supportout, &supporterr, argvchild);
+    supportpid = pipespawnv(cmd, STDIN_PIPE|STDOUT_PIPE|STDERR_PIPE, 0,
+                           &supportin, &supportout, &supporterr, argvchild);
 
     aclose(supportin);
 
-    bsu = malloc(SIZEOF(*bsu));
-    memset(bsu, '\0', SIZEOF(*bsu));
+    bsu = g_new0(backup_support_option_t, 1);
+    bsu->config = 1;
+    bsu->host = 1;
+    bsu->disk = 1;
     streamout = fdopen(supportout, "r");
+    if (!streamout) {
+       error(_("Error opening pipe to child: %s"), strerror(errno));
+       /* NOTREACHED */
+    }
     while((line = agets(streamout)) != NULL) {
        dbprintf(_("support line: %s\n"), line);
        if (strncmp(line,"CONFIG ", 7) == 0) {
@@ -801,7 +804,7 @@ backup_support_option(
            bsu->host = 1;
        } else if (strncmp(line,"DISK ", 5) == 0) {
            if (strcmp(line+5, "YES") == 0)
-               bsu->host = 1;
+               bsu->disk = 1;
        } else if (strncmp(line,"INDEX-LINE ", 11) == 0) {
            if (strcmp(line+11, "YES") == 0)
                bsu->index_line = 1;
@@ -823,24 +826,712 @@ backup_support_option(
        } else if (strncmp(line,"INCLUDE-LIST ", 13) == 0) {
            if (strcmp(line+13, "YES") == 0)
                bsu->include_list = 1;
+       } else if (strncmp(line,"INCLUDE-OPTIONAL ", 17) == 0) {
+           if (strcmp(line+17, "YES") == 0)
+               bsu->include_optional = 1;
        } else if (strncmp(line,"EXCLUDE-FILE ", 13) == 0) {
            if (strcmp(line+13, "YES") == 0)
                bsu->exclude_file = 1;
        } else if (strncmp(line,"EXCLUDE-LIST ", 13) == 0) {
            if (strcmp(line+13, "YES") == 0)
                bsu->exclude_list = 1;
+       } else if (strncmp(line,"EXCLUDE-OPTIONAL ", 17) == 0) {
+           if (strcmp(line+17, "YES") == 0)
+               bsu->exclude_optional = 1;
        } else if (strncmp(line,"COLLECTION ", 11) == 0) {
            if (strcmp(line+11, "YES") == 0)
                bsu->collection = 1;
+       } else if (strncmp(line,"CALCSIZE ", 9) == 0) {
+           if (strcmp(line+9, "YES") == 0)
+               bsu->calcsize = 1;
+       } else if (strncmp(line,"MULTI-ESTIMATE ", 15) == 0) {
+           if (strcmp(line+15, "YES") == 0)
+               bsu->multi_estimate = 1;
        } else if (strncmp(line,"MAX-LEVEL ", 10) == 0) {
            bsu->max_level  = atoi(line+10);
+       } else if (strncmp(line,"RECOVER-MODE ", 13) == 0) {
+           if (strcasecmp(line+13, "SMB") == 0)
+               bsu->smb_recover_mode = 1;
        } else {
            dbprintf(_("Invalid support line: %s\n"), line);
        }
        amfree(line);
     }
     aclose(supportout);
+    streamerr = fdopen(supporterr, "r");
+    if (!streamerr) {
+       error(_("Error opening pipe to child: %s"), strerror(errno));
+       /* NOTREACHED */
+    }
+    while((line = agets(streamerr)) != NULL) {
+       if (strlen(line) > 0) {
+           g_ptr_array_add(*errarray, line);
+           dbprintf("Application '%s': %s\n", program, line);
+       }
+       amfree(bsu);
+    }
+    aclose(supporterr);
+
+    if (waitpid(supportpid, &status, 0) < 0) {
+       err = vstrallocf(_("waitpid failed: %s"), strerror(errno));
+    } else if (!WIFEXITED(status)) {
+       err = vstrallocf(_("exited with signal %d"), WTERMSIG(status));
+    } else if (WEXITSTATUS(status) != 0) {
+       err = vstrallocf(_("exited with status %d"), WEXITSTATUS(status));
+    }
+
+    if (err) {
+       g_ptr_array_add(*errarray, err);
+       dbprintf("Application '%s': %s\n", program, err);
+       amfree(bsu);
+    }
+    return bsu;
+}
+
+void
+run_client_script(
+    script_t     *script,
+    execute_on_t  execute_on,
+    g_option_t   *g_options,
+    dle_t       *dle)
+{
+    pid_t     scriptpid;
+    int       scriptin, scriptout, scripterr;
+    char     *cmd;
+    char    **argvchild;
+    int       i;
+    FILE     *streamout;
+    FILE     *streamerr;
+    char     *line;
+    int       argv_size;
+    amwait_t  wait_status;
+
+    if ((script->execute_on & execute_on) == 0)
+       return;
+    if (script->execute_where != ES_CLIENT)
+       return;
+
+    cmd = vstralloc(APPLICATION_DIR, "/", script->plugin, NULL);
+    argv_size = 14 + property_argv_size(script->property);
+    if (dle->level)
+       argv_size += 2 * g_slist_length(dle->level);
+    argvchild = g_new0(char *, argv_size);
+    i = 0;
+    argvchild[i++] = script->plugin;
+
+    switch (execute_on) {
+    case EXECUTE_ON_PRE_DLE_AMCHECK:
+       argvchild[i++] = "PRE-DLE-AMCHECK"; break;
+    case EXECUTE_ON_PRE_HOST_AMCHECK:
+       argvchild[i++] = "PRE-HOST-AMCHECK"; break;
+    case EXECUTE_ON_POST_DLE_AMCHECK:
+       argvchild[i++] = "POST-DLE-AMCHECK"; break;
+    case EXECUTE_ON_POST_HOST_AMCHECK:
+       argvchild[i++] = "POST-HOST-AMCHECK"; break;
+    case EXECUTE_ON_PRE_DLE_ESTIMATE:
+       argvchild[i++] = "PRE-DLE-ESTIMATE"; break;
+    case EXECUTE_ON_PRE_HOST_ESTIMATE:
+       argvchild[i++] = "PRE-HOST-ESTIMATE"; break;
+    case EXECUTE_ON_POST_DLE_ESTIMATE:
+       argvchild[i++] = "POST-DLE-ESTIMATE"; break;
+    case EXECUTE_ON_POST_HOST_ESTIMATE:
+       argvchild[i++] = "POST-HOST-ESTIMATE"; break;
+    case EXECUTE_ON_PRE_DLE_BACKUP:
+       argvchild[i++] = "PRE-DLE-BACKUP"; break;
+    case EXECUTE_ON_PRE_HOST_BACKUP:
+       argvchild[i++] = "PRE-HOST-BACKUP"; break;
+    case EXECUTE_ON_POST_DLE_BACKUP:
+       argvchild[i++] = "POST-DLE-BACKUP"; break;
+    case EXECUTE_ON_POST_HOST_BACKUP:
+       argvchild[i++] = "POST-HOST-BACKUP"; break;
+    case EXECUTE_ON_PRE_RECOVER:
+       argvchild[i++] = "PRE-RECOVER"; break;
+    case EXECUTE_ON_POST_RECOVER:
+       argvchild[i++] = "POST-RECOVER"; break;
+    case EXECUTE_ON_PRE_LEVEL_RECOVER:
+       argvchild[i++] = "PRE-LEVEL-RECOVER"; break;
+    case EXECUTE_ON_POST_LEVEL_RECOVER:
+       argvchild[i++] = "POST-LEVEL-RECOVER"; break;
+    case EXECUTE_ON_INTER_LEVEL_RECOVER:
+       argvchild[i++] = "INTER-LEVEL-RECOVER"; break;
+    }
+
+    argvchild[i++] = "--execute-where";
+    argvchild[i++] = "client";
+
+    if (g_options->config) {
+       argvchild[i++] = "--config";
+       argvchild[i++] = g_options->config;
+    }
+    if (g_options->hostname) {
+       argvchild[i++] = "--host";
+       argvchild[i++] = g_options->hostname;
+    }
+    if (dle->disk) {
+       argvchild[i++] = "--disk";
+       argvchild[i++] = dle->disk;
+    }
+    if (dle->device) {
+       argvchild[i++] = "--device";
+       argvchild[i++] = stralloc(dle->device);
+    }
+    if (dle->level) {
+       GSList *level;
+       char number[NUM_STR_SIZE];
+       for (level=dle->level; level; level=level->next) {
+           argvchild[i++] = "--level";
+           g_snprintf(number, SIZEOF(number), "%d",
+                      GPOINTER_TO_INT(level->data));
+           argvchild[i++] = stralloc(number);
+       }
+    }
+    i += property_add_to_argv(&argvchild[i], script->property);
+    argvchild[i++] = NULL;
+
+    scriptpid = pipespawnv(cmd, STDIN_PIPE|STDOUT_PIPE|STDERR_PIPE, 0,
+                          &scriptin, &scriptout, &scripterr, argvchild);
+
+    close(scriptin);
+
+    script->result = g_new0(client_script_result_t, 1);
+    script->result->proplist =
+                   g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL);
+    script->result->output = g_ptr_array_new();
+    script->result->err = g_ptr_array_new();
+
+    streamout = fdopen(scriptout, "r");
+    if (streamout) {
+        while((line = agets(streamout)) != NULL) {
+            dbprintf("script: %s\n", line);
+            if (BSTRNCMP(line, "PROPERTY ") == 0) {
+               char *property_name, *property_value;
+               property_name = line + 9;
+               property_value = index(property_name,' ');
+               if (property_value == NULL) {
+                   char *msg = g_strdup_printf(
+                                       "ERROR %s: Bad output property: %s",
+                                       script->plugin, line);
+                   g_ptr_array_add(script->result->output, msg);
+               } else {
+                   property_t *property;
+
+                   *property_value++ = '\0';
+                   property_name = stralloc(property_name);
+                   property_value = stralloc(property_value);
+                   property = g_hash_table_lookup(script->result->proplist,
+                                                  property_name);
+                   if (!property) {
+                       property = g_new0(property_t, 1);
+                       g_hash_table_insert(script->result->proplist,
+                                           property_name, property);
+                   }
+                   property->values = g_slist_append(property->values,
+                                                     property_value);
+               }
+               amfree(line);
+            } else {
+                g_ptr_array_add(script->result->output, line);
+            }
+        }
+    }
+    fclose(streamout);
+
+    streamerr = fdopen(scripterr, "r");
+    if (streamerr) {
+        while((line = agets(streamerr)) != NULL) {
+           g_ptr_array_add(script->result->err,
+                           g_strdup_printf(_("Script '%s' command '%s': %s"),
+                                           script->plugin, argvchild[1],
+                                           line));
+           amfree(line);
+       }
+    }
+
+    waitpid(scriptpid, &wait_status, 0);
+    if (WIFSIGNALED(wait_status)) {
+       g_ptr_array_add(script->result->err,
+                       g_strdup_printf(_("Script '%s' command '%s' terminated with signal %d: see %s"),
+                                       script->plugin, argvchild[1],
+                                       WTERMSIG(wait_status),
+                                       dbfn()));
+    } else if (WIFEXITED(wait_status)) {
+        if (WEXITSTATUS(wait_status) != 0) {
+           g_ptr_array_add(script->result->err,
+                           g_strdup_printf(_("Script '%s' command '%s' exited with status %d: see %s"),
+                                           script->plugin, argvchild[1],
+                                           WEXITSTATUS(wait_status),
+                                           dbfn()));
+        } else {
+            /* Normal exit */
+        }
+    }
+    
+}
+
+void run_client_script_output(gpointer data, gpointer user_data);
+void run_client_script_err_amcheck(gpointer data, gpointer user_data);
+void run_client_script_err_estimate(gpointer data, gpointer user_data);
+void run_client_script_err_backup(gpointer data, gpointer user_data);
+void run_client_script_err_recover(gpointer data, gpointer user_data);
+
+typedef struct script_output_s {
+    FILE  *stream;
+    dle_t *dle;
+} script_output_t;
+
+void
+run_client_script_output(
+    gpointer data,
+    gpointer user_data)
+{
+    char            *line = data;
+    script_output_t *so   = user_data;
+
+    if (line && so->stream) {
+       g_fprintf(so->stream, "%s\n", line);
+    }
+}
+
+void
+run_client_script_err_amcheck(
+    gpointer data,
+    gpointer user_data)
+{
+    char            *line  = data;
+    script_output_t *so    = user_data;
 
-    return NULL;
+    if (line && so->stream) {
+       g_fprintf(so->stream, "ERROR %s\n", line);
+    }
 }
 
+void
+run_client_script_err_estimate(
+    gpointer data,
+    gpointer user_data)
+{
+    char            *line  = data;
+    script_output_t *so    = user_data;
+
+    if (line && so->stream) {
+       char *qdisk = quote_string(so->dle->disk);
+       g_fprintf(so->stream, "%s 0 WARNING \"%s\"\n", qdisk, line);
+       amfree(qdisk);
+    }
+}
+
+void
+run_client_script_err_backup(
+    gpointer data,
+    gpointer user_data)
+{
+    char            *line  = data;
+    script_output_t *so    = user_data;
+
+    if (line && so->stream) {
+       g_fprintf(so->stream, "? %s\n", line);
+    }
+}
+
+void
+run_client_script_err_recover(
+    gpointer data,
+    gpointer user_data)
+{
+    char            *line  = data;
+    script_output_t *so    = user_data;
+
+    if (line && so->stream) {
+       g_fprintf(so->stream, "%s\n", line);
+    }
+}
+
+void
+run_client_scripts(
+    execute_on_t  execute_on,
+    g_option_t   *g_options,
+    dle_t       *dle,
+    FILE         *streamout)
+{
+    GSList          *scriptlist;
+    script_t        *script;
+    GFunc            client_script_err = NULL;
+    script_output_t  so = { streamout, dle };
+
+    for (scriptlist = dle->scriptlist; scriptlist != NULL;
+        scriptlist = scriptlist->next) {
+       script = (script_t *)scriptlist->data;
+       run_client_script(script, execute_on, g_options, dle);
+       if (script->result && script->result->output) {
+           g_ptr_array_foreach(script->result->output,
+                               run_client_script_output,
+                               &so);
+           g_ptr_array_free(script->result->output, TRUE);
+           script->result->output = NULL;
+       }
+       if (script->result && script->result->err) {
+           switch (execute_on) {
+           case EXECUTE_ON_PRE_DLE_AMCHECK:
+           case EXECUTE_ON_PRE_HOST_AMCHECK:
+           case EXECUTE_ON_POST_DLE_AMCHECK:
+           case EXECUTE_ON_POST_HOST_AMCHECK:
+                client_script_err = run_client_script_err_amcheck;
+                break;
+           case EXECUTE_ON_PRE_DLE_ESTIMATE:
+           case EXECUTE_ON_PRE_HOST_ESTIMATE:
+           case EXECUTE_ON_POST_DLE_ESTIMATE:
+           case EXECUTE_ON_POST_HOST_ESTIMATE:
+                if (am_has_feature(g_options->features,
+                                   fe_sendsize_rep_warning)) {
+                    client_script_err = run_client_script_err_estimate;
+                }
+                break;
+           case EXECUTE_ON_PRE_DLE_BACKUP:
+           case EXECUTE_ON_PRE_HOST_BACKUP:
+           case EXECUTE_ON_POST_DLE_BACKUP:
+           case EXECUTE_ON_POST_HOST_BACKUP:
+                client_script_err = run_client_script_err_backup;
+                break;
+           case EXECUTE_ON_PRE_RECOVER:
+           case EXECUTE_ON_POST_RECOVER:
+           case EXECUTE_ON_PRE_LEVEL_RECOVER:
+           case EXECUTE_ON_POST_LEVEL_RECOVER:
+           case EXECUTE_ON_INTER_LEVEL_RECOVER:
+                client_script_err = run_client_script_err_recover;
+           }
+           if (client_script_err != NULL) {
+               g_ptr_array_foreach(script->result->err,
+                                   client_script_err,
+                                   &so);
+           }
+           g_ptr_array_free(script->result->err, TRUE);
+           script->result->err = NULL;
+       }
+    }
+}
+
+
+void
+run_calcsize(
+    char   *config,
+    char   *program,
+    char   *disk,
+    char   *dirname,
+    GSList *levels,
+    char   *file_exclude,
+    char   *file_include)
+{
+    char        *cmd, *cmdline;
+    char        *my_argv[DUMP_LEVELS*2+22];
+    int          my_argc;
+    char         tmppath[PATH_MAX];
+    char         number[NUM_STR_SIZE];
+    GSList      *alevel;
+    int          level;
+    int          i;
+    char        *match_expr;
+    int          pipefd = -1, nullfd = -1;
+    pid_t        calcpid;
+    times_t      start_time;
+    FILE        *dumpout = NULL;
+    int          dumpsince;
+    char        *errmsg = NULL;
+    off_t        size = (off_t)1;
+    char        *line = NULL;
+    amwait_t     wait_status;
+    int          len;
+    char        *qdisk;
+    amandates_t *amdp;
+    char        *amandates_file;
+
+    qdisk = quote_string(disk);
+
+    amandates_file = getconf_str(CNF_AMANDATES);
+    if(!start_amandates(amandates_file, 0)) {
+       char *errstr = strerror(errno);
+       char *errmsg = vstrallocf(_("could not open %s: %s"), amandates_file, errstr);
+       char *qerrmsg = quote_string(errmsg);
+       g_printf(_("ERROR %s\n"), qerrmsg);
+       amfree(qdisk);
+       amfree(errmsg);
+       amfree(qerrmsg);
+       return;
+    }
+
+    startclock();
+    cmd = vstralloc(amlibexecdir, "/", "calcsize", versionsuffix(), NULL);
+
+    my_argc = 0;
+
+    my_argv[my_argc++] = stralloc("calcsize");
+    if (config)
+       my_argv[my_argc++] = stralloc(config);
+    else
+       my_argv[my_argc++] = stralloc("NOCONFIG");
+
+    my_argv[my_argc++] = stralloc(program);
+
+    canonicalize_pathname(disk, tmppath);
+    my_argv[my_argc++] = stralloc(tmppath);
+    canonicalize_pathname(dirname, tmppath);
+    my_argv[my_argc++] = stralloc(tmppath);
+
+    if (file_exclude) {
+       my_argv[my_argc++] = stralloc("-X");
+       my_argv[my_argc++] = file_exclude;
+    }
+
+    if (file_include) {
+       my_argv[my_argc++] = stralloc("-I");
+       my_argv[my_argc++] = file_include;
+    }
+
+    for (alevel = levels; alevel != NULL; alevel = alevel->next) {
+       amdp = amandates_lookup(disk);
+       level = GPOINTER_TO_INT(alevel->data);
+       dbprintf("level: %d\n", level);
+       dumpsince = 0;
+       for (i=0; i < level; i++) {
+           if (dumpsince < amdp->dates[i])
+               dumpsince = amdp->dates[i];
+       }
+       g_snprintf(number, SIZEOF(number), "%d", level);
+       my_argv[my_argc++] = stralloc(number);
+       g_snprintf(number, SIZEOF(number), "%d", dumpsince);
+       my_argv[my_argc++] = stralloc(number);
+    }
+
+    my_argv[my_argc] = NULL;
+    cmdline = stralloc(my_argv[0]);
+    for(i = 1; i < my_argc; i++)
+       cmdline = vstrextend(&cmdline, " ", my_argv[i], NULL);
+    dbprintf(_("running: \"%s\"\n"), cmdline);
+    amfree(cmdline);
+
+    start_time = curclock();
+
+    fflush(stderr); fflush(stdout);
+
+    if ((nullfd = open("/dev/null", O_RDWR)) == -1) {
+       errmsg = vstrallocf(_("Cannot access /dev/null : %s"),
+                           strerror(errno));
+       dbprintf("%s\n", errmsg);
+       goto common_exit;
+    }
+
+    calcpid = pipespawnv(cmd, STDERR_PIPE, 0,
+                        &nullfd, &nullfd, &pipefd, my_argv);
+    amfree(cmd);
+
+    dumpout = fdopen(pipefd,"r");
+    if (!dumpout) {
+       error(_("Can't fdopen: %s"), strerror(errno));
+       /*NOTREACHED*/
+    }
+
+    match_expr = vstralloc(" %d SIZE %lld", NULL);
+    len = strlen(qdisk);
+    for(size = (off_t)-1; (line = agets(dumpout)) != NULL; free(line)) {
+       long long size_ = (long long)0;
+       if (line[0] == '\0' || (int)strlen(line) <= len)
+           continue;
+       /* Don't use sscanf for qdisk because it can have a '%'. */
+       if (strncmp(line, qdisk, len) == 0 &&
+           sscanf(line+len, match_expr, &level, &size_) == 2) {
+           g_printf("%d %lld %d\n", level, size_, 1); /* write to sendsize */
+           dbprintf(_("estimate size for %s level %d: %lld KB\n"),
+                    qdisk, level, size_);
+       }
+       size = (off_t)size_;
+    }
+    amfree(match_expr);
+
+    dbprintf(_("waiting for %s %s child (pid=%d)\n"),
+            my_argv[0], qdisk, (int)calcpid);
+    waitpid(calcpid, &wait_status, 0);
+    if (WIFSIGNALED(wait_status)) {
+       errmsg = vstrallocf(_("%s terminated with signal %d: see %s"),
+                           "calcsize", WTERMSIG(wait_status),
+                           dbfn());
+    } else if (WIFEXITED(wait_status)) {
+       if (WEXITSTATUS(wait_status) != 0) {
+           errmsg = vstrallocf(_("%s exited with status %d: see %s"),
+                               "calcsize", WEXITSTATUS(wait_status),
+                               dbfn());
+       } else {
+           /* Normal exit */
+       }
+    } else {
+       errmsg = vstrallocf(_("%s got bad exit: see %s"),
+                           "calcsize", dbfn());
+    }
+
+    dbprintf(_("after %s %s wait: child pid=%d status=%d\n"),
+            my_argv[0], qdisk,
+            (int)calcpid, WEXITSTATUS(wait_status));
+
+    dbprintf(_(".....\n"));
+    dbprintf(_("estimate time for %s: %s\n"),
+            qdisk,
+            walltime_str(timessub(curclock(), start_time)));
+
+common_exit:
+    if (errmsg && errmsg[0] != '\0') {
+       char *qerrmsg = quote_string(errmsg);
+       dbprintf(_("errmsg is %s\n"), errmsg);
+       g_printf("ERROR %s\n", qerrmsg);
+       amfree(qerrmsg);
+    }
+    amfree(qdisk);
+    amfree(errmsg);
+    for(i = 0; i < my_argc; i++) {
+        amfree(my_argv[i]);
+    }
+    amfree(cmd);
+
+}
+
+
+void
+check_access(
+    char *     filename,
+    int                mode)
+{
+    char *noun, *adjective;
+    char *quoted = quote_string(filename);
+
+    if(mode == F_OK)
+        noun = "find", adjective = "exists";
+    else if((mode & X_OK) == X_OK)
+       noun = "execute", adjective = "executable";
+    else if((mode & (W_OK|R_OK)) == (W_OK|R_OK))
+       noun = "read/write", adjective = "read/writable";
+    else 
+       noun = "access", adjective = "accessible";
+
+    if(access(filename, mode) == -1)
+       g_printf(_("ERROR [can not %s %s: %s]\n"), noun, quoted, strerror(errno));
+    else
+       g_printf(_("OK %s %s\n"), quoted, adjective);
+    amfree(quoted);
+}
+
+void
+check_file(
+    char *     filename,
+    int                mode)
+{
+    struct stat stat_buf;
+    char *quoted;
+
+    if(!stat(filename, &stat_buf)) {
+       if(!S_ISREG(stat_buf.st_mode)) {
+           quoted = quote_string(filename);
+           g_printf(_("ERROR [%s is not a file]\n"), quoted);
+           amfree(quoted);
+       }
+    }
+    if (getuid() == geteuid()) {
+       check_access(filename, mode);
+    }
+}
+
+void
+check_dir(
+    char *     dirname,
+    int                mode)
+{
+    struct stat stat_buf;
+    char *quoted;
+    char *dir;
+
+    if(!stat(dirname, &stat_buf)) {
+       if(!S_ISDIR(stat_buf.st_mode)) {
+           quoted = quote_string(dirname);
+           g_printf(_("ERROR [%s is not a directory]\n"), quoted);
+           amfree(quoted);
+       }
+    } else {
+       quoted = quote_string(dirname);
+       g_printf(_("ERROR [%s: %s]\n"), quoted, strerror(errno));
+       amfree(quoted);
+    }
+    if (getuid() == geteuid()) {
+       dir = stralloc2(dirname, "/.");
+       check_access(dir, mode);
+       amfree(dir);
+    }
+}
+
+void
+check_suid(
+    char *     filename)
+{
+#ifndef SINGLE_USERID
+    struct stat stat_buf;
+    char *quoted = quote_string(filename);
+
+    if(!stat(filename, &stat_buf)) {
+       if(stat_buf.st_uid != 0 ) {
+           g_printf(_("ERROR [%s is not owned by root]\n"), quoted);
+       }
+       if((stat_buf.st_mode & S_ISUID) != S_ISUID) {
+           g_printf(_("ERROR [%s is not SUID root]\n"), quoted);
+       }
+    }
+    else {
+       g_printf(_("ERROR [can not stat %s]\n"), quoted);
+    }
+    amfree(quoted);
+#else
+    (void)filename;    /* Quiet unused parameter warning */
+#endif
+}
+
+/*
+ * Returns the value of the first integer in a string.
+ */
+
+double
+the_num(
+    char *      str,
+    int         pos)
+{
+    char *num;
+    int ch;
+    double d;
+
+    do {
+       ch = *str++;
+       while(ch && !isdigit(ch)) ch = *str++;
+       if (pos == 1) break;
+       pos--;
+       while(ch && (isdigit(ch) || ch == '.')) ch = *str++;
+    } while (ch);
+    num = str - 1;
+    while(isdigit(ch) || ch == '.') ch = *str++;
+    str[-1] = '\0';
+    d = atof(num);
+    str[-1] = (char)ch;
+    return d;
+}
+
+
+char *
+config_errors_to_error_string(
+    GSList *errlist)
+{
+    char *errmsg;
+    gboolean multiple_errors = FALSE;
+
+    if (errlist) {
+       errmsg = (char *)errlist->data;
+       if (errlist->next)
+           multiple_errors = TRUE;
+    } else {
+       errmsg = _("(no error message)");
+    }
+
+    return vstrallocf("ERROR %s%s", errmsg,
+       multiple_errors? _(" (additional errors not displayed)"):"");
+}
index b5ed362696bebe8ac1a5ce1cbd804e6b21a20f87..ed686c6e5cc17edaa88c990b9d00df3240d4bf61 100644 (file)
 #include "sl.h"
 #include "util.h"              /* for bstrncmp() */
 #include "amandad.h"           /* for g_option_t */
-
-typedef struct option_s {
-    char *str;
-    int compress;
-    int encrypt;
-    char *srvcompprog;
-    char *clntcompprog;
-    char *srv_encrypt;
-    char *clnt_encrypt;
-    char *srv_decrypt_opt;
-    char *clnt_decrypt_opt;
-    int no_record;
-    int createindex;
-    char *auth;
-    sl_t *exclude_file;
-    sl_t *exclude_list;
-    sl_t *include_file;
-    sl_t *include_list;
-    int exclude_optional;
-    int include_optional;
-    int kencrypt;
-} option_t;
+#include "amxml.h"             /* for dle_t      */
 
 typedef struct backup_support_option_s {
     int config;
@@ -77,21 +56,79 @@ typedef struct backup_support_option_s {
     int exclude_list;
     int exclude_optional;
     int collection;
+    int calcsize;
+    int multi_estimate;
+    int smb_recover_mode;
 } backup_support_option_t;
 
-char *build_exclude(char *disk, char *device, option_t *options, int verbose);
-char *build_include(char *disk, char *device, option_t *options, int verbose);
-void init_options(option_t *options);
-option_t *parse_options(char *str,
-                          char *disk,
-                          char *device,
-                          am_feature_t *features,
-                          int verbose);
-void output_tool_property(FILE *tool, option_t *options);
+typedef struct client_script_result_s {
+    int exit_code;
+    proplist_t proplist;
+    GPtrArray *output;
+    GPtrArray *err;
+} client_script_result_t;
+
+char *build_exclude(dle_t *dle, int verbose);
+char *build_include(dle_t *dle, int verbose);
+void parse_options(char *str,
+                  dle_t *dle,
+                  am_feature_t *features,
+                  int verbose);
+
+/* Count the size of an ARGV to store all properties of an application for
+ * a dle. include/exclude options are converted to properties.
+ *
+ * @param dle: the dle
+ * @returns: size of an ARGV needed.
+ */
+int application_property_argv_size(dle_t *dle);
+
+/* Add all properties of an application for a dle to an ARGV.
+ * include/exclude options are converted to properties.
+ *
+ * @param argvchild: the ARGV where to store properties.
+ * @param dle: the dle.
+ * @returns: Number of argument added to ARGV.
+ */
+int application_property_add_to_argv(char **argvchild,
+                                    dle_t *dle,
+                                    backup_support_option_t *bsu);
+
 char *fixup_relative(char *name, char *device);
 backup_support_option_t *backup_support_option(char *program,
                                               g_option_t *g_options,
                                               char *disk,
-                                              char *amdevice);
+                                              char *amdevice,
+                                              GPtrArray **errarray);
+
+void run_client_script(script_t     *script,
+                      execute_on_t  execute_on,
+                      g_option_t   *g_options,
+                      dle_t        *dle);
+
+void run_client_scripts(execute_on_t  execute_on,
+                       g_option_t   *g_options,
+                       dle_t        *dle,
+                       FILE         *streamout);
+
+void run_calcsize(char *config, char *program, char *disk,
+                  char *dirname, GSList *levels,
+                  char *file_exclude, char *file_include);
+
+void check_access(char *filename, int mode);
+void check_file(char *filename, int mode);
+void check_dir(char *dirname, int mode);
+void check_suid(char *filename);
+double the_num(char * str, int pos);
+
+/* Convert a GSList returned from config_errors into an "ERROR "
+ * line suitable for inclusion in a NAK or REP packet.  Because we only
+ * get one ERROR line per packet, this includes only the first 
+ * error, with an indication that there are more to follow.
+ *
+ * @param errlist: the list of errors from config_errors
+ * @returns: newly allocated string containing the error messages
+ */
+char *config_errors_to_error_string(GSList *errlist);
 
 #endif
index fb3acbdd33d7e4f13b39ab3dddf8a4509e605521..1edf46f68e64d1940bf3b33dbeedcdf34382c3dc 100644 (file)
@@ -81,7 +81,7 @@ main(
     amfree(our_feature_string);
     am_release_feature_set(our_features);
     our_features = NULL;
-    if (fullwrite(1, options, strlen(options)) < 0) {
+    if (full_write(1, options, strlen(options)) < strlen(options)) {
        error(_("error sending noop response: %s"), strerror(errno));
        /*NOTREACHED*/
     }
index 144d6bfc777052b87a39298b20c4c7331b818b69..cc4705faada555cdd4a4bfd6fd85268e7f5c2d72 100644 (file)
@@ -112,11 +112,6 @@ main(
        }
     } while(0);
 
-    if(get_client_uid() == (uid_t) -1) {
-       error(_("error [cannot find user %s in passwd file]\n"), CLIENT_LOGIN);
-       /*NOTREACHED*/
-    }
-
 #ifdef WANT_SETUID_CLIENT
     check_running_as(RUNNING_AS_CLIENT_LOGIN | RUNNING_AS_UID_ONLY);
     if (!become_root()) {
index 8787a8245f40c0a055d6e7f8197662d10e4e8ad5..416daf297d4e29de77478ca872f65b08fc127a60 100644 (file)
@@ -25,7 +25,7 @@
  *                        University of Maryland at College Park
  */
 /* 
- * $Id: selfcheck.c,v 1.95 2006/08/29 11:21:00 martinea Exp $
+ * $Id: selfcheck.c 10421 2008-03-06 18:48:30Z martineau $
  *
  * do self-check and send back any error messages
  */
@@ -42,6 +42,8 @@
 #include "client_util.h"
 #include "conffile.h"
 #include "amandad.h"
+#include "amxml.h"
+#include "base64.h"
 
 #ifdef SAMBA_CLIENT
 #include "findpass.h"
@@ -61,7 +63,7 @@ int need_runtar=0;
 int need_gnutar=0;
 int need_compress_path=0;
 int need_calcsize=0;
-int program_is_backup_api=0;
+int program_is_application_api=0;
 
 static char *amandad_auth = NULL;
 static am_feature_t *our_features = NULL;
@@ -71,14 +73,10 @@ static g_option_t *g_options = NULL;
 /* local functions */
 int main(int argc, char **argv);
 
-static void check_options(char *program, char *calcprog, char *disk, char *amdevice, option_t *options);
-static void check_disk(char *program, char *calcprog, char *disk, char *amdevice, int level, option_t *options);
+static void check_options(dle_t *dle);
+static void check_disk(dle_t *dle);
 static void check_overall(void);
-static void check_access(char *filename, int mode);
 static int check_file_exist(char *filename);
-static void check_file(char *filename, int mode);
-static void check_dir(char *dirname, int mode);
-static void check_suid(char *filename);
 static void check_space(char *dir, off_t kbytes);
 
 int
@@ -86,19 +84,16 @@ main(
     int                argc,
     char **    argv)
 {
-    int level;
     char *line = NULL;
-    char *program = NULL;
-    char *calcprog = NULL;
-    char *disk = NULL;
     char *qdisk = NULL;
-    char *amdevice = NULL;
     char *qamdevice = NULL;
     char *optstr = NULL;
     char *err_extra = NULL;
     char *s, *fp;
-    option_t *options;
     int ch;
+    dle_t *dle;
+    int level;
+    GSList *errlist;
 
     /* initialize */
 
@@ -129,6 +124,7 @@ main(
     }
 
     config_init(CONFIG_INIT_CLIENT, NULL);
+    /* (check for config errors comes later) */
 
     check_running_as(RUNNING_AS_CLIENT_LOGIN);
 
@@ -166,12 +162,24 @@ main(
                config_init(CONFIG_INIT_CLIENT | CONFIG_INIT_EXPLICIT_NAME | CONFIG_INIT_OVERLAY,
                            g_options->config);
 
-               dbrename(config_name, DBG_SUBDIR_CLIENT);
+               dbrename(get_config_name(), DBG_SUBDIR_CLIENT);
+           }
+
+           /* check for any config errors now */
+           if (config_errors(&errlist) >= CFGERR_ERRORS) {
+               char *errstr = config_errors_to_error_string(errlist);
+               g_printf("%s\n", errstr);
+               dbclose();
+               return 1;
            }
 
+           if (am_has_feature(g_options->features, fe_req_xml)) {
+               break;
+           }
            continue;
        }
 
+       dle = alloc_dle();
        s = line;
        ch = *s++;
 
@@ -179,33 +187,34 @@ main(
        if (ch == '\0') {
            goto err;                           /* no program */
        }
-       program = s - 1;
+       dle->program = s - 1;
        skip_non_whitespace(s, ch);
        s[-1] = '\0';                           /* terminate the program name */
 
-       program_is_backup_api = 0;
-       if(strcmp(program,"BACKUP")==0) {
-           program_is_backup_api = 1;
+       dle->program_is_application_api = 0;
+       if(strcmp(dle->program,"APPLICATION")==0) {
+           dle->program_is_application_api = 1;
            skip_whitespace(s, ch);             /* find dumper name */
            if (ch == '\0') {
                goto err;                       /* no program */
            }
-           program = s - 1;
+           dle->program = s - 1;
            skip_non_whitespace(s, ch);
            s[-1] = '\0';                       /* terminate the program name */
        }
 
-       if(strncmp_const(program, "CALCSIZE") == 0) {
+       if(strncmp_const(dle->program, "CALCSIZE") == 0) {
            skip_whitespace(s, ch);             /* find program name */
            if (ch == '\0') {
                goto err;                       /* no program */
            }
-           calcprog = s - 1;
+           dle->program = s - 1;
            skip_non_whitespace(s, ch);
            s[-1] = '\0';
+           dle->calcsize = 1;
        }
        else {
-           calcprog = NULL;
+           dle->calcsize = 0;
        }
 
        skip_whitespace(s, ch);                 /* find disk name */
@@ -215,7 +224,7 @@ main(
        qdisk = s - 1;
        skip_quoted_string(s, ch);
        s[-1] = '\0';                           /* terminate the disk name */
-       disk = unquote_string(qdisk);
+       dle->disk = unquote_string(qdisk);
 
        skip_whitespace(s, ch);                 /* find the device or level */
        if (ch == '\0') {
@@ -226,17 +235,19 @@ main(
            skip_quoted_string(s, ch);
             s[-1] = '\0';                      /* terminate the device */
            qamdevice = stralloc(fp);
-           amdevice = unquote_string(qamdevice);
+           dle->device = unquote_string(qamdevice);
            skip_whitespace(s, ch);             /* find level number */
        }
        else {
-           amdevice = stralloc(disk);
+           dle->device = stralloc(dle->disk);
+           qamdevice = stralloc(qdisk);
        }
 
                                                /* find level number */
        if (ch == '\0' || sscanf(s - 1, "%d", &level) != 1) {
            goto err;                           /* bad level */
        }
+       dle->level = g_slist_append(dle->level, GINT_TO_POINTER(level));
        skip_integer(s, ch);
 
        skip_whitespace(s, ch);
@@ -248,18 +259,13 @@ main(
            optstr = s - 1;
            skip_quoted_string(s, ch);
            s[-1] = '\0';                       /* terminate the options */
-           options = parse_options(optstr, disk, amdevice, g_options->features, 1);
+           parse_options(optstr, dle, g_options->features, 1);
            /*@ignore@*/
-           check_options(program, calcprog, disk, amdevice, options);
-           check_disk(program, calcprog, disk, amdevice, level, options);
+
+           check_options(dle);
+           check_disk(dle);
+
            /*@end@*/
-           free_sl(options->exclude_file);
-           free_sl(options->exclude_list);
-           free_sl(options->include_file);
-           free_sl(options->include_list);
-           amfree(options->auth);
-           amfree(options->str);
-           amfree(options);
        } else if (ch == '\0') {
            /* check all since no option */
            need_samba=1;
@@ -277,21 +283,46 @@ main(
            need_compress_path=1;
            need_calcsize=1;
            /*@ignore@*/
-           check_disk(program, calcprog, disk, amdevice, level, NULL);
+           check_disk(dle);
            /*@end@*/
        } else {
            goto err;                           /* bad syntax */
        }
-       amfree(disk);
        amfree(qamdevice);
-       amfree(amdevice);
     }
     if (g_options == NULL) {
-       printf(_("ERROR [Missing OPTIONS line in selfcheck input]\n"));
+       g_printf(_("ERROR [Missing OPTIONS line in selfcheck input]\n"));
        error(_("Missing OPTIONS line in selfcheck input\n"));
        /*NOTREACHED*/
     }
 
+    if (am_has_feature(g_options->features, fe_req_xml)) {
+       char  *errmsg = NULL;
+       dle_t *dles, *dle;
+
+       dles = amxml_parse_node_FILE(stdin, &errmsg);
+       if (errmsg) {
+           err_extra = errmsg;
+           goto err;
+       }
+       for (dle = dles; dle != NULL; dle = dle->next) {
+           run_client_scripts(EXECUTE_ON_PRE_HOST_AMCHECK, g_options, dle,
+                              stdout);
+       }
+       for (dle = dles; dle != NULL; dle = dle->next) {
+           check_options(dle);
+           run_client_scripts(EXECUTE_ON_PRE_DLE_AMCHECK, g_options, dle,
+                              stdout);
+           check_disk(dle);
+           run_client_scripts(EXECUTE_ON_POST_DLE_AMCHECK, g_options, dle,
+                              stdout);
+       }
+       for (dle = dles; dle != NULL; dle = dle->next) {
+           run_client_scripts(EXECUTE_ON_POST_HOST_AMCHECK, g_options, dle,
+                              stdout);
+       }
+    }
+
     check_overall();
 
     amfree(line);
@@ -304,10 +335,13 @@ main(
     return 0;
 
  err:
-    g_printf(_("ERROR [BOGUS REQUEST PACKET]\n"));
-    dbprintf(_("REQ packet is bogus%s%s\n"),
-             err_extra ? ": " : "",
-             err_extra ? err_extra : "");
+    if (err_extra) {
+       g_printf(_("ERROR [FORMAT ERROR IN REQUEST PACKET %s]\n"), err_extra);
+       dbprintf(_("REQ packet is bogus: %s\n"), err_extra);
+    } else {
+       g_printf(_("ERROR [FORMAT ERROR IN REQUEST PACKET]\n"));
+       dbprintf(_("REQ packet is bogus\n"));
+    }
     dbclose();
     return 1;
 }
@@ -315,71 +349,43 @@ main(
 
 static void
 check_options(
-    char *     program,
-    char *     calcprog,
-    char *     disk,
-    char *     amdevice,
-    option_t * options)
+    dle_t *dle)
 {
-    char *myprogram = program;
-
-    if(strcmp(myprogram,"CALCSIZE") == 0) {
-       int nb_exclude = 0;
-       int nb_include = 0;
-       char *file_exclude = NULL;
-       char *file_include = NULL;
-
-       if(options->exclude_file) nb_exclude += options->exclude_file->nb_element;
-       if(options->exclude_list) nb_exclude += options->exclude_list->nb_element;
-       if(options->include_file) nb_include += options->include_file->nb_element;
-       if(options->include_list) nb_include += options->include_list->nb_element;
-
-       if(nb_exclude > 0) file_exclude = build_exclude(disk, amdevice, options, 1);
-       if(nb_include > 0) file_include = build_include(disk, amdevice, options, 1);
-
-       amfree(file_exclude);
-       amfree(file_include);
-
+    if (dle->calcsize == 1) {
        need_calcsize=1;
-       if (calcprog == NULL) {
-           g_printf(_("ERROR [no program name for calcsize]\n"));
-       } else {
-           myprogram = calcprog;
-       }
     }
 
-    if(strcmp(myprogram,"GNUTAR") == 0) {
+    if (strcmp(dle->program,"GNUTAR") == 0) {
        need_gnutar=1;
-        if(amdevice[0] == '/' && amdevice[1] == '/') {
-           if(options->exclude_file && options->exclude_file->nb_element > 1) {
+        if(dle->device[0] == '/' && dle->device[1] == '/') {
+           if(dle->exclude_file && dle->exclude_file->nb_element > 1) {
                g_printf(_("ERROR [samba support only one exclude file]\n"));
            }
-           if(options->exclude_list && options->exclude_list->nb_element > 0 &&
-              options->exclude_optional==0) {
+           if (dle->exclude_list && dle->exclude_list->nb_element > 0 &&
+               dle->exclude_optional==0) {
                g_printf(_("ERROR [samba does not support exclude list]\n"));
            }
-           if(options->include_file && options->include_file->nb_element > 0) {
+           if (dle->include_file && dle->include_file->nb_element > 0) {
                g_printf(_("ERROR [samba does not support include file]\n"));
            }
-           if(options->include_list && options->include_list->nb_element > 0 &&
-              options->include_optional==0) {
+           if (dle->include_list && dle->include_list->nb_element > 0 &&
+               dle->include_optional==0) {
                g_printf(_("ERROR [samba does not support include list]\n"));
            }
            need_samba=1;
-       }
-       else {
+       } else {
            int nb_exclude = 0;
            int nb_include = 0;
            char *file_exclude = NULL;
            char *file_include = NULL;
 
-           if(options->exclude_file) nb_exclude += options->exclude_file->nb_element;
-           if(options->exclude_list) nb_exclude += options->exclude_list->nb_element;
-           if(options->include_file) nb_include += options->include_file->nb_element;
-           if(options->include_list) nb_include += options->include_list->nb_element;
+           if (dle->exclude_file) nb_exclude += dle->exclude_file->nb_element;
+           if (dle->exclude_list) nb_exclude += dle->exclude_list->nb_element;
+           if (dle->include_file) nb_include += dle->include_file->nb_element;
+           if (dle->include_list) nb_include += dle->include_list->nb_element;
 
-           if(nb_exclude > 0) file_exclude = build_exclude(disk, amdevice, options, 1);
-           if(nb_include > 0) file_include = build_include(disk, amdevice, options, 1);
+           if (nb_exclude > 0) file_exclude = build_exclude(dle, 1);
+           if (nb_include > 0) file_include = build_include(dle, 1);
 
            amfree(file_exclude);
            amfree(file_include);
@@ -388,17 +394,17 @@ check_options(
        }
     }
 
-    if(strcmp(myprogram,"DUMP") == 0) {
-       if(options->exclude_file && options->exclude_file->nb_element > 0) {
+    if (strcmp(dle->program,"DUMP") == 0) {
+       if (dle->exclude_file && dle->exclude_file->nb_element > 0) {
            g_printf(_("ERROR [DUMP does not support exclude file]\n"));
        }
-       if(options->exclude_list && options->exclude_list->nb_element > 0) {
+       if (dle->exclude_list && dle->exclude_list->nb_element > 0) {
            g_printf(_("ERROR [DUMP does not support exclude list]\n"));
        }
-       if(options->include_file && options->include_file->nb_element > 0) {
+       if (dle->include_file && dle->include_file->nb_element > 0) {
            g_printf(_("ERROR [DUMP does not support include file]\n"));
        }
-       if(options->include_list && options->include_list->nb_element > 0) {
+       if (dle->include_list && dle->include_list->nb_element > 0) {
            g_printf(_("ERROR [DUMP does not support include list]\n"));
        }
 #ifdef USE_RUNDUMP
@@ -407,66 +413,66 @@ check_options(
 #ifndef AIX_BACKUP
 #ifdef VDUMP
 #ifdef DUMP
-       if (strcmp(amname_to_fstype(amdevice), "advfs") == 0)
+       if (strcmp(amname_to_fstype(dle->device), "advfs") == 0)
 #else
        if (1)
 #endif
        {
            need_vdump=1;
            need_rundump=1;
-           if (options->createindex)
+           if (dle->create_index)
                need_vrestore=1;
        }
        else
 #endif /* VDUMP */
 #ifdef XFSDUMP
 #ifdef DUMP
-       if (strcmp(amname_to_fstype(amdevice), "xfs") == 0)
+       if (strcmp(amname_to_fstype(dle->device), "xfs") == 0)
 #else
        if (1)
 #endif
        {
            need_xfsdump=1;
            need_rundump=1;
-           if (options->createindex)
+           if (dle->create_index)
                need_xfsrestore=1;
        }
        else
 #endif /* XFSDUMP */
 #ifdef VXDUMP
 #ifdef DUMP
-       if (strcmp(amname_to_fstype(amdevice), "vxfs") == 0)
+       if (strcmp(amname_to_fstype(dle->device), "vxfs") == 0)
 #else
        if (1)
 #endif
        {
            need_vxdump=1;
-           if (options->createindex)
+           if (dle->create-index)
                need_vxrestore=1;
        }
        else
 #endif /* VXDUMP */
        {
            need_dump=1;
-           if (options->createindex)
+           if (dle->create_index)
                need_restore=1;
        }
 #else
        /* AIX backup program */
        need_dump=1;
-       if (options->createindex)
+       if (dle->create_index)
            need_restore=1;
 #endif
     }
-    if ((options->compress == COMP_BEST) || (options->compress == COMP_FAST) 
-               || (options->compress == COMP_CUST)) {
+    if ((dle->compress == COMP_BEST) || (dle->compress == COMP_FAST) 
+               || (dle->compress == COMP_CUST)) {
        need_compress_path=1;
     }
-    if(options->auth && amandad_auth) {
-       if(strcasecmp(options->auth, amandad_auth) != 0) {
+    if (dle->auth && amandad_auth) {
+       if (strcasecmp(dle->auth, amandad_auth) != 0) {
            g_fprintf(stdout,_("ERROR [client configured for auth=%s while server requested '%s']\n"),
-                   amandad_auth, options->auth);
-           if(strcmp(options->auth, "ssh") == 0)  {    
+                   amandad_auth, dle->auth);
+           if (strcmp(dle->auth, "ssh") == 0)  {       
                g_fprintf(stderr, _("ERROR [The auth in ~/.ssh/authorized_keys "
                                  "should be \"--auth=ssh\", or use another auth "
                                  " for the DLE]\n"));
@@ -481,12 +487,7 @@ check_options(
 
 static void
 check_disk(
-    char *     program,
-    char *     calcprog,
-    char *     disk,
-    char *     amdevice,
-    int                level,
-    option_t    *options)
+    dle_t *dle)
 {
     char *device = stralloc("nodevice");
     char *err = NULL;
@@ -498,31 +499,21 @@ check_disk(
     int access_result;
     char *access_type;
     char *extra_info = NULL;
-    char *myprogram = program;
-    char *qdisk = quote_string(disk);
-    char *qamdevice = quote_string(amdevice);
+    char *qdisk = quote_string(dle->disk);
+    char *qamdevice = quote_string(dle->device);
     char *qdevice = NULL;
-    FILE *toolin;
-
-    (void)level;       /* Quiet unused parameter warning */
 
     dbprintf(_("checking disk %s\n"), qdisk);
-
-    if(strcmp(myprogram,"CALCSIZE") == 0) {
-       if(amdevice[0] == '/' && amdevice[1] == '/') {
+    if (dle->calcsize == 1) {
+       if (dle->device[0] == '/' && dle->device[1] == '/') {
            err = vstrallocf(_("Can't use CALCSIZE for samba estimate, use CLIENT: %s"),
-                           amdevice);
-           goto common_exit;
-       }
-       if (calcprog == NULL) {
-           err = _("no program for calcsize");
+                           dle->device);
            goto common_exit;
        }
-       myprogram = calcprog;
     }
 
-    if (strcmp(myprogram, "GNUTAR")==0) {
-        if(amdevice[0] == '/' && amdevice[1] == '/') {
+    if (strcmp(dle->program, "GNUTAR")==0) {
+        if(dle->device[0] == '/' && dle->device[1] == '/') {
 #ifdef SAMBA_CLIENT
            int nullfd, checkerr;
            int passwdfd;
@@ -538,23 +529,23 @@ check_disk(
            char *pw_fd_env;
            int errdos;
 
-           parsesharename(amdevice, &share, &subdir);
+           parsesharename(dle->device, &share, &subdir);
            if (!share) {
-               err = vstrallocf(_("cannot parse for share/subdir disk entry %s"), amdevice);
+               err = vstrallocf(_("cannot parse for share/subdir disk entry %s"), dle->device);
                goto common_exit;
            }
            if ((subdir) && (SAMBA_VERSION < 2)) {
                err = vstrallocf(_("subdirectory specified for share '%s' but, samba is not v2 or better"),
-                               amdevice);
+                               dle->device);
                goto common_exit;
            }
            if ((user_and_password = findpass(share, &domain)) == NULL) {
-               err = vstrallocf(_("cannot find password for %s"), amdevice);
+               err = vstrallocf(_("cannot find password for %s"), dle->device);
                goto common_exit;
            }
            lpass = strlen(user_and_password);
            if ((pwtext = strchr(user_and_password, '%')) == NULL) {
-               err = vstrallocf(_("password field not \'user%%pass\' for %s"), amdevice);
+               err = vstrallocf(_("password field not \'user%%pass\' for %s"), dle->device);
                goto common_exit;
            }
            *pwtext++ = '\0';
@@ -575,7 +566,7 @@ check_disk(
            } else {
                pw_fd_env = "dummy_PASSWD_FD";
            }
-           checkpid = pipespawn(SAMBA_CLIENT, STDERR_PIPE|PASSWD_PIPE,
+           checkpid = pipespawn(SAMBA_CLIENT, STDERR_PIPE|PASSWD_PIPE, 0,
                                 &nullfd, &nullfd, &checkerr,
                                 pw_fd_env, &passwdfd,
                                 "smbclient",
@@ -595,9 +586,9 @@ check_disk(
            aclose(nullfd);
            /*@ignore@*/
            if ((pwtext_len > 0)
-             && fullwrite(passwdfd, pwtext, (size_t)pwtext_len) < 0) {
+             && full_write(passwdfd, pwtext, pwtext_len) < pwtext_len) {
                err = vstrallocf(_("password write failed: %s: %s"),
-                               amdevice, strerror(errno));
+                               dle->device, strerror(errno));
                aclose(passwdfd);
                goto common_exit;
            }
@@ -630,7 +621,8 @@ check_disk(
            while ((wpid = wait(&retstat)) != -1) {
                if (!WIFEXITED(retstat) || WEXITSTATUS(retstat) != 0) {
                    char *exitstr = str_exit_status("smbclient", retstat);
-                   err = newvstralloc(err, err, sep, exitstr);
+                   strappend(err, sep);
+                   strappend(err, exitstr);
                    sep = "\n";
                    amfree(exitstr);
 
@@ -641,11 +633,11 @@ check_disk(
                if (extra_info) {
                    err = newvstrallocf(err,
                                   _("samba access error: %s: %s %s"),
-                                  amdevice, extra_info, err);
+                                  dle->device, extra_info, err);
                    amfree(extra_info);
                } else {
                    err = newvstrallocf(err, _("samba access error: %s: %s"),
-                                  amdevice, err);
+                                  dle->device, err);
                }
            }
 #else
@@ -656,9 +648,9 @@ check_disk(
        }
        amode = F_OK;
        amfree(device);
-       device = amname_to_dirname(amdevice);
-    } else if (strcmp(myprogram, "DUMP") == 0) {
-       if(amdevice[0] == '/' && amdevice[1] == '/') {
+       device = amname_to_dirname(dle->device);
+    } else if (strcmp(dle->program, "DUMP") == 0) {
+       if(dle->device[0] == '/' && dle->device[1] == '/') {
            err = vstrallocf(
                  _("The DUMP program cannot handle samba shares, use GNUTAR: %s"),
                  qdisk);
@@ -666,19 +658,19 @@ check_disk(
        }
 #ifdef VDUMP                                                           /* { */
 #ifdef DUMP                                                            /* { */
-        if (strcmp(amname_to_fstype(amdevice), "advfs") == 0)
+        if (strcmp(amname_to_fstype(dle->device), "advfs") == 0)
 #else                                                                  /* }{ */
        if (1)
 #endif                                                                 /* } */
        {
            amfree(device);
-           device = amname_to_dirname(amdevice);
+           device = amname_to_dirname(dle->device);
            amode = F_OK;
        } else
 #endif                                                                 /* } */
        {
            amfree(device);
-           device = amname_to_devname(amdevice);
+           device = amname_to_devname(dle->device);
 #ifdef USE_RUNDUMP
            amode = F_OK;
 #else
@@ -686,30 +678,97 @@ check_disk(
 #endif
        }
     }
-    else { /* program_is_backup_api==1 */
-       pid_t  backup_api_pid;
-       int    property_pipe[2];
+    else { /* program_is_application_api==1 */
+       pid_t                    application_api_pid;
        backup_support_option_t *bsu;
+       int                      app_err[2];
+       GPtrArray               *errarray;
+
+       bsu = backup_support_option(dle->program, g_options, dle->disk,
+                                   dle->device, &errarray);
+
+       if (!bsu) {
+           char  *line;
+           guint  i;
+           for (i=0; i < errarray->len; i++) {
+               line = g_ptr_array_index(errarray, i);
+               fprintf(stdout, _("ERROR Application '%s': %s\n"),
+                       dle->program, line);
+               amfree(line);
+           }
+           err = vstrallocf(_("Application '%s': can't run support command"),
+                            dle->program);
+           goto common_exit;
+       }
 
-       bsu = backup_support_option(program, g_options, disk, amdevice);
+       if (dle->calcsize && !bsu->calcsize) {
+           g_printf("ERROR application %s doesn't support calcsize estimate\n",
+                    dle->program);
+       }
+       if (dle->include_file && dle->include_file->nb_element > 0 &&
+           !bsu->include_file) {
+           g_printf("ERROR application %s doesn't support include-file\n",
+                  dle->program);
+       }
+       if (dle->include_list && dle->include_list->nb_element > 0 &&
+           !bsu->include_list) {
+           g_printf("ERROR application %s doesn't support include-list\n",
+                  dle->program);
+       }
+       if (dle->include_optional && !bsu->include_optional) {
+           g_printf("ERROR application %s doesn't support optional include\n",
+                  dle->program);
+       }
+       if (dle->exclude_file && dle->exclude_file->nb_element > 0 &&
+           !bsu->exclude_file) {
+           g_printf("ERROR application %s doesn't support exclude-file\n",
+                  dle->program);
+       }
+       if (dle->exclude_list && dle->exclude_list->nb_element > 0 &&
+           !bsu->exclude_list) {
+           g_printf("ERROR application %s doesn't support exclude-list\n",
+                  dle->program);
+       }
+       if (dle->exclude_optional && !bsu->exclude_optional) {
+           g_printf("ERROR application %s doesn't support optional exclude\n",
+                  dle->program);
+       }
+       fflush(stdout);fflush(stderr);
 
-       if (pipe(property_pipe) < 0) {
-           err = vstrallocf(_("pipe failed: %s"), strerror(errno));
+       if (pipe(app_err) < 0) {
+           err = vstrallocf(_("Application '%s': can't create pipe"),
+                            dle->program);
            goto common_exit;
        }
-       fflush(stdout);fflush(stderr);
-       
-       switch (backup_api_pid = fork()) {
+
+       switch (application_api_pid = fork()) {
        case -1:
            err = vstrallocf(_("fork failed: %s"), strerror(errno));
            goto common_exit;
 
        case 0: /* child */
            {
-               char *argvchild[14];
-               char *cmd = vstralloc(DUMPER_DIR, "/", program, NULL);
+               char **argvchild, **arg;
+               char *cmd = vstralloc(APPLICATION_DIR, "/", dle->program, NULL);
+               GSList   *scriptlist;
+               script_t *script;
+               char *cmdline;
                int j=0;
-               argvchild[j++] = program;
+               int k;
+
+               aclose(app_err[0]);
+               dup2(app_err[1], 2);
+
+               k = application_property_argv_size(dle);
+               for (scriptlist = dle->scriptlist; scriptlist != NULL;
+                    scriptlist = scriptlist->next) {
+                   script = (script_t *)scriptlist->data;
+                   if (script->result && script->result->proplist) {
+                       k += property_argv_size(script->result->proplist);
+                   }
+               }
+               argvchild = g_new0(char *, 18 + k);
+               argvchild[j++] = dle->program;
                argvchild[j++] = "selfcheck";
                if (bsu->message_line == 1) {
                    argvchild[j++] = "--message";
@@ -723,49 +782,76 @@ check_disk(
                    argvchild[j++] = "--host";
                    argvchild[j++] = g_options->hostname;
                }
-               if (disk != NULL && bsu->disk == 1) {
+               if (dle->disk != NULL && bsu->disk == 1) {
                    argvchild[j++] = "--disk";
-                   argvchild[j++] = disk;
+                   argvchild[j++] = dle->disk;
                }
                argvchild[j++] = "--device";
-               argvchild[j++] = amdevice;
-               if(options && options->createindex && bsu->index_line == 1) {
+               argvchild[j++] = dle->device;
+               if (dle->create_index && bsu->index_line == 1) {
                    argvchild[j++] = "--index";
                    argvchild[j++] = "line";
                }
-               if (!options->no_record && bsu->record == 1) {
+               if (dle->record && bsu->record == 1) {
                    argvchild[j++] = "--record";
                }
+               if (dle->calcsize && bsu->calcsize == 1) {
+                   argvchild[j++] = "--calcsize";
+               }
+               j += application_property_add_to_argv(&argvchild[j], dle, bsu);
+
+               for (scriptlist = dle->scriptlist; scriptlist != NULL;
+                    scriptlist = scriptlist->next) {
+                   script = (script_t *)scriptlist->data;
+                   if (script->result && script->result->proplist) {
+                       j += property_add_to_argv(&argvchild[j],
+                                                 script->result->proplist);
+                   }
+               }
+
                argvchild[j++] = NULL;
-               dup2(property_pipe[0], 0);
-               aclose(property_pipe[1]);
+
+               cmdline = stralloc(cmd);
+               for(arg = argvchild; *arg != NULL; arg++) {
+                   char *quoted = quote_string(*arg);
+                   cmdline = vstrextend(&cmdline, " ", quoted, NULL);
+                   amfree(quoted);
+               }
+               dbprintf(_("Spawning \"%s\" in pipeline\n"), cmdline);
+               amfree(cmdline);
+
                safe_fd(-1, 0);
-               execve(cmd,argvchild,safe_env());
+               execve(cmd, argvchild, safe_env());
                g_printf(_("ERROR [Can't execute %s: %s]\n"), cmd, strerror(errno));
                exit(127);
            }
        default: /* parent */
            {
-               int status;
-               aclose(property_pipe[0]);
-               toolin = fdopen(property_pipe[1],"w");
-               if (!toolin) {
-                   err = vstrallocf(_("Can't fdopen: %s"), strerror(errno));
-                   goto common_exit;
-               }
-               output_tool_property(toolin, options);
-               fflush(toolin);
-               fclose(toolin);
-               if (waitpid(backup_api_pid, &status, 0) < 0) {
-                   if (!WIFEXITED(status)) {
-                       err = vstrallocf(_("Tool exited with signal %d"),
-                                        WTERMSIG(status));
-                   } else if (WEXITSTATUS(status) != 0) {
-                       err = vstrallocf(_("Tool exited with status %d"),
-                                        WEXITSTATUS(status));
-                   } else {
-                       err = vstrallocf(_("waitpid returned negative value"));
+               int   status;
+               FILE *app_stderr;
+               char *line;
+
+               aclose(app_err[1]);
+               app_stderr = fdopen(app_err[0], "r");
+               while((line = agets(app_stderr)) != NULL) {
+                   if (strlen(line) > 0) {
+                       fprintf(stdout, "ERROR Application '%s': %s\n",
+                               dle->program, line);
+                       dbprintf("ERROR %s\n", line);
                    }
+                   amfree(line);
+               }
+               if (waitpid(application_api_pid, &status, 0) < 0) {
+                   err = vstrallocf(_("waitpid failed: %s"),
+                                        strerror(errno));
+                   goto common_exit;
+               } else if (!WIFEXITED(status)) {
+                   err = vstrallocf(_("Application '%s': exited with signal %d"),
+                                    dle->program, WTERMSIG(status));
+                   goto common_exit;
+               } else if (WEXITSTATUS(status) != 0) {
+                   err = vstrallocf(_("Application '%s': exited with status %d"),
+                                    dle->program, WEXITSTATUS(status));
                    goto common_exit;
                }
            }
@@ -801,6 +887,9 @@ check_disk(
 
 common_exit:
 
+    if (!qdevice)
+       qdevice = quote_string(device);
+
     amfree(share);
     amfree(subdir);
     if(user_and_password) {
@@ -810,7 +899,7 @@ common_exit:
     amfree(domain);
 
     if(err) {
-       g_printf(_("ERROR [%s]\n"), err);
+       g_printf(_("ERROR %s\n"), err);
        dbprintf(_("%s\n"), err);
        amfree(err);
     } else {
@@ -928,19 +1017,18 @@ check_overall(void)
 #else
        g_printf(_("ERROR [GNUTAR program not available]\n"));
 #endif
-       need_amandates = 1;
        gnutar_list_dir = getconf_str(CNF_GNUTAR_LIST_DIR);
        if (strlen(gnutar_list_dir) == 0)
            gnutar_list_dir = NULL;
-       if (gnutar_list_dir) 
+       if (gnutar_list_dir) {
+           /* make sure our listed-incremental dir is ready */
            check_dir(gnutar_list_dir, R_OK|W_OK);
+       } else {
+           /* no listed-incremental dir, so check that amandates is ready */
+           need_amandates = 1;
+       }
     }
 
-    if (need_amandates) {
-       char *amandates_file;
-       amandates_file = getconf_str(CNF_AMANDATES);
-       check_file(amandates_file, R_OK|W_OK);
-    }
     if( need_calcsize ) {
        char *cmd;
 
@@ -949,6 +1037,15 @@ check_overall(void)
        check_file(cmd, X_OK);
 
        amfree(cmd);
+
+       /* calcsize uses amandates */
+       need_amandates = 1;
+    }
+
+    if (need_amandates) {
+       char *amandates_file;
+       amandates_file = getconf_str(CNF_AMANDATES);
+       check_file(amandates_file, R_OK|W_OK);
     }
 
     if( need_samba ) {
@@ -1045,30 +1142,6 @@ check_space(
     amfree(quoted);
 }
 
-static void
-check_access(
-    char *     filename,
-    int                mode)
-{
-    char *noun, *adjective;
-    char *quoted = quote_string(filename);
-
-    if(mode == F_OK)
-        noun = "find", adjective = "exists";
-    else if((mode & X_OK) == X_OK)
-       noun = "execute", adjective = "executable";
-    else if((mode & (W_OK|R_OK)) == (W_OK|R_OK))
-       noun = "read/write", adjective = "read/writable";
-    else 
-       noun = "access", adjective = "accessible";
-
-    if(access(filename, mode) == -1)
-       g_printf(_("ERROR [can not %s %s: %s]\n"), noun, quoted, strerror(errno));
-    else
-       g_printf(_("OK %s %s\n"), quoted, adjective);
-    amfree(quoted);
-}
-
 static int
 check_file_exist(
     char *filename)
@@ -1083,66 +1156,3 @@ check_file_exist(
     return 1;
 }
 
-static void
-check_file(
-    char *     filename,
-    int                mode)
-{
-    struct stat stat_buf;
-    char *quoted;
-
-    if(!stat(filename, &stat_buf)) {
-       if(!S_ISREG(stat_buf.st_mode)) {
-           quoted = quote_string(filename);
-           g_printf(_("ERROR [%s is not a file]\n"), quoted);
-           amfree(quoted);
-       }
-    }
-    check_access(filename, mode);
-}
-
-static void
-check_dir(
-    char *     dirname,
-    int                mode)
-{
-    struct stat stat_buf;
-    char *quoted;
-    char *dir;
-
-    if(!stat(dirname, &stat_buf)) {
-       if(!S_ISDIR(stat_buf.st_mode)) {
-           quoted = quote_string(dirname);
-           g_printf(_("ERROR [%s is not a directory]\n"), quoted);
-           amfree(quoted);
-       }
-    }
-    dir = stralloc2(dirname, "/.");
-    check_access(dir, mode);
-    amfree(dir);
-}
-
-static void
-check_suid(
-    char *     filename)
-{
-#ifndef SINGLE_USERID
-    struct stat stat_buf;
-    char *quoted = quote_string(filename);
-
-    if(!stat(filename, &stat_buf)) {
-       if(stat_buf.st_uid != 0 ) {
-           g_printf(_("ERROR [%s is not owned by root]\n"), quoted);
-       }
-       if((stat_buf.st_mode & S_ISUID) != S_ISUID) {
-           g_printf(_("ERROR [%s is not SUID root]\n"), quoted);
-       }
-    }
-    else {
-       g_printf(_("ERROR [can not stat %s]\n"), quoted);
-    }
-    amfree(quoted);
-#else
-    (void)filename;    /* Quiet unused parameter warning */
-#endif
-}
index 1ec5a7fb2321a0f8977b6739b726639299870eaf..b0a8ec7ec236a66bc2755f0e30c960629dc840da 100644 (file)
@@ -116,9 +116,9 @@ static amregex_t re_table[] = {
   AM_STRANGE_RE(NULL)
 };
 
-static void start_backup(char *host, char *disk, char *amdevice, int level,
-               char *dumpdate, int dataf, int mesgf, int indexf);
-static void end_backup(int status);
+static void start_backup(dle_t *dle, char *host,
+                        int dataf, int mesgf, int indexf);
+static void end_backup(dle_t *dle, int status);
 
 /*
  *  doing similar to $ dump | compression | encryption
@@ -126,11 +126,8 @@ static void end_backup(int status);
 
 static void
 start_backup(
-    char *     host,
-    char *     disk,
-    char *     amdevice,
-    int                level,
-    char *     dumpdate,
+    dle_t      *dle,
+    char       *host,
     int                dataf,
     int                mesgf,
     int                indexf)
@@ -148,23 +145,21 @@ start_backup(
     char *qdisk;
     char *config;
 
-    (void)dumpdate;    /* Quiet unused parameter warning */
+    g_snprintf(level_str, SIZEOF(level_str), "%d", GPOINTER_TO_INT(dle->level->data));
 
-    g_snprintf(level_str, SIZEOF(level_str), "%d", level);
-
-    qdisk = quote_string(disk);
-    dbprintf(_("start: %s:%s lev %d\n"), host, qdisk, level);
+    qdisk = quote_string(dle->disk);
+    dbprintf(_("start: %s:%s lev %d\n"), host, qdisk, GPOINTER_TO_INT(dle->level->data));
 
     g_fprintf(stderr, _("%s: start [%s:%s level %d]\n"),
-           get_pname(), host, qdisk, level);
+           get_pname(), host, qdisk, GPOINTER_TO_INT(dle->level->data));
     amfree(qdisk);
 
     /*  apply client-side encryption here */
-    if ( options->encrypt == ENCRYPT_CUST ) {
-        encpid = pipespawn(options->clnt_encrypt, STDIN_PIPE,
-                       &compout, &dataf, &mesgf,
-                       options->clnt_encrypt, encryptopt, NULL);
-        dbprintf(_("gnutar: pid %ld: %s\n"), (long)encpid, options->clnt_encrypt);
+    if (dle->encrypt == ENCRYPT_CUST ) {
+        encpid = pipespawn(dle->clnt_encrypt, STDIN_PIPE, 0,
+                          &compout, &dataf, &mesgf,
+                          dle->clnt_encrypt, encryptopt, NULL);
+        dbprintf(_("gnutar: pid %ld: %s\n"), (long)encpid, dle->clnt_encrypt);
     } else {
         compout = dataf;
         encpid = -1;
@@ -172,17 +167,17 @@ start_backup(
     /*  now do the client-side compression */
 
 
-    if(options->compress == COMP_FAST || options->compress == COMP_BEST) {
+    if(dle->compress == COMP_FAST || dle->compress == COMP_BEST) {
        compopt = skip_argument;
 
 #if defined(COMPRESS_BEST_OPT) && defined(COMPRESS_FAST_OPT)
-       if(options->compress == COMP_BEST) {
+       if(dle->compress == COMP_BEST) {
            compopt = COMPRESS_BEST_OPT;
        } else {
            compopt = COMPRESS_FAST_OPT;
        }
 #endif
-       comppid = pipespawn(COMPRESS_PATH, STDIN_PIPE,
+       comppid = pipespawn(COMPRESS_PATH, STDIN_PIPE, 0,
                            &dumpout, &compout, &mesgf,
                            COMPRESS_PATH, compopt, NULL);
        dbprintf(_("dump: pid %ld: %s"), (long)comppid, COMPRESS_PATH);
@@ -190,13 +185,13 @@ start_backup(
            dbprintf(" %s", compopt);
        }
        dbprintf("\n");
-     } else if (options->compress == COMP_CUST) {
+     } else if (dle->compress == COMP_CUST) {
         compopt = skip_argument;
-       comppid = pipespawn(options->clntcompprog, STDIN_PIPE,
+       comppid = pipespawn(dle->compprog, STDIN_PIPE, 0,
                            &dumpout, &compout, &mesgf,
-                           options->clntcompprog, compopt, NULL);
+                           dle->compprog, compopt, NULL);
        dbprintf(_("gnutar-cust: pid %ld: %s"),
-               (long)comppid, options->clntcompprog);
+               (long)comppid, dle->compprog);
        if(compopt != skip_argument) {
            dbprintf(" %s", compopt);
        }
@@ -207,8 +202,8 @@ start_backup(
     }
 
     /* invoke dump */
-    device = amname_to_devname(amdevice);
-    fstype = amname_to_fstype(amdevice);
+    device = amname_to_devname(dle->device);
+    fstype = amname_to_fstype(dle->device);
 
     dbprintf(_("dumping device '%s' with '%s'\n"), device, fstype);
 
@@ -229,7 +224,7 @@ start_backup(
     /* normal dump */
 #ifdef XFSDUMP                                         /* { */
 #ifdef DUMP                                            /* { */
-    if (strcmp(amname_to_fstype(amdevice), "xfs") == 0)
+    if (strcmp(amname_to_fstype(dle->device), "xfs") == 0)
 #else                                                  /* } { */
     if (1)
 #endif                                                 /* } */
@@ -253,16 +248,16 @@ start_backup(
                             " | sed",
                             " -e", " \'s/^/\\//\'",
                             NULL);
-       info_tapeheader();
+       info_tapeheader(dle);
 
-       start_index(options->createindex, dumpout, mesgf, indexf, indexcmd);
+       start_index(dle->create_index, dumpout, mesgf, indexf, indexcmd);
 
        dumpkeys = stralloc(level_str);
-       dumppid = pipespawn(progname, STDIN_PIPE,
+       dumppid = pipespawn(progname, STDIN_PIPE, 0,
                            &dumpin, &dumpout, &mesgf,
                            cmdX, config,
                            "xfsdump",
-                           options->no_record ? "-J" : skip_argument,
+                           !dle->record ? "-J" : skip_argument,
                            "-F",
                            "-l", dumpkeys,
                            "-",
@@ -273,7 +268,7 @@ start_backup(
 #endif                                                 /* } */
 #ifdef VXDUMP                                          /* { */
 #ifdef DUMP
-    if (strcmp(amname_to_fstype(amdevice), "vxfs") == 0)
+    if (strcmp(amname_to_fstype(dle->device), "vxfs") == 0)
 #else
     if (1)
 #endif
@@ -295,7 +290,7 @@ start_backup(
        program->restore_name = VXRESTORE;
 
        dumpkeys = vstralloc(level_str,
-                            options->no_record ? "" : "u",
+                            !dle->record ? "" : "u",
                             "s",
                             "f",
                             NULL);
@@ -306,11 +301,11 @@ start_backup(
                             " | ",
                             LEAF_AND_DIRS,
                             NULL);
-       info_tapeheader();
+       info_tapeheader(dle);
 
-       start_index(options->createindex, dumpout, mesgf, indexf, indexcmd);
+       start_index(dle->create_index, dumpout, mesgf, indexf, indexcmd);
 
-       dumppid = pipespawn(progname, STDIN_PIPE,
+       dumppid = pipespawn(progname, STDIN_PIPE, 0,
                            &dumpin, &dumpout, &mesgf, 
                            cmdX, config,
                            "vxdump",
@@ -325,7 +320,7 @@ start_backup(
 
 #ifdef VDUMP                                           /* { */
 #ifdef DUMP
-    if (strcmp(amname_to_fstype(amdevice), "advfs") == 0)
+    if (strcmp(amname_to_fstype(dle->device), "advfs") == 0)
 #else
     if (1)
 #endif
@@ -337,12 +332,12 @@ start_backup(
            config = g_options->config;
        else
            config = "NOCONFIG";
-       device = newstralloc(device, amname_to_dirname(amdevice));
+       device = newstralloc(device, amname_to_dirname(dle->device));
        program->backup_name  = VDUMP;
        program->restore_name = VRESTORE;
 
        dumpkeys = vstralloc(level_str,
-                            options->no_record ? "" : "u",
+                            !dle->record ? "" : "u",
                             "b",
                             "f",
                             NULL);
@@ -353,11 +348,11 @@ start_backup(
                             " | ",
                             "sed -e \'\n/^\\./ {\ns/^\\.//\ns/, [0-9]*$//\ns/^\\.//\ns/ @-> .*$//\nt\n}\nd\n\'",
                             NULL);
-       info_tapeheader();
+       info_tapeheader(dle);
 
-       start_index(options->createindex, dumpout, mesgf, indexf, indexcmd);
+       start_index(dle->create-index, dumpout, mesgf, indexf, indexcmd);
 
-       dumppid = pipespawn(cmd, STDIN_PIPE,
+       dumppid = pipespawn(cmd, STDIN_PIPE, 0,
                            &dumpin, &dumpout, &mesgf, 
                            cmdX, config,
                            "vdump",
@@ -380,8 +375,20 @@ start_backup(
 #else
 #  define PARAM_HONOR_NODUMP ""
 #endif
+
+#ifdef __FreeBSD__
+# if defined(__FreeBSD_version) && (__FreeBSD_version >= 500043)
+#  define FREEBSD_EXTRA_KEYS "bL"
+# else
+#  define FREEBSD_EXTRA_KEYS "b"
+# endif
+#else
+# define FREEBSD_EXTRA_KEYS ""
+#endif
+
        dumpkeys = vstralloc(level_str,
-                            options->no_record ? "" : "u",
+                            !dle->record ? "" : "u",
+                            FREEBSD_EXTRA_KEYS,
                             "s",
                             PARAM_HONOR_NODUMP,
                             "f",
@@ -394,15 +401,18 @@ start_backup(
                             " | ",
                             LEAF_AND_DIRS,
                             NULL);
-       info_tapeheader();
+       info_tapeheader(dle);
 
-       start_index(options->createindex, dumpout, mesgf, indexf, indexcmd);
+       start_index(dle->create_index, dumpout, mesgf, indexf, indexcmd);
 
-       dumppid = pipespawn(cmd, STDIN_PIPE,
+       dumppid = pipespawn(cmd, STDIN_PIPE, 0,
                            &dumpin, &dumpout, &mesgf, 
                            cmdX, config,
                            "dump",
                            dumpkeys,
+#ifdef __FreeBSD__
+                           "64",
+#endif
                            "1048576",
 #ifdef HAVE_HONOR_NODUMP
                            "0",
@@ -415,7 +425,7 @@ start_backup(
     /* AIX backup program */
     dumpkeys = vstralloc("-",
                         level_str,
-                        options->no_record ? "" : "u",
+                        !dle->record ? "" : "u",
                         "f",
                         NULL);
 
@@ -426,11 +436,11 @@ start_backup(
                         " | ",
                         LEAF_AND_DIRS,
                         NULL);
-    info_tapeheader();
+    info_tapeheader(dle);
 
-    start_index(options->createindex, dumpout, mesgf, indexf, indexcmd);
+    start_index(dle->create_index, dumpout, mesgf, indexf, indexcmd);
 
-    dumppid = pipespawn(cmd, STDIN_PIPE,
+    dumppid = pipespawn(cmd, STDIN_PIPE, 0,
                        &dumpin, &dumpout, &mesgf, 
                        cmdX, config,
                        "backup",
@@ -453,14 +463,16 @@ start_backup(
     aclose(compout);
     aclose(dataf);
     aclose(mesgf);
-    if (options->createindex)
+    if (dle->create_index)
        aclose(indexf);
 }
 
 static void
 end_backup(
+    dle_t      *dle,
     int                status)
 {
+    (void)dle;
     (void)status;      /* Quiet unused parameter warning */
 
     /* don't need to do anything for dump */
index c11b55c5a65947ea1984fba7b4ab7274c3f7aa54..4439f308b12079c1fb4a0ae5441a55cdcc5b12be 100644 (file)
@@ -126,17 +126,13 @@ time_t cur_dumptime;
 
 static char *gnutar_list_dir = NULL;
 static char *incrname = NULL;
-static char *amandates_file;
 /*
  *  doing similar to $ gtar | compression | encryption 
  */
 static void
 start_backup(
-    char *     host,
-    char *     disk,
-    char *     amdevice,
-    int                level,
-    char *     dumpdate,
+    dle_t      *dle,
+    char       *host,
     int                dataf,
     int                mesgf,
     int                indexf)
@@ -147,10 +143,10 @@ start_backup(
     char *indexcmd = NULL;
     char *dirname = NULL;
     int l;
-    char dumptimestr[80];
+    char dumptimestr[80] = "UNUSED";
     struct tm *gmtm;
-    amandates_t *amdates;
-    time_t prev_dumptime;
+    amandates_t *amdates = NULL;
+    time_t prev_dumptime = 0;
     char *error_pn = NULL;
     char *compopt  = NULL;
     char *encryptopt = skip_argument;
@@ -160,38 +156,37 @@ start_backup(
     int infd, outfd;
     ssize_t nb;
     char buf[32768];
-
-    (void)dumpdate;    /* Quiet unused parameter warning */
+    char *amandates_file = NULL;
 
     error_pn = stralloc2(get_pname(), "-smbclient");
 
-    qdisk = quote_string(disk);
-    dbprintf(_("start: %s:%s lev %d\n"), host, qdisk, level);
+    qdisk = quote_string(dle->disk);
+    dbprintf(_("start: %s:%s lev %d\n"), host, qdisk, GPOINTER_TO_INT(dle->level->data));
 
     g_fprintf(stderr, _("%s: start [%s:%s level %d]\n"),
-           get_pname(), host, qdisk, level);
+           get_pname(), host, qdisk, GPOINTER_TO_INT(dle->level->data));
 
      /*  apply client-side encryption here */
-     if ( options->encrypt == ENCRYPT_CUST ) {
-         encpid = pipespawn(options->clnt_encrypt, STDIN_PIPE,
+     if ( dle->encrypt == ENCRYPT_CUST ) {
+         encpid = pipespawn(dle->clnt_encrypt, STDIN_PIPE, 0, 
                        &compout, &dataf, &mesgf, 
-                       options->clnt_encrypt, encryptopt, NULL);
-         dbprintf(_("gnutar: pid %ld: %s\n"), (long)encpid, options->clnt_encrypt);
+                       dle->clnt_encrypt, encryptopt, NULL);
+         dbprintf(_("gnutar: pid %ld: %s\n"), (long)encpid, dle->clnt_encrypt);
     } else {
        compout = dataf;
        encpid = -1;
     } 
      /*  now do the client-side compression */
-    if(options->compress == COMP_FAST || options->compress == COMP_BEST) {
+    if(dle->compress == COMP_FAST || dle->compress == COMP_BEST) {
           compopt = skip_argument;
 #if defined(COMPRESS_BEST_OPT) && defined(COMPRESS_FAST_OPT)
-       if(options->compress == COMP_BEST) {
+       if(dle->compress == COMP_BEST) {
            compopt = COMPRESS_BEST_OPT;
        } else {
            compopt = COMPRESS_FAST_OPT;
        }
 #endif
-       comppid = pipespawn(COMPRESS_PATH, STDIN_PIPE,
+       comppid = pipespawn(COMPRESS_PATH, STDIN_PIPE, 0,
                            &dumpout, &compout, &mesgf,
                            COMPRESS_PATH, compopt, NULL);
        dbprintf(_("gnutar: pid %ld: %s"), (long)comppid, COMPRESS_PATH);
@@ -201,16 +196,16 @@ start_backup(
        } else {
            dbprintf(_("pid %ld: %s\n"), (long)comppid, COMPRESS_PATH);
        }
-     } else if (options->compress == COMP_CUST) {
+     } else if (dle->compress == COMP_CUST) {
         compopt = skip_argument;
-       comppid = pipespawn(options->clntcompprog, STDIN_PIPE,
+       comppid = pipespawn(dle->compprog, STDIN_PIPE, 0,
                            &dumpout, &compout, &mesgf,
-                           options->clntcompprog, compopt, NULL);
+                           dle->compprog, compopt, NULL);
        if(compopt != skip_argument) {
            dbprintf(_("pid %ld: %s %s\n"),
-                    (long)comppid, options->clntcompprog, compopt);
+                    (long)comppid, dle->compprog, compopt);
        } else {
-           dbprintf(_("pid %ld: %s\n"), (long)comppid, options->clntcompprog);
+           dbprintf(_("pid %ld: %s\n"), (long)comppid, dle->compprog);
        }
     } else {
        dumpout = compout;
@@ -222,7 +217,7 @@ start_backup(
        gnutar_list_dir = NULL;
 
 #ifdef SAMBA_CLIENT                                                    /* { */
-    if (amdevice[0] == '/' && amdevice[1]=='/')
+    if (dle->device[0] == '/' && dle->device[1]=='/')
        amfree(incrname);
     else
 #endif                                                                 /* } */
@@ -231,7 +226,7 @@ start_backup(
        char number[NUM_STR_SIZE];
        char *inputname = NULL;
        int baselevel;
-       char *sdisk = sanitise_filename(disk);
+       char *sdisk = sanitise_filename(dle->disk);
 
        basename = vstralloc(gnutar_list_dir,
                             "/",
@@ -240,7 +235,7 @@ start_backup(
                             NULL);
        amfree(sdisk);
 
-       g_snprintf(number, SIZEOF(number), "%d", level);
+       g_snprintf(number, SIZEOF(number), "%d", GPOINTER_TO_INT(dle->level->data));
        incrname = vstralloc(basename, "_", number, ".new", NULL);
        unlink(incrname);
 
@@ -249,7 +244,7 @@ start_backup(
         * backward until one is found.  If none are found (which will also
         * be true for a level 0), arrange to read from /dev/null.
         */
-       baselevel = level;
+       baselevel = GPOINTER_TO_INT(dle->level->data);
        infd = -1;
        while (infd == -1) {
            if (--baselevel >= 0) {
@@ -283,7 +278,7 @@ start_backup(
        }
 
        while ((nb = read(infd, &buf, SIZEOF(buf))) > 0) {
-           if (fullwrite(outfd, &buf, (size_t)nb) < nb) {
+           if (full_write(outfd, &buf, (size_t)nb) < (size_t)nb) {
                error(_("error [writing to '%s': %s]"), incrname,
                       strerror(errno));
                /*NOTREACHED*/
@@ -308,50 +303,51 @@ start_backup(
        if(baselevel >= 0) {
            fquoted = quote_string(inputname);
            dbprintf(_("doing level %d dump as listed-incremental from '%s' to '%s'\n"),
-                    level, fquoted, tquoted);
+                    GPOINTER_TO_INT(dle->level->data), fquoted, tquoted);
            amfree(fquoted);
        } else {
            dbprintf(_("doing level %d dump as listed-incremental to '%s'\n"),
-                    level, tquoted);
+                    GPOINTER_TO_INT(dle->level->data), tquoted);
        }
        amfree(tquoted);
        amfree(inputname);
        amfree(basename);
-    }
-
-    /* find previous dump time */
+    } else {
+       /* no gnutar-listdir, so we're using amandates */
 
-    amandates_file = getconf_str(CNF_AMANDATES);
-    if(!start_amandates(amandates_file, 0)) {
-       error(_("error [opening %s: %s]"), amandates_file, strerror(errno));
-       /*NOTREACHED*/
-    }
+       /* find previous dump time, failing completely if there's a problem */
+       amandates_file = getconf_str(CNF_AMANDATES);
+       if(!start_amandates(amandates_file, 0)) {
+           error(_("error [opening %s: %s]"), amandates_file, strerror(errno));
+           /*NOTREACHED*/
+       }
 
-    amdates = amandates_lookup(disk);
+       amdates = amandates_lookup(dle->disk);
 
-    prev_dumptime = EPOCH;
-    for(l = 0; l < level; l++) {
-       if(amdates->dates[l] > prev_dumptime)
-           prev_dumptime = amdates->dates[l];
-    }
+       prev_dumptime = EPOCH;
+       for(l = 0; l < GPOINTER_TO_INT(dle->level->data); l++) {
+           if(amdates->dates[l] > prev_dumptime)
+               prev_dumptime = amdates->dates[l];
+       }
 
-    finish_amandates();
-    free_amandates();
+       finish_amandates();
+       free_amandates();
 
-    gmtm = gmtime(&prev_dumptime);
-    g_snprintf(dumptimestr, SIZEOF(dumptimestr),
-               "%04d-%02d-%02d %2d:%02d:%02d GMT",
-               gmtm->tm_year + 1900, gmtm->tm_mon+1, gmtm->tm_mday,
-               gmtm->tm_hour, gmtm->tm_min, gmtm->tm_sec);
+       gmtm = gmtime(&prev_dumptime);
+       g_snprintf(dumptimestr, SIZEOF(dumptimestr),
+                   "%04d-%02d-%02d %2d:%02d:%02d GMT",
+                   gmtm->tm_year + 1900, gmtm->tm_mon+1, gmtm->tm_mday,
+                   gmtm->tm_hour, gmtm->tm_min, gmtm->tm_sec);
 
-    dbprintf(_("gnutar: doing level %d dump from date: %s\n"),
-             level, dumptimestr);
+       dbprintf(_("gnutar: doing level %d dump from amandates-derived date: %s\n"),
+                 GPOINTER_TO_INT(dle->level->data), dumptimestr);
+    }
 
-    dirname = amname_to_dirname(amdevice);
+    dirname = amname_to_dirname(dle->device);
 
     cur_dumptime = time(0);
-    cur_level = level;
-    cur_disk = stralloc(disk);
+    cur_level = GPOINTER_TO_INT(dle->level->data);
+    cur_disk = stralloc(dle->disk);
 #ifdef GNUTAR
 #  define PROGRAM_GNUTAR GNUTAR
 #else
@@ -367,7 +363,7 @@ start_backup(
 
 #ifdef SAMBA_CLIENT                                                    /* { */
     /* Use sambatar if the disk to back up is a PC disk */
-    if (amdevice[0] == '/' && amdevice[1]=='/') {
+    if (dle->device[0] == '/' && dle->device[1]=='/') {
        char *sharename = NULL, *user_and_password = NULL, *domain = NULL;
        char *share = NULL, *subdir = NULL;
        char *pwtext = NULL;
@@ -377,7 +373,7 @@ start_backup(
        size_t pwtext_len;
        char *pw_fd_env;
 
-       parsesharename(amdevice, &share, &subdir);
+       parsesharename(dle->device, &share, &subdir);
        if (!share) {
            amfree(share);
            amfree(subdir);
@@ -433,16 +429,16 @@ start_backup(
        }
 
        taropt = stralloc("-T");
-       if(options->exclude_file && options->exclude_file->nb_element == 1) {
+       if(dle->exclude_file && dle->exclude_file->nb_element == 1) {
            strappend(taropt, "X");
        }
 #if SAMBA_VERSION >= 2
        strappend(taropt, "q");
 #endif
        strappend(taropt, "c");
-       if (level != 0) {
+       if (GPOINTER_TO_INT(dle->level->data) != 0) {
            strappend(taropt, "g");
-       } else if (!options->no_record) {
+       } else if (dle->record) {
            strappend(taropt, "a");
        }
 
@@ -454,16 +450,16 @@ start_backup(
 
        program->backup_name = program->restore_name = SAMBA_CLIENT;
        cmd = stralloc(program->backup_name);
-       info_tapeheader();
+       info_tapeheader(dle);
 
-       start_index(options->createindex, dumpout, mesgf, indexf, indexcmd);
+       start_index(dle->create_index, dumpout, mesgf, indexf, indexcmd);
 
        if (pwtext_len > 0) {
            pw_fd_env = "PASSWD_FD";
        } else {
            pw_fd_env = "dummy_PASSWD_FD";
        }
-       dumppid = pipespawn(cmd, STDIN_PIPE|PASSWD_PIPE,
+       dumppid = pipespawn(cmd, STDIN_PIPE|PASSWD_PIPE, 0,
                            &dumpin, &dumpout, &mesgf,
                            pw_fd_env, &passwdf,
                            "smbclient",
@@ -480,13 +476,13 @@ start_backup(
                            "-d0",
                            taropt,
                            "-",
-                           options->exclude_file && options->exclude_file->nb_element == 1 ? options->exclude_file->first->name : skip_argument,
+                           dle->exclude_file && dle->exclude_file->nb_element == 1 ? dle->exclude_file->first->name : skip_argument,
                            NULL);
        if(domain) {
            memset(domain, '\0', strlen(domain));
            amfree(domain);
        }
-       if(pwtext_len > 0 && fullwrite(passwdf, pwtext, pwtext_len) < 0) {
+       if(pwtext_len > 0 && full_write(passwdf, pwtext, pwtext_len) < pwtext_len) {
            int save_errno = errno;
 
            aclose(passwdf);
@@ -516,20 +512,20 @@ start_backup(
        char *file_exclude = NULL;
        char *file_include = NULL;
 
-       if(options->exclude_file) nb_exclude+=options->exclude_file->nb_element;
-       if(options->exclude_list) nb_exclude+=options->exclude_list->nb_element;
-       if(options->include_file) nb_include+=options->include_file->nb_element;
-       if(options->include_list) nb_include+=options->include_list->nb_element;
+       if (dle->exclude_file) nb_exclude+=dle->exclude_file->nb_element;
+       if (dle->exclude_list) nb_exclude+=dle->exclude_list->nb_element;
+       if (dle->include_file) nb_include+=dle->include_file->nb_element;
+       if (dle->include_list) nb_include+=dle->include_list->nb_element;
 
-       if(nb_exclude > 0) file_exclude = build_exclude(disk, amdevice, options, 0);
-       if(nb_include > 0) file_include = build_include(disk, amdevice, options, 0);
+       if (nb_exclude > 0) file_exclude = build_exclude(dle, 0);
+       if (nb_include > 0) file_include = build_include(dle, 0);
 
        my_argv = alloc(SIZEOF(char *) * (22 + (nb_exclude*2)+(nb_include*2)));
 
        cmd = vstralloc(amlibexecdir, "/", "runtar", versionsuffix(), NULL);
-       info_tapeheader();
+       info_tapeheader(dle);
 
-       start_index(options->createindex, dumpout, mesgf, indexf, indexcmd);
+       start_index(dle->create_index, dumpout, mesgf, indexf, indexcmd);
 
         my_argv[i++] = "runtar";
        if (g_options->config)
@@ -581,7 +577,7 @@ start_backup(
            my_argv[i++] = ".";
        }
        my_argv[i++] = NULL;
-       dumppid = pipespawnv(cmd, STDIN_PIPE,
+       dumppid = pipespawnv(cmd, STDIN_PIPE, 0,
                             &dumpin, &dumpout, &mesgf, my_argv);
        tarpid = dumppid;
        amfree(file_exclude);
@@ -603,15 +599,18 @@ start_backup(
     aclose(compout);
     aclose(dataf);
     aclose(mesgf);
-    if (options->createindex)
+    if (dle->create_index)
        aclose(indexf);
 }
 
 static void
 end_backup(
+    dle_t      *dle,
     int                goterror)
 {
-    if(!options->no_record && !goterror) {
+    char *amandates_file = NULL;
+
+    if(dle->record && !goterror) {
        if (incrname != NULL && strlen(incrname) > 4) {
            char *nodotnew;
        
@@ -625,14 +624,22 @@ end_backup(
            amfree(incrname);
        }
 
-        if(!start_amandates(amandates_file, 1)) {
-           g_fprintf(stderr, _("%s: warning [opening %s: %s]"), get_pname(),
-                   amandates_file, strerror(errno));
-       }
-       else {
+       /* update the amandates file */
+       amandates_file = getconf_str(CNF_AMANDATES);
+       if(start_amandates(amandates_file, 1)) {
            amandates_updateone(cur_disk, cur_level, cur_dumptime);
            finish_amandates();
            free_amandates();
+       } else {
+           /* failure is only fatal if we didn't get a gnutar-listdir */
+           char *gnutar_list_dir = getconf_str(CNF_GNUTAR_LIST_DIR);
+           if (!gnutar_list_dir || !*gnutar_list_dir) {
+               error(_("error [opening %s for writing: %s]"), amandates_file, strerror(errno));
+               /* NOTREACHED */
+           } else {
+               g_debug(_("non-fatal error opening '%s' for writing: %s]"),
+                       amandates_file, strerror(errno));
+           }
        }
     }
 }
index 9f26dafe2e2d3ccf02db171a2da62cc57d227b12..6da1326a86a7a28ff4941f98af9c25cc3662a17a 100644 (file)
@@ -39,6 +39,7 @@
 #include "getfsent.h"
 #include "version.h"
 #include "conffile.h"
+#include "amandates.h"
 
 #define sendbackup_debug(i, ...) do {  \
        if ((i) <= debug_sendbackup) {  \
@@ -53,18 +54,19 @@ pid_t dumppid = (pid_t)-1;
 pid_t tarpid = (pid_t)-1;
 pid_t encpid = (pid_t)-1;
 pid_t indexpid = (pid_t)-1;
+pid_t application_api_pid = (pid_t)-1;
 char *errorstr = NULL;
 
 int datafd;
 int mesgfd;
 int indexfd;
 
-option_t *options;
 g_option_t *g_options = NULL;
 
 long dump_size = -1;
 
 backup_program_t *program = NULL;
+dle_t *gdle = NULL;
 
 static am_feature_t *our_features = NULL;
 static char *our_feature_string = NULL;
@@ -72,110 +74,38 @@ static char *amandad_auth = NULL;
 
 /* local functions */
 int main(int argc, char **argv);
-char *optionstr(option_t *options);
 char *childstr(pid_t pid);
-int check_status(pid_t pid, amwait_t w);
+int check_status(pid_t pid, amwait_t w, int mesgfd);
 
 pid_t pipefork(void (*func)(void), char *fname, int *stdinfd,
                int stdoutfd, int stderrfd);
-void parse_backup_messages(int mesgin);
+int check_result(int mesgfd);
+void parse_backup_messages(dle_t *dle, int mesgin);
 static void process_dumpline(char *str);
 static void save_fd(int *, int);
-void backup_api_info_tapeheader(int mesgfd, char *prog, option_t *options);
+void application_api_info_tapeheader(int mesgfd, char *prog, dle_t *dle);
 
-double the_num(char *str, int pos);
+int fdprintf(int fd, char *format, ...) G_GNUC_PRINTF(2, 3);
 
-
-char *
-optionstr(
-    option_t * options)
+int
+fdprintf(
+    int   fd,
+    char *format,
+    ...)
 {
-    static char *optstr = NULL;
-    char *compress_opt;
-    char *encrypt_opt;
-    char *decrypt_opt;
-    char *record_opt = "";
-    char *index_opt = "";
-    char *auth_opt;
-    char *exclude_file_opt;
-    char *exclude_list_opt;
-    char *exc = NULL;
-    sle_t *excl;
-
-    if(options->compress == COMP_BEST)
-       compress_opt = stralloc("compress-best;");
-    else if(options->compress == COMP_FAST)
-       compress_opt = stralloc("compress-fast;");
-    else if(options->compress == COMP_SERVER_BEST)
-       compress_opt = stralloc("srvcomp-best;");
-    else if(options->compress == COMP_SERVER_FAST)
-       compress_opt = stralloc("srvcomp-fast;");
-    else if(options->compress == COMP_SERVER_CUST)
-       compress_opt = vstralloc("srvcomp-cust=", options->srvcompprog, ";", NULL);
-    else if(options->compress == COMP_CUST)
-       compress_opt = vstralloc("comp-cust=", options->clntcompprog, ";", NULL);
-    else
-       compress_opt = stralloc("");
-    
-    if(options->encrypt == ENCRYPT_CUST) {
-      encrypt_opt = vstralloc("encrypt-cust=", options->clnt_encrypt, ";", NULL);
-      if (options->clnt_decrypt_opt)
-       decrypt_opt = vstralloc("client-decrypt-option=", options->clnt_decrypt_opt, ";", NULL);
-      else
-       decrypt_opt = stralloc("");
-    }
-    else if(options->encrypt == ENCRYPT_SERV_CUST) {
-      encrypt_opt = vstralloc("encrypt-serv-cust=", options->srv_encrypt, ";", NULL);
-      if(options->srv_decrypt_opt)
-       decrypt_opt = vstralloc("server-decrypt-option=", options->srv_decrypt_opt, ";", NULL);
-      else
-       decrypt_opt = stralloc("");
-    }
-    else {
-       encrypt_opt = stralloc("");
-       decrypt_opt = stralloc("");
-    }
+    va_list  argp;
+    char    *s;
+    int      r;
 
-    if(options->no_record) record_opt = "no-record;";
-    if(options->auth) auth_opt = vstralloc("auth=", options->auth, ";", NULL);
-       else auth_opt = stralloc("");
-    if(options->createindex) index_opt = "index;";
+    arglist_start(argp, format);
+    s = g_strdup_vprintf(format, argp);
+    arglist_end(argp);
 
-    exclude_file_opt = stralloc("");
-    if(options->exclude_file) {
-       for(excl = options->exclude_file->first; excl != NULL; excl=excl->next){
-           exc = newvstralloc(exc, "exclude-file=", excl->name, ";", NULL);
-           strappend(exclude_file_opt, exc);
-       }
-    }
-    exclude_list_opt = stralloc("");
-    if(options->exclude_list) {
-       for(excl = options->exclude_list->first; excl != NULL; excl=excl->next){
-           exc = newvstralloc(exc, "exclude-list=", excl->name, ";", NULL);
-           strappend(exclude_list_opt, exc);
-       }
-    }
-    amfree(exc);
-    optstr = newvstralloc(optstr,
-                         compress_opt,
-                         encrypt_opt,
-                         decrypt_opt,
-                         record_opt,
-                         index_opt,
-                         auth_opt,
-                         exclude_file_opt,
-                         exclude_list_opt,
-                         NULL);
-    amfree(compress_opt);
-    amfree(encrypt_opt);
-    amfree(decrypt_opt);
-    amfree(auth_opt);
-    amfree(exclude_file_opt);
-    amfree(exclude_list_opt);
-    return optstr;
+    r = full_write(fd, s, strlen(s));
+    amfree(s);
+    return r;
 }
 
-
 int
 main(
     int                argc,
@@ -184,22 +114,19 @@ main(
     int interactive = 0;
     int level = 0;
     int mesgpipe[2];
-    char *prog, *dumpdate, *stroptions;
-    int program_is_backup_api;
-    char *disk = NULL;
+    dle_t *dle = NULL;
+    char *dumpdate, *stroptions;
     char *qdisk = NULL;
-    char *amdevice = NULL;
     char *qamdevice = NULL;
     char *line = NULL;
     char *err_extra = NULL;
     char *s;
     int i;
     int ch;
-    FILE *toolin;
-    int status;
+    GSList *errlist;
+    FILE   *mesgstream;
 
     /* initialize */
-
     /*
      * Configure program for internationalization:
      *   1) Only set the message locale for now.
@@ -242,6 +169,7 @@ main(
     our_feature_string = am_feature_to_string(our_features);
 
     config_init(CONFIG_INIT_CLIENT, NULL);
+    /* (check for config errors comes later) */
 
     check_running_as(RUNNING_AS_CLIENT_LOGIN);
 
@@ -256,13 +184,9 @@ main(
        fflush(stderr);
     }
 
-    prog = NULL;
-    disk = NULL;
     qdisk = NULL;
-    amdevice = NULL;
     dumpdate = NULL;
     stroptions = NULL;
-    program_is_backup_api=0;
 
     for(; (line = agets(stdin)) != NULL; free(line)) {
        if (line[0] == '\0')
@@ -284,17 +208,31 @@ main(
                config_init(CONFIG_INIT_CLIENT | CONFIG_INIT_EXPLICIT_NAME | CONFIG_INIT_OVERLAY,
                            g_options->config);
 
-               dbrename(config_name, DBG_SUBDIR_CLIENT);
+               dbrename(get_config_name(), DBG_SUBDIR_CLIENT);
+           }
+
+           /* check for any config errors now */
+           if (config_errors(&errlist) >= CFGERR_ERRORS) {
+               char *errstr = config_errors_to_error_string(errlist);
+               g_printf("%s\n", errstr);
+               dbclose();
+               return 1;
+           }
+
+           if (am_has_feature(g_options->features, fe_req_xml)) {
+               break;
            }
            continue;
        }
 
-       if (prog != NULL) {
+       if (dle && dle->program != NULL) {
            err_extra = _("multiple requests");
            goto err;
        }
 
        dbprintf(_("  sendbackup req: <%s>\n"), line);
+       dle = alloc_dle();
+
        s = line;
        ch = *s++;
 
@@ -303,21 +241,21 @@ main(
            err_extra = _("no program name");
            goto err;                           /* no program name */
        }
-       prog = s - 1;
+       dle->program = s - 1;
        skip_non_whitespace(s, ch);
        s[-1] = '\0';
 
-       if(strcmp(prog,"BACKUP")==0) {
-           program_is_backup_api=1;
-           skip_whitespace(s, ch);             /* find dumper name */
-           if (ch == '\0') {
-               goto err;                       /* no program */
-           }
-           prog = s - 1;
-           skip_non_whitespace(s, ch);
-           s[-1] = '\0';
-       }
-       prog = stralloc(prog);
+        if (strcmp(dle->program, "APPLICATION")==0) {
+            dle->program_is_application_api=1;
+            skip_whitespace(s, ch);             /* find dumper name */
+            if (ch == '\0') {
+                goto err;                       /* no program */
+            }
+            dle->program = s - 1;
+            skip_non_whitespace(s, ch);
+            s[-1] = '\0';
+        }
+       dle->program = stralloc(dle->program);
 
        skip_whitespace(s, ch);                 /* find the disk name */
        if(ch == '\0') {
@@ -325,14 +263,13 @@ main(
            goto err;                           /* no disk name */
        }
 
-       amfree(disk);
        amfree(qdisk);
        qdisk = s - 1;
        ch = *qdisk;
        skip_quoted_string(s, ch);
        s[-1] = '\0';
        qdisk = stralloc(qdisk);
-       disk = unquote_string(qdisk);
+       dle->disk = unquote_string(qdisk);
 
        skip_whitespace(s, ch);                 /* find the device or level */
        if (ch == '\0') {
@@ -341,18 +278,17 @@ main(
        }
 
        if(!isdigit((int)s[-1])) {
-           amfree(amdevice);
            amfree(qamdevice);
            qamdevice = s - 1;
            ch = *qamdevice;
            skip_quoted_string(s, ch);
            s[-1] = '\0';
            qamdevice = stralloc(qamdevice);
-           amdevice = unquote_string(qamdevice);
+           dle->device = unquote_string(qamdevice);
            skip_whitespace(s, ch);             /* find level number */
        }
        else {
-           amdevice = stralloc(disk);
+           dle->device = stralloc(dle->disk);
            qamdevice = stralloc(qdisk);
        }
                                                /* find the level number */
@@ -361,6 +297,7 @@ main(
            goto err;                           /* bad level */
        }
        skip_integer(s, ch);
+       dle->level = g_slist_append(dle->level, GINT_TO_POINTER(level));
 
        skip_whitespace(s, ch);                 /* find the dump date */
        if(ch == '\0') {
@@ -392,63 +329,95 @@ main(
     }
     amfree(line);
     if (g_options == NULL) {
-       printf(_("ERROR [Missing OPTIONS line in sendbackup input]\n"));
+       g_printf(_("ERROR [Missing OPTIONS line in sendbackup input]\n"));
        error(_("Missing OPTIONS line in sendbackup input\n"));
        /*NOTREACHED*/
     }
 
-    if (prog       == NULL ||
-       disk       == NULL ||
-       amdevice   == NULL ||
-       dumpdate   == NULL ||
-       stroptions == NULL) {
+    if (am_has_feature(g_options->features, fe_req_xml)) {
+       char *errmsg = NULL;
+
+       dle = amxml_parse_node_FILE(stdin, &errmsg);
+       if (errmsg) {
+           err_extra = errmsg;
+           goto err;
+       }
+       if (!dle) {
+           err_extra = _("One DLE required");
+           goto err;
+       } else if (dle->next) {
+           err_extra = _("Only one DLE allowed");
+           goto err;
+       }
+
+       qdisk = quote_string(dle->disk);
+       if (dle->device == NULL)
+           dle->device = stralloc(dle->disk);
+       qamdevice = quote_string(dle->device);
+       dumpdate = stralloc("NODATE");
+       stroptions = stralloc("");
+    } else {
+       parse_options(stroptions, dle, g_options->features, 0);
+    }
+    gdle = dle;
+
+    if (dle->program == NULL ||
+       dle->disk    == NULL ||
+       dle->device  == NULL ||
+       dle->level   == NULL ||
+       dumpdate     == NULL) {
        err_extra = _("no valid sendbackup request");
        goto err;
     }
-       
-    dbprintf(_("  Parsed request as: program `%s'\n"), prog);
+
+    if (g_slist_length(dle->level) != 1) {
+       err_extra = _("Too many level");
+       goto err;
+    }
+
+    level = GPOINTER_TO_INT(dle->level->data);
+    dbprintf(_("  Parsed request as: program `%s'\n"), dle->program);
     dbprintf(_("                     disk `%s'\n"), qdisk);
     dbprintf(_("                     device `%s'\n"), qamdevice);
     dbprintf(_("                     level %d\n"), level);
     dbprintf(_("                     since %s\n"), dumpdate);
     dbprintf(_("                     options `%s'\n"), stroptions);
 
-    if(program_is_backup_api==1) {
-       /* check that the backup_api exist */
-    }
-    else {
+    if (dle->program_is_application_api==1) {
+       /* check that the application_api exist */
+    } else {
        for(i = 0; programs[i]; i++) {
-           if (strcmp(programs[i]->name, prog) == 0) {
+           if (strcmp(programs[i]->name, dle->program) == 0) {
                break;
            }
        }
        if (programs[i] == NULL) {
-           dbprintf(_("ERROR [%s: unknown program %s]\n"), get_pname(), prog);
-           error(_("ERROR [%s: unknown program %s]"), get_pname(), prog);
+           dbprintf(_("ERROR [%s: unknown program %s]\n"), get_pname(),
+                    dle->program);
+           error(_("ERROR [%s: unknown program %s]"), get_pname(),
+                 dle->program);
            /*NOTREACHED*/
        }
        program = programs[i];
     }
 
-    options = parse_options(stroptions, disk, amdevice, g_options->features, 0);
-
     if(!interactive) {
        datafd = DATA_FD_OFFSET + 0;
        mesgfd = DATA_FD_OFFSET + 2;
        indexfd = DATA_FD_OFFSET + 4;
     }
-    if (!options->createindex)
+    if (!dle->create_index)
        indexfd = -1;
 
-    if(options->auth && amandad_auth) {
-       if(strcasecmp(options->auth, amandad_auth) != 0) {
+    if (dle->auth && amandad_auth) {
+       if(strcasecmp(dle->auth, amandad_auth) != 0) {
            g_printf(_("ERROR [client configured for auth=%s while server requested '%s']\n"),
-                  amandad_auth, options->auth);
+                  amandad_auth, dle->auth);
            exit(-1);
        }
     }
 
-    if (options->kencrypt) {
+    if (dle->kencrypt) {
        g_printf("KENCRYPT\n");
     }
 
@@ -462,9 +431,6 @@ main(
     if(am_has_feature(g_options->features, fe_rep_options_hostname)) {
        g_printf("hostname=%s;", g_options->hostname);
     }
-    if(am_has_feature(g_options->features, fe_rep_options_sendbackup_options)) {
-       g_printf("%s", optionstr(options));
-    }
     g_printf("\n");
     fflush(stdout);
     if (freopen("/dev/null", "w", stdout) == NULL) {
@@ -484,56 +450,135 @@ main(
     }
 
     if(!interactive) {
-      if(datafd == -1 || mesgfd == -1 || (options->createindex && indexfd == -1)) {
+      if(datafd == -1 || mesgfd == -1 || (dle->create_index && indexfd == -1)) {
         dbclose();
         exit(1);
       }
     }
 
-    if(program_is_backup_api==1) {
-       pid_t backup_api_pid;
-       int i, j;
+    mesgstream = fdopen(mesgfd,"w");
+    run_client_scripts(EXECUTE_ON_PRE_DLE_BACKUP, g_options, dle, mesgstream);
+    fflush(mesgstream);
+
+    if (dle->program_is_application_api==1) {
+       int i, j, k;
        char *cmd=NULL;
-       char *argvchild[20];
+       char **argvchild;
        char levelstr[20];
-       int property_pipe[2];
        backup_support_option_t *bsu;
-
-       if (pipe(property_pipe) < 0) {
-           error(_("Can't create pipe: %s"),strerror(errno));
-           /*NOTREACHED*/
+       char *compopt = NULL;
+       char *encryptopt = skip_argument;
+       int compout, dumpout;
+       GSList    *scriptlist;
+       script_t  *script;
+       time_t     cur_dumptime;
+       int        result;
+       GPtrArray *errarray;
+       int        errfd[2];
+       FILE      *dumperr;
+
+       /*  apply client-side encryption here */
+       if ( dle->encrypt == ENCRYPT_CUST ) {
+           encpid = pipespawn(dle->clnt_encrypt, STDIN_PIPE, 0,
+                              &compout, &datafd, &mesgfd,
+                              dle->clnt_encrypt, encryptopt, NULL);
+           dbprintf(_("encrypt: pid %ld: %s\n"), (long)encpid, dle->clnt_encrypt);
+       } else {
+           compout = datafd;
+           encpid = -1;
        }
-       bsu = backup_support_option(prog, g_options, disk, amdevice);
 
-       switch(backup_api_pid=fork()) {
-       case 0:
-           aclose(property_pipe[1]);
-           if(dup2(property_pipe[0], 0) == -1) {
-               error(_("Can't dup2: %s"),strerror(errno));
-               /*NOTREACHED*/
+       /*  now do the client-side compression */
+       if(dle->compress == COMP_FAST || dle->compress == COMP_BEST) {
+           compopt = skip_argument;
+#if defined(COMPRESS_BEST_OPT) && defined(COMPRESS_FAST_OPT)
+           if(dle->compress == COMP_BEST) {
+               compopt = COMPRESS_BEST_OPT;
+           } else {
+               compopt = COMPRESS_FAST_OPT;
            }
-           if(dup2(datafd, 1) == -1) {
-               error(_("Can't dup2: %s"),strerror(errno));
-               /*NOTREACHED*/
+#endif
+           comppid = pipespawn(COMPRESS_PATH, STDIN_PIPE, 0,
+                               &dumpout, &compout, &mesgfd,
+                               COMPRESS_PATH, compopt, NULL);
+           dbprintf(_("gnutar: pid %ld: %s"), (long)comppid, COMPRESS_PATH);
+           if(compopt != skip_argument) {
+               dbprintf(_("pid %ld: %s %s\n"),
+                        (long)comppid, COMPRESS_PATH, compopt);
+           } else {
+               dbprintf(_("pid %ld: %s\n"), (long)comppid, COMPRESS_PATH);
            }
-           if(dup2(mesgfd, 2) == -1) {
-               error(_("Can't dup2: %s"),strerror(errno));
-               /*NOTREACHED*/
+       } else if (dle->compress == COMP_CUST) {
+           compopt = skip_argument;
+           comppid = pipespawn(dle->compprog, STDIN_PIPE, 0,
+                               &dumpout, &compout, &mesgfd,
+                               dle->compprog, compopt, NULL);
+           if(compopt != skip_argument) {
+               dbprintf(_("pid %ld: %s %s\n"),
+                        (long)comppid, dle->compprog, compopt);
+           } else {
+               dbprintf(_("pid %ld: %s\n"), (long)comppid, dle->compprog);
            }
-           if(indexfd != 0) {
-               if(dup2(indexfd, 3) == -1) {
-                   error(_("Can't dup2: %s"),strerror(errno));
-                   /*NOTREACHED*/
+       } else {
+           dumpout = compout;
+           comppid = -1;
+       }
+
+       cur_dumptime = time(0);
+       bsu = backup_support_option(dle->program, g_options, dle->disk,
+                                   dle->device, &errarray);
+       if (!bsu) {
+           char  *errmsg;
+           char  *qerrmsg;
+           guint  i;
+           for (i=0; i < errarray->len; i++) {
+               errmsg = g_ptr_array_index(errarray, i);
+               qerrmsg = quote_string(errmsg);
+               fdprintf(mesgfd,
+                         _("sendbackup: error [Application '%s': %s]\n"),
+                         dle->program, errmsg);
+               dbprintf("aa: %s\n",qerrmsg);
+               amfree(qerrmsg);
+           }
+           if (i == 0) { /* no errarray */
+               errmsg = vstrallocf(_("Can't execute application '%s'"),
+                                   dle->program);
+               qerrmsg = quote_string(errmsg);
+               fdprintf(mesgfd, _("sendbackup: error [%s]\n"), errmsg);
+               dbprintf(_("ERROR %s\n"), qerrmsg);
+               amfree(qerrmsg);
+               amfree(errmsg);
+           }
+           return 0;
+       }
+
+       if (pipe(errfd) < 0) {
+           char  *errmsg;
+           char  *qerrmsg;
+           errmsg = vstrallocf(_("Application '%s': can't create pipe"),
+                                   dle->program);
+           qerrmsg = quote_string(errmsg);
+           fdprintf(mesgfd, _("sendbackup: error [%s]\n"), errmsg);
+           dbprintf(_("ERROR %s\n"), qerrmsg);
+           amfree(qerrmsg);
+           amfree(errmsg);
+           return 0;
+       }
+
+       switch(application_api_pid=fork()) {
+       case 0:
+           cmd = vstralloc(APPLICATION_DIR, "/", dle->program, NULL);
+           k = application_property_argv_size(dle);
+           for (scriptlist = dle->scriptlist; scriptlist != NULL;
+                scriptlist = scriptlist->next) {
+               script = (script_t *)scriptlist->data;
+               if (script->result && script->result->proplist) {
+                   k += property_argv_size(script->result->proplist);
                }
-               fcntl(indexfd, F_SETFD, 0);
-               fcntl(3, F_SETFD, 0);
-               safe_fd(3, 1);
-           } else {
-               safe_fd(-1, 0);
            }
-           cmd = vstralloc(DUMPER_DIR, "/", prog, NULL);
+           argvchild = g_new0(char *, 20 + k);
            i=0;
-           argvchild[i++] = prog;
+           argvchild[i++] = dle->program;
            argvchild[i++] = "backup";
            if (bsu->message_line == 1) {
                argvchild[i++] = "--message";
@@ -547,59 +592,110 @@ main(
                argvchild[i++] = "--host";
                argvchild[i++] = g_options->hostname;
            }
-           if (disk && bsu->disk == 1) {
+           if (dle->disk && bsu->disk == 1) {
                argvchild[i++] = "--disk";
-               argvchild[i++] = disk;
+               argvchild[i++] = dle->disk;
            }
            argvchild[i++] = "--device";
-           argvchild[i++] = amdevice;
+           argvchild[i++] = dle->device;
            if (level <= bsu->max_level) {
                argvchild[i++] = "--level";
                g_snprintf(levelstr,19,"%d",level);
                argvchild[i++] = levelstr;
            }
-           if (indexfd != 0 && bsu->index_line == 1) {
+           if (indexfd != -1 && bsu->index_line == 1) {
                argvchild[i++] = "--index";
                argvchild[i++] = "line";
            }
-           if (!options->no_record && bsu->record == 1) {
+           if (dle->record && bsu->record == 1) {
                argvchild[i++] = "--record";
            }
+           i += application_property_add_to_argv(&argvchild[i], dle, bsu);
+
+           for (scriptlist = dle->scriptlist; scriptlist != NULL;
+                scriptlist = scriptlist->next) {
+               script = (script_t *)scriptlist->data;
+               if (script->result && script->result->proplist) {
+                   i += property_add_to_argv(&argvchild[i],
+                                             script->result->proplist);
+               }
+           }
+
            argvchild[i] = NULL;
-           dbprintf(_("%s: running \"%s"), get_pname(), cmd);
-           for(j=1;j<i;j++) dbprintf(" %s",argvchild[j]);
+           dbprintf(_("%s: running \"%s\n"), get_pname(), cmd);
+           for(j=1;j<i;j++) dbprintf(" %s\n",argvchild[j]);
            dbprintf(_("\"\n"));
-           backup_api_info_tapeheader(mesgfd, prog, options);
+           if(dup2(dumpout, 1) == -1) {
+               error(_("Can't dup2: %s"),strerror(errno));
+               /*NOTREACHED*/
+           }
+           if (dup2(errfd[1], 2) == -1) {
+               error(_("Can't dup2: %s"),strerror(errno));
+               /*NOTREACHED*/
+           }
+           if(dup2(mesgfd, 3) == -1) {
+               error(_("Can't dup2: %s"),strerror(errno));
+               /*NOTREACHED*/
+           }
+           if(indexfd > 0) {
+               if(dup2(indexfd, 4) == -1) {
+                   error(_("Can't dup2: %s"),strerror(errno));
+                   /*NOTREACHED*/
+               }
+               fcntl(indexfd, F_SETFD, 0);
+           }
+           application_api_info_tapeheader(mesgfd, dle->program, dle);
+           if (indexfd != 0) {
+               safe_fd(3, 2);
+           } else {
+               safe_fd(3, 1);
+           }
            execve(cmd, argvchild, safe_env());
            exit(1);
            break;
  
        default:
-           aclose(property_pipe[0]);
-           toolin = fdopen(property_pipe[1],"w");
-           if (!toolin) {
-               error(_("Can't fdopen: %s"), strerror(errno));
-               /*NOTREACHED*/
-           }
-           output_tool_property(toolin, options);
-           fflush(toolin);
-           fclose(toolin);
            break;
        case -1:
            error(_("%s: fork returned: %s"), get_pname(), strerror(errno));
        }
-       amfree(bsu);
-       if (waitpid(backup_api_pid, &status, 0) < 0) {
-           if (!WIFEXITED(status)) {
-               dbprintf(_("Tool exited with signal %d"), WTERMSIG(status));
-           } else if (WEXITSTATUS(status) != 0) {
-               dbprintf(_("Tool exited with status %d"), WEXITSTATUS(status));
+
+       close(errfd[1]);
+       dumperr = fdopen(errfd[0],"r");
+       if (!dumperr) {
+           error(_("Can't fdopen: %s"), strerror(errno));
+           /*NOTREACHED*/
+       }
+
+       while ((line = agets(dumperr)) != NULL) {
+           if (strlen(line) > 0) {
+               fdprintf(mesgfd, "sendbackup: error [%s]\n", line);
+               dbprintf("error: %s\n", line);
+           }
+           amfree(line);
+       }
+
+       result = check_result(mesgfd);
+       if (result == 0) {
+           char *amandates_file;
+
+           amandates_file = getconf_str(CNF_AMANDATES);
+           if(start_amandates(amandates_file, 1)) {
+               amandates_updateone(dle->disk, level, cur_dumptime);
+               finish_amandates();
+               free_amandates();
            } else {
-               dbprintf(_("waitpid returned negative value"));
+               if (dle->calcsize && bsu->calcsize) {
+                   error(_("error [opening %s for writing: %s]"),
+                         amandates_file, strerror(errno));
+               } else {
+                   g_debug(_("non-fatal error opening '%s' for writing: %s]"),
+                           amandates_file, strerror(errno));
+               }
            }
        }
-     }
-    else {
+       amfree(bsu);
+     } else {
        if(!interactive) {
            /* redirect stderr */
            if(dup2(mesgfd, 2) == -1) {
@@ -616,17 +712,17 @@ main(
            error(_("error [opening mesg pipe: %s]"), s);
        }
 
-       program->start_backup(g_options->hostname, disk, amdevice, level,
-                             dumpdate, datafd, mesgpipe[1], indexfd);
+       program->start_backup(dle, g_options->hostname,
+                             datafd, mesgpipe[1], indexfd);
        dbprintf(_("Started backup\n"));
-       parse_backup_messages(mesgpipe[0]);
+       parse_backup_messages(dle, mesgpipe[0]);
        dbprintf(_("Parsed backup messages\n"));
     }
 
-    amfree(prog);
-    amfree(disk);
+    run_client_scripts(EXECUTE_ON_POST_DLE_BACKUP, g_options, dle, mesgstream);
+    fflush(mesgstream);
+
     amfree(qdisk);
-    amfree(amdevice);
     amfree(qamdevice);
     amfree(dumpdate);
     amfree(stroptions);
@@ -640,10 +736,20 @@ main(
     return 0;
 
  err:
-    g_printf(_("FORMAT ERROR IN REQUEST PACKET\n"));
-    dbprintf(_("REQ packet is bogus%s%s\n"),
-             err_extra ? ": " : "",
-             err_extra ? err_extra : "");
+    if (err_extra) {
+       g_printf(_("ERROR FORMAT ERROR IN REQUEST PACKET '%s'\n"), err_extra);
+       dbprintf(_("REQ packet is bogus: %s\n"), err_extra);
+    } else {
+       g_printf(_("ERROR FORMAT ERROR IN REQUEST PACKET\n"));
+       dbprintf(_("REQ packet is bogus\n"));
+    }
+
+    amfree(qdisk);
+    amfree(qamdevice);
+    amfree(dumpdate);
+    amfree(stroptions);
+    amfree(our_feature_string);
+
     dbclose();
     return 1;
 }
@@ -662,6 +768,13 @@ childstr(
     if(pid == comppid) return "compress";
     if(pid == encpid) return "encrypt";
     if(pid == indexpid) return "index";
+    if(pid == application_api_pid) {
+       if (!gdle) {
+           dbprintf("gdle == NULL\n");
+           return "gdle == NULL";
+       }
+       return gdle->program;
+    }
     return "unknown";
 }
 
@@ -675,7 +788,8 @@ childstr(
 int
 check_status(
     pid_t      pid,
-    amwait_t   w)
+    amwait_t   w,
+    int                mesgfd)
 {
     char *thiserr = NULL;
     char *str, *strX;
@@ -698,11 +812,11 @@ check_status(
         * but the failure is noted.
         */
        if(ret != 0) {
-           g_fprintf(stderr, _("? index %s returned %d\n"), str, ret);
+           fdprintf(mesgfd, _("? index %s returned %d\n"), str, ret);
            rc = 0;
        }
        indexpid = -1;
-       strX = "index ";
+       strX = "index";
     } else if(pid == comppid) {
        /*
         * compress returns 2 sometimes, but it is ok.
@@ -713,7 +827,7 @@ check_status(
        }
 #endif
        comppid = -1;
-       strX = "compress ";
+       strX = "compress";
     } else if(pid == dumppid && tarpid == -1) {
         /*
         * Ultrix dump returns 1 sometimes, but it is ok.
@@ -724,7 +838,7 @@ check_status(
        }
 #endif
        dumppid = -1;
-       strX = "dump ";
+       strX = "dump";
     } else if(pid == tarpid) {
        if (ret == 1) {
            rc = 0;
@@ -738,9 +852,11 @@ check_status(
        }
 #endif
        dumppid = tarpid = -1;
-       strX = "dump ";
+       strX = "dump";
+    } else if(pid == application_api_pid) {
+       strX = "Application";
     } else {
-       strX = "unknown ";
+       strX = "unknown";
     }
 
     if(rc == 0) {
@@ -754,6 +870,8 @@ check_status(
        thiserr = vstrallocf(_("%s (%d) %s returned %d"), strX, (int)pid, str, ret);
     }
 
+    fdprintf(mesgfd, "? %s\n", thiserr);
+
     if(errorstr) {
        errorstr =  newvstrallocf(errorstr, "%s, %s", errorstr, thiserr);
        amfree(thiserr);
@@ -769,12 +887,13 @@ check_status(
  *Send header info to the message file.
  */
 void
-info_tapeheader(void)
+info_tapeheader(
+    dle_t *dle)
 {
     g_fprintf(stderr, "%s: info BACKUP=%s\n", get_pname(), program->backup_name);
 
     g_fprintf(stderr, "%s: info RECOVER_CMD=", get_pname());
-    if (options->compress == COMP_FAST || options->compress == COMP_BEST)
+    if (dle->compress == COMP_FAST || dle->compress == COMP_BEST)
        g_fprintf(stderr, "%s %s |", UNCOMPRESS_PATH,
 #ifdef UNCOMPRESS_OPT
                UNCOMPRESS_OPT
@@ -785,7 +904,7 @@ info_tapeheader(void)
 
     g_fprintf(stderr, "%s -xpGf - ...\n", program->restore_name);
 
-    if (options->compress == COMP_FAST || options->compress == COMP_BEST)
+    if (dle->compress == COMP_FAST || dle->compress == COMP_BEST)
        g_fprintf(stderr, "%s: info COMPRESS_SUFFIX=%s\n",
                        get_pname(), COMPRESS_SUFFIX);
 
@@ -793,32 +912,32 @@ info_tapeheader(void)
 }
 
 void
-backup_api_info_tapeheader(
+application_api_info_tapeheader(
     int       mesgfd,
     char     *prog,
-    option_t *options)
+    dle_t *dle)
 {
     char line[1024];
 
-    g_snprintf(line, 1024, "%s: info BACKUP=DUMPER\n", get_pname());
-    if (fullwrite(mesgfd, line, strlen(line)) != (ssize_t)strlen(line)) {
+    g_snprintf(line, 1024, "%s: info BACKUP=APPLICATION\n", get_pname());
+    if (full_write(mesgfd, line, strlen(line)) != strlen(line)) {
        dbprintf(_("error writing to mesgfd socket: %s"), strerror(errno));
        return;
     }
 
-    g_snprintf(line, 1024, "%s: info DUMPER=%s\n", get_pname(), prog);
-    if (fullwrite(mesgfd, line, strlen(line)) != (ssize_t)strlen(line)) {
+    g_snprintf(line, 1024, "%s: info APPLICATION=%s\n", get_pname(), prog);
+    if (full_write(mesgfd, line, strlen(line)) != strlen(line)) {
        dbprintf(_("error writing to mesgfd socket: %s"), strerror(errno));
        return;
     }
 
     g_snprintf(line, 1024, "%s: info RECOVER_CMD=", get_pname());
-    if (fullwrite(mesgfd, line, strlen(line)) != (ssize_t)strlen(line)) {
+    if (full_write(mesgfd, line, strlen(line)) != strlen(line)) {
        dbprintf(_("error writing to mesgfd socket: %s"), strerror(errno));
        return;
     }
 
-    if (options->compress) {
+    if (dle->compress == COMP_FAST || dle->compress == COMP_BEST) {
        g_snprintf(line, 1024, "%s %s |", UNCOMPRESS_PATH,
 #ifdef UNCOMPRESS_OPT
                 UNCOMPRESS_OPT
@@ -826,28 +945,29 @@ backup_api_info_tapeheader(
                 ""
 #endif
                 );
-       if (fullwrite(mesgfd, line, strlen(line)) != (ssize_t)strlen(line)) {
+       if (full_write(mesgfd, line, strlen(line)) != strlen(line)) {
            dbprintf(_("error writing to mesgfd socket: %s"), strerror(errno));
            return;
        }
     }
-    g_snprintf(line, 1024, "%s -f... -\n", prog);
-    if (fullwrite(mesgfd, line, strlen(line)) != (ssize_t)strlen(line)) {
+    g_snprintf(line, 1024, "%s/%s restore [./file-to-restore]+\n",
+              APPLICATION_DIR, prog);
+    if (full_write(mesgfd, line, strlen(line)) != strlen(line)) {
        dbprintf(_("error writing to mesgfd socket: %s"), strerror(errno));
        return;
     }
 
-    if (options->compress) {
+    if (dle->compress) {
        g_snprintf(line, 1024, "%s: info COMPRESS_SUFFIX=%s\n",
                 get_pname(), COMPRESS_SUFFIX);
-       if (fullwrite(mesgfd, line, strlen(line)) != (ssize_t)strlen(line)) {
+       if (full_write(mesgfd, line, strlen(line)) != strlen(line)) {
            dbprintf(_("error writing to mesgfd socket: %s"), strerror(errno));
            return;
        }
     }
 
     g_snprintf(line, 1024, "%s: info end\n", get_pname());
-    if (fullwrite(mesgfd, line, strlen(line)) != (ssize_t)strlen(line)) {
+    if (full_write(mesgfd, line, strlen(line)) != strlen(line)) {
        dbprintf(_("error writing to mesgfd socket: %s"), strerror(errno));
        return;
     }
@@ -905,35 +1025,25 @@ pipefork(
     return pid;
 }
 
-void
-parse_backup_messages(
-    int                mesgin)
+int
+check_result(
+    int mesgfd)
 {
     int goterror;
     pid_t wpid;
     amwait_t retstat;
-    char *line;
 
     goterror = 0;
-    amfree(errorstr);
-
-    for(; (line = areads(mesgin)) != NULL; free(line)) {
-       process_dumpline(line);
-    }
 
-    if(errno) {
-       error(_("error [read mesg pipe: %s]"), strerror(errno));
-       /*NOTREACHED*/
-    }
 
     while((wpid = waitpid((pid_t)-1, &retstat, WNOHANG)) > 0) {
-       if(check_status(wpid, retstat)) goterror = 1;
+       if(check_status(wpid, retstat, mesgfd)) goterror = 1;
     }
 
     if (dumppid != -1) {
        sleep(5);
        while((wpid = waitpid((pid_t)-1, &retstat, WNOHANG)) > 0) {
-           if(check_status(wpid, retstat)) goterror = 1;
+           if(check_status(wpid, retstat, mesgfd)) goterror = 1;
        }
     }
     if (dumppid != -1) {
@@ -948,7 +1058,7 @@ parse_backup_messages(
        }
        sleep(5);
        while((wpid = waitpid((pid_t)-1, &retstat, WNOHANG)) > 0) {
-           if(check_status(wpid, retstat)) goterror = 1;
+           if(check_status(wpid, retstat, mesgfd)) goterror = 1;
        }
     }
     if (dumppid != -1) {
@@ -963,10 +1073,34 @@ parse_backup_messages(
        }
        sleep(5);
        while((wpid = waitpid((pid_t)-1, &retstat, WNOHANG)) > 0) {
-           if(check_status(wpid, retstat)) goterror = 1;
+           if(check_status(wpid, retstat, mesgfd)) goterror = 1;
        }
     }
 
+    return goterror;
+}
+
+void
+parse_backup_messages(
+    dle_t      *dle,
+    int                mesgin)
+{
+    int goterror;
+    char *line;
+
+    amfree(errorstr);
+
+    for(; (line = areads(mesgin)) != NULL; free(line)) {
+       process_dumpline(line);
+    }
+
+    if(errno) {
+       error(_("error [read mesg pipe: %s]"), strerror(errno));
+       /*NOTREACHED*/
+    }
+
+    goterror = check_result(mesgfd);
+
     if(errorstr) {
        error(_("error [%s]"), errorstr);
        /*NOTREACHED*/
@@ -975,39 +1109,10 @@ parse_backup_messages(
        /*NOTREACHED*/
     }
 
-    program->end_backup(goterror);
+    program->end_backup(dle, goterror);
 
-    g_fprintf(stderr, _("%s: size %ld\n"), get_pname(), dump_size);
-    g_fprintf(stderr, _("%s: end\n"), get_pname());
-}
-
-
-/*
- * Returns the value of the first integer in a string.
- */
-
-double
-the_num(
-    char *     str,
-    int         pos)
-{
-    char *num;
-    int ch;
-    double d;
-
-    do {
-       ch = *str++;
-       while(ch && !isdigit(ch)) ch = *str++;
-       if (pos == 1) break;
-       pos--;
-       while(ch && (isdigit(ch) || ch == '.')) ch = *str++;
-    } while (ch);
-    num = str - 1;
-    while(isdigit(ch) || ch == '.') ch = *str++;
-    str[-1] = '\0';
-    d = atof(num);
-    str[-1] = (char)ch;
-    return d;
+    fdprintf(mesgfd, _("%s: size %ld\n"), get_pname(), dump_size);
+    fdprintf(mesgfd, _("%s: end\n"), get_pname());
 }
 
 
@@ -1057,7 +1162,7 @@ process_dumpline(
              type,
              startchr,
              str);
-    g_fprintf(stderr, "%c %s\n", startchr, str);
+    fdprintf(mesgfd, "%c %s\n", startchr, str);
 }
 
 
@@ -1161,7 +1266,7 @@ start_index(
     char buffer[BUFSIZ], *ptr;
     ssize_t bytes_read;
     size_t bytes_written;
-    ssize_t just_written;
+    size_t just_written;
 
     do {
        bytes_read = read(0, buffer, SIZEOF(buffer));
@@ -1178,8 +1283,8 @@ start_index(
     /* write the stuff to the subprocess */
     ptr = buffer;
     bytes_written = 0;
-    just_written = fullwrite(fileno(pipe_fp), ptr, (size_t)bytes_read);
-    if (just_written < 0) {
+    just_written = full_write(fileno(pipe_fp), ptr, (size_t)bytes_read);
+    if (just_written < (size_t)bytes_read) {
        /* 
         * just as we waited for write() to complete.
         */
@@ -1196,8 +1301,8 @@ start_index(
        occurs */
     ptr = buffer;
     bytes_written = 0;
-    just_written = fullwrite(3, ptr, (size_t)bytes_read);
-    if (just_written < 0) {
+    just_written = full_write(3, ptr, bytes_read);
+    if (just_written < (size_t)bytes_read) {
        error(_("index tee cannot write [%s]"), strerror(errno));
        /*NOTREACHED*/
     } else {
index 134e6fb65bf084489d37b1005cfbe976e60aa1ae..ceff2d96fae9eba51f99d8a733c4fa9ea5de39be 100644 (file)
@@ -36,7 +36,7 @@
 #include "client_util.h"
 #include "amandad.h"
 
-void info_tapeheader(void);
+void info_tapeheader(dle_t *dle);
 void start_index(int createindex, int input, int mesg, 
                    int index, char *cmd);
 
@@ -57,7 +57,7 @@ void start_index(int createindex, int input, int mesg,
  */
 
 typedef enum { 
-    DMP_NORMAL, DMP_STRANGE, DMP_SIZE, DMP_ERROR
+    DMP_NORMAL, DMP_IGNORE, DMP_STRANGE, DMP_SIZE, DMP_ERROR
 } dmpline_t;
 
 typedef struct regex_s {
@@ -69,20 +69,20 @@ typedef struct regex_s {
 } amregex_t;
 
 #define AM_NORMAL_RE(re)       {(re), __LINE__, 0, 0, DMP_NORMAL}
+#define AM_IGNORE_RE(re)       {(re), __LINE__, 0, 0, DMP_IGNORE}
 #define AM_STRANGE_RE(re)      {(re), __LINE__, 0, 0, DMP_STRANGE}
 #define AM_SIZE_RE(re,s,f)     {(re), __LINE__, (s), (f), DMP_SIZE}
 #define AM_ERROR_RE(re)                {(re), __LINE__, 0, 0, DMP_ERROR}
 
 extern pid_t  comppid, dumppid, encpid, tarpid;
 extern pid_t indexpid;
-extern option_t *options;
 extern g_option_t *g_options;
 
 typedef struct backup_program_s {
     char *name, *backup_name, *restore_name;
     amregex_t *re_table;
-    void (*start_backup)(char *host, char *disk, char *amdevice, int level, char *dumpdate, int dataf, int mesgf, int indexf);
-    void (*end_backup)(int goterror);
+    void (*start_backup)(dle_t *dle, char *host, int dataf, int mesgf, int indexf);
+    void (*end_backup)(dle_t *dle, int goterror);
 } backup_program_t;
 
 extern backup_program_t *programs[], *program;
index 4a335b7bdfb4a0ddf25d6ad5ea15666533d8219d..359688c49aa6ff59d8f49ea6b4ce2339bc2d89c4 100644 (file)
@@ -24,7 +24,7 @@
  * file named AUTHORS, in the root directory of this distribution.
  */
 /* 
- * $Id: sendsize.c,v 1.171 2006/08/24 01:57:15 paddy_s Exp $
+ * $Id: sendsize.c 10421 2008-03-06 18:48:30Z martineau $
  *
  * send estimated backup sizes using dump
  */
@@ -83,19 +83,13 @@ typedef struct level_estimates_s {
 
 typedef struct disk_estimates_s {
     struct disk_estimates_s *next;
-    char *amname;
     char *qamname;
-    char *amdevice;
     char *qamdevice;
     char *dirname;
     char *qdirname;
-    char *program;
-    char *calcprog;
-    int program_is_backup_api;
-    int spindle;
     pid_t child;
     int done;
-    option_t *options;
+    dle_t *dle;
     level_estimate_t est[DUMP_LEVELS];
 } disk_estimates_t;
 
@@ -104,31 +98,27 @@ disk_estimates_t *est_list;
 static am_feature_t *our_features = NULL;
 static char *our_feature_string = NULL;
 static g_option_t *g_options = NULL;
+static gboolean amandates_started = FALSE;
 
 /* local functions */
 int main(int argc, char **argv);
-void add_diskest(char *disk, char *amdevice, int level, int spindle, 
-                   int program_is_backup_api, char *prog, char *calcprog,
-                   option_t *options);
+void dle_add_diskest(dle_t *dle);
 void calc_estimates(disk_estimates_t *est);
 void free_estimates(disk_estimates_t *est);
 void dump_calc_estimates(disk_estimates_t *);
 void star_calc_estimates(disk_estimates_t *);
 void smbtar_calc_estimates(disk_estimates_t *);
 void gnutar_calc_estimates(disk_estimates_t *);
-void backup_api_calc_estimate(disk_estimates_t *);
+void application_api_calc_estimate(disk_estimates_t *);
 void generic_calc_estimates(disk_estimates_t *);
 
-
 int
 main(
     int                argc,
     char **    argv)
 {
-    int level, spindle;
-    char *prog, *calcprog, *dumpdate;
-    option_t *options = NULL;
-    int program_is_backup_api;
+    int level;
+    char *dumpdate;
     disk_estimates_t *est;
     disk_estimates_t *est1;
     disk_estimates_t *est_prev;
@@ -139,13 +129,11 @@ main(
     int done;
     int need_wait;
     int dumpsrunning;
-    char *disk = NULL;
     char *qdisk = NULL;
     char *qlist = NULL;
-    char *amdevice = NULL;
     char *qamdevice = NULL;
-    char *amandates_file;
-    int   amandates_read = 0;
+    dle_t *dle;
+    GSList *errlist;
 
     (void)argc;        /* Quiet unused parameter warning */
     (void)argv;        /* Quiet unused parameter warning */
@@ -178,6 +166,7 @@ main(
     our_feature_string = am_feature_to_string(our_features);
 
     config_init(CONFIG_INIT_CLIENT, NULL);
+    /* (check for config errors comes later) */
 
     check_running_as(RUNNING_AS_CLIENT_LOGIN);
 
@@ -212,20 +201,24 @@ main(
                config_init(CONFIG_INIT_CLIENT | CONFIG_INIT_EXPLICIT_NAME | CONFIG_INIT_OVERLAY,
                            g_options->config);
 
-               dbrename(config_name, DBG_SUBDIR_CLIENT);
+               dbrename(get_config_name(), DBG_SUBDIR_CLIENT);
            }
 
-           continue;
-       }
+           /* check for any config errors now */
+           if (config_errors(&errlist) >= CFGERR_ERRORS) {
+               char *errstr = config_errors_to_error_string(errlist);
+               g_printf("%s\n", errstr);
+               dbclose();
+               return 1;
+           }
 
-       if (amandates_read == 0) {
-           amandates_file = getconf_str(CNF_AMANDATES);
-           if(!start_amandates(amandates_file, 0))
-               error("error [opening %s: %s]", amandates_file,
-                     strerror(errno));
-           amandates_read = 1;
+           if (am_has_feature(g_options->features, fe_req_xml)) {
+               break;
+           }
+           continue;
        }
 
+       dle = alloc_dle();
        s = line;
        ch = *s++;
 
@@ -234,44 +227,46 @@ main(
            err_extra = stralloc(_("no program name"));
            goto err;                           /* no program name */
        }
-       prog = s - 1;
+       dle->program = s - 1;
        skip_non_whitespace(s, ch);
        s[-1] = '\0';
 
-       program_is_backup_api=0;
-       if(strncmp_const(prog, "CALCSIZE") == 0) {
+       dle->program_is_application_api=0;
+       if(strncmp_const(dle->program, "CALCSIZE") == 0) {
            skip_whitespace(s, ch);             /* find the program name */
            if(ch == '\0') {
                err_extra = stralloc(_("no program name"));
                goto err;
            }
-           calcprog = s - 1;
+           dle->calcsize = 1;
+           dle->program = s - 1;
            skip_non_whitespace(s, ch);
            s[-1] = '\0';
-           if (strcmp(calcprog,"BACKUP") == 0) {
-               program_is_backup_api=1;
+           if (strcmp(dle->program,"APPLICATION") == 0) {
+               dle->program_is_application_api=1;
                skip_whitespace(s, ch);         /* find dumper name */
                if (ch == '\0') {
                    goto err;                   /* no program */
                }
-               calcprog = s - 1;
+               dle->program = s - 1;
                skip_non_whitespace(s, ch);
                s[-1] = '\0';
            }
        }
        else {
-           calcprog = NULL;
-           if (strcmp(prog,"BACKUP") == 0) {
-               program_is_backup_api=1;
+           dle->calcsize = 0;
+           if (strcmp(dle->program,"APPLICATION") == 0) {
+               dle->program_is_application_api=1;
                skip_whitespace(s, ch);         /* find dumper name */
                if (ch == '\0') {
                    goto err;                   /* no program */
                }
-               prog = s - 1;
+               dle->program = s - 1;
                skip_non_whitespace(s, ch);
                s[-1] = '\0';
            }
        }
+       dle->program = stralloc(dle->program);
 
        skip_whitespace(s, ch);                 /* find the disk name */
        if(ch == '\0') {
@@ -281,14 +276,12 @@ main(
 
        if (qdisk != NULL)
            amfree(qdisk);
-       if (disk != NULL)
-           amfree(disk);
 
        fp = s - 1;
        skip_quoted_string(s, ch);
        s[-1] = '\0';                           /* terminate the disk name */
        qdisk = stralloc(fp);
-       disk = unquote_string(qdisk);
+       dle->disk = unquote_string(qdisk);
 
        skip_whitespace(s, ch);                 /* find the device or level */
        if (ch == '\0') {
@@ -300,11 +293,11 @@ main(
            skip_quoted_string(s, ch);
            s[-1] = '\0';
            qamdevice = stralloc(fp);
-           amdevice = unquote_string(qamdevice);
+           dle->device = unquote_string(qamdevice);
            skip_whitespace(s, ch);             /* find level number */
        }
        else {
-           amdevice = stralloc(disk);
+           dle->device = stralloc(dle->disk);
            qamdevice = stralloc(qdisk);
        }
 
@@ -318,6 +311,7 @@ main(
            goto err;
        }
        skip_integer(s, ch);
+       dle->level = g_slist_append(dle->level, GINT_TO_POINTER(level));
 
        skip_whitespace(s, ch);                 /* find the dump date */
        if(ch == '\0') {
@@ -329,11 +323,11 @@ main(
        s[-1] = '\0';
        (void)dumpdate;                         /* XXX: Set but not used */
 
-       spindle = 0;                            /* default spindle */
+       dle->spindle = 0;                       /* default spindle */
 
        skip_whitespace(s, ch);                 /* find the spindle */
        if(ch != '\0') {
-           if(sscanf(s - 1, "%d", &spindle) != 1) {
+           if(sscanf(s - 1, "%d", &dle->spindle) != 1) {
                err_extra = stralloc(_("bad spindle"));
                goto err;                       /* bad spindle */
            }
@@ -342,35 +336,32 @@ main(
            skip_whitespace(s, ch);             /* find the parameters */
            if(ch != '\0') {
                if(strncmp_const(s-1, "OPTIONS |;") == 0) {
-                   options = parse_options(s + 8,
-                                           disk,
-                                           amdevice,
-                                           g_options->features,
-                                           0);
+                   parse_options(s + 8,
+                                 dle,
+                                 g_options->features,
+                                 0);
                }
                else {
-                   options = alloc(SIZEOF(option_t));
-                   init_options(options);
                    while (ch != '\0') {
                        if(strncmp_const(s-1, "exclude-file=") == 0) {
                            qlist = unquote_string(s+12);
-                           options->exclude_file =
-                               append_sl(options->exclude_file, qlist);
+                           dle->exclude_file =
+                               append_sl(dle->exclude_file, qlist);
                            amfree(qlist);
                        } else if(strncmp_const(s-1, "exclude-list=") == 0) {
                            qlist = unquote_string(s+12);
-                           options->exclude_list =
-                               append_sl(options->exclude_list, qlist);
+                           dle->exclude_list =
+                               append_sl(dle->exclude_list, qlist);
                            amfree(qlist);
                        } else if(strncmp_const(s-1, "include-file=") == 0) {
                            qlist = unquote_string(s+12);
-                           options->include_file =
-                               append_sl(options->include_file, qlist);
+                           dle->include_file =
+                               append_sl(dle->include_file, qlist);
                            amfree(qlist);
                        } else if(strncmp_const(s-1, "include-list=") == 0) {
                            qlist = unquote_string(s+12);
-                           options->include_list =
-                               append_sl(options->include_list, qlist);
+                           dle->include_list =
+                               append_sl(dle->include_list, qlist);
                            amfree(qlist);
                        } else {
                            err_extra = vstrallocf(_("Invalid parameter (%s)"), s-1);
@@ -382,33 +373,43 @@ main(
                    }
                }
            }
-           else {
-               options = alloc(SIZEOF(option_t));
-               init_options(options);
-           }
-       }
-       else {
-           options = alloc(SIZEOF(option_t));
-           init_options(options);
        }
 
        /*@ignore@*/
-       add_diskest(disk, amdevice, level, spindle, program_is_backup_api, prog, calcprog, options);
+       dle_add_diskest(dle);
        /*@end@*/
-       amfree(disk);
-       amfree(qdisk);
-       amfree(amdevice);
-       amfree(qamdevice);
     }
     if (g_options == NULL) {
-       printf(_("ERROR [Missing OPTIONS line in sendsize input]\n"));
+       g_printf(_("ERROR [Missing OPTIONS line in sendsize input]\n"));
        error(_("Missing OPTIONS line in sendsize input\n"));
        /*NOTREACHED*/
     }
     amfree(line);
 
-    finish_amandates();
-    free_amandates();
+    if (am_has_feature(g_options->features, fe_req_xml)) {
+       char    *errmsg = NULL;
+       dle_t   *dles, *dle;
+
+       dles = amxml_parse_node_FILE(stdin, &errmsg);
+       if (errmsg) {
+           err_extra = errmsg;
+           goto err;
+       }
+       for (dle = dles; dle != NULL; dle = dle->next) {
+           dle_add_diskest(dle);
+       }
+    }
+
+    if (amandates_started) {
+       finish_amandates();
+       free_amandates();
+       amandates_started = FALSE;
+    }
+
+    for(est = est_list; est != NULL; est = est->next) {
+       run_client_scripts(EXECUTE_ON_PRE_HOST_ESTIMATE, g_options, est->dle,
+                          stdout);
+    }
 
     dumpsrunning = 0;
     need_wait = 0;
@@ -454,6 +455,8 @@ main(
                est->done = 1;
                est->child = 0;
                dumpsrunning--;
+               run_client_scripts(EXECUTE_ON_POST_DLE_ESTIMATE, g_options,
+                                  est->dle, stdout);
            }
        }
        /*
@@ -478,7 +481,7 @@ main(
            /*
             * Make sure there is no spindle conflict.
             */
-           if(est->spindle != -1) {
+           if(est->dle->spindle != -1) {
                for(est1 = est_list; est1 != NULL; est1 = est1->next) {
                    if(est1->child == 0 || est == est1 || est1->done) {
                        /*
@@ -487,7 +490,7 @@ main(
                         */
                        continue;
                    }
-                   if(est1->spindle == est->spindle) {
+                   if(est1->dle->spindle == est->dle->spindle) {
                        break;                  /* oops -- they match */
                    }
                }
@@ -503,6 +506,9 @@ main(
            }
        } else {
            done = 0;
+           run_client_scripts(EXECUTE_ON_PRE_DLE_ESTIMATE, g_options,
+                              est->dle, stdout);
+
            if((est->child = fork()) == 0) {
                calc_estimates(est);            /* child does the estimate */
                exit(0);
@@ -514,6 +520,11 @@ main(
        }
     }
 
+    for(est = est_list; est != NULL; est = est->next) {
+       run_client_scripts(EXECUTE_ON_POST_HOST_ESTIMATE, g_options, est->dle,
+                          stdout);
+    }
+
     est_prev = NULL;
     for(est = est_list; est != NULL; est = est->next) {
        free_estimates(est);
@@ -529,52 +540,87 @@ main(
     dbclose();
     return 0;
  err:
-    g_printf(_("FORMAT ERROR IN REQUEST PACKET\n"));
     if (err_extra) {
+       g_printf(_("FORMAT ERROR IN REQUEST PACKET '%s'\n"), err_extra);
        dbprintf(_("REQ packet is bogus: %s\n"), err_extra);
        amfree(err_extra);
     } else {
+       g_printf(_("ERROR FORMAT ERROR IN REQUEST PACKET\n"));
        dbprintf(_("REQ packet is bogus\n"));
     }
+
+    free_g_options(g_options);
+
     dbclose();
     return 1;
 }
 
 
 void
-add_diskest(
-    char *     disk,
-    char *     amdevice,
-    int                level,
-    int                spindle,
-    int                program_is_backup_api,
-    char *     prog,
-    char *     calcprog,
-    option_t * options)
+dle_add_diskest(
+    dle_t    *dle)
 {
     disk_estimates_t *newp, *curp;
     amandates_t *amdp;
     int dumplev, estlev;
     time_t dumpdate;
+    GSList *level;
+    char *amandates_file;
+    gboolean need_amandates = FALSE;
 
-    if (level < 0)
-       level = 0;
-    if (level >= DUMP_LEVELS)
-       level = DUMP_LEVELS - 1;
+    level = dle->level;
+    if (level == NULL) {
+       g_printf(_("ERROR Missing level in request\n"));
+       return;
+    }
+
+    /* should we use amandates for this? */
+    if (dle->calcsize)
+       need_amandates = TRUE;
+    if (strcmp(dle->program, "GNUTAR") == 0) {
+       /* GNUTAR only needs amandates if gnutar_list_dir is NULL */
+       char *gnutar_list_dir = getconf_str(CNF_GNUTAR_LIST_DIR);
+       if (!gnutar_list_dir || !*gnutar_list_dir)
+           need_amandates = TRUE;
+    }
+
+    /* start amandates here, before adding this DLE to est_list, in case
+     * we encounter an error. */
+    if (need_amandates) {
+       if (!amandates_started) {
+           amandates_file = getconf_str(CNF_AMANDATES);
+           if(!start_amandates(amandates_file, 0)) {
+               char *errstr = strerror(errno);
+               char *qamname = quote_string(dle->disk);
+               char *errmsg = vstrallocf(_("could not open %s: %s"), amandates_file, errstr);
+               char *qerrmsg = quote_string(errmsg);
+               g_printf(_("%s %d ERROR %s\n"), qamname, 0, qerrmsg);
+               amfree(qamname);
+               amfree(errmsg);
+               amfree(qerrmsg);
+               return;
+           }
+           amandates_started = TRUE;
+       }
+    }
+
+    while (level != NULL) {
+       if (GPOINTER_TO_INT(level->data) < 0)
+           level->data = GINT_TO_POINTER(0);
+       if (GPOINTER_TO_INT(level->data) >= DUMP_LEVELS)
+           level->data = GINT_TO_POINTER(DUMP_LEVELS - 1);
+       level = g_slist_next(level);
+    }
 
     for(curp = est_list; curp != NULL; curp = curp->next) {
-       if(strcmp(curp->amname, disk) == 0) {
+       if(strcmp(curp->dle->disk, dle->disk) == 0) {
            /* already have disk info, just note the level request */
-           curp->est[level].needestimate = 1;
-           if(options) {
-               free_sl(options->exclude_file);
-               free_sl(options->exclude_list);
-               free_sl(options->include_file);
-               free_sl(options->include_list);
-               amfree(options->auth);
-               amfree(options->str);
-               amfree(options);
+           level = dle->level;
+           while (level != NULL) {
+               curp->est[GPOINTER_TO_INT(level->data)].needestimate = 1;
+               level = g_slist_next(level);
            }
+
            return;
        }
     }
@@ -583,32 +629,39 @@ add_diskest(
     memset(newp, 0, SIZEOF(*newp));
     newp->next = est_list;
     est_list = newp;
-    newp->amname = stralloc(disk);
-    newp->qamname = quote_string(disk);
-    newp->amdevice = stralloc(amdevice);
-    newp->qamdevice = quote_string(amdevice);
-    newp->dirname = amname_to_dirname(newp->amdevice);
-    newp->qdirname = quote_string(newp->dirname);
-    newp->program = stralloc(prog);
-    if(calcprog != NULL)
-       newp->calcprog = stralloc(calcprog);
-    else
-       newp->calcprog = NULL;
-    newp->program_is_backup_api = program_is_backup_api;
-    newp->spindle = spindle;
-    newp->est[level].needestimate = 1;
-    newp->options = options;
+    newp->qamname = quote_string(dle->disk);
+    if (dle->device) {
+       newp->qamdevice = quote_string(dle->device);
+       newp->dirname = amname_to_dirname(dle->device);
+       newp->qdirname = quote_string(newp->dirname);
+    } else {
+       newp->qamdevice = stralloc("");
+       newp->dirname = stralloc("");
+       newp->qdirname = stralloc("");
+    }
+    level = dle->level;
+    while (level != NULL) {
+       newp->est[GPOINTER_TO_INT(level->data)].needestimate = 1;
+       level = g_slist_next(level);
+    }
+    newp->dle = dle;
 
     /* fill in dump-since dates */
-
-    amdp = amandates_lookup(newp->amname);
-
-    newp->est[0].dumpsince = EPOCH;
-    for(dumplev = 0; dumplev < DUMP_LEVELS; dumplev++) {
-       dumpdate = amdp->dates[dumplev];
-       for(estlev = dumplev+1; estlev < DUMP_LEVELS; estlev++) {
-           if(dumpdate > newp->est[estlev].dumpsince)
-               newp->est[estlev].dumpsince = dumpdate;
+    if (need_amandates) {
+       amdp = amandates_lookup(newp->dle->disk);
+
+       newp->est[0].dumpsince = EPOCH;
+       for(dumplev = 0; dumplev < DUMP_LEVELS; dumplev++) {
+           dumpdate = amdp->dates[dumplev];
+           for(estlev = dumplev+1; estlev < DUMP_LEVELS; estlev++) {
+               if(dumpdate > newp->est[estlev].dumpsince)
+                   newp->est[estlev].dumpsince = dumpdate;
+           }
+       }
+    } else {
+       /* just zero everything out */
+       for(dumplev = 0; dumplev < DUMP_LEVELS; dumplev++) {
+           newp->est[dumplev].dumpsince = 0;
        }
     }
 }
@@ -618,21 +671,12 @@ void
 free_estimates(
     disk_estimates_t * est)
 {
-    amfree(est->amname);
     amfree(est->qamname);
-    amfree(est->amdevice);
     amfree(est->qamdevice);
     amfree(est->dirname);
     amfree(est->qdirname);
-    amfree(est->program);
-    if(est->options) {
-       free_sl(est->options->exclude_file);
-       free_sl(est->options->exclude_list);
-       free_sl(est->options->include_file);
-       free_sl(est->options->include_list);
-       amfree(est->options->str);
-       amfree(est->options->auth);
-       amfree(est->options);
+    if(est->dle) {
+/* free DLE */
     }
 }
 
@@ -645,38 +689,40 @@ void
 calc_estimates(
     disk_estimates_t * est)
 {
-    dbprintf(_("calculating for amname %s, dirname %s, spindle %d\n"),
-             est->qamname, est->qdirname, est->spindle);
-       
-    if(est->program_is_backup_api ==  1)
-       backup_api_calc_estimate(est);
+    dbprintf(_("calculating for amname %s, dirname %s, spindle %d %s\n"),
+             est->qamname, est->qdirname, est->dle->spindle, est->dle->program);
+
+    if(est->dle->program_is_application_api ==  1)
+       application_api_calc_estimate(est);
+    else
+    if(est->dle->calcsize ==  1)
+       if (est->dle->device[0] == '/' && est->dle->device[1] == '/')
+           dbprintf(_("Can't use CALCSIZE for samba estimate: %s %s\n"),
+                    est->qamname, est->qdirname);
+       else
+           generic_calc_estimates(est);
     else
 #ifndef USE_GENERIC_CALCSIZE
-    if(strcmp(est->program, "DUMP") == 0)
+    if(strcmp(est->dle->program, "DUMP") == 0)
        dump_calc_estimates(est);
     else
 #endif
 #ifdef SAMBA_CLIENT
-      if (strcmp(est->program, "GNUTAR") == 0 &&
-         est->amdevice[0] == '/' && est->amdevice[1] == '/')
+      if (strcmp(est->dle->program, "GNUTAR") == 0 &&
+         est->dle->device[0] == '/' && est->dle->device[1] == '/')
        smbtar_calc_estimates(est);
       else
 #endif
 #ifdef GNUTAR
-       if (strcmp(est->program, "GNUTAR") == 0)
+       if (strcmp(est->dle->program, "GNUTAR") == 0)
          gnutar_calc_estimates(est);
        else
 #endif
-#ifdef SAMBA_CLIENT
-         if (est->amdevice[0] == '/' && est->amdevice[1] == '/')
-           dbprintf(_("Can't use CALCSIZE for samba estimate: %s %s\n"),
-                     est->qamname, est->qdirname);
-         else
-#endif
-           generic_calc_estimates(est);
+           dbprintf(_("Invalid program: %s %s %s\n"),
+                     est->qamname, est->qdirname, est->dle->program);
 
     dbprintf(_("done with amname %s dirname %s spindle %d\n"),
-             est->qamname, est->qdirname, est->spindle);
+             est->qamname, est->qdirname, est->dle->spindle);
 }
 
 /*
@@ -685,51 +731,114 @@ calc_estimates(
  */
 
 /* local functions */
-off_t getsize_dump(char *disk, char *amdevice, int level, option_t *options,
-                  char **errmsg);
-off_t getsize_smbtar(char *disk, char *amdevice, int level, option_t *options,
-                    char **errmsg);
-off_t getsize_gnutar(char *disk, char *amdevice, int level,
-                      option_t *options, time_t dumpsince, char **errmsg);
-off_t getsize_backup_api(char *program, char *disk, char *amdevice, int level,
-                       option_t *options, time_t dumpsince, char **errmsg);
+off_t getsize_dump(dle_t *dle, int level, char **errmsg);
+off_t getsize_smbtar(dle_t *dle, int level, char **errmsg);
+off_t getsize_gnutar(dle_t *dle, int level, time_t dumpsince, char **errmsg);
+off_t getsize_star(dle_t *dle, int level, time_t dumpsince, char **errmsg);
+off_t getsize_application_api(disk_estimates_t *est, int nb_level,
+                             int *levels, backup_support_option_t *bsu);
 off_t handle_dumpline(char *str);
 double first_num(char *str);
 
 void
-backup_api_calc_estimate(
+application_api_calc_estimate(
     disk_estimates_t * est)
 {
     int    level;
-    off_t  size;
-    char  *errmsg = NULL, *qerrmsg;
+    int    i;
+    int    levels[DUMP_LEVELS];
+    int    nb_level = 0;
+    backup_support_option_t *bsu;
+    GPtrArray               *errarray;
+
+    bsu = backup_support_option(est->dle->program, g_options, est->dle->disk,
+                               est->dle->device, &errarray);
+    if (!bsu) {
+       guint  i;
+       for (i=0; i < errarray->len; i++) {
+           char  *line;
+           char  *errmsg;
+           char  *qerrmsg;
+           line = g_ptr_array_index(errarray, i);
+           if(am_has_feature(g_options->features,
+                             fe_rep_sendsize_quoted_error)) {
+               errmsg = g_strdup_printf(_("Application '%s': %s"),
+                                    est->dle->program, line);
+               qerrmsg = quote_string(errmsg);
+               for (level = 0; level < DUMP_LEVELS; level++) {
+                   if (est->est[level].needestimate) {
+                       g_printf(_("%s %d ERROR %s\n"),
+                                est->dle->disk, level, qerrmsg);
+                       dbprintf(_("%s %d ERROR A %s\n"),
+                                est->qamname, level, qerrmsg);
+                   }
+               }
+               amfree(errmsg);
+               amfree(qerrmsg);
+           }
+       }
+       if (i == 0) { /* nothing in errarray */
+           char  *errmsg;
+           char  *qerrmsg;
+           errmsg = g_strdup_printf(
+               _("Application '%s': cannon execute support command"),
+               est->dle->program);
+           qerrmsg = quote_string(errmsg);
+           for (level = 0; level < DUMP_LEVELS; level++) {
+               if (est->est[level].needestimate) {
+                   g_printf(_("%s %d ERROR %s\n"),
+                            est->dle->disk, level, qerrmsg);
+                   dbprintf(_("%s %d ERROR %s\n"),
+                            est->qamname, level, qerrmsg);
+               }
+           }
+           amfree(errmsg);
+           amfree(qerrmsg);
+       }
+       for (level = 0; level < DUMP_LEVELS; level++) {
+           est->est[level].needestimate = 0;
+       }
+       g_ptr_array_free(errarray, TRUE);
+    }
 
     for(level = 0; level < DUMP_LEVELS; level++) {
        if (est->est[level].needestimate) {
-           dbprintf(_("getting size via application API for %s %s level %d\n"),
-                     est->qamname, est->qamdevice, level);
-           size = getsize_backup_api(est->program, est->amname, est->amdevice,
-                                     level, est->options,
-                                     est->est[level].dumpsince, &errmsg);
+           if (level > bsu->max_level) {
+               /* planner will not even consider this level */
+               g_printf("%s %d SIZE %lld\n", est->qamname, level,
+                        (long long)-2);
+               est->est[level].needestimate = 0;
+           } else if (est->dle->estimate == ES_SERVER) {
+               /* planner will consider this level, */
+               /* but use a server-side estimate    */
+               g_printf("%s %d SIZE %lld\n", est->qamname, level,
+                        (long long)-1);
+               est->est[level].needestimate = 0;
+           } else {
+               levels[nb_level++] = level;
+           }
+       }
+    }
 
-           amflock(1, "size");
+    if (nb_level == 0)
+       return;
 
-           g_printf(_("%s %d SIZE %lld\n"), est->qamname, level,
-                  (long long)size);
-           if (errmsg && errmsg[0] != '\0') {
-               if(am_has_feature(g_options->features,
-                                 fe_rep_sendsize_quoted_error)) {
-                   qerrmsg = quote_string(errmsg);
-                   dbprintf(_("errmsg is %s\n"), errmsg);
-                   g_printf(_("%s %d ERROR %s\n"),
-                          est->qamname, level, qerrmsg);
-                   amfree(qerrmsg);
-               }
-           }
-           amfree(errmsg);
-           fflush(stdout);
+    if (bsu->multi_estimate) {
+       for (i=0;i<nb_level;i++) {
+           dbprintf(_("getting size via application API for %s %s level %d\n"),
+                    est->qamname, est->qamdevice, levels[i]);
+       }
+       getsize_application_api(est, nb_level, levels, bsu);
 
-           amfunlock(1, "size");
+    } else {
+       for(level = 0; level < DUMP_LEVELS; level++) {
+           if (est->est[level].needestimate) {
+               dbprintf(
+                   _("getting size via application API for %s %s level %d\n"),
+                   est->qamname, est->qamdevice, level);
+               levels[0] = level;
+               getsize_application_api(est, 1, levels, bsu);
+           }
        }
     }
 }
@@ -758,6 +867,7 @@ generic_calc_estimates(
     amwait_t wait_status;
     char *errmsg = NULL, *qerrmsg;
     char tmppath[PATH_MAX];
+    int len;
 
     cmd = vstralloc(amlibexecdir, "/", "calcsize", versionsuffix(), NULL);
 
@@ -769,28 +879,25 @@ generic_calc_estimates(
     else
        my_argv[my_argc++] = stralloc("NOCONFIG");
 
-    my_argv[my_argc++] = stralloc(est->calcprog);
-
-    my_argv[my_argc++] = stralloc(est->amname);
+    my_argv[my_argc++] = stralloc(est->dle->program);
+    canonicalize_pathname(est->dle->disk, tmppath);
+    my_argv[my_argc++] = stralloc(tmppath);
     canonicalize_pathname(est->dirname, tmppath);
     my_argv[my_argc++] = stralloc(tmppath);
 
+    if (est->dle->exclude_file)
+       nb_exclude += est->dle->exclude_file->nb_element;
+    if (est->dle->exclude_list)
+       nb_exclude += est->dle->exclude_list->nb_element;
+    if (est->dle->include_file)
+       nb_include += est->dle->include_file->nb_element;
+    if (est->dle->include_list)
+       nb_include += est->dle->include_list->nb_element;
 
-    if(est->options->exclude_file)
-       nb_exclude += est->options->exclude_file->nb_element;
-    if(est->options->exclude_list)
-       nb_exclude += est->options->exclude_list->nb_element;
-    if(est->options->include_file)
-       nb_include += est->options->include_file->nb_element;
-    if(est->options->include_list)
-       nb_include += est->options->include_list->nb_element;
-
-    if(nb_exclude > 0)
-       file_exclude = build_exclude(est->amname,
-               est->amdevice, est->options, 0);
-    if(nb_include > 0)
-       file_include = build_include(est->amname,
-               est->amdevice, est->options, 0);
+    if (nb_exclude > 0)
+       file_exclude = build_exclude(est->dle, 0);
+    if (nb_include > 0)
+       file_include = build_include(est->dle, 0);
 
     if(file_exclude) {
        my_argv[my_argc++] = stralloc("-X");
@@ -832,7 +939,8 @@ generic_calc_estimates(
        goto common_exit;
     }
 
-    calcpid = pipespawnv(cmd, STDERR_PIPE, &nullfd, &nullfd, &pipefd, my_argv);
+    calcpid = pipespawnv(cmd, STDERR_PIPE, 0,
+                        &nullfd, &nullfd, &pipefd, my_argv);
     amfree(cmd);
 
     dumpout = fdopen(pipefd,"r");
@@ -840,12 +948,15 @@ generic_calc_estimates(
        error(_("Can't fdopen: %s"), strerror(errno));
        /*NOTREACHED*/
     }
-    match_expr = vstralloc(est->qamname," %d SIZE %lld", NULL);
+    match_expr = vstralloc(" %d SIZE %lld", NULL);
+    len = strlen(est->qamname);
     for(size = (off_t)-1; (line = agets(dumpout)) != NULL; free(line)) {
        long long size_ = (long long)0;
-       if (line[0] == '\0')
+       if (line[0] == '\0' || (int)strlen(line) <= len)
            continue;
-       if(sscanf(line, match_expr, &level, &size_) == 2) {
+       /* Don't use sscanf for est->qamname because it can have a '%'. */
+       if (strncmp(line, est->qamname, len) == 0 &&
+           sscanf(line+len, match_expr, &level, &size_) == 2) {
            g_printf("%s\n", line); /* write to amandad */
            dbprintf(_("estimate size for %s level %d: %lld KB\n"),
                      est->qamname,
@@ -914,8 +1025,7 @@ dump_calc_estimates(
        if(est->est[level].needestimate) {
            dbprintf(_("getting size via dump for %s level %d\n"),
                      est->qamname, level);
-           size = getsize_dump(est->amname, est->amdevice,
-                               level, est->options, &errmsg);
+           size = getsize_dump(est->dle, level, &errmsg);
 
            amflock(1, "size");
 
@@ -952,8 +1062,7 @@ smbtar_calc_estimates(
        if(est->est[level].needestimate) {
            dbprintf(_("getting size via smbclient for %s level %d\n"),
                      est->qamname, level);
-           size = getsize_smbtar(est->amname, est->amdevice, level,
-                                 est->options, &errmsg);
+           size = getsize_smbtar(est->dle, level, &errmsg);
 
            amflock(1, "size");
 
@@ -991,8 +1100,8 @@ gnutar_calc_estimates(
        if (est->est[level].needestimate) {
            dbprintf(_("getting size via gnutar for %s level %d\n"),
                      est->qamname, level);
-           size = getsize_gnutar(est->amname, est->amdevice, level,
-                                 est->options, est->est[level].dumpsince,
+           size = getsize_gnutar(est->dle, level,
+                                 est->est[level].dumpsince,
                                  &errmsg);
 
            amflock(1, "size");
@@ -1084,10 +1193,8 @@ regex_scale_t re_size[] = {
 
 off_t
 getsize_dump(
-    char       *disk,
-    char       *amdevice,
+    dle_t      *dle,
     int                level,
-    option_t   *options G_GNUC_UNUSED,
     char      **errmsg)
 {
     int pipefd[2], nullfd, stdoutfd, killctl[2];
@@ -1104,7 +1211,7 @@ getsize_dump(
     char level_str[NUM_STR_SIZE];
     int s;
     times_t start_time;
-    char *qdisk = quote_string(disk);
+    char *qdisk = quote_string(dle->disk);
     char *qdevice;
     char *config;
     amwait_t wait_status;
@@ -1112,11 +1219,17 @@ getsize_dump(
     int is_rundump = 1;
 #endif
 
+    if (level > 9)
+       return -2; /* planner will not even consider this level */
+    if (dle->estimate == ES_SERVER)
+       return -1; /* planner will consider this level, */
+                  /* but use a server-side estimate    */
+
     g_snprintf(level_str, SIZEOF(level_str), "%d", level);
 
-    device = amname_to_devname(amdevice);
+    device = amname_to_devname(dle->device);
     qdevice = quote_string(device);
-    fstype = amname_to_fstype(amdevice);
+    fstype = amname_to_fstype(dle->device);
 
     dbprintf(_("calculating for device %s with %s\n"),
              qdevice, fstype);
@@ -1455,7 +1568,7 @@ getsize_dump(
                    cmd, name);
     } else if(size == (off_t)0 && level == 0) {
        dbprintf(_("possible %s%s problem -- is \"%s\" really empty?\n"),
-                 cmd, name, disk);
+                 cmd, name, dle->disk);
        dbprintf(".....\n");
     } else {
            dbprintf(_("estimate size for %s level %d: %lld KB\n"),
@@ -1536,10 +1649,8 @@ getsize_dump(
 #ifdef SAMBA_CLIENT
 off_t
 getsize_smbtar(
-    char       *disk,
-    char       *amdevice,
+    dle_t      *dle,
     int                level,
-    option_t   *options,
     char      **errmsg)
 {
     int pipefd = -1, nullfd = -1, passwdfd = -1;
@@ -1555,14 +1666,18 @@ getsize_smbtar(
     char *pw_fd_env;
     times_t start_time;
     char *error_pn = NULL;
-    char *qdisk = quote_string(disk);
+    char *qdisk = quote_string(dle->disk);
     amwait_t wait_status;
 
-    (void)options;     /* Quiet unused parameter warning */
-
     error_pn = stralloc2(get_pname(), "-smbclient");
 
-    parsesharename(amdevice, &share, &subdir);
+    if (level > 1)
+       return -2; /* planner will not even consider this level */
+    if (dle->estimate == ES_SERVER)
+       return -1; /* planner will consider this level, */
+                  /* but use a server-side estimate    */
+
+    parsesharename(dle->device, &share, &subdir);
     if (!share) {
        amfree(share);
        amfree(subdir);
@@ -1587,7 +1702,7 @@ getsize_smbtar(
        }
        set_pname(error_pn);
        amfree(error_pn);
-       error(_("cannot find password for %s"), disk);
+       error(_("cannot find password for %s"), dle->disk);
        /*NOTREACHED*/
     }
     lpass = strlen(user_and_password);
@@ -1600,7 +1715,7 @@ getsize_smbtar(
        }
        set_pname(error_pn);
        amfree(error_pn);
-       error(_("password field not \'user%%pass\' for %s"), disk);
+       error(_("password field not \'user%%pass\' for %s"), dle->disk);
        /*NOTREACHED*/
     }
     *pwtext++ = '\0';
@@ -1651,7 +1766,7 @@ getsize_smbtar(
     } else {
        pw_fd_env = "dummy_PASSWD_FD";
     }
-    dumppid = pipespawn(SAMBA_CLIENT, STDERR_PIPE|PASSWD_PIPE,
+    dumppid = pipespawn(SAMBA_CLIENT, STDERR_PIPE|PASSWD_PIPE, 0,
              &nullfd, &nullfd, &pipefd, 
              pw_fd_env, &passwdfd,
              "smbclient",
@@ -1673,7 +1788,7 @@ getsize_smbtar(
        amfree(domain);
     }
     aclose(nullfd);
-    if(pwtext_len > 0 && fullwrite(passwdfd, pwtext, (size_t)pwtext_len) < 0) {
+    if(pwtext_len > 0 && full_write(passwdfd, pwtext, pwtext_len) < pwtext_len) {
        int save_errno = errno;
 
        memset(user_and_password, '\0', (size_t)lpass);
@@ -1730,7 +1845,7 @@ getsize_smbtar(
        dbprintf(".....\n");
     } else if(size == (off_t)0 && level == 0) {
        dbprintf(_("possible %s problem -- is \"%s\" really empty?\n"),
-                 SAMBA_CLIENT, disk);
+                 SAMBA_CLIENT, dle->disk);
        dbprintf(".....\n");
     }
     dbprintf(_("estimate size for %s level %d: %lld KB\n"),
@@ -1772,10 +1887,8 @@ getsize_smbtar(
 #ifdef GNUTAR
 off_t
 getsize_gnutar(
-    char       *disk,
-    char       *amdevice,
+    dle_t      *dle,
     int                level,
-    option_t   *options,
     time_t     dumpsince,
     char      **errmsg)
 {
@@ -1803,18 +1916,24 @@ getsize_gnutar(
     int infd, outfd;
     ssize_t nb;
     char buf[32768];
-    char *qdisk = quote_string(disk);
+    char *qdisk = quote_string(dle->disk);
     char *gnutar_list_dir;
     amwait_t wait_status;
     char tmppath[PATH_MAX];
 
-    if(options->exclude_file) nb_exclude += options->exclude_file->nb_element;
-    if(options->exclude_list) nb_exclude += options->exclude_list->nb_element;
-    if(options->include_file) nb_include += options->include_file->nb_element;
-    if(options->include_list) nb_include += options->include_list->nb_element;
+    if (level > 9)
+       return -2; /* planner will not even consider this level */
+    if (dle->estimate == ES_SERVER)
+       return -1; /* planner will consider this level, */
+                  /* but use a server-side estimate    */
+
+    if(dle->exclude_file) nb_exclude += dle->exclude_file->nb_element;
+    if(dle->exclude_list) nb_exclude += dle->exclude_list->nb_element;
+    if(dle->include_file) nb_include += dle->include_file->nb_element;
+    if(dle->include_list) nb_include += dle->include_list->nb_element;
 
-    if(nb_exclude > 0) file_exclude = build_exclude(disk, amdevice, options, 0);
-    if(nb_include > 0) file_include = build_include(disk, amdevice, options, 0);
+    if(nb_exclude > 0) file_exclude = build_exclude(dle, 0);
+    if(nb_include > 0) file_include = build_include(dle, 0);
 
     my_argv = alloc(SIZEOF(char *) * 22);
     i = 0;
@@ -1825,7 +1944,7 @@ getsize_gnutar(
     if (gnutar_list_dir) {
        char number[NUM_STR_SIZE];
        int baselevel;
-       char *sdisk = sanitise_filename(disk);
+       char *sdisk = sanitise_filename(dle->disk);
 
        basename = vstralloc(gnutar_list_dir,
                             "/",
@@ -1876,7 +1995,7 @@ getsize_gnutar(
        }
 
        while ((nb = read(infd, &buf, SIZEOF(buf))) > 0) {
-           if (fullwrite(outfd, &buf, (size_t)nb) < nb) {
+           if (full_write(outfd, &buf, (size_t)nb) < (size_t)nb) {
                *errmsg = vstrallocf(_("writing to %s: %s"),
                                     incrname, strerror(errno));
                dbprintf("%s\n", *errmsg);
@@ -1914,7 +2033,7 @@ getsize_gnutar(
                gmtm->tm_year + 1900, gmtm->tm_mon+1, gmtm->tm_mday,
                gmtm->tm_hour, gmtm->tm_min, gmtm->tm_sec);
 
-    dirname = amname_to_dirname(amdevice);
+    dirname = amname_to_dirname(dle->device);
 
     cmd = vstralloc(amlibexecdir, "/", "runtar", versionsuffix(), NULL);
     my_argv[i++] = "runtar";
@@ -1931,6 +2050,9 @@ getsize_gnutar(
     my_argv[i++] = "--create";
     my_argv[i++] = "--file";
     my_argv[i++] = "/dev/null";
+    /* use --numeric-owner for estimates, to reduce the number of user/group
+     * lookups required */
+    my_argv[i++] = "--numeric-owner";
     my_argv[i++] = "--directory";
     canonicalize_pathname(dirname, tmppath);
     my_argv[i++] = tmppath;
@@ -1978,7 +2100,8 @@ getsize_gnutar(
        goto common_exit;
     }
 
-    dumppid = pipespawnv(cmd, STDERR_PIPE, &nullfd, &nullfd, &pipefd, my_argv);
+    dumppid = pipespawnv(cmd, STDERR_PIPE, 0,
+                        &nullfd, &nullfd, &pipefd, my_argv);
 
     dumpout = fdopen(pipefd,"r");
     if (!dumpout) {
@@ -2019,7 +2142,7 @@ getsize_gnutar(
        dbprintf(".....\n");
     } else if(size == (off_t)0 && level == 0) {
        dbprintf(_("possible %s problem -- is \"%s\" really empty?\n"),
-                 my_argv[0], disk);
+                 my_argv[0], dle->disk);
        dbprintf(".....\n");
     }
     dbprintf(_("estimate size for %s level %d: %lld KB\n"),
@@ -2072,48 +2195,47 @@ common_exit:
 #endif
 
 off_t
-getsize_backup_api(
-    char       *program,
-    char       *disk,
-    char       *amdevice,
-    int                 level,
-    option_t   *options,
-    time_t      dumpsince,
-    char        **errmsg)
+getsize_application_api(
+    disk_estimates_t         *est,
+    int                              nb_level,
+    int                             *levels,
+    backup_support_option_t  *bsu)
 {
-    int pipeinfd[2], pipeoutfd[2], nullfd;
+    dle_t *dle = est->dle;
+    int pipeinfd[2], pipeoutfd[2], pipeerrfd[2];
     pid_t dumppid;
     off_t size = (off_t)-1;
-    FILE *dumpout, *toolin;
+    FILE *dumpout;
+    FILE *dumperr;
     char *line = NULL;
     char *cmd = NULL;
     char *cmdline;
-    char dumptimestr[80];
-    struct tm *gmtm;
-    int  i, j;
-    char *argvchild[10];
+    int  i, j, k;
+    char **argvchild;
     char *newoptstr = NULL;
     off_t size1, size2;
     times_t start_time;
-    char *qdisk = quote_string(disk);
-    char *qamdevice = quote_string(amdevice);
+    char *qdisk = quote_string(dle->disk);
+    char *qamdevice = quote_string(dle->device);
     amwait_t wait_status;
     char levelstr[NUM_STR_SIZE];
-    backup_support_option_t *bsu;
+    GSList   *scriptlist;
+    script_t *script;
+    char     *errmsg = NULL;
 
-    (void)options;
-    gmtm = gmtime(&dumpsince);
-    g_snprintf(dumptimestr, SIZEOF(dumptimestr),
-               "%04d-%02d-%02d %2d:%02d:%02d GMT",
-               gmtm->tm_year + 1900, gmtm->tm_mon+1, gmtm->tm_mday,
-               gmtm->tm_hour, gmtm->tm_min, gmtm->tm_sec);
-
-    cmd = vstralloc(DUMPER_DIR, "/", program, NULL);
-
-    bsu = backup_support_option(program, g_options, disk, amdevice);
+    cmd = vstralloc(APPLICATION_DIR, "/", dle->program, NULL);
 
     i=0;
-    argvchild[i++] = program;
+    k = application_property_argv_size(dle);
+    for (scriptlist = dle->scriptlist; scriptlist != NULL;
+        scriptlist = scriptlist->next) {
+       script = (script_t *)scriptlist->data;
+       if (script->result && script->result->proplist) {
+           k += property_argv_size(script->result->proplist);
+       }
+    }
+    argvchild = g_new0(char *, 16 + k + DUMP_LEVELS*2);
+    argvchild[i++] = dle->program;
     argvchild[i++] = "estimate";
     if (bsu->message_line == 1) {
        argvchild[i++] = "--message";
@@ -2128,43 +2250,54 @@ getsize_backup_api(
        argvchild[i++] = g_options->hostname;
     }
     argvchild[i++] = "--device";
-    argvchild[i++] = amdevice;
-    if (disk && bsu->disk == 1) {
+    argvchild[i++] = dle->device;
+    if (dle->disk && bsu->disk == 1) {
        argvchild[i++] = "--disk";
-       argvchild[i++] = disk;
+       argvchild[i++] = dle->disk;
     }
-    if (level <= bsu->max_level) {
+    for (j=0; j < nb_level; j++) {
        argvchild[i++] = "--level";
-       g_snprintf(levelstr,SIZEOF(levelstr),"%d",level);
-       argvchild[i++] = levelstr;
+       g_snprintf(levelstr,SIZEOF(levelstr),"%d", levels[j]);
+       argvchild[i++] = stralloc(levelstr);
+    }
+    if (dle->calcsize && bsu->calcsize) {
+       argvchild[i++] = "--calcsize";
+    }
+
+    i += application_property_add_to_argv(&argvchild[i], dle, bsu);
+
+    for (scriptlist = dle->scriptlist; scriptlist != NULL;
+        scriptlist = scriptlist->next) {
+       script = (script_t *)scriptlist->data;
+       if (script->result && script->result->proplist) {
+           i += property_add_to_argv(&argvchild[i],
+                                     script->result->proplist);
+       }
     }
 
     argvchild[i] = NULL;
 
     cmdline = stralloc(cmd);
     for(j = 1; j < i; j++)
-       cmdline = vstrextend(&cmdline, " ", argvchild[i], NULL);
+       cmdline = vstrextend(&cmdline, " ", argvchild[j], NULL);
     dbprintf("running: \"%s\"\n", cmdline);
     amfree(cmdline);
 
-    if ((nullfd = open("/dev/null", O_RDWR)) == -1) {
-       *errmsg = vstrallocf(_("Cannot access /dev/null : %s"),
-                            strerror(errno));
-       dbprintf("%s\n", *errmsg);
+    if (pipe(pipeerrfd) < 0) {
+       errmsg = vstrallocf(_("getsize_application_api could not create data pipes: %s"),
+                           strerror(errno));
        goto common_exit;
     }
 
     if (pipe(pipeinfd) < 0) {
-       *errmsg = vstrallocf(_("getsize_backup_api could create data pipes: %s"),
-                            strerror(errno));
-       dbprintf("%s\n", *errmsg);
+       errmsg = vstrallocf(_("getsize_application_api could not create data pipes: %s"),
+                           strerror(errno));
        goto common_exit;
     }
 
     if (pipe(pipeoutfd) < 0) {
-       *errmsg = vstrallocf(_("getsize_backup_api could create data pipes: %s"),
-                            strerror(errno));
-       dbprintf("%s\n", *errmsg);
+       errmsg = vstrallocf(_("getsize_application_api could not create data pipes: %s"),
+                           strerror(errno));
        goto common_exit;
     }
 
@@ -2179,9 +2312,10 @@ getsize_backup_api(
     case 0:
       dup2(pipeinfd[0], 0);
       dup2(pipeoutfd[1], 1);
-      dup2(nullfd, 2);
+      dup2(pipeerrfd[1], 2);
       aclose(pipeinfd[1]);
       aclose(pipeoutfd[0]);
+      aclose(pipeerrfd[0]);
       safe_fd(-1, 0);
 
       execve(cmd, argvchild, safe_env());
@@ -2192,16 +2326,8 @@ getsize_backup_api(
 
     aclose(pipeinfd[0]);
     aclose(pipeoutfd[1]);
-
-    toolin = fdopen(pipeinfd[1],"w");
-    if (!toolin) {
-       error("Can't fdopen: %s", strerror(errno));
-       /*NOTREACHED*/
-    }
-
-    output_tool_property(toolin, options);
-    fflush(toolin);
-    fclose(toolin);
+    aclose(pipeerrfd[1]);
+    aclose(pipeinfd[1]);
 
     dumpout = fdopen(pipeoutfd[0],"r");
     if (!dumpout) {
@@ -2212,69 +2338,102 @@ getsize_backup_api(
     for(size = (off_t)-1; (line = agets(dumpout)) != NULL; free(line)) {
        long long size1_ = (long long)0;
        long long size2_ = (long long)0;
+       int  level = 0;
        if (line[0] == '\0')
            continue;
        dbprintf("%s\n", line);
-       i = sscanf(line, "%lld %lld", &size1_, &size2_);
+       if (strncmp(line,"ERROR ", 6) == 0) {
+           char *errmsg, *qerrmsg;
+
+           errmsg = stralloc(line+6);
+           qerrmsg = quote_string(errmsg);
+           dbprintf(_("errmsg is %s\n"), errmsg);
+           g_printf(_("%s %d ERROR %s\n"), est->qamname, levels[0], qerrmsg);
+           amfree(qerrmsg);
+           continue;
+       }
+       i = sscanf(line, "%d %lld %lld", &level, &size1_, &size2_);
+       if (i != 3) {
+           i = sscanf(line, "%lld %lld", &size1_, &size2_);
+           level = levels[0];
+           if (i != 2) {
+               char *errmsg, *qerrmsg;
+
+               errmsg = vstrallocf(_("bad line %s"), line);
+               qerrmsg = quote_string(errmsg);
+               dbprintf(_("errmsg is %s\n"), errmsg);
+               g_printf(_("%s %d ERROR %s\n"), est->qamname, levels[0], qerrmsg);
+               amfree(qerrmsg);
+               continue;
+           }
+       }
        size1 = (off_t)size1_;
        size2 = (off_t)size2_;
-       if(i == 2) {
+       if (size1 <= 0 || size2 <=0)
+           size = -1;
+       else if (size1 * size2 > 0)
            size = size1 * size2;
-       }
-       if(size > -1) {
-           amfree(line);
-           while ((line = agets(dumpout)) != NULL) {
-               if (line[0] != '\0')
-                   break;
-               amfree(line);
-           }
-           if(line != NULL) {
-               dbprintf(_("%s\n"), line);
+       dbprintf(_("estimate size for %s level %d: %lld KB\n"),
+                qamdevice,
+                level,
+                (long long)size);
+       g_printf("%s %d SIZE %lld\n", est->qamname, level, (long long)size);
+    }
+    amfree(line);
+
+    dumperr = fdopen(pipeerrfd[0],"r");
+    if (!dumperr) {
+       error(_("Can't fdopen: %s"), strerror(errno));
+       /*NOTREACHED*/
+    }
+
+    while ((line = agets(dumperr)) != NULL) {
+           if (strlen(line) > 0) {
+           char *err =  g_strdup_printf(_("Application '%s': %s"),
+                                        dle->program, line);
+           char *qerr = quote_string(err);
+           for (j=0; j < nb_level; j++) {
+               fprintf(stdout, "%s %d ERROR %s\n",
+                       est->qamname, levels[j], qerr);
            }
-           break;
+           dbprintf("ERROR %s", qerr);
+           amfree(err);
+           amfree(qerr);
        }
+       amfree(line);
     }
-    amfree(line);
 
     dbprintf(".....\n");
-    dbprintf(_("estimate time for %s level %d: %s\n"), qamdevice, level,
-             walltime_str(timessub(curclock(), start_time)));
-    if(size == (off_t)-1) {
-       *errmsg = vstrallocf(_("no size line match in %s output"), cmd);
-       dbprintf(_("%s for %s\n"), cmd, qdisk);
-       dbprintf(".....\n");
-    } else if(size == (off_t)0 && level == 0) {
-       dbprintf(_("possible %s problem -- is \"%s\" really empty?\n"),
-                 cmd, qdisk);
-       dbprintf(".....\n");
+    if (nb_level == 1) {
+       dbprintf(_("estimate time for %s level %d: %s\n"), qamdevice,
+                levels[0], walltime_str(timessub(curclock(), start_time)));
+    } else {
+       dbprintf(_("estimate time for %s all level: %s\n"), qamdevice,
+                walltime_str(timessub(curclock(), start_time)));
     }
-    dbprintf(_("estimate size for %s level %d: %lld KB\n"),
-             qamdevice,
-             level,
-             (long long)size);
 
     kill(-dumppid, SIGTERM);
 
     dbprintf(_("waiting for %s \"%s\" child\n"), cmd, qdisk);
     waitpid(dumppid, &wait_status, 0);
     if (WIFSIGNALED(wait_status)) {
-       *errmsg = vstrallocf(_("%s terminated with signal %d: see %s"),
-                            cmd, WTERMSIG(wait_status), dbfn());
+       errmsg = vstrallocf(_("%s terminated with signal %d: see %s"),
+                           cmd, WTERMSIG(wait_status), dbfn());
     } else if (WIFEXITED(wait_status)) {
        if (WEXITSTATUS(wait_status) != 0) {
-           *errmsg = vstrallocf(_("%s exited with status %d: see %s"), cmd,
-                                WEXITSTATUS(wait_status), dbfn());
+           errmsg = vstrallocf(_("%s exited with status %d: see %s"), cmd,
+                               WEXITSTATUS(wait_status), dbfn());
        } else {
            /* Normal exit */
        }
     } else {
-       *errmsg = vstrallocf(_("%s got bad exit: see %s"),
-                            cmd, dbfn());
+       errmsg = vstrallocf(_("%s got bad exit: see %s"),
+                           cmd, dbfn());
     }
     dbprintf(_("after %s %s wait\n"), cmd, qdisk);
 
-    aclose(nullfd);
     afclose(dumpout);
+    afclose(dumperr);
 
 common_exit:
 
@@ -2282,6 +2441,15 @@ common_exit:
     amfree(newoptstr);
     amfree(qdisk);
     amfree(qamdevice);
+    if (errmsg) {
+       char *qerrmsg = quote_string(errmsg);
+       dbprintf(_("errmsg is %s\n"), errmsg);
+       for (j=0; j < nb_level; j++) {
+           g_printf(_("%s %d ERROR %s\n"), est->qamname, levels[j], qerrmsg);
+       }
+       amfree(errmsg);
+       amfree(qerrmsg);
+    }
     return size;
 }
 
index 91a42a1159cf478454660984dc59f8fba5ae13a2..daaf7b41115b96025cdb5d6abb7203418e588615 100644 (file)
@@ -19,6 +19,7 @@ libamanda_la_SOURCES =                \
        alloc.c                 \
        amfeatures.c            \
        amflock.c               \
+       amxml.c                 \
        clock.c                 \
        columnar.c              \
        conffile.c              \
@@ -32,14 +33,16 @@ libamanda_la_SOURCES =              \
        packet.c                \
        pipespawn.c             \
        protocol.c              \
+       queueing.c              \
+       semaphore.c             \
        security.c              \
        security-util.c         \
+       simpleprng.c            \
        sl.c                    \
        sockaddr-util.c         \
        stream.c                \
        tapelist.c              \
        timestamp.c             \
-       token.c                 \
        util.c                  \
        versuff.c
 # version.c is generated; see below
@@ -94,6 +97,7 @@ libamanda_la_LDFLAGS =  -release $(VERSION)
 noinst_HEADERS =               \
        amanda.h                \
        amfeatures.h            \
+       amxml.h                 \
        arglist.h               \
        clock.h                 \
        columnar.h              \
@@ -109,14 +113,16 @@ noinst_HEADERS =          \
        pipespawn.h             \
        protocol.h              \
        queue.h                 \
+       queueing.h              \
+       semaphore.h             \
        security.h              \
        security-util.h         \
+       simpleprng.h            \
        sl.h                    \
        sockaddr-util.h         \
        stream.h                \
        tapelist.h              \
        timestamp.h             \
-       token.h                 \
        util.h                  \
        version.h
 
@@ -150,7 +156,7 @@ version.c: genversion$(EXEEXT)
 BUILT_SOURCES += genversion.h version.c
 
 # these are used for testing only:
-TEST_PROGS = token file bsdsecurity amfeatures
+TEST_PROGS = file bsdsecurity amfeatures
 
 CLEANFILES += *.test.c
 DISTCLEANFILES += version.c genversion genversion.h
@@ -169,9 +175,6 @@ STANDARD_COMMON_STUFF = \
        $(STANDARD_COMMON_STUFF_NOT_FILE) \
        file.lo
 
-token_SOURCES = token.test.c
-token_LDADD = $(libamanda_la_LIBADD) $(STANDARD_COMMON_STUFF)
-
 file_SOURCES = file.test.c
 file_LDADD = $(libamanda_la_LIBADD) $(STANDARD_COMMON_STUFF_NOT_FILE)
 
@@ -191,20 +194,52 @@ bsdsecurity_LDADD = $(libamanda_a_LIBADD) \
 amfeatures_SOURCES = amfeatures.test.c
 amfeatures_LDADD = $(libamanda_la_LIBADD) $(STANDARD_COMMON_STUFF)
 
+# libtestutils.la
+#
+# Convenience library (never installed) for 'make check'-based tests.
+
+noinst_LTLIBRARIES = libtestutils.la
+libtestutils_la_SOURCES = \
+       testutils.c \
+       testutils.h
+
 # automake-style tests
 
-TESTS = amflock-test
+# automake-style tests
+
+TESTS = amflock-test event-test semaphore-test queueing-test quoting-test
 noinst_PROGRAMS = $(TESTS)
 
 amflock_test_SOURCES = amflock-test.c
-amflock_test_LDADD = libamanda.la
+amflock_test_LDADD = libamanda.la libtestutils.la
+
+event_test_SOURCES = event-test.c
+event_test_LDADD = libamanda.la libtestutils.la
+
+semaphore_test_SOURCES = semaphore-test.c
+semaphore_test_LDADD = libamanda.la libtestutils.la
+
+queueing_test_SOURCES = queueing-test.c
+queueing_test_LDADD = libamanda.la libtestutils.la
+
+quoting_test_SOURCES = quoting-test.c
+quoting_test_LDADD = libamanda.la libtestutils.la
 
 # scripts
 
-# divide scripts up both by language and by destination directory.
-sbin_SCRIPTS_PERL = \
+# divide scripts up both by language, by destination directory, and by whether they
+# should get checked (stuff in *_SCRIPTS_* isn't syntax checked; this is necessary
+# for perl scripts that use Amanda::* packages)
+sbin_CHECK_PERL = \
            amgpgcrypt \
-           amcryptsimple
+           amcryptsimple \
+           amgetconf
+sbin_SCRIPTS_PERL = \
+           $(sbin_CHECK_PERL)
+
+amlibexec_CHECK_PERL =
+amlibexec_SCRIPTS_PERL = \
+           $(amlibexec_CHECK_PERL)
 
 sbin_SCRIPTS_SHELL = \
            amcrypt \
@@ -212,16 +247,17 @@ sbin_SCRIPTS_SHELL = \
            amcrypt-ossl \
            amcrypt-ossl-asym
 
-amlibexec_SCRIPTS_PERL = 
+amlibexec_SCRIPTS_SHELL = 
 
 SCRIPTS_INCLUDE = \
            amanda-sh-lib.sh
 
 EXTRA_DIST += amanda-sh-lib.sh.in
 
-CHECK_PERL = $(sbin_SCRIPTS_PERL) $(amlibexec_SCRIPTS_PERL)
-SCRIPTS_PERL = $(CHECK_PERL)
+CHECK_PERL = $(sbin_CHECK_PERL) $(amlibexec_CHECK_PERL)
+SCRIPTS_PERL = $(sbin_SCRIPTS_PERL) $(amlibexec_SCRIPTS_PERL)
 SCRIPTS_SHELL = $(sbin_SCRIPTS_SHELL) $(amlibexec_SCRIPTS_SHELL)
+
 amlibexec_DATA = $(SCRIPTS_INCLUDE)
 amlibexec_SCRIPTS = $(amlibexec_SCRIPTS_PERL) $(amlibexec_SCRIPTS_SHELL)
 sbin_SCRIPTS = $(sbin_SCRIPTS_PERL) $(sbin_SCRIPTS_SHELL)
@@ -246,3 +282,7 @@ listlibsrc:
 %.test.c: $(srcdir)/%.c
        echo '#define TEST' >$@
        echo '#include "$<"' >>$@
+
+distclean-local:
+       if test `cd $(srcdir) && pwd` != `pwd`; then rm -f svn-info.h; fi
+MAINTAINERCLEANFILES+=svn-info.h
index b88a9732f9f66144c8d89d553614d0037b8e52c6..b6457936e87bddc199999a67d25f7c89f5ea7952 100644 (file)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  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.
@@ -17,7 +17,7 @@
 # Makefile for Amanda library.
 
 # vim:ft=automake
-# Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
 # 
 # This library is free software; you can redistribute it and/or modify it
 # under the terms of the GNU Lesser General Public License version 2.1 as 
 # along with this library; if not, write to the Free Software Foundation,
 # Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
 # 
-# Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
-# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 
 # simple include file to pre-define variables which are then +='d by other
 # scripts in this directory.
 
 # vim:ft=automake
-# Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
 # 
 # This library is free software; you can redistribute it and/or modify it
 # under the terms of the GNU Lesser General Public License version 2.1 as 
@@ -54,8 +54,8 @@
 # along with this library; if not, write to the Free Software Foundation,
 # Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
 # 
-# Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
-# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 
 # SYNOPSIS:
 #
 # Files which support it are syntax-checked when the user invokes 'make check'.
 #
 # All *target* filenames must be listed in SCRIPTS_SHELL, SCRIPTS_PERL, and 
-# SCRIPTS_AWK to support 'make check', 'make dist', and 'make distclean'.
+# SCRIPTS_AWK to support 'make check', 'make dist', and 'make distclean'. No
+# files which are not substituted by config.status should be included in
+# SCRIPTS_PERL, SCRIPTS_SHELL, or SCRIPTS_AWK.  If non-generated files are listed
+# for installation, then Automake will figure out that they should be distributed;
+# otherwise, include them in EXTRA_DIST.
 #
 # USAGE:
 #
 #   SCRIPTS_PERL = fooscript barscript perl-lib.pl perlmod.pm
 #   SCRIPTS_SHELL = shell1 shell2 sh-lib.sh
 #   SCRIPTS_AWK = talk balk chalk awk-lib.awk
+#   sbin_SCRIPTS = not-subbed
+#   EXTRA_DIST = util-script.pl
 #
 # with the corresponding files in the repository:
 #
 #   fooscript.pl barscript.pl perl-lib.pl.in perlmod.pm.in
 #   shell1.sh shell2.sh sh-lib.sh.in
 #   talk.awk balk.awk chalk.awk awk-lib.awk.in
+#   not-subbed util-script.pl
 #
 # by default, all shell and perl scripts are syntax checked.  If this is
 # a problem (for example, perl scripts depending on Amanda extension 
 # INSTALLPERMS_exec = \
 #      dest=$(sbindir) chown=amanda chmod= \
 #              foo bar \
-#      chmod=u+s,o-rwx \
+#      chmod=07450 \
 #              bing
 #      dest=$(libexecdir) chmod= \
 #              $(libexec_PROGRAMS)
 #
 # This whole operation is not required when making builds for packaging,
 # and can be disabled with --disable-installperms, via the WANT_INSTALLPERMS
-# AM_CONDITIONAL.
+# AM_CONDITIONAL.  When disabled, the file 'installperms.sh' in the top-level
+# build directory is populated with a format suitable for shell interpretation,
+# with lines like this:
+#   installperm "amanda:disk" "04750" "/usr/local/sbin/bing"
+# the arguments being, respectively, owner:group, mode, and filename.  There will
+# be exactly one line for each file which has specific permissions.  The intention
+# is that this file be used by packaging scripts to set correct permissions at install
+# time.  Note that files which have no special permissions requirements do not appear 
+# in this file at all, due to limitations of Automake.
 
 # vim:ft=automake
 
@@ -168,24 +183,28 @@ DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
        $(top_srcdir)/config/automake/precompile.am \
        $(top_srcdir)/config/automake/scripts.am \
        $(top_srcdir)/config/automake/vars.am
-@WANT_AMFLOCK_POSIX_TRUE@am__append_1 = amflock-posix.c
-@WANT_AMFLOCK_FLOCK_TRUE@am__append_2 = amflock-flock.c
-@WANT_AMFLOCK_LOCKF_TRUE@am__append_3 = amflock-lockf.c
-@WANT_AMFLOCK_LNLOCK_TRUE@am__append_4 = amflock-lnlock.c
-@WANT_RSH_SECURITY_TRUE@am__append_5 = rsh-security.c
-@WANT_SSH_SECURITY_TRUE@am__append_6 = ssh-security.c
-@WANT_BSD_SECURITY_TRUE@am__append_7 = bsd-security.c
-@WANT_BSDTCP_SECURITY_TRUE@am__append_8 = bsdtcp-security.c
-@WANT_BSDUDP_SECURITY_TRUE@am__append_9 = bsdudp-security.c
-@WANT_KRB4_SECURITY_TRUE@am__append_10 = krb4-security.c       
-@WANT_KRB5_SECURITY_TRUE@am__append_11 = krb5-security.c
+@WANT_INSTALLPERMS_FALSE@am__append_1 = $(installperms_sh)
+@WANT_AMFLOCK_POSIX_TRUE@am__append_2 = amflock-posix.c
+@WANT_AMFLOCK_FLOCK_TRUE@am__append_3 = amflock-flock.c
+@WANT_AMFLOCK_LOCKF_TRUE@am__append_4 = amflock-lockf.c
+@WANT_AMFLOCK_LNLOCK_TRUE@am__append_5 = amflock-lnlock.c
+@WANT_RSH_SECURITY_TRUE@am__append_6 = rsh-security.c
+@WANT_SSH_SECURITY_TRUE@am__append_7 = ssh-security.c
+@WANT_BSD_SECURITY_TRUE@am__append_8 = bsd-security.c
+@WANT_BSDTCP_SECURITY_TRUE@am__append_9 = bsdtcp-security.c
+@WANT_BSDUDP_SECURITY_TRUE@am__append_10 = bsdudp-security.c
+@WANT_KRB4_SECURITY_TRUE@am__append_11 = krb4-security.c       
+@WANT_KRB5_SECURITY_TRUE@am__append_12 = krb5-security.c
 EXTRA_PROGRAMS = genversion$(EXEEXT) $(am__EXEEXT_1)
-TESTS = amflock-test$(EXEEXT)
+TESTS = amflock-test$(EXEEXT) event-test$(EXEEXT) \
+       semaphore-test$(EXEEXT) queueing-test$(EXEEXT) \
+       quoting-test$(EXEEXT)
 noinst_PROGRAMS = $(am__EXEEXT_2)
 subdir = common-src
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps =  \
        $(top_srcdir)/config/macro-archive/ac_define_dir.m4 \
+       $(top_srcdir)/config/macro-archive/ac_perl_module_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_perl_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_swig.m4 \
        $(top_srcdir)/config/macro-archive/ax_compare_version.m4 \
@@ -219,6 +238,7 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/amanda/libs.m4 \
        $(top_srcdir)/config/amanda/net.m4 \
        $(top_srcdir)/config/amanda/progs.m4 \
+       $(top_srcdir)/config/amanda/ps.m4 \
        $(top_srcdir)/config/amanda/readdir.m4 \
        $(top_srcdir)/config/amanda/readline.m4 \
        $(top_srcdir)/config/amanda/rsh-security.m4 \
@@ -241,7 +261,9 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/float_h.m4 \
        $(top_srcdir)/config/gnulib/fsusage.m4 \
        $(top_srcdir)/config/gnulib/getaddrinfo.m4 \
+       $(top_srcdir)/config/gnulib/getopt.m4 \
        $(top_srcdir)/config/gnulib/gettimeofday.m4 \
+       $(top_srcdir)/config/gnulib/gnulib-common.m4 \
        $(top_srcdir)/config/gnulib/gnulib-comp.m4 \
        $(top_srcdir)/config/gnulib/include_next.m4 \
        $(top_srcdir)/config/gnulib/inet_ntop.m4 \
@@ -269,7 +291,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/sys_stat_h.m4 \
        $(top_srcdir)/config/gnulib/sys_time_h.m4 \
        $(top_srcdir)/config/gnulib/tempname.m4 \
-       $(top_srcdir)/config/gnulib/ulonglong.m4 \
        $(top_srcdir)/config/gnulib/unistd_h.m4 \
        $(top_srcdir)/config/gnulib/vasnprintf.m4 \
        $(top_srcdir)/config/gnulib/visibility.m4 \
@@ -280,7 +301,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gettext-macros/lib-ld.m4 \
        $(top_srcdir)/config/gettext-macros/lib-link.m4 \
        $(top_srcdir)/config/gettext-macros/lib-prefix.m4 \
-       $(top_srcdir)/config/gettext-macros/longlong.m4 \
        $(top_srcdir)/config/gettext-macros/nls.m4 \
        $(top_srcdir)/config/gettext-macros/po.m4 \
        $(top_srcdir)/config/gettext-macros/progtest.m4 \
@@ -304,17 +324,17 @@ am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
 am__installdirs = "$(DESTDIR)$(amlibdir)" "$(DESTDIR)$(amlibexecdir)" \
        "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(amlibexecdir)"
 amlibLTLIBRARIES_INSTALL = $(INSTALL)
-LTLIBRARIES = $(amlib_LTLIBRARIES)
+LTLIBRARIES = $(amlib_LTLIBRARIES) $(noinst_LTLIBRARIES)
 libamanda_la_DEPENDENCIES = ../gnulib/libgnu.la
-am__libamanda_la_SOURCES_DIST = alloc.c amfeatures.c amflock.c clock.c \
-       columnar.c conffile.c debug.c dgram.c event.c file.c \
+am__libamanda_la_SOURCES_DIST = alloc.c amfeatures.c amflock.c amxml.c \
+       clock.c columnar.c conffile.c debug.c dgram.c event.c file.c \
        fileheader.c glib-util.c match.c packet.c pipespawn.c \
-       protocol.c security.c security-util.c sl.c sockaddr-util.c \
-       stream.c tapelist.c timestamp.c token.c util.c versuff.c \
-       amflock-posix.c amflock-flock.c amflock-lockf.c \
-       amflock-lnlock.c rsh-security.c ssh-security.c bsd-security.c \
-       bsdtcp-security.c bsdudp-security.c krb4-security.c \
-       krb5-security.c local-security.c
+       protocol.c queueing.c semaphore.c security.c security-util.c \
+       simpleprng.c sl.c sockaddr-util.c stream.c tapelist.c \
+       timestamp.c util.c versuff.c amflock-posix.c amflock-flock.c \
+       amflock-lockf.c amflock-lnlock.c rsh-security.c ssh-security.c \
+       bsd-security.c bsdtcp-security.c bsdudp-security.c \
+       krb4-security.c krb5-security.c local-security.c
 @WANT_AMFLOCK_POSIX_TRUE@am__objects_1 = amflock-posix.lo
 @WANT_AMFLOCK_FLOCK_TRUE@am__objects_2 = amflock-flock.lo
 @WANT_AMFLOCK_LOCKF_TRUE@am__objects_3 = amflock-lockf.lo
@@ -326,25 +346,29 @@ am__libamanda_la_SOURCES_DIST = alloc.c amfeatures.c amflock.c clock.c \
 @WANT_BSDUDP_SECURITY_TRUE@am__objects_9 = bsdudp-security.lo
 @WANT_KRB4_SECURITY_TRUE@am__objects_10 = krb4-security.lo
 @WANT_KRB5_SECURITY_TRUE@am__objects_11 = krb5-security.lo
-am_libamanda_la_OBJECTS = alloc.lo amfeatures.lo amflock.lo clock.lo \
-       columnar.lo conffile.lo debug.lo dgram.lo event.lo file.lo \
-       fileheader.lo glib-util.lo match.lo packet.lo pipespawn.lo \
-       protocol.lo security.lo security-util.lo sl.lo \
-       sockaddr-util.lo stream.lo tapelist.lo timestamp.lo token.lo \
-       util.lo versuff.lo $(am__objects_1) $(am__objects_2) \
-       $(am__objects_3) $(am__objects_4) $(am__objects_5) \
-       $(am__objects_6) $(am__objects_7) $(am__objects_8) \
-       $(am__objects_9) $(am__objects_10) $(am__objects_11) \
-       local-security.lo
+am_libamanda_la_OBJECTS = alloc.lo amfeatures.lo amflock.lo amxml.lo \
+       clock.lo columnar.lo conffile.lo debug.lo dgram.lo event.lo \
+       file.lo fileheader.lo glib-util.lo match.lo packet.lo \
+       pipespawn.lo protocol.lo queueing.lo semaphore.lo security.lo \
+       security-util.lo simpleprng.lo sl.lo sockaddr-util.lo \
+       stream.lo tapelist.lo timestamp.lo util.lo versuff.lo \
+       $(am__objects_1) $(am__objects_2) $(am__objects_3) \
+       $(am__objects_4) $(am__objects_5) $(am__objects_6) \
+       $(am__objects_7) $(am__objects_8) $(am__objects_9) \
+       $(am__objects_10) $(am__objects_11) local-security.lo
 nodist_libamanda_la_OBJECTS = version.lo
 libamanda_la_OBJECTS = $(am_libamanda_la_OBJECTS) \
        $(nodist_libamanda_la_OBJECTS)
 libamanda_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
        $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
        $(libamanda_la_LDFLAGS) $(LDFLAGS) -o $@
-am__EXEEXT_1 = token$(EXEEXT) file$(EXEEXT) bsdsecurity$(EXEEXT) \
-       amfeatures$(EXEEXT)
-am__EXEEXT_2 = amflock-test$(EXEEXT)
+libtestutils_la_LIBADD =
+am_libtestutils_la_OBJECTS = testutils.lo
+libtestutils_la_OBJECTS = $(am_libtestutils_la_OBJECTS)
+am__EXEEXT_1 = file$(EXEEXT) bsdsecurity$(EXEEXT) amfeatures$(EXEEXT)
+am__EXEEXT_2 = amflock-test$(EXEEXT) event-test$(EXEEXT) \
+       semaphore-test$(EXEEXT) queueing-test$(EXEEXT) \
+       quoting-test$(EXEEXT)
 PROGRAMS = $(noinst_PROGRAMS)
 am_amfeatures_OBJECTS = amfeatures.test.$(OBJEXT)
 amfeatures_OBJECTS = $(am_amfeatures_OBJECTS)
@@ -352,12 +376,15 @@ amfeatures_DEPENDENCIES = $(libamanda_la_LIBADD) \
        $(STANDARD_COMMON_STUFF)
 am_amflock_test_OBJECTS = amflock-test.$(OBJEXT)
 amflock_test_OBJECTS = $(am_amflock_test_OBJECTS)
-amflock_test_DEPENDENCIES = libamanda.la
+amflock_test_DEPENDENCIES = libamanda.la libtestutils.la
 am_bsdsecurity_OBJECTS = bsd-security.test.$(OBJEXT)
 bsdsecurity_OBJECTS = $(am_bsdsecurity_OBJECTS)
 bsdsecurity_DEPENDENCIES = alloc.lo clock.lo debug.lo dgram.lo \
        event.lo file.lo packet.lo security.lo ssh-security.lo \
        versuff.lo
+am_event_test_OBJECTS = event-test.$(OBJEXT)
+event_test_OBJECTS = $(am_event_test_OBJECTS)
+event_test_DEPENDENCIES = libamanda.la libtestutils.la
 am_file_OBJECTS = file.test.$(OBJEXT)
 file_OBJECTS = $(am_file_OBJECTS)
 file_DEPENDENCIES = $(libamanda_la_LIBADD) \
@@ -366,13 +393,19 @@ am_genversion_OBJECTS = genversion.$(OBJEXT)
 genversion_OBJECTS = $(am_genversion_OBJECTS)
 genversion_DEPENDENCIES = $(libamanda_la_LIBADD) versuff.lo \
        ../gnulib/libgnu.la
-am_token_OBJECTS = token.test.$(OBJEXT)
-token_OBJECTS = $(am_token_OBJECTS)
-token_DEPENDENCIES = $(libamanda_la_LIBADD) $(STANDARD_COMMON_STUFF)
+am_queueing_test_OBJECTS = queueing-test.$(OBJEXT)
+queueing_test_OBJECTS = $(am_queueing_test_OBJECTS)
+queueing_test_DEPENDENCIES = libamanda.la libtestutils.la
+am_quoting_test_OBJECTS = quoting-test.$(OBJEXT)
+quoting_test_OBJECTS = $(am_quoting_test_OBJECTS)
+quoting_test_DEPENDENCIES = libamanda.la libtestutils.la
+am_semaphore_test_OBJECTS = semaphore-test.$(OBJEXT)
+semaphore_test_OBJECTS = $(am_semaphore_test_OBJECTS)
+semaphore_test_DEPENDENCIES = libamanda.la libtestutils.la
 amlibexecSCRIPT_INSTALL = $(INSTALL_SCRIPT)
 sbinSCRIPT_INSTALL = $(INSTALL_SCRIPT)
 SCRIPTS = $(amlibexec_SCRIPTS) $(sbin_SCRIPTS)
-DEFAULT_INCLUDES = -I. -I$(top_builddir)/config@am__isrc@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/config
 depcomp = $(SHELL) $(top_srcdir)/config/depcomp
 am__depfiles_maybe = depfiles
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
@@ -385,12 +418,17 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
        --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
        $(LDFLAGS) -o $@
 SOURCES = $(libamanda_la_SOURCES) $(nodist_libamanda_la_SOURCES) \
-       $(amfeatures_SOURCES) $(amflock_test_SOURCES) \
-       $(bsdsecurity_SOURCES) $(file_SOURCES) $(genversion_SOURCES) \
-       $(token_SOURCES)
-DIST_SOURCES = $(am__libamanda_la_SOURCES_DIST) $(amfeatures_SOURCES) \
-       $(amflock_test_SOURCES) $(bsdsecurity_SOURCES) $(file_SOURCES) \
-       $(genversion_SOURCES) $(token_SOURCES)
+       $(libtestutils_la_SOURCES) $(amfeatures_SOURCES) \
+       $(amflock_test_SOURCES) $(bsdsecurity_SOURCES) \
+       $(event_test_SOURCES) $(file_SOURCES) $(genversion_SOURCES) \
+       $(queueing_test_SOURCES) $(quoting_test_SOURCES) \
+       $(semaphore_test_SOURCES)
+DIST_SOURCES = $(am__libamanda_la_SOURCES_DIST) \
+       $(libtestutils_la_SOURCES) $(amfeatures_SOURCES) \
+       $(amflock_test_SOURCES) $(bsdsecurity_SOURCES) \
+       $(event_test_SOURCES) $(file_SOURCES) $(genversion_SOURCES) \
+       $(queueing_test_SOURCES) $(quoting_test_SOURCES) \
+       $(semaphore_test_SOURCES)
 amlibexecDATA_INSTALL = $(INSTALL_DATA)
 DATA = $(amlibexec_DATA)
 HEADERS = $(noinst_HEADERS)
@@ -398,6 +436,7 @@ ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
+AIX_BACKUP = @AIX_BACKUP@
 ALLOCA = @ALLOCA@
 ALLOCA_H = @ALLOCA_H@
 AMANDA_DBGDIR = @AMANDA_DBGDIR@
@@ -412,8 +451,10 @@ AMPLOT_CAT_GZIP = @AMPLOT_CAT_GZIP@
 AMPLOT_CAT_PACK = @AMPLOT_CAT_PACK@
 AMPLOT_COMPRESS = @AMPLOT_COMPRESS@
 AMTAR = @AMTAR@
+APPLICATION_DIR = @APPLICATION_DIR@
 AR = @AR@
 ARPA_INET_H = @ARPA_INET_H@
+ASSERTIONS = @ASSERTIONS@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -425,16 +466,28 @@ BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@
 BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@
 BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@
 BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@
+BSDTCP_SECURITY = @BSDTCP_SECURITY@
+BSDUDP_SECURITY = @BSDUDP_SECURITY@
+BSD_SECURITY = @BSD_SECURITY@
 CAT = @CAT@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
+CHECK_USERID = @CHECK_USERID@
 CHIO = @CHIO@
 CHS = @CHS@
+CLIENT_HOST_INSTANCE = @CLIENT_HOST_INSTANCE@
+CLIENT_HOST_KEY_FILE = @CLIENT_HOST_KEY_FILE@
+CLIENT_HOST_PRINCIPAL = @CLIENT_HOST_PRINCIPAL@
 CLIENT_LOGIN = @CLIENT_LOGIN@
 CLIENT_SCRIPTS_OPT = @CLIENT_SCRIPTS_OPT@
 COMPRESS = @COMPRESS@
+COMPRESS_BEST_OPT = @COMPRESS_BEST_OPT@
+COMPRESS_FAST_OPT = @COMPRESS_FAST_OPT@
+COMPRESS_PATH = @COMPRESS_PATH@
+COMPRESS_SUFFIX = @COMPRESS_SUFFIX@
+CONFIG_CLOBBER_MY_CONFIG = @CONFIG_CLOBBER_MY_CONFIG@
 CONFIG_DIR = @CONFIG_DIR@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
@@ -448,6 +501,7 @@ DD = @DD@
 DEFAULT_AMANDATES_FILE = @DEFAULT_AMANDATES_FILE@
 DEFAULT_CHANGER_DEVICE = @DEFAULT_CHANGER_DEVICE@
 DEFAULT_CONFIG = @DEFAULT_CONFIG@
+DEFAULT_MAILER = @DEFAULT_MAILER@
 DEFAULT_SERVER = @DEFAULT_SERVER@
 DEFAULT_TAPE_DEVICE = @DEFAULT_TAPE_DEVICE@
 DEFAULT_TAPE_SERVER = @DEFAULT_TAPE_SERVER@
@@ -455,7 +509,7 @@ DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DOC_BUILD_DATE = @DOC_BUILD_DATE@
 DUMP = @DUMP@
-DUMPER_DIR = @DUMPER_DIR@
+DUMP_RETURNS_1 = @DUMP_RETURNS_1@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -468,6 +522,7 @@ F77 = @F77@
 FFLAGS = @FFLAGS@
 FLOAT_H = @FLOAT_H@
 GETCONF = @GETCONF@
+GETOPT_H = @GETOPT_H@
 GETTEXT = @GETTEXT@
 GLIB_CFLAGS = @GLIB_CFLAGS@
 GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
@@ -478,9 +533,12 @@ GMSGFMT_015 = @GMSGFMT_015@
 GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
 GNULIB_CHOWN = @GNULIB_CHOWN@
 GNULIB_DUP2 = @GNULIB_DUP2@
+GNULIB_ENVIRON = @GNULIB_ENVIRON@
 GNULIB_FCHDIR = @GNULIB_FCHDIR@
 GNULIB_FFLUSH = @GNULIB_FFLUSH@
+GNULIB_FOPEN = @GNULIB_FOPEN@
 GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
+GNULIB_FREOPEN = @GNULIB_FREOPEN@
 GNULIB_FSEEK = @GNULIB_FSEEK@
 GNULIB_FSEEKO = @GNULIB_FSEEKO@
 GNULIB_FTELL = @GNULIB_FTELL@
@@ -490,6 +548,7 @@ GNULIB_GETCWD = @GNULIB_GETCWD@
 GNULIB_GETDELIM = @GNULIB_GETDELIM@
 GNULIB_GETLINE = @GNULIB_GETLINE@
 GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
+GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@
 GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
 GNULIB_LCHOWN = @GNULIB_LCHOWN@
 GNULIB_LSEEK = @GNULIB_LSEEK@
@@ -514,8 +573,10 @@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
 GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
 GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
 GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
+GNULIB_PUTENV = @GNULIB_PUTENV@
 GNULIB_READLINK = @GNULIB_READLINK@
 GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@
+GNULIB_SETENV = @GNULIB_SETENV@
 GNULIB_SLEEP = @GNULIB_SLEEP@
 GNULIB_SNPRINTF = @GNULIB_SNPRINTF@
 GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@
@@ -524,11 +585,15 @@ GNULIB_STPNCPY = @GNULIB_STPNCPY@
 GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
 GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
 GNULIB_STRDUP = @GNULIB_STRDUP@
+GNULIB_STRERROR = @GNULIB_STRERROR@
 GNULIB_STRNDUP = @GNULIB_STRNDUP@
 GNULIB_STRNLEN = @GNULIB_STRNLEN@
 GNULIB_STRPBRK = @GNULIB_STRPBRK@
 GNULIB_STRSEP = @GNULIB_STRSEP@
+GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@
+GNULIB_STRSTR = @GNULIB_STRSTR@
 GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
+GNULIB_UNSETENV = @GNULIB_UNSETENV@
 GNULIB_VASPRINTF = @GNULIB_VASPRINTF@
 GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@
 GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
@@ -542,6 +607,7 @@ GOBJECT_QUERY = @GOBJECT_QUERY@
 GREP = @GREP@
 GZIP = @GZIP@
 HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@
+HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@
 HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@
 HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@
 HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
@@ -550,9 +616,10 @@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
 HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@
 HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
 HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
-HAVE_DECL_STRNCASECMP = @HAVE_DECL_STRNCASECMP@
+HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@
 HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
 HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
+HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@
 HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
 HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
 HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
@@ -560,7 +627,9 @@ HAVE_DUP2 = @HAVE_DUP2@
 HAVE_FSEEKO = @HAVE_FSEEKO@
 HAVE_FTELLO = @HAVE_FTELLO@
 HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
+HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
 HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
+HAVE_GZIP = @HAVE_GZIP@
 HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
 HAVE_IO_H = @HAVE_IO_H@
 HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
@@ -569,8 +638,10 @@ HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@
 HAVE_MEMPCPY = @HAVE_MEMPCPY@
 HAVE_MKDTEMP = @HAVE_MKDTEMP@
 HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@
+HAVE_OS_H = @HAVE_OS_H@
 HAVE_READLINK = @HAVE_READLINK@
 HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@
+HAVE_SETENV = @HAVE_SETENV@
 HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
 HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
 HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
@@ -578,7 +649,6 @@ HAVE_SLEEP = @HAVE_SLEEP@
 HAVE_STDINT_H = @HAVE_STDINT_H@
 HAVE_STPCPY = @HAVE_STPCPY@
 HAVE_STPNCPY = @HAVE_STPNCPY@
-HAVE_STRCASECMP = @HAVE_STRCASECMP@
 HAVE_STRCASESTR = @HAVE_STRCASESTR@
 HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
 HAVE_STRNDUP = @HAVE_STRNDUP@
@@ -587,10 +657,12 @@ HAVE_STRSEP = @HAVE_STRSEP@
 HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@
 HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
 HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
+HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
 HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
 HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
 HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
 HAVE_UNISTD_H = @HAVE_UNISTD_H@
+HAVE_UNSETENV = @HAVE_UNSETENV@
 HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
 HAVE_VASPRINTF = @HAVE_VASPRINTF@
 HAVE_VISIBILITY = @HAVE_VISIBILITY@
@@ -606,6 +678,8 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 INTLLIBS = @INTLLIBS@
 INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+KRB4_SECURITY = @KRB4_SECURITY@
+KRB5_SECURITY = @KRB5_SECURITY@
 LDFLAGS = @LDFLAGS@
 LEX = @LEX@
 LEXLIB = @LEXLIB@
@@ -622,6 +696,8 @@ LIBTHREAD = @LIBTHREAD@
 LIBTOOL = @LIBTOOL@
 LIBTOOL_DEPS = @LIBTOOL_DEPS@
 LN_S = @LN_S@
+LOCKING = @LOCKING@
+LOW_TCPPORTRANGE = @LOW_TCPPORTRANGE@
 LTLIBICONV = @LTLIBICONV@
 LTLIBINTL = @LTLIBINTL@
 LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
@@ -630,7 +706,6 @@ LTLIBPTH = @LTLIBPTH@
 LTLIBTHREAD = @LTLIBTHREAD@
 MAILER = @MAILER@
 MAKEINFO = @MAKEINFO@
-MAXTAPEBLOCKSIZE = @MAXTAPEBLOCKSIZE@
 MCUTIL = @MCUTIL@
 MKDIR_P = @MKDIR_P@
 MSGFMT = @MSGFMT@
@@ -666,26 +741,37 @@ PERL_INC = @PERL_INC@
 PKG_CONFIG = @PKG_CONFIG@
 POSUB = @POSUB@
 PRINT = @PRINT@
+PS = @PS@
+PS_ARGUMENT = @PS_ARGUMENT@
 PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
 RANLIB = @RANLIB@
 READLINE_LIBS = @READLINE_LIBS@
 REPLACE_CHOWN = @REPLACE_CHOWN@
 REPLACE_FCHDIR = @REPLACE_FCHDIR@
 REPLACE_FFLUSH = @REPLACE_FFLUSH@
+REPLACE_FOPEN = @REPLACE_FOPEN@
 REPLACE_FPRINTF = @REPLACE_FPRINTF@
+REPLACE_FREOPEN = @REPLACE_FREOPEN@
 REPLACE_FSEEK = @REPLACE_FSEEK@
 REPLACE_FSEEKO = @REPLACE_FSEEKO@
 REPLACE_FTELL = @REPLACE_FTELL@
 REPLACE_FTELLO = @REPLACE_FTELLO@
 REPLACE_GETCWD = @REPLACE_GETCWD@
 REPLACE_GETLINE = @REPLACE_GETLINE@
+REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
 REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
 REPLACE_LCHOWN = @REPLACE_LCHOWN@
 REPLACE_LSEEK = @REPLACE_LSEEK@
+REPLACE_MEMMEM = @REPLACE_MEMMEM@
 REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
 REPLACE_PRINTF = @REPLACE_PRINTF@
+REPLACE_PUTENV = @REPLACE_PUTENV@
 REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
 REPLACE_SPRINTF = @REPLACE_SPRINTF@
+REPLACE_STRCASESTR = @REPLACE_STRCASESTR@
+REPLACE_STRERROR = @REPLACE_STRERROR@
+REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@
+REPLACE_STRSTR = @REPLACE_STRSTR@
 REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
 REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
 REPLACE_VPRINTF = @REPLACE_VPRINTF@
@@ -693,7 +779,11 @@ REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
 REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
 REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
 RESTORE = @RESTORE@
+RSH_SECURITY = @RSH_SECURITY@
 SAMBA_CLIENT = @SAMBA_CLIENT@
+SERVER_HOST_INSTANCE = @SERVER_HOST_INSTANCE@
+SERVER_HOST_KEY_FILE = @SERVER_HOST_KEY_FILE@
+SERVER_HOST_PRINCIPAL = @SERVER_HOST_PRINCIPAL@
 SERVICE_SUFFIX = @SERVICE_SUFFIX@
 SETUID_GROUP = @SETUID_GROUP@
 SET_MAKE = @SET_MAKE@
@@ -703,6 +793,7 @@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
 SNAPSHOT_STAMP = @SNAPSHOT_STAMP@
 SORT = @SORT@
 SSH = @SSH@
+SSH_SECURITY = @SSH_SECURITY@
 STDBOOL_H = @STDBOOL_H@
 STDINT_H = @STDINT_H@
 STRIP = @STRIP@
@@ -712,7 +803,14 @@ SWIG_LIB = @SWIG_LIB@
 SYS_SOCKET_H = @SYS_SOCKET_H@
 SYS_STAT_H = @SYS_STAT_H@
 SYS_TIME_H = @SYS_TIME_H@
+TCPPORTRANGE = @TCPPORTRANGE@
+TICKET_LIFETIME = @TICKET_LIFETIME@
+UDPPORTRANGE = @UDPPORTRANGE@
+UNCOMPRESS_OPT = @UNCOMPRESS_OPT@
+UNCOMPRESS_PATH = @UNCOMPRESS_PATH@
+USE_AMANDAHOSTS = @USE_AMANDAHOSTS@
 USE_NLS = @USE_NLS@
+USE_RUNDUMP = @USE_RUNDUMP@
 USE_VERSION_SUFFIXES = @USE_VERSION_SUFFIXES@
 VDUMP = @VDUMP@
 VERSION = @VERSION@
@@ -721,6 +819,7 @@ VERSION_MAJOR = @VERSION_MAJOR@
 VERSION_MINOR = @VERSION_MINOR@
 VERSION_PATCH = @VERSION_PATCH@
 VERSION_SUFFIX = @VERSION_SUFFIX@
+VOID_UNSETENV = @VOID_UNSETENV@
 VRESTORE = @VRESTORE@
 VXDUMP = @VXDUMP@
 VXRESTORE = @VXRESTORE@
@@ -749,6 +848,7 @@ am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+amdatadir = @amdatadir@
 amincludedir = @amincludedir@
 amlibdir = @amlibdir@
 amlibexecdir = @amlibexecdir@
@@ -767,6 +867,8 @@ dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 gl_LIBOBJS = @gl_LIBOBJS@
 gl_LTLIBOBJS = @gl_LTLIBOBJS@
+gltests_LIBOBJS = @gltests_LIBOBJS@
+gltests_LTLIBOBJS = @gltests_LTLIBOBJS@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
@@ -796,6 +898,7 @@ target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 SUFFIXES = 
@@ -808,8 +911,9 @@ CLEANFILES = config.log *.test.c
 
 # and we'll need to clean up our generated files for distclean
 DISTCLEANFILES = $(SCRIPTS_SHELL) $(SCRIPTS_PERL) $(SCRIPTS_AWK) \
-       version.c genversion genversion.h
-MAINTAINERCLEANFILES = 
+       $(SCRIPTS_INCLUDE) $(am__append_1) version.c genversion \
+       genversion.h
+MAINTAINERCLEANFILES = svn-info.h
 
 # syntax-check shell scripts on 'make check'
 CHECK_SHELL = $(SCRIPTS_SHELL)
@@ -817,21 +921,41 @@ CHECK_SHELL = $(SCRIPTS_SHELL)
 # sed expression to strip leading directories from a filename; this converts e.g.,
 # src/foo/bar.so to bar.so.
 strip_leading_dirs = s|^.*/||
+@WANT_INSTALLPERMS_FALSE@do_file = pa="$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
+@WANT_INSTALLPERMS_FALSE@    echo "installperm \"$$chown\" \"$$chmod\" \"$$pa\"" >> "$(installperms_sh)"
+
+
+# define a snippet of the scripts below to either perform a chown/chmod operation,
+# or record that operation in the logfile.  On entry to the snippet, $$dest is the
+# destination directory, $$cmd is the srcdir-relative pathname of the target file,
+# $$chown is the ownership, and $$chmod is the permission pattern.
+@WANT_INSTALLPERMS_TRUE@do_file = pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
+@WANT_INSTALLPERMS_TRUE@    if test -n "$$chown"; then \
+@WANT_INSTALLPERMS_TRUE@       echo chown "$$chown" "$$pa"; \
+@WANT_INSTALLPERMS_TRUE@       chown "$$chown" "$$pa" || exit 1; \
+@WANT_INSTALLPERMS_TRUE@    fi; \
+@WANT_INSTALLPERMS_TRUE@    if test -n "$$chmod"; then \
+@WANT_INSTALLPERMS_TRUE@       echo chmod "$$chmod" "$$pa"; \
+@WANT_INSTALLPERMS_TRUE@       chmod "$$chmod" "$$pa" || exit 1; \
+@WANT_INSTALLPERMS_TRUE@    fi 
+
+@WANT_INSTALLPERMS_FALSE@installperms_sh = "$(top_builddir)/installperms.sh"
 INCLUDES = -I$(top_srcdir)/gnulib   
 AM_CFLAGS = $(AMANDA_WARNING_CFLAGS)
 AM_LDFLAGS = $(AMANDA_STATIC_LDFLAGS)
 amlib_LTLIBRARIES = libamanda.la
 LINT = $(AMLINT)
 LINTFLAGS = $(AMLINTFLAGS)
-libamanda_la_SOURCES = alloc.c amfeatures.c amflock.c clock.c \
+libamanda_la_SOURCES = alloc.c amfeatures.c amflock.c amxml.c clock.c \
        columnar.c conffile.c debug.c dgram.c event.c file.c \
        fileheader.c glib-util.c match.c packet.c pipespawn.c \
-       protocol.c security.c security-util.c sl.c sockaddr-util.c \
-       stream.c tapelist.c timestamp.c token.c util.c versuff.c \
-       $(am__append_1) $(am__append_2) $(am__append_3) \
+       protocol.c queueing.c semaphore.c security.c security-util.c \
+       simpleprng.c sl.c sockaddr-util.c stream.c tapelist.c \
+       timestamp.c util.c versuff.c $(am__append_2) $(am__append_3) \
        $(am__append_4) $(am__append_5) $(am__append_6) \
        $(am__append_7) $(am__append_8) $(am__append_9) \
-       $(am__append_10) $(am__append_11) local-security.c
+       $(am__append_10) $(am__append_11) $(am__append_12) \
+       local-security.c
 # version.c is generated; see below
 nodist_libamanda_la_SOURCES = version.c
 libamanda_la_LIBADD = \
@@ -841,6 +965,7 @@ libamanda_la_LDFLAGS = -release $(VERSION)
 noinst_HEADERS = \
        amanda.h                \
        amfeatures.h            \
+       amxml.h                 \
        arglist.h               \
        clock.h                 \
        columnar.h              \
@@ -856,14 +981,16 @@ noinst_HEADERS = \
        pipespawn.h             \
        protocol.h              \
        queue.h                 \
+       queueing.h              \
+       semaphore.h             \
        security.h              \
        security-util.h         \
+       simpleprng.h            \
        sl.h                    \
        sockaddr-util.h         \
        stream.h                \
        tapelist.h              \
        timestamp.h             \
-       token.h                 \
        util.h                  \
        version.h
 
@@ -883,7 +1010,7 @@ genversion_LDADD = $(libamanda_la_LIBADD)  \
 
 
 # these are used for testing only:
-TEST_PROGS = token file bsdsecurity amfeatures
+TEST_PROGS = file bsdsecurity amfeatures
 
 # used for testing only
 STANDARD_COMMON_STUFF_NOT_FILE = \
@@ -898,8 +1025,6 @@ STANDARD_COMMON_STUFF = \
        $(STANDARD_COMMON_STUFF_NOT_FILE) \
        file.lo
 
-token_SOURCES = token.test.c
-token_LDADD = $(libamanda_la_LIBADD) $(STANDARD_COMMON_STUFF)
 file_SOURCES = file.test.c
 file_LDADD = $(libamanda_la_LIBADD) $(STANDARD_COMMON_STUFF_NOT_FILE)
 bsdsecurity_SOURCES = bsd-security.test.c
@@ -917,15 +1042,42 @@ bsdsecurity_LDADD = $(libamanda_a_LIBADD) \
 
 amfeatures_SOURCES = amfeatures.test.c
 amfeatures_LDADD = $(libamanda_la_LIBADD) $(STANDARD_COMMON_STUFF)
+
+# libtestutils.la
+#
+# Convenience library (never installed) for 'make check'-based tests.
+noinst_LTLIBRARIES = libtestutils.la
+libtestutils_la_SOURCES = \
+       testutils.c \
+       testutils.h
+
 amflock_test_SOURCES = amflock-test.c
-amflock_test_LDADD = libamanda.la
+amflock_test_LDADD = libamanda.la libtestutils.la
+event_test_SOURCES = event-test.c
+event_test_LDADD = libamanda.la libtestutils.la
+semaphore_test_SOURCES = semaphore-test.c
+semaphore_test_LDADD = libamanda.la libtestutils.la
+queueing_test_SOURCES = queueing-test.c
+queueing_test_LDADD = libamanda.la libtestutils.la
+quoting_test_SOURCES = quoting-test.c
+quoting_test_LDADD = libamanda.la libtestutils.la
 
 # scripts
 
-# divide scripts up both by language and by destination directory.
-sbin_SCRIPTS_PERL = \
+# divide scripts up both by language, by destination directory, and by whether they
+# should get checked (stuff in *_SCRIPTS_* isn't syntax checked; this is necessary
+# for perl scripts that use Amanda::* packages)
+sbin_CHECK_PERL = \
            amgpgcrypt \
-           amcryptsimple
+           amcryptsimple \
+           amgetconf
+
+sbin_SCRIPTS_PERL = \
+           $(sbin_CHECK_PERL)
+
+amlibexec_CHECK_PERL = 
+amlibexec_SCRIPTS_PERL = \
+           $(amlibexec_CHECK_PERL)
 
 sbin_SCRIPTS_SHELL = \
            amcrypt \
@@ -933,12 +1085,12 @@ sbin_SCRIPTS_SHELL = \
            amcrypt-ossl \
            amcrypt-ossl-asym
 
-amlibexec_SCRIPTS_PERL = 
+amlibexec_SCRIPTS_SHELL = 
 SCRIPTS_INCLUDE = \
            amanda-sh-lib.sh
 
-CHECK_PERL = $(sbin_SCRIPTS_PERL) $(amlibexec_SCRIPTS_PERL)
-SCRIPTS_PERL = $(CHECK_PERL)
+CHECK_PERL = $(sbin_CHECK_PERL) $(amlibexec_CHECK_PERL)
+SCRIPTS_PERL = $(sbin_SCRIPTS_PERL) $(amlibexec_SCRIPTS_PERL)
 SCRIPTS_SHELL = $(sbin_SCRIPTS_SHELL) $(amlibexec_SCRIPTS_SHELL)
 amlibexec_DATA = $(SCRIPTS_INCLUDE)
 amlibexec_SCRIPTS = $(amlibexec_SCRIPTS_PERL) $(amlibexec_SCRIPTS_SHELL)
@@ -990,8 +1142,8 @@ install-amlibLTLIBRARIES: $(amlib_LTLIBRARIES)
        @list='$(amlib_LTLIBRARIES)'; for p in $$list; do \
          if test -f $$p; then \
            f=$(am__strip_dir) \
-           echo " $(LIBTOOL) --mode=install $(amlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(amlibdir)/$$f'"; \
-           $(LIBTOOL) --mode=install $(amlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(amlibdir)/$$f"; \
+           echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(amlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(amlibdir)/$$f'"; \
+           $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(amlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(amlibdir)/$$f"; \
          else :; fi; \
        done
 
@@ -999,8 +1151,8 @@ uninstall-amlibLTLIBRARIES:
        @$(NORMAL_UNINSTALL)
        @list='$(amlib_LTLIBRARIES)'; for p in $$list; do \
          p=$(am__strip_dir) \
-         echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(amlibdir)/$$p'"; \
-         $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(amlibdir)/$$p"; \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(amlibdir)/$$p'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(amlibdir)/$$p"; \
        done
 
 clean-amlibLTLIBRARIES:
@@ -1011,8 +1163,19 @@ clean-amlibLTLIBRARIES:
          echo "rm -f \"$${dir}/so_locations\""; \
          rm -f "$${dir}/so_locations"; \
        done
+
+clean-noinstLTLIBRARIES:
+       -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+       @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+         dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+         test "$$dir" != "$$p" || dir=.; \
+         echo "rm -f \"$${dir}/so_locations\""; \
+         rm -f "$${dir}/so_locations"; \
+       done
 libamanda.la: $(libamanda_la_OBJECTS) $(libamanda_la_DEPENDENCIES) 
        $(libamanda_la_LINK) -rpath $(amlibdir) $(libamanda_la_OBJECTS) $(libamanda_la_LIBADD) $(LIBS)
+libtestutils.la: $(libtestutils_la_OBJECTS) $(libtestutils_la_DEPENDENCIES) 
+       $(LINK)  $(libtestutils_la_OBJECTS) $(libtestutils_la_LIBADD) $(LIBS)
 
 clean-noinstPROGRAMS:
        @list='$(noinst_PROGRAMS)'; for p in $$list; do \
@@ -1029,15 +1192,24 @@ amflock-test$(EXEEXT): $(amflock_test_OBJECTS) $(amflock_test_DEPENDENCIES)
 bsdsecurity$(EXEEXT): $(bsdsecurity_OBJECTS) $(bsdsecurity_DEPENDENCIES) 
        @rm -f bsdsecurity$(EXEEXT)
        $(LINK) $(bsdsecurity_OBJECTS) $(bsdsecurity_LDADD) $(LIBS)
+event-test$(EXEEXT): $(event_test_OBJECTS) $(event_test_DEPENDENCIES) 
+       @rm -f event-test$(EXEEXT)
+       $(LINK) $(event_test_OBJECTS) $(event_test_LDADD) $(LIBS)
 file$(EXEEXT): $(file_OBJECTS) $(file_DEPENDENCIES) 
        @rm -f file$(EXEEXT)
        $(LINK) $(file_OBJECTS) $(file_LDADD) $(LIBS)
 genversion$(EXEEXT): $(genversion_OBJECTS) $(genversion_DEPENDENCIES) 
        @rm -f genversion$(EXEEXT)
        $(LINK) $(genversion_OBJECTS) $(genversion_LDADD) $(LIBS)
-token$(EXEEXT): $(token_OBJECTS) $(token_DEPENDENCIES) 
-       @rm -f token$(EXEEXT)
-       $(LINK) $(token_OBJECTS) $(token_LDADD) $(LIBS)
+queueing-test$(EXEEXT): $(queueing_test_OBJECTS) $(queueing_test_DEPENDENCIES) 
+       @rm -f queueing-test$(EXEEXT)
+       $(LINK) $(queueing_test_OBJECTS) $(queueing_test_LDADD) $(LIBS)
+quoting-test$(EXEEXT): $(quoting_test_OBJECTS) $(quoting_test_DEPENDENCIES) 
+       @rm -f quoting-test$(EXEEXT)
+       $(LINK) $(quoting_test_OBJECTS) $(quoting_test_LDADD) $(LIBS)
+semaphore-test$(EXEEXT): $(semaphore_test_OBJECTS) $(semaphore_test_DEPENDENCIES) 
+       @rm -f semaphore-test$(EXEEXT)
+       $(LINK) $(semaphore_test_OBJECTS) $(semaphore_test_LDADD) $(LIBS)
 install-amlibexecSCRIPTS: $(amlibexec_SCRIPTS)
        @$(NORMAL_INSTALL)
        test -z "$(amlibexecdir)" || $(MKDIR_P) "$(DESTDIR)$(amlibexecdir)"
@@ -1092,6 +1264,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amflock-posix.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amflock-test.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amflock.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amxml.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsd-security.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsd-security.test.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsdtcp-security.Plo@am__quote@
@@ -1101,6 +1274,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conffile.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dgram.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/event-test.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/event.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file.test.Po@am__quote@
@@ -1114,17 +1288,22 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/packet.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pipespawn.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/protocol.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/queueing-test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/queueing.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quoting-test.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rsh-security.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/security-util.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/security.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/semaphore-test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/semaphore.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simpleprng.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sl.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sockaddr-util.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssh-security.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tapelist.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testutils.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timestamp.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/token.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/token.test.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/versuff.Plo@am__quote@
@@ -1178,8 +1357,8 @@ ID: $(HEADERS) $(SOURCES) $(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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
        mkid -fID $$unique
 tags: TAGS
 
@@ -1191,8 +1370,8 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
        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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { 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) \
@@ -1202,13 +1381,12 @@ ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
                $(TAGS_FILES) $(LISP)
        tags=; \
-       here=`pwd`; \
        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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
        test -z "$(CTAGS_ARGS)$$tags$$unique" \
          || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
             $$tags $$unique
@@ -1363,18 +1541,16 @@ maintainer-clean-generic:
        @echo "it deletes files that may require special tools to rebuild."
        -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
        -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-@WANT_INSTALLPERMS_FALSE@install-exec-hook:
-@WANT_INSTALLPERMS_FALSE@install-data-hook:
 clean: clean-am
 
 clean-am: clean-amlibLTLIBRARIES clean-generic clean-libtool \
-       clean-noinstPROGRAMS mostlyclean-am
+       clean-noinstLTLIBRARIES clean-noinstPROGRAMS mostlyclean-am
 
 distclean: distclean-am
        -rm -rf ./$(DEPDIR)
        -rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
-       distclean-tags
+       distclean-local distclean-tags
 
 dvi: dvi-am
 
@@ -1407,7 +1583,7 @@ install-pdf: install-pdf-am
 
 install-ps: install-ps-am
 
-installcheck-am:
+installcheck-am: installcheck-local
 
 maintainer-clean: maintainer-clean-am
        -rm -rf ./$(DEPDIR)
@@ -1434,16 +1610,17 @@ uninstall-am: uninstall-amlibLTLIBRARIES uninstall-amlibexecDATA \
 
 .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am check-local \
        clean clean-amlibLTLIBRARIES clean-generic clean-libtool \
-       clean-noinstPROGRAMS ctags dist-hook distclean \
-       distclean-compile distclean-generic distclean-libtool \
-       distclean-tags distdir dvi dvi-am html html-am info info-am \
-       install install-am install-amlibLTLIBRARIES \
-       install-amlibexecDATA install-amlibexecSCRIPTS install-data \
-       install-data-am install-data-hook install-dvi install-dvi-am \
-       install-exec install-exec-am install-exec-hook install-html \
-       install-html-am install-info install-info-am install-man \
-       install-pdf install-pdf-am install-ps install-ps-am \
-       install-sbinSCRIPTS install-strip installcheck installcheck-am \
+       clean-noinstLTLIBRARIES clean-noinstPROGRAMS ctags dist-hook \
+       distclean distclean-compile distclean-generic \
+       distclean-libtool distclean-local distclean-tags distdir dvi \
+       dvi-am html html-am info info-am install install-am \
+       install-amlibLTLIBRARIES install-amlibexecDATA \
+       install-amlibexecSCRIPTS install-data install-data-am \
+       install-data-hook install-dvi install-dvi-am install-exec \
+       install-exec-am install-exec-hook install-html install-html-am \
+       install-info install-info-am install-man install-pdf \
+       install-pdf-am install-ps install-ps-am install-sbinSCRIPTS \
+       install-strip installcheck installcheck-am installcheck-local \
        installdirs maintainer-clean maintainer-clean-generic \
        mostlyclean mostlyclean-compile mostlyclean-generic \
        mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
@@ -1456,6 +1633,11 @@ uninstall-am: uninstall-amlibLTLIBRARIES uninstall-amlibexecDATA \
 %: %.pl $(top_builddir)/config.status
        $(top_builddir)/config.status --file=$@:$<
        chmod a+x $@
+       @if test -f $(top_builddir)/perl/.libs/libCmdline.so -o -f $(top_builddir)/perl/libCmdline.so; then \
+               grep -v '^use lib' $@ > $@.nouselib; \
+               $(PERL) $(CHECK_PERL_FLAGS) -I$(top_builddir)/perl -I$(top_builddir)/perl/.libs -I$(top_srcdir)/perl -c -w -T $@.nouselib || exit 1; \
+               rm $@.nouselib; \
+       fi
 
 %.pl: %.pl.in $(top_builddir)/config.status
        $(top_builddir)/config.status --file=$@:$<
@@ -1481,13 +1663,27 @@ uninstall-am: uninstall-amlibLTLIBRARIES uninstall-amlibexecDATA \
 
 # syntax-check perl scripts on 'make check'
 check-perl: $(CHECK_PERL)
+       @CHECK_PERL="$(CHECK_PERL)"; \
+       if test -f $(top_builddir)/perl/.libs/libCmdline.so -o -f $(top_builddir)/perl/libCmdline.so; then \
+               if test -n "$(PERL)"; then \
+                       for perlobj in $$CHECK_PERL; do \
+                               grep -v '^use lib' $$perlobj > $$perlobj.nouselib; \
+                               $(PERL) $(CHECK_PERL_FLAGS) -I$(top_builddir)/perl -I$(top_builddir)/perl/.libs -I$(top_srcdir)/perl -c -w -T $$perlobj.nouselib || exit 1; \
+                               rm $$perlobj.nouselib; \
+                       done; \
+               fi \
+       fi
+check-local: check-perl
+
+# syntax-check perl scripts on 'make installcheck'
+installcheck-perl: $(CHECK_PERL)
        @CHECK_PERL="$(CHECK_PERL)"; \
        if test -n "$(PERL)"; then \
                for perlobj in $$CHECK_PERL; do \
                        $(PERL) $(CHECK_PERL_FLAGS) -c -w -T $$perlobj || exit 1; \
                done; \
        fi
-check-local: check-perl
+installcheck-local: installcheck-perl
 check-shell: $(CHECK_SHELL)
        @CHECK_SHELL="$(CHECK_SHELL)"; \
        if test -n "$$CHECK_SHELL"; then \
@@ -1525,52 +1721,40 @@ dist-scripts:
        true
 dist-hook: dist-scripts
 
-@WANT_INSTALLPERMS_TRUE@installperms-exec:
-@WANT_INSTALLPERMS_TRUE@       @installperms="$(INSTALLPERMS_exec)"; \
-@WANT_INSTALLPERMS_TRUE@       test -n "$$installperms" && echo "Setting installation permissions on executables"; \
-@WANT_INSTALLPERMS_TRUE@       dest=; chown=; chmod=; \
-@WANT_INSTALLPERMS_TRUE@       for cmd in $$installperms; do \
-@WANT_INSTALLPERMS_TRUE@           case "$$cmd" in \
-@WANT_INSTALLPERMS_TRUE@               chown=amanda) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
-@WANT_INSTALLPERMS_TRUE@               dest=*|chown=*|chmod=*) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; eval $$cmd;; \
-@WANT_INSTALLPERMS_TRUE@               *)  pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chown"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chown "$$chown" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chown "$$chown" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chmod"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chmod "$$chmod" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chmod "$$chmod" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@           esac; \
-@WANT_INSTALLPERMS_TRUE@       done
-
-@WANT_INSTALLPERMS_TRUE@installperms-data:
-@WANT_INSTALLPERMS_TRUE@       @installperms="$(INSTALLPERMS_data)"; \
-@WANT_INSTALLPERMS_TRUE@       test -n "$$installperms" && echo "Setting installation permissions on data"; \
-@WANT_INSTALLPERMS_TRUE@       dest=; chown=; chmod=; \
-@WANT_INSTALLPERMS_TRUE@       for cmd in $$installperms; do \
-@WANT_INSTALLPERMS_TRUE@           case "$$cmd" in \
-@WANT_INSTALLPERMS_TRUE@               chown=amanda) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
-@WANT_INSTALLPERMS_TRUE@               dest=*|chown=*|chmod=*) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; eval $$cmd;; \
-@WANT_INSTALLPERMS_TRUE@               *)  pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chown"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chown "$$chown" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chown "$$chown" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chmod"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chmod "$$chmod" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chmod "$$chmod" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@           esac; \
-@WANT_INSTALLPERMS_TRUE@       done
-
-@WANT_INSTALLPERMS_TRUE@install-exec-hook: installperms-exec
-@WANT_INSTALLPERMS_TRUE@install-data-hook: installperms-data
+installperms-exec:
+       @installperms="$(INSTALLPERMS_exec)"; \
+       test -n "$$installperms" && echo "Setting installation permissions on executables"; \
+       dest=; chown=; chmod=; \
+       for cmd in $$installperms; do \
+           case "$$cmd" in \
+               chown=amanda) \
+                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
+               dest=*|chown=*|chmod=*) \
+                       echo "  ($$cmd)"; eval $$cmd;; \
+               *) $(do_file) ;; \
+           esac; \
+       done
+
+installperms-data:
+       @installperms="$(INSTALLPERMS_data)"; \
+       dest=; chown=; chmod=; \
+       for cmd in $$installperms; do \
+           case "$$cmd" in \
+               chown=amanda) \
+                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
+               dest=*|chown=*|chmod=*) \
+                       echo "  ($$cmd)"; eval $$cmd;; \
+               *)  $(do_file) ;; \
+           esac; \
+       done
+
+install-exec-hook: installperms-exec
+install-data-hook: installperms-data
+
+# define a rule to initialize the installperms manifest file
+@WANT_INSTALLPERMS_TRUE@installperms-init:
+@WANT_INSTALLPERMS_FALSE@installperms-init:
+@WANT_INSTALLPERMS_FALSE@      rm -f "$(installperms_sh)"
 
 # A rule to make precompiler output from C files.  This is not used during
 # ordinary builds, but but can very useful in debugging problems on strange
@@ -1608,6 +1792,9 @@ listlibsrc:
 %.test.c: $(srcdir)/%.c
        echo '#define TEST' >$@
        echo '#include "$<"' >>$@
+
+distclean-local:
+       if test `cd $(srcdir) && pwd` != `pwd`; then rm -f svn-info.h; fi
 # 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:
index 8d3aa1c93ed625f413bfff758692fe17f51c466f..26953c6b45d3c0262707d9a1ac04302f84776dbf 100755 (executable)
@@ -1,6 +1,6 @@
 #! @SHELL@
 #
-# Copyright (c) 2005 Zmanda Inc.  All Rights Reserved.
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
 # 
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License version 2 as published
@@ -15,8 +15,8 @@
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 # 
-# Contact information: Zmanda Inc, 505 N Mathlida Ave, Suite 120
-# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 #
 
 prefix="@prefix@"
index 0c82190cdb475f193504b4fedbef20ffdc8c1cca..ab93255a3d5a029d2e83c2470c81197eddfe245f 100644 (file)
@@ -19,7 +19,6 @@ STAR="@STAR@"
 SAMBA_CLIENT="@SAMBA_CLIENT@"
 GZIP="@GZIP@"
 SORT="@SORT@"
-MAILER="@MAILER@"
 PERL="@PERL@"
 AWK="@AWK@"
 
@@ -40,7 +39,7 @@ if test -n "$GETTEXT"; then
     _() {
            fmt=`$GETTEXT -d amanda "$1"`
            shift
-           printf "$fmt" $*
+           printf "$fmt" "$@"
     }
 else
     _() {
index 9aa3d6a4fafb080c308680991033e40d1ff456ab..ec0653316e75bd3f0c0489bc906c3fcab8c2202b 100644 (file)
 #ifndef AMANDA_H
 #define AMANDA_H
 
-#include <glib.h>
-#include <glib/gprintf.h>
-
-#include "amflock.h"
-
 #ifdef HAVE_CONFIG_H
 /* use a relative path here to avoid conflicting with Perl's config.h. */
 #include "../config/config.h"
 #endif
 
+#include <glib.h>
+#include <glib/gprintf.h>
+
+#include "amflock.h"
+
 /*
  * Force large file source even if configure guesses wrong.
  */
@@ -71,9 +71,6 @@
  * Also, some systems put key files in different places, so by including 
  * everything here the rest of the system is isolated from such things.
  */
-#ifdef HAVE_ALLOCA_H
-#  include <alloca.h>
-#endif
 
 /* from the autoconf documentation */
 #ifdef HAVE_DIRENT_H
@@ -404,11 +401,6 @@ extern int errno;
 #define DISK_BLOCK_KB          32
 #define DISK_BLOCK_BYTES       (DISK_BLOCK_KB * 1024)
 
-/* Maximum size of a tape block */
-/* MAX_TAPE_BLOCK_KB is defined in config.h */
-/* by configure --with-maxtapeblocksize     */
-#define MAX_TAPE_BLOCK_BYTES (MAX_TAPE_BLOCK_KB*1024)
-
 /* Maximum length of tape label, plus one for null-terminator. */
 #define MAX_TAPE_LABEL_LEN (10240)
 #define MAX_TAPE_LABEL_BUF (MAX_TAPE_LABEL_LEN+1)
@@ -494,6 +486,7 @@ char *      validate_regexp(const char *regex);
 char * validate_glob(const char *glob);
 char * clean_regex(const char *regex);
 int    match(const char *regex, const char *str);
+int    match_no_newline(const char *regex, const char *str);
 int    match_glob(const char *glob, const char *str);
 char * glob_to_regex(const char *glob);
 int    match_tar(const char *glob, const char *str);
@@ -625,15 +618,15 @@ time_t    unctime(char *timestr);
 #define        NUM_STR_SIZE    128             /* a generic number buffer size */
 
 #define        skip_whitespace(ptr,c) do {                                     \
-    while((c) != '\n' && isspace((int)c)) (c) = *(ptr)++;              \
+    while((c) != '\n' && g_ascii_isspace((int)c)) (c) = *(ptr)++;              \
 } while(0)
 
 #define        skip_non_whitespace(ptr,c) do {                                 \
-    while((c) != '\0' && !isspace((int)c)) (c) = *(ptr)++;             \
+    while((c) != '\0' && !g_ascii_isspace((int)c)) (c) = *(ptr)++;             \
 } while(0)
 
 #define        skip_non_whitespace_cs(ptr,c) do {                              \
-    while((c) != '\0' && (c) != '#' && !isspace((int)c)) (c) = *(ptr)++;\
+    while((c) != '\0' && (c) != '#' && !g_ascii_isspace((int)c)) (c) = *(ptr)++;\
 } while(0)
 
 #define        skip_non_integer(ptr,c) do {                                    \
@@ -647,11 +640,12 @@ time_t    unctime(char *timestr);
 
 #define skip_quoted_string(ptr, c) do {                                        \
     int        iq = 0;                                                         \
-    while (((c) != '\0') && !((iq == 0) && isspace((int)c))) {         \
+    while (((c) != '\0') && !((iq == 0) && g_ascii_isspace((int)c))) {         \
        if ((c) == '"') {                                               \
            iq = !iq;                                                   \
-       } else if (((c) == '\\') && (*(ptr) == '"')) {                  \
-           (ptr)++;                                                    \
+       } else if ((c) == '\\') {                                       \
+           if (*ptr)   /* not last character */                        \
+               (ptr)++;                                                \
        }                                                               \
        (c) = *(ptr)++;                                                 \
     }                                                                  \
@@ -677,7 +671,7 @@ time_t      unctime(char *timestr);
 
 #define        copy_string(ptr,c,f,l,fp) do {                                  \
     (fp) = (f);                                                                \
-    while((c) != '\0' && !isspace((int)c)) {                           \
+    while((c) != '\0' && !g_ascii_isspace((int)c)) {                           \
        if((fp) >= (f) + (l) - 1) {                                     \
            *(fp) = '\0';                                               \
            (fp) = NULL;                                                \
@@ -693,7 +687,7 @@ time_t      unctime(char *timestr);
 
 #define        copy_string_cs(ptr,c,f,l,fp) do {                               \
     (fp) = (f);                                                                \
-    while((c) != '\0' && (c) != '#' && !isspace((int)c)) {             \
+    while((c) != '\0' && (c) != '#' && !g_ascii_isspace((int)c)) {             \
        if((fp) >= (f) + (l) - 1) {                                     \
            *(fp) = '\0';                                               \
            (fp) = NULL;                                                \
@@ -1076,6 +1070,9 @@ extern int vprintf(const char *format, va_list ap);
 /* gnulib-only includes (hence "" instead of <>) */
 #include "getaddrinfo.h"
 #include "inet_ntop.h"
+#include "safe-read.h"
+#include "full-read.h"
+#include "full-write.h"
 
 #if !defined(S_ISCHR) && defined(_S_IFCHR) && defined(_S_IFMT)
 #define S_ISCHR(mode) (((mode) & _S_IFMT) == _S_IFCHR)
@@ -1181,68 +1178,6 @@ extern ssize_t writev(int fd, const struct iovec *iov, int iovcnt);
 #  endif
 #endif
 
-#if SIZEOF_OFF_T == 8
-#  ifdef OFF_MAX
-#    define AM64_MAX (off_t)(OFF_MAX)
-#  else
-#    define AM64_MAX (off_t)(9223372036854775807LL)
-#  endif
-#  ifdef OFF_MIN
-#    define AM64_MIN (off_t)(OFF_MIN)
-#  else
-#    define AM64_MIN (off_t)(-9223372036854775807LL -1LL)
-#  endif
-#else
-#if SIZEOF_LONG == 8
-#  ifdef LONG_MAX
-#    define AM64_MAX (off_t)(LONG_MAX)
-#  else
-#    define AM64_MAX (off_t)9223372036854775807L
-#  endif
-#  ifdef LONG_MIN
-#    define AM64_MIN (off_t)(LONG_MIN)
-#  else
-#    define AM64_MIN (off_t)(-9223372036854775807L -1L)
-#  endif
-#else
-#if SIZEOF_LONG_LONG == 8
-#  ifdef LONG_LONG_MAX
-#    define AM64_MAX (off_t)(LONG_LONG_MAX)
-#  else
-#    define AM64_MAX (off_t)9223372036854775807LL
-#  endif
-#  ifdef LONG_LONG_MIN
-#    define AM64_MIN (off_t)(LONG_LONG_MIN)
-#  else
-#    define AM64_MIN (off_t)(-9223372036854775807LL -1LL)
-#  endif
-#else
-#if SIZEOF_INTMAX_T == 8
-#  ifdef INTMAX_MAX
-#    define AM64_MAX (off_t)(INTMAX_MAX)
-#  else
-#    define AM64_MAX (off_t)9223372036854775807LL
-#  endif
-#  ifdef INTMAX_MIN
-#    define AM64_MIN (off_t)(INTMAX_MIN)
-#  else
-#    define AM64_MIN (off_t)(-9223372036854775807LL -1LL)
-#  endif
-#else  /* no 64 bits type found, use long. */
-#  ifdef LONG_MAX
-#    define AM64_MAX (off_t)(LONG_MAX)
-#  else
-#    define AM64_MAX (off_t)2147483647
-#  endif
-#  ifdef LONG_MIN
-#    define AM64_MIN (off_t)(LONG_MIN)
-#  else
-#    define AM64_MIN (off_t)(-2147483647 -1)
-#  endif
-#endif
-#endif
-#endif
-#endif
 
 #define BIND_CYCLE_RETRIES     120             /* Total of 30 minutes */
 
index 05e50e55ebf17e48d2678bb71dd016386ff3cf3e..ef5b7d6052d699b415754819c608c92619b52fbf 100755 (executable)
@@ -1,6 +1,6 @@
 #!@PERL@ -w
 #
-# Copyright (c) 2006 Zmanda Inc.  All Rights Reserved.
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License version 2 as published
@@ -15,8 +15,8 @@
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 #
-# Contact information: Zmanda Inc, 505 N Mathlida Ave, Suite 120
-# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 #
 
 
index 675a647eba48691b24f243c874f9271ff8fb9f02..5d03ed53f8f9a67565e7b0739b98e012ad10d787 100644 (file)
@@ -72,7 +72,7 @@ am_init_feature_set(void)
 
        am_add_feature(f, fe_program_dump);
        am_add_feature(f, fe_program_gnutar);
-       am_add_feature(f, fe_program_backup_api);
+       am_add_feature(f, fe_program_application_api);
 
        am_add_feature(f, fe_options_compress_fast);
        am_add_feature(f, fe_options_compress_best);
@@ -147,6 +147,13 @@ am_init_feature_set(void)
        am_add_feature(f, fe_req_options_config);
 
        am_add_feature(f, fe_rep_sendsize_quoted_error);
+       am_add_feature(f, fe_req_xml);
+       am_add_feature(f, fe_pp_script);
+       am_add_feature(f, fe_amindexd_DLE);
+       am_add_feature(f, fe_amrecover_dle_in_header);
+       am_add_feature(f, fe_xml_estimate);
+       am_add_feature(f, fe_xml_property_priority);
+       am_add_feature(f, fe_sendsize_rep_warning);
     }
     return f;
 }
@@ -426,7 +433,7 @@ am_string_to_feature(
                ch2 -= 'a';
                ch2 += 10;
            } else {
-               amfree(f);                              /* bad conversion */
+               am_release_feature_set(f); /* bad conversion */
                break;
            }
            f->bytes[i] = (unsigned char)((ch1 << 4) | ch2);
index 1398c646382c08f06e9a58b01dd43982ee5902a2..4d007e87082af7ddcd4415f4ed1b6f6a15b51fad 100644 (file)
@@ -93,7 +93,7 @@ typedef enum {
 
     fe_program_dump,
     fe_program_gnutar,
-    fe_program_backup_api,             /* require fe_sendsize_req_options */
+    fe_program_application_api,                /* require fe_sendsize_req_options */
 
     fe_options_compress_fast,
     fe_options_compress_best,
@@ -172,6 +172,13 @@ typedef enum {
     fe_req_options_config,
 
     fe_rep_sendsize_quoted_error,
+    fe_req_xml,
+    fe_pp_script,      // only in XML
+    fe_amindexd_DLE,
+    fe_amrecover_dle_in_header,
+    fe_xml_estimate,
+    fe_xml_property_priority,
+    fe_sendsize_rep_warning,
 
     /*
      * All new features must be inserted immediately *before* this entry.
index 4becf5cc9d4951e320a34df6b1a13ca884cf33ec..2c5b151fd74135f7d983bb503f7d78b032de1c1f 100644 (file)
  */
 
 #include "amanda.h"
+#include "testutils.h"
 
 /* from amflock.c */
 extern amflock_impl_t *amflock_impls[];
 
-int
-main(void)
+/* Test all amflock implementations available for basic 
+ * functionality
+ */
+static int
+test_impls(void)
 {
     amflock_impl_t **imp = amflock_impls;
     char *filename = "./amflocktest.file";
@@ -43,43 +47,57 @@ main(void)
     _lnlock_dir = ".";
 
     while (*imp) {
-       g_fprintf(stderr, _("Testing amflock-%s\n"), (*imp)->impl_name);
-       alarm(5); /* time out after 5 seconds */
+       tu_dbg("Testing amflock-%s\n", (*imp)->impl_name);
 
        for (lock_ro = 0; lock_ro < 2; lock_ro++) { /* false (0) or true (1) */
            if (unlink(filename) == -1 && errno != ENOENT) {
                perror("unlink");
-               return 1;
+               return 0;
            }
 
            if ((fd = open(filename, O_RDWR | O_CREAT | O_EXCL, 0600)) == -1) {
                perror("open");
-               return 1;
+               return 0;
            }
 
            if (lock_ro) {
                if ((*imp)->amroflock_impl(fd, resource) != 0) {
                    perror("amroflock");
-                   return 1;
+                   return 0;
                }
            } else {
                if ((*imp)->amflock_impl(fd, resource) != 0) {
                    perror("amflock");
-                   return 1;
+                   return 0;
                }
            }
 
            if ((*imp)->amfunlock_impl(fd, resource) != 0) {
                perror("amfunlock");
-               return 1;
+               return 0;
            }
 
            close(fd); /* ignore error */
            unlink(filename); /* ignore error */
        }
 
+       fprintf(stderr, "  PASS amflock-%s\n", (*imp)->impl_name);
+
        imp++;
     }
 
-    return 0;
+    return 1;
+}
+
+/* TODO: a more serious test of exclusion using multiple processes */
+
+int
+main(int argc, char **argv)
+{
+    static TestUtilsTest tests[] = {
+       TU_TEST(test_impls, 10),
+       TU_END()
+    };
+
+    return testutils_run_tests(argc, argv, tests);
 }
diff --git a/common-src/amgetconf.pl b/common-src/amgetconf.pl
new file mode 100644 (file)
index 0000000..86870e1
--- /dev/null
@@ -0,0 +1,303 @@
+#! @PERL@
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+use lib '@amperldir@';
+use strict;
+use Amanda::Config qw( :getconf :init );
+use Amanda::Debug qw( :logging );
+use Amanda::Util qw( :constants );
+use Amanda::Paths;
+use Amanda::Constants;
+use Getopt::Long;
+
+# Implementation note: this application is a bit funny, because it does not
+# set up Amanda fully until some time into processing.  This lets it respond
+# with build configuration information without a config file, and lets it set
+# up debugging for the caller.  
+#
+# The most obvious consequence is that, rather than calling die (which interfaces
+# with Amanda::Debug), this file uses a locally defined 'fail' to print error 
+# messages.
+
+sub usage {
+    print <<EOF;
+Usage: amgetconf [--client] [--execute-where client|server] [-l|--list] [-o configoption]* <config> <paramname>
+  (any ordering of options and arguments is acceptable)
+
+--client is equivalent to --execute-where client
+
+--execute-where tells amgetconf whether to operate on the client or the 
+server; the server is the default.
+
+paramname can be one of
+  dbopen.APPNAME -- open a debug file
+  dbclose.APPNAME:FILENAME -- close debug file FILENAME
+  build.PARAM -- get a build parameter
+  PARAM -- get an Amanda configuration parameter
+
+For all but Amanda configuration parameters, the <config> option is
+ignored, but must be present.  For Amanda configuration parameters,
+values in subsections are specified in the form TYPE:NAME:PARAMETER.
+
+With --list, PARAM can be one of
+EOF
+    for my $name (keys %Amanda::Config::subsection_names) {
+       print "    $name\n";
+    }
+    exit(1);
+}
+
+sub fail {
+    print STDERR @_, "\n";
+    exit(1);
+}
+
+sub no_such_param {
+    my ($parameter) = @_;
+    fail("amgetconf: no such parameter \"$parameter\"");
+}
+
+## build parameters
+
+my %build_info = (
+    # NOTE TO MAINTAINERS:
+    #   If you add to this list, be sure to also add the new parameter 
+    #   amgetconf(8) manual page.  Note that all keys are lower-case.
+
+    ## directories from Amanda::Paths
+
+    'bindir' => $bindir,
+    'sbindir' => $sbindir,
+    'libexecdir' => $libexecdir,
+    'amlibexecdir' => $amlibexecdir,
+    'mandir' => $mandir,
+    'amanda_tmpdir' => $AMANDA_TMPDIR,
+    'config_dir' => $CONFIG_DIR,
+    'amanda_dbgdir' => $AMANDA_DBGDIR,
+    'application_dir' => $APPLICATION_DIR,
+    'gnutar_listed_incremental_dir' => $GNUTAR_LISTED_INCREMENTAL_DIR,
+    'listed_inc_dir' => $GNUTAR_LISTED_INCREMENTAL_DIR, # (historical alias)
+
+    ## constants from Amanda::Constants
+
+    # build environment info
+
+    'cc' => $Amanda::Constants::CC,
+    'version' => $Amanda::Constants::VERSION,
+    'assertions' => $Amanda::Constants::ASSERTIONS,
+    'use_version_suffixes' => $Amanda::Constants::USE_VERSION_SUFFIXES,
+    'locking' => $Amanda::Constants::LOCKING,
+
+    # executable paths
+
+    'dump' => $Amanda::Constants::DUMP,
+    'restore' => $Amanda::Constants::RESTORE,
+    'vdump' => $Amanda::Constants::VDUMP,
+    'vrestore' => $Amanda::Constants::VRESTORE,
+    'xfsdump' => $Amanda::Constants::XFSDUMP,
+    'xfsrestore' => $Amanda::Constants::XFSRESTORE,
+    'vxdump' => $Amanda::Constants::VXDUMP,
+    'vxrestore' => $Amanda::Constants::VXRESTORE,
+    'samba_client' => $Amanda::Constants::SAMBA_CLIENT,
+    'gnutar' => $Amanda::Constants::GNUTAR,
+    'star' => $Amanda::Constants::STAR,
+    'compress_path' => $Amanda::Constants::COMPRESS_PATH,
+    'uncompress_path' => $Amanda::Constants::UNCOMPRESS_PATH,
+    'aix_backup' => $Amanda::Constants::AIX_BACKUP,
+    'dump_returns_1' => $Amanda::Constants::DUMP_RETURNS_1,
+
+    # amanda modules
+
+    'bsd_security' => $Amanda::Constants::BSD_SECURITY,
+    'bsdudp_security' => $Amanda::Constants::BSDUDP_SECURITY,
+    'bsdtcp_security' => $Amanda::Constants::BSDTCP_SECURITY,
+    'krb4_security' => $Amanda::Constants::KRB4_SECURITY,
+    'krb5_security' => $Amanda::Constants::KRB5_SECURITY,
+    'ssh_security' => $Amanda::Constants::SSH_SECURITY,
+    'rsh_security' => $Amanda::Constants::RSH_SECURITY,
+    'use_amandahosts' => $Amanda::Constants::USE_AMANDAHOSTS,
+
+    # build-time constants
+    
+    'amanda_debug_days' => $Amanda::Constants::AMANDA_DEBUG_DAYS,
+    'default_server' => $Amanda::Constants::DEFAULT_SERVER,
+    'default_amandates_file' => $Amanda::Constants::DEFAULT_AMANDATES_FILE,
+    'default_config' => $Amanda::Constants::DEFAULT_CONFIG,
+    'default_tape_server' => $Amanda::Constants::DEFAULT_TAPE_SERVER,
+    'default_tape_device' => $Amanda::Constants::DEFAULT_TAPE_DEVICE,
+    'client_login' => $Amanda::Constants::CLIENT_LOGIN,
+    'use_rundump' => $Amanda::Constants::USE_RUNDUMP,
+    'check_userid' => $Amanda::Constants::CHECK_USERID,
+
+    # compression information
+
+    'compress_suffix' => $Amanda::Constants::COMPRESS_SUFFIX,
+    'compress_fast_opt' => $Amanda::Constants::COMPRESS_FAST_OPT,
+    'compress_best_opt' => $Amanda::Constants::COMPRESS_BEST_OPT,
+    'uncompress_opt' => $Amanda::Constants::UNCOMPRESS_OPT,
+
+    # kerberos information
+
+    'ticket_lifetime' => $Amanda::Constants::TICKET_LIFETIME,
+    'server_host_principal' => $Amanda::Constants::SERVER_HOST_PRINCIPAL,
+    'server_host_instance' => $Amanda::Constants::SERVER_HOST_INSTANCE,
+    'server_host_key_file' => $Amanda::Constants::SERVER_HOST_KEY_FILE,
+    'client_host_principal' => $Amanda::Constants::CLIENT_HOST_PRINCIPAL,
+    'client_host_instance' => $Amanda::Constants::CLIENT_HOST_INSTANCE,
+    'client_host_key_file' => $Amanda::Constants::CLIENT_HOST_KEY_FILE,
+    # (historical typos:)
+    'server_host_principle' => $Amanda::Constants::SERVER_HOST_PRINCIPAL,
+    'client_host_principle' => $Amanda::Constants::CLIENT_HOST_PRINCIPAL,
+    # (for testing purposes)
+    '__empty' => '',
+
+);
+
+sub build_param {
+    my ($parameter, $opt_list) = @_;
+
+    if ($opt_list) {
+       usage() unless ($parameter eq "build");
+
+       for my $pname (sort keys %build_info) {
+           print "$pname\n";
+       }
+    } else {
+       my ($pname) = $parameter =~ /^build\.(.*)/;
+
+       my $val = $build_info{lc $pname};
+       no_such_param($parameter) unless (defined($val));
+
+       print "$val\n";
+    }
+}
+
+## dbopen or dbclose
+
+sub db_param {
+    my ($parameter, $opt_list) = @_;
+    my ($appname, $filename);
+    if (($appname) = $parameter =~ /^dbopen\.(.*)/) {
+       $appname =~ s/[^[:alnum:]]/_/g;
+       Amanda::Util::setup_application($appname, "server", $CONTEXT_CMDLINE);
+       print Amanda::Debug::dbfn(), "\n";
+    } elsif (($appname, $filename) = $parameter =~ /^dbclose\.([^:]*):(.*)/) {
+       fail("debug file $filename does not exist") unless (-f $filename);
+       Amanda::Debug::dbreopen($filename, '');
+       Amanda::Debug::dbclose();
+       print "$filename\n";
+    } else {
+       fail("cannot parse $parameter");
+    }
+}
+
+## regular configuration parameters
+
+sub conf_param {
+    my ($parameter, $opt_list) = @_;
+
+    if ($opt_list) {
+       # getconf_list will return an empty list for any unrecognized name,
+       # so first check that the user has supplied a real subsection
+       no_such_param($parameter)
+           unless defined($Amanda::Config::subsection_names{$parameter});
+       my @list = getconf_list($parameter);
+
+       for my $subsec (@list) {
+           print "$subsec\n";
+       }
+    } else {
+       no_such_param($parameter)
+           unless defined(getconf_byname($parameter));
+       my @strs = getconf_byname_strs($parameter, 0);
+       
+       for my $str (@strs) {
+           print "$str\n";
+       }
+    }
+}
+
+## Command-line parsing
+
+my $opt_list = '';
+my $config_overwrites = new_config_overwrites($#ARGV+1);
+my $execute_where = undef;
+
+Getopt::Long::Configure(qw{bundling});
+GetOptions(
+    'list|l' => \$opt_list,
+    'o=s' => sub { add_config_overwrite_opt($config_overwrites, $_[1]); },
+    'execute-where=s' => sub {
+        my $where = lc($_[1]);
+        fail("Invalid value ($_[1]) for --execute-where. Must be client or server.") 
+            unless $where eq 'client' or $where eq 'server';
+        fail("--execute-where=server conflicts with --execute-where=client or --client.")
+            unless !defined($execute_where) || (
+                ($where eq 'client' && $execute_where) ||
+                ($where eq 'server' && !$execute_where));
+        $execute_where = ($where eq 'client')? $CONFIG_INIT_CLIENT : 0;
+    },
+    'client' => sub {
+        fail("--execute-where=server conflicts with --execute-where=client or --client.")
+            unless !defined($execute_where) || $execute_where;
+        $execute_where = $CONFIG_INIT_CLIENT;
+    }
+) or usage();
+
+my $config_name;
+my $parameter;
+
+if (@ARGV == 1) {
+    $parameter = $ARGV[0];
+} elsif (@ARGV >= 2) {
+    # note that we ignore any arguments past these two.  Amdump lazily passes 
+    # such arguments on to us, so we have no choice.
+    $config_name = $ARGV[0];
+    $parameter = $ARGV[1];
+} else {
+    usage();
+}
+
+## Now start looking at the parameter.
+
+if ($parameter =~ /^build(?:\..*)?/) {
+    build_param($parameter, $opt_list);
+    exit(0);
+} 
+
+if ($parameter =~ /^db(open|close)\./) {
+    db_param($parameter, $opt_list);
+    exit(0);
+}
+
+# finally, finish up the application startup procedure
+Amanda::Util::setup_application("amgetconf", "server", $CONTEXT_SCRIPTUTIL);
+config_init($CONFIG_INIT_EXPLICIT_NAME | $CONFIG_INIT_USE_CWD | $execute_where, $config_name);
+apply_config_overwrites($config_overwrites);
+my ($cfgerr_level, @cfgerr_errors) = config_errors();
+if ($cfgerr_level >= $CFGERR_WARNINGS) {
+    config_print_errors();
+    if ($cfgerr_level >= $CFGERR_ERRORS) {
+       die("errors processing config file");
+    }
+}
+
+Amanda::Util::finish_setup($RUNNING_AS_ANY);
+
+conf_param($parameter, $opt_list);
index 28526705cb6a24b3e29ed1a6d09d39e87f63aeec..e746c0e54db7e647d1ef48cba292b71f4194f0a8 100755 (executable)
@@ -1,6 +1,6 @@
 #!@PERL@ -w
 #
-# Copyright (c) 2006 Zmanda Inc.  All Rights Reserved.
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License version 2 as published
@@ -15,8 +15,8 @@
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 #
-# Contact information: Zmanda Inc, 505 N Mathlida Ave, Suite 120
-# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 #
 
 # Amanda has problem with gpg mdc(modification detection code) in the binary mode.
diff --git a/common-src/amxml.c b/common-src/amxml.c
new file mode 100644 (file)
index 0000000..b6e96c4
--- /dev/null
@@ -0,0 +1,927 @@
+/*
+ * Amanda, The Advanced Maryland Automatic Network Disk Archiver
+ * Copyright (c) 1991-1998 University of Maryland at College Park
+ * All Rights Reserved.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of U.M. not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  U.M. makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as is"
+ * without express or implied warranty.
+ *
+ * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M.
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors: the Amanda Development Team.  Its members are listed in a
+ * file named AUTHORS, in the root directory of this distribution.
+ */
+
+/*
+ * $Id: amxml.c 5151 2007-02-06 15:41:53Z martineau $
+ *
+ * xml parsing of amanda protocol packet
+ */
+
+#include "amanda.h"
+#include "util.h"
+#include "amxml.h"
+#include "glib.h"
+#include "conffile.h"
+#include "base64.h"
+
+typedef struct amgxml_s {
+    dle_t   *dles;
+    dle_t   *dle;
+    GSList  *element_names;
+    int      has_calcsize;
+    int      has_estimate;
+    int      has_record;
+    int      has_spindle;
+    int      has_compress;
+    int      has_encrypt;
+    int      has_kencrypt;
+    int      has_exclude;
+    int      has_include;
+    int      has_index;
+    int      has_backup_program;
+    int      has_plugin;
+    int      has_optional;
+    char    *property_name;
+    property_t *property_data;
+    proplist_t  property;
+    script_t   *script;
+    char       *encoding;
+    char       *raw;
+
+} amgxml_t;
+
+
+dle_t *
+alloc_dle(void)
+{
+    dle_t *dle;
+
+    dle = malloc(sizeof(dle_t));
+    init_dle(dle);
+    return dle;
+}
+
+void
+init_dle(
+    dle_t *dle)
+{
+    dle->disk = NULL;
+    dle->device = NULL;
+    dle->program_is_application_api = 0;
+    dle->program = NULL;
+    dle->calcsize = 0;
+    dle->estimate = 0;
+    dle->record = 1;
+    dle->spindle = 0;
+    dle->compress = COMP_NONE;
+    dle->encrypt = ENCRYPT_NONE;
+    dle->kencrypt = 0;
+    dle->level = NULL;
+    dle->dumpdate = NULL;
+    dle->compprog = NULL;
+    dle->srv_encrypt = NULL;
+    dle->clnt_encrypt = NULL;
+    dle->srv_decrypt_opt = NULL;
+    dle->clnt_decrypt_opt = NULL;
+    dle->create_index = 0;
+    dle->auth = NULL;
+    dle->exclude_file = NULL;
+    dle->exclude_list = NULL;
+    dle->include_file = NULL;
+    dle->include_list = NULL;
+    dle->exclude_optional = 0;
+    dle->include_optional = 0;
+    dle->application_property = NULL;
+    dle->scriptlist = NULL;
+    dle->next = NULL;
+}
+
+
+/* Called for open tags <foo bar="baz"> */
+static void amstart_element(GMarkupParseContext *context,
+                           const gchar         *element_name,
+                           const gchar        **attribute_names,
+                           const gchar        **attribute_values,
+                           gpointer             user_data,
+                           GError             **gerror);
+
+/* Called for close tags </foo> */
+static void amend_element(GMarkupParseContext *context,
+                         const gchar         *element_name,
+                         gpointer             user_data,
+                         GError             **gerror);
+
+/* Called for character data */
+/* text is not nul-terminated */
+static void amtext(GMarkupParseContext *context,
+                  const gchar         *text,
+                  gsize                text_len,  
+                  gpointer             user_data,
+                  GError             **gerror);
+
+/* Called for open tags <foo bar="baz"> */
+static void
+amstart_element(
+    G_GNUC_UNUSED GMarkupParseContext *context,
+                 const gchar         *element_name,
+    G_GNUC_UNUSED const gchar        **attribute_names,
+    G_GNUC_UNUSED const gchar        **attribute_values,
+                 gpointer             user_data,
+                 GError             **gerror)
+{
+    amgxml_t *data_user = user_data;
+    dle_t    *adle;
+    GSList   *last_element = data_user->element_names;
+    char     *last_element_name = NULL;
+    dle_t    *dle = data_user->dle;
+    const gchar   **at_names, **at_values;
+
+    if (last_element)
+       last_element_name = last_element->data;
+
+    data_user->raw = NULL;
+    data_user->encoding = NULL;
+
+    if (attribute_names) {
+       for(at_names = attribute_names, at_values = attribute_values;
+           *at_names != NULL && at_values != NULL;
+           at_names++, at_values++) {
+           if (strcmp(*at_names, "encoding") == 0) {
+               data_user->encoding = stralloc(*at_values);
+           } else if (strcmp(*at_names, "raw") == 0) {
+               data_user->raw = base64_decode_alloc_string((char *)*at_values);
+           } else {
+               g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                           "XML: Invalid attribute '%s' for %s element",
+                           *at_names, element_name);
+               return;
+           }
+       }
+    }
+
+    if (strcmp(element_name, "dle") == 0) {
+       if (last_element != NULL) {
+           g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                       "XML: Invalid dle element");
+           return;
+       }
+       for(adle = data_user->dles; adle != NULL && adle->next != NULL;
+           adle = adle->next);
+       data_user->dle = alloc_dle();
+       if (adle == NULL) {
+           data_user->dles = data_user->dle;
+       } else {
+           adle->next = data_user->dle;
+       }
+       data_user->has_calcsize = 0;
+       data_user->has_estimate = 0;
+       data_user->has_record = 0;
+       data_user->has_spindle = 0;
+       data_user->has_compress = 0;
+       data_user->has_encrypt = 0;
+       data_user->has_kencrypt = 0;
+       data_user->has_exclude = 0;
+       data_user->has_include = 0;
+       data_user->has_index = 0;
+       data_user->has_backup_program = 0;
+       data_user->has_plugin = 0;
+       data_user->has_optional = 0;
+       data_user->property_name = NULL;
+       data_user->property_data = NULL;
+    } else if(strcmp(element_name, "disk"          ) == 0 ||
+             strcmp(element_name, "diskdevice"    ) == 0 ||
+             strcmp(element_name, "calcsize"      ) == 0 ||
+             strcmp(element_name, "estimate"      ) == 0 ||
+             strcmp(element_name, "program"       ) == 0 ||
+             strcmp(element_name, "auth"          ) == 0 ||
+             strcmp(element_name, "index"         ) == 0 ||
+             strcmp(element_name, "dumpdate"      ) == 0 ||
+             strcmp(element_name, "level"         ) == 0 ||
+             strcmp(element_name, "record"        ) == 0 ||
+             strcmp(element_name, "spindle"       ) == 0 ||
+             strcmp(element_name, "compress"      ) == 0 ||
+             strcmp(element_name, "encrypt"       ) == 0 ||
+             strcmp(element_name, "kencrypt"      ) == 0 ||
+             strcmp(element_name, "exclude"       ) == 0 ||
+             strcmp(element_name, "include"       ) == 0) {
+       if (strcmp(last_element_name, "dle") != 0) {
+           g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                       "XML: Invalid %s element", element_name);
+           return;
+       }
+       if ((strcmp(element_name, "disk"          ) == 0 && dle->disk) ||
+           (strcmp(element_name, "diskdevice"    ) == 0 && dle->device) ||
+           (strcmp(element_name, "calcsize"      ) == 0 && data_user->has_calcsize) ||
+           (strcmp(element_name, "estimate"      ) == 0 && data_user->has_estimate) ||
+           (strcmp(element_name, "record"        ) == 0 && data_user->has_record) ||
+           (strcmp(element_name, "spindle"       ) == 0 && data_user->has_spindle) ||
+           (strcmp(element_name, "program"       ) == 0 && dle->program) ||
+           (strcmp(element_name, "auth"          ) == 0 && dle->auth) ||
+           (strcmp(element_name, "index"         ) == 0 && data_user->has_index) ||
+           (strcmp(element_name, "dumpdate"      ) == 0 && dle->dumpdate) ||
+           (strcmp(element_name, "compress"      ) == 0 && data_user->has_compress) ||
+           (strcmp(element_name, "encrypt"       ) == 0 && data_user->has_encrypt) ||
+           (strcmp(element_name, "kencrypt"      ) == 0 && data_user->has_kencrypt) ||
+           (strcmp(element_name, "exclude"       ) == 0 && data_user->has_exclude) ||
+           (strcmp(element_name, "include"       ) == 0 && data_user->has_include)) {
+           g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                       "XML: Duplicate %s element", element_name);
+           return;
+       }
+       if (strcmp(element_name, "calcsize"      ) == 0) data_user->has_calcsize       = 1;
+       if (strcmp(element_name, "estimate"      ) == 0) data_user->has_estimate       = 1;
+       if (strcmp(element_name, "record"        ) == 0) data_user->has_record         = 1;
+       if (strcmp(element_name, "spindle"       ) == 0) data_user->has_spindle        = 1;
+       if (strcmp(element_name, "index"         ) == 0) data_user->has_index          = 1;
+       if (strcmp(element_name, "compress"      ) == 0) data_user->has_compress       = 1;
+       if (strcmp(element_name, "encrypt"       ) == 0) data_user->has_encrypt        = 1;
+       if (strcmp(element_name, "kencrypt"       ) == 0) data_user->has_kencrypt        = 1;
+       if (strcmp(element_name, "exclude"       ) == 0) data_user->has_exclude        = 1;
+       if (strcmp(element_name, "include"       ) == 0) data_user->has_include        = 1;
+       if (strcmp(element_name, "exclude") == 0 || strcmp(element_name, "include") == 0)
+          data_user->has_optional = 0;
+    } else if(strcmp(element_name, "custom-compress-program") == 0) {
+       if (strcmp(last_element_name, "compress") != 0) {
+           g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                       "XML: Invalid %s element", element_name);
+           return;
+       }
+       if (dle->compprog) {
+           g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                       "XML: Duplicate %s element", element_name);
+           return;
+       }
+    } else if (strcmp(element_name, "custom-encrypt-program") == 0 ||
+              strcmp(element_name, "decrypt-option") == 0) {
+       if (strcmp(last_element_name, "encrypt") != 0) {
+           g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                       "XML: Invalid %s element", element_name);
+           return;
+       }
+       if (strcmp(element_name, "custom-encrypt-program") == 0 &&
+                  dle->clnt_encrypt) {
+           g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                       "XML: Duplicate %s element", element_name);
+           return;
+       }
+       if (strcmp(element_name, "decrypt-option") == 0 &&
+                  dle->clnt_decrypt_opt) {
+           g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                       "XML: Duplicate %s element", element_name);
+           return;
+       }
+    } else if(strcmp(element_name, "plugin") == 0) {
+       if (strcmp(last_element_name, "backup-program") != 0 &&
+           strcmp(last_element_name, "script") != 0) {
+           g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                       "XML: Invalid %s element", element_name);
+           return;
+       }
+       if (data_user->has_plugin) {
+           g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                       "XML: Duplicate %s element in '%s'", element_name,
+                       last_element_name);
+           return;
+       }
+    } else if(strcmp(element_name, "property") == 0) {
+       if (strcmp(last_element_name, "backup-program") != 0 &&
+           strcmp(last_element_name, "script") != 0) {
+           g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                       "XML: Invalid %s element", element_name);
+           return;
+       }
+       data_user->property_data = malloc(sizeof(property_t));
+       data_user->property_data->append = 0;
+       data_user->property_data->priority = 0;
+       data_user->property_data->values = NULL;
+    } else if(strcmp(element_name, "name") == 0) {
+       if (strcmp(last_element_name, "property") != 0) {
+           g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                       "XML: Invalid %s element", element_name);
+           return;
+       }
+       if (data_user->property_name) {
+           g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                       "XML: Duplicate %s element in '%s'", element_name,
+                       last_element_name);
+           return;
+       }
+    } else if(strcmp(element_name, "priority") == 0) {
+       if (strcmp(last_element_name, "property") != 0) {
+           g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                       "XML: Invalid %s element", element_name);
+           return;
+       }
+    } else if(strcmp(element_name, "value") == 0) {
+       if (strcmp(last_element_name, "property") != 0) {
+           g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                       "XML: Invalid %s element", element_name);
+           return;
+       }
+    } else if(strcmp(element_name, "file") == 0 ||
+             strcmp(element_name, "list") == 0 ||
+             strcmp(element_name, "optional") == 0) {
+       if (strcmp(last_element_name, "exclude") != 0 &&
+           strcmp(last_element_name, "include") != 0) {
+           g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                       "XML: Invalid %s element", element_name);
+           return;
+       }
+       if (strcmp(element_name, "optional") == 0 && data_user->has_optional) {
+           g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                       "XML: Duplicate %s element", element_name);
+           return;
+       }
+       if (strcmp(element_name, "optional") == 0) data_user->has_optional = 1;
+    } else if (strcmp(element_name, "backup-program") == 0) {
+       if (data_user->has_backup_program) {
+           g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                       "XML: Duplicate %s element", element_name);
+           return;
+       } else {
+           data_user->has_backup_program = 1;
+           data_user->property =
+                   g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL);
+           data_user->has_plugin = 0;
+       }
+    } else if (strcmp(element_name, "script") == 0) {
+       data_user->property =
+                   g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL);
+       data_user->script = malloc(sizeof(script_t));
+       data_user->script->plugin = NULL;
+       data_user->script->execute_on = 0;
+       data_user->script->execute_where = ES_CLIENT;
+       data_user->script->property = NULL;
+       data_user->script->result = NULL;
+       data_user->has_plugin = 0;
+    } else if (strcmp(element_name, "execute_on") == 0) {
+    } else if (strcmp(element_name, "execute_where") == 0) {
+    } else {
+       g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                   "XML: Invalid %s element", element_name);
+       return;
+    }
+    data_user->element_names = g_slist_prepend(data_user->element_names,
+                                              stralloc(element_name));
+}
+
+/* Called for close tags </foo> */
+static void
+amend_element(
+    G_GNUC_UNUSED GMarkupParseContext *context,
+                 const gchar         *element_name,
+                 gpointer             user_data,
+                 GError             **gerror)
+{
+    amgxml_t *data_user = user_data;
+    GSList   *last_element = data_user->element_names;
+    char     *last_element_name = NULL;
+    dle_t    *dle = data_user->dle;
+
+    if (!last_element) {
+       g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                   "XML: Invalid closing tag");
+       return;
+    }
+    last_element_name = last_element->data;
+    if (strcmp(last_element_name, element_name) != 0) {
+       g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                   "XML: Invalid closing tag '%s'", element_name);
+       return;
+    }
+
+    if (strcmp(element_name, "property") == 0) {
+       g_hash_table_insert(data_user->property,
+                           data_user->property_name,
+                           data_user->property_data);
+       data_user->property_name = NULL;
+       data_user->property_data = NULL;
+    } else if (strcmp(element_name, "dle") == 0) {
+       if (dle->disk == NULL) {
+           g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                   "XML: No disk provided in DLE element");
+           return;
+       }
+       if (dle->program_is_application_api &&
+           !dle->program) {
+           g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                   "XML: program set to APPLICATION but no application set");
+           return;
+       }
+       if (dle->device == NULL && dle->disk)
+           dle->device = stralloc(dle->disk);
+/* Add check of required field */
+       data_user->dle = NULL;
+    } else if (strcmp(element_name, "backup-program") == 0) {
+       if (dle->program == NULL) {
+           g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                   "XML: No plugin set for application");
+           return;
+       }
+       dle->application_property = data_user->property;
+       data_user->property = NULL;
+    } else if (strcmp(element_name, "script") == 0) {
+       if (data_user->script->plugin == NULL) {
+           g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                   "XML: No plugin set for script");
+           return;
+       }
+       data_user->script->property = data_user->property;
+       data_user->property = NULL;
+       dle->scriptlist = g_slist_append(dle->scriptlist, data_user->script);
+       data_user->script = NULL;
+    }
+    g_free(data_user->element_names->data);
+    data_user->element_names = g_slist_delete_link(data_user->element_names,
+                                                  data_user->element_names);
+}
+
+/* Called for character data */
+/* text is not nul-terminated */
+static void
+amtext(
+    G_GNUC_UNUSED GMarkupParseContext *context,
+                 const gchar         *text,
+                 gsize                text_len,  
+                 gpointer             user_data,
+                 GError             **gerror)
+{
+    char     *tt;
+    amgxml_t *data_user = user_data;
+    GSList   *last_element = data_user->element_names;
+    char     *last_element_name;
+    GSList   *last_element2;
+    char     *last_element2_name;
+    dle_t    *dle = data_user->dle;
+    int       i;
+
+    if (!last_element) {
+       g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                   "XML: Invalid text");
+       return;
+    }
+    last_element_name = last_element->data;
+
+    tt = malloc(text_len + 1);
+    strncpy(tt,text,text_len);
+    tt[text_len] = '\0';
+
+    //check if it is only space
+    if (match_no_newline("^[ \f\n\r\t\v]*$", tt)) {
+       amfree(tt);
+       return;
+    }
+
+    if (data_user->raw) {
+       amfree(tt);
+       tt = stralloc(data_user->raw);
+    }
+
+    //check if it is only space
+    if (match_no_newline("^[ \f\n\r\t\v]*$", tt)) {
+       amfree(tt);
+       return;
+    }
+
+    if (strcmp(last_element_name, "dle") == 0 ||
+       strcmp(last_element_name, "backup-program") == 0 ||
+       strcmp(last_element_name, "exclude") == 0 ||
+       strcmp(last_element_name, "include") == 0) {
+       g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                   "XML: %s doesn't have text '%s'", last_element_name, tt);
+       return;
+    } else if(strcmp(last_element_name, "disk") == 0) {
+       if (dle->disk != NULL) {
+           g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                       "XML: multiple text in %s", last_element_name);
+           return;
+       }
+       dle->disk = tt;
+    } else if(strcmp(last_element_name, "diskdevice") == 0) {
+       if (dle->device != NULL) {
+           g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                       "XML: multiple text in %s", last_element_name);
+           return;
+       }
+       dle->device = tt;
+    } else if(strcmp(last_element_name, "calcsize") == 0) {
+       if (strcasecmp(tt,"yes") == 0) {
+           dle->calcsize = 1;
+       }
+       amfree(tt);
+    } else if(strcmp(last_element_name, "estimate") == 0) {
+       if (strcasecmp(tt,"client") == 0) {
+           dle->estimate = ES_CLIENT;
+       } else if (strcasecmp(tt,"calcsize") == 0) {
+           dle->estimate = ES_CALCSIZE;
+           dle->calcsize = 1;
+       } else if (strcasecmp(tt,"server") == 0) {
+           dle->estimate = ES_SERVER;
+       }
+       amfree(tt);
+    } else if(strcmp(last_element_name, "program") == 0) {
+       if (dle->program != NULL) {
+           g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                       "XML: multiple text in %s", last_element_name);
+           return;
+       }
+       dle->program = tt;
+       if (strcmp(tt, "APPLICATION") == 0) {
+           dle->program_is_application_api = 1;
+           dle->program = NULL;
+       }
+    } else if(strcmp(last_element_name, "plugin") == 0) {
+       last_element2 = g_slist_nth(data_user->element_names, 1);
+       if (!last_element2) {
+           error("Invalid name text");
+       }
+       last_element2_name = last_element2->data;
+       if (strcmp(last_element2_name, "backup-program") == 0) {
+           dle->program = tt;
+       } else if (strcmp(last_element2_name, "script") == 0) {
+           data_user->script->plugin = tt;
+       } else {
+           error("plugin outside of backup-program");
+       }
+       data_user->has_plugin = 1;
+    } else if(strcmp(last_element_name, "name") == 0) {
+       last_element2 = g_slist_nth(data_user->element_names, 1);
+       if (!last_element2) {
+           error("Invalid name text");
+       }
+       last_element2_name = last_element2->data;
+       if (strcmp(last_element2_name, "property") == 0) {
+           data_user->property_name = tt;
+       } else {
+           error("name outside of property");
+       }
+    } else if(strcmp(last_element_name, "priority") == 0) {
+       last_element2 = g_slist_nth(data_user->element_names, 1);
+       if (!last_element2) {
+           error("Invalid priority text");
+       }
+       last_element2_name = last_element2->data;
+       if (strcmp(last_element2_name, "property") == 0) {
+           if (strcasecmp(tt,"yes") == 0) {
+               data_user->property_data->priority = 1;
+           }
+       } else {
+           error("priority outside of property");
+       }
+    } else if(strcmp(last_element_name, "value") == 0) {
+       last_element2 = g_slist_nth(data_user->element_names, 1);
+       if (!last_element2) {
+           error("Invalid name text");
+       }
+       last_element2_name = last_element2->data;
+       if (strcmp(last_element2_name, "property") == 0) {
+           data_user->property_data->values =
+                       g_slist_append(data_user->property_data->values, tt);
+       } else {
+           error("value outside of property");
+       }
+    } else if(strcmp(last_element_name, "auth") == 0) {
+       if (dle->auth != NULL) {
+           g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                       "XML: multiple text in %s", last_element_name);
+           return;
+       }
+       dle->auth = tt;
+    } else if(strcmp(last_element_name, "level") == 0) {
+       dle->level = g_slist_append(dle->level, GINT_TO_POINTER(atoi(tt)));
+       amfree(tt);
+    } else if(strcmp(last_element_name, "index") == 0) {
+       if (strcasecmp(tt,"no") == 0) {
+           dle->create_index = 0;
+       } else if (strcasecmp(tt,"yes") == 0) {
+           dle->create_index = 1;
+       } else {
+           g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                       "XML: Invalid %s (%s)", last_element_name, tt);
+           amfree(tt);
+           return;
+       }
+       amfree(tt);
+    } else if(strcmp(last_element_name, "dumpdate") == 0) {
+       if (dle->dumpdate != NULL) {
+           g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                       "XML: multiple text in %s", last_element_name);
+           amfree(tt);
+           return;
+       }
+       dle->dumpdate = tt;
+    } else if(strcmp(last_element_name, "record") == 0) {
+       if (strcasecmp(tt, "no") == 0) {
+           dle->record = 0;
+       } else if (strcasecmp(tt, "yes") == 0) {
+           dle->record = 1;
+       } else {
+           g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                       "XML: Invalid %s (%s)", last_element_name, tt);
+           return;
+       }
+    } else if(strcmp(last_element_name, "spindle") == 0) {
+       dle->spindle = atoi(tt);
+    } else if(strcmp(last_element_name, "compress") == 0) {
+       if (strcmp(tt, "FAST") == 0) {
+           dle->compress = COMP_FAST;
+       } else if (strcmp(tt, "BEST") == 0) {
+           dle->compress = COMP_BEST;
+       } else if (BSTRNCMP(tt, "CUSTOM") == 0) {
+           dle->compress = COMP_CUST;
+       } else if (strcmp(tt, "SERVER-FAST") == 0) {
+           dle->compress = COMP_SERVER_FAST;
+       } else if (strcmp(tt, "SERVER-BEST") == 0) {
+           dle->compress = COMP_SERVER_BEST;
+       } else if (BSTRNCMP(tt, "SERVER-CUSTOM") == 0) {
+           dle->compress = COMP_SERVER_CUST;
+       } else {
+           g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                       "XML: Invalid %s (%s)", last_element_name, tt);
+           amfree(tt);
+           return;
+       }
+       amfree(tt);
+    } else if(strcmp(last_element_name, "custom-compress-program") == 0) {
+       if (dle->compprog != NULL) {
+           g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                       "XML: multiple text in %s", last_element_name);
+           amfree(tt);
+           return;
+       }
+       dle->compprog = tt;
+    } else if(strcmp(last_element_name, "encrypt") == 0) {
+       if (BSTRNCMP(tt,"NO") == 0) {
+           dle->encrypt = ENCRYPT_NONE;
+       } else if (BSTRNCMP(tt, "CUSTOM") == 0) {
+           dle->encrypt = ENCRYPT_CUST;
+       } else if (BSTRNCMP(tt, "SERVER-CUSTOM") == 0) {
+           dle->encrypt = ENCRYPT_SERV_CUST;
+       } else {
+           g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                       "XML: Invalid %s (%s)", last_element_name, tt);
+           amfree(tt);
+           return;
+       }
+       amfree(tt);
+    } else if(strcmp(last_element_name, "kencrypt") == 0) {
+       if (strcasecmp(tt,"no") == 0) {
+           dle->kencrypt = 0;
+       } else if (strcasecmp(tt,"yes") == 0) {
+           dle->kencrypt = 1;
+       } else {
+           g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                       "XML: Invalid %s (%s)", last_element_name, tt);
+           amfree(tt);
+           return;
+       }
+       amfree(tt);
+    } else if(strcmp(last_element_name, "custom-encrypt-program") == 0) {
+       last_element2 = g_slist_nth(data_user->element_names, 1);
+       if (!last_element2) {
+           error("XML: optional");
+       }
+       last_element2_name = last_element2->data;
+       dle->clnt_encrypt = tt;
+    } else if(strcmp(last_element_name, "decrypt-option") == 0) {
+       last_element2 = g_slist_nth(data_user->element_names, 1);
+       if (!last_element2) {
+           error("XML: optional");
+       }
+       last_element2_name = last_element2->data;
+       dle->clnt_decrypt_opt = tt;
+    } else if(strcmp(last_element_name, "exclude") == 0 ||
+             strcmp(last_element_name, "include") == 0) {
+       data_user->has_optional = 0;
+    } else if(strcmp(last_element_name, "file") == 0) {
+       last_element2 = g_slist_nth(data_user->element_names, 1);
+       if (!last_element2) {
+           error("XML: optional");
+       }
+       last_element2_name = last_element2->data;
+       if (strcmp(last_element2_name, "exclude") == 0) {
+           dle->exclude_file = append_sl(dle->exclude_file, tt);
+       } else if (strcmp(last_element2_name, "include") == 0) {
+           dle->include_file = append_sl(dle->include_file, tt);
+       } else {
+           error("bad file");
+       }
+    } else if(strcmp(last_element_name, "list") == 0) {
+       last_element2 = g_slist_nth(data_user->element_names, 1);
+       if (!last_element2) {
+           error("XML: optional");
+       }
+       last_element2_name = last_element2->data;
+       if (strcmp(last_element2_name, "exclude") == 0) {
+           dle->exclude_list = append_sl(dle->exclude_list, tt);
+       } else if (strcmp(last_element2_name, "include") == 0) {
+           dle->include_list = append_sl(dle->include_list, tt);
+       } else {
+           error("bad list");
+       }
+    } else if(strcmp(last_element_name, "optional") == 0) {
+       i = atoi(tt);
+       last_element2 = g_slist_nth(data_user->element_names, 1);
+       if (!last_element2) {
+           error("XML: optional");
+       }
+       last_element2_name = last_element2->data;
+       if (strcmp(last_element2_name, "exclude") == 0) {
+           dle->exclude_optional = 1;
+       } else if (strcmp(last_element2_name, "include") == 0) {
+           dle->include_optional = 1;
+       } else {
+           error("bad optional");
+       }
+       data_user->has_optional = 1;
+       amfree(tt);
+    } else if(strcmp(last_element_name, "script") == 0) {
+    } else if(strcmp(last_element_name, "execute_on") == 0) {
+       char *sep;
+       char *tt1 = tt;
+       do {
+           sep = strchr(tt1,',');
+           if (sep)
+               *sep = '\0';
+           if (strcmp(tt1,"PRE-DLE-AMCHECK") == 0)
+               data_user->script->execute_on |= EXECUTE_ON_PRE_DLE_AMCHECK;
+           else if (strcmp(tt1,"PRE-HOST-AMCHECK") == 0)
+               data_user->script->execute_on |= EXECUTE_ON_PRE_HOST_AMCHECK;
+           else if (strcmp(tt1,"POST-DLE-AMCHECK") == 0)
+               data_user->script->execute_on |= EXECUTE_ON_POST_DLE_AMCHECK;
+           else if (strcmp(tt1,"POST-HOST-AMCHECK") == 0)
+               data_user->script->execute_on |= EXECUTE_ON_POST_HOST_AMCHECK;
+           else if (strcmp(tt1,"PRE-DLE-ESTIMATE") == 0)
+               data_user->script->execute_on |= EXECUTE_ON_PRE_DLE_ESTIMATE;
+           else if (strcmp(tt1,"PRE-HOST-ESTIMATE") == 0)
+               data_user->script->execute_on |= EXECUTE_ON_PRE_HOST_ESTIMATE;
+           else if (strcmp(tt1,"POST-DLE-ESTIMATE") == 0)
+               data_user->script->execute_on |= EXECUTE_ON_POST_DLE_ESTIMATE;
+           else if (strcmp(tt1,"POST-HOST-ESTIMATE") == 0)
+               data_user->script->execute_on |= EXECUTE_ON_POST_HOST_ESTIMATE;
+           else if (strcmp(tt1,"PRE-DLE-BACKUP") == 0)
+               data_user->script->execute_on |= EXECUTE_ON_PRE_DLE_BACKUP;
+           else if (strcmp(tt1,"PRE-HOST-BACKUP") == 0)
+               data_user->script->execute_on |= EXECUTE_ON_PRE_HOST_BACKUP;
+           else if (strcmp(tt1,"POST-DLE-BACKUP") == 0)
+               data_user->script->execute_on |= EXECUTE_ON_POST_DLE_BACKUP;
+           else if (strcmp(tt1,"POST-HOST-BACKUP") == 0)
+               data_user->script->execute_on |= EXECUTE_ON_POST_HOST_BACKUP;
+           else if (strcmp(tt1,"PRE-RECOVER") == 0)
+               data_user->script->execute_on |= EXECUTE_ON_PRE_RECOVER;
+           else if (strcmp(tt1,"POST-RECOVER") == 0)
+               data_user->script->execute_on |= EXECUTE_ON_POST_RECOVER;
+           else if (strcmp(tt1,"PRE-LEVEL-RECOVER") == 0)
+               data_user->script->execute_on |= EXECUTE_ON_PRE_LEVEL_RECOVER;
+           else if (strcmp(tt1,"POST-LEVEL-RECOVER") == 0)
+               data_user->script->execute_on |= EXECUTE_ON_POST_LEVEL_RECOVER;
+           else if (strcmp(tt1,"INTER-LEVEL-RECOVER") == 0)
+               data_user->script->execute_on |= EXECUTE_ON_INTER_LEVEL_RECOVER;
+           else 
+               dbprintf("BAD EXECUTE_ON: %s\n", tt1);
+           if (sep)
+               tt1 = sep+1;
+       } while (sep);
+       amfree(tt);
+    } else if(strcmp(last_element_name, "execute_where") == 0) {
+       if (strcmp(tt, "CLIENT") == 0) {
+           data_user->script->execute_where = ES_CLIENT;
+       } else {
+           data_user->script->execute_where = ES_SERVER;
+       }
+    } else {
+       g_set_error(gerror, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
+                   "XML: amtext not defined for '%s'", last_element_name);
+       return;
+    }
+}
+
+dle_t *
+amxml_parse_node_CHAR(
+    char *txt,
+    char **errmsg)
+{
+    amgxml_t             amgxml = {NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL};
+    GMarkupParser        parser = {&amstart_element, &amend_element, &amtext,
+                                  NULL, NULL};
+    GMarkupParseFlags    flags = 0;
+    GMarkupParseContext *context;
+    GError             *gerror = NULL;
+
+    (void)errmsg;
+
+    context = g_markup_parse_context_new(&parser, flags, &amgxml, NULL);
+
+    g_markup_parse_context_parse(context, txt, strlen(txt), &gerror);
+    if (!gerror)
+       g_markup_parse_context_end_parse(context, &gerror);
+    g_markup_parse_context_free(context);
+    if (gerror) {
+       if (errmsg)
+           *errmsg = stralloc(gerror->message);
+       g_error_free(gerror);
+    }
+    return amgxml.dles;
+       
+}
+
+dle_t *
+amxml_parse_node_FILE(
+    FILE *file,
+    char **errmsg)
+{
+    amgxml_t             amgxml = {NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL};
+    GMarkupParser        parser = {&amstart_element, &amend_element, &amtext,
+                                  NULL, NULL};
+    GMarkupParseFlags    flags = 0;
+    GMarkupParseContext *context;
+    GError             *gerror = NULL;
+    char                *line;
+
+    (void)errmsg;
+
+    context = g_markup_parse_context_new(&parser, flags, &amgxml, NULL);
+
+    while ((line = agets(file)) != NULL && !gerror) {
+       g_markup_parse_context_parse(context, line, strlen(line), &gerror);
+       amfree(line);
+    }
+    if (!gerror)
+       g_markup_parse_context_end_parse(context, &gerror);
+    g_markup_parse_context_free(context);
+    if (gerror) {
+       if (errmsg)
+           *errmsg = stralloc(gerror->message);
+       g_error_free(gerror);
+    }
+    return amgxml.dles;
+}
+
+char *
+amxml_format_tag(
+    char *tag,
+    char *value)
+{
+    char *b64value;
+    char *c;
+    int   need_raw;
+    char *result;
+    char *quoted_value;
+    char *q;
+
+    quoted_value = malloc(strlen(value)+1);
+    q = quoted_value;
+    need_raw = 0;
+    for(c=value; *c != '\0'; c++) {
+       // Check include negative value, with the 8th bit set.
+       if (*c <= ' ' ||
+           (unsigned char)*c > 127 ||
+           *c == '<' ||
+           *c == '>' ||
+           *c == '"' ||
+           *c == '&' ||
+           *c == '\\' ||
+           *c == '\'' ||
+           *c == '\t' ||
+           *c == '\f' ||
+           *c == '\r' ||
+           *c == '\n') {
+           need_raw = 1;
+           *q++ = '_';
+       } else {
+           *q++ = *c;
+       }
+    }
+    *q = '\0';
+
+    if (need_raw) {
+       base64_encode_alloc(value, strlen(value), &b64value);
+       result = vstralloc("<", tag,
+                          " encoding=\"raw\" raw=\"", b64value, "\">",
+                          quoted_value,
+                          "</", tag, ">",
+                          NULL);
+       amfree(b64value);
+    } else {
+       result = vstralloc("<", tag, ">",
+                          value,
+                          "</", tag, ">",
+                          NULL);
+    }
+    amfree(quoted_value);
+
+    return result;
+}
diff --git a/common-src/amxml.h b/common-src/amxml.h
new file mode 100644 (file)
index 0000000..82dc010
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * Amanda, The Advanced Maryland Automatic Network Disk Archiver
+ * Copyright (c) 1991-1998 University of Maryland at College Park
+ * All Rights Reserved.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of U.M. not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  U.M. makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as is"
+ * without express or implied warranty.
+ *
+ * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M.
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors: the Amanda Development Team.  Its members are listed in a
+ * file named AUTHORS, in the root directory of this distribution.
+ */
+
+/*
+ * $Id: amxml.h 5151 2007-02-06 15:41:53Z martineau $
+ *
+ * xml parsing of amanda protocol packet
+ */
+
+#ifndef AMXML_H
+#define AMXML_H
+
+#include "conffile.h"
+
+typedef struct script_s {
+    char                          *plugin;
+    execute_on_t                   execute_on;
+    int                            execute_where;
+    proplist_t                     property;
+    struct client_script_result_s *result;
+} script_t;
+
+typedef GSList *scriptlist_t;
+
+typedef struct a_dle_s {
+    char   *disk;
+    char   *device;
+    int     program_is_application_api;
+    char   *program;
+    int     calcsize;
+    estimate_t     estimate;
+    int     spindle;
+    int     compress;
+    int     encrypt;
+    int     kencrypt;
+    GSList *level;
+    int     nb_level;
+    char   *dumpdate;
+    char   *compprog;
+    char   *srv_encrypt;
+    char   *clnt_encrypt;
+    char   *srv_decrypt_opt;
+    char   *clnt_decrypt_opt;
+    int     record;
+    int     create_index;
+    char   *auth;
+    sl_t   *exclude_file;
+    sl_t   *exclude_list;
+    sl_t   *include_file;
+    sl_t   *include_list;
+    int     exclude_optional;
+    int     include_optional;
+    proplist_t application_property;
+    scriptlist_t scriptlist;
+    struct a_dle_s *next;
+} dle_t;
+
+dle_t *alloc_dle(void);
+void   init_dle(dle_t *dle);
+dle_t *amxml_parse_node_CHAR(char *txt, char **errmsg);
+dle_t *amxml_parse_node_FILE(FILE *file, char **errmsg);
+char  *amxml_format_tag(char *tag, char *value);
+#endif
index 4be79482bb6bc036871bcc539bab6b8c6d133dd2..46bdca9ad7ded214a3ed97ebccb6bfa9bab9e15c 100644 (file)
@@ -156,15 +156,16 @@ bsd_connect(
        security_seterror(&bh->sech,
                _("resolve_hostname(%s) did not return a canonical name\n"), hostname);
        (*fn)(arg, &bh->sech, S_ERROR);
-       return;
+       if (res) freeaddrinfo(res);
+       return;
     }
     if (res == NULL) {
        dbprintf(_("resolve_hostname(%s): no results\n"), hostname);
        security_seterror(&bh->sech,
                _("resolve_hostname(%s): no results\n"), hostname);
        (*fn)(arg, &bh->sech, S_ERROR);
-       amfree(canonname);
-       return;
+       amfree(canonname);
+       return;
     }
 
     for (res_addr = res; res_addr != NULL; res_addr = res_addr->ai_next) {
@@ -576,7 +577,7 @@ stream_read_sync_callback(
        n = read(bs->fd, bs->databuf, sizeof(bs->databuf));
     } while ((n < 0) && ((errno == EINTR) || (errno == EAGAIN)));
     if (n < 0)
-        security_stream_seterror(&bs->secstr, strerror(errno));
+        security_stream_seterror(&bs->secstr, "%s", strerror(errno));
     bs->len = n;
 }
 
@@ -618,7 +619,7 @@ stream_read_callback(
     } while ((n < 0) && ((errno == EINTR) || (errno == EAGAIN)));
 
     if (n < 0)
-       security_stream_seterror(&bs->secstr, strerror(errno));
+       security_stream_seterror(&bs->secstr, "%s", strerror(errno));
 
     (*bs->fn)(bs->arg, bs->databuf, n);
 }
index 5362ac8562440a101186fef04104d95b65b5f51f..33bcaba7882ccab0a50bcfdac4d26718230d6cb0 100644 (file)
@@ -34,7 +34,6 @@
 #include "clock.h"
 
 /* local functions */
-times_t times_zero;
 times_t start_time;
 static int clock_running = 0;
 
index 0f7ce1eb1a7c43242edb9a43527d3ac994a1b9b5..764df90aa2e908c62814972e242adc1a57c44341 100644 (file)
@@ -36,8 +36,6 @@
 
 typedef GTimeVal times_t;
 
-extern times_t times_zero, start_time;
-
 /* NOT THREAD SAFE */
 void startclock(void);
 times_t stopclock(void);
index 18afa9e8d1843d86b275ac25a792ee12c6397175..cf88dd8e182d39ed80d207a599a674d0ea744fda 100644 (file)
@@ -35,6 +35,7 @@
 #include "util.h"
 #include "conffile.h"
 #include "clock.h"
+#include <glib.h>
 
 /*
  * Lexical analysis
@@ -53,7 +54,7 @@ typedef enum {
     CONF_UNKNOWN,              CONF_ANY,               CONF_COMMA,
     CONF_LBRACE,               CONF_RBRACE,            CONF_NL,
     CONF_END,                  CONF_IDENT,             CONF_INT,
-    CONF_AM64,                 CONF_BOOL,              CONF_REAL,
+    CONF_INT64,                        CONF_BOOL,              CONF_REAL,
     CONF_STRING,               CONF_TIME,              CONF_SIZE,
 
     /* config parameters */
@@ -63,16 +64,18 @@ typedef enum {
     CONF_BUMPPERCENT,          CONF_BUMPSIZE,          CONF_BUMPDAYS,
     CONF_BUMPMULT,             CONF_ETIMEOUT,          CONF_DTIMEOUT,
     CONF_CTIMEOUT,             CONF_TAPEBUFS,          CONF_TAPELIST,
-    CONF_DEVICE_OUTPUT_BUFFER_SIZE,
+    CONF_DEVICE_OUTPUT_BUFFER_SIZE,                    CONF_RAWTAPEDEV,
     CONF_DISKFILE,             CONF_INFOFILE,          CONF_LOGDIR,
     CONF_LOGFILE,              CONF_DISKDIR,           CONF_DISKSIZE,
     CONF_INDEXDIR,             CONF_NETUSAGE,          CONF_INPARALLEL,
     CONF_DUMPORDER,            CONF_TIMEOUT,           CONF_TPCHANGER,
     CONF_RUNTAPES,             CONF_DEFINE,            CONF_DUMPTYPE,
     CONF_TAPETYPE,             CONF_INTERFACE,         CONF_PRINTER,
+    CONF_MAILER,
     CONF_AUTOFLUSH,            CONF_RESERVE,           CONF_MAXDUMPSIZE,
     CONF_COLUMNSPEC,           CONF_AMRECOVER_DO_FSF,  CONF_AMRECOVER_CHECK_LABEL,
     CONF_AMRECOVER_CHANGER,    CONF_LABEL_NEW_TAPES,   CONF_USETIMESTAMPS,
+    CONF_CHANGER,
 
     CONF_TAPERALGO,            CONF_FIRST,             CONF_FIRSTFIT,
     CONF_LARGEST,              CONF_LARGESTFIT,        CONF_SMALLEST,
@@ -81,7 +84,22 @@ typedef enum {
     CONF_TAPERFLUSH,
     CONF_FLUSH_THRESHOLD_DUMPED,
     CONF_FLUSH_THRESHOLD_SCHEDULED,
-    CONF_DEVICE_PROPERTY,
+    CONF_DEVICE_PROPERTY,      CONF_PROPERTY,          CONF_PLUGIN,
+    CONF_APPLICATION,          CONF_APPLICATION_TOOL,
+    CONF_PP_SCRIPT,            CONF_PP_SCRIPT_TOOL,
+    CONF_EXECUTE_ON,           CONF_EXECUTE_WHERE,     CONF_SEND_AMREPORT_ON,
+    CONF_DEVICE,
+
+    /* execute on */
+    CONF_PRE_DLE_AMCHECK,      CONF_PRE_HOST_AMCHECK,
+    CONF_POST_DLE_AMCHECK,     CONF_POST_HOST_AMCHECK,
+    CONF_PRE_DLE_ESTIMATE,     CONF_PRE_HOST_ESTIMATE,
+    CONF_POST_DLE_ESTIMATE,    CONF_POST_HOST_ESTIMATE,
+    CONF_PRE_DLE_BACKUP,       CONF_PRE_HOST_BACKUP,
+    CONF_POST_DLE_BACKUP,      CONF_POST_HOST_BACKUP,
+    CONF_PRE_RECOVER,         CONF_POST_RECOVER,
+    CONF_PRE_LEVEL_RECOVER,    CONF_POST_LEVEL_RECOVER,
+    CONF_INTER_LEVEL_RECOVER,
 
     /* kerberos 5 */
     CONF_KRB5KEYTAB,           CONF_KRB5PRINCIPAL,
@@ -139,6 +157,9 @@ typedef enum {
     /* holdingdisk */
     CONF_NEVER,                        CONF_AUTO,              CONF_REQUIRED,
 
+    /* send_amreport */
+    CONF_ALL,                  CONF_STRANGE,           CONF_ERROR,
+
     /* priority */
     CONF_LOW,                  CONF_MEDIUM,            CONF_HIGH,
 
@@ -210,6 +231,12 @@ static void unget_conftoken(void);
 static int  conftoken_getc(void);
 static int  conftoken_ungetc(int c);
 
+static void copy_proplist(gpointer key_p,
+                          gpointer value_p,
+                          gpointer user_data_p);
+static void copy_pp_scriptlist(gpointer data_p,
+                               gpointer user_data_p);
+
 /*
  * Parser
  */
@@ -226,6 +253,13 @@ typedef struct conf_var_s {
     void       (*validate_function) (struct conf_var_s *, val_t *);
 } conf_var_t;
 
+/* This is a list of filenames that are used in 'seen_t' structs. */
+static GSList *seen_filenames = NULL;
+
+/* get a copy of filename that's stored in seen_filenames so that it won't go
+ * away until config_uninit. */
+static char *get_seen_filename(char *filename);
+
 /* If allow_overwrites is true, the a parameter which has already been
  * seen will simply overwrite the old value, rather than triggering an 
  * error.  Note that this does not apply to all parameters, e.g., 
@@ -240,7 +274,7 @@ static int allow_overwrites;
  */
 struct tapetype_s {
     struct tapetype_s *next;
-    int seen;
+    seen_t seen;
     char *name;
 
     val_t value[TAPETYPE_TAPETYPE];
@@ -248,7 +282,7 @@ struct tapetype_s {
 
 struct dumptype_s {
     struct dumptype_s *next;
-    int seen;
+    seen_t seen;
     char *name;
 
     val_t value[DUMPTYPE_DUMPTYPE];
@@ -256,7 +290,7 @@ struct dumptype_s {
 
 struct interface_s {
     struct interface_s *next;
-    int seen;
+    seen_t seen;
     char *name;
 
     val_t value[INTER_INTER];
@@ -264,12 +298,44 @@ struct interface_s {
 
 struct holdingdisk_s {
     struct holdingdisk_s *next;
-    int seen;
+    seen_t seen;
     char *name;
 
     val_t value[HOLDING_HOLDING];
 };
 
+struct application_s {
+    struct application_s *next;
+    seen_t seen;
+    char *name;
+
+    val_t value[APPLICATION_APPLICATION];
+};
+
+struct pp_script_s {
+    struct pp_script_s *next;
+    seen_t seen;
+    char *name;
+
+    val_t value[PP_SCRIPT_PP_SCRIPT];
+};
+
+struct device_config_s {
+    struct device_config_s *next;
+    seen_t seen;
+    char *name;
+
+    val_t value[DEVICE_CONFIG_DEVICE_CONFIG];
+};
+
+struct changer_config_s {
+    struct changer_config_s *next;
+    int seen;
+    char *name;
+
+    val_t value[CHANGER_CONFIG_CHANGER_CONFIG];
+};
+
 /* The current parser table */
 static conf_var_t *parsetable = NULL;
 
@@ -279,27 +345,33 @@ static conf_var_t *parsetable = NULL;
  *
  * @param filename: configuration file to read
  * @param is_client: true if this is a client
- * @returns: false if an error occurred
+ * @param missing_ok: is it OK if the file is missing?
  */
-static gboolean read_conffile(char *filename,
-                             gboolean is_client);
+static void read_conffile(char *filename,
+                         gboolean is_client,
+                         gboolean missing_ok);
 
 /* Read and process a line of input from the current file, using the 
  * current keytable and parsetable.  For blocks, this recursively
  * reads the entire block.
  *
  * @param is_client: true if this is a client
- * @returns: true on success, false on EOF or error
+ * @returns: true on success, false on EOF
  */
 static gboolean read_confline(gboolean is_client);
 
-/* Handle an invalid token, by issuing a warning or an error, depending
- * on how long the token has been deprecated.
+/* Handle an invalid token, recognizing deprecated tokens as such,
+ * and producing an appropriate error message.
  *
  * @param token: the identifier
  */
 static void handle_invalid_keyword(const char * token);
 
+/* Check whether token is deprecated, and issue a warning if it
+ * is.  This consults the global variables 'tok' and 'tokenval'
+ */
+static void handle_deprecated_keyword(void);
+
 /* Read a brace-delimited block using the given parse table.  This
  * function is used to read brace-delimited subsections in the config
  * files and also (via read_dumptype) to read dumptypes from
@@ -357,13 +429,37 @@ static void init_interface_defaults(void);
 static void save_interface(void);
 static void copy_interface(void);
 
+static application_t apcur;
+static void get_application(void);
+static void init_application_defaults(void);
+static void save_application(void);
+static void copy_application(void);
+
+static pp_script_t pscur;
+static void get_pp_script(void);
+static void init_pp_script_defaults(void);
+static void save_pp_script(void);
+static void copy_pp_script(void);
+
+static device_config_t dccur;
+static void get_device_config(void);
+static void init_device_config_defaults(void);
+static void save_device_config(void);
+static void copy_device_config(void);
+
+static changer_config_t cccur;
+static void get_changer_config(void);
+static void init_changer_config_defaults(void);
+static void save_changer_config(void);
+static void copy_changer_config(void);
+
 /* read_functions -- these fit into the read_function slot in a parser
  * table entry, and are responsible for calling getconf_token as necessary
  * to consume their arguments, and setting their second argument with the
  * result.  The first argument is a copy of the parser table entry, if
  * needed. */
 static void read_int(conf_var_t *, val_t *);
-static void read_am64(conf_var_t *, val_t *);
+static void read_int64(conf_var_t *, val_t *);
 static void read_real(conf_var_t *, val_t *);
 static void read_str(conf_var_t *, val_t *);
 static void read_ident(conf_var_t *, val_t *);
@@ -376,11 +472,16 @@ static void read_holding(conf_var_t *, val_t *);
 static void read_estimate(conf_var_t *, val_t *);
 static void read_strategy(conf_var_t *, val_t *);
 static void read_taperalgo(conf_var_t *, val_t *);
+static void read_send_amreport_on(conf_var_t *, val_t *);
 static void read_priority(conf_var_t *, val_t *);
 static void read_rate(conf_var_t *, val_t *);
 static void read_exinclude(conf_var_t *, val_t *);
 static void read_intrange(conf_var_t *, val_t *);
+static void read_dapplication(conf_var_t *, val_t *);
+static void read_dpp_script(conf_var_t *, val_t *);
 static void read_property(conf_var_t *, val_t *);
+static void read_execute_on(conf_var_t *, val_t *);
+static void read_execute_where(conf_var_t *, val_t *);
 
 /* Functions to get various types of values.  These are called by
  * read_functions to take care of any variations in the way that these
@@ -390,7 +491,7 @@ static void read_property(conf_var_t *, val_t *);
 static time_t  get_time(void);
 static int     get_int(void);
 static ssize_t get_size(void);
-static off_t   get_am64_t(void);
+static gint64  get_int64(void);
 static int     get_bool(void);
 
 /* Check the given 'seen', flagging an error if this value has already
@@ -399,7 +500,7 @@ static int     get_bool(void);
  *
  * @param seen: (in/out) seen value to adjust
  */
-static void ckseen(int *seen);
+static void ckseen(seen_t *seen);
 
 /* validate_functions -- these fit into the validate_function solt in
  * a parser table entry.  They call conf_parserror if the value in their
@@ -419,19 +520,26 @@ static void validate_debug(conf_var_t *, val_t *);
 static void validate_port_range(val_t *, int, int);
 static void validate_reserved_port_range(conf_var_t *, val_t *);
 static void validate_unreserved_port_range(conf_var_t *, val_t *);
+static void validate_program(conf_var_t *, val_t *);
 
 /*
  * Initialization
  */
 
-/* Name of the current configuration (part of API) */
-char *config_name = NULL;
+/* The name of the configuration under which this application is running.
+ * This variable is initialized by config_init.
+ */
+static char *config_name = NULL;
 
-/* Current configuration directory (part of API) */
-char *config_dir = NULL;
+/* The directory containing the configuration for this application.  This
+ * variable is initialized by config_init
+ */
+static char *config_dir = NULL;
 
-/* Current toplevel configuration file (part of API) */
-char *config_filename = NULL;
+/* The most recently read top-level configuration file.  This variable is
+ * initialized by config_init
+ */
+static char *config_filename = NULL;
 
 /* Has the config been initialized? */
 static gboolean config_initialized = FALSE;
@@ -451,6 +559,10 @@ static holdingdisk_t *holdinglist = NULL;
 static dumptype_t *dumplist = NULL;
 static tapetype_t *tapelist = NULL;
 static interface_t *interface_list = NULL;
+static application_t *application_list = NULL;
+static pp_script_t *pp_script_list = NULL;
+static device_config_t *device_config_list = NULL;
+static changer_config_t *changer_config_list = NULL;
 
 /* storage for derived values */
 static long int unit_divisor = 1;
@@ -491,7 +603,7 @@ static void update_derived_values(gboolean is_client);
  * the relevant value into the 'v' field.
  */
 static void conf_init_int(val_t *val, int i);
-static void conf_init_am64(val_t *val, off_t l);
+static void conf_init_int64(val_t *val, gint64 l);
 static void conf_init_real(val_t *val, float r);
 static void conf_init_str(val_t *val, char *s);
 static void conf_init_ident(val_t *val, char *s);
@@ -502,6 +614,9 @@ static void conf_init_compress(val_t *val, comp_t i);
 static void conf_init_encrypt(val_t *val, encrypt_t i);
 static void conf_init_holding(val_t *val, dump_holdingdisk_t i);
 static void conf_init_estimate(val_t *val, estimate_t i);
+static void conf_init_execute_on(val_t *, int);
+static void conf_init_execute_where(val_t *, int);
+static void conf_init_send_amreport(val_t *val, send_amreport_t i);
 static void conf_init_strategy(val_t *val, strategy_t);
 static void conf_init_taperalgo(val_t *val, taperalgo_t i);
 static void conf_init_priority(val_t *val, int i);
@@ -509,6 +624,8 @@ static void conf_init_rate(val_t *val, float r1, float r2);
 static void conf_init_exinclude(val_t *val); /* to empty list */
 static void conf_init_intrange(val_t *val, int i1, int i2);
 static void conf_init_proplist(val_t *val); /* to empty list */
+static void conf_init_pp_scriptlist(val_t *);
+static void conf_init_application(val_t *val);
 
 /*
  * Command-line Handling
@@ -540,6 +657,7 @@ static void free_val_t(val_t *);
 /* Utility functions/structs for val_t_display_strs */
 static char *exinclude_display_str(val_t *val, int file);
 static void proplist_display_str_foreach_fn(gpointer key_p, gpointer value_p, gpointer user_data_p);
+static void pp_scriptlist_display_str_foreach_fn(gpointer data_p, gpointer user_data_p);
 static void val_t_print_token(FILE *output, char *prefix, char *format, keytab_t *kt, val_t *val);
 
 /* Given a key name as used in config overwrites, return a pointer to the corresponding
@@ -564,8 +682,10 @@ static int parm_key_info(char *key, conf_var_t **parm, val_t **val);
 /* Have we seen a parse error yet?  Parsing continues after an error, so this
  * flag is checked after the parse is complete.
  */
-static gboolean got_parserror;
+static cfgerr_level_t cfgerr_level;
+static GSList *cfgerr_errors = NULL;
 
+static void conf_error_common(cfgerr_level_t level, const char * format, va_list argp);
 static void    conf_parserror(const char *format, ...)
                 __attribute__ ((format (printf, 1, 2)));
 
@@ -594,6 +714,7 @@ keytab_t client_keytab[] = {
     { "CONNECT_TRIES", CONF_CONNECT_TRIES },
     { "REP_TRIES", CONF_REP_TRIES },
     { "REQ_TRIES", CONF_REQ_TRIES },
+    { "CLIENT", CONF_CLIENT },
     { "DEBUG_AMANDAD", CONF_DEBUG_AMANDAD },
     { "DEBUG_AMIDXTAPED", CONF_DEBUG_AMIDXTAPED },
     { "DEBUG_AMINDEXD", CONF_DEBUG_AMINDEXD },
@@ -610,13 +731,46 @@ keytab_t client_keytab[] = {
     { "DEBUG_SELFCHECK", CONF_DEBUG_SELFCHECK },
     { "DEBUG_SENDSIZE", CONF_DEBUG_SENDSIZE },
     { "DEBUG_SENDBACKUP", CONF_DEBUG_SENDBACKUP },
-    { "RESERVED-UDP-PORT", CONF_RESERVED_UDP_PORT },
-    { "RESERVED-TCP-PORT", CONF_RESERVED_TCP_PORT },
-    { "UNRESERVED-TCP-PORT", CONF_UNRESERVED_TCP_PORT },
-    { NULL, CONF_UNKNOWN },
+    { "EXECUTE_ON", CONF_EXECUTE_ON },
+    { "EXECUTE_WHERE", CONF_EXECUTE_WHERE },
+    { "RESERVED_UDP_PORT", CONF_RESERVED_UDP_PORT },
+    { "RESERVED_TCP_PORT", CONF_RESERVED_TCP_PORT },
+    { "UNRESERVED_TCP_PORT", CONF_UNRESERVED_TCP_PORT },
+    { "DEFINE", CONF_DEFINE },
+    { "COMMENT", CONF_COMMENT },
+    { "MAILER", CONF_MAILER },
+    { "SCRIPT", CONF_PP_SCRIPT },
+    { "SCRIPT_TOOL", CONF_PP_SCRIPT_TOOL },
+    { "PLUGIN", CONF_PLUGIN },
+    { "PRE_DLE_AMCHECK", CONF_PRE_DLE_AMCHECK },
+    { "PRE_HOST_AMCHECK", CONF_PRE_HOST_AMCHECK },
+    { "POST_DLE_AMCHECK", CONF_POST_DLE_AMCHECK },
+    { "POST_HOST_AMCHECK", CONF_POST_HOST_AMCHECK },
+    { "PRE_DLE_ESTIMATE", CONF_PRE_DLE_ESTIMATE },
+    { "PRE_HOST_ESTIMATE", CONF_PRE_HOST_ESTIMATE },
+    { "POST_DLE_ESTIMATE", CONF_POST_DLE_ESTIMATE },
+    { "POST_HOST_ESTIMATE", CONF_POST_HOST_ESTIMATE },
+    { "POST_DLE_BACKUP", CONF_POST_DLE_BACKUP },
+    { "POST_HOST_BACKUP", CONF_POST_HOST_BACKUP },
+    { "PRE_DLE_BACKUP", CONF_PRE_DLE_BACKUP },
+    { "PRE_HOST_BACKUP", CONF_PRE_HOST_BACKUP },
+    { "PRE_RECOVER", CONF_PRE_RECOVER },
+    { "POST_RECOVER", CONF_POST_RECOVER },
+    { "PRE_LEVEL_RECOVER", CONF_PRE_LEVEL_RECOVER },
+    { "POST_LEVEL_RECOVER", CONF_POST_LEVEL_RECOVER },
+    { "INTER_LEVEL_RECOVER", CONF_INTER_LEVEL_RECOVER },
+    { "PRIORITY", CONF_PRIORITY },
+    { "PROPERTY", CONF_PROPERTY },
+    { "APPLICATION", CONF_APPLICATION },
+    { "APPLICATION_TOOL", CONF_APPLICATION_TOOL },
+    { "SERVER", CONF_SERVER },
+    { "APPEND", CONF_APPEND },
+    { NULL, CONF_IDENT },
+    { NULL, CONF_UNKNOWN }
 };
 
 keytab_t server_keytab[] = {
+    { "ALL", CONF_ALL },
     { "AMANDAD_PATH", CONF_AMANDAD_PATH },
     { "AMRECOVER_CHANGER", CONF_AMRECOVER_CHANGER },
     { "AMRECOVER_CHECK_LABEL", CONF_AMRECOVER_CHECK_LABEL },
@@ -625,6 +779,8 @@ keytab_t server_keytab[] = {
     { "AUTH", CONF_AUTH },
     { "AUTO", CONF_AUTO },
     { "AUTOFLUSH", CONF_AUTOFLUSH },
+    { "APPLICATION", CONF_APPLICATION },
+    { "APPLICATION_TOOL", CONF_APPLICATION_TOOL },
     { "BEST", CONF_BEST },
     { "BLOCKSIZE", CONF_BLOCKSIZE },
     { "BUMPDAYS", CONF_BUMPDAYS },
@@ -632,6 +788,7 @@ keytab_t server_keytab[] = {
     { "BUMPPERCENT", CONF_BUMPPERCENT },
     { "BUMPSIZE", CONF_BUMPSIZE },
     { "CALCSIZE", CONF_CALCSIZE },
+    { "CHANGER", CONF_CHANGER },
     { "CHANGERDEV", CONF_CHANGERDEV },
     { "CHANGERFILE", CONF_CHANGERFILE },
     { "CHUNKSIZE", CONF_CHUNKSIZE },
@@ -664,6 +821,7 @@ keytab_t server_keytab[] = {
     { "DEBUG_SENDSIZE"   , CONF_DEBUG_SENDSIZE },
     { "DEBUG_SENDBACKUP" , CONF_DEBUG_SENDBACKUP },
     { "DEFINE", CONF_DEFINE },
+    { "DEVICE", CONF_DEVICE },
     { "DEVICE_PROPERTY", CONF_DEVICE_PROPERTY },
     { "DIRECTORY", CONF_DIRECTORY },
     { "DISKFILE", CONF_DISKFILE },
@@ -674,15 +832,18 @@ keytab_t server_keytab[] = {
     { "DUMPTYPE", CONF_DUMPTYPE },
     { "DUMPUSER", CONF_DUMPUSER },
     { "ENCRYPT", CONF_ENCRYPT },
+    { "ERROR", CONF_ERROR },
     { "ESTIMATE", CONF_ESTIMATE },
     { "ETIMEOUT", CONF_ETIMEOUT },
     { "EXCLUDE", CONF_EXCLUDE },
-    { "EXCLUDE-FILE", CONF_EXCLUDE_FILE },
-    { "EXCLUDE-LIST", CONF_EXCLUDE_LIST },
+    { "EXCLUDE_FILE", CONF_EXCLUDE_FILE },
+    { "EXCLUDE_LIST", CONF_EXCLUDE_LIST },
+    { "EXECUTE_ON", CONF_EXECUTE_ON },
+    { "EXECUTE_WHERE", CONF_EXECUTE_WHERE },
     { "FALLBACK_SPLITSIZE", CONF_FALLBACK_SPLITSIZE },
     { "FAST", CONF_FAST },
     { "FILE", CONF_EFILE },
-    { "FILE-PAD", CONF_FILE_PAD },
+    { "FILE_PAD", CONF_FILE_PAD },
     { "FILEMARK", CONF_FILEMARK },
     { "FIRST", CONF_FIRST },
     { "FIRSTFIT", CONF_FIRSTFIT },
@@ -706,11 +867,12 @@ keytab_t server_keytab[] = {
     { "LARGEST", CONF_LARGEST },
     { "LARGESTFIT", CONF_LARGESTFIT },
     { "LAST", CONF_LAST },
-    { "LBL-TEMPL", CONF_LBL_TEMPL },
+    { "LBL_TEMPL", CONF_LBL_TEMPL },
     { "LENGTH", CONF_LENGTH },
     { "LIST", CONF_LIST },
     { "LOGDIR", CONF_LOGDIR },
     { "LOW", CONF_LOW },
+    { "MAILER", CONF_MAILER },
     { "MAILTO", CONF_MAILTO },
     { "READBLOCKSIZE", CONF_READBLOCKSIZE },
     { "MAXDUMPS", CONF_MAXDUMPS },
@@ -724,45 +886,69 @@ keytab_t server_keytab[] = {
     { "NONE", CONF_NONE },
     { "OPTIONAL", CONF_OPTIONAL },
     { "ORG", CONF_ORG },
+    { "PLUGIN", CONF_PLUGIN },
+    { "PRE_DLE_AMCHECK", CONF_PRE_DLE_AMCHECK },
+    { "PRE_HOST_AMCHECK", CONF_PRE_HOST_AMCHECK },
+    { "POST_DLE_AMCHECK", CONF_POST_DLE_AMCHECK },
+    { "POST_HOST_AMCHECK", CONF_POST_HOST_AMCHECK },
+    { "PRE_DLE_ESTIMATE", CONF_PRE_DLE_ESTIMATE },
+    { "PRE_HOST_ESTIMATE", CONF_PRE_HOST_ESTIMATE },
+    { "POST_DLE_ESTIMATE", CONF_POST_DLE_ESTIMATE },
+    { "POST_HOST_ESTIMATE", CONF_POST_HOST_ESTIMATE },
+    { "POST_DLE_BACKUP", CONF_POST_DLE_BACKUP },
+    { "POST_HOST_BACKUP", CONF_POST_HOST_BACKUP },
+    { "PRE_DLE_BACKUP", CONF_PRE_DLE_BACKUP },
+    { "PRE_HOST_BACKUP", CONF_PRE_HOST_BACKUP },
+    { "PRE_RECOVER", CONF_PRE_RECOVER },
+    { "POST_RECOVER", CONF_POST_RECOVER },
+    { "PRE_LEVEL_RECOVER", CONF_PRE_LEVEL_RECOVER },
+    { "POST_LEVEL_RECOVER", CONF_POST_LEVEL_RECOVER },
+    { "INTER_LEVEL_RECOVER", CONF_INTER_LEVEL_RECOVER },
     { "PRINTER", CONF_PRINTER },
     { "PRIORITY", CONF_PRIORITY },
     { "PROGRAM", CONF_PROGRAM },
+    { "PROPERTY", CONF_PROPERTY },
     { "RECORD", CONF_RECORD },
     { "REP_TRIES", CONF_REP_TRIES },
     { "REQ_TRIES", CONF_REQ_TRIES },
     { "REQUIRED", CONF_REQUIRED },
     { "RESERVE", CONF_RESERVE },
-    { "RESERVED-UDP-PORT", CONF_RESERVED_UDP_PORT },
-    { "RESERVED-TCP-PORT", CONF_RESERVED_TCP_PORT },
+    { "RESERVED_UDP_PORT", CONF_RESERVED_UDP_PORT },
+    { "RESERVED_TCP_PORT", CONF_RESERVED_TCP_PORT },
     { "RUNSPERCYCLE", CONF_RUNSPERCYCLE },
     { "RUNTAPES", CONF_RUNTAPES },
+    { "SCRIPT", CONF_PP_SCRIPT },
+    { "SCRIPT_TOOL", CONF_PP_SCRIPT_TOOL },
+    { "SEND_AMREPORT_ON", CONF_SEND_AMREPORT_ON },
     { "SERVER", CONF_SERVER },
     { "SERVER_CUSTOM_COMPRESS", CONF_SRVCOMPPROG },
     { "SERVER_DECRYPT_OPTION", CONF_SRV_DECRYPT_OPT },
     { "SERVER_ENCRYPT", CONF_SRV_ENCRYPT },
     { "SKIP", CONF_SKIP },
-    { "SKIP-FULL", CONF_SKIP_FULL },
-    { "SKIP-INCR", CONF_SKIP_INCR },
+    { "SKIP_FULL", CONF_SKIP_FULL },
+    { "SKIP_INCR", CONF_SKIP_INCR },
     { "SMALLEST", CONF_SMALLEST },
     { "SPEED", CONF_SPEED },
     { "SPLIT_DISKBUFFER", CONF_SPLIT_DISKBUFFER },
     { "SSH_KEYS", CONF_SSH_KEYS },
     { "STANDARD", CONF_STANDARD },
     { "STARTTIME", CONF_STARTTIME },
+    { "STRANGE", CONF_STRANGE },
     { "STRATEGY", CONF_STRATEGY },
     { "TAPEBUFS", CONF_TAPEBUFS },
     { "DEVICE_OUTPUT_BUFFER_SIZE", CONF_DEVICE_OUTPUT_BUFFER_SIZE },
     { "TAPECYCLE", CONF_TAPECYCLE },
     { "TAPEDEV", CONF_TAPEDEV },
+    { "RAWTAPEDEV", CONF_RAWTAPEDEV },
     { "TAPELIST", CONF_TAPELIST },
     { "TAPERALGO", CONF_TAPERALGO },
-    { "FLUSH-THRESHOLD-DUMPED", CONF_FLUSH_THRESHOLD_DUMPED },
-    { "FLUSH-THRESHOLD-SCHEDULED", CONF_FLUSH_THRESHOLD_SCHEDULED },
+    { "FLUSH_THRESHOLD_DUMPED", CONF_FLUSH_THRESHOLD_DUMPED },
+    { "FLUSH_THRESHOLD_SCHEDULED", CONF_FLUSH_THRESHOLD_SCHEDULED },
     { "TAPERFLUSH", CONF_TAPERFLUSH },
     { "TAPETYPE", CONF_TAPETYPE },
     { "TAPE_SPLITSIZE", CONF_TAPE_SPLITSIZE },
     { "TPCHANGER", CONF_TPCHANGER },
-    { "UNRESERVED-TCP-PORT", CONF_UNRESERVED_TCP_PORT },
+    { "UNRESERVED_TCP_PORT", CONF_UNRESERVED_TCP_PORT },
     { "USE", CONF_USE },
     { "USETIMESTAMPS", CONF_USETIMESTAMPS },
     { NULL, CONF_IDENT },
@@ -839,6 +1025,7 @@ conf_var_t client_var [] = {
    { CONF_CLIENT_USERNAME    , CONFTYPE_STR     , read_str     , CNF_CLIENT_USERNAME    , NULL },
    { CONF_GNUTAR_LIST_DIR    , CONFTYPE_STR     , read_str     , CNF_GNUTAR_LIST_DIR    , NULL },
    { CONF_AMANDATES          , CONFTYPE_STR     , read_str     , CNF_AMANDATES          , NULL },
+   { CONF_MAILER             , CONFTYPE_STR     , read_str     , CNF_MAILER             , NULL },
    { CONF_KRB5KEYTAB         , CONFTYPE_STR     , read_str     , CNF_KRB5KEYTAB         , NULL },
    { CONF_KRB5PRINCIPAL      , CONFTYPE_STR     , read_str     , CNF_KRB5PRINCIPAL      , NULL },
    { CONF_CONNECT_TRIES      , CONFTYPE_INT     , read_int     , CNF_CONNECT_TRIES      , validate_positive },
@@ -863,6 +1050,9 @@ conf_var_t client_var [] = {
    { CONF_RESERVED_UDP_PORT  , CONFTYPE_INTRANGE, read_intrange, CNF_RESERVED_UDP_PORT  , validate_reserved_port_range },
    { CONF_RESERVED_TCP_PORT  , CONFTYPE_INTRANGE, read_intrange, CNF_RESERVED_TCP_PORT  , validate_reserved_port_range },
    { CONF_UNRESERVED_TCP_PORT, CONFTYPE_INTRANGE, read_intrange, CNF_UNRESERVED_TCP_PORT, validate_unreserved_port_range },
+   { CONF_PROPERTY           , CONFTYPE_PROPLIST, read_property, CNF_PROPERTY           , NULL },
+   { CONF_APPLICATION        , CONFTYPE_STR     , read_dapplication, DUMPTYPE_APPLICATION, NULL },
+   { CONF_PP_SCRIPT          , CONFTYPE_STR     , read_dpp_script, DUMPTYPE_PP_SCRIPTLIST, NULL },
    { CONF_UNKNOWN            , CONFTYPE_INT     , NULL         , CNF_CNF                , NULL }
 };
 
@@ -871,8 +1061,11 @@ conf_var_t server_var [] = {
    { CONF_MAILTO               , CONFTYPE_STR      , read_str         , CNF_MAILTO               , NULL },
    { CONF_DUMPUSER             , CONFTYPE_STR      , read_str         , CNF_DUMPUSER             , NULL },
    { CONF_PRINTER              , CONFTYPE_STR      , read_str         , CNF_PRINTER              , NULL },
+   { CONF_MAILER               , CONFTYPE_STR      , read_str         , CNF_MAILER               , NULL },
    { CONF_TAPEDEV              , CONFTYPE_STR      , read_str         , CNF_TAPEDEV              , NULL },
+   { CONF_RAWTAPEDEV           , CONFTYPE_STR      , read_str         , CNF_RAWTAPEDEV           , NULL },
    { CONF_DEVICE_PROPERTY      , CONFTYPE_PROPLIST , read_property    , CNF_DEVICE_PROPERTY      , NULL },
+   { CONF_PROPERTY             , CONFTYPE_PROPLIST , read_property    , CNF_PROPERTY             , NULL },
    { CONF_TPCHANGER            , CONFTYPE_STR      , read_str         , CNF_TPCHANGER            , NULL },
    { CONF_CHANGERDEV           , CONFTYPE_STR      , read_str         , CNF_CHANGERDEV           , NULL },
    { CONF_CHANGERFILE          , CONFTYPE_STR      , read_str         , CNF_CHANGERFILE          , NULL },
@@ -888,7 +1081,7 @@ conf_var_t server_var [] = {
    { CONF_RUNTAPES             , CONFTYPE_INT      , read_int         , CNF_RUNTAPES             , validate_nonnegative },
    { CONF_TAPECYCLE            , CONFTYPE_INT      , read_int         , CNF_TAPECYCLE            , validate_positive },
    { CONF_BUMPDAYS             , CONFTYPE_INT      , read_int         , CNF_BUMPDAYS             , validate_positive },
-   { CONF_BUMPSIZE             , CONFTYPE_AM64     , read_am64        , CNF_BUMPSIZE             , validate_positive },
+   { CONF_BUMPSIZE             , CONFTYPE_INT64    , read_int64       , CNF_BUMPSIZE             , validate_positive },
    { CONF_BUMPPERCENT          , CONFTYPE_INT      , read_int         , CNF_BUMPPERCENT          , validate_bumppercent },
    { CONF_BUMPMULT             , CONFTYPE_REAL     , read_real        , CNF_BUMPMULT             , validate_bumpmult },
    { CONF_NETUSAGE             , CONFTYPE_INT      , read_int         , CNF_NETUSAGE             , validate_positive },
@@ -902,13 +1095,14 @@ conf_var_t server_var [] = {
    { CONF_DEVICE_OUTPUT_BUFFER_SIZE, CONFTYPE_SIZE , read_size        , CNF_DEVICE_OUTPUT_BUFFER_SIZE, validate_positive },
    { CONF_COLUMNSPEC           , CONFTYPE_STR      , read_str         , CNF_COLUMNSPEC           , NULL },
    { CONF_TAPERALGO            , CONFTYPE_TAPERALGO, read_taperalgo   , CNF_TAPERALGO            , NULL },
+   { CONF_SEND_AMREPORT_ON     , CONFTYPE_SEND_AMREPORT_ON, read_send_amreport_on, CNF_SEND_AMREPORT_ON       , NULL },
    { CONF_FLUSH_THRESHOLD_DUMPED, CONFTYPE_INT     , read_int         , CNF_FLUSH_THRESHOLD_DUMPED, validate_nonnegative },
    { CONF_FLUSH_THRESHOLD_SCHEDULED, CONFTYPE_INT  , read_int         , CNF_FLUSH_THRESHOLD_SCHEDULED, validate_nonnegative },
    { CONF_TAPERFLUSH           , CONFTYPE_INT      , read_int         , CNF_TAPERFLUSH           , validate_nonnegative },
    { CONF_DISPLAYUNIT          , CONFTYPE_STR      , read_str         , CNF_DISPLAYUNIT          , validate_displayunit },
    { CONF_AUTOFLUSH            , CONFTYPE_BOOLEAN  , read_bool        , CNF_AUTOFLUSH            , NULL },
    { CONF_RESERVE              , CONFTYPE_INT      , read_int         , CNF_RESERVE              , validate_reserve },
-   { CONF_MAXDUMPSIZE          , CONFTYPE_AM64     , read_am64        , CNF_MAXDUMPSIZE          , NULL },
+   { CONF_MAXDUMPSIZE          , CONFTYPE_INT64    , read_int64       , CNF_MAXDUMPSIZE          , NULL },
    { CONF_KRB5KEYTAB           , CONFTYPE_STR      , read_str         , CNF_KRB5KEYTAB           , NULL },
    { CONF_KRB5PRINCIPAL        , CONFTYPE_STR      , read_str         , CNF_KRB5PRINCIPAL        , NULL },
    { CONF_LABEL_NEW_TAPES      , CONFTYPE_STR      , read_str         , CNF_LABEL_NEW_TAPES      , NULL },
@@ -946,8 +1140,8 @@ conf_var_t tapetype_var [] = {
    { CONF_LBL_TEMPL     , CONFTYPE_STR     , read_str   , TAPETYPE_LBL_TEMPL    , NULL },
    { CONF_BLOCKSIZE     , CONFTYPE_SIZE    , read_size  , TAPETYPE_BLOCKSIZE    , validate_blocksize },
    { CONF_READBLOCKSIZE , CONFTYPE_SIZE    , read_size  , TAPETYPE_READBLOCKSIZE, validate_blocksize },
-   { CONF_LENGTH        , CONFTYPE_AM64    , read_am64  , TAPETYPE_LENGTH       , validate_nonnegative },
-   { CONF_FILEMARK      , CONFTYPE_AM64    , read_am64  , TAPETYPE_FILEMARK     , NULL },
+   { CONF_LENGTH        , CONFTYPE_INT64   , read_int64 , TAPETYPE_LENGTH       , validate_nonnegative },
+   { CONF_FILEMARK      , CONFTYPE_INT64   , read_int64 , TAPETYPE_FILEMARK     , NULL },
    { CONF_SPEED         , CONFTYPE_INT     , read_int   , TAPETYPE_SPEED        , validate_nonnegative },
    { CONF_FILE_PAD      , CONFTYPE_BOOLEAN , read_bool  , TAPETYPE_FILE_PAD     , NULL },
    { CONF_UNKNOWN       , CONFTYPE_INT     , NULL       , TAPETYPE_TAPETYPE     , NULL }
@@ -958,7 +1152,7 @@ conf_var_t dumptype_var [] = {
    { CONF_AUTH              , CONFTYPE_STR      , read_str      , DUMPTYPE_SECURITY_DRIVER   , NULL },
    { CONF_BUMPDAYS          , CONFTYPE_INT      , read_int      , DUMPTYPE_BUMPDAYS          , NULL },
    { CONF_BUMPMULT          , CONFTYPE_REAL     , read_real     , DUMPTYPE_BUMPMULT          , NULL },
-   { CONF_BUMPSIZE          , CONFTYPE_AM64     , read_am64     , DUMPTYPE_BUMPSIZE          , NULL },
+   { CONF_BUMPSIZE          , CONFTYPE_INT64    , read_int64    , DUMPTYPE_BUMPSIZE          , NULL },
    { CONF_BUMPPERCENT       , CONFTYPE_INT      , read_int      , DUMPTYPE_BUMPPERCENT       , NULL },
    { CONF_COMPRATE          , CONFTYPE_REAL     , read_rate     , DUMPTYPE_COMPRATE          , NULL },
    { CONF_COMPRESS          , CONFTYPE_INT      , read_compress , DUMPTYPE_COMPRESS          , NULL },
@@ -973,13 +1167,14 @@ conf_var_t dumptype_var [] = {
    { CONF_MAXDUMPS          , CONFTYPE_INT      , read_int      , DUMPTYPE_MAXDUMPS          , validate_positive },
    { CONF_MAXPROMOTEDAY     , CONFTYPE_INT      , read_int      , DUMPTYPE_MAXPROMOTEDAY     , validate_nonnegative },
    { CONF_PRIORITY          , CONFTYPE_PRIORITY , read_priority , DUMPTYPE_PRIORITY          , NULL },
-   { CONF_PROGRAM           , CONFTYPE_STR      , read_str      , DUMPTYPE_PROGRAM           , NULL },
+   { CONF_PROGRAM           , CONFTYPE_STR      , read_str      , DUMPTYPE_PROGRAM           , validate_program },
+   { CONF_PROPERTY          , CONFTYPE_PROPLIST , read_property , DUMPTYPE_PROPERTY          , NULL },
    { CONF_RECORD            , CONFTYPE_BOOLEAN  , read_bool     , DUMPTYPE_RECORD            , NULL },
    { CONF_SKIP_FULL         , CONFTYPE_BOOLEAN  , read_bool     , DUMPTYPE_SKIP_FULL         , NULL },
    { CONF_SKIP_INCR         , CONFTYPE_BOOLEAN  , read_bool     , DUMPTYPE_SKIP_INCR         , NULL },
    { CONF_STARTTIME         , CONFTYPE_TIME     , read_time     , DUMPTYPE_STARTTIME         , NULL },
    { CONF_STRATEGY          , CONFTYPE_INT      , read_strategy , DUMPTYPE_STRATEGY          , NULL },
-   { CONF_TAPE_SPLITSIZE    , CONFTYPE_AM64     , read_am64     , DUMPTYPE_TAPE_SPLITSIZE    , validate_nonnegative },
+   { CONF_TAPE_SPLITSIZE    , CONFTYPE_INT64    , read_int64    , DUMPTYPE_TAPE_SPLITSIZE    , validate_nonnegative },
    { CONF_SPLIT_DISKBUFFER  , CONFTYPE_STR      , read_str      , DUMPTYPE_SPLIT_DISKBUFFER  , NULL },
    { CONF_ESTIMATE          , CONFTYPE_INT      , read_estimate , DUMPTYPE_ESTIMATE          , NULL },
    { CONF_SRV_ENCRYPT       , CONFTYPE_STR      , read_str      , DUMPTYPE_SRV_ENCRYPT       , NULL },
@@ -989,17 +1184,19 @@ conf_var_t dumptype_var [] = {
    { CONF_SSH_KEYS          , CONFTYPE_STR      , read_str      , DUMPTYPE_SSH_KEYS          , NULL },
    { CONF_SRVCOMPPROG       , CONFTYPE_STR      , read_str      , DUMPTYPE_SRVCOMPPROG       , NULL },
    { CONF_CLNTCOMPPROG      , CONFTYPE_STR      , read_str      , DUMPTYPE_CLNTCOMPPROG      , NULL },
-   { CONF_FALLBACK_SPLITSIZE, CONFTYPE_AM64     , read_am64     , DUMPTYPE_FALLBACK_SPLITSIZE, NULL },
+   { CONF_FALLBACK_SPLITSIZE, CONFTYPE_INT64    , read_int64    , DUMPTYPE_FALLBACK_SPLITSIZE, NULL },
    { CONF_SRV_DECRYPT_OPT   , CONFTYPE_STR      , read_str      , DUMPTYPE_SRV_DECRYPT_OPT   , NULL },
    { CONF_CLNT_DECRYPT_OPT  , CONFTYPE_STR      , read_str      , DUMPTYPE_CLNT_DECRYPT_OPT  , NULL },
+   { CONF_APPLICATION       , CONFTYPE_STR      , read_dapplication, DUMPTYPE_APPLICATION    , NULL },
+   { CONF_PP_SCRIPT         , CONFTYPE_STR      , read_dpp_script, DUMPTYPE_PP_SCRIPTLIST    , NULL },
    { CONF_UNKNOWN           , CONFTYPE_INT      , NULL          , DUMPTYPE_DUMPTYPE          , NULL }
 };
 
 conf_var_t holding_var [] = {
    { CONF_DIRECTORY, CONFTYPE_STR   , read_str   , HOLDING_DISKDIR  , NULL },
    { CONF_COMMENT  , CONFTYPE_STR   , read_str   , HOLDING_COMMENT  , NULL },
-   { CONF_USE      , CONFTYPE_AM64  , read_am64  , HOLDING_DISKSIZE , validate_use },
-   { CONF_CHUNKSIZE, CONFTYPE_AM64  , read_am64  , HOLDING_CHUNKSIZE, validate_chunksize },
+   { CONF_USE      , CONFTYPE_INT64 , read_int64 , HOLDING_DISKSIZE , validate_use },
+   { CONF_CHUNKSIZE, CONFTYPE_INT64 , read_int64 , HOLDING_CHUNKSIZE, validate_chunksize },
    { CONF_UNKNOWN  , CONFTYPE_INT   , NULL       , HOLDING_HOLDING  , NULL }
 };
 
@@ -1010,6 +1207,38 @@ conf_var_t interface_var [] = {
 };
 
 
+conf_var_t application_var [] = {
+   { CONF_COMMENT  , CONFTYPE_STR     , read_str     , APPLICATION_COMMENT    , NULL },
+   { CONF_PLUGIN   , CONFTYPE_STR     , read_str     , APPLICATION_PLUGIN     , NULL },
+   { CONF_PROPERTY , CONFTYPE_PROPLIST, read_property, APPLICATION_PROPERTY   , NULL },
+   { CONF_UNKNOWN  , CONFTYPE_INT     , NULL         , APPLICATION_APPLICATION, NULL }
+};
+
+conf_var_t pp_script_var [] = {
+   { CONF_COMMENT      , CONFTYPE_STR     , read_str     , PP_SCRIPT_COMMENT      , NULL },
+   { CONF_PLUGIN       , CONFTYPE_STR     , read_str     , PP_SCRIPT_PLUGIN       , NULL },
+   { CONF_PROPERTY     , CONFTYPE_PROPLIST, read_property, PP_SCRIPT_PROPERTY     , NULL },
+   { CONF_EXECUTE_ON   , CONFTYPE_EXECUTE_ON  , read_execute_on  , PP_SCRIPT_EXECUTE_ON   , NULL },
+   { CONF_EXECUTE_WHERE, CONFTYPE_EXECUTE_WHERE  , read_execute_where  , PP_SCRIPT_EXECUTE_WHERE, NULL },
+   { CONF_UNKNOWN      , CONFTYPE_INT     , NULL         , PP_SCRIPT_PP_SCRIPT    , NULL }
+};
+
+conf_var_t device_config_var [] = {
+   { CONF_COMMENT         , CONFTYPE_STR      , read_str      , DEVICE_CONFIG_COMMENT        , NULL },
+   { CONF_DEVICE_PROPERTY , CONFTYPE_PROPLIST , read_property , DEVICE_CONFIG_DEVICE_PROPERTY, NULL },
+   { CONF_TAPEDEV         , CONFTYPE_STR      , read_str      , DEVICE_CONFIG_TAPEDEV        , NULL },
+   { CONF_UNKNOWN         , CONFTYPE_INT      , NULL          , DEVICE_CONFIG_DEVICE_CONFIG  , NULL }
+};
+
+conf_var_t changer_config_var [] = {
+   { CONF_COMMENT         , CONFTYPE_STR      , read_str      , CHANGER_CONFIG_COMMENT        , NULL },
+   { CONF_TAPEDEV         , CONFTYPE_STR      , read_str      , CHANGER_CONFIG_TAPEDEV        , NULL },
+   { CONF_TPCHANGER       , CONFTYPE_STR      , read_str      , CHANGER_CONFIG_TPCHANGER      , NULL },
+   { CONF_CHANGERDEV      , CONFTYPE_STR      , read_str      , CHANGER_CONFIG_CHANGERDEV     , NULL },
+   { CONF_CHANGERFILE     , CONFTYPE_STR      , read_str      , CHANGER_CONFIG_CHANGERFILE    , NULL },
+   { CONF_UNKNOWN         , CONFTYPE_INT      , NULL          , CHANGER_CONFIG_CHANGER_CONFIG , NULL }
+};
+
 /*
  * Lexical Analysis Implementation
  */
@@ -1038,10 +1267,21 @@ lookup_keyword(
     char *     str)
 {
     keytab_t *kwp;
+    char *str1 = stralloc(str);
+    char *p = str1;
+
+    /* Fold '-' to '_' in the token.  Note that this modifies str1
+     * in place. */
+    while (*p) {
+       if (*p == '-') *p = '_';
+       p++;
+    }
 
     for(kwp = keytable; kwp->keyword != NULL; kwp++) {
-       if (strcasecmp(kwp->keyword, str) == 0) break;
+       if (strcasecmp(kwp->keyword, str1) == 0) break;
     }
+
+    amfree(str1);
     return kwp->token;
 }
 
@@ -1050,7 +1290,7 @@ get_conftoken(
     tok_t      exp)
 {
     int ch, d;
-    off_t am64;
+    gint64 int64;
     char *buf;
     char *tmps;
     int token_overflow;
@@ -1067,7 +1307,7 @@ get_conftoken(
        ** up again in the current keyword table.
        */
        switch(tok) {
-       case CONF_AM64:    case CONF_SIZE:
+       case CONF_INT64:   case CONF_SIZE:
        case CONF_INT:     case CONF_REAL:    case CONF_STRING:
        case CONF_LBRACE:  case CONF_RBRACE:  case CONF_COMMA:
        case CONF_NL:      case CONF_END:     case CONF_UNKNOWN:
@@ -1085,7 +1325,9 @@ get_conftoken(
     else {
        ch = conftoken_getc();
 
-       while(ch != EOF && ch != '\n' && isspace(ch))
+       /* note that we're explicitly assuming this file is ASCII.  Someday
+        * maybe we'll support UTF-8? */
+       while(ch != EOF && ch != '\n' && g_ascii_isspace(ch))
            ch = conftoken_getc();
        if (ch == '#') {        /* comment - eat everything but eol/eof */
            while((ch = conftoken_getc()) != EOF && ch != '\n') {
@@ -1129,36 +1371,36 @@ get_conftoken(
            sign = 1;
 
 negative_number: /* look for goto negative_number below sign is set there */
-           am64 = 0;
+           int64 = 0;
            do {
-               am64 = am64 * 10 + (ch - '0');
+               int64 = int64 * 10 + (ch - '0');
                ch = conftoken_getc();
            } while (isdigit(ch));
 
            if (ch != '.') {
                if (exp == CONF_INT) {
                    tok = CONF_INT;
-                   tokenval.v.i = sign * (int)am64;
+                   tokenval.v.i = sign * (int)int64;
                } else if (exp != CONF_REAL) {
-                   tok = CONF_AM64;
-                   tokenval.v.am64 = (off_t)sign * am64;
+                   tok = CONF_INT64;
+                   tokenval.v.int64 = (gint64)sign * int64;
                } else {
                    /* automatically convert to real when expected */
-                   tokenval.v.r = (double)sign * (double)am64;
+                   tokenval.v.r = (double)sign * (double)int64;
                    tok = CONF_REAL;
                }
            } else {
                /* got a real number, not an int */
-               tokenval.v.r = sign * (double) am64;
-               am64 = 0;
+               tokenval.v.r = sign * (double) int64;
+               int64 = 0;
                d = 1;
                ch = conftoken_getc();
                while (isdigit(ch)) {
-                   am64 = am64 * 10 + (ch - '0');
+                   int64 = int64 * 10 + (ch - '0');
                    d = d * 10;
                    ch = conftoken_getc();
                }
-               tokenval.v.r += sign * ((double)am64) / d;
+               tokenval.v.r += sign * ((double)int64) / d;
                tok = CONF_REAL;
            }
 
@@ -1366,10 +1608,11 @@ conftoken_ungetc(
  * Parser Implementation
  */
 
-static gboolean
+static void
 read_conffile(
     char *filename,
-    gboolean is_client)
+    gboolean is_client,
+    gboolean missing_ok)
 {
     /* Save global locations. */
     FILE *save_file     = current_file;
@@ -1384,18 +1627,14 @@ read_conffile(
        keytable = server_keytab;
        parsetable = server_var;
     }
-    current_filename = config_dir_relative(filename);
+    filename = config_dir_relative(filename);
+    current_filename = get_seen_filename(filename);
+    amfree(filename);
 
     if ((current_file = fopen(current_filename, "r")) == NULL) {
-       /* client conf files are optional, and this fprintf ends up sending this message back
-        * to the server without proper auth encapsulation, leading to "invalid size: could not
-        * open .."  This is fixed in TRUNK by completely rewriting this module's error-handling
-        * code. */
-       if (!is_client) {
-           g_fprintf(stderr, _("could not open conf file \"%s\": %s\n"), current_filename,
-               strerror(errno));
-       }
-       got_parserror = TRUE;
+       if (!missing_ok)
+           conf_parserror(_("could not open conf file \"%s\": %s"), 
+                   current_filename, strerror(errno));
        goto finish;
     }
 
@@ -1409,14 +1648,11 @@ read_conffile(
     afclose(current_file);
 
 finish:
-    amfree(current_filename);
 
     /* Restore servers */
     current_line_num = save_line_num;
     current_file     = save_file;
     current_filename = save_filename;
-
-    return !got_parserror;
 }
 
 static gboolean
@@ -1427,11 +1663,12 @@ read_confline(
 
     current_line_num += 1;
     get_conftoken(CONF_ANY);
+    handle_deprecated_keyword();
+
     switch(tok) {
     case CONF_INCLUDEFILE:
        get_conftoken(CONF_STRING);
-       if (!read_conffile(tokenval.v.s, is_client))
-           return 0;
+       read_conffile(tokenval.v.s, is_client, FALSE);
        break;
 
     case CONF_HOLDING:
@@ -1444,13 +1681,20 @@ read_confline(
 
     case CONF_DEFINE:
        if (is_client) {
-           handle_invalid_keyword(tokenval.v.s);
+           get_conftoken(CONF_ANY);
+           if(tok == CONF_APPLICATION_TOOL) get_application();
+           else if(tok == CONF_PP_SCRIPT_TOOL) get_pp_script();
+           else conf_parserror(_("APPLICATION-TOOL or SCRIPT-TOOL expected"));
        } else {
            get_conftoken(CONF_ANY);
            if(tok == CONF_DUMPTYPE) get_dumptype();
            else if(tok == CONF_TAPETYPE) get_tapetype();
            else if(tok == CONF_INTERFACE) get_interface();
-           else conf_parserror(_("DUMPTYPE, INTERFACE or TAPETYPE expected"));
+           else if(tok == CONF_APPLICATION_TOOL) get_application();
+           else if(tok == CONF_PP_SCRIPT_TOOL) get_pp_script();
+           else if(tok == CONF_DEVICE) get_device_config();
+           else if(tok == CONF_CHANGER) get_changer_config();
+           else conf_parserror(_("DUMPTYPE, INTERFACE, TAPETYPE, APPLICATION-TOOL, SCRIPT-TOOL, DEVICE, or CHANGER expected"));
        }
        break;
 
@@ -1482,42 +1726,50 @@ read_confline(
 }
 
 static void
-handle_invalid_keyword(
-    const char * token)
+handle_deprecated_keyword(void)
 {
+    tok_t *dep;
     /* Procedure for deprecated keywords:
      * 1) At time of deprecation, add to warning_deprecated below.
-     *    Note the date of deprecation.
-     * 2) After two years, move the keyword to error_deprecated below.
+     *    Note the date of deprecation.  The keyword will still be
+     *    parsed, and can still be used from other parts of Amanda,
+     *    during this time.
+     * 2) After two years, move the keyword (as a string) to
+     *    error_deprecated below. Remove the token (CONF_XXX) and
+     *    config parameter (CNF_XXX) from the rest of the module.
      *    Note the date of the move.
-     * 3) After two more years, drop the token entirely. */
+     */
 
-    static const char * warning_deprecated[] = {
-        "rawtapedev",  /* 2007-01-23 */
-        "tapebufs",    /* 2007-10-15 */
-       "netusage",    /* historical since 1997-08-11, deprecated 2007-10-23 */
-        NULL
+    static tok_t warning_deprecated[] = {
+        CONF_RAWTAPEDEV,  /* 2007-01-23 */
+        CONF_TAPEBUFS,    /* 2007-10-15 */
+       CONF_FILE_PAD,    /* 2008-07-01 */
+        0
     };
+
+    for (dep = warning_deprecated; *dep; dep++) {
+       if (tok == *dep) {
+            conf_parswarn(_("warning: Keyword %s is deprecated."),
+                           tokenval.v.s);
+       }
+    }
+}
+
+static void
+handle_invalid_keyword(
+    const char * token)
+{
     static const char * error_deprecated[] = {
         NULL
     };
     const char ** s;
 
-    for (s = warning_deprecated; *s != NULL; s ++) {
-        if (strcmp(*s, token) == 0) {
-            conf_parswarn(_("warning: Keyword %s is deprecated."),
-                           token);
-            break;
-        }
-    }
-    if (*s == NULL) {
-        for (s = error_deprecated; *s != NULL; s ++) {
-            if (strcmp(*s, token) == 0) {
-                conf_parserror(_("error: Keyword %s is deprecated."),
-                               token);
-                return;
-            }
-        }
+    for (s = error_deprecated; *s != NULL; s ++) {
+       if (strcmp(*s, token) == 0) {
+           conf_parserror(_("error: Keyword %s is deprecated."),
+                          token);
+           return;
+       }
     }
     if (*s == NULL) {
         conf_parserror(_("configuration keyword expected"));
@@ -1534,6 +1786,24 @@ handle_invalid_keyword(
     g_assert_not_reached();
 }
 
+static char *
+get_seen_filename(
+    char *filename)
+{
+    GSList *iter;
+    char *istr;
+
+    for (iter = seen_filenames; iter; iter = iter->next) {
+       istr = iter->data;
+       if (istr == filename || 0 == strcmp(istr, filename))
+           return istr;
+    }
+
+    istr = stralloc(filename);
+    seen_filenames = g_slist_prepend(seen_filenames, istr);
+    return istr;
+}
+
 static void
 read_block(
     conf_var_t    *read_var,
@@ -1604,7 +1874,8 @@ get_holdingdisk(
 
     get_conftoken(CONF_IDENT);
     hdcur.name = stralloc(tokenval.v.s);
-    hdcur.seen = current_line_num;
+    hdcur.seen.filename = current_filename;
+    hdcur.seen.linenum = current_line_num;
 
     read_block(holding_var, hdcur.value,
               _("holding disk parameter expected"), 1, NULL);
@@ -1620,9 +1891,9 @@ init_holdingdisk_defaults(
 {
     conf_init_str(&hdcur.value[HOLDING_COMMENT]  , "");
     conf_init_str(&hdcur.value[HOLDING_DISKDIR]  , "");
-    conf_init_am64(&hdcur.value[HOLDING_DISKSIZE] , (off_t)0);
+    conf_init_int64(&hdcur.value[HOLDING_DISKSIZE] , (gint64)0);
                     /* 1 Gb = 1M counted in 1Kb blocks */
-    conf_init_am64(&hdcur.value[HOLDING_CHUNKSIZE], (off_t)1024*1024);
+    conf_init_int64(&hdcur.value[HOLDING_CHUNKSIZE], (gint64)1024*1024);
 }
 
 static void
@@ -1659,7 +1930,7 @@ read_dumptype(
 
     if (fname) {
        saved_fname = current_filename;
-       current_filename = fname;
+       current_filename = get_seen_filename(fname);
     }
 
     if (linenum)
@@ -1675,7 +1946,8 @@ read_dumptype(
        get_conftoken(CONF_IDENT);
        dpcur.name = stralloc(tokenval.v.s);
     }
-    dpcur.seen = current_line_num;
+    dpcur.seen.filename = current_filename;
+    dpcur.seen.linenum = current_line_num;
 
     read_block(dumptype_var, dpcur.value,
               _("dumptype parameter expected"),
@@ -1730,7 +2002,7 @@ init_dumptype_defaults(void)
     conf_init_int      (&dpcur.value[DUMPTYPE_MAXDUMPS]          , conf_data[CNF_MAXDUMPS].v.i);
     conf_init_int      (&dpcur.value[DUMPTYPE_MAXPROMOTEDAY]     , 10000);
     conf_init_int      (&dpcur.value[DUMPTYPE_BUMPPERCENT]       , conf_data[CNF_BUMPPERCENT].v.i);
-    conf_init_am64     (&dpcur.value[DUMPTYPE_BUMPSIZE]          , conf_data[CNF_BUMPSIZE].v.am64);
+    conf_init_int64    (&dpcur.value[DUMPTYPE_BUMPSIZE]          , conf_data[CNF_BUMPSIZE].v.int64);
     conf_init_int      (&dpcur.value[DUMPTYPE_BUMPDAYS]          , conf_data[CNF_BUMPDAYS].v.i);
     conf_init_real     (&dpcur.value[DUMPTYPE_BUMPMULT]          , conf_data[CNF_BUMPMULT].v.r);
     conf_init_time     (&dpcur.value[DUMPTYPE_STARTTIME]         , (time_t)0);
@@ -1741,8 +2013,8 @@ init_dumptype_defaults(void)
     conf_init_str   (&dpcur.value[DUMPTYPE_SRV_DECRYPT_OPT]   , "-d");
     conf_init_str   (&dpcur.value[DUMPTYPE_CLNT_DECRYPT_OPT]  , "-d");
     conf_init_rate     (&dpcur.value[DUMPTYPE_COMPRATE]          , 0.50, 0.50);
-    conf_init_am64     (&dpcur.value[DUMPTYPE_TAPE_SPLITSIZE]    , (off_t)0);
-    conf_init_am64     (&dpcur.value[DUMPTYPE_FALLBACK_SPLITSIZE], (off_t)10 * 1024);
+    conf_init_int64    (&dpcur.value[DUMPTYPE_TAPE_SPLITSIZE]    , (gint64)0);
+    conf_init_int64    (&dpcur.value[DUMPTYPE_FALLBACK_SPLITSIZE], (gint64)10 * 1024);
     conf_init_str   (&dpcur.value[DUMPTYPE_SPLIT_DISKBUFFER]  , NULL);
     conf_init_bool     (&dpcur.value[DUMPTYPE_RECORD]            , 1);
     conf_init_bool     (&dpcur.value[DUMPTYPE_SKIP_INCR]         , 0);
@@ -1751,6 +2023,9 @@ init_dumptype_defaults(void)
     conf_init_bool     (&dpcur.value[DUMPTYPE_KENCRYPT]          , 0);
     conf_init_bool     (&dpcur.value[DUMPTYPE_IGNORE]            , 0);
     conf_init_bool     (&dpcur.value[DUMPTYPE_INDEX]             , 1);
+    conf_init_application(&dpcur.value[DUMPTYPE_APPLICATION]);
+    conf_init_pp_scriptlist(&dpcur.value[DUMPTYPE_PP_SCRIPTLIST]);
+    conf_init_proplist(&dpcur.value[DUMPTYPE_PROPERTY]);
 }
 
 static void
@@ -1761,7 +2036,12 @@ save_dumptype(void)
     dp = lookup_dumptype(dpcur.name);
 
     if(dp != (dumptype_t *)0) {
-       conf_parserror(_("dumptype %s already defined on line %d"), dp->name, dp->seen);
+       if (dp->seen.linenum == -1) {
+           conf_parserror(_("dumptype %s is defined by default and cannot be redefined"), dp->name);
+       } else {
+           conf_parserror(_("dumptype %s already defined at %s:%d"), dp->name,
+                          dp->seen.filename, dp->seen.linenum);
+       }
        return;
     }
 
@@ -1794,7 +2074,7 @@ copy_dumptype(void)
     }
 
     for(i=0; i < DUMPTYPE_DUMPTYPE; i++) {
-       if(dt->value[i].seen) {
+       if(dt->value[i].seen.linenum) {
            free_val_t(&dpcur.value[i]);
            copy_val_t(&dpcur.value[i], &dt->value[i]);
        }
@@ -1813,7 +2093,8 @@ get_tapetype(void)
 
     get_conftoken(CONF_IDENT);
     tpcur.name = stralloc(tokenval.v.s);
-    tpcur.seen = current_line_num;
+    tpcur.seen.filename = current_filename;
+    tpcur.seen.linenum = current_line_num;
 
     read_block(tapetype_var, tpcur.value,
               _("tapetype parameter expected"), 1, copy_tapetype);
@@ -1835,9 +2116,9 @@ init_tapetype_defaults(void)
     conf_init_str(&tpcur.value[TAPETYPE_COMMENT]      , "");
     conf_init_str(&tpcur.value[TAPETYPE_LBL_TEMPL]    , "");
     conf_init_size  (&tpcur.value[TAPETYPE_BLOCKSIZE]    , DISK_BLOCK_KB);
-    conf_init_size  (&tpcur.value[TAPETYPE_READBLOCKSIZE], MAX_TAPE_BLOCK_KB);
-    conf_init_am64  (&tpcur.value[TAPETYPE_LENGTH]       , ((off_t)2000 * 1024));
-    conf_init_am64  (&tpcur.value[TAPETYPE_FILEMARK]     , (off_t)1000);
+    conf_init_size  (&tpcur.value[TAPETYPE_READBLOCKSIZE], DISK_BLOCK_KB);
+    conf_init_int64 (&tpcur.value[TAPETYPE_LENGTH]       , ((gint64)2000 * 1024));
+    conf_init_int64 (&tpcur.value[TAPETYPE_FILEMARK]     , (gint64)1000);
     conf_init_int   (&tpcur.value[TAPETYPE_SPEED]        , 200);
     conf_init_bool  (&tpcur.value[TAPETYPE_FILE_PAD]     , 1);
 }
@@ -1851,7 +2132,8 @@ save_tapetype(void)
 
     if(tp != (tapetype_t *)0) {
        amfree(tpcur.name);
-       conf_parserror(_("tapetype %s already defined on line %d"), tp->name, tp->seen);
+       conf_parserror(_("tapetype %s already defined at %s:%d"),
+               tp->name, tp->seen.filename, tp->seen.linenum);
        return;
     }
 
@@ -1883,7 +2165,7 @@ copy_tapetype(void)
     }
 
     for(i=0; i < TAPETYPE_TAPETYPE; i++) {
-       if(tp->value[i].seen) {
+       if(tp->value[i].seen.linenum) {
            free_val_t(&tpcur.value[i]);
            copy_val_t(&tpcur.value[i], &tp->value[i]);
        }
@@ -1902,7 +2184,8 @@ get_interface(void)
 
     get_conftoken(CONF_IDENT);
     ifcur.name = stralloc(tokenval.v.s);
-    ifcur.seen = current_line_num;
+    ifcur.seen.filename = current_filename;
+    ifcur.seen.linenum = current_line_num;
 
     read_block(interface_var, ifcur.value,
               _("interface parameter expected"), 1, copy_interface);
@@ -1930,8 +2213,8 @@ save_interface(void)
     ip = lookup_interface(ifcur.name);
 
     if(ip != (interface_t *)0) {
-       conf_parserror(_("interface %s already defined on line %d"), ip->name,
-                      ip->seen);
+       conf_parserror(_("interface %s already defined at %s:%d"),
+               ip->name, ip->seen.filename, ip->seen.linenum);
        return;
     }
 
@@ -1963,104 +2246,622 @@ copy_interface(void)
     }
 
     for(i=0; i < INTER_INTER; i++) {
-       if(ip->value[i].seen) {
+       if(ip->value[i].seen.linenum) {
            free_val_t(&ifcur.value[i]);
            copy_val_t(&ifcur.value[i], &ip->value[i]);
        }
     }
 }
 
-/* Read functions */
 
-static void
-read_int(
-    conf_var_t *np G_GNUC_UNUSED,
-    val_t *val)
+application_t *
+read_application(
+    char *name,
+    FILE *from,
+    char *fname,
+    int *linenum)
 {
-    ckseen(&val->seen);
-    val_t__int(val) = get_int();
+    int save_overwrites;
+    FILE *saved_conf = NULL;
+    char *saved_fname = NULL;
+
+    if (from) {
+       saved_conf = current_file;
+       current_file = from;
+    }
+
+    if (fname) {
+       saved_fname = current_filename;
+       current_filename = get_seen_filename(fname);
+    }
+
+    if (linenum)
+       current_line_num = *linenum;
+
+    save_overwrites = allow_overwrites;
+    allow_overwrites = 1;
+
+    init_application_defaults();
+    if (name) {
+       apcur.name = name;
+    } else {
+       get_conftoken(CONF_IDENT);
+       apcur.name = stralloc(tokenval.v.s);
+    }
+    apcur.seen.filename = current_filename;
+    apcur.seen.linenum = current_line_num;
+
+    read_block(application_var, apcur.value,
+              _("application-tool parameter expected"),
+              (name == NULL), *copy_application);
+    if(!name)
+       get_conftoken(CONF_NL);
+
+    if (!application_get_plugin(&apcur) ||
+       strlen(application_get_plugin(&apcur)) == 0) {
+       conf_parserror("plugin not set for application");
+    }
+
+    save_application();
+
+    allow_overwrites = save_overwrites;
+
+    if (linenum)
+       *linenum = current_line_num;
+
+    if (fname)
+       current_filename = saved_fname;
+
+    if (from)
+       current_file = saved_conf;
+
+    return lookup_application(apcur.name);
 }
 
 static void
-read_am64(
-    conf_var_t *np G_GNUC_UNUSED,
-    val_t *val)
+get_application(
+    void)
 {
-    ckseen(&val->seen);
-    val_t__am64(val) = get_am64_t();
+    read_application(NULL, NULL, NULL, NULL);
 }
 
 static void
-read_real(
-    conf_var_t *np G_GNUC_UNUSED,
-    val_t *val)
+init_application_defaults(
+    void)
 {
-    ckseen(&val->seen);
-    get_conftoken(CONF_REAL);
-    val_t__real(val) = tokenval.v.r;
+    apcur.name = NULL;
+    conf_init_str(&apcur.value[APPLICATION_COMMENT] , "");
+    conf_init_str(&apcur.value[APPLICATION_PLUGIN]  , "");
+    conf_init_proplist(&apcur.value[APPLICATION_PROPERTY]);
 }
 
 static void
-read_str(
-    conf_var_t *np G_GNUC_UNUSED,
-    val_t *val)
+save_application(
+    void)
 {
-    ckseen(&val->seen);
-    get_conftoken(CONF_STRING);
-    val->v.s = newstralloc(val->v.s, tokenval.v.s);
+    application_t *ap, *ap1;
+
+    ap = lookup_application(apcur.name);
+
+    if(ap != (application_t *)0) {
+       conf_parserror(_("application-tool %s already defined at %s:%d"),
+                      ap->name, ap->seen.filename, ap->seen.linenum);
+       return;
+    }
+
+    ap = alloc(sizeof(application_t));
+    *ap = apcur;
+    ap->next = NULL;
+    /* add at end of list */
+    if (!application_list)
+       application_list = ap;
+    else {
+       ap1 = application_list;
+       while (ap1->next != NULL) {
+           ap1 = ap1->next;
+       }
+       ap1->next = ap;
+    }
 }
 
 static void
-read_ident(
-    conf_var_t *np G_GNUC_UNUSED,
-    val_t *val)
+copy_application(void)
 {
-    ckseen(&val->seen);
-    get_conftoken(CONF_IDENT);
-    val->v.s = newstralloc(val->v.s, tokenval.v.s);
+    application_t *ap;
+    int i;
+
+    ap = lookup_application(tokenval.v.s);
+
+    if(ap == NULL) {
+       conf_parserror(_("application parameter expected"));
+       return;
+    }
+
+    for(i=0; i < APPLICATION_APPLICATION; i++) {
+       if(ap->value[i].seen.linenum) {
+           free_val_t(&apcur.value[i]);
+       copy_val_t(&apcur.value[i], &ap->value[i]);
+       }
+    }
 }
 
-static void
-read_time(
-    conf_var_t *np G_GNUC_UNUSED,
-    val_t *val)
+pp_script_t *
+read_pp_script(
+    char *name,
+    FILE *from,
+    char *fname,
+    int *linenum)
 {
-    ckseen(&val->seen);
-    val_t__time(val) = get_time();
+    int save_overwrites;
+    FILE *saved_conf = NULL;
+    char *saved_fname = NULL;
+
+    if (from) {
+       saved_conf = current_file;
+       current_file = from;
+    }
+
+    if (fname) {
+       saved_fname = current_filename;
+       current_filename = get_seen_filename(fname);
+    }
+
+    if (linenum)
+       current_line_num = *linenum;
+
+    save_overwrites = allow_overwrites;
+    allow_overwrites = 1;
+
+    init_pp_script_defaults();
+    if (name) {
+       pscur.name = name;
+    } else {
+       get_conftoken(CONF_IDENT);
+       pscur.name = stralloc(tokenval.v.s);
+    }
+    pscur.seen.filename = current_filename;
+    pscur.seen.linenum = current_line_num;
+
+    read_block(pp_script_var, pscur.value,
+              _("script-tool parameter expected"),
+              (name == NULL), *copy_pp_script);
+    if(!name)
+       get_conftoken(CONF_NL);
+
+    if (!pp_script_get_plugin(&pscur) ||
+       strlen(pp_script_get_plugin(&pscur)) == 0) {
+       conf_parserror("plugin not set for script");
+    }
+
+    save_pp_script();
+
+    allow_overwrites = save_overwrites;
+
+    if (linenum)
+       *linenum = current_line_num;
+
+    if (fname)
+       current_filename = saved_fname;
+
+    if (from)
+       current_file = saved_conf;
+
+    return lookup_pp_script(pscur.name);
 }
 
 static void
-read_size(
-    conf_var_t *np G_GNUC_UNUSED,
-    val_t *val)
+get_pp_script(
+    void)
 {
-    ckseen(&val->seen);
-    val_t__size(val) = get_size();
+    read_pp_script(NULL, NULL, NULL, NULL);
 }
 
 static void
-read_bool(
-    conf_var_t *np G_GNUC_UNUSED,
-    val_t *val)
+init_pp_script_defaults(
+    void)
 {
-    ckseen(&val->seen);
-    val_t__boolean(val) = get_bool();
+    pscur.name = NULL;
+    conf_init_str(&pscur.value[PP_SCRIPT_COMMENT] , "");
+    conf_init_str(&pscur.value[PP_SCRIPT_PLUGIN]  , "");
+    conf_init_proplist(&pscur.value[PP_SCRIPT_PROPERTY]);
+    conf_init_execute_on(&pscur.value[PP_SCRIPT_EXECUTE_ON], 0);
+    conf_init_execute_where(&pscur.value[PP_SCRIPT_EXECUTE_WHERE], ES_CLIENT);
 }
 
 static void
-read_compress(
-    conf_var_t *np G_GNUC_UNUSED,
-    val_t *val)
+save_pp_script(
+    void)
 {
-    int serv, clie, none, fast, best, custom;
-    int done;
-    comp_t comp;
+    pp_script_t *ps, *ps1;
 
-    ckseen(&val->seen);
+    ps = lookup_pp_script(pscur.name);
 
-    serv = clie = none = fast = best = custom  = 0;
+    if(ps != (pp_script_t *)0) {
+       conf_parserror(_("script-tool %s already defined at %s:%d"),
+                      ps->name, ps->seen.filename, ps->seen.linenum);
+       return;
+    }
 
-    done = 0;
+    ps = alloc(sizeof(pp_script_t));
+    *ps = pscur;
+    ps->next = NULL;
+    /* add at end of list */
+    if (!pp_script_list)
+       pp_script_list = ps;
+    else {
+       ps1 = pp_script_list;
+       while (ps1->next != NULL) {
+           ps1 = ps1->next;
+       }
+       ps1->next = ps;
+    }
+}
+
+static void
+copy_pp_script(void)
+{
+    pp_script_t *ps;
+    int i;
+
+    ps = lookup_pp_script(tokenval.v.s);
+
+    if(ps == NULL) {
+       conf_parserror(_("script parameter expected"));
+       return;
+    }
+
+    for(i=0; i < PP_SCRIPT_PP_SCRIPT; i++) {
+       if(ps->value[i].seen.linenum) {
+           free_val_t(&pscur.value[i]);
+           copy_val_t(&pscur.value[i], &ps->value[i]);
+       }
+    }
+}
+
+device_config_t *
+read_device_config(
+    char *name,
+    FILE *from,
+    char *fname,
+    int *linenum)
+{
+    int save_overwrites;
+    FILE *saved_conf = NULL;
+    char *saved_fname = NULL;
+
+    if (from) {
+       saved_conf = current_file;
+       current_file = from;
+    }
+
+    if (fname) {
+       saved_fname = current_filename;
+       current_filename = get_seen_filename(fname);
+    }
+
+    if (linenum)
+       current_line_num = *linenum;
+
+    save_overwrites = allow_overwrites;
+    allow_overwrites = 1;
+
+    init_device_config_defaults();
+    if (name) {
+       dccur.name = name;
+    } else {
+       get_conftoken(CONF_IDENT);
+       dccur.name = stralloc(tokenval.v.s);
+    }
+    dccur.seen.filename = current_filename;
+    dccur.seen.linenum = current_line_num;
+
+    read_block(device_config_var, dccur.value,
+              _("device parameter expected"),
+              (name == NULL), *copy_device_config);
+    if(!name)
+       get_conftoken(CONF_NL);
+
+    save_device_config();
+
+    allow_overwrites = save_overwrites;
+
+    if (linenum)
+       *linenum = current_line_num;
+
+    if (fname)
+       current_filename = saved_fname;
+
+    if (from)
+       current_file = saved_conf;
+
+    return lookup_device_config(dccur.name);
+}
+
+static void
+get_device_config(
+    void)
+{
+    read_device_config(NULL, NULL, NULL, NULL);
+}
+
+static void
+init_device_config_defaults(
+    void)
+{
+    dccur.name = NULL;
+    conf_init_str(&dccur.value[DEVICE_CONFIG_COMMENT] , "");
+    conf_init_str(&dccur.value[DEVICE_CONFIG_TAPEDEV]  , "");
+    conf_init_proplist(&dccur.value[DEVICE_CONFIG_DEVICE_PROPERTY]);
+}
+
+static void
+save_device_config(
+    void)
+{
+    device_config_t *dc, *dc1;
+
+    dc = lookup_device_config(dccur.name);
+
+    if(dc != (device_config_t *)0) {
+       conf_parserror(_("device %s already defined at %s:%d"),
+                      dc->name, dc->seen.filename, dc->seen.linenum);
+       return;
+    }
+
+    dc = alloc(sizeof(device_config_t));
+    *dc = dccur;
+    dc->next = NULL;
+    /* add at end of list */
+    if (!device_config_list)
+       device_config_list = dc;
+    else {
+       dc1 = device_config_list;
+       while (dc1->next != NULL) {
+           dc1 = dc1->next;
+       }
+       dc1->next = dc;
+    }
+}
+
+static void
+copy_device_config(void)
+{
+    device_config_t *dc;
+    int i;
+
+    dc = lookup_device_config(tokenval.v.s);
+
+    if(dc == NULL) {
+       conf_parserror(_("device parameter expected"));
+       return;
+    }
+
+    for(i=0; i < DEVICE_CONFIG_DEVICE_CONFIG; i++) {
+       if(dc->value[i].seen.linenum) {
+           free_val_t(&dccur.value[i]);
+           copy_val_t(&dccur.value[i], &dc->value[i]);
+       }
+    }
+}
+
+changer_config_t *
+read_changer_config(
+    char *name,
+    FILE *from,
+    char *fname,
+    int *linenum)
+{
+    int save_overwrites;
+    FILE *saved_conf = NULL;
+    char *saved_fname = NULL;
+
+    if (from) {
+       saved_conf = current_file;
+       current_file = from;
+    }
+
+    if (fname) {
+       saved_fname = current_filename;
+       current_filename = fname;
+    }
+
+    if (linenum)
+       current_line_num = *linenum;
+
+    save_overwrites = allow_overwrites;
+    allow_overwrites = 1;
+
+    init_changer_config_defaults();
+    if (name) {
+       cccur.name = name;
+    } else {
+       get_conftoken(CONF_IDENT);
+       cccur.name = stralloc(tokenval.v.s);
+    }
+    cccur.seen = current_line_num;
+
+    read_block(changer_config_var, cccur.value,
+              _("changer parameter expected"),
+              (name == NULL), *copy_changer_config);
+    if(!name)
+       get_conftoken(CONF_NL);
+
+    save_changer_config();
+
+    allow_overwrites = save_overwrites;
+
+    if (linenum)
+       *linenum = current_line_num;
+
+    if (fname)
+       current_filename = saved_fname;
+
+    if (from)
+       current_file = saved_conf;
+
+    return lookup_changer_config(cccur.name);
+}
+
+static void
+get_changer_config(
+    void)
+{
+    read_changer_config(NULL, NULL, NULL, NULL);
+}
+
+static void
+init_changer_config_defaults(
+    void)
+{
+    cccur.name = NULL;
+    conf_init_str(&cccur.value[CHANGER_CONFIG_COMMENT] , "");
+    conf_init_str(&cccur.value[CHANGER_CONFIG_TAPEDEV]  , "");
+    conf_init_str(&cccur.value[CHANGER_CONFIG_TPCHANGER]  , "");
+    conf_init_str(&cccur.value[CHANGER_CONFIG_CHANGERDEV]  , "");
+    conf_init_str(&cccur.value[CHANGER_CONFIG_CHANGERFILE]  , "");
+}
+
+static void
+save_changer_config(
+    void)
+{
+    changer_config_t *dc, *dc1;
+
+    dc = lookup_changer_config(cccur.name);
+
+    if(dc != (changer_config_t *)0) {
+       conf_parserror(_("changer %s already defined on line %d"),
+                      dc->name, dc->seen);
+       return;
+    }
+
+    dc = alloc(sizeof(changer_config_t));
+    *dc = cccur;
+    dc->next = NULL;
+    /* add at end of list */
+    if (!changer_config_list)
+       changer_config_list = dc;
+    else {
+       dc1 = changer_config_list;
+       while (dc1->next != NULL) {
+           dc1 = dc1->next;
+       }
+       dc1->next = dc;
+    }
+}
+
+static void
+copy_changer_config(void)
+{
+    changer_config_t *dc;
+    int i;
+
+    dc = lookup_changer_config(tokenval.v.s);
+
+    if(dc == NULL) {
+       conf_parserror(_("changer parameter expected"));
+       return;
+    }
+
+    for(i=0; i < CHANGER_CONFIG_CHANGER_CONFIG; i++) {
+       if(dc->value[i].seen.linenum) {
+           free_val_t(&cccur.value[i]);
+           copy_val_t(&cccur.value[i], &dc->value[i]);
+       }
+    }
+}
+
+/* Read functions */
+
+static void
+read_int(
+    conf_var_t *np G_GNUC_UNUSED,
+    val_t *val)
+{
+    ckseen(&val->seen);
+    val_t__int(val) = get_int();
+}
+
+static void
+read_int64(
+    conf_var_t *np G_GNUC_UNUSED,
+    val_t *val)
+{
+    ckseen(&val->seen);
+    val_t__int64(val) = get_int64();
+}
+
+static void
+read_real(
+    conf_var_t *np G_GNUC_UNUSED,
+    val_t *val)
+{
+    ckseen(&val->seen);
+    get_conftoken(CONF_REAL);
+    val_t__real(val) = tokenval.v.r;
+}
+
+static void
+read_str(
+    conf_var_t *np G_GNUC_UNUSED,
+    val_t *val)
+{
+    ckseen(&val->seen);
+    get_conftoken(CONF_STRING);
+    val->v.s = newstralloc(val->v.s, tokenval.v.s);
+}
+
+static void
+read_ident(
+    conf_var_t *np G_GNUC_UNUSED,
+    val_t *val)
+{
+    ckseen(&val->seen);
+    get_conftoken(CONF_IDENT);
+    val->v.s = newstralloc(val->v.s, tokenval.v.s);
+}
+
+static void
+read_time(
+    conf_var_t *np G_GNUC_UNUSED,
+    val_t *val)
+{
+    ckseen(&val->seen);
+    val_t__time(val) = get_time();
+}
+
+static void
+read_size(
+    conf_var_t *np G_GNUC_UNUSED,
+    val_t *val)
+{
+    ckseen(&val->seen);
+    val_t__size(val) = get_size();
+}
+
+static void
+read_bool(
+    conf_var_t *np G_GNUC_UNUSED,
+    val_t *val)
+{
+    ckseen(&val->seen);
+    val_t__boolean(val) = get_bool();
+}
+
+static void
+read_compress(
+    conf_var_t *np G_GNUC_UNUSED,
+    val_t *val)
+{
+    int serv, clie, none, fast, best, custom;
+    int done;
+    comp_t comp;
+
+    ckseen(&val->seen);
+
+    serv = clie = none = fast = best = custom  = 0;
+
+    done = 0;
     do {
        get_conftoken(CONF_ANY);
        switch(tok) {
@@ -2258,6 +3059,24 @@ read_taperalgo(
     }
 }
 
+static void
+read_send_amreport_on(
+    conf_var_t *np G_GNUC_UNUSED,
+    val_t *val)
+{
+    ckseen(&val->seen);
+
+    get_conftoken(CONF_ANY);
+    switch(tok) {
+    case CONF_ALL:     val_t__send_amreport(val) = SEND_AMREPORT_ALL;     break;
+    case CONF_STRANGE: val_t__send_amreport(val) = SEND_AMREPORT_STRANGE; break;
+    case CONF_ERROR:   val_t__send_amreport(val) = SEND_AMREPORT_ERROR;   break;
+    case CONF_NEVER:   val_t__send_amreport(val) = SEND_AMREPORT_NEVER;   break;
+    default:
+       conf_parserror(_("ALL, STRANGE, ERROR or NEVER expected"));
+    }
+}
+
 static void
 read_priority(
     conf_var_t *np G_GNUC_UNUSED,
@@ -2398,19 +3217,185 @@ read_intrange(
 static void
 read_property(
     conf_var_t *np G_GNUC_UNUSED,
-    val_t *val)
+    val_t      *val)
 {
-    char *key, *value;
-    get_conftoken(CONF_STRING);
+    char *key;
+    property_t *property = malloc(sizeof(property_t));
+    property_t *old_property;
+    property->append = 0; 
+    property->priority = 0; 
+    property->values = NULL;
+
+    get_conftoken(CONF_ANY);
+    if (tok == CONF_PRIORITY) {
+       property->priority = 1;
+       get_conftoken(CONF_ANY);
+    }
+    if (tok == CONF_APPEND) {
+       property->append = 1;
+       get_conftoken(CONF_ANY);
+    }
+    if (tok != CONF_STRING) {
+       conf_parserror(_("key expected"));
+       return;
+    }
     key = strdup(tokenval.v.s);
-    get_conftoken(CONF_STRING);
-    value = strdup(tokenval.v.s);
 
-    g_hash_table_insert(val_t__proplist(val), key, value);
+    get_conftoken(CONF_ANY);
+    if (tok == CONF_NL ||  tok == CONF_END) {
+       g_hash_table_remove(val->v.proplist, key);
+       unget_conftoken();
+       return;
+    }
+    if (tok != CONF_STRING) {
+       conf_parserror(_("value expected"));
+       return;
+    }
+
+    if(val->seen.linenum == 0) {
+       val->seen.filename = current_filename;
+       val->seen.linenum = current_line_num;
+    }
+
+    old_property = g_hash_table_lookup(val->v.proplist, key);
+    if (property->append) {
+       if (old_property) {
+           if (old_property->priority)
+               property->priority = 1;
+           property->values = old_property->values;
+       }
+    } else {
+       property->values = g_hash_table_lookup(val->v.proplist, key);
+       if (old_property) {
+           g_slist_free(old_property->values);
+           amfree(old_property);
+       }
+       property->values = NULL;
+    }
+    while(tok == CONF_STRING) {
+       property->values = g_slist_append(property->values,
+                                         strdup(tokenval.v.s));
+       get_conftoken(CONF_ANY);
+    }
+    unget_conftoken();
+    g_hash_table_insert(val->v.proplist, key, property);
+}
+
+
+static void
+read_dapplication(
+    conf_var_t *np G_GNUC_UNUSED,
+    val_t      *val)
+{
+
+    get_conftoken(CONF_ANY);
+    if (tok == CONF_LBRACE) {
+       val->v.application = read_application(vstralloc("custom(DUMPTYPE:",
+                                                       dpcur.name, ")", ".",
+                                                       anonymous_value(),NULL),
+                                             NULL, NULL, NULL);
+
+    } else if (tok == CONF_STRING) {
+       val->v.application = lookup_application(tokenval.v.s);
+       if (val->v.application == NULL) {
+           conf_parserror(_("Unknown application named: %s"), tokenval.v.s);
+           return;
+       }
+    } else {
+       conf_parserror(_("application name expected: %d %d"), tok, CONF_STRING);
+       return;
+    }
+    ckseen(&val->seen);
+}
+
+static void
+read_dpp_script(
+    conf_var_t *np G_GNUC_UNUSED,
+    val_t      *val)
+{
+    pp_script_t *pp_script;
+    get_conftoken(CONF_ANY);
+    if (tok == CONF_LBRACE) {
+       pp_script = read_pp_script(vstralloc("custom(DUMPTYPE:", dpcur.name,
+                                            ")", ".", anonymous_value(),NULL),
+                                  NULL, NULL, NULL);
+    } else if (tok == CONF_STRING) {
+       pp_script = lookup_pp_script(tokenval.v.s);
+       if (pp_script == NULL) {
+           conf_parserror(_("Unknown pp_script named: %s"), tokenval.v.s);
+           return;
+       }
+    } else {
+       conf_parserror(_("pp_script name expected: %d %d"), tok, CONF_STRING);
+       return;
+    }
+    val->v.pp_scriptlist = g_slist_append(val->v.pp_scriptlist, pp_script);
+    ckseen(&val->seen);
+}
+static void
+read_execute_on(
+    conf_var_t *np G_GNUC_UNUSED,
+    val_t *val)
+{
+    ckseen(&val->seen);
+
+    get_conftoken(CONF_ANY);
+    val->v.i = 0;
+    do {
+       switch(tok) {
+       case CONF_PRE_DLE_AMCHECK:     val->v.i |= EXECUTE_ON_PRE_DLE_AMCHECK;     break;
+       case CONF_PRE_HOST_AMCHECK:    val->v.i |= EXECUTE_ON_PRE_HOST_AMCHECK;    break;
+       case CONF_POST_DLE_AMCHECK:    val->v.i |= EXECUTE_ON_POST_DLE_AMCHECK;    break;
+       case CONF_POST_HOST_AMCHECK:   val->v.i |= EXECUTE_ON_POST_HOST_AMCHECK;   break;
+       case CONF_PRE_DLE_ESTIMATE:    val->v.i |= EXECUTE_ON_PRE_DLE_ESTIMATE;    break;
+       case CONF_PRE_HOST_ESTIMATE:   val->v.i |= EXECUTE_ON_PRE_HOST_ESTIMATE;   break;
+       case CONF_POST_DLE_ESTIMATE:   val->v.i |= EXECUTE_ON_POST_DLE_ESTIMATE;   break;
+       case CONF_POST_HOST_ESTIMATE:  val->v.i |= EXECUTE_ON_POST_HOST_ESTIMATE;  break;
+       case CONF_PRE_DLE_BACKUP:      val->v.i |= EXECUTE_ON_PRE_DLE_BACKUP;      break;
+       case CONF_PRE_HOST_BACKUP:     val->v.i |= EXECUTE_ON_PRE_HOST_BACKUP;     break;
+       case CONF_POST_DLE_BACKUP:     val->v.i |= EXECUTE_ON_POST_DLE_BACKUP;     break;
+       case CONF_POST_HOST_BACKUP:    val->v.i |= EXECUTE_ON_POST_HOST_BACKUP;    break;
+       case CONF_PRE_RECOVER:         val->v.i |= EXECUTE_ON_PRE_RECOVER;         break;
+       case CONF_POST_RECOVER:        val->v.i |= EXECUTE_ON_POST_RECOVER;        break;
+       case CONF_PRE_LEVEL_RECOVER:   val->v.i |= EXECUTE_ON_PRE_LEVEL_RECOVER;   break;
+       case CONF_POST_LEVEL_RECOVER:  val->v.i |= EXECUTE_ON_POST_LEVEL_RECOVER;  break;
+       case CONF_INTER_LEVEL_RECOVER: val->v.i |= EXECUTE_ON_INTER_LEVEL_RECOVER; break;
+       default:
+       conf_parserror(_("Execute_on expected"));
+       }
+       get_conftoken(CONF_ANY);
+       if (tok != CONF_COMMA) {
+           unget_conftoken();
+           break;
+       }
+       get_conftoken(CONF_ANY);
+    } while (1);
+}
+
+static void
+read_execute_where(
+    conf_var_t *np G_GNUC_UNUSED,
+    val_t *val)
+{
+    ckseen(&val->seen);
+
+    get_conftoken(CONF_ANY);
+    switch(tok) {
+    case CONF_CLIENT:      val->v.i = ES_CLIENT;   break;
+    case CONF_SERVER:      val->v.i = ES_SERVER;   break;
+    default:
+       conf_parserror(_("CLIENT or SERVER expected"));
+    }
 }
 
 /* get_* functions */
 
+/* these functions use precompiler conditionals to skip useless size checks
+ * when casting from one type to another.  SIZEOF_GINT64 is pretty simple to
+ * calculate; the others are calculated by configure. */
+
+#define SIZEOF_GINT64 8
+
 static time_t
 get_time(void)
 {
@@ -2420,7 +3405,7 @@ get_time(void)
     switch(tok) {
     case CONF_INT:
 #if SIZEOF_TIME_T < SIZEOF_INT
-       if ((off_t)tokenval.v.i >= (off_t)TIME_MAX)
+       if ((gint64)tokenval.v.i >= (gint64)TIME_MAX)
            conf_parserror(_("value too large"));
 #endif
        hhmm = (time_t)tokenval.v.i;
@@ -2428,18 +3413,18 @@ get_time(void)
 
     case CONF_SIZE:
 #if SIZEOF_TIME_T < SIZEOF_SSIZE_T
-       if ((off_t)tokenval.v.size >= (off_t)TIME_MAX)
+       if ((gint64)tokenval.v.size >= (gint64)TIME_MAX)
            conf_parserror(_("value too large"));
 #endif
        hhmm = (time_t)tokenval.v.size;
        break;
 
-    case CONF_AM64:
-#if SIZEOF_TIME_T < SIZEOF_LONG_LONG
-       if ((off_t)tokenval.v.am64 >= (off_t)TIME_MAX)
+    case CONF_INT64:
+#if SIZEOF_TIME_T < SIZEOF_GINT64
+       if ((gint64)tokenval.v.int64 >= (gint64)TIME_MAX)
            conf_parserror(_("value too large"));
 #endif
-       hhmm = (time_t)tokenval.v.am64;
+       hhmm = (time_t)tokenval.v.int64;
        break;
 
     case CONF_AMINFINITY:
@@ -2471,22 +3456,22 @@ get_int(void)
 
     case CONF_SIZE:
 #if SIZEOF_INT < SIZEOF_SSIZE_T
-       if ((off_t)tokenval.v.size > (off_t)INT_MAX)
+       if ((gint64)tokenval.v.size > (gint64)INT_MAX)
            conf_parserror(_("value too large"));
-       if ((off_t)tokenval.v.size < (off_t)INT_MIN)
+       if ((gint64)tokenval.v.size < (gint64)INT_MIN)
            conf_parserror(_("value too small"));
 #endif
        val = (int)tokenval.v.size;
        break;
 
-    case CONF_AM64:
-#if SIZEOF_INT < SIZEOF_LONG_LONG
-       if (tokenval.v.am64 > (off_t)INT_MAX)
+    case CONF_INT64:
+#if SIZEOF_INT < SIZEOF_GINT64
+       if (tokenval.v.int64 > (gint64)INT_MAX)
            conf_parserror(_("value too large"));
-       if (tokenval.v.am64 < (off_t)INT_MIN)
+       if (tokenval.v.int64 < (gint64)INT_MIN)
            conf_parserror(_("value too small"));
 #endif
-       val = (int)tokenval.v.am64;
+       val = (int)tokenval.v.int64;
        break;
 
     case CONF_AMINFINITY:
@@ -2559,22 +3544,22 @@ get_size(void)
 
     case CONF_INT:
 #if SIZEOF_SIZE_T < SIZEOF_INT
-       if ((off_t)tokenval.v.i > (off_t)SSIZE_MAX)
+       if ((gint64)tokenval.v.i > (gint64)SSIZE_MAX)
            conf_parserror(_("value too large"));
-       if ((off_t)tokenval.v.i < (off_t)SSIZE_MIN)
+       if ((gint64)tokenval.v.i < (gint64)SSIZE_MIN)
            conf_parserror(_("value too small"));
 #endif
        val = (ssize_t)tokenval.v.i;
        break;
 
-    case CONF_AM64:
-#if SIZEOF_SIZE_T < SIZEOF_LONG_LONG
-       if (tokenval.v.am64 > (off_t)SSIZE_MAX)
+    case CONF_INT64:
+#if SIZEOF_SIZE_T < SIZEOF_GINT64
+       if (tokenval.v.int64 > (gint64)SSIZE_MAX)
            conf_parserror(_("value too large"));
-       if (tokenval.v.am64 < (off_t)SSIZE_MIN)
+       if (tokenval.v.int64 < (gint64)SSIZE_MIN)
            conf_parserror(_("value too small"));
 #endif
-       val = (ssize_t)tokenval.v.am64;
+       val = (ssize_t)tokenval.v.int64;
        break;
 
     case CONF_AMINFINITY:
@@ -2629,10 +3614,10 @@ get_size(void)
     return val;
 }
 
-static off_t
-get_am64_t(void)
+static gint64
+get_int64(void)
 {
-    off_t val;
+    gint64 val;
     keytab_t *save_kt;
 
     save_kt = keytable;
@@ -2642,19 +3627,19 @@ get_am64_t(void)
 
     switch(tok) {
     case CONF_INT:
-       val = (off_t)tokenval.v.i;
+       val = (gint64)tokenval.v.i;
        break;
 
     case CONF_SIZE:
-       val = (off_t)tokenval.v.size;
+       val = (gint64)tokenval.v.size;
        break;
 
-    case CONF_AM64:
-       val = tokenval.v.am64;
+    case CONF_INT64:
+       val = tokenval.v.int64;
        break;
 
     case CONF_AMINFINITY:
-       val = AM64_MAX;
+       val = G_MAXINT64;
        break;
 
     default:
@@ -2673,19 +3658,19 @@ get_am64_t(void)
        break;
 
     case CONF_MULT7:
-       if (val > AM64_MAX/7 || val < AM64_MIN/7)
+       if (val > G_MAXINT64/7 || val < ((gint64)G_MININT64)/7)
            conf_parserror(_("value too large"));
        val *= 7;
        break;
 
     case CONF_MULT1M:
-       if (val > AM64_MAX/1024 || val < AM64_MIN/1024)
+       if (val > G_MAXINT64/1024 || val < ((gint64)G_MININT64)/1024)
            conf_parserror(_("value too large"));
        val *= 1024;
        break;
 
     case CONF_MULT1G:
-       if (val > AM64_MAX/(1024*1024) || val < AM64_MIN/(1024*1024))
+       if (val > G_MAXINT64/(1024*1024) || val < ((gint64)G_MININT64)/(1024*1024))
            conf_parserror(_("value too large"));
        val *= 1024*1024;
        break;
@@ -2726,8 +3711,8 @@ get_bool(void)
            val = 0;
        break;
 
-    case CONF_AM64:
-       if (tokenval.v.am64 != (off_t)0)
+    case CONF_INT64:
+       if (tokenval.v.int64 != (gint64)0)
            val = 1;
        else
            val = 0;
@@ -2758,12 +3743,14 @@ get_bool(void)
 
 void
 ckseen(
-    int *seen)
+    seen_t *seen)
 {
-    if (*seen && !allow_overwrites && current_line_num != -2) {
-       conf_parserror(_("duplicate parameter, prev def on line %d"), *seen);
+    if (seen->linenum && !allow_overwrites && current_line_num != -2) {
+       conf_parserror(_("duplicate parameter; previous definition %s:%d"),
+               seen->filename, seen->linenum);
     }
-    *seen = current_line_num;
+    seen->filename = current_filename;
+    seen->linenum = current_line_num;
 }
 
 /* Validation functions */
@@ -2778,8 +3765,8 @@ validate_nonnegative(
        if(val_t__int(val) < 0)
            conf_parserror(_("%s must be nonnegative"), get_token_name(np->token));
        break;
-    case CONFTYPE_AM64:
-       if(val_t__am64(val) < 0)
+    case CONFTYPE_INT64:
+       if(val_t__int64(val) < 0)
            conf_parserror(_("%s must be nonnegative"), get_token_name(np->token));
        break;
     case CONFTYPE_SIZE:
@@ -2801,8 +3788,8 @@ validate_positive(
        if(val_t__int(val) < 1)
            conf_parserror(_("%s must be positive"), get_token_name(np->token));
        break;
-    case CONFTYPE_AM64:
-       if(val_t__am64(val) < 1)
+    case CONFTYPE_INT64:
+       if(val_t__int64(val) < 1)
            conf_parserror(_("%s must be positive"), get_token_name(np->token));
        break;
     case CONFTYPE_TIME:
@@ -2899,7 +3886,7 @@ validate_use(
     struct conf_var_s *np G_GNUC_UNUSED,
     val_t        *val)
 {
-    val_t__am64(val) = am_floor(val_t__am64(val), DISK_BLOCK_KB);
+    val_t__int64(val) = am_floor(val_t__int64(val), DISK_BLOCK_KB);
 }
 
 static void
@@ -2908,14 +3895,14 @@ validate_chunksize(
     val_t        *val)
 {
     /* NOTE: this function modifies the target value (rounding) */
-    if(val_t__am64(val) == 0) {
-       val_t__am64(val) = ((AM64_MAX / 1024) - (2 * DISK_BLOCK_KB));
+    if(val_t__int64(val) == 0) {
+       val_t__int64(val) = ((G_MAXINT64 / 1024) - (2 * DISK_BLOCK_KB));
     }
-    else if(val_t__am64(val) < 0) {
-       conf_parserror(_("Negative chunksize (%lld) is no longer supported"), (long long)val_t__am64(val));
+    else if(val_t__int64(val) < 0) {
+       conf_parserror(_("Negative chunksize (%lld) is no longer supported"), (long long)val_t__int64(val));
     }
-    val_t__am64(val) = am_floor(val_t__am64(val), (off_t)DISK_BLOCK_KB);
-    if (val_t__am64(val) < 2*DISK_BLOCK_KB) {
+    val_t__int64(val) = am_floor(val_t__int64(val), (gint64)DISK_BLOCK_KB);
+    if (val_t__int64(val) < 2*DISK_BLOCK_KB) {
        conf_parserror("chunksize must be at least %dkb", 2*DISK_BLOCK_KB);
     }
 }
@@ -2981,7 +3968,7 @@ validate_unreserved_port_range(
  * Initialization Implementation
  */
 
-gboolean
+cfgerr_level_t
 config_init(
     config_init_flags flags,
     char *arg_config_name)
@@ -3029,9 +4016,12 @@ config_init(
        amfree(config_name);
        config_dir = newstralloc(config_dir, CONFIG_DIR);
     } else {
-       /* ok, then, we won't read anything (for e.g., amrestore) */
+       /* ok, then, we won't read anything (for e.g., amrestore), but
+        * will set up for server-side config_overwrites */
        amfree(config_name);
        amfree(config_dir);
+       keytable = server_keytab;
+       parsetable = server_var;
     }
 
     /* If we have a config_dir, we can try reading something */
@@ -3042,23 +4032,16 @@ config_init(
            config_filename = newvstralloc(config_filename, config_dir, "/amanda.conf", NULL);
        }
 
-       /* try to read the file, and handle parse errors */
-       if (!read_conffile(config_filename, flags & CONFIG_INIT_CLIENT)) {
-           if (flags & CONFIG_INIT_FATAL) {
-               error(_("errors processing config file \"%s\""), config_filename);
-               /* NOTREACHED */
-           } else {
-               g_warning(_("errors processing config file \"%s\" (non-fatal)"), config_filename);
-               return FALSE;
-           }
-       }
+       read_conffile(config_filename,
+               flags & CONFIG_INIT_CLIENT,
+               flags & CONFIG_INIT_CLIENT);
     } else {
        amfree(config_filename);
     }
 
     update_derived_values(flags & CONFIG_INIT_CLIENT);
 
-    return TRUE;
+    return cfgerr_level;
 }
 
 void
@@ -3068,6 +4051,10 @@ config_uninit(void)
     dumptype_t       *dp, *dpnext;
     tapetype_t       *tp, *tpnext;
     interface_t      *ip, *ipnext;
+    application_t *ap, *apnext;
+    pp_script_t   *pp, *ppnext;
+    device_config_t *dc, *dcnext;
+    changer_config_t *cc, *ccnext;
     int               i;
 
     if (!config_initialized) return;
@@ -3112,6 +4099,47 @@ config_uninit(void)
     }
     interface_list = NULL;
 
+    for(ap=application_list; ap != NULL; ap = apnext) {
+       amfree(ap->name);
+       for(i=0; i<INTER_INTER-1; i++) {
+          free_val_t(&ap->value[i]);
+       }
+       apnext = ap->next;
+       amfree(ap);
+    }
+    application_list = NULL;
+
+    for(pp=pp_script_list; pp != NULL; pp = ppnext) {
+       amfree(pp->name);
+       for(i=0; i<INTER_INTER-1; i++) {
+          free_val_t(&pp->value[i]);
+       }
+       ppnext = pp->next;
+       amfree(pp);
+    }
+    pp_script_list = NULL;
+
+    for(dc=device_config_list; dc != NULL; dc = dcnext) {
+       amfree(dc->name);
+       for(i=0; i<INTER_INTER-1; i++) {
+          free_val_t(&dc->value[i]);
+       }
+       dcnext = dc->next;
+       amfree(dc);
+    }
+    device_config_list = NULL;
+
+    for(cc=changer_config_list; cc != NULL; cc = ccnext) {
+       amfree(cc->name);
+       for(i=0; i<INTER_INTER-1; i++) {
+          free_val_t(&cc->value[i]);
+       }
+       ccnext = cc->next;
+       amfree(cc);
+    }
+
+    changer_config_list = NULL;
+
     for(i=0; i<CNF_CNF-1; i++)
        free_val_t(&conf_data[i]);
 
@@ -3123,8 +4151,12 @@ config_uninit(void)
     amfree(config_name);
     amfree(config_dir);
 
+    g_slist_free_full(seen_filenames);
+    seen_filenames = NULL;
+
     config_client = FALSE;
 
+    config_clear_errors();
     config_initialized = FALSE;
 }
 
@@ -3148,7 +4180,9 @@ init_defaults(
     conf_init_str(&conf_data[CNF_MAILTO], "operators");
     conf_init_str(&conf_data[CNF_DUMPUSER], CLIENT_LOGIN);
     conf_init_str(&conf_data[CNF_TAPEDEV], DEFAULT_TAPE_DEVICE);
+    conf_init_str(&conf_data[CNF_RAWTAPEDEV], DEFAULT_TAPE_DEVICE);
     conf_init_proplist(&conf_data[CNF_DEVICE_PROPERTY]);
+    conf_init_proplist(&conf_data[CNF_PROPERTY]);
     conf_init_str(&conf_data[CNF_CHANGERDEV], DEFAULT_CHANGER_DEVICE);
     conf_init_str(&conf_data[CNF_CHANGERFILE], "/usr/adm/amanda/changer-status");
     conf_init_str   (&conf_data[CNF_LABELSTR]             , ".*");
@@ -3165,7 +4199,7 @@ init_defaults(
     conf_init_int      (&conf_data[CNF_INPARALLEL]           , 10);
     conf_init_str   (&conf_data[CNF_DUMPORDER]            , "ttt");
     conf_init_int      (&conf_data[CNF_BUMPPERCENT]          , 0);
-    conf_init_am64     (&conf_data[CNF_BUMPSIZE]             , (off_t)10*1024);
+    conf_init_int64    (&conf_data[CNF_BUMPSIZE]             , (gint64)10*1024);
     conf_init_real     (&conf_data[CNF_BUMPMULT]             , 1.5);
     conf_init_int      (&conf_data[CNF_BUMPDAYS]             , 2);
     conf_init_str   (&conf_data[CNF_TPCHANGER]            , "");
@@ -3177,9 +4211,10 @@ init_defaults(
     conf_init_int      (&conf_data[CNF_TAPEBUFS]             , 20);
     conf_init_size     (&conf_data[CNF_DEVICE_OUTPUT_BUFFER_SIZE], 40*32768);
     conf_init_str   (&conf_data[CNF_PRINTER]              , "");
+    conf_init_str   (&conf_data[CNF_MAILER]               , DEFAULT_MAILER);
     conf_init_bool     (&conf_data[CNF_AUTOFLUSH]            , 0);
     conf_init_int      (&conf_data[CNF_RESERVE]              , 100);
-    conf_init_am64     (&conf_data[CNF_MAXDUMPSIZE]          , (off_t)-1);
+    conf_init_int64    (&conf_data[CNF_MAXDUMPSIZE]          , (gint64)-1);
     conf_init_str   (&conf_data[CNF_COLUMNSPEC]           , "");
     conf_init_bool     (&conf_data[CNF_AMRECOVER_DO_FSF]     , 1);
     conf_init_str   (&conf_data[CNF_AMRECOVER_CHANGER]    , "");
@@ -3227,91 +4262,93 @@ init_defaults(
 #else
     conf_init_intrange (&conf_data[CNF_UNRESERVED_TCP_PORT]  , IPPORT_RESERVED, 65535);
 #endif
+    conf_init_send_amreport (&conf_data[CNF_SEND_AMREPORT_ON], SEND_AMREPORT_ALL);
 
     /* reset internal variables */
-    got_parserror = FALSE;
+    config_clear_errors();
+    cfgerr_level = CFGERR_OK;
     allow_overwrites = 0;
     token_pushed = 0;
 
     /* create some predefined dumptypes for backwards compatability */
     init_dumptype_defaults();
     dpcur.name = stralloc("NO-COMPRESS");
-    dpcur.seen = -1;
+    dpcur.seen.linenum = -1;
     free_val_t(&dpcur.value[DUMPTYPE_COMPRESS]);
     val_t__compress(&dpcur.value[DUMPTYPE_COMPRESS]) = COMP_NONE;
-    val_t__seen(&dpcur.value[DUMPTYPE_COMPRESS]) = -1;
+    val_t__seen(&dpcur.value[DUMPTYPE_COMPRESS]).linenum = -1;
     save_dumptype();
 
     init_dumptype_defaults();
     dpcur.name = stralloc("COMPRESS-FAST");
-    dpcur.seen = -1;
+    dpcur.seen.linenum = -1;
     free_val_t(&dpcur.value[DUMPTYPE_COMPRESS]);
     val_t__compress(&dpcur.value[DUMPTYPE_COMPRESS]) = COMP_FAST;
-    val_t__seen(&dpcur.value[DUMPTYPE_COMPRESS]) = -1;
+    val_t__seen(&dpcur.value[DUMPTYPE_COMPRESS]).linenum = -1;
     save_dumptype();
 
     init_dumptype_defaults();
     dpcur.name = stralloc("COMPRESS-BEST");
-    dpcur.seen = -1;
+    dpcur.seen.linenum = -1;
     free_val_t(&dpcur.value[DUMPTYPE_COMPRESS]);
     val_t__compress(&dpcur.value[DUMPTYPE_COMPRESS]) = COMP_BEST;
-    val_t__seen(&dpcur.value[DUMPTYPE_COMPRESS]) = -1;
+    val_t__seen(&dpcur.value[DUMPTYPE_COMPRESS]).linenum = -1;
     save_dumptype();
 
     init_dumptype_defaults();
     dpcur.name = stralloc("COMPRESS-CUST");
-    dpcur.seen = -1;
+    dpcur.seen.linenum = -1;
     free_val_t(&dpcur.value[DUMPTYPE_COMPRESS]);
     val_t__compress(&dpcur.value[DUMPTYPE_COMPRESS]) = COMP_CUST;
-    val_t__seen(&dpcur.value[DUMPTYPE_COMPRESS]) = -1;
+    val_t__seen(&dpcur.value[DUMPTYPE_COMPRESS]).linenum = -1;
     save_dumptype();
 
     init_dumptype_defaults();
     dpcur.name = stralloc("SRVCOMPRESS");
-    dpcur.seen = -1;
+    dpcur.seen.linenum = -1;
     free_val_t(&dpcur.value[DUMPTYPE_COMPRESS]);
     val_t__compress(&dpcur.value[DUMPTYPE_COMPRESS]) = COMP_SERVER_FAST;
-    val_t__seen(&dpcur.value[DUMPTYPE_COMPRESS]) = -1;
+    val_t__seen(&dpcur.value[DUMPTYPE_COMPRESS]).linenum = -1;
     save_dumptype();
 
     init_dumptype_defaults();
     dpcur.name = stralloc("BSD-AUTH");
-    dpcur.seen = -1;
+    dpcur.seen.linenum = -1;
     free_val_t(&dpcur.value[DUMPTYPE_SECURITY_DRIVER]);
     val_t__str(&dpcur.value[DUMPTYPE_SECURITY_DRIVER]) = stralloc("BSD");
-    val_t__seen(&dpcur.value[DUMPTYPE_SECURITY_DRIVER]) = -1;
+    val_t__seen(&dpcur.value[DUMPTYPE_SECURITY_DRIVER]).linenum = -1;
     save_dumptype();
 
     init_dumptype_defaults();
     dpcur.name = stralloc("KRB4-AUTH");
-    dpcur.seen = -1;
+    dpcur.seen.linenum = -1;
     free_val_t(&dpcur.value[DUMPTYPE_SECURITY_DRIVER]);
     val_t__str(&dpcur.value[DUMPTYPE_SECURITY_DRIVER]) = stralloc("KRB4");
-    val_t__seen(&dpcur.value[DUMPTYPE_SECURITY_DRIVER]) = -1;
+    val_t__seen(&dpcur.value[DUMPTYPE_SECURITY_DRIVER]).linenum = -1;
     save_dumptype();
 
     init_dumptype_defaults();
     dpcur.name = stralloc("NO-RECORD");
-    dpcur.seen = -1;
+    dpcur.seen.linenum = -1;
     free_val_t(&dpcur.value[DUMPTYPE_RECORD]);
     val_t__int(&dpcur.value[DUMPTYPE_RECORD]) = 0;
-    val_t__seen(&dpcur.value[DUMPTYPE_RECORD]) = -1;
+    val_t__seen(&dpcur.value[DUMPTYPE_RECORD]).linenum = -1;
     save_dumptype();
 
     init_dumptype_defaults();
     dpcur.name = stralloc("NO-HOLD");
-    dpcur.seen = -1;
+    dpcur.seen.linenum = -1;
     free_val_t(&dpcur.value[DUMPTYPE_HOLDINGDISK]);
     val_t__holding(&dpcur.value[DUMPTYPE_HOLDINGDISK]) = HOLD_NEVER;
-    val_t__seen(&dpcur.value[DUMPTYPE_HOLDINGDISK]) = -1;
+    val_t__seen(&dpcur.value[DUMPTYPE_HOLDINGDISK]).linenum = -1;
     save_dumptype();
 
     init_dumptype_defaults();
     dpcur.name = stralloc("NO-FULL");
-    dpcur.seen = -1;
+    dpcur.seen.linenum = -1;
     free_val_t(&dpcur.value[DUMPTYPE_STRATEGY]);
     val_t__strategy(&dpcur.value[DUMPTYPE_STRATEGY]) = DS_NOFULL;
-    val_t__seen(&dpcur.value[DUMPTYPE_STRATEGY]) = -1;
+    val_t__seen(&dpcur.value[DUMPTYPE_STRATEGY]).linenum = -1;
     save_dumptype();
 
     /* And we're initialized! */
@@ -3356,7 +4393,7 @@ update_derived_values(
        if (!(ip = lookup_interface("default"))) {
            init_interface_defaults();
            ifcur.name = stralloc("default");
-           ifcur.seen = getconf_seen(CNF_NETUSAGE);
+           ifcur.seen = val_t__seen(getconf(CNF_NETUSAGE));
            save_interface();
 
            ip = lookup_interface("default");
@@ -3369,12 +4406,12 @@ update_derived_values(
            v = interface_getconf(ip, INTER_COMMENT);
            free_val_t(v);
            val_t__str(v) = stralloc(_("implicit from NETUSAGE"));
-           val_t__seen(v) = getconf_seen(CNF_NETUSAGE);
+           val_t__seen(v) = val_t__seen(getconf(CNF_NETUSAGE));
 
            v = interface_getconf(ip, INTER_MAXUSAGE);
            free_val_t(v);
            val_t__int(v) = getconf_int(CNF_NETUSAGE);
-           val_t__seen(v) = getconf_seen(CNF_NETUSAGE);
+           val_t__seen(v) = val_t__seen(getconf(CNF_NETUSAGE));
        }
 
        /* Check the tapetype is defined */
@@ -3385,7 +4422,7 @@ update_derived_values(
                !lookup_tapetype("EXABYTE")) {
                init_tapetype_defaults();
                tpcur.name = stralloc("EXABYTE");
-               tpcur.seen = -1;
+               tpcur.seen = val_t__seen(getconf(CNF_TAPETYPE));
                save_tapetype();
            } else {
                conf_parserror(_("tapetype %s is not defined"),
@@ -3445,19 +4482,21 @@ conf_init_int(
     val_t *val,
     int    i)
 {
-    val->seen = 0;
+    val->seen.linenum = 0;
+    val->seen.filename = NULL;
     val->type = CONFTYPE_INT;
     val_t__int(val) = i;
 }
 
 static void
-conf_init_am64(
+conf_init_int64(
     val_t *val,
-    off_t   l)
+    gint64   l)
 {
-    val->seen = 0;
-    val->type = CONFTYPE_AM64;
-    val_t__am64(val) = l;
+    val->seen.linenum = 0;
+    val->seen.filename = NULL;
+    val->type = CONFTYPE_INT64;
+    val_t__int64(val) = l;
 }
 
 static void
@@ -3465,7 +4504,8 @@ conf_init_real(
     val_t  *val,
     float r)
 {
-    val->seen = 0;
+    val->seen.linenum = 0;
+    val->seen.filename = NULL;
     val->type = CONFTYPE_REAL;
     val_t__real(val) = r;
 }
@@ -3475,7 +4515,8 @@ conf_init_str(
     val_t *val,
     char  *s)
 {
-    val->seen = 0;
+    val->seen.linenum = 0;
+    val->seen.filename = NULL;
     val->type = CONFTYPE_STR;
     if(s)
        val->v.s = stralloc(s);
@@ -3488,7 +4529,8 @@ conf_init_ident(
     val_t *val,
     char  *s)
 {
-    val->seen = 0;
+    val->seen.linenum = 0;
+    val->seen.filename = NULL;
     val->type = CONFTYPE_IDENT;
     if(s)
        val->v.s = stralloc(s);
@@ -3501,7 +4543,8 @@ conf_init_time(
     val_t *val,
     time_t   t)
 {
-    val->seen = 0;
+    val->seen.linenum = 0;
+    val->seen.filename = NULL;
     val->type = CONFTYPE_TIME;
     val_t__time(val) = t;
 }
@@ -3511,7 +4554,8 @@ conf_init_size(
     val_t *val,
     ssize_t   sz)
 {
-    val->seen = 0;
+    val->seen.linenum = 0;
+    val->seen.filename = NULL;
     val->type = CONFTYPE_SIZE;
     val_t__size(val) = sz;
 }
@@ -3521,7 +4565,8 @@ conf_init_bool(
     val_t *val,
     int    i)
 {
-    val->seen = 0;
+    val->seen.linenum = 0;
+    val->seen.filename = NULL;
     val->type = CONFTYPE_BOOLEAN;
     val_t__boolean(val) = i;
 }
@@ -3531,7 +4576,8 @@ conf_init_compress(
     val_t *val,
     comp_t    i)
 {
-    val->seen = 0;
+    val->seen.linenum = 0;
+    val->seen.filename = NULL;
     val->type = CONFTYPE_COMPRESS;
     val_t__compress(val) = (int)i;
 }
@@ -3541,7 +4587,8 @@ conf_init_encrypt(
     val_t *val,
     encrypt_t    i)
 {
-    val->seen = 0;
+    val->seen.linenum = 0;
+    val->seen.filename = NULL;
     val->type = CONFTYPE_ENCRYPT;
     val_t__encrypt(val) = (int)i;
 }
@@ -3551,7 +4598,8 @@ conf_init_holding(
     val_t              *val,
     dump_holdingdisk_t  i)
 {
-    val->seen = 0;
+    val->seen.linenum = 0;
+    val->seen.filename = NULL;
     val->type = CONFTYPE_HOLDING;
     val_t__holding(val) = (int)i;
 }
@@ -3561,7 +4609,8 @@ conf_init_estimate(
     val_t *val,
     estimate_t    i)
 {
-    val->seen = 0;
+    val->seen.linenum = 0;
+    val->seen.filename = NULL;
     val->type = CONFTYPE_ESTIMATE;
     val_t__estimate(val) = i;
 }
@@ -3571,7 +4620,8 @@ conf_init_strategy(
     val_t *val,
     strategy_t    i)
 {
-    val->seen = 0;
+    val->seen.linenum = 0;
+    val->seen.filename = NULL;
     val->type = CONFTYPE_STRATEGY;
     val_t__strategy(val) = i;
 }
@@ -3581,7 +4631,8 @@ conf_init_taperalgo(
     val_t *val,
     taperalgo_t    i)
 {
-    val->seen = 0;
+    val->seen.linenum = 0;
+    val->seen.filename = NULL;
     val->type = CONFTYPE_TAPERALGO;
     val_t__taperalgo(val) = i;
 }
@@ -3591,7 +4642,8 @@ conf_init_priority(
     val_t *val,
     int    i)
 {
-    val->seen = 0;
+    val->seen.linenum = 0;
+    val->seen.filename = NULL;
     val->type = CONFTYPE_PRIORITY;
     val_t__priority(val) = i;
 }
@@ -3602,7 +4654,8 @@ conf_init_rate(
     float r1,
     float r2)
 {
-    val->seen = 0;
+    val->seen.linenum = 0;
+    val->seen.filename = NULL;
     val->type = CONFTYPE_RATE;
     val_t__rate(val)[0] = r1;
     val_t__rate(val)[1] = r2;
@@ -3612,7 +4665,8 @@ static void
 conf_init_exinclude(
     val_t *val)
 {
-    val->seen = 0;
+    val->seen.linenum = 0;
+    val->seen.filename = NULL;
     val->type = CONFTYPE_EXINCLUDE;
     val_t__exinclude(val).optional = 0;
     val_t__exinclude(val).sl_list = NULL;
@@ -3625,7 +4679,8 @@ conf_init_intrange(
     int    i1,
     int    i2)
 {
-    val->seen = 0;
+    val->seen.linenum = 0;
+    val->seen.filename = NULL;
     val->type = CONFTYPE_INTRANGE;
     val_t__intrange(val)[0] = i1;
     val_t__intrange(val)[1] = i2;
@@ -3635,12 +4690,61 @@ static void
 conf_init_proplist(
     val_t *val)
 {
-    val->seen = 0;
+    val->seen.linenum = 0;
+    val->seen.filename = NULL;
     val->type = CONFTYPE_PROPLIST;
     val_t__proplist(val) =
-        g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
+        g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL);
+}
+
+static void
+conf_init_execute_on(
+    val_t *val,
+    int    i)
+{
+    val->seen.linenum = 0;
+    val->seen.filename = NULL;
+    val->type = CONFTYPE_EXECUTE_ON;
+    val->v.i = i;
+}
+
+static void
+conf_init_execute_where(
+    val_t *val,
+    int    i)
+{
+    val->seen.linenum = 0;
+    val->seen.filename = NULL;
+    val->type = CONFTYPE_EXECUTE_WHERE;
+    val->v.i = i;
+}
+
+static void
+conf_init_send_amreport(
+    val_t *val,
+    send_amreport_t i)
+{
+    val->seen.linenum = 0;
+    val->seen.filename = NULL;
+    val->type = CONFTYPE_SEND_AMREPORT_ON;
+    val->v.i = i;
+}
+
+static void conf_init_pp_scriptlist(val_t *val) {
+    val->seen.linenum = 0;
+    val->seen.filename = NULL;
+    val->type = CONFTYPE_PP_SCRIPTLIST;
+    val->v.proplist = NULL;
+}
+
+static void conf_init_application(val_t *val) {
+    val->seen.linenum = 0;
+    val->seen.filename = NULL;
+    val->type = CONFTYPE_APPLICATION;
+    val->v.application = NULL;
 }
 
+
 /*
  * Config access implementation
  */
@@ -3660,6 +4764,10 @@ getconf_list(
     dumptype_t *dp;
     interface_t *ip;
     holdingdisk_t *hp;
+    application_t *ap;
+    pp_script_t   *pp;
+    device_config_t *dc;
+    changer_config_t *cc;
     GSList *rv = NULL;
 
     if (strcasecmp(listname,"tapetype") == 0) {
@@ -3678,6 +4786,24 @@ getconf_list(
        for(ip = interface_list; ip != NULL; ip=ip->next) {
            rv = g_slist_append(rv, ip->name);
        }
+    } else if (strcasecmp(listname,"application_tool") == 0
+           || strcasecmp(listname,"application-tool") == 0) {
+       for(ap = application_list; ap != NULL; ap=ap->next) {
+           rv = g_slist_append(rv, ap->name);
+       }
+    } else if (strcasecmp(listname,"script_tool") == 0
+           || strcasecmp(listname,"script-tool") == 0) {
+       for(pp = pp_script_list; pp != NULL; pp=pp->next) {
+           rv = g_slist_append(rv, pp->name);
+       }
+    } else if (strcasecmp(listname,"device") == 0) {
+       for(dc = device_config_list; dc != NULL; dc=dc->next) {
+           rv = g_slist_append(rv, dc->name);
+       }
+    } else if (strcasecmp(listname,"changer") == 0) {
+       for(cc = changer_config_list; cc != NULL; cc=cc->next) {
+           rv = g_slist_append(rv, cc->name);
+       }
     }
     return rv;
 }
@@ -3716,6 +4842,19 @@ tapetype_getconf(
     return &ttyp->value[key];
 }
 
+static void
+validate_program(
+    conf_var_t *np G_GNUC_UNUSED,
+    val_t        *val)
+{
+    if (strcmp(val->v.s, "DUMP") != 0 &&
+       strcmp(val->v.s, "GNUTAR") != 0 &&
+       strcmp(val->v.s, "STAR") != 0 &&
+       strcmp(val->v.s, "APPLICATION") != 0)
+       conf_parserror("program must be \"DUMP\", \"GNUTAR\", \"STAR\" or \"APPLICATION\"");
+}
+
+
 char *
 tapetype_name(
     tapetype_t *ttyp)
@@ -3829,6 +4968,126 @@ holdingdisk_name(
     return hdisk->name;
 }
 
+application_t *
+lookup_application(
+    char *str)
+{
+    application_t *p;
+
+    for(p = application_list; p != NULL; p = p->next) {
+       if(strcasecmp(p->name, str) == 0) return p;
+    }
+    return NULL;
+}
+
+val_t *
+application_getconf(
+    application_t *ap,
+    application_key key)
+{
+    assert(ap != NULL);
+    assert(key < APPLICATION_APPLICATION);
+    return &ap->value[key];
+}
+
+char *
+application_name(
+    application_t *ap)
+{
+    assert(ap != NULL);
+    return ap->name;
+}
+
+pp_script_t *
+lookup_pp_script(
+    char *str)
+{
+    pp_script_t *pps;
+
+    for(pps = pp_script_list; pps != NULL; pps = pps->next) {
+       if(strcasecmp(pps->name, str) == 0) return pps;
+    }
+    return NULL;
+}
+
+val_t *
+pp_script_getconf(
+    pp_script_t *pps,
+    pp_script_key key)
+{
+    assert(pps != NULL);
+    assert(key < PP_SCRIPT_PP_SCRIPT);
+    return &pps->value[key];
+}
+
+char *
+pp_script_name(
+    pp_script_t *pps)
+{
+    assert(pps != NULL);
+    return pps->name;
+}
+
+device_config_t *
+lookup_device_config(
+    char *str)
+{
+    device_config_t *devconf;
+
+    for(devconf = device_config_list; devconf != NULL; devconf = devconf->next) {
+       if(strcasecmp(devconf->name, str) == 0) return devconf;
+    }
+    return NULL;
+}
+
+val_t *
+device_config_getconf(
+    device_config_t *devconf,
+    device_config_key key)
+{
+    assert(devconf != NULL);
+    assert(key < DEVICE_CONFIG_DEVICE_CONFIG);
+    return &devconf->value[key];
+}
+
+char *
+device_config_name(
+    device_config_t *devconf)
+{
+    assert(devconf != NULL);
+    return devconf->name;
+}
+
+changer_config_t *
+lookup_changer_config(
+    char *str)
+{
+    changer_config_t *devconf;
+
+    for(devconf = changer_config_list; devconf != NULL; devconf = devconf->next) {
+       if(strcasecmp(devconf->name, str) == 0) return devconf;
+    }
+    return NULL;
+}
+
+val_t *
+changer_config_getconf(
+    changer_config_t *devconf,
+    changer_config_key key)
+{
+    assert(devconf != NULL);
+    assert(key < CHANGER_CONFIG_CHANGER_CONFIG);
+    return &devconf->value[key];
+}
+
+char *
+changer_config_name(
+    changer_config_t *devconf)
+{
+    assert(devconf != NULL);
+    return devconf->name;
+}
+
 long int
 getconf_unit_divisor(void)
 {
@@ -3845,6 +5104,9 @@ new_config_overwrites(
 {
     config_overwrites_t *co;
 
+    if (size_estimate <= 0)
+       size_estimate = 10;
+
     co = alloc(sizeof(*co));
     co->ovr = alloc(sizeof(*co->ovr) * size_estimate);
     co->n_allocated = size_estimate;
@@ -3941,13 +5203,13 @@ extract_commandline_config_overwrites(
     return co;
 }
 
-void
+cfgerr_level_t
 apply_config_overwrites(
     config_overwrites_t *co)
 {
     int i;
 
-    if(!co) return;
+    if(!co) return cfgerr_level;
     assert(keytable != NULL);
     assert(parsetable != NULL);
 
@@ -3958,7 +5220,8 @@ apply_config_overwrites(
        conf_var_t *key_parm;
 
        if (!parm_key_info(key, &key_parm, &key_val)) {
-           error(_("unknown parameter '%s'"), key);
+           conf_parserror(_("unknown parameter '%s'"), key);
+           continue;
        }
 
        /* now set up a fake line and use the relevant read_function to
@@ -3974,7 +5237,6 @@ apply_config_overwrites(
        token_pushed = 0;
        current_line_num = -2;
        allow_overwrites = 1;
-       got_parserror = 0;
 
        key_parm->read_function(key_parm, key_val);
        if ((key_parm)->validate_function)
@@ -3982,11 +5244,6 @@ apply_config_overwrites(
 
        amfree(current_line);
        current_char = NULL;
-
-       if (got_parserror) {
-           error(_("parse error in configuration overwrites"));
-           /* NOTREACHED */
-       }
     }
 
     /* merge these overwrites with previous overwrites, if necessary */
@@ -4003,6 +5260,8 @@ apply_config_overwrites(
     }
 
     update_derived_values(config_client);
+
+    return cfgerr_level;
 }
 
 /*
@@ -4020,15 +5279,15 @@ val_t_to_int(
     return val_t__int(val);
 }
 
-off_t
-val_t_to_am64(
+gint64
+val_t_to_int64(
     val_t *val)
 {
-    if (val->type != CONFTYPE_AM64) {
-       error(_("val_t_to_am64: val.type is not CONFTYPE_AM64"));
+    if (val->type != CONFTYPE_INT64) {
+       error(_("val_t_to_int64: val.type is not CONFTYPE_INT64"));
        /*NOTREACHED*/
     }
-    return val_t__am64(val);
+    return val_t__int64(val);
 }
 
 float
@@ -4137,7 +5396,7 @@ val_t_to_estimate(
     val_t *val)
 {
     if (val->type != CONFTYPE_ESTIMATE) {
-       error(_("val_t_to_extimate: val.type is not CONFTYPE_ESTIMATE"));
+       error(_("val_t_to_estimate: val.type is not CONFTYPE_ESTIMATE"));
        /*NOTREACHED*/
     }
     return val_t__estimate(val);
@@ -4162,7 +5421,18 @@ val_t_to_taperalgo(
        error(_("val_t_to_taperalgo: val.type is not CONFTYPE_TAPERALGO"));
        /*NOTREACHED*/
     }
-    return val_t__taperalgo(val);
+    return val_t__taperalgo(val);
+}
+
+send_amreport_t
+val_t_to_send_amreport(
+    val_t *val)
+{
+    if (val->type != CONFTYPE_SEND_AMREPORT_ON) {
+       error(_("val_t_to_send_amreport: val.type is not CONFTYPE_SEND_AMREPORT_ON"));
+       /*NOTREACHED*/
+    }
+    return val_t__send_amreport(val);
 }
 
 int
@@ -4226,7 +5496,7 @@ copy_val_t(
     val_t *valdst,
     val_t *valsrc)
 {
-    if(valsrc->seen) {
+    if(valsrc->seen.linenum) {
        valdst->type = valsrc->type;
        valdst->seen = valsrc->seen;
        switch(valsrc->type) {
@@ -4236,6 +5506,9 @@ copy_val_t(
        case CONFTYPE_ENCRYPT:
        case CONFTYPE_HOLDING:
        case CONFTYPE_ESTIMATE:
+       case CONFTYPE_EXECUTE_ON:
+       case CONFTYPE_EXECUTE_WHERE:
+       case CONFTYPE_SEND_AMREPORT_ON:
        case CONFTYPE_STRATEGY:
        case CONFTYPE_TAPERALGO:
        case CONFTYPE_PRIORITY:
@@ -4246,8 +5519,8 @@ copy_val_t(
            valdst->v.size = valsrc->v.size;
            break;
 
-       case CONFTYPE_AM64:
-           valdst->v.am64 = valsrc->v.am64;
+       case CONFTYPE_INT64:
+           valdst->v.int64 = valsrc->v.int64;
            break;
 
        case CONFTYPE_REAL:
@@ -4280,12 +5553,66 @@ copy_val_t(
            break;
 
         case CONFTYPE_PROPLIST:
-            g_assert_not_reached();
-            break;
+           if (valsrc->v.proplist) {
+               valdst->v.proplist = g_hash_table_new_full(g_str_hash,
+                                                          g_str_equal,
+                                                          NULL, NULL);
+
+               g_hash_table_foreach(valsrc->v.proplist, &copy_proplist,
+                                    valdst->v.proplist);
+           } else {
+               valdst->v.proplist = NULL;
+           }
+           break;
+
+       case CONFTYPE_PP_SCRIPTLIST:
+           valdst->v.pp_scriptlist = NULL;
+           if (valsrc->v.pp_scriptlist) {
+               g_slist_foreach(valsrc->v.pp_scriptlist, &copy_pp_scriptlist,
+                               valdst->v.pp_scriptlist);
+           }
+           break;
+
+       case CONFTYPE_APPLICATION:
+           valdst->v.application = valsrc->v.application;
+           break;
        }
     }
 }
 
+static void
+copy_proplist(
+    gpointer key_p,
+    gpointer value_p,
+    gpointer user_data_p)
+{
+    char *property_s = key_p;
+    property_t *property = value_p;
+    proplist_t proplist = user_data_p;
+    GSList *elem = NULL;
+    property_t *new_property = malloc(sizeof(property_t));
+    new_property->append = property->append;
+    new_property->priority = property->priority;
+    new_property->values = NULL;
+
+    for(elem = property->values;elem != NULL; elem=elem->next) {
+       new_property->values = g_slist_append(new_property->values,
+                                             stralloc(elem->data));
+    }
+    g_hash_table_insert(proplist, property_s, new_property);
+}
+
+static void
+copy_pp_scriptlist(
+    gpointer data_p,
+    gpointer user_data_p)
+{
+    pp_script_t *pp_script   = data_p;
+    pp_scriptlist_t pp_scriptlist = user_data_p;
+
+    pp_scriptlist = g_slist_append(pp_scriptlist, pp_script);
+}
+
 static void
 free_val_t(
     val_t *val)
@@ -4297,11 +5624,14 @@ free_val_t(
        case CONFTYPE_ENCRYPT:
        case CONFTYPE_HOLDING:
        case CONFTYPE_ESTIMATE:
+       case CONFTYPE_EXECUTE_WHERE:
+       case CONFTYPE_EXECUTE_ON:
+       case CONFTYPE_SEND_AMREPORT_ON:
        case CONFTYPE_STRATEGY:
        case CONFTYPE_SIZE:
        case CONFTYPE_TAPERALGO:
        case CONFTYPE_PRIORITY:
-       case CONFTYPE_AM64:
+       case CONFTYPE_INT64:
        case CONFTYPE_REAL:
        case CONFTYPE_RATE:
        case CONFTYPE_INTRANGE:
@@ -4323,8 +5653,16 @@ free_val_t(
         case CONFTYPE_PROPLIST:
             g_hash_table_destroy(val_t__proplist(val));
             break;
+
+       case CONFTYPE_PP_SCRIPTLIST:
+           g_slist_free_full(val->v.pp_scriptlist);
+           break;
+
+       case CONFTYPE_APPLICATION:
+           break;
     }
-    val->seen = 0;
+    val->seen.linenum = 0;
+    val->seen.filename = NULL;
 }
 
 /*
@@ -4393,6 +5731,10 @@ dump_configuration(void)
     dumptype_t *dp;
     interface_t *ip;
     holdingdisk_t *hp;
+    application_t *ap;
+    pp_script_t *ps;
+    device_config_t *dc;
+    changer_config_t *cc;
     int i;
     conf_var_t *np;
     keytab_t *kt;
@@ -4438,7 +5780,7 @@ dump_configuration(void)
     }
 
     for(tp = tapelist; tp != NULL; tp = tp->next) {
-       if(tp->seen == -1)
+       if(tp->seen.linenum == -1)
            prefix = "#";
        else
            prefix = "";
@@ -4461,7 +5803,7 @@ dump_configuration(void)
 
     for(dp = dumplist; dp != NULL; dp = dp->next) {
        if (strncmp_const(dp->name, "custom(") != 0) { /* don't dump disklist-derived dumptypes */
-           if(dp->seen == -1)
+           if(dp->seen.linenum == -1)
                prefix = "#";
            else
                prefix = "";
@@ -4484,7 +5826,10 @@ dump_configuration(void)
     }
 
     for(ip = interface_list; ip != NULL; ip = ip->next) {
-       if(strcmp(ip->name,"default") == 0)
+       seen_t *netusage_seen = &val_t__seen(getconf(CNF_NETUSAGE));
+       if (ip->seen.linenum == netusage_seen->linenum &&
+           ip->seen.filename && netusage_seen->filename &&
+           0 == strcmp(ip->seen.filename, netusage_seen->filename))
            prefix = "#";
        else
            prefix = "";
@@ -4505,6 +5850,87 @@ dump_configuration(void)
        g_printf("%s}\n",prefix);
     }
 
+    for(ap = application_list; ap != NULL; ap = ap->next) {
+       if(strcmp(ap->name,"default") == 0)
+           prefix = "#";
+       else
+           prefix = "";
+       g_printf("\n%sDEFINE APPLICATION-TOOL %s {\n", prefix, ap->name);
+       for(i=0; i < APPLICATION_APPLICATION; i++) {
+           for(np=application_var; np->token != CONF_UNKNOWN; np++)
+               if(np->parm == i) break;
+           if(np->token == CONF_UNKNOWN)
+               error(_("application-tool bad value"));
+
+           for(kt = server_keytab; kt->token != CONF_UNKNOWN; kt++)
+               if(kt->token == np->token) break;
+           if(kt->token == CONF_UNKNOWN)
+               error(_("application bad token"));
+
+           val_t_print_token(stdout, prefix, "      %-19s ", kt, &ap->value[i]);
+       }
+       g_printf("%s}\n",prefix);
+    }
+
+    for(ps = pp_script_list; ps != NULL; ps = ps->next) {
+       if(strcmp(ps->name,"default") == 0)
+           prefix = "#";
+       else
+           prefix = "";
+       g_printf("\n%sDEFINE SCRIPT-TOOL %s {\n", prefix, ps->name);
+       for(i=0; i < PP_SCRIPT_PP_SCRIPT; i++) {
+           for(np=pp_script_var; np->token != CONF_UNKNOWN; np++)
+               if(np->parm == i) break;
+           if(np->token == CONF_UNKNOWN)
+               error(_("script-tool bad value"));
+
+           for(kt = server_keytab; kt->token != CONF_UNKNOWN; kt++)
+               if(kt->token == np->token) break;
+           if(kt->token == CONF_UNKNOWN)
+               error(_("script bad token"));
+
+           val_t_print_token(stdout, prefix, "      %-19s ", kt, &ps->value[i]);
+       }
+       g_printf("%s}\n",prefix);
+    }
+
+    for(dc = device_config_list; dc != NULL; dc = dc->next) {
+       prefix = "";
+       g_printf("\n%sDEFINE DEVICE %s {\n", prefix, dc->name);
+       for(i=0; i < DEVICE_CONFIG_DEVICE_CONFIG; i++) {
+           for(np=device_config_var; np->token != CONF_UNKNOWN; np++)
+               if(np->parm == i) break;
+           if(np->token == CONF_UNKNOWN)
+               error(_("device bad value"));
+
+           for(kt = server_keytab; kt->token != CONF_UNKNOWN; kt++)
+               if(kt->token == np->token) break;
+           if(kt->token == CONF_UNKNOWN)
+               error(_("device bad token"));
+
+           val_t_print_token(stdout, prefix, "      %-19s ", kt, &dc->value[i]);
+       }
+       g_printf("%s}\n",prefix);
+    }
+
+    for(cc = changer_config_list; cc != NULL; cc = cc->next) {
+       prefix = "";
+       g_printf("\n%sDEFINE CHANGER %s {\n", prefix, cc->name);
+       for(i=0; i < CHANGER_CONFIG_CHANGER_CONFIG; i++) {
+           for(np=changer_config_var; np->token != CONF_UNKNOWN; np++)
+               if(np->parm == i) break;
+           if(np->token == CONF_UNKNOWN)
+               error(_("changer bad value"));
+
+           for(kt = server_keytab; kt->token != CONF_UNKNOWN; kt++)
+               if(kt->token == np->token) break;
+           if(kt->token == CONF_UNKNOWN)
+               error(_("changer bad token"));
+
+           val_t_print_token(stdout, prefix, "      %-19s ", kt, &cc->value[i]);
+       }
+       g_printf("%s}\n",prefix);
+    }
 }
 
 static void
@@ -4563,8 +5989,8 @@ val_t_display_strs(
        buf[0] = vstrallocf("%zd", (ssize_t)val_t__size(val));
        break;
 
-    case CONFTYPE_AM64:
-       buf[0] = vstrallocf("%lld", (long long)val_t__am64(val));
+    case CONFTYPE_INT64:
+       buf[0] = vstrallocf("%lld", (long long)val_t__int64(val));
        break;
 
     case CONFTYPE_REAL:
@@ -4697,6 +6123,35 @@ val_t_display_strs(
        }
        break;
 
+    case CONFTYPE_EXECUTE_WHERE:
+       switch(val->v.i) {
+       case ES_CLIENT:
+           buf[0] = vstrallocf("CLIENT");
+           break;
+
+       case ES_SERVER:
+           buf[0] = vstrallocf("SERVER");
+           break;
+       }
+       break;
+
+    case CONFTYPE_SEND_AMREPORT_ON:
+       switch(val->v.i) {
+       case SEND_AMREPORT_ALL:
+           buf[0] = vstrallocf("ALL");
+           break;
+       case SEND_AMREPORT_STRANGE:
+           buf[0] = vstrallocf("STRANGE");
+           break;
+       case SEND_AMREPORT_ERROR:
+           buf[0] = vstrallocf("ERROR");
+           break;
+       case SEND_AMREPORT_NEVER:
+           buf[0] = vstrallocf("NEVER");
+           break;
+       }
+       break;
+
      case CONFTYPE_ENCRYPT:
        switch(val_t__encrypt(val)) {
        case ENCRYPT_NONE:
@@ -4758,27 +6213,197 @@ val_t_display_strs(
        buf = malloc((nb_property+1)*SIZEOF(char*));
        buf[nb_property] = NULL;
        mybuf = buf;
-       g_hash_table_foreach(val_t__proplist(val), proplist_display_str_foreach_fn, &mybuf);
+       g_hash_table_foreach(val_t__proplist(val),
+                            proplist_display_str_foreach_fn,
+                            &mybuf);
+        break;
+    }
+
+    case CONFTYPE_PP_SCRIPTLIST: {
+       int    nb_pp_scriplist;
+       char **mybuf;
+
+       nb_pp_scriplist = g_slist_length(val_t__pp_scriptlist(val));
+       amfree(buf);
+       buf = malloc((nb_pp_scriplist+1)*SIZEOF(char*));
+       buf[nb_pp_scriplist] = NULL;
+       mybuf = buf;
+       g_slist_foreach(val_t__pp_scriptlist(val),
+                       pp_scriptlist_display_str_foreach_fn,
+                       &mybuf);
         break;
     }
+
+    case CONFTYPE_APPLICATION: {
+       if (val->v.application) {
+           buf[0] = vstrallocf("\"%s\"", val->v.application->name);
+       } else {
+           buf[0] = stralloc("");
+       }
+       break;
+    }
+
+    case CONFTYPE_EXECUTE_ON:
+       buf[0] = stralloc("");
+       if (val->v.i != 0) {
+           char *sep = "";
+           if (val->v.i & EXECUTE_ON_PRE_DLE_AMCHECK) {
+               buf[0] = vstrextend(&buf[0], sep, "PRE-DLE-AMCHECK", NULL);
+               sep = ", ";
+           }
+           if (val->v.i & EXECUTE_ON_PRE_HOST_AMCHECK) {
+               buf[0] = vstrextend(&buf[0], sep, "PRE-HOST-AMCHECK", NULL);
+               sep = ", ";
+           }
+           if (val->v.i & EXECUTE_ON_POST_DLE_AMCHECK) {
+               buf[0] = vstrextend(&buf[0], sep, "POST-DLE-AMCHECK", NULL);
+               sep = ", ";
+           }
+           if (val->v.i & EXECUTE_ON_POST_HOST_AMCHECK) {
+               buf[0] = vstrextend(&buf[0], sep, "POST-HOST-AMCHECK", NULL);
+               sep = ", ";
+           }
+           if (val->v.i & EXECUTE_ON_PRE_DLE_ESTIMATE) {
+               buf[0] = vstrextend(&buf[0], sep, "PRE-DLE-ESTIMATE", NULL);
+               sep = ", ";
+           }
+           if (val->v.i & EXECUTE_ON_PRE_HOST_ESTIMATE) {
+               buf[0] = vstrextend(&buf[0], sep, "PRE-HOST-ESTIMATE", NULL);
+               sep = ", ";
+           }
+           if (val->v.i & EXECUTE_ON_POST_DLE_ESTIMATE) {
+               buf[0] = vstrextend(&buf[0], sep, "POST-DLE-ESTIMATE", NULL);
+               sep = ", ";
+           }
+           if (val->v.i & EXECUTE_ON_POST_HOST_ESTIMATE) {
+               buf[0] = vstrextend(&buf[0], sep, "POST-HOST-ESTIMATE", NULL);
+               sep = ", ";
+           }
+           if (val->v.i & EXECUTE_ON_PRE_DLE_BACKUP) {
+               buf[0] = vstrextend(&buf[0], sep, "PRE-DLE-BACKUP", NULL);
+               sep = ", ";
+           }
+           if (val->v.i & EXECUTE_ON_PRE_HOST_BACKUP) {
+               buf[0] = vstrextend(&buf[0], sep, "PRE-HOST-BACKUP", NULL);
+               sep = ", ";
+           }
+           if (val->v.i & EXECUTE_ON_POST_DLE_BACKUP) {
+               buf[0] = vstrextend(&buf[0], sep, "POST-DLE-BACKUP", NULL);
+               sep = ", ";
+           }
+           if (val->v.i & EXECUTE_ON_POST_HOST_BACKUP) {
+               buf[0] = vstrextend(&buf[0], sep, "POST-HOST-BACKUP", NULL);
+               sep = ", ";
+           }
+           if (val->v.i & EXECUTE_ON_PRE_RECOVER) {
+               buf[0] = vstrextend(&buf[0], sep, "PRE-RECOVER", NULL);
+               sep = ", ";
+           }
+           if (val->v.i & EXECUTE_ON_POST_RECOVER) {
+               buf[0] = vstrextend(&buf[0], sep, "POST-RECOVER", NULL);
+               sep = ", ";
+           }
+           if (val->v.i & EXECUTE_ON_PRE_LEVEL_RECOVER) {
+               buf[0] = vstrextend(&buf[0], sep, "PRE-LEVEL-RECOVER", NULL);
+               sep = ", ";
+           }
+           if (val->v.i & EXECUTE_ON_POST_LEVEL_RECOVER) {
+               buf[0] = vstrextend(&buf[0], sep, "POST-LEVEL-RECOVER", NULL);
+               sep = ", ";
+           }
+           if (val->v.i & EXECUTE_ON_INTER_LEVEL_RECOVER) {
+               buf[0] = vstrextend(&buf[0], sep, "INTER-LEVEL-RECOVER", NULL);
+               sep = ", ";
+           }
+       }
+        break;
+
     }
     return buf;
 }
 
+int
+val_t_to_execute_on(
+    val_t *val)
+{
+    if (val->type != CONFTYPE_EXECUTE_ON) {
+       error(_("get_conftype_execute_on: val.type is not CONFTYPE_EXECUTE_ON"));
+       /*NOTREACHED*/
+    }
+    return val_t__execute_on(val);
+}
+
+int
+val_t_to_execute_where(
+    val_t *val)
+{
+    if (val->type != CONFTYPE_EXECUTE_WHERE) {
+       error(_("get_conftype_execute_where: val.type is not CONFTYPE_EXECUTE_WHERE"));
+       /*NOTREACHED*/
+    }
+    return val->v.i;
+}
+
+pp_scriptlist_t
+val_t_to_pp_scriptlist(
+    val_t *val)
+{
+    if (val->type != CONFTYPE_PP_SCRIPTLIST) {
+       error(_("get_conftype_proplist: val.type is not CONFTYPE_PP_SCRIPTLIST"));
+       /*NOTREACHED*/
+    }
+    return val->v.pp_scriptlist;
+}
+
+
+application_t *
+val_t_to_application(
+    val_t *val)
+{
+    if (val->type != CONFTYPE_APPLICATION) {
+       error(_("get_conftype_applicaiton: val.type is not CONFTYPE_APPLICATION"));
+       /*NOTREACHED*/
+    }
+    return val->v.application;
+}
+
+
 static void
 proplist_display_str_foreach_fn(
     gpointer key_p,
     gpointer value_p,
     gpointer user_data_p)
 {
-    char *property_s = key_p;
-    char *value_s    = value_p;
-    char ***msg             = (char ***)user_data_p;
+    char         *property_s = key_p;
+    property_t   *property   = value_p;
+    GSList       *value;
+    char       ***msg        = (char ***)user_data_p;
+
+    /* What to do with property->append? it should be printed only on client */
+    if (property->priority) {
+       **msg = vstralloc("priority \"", property_s, "\"", NULL);
+    } else {
+       **msg = vstralloc("\"", property_s, "\"", NULL);
+    }
+    for(value=property->values; value != NULL; value = value->next) {
+       **msg = vstrextend(*msg, " \"", value->data, "\"", NULL);
+    }
+    (*msg)++;
+}
+
+static void
+pp_scriptlist_display_str_foreach_fn(
+    gpointer data_p,
+    gpointer user_data_p)
+{
+    pp_script_t *pp_script = data_p;
+    char ***msg      = (char ***)user_data_p;
 
-    **msg = vstralloc("\"", property_s, "\" \"", value_s, "\"", NULL);
+    **msg = vstralloc("\"", pp_script->name, "\"", NULL);
     (*msg)++;
 }
 
+
 static char *
 exinclude_display_str(
     val_t *val,
@@ -4858,6 +6483,10 @@ parm_key_info(
     dumptype_t *dp;
     interface_t *ip;
     holdingdisk_t *hp;
+    application_t *ap;
+    pp_script_t   *pp;
+    device_config_t   *dc;
+    changer_config_t   *cc;
     int success = FALSE;
 
     /* WARNING: assumes globals keytable and parsetable are set correctly. */
@@ -4868,9 +6497,8 @@ parm_key_info(
     key = stralloc(key);
 
     /* uppercase the key */
-    s = key;
     for (s = key; (ch = *s) != 0; s++) {
-       if(islower((int)ch))
+       if (islower((int)ch))
            *s = (char)toupper(ch);
     }
 
@@ -4881,12 +6509,22 @@ parm_key_info(
        *subsec_name = '\0';
        subsec_name++;
 
+       /* convert subsec_type '-' to '_' */
+       for (s = subsec_type; (ch = *s) != 0; s++) {
+           if (*s == '-') *s = '_';
+       }
+
        subsec_key = strchr(subsec_name,':');
        if(!subsec_key) goto out; /* failure */
 
        *subsec_key = '\0';
        subsec_key++;
 
+       /* convert subsec_key '-' to '_' */
+       for (s = subsec_key; (ch = *s) != 0; s++) {
+           if (*s == '-') *s = '_';
+       }
+
        /* If the keyword doesn't exist, there's no need to look up the
         * subsection -- we know it's invalid */
        for(kt = keytable; kt->token != CONF_UNKNOWN; kt++) {
@@ -4945,10 +6583,63 @@ parm_key_info(
            if (val) *val = &ip->value[np->parm];
            if (parm) *parm = np;
            success = TRUE;
-       } 
+       } else if (strcmp(subsec_type, "APPLICATION_TOOL") == 0) {
+           ap = lookup_application(subsec_name);
+           if (!ap) goto out;
+           for(np = application_var; np->token != CONF_UNKNOWN; np++) {
+               if(np->token == kt->token)
+                  break;
+           }
+           if (np->token == CONF_UNKNOWN) goto out;
+
+           if (val) *val = &ap->value[np->parm];
+           if (parm) *parm = np;
+           success = TRUE;
+       } else if (strcmp(subsec_type, "SCRIPT_TOOL") == 0) {
+           pp = lookup_pp_script(subsec_name);
+           if (!pp) goto out;
+           for(np = pp_script_var; np->token != CONF_UNKNOWN; np++) {
+               if(np->token == kt->token)
+                  break;
+           }
+           if (np->token == CONF_UNKNOWN) goto out;
+
+           if (val) *val = &pp->value[np->parm];
+           if (parm) *parm = np;
+           success = TRUE;
+       } else if (strcmp(subsec_type, "DEVICE") == 0) {
+           dc = lookup_device_config(subsec_name);
+           if (!dc) goto out;
+           for(np = device_config_var; np->token != CONF_UNKNOWN; np++) {
+               if(np->token == kt->token)
+                  break;
+           }
+           if (np->token == CONF_UNKNOWN) goto out;
+
+           if (val) *val = &dc->value[np->parm];
+           if (parm) *parm = np;
+           success = TRUE;
+       } else if (strcmp(subsec_type, "CHANGER") == 0) {
+           cc = lookup_changer_config(subsec_name);
+           if (!cc) goto out;
+           for(np = changer_config_var; np->token != CONF_UNKNOWN; np++) {
+               if(np->token == kt->token)
+                  break;
+           }
+           if (np->token == CONF_UNKNOWN) goto out;
+
+           if (val) *val = &cc->value[np->parm];
+           if (parm) *parm = np;
+           success = TRUE;
+       }
 
     /* No delimiters -- we're referencing a global config parameter */
     } else {
+       /* convert key '-' to '_' */
+       for (s = key; (ch = *s) != 0; s++) {
+           if (*s == '-') *s = '_';
+       }
+
        /* look up the keyword */
        for(kt = keytable; kt->token != CONF_UNKNOWN; kt++) {
            if(kt->keyword && strcmp(kt->keyword, key) == 0)
@@ -4975,20 +6666,21 @@ out:
 
 gint64 
 find_multiplier(
-    char * casestr)
+    char * str)
 {
     keytab_t * table_entry;
-    char * str = g_utf8_strup(casestr, -1);
+
+    str = g_strdup(str);
     g_strstrip(str);
 
     if (*str == '\0') {
         g_free(str);
         return 1;
     }
-    
+
     for (table_entry = numb_keytable; table_entry->keyword != NULL;
          table_entry ++) {
-        if (strcmp(casestr, table_entry->keyword) == 0) {
+        if (strcasecmp(str, table_entry->keyword) == 0) {
             g_free(str);
             switch (table_entry->token) {
             case CONF_MULT1K:
@@ -5020,18 +6712,35 @@ find_multiplier(
  * Error Handling Implementaiton
  */
 
-static void print_parse_problem(const char * format, va_list argp) {
-    const char *xlated_fmt = gettext(format);
+void config_add_error(
+    cfgerr_level_t level,
+    char * errmsg)
+{
+    cfgerr_level = max(cfgerr_level, level);
+
+    g_debug("%s", errmsg);
+    cfgerr_errors = g_slist_append(cfgerr_errors, errmsg);
+}
+
+static void conf_error_common(
+    cfgerr_level_t level,
+    const char * format,
+    va_list argp)
+{
+    char *msg = g_strdup_vprintf(format, argp);
+    char *errstr = NULL;
 
     if(current_line)
-       g_fprintf(stderr, _("argument \"%s\": "), current_line);
+       errstr = g_strdup_printf(_("argument \"%s\": %s"),
+                   current_line, msg);
     else if (current_filename && current_line_num > 0)
-       g_fprintf(stderr, "\"%s\", line %d: ", current_filename, current_line_num);
+       errstr = g_strdup_printf(_("\"%s\", line %d: %s"),
+                   current_filename, current_line_num, msg);
     else
-       g_fprintf(stderr, _("parse error: "));
-    
-    g_vfprintf(stderr, xlated_fmt, argp);
-    fputc('\n', stderr);
+       errstr = g_strdup_printf(_("parse error: %s"), msg);
+    amfree(msg);
+
+    config_add_error(level, errstr);
 }
 
 printf_arglist_function(void conf_parserror, const char *, format)
@@ -5039,16 +6748,91 @@ printf_arglist_function(void conf_parserror, const char *, format)
     va_list argp;
     
     arglist_start(argp, format);
-    print_parse_problem(format, argp);
+    conf_error_common(CFGERR_ERRORS, format, argp);
     arglist_end(argp);
-
-    got_parserror = TRUE;
 }
 
 printf_arglist_function(void conf_parswarn, const char *, format) {
     va_list argp;
     
     arglist_start(argp, format);
-    print_parse_problem(format, argp);
+    conf_error_common(CFGERR_WARNINGS, format, argp);
     arglist_end(argp);
 }
+
+cfgerr_level_t
+config_errors(GSList **errstr)
+{
+    if (errstr)
+       *errstr = cfgerr_errors;
+    return cfgerr_level;
+}
+
+void
+config_clear_errors(void)
+{
+    g_slist_free_full(cfgerr_errors);
+
+    cfgerr_errors = NULL;
+    cfgerr_level = CFGERR_OK;
+}
+
+void
+config_print_errors(void)
+{
+    GSList *iter;
+
+    for (iter = cfgerr_errors; iter; iter = g_slist_next(iter)) {
+       g_fprintf(stderr, "%s\n", (char *)iter->data);
+    }
+}
+
+/* Get the config name */
+char *get_config_name(void)
+{
+    return config_name;
+}
+
+/* Get the config directory */
+char *get_config_dir(void)
+{
+    return config_dir;
+}
+
+/* Get the config filename */
+char *get_config_filename(void)
+{
+    return config_filename;
+}
+
+int
+property_argv_size(proplist_t proplist) {
+    int nb;
+
+    nb = 0;
+    g_hash_table_foreach(proplist, &count_proplist, &nb);
+    return nb*2;
+}
+
+int
+property_add_to_argv(
+    char **argvchild,
+    proplist_t proplist)
+{
+    char **argv = argvchild;
+
+    g_hash_table_foreach(proplist, &proplist_add_to_argv, &argv);
+    return (argv - argvchild);
+}
+
+char *
+anonymous_value(void)
+{
+    static char number[NUM_STR_SIZE];
+    static int value=1;
+
+    g_snprintf(number, sizeof(number), "%d", value);
+
+    value++;
+    return number;
+}
index 8873cec75292b3d659bae70148c72d098d6319c0..a61edd9d2f3c7c9ae5b53761bbc36a7146047bde 100644 (file)
 /* Getting Configuration Values
  * ============================
  *
- * Amanda configurations consist of a number of "global" parameters, as well as named
- * subsections of four types: dumptypes, interfaces, holdingdisks, and tapetypes.  The
- * global parameters are fetched with the getconf_CONFTYPE functions, keyed by a
- * confparam_t constant (with prefix CNF_).  The subsection parameters are fetched with
- * SUBSEC_get_PARAM() macros, e.g., tapetype_get_blocksize(ttyp), where the argument
- * comes from lookup_SUBSEC(), in this case lookup_tapetype(name).
+ * Amanda configurations consist of a number of "global" parameters, as well as
+ * named subsections of several types.  The global parameters are fetched with
+ * the getconf_CONFTYPE functions, keyed by a confparam_t constant (with prefix
+ * CNF_).  The subsection parameters are fetched with SUBSEC_get_PARAM()
+ * macros, e.g., tapetype_get_blocksize(ttyp), where the argument comes from
+ * lookup_SUBSEC(), in this case lookup_tapetype(name).
  *
  * Types
  * =====
  * ======
  * Note that, unless specified, all memory in this module is managed by the module
  * itself; return strings should not be freed by the caller.
+ *
+ * Error Handling
+ * ==============
+ * All errors and warnings generated by this module are available from get_config_errors().
+ * It is up to the caller to route these messages to the user.  The function
+ * config_print_errors() will print the errors to stderr, as a convenience.
  */
 
 /*
@@ -131,19 +137,55 @@ typedef enum {
     ALGO_ALGO /* sentinel */
 } taperalgo_t;
 
+/* execute_on types */
+#define EXECUTE_ON_PRE_DLE_AMCHECK     1<<0
+#define EXECUTE_ON_PRE_HOST_AMCHECK    1<<1
+#define EXECUTE_ON_POST_DLE_AMCHECK    1<<2
+#define EXECUTE_ON_POST_HOST_AMCHECK   1<<3
+#define EXECUTE_ON_PRE_DLE_ESTIMATE    1<<4
+#define EXECUTE_ON_PRE_HOST_ESTIMATE   1<<5
+#define EXECUTE_ON_POST_DLE_ESTIMATE   1<<6
+#define EXECUTE_ON_POST_HOST_ESTIMATE  1<<7
+#define EXECUTE_ON_PRE_DLE_BACKUP      1<<8
+#define EXECUTE_ON_PRE_HOST_BACKUP     1<<9
+#define EXECUTE_ON_POST_DLE_BACKUP     1<<10
+#define EXECUTE_ON_POST_HOST_BACKUP    1<<11
+#define EXECUTE_ON_PRE_RECOVER         1<<12
+#define EXECUTE_ON_POST_RECOVER        1<<13
+#define EXECUTE_ON_PRE_LEVEL_RECOVER   1<<14
+#define EXECUTE_ON_POST_LEVEL_RECOVER  1<<15
+#define EXECUTE_ON_INTER_LEVEL_RECOVER 1<<16
+typedef int execute_on_t;
+
+typedef int execute_where_t;
+
+typedef enum {
+    SEND_AMREPORT_ALL,
+    SEND_AMREPORT_STRANGE,
+    SEND_AMREPORT_ERROR,
+    SEND_AMREPORT_NEVER
+} send_amreport_t;
+
 typedef struct exinclude_s {
     sl_t *sl_list;
     sl_t *sl_file;
     int  optional;
 } exinclude_t;
 
+typedef struct {
+    int append;
+    int priority;
+    GSList* values;
+} property_t;
+
 typedef GHashTable* proplist_t;
+typedef GSList* pp_scriptlist_t;
 
 /* Names for the type of value in a val_t.  Mostly for internal use, but useful
  * for wrapping val_t's, too. */
 typedef enum {
     CONFTYPE_INT,
-    CONFTYPE_AM64,
+    CONFTYPE_INT64,
     CONFTYPE_REAL,
     CONFTYPE_STR,
     CONFTYPE_IDENT,
@@ -160,16 +202,29 @@ typedef enum {
     CONFTYPE_RATE,
     CONFTYPE_INTRANGE,
     CONFTYPE_EXINCLUDE,
-    CONFTYPE_PROPLIST
+    CONFTYPE_PROPLIST,
+    CONFTYPE_APPLICATION,
+    CONFTYPE_EXECUTE_ON,
+    CONFTYPE_EXECUTE_WHERE,
+    CONFTYPE_SEND_AMREPORT_ON,
+    CONFTYPE_PP_SCRIPTLIST
 } conftype_t;
 
+/* A "seen" struct.  Rather than allocate strings all over the place, this
+ * string is in the "parsed_filenames" GSList and will be freed when that
+ * GSList is freed.  This struct should be opaque to other modules. */
+typedef struct seen_s {
+    char *filename;
+    int linenum;
+} seen_t;
+
 /* This should be considered an opaque type for any other modules.  The complete
  * struct is included here to allow quick access via macros. Access it *only* through
  * those macros. */
 typedef struct val_s {
     union {
         int            i;
-        off_t          am64;
+        gint64         int64;
         double         r;
         char           *s;
         ssize_t                size;
@@ -178,40 +233,47 @@ typedef struct val_s {
         exinclude_t    exinclude;
         int            intrange[2];
         proplist_t      proplist;
+       struct application_s  *application;
+       pp_scriptlist_t pp_scriptlist;
     } v;
-    int seen;
+    seen_t seen;
     conftype_t type;
 } val_t;
 
 /* Functions to typecheck and extract a particular type of
  * value from a val_t.  All call error() if the type is incorrect,
  * as this is a programming error.  */
-int                 val_t_to_int      (val_t *);
-off_t               val_t_to_am64     (val_t *);
-float               val_t_to_real     (val_t *);
-char               *val_t_to_str      (val_t *); /* (also converts CONFTYPE_IDENT) */
-char               *val_t_to_ident    (val_t *); /* (also converts CONFTYPE_STR) */
-time_t              val_t_to_time     (val_t *);
-ssize_t             val_t_to_size     (val_t *);
-int                 val_t_to_boolean  (val_t *);
-comp_t              val_t_to_compress (val_t *);
-encrypt_t           val_t_to_encrypt  (val_t *);
-dump_holdingdisk_t  val_t_to_holding  (val_t *);
-estimate_t          val_t_to_estimate (val_t *);
-strategy_t          val_t_to_strategy (val_t *);
-taperalgo_t         val_t_to_taperalgo(val_t *);
-int                 val_t_to_priority (val_t *);
-float              *val_t_to_rate     (val_t *); /* array of two floats */
-exinclude_t         val_t_to_exinclude(val_t *);
-int                *val_t_to_intrange (val_t *); /* array of two ints */
-proplist_t          val_t_to_proplist (val_t *);
+int                   val_t_to_int      (val_t *);
+gint64                val_t_to_int64    (val_t *);
+float                 val_t_to_real     (val_t *);
+char                 *val_t_to_str      (val_t *); /* (also converts CONFTYPE_IDENT) */
+char                 *val_t_to_ident    (val_t *); /* (also converts CONFTYPE_STR) */
+time_t                val_t_to_time     (val_t *);
+ssize_t               val_t_to_size     (val_t *);
+int                   val_t_to_boolean  (val_t *);
+comp_t                val_t_to_compress (val_t *);
+encrypt_t             val_t_to_encrypt  (val_t *);
+dump_holdingdisk_t    val_t_to_holding  (val_t *);
+estimate_t            val_t_to_estimate (val_t *);
+strategy_t            val_t_to_strategy (val_t *);
+taperalgo_t           val_t_to_taperalgo(val_t *);
+int                   val_t_to_priority (val_t *);
+float                *val_t_to_rate     (val_t *); /* array of two floats */
+exinclude_t           val_t_to_exinclude(val_t *);
+int                  *val_t_to_intrange (val_t *); /* array of two ints */
+proplist_t            val_t_to_proplist (val_t *);
+struct application_s *val_t_to_application(val_t *);
+pp_scriptlist_t       val_t_to_pp_scriptlist(val_t *);
+execute_on_t          val_t_to_execute_on(val_t *);
+execute_where_t       val_t_to_execute_where(val_t *);
+send_amreport_t       val_t_to_send_amreport(val_t *);
 
 /* Has the given val_t been seen in a configuration file or config overwrite?
  *
  * @param val: val_t* to examine
  * @returns: boolean
  */
-#define val_t_seen(val) ((val)->seen)
+#define val_t_seen(val) ((val)->seen.linenum)
 
 /* What is the underlying type of this val_t?
  *
@@ -227,26 +289,31 @@ proplist_t          val_t_to_proplist (val_t *);
  * (in the macro name) to the corresponding union field.  The macros work
  * as lvalues, too.
  */
-#define val_t__seen(val)        ((val)->seen)
-#define val_t__int(val)         ((val)->v.i)
-#define val_t__am64(val)        ((val)->v.am64)
-#define val_t__real(val)        ((val)->v.r)
-#define val_t__str(val)         ((val)->v.s)
-#define val_t__ident(val)       ((val)->v.s)
-#define val_t__time(val)        ((val)->v.t)
-#define val_t__size(val)        ((val)->v.size)
-#define val_t__boolean(val)     ((val)->v.i)
-#define val_t__compress(val)    ((val)->v.i)
-#define val_t__encrypt(val)     ((val)->v.i)
-#define val_t__holding(val)     ((val)->v.i)
-#define val_t__estimate(val)    ((val)->v.i)
-#define val_t__strategy(val)    ((val)->v.i)
-#define val_t__taperalgo(val)   ((val)->v.i)
-#define val_t__priority(val)    ((val)->v.i)
-#define val_t__rate(val)        ((val)->v.rate)
-#define val_t__exinclude(val)   ((val)->v.exinclude)
-#define val_t__intrange(val)    ((val)->v.intrange)
-#define val_t__proplist(val)    ((val)->v.proplist)
+#define val_t__seen(val)          ((val)->seen)
+#define val_t__int(val)           ((val)->v.i)
+#define val_t__int64(val)         ((val)->v.int64)
+#define val_t__real(val)          ((val)->v.r)
+#define val_t__str(val)           ((val)->v.s)
+#define val_t__ident(val)         ((val)->v.s)
+#define val_t__time(val)          ((val)->v.t)
+#define val_t__size(val)          ((val)->v.size)
+#define val_t__boolean(val)       ((val)->v.i)
+#define val_t__compress(val)      ((val)->v.i)
+#define val_t__encrypt(val)       ((val)->v.i)
+#define val_t__holding(val)       ((val)->v.i)
+#define val_t__estimate(val)      ((val)->v.i)
+#define val_t__strategy(val)      ((val)->v.i)
+#define val_t__taperalgo(val)     ((val)->v.i)
+#define val_t__send_amreport(val) ((val)->v.i)
+#define val_t__priority(val)      ((val)->v.i)
+#define val_t__rate(val)          ((val)->v.rate)
+#define val_t__exinclude(val)     ((val)->v.exinclude)
+#define val_t__intrange(val)      ((val)->v.intrange)
+#define val_t__proplist(val)      ((val)->v.proplist)
+#define val_t__pp_scriptlist(val) ((val)->v.pp_scriptlist)
+#define val_t__application(val)   ((val)->v.application)
+#define val_t__execute_on(val)    ((val)->v.i)
+#define val_t__execute_where(val) ((val)->v.i)
 /*
  * Parameters
  *
@@ -272,7 +339,15 @@ typedef enum {
     CNF_MAILTO,
     CNF_DUMPUSER,
     CNF_TAPEDEV,
+    CNF_RAWTAPEDEV,
     CNF_DEVICE_PROPERTY,
+    CNF_PROPERTY,
+    CNF_APPLICATION,
+    CNF_APPLICATION_TOOL,
+    CNF_EXECUTE_ON,
+    CNF_PP_SCRIPT,
+    CNF_PP_SCRIPT_TOOL,
+    CNF_PLUGIN,
     CNF_CHANGERDEV,
     CNF_CHANGERFILE,
     CNF_LABELSTR,
@@ -301,6 +376,7 @@ typedef enum {
     CNF_TAPEBUFS,
     CNF_DEVICE_OUTPUT_BUFFER_SIZE,
     CNF_PRINTER,
+    CNF_MAILER,
     CNF_AUTOFLUSH,
     CNF_RESERVE,
     CNF_MAXDUMPSIZE,
@@ -309,6 +385,7 @@ typedef enum {
     CNF_AMRECOVER_CHECK_LABEL,
     CNF_AMRECOVER_CHANGER,
     CNF_TAPERALGO,
+    CNF_SEND_AMREPORT_ON,
     CNF_FLUSH_THRESHOLD_DUMPED,
     CNF_FLUSH_THRESHOLD_SCHEDULED,
     CNF_TAPERFLUSH,
@@ -366,7 +443,7 @@ val_t *getconf(confparm_key key);
  * @returns: various
  */
 #define getconf_int(key)          (val_t_to_int(getconf((key))))
-#define getconf_am64(key)         (val_t_to_am64(getconf((key))))
+#define getconf_int64(key)        (val_t_to_int64(getconf((key))))
 #define getconf_real(key)         (val_t_to_real(getconf((key))))
 #define getconf_str(key)         (val_t_to_str(getconf((key))))
 #define getconf_ident(key)        (val_t_to_ident(getconf((key))))
@@ -384,6 +461,7 @@ val_t *getconf(confparm_key key);
 #define getconf_exinclude(key)    (val_t_to_exinclude(getconf((key))))
 #define getconf_intrange(key)     (val_t_to_intrange(getconf((key))))
 #define getconf_proplist(key)     (val_t_to_proplist(getconf((key))))
+#define getconf_send_amreport(key) (val_t_to_send_amreport(getconf((key))))
 
 /* Get a list of names for subsections of the given type
  *
@@ -494,8 +572,8 @@ char *tapetype_name(tapetype_t *ttyp);
 #define tapetype_get_lbl_templ(ttyp)       (val_t_to_str(tapetype_getconf((ttyp), TAPETYPE_LBL_TEMPL)))
 #define tapetype_get_blocksize(ttyp)       (val_t_to_size(tapetype_getconf((ttyp), TAPETYPE_BLOCKSIZE)))
 #define tapetype_get_readblocksize(ttyp)   (val_t_to_size(tapetype_getconf((ttyp), TAPETYPE_READBLOCKSIZE)))
-#define tapetype_get_length(ttyp)          (val_t_to_am64(tapetype_getconf((ttyp), TAPETYPE_LENGTH)))
-#define tapetype_get_filemark(ttyp)        (val_t_to_am64(tapetype_getconf((ttyp), TAPETYPE_FILEMARK)))
+#define tapetype_get_length(ttyp)          (val_t_to_int64(tapetype_getconf((ttyp), TAPETYPE_LENGTH)))
+#define tapetype_get_filemark(ttyp)        (val_t_to_int64(tapetype_getconf((ttyp), TAPETYPE_FILEMARK)))
 #define tapetype_get_speed(ttyp)           (val_t_to_int(tapetype_getconf((ttyp), TAPETYPE_SPEED)))
 #define tapetype_get_file_pad(ttyp)        (val_t_to_boolean(tapetype_getconf((ttyp), TAPETYPE_FILE_PAD)))
 
@@ -542,6 +620,9 @@ typedef enum {
     DUMPTYPE_KENCRYPT,
     DUMPTYPE_IGNORE,
     DUMPTYPE_INDEX,
+    DUMPTYPE_APPLICATION,
+    DUMPTYPE_PP_SCRIPTLIST,
+    DUMPTYPE_PROPERTY,
     DUMPTYPE_DUMPTYPE /* sentinel */
 } dumptype_key;
 
@@ -604,7 +685,7 @@ char *dumptype_name(dumptype_t *dtyp);
 #define dumptype_get_maxdumps(dtyp)            (val_t_to_int(dumptype_getconf((dtyp), DUMPTYPE_MAXDUMPS)))
 #define dumptype_get_maxpromoteday(dtyp)       (val_t_to_int(dumptype_getconf((dtyp), DUMPTYPE_MAXPROMOTEDAY)))
 #define dumptype_get_bumppercent(dtyp)         (val_t_to_int(dumptype_getconf((dtyp), DUMPTYPE_BUMPPERCENT)))
-#define dumptype_get_bumpsize(dtyp)            (val_t_to_am64(dumptype_getconf((dtyp), DUMPTYPE_BUMPSIZE)))
+#define dumptype_get_bumpsize(dtyp)            (val_t_to_int64(dumptype_getconf((dtyp), DUMPTYPE_BUMPSIZE)))
 #define dumptype_get_bumpdays(dtyp)            (val_t_to_int(dumptype_getconf((dtyp), DUMPTYPE_BUMPDAYS)))
 #define dumptype_get_bumpmult(dtyp)            (val_t_to_real(dumptype_getconf((dtyp), DUMPTYPE_BUMPMULT)))
 #define dumptype_get_starttime(dtyp)           (val_t_to_time(dumptype_getconf((dtyp), DUMPTYPE_STARTTIME)))
@@ -615,8 +696,8 @@ char *dumptype_name(dumptype_t *dtyp);
 #define dumptype_get_srv_decrypt_opt(dtyp)     (val_t_to_str(dumptype_getconf((dtyp), DUMPTYPE_SRV_DECRYPT_OPT)))
 #define dumptype_get_clnt_decrypt_opt(dtyp)    (val_t_to_str(dumptype_getconf((dtyp), DUMPTYPE_CLNT_DECRYPT_OPT)))
 #define dumptype_get_comprate(dtyp)            (val_t_to_rate(dumptype_getconf((dtyp), DUMPTYPE_COMPRATE)))
-#define dumptype_get_tape_splitsize(dtyp)      (val_t_to_am64(dumptype_getconf((dtyp), DUMPTYPE_TAPE_SPLITSIZE)))
-#define dumptype_get_fallback_splitsize(dtyp)  (val_t_to_am64(dumptype_getconf((dtyp), DUMPTYPE_FALLBACK_SPLITSIZE)))
+#define dumptype_get_tape_splitsize(dtyp)      (val_t_to_int64(dumptype_getconf((dtyp), DUMPTYPE_TAPE_SPLITSIZE)))
+#define dumptype_get_fallback_splitsize(dtyp)  (val_t_to_int64(dumptype_getconf((dtyp), DUMPTYPE_FALLBACK_SPLITSIZE)))
 #define dumptype_get_split_diskbuffer(dtyp)    (val_t_to_str(dumptype_getconf((dtyp), DUMPTYPE_SPLIT_DISKBUFFER)))
 #define dumptype_get_record(dtyp)              (val_t_to_boolean(dumptype_getconf((dtyp), DUMPTYPE_RECORD)))
 #define dumptype_get_skip_incr(dtyp)           (val_t_to_boolean(dumptype_getconf((dtyp), DUMPTYPE_SKIP_INCR)))
@@ -625,6 +706,9 @@ char *dumptype_name(dumptype_t *dtyp);
 #define dumptype_get_kencrypt(dtyp)            (val_t_to_boolean(dumptype_getconf((dtyp), DUMPTYPE_KENCRYPT)))
 #define dumptype_get_ignore(dtyp)              (val_t_to_boolean(dumptype_getconf((dtyp), DUMPTYPE_IGNORE)))
 #define dumptype_get_index(dtyp)               (val_t_to_boolean(dumptype_getconf((dtyp), DUMPTYPE_INDEX)))
+#define dumptype_get_application(dtyp)         (val_t_to_application(dumptype_getconf((dtyp), DUMPTYPE_APPLICATION)))
+#define dumptype_get_pp_scriptlist(dtyp)       (val_t_to_pp_scriptlist(dumptype_getconf((dtyp), DUMPTYPE_PP_SCRIPTLIST)))
+#define dumptype_get_property(dtyp)            (val_t_to_proplist(dumptype_getconf((dtyp), DUMPTYPE_PROPERTY)))
 
 /*
  * Interface parameter access
@@ -748,8 +832,290 @@ char *holdingdisk_name(holdingdisk_t *hdisk);
  */
 #define holdingdisk_get_comment(hdisk)   (val_t_to_str(holdingdisk_getconf((hdisk), HOLDING_COMMENT)))
 #define holdingdisk_get_diskdir(hdisk)   (val_t_to_str(holdingdisk_getconf((hdisk), HOLDING_DISKDIR)))
-#define holdingdisk_get_disksize(hdisk)  (val_t_to_am64(holdingdisk_getconf((hdisk), HOLDING_DISKSIZE)))
-#define holdingdisk_get_chunksize(hdisk) (val_t_to_am64(holdingdisk_getconf((hdisk), HOLDING_CHUNKSIZE)))
+#define holdingdisk_get_disksize(hdisk)  (val_t_to_int64(holdingdisk_getconf((hdisk), HOLDING_DISKSIZE)))
+#define holdingdisk_get_chunksize(hdisk) (val_t_to_int64(holdingdisk_getconf((hdisk), HOLDING_CHUNKSIZE)))
+
+/* A application-tool interface */
+typedef enum application_e  {
+    APPLICATION_COMMENT,
+    APPLICATION_PLUGIN,
+    APPLICATION_PROPERTY,
+    APPLICATION_APPLICATION
+} application_key;
+
+/* opaque object */
+typedef struct application_s application_t;
+
+/* Given the name of the application, return a application object.  Returns NULL
+ * if no matching application exists.  Note that the match is case-insensitive.
+ *
+ * @param identifier: name of the desired application
+ * @returns: object or NULL
+ */
+
+application_t *lookup_application(char *identifier);
+
+/* Given a application and a key, return a pointer to the corresponding val_t.
+ *
+ * @param ttyp: the application to examine
+ * @param key: application (one of the APPLICATION_* constants)
+ * @returns: pointer to value
+ */
+val_t *application_getconf(application_t *app, application_key key);
+
+/* Get the name of this application.
+ *
+ * @param ttyp: the application to examine
+ * @returns: name of the application
+ */
+char *application_name(application_t *app);
+
+/* (convenience macro) has this parameter been seen in this application?  This
+ * applies to the specific parameter *within* the application.
+ *
+ * @param key: application_key
+ * @returns: boolean
+ */
+#define application_seen(app, key)       (val_t_seen(application_getconf((app), (key))))
+
+/* (convenience macros)
+ * fetch a particular parameter; caller must know the correct type.
+ *
+ * @param ttyp: the application to examine
+ * @returns: various
+ */
+#define application_get_comment(application)  (val_t_to_str(application_getconf((application), APPLICATION_COMMENT))
+#define application_get_plugin(application)   (val_t_to_str(application_getconf((application), APPLICATION_PLUGIN)))
+#define application_get_property(application) (val_t_to_proplist(application_getconf((application), APPLICATION_PROPERTY)))
+
+application_t *read_application(char *name, FILE *from, char *fname, int *linenum);
+
+/* A pp-script-tool interface */
+typedef enum pp_script_e  {
+    PP_SCRIPT_COMMENT,
+    PP_SCRIPT_PLUGIN,
+    PP_SCRIPT_PROPERTY,
+    PP_SCRIPT_EXECUTE_ON,
+    PP_SCRIPT_EXECUTE_WHERE,
+    PP_SCRIPT_PP_SCRIPT
+} pp_script_key;
+
+/* opaque object */
+typedef struct pp_script_s pp_script_t;
+
+/* Given the name of the pp_script, return a pp_script object.  Returns NULL
+ * if no matching pp_script exists.  Note that the match is case-insensitive.
+ *
+ * @param identifier: name of the desired pp_script
+ * @returns: object or NULL
+ */
+
+pp_script_t *lookup_pp_script(char *identifier);
+
+/* Given a pp_script and a key, return a pointer to the corresponding val_t.
+ *
+ * @param ttyp: the pp_script to examine
+ * @param key: pp_script (one of the PP_SCRIPT_* constants)
+ * @returns: pointer to value
+ */
+val_t *pp_script_getconf(pp_script_t *pps, pp_script_key key);
+
+/* Get the name of this pp_script.
+ *
+ * @param ttyp: the pp_script to examine
+ * @returns: name of the pp_script
+ */
+char *pp_script_name(pp_script_t *pps);
+
+/* (convenience macro) has this parameter been seen in this pp_script?  This
+ * applies to the specific parameter *within* the pp_script.
+ *
+ * @param key: pp_script_key
+ * @returns: boolean
+ */
+#define pp_script_seen(pps, key)       (val_t_seen(pp_script_getconf((pps), (key))))
+
+/* (convenience macros)
+ * fetch a particular parameter; caller must know the correct type.
+ *
+ * @param ttyp: the pp_script to examine
+ * @returns: various
+ */
+
+#define pp_script_get_comment(pp_script)   (val_t_to_str(pp_script_getconf((pp_script), PP_SCRIPT_COMMENT)))
+#define pp_script_get_plugin(pp_script)   (val_t_to_str(pp_script_getconf((pp_script), PP_SCRIPT_PLUGIN)))
+#define pp_script_get_property(pp_script)   (val_t_to_proplist(pp_script_getconf((pp_script), PP_SCRIPT_PROPERTY)))
+#define pp_script_get_execute_on(pp_script)   (val_t_to_execute_on(pp_script_getconf((pp_script), PP_SCRIPT_EXECUTE_ON)))
+#define pp_script_get_execute_where(pp_script)   (val_t_to_execute_where(pp_script_getconf((pp_script), PP_SCRIPT_EXECUTE_WHERE)))
+
+pp_script_t *read_pp_script(char *name, FILE *from, char *fname, int *linenum);
+pp_script_t *lookup_pp_script(char *identifier);
+
+/* A device definition */
+typedef enum {
+    DEVICE_CONFIG_COMMENT,
+    DEVICE_CONFIG_TAPEDEV,
+    DEVICE_CONFIG_DEVICE_PROPERTY,
+    DEVICE_CONFIG_DEVICE_CONFIG
+} device_config_key;
+
+/* opaque object */
+typedef struct device_config_s device_config_t;
+
+/* Given the name of the device, return a device_config_t object.  Returns NULL
+ * if no matching device exists.  Note that the match is case-insensitive.
+ *
+ * @param identifier: name of the desired device
+ * @returns: object or NULL
+ */
+
+device_config_t *lookup_device_config(char *identifier);
+
+/* Given a device_config and a key, return a pointer to the corresponding val_t.
+ *
+ * @param ttyp: the device_config to examine
+ * @param key: device_config (one of the DEVICE_CONFIG_* constants)
+ * @returns: pointer to value
+ */
+val_t *device_config_getconf(device_config_t *devconf, device_config_key key);
+
+/* Get the name of this device_config.
+ *
+ * @param ttyp: the device_config to examine
+ * @returns: name of the device_config
+ */
+char *device_config_name(device_config_t *devconf);
+
+/* (convenience macro) has this parameter been seen in this device_config?  This
+ * applies to the specific parameter *within* the device_config.
+ *
+ * @param key: device_config_key
+ * @returns: boolean
+ */
+#define device_config_seen(devconf, key)       (val_t_seen(device_config_getconf((devconf), (key))))
+
+/* (convenience macros)
+ * fetch a particular parameter; caller must know the correct type.
+ *
+ * @param devconf: the device_config to examine
+ * @returns: various
+ */
+
+#define device_config_get_comment(devconf)   (val_t_to_str(device_config_getconf((devconf), DEVICE_CONFIG_COMMENT)))
+#define device_config_get_tapedev(devconf)   (val_t_to_str(device_config_getconf((devconf), DEVICE_CONFIG_TAPEDEV)))
+#define device_config_get_property(devconf)   (val_t_to_proplist(device_config_getconf((devconf), DEVICE_CONFIG_DEVICE_PROPERTY)))
+
+device_config_t *read_device_config(char *name, FILE *from, char *fname, int *linenum);
+device_config_t *lookup_device_config(char *identifier);
+
+/* A changer definition */
+typedef enum {
+    CHANGER_CONFIG_COMMENT,
+    CHANGER_CONFIG_TAPEDEV,
+    CHANGER_CONFIG_TPCHANGER,
+    CHANGER_CONFIG_CHANGERDEV,
+    CHANGER_CONFIG_CHANGERFILE,
+    CHANGER_CONFIG_CHANGER_CONFIG
+} changer_config_key;
+
+/* opaque object */
+typedef struct changer_config_s changer_config_t;
+
+/* Given the name of the changer, return a changer_config_t object.  Returns NULL
+ * if no matching changer exists.  Note that the match is case-insensitive.
+ *
+ * @param identifier: name of the desired changer
+ * @returns: object or NULL
+ */
+
+changer_config_t *lookup_changer_config(char *identifier);
+
+/* Given a changer_config and a key, return a pointer to the corresponding val_t.
+ *
+ * @param ttyp: the changer_config to examine
+ * @param key: changer_config (one of the DEVICE_CONFIG_* constants)
+ * @returns: pointer to value
+ */
+val_t *changer_config_getconf(changer_config_t *devconf, changer_config_key key);
+
+/* Get the name of this changer_config.
+ *
+ * @param ttyp: the changer_config to examine
+ * @returns: name of the changer_config
+ */
+char *changer_config_name(changer_config_t *devconf);
+
+/* (convenience macro) has this parameter been seen in this changer_config?  This
+ * applies to the specific parameter *within* the changer_config.
+ *
+ * @param key: changer_config_key
+ * @returns: boolean
+ */
+#define changer_config_seen(devconf, key)       (val_t_seen(changer_config_getconf((devconf), (key))))
+
+/* (convenience macros)
+ * fetch a particular parameter; caller must know the correct type.
+ *
+ * @param devconf: the changer_config to examine
+ * @returns: various
+ */
+
+#define changer_config_get_comment(devconf)   (val_t_to_str(changer_config_getconf((devconf), DEVICE_CONFIG_COMMENT)))
+#define changer_config_get_tapedev(devconf)   (val_t_to_str(changer_config_getconf((devconf), DEVICE_CONFIG_TAPEDEV)))
+#define changer_config_get_tpchanger(devconf)   (val_t_to_str(changer_config_getconf((devconf), DEVICE_CONFIG_TPCHANGER)))
+#define changer_config_get_changerdev(devconf)   (val_t_to_str(changer_config_getconf((devconf), DEVICE_CONFIG_CHANGERDEV)))
+#define changer_config_get_changerfile(devconf)   (val_t_to_str(changer_config_getconf((devconf), DEVICE_CONFIG_CHANGERFILE)))
+
+changer_config_t *read_changer_config(char *name, FILE *from, char *fname, int *linenum);
+changer_config_t *lookup_changer_config(char *identifier);
+
+/*
+ * Error Handling
+ */
+
+typedef enum {
+    /* No errors or warnings */
+    CFGERR_OK = 0,
+
+    /* warnings were encountered */
+    CFGERR_WARNINGS = 1,
+
+    /* errors (and maybe some warnings too, who knows) were encountered */
+    CFGERR_ERRORS = 2,
+} cfgerr_level_t;
+
+/*
+ * Errors
+ */
+
+/* Get a GSList of all error and warning messages accumulated so far.
+ *
+ * @param (output) errlist: pointer to the list of error strings; allocated
+ * memory remains the responsibility of the config module.  If errlist is
+ * NULL, the list is not returned.
+ * @returns: current error level
+ */
+cfgerr_level_t config_errors(GSList **errlist);
+
+/* Clear any error conditions.
+ */
+void config_clear_errors(void);
+
+/* Print the list of current error and warning messages, one per line,
+ * to stderr. This is a convenience function for command-line
+ * applications.
+ */
+void config_print_errors(void);
+
+/* Add an error message to the list of errors, and make sure tha the
+ * error level is at least LEVEL.  This is used by the diskfile module
+ * to insert its errors into this module's error list.
+ *
+ * @param level: level for this error
+ * @param errmsg: error message; conffile takes responsibility for freeing
+ *   this string.
+ */
+void config_add_error(cfgerr_level_t level, char *errmsg);
 
 /*
  * Command-line handling
@@ -809,15 +1175,13 @@ extract_commandline_config_overwrites(int *argc,
                                      char ***argv);
 
 /* Apply configuration overwrites to the current configuration and take
- * ownership of the config_overwrites object.
- *
- * If any parameters are not matched in the current symbol table, or
- * correspond to named subsections which do not exist, this function calls
- * error() and does not return.
+ * ownership of the config_overwrites object.  It is the caller's
+ * responsibility to handle any errors.
  *
  * @param co: the config_overwrites object
+ * @returns: current error level
  */
-void apply_config_overwrites(config_overwrites_t *co);
+cfgerr_level_t apply_config_overwrites(config_overwrites_t *co);
 
 /*
  * Initialization
@@ -837,9 +1201,6 @@ typedef enum {
     /* New configuration should "overlay" existing configuration; this
      * is used by clients to load multiple amanda-client.conf files. */
     CONFIG_INIT_OVERLAY = 1 << 3,
-
-    /* If the file doesn't exist, halt with an error. */
-    CONFIG_INIT_FATAL = 1 << 4,
 } config_init_flags;
 
 /* Initialize this application's configuration, with the specific actions
@@ -855,15 +1216,14 @@ typedef enum {
  *  - otherwise, for the client only, se config_dir to CONFIG_DIR and
  *    config_name to NULL.
  *  - depending on CONFIG_INIT_CLIENT, read amanda.conf or amanda-client.conf
- *  - in the event of an error, call error() if CONFIG_INIT_FATAL, otherwise
- *    record a message in the debug log and return false.
  *
  * @param flags: flags indicating desired behavior, as above
  * @param arg_config_name: config name to use (from e.g., argv[1])
- * @returns: true on success, false on failure, unless CONFIG_INIT_FATAL
+ * @returns: current error level
  */
-gboolean config_init(config_init_flags flags,
-                    char *arg_config_name);
+cfgerr_level_t config_init(
+        config_init_flags flags,
+        char *arg_config_name);
 
 /* Free all memory allocated for the configuration.  This effectively
  * reverses the effects of config_init().
@@ -891,21 +1251,14 @@ void config_uninit(void);
  */
 char **get_config_options(int first);
 
-/* The name of the configuration under which this application is running.
- * This variable is initialized by config_init, and should be treated as
- * read-only.
- */
-extern char *config_name;
+/* Get the config name */
+char *get_config_name(void);
 
-/* The directory containing the configuration for this application.  This
- * variable is initialized by config_init, and should be treated as read-only.
- */
-extern char *config_dir;
+/* Get the config directory */
+char *get_config_dir(void);
 
-/* The most recently read top-level configuration file.  This variable is
- * initialized by config_init, and should be treated as read-only.
- */
-extern char *config_filename;
+/* Get the config filename */
+char *get_config_filename(void);
 
 /*
  * Utilities
@@ -956,6 +1309,15 @@ char **val_t_display_strs(val_t *val, int str_needs_quotes);
  */
 dumptype_t *read_dumptype(char *name, FILE *from, char *fname, int *linenum);
 
+/* Every call return a pointer to a string with an increasing number; this is
+ * used by this module as well as by diskfile.c to read the disklist.
+ *
+ * Nobody else should use this function.  Seriously.
+ *
+ * @returns: a pointer to a static string.
+ */
+char *anonymous_value(void);
+
 /* Extend a relative filename with the current config_dir; if filename is already
  * absolute, this is equivalent to stralloc.
  *
@@ -983,4 +1345,18 @@ char *taperalgo2str(taperalgo_t taperalgo);
  */
 gint64 find_multiplier(char * casestr);
 
+/* Compute the size needed in an ARGV to pass all properties
+ *
+ * @param proplist: The property list
+ * @returns: The size required for an ARGV
+ */
+int property_argv_size(proplist_t proplist);
+
+/* Add all properties to an ARGV
+ *
+ * @param argvchild: Pointer to the ARGV.
+ * @param proplist: The property list
+ */
+int property_add_to_argv(char **argvchild, proplist_t proplist);
+
 #endif /* ! CONFFILE_H */
index ed036e48599056208a027e9fa3a55d9455ee5e32..dff138337fb66c36df5b8f3618a8ad6a6136ae60 100644 (file)
@@ -64,7 +64,7 @@ static time_t open_time;
 static void (*logerror_fn)(char *) = NULL;
 
 /* storage for global variables */
-erroutput_type_t erroutput_type = ERR_INTERACTIVE;
+erroutput_type_t erroutput_type = ERR_FROM_CONTEXT;
 int error_exit_status = 1;
 
 /* static function prototypes */
@@ -126,29 +126,60 @@ debug_logging_handler(const gchar *log_domain G_GNUC_UNUSED,
            gpointer user_data G_GNUC_UNUSED)
 {
     char *maxlevel = NULL;
+    pcontext_t context = get_pcontext();
+
+    /* scriptutil context doesn't do any logging except for critical
+     * and error levels */
+    if (context != CONTEXT_SCRIPTUTIL) {
+       /* convert the highest level to a string and dbprintf it */
+       if (log_level & G_LOG_LEVEL_ERROR)
+           maxlevel = _("error (fatal): ");
+       else if (log_level & G_LOG_LEVEL_CRITICAL)
+           maxlevel = _("critical (fatal): ");
+       else if (log_level & G_LOG_LEVEL_WARNING)
+           maxlevel = _("warning: ");
+       else if (log_level & G_LOG_LEVEL_MESSAGE)
+           maxlevel = _("message: ");
+       else if (log_level & G_LOG_LEVEL_INFO)
+           maxlevel = _("info: ");
+       else
+           maxlevel = ""; /* no level displayed for debugging */
 
-    /* convert the highest level to a string and dbprintf it */
-    if (log_level & G_LOG_LEVEL_ERROR)
-       maxlevel = _("error (fatal): ");
-    else if (log_level & G_LOG_LEVEL_CRITICAL)
-       maxlevel = _("critical (fatal): ");
-    else if (log_level & G_LOG_LEVEL_WARNING)
-       maxlevel = _("warning: ");
-    else if (log_level & G_LOG_LEVEL_MESSAGE)
-       maxlevel = _("message: ");
-    else if (log_level & G_LOG_LEVEL_INFO)
-       maxlevel = _("info: ");
-    else
-       maxlevel = ""; /* no level displayed for debugging */
-
-    debug_printf("%s%s\n", maxlevel, message);
+       debug_printf("%s%s\n", maxlevel, message);
+    }
 
     /* error and critical levels have special handling */
     if (log_level & (G_LOG_LEVEL_ERROR|G_LOG_LEVEL_CRITICAL)) {
-       if (erroutput_type & ERR_AMANDALOG && logerror_fn != NULL)
+       erroutput_type_t local_erroutput;
+
+       /* Calculate a local version of erroutput_type, based on the
+        * context if the process has not set erroutput_type explicitly */
+       if (!(erroutput_type & ERR_FROM_CONTEXT)) {
+           local_erroutput = erroutput_type;
+       } else {
+           switch (context) {
+               case CONTEXT_SCRIPTUTIL:
+                   local_erroutput = ERR_INTERACTIVE;
+                   break;
+
+               case CONTEXT_DAEMON:
+                   local_erroutput = ERR_INTERACTIVE
+                                   | ERR_AMANDALOG
+                                   | ERR_SYSLOG;
+                   break;
+
+               case CONTEXT_CMDLINE:
+               case CONTEXT_DEFAULT:
+               default:
+                   local_erroutput = ERR_INTERACTIVE;
+                   break;
+           }
+       }
+
+       if (local_erroutput & ERR_AMANDALOG && logerror_fn != NULL)
            (*logerror_fn)((char *)message); /* discard 'const' */
 
-       if (erroutput_type & ERR_SYSLOG) {
+       if (local_erroutput & ERR_SYSLOG) {
 #ifdef LOG_AUTH
            openlog(get_pname(), LOG_PID, LOG_AUTH);
 #else
@@ -158,7 +189,7 @@ debug_logging_handler(const gchar *log_domain G_GNUC_UNUSED,
            closelog();
        }
 
-       if (erroutput_type & ERR_INTERACTIVE) {
+       if (local_erroutput & ERR_INTERACTIVE) {
            g_fprintf(stderr, "%s: %s\n", get_pname(), message);
            fflush(stderr);
        }
@@ -379,9 +410,10 @@ debug_setup_2(
        /*
         * Make the first debug log file entry.
         */
-       debug_printf(_("pid %ld ruid %ld euid %ld: %s at %s"),
+       debug_printf(_("pid %ld ruid %ld euid %ld version %s: %s at %s"),
                     (long)getpid(),
                     (long)getuid(), (long)geteuid(),
+                    VERSION,
                     annotation,
                     ctime(&open_time));
     }
@@ -410,6 +442,19 @@ msg_timestamp(void)
  * ---- public functions
  */
 
+void
+debug_init(void)
+{
+    debug_setup_logging();
+
+    /* the scriptutil context does not create a debug log, since such
+     * processes are invoked many times.
+     */
+    if (get_pcontext() != CONTEXT_SCRIPTUTIL) {
+       debug_open(get_ptype());
+    }
+}
+
 void
 set_logerror(void (*f)(char *))
 {
@@ -647,6 +692,7 @@ printf_arglist_function(void debug_printf, const char *, format)
 {
     va_list argp;
     int save_errno;
+    static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
 
     /*
      * It is common in the code to call dbprintf to write out
@@ -662,6 +708,7 @@ printf_arglist_function(void debug_printf, const char *, format)
        db_file = stderr;
     }
     if(db_file != NULL) {
+       g_static_mutex_lock(&mutex);
        if (db_file != stderr)
            g_fprintf(db_file, "%s: %s: ", msg_timestamp(), get_pname());
        else 
@@ -670,6 +717,7 @@ printf_arglist_function(void debug_printf, const char *, format)
        g_vfprintf(db_file, format, argp);
        arglist_end(argp);
        fflush(db_file);
+       g_static_mutex_unlock(&mutex);
     }
     errno = save_errno;
 }
index b3d539e930155c099d451257e951146e760f6771..13894be7676b961d14fb8900a5aa432e4e3b71da 100644 (file)
@@ -53,8 +53,9 @@
  *  g_info -- helpful extra details, but not verbose
  *  g_debug -- debug messages
  *
- * g_error and g_critical will respect erroutput_type, potentially
- * sending the error to the Amanda logfile for this run (see logfile.c).
+ * g_error and g_critical will respect erroutput_type, or if that has not
+ * been set explicitly, the current process context (get_pcontext). This can
+ * mean sending the error to the Amanda logfile for this run (see logfile.c).
  */
 
 /* g_debug was introduced in glib 2.6, so define it here for systems where
 #define g_info(...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, __VA_ARGS__)
 #endif
 
+/* Initialize the debugging interface.  This is the "high-level"
+ * initialization function; older and lower-level applications can call
+ * dbopen() and friends directly.
+ *
+ * This function sets up debug logging and error-handling according to
+ * the current process name, type, and context, as defined in util.
+ */
+void debug_init(void);
+
 /*
  * FATAL ERROR HANDLING
  */
@@ -80,7 +90,8 @@
 #define errordump(...) do { g_error(__VA_ARGS__); abort(); } while (0)
 #define error(...) do { g_critical(__VA_ARGS__); exit(error_exit_status); } while (0)
 
-/* Additional handling for error and critical messages. */
+/* Additional handling for error and critical messages.  Leave this
+ * set to its default if you're using debug_init(). */
 typedef enum {
     /* send message to stderr (for interactive programs) */
     ERR_INTERACTIVE    = 1 << 0, /* (default) */
@@ -90,7 +101,12 @@ typedef enum {
 
     /* add an L_FATAL entry in the Amanda logfile for the 
      * current run */
-    ERR_AMANDALOG      = 1 << 2
+    ERR_AMANDALOG      = 1 << 2,
+
+    /* the default situation -- do whatever's appropriate for
+     * the current context.  If this is set, the other flags
+     * are ignored. */
+    ERR_FROM_CONTEXT   = 1 << 3,
 } erroutput_type_t;
 extern erroutput_type_t erroutput_type;
 
@@ -103,7 +119,7 @@ extern int error_exit_status;
  * ERR_AMANDALOG is set.
  *
  * This function is required because libamanda, which contains
- * debug.c, is not always linked with the logerror module 
+ * debug.c, is not always linked with the logerror module
  * (which only appears in server applications).
  *
  * @param logerror_fn: function pointer
index 7fbabb0c517339be80df497ff4b9d06a1306c4aa..f0e80ec837f0573e55ebe02a59bab189458575dc 100644 (file)
@@ -64,6 +64,7 @@ dgram_bind(
 
     portrange = getconf_intrange(CNF_RESERVED_UDP_PORT);
     *portp = (in_port_t)0;
+    g_debug("dgram_bind: setting up a socket with family %d", family);
     if((s = socket(family, SOCK_DGRAM, 0)) == -1) {
        save_errno = errno;
        dbprintf(_("dgram_bind: socket() failed: %s\n"),
@@ -158,6 +159,7 @@ dgram_send_addr(
        s = dgram->socket;
        socket_opened = 0;
     } else {
+       g_debug("dgram_send_addr: setting up a socket with family %d", SU_GET_FAMILY(addr));
        if((s = socket(SU_GET_FAMILY(addr), SOCK_DGRAM, 0)) == -1) {
            save_errno = errno;
            dbprintf(_("dgram_send_addr: socket() failed: %s\n"),
diff --git a/common-src/event-test.c b/common-src/event-test.c
new file mode 100644 (file)
index 0000000..6a3bb15
--- /dev/null
@@ -0,0 +1,650 @@
+/*
+ * Copyright (c) 2008 Zmanda Inc.  All Rights Reserved.
+ * 
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ * 
+ * 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.,
+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ * 
+ * Contact information: Zmanda Inc, 465 N Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ *
+ * Author: Dustin J. Mitchell <dustin@zmanda.com>
+ */
+
+#include "amanda.h"
+#include "testutils.h"
+#include "event.h"
+
+/* a random global variable to flag that some function has been called */
+static int global;
+
+/* file descriptor under EV_READFD or EV_WRITEFD */
+static int cb_fd;
+
+/* and some easy access to the event handles for callbacks */
+static event_handle_t *hdl[10];
+
+/*
+ * Utils
+ */
+
+/* A common event callback that just decrements 'global', and frees
+ * hdl[0] if global reaches zero.
+ */
+static void
+test_decrement_cb(void *up G_GNUC_UNUSED)
+{
+    global--;
+    tu_dbg("Decrement global to %d\n", global);
+    if (global == 0) {
+       tu_dbg("Release event\n");
+       event_release(hdl[0]);
+    }
+}
+
+/*
+ * Tests
+ */
+
+/****
+ * Test that EV_TIME events fire, repeatedly.
+ */
+static int
+test_ev_time(void)
+{
+    global = 2;
+    hdl[0] = event_register(1, EV_TIME, test_decrement_cb, NULL);
+
+    /* Block waiting for the event to fire.  The event itself eventually
+     * unregisters itself, causing the event_loop to finish */
+    event_loop(0);
+
+    return (global == 0);
+}
+
+/****
+ * Test that nonblocking waits don't block.
+ */
+static int
+test_nonblock(void)
+{
+    global = 1; /* the callback should not be triggered, so this should stay 1 */
+    hdl[0] = event_register(1, EV_TIME, test_decrement_cb, NULL);
+
+    event_loop(1); /* non-blocking */
+
+    return (global != 0);
+}
+
+/****
+ * Test that EV_WAIT events fire when event_wakeup is called, without waiting for
+ * another iteration of the event loop.  Security API depends on callbacks occuring
+ * immediately.
+ */
+static int
+test_ev_wait(void)
+{
+    global = 2;
+    hdl[0] = event_register(4422, EV_WAIT, test_decrement_cb, NULL);
+
+    if (global != 2) return 0;
+    event_wakeup(4422);
+    if (global != 1) return 0;
+    event_wakeup(4422);
+    if (global != 0) return 0;
+    event_wakeup(4422); /* the handler has been removed, but this is not an error */
+    if (global != 0) return 0;
+
+    /* queue should now be empty, so this won't block */
+    event_loop(0);
+
+    return 1;
+}
+
+/****
+ * Test that EV_WAIT events with the same ID added during an EV_WAIT callback are not
+ * called back immediately, but wait for a subsequent wakeup.  Security API depends on
+ * this behavior.  This is a pathological test :)
+ */
+static void
+test_ev_wait_2_cb(void *up G_GNUC_UNUSED)
+{
+    global--;
+    tu_dbg("Decrement global to %d\n", global);
+
+    if (global >= 0) {
+       tu_dbg("release EV_WAIT event\n");
+       event_release(hdl[0]);
+    }
+    if (global > 0) {
+       tu_dbg("register new EV_WAIT event with same ID\n");
+       hdl[0] = event_register(84, EV_WAIT, test_ev_wait_2_cb, NULL);
+    }
+}
+
+static int
+test_ev_wait_2(void)
+{
+    global = 2;
+    hdl[0] = event_register(84, EV_WAIT, test_ev_wait_2_cb, NULL);
+
+    /* Each wakeup should only invoke the callback *once* */
+    if (global != 2) return 0;
+    event_wakeup(84);
+    if (global != 1) return 0;
+    event_wakeup(84);
+    if (global != 0) return 0;
+    event_wakeup(84); /* the handler has been removed, but this is not an error */
+    if (global != 0) return 0;
+
+    return 1;
+}
+
+/****
+ * Test that event_wait correctly waits for a EV_TIME event to fire, even when
+ * other events are running.  */
+static void
+test_event_wait_cb(void *up G_GNUC_UNUSED)
+{
+    int *cb_fired = (int *)up;
+    (*cb_fired) = 1;
+
+    /* immediately unregister ourselves */
+    tu_dbg("test_event_wait_cb called\n");
+    event_release(hdl[1]);
+}
+
+static int
+test_event_wait(void)
+{
+    int cb_fired = 0;
+    global = 3;
+
+    /* this one serves as a "decoy", running in the background while we wait
+     * for test_event_wait_cb */
+    hdl[0] = event_register(1, EV_TIME, test_decrement_cb, NULL);
+
+    /* this is our own callback */
+    hdl[1] = event_register(2, EV_TIME, test_event_wait_cb, (void *)&cb_fired);
+
+    /* wait until our own callback fires */
+    event_wait(hdl[1]);
+
+    /* at this point, test_decrement_cb should have fired once or twice, but not
+     * three times */
+    if (global == 0) {
+       tu_dbg("global is already zero!\n");
+       return 0;
+    }
+
+    /* and our own callback should have fired */
+    if (!cb_fired) {
+       tu_dbg("test_event_wait_cb didn't fire\n");
+       return 0;
+    }
+
+    return 1;
+}
+
+/****
+ * Test that event_wait correctly waits for a EV_WAIT event to be released, not 
+ * fired, even when other events are running.  */
+static void
+test_event_wait_2_cb(void *up)
+{
+    int *wakeups_remaining = (int *)up;
+    tu_dbg("test_event_wait_2_cb called\n");
+
+    if (--(*wakeups_remaining) == 0) {
+       /* unregister ourselves if we've awakened enough times */
+       event_release(hdl[2]);
+       hdl[2] = NULL;
+    }
+}
+
+static void
+test_event_wait_2_wakeup_cb(void *up G_GNUC_UNUSED)
+{
+    tu_dbg("test_event_wait_2_wakeup_cb called\n");
+
+    /* wake up the EV_WAIT event */
+    event_wakeup(9876);
+}
+
+static int
+test_event_wait_2(void)
+{
+    int wakeups_remaining = 2;
+    global = 3;
+
+    /* this one serves as a "decoy", running in the background while we wait
+     * for test_event_wait_2_cb */
+    hdl[0] = event_register(1, EV_TIME, test_decrement_cb, NULL);
+
+    /* This one repeatedly calls event_wakeup for the EV_WAIT event */
+    hdl[1] = event_register(1, EV_TIME, test_event_wait_2_wakeup_cb, NULL);
+
+    /* this is our own callback */
+    hdl[2] = event_register(9876, EV_WAIT, test_event_wait_2_cb, (void *)&wakeups_remaining);
+
+    /* wait until the EV_WAIT is *released*, not just fired. */
+    event_wait(hdl[2]);
+
+    /* at this point, test_decrement_cb should have fired twice, but not
+     * three times */
+    if (global == 0) {
+       tu_dbg("global is already zero!\n");
+       return 0;
+    }
+
+    /* and our own callback should have fired twice, not just once */
+    if (wakeups_remaining != 0) {
+       tu_dbg("test_event_wait_2_cb didn't fire twice\n");
+       return 0;
+    }
+
+    return 1;
+}
+
+/****
+ * Test that EV_READFD is triggered correctly when there's data available
+ * for reading.  The source of read events is a spawned child which writes
+ * lots of data to a pipe, in hopes of overflowing the pipe buffer.
+ */
+static void
+test_ev_readfd_cb(void *up G_GNUC_UNUSED)
+{
+    char buf[1024];
+    int len;
+
+    /* read from the fd until we're out of bytes */
+    tu_dbg("reader: callback executing\n");
+    len = read(cb_fd, buf, sizeof(buf));
+    if (len == 0) {
+       tu_dbg("reader: callback returning\n");
+    } else if (len < 0) {
+       tu_dbg("reader: read() returned %d: %s\n", len, strerror(errno));
+       /* do we need to handle e.g., EAGAIN here? */
+    } else {
+       tu_dbg("reader: read %d bytes\n", len);
+       global -= len;
+       /* release this event if we've read all of the available bytes */
+       if (global <= 0) {
+           close(cb_fd);
+           event_release(hdl[0]);
+       }
+    }
+}
+
+static void
+test_ev_readfd_writer(int fd, size_t count)
+{
+    char buf[256];
+    size_t i;
+
+    for (i = 0; i < sizeof(buf); i++) {
+       buf[i] = (char)i;
+    }
+
+    while (count > 0) {
+       int len;
+
+       len = write(fd, buf, min(sizeof(buf), count));
+       tu_dbg("writer wrote %d bytes\n", len);
+       count -= len;
+    }
+
+    close(fd);
+}
+
+#define TEST_EV_READFD_SIZE (1024*1024)
+
+static int
+test_ev_readfd(void)
+{
+    int writer_pid;
+    int p[2];
+
+    /* make a pipe */
+    if (pipe(p) == -1) {
+       exit(1);
+    }
+
+    /* fork off the writer */
+    switch (writer_pid = fork()) {
+       case 0: /* child */
+           close(p[0]);
+           test_ev_readfd_writer(p[1], TEST_EV_READFD_SIZE);
+           exit(0);
+           break;
+
+       case -1: /* error */
+           perror("fork");
+           return 0;
+
+       default: /* parent */
+           break;
+    }
+
+    /* set up a EV_READFD on the read end of the pipe */
+    cb_fd = p[0];
+    fcntl(cb_fd, F_SETFL, O_NONBLOCK);
+    close(p[1]);
+    global = TEST_EV_READFD_SIZE;
+    hdl[0] = event_register(p[0], EV_READFD, test_ev_readfd_cb, NULL);
+
+    /* let it run */
+    event_loop(0);
+
+    tu_dbg("waiting for writer to die..\n");
+    waitpid(writer_pid, NULL, 0);
+
+    if (global != 0) {
+       tu_dbg("%d bytes remain unread..\n", global);
+       return 0;
+    }
+
+    return 1;
+}
+
+/****
+ * Test the combination of an EV_TIME and an EV_READFD to peform a 
+ * timeout-protected read that times out.
+ */
+static void
+test_read_timeout_slow_writer(int fd)
+{
+    char buf[] = "OH NO!";
+
+    /* this should exceed the timeout, which is 1s */
+    sleep(2);
+
+    if (write(fd, buf, strlen(buf)+1) == -1) {
+       exit(1);
+    }
+    close(fd);
+}
+
+static void
+test_read_timeout_cb(void *up G_GNUC_UNUSED)
+{
+    tu_dbg("read timed out (this is supposed to happen)\n");
+    global = 1234; /* sentinel value */
+
+    /* free up all of the events so that event_loop returns */
+    event_release(hdl[0]);
+    event_release(hdl[1]);
+}
+
+static int
+test_read_timeout(void)
+{
+    int writer_pid;
+    int p[2];
+
+    /* make a pipe */
+    if (pipe(p) == -1) {
+       exit(1);
+    }
+
+    /* fork off the writer */
+    switch (writer_pid = fork()) {
+       case 0: /* child */
+           close(p[0]);
+           test_read_timeout_slow_writer(p[1]);
+           exit(0);
+           break;
+
+       case -1: /* error */
+           perror("fork");
+           return 0;
+
+       default: /* parent */
+           break;
+    }
+
+    /* set up a EV_READFD on the read end of the pipe */
+    cb_fd = p[0];
+    fcntl(cb_fd, F_SETFL, O_NONBLOCK);
+    close(p[1]);
+    hdl[0] = event_register(p[0], EV_READFD, test_ev_readfd_cb, NULL);
+
+    /* and set up a timeout */
+    global = 0;        /* timeout_cb will set this to 1234 */
+    hdl[1] = event_register(1, EV_TIME, test_read_timeout_cb, NULL);
+
+    /* let it run */
+    event_loop(0);
+
+    /* see if we got the sentinel indicating the timeout fired */
+    if (global != 1234)
+       return 0;
+
+    return 1;
+}
+
+/****
+ * Test that EV_WRITEFD is triggered correctly when there's buffer space to
+ * support a write.  
+ */
+
+static void
+test_ev_writefd_cb(void *up G_GNUC_UNUSED)
+{
+    char buf[1024];
+    int len;
+    unsigned int i;
+
+    /* initialize the buffer to something worthwhile */
+    for (i = 0; i < sizeof(buf); i++) {
+       buf[i] = (char)i;
+    }
+
+    /* write some bytes, but no more than global */
+    tu_dbg("test_ev_writefd_cb called\n");
+    while (1) {
+       len = write(cb_fd, buf, min((size_t)global, sizeof(buf)));
+       if (len < 0) {
+           tu_dbg("test_ev_writefd_cb: write() returned %d\n", len);
+           return;
+       } else if (len == 0) {
+           /* do we need to handle EAGAIN, etc. here? */
+           tu_dbg("test_ev_writefd_cb done\n");
+           return;
+       }
+       tu_dbg(" write() wrote %d bytes\n", len);
+       global -= len;
+       if (global <= 0) {
+           close(cb_fd);
+           event_release(hdl[0]);
+           return;
+       }
+    }
+}
+
+static void
+test_ev_writefd_consumer(int fd, size_t count)
+{
+    while (count > 0) {
+       char buf[1024];
+       int len;
+
+       tu_dbg("reader: calling read(%d)\n", (int)sizeof(buf));
+       len = read(fd, buf, sizeof(buf));
+
+       /* exit on a read error or EOF */
+       if (len < 1) return;
+
+       tu_dbg("reader: read() returned %d bytes\n", len);
+
+       count -= len;
+    }
+}
+
+#define TEST_EV_WRITEFD_SIZE (1024*1024)
+
+static int
+test_ev_writefd(void)
+{
+    int reader_pid;
+    int p[2];
+
+    /* make a pipe */
+    if (pipe(p) == -1) {
+       exit(1);
+    }
+
+    /* fork off the reader */
+    switch (reader_pid = fork()) {
+       case 0: /* child */
+           close(p[1]);
+           test_ev_writefd_consumer(p[0], TEST_EV_WRITEFD_SIZE);
+           exit(0);
+           break;
+
+       case -1: /* error */
+           perror("fork");
+           return 0;
+
+       default: /* parent */
+           break;
+    }
+
+    /* set up a EV_WRITEFD on the write end of the pipe */
+    cb_fd = p[1];
+    fcntl(cb_fd, F_SETFL, O_NONBLOCK);
+    global = TEST_EV_WRITEFD_SIZE;
+    close(p[0]);
+    hdl[0] = event_register(p[1], EV_WRITEFD, test_ev_writefd_cb, NULL);
+
+    /* let it run */
+    event_loop(0);
+
+    tu_dbg("waiting for reader to die..\n");
+    waitpid(reader_pid, NULL, 0);
+
+    /* and see what we got */
+    if (global != 0) {
+       tu_dbg("writes did not complete\n");
+       return 0;
+    }
+
+    return 1;
+}
+
+/****
+ * Test that a child_watch_source works correctly.
+ */
+
+static gint test_child_watch_result = 0;
+static GMainLoop *test_child_watch_main_loop = NULL;
+
+static void
+test_child_watch_callback(
+    pid_t pid,
+    gint status,
+    gpointer data)
+{
+    static int count = 0;
+    gint expected_pid = GPOINTER_TO_INT(data);
+
+    if (pid != expected_pid
+           || !WIFEXITED(status)
+           || WEXITSTATUS(status) != 13)
+       test_child_watch_result = FALSE;
+    else
+       test_child_watch_result = TRUE;
+
+    count++;
+    if(count >= 2)
+       g_main_loop_quit(test_child_watch_main_loop);
+}
+
+static int
+test_child_watch_source(void)
+{
+    int pid, pid2;
+    GSource *src, *src2;
+
+    /* fork off the child we want to watch die */
+    switch (pid = fork()) {
+       case 0: /* child */
+           exit(13);
+           break;
+
+       case -1: /* error */
+           perror("fork");
+           return 0;
+
+       default: /* parent */
+           break;
+    }
+
+    /* set up a child watch */
+    src = new_child_watch_source(pid);
+    g_source_set_callback(src, (GSourceFunc)test_child_watch_callback,
+            GINT_TO_POINTER(pid), NULL);
+    g_source_attach(src, NULL);
+    g_source_unref(src);
+
+    switch (pid2 = fork()) {
+       case 0: /* child */
+           exit(13);
+           break;
+
+       case -1: /* error */
+           perror("fork");
+           return 0;
+
+       default: /* parent */
+           break;
+    }
+
+    sleep(1);
+    /* set up a child watch */
+    src2 = new_child_watch_source(pid2);
+    g_source_set_callback(src2, (GSourceFunc)test_child_watch_callback,
+            GINT_TO_POINTER(pid2), NULL);
+    g_source_attach(src2, NULL);
+    g_source_unref(src2);
+
+    /* let it run */
+    test_child_watch_main_loop = g_main_loop_new(NULL, 1);
+    g_main_loop_run(test_child_watch_main_loop);
+
+    return test_child_watch_result;
+}
+
+/*
+ * Main driver
+ */
+
+int
+main(int argc, char **argv)
+{
+    static TestUtilsTest tests[] = {
+       TU_TEST(test_ev_time, 10),
+       TU_TEST(test_ev_wait, 10),
+       TU_TEST(test_ev_wait_2, 10),
+       TU_TEST(test_ev_readfd, 60), /* runs slowly on old kernels */
+       TU_TEST(test_ev_writefd, 60),
+       TU_TEST(test_event_wait, 10),
+       TU_TEST(test_event_wait_2, 10),
+       TU_TEST(test_nonblock, 10),
+       TU_TEST(test_read_timeout, 10),
+       TU_TEST(test_child_watch_source, 5),
+       /* fdsource is used by ev_readfd/ev_writefd, and is sufficiently tested there */
+       TU_END()
+    };
+
+    return testutils_run_tests(argc, argv, tests);
+}
index 11bad8bf576575ef3d58c2b9e514328d4e71fd3a..474e87138107daae2079bedb0c2c646b446a3c7a 100644 (file)
  * Event handler.  Serializes different kinds of events to allow for
  * a uniform interface, central state storage, and centralized
  * interdependency logic.
+ *
+ * This is a compatibility wrapper over Glib's GMainLoop.  New code should
+ * use Glib's interface directly.
+ *
+ * Each event_handle is associated with a unique GSource, identified by it
+ * event_source_id.
  */
 
 #include "amanda.h"
-#include "event.h"
-#include "queue.h"
 #include "conffile.h"
+#include "event.h"
+#include "glib-util.h"
+
+/* TODO: use mem chunks to allocate event_handles */
+/* TODO: lock stuff for threading */
 
+/* Write a debugging message if the config variable debug_event
+ * is greater than or equal to i */
 #define event_debug(i, ...) do {       \
        if ((i) <= debug_event) {       \
            dbprintf(__VA_ARGS__);      \
 struct event_handle {
     event_fn_t fn;             /* function to call when this fires */
     void *arg;                 /* argument to pass to previous function */
+
     event_type_t type;         /* type of event */
     event_id_t data;           /* type data */
-    time_t lastfired;          /* timestamp of last fired (EV_TIME only) */
-    LIST_ENTRY(event_handle) le; /* queue handle */
-};
 
-/*
- * eventq is a queue of currently active events.
- * cache is a queue of unused handles.  We keep a few around to avoid
- * malloc overhead when doing a lot of register/releases.
- */
-static struct {
-    LIST_HEAD(, event_handle) listhead;
-    int qlength;
-} eventq = {
-    LIST_HEAD_INITIALIZER(eventq.listhead), 0
-}, cache = {
-    LIST_HEAD_INITIALIZER(eventq.listhead), 0
+    GSource *source;           /* Glib event source, if one exists */
+    guint source_id;           /* ID of the glib event source */
+
+    gboolean has_fired;                /* for use by event_wait() */
+    gboolean is_dead;          /* should this event be deleted? */
 };
-#define        eventq_first(q)         LIST_FIRST(&q.listhead)
-#define        eventq_next(eh)         LIST_NEXT(eh, le)
-#define        eventq_add(q, eh)       LIST_INSERT_HEAD(&q.listhead, eh, le);
-#define        eventq_remove(eh)       LIST_REMOVE(eh, le);
 
-/*
- * How many items we can have in the handle cache before we start
- * freeing.
- */
-#define        CACHEDEPTH      10
+/* A list of all extant event_handle objects, used for searching for particular
+ * events and for deleting dead events */
+GSList *all_events;
 
 /*
- * A table of currently set signal handlers.
+ * Utility functions
  */
-static struct sigtabent {
-    event_handle_t *handle;    /* handle for this signal */
-    int score;                 /* number of signals recvd since last checked */
-    void (*oldhandler)(int);/* old handler (for unsetting) */
-} sigtable[NSIG];
-
-static const char *event_type2str(event_type_t);
-#define        fire(eh)        (*(eh)->fn)((eh)->arg)
-static void signal_handler(int);
-static event_handle_t *gethandle(void);
-static void puthandle(event_handle_t *);
-static int event_loop_wait (event_handle_t *, const int);
+
+static const char *event_type2str(event_type_t type);
+
+/* "Fire" an event handle, by calling its callback function */
+#define        fire(eh) do { \
+       event_debug(1, "firing %p: %s/%jd\n", eh, event_type2str((eh)->type), (eh)->data); \
+       (*(eh)->fn)((eh)->arg); \
+       (eh)->has_fired = TRUE; \
+} while(0)
+
+/* Adapt a Glib callback to an event_handle_t callback; assumes that the
+ * user_ptr for the Glib callback is a pointer to the event_handle_t.  */
+static gboolean 
+event_handle_callback(
+    gpointer user_ptr)
+{
+    event_handle_t *hdl = (event_handle_t *)user_ptr;
+
+    /* if the handle is dead, then don't fire the callback; this means that
+     * we're in the process of freeing the event */
+    if (!hdl->is_dead) {
+       fire(hdl);
+    }
+
+    /* don't ever let GMainLoop destroy GSources */
+    return TRUE;
+}
 
 /*
- * Add a new event.  See the comment in event.h for what the arguments
- * mean.
+ * Public functions
  */
+
 event_handle_t *
 event_register(
     event_id_t data,
@@ -107,42 +118,79 @@ event_register(
     void *arg)
 {
     event_handle_t *handle;
+    GIOCondition cond;
 
+    /* sanity-checking */
     if ((type == EV_READFD) || (type == EV_WRITEFD)) {
        /* make sure we aren't given a high fd that will overflow a fd_set */
        if (data >= (int)FD_SETSIZE) {
-           error(_("event_register: Invalid file descriptor %lu"), data);
+           error(_("event_register: Invalid file descriptor %jd"), data);
            /*NOTREACHED*/
        }
-#if !defined(__lint) /* Global checking knows that these are never called */
-    } else if (type == EV_SIG) {
-       /* make sure signals are within range */
-       if (data >= NSIG) {
-           error(_("event_register: Invalid signal %lu"), data);
-           /*NOTREACHED*/
-       }
-       if (sigtable[data].handle != NULL) { 
-           error(_("event_register: signal %lu already registered"), data);
-           /*NOTREACHED*/
+    } else if (type == EV_TIME) {
+       if (data <= 0) {
+           error(_("event_register: interval for EV_TIME must be greater than 0; got %jd"), data);
        }
-    } else if (type >= EV_DEAD) {
-       error(_("event_register: Invalid event type %d"), type);
-       /*NOTREACHED*/
-#endif
     }
 
-    handle = gethandle();
+    handle = g_new0(event_handle_t, 1);
     handle->fn = fn;
     handle->arg = arg;
     handle->type = type;
     handle->data = data;
-    handle->lastfired = -1;
-    eventq_add(eventq, handle);
-    eventq.qlength++;
+    handle->is_dead = FALSE;
 
-    event_debug(1, _("event: register: %p->data=%lu, type=%s\n"),
+    event_debug(1, _("event: register: %p->data=%jd, type=%s\n"),
                    handle, handle->data, event_type2str(handle->type));
-    return (handle);
+
+    /* add to the list of events */
+    all_events = g_slist_prepend(all_events, (gpointer)handle);
+
+    /* and set up the GSource for this event */
+    switch (type) {
+       case EV_READFD:
+       case EV_WRITEFD:
+           /* create a new source */
+           if (type == EV_READFD) {
+               cond = G_IO_IN | G_IO_HUP | G_IO_ERR;
+           } else {
+               cond = G_IO_OUT | G_IO_ERR;
+           }
+
+           handle->source = new_fdsource(data, cond);
+
+           /* attach it to the default GMainLoop */
+           g_source_attach(handle->source, NULL);
+           handle->source_id = g_source_get_id(handle->source);
+
+           /* And set its callbacks */
+           g_source_set_callback(handle->source, event_handle_callback,
+                                 (gpointer)handle, NULL);
+
+           /* drop our reference to it, so when it's detached, it will be
+            * destroyed. */
+           g_source_unref(handle->source);
+           break;
+
+       case EV_TIME:
+           /* Glib provides a nice shortcut for timeouts.  The *1000 converts
+            * seconds to milliseconds. */
+           handle->source_id = g_timeout_add(data * 1000, event_handle_callback,
+                                             (gpointer)handle);
+
+           /* But it doesn't give us the source directly.. */
+           handle->source = g_main_context_find_source_by_id(NULL, handle->source_id);
+           break;
+
+       case EV_WAIT:
+           /* nothing to do -- these are handled independently of GMainLoop */
+           break;
+
+       default:
+           error(_("Unknown event type %s"), event_type2str(type));
+    }
+
+    return handle;
 }
 
 /*
@@ -154,37 +202,15 @@ void
 event_release(
     event_handle_t *handle)
 {
-
     assert(handle != NULL);
 
-    event_debug(1, _("event: release (mark): %p data=%lu, type=%s\n"),
+    event_debug(1, _("event: release (mark): %p data=%jd, type=%s\n"),
                    handle, handle->data,
                    event_type2str(handle->type));
-    assert(handle->type != EV_DEAD);
-
-    /*
-     * For signal events, we need to specially remove then from the
-     * signal event table.
-     */
-    if (handle->type == EV_SIG) {
-       struct sigtabent *se = &sigtable[handle->data];
-
-       assert(se->handle == handle);
-       signal((int)handle->data, se->oldhandler);
-       se->handle = NULL;
-       se->score = 0;
-    }
-
-    /*
-     * Decrement the qlength now since this is no longer a real
-     * event.
-     */
-    eventq.qlength--;
+    assert(!handle->is_dead);
 
-    /*
-     * Mark it as dead and leave it for the loop to remove.
-     */
-    handle->type = EV_DEAD;
+    /* Mark it as dead and leave it for the event_loop to remove */
+    handle->is_dead = TRUE;
 }
 
 /*
@@ -194,401 +220,153 @@ int
 event_wakeup(
     event_id_t id)
 {
-    event_handle_t *eh;
+    GSList *iter;
+    GSList *tofire = NULL;
     int nwaken = 0;
 
-    event_debug(1, _("event: wakeup: enter (%lu)\n"), id);
+    event_debug(1, _("event: wakeup: enter (%jd)\n"), id);
 
-    for (eh = eventq_first(eventq); eh != NULL; eh = eventq_next(eh)) {
+    /* search for any and all matching events, and record them.  This way
+     * we have determined the whole list of events we'll be firing *before*
+     * we fire any of them. */
+    for (iter = all_events; iter != NULL; iter = g_slist_next(iter)) {
+       event_handle_t *eh = (event_handle_t *)iter->data;
+       if (eh->type == EV_WAIT && eh->data == id && !eh->is_dead) {
+           tofire = g_slist_append(tofire, (gpointer)eh);
+       }
+    }
 
-       if (eh->type == EV_WAIT && eh->data == id) {
-           event_debug(1, _("event: wakeup: %p id=%lu\n"), eh, id);
+    /* fire them */
+    for (iter = tofire; iter != NULL; iter = g_slist_next(iter)) {
+       event_handle_t *eh = (event_handle_t *)iter->data;
+       if (eh->type == EV_WAIT && eh->data == id && !eh->is_dead) {
+           event_debug(1, _("A: event: wakeup triggering: %p id=%jd\n"), eh, id);
            fire(eh);
            nwaken++;
        }
     }
+
+    /* and free the temporary list */
+    g_slist_free(tofire);
+
     return (nwaken);
 }
 
 
 /*
- * The event loop.  We need to be specially careful here with adds and
- * deletes.  Since adds and deletes will often happen while this is running,
- * we need to make sure we don't end up referencing a dead event handle.
+ * The event loop.
  */
+
+static void event_loop_wait (event_handle_t *, const int);
+
 void
 event_loop(
-    const int dontblock)
+    int nonblock)
 {
-    event_loop_wait((event_handle_t *)NULL, dontblock);
+    event_loop_wait(NULL, nonblock);
 }
 
-
-
-int
+void
 event_wait(
     event_handle_t *eh)
 {
-    return event_loop_wait(eh, 0);
+    event_loop_wait(eh, 0);
 }
 
-/*
- * The event loop.  We need to be specially careful here with adds and
- * deletes.  Since adds and deletes will often happen while this is running,
- * we need to make sure we don't end up referencing a dead event handle.
+/* Flush out any dead events in all_events.  Be careful that this
+ * isn't called while someone is iterating over all_events.
+ *
+ * @param wait_eh: the event handle we're waiting on, which shouldn't
+ *         be flushed.
  */
-static int
-event_loop_wait(
-    event_handle_t *wait_eh,
-    const int       dontblock)
+static void
+flush_dead_events(event_handle_t *wait_eh)
 {
-#ifdef ASSERTIONS
-    static int entry = 0;
-#endif
-    SELECT_ARG_TYPE readfds, writefds, errfds, werrfds;
-    struct timeval timeout, *tvptr;
-    int ntries, maxfd, rc;
-    long interval;
-    time_t curtime;
-    event_handle_t *eh, *nexteh;
-    struct sigtabent *se;
-    int event_wait_fired = 0;
-    int see_event;
-
-    event_debug(1, _("event: loop: enter: dontblock=%d, qlength=%d, eh=%p\n"),
-                   dontblock, eventq.qlength, wait_eh);
-
-    /*
-     * If we have no events, we have nothing to do
-     */
-    if (eventq.qlength == 0)
-       return 0;
-
-    /*
-     * We must not be entered twice
-     */
-    assert(++entry == 1);
-
-    ntries = 0;
-
-    /*
-     * Save a copy of the current time once, to reduce syscall load
-     * slightly.
-     */
-    curtime = time(NULL);
-
-    do {
-       if (debug_event >= 1) {
-           event_debug(1, _("event: loop: dontblock=%d, qlength=%d eh=%p\n"),
-                           dontblock, eventq.qlength, wait_eh);
-           for (eh = eventq_first(eventq); eh != NULL; eh = eventq_next(eh)) {
-               event_debug(1, _("%p): %s data=%lu fn=%p arg=%p\n"),
-                               eh, event_type2str(eh->type), eh->data, eh->fn,
-                               eh->arg);
-           }
-       }
-       /*
-        * Set ourselves up with no timeout initially.
-        */
-       timeout.tv_sec = 0;
-       timeout.tv_usec = 0;
-
-       /*
-        * If we can block, initially set the tvptr to NULL.  If
-        * we come across timeout events in the loop below, they
-        * will set it to an appropriate buffer.  If we don't
-        * see any timeout events, then tvptr will remain NULL
-        * and the select will properly block indefinately.
-        *
-        * If we can't block, set it to point to the timeout buf above.
-        */
-       if (dontblock)
-           tvptr = &timeout;
-       else
-           tvptr = NULL;
-
-       /*
-        * Rebuild the select bitmasks each time.
-        */
-       FD_ZERO(&readfds);
-       FD_ZERO(&writefds);
-       FD_ZERO(&errfds);
-       maxfd = 0;
-
-       see_event = (wait_eh == (event_handle_t *)NULL);
-       /*
-        * Run through each event handle and setup the events.
-        * We save our next pointer early in case we GC some dead
-        * events.
-        */
-       for (eh = eventq_first(eventq); eh != NULL; eh = nexteh) {
-           nexteh = eventq_next(eh);
-
-           switch (eh->type) {
-
-           /*
-            * Read fds just get set into the select bitmask
-            */
-           case EV_READFD:
-               FD_SET((int)eh->data, &readfds);
-               FD_SET((int)eh->data, &errfds);
-               maxfd = max(maxfd, (int)eh->data);
-               see_event |= (eh == wait_eh);
-               break;
-
-           /*
-            * Likewise with write fds
-            */
-           case EV_WRITEFD:
-               FD_SET((int)eh->data, &writefds);
-               FD_SET((int)eh->data, &errfds);
-               maxfd = max(maxfd, (int)eh->data);
-               see_event |= (eh == wait_eh);
-               break;
-
-           /*
-            * Only set signals that aren't already set to avoid unnecessary
-            * syscall overhead.
-            */
-           case EV_SIG:
-               se = &sigtable[eh->data];
-               see_event |= (eh == wait_eh);
-
-               if (se->handle == eh)
-                   break;
-
-               /* no previous handle */
-               assert(se->handle == NULL);
-               se->handle = eh;
-               se->score = 0;
-               /*@ignore@*/
-               se->oldhandler = signal((int)eh->data, signal_handler);
-               /*@end@*/
-               break;
-
-           /*
-            * Compute the timeout for this select
-            */
-           case EV_TIME:
-               /* if we're not supposed to block, then leave it at 0 */
-               if (dontblock)
-                   break;
-
-               if (eh->lastfired == -1)
-                   eh->lastfired = curtime;
-
-               interval = (long)(eh->data - (curtime - eh->lastfired));
-               if (interval < 0)
-                   interval = 0;
-
-               if (tvptr != NULL)
-                   timeout.tv_sec = min(timeout.tv_sec, interval);
-               else {
-                   /* this is the first timeout */
-                   tvptr = &timeout;
-                   timeout.tv_sec = interval;
-               }
-               see_event |= (eh == wait_eh);
-               break;
-
-           /*
-            * Wait events are processed immediately by event_wakeup()
-            */
-           case EV_WAIT:
-               see_event |= (eh == wait_eh);
-               break;
-
-           /*
-            * Prune dead events
-            */
-           case EV_DEAD:
-               eventq_remove(eh);
-               puthandle(eh);
-               break;
-
-           default:
-               assert(0);
-               break;
-           }
-       }
-
-       if(!see_event) {
-           assert(--entry == 0);
-           return 0;
-       }
+    GSList *iter, *next;
 
-       /*
-        * Let 'er rip
-        */
-       event_debug(1,
-                   _("event: select: dontblock=%d, maxfd=%d, timeout=%ld\n"),
-                    dontblock, maxfd,
-                    tvptr != NULL ? timeout.tv_sec : -1);
-       rc = select(maxfd + 1, &readfds, &writefds, &errfds, tvptr);
-       event_debug(1, _("event: select returns %d\n"), rc);
-
-       /*
-        * Select errors can mean many things.  Interrupted events should
-        * not be fatal, since they could be delivered signals which still
-        * need to have their events fired.
-        */
-       if (rc < 0) {
-           if (errno != EINTR) {
-               if (++ntries > 5) {
-                   error(_("select failed: %s"), strerror(errno));
-                   /*NOTREACHED*/
-               }
-               continue;
-           }
-           /* proceed if errno == EINTR, we may have caught a signal */
+    for (iter = all_events; iter != NULL; iter = next) {
+       event_handle_t *hdl = (event_handle_t *)iter->data;
+       next = g_slist_next(iter);
 
-           /* contents cannot be trusted */
-           FD_ZERO(&readfds);
-           FD_ZERO(&writefds);
-           FD_ZERO(&errfds);
-       }
+       /* (handle the case when wait_eh is dead by simply not deleting
+        * it; the next run of event_loop will take care of it) */
+       if (hdl->is_dead && hdl != wait_eh) {
+           all_events = g_slist_delete_link(all_events, iter);
+           if (hdl->source) g_source_destroy(hdl->source);
 
-       /*
-        * Grab the current time again for use in timed events.
-        */
-       curtime = time(NULL);
-
-       /*
-        * We need to copy the errfds into werrfds, so file descriptors
-        * that are being polled for both reading and writing have
-        * both of their poll events 'see' the error.
-        */
-       memcpy(&werrfds, &errfds, SIZEOF(werrfds));
-
-       /*
-        * Now run through the events and fire the ones that are ready.
-        * Don't handle file descriptor events if the select failed.
-        */
-       for (eh = eventq_first(eventq); eh != NULL; eh = eventq_next(eh)) {
-
-           switch (eh->type) {
-
-           /*
-            * Read fds: just fire the event if set in the bitmask
-            */
-           case EV_READFD:
-               if (FD_ISSET((int)eh->data, &readfds) ||
-                   FD_ISSET((int)eh->data, &errfds)) {
-                   FD_CLR((int)eh->data, &readfds);
-                   FD_CLR((int)eh->data, &errfds);
-                   fire(eh);
-                   if(eh == wait_eh) event_wait_fired = 1;
-               }
-               break;
-
-           /*
-            * Write fds: same as Read fds
-            */
-           case EV_WRITEFD:
-               if (FD_ISSET((int)eh->data, &writefds) ||
-                   FD_ISSET((int)eh->data, &werrfds)) {
-                   FD_CLR((int)eh->data, &writefds);
-                   FD_CLR((int)eh->data, &werrfds);
-                   fire(eh);
-                   if(eh == wait_eh) event_wait_fired = 1;
-               }
-               break;
-
-           /*
-            * Signal events: check the score for fires, and run the
-            * event if we got one.
-            */
-           case EV_SIG:
-               se = &sigtable[eh->data];
-               if (se->score > 0) {
-                   assert(se->handle == eh);
-                   se->score = 0;
-                   fire(eh);
-                   if(eh == wait_eh) event_wait_fired = 1;
-               }
-               break;
-
-           /*
-            * Timed events: check the interval elapsed since last fired,
-            * and set it off if greater or equal to requested interval.
-            */
-           case EV_TIME:
-               if (eh->lastfired == -1)
-                   eh->lastfired = curtime;
-               if ((curtime - eh->lastfired) >= (time_t)eh->data) {
-                   eh->lastfired = curtime;
-                   fire(eh);
-                   if(eh == wait_eh) event_wait_fired = 1;
-               }
-               break;
-
-           /*
-            * Wait events are handled immediately by event_wakeup()
-            * Dead events are handled by the pre-select loop.
-            */
-           case EV_WAIT:
-           case EV_DEAD:
-               break;
-
-           default:
-               assert(0);
-               break;
-           }
+           amfree(hdl);
        }
-    } while (!dontblock && eventq.qlength > 0 && event_wait_fired == 0);
-
-    assert(--entry == 0);
-    
-    return (event_wait_fired == 1);
+    }
 }
 
-/*
- * Generic signal handler.  Used to count caught signals for the event
- * loop.
- */
-static void
-signal_handler(
-    int        signo)
+/* Return TRUE if we have any events outstanding that can be dispatched
+ * by GMainLoop.  Recall EV_WAIT events appear in all_events, but are
+ * not dispatched by GMainLoop.  */
+static gboolean
+any_mainloop_events(void)
 {
+    GSList *iter;
+
+    for (iter = all_events; iter != NULL; iter = g_slist_next(iter)) {
+       event_handle_t *hdl = (event_handle_t *)iter->data;
+       if (hdl->type != EV_WAIT)
+           return TRUE;
+    }
 
-    assert((signo >= 0) && ((size_t)signo < (size_t)(sizeof(sigtable) / sizeof(sigtable[0]))));
-    sigtable[signo].score++;
+    return FALSE;
 }
 
-/*
- * Return a new handle.  Take from the handle cache if not empty.  Otherwise,
- * alloc a new one.
- */
-static event_handle_t *
-gethandle(void)
+static void
+event_loop_wait(
+    event_handle_t *wait_eh,
+    int nonblock)
 {
-    event_handle_t *eh;
+    event_debug(1, _("event: loop: enter: nonblockg=%d, eh=%p\n"), nonblock, wait_eh);
+
+    /* If we're waiting for a specific event, then reset its has_fired flag */
+    if (wait_eh) {
+       wait_eh->has_fired = FALSE;
+    }
 
-    if ((eh = eventq_first(cache)) != NULL) {
-       assert(cache.qlength > 0);
-       eventq_remove(eh);
-       cache.qlength--;
-       return (eh);
+    /* Keep looping until there are no events, or until wait_eh has fired */
+    while (1) {
+       /* clean up first, so we don't accidentally check a dead source */
+       flush_dead_events(wait_eh);
+
+       /* if there's nothing to wait for, then don't block, but run an
+        * iteration so that any other users of GMainLoop will get a chance
+        * to run. */
+       if (!any_mainloop_events())
+           break;
+
+       /* Do an interation */
+       g_main_context_iteration(NULL, !nonblock);
+
+       /* If the event we've been waiting for has fired or been released, as
+        * appropriate, we're done.  See the comments for event_wait in event.h
+        * for the skinny on this weird expression. */
+       if (wait_eh && ((wait_eh->type == EV_WAIT && wait_eh->is_dead)
+                    || (wait_eh->type != EV_WAIT && wait_eh->has_fired)))
+           break;
+
+       /* Don't loop if we're not blocking */
+       if (nonblock)
+           break;
     }
-    assert(cache.qlength == 0);
-    return (alloc(SIZEOF(*eh)));
+
+    /* extra cleanup, to keep all_events short, and to delete wait_eh if it
+     * has been released. */
+    flush_dead_events(NULL);
+
 }
 
-/*
- * Free a handle.  If there's space in the handle cache, put it there.
- * Otherwise, free it.
- */
-static void
-puthandle(
-    event_handle_t *eh)
+GMainLoop *
+default_main_loop(void)
 {
-
-    if (cache.qlength > CACHEDEPTH) {
-       amfree(eh);
-       return;
-    }
-    eventq_add(cache, eh);
-    cache.qlength++;
+    static GMainLoop *loop = NULL;
+    if (!loop)
+       loop = g_main_loop_new(NULL, TRUE);
+    return loop;
 }
 
 /*
@@ -605,10 +383,8 @@ event_type2str(
 #define        X(s)    { s, stringize(s) }
        X(EV_READFD),
        X(EV_WRITEFD),
-       X(EV_SIG),
        X(EV_TIME),
        X(EV_WAIT),
-       X(EV_DEAD),
 #undef X
     };
     size_t i;
@@ -618,3 +394,192 @@ event_type2str(
            return (event_types[i].name);
     return (_("BOGUS EVENT TYPE"));
 }
+
+/*
+ * FDSource -- a source for a file descriptor
+ *
+ * We could use Glib's GIOChannel for this, but it adds some buffering
+ * and Unicode functionality that we really don't want.  The custom GSource
+ * is simple enough anyway, and the Glib documentation describes it in prose.
+ */
+
+typedef struct FDSource {
+    GSource source; /* must be the first element in the struct */
+    GPollFD pollfd; /* Our file descriptor */
+} FDSource;
+
+static gboolean
+fdsource_prepare(
+    GSource *source G_GNUC_UNUSED,
+    gint *timeout_)
+{
+    *timeout_ = -1; /* block forever, as far as we're concerned */
+    return FALSE;
+}
+
+static gboolean
+fdsource_check(
+    GSource *source)
+{
+    FDSource *fds = (FDSource *)source;
+
+    /* we need to be dispatched if any interesting events have been received by the FD */
+    return fds->pollfd.events & fds->pollfd.revents;
+}
+
+static gboolean
+fdsource_dispatch(
+    GSource *source G_GNUC_UNUSED,
+    GSourceFunc callback,
+    gpointer user_data)
+{
+    if (callback)
+       return callback(user_data);
+
+    /* Don't automatically detach the event source if there's no callback. */
+    return TRUE;
+}
+
+GSource *
+new_fdsource(gint fd, GIOCondition events)
+{
+    static GSourceFuncs *fdsource_funcs = NULL;
+    GSource *src;
+    FDSource *fds;
+
+    /* initialize these here to avoid a compiler warning */
+    if (!fdsource_funcs) {
+       fdsource_funcs = g_new0(GSourceFuncs, 1);
+       fdsource_funcs->prepare = fdsource_prepare;
+       fdsource_funcs->check = fdsource_check;
+       fdsource_funcs->dispatch = fdsource_dispatch;
+    }
+
+    src = g_source_new(fdsource_funcs, sizeof(FDSource));
+    fds = (FDSource *)src;
+
+    fds->pollfd.fd = fd;
+    fds->pollfd.events = events;
+    g_source_add_poll(src, &fds->pollfd);
+
+    return src;
+}
+
+/*
+ * ChildWatchSource -- a source for a file descriptor
+ *
+ * Newer versions of glib provide equivalent functionality; consider
+ * optionally using that, protected by a GLIB_CHECK_VERSION condition.
+ */
+
+/* Versions before glib-2.4.0 didn't include a child watch source, and versions
+ * before 2.6.0 used unreliable signals.  On these versions, we implement
+ * a "dumb" version of our own invention.  This is dumb in the sense that it
+ * doesn't use SIGCHLD to detect a dead child, preferring to just poll at
+ * exponentially increasing interals.  Writing a smarter implementation runs into
+ * some tricky race conditions and extra machinery.  Since there are few, if any,
+ * users of a glib version this old, such machinery wouldn't get much testing.
+ */
+#if (GLIB_MAJOR_VERSION < 2 || (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION < 6))
+typedef struct ChildWatchSource {
+    GSource source; /* must be the first element in the struct */
+
+    pid_t pid;
+
+    gint dead;
+    gint status;
+
+    gint timeout;
+} ChildWatchSource;
+
+/* this corresponds to rapid checks for about 10 seconds, after which the
+ * waitpid() check occurs every 2 seconds. */
+#define CWS_BASE_TIMEOUT 20
+#define CWS_MULT_TIMEOUT 1.1
+#define CWS_MAX_TIMEOUT 2000
+
+static gboolean
+child_watch_source_prepare(
+    GSource *source,
+    gint *timeout_)
+{
+    ChildWatchSource *cws = (ChildWatchSource *)source;
+
+    *timeout_ = cws->timeout;
+
+    cws->timeout *= CWS_MULT_TIMEOUT;
+    if (cws->timeout > CWS_MAX_TIMEOUT) cws->timeout = CWS_MAX_TIMEOUT;
+
+    return FALSE;
+}
+
+static gboolean
+child_watch_source_check(
+    GSource *source)
+{
+    ChildWatchSource *cws = (ChildWatchSource *)source;
+
+    /* is it dead? */
+    if (!cws->dead && waitpid(cws->pid, &cws->status, WNOHANG) > 0) {
+       cws->dead = TRUE;
+    }
+
+    return cws->dead;
+}
+
+static gboolean
+child_watch_source_dispatch(
+    GSource *source G_GNUC_UNUSED,
+    GSourceFunc callback,
+    gpointer user_data)
+{
+    ChildWatchSource *cws = (ChildWatchSource *)source;
+
+    /* this shouldn't happen, but just in case */
+    if (cws->dead) {
+       if (!callback) {
+           g_warning("child %jd died before callback was registered", (uintmax_t)cws->pid);
+           return FALSE;
+       }
+
+       ((ChildWatchFunc)callback)(cws->pid, cws->status, user_data);
+
+       /* Un-queue this source unconditionally -- the child can't die twice */
+       return FALSE;
+    }
+
+    return TRUE;
+}
+
+GSource *
+new_child_watch_source(pid_t pid)
+{
+    static GSourceFuncs *child_watch_source_funcs = NULL;
+    GSource *src;
+    ChildWatchSource *cws;
+
+    /* initialize these here to avoid a compiler warning */
+    if (!child_watch_source_funcs) {
+       child_watch_source_funcs = g_new0(GSourceFuncs, 1);
+       child_watch_source_funcs->prepare = child_watch_source_prepare;
+       child_watch_source_funcs->check = child_watch_source_check;
+       child_watch_source_funcs->dispatch = child_watch_source_dispatch;
+    }
+
+    src = g_source_new(child_watch_source_funcs, sizeof(ChildWatchSource));
+    cws = (ChildWatchSource *)src;
+
+    cws->pid = pid;
+    cws->dead = FALSE;
+    cws->timeout = CWS_BASE_TIMEOUT;
+
+    return src;
+}
+#else
+/* In more recent versions of glib, we just use the built-in glib source */
+GSource *
+new_child_watch_source(pid_t pid)
+{
+    return g_child_watch_source_new(pid);
+}
+#endif
index 402d899c8e1f0a418bc50d839b16f794e1423d94..ed97ad93253942f5282f5418f9853abfb64f2eca 100644 (file)
@@ -43,13 +43,16 @@ struct event_handle;
 typedef struct event_handle event_handle_t;
 
 /*
- * The 'id' of the event.  The meaning of this is dependant on the type
- * of event we are registering.  This is hopefully wide enough that
- * callers can cast pointers to it and keep the value untruncated and
- * unique.
- * FIXME: THIS IS NOT 64-BIT CLEAN!
+ * The 'id' of the event.  The meaning of this depends on the type of
+ * event we are registering -- see event_register.  The name 'id' is
+ * historical: it is quite possible to have many outstanding events with
+ * the same ID (same timeout or same file descriptor).
+ *
+ * Event id's are supplied by the caller, and in some cases are cast from
+ * pointers, so this value must be wide enough to hold a pointer without
+ * truncation.
  */
-typedef        unsigned long event_id_t;
+typedef        intmax_t event_id_t;
 
 /*
  * The types of events we can register.
@@ -57,10 +60,8 @@ typedef      unsigned long event_id_t;
 typedef enum {
     EV_READFD,                 /* file descriptor is ready for reading */
     EV_WRITEFD,                        /* file descriptor is ready for writing */
-    EV_SIG,                    /* signal has fired */
     EV_TIME,                   /* n seconds have elapsed */
     EV_WAIT,                   /* event_wakeup() was called with this id */
-    EV_DEAD                    /* internal use only */
 } event_type_t;
 
 /*
@@ -91,19 +92,56 @@ event_handle_t *event_register(event_id_t, event_type_t, event_fn_t, void *);
 void event_release(event_handle_t *);
 
 /*
- * Wake up all EV_WAIT events waiting on a specific id
+ * Wake up all EV_WAIT events waiting on a specific id.  This happens immediately,
+ * not in the next iteration of the event loop.  If callbacks made during the wakeup
+ * register a new event with the same ID, that new event will *not* be awakened.
  */
 int event_wakeup(event_id_t);
 
 /*
- * Block until the event is terminated.
+ * Call event_loop, returning when one of the following conditions is
+ * true:
+ *  evt is EV_WAIT, and it is released; or
+ *  evt is EV_READFD, EV_WRITEFD, or EV_TIME, and it is fired.
  */
-int event_wait(event_handle_t *);
+void event_wait(event_handle_t *evt);
 
 /*
  * Process events.  If the argument is nonzero, then the loop does
  * not block.
  */
-void event_loop(const int);
+void event_loop(int nonblock);
+
+/*
+ * Get the default GMainLoop object.  Applications which use the Glib
+ * main loop directly should use this object for calls to e.g.,
+ * g_main_loop_run(loop).
+ */
+GMainLoop *default_main_loop(void);
+
+/*
+ * Utility GSources
+ */
+
+/* Create a GSource that will callback when the given file descriptor is in
+ * any of the given conditions.  The callback is a simple GSourceFunc.
+ *
+ * @param fd: the file descriptr
+ * @param events: the conditions (GIOCondition flags)
+ * @return: GSource object
+ */
+GSource * new_fdsource(gint fd, GIOCondition events);
+
+/* Create a GSource that will callback when the given child dies.  The callback
+ * should match ChildWatchFunc.  Once the callback is made, it will not be called
+ * again by this source.
+ *
+ * Note: This is provided by glib in later versions, but not in version 2.2.0.
+ * This function and callback is modeled on g_child_watch_source_new.
+ *
+ * @param pid: the process ID @return: GSource object
+ */
+typedef void (*ChildWatchFunc)(pid_t pid, gint status, gpointer data); 
+GSource * new_child_watch_source(pid_t pid);
 
 #endif /* EVENT_H */
index 6f2a0acc4c97ccce7803d9f7fffafe3862b81d9c..e8de92c62677904e4d4b06aa20aa3251e6f143eb 100644 (file)
@@ -473,7 +473,7 @@ debug_agets(
        }
 
        if (ch == '\\') {
-           escape = 1;
+           escape = !escape;
        } else {
            if (ch == '"') {
                if (!escape) 
index ead4619c403222b1ce0b969e30356d1cd1dee38e..17cfca96216ef591f70480d6fe43ce7e3db58544 100644 (file)
@@ -36,15 +36,17 @@ static const char * filetype2str(filetype_t);
 static filetype_t      str2filetype(const char *);
 static void            strange_header(dumpfile_t *, const char *,
                                size_t, const char *, const char *);
-static char *          strquotedstr(void);
 static ssize_t                 hexdump(const char *buffer, size_t len);
+static char            *quote_heredoc(char *text, char *delimiter_prefix);
+static char            *parse_heredoc(char *line, char **saveptr);
 
 void
 fh_init(
     dumpfile_t *file)
 {
     memset(file, '\0', SIZEOF(*file));
-    file->blocksize = DISK_BLOCK_BYTES;
+    file->type = F_EMPTY;
+    file->blocksize = 0;
 }
 
 static void
@@ -69,6 +71,29 @@ strange_header(
     file->type = F_WEIRD;
 }
 
+/* chop whitespace off of a string, in place */
+static void
+chomp(char *str)
+{
+    char *s = str;
+
+    if (!str)
+       return;
+
+    /* trim leading space */
+    while (g_ascii_isspace(*s)) { s++; }
+    if (s != str)
+       memmove(str, s, strlen(s)+1);
+
+    /* trim trailing space */
+    if (*str) {
+       for (s = str+strlen(str)-1; s >= str; s--) {
+           if (!g_ascii_isspace(*s))
+               break;
+           *s = '\0';
+       }
+    }
+}
 
 void
 parse_file_header(
@@ -80,6 +105,7 @@ parse_file_header(
     size_t lsize;
     char *uqname;
     int in_quotes;
+    char *saveptr = NULL;
 
     /* put the buffer into a writable chunk of memory and nul-term it */
     buf = alloc(buflen + 1);
@@ -87,6 +113,7 @@ parse_file_header(
     buf[buflen] = '\0';
     fh_init(file); 
 
+    /* extract the first unquoted line */
     in_quotes = 0;
     for (line = buf, lsize = 0; lsize < buflen; line++) {
        if ((*line == '\n') && !in_quotes)
@@ -106,7 +133,7 @@ parse_file_header(
     line1[lsize] = '\0';
     *line = '\n';
 
-    tok = strtok(line1, " ");
+    tok = strtok_r(line1, " ", &saveptr);
     if (tok == NULL) {
         g_fprintf(stderr, _("%s: Empty amanda header: buflen=%zu lsize=%zu\n"), get_pname(),
            buflen, 
@@ -123,7 +150,7 @@ parse_file_header(
        return;
     }
 
-    tok = strtok(NULL, " ");
+    tok = strtok_r(NULL, " ", &saveptr);
     if (tok == NULL) {
        strange_header(file, buffer, buflen, _("<file type>"), tok);
        goto out;
@@ -132,26 +159,26 @@ parse_file_header(
     
     switch (file->type) {
     case F_TAPESTART:
-       tok = strtok(NULL, " ");
+       tok = strtok_r(NULL, " ", &saveptr);
        if ((tok == NULL) || (strcmp(tok, "DATE") != 0)) {
            strange_header(file, buffer, buflen, "DATE", tok);
            goto out;
        }
 
-       tok = strtok(NULL, " ");
+       tok = strtok_r(NULL, " ", &saveptr);
        if (tok == NULL) {
            strange_header(file, buffer, buflen, _("<date stamp>"), tok);
            goto out;
        }
        strncpy(file->datestamp, tok, SIZEOF(file->datestamp) - 1);
 
-       tok = strtok(NULL, " ");
+       tok = strtok_r(NULL, " ", &saveptr);
        if ((tok == NULL) || (strcmp(tok, "TAPE") != 0)) {
            strange_header(file, buffer, buflen, "TAPE", tok);
            goto out;
        }
 
-       tok = strtok(NULL, " ");
+       tok = strtok_r(NULL, " ", &saveptr);
        if (tok == NULL) {
            strange_header(file, buffer, buflen, _("<file type>"), tok);
            goto out;
@@ -162,21 +189,21 @@ parse_file_header(
     case F_DUMPFILE:
     case F_CONT_DUMPFILE:
     case F_SPLIT_DUMPFILE:
-       tok = strtok(NULL, " ");
+       tok = strtok_r(NULL, " ", &saveptr);
        if (tok == NULL) {
            strange_header(file, buffer, buflen, _("<date stamp>"), tok);
            goto out;
        }
        strncpy(file->datestamp, tok, SIZEOF(file->datestamp) - 1);
 
-       tok = strtok(NULL, " ");
+       tok = strtok_r(NULL, " ", &saveptr);
        if (tok == NULL) {
            strange_header(file, buffer, buflen, _("<file name>"), tok);
            goto out;
        }
        strncpy(file->name, tok, SIZEOF(file->name) - 1);
 
-       tok = strquotedstr();
+       tok = strquotedstr(&saveptr);
        if (tok == NULL) {
            strange_header(file, buffer, buflen, _("<disk name>"), tok);
            goto out;
@@ -186,13 +213,13 @@ parse_file_header(
        amfree(uqname);
        
        if(file->type == F_SPLIT_DUMPFILE) {
-           tok = strtok(NULL, " ");
+           tok = strtok_r(NULL, " ", &saveptr);
            if (tok == NULL || strcmp(tok, "part") != 0) {
                strange_header(file, buffer, buflen, "part", tok);
                goto out;
            }
 
-           tok = strtok(NULL, "/");
+           tok = strtok_r(NULL, "/", &saveptr);
            if ((tok == NULL) || (sscanf(tok, "%d", &file->partnum) != 1)) {
                strange_header(file, buffer, buflen, _("<part num param>"), tok);
                goto out;
@@ -201,32 +228,32 @@ parse_file_header(
            /* If totalparts == -1, then the original dump was done in 
               streaming mode (no holding disk), thus we don't know how 
                many parts there are. */
-           tok = strtok(NULL, " ");
+           tok = strtok_r(NULL, " ", &saveptr);
             if((tok == NULL) || (sscanf(tok, "%d", &file->totalparts) != 1)) {
                strange_header(file, buffer, buflen, _("<total parts param>"), tok);
                goto out;
            }
        }
 
-       tok = strtok(NULL, " ");
+       tok = strtok_r(NULL, " ", &saveptr);
        if ((tok == NULL) || (strcmp(tok, "lev") != 0)) {
            strange_header(file, buffer, buflen, "lev", tok);
            goto out;
        }
 
-       tok = strtok(NULL, " ");
+       tok = strtok_r(NULL, " ", &saveptr);
        if ((tok == NULL) || (sscanf(tok, "%d", &file->dumplevel) != 1)) {
            strange_header(file, buffer, buflen, _("<dump level param>"), tok);
            goto out;
        }
 
-       tok = strtok(NULL, " ");
+       tok = strtok_r(NULL, " ", &saveptr);
        if ((tok == NULL) || (strcmp(tok, "comp") != 0)) {
            strange_header(file, buffer, buflen, "comp", tok);
            goto out;
        }
 
-       tok = strtok(NULL, " ");
+       tok = strtok_r(NULL, " ", &saveptr);
        if (tok == NULL) {
            strange_header(file, buffer, buflen, _("<comp param>"), tok);
            goto out;
@@ -238,7 +265,7 @@ parse_file_header(
        if (strcmp(file->comp_suffix, "C") == 0)
            strncpy(file->comp_suffix, ".Z", SIZEOF(file->comp_suffix) - 1);
               
-       tok = strtok(NULL, " ");
+       tok = strtok_r(NULL, " ", &saveptr);
         /* "program" is optional */
         if (tok == NULL || strcmp(tok, "program") != 0) {
            amfree(buf);
@@ -246,7 +273,7 @@ parse_file_header(
             return;
        }
 
-        tok = strtok(NULL, " ");
+        tok = strtok_r(NULL, " ", &saveptr);
         if (tok == NULL) {
            strange_header(file, buffer, buflen, _("<program name>"), tok);
            goto out;
@@ -255,12 +282,12 @@ parse_file_header(
         if (file->program[0] == '\0')
             strncpy(file->program, "RESTORE", SIZEOF(file->program) - 1);
 
-       if ((tok = strtok(NULL, " ")) == NULL)
+       if ((tok = strtok_r(NULL, " ", &saveptr)) == NULL)
              break;          /* reached the end of the buffer */
 
        /* "encryption" is optional */
        if (BSTRNCMP(tok, "crypt") == 0) {
-           tok = strtok(NULL, " ");
+           tok = strtok_r(NULL, " ", &saveptr);
            if (tok == NULL) {
                strange_header(file, buffer, buflen, _("<crypt param>"), tok);
                goto out;
@@ -268,65 +295,65 @@ parse_file_header(
            strncpy(file->encrypt_suffix, tok,
                    SIZEOF(file->encrypt_suffix) - 1);
            file->encrypted = BSTRNCMP(file->encrypt_suffix, "N");
-           if ((tok = strtok(NULL, " ")) == NULL)
+           if ((tok = strtok_r(NULL, " ", &saveptr)) == NULL)
                break;
        }
 
        /* "srvcompprog" is optional */
        if (BSTRNCMP(tok, "server_custom_compress") == 0) {
-           tok = strtok(NULL, " ");
+           tok = strtok_r(NULL, " ", &saveptr);
            if (tok == NULL) {
                strange_header(file, buffer, buflen,
                                _("<server custom compress param>"), tok);
                goto out;
            }
            strncpy(file->srvcompprog, tok, SIZEOF(file->srvcompprog) - 1);
-           if ((tok = strtok(NULL, " ")) == NULL)
+           if ((tok = strtok_r(NULL, " ", &saveptr)) == NULL)
                break;      
        }
 
        /* "clntcompprog" is optional */
        if (BSTRNCMP(tok, "client_custom_compress") == 0) {
-           tok = strtok(NULL, " ");
+           tok = strtok_r(NULL, " ", &saveptr);
            if (tok == NULL) {
                strange_header(file, buffer, buflen,
                                _("<client custom compress param>"), tok);
                goto out;
            }
            strncpy(file->clntcompprog, tok, SIZEOF(file->clntcompprog) - 1);
-           if ((tok = strtok(NULL, " ")) == NULL)
+           if ((tok = strtok_r(NULL, " ", &saveptr)) == NULL)
                break;
        }
 
        /* "srv_encrypt" is optional */
        if (BSTRNCMP(tok, "server_encrypt") == 0) {
-           tok = strtok(NULL, " ");
+           tok = strtok_r(NULL, " ", &saveptr);
            if (tok == NULL) {
                strange_header(file, buffer, buflen,
                                _("<server encrypt param>"), tok);
                goto out;
            }
            strncpy(file->srv_encrypt, tok, SIZEOF(file->srv_encrypt) - 1);
-           if ((tok = strtok(NULL, " ")) == NULL) 
+           if ((tok = strtok_r(NULL, " ", &saveptr)) == NULL) 
                break;
        }
 
        /* "clnt_encrypt" is optional */
        if (BSTRNCMP(tok, "client_encrypt") == 0) {
-           tok = strtok(NULL, " ");
+           tok = strtok_r(NULL, " ", &saveptr);
            if (tok == NULL) {
                strange_header(file, buffer, buflen,
                                _("<client encrypt param>"), tok);
                goto out;
            }
            strncpy(file->clnt_encrypt, tok, SIZEOF(file->clnt_encrypt) - 1);
-           if ((tok = strtok(NULL, " ")) == NULL) 
+           if ((tok = strtok_r(NULL, " ", &saveptr)) == NULL) 
                break;
        }
 
        /* "srv_decrypt_opt" is optional */
        if (BSTRNCMP(tok, "server_decrypt_option") == 0) {
-           tok = strtok(NULL, " ");
+           tok = strtok_r(NULL, " ", &saveptr);
            if (tok == NULL) {
                strange_header(file, buffer, buflen,
                                _("<server decrypt param>"), tok);
@@ -334,13 +361,13 @@ parse_file_header(
            }
            strncpy(file->srv_decrypt_opt, tok,
                    SIZEOF(file->srv_decrypt_opt) - 1);
-           if ((tok = strtok(NULL, " ")) == NULL) 
+           if ((tok = strtok_r(NULL, " ", &saveptr)) == NULL) 
                break;
        }
 
        /* "clnt_decrypt_opt" is optional */
        if (BSTRNCMP(tok, "client_decrypt_option") == 0) {
-           tok = strtok(NULL, " ");
+           tok = strtok_r(NULL, " ", &saveptr);
            if (tok == NULL) {
                strange_header(file, buffer, buflen,
                                _("<client decrypt param>"), tok);
@@ -348,18 +375,18 @@ parse_file_header(
            }
            strncpy(file->clnt_decrypt_opt, tok,
                    SIZEOF(file->clnt_decrypt_opt) - 1);
-           if ((tok = strtok(NULL, " ")) == NULL) 
+           if ((tok = strtok_r(NULL, " ", &saveptr)) == NULL) 
                break;
        }
       break;
       
 
     case F_TAPEEND:
-       tok = strtok(NULL, " ");
+       tok = strtok_r(NULL, " ", &saveptr);
        /* DATE is optional */
        if (tok != NULL) {
            if (strcmp(tok, "DATE") == 0) {
-               tok = strtok(NULL, " ");
+               tok = strtok_r(NULL, " ", &saveptr);
                if(tok == NULL)
                    file->datestamp[0] = '\0';
                else
@@ -378,9 +405,9 @@ parse_file_header(
        goto out;
     }
 
-    (void)strtok(buf, "\n"); /* this is the first line */
+    (void)strtok_r(buf, "\n", &saveptr); /* this is the first line */
     /* iterate through the rest of the lines */
-    while ((line = strtok(NULL, "\n")) != NULL) {
+    while ((line = strtok_r(NULL, "\n", &saveptr)) != NULL) {
 #define SC "CONT_FILENAME="
        if (strncmp(line, SC, SIZEOF(SC) - 1) == 0) {
            line += SIZEOF(SC) - 1;
@@ -397,21 +424,28 @@ parse_file_header(
            continue;
        }
 #undef SC
-#define SC "DUMPER="
+#define SC "APPLICATION="
        if (strncmp(line, SC, SIZEOF(SC) - 1) == 0) {
            line += SIZEOF(SC) - 1;
-           strncpy(file->dumper, line,
-                   SIZEOF(file->dumper) - 1);
+           strncpy(file->application, line,
+                   SIZEOF(file->application) - 1);
            continue;
        }
 #undef SC
 
+#define SC "DLE="
+       if (strncmp(line, SC, SIZEOF(SC) - 1) == 0) {
+           line += SIZEOF(SC) - 1;
+           file->dle_str = parse_heredoc(line, &saveptr);
+       }
+#undef SC
+
 #define SC _("To restore, position tape at start of file and run:")
        if (strncmp(line, SC, SIZEOF(SC) - 1) == 0)
            continue;
 #undef SC
 
-#define SC "\tdd if=<tape> bs="
+#define SC "\tdd if=<tape> "
        if (strncmp(line, SC, SIZEOF(SC) - 1) == 0) {
            char *cmd1, *cmd2, *cmd3=NULL;
 
@@ -431,6 +465,11 @@ parse_file_header(
                *cmd3++ = '\0';
            }
           
+           /* clean up some extra spaces in various fields */
+           chomp(cmd1);
+           chomp(cmd2);
+           chomp(cmd3);
+
            /* three cmds: decrypt    | uncompress | recover
             * two   cmds: uncompress | recover
             * XXX note that if there are two cmds, the first one 
@@ -446,15 +485,15 @@ parse_file_header(
                        SIZEOF(file->recover_cmd) - 1);
              } else {
                g_snprintf(file->uncompress_cmd,
-                        SIZEOF(file->uncompress_cmd), "%s|", cmd1);
+                        SIZEOF(file->uncompress_cmd), "%s |", cmd1);
                strncpy(file->recover_cmd, cmd2,
                        SIZEOF(file->recover_cmd) - 1);
              }
            } else {    /* cmd3 presents:  decrypt | uncompress | recover */
              g_snprintf(file->decrypt_cmd,
-                      SIZEOF(file->decrypt_cmd), "%s|", cmd1);
+                      SIZEOF(file->decrypt_cmd), "%s |", cmd1);
              g_snprintf(file->uncompress_cmd,
-                      SIZEOF(file->uncompress_cmd), "%s|", cmd2);
+                      SIZEOF(file->uncompress_cmd), "%s |", cmd2);
              strncpy(file->recover_cmd, cmd3,
                      SIZEOF(file->recover_cmd) - 1);
            }
@@ -485,7 +524,7 @@ dump_dumpfile_t(
        dbprintf(_("    name             = '%s'\n"), file->name);
        dbprintf(_("    disk             = '%s'\n"), file->disk);
        dbprintf(_("    program          = '%s'\n"), file->program);
-       dbprintf(_("    dumper           = '%s'\n"), file->dumper);
+       dbprintf(_("    application      = '%s'\n"), file->application);
        dbprintf(_("    srvcompprog      = '%s'\n"), file->srvcompprog);
        dbprintf(_("    clntcompprog     = '%s'\n"), file->clntcompprog);
        dbprintf(_("    srv_encrypt      = '%s'\n"), file->srv_encrypt);
@@ -497,10 +536,15 @@ dump_dumpfile_t(
        dbprintf(_("    srv_decrypt_opt  = '%s'\n"), file->srv_decrypt_opt);
        dbprintf(_("    clnt_decrypt_opt = '%s'\n"), file->clnt_decrypt_opt);
        dbprintf(_("    cont_filename    = '%s'\n"), file->cont_filename);
+       if (file->dle_str)
+           dbprintf(_("    dle_str          = %s\n"), file->dle_str);
+       else
+           dbprintf(_("    dle_str          = (null)\n"));
        dbprintf(_("    is_partial       = %d\n"), file->is_partial);
        dbprintf(_("    partnum          = %d\n"), file->partnum);
        dbprintf(_("    totalparts       = %d\n"), file->totalparts);
-       dbprintf(_("    blocksize        = %zu\n"), file->blocksize);
+       if (file->blocksize)
+           dbprintf(_("    blocksize        = %zu\n"), file->blocksize);
 }
 
 static void
@@ -567,7 +611,7 @@ build_header(const dumpfile_t * file, size_t size)
        validate_name(file->name);
        validate_datestamp(file->datestamp);
         g_string_printf(rval, 
-                        "AMANDA: TAPESTART DATE %s TAPE %s\n014\n",
+                        "AMANDA: TAPESTART DATE %s TAPE %s\n\014\n",
                         file->datestamp, file->name);
        break;
         
@@ -632,22 +676,34 @@ build_header(const dumpfile_t * file, size_t size)
             g_string_append_printf(rval, "CONT_FILENAME=%s\n",
                                    file->cont_filename);
        }
-       if (file->dumper[0] != '\0') {
-            g_string_append_printf(rval, "DUMPER=%s\n", file->dumper);
+       if (file->application[0] != '\0') {
+            g_string_append_printf(rval, "APPLICATION=%s\n", file->application);
        }
        if (file->is_partial != 0) {
             g_string_append_printf(rval, "PARTIAL=YES\n");
        }
+       if (file->dle_str && strlen(file->dle_str) < size-2048) {
+           char *heredoc = quote_heredoc(file->dle_str, "ENDDLE");
+           g_string_append_printf(rval, "DLE=%s\n", heredoc);
+           amfree(heredoc);
+       }
         
         g_string_append_printf(rval,
            _("To restore, position tape at start of file and run:\n"));
 
+        g_string_append_printf(rval, "\tdd if=<tape> ");
+       if (file->blocksize)
+           g_string_append_printf(rval, "bs=%zuk ",
+                                  file->blocksize / 1024);
+       g_string_append_printf(rval, "skip=1 | ");
+       if (*file->decrypt_cmd)
+           g_string_append_printf(rval, "%s ", file->decrypt_cmd);
+       if (*file->uncompress_cmd)
+           g_string_append_printf(rval, "%s ", file->uncompress_cmd);
+       if (*file->recover_cmd)
+           g_string_append_printf(rval, "%s ", file->recover_cmd);
        /* \014 == ^L == form feed */
-        g_string_append_printf(rval,
-                               "\tdd if=<tape> bs=%zuk skip=1 |%s %s %s\n\014\n",
-                               file->blocksize / 1024,
-                               file->decrypt_cmd, file->uncompress_cmd,
-                               file->recover_cmd);
+       g_string_append_printf(rval, "\n\014\n");
        break;
 
     case F_TAPEEND:
@@ -827,37 +883,63 @@ gboolean headers_are_equal(dumpfile_t * a, dumpfile_t * b) {
     if (a == NULL || b == NULL)
         return FALSE;
 
-    return 0 == memcmp(a, b, sizeof(*a));
+    if (a->type != b->type) return FALSE;
+    if (strcmp(a->datestamp, b->datestamp)) return FALSE;
+    if (a->dumplevel != b->dumplevel) return FALSE;
+    if (a->compressed != b->compressed) return FALSE;
+    if (a->encrypted != b->encrypted) return FALSE;
+    if (strcmp(a->comp_suffix, b->comp_suffix)) return FALSE;
+    if (strcmp(a->encrypt_suffix, b->encrypt_suffix)) return FALSE;
+    if (strcmp(a->name, b->name)) return FALSE;
+    if (strcmp(a->disk, b->disk)) return FALSE;
+    if (strcmp(a->program, b->program)) return FALSE;
+    if (strcmp(a->application, b->application)) return FALSE;
+    if (strcmp(a->srvcompprog, b->srvcompprog)) return FALSE;
+    if (strcmp(a->clntcompprog, b->clntcompprog)) return FALSE;
+    if (strcmp(a->srv_encrypt, b->srv_encrypt)) return FALSE;
+    if (strcmp(a->clnt_encrypt, b->clnt_encrypt)) return FALSE;
+    if (strcmp(a->recover_cmd, b->recover_cmd)) return FALSE;
+    if (strcmp(a->uncompress_cmd, b->uncompress_cmd)) return FALSE;
+    if (strcmp(a->encrypt_cmd, b->encrypt_cmd)) return FALSE;
+    if (strcmp(a->decrypt_cmd, b->decrypt_cmd)) return FALSE;
+    if (strcmp(a->srv_decrypt_opt, b->srv_decrypt_opt)) return FALSE;
+    if (strcmp(a->clnt_decrypt_opt, b->clnt_decrypt_opt)) return FALSE;
+    if (strcmp(a->cont_filename, b->cont_filename)) return FALSE;
+    if (a->dle_str != b->dle_str && a->dle_str && b->dle_str
+       && strcmp(a->dle_str, b->dle_str)) return FALSE;
+    if (a->is_partial != b->is_partial) return FALSE;
+    if (a->partnum != b->partnum) return FALSE;
+    if (a->totalparts != b->totalparts) return FALSE;
+    if (a->blocksize != b->blocksize) return FALSE;
+
+    return TRUE; /* ok, they're the same */
 }
 
 dumpfile_t * dumpfile_copy(dumpfile_t* source) {
-    gpointer rval = malloc(sizeof(dumpfile_t));
+    dumpfile_t* rval = malloc(sizeof(dumpfile_t));
     memcpy(rval, source, sizeof(dumpfile_t));
+    if (rval->dle_str) rval->dle_str = stralloc(rval->dle_str);
     return rval;
 }
 
-/*
- * This function modify strtok context.
- */
-static char *
-strquotedstr(void)
+void
+dumpfile_copy_in_place(
+    dumpfile_t *dest,
+    dumpfile_t* source)
 {
-    char *  tok = strtok(NULL, " ");
-    size_t     len;
-
-    len = strlen(tok);
-    if ((tok != NULL) && (tok[0] == '"') &&
-       (len > 1 && (tok[len - 1] != '"') && (tok[len - 2] != '\\'))) {
-       char *  t;
-
-       do {
-           t = strtok(NULL, " ");
-           tok[len] = ' ';
-           len = strlen(tok);
-       } while ((t != NULL) &&
-                (tok[len - 1] != '"') && (tok[len - 2] != '\\'));
+    memcpy(dest, source, sizeof(dumpfile_t));
+    if (dest->dle_str) dest->dle_str = stralloc(dest->dle_str);
+}
+
+void dumpfile_free_data(dumpfile_t* info) {
+    if (info) {
+       amfree(info->dle_str);
     }
-    return tok;
+}
+
+void dumpfile_free(dumpfile_t* info) {
+    dumpfile_free_data(info);
+    amfree(info);
 }
 
 static ssize_t
@@ -879,3 +961,66 @@ hexdump(
     return rc;
 }
 
+static char *quote_heredoc(
+    char  *text,
+    char  *delimiter_prefix)
+{
+    char *delimiter = stralloc(delimiter_prefix);
+    int delimiter_n = 0;
+    int delimiter_len = strlen(delimiter);
+    char *quoted;
+
+    /* keep picking delimiters until we find one that's not a line in TEXT */
+    while (1) {
+       char *line = text;
+       char *c = text;
+       gboolean found_delimiter = FALSE;
+
+       while (1) {
+           if (*c == '\n' || *c == '\0') {
+               int linelen = c - line;
+               if (linelen == delimiter_len && 0 == strncmp(line, delimiter, linelen)) {
+                   found_delimiter = TRUE;
+                   break;
+               }
+               line = c+1;
+           }
+           if (!*c) break;
+           c++;
+       }
+
+       if (!found_delimiter)
+           break;
+
+       delimiter = newvstrallocf(delimiter, "%s%d", delimiter_prefix, ++delimiter_n);
+       delimiter_len = strlen(delimiter);
+    }
+
+    /* we have a delimiter .. now use it */
+    quoted = vstrallocf("<<%s\n%s\n%s", delimiter, text, delimiter);
+    amfree(delimiter);
+    return quoted;
+}
+
+static char *parse_heredoc(
+    char  *line,
+    char **saveptr)
+{
+    char *result = NULL;
+
+    if (strncmp(line, "<<", 2) == 0) {
+       char *keyword = line+2;
+       char *new_line;
+
+       while((new_line = strtok_r(NULL, "\n", saveptr)) != NULL &&
+             strcmp(new_line, keyword) != 0) {
+           result = vstrextend(&result, new_line, "\n", NULL);
+       }
+       /* remove latest '\n' */
+       if (strlen(result) > 0)
+           result[strlen(result)-1] = '\0';
+    } else {
+       result = stralloc(line);
+    }
+    return result;
+}
index f54fae5451e8bb5f5623771d0fb131bc6a8ac9e9..e92eb8e2285c5a6a1d124989e51011d20c2f0bcd 100644 (file)
@@ -53,7 +53,7 @@ typedef struct file_s {
     string_t name;     /* hostname or label */
     string_t disk;
     string_t program;
-    string_t dumper;
+    string_t application;
     string_t srvcompprog;
     string_t clntcompprog;
     string_t srv_encrypt;
@@ -65,6 +65,7 @@ typedef struct file_s {
     string_t srv_decrypt_opt;
     string_t clnt_decrypt_opt;
     string_t cont_filename;
+    char     *dle_str;
     int is_partial;
     int partnum;
     int totalparts; /* -1 == UNKNOWN */
@@ -91,5 +92,12 @@ gboolean headers_are_equal(dumpfile_t * a, dumpfile_t * b);
 
 /* Returns an allocated duplicate header. */
 dumpfile_t * dumpfile_copy(dumpfile_t* from);
+void dumpfile_copy_in_place(dumpfile_t *dest, dumpfile_t* source);
+
+/* Frees associated storage */
+void dumpfile_free_data(dumpfile_t* info);
+
+/* Frees the header and associated storage */
+void dumpfile_free(dumpfile_t* info);
 
 #endif /* !FILEHEADER_H */
index 1b4f7f5b58aff57f5a983f817847826b0807c483..e4ae2369d8513c6a1b1c801f65e18c9047307106 100644 (file)
@@ -24,7 +24,7 @@
  * file named AUTHORS, in the root directory of this distribution.
  */
 /*
- * $Id: genversion.c 698 2008-01-11 00:42:49Z martinea $
+ * $Id: genversion.c 1168 2008-07-03 14:15:21Z djmitche $
  *
  * dump the current Amanda version info
  */
@@ -362,20 +362,17 @@ main(
     prstr("HAVE_SYSVSHM");
 #endif
 
-#ifdef USE_POSIX_FCNTL
-    prstr("LOCKING=POSIX_FCNTL");
+#ifdef WANT_AMFLOCK_POSIX
+    prstr("AMFLOCK_POSIX");
 #endif
-#ifdef USE_FLOCK
-    prstr("LOCKING=FLOCK");
+#ifdef WANT_AMFLOCK_FLOCK
+    prstr("AMFLOCK_FLOCK");
 #endif
-#ifdef USE_LOCKF
-    prstr("LOCKING=LOCKF");
+#ifdef WANT_AMFLOCK_LOCKF
+    prstr("AMFLOCK_LOCKF");
 #endif
-#ifdef USE_LNLOCK
-    prstr("LOCKING=LNLOCK");
-#endif
-#if !defined(USE_POSIX_FCNTL) && !defined(USE_FLOCK) && !defined(USE_LOCK) && !defined(USE_LNLOCK)
-    prstr("LOCKING=**NONE**");
+#ifdef WANT_AMFLOCK_LNLOCK
+    prstr("AMFLOCK_LNLOCK");
 #endif
 
 #ifdef STATFS_BSD
index 316c245b61cd255d966d16c07337b482b81a8a4e..c14053990930f545236650b6c4cb173a5e8e2646 100644 (file)
@@ -1,3 +1,3 @@
 #define CC "gcc"
-#define BUILT_DATE "Fri Aug 22 14:21:05 EDT 2008"
+#define BUILT_DATE "Thu Jan 22 08:52:28 EST 2009"
 #define BUILT_MACH "x86_64-unknown-linux-gnu"
index ec9728ad4c8a24d7ad2a61f52bb3b0a789a8a007..dd6b38e0e12397d01856a4be924171eb267cbf74 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+ * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
  * 
  * This library is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License version 2.1 as 
@@ -14,8 +14,8 @@
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  * 
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 /*
 #include "glib-util.h"
 #include "conffile.h" /* For find_multiplier. */
 
+#ifdef HAVE_LIBCURL
+#include <curl/curl.h>
+#endif
+
+void
+glib_init(void) {
+    static gboolean did_glib_init = FALSE;
+    if (did_glib_init) return;
+    did_glib_init = TRUE;
+
+    /* Initialize glib's type system */
+    g_type_init();
+
+    /* set up libcurl (this must happen before threading 
+     * is initialized) */
+#ifdef HAVE_LIBCURL
+# ifdef G_THREADS_ENABLED
+    g_assert(!g_thread_supported());
+# endif
+    g_assert(curl_global_init(CURL_GLOBAL_ALL) == 0);
+#endif
+
+    /* And set up glib's threads */
+#if defined(G_THREADS_ENABLED) && !defined(G_THREADS_IMPL_NONE)
+    if (g_thread_supported()) {
+        return;
+    }
+    g_thread_init(NULL);
+#endif
+
+    /* do a version check */
+#if GLIB_CHECK_VERSION(2,6,0)
+    {
+       const char *glib_err = glib_check_version(GLIB_MAJOR_VERSION,
+                                                 GLIB_MINOR_VERSION,
+                                                 GLIB_MICRO_VERSION);
+       if (glib_err) {
+           error(_("%s: Amanda was compiled with glib-%d.%d.%d"), glib_err,
+                   GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
+           exit(1); /* glib_init may be called before error handling is set up */
+       }
+    }
+#endif
+}
+
 typedef enum {
     FLAG_STRING_NAME,
     FLAG_STRING_SHORT_NAME,
@@ -402,6 +447,10 @@ char * g_english_strjoinv(char ** strv, const char * conjunction) {
     strv = g_strdupv(strv);
 
     length = g_strv_length(strv);
+
+    if (length == 1)
+       return stralloc(strv[0]);
+
     last = strv[length - 1];
     strv[length - 1] = NULL;
     
@@ -433,5 +482,43 @@ guint g_strv_length(gchar ** strv) {
     }
     return rval;
 }
-
 #endif /* GLIB_CHECK_VERSION(2.6.0) */
+
+#if !GLIB_CHECK_VERSION(2,4,0)
+void
+g_ptr_array_foreach (GPtrArray *array,
+                     GFunc      func,
+                     gpointer   user_data)
+{
+  guint i;
+
+  g_return_if_fail (array);
+
+  for (i = 0; i < array->len; i++)
+    (*func) (array->pdata[i], user_data);
+}
+#endif
+
+guint
+g_str_case_hash(
+       gconstpointer key)
+{
+    /* modified version of glib's hash function, copyright
+     * GLib Team and others 1997-2000. */
+    const char *p = key;
+    guint h = g_ascii_toupper(*p);
+
+    if (h)
+       for (p += 1; *p != '\0'; p++)
+           h = (h << 5) - h + g_ascii_toupper(*p);
+
+    return h;
+}
+
+gboolean
+g_str_case_equal(
+       gconstpointer v1,
+       gconstpointer v2)
+{
+    return (0 == g_ascii_strcasecmp((char *)v1, (char *)v2));
+}
index 3151d2baac119dc711a865202d9f04b6e1d43831..bc54c53a6d492bfa3ec9e20962c55101d15f3961 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+ * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
  * 
  * This library is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License version 2.1 as 
@@ -14,8 +14,8 @@
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  * 
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 /*
  * Utilities that aren't quite included in glib
 #include <glib.h>
 #include <glib-object.h>
 
+/* Call the requisite glib init functions, including calling
+ * g_init_types and setting up threading support.  This function can
+ * be called multiple times with no harm, although it is not
+ * re-entrant.
+ */
+void glib_init(void);
+
 /* like g_[s]list_foreach, but with a function taking only
  * one argument.
  */
@@ -107,5 +114,14 @@ char * g_english_strjoinv_and_free(char ** strv, const char * conjunction);
 guint g_strv_length(gchar ** strv);
 #endif
 
+#if !GLIB_CHECK_VERSION(2,4,0)
+void g_ptr_array_foreach (GPtrArray *array,
+                         GFunc func,
+                          gpointer user_data);
 #endif
 
+/* functions for g_hash_table_new to hash and compare case-insensitive strings */
+guint g_str_case_hash(gconstpointer v);
+gboolean g_str_case_equal(gconstpointer v1, gconstpointer v2);
+
+#endif
index 77fa3bd903a205bfff4c2615f5456485d957734a..69bf2d314142478177aedaf0bd812453be34ea80 100644 (file)
 #endif /* HAVE_ON_EXIT */
 #endif /* ! HAVE_ATEXIT */
 
+/*
+ * This is the tcp stream buffer size
+ */
+#ifndef STREAM_BUFSIZE
+#define        STREAM_BUFSIZE  (32768*2)
+#endif
+
 int krb_set_lifetime(int);
 int kuserok(AUTH_DAT *, char *);
 
@@ -98,19 +105,12 @@ struct krb4_stream {
     in_port_t port;                    /* local port this is bound to */
     int socket;                                /* fd for server-side accepts */
     event_handle_t *ev_read;           /* read event handle */
-    char databuf[MAX_TAPE_BLOCK_BYTES];        /* read buffer */
+    char databuf[STREAM_BUFSIZE];      /* read buffer */
     int len;                           /* */
     void (*fn)(void *, void *, ssize_t);/* read event fn */
     void *arg;                         /* arg for previous */
 };
 
-/*
- * This is the tcp stream buffer size
- */
-#ifndef STREAM_BUFSIZE
-#define        STREAM_BUFSIZE  (MAX_TAPE_BLOCK_BYTES * 2)
-#endif
-
 /*
  * Interface functions
  */
index 6c6572b619abcb557e532b64eafb7db5ff45279e..dcf778e6567df9d2e062cfa866d37668675d9663 100644 (file)
  */
 #define GSS_TIMEOUT                     30
 
-/*
- * The largest buffer we can send/receive.
- */
-#define AMANDA_MAX_TOK_SIZE             (MAX_TAPE_BLOCK_BYTES * 4)
-
 /*
  * This is the tcp stream buffer size
  */
-#define KRB5_STREAM_BUFSIZE     (MAX_TAPE_BLOCK_BYTES * 2)
+#define KRB5_STREAM_BUFSIZE     (32768 * 2)
 
 /*
  * This is the max number of outgoing connections we can have at once.
index 29a946df5ae0d233619d397c0a0bbf6c03350d9c..7e2d1d81845c9fe4bef1a2c8b23729f296c18f93 100644 (file)
@@ -178,6 +178,7 @@ local_connect(
 
 error:
     (*fn)(arg, &rh->sech, S_ERROR);
+    amfree(rh->hostname);
 }
 
 /*
@@ -188,7 +189,7 @@ static int
 runlocal(
     struct tcp_conn *  rc,
     const char *       amandad_path,
-    const char *       client_username)
+    const char *       client_username G_GNUC_UNUSED)
 {
     int rpipe[2], wpipe[2];
     char *xamandad_path = (char *)amandad_path;
index f9ce31ded98bf71d8e8f78bc72b60636fe62957c..d8c83bcc7657ec16014ade4c0f35587bc4e20826 100644 (file)
@@ -99,6 +99,34 @@ match(
     return result == 0;
 }
 
+int
+match_no_newline(
+    const char *       regex,
+    const char *       str)
+{
+    regex_t regc;
+    int result;
+    char errmsg[STR_SIZE];
+
+    if((result = regcomp(&regc, regex,
+                        REG_EXTENDED|REG_NOSUB)) != 0) {
+        regerror(result, &regc, errmsg, SIZEOF(errmsg));
+       error(_("regex \"%s\": %s"), regex, errmsg);
+       /*NOTREACHED*/
+    }
+
+    if((result = regexec(&regc, str, 0, 0, 0)) != 0
+       && result != REG_NOMATCH) {
+        regerror(result, &regc, errmsg, SIZEOF(errmsg));
+       error(_("regex \"%s\": %s"), regex, errmsg);
+       /*NOTREACHED*/
+    }
+
+    regfree(&regc);
+
+    return result == 0;
+}
+
 char *
 validate_glob(
     const char *       glob)
@@ -530,6 +558,17 @@ match_disk(
     return match_word(glob, disk, '/');
 }
 
+static int
+alldigits(
+    const char *str)
+{
+    while (*str) {
+       if (!isdigit((int)*(str++)))
+           return 0;
+    }
+    return 1;
+}
+
 int
 match_datestamp(
     const char *       dateexp,
@@ -543,45 +582,56 @@ match_datestamp(
     int match_exact;
 
     if(strlen(dateexp) >= 100 || strlen(dateexp) < 1) {
-       error(_("Illegal datestamp expression %s"),dateexp);
-       /*NOTREACHED*/
+       goto illegal;
     }
    
+    /* strip and ignore an initial "^" */
     if(dateexp[0] == '^') {
-       strncpy(mydateexp, dateexp+1, strlen(dateexp)-1); 
-       mydateexp[strlen(dateexp)-1] = '\0';
+       strncpy(mydateexp, dateexp+1, sizeof(mydateexp)-1);
+       mydateexp[sizeof(mydateexp)-1] = '\0';
     }
     else {
-       strncpy(mydateexp, dateexp, strlen(dateexp));
-       mydateexp[strlen(dateexp)] = '\0';
+       strncpy(mydateexp, dateexp, sizeof(mydateexp)-1);
+       mydateexp[sizeof(mydateexp)-1] = '\0';
     }
 
-    if(mydateexp[strlen(mydateexp)] == '$') {
+    if(mydateexp[strlen(mydateexp)-1] == '$') {
        match_exact = 1;
-       mydateexp[strlen(mydateexp)] = '\0';
+       mydateexp[strlen(mydateexp)-1] = '\0';  /* strip the trailing $ */
     }
     else
        match_exact = 0;
 
+    /* a single dash represents a date range */
     if((dash = strchr(mydateexp,'-'))) {
-       if(match_exact == 1) {
-           error(_("Illegal datestamp expression %s"),dateexp);
-           /*NOTREACHED*/
+       if(match_exact == 1 || strchr(dash+1, '-')) {
+           goto illegal;
        }
-       len = (size_t)(dash - mydateexp);
-       len_suffix = strlen(dash) - 1;
-       len_prefix = len - len_suffix;
+
+       /* format: XXXYYYY-ZZZZ, indicating dates XXXYYYY to XXXZZZZ */
+
+       len = (size_t)(dash - mydateexp);   /* length of XXXYYYY */
+       len_suffix = strlen(dash) - 1;  /* length of ZZZZ */
+       if (len_suffix > len) goto illegal;
+       len_prefix = len - len_suffix; /* length of XXX */
 
        dash++;
+
        strncpy(firstdate, mydateexp, len);
        firstdate[len] = '\0';
        strncpy(lastdate, mydateexp, len_prefix);
        strncpy(&(lastdate[len_prefix]), dash, len_suffix);
        lastdate[len] = '\0';
+       if (!alldigits(firstdate) || !alldigits(lastdate))
+           goto illegal;
+       if (strncmp(firstdate, lastdate, strlen(firstdate)) > 0)
+           goto illegal;
        return ((strncmp(datestamp, firstdate, strlen(firstdate)) >= 0) &&
                (strncmp(datestamp, lastdate , strlen(lastdate))  <= 0));
     }
     else {
+       if (!alldigits(mydateexp))
+           goto illegal;
        if(match_exact == 1) {
            return (strcmp(datestamp, mydateexp) == 0);
        }
@@ -589,6 +639,9 @@ match_datestamp(
            return (strncmp(datestamp, mydateexp, strlen(mydateexp)) == 0);
        }
     }
+illegal:
+       error(_("Illegal datestamp expression %s"),dateexp);
+       /*NOTREACHED*/
 }
 
 
index 16fd67cdda4dfc916cd0e3dc71ec8bd8001049dc..28f342bdc18f5a6e7564bde5a9a1f016c11018fc 100644 (file)
@@ -6,7 +6,7 @@
 
 char skip_argument[1];
 
-pid_t pipespawnv_passwd(char *prog, int pipedef,
+pid_t pipespawnv_passwd(char *prog, int pipedef, int need_root,
                   int *stdinfd, int *stdoutfd, int *stderrfd,
                   char **my_argv);
 
@@ -19,6 +19,7 @@ pid_t
 pipespawn(
     char *     prog,
     int                pipedef,
+    int         need_root,
     int *      stdinfd,
     int *      stdoutfd,
     int *      stderrfd,
@@ -49,7 +50,8 @@ pipespawn(
     }
     arglist_end(ap);
 
-    pid = pipespawnv_passwd(prog, pipedef, stdinfd, stdoutfd, stderrfd, argv);
+    pid = pipespawnv_passwd(prog, pipedef, need_root,
+                           stdinfd, stdoutfd, stderrfd, argv);
     amfree(argv);
     return pid;
 }
@@ -58,12 +60,14 @@ pid_t
 pipespawnv(
     char *     prog,
     int                pipedef,
+    int                need_root,
     int *      stdinfd,
     int *      stdoutfd,
     int *      stderrfd,
     char **    my_argv)
 {
-    return pipespawnv_passwd(prog, pipedef, stdinfd, stdoutfd, stderrfd,
+    return pipespawnv_passwd(prog, pipedef, need_root,
+                            stdinfd, stdoutfd, stderrfd,
        my_argv);
 }
 
@@ -71,6 +75,7 @@ pid_t
 pipespawnv_passwd(
     char *     prog,
     int                pipedef,
+    int                need_root,
     int *      stdinfd,
     int *      stdoutfd,
     int *      stderrfd,
@@ -96,6 +101,7 @@ pipespawnv_passwd(
        passwdvar = *my_argv++;
        passwdfd  = (int *)*my_argv++;
     }
+    g_debug("pipespawnv: stdoutfd is %d", *stdoutfd);
     memset(inpipe, -1, SIZEOF(inpipe));
     memset(outpipe, -1, SIZEOF(outpipe));
     memset(errpipe, -1, SIZEOF(errpipe));
@@ -225,6 +231,8 @@ pipespawnv_passwd(
            safe_fd(-1, 0);
        }
 
+       if (need_root)
+           become_root();
        execve(prog, my_argv, env);
        e = strerror(errno);
        error(_("error [exec %s: %s]"), prog, e);
index 8b81f58d9d4755e78d67363c5bebcd8b07a45e8c..581312154285cc08af833ec48978076f638a27e7 100644 (file)
@@ -12,10 +12,10 @@ extern char skip_argument[1];
 #define STDERR_PIPE    (1 << 2)
 #define PASSWD_PIPE    (1 << 3)
 
-pid_t pipespawn(char *prog, int pipedef,
+pid_t pipespawn(char *prog, int pipedef, int need_root,
                 int *stdinfd, int *stdoutfd, int *stderrfd,
                 ...);
-pid_t pipespawnv(char *prog, int pipedef,
+pid_t pipespawnv(char *prog, int pipedef, int need_root,
                  int *stdinfd, int *stdoutfd, int *stderrfd,
                  char **my_argv);
 
index da587042749e6679fc4150c9c150783612291259..3cad500f71b56e16d881f7998eeac56a24993f7f 100644 (file)
@@ -159,7 +159,7 @@ protocol_sendreq(
     p->resettries = RESET_TRIES;
     p->reqtries = getconf_int(CNF_REQ_TRIES);
     p->conf_fn = conf_fn;
-    pkt_init(&p->req, P_REQ, req);
+    pkt_init(&p->req, P_REQ, "%s", req);
 
     /*
      * These are here for the caller
diff --git a/common-src/queueing-test.c b/common-src/queueing-test.c
new file mode 100644 (file)
index 0000000..7e78e81
--- /dev/null
@@ -0,0 +1,314 @@
+/*
+ * Copyright (c) 2008 Zmanda Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ *
+ * 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.,
+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ * Contact information: Zmanda Inc, 465 N Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ *
+ * Author: Dustin J. Mitchell <dustin@zmanda.com>
+ */
+
+#include "amanda.h"
+#include "testutils.h"
+#include "glib-util.h"
+#include "queueing.h"
+
+/****
+ * Test a simple queue
+ */
+
+struct test_queue_simple_data {
+    size_t bytes_to_produce;
+
+    /* The counters here are used to produce a slowly changing 
+     * bytesequence, which should not align with block or buffer
+     * boundaries. */
+    size_t bytes_produced;
+    guint32 producer_counter;
+
+    size_t bytes_consumed;
+    guint32 consumer_counter;
+};
+
+static producer_result_t
+test_queue_simple_producer(
+    gpointer data,
+    queue_buffer_t *buffer,
+    size_t hint_size)
+{
+    struct test_queue_simple_data *d = (struct test_queue_simple_data *)data;
+    size_t to_write = hint_size;
+    size_t i;
+
+    /* just for fun, write a little bit more sometimes */
+    to_write += d->producer_counter % 50;
+
+    /* but not too much */
+    if (to_write > d->bytes_to_produce - d->bytes_produced)
+       to_write = d->bytes_to_produce - d->bytes_produced;
+
+    /* make sure the buffer is big enough */
+    if (buffer->data == NULL) {
+       buffer->data = g_malloc(to_write);
+       buffer->alloc_size = to_write;
+    } else if (buffer->alloc_size < to_write) {
+       buffer->data = g_realloc(buffer->data, to_write);
+       buffer->alloc_size = to_write;
+    }
+    /* g_debug("Producing %zd bytes in %p (@%p)", to_write, buffer, buffer->data); */
+
+    /* fill in the data with some random junk */
+    for (i = 0; i < to_write; i++) {
+       buffer->data[i] = (char)(d->producer_counter / 7 + (d->producer_counter >> 10));
+       d->producer_counter++;
+    }
+
+    /* and call it a day */
+    buffer->offset = 0;
+    buffer->data_size = to_write;
+    d->bytes_produced += to_write;
+    return d->bytes_produced >= d->bytes_to_produce?
+        PRODUCER_FINISHED
+       : PRODUCER_MORE;
+}
+
+static ssize_t
+test_queue_simple_consumer(
+    gpointer data,
+    queue_buffer_t *buffer)
+{
+    struct test_queue_simple_data *d = (struct test_queue_simple_data *)data;
+    size_t to_read = buffer->data_size;
+    size_t i;
+
+    g_assert(buffer->data != NULL);
+    g_assert(buffer->data_size != 0);
+
+    /* let's not read it all, to make sure that we get called back with the
+     * remainder */
+    to_read = buffer->data_size;
+    if (to_read > 1000) to_read = 1000;
+
+    /* verify the contents of the buffer */
+    /* g_debug("Consuming %zd bytes starting at %d in %p (@%p)", to_read, buffer->offset, buffer, buffer->data); */
+    for (i = 0; i < to_read; i++) {
+       char expected = d->consumer_counter / 7 + (d->consumer_counter >> 10);
+       if (buffer->data[buffer->offset + i] != expected) {
+           tu_dbg("expected %d, but got %d at byte position %zd\n",
+               (int)expected, buffer->data[i], i);
+           return -1;
+       }
+       d->consumer_counter++;
+    }
+    d->bytes_consumed += to_read;
+
+    return to_read;
+}
+
+static int
+test_queue_simple(StreamingRequirement sr)
+{
+    queue_result_flags qr;
+    gboolean success = TRUE;
+
+    struct test_queue_simple_data d = {
+       10*1024*1024, /* bytes_to_produce */
+       0, /* bytes_produced */
+       0, /* producer_counter */
+       0, /* bytes_consumed */
+       0 /* consumer_counter */
+    };
+
+    qr = do_consumer_producer_queue_full(
+       test_queue_simple_producer, (gpointer)&d,
+       test_queue_simple_consumer, (gpointer)&d,
+       10230, /* almost 10k */
+       3*1024*1024, /* 3M */
+       sr);
+
+    if (qr != QUEUE_SUCCESS) {
+       tu_dbg("Expected result QUEUE_SUCCESS (%d); got %d\n",
+           QUEUE_SUCCESS, qr);
+       success = FALSE;
+    }
+
+    if (d.bytes_produced != d.bytes_to_produce) {
+       tu_dbg("Expected to produce %zd bytes; produced %zd\n",
+           d.bytes_to_produce, d.bytes_produced);
+       success = FALSE;
+    }
+
+    if (d.bytes_consumed != d.bytes_to_produce) {
+       tu_dbg("Expected to consume %zd bytes; consumed %zd\n",
+           d.bytes_to_produce, d.bytes_consumed);
+       success = FALSE;
+    }
+
+    return success;
+}
+
+static int
+test_queue_simple_STREAMING_REQUIREMENT_NONE(void)
+{
+    return test_queue_simple(STREAMING_REQUIREMENT_NONE);
+}
+
+static int
+test_queue_simple_STREAMING_REQUIREMENT_DESIRED(void)
+{
+    return test_queue_simple(STREAMING_REQUIREMENT_DESIRED);
+}
+
+static int
+test_queue_simple_STREAMING_REQUIREMENT_REQUIRED(void)
+{
+    return test_queue_simple(STREAMING_REQUIREMENT_REQUIRED);
+}
+
+/****
+ * Test fd_reader and fd_writer
+ */
+
+#define TEST_FD_CONSUMER_PRODUCER_BLOCKS (1024)
+
+static gpointer
+data_producer_thread(gpointer d)
+{
+    int fd = GPOINTER_TO_INT(d);
+    char buf[1024];
+    size_t i;
+    int block;
+
+    /* fill in the buffer with some stuff */
+    for (i = 0; i < (int)sizeof(buf); i++) {
+       buf[i] = (char)i;
+    }
+
+    /* and write it out in blocks */
+    for (block = 0; block < TEST_FD_CONSUMER_PRODUCER_BLOCKS; block++) {
+       size_t written = 0;
+       while (written < sizeof(buf)) {
+           int len = write(fd, buf + written, sizeof(buf) - written);
+           if (len < 0) {
+               perror("writing pipe to fd_read_producer");
+               close(fd);
+               return GINT_TO_POINTER(0);
+           }
+           written += len;
+       }
+    }
+
+    close(fd);
+    return GINT_TO_POINTER(1);
+}
+
+static gpointer
+data_consumer_thread(gpointer d)
+{
+    int fd = GPOINTER_TO_INT(d);
+    char buf[1024];
+    size_t i;
+    int block;
+
+    /* and read it in in blocks */
+    for (block = 0; block < TEST_FD_CONSUMER_PRODUCER_BLOCKS; block++) {
+       size_t bytes_read = 0;
+       while (bytes_read < sizeof(buf)) {
+           int len = read(fd, buf + bytes_read, sizeof(buf) - bytes_read);
+           if (len < 0) {
+               perror("reading pipe from fd_write_consumer");
+               return NULL;
+           }
+           bytes_read += len;
+       }
+
+       /* verify the block */
+       for (i = 0; i < (int)sizeof(buf); i++) {
+           if (buf[i] != (char)i) {
+               tu_dbg("result data does not match input; block %d byte %zd", block, i);
+               close(fd);
+               return GINT_TO_POINTER(0);
+           }
+       }
+    }
+
+    close(fd);
+    return GINT_TO_POINTER(1);
+}
+
+static int
+test_fd_consumer_producer(void)
+{
+    gboolean success;
+    GThread *rth, *wth;
+    int input_pipe[2];
+    int output_pipe[2];
+    queue_fd_t queue_read = {0, NULL};
+    queue_fd_t queue_write = {0, NULL};
+
+    /* create pipes and hook up threads to them */
+    if (pipe(input_pipe) < 0) {
+       perror("pipe(input_pipe)");
+       return FALSE;
+    }
+    if (pipe(output_pipe) < 0) {
+       perror("pipe(output_pipe)");
+       return FALSE;
+    }
+
+    wth = g_thread_create(data_producer_thread, GINT_TO_POINTER(input_pipe[1]), TRUE, NULL);
+    rth = g_thread_create(data_consumer_thread, GINT_TO_POINTER(output_pipe[0]), TRUE, NULL);
+
+    /* run the queue */
+    queue_read.fd = input_pipe[0];
+    queue_write.fd = output_pipe[1];
+    success = do_consumer_producer_queue(
+       fd_read_producer, &queue_read,
+       fd_write_consumer, &queue_write);
+    if (!success)
+       tu_dbg("do_consumer_producer_queue returned FALSE");
+
+    /* and examine the results */
+    success = GPOINTER_TO_INT(g_thread_join(wth)) && success;
+    success = GPOINTER_TO_INT(g_thread_join(rth)) && success;
+
+    /* close stuff up */
+    close(input_pipe[0]);
+    close(input_pipe[1]);
+    close(output_pipe[0]);
+    close(output_pipe[1]);
+
+    return success;
+}
+
+/*
+ * Main driver
+ */
+
+int
+main(int argc, char **argv)
+{
+    static TestUtilsTest tests[] = {
+       TU_TEST(test_queue_simple_STREAMING_REQUIREMENT_NONE, 15),
+       TU_TEST(test_queue_simple_STREAMING_REQUIREMENT_DESIRED, 15),
+       TU_TEST(test_queue_simple_STREAMING_REQUIREMENT_REQUIRED, 15),
+       TU_TEST(test_fd_consumer_producer, 60), /* runs slowly on old kernels */
+       TU_END()
+    };
+
+    glib_init();
+
+    return testutils_run_tests(argc, argv, tests);
+}
diff --git a/common-src/queueing.c b/common-src/queueing.c
new file mode 100644 (file)
index 0000000..672d844
--- /dev/null
@@ -0,0 +1,524 @@
+/*
+ * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+ * 
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License version 2.1 as 
+ * published by the Free Software Foundation.
+ * 
+ * This 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 this library; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+ * 
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+ */
+
+#include "queueing.h"
+#include "semaphore.h"
+#include "amanda.h"
+
+/* Queueing framework here. */
+typedef struct {
+    size_t block_size;
+    StreamingRequirement streaming_mode;
+
+    ProducerFunctor producer;
+    gpointer producer_user_data;
+
+    ConsumerFunctor consumer;
+    gpointer consumer_user_data;
+
+    GAsyncQueue *data_queue, *free_queue;
+    semaphore_t *free_memory;
+} queue_data_t;
+
+static queue_buffer_t *invent_buffer(void) {
+    queue_buffer_t *rval;
+    rval = g_new(queue_buffer_t, 1);
+
+    rval->data = NULL;
+    rval->alloc_size = 0;
+    rval->data_size = 0;
+    rval->offset = 0;
+
+    return rval;
+}
+
+void free_buffer(queue_buffer_t *buf) {
+    if (buf != NULL)
+        amfree(buf->data);
+    amfree(buf);
+}
+
+static queue_buffer_t * merge_buffers(queue_buffer_t *buf1,
+                                      queue_buffer_t *buf2) {
+    if (buf1 == NULL)
+        return buf2;
+    else if (buf2 == NULL)
+        return buf1;
+
+    if (buf2->offset >= buf1->data_size) {
+        /* We can fit buf1 at the beginning of buf2. */
+        memcpy(buf2->data + buf2->offset - buf1->data_size,
+               buf1->data + buf1->offset,
+               buf1->data_size);
+        buf2->offset -= buf1->data_size;
+        buf2->data_size += buf1->data_size;
+        free_buffer(buf1);
+        return buf2;
+    } else if (buf1->alloc_size - buf1->offset - buf1->data_size
+               >= buf2->data_size) {
+        /* We can fit buf2 at the end of buf1. */
+        memcpy(buf1->data + buf1->offset + buf1->data_size,
+               buf2->data + buf2->offset, buf2->data_size);
+        buf1->data_size += buf2->data_size;
+        free_buffer(buf2);
+        return buf1;
+    } else {
+        /* We can grow buf1 and put everything there. */
+        if (buf1->offset != 0) {
+            /* But first we have to fix up buf1. */
+            memmove(buf1->data, buf1->data + buf1->offset, buf1->data_size);
+            buf1->offset = 0;
+        }
+        buf1->alloc_size = buf1->data_size + buf2->data_size;
+        buf1->data = realloc(buf1->data, buf1->alloc_size);
+        memcpy(buf1->data + buf1->data_size, buf2->data + buf2->offset,
+               buf2->data_size);
+        buf1->data_size = buf1->alloc_size;
+        free_buffer(buf2);
+        return buf1;
+    }
+}
+
+/* Invalidate the first "bytes" bytes of the buffer, by adjusting the
+   offset and data size. */
+static void consume_buffer(queue_buffer_t* buf, ssize_t bytes) {
+    g_assert(bytes >= 0 && bytes <= (ssize_t)buf->data_size);
+    buf->offset += bytes;
+    buf->data_size -= bytes;
+}
+
+/* Looks at the buffer to see how much free space it has. If it has more than
+ * twice the data size of unused space at the end, or more than four times
+ * the data size of unused space at the beginning, then that space is
+ * reclaimed. */
+static void heatshrink_buffer(queue_buffer_t *buf) {
+    if (buf == NULL)
+        return;
+
+    if (G_UNLIKELY(buf->offset > buf->data_size * 4)) {
+        /* Consolodate with memmove. We will reclaim the space in the next
+         * step. */
+        memmove(buf->data, buf->data + buf->offset, buf->data_size);
+        buf->offset = 0;
+    } 
+
+    if (buf->alloc_size > buf->data_size*2 + buf->offset) {
+        buf->alloc_size = buf->data_size + buf->offset;
+        buf->data = realloc(buf->data, buf->alloc_size);
+    }
+}
+
+static gpointer do_producer_thread(gpointer datap) {
+    queue_data_t* data = datap;
+
+    for (;;) {
+        queue_buffer_t *buf;
+        gboolean result;
+
+        semaphore_decrement(data->free_memory, 0);
+        buf = g_async_queue_try_pop(data->free_queue);
+        if (buf != NULL && buf->data == NULL) {
+            /* Consumer is finished, then so are we. */
+            amfree(buf);
+            return GINT_TO_POINTER(TRUE);
+        }
+
+        if (buf == NULL) {
+            buf = invent_buffer();
+        }
+        buf->offset = 0;
+        buf->data_size = 0;
+
+        result = data->producer(data->producer_user_data, buf,
+                                data->block_size);
+
+        // Producers can allocate way too much memory.
+        heatshrink_buffer(buf);
+
+        if (buf->data_size > 0) {
+            semaphore_force_adjust(data->free_memory, -buf->alloc_size);
+            
+            g_async_queue_push(data->data_queue, buf);
+            buf = NULL;
+        } else {
+            g_assert(result != PRODUCER_MORE);
+            free_buffer(buf);
+            buf = NULL;
+        }
+
+
+        if (result == PRODUCER_MORE) {
+            continue;
+        } else {
+            /* We are finished (and the first to do so). */
+            g_async_queue_push(data->data_queue, invent_buffer());
+            semaphore_force_set(data->free_memory, INT_MIN);
+
+            return GINT_TO_POINTER(result == PRODUCER_FINISHED);
+        }
+    }
+}
+
+static gpointer do_consumer_thread(gpointer datap) {
+    queue_data_t* data = datap;
+    gboolean got_eof = FALSE;
+    queue_buffer_t *buf = NULL;
+
+    if (data->streaming_mode != STREAMING_REQUIREMENT_NONE) {
+        semaphore_wait_empty(data->free_memory);
+    }
+
+    for (;;) {
+        gboolean result;
+
+       /* Pull in and merge buffers until we have at least data->block_size
+        * bytes, or there are no more buffers */
+        while (!got_eof && (buf == NULL || buf->data_size < data->block_size)) {
+            queue_buffer_t *next_buf;
+            if (data->streaming_mode == STREAMING_REQUIREMENT_DESIRED) {
+                do {
+                    next_buf = g_async_queue_try_pop(data->data_queue);
+                    if (next_buf == NULL) {
+                        semaphore_wait_empty(data->free_memory);
+                    }
+                } while (next_buf == NULL);
+            } else {
+                next_buf = g_async_queue_pop(data->data_queue);
+                g_assert(next_buf != NULL);
+            }
+
+            if (next_buf->data == NULL) {
+                /* A buffer with NULL data is an EOF from the producer */
+                free_buffer(next_buf);
+               got_eof = TRUE;
+               break;
+            }
+
+            semaphore_increment(data->free_memory, next_buf->alloc_size);
+
+            buf = merge_buffers(buf, next_buf);
+        }
+
+       /* If we're out of data, then we are done. */
+       if (buf == NULL)
+           break;
+
+        result = data->consumer(data->consumer_user_data, buf);
+
+        if (result > 0) {
+            consume_buffer(buf, result);
+            if (buf->data_size == 0) {
+                g_async_queue_push(data->free_queue, buf);
+                buf = NULL;
+            }
+            continue;
+        } else {
+            free_buffer(buf);
+            return GINT_TO_POINTER(FALSE);
+        }
+    }
+
+    /* We are so outta here. */
+    return GINT_TO_POINTER(TRUE);
+}
+
+/* Empties a buffer queue and frees all the buffers associated with it.
+ *
+ * If full_cleanup is TRUE, then we delete the queue itself.
+ * If full_cleanup is FALSE, then we leave the queue around, with a
+ *         signal element in it. */
+static void cleanup_buffer_queue(GAsyncQueue *Q, gboolean full_cleanup) {
+    g_async_queue_lock(Q);
+    for (;;) {
+        queue_buffer_t *buftmp;
+        buftmp = g_async_queue_try_pop_unlocked(Q);
+        if (buftmp == NULL)
+            break;
+
+        free_buffer(buftmp);
+    }
+    if (!full_cleanup)
+        g_async_queue_push_unlocked(Q, invent_buffer());
+
+    g_async_queue_unlock(Q);
+    
+    if (full_cleanup)
+        g_async_queue_unref(Q);
+}
+
+/* This function sacrifices performance, but will still work just
+   fine, on systems where threads are not supported. */
+static queue_result_flags
+do_unthreaded_consumer_producer_queue(size_t block_size,
+                                      ProducerFunctor producer,
+                                      gpointer producer_user_data,
+                                      ConsumerFunctor consumer,
+                                      gpointer consumer_user_data) {
+    queue_buffer_t *buf = NULL, *next_buf = NULL;
+    gboolean finished = FALSE;
+    queue_result_flags rval = 0;
+
+    /* The basic theory of operation here is to read until we have
+       enough data to write, then write until we don't.. */
+    while (!finished) {
+        producer_result_t result;
+        
+        while ((buf == NULL || buf->data_size < block_size) && !finished) {
+            if (next_buf == NULL)
+                next_buf = invent_buffer();
+
+            result = producer(producer_user_data, next_buf, block_size);
+
+            if (result != PRODUCER_MORE) {
+                finished = TRUE;
+                if (result != PRODUCER_FINISHED) {
+                    rval |= QUEUE_PRODUCER_ERROR;
+                }
+            }
+
+            buf = merge_buffers(buf, next_buf);
+            next_buf = NULL;
+        }
+
+        while (buf != NULL && buf->data_size > 0 &&
+               (buf->data_size >= block_size || finished)) {
+            result = consumer(consumer_user_data, buf);
+            
+            if (result > 0) {
+                consume_buffer(buf, result);
+                if (buf->data_size == 0) {
+                    next_buf = buf;
+                    buf = NULL;
+                }
+            } else {
+                finished = TRUE;
+                rval |= QUEUE_CONSUMER_ERROR;
+                break;
+            }
+        }
+    }
+
+    free_buffer(buf);
+    free_buffer(next_buf);
+    return rval;
+}
+
+gboolean do_consumer_producer_queue(ProducerFunctor producer,
+                                    gpointer producer_user_data,
+                                    ConsumerFunctor consumer,
+                                    gpointer consumer_user_data) {
+    return QUEUE_SUCCESS ==
+        do_consumer_producer_queue_full(producer, producer_user_data,
+                                        consumer, consumer_user_data,
+                                        0, DEFAULT_MAX_BUFFER_MEMORY,
+                                        STREAMING_REQUIREMENT_NONE);
+}
+
+queue_result_flags
+do_consumer_producer_queue_full(ProducerFunctor producer,
+                                gpointer producer_user_data,
+                                ConsumerFunctor consumer,
+                                gpointer consumer_user_data,
+                                size_t block_size,
+                                size_t max_memory,
+                                StreamingRequirement streaming_mode) {
+    GThread     * producer_thread;
+    GThread     * consumer_thread;
+    queue_data_t  queue_data;
+    gpointer      producer_result;
+    gpointer      consumer_result;
+    queue_result_flags rval;
+
+    if (block_size <= 0) {
+        block_size = DISK_BLOCK_BYTES;
+    }
+
+    g_return_val_if_fail(producer != NULL, FALSE);
+    g_return_val_if_fail(consumer != NULL, FALSE);
+
+    if (!g_thread_supported()) {
+        return do_unthreaded_consumer_producer_queue(block_size, producer,
+                                                     producer_user_data,
+                                                     consumer,
+                                                     consumer_user_data);
+    }
+
+    queue_data.block_size = block_size;
+    queue_data.producer = producer;
+    queue_data.producer_user_data = producer_user_data;
+    queue_data.consumer = consumer;
+    queue_data.consumer_user_data = consumer_user_data;
+    queue_data.streaming_mode = streaming_mode;
+
+    queue_data.data_queue = g_async_queue_new();
+    queue_data.free_queue = g_async_queue_new();
+
+    max_memory = MAX(1,MIN(max_memory, INT_MAX / 2));
+    queue_data.free_memory = semaphore_new_with_value(max_memory);
+
+    producer_thread = g_thread_create(do_producer_thread, &queue_data,
+                                      TRUE,
+                                      NULL /* FIXME: Should handle
+                                              errors. */);
+    consumer_thread = g_thread_create(do_consumer_thread, &queue_data,
+                                      TRUE,
+                                      NULL /* FIXME: Should handle
+                                              errors. */);
+    
+    /* The order of cleanup here is very important, to avoid deadlock. */
+    /* 1) Reap the consumer. */
+    consumer_result = g_thread_join(consumer_thread);
+    /* 2) Stop the producer. */
+    semaphore_force_set(queue_data.free_memory, -1);
+    /* 3) Cleanup the free queue; add a signal flag. */
+    cleanup_buffer_queue(queue_data.free_queue, FALSE);
+    /* 4) Restart the producer (so it can exit). */
+    semaphore_force_set(queue_data.free_memory, INT_MAX);
+    /* 5) Reap the producer. */
+    producer_result = g_thread_join(producer_thread);
+
+    cleanup_buffer_queue(queue_data.free_queue, TRUE);
+    cleanup_buffer_queue(queue_data.data_queue, TRUE);
+
+    semaphore_free(queue_data.free_memory);
+    
+    rval = 0;
+    if (!GPOINTER_TO_INT(producer_result)) {
+        rval |= QUEUE_PRODUCER_ERROR;
+    }
+    if (!GPOINTER_TO_INT(consumer_result)) {
+        rval |= QUEUE_CONSUMER_ERROR;
+    }
+    return rval;
+}
+
+/* Commonly-useful producers and consumers below. */
+
+queue_fd_t *
+queue_fd_new(
+    int fd,
+    char *errmsg)
+{
+    queue_fd_t *queue_fd;
+
+    queue_fd = malloc(sizeof(queue_fd_t));
+    queue_fd->fd = fd;
+    queue_fd->errmsg = errmsg;
+
+    return queue_fd;
+}
+
+int
+queue_fd_fd(
+    queue_fd_t *queue_fd)
+{
+    return queue_fd->fd;
+}
+
+char *queue_fd_errmsg(
+    queue_fd_t *queue_fd)
+{
+    return queue_fd->errmsg;
+}
+
+producer_result_t fd_read_producer(gpointer f_queue_fd, queue_buffer_t *buffer,
+                                   size_t hint_size) {
+    int fd;
+    queue_fd_t *queue_fd = (queue_fd_t *)f_queue_fd;
+    fd = queue_fd->fd;
+    g_assert(fd >= 0);
+    g_assert(buffer->data_size == 0);
+
+    buffer->offset = 0;
+
+    if (buffer->data == NULL) {
+        /* Set up the buffer. */
+        buffer->data = malloc(hint_size);
+        buffer->alloc_size = hint_size;
+    }
+
+    for (;;) {
+        ssize_t result;
+        result = read(fd, buffer->data, buffer->alloc_size);
+
+        if (result > 0) {
+            buffer->data_size = result;
+            return PRODUCER_MORE;
+        } else if (result == 0) {
+            /* End of file. */
+            return PRODUCER_FINISHED;
+        } else if (0
+#ifdef EAGAIN
+                || errno == EAGAIN
+#endif
+#ifdef EWOULDBLOCK
+                || errno == EWOULDBLOCK
+#endif
+#ifdef EINTR
+                || errno == EINTR
+#endif
+                ) {
+                /* Try again. */
+                continue;
+        } else {
+            /* Error occured. */
+           queue_fd->errmsg = newvstrallocf(queue_fd->errmsg,
+               "Error reading fd %d: %s\n", fd, strerror(errno));
+            return PRODUCER_ERROR;
+        }
+    }
+}
+
+ssize_t fd_write_consumer(gpointer f_queue_fd, queue_buffer_t *buffer) {
+    int fd;
+    queue_fd_t *queue_fd = (queue_fd_t *)f_queue_fd;
+    fd = queue_fd->fd;
+
+    g_assert(fd >= 0);
+
+    g_return_val_if_fail(buffer->data_size > 0, 0);
+
+    for (;;) {
+        ssize_t write_size;
+        write_size = write(fd, buffer->data + buffer->offset,
+                           buffer->data_size);
+        
+        if (write_size > 0) {
+            return write_size;
+        } else if (0
+#ifdef EAGAIN
+                || errno == EAGAIN
+#endif
+#ifdef EWOULDBLOCK
+                || errno == EWOULDBLOCK
+#endif
+#ifdef EINTR
+                || errno == EINTR
+#endif
+                ) {
+                /* Try again. */
+                continue;
+        } else {
+            /* Error occured. */
+            g_fprintf(stderr, "Error writing fd %d: %s\n", fd, strerror(errno));
+            return -1;
+        }        
+    }
+}
diff --git a/common-src/queueing.h b/common-src/queueing.h
new file mode 100644 (file)
index 0000000..248c11b
--- /dev/null
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+ * 
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License version 2.1 as 
+ * published by the Free Software Foundation.
+ * 
+ * This 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 this library; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+ * 
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+ */
+
+#ifndef QUEUEING_H
+#define QUEUEING_H
+
+/* This file contains the code for fast threaded reading and writing to/from
+ * media, for devices that don't require any special handling. Some
+ * devices (e.g., CD-ROM) may use a different method for bulk reads or
+ * writes. */
+
+#include "amanda.h"
+#include <glib.h>
+
+#define DEFAULT_MAX_BUFFER_MEMORY (1*1024*1024)
+
+typedef enum {
+    STREAMING_REQUIREMENT_NONE,
+    STREAMING_REQUIREMENT_DESIRED,
+    STREAMING_REQUIREMENT_REQUIRED
+} StreamingRequirement;
+
+/* Valid data in this structure starts at data + offset, and has size
+ * data_size. Allocation starts at data and has size alloc_size. */
+typedef struct {
+    char *data;
+    size_t alloc_size;
+    size_t data_size;
+    size_t offset;
+} queue_buffer_t;
+
+void free_buffer(queue_buffer_t*);
+
+typedef enum {
+    PRODUCER_MORE,     /* Means the producer should be run again. */
+    PRODUCER_FINISHED, /* Means that no error occured, but the
+                          producer should not be run again. */
+    PRODUCER_ERROR     /* Means an error occured, and the producer
+                          should not be run again. */
+} producer_result_t;
+
+typedef enum {
+    QUEUE_SUCCESS = 0,
+    QUEUE_PRODUCER_ERROR = 1 << 0,
+    QUEUE_CONSUMER_ERROR = 1 << 1,
+    QUEUE_INTERNAL_ERROR = 1 << 2
+} queue_result_flags;
+
+/* The producer takes the given buffer (which is not itself NULL, but may contain
+ * a NULL data segment), and fills it with data. The producer can allocate or
+ * reallocate the buffer's 'data' element as necessary; the queueing system will
+ * free it when necessary. The result of the production operation is specified in
+ * the return value, but if the buffer is left without data, then that is
+ * interpreted as PRODUCER_ERROR. For optimal performance, the producer should
+ * supply exactly hint_size bytes of data in each call, but this is not required.
+ *
+ * The consumer is given a buffer (which will not be NULL, nor contain a NULL data
+ * segment), and is expected to process some or all of the data in that buffer. If
+ * there is a problem consuming data (such that no further data can be consumed),
+ * the consumer may return -1. Otherwise, the consumer should return the number of
+ * bytes actually consumed.  If an error occurs, it should return -1, regardless
+ * of the number of bytes consumed.  The queueing framework will ensure that all
+ * blocks have at least hint_size bytes, except the last.  For optimal
+ * performance, the consumer should consume the entire buffer at each call, but
+ * this is not required.
+ *
+ * Note that the handling of the queue_buffer_t is different between the two
+ * functions: The producer should update queue_buffer_t as necessary to corespond
+ * to read data, while the consumer should leave the queue_buffer_t unadjusted:
+ * The queueing framework will invalidate data in the buffer according to the
+ * return value of the consumer.*/
+
+typedef producer_result_t (* ProducerFunctor)(gpointer user_data,
+                                              queue_buffer_t* buffer,
+                                              size_t hint_size);
+typedef ssize_t (* ConsumerFunctor)(gpointer user_data,
+                                queue_buffer_t* buffer);
+
+
+/* These functions make the magic happen. The first one assumes
+   reasonable defaults, the second one provides more options.
+   % producer           : A function that provides data to write.
+   % producer_user_data : A pointer to pass to that function.
+   % consumer           : A function that writes data out.
+   % consumer_user_data : A pointer to pass to that function.
+   % block_size         : Size of chunks to write out to consumer. If
+                          nonpositive, data will be written in
+                          variable-sized chunks.
+   % max_memory         : Amount of memory to be used for buffering.
+                          (default is DEFAULT_MAX_BUFFER_MEMORY).
+   % streaming_mode     : Describes streaming mode.
+         STREAMING_REQUIREMENT_NONE:     Data will be written as fast
+                                         as possible. No prebuffering
+                                         will be done.
+         STREAMING_REQUIREMENT_DESIRED:  max_memory bytes of data will
+                                         be prebuffered, and if the
+                                         buffer ever empties, no data
+                                         will be written until it
+                                         fills again.
+         STREAMING_REQUIREMENT_REQUIRED: max_memory bytes of data will
+                                         be prebuffered, and
+                                         thereafter data will be
+                                         written as fast as possible.
+*/
+gboolean
+do_consumer_producer_queue(ProducerFunctor producer,
+                           gpointer producer_user_data,
+                           ConsumerFunctor consumer,
+                           gpointer consumer_user_data);
+queue_result_flags
+do_consumer_producer_queue_full(ProducerFunctor producer,
+                                gpointer producer_user_data,
+                                ConsumerFunctor consumer,
+                                gpointer consumer_user_data,
+                                size_t block_size,
+                                size_t max_memory,
+                                StreamingRequirement streaming_mode);
+
+/* Some commonly-useful producers and consumers.*/
+
+/* These functions will call read() or write() respectively. The user
+   data should be a pointer to an queue_fd_t, with fd set to the device
+   descriptor and errmsg set to NULL. */
+
+typedef struct {
+    int fd;
+    char *errmsg;
+} queue_fd_t;
+
+queue_fd_t *queue_fd_new(int fd, char *errmsg);
+int queue_fd_fd(queue_fd_t *queue_fd);
+char *queue_fd_errmsg(queue_fd_t *queue_fd);
+
+producer_result_t fd_read_producer(gpointer queue_fd, queue_buffer_t *buffer,
+                                   size_t hint_size);
+ssize_t fd_write_consumer(gpointer queue_fd, queue_buffer_t *buffer);
+
+
+
+#endif /* QUEUEING_H */
diff --git a/common-src/quoting-test.c b/common-src/quoting-test.c
new file mode 100644 (file)
index 0000000..1654b05
--- /dev/null
@@ -0,0 +1,492 @@
+/*
+ * Copyright (c) 2008 Zmanda Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ *
+ * 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.,
+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ * Contact information: Zmanda Inc, 465 N Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ *
+ * Author: Dustin J. Mitchell <dustin@zmanda.com>
+ */
+
+#include "amanda.h"
+#include "testutils.h"
+#include "util.h"
+
+/* Utilities */
+
+static char *
+safestr(const char *str) {
+    static char hex[] = "0123456789abcdef";
+    const char *p;
+    char *result = malloc(3 + strlen(str) * 3);
+    char *r = result;
+
+    *(r++) = '|';
+    for (p = str; *p; p++) {
+       if (isprint((int)*p)) {
+           *(r++) = *p;
+       } else {
+           *(r++) = '#';
+           *(r++) = hex[((*p)&0xf0) >> 4];
+           *(r++) = hex[(*p)&0xf];
+       }
+    }
+    *(r++) = '|';
+    *(r++) = '\0';
+
+    return result;
+}
+
+char * quotable_strings[] = {
+    "",
+    "simple",
+    "sp a ces",
+    "\"foo bar\"",
+    "back\\slash",
+    "escaped\\ space",
+    "escaped\\\"quote",
+    "balanced \"internal\" quotes",
+    "\"already quoted\" string",
+    "string that's \"already quoted\"",
+    "internal\"quote",
+    "bs-end\\",
+    "backslash\\nletter",
+    "backslash\\tletter",
+    "\t", "\r", "\n", "\f", "\004",
+    "new\nline",
+    "newline-end\n",
+    "ta\tb",
+    "tab-end\t",
+    "\\\\\\\\",
+    "\"",
+    NULL
+};
+
+/****
+ * Round-trip testing of quoting functions
+ */
+
+static int
+test_round_trip(void)
+{
+    char **strp;
+    gboolean success = TRUE;
+
+    for (strp = quotable_strings; *strp; strp++) {
+       char *quoted, *unquoted;
+
+       quoted = quote_string(*strp);
+       unquoted = unquote_string(quoted);
+
+       /* if they're not the same, complain */
+       if (0 != strcmp(*strp, unquoted)) {
+           char *safe_orig = safestr(*strp);
+           char *safe_quoted = safestr(quoted);
+           char *safe_unquoted = safestr(unquoted);
+
+           printf("  bad round-trip: %s -quote_string-> %s -unquote_string-> %s\n",
+               safe_orig, safe_quoted, safe_unquoted);
+
+           amfree(safe_orig);
+           amfree(safe_quoted);
+           amfree(safe_unquoted);
+
+           success = FALSE;
+       }
+
+       amfree(quoted);
+       amfree(unquoted);
+    }
+
+    return success;
+}
+
+/***
+ * Test that the new split_quoted_strings acts identically to
+ * the old split(), albeit with a different set of arguments and
+ * return value.  Note that we only test with a delimiter of " ",
+ * as split() is not used with any other delimiter.
+ */
+
+static gboolean
+compare_strv(
+    const char **exp,
+    char **got,
+    const char *source,
+    const char *original)
+{
+    const char **a = exp;
+    char **b = got;
+    while (*a && *b) {
+       if (0 != strcmp(*a, *b))
+           break;
+       a++; b++;
+    }
+
+    /* did we exit the loop early, or were they different lengths? */
+    if (*a || *b) {
+       char *safe;
+
+       safe = safestr(original);
+       g_printf("  %s: expected [", safe);
+       amfree(safe);
+       for (a = exp; *a; a++) {
+           safe = safestr(*a);
+           g_printf("%s%s", safe, *(a+1)? ", " : "");
+           amfree(safe);
+       }
+       g_printf("] but got [");
+       for (b = got; *b; b++) {
+           safe = safestr(*b);
+           g_printf("%s%s", safe, *(b+1)? ", " : "");
+           amfree(safe);
+       }
+       g_printf("] using %s.\n", source);
+
+       return FALSE;
+    }
+
+    return TRUE;
+}
+
+static int
+test_split_quoted_strings(void)
+{
+    char **iter1, **iter2, **iter3;
+    gboolean success = TRUE;
+    char *middle_strings[] = {
+       "",
+       "foo",
+       "\"foo\"",
+       "sp aces",
+       NULL,
+    };
+
+    /* the idea here is to loop over all triples of strings, forming a
+     * string by quoting them with quote_string and inserting a space, then
+     * re-splitting with split_quoted_string.  This should get us back to our
+     * starting point. */
+
+    for (iter1 = quotable_strings; *iter1; iter1++) {
+       for (iter2 = middle_strings; *iter2; iter2++) {
+           for (iter3 = quotable_strings; *iter3; iter3++) {
+               char *q1 = quote_string(*iter1);
+               char *q2 = quote_string(*iter2);
+               char *q3 = quote_string(*iter3);
+               const char *expected[4] = { *iter1, *iter2, *iter3, NULL };
+               char *combined = vstralloc(q1, " ", q2, " ", q3, NULL);
+               char **tokens;
+
+               tokens = split_quoted_strings(combined);
+
+               success = compare_strv(expected, tokens, "split_quoted_strings", combined)
+                       && success;
+
+               amfree(q1);
+               amfree(q2);
+               amfree(q3);
+               amfree(combined);
+               g_strfreev(tokens);
+           }
+       }
+    }
+
+    return success;
+}
+
+/****
+ * Test splitting some edge cases and invalid strings
+ */
+
+struct trial {
+    const char *combined;
+    const char *expected[5];
+};
+
+static int
+test_split_quoted_strings_edge(void)
+{
+    gboolean success = TRUE;
+    struct trial trials[] = {
+       { "", { "", NULL, } },
+       { " ", { "", "", NULL } },
+       { " x", { "", "x", NULL } },
+       { "x ", { "x", "", NULL } },
+       { "x\\ y", { "x y", NULL } },
+       { "\\", { "", NULL } }, /* inv */
+       { "z\\", { "z", NULL } }, /* inv */
+       { "z\"", { "z", NULL } }, /* inv */
+       { "\" \" \"", { " ", "", NULL } }, /* inv */
+       { NULL, { NULL, } },
+    };
+    struct trial *trial = trials;
+
+    while (trial->combined) {
+       char **tokens = split_quoted_strings(trial->combined);
+
+       success = compare_strv(trial->expected, tokens,
+                              "split_quoted_strings", trial->combined)
+           && success;
+
+       g_strfreev(tokens);
+       trial++;
+    }
+
+    return success;
+}
+
+/****
+ * Test unquoting of some pathological strings
+ */
+static int
+test_unquote_string(void)
+{
+    gboolean success = TRUE;
+    char *tests[] = {
+       "simple",              "simple",
+       "\"quoted\"",          "quoted",
+       "s p a c e",           "s p a c e",
+
+       /* special escape characters */
+       "esc \\\" quote",      "esc \" quote",
+       "esc \\t tab",         "esc \t tab",
+       "esc \\\\ esc",        "esc \\ esc",
+       "esc \\02 oct",         "esc \02 oct",
+       "esc \\7 oct",         "esc \7 oct",
+       "esc \\17 oct",        "esc \17 oct",
+       "esc \\117 oct",       "esc \117 oct",
+       "esc \\1117 oct",      "esc \1117 oct", /* '7' is distinct char */
+
+       /* same, but pre-quoted */
+       "\"esc \\\" quote\"",  "esc \" quote",
+       "\"esc \\t tab\"",     "esc \t tab",
+       "\"esc \\\\ esc\"",    "esc \\ esc",
+       "\"esc \\02 oct\"",     "esc \02 oct",
+       "\"esc \\7 oct\"",     "esc \7 oct",
+       "\"esc \\17 oct\"",    "esc \17 oct",
+       "\"esc \\117 oct\"",   "esc \117 oct",
+       "\"esc \\1117 oct\"",  "esc \1117 oct", /* '7' is distinct char */
+
+       /* strips balanced quotes, even inside the string */
+       ">>\"x\"<<",           ">>x<<",
+       ">>\"x\"-\"y\"<<",     ">>x-y<<",
+
+       /* pathological, but valid */
+       "\\\\",                "\\",
+       "\"\\\"\"",            "\"",
+       "\"\\\\\"",            "\\",
+       "--\\\"",              "--\"",
+       "\\\"--",              "\"--",
+
+       /* invalid strings (handling here is arbitrary, but these tests
+        * will alert us if the handling changes) */
+       "\\",                  "", /* trailing backslash is ignored */
+       "xx\\",                "xx", /* ditto */
+       "\\\\\\\\\\\\\\",      "\\\\\\",   /* ditto */
+       "\\777",               "\377", /* 0777 & 0xff = 0xff */
+       "\"--",                "--", /* leading quote is dropped */
+       "--\"",                "--", /* trailing quote is dropped */
+
+       NULL, NULL,
+    };
+    char **strp;
+
+    for (strp = tests; *strp;) {
+       char *quoted = *(strp++);
+       char *expected = *(strp++);
+       char *unquoted = unquote_string(quoted);
+
+       /* if they're not the same, complain */
+       if (0 != strcmp(expected, unquoted)) {
+           char *safe_quoted = safestr(quoted);
+           char *safe_unquoted = safestr(unquoted);
+           char *safe_expected = safestr(expected);
+
+           printf("  %s unquoted to %s; expected %s.\n",
+               safe_quoted, safe_unquoted, safe_expected);
+
+           amfree(safe_quoted);
+           amfree(safe_unquoted);
+           amfree(safe_expected);
+
+           success = FALSE;
+       }
+
+       amfree(unquoted);
+    }
+
+    return success;
+}
+
+/****
+ * Test the strquotedstr function
+ */
+static int
+test_strquotedstr_skipping(void)
+{
+    char **iter1, **iter2;
+    gboolean success = TRUE;
+
+    /* the idea here is to loop over all pairs of strings, forming a
+     * string by quoting them with quote_string and inserting a space, then
+     * re-splitting with strquotedstr.  This should get us back to our
+     * starting point. Note that we have to begin with a non-quoted identifier,
+     * becuse strquotedstr requires that strtok_r has already been called. */
+
+    for (iter1 = quotable_strings; *iter1; iter1++) {
+       for (iter2 = quotable_strings; *iter2; iter2++) {
+           char *q1 = quote_string(*iter1);
+           char *q2 = quote_string(*iter2);
+           char *combined = vstralloc("START ", q1, " ", q2, NULL);
+           char *copy = g_strdup(combined);
+           char *saveptr = NULL;
+           char *tok;
+           int i;
+
+           tok = strtok_r(copy, " ", &saveptr);
+
+           for (i = 1; i <= 2; i++) {
+               char *expected = (i == 1)? q1:q2;
+               tok = strquotedstr(&saveptr);
+               if (!tok) {
+                   g_fprintf(stderr, "while parsing '%s', call %d to strquotedstr returned NULL\n",
+                             combined, i);
+                   success = FALSE;
+                   goto next;
+               }
+               if (0 != strcmp(tok, expected)) {
+                   char *safe = safestr(tok);
+
+                   g_fprintf(stderr, "while parsing '%s', call %d to strquotedstr returned '%s' "
+                             "but '%s' was expected.\n",
+                             combined, i, safe, expected);
+                   success = FALSE;
+                   goto next;
+               }
+           }
+
+           if (strquotedstr(&saveptr) != NULL) {
+               g_fprintf(stderr, "while parsing '%s', call 3 to strquotedstr did not return NULL\n",
+                         combined);
+               success = FALSE;
+               goto next;
+           }
+next:
+           amfree(q1);
+           amfree(q2);
+           amfree(copy);
+           amfree(combined);
+       }
+    }
+
+    return success;
+}
+
+static int
+test_strquotedstr_edge_invalid(void)
+{
+    gboolean success = TRUE;
+    char *invalid[] = {
+       "X \"abc", /* unterminated */
+       "X \"ab cd", /* unterminated second token */
+       "X a\"b cd", /* unterminated second token with internal quote */
+       "X b\\", /* trailing backslash */
+       "X \"b\\", /* trailing backslash in quote */
+       "X \"b\\\"", /* backslash'd ending quote */
+       NULL
+    };
+    char **iter;
+
+    /* run strquotedstr on a bunch of invalid tokens.  It should return NULL */
+
+    for (iter = invalid; *iter; iter++) {
+       char *copy = g_strdup(*iter);
+       char *tok;
+       char *saveptr = NULL;
+
+       tok = strtok_r(copy, " ", &saveptr);
+       tok = strquotedstr(&saveptr);
+       if (tok != NULL) {
+           g_fprintf(stderr, "while parsing invalid '%s', strquotedstr did not return NULL\n",
+                     *iter);
+           success = FALSE;
+       }
+
+       amfree(copy);
+    }
+
+    return success;
+}
+
+static int
+test_strquotedstr_edge_valid(void)
+{
+    gboolean success = TRUE;
+    char *valid[] = {
+       /* input */         /* expected (omitting "X") */
+       "X abc\\ def",      "abc\\ def", /* backslashed space */
+       "X \"abc\\ def\"",  "\"abc\\ def\"", /* quoted, backslashed space */
+       "X a\"  \"b",       "a\"  \"b", /* quoted spaces */
+       NULL, NULL
+    };
+    char **iter;
+
+    /* run strquotedstr on a bunch of valid, but tricky, tokens.  It should return NULL */
+
+    for (iter = valid; *iter; iter += 2) {
+       char *copy = g_strdup(*iter);
+       char *expected = *(iter+1);
+       char *tok;
+       char *saveptr = NULL;
+
+       tok = strtok_r(copy, " ", &saveptr);
+       tok = strquotedstr(&saveptr);
+       if (tok == NULL) {
+           g_fprintf(stderr, "while parsing valid '%s', strquotedstr returned NULL\n",
+                     *iter);
+           success = FALSE;
+       } else if (0 != strcmp(tok, expected)) {
+           g_fprintf(stderr, "while parsing valid '%s', strquotedstr returned '%s' while "
+                     "'%s' was expected\n",
+                     *iter, tok, expected);
+           success = FALSE;
+       }
+
+       amfree(copy);
+    }
+
+    return success;
+}
+
+/*
+ * Main driver
+ */
+
+int
+main(int argc, char **argv)
+{
+    static TestUtilsTest tests[] = {
+       TU_TEST(test_round_trip, 5),
+       TU_TEST(test_unquote_string, 5),
+       TU_TEST(test_split_quoted_strings, 5),
+       TU_TEST(test_split_quoted_strings_edge, 5),
+       TU_TEST(test_strquotedstr_skipping, 5),
+       TU_TEST(test_strquotedstr_edge_invalid, 5),
+       TU_TEST(test_strquotedstr_edge_valid, 5),
+       TU_END()
+    };
+
+    return testutils_run_tests(argc, argv, tests);
+}
index 26914c6845f1433b0a2445df54fe2a03155a969f..4d14f3bdfaa3755a0d715794802b340213e360ef 100644 (file)
@@ -117,6 +117,7 @@ rsh_connect(
     void *             arg,
     void *             datap)
 {
+    int result;
     struct sec_handle *rh;
     char *amandad_path=NULL, *client_username=NULL;
 
@@ -132,10 +133,12 @@ rsh_connect(
     rh->ev_timeout = NULL;
     rh->rc = NULL;
 
+    /* get the canonical hostname */
     rh->hostname = NULL;
-    if (resolve_hostname(hostname, 0, NULL, &rh->hostname) || rh->hostname == NULL) {
+    if ((result = resolve_hostname(hostname, 0, NULL, &rh->hostname)) || rh->hostname == NULL) {
        security_seterror(&rh->sech,
-           _("%s: could not resolve hostname"), hostname);
+           _("rsh_security could not find canonical name for '%s': %s"),
+           hostname, gai_strerror(result));
        (*fn)(arg, &rh->sech, S_ERROR);
        return;
     }
index 77e5d0c8c914a8daac3996b5ffb0797e20d582f5..ee2f99c6f7032216fb6d66bdacd88b9d49cd609b 100644 (file)
@@ -229,7 +229,8 @@ stream_sendpkt(
       pkt_type2str(pkt->type), pkt->type, strlen(pkt->body), pkt->body);
 
     if (security_stream_write(&rh->rs->secstr, buf, len) < 0) {
-       security_seterror(&rh->sech, security_stream_geterror(&rh->rs->secstr));
+       security_seterror(&rh->sech, "%s", security_stream_geterror(&rh->rs->secstr));
+       amfree(buf);
        return (-1);
     }
     amfree(buf);
@@ -330,7 +331,7 @@ tcpm_stream_write(
 
     if (tcpm_send_token(rs->rc, rs->rc->write, rs->handle, &rs->rc->errmsg,
                             buf, size)) {
-       security_stream_seterror(&rs->secstr, rs->rc->errmsg);
+       security_stream_seterror(&rs->secstr, "%s", rs->rc->errmsg);
        return (-1);
     }
     return (0);
@@ -354,7 +355,7 @@ tcpm_stream_read(
      * Only one read request can be active per stream.
      */
     if (rs->ev_read == NULL) {
-       rs->ev_read = event_register((event_id_t)rs->rc, EV_WAIT,
+       rs->ev_read = event_register((event_id_t)rs->rc->event_id, EV_WAIT,
            stream_read_callback, rs);
        sec_tcp_conn_read(rs->rc);
     }
@@ -380,7 +381,7 @@ tcpm_stream_read_sync(
     if (rs->ev_read != NULL) {
        return -1;
     }
-    rs->ev_read = event_register((event_id_t)rs->rc, EV_WAIT,
+    rs->ev_read = event_register((event_id_t)rs->rc->event_id, EV_WAIT,
         stream_read_sync_callback, rs);
     sec_tcp_conn_read(rs->rc);
     event_wait(rs->ev_read);
@@ -466,7 +467,7 @@ tcpm_send_token(
         nb_iov = 3;
     }
 
-    rval = net_writev(fd, iov, nb_iov);
+    rval = full_writev(fd, iov, nb_iov);
     if (len != 0 && rc->driver->data_encrypt != NULL && buf != encbuf) {
        amfree(encbuf);
     }
@@ -607,7 +608,7 @@ tcpm_close_connection(
 
     (void)hostname;
 
-    if (rh && rh->rc && rh->rc->toclose == 0) {
+    if (rh && rh->rc && rh->rc->read >= 0 && rh->rc->toclose == 0) {
        rh->rc->toclose = 1;
        sec_tcp_conn_put(rh->rc);
     }
@@ -862,7 +863,7 @@ tcp_stream_write(
 
     assert(rs != NULL);
 
-    if (fullwrite(rs->fd, buf, size) < 0) {
+    if (full_write(rs->fd, buf, size) < size) {
         security_stream_seterror(&rs->secstr,
             _("write error on stream %d: %s"), rs->port, strerror(errno));
         return (-1);
@@ -886,7 +887,7 @@ bsd_prefix_packet(
        security_seterror(&rh->sech,
                          _("can't get login name for my uid %ld"),
                          (long)getuid());
-       return(NULL);
+       return "";
     }
     buf = alloc(16+strlen(pwd->pw_name));
     strncpy(buf, "SECURITY USER ", (16 + strlen(pwd->pw_name)));
@@ -1016,6 +1017,7 @@ bsd_recv_security_ok(
        if ((tok = strtok(NULL, "")) == NULL) {
            security_seterror(&rh->sech,
                _("SECURITY line: %s"), security_line);
+           amfree(service);
            amfree(security_line);
            return (-1);        /* default errmsg */
        }
@@ -1063,7 +1065,7 @@ udpbsd_sendpkt(
      * Initialize this datagram, and add the header
      */
     dgram_zero(&rh->udp->dgram);
-    dgram_cat(&rh->udp->dgram, pkthdr2str(rh, pkt));
+    dgram_cat(&rh->udp->dgram, "%s", pkthdr2str(rh, pkt));
 
     /*
      * Add the security info.  This depends on which kind of packet we're
@@ -1089,7 +1091,7 @@ udpbsd_sendpkt(
     /*
      * Add the body, and send it
      */
-    dgram_cat(&rh->udp->dgram, pkt->body);
+    dgram_cat(&rh->udp->dgram, "%s", pkt->body);
 
     auth_debug(1,
      _("sec: udpbsd_sendpkt: %s (%d) pkt_t (len %zu) contains:\n\n\"%s\"\n\n"),
@@ -1470,6 +1472,7 @@ sec_tcp_conn_get(
     rc->auth = 0;
     rc->conf_fn = NULL;
     rc->datap = NULL;
+    rc->event_id = newevent++;
     connq_append(rc);
     return (rc);
 }
@@ -1505,10 +1508,13 @@ sec_tcp_conn_put(
        amfree(rc->errmsg);
     connq_remove(rc);
     amfree(rc->pkt);
-    if(!rc->donotclose)
-       amfree(rc); /* someone might still use it           */
-                   /* eg. in sec_tcp_conn_read_callback if */
-                   /*     event_wakeup call us.            */
+    if(!rc->donotclose) {
+       /* amfree(rc) */
+       /* a memory leak occurs, but freeing it lead to memory
+        * corruption because it can still be used.
+        * We need to find a good place to free 'rc'.
+        */
+    }
 }
 
 /*
@@ -1583,7 +1589,7 @@ recvpkt_callback(
        (*rh->fn.recvpkt)(rh->arg, NULL, S_ERROR);
        return;
     case -1:
-       security_seterror(&rh->sech, security_stream_geterror(&rh->rs->secstr));
+       security_seterror(&rh->sech, "%s", security_stream_geterror(&rh->rs->secstr));
        (*rh->fn.recvpkt)(rh->arg, NULL, S_ERROR);
        return;
     default:
@@ -1637,7 +1643,7 @@ stream_read_sync_callback(
 
     if (rs->rc->pktlen <= 0) {
        auth_debug(1, _("sec: stream_read_sync_callback: %s\n"), rs->rc->errmsg);
-       security_stream_seterror(&rs->secstr, rs->rc->errmsg);
+       security_stream_seterror(&rs->secstr, "%s", rs->rc->errmsg);
        if(rs->closed_by_me == 0 && rs->closed_by_network == 0)
            sec_tcp_conn_put(rs->rc);
        rs->closed_by_network = 1;
@@ -1683,7 +1689,7 @@ stream_read_callback(
 
     if (rs->rc->pktlen <= 0) {
        auth_debug(1, _("sec: stream_read_callback: %s\n"), rs->rc->errmsg);
-       security_stream_seterror(&rs->secstr, rs->rc->errmsg);
+       security_stream_seterror(&rs->secstr, "%s", rs->rc->errmsg);
        if(rs->closed_by_me == 0 && rs->closed_by_network == 0)
            sec_tcp_conn_put(rs->rc);
        rs->closed_by_network = 1;
@@ -1723,7 +1729,7 @@ sec_tcp_conn_read_callback(
     if (rval < 0 || rc->handle == H_EOF) {
        rc->pktlen = rval;
        rc->handle = H_EOF;
-       revent = event_wakeup((event_id_t)rc);
+       revent = event_wakeup((event_id_t)rc->event_id);
        auth_debug(1, _("sec: conn_read_callback: event_wakeup return %d\n"),
                       revent);
        /* delete our 'accept' reference */
@@ -1741,7 +1747,7 @@ sec_tcp_conn_read_callback(
 
     if(rval == 0) {
        rc->pktlen = 0;
-       revent = event_wakeup((event_id_t)rc);
+       revent = event_wakeup((event_id_t)rc->event_id);
        auth_debug(1,
                   _("sec: conn_read_callback: event_wakeup return %d\n"), revent);
        return;
@@ -1749,8 +1755,8 @@ sec_tcp_conn_read_callback(
 
     /* If there are events waiting on this handle, we're done */
     rc->donotclose = 1;
-    revent = event_wakeup((event_id_t)rc);
-    auth_debug(1, _("sec: conn_read_callback: event_wakeup return %zd\n"), rval);
+    revent = event_wakeup((event_id_t)rc->event_id);
+    auth_debug(1, _("sec: conn_read_callback: event_wakeup return %d\n"), revent);
     rc->donotclose = 0;
     if (rc->handle == H_TAKEN || rc->pktlen == 0) {
        if(rc->refcnt == 0) amfree(rc);
@@ -1760,8 +1766,12 @@ sec_tcp_conn_read_callback(
     assert(rc->refcnt > 0);
 
     /* If there is no accept fn registered, then drop the packet */
-    if (rc->accept_fn == NULL)
+    if (rc->accept_fn == NULL) {
+       g_warning(
+         _("sec: conn_read_callback: %zd bytes for handle %d went unclaimed!"),
+         rc->pktlen, rc->handle);
        return;
+    }
 
     rh = alloc(SIZEOF(*rh));
     security_handleinit(&rh->sech, rc->driver);
@@ -2237,7 +2247,7 @@ check_user_amandahosts(
     if (! found) {
        if (strcmp(service, "amindexd") == 0 ||
            strcmp(service, "amidxtaped") == 0) {
-           result = vstrallocf(_("Please add the line \"%s %s amindexd amidxtaped\" to %s on the client"), host, remoteuser, ptmp);
+           result = vstrallocf(_("Please add the line \"%s %s amindexd amidxtaped\" to %s on the server"), host, remoteuser, ptmp);
        } else if (strcmp(service, "amdump") == 0 ||
                   strcmp(service, "noop") == 0 ||
                   strcmp(service, "selfcheck") == 0 ||
@@ -2365,57 +2375,6 @@ check_security(
     return *errstr == NULL;
 }
 
-/*
- * Writes out the entire iovec
- */
-ssize_t
-net_writev(
-    int                        fd,
-    struct iovec *     iov,
-    int                        iovcnt)
-{
-    ssize_t delta, n, total;
-
-    assert(iov != NULL);
-
-    total = 0;
-    while (iovcnt > 0) {
-       /*
-        * Write the iovec
-        */
-       n = writev(fd, iov, iovcnt);
-       if (n < 0) {
-           if (errno != EINTR)
-               return (-1);
-           auth_debug(1, _("net_writev got EINTR\n"));
-       }
-       else if (n == 0) {
-           errno = EIO;
-           return (-1);
-       } else {
-           total += n;
-           /*
-            * Iterate through each iov.  Figure out what we still need
-            * to write out.
-            */
-           for (; n > 0; iovcnt--, iov++) {
-               /* 'delta' is the bytes written from this iovec */
-               delta = ((size_t)n < (size_t)iov->iov_len) ? n : (ssize_t)iov->iov_len;
-               /* subtract from the total num bytes written */
-               n -= delta;
-               assert(n >= 0);
-               /* subtract from this iovec */
-               iov->iov_len -= delta;
-               iov->iov_base = (char *)iov->iov_base + delta;
-               /* if this iovec isn't empty, run the writev again */
-               if (iov->iov_len > 0)
-                   break;
-           }
-       }
-    }
-    return (total);
-}
-
 /*
  * Like read(), but waits until the entire buffer has been filled.
  */
index 22accfc4b8395026de00c3be4056901d569ea5bd..93b234f6f4fdb526fba1d964658a96b0fe48e84c 100644 (file)
@@ -75,6 +75,7 @@ struct tcp_conn {
     char *             errmsg;                 /* error passed up */
     int                        refcnt;                 /* number of handles using */
     int                        handle;                 /* last proto handle read */
+    int                        event_id;               /* event ID fired when token read */
     void               (*accept_fn)(security_handle_t *, pkt_t *);
     sockaddr_union     peer;
     TAILQ_ENTRY(tcp_conn) tq;                  /* queue handle */
@@ -275,7 +276,6 @@ char *      check_user_amandahosts(const char *host,
                                const char *user,
                                const char *service);
 
-ssize_t        net_writev(int, struct iovec *, int);
 ssize_t        net_read(int, void *, size_t, int);
 ssize_t net_read_fillbuf(int, int, void *, size_t);
 void   show_stat_info(char *a, char *b);
diff --git a/common-src/semaphore-test.c b/common-src/semaphore-test.c
new file mode 100644 (file)
index 0000000..d6ec04b
--- /dev/null
@@ -0,0 +1,245 @@
+/*
+ * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License version 2.1 as
+ * published by the Free Software Foundation.
+ *
+ * This 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 this library; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+ *
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+ */
+
+#include "semaphore.h"
+#include "testutils.h"
+#include "amanda.h"
+#include "util.h"
+
+/*
+ * test that decrement waits properly
+ */
+
+struct test_decr_wait_data {
+    semaphore_t *sem;
+    gboolean increment_called;
+};
+
+static gpointer
+test_decr_wait_thread(gpointer datap)
+{
+    struct test_decr_wait_data *data = datap;
+
+    /* should block */
+    semaphore_decrement(data->sem, 20);
+
+    /* if increment hasn't been called yet, that's an error. */
+    if (!data->increment_called)
+       return GINT_TO_POINTER(0);
+
+    return GINT_TO_POINTER(1);
+}
+
+static gboolean
+test_decr_wait(void)
+{
+    GThread *th;
+    struct test_decr_wait_data data = { NULL, FALSE };
+    int rv;
+
+    data.sem = semaphore_new_with_value(10),
+
+    th = g_thread_create(test_decr_wait_thread, (gpointer)&data, TRUE, NULL);
+
+    /* sleep to give semaphore_decrement() a chance to block (or not). */
+    g_usleep(G_USEC_PER_SEC / 4);
+
+    /* and then increment the semaphore enough that the decrement can succeed */
+    data.increment_called = TRUE;
+    semaphore_increment(data.sem, 10);
+
+    /* join the thread and see how it fared. */
+    rv = GPOINTER_TO_INT(g_thread_join(th));
+
+    semaphore_free(data.sem);
+
+    return (rv == 1);
+}
+
+
+/*
+ * test that semaphore_wait_empty waits properly
+ */
+
+static gpointer
+test_wait_empty_thread(gpointer datap)
+{
+    semaphore_t *sem = datap;
+
+    /* should block */
+    semaphore_decrement(sem, 20);
+
+    /* value should be 10 now (decremented from 30) */
+    if (sem->value != 10)
+       return GINT_TO_POINTER(1);
+
+    /* sleep for a bit */
+    g_usleep(G_USEC_PER_SEC / 4);
+
+    /* decrement those last 10, which should trigger the zero */
+    semaphore_decrement(sem, 10);
+
+    return GINT_TO_POINTER(0);
+}
+
+static gboolean
+test_wait_empty(void)
+{
+    GThread *th;
+    semaphore_t *sem = semaphore_new_with_value(10);
+    int rv;
+
+    th = g_thread_create(test_wait_empty_thread, (gpointer)sem, TRUE, NULL);
+
+    /* sleep to give semaphore_decrement() a chance to block (or not). */
+    g_usleep(G_USEC_PER_SEC / 4);
+
+    /* add another 10, so decrement can hit zero next time it's called */
+    semaphore_increment(sem, 10);
+
+    /* and wait on the semaphore emptying */
+    semaphore_wait_empty(sem);
+
+    /* join the thread and see how it fared. */
+    rv = GPOINTER_TO_INT(g_thread_join(th));
+
+    semaphore_free(sem);
+
+    return (rv == 1);
+}
+
+/*
+ * test that semaphore_force_adjust correctly wakes both
+ * semaphore_decrement and semaphore_wait_empty.
+ */
+
+static gpointer
+test_force_adjust_thread(gpointer datap)
+{
+    semaphore_t *sem = datap;
+
+    /* this should block */
+    semaphore_decrement(sem, 20);
+
+    /* and this should block, too - it's fun */
+    semaphore_wait_empty(sem);
+
+    return NULL;
+}
+
+static gboolean
+test_force_adjust(void)
+{
+    GThread *th;
+    semaphore_t *sem = semaphore_new_with_value(10);
+
+    th = g_thread_create(test_force_adjust_thread, (gpointer)sem, TRUE, NULL);
+
+    /* sleep to give semaphore_decrement() a chance to block (or not). */
+    g_usleep(G_USEC_PER_SEC / 4);
+
+    /* add another 20, so decrement can proceed, but leave the value at 10 */
+    semaphore_force_adjust(sem, 20);
+
+    /* sleep to give semaphore_wait_empty() a chance to block (or not). */
+    g_usleep(G_USEC_PER_SEC / 4);
+
+    /* and empty out the semaphore */
+    semaphore_force_adjust(sem, -10);
+
+    g_thread_join(th);
+
+    semaphore_free(sem);
+
+    /* it we didn't hang yet, it's all good */
+    return TRUE;
+}
+
+/*
+ * test that semaphore_force_set correctly wakes both
+ * semaphore_decrement and semaphore_wait_empty.
+ */
+
+static gpointer
+test_force_set_thread(gpointer datap)
+{
+    semaphore_t *sem = datap;
+
+    /* this should block */
+    semaphore_decrement(sem, 20);
+
+    /* and this should block, too - it's fun */
+    semaphore_wait_empty(sem);
+
+    return NULL;
+}
+
+static gboolean
+test_force_set(void)
+{
+    GThread *th;
+    semaphore_t *sem = semaphore_new_with_value(10);
+
+    th = g_thread_create(test_force_set_thread, (gpointer)sem, TRUE, NULL);
+
+    /* sleep to give semaphore_decrement() a chance to block (or not). */
+    g_usleep(G_USEC_PER_SEC / 4);
+
+    /* set it to 30, so decrement can proceed, but leave the value at 10 */
+    semaphore_force_set(sem, 30);
+
+    /* sleep to give semaphore_wait_empty() a chance to block (or not). */
+    g_usleep(G_USEC_PER_SEC / 4);
+
+    /* and empty out the semaphore */
+    semaphore_force_set(sem, 0);
+
+    g_thread_join(th);
+
+    semaphore_free(sem);
+
+    /* it we didn't hang yet, it's all good */
+    return TRUE;
+}
+
+/*
+ * Main loop
+ */
+
+int
+main(int argc, char **argv)
+{
+#if defined(G_THREADS_ENABLED) && !defined(G_THREADS_IMPL_NONE)
+    static TestUtilsTest tests[] = {
+       TU_TEST(test_decr_wait, 10),
+       TU_TEST(test_wait_empty, 10),
+       TU_TEST(test_force_adjust, 10),
+       TU_TEST(test_force_set, 10),
+       TU_END()
+    };
+
+    glib_init();
+
+    return testutils_run_tests(argc, argv, tests);
+#else
+    g_fprintf(stderr, "No thread support on this platform -- nothing to test\n");
+    return 0;
+#endif
+}
diff --git a/common-src/semaphore.c b/common-src/semaphore.c
new file mode 100644 (file)
index 0000000..a38b677
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+ * 
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License version 2.1 as 
+ * published by the Free Software Foundation.
+ * 
+ * This 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 this library; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+ * 
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+ */
+
+/* GLib does not provide semaphores, which are useful in queue.c.
+   So, we implement it here. */
+
+#include "semaphore.h"
+#include "amanda.h"
+
+semaphore_t* semaphore_new_with_value(int value) {
+    semaphore_t *rval;
+
+    if (!g_thread_supported())
+        return NULL;
+
+    rval = malloc(sizeof(*rval));
+    rval->value = value;
+    rval->mutex = g_mutex_new();
+    rval->decrement_cond = g_cond_new();
+    rval->zero_cond = g_cond_new();
+    
+    if (rval->mutex == NULL || rval->decrement_cond == NULL ||
+        rval->zero_cond == NULL) {
+        semaphore_free(rval);
+        return NULL;
+    } else {
+        return rval;
+    }
+}
+
+void semaphore_free(semaphore_t* o) {
+    g_mutex_free(o->mutex);
+    g_cond_free(o->decrement_cond);
+    g_cond_free(o->zero_cond);
+    free(o);
+}
+
+/* This function checks if the semaphore would is zero or negative.
+ * If so, the zero_cond is signalled. We assume that the mutex is
+ * locked. */
+static void check_empty(semaphore_t * o) {
+    if (o->value <= 0) {
+        g_cond_broadcast(o->zero_cond);
+    }
+}
+
+void semaphore_increment(semaphore_t* o, unsigned int inc) {
+    g_return_if_fail(o != NULL);
+    g_return_if_fail(inc != 0);
+
+    semaphore_force_adjust(o, inc);
+}
+
+void semaphore_decrement(semaphore_t* o, unsigned int dec) {
+    int sdec;
+    g_return_if_fail(o != NULL);
+    sdec = (int) dec;
+    g_return_if_fail(sdec >= 0);
+
+    g_mutex_lock(o->mutex);
+    while (o->value < sdec) {
+        g_cond_wait(o->decrement_cond, o->mutex);
+    }
+    o->value -= sdec;
+    check_empty(o);
+    g_mutex_unlock(o->mutex);
+}
+
+void semaphore_force_adjust(semaphore_t* o, int inc) {
+    g_return_if_fail(o != NULL);
+
+    g_mutex_lock(o->mutex);
+    o->value += inc;
+    if (inc < 0)
+       check_empty(o);
+    else
+       g_cond_broadcast(o->decrement_cond);
+    g_mutex_unlock(o->mutex);
+
+}
+
+void semaphore_force_set(semaphore_t* o, int value) {
+    int oldvalue;
+    g_return_if_fail(o != NULL);
+    
+    g_mutex_lock(o->mutex);
+    oldvalue = o->value;
+    o->value = value;
+    if (value < oldvalue)
+       check_empty(o);
+    else
+       g_cond_broadcast(o->decrement_cond);
+    g_mutex_unlock(o->mutex);
+    
+}
+
+void semaphore_wait_empty(semaphore_t * o) {
+    g_return_if_fail(o != NULL);
+    
+    g_mutex_lock(o->mutex);
+    while (o->value > 0) {
+        g_cond_wait(o->zero_cond, o->mutex);
+    }
+    g_mutex_unlock(o->mutex);
+}
diff --git a/common-src/semaphore.h b/common-src/semaphore.h
new file mode 100644 (file)
index 0000000..c3135d6
--- /dev/null
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+ * 
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License version 2.1 as 
+ * published by the Free Software Foundation.
+ * 
+ * This 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 this library; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+ * 
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+ */
+
+/* GLib does not provide semaphores, which are useful in queue.c.
+   So, we implement it here. */
+
+#include <glib.h>
+
+#ifndef SEMAPHORE_H
+
+typedef struct {
+    int value;
+    GMutex *mutex;
+    GCond * decrement_cond;
+    GCond * zero_cond;
+} semaphore_t;
+
+/* Create a new semaphore object with the given value.
+ *
+ * @param value: new value
+ * @returns: newly allocated semaphore_t
+ */
+semaphore_t* semaphore_new_with_value(int value);
+
+/* Shortcut to make a new semaphore with value 1.
+ */
+#define semaphore_new() semaphore_new_with_value(1)
+
+/* Free a semaphore allocated by semaphore_with_new_value().  Be sure the
+ * semaphore is no longer in use by any threads.
+ *
+ * @param sem: the semaphore to free
+ */
+void semaphore_free(semaphore_t *sem);
+
+/* Increment the value of the semaphore by incr.  This corresponds to
+ * Dijkstra's V(), or the typical semaphore's release().
+ *
+ * This function will not block, but may wake other threads waiting
+ * on semaphore_decrement().
+ *
+ * @param sem: the semaphore
+ * @param incr: added to the semaphore's value
+ */
+void semaphore_increment(semaphore_t *sem, unsigned int incr);
+
+/* Shortcut to increment the semaphore by 1.
+ */
+#define semaphore_up(semaphore) semaphore_increment(semaphore,1)
+
+/* Decrement the value of the semaphore by incr.  If this operation
+ * would make the semaphore negative, block until the semaphore
+ * value is large enough, then perform the decerement operation. Threads
+ * waiting on semaphore_wait_empty() may be awakened if the value
+ * reaches 0.
+ *
+ * @param sem: the semaphore
+ * @param decr: subtracted from the semaphore's value
+ */
+void semaphore_decrement(semaphore_t *sem, unsigned int decr);
+
+/* Shortcut to decrement the semaphore by 1.
+ */
+#define semaphore_down(semaphore) semaphore_decrement(semaphore, 1)
+
+/* Increment or decrement (with a negative incr) the value without
+ * blocking.  Threads waiting on semaphore_decrement() or
+ * semaphore_wait_empty() will be awakened if necessary.
+ *
+ * @param sem: the semaphore
+ * @param incr: added to the semaphore's value
+ */
+void semaphore_force_adjust(semaphore_t *sem, int incr);
+
+/* Set the semaphore to a given value without blocking.  Threads
+ * waiting on semaphore_decrement() or semaphore_wait_empty()
+ * will be awakened if necessary.
+ *
+ * @param sem: the semaphore
+ * @param value: the new value
+ */
+void semaphore_force_set(semaphore_t *sem, int value);
+
+/* Block until the semaphore's value is zero.
+ *
+ * @param sem: the semaphore
+ */
+void semaphore_wait_empty(semaphore_t *sem);
+
+#endif /* SEMAPHORE_H */
diff --git a/common-src/simpleprng.c b/common-src/simpleprng.c
new file mode 100644 (file)
index 0000000..684e5de
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ *
+ * 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.,
+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ * Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+ */
+
+#include "simpleprng.h"
+
+/* A *very* basic linear congruential generator; values are as cited in
+ * http://en.wikipedia.org/wiki/Linear_congruential_generator for Numerical Recipes */
+
+#define A 1664525
+#define C 1013904223
+
+void
+simpleprng_seed(
+    simpleprng_state_t *state,
+    guint32 seed)
+{
+    g_assert(seed != 0);
+    *state = seed;
+}
+
+guint32 simpleprng_rand(
+    simpleprng_state_t *state)
+{
+    return (*state = (A * (*state)) + C);
+}
+
+void simpleprng_fill_buffer(
+    simpleprng_state_t *state,
+    gpointer buf,
+    size_t len)
+{
+    guint8 *p = buf;
+    while (len--) {
+       *(p++) = simpleprng_rand_byte(state);
+    }
+}
+
+gboolean simpleprng_verify_buffer(
+    simpleprng_state_t *state,
+    gpointer buf,
+    size_t len)
+{
+    guint8 *p = buf;
+    while (len--) {
+       guint8 expected = simpleprng_rand_byte(state);
+       guint8 got = *p;
+       if (expected != got) {
+           g_fprintf(stderr,
+                   "random value mismatch in buffer %p, offset %zd: got 0x%02x, expected 0x%02x\n", 
+                   buf, (size_t)(p-(guint8*)buf), (int)got, (int)expected);
+           return FALSE;
+       }
+       p++;
+    }
+
+    return TRUE;
+}
diff --git a/common-src/simpleprng.h b/common-src/simpleprng.h
new file mode 100644 (file)
index 0000000..e5b6a7e
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ *
+ * 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.,
+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ * Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+ */
+
+#ifndef SIMPLEPRNG_H
+#define        SIMPLEPRNG_H
+
+#include "amanda.h"
+
+/* A very simple, thread-safe PRNG.  This is intended for use in reproducable
+ * generating bytestreams for testing purposes.  It is *not* cryptographically
+ * secure! */
+
+typedef guint32 simpleprng_state_t;
+
+/* Initialize and seed the PRNG
+ *
+ * @param state: pointer to PRNG state
+ * @param seed: initial value
+ */
+void simpleprng_seed(
+    simpleprng_state_t *state,
+    guint32 seed);
+
+/* Get a random guint32
+ *
+ * @param state: pointer to PRNG state
+ * @returns: random integer
+ */
+guint32 simpleprng_rand(
+    simpleprng_state_t *state);
+
+/* Get a random byte
+ *
+ * @param state: pointer to PRNG state
+ * @returns: random integer
+ */
+/* use the high-order bytes, as they're "more random" */
+#define simpleprng_rand_byte(state) \
+    ((guint8)(simpleprng_rand((state)) >> 24))
+
+/* Fill the given buffer with a sequence of bytes
+ *
+ * @param state: pointer to PRNG state
+ * @param buf: buffer to fill
+ * @param len: number of bytes to write
+ */
+void simpleprng_fill_buffer(
+    simpleprng_state_t *state,
+    gpointer buf,
+    size_t len);
+
+/* Verify that a buffer matches the values from the PRNG.
+ *
+ * @param state: pointer to PRNG state
+ * @param buf: buffer to verify
+ * @param len: number of bytes to verify
+ * @returns: true if all bytes match
+ */
+gboolean simpleprng_verify_buffer(
+    simpleprng_state_t *state,
+    gpointer buf,
+    size_t len);
+
+#endif /* SIMPLEPRNG_H */
index ffc6ca2faff88c8842dd8a6142e66d02d0ae2b9d..84655ac7c7371420a6c70a8df2988af629e700ca 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005 Zmanda Inc.  All Rights Reserved.
+ * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 as published
@@ -14,8 +14,8 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  *
- * Contact information: Zmanda Inc, 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  *
  * Author: Dustin J. Mitchell <dustin@zmanda.com>
  */
index 977c4f9a2efefc5af73660909caf7fa01f57e85a..56e460d8a7ca445f51a755ffbe58cc041fadc5a2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005 Zmanda Inc.  All Rights Reserved.
+ * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 as published
@@ -14,8 +14,8 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  *
- * Contact information: Zmanda Inc, 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  *
  * Author: Dustin J. Mitchell <dustin@zmanda.com>
  */
index 45a55e40d7d2684d299714d8354a33cabf1510da..229c4b40811b1d36ee3b36c88f2c7cd3286ab258 100644 (file)
@@ -106,6 +106,7 @@ ssh_connect(
     void *             arg,
     void *             datap)
 {
+    int result;
     struct sec_handle *rh;
     char *amandad_path=NULL, *client_username=NULL, *ssh_keys=NULL;
 
@@ -121,10 +122,13 @@ ssh_connect(
     rh->ev_timeout = NULL;
     rh->rc = NULL;
 
+    /* get the canonical hostname */
     rh->hostname = NULL;
-    if (resolve_hostname(hostname, 0, NULL, &rh->hostname) || rh->hostname == NULL) {
+    if ((result = resolve_hostname(hostname, 0, NULL, &rh->hostname)) != 0
+        || rh->hostname == NULL) {
        security_seterror(&rh->sech,
-           _("%s: ssh could not resolve hostname"), hostname);
+           _("ssh_security could not find canonical name for '%s': %s"),
+           hostname, gai_strerror(result));
        (*fn)(arg, &rh->sech, S_ERROR);
        return;
     }
index d9504fcdf4771236d10e50cbc20bfa1f344ede63..22b9b0c33fe7fcdebc26afb2d89acc926061e1de 100644 (file)
@@ -69,11 +69,13 @@ stream_server(
     } else {
        socket_family = family;
     }
+    g_debug("stream_server opening socket with family %d (requested family was %d)", socket_family, family);
     server_socket = socket(socket_family, SOCK_STREAM, 0);
-    
+
 #ifdef WORKING_IPV6
     /* if that address family actually isn't supported, just try AF_INET */
     if (server_socket == -1 && errno == EAFNOSUPPORT) {
+       g_debug("stream_server retrying socket with AF_INET");
        socket_family = AF_INET;
        server_socket = socket(AF_INET, SOCK_STREAM, 0);
     }
@@ -202,10 +204,10 @@ stream_client_internal(
     int priv)
 {
     sockaddr_union svaddr, claddr;
-    int save_errno;
+    int save_errno = 0;
     char *f;
-    int client_socket;
-    int *portrange;
+    int client_socket = 0;
+    int *portrange = NULL;
     int result;
     struct addrinfo *res, *res_addr;
 
@@ -347,7 +349,7 @@ stream_accept(
                                _("stream_accept: timeout after %d seconds\n"),
                               timeout),
                         timeout);
-               errno = ENOENT;                 /* ??? */
+               errno = ETIMEDOUT;
                return -1;
            } else if (!FD_ISSET(server_socket, &readset)) {
                int i;
index 5357aaf84b37c54a56b6d61e7a1e1b9e6b5cb130..3e2b034850209e6cd7278df917c2d89c5d038acb 100644 (file)
@@ -1,2 +1,2 @@
-#define BUILT_REV "1266"
-#define BUILT_BRANCH "amanda-260"
+#define BUILT_REV "1609"
+#define BUILT_BRANCH "amanda-261"
diff --git a/common-src/testutils.c b/common-src/testutils.c
new file mode 100644 (file)
index 0000000..a614b7c
--- /dev/null
@@ -0,0 +1,153 @@
+/*
+ * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ *
+ * 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.,
+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+ */
+
+#include "amanda.h"
+#include "testutils.h"
+
+int tu_debugging_enabled = FALSE;
+
+static void
+alarm_hdlr(int sig G_GNUC_UNUSED)
+{
+    fprintf(stderr, "-- TEST TIMED OUT --\n");
+    exit(1);
+}
+
+/* Call testfn in a forked process, such that any failures will trigger a
+ * test failure, but allow the other tests to proceed.
+ */
+static int
+callinfork(TestUtilsTest *test, int ignore_timeouts)
+{
+    pid_t pid;
+    int success;
+    amwait_t status;
+
+    switch (pid = fork()) {
+       case 0: /* child */
+           /* kill the test after a bit */
+           signal(SIGALRM, alarm_hdlr);
+           if (!ignore_timeouts) alarm(test->timeout);
+
+           success = test->fn();
+           exit(success? 0:1);
+
+       case -1:
+           perror("fork");
+           exit(1);
+
+       default: /* parent */
+           waitpid(pid, &status, 0);
+           if (status == 0) {
+               fprintf(stderr, " PASS %s\n", test->name);
+           } else {
+               fprintf(stderr, " FAIL %s\n", test->name);
+           }
+           return status == 0;
+    }
+}
+
+static void
+usage(
+    TestUtilsTest *tests)
+{
+    printf("USAGE: <test-script> [-d] [-h] [testname [testname [..]]]\n"
+       "\n"
+       "\t-h: this message\n"
+       "\t-d: print debugging messages\n"
+       "\t-t: ignore timeouts\n"
+       "\n"
+       "If no test names are specified, all tests are run.  Available tests:\n"
+       "\n");
+    while (tests->fn) {
+       printf("\t%s\n", tests->name);
+       tests++;
+    }
+}
+
+static void
+ignore_debug_messages(
+           const gchar *log_domain G_GNUC_UNUSED,
+           GLogLevelFlags log_level G_GNUC_UNUSED,
+           const gchar *message G_GNUC_UNUSED,
+           gpointer user_data G_GNUC_UNUSED)
+{
+}
+
+int
+testutils_run_tests(
+    int argc,
+    char **argv,
+    TestUtilsTest *tests)
+{
+    TestUtilsTest *t;
+    int run_all = 1;
+    int success;
+    int ignore_timeouts = 0;
+
+    /* first_parse the command line */
+    while (argc > 1) {
+       if (strcmp(argv[1], "-d") == 0) {
+           tu_debugging_enabled = TRUE;
+       } else if (strcmp(argv[1], "-t") == 0) {
+           ignore_timeouts = TRUE;
+       } else if (strcmp(argv[1], "-h") == 0) {
+           usage(tests);
+           return 1;
+       } else {
+           int found = 0;
+
+           for (t = tests; t->fn; t++) {
+               if (strcmp(argv[1], t->name) == 0) {
+                   found = 1;
+                   t->selected = 1;
+                   break;
+               }
+           }
+
+           if (!found) {
+               fprintf(stderr, "Test '%s' not found\n", argv[1]);
+               return 1;
+           }
+
+           run_all = 0;
+       }
+
+       argc--; argv++;
+    }
+
+    /* Make sure g_critical and g_error will exit */
+    g_log_set_always_fatal(G_LOG_LEVEL_ERROR |  G_LOG_LEVEL_CRITICAL);
+
+    /* and silently drop debug messages unless we're debugging */
+    if (!tu_debugging_enabled) {
+       g_log_set_handler(NULL, G_LOG_LEVEL_DEBUG, ignore_debug_messages, NULL);
+    }
+
+    /* Now actually run the tests */
+    success = 1;
+    for (t = tests; t->fn; t++) {
+       if (run_all || t->selected) {
+           success = callinfork(t, ignore_timeouts) && success;
+       }
+    }
+
+    return success? 0:1;
+}
diff --git a/common-src/testutils.h b/common-src/testutils.h
new file mode 100644 (file)
index 0000000..26c138c
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ *
+ * 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.,
+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ *
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+ */
+
+#ifndef TESTUTILS_H
+#define TESTUTILS_H
+
+/*
+ * A library of utilities for writing 'make check'-based tests.
+ *
+ * Use this module like this:
+ *   int test_one(void) {
+ *     ...
+ *     tu_dbg("yep, worked: %p", someptr);
+ *     ...
+ *     return TRUE;
+ *   }
+ *
+ *   int main(int argc, char **argv)
+ *   {
+ *     TestUtilsTest tests[] = {
+ *         TU_TEST(test_one, 5),
+ *         TU_TEST(test_two, 6),
+ *         ...
+ *         TU_END()
+ *     }
+ *
+ *     return testutils_run_tests(argc, argv, tests);
+ *   }
+ */
+
+/*
+ * Defining tests
+ */
+
+/* A test function, returning a boolean */
+typedef int (*TestFunction)(void);
+
+/* A struct for test functions */
+typedef struct TestUtilsTest {
+    TestFunction fn;
+    char *name;
+    int timeout;
+    int selected;
+} TestUtilsTest;
+
+/* Macro to define a test array element */
+#define TU_TEST(fn, to) { fn, #fn, to, FALSE }
+#define TU_END() { NULL, NULL, 0, FALSE }
+
+/*
+ * Debugging
+ */
+
+/* Debugging macro taking printf arguments.  This is only enabled if the '-d' flag
+ * is given on the commandline.  You can use g_debug, too, if you'd prefer. */
+#define tu_dbg(...) if (tu_debugging_enabled) { g_fprintf(stderr, __VA_ARGS__); }
+
+/* Is debugging enabled for this test run? (set internally) */
+int tu_debugging_enabled;
+
+/*
+ * Main loop
+ */
+
+int testutils_run_tests(int argc, char **argv, TestUtilsTest *tests);
+
+#endif /* TESTUTILS_H */
index dfeec75ce9100e01eccb70460da828bbd63f7ca7..0c2e6c1513447411551d31e009edaa490858b78e 100644 (file)
@@ -60,6 +60,7 @@ char * get_timestamp_from_time(time_t when) {
 }
 
 char * get_proper_stamp_from_time(time_t when) {
+    /* note that this is reimplemented in perl in perl/Amanda/Util.swg */
     if (getconf_boolean(CNF_USETIMESTAMPS)) {
         return get_timestamp_from_time(when);
     } else {
diff --git a/common-src/token.c b/common-src/token.c
deleted file mode 100644 (file)
index 6489da3..0000000
+++ /dev/null
@@ -1,482 +0,0 @@
-/*
- * Amanda, The Advanced Maryland Automatic Network Disk Archiver
- * Copyright (c) 1997-1998 University of Maryland at College Park
- * All Rights Reserved.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of U.M. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission.  U.M. makes no representations about the
- * suitability of this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- *
- * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M.
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: the Amanda Development Team.  Its members are listed in a
- * file named AUTHORS, in the root directory of this distribution.
- */
-/*
- * $Id: token.c,v 1.32 2006/07/19 17:41:15 martinea Exp $
- *
- * token bashing routines
- */
-
-/*
-** The quoting method used here was selected because it has the
-** property that quoting a string that doesn't contain funny
-** characters results in an unchanged string and it was easy to code.
-** There are probably other algorithms that are just as effective.
-**/
-
-#include "amanda.h"
-#include "arglist.h"
-#include "token.h"
-
-/* Split a string up into tokens.
-** There is exactly one separator character between tokens.
-** XXX Won't work too well if separator is '\'!
-**
-** Inspired by awk and a routine called splitter() that I snarfed from
-** the net ages ago (original author long forgotten).
-*/
-int
-split(
-    char *     str,    /* String to split */
-    char **    token,  /* Array of token pointers */
-    int                toklen, /* Size of token[] */
-    char *     sep)    /* Token separators - usually " " */
-{
-    register char *pi, *po;
-    register int fld;
-    register size_t len;
-    static char *buf = (char *)0; /* XXX - static buffer */
-    int in_quotes;
-
-    assert(str && token && toklen > 0 && sep);
-
-    token[0] = str;
-
-    for (fld = 1; fld < toklen; fld++) token[fld] = (char *)0;
-
-    fld = 0;
-
-    if (*sep == '\0' || *str == '\0' || toklen == 1) return fld;
-
-    /* Calculate the length of the unquoted string. */
-    len = strlen(str);;
-
-    /* Allocate some space */
-
-    buf = newalloc(buf, len+1);
-
-    /* Copy it across and tokenise it */
-
-    in_quotes = 0;
-    po = buf;
-    token[++fld] = po;
-    for (pi = str; *pi && *pi != '\0'; pi++) {
-       if (*pi == '\n' && !in_quotes)
-           break;
-
-       if (!in_quotes && strchr(sep, *pi)) {
-           /*
-            * separator
-            * Advance to next field.
-            */
-           *po = '\0'; /* end of token */
-           if (fld+1 >= toklen) return fld; /* too many tokens */
-           token[++fld] = po + 1;
-           po++;
-           continue;
-       }
-
-       if (*pi == '"') {
-           /*
-            * Start or end of quote
-            * Emit quote in either case
-            */
-           in_quotes = !in_quotes;
-       } else if (in_quotes && *pi == '\\' && (*(pi + 1) == '"')) {
-           /*
-            * Quoted quote.
-            * emit '/' - default will pick up '"'
-            */
-           *po++ = *pi++;
-       }
-       *po++ = *pi;    /* Emit character */
-    }
-    *po = '\0';
-
-    assert(po == buf + len);   /* Just checking! */
-
-    return fld;
-}
-
-/*
-** Quote all the funny characters in one token.
-** - squotef - formatted string with space separator
-** - quotef  - formatted string with specified separators
-** - squote  - fixed string with space separator
-** - quote   - fixed strings with specified separators
-**/
-printf_arglist_function(char *squotef, char *, format)
-{
-       va_list argp;
-       char linebuf[16384];
-
-       /* Format the token */
-
-       arglist_start(argp, format);
-       g_vsnprintf(linebuf, SIZEOF(linebuf), format, argp);
-       arglist_end(argp);
-
-       return quote(" ", linebuf);
-}
-
-printf_arglist_function1(char *quotef, char *, sep, char *, format)
-{
-       va_list argp;
-       char linebuf[16384];
-
-       /* Format the token */
-
-       arglist_start(argp, format);
-       g_vsnprintf(linebuf, SIZEOF(linebuf), format, argp);
-       arglist_end(argp);
-
-       return quote(sep, linebuf);
-}
-
-char *squote(
-    char *     str)    /* the string to quote */
-{
-       return quote(" ", str);
-}
-
-char *
-quote(
-    char *     sepchr, /* separators that also need quoting */
-    char *     str)    /* the string to quote */
-{
-    register char *pi, *po;
-    register size_t len;
-    char *buf;
-    int sep, need_quotes;
-
-    /* Calculate the length of the quoted token. */
-
-    sep = 0;
-    len = 0;
-    for (pi = str; *pi; pi++) {
-       if (*pi < ' ' || *pi > '~')
-           len = len + 4;
-       else if (*pi == '\\' || *pi == '"')
-           len = len + 2;
-       else if (*sepchr && strchr(sepchr, *pi)) {
-           len = len + 1;
-           sep++;
-       }
-       else
-           len++;
-    }
-
-    need_quotes = (sep != 0);
-
-    if (need_quotes) len = len + 2;
-
-    /* Allocate some space */
-
-    buf = alloc(len+1);                /* trailing null */
-
-    /* Copy it across */
-
-    po = buf;
-
-    if (need_quotes) *po++ = '"';
-
-    for (pi = str; *pi; pi++) {
-       if (*pi < ' ' || *pi > '~') {
-           *po++ = '\\';
-           *po++ = (char)(((*pi >> 6) & 07) + '0');
-           *po++ = (char)(((*pi >> 3) & 07) + '0');
-           *po++ = (char)(((*pi     ) & 07) + '0');
-       }
-       else if (*pi == '\\' || *pi == '"') {
-           *po++ = '\\';
-           *po++ = *pi;
-       }
-       else *po++ = *pi;
-    }
-
-    if (need_quotes) *po++ = '"';
-
-    *po = '\0';
-
-    assert(po == (buf + len)); /* Just checking! */
-
-    return buf;
-}
-
-/* Quote a string so that it can be used as a regular expression */
-char *
-rxquote(
-    char *     str)    /* the string to quote */
-{
-    char *pi, *po;
-    size_t len;
-    char *buf;
-
-    /* Calculate the length of the quoted token. */
-
-    len = 0;
-    for (pi = str; *pi; pi++) {
-       switch (*pi) {
-           /* regular expression meta-characters: */
-#define META_CHARS \
-       case '\\': \
-       case '.': \
-       case '?': \
-       case '*': \
-       case '+': \
-       case '^': \
-       case '$': \
-       case '|': \
-       case '(': \
-       case ')': \
-       case '[': \
-       case ']': \
-       case '{': \
-       case '}' /* no colon */
-       META_CHARS:
-           len++;
-           /* fall through */
-       default:
-           len++;
-           break;
-       }
-    }
-
-    /* Allocate some space */
-
-    buf = alloc(len+1);                /* trailing null */
-
-    /* Copy it across */
-
-    po = buf;
-
-    for (pi = str; *pi; pi++) {
-       switch (*pi) {
-       META_CHARS:
-#undef META_CHARS
-           *po++ = '\\';
-           /* fall through */
-       default:
-           *po++ = *pi;
-           break;
-       }
-    }
-
-    *po = '\0';
-
-    assert(po == (buf + len)); /* Just checking! */
-
-    return buf;
-}
-
-#ifndef HAVE_SHQUOTE
-/* Quote a string so that it can be safely passed to a shell */
-char *
-shquote(
-    char *     str)    /* the string to quote */
-{
-    char *pi, *po;
-    size_t len;
-    char *buf;
-
-    /* Calculate the length of the quoted token. */
-
-    len = 0;
-    for (pi = str; *pi; pi++) {
-       switch (*pi) {
-           /* shell meta-characters: */
-#define META_CHARS \
-       case '\\': \
-       case ' ': \
-       case '\t': \
-       case '\n': \
-       case '?': \
-       case '*': \
-       case '$': \
-       case '~': \
-       case '!': \
-       case ';': \
-       case '&': \
-       case '<': \
-       case '>': \
-       case '\'': \
-       case '\"': \
-       case '`': \
-       case '|': \
-       case '(': \
-       case ')': \
-       case '[': \
-       case ']': \
-       case '{': \
-       case '}' /* no colon */
-       META_CHARS:
-           len++;
-           /* fall through */
-       default:
-           len++;
-           break;
-       }
-    }
-
-    /* Allocate some space */
-
-    buf = alloc(len+1);                /* trailing null */
-
-    /* Copy it across */
-
-    po = buf;
-
-    for (pi = str; *pi; pi++) {
-       switch (*pi) {
-       META_CHARS:
-#undef META_CHARS
-           *po++ = '\\';
-           /* fall through */
-       default:
-           *po++ = *pi;
-           break;
-       }
-    }
-
-    *po = '\0';
-
-    assert(po == (buf + len)); /* Just checking! */
-
-    return buf;
-}
-#endif
-
-/* Table lookup.
-*/
-int
-table_lookup(
-    table_t *  table,
-    char *     str)
-{
-       while(table->word != (char *)0) {
-               if (*table->word == *str && strcmp(table->word, str) == 0) {
-                       return table->value;
-               }
-               table++;
-       }
-
-       return table->value;
-}
-
-/* Reverse table lookup.
-*/
-char *
-table_lookup_r(
-    /*@keep@*/ table_t *       table,
-               int             val)
-{
-       while(table->word != (char *)0) {
-               if (table->value == val) {
-                       return table->word;
-               }
-               table++;
-       }
-
-       return (char *)0;
-}
-
-#ifdef TEST
-
-int
-main(
-    int                argc,
-    char **    argv)
-{
-       char *str = NULL;
-       char *t[20];
-       int r;
-       char *sr;
-       int i;
-
-       /*
-        * Configure program for internationalization:
-        *   1) Only set the message locale for now.
-        *   2) Set textdomain for all amanda related programs to "amanda"
-        *      We don't want to be forced to support dozens of message catalogs
-        */  
-       setlocale(LC_MESSAGES, "C");
-       textdomain("amanda"); 
-
-       safe_fd(-1, 0);
-
-       setlocale(LC_ALL, "C");
-
-       /* shut up compiler */
-       argc = argc;
-       argv = argv;
-
-       set_pname("token test");
-
-       dbopen(NULL);
-
-       /* Don't die when child closes pipe */
-       signal(SIGPIPE, SIG_IGN);
-
-       erroutput_type = ERR_INTERACTIVE;
-
-       g_printf(_("Testing split() with \" \" token separator\n"));
-       while(1) {
-               g_printf(_("Input string: "));
-               amfree(str);
-               if ((str = agets(stdin)) == NULL) {
-                       g_printf("\n");
-                       break;
-               }
-               r = split(str, t, 20, " ");
-               g_printf(plural(_("%d token:\n"), _("%d token:\n"), r), r);
-               for (i=0; i <= r; i++)
-                       g_printf("tok[%d] = \"%s\"\n", i, t[i]);
-       }
-       amfree(str);
-       g_printf("\n");
-
-       g_printf(_("Testing quote()\n"));
-       while(1) {
-               g_printf(_("Input string: "));
-               amfree(str);
-               if ((str = agets(stdin)) == NULL) {
-                       g_printf("\n");
-                       break;
-               }
-               sr = squote(str);
-               g_printf(_("Quoted   = \"%s\"\n"), sr);
-               strncpy(str,sr,SIZEOF(str)-1);
-               str[SIZEOF(str)-1] = '\0';
-               r = split(str, t, 20, " ");
-               if (r != 1)
-                       g_printf("split()=%d!\n", r);
-               g_printf(_("Unquoted = \"%s\"\n"), t[1]);
-               amfree(sr);
-       }
-       amfree(str);
-       return 0;
-}
-
-#endif
diff --git a/common-src/token.h b/common-src/token.h
deleted file mode 100644 (file)
index 4d80699..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Amanda, The Advanced Maryland Automatic Network Disk Archiver
- * Copyright (c) 1997-1998 University of Maryland at College Park
- * All Rights Reserved.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of U.M. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission.  U.M. makes no representations about the
- * suitability of this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- *
- * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M.
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: the Amanda Development Team.  Its members are listed in a
- * file named AUTHORS, in the root directory of this distribution.
- */
-/*
- * $Id: token.h,v 1.13 2006/05/25 01:47:12 johnfranks Exp $
- *
- * interface to token module
- */
-#ifndef TOKEN_H
-#define TOKEN_H
-
-#include "amanda.h"
-
-typedef struct {char *word; int value;} table_t;
-
-extern int split(char *str, char **token, int toklen, char *sep);
-extern char *squotef(char *format, ...)
-     G_GNUC_PRINTF(1,2);
-extern char *squote(char *str);
-extern char *quotef(char *sep, char *format, ...)
-     G_GNUC_PRINTF(2,3);
-extern char *quote(char *sep, char *str);
-extern char *rxquote(char *str);
-#ifndef HAVE_SHQUOTE
-extern char *shquote(char *str);
-#endif
-extern int table_lookup(table_t *table, char *str);
-extern char *table_lookup_r(table_t *table, int val);
-
-#endif
index c1ba9d5abeca516167211cc072575ba591378b79..24398f56c86919e1770f34379fae73a8ba09a83b 100644 (file)
 #include "clock.h"
 #include "sockaddr-util.h"
 #include "conffile.h"
-
-#ifdef HAVE_LIBCURL
-#include <curl/curl.h>
-#endif
+#include "base64.h"
 
 static int make_socket(sa_family_t family);
 static int connect_port(sockaddr_union *addrp, in_port_t port, char *proto,
                        sockaddr_union *svaddr, int nonblock);
 
-/*
- * Keep calling read() until we've read buflen's worth of data, or EOF,
- * or we get an error.
- *
- * Returns the number of bytes read, 0 on EOF, or negative on error.
- */
-ssize_t
-fullread(
-    int                fd,
-    void *     vbuf,
-    size_t     buflen)
-{
-    ssize_t nread, tot = 0;
-    char *buf = vbuf;  /* cast to char so we can ++ it */
-
-    while (buflen > 0) {
-       nread = read(fd, buf, buflen);
-       if (nread < 0) {
-           if ((errno == EINTR) || (errno == EAGAIN))
-               continue;
-           return ((tot > 0) ? tot : -1);
-       }
-
-       if (nread == 0)
-           break;
-
-       tot += nread;
-       buf += nread;
-       buflen -= nread;
-    }
-    return (tot);
-}
-
-/*
- * Keep calling write() until we've written buflen's worth of data,
- * or we get an error.
- *
- * Returns the number of bytes written, or negative on error.
- */
-ssize_t
-fullwrite(
-    int                fd,
-    const void *vbuf,
-    size_t     buflen)
-{
-    ssize_t nwritten, tot = 0;
-    const char *buf = vbuf;    /* cast to char so we can ++ it */
-
-    while (buflen > 0) {
-       nwritten = write(fd, buf, buflen);
-       if (nwritten < 0) {
-           if ((errno == EINTR) || (errno == EAGAIN))
-               continue;
-           return ((tot > 0) ? tot : -1);
-       }
-       tot += nwritten;
-       buf += nwritten;
-       buflen -= nwritten;
-    }
-    return (tot);
-}
-
 static int
 make_socket(
     sa_family_t family)
@@ -116,6 +51,7 @@ make_socket(
     int r;
 #endif
 
+    g_debug("make_socket opening socket with family %d", family);
     s = socket(family, SOCK_STREAM, 0);
     if (s == -1) {
         save_errno = errno;
@@ -376,6 +312,56 @@ bind_portrange(
     return -1;
 }
 
+/*
+ * Writes out the entire iovec
+ */
+ssize_t
+full_writev(
+    int                        fd,
+    struct iovec *     iov,
+    int                        iovcnt)
+{
+    ssize_t delta, n, total;
+
+    assert(iov != NULL);
+
+    total = 0;
+    while (iovcnt > 0) {
+       /*
+        * Write the iovec
+        */
+       n = writev(fd, iov, iovcnt);
+       if (n < 0) {
+           if (errno != EINTR)
+               return (-1);
+       }
+       else if (n == 0) {
+           errno = EIO;
+           return (-1);
+       } else {
+           total += n;
+           /*
+            * Iterate through each iov.  Figure out what we still need
+            * to write out.
+            */
+           for (; n > 0; iovcnt--, iov++) {
+               /* 'delta' is the bytes written from this iovec */
+               delta = ((size_t)n < (size_t)iov->iov_len) ? n : (ssize_t)iov->iov_len;
+               /* subtract from the total num bytes written */
+               n -= delta;
+               assert(n >= 0);
+               /* subtract from this iovec */
+               iov->iov_len -= delta;
+               iov->iov_base = (char *)iov->iov_base + delta;
+               /* if this iovec isn't empty, run the writev again */
+               if (iov->iov_len > 0)
+                   break;
+           }
+       }
+    }
+    return (total);
+}
+
 
 int
 needs_quotes(
@@ -487,6 +473,19 @@ unquote_string(
                    in++;
                    *(out++) = '\f';
                    continue;
+               } else if (*in >= '0' && *in <= '7') {
+                   char c = 0;
+                   int i = 0;
+
+                   while (i < 3 && *in >= '0' && *in <= '7') {
+                       c = (c << 3) + *(in++) - '0';
+                       i++;
+                   }
+                   if (c)
+                       *(out++) = c;
+               } else if (*in == '\0') {
+                   /* trailing backslash -- ignore */
+                   break;
                }
            }
            *(out++) = *(in++);
@@ -496,6 +495,85 @@ unquote_string(
     return (ret);
 }
 
+gchar **
+split_quoted_strings(
+    const gchar *string)
+{
+    char *local = g_strdup(string);
+    char *start = local;
+    char *p = local;
+    char **result;
+    GPtrArray *strs = g_ptr_array_new();
+    int iq = 0;
+
+    while (*p) {
+       if (!iq && *p == ' ') {
+           *p = '\0';
+           g_ptr_array_add(strs, unquote_string(start));
+           start = p+1;
+       } else if (*p == '\\') {
+           /* next character is taken literally; if it's a multicharacter
+            * escape (e.g., \171), that doesn't bother us here */
+           p++;
+           if (!*p) break;
+       } else if (*p == '\"') {
+           iq = ! iq;
+       }
+
+       p++;
+    }
+    if (start != string)
+       g_ptr_array_add(strs, unquote_string(start));
+
+    /* now convert strs into a strv, by stealing its references to the underlying
+     * strings */
+    result = g_new0(char *, strs->len + 1);
+    memmove(result, strs->pdata, sizeof(char *) * strs->len);
+
+    g_ptr_array_free(strs, FALSE); /* FALSE => don't free strings */
+    g_free(local);
+
+    return result;
+}
+
+char *
+strquotedstr(char **saveptr)
+{
+    char *  tok = strtok_r(NULL, " ", saveptr);
+    size_t     len;
+    int         in_quote;
+    int         in_backslash;
+    char       *p, *t;
+
+    if (!tok)
+       return tok;
+    len = strlen(tok);
+    in_quote = 0;
+    in_backslash = 0;
+    p = tok;
+    while (in_quote || in_backslash || *p != '\0') {
+       if (*p == '\0') {
+           /* append a new token */
+           t = strtok_r(NULL, " ", saveptr);
+           if (!t)
+               return NULL;
+           tok[len] = ' ';
+           len = strlen(tok);
+       }
+       if (!in_backslash) {
+           if (*p == '"')
+               in_quote = !in_quote;
+           else if (*p == '\\') {
+               in_backslash = 1;
+           }
+       } else {
+          in_backslash = 0;
+       }
+       p++;
+    }
+    return tok;
+}
+
 char *
 sanitize_string(
     const char *str)
@@ -535,7 +613,7 @@ int copy_file(
 {
     int     infd, outfd;
     int     save_errno;
-    ssize_t nb;
+    size_t nb;
     char    buf[32768];
     char   *quoted;
 
@@ -559,7 +637,7 @@ int copy_file(
     }
 
     while((nb=read(infd, &buf, SIZEOF(buf))) > 0) {
-       if(fullwrite(outfd,&buf,(size_t)nb) < nb) {
+       if(full_write(outfd,&buf,nb) < nb) {
            save_errno = errno;
            quoted = quote_string(dst);
            *errmsg = vstrallocf(_("Error writing to '%s': %s"),
@@ -571,7 +649,7 @@ int copy_file(
        }
     }
 
-    if (nb < 0) {
+    if (errno != 0) {
        save_errno = errno;
        quoted = quote_string(src);
        *errmsg = vstrallocf(_("Error reading from '%s': %s"),
@@ -712,28 +790,6 @@ int compare_possibly_null_strings(const char * a, const char * b) {
     }
 }
 
-gboolean amanda_thread_init(void) {
-    gboolean success = FALSE;
-#ifdef HAVE_LIBCURL
-    static gboolean did_curl_init = FALSE;
-    if (!did_curl_init) {
-# ifdef G_THREADS_ENABLED
-        g_assert(!g_thread_supported());
-# endif
-        g_assert(curl_global_init(CURL_GLOBAL_ALL) == 0);
-        did_curl_init = TRUE;
-    }
-#endif
-#if defined(G_THREADS_ENABLED) && !defined(G_THREADS_IMPL_NONE)
-    if (g_thread_supported()) {
-        return TRUE;
-    }
-    g_thread_init(NULL);
-    success = TRUE;
-#endif
-    return success;
-}
-
 int
 resolve_hostname(const char *hostname,
        int socktype,
@@ -756,7 +812,14 @@ resolve_hostname(const char *hostname,
 #endif
 
     memset(&hints, 0, sizeof(hints));
+#ifdef WORKING_IPV6
+    /* get any kind of addresss */
     hints.ai_family = AF_UNSPEC;
+#else
+    /* even if getaddrinfo supports IPv6, don't let it return
+     * such an address */
+    hints.ai_family = AF_INET;
+#endif
     hints.ai_flags = flags;
     hints.ai_socktype = socktype;
     result = getaddrinfo(hostname, NULL, &hints, &myres);
@@ -844,6 +907,11 @@ check_running_as(running_as_flags who)
 #endif
 
     switch (who & RUNNING_AS_USER_MASK) {
+       case RUNNING_AS_ANY:
+           uid_target = uid_me;
+           uname_target = uname_me;
+           return;
+
        case RUNNING_AS_ROOT:
            uid_target = 0;
            uname_target = "root";
@@ -923,28 +991,123 @@ int
 become_root(void)
 {
 #ifndef SINGLE_USERID
+    // if euid !=0, it set only euid
+    if (setuid(0) == -1) return 0;
+    // will set ruid because euid == 0.
     if (setuid(0) == -1) return 0;
 #endif
     return 1;
 }
 
+
+char *
+base64_decode_alloc_string(
+    char *in)
+{
+    char   *out;
+    size_t  in_len = strlen(in);
+    size_t  out_len = 3 * (in_len / 4) + 3;
+
+    out = malloc(out_len);
+    if (!base64_decode(in, in_len, out, &out_len)) {
+       amfree(out);
+       return NULL;
+    }
+    out[out_len] = '\0';
+
+    return out;
+}
+
+
+/* A GHFunc (callback for g_hash_table_foreach) */
+void count_proplist(
+    gpointer key_p G_GNUC_UNUSED,
+    gpointer value_p,
+    gpointer user_data_p)
+{
+    property_t *value_s = value_p;
+    int    *nb = user_data_p;
+    GSList  *value;
+
+    for(value=value_s->values; value != NULL; value = value->next) {
+       (*nb)++;
+    }
+}
+
+/* A GHFunc (callback for g_hash_table_foreach) */
+void proplist_add_to_argv(
+    gpointer key_p,
+    gpointer value_p,
+    gpointer user_data_p)
+{
+    char         *property_s = key_p;
+    property_t   *value_s = value_p;
+    char       ***argv = user_data_p;
+    GSList       *value;
+    char         *q, *w, *qprop, *qvalue;
+
+    q = quote_string(property_s);
+    /* convert to lower case */
+    for (w=q; *w != '\0'; w++) {
+       *w = tolower(*w);
+       if (*w == '_')
+           *w = '-';
+    }
+    qprop = stralloc2("--", q);
+    amfree(q);
+    for(value=value_s->values; value != NULL; value = value->next) {
+       qvalue = quote_string((char *)value->data);
+       **argv = stralloc(qprop);
+       (*argv)++;
+       **argv = qvalue;
+       (*argv)++;
+    }
+    amfree(qprop);
+}
+
+
 /*
  * Process parameters
  */
 
-/* current process name */
-#define MAX_PNAME 128
-static char pname[MAX_PNAME] = "unknown";
+static char *pname = NULL;
+static char *ptype = NULL;
+static pcontext_t pcontext = CONTEXT_DEFAULT; 
 
 void
 set_pname(char *p)
 {
-    g_strlcpy(pname, p, sizeof(pname));
+    pname = newstralloc(pname, p);
 }
 
 char *
 get_pname(void)
 {
+    if (!pname) pname = stralloc("unknown");
     return pname;
 }
 
+void
+set_ptype(char *p)
+{
+    ptype = newstralloc(ptype, p);
+}
+
+char *
+get_ptype(void)
+{
+    if (!ptype) ptype = stralloc("unknown");
+    return ptype;
+}
+
+void
+set_pcontext(pcontext_t pc)
+{
+    pcontext = pc;
+}
+
+pcontext_t
+get_pcontext(void)
+{
+    return pcontext;
+}
index 3a9efe7fcc880eadf00d4f710cb3914fecd4948d..59d29a0cef6986810b9c73a196af103893a5d947 100644 (file)
 /* internal types and variables */
 
 
-ssize_t        fullread(int, void *, size_t);
-ssize_t        fullwrite(int, const void *, size_t);
-
 int    connect_portrange(sockaddr_union *, in_port_t, in_port_t, char *,
                          sockaddr_union *, int);
 int    bind_portrange(int, sockaddr_union *, in_port_t, in_port_t,
                       char *);
 
+ssize_t        full_writev(int, struct iovec *, int);
+
 char * construct_datestamp(time_t *t);
 char * construct_timestamp(time_t *t);
 
@@ -60,6 +59,25 @@ char *       construct_timestamp(time_t *t);
 /*@only@*//*@null@*/char *unquote_string(const char *str);
 int    needs_quotes(const char * str);
 
+/* Split a string into space-delimited words, obeying quoting as created by
+ * quote_string.  To keep compatibility with the old split(), this has the
+ * characteristic that multiple consecutive spaces are not collapsed into
+ * a single space: "x  y" parses as [ "x", "", "y", NULL ].  The strings are
+ * unquoted before they are returned, unlike split().  An empty string is
+ * split into [ "", NULL ].
+ *
+ * Returns a NULL-terminated array of strings, which should be freed with
+ * g_strfreev.
+ */
+gchar ** split_quoted_strings(const gchar *string);
+
+/* Like strtok_r, but consider a quoted string to be a single token.  Caller
+ * must begin parsing with strtok_r first, then pass the saveptr to this function.
+ *
+ * Returns NULL on unparseable strings (e.g., unterminated quotes, bad escapes)
+ */
+char *         strquotedstr(char **saveptr);
+
 char * sanitize_string(const char *str);
 int     copy_file(char *dst, char *src, char **errmsg);
 
@@ -103,11 +121,6 @@ void free_new_argv(int new_argc, char **new_argv);
  * strings, instead of segfaulting. */
 int compare_possibly_null_strings(const char * a, const char * b);
 
-/* Does g_thread_init(), along with anything else that should be done
- * before/after thread setup. It's OK to call this function more than once.
- * Returns TRUE if threads are supported. */
-gboolean amanda_thread_init(void);
-
 /* Given a hostname, call getaddrinfo to resolve it.  Optionally get the
  * entire set of results (if res is not NULL) and the canonical name of
  * the host (if canonname is not NULL).  The canonical name might
@@ -155,6 +168,9 @@ char *_str_exit_status(char *subject, amwait_t status);
  * @param who: one of the RUNNING_AS_* constants, below.
  */
 typedef enum {
+        /* doesn't matter */
+    RUNNING_AS_ANY,
+
         /* userid is 0 */
     RUNNING_AS_ROOT,
 
@@ -199,6 +215,24 @@ int become_root(void);
  * Process parameters
  */
 
+/* The 'context' of a process gives a general description of how it is
+ * used.  This affects log output, among other things.
+ */
+typedef enum {
+    /* default context (logging to stderr, etc. -- not pretty) */
+    CONTEXT_DEFAULT = 0,
+
+    /* user-interfacing command-line utility like amadmin */
+    CONTEXT_CMDLINE,
+
+    /* daemon like amandad or sendbackup */
+    CONTEXT_DAEMON,
+
+    /* a utility used from shell scripts, and thus probably invoked
+     * quite often */
+    CONTEXT_SCRIPTUTIL,
+} pcontext_t;
+
 /* Set the name of the process.  The parameter is copied, and remains
  * the responsibility of the caller on return. This value is used in log
  * messages and other output throughout Amanda.
@@ -214,6 +248,33 @@ void set_pname(char *pname);
  */
 char *get_pname(void);
 
+/* Set the type of the process.  The parameter is copied, and remains
+ * the responsibility of the caller on return.  This value dictates the
+ * directory in which debug logs are stored.
+ *
+ * @param pname: the new process type
+ */
+void set_ptype(char *ptype);
+
+/* Get the current process name; the result is in a static buffer, and
+ * should *not* be free()d by the caller.
+ *
+ * @returns: process name
+ */
+char *get_ptype(void);
+
+/* Set the process's context
+ *
+ * @param context: the new context
+ */
+void set_pcontext(pcontext_t context);
+
+/* Get the process's context
+ *
+ * @returns: the context
+ */
+pcontext_t get_pcontext(void);
+
 /*
  * Readline support
  *
@@ -242,4 +303,28 @@ void       add_history(const char *line);
 
 #endif
 
+char *base64_decode_alloc_string(char *);
+
+/* A GHFunc (callback for g_hash_table_foreach),
+ * Count the number of properties.
+ *
+ * @param key_p: (char *) property name.
+ * @param value_p: (GSList *) property values list.
+ * @param user_data_p: (int *) count are added to that value.
+ */
+void count_proplist(gpointer key_p,
+                   gpointer value_p,
+                   gpointer user_data_p);
+
+/* A GHFunc (callback for g_hash_table_foreach),
+ * Store a property and it's value in an ARGV.
+ *
+ * @param key_p: (char *) property name.
+ * @param value_p: (GSList *) property values list.
+ * @param user_data_p: (char ***) pointer to ARGV.
+ */
+void proplist_add_to_argv(gpointer key_p,
+                         gpointer value_p,
+                         gpointer user_data_p);
+
 #endif /* UTIL_H */
index 3504b3089e89542ebdc9793ea24841597d4023a4..03e6183d2c3d5f32baa2002d5aadf61fb9cd5e06 100644 (file)
 
 const int   VERSION_MAJOR   = 2;
 const int   VERSION_MINOR   = 6;
-const int   VERSION_PATCH   = 0;
-const char *const VERSION_COMMENT = "p2";
+const int   VERSION_PATCH   = 1;
+const char *const VERSION_COMMENT = "";
 
 const char *
 versionsuffix(void)
 {
 #ifdef USE_VERSION_SUFFIXES
-    return "-2.6.0p2";
+    return "-2.6.1";
 #else
     return "";
 #endif
@@ -49,5 +49,5 @@ versionsuffix(void)
 const char *
 version(void)
 {
-    return "2.6.0p2";
+    return "2.6.1";
 }
index 7f0a293e2f418cb909f23e7e17749b0dc16f3b70..e7aabc04d5946f537c4bafb2f05bed0d9dd7fb96 100644 (file)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  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.
@@ -42,6 +42,7 @@ subdir = config
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps =  \
        $(top_srcdir)/config/macro-archive/ac_define_dir.m4 \
+       $(top_srcdir)/config/macro-archive/ac_perl_module_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_perl_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_swig.m4 \
        $(top_srcdir)/config/macro-archive/ax_compare_version.m4 \
@@ -75,6 +76,7 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/amanda/libs.m4 \
        $(top_srcdir)/config/amanda/net.m4 \
        $(top_srcdir)/config/amanda/progs.m4 \
+       $(top_srcdir)/config/amanda/ps.m4 \
        $(top_srcdir)/config/amanda/readdir.m4 \
        $(top_srcdir)/config/amanda/readline.m4 \
        $(top_srcdir)/config/amanda/rsh-security.m4 \
@@ -97,7 +99,9 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/float_h.m4 \
        $(top_srcdir)/config/gnulib/fsusage.m4 \
        $(top_srcdir)/config/gnulib/getaddrinfo.m4 \
+       $(top_srcdir)/config/gnulib/getopt.m4 \
        $(top_srcdir)/config/gnulib/gettimeofday.m4 \
+       $(top_srcdir)/config/gnulib/gnulib-common.m4 \
        $(top_srcdir)/config/gnulib/gnulib-comp.m4 \
        $(top_srcdir)/config/gnulib/include_next.m4 \
        $(top_srcdir)/config/gnulib/inet_ntop.m4 \
@@ -125,7 +129,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/sys_stat_h.m4 \
        $(top_srcdir)/config/gnulib/sys_time_h.m4 \
        $(top_srcdir)/config/gnulib/tempname.m4 \
-       $(top_srcdir)/config/gnulib/ulonglong.m4 \
        $(top_srcdir)/config/gnulib/unistd_h.m4 \
        $(top_srcdir)/config/gnulib/vasnprintf.m4 \
        $(top_srcdir)/config/gnulib/visibility.m4 \
@@ -136,7 +139,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gettext-macros/lib-ld.m4 \
        $(top_srcdir)/config/gettext-macros/lib-link.m4 \
        $(top_srcdir)/config/gettext-macros/lib-prefix.m4 \
-       $(top_srcdir)/config/gettext-macros/longlong.m4 \
        $(top_srcdir)/config/gettext-macros/nls.m4 \
        $(top_srcdir)/config/gettext-macros/po.m4 \
        $(top_srcdir)/config/gettext-macros/progtest.m4 \
@@ -155,6 +157,7 @@ SOURCES =
 DIST_SOURCES =
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
+AIX_BACKUP = @AIX_BACKUP@
 ALLOCA = @ALLOCA@
 ALLOCA_H = @ALLOCA_H@
 AMANDA_DBGDIR = @AMANDA_DBGDIR@
@@ -169,8 +172,10 @@ AMPLOT_CAT_GZIP = @AMPLOT_CAT_GZIP@
 AMPLOT_CAT_PACK = @AMPLOT_CAT_PACK@
 AMPLOT_COMPRESS = @AMPLOT_COMPRESS@
 AMTAR = @AMTAR@
+APPLICATION_DIR = @APPLICATION_DIR@
 AR = @AR@
 ARPA_INET_H = @ARPA_INET_H@
+ASSERTIONS = @ASSERTIONS@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -182,16 +187,28 @@ BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@
 BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@
 BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@
 BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@
+BSDTCP_SECURITY = @BSDTCP_SECURITY@
+BSDUDP_SECURITY = @BSDUDP_SECURITY@
+BSD_SECURITY = @BSD_SECURITY@
 CAT = @CAT@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
+CHECK_USERID = @CHECK_USERID@
 CHIO = @CHIO@
 CHS = @CHS@
+CLIENT_HOST_INSTANCE = @CLIENT_HOST_INSTANCE@
+CLIENT_HOST_KEY_FILE = @CLIENT_HOST_KEY_FILE@
+CLIENT_HOST_PRINCIPAL = @CLIENT_HOST_PRINCIPAL@
 CLIENT_LOGIN = @CLIENT_LOGIN@
 CLIENT_SCRIPTS_OPT = @CLIENT_SCRIPTS_OPT@
 COMPRESS = @COMPRESS@
+COMPRESS_BEST_OPT = @COMPRESS_BEST_OPT@
+COMPRESS_FAST_OPT = @COMPRESS_FAST_OPT@
+COMPRESS_PATH = @COMPRESS_PATH@
+COMPRESS_SUFFIX = @COMPRESS_SUFFIX@
+CONFIG_CLOBBER_MY_CONFIG = @CONFIG_CLOBBER_MY_CONFIG@
 CONFIG_DIR = @CONFIG_DIR@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
@@ -205,6 +222,7 @@ DD = @DD@
 DEFAULT_AMANDATES_FILE = @DEFAULT_AMANDATES_FILE@
 DEFAULT_CHANGER_DEVICE = @DEFAULT_CHANGER_DEVICE@
 DEFAULT_CONFIG = @DEFAULT_CONFIG@
+DEFAULT_MAILER = @DEFAULT_MAILER@
 DEFAULT_SERVER = @DEFAULT_SERVER@
 DEFAULT_TAPE_DEVICE = @DEFAULT_TAPE_DEVICE@
 DEFAULT_TAPE_SERVER = @DEFAULT_TAPE_SERVER@
@@ -212,7 +230,7 @@ DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DOC_BUILD_DATE = @DOC_BUILD_DATE@
 DUMP = @DUMP@
-DUMPER_DIR = @DUMPER_DIR@
+DUMP_RETURNS_1 = @DUMP_RETURNS_1@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -225,6 +243,7 @@ F77 = @F77@
 FFLAGS = @FFLAGS@
 FLOAT_H = @FLOAT_H@
 GETCONF = @GETCONF@
+GETOPT_H = @GETOPT_H@
 GETTEXT = @GETTEXT@
 GLIB_CFLAGS = @GLIB_CFLAGS@
 GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
@@ -235,9 +254,12 @@ GMSGFMT_015 = @GMSGFMT_015@
 GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
 GNULIB_CHOWN = @GNULIB_CHOWN@
 GNULIB_DUP2 = @GNULIB_DUP2@
+GNULIB_ENVIRON = @GNULIB_ENVIRON@
 GNULIB_FCHDIR = @GNULIB_FCHDIR@
 GNULIB_FFLUSH = @GNULIB_FFLUSH@
+GNULIB_FOPEN = @GNULIB_FOPEN@
 GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
+GNULIB_FREOPEN = @GNULIB_FREOPEN@
 GNULIB_FSEEK = @GNULIB_FSEEK@
 GNULIB_FSEEKO = @GNULIB_FSEEKO@
 GNULIB_FTELL = @GNULIB_FTELL@
@@ -247,6 +269,7 @@ GNULIB_GETCWD = @GNULIB_GETCWD@
 GNULIB_GETDELIM = @GNULIB_GETDELIM@
 GNULIB_GETLINE = @GNULIB_GETLINE@
 GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
+GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@
 GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
 GNULIB_LCHOWN = @GNULIB_LCHOWN@
 GNULIB_LSEEK = @GNULIB_LSEEK@
@@ -271,8 +294,10 @@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
 GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
 GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
 GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
+GNULIB_PUTENV = @GNULIB_PUTENV@
 GNULIB_READLINK = @GNULIB_READLINK@
 GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@
+GNULIB_SETENV = @GNULIB_SETENV@
 GNULIB_SLEEP = @GNULIB_SLEEP@
 GNULIB_SNPRINTF = @GNULIB_SNPRINTF@
 GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@
@@ -281,11 +306,15 @@ GNULIB_STPNCPY = @GNULIB_STPNCPY@
 GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
 GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
 GNULIB_STRDUP = @GNULIB_STRDUP@
+GNULIB_STRERROR = @GNULIB_STRERROR@
 GNULIB_STRNDUP = @GNULIB_STRNDUP@
 GNULIB_STRNLEN = @GNULIB_STRNLEN@
 GNULIB_STRPBRK = @GNULIB_STRPBRK@
 GNULIB_STRSEP = @GNULIB_STRSEP@
+GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@
+GNULIB_STRSTR = @GNULIB_STRSTR@
 GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
+GNULIB_UNSETENV = @GNULIB_UNSETENV@
 GNULIB_VASPRINTF = @GNULIB_VASPRINTF@
 GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@
 GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
@@ -299,6 +328,7 @@ GOBJECT_QUERY = @GOBJECT_QUERY@
 GREP = @GREP@
 GZIP = @GZIP@
 HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@
+HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@
 HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@
 HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@
 HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
@@ -307,9 +337,10 @@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
 HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@
 HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
 HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
-HAVE_DECL_STRNCASECMP = @HAVE_DECL_STRNCASECMP@
+HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@
 HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
 HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
+HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@
 HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
 HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
 HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
@@ -317,7 +348,9 @@ HAVE_DUP2 = @HAVE_DUP2@
 HAVE_FSEEKO = @HAVE_FSEEKO@
 HAVE_FTELLO = @HAVE_FTELLO@
 HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
+HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
 HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
+HAVE_GZIP = @HAVE_GZIP@
 HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
 HAVE_IO_H = @HAVE_IO_H@
 HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
@@ -326,8 +359,10 @@ HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@
 HAVE_MEMPCPY = @HAVE_MEMPCPY@
 HAVE_MKDTEMP = @HAVE_MKDTEMP@
 HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@
+HAVE_OS_H = @HAVE_OS_H@
 HAVE_READLINK = @HAVE_READLINK@
 HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@
+HAVE_SETENV = @HAVE_SETENV@
 HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
 HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
 HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
@@ -335,7 +370,6 @@ HAVE_SLEEP = @HAVE_SLEEP@
 HAVE_STDINT_H = @HAVE_STDINT_H@
 HAVE_STPCPY = @HAVE_STPCPY@
 HAVE_STPNCPY = @HAVE_STPNCPY@
-HAVE_STRCASECMP = @HAVE_STRCASECMP@
 HAVE_STRCASESTR = @HAVE_STRCASESTR@
 HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
 HAVE_STRNDUP = @HAVE_STRNDUP@
@@ -344,10 +378,12 @@ HAVE_STRSEP = @HAVE_STRSEP@
 HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@
 HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
 HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
+HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
 HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
 HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
 HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
 HAVE_UNISTD_H = @HAVE_UNISTD_H@
+HAVE_UNSETENV = @HAVE_UNSETENV@
 HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
 HAVE_VASPRINTF = @HAVE_VASPRINTF@
 HAVE_VISIBILITY = @HAVE_VISIBILITY@
@@ -363,6 +399,8 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 INTLLIBS = @INTLLIBS@
 INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+KRB4_SECURITY = @KRB4_SECURITY@
+KRB5_SECURITY = @KRB5_SECURITY@
 LDFLAGS = @LDFLAGS@
 LEX = @LEX@
 LEXLIB = @LEXLIB@
@@ -379,6 +417,8 @@ LIBTHREAD = @LIBTHREAD@
 LIBTOOL = @LIBTOOL@
 LIBTOOL_DEPS = @LIBTOOL_DEPS@
 LN_S = @LN_S@
+LOCKING = @LOCKING@
+LOW_TCPPORTRANGE = @LOW_TCPPORTRANGE@
 LTLIBICONV = @LTLIBICONV@
 LTLIBINTL = @LTLIBINTL@
 LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
@@ -387,7 +427,6 @@ LTLIBPTH = @LTLIBPTH@
 LTLIBTHREAD = @LTLIBTHREAD@
 MAILER = @MAILER@
 MAKEINFO = @MAKEINFO@
-MAXTAPEBLOCKSIZE = @MAXTAPEBLOCKSIZE@
 MCUTIL = @MCUTIL@
 MKDIR_P = @MKDIR_P@
 MSGFMT = @MSGFMT@
@@ -423,26 +462,37 @@ PERL_INC = @PERL_INC@
 PKG_CONFIG = @PKG_CONFIG@
 POSUB = @POSUB@
 PRINT = @PRINT@
+PS = @PS@
+PS_ARGUMENT = @PS_ARGUMENT@
 PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
 RANLIB = @RANLIB@
 READLINE_LIBS = @READLINE_LIBS@
 REPLACE_CHOWN = @REPLACE_CHOWN@
 REPLACE_FCHDIR = @REPLACE_FCHDIR@
 REPLACE_FFLUSH = @REPLACE_FFLUSH@
+REPLACE_FOPEN = @REPLACE_FOPEN@
 REPLACE_FPRINTF = @REPLACE_FPRINTF@
+REPLACE_FREOPEN = @REPLACE_FREOPEN@
 REPLACE_FSEEK = @REPLACE_FSEEK@
 REPLACE_FSEEKO = @REPLACE_FSEEKO@
 REPLACE_FTELL = @REPLACE_FTELL@
 REPLACE_FTELLO = @REPLACE_FTELLO@
 REPLACE_GETCWD = @REPLACE_GETCWD@
 REPLACE_GETLINE = @REPLACE_GETLINE@
+REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
 REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
 REPLACE_LCHOWN = @REPLACE_LCHOWN@
 REPLACE_LSEEK = @REPLACE_LSEEK@
+REPLACE_MEMMEM = @REPLACE_MEMMEM@
 REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
 REPLACE_PRINTF = @REPLACE_PRINTF@
+REPLACE_PUTENV = @REPLACE_PUTENV@
 REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
 REPLACE_SPRINTF = @REPLACE_SPRINTF@
+REPLACE_STRCASESTR = @REPLACE_STRCASESTR@
+REPLACE_STRERROR = @REPLACE_STRERROR@
+REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@
+REPLACE_STRSTR = @REPLACE_STRSTR@
 REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
 REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
 REPLACE_VPRINTF = @REPLACE_VPRINTF@
@@ -450,7 +500,11 @@ REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
 REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
 REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
 RESTORE = @RESTORE@
+RSH_SECURITY = @RSH_SECURITY@
 SAMBA_CLIENT = @SAMBA_CLIENT@
+SERVER_HOST_INSTANCE = @SERVER_HOST_INSTANCE@
+SERVER_HOST_KEY_FILE = @SERVER_HOST_KEY_FILE@
+SERVER_HOST_PRINCIPAL = @SERVER_HOST_PRINCIPAL@
 SERVICE_SUFFIX = @SERVICE_SUFFIX@
 SETUID_GROUP = @SETUID_GROUP@
 SET_MAKE = @SET_MAKE@
@@ -460,6 +514,7 @@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
 SNAPSHOT_STAMP = @SNAPSHOT_STAMP@
 SORT = @SORT@
 SSH = @SSH@
+SSH_SECURITY = @SSH_SECURITY@
 STDBOOL_H = @STDBOOL_H@
 STDINT_H = @STDINT_H@
 STRIP = @STRIP@
@@ -469,7 +524,14 @@ SWIG_LIB = @SWIG_LIB@
 SYS_SOCKET_H = @SYS_SOCKET_H@
 SYS_STAT_H = @SYS_STAT_H@
 SYS_TIME_H = @SYS_TIME_H@
+TCPPORTRANGE = @TCPPORTRANGE@
+TICKET_LIFETIME = @TICKET_LIFETIME@
+UDPPORTRANGE = @UDPPORTRANGE@
+UNCOMPRESS_OPT = @UNCOMPRESS_OPT@
+UNCOMPRESS_PATH = @UNCOMPRESS_PATH@
+USE_AMANDAHOSTS = @USE_AMANDAHOSTS@
 USE_NLS = @USE_NLS@
+USE_RUNDUMP = @USE_RUNDUMP@
 USE_VERSION_SUFFIXES = @USE_VERSION_SUFFIXES@
 VDUMP = @VDUMP@
 VERSION = @VERSION@
@@ -478,6 +540,7 @@ VERSION_MAJOR = @VERSION_MAJOR@
 VERSION_MINOR = @VERSION_MINOR@
 VERSION_PATCH = @VERSION_PATCH@
 VERSION_SUFFIX = @VERSION_SUFFIX@
+VOID_UNSETENV = @VOID_UNSETENV@
 VRESTORE = @VRESTORE@
 VXDUMP = @VXDUMP@
 VXRESTORE = @VXRESTORE@
@@ -506,6 +569,7 @@ am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+amdatadir = @amdatadir@
 amincludedir = @amincludedir@
 amlibdir = @amlibdir@
 amlibexecdir = @amlibexecdir@
@@ -524,6 +588,8 @@ dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 gl_LIBOBJS = @gl_LIBOBJS@
 gl_LTLIBOBJS = @gl_LTLIBOBJS@
+gltests_LIBOBJS = @gltests_LIBOBJS@
+gltests_LTLIBOBJS = @gltests_LTLIBOBJS@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
@@ -553,6 +619,7 @@ target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 EXTRA_DIST = config.guess config.sub install-sh libtool.m4 ltmain.sh \
@@ -565,11 +632,12 @@ EXTRA_DIST = config.guess config.sub install-sh libtool.m4 ltmain.sh \
        amanda/funcs.m4 amanda/getfsent.m4 amanda/i18n.m4 \
        amanda/ipv6.m4 amanda/krb4-security.m4 amanda/krb5-security.m4 \
        amanda/lfs.m4 amanda/libs.m4 amanda/net.m4 amanda/progs.m4 \
-       amanda/readdir.m4 amanda/readline.m4 amanda/rsh-security.m4 \
-       amanda/s3-device.m4 amanda/shmem.m4 amanda/socklen_t_equiv.m4 \
-       amanda/ssh-security.m4 amanda/summary.m4 amanda/swig.m4 \
-       amanda/syshacks.m4 amanda/tape.m4 amanda/types.m4 \
-       amanda/userid.m4 amanda/version.m4 gettext-macros/codeset.m4 \
+       amanda/ps.m4 amanda/readdir.m4 amanda/readline.m4 \
+       amanda/rsh-security.m4 amanda/s3-device.m4 amanda/shmem.m4 \
+       amanda/socklen_t_equiv.m4 amanda/ssh-security.m4 \
+       amanda/summary.m4 amanda/swig.m4 amanda/syshacks.m4 \
+       amanda/tape.m4 amanda/types.m4 amanda/userid.m4 \
+       amanda/version.m4 gettext-macros/codeset.m4 \
        gettext-macros/gettext.m4 gettext-macros/glibc21.m4 \
        gettext-macros/glibc2.m4 gettext-macros/iconv.m4 \
        gettext-macros/intdiv0.m4 gettext-macros/intmax.m4 \
@@ -587,7 +655,7 @@ EXTRA_DIST = config.guess config.sub install-sh libtool.m4 ltmain.sh \
        gnulib/absolute-header.m4 gnulib/alloca.m4 \
        gnulib/arpa_inet_h.m4 gnulib/base64.m4 gnulib/eoverflow.m4 \
        gnulib/extensions.m4 gnulib/float_h.m4 gnulib/fsusage.m4 \
-       gnulib/getaddrinfo.m4 gnulib/gettimeofday.m4 \
+       gnulib/getaddrinfo.m4 gnulib/getopt.m4 gnulib/gettimeofday.m4 \
        gnulib/gnulib-cache.m4 gnulib/gnulib-common.m4 \
        gnulib/gnulib-comp.m4 gnulib/gnulib-tool.m4 \
        gnulib/include_next.m4 gnulib/inet_ntop.m4 gnulib/intmax_t.m4 \
@@ -600,10 +668,11 @@ EXTRA_DIST = config.guess config.sub install-sh libtool.m4 ltmain.sh \
        gnulib/stdbool.m4 gnulib/stdint_h.m4 gnulib/stdint.m4 \
        gnulib/stdio_h.m4 gnulib/stdlib_h.m4 gnulib/strdup.m4 \
        gnulib/string_h.m4 gnulib/sys_socket_h.m4 gnulib/sys_stat_h.m4 \
-       gnulib/sys_time_h.m4 gnulib/tempname.m4 gnulib/ulonglong.m4 \
-       gnulib/unistd_h.m4 gnulib/vasnprintf.m4 gnulib/visibility.m4 \
-       gnulib/wchar.m4 gnulib/wchar_t.m4 gnulib/wint_t.m4 \
-       gnulib/xsize.m4 macro-archive/ac_define_dir.m4 \
+       gnulib/sys_time_h.m4 gnulib/tempname.m4 gnulib/unistd_h.m4 \
+       gnulib/vasnprintf.m4 gnulib/visibility.m4 gnulib/wchar.m4 \
+       gnulib/wchar_t.m4 gnulib/wint_t.m4 gnulib/xsize.m4 \
+       macro-archive/ac_define_dir.m4 \
+       macro-archive/ac_perl_module_version.m4 \
        macro-archive/ac_prog_perl_version.m4 \
        macro-archive/ac_prog_swig.m4 \
        macro-archive/ax_compare_version.m4 \
index a37670720724ecc589009973d4a8720f7900159c..30ce62a5dd14efe79bfb2a68ea004141bbda6668 100644 (file)
 #   Note that the defaults for *both* of these options are "yes", unlike
 #   the remainder of the security implementations.
 #
-#   Defines BSD_SECURITY, and sets AM_CONDITIONAL WANT_BSD_SECURITY,
-#   if the user has selected this mechanism.  Also defines USE_AMANDAHOSTS
-#   unless the user has specified --without-amandahosts.
+#   Defines and substitues BSD_SECURITY, and sets AM_CONDITIONAL
+#   WANT_BSD_SECURITY, if the user has selected this mechanism.
+#   Also defines and substitutes USE_AMANDAHOSTS unless the user has
+#   specified --without-amandahosts.
 #
 AC_DEFUN([AMANDA_BSD_SECURITY],
 [
@@ -24,7 +25,7 @@ AC_DEFUN([AMANDA_BSD_SECURITY],
         [
             case "$withval" in
                 n | no) BSD_SECURITY=no ;;
-                y |  ye | yes) ;;
+                y |  ye | yes) BSD_SECURITY=yes ;;
                 *) AC_MSG_ERROR([*** You must not supply an argument to --without-bsd-security.])
                     ;;
             esac
@@ -37,8 +38,8 @@ AC_DEFUN([AMANDA_BSD_SECURITY],
             [use ".rhosts" instead of ".amandahosts"]),
         [
             case "$withval" in
-                n | no ) USE_AMANDAHOSTS="no" ;;
-                y |  ye | yes) : ;;
+                n | no ) USE_AMANDAHOSTS=no ;;
+                y |  ye | yes) USE_AMANDAHOSTS=yes ;;
                 *) AC_MSG_ERROR([*** You must not supply an argument to --without-amandahosts option.])
                   ;;
             esac
@@ -55,4 +56,6 @@ AC_DEFUN([AMANDA_BSD_SECURITY],
     fi
 
     AM_CONDITIONAL(WANT_BSD_SECURITY, test x"$BSD_SECURITY" = x"yes")
+    AC_SUBST(BSD_SECURITY)
+    AC_SUBST(USE_AMANDAHOSTS)
 ])
index 044415b8ea1386565451c1728231faac21293d2c..10192e1dfd6bcfe868f8dfb77ea78234aac83634 100644 (file)
@@ -7,18 +7,18 @@
 #   Handle configuration for BSDTCP security, implementing the 
 #   --with-bsdtcp-security option.
 #
-#   Defines BSDTCP_SECURITY, and sets AM_CONDITIONAL WANT_BSDTCP_SECURITY,
-#   if the user has selected this mechanism.
+#   Defines and substitutes BSDTCP_SECURITY, and sets AM_CONDITIONAL 
+#   WANT_BSDTCP_SECURITY, if the user has selected this mechanism.
 #
 AC_DEFUN([AMANDA_BSDTCP_SECURITY],
 [
-    BSDTCP_SECURITY="no"
+    BSDTCP_SECURITY="yes"
     AC_ARG_WITH(bsdtcp-security,
         AS_HELP_STRING([--with-bsdtcp-security],
                 [include BSDTCP authentication]),
         [
             case "$withval" in
-                n | no) : ;;
+                n | no) BSDTCP_SECURITY=no ;;
                 y |  ye | yes) BSDTCP_SECURITY=yes ;;
                 *) AC_MSG_ERROR([*** You must not supply an argument to --with-bsdtcp-security.])
               ;;
@@ -30,5 +30,7 @@ AC_DEFUN([AMANDA_BSDTCP_SECURITY],
         AC_DEFINE(BSDTCP_SECURITY,1,
             [Define if BSDTCP transport should be enabled.])
     fi
+
     AM_CONDITIONAL(WANT_BSDTCP_SECURITY, test x"$BSDTCP_SECURITY" = x"yes")
+    AC_SUBST(BSDTCP_SECURITY)
 ])
index 1422bb7d036d712a6e07a021a271932f07706838..32fe09efb213f0593b54aeb11c47b43286297242 100644 (file)
@@ -7,8 +7,8 @@
 #   Handle configuration for BSDUDP security, implementing the 
 #   --with-bsdudp-security option.
 #
-#   Defines BSDUDP_SECURITY, and sets AM_CONDITIONAL WANT_BSDUDP_SECURITY,
-#   if the user has selected this mechanism.
+#   Defines and substitutes BSDUDP_SECURITY, and sets AM_CONDITIONAL
+#   WANT_BSDUDP_SECURITY, if the user has selected this mechanism.
 #
 AC_DEFUN([AMANDA_BSDUDP_SECURITY],
 [
@@ -30,5 +30,7 @@ AC_DEFUN([AMANDA_BSDUDP_SECURITY],
         AC_DEFINE(BSDUDP_SECURITY,1,
             [Define if BSDUDP transport should be enabled.])
     fi
+
     AM_CONDITIONAL(WANT_BSDUDP_SECURITY, test x"$BSDUDP_SECURITY" = x"yes")
+    AC_SUBST(BSDUDP_SECURITY)
 ])
index 23c3ae3cf9412cd8d2038358e2e5499dbaa5c4f2..3d263257499727b0f4cebf8f0e78d6dc1b8889b1 100644 (file)
@@ -33,8 +33,8 @@ AC_DEFUN([AMANDA_SETUP_CHANGER], [
        sys/scsi.h \
        sys/scsiio.h \
        sys/scsi/impl/uscsi.h \
-       sys/scsi/scsi/ioctl.h \
-       )
+       sys/scsi/scsi/ioctl.h, \
+       [], [], [AC_INCLUDES_DEFAULT])
 
     #
     # chio support
index 1fb47ec8ac6cfe808b770b43d8cef8cfaccc4e65..4df5a496e89411f91040c39ef49e411090b593af 100644 (file)
@@ -4,7 +4,7 @@
 #
 # OVERVIEW
 #
-#   Find a suitable compression program and define the following:
+#   Find a suitable compression program and substitute and define the following:
 #
 #    - COMPRESS_PATH
 #    - COMPRESS_SUFFIX
@@ -20,9 +20,11 @@ AC_DEFUN([AMANDA_CHECK_COMPRESSION],
     AC_REQUIRE([AMANDA_PROG_COMPRESS])
     AC_REQUIRE([AMANDA_PROG_GZIP])
 
+    HAVE_GZIP=
     if test "$GZIP"; then
        AC_DEFINE(HAVE_GZIP,1,
            [Define if Amanda is using the gzip program. ])
+       HAVE_GZIP=1
        COMPRESS_PATH="$GZIP"
        COMPRESS_SUFFIX=".gz"
        COMPRESS_FAST_OPT="--fast"
@@ -66,6 +68,14 @@ AC_DEFUN([AMANDA_CHECK_COMPRESSION],
     AC_DEFINE_UNQUOTED(UNCOMPRESS_OPT,"$UNCOMPRESS_OPT",
        [Define as any optional arguments to get UNCOMPRESS_PATH to uncompress. ])
 
+    AC_SUBST(COMPRESS_PATH)
+    AC_SUBST(COMPRESS_SUFFIX)
+    AC_SUBST(COMPRESS_FAST_OPT)
+    AC_SUBST(COMPRESS_BEST_OPT)
+    AC_SUBST(UNCOMPRESS_PATH)
+    AC_SUBST(UNCOMPRESS_OPT)
+    AC_SUBST(HAVE_GZIP)
+
     # Empty GZIP so that make dist works.
     GZIP=
 ])
index 4a499dc553469401ec7ee40d2321d4eef9635d65..a9acbd6edfc912726537565dd189615abbed2c86 100644 (file)
@@ -4,10 +4,12 @@
 #
 # OVERVIEW
 #
-#   Handles the --with-assertions flag.  Defines ASSERTIONS if the flag is given.
+#   Handles the --with-assertions flag.  Defines and substitutes ASSERTIONS
+#   if the flag is given.
 #
 AC_DEFUN([AMANDA_WITH_ASSERTIONS],
 [
+    ASSERTIONS=
     AC_ARG_WITH(assertions,
         AS_HELP_STRING([--with-assertions],
             [compile assertions into code]),
@@ -15,6 +17,7 @@ AC_DEFUN([AMANDA_WITH_ASSERTIONS],
             case "$withval" in
                 n | no) : ;;
                 y |  ye | yes)
+                   ASSERTIONS=1
                     AC_DEFINE(ASSERTIONS,1,
                         [Define if you want assertion checking. ])
                   ;;
@@ -23,6 +26,7 @@ AC_DEFUN([AMANDA_WITH_ASSERTIONS],
             esac
         ]
     )
+    AC_SUBST(ASSERTIONS)
 ])
 
 # SYNOPSIS
index a28931badab026048383acc8584cd09c8736273d..af870c4cffda929ee390ece5e9d19ded8ccb11fa 100644 (file)
 #
 AC_DEFUN([AMANDA_SETUP_DEFAULTS],
 [
+    #allow configure CONFIG_CLOBBER_MY_CONFIG= to be used by make.
+    CONFIG_CLOBBER_MY_CONFIG=$CLOBBER_MY_CONFIG
+    AC_SUBST(CONFIG_CLOBBER_MY_CONFIG)
+
     AC_ARG_WITH(index-server,
        AS_HELP_STRING([--with-index-server=HOST],
            [default amanda index server (default: `uname -n`)]),
index ee9c58cdbe0631f03f92c8d58a87801411a84de2..f0fea5b90af3f527d6a86436fa296dc395e735e1 100644 (file)
@@ -1,16 +1,16 @@
 # SYNOPSIS
 #
-#   AMANDA_WITH_DUMPERDIR
+#   AMANDA_WITH_APPLICATIONDIR
 #
 # OVERVIEW
 #
-#   Define and substitute DUMPER_DIR with the result.
+#   Define and substitute APPLICATION_DIR with the result.
 #
-AC_DEFUN([AMANDA_WITH_DUMPERDIR],
+AC_DEFUN([AMANDA_WITH_APPLICATIONDIR],
 [
     AC_ARG_WITH(dumperdir,
        AS_HELP_STRING([--with-dumperdir=DIR],
-           [where we install the dumpers (default: exec_prefix/dumper)]),
+           [where we install the dumpers (deprecated)]),
        [
             AMANDA_MSG_WARN([--with-dumperdir is no longer used.])
        ]
@@ -24,7 +24,7 @@ AC_DEFUN([AMANDA_WITH_DUMPERDIR],
 # OVERVIEW
 #
 #   Allow user to specify the dumperdir, defaulting to ${exec_prefix}/dumper.
-#   Define and substitute DUMPER_DIR with the result.
+#   Define and substitute APPLICATION_DIR with the result.
 #
 AC_DEFUN([AMANDA_WITH_CONFIGDIR],
 [
@@ -156,11 +156,12 @@ AC_DEFUN([AMANDA_WITH_TMPDIR],
 #   - mandir
 #
 #   Also defines the following directories and expands any variable references:
+#   - amdatadir = --with-amdatadir or ${datadir}/amanda
 #   - amlibdir = --with-amlibdir or ${libdir}/amanda
 #   - amlibexecdir = --with-amlibexecdir or ${libexecdir}/amanda
 #   - amincludedir = ${includedir}/amanda
 #   - amperldir = --with-amperldir or `perl -V:installsitearch`
-#   - DUMPER_DIR = ${amlibexecdir}/application
+#   - APPLICATION_DIR = ${amlibexecdir}/application
 #
 AC_DEFUN([AMANDA_EXPAND_DIRS],
 [
@@ -241,10 +242,21 @@ AC_DEFUN([AMANDA_EXPAND_DIRS],
     AC_DEFINE_DIR([amperldir], [AMPERLLIB],
        [Directory in which perl modules should be installed])
 
-    DUMPER_DIR='${amlibexecdir}/application'
-    AC_DEFINE_DIR([DUMPER_DIR],[DUMPER_DIR],
+    APPLICATION_DIR='${amlibexecdir}/application'
+    AC_DEFINE_DIR([APPLICATION_DIR],[APPLICATION_DIR],
            [Directory in which dumper interfaces should be installed and searched. ])
-    # TODO: rename to APPLICATION_DIR, add to Amanda::Paths and 'amgtconf build.APPLICATION_DIR'
+
+    AC_ARG_WITH(amdatadir,
+       AS_HELP_STRING([--with-amdatadir[[[[[=PATH]]]]]],
+               [Where amanda's templates and examples are installed; default: $datadir/amanda]),
+       [
+           AMDATADIR=$withval
+       ], [
+           AMDATADIR=$datadir/amanda
+       ]
+    )
+    AC_DEFINE_DIR([amdatadir], [AMDATADIR],
+       [Directory in which amanda's templates and examples are installed. ])
 ])
 
 # SYNOPSIS
@@ -258,9 +270,10 @@ AC_DEFUN([AMANDA_EXPAND_DIRS],
 AC_DEFUN([AMANDA_SHOW_DIRS_SUMMARY],
 [
     echo "Directories:"
-    echo "  Perl modules (amperldir): $amperldir"
-    echo "  Dumper: $DUMPER_DIR"
+    echo "  Application: $APPLICATION_DIR"
     echo "  Configuration: $CONFIG_DIR"
     echo "  GNU Tar lists: $GNUTAR_LISTED_INCREMENTAL_DIR"
+    echo "  Perl modules (amperldir): $amperldir"
+    echo "  Template and example data files (amdatadir): $amdatadir"
     echo "  Temporary: $AMANDA_TMPDIR"
 ])
index 9c455c6032670001cb8df5ea0ea6ed9b2bae7260..76b20d93cc8b1a4e07ccea8df66daec8fe38a587 100644 (file)
@@ -214,7 +214,8 @@ AC_DEFUN([AMANDA_PROG_XFSDUMP_XFSRESTORE],
 #   the binaries we search for depends on the target system.  If working
 #   binaries are found, DUMP and RESTORE are defined to their full paths.
 #
-#   DUMP_RETURNS is defined if the system's 'dump' returns 1 on success.
+#   DUMP_RETURNS_1 is defined and substituted if the system's 'dump'
+#   returns 1 on success.
 #
 #   HAVE_DUMP_ESTIMATE is defined to the dump flag which enables estimates.
 #
@@ -233,23 +234,25 @@ AC_DEFUN([AMANDA_PROG_DUMP_RESTORE],
     # a variable is set up here to specify the order of dump programs to
     # search for on the system.
     DUMP_PROGRAMS="ufsdump dump backup"
-    dump_returns_1=
+    DUMP_RETURNS_1=
+    AIX_BACKUP=
     case "$target" in
        *-dg-*)
            DUMP_PROGRAMS="dump "$DUMP_PROGRAMS
-           dump_returns_1=yes
+           DUMP_RETURNS_1=1
            ;;
       *-ibm-aix*)
            DUMP_PROGRAMS="backup "$DUMP_PROGRAMS
+           AIX_BACKUP=1
            AC_DEFINE(AIX_BACKUP,1,
                [Is DUMP the AIX program 'backup'?])
            ;;
       *-ultrix*)
-           dump_returns_1=yes
+           DUMP_RETURNS_1=1
            ;;
     esac
 
-    if test -n "$dump_returns_1"; then
+    if test -n "$DUMP_RETURNS_1"; then
       AC_DEFINE(DUMP_RETURNS_1,1,
        [Define this if this system's dump exits with 1 as a success code. ])
     fi
@@ -362,6 +365,9 @@ AC_DEFUN([AMANDA_PROG_DUMP_RESTORE],
            fi
        ])
     fi
+
+    AC_SUBST(AIX_BACKUP)
+    AC_SUBST(DUMP_RETURNS_1)
 ])
 
 # SYNOPSIS
@@ -371,7 +377,7 @@ AC_DEFUN([AMANDA_PROG_DUMP_RESTORE],
 # DESCRIPTION
 #
 #   Decide if the 'rundump' setuid-root wrapper should be used to invoke
-#   dump.  If so, USE_RUNDUMP is #defined.
+#   dump.  If so, USE_RUNDUMP is defined and substituted.
 #
 AC_DEFUN([AMANDA_CHECK_USE_RUNDUMP], [
     USE_RUNDUMP=no
@@ -392,7 +398,12 @@ AC_DEFUN([AMANDA_CHECK_USE_RUNDUMP], [
         ])
 
     if test x"$USE_RUNDUMP" = x"yes"; then
+       USE_RUNDUMP=1
         AC_DEFINE(USE_RUNDUMP,1,
             [Define to invoke rundump (setuid-root) instead of DUMP program directly. ])
+    else
+       USE_RUNDUMP=
     fi
+
+    AC_SUBST(USE_RUNDUMP)
 ])
index 7e929ac3915cb1b0c9fe064a23c846aef9e8a027..b5133a763d986dcd4e72a77a9cfa990089353139 100644 (file)
@@ -25,6 +25,7 @@ EXTRA_DIST += amanda/lfs.m4
 EXTRA_DIST += amanda/libs.m4
 EXTRA_DIST += amanda/net.m4
 EXTRA_DIST += amanda/progs.m4
+EXTRA_DIST += amanda/ps.m4
 EXTRA_DIST += amanda/readdir.m4
 EXTRA_DIST += amanda/readline.m4
 EXTRA_DIST += amanda/rsh-security.m4
index ba20da9dc534c47e6d3193b4568cb57875e26760..1f67530b5fd6fb28ce0c58bb9ae6ef41b31427e3 100644 (file)
@@ -92,16 +92,17 @@ AC_DEFUN([AMANDA_INIT_FLAGS],
            done
        ])
 
+    # Disable strict-aliasing optimizations
+    AMANDA_DISABLE_GCC_FEATURE(strict-aliasing)
+
     # Warn for just about everything
-    AMANDA_TEST_GCC_WARNING_FLAG(-Wall, [
-       AMANDA_ADD_WARNING_CFLAG(-Wall)
-    ])
+    AMANDA_ENABLE_GCC_WARNING(all)
     
     # And add any extra warnings too
-    AMANDA_TEST_GCC_WARNING_FLAG(-Wextra, [
+    AMANDA_TEST_GCC_FLAG(-Wextra, [
        AMANDA_ADD_WARNING_CFLAG(-Wextra)
     ], [
-       AMANDA_TEST_GCC_WARNING_FLAG(-W, [
+       AMANDA_TEST_GCC_FLAG(-W, [
            AMANDA_ADD_WARNING_CFLAG(-W)
        ])
     ])
@@ -197,6 +198,25 @@ AC_DEFUN([AMANDA_ADD_LIBS],
     [LIBS="$1 $LIBS"]
 )
 
+# SYNOPSIS
+#
+#   AMANDA_DISABLE_GCC_FEATURE(feature)
+#
+# OVERVIEW
+#
+#   Disable feature 'feature' by adding flag -Wno-'feature' to 
+#   AMANDA_FEATURE_CFLAGS.
+#
+AC_DEFUN([AMANDA_DISABLE_GCC_FEATURE],
+[
+    # test for -W'feature', then add the 'no-' version.
+    AMANDA_TEST_GCC_FLAG(-f$1,
+    [
+       AMANDA_ADD_CFLAGS(-fno-$1)
+       AMANDA_ADD_CPPFLAGS(-fno-$1)
+    ])
+])
+
 # SYNOPSIS
 #
 #   AMANDA_ADD_WARNING_CFLAG(flag)
@@ -220,7 +240,7 @@ AC_DEFUN([AMANDA_ADD_WARNING_CFLAG],
 #
 AC_DEFUN([AMANDA_ENABLE_GCC_WARNING],
 [
-    AMANDA_TEST_GCC_WARNING_FLAG(-W$1,
+    AMANDA_TEST_GCC_FLAG(-W$1,
     [
        AMANDA_ADD_WARNING_CFLAG(-W$1)
     ])
@@ -238,7 +258,7 @@ AC_DEFUN([AMANDA_ENABLE_GCC_WARNING],
 AC_DEFUN([AMANDA_DISABLE_GCC_WARNING],
 [
     # test for -W'warning', then add the 'no-' version.
-    AMANDA_TEST_GCC_WARNING_FLAG(-W$1,
+    AMANDA_TEST_GCC_FLAG(-W$1,
     [
        AMANDA_ADD_WARNING_CFLAG(-Wno-$1)
     ])
@@ -246,7 +266,7 @@ AC_DEFUN([AMANDA_DISABLE_GCC_WARNING],
 
 # SYNOPSIS
 #
-#   AMANDA_TEST_GCC_WARNING_FLAG(flag, action-if-found, action-if-not-found)
+#   AMANDA_TEST_GCC_FLAG(flag, action-if-found, action-if-not-found)
 #
 # OVERVIEW
 #
@@ -255,14 +275,16 @@ AC_DEFUN([AMANDA_DISABLE_GCC_WARNING],
 #
 #   Intended for internal use in this file.
 #
-AC_DEFUN([AMANDA_TEST_GCC_WARNING_FLAG],
+AC_DEFUN([AMANDA_TEST_GCC_FLAG],
 [
     AC_REQUIRE([AC_PROG_CC])
     AC_REQUIRE([AC_PROG_EGREP])
     AC_MSG_CHECKING(for gcc flag $1)
     if test "x$GCC" = "xyes"; then
        changequote(,)dnl
-       $CC -v --help 2>&1 | $EGREP -- '[^[:alnum:]]$1[^[:alnum:]-]' 2>&1 > /dev/null
+       (gcc --help={target,optimizers,warnings,undocumented,params,c} 2>&1 || 
+           $CC -v --help 2>&1) | 
+         $EGREP -- '[^[:alnum:]]$1[^[:alnum:]-]' 2>&1 > /dev/null
        changequote([,])dnl
        if test $? -eq 0; then
            found_warning=yes
index 9850a5b99c4a40ca338420281c37f2d87217bb87..fa7615b6a9ab3b8a02dc11ad1e3c0bd213995ad8 100644 (file)
@@ -4,15 +4,15 @@
 #
 # OVERVIEW
 #
-#   Set up file locking support.  Four types of locking are available:
-#     USE_POSIX_FCNTL - use fcntl().  The full job.
-#     USE_FLOCK       - use flock().  Does just as well.
-#     USE_LOCKF       - use lockf().  Only handles advisory, exclusive,
+#   Set up file locking support.  Four locking mechanisms are available:
+#     POSIX_FCNTL - use fcntl().  The full job.
+#     FLOCK       - use flock().  Does just as well.
+#     LOCKF       - use lockf().  Only handles advisory, exclusive,
 #                       blocking file locks as used by Amanda.
-#     USE_LNLOCK      - Home brew exclusive, blocking file lock.
-#     <none>          - No locking available.  User beware!
-#   One of given symbols are defined if the method is discovered to
-#   be available; the methods are searched in the above order.
+#     LNLOCK      - Home brew exclusive, blocking file lock.
+#
+#   For the chosen method, WANT_AMFLOCK_mech is defined and set up as an
+#   AM_CONDITIONAL.  Also, LOCKING, which contains the mechanism, is substituted.
 #
 AC_DEFUN([AMANDA_SETUP_FILE_LOCKING],
 [
@@ -28,7 +28,7 @@ AC_DEFUN([AMANDA_SETUP_FILE_LOCKING],
     # Note: these all use AC_TRY_LINK to make sure that we can compile
     # and link each variant.  They do not try to test the variants --
     # that is left to runtime.
-    WORKING_FILE_LOCK="no"
+    LOCKING="no"
 
     # check POSIX locking
     AC_CACHE_CHECK(
@@ -62,7 +62,7 @@ AC_DEFUN([AMANDA_SETUP_FILE_LOCKING],
     if test "x$amanda_cv_posix_filelocking" = xyes; then
        AC_DEFINE(WANT_AMFLOCK_POSIX,1,[Define to use POSIX (fcntl()) for file locking])
        WANT_AMFLOCK_POSIX="yes"
-       WORKING_FILE_LOCK="yes"
+       LOCKING="POSIX_FCNTL"
     fi
     AM_CONDITIONAL(WANT_AMFLOCK_POSIX, test x"$WANT_AMFLOCK_POSIX" = x"yes")
 
@@ -86,7 +86,7 @@ AC_DEFUN([AMANDA_SETUP_FILE_LOCKING],
     if test "x$amanda_cv_flock_filelocking" = xyes; then
        AC_DEFINE(WANT_AMFLOCK_FLOCK,1,[Define to use flock(2) for file locking])
        WANT_AMFLOCK_FLOCK="yes"
-       WORKING_FILE_LOCK="yes"
+       LOCKING="FLOCK"
     fi
     AM_CONDITIONAL(WANT_AMFLOCK_FLOCK, test x"$WANT_AMFLOCK_FLOCK" = x"yes")
 
@@ -110,7 +110,7 @@ AC_DEFUN([AMANDA_SETUP_FILE_LOCKING],
     if test "x$amanda_cv_lockf_filelocking" = xyes; then
        AC_DEFINE(WANT_AMFLOCK_LOCKF,1,[Define to use lockf(3) for file locking.])
        WANT_AMFLOCK_LOCKF="yes"
-       WORKING_FILE_LOCK="yes"
+       LOCKING="LOCKF"
     fi
     AM_CONDITIONAL(WANT_AMFLOCK_LOCKF, test x"$WANT_AMFLOCK_LOCKF" = x"yes")
 
@@ -134,12 +134,14 @@ AC_DEFUN([AMANDA_SETUP_FILE_LOCKING],
     if test "x$amanda_cv_lnlock_filelocking" = xyes; then
        AC_DEFINE(WANT_AMFLOCK_LNLOCK,1,[Define to use link(2) to emulate file locking.])
        WANT_AMFLOCK_LNLOCK="yes"
-       WORKING_FILE_LOCK="yes"
+       LOCKING="LNLOCK"
     fi
     AM_CONDITIONAL(WANT_AMFLOCK_LNLOCK, test x"$WANT_AMFLOCK_LNLOCK" = x"yes")
 
-    if test x"$WORKING_FILE_LOCK" = "no"; then
+    if test x"$LOCKING" = "no"; then
        # this shouldn't happen, and is *bad* if it does
        AC_MSG_ERROR([*** No working file locking capability found!])
     fi
+
+    AC_SUBST(LOCKING)
 ])
index c3c177658473e8c013f1f57d2b354f1d5f1ff46b..4330ad5f3d5bbf7c2fce2304312e7d0524fa4a73 100644 (file)
@@ -112,31 +112,6 @@ main()
     fi
 ])
 
-#
-# Checks to see if there's a sockaddr_storage structure
-#
-# usage:
-#
-#      AC_SOCKADDR_STORAGE
-#
-# results:
-#
-#      HAVE_SOCKADDR_STORAGE (defined)
-#
-AC_DEFUN([AC_SOCKADDR_STORAGE],
-    [AC_MSG_CHECKING(if sockaddr_storage struct exists)
-    AC_CACHE_VAL(ac_cv_has_sockaddr_storage,
-       AC_TRY_COMPILE([
-#      include <sys/types.h>
-#      include <sys/socket.h>],
-       [u_int i = sizeof (struct sockaddr_storage)],
-       ac_cv_has_sockaddr_storage=yes,
-       ac_cv_has_sockaddr_storage=no))
-    AC_MSG_RESULT($ac_cv_has_sockaddr_storage)
-    if test $ac_cv_has_sockaddr_storage = yes ; then
-           AC_DEFINE(HAVE_SOCKADDR_STORAGE,1,[if struct sockaddr_storage exists])
-    fi])
-
 # SYNOPSIS
 #
 #   AMANDA_SHOW_IPV6_SUMMARY
index 68f541676ee4eca328d3f20c70d5771bd14ee37a..446be93e1c2c6a5e83035f4766efce3febd8d796 100644 (file)
@@ -7,9 +7,9 @@
 #   Handle configuration for KRB4 security, implementing the --with-krb4-security
 #   option.  If libraries are found, they are added to the relevant compiler flags.
 #
-#   Defines KRB4_SECURITY, and sets AM_CONDITIONAL WANT_KRB4_SECURITY,
+#   Defines and substitutes KRB4_SECURITY, and sets AM_CONDITIONAL WANT_KRB4_SECURITY,
 #   if the user has selected this mechanism.  Also, the following parameters
-#   are taken from options and defined:
+#   are taken from options, defined, and substituted:
 #
 #    - SERVER_HOST_PRINCIPAL
 #    - SERVER_HOST_INSTANCE
@@ -231,4 +231,14 @@ AC_DEFUN([AMANDA_KRB4_SECURITY],
         fi
     fi
     AM_CONDITIONAL(WANT_KRB4_SECURITY, test x"$KRB4_SECURITY" = x"yes")
+
+    AC_SUBST(KRB4_SECURITY)
+
+    AC_SUBST(SERVER_HOST_PRINCIPAL)
+    AC_SUBST(SERVER_HOST_INSTANCE)
+    AC_SUBST(SERVER_HOST_KEY_FILE)
+    AC_SUBST(CLIENT_HOST_PRINCIPAL)
+    AC_SUBST(CLIENT_HOST_INSTANCE)
+    AC_SUBST(CLIENT_HOST_KEY_FILE)
+    AC_SUBST(TICKET_LIFETIME)
 ])
index 1cf0d7a5f1058ec258b671b3cb69b07b7f0b24dd..0aea8f5711f015b90bc588ffb8f7b72c730ddba4 100644 (file)
@@ -7,17 +7,9 @@
 #   Handle configuration for KRB5 security, implementing the --with-krb5-security
 #   option.  If libraries are found, they are added to the relevant compiler flags.
 #
-#   Defines KRB5_SECURITY, and sets AM_CONDITIONAL WANT_KRB5_SECURITY,
-#   if the user has selected this mechanism.  Also, the following parameters
-#   are taken from options and defined:
-#
-#    - SERVER_HOST_PRINCIPAL
-#    - SERVER_HOST_INSTANCE
-#    - SERVER_HOST_KEY_FILE
-#    - CLIENT_HOST_PRINCIPAL
-#    - CLIENT_HOST_INSTANCE
-#    - CLIENT_HOST_KEY_FILE
-#    - TICKET_LIFETIME
+#   Defines and substitutes KRB5_SECURITY, and sets AM_CONDITIONAL 
+#   WANT_KRB5_SECURITY, if the user has selected this mechanism.  Also, the
+#   following parameters are taken from options, defined, and substituted:
 #
 AC_DEFUN([AMANDA_KRB5_SECURITY],
 [
@@ -102,4 +94,5 @@ AC_DEFUN([AMANDA_KRB5_SECURITY],
     fi
 
     AM_CONDITIONAL(WANT_KRB5_SECURITY, test x"$KRB5_SECURITY" = x"yes")
+    AC_SUBST(KRB5_SECURITY)
 ])
index 4bf2bc279b322263b6a6c3c0e67e8445ae9acb2d..1c3ae6cb92ee06dafc3c7e87fed0f8c122ff3bf2 100644 (file)
@@ -120,8 +120,8 @@ AC_DEFUN([AMANDA_CHECK_GLIB], [
     AM_PATH_GLIB_2_0(2.2.0,,[
        AC_MSG_ERROR(glib not found or too old; See http://wiki.zmanda.com/index.php/Installation for help)
     ], gmodule gobject gthread)
-    AMANDA_ADD_CFLAGS($GLIB_CFLAGS)
-    AMANDA_ADD_CPPFLAGS($GLIB_CPPFLAGS)
+    # GLIB_CPPFLAGS is not set by autoconf, yet GLIB_CFLAGS contains what GLIB_CPPFLAGS should contain.
+    AMANDA_ADD_CPPFLAGS($GLIB_CFLAGS)
     AMANDA_ADD_LIBS($GLIB_LIBS)
 ])
 
index f2c1805a716b1c3635313415a5faf31bdfe6d967..917903b074cad82c48869ab914a0bab371f02ae8 100644 (file)
@@ -59,8 +59,8 @@ AC_DEFUN([AMANDA_WITH_REUSEPORTS], [
 # OVERVIEW
 #
 #   Implement --with-low-tcpportrange, --with-tcpportrange, and --with-udpportrange.
-#   Results are DEFINED in LOW_TCPPORTRANGE, TCPPORTRANGE, and UDPPORTRANGE, 
-#   respectively.
+#   Results are DEFINED and substituted in LOW_TCPPORTRANGE, TCPPORTRANGE, and 
+#   UDPPORTRANGE, respectively.
 #
 AC_DEFUN([AMANDA_WITH_PORTRANGES], [
     AC_ARG_WITH(low-tcpportrange,
@@ -139,6 +139,9 @@ AC_DEFUN([AMANDA_WITH_PORTRANGES], [
   [A comma-separated list of two integers, determining the minimum and
  * maximum reserved UDP port numbers sockets should be bound to. ])
     fi
+    AC_SUBST(UDPPORTRANGE)
+    AC_SUBST(TCPPORTRANGE)
+    AC_SUBST(LOW_TCPPORTRANGE)
 ])
 
 # SYNOPSIS
index 79babba8ab6bdd980c24f965e2dd74b347be54e1..c816b75e350a74b229ef4ca734c63e7be9e4f0dc 100644 (file)
@@ -111,10 +111,11 @@ AC_DEFUN([AMANDA_PROG_LINT],
       AC_PATH_PROG(AMLINT,splint,,$SYSLOCPATH)
       if test ! -z "$AMLINT"; then
        AMLINT="splint"
+        AMLINTFLAGS='+show-scan +unixlib -weak -globs +usedef +usereleased +impouts -paramimptemp -varuse -warnposix -redef -preproc -fixedformalarray -retval -unrecog -usevarargs -formatcode'
       else
        AMLINT='echo "Error: LINT is not installed" ; false'
+        AMLINTFLAGS=''
       fi
-      AMLINTFLAGS='+show-scan +unixlib -weak -globs +usedef +usereleased +impouts -paramimptemp -varuse -warnposix -redef -preproc -fixedformalarray -retval -unrecog -usevarargs -formatcode'
     fi
     AC_SUBST(AMLINTFLAGS)
 ])
@@ -283,10 +284,13 @@ AC_DEFUN([AMANDA_PROG_MAILER],
     AC_PATH_PROGS(MAILER,Mail mailx mail,NONE)
     if test x"$MAILER" = x"NONE"; then
         AMANDA_MSG_WARN([WARNING: Amanda cannot send mail reports without a mailer.])
+       DEFAULT_MAILER=""
     else
-        AC_DEFINE_UNQUOTED(MAILER,"$MAILER",
-                [A program that understands -s "subject" user < message_file])
+       DEFAULT_MAILER="$MAILER"
     fi
+    AC_DEFINE_UNQUOTED(DEFAULT_MAILER,"$DEFAULT_MAILER",
+                [A program that understands -s "subject" user < message_file])
+    AC_SUBST(DEFAULT_MAILER)
 ])
 
 # SYNOPSIS
diff --git a/config/amanda/ps.m4 b/config/amanda/ps.m4
new file mode 100644 (file)
index 0000000..83b88b5
--- /dev/null
@@ -0,0 +1,62 @@
+#
+#   Find ps argument for Amanda::Process
+#
+AC_DEFUN([AMANDA_PS_ARGUMENT],
+[
+    AC_PATH_PROG(PS, ps)
+    AC_MSG_CHECKING([ps argument to use])
+    PS_ARGUMENT=
+
+    # ps is *very* non-portable, and across many systems, the same option
+    # (e.g., -e) can mean different things.  So this macro tries to
+    # special-case most known systems, and makes an effort to detect unknown
+    # systems
+    case "$target" in
+       *-*-solaris*)
+           PS_ARGUMENT="-eo pid,ppid,comm"
+           ;;
+
+       *-*-linux-*)
+           PS_ARGUMENT="-eo pid,ppid,command"
+           ;;
+
+       *-*-*bsd*)
+           PS_ARGUMENT="-axo pid,ppid,command"
+           ;;
+
+       *-apple-darwin*)
+           PS_ARGUMENT="-aAco pid,ppid,command"
+           ;;
+
+       *-pc-cygwin)
+           # Cygwin is special-cased in Amanda::Process
+           PS_ARGUMENT=CYGWIN
+           ;;
+
+       *-*-hpux*)
+           # HPUX's 'PS' needs the env var UNIX95 to run in "xpg4" mode
+           PS="UNIX95=1 $PS"
+           PS_ARGUMENT="-eo pid,ppid,comm"
+           ;;
+
+       *)
+           for try in \
+               "-axo pid,ppid,command" \
+               "-aAco pid,ppid,command" \
+               "-eo pid,ppid,comm"
+           do
+               ps $try >/dev/null 2>/dev/null
+               if test $? -eq 0; then
+                   PS_ARGUMENT="$try"
+                   break
+               fi
+           done
+           if test -z "$PS_ARGUMENT"; then
+               AC_MSG_ERROR([Can't find ps argument to use.])
+           fi
+           ;;
+    esac
+
+    AC_MSG_RESULT($PS_ARGUMENT)
+    AC_SUBST(PS_ARGUMENT)
+])
index 891d50f5be8fb33fd7cfa125770c831b149243b0..747b6541e59f5850d39c01b6e666fd0aacaf6bbb 100644 (file)
@@ -28,5 +28,6 @@ AC_DEFUN([AMANDA_RSH_SECURITY],
                 [Define if RSH transport should be enabled. ])
     fi
     AM_CONDITIONAL(WANT_RSH_SECURITY, test x"$RSH_SECURITY" = x"yes")
+    AC_SUBST(RSH_SECURITY)
 ])
 
index 1aa37cbacdc182daea77e7fc911adec2d252cdfd..2c15e4ca5f09ba2227dcd83234a3b40e5bada6f1 100644 (file)
@@ -7,9 +7,6 @@
 #   Perform the necessary checks for the S3 Device.  If the S3 device should be built,
 #   WANT_S3_DEVICE is DEFINEd and set up as an AM_CONDITIONAL.
 #
-#   The subsidiary DevPay support, if enabled, defines and AM_CONDITIONALizes
-#   WANT_DEVPAY.
-#
 AC_DEFUN([AMANDA_S3_DEVICE], [
     AC_REQUIRE([AMANDA_CHECK_LIBCURL])
     AC_REQUIRE([AMANDA_CHECK_HMAC])
@@ -43,23 +40,4 @@ AC_DEFUN([AMANDA_S3_DEVICE], [
     if test x"$WANT_S3_DEVICE" = x"yes"; then
        AC_DEFINE(WANT_S3_DEVICE, [], [Compile Amazon S3 driver])
     fi
-                         
-
-    AC_ARG_ENABLE([devpay],
-                 AS_HELP_STRING([--enable-devpay],
-                                [Use devpay authentication for Amazon S3 driver]),
-                 [WANT_DEVPAY=$enableval], [WANT_DEVPAY=no])
-
-    AC_MSG_CHECKING([whether to include the Amazon S3 device's DevPay support])
-    if test x"$WANT_DEVPAY" = x"yes"; then
-       if test x"$WANT_S3_DEVICE" != x"yes"; then
-           AC_MSG_RESULT(no)
-           AC_MSG_ERROR([DevPay support requires the S3 device (--enable-s3-device)])
-       fi
-
-       AC_DEFINE([WANT_DEVPAY], [], [Compile Amazon DevPay support])
-    fi
-    AC_MSG_RESULT($WANT_DEVPAY)
-
-    AM_CONDITIONAL([WANT_DEVPAY], [test "$WANT_DEVPAY" = "yes"])
 ])
index 9fd8d9758c1a7ad5c6f28bf4d69bfcc94769f9e2..e5e4c3483ac6c841a29baf53067819e26c821dc4 100644 (file)
@@ -5,17 +5,18 @@
 # OVERVIEW
 #
 #   Handle configuration for SSH security, implementing the --with-ssh-security
-#   option and checking for the relevant programs and options.
+#   option and checking for the relevant programs and options.  Defines and substitutes
+#   SSH_SECURITY, searches for and defines SSH, and defines SSH_OPTIONS.
 #
 AC_DEFUN([AMANDA_SSH_SECURITY],
 [
-    SSH_SECURITY=no
+    SSH_SECURITY=yes
     AC_ARG_WITH(ssh-security,
         AS_HELP_STRING([--with-ssh-security], 
                 [include SSH authentication]),
         [
             case "$withval" in
-                n | no) : ;;
+                n | no) SSH_SECURITY=no ;;
                 y |  ye | yes) SSH_SECURITY=yes ;;
                 *) AC_MSG_ERROR([*** You must not supply an argument to --with-ssh-security.])
               ;;
@@ -68,4 +69,7 @@ AC_DEFUN([AMANDA_SSH_SECURITY],
                 [Arguments to ssh])
     fi
     AM_CONDITIONAL(WANT_SSH_SECURITY, test x"$SSH_SECURITY" = x"yes")
+
+    AC_SUBST(SSH_SECURITY)
+    # (note -- don't just substitute SSH_OPTIONS -- shell quoting will break)
 ])
index dadfc890837a79fa33f7d8695aec7955beb49044..483306d917d8dd6e06edf995cdf6d898e4a3af7f 100644 (file)
@@ -17,6 +17,11 @@ AC_DEFUN([AMANDA_SETUP_SWIG],
     # If we want cygwin to copy ddl to modules directory.
     WANT_CYGWIN_COPY_PERL_DLL="false"
 
+    # test for ExtUtils::Embed
+    AC_PERL_MODULE_VERSION([ExtUtils::Embed 0.0], [], [
+       AC_MSG_ERROR([*** Amanda requires the perl package ExtUtils::Embed to build its perl modules])
+    ])
+
     # get the include path for building perl extensions
     PERL_INC=`$PERL -MExtUtils::Embed -e perl_inc`
     AC_SUBST(PERL_INC)
index d08f27a9a0f0032443096c4a3c96b2a413300bdb..f5b04d9650ebbbbaabe6a00848d6f9c40eff4729 100644 (file)
@@ -4,20 +4,12 @@
 #
 # OVERVIEW
 #
-#   Implement the --with-maxtapeblocksize option, and DEFINE and SUBST the
-#   result in MAX_TAPE_BLOCk_KB and MAXTAPEBLOCKSIZE, respectively.
+#   Implement the deprecated --with-maxtapeblocksize option.
 #
 AC_DEFUN([AMANDA_WITH_MAXTAPEBLOCKSIZE], [
-    AC_ARG_WITH(maxtapeblocksize,
-       AS_HELP_STRING([--with-maxtapeblocksize=kb],
-           [Maximum size of a tape block (default: 32)]),
-       [ MAXTAPEBLOCKSIZE="$withval" ],
-       [ MAXTAPEBLOCKSIZE=32 ]
+    AC_ARG_WITH(maxtapeblocksize, [(deprecated)],
+       [ AMANDA_MSG_WARN([--with-maxtapeblocksize is no longer needed]) ]
     )
-
-    AC_DEFINE_UNQUOTED(MAX_TAPE_BLOCK_KB,($MAXTAPEBLOCKSIZE),
-       [Maximum size of a tape block in KBytes.])
-    AC_SUBST(MAXTAPEBLOCKSIZE)
 ])
 
 # SYNOPSIS
@@ -35,9 +27,6 @@ AC_DEFUN([AMANDA_WITH_MAXTAPEBLOCKSIZE], [
 #   If 'struct mtget' fields mt_flags, mt_fileno, mt_blkno, mt_dsreg, and 
 #   mt_erreg, the corresponding HAVE_MT_* is DEFINEd.
 #
-#   Not that most of the checks in this section correspond to the older
-#   tapeio (in tape-src/), rather than the new tape device.
-#
 AC_DEFUN([AMANDA_TAPE_DEVICE], [
     AC_CHECK_HEADERS( \
        linux/zftape.h \
index ff9e85245d8527dc428e66f42398139cf16437bb..a3ddea245ff3bc670439b7423cd13b4d5cf59873 100644 (file)
@@ -14,6 +14,9 @@ AC_DEFUN([AMANDA_CHECK_TYPE], [
     AC_CHECK_TYPE($1, [], [
        AC_DEFINE($1, $2, [Type for $1, if it is not defined by the system])
     ], ifelse($3, [], [], [
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
 #ifdef STDC_HEADERS
 #include <stdlib.h>
 #include <stddef.h>
index 8ef15c89dc7a69be40b4ac00c9f56325bffea1d7..c659395a51e9fb88516d918dee89fa93290e00c4 100644 (file)
@@ -28,8 +28,8 @@ AC_DEFUN([AMANDA_DISABLE_INSTALLPERMS],
 # OVERVIEW
 #
 #   Handle the --without-force-id option, which disables userid checks for
-#   all Amanda applications.  Defines CHECK_USERID *unless* this option is
-#   given.
+#   all Amanda applications.  Defines and substitutes CHECK_USERID *unless* 
+#   this option is given.
 #
 AC_DEFUN([AMANDA_WITH_FORCE_UID],
 [
@@ -41,14 +41,17 @@ AC_DEFUN([AMANDA_WITH_FORCE_UID],
     )
     case "$CHECK_USERID" in
         y | ye | yes) 
+           CHECK_USERID=1
             AC_DEFINE(CHECK_USERID, 1,
                 [Define to force to another user on client machines. ])
           ;;
         n | no) :
+           CHECK_USERID=
           ;;
         *)
             AC_MSG_ERROR([*** You must not supply an argument to --with-force-uid option.])
     esac
+    AC_SUBST(CHECK_USERID)
 ])
 
 # SYNOPSIS
index 245345bb18ae7f4a0a4c002c31c00f69332396cc..586eb018578e68a2aa5b59b2347c0ca14a3db992 100644 (file)
@@ -25,7 +25,7 @@
 # INSTALLPERMS_exec = \
 #      dest=$(sbindir) chown=amanda chmod= \
 #              foo bar \
-#      chmod=u+s,o-rwx \
+#      chmod=07450 \
 #              bing
 #      dest=$(libexecdir) chmod= \
 #              $(libexec_PROGRAMS)
 #
 # This whole operation is not required when making builds for packaging,
 # and can be disabled with --disable-installperms, via the WANT_INSTALLPERMS
-# AM_CONDITIONAL.
+# AM_CONDITIONAL.  When disabled, the file 'installperms.sh' in the top-level
+# build directory is populated with a format suitable for shell interpretation,
+# with lines like this:
+#   installperm "amanda:disk" "04750" "/usr/local/sbin/bing"
+# the arguments being, respectively, owner:group, mode, and filename.  There will
+# be exactly one line for each file which has specific permissions.  The intention
+# is that this file be used by packaging scripts to set correct permissions at install
+# time.  Note that files which have no special permissions requirements do not appear 
+# in this file at all, due to limitations of Automake.
 
 # sed expression to strip leading directories from a filename; this converts e.g.,
 # src/foo/bar.so to bar.so.
 strip_leading_dirs=s|^.*/||
 
+# define a snippet of the scripts below to either perform a chown/chmod operation,
+# or record that operation in the logfile.  On entry to the snippet, $$dest is the
+# destination directory, $$cmd is the srcdir-relative pathname of the target file,
+# $$chown is the ownership, and $$chmod is the permission pattern.
 if WANT_INSTALLPERMS
+do_file=pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
+    if test -n "$$chown"; then \
+       echo chown "$$chown" "$$pa"; \
+       chown "$$chown" "$$pa" || exit 1; \
+    fi; \
+    if test -n "$$chmod"; then \
+       echo chmod "$$chmod" "$$pa"; \
+       chmod "$$chmod" "$$pa" || exit 1; \
+    fi 
+else
+installperms_sh="$(top_builddir)/installperms.sh"
+do_file=pa="$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
+    echo "installperm \"$$chown\" \"$$chmod\" \"$$pa\"" >> "$(installperms_sh)"
+DISTCLEANFILES += $(installperms_sh)
+endif
+
 installperms-exec:
        @installperms="$(INSTALLPERMS_exec)"; \
        test -n "$$installperms" && echo "Setting installation permissions on executables"; \
@@ -52,21 +80,12 @@ installperms-exec:
                        echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
                dest=*|chown=*|chmod=*) \
                        echo "  ($$cmd)"; eval $$cmd;; \
-               *)  pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
-                   if test -n "$$chown"; then \
-                       echo chown "$$chown" "$$pa"; \
-                       chown "$$chown" "$$pa" || exit 1; \
-                   fi; \
-                   if test -n "$$chmod"; then \
-                       echo chmod "$$chmod" "$$pa"; \
-                       chmod "$$chmod" "$$pa" || exit 1; \
-                   fi; \
+               *) $(do_file) ;; \
            esac; \
        done
 
 installperms-data:
        @installperms="$(INSTALLPERMS_data)"; \
-       test -n "$$installperms" && echo "Setting installation permissions on data"; \
        dest=; chown=; chmod=; \
        for cmd in $$installperms; do \
            case "$$cmd" in \
@@ -74,18 +93,17 @@ installperms-data:
                        echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
                dest=*|chown=*|chmod=*) \
                        echo "  ($$cmd)"; eval $$cmd;; \
-               *)  pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
-                   if test -n "$$chown"; then \
-                       echo chown "$$chown" "$$pa"; \
-                       chown "$$chown" "$$pa" || exit 1; \
-                   fi; \
-                   if test -n "$$chmod"; then \
-                       echo chmod "$$chmod" "$$pa"; \
-                       chmod "$$chmod" "$$pa" || exit 1; \
-                   fi; \
+               *)  $(do_file) ;; \
            esac; \
        done
 
 install-exec-hook: installperms-exec
 install-data-hook: installperms-data
+
+# define a rule to initialize the installperms manifest file
+if WANT_INSTALLPERMS
+installperms-init:
+else
+installperms-init:
+       rm -f "$(installperms_sh)"
 endif
index 129df49e63ae81313c23f4f3e2ea9756f8aeff27..cb6d705b1df8cb11c1e72bcf137aaec478ad0c29 100644 (file)
@@ -1,5 +1,5 @@
 # vim:ft=automake
-# Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
 # 
 # This library is free software; you can redistribute it and/or modify it
 # under the terms of the GNU Lesser General Public License version 2.1 as 
@@ -14,8 +14,8 @@
 # along with this library; if not, write to the Free Software Foundation,
 # Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
 # 
-# Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
-# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 
 # SYNOPSIS:
 #
 # Files which support it are syntax-checked when the user invokes 'make check'.
 #
 # All *target* filenames must be listed in SCRIPTS_SHELL, SCRIPTS_PERL, and 
-# SCRIPTS_AWK to support 'make check', 'make dist', and 'make distclean'.
+# SCRIPTS_AWK to support 'make check', 'make dist', and 'make distclean'. No
+# files which are not substituted by config.status should be included in
+# SCRIPTS_PERL, SCRIPTS_SHELL, or SCRIPTS_AWK.  If non-generated files are listed
+# for installation, then Automake will figure out that they should be distributed;
+# otherwise, include them in EXTRA_DIST.
 #
 # USAGE:
 #
 #   SCRIPTS_PERL = fooscript barscript perl-lib.pl perlmod.pm
 #   SCRIPTS_SHELL = shell1 shell2 sh-lib.sh
 #   SCRIPTS_AWK = talk balk chalk awk-lib.awk
+#   sbin_SCRIPTS = not-subbed
+#   EXTRA_DIST = util-script.pl
 #
 # with the corresponding files in the repository:
 #
 #   fooscript.pl barscript.pl perl-lib.pl.in perlmod.pm.in
 #   shell1.sh shell2.sh sh-lib.sh.in
 #   talk.awk balk.awk chalk.awk awk-lib.awk.in
+#   not-subbed util-script.pl
 #
 # by default, all shell and perl scripts are syntax checked.  If this is
 # a problem (for example, perl scripts depending on Amanda extension 
 %: %.pl $(top_builddir)/config.status
        $(top_builddir)/config.status --file=$@:$<
        chmod a+x $@
+       @if test -f $(top_builddir)/perl/.libs/libCmdline.so -o -f $(top_builddir)/perl/libCmdline.so; then \
+               grep -v '^use lib' $@ > $@.nouselib; \
+               $(PERL) $(CHECK_PERL_FLAGS) -I$(top_builddir)/perl -I$(top_builddir)/perl/.libs -I$(top_srcdir)/perl -c -w -T $@.nouselib || exit 1; \
+               rm $@.nouselib; \
+       fi
 
 %.pl: %.pl.in $(top_builddir)/config.status
        $(top_builddir)/config.status --file=$@:$<
 CLEANFILES += config.log
 
 # and we'll need to clean up our generated files for distclean
-DISTCLEANFILES += $(SCRIPTS_SHELL) $(SCRIPTS_PERL) $(SCRIPTS_AWK)
+DISTCLEANFILES += $(SCRIPTS_SHELL) $(SCRIPTS_PERL) $(SCRIPTS_AWK) $(SCRIPTS_INCLUDE)
 
 # syntax-check perl scripts on 'make check'
 check-perl: $(CHECK_PERL)
+       @CHECK_PERL="$(CHECK_PERL)"; \
+       if test -f $(top_builddir)/perl/.libs/libCmdline.so -o -f $(top_builddir)/perl/libCmdline.so; then \
+               if test -n "$(PERL)"; then \
+                       for perlobj in $$CHECK_PERL; do \
+                               grep -v '^use lib' $$perlobj > $$perlobj.nouselib; \
+                               $(PERL) $(CHECK_PERL_FLAGS) -I$(top_builddir)/perl -I$(top_builddir)/perl/.libs -I$(top_srcdir)/perl -c -w -T $$perlobj.nouselib || exit 1; \
+                               rm $$perlobj.nouselib; \
+                       done; \
+               fi \
+       fi
+check-local: check-perl
+
+# syntax-check perl scripts on 'make installcheck'
+installcheck-perl: $(CHECK_PERL)
        @CHECK_PERL="$(CHECK_PERL)"; \
        if test -n "$(PERL)"; then \
                for perlobj in $$CHECK_PERL; do \
                        $(PERL) $(CHECK_PERL_FLAGS) -c -w -T $$perlobj || exit 1; \
                done; \
        fi
-check-local: check-perl
+installcheck-local: installcheck-perl
 
 # syntax-check shell scripts on 'make check'
 CHECK_SHELL = $(SCRIPTS_SHELL)
index 88aa8a84e6afe93192b794ad30e1bab669964451..a6310e922cd23449791b4659a047157ce1e5e516 100644 (file)
@@ -1,5 +1,5 @@
 # vim:ft=automake
-# Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
 # 
 # This library is free software; you can redistribute it and/or modify it
 # under the terms of the GNU Lesser General Public License version 2.1 as 
@@ -14,8 +14,8 @@
 # along with this library; if not, write to the Free Software Foundation,
 # Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
 # 
-# Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
-# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 
 # simple include file to pre-define variables which are then +='d by other
 # scripts in this directory.
index 5c2d00400c8f3a0e4d4fe8ba3f35330129cedf7f..172cfbd385ecaf300701a3093b1902f18a650b73 100644 (file)
@@ -1,5 +1,8 @@
 /* config/config.h.in.  Generated from configure.in by autoheader.  */
 
+/* Define if building universal (internal helper macro) */
+#undef AC_APPLE_UNIVERSAL_BUILD
+
 /* Is DUMP the AIX program 'backup'? */
 #undef AIX_BACKUP
 
@@ -15,6 +18,9 @@
 /* The directory in which Amanda should create temporary files. */
 #undef AMANDA_TMPDIR
 
+/* Directory in which dumper interfaces should be installed and searched. */
+#undef APPLICATION_DIR
+
 /* Define if you want assertion checking. */
 #undef ASSERTIONS
 
 /* This is the default Amanda configuration. */
 #undef DEFAULT_CONFIG
 
+/* A program that understands -s "subject" user < message_file */
+#undef DEFAULT_MAILER
+
 /* This is the default Amanda index server. */
 #undef DEFAULT_SERVER
 
 /* Define the location of the ufsdump, backup, or dump program. */
 #undef DUMP
 
-/* Directory in which dumper interfaces should be installed and searched. */
-#undef DUMPER_DIR
-
 /* Define if dumper should buffer the sockets for faster throughput. */
 #undef DUMPER_SOCKET_BUFFERING
 
    */
 #undef HAVE_ALLOCA_H
 
+/* Define to 1 if you have the "amanda.h" header file. */
+#undef HAVE_AMANDA_H
+
 /* Define to 1 if you have the <arpa/inet.h> header file. */
 #undef HAVE_ARPA_INET_H
 
    don't. */
 #undef HAVE_DECL_GETADDRINFO
 
+/* Define to 1 if you have the declaration of `getenv', and to 0 if you don't.
+   */
+#undef HAVE_DECL_GETENV
+
 /* Define to 1 if you have the declaration of `getnameinfo', and to 0 if you
    don't. */
 #undef HAVE_DECL_GETNAMEINFO
 /* Define if fwrite is declared. */
 #undef HAVE_FWRITE_DECL
 
-/* Define to 1 if you have the `getaddrinfo' function. */
-#undef HAVE_GETADDRINFO
-
 /* Define to 1 if you have the `getgrgid_r' function. */
 #undef HAVE_GETGRGID_R
 
 /* Define if getopt is declared. */
 #undef HAVE_GETOPT_DECL
 
+/* Define to 1 if you have the <getopt.h> header file. */
+#undef HAVE_GETOPT_H
+
+/* Define to 1 if you have the `getopt_long_only' function. */
+#undef HAVE_GETOPT_LONG_ONLY
+
 /* Define to 1 if you have the `getpagesize' function. */
 #undef HAVE_GETPAGESIZE
 
 /* Define if listen is declared. */
 #undef HAVE_LISTEN_DECL
 
-/* Define if you have the 'long long' type. */
-#undef HAVE_LONG_LONG
-
 /* Define to 1 if the system has the type `long long int'. */
 #undef HAVE_LONG_LONG_INT
 
 /* Define if the POSIX multithreading library has read/write locks. */
 #undef HAVE_PTHREAD_RWLOCK
 
-/* Define to 1 if the system has the type `ptrdiff_t'. */
-#undef HAVE_PTRDIFF_T
-
 /* Define to 1 if you have the `putenv' function. */
 #undef HAVE_PUTENV
 
 /* Define if recvfrom is declared. */
 #undef HAVE_RECVFROM_DECL
 
+/* Define to 1 if you have the <regex.h> header file. */
+#undef HAVE_REGEX_H
+
 /* Define to 1 if you have the `remove' function. */
 #undef HAVE_REMOVE
 
 /* Define if shmget is declared. */
 #undef HAVE_SHMGET_DECL
 
-/* Define to 1 if you have the `shquote' function. */
-#undef HAVE_SHQUOTE
-
 /* Define to 1 if you have the `sigaction' function. */
 #undef HAVE_SIGACTION
 
 /* Define if snprintf is declared. */
 #undef HAVE_SNPRINTF_DECL
 
-/* if struct sockaddr_storage exists */
+/* struct sockaddr_storage exists */
 #undef HAVE_SOCKADDR_STORAGE
 
 /* Define to 1 if you have the `socket' function. */
 /* Define if time is declared. */
 #undef HAVE_TIME_DECL
 
+/* Define to 1 if you have the <time.h> header file. */
+#undef HAVE_TIME_H
+
 /* Define to 1 if you have the `tolower' function. */
 #undef HAVE_TOLOWER
 
 /* Define to 1 if the system has the type `unsigned long long int'. */
 #undef HAVE_UNSIGNED_LONG_LONG_INT
 
+/* Define to 1 if you have the "util.h" header file. */
+#undef HAVE_UTIL_H
+
 /* Define to 1 if you have the `vasnprintf' function. */
 #undef HAVE_VASNPRINTF
 
 /* LPRCMD switch for specifying a printer name. */
 #undef LPRFLAG
 
-/* A program that understands -s "subject" user < message_file */
-#undef MAILER
-
-/* Maximum size of a tape block in KBytes. */
-#undef MAX_TAPE_BLOCK_KB
-
 /* The switch to be used when invoking mt to specify the * tape device. */
 #undef MT_FILE_FLAG
 
 /* Define for backups being done on a multiple networks and FQDNs are used. */
 #undef USE_FQDN
 
+/* Define to 1 if files will be processed with gettextize */
+#undef USE_GETTEXT
+
 /* Define if the POSIX multithreading library can be used. */
 #undef USE_POSIX_THREADS
 
 /* Define to use POSIX (fcntl()) for file locking */
 #undef WANT_AMFLOCK_POSIX
 
-/* Compile Amazon DevPay support */
-#undef WANT_DEVPAY
-
 /* Compile Amazon S3 driver */
 #undef WANT_S3_DEVICE
 
    'wint_t'. */
 #undef WINT_T_SUFFIX
 
-/* Define to 1 if your processor stores words with the most significant byte
-   first (like Motorola and SPARC, unlike Intel and VAX). */
-#undef WORDS_BIGENDIAN
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+   significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+#  define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+#  undef WORDS_BIGENDIAN
+# endif
+#endif
 
 /* Target system has functional IPv6 support */
 #undef WORKING_IPV6
 /* Number of bits in a file offset, on hosts where this is settable. */
 #undef _FILE_OFFSET_BITS
 
-/* Enable GNU extensions on systems that have them.  */
-#ifndef _GNU_SOURCE
-# undef _GNU_SOURCE
-#endif
-
 /* Define for large files, on AIX-style hosts. */
 #undef _LARGE_FILES
 
 #endif
 
 
+/* Define to rpl_ if the getopt replacement functions and variables should be
+   used. */
+#undef __GETOPT_PREFIX
+
+/* Directory in which amanda's templates and examples are installed. */
+#undef amdatadir
+
 /* Directory in which Amanda header files should be installed */
 #undef amincludedir
 
 /* Define to `int' if <sys/types.h> does not define. */
 #undef pid_t
 
-/* Define to equivalent of C99 restrict keyword, or to nothing if this is not
-   supported. Do not define if restrict is supported directly. */
+/* Define as the type of the result of subtracting two pointers, if the system
+   doesn't define it. */
+#undef ptrdiff_t
+
+/* Define to the equivalent of the C99 'restrict' keyword, or to
+   nothing if this is not supported.  Do not define if restrict is
+   supported directly.  */
 #undef restrict
+/* Work around a bug in Sun C++: it does not support _Restrict, even
+   though the corresponding Sun C compiler does, which causes
+   "#define restrict _Restrict" in the previous line.  Perhaps some future
+   version of Sun C++ will work with _Restrict; if so, it'll probably
+   define __RESTRICT, just as Sun C does.  */
+#if defined __SUNPRO_CC && !defined __RESTRICT
+# define _Restrict
+#endif
 
 /* Type for sa_family_t, if it is not defined by the system */
 #undef sa_family_t
index c547c68825fa9b588b67046e9982e721d70aea8e..35f959b87cfdc49df9e28460713cee6c2df4e07b 100644 (file)
@@ -2,7 +2,7 @@
 # Output a system dependent set of variables, describing how to set the
 # run time search path of shared libraries in an executable.
 #
-#   Copyright 1996-2007 Free Software Foundation, Inc.
+#   Copyright 1996-2008 Free Software Foundation, Inc.
 #   Taken from GNU libtool, 2001
 #   Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
 #
@@ -158,7 +158,7 @@ if test "$with_gnu_ld" = yes; then
   # option of GNU ld is called -rpath, not --rpath.
   hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
   case "$host_os" in
-    aix3* | aix4* | aix5*)
+    aix[3-9]*)
       # On AIX/PPC, the GNU linker is very broken
       if test "$host_cpu" != ia64; then
         ld_shlibs=no
@@ -254,7 +254,7 @@ else
         hardcode_direct=unsupported
       fi
       ;;
-    aix4* | aix5*)
+    aix[4-9]*)
       if test "$host_cpu" = ia64; then
         # On IA64, the linker does run time linking by default, so we don't
         # have to do anything special.
@@ -264,7 +264,7 @@ else
         # Test if we are trying to use run time linking or normal
         # AIX style linking. If -brtl is somewhere in LDFLAGS, we
         # need to do runtime linking.
-        case $host_os in aix4.[23]|aix4.[23].*|aix5*)
+        case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
           for ld_flag in $LDFLAGS; do
             if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
               aix_use_runtimelinking=yes
@@ -505,7 +505,7 @@ case "$host_os" in
   aix3*)
     library_names_spec='$libname.a'
     ;;
-  aix4* | aix5*)
+  aix[4-9]*)
     library_names_spec='$libname$shrext'
     ;;
   amigaos*)
index eb62e0e7a52f16787cd5ac5084def332d5874aed..95f54a6d48c08452ba0f2eaef811c72ce2748825 100644 (file)
@@ -1,5 +1,5 @@
-# alloca.m4 serial 7
-dnl Copyright (C) 2002-2004, 2006 Free Software Foundation, Inc.
+# alloca.m4 serial 8
+dnl Copyright (C) 2002-2004, 2006, 2007 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -39,10 +39,6 @@ AC_DEFUN([gl_FUNC_ALLOCA],
     ALLOCA_H=alloca.h
   fi
   AC_SUBST([ALLOCA_H])
-
-  AC_DEFINE(HAVE_ALLOCA_H, 1,
-    [Define HAVE_ALLOCA_H for backward compatibility with older code
-     that includes <alloca.h> only if HAVE_ALLOCA_H is defined.])
 ])
 
 # Prerequisites of lib/alloca.c.
index f2c14fcefa40f035158ebf21432335b05b05ab66..0029f2e44837c7befc50489cf92e2621d9f067e4 100644 (file)
@@ -8,6 +8,7 @@ EXTRA_DIST += gnulib/extensions.m4
 EXTRA_DIST += gnulib/float_h.m4
 EXTRA_DIST += gnulib/fsusage.m4
 EXTRA_DIST += gnulib/getaddrinfo.m4
+EXTRA_DIST += gnulib/getopt.m4
 EXTRA_DIST += gnulib/gettimeofday.m4
 EXTRA_DIST += gnulib/gnulib-cache.m4
 EXTRA_DIST += gnulib/gnulib-common.m4
@@ -45,7 +46,6 @@ EXTRA_DIST += gnulib/sys_socket_h.m4
 EXTRA_DIST += gnulib/sys_stat_h.m4
 EXTRA_DIST += gnulib/sys_time_h.m4
 EXTRA_DIST += gnulib/tempname.m4
-EXTRA_DIST += gnulib/ulonglong.m4
 EXTRA_DIST += gnulib/unistd_h.m4
 EXTRA_DIST += gnulib/vasnprintf.m4
 EXTRA_DIST += gnulib/visibility.m4
index 1b1ad103e984483e9d742a65c68fff39671f7d32..d36e3a46caef916dfd5d0c4dd26182d70850b3ae 100644 (file)
@@ -1,4 +1,4 @@
-# float_h.m4 serial 2
+# float_h.m4 serial 3
 dnl Copyright (C) 2007 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -10,7 +10,7 @@ AC_DEFUN([gl_FLOAT_H],
   AC_REQUIRE([AC_CANONICAL_HOST])
   FLOAT_H=
   case "$host_os" in
-    beos*)
+    beos* | openbsd*)
       FLOAT_H=float.h
       gl_CHECK_NEXT_HEADERS([float.h])
       ;;
index 7be1e490ae68f96f83577a745404abce79a1b408..5d36c195053839d83b298f8220b5210289ed5f68 100644 (file)
@@ -1,4 +1,4 @@
-# getaddrinfo.m4 serial 13
+# getaddrinfo.m4 serial 15
 dnl Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -9,8 +9,23 @@ AC_DEFUN([gl_GETADDRINFO],
   AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl for HAVE_SYS_SOCKET_H, HAVE_WINSOCK2_H
   AC_MSG_NOTICE([checking how to do getaddrinfo, freeaddrinfo and getnameinfo])
 
+  AC_CHECK_HEADERS_ONCE(netdb.h)
+
   AC_SEARCH_LIBS(getaddrinfo, [nsl socket])
-  AC_CHECK_FUNCS(getaddrinfo,, [
+  AC_CACHE_CHECK([for getaddrinfo], [gl_cv_func_getaddrinfo], [
+    AC_TRY_LINK([
+#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#include <stddef.h>
+], [getaddrinfo("", "", NULL, NULL);],
+      [gl_cv_func_getaddrinfo=yes],
+      [gl_cv_func_getaddrinfo=no])])
+  if test $gl_cv_func_getaddrinfo = no; then
     AC_CACHE_CHECK(for getaddrinfo in ws2tcpip.h and -lws2_32,
                   gl_cv_w32_getaddrinfo, [
       gl_cv_w32_getaddrinfo=no
@@ -20,19 +35,19 @@ AC_DEFUN([gl_GETADDRINFO],
 #ifdef HAVE_WS2TCPIP_H
 #include <ws2tcpip.h>
 #endif
-], [getaddrinfo(0, 0, 0, 0);], gl_cv_w32_getaddrinfo=yes)
+#include <stddef.h>
+], [getaddrinfo(NULL, NULL, NULL, NULL);], gl_cv_w32_getaddrinfo=yes)
     LIBS="$am_save_LIBS"])
     if test "$gl_cv_w32_getaddrinfo" = "yes"; then
       LIBS="$LIBS -lws2_32"
     else
       AC_LIBOBJ(getaddrinfo)
     fi
-    ])
+  fi
 
   # We can't use AC_REPLACE_FUNCS here because gai_strerror may be an
   # inline function declared in ws2tcpip.h, so we need to get that
   # header included somehow.
-  AC_CHECK_HEADERS_ONCE(netdb.h)
   AC_CACHE_CHECK([for gai_strerror (possibly via ws2tcpip.h)],
     gl_cv_func_gai_strerror, [
       AC_TRY_LINK([
@@ -46,7 +61,8 @@ AC_DEFUN([gl_GETADDRINFO],
 #ifdef HAVE_WS2TCPIP_H
 #include <ws2tcpip.h>
 #endif
-], [gai_strerror (0);],
+#include <stddef.h>
+], [gai_strerror (NULL);],
         [gl_cv_func_gai_strerror=yes],
         [gl_cv_func_gai_strerror=no])])
   if test $gl_cv_func_gai_strerror = no; then
@@ -71,7 +87,8 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [
 #ifdef HAVE_WINSOCK2_H
 #include <winsock2.h>
 #endif
-], [gethostbyname(0);], gl_cv_w32_gethostbyname=yes)
+#include <stddef.h>
+], [gethostbyname(NULL);], gl_cv_w32_gethostbyname=yes)
     LIBS="$am_save_LIBS"])
     if test "$gl_cv_w32_gethostbyname" = "yes"; then
       LIBS="$LIBS -lws2_32"
diff --git a/config/gnulib/getopt.m4 b/config/gnulib/getopt.m4
new file mode 100644 (file)
index 0000000..c0a73b2
--- /dev/null
@@ -0,0 +1,83 @@
+# getopt.m4 serial 13
+dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+# The getopt module assume you want GNU getopt, with getopt_long etc,
+# rather than vanilla POSIX getopt.  This means your code should
+# always include <getopt.h> for the getopt prototypes.
+
+AC_DEFUN([gl_GETOPT_SUBSTITUTE],
+[
+  AC_LIBOBJ([getopt])
+  AC_LIBOBJ([getopt1])
+  gl_GETOPT_SUBSTITUTE_HEADER
+  gl_PREREQ_GETOPT
+])
+
+AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER],
+[
+  GETOPT_H=getopt.h
+  AC_DEFINE([__GETOPT_PREFIX], [[rpl_]],
+    [Define to rpl_ if the getopt replacement functions and variables
+     should be used.])
+  AC_SUBST([GETOPT_H])
+])
+
+AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
+[
+  if test -z "$GETOPT_H"; then
+    AC_CHECK_HEADERS([getopt.h], [], [GETOPT_H=getopt.h])
+  fi
+
+  if test -z "$GETOPT_H"; then
+    AC_CHECK_FUNCS([getopt_long_only], [], [GETOPT_H=getopt.h])
+  fi
+
+  dnl BSD getopt_long uses an incompatible method to reset option processing,
+  dnl and (as of 2004-10-15) mishandles optional option-arguments.
+  if test -z "$GETOPT_H"; then
+    AC_CHECK_DECL([optreset], [GETOPT_H=getopt.h], [], [#include <getopt.h>])
+  fi
+
+  dnl Solaris 10 getopt doesn't handle `+' as a leading character in an
+  dnl option string (as of 2005-05-05).
+  if test -z "$GETOPT_H"; then
+    AC_CACHE_CHECK([for working GNU getopt function], [gl_cv_func_gnu_getopt],
+      [AC_RUN_IFELSE(
+       [AC_LANG_PROGRAM([#include <getopt.h>],
+          [[
+            char *myargv[3];
+            myargv[0] = "conftest";
+            myargv[1] = "-+";
+            myargv[2] = 0;
+            return getopt (2, myargv, "+a") != '?';
+          ]])],
+       [gl_cv_func_gnu_getopt=yes],
+       [gl_cv_func_gnu_getopt=no],
+       [dnl cross compiling - pessimistically guess based on decls
+        dnl Solaris 10 getopt doesn't handle `+' as a leading character in an
+        dnl option string (as of 2005-05-05).
+        AC_CHECK_DECL([getopt_clip],
+          [gl_cv_func_gnu_getopt=no], [gl_cv_func_gnu_getopt=yes],
+          [#include <getopt.h>])])])
+    if test "$gl_cv_func_gnu_getopt" = "no"; then
+      GETOPT_H=getopt.h
+    fi
+  fi
+])
+
+AC_DEFUN([gl_GETOPT_IFELSE],
+[
+  AC_REQUIRE([gl_GETOPT_CHECK_HEADERS])
+  AS_IF([test -n "$GETOPT_H"], [$1], [$2])
+])
+
+AC_DEFUN([gl_GETOPT], [gl_GETOPT_IFELSE([gl_GETOPT_SUBSTITUTE])])
+
+# Prerequisites of lib/getopt*.
+AC_DEFUN([gl_PREREQ_GETOPT],
+[
+  AC_CHECK_DECLS_ONCE([getenv])
+])
index f1b01f7fb3c4438d5cdfa1cabc66ef09c21f3a72..b1a4c82cc590fb2239bbffd7d240233b82a5af5f 100644 (file)
 
 
 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib --m4-base=config/gnulib --doc-base=doc --aux-dir=config --libtool --macro-prefix=gl base64 fsusage getaddrinfo lock mkdtemp physmem visibility
+#   gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib --m4-base=config/gnulib --doc-base=doc --aux-dir=config --libtool --macro-prefix=gl base64 fsusage full-read full-write getaddrinfo getopt lock mkdtemp physmem visibility
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([])
-gl_MODULES([base64 fsusage getaddrinfo lock mkdtemp physmem visibility])
+gl_MODULES([base64 fsusage full-read full-write getaddrinfo getopt lock mkdtemp physmem visibility])
 gl_AVOID([])
 gl_SOURCE_BASE([gnulib])
 gl_M4_BASE([config/gnulib])
index 539801080da2ce91b8b13e5643d7c0c3fd494db3..9336d726055452aa81a4e2ceee265ce08a0deffb 100644 (file)
@@ -1,4 +1,4 @@
-# gnulib-common.m4 serial 2
+# gnulib-common.m4 serial 3
 dnl Copyright (C) 2007 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -20,3 +20,46 @@ m4_ifdef([AC_PROG_MKDIR_P], [], [
     [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
      MKDIR_P='$(mkdir_p)'
      AC_SUBST([MKDIR_P])])])
+
+# AC_C_RESTRICT
+# This definition overrides the AC_C_RESTRICT macro from autoconf 2.60..2.61,
+# so that mixed use of GNU C and GNU C++ and mixed use of Sun C and Sun C++
+# works.
+# This definition can be removed once autoconf >= 2.62 can be assumed.
+AC_DEFUN([AC_C_RESTRICT],
+[AC_CACHE_CHECK([for C/C++ restrict keyword], ac_cv_c_restrict,
+  [ac_cv_c_restrict=no
+   # The order here caters to the fact that C++ does not require restrict.
+   for ac_kw in __restrict __restrict__ _Restrict restrict; do
+     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+      [[typedef int * int_ptr;
+       int foo (int_ptr $ac_kw ip) {
+       return ip[0];
+       }]],
+      [[int s[1];
+       int * $ac_kw t = s;
+       t[0] = 0;
+       return foo(t)]])],
+      [ac_cv_c_restrict=$ac_kw])
+     test "$ac_cv_c_restrict" != no && break
+   done
+  ])
+ AH_VERBATIM([restrict],
+[/* Define to the equivalent of the C99 'restrict' keyword, or to
+   nothing if this is not supported.  Do not define if restrict is
+   supported directly.  */
+#undef restrict
+/* Work around a bug in Sun C++: it does not support _Restrict, even
+   though the corresponding Sun C compiler does, which causes
+   "#define restrict _Restrict" in the previous line.  Perhaps some future
+   version of Sun C++ will work with _Restrict; if so, it'll probably
+   define __RESTRICT, just as Sun C does.  */
+#if defined __SUNPRO_CC && !defined __RESTRICT
+# define _Restrict
+#endif])
+ case $ac_cv_c_restrict in
+   restrict) ;;
+   no) AC_DEFINE([restrict], []) ;;
+   *)  AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;;
+ esac
+])
index 3c363607ad367cc6e78c874183217013a949adbc..d0858c3842602fb76b08447b5f81e57bb88365d3 100644 (file)
@@ -34,11 +34,11 @@ AC_DEFUN([gl_EARLY],
 # "Check for header files, types and library functions".
 AC_DEFUN([gl_INIT],
 [
+  AM_CONDITIONAL([GL_COND_LIBTOOL], [true])
+  gl_cond_libtool=true
   m4_pushdef([AC_LIBOBJ], m4_defn([gl_LIBOBJ]))
   m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gl_REPLACE_FUNCS]))
   m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES]))
-  AM_CONDITIONAL([GL_COND_LIBTOOL], [true])
-  gl_cond_libtool=true
   gl_source_base='gnulib'
   gl_FUNC_ALLOCA
   gl_HEADER_ARPA_INET
@@ -47,6 +47,7 @@ AC_DEFUN([gl_INIT],
   gl_FLOAT_H
   gl_FSUSAGE
   gl_GETADDRINFO
+  gl_GETOPT
   AC_SUBST([LIBINTL])
   AC_SUBST([LTLIBINTL])
   gl_FUNC_GETTIMEOFDAY
@@ -102,34 +103,112 @@ AC_DEFUN([gl_INIT],
     AC_SUBST([gl_LIBOBJS], [$gl_libobjs])
     AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs])
   ])
+  gltests_libdeps=
+  gltests_ltlibdeps=
+  m4_pushdef([AC_LIBOBJ], m4_defn([gltests_LIBOBJ]))
+  m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gltests_REPLACE_FUNCS]))
+  m4_pushdef([AC_LIBSOURCES], m4_defn([gltests_LIBSOURCES]))
+  gl_source_base='tests'
+  m4_popdef([AC_LIBSOURCES])
+  m4_popdef([AC_REPLACE_FUNCS])
+  m4_popdef([AC_LIBOBJ])
+  AC_CONFIG_COMMANDS_PRE([
+    gltests_libobjs=
+    gltests_ltlibobjs=
+    if test -n "$gltests_LIBOBJS"; then
+      # Remove the extension.
+      sed_drop_objext='s/\.o$//;s/\.obj$//'
+      for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do
+        gltests_libobjs="$gltests_libobjs $i.$ac_objext"
+        gltests_ltlibobjs="$gltests_ltlibobjs $i.lo"
+      done
+    fi
+    AC_SUBST([gltests_LIBOBJS], [$gltests_libobjs])
+    AC_SUBST([gltests_LTLIBOBJS], [$gltests_ltlibobjs])
+  ])
 ])
 
 # Like AC_LIBOBJ, except that the module name goes
 # into gl_LIBOBJS instead of into LIBOBJS.
-AC_DEFUN([gl_LIBOBJ],
-  [gl_LIBOBJS="$gl_LIBOBJS $1.$ac_objext"])
+AC_DEFUN([gl_LIBOBJ], [
+  AS_LITERAL_IF([$1], [gl_LIBSOURCES([$1.c])])dnl
+  gl_LIBOBJS="$gl_LIBOBJS $1.$ac_objext"
+])
+
+# m4_foreach_w is provided by autoconf-2.59c and later.
+# This definition is to accommodate developers using versions
+# of autoconf older than that.
+m4_ifndef([m4_foreach_w],
+  [m4_define([m4_foreach_w],
+    [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])])
 
 # Like AC_REPLACE_FUNCS, except that the module name goes
 # into gl_LIBOBJS instead of into LIBOBJS.
-AC_DEFUN([gl_REPLACE_FUNCS],
-  [AC_CHECK_FUNCS([$1], , [gl_LIBOBJ($ac_func)])])
+AC_DEFUN([gl_REPLACE_FUNCS], [
+  m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl
+  AC_CHECK_FUNCS([$1], , [gl_LIBOBJ($ac_func)])
+])
+
+# Like AC_LIBSOURCES, except the directory where the source file is
+# expected is derived from the gnulib-tool parametrization,
+# and alloca is special cased (for the alloca-opt module).
+# We could also entirely rely on EXTRA_lib..._SOURCES.
+AC_DEFUN([gl_LIBSOURCES], [
+  m4_foreach([_gl_NAME], [$1], [
+    m4_if(_gl_NAME, [alloca.c], [], [
+      m4_syscmd([test -r gnulib/]_gl_NAME[ || test ! -d gnulib])dnl
+      m4_if(m4_sysval, [0], [],
+        [AC_FATAL([missing gnulib/]_gl_NAME)])
+    ])
+  ])
+])
+
+# Like AC_LIBOBJ, except that the module name goes
+# into gltests_LIBOBJS instead of into LIBOBJS.
+AC_DEFUN([gltests_LIBOBJ], [
+  AS_LITERAL_IF([$1], [gltests_LIBSOURCES([$1.c])])dnl
+  gltests_LIBOBJS="$gltests_LIBOBJS $1.$ac_objext"
+])
+
+# m4_foreach_w is provided by autoconf-2.59c and later.
+# This definition is to accommodate developers using versions
+# of autoconf older than that.
+m4_ifndef([m4_foreach_w],
+  [m4_define([m4_foreach_w],
+    [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])])
 
-# Like AC_LIBSOURCES, except that it does nothing.
-# We rely on EXTRA_lib..._SOURCES instead.
-AC_DEFUN([gl_LIBSOURCES],
-  [])
+# Like AC_REPLACE_FUNCS, except that the module name goes
+# into gltests_LIBOBJS instead of into LIBOBJS.
+AC_DEFUN([gltests_REPLACE_FUNCS], [
+  m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl
+  AC_CHECK_FUNCS([$1], , [gltests_LIBOBJ($ac_func)])
+])
+
+# Like AC_LIBSOURCES, except the directory where the source file is
+# expected is derived from the gnulib-tool parametrization,
+# and alloca is special cased (for the alloca-opt module).
+# We could also entirely rely on EXTRA_lib..._SOURCES.
+AC_DEFUN([gltests_LIBSOURCES], [
+  m4_foreach([_gl_NAME], [$1], [
+    m4_if(_gl_NAME, [alloca.c], [], [
+      m4_syscmd([test -r tests/]_gl_NAME[ || test ! -d tests])dnl
+      m4_if(m4_sysval, [0], [],
+        [AC_FATAL([missing tests/]_gl_NAME)])
+    ])
+  ])
+])
 
 # This macro records the list of files which have been installed by
 # gnulib-tool and may be removed by future gnulib-tool invocations.
 AC_DEFUN([gl_FILE_LIST], [
   build-aux/config.rpath
   build-aux/link-warning.h
-  lib/alloca_.h
+  lib/alloca.in.h
   lib/asnprintf.c
   lib/base64.c
   lib/base64.h
   lib/float+.h
-  lib/float_.h
+  lib/float.in.h
   lib/fsusage.c
   lib/fsusage.h
   lib/full-read.c
@@ -139,6 +218,10 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/gai_strerror.c
   lib/getaddrinfo.c
   lib/getaddrinfo.h
+  lib/getopt.c
+  lib/getopt.in.h
+  lib/getopt1.c
+  lib/getopt_int.h
   lib/gettext.h
   lib/gettimeofday.c
   lib/inet_ntop.c
@@ -147,7 +230,7 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/lock.h
   lib/malloc.c
   lib/mkdtemp.c
-  lib/netinet_in_.h
+  lib/netinet_in.in.h
   lib/physmem.c
   lib/physmem.h
   lib/printf-args.c
@@ -160,21 +243,21 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/safe-write.h
   lib/size_max.h
   lib/snprintf.c
-  lib/stdbool_.h
-  lib/stdint_.h
-  lib/stdio_.h
-  lib/stdlib_.h
+  lib/stdbool.in.h
+  lib/stdint.in.h
+  lib/stdio.in.h
+  lib/stdlib.in.h
   lib/strdup.c
-  lib/string_.h
-  lib/sys_socket_.h
-  lib/sys_stat_.h
-  lib/sys_time_.h
+  lib/string.in.h
+  lib/sys_socket.in.h
+  lib/sys_stat.in.h
+  lib/sys_time.in.h
   lib/tempname.c
   lib/tempname.h
-  lib/unistd_.h
+  lib/unistd.in.h
   lib/vasnprintf.c
   lib/vasnprintf.h
-  lib/wchar_.h
+  lib/wchar.in.h
   lib/xsize.h
   m4/absolute-header.m4
   m4/alloca.m4
@@ -185,6 +268,7 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/float_h.m4
   m4/fsusage.m4
   m4/getaddrinfo.m4
+  m4/getopt.m4
   m4/gettimeofday.m4
   m4/gnulib-common.m4
   m4/include_next.m4
@@ -219,7 +303,6 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/sys_stat_h.m4
   m4/sys_time_h.m4
   m4/tempname.m4
-  m4/ulonglong.m4
   m4/unistd_h.m4
   m4/vasnprintf.m4
   m4/visibility.m4
index 17c7b0ae88a62f31cee7862d6fa97ea623f8279d..50ae35d223798bd24f5d664445dcec8719067ec4 100644 (file)
@@ -1,5 +1,5 @@
-# intmax_t.m4 serial 5
-dnl Copyright (C) 1997-2004, 2006 Free Software Foundation, Inc.
+# intmax_t.m4 serial 6
+dnl Copyright (C) 1997-2004, 2006-2007 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -18,8 +18,8 @@ AC_DEFUN([gl_AC_TYPE_INTMAX_T],
   AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
   AC_REQUIRE([gl_AC_HEADER_STDINT_H])
   if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then
-    AC_REQUIRE([gl_AC_TYPE_LONG_LONG])
-    test $ac_cv_type_long_long = yes \
+    AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
+    test $ac_cv_type_long_long_int = yes \
       && ac_type='long long' \
       || ac_type='long'
     AC_DEFINE_UNQUOTED(intmax_t, $ac_type,
@@ -51,8 +51,8 @@ AC_DEFUN([gt_AC_TYPE_INTMAX_T],
     AC_DEFINE(HAVE_INTMAX_T, 1,
       [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
   else
-    AC_REQUIRE([gl_AC_TYPE_LONG_LONG])
-    test $ac_cv_type_long_long = yes \
+    AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
+    test $ac_cv_type_long_long_int = yes \
       && ac_type='long long' \
       || ac_type='long'
     AC_DEFINE_UNQUOTED(intmax_t, $ac_type,
index f157d983da749743b27129a4f6b3af16d5c97857..e3d26fc42dc0687fb3000d67df040d7fa64df1a5 100644 (file)
@@ -1,4 +1,4 @@
-# lib-link.m4 serial 13 (gettext-0.16.2)
+# lib-link.m4 serial 13 (gettext-0.17)
 dnl Copyright (C) 2001-2007 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
index 4cc585ea2e7776c06afd41761afaacaad040cc93..91119335356e33ab293f852fa730ec925a30f258 100644 (file)
@@ -1,4 +1,4 @@
-# lock.m4 serial 7 (gettext-0.16.2)
+# lock.m4 serial 7 (gettext-0.17)
 dnl Copyright (C) 2005-2007 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
index 1f9e862ef118356817bef76ebe41466c0699000e..15bf9dacadb85b8802381eafddeb9fc6556c067d 100644 (file)
@@ -1,5 +1,5 @@
-# longlong.m4 serial 10
-dnl Copyright (C) 1999-2006 Free Software Foundation, Inc.
+# longlong.m4 serial 13
+dnl Copyright (C) 1999-2007 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -7,8 +7,8 @@ dnl with or without modifications, as long as this notice is preserved.
 dnl From Paul Eggert.
 
 # Define HAVE_LONG_LONG_INT if 'long long int' works.
-# This fixes a bug in Autoconf 2.60, but can be removed once we
-# assume 2.61 everywhere.
+# This fixes a bug in Autoconf 2.61, but can be removed once we
+# assume 2.62 everywhere.
 
 # Note: If the type 'long long int' exists but is only 32 bits large
 # (as on some very old compilers), HAVE_LONG_LONG_INT will not be
@@ -18,20 +18,11 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT],
 [
   AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int],
     [AC_LINK_IFELSE(
-       [AC_LANG_PROGRAM(
-         [[long long int ll = 9223372036854775807ll;
-           long long int nll = -9223372036854775807LL;
-           typedef int a[((-9223372036854775807LL < 0
-                           && 0 < 9223372036854775807ll)
-                          ? 1 : -1)];
-           int i = 63;]],
-         [[long long int llmax = 9223372036854775807ll;
-           return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
-                   | (llmax / ll) | (llmax % ll));]])],
+       [_AC_TYPE_LONG_LONG_SNIPPET],
        [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004.
        dnl If cross compiling, assume the bug isn't important, since
        dnl nobody cross compiles for this platform as far as we know.
-        AC_RUN_IFELSE(
+       AC_RUN_IFELSE(
          [AC_LANG_PROGRAM(
             [[@%:@include <limits.h>
               @%:@ifndef LLONG_MAX
@@ -60,13 +51,56 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT],
   fi
 ])
 
-# This macro is obsolescent and should go away soon.
-AC_DEFUN([gl_AC_TYPE_LONG_LONG],
+# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works.
+# This fixes a bug in Autoconf 2.61, but can be removed once we
+# assume 2.62 everywhere.
+
+# Note: If the type 'unsigned long long int' exists but is only 32 bits
+# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT
+# will not be defined. In this case you can treat 'unsigned long long int'
+# like 'unsigned long int'.
+
+AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
 [
-  AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
-  ac_cv_type_long_long=$ac_cv_type_long_long_int
-  if test $ac_cv_type_long_long = yes; then
-    AC_DEFINE(HAVE_LONG_LONG, 1,
-      [Define if you have the 'long long' type.])
+  AC_CACHE_CHECK([for unsigned long long int],
+    [ac_cv_type_unsigned_long_long_int],
+    [AC_LINK_IFELSE(
+       [_AC_TYPE_LONG_LONG_SNIPPET],
+       [ac_cv_type_unsigned_long_long_int=yes],
+       [ac_cv_type_unsigned_long_long_int=no])])
+  if test $ac_cv_type_unsigned_long_long_int = yes; then
+    AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], 1,
+      [Define to 1 if the system has the type `unsigned long long int'.])
   fi
 ])
+
+# Expands to a C program that can be used to test for simultaneous support
+# of 'long long' and 'unsigned long long'. We don't want to say that
+# 'long long' is available if 'unsigned long long' is not, or vice versa,
+# because too many programs rely on the symmetry between signed and unsigned
+# integer types (excluding 'bool').
+AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET],
+[
+  AC_LANG_PROGRAM(
+    [[/* For now, do not test the preprocessor; as of 2007 there are too many
+        implementations with broken preprocessors.  Perhaps this can
+        be revisited in 2012.  In the meantime, code should not expect
+        #if to work with literals wider than 32 bits.  */
+      /* Test literals.  */
+      long long int ll = 9223372036854775807ll;
+      long long int nll = -9223372036854775807LL;
+      unsigned long long int ull = 18446744073709551615ULL;
+      /* Test constant expressions.   */
+      typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
+                    ? 1 : -1)];
+      typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
+                    ? 1 : -1)];
+      int i = 63;]],
+    [[/* Test availability of runtime routines for shift and division.  */
+      long long int llmax = 9223372036854775807ll;
+      unsigned long long int ullmax = 18446744073709551615ull;
+      return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
+             | (llmax / ll) | (llmax % ll)
+             | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
+             | (ullmax / ull) | (ullmax % ull));]])
+])
index d39a314e178451ebb30f1441dd99cfbe51a92434..b755757be43c91d0b48c6e0027c829466e6c6a34 100644 (file)
@@ -1,4 +1,4 @@
-# socklen.m4 serial 5
+# socklen.m4 serial 6
 dnl Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -12,7 +12,7 @@ dnl types for the argument to getsockopt, getpeername, etc.  So we
 dnl have to test to find something that will work.
 
 dnl On mingw32, socklen_t is in ws2tcpip.h ('int'), so we try to find
-dnl it there first.  That file is included by gnulib's sys_socket_.h, which
+dnl it there first.  That file is included by gnulib's sys_socket.in.h, which
 dnl all users of this module should include.  Cygwin must not include
 dnl ws2tcpip.h.
 AC_DEFUN([gl_TYPE_SOCKLEN_T],
index 03bb0932028fcf55be27efa896d0365be02ed945..bb6c34fe1e9e78a6a733f3c94501a5c240dfe947 100644 (file)
@@ -1,4 +1,4 @@
-# stdint.m4 serial 28
+# stdint.m4 serial 29
 dnl Copyright (C) 2001-2007 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -370,7 +370,7 @@ AC_DEFUN([gl_STDINT_INCLUDES],
 
 dnl gl_STDINT_TYPE_PROPERTIES
 dnl Compute HAVE_SIGNED_t, BITSIZEOF_t and t_SUFFIX, for all the types t
-dnl of interest to stdint_.h.
+dnl of interest to stdint.in.h.
 AC_DEFUN([gl_STDINT_TYPE_PROPERTIES],
 [
   gl_STDINT_BITSIZEOF([ptrdiff_t sig_atomic_t size_t wchar_t wint_t],
index b9a69984f6d704a9a94bf0cd37fd3eddf27f1571..a40d41804199e9d99c7d6bac761ea02cde36f4c5 100644 (file)
@@ -1,4 +1,4 @@
-# stdio_h.m4 serial 7
+# stdio_h.m4 serial 9
 dnl Copyright (C) 2007 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -28,6 +28,8 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
   GNULIB_VSNPRINTF=0;      AC_SUBST([GNULIB_VSNPRINTF])
   GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX])
   GNULIB_VASPRINTF=0;      AC_SUBST([GNULIB_VASPRINTF])
+  GNULIB_FOPEN=0;          AC_SUBST([GNULIB_FOPEN])
+  GNULIB_FREOPEN=0;        AC_SUBST([GNULIB_FREOPEN])
   GNULIB_FSEEK=0;          AC_SUBST([GNULIB_FSEEK])
   GNULIB_FSEEKO=0;         AC_SUBST([GNULIB_FSEEKO])
   GNULIB_FTELL=0;          AC_SUBST([GNULIB_FTELL])
@@ -48,6 +50,8 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
   REPLACE_VSPRINTF=0;      AC_SUBST([REPLACE_VSPRINTF])
   HAVE_VASPRINTF=1;        AC_SUBST([HAVE_VASPRINTF])
   REPLACE_VASPRINTF=0;     AC_SUBST([REPLACE_VASPRINTF])
+  REPLACE_FOPEN=0;         AC_SUBST([REPLACE_FOPEN])
+  REPLACE_FREOPEN=0;       AC_SUBST([REPLACE_FREOPEN])
   HAVE_FSEEKO=1;           AC_SUBST([HAVE_FSEEKO])
   REPLACE_FSEEKO=0;        AC_SUBST([REPLACE_FSEEKO])
   REPLACE_FSEEK=0;         AC_SUBST([REPLACE_FSEEK])
@@ -69,13 +73,12 @@ AC_DEFUN([gl_STDIN_LARGE_OFFSET],
       [AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>],
 [#if defined __SL64 && defined __SCLE /* cygwin */
   /* Cygwin 1.5.24 and earlier fail to put stdin in 64-bit mode, making
-     fseeko/ftello needlessly fail.  This bug was fixed at the same time
-     that cygwin started exporting asnprintf (cygwin 1.7.0), so we use
-     that as a link-time test for cross-compiles rather than building
-     a runtime test.  */
-  size_t s;
-  if (asnprintf (NULL, &s, ""))
-    return 0;
+     fseeko/ftello needlessly fail.  This bug was fixed in 1.5.25, and
+     it is easier to do a version check than building a runtime test.  */
+# include <cygwin/version.h>
+# if CYGWIN_VERSION_DLL_COMBINED < CYGWIN_VERSION_DLL_MAKE_COMBINED (1005, 25)
+  choke me
+# endif
 #endif])],
        [gl_cv_var_stdin_large_offset=yes],
        [gl_cv_var_stdin_large_offset=no])])
index ea9286ef46bc66b7c81b3b5e712f4e0c6f812731..fe4ce122e9fd6208b66887a6fa4cce06db8914d6 100644 (file)
@@ -1,4 +1,4 @@
-# stdlib_h.m4 serial 3
+# stdlib_h.m4 serial 5
 dnl Copyright (C) 2007 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -25,11 +25,18 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   GNULIB_GETSUBOPT=0;     AC_SUBST([GNULIB_GETSUBOPT])
   GNULIB_MKDTEMP=0;       AC_SUBST([GNULIB_MKDTEMP])
   GNULIB_MKSTEMP=0;       AC_SUBST([GNULIB_MKSTEMP])
+  GNULIB_PUTENV=0;        AC_SUBST([GNULIB_PUTENV])
+  GNULIB_SETENV=0;        AC_SUBST([GNULIB_SETENV])
+  GNULIB_UNSETENV=0;      AC_SUBST([GNULIB_UNSETENV])
   dnl Assume proper GNU behavior unless another module says otherwise.
   HAVE_CALLOC_POSIX=1;    AC_SUBST([HAVE_CALLOC_POSIX])
   HAVE_GETSUBOPT=1;       AC_SUBST([HAVE_GETSUBOPT])
   HAVE_MALLOC_POSIX=1;    AC_SUBST([HAVE_MALLOC_POSIX])
   HAVE_MKDTEMP=1;         AC_SUBST([HAVE_MKDTEMP])
   HAVE_REALLOC_POSIX=1;   AC_SUBST([HAVE_REALLOC_POSIX])
+  HAVE_SETENV=1;          AC_SUBST([HAVE_SETENV])
+  HAVE_UNSETENV=1;        AC_SUBST([HAVE_UNSETENV])
   REPLACE_MKSTEMP=0;      AC_SUBST([REPLACE_MKSTEMP])
+  REPLACE_PUTENV=0;       AC_SUBST([REPLACE_PUTENV])
+  VOID_UNSETENV=0;        AC_SUBST([VOID_UNSETENV])
 ])
index ec51e9a0185d208e1f7391bb02f73ca8f73a91eb..766d7e984948bb6bf9cc80e18bbc01e18cd8f8ea 100644 (file)
@@ -1,10 +1,12 @@
 # Configure a GNU-like replacement for <string.h>.
 
-# Copyright (C) 2007 Free Software Foundation, Inc.
+# Copyright (C) 2007, 2008 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
+
 # Written by Paul Eggert.
 
 AC_DEFUN([gl_HEADER_STRING_H],
@@ -41,6 +43,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
   GNULIB_STRNLEN=0;     AC_SUBST([GNULIB_STRNLEN])
   GNULIB_STRPBRK=0;     AC_SUBST([GNULIB_STRPBRK])
   GNULIB_STRSEP=0;      AC_SUBST([GNULIB_STRSEP])
+  GNULIB_STRSTR=0;      AC_SUBST([GNULIB_STRSTR])
   GNULIB_STRCASESTR=0;  AC_SUBST([GNULIB_STRCASESTR])
   GNULIB_STRTOK_R=0;    AC_SUBST([GNULIB_STRTOK_R])
   GNULIB_MBSLEN=0;      AC_SUBST([GNULIB_MBSLEN])
@@ -57,14 +60,14 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
   GNULIB_MBSSPN=0;      AC_SUBST([GNULIB_MBSSPN])
   GNULIB_MBSSEP=0;      AC_SUBST([GNULIB_MBSSEP])
   GNULIB_MBSTOK_R=0;    AC_SUBST([GNULIB_MBSTOK_R])
+  GNULIB_STRERROR=0;    AC_SUBST([GNULIB_STRERROR])
+  GNULIB_STRSIGNAL=0;   AC_SUBST([GNULIB_STRSIGNAL])
   dnl Assume proper GNU behavior unless another module says otherwise.
   HAVE_DECL_MEMMEM=1;          AC_SUBST([HAVE_DECL_MEMMEM])
   HAVE_MEMPCPY=1;              AC_SUBST([HAVE_MEMPCPY])
   HAVE_DECL_MEMRCHR=1;         AC_SUBST([HAVE_DECL_MEMRCHR])
   HAVE_STPCPY=1;               AC_SUBST([HAVE_STPCPY])
   HAVE_STPNCPY=1;              AC_SUBST([HAVE_STPNCPY])
-  HAVE_STRCASECMP=1;           AC_SUBST([HAVE_STRCASECMP])
-  HAVE_DECL_STRNCASECMP=1;     AC_SUBST([HAVE_DECL_STRNCASECMP])
   HAVE_STRCHRNUL=1;            AC_SUBST([HAVE_STRCHRNUL])
   HAVE_DECL_STRDUP=1;          AC_SUBST([HAVE_DECL_STRDUP])
   HAVE_STRNDUP=1;              AC_SUBST([HAVE_STRNDUP])
@@ -74,4 +77,11 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
   HAVE_STRSEP=1;               AC_SUBST([HAVE_STRSEP])
   HAVE_STRCASESTR=1;           AC_SUBST([HAVE_STRCASESTR])
   HAVE_DECL_STRTOK_R=1;                AC_SUBST([HAVE_DECL_STRTOK_R])
+  HAVE_DECL_STRERROR=1;                AC_SUBST([HAVE_DECL_STRERROR])
+  HAVE_DECL_STRSIGNAL=1;       AC_SUBST([HAVE_DECL_STRSIGNAL])
+  REPLACE_STRERROR=0;          AC_SUBST([REPLACE_STRERROR])
+  REPLACE_STRSIGNAL=0;         AC_SUBST([REPLACE_STRSIGNAL])
+  REPLACE_MEMMEM=0;            AC_SUBST([REPLACE_MEMMEM])
+  REPLACE_STRCASESTR=0;                AC_SUBST([REPLACE_STRCASESTR])
+  REPLACE_STRSTR=0;            AC_SUBST([REPLACE_STRSTR])
 ])
diff --git a/config/gnulib/ulonglong.m4 b/config/gnulib/ulonglong.m4
deleted file mode 100644 (file)
index 9fae98e..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-# ulonglong.m4 serial 6
-dnl Copyright (C) 1999-2006 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl From Paul Eggert.
-
-# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works.
-# This fixes a bug in Autoconf 2.60, but can be removed once we
-# assume 2.61 everywhere.
-
-# Note: If the type 'unsigned long long int' exists but is only 32 bits
-# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT
-# will not be defined. In this case you can treat 'unsigned long long int'
-# like 'unsigned long int'.
-
-AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
-[
-  AC_CACHE_CHECK([for unsigned long long int],
-    [ac_cv_type_unsigned_long_long_int],
-    [AC_LINK_IFELSE(
-       [AC_LANG_PROGRAM(
-         [[unsigned long long int ull = 18446744073709551615ULL;
-           typedef int a[(18446744073709551615ULL <= (unsigned long long int) -1
-                          ? 1 : -1)];
-          int i = 63;]],
-         [[unsigned long long int ullmax = 18446744073709551615ull;
-           return (ull << 63 | ull >> 63 | ull << i | ull >> i
-                   | ullmax / ull | ullmax % ull);]])],
-       [ac_cv_type_unsigned_long_long_int=yes],
-       [ac_cv_type_unsigned_long_long_int=no])])
-  if test $ac_cv_type_unsigned_long_long_int = yes; then
-    AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], 1,
-      [Define to 1 if the system has the type `unsigned long long int'.])
-  fi
-])
-
-# This macro is obsolescent and should go away soon.
-AC_DEFUN([gl_AC_TYPE_UNSIGNED_LONG_LONG],
-[
-  AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
-  ac_cv_type_unsigned_long_long=$ac_cv_type_unsigned_long_long_int
-  if test $ac_cv_type_unsigned_long_long = yes; then
-    AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
-      [Define if you have the 'unsigned long long' type.])
-  fi
-])
index b12f84e8eceda057874c094a64f6e9db2222f659..e8ccab16e837659cb30099432991a810bd7698cf 100644 (file)
@@ -1,5 +1,5 @@
-# unistd_h.m4 serial 9
-dnl Copyright (C) 2006-2007 Free Software Foundation, Inc.
+# unistd_h.m4 serial 11
+dnl Copyright (C) 2006-2008 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -34,10 +34,12 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
 [
   GNULIB_CHOWN=0;         AC_SUBST([GNULIB_CHOWN])
   GNULIB_DUP2=0;          AC_SUBST([GNULIB_DUP2])
+  GNULIB_ENVIRON=0;       AC_SUBST([GNULIB_ENVIRON])
   GNULIB_FCHDIR=0;        AC_SUBST([GNULIB_FCHDIR])
   GNULIB_FTRUNCATE=0;     AC_SUBST([GNULIB_FTRUNCATE])
   GNULIB_GETCWD=0;        AC_SUBST([GNULIB_GETCWD])
   GNULIB_GETLOGIN_R=0;    AC_SUBST([GNULIB_GETLOGIN_R])
+  GNULIB_GETPAGESIZE=0;   AC_SUBST([GNULIB_GETPAGESIZE])
   GNULIB_LCHOWN=0;        AC_SUBST([GNULIB_LCHOWN])
   GNULIB_LSEEK=0;         AC_SUBST([GNULIB_LSEEK])
   GNULIB_READLINK=0;      AC_SUBST([GNULIB_READLINK])
@@ -45,12 +47,17 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   dnl Assume proper GNU behavior unless another module says otherwise.
   HAVE_DUP2=1;            AC_SUBST([HAVE_DUP2])
   HAVE_FTRUNCATE=1;       AC_SUBST([HAVE_FTRUNCATE])
+  HAVE_GETPAGESIZE=1;     AC_SUBST([HAVE_GETPAGESIZE])
   HAVE_READLINK=1;        AC_SUBST([HAVE_READLINK])
   HAVE_SLEEP=1;           AC_SUBST([HAVE_SLEEP])
+  HAVE_DECL_ENVIRON=1;    AC_SUBST([HAVE_DECL_ENVIRON])
   HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R])
+  HAVE_OS_H=0;            AC_SUBST([HAVE_OS_H])
+  HAVE_SYS_PARAM_H=0;     AC_SUBST([HAVE_SYS_PARAM_H])
   REPLACE_CHOWN=0;        AC_SUBST([REPLACE_CHOWN])
   REPLACE_FCHDIR=0;       AC_SUBST([REPLACE_FCHDIR])
   REPLACE_GETCWD=0;       AC_SUBST([REPLACE_GETCWD])
+  REPLACE_GETPAGESIZE=0;  AC_SUBST([REPLACE_GETPAGESIZE])
   REPLACE_LCHOWN=0;       AC_SUBST([REPLACE_LCHOWN])
   REPLACE_LSEEK=0;        AC_SUBST([REPLACE_LSEEK])
 ])
index ef2de787f02bb1ac466983794d174adfd7d3da61..c4d3f4fa07187d7898b2adb76a79cdc1917be8ea 100644 (file)
@@ -1,5 +1,5 @@
-# vasnprintf.m4 serial 20
-dnl Copyright (C) 2002-2004, 2006-2007 Free Software Foundation, Inc.
+# vasnprintf.m4 serial 24
+dnl Copyright (C) 2002-2004, 2006-2008 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -45,7 +45,10 @@ AC_DEFUN([gl_PREREQ_PRINTF_PARSE],
   AC_REQUIRE([gt_TYPE_WCHAR_T])
   AC_REQUIRE([gt_TYPE_WINT_T])
   AC_REQUIRE([AC_TYPE_SIZE_T])
-  AC_CHECK_TYPES(ptrdiff_t)
+  AC_CHECK_TYPE([ptrdiff_t], ,
+    [AC_DEFINE([ptrdiff_t], [long],
+       [Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
+    ])
   AC_REQUIRE([gt_AC_TYPE_INTMAX_T])
 ])
 
@@ -163,6 +166,21 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING],
   esac
 ])
 
+# Extra prerequisites of lib/vasnprintf.c for supporting the '-' flag.
+AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST],
+[
+  AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
+  case "$gl_cv_func_printf_flag_leftadjust" in
+    *yes)
+      ;;
+    *)
+      AC_DEFINE([NEED_PRINTF_FLAG_LEFTADJUST], 1,
+        [Define if the vasnprintf implementation needs special code for the
+         '-' flag.])
+      ;;
+  esac
+])
+
 # Extra prerequisites of lib/vasnprintf.c for supporting the 0 flag.
 AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ZERO],
 [
@@ -178,6 +196,49 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ZERO],
   esac
 ])
 
+# Extra prerequisites of lib/vasnprintf.c for supporting large precisions.
+AC_DEFUN([gl_PREREQ_VASNPRINTF_PRECISION],
+[
+  AC_REQUIRE([gl_PRINTF_PRECISION])
+  case "$gl_cv_func_printf_precision" in
+    *yes)
+      ;;
+    *)
+      AC_DEFINE([NEED_PRINTF_UNBOUNDED_PRECISION], 1,
+        [Define if the vasnprintf implementation needs special code for
+         supporting large precisions without arbitrary bounds.])
+      AC_DEFINE([NEED_PRINTF_DOUBLE], 1,
+        [Define if the vasnprintf implementation needs special code for
+         'double' arguments.])
+      AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], 1,
+        [Define if the vasnprintf implementation needs special code for
+         'long double' arguments.])
+      ;;
+  esac
+])
+
+# Extra prerequisites of lib/vasnprintf.c for surviving out-of-memory
+# conditions.
+AC_DEFUN([gl_PREREQ_VASNPRINTF_ENOMEM],
+[
+  AC_REQUIRE([gl_PRINTF_ENOMEM])
+  case "$gl_cv_func_printf_enomem" in
+    *yes)
+      ;;
+    *)
+      AC_DEFINE([NEED_PRINTF_ENOMEM], 1,
+        [Define if the vasnprintf implementation needs special code for
+         surviving out-of-memory conditions.])
+      AC_DEFINE([NEED_PRINTF_DOUBLE], 1,
+        [Define if the vasnprintf implementation needs special code for
+         'double' arguments.])
+      AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], 1,
+        [Define if the vasnprintf implementation needs special code for
+         'long double' arguments.])
+      ;;
+  esac
+])
+
 # Prerequisites of lib/vasnprintf.c including all extras for POSIX compliance.
 AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_EXTRAS],
 [
@@ -188,7 +249,10 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_EXTRAS],
   gl_PREREQ_VASNPRINTF_DIRECTIVE_A
   gl_PREREQ_VASNPRINTF_DIRECTIVE_F
   gl_PREREQ_VASNPRINTF_FLAG_GROUPING
+  gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
   gl_PREREQ_VASNPRINTF_FLAG_ZERO
+  gl_PREREQ_VASNPRINTF_PRECISION
+  gl_PREREQ_VASNPRINTF_ENOMEM
 ])
 
 # Prerequisites of lib/asnprintf.c.
index 2cac1a710827d984fc9a31dd681a523f6ac5e4c6..af5ed936cc447baf325b9c2c1ea4fc9b0f620ee5 100644 (file)
@@ -1,4 +1,4 @@
-# wint_t.m4 serial 2 (gettext-0.16.2)
+# wint_t.m4 serial 2 (gettext-0.17)
 dnl Copyright (C) 2003, 2007 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
diff --git a/config/macro-archive/ac_perl_module_version.m4 b/config/macro-archive/ac_perl_module_version.m4
new file mode 100644 (file)
index 0000000..b2987dc
--- /dev/null
@@ -0,0 +1,85 @@
+# ===========================================================================
+#         http://autoconf-archive.cryp.to/ac_perl_module_version.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AC_PERL_MODULE_VERSION([MODULE VERSION], [ACTION-IF-TRUE], [ACTION-IF-FALSE])
+#
+# DESCRIPTION
+#
+#   Checks to see if the list of 'Module Version' are avaiable in the
+#   system. If all the modules in the list are avaiable ACTION-IF-TRUE is
+#   executed. Case one module is not avaiable ACTION-IF-FALSE is executed
+#   and the macro execution is aborted. NOTE: Perl is needed.
+#
+#   Example:
+#
+#     AC_PERL_MODULE_VERSION(CGI::Test 0.104 CGI::Ajax 0.694, ,
+#        AC_MSG_ERROR(Need some Perl modules))
+#
+# LAST MODIFICATION
+#
+#   2008-04-12
+#
+# COPYLEFT
+#
+#   Copyright (c) 2008 Marco Gomes <mpglesi@gmail.com>
+#   Copyright (c) 2008 Ruben Fonseca <fonseka@gmail.com>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved.
+
+AC_DEFUN([AC_PERL_MODULE_VERSION],[dnl
+ac_perl_list_modules="$1"
+# Make sure we have perl
+if test -z "$PERL"; then
+AC_CHECK_PROG(PERL,perl,perl)
+fi
+
+# Check the number of arguments
+args_num=`echo $ac_perl_list_modules | wc -w`
+let "ckeck_args = $args_num % 2"
+if test "$check_args" = "1" ; then
+  AC_MSG_ERROR(syntax error)
+else
+  eval
+fi
+
+if test "x$PERL" != x; then
+  ac_failed=0
+  while test ${#ac_perl_list_modules} -gt 2 ; do
+       module_name=`echo $ac_perl_list_modules | cut -d " " -f 1`
+       module_version=`echo $ac_perl_list_modules | cut -d " " -f 2`
+       ac_perl_list_modules=`echo $ac_perl_list_modules | cut -d " " -f 3-`
+       AC_MSG_CHECKING(for perl module $module_name version $module_version)
+
+       $PERL "-M$module_name" -e exit > /dev/null 2>&1
+       if test $? -ne 0; then
+         AC_MSG_RESULT(no);
+         ac_failed=1
+         ac_perl_list_modules=""
+       else
+         version=`$PERL "-M$module_name" -e 'print $'"$module_name::VERSION" 2>&1`
+         $PERL -e 'exit(shift cmp shift)' "$version" "$module_version"
+         if test $? -eq 0 -o $? -eq 1 ; then
+           AC_MSG_RESULT(ok);
+         else
+           AC_MSG_RESULT(no)
+           ac_failed=1
+           ac_perl_list_modules=""
+         fi
+       fi;
+  done
+
+  if test "$ac_failed" = 0; then
+    :
+    $2
+  else
+    :
+    $3
+  fi
+else
+  AC_MSG_ERROR(could not find perl)
+fi])dnl
index 935b169825597d001e54f44d8cc35493bec00ac4..f29c94ebaf4d33c2861e9b57ee4d8d5a367aa48b 100644 (file)
@@ -32,7 +32,7 @@
 #
 # COPYRIGHT
 #
-#   Copyright (c) 2007 Zmanda Inc.  All Rights Reserved.
+#   Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
 #  
 #   This program is free software; you can redistribute it and/or modify it
 #   under the terms of the GNU General Public License version 2 as published
@@ -53,8 +53,8 @@
 #   may extend this special exception to the GPL to apply to your
 #   modified version as well.
 #
-#   Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
-#   Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+#   Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+#   Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 
 AC_DEFUN([AC_CHECK_DOCBOOK_DTD],
 [
index e92c8488468d8eca8ffabaa0044c8bca1efbac75..86e13377d9afe4bdeeb08268a761056ee7d698fb 100644 (file)
@@ -27,7 +27,7 @@
 #
 # COPYRIGHT
 #
-#   Copyright (c) 2007 Zmanda Inc.  All Rights Reserved.
+#   Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
 #  
 #   This program is free software; you can redistribute it and/or modify it
 #   under the terms of the GNU General Public License version 2 as published
@@ -48,8 +48,8 @@
 #   may extend this special exception to the GPL to apply to your
 #   modified version as well.
 #
-#   Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
-#   Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+#   Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+#   Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 
 AC_DEFUN([AC_CHECK_DOCBOOK_XSLT_MIN],
 [
index ab4b6ce8c0acee27ea2ea7d9acc6607ea2c0bd91..d163f982dda3e081e10e6a32b75f598ab413215c 100644 (file)
@@ -32,7 +32,7 @@
 #
 # COPYRIGHT
 #
-#   Copyright (c) 2007 Zmanda Inc.  All Rights Reserved.
+#   Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
 #  
 #   This program is free software; you can redistribute it and/or modify it
 #   under the terms of the GNU General Public License version 2 as published
@@ -53,8 +53,8 @@
 #   may extend this special exception to the GPL to apply to your
 #   modified version as well.
 #
-#   Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
-#   Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+#   Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+#   Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 
 AC_DEFUN([AC_CHECK_DOCBOOK_XSLT],
 [
index 7773a1d244d3504b5c79eb5ae915670469c06d53..f1e2010cbac77454760a8bace6879306c446ceeb 100644 (file)
@@ -1,5 +1,6 @@
 ## this file is automatically generated by autogen
 EXTRA_DIST += macro-archive/ac_define_dir.m4
+EXTRA_DIST += macro-archive/ac_perl_module_version.m4
 EXTRA_DIST += macro-archive/ac_prog_perl_version.m4
 EXTRA_DIST += macro-archive/ac_prog_swig.m4
 EXTRA_DIST += macro-archive/ax_compare_version.m4
index b782967d63326e293f0a2babcb894a2b6bd6b06d..799635c7ced462e471d499018c42db5cfe1aa572 100644 (file)
@@ -27,7 +27,7 @@
 #
 # COPYRIGHT
 #
-#   Copyright (c) 2007 Zmanda Inc.  All Rights Reserved.
+#   Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
 #  
 #   This program is free software; you can redistribute it and/or modify it
 #   under the terms of the GNU General Public License version 2 as published
@@ -48,8 +48,8 @@
 #   may extend this special exception to the GPL to apply to your
 #   modified version as well.
 #
-#   Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
-#   Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+#   Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+#   Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 
 AC_DEFUN([AC_PROG_XSLTPROC],
 [
index 49ddd558d6e39df0daedc71056759463218117b8..4194c65aac601bb394f73a6dbbd33222a0c7c63c 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,9 +1,9 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61.
+# Generated by GNU Autoconf 2.63.
 #
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 # This configure script is free software; the Free Software Foundation
 # gives unlimited permission to copy, distribute and modify it.
 ## --------------------- ##
@@ -15,7 +15,7 @@ DUALCASE=1; export DUALCASE # for MKS sh
 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
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
   # is contrary to our usage.  Disable this feature.
   alias -g '${1+"$@"}'='"$@"'
   setopt NO_GLOB_SUBST
@@ -37,17 +37,45 @@ 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=';'
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='printf %s\n'
+  as_echo_n='printf %s'
+else
+  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+    as_echo_n='/usr/ucb/echo -n'
   else
-    PATH_SEPARATOR=:
+    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+    as_echo_n_body='eval
+      arg=$1;
+      case $arg in
+      *"$as_nl"*)
+       expr "X$arg" : "X\\(.*\\)$as_nl";
+       arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+      esac;
+      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+    '
+    export as_echo_n_body
+    as_echo_n='sh -c $as_echo_n_body as_echo'
   fi
-  rm -f conf$$.sh
+  export as_echo_body
+  as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+      PATH_SEPARATOR=';'
+  }
 fi
 
 # Support unset when possible.
@@ -63,8 +91,6 @@ fi
 # 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.
@@ -87,7 +113,7 @@ 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
+  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
   { (exit 1); exit 1; }
 fi
 
@@ -100,17 +126,10 @@ 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
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
 
 # Required to use basename.
 if expr a : '\(a\)' >/dev/null 2>&1 &&
@@ -132,7 +151,7 @@ as_me=`$as_basename -- "$0" ||
 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
         X"$0" : 'X\(//\)$' \| \
         X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-echo X/"$0" |
+$as_echo X/"$0" |
     sed '/^.*\/\([^/][^/]*\)\/*$/{
            s//\1/
            q
@@ -158,7 +177,7 @@ else
   as_have_required=no
 fi
 
-  if test $as_have_required = yes &&    (eval ":
+  if test $as_have_required = yes &&    (eval ":
 (as_func_return () {
   (exit \$1)
 }
@@ -240,7 +259,7 @@ IFS=$as_save_IFS
 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
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
   # is contrary to our usage.  Disable this feature.
   alias -g '${1+"$@"}'='"$@"'
   setopt NO_GLOB_SUBST
@@ -261,7 +280,7 @@ _ASEOF
 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
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
   # is contrary to our usage.  Disable this feature.
   alias -g '${1+"$@"}'='"$@"'
   setopt NO_GLOB_SUBST
@@ -341,10 +360,10 @@ fi
 
       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+"$@"}
+       do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+       done
+       export CONFIG_SHELL
+       exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
 fi
 
 
@@ -413,9 +432,10 @@ 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
+  echo Please tell bug-autoconf@gnu.org about your system,
+  echo including any error possibly output before this message.
+  echo This can help us improve future autoconf versions.
+  echo Configuration will now proceed without shell functions.
 }
 
 
@@ -451,7 +471,7 @@ test \$exitcode = 0") || {
       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
+    { $as_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
@@ -479,7 +499,6 @@ case `echo -n x` in
 *)
   ECHO_N='-n';;
 esac
-
 if expr a : '\(a\)' >/dev/null 2>&1 &&
    test "X`expr 00001 : '.*\(...\)'`" = X001; then
   as_expr=expr
@@ -492,19 +511,22 @@ 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 ||
+  mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+  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'
-elif ln conf$$.file conf$$ 2>/dev/null; then
-  as_ln_s=ln
+  fi
 else
   as_ln_s='cp -p'
 fi
@@ -529,10 +551,10 @@ else
   as_test_x='
     eval sh -c '\''
       if test -d "$1"; then
-        test -d "$1/.";
+       test -d "$1/.";
       else
        case $1 in
-        -*)set "./$1";;
+       -*)set "./$1";;
        esac;
        case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
        ???[sx]*):;;*)false;;esac;fi
@@ -769,499 +791,658 @@ ac_includes_default="\
 
 gl_header_list=
 gl_func_list=
-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
-build
-build_cpu
-build_vendor
-build_os
-host
-host_cpu
-host_vendor
-host_os
-target
-target_cpu
-target_vendor
-target_os
-PACKAGE
-INSTALL_PROGRAM
-INSTALL_SCRIPT
-INSTALL_DATA
-am__isrc
-CYGPATH_W
-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
-SNAPSHOT_STAMP
-VERSION_MAJOR
-VERSION_MINOR
-VERSION_PATCH
-VERSION_COMMENT
-VERSION_SUFFIX
-CC
-CFLAGS
-LDFLAGS
-CPPFLAGS
-ac_ct_CC
-EXEEXT
-OBJEXT
-DEPDIR
-am__include
-am__quote
-AMDEP_TRUE
-AMDEP_FALSE
-AMDEPBACKSLASH
-CCDEPMODE
-am__fastdepCC_TRUE
-am__fastdepCC_FALSE
-RANLIB
-CPP
-GREP
-EGREP
-GL_COND_LIBTOOL_TRUE
-GL_COND_LIBTOOL_FALSE
-ALLOCA
-ALLOCA_H
-ARPA_INET_H
-INCLUDE_NEXT
-NEXT_FLOAT_H
-FLOAT_H
-NEXT_SYS_SOCKET_H
-HAVE_SYS_SOCKET_H
-HAVE_WINSOCK2_H
-HAVE_WS2TCPIP_H
-SYS_SOCKET_H
-LIBINTL
-LTLIBINTL
-NEXT_SYS_TIME_H
-HAVE_SYS_TIME_H
-HAVE_STRUCT_TIMEVAL
-REPLACE_GETTIMEOFDAY
-SYS_TIME_H
-LIBPTH
-LTLIBPTH
-LIBTHREAD
-LTLIBTHREAD
-LIBMULTITHREAD
-LTLIBMULTITHREAD
-HAVE_MALLOC_POSIX
-GNULIB_MALLOC_POSIX
-GNULIB_REALLOC_POSIX
-GNULIB_CALLOC_POSIX
-GNULIB_GETSUBOPT
-GNULIB_MKDTEMP
-GNULIB_MKSTEMP
-HAVE_CALLOC_POSIX
-HAVE_GETSUBOPT
-HAVE_MKDTEMP
-HAVE_REALLOC_POSIX
-REPLACE_MKSTEMP
-NEXT_NETINET_IN_H
-HAVE_NETINET_IN_H
-NETINET_IN_H
-GNULIB_FPRINTF_POSIX
-GNULIB_PRINTF_POSIX
-GNULIB_SNPRINTF
-GNULIB_SPRINTF_POSIX
-GNULIB_VFPRINTF_POSIX
-GNULIB_VPRINTF_POSIX
-GNULIB_VSNPRINTF
-GNULIB_VSPRINTF_POSIX
-GNULIB_VASPRINTF
-GNULIB_FSEEK
-GNULIB_FSEEKO
-GNULIB_FTELL
-GNULIB_FTELLO
-GNULIB_FFLUSH
-GNULIB_GETDELIM
-GNULIB_GETLINE
-REPLACE_FPRINTF
-REPLACE_VFPRINTF
-REPLACE_PRINTF
-REPLACE_VPRINTF
-REPLACE_SNPRINTF
-HAVE_DECL_SNPRINTF
-REPLACE_VSNPRINTF
-HAVE_DECL_VSNPRINTF
-REPLACE_SPRINTF
-REPLACE_VSPRINTF
-HAVE_VASPRINTF
-REPLACE_VASPRINTF
-HAVE_FSEEKO
-REPLACE_FSEEKO
-REPLACE_FSEEK
-HAVE_FTELLO
-REPLACE_FTELLO
-REPLACE_FTELL
-REPLACE_FFLUSH
-HAVE_DECL_GETDELIM
-HAVE_DECL_GETLINE
-REPLACE_GETLINE
-STDBOOL_H
-HAVE__BOOL
-HAVE_LONG_LONG_INT
-HAVE_UNSIGNED_LONG_LONG_INT
-HAVE_INTTYPES_H
-HAVE_SYS_TYPES_H
-NEXT_STDINT_H
-HAVE_STDINT_H
-HAVE_SYS_INTTYPES_H
-HAVE_SYS_BITYPES_H
-BITSIZEOF_PTRDIFF_T
-BITSIZEOF_SIG_ATOMIC_T
-BITSIZEOF_SIZE_T
-BITSIZEOF_WCHAR_T
-BITSIZEOF_WINT_T
-HAVE_SIGNED_SIG_ATOMIC_T
-HAVE_SIGNED_WCHAR_T
-HAVE_SIGNED_WINT_T
-PTRDIFF_T_SUFFIX
-SIG_ATOMIC_T_SUFFIX
-SIZE_T_SUFFIX
-WCHAR_T_SUFFIX
-WINT_T_SUFFIX
-STDINT_H
-NEXT_STDIO_H
-NEXT_STDLIB_H
-GNULIB_MEMMEM
-GNULIB_MEMPCPY
-GNULIB_MEMRCHR
-GNULIB_STPCPY
-GNULIB_STPNCPY
-GNULIB_STRCHRNUL
-GNULIB_STRDUP
-GNULIB_STRNDUP
-GNULIB_STRNLEN
-GNULIB_STRPBRK
-GNULIB_STRSEP
-GNULIB_STRCASESTR
-GNULIB_STRTOK_R
-GNULIB_MBSLEN
-GNULIB_MBSNLEN
-GNULIB_MBSCHR
-GNULIB_MBSRCHR
-GNULIB_MBSSTR
-GNULIB_MBSCASECMP
-GNULIB_MBSNCASECMP
-GNULIB_MBSPCASECMP
-GNULIB_MBSCASESTR
-GNULIB_MBSCSPN
-GNULIB_MBSPBRK
-GNULIB_MBSSPN
-GNULIB_MBSSEP
-GNULIB_MBSTOK_R
-HAVE_DECL_MEMMEM
-HAVE_MEMPCPY
-HAVE_DECL_MEMRCHR
-HAVE_STPCPY
-HAVE_STPNCPY
-HAVE_STRCASECMP
-HAVE_DECL_STRNCASECMP
-HAVE_STRCHRNUL
-HAVE_DECL_STRDUP
-HAVE_STRNDUP
-HAVE_DECL_STRNDUP
-HAVE_DECL_STRNLEN
-HAVE_STRPBRK
-HAVE_STRSEP
-HAVE_STRCASESTR
-HAVE_DECL_STRTOK_R
-NEXT_STRING_H
-HAVE_LSTAT
-HAVE_DECL_MKDIR
-HAVE_IO_H
-NEXT_SYS_STAT_H
-SYS_STAT_H
-GNULIB_CHOWN
-GNULIB_DUP2
-GNULIB_FCHDIR
-GNULIB_FTRUNCATE
-GNULIB_GETCWD
-GNULIB_GETLOGIN_R
-GNULIB_LCHOWN
-GNULIB_LSEEK
-GNULIB_READLINK
-GNULIB_SLEEP
-HAVE_DUP2
-HAVE_FTRUNCATE
-HAVE_READLINK
-HAVE_SLEEP
-HAVE_DECL_GETLOGIN_R
-REPLACE_CHOWN
-REPLACE_FCHDIR
-REPLACE_GETCWD
-REPLACE_LCHOWN
-REPLACE_LSEEK
-NEXT_UNISTD_H
-HAVE_UNISTD_H
-EOVERFLOW
-CFLAG_VISIBILITY
-HAVE_VISIBILITY
-GNULIB_WCWIDTH
-HAVE_DECL_WCWIDTH
-REPLACE_WCWIDTH
-WCHAR_H
-HAVE_WCHAR_H
-NEXT_WCHAR_H
-AMANDA_WARNING_CFLAGS
-CLIENT_LOGIN
-SETUID_GROUP
-CONFIG_DIR
-USE_VERSION_SUFFIXES
-GNUTAR_LISTED_INCREMENTAL_DIR
-AMANDA_TMPDIR
-BINARY_OWNER
-MAXTAPEBLOCKSIZE
-AMANDA_DBGDIR
-AMANDA_DEBUG_DAYS
-SERVICE_SUFFIX
-WANT_SETUID_CLIENT_TRUE
-WANT_SETUID_CLIENT_FALSE
-WANT_INSTALLPERMS_TRUE
-WANT_INSTALLPERMS_FALSE
-WANT_CLIENT_TRUE
-WANT_CLIENT_FALSE
-WANT_RESTORE_TRUE
-WANT_RESTORE_FALSE
-WANT_SERVER_TRUE
-WANT_SERVER_FALSE
-WANT_RECOVER_TRUE
-WANT_RECOVER_FALSE
-WANT_TAPE_TRUE
-WANT_TAPE_FALSE
-GNUPLOT
-PCAT
-COMPRESS
-GZIP
-AMPLOT_COMPRESS
-AMPLOT_CAT_GZIP
-AMPLOT_CAT_COMPRESS
-AMPLOT_CAT_PACK
-WANT_AMPLOT_TRUE
-WANT_AMPLOT_FALSE
-XSLTPROC_FLAGS
-XSLTPROC
-ENABLE_MANPAGE_BUILD_TRUE
-ENABLE_MANPAGE_BUILD_FALSE
-XSLREL
-DOC_BUILD_DATE
-DEFAULT_SERVER
-DEFAULT_CONFIG
-DEFAULT_TAPE_SERVER
-DEFAULT_TAPE_DEVICE
-EXAMPLE_TAPEDEV
-DEFAULT_CHANGER_DEVICE
-DEFAULT_AMANDATES_FILE
-GETCONF
-CHIO
-CHS
-MTX
-MCUTIL
-WANT_CHG_SCSI_TRUE
-WANT_CHG_SCSI_FALSE
-WANT_SCSI_LINUX_TRUE
-WANT_SCSI_LINUX_FALSE
-WANT_SCSI_HPUX_NEW_TRUE
-WANT_SCSI_HPUX_NEW_FALSE
-WANT_SCSI_IRIX_TRUE
-WANT_SCSI_IRIX_FALSE
-WANT_SCSI_SOLARIS_TRUE
-WANT_SCSI_SOLARIS_FALSE
-WANT_SCSI_AIX_TRUE
-WANT_SCSI_AIX_FALSE
-WANT_SCSI_CAM_TRUE
-WANT_SCSI_CAM_FALSE
-WANT_SCSI_BSD_TRUE
-WANT_SCSI_BSD_FALSE
-WANT_CHG_SCSI_CHIO_TRUE
-WANT_CHG_SCSI_CHIO_FALSE
-WANT_SCSI_HPUX_TRUE
-WANT_SCSI_HPUX_FALSE
-WANT_SCSI_CHIO_TRUE
-WANT_SCSI_CHIO_FALSE
-WANT_AMFLOCK_POSIX_TRUE
-WANT_AMFLOCK_POSIX_FALSE
-WANT_AMFLOCK_FLOCK_TRUE
-WANT_AMFLOCK_FLOCK_FALSE
-WANT_AMFLOCK_LOCKF_TRUE
-WANT_AMFLOCK_LOCKF_FALSE
-WANT_AMFLOCK_LNLOCK_TRUE
-WANT_AMFLOCK_LNLOCK_FALSE
-SWIG
-SWIG_LIB
-PERL
-PERL_INC
-WANT_CYGWIN_COPY_PERL_DLL_TRUE
-WANT_CYGWIN_COPY_PERL_DLL_FALSE
-PERLEXTLIBS
-CAT
-CLIENT_SCRIPTS_OPT
-amlibdir
-amlibexecdir
-amincludedir
-amperldir
-DUMPER_DIR
-MSGFMT
-GETTEXT
-USE_NLS
-GMSGFMT
-MSGFMT_015
-GMSGFMT_015
-XGETTEXT
-XGETTEXT_015
-MSGMERGE
-INTL_MACOSX_LIBS
-LIBICONV
-LTLIBICONV
-INTLLIBS
-POSUB
-CURL_CONFIG
-_libcurl_config
-LIBCURL_CPPFLAGS
-LIBCURL
-WANT_S3_DEVICE_TRUE
-WANT_S3_DEVICE_FALSE
-WANT_DEVPAY_TRUE
-WANT_DEVPAY_FALSE
-WANT_TAPE_XENIX_TRUE
-WANT_TAPE_XENIX_FALSE
-WANT_TAPE_AIX_TRUE
-WANT_TAPE_AIX_FALSE
-WANT_TAPE_UWARE_TRUE
-WANT_TAPE_UWARE_FALSE
-WANT_TAPE_POSIX_TRUE
-WANT_TAPE_POSIX_FALSE
-WANT_TAPE_DEVICE_TRUE
-WANT_TAPE_DEVICE_FALSE
-WANT_BSD_SECURITY_TRUE
-WANT_BSD_SECURITY_FALSE
-WANT_BSDTCP_SECURITY_TRUE
-WANT_BSDTCP_SECURITY_FALSE
-WANT_BSDUDP_SECURITY_TRUE
-WANT_BSDUDP_SECURITY_FALSE
-WANT_RSH_SECURITY_TRUE
-WANT_RSH_SECURITY_FALSE
-SSH
-WANT_SSH_SECURITY_TRUE
-WANT_SSH_SECURITY_FALSE
-WANT_KRB4_SECURITY_TRUE
-WANT_KRB4_SECURITY_FALSE
-WANT_KRB5_SECURITY_TRUE
-WANT_KRB5_SECURITY_FALSE
-XFSDUMP
-XFSRESTORE
-VXDUMP
-VXRESTORE
-VDUMP
-VRESTORE
-DUMP
-RESTORE
-GNUTAR
-SAMBA_CLIENT
-WANT_SAMBA_TRUE
-WANT_SAMBA_FALSE
-AMLINT
-AMLINTFLAGS
-LEX
-LEX_OUTPUT_ROOT
-LEXLIB
-AR
-YACC
-YFLAGS
-DD
-BASH
-SORT
-MAILER
-MT
-MT_FILE_FLAG
-PRINT
-GCC_COMPILER_TRUE
-GCC_COMPILER_FALSE
-LN_S
-ECHO
-CXX
-CXXFLAGS
-ac_ct_CXX
-CXXDEPMODE
-am__fastdepCXX_TRUE
-am__fastdepCXX_FALSE
-CXXCPP
-F77
-FFLAGS
-ac_ct_F77
-LIBTOOL
-LIBTOOL_DEPS
-AMANDA_STATIC_LDFLAGS
-PKG_CONFIG
-GLIB_CFLAGS
-GLIB_LIBS
-GLIB_GENMARSHAL
-GOBJECT_QUERY
-GLIB_MKENUMS
-READLINE_LIBS
-LIBOBJS
-LTLIBOBJS
-gl_LIBOBJS
+ac_subst_vars='SVN
+gltests_LTLIBOBJS
+gltests_LIBOBJS
 gl_LTLIBOBJS
-SVN'
-ac_subst_files=''
-      ac_precious_vars='build_alias
-host_alias
-target_alias
-CC
-CFLAGS
-LDFLAGS
-LIBS
-CPPFLAGS
-CPP
+gl_LIBOBJS
+LTLIBOBJS
+LIBOBJS
+READLINE_LIBS
+GLIB_MKENUMS
+GOBJECT_QUERY
+GLIB_GENMARSHAL
+GLIB_LIBS
+GLIB_CFLAGS
+PKG_CONFIG
+AMANDA_STATIC_LDFLAGS
+LIBTOOL_DEPS
+LIBTOOL
+ac_ct_F77
+FFLAGS
+F77
+CXXCPP
+am__fastdepCXX_FALSE
+am__fastdepCXX_TRUE
+CXXDEPMODE
+ac_ct_CXX
+CXXFLAGS
+CXX
+ECHO
+LN_S
+GCC_COMPILER_FALSE
+GCC_COMPILER_TRUE
+PS_ARGUMENT
+PS
+PRINT
+MT_FILE_FLAG
+MT
+DEFAULT_MAILER
+MAILER
+SORT
+BASH
+DD
+YFLAGS
+YACC
+AR
+LEXLIB
+LEX_OUTPUT_ROOT
+LEX
+AMLINTFLAGS
+AMLINT
+USE_RUNDUMP
+WANT_SAMBA_FALSE
+WANT_SAMBA_TRUE
+SAMBA_CLIENT
+GNUTAR
+DUMP_RETURNS_1
+AIX_BACKUP
+RESTORE
+DUMP
+VRESTORE
+VDUMP
+VXRESTORE
+VXDUMP
+XFSRESTORE
+XFSDUMP
+KRB5_SECURITY
+WANT_KRB5_SECURITY_FALSE
+WANT_KRB5_SECURITY_TRUE
+TICKET_LIFETIME
+CLIENT_HOST_KEY_FILE
+CLIENT_HOST_INSTANCE
+CLIENT_HOST_PRINCIPAL
+SERVER_HOST_KEY_FILE
+SERVER_HOST_INSTANCE
+SERVER_HOST_PRINCIPAL
+KRB4_SECURITY
+WANT_KRB4_SECURITY_FALSE
+WANT_KRB4_SECURITY_TRUE
+SSH_SECURITY
+WANT_SSH_SECURITY_FALSE
+WANT_SSH_SECURITY_TRUE
+SSH
+RSH_SECURITY
+WANT_RSH_SECURITY_FALSE
+WANT_RSH_SECURITY_TRUE
+BSDUDP_SECURITY
+WANT_BSDUDP_SECURITY_FALSE
+WANT_BSDUDP_SECURITY_TRUE
+BSDTCP_SECURITY
+WANT_BSDTCP_SECURITY_FALSE
+WANT_BSDTCP_SECURITY_TRUE
+USE_AMANDAHOSTS
+BSD_SECURITY
+WANT_BSD_SECURITY_FALSE
+WANT_BSD_SECURITY_TRUE
+WANT_TAPE_DEVICE_FALSE
+WANT_TAPE_DEVICE_TRUE
+WANT_TAPE_POSIX_FALSE
+WANT_TAPE_POSIX_TRUE
+WANT_TAPE_UWARE_FALSE
+WANT_TAPE_UWARE_TRUE
+WANT_TAPE_AIX_FALSE
+WANT_TAPE_AIX_TRUE
+WANT_TAPE_XENIX_FALSE
+WANT_TAPE_XENIX_TRUE
+WANT_S3_DEVICE_FALSE
+WANT_S3_DEVICE_TRUE
+LIBCURL
+LIBCURL_CPPFLAGS
+_libcurl_config
+CURL_CONFIG
+POSUB
+INTLLIBS
+LTLIBICONV
+LIBICONV
+INTL_MACOSX_LIBS
+MSGMERGE
+XGETTEXT_015
+XGETTEXT
+GMSGFMT_015
+MSGFMT_015
+GMSGFMT
+USE_NLS
+GETTEXT
+MSGFMT
+amdatadir
+APPLICATION_DIR
+amperldir
+amincludedir
+amlibexecdir
+amlibdir
+CLIENT_SCRIPTS_OPT
+HAVE_GZIP
+UNCOMPRESS_OPT
+UNCOMPRESS_PATH
+COMPRESS_BEST_OPT
+COMPRESS_FAST_OPT
+COMPRESS_SUFFIX
+COMPRESS_PATH
+CAT
+PERLEXTLIBS
+WANT_CYGWIN_COPY_PERL_DLL_FALSE
+WANT_CYGWIN_COPY_PERL_DLL_TRUE
+PERL_INC
+PERL
+SWIG_LIB
+SWIG
+LOCKING
+WANT_AMFLOCK_LNLOCK_FALSE
+WANT_AMFLOCK_LNLOCK_TRUE
+WANT_AMFLOCK_LOCKF_FALSE
+WANT_AMFLOCK_LOCKF_TRUE
+WANT_AMFLOCK_FLOCK_FALSE
+WANT_AMFLOCK_FLOCK_TRUE
+WANT_AMFLOCK_POSIX_FALSE
+WANT_AMFLOCK_POSIX_TRUE
+WANT_SCSI_CHIO_FALSE
+WANT_SCSI_CHIO_TRUE
+WANT_SCSI_HPUX_FALSE
+WANT_SCSI_HPUX_TRUE
+WANT_CHG_SCSI_CHIO_FALSE
+WANT_CHG_SCSI_CHIO_TRUE
+WANT_SCSI_BSD_FALSE
+WANT_SCSI_BSD_TRUE
+WANT_SCSI_CAM_FALSE
+WANT_SCSI_CAM_TRUE
+WANT_SCSI_AIX_FALSE
+WANT_SCSI_AIX_TRUE
+WANT_SCSI_SOLARIS_FALSE
+WANT_SCSI_SOLARIS_TRUE
+WANT_SCSI_IRIX_FALSE
+WANT_SCSI_IRIX_TRUE
+WANT_SCSI_HPUX_NEW_FALSE
+WANT_SCSI_HPUX_NEW_TRUE
+WANT_SCSI_LINUX_FALSE
+WANT_SCSI_LINUX_TRUE
+WANT_CHG_SCSI_FALSE
+WANT_CHG_SCSI_TRUE
+MCUTIL
+MTX
+CHS
+CHIO
+GETCONF
+DEFAULT_AMANDATES_FILE
+DEFAULT_CHANGER_DEVICE
+EXAMPLE_TAPEDEV
+DEFAULT_TAPE_DEVICE
+DEFAULT_TAPE_SERVER
+DEFAULT_CONFIG
+DEFAULT_SERVER
+CONFIG_CLOBBER_MY_CONFIG
+DOC_BUILD_DATE
+XSLREL
+ENABLE_MANPAGE_BUILD_FALSE
+ENABLE_MANPAGE_BUILD_TRUE
+XSLTPROC
+XSLTPROC_FLAGS
+WANT_AMPLOT_FALSE
+WANT_AMPLOT_TRUE
+AMPLOT_CAT_PACK
+AMPLOT_CAT_COMPRESS
+AMPLOT_CAT_GZIP
+AMPLOT_COMPRESS
+GZIP
+COMPRESS
+PCAT
+GNUPLOT
+WANT_TAPE_FALSE
+WANT_TAPE_TRUE
+WANT_RECOVER_FALSE
+WANT_RECOVER_TRUE
+WANT_SERVER_FALSE
+WANT_SERVER_TRUE
+WANT_RESTORE_FALSE
+WANT_RESTORE_TRUE
+WANT_CLIENT_FALSE
+WANT_CLIENT_TRUE
+WANT_INSTALLPERMS_FALSE
+WANT_INSTALLPERMS_TRUE
+WANT_SETUID_CLIENT_FALSE
+WANT_SETUID_CLIENT_TRUE
+SERVICE_SUFFIX
+AMANDA_DEBUG_DAYS
+AMANDA_DBGDIR
+ASSERTIONS
+LOW_TCPPORTRANGE
+TCPPORTRANGE
+UDPPORTRANGE
+BINARY_OWNER
+CHECK_USERID
+AMANDA_TMPDIR
+GNUTAR_LISTED_INCREMENTAL_DIR
+USE_VERSION_SUFFIXES
+CONFIG_DIR
+SETUID_GROUP
+CLIENT_LOGIN
+AMANDA_WARNING_CFLAGS
+NEXT_WCHAR_H
+HAVE_WCHAR_H
+WCHAR_H
+REPLACE_WCWIDTH
+HAVE_DECL_WCWIDTH
+GNULIB_WCWIDTH
+HAVE_VISIBILITY
+CFLAG_VISIBILITY
+EOVERFLOW
+HAVE_UNISTD_H
+NEXT_UNISTD_H
+REPLACE_LSEEK
+REPLACE_LCHOWN
+REPLACE_GETPAGESIZE
+REPLACE_GETCWD
+REPLACE_FCHDIR
+REPLACE_CHOWN
+HAVE_SYS_PARAM_H
+HAVE_OS_H
+HAVE_DECL_GETLOGIN_R
+HAVE_DECL_ENVIRON
+HAVE_SLEEP
+HAVE_READLINK
+HAVE_GETPAGESIZE
+HAVE_FTRUNCATE
+HAVE_DUP2
+GNULIB_SLEEP
+GNULIB_READLINK
+GNULIB_LSEEK
+GNULIB_LCHOWN
+GNULIB_GETPAGESIZE
+GNULIB_GETLOGIN_R
+GNULIB_GETCWD
+GNULIB_FTRUNCATE
+GNULIB_FCHDIR
+GNULIB_ENVIRON
+GNULIB_DUP2
+GNULIB_CHOWN
+SYS_STAT_H
+NEXT_SYS_STAT_H
+HAVE_IO_H
+HAVE_DECL_MKDIR
+HAVE_LSTAT
+NEXT_STRING_H
+REPLACE_STRSTR
+REPLACE_STRCASESTR
+REPLACE_MEMMEM
+REPLACE_STRSIGNAL
+REPLACE_STRERROR
+HAVE_DECL_STRSIGNAL
+HAVE_DECL_STRERROR
+HAVE_DECL_STRTOK_R
+HAVE_STRCASESTR
+HAVE_STRSEP
+HAVE_STRPBRK
+HAVE_DECL_STRNLEN
+HAVE_DECL_STRNDUP
+HAVE_STRNDUP
+HAVE_DECL_STRDUP
+HAVE_STRCHRNUL
+HAVE_STPNCPY
+HAVE_STPCPY
+HAVE_DECL_MEMRCHR
+HAVE_MEMPCPY
+HAVE_DECL_MEMMEM
+GNULIB_STRSIGNAL
+GNULIB_STRERROR
+GNULIB_MBSTOK_R
+GNULIB_MBSSEP
+GNULIB_MBSSPN
+GNULIB_MBSPBRK
+GNULIB_MBSCSPN
+GNULIB_MBSCASESTR
+GNULIB_MBSPCASECMP
+GNULIB_MBSNCASECMP
+GNULIB_MBSCASECMP
+GNULIB_MBSSTR
+GNULIB_MBSRCHR
+GNULIB_MBSCHR
+GNULIB_MBSNLEN
+GNULIB_MBSLEN
+GNULIB_STRTOK_R
+GNULIB_STRCASESTR
+GNULIB_STRSTR
+GNULIB_STRSEP
+GNULIB_STRPBRK
+GNULIB_STRNLEN
+GNULIB_STRNDUP
+GNULIB_STRDUP
+GNULIB_STRCHRNUL
+GNULIB_STPNCPY
+GNULIB_STPCPY
+GNULIB_MEMRCHR
+GNULIB_MEMPCPY
+GNULIB_MEMMEM
+NEXT_STDLIB_H
+NEXT_STDIO_H
+STDINT_H
+WINT_T_SUFFIX
+WCHAR_T_SUFFIX
+SIZE_T_SUFFIX
+SIG_ATOMIC_T_SUFFIX
+PTRDIFF_T_SUFFIX
+HAVE_SIGNED_WINT_T
+HAVE_SIGNED_WCHAR_T
+HAVE_SIGNED_SIG_ATOMIC_T
+BITSIZEOF_WINT_T
+BITSIZEOF_WCHAR_T
+BITSIZEOF_SIZE_T
+BITSIZEOF_SIG_ATOMIC_T
+BITSIZEOF_PTRDIFF_T
+HAVE_SYS_BITYPES_H
+HAVE_SYS_INTTYPES_H
+HAVE_STDINT_H
+NEXT_STDINT_H
+HAVE_SYS_TYPES_H
+HAVE_INTTYPES_H
+HAVE_UNSIGNED_LONG_LONG_INT
+HAVE_LONG_LONG_INT
+HAVE__BOOL
+STDBOOL_H
+REPLACE_GETLINE
+HAVE_DECL_GETLINE
+HAVE_DECL_GETDELIM
+REPLACE_FFLUSH
+REPLACE_FTELL
+REPLACE_FTELLO
+HAVE_FTELLO
+REPLACE_FSEEK
+REPLACE_FSEEKO
+HAVE_FSEEKO
+REPLACE_FREOPEN
+REPLACE_FOPEN
+REPLACE_VASPRINTF
+HAVE_VASPRINTF
+REPLACE_VSPRINTF
+REPLACE_SPRINTF
+HAVE_DECL_VSNPRINTF
+REPLACE_VSNPRINTF
+HAVE_DECL_SNPRINTF
+REPLACE_SNPRINTF
+REPLACE_VPRINTF
+REPLACE_PRINTF
+REPLACE_VFPRINTF
+REPLACE_FPRINTF
+GNULIB_GETLINE
+GNULIB_GETDELIM
+GNULIB_FFLUSH
+GNULIB_FTELLO
+GNULIB_FTELL
+GNULIB_FSEEKO
+GNULIB_FSEEK
+GNULIB_FREOPEN
+GNULIB_FOPEN
+GNULIB_VASPRINTF
+GNULIB_VSPRINTF_POSIX
+GNULIB_VSNPRINTF
+GNULIB_VPRINTF_POSIX
+GNULIB_VFPRINTF_POSIX
+GNULIB_SPRINTF_POSIX
+GNULIB_SNPRINTF
+GNULIB_PRINTF_POSIX
+GNULIB_FPRINTF_POSIX
+NETINET_IN_H
+HAVE_NETINET_IN_H
+NEXT_NETINET_IN_H
+VOID_UNSETENV
+REPLACE_PUTENV
+REPLACE_MKSTEMP
+HAVE_UNSETENV
+HAVE_SETENV
+HAVE_REALLOC_POSIX
+HAVE_MKDTEMP
+HAVE_GETSUBOPT
+HAVE_CALLOC_POSIX
+GNULIB_UNSETENV
+GNULIB_SETENV
+GNULIB_PUTENV
+GNULIB_MKSTEMP
+GNULIB_MKDTEMP
+GNULIB_GETSUBOPT
+GNULIB_CALLOC_POSIX
+GNULIB_REALLOC_POSIX
+GNULIB_MALLOC_POSIX
+HAVE_MALLOC_POSIX
+LTLIBMULTITHREAD
+LIBMULTITHREAD
+LTLIBTHREAD
+LIBTHREAD
+LTLIBPTH
+LIBPTH
+SYS_TIME_H
+REPLACE_GETTIMEOFDAY
+HAVE_STRUCT_TIMEVAL
+HAVE_SYS_TIME_H
+NEXT_SYS_TIME_H
+LTLIBINTL
+LIBINTL
+GETOPT_H
+SYS_SOCKET_H
+HAVE_WS2TCPIP_H
+HAVE_WINSOCK2_H
+HAVE_SYS_SOCKET_H
+NEXT_SYS_SOCKET_H
+FLOAT_H
+NEXT_FLOAT_H
+INCLUDE_NEXT
+ARPA_INET_H
+ALLOCA_H
+ALLOCA
+GL_COND_LIBTOOL_FALSE
+GL_COND_LIBTOOL_TRUE
+EGREP
+GREP
+CPP
+RANLIB
+am__fastdepCC_FALSE
+am__fastdepCC_TRUE
+CCDEPMODE
+AMDEPBACKSLASH
+AMDEP_FALSE
+AMDEP_TRUE
+am__quote
+am__include
+DEPDIR
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+VERSION_SUFFIX
+VERSION_COMMENT
+VERSION_PATCH
+VERSION_MINOR
+VERSION_MAJOR
+SNAPSHOT_STAMP
+am__untar
+am__tar
+AMTAR
+am__leading_dot
+SET_MAKE
+AWK
+mkdir_p
+MKDIR_P
+INSTALL_STRIP_PROGRAM
+STRIP
+install_sh
+MAKEINFO
+AUTOHEADER
+AUTOMAKE
+AUTOCONF
+ACLOCAL
+VERSION
+CYGPATH_W
+am__isrc
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+PACKAGE
+target_os
+target_vendor
+target_cpu
+target
+host_os
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
+ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_dependency_tracking
+enable_threads
+with_gnu_ld
+enable_rpath
+with_libpth_prefix
+enable_largefile
+with_cflags
+with_includes
+with_libraries
+with_user
+with_group
+with_dumperdir
+with_configdir
+with_indexdir
+with_dbdir
+with_logdir
+with_suffixes
+with_gnutar_listdir
+with_gnutar_listed_incremental
+with_tmpdir
+with_force_uid
+with_owner
+with_fqdn
+with_reuseports
+with_low_tcpportrange
+with_tcpportrange
+with_udpportrange
+with_buffered_dump
+with_maxtapeblocksize
+with_assertions
+with_debugging
+with_debug_days
+with_testing
+with_single_userid
+enable_installperms
+with_server
+with_client
+with_restore
+with_amrecover
+with_client_only
+with_server_only
+with_gnuplot
+enable_manpage_build
+with_xsltproc
+with_xsltproc_flags
+with_index_server
+with_config
+with_tape_server
+with_tape_device
+with_changer_device
+with_amandates
+with_perlextlibs
+with_ipv6
+with_mmap
+with_amlibdir
+with_amlibexecdir
+with_amperldir
+with_amdatadir
+enable_nls
+with_libiconv_prefix
+with_libintl_prefix
+with_libcurl
+enable_s3_device
+with_bsd_security
+with_amandahosts
+with_bsdtcp_security
+with_bsdudp_security
+with_rsh_security
+with_ssh_security
+with_ssh_options
+with_krb4_security
+with_server_principal
+with_server_instance
+with_server_keyfile
+with_client_principal
+with_client_instance
+with_client_keyfile
+with_ticket_lifetime
+with_krb5_security
+with_dump_honor_nodump
+with_gnutar
+with_smbclient
+with_samba_user
+with_rundump
+enable_shared
+enable_static
+enable_fast_install
+enable_libtool_lock
+with_pic
+with_tags
+enable_static_binary
+enable_glibtest
+with_readline
+'
+      ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP
 GNUPLOT
 SWIG
 PERL
@@ -1280,6 +1461,8 @@ PKG_CONFIG'
 # Initialize some variables set by options.
 ac_init_help=
 ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
 # The variables have the same names as the options, with
 # dashes changed to underlines.
 cache_file=/dev/null
@@ -1378,13 +1561,21 @@ do
     datarootdir=$ac_optarg ;;
 
   -disable-* | --disable-*)
-    ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    ac_useropt=`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
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
    { (exit 1); exit 1; }; }
-    ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
-    eval enable_$ac_feature=no ;;
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"enable_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+        ac_unrecognized_sep=', ';;
+    esac
+    eval enable_$ac_useropt=no ;;
 
   -docdir | --docdir | --docdi | --doc | --do)
     ac_prev=docdir ;;
@@ -1397,13 +1588,21 @@ do
     dvidir=$ac_optarg ;;
 
   -enable-* | --enable-*)
-    ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    ac_useropt=`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
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
    { (exit 1); exit 1; }; }
-    ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
-    eval enable_$ac_feature=\$ac_optarg ;;
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"enable_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+        ac_unrecognized_sep=', ';;
+    esac
+    eval enable_$ac_useropt=\$ac_optarg ;;
 
   -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
   | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
@@ -1594,22 +1793,38 @@ do
     ac_init_version=: ;;
 
   -with-* | --with-*)
-    ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    ac_useropt=`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
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2
    { (exit 1); exit 1; }; }
-    ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
-    eval with_$ac_package=\$ac_optarg ;;
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"with_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+        ac_unrecognized_sep=', ';;
+    esac
+    eval with_$ac_useropt=\$ac_optarg ;;
 
   -without-* | --without-*)
-    ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    ac_useropt=`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
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2
    { (exit 1); exit 1; }; }
-    ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
-    eval with_$ac_package=no ;;
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"with_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+        ac_unrecognized_sep=', ';;
+    esac
+    eval with_$ac_useropt=no ;;
 
   --x)
     # Obsolete; use --with-x.
@@ -1629,7 +1844,7 @@ do
   | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
     x_libraries=$ac_optarg ;;
 
-  -*) { echo "$as_me: error: unrecognized option: $ac_option
+  -*) { $as_echo "$as_me: error: unrecognized option: $ac_option
 Try \`$0 --help' for more information." >&2
    { (exit 1); exit 1; }; }
     ;;
@@ -1638,16 +1853,16 @@ Try \`$0 --help' for more information." >&2
     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
+      { $as_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
+    $as_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
+      $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
     : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
     ;;
 
@@ -1656,22 +1871,38 @@ 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
+  { $as_echo "$as_me: error: missing argument to $ac_option" >&2
    { (exit 1); exit 1; }; }
 fi
 
-# Be sure to have absolute directory names.
+if test -n "$ac_unrecognized_opts"; then
+  case $enable_option_checking in
+    no) ;;
+    fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2
+   { (exit 1); exit 1; }; } ;;
+    *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+  esac
+fi
+
+# Check all directory arguments for consistency.
 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
+  # Remove trailing slashes.
+  case $ac_val in
+    */ )
+      ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+      eval $ac_var=\$ac_val;;
+  esac
+  # Be sure to have absolute directory names.
   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
+  { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
    { (exit 1); exit 1; }; }
 done
 
@@ -1686,7 +1917,7 @@ target=$target_alias
 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.
+    $as_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
@@ -1702,10 +1933,10 @@ 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
+  { $as_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
+  { $as_echo "$as_me: error: pwd does not report name of working directory" >&2
    { (exit 1); exit 1; }; }
 
 
@@ -1713,12 +1944,12 @@ test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
 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" |
+  ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_myself" : 'X\(//\)[^/]' \| \
+        X"$as_myself" : 'X\(//\)$' \| \
+        X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
            s//\1/
            q
@@ -1745,12 +1976,12 @@ else
 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
+  { $as_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
+       cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2
    { (exit 1); exit 1; }; }
        pwd)`
 # When building in place, set srcdir=.
@@ -1799,9 +2030,9 @@ Configuration:
 
 Installation directories:
   --prefix=PREFIX         install architecture-independent files in PREFIX
-                         [$ac_default_prefix]
+                          [$ac_default_prefix]
   --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
-                         [PREFIX]
+                          [PREFIX]
 
 By default, \`make install' will install all the files in
 \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
@@ -1811,25 +2042,25 @@ 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/PACKAGE]
-  --htmldir=DIR          html documentation [DOCDIR]
-  --dvidir=DIR           dvi documentation [DOCDIR]
-  --pdfdir=DIR           pdf documentation [DOCDIR]
-  --psdir=DIR            ps documentation [DOCDIR]
+  --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/PACKAGE]
+  --htmldir=DIR           html documentation [DOCDIR]
+  --dvidir=DIR            dvi documentation [DOCDIR]
+  --pdfdir=DIR            pdf documentation [DOCDIR]
+  --psdir=DIR             ps documentation [DOCDIR]
 _ACEOF
 
   cat <<\_ACEOF
@@ -1851,6 +2082,7 @@ if test -n "$ac_init_help"; then
   cat <<\_ACEOF
 
 Optional Features:
+  --disable-option-checking  ignore unrecognized --enable/--with options
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
   --disable-dependency-tracking  speeds up one-time build
@@ -1866,7 +2098,6 @@ Optional Features:
                           manpages are usually sufficient)
   --disable-nls           do not use Native Language Support
   --disable-s3-device     disable the S3 device
-  --enable-devpay         Use devpay authentication for Amazon S3 driver
   --enable-shared[=PKGS]  build shared libraries [default=yes]
   --enable-static[=PKGS]  build static libraries [default=yes]
   --enable-fast-install[=PKGS]
@@ -1890,8 +2121,7 @@ Optional Packages:
   --with-user=USER        force execution to USER on client systems (REQUIRED)
   --with-group=GROUP      group allowed to execute setuid-root programs
                           (REQUIRED)
-  --with-dumperdir=DIR    where we install the dumpers (default:
-                          exec_prefix/dumper)
+  --with-dumperdir=DIR    where we install the dumpers (deprecated)
   --with-configdir=DIR    runtime config files in DIR [sysconfdir/amanda]
   --with-indexdir         deprecated: use indexdir in amanda.conf
   --with-dbdir            deprecated: use infofile in amanda.conf
@@ -1921,8 +2151,7 @@ Optional Packages:
                           bind reserved UDP server sockets to ports within
                           this range (default: unlimited)
   --with-buffered-dump    buffer the dumping sockets on the server for speed
-  --with-maxtapeblocksize=kb
-                          Maximum size of a tape block (default: 32)
+(deprecated)
   --with-assertions       compile assertions into code
   --with-debugging=DIR
             put debug logs in DIR (default same as --with-tmpdir)
@@ -1940,7 +2169,7 @@ Optional Packages:
   --with-client-only      deprecated: use --without-server
   --with-server-only      deprecated: use --without-client
   --with-gnuplot=PATH     use gnuplot executable at PATH in amplot
-  --with-xsltproc[=PATH]
+  --with-xsltproc[[[=PATH]]]
                           Use the xsltproc binary in in PATH.
     --with-xsltproc-flags=FLAGS
                           Flags to pass to xsltproc (default --nonet)
@@ -1959,17 +2188,20 @@ Optional Packages:
   --with-ipv6             enable IPv6 support (default if IPv6 is found)
          --without-ipv6          disable IPv6
   --with-mmap             force use of mmap instead of shared memory support
-  --with-amlibdir[=PATH]
+  --with-amlibdir[[[=PATH]]]
                           Where library are installed, default: $libdir/amanda
          --without-amlibdir      Library are installed in $libdir
-  --with-amlibexecdir[=PATH]
+  --with-amlibexecdir[[[=PATH]]]
                           Where amanda own programs are installed, default:
                           $libexecdir/amanda
          --without-amlibexecdir  Amanda own programs are installed in $libexecdir
-  --with-amperldir[=PATH]
+  --with-amperldir[[[=PATH]]]
                           Where amanda's perl modules are installed; default:
                           installsitelib
          --without-amperldir     Install amanda's perl modules in $amlibdir/perl
+  --with-amdatadir[[[=PATH]]]
+                          Where amanda's templates and examples are installed;
+                          default: $datadir/amanda
   --with-libiconv-prefix[=DIR]  search for libiconv in DIR/include and DIR/lib
   --without-libiconv-prefix     don't search for libiconv in includedir and libdir
   --with-libintl-prefix[=DIR]  search for libintl in DIR/include and DIR/lib
@@ -2051,15 +2283,17 @@ 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
+    test -d "$ac_dir" ||
+      { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && 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,^\.[\\/],,'`
+  ac_dir_suffix=/`$as_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,/,,'`
+  ac_top_builddir_sub=`$as_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/ ;;
@@ -2095,7 +2329,7 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
       echo &&
       $SHELL "$ac_srcdir/configure" --help=recursive
     else
-      echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+      $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
     fi || ac_status=$?
     cd "$ac_pwd" || { ac_status=$?; break; }
   done
@@ -2105,10 +2339,10 @@ test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
 configure
-generated by GNU Autoconf 2.61
+generated by GNU Autoconf 2.63
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 _ACEOF
@@ -2119,7 +2353,7 @@ This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
 It was created by $as_me, which was
-generated by GNU Autoconf 2.61.  Invocation command line was
+generated by GNU Autoconf 2.63.  Invocation command line was
 
   $ $0 $@
 
@@ -2155,7 +2389,7 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  echo "PATH: $as_dir"
+  $as_echo "PATH: $as_dir"
 done
 IFS=$as_save_IFS
 
@@ -2190,7 +2424,7 @@ do
     | -silent | --silent | --silen | --sile | --sil)
       continue ;;
     *\'*)
-      ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+      ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
     esac
     case $ac_pass in
     1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
@@ -2242,11 +2476,12 @@ _ASBOX
     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;} ;;
+      *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
       esac
       case $ac_var in #(
       _ | IFS | as_nl) ;; #(
+      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
       *) $as_unset $ac_var ;;
       esac ;;
     esac
@@ -2276,9 +2511,9 @@ _ASBOX
     do
       eval ac_val=\$$ac_var
       case $ac_val in
-      *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+      *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
       esac
-      echo "$ac_var='\''$ac_val'\''"
+      $as_echo "$ac_var='\''$ac_val'\''"
     done | sort
     echo
 
@@ -2293,9 +2528,9 @@ _ASBOX
       do
        eval ac_val=\$$ac_var
        case $ac_val in
-       *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+       *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
        esac
-       echo "$ac_var='\''$ac_val'\''"
+       $as_echo "$ac_var='\''$ac_val'\''"
       done | sort
       echo
     fi
@@ -2311,8 +2546,8 @@ _ASBOX
       echo
     fi
     test "$ac_signal" != 0 &&
-      echo "$as_me: caught signal $ac_signal"
-    echo "$as_me: exit $exit_status"
+      $as_echo "$as_me: caught signal $ac_signal"
+    $as_echo "$as_me: exit $exit_status"
   } >&5
   rm -f core *.core core.conftest.* &&
     rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
@@ -2354,21 +2589,24 @@ _ACEOF
 
 
 # Let the site file select an alternate cache file if it wants to.
-# Prefer explicitly selected file to automatically selected ones.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
 if test -n "$CONFIG_SITE"; then
-  set x "$CONFIG_SITE"
+  ac_site_file1=$CONFIG_SITE
 elif test "x$prefix" != xNONE; then
-  set x "$prefix/share/config.site" "$prefix/etc/config.site"
+  ac_site_file1=$prefix/share/config.site
+  ac_site_file2=$prefix/etc/config.site
 else
-  set x "$ac_default_prefix/share/config.site" \
-       "$ac_default_prefix/etc/config.site"
+  ac_site_file1=$ac_default_prefix/share/config.site
+  ac_site_file2=$ac_default_prefix/etc/config.site
 fi
-shift
-for ac_site_file
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
 do
+  test "x$ac_site_file" = xNONE && continue
   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;}
+    { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
     sed 's/^/| /' "$ac_site_file" >&5
     . "$ac_site_file"
   fi
@@ -2378,16 +2616,16 @@ 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;}
+    { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5
+$as_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;}
+  { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
   >$cache_file
 fi
 
@@ -2420,29 +2658,38 @@ for ac_var in $ac_precious_vars; do
   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;}
+      { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_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;}
+      { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+$as_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=:
+       # differences in whitespace do not lead to failure.
+       ac_old_val_w=`echo x $ac_old_val`
+       ac_new_val_w=`echo x $ac_new_val`
+       if test "$ac_old_val_w" != "$ac_new_val_w"; then
+         { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+         ac_cache_corrupted=:
+       else
+         { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+         eval $ac_var=\$ac_old_val
+       fi
+       { $as_echo "$as_me:$LINENO:   former value:  \`$ac_old_val'" >&5
+$as_echo "$as_me:   former value:  \`$ac_old_val'" >&2;}
+       { $as_echo "$as_me:$LINENO:   current value: \`$ac_new_val'" >&5
+$as_echo "$as_me:   current value: \`$ac_new_val'" >&2;}
       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=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
     *) ac_arg=$ac_var=$ac_new_val ;;
     esac
     case " $ac_configure_args " in
@@ -2452,10 +2699,12 @@ echo "$as_me:   current value: $ac_new_val" >&2;}
   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;}
+  { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+  { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
    { (exit 1); exit 1; }; }
 fi
 
@@ -2500,8 +2749,8 @@ for ac_dir in config "$srcdir"/config; do
   fi
 done
 if test -z "$ac_aux_dir"; then
-  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in config \"$srcdir\"/config" >&5
-echo "$as_me: error: cannot find install-sh or install.sh in config \"$srcdir\"/config" >&2;}
+  { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in config \"$srcdir\"/config" >&5
+$as_echo "$as_me: error: cannot find install-sh or install.sh in config \"$srcdir\"/config" >&2;}
    { (exit 1); exit 1; }; }
 fi
 
@@ -2516,34 +2765,34 @@ ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
 
 # 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;}
+  { { $as_echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
+$as_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; }
+{ $as_echo "$as_me:$LINENO: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
 if test "${ac_cv_build+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&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;}
+  { { $as_echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+$as_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;}
+  { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
+$as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+$as_echo "$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;}
+*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
+$as_echo "$as_me: error: invalid value of canonical build" >&2;}
    { (exit 1); exit 1; }; };;
 esac
 build=$ac_cv_build
@@ -2560,27 +2809,27 @@ 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; }
+{ $as_echo "$as_me:$LINENO: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
 if test "${ac_cv_host+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&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;}
+    { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
+$as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+$as_echo "$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;}
+*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
+$as_echo "$as_me: error: invalid value of canonical host" >&2;}
    { (exit 1); exit 1; }; };;
 esac
 host=$ac_cv_host
@@ -2597,27 +2846,27 @@ IFS=$ac_save_IFS
 case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
 
 
-{ echo "$as_me:$LINENO: checking target system type" >&5
-echo $ECHO_N "checking target system type... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking target system type" >&5
+$as_echo_n "checking target system type... " >&6; }
 if test "${ac_cv_target+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test "x$target_alias" = x; then
   ac_cv_target=$ac_cv_host
 else
   ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` ||
-    { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&5
-echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&2;}
+    { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&5
+$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&2;}
    { (exit 1); exit 1; }; }
 fi
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_target" >&5
-echo "${ECHO_T}$ac_cv_target" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_target" >&5
+$as_echo "$ac_cv_target" >&6; }
 case $ac_cv_target in
 *-*-*) ;;
-*) { { echo "$as_me:$LINENO: error: invalid value of canonical target" >&5
-echo "$as_me: error: invalid value of canonical target" >&2;}
+*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical target" >&5
+$as_echo "$as_me: error: invalid value of canonical target" >&2;}
    { (exit 1); exit 1; }; };;
 esac
 target=$ac_cv_target
@@ -2659,11 +2908,12 @@ am__api_version='1.10'
 # 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; }
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
 if test -z "$INSTALL"; then
 if test "${ac_cv_path_install+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
@@ -2692,17 +2942,29 @@ case $as_dir/ in
            # 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
+           rm -rf conftest.one conftest.two conftest.dir
+           echo one > conftest.one
+           echo two > conftest.two
+           mkdir conftest.dir
+           if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+             test -s conftest.one && test -s conftest.two &&
+             test -s conftest.dir/conftest.one &&
+             test -s conftest.dir/conftest.two
+           then
+             ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+             break 3
+           fi
          fi
        fi
       done
     done
     ;;
 esac
+
 done
 IFS=$as_save_IFS
 
+rm -rf conftest.one conftest.two conftest.dir
 
 fi
   if test "${ac_cv_path_install+set}" = set; then
@@ -2715,8 +2977,8 @@ fi
     INSTALL=$ac_install_sh
   fi
 fi
-{ echo "$as_me:$LINENO: result: $INSTALL" >&5
-echo "${ECHO_T}$INSTALL" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
 
 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
 # It thinks the first close brace ends the variable substitution.
@@ -2726,8 +2988,8 @@ 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; }
+{ $as_echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+$as_echo_n "checking whether build environment is sane... " >&6; }
 # Just in case
 sleep 1
 echo timestamp > conftest.file
@@ -2750,9 +3012,9 @@ if (
       # 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
+      { { $as_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
+$as_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
@@ -2763,26 +3025,23 @@ then
    # Ok.
    :
 else
-   { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
+   { { $as_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!
+$as_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; }
+{ $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "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.
+# Double any \ or $.
 # 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
+ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
+program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
 
 # expand $ac_aux_dir to an absolute path
 am_aux_dir=`cd $ac_aux_dir && pwd`
@@ -2793,15 +3052,15 @@ 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;}
+  { $as_echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
 fi
 
-{ echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5
-echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5
+$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
 if test -z "$MKDIR_P"; then
   if test "${ac_cv_path_mkdir+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
@@ -2836,8 +3095,8 @@ fi
     MKDIR_P="$ac_install_sh -d"
   fi
 fi
-{ echo "$as_me:$LINENO: result: $MKDIR_P" >&5
-echo "${ECHO_T}$MKDIR_P" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
 
 mkdir_p="$MKDIR_P"
 case $mkdir_p in
@@ -2849,10 +3108,10 @@ 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; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_prog_AWK+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$AWK"; then
   ac_cv_prog_AWK="$AWK" # Let the user override the test.
@@ -2865,7 +3124,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -2876,22 +3135,23 @@ fi
 fi
 AWK=$ac_cv_prog_AWK
 if test -n "$AWK"; then
-  { echo "$as_me:$LINENO: result: $AWK" >&5
-echo "${ECHO_T}$AWK" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "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'`
+{ $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_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
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.make <<\_ACEOF
 SHELL = /bin/sh
@@ -2908,12 +3168,12 @@ 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; }
+  { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
   SET_MAKE=
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
   SET_MAKE="MAKE=${MAKE-make}"
 fi
 
@@ -2932,8 +3192,8 @@ if test "`cd $srcdir && pwd`" != "`pwd`"; then
   am__isrc=' -I$(srcdir)'
   # test to see if srcdir already configured
   if 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;}
+    { { $as_echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
+$as_echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
    { (exit 1); exit 1; }; }
   fi
 fi
@@ -2950,7 +3210,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE=amanda
- VERSION="2.6.0p2"
+ VERSION="2.6.1"
 
 
 cat >>confdefs.h <<_ACEOF
@@ -2988,10 +3248,10 @@ 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; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_prog_STRIP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$STRIP"; then
   ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
@@ -3004,7 +3264,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -3015,11 +3275,11 @@ fi
 fi
 STRIP=$ac_cv_prog_STRIP
 if test -n "$STRIP"; then
-  { echo "$as_me:$LINENO: result: $STRIP" >&5
-echo "${ECHO_T}$STRIP" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -3028,10 +3288,10 @@ 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; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_STRIP"; then
   ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
@@ -3044,7 +3304,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -3055,11 +3315,11 @@ 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; }
+  { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
   if test "x$ac_ct_STRIP" = x; then
@@ -3067,12 +3327,8 @@ fi
   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;}
+{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
     STRIP=$ac_ct_STRIP
@@ -3156,10 +3412,10 @@ 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; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_prog_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -3172,7 +3428,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -3183,11 +3439,11 @@ fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $CC" >&5
+$as_echo "$CC" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -3196,10 +3452,10 @@ 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; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
   ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
@@ -3212,7 +3468,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -3223,11 +3479,11 @@ 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; }
+  { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
   if test "x$ac_ct_CC" = x; then
@@ -3235,12 +3491,8 @@ fi
   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;}
+{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
     CC=$ac_ct_CC
@@ -3253,10 +3505,10 @@ 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; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_prog_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -3269,7 +3521,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -3280,11 +3532,11 @@ fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $CC" >&5
+$as_echo "$CC" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -3293,10 +3545,10 @@ 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; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_prog_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -3314,7 +3566,7 @@ do
        continue
      fi
     ac_cv_prog_CC="cc"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -3337,11 +3589,11 @@ fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $CC" >&5
+$as_echo "$CC" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -3352,10 +3604,10 @@ if test -z "$CC"; then
   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; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_prog_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -3368,7 +3620,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -3379,11 +3631,11 @@ fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $CC" >&5
+$as_echo "$CC" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -3396,10 +3648,10 @@ if test -z "$CC"; then
 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; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
   ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
@@ -3412,7 +3664,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -3423,11 +3675,11 @@ 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; }
+  { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -3439,12 +3691,8 @@ done
   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;}
+{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
     CC=$ac_ct_CC
@@ -3454,44 +3702,50 @@ fi
 fi
 
 
-test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_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
+$as_echo "$as_me: error: no acceptable C compiler found in \$PATH
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (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`
+$as_echo "$as_me:$LINENO: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$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_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_compiler --version >&5") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_compiler -v >&5") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_compiler -V >&5") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }
 
 cat >conftest.$ac_ext <<_ACEOF
@@ -3510,27 +3764,22 @@ main ()
 }
 _ACEOF
 ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.exe b.out"
+ac_clean_files="$ac_clean_files a.out a.out.dSYM 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.
+{ $as_echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
 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_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
     * ) ac_rmfiles="$ac_rmfiles $ac_file";;
   esac
 done
@@ -3541,10 +3790,11 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_link_default") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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'
@@ -3555,7 +3805,7 @@ 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 )
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
        ;;
     [ab].out )
        # We found the default executable, but exeext='' is most
@@ -3582,25 +3832,27 @@ else
   ac_file=''
 fi
 
-{ echo "$as_me:$LINENO: result: $ac_file" >&5
-echo "${ECHO_T}$ac_file" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
 if test -z "$ac_file"; then
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_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
+$as_echo "$as_me: error: C compiler cannot create executables
 See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
+   { (exit 77); exit 77; }; }; }
 fi
 
 ac_exeext=$ac_cv_exeext
 
 # 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; }
+{ $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&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
@@ -3609,49 +3861,53 @@ if test "$cross_compiling" != yes; then
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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.
+       { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_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.
+$as_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; }; }
+   { (exit 1); exit 1; }; }; }
     fi
   fi
 fi
-{ echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+{ $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
 
-rm -f a.out a.exe conftest$ac_cv_exeext b.out
+rm -f -r a.out a.out.dSYM 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; }
+{ $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+{ $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
 
-{ echo "$as_me:$LINENO: checking for suffix of executables" >&5
-echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&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_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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
@@ -3660,31 +3916,33 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
 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_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.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
+  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_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
+$as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
 if test "${ac_cv_objext+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -3707,40 +3965,43 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_compile") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
     *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
        break;;
   esac
 done
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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
+{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_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
+$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
 if test "${ac_cv_c_compiler_gnu+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -3766,20 +4027,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_compiler_gnu=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_compiler_gnu=no
@@ -3789,15 +4051,19 @@ 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`
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GCC=yes
+else
+  GCC=
+fi
 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; }
+{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
 if test "${ac_cv_prog_cc_g+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_save_c_werror_flag=$ac_c_werror_flag
    ac_c_werror_flag=yes
@@ -3824,20 +4090,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_prog_cc_g=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        CFLAGS=""
@@ -3862,20 +4129,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   :
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_c_werror_flag=$ac_save_c_werror_flag
@@ -3901,20 +4169,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_prog_cc_g=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
@@ -3929,8 +4198,8 @@ 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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$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
@@ -3946,10 +4215,10 @@ 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; }
+{ $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
 if test "${ac_cv_prog_cc_c89+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_cv_prog_cc_c89=no
 ac_save_CC=$CC
@@ -4020,20 +4289,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_prog_cc_c89=$ac_arg
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
@@ -4049,15 +4319,15 @@ 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; } ;;
+    { $as_echo "$as_me:$LINENO: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
   xno)
-    { echo "$as_me:$LINENO: result: unsupported" >&5
-echo "${ECHO_T}unsupported" >&6; } ;;
+    { $as_echo "$as_me:$LINENO: result: unsupported" >&5
+$as_echo "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; } ;;
+    { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
 esac
 
 
@@ -4078,8 +4348,8 @@ am__doit:
 .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; }
+{ $as_echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
+$as_echo_n "checking for style of include used by $am_make... " >&6; }
 am__include="#"
 am__quote=
 _am_result=none
@@ -4106,8 +4376,8 @@ if test "$am__include" = "#"; then
 fi
 
 
-{ echo "$as_me:$LINENO: result: $_am_result" >&5
-echo "${ECHO_T}$_am_result" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $_am_result" >&5
+$as_echo "$_am_result" >&6; }
 rm -f confinc confmf
 
 # Check whether --enable-dependency-tracking was given.
@@ -4131,10 +4401,10 @@ fi
 
 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; }
+{ $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
 if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&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
@@ -4222,8 +4492,8 @@ else
 fi
 
 fi
-{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
-echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
 CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
 
  if
@@ -4240,10 +4510,10 @@ fi
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_prog_RANLIB+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$RANLIB"; then
   ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
@@ -4256,7 +4526,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -4267,11 +4537,11 @@ fi
 fi
 RANLIB=$ac_cv_prog_RANLIB
 if test -n "$RANLIB"; then
-  { echo "$as_me:$LINENO: result: $RANLIB" >&5
-echo "${ECHO_T}$RANLIB" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $RANLIB" >&5
+$as_echo "$RANLIB" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -4280,10 +4550,10 @@ if test -z "$ac_cv_prog_RANLIB"; then
   ac_ct_RANLIB=$RANLIB
   # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_RANLIB"; then
   ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
@@ -4296,7 +4566,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_RANLIB="ranlib"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -4307,11 +4577,11 @@ fi
 fi
 ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
 if test -n "$ac_ct_RANLIB"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
-echo "${ECHO_T}$ac_ct_RANLIB" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+$as_echo "$ac_ct_RANLIB" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
   if test "x$ac_ct_RANLIB" = x; then
@@ -4319,12 +4589,8 @@ fi
   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;}
+{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
     RANLIB=$ac_ct_RANLIB
@@ -4334,26 +4600,20 @@ else
 fi
 
 
-cat >>confdefs.h <<\_ACEOF
-#define _GNU_SOURCE 1
-_ACEOF
-
-
-
 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
-{ 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; }
+{ $as_echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
 fi
 if test -z "$CPP"; then
   if test "${ac_cv_prog_CPP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
       # Double quotes because CPP needs to be expanded
     for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
@@ -4385,20 +4645,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
         test ! -s conftest.err
        }; then
   :
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
   # Broken: fails on valid input.
@@ -4422,13 +4683,14 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
         test ! -s conftest.err
@@ -4436,7 +4698,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   # Broken: success on invalid input.
 continue
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
   # Passes both tests.
@@ -4461,8 +4723,8 @@ fi
 else
   ac_cv_prog_CPP=$CPP
 fi
-{ echo "$as_me:$LINENO: result: $CPP" >&5
-echo "${ECHO_T}$CPP" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
 ac_preproc_ok=false
 for ac_c_preproc_warn_flag in '' yes
 do
@@ -4490,20 +4752,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
         test ! -s conftest.err
        }; then
   :
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
   # Broken: fails on valid input.
@@ -4527,13 +4790,14 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
         test ! -s conftest.err
@@ -4541,7 +4805,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   # Broken: success on invalid input.
 continue
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
   # Passes both tests.
@@ -4557,11 +4821,13 @@ rm -f conftest.err conftest.$ac_ext
 if $ac_preproc_ok; then
   :
 else
-  { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
 See \`config.log' for more details." >&5
-echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 fi
 
 ac_ext=c
@@ -4571,42 +4837,37 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_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; }
+{ $as_echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&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
+  $as_echo_n "(cached) " >&6
 else
+  if test -z "$GREP"; then
   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
+  # 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_test_x "$ac_path_GREP"; } || continue
-    # Check for GNU ac_path_GREP and select it if it is found.
+    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_test_x "$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"
+  $as_echo_n 0123456789 >"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"
+    $as_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`
@@ -4621,74 +4882,60 @@ case `"$ac_path_GREP" --version 2>&1` in
   rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
 esac
 
-
-    $ac_path_GREP_found && break 3
+      $ac_path_GREP_found && break 3
+    done
   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;}
+  if test -z "$ac_cv_path_GREP"; then
+    { { $as_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+$as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
    { (exit 1); exit 1; }; }
-fi
-
+  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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
 if test "${ac_cv_path_EGREP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&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
+     if test -z "$EGREP"; then
   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
+  # 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_test_x "$ac_path_EGREP"; } || continue
-    # Check for GNU ac_path_EGREP and select it if it is found.
+    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_test_x "$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"
+  $as_echo_n 0123456789 >"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"
+    $as_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`
@@ -4703,40 +4950,31 @@ case `"$ac_path_EGREP" --version 2>&1` in
   rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
 esac
 
-
-    $ac_path_EGREP_found && break 3
+      $ac_path_EGREP_found && break 3
+    done
   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;}
+  if test -z "$ac_cv_path_EGREP"; then
+    { { $as_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+$as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
    { (exit 1); exit 1; }; }
-fi
-
+  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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
 if test "${ac_cv_header_stdc+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -4763,20 +5001,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_header_stdc=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_header_stdc=no
@@ -4868,37 +5107,40 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
 ac_cv_header_stdc=no
 fi
+rm -rf conftest.dSYM
 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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
 if test $ac_cv_header_stdc = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -4920,11 +5162,11 @@ fi
 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; }
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -4942,20 +5184,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   eval "$as_ac_Header=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_Header=no"
@@ -4963,12 +5206,15 @@ 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
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -4978,17 +5224,17 @@ done
 
 
   if test "${ac_cv_header_minix_config_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for minix/config.h" >&5
-echo $ECHO_N "checking for minix/config.h... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for minix/config.h" >&5
+$as_echo_n "checking for minix/config.h... " >&6; }
 if test "${ac_cv_header_minix_config_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5
-echo "${ECHO_T}$ac_cv_header_minix_config_h" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5
+$as_echo "$ac_cv_header_minix_config_h" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking minix/config.h usability" >&5
-echo $ECHO_N "checking minix/config.h usability... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking minix/config.h usability" >&5
+$as_echo_n "checking minix/config.h usability... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -5004,32 +5250,33 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking minix/config.h presence" >&5
-echo $ECHO_N "checking minix/config.h presence... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking minix/config.h presence" >&5
+$as_echo_n "checking minix/config.h presence... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -5043,66 +5290,67 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
         test ! -s conftest.err
        }; then
   ac_header_preproc=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: minix/config.h: proceeding with the compiler's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: minix/config.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: minix/config.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: minix/config.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: minix/config.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: minix/config.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: minix/config.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: minix/config.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: minix/config.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: minix/config.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: minix/config.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: minix/config.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: minix/config.h: in the future, the compiler will take precedence" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: minix/config.h: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: minix/config.h:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: minix/config.h: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: minix/config.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: minix/config.h: proceeding with the preprocessor's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: minix/config.h: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for minix/config.h" >&5
-echo $ECHO_N "checking for minix/config.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for minix/config.h" >&5
+$as_echo_n "checking for minix/config.h... " >&6; }
 if test "${ac_cv_header_minix_config_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_cv_header_minix_config_h=$ac_header_preproc
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5
-echo "${ECHO_T}$ac_cv_header_minix_config_h" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5
+$as_echo "$ac_cv_header_minix_config_h" >&6; }
 
 fi
-if test $ac_cv_header_minix_config_h = yes; then
+if test "x$ac_cv_header_minix_config_h" = x""yes; then
   MINIX=yes
 else
   MINIX=
@@ -5129,10 +5377,10 @@ _ACEOF
 
 
 
-  { echo "$as_me:$LINENO: checking whether it is safe to define __EXTENSIONS__" >&5
-echo $ECHO_N "checking whether it is safe to define __EXTENSIONS__... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking whether it is safe to define __EXTENSIONS__" >&5
+$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; }
 if test "${ac_cv_safe_to_define___extensions__+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -5157,20 +5405,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_safe_to_define___extensions__=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_safe_to_define___extensions__=no
@@ -5178,8 +5427,8 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_safe_to_define___extensions__" >&5
-echo "${ECHO_T}$ac_cv_safe_to_define___extensions__" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_safe_to_define___extensions__" >&5
+$as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
   test $ac_cv_safe_to_define___extensions__ = yes &&
     cat >>confdefs.h <<\_ACEOF
 #define __EXTENSIONS__ 1
@@ -5251,10 +5500,10 @@ fi
 
 # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
 # for constant arguments.  Useless!
-{ echo "$as_me:$LINENO: checking for working alloca.h" >&5
-echo $ECHO_N "checking for working alloca.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for working alloca.h" >&5
+$as_echo_n "checking for working alloca.h... " >&6; }
 if test "${ac_cv_working_alloca_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -5278,31 +5527,35 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_working_alloca_h=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_working_alloca_h=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_working_alloca_h" >&5
-echo "${ECHO_T}$ac_cv_working_alloca_h" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_working_alloca_h" >&5
+$as_echo "$ac_cv_working_alloca_h" >&6; }
 if test $ac_cv_working_alloca_h = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -5311,10 +5564,10 @@ _ACEOF
 
 fi
 
-{ echo "$as_me:$LINENO: checking for alloca" >&5
-echo $ECHO_N "checking for alloca... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for alloca" >&5
+$as_echo_n "checking for alloca... " >&6; }
 if test "${ac_cv_func_alloca_works+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -5358,31 +5611,35 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_func_alloca_works=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_func_alloca_works=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_alloca_works" >&5
-echo "${ECHO_T}$ac_cv_func_alloca_works" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_alloca_works" >&5
+$as_echo "$ac_cv_func_alloca_works" >&6; }
 
 if test $ac_cv_func_alloca_works = yes; then
 
@@ -5396,6 +5653,10 @@ else
 # contain a buggy version.  If you still want to use their alloca,
 # use ar to extract alloca.o from them instead of compiling alloca.c.
 
+
+
+
+
 ALLOCA=\${LIBOBJDIR}alloca.$ac_objext
 
 cat >>confdefs.h <<\_ACEOF
@@ -5403,10 +5664,10 @@ cat >>confdefs.h <<\_ACEOF
 _ACEOF
 
 
-{ echo "$as_me:$LINENO: checking whether \`alloca.c' needs Cray hooks" >&5
-echo $ECHO_N "checking whether \`alloca.c' needs Cray hooks... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking whether \`alloca.c' needs Cray hooks" >&5
+$as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; }
 if test "${ac_cv_os_cray+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -5430,15 +5691,15 @@ fi
 rm -f conftest*
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_os_cray" >&5
-echo "${ECHO_T}$ac_cv_os_cray" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_os_cray" >&5
+$as_echo "$ac_cv_os_cray" >&6; }
 if test $ac_cv_os_cray = yes; then
   for ac_func in _getb67 GETB67 getb67; 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; }
+    as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -5491,33 +5752,40 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
 
 cat >>confdefs.h <<_ACEOF
 #define CRAY_STACKSEG_END $ac_func
@@ -5529,10 +5797,10 @@ fi
   done
 fi
 
-{ echo "$as_me:$LINENO: checking stack direction for C alloca" >&5
-echo $ECHO_N "checking stack direction for C alloca... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking stack direction for C alloca" >&5
+$as_echo_n "checking stack direction for C alloca... " >&6; }
 if test "${ac_cv_c_stack_direction+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test "$cross_compiling" = yes; then
   ac_cv_c_stack_direction=0
@@ -5570,36 +5838,39 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_c_stack_direction=1
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
 ac_cv_c_stack_direction=-1
 fi
+rm -rf conftest.dSYM
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5
-echo "${ECHO_T}$ac_cv_c_stack_direction" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5
+$as_echo "$ac_cv_c_stack_direction" >&6; }
 
 cat >>confdefs.h <<_ACEOF
 #define STACK_DIRECTION $ac_cv_c_stack_direction
@@ -5615,20 +5886,21 @@ fi
 
 for ac_header in $gl_header_list
 do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+as_ac_Header=`$as_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; }
+  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -5644,32 +5916,33 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -5683,69 +5956,73 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
         test ! -s conftest.err
        }; then
   ac_header_preproc=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&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; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
 
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
+as_val=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -5757,10 +6034,10 @@ done
 
 
 
-{ echo "$as_me:$LINENO: checking for inline" >&5
-echo $ECHO_N "checking for inline... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for inline" >&5
+$as_echo_n "checking for inline... " >&6; }
 if test "${ac_cv_c_inline+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_cv_c_inline=no
 for ac_kw in inline __inline__ __inline; do
@@ -5783,20 +6060,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_c_inline=$ac_kw
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
@@ -5807,8 +6085,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 done
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
-echo "${ECHO_T}$ac_cv_c_inline" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
+$as_echo "$ac_cv_c_inline" >&6; }
 
 
 case $ac_cv_c_inline in
@@ -5826,15 +6104,14 @@ _ACEOF
     ;;
 esac
 
-{ echo "$as_me:$LINENO: checking for C/C++ restrict keyword" >&5
-echo $ECHO_N "checking for C/C++ restrict keyword... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for C/C++ restrict keyword" >&5
+$as_echo_n "checking for C/C++ restrict keyword... " >&6; }
 if test "${ac_cv_c_restrict+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_cv_c_restrict=no
-   # Try the official restrict keyword, then gcc's __restrict, and
-   # the less common variants.
-   for ac_kw in restrict __restrict __restrict__ _Restrict; do
+   # The order here caters to the fact that C++ does not require restrict.
+   for ac_kw in __restrict __restrict__ _Restrict restrict; do
      cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -5842,16 +6119,16 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 typedef int * int_ptr;
-        int foo (int_ptr $ac_kw ip) {
-        return ip[0];
+       int foo (int_ptr $ac_kw ip) {
+       return ip[0];
        }
 int
 main ()
 {
 int s[1];
-        int * $ac_kw t = s;
-        t[0] = 0;
-        return foo(t)
+       int * $ac_kw t = s;
+       t[0] = 0;
+       return foo(t)
   ;
   return 0;
 }
@@ -5862,20 +6139,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_c_restrict=$ac_kw
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
@@ -5886,13 +6164,14 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    done
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_c_restrict" >&5
-echo "${ECHO_T}$ac_cv_c_restrict" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_restrict" >&5
+$as_echo "$ac_cv_c_restrict" >&6; }
+
+
  case $ac_cv_c_restrict in
    restrict) ;;
-   no)
-cat >>confdefs.h <<\_ACEOF
-#define restrict
+   no) cat >>confdefs.h <<\_ACEOF
+#define restrict /**/
 _ACEOF
  ;;
    *)  cat >>confdefs.h <<_ACEOF
@@ -5903,10 +6182,10 @@ _ACEOF
 
 
 
-  { echo "$as_me:$LINENO: checking whether the preprocessor supports include_next" >&5
-echo $ECHO_N "checking whether the preprocessor supports include_next... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking whether the preprocessor supports include_next" >&5
+$as_echo_n "checking whether the preprocessor supports include_next... " >&6; }
 if test "${gl_cv_have_include_next+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   rm -rf conftestd1 conftestd2
      mkdir conftestd1 conftestd2
@@ -5936,20 +6215,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   gl_cv_have_include_next=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        gl_cv_have_include_next=no
@@ -5960,8 +6240,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
      rm -rf conftestd1 conftestd2
 
 fi
-{ echo "$as_me:$LINENO: result: $gl_cv_have_include_next" >&5
-echo "${ECHO_T}$gl_cv_have_include_next" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gl_cv_have_include_next" >&5
+$as_echo "$gl_cv_have_include_next" >&6; }
   if test $gl_cv_have_include_next = yes; then
 
 
@@ -6007,10 +6287,10 @@ _ACEOF
 
 
 
-  { echo "$as_me:$LINENO: checking whether <sys/socket.h> is self-contained" >&5
-echo $ECHO_N "checking whether <sys/socket.h> is self-contained... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking whether <sys/socket.h> is self-contained" >&5
+$as_echo_n "checking whether <sys/socket.h> is self-contained... " >&6; }
 if test "${gl_cv_header_sys_socket_h_selfcontained+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
       cat >conftest.$ac_ext <<_ACEOF
@@ -6034,20 +6314,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   gl_cv_header_sys_socket_h_selfcontained=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        gl_cv_header_sys_socket_h_selfcontained=no
@@ -6056,8 +6337,8 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 fi
-{ echo "$as_me:$LINENO: result: $gl_cv_header_sys_socket_h_selfcontained" >&5
-echo "${ECHO_T}$gl_cv_header_sys_socket_h_selfcontained" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gl_cv_header_sys_socket_h_selfcontained" >&5
+$as_echo "$gl_cv_header_sys_socket_h_selfcontained" >&6; }
   if test $gl_cv_header_sys_socket_h_selfcontained = yes; then
     SYS_SOCKET_H=''
   else
@@ -6077,10 +6358,10 @@ echo "${ECHO_T}$gl_cv_header_sys_socket_h_selfcontained" >&6; }
      if test $gl_cv_have_include_next = yes; then
        gl_cv_next_sys_socket_h='<'sys/socket.h'>'
      else
-       { echo "$as_me:$LINENO: checking absolute name of <sys/socket.h>" >&5
-echo $ECHO_N "checking absolute name of <sys/socket.h>... $ECHO_C" >&6; }
+       { $as_echo "$as_me:$LINENO: checking absolute name of <sys/socket.h>" >&5
+$as_echo_n "checking absolute name of <sys/socket.h>... " >&6; }
 if test "${gl_cv_next_sys_socket_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
          if test $ac_cv_header_sys_socket_h = yes; then
@@ -6105,8 +6386,8 @@ _ACEOF
          fi
 
 fi
-{ echo "$as_me:$LINENO: result: $gl_cv_next_sys_socket_h" >&5
-echo "${ECHO_T}$gl_cv_next_sys_socket_h" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gl_cv_next_sys_socket_h" >&5
+$as_echo "$gl_cv_next_sys_socket_h" >&6; }
      fi
      NEXT_SYS_SOCKET_H=$gl_cv_next_sys_socket_h
 
@@ -6122,20 +6403,21 @@ echo "${ECHO_T}$gl_cv_next_sys_socket_h" >&6; }
 
 for ac_header in winsock2.h ws2tcpip.h
 do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+as_ac_Header=`$as_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; }
+  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -6151,32 +6433,33 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -6190,69 +6473,73 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
         test ! -s conftest.err
        }; then
   ac_header_preproc=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&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; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
 
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
+as_val=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -6298,10 +6585,10 @@ done
 
 
 
-  { echo "$as_me:$LINENO: checking for IPv4 sockets" >&5
-echo $ECHO_N "checking for IPv4 sockets... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for IPv4 sockets" >&5
+$as_echo_n "checking for IPv4 sockets... " >&6; }
   if test "${gl_cv_socket_ipv4+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -6334,20 +6621,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   gl_cv_socket_ipv4=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        gl_cv_socket_ipv4=no
@@ -6356,8 +6644,8 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 
-  { echo "$as_me:$LINENO: result: $gl_cv_socket_ipv4" >&5
-echo "${ECHO_T}$gl_cv_socket_ipv4" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $gl_cv_socket_ipv4" >&5
+$as_echo "$gl_cv_socket_ipv4" >&6; }
   if test $gl_cv_socket_ipv4 = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -6366,10 +6654,10 @@ _ACEOF
 
   fi
 
-  { echo "$as_me:$LINENO: checking for IPv6 sockets" >&5
-echo $ECHO_N "checking for IPv6 sockets... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for IPv6 sockets" >&5
+$as_echo_n "checking for IPv6 sockets... " >&6; }
   if test "${gl_cv_socket_ipv6+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -6402,20 +6690,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   gl_cv_socket_ipv6=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        gl_cv_socket_ipv6=no
@@ -6424,8 +6713,8 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 
-  { echo "$as_me:$LINENO: result: $gl_cv_socket_ipv6" >&5
-echo "${ECHO_T}$gl_cv_socket_ipv6" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $gl_cv_socket_ipv6" >&5
+$as_echo "$gl_cv_socket_ipv6" >&6; }
   if test $gl_cv_socket_ipv6 = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -6435,6 +6724,529 @@ _ACEOF
   fi
 
 
+  if test -z "$GETOPT_H"; then
+
+for ac_header in getopt.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  $as_echo_n "(cached) " >&6
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  $as_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
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  $as_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
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  $as_echo_n "(cached) " >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+fi
+as_val=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  GETOPT_H=getopt.h
+fi
+
+done
+
+  fi
+
+  if test -z "$GETOPT_H"; then
+
+for ac_func in getopt_long_only
+do
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+  $as_echo_n "(cached) " >&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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
+  eval "$as_ac_var=yes"
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       eval "$as_ac_var=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  GETOPT_H=getopt.h
+fi
+done
+
+  fi
+
+      if test -z "$GETOPT_H"; then
+    { $as_echo "$as_me:$LINENO: checking whether optreset is declared" >&5
+$as_echo_n "checking whether optreset is declared... " >&6; }
+if test "${ac_cv_have_decl_optreset+set}" = set; then
+  $as_echo_n "(cached) " >&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 <getopt.h>
+
+int
+main ()
+{
+#ifndef optreset
+  (void) optreset;
+#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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_have_decl_optreset=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_have_decl_optreset=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_optreset" >&5
+$as_echo "$ac_cv_have_decl_optreset" >&6; }
+if test "x$ac_cv_have_decl_optreset" = x""yes; then
+  GETOPT_H=getopt.h
+fi
+
+  fi
+
+      if test -z "$GETOPT_H"; then
+    { $as_echo "$as_me:$LINENO: checking for working GNU getopt function" >&5
+$as_echo_n "checking for working GNU getopt function... " >&6; }
+if test "${gl_cv_func_gnu_getopt+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then
+                        { $as_echo "$as_me:$LINENO: checking whether getopt_clip is declared" >&5
+$as_echo_n "checking whether getopt_clip is declared... " >&6; }
+if test "${ac_cv_have_decl_getopt_clip+set}" = set; then
+  $as_echo_n "(cached) " >&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 <getopt.h>
+
+int
+main ()
+{
+#ifndef getopt_clip
+  (void) getopt_clip;
+#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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_have_decl_getopt_clip=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_have_decl_getopt_clip=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_getopt_clip" >&5
+$as_echo "$ac_cv_have_decl_getopt_clip" >&6; }
+if test "x$ac_cv_have_decl_getopt_clip" = x""yes; then
+  gl_cv_func_gnu_getopt=no
+else
+  gl_cv_func_gnu_getopt=yes
+fi
+
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <getopt.h>
+int
+main ()
+{
+
+            char *myargv[3];
+            myargv[0] = "conftest";
+            myargv[1] = "-+";
+            myargv[2] = 0;
+            return getopt (2, myargv, "+a") != '?';
+
+  ;
+  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  gl_cv_func_gnu_getopt=yes
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+gl_cv_func_gnu_getopt=no
+fi
+rm -rf conftest.dSYM
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $gl_cv_func_gnu_getopt" >&5
+$as_echo "$gl_cv_func_gnu_getopt" >&6; }
+    if test "$gl_cv_func_gnu_getopt" = "no"; then
+      GETOPT_H=getopt.h
+    fi
+  fi
+
+
+      { $as_echo "$as_me:$LINENO: checking whether getenv is declared" >&5
+$as_echo_n "checking whether getenv is declared... " >&6; }
+if test "${ac_cv_have_decl_getenv+set}" = set; then
+  $as_echo_n "(cached) " >&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
+int
+main ()
+{
+#ifndef getenv
+  (void) getenv;
+#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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_have_decl_getenv=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_have_decl_getenv=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_getenv" >&5
+$as_echo "$ac_cv_have_decl_getenv" >&6; }
+if test "x$ac_cv_have_decl_getenv" = x""yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_GETENV 1
+_ACEOF
+
+
+else
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_GETENV 0
+_ACEOF
+
+
+fi
+
+
+
+
 
 
 
@@ -6456,10 +7268,10 @@ _ACEOF
      if test $gl_cv_have_include_next = yes; then
        gl_cv_next_sys_time_h='<'sys/time.h'>'
      else
-       { echo "$as_me:$LINENO: checking absolute name of <sys/time.h>" >&5
-echo $ECHO_N "checking absolute name of <sys/time.h>... $ECHO_C" >&6; }
+       { $as_echo "$as_me:$LINENO: checking absolute name of <sys/time.h>" >&5
+$as_echo_n "checking absolute name of <sys/time.h>... " >&6; }
 if test "${gl_cv_next_sys_time_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
          if test $ac_cv_header_sys_time_h = yes; then
@@ -6484,8 +7296,8 @@ _ACEOF
          fi
 
 fi
-{ echo "$as_me:$LINENO: result: $gl_cv_next_sys_time_h" >&5
-echo "${ECHO_T}$gl_cv_next_sys_time_h" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gl_cv_next_sys_time_h" >&5
+$as_echo "$gl_cv_next_sys_time_h" >&6; }
      fi
      NEXT_SYS_TIME_H=$gl_cv_next_sys_time_h
 
@@ -6499,10 +7311,10 @@ echo "${ECHO_T}$gl_cv_next_sys_time_h" >&6; }
   fi
 
 
-  { echo "$as_me:$LINENO: checking for struct timeval" >&5
-echo $ECHO_N "checking for struct timeval... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for struct timeval" >&5
+$as_echo_n "checking for struct timeval... " >&6; }
 if test "${gl_cv_sys_struct_timeval+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -6529,20 +7341,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   gl_cv_sys_struct_timeval=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        gl_cv_sys_struct_timeval=no
@@ -6550,8 +7363,8 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $gl_cv_sys_struct_timeval" >&5
-echo "${ECHO_T}$gl_cv_sys_struct_timeval" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gl_cv_sys_struct_timeval" >&5
+$as_echo "$gl_cv_sys_struct_timeval" >&6; }
   if test $gl_cv_sys_struct_timeval = yes; then
     HAVE_STRUCT_TIMEVAL=1
   else
@@ -6578,11 +7391,11 @@ echo "${ECHO_T}$gl_cv_sys_struct_timeval" >&6; }
 
 for ac_func in $gl_func_list
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -6635,35 +7448,42 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -6714,8 +7534,8 @@ fi
 ac_prog=ld
 if test "$GCC" = yes; then
   # Check if gcc -print-prog-name=ld gives a path.
-  { echo "$as_me:$LINENO: checking for ld used by GCC" >&5
-echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for ld used by GCC" >&5
+$as_echo_n "checking for ld used by GCC... " >&6; }
   case $host in
   *-*-mingw*)
     # gcc leaves a trailing carriage return which upsets mingw
@@ -6744,14 +7564,14 @@ echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6; }
     ;;
   esac
 elif test "$with_gnu_ld" = yes; then
-  { echo "$as_me:$LINENO: checking for GNU ld" >&5
-echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
 else
-  { echo "$as_me:$LINENO: checking for non-GNU ld" >&5
-echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
 fi
 if test "${acl_cv_path_LD+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test -z "$LD"; then
   IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
@@ -6778,19 +7598,19 @@ fi
 
 LD="$acl_cv_path_LD"
 if test -n "$LD"; then
-  { echo "$as_me:$LINENO: result: $LD" >&5
-echo "${ECHO_T}$LD" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $LD" >&5
+$as_echo "$LD" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
-test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
-echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+test -z "$LD" && { { $as_echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+$as_echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
    { (exit 1); exit 1; }; }
-{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
-echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
 if test "${acl_cv_prog_gnu_ld+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   # I'd rather use --version here, but apparently some GNU ld's only accept -v.
 case `$LD -v 2>&1 </dev/null` in
@@ -6800,17 +7620,17 @@ case `$LD -v 2>&1 </dev/null` in
   acl_cv_prog_gnu_ld=no ;;
 esac
 fi
-{ echo "$as_me:$LINENO: result: $acl_cv_prog_gnu_ld" >&5
-echo "${ECHO_T}$acl_cv_prog_gnu_ld" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $acl_cv_prog_gnu_ld" >&5
+$as_echo "$acl_cv_prog_gnu_ld" >&6; }
 with_gnu_ld=$acl_cv_prog_gnu_ld
 
 
 
 
-                                                { echo "$as_me:$LINENO: checking for shared library run path origin" >&5
-echo $ECHO_N "checking for shared library run path origin... $ECHO_C" >&6; }
+                                                { $as_echo "$as_me:$LINENO: checking for shared library run path origin" >&5
+$as_echo_n "checking for shared library run path origin... " >&6; }
 if test "${acl_cv_rpath+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
     CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
@@ -6820,8 +7640,8 @@ else
     acl_cv_rpath=done
 
 fi
-{ echo "$as_me:$LINENO: result: $acl_cv_rpath" >&5
-echo "${ECHO_T}$acl_cv_rpath" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $acl_cv_rpath" >&5
+$as_echo "$acl_cv_rpath" >&6; }
   wl="$acl_cv_wl"
   libext="$acl_cv_libext"
   shlibext="$acl_cv_shlibext"
@@ -6864,8 +7684,8 @@ fi
   LIBMULTITHREAD=
   LTLIBMULTITHREAD=
   if test "$gl_use_threads" != no; then
-        { echo "$as_me:$LINENO: checking whether imported symbols can be declared weak" >&5
-echo $ECHO_N "checking whether imported symbols can be declared weak... $ECHO_C" >&6; }
+        { $as_echo "$as_me:$LINENO: checking whether imported symbols can be declared weak" >&5
+$as_echo_n "checking whether imported symbols can be declared weak... " >&6; }
     gl_have_weak=no
     cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -6889,45 +7709,49 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   gl_have_weak=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
-    { echo "$as_me:$LINENO: result: $gl_have_weak" >&5
-echo "${ECHO_T}$gl_have_weak" >&6; }
+    { $as_echo "$as_me:$LINENO: result: $gl_have_weak" >&5
+$as_echo "$gl_have_weak" >&6; }
     if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then
       # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that
       # it groks <pthread.h>. It's added above, in gl_LOCK_EARLY_BODY.
       if test "${ac_cv_header_pthread_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for pthread.h" >&5
-echo $ECHO_N "checking for pthread.h... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for pthread.h" >&5
+$as_echo_n "checking for pthread.h... " >&6; }
 if test "${ac_cv_header_pthread_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_pthread_h" >&5
-echo "${ECHO_T}$ac_cv_header_pthread_h" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_pthread_h" >&5
+$as_echo "$ac_cv_header_pthread_h" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking pthread.h usability" >&5
-echo $ECHO_N "checking pthread.h usability... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking pthread.h usability" >&5
+$as_echo_n "checking pthread.h usability... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -6943,32 +7767,33 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking pthread.h presence" >&5
-echo $ECHO_N "checking pthread.h presence... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking pthread.h presence" >&5
+$as_echo_n "checking pthread.h presence... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -6982,66 +7807,67 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
         test ! -s conftest.err
        }; then
   ac_header_preproc=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: pthread.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: pthread.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: pthread.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: pthread.h: proceeding with the compiler's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: pthread.h: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: pthread.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: pthread.h: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: pthread.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: pthread.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: pthread.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: pthread.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: pthread.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: pthread.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: pthread.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: pthread.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: pthread.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: pthread.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: pthread.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: pthread.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: pthread.h: in the future, the compiler will take precedence" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: pthread.h: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: pthread.h: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: pthread.h:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: pthread.h:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: pthread.h: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: pthread.h: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: pthread.h:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: pthread.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: pthread.h: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: pthread.h: proceeding with the preprocessor's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: pthread.h: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: pthread.h: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for pthread.h" >&5
-echo $ECHO_N "checking for pthread.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for pthread.h" >&5
+$as_echo_n "checking for pthread.h... " >&6; }
 if test "${ac_cv_header_pthread_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_cv_header_pthread_h=$ac_header_preproc
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_pthread_h" >&5
-echo "${ECHO_T}$ac_cv_header_pthread_h" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_pthread_h" >&5
+$as_echo "$ac_cv_header_pthread_h" >&6; }
 
 fi
-if test $ac_cv_header_pthread_h = yes; then
+if test "x$ac_cv_header_pthread_h" = x""yes; then
   gl_have_pthread_h=yes
 else
   gl_have_pthread_h=no
@@ -7078,26 +7904,30 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   gl_have_pthread=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
         # Test for libpthread by looking for pthread_kill. (Not pthread_self,
@@ -7105,10 +7935,10 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
         if test -n "$gl_have_pthread"; then
           # The program links fine without libpthread. But it may actually
           # need to link with libpthread in order to create multiple threads.
-          { echo "$as_me:$LINENO: checking for pthread_kill in -lpthread" >&5
-echo $ECHO_N "checking for pthread_kill in -lpthread... $ECHO_C" >&6; }
+          { $as_echo "$as_me:$LINENO: checking for pthread_kill in -lpthread" >&5
+$as_echo_n "checking for pthread_kill in -lpthread... " >&6; }
 if test "${ac_cv_lib_pthread_pthread_kill+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lpthread  $LIBS"
@@ -7140,33 +7970,37 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_pthread_pthread_kill=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_pthread_pthread_kill=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_kill" >&5
-echo "${ECHO_T}$ac_cv_lib_pthread_pthread_kill" >&6; }
-if test $ac_cv_lib_pthread_pthread_kill = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_kill" >&5
+$as_echo "$ac_cv_lib_pthread_pthread_kill" >&6; }
+if test "x$ac_cv_lib_pthread_pthread_kill" = x""yes; then
   LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread
              # On Solaris and HP-UX, most pthread functions exist also in libc.
              # Therefore pthread_in_use() needs to actually try to create a
@@ -7185,10 +8019,10 @@ fi
 
         else
           # Some library is needed. Try libpthread and libc_r.
-          { echo "$as_me:$LINENO: checking for pthread_kill in -lpthread" >&5
-echo $ECHO_N "checking for pthread_kill in -lpthread... $ECHO_C" >&6; }
+          { $as_echo "$as_me:$LINENO: checking for pthread_kill in -lpthread" >&5
+$as_echo_n "checking for pthread_kill in -lpthread... " >&6; }
 if test "${ac_cv_lib_pthread_pthread_kill+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lpthread  $LIBS"
@@ -7220,33 +8054,37 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_pthread_pthread_kill=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_pthread_pthread_kill=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_kill" >&5
-echo "${ECHO_T}$ac_cv_lib_pthread_pthread_kill" >&6; }
-if test $ac_cv_lib_pthread_pthread_kill = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_kill" >&5
+$as_echo "$ac_cv_lib_pthread_pthread_kill" >&6; }
+if test "x$ac_cv_lib_pthread_pthread_kill" = x""yes; then
   gl_have_pthread=yes
              LIBTHREAD=-lpthread LTLIBTHREAD=-lpthread
              LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread
@@ -7254,10 +8092,10 @@ fi
 
           if test -z "$gl_have_pthread"; then
             # For FreeBSD 4.
-            { echo "$as_me:$LINENO: checking for pthread_kill in -lc_r" >&5
-echo $ECHO_N "checking for pthread_kill in -lc_r... $ECHO_C" >&6; }
+            { $as_echo "$as_me:$LINENO: checking for pthread_kill in -lc_r" >&5
+$as_echo_n "checking for pthread_kill in -lc_r... " >&6; }
 if test "${ac_cv_lib_c_r_pthread_kill+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lc_r  $LIBS"
@@ -7289,33 +8127,37 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_c_r_pthread_kill=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_c_r_pthread_kill=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_c_r_pthread_kill" >&5
-echo "${ECHO_T}$ac_cv_lib_c_r_pthread_kill" >&6; }
-if test $ac_cv_lib_c_r_pthread_kill = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_c_r_pthread_kill" >&5
+$as_echo "$ac_cv_lib_c_r_pthread_kill" >&6; }
+if test "x$ac_cv_lib_c_r_pthread_kill" = x""yes; then
   gl_have_pthread=yes
                LIBTHREAD=-lc_r LTLIBTHREAD=-lc_r
                LIBMULTITHREAD=-lc_r LTLIBMULTITHREAD=-lc_r
@@ -7343,12 +8185,13 @@ _ACEOF
           fi
           # OSF/1 4.0 and MacOS X 10.1 lack the pthread_rwlock_t type and the
           # pthread_rwlock_* functions.
-          { echo "$as_me:$LINENO: checking for pthread_rwlock_t" >&5
-echo $ECHO_N "checking for pthread_rwlock_t... $ECHO_C" >&6; }
+          { $as_echo "$as_me:$LINENO: checking for pthread_rwlock_t" >&5
+$as_echo_n "checking for pthread_rwlock_t... " >&6; }
 if test "${ac_cv_type_pthread_rwlock_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
+  ac_cv_type_pthread_rwlock_t=no
+cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -7356,14 +8199,46 @@ cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #include <pthread.h>
 
-typedef pthread_rwlock_t ac__type_new_;
 int
 main ()
 {
-if ((ac__type_new_ *) 0)
-  return 0;
-if (sizeof (ac__type_new_))
+if (sizeof (pthread_rwlock_t))
+       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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <pthread.h>
+
+int
+main ()
+{
+if (sizeof ((pthread_rwlock_t)))
+         return 0;
   ;
   return 0;
 }
@@ -7374,30 +8249,39 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
-  ac_cv_type_pthread_rwlock_t=yes
+  :
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_cv_type_pthread_rwlock_t=no
+       ac_cv_type_pthread_rwlock_t=yes
 fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_pthread_rwlock_t" >&5
-echo "${ECHO_T}$ac_cv_type_pthread_rwlock_t" >&6; }
-if test $ac_cv_type_pthread_rwlock_t = yes; then
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_pthread_rwlock_t" >&5
+$as_echo "$ac_cv_type_pthread_rwlock_t" >&6; }
+if test "x$ac_cv_type_pthread_rwlock_t" = x""yes; then
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_PTHREAD_RWLOCK 1
@@ -7432,13 +8316,14 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
@@ -7449,7 +8334,7 @@ cat >>confdefs.h <<\_ACEOF
 _ACEOF
 
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
@@ -7486,26 +8371,30 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   gl_have_solaristhread=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
         LIBS="$gl_save_LIBS"
@@ -7539,10 +8428,10 @@ _ACEOF
 
 
 
-  { echo "$as_me:$LINENO: checking how to link with libpth" >&5
-echo $ECHO_N "checking how to link with libpth... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking how to link with libpth" >&5
+$as_echo_n "checking how to link with libpth... " >&6; }
 if test "${ac_cv_libpth_libs+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 
@@ -7929,8 +8818,8 @@ fi
     ac_cv_libpth_cppflags="$INCPTH"
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_libpth_libs" >&5
-echo "${ECHO_T}$ac_cv_libpth_libs" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_libpth_libs" >&5
+$as_echo "$ac_cv_libpth_libs" >&6; }
   LIBPTH="$ac_cv_libpth_libs"
   LTLIBPTH="$ac_cv_libpth_ltlibs"
   INCPTH="$ac_cv_libpth_cppflags"
@@ -7987,26 +8876,30 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   gl_have_pth=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
       LIBS="$gl_save_LIBS"
@@ -8053,20 +8946,20 @@ _ACEOF
       fi
     fi
   fi
-  { echo "$as_me:$LINENO: checking for multithread API to use" >&5
-echo $ECHO_N "checking for multithread API to use... $ECHO_C" >&6; }
-  { echo "$as_me:$LINENO: result: $gl_threads_api" >&5
-echo "${ECHO_T}$gl_threads_api" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for multithread API to use" >&5
+$as_echo_n "checking for multithread API to use... " >&6; }
+  { $as_echo "$as_me:$LINENO: result: $gl_threads_api" >&5
+$as_echo "$gl_threads_api" >&6; }
 
 
 
 
 
 
-  { echo "$as_me:$LINENO: checking whether malloc, realloc, calloc are POSIX compliant" >&5
-echo $ECHO_N "checking whether malloc, realloc, calloc are POSIX compliant... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking whether malloc, realloc, calloc are POSIX compliant" >&5
+$as_echo_n "checking whether malloc, realloc, calloc are POSIX compliant... " >&6; }
 if test "${gl_cv_func_malloc_posix+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
                         cat >conftest.$ac_ext <<_ACEOF
@@ -8093,20 +8986,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   gl_cv_func_malloc_posix=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        gl_cv_func_malloc_posix=no
@@ -8115,8 +9009,8 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 fi
-{ echo "$as_me:$LINENO: result: $gl_cv_func_malloc_posix" >&5
-echo "${ECHO_T}$gl_cv_func_malloc_posix" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gl_cv_func_malloc_posix" >&5
+$as_echo "$gl_cv_func_malloc_posix" >&6; }
 
 
   GNULIB_MALLOC_POSIX=0;
@@ -8125,17 +9019,24 @@ echo "${ECHO_T}$gl_cv_func_malloc_posix" >&6; }
   GNULIB_GETSUBOPT=0;
   GNULIB_MKDTEMP=0;
   GNULIB_MKSTEMP=0;
+  GNULIB_PUTENV=0;
+  GNULIB_SETENV=0;
+  GNULIB_UNSETENV=0;
     HAVE_CALLOC_POSIX=1;
   HAVE_GETSUBOPT=1;
   HAVE_MALLOC_POSIX=1;
   HAVE_MKDTEMP=1;
   HAVE_REALLOC_POSIX=1;
+  HAVE_SETENV=1;
+  HAVE_UNSETENV=1;
   REPLACE_MKSTEMP=0;
+  REPLACE_PUTENV=0;
+  VOID_UNSETENV=0;
 
-{ echo "$as_me:$LINENO: checking for external symbol _system_configuration" >&5
-echo $ECHO_N "checking for external symbol _system_configuration... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for external symbol _system_configuration" >&5
+$as_echo_n "checking for external symbol _system_configuration... " >&6; }
 if test "${gl_cv_var__system_configuration+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -8160,31 +9061,35 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   gl_cv_var__system_configuration=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        gl_cv_var__system_configuration=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $gl_cv_var__system_configuration" >&5
-echo "${ECHO_T}$gl_cv_var__system_configuration" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gl_cv_var__system_configuration" >&5
+$as_echo "$gl_cv_var__system_configuration" >&6; }
 
     if test $gl_cv_var__system_configuration = yes; then
 
@@ -8196,10 +9101,10 @@ _ACEOF
 
 
 
-  { echo "$as_me:$LINENO: checking for ssize_t" >&5
-echo $ECHO_N "checking for ssize_t... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for ssize_t" >&5
+$as_echo_n "checking for ssize_t... " >&6; }
 if test "${gt_cv_ssize_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -8223,20 +9128,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   gt_cv_ssize_t=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        gt_cv_ssize_t=no
@@ -8244,8 +9150,8 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $gt_cv_ssize_t" >&5
-echo "${ECHO_T}$gt_cv_ssize_t" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gt_cv_ssize_t" >&5
+$as_echo "$gt_cv_ssize_t" >&6; }
   if test $gt_cv_ssize_t = no; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -8264,6 +9170,8 @@ _ACEOF
   GNULIB_VSNPRINTF=0;
   GNULIB_VSPRINTF_POSIX=0;
   GNULIB_VASPRINTF=0;
+  GNULIB_FOPEN=0;
+  GNULIB_FREOPEN=0;
   GNULIB_FSEEK=0;
   GNULIB_FSEEKO=0;
   GNULIB_FTELL=0;
@@ -8283,6 +9191,8 @@ _ACEOF
   REPLACE_VSPRINTF=0;
   HAVE_VASPRINTF=1;
   REPLACE_VASPRINTF=0;
+  REPLACE_FOPEN=0;
+  REPLACE_FREOPEN=0;
   HAVE_FSEEKO=1;
   REPLACE_FSEEKO=0;
   REPLACE_FSEEK=0;
@@ -8295,10 +9205,10 @@ _ACEOF
   REPLACE_GETLINE=0;
 
 
-      { echo "$as_me:$LINENO: checking whether snprintf is declared" >&5
-echo $ECHO_N "checking whether snprintf is declared... $ECHO_C" >&6; }
+      { $as_echo "$as_me:$LINENO: checking whether snprintf is declared" >&5
+$as_echo_n "checking whether snprintf is declared... " >&6; }
 if test "${ac_cv_have_decl_snprintf+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -8324,20 +9234,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_have_decl_snprintf=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_have_decl_snprintf=no
@@ -8345,9 +9256,9 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_snprintf" >&5
-echo "${ECHO_T}$ac_cv_have_decl_snprintf" >&6; }
-if test $ac_cv_have_decl_snprintf = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_snprintf" >&5
+$as_echo "$ac_cv_have_decl_snprintf" >&6; }
+if test "x$ac_cv_have_decl_snprintf" = x""yes; then
 
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_SNPRINTF 1
@@ -8364,10 +9275,10 @@ fi
 
 
 
-{ echo "$as_me:$LINENO: checking for stdbool.h that conforms to C99" >&5
-echo $ECHO_N "checking for stdbool.h that conforms to C99... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for stdbool.h that conforms to C99" >&5
+$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; }
 if test "${ac_cv_header_stdbool_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -8457,20 +9368,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_header_stdbool_h=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_header_stdbool_h=no
@@ -8478,28 +9390,60 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_stdbool_h" >&5
-echo "${ECHO_T}$ac_cv_header_stdbool_h" >&6; }
-   { echo "$as_me:$LINENO: checking for _Bool" >&5
-echo $ECHO_N "checking for _Bool... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdbool_h" >&5
+$as_echo "$ac_cv_header_stdbool_h" >&6; }
+   { $as_echo "$as_me:$LINENO: checking for _Bool" >&5
+$as_echo_n "checking for _Bool... " >&6; }
 if test "${ac_cv_type__Bool+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
+  ac_cv_type__Bool=no
+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 _Bool ac__type_new_;
 int
 main ()
 {
-if ((ac__type_new_ *) 0)
-  return 0;
-if (sizeof (ac__type_new_))
+if (sizeof (_Bool))
+       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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  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
+int
+main ()
+{
+if (sizeof ((_Bool)))
+         return 0;
   ;
   return 0;
 }
@@ -8510,30 +9454,39 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
-  ac_cv_type__Bool=yes
+  :
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_type__Bool=yes
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_cv_type__Bool=no
+
 fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type__Bool" >&5
-echo "${ECHO_T}$ac_cv_type__Bool" >&6; }
-if test $ac_cv_type__Bool = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type__Bool" >&5
+$as_echo "$ac_cv_type__Bool" >&6; }
+if test "x$ac_cv_type__Bool" = x""yes; then
 
 cat >>confdefs.h <<_ACEOF
 #define HAVE__BOOL 1
@@ -8550,32 +9503,46 @@ _ACEOF
 
    fi
 
-  { echo "$as_me:$LINENO: checking for long long int" >&5
-echo $ECHO_N "checking for long long int... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for long long int" >&5
+$as_echo_n "checking for long long int... " >&6; }
 if test "${ac_cv_type_long_long_int+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+
+  /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-long long int ll = 9223372036854775807ll;
-           long long int nll = -9223372036854775807LL;
-           typedef int a[((-9223372036854775807LL < 0
-                           && 0 < 9223372036854775807ll)
-                          ? 1 : -1)];
-           int i = 63;
+/* For now, do not test the preprocessor; as of 2007 there are too many
+        implementations with broken preprocessors.  Perhaps this can
+        be revisited in 2012.  In the meantime, code should not expect
+        #if to work with literals wider than 32 bits.  */
+      /* Test literals.  */
+      long long int ll = 9223372036854775807ll;
+      long long int nll = -9223372036854775807LL;
+      unsigned long long int ull = 18446744073709551615ULL;
+      /* Test constant expressions.   */
+      typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
+                    ? 1 : -1)];
+      typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
+                    ? 1 : -1)];
+      int i = 63;
 int
 main ()
 {
-long long int llmax = 9223372036854775807ll;
-           return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
-                   | (llmax / ll) | (llmax % ll));
+/* Test availability of runtime routines for shift and division.  */
+      long long int llmax = 9223372036854775807ll;
+      unsigned long long int ullmax = 18446744073709551615ull;
+      return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
+             | (llmax / ll) | (llmax % ll)
+             | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
+             | (ullmax / ull) | (ullmax % ull));
   ;
   return 0;
 }
+
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (ac_try="$ac_link"
@@ -8583,19 +9550,22 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-                       if test "$cross_compiling" = yes; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
+                       if test "$cross_compiling" = yes; then
   ac_cv_type_long_long_int=yes
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -8634,45 +9604,49 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_type_long_long_int=yes
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
 ac_cv_type_long_long_int=no
 fi
+rm -rf conftest.dSYM
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 
 
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_type_long_long_int=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_long_long_int" >&5
-echo "${ECHO_T}$ac_cv_type_long_long_int" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_long_long_int" >&5
+$as_echo "$ac_cv_type_long_long_int" >&6; }
   if test $ac_cv_type_long_long_int = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -8682,30 +9656,46 @@ _ACEOF
   fi
 
 
-  { echo "$as_me:$LINENO: checking for unsigned long long int" >&5
-echo $ECHO_N "checking for unsigned long long int... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for unsigned long long int" >&5
+$as_echo_n "checking for unsigned long long int... " >&6; }
 if test "${ac_cv_type_unsigned_long_long_int+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+
+  /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-unsigned long long int ull = 18446744073709551615ULL;
-           typedef int a[(18446744073709551615ULL <= (unsigned long long int) -1
-                          ? 1 : -1)];
-          int i = 63;
+/* For now, do not test the preprocessor; as of 2007 there are too many
+        implementations with broken preprocessors.  Perhaps this can
+        be revisited in 2012.  In the meantime, code should not expect
+        #if to work with literals wider than 32 bits.  */
+      /* Test literals.  */
+      long long int ll = 9223372036854775807ll;
+      long long int nll = -9223372036854775807LL;
+      unsigned long long int ull = 18446744073709551615ULL;
+      /* Test constant expressions.   */
+      typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
+                    ? 1 : -1)];
+      typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
+                    ? 1 : -1)];
+      int i = 63;
 int
 main ()
 {
-unsigned long long int ullmax = 18446744073709551615ull;
-           return (ull << 63 | ull >> 63 | ull << i | ull >> i
-                   | ullmax / ull | ullmax % ull);
+/* Test availability of runtime routines for shift and division.  */
+      long long int llmax = 9223372036854775807ll;
+      unsigned long long int ullmax = 18446744073709551615ull;
+      return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
+             | (llmax / ll) | (llmax % ll)
+             | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
+             | (ullmax / ull) | (ullmax % ull));
   ;
   return 0;
 }
+
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
 if { (ac_try="$ac_link"
@@ -8713,31 +9703,35 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_type_unsigned_long_long_int=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_type_unsigned_long_long_int=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_long_long_int" >&5
-echo "${ECHO_T}$ac_cv_type_unsigned_long_long_int" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_long_long_int" >&5
+$as_echo "$ac_cv_type_unsigned_long_long_int" >&6; }
   if test $ac_cv_type_unsigned_long_long_int = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -8782,6 +9776,7 @@ _ACEOF
   GNULIB_STRNLEN=0;
   GNULIB_STRPBRK=0;
   GNULIB_STRSEP=0;
+  GNULIB_STRSTR=0;
   GNULIB_STRCASESTR=0;
   GNULIB_STRTOK_R=0;
   GNULIB_MBSLEN=0;
@@ -8798,13 +9793,13 @@ _ACEOF
   GNULIB_MBSSPN=0;
   GNULIB_MBSSEP=0;
   GNULIB_MBSTOK_R=0;
+  GNULIB_STRERROR=0;
+  GNULIB_STRSIGNAL=0;
     HAVE_DECL_MEMMEM=1;
   HAVE_MEMPCPY=1;
   HAVE_DECL_MEMRCHR=1;
   HAVE_STPCPY=1;
   HAVE_STPNCPY=1;
-  HAVE_STRCASECMP=1;
-  HAVE_DECL_STRNCASECMP=1;
   HAVE_STRCHRNUL=1;
   HAVE_DECL_STRDUP=1;
   HAVE_STRNDUP=1;
@@ -8814,12 +9809,19 @@ _ACEOF
   HAVE_STRSEP=1;
   HAVE_STRCASESTR=1;
   HAVE_DECL_STRTOK_R=1;
+  HAVE_DECL_STRERROR=1;
+  HAVE_DECL_STRSIGNAL=1;
+  REPLACE_STRERROR=0;
+  REPLACE_STRSIGNAL=0;
+  REPLACE_MEMMEM=0;
+  REPLACE_STRCASESTR=0;
+  REPLACE_STRSTR=0;
 
 
-      { echo "$as_me:$LINENO: checking whether strdup is declared" >&5
-echo $ECHO_N "checking whether strdup is declared... $ECHO_C" >&6; }
+      { $as_echo "$as_me:$LINENO: checking whether strdup is declared" >&5
+$as_echo_n "checking whether strdup is declared... " >&6; }
 if test "${ac_cv_have_decl_strdup+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -8845,20 +9847,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_have_decl_strdup=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_have_decl_strdup=no
@@ -8866,9 +9869,9 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_strdup" >&5
-echo "${ECHO_T}$ac_cv_have_decl_strdup" >&6; }
-if test $ac_cv_have_decl_strdup = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_strdup" >&5
+$as_echo "$ac_cv_have_decl_strdup" >&6; }
+if test "x$ac_cv_have_decl_strdup" = x""yes; then
 
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_STRDUP 1
@@ -8908,10 +9911,10 @@ fi
      if test $gl_cv_have_include_next = yes; then
        gl_cv_next_string_h='<'string.h'>'
      else
-       { echo "$as_me:$LINENO: checking absolute name of <string.h>" >&5
-echo $ECHO_N "checking absolute name of <string.h>... $ECHO_C" >&6; }
+       { $as_echo "$as_me:$LINENO: checking absolute name of <string.h>" >&5
+$as_echo_n "checking absolute name of <string.h>... " >&6; }
 if test "${gl_cv_next_string_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
          if test $ac_cv_header_string_h = yes; then
@@ -8936,8 +9939,8 @@ _ACEOF
          fi
 
 fi
-{ echo "$as_me:$LINENO: result: $gl_cv_next_string_h" >&5
-echo "${ECHO_T}$gl_cv_next_string_h" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gl_cv_next_string_h" >&5
+$as_echo "$gl_cv_next_string_h" >&6; }
      fi
      NEXT_STRING_H=$gl_cv_next_string_h
 
@@ -8950,10 +9953,10 @@ echo "${ECHO_T}$gl_cv_next_string_h" >&6; }
 
 
 
-{ echo "$as_me:$LINENO: checking whether stat file-mode macros are broken" >&5
-echo $ECHO_N "checking whether stat file-mode macros are broken... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking whether stat file-mode macros are broken" >&5
+$as_echo_n "checking whether stat file-mode macros are broken... " >&6; }
 if test "${ac_cv_header_stat_broken+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -8987,20 +9990,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_header_stat_broken=no
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_header_stat_broken=yes
@@ -9008,8 +10012,8 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_stat_broken" >&5
-echo "${ECHO_T}$ac_cv_header_stat_broken" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stat_broken" >&5
+$as_echo "$ac_cv_header_stat_broken" >&6; }
 if test $ac_cv_header_stat_broken = yes; then
 
 cat >>confdefs.h <<\_ACEOF
 
 if test "$enable_largefile" != no; then
 
-  { echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5
-echo $ECHO_N "checking for special C compiler options needed for large files... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5
+$as_echo_n "checking for special C compiler options needed for large files... " >&6; }
 if test "${ac_cv_sys_largefile_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_cv_sys_largefile_CC=no
      if test "$GCC" != yes; then
@@ -9071,20 +10075,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   break
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
@@ -9098,20 +10103,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_sys_largefile_CC=' -n32'; break
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
@@ -9124,16 +10130,16 @@ rm -f core conftest.err conftest.$ac_objext
        rm -f conftest.$ac_ext
     fi
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_CC" >&5
-echo "${ECHO_T}$ac_cv_sys_largefile_CC" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_CC" >&5
+$as_echo "$ac_cv_sys_largefile_CC" >&6; }
   if test "$ac_cv_sys_largefile_CC" != no; then
     CC=$CC$ac_cv_sys_largefile_CC
   fi
 
-  { echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS value needed for large files" >&5
-echo $ECHO_N "checking for _FILE_OFFSET_BITS value needed for large files... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS value needed for large files" >&5
+$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
 if test "${ac_cv_sys_file_offset_bits+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   while :; do
   cat >conftest.$ac_ext <<_ACEOF
@@ -9165,20 +10171,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_sys_file_offset_bits=no; break
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
@@ -9215,20 +10222,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_sys_file_offset_bits=64; break
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
@@ -9239,8 +10247,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   break
 done
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5
-echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5
+$as_echo "$ac_cv_sys_file_offset_bits" >&6; }
 case $ac_cv_sys_file_offset_bits in #(
   no | unknown) ;;
   *)
@@ -9249,12 +10257,12 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 ;;
 esac
-rm -f conftest*
+rm -rf conftest*
   if test $ac_cv_sys_file_offset_bits = unknown; then
-    { echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5
-echo $ECHO_N "checking for _LARGE_FILES value needed for large files... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5
+$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
 if test "${ac_cv_sys_large_files+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   while :; do
   cat >conftest.$ac_ext <<_ACEOF
@@ -9286,20 +10294,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_sys_large_files=no; break
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
@@ -9336,20 +10345,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_sys_large_files=1; break
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
@@ -9360,8 +10370,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   break
 done
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5
-echo "${ECHO_T}$ac_cv_sys_large_files" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5
+$as_echo "$ac_cv_sys_large_files" >&6; }
 case $ac_cv_sys_large_files in #(
   no | unknown) ;;
   *)
@@ -9370,29 +10380,36 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 ;;
 esac
-rm -f conftest*
+rm -rf conftest*
   fi
 fi
 
 
   GNULIB_CHOWN=0;
   GNULIB_DUP2=0;
+  GNULIB_ENVIRON=0;
   GNULIB_FCHDIR=0;
   GNULIB_FTRUNCATE=0;
   GNULIB_GETCWD=0;
   GNULIB_GETLOGIN_R=0;
+  GNULIB_GETPAGESIZE=0;
   GNULIB_LCHOWN=0;
   GNULIB_LSEEK=0;
   GNULIB_READLINK=0;
   GNULIB_SLEEP=0;
     HAVE_DUP2=1;
   HAVE_FTRUNCATE=1;
+  HAVE_GETPAGESIZE=1;
   HAVE_READLINK=1;
   HAVE_SLEEP=1;
+  HAVE_DECL_ENVIRON=1;
   HAVE_DECL_GETLOGIN_R=1;
+  HAVE_OS_H=0;
+  HAVE_SYS_PARAM_H=0;
   REPLACE_CHOWN=0;
   REPLACE_FCHDIR=0;
   REPLACE_GETCWD=0;
+  REPLACE_GETPAGESIZE=0;
   REPLACE_LCHOWN=0;
   REPLACE_LSEEK=0;
 
 
 
 
-  { echo "$as_me:$LINENO: checking for EOVERFLOW" >&5
-echo $ECHO_N "checking for EOVERFLOW... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for EOVERFLOW" >&5
+$as_echo_n "checking for EOVERFLOW... " >&6; }
 if test "${ac_cv_decl_EOVERFLOW+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
     cat >conftest.$ac_ext <<_ACEOF
@@ -9484,13 +10501,14 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
@@ -9526,20 +10544,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_hi=$ac_mid; break
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_lo=`expr $ac_mid + 1`
@@ -9553,7 +10572,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   done
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        cat >conftest.$ac_ext <<_ACEOF
@@ -9585,13 +10604,14 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
@@ -9627,20 +10647,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_lo=$ac_mid; break
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_hi=`expr '(' $ac_mid ')' - 1`
@@ -9654,7 +10675,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   done
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_lo= ac_hi=
@@ -9696,20 +10717,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_hi=$ac_mid
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_lo=`expr '(' $ac_mid ')' + 1`
@@ -9751,15 +10773,17 @@ main ()
       long int i = longval ();
       if (i != (EOVERFLOW))
        return 1;
-      fprintf (f, "%ld\n", i);
+      fprintf (f, "%ld", i);
     }
   else
     {
       unsigned long int i = ulongval ();
       if (i != (EOVERFLOW))
        return 1;
-      fprintf (f, "%lu\n", i);
+      fprintf (f, "%lu", i);
     }
+  /* Do not output a trailing newline, as this causes \r\n confusion
+     on some platforms.  */
   return ferror (f) || fclose (f) != 0;
 
   ;
@@ -9772,27 +10796,30 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_decl_EOVERFLOW=`cat conftest.val`
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 fi
+rm -rf conftest.dSYM
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 rm -f conftest.val
@@ -9802,8 +10829,8 @@ rm -f conftest.val
     fi
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_decl_EOVERFLOW" >&5
-echo "${ECHO_T}$ac_cv_decl_EOVERFLOW" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_decl_EOVERFLOW" >&5
+$as_echo "$ac_cv_decl_EOVERFLOW" >&6; }
   if test "$ac_cv_decl_EOVERFLOW" != yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -9821,10 +10848,10 @@ _ACEOF
 
 
 
-  { echo "$as_me:$LINENO: checking for wchar_t" >&5
-echo $ECHO_N "checking for wchar_t... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for wchar_t" >&5
+$as_echo_n "checking for wchar_t... " >&6; }
 if test "${gt_cv_c_wchar_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -9848,20 +10875,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   gt_cv_c_wchar_t=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        gt_cv_c_wchar_t=no
@@ -9869,8 +10897,8 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $gt_cv_c_wchar_t" >&5
-echo "${ECHO_T}$gt_cv_c_wchar_t" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gt_cv_c_wchar_t" >&5
+$as_echo "$gt_cv_c_wchar_t" >&6; }
   if test $gt_cv_c_wchar_t = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -9880,10 +10908,10 @@ _ACEOF
   fi
 
 
-  { echo "$as_me:$LINENO: checking for wint_t" >&5
-echo $ECHO_N "checking for wint_t... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for wint_t" >&5
+$as_echo_n "checking for wint_t... " >&6; }
 if test "${gt_cv_c_wint_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -9907,20 +10935,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   gt_cv_c_wint_t=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        gt_cv_c_wint_t=no
@@ -9928,8 +10957,8 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $gt_cv_c_wint_t" >&5
-echo "${ECHO_T}$gt_cv_c_wint_t" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gt_cv_c_wint_t" >&5
+$as_echo "$gt_cv_c_wint_t" >&6; }
   if test $gt_cv_c_wint_t = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -9938,26 +10967,24 @@ _ACEOF
 
   fi
 
-{ echo "$as_me:$LINENO: checking for size_t" >&5
-echo $ECHO_N "checking for size_t... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for size_t" >&5
+$as_echo_n "checking for size_t... " >&6; }
 if test "${ac_cv_type_size_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
+  ac_cv_type_size_t=no
+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 size_t ac__type_new_;
 int
 main ()
 {
-if ((ac__type_new_ *) 0)
-  return 0;
-if (sizeof (ac__type_new_))
-  return 0;
+if (sizeof (size_t))
+       return 0;
   ;
   return 0;
 }
@@ -9968,57 +10995,30 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
-  ac_cv_type_size_t=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_type_size_t=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
-echo "${ECHO_T}$ac_cv_type_size_t" >&6; }
-if test $ac_cv_type_size_t = yes; then
-  :
-else
-
-cat >>confdefs.h <<_ACEOF
-#define size_t unsigned int
-_ACEOF
-
-fi
-
-
-  { echo "$as_me:$LINENO: checking for inttypes.h" >&5
-echo $ECHO_N "checking for inttypes.h... $ECHO_C" >&6; }
-if test "${gl_cv_header_inttypes_h+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 <sys/types.h>
-#include <inttypes.h>
+$ac_includes_default
 int
 main ()
 {
-uintmax_t i = (uintmax_t) -1;
+if (sizeof ((size_t)))
+         return 0;
   ;
   return 0;
 }
@@ -10029,42 +11029,53 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
-  gl_cv_header_inttypes_h=yes
+  :
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-       gl_cv_header_inttypes_h=no
+       ac_cv_type_size_t=yes
 fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
 fi
-{ echo "$as_me:$LINENO: result: $gl_cv_header_inttypes_h" >&5
-echo "${ECHO_T}$gl_cv_header_inttypes_h" >&6; }
-  if test $gl_cv_header_inttypes_h = yes; then
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
+$as_echo "$ac_cv_type_size_t" >&6; }
+if test "x$ac_cv_type_size_t" = x""yes; then
+  :
+else
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_INTTYPES_H_WITH_UINTMAX 1
+#define size_t unsigned int
 _ACEOF
 
-  fi
+fi
 
 
-  { echo "$as_me:$LINENO: checking for stdint.h" >&5
-echo $ECHO_N "checking for stdint.h... $ECHO_C" >&6; }
-if test "${gl_cv_header_stdint_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  { $as_echo "$as_me:$LINENO: checking for inttypes.h" >&5
+$as_echo_n "checking for inttypes.h... " >&6; }
+if test "${gl_cv_header_inttypes_h+set}" = set; then
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -10073,7 +11084,7 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #include <sys/types.h>
-#include <stdint.h>
+#include <inttypes.h>
 int
 main ()
 {
@@ -10088,42 +11099,43 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
-  gl_cv_header_stdint_h=yes
+  gl_cv_header_inttypes_h=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-       gl_cv_header_stdint_h=no
+       gl_cv_header_inttypes_h=no
 fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $gl_cv_header_stdint_h" >&5
-echo "${ECHO_T}$gl_cv_header_stdint_h" >&6; }
-  if test $gl_cv_header_stdint_h = yes; then
+{ $as_echo "$as_me:$LINENO: result: $gl_cv_header_inttypes_h" >&5
+$as_echo "$gl_cv_header_inttypes_h" >&6; }
+  if test $gl_cv_header_inttypes_h = yes; then
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_STDINT_H_WITH_UINTMAX 1
+#define HAVE_INTTYPES_H_WITH_UINTMAX 1
 _ACEOF
 
   fi
 
 
-  { echo "$as_me:$LINENO: checking for long long" >&5
-echo $ECHO_N "checking for long long... $ECHO_C" >&6; }
-if test "${ac_cv_type_long_long+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  { $as_echo "$as_me:$LINENO: checking for stdint.h" >&5
+$as_echo_n "checking for stdint.h... " >&6; }
+if test "${gl_cv_header_stdint_h+set}" = set; then
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -10131,51 +11143,50 @@ _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-long long ll = 1LL; int i = 63;
+#include <sys/types.h>
+#include <stdint.h>
 int
 main ()
 {
-long long llmax = (long long) -1;
-     return ll << i | ll >> i | llmax / ll | llmax % ll;
+uintmax_t i = (uintmax_t) -1;
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
+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_link") 2>conftest.er1
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  ac_cv_type_long_long=yes
+       } && test -s conftest.$ac_objext; then
+  gl_cv_header_stdint_h=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_cv_type_long_long=no
+       gl_cv_header_stdint_h=no
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5
-echo "${ECHO_T}$ac_cv_type_long_long" >&6; }
-  if test $ac_cv_type_long_long = yes; then
+{ $as_echo "$as_me:$LINENO: result: $gl_cv_header_stdint_h" >&5
+$as_echo "$gl_cv_header_stdint_h" >&6; }
+  if test $gl_cv_header_stdint_h = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LONG_LONG 1
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STDINT_H_WITH_UINTMAX 1
 _ACEOF
 
   fi
@@ -10183,10 +11194,10 @@ _ACEOF
 
 
 
-  { echo "$as_me:$LINENO: checking for intmax_t" >&5
-echo $ECHO_N "checking for intmax_t... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for intmax_t" >&5
+$as_echo_n "checking for intmax_t... " >&6; }
 if test "${gt_cv_c_intmax_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -10218,20 +11229,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   gt_cv_c_intmax_t=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        gt_cv_c_intmax_t=no
@@ -10239,8 +11251,8 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $gt_cv_c_intmax_t" >&5
-echo "${ECHO_T}$gt_cv_c_intmax_t" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gt_cv_c_intmax_t" >&5
+$as_echo "$gt_cv_c_intmax_t" >&6; }
   if test $gt_cv_c_intmax_t = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -10249,7 +11261,7 @@ _ACEOF
 
   else
 
-    test $ac_cv_type_long_long = yes \
+    test $ac_cv_type_long_long_int = yes \
       && ac_type='long long' \
       || ac_type='long'
 
@@ -10267,9 +11279,6 @@ _ACEOF
 
 
 
-
-
-
    if true; then
   GL_COND_LIBTOOL_TRUE=
   GL_COND_LIBTOOL_FALSE='#'
@@ -10279,6 +11288,9 @@ else
 fi
 
   gl_cond_libtool=true
+
+
+
   gl_source_base='gnulib'
 
 
 
   # Define an additional variable used in the Makefile substitution.
   if test $ac_cv_working_alloca_h = yes; then
-    { echo "$as_me:$LINENO: checking for alloca as a compiler built-in" >&5
-echo $ECHO_N "checking for alloca as a compiler built-in... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for alloca as a compiler built-in" >&5
+$as_echo_n "checking for alloca as a compiler built-in... " >&6; }
 if test "${gl_cv_rpl_alloca+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
       cat >conftest.$ac_ext <<_ACEOF
@@ -10319,8 +11331,8 @@ rm -f conftest*
 
 
 fi
-{ echo "$as_me:$LINENO: result: $gl_cv_rpl_alloca" >&5
-echo "${ECHO_T}$gl_cv_rpl_alloca" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gl_cv_rpl_alloca" >&5
+$as_echo "$gl_cv_rpl_alloca" >&6; }
     if test $gl_cv_rpl_alloca = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -10337,12 +11349,6 @@ _ACEOF
 
 
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_ALLOCA_H 1
-_ACEOF
-
-
-
 
   :
 
@@ -10357,11 +11363,11 @@ _ACEOF
   fi
 
 
-  { echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5
-echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5
+$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
 if test -z "$MKDIR_P"; then
   if test "${ac_cv_path_mkdir+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
@@ -10396,8 +11402,8 @@ fi
     MKDIR_P="$ac_install_sh -d"
   fi
 fi
-{ echo "$as_me:$LINENO: result: $MKDIR_P" >&5
-echo "${ECHO_T}$MKDIR_P" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
 
 
 
@@ -10410,7 +11416,7 @@ echo "${ECHO_T}$MKDIR_P" >&6; }
 
   FLOAT_H=
   case "$host_os" in
-    beos*)
+    beos* | openbsd*)
       FLOAT_H=float.h
 
 
@@ -10426,10 +11432,10 @@ echo "${ECHO_T}$MKDIR_P" >&6; }
      if test $gl_cv_have_include_next = yes; then
        gl_cv_next_float_h='<'float.h'>'
      else
-       { echo "$as_me:$LINENO: checking absolute name of <float.h>" >&5
-echo $ECHO_N "checking absolute name of <float.h>... $ECHO_C" >&6; }
+       { $as_echo "$as_me:$LINENO: checking absolute name of <float.h>" >&5
+$as_echo_n "checking absolute name of <float.h>... " >&6; }
 if test "${gl_cv_next_float_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
          if test $ac_cv_header_float_h = yes; then
@@ -10454,8 +11460,8 @@ _ACEOF
          fi
 
 fi
-{ echo "$as_me:$LINENO: result: $gl_cv_next_float_h" >&5
-echo "${ECHO_T}$gl_cv_next_float_h" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gl_cv_next_float_h" >&5
+$as_echo "$gl_cv_next_float_h" >&6; }
      fi
      NEXT_FLOAT_H=$gl_cv_next_float_h
 
@@ -10486,11 +11492,11 @@ echo "${ECHO_T}$gl_cv_next_float_h" >&6; }
 
 for ac_header in sys/mount.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; }
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -10511,20 +11517,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   eval "$as_ac_Header=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_Header=no"
 
 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
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -10546,8 +11556,8 @@ done
 
 
 
-{ echo "$as_me:$LINENO: checking how to get file system space usage" >&5
-echo "$as_me: checking how to get file system space usage" >&6;}
+{ $as_echo "$as_me:$LINENO: checking how to get file system space usage" >&5
+$as_echo "$as_me: checking how to get file system space usage" >&6;}
 ac_fsusage_space=no
 
 # Perform only the link test since it seems there are no variants of the
@@ -10558,10 +11568,10 @@ ac_fsusage_space=no
 # is what it gets when this test fails.
 if test $ac_fsusage_space = no; then
   # SVR4
-  { echo "$as_me:$LINENO: checking for statvfs function (SVR4)" >&5
-echo $ECHO_N "checking for statvfs function (SVR4)... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for statvfs function (SVR4)" >&5
+$as_echo_n "checking for statvfs function (SVR4)... " >&6; }
 if test "${fu_cv_sys_stat_statvfs+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -10597,31 +11607,35 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   fu_cv_sys_stat_statvfs=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        fu_cv_sys_stat_statvfs=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $fu_cv_sys_stat_statvfs" >&5
-echo "${ECHO_T}$fu_cv_sys_stat_statvfs" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $fu_cv_sys_stat_statvfs" >&5
+$as_echo "$fu_cv_sys_stat_statvfs" >&6; }
   if test $fu_cv_sys_stat_statvfs = yes; then
     ac_fsusage_space=yes
 
 
 if test $ac_fsusage_space = no; then
   # DEC Alpha running OSF/1
-  { echo "$as_me:$LINENO: checking for 3-argument statfs function (DEC OSF/1)" >&5
-echo $ECHO_N "checking for 3-argument statfs function (DEC OSF/1)... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for 3-argument statfs function (DEC OSF/1)" >&5
+$as_echo_n "checking for 3-argument statfs function (DEC OSF/1)... " >&6; }
   if test "${fu_cv_sys_stat_statfs3_osf1+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test "$cross_compiling" = yes; then
   fu_cv_sys_stat_statfs3_osf1=no
@@ -10666,37 +11680,40 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   fu_cv_sys_stat_statfs3_osf1=yes
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
 fu_cv_sys_stat_statfs3_osf1=no
 fi
+rm -rf conftest.dSYM
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 
 
 fi
 
-  { echo "$as_me:$LINENO: result: $fu_cv_sys_stat_statfs3_osf1" >&5
-echo "${ECHO_T}$fu_cv_sys_stat_statfs3_osf1" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $fu_cv_sys_stat_statfs3_osf1" >&5
+$as_echo "$fu_cv_sys_stat_statfs3_osf1" >&6; }
   if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
     ac_fsusage_space=yes
 
 
 if test $ac_fsusage_space = no; then
 # AIX
-  { echo "$as_me:$LINENO: checking for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)" >&5
-echo $ECHO_N "checking for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)" >&5
+$as_echo_n "checking for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)... " >&6; }
   if test "${fu_cv_sys_stat_statfs2_bsize+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test "$cross_compiling" = yes; then
   fu_cv_sys_stat_statfs2_bsize=no
@@ -10747,37 +11764,40 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   fu_cv_sys_stat_statfs2_bsize=yes
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
 fu_cv_sys_stat_statfs2_bsize=no
 fi
+rm -rf conftest.dSYM
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 
 
 fi
 
-  { echo "$as_me:$LINENO: result: $fu_cv_sys_stat_statfs2_bsize" >&5
-echo "${ECHO_T}$fu_cv_sys_stat_statfs2_bsize" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $fu_cv_sys_stat_statfs2_bsize" >&5
+$as_echo "$fu_cv_sys_stat_statfs2_bsize" >&6; }
   if test $fu_cv_sys_stat_statfs2_bsize = yes; then
     ac_fsusage_space=yes
 
 
 if test $ac_fsusage_space = no; then
 # SVR3
-  { echo "$as_me:$LINENO: checking for four-argument statfs (AIX-3.2.5, SVR3)" >&5
-echo $ECHO_N "checking for four-argument statfs (AIX-3.2.5, SVR3)... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for four-argument statfs (AIX-3.2.5, SVR3)" >&5
+$as_echo_n "checking for four-argument statfs (AIX-3.2.5, SVR3)... " >&6; }
   if test "${fu_cv_sys_stat_statfs4+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test "$cross_compiling" = yes; then
   fu_cv_sys_stat_statfs4=no
@@ -10819,37 +11839,40 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   fu_cv_sys_stat_statfs4=yes
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
 fu_cv_sys_stat_statfs4=no
 fi
+rm -rf conftest.dSYM
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 
 
 fi
 
-  { echo "$as_me:$LINENO: result: $fu_cv_sys_stat_statfs4" >&5
-echo "${ECHO_T}$fu_cv_sys_stat_statfs4" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $fu_cv_sys_stat_statfs4" >&5
+$as_echo "$fu_cv_sys_stat_statfs4" >&6; }
   if test $fu_cv_sys_stat_statfs4 = yes; then
     ac_fsusage_space=yes
 
 
 if test $ac_fsusage_space = no; then
 # 4.4BSD and NetBSD
-  { echo "$as_me:$LINENO: checking for two-argument statfs with statfs.fsize member (4.4BSD and NetBSD)" >&5
-echo $ECHO_N "checking for two-argument statfs with statfs.fsize member (4.4BSD and NetBSD)... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for two-argument statfs with statfs.fsize member (4.4BSD and NetBSD)" >&5
+$as_echo_n "checking for two-argument statfs with statfs.fsize member (4.4BSD and NetBSD)... " >&6; }
   if test "${fu_cv_sys_stat_statfs2_fsize+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test "$cross_compiling" = yes; then
   fu_cv_sys_stat_statfs2_fsize=no
@@ -10897,37 +11920,40 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   fu_cv_sys_stat_statfs2_fsize=yes
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
 fu_cv_sys_stat_statfs2_fsize=no
 fi
+rm -rf conftest.dSYM
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 
 
 fi
 
-  { echo "$as_me:$LINENO: result: $fu_cv_sys_stat_statfs2_fsize" >&5
-echo "${ECHO_T}$fu_cv_sys_stat_statfs2_fsize" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $fu_cv_sys_stat_statfs2_fsize" >&5
+$as_echo "$fu_cv_sys_stat_statfs2_fsize" >&6; }
   if test $fu_cv_sys_stat_statfs2_fsize = yes; then
     ac_fsusage_space=yes
 
 
 if test $ac_fsusage_space = no; then
   # Ultrix
-  { echo "$as_me:$LINENO: checking for two-argument statfs with struct fs_data (Ultrix)" >&5
-echo $ECHO_N "checking for two-argument statfs with struct fs_data (Ultrix)... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for two-argument statfs with struct fs_data (Ultrix)" >&5
+$as_echo_n "checking for two-argument statfs with struct fs_data (Ultrix)... " >&6; }
   if test "${fu_cv_sys_stat_fs_data+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test "$cross_compiling" = yes; then
   fu_cv_sys_stat_fs_data=no
@@ -10979,37 +12005,40 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   fu_cv_sys_stat_fs_data=yes
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
 fu_cv_sys_stat_fs_data=no
 fi
+rm -rf conftest.dSYM
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 
 
 fi
 
-  { echo "$as_me:$LINENO: result: $fu_cv_sys_stat_fs_data" >&5
-echo "${ECHO_T}$fu_cv_sys_stat_fs_data" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $fu_cv_sys_stat_fs_data" >&5
+$as_echo "$fu_cv_sys_stat_fs_data" >&6; }
   if test $fu_cv_sys_stat_fs_data = yes; then
     ac_fsusage_space=yes
 
@@ -11036,13 +12065,14 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
         test ! -s conftest.err
@@ -11054,7 +12084,7 @@ _ACEOF
 
     ac_fsusage_space=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
 
 
   if test $gl_cv_fs_space = yes; then
-    gl_LIBOBJS="$gl_LIBOBJS fsusage.$ac_objext"
+
+
+
+
+
+
+
+  gl_LIBOBJS="$gl_LIBOBJS fsusage.$ac_objext"
+
 
 
 
 
 for ac_header in dustat.h sys/fs/s5param.h sys/filsys.h sys/statfs.h
 do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+as_ac_Header=`$as_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; }
+  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -11109,32 +12148,33 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -11148,69 +12188,73 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
         test ! -s conftest.err
        }; then
   ac_header_preproc=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&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; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
 
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
+as_val=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
 done
 
 
-  { echo "$as_me:$LINENO: checking for statfs that truncates block counts" >&5
-echo $ECHO_N "checking for statfs that truncates block counts... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for statfs that truncates block counts" >&5
+$as_echo_n "checking for statfs that truncates block counts... " >&6; }
   if test "${fu_cv_sys_truncating_statfs+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -11250,20 +12294,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   fu_cv_sys_truncating_statfs=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        fu_cv_sys_truncating_statfs=no
@@ -11279,20 +12324,28 @@ cat >>confdefs.h <<\_ACEOF
 _ACEOF
 
   fi
-  { echo "$as_me:$LINENO: result: $fu_cv_sys_truncating_statfs" >&5
-echo "${ECHO_T}$fu_cv_sys_truncating_statfs" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $fu_cv_sys_truncating_statfs" >&5
+$as_echo "$fu_cv_sys_truncating_statfs" >&6; }
 
 
   fi
 
 
-    { echo "$as_me:$LINENO: checking how to do getaddrinfo, freeaddrinfo and getnameinfo" >&5
-echo "$as_me: checking how to do getaddrinfo, freeaddrinfo and getnameinfo" >&6;}
+    { $as_echo "$as_me:$LINENO: checking how to do getaddrinfo, freeaddrinfo and getnameinfo" >&5
+$as_echo "$as_me: checking how to do getaddrinfo, freeaddrinfo and getnameinfo" >&6;}
+
+
+  :
+
+
 
-  { echo "$as_me:$LINENO: checking for library containing getaddrinfo" >&5
-echo $ECHO_N "checking for library containing getaddrinfo... $ECHO_C" >&6; }
+
+
+
+  { $as_echo "$as_me:$LINENO: checking for library containing getaddrinfo" >&5
+$as_echo_n "checking for library containing getaddrinfo... " >&6; }
 if test "${ac_cv_search_getaddrinfo+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_func_search_save_LIBS=$LIBS
 cat >conftest.$ac_ext <<_ACEOF
@@ -11330,26 +12383,30 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_search_getaddrinfo=$ac_res
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext
   if test "${ac_cv_search_getaddrinfo+set}" = set; then
 rm conftest.$ac_ext
 LIBS=$ac_func_search_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_search_getaddrinfo" >&5
-echo "${ECHO_T}$ac_cv_search_getaddrinfo" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_getaddrinfo" >&5
+$as_echo "$ac_cv_search_getaddrinfo" >&6; }
 ac_res=$ac_cv_search_getaddrinfo
 if test "$ac_res" != no; then
   test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
 fi
 
-
-for ac_func in getaddrinfo
-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
+  { $as_echo "$as_me:$LINENO: checking for getaddrinfo" >&5
+$as_echo_n "checking for getaddrinfo... " >&6; }
+if test "${gl_cv_func_getaddrinfo+set}" = set; then
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
+
+    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"
+#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
 #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
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
 #endif
+#include <stddef.h>
 
 int
 main ()
 {
-return $ac_func ();
+getaddrinfo("", "", NULL, NULL);
   ;
   return 0;
 }
@@ -11432,43 +12465,40 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  eval "$as_ac_var=yes"
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
+  gl_cv_func_getaddrinfo=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-       eval "$as_ac_var=no"
+       gl_cv_func_getaddrinfo=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
-
-else
-
-    { echo "$as_me:$LINENO: checking for getaddrinfo in ws2tcpip.h and -lws2_32" >&5
-echo $ECHO_N "checking for getaddrinfo in ws2tcpip.h and -lws2_32... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gl_cv_func_getaddrinfo" >&5
+$as_echo "$gl_cv_func_getaddrinfo" >&6; }
+  if test $gl_cv_func_getaddrinfo = no; then
+    { $as_echo "$as_me:$LINENO: checking for getaddrinfo in ws2tcpip.h and -lws2_32" >&5
+$as_echo_n "checking for getaddrinfo in ws2tcpip.h and -lws2_32... " >&6; }
 if test "${gl_cv_w32_getaddrinfo+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
       gl_cv_w32_getaddrinfo=no
@@ -11484,11 +12514,12 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef HAVE_WS2TCPIP_H
 #include <ws2tcpip.h>
 #endif
+#include <stddef.h>
 
 int
 main ()
 {
-getaddrinfo(0, 0, 0, 0);
+getaddrinfo(NULL, NULL, NULL, NULL);
   ;
   return 0;
 }
@@ -11499,56 +12530,58 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   gl_cv_w32_getaddrinfo=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
     LIBS="$am_save_LIBS"
 fi
-{ echo "$as_me:$LINENO: result: $gl_cv_w32_getaddrinfo" >&5
-echo "${ECHO_T}$gl_cv_w32_getaddrinfo" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gl_cv_w32_getaddrinfo" >&5
+$as_echo "$gl_cv_w32_getaddrinfo" >&6; }
     if test "$gl_cv_w32_getaddrinfo" = "yes"; then
       LIBS="$LIBS -lws2_32"
     else
-      gl_LIBOBJS="$gl_LIBOBJS getaddrinfo.$ac_objext"
-    fi
 
-fi
-done
 
 
-  # We can't use AC_REPLACE_FUNCS here because gai_strerror may be an
-  # inline function declared in ws2tcpip.h, so we need to get that
-  # header included somehow.
 
-  :
 
 
 
+  gl_LIBOBJS="$gl_LIBOBJS getaddrinfo.$ac_objext"
 
+    fi
+  fi
 
-  { echo "$as_me:$LINENO: checking for gai_strerror (possibly via ws2tcpip.h)" >&5
-echo $ECHO_N "checking for gai_strerror (possibly via ws2tcpip.h)... $ECHO_C" >&6; }
+  # We can't use AC_REPLACE_FUNCS here because gai_strerror may be an
+  # inline function declared in ws2tcpip.h, so we need to get that
+  # header included somehow.
+  { $as_echo "$as_me:$LINENO: checking for gai_strerror (possibly via ws2tcpip.h)" >&5
+$as_echo_n "checking for gai_strerror (possibly via ws2tcpip.h)... " >&6; }
 if test "${gl_cv_func_gai_strerror+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
       cat >conftest.$ac_ext <<_ACEOF
@@ -11568,11 +12601,12 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef HAVE_WS2TCPIP_H
 #include <ws2tcpip.h>
 #endif
+#include <stddef.h>
 
 int
 main ()
 {
-gai_strerror (0);
+gai_strerror (NULL);
   ;
   return 0;
 }
@@ -11583,40 +12617,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   gl_cv_func_gai_strerror=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        gl_cv_func_gai_strerror=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $gl_cv_func_gai_strerror" >&5
-echo "${ECHO_T}$gl_cv_func_gai_strerror" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gl_cv_func_gai_strerror" >&5
+$as_echo "$gl_cv_func_gai_strerror" >&6; }
   if test $gl_cv_func_gai_strerror = no; then
-    gl_LIBOBJS="$gl_LIBOBJS gai_strerror.$ac_objext"
+
+
+
+
+
+
+
+  gl_LIBOBJS="$gl_LIBOBJS gai_strerror.$ac_objext"
+
   fi
 
 
-    { echo "$as_me:$LINENO: checking for library containing gethostbyname" >&5
-echo $ECHO_N "checking for library containing gethostbyname... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for library containing gethostbyname" >&5
+$as_echo_n "checking for library containing gethostbyname... " >&6; }
 if test "${ac_cv_search_gethostbyname+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_func_search_save_LIBS=$LIBS
 cat >conftest.$ac_ext <<_ACEOF
@@ -11654,26 +12700,30 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_search_gethostbyname=$ac_res
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext
   if test "${ac_cv_search_gethostbyname+set}" = set; then
 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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_gethostbyname" >&5
+$as_echo "$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
 
-  { echo "$as_me:$LINENO: checking for library containing getservbyname" >&5
-echo $ECHO_N "checking for library containing getservbyname... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for library containing getservbyname" >&5
+$as_echo_n "checking for library containing getservbyname... " >&6; }
 if test "${ac_cv_search_getservbyname+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_func_search_save_LIBS=$LIBS
 cat >conftest.$ac_ext <<_ACEOF
@@ -11737,26 +12787,30 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_search_getservbyname=$ac_res
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext
   if test "${ac_cv_search_getservbyname+set}" = set; then
@@ -11771,8 +12825,8 @@ fi
 rm conftest.$ac_ext
 LIBS=$ac_func_search_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_search_getservbyname" >&5
-echo "${ECHO_T}$ac_cv_search_getservbyname" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_getservbyname" >&5
+$as_echo "$ac_cv_search_getservbyname" >&6; }
 ac_res=$ac_cv_search_getservbyname
 if test "$ac_res" != no; then
   test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -11839,43 +12893,50 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
 else
 
-    { echo "$as_me:$LINENO: checking for gethostbyname in winsock2.h and -lws2_32" >&5
-echo $ECHO_N "checking for gethostbyname in winsock2.h and -lws2_32... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for gethostbyname in winsock2.h and -lws2_32" >&5
+$as_echo_n "checking for gethostbyname in winsock2.h and -lws2_32... " >&6; }
 if test "${gl_cv_w32_gethostbyname+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
       gl_cv_w32_gethostbyname=no
@@ -11891,11 +12952,12 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef HAVE_WINSOCK2_H
 #include <winsock2.h>
 #endif
+#include <stddef.h>
 
 int
 main ()
 {
-gethostbyname(0);
+gethostbyname(NULL);
   ;
   return 0;
 }
@@ -11906,32 +12968,36 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   gl_cv_w32_gethostbyname=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
     LIBS="$am_save_LIBS"
 fi
-{ echo "$as_me:$LINENO: result: $gl_cv_w32_gethostbyname" >&5
-echo "${ECHO_T}$gl_cv_w32_gethostbyname" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gl_cv_w32_gethostbyname" >&5
+$as_echo "$gl_cv_w32_gethostbyname" >&6; }
     if test "$gl_cv_w32_gethostbyname" = "yes"; then
       LIBS="$LIBS -lws2_32"
     fi
@@ -11954,10 +13020,10 @@ done
 
 
 
-  { echo "$as_me:$LINENO: checking whether getaddrinfo is declared" >&5
-echo $ECHO_N "checking whether getaddrinfo is declared... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking whether getaddrinfo is declared" >&5
+$as_echo_n "checking whether getaddrinfo is declared... " >&6; }
 if test "${ac_cv_have_decl_getaddrinfo+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -11998,20 +13064,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_have_decl_getaddrinfo=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_have_decl_getaddrinfo=no
@@ -12019,9 +13086,9 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_getaddrinfo" >&5
-echo "${ECHO_T}$ac_cv_have_decl_getaddrinfo" >&6; }
-if test $ac_cv_have_decl_getaddrinfo = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_getaddrinfo" >&5
+$as_echo "$ac_cv_have_decl_getaddrinfo" >&6; }
+if test "x$ac_cv_have_decl_getaddrinfo" = x""yes; then
 
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_GETADDRINFO 1
@@ -12035,10 +13102,10 @@ _ACEOF
 
 
 fi
-{ echo "$as_me:$LINENO: checking whether freeaddrinfo is declared" >&5
-echo $ECHO_N "checking whether freeaddrinfo is declared... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking whether freeaddrinfo is declared" >&5
+$as_echo_n "checking whether freeaddrinfo is declared... " >&6; }
 if test "${ac_cv_have_decl_freeaddrinfo+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -12079,20 +13146,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_have_decl_freeaddrinfo=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_have_decl_freeaddrinfo=no
@@ -12100,9 +13168,9 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_freeaddrinfo" >&5
-echo "${ECHO_T}$ac_cv_have_decl_freeaddrinfo" >&6; }
-if test $ac_cv_have_decl_freeaddrinfo = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_freeaddrinfo" >&5
+$as_echo "$ac_cv_have_decl_freeaddrinfo" >&6; }
+if test "x$ac_cv_have_decl_freeaddrinfo" = x""yes; then
 
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_FREEADDRINFO 1
@@ -12116,10 +13184,10 @@ _ACEOF
 
 
 fi
-{ echo "$as_me:$LINENO: checking whether gai_strerror is declared" >&5
-echo $ECHO_N "checking whether gai_strerror is declared... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking whether gai_strerror is declared" >&5
+$as_echo_n "checking whether gai_strerror is declared... " >&6; }
 if test "${ac_cv_have_decl_gai_strerror+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -12160,20 +13228,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_have_decl_gai_strerror=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_have_decl_gai_strerror=no
@@ -12181,9 +13250,9 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_gai_strerror" >&5
-echo "${ECHO_T}$ac_cv_have_decl_gai_strerror" >&6; }
-if test $ac_cv_have_decl_gai_strerror = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_gai_strerror" >&5
+$as_echo "$ac_cv_have_decl_gai_strerror" >&6; }
+if test "x$ac_cv_have_decl_gai_strerror" = x""yes; then
 
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_GAI_STRERROR 1
@@ -12197,10 +13266,10 @@ _ACEOF
 
 
 fi
-{ echo "$as_me:$LINENO: checking whether getnameinfo is declared" >&5
-echo $ECHO_N "checking whether getnameinfo is declared... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking whether getnameinfo is declared" >&5
+$as_echo_n "checking whether getnameinfo is declared... " >&6; }
 if test "${ac_cv_have_decl_getnameinfo+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -12241,20 +13310,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_have_decl_getnameinfo=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_have_decl_getnameinfo=no
@@ -12262,9 +13332,9 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_getnameinfo" >&5
-echo "${ECHO_T}$ac_cv_have_decl_getnameinfo" >&6; }
-if test $ac_cv_have_decl_getnameinfo = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_getnameinfo" >&5
+$as_echo "$ac_cv_have_decl_getnameinfo" >&6; }
+if test "x$ac_cv_have_decl_getnameinfo" = x""yes; then
 
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_GETNAMEINFO 1
@@ -12280,12 +13350,13 @@ _ACEOF
 fi
 
 
-  { echo "$as_me:$LINENO: checking for struct addrinfo" >&5
-echo $ECHO_N "checking for struct addrinfo... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for struct addrinfo" >&5
+$as_echo_n "checking for struct addrinfo... " >&6; }
 if test "${ac_cv_type_struct_addrinfo+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
+  ac_cv_type_struct_addrinfo=no
+cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -12304,14 +13375,57 @@ cat >>conftest.$ac_ext <<_ACEOF
 #endif
 
 
-typedef struct addrinfo ac__type_new_;
 int
 main ()
 {
-if ((ac__type_new_ *) 0)
-  return 0;
-if (sizeof (ac__type_new_))
+if (sizeof (struct addrinfo))
+       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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#ifdef HAVE_WS2TCPIP_H
+#include <ws2tcpip.h>
+#endif
+
+
+int
+main ()
+{
+if (sizeof ((struct addrinfo)))
+         return 0;
   ;
   return 0;
 }
@@ -12322,30 +13436,39 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
-  ac_cv_type_struct_addrinfo=yes
+  :
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_cv_type_struct_addrinfo=no
+       ac_cv_type_struct_addrinfo=yes
 fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_struct_addrinfo" >&5
-echo "${ECHO_T}$ac_cv_type_struct_addrinfo" >&6; }
-if test $ac_cv_type_struct_addrinfo = yes; then
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_struct_addrinfo" >&5
+$as_echo "$ac_cv_type_struct_addrinfo" >&6; }
+if test "x$ac_cv_type_struct_addrinfo" = x""yes; then
 
 cat >>confdefs.h <<_ACEOF
 #define HAVE_STRUCT_ADDRINFO 1
 
 
 
+  if test -n "$GETOPT_H"; then
+
+
+
+
+
+
+
+
+  gl_LIBOBJS="$gl_LIBOBJS getopt.$ac_objext"
+
+
+
+
+
+
+
+
+  gl_LIBOBJS="$gl_LIBOBJS getopt1.$ac_objext"
+
+
+  GETOPT_H=getopt.h
+
+cat >>confdefs.h <<\_ACEOF
+#define __GETOPT_PREFIX rpl_
+_ACEOF
+
 
 
 
 
 
 
-  { echo "$as_me:$LINENO: checking for gettimeofday with POSIX signature" >&5
-echo $ECHO_N "checking for gettimeofday with POSIX signature... $ECHO_C" >&6; }
+
+fi
+
+
+
+
+
+
+
+
+  :
+
+
+
+
+
+
+  { $as_echo "$as_me:$LINENO: checking for gettimeofday with POSIX signature" >&5
+$as_echo_n "checking for gettimeofday with POSIX signature... " >&6; }
 if test "${gl_cv_func_gettimeofday_posix_signature+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -12401,20 +13568,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   gl_cv_func_gettimeofday_posix_signature=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        gl_cv_func_gettimeofday_posix_signature=no
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $gl_cv_func_gettimeofday_posix_signature" >&5
-echo "${ECHO_T}$gl_cv_func_gettimeofday_posix_signature" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gl_cv_func_gettimeofday_posix_signature" >&5
+$as_echo "$gl_cv_func_gettimeofday_posix_signature" >&6; }
 
 
 
 
- { echo "$as_me:$LINENO: checking whether gettimeofday clobbers localtime buffer" >&5
-echo $ECHO_N "checking whether gettimeofday clobbers localtime buffer... $ECHO_C" >&6; }
+ { $as_echo "$as_me:$LINENO: checking whether gettimeofday clobbers localtime buffer" >&5
+$as_echo_n "checking whether gettimeofday clobbers localtime buffer... " >&6; }
 if test "${gl_cv_func_gettimeofday_clobber+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test "$cross_compiling" = yes; then
        gl_cv_func_gettimeofday_clobber=yes
@@ -12470,320 +13638,72 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   gl_cv_func_gettimeofday_clobber=no
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
 gl_cv_func_gettimeofday_clobber=yes
 fi
+rm -rf conftest.dSYM
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 
 
 fi
-{ echo "$as_me:$LINENO: result: $gl_cv_func_gettimeofday_clobber" >&5
-echo "${ECHO_T}$gl_cv_func_gettimeofday_clobber" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gl_cv_func_gettimeofday_clobber" >&5
+$as_echo "$gl_cv_func_gettimeofday_clobber" >&6; }
 
  if test $gl_cv_func_gettimeofday_clobber = yes; then
    REPLACE_GETTIMEOFDAY=1
    SYS_TIME_H=sys/time.h
 
-  gl_LIBOBJS="$gl_LIBOBJS gettimeofday.$ac_objext"
-
-
-for ac_header in sys/timeb.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); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; 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 && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.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_c_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;}
 
-    ;;
-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_func in _ftime
-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); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; 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_ipa8_conftest.oo \
-      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
-
-
-
-cat >>confdefs.h <<\_ACEOF
-#define gmtime rpl_gmtime
-_ACEOF
-
-
-cat >>confdefs.h <<\_ACEOF
-#define localtime rpl_localtime
-_ACEOF
-
-
-
-cat >>confdefs.h <<\_ACEOF
-#define GETTIMEOFDAY_CLOBBERS_LOCALTIME 1
-_ACEOF
-
- fi
-
+  gl_LIBOBJS="$gl_LIBOBJS gettimeofday.$ac_objext"
 
-  if test $gl_cv_func_gettimeofday_posix_signature != yes; then
-    REPLACE_GETTIMEOFDAY=1
-    SYS_TIME_H=sys/time.h
-    if test $gl_cv_func_gettimeofday_clobber != yes; then
-      gl_LIBOBJS="$gl_LIBOBJS gettimeofday.$ac_objext"
 
 
 for ac_header in sys/timeb.h
 do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+as_ac_Header=`$as_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; }
+  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -12799,32 +13719,33 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -12838,69 +13759,73 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
         test ! -s conftest.err
        }; then
   ac_header_preproc=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&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; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
 
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
+as_val=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -12910,11 +13835,11 @@ done
 
 for ac_func in _ftime
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -12967,35 +13892,323 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
+  eval "$as_ac_var=yes"
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       eval "$as_ac_var=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+
+cat >>confdefs.h <<\_ACEOF
+#define gmtime rpl_gmtime
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define localtime rpl_localtime
+_ACEOF
+
+
+
+cat >>confdefs.h <<\_ACEOF
+#define GETTIMEOFDAY_CLOBBERS_LOCALTIME 1
+_ACEOF
+
+ fi
+
+
+  if test $gl_cv_func_gettimeofday_posix_signature != yes; then
+    REPLACE_GETTIMEOFDAY=1
+    SYS_TIME_H=sys/time.h
+    if test $gl_cv_func_gettimeofday_clobber != yes; then
+
+
+
+
+
+
+
+  gl_LIBOBJS="$gl_LIBOBJS gettimeofday.$ac_objext"
+
+
+
+for ac_header in sys/timeb.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  $as_echo_n "(cached) " >&6
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  $as_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
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  $as_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
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  $as_echo_n "(cached) " >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+fi
+as_val=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+for ac_func in _ftime
+do
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+  $as_echo_n "(cached) " >&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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -13007,13 +14220,20 @@ done
 
 
 
+
+
+
+
+
+
+
 for ac_func in inet_ntop
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -13066,44 +14286,54 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
 else
-  gl_LIBOBJS="$gl_LIBOBJS $ac_func.$ac_objext"
+
+    gl_LIBOBJS="$gl_LIBOBJS $ac_func.$ac_objext"
+
 fi
 done
 
 
 
+
   :
 
 
@@ -13113,10 +14343,10 @@ done
 
 
 
-  { echo "$as_me:$LINENO: checking whether inet_ntop is declared" >&5
-echo $ECHO_N "checking whether inet_ntop is declared... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking whether inet_ntop is declared" >&5
+$as_echo_n "checking whether inet_ntop is declared... " >&6; }
 if test "${ac_cv_have_decl_inet_ntop+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -13143,20 +14373,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_have_decl_inet_ntop=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_have_decl_inet_ntop=no
@@ -13164,9 +14395,9 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_inet_ntop" >&5
-echo "${ECHO_T}$ac_cv_have_decl_inet_ntop" >&6; }
-if test $ac_cv_have_decl_inet_ntop = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_inet_ntop" >&5
+$as_echo "$ac_cv_have_decl_inet_ntop" >&6; }
+if test "x$ac_cv_have_decl_inet_ntop" = x""yes; then
 
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_INET_NTOP 1
@@ -13203,7 +14434,15 @@ cat >>confdefs.h <<\_ACEOF
 _ACEOF
 
   else
-    gl_LIBOBJS="$gl_LIBOBJS malloc.$ac_objext"
+
+
+
+
+
+
+
+  gl_LIBOBJS="$gl_LIBOBJS malloc.$ac_objext"
+
     HAVE_MALLOC_POSIX=0
   fi
 
@@ -13215,13 +14454,20 @@ _ACEOF
 
 
 
+
+
+
+
+
+
+
 for ac_func in mkdtemp
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -13274,42 +14520,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
 else
-  gl_LIBOBJS="$gl_LIBOBJS $ac_func.$ac_objext"
+
+    gl_LIBOBJS="$gl_LIBOBJS $ac_func.$ac_objext"
+
 fi
 done
 
+
   if test $ac_cv_func_mkdtemp = no; then
     HAVE_MKDTEMP=0
     :
@@ -13321,10 +14577,10 @@ done
   GNULIB_MKDTEMP=1
 
 
-  { echo "$as_me:$LINENO: checking whether <netinet/in.h> is self-contained" >&5
-echo $ECHO_N "checking whether <netinet/in.h> is self-contained... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking whether <netinet/in.h> is self-contained" >&5
+$as_echo_n "checking whether <netinet/in.h> is self-contained... " >&6; }
 if test "${gl_cv_header_netinet_in_h_selfcontained+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
       cat >conftest.$ac_ext <<_ACEOF
@@ -13348,20 +14604,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   gl_cv_header_netinet_in_h_selfcontained=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        gl_cv_header_netinet_in_h_selfcontained=no
@@ -13370,8 +14627,8 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 fi
-{ echo "$as_me:$LINENO: result: $gl_cv_header_netinet_in_h_selfcontained" >&5
-echo "${ECHO_T}$gl_cv_header_netinet_in_h_selfcontained" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gl_cv_header_netinet_in_h_selfcontained" >&5
+$as_echo "$gl_cv_header_netinet_in_h_selfcontained" >&6; }
   if test $gl_cv_header_netinet_in_h_selfcontained = yes; then
     NETINET_IN_H=''
   else
@@ -13379,20 +14636,21 @@ echo "${ECHO_T}$gl_cv_header_netinet_in_h_selfcontained" >&6; }
 
 for ac_header in netinet/in.h
 do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+as_ac_Header=`$as_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; }
+  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -13408,32 +14666,33 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -13447,69 +14706,73 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
         test ! -s conftest.err
        }; then
   ac_header_preproc=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&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; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
 
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
+as_val=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -13530,10 +14793,10 @@ done
      if test $gl_cv_have_include_next = yes; then
        gl_cv_next_netinet_in_h='<'netinet/in.h'>'
      else
-       { echo "$as_me:$LINENO: checking absolute name of <netinet/in.h>" >&5
-echo $ECHO_N "checking absolute name of <netinet/in.h>... $ECHO_C" >&6; }
+       { $as_echo "$as_me:$LINENO: checking absolute name of <netinet/in.h>" >&5
+$as_echo_n "checking absolute name of <netinet/in.h>... " >&6; }
 if test "${gl_cv_next_netinet_in_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
          if test $ac_cv_header_netinet_in_h = yes; then
@@ -13558,8 +14821,8 @@ _ACEOF
          fi
 
 fi
-{ echo "$as_me:$LINENO: result: $gl_cv_next_netinet_in_h" >&5
-echo "${ECHO_T}$gl_cv_next_netinet_in_h" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gl_cv_next_netinet_in_h" >&5
+$as_echo "$gl_cv_next_netinet_in_h" >&6; }
      fi
      NEXT_NETINET_IN_H=$gl_cv_next_netinet_in_h
 
@@ -13574,11 +14837,11 @@ echo "${ECHO_T}$gl_cv_next_netinet_in_h" >&6; }
   fi
 
 
-  { echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5
-echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5
+$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
 if test -z "$MKDIR_P"; then
   if test "${ac_cv_path_mkdir+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
     MKDIR_P="$ac_install_sh -d"
   fi
 fi
-{ echo "$as_me:$LINENO: result: $MKDIR_P" >&5
-echo "${ECHO_T}$MKDIR_P" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
+
+
+
+
+
+
+
 
 
   gl_LIBOBJS="$gl_LIBOBJS physmem.$ac_objext"
 
+
   # Prerequisites of lib/physmem.c.
 
 
@@ -13632,11 +14903,11 @@ for ac_header in sys/pstat.h sys/sysmp.h sys/sysinfo.h \
     machine/hal_sysinfo.h sys/table.h sys/param.h sys/sysctl.h \
     sys/systemcfg.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; }
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -13654,20 +14925,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   eval "$as_ac_Header=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_Header=no"
 
 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
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -13696,11 +14971,11 @@ done
 
 for ac_func in pstat_getstatic pstat_getdynamic sysmp getsysinfo sysctl table
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -13753,35 +15028,42 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -13790,6 +15072,13 @@ done
 
 
 
+
+
+
+
+
+
+
   gl_LIBOBJS="$gl_LIBOBJS safe-read.$ac_objext"
 
 
@@ -13797,6 +15086,14 @@ done
 
 
 
+
+
+
+
+
+
+
+
   gl_LIBOBJS="$gl_LIBOBJS safe-write.$ac_objext"
 
 
@@ -13807,22 +15104,24 @@ done
 
 
 
+
 for ac_header in stdint.h
 do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+as_ac_Header=`$as_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; }
+  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -13838,32 +15137,33 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -13877,77 +15177,81 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
         test ! -s conftest.err
        }; then
   ac_header_preproc=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&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; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
 
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
+as_val=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
 
 done
 
-    { echo "$as_me:$LINENO: checking for SIZE_MAX" >&5
-echo $ECHO_N "checking for SIZE_MAX... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for SIZE_MAX" >&5
+$as_echo_n "checking for SIZE_MAX... " >&6; }
   result=
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -13998,13 +15302,14 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
@@ -14035,20 +15340,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_hi=$ac_mid; break
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_lo=`expr $ac_mid + 1`
@@ -14062,7 +15368,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   done
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        cat >conftest.$ac_ext <<_ACEOF
@@ -14089,13 +15395,14 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
@@ -14126,20 +15433,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_lo=$ac_mid; break
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_hi=`expr '(' $ac_mid ')' - 1`
@@ -14153,7 +15461,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   done
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_lo= ac_hi=
@@ -14190,20 +15498,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_hi=$ac_mid
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_lo=`expr '(' $ac_mid ')' + 1`
@@ -14240,15 +15549,17 @@ main ()
       long int i = longval ();
       if (i != (sizeof (size_t) * CHAR_BIT - 1))
        return 1;
-      fprintf (f, "%ld\n", i);
+      fprintf (f, "%ld", i);
     }
   else
     {
       unsigned long int i = ulongval ();
       if (i != (sizeof (size_t) * CHAR_BIT - 1))
        return 1;
-      fprintf (f, "%lu\n", i);
+      fprintf (f, "%lu", i);
     }
+  /* Do not output a trailing newline, as this causes \r\n confusion
+     on some platforms.  */
   return ferror (f) || fclose (f) != 0;
 
   ;
@@ -14261,29 +15572,32 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   size_t_bits_minus_1=`cat conftest.val`
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
 size_t_bits_minus_1=
 fi
+rm -rf conftest.dSYM
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 rm -f conftest.val
@@ -14313,13 +15627,14 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
@@ -14349,20 +15664,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_hi=$ac_mid; break
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_lo=`expr $ac_mid + 1`
@@ -14376,7 +15692,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   done
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        cat >conftest.$ac_ext <<_ACEOF
@@ -14402,13 +15718,14 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
@@ -14438,20 +15755,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_lo=$ac_mid; break
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_hi=`expr '(' $ac_mid ')' - 1`
@@ -14465,7 +15783,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   done
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_lo= ac_hi=
@@ -14501,20 +15819,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_hi=$ac_mid
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_lo=`expr '(' $ac_mid ')' + 1`
@@ -14550,15 +15869,17 @@ main ()
       long int i = longval ();
       if (i != (sizeof (size_t) <= sizeof (unsigned int)))
        return 1;
-      fprintf (f, "%ld\n", i);
+      fprintf (f, "%ld", i);
     }
   else
     {
       unsigned long int i = ulongval ();
       if (i != (sizeof (size_t) <= sizeof (unsigned int)))
        return 1;
-      fprintf (f, "%lu\n", i);
+      fprintf (f, "%lu", i);
     }
+  /* Do not output a trailing newline, as this causes \r\n confusion
+     on some platforms.  */
   return ferror (f) || fclose (f) != 0;
 
   ;
@@ -14571,29 +15892,32 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   fits_in_uint=`cat conftest.val`
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
 fits_in_uint=
 fi
+rm -rf conftest.dSYM
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 rm -f conftest.val
@@ -14624,20 +15948,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   fits_in_uint=0
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
@@ -14654,8 +15979,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
             result='((size_t)~(size_t)0)'
     fi
   fi
-  { echo "$as_me:$LINENO: result: $result" >&5
-echo "${ECHO_T}$result" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $result" >&5
+$as_echo "$result" >&6; }
   if test "$result" != yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -14669,11 +15994,11 @@ _ACEOF
 
 for ac_func in snprintf
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -14726,35 +16051,42 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -14763,7 +16095,15 @@ done
   if test $ac_cv_func_snprintf = no; then
 
 
+
+
+
+
+
+
+
   gl_LIBOBJS="$gl_LIBOBJS snprintf.$ac_objext"
+
   if test $ac_cv_func_snprintf = yes; then
     REPLACE_SNPRINTF=1
   fi
@@ -14785,12 +16125,13 @@ done
 
   GNULIB_SNPRINTF=1
 
-     { echo "$as_me:$LINENO: checking for socklen_t" >&5
-echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6; }
+     { $as_echo "$as_me:$LINENO: checking for socklen_t" >&5
+$as_echo_n "checking for socklen_t... " >&6; }
 if test "${ac_cv_type_socklen_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
+  ac_cv_type_socklen_t=no
+cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -14803,14 +16144,51 @@ cat >>conftest.$ac_ext <<_ACEOF
       # include <ws2tcpip.h>
       #endif
 
-typedef socklen_t ac__type_new_;
 int
 main ()
 {
-if ((ac__type_new_ *) 0)
-  return 0;
-if (sizeof (ac__type_new_))
+if (sizeof (socklen_t))
+       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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+      #if HAVE_SYS_SOCKET_H
+      # include <sys/socket.h>
+      #elif HAVE_WS2TCPIP_H
+      # include <ws2tcpip.h>
+      #endif
+
+int
+main ()
+{
+if (sizeof ((socklen_t)))
+         return 0;
   ;
   return 0;
 }
@@ -14821,36 +16199,45 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
-  ac_cv_type_socklen_t=yes
+  :
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_type_socklen_t=yes
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_cv_type_socklen_t=no
+
 fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_socklen_t" >&5
-echo "${ECHO_T}$ac_cv_type_socklen_t" >&6; }
-if test $ac_cv_type_socklen_t = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_socklen_t" >&5
+$as_echo "$ac_cv_type_socklen_t" >&6; }
+if test "x$ac_cv_type_socklen_t" = x""yes; then
   :
 else
-  { echo "$as_me:$LINENO: checking for socklen_t equivalent" >&5
-echo $ECHO_N "checking for socklen_t equivalent... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for socklen_t equivalent" >&5
+$as_echo_n "checking for socklen_t equivalent... " >&6; }
       if test "${gl_cv_socklen_t_equiv+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   # Systems have either "struct sockaddr *" or
         # "void *" as the second argument to getpeername
@@ -14882,20 +16269,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   gl_cv_socklen_t_equiv="$t"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
@@ -14910,12 +16298,12 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 
       if test "$gl_cv_socklen_t_equiv" = ""; then
-       { { echo "$as_me:$LINENO: error: Cannot find a type to use in place of socklen_t" >&5
-echo "$as_me: error: Cannot find a type to use in place of socklen_t" >&2;}
+       { { $as_echo "$as_me:$LINENO: error: Cannot find a type to use in place of socklen_t" >&5
+$as_echo "$as_me: error: Cannot find a type to use in place of socklen_t" >&2;}
    { (exit 1); exit 1; }; }
       fi
-      { echo "$as_me:$LINENO: result: $gl_cv_socklen_t_equiv" >&5
-echo "${ECHO_T}$gl_cv_socklen_t_equiv" >&6; }
+      { $as_echo "$as_me:$LINENO: result: $gl_cv_socklen_t_equiv" >&5
+$as_echo "$gl_cv_socklen_t_equiv" >&6; }
 
 cat >>confdefs.h <<_ACEOF
 #define socklen_t $gl_cv_socklen_t_equiv
@@ -14924,10 +16312,10 @@ _ACEOF
 fi
 
 
-  { echo "$as_me:$LINENO: checking for ssize_t" >&5
-echo $ECHO_N "checking for ssize_t... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for ssize_t" >&5
+$as_echo_n "checking for ssize_t... " >&6; }
 if test "${gt_cv_ssize_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -14951,20 +16339,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   gt_cv_ssize_t=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        gt_cv_ssize_t=no
@@ -14972,8 +16361,8 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $gt_cv_ssize_t" >&5
-echo "${ECHO_T}$gt_cv_ssize_t" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gt_cv_ssize_t" >&5
+$as_echo "$gt_cv_ssize_t" >&6; }
   if test $gt_cv_ssize_t = no; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -15046,10 +16435,10 @@ _ACEOF
      if test $gl_cv_have_include_next = yes; then
        gl_cv_next_stdint_h='<'stdint.h'>'
      else
-       { echo "$as_me:$LINENO: checking absolute name of <stdint.h>" >&5
-echo $ECHO_N "checking absolute name of <stdint.h>... $ECHO_C" >&6; }
+       { $as_echo "$as_me:$LINENO: checking absolute name of <stdint.h>" >&5
+$as_echo_n "checking absolute name of <stdint.h>... " >&6; }
 if test "${gl_cv_next_stdint_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
          if test $ac_cv_header_stdint_h = yes; then
@@ -15074,8 +16463,8 @@ _ACEOF
          fi
 
 fi
-{ echo "$as_me:$LINENO: result: $gl_cv_next_stdint_h" >&5
-echo "${ECHO_T}$gl_cv_next_stdint_h" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gl_cv_next_stdint_h" >&5
+$as_echo "$gl_cv_next_stdint_h" >&6; }
      fi
      NEXT_STDINT_H=$gl_cv_next_stdint_h
 
@@ -15089,10 +16478,10 @@ echo "${ECHO_T}$gl_cv_next_stdint_h" >&6; }
 
 
     if test $ac_cv_header_stdint_h = yes; then
-    { echo "$as_me:$LINENO: checking whether stdint.h conforms to C99" >&5
-echo $ECHO_N "checking whether stdint.h conforms to C99... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking whether stdint.h conforms to C99" >&5
+$as_echo_n "checking whether stdint.h conforms to C99... " >&6; }
 if test "${gl_cv_header_working_stdint_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   gl_cv_header_working_stdint_h=no
        cat >conftest.$ac_ext <<_ACEOF
@@ -15268,20 +16657,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   gl_cv_header_working_stdint_h=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
@@ -15289,8 +16679,8 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $gl_cv_header_working_stdint_h" >&5
-echo "${ECHO_T}$gl_cv_header_working_stdint_h" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gl_cv_header_working_stdint_h" >&5
+$as_echo "$gl_cv_header_working_stdint_h" >&6; }
   fi
   if test "$gl_cv_header_working_stdint_h" = yes; then
     STDINT_H=
@@ -15299,20 +16689,21 @@ echo "${ECHO_T}$gl_cv_header_working_stdint_h" >&6; }
 
 for ac_header in sys/inttypes.h sys/bitypes.h
 do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+as_ac_Header=`$as_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; }
+  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -15328,32 +16719,33 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -15367,69 +16759,73 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
         test ! -s conftest.err
        }; then
   ac_header_preproc=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&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; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
 
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
+as_val=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -15466,10 +16862,10 @@ done
 
 
   for gltype in ptrdiff_t sig_atomic_t size_t wchar_t wint_t ; do
-    { echo "$as_me:$LINENO: checking for bit size of $gltype" >&5
-echo $ECHO_N "checking for bit size of $gltype... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for bit size of $gltype" >&5
+$as_echo_n "checking for bit size of $gltype... " >&6; }
 if { as_var=gl_cv_bitsizeof_${gltype}; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test "$cross_compiling" = yes; then
   # Depending upon the size, compute the lo and hi bounds.
@@ -15507,13 +16903,14 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
@@ -15554,20 +16951,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_hi=$ac_mid; break
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_lo=`expr $ac_mid + 1`
@@ -15581,7 +16979,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   done
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        cat >conftest.$ac_ext <<_ACEOF
@@ -15618,13 +17016,14 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
@@ -15665,20 +17064,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_lo=$ac_mid; break
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_hi=`expr '(' $ac_mid ')' - 1`
@@ -15692,7 +17092,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   done
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_lo= ac_hi=
@@ -15739,20 +17139,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_hi=$ac_mid
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_lo=`expr '(' $ac_mid ')' + 1`
@@ -15799,15 +17200,17 @@ main ()
       long int i = longval ();
       if (i != (sizeof ($gltype) * CHAR_BIT))
        return 1;
-      fprintf (f, "%ld\n", i);
+      fprintf (f, "%ld", i);
     }
   else
     {
       unsigned long int i = ulongval ();
       if (i != (sizeof ($gltype) * CHAR_BIT))
        return 1;
-      fprintf (f, "%lu\n", i);
+      fprintf (f, "%lu", i);
     }
+  /* Do not output a trailing newline, as this causes \r\n confusion
+     on some platforms.  */
   return ferror (f) || fclose (f) != 0;
 
   ;
@@ -15820,38 +17223,42 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   result=`cat conftest.val`
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
 result=unknown
 fi
+rm -rf conftest.dSYM
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 rm -f conftest.val
        eval gl_cv_bitsizeof_${gltype}=\$result
 
 fi
-ac_res=`eval echo '${'gl_cv_bitsizeof_${gltype}'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+ac_res=`eval 'as_val=${'gl_cv_bitsizeof_${gltype}'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
     eval result=\$gl_cv_bitsizeof_${gltype}
     if test $result = unknown; then
                                                 result=0
@@ -15871,10 +17278,10 @@ _ACEOF
 
 
   for gltype in sig_atomic_t wchar_t wint_t ; do
-    { echo "$as_me:$LINENO: checking whether $gltype is signed" >&5
-echo $ECHO_N "checking whether $gltype is signed... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking whether $gltype is signed" >&5
+$as_echo_n "checking whether $gltype is signed... " >&6; }
 if { as_var=gl_cv_type_${gltype}_signed; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -15908,20 +17315,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   result=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        result=no
@@ -15931,9 +17339,10 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
        eval gl_cv_type_${gltype}_signed=\$result
 
 fi
-ac_res=`eval echo '${'gl_cv_type_${gltype}_signed'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+ac_res=`eval 'as_val=${'gl_cv_type_${gltype}_signed'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
     eval result=\$gl_cv_type_${gltype}_signed
     GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
     if test "$result" = yes; then
@@ -15958,10 +17367,10 @@ _ACEOF
 
 
   for gltype in ptrdiff_t sig_atomic_t size_t wchar_t wint_t ; do
-    { echo "$as_me:$LINENO: checking for $gltype integer literal suffix" >&5
-echo $ECHO_N "checking for $gltype integer literal suffix... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for $gltype integer literal suffix" >&5
+$as_echo_n "checking for $gltype integer literal suffix... " >&6; }
 if { as_var=gl_cv_type_${gltype}_suffix; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   eval gl_cv_type_${gltype}_suffix=no
        eval result=\$gl_cv_type_${gltype}_signed
@@ -16014,20 +17423,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   eval gl_cv_type_${gltype}_suffix=\$glsuf
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
@@ -16038,9 +17448,10 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
          test "$result" != no && break
        done
 fi
-ac_res=`eval echo '${'gl_cv_type_${gltype}_suffix'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+ac_res=`eval 'as_val=${'gl_cv_type_${gltype}_suffix'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
     GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
     eval result=\$gl_cv_type_${gltype}_suffix
     test "$result" = no && result=
@@ -16073,10 +17484,10 @@ _ACEOF
      if test $gl_cv_have_include_next = yes; then
        gl_cv_next_stdio_h='<'stdio.h'>'
      else
-       { echo "$as_me:$LINENO: checking absolute name of <stdio.h>" >&5
-echo $ECHO_N "checking absolute name of <stdio.h>... $ECHO_C" >&6; }
+       { $as_echo "$as_me:$LINENO: checking absolute name of <stdio.h>" >&5
+$as_echo_n "checking absolute name of <stdio.h>... " >&6; }
 if test "${gl_cv_next_stdio_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
          if test $ac_cv_header_stdio_h = yes; then
@@ -16101,8 +17512,8 @@ _ACEOF
          fi
 
 fi
-{ echo "$as_me:$LINENO: result: $gl_cv_next_stdio_h" >&5
-echo "${ECHO_T}$gl_cv_next_stdio_h" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gl_cv_next_stdio_h" >&5
+$as_echo "$gl_cv_next_stdio_h" >&6; }
      fi
      NEXT_STDIO_H=$gl_cv_next_stdio_h
 
@@ -16125,10 +17536,10 @@ echo "${ECHO_T}$gl_cv_next_stdio_h" >&6; }
      if test $gl_cv_have_include_next = yes; then
        gl_cv_next_stdlib_h='<'stdlib.h'>'
      else
-       { echo "$as_me:$LINENO: checking absolute name of <stdlib.h>" >&5
-echo $ECHO_N "checking absolute name of <stdlib.h>... $ECHO_C" >&6; }
+       { $as_echo "$as_me:$LINENO: checking absolute name of <stdlib.h>" >&5
+$as_echo_n "checking absolute name of <stdlib.h>... " >&6; }
 if test "${gl_cv_next_stdlib_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
          if test $ac_cv_header_stdlib_h = yes; then
@@ -16153,8 +17564,8 @@ _ACEOF
          fi
 
 fi
-{ echo "$as_me:$LINENO: result: $gl_cv_next_stdlib_h" >&5
-echo "${ECHO_T}$gl_cv_next_stdlib_h" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gl_cv_next_stdlib_h" >&5
+$as_echo "$gl_cv_next_stdlib_h" >&6; }
      fi
      NEXT_STDLIB_H=$gl_cv_next_stdlib_h
 
@@ -16164,13 +17575,20 @@ echo "${ECHO_T}$gl_cv_next_stdlib_h" >&6; }
 
 
 
+
+
+
+
+
+
+
 for ac_func in strdup
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -16223,43 +17641,53 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
 else
-  gl_LIBOBJS="$gl_LIBOBJS $ac_func.$ac_objext"
+
+    gl_LIBOBJS="$gl_LIBOBJS $ac_func.$ac_objext"
+
 fi
 done
 
 
+
   :
 
 
@@ -16279,10 +17707,10 @@ done
 
 
 
-  { echo "$as_me:$LINENO: checking whether <sys/socket.h> is self-contained" >&5
-echo $ECHO_N "checking whether <sys/socket.h> is self-contained... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking whether <sys/socket.h> is self-contained" >&5
+$as_echo_n "checking whether <sys/socket.h> is self-contained... " >&6; }
 if test "${gl_cv_header_sys_socket_h_selfcontained+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
       cat >conftest.$ac_ext <<_ACEOF
@@ -16306,20 +17734,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   gl_cv_header_sys_socket_h_selfcontained=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        gl_cv_header_sys_socket_h_selfcontained=no
@@ -16328,8 +17757,8 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 fi
-{ echo "$as_me:$LINENO: result: $gl_cv_header_sys_socket_h_selfcontained" >&5
-echo "${ECHO_T}$gl_cv_header_sys_socket_h_selfcontained" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gl_cv_header_sys_socket_h_selfcontained" >&5
+$as_echo "$gl_cv_header_sys_socket_h_selfcontained" >&6; }
   if test $gl_cv_header_sys_socket_h_selfcontained = yes; then
     SYS_SOCKET_H=''
   else
@@ -16349,10 +17778,10 @@ echo "${ECHO_T}$gl_cv_header_sys_socket_h_selfcontained" >&6; }
      if test $gl_cv_have_include_next = yes; then
        gl_cv_next_sys_socket_h='<'sys/socket.h'>'
      else
-       { echo "$as_me:$LINENO: checking absolute name of <sys/socket.h>" >&5
-echo $ECHO_N "checking absolute name of <sys/socket.h>... $ECHO_C" >&6; }
+       { $as_echo "$as_me:$LINENO: checking absolute name of <sys/socket.h>" >&5
+$as_echo_n "checking absolute name of <sys/socket.h>... " >&6; }
 if test "${gl_cv_next_sys_socket_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
          if test $ac_cv_header_sys_socket_h = yes; then
@@ -16377,8 +17806,8 @@ _ACEOF
          fi
 
 fi
-{ echo "$as_me:$LINENO: result: $gl_cv_next_sys_socket_h" >&5
-echo "${ECHO_T}$gl_cv_next_sys_socket_h" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gl_cv_next_sys_socket_h" >&5
+$as_echo "$gl_cv_next_sys_socket_h" >&6; }
      fi
      NEXT_SYS_SOCKET_H=$gl_cv_next_sys_socket_h
 
@@ -16394,20 +17823,21 @@ echo "${ECHO_T}$gl_cv_next_sys_socket_h" >&6; }
 
 for ac_header in winsock2.h ws2tcpip.h
 do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+as_ac_Header=`$as_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; }
+  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -16423,32 +17853,33 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -16462,69 +17893,73 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
         test ! -s conftest.err
        }; then
   ac_header_preproc=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&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; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
 
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
+as_val=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -16548,11 +17983,11 @@ done
   fi
 
 
-  { echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5
-echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5
+$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
 if test -z "$MKDIR_P"; then
   if test "${ac_cv_path_mkdir+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
@@ -16587,8 +18022,8 @@ fi
     MKDIR_P="$ac_install_sh -d"
   fi
 fi
-{ echo "$as_me:$LINENO: result: $MKDIR_P" >&5
-echo "${ECHO_T}$MKDIR_P" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
 
 
 
@@ -16605,10 +18040,10 @@ echo "${ECHO_T}$MKDIR_P" >&6; }
   fi
 
 
-      { echo "$as_me:$LINENO: checking whether mkdir is declared" >&5
-echo $ECHO_N "checking whether mkdir is declared... $ECHO_C" >&6; }
+      { $as_echo "$as_me:$LINENO: checking whether mkdir is declared" >&5
+$as_echo_n "checking whether mkdir is declared... " >&6; }
 if test "${ac_cv_have_decl_mkdir+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -16635,20 +18070,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_have_decl_mkdir=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_have_decl_mkdir=no
@@ -16656,9 +18092,9 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_mkdir" >&5
-echo "${ECHO_T}$ac_cv_have_decl_mkdir" >&6; }
-if test $ac_cv_have_decl_mkdir = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_mkdir" >&5
+$as_echo "$ac_cv_have_decl_mkdir" >&6; }
+if test "x$ac_cv_have_decl_mkdir" = x""yes; then
 
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_MKDIR 1
@@ -16673,20 +18109,21 @@ _ACEOF
 
 for ac_header in io.h
 do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+as_ac_Header=`$as_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; }
+  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -16702,32 +18139,33 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -16741,69 +18179,73 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
         test ! -s conftest.err
        }; then
   ac_header_preproc=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&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; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
 
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
+as_val=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
      if test $gl_cv_have_include_next = yes; then
        gl_cv_next_sys_stat_h='<'sys/stat.h'>'
      else
-       { echo "$as_me:$LINENO: checking absolute name of <sys/stat.h>" >&5
-echo $ECHO_N "checking absolute name of <sys/stat.h>... $ECHO_C" >&6; }
+       { $as_echo "$as_me:$LINENO: checking absolute name of <sys/stat.h>" >&5
+$as_echo_n "checking absolute name of <sys/stat.h>... " >&6; }
 if test "${gl_cv_next_sys_stat_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
          if test $ac_cv_header_sys_stat_h = yes; then
@@ -16871,8 +18313,8 @@ _ACEOF
          fi
 
 fi
-{ echo "$as_me:$LINENO: result: $gl_cv_next_sys_stat_h" >&5
-echo "${ECHO_T}$gl_cv_next_sys_stat_h" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gl_cv_next_sys_stat_h" >&5
+$as_echo "$gl_cv_next_sys_stat_h" >&6; }
      fi
      NEXT_SYS_STAT_H=$gl_cv_next_sys_stat_h
 
@@ -16881,11 +18323,11 @@ echo "${ECHO_T}$gl_cv_next_sys_stat_h" >&6; }
   SYS_STAT_H='sys/stat.h'
 
 
-  { echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5
-echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5
+$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
 if test -z "$MKDIR_P"; then
   if test "${ac_cv_path_mkdir+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
     MKDIR_P="$ac_install_sh -d"
   fi
 fi
-{ echo "$as_me:$LINENO: result: $MKDIR_P" >&5
-echo "${ECHO_T}$MKDIR_P" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
 
 
 
 
-  { echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5
-echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5
+$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
 if test -z "$MKDIR_P"; then
   if test "${ac_cv_path_mkdir+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
     MKDIR_P="$ac_install_sh -d"
   fi
 fi
-{ echo "$as_me:$LINENO: result: $MKDIR_P" >&5
-echo "${ECHO_T}$MKDIR_P" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
+
+
+
+
+
+
+
 
 
 
 
   gl_LIBOBJS="$gl_LIBOBJS tempname.$ac_objext"
 
+
   :
 
 
@@ -16993,10 +18443,10 @@ echo "${ECHO_T}$MKDIR_P" >&6; }
      if test $gl_cv_have_include_next = yes; then
        gl_cv_next_unistd_h='<'unistd.h'>'
      else
-       { echo "$as_me:$LINENO: checking absolute name of <unistd.h>" >&5
-echo $ECHO_N "checking absolute name of <unistd.h>... $ECHO_C" >&6; }
+       { $as_echo "$as_me:$LINENO: checking absolute name of <unistd.h>" >&5
+$as_echo_n "checking absolute name of <unistd.h>... " >&6; }
 if test "${gl_cv_next_unistd_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
          if test $ac_cv_header_unistd_h = yes; then
@@ -17021,8 +18471,8 @@ _ACEOF
          fi
 
 fi
-{ echo "$as_me:$LINENO: result: $gl_cv_next_unistd_h" >&5
-echo "${ECHO_T}$gl_cv_next_unistd_h" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gl_cv_next_unistd_h" >&5
+$as_echo "$gl_cv_next_unistd_h" >&6; }
      fi
      NEXT_UNISTD_H=$gl_cv_next_unistd_h
 
@@ -17061,10 +18511,42 @@ echo "${ECHO_T}$gl_cv_next_unistd_h" >&6; }
 
 
 
+
+
+
+
+
+
+
   gl_LIBOBJS="$gl_LIBOBJS vasnprintf.$ac_objext"
+
+
+
+
+
+
+
+
   gl_LIBOBJS="$gl_LIBOBJS printf-args.$ac_objext"
+
+
+
+
+
+
+
+
   gl_LIBOBJS="$gl_LIBOBJS printf-parse.$ac_objext"
+
+
+
+
+
+
+
+
   gl_LIBOBJS="$gl_LIBOBJS asnprintf.$ac_objext"
+
   if test $ac_cv_func_vasnprintf = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -17082,26 +18564,58 @@ _ACEOF
 
 
 
-  { echo "$as_me:$LINENO: checking for ptrdiff_t" >&5
-echo $ECHO_N "checking for ptrdiff_t... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for ptrdiff_t" >&5
+$as_echo_n "checking for ptrdiff_t... " >&6; }
 if test "${ac_cv_type_ptrdiff_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
+  ac_cv_type_ptrdiff_t=no
+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 ptrdiff_t ac__type_new_;
 int
 main ()
 {
-if ((ac__type_new_ *) 0)
-  return 0;
-if (sizeof (ac__type_new_))
+if (sizeof (ptrdiff_t))
+       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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  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
+int
+main ()
+{
+if (sizeof ((ptrdiff_t)))
+         return 0;
   ;
   return 0;
 }
@@ -17112,33 +18626,44 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
-  ac_cv_type_ptrdiff_t=yes
+  :
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_cv_type_ptrdiff_t=no
+       ac_cv_type_ptrdiff_t=yes
 fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_ptrdiff_t" >&5
-echo "${ECHO_T}$ac_cv_type_ptrdiff_t" >&6; }
-if test $ac_cv_type_ptrdiff_t = yes; then
 
-cat >>confdefs.h <<_ACEOF
-#define HAVE_PTRDIFF_T 1
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_ptrdiff_t" >&5
+$as_echo "$ac_cv_type_ptrdiff_t" >&6; }
+if test "x$ac_cv_type_ptrdiff_t" = x""yes; then
+  :
+else
+
+cat >>confdefs.h <<\_ACEOF
+#define ptrdiff_t long
 _ACEOF
 
 
 
 for ac_func in snprintf wcslen
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -17212,44 +18737,51 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
 fi
 done
 
-      { echo "$as_me:$LINENO: checking whether _snprintf is declared" >&5
-echo $ECHO_N "checking whether _snprintf is declared... $ECHO_C" >&6; }
+      { $as_echo "$as_me:$LINENO: checking whether _snprintf is declared" >&5
+$as_echo_n "checking whether _snprintf is declared... " >&6; }
 if test "${ac_cv_have_decl__snprintf+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -17276,20 +18808,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_have_decl__snprintf=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_have_decl__snprintf=no
@@ -17297,9 +18830,9 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_have_decl__snprintf" >&5
-echo "${ECHO_T}$ac_cv_have_decl__snprintf" >&6; }
-if test $ac_cv_have_decl__snprintf = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl__snprintf" >&5
+$as_echo "$ac_cv_have_decl__snprintf" >&6; }
+if test "x$ac_cv_have_decl__snprintf" = x""yes; then
 
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL__SNPRINTF 1
   CFLAG_VISIBILITY=
   HAVE_VISIBILITY=0
   if test -n "$GCC"; then
-    { echo "$as_me:$LINENO: checking for simple visibility declarations" >&5
-echo $ECHO_N "checking for simple visibility declarations... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for simple visibility declarations" >&5
+$as_echo_n "checking for simple visibility declarations... " >&6; }
     if test "${gl_cv_cc_visibility+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
       gl_save_CFLAGS="$CFLAGS"
@@ -17358,20 +18891,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   gl_cv_cc_visibility=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        gl_cv_cc_visibility=no
@@ -17381,8 +18915,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
       CFLAGS="$gl_save_CFLAGS"
 fi
 
-    { echo "$as_me:$LINENO: result: $gl_cv_cc_visibility" >&5
-echo "${ECHO_T}$gl_cv_cc_visibility" >&6; }
+    { $as_echo "$as_me:$LINENO: result: $gl_cv_cc_visibility" >&5
+$as_echo "$gl_cv_cc_visibility" >&6; }
     if test $gl_cv_cc_visibility = yes; then
       CFLAG_VISIBILITY="-fvisibility=hidden"
       HAVE_VISIBILITY=1
@@ -17398,10 +18932,10 @@ _ACEOF
 
 
 
-  { echo "$as_me:$LINENO: checking whether <wchar.h> is standalone" >&5
-echo $ECHO_N "checking whether <wchar.h> is standalone... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking whether <wchar.h> is standalone" >&5
+$as_echo_n "checking whether <wchar.h> is standalone... " >&6; }
 if test "${gl_cv_header_wchar_h_standalone+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 #include <wchar.h>
@@ -17413,20 +18947,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   gl_cv_header_wchar_h_standalone=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        gl_cv_header_wchar_h_standalone=no
@@ -17434,8 +18969,8 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $gl_cv_header_wchar_h_standalone" >&5
-echo "${ECHO_T}$gl_cv_header_wchar_h_standalone" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gl_cv_header_wchar_h_standalone" >&5
+$as_echo "$gl_cv_header_wchar_h_standalone" >&6; }
   if test $gl_cv_header_wchar_h_standalone != yes; then
     WCHAR_H=wchar.h
   fi
@@ -17467,10 +19002,10 @@ echo "${ECHO_T}$gl_cv_header_wchar_h_standalone" >&6; }
      if test $gl_cv_have_include_next = yes; then
        gl_cv_next_wchar_h='<'wchar.h'>'
      else
-       { echo "$as_me:$LINENO: checking absolute name of <wchar.h>" >&5
-echo $ECHO_N "checking absolute name of <wchar.h>... $ECHO_C" >&6; }
+       { $as_echo "$as_me:$LINENO: checking absolute name of <wchar.h>" >&5
+$as_echo_n "checking absolute name of <wchar.h>... " >&6; }
 if test "${gl_cv_next_wchar_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
          if test $ac_cv_header_wchar_h = yes; then
@@ -17495,8 +19030,8 @@ _ACEOF
          fi
 
 fi
-{ echo "$as_me:$LINENO: result: $gl_cv_next_wchar_h" >&5
-echo "${ECHO_T}$gl_cv_next_wchar_h" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gl_cv_next_wchar_h" >&5
+$as_echo "$gl_cv_next_wchar_h" >&6; }
      fi
      NEXT_WCHAR_H=$gl_cv_next_wchar_h
 
@@ -17509,20 +19044,21 @@ echo "${ECHO_T}$gl_cv_next_wchar_h" >&6; }
 
 for ac_header in stdint.h
 do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+as_ac_Header=`$as_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; }
+  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -17538,32 +19074,33 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -17577,69 +19114,73 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
         test ! -s conftest.err
        }; then
   ac_header_preproc=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&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; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
 
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
+as_val=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -17651,6 +19192,16 @@ done
 
 
 
+  gltests_libdeps=
+  gltests_ltlibdeps=
+
+
+
+  gl_source_base='tests'
+
+
+
+
 
 
 
@@ -17663,8 +19214,8 @@ if test "${with_cflags+set}" = set; then
   withval=$with_cflags;
            case "$withval" in
            "" | y | ye | yes | n | no)
-               { { echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-cflags option." >&5
-echo "$as_me: error: *** You must supply an argument to the --with-cflags option." >&2;}
+               { { $as_echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-cflags option." >&5
+$as_echo "$as_me: error: *** You must supply an argument to the --with-cflags option." >&2;}
    { (exit 1); exit 1; }; }
                ;;
            esac
@@ -17680,8 +19231,8 @@ if test "${with_includes+set}" = set; then
   withval=$with_includes;
            case "$withval" in
            "" | y | ye | yes | n | no)
-               { { echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-includes option." >&5
-echo "$as_me: error: *** You must supply an argument to the --with-includes option." >&2;}
+               { { $as_echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-includes option." >&5
+$as_echo "$as_me: error: *** You must supply an argument to the --with-includes option." >&2;}
    { (exit 1); exit 1; }; }
              ;;
            esac
@@ -17691,8 +19242,8 @@ echo "$as_me: error: *** You must supply an argument to the --with-includes opti
                    CPPFLAGS="$CPPFLAGS -I$dir"
                else
 
-    { echo "$as_me:$LINENO: WARNING: Include directory $dir does not exist." >&5
-echo "$as_me: WARNING: Include directory $dir does not exist." >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: Include directory $dir does not exist." >&5
+$as_echo "$as_me: WARNING: Include directory $dir does not exist." >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
@@ -17712,8 +19263,8 @@ if test "${with_libraries+set}" = set; then
   withval=$with_libraries;
            case "$withval" in
            "" | y | ye | yes | n | no)
-               { { echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-libraries option." >&5
-echo "$as_me: error: *** You must supply an argument to the --with-libraries option." >&2;}
+               { { $as_echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-libraries option." >&5
+$as_echo "$as_me: error: *** You must supply an argument to the --with-libraries option." >&2;}
    { (exit 1); exit 1; }; }
              ;;
            esac
@@ -17728,8 +19279,8 @@ echo "$as_me: error: *** You must supply an argument to the --with-libraries opt
                    LDFLAGS="$LDFLAGS -L$dir"
                else
 
-    { echo "$as_me:$LINENO: WARNING: Library directory $dir does not exist." >&5
-echo "$as_me: WARNING: Library directory $dir does not exist." >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: Library directory $dir does not exist." >&5
+$as_echo "$as_me: WARNING: Library directory $dir does not exist." >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
@@ -17743,27 +19294,69 @@ AAW_EOF
 fi
 
 
+    # Disable strict-aliasing optimizations
+
+    # test for -W'feature', then add the 'no-' version.
+
+
+
+    { $as_echo "$as_me:$LINENO: checking for gcc flag -fstrict-aliasing" >&5
+$as_echo_n "checking for gcc flag -fstrict-aliasing... " >&6; }
+    if test "x$GCC" = "xyes"; then
+               (gcc --help={target,optimizers,warnings,undocumented,params,c} 2>&1 ||
+           $CC -v --help 2>&1) |
+         $EGREP -- '[^[:alnum:]]-fstrict-aliasing[^[:alnum:]-]' 2>&1 > /dev/null
+               if test $? -eq 0; then
+           found_warning=yes
+           { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+       else
+           found_warning=no
+           { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+       fi
+    else
+       found_warning=no
+       { $as_echo "$as_me:$LINENO: result: no (not using gcc)" >&5
+$as_echo "no (not using gcc)" >&6; }
+    fi
+
+    if test x"$found_warning" = x"yes"; then
+       CFLAGS="$CFLAGS -fno-strict-aliasing"
+
+       CPPFLAGS="$CPPFLAGS -fno-strict-aliasing"
+
+
+    else
+       :
+    fi
+
+
+
     # Warn for just about everything
 
 
 
-    { echo "$as_me:$LINENO: checking for gcc flag -Wall" >&5
-echo $ECHO_N "checking for gcc flag -Wall... $ECHO_C" >&6; }
+
+    { $as_echo "$as_me:$LINENO: checking for gcc flag -Wall" >&5
+$as_echo_n "checking for gcc flag -Wall... " >&6; }
     if test "x$GCC" = "xyes"; then
-               $CC -v --help 2>&1 | $EGREP -- '[^[:alnum:]]-Wall[^[:alnum:]-]' 2>&1 > /dev/null
+               (gcc --help={target,optimizers,warnings,undocumented,params,c} 2>&1 ||
+           $CC -v --help 2>&1) |
+         $EGREP -- '[^[:alnum:]]-Wall[^[:alnum:]-]' 2>&1 > /dev/null
                if test $? -eq 0; then
            found_warning=yes
-           { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+           { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
        else
            found_warning=no
-           { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+           { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
        fi
     else
        found_warning=no
-       { echo "$as_me:$LINENO: result: no (not using gcc)" >&5
-echo "${ECHO_T}no (not using gcc)" >&6; }
+       { $as_echo "$as_me:$LINENO: result: no (not using gcc)" >&5
+$as_echo "no (not using gcc)" >&6; }
     fi
 
     if test x"$found_warning" = x"yes"; then
@@ -17775,27 +19368,30 @@ echo "${ECHO_T}no (not using gcc)" >&6; }
     fi
 
 
+
     # And add any extra warnings too
 
 
 
-    { echo "$as_me:$LINENO: checking for gcc flag -Wextra" >&5
-echo $ECHO_N "checking for gcc flag -Wextra... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for gcc flag -Wextra" >&5
+$as_echo_n "checking for gcc flag -Wextra... " >&6; }
     if test "x$GCC" = "xyes"; then
-               $CC -v --help 2>&1 | $EGREP -- '[^[:alnum:]]-Wextra[^[:alnum:]-]' 2>&1 > /dev/null
+               (gcc --help={target,optimizers,warnings,undocumented,params,c} 2>&1 ||
+           $CC -v --help 2>&1) |
+         $EGREP -- '[^[:alnum:]]-Wextra[^[:alnum:]-]' 2>&1 > /dev/null
                if test $? -eq 0; then
            found_warning=yes
-           { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+           { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
        else
            found_warning=no
-           { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+           { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
        fi
     else
        found_warning=no
-       { echo "$as_me:$LINENO: result: no (not using gcc)" >&5
-echo "${ECHO_T}no (not using gcc)" >&6; }
+       { $as_echo "$as_me:$LINENO: result: no (not using gcc)" >&5
+$as_echo "no (not using gcc)" >&6; }
     fi
 
     if test x"$found_warning" = x"yes"; then
@@ -17806,23 +19402,25 @@ echo "${ECHO_T}no (not using gcc)" >&6; }
 
 
 
-    { echo "$as_me:$LINENO: checking for gcc flag -W" >&5
-echo $ECHO_N "checking for gcc flag -W... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for gcc flag -W" >&5
+$as_echo_n "checking for gcc flag -W... " >&6; }
     if test "x$GCC" = "xyes"; then
-               $CC -v --help 2>&1 | $EGREP -- '^[:alnum:]-W^[:alnum:]-' 2>&1 > /dev/null
+               (gcc --help={target,optimizers,warnings,undocumented,params,c} 2>&1 ||
+           $CC -v --help 2>&1) |
+         $EGREP -- '^[:alnum:]-W^[:alnum:]-' 2>&1 > /dev/null
                if test $? -eq 0; then
            found_warning=yes
-           { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+           { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
        else
            found_warning=no
-           { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+           { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
        fi
     else
        found_warning=no
-       { echo "$as_me:$LINENO: result: no (not using gcc)" >&5
-echo "${ECHO_T}no (not using gcc)" >&6; }
+       { $as_echo "$as_me:$LINENO: result: no (not using gcc)" >&5
+$as_echo "no (not using gcc)" >&6; }
     fi
 
     if test x"$found_warning" = x"yes"; then
@@ -17853,8 +19451,8 @@ if test "${with_user+set}" = set; then
   withval=$with_user;
             case "$withval" in
                 "" | y | ye | yes | n | no)
-                    { { echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-user option." >&5
-echo "$as_me: error: *** You must supply an argument to the --with-user option." >&2;}
+                    { { $as_echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-user option." >&5
+$as_echo "$as_me: error: *** You must supply an argument to the --with-user option." >&2;}
    { (exit 1); exit 1; }; }
                   ;;
                 *)
@@ -17865,8 +19463,8 @@ echo "$as_me: error: *** You must supply an argument to the --with-user option."
 else
 
 
-    { echo "$as_me:$LINENO: WARNING: no user specified (--with-user) -- using 'amanda'" >&5
-echo "$as_me: WARNING: no user specified (--with-user) -- using 'amanda'" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: no user specified (--with-user) -- using 'amanda'" >&5
+$as_echo "$as_me: WARNING: no user specified (--with-user) -- using 'amanda'" >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
@@ -17894,8 +19492,8 @@ if test "${with_group+set}" = set; then
   withval=$with_group;
             case "$withval" in
                 "" | y | ye | yes | n | no)
-                    { { echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-group option." >&5
-echo "$as_me: error: *** You must supply an argument to the --with-group option." >&2;}
+                    { { $as_echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-group option." >&5
+$as_echo "$as_me: error: *** You must supply an argument to the --with-group option." >&2;}
    { (exit 1); exit 1; }; }
                   ;;
                 *) SETUID_GROUP="$withval"
@@ -17905,8 +19503,8 @@ echo "$as_me: error: *** You must supply an argument to the --with-group option.
 else
 
 
-    { echo "$as_me:$LINENO: WARNING: no group specified (--with-group) -- using 'backup'" >&5
-echo "$as_me: WARNING: no group specified (--with-group) -- using 'backup'" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: no group specified (--with-group) -- using 'backup'" >&5
+$as_echo "$as_me: WARNING: no group specified (--with-group) -- using 'backup'" >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
@@ -17927,8 +19525,8 @@ fi
 if test "${with_dumperdir+set}" = set; then
   withval=$with_dumperdir;
 
-    { echo "$as_me:$LINENO: WARNING: --with-dumperdir is no longer used." >&5
-echo "$as_me: WARNING: --with-dumperdir is no longer used." >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: --with-dumperdir is no longer used." >&5
+$as_echo "$as_me: WARNING: --with-dumperdir is no longer used." >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
@@ -17948,8 +19546,8 @@ if test "${with_configdir+set}" = set; then
   withval=$with_configdir;
            case "$withval" in
            "" | y | ye | yes | n | no)
-               { { echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-configdir option." >&5
-echo "$as_me: error: *** You must supply an argument to the --with-configdir option." >&2;}
+               { { $as_echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-configdir option." >&5
+$as_echo "$as_me: error: *** You must supply an argument to the --with-configdir option." >&2;}
    { (exit 1); exit 1; }; }
              ;;
            *) CONFIG_DIR="$withval"
@@ -17985,8 +19583,8 @@ _ACEOF
 
 # Check whether --with-indexdir was given.
 if test "${with_indexdir+set}" = set; then
-  withval=$with_indexdir;    { { echo "$as_me:$LINENO: error: *** --with-indexdir is deprecated; use indexdir in amanda.conf instead." >&5
-echo "$as_me: error: *** --with-indexdir is deprecated; use indexdir in amanda.conf instead." >&2;}
+  withval=$with_indexdir;    { { $as_echo "$as_me:$LINENO: error: *** --with-indexdir is deprecated; use indexdir in amanda.conf instead." >&5
+$as_echo "$as_me: error: *** --with-indexdir is deprecated; use indexdir in amanda.conf instead." >&2;}
    { (exit 1); exit 1; }; }
 
 fi
@@ -17996,8 +19594,8 @@ fi
 
 # Check whether --with-dbdir was given.
 if test "${with_dbdir+set}" = set; then
-  withval=$with_dbdir;    { { echo "$as_me:$LINENO: error: *** --with-dbdir is deprecated; use infofile in amanda.conf instead." >&5
-echo "$as_me: error: *** --with-dbdir is deprecated; use infofile in amanda.conf instead." >&2;}
+  withval=$with_dbdir;    { { $as_echo "$as_me:$LINENO: error: *** --with-dbdir is deprecated; use infofile in amanda.conf instead." >&5
+$as_echo "$as_me: error: *** --with-dbdir is deprecated; use infofile in amanda.conf instead." >&2;}
    { (exit 1); exit 1; }; }
 
 fi
@@ -18007,8 +19605,8 @@ fi
 
 # Check whether --with-logdir was given.
 if test "${with_logdir+set}" = set; then
-  withval=$with_logdir;    { { echo "$as_me:$LINENO: error: *** --with-logdir is deprecated; use logfile in amanda.conf instead." >&5
-echo "$as_me: error: *** --with-logdir is deprecated; use logfile in amanda.conf instead." >&2;}
+  withval=$with_logdir;    { { $as_echo "$as_me:$LINENO: error: *** --with-logdir is deprecated; use logfile in amanda.conf instead." >&5
+$as_echo "$as_me: error: *** --with-logdir is deprecated; use logfile in amanda.conf instead." >&2;}
    { (exit 1); exit 1; }; }
 
 fi
@@ -18062,8 +19660,8 @@ EOF_SED
       ;;
     n | no) USE_VERSION_SUFFIXES=no
       ;;
-    *) { { echo "$as_me:$LINENO: error: *** You must not supply an argument to --with-suffixes option." >&5
-echo "$as_me: error: *** You must not supply an argument to --with-suffixes option." >&2;}
+    *) { { $as_echo "$as_me:$LINENO: error: *** You must not supply an argument to --with-suffixes option." >&5
+$as_echo "$as_me: error: *** You must not supply an argument to --with-suffixes option." >&2;}
    { (exit 1); exit 1; }; }
       ;;
     esac
@@ -18113,8 +19711,8 @@ _ACEOF
 # Check whether --with-gnutar-listed-incremental was given.
 if test "${with_gnutar_listed_incremental+set}" = set; then
   withval=$with_gnutar_listed_incremental;
-            { { echo "$as_me:$LINENO: error: *** The gnutar-listed-incremental option is deprecated; use --with-gnutar-listdir instead" >&5
-echo "$as_me: error: *** The gnutar-listed-incremental option is deprecated; use --with-gnutar-listdir instead" >&2;}
+            { { $as_echo "$as_me:$LINENO: error: *** The gnutar-listed-incremental option is deprecated; use --with-gnutar-listdir instead" >&5
+$as_echo "$as_me: error: *** The gnutar-listed-incremental option is deprecated; use --with-gnutar-listdir instead" >&2;}
    { (exit 1); exit 1; }; }
 
 
@@ -18137,8 +19735,8 @@ fi
 
 
     case "$tmpdir" in
-        n | no) { { echo "$as_me:$LINENO: error: *** --without-tmpdir is not allowed." >&5
-echo "$as_me: error: *** --without-tmpdir is not allowed." >&2;}
+        n | no) { { $as_echo "$as_me:$LINENO: error: *** --without-tmpdir is not allowed." >&5
+$as_echo "$as_me: error: *** --without-tmpdir is not allowed." >&2;}
    { (exit 1); exit 1; }; };;
         y |  ye | yes) AMANDA_TMPDIR="/tmp/amanda";;
         *) AMANDA_TMPDIR="$tmpdir";;
@@ -18174,6 +19772,7 @@ fi
 
     case "$CHECK_USERID" in
         y | ye | yes)
+           CHECK_USERID=1
 
 cat >>confdefs.h <<\_ACEOF
 #define CHECK_USERID 1
@@ -18181,23 +19780,25 @@ _ACEOF
 
           ;;
         n | no) :
+           CHECK_USERID=
           ;;
         *)
-            { { echo "$as_me:$LINENO: error: *** You must not supply an argument to --with-force-uid option." >&5
-echo "$as_me: error: *** You must not supply an argument to --with-force-uid option." >&2;}
+            { { $as_echo "$as_me:$LINENO: error: *** You must not supply an argument to --with-force-uid option." >&5
+$as_echo "$as_me: error: *** You must not supply an argument to --with-force-uid option." >&2;}
    { (exit 1); exit 1; }; }
     esac
 
 
 
 
+
 # Check whether --with-owner was given.
 if test "${with_owner+set}" = set; then
   withval=$with_owner;
             case "$withval" in
             "" | y | ye | yes | n | no)
-                { { echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-owner option." >&5
-echo "$as_me: error: *** You must supply an argument to the --with-owner option." >&2;}
+                { { $as_echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-owner option." >&5
+$as_echo "$as_me: error: *** You must supply an argument to the --with-owner option." >&2;}
    { (exit 1); exit 1; }; }
               ;;
             *) BINARY_OWNER="$withval"
@@ -18237,8 +19838,8 @@ cat >>confdefs.h <<\_ACEOF
 _ACEOF
 
       ;;
-    *) { { echo "$as_me:$LINENO: error: You must not supply an argument to --with-fqdn option." >&5
-echo "$as_me: error: You must not supply an argument to --with-fqdn option." >&2;}
+    *) { { $as_echo "$as_me:$LINENO: error: You must not supply an argument to --with-fqdn option." >&5
+$as_echo "$as_me: error: You must not supply an argument to --with-fqdn option." >&2;}
    { (exit 1); exit 1; }; }
       ;;
     esac
@@ -18250,8 +19851,8 @@ if test "${with_reuseports+set}" = set; then
   withval=$with_reuseports;  case "$withval" in
            y | ye | yes) USE_REUSEADDR=no;;
            n | no) USE_REUSEADDR=yes;;
-           *) { { echo "$as_me:$LINENO: error: You must not supply an argument to --without-reuseports" >&5
-echo "$as_me: error: You must not supply an argument to --without-reuseports" >&2;}
+           *) { { $as_echo "$as_me:$LINENO: error: You must not supply an argument to --without-reuseports" >&5
+$as_echo "$as_me: error: You must not supply an argument to --without-reuseports" >&2;}
    { (exit 1); exit 1; }; };;
          esac
 
 
     if test x"$LOW_TCPPORTRANGE" != x"unlimited"; then
        if test x`echo "$LOW_TCPPORTRANGE" | sed 's/[0-9][0-9]*,[0-9][0-9]*//'` != x""; then
-           { { echo "$as_me:$LINENO: error: --with-low-tcpportrange requires two comma-separated positive numbers" >&5
-echo "$as_me: error: --with-low-tcpportrange requires two comma-separated positive numbers" >&2;}
+           { { $as_echo "$as_me:$LINENO: error: --with-low-tcpportrange requires two comma-separated positive numbers" >&5
+$as_echo "$as_me: error: --with-low-tcpportrange requires two comma-separated positive numbers" >&2;}
    { (exit 1); exit 1; }; }
        fi
        min_low_tcp_port=`echo "$LOW_TCPPORTRANGE" | sed 's/,.*//'`
        max_low_tcp_port=`echo "$LOW_TCPPORTRANGE" | sed 's/.*,//'`
        if test $min_low_tcp_port -gt $max_low_tcp_port; then
-           { { echo "$as_me:$LINENO: error: the second TCP port number must be greater than the first in --with-low-tcpportrange" >&5
-echo "$as_me: error: the second TCP port number must be greater than the first in --with-low-tcpportrange" >&2;}
+           { { $as_echo "$as_me:$LINENO: error: the second TCP port number must be greater than the first in --with-low-tcpportrange" >&5
+$as_echo "$as_me: error: the second TCP port number must be greater than the first in --with-low-tcpportrange" >&2;}
    { (exit 1); exit 1; }; }
        fi
        if test $min_low_tcp_port -lt 512; then
 
-    { echo "$as_me:$LINENO: WARNING: the low TCP port range should be 512 or greater in --with-low-tcpportrange" >&5
-echo "$as_me: WARNING: the low TCP port range should be 512 or greater in --with-low-tcpportrange" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: the low TCP port range should be 512 or greater in --with-low-tcpportrange" >&5
+$as_echo "$as_me: WARNING: the low TCP port range should be 512 or greater in --with-low-tcpportrange" >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
@@ -18304,8 +19905,8 @@ AAW_EOF
        fi
        if test $max_low_tcp_port -ge 1024; then
 
-    { echo "$as_me:$LINENO: WARNING: the low TCP port range should be less than 1024 in --with-low-tcpportrange" >&5
-echo "$as_me: WARNING: the low TCP port range should be less than 1024 in --with-low-tcpportrange" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: the low TCP port range should be less than 1024 in --with-low-tcpportrange" >&5
+$as_echo "$as_me: WARNING: the low TCP port range should be less than 1024 in --with-low-tcpportrange" >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
 
     if test x"$TCPPORTRANGE" != x"unlimited"; then
        if test x`echo "$TCPPORTRANGE" | sed 's/[0-9][0-9]*,[0-9][0-9]*//'` != x""; then
-           { { echo "$as_me:$LINENO: error: --with-tcpportrange requires two comma-separated positive numbers" >&5
-echo "$as_me: error: --with-tcpportrange requires two comma-separated positive numbers" >&2;}
+           { { $as_echo "$as_me:$LINENO: error: --with-tcpportrange requires two comma-separated positive numbers" >&5
+$as_echo "$as_me: error: --with-tcpportrange requires two comma-separated positive numbers" >&2;}
    { (exit 1); exit 1; }; }
        fi
        min_tcp_port=`echo "$TCPPORTRANGE" | sed 's/,.*//'`
        max_tcp_port=`echo "$TCPPORTRANGE" | sed 's/.*,//'`
        if test $min_tcp_port -gt $max_tcp_port; then
-           { { echo "$as_me:$LINENO: error: the second TCP port number must be greater than the first in --with-tcpportrange" >&5
-echo "$as_me: error: the second TCP port number must be greater than the first in --with-tcpportrange" >&2;}
+           { { $as_echo "$as_me:$LINENO: error: the second TCP port number must be greater than the first in --with-tcpportrange" >&5
+$as_echo "$as_me: error: the second TCP port number must be greater than the first in --with-tcpportrange" >&2;}
    { (exit 1); exit 1; }; }
        fi
        if test $min_tcp_port -lt 1024; then
 
-    { echo "$as_me:$LINENO: WARNING: the TCP port range should be 1024 or greater in --with-tcpportrange" >&5
-echo "$as_me: WARNING: the TCP port range should be 1024 or greater in --with-tcpportrange" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: the TCP port range should be 1024 or greater in --with-tcpportrange" >&5
+$as_echo "$as_me: WARNING: the TCP port range should be 1024 or greater in --with-tcpportrange" >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
@@ -18357,8 +19958,8 @@ AAW_EOF
        fi
        if test $max_tcp_port -ge 65536; then
 
-    { echo "$as_me:$LINENO: WARNING: the TCP port range should be less than 65536 in --with-tcpportrange" >&5
-echo "$as_me: WARNING: the TCP port range should be less than 65536 in --with-tcpportrange" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: the TCP port range should be less than 65536 in --with-tcpportrange" >&5
+$as_echo "$as_me: WARNING: the TCP port range should be less than 65536 in --with-tcpportrange" >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
 
     if test x"$UDPPORTRANGE" != x"unlimited"; then
        if test x`echo "$UDPPORTRANGE" | sed 's/[0-9][0-9]*,[0-9][0-9]*//'` != x""; then
-           { { echo "$as_me:$LINENO: error: --with-udpportrange requires two comma-separated positive numbers" >&5
-echo "$as_me: error: --with-udpportrange requires two comma-separated positive numbers" >&2;}
+           { { $as_echo "$as_me:$LINENO: error: --with-udpportrange requires two comma-separated positive numbers" >&5
+$as_echo "$as_me: error: --with-udpportrange requires two comma-separated positive numbers" >&2;}
    { (exit 1); exit 1; }; }
        fi
        min_udp_port=`echo "$UDPPORTRANGE" | sed 's/,.*//'`
        max_udp_port=`echo "$UDPPORTRANGE" | sed 's/.*,//'`
        if test $min_udp_port -gt $max_udp_port; then
-           { { echo "$as_me:$LINENO: error: the second UDP port number must be greater than the first in --with-udpportrange" >&5
-echo "$as_me: error: the second UDP port number must be greater than the first in --with-udpportrange" >&2;}
+           { { $as_echo "$as_me:$LINENO: error: the second UDP port number must be greater than the first in --with-udpportrange" >&5
+$as_echo "$as_me: error: the second UDP port number must be greater than the first in --with-udpportrange" >&2;}
    { (exit 1); exit 1; }; }
        fi
        if test $max_udp_port -ge 1024; then
 
-    { echo "$as_me:$LINENO: WARNING: the UDP port range should be less than 1025 in --with-udpportrange" >&5
-echo "$as_me: WARNING: the UDP port range should be less than 1025 in --with-udpportrange" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: the UDP port range should be less than 1025 in --with-udpportrange" >&5
+$as_echo "$as_me: WARNING: the UDP port range should be less than 1025 in --with-udpportrange" >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
@@ -18409,8 +20010,8 @@ AAW_EOF
        fi
        if test $min_udp_port -le 0; then
 
-    { echo "$as_me:$LINENO: WARNING: the UDP port range should be greater than 0 in --with-udpportrange" >&5
-echo "$as_me: WARNING: the UDP port range should be greater than 0 in --with-udpportrange" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: the UDP port range should be greater than 0 in --with-udpportrange" >&5
+$as_echo "$as_me: WARNING: the UDP port range should be greater than 0 in --with-udpportrange" >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
@@ -18428,6 +20029,9 @@ _ACEOF
 
 
 
+
+
+
 # Check whether --with-buffered-dump was given.
 if test "${with_buffered_dump+set}" = set; then
   withval=$with_buffered_dump;  DUMPER_SOCKET_BUFFERING=$withval
@@ -18444,8 +20048,8 @@ cat >>confdefs.h <<\_ACEOF
 _ACEOF
 
       ;;
-    *) { { echo "$as_me:$LINENO: error: You must not supply an argument to --with-buffered-dump." >&5
-echo "$as_me: error: You must not supply an argument to --with-buffered-dump." >&2;}
+    *) { { $as_echo "$as_me:$LINENO: error: You must not supply an argument to --with-buffered-dump." >&5
+$as_echo "$as_me: error: You must not supply an argument to --with-buffered-dump." >&2;}
    { (exit 1); exit 1; }; } ;;
     esac
 
@@ -18453,21 +20057,22 @@ echo "$as_me: error: You must not supply an argument to --with-buffered-dump." >
 
 # Check whether --with-maxtapeblocksize was given.
 if test "${with_maxtapeblocksize+set}" = set; then
-  withval=$with_maxtapeblocksize;  MAXTAPEBLOCKSIZE="$withval"
-else
-   MAXTAPEBLOCKSIZE=32
+  withval=$with_maxtapeblocksize;
+    { $as_echo "$as_me:$LINENO: WARNING: --with-maxtapeblocksize is no longer needed" >&5
+$as_echo "$as_me: WARNING: --with-maxtapeblocksize is no longer needed" >&2;}
 
-fi
 
+    cat <<AAW_EOF >>config.warnings
+--with-maxtapeblocksize is no longer needed
+AAW_EOF
 
 
-cat >>confdefs.h <<_ACEOF
-#define MAX_TAPE_BLOCK_KB ($MAXTAPEBLOCKSIZE)
-_ACEOF
 
+fi
 
 
 
+    ASSERTIONS=
 
 # Check whether --with-assertions was given.
 if test "${with_assertions+set}" = set; then
@@ -18475,14 +20080,15 @@ if test "${with_assertions+set}" = set; then
             case "$withval" in
                 n | no) : ;;
                 y |  ye | yes)
+                   ASSERTIONS=1
 
 cat >>confdefs.h <<\_ACEOF
 #define ASSERTIONS 1
 _ACEOF
 
                   ;;
-                *) { { echo "$as_me:$LINENO: error: *** You must not supply an argument to --with-assertions option." >&5
-echo "$as_me: error: *** You must not supply an argument to --with-assertions option." >&2;}
+                *) { { $as_echo "$as_me:$LINENO: error: *** You must not supply an argument to --with-assertions option." >&5
+$as_echo "$as_me: error: *** You must not supply an argument to --with-assertions option." >&2;}
    { (exit 1); exit 1; }; }
                   ;;
             esac
@@ -18494,6 +20100,7 @@ fi
 
 
 
+
 # Check whether --with-debugging was given.
 if test "${with_debugging+set}" = set; then
   withval=$with_debugging;  debugging="$withval"
@@ -18504,8 +20111,8 @@ fi
 
 
     case "$debugging" in
-        n | no) { { echo "$as_me:$LINENO: error: Amanda no longer supports building with debugging disabled" >&5
-echo "$as_me: error: Amanda no longer supports building with debugging disabled" >&2;}
+        n | no) { { $as_echo "$as_me:$LINENO: error: Amanda no longer supports building with debugging disabled" >&5
+$as_echo "$as_me: error: Amanda no longer supports building with debugging disabled" >&2;}
    { (exit 1); exit 1; }; };;
         y | ye | yes) AMANDA_DBGDIR="$AMANDA_TMPDIR";;
         *) AMANDA_DBGDIR="$debugging";;
@@ -18551,8 +20158,8 @@ fi
             AMANDA_DEBUG_DAYS=4 ;;
         [0-9] | [0-9][0-9] | [0-9][0-9][0-9])
             AMANDA_DEBUG_DAYS="$debug_days" ;;
-        *) { { echo "$as_me:$LINENO: error: *** --with-debug-days value not numeric or out of range." >&5
-echo "$as_me: error: *** --with-debug-days value not numeric or out of range." >&2;}
+        *) { { $as_echo "$as_me:$LINENO: error: *** --with-debug-days value not numeric or out of range." >&5
+$as_echo "$as_me: error: *** --with-debug-days value not numeric or out of range." >&2;}
    { (exit 1); exit 1; }; }
           ;;
     esac
@@ -18678,8 +20285,8 @@ if test "${with_server+set}" = set; then
            case "$withval" in
            y | ye | yes) WANT_SERVER=true;;
            n | no) WANT_SERVER=false;;
-           *) { { echo "$as_me:$LINENO: error: You must not supply an argument to the --without-server option." >&5
-echo "$as_me: error: You must not supply an argument to the --without-server option." >&2;}
+           *) { { $as_echo "$as_me:$LINENO: error: You must not supply an argument to the --without-server option." >&5
+$as_echo "$as_me: error: You must not supply an argument to the --without-server option." >&2;}
    { (exit 1); exit 1; }; } ;;
            esac
 
@@ -18695,8 +20302,8 @@ if test "${with_client+set}" = set; then
            case "$withval" in
            y | ye | yes) WANT_CLIENT=true;;
            n | no) WANT_CLIENT=false;;
-           *) { { echo "$as_me:$LINENO: error: You must not supply an argument to the --without-client option." >&5
-echo "$as_me: error: You must not supply an argument to the --without-client option." >&2;}
+           *) { { $as_echo "$as_me:$LINENO: error: You must not supply an argument to the --without-client option." >&5
+$as_echo "$as_me: error: You must not supply an argument to the --without-client option." >&2;}
    { (exit 1); exit 1; }; } ;;
            esac
 
@@ -18713,8 +20320,8 @@ if test "${with_restore+set}" = set; then
            case "$withval" in
            y | ye | yes) WANT_RESTORE=true;;
            n | no) WANT_RESTORE=false;;
-           *) { { echo "$as_me:$LINENO: error: You must not supply an argument to --with-restore option." >&5
-echo "$as_me: error: You must not supply an argument to --with-restore option." >&2;}
+           *) { { $as_echo "$as_me:$LINENO: error: You must not supply an argument to --with-restore option." >&5
+$as_echo "$as_me: error: You must not supply an argument to --with-restore option." >&2;}
    { (exit 1); exit 1; }; } ;;
            esac
 
@@ -18731,8 +20338,8 @@ if test "${with_amrecover+set}" = set; then
            case "$withval" in
            y | ye | yes) WANT_RECOVER=false;;
            n | no) WANT_RECOVER=false;;
-           *) { { echo "$as_me:$LINENO: error: You must not supply an argument to --with-amrecover option." >&5
-echo "$as_me: error: You must not supply an argument to --with-amrecover option." >&2;}
+           *) { { $as_echo "$as_me:$LINENO: error: You must not supply an argument to --with-amrecover option." >&5
+$as_echo "$as_me: error: You must not supply an argument to --with-amrecover option." >&2;}
    { (exit 1); exit 1; }; } ;;
            esac
 
@@ -18743,8 +20350,8 @@ fi
 
 # Check whether --with-client-only was given.
 if test "${with_client_only+set}" = set; then
-  withval=$with_client_only;    { { echo "$as_me:$LINENO: error: --with-client-only is deprecated, use --without-server instead." >&5
-echo "$as_me: error: --with-client-only is deprecated, use --without-server instead." >&2;}
+  withval=$with_client_only;    { { $as_echo "$as_me:$LINENO: error: --with-client-only is deprecated, use --without-server instead." >&5
+$as_echo "$as_me: error: --with-client-only is deprecated, use --without-server instead." >&2;}
    { (exit 1); exit 1; }; }
 
 fi
@@ -18754,8 +20361,8 @@ fi
 
 # Check whether --with-server-only was given.
 if test "${with_server_only+set}" = set; then
-  withval=$with_server_only;    { { echo "$as_me:$LINENO: error: --with-server-only is deprecated, use --without-client instead." >&5
-echo "$as_me: error: --with-server-only is deprecated, use --without-client instead." >&2;}
+  withval=$with_server_only;    { { $as_echo "$as_me:$LINENO: error: --with-server-only is deprecated, use --without-client instead." >&5
+$as_echo "$as_me: error: --with-server-only is deprecated, use --without-client instead." >&2;}
    { (exit 1); exit 1; }; }
 
 fi
 
     # detect invalid combinations of components
     if ! ${WANT_SERVER-true} && ${WANT_RESTORE-true}; then
-        { { echo "$as_me:$LINENO: error: --without-server requires --without-restore" >&5
-echo "$as_me: error: --without-server requires --without-restore" >&2;}
+        { { $as_echo "$as_me:$LINENO: error: --without-server requires --without-restore" >&5
+$as_echo "$as_me: error: --without-server requires --without-restore" >&2;}
    { (exit 1); exit 1; }; }
     fi
     if ! ${WANT_CLIENT-true} && ${WANT_RECOVER-true}; then
-        { { echo "$as_me:$LINENO: error: --without-client requires --without-amrecover" >&5
-echo "$as_me: error: --without-client requires --without-amrecover" >&2;}
+        { { $as_echo "$as_me:$LINENO: error: --without-client requires --without-amrecover" >&5
+$as_echo "$as_me: error: --without-client requires --without-amrecover" >&2;}
    { (exit 1); exit 1; }; }
     fi
 
     else
        # Extract the first word of "gnuplot", so it can be a program name with args.
 set dummy gnuplot; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_GNUPLOT+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $GNUPLOT in
   [\\/]* | ?:[\\/]*)
@@ -18870,7 +20477,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_GNUPLOT="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -18882,11 +20489,11 @@ esac
 fi
 GNUPLOT=$ac_cv_path_GNUPLOT
 if test -n "$GNUPLOT"; then
-  { echo "$as_me:$LINENO: result: $GNUPLOT" >&5
-echo "${ECHO_T}$GNUPLOT" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $GNUPLOT" >&5
+$as_echo "$GNUPLOT" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
 
     # Extract the first word of "pcat", so it can be a program name with args.
 set dummy pcat; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_PCAT+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $PCAT in
   [\\/]* | ?:[\\/]*)
@@ -18917,7 +20524,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_PCAT="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -18929,11 +20536,11 @@ esac
 fi
 PCAT=$ac_cv_path_PCAT
 if test -n "$PCAT"; then
-  { echo "$as_me:$LINENO: result: $PCAT" >&5
-echo "${ECHO_T}$PCAT" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $PCAT" >&5
+$as_echo "$PCAT" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
 
     # Extract the first word of "compress", so it can be a program name with args.
 set dummy compress; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_COMPRESS+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $COMPRESS in
   [\\/]* | ?:[\\/]*)
@@ -18960,7 +20567,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_COMPRESS="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -18972,11 +20579,11 @@ esac
 fi
 COMPRESS=$ac_cv_path_COMPRESS
 if test -n "$COMPRESS"; then
-  { echo "$as_me:$LINENO: result: $COMPRESS" >&5
-echo "${ECHO_T}$COMPRESS" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $COMPRESS" >&5
+$as_echo "$COMPRESS" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
 
     # Extract the first word of "gzip", so it can be a program name with args.
 set dummy gzip; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_GZIP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $GZIP in
   [\\/]* | ?:[\\/]*)
@@ -19003,7 +20610,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_GZIP="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -19015,11 +20622,11 @@ esac
 fi
 GZIP=$ac_cv_path_GZIP
 if test -n "$GZIP"; then
-  { echo "$as_me:$LINENO: result: $GZIP" >&5
-echo "${ECHO_T}$GZIP" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $GZIP" >&5
+$as_echo "$GZIP" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -19060,8 +20667,8 @@ fi
     else
        WANT_AMPLOT=false
 
-    { echo "$as_me:$LINENO: WARNING: Not building 'amplot', because gnuplot was not found" >&5
-echo "$as_me: WARNING: Not building 'amplot', because gnuplot was not found" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: Not building 'amplot', because gnuplot was not found" >&5
+$as_echo "$as_me: WARNING: Not building 'amplot', because gnuplot was not found" >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
@@ -19128,10 +20735,10 @@ if test "$ac_with_xsltproc" = "yes" -o "$ac_with_xsltproc" = "maybe"; then
 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; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_XSLTPROC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $XSLTPROC in
   [\\/]* | ?:[\\/]*)
@@ -19146,7 +20753,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_XSLTPROC="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -19158,11 +20765,11 @@ esac
 fi
 XSLTPROC=$ac_cv_path_XSLTPROC
 if test -n "$XSLTPROC"; then
-  { echo "$as_me:$LINENO: result: $XSLTPROC" >&5
-echo "${ECHO_T}$XSLTPROC" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $XSLTPROC" >&5
+$as_echo "$XSLTPROC" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -19175,8 +20782,8 @@ else
             XSLTPROC="$ac_with_xsltproc";
         else
 
-    { echo "$as_me:$LINENO: WARNING: Specified xsltproc of $ac_with_xsltproc isn't executable; searching for an alternative." >&5
-echo "$as_me: WARNING: Specified xsltproc of $ac_with_xsltproc isn't executable; searching for an alternative." >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: Specified xsltproc of $ac_with_xsltproc isn't executable; searching for an alternative." >&5
+$as_echo "$as_me: WARNING: Specified xsltproc of $ac_with_xsltproc isn't executable; searching for an alternative." >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
@@ -19188,10 +20795,10 @@ AAW_EOF
 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; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_XSLTPROC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $XSLTPROC in
   [\\/]* | ?:[\\/]*)
@@ -19206,7 +20813,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_XSLTPROC="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -19218,11 +20825,11 @@ esac
 fi
 XSLTPROC=$ac_cv_path_XSLTPROC
 if test -n "$XSLTPROC"; then
-  { echo "$as_me:$LINENO: result: $XSLTPROC" >&5
-echo "${ECHO_T}$XSLTPROC" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $XSLTPROC" >&5
+$as_echo "$XSLTPROC" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
 
 
 
-    { echo "$as_me:$LINENO: checking for Docbook XSLT version 1.72.0" >&5
-echo $ECHO_N "checking for Docbook XSLT version 1.72.0... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for Docbook XSLT version 1.72.0" >&5
+$as_echo_n "checking for Docbook XSLT version 1.72.0... " >&6; }
 if test "${ac_cv_docbook_xslt_1_72_0+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
        ac_cv_docbook_xslt_1_72_0=no
@@ -19259,8 +20866,8 @@ else
        fi
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_docbook_xslt_1_72_0" >&5
-echo "${ECHO_T}$ac_cv_docbook_xslt_1_72_0" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_docbook_xslt_1_72_0" >&5
+$as_echo "$ac_cv_docbook_xslt_1_72_0" >&6; }
 
     HAVE_DOCBOOK_XSLT_1_72_0="$ac_cv_docbook_xslt_1_72_0"
     HAVE_DOCBOOK_XSLT="$HAVE_DOCBOOK_XSLT_1_72_0"
@@ -19272,10 +20879,10 @@ echo "${ECHO_T}$ac_cv_docbook_xslt_1_72_0" >&6; }
 
 
 
-    { echo "$as_me:$LINENO: checking for current Docbook XSLT version" >&5
-echo $ECHO_N "checking for current Docbook XSLT version... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for current Docbook XSLT version" >&5
+$as_echo_n "checking for current Docbook XSLT version... " >&6; }
 if test "${ac_cv_docbook_xslt_current_version+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
        ac_cv_docbook_xslt_current_version=no
@@ -19309,16 +20916,16 @@ EOF
        fi
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_docbook_xslt_current_version" >&5
-echo "${ECHO_T}$ac_cv_docbook_xslt_current_version" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_docbook_xslt_current_version" >&5
+$as_echo "$ac_cv_docbook_xslt_current_version" >&6; }
 
     DOCBOOK_XSLT_CURRENT_VERSION="$ac_cv_docbook_xslt_current_version"
-    { echo "$as_me:$LINENO: checking whether Docbook XSLT version is 1.72.0 or newer" >&5
-echo $ECHO_N "checking whether Docbook XSLT version is 1.72.0 or newer... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking whether Docbook XSLT version is 1.72.0 or newer" >&5
+$as_echo_n "checking whether Docbook XSLT version is 1.72.0 or newer... " >&6; }
 
     if test x"$DOCBOOK_XSLT_CURRENT_VERSION" = x"no"; then
-       { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+       { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
     else
 
   # Used to indicate true or false condition
@@ -19358,11 +20965,11 @@ x$ax_compare_version_B" | sed 's/^ *//' | sort -r | sed "s/x${ax_compare_version
 
 
        if test x"$DOCBOOK_XSLT_CURRENT_VERSION" = x"no"; then
-           { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+           { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
        else
-           { echo "$as_me:$LINENO: result: yes ($DOCBOOK_XSLT_CURRENT_VERSION)" >&5
-echo "${ECHO_T}yes ($DOCBOOK_XSLT_CURRENT_VERSION)" >&6; }
+           { $as_echo "$as_me:$LINENO: result: yes ($DOCBOOK_XSLT_CURRENT_VERSION)" >&5
+$as_echo "yes ($DOCBOOK_XSLT_CURRENT_VERSION)" >&6; }
        fi
     fi
 
@@ -19375,10 +20982,10 @@ echo "${ECHO_T}yes ($DOCBOOK_XSLT_CURRENT_VERSION)" >&6; }
 
 
 
-    { echo "$as_me:$LINENO: checking for Docbook DTD version 4.1.2" >&5
-echo $ECHO_N "checking for Docbook DTD version 4.1.2... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for Docbook DTD version 4.1.2" >&5
+$as_echo_n "checking for Docbook DTD version 4.1.2... " >&6; }
 if test "${ac_cv_docbook_dtd_4_1_2+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
        ac_cv_docbook_dtd_4_1_2=no
@@ -19411,8 +21018,8 @@ EOF
        fi
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_docbook_dtd_4_1_2" >&5
-echo "${ECHO_T}$ac_cv_docbook_dtd_4_1_2" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_docbook_dtd_4_1_2" >&5
+$as_echo "$ac_cv_docbook_dtd_4_1_2" >&6; }
 
     HAVE_DOCBOOK_DTD_4_1_2="$ac_cv_docbook_dtd_4_1_2"
     HAVE_DOCBOOK_DTD="$HAVE_DOCBOOK_DTD_4_1_2"
@@ -19430,10 +21037,10 @@ echo "${ECHO_T}$ac_cv_docbook_dtd_4_1_2" >&6; }
 
 
 
-    { echo "$as_me:$LINENO: checking for Docbook DTD version 4.2" >&5
-echo $ECHO_N "checking for Docbook DTD version 4.2... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for Docbook DTD version 4.2" >&5
+$as_echo_n "checking for Docbook DTD version 4.2... " >&6; }
 if test "${ac_cv_docbook_dtd_4_2+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
        ac_cv_docbook_dtd_4_2=no
@@ -19466,8 +21073,8 @@ EOF
        fi
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_docbook_dtd_4_2" >&5
-echo "${ECHO_T}$ac_cv_docbook_dtd_4_2" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_docbook_dtd_4_2" >&5
+$as_echo "$ac_cv_docbook_dtd_4_2" >&6; }
 
     HAVE_DOCBOOK_DTD_4_2="$ac_cv_docbook_dtd_4_2"
     HAVE_DOCBOOK_DTD="$HAVE_DOCBOOK_DTD_4_2"
@@ -19478,8 +21085,8 @@ echo "${ECHO_T}$ac_cv_docbook_dtd_4_2" >&6; }
 
 
        if test -z "$XSLTPROC"; then
-           { { echo "$as_me:$LINENO: error: Cannot build manpages: 'xsltproc' was not found." >&5
-echo "$as_me: error: Cannot build manpages: 'xsltproc' was not found." >&2;}
+           { { $as_echo "$as_me:$LINENO: error: Cannot build manpages: 'xsltproc' was not found." >&5
+$as_echo "$as_me: error: Cannot build manpages: 'xsltproc' was not found." >&2;}
    { (exit 1); exit 1; }; }
        fi
 
@@ -19488,8 +21095,8 @@ echo "$as_me: error: Cannot build manpages: 'xsltproc' was not found." >&2;}
        XSLREL=current
        if test "x$DOCBOOK_XSLT_CURRENT_VERSION" = "xno"; then
            if test "x$HAVE_DOCBOOK_XSLT_1_72_0" = "xno"; then
-               { { echo "$as_me:$LINENO: error: Cannot build manpages: docbook version 1.72.0 or higher required." >&5
-echo "$as_me: error: Cannot build manpages: docbook version 1.72.0 or higher required." >&2;}
+               { { $as_echo "$as_me:$LINENO: error: Cannot build manpages: docbook version 1.72.0 or higher required." >&5
+$as_echo "$as_me: error: Cannot build manpages: docbook version 1.72.0 or higher required." >&2;}
    { (exit 1); exit 1; }; }
            else
                XSLREL=1.72.0
@@ -19499,8 +21106,8 @@ echo "$as_me: error: Cannot build manpages: docbook version 1.72.0 or higher req
        # disable validation if the correct DTDs are not available
        if test "x$HAVE_DOCBOOK_DTD_4_1_2" = "xno" || test "x$HAVE_DOCBOOK_DTD_4_2" = "xno"; then
 
-    { echo "$as_me:$LINENO: WARNING: Docbook DTD versions 4.1.2 and 4.2 are required for manpage validation; disabling validation" >&5
-echo "$as_me: WARNING: Docbook DTD versions 4.1.2 and 4.2 are required for manpage validation; disabling validation" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: Docbook DTD versions 4.1.2 and 4.2 are required for manpage validation; disabling validation" >&5
+$as_echo "$as_me: WARNING: Docbook DTD versions 4.1.2 and 4.2 are required for manpage validation; disabling validation" >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
 
 
 
+    #allow configure CONFIG_CLOBBER_MY_CONFIG= to be used by make.
+    CONFIG_CLOBBER_MY_CONFIG=$CLOBBER_MY_CONFIG
+
+
 
 # Check whether --with-index-server was given.
 if test "${with_index_server+set}" = set; then
   withval=$with_index_server;
            case "$withval" in
            "" | y | ye | yes | n | no)
-               { { echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-index-server option." >&5
-echo "$as_me: error: *** You must supply an argument to the --with-index-server option." >&2;}
+               { { $as_echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-index-server option." >&5
+$as_echo "$as_me: error: *** You must supply an argument to the --with-index-server option." >&2;}
    { (exit 1); exit 1; }; }
              ;;
            *) DEFAULT_SERVER="$withval"
@@ -19556,8 +21167,8 @@ if test "${with_config+set}" = set; then
   withval=$with_config;
            case "$withval" in
            "" | y | ye | yes | n | no)
-               { { echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-config option." >&5
-echo "$as_me: error: *** You must supply an argument to the --with-config option." >&2;}
+               { { $as_echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-config option." >&5
+$as_echo "$as_me: error: *** You must supply an argument to the --with-config option." >&2;}
    { (exit 1); exit 1; }; }
              ;;
            *) DEFAULT_CONFIG="$withval"
@@ -19582,8 +21193,8 @@ if test "${with_tape_server+set}" = set; then
   withval=$with_tape_server;
            case "$withval" in
            "" | y | ye | yes | n | no)
-               { { echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-tape-server option." >&5
-echo "$as_me: error: *** You must supply an argument to the --with-tape-server option." >&2;}
+               { { $as_echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-tape-server option." >&5
+$as_echo "$as_me: error: *** You must supply an argument to the --with-tape-server option." >&2;}
    { (exit 1); exit 1; }; }
              ;;
            *) DEFAULT_TAPE_SERVER="$withval"
@@ -19608,8 +21219,8 @@ if test "${with_tape_device+set}" = set; then
   withval=$with_tape_device;
            case "$withval" in
            "" | y | ye | yes | n | no)
-               { { echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-tape-device option." >&5
-echo "$as_me: error: *** You must supply an argument to the --with-tape-device option." >&2;}
+               { { $as_echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-tape-device option." >&5
+$as_echo "$as_me: error: *** You must supply an argument to the --with-tape-device option." >&2;}
    { (exit 1); exit 1; }; }
              ;;
            *) DEFAULT_TAPE_DEVICE="$withval"
@@ -19640,8 +21251,8 @@ if test "${with_changer_device+set}" = set; then
   withval=$with_changer_device;
            case "$withval" in
            "" | y | ye | yes | n | no)
-               { { echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-changer-device option." >&5
-echo "$as_me: error: *** You must supply an argument to the --with-changer-device option." >&2;}
+               { { $as_echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-changer-device option." >&5
+$as_echo "$as_me: error: *** You must supply an argument to the --with-changer-device option." >&2;}
    { (exit 1); exit 1; }; }
              ;;
            *) DEFAULT_CHANGER_DEVICE="$withval"
@@ -19671,8 +21282,8 @@ _ACEOF
 if test "${with_amandates+set}" = set; then
   withval=$with_amandates;
            case "$withval" in
-               n | no) { { echo "$as_me:$LINENO: error: *** --without-amandates is not allowed." >&5
-echo "$as_me: error: *** --without-amandates is not allowed." >&2;}
+               n | no) { { $as_echo "$as_me:$LINENO: error: *** --without-amandates is not allowed." >&5
+$as_echo "$as_me: error: *** --without-amandates is not allowed." >&2;}
    { (exit 1); exit 1; }; };;
                y |  ye | yes) amandates='$localstatedir/amanda/amandates' ;;
                *) amandates="$withval";;
@@ -19706,10 +21317,10 @@ _ACEOF
 
     # Extract the first word of "getconf", so it can be a program name with args.
 set dummy getconf; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_GETCONF+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $GETCONF in
   [\\/]* | ?:[\\/]*)
@@ -19724,7 +21335,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_GETCONF="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -19736,11 +21347,11 @@ esac
 fi
 GETCONF=$ac_cv_path_GETCONF
 if test -n "$GETCONF"; then
-  { echo "$as_me:$LINENO: result: $GETCONF" >&5
-echo "${ECHO_T}$GETCONF" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $GETCONF" >&5
+$as_echo "$GETCONF" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
     # Checks for compilers, typedefs, structures, and compiler characteristics.
     # Check for large file compilation environment.
     NEED_RESETOFS=yes
-    { echo "$as_me:$LINENO: checking for large file compilation CFLAGS" >&5
-echo $ECHO_N "checking for large file compilation CFLAGS... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for large file compilation CFLAGS" >&5
+$as_echo_n "checking for large file compilation CFLAGS... " >&6; }
 if test "${amanda_cv_LFS_CFLAGS+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
         amanda_cv_LFS_CFLAGS=
@@ -19776,15 +21387,15 @@ else
 
 
 fi
-{ echo "$as_me:$LINENO: result: $amanda_cv_LFS_CFLAGS" >&5
-echo "${ECHO_T}$amanda_cv_LFS_CFLAGS" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $amanda_cv_LFS_CFLAGS" >&5
+$as_echo "$amanda_cv_LFS_CFLAGS" >&6; }
     CFLAGS="$CFLAGS $amanda_cv_LFS_CFLAGS"
 
 
-    { echo "$as_me:$LINENO: checking for large file compilation LDFLAGS" >&5
-echo $ECHO_N "checking for large file compilation LDFLAGS... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for large file compilation LDFLAGS" >&5
+$as_echo_n "checking for large file compilation LDFLAGS... " >&6; }
 if test "${amanda_cv_LFS_LDFLAGS+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
         amanda_cv_LFS_LDFLAGS=
@@ -19797,15 +21408,15 @@ else
 
 
 fi
-{ echo "$as_me:$LINENO: result: $amanda_cv_LFS_LDFLAGS" >&5
-echo "${ECHO_T}$amanda_cv_LFS_LDFLAGS" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $amanda_cv_LFS_LDFLAGS" >&5
+$as_echo "$amanda_cv_LFS_LDFLAGS" >&6; }
     LDFLAGS="$LDFLAGS $amanda_cv_LFS_LDFLAGS"
 
 
-    { echo "$as_me:$LINENO: checking for large file compilation LIBS" >&5
-echo $ECHO_N "checking for large file compilation LIBS... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for large file compilation LIBS" >&5
+$as_echo_n "checking for large file compilation LIBS... " >&6; }
 if test "${amanda_cv_LFS_LIBS+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
         amanda_cv_LFS_LIBS=
@@ -19818,8 +21429,8 @@ else
 
 
 fi
-{ echo "$as_me:$LINENO: result: $amanda_cv_LFS_LIBS" >&5
-echo "${ECHO_T}$amanda_cv_LFS_LIBS" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $amanda_cv_LFS_LIBS" >&5
+$as_echo "$amanda_cv_LFS_LIBS" >&6; }
     LIBS="$amanda_cv_LFS_LIBS $LIBS"
 
 
@@ -19835,10 +21446,10 @@ _ACEOF
 
     # Extract the first word of "chio", so it can be a program name with args.
 set dummy chio; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_CHIO+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $CHIO in
   [\\/]* | ?:[\\/]*)
@@ -19853,7 +21464,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_CHIO="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -19866,11 +21477,11 @@ esac
 fi
 CHIO=$ac_cv_path_CHIO
 if test -n "$CHIO"; then
-  { echo "$as_me:$LINENO: result: $CHIO" >&5
-echo "${ECHO_T}$CHIO" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $CHIO" >&5
+$as_echo "$CHIO" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
 
     # Extract the first word of "chs", so it can be a program name with args.
 set dummy chs; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_CHS+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $CHS in
   [\\/]* | ?:[\\/]*)
@@ -19897,7 +21508,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_CHS="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -19910,11 +21521,11 @@ esac
 fi
 CHS=$ac_cv_path_CHS
 if test -n "$CHS"; then
-  { echo "$as_me:$LINENO: result: $CHS" >&5
-echo "${ECHO_T}$CHS" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $CHS" >&5
+$as_echo "$CHS" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
 
     # Extract the first word of "mtx", so it can be a program name with args.
 set dummy mtx; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_MTX+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $MTX in
   [\\/]* | ?:[\\/]*)
@@ -19941,7 +21552,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_MTX="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -19954,11 +21565,11 @@ esac
 fi
 MTX=$ac_cv_path_MTX
 if test -n "$MTX"; then
-  { echo "$as_me:$LINENO: result: $MTX" >&5
-echo "${ECHO_T}$MTX" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $MTX" >&5
+$as_echo "$MTX" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
 
     # Extract the first word of "mcutil", so it can be a program name with args.
 set dummy mcutil; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_MCUTIL+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $MCUTIL in
   [\\/]* | ?:[\\/]*)
@@ -19985,7 +21596,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_MCUTIL="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -19998,11 +21609,11 @@ esac
 fi
 MCUTIL=$ac_cv_path_MCUTIL
 if test -n "$MCUTIL"; then
-  { echo "$as_me:$LINENO: result: $MCUTIL" >&5
-echo "${ECHO_T}$MCUTIL" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $MCUTIL" >&5
+$as_echo "$MCUTIL" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -20041,30 +21652,22 @@ for ac_header in \
        sys/scsi.h \
        sys/scsiio.h \
        sys/scsi/impl/uscsi.h \
-       sys/scsi/scsi/ioctl.h \
-
+       sys/scsi/scsi/ioctl.h
 do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 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; }
+  $as_echo_n "(cached) " >&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
+  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
@@ -20073,109 +21676,39 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
+  eval "$as_ac_Header=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_header_compiler=no
+       eval "$as_ac_Header=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 && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.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_c_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;}
-
-    ;;
-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
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
+ \
 
 fi
 
@@ -20186,10 +21719,10 @@ done
     # chio support
     #
     if test x"$ac_cv_header_sys_scsi_h" = x"yes"; then
-       { echo "$as_me:$LINENO: checking for HP/UX-like scsi changer support" >&5
-echo $ECHO_N "checking for HP/UX-like scsi changer support... $ECHO_C" >&6; }
+       { $as_echo "$as_me:$LINENO: checking for HP/UX-like scsi changer support" >&5
+$as_echo_n "checking for HP/UX-like scsi changer support... " >&6; }
 if test "${amanda_cv_hpux_scsi_chio+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -20219,20 +21752,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   amanda_cv_hpux_scsi_chio=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        amanda_cv_hpux_scsi_chio=no
@@ -20240,8 +21774,8 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $amanda_cv_hpux_scsi_chio" >&5
-echo "${ECHO_T}$amanda_cv_hpux_scsi_chio" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $amanda_cv_hpux_scsi_chio" >&5
+$as_echo "$amanda_cv_hpux_scsi_chio" >&6; }
        if test x"$amanda_cv_hpux_scsi_chio" = x"yes"; then
            WANT_SCSI_HPUX=yes
            WANT_CHG_SCSI=yes
@@ -20253,10 +21787,10 @@ echo "${ECHO_T}$amanda_cv_hpux_scsi_chio" >&6; }
     #
     if test x"$ac_cv_header_sys_mtio_h" = x"yes" &&
        test x"$ac_cv_header_scsi_scsi_ioctl_h" = x"yes"; then
-           { echo "$as_me:$LINENO: checking for Linux like scsi support (ioctl)" >&5
-echo $ECHO_N "checking for Linux like scsi support (ioctl)... $ECHO_C" >&6; }
+           { $as_echo "$as_me:$LINENO: checking for Linux like scsi support (ioctl)" >&5
+$as_echo_n "checking for Linux like scsi support (ioctl)... " >&6; }
 if test "${amanda_cv_linux_scsi+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -20286,20 +21820,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   amanda_cv_linux_scsi=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        amanda_cv_linux_scsi=no
@@ -20307,8 +21842,8 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $amanda_cv_linux_scsi" >&5
-echo "${ECHO_T}$amanda_cv_linux_scsi" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $amanda_cv_linux_scsi" >&5
+$as_echo "$amanda_cv_linux_scsi" >&6; }
     fi
 
     #
@@ -20316,10 +21851,10 @@ echo "${ECHO_T}$amanda_cv_linux_scsi" >&6; }
     #
     if test x"$ac_cv_header_sys_mtio_h" = x"yes" &&
        test x"$ac_cv_header_scsi_sg_h" = x"yes"; then
-           { echo "$as_me:$LINENO: checking for Linux like scsi support (sg)" >&5
-echo $ECHO_N "checking for Linux like scsi support (sg)... $ECHO_C" >&6; }
+           { $as_echo "$as_me:$LINENO: checking for Linux like scsi support (sg)" >&5
+$as_echo_n "checking for Linux like scsi support (sg)... " >&6; }
 if test "${amanda_cv_linux_sg_scsi+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -20351,20 +21886,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   amanda_cv_linux_sg_scsi=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        amanda_cv_linux_sg_scsi=no
@@ -20372,8 +21908,8 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $amanda_cv_linux_sg_scsi" >&5
-echo "${ECHO_T}$amanda_cv_linux_sg_scsi" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $amanda_cv_linux_sg_scsi" >&5
+$as_echo "$amanda_cv_linux_sg_scsi" >&6; }
     fi
 
     if test x"$amanda_cv_linux_scsi" = x"yes" ||
@@ -20387,10 +21923,10 @@ echo "${ECHO_T}$amanda_cv_linux_sg_scsi" >&6; }
     #
     if test x"$ac_cv_header_sys_mtio_h" = x"yes" &&
        test x"$ac_cv_header_sys_scsi_h" = x"yes"; then
-           { echo "$as_me:$LINENO: checking for HP-UX like scsi support" >&5
-echo $ECHO_N "checking for HP-UX like scsi support... $ECHO_C" >&6; }
+           { $as_echo "$as_me:$LINENO: checking for HP-UX like scsi support" >&5
+$as_echo_n "checking for HP-UX like scsi support... " >&6; }
 if test "${amanda_cv_hpux_scsi+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -20422,20 +21958,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   amanda_cv_hpux_scsi=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        amanda_cv_hpux_scsi=no
@@ -20443,8 +21980,8 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $amanda_cv_hpux_scsi" >&5
-echo "${ECHO_T}$amanda_cv_hpux_scsi" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $amanda_cv_hpux_scsi" >&5
+$as_echo "$amanda_cv_hpux_scsi" >&6; }
            if test x"$amanda_cv_hpux_scsi" = x"yes";then
                    WANT_SCSI_HPUX_NEW=yes
                    WANT_CHG_SCSI=yes
@@ -20457,10 +21994,10 @@ echo "${ECHO_T}$amanda_cv_hpux_scsi" >&6; }
     #
     if test x"$ac_cv_header_sys_mtio_h" = x"yes" &&
        test x"$ac_cv_header_sys_dsreq_h" = x"yes"; then
-           { echo "$as_me:$LINENO: checking for Irix like scsi support" >&5
-echo $ECHO_N "checking for Irix like scsi support... $ECHO_C" >&6; }
+           { $as_echo "$as_me:$LINENO: checking for Irix like scsi support" >&5
+$as_echo_n "checking for Irix like scsi support... " >&6; }
 if test "${amanda_cv_irix_scsi+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -20491,20 +22028,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   amanda_cv_irix_scsi=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        amanda_cv_irix_scsi=no
@@ -20512,8 +22050,8 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $amanda_cv_irix_scsi" >&5
-echo "${ECHO_T}$amanda_cv_irix_scsi" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $amanda_cv_irix_scsi" >&5
+$as_echo "$amanda_cv_irix_scsi" >&6; }
            if test x"$amanda_cv_irix_scsi" = x"yes";then
                    WANT_SCSI_IRIX=yes
                    WANT_CHG_SCSI=yes
@@ -20525,10 +22063,10 @@ echo "${ECHO_T}$amanda_cv_irix_scsi" >&6; }
     #
     if test x"$ac_cv_header_sys_mtio_h" = x"yes" &&
        test x"$ac_cv_header_sys_scsi_impl_uscsi_h" = x"yes"; then
-           { echo "$as_me:$LINENO: checking for Solaris-like scsi support" >&5
-echo $ECHO_N "checking for Solaris-like scsi support... $ECHO_C" >&6; }
+           { $as_echo "$as_me:$LINENO: checking for Solaris-like scsi support" >&5
+$as_echo_n "checking for Solaris-like scsi support... " >&6; }
 if test "${amanda_cv_solaris_scsi+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -20559,20 +22097,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   amanda_cv_solaris_scsi=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        amanda_cv_solaris_scsi=no
@@ -20580,8 +22119,8 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $amanda_cv_solaris_scsi" >&5
-echo "${ECHO_T}$amanda_cv_solaris_scsi" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $amanda_cv_solaris_scsi" >&5
+$as_echo "$amanda_cv_solaris_scsi" >&6; }
            if test x"$amanda_cv_solaris_scsi" = x"yes";then
                    WANT_SCSI_SOLARIS=yes
                    WANT_CHG_SCSI=yes
@@ -20594,10 +22133,10 @@ echo "${ECHO_T}$amanda_cv_solaris_scsi" >&6; }
     if test x"$ac_cv_header_sys_tape_h" = x"yes" &&
        test x"$ac_cv_header_sys_scarray_h" = x"yes" &&
        test x"$ac_cv_header_sys_gscdds_h" = x"yes"; then
-           { echo "$as_me:$LINENO: checking for AIX like scsi support" >&5
-echo $ECHO_N "checking for AIX like scsi support... $ECHO_C" >&6; }
+           { $as_echo "$as_me:$LINENO: checking for AIX like scsi support" >&5
+$as_echo_n "checking for AIX like scsi support... " >&6; }
 if test "${amanda_cv_aix_scsi+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -20628,20 +22167,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   amanda_cv_aix_scsi=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        amanda_cv_aix_scsi=no
@@ -20649,8 +22189,8 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $amanda_cv_aix_scsi" >&5
-echo "${ECHO_T}$amanda_cv_aix_scsi" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $amanda_cv_aix_scsi" >&5
+$as_echo "$amanda_cv_aix_scsi" >&6; }
            if test x"$amanda_cv_aix_scsi" = x"yes";then
                    WANT_SCSI_AIX=yes
                    WANT_CHG_SCSI=yes
@@ -20660,10 +22200,10 @@ echo "${ECHO_T}$amanda_cv_aix_scsi" >&6; }
     # BSD CAM SCSI
     #
     if test x"$ac_cv_header_cam_cam_h" = x"yes";then
-           { echo "$as_me:$LINENO: checking for CAM like scsi support" >&5
-echo $ECHO_N "checking for CAM like scsi support... $ECHO_C" >&6; }
+           { $as_echo "$as_me:$LINENO: checking for CAM like scsi support" >&5
+$as_echo_n "checking for CAM like scsi support... " >&6; }
 if test "${amanda_cv_cam_scsi+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -20698,20 +22238,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   amanda_cv_cam_scsi=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        amanda_cv_cam_scsi=no
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $amanda_cv_cam_scsi" >&5
-echo "${ECHO_T}$amanda_cv_cam_scsi" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $amanda_cv_cam_scsi" >&5
+$as_echo "$amanda_cv_cam_scsi" >&6; }
            if test x"$amanda_cv_cam_scsi" = x"yes";then
                    WANT_SCSI_CAM=yes
                    WANT_CHG_SCSI=yes
 
-{ echo "$as_me:$LINENO: checking for main in -lcam" >&5
-echo $ECHO_N "checking for main in -lcam... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for main in -lcam" >&5
+$as_echo_n "checking for main in -lcam... " >&6; }
 if test "${ac_cv_lib_cam_main+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lcam  $LIBS"
@@ -20754,33 +22295,37 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_cam_main=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_cam_main=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_cam_main" >&5
-echo "${ECHO_T}$ac_cv_lib_cam_main" >&6; }
-if test $ac_cv_lib_cam_main = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_cam_main" >&5
+$as_echo "$ac_cv_lib_cam_main" >&6; }
+if test "x$ac_cv_lib_cam_main" = x""yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBCAM 1
 _ACEOF
     #
     if test x"$ac_cv_header_sys_mtio_h" = x"yes" &&
        test x"$ac_cv_header_sys_scsiio_h" = x"yes"; then
-       { echo "$as_me:$LINENO: checking for BSD like scsi support" >&5
-echo $ECHO_N "checking for BSD like scsi support... $ECHO_C" >&6; }
+       { $as_echo "$as_me:$LINENO: checking for BSD like scsi support" >&5
+$as_echo_n "checking for BSD like scsi support... " >&6; }
 if test "${amanda_cv_bsd_scsi+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -20832,20 +22377,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   amanda_cv_bsd_scsi=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        amanda_cv_bsd_scsi=no
@@ -20853,8 +22399,8 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $amanda_cv_bsd_scsi" >&5
-echo "${ECHO_T}$amanda_cv_bsd_scsi" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $amanda_cv_bsd_scsi" >&5
+$as_echo "$amanda_cv_bsd_scsi" >&6; }
        if test x"$amanda_cv_bsd_scsi" = x"yes";then
           WANT_SCSI_BSD=yes
           WANT_CHG_SCSI=yes
@@ -20984,20 +22530,21 @@ for ac_header in fstab.h \
        sys/vfstab.h \
 
 do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+as_ac_Header=`$as_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; }
+  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -21013,32 +22560,33 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -21052,69 +22600,73 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
         test ! -s conftest.err
        }; then
   ac_header_preproc=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&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; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
 
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
+as_val=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -21125,11 +22677,11 @@ done
 
 for ac_func in endmntent
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -21182,35 +22734,42 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -21219,11 +22778,11 @@ done
 
 for ac_func in setmntent
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -21276,35 +22835,42 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -21324,20 +22890,21 @@ for ac_header in fcntl.h \
        unistd.h \
 
 do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+as_ac_Header=`$as_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; }
+  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -21353,32 +22920,33 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -21392,69 +22960,73 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
         test ! -s conftest.err
        }; then
   ac_header_preproc=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&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; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
 
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
+as_val=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -21466,13 +23038,13 @@ done
     # Note: these all use AC_TRY_LINK to make sure that we can compile
     # and link each variant.  They do not try to test the variants --
     # that is left to runtime.
-    WORKING_FILE_LOCK="no"
+    LOCKING="no"
 
     # check POSIX locking
-    { echo "$as_me:$LINENO: checking whether POSIX locking (with fcntl(2)) is available" >&5
-echo $ECHO_N "checking whether POSIX locking (with fcntl(2)) is available... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking whether POSIX locking (with fcntl(2)) is available" >&5
+$as_echo_n "checking whether POSIX locking (with fcntl(2)) is available... " >&6; }
 if test "${amanda_cv_posix_filelocking+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
            cat >conftest.$ac_ext <<_ACEOF
@@ -21514,23 +23086,26 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
 
        amanda_cv_posix_filelocking="yes"
 
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
@@ -21538,12 +23113,13 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 
 fi
-{ echo "$as_me:$LINENO: result: $amanda_cv_posix_filelocking" >&5
-echo "${ECHO_T}$amanda_cv_posix_filelocking" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $amanda_cv_posix_filelocking" >&5
+$as_echo "$amanda_cv_posix_filelocking" >&6; }
     if test "x$amanda_cv_posix_filelocking" = xyes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -21551,7 +23127,7 @@ cat >>confdefs.h <<\_ACEOF
 _ACEOF
 
        WANT_AMFLOCK_POSIX="yes"
-       WORKING_FILE_LOCK="yes"
+       LOCKING="POSIX_FCNTL"
     fi
      if test x"$WANT_AMFLOCK_POSIX" = x"yes"; then
   WANT_AMFLOCK_POSIX_TRUE=
 
 
     # check flock-based (BSD) locking
-    { echo "$as_me:$LINENO: checking whether flock locking is available" >&5
-echo $ECHO_N "checking whether flock locking is available... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking whether flock locking is available" >&5
+$as_echo_n "checking whether flock locking is available... " >&6; }
 if test "${amanda_cv_flock_filelocking+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
            cat >conftest.$ac_ext <<_ACEOF
@@ -21596,23 +23172,26 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
 
        amanda_cv_flock_filelocking="yes"
 
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
@@ -21620,12 +23199,13 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 
 fi
-{ echo "$as_me:$LINENO: result: $amanda_cv_flock_filelocking" >&5
-echo "${ECHO_T}$amanda_cv_flock_filelocking" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $amanda_cv_flock_filelocking" >&5
+$as_echo "$amanda_cv_flock_filelocking" >&6; }
     if test "x$amanda_cv_flock_filelocking" = xyes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -21633,7 +23213,7 @@ cat >>confdefs.h <<\_ACEOF
 _ACEOF
 
        WANT_AMFLOCK_FLOCK="yes"
-       WORKING_FILE_LOCK="yes"
+       LOCKING="FLOCK"
     fi
      if test x"$WANT_AMFLOCK_FLOCK" = x"yes"; then
   WANT_AMFLOCK_FLOCK_TRUE=
 
 
     # check lockf-based (SVR2, SVR3, SVR4) locking
-    { echo "$as_me:$LINENO: checking whether lockf(3) locking is available" >&5
-echo $ECHO_N "checking whether lockf(3) locking is available... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking whether lockf(3) locking is available" >&5
+$as_echo_n "checking whether lockf(3) locking is available... " >&6; }
 if test "${amanda_cv_lockf_filelocking+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
            cat >conftest.$ac_ext <<_ACEOF
@@ -21678,23 +23258,26 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
 
        amanda_cv_lockf_filelocking="yes"
 
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
@@ -21702,12 +23285,13 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 
 fi
-{ echo "$as_me:$LINENO: result: $amanda_cv_lockf_filelocking" >&5
-echo "${ECHO_T}$amanda_cv_lockf_filelocking" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $amanda_cv_lockf_filelocking" >&5
+$as_echo "$amanda_cv_lockf_filelocking" >&6; }
     if test "x$amanda_cv_lockf_filelocking" = xyes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -21715,7 +23299,7 @@ cat >>confdefs.h <<\_ACEOF
 _ACEOF
 
        WANT_AMFLOCK_LOCKF="yes"
-       WORKING_FILE_LOCK="yes"
+       LOCKING="LOCKF"
     fi
      if test x"$WANT_AMFLOCK_LOCKF" = x"yes"; then
   WANT_AMFLOCK_LOCKF_TRUE=
 
 
     # check our homebrew hardlink-based locking (requires hardlinks)
-    { echo "$as_me:$LINENO: checking whether link(2) is available for locking" >&5
-echo $ECHO_N "checking whether link(2) is available for locking... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking whether link(2) is available for locking" >&5
+$as_echo_n "checking whether link(2) is available for locking... " >&6; }
 if test "${amanda_cv_lnlock_filelocking+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
            cat >conftest.$ac_ext <<_ACEOF
@@ -21760,23 +23344,26 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
 
        amanda_cv_lnlock_filelocking="yes"
 
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
@@ -21784,12 +23371,13 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 
 fi
-{ echo "$as_me:$LINENO: result: $amanda_cv_lnlock_filelocking" >&5
-echo "${ECHO_T}$amanda_cv_lnlock_filelocking" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $amanda_cv_lnlock_filelocking" >&5
+$as_echo "$amanda_cv_lnlock_filelocking" >&6; }
     if test "x$amanda_cv_lnlock_filelocking" = xyes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -21797,7 +23385,7 @@ cat >>confdefs.h <<\_ACEOF
 _ACEOF
 
        WANT_AMFLOCK_LNLOCK="yes"
-       WORKING_FILE_LOCK="yes"
+       LOCKING="LNLOCK"
     fi
      if test x"$WANT_AMFLOCK_LNLOCK" = x"yes"; then
   WANT_AMFLOCK_LNLOCK_TRUE=
@@ -21808,23 +23396,25 @@ else
 fi
 
 
-    if test x"$WORKING_FILE_LOCK" = "no"; then
+    if test x"$LOCKING" = "no"; then
        # this shouldn't happen, and is *bad* if it does
-       { { echo "$as_me:$LINENO: error: *** No working file locking capability found!" >&5
-echo "$as_me: error: *** No working file locking capability found!" >&2;}
+       { { $as_echo "$as_me:$LINENO: error: *** No working file locking capability found!" >&5
+$as_echo "$as_me: error: *** No working file locking capability found!" >&2;}
    { (exit 1); exit 1; }; }
     fi
 
 
 
+
+
     for ac_prog in swig
 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; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_SWIG+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $SWIG in
   [\\/]* | ?:[\\/]*)
@@ -21839,7 +23429,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_SWIG="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -21851,11 +23441,11 @@ esac
 fi
 SWIG=$ac_cv_path_SWIG
 if test -n "$SWIG"; then
-  { echo "$as_me:$LINENO: result: $SWIG" >&5
-echo "${ECHO_T}$SWIG" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $SWIG" >&5
+$as_echo "$SWIG" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -21866,10 +23456,10 @@ done
 
         # Extract the first word of "swig", so it can be a program name with args.
 set dummy swig; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_SWIG+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $SWIG in
   [\\/]* | ?:[\\/]*)
@@ -21884,7 +23474,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_SWIG="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -21896,22 +23486,22 @@ esac
 fi
 SWIG=$ac_cv_path_SWIG
 if test -n "$SWIG"; then
-  { echo "$as_me:$LINENO: result: $SWIG" >&5
-echo "${ECHO_T}$SWIG" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $SWIG" >&5
+$as_echo "$SWIG" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
         if test -z "$SWIG" ; then
                 SWIG='echo "Error: SWIG is not installed. You should look at http://www.swig.org" ; false'
         elif test -n "1.3.28" ; then
-                { echo "$as_me:$LINENO: checking for SWIG version" >&5
-echo $ECHO_N "checking for SWIG version... $ECHO_C" >&6; }
+                { $as_echo "$as_me:$LINENO: checking for SWIG version" >&5
+$as_echo_n "checking for SWIG version... " >&6; }
                 swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`
-                { echo "$as_me:$LINENO: result: $swig_version" >&5
-echo "${ECHO_T}$swig_version" >&6; }
+                { $as_echo "$as_me:$LINENO: result: $swig_version" >&5
+$as_echo "$swig_version" >&6; }
                 if test -n "$swig_version" ; then
                         # Calculate the required version number components
                         required=1.3.28
@@ -21965,10 +23555,10 @@ echo "${ECHO_T}$swig_version" >&6; }
 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; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_PERL+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $PERL in
   [\\/]* | ?:[\\/]*)
@@ -21983,7 +23573,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -21995,11 +23585,11 @@ esac
 fi
 PERL=$ac_cv_path_PERL
 if test -n "$PERL"; then
-  { echo "$as_me:$LINENO: result: $PERL" >&5
-echo "${ECHO_T}$PERL" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $PERL" >&5
+$as_echo "$PERL" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -22011,10 +23601,10 @@ done
 if test -z "$PERL"; then
 # Extract the first word of "perl", so it can be a program name with args.
 set dummy perl; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_prog_PERL+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$PERL"; then
   ac_cv_prog_PERL="$PERL" # Let the user override the test.
@@ -22027,7 +23617,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_PERL="perl"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 fi
 PERL=$ac_cv_prog_PERL
 if test -n "$PERL"; then
-  { echo "$as_me:$LINENO: result: $PERL" >&5
-echo "${ECHO_T}$PERL" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $PERL" >&5
+$as_echo "$PERL" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
 ac_perl_version="5.6.0"
 
 if test "x$PERL" != "x"; then
-  { echo "$as_me:$LINENO: checking for perl version greater than or equal to $ac_perl_version" >&5
-echo $ECHO_N "checking for perl version greater than or equal to $ac_perl_version... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for perl version greater than or equal to $ac_perl_version" >&5
+$as_echo_n "checking for perl version greater than or equal to $ac_perl_version... " >&6; }
   # NB: It would be nice to log the error if there is one, but we cannot rely
   # on autoconf internals
   $PERL -e "use $ac_perl_version;" > /dev/null 2>&1
   if test $? -ne 0; then
-    { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; };
+    { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; };
 
-       { { echo "$as_me:$LINENO: error: Amanda requires at least perl 5.6.0" >&5
-echo "$as_me: error: Amanda requires at least perl 5.6.0" >&2;}
+       { { $as_echo "$as_me:$LINENO: error: Amanda requires at least perl 5.6.0" >&5
+$as_echo "$as_me: error: Amanda requires at least perl 5.6.0" >&2;}
    { (exit 1); exit 1; }; }
 
   else
-    { echo "$as_me:$LINENO: result: ok" >&5
-echo "${ECHO_T}ok" >&6; };
+    { $as_echo "$as_me:$LINENO: result: ok" >&5
+$as_echo "ok" >&6; };
 
   fi
 else
-  { echo "$as_me:$LINENO: WARNING: could not find perl" >&5
-echo "$as_me: WARNING: could not find perl" >&2;}
+  { $as_echo "$as_me:$LINENO: WARNING: could not find perl" >&5
+$as_echo "$as_me: WARNING: could not find perl" >&2;}
 fi
 
 
     # If we want cygwin to copy ddl to modules directory.
     WANT_CYGWIN_COPY_PERL_DLL="false"
 
+    # test for ExtUtils::Embed
+    ac_perl_list_modules="ExtUtils::Embed 0.0"
+# Make sure we have perl
+if test -z "$PERL"; then
+# Extract the first word of "perl", so it can be a program name with args.
+set dummy perl; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_PERL+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$PERL"; then
+  ac_cv_prog_PERL="$PERL" # 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_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_PERL="perl"
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+PERL=$ac_cv_prog_PERL
+if test -n "$PERL"; then
+  { $as_echo "$as_me:$LINENO: result: $PERL" >&5
+$as_echo "$PERL" >&6; }
+else
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+
+# Check the number of arguments
+args_num=`echo $ac_perl_list_modules | wc -w`
+let "ckeck_args = $args_num % 2"
+if test "$check_args" = "1" ; then
+  { { $as_echo "$as_me:$LINENO: error: syntax error" >&5
+$as_echo "$as_me: error: syntax error" >&2;}
+   { (exit 1); exit 1; }; }
+else
+  eval
+fi
+
+if test "x$PERL" != x; then
+  ac_failed=0
+  while test ${#ac_perl_list_modules} -gt 2 ; do
+       module_name=`echo $ac_perl_list_modules | cut -d " " -f 1`
+       module_version=`echo $ac_perl_list_modules | cut -d " " -f 2`
+       ac_perl_list_modules=`echo $ac_perl_list_modules | cut -d " " -f 3-`
+       { $as_echo "$as_me:$LINENO: checking for perl module $module_name version $module_version" >&5
+$as_echo_n "checking for perl module $module_name version $module_version... " >&6; }
+
+       $PERL "-M$module_name" -e exit > /dev/null 2>&1
+       if test $? -ne 0; then
+         { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; };
+         ac_failed=1
+         ac_perl_list_modules=""
+       else
+         version=`$PERL "-M$module_name" -e 'print $'"$module_name::VERSION" 2>&1`
+         $PERL -e 'exit(shift cmp shift)' "$version" "$module_version"
+         if test $? -eq 0 -o $? -eq 1 ; then
+           { $as_echo "$as_me:$LINENO: result: ok" >&5
+$as_echo "ok" >&6; };
+         else
+           { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+           ac_failed=1
+           ac_perl_list_modules=""
+         fi
+       fi;
+  done
+
+  if test "$ac_failed" = 0; then
+    :
+
+  else
+    :
+
+       { { $as_echo "$as_me:$LINENO: error: *** Amanda requires the perl package ExtUtils::Embed to build its perl modules" >&5
+$as_echo "$as_me: error: *** Amanda requires the perl package ExtUtils::Embed to build its perl modules" >&2;}
+   { (exit 1); exit 1; }; }
+
+  fi
+else
+  { { $as_echo "$as_me:$LINENO: error: could not find perl" >&5
+$as_echo "$as_me: error: could not find perl" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
     # get the include path for building perl extensions
     PERL_INC=`$PERL -MExtUtils::Embed -e perl_inc`
 
 
     if test x"$enable_shared" = x"no"; then
-       { { echo "$as_me:$LINENO: error: *** Amanda cannot be compiled without shared-library support (do not use --disable-shared)" >&5
-echo "$as_me: error: *** Amanda cannot be compiled without shared-library support (do not use --disable-shared)" >&2;}
+       { { $as_echo "$as_me:$LINENO: error: *** Amanda cannot be compiled without shared-library support (do not use --disable-shared)" >&5
+$as_echo "$as_me: error: *** Amanda cannot be compiled without shared-library support (do not use --disable-shared)" >&2;}
    { (exit 1); exit 1; }; }
     fi
 
@@ -22143,8 +23834,8 @@ fi
 if test "${with_perlextlibs+set}" = set; then
   withval=$with_perlextlibs;
            case "$withval" in
-               y|ye|yes) { { echo "$as_me:$LINENO: error: *** You must specify a value for --with-perlextlibs" >&5
-echo "$as_me: error: *** You must specify a value for --with-perlextlibs" >&2;}
+               y|ye|yes) { { $as_echo "$as_me:$LINENO: error: *** You must specify a value for --with-perlextlibs" >&5
+$as_echo "$as_me: error: *** You must specify a value for --with-perlextlibs" >&2;}
    { (exit 1); exit 1; }; };;
                n|no) PERLEXTLIBS='';;
                *) PERLEXTLIBS="$withval" ;;
 
     # Extract the first word of "cat", so it can be a program name with args.
 set dummy cat; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_CAT+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $CAT in
   [\\/]* | ?:[\\/]*)
@@ -22176,7 +23867,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_CAT="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -22189,11 +23880,11 @@ esac
 fi
 CAT=$ac_cv_path_CAT
 if test -n "$CAT"; then
-  { echo "$as_me:$LINENO: result: $CAT" >&5
-echo "${ECHO_T}$CAT" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $CAT" >&5
+$as_echo "$CAT" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
 
 
 
+    HAVE_GZIP=
     if test "$GZIP"; then
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_GZIP 1
 _ACEOF
 
+       HAVE_GZIP=1
        COMPRESS_PATH="$GZIP"
        COMPRESS_SUFFIX=".gz"
        COMPRESS_FAST_OPT="--fast"
@@ -22230,8 +23923,8 @@ _ACEOF
            # XXX is the above true? --dustin
 
 
-    { echo "$as_me:$LINENO: WARNING: Cannot find either gzip or compress.  Using cat." >&5
-echo "$as_me: WARNING: Cannot find either gzip or compress.  Using cat." >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: Cannot find either gzip or compress.  Using cat." >&5
+$as_echo "$as_me: WARNING: Cannot find either gzip or compress.  Using cat." >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
@@ -22279,14 +23972,22 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
+
+
+
+
+
+
+
+
     # Empty GZIP so that make dist works.
     GZIP=
 
 
-    { echo "$as_me:$LINENO: checking if sockaddr_storage struct exists" >&5
-echo $ECHO_N "checking if sockaddr_storage struct exists... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking if sockaddr_storage struct exists" >&5
+$as_echo_n "checking if sockaddr_storage struct exists... " >&6; }
 if test "${ac_cv_has_sockaddr_storage+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
        cat >conftest.$ac_ext <<_ACEOF
@@ -22312,20 +24013,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_has_sockaddr_storage=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_has_sockaddr_storage=no
@@ -22334,8 +24036,8 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_has_sockaddr_storage" >&5
-echo "${ECHO_T}$ac_cv_has_sockaddr_storage" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_has_sockaddr_storage" >&5
+$as_echo "$ac_cv_has_sockaddr_storage" >&6; }
 
     if test $ac_cv_has_sockaddr_storage = yes ; then
 
@@ -22357,8 +24059,8 @@ if test "${with_ipv6+set}" = set; then
            y | ye | yes) amanda_with_ipv6=yes;;
            n | no) amanda_with_ipv6=no;;
            *)
-               { { echo "$as_me:$LINENO: error: *** You must not supply an argument to --with-ipv6 option." >&5
-echo "$as_me: error: *** You must not supply an argument to --with-ipv6 option." >&2;}
+               { { $as_echo "$as_me:$LINENO: error: *** You must not supply an argument to --with-ipv6 option." >&5
+$as_echo "$as_me: error: *** You must not supply an argument to --with-ipv6 option." >&2;}
    { (exit 1); exit 1; }; }
              ;;
            esac
 
     if test x"$amanda_with_ipv6" = x"yes" ||
        test x"$amanda_with_ipv6" = x"maybe" ; then
-       { echo "$as_me:$LINENO: checking for working IPv6" >&5
-echo $ECHO_N "checking for working IPv6... $ECHO_C" >&6; }
+       { $as_echo "$as_me:$LINENO: checking for working IPv6" >&5
+$as_echo_n "checking for working IPv6... " >&6; }
 if test "${amanda_cv_working_ipv6+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
            case "$target" in
@@ -22420,29 +24122,32 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
    amanda_cv_working_ipv6=yes
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
  amanda_cv_working_ipv6=no
 fi
+rm -rf conftest.dSYM
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 
@@ -22450,8 +24155,8 @@ fi
            esac
 
 fi
-{ echo "$as_me:$LINENO: result: $amanda_cv_working_ipv6" >&5
-echo "${ECHO_T}$amanda_cv_working_ipv6" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $amanda_cv_working_ipv6" >&5
+$as_echo "$amanda_cv_working_ipv6" >&6; }
 
        if test "$amanda_cv_working_ipv6" = yes; then
            WORKING_IPV6=yes
@@ -22463,8 +24168,8 @@ _ACEOF
        else
            # error out only if the user specifically requested support
            if test x"$amanda_with_ipv6" = x"yes"; then
-               { { echo "$as_me:$LINENO: error: IPv6 support was requested, but it is not working." >&5
-echo "$as_me: error: IPv6 support was requested, but it is not working." >&2;}
+               { { $as_echo "$as_me:$LINENO: error: IPv6 support was requested, but it is not working." >&5
+$as_echo "$as_me: error: IPv6 support was requested, but it is not working." >&2;}
    { (exit 1); exit 1; }; }
            fi
        fi
@@ -22478,8 +24183,8 @@ if test "${with_mmap+set}" = set; then
   withval=$with_mmap;
            case "$FORCE_MMAP" in
                y | ye | yes | n | no) : ;;
-               *) { { echo "$as_me:$LINENO: error: *** You must not supply an argument to --with-mmap." >&5
-echo "$as_me: error: *** You must not supply an argument to --with-mmap." >&2;}
+               *) { { $as_echo "$as_me:$LINENO: error: *** You must not supply an argument to --with-mmap." >&5
+$as_echo "$as_me: error: *** You must not supply an argument to --with-mmap." >&2;}
    { (exit 1); exit 1; }; } ;;
            esac
            FORCE_MMAP=$withval
@@ -22498,20 +24203,21 @@ for ac_header in \
            sys/mman.h \
 
 do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+as_ac_Header=`$as_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; }
+  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -22527,32 +24233,33 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -22566,69 +24273,73 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
         test ! -s conftest.err
        }; then
   ac_header_preproc=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&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; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
 
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
+as_val=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -22640,20 +24351,21 @@ done
 
 for ac_header in stdlib.h unistd.h
 do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+as_ac_Header=`$as_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; }
+  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -22669,32 +24381,33 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -22708,69 +24421,73 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
         test ! -s conftest.err
        }; then
   ac_header_preproc=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&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; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
 
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
+as_val=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -22780,11 +24497,11 @@ done
 
 for ac_func in getpagesize
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -22837,44 +24554,51 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
 fi
 done
 
-{ echo "$as_me:$LINENO: checking for working mmap" >&5
-echo $ECHO_N "checking for working mmap... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for working mmap" >&5
+$as_echo_n "checking for working mmap... " >&6; }
 if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test "$cross_compiling" = yes; then
   ac_cv_func_mmap_fixed_mapped=no
@@ -23018,36 +24742,39 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_func_mmap_fixed_mapped=yes
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
 ac_cv_func_mmap_fixed_mapped=no
 fi
+rm -rf conftest.dSYM
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5
-echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5
+$as_echo "$ac_cv_func_mmap_fixed_mapped" >&6; }
 if test $ac_cv_func_mmap_fixed_mapped = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -23061,11 +24788,11 @@ rm -f conftest.mmap
 
 for ac_func in shmget
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -23118,35 +24845,42 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
 
@@ -23158,20 +24892,21 @@ for ac_header in sys/types.h \
            sys/shm.h \
 
 do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+as_ac_Header=`$as_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; }
+  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -23187,32 +24922,33 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -23226,69 +24962,73 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
         test ! -s conftest.err
        }; then
   ac_header_preproc=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&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; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
 
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
+as_val=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
 done
 
 
-       { echo "$as_me:$LINENO: checking for shmdt() argument type" >&5
-echo $ECHO_N "checking for shmdt() argument type... $ECHO_C" >&6; }
+       { $as_echo "$as_me:$LINENO: checking for shmdt() argument type" >&5
+$as_echo_n "checking for shmdt() argument type... " >&6; }
 if test "${amanda_cv_shmdt_arg_type+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
                if test "$ac_cv_func_shmget" = yes; then
@@ -23340,8 +25080,8 @@ EOF
 
 
 fi
-{ echo "$as_me:$LINENO: result: $amanda_cv_shmdt_arg_type" >&5
-echo "${ECHO_T}$amanda_cv_shmdt_arg_type" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $amanda_cv_shmdt_arg_type" >&5
+$as_echo "$amanda_cv_shmdt_arg_type" >&6; }
 
 cat >>confdefs.h <<_ACEOF
 #define SHM_ARG_TYPE $amanda_cv_shmdt_arg_type
@@ -23368,11 +25108,11 @@ ice_have_shmat=no
 
 for ac_func in shmat
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -23425,45 +25165,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_shmat=yes
 fi
 done
 
 if test "${ice_have_shmat}" = yes; then
-{ echo "$as_me:$LINENO: checking for shmat declaration in sys/types.h sys/ipc.h sys/shm.h" >&5
-echo $ECHO_N "checking for shmat declaration in sys/types.h sys/ipc.h sys/shm.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for shmat declaration in sys/types.h sys/ipc.h sys/shm.h" >&5
+$as_echo_n "checking for shmat declaration in sys/types.h sys/ipc.h sys/shm.h... " >&6; }
 if test "${ice_cv_have_shmat_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_shmat_decl=no
@@ -23512,8 +25259,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_shmat_decl" >&5
-echo "${ECHO_T}$ice_cv_have_shmat_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_shmat_decl" >&5
+$as_echo "$ice_cv_have_shmat_decl" >&6; }
 if test "$ice_cv_have_shmat_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -23528,11 +25275,11 @@ ice_have_shmctl=no
 
 for ac_func in shmctl
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -23585,45 +25332,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_shmctl=yes
 fi
 done
 
 if test "${ice_have_shmctl}" = yes; then
-{ echo "$as_me:$LINENO: checking for shmctl declaration in sys/types.h sys/ipc.h sys/shm.h" >&5
-echo $ECHO_N "checking for shmctl declaration in sys/types.h sys/ipc.h sys/shm.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for shmctl declaration in sys/types.h sys/ipc.h sys/shm.h" >&5
+$as_echo_n "checking for shmctl declaration in sys/types.h sys/ipc.h sys/shm.h... " >&6; }
 if test "${ice_cv_have_shmctl_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_shmctl_decl=no
@@ -23672,8 +25426,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_shmctl_decl" >&5
-echo "${ECHO_T}$ice_cv_have_shmctl_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_shmctl_decl" >&5
+$as_echo "$ice_cv_have_shmctl_decl" >&6; }
 if test "$ice_cv_have_shmctl_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -23688,11 +25442,11 @@ ice_have_shmdt=no
 
 for ac_func in shmdt
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -23745,45 +25499,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_shmdt=yes
 fi
 done
 
 if test "${ice_have_shmdt}" = yes; then
-{ echo "$as_me:$LINENO: checking for shmdt declaration in sys/types.h sys/ipc.h sys/shm.h" >&5
-echo $ECHO_N "checking for shmdt declaration in sys/types.h sys/ipc.h sys/shm.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for shmdt declaration in sys/types.h sys/ipc.h sys/shm.h" >&5
+$as_echo_n "checking for shmdt declaration in sys/types.h sys/ipc.h sys/shm.h... " >&6; }
 if test "${ice_cv_have_shmdt_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_shmdt_decl=no
@@ -23832,8 +25593,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_shmdt_decl" >&5
-echo "${ECHO_T}$ice_cv_have_shmdt_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_shmdt_decl" >&5
+$as_echo "$ice_cv_have_shmdt_decl" >&6; }
 if test "$ice_cv_have_shmdt_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -23848,11 +25609,11 @@ ice_have_shmget=no
 
 for ac_func in shmget
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -23905,45 +25666,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_shmget=yes
 fi
 done
 
 if test "${ice_have_shmget}" = yes; then
-{ echo "$as_me:$LINENO: checking for shmget declaration in sys/types.h sys/ipc.h sys/shm.h" >&5
-echo $ECHO_N "checking for shmget declaration in sys/types.h sys/ipc.h sys/shm.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for shmget declaration in sys/types.h sys/ipc.h sys/shm.h" >&5
+$as_echo_n "checking for shmget declaration in sys/types.h sys/ipc.h sys/shm.h... " >&6; }
 if test "${ice_cv_have_shmget_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_shmget_decl=no
@@ -23992,8 +25760,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_shmget_decl" >&5
-echo "${ECHO_T}$ice_cv_have_shmget_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_shmget_decl" >&5
+$as_echo "$ice_cv_have_shmget_decl" >&6; }
 if test "$ice_cv_have_shmget_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -24009,8 +25777,8 @@ fi
        n | no)
            if test "x$ac_cv_func_shmget" != xyes; then
 
-    { echo "$as_me:$LINENO: WARNING: Neither shmget() nor mmap() found. This system will not support the Amanda server." >&5
-echo "$as_me: WARNING: Neither shmget() nor mmap() found. This system will not support the Amanda server." >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: Neither shmget() nor mmap() found. This system will not support the Amanda server." >&5
+$as_echo "$as_me: WARNING: Neither shmget() nor mmap() found. This system will not support the Amanda server." >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
@@ -24023,8 +25791,8 @@ AAW_EOF
          ;;
        y | ye | yes)
 
-    { echo "$as_me:$LINENO: WARNING: --with-mmap used on a system with no mmap() support.  This system will not support the Amanda server." >&5
-echo "$as_me: WARNING: --with-mmap used on a system with no mmap() support.  This system will not support the Amanda server." >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: --with-mmap used on a system with no mmap() support.  This system will not support the Amanda server." >&5
+$as_echo "$as_me: WARNING: --with-mmap used on a system with no mmap() support.  This system will not support the Amanda server." >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
@@ -24045,11 +25813,11 @@ AAW_EOF
 
 ac_header_dirent=no
 for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
-  as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5
-echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6; }
+  as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5
+$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -24075,20 +25843,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   eval "$as_ac_Header=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_Header=no"
 
 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
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
 _ACEOF
 
 ac_header_dirent=$ac_hdr; break
 done
 # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
 if test $ac_header_dirent = dirent.h; then
-  { echo "$as_me:$LINENO: checking for library containing opendir" >&5
-echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for library containing opendir" >&5
+$as_echo_n "checking for library containing opendir... " >&6; }
 if test "${ac_cv_search_opendir+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_func_search_save_LIBS=$LIBS
 cat >conftest.$ac_ext <<_ACEOF
@@ -24151,26 +25923,30 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_search_opendir=$ac_res
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext
   if test "${ac_cv_search_opendir+set}" = set; then
@@ -24185,8 +25961,8 @@ fi
 rm conftest.$ac_ext
 LIBS=$ac_func_search_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
-echo "${ECHO_T}$ac_cv_search_opendir" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
+$as_echo "$ac_cv_search_opendir" >&6; }
 ac_res=$ac_cv_search_opendir
 if test "$ac_res" != no; then
   test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
@@ -24194,10 +25970,10 @@ if test "$ac_res" != no; then
 fi
 
 else
-  { echo "$as_me:$LINENO: checking for library containing opendir" >&5
-echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for library containing opendir" >&5
+$as_echo_n "checking for library containing opendir... " >&6; }
 if test "${ac_cv_search_opendir+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_func_search_save_LIBS=$LIBS
 cat >conftest.$ac_ext <<_ACEOF
@@ -24235,26 +26011,30 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_search_opendir=$ac_res
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext
   if test "${ac_cv_search_opendir+set}" = set; then
@@ -24269,8 +26049,8 @@ fi
 rm conftest.$ac_ext
 LIBS=$ac_func_search_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
-echo "${ECHO_T}$ac_cv_search_opendir" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
+$as_echo "$ac_cv_search_opendir" >&6; }
 ac_res=$ac_cv_search_opendir
 if test "$ac_res" != no; then
   test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
 
     # include the dirent headers as described in the autoconf documentation.
-    { echo "$as_me:$LINENO: checking whether readdir is declared" >&5
-echo $ECHO_N "checking whether readdir is declared... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking whether readdir is declared" >&5
+$as_echo_n "checking whether readdir is declared... " >&6; }
 if test "${ac_cv_have_decl_readdir+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -24328,20 +26108,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_have_decl_readdir=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_have_decl_readdir=no
@@ -24349,9 +26130,9 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_readdir" >&5
-echo "${ECHO_T}$ac_cv_have_decl_readdir" >&6; }
-if test $ac_cv_have_decl_readdir = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_readdir" >&5
+$as_echo "$ac_cv_have_decl_readdir" >&6; }
+if test "x$ac_cv_have_decl_readdir" = x""yes; then
 
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_READDIR 1
@@ -24365,10 +26146,10 @@ _ACEOF
 
 
 fi
-{ echo "$as_me:$LINENO: checking whether readdir_r is declared" >&5
-echo $ECHO_N "checking whether readdir_r is declared... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking whether readdir_r is declared" >&5
+$as_echo_n "checking whether readdir_r is declared... " >&6; }
 if test "${ac_cv_have_decl_readdir_r+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -24412,20 +26193,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_have_decl_readdir_r=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_have_decl_readdir_r=no
@@ -24433,9 +26215,9 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_readdir_r" >&5
-echo "${ECHO_T}$ac_cv_have_decl_readdir_r" >&6; }
-if test $ac_cv_have_decl_readdir_r = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_readdir_r" >&5
+$as_echo "$ac_cv_have_decl_readdir_r" >&6; }
+if test "x$ac_cv_have_decl_readdir_r" = x""yes; then
 
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_READDIR_R 1
@@ -24449,10 +26231,10 @@ _ACEOF
 
 
 fi
-{ echo "$as_me:$LINENO: checking whether readdir64 is declared" >&5
-echo $ECHO_N "checking whether readdir64 is declared... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking whether readdir64 is declared" >&5
+$as_echo_n "checking whether readdir64 is declared... " >&6; }
 if test "${ac_cv_have_decl_readdir64+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -24496,20 +26278,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_have_decl_readdir64=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_have_decl_readdir64=no
@@ -24517,9 +26300,9 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_readdir64" >&5
-echo "${ECHO_T}$ac_cv_have_decl_readdir64" >&6; }
-if test $ac_cv_have_decl_readdir64 = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_readdir64" >&5
+$as_echo "$ac_cv_have_decl_readdir64" >&6; }
+if test "x$ac_cv_have_decl_readdir64" = x""yes; then
 
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_READDIR64 1
@@ -24533,10 +26316,10 @@ _ACEOF
 
 
 fi
-{ echo "$as_me:$LINENO: checking whether readdir64_r is declared" >&5
-echo $ECHO_N "checking whether readdir64_r is declared... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking whether readdir64_r is declared" >&5
+$as_echo_n "checking whether readdir64_r is declared... " >&6; }
 if test "${ac_cv_have_decl_readdir64_r+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -24580,20 +26363,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_have_decl_readdir64_r=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_have_decl_readdir64_r=no
@@ -24601,9 +26385,9 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_readdir64_r" >&5
-echo "${ECHO_T}$ac_cv_have_decl_readdir64_r" >&6; }
-if test $ac_cv_have_decl_readdir64_r = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_readdir64_r" >&5
+$as_echo "$ac_cv_have_decl_readdir64_r" >&6; }
+if test "x$ac_cv_have_decl_readdir64_r" = x""yes; then
 
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_READDIR64_R 1
@@ -24622,8 +26406,8 @@ fi
 
 
     # disk device prefixes
-    { echo "$as_me:$LINENO: checking disk device prefixes" >&5
-echo $ECHO_N "checking disk device prefixes... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking disk device prefixes" >&5
+$as_echo_n "checking disk device prefixes... " >&6; }
 
     # Use df to find the mount point for the root filesystem.  Use
     # the positional parameters to find the particular line from df
@@ -24662,8 +26446,8 @@ echo $ECHO_N "checking disk device prefixes... $ECHO_C" >&6; }
            case $mount in
                /dev/vg*)
 
-    { echo "$as_me:$LINENO: WARNING: Run amhpfixdevs on HP-UX systems using /dev/vg??." >&5
-echo "$as_me: WARNING: Run amhpfixdevs on HP-UX systems using /dev/vg??." >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: Run amhpfixdevs on HP-UX systems using /dev/vg??." >&5
+$as_echo "$as_me: WARNING: Run amhpfixdevs on HP-UX systems using /dev/vg??." >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
@@ -24680,8 +26464,8 @@ AAW_EOF
            CLIENT_SCRIPTS_OPT=amsinixfixdevs
            if ! test -d /dev/dsk; then
 
-    { echo "$as_me:$LINENO: WARNING: Run amsinixfixdevs on Sinix systems using VxFS." >&5
-echo "$as_me: WARNING: Run amsinixfixdevs on Sinix systems using VxFS." >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: Run amsinixfixdevs on Sinix systems using VxFS." >&5
+$as_echo "$as_me: WARNING: Run amsinixfixdevs on Sinix systems using VxFS." >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
@@ -24701,8 +26485,8 @@ AAW_EOF
     esac
 
     if test "$DEV_PREFIX" && test "$RDEV_PREFIX"; then
-       { echo "$as_me:$LINENO: result: (predefined) $DEV_PREFIX - $RDEV_PREFIX" >&5
-echo "${ECHO_T}(predefined) $DEV_PREFIX - $RDEV_PREFIX" >&6; }
+       { $as_echo "$as_me:$LINENO: result: (predefined) $DEV_PREFIX - $RDEV_PREFIX" >&5
+$as_echo "(predefined) $DEV_PREFIX - $RDEV_PREFIX" >&6; }
     else
        if test -d /dev/dsk; then
            DEV_PREFIX=/dev/dsk/
@@ -24733,8 +26517,8 @@ echo "${ECHO_T}(predefined) $DEV_PREFIX - $RDEV_PREFIX" >&6; }
            DEV_PREFIX=/
            RDEV_PREFIX=/
        fi
-       { echo "$as_me:$LINENO: result: $DEV_PREFIX - $RDEV_PREFIX" >&5
-echo "${ECHO_T}$DEV_PREFIX - $RDEV_PREFIX" >&6; }
+       { $as_echo "$as_me:$LINENO: result: $DEV_PREFIX - $RDEV_PREFIX" >&5
+$as_echo "$DEV_PREFIX - $RDEV_PREFIX" >&6; }
     fi
 
 
@@ -24799,8 +26583,8 @@ _ACEOF
         *-sgi-irix3*)
                    # The old cc won't work!
                    if test "x$GCC" != "xyes"; then
-                       { { echo "$as_me:$LINENO: error: The old SGI IRIX compiler ($CC) will not compile Amanda; use CC=gcc" >&5
-echo "$as_me: error: The old SGI IRIX compiler ($CC) will not compile Amanda; use CC=gcc" >&2;}
+                       { { $as_echo "$as_me:$LINENO: error: The old SGI IRIX compiler ($CC) will not compile Amanda; use CC=gcc" >&5
+$as_echo "$as_me: error: The old SGI IRIX compiler ($CC) will not compile Amanda; use CC=gcc" >&2;}
    { (exit 1); exit 1; }; }
                    fi
                    ;;
@@ -25064,25 +26848,55 @@ _ACEOF
   test "$exec_prefix_NONE" && exec_prefix=NONE
 
 
-    DUMPER_DIR='${amlibexecdir}/application'
+    APPLICATION_DIR='${amlibexecdir}/application'
+
+  prefix_NONE=
+  exec_prefix_NONE=
+  test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
+  test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
+  eval ac_define_dir="\"$APPLICATION_DIR\""
+  eval ac_define_dir="\"$ac_define_dir\""
+  APPLICATION_DIR="$ac_define_dir"
+
+
+cat >>confdefs.h <<_ACEOF
+#define APPLICATION_DIR "$ac_define_dir"
+_ACEOF
+
+  test "$prefix_NONE" && prefix=NONE
+  test "$exec_prefix_NONE" && exec_prefix=NONE
+
+
+
+# Check whether --with-amdatadir was given.
+if test "${with_amdatadir+set}" = set; then
+  withval=$with_amdatadir;
+           AMDATADIR=$withval
+
+else
+
+           AMDATADIR=$datadir/amanda
+
+
+fi
+
 
   prefix_NONE=
   exec_prefix_NONE=
   test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
   test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
-  eval ac_define_dir="\"$DUMPER_DIR\""
+  eval ac_define_dir="\"$AMDATADIR\""
   eval ac_define_dir="\"$ac_define_dir\""
-  DUMPER_DIR="$ac_define_dir"
+  amdatadir="$ac_define_dir"
 
 
 cat >>confdefs.h <<_ACEOF
-#define DUMPER_DIR "$ac_define_dir"
+#define amdatadir "$ac_define_dir"
 _ACEOF
 
   test "$prefix_NONE" && prefix=NONE
   test "$exec_prefix_NONE" && exec_prefix=NONE
 
-    # TODO: rename to APPLICATION_DIR, add to Amanda::Paths and 'amgtconf build.APPLICATION_DIR'
 
 
 #
@@ -25091,10 +26905,10 @@ _ACEOF
 
     # FreeBSD needs to link libxpg4
 
-{ echo "$as_me:$LINENO: checking for setlocale in -lxpg4" >&5
-echo $ECHO_N "checking for setlocale in -lxpg4... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for setlocale in -lxpg4" >&5
+$as_echo_n "checking for setlocale in -lxpg4... " >&6; }
 if test "${ac_cv_lib_xpg4_setlocale+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lxpg4  $LIBS"
@@ -25126,33 +26940,37 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_xpg4_setlocale=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_xpg4_setlocale=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_xpg4_setlocale" >&5
-echo "${ECHO_T}$ac_cv_lib_xpg4_setlocale" >&6; }
-if test $ac_cv_lib_xpg4_setlocale = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_xpg4_setlocale" >&5
+$as_echo "$ac_cv_lib_xpg4_setlocale" >&6; }
+if test "x$ac_cv_lib_xpg4_setlocale" = x""yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBXPG4 1
 _ACEOF
 
     # Extract the first word of "msgfmt", so it can be a program name with args.
 set dummy msgfmt; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_MSGFMT+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $MSGFMT in
   [\\/]* | ?:[\\/]*)
@@ -25189,7 +27007,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_MSGFMT="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -25201,20 +27019,20 @@ esac
 fi
 MSGFMT=$ac_cv_path_MSGFMT
 if test -n "$MSGFMT"; then
-  { echo "$as_me:$LINENO: result: $MSGFMT" >&5
-echo "${ECHO_T}$MSGFMT" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $MSGFMT" >&5
+$as_echo "$MSGFMT" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
     # Extract the first word of "gettext", so it can be a program name with args.
 set dummy gettext; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_GETTEXT+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $GETTEXT in
   [\\/]* | ?:[\\/]*)
@@ -25229,7 +27047,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_GETTEXT="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -25241,19 +27059,19 @@ esac
 fi
 GETTEXT=$ac_cv_path_GETTEXT
 if test -n "$GETTEXT"; then
-  { echo "$as_me:$LINENO: result: $GETTEXT" >&5
-echo "${ECHO_T}$GETTEXT" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $GETTEXT" >&5
+$as_echo "$GETTEXT" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
 
 
 
-  { echo "$as_me:$LINENO: checking whether NLS is requested" >&5
-echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking whether NLS is requested" >&5
+$as_echo_n "checking whether NLS is requested... " >&6; }
     # Check whether --enable-nls was given.
 if test "${enable_nls+set}" = set; then
   enableval=$enable_nls; USE_NLS=$enableval
@@ -25261,8 +27079,8 @@ else
   USE_NLS=yes
 fi
 
-  { echo "$as_me:$LINENO: result: $USE_NLS" >&5
-echo "${ECHO_T}$USE_NLS" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $USE_NLS" >&5
+$as_echo "$USE_NLS" >&6; }
 
 
 
@@ -25299,10 +27117,10 @@ rm -f conf$$.file
 
 # Extract the first word of "msgfmt", so it can be a program name with args.
 set dummy msgfmt; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_MSGFMT+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case "$MSGFMT" in
   [\\/]* | ?:[\\/]*)
@@ -25331,19 +27149,19 @@ esac
 fi
 MSGFMT="$ac_cv_path_MSGFMT"
 if test "$MSGFMT" != ":"; then
-  { echo "$as_me:$LINENO: result: $MSGFMT" >&5
-echo "${ECHO_T}$MSGFMT" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $MSGFMT" >&5
+$as_echo "$MSGFMT" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
   # Extract the first word of "gmsgfmt", so it can be a program name with args.
 set dummy gmsgfmt; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_GMSGFMT+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $GMSGFMT in
   [\\/]* | ?:[\\/]*)
@@ -25358,7 +27176,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -25371,11 +27189,11 @@ esac
 fi
 GMSGFMT=$ac_cv_path_GMSGFMT
 if test -n "$GMSGFMT"; then
-  { echo "$as_me:$LINENO: result: $GMSGFMT" >&5
-echo "${ECHO_T}$GMSGFMT" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $GMSGFMT" >&5
+$as_echo "$GMSGFMT" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -25422,10 +27240,10 @@ rm -f conf$$.file
 
 # Extract the first word of "xgettext", so it can be a program name with args.
 set dummy xgettext; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_XGETTEXT+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case "$XGETTEXT" in
   [\\/]* | ?:[\\/]*)
@@ -25454,11 +27272,11 @@ esac
 fi
 XGETTEXT="$ac_cv_path_XGETTEXT"
 if test "$XGETTEXT" != ":"; then
-  { echo "$as_me:$LINENO: result: $XGETTEXT" >&5
-echo "${ECHO_T}$XGETTEXT" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $XGETTEXT" >&5
+$as_echo "$XGETTEXT" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
     rm -f messages.po
@@ -25500,10 +27318,10 @@ rm -f conf$$.file
 
 # Extract the first word of "msgmerge", so it can be a program name with args.
 set dummy msgmerge; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_MSGMERGE+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case "$MSGMERGE" in
   [\\/]* | ?:[\\/]*)
@@ -25531,11 +27349,11 @@ esac
 fi
 MSGMERGE="$ac_cv_path_MSGMERGE"
 if test "$MSGMERGE" != ":"; then
-  { echo "$as_me:$LINENO: result: $MSGMERGE" >&5
-echo "${ECHO_T}$MSGMERGE" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $MSGMERGE" >&5
+$as_echo "$MSGMERGE" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
 
 
 
-    { echo "$as_me:$LINENO: checking for CFPreferencesCopyAppValue" >&5
-echo $ECHO_N "checking for CFPreferencesCopyAppValue... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for CFPreferencesCopyAppValue" >&5
+$as_echo_n "checking for CFPreferencesCopyAppValue... " >&6; }
 if test "${gt_cv_func_CFPreferencesCopyAppValue+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   gt_save_LIBS="$LIBS"
      LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
@@ -25973,32 +27791,36 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   gt_cv_func_CFPreferencesCopyAppValue=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        gt_cv_func_CFPreferencesCopyAppValue=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
      LIBS="$gt_save_LIBS"
 fi
-{ echo "$as_me:$LINENO: result: $gt_cv_func_CFPreferencesCopyAppValue" >&5
-echo "${ECHO_T}$gt_cv_func_CFPreferencesCopyAppValue" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gt_cv_func_CFPreferencesCopyAppValue" >&5
+$as_echo "$gt_cv_func_CFPreferencesCopyAppValue" >&6; }
   if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -26006,10 +27828,10 @@ cat >>confdefs.h <<\_ACEOF
 _ACEOF
 
   fi
-    { echo "$as_me:$LINENO: checking for CFLocaleCopyCurrent" >&5
-echo $ECHO_N "checking for CFLocaleCopyCurrent... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for CFLocaleCopyCurrent" >&5
+$as_echo_n "checking for CFLocaleCopyCurrent... " >&6; }
 if test "${gt_cv_func_CFLocaleCopyCurrent+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   gt_save_LIBS="$LIBS"
      LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
@@ -26034,32 +27856,36 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   gt_cv_func_CFLocaleCopyCurrent=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        gt_cv_func_CFLocaleCopyCurrent=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
      LIBS="$gt_save_LIBS"
 fi
-{ echo "$as_me:$LINENO: result: $gt_cv_func_CFLocaleCopyCurrent" >&5
-echo "${ECHO_T}$gt_cv_func_CFLocaleCopyCurrent" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gt_cv_func_CFLocaleCopyCurrent" >&5
+$as_echo "$gt_cv_func_CFLocaleCopyCurrent" >&6; }
   if test $gt_cv_func_CFLocaleCopyCurrent = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -26089,10 +27915,10 @@ _ACEOF
 
 
 
-        { echo "$as_me:$LINENO: checking for GNU gettext in libc" >&5
-echo $ECHO_N "checking for GNU gettext in libc... $ECHO_C" >&6; }
+        { $as_echo "$as_me:$LINENO: checking for GNU gettext in libc" >&5
+$as_echo_n "checking for GNU gettext in libc... " >&6; }
 if test "${gt_cv_func_gnugettext1_libc+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -26118,31 +27944,35 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   gt_cv_func_gnugettext1_libc=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        gt_cv_func_gnugettext1_libc=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext1_libc" >&5
-echo "${ECHO_T}$gt_cv_func_gnugettext1_libc" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext1_libc" >&5
+$as_echo "$gt_cv_func_gnugettext1_libc" >&6; }
 
         if test "$gt_cv_func_gnugettext1_libc" != "yes"; then
 
@@ -26175,10 +28005,10 @@ echo "${ECHO_T}$gt_cv_func_gnugettext1_libc" >&6; }
   done
 
 
-  { echo "$as_me:$LINENO: checking for iconv" >&5
-echo $ECHO_N "checking for iconv... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for iconv" >&5
+$as_echo_n "checking for iconv... " >&6; }
 if test "${am_cv_func_iconv+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
     am_cv_func_iconv="no, consider installing GNU libiconv"
@@ -26207,26 +28037,30 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   am_cv_func_iconv=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
     if test "$am_cv_func_iconv" != yes; then
@@ -26256,35 +28090,39 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   am_cv_lib_iconv=yes
         am_cv_func_iconv=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
       LIBS="$am_save_LIBS"
     fi
 
 fi
-{ echo "$as_me:$LINENO: result: $am_cv_func_iconv" >&5
-echo "${ECHO_T}$am_cv_func_iconv" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $am_cv_func_iconv" >&5
+$as_echo "$am_cv_func_iconv" >&6; }
   if test "$am_cv_func_iconv" = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -26293,10 +28131,10 @@ _ACEOF
 
   fi
   if test "$am_cv_lib_iconv" = yes; then
-    { echo "$as_me:$LINENO: checking how to link with libiconv" >&5
-echo $ECHO_N "checking how to link with libiconv... $ECHO_C" >&6; }
-    { echo "$as_me:$LINENO: result: $LIBICONV" >&5
-echo "${ECHO_T}$LIBICONV" >&6; }
+    { $as_echo "$as_me:$LINENO: checking how to link with libiconv" >&5
+$as_echo_n "checking how to link with libiconv... " >&6; }
+    { $as_echo "$as_me:$LINENO: result: $LIBICONV" >&5
+$as_echo "$LIBICONV" >&6; }
   else
             CPPFLAGS="$am_save_CPPFLAGS"
     LIBICONV=
     done
   fi
 
-          { echo "$as_me:$LINENO: checking for GNU gettext in libintl" >&5
-echo $ECHO_N "checking for GNU gettext in libintl... $ECHO_C" >&6; }
+          { $as_echo "$as_me:$LINENO: checking for GNU gettext in libintl" >&5
+$as_echo_n "checking for GNU gettext in libintl... " >&6; }
 if test "${gt_cv_func_gnugettext1_libintl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   gt_save_CPPFLAGS="$CPPFLAGS"
             CPPFLAGS="$CPPFLAGS $INCINTL"
@@ -26722,26 +28560,30 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   gt_cv_func_gnugettext1_libintl=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        gt_cv_func_gnugettext1_libintl=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
                         if test "$gt_cv_func_gnugettext1_libintl" != yes && test -n "$LIBICONV"; then
@@ -26774,37 +28616,41 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   LIBINTL="$LIBINTL $LIBICONV"
                 LTLIBINTL="$LTLIBINTL $LTLIBICONV"
                 gt_cv_func_gnugettext1_libintl=yes
 
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
             fi
             CPPFLAGS="$gt_save_CPPFLAGS"
             LIBS="$gt_save_LIBS"
 fi
-{ echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext1_libintl" >&5
-echo "${ECHO_T}$gt_cv_func_gnugettext1_libintl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $gt_cv_func_gnugettext1_libintl" >&5
+$as_echo "$gt_cv_func_gnugettext1_libintl" >&6; }
         fi
 
                                         if test "$gt_cv_func_gnugettext1_libc" = "yes" \
@@ -26840,13 +28686,13 @@ _ACEOF
     fi
   fi
 
-  { echo "$as_me:$LINENO: checking whether to use NLS" >&5
-echo $ECHO_N "checking whether to use NLS... $ECHO_C" >&6; }
-  { echo "$as_me:$LINENO: result: $USE_NLS" >&5
-echo "${ECHO_T}$USE_NLS" >&6; }
+  { $as_echo "$as_me:$LINENO: checking whether to use NLS" >&5
+$as_echo_n "checking whether to use NLS... " >&6; }
+  { $as_echo "$as_me:$LINENO: result: $USE_NLS" >&5
+$as_echo "$USE_NLS" >&6; }
   if test "$USE_NLS" = "yes"; then
-    { echo "$as_me:$LINENO: checking where the gettext function comes from" >&5
-echo $ECHO_N "checking where the gettext function comes from... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking where the gettext function comes from" >&5
+$as_echo_n "checking where the gettext function comes from... " >&6; }
     if test "$gt_use_preinstalled_gnugettext" = "yes"; then
       if test "$gt_cv_func_gnugettext1_libintl" = "yes"; then
         gt_source="external libintl"
@@ -26856,18 +28702,18 @@ echo $ECHO_N "checking where the gettext function comes from... $ECHO_C" >&6; }
     else
       gt_source="included intl directory"
     fi
-    { echo "$as_me:$LINENO: result: $gt_source" >&5
-echo "${ECHO_T}$gt_source" >&6; }
+    { $as_echo "$as_me:$LINENO: result: $gt_source" >&5
+$as_echo "$gt_source" >&6; }
   fi
 
   if test "$USE_NLS" = "yes"; then
 
     if test "$gt_use_preinstalled_gnugettext" = "yes"; then
       if test "$gt_cv_func_gnugettext1_libintl" = "yes"; then
-        { echo "$as_me:$LINENO: checking how to link with libintl" >&5
-echo $ECHO_N "checking how to link with libintl... $ECHO_C" >&6; }
-        { echo "$as_me:$LINENO: result: $LIBINTL" >&5
-echo "${ECHO_T}$LIBINTL" >&6; }
+        { $as_echo "$as_me:$LINENO: checking how to link with libintl" >&5
+$as_echo_n "checking how to link with libintl... " >&6; }
+        { $as_echo "$as_me:$LINENO: result: $LIBINTL" >&5
+$as_echo "$LIBINTL" >&6; }
 
   for element in $INCINTL; do
     haveit=
@@ -26929,10 +28775,10 @@ _ACEOF
         # translate them to -R flags, as required by the runtime linker.
         # Extract the first word of "curl-config", so it can be a program name with args.
 set dummy curl-config; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_CURL_CONFIG+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $CURL_CONFIG in
   [\\/]* | ?:[\\/]*)
@@ -26948,7 +28794,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_CURL_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -26960,11 +28806,11 @@ esac
 fi
 CURL_CONFIG=$ac_cv_path_CURL_CONFIG
 if test -n "$CURL_CONFIG"; then
-  { echo "$as_me:$LINENO: result: $CURL_CONFIG" >&5
-echo "${ECHO_T}$CURL_CONFIG" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $CURL_CONFIG" >&5
+$as_echo "$CURL_CONFIG" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
 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; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_prog_AWK+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$AWK"; then
   ac_cv_prog_AWK="$AWK" # Let the user override the test.
@@ -27047,7 +28893,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 fi
 AWK=$ac_cv_prog_AWK
 if test -n "$AWK"; then
-  { echo "$as_me:$LINENO: result: $AWK" >&5
-echo "${ECHO_T}$AWK" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -27079,10 +28925,10 @@ done
         _libcurl_ldflags="-L$withval/lib"
         # Extract the first word of "curl-config", so it can be a program name with args.
 set dummy curl-config; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path__libcurl_config+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $_libcurl_config in
   [\\/]* | ?:[\\/]*)
@@ -27097,7 +28943,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path__libcurl_config="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -27110,21 +28956,21 @@ esac
 fi
 _libcurl_config=$ac_cv_path__libcurl_config
 if test -n "$_libcurl_config"; then
-  { echo "$as_me:$LINENO: result: $_libcurl_config" >&5
-echo "${ECHO_T}$_libcurl_config" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $_libcurl_config" >&5
+$as_echo "$_libcurl_config" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
      else
         # Extract the first word of "curl-config", so it can be a program name with args.
 set dummy curl-config; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path__libcurl_config+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $_libcurl_config in
   [\\/]* | ?:[\\/]*)
@@ -27139,7 +28985,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path__libcurl_config="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -27151,35 +28997,35 @@ esac
 fi
 _libcurl_config=$ac_cv_path__libcurl_config
 if test -n "$_libcurl_config"; then
-  { echo "$as_me:$LINENO: result: $_libcurl_config" >&5
-echo "${ECHO_T}$_libcurl_config" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $_libcurl_config" >&5
+$as_echo "$_libcurl_config" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
      fi
 
      if test x$_libcurl_config != "x" ; then
-        { echo "$as_me:$LINENO: checking for the version of libcurl" >&5
-echo $ECHO_N "checking for the version of libcurl... $ECHO_C" >&6; }
+        { $as_echo "$as_me:$LINENO: checking for the version of libcurl" >&5
+$as_echo_n "checking for the version of libcurl... " >&6; }
 if test "${libcurl_cv_lib_curl_version+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   libcurl_cv_lib_curl_version=`$_libcurl_config --version | $AWK '{print $2}'`
 fi
-{ echo "$as_me:$LINENO: result: $libcurl_cv_lib_curl_version" >&5
-echo "${ECHO_T}$libcurl_cv_lib_curl_version" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $libcurl_cv_lib_curl_version" >&5
+$as_echo "$libcurl_cv_lib_curl_version" >&6; }
 
         _libcurl_version=`echo $libcurl_cv_lib_curl_version | $_libcurl_version_parse`
         _libcurl_wanted=`echo 7.10.0 | $_libcurl_version_parse`
 
         if test $_libcurl_wanted -gt 0 ; then
-           { echo "$as_me:$LINENO: checking for libcurl >= version 7.10.0" >&5
-echo $ECHO_N "checking for libcurl >= version 7.10.0... $ECHO_C" >&6; }
+           { $as_echo "$as_me:$LINENO: checking for libcurl >= version 7.10.0" >&5
+$as_echo_n "checking for libcurl >= version 7.10.0... " >&6; }
 if test "${libcurl_cv_lib_version_ok+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
               if test $_libcurl_version -ge $_libcurl_wanted ; then
@@ -27189,8 +29035,8 @@ else
               fi
 
 fi
-{ echo "$as_me:$LINENO: result: $libcurl_cv_lib_version_ok" >&5
-echo "${ECHO_T}$libcurl_cv_lib_version_ok" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $libcurl_cv_lib_version_ok" >&5
+$as_echo "$libcurl_cv_lib_version_ok" >&6; }
         fi
 
         if test $_libcurl_wanted -eq 0 || test x$libcurl_cv_lib_version_ok = xyes ; then
@@ -27230,10 +29076,10 @@ echo "${ECHO_T}$libcurl_cv_lib_version_ok" >&6; }
         # link line (or failing that, "-lcurl") is enough.
         LIBCURL=${LIBCURL-"$_libcurl_ldflags -lcurl"}
 
-        { echo "$as_me:$LINENO: checking whether libcurl is usable" >&5
-echo $ECHO_N "checking whether libcurl is usable... $ECHO_C" >&6; }
+        { $as_echo "$as_me:$LINENO: checking whether libcurl is usable" >&5
+$as_echo_n "checking whether libcurl is usable... " >&6; }
 if test "${libcurl_cv_lib_curl_usable+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
            _libcurl_save_cppflags=$CPPFLAGS
@@ -27273,26 +29119,30 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   libcurl_cv_lib_curl_usable=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        libcurl_cv_lib_curl_usable=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 
@@ -27302,8 +29152,8 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
            unset _libcurl_save_libs
 
 fi
-{ echo "$as_me:$LINENO: result: $libcurl_cv_lib_curl_usable" >&5
-echo "${ECHO_T}$libcurl_cv_lib_curl_usable" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $libcurl_cv_lib_curl_usable" >&5
+$as_echo "$libcurl_cv_lib_curl_usable" >&6; }
 
         if test $libcurl_cv_lib_curl_usable = yes ; then
 
@@ -27315,10 +29165,10 @@ echo "${ECHO_T}$libcurl_cv_lib_curl_usable" >&6; }
            _libcurl_save_libs=$LIBS
            LIBS="$LIBS $LIBCURL"
 
-           { echo "$as_me:$LINENO: checking for curl_free" >&5
-echo $ECHO_N "checking for curl_free... $ECHO_C" >&6; }
+           { $as_echo "$as_me:$LINENO: checking for curl_free" >&5
+$as_echo_n "checking for curl_free... " >&6; }
 if test "${ac_cv_func_curl_free+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -27371,32 +29221,36 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_func_curl_free=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_func_curl_free=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_curl_free" >&5
-echo "${ECHO_T}$ac_cv_func_curl_free" >&6; }
-if test $ac_cv_func_curl_free = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_curl_free" >&5
+$as_echo "$ac_cv_func_curl_free" >&6; }
+if test "x$ac_cv_func_curl_free" = x""yes; then
   :
 else
 
@@ -27422,10 +29276,10 @@ _ACEOF
 
            for _libcurl_feature in $_libcurl_features ; do
               cat >>confdefs.h <<_ACEOF
-#define `echo "libcurl_feature_$_libcurl_feature" | $as_tr_cpp` 1
+#define `$as_echo "libcurl_feature_$_libcurl_feature" | $as_tr_cpp` 1
 _ACEOF
 
-              eval `echo "libcurl_feature_$_libcurl_feature" | $as_tr_sh`=yes
+              eval `$as_echo "libcurl_feature_$_libcurl_feature" | $as_tr_sh`=yes
            done
 
            if test "x$_libcurl_protocols" = "x" ; then
@@ -27447,10 +29301,10 @@ _ACEOF
 
            for _libcurl_protocol in $_libcurl_protocols ; do
               cat >>confdefs.h <<_ACEOF
-#define `echo "libcurl_protocol_$_libcurl_protocol" | $as_tr_cpp` 1
+#define `$as_echo "libcurl_protocol_$_libcurl_protocol" | $as_tr_cpp` 1
 _ACEOF
 
-              eval `echo "libcurl_protocol_$_libcurl_protocol" | $as_tr_sh`=yes
+              eval `$as_echo "libcurl_protocol_$_libcurl_protocol" | $as_tr_sh`=yes
            done
         else
            unset LIBCURL
@@ -27487,18 +29341,22 @@ _ACEOF
 
 
 
-    { echo "$as_me:$LINENO: checking for curl_off_t" >&5
-echo $ECHO_N "checking for curl_off_t... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for curl_off_t" >&5
+$as_echo_n "checking for curl_off_t... " >&6; }
 if test "${ac_cv_type_curl_off_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
+  ac_cv_type_curl_off_t=no
+cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
 #ifdef STDC_HEADERS
 #include <stdlib.h>
 #include <stddef.h>
@@ -27507,14 +29365,56 @@ cat >>conftest.$ac_ext <<_ACEOF
 
 
 
-typedef curl_off_t ac__type_new_;
 int
 main ()
 {
-if ((ac__type_new_ *) 0)
-  return 0;
-if (sizeof (ac__type_new_))
+if (sizeof (curl_off_t))
+       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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+#include <curl/curl.h>
+
+
+
+int
+main ()
+{
+if (sizeof ((curl_off_t)))
+         return 0;
   ;
   return 0;
 }
@@ -27525,30 +29425,39 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
-  ac_cv_type_curl_off_t=yes
+  :
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_type_curl_off_t=yes
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_cv_type_curl_off_t=no
+
 fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_curl_off_t" >&5
-echo "${ECHO_T}$ac_cv_type_curl_off_t" >&6; }
-if test $ac_cv_type_curl_off_t = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_curl_off_t" >&5
+$as_echo "$ac_cv_type_curl_off_t" >&6; }
+if test "x$ac_cv_type_curl_off_t" = x""yes; then
   :
 else
 
 
     HAVE_HMAC=yes
 
-{ echo "$as_me:$LINENO: checking for HMAC_CTX_init in -lcrypto" >&5
-echo $ECHO_N "checking for HMAC_CTX_init in -lcrypto... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for HMAC_CTX_init in -lcrypto" >&5
+$as_echo_n "checking for HMAC_CTX_init in -lcrypto... " >&6; }
 if test "${ac_cv_lib_crypto_HMAC_CTX_init+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lcrypto  $LIBS"
@@ -27601,33 +29510,37 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_crypto_HMAC_CTX_init=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_crypto_HMAC_CTX_init=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_crypto_HMAC_CTX_init" >&5
-echo "${ECHO_T}$ac_cv_lib_crypto_HMAC_CTX_init" >&6; }
-if test $ac_cv_lib_crypto_HMAC_CTX_init = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_crypto_HMAC_CTX_init" >&5
+$as_echo "$ac_cv_lib_crypto_HMAC_CTX_init" >&6; }
+if test "x$ac_cv_lib_crypto_HMAC_CTX_init" = x""yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBCRYPTO 1
 _ACEOF
 
 for ac_header in openssl/hmac.h crypto/hmac.h hmac.h
 do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+as_ac_Header=`$as_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; }
+  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -27674,32 +29588,33 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -27713,69 +29628,73 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
         test ! -s conftest.err
        }; then
   ac_header_preproc=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&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; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
 
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
+as_val=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
  found_hmac_h=yes; break
 fi
@@ -27798,8 +29717,8 @@ else
 fi
 
 
-    { echo "$as_me:$LINENO: checking whether to include the Amazon S3 device" >&5
-echo $ECHO_N "checking whether to include the Amazon S3 device... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking whether to include the Amazon S3 device" >&5
+$as_echo_n "checking whether to include the Amazon S3 device... " >&6; }
     # if the user didn't specify 'no', then check for support
     if test x"$WANT_S3_DEVICE" != x"no"; then
        if test x"$HAVE_CURL" = x"yes" -a x"$HAVE_HMAC" = x"yes"; then
@@ -27808,18 +29727,18 @@ echo $ECHO_N "checking whether to include the Amazon S3 device... $ECHO_C" >&6;
            # no support -- if the user explicitly enabled the device,
            # then this is an error
            if test x"$WANT_S3_DEVICE" = x"yes"; then
-               { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-               { { echo "$as_me:$LINENO: error: Cannot build the Amazon S3 device: one or more prerequisites are missing." >&5
-echo "$as_me: error: Cannot build the Amazon S3 device: one or more prerequisites are missing." >&2;}
+               { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+               { { $as_echo "$as_me:$LINENO: error: Cannot build the Amazon S3 device: one or more prerequisites are missing." >&5
+$as_echo "$as_me: error: Cannot build the Amazon S3 device: one or more prerequisites are missing." >&2;}
    { (exit 1); exit 1; }; }
            else
                WANT_S3_DEVICE=no
            fi
        fi
     fi
-    { echo "$as_me:$LINENO: result: $WANT_S3_DEVICE" >&5
-echo "${ECHO_T}$WANT_S3_DEVICE" >&6; }
+    { $as_echo "$as_me:$LINENO: result: $WANT_S3_DEVICE" >&5
+$as_echo "$WANT_S3_DEVICE" >&6; }
 
      if test x"$WANT_S3_DEVICE" = x"yes"; then
   WANT_S3_DEVICE_TRUE=
     if test x"$WANT_S3_DEVICE" = x"yes"; then
 
 cat >>confdefs.h <<\_ACEOF
-#define WANT_S3_DEVICE
+#define WANT_S3_DEVICE /**/
 _ACEOF
 
     fi
 
 
-    # Check whether --enable-devpay was given.
-if test "${enable_devpay+set}" = set; then
-  enableval=$enable_devpay; WANT_DEVPAY=$enableval
-else
-  WANT_DEVPAY=no
-fi
-
-
-    { echo "$as_me:$LINENO: checking whether to include the Amazon S3 device's DevPay support" >&5
-echo $ECHO_N "checking whether to include the Amazon S3 device's DevPay support... $ECHO_C" >&6; }
-    if test x"$WANT_DEVPAY" = x"yes"; then
-       if test x"$WANT_S3_DEVICE" != x"yes"; then
-           { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-           { { echo "$as_me:$LINENO: error: DevPay support requires the S3 device (--enable-s3-device)" >&5
-echo "$as_me: error: DevPay support requires the S3 device (--enable-s3-device)" >&2;}
-   { (exit 1); exit 1; }; }
-       fi
-
-
-cat >>confdefs.h <<\_ACEOF
-#define WANT_DEVPAY
-_ACEOF
-
-    fi
-    { echo "$as_me:$LINENO: result: $WANT_DEVPAY" >&5
-echo "${ECHO_T}$WANT_DEVPAY" >&6; }
-
-     if test "$WANT_DEVPAY" = "yes"; then
-  WANT_DEVPAY_TRUE=
-  WANT_DEVPAY_FALSE='#'
-else
-  WANT_DEVPAY_TRUE='#'
-  WANT_DEVPAY_FALSE=
-fi
-
-
-
 
 
 
@@ -27887,20 +29768,21 @@ for ac_header in \
        sys/mtio.h \
 
 do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+as_ac_Header=`$as_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; }
+  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -27916,32 +29798,33 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -27955,69 +29838,73 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
         test ! -s conftest.err
        }; then
   ac_header_preproc=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&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; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
 
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
+as_val=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -28026,10 +29913,10 @@ done
 
 
     # check for MTIOCTOP, an indicator of POSIX tape support
-    { echo "$as_me:$LINENO: checking for MTIOCTOP" >&5
-echo $ECHO_N "checking for MTIOCTOP... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for MTIOCTOP" >&5
+$as_echo_n "checking for MTIOCTOP... " >&6; }
 if test "${amanda_cv_HAVE_MTIOCTOP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
        cat >conftest.$ac_ext <<_ACEOF
@@ -28063,20 +29950,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   amanda_cv_HAVE_MTIOCTOP=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        amanda_cv_HAVE_MTIOCTOP=no
@@ -28087,8 +29975,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
        HAVE_MTIOCTOP=$amanda_cv_HAVE_MTIOCTOP
 
 fi
-{ echo "$as_me:$LINENO: result: $amanda_cv_HAVE_MTIOCTOP" >&5
-echo "${ECHO_T}$amanda_cv_HAVE_MTIOCTOP" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $amanda_cv_HAVE_MTIOCTOP" >&5
+$as_echo "$amanda_cv_HAVE_MTIOCTOP" >&6; }
 
     # decide which tape device to compile (arranged in such a way that
     # only one actually gets compiled)
@@ -28180,8 +30068,8 @@ _ACEOF
     #
     # Check for various "mt status" related structure elements.
     #
-    { echo "$as_me:$LINENO: checking for mt_flags mtget structure element" >&5
-echo $ECHO_N "checking for mt_flags mtget structure element... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for mt_flags mtget structure element" >&5
+$as_echo_n "checking for mt_flags mtget structure element... " >&6; }
     cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -28212,20 +30100,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
 
-           { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+           { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_MT_FLAGS 1
@@ -28233,19 +30122,19 @@ _ACEOF
 
 
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
-           { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+           { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 
 fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
-    { echo "$as_me:$LINENO: checking for mt_fileno mtget structure element" >&5
-echo $ECHO_N "checking for mt_fileno mtget structure element... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for mt_fileno mtget structure element" >&5
+$as_echo_n "checking for mt_fileno mtget structure element... " >&6; }
     mt_fileno_result="found"
     cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -28277,20 +30166,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
 
-           { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+           { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_MT_FILENO 1
@@ -28298,19 +30188,19 @@ _ACEOF
 
 
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
-           { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+           { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 
 fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
-    { echo "$as_me:$LINENO: checking for mt_blkno mtget structure element" >&5
-echo $ECHO_N "checking for mt_blkno mtget structure element... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for mt_blkno mtget structure element" >&5
+$as_echo_n "checking for mt_blkno mtget structure element... " >&6; }
     cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -28341,20 +30231,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
 
-           { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+           { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_MT_BLKNO 1
@@ -28362,19 +30253,19 @@ _ACEOF
 
 
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
-           { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+           { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 
 fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
-    { echo "$as_me:$LINENO: checking for mt_dsreg mtget structure element" >&5
-echo $ECHO_N "checking for mt_dsreg mtget structure element... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for mt_dsreg mtget structure element" >&5
+$as_echo_n "checking for mt_dsreg mtget structure element... " >&6; }
     cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -28405,20 +30296,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
 
-           { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+           { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_MT_DSREG 1
@@ -28426,19 +30318,19 @@ _ACEOF
 
 
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
-           { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+           { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 
 fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
-    { echo "$as_me:$LINENO: checking for mt_erreg mtget structure element" >&5
-echo $ECHO_N "checking for mt_erreg mtget structure element... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for mt_erreg mtget structure element" >&5
+$as_echo_n "checking for mt_erreg mtget structure element... " >&6; }
     cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -28469,20 +30361,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
 
-           { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+           { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_MT_ERREG 1
@@ -28490,12 +30383,12 @@ _ACEOF
 
 
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
-           { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+           { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 
 fi
 
@@ -28513,9 +30406,9 @@ if test "${with_bsd_security+set}" = set; then
   withval=$with_bsd_security;
             case "$withval" in
                 n | no) BSD_SECURITY=no ;;
-                y |  ye | yes) ;;
-                *) { { echo "$as_me:$LINENO: error: *** You must not supply an argument to --without-bsd-security." >&5
-echo "$as_me: error: *** You must not supply an argument to --without-bsd-security." >&2;}
+                y |  ye | yes) BSD_SECURITY=yes ;;
+                *) { { $as_echo "$as_me:$LINENO: error: *** You must not supply an argument to --without-bsd-security." >&5
+$as_echo "$as_me: error: *** You must not supply an argument to --without-bsd-security." >&2;}
    { (exit 1); exit 1; }; }
                     ;;
             esac
 if test "${with_amandahosts+set}" = set; then
   withval=$with_amandahosts;
             case "$withval" in
-                n | no ) USE_AMANDAHOSTS="no" ;;
-                y |  ye | yes) : ;;
-                *) { { echo "$as_me:$LINENO: error: *** You must not supply an argument to --without-amandahosts option." >&5
-echo "$as_me: error: *** You must not supply an argument to --without-amandahosts option." >&2;}
+                n | no ) USE_AMANDAHOSTS=no ;;
+                y |  ye | yes) USE_AMANDAHOSTS=yes ;;
+                *) { { $as_echo "$as_me:$LINENO: error: *** You must not supply an argument to --without-amandahosts option." >&5
+$as_echo "$as_me: error: *** You must not supply an argument to --without-amandahosts option." >&2;}
    { (exit 1); exit 1; }; }
                   ;;
             esac
 
 
 
-    BSDTCP_SECURITY="no"
+
+
+    BSDTCP_SECURITY="yes"
 
 # Check whether --with-bsdtcp-security was given.
 if test "${with_bsdtcp_security+set}" = set; then
   withval=$with_bsdtcp_security;
             case "$withval" in
-                n | no) : ;;
+                n | no) BSDTCP_SECURITY=no ;;
                 y |  ye | yes) BSDTCP_SECURITY=yes ;;
-                *) { { echo "$as_me:$LINENO: error: *** You must not supply an argument to --with-bsdtcp-security." >&5
-echo "$as_me: error: *** You must not supply an argument to --with-bsdtcp-security." >&2;}
+                *) { { $as_echo "$as_me:$LINENO: error: *** You must not supply an argument to --with-bsdtcp-security." >&5
+$as_echo "$as_me: error: *** You must not supply an argument to --with-bsdtcp-security." >&2;}
    { (exit 1); exit 1; }; }
               ;;
             esac
@@ -28590,6 +30485,7 @@ cat >>confdefs.h <<\_ACEOF
 _ACEOF
 
     fi
+
      if test x"$BSDTCP_SECURITY" = x"yes"; then
   WANT_BSDTCP_SECURITY_TRUE=
   WANT_BSDTCP_SECURITY_FALSE='#'
@@ -28600,6 +30496,7 @@ fi
 
 
 
+
     BSDUDP_SECURITY="no"
 
 # Check whether --with-bsdudp-security was given.
@@ -28608,8 +30505,8 @@ if test "${with_bsdudp_security+set}" = set; then
             case "$withval" in
                 n | no) : ;;
                 y |  ye | yes) BSDUDP_SECURITY=yes ;;
-                *) { { echo "$as_me:$LINENO: error: *** You must not supply an argument to --with-bsdudp-security." >&5
-echo "$as_me: error: *** You must not supply an argument to --with-bsdudp-security." >&2;}
+                *) { { $as_echo "$as_me:$LINENO: error: *** You must not supply an argument to --with-bsdudp-security." >&5
+$as_echo "$as_me: error: *** You must not supply an argument to --with-bsdudp-security." >&2;}
    { (exit 1); exit 1; }; }
               ;;
             esac
@@ -28624,6 +30521,7 @@ cat >>confdefs.h <<\_ACEOF
 _ACEOF
 
     fi
+
      if test x"$BSDUDP_SECURITY" = x"yes"; then
   WANT_BSDUDP_SECURITY_TRUE=
   WANT_BSDUDP_SECURITY_FALSE='#'
@@ -28634,6 +30532,7 @@ fi
 
 
 
+
     RSH_SECURITY=no
 
 # Check whether --with-rsh-security was given.
@@ -28642,8 +30541,8 @@ if test "${with_rsh_security+set}" = set; then
             case "$withval" in
                 n | no) : ;;
                 y |  ye | yes) RSH_SECURITY=yes ;;
-                *) { { echo "$as_me:$LINENO: error: *** You must not supply an argument to --with-rsh-security." >&5
-echo "$as_me: error: *** You must not supply an argument to --with-rsh-security." >&2;}
+                *) { { $as_echo "$as_me:$LINENO: error: *** You must not supply an argument to --with-rsh-security." >&5
+$as_echo "$as_me: error: *** You must not supply an argument to --with-rsh-security." >&2;}
    { (exit 1); exit 1; }; }
               ;;
             esac
 
 
 
-    SSH_SECURITY=no
+
+    SSH_SECURITY=yes
 
 # Check whether --with-ssh-security was given.
 if test "${with_ssh_security+set}" = set; then
   withval=$with_ssh_security;
             case "$withval" in
-                n | no) : ;;
+                n | no) SSH_SECURITY=no ;;
                 y |  ye | yes) SSH_SECURITY=yes ;;
-                *) { { echo "$as_me:$LINENO: error: *** You must not supply an argument to --with-ssh-security." >&5
-echo "$as_me: error: *** You must not supply an argument to --with-ssh-security." >&2;}
+                *) { { $as_echo "$as_me:$LINENO: error: *** You must not supply an argument to --with-ssh-security." >&5
+$as_echo "$as_me: error: *** You must not supply an argument to --with-ssh-security." >&2;}
    { (exit 1); exit 1; }; }
               ;;
             esac
 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; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_SSH+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $SSH in
   [\\/]* | ?:[\\/]*)
@@ -28709,7 +30609,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_SSH="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -28721,11 +30621,11 @@ esac
 fi
 SSH=$ac_cv_path_SSH
 if test -n "$SSH"; then
-  { echo "$as_me:$LINENO: result: $SSH" >&5
-echo "${ECHO_T}$SSH" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $SSH" >&5
+$as_echo "$SSH" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
 
         case "$SSH_OPTIONS" in
             y | ye | yes | n | no)
-                { { echo "$as_me:$LINENO: error: *** You must supply an argument to --with-ssh-options." >&5
-echo "$as_me: error: *** You must supply an argument to --with-ssh-options." >&2;}
+                { { $as_echo "$as_me:$LINENO: error: *** You must supply an argument to --with-ssh-options." >&5
+$as_echo "$as_me: error: *** You must supply an argument to --with-ssh-options." >&2;}
    { (exit 1); exit 1; }; };;
             *) : ;;
         esac
 
-        { echo "$as_me:$LINENO: checking SSH options" >&5
-echo $ECHO_N "checking SSH options... $ECHO_C" >&6; }
+        { $as_echo "$as_me:$LINENO: checking SSH options" >&5
+$as_echo_n "checking SSH options... " >&6; }
         # if we didn't get SSH options from the user, figure them out for ourselves
         if test -z "$SSH_OPTIONS"; then
             case `$SSH -V 2>&1` in
@@ -28769,8 +30669,8 @@ echo $ECHO_N "checking SSH options... $ECHO_C" >&6; }
            quoted="\"`echo "$i" | sed -e 's/\"/\\\"/'`\""
            SSH_OPTIONS="${SSH_OPTIONS}${SSH_OPTIONS:+, }$quoted";
        done
-        { echo "$as_me:$LINENO: result: $SSH_OPTIONS" >&5
-echo "${ECHO_T}$SSH_OPTIONS" >&6; }
+        { $as_echo "$as_me:$LINENO: result: $SSH_OPTIONS" >&5
+$as_echo "$SSH_OPTIONS" >&6; }
 
         # finally, make the various outputs for all of this
 
@@ -28799,6 +30699,9 @@ fi
 
 
 
+    # (note -- don't just substitute SSH_OPTIONS -- shell quoting will break)
+
+
     # Specify --with-krb4-security if Kerberos software is in somewhere
     # other than the listed KRB4_SPOTS.  We only compile kerberos support in
     # if the right files are there.
 
     # check the remaining, subsidiary options
 
-    { echo "$as_me:$LINENO: checking host principal" >&5
-echo $ECHO_N "checking host principal... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking host principal" >&5
+$as_echo_n "checking host principal... " >&6; }
 
 # Check whether --with-server-principal was given.
 if test "${with_server_principal+set}" = set; then
   withval=$with_server_principal;
             case "$withval" in
                 "" | y | ye | yes | n | no)
-                    { { echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-server-principal option." >&5
-echo "$as_me: error: *** You must supply an argument to the --with-server-principal option." >&2;}
+                    { { $as_echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-server-principal option." >&5
+$as_echo "$as_me: error: *** You must supply an argument to the --with-server-principal option." >&2;}
    { (exit 1); exit 1; }; }
                   ;;
                 *) SERVER_HOST_PRINCIPAL="$withval" ;;
@@ -28843,19 +30746,19 @@ else
 
 fi
 
-    { echo "$as_me:$LINENO: result: $SERVER_HOST_PRINCIPAL" >&5
-echo "${ECHO_T}$SERVER_HOST_PRINCIPAL" >&6; }
+    { $as_echo "$as_me:$LINENO: result: $SERVER_HOST_PRINCIPAL" >&5
+$as_echo "$SERVER_HOST_PRINCIPAL" >&6; }
 
-    { echo "$as_me:$LINENO: checking server host instance" >&5
-echo $ECHO_N "checking server host instance... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking server host instance" >&5
+$as_echo_n "checking server host instance... " >&6; }
 
 # Check whether --with-server-instance was given.
 if test "${with_server_instance+set}" = set; then
   withval=$with_server_instance;
             case "$withval" in
                 "" | y | ye | yes | n | no)
-                    { { echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-server-instance option." >&5
-echo "$as_me: error: *** You must supply an argument to the --with-server-instance option." >&2;}
+                    { { $as_echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-server-instance option." >&5
+$as_echo "$as_me: error: *** You must supply an argument to the --with-server-instance option." >&2;}
    { (exit 1); exit 1; }; }
                   ;;
                 *) SERVER_HOST_INSTANCE="$withval" ;;
@@ -28866,19 +30769,19 @@ else
 
 fi
 
-    { echo "$as_me:$LINENO: result: $SERVER_HOST_INSTANCE" >&5
-echo "${ECHO_T}$SERVER_HOST_INSTANCE" >&6; }
+    { $as_echo "$as_me:$LINENO: result: $SERVER_HOST_INSTANCE" >&5
+$as_echo "$SERVER_HOST_INSTANCE" >&6; }
 
-    { echo "$as_me:$LINENO: checking server host key file" >&5
-echo $ECHO_N "checking server host key file... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking server host key file" >&5
+$as_echo_n "checking server host key file... " >&6; }
 
 # Check whether --with-server-keyfile was given.
 if test "${with_server_keyfile+set}" = set; then
   withval=$with_server_keyfile;
             case "$withval" in
                 "" | y | ye | yes | n | no)
-                    { { echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-server-keyfile option." >&5
-echo "$as_me: error: *** You must supply an argument to the --with-server-keyfile option." >&2;}
+                    { { $as_echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-server-keyfile option." >&5
+$as_echo "$as_me: error: *** You must supply an argument to the --with-server-keyfile option." >&2;}
    { (exit 1); exit 1; }; }
                   ;;
                 *) SERVER_HOST_KEY_FILE="$withval" ;;
@@ -28889,19 +30792,19 @@ else
 
 fi
 
-    { echo "$as_me:$LINENO: result: $SERVER_HOST_KEY_FILE" >&5
-echo "${ECHO_T}$SERVER_HOST_KEY_FILE" >&6; }
+    { $as_echo "$as_me:$LINENO: result: $SERVER_HOST_KEY_FILE" >&5
+$as_echo "$SERVER_HOST_KEY_FILE" >&6; }
 
-    { echo "$as_me:$LINENO: checking client host principle" >&5
-echo $ECHO_N "checking client host principle... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking client host principle" >&5
+$as_echo_n "checking client host principle... " >&6; }
 
 # Check whether --with-client-principal was given.
 if test "${with_client_principal+set}" = set; then
   withval=$with_client_principal;
             case "$withval" in
                 "" | y | ye | yes | n | no)
-                    { { echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-client-principal option." >&5
-echo "$as_me: error: *** You must supply an argument to the --with-client-principal option." >&2;}
+                    { { $as_echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-client-principal option." >&5
+$as_echo "$as_me: error: *** You must supply an argument to the --with-client-principal option." >&2;}
    { (exit 1); exit 1; }; }
                   ;;
                 *) CLIENT_HOST_PRINCIPAL="$withval" ;;
@@ -28912,19 +30815,19 @@ else
 
 fi
 
-    { echo "$as_me:$LINENO: result: $CLIENT_HOST_PRINCIPAL" >&5
-echo "${ECHO_T}$CLIENT_HOST_PRINCIPAL" >&6; }
+    { $as_echo "$as_me:$LINENO: result: $CLIENT_HOST_PRINCIPAL" >&5
+$as_echo "$CLIENT_HOST_PRINCIPAL" >&6; }
 
-    { echo "$as_me:$LINENO: checking client host instance" >&5
-echo $ECHO_N "checking client host instance... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking client host instance" >&5
+$as_echo_n "checking client host instance... " >&6; }
 
 # Check whether --with-client-instance was given.
 if test "${with_client_instance+set}" = set; then
   withval=$with_client_instance;
             case "$withval" in
                 "" | y | ye | yes | n | no)
-                    { { echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-client-instance option." >&5
-echo "$as_me: error: *** You must supply an argument to the --with-client-instance option." >&2;}
+                    { { $as_echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-client-instance option." >&5
+$as_echo "$as_me: error: *** You must supply an argument to the --with-client-instance option." >&2;}
    { (exit 1); exit 1; }; }
                   ;;
                 *) CLIENT_HOST_INSTANCE="$withval" ;;
@@ -28935,19 +30838,19 @@ else
 
 fi
 
-    { echo "$as_me:$LINENO: result: $CLIENT_HOST_INSTANCE" >&5
-echo "${ECHO_T}$CLIENT_HOST_INSTANCE" >&6; }
+    { $as_echo "$as_me:$LINENO: result: $CLIENT_HOST_INSTANCE" >&5
+$as_echo "$CLIENT_HOST_INSTANCE" >&6; }
 
-    { echo "$as_me:$LINENO: checking client host key file" >&5
-echo $ECHO_N "checking client host key file... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking client host key file" >&5
+$as_echo_n "checking client host key file... " >&6; }
 
 # Check whether --with-client-keyfile was given.
 if test "${with_client_keyfile+set}" = set; then
   withval=$with_client_keyfile;
             case "$withval" in
                 "" | y | ye | yes | n | no)
-                    { { echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-client-keyfile option." >&5
-echo "$as_me: error: *** You must supply an argument to the --with-client-keyfile option." >&2;}
+                    { { $as_echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-client-keyfile option." >&5
+$as_echo "$as_me: error: *** You must supply an argument to the --with-client-keyfile option." >&2;}
    { (exit 1); exit 1; }; }
                   ;;
                 *) CLIENT_HOST_KEY_FILE="$withval" ;;
       # add quotes
       CLIENT_HOST_KEY_FILE="\"$CLIENT_HOST_KEY_FILE\""
     fi
-    { echo "$as_me:$LINENO: result: $CLIENT_HOST_KEY_FILE" >&5
-echo "${ECHO_T}$CLIENT_HOST_KEY_FILE" >&6; }
+    { $as_echo "$as_me:$LINENO: result: $CLIENT_HOST_KEY_FILE" >&5
+$as_echo "$CLIENT_HOST_KEY_FILE" >&6; }
 
-    { echo "$as_me:$LINENO: checking ticket lifetime" >&5
-echo $ECHO_N "checking ticket lifetime... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking ticket lifetime" >&5
+$as_echo_n "checking ticket lifetime... " >&6; }
 
 # Check whether --with-ticket-lifetime was given.
 if test "${with_ticket_lifetime+set}" = set; then
   withval=$with_ticket_lifetime;
             case "$withval" in
             "" | y | ye | yes | n | no)
-                { { echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-ticket-lifetime option." >&5
-echo "$as_me: error: *** You must supply an argument to the --with-ticket-lifetime option." >&2;}
+                { { $as_echo "$as_me:$LINENO: error: *** You must supply an argument to the --with-ticket-lifetime option." >&5
+$as_echo "$as_me: error: *** You must supply an argument to the --with-ticket-lifetime option." >&2;}
    { (exit 1); exit 1; }; }
               ;;
             *) TICKET_LIFETIME="$withval" ;;
@@ -28986,21 +30889,21 @@ else
 
 fi
 
-    { echo "$as_me:$LINENO: result: $TICKET_LIFETIME" >&5
-echo "${ECHO_T}$TICKET_LIFETIME" >&6; }
+    { $as_echo "$as_me:$LINENO: result: $TICKET_LIFETIME" >&5
+$as_echo "$TICKET_LIFETIME" >&6; }
 
 
     if test "x${KRB4_SECURITY}" = "xyes"; then
-        { echo "$as_me:$LINENO: checking for Kerberos and Amanda kerberos4 bits" >&5
-echo $ECHO_N "checking for Kerberos and Amanda kerberos4 bits... $ECHO_C" >&6; }
+        { $as_echo "$as_me:$LINENO: checking for Kerberos and Amanda kerberos4 bits" >&5
+$as_echo_n "checking for Kerberos and Amanda kerberos4 bits... " >&6; }
         found="no"
         for dir in $KRB4_SPOTS; do
             if test \( -f ${dir}/lib/libkrb.a -o -f ${dir}/lib/libkrb.so \) -a \( -f ${dir}/lib/libdes.a -o -f ${dir}/lib/libdes.so \) ; then
                 #
                 # This is the original Kerberos 4.
                 #
-                { echo "$as_me:$LINENO: result: found in $dir" >&5
-echo "${ECHO_T}found in $dir" >&6; }
+                { $as_echo "$as_me:$LINENO: result: found in $dir" >&5
+$as_echo "found in $dir" >&6; }
                 found="yes"
 
                 #
@@ -29028,8 +30931,8 @@ echo "${ECHO_T}found in $dir" >&6; }
                 #
                 # This is Kerberos 5 with Kerberos 4 back-support.
                 #
-                { echo "$as_me:$LINENO: result: found in $dir" >&5
-echo "${ECHO_T}found in $dir" >&6; }
+                { $as_echo "$as_me:$LINENO: result: found in $dir" >&5
+$as_echo "found in $dir" >&6; }
                 found="yes"
                 CPPFLAGS="$CPPFLAGS -I$dir/include -I$dir/include/kerberosIV"
 
@@ -29048,11 +30951,11 @@ echo "${ECHO_T}found in $dir" >&6; }
         done
 
         if test "x$found" = "xno" ; then
-            { echo "$as_me:$LINENO: result: no libraries found" >&5
-echo "${ECHO_T}no libraries found" >&6; }
+            { $as_echo "$as_me:$LINENO: result: no libraries found" >&5
+$as_echo "no libraries found" >&6; }
 
-    { echo "$as_me:$LINENO: WARNING: No Kerberos IV libraries were found on your system; disabling krb4-security" >&5
-echo "$as_me: WARNING: No Kerberos IV libraries were found on your system; disabling krb4-security" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: No Kerberos IV libraries were found on your system; disabling krb4-security" >&5
+$as_echo "$as_me: WARNING: No Kerberos IV libraries were found on your system; disabling krb4-security" >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
 
 
 
+
+
+
+
+
+
+
+
+
+
     # Specify --with-krb5-security if Kerberos software is in somewhere
     # other than the listed KRB5_SPOTS.  We only compile kerberos support in
     # if the right files are there.
@@ -29141,8 +31054,8 @@ fi
         # if found, force the static versions of these libs (.a) by linking directly
         # with the .a files.  I don't know how to get -R dependancies checked
         # in autoconf at this time. -kashmir
-        { echo "$as_me:$LINENO: checking for Kerberos V libraries" >&5
-echo $ECHO_N "checking for Kerberos V libraries... $ECHO_C" >&6; }
+        { $as_echo "$as_me:$LINENO: checking for Kerberos V libraries" >&5
+$as_echo_n "checking for Kerberos V libraries... " >&6; }
         KRB5_DIR_FOUND=""
         for dir in $KRB5_SPOTS; do
           for lib in lib lib64; do
@@ -29176,8 +31089,8 @@ echo $ECHO_N "checking for Kerberos V libraries... $ECHO_C" >&6; }
         done
 
         if test "$KRB5_DIR_FOUND"; then
-            { echo "$as_me:$LINENO: result: found in $KRB5_DIR_FOUND" >&5
-echo "${ECHO_T}found in $KRB5_DIR_FOUND" >&6; }
+            { $as_echo "$as_me:$LINENO: result: found in $KRB5_DIR_FOUND" >&5
+$as_echo "found in $KRB5_DIR_FOUND" >&6; }
             #
             # some OS's, such as NetBSD, stick krb5 includes out of the way...
             # should probably just use autoconf to look for various include
@@ -29192,10 +31105,10 @@ echo "${ECHO_T}found in $KRB5_DIR_FOUND" >&6; }
 
             fi
 
-{ echo "$as_me:$LINENO: checking for main in -lkrb5support" >&5
-echo $ECHO_N "checking for main in -lkrb5support... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for main in -lkrb5support" >&5
+$as_echo_n "checking for main in -lkrb5support... " >&6; }
 if test "${ac_cv_lib_krb5support_main+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lkrb5support  $LIBS"
@@ -29221,33 +31134,37 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_krb5support_main=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_krb5support_main=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_krb5support_main" >&5
-echo "${ECHO_T}$ac_cv_lib_krb5support_main" >&6; }
-if test $ac_cv_lib_krb5support_main = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_krb5support_main" >&5
+$as_echo "$ac_cv_lib_krb5support_main" >&6; }
+if test "x$ac_cv_lib_krb5support_main" = x""yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBKRB5SUPPORT 1
 _ACEOF
@@ -29265,10 +31182,10 @@ cat >>confdefs.h <<\_ACEOF
 _ACEOF
 
         else
-            { echo "$as_me:$LINENO: result: no krb5 system libraries found" >&5
-echo "${ECHO_T}no krb5 system libraries found" >&6; }
-            { { echo "$as_me:$LINENO: error: No Kerberos V libraries were found on your system; krb5-security cannot be enabled" >&5
-echo "$as_me: error: No Kerberos V libraries were found on your system; krb5-security cannot be enabled" >&2;}
+            { $as_echo "$as_me:$LINENO: result: no krb5 system libraries found" >&5
+$as_echo "no krb5 system libraries found" >&6; }
+            { { $as_echo "$as_me:$LINENO: error: No Kerberos V libraries were found on your system; krb5-security cannot be enabled" >&5
+$as_echo "$as_me: error: No Kerberos V libraries were found on your system; krb5-security cannot be enabled" >&2;}
    { (exit 1); exit 1; }; }
             KRB5_SECURITY="no"
         fi
@@ -29284,6 +31201,7 @@ fi
 
 
 
+
 #
 # Dumpers
 #
 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; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_XFSDUMP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $XFSDUMP in
   [\\/]* | ?:[\\/]*)
@@ -29312,7 +31230,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_XFSDUMP="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -29324,11 +31242,11 @@ esac
 fi
 XFSDUMP=$ac_cv_path_XFSDUMP
 if test -n "$XFSDUMP"; then
-  { echo "$as_me:$LINENO: result: $XFSDUMP" >&5
-echo "${ECHO_T}$XFSDUMP" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $XFSDUMP" >&5
+$as_echo "$XFSDUMP" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -29339,10 +31257,10 @@ done
 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; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_XFSRESTORE+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $XFSRESTORE in
   [\\/]* | ?:[\\/]*)
@@ -29357,7 +31275,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_XFSRESTORE="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -29369,11 +31287,11 @@ esac
 fi
 XFSRESTORE=$ac_cv_path_XFSRESTORE
 if test -n "$XFSRESTORE"; then
-  { echo "$as_me:$LINENO: result: $XFSRESTORE" >&5
-echo "${ECHO_T}$XFSRESTORE" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $XFSRESTORE" >&5
+$as_echo "$XFSRESTORE" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -29392,8 +31310,8 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
-    { echo "$as_me:$LINENO: WARNING: xfsdump causes the setuid-root rundump program to be enabled.  To disable it, just #undef XFSDUMP in config/config.h" >&5
-echo "$as_me: WARNING: xfsdump causes the setuid-root rundump program to be enabled.  To disable it, just #undef XFSDUMP in config/config.h" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: xfsdump causes the setuid-root rundump program to be enabled.  To disable it, just #undef XFSDUMP in config/config.h" >&5
+$as_echo "$as_me: WARNING: xfsdump causes the setuid-root rundump program to be enabled.  To disable it, just #undef XFSDUMP in config/config.h" >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
@@ -29408,10 +31326,10 @@ AAW_EOF
 
     # Extract the first word of "vxdump", so it can be a program name with args.
 set dummy vxdump; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_VXDUMP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $VXDUMP in
   [\\/]* | ?:[\\/]*)
@@ -29427,7 +31345,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_VXDUMP="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -29439,20 +31357,20 @@ esac
 fi
 VXDUMP=$ac_cv_path_VXDUMP
 if test -n "$VXDUMP"; then
-  { echo "$as_me:$LINENO: result: $VXDUMP" >&5
-echo "${ECHO_T}$VXDUMP" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $VXDUMP" >&5
+$as_echo "$VXDUMP" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
     # Extract the first word of "vxrestore", so it can be a program name with args.
 set dummy vxrestore; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_VXRESTORE+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $VXRESTORE in
   [\\/]* | ?:[\\/]*)
@@ -29468,7 +31386,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_VXRESTORE="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -29480,11 +31398,11 @@ esac
 fi
 VXRESTORE=$ac_cv_path_VXRESTORE
 if test -n "$VXRESTORE"; then
-  { echo "$as_me:$LINENO: result: $VXRESTORE" >&5
-echo "${ECHO_T}$VXRESTORE" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $VXRESTORE" >&5
+$as_echo "$VXRESTORE" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -29506,10 +31424,10 @@ _ACEOF
 
     # Extract the first word of "vdump", so it can be a program name with args.
 set dummy vdump; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_VDUMP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $VDUMP in
   [\\/]* | ?:[\\/]*)
@@ -29524,7 +31442,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_VDUMP="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -29536,20 +31454,20 @@ esac
 fi
 VDUMP=$ac_cv_path_VDUMP
 if test -n "$VDUMP"; then
-  { echo "$as_me:$LINENO: result: $VDUMP" >&5
-echo "${ECHO_T}$VDUMP" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $VDUMP" >&5
+$as_echo "$VDUMP" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
     # Extract the first word of "vrestore", so it can be a program name with args.
 set dummy vrestore; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_VRESTORE+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $VRESTORE in
   [\\/]* | ?:[\\/]*)
@@ -29564,7 +31482,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_VRESTORE="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -29576,11 +31494,11 @@ esac
 fi
 VRESTORE=$ac_cv_path_VRESTORE
 if test -n "$VRESTORE"; then
-  { echo "$as_me:$LINENO: result: $VRESTORE" >&5
-echo "${ECHO_T}$VRESTORE" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $VRESTORE" >&5
+$as_echo "$VRESTORE" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -29601,10 +31519,10 @@ _ACEOF
 
     # Extract the first word of "grep", so it can be a program name with args.
 set dummy grep; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_GREP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $GREP in
   [\\/]* | ?:[\\/]*)
@@ -29619,7 +31537,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_GREP="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -29632,11 +31550,11 @@ esac
 fi
 GREP=$ac_cv_path_GREP
 if test -n "$GREP"; then
-  { echo "$as_me:$LINENO: result: $GREP" >&5
-echo "${ECHO_T}$GREP" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $GREP" >&5
+$as_echo "$GREP" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -29657,14 +31575,16 @@ _ACEOF
     # a variable is set up here to specify the order of dump programs to
     # search for on the system.
     DUMP_PROGRAMS="ufsdump dump backup"
-    dump_returns_1=
+    DUMP_RETURNS_1=
+    AIX_BACKUP=
     case "$target" in
        *-dg-*)
            DUMP_PROGRAMS="dump "$DUMP_PROGRAMS
-           dump_returns_1=yes
+           DUMP_RETURNS_1=1
            ;;
       *-ibm-aix*)
            DUMP_PROGRAMS="backup "$DUMP_PROGRAMS
+           AIX_BACKUP=1
 
 cat >>confdefs.h <<\_ACEOF
 #define AIX_BACKUP 1
@@ -29672,11 +31592,11 @@ _ACEOF
 
            ;;
       *-ultrix*)
-           dump_returns_1=yes
+           DUMP_RETURNS_1=1
            ;;
     esac
 
-    if test -n "$dump_returns_1"; then
+    if test -n "$DUMP_RETURNS_1"; then
 
 cat >>confdefs.h <<\_ACEOF
 #define DUMP_RETURNS_1 1
@@ -29688,10 +31608,10 @@ _ACEOF
 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; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_DUMP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $DUMP in
   [\\/]* | ?:[\\/]*)
@@ -29706,7 +31626,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_DUMP="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -29718,11 +31638,11 @@ esac
 fi
 DUMP=$ac_cv_path_DUMP
 if test -n "$DUMP"; then
-  { echo "$as_me:$LINENO: result: $DUMP" >&5
-echo "${ECHO_T}$DUMP" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $DUMP" >&5
+$as_echo "$DUMP" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -29733,10 +31653,10 @@ done
 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; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_RESTORE+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $RESTORE in
   [\\/]* | ?:[\\/]*)
@@ -29751,7 +31671,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_RESTORE="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -29763,11 +31683,11 @@ esac
 fi
 RESTORE=$ac_cv_path_RESTORE
 if test -n "$RESTORE"; then
-  { echo "$as_me:$LINENO: result: $RESTORE" >&5
-echo "${ECHO_T}$RESTORE" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $RESTORE" >&5
+$as_echo "$RESTORE" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -29801,10 +31721,10 @@ _ACEOF
 
        # check for an estimate flag
        if test -x $DUMP; then
-           { echo "$as_me:$LINENO: checking whether $DUMP supports -E or -S for estimates" >&5
-echo $ECHO_N "checking whether $DUMP supports -E or -S for estimates... $ECHO_C" >&6; }
+           { $as_echo "$as_me:$LINENO: checking whether $DUMP supports -E or -S for estimates" >&5
+$as_echo_n "checking whether $DUMP supports -E or -S for estimates... " >&6; }
 if test "${amanda_cv_dump_estimate+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
                    case "$DUMP" in
@@ -29816,7 +31736,7 @@ else
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }
                        cat conftest.d-E >&5
                        { ac_try='$DUMP 9Sf /dev/null /dev/null/invalid/fs 2>&1
@@ -29826,7 +31746,7 @@ else
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }
                        cat conftest.d-S >&5
                        { ac_try='$DUMP 9f /dev/null /dev/null/invalid/fs 2>&1
@@ -29836,21 +31756,21 @@ else
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }
                        cat conftest.d >&5
                        if { ac_try='cmp conftest.d-E conftest.d 1>&2'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
                            amanda_cv_dump_estimate=E
                        elif { ac_try='cmp conftest.d-S conftest.d 1>&2'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
                            amanda_cv_dump_estimate=S
                        else
@@ -29863,12 +31783,12 @@ else
                    esac
 
 fi
-{ echo "$as_me:$LINENO: result: $amanda_cv_dump_estimate" >&5
-echo "${ECHO_T}$amanda_cv_dump_estimate" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $amanda_cv_dump_estimate" >&5
+$as_echo "$amanda_cv_dump_estimate" >&6; }
        else
 
-    { echo "$as_me:$LINENO: WARNING: $DUMP is not executable, cannot run -E/-S test" >&5
-echo "$as_me: WARNING: $DUMP is not executable, cannot run -E/-S test" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $DUMP is not executable, cannot run -E/-S test" >&5
+$as_echo "$as_me: WARNING: $DUMP is not executable, cannot run -E/-S test" >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
@@ -29891,10 +31811,10 @@ _ACEOF
 if test "${with_dump_honor_nodump+set}" = set; then
   withval=$with_dump_honor_nodump;
            if test -x $DUMP; then
-               { echo "$as_me:$LINENO: checking whether $DUMP supports -h (honor nodump flag)" >&5
-echo $ECHO_N "checking whether $DUMP supports -h (honor nodump flag)... $ECHO_C" >&6; }
+               { $as_echo "$as_me:$LINENO: checking whether $DUMP supports -h (honor nodump flag)" >&5
+$as_echo_n "checking whether $DUMP supports -h (honor nodump flag)... " >&6; }
 if test "${amanda_cv_honor_nodump+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
                    case "$DUMP" in
@@ -29906,7 +31826,7 @@ else
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }
                        cat conftest.d-h >&5
                        { ac_try='$DUMP 9f /dev/null /dev/null/invalid/fs 2>&1
@@ -29916,14 +31836,14 @@ else
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }
                        cat conftest.d >&5
                        if { ac_try='diff conftest.d-h conftest.d 1>&2'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
                            amanda_cv_honor_nodump=yes
                        else
@@ -29936,12 +31856,12 @@ else
                    esac
 
 fi
-{ echo "$as_me:$LINENO: result: $amanda_cv_honor_nodump" >&5
-echo "${ECHO_T}$amanda_cv_honor_nodump" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $amanda_cv_honor_nodump" >&5
+$as_echo "$amanda_cv_honor_nodump" >&6; }
            else
 
-    { echo "$as_me:$LINENO: WARNING: $DUMP is not executable, cannot run -h test" >&5
-echo "$as_me: WARNING: $DUMP is not executable, cannot run -h test" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $DUMP is not executable, cannot run -h test" >&5
+$as_echo "$as_me: WARNING: $DUMP is not executable, cannot run -h test" >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
@@ -29966,6 +31886,9 @@ fi
 
 
 
+
+
+
     # call with
 
 # Check whether --with-gnutar was given.
@@ -29976,8 +31899,8 @@ if test "${with_gnutar+set}" = set; then
                /*) GNUTAR="$withval";;
                y|ye|yes) :;;
                n|no) GNUTAR=no ;;
-               *)  { { echo "$as_me:$LINENO: error: *** You must supply a full pathname to --with-gnutar" >&5
-echo "$as_me: error: *** You must supply a full pathname to --with-gnutar" >&2;}
+               *)  { { $as_echo "$as_me:$LINENO: error: *** You must supply a full pathname to --with-gnutar" >&5
+$as_echo "$as_me: error: *** You must supply a full pathname to --with-gnutar" >&2;}
    { (exit 1); exit 1; }; };;
            esac
            # done
 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; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_GNUTAR+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $GNUTAR in
   [\\/]* | ?:[\\/]*)
@@ -30012,7 +31935,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_GNUTAR="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -30024,11 +31947,11 @@ esac
 fi
 GNUTAR=$ac_cv_path_GNUTAR
 if test -n "$GNUTAR"; then
-  { echo "$as_me:$LINENO: result: $GNUTAR" >&5
-echo "${ECHO_T}$GNUTAR" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $GNUTAR" >&5
+$as_echo "$GNUTAR" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -30044,8 +31967,8 @@ done
               *)
                            # warning..
 
-    { echo "$as_me:$LINENO: WARNING: $GNUTAR is not GNU tar, so it will not be used." >&5
-echo "$as_me: WARNING: $GNUTAR is not GNU tar, so it will not be used." >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $GNUTAR is not GNU tar, so it will not be used." >&5
+$as_echo "$as_me: WARNING: $GNUTAR is not GNU tar, so it will not be used." >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
@@ -30084,8 +32007,8 @@ if test "${with_smbclient+set}" = set; then
                /*) SAMBA_CLIENT="$withval";;
                y|ye|yes) :;;
                n|no) SAMBA_CLIENT=no ;;
-               *)  { { echo "$as_me:$LINENO: error: *** You must supply a full pathname to --with-smbclient" >&5
-echo "$as_me: error: *** You must supply a full pathname to --with-smbclient" >&2;}
+               *)  { { $as_echo "$as_me:$LINENO: error: *** You must supply a full pathname to --with-smbclient" >&5
+$as_echo "$as_me: error: *** You must supply a full pathname to --with-smbclient" >&2;}
    { (exit 1); exit 1; }; };;
            esac
 
@@ -30096,8 +32019,8 @@ fi
 
 # Check whether --with-samba-user was given.
 if test "${with_samba_user+set}" = set; then
-  withval=$with_samba_user;  { { echo "$as_me:$LINENO: error: --with-samba-user is no longer supported; place username in 'amandapass'" >&5
-echo "$as_me: error: --with-samba-user is no longer supported; place username in 'amandapass'" >&2;}
+  withval=$with_samba_user;  { { $as_echo "$as_me:$LINENO: error: --with-samba-user is no longer supported; place username in 'amandapass'" >&5
+$as_echo "$as_me: error: --with-samba-user is no longer supported; place username in 'amandapass'" >&2;}
    { (exit 1); exit 1; }; }
 
 fi
     if test "x$SAMBA_CLIENT" != "xno"; then
       # Extract the first word of "smbclient", so it can be a program name with args.
 set dummy smbclient; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_SAMBA_CLIENT+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $SAMBA_CLIENT in
   [\\/]* | ?:[\\/]*)
@@ -30124,7 +32047,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_SAMBA_CLIENT="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -30136,11 +32059,11 @@ esac
 fi
 SAMBA_CLIENT=$ac_cv_path_SAMBA_CLIENT
 if test -n "$SAMBA_CLIENT"; then
-  { echo "$as_me:$LINENO: result: $SAMBA_CLIENT" >&5
-echo "${ECHO_T}$SAMBA_CLIENT" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $SAMBA_CLIENT" >&5
+$as_echo "$SAMBA_CLIENT" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -30155,8 +32078,8 @@ fi
                      ;;
         *)
 
-    { echo "$as_me:$LINENO: WARNING: $SAMBA_CLIENT does not seem to be smbclient, so it will not be used." >&5
-echo "$as_me: WARNING: $SAMBA_CLIENT does not seem to be smbclient, so it will not be used." >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $SAMBA_CLIENT does not seem to be smbclient, so it will not be used." >&5
+$as_echo "$as_me: WARNING: $SAMBA_CLIENT does not seem to be smbclient, so it will not be used." >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
@@ -30207,8 +32130,8 @@ if test "${with_rundump+set}" = set; then
         case "$withval" in
             n | no) USE_RUNDUMP=no ;;
             y | ye | yes) USE_RUNDUMP=yes ;;
-            *) { { echo "$as_me:$LINENO: error: You must not supply an argument to --with-rundump option." >&5
-echo "$as_me: error: You must not supply an argument to --with-rundump option." >&2;}
+            *) { { $as_echo "$as_me:$LINENO: error: You must not supply an argument to --with-rundump option." >&5
+$as_echo "$as_me: error: You must not supply an argument to --with-rundump option." >&2;}
    { (exit 1); exit 1; }; };;
         esac
 
 
 
     if test x"$USE_RUNDUMP" = x"yes"; then
+       USE_RUNDUMP=1
 
 cat >>confdefs.h <<\_ACEOF
 #define USE_RUNDUMP 1
 _ACEOF
 
+    else
+       USE_RUNDUMP=
     fi
 
 
+
+
 #
 # Look for other programs Amanda will use
 #
@@ -30231,10 +32159,10 @@ _ACEOF
 
     # Extract the first word of "grep", so it can be a program name with args.
 set dummy grep; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_GREP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $GREP in
   [\\/]* | ?:[\\/]*)
@@ -30249,7 +32177,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_GREP="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -30262,11 +32190,11 @@ esac
 fi
 GREP=$ac_cv_path_GREP
 if test -n "$GREP"; then
-  { echo "$as_me:$LINENO: result: $GREP" >&5
-echo "${ECHO_T}$GREP" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $GREP" >&5
+$as_echo "$GREP" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -30276,45 +32204,40 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
-{ echo "$as_me:$LINENO: checking for egrep" >&5
-echo $ECHO_N "checking for egrep... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
 if test "${ac_cv_path_EGREP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&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
+     if test -z "$EGREP"; then
   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
+  # 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_test_x "$ac_path_EGREP"; } || continue
-    # Check for GNU ac_path_EGREP and select it if it is found.
+    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_test_x "$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"
+  $as_echo_n 0123456789 >"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"
+    $as_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`
@@ -30329,33 +32252,24 @@ case `"$ac_path_EGREP" --version 2>&1` in
   rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
 esac
 
-
-    $ac_path_EGREP_found && break 3
+      $ac_path_EGREP_found && break 3
+    done
   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;}
+  if test -z "$ac_cv_path_EGREP"; then
+    { { $as_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+$as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
    { (exit 1); exit 1; }; }
-fi
-
+  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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
  EGREP="$ac_cv_path_EGREP"
 
 
@@ -30365,10 +32279,10 @@ echo "${ECHO_T}$ac_cv_path_EGREP" >&6; }
 
     # Extract the first word of "lint", so it can be a program name with args.
 set dummy lint; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_AMLINT+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $AMLINT in
   [\\/]* | ?:[\\/]*)
@@ -30384,7 +32298,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_AMLINT="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -30396,11 +32310,11 @@ esac
 fi
 AMLINT=$ac_cv_path_AMLINT
 if test -n "$AMLINT"; then
-  { echo "$as_me:$LINENO: result: $AMLINT" >&5
-echo "${ECHO_T}$AMLINT" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $AMLINT" >&5
+$as_echo "$AMLINT" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
     else
       # Extract the first word of "splint", so it can be a program name with args.
 set dummy splint; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_AMLINT+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $AMLINT in
   [\\/]* | ?:[\\/]*)
@@ -30482,7 +32396,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_AMLINT="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -30494,20 +32408,21 @@ esac
 fi
 AMLINT=$ac_cv_path_AMLINT
 if test -n "$AMLINT"; then
-  { echo "$as_me:$LINENO: result: $AMLINT" >&5
-echo "${ECHO_T}$AMLINT" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $AMLINT" >&5
+$as_echo "$AMLINT" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
       if test ! -z "$AMLINT"; then
        AMLINT="splint"
+        AMLINTFLAGS='+show-scan +unixlib -weak -globs +usedef +usereleased +impouts -paramimptemp -varuse -warnposix -redef -preproc -fixedformalarray -retval -unrecog -usevarargs -formatcode'
       else
        AMLINT='echo "Error: LINT is not installed" ; false'
+        AMLINTFLAGS=''
       fi
-      AMLINTFLAGS='+show-scan +unixlib -weak -globs +usedef +usereleased +impouts -paramimptemp -varuse -warnposix -redef -preproc -fixedformalarray -retval -unrecog -usevarargs -formatcode'
     fi
 
 
@@ -30515,10 +32430,10 @@ for ac_prog in flex lex
 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; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_prog_LEX+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$LEX"; then
   ac_cv_prog_LEX="$LEX" # Let the user override the test.
@@ -30531,7 +32446,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_LEX="$ac_prog"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 fi
 LEX=$ac_cv_prog_LEX
 if test -n "$LEX"; then
-  { echo "$as_me:$LINENO: result: $LEX" >&5
-echo "${ECHO_T}$LEX" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $LEX" >&5
+$as_echo "$LEX" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -30579,15 +32494,16 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$LEX conftest.l") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }
-{ echo "$as_me:$LINENO: checking lex output file root" >&5
-echo $ECHO_N "checking lex output file root... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking lex output file root" >&5
+$as_echo_n "checking lex output file root... " >&6; }
 if test "${ac_cv_prog_lex_root+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 if test -f lex.yy.c; then
@@ -30595,20 +32511,20 @@ if test -f lex.yy.c; then
 elif test -f lexyy.c; then
   ac_cv_prog_lex_root=lexyy
 else
-  { { echo "$as_me:$LINENO: error: cannot find output from $LEX; giving up" >&5
-echo "$as_me: error: cannot find output from $LEX; giving up" >&2;}
+  { { $as_echo "$as_me:$LINENO: error: cannot find output from $LEX; giving up" >&5
+$as_echo "$as_me: error: cannot find output from $LEX; giving up" >&2;}
    { (exit 1); exit 1; }; }
 fi
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_prog_lex_root" >&5
-echo "${ECHO_T}$ac_cv_prog_lex_root" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_lex_root" >&5
+$as_echo "$ac_cv_prog_lex_root" >&6; }
 LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root
 
 if test -z "${LEXLIB+set}"; then
-  { echo "$as_me:$LINENO: checking lex library" >&5
-echo $ECHO_N "checking lex library... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking lex library" >&5
+$as_echo_n "checking lex library... " >&6; }
 if test "${ac_cv_lib_lex+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
     ac_save_LIBS=$LIBS
@@ -30624,26 +32540,30 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_lex=$ac_lib
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
       test "$ac_cv_lib_lex" != 'none needed' && break
@@ -30651,16 +32571,16 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
     LIBS=$ac_save_LIBS
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_lex" >&5
-echo "${ECHO_T}$ac_cv_lib_lex" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_lex" >&5
+$as_echo "$ac_cv_lib_lex" >&6; }
   test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex
 fi
 
 
-{ echo "$as_me:$LINENO: checking whether yytext is a pointer" >&5
-echo $ECHO_N "checking whether yytext is a pointer... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking whether yytext is a pointer" >&5
+$as_echo_n "checking whether yytext is a pointer... " >&6; }
 if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   # POSIX says lex can declare yytext either as a pointer or an array; the
 # default is implementation-dependent.  Figure out which it is, since
@@ -30678,33 +32598,37 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_prog_lex_yytext_pointer=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_save_LIBS
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_prog_lex_yytext_pointer" >&5
-echo "${ECHO_T}$ac_cv_prog_lex_yytext_pointer" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_lex_yytext_pointer" >&5
+$as_echo "$ac_cv_prog_lex_yytext_pointer" >&6; }
 if test $ac_cv_prog_lex_yytext_pointer = yes; then
 
 cat >>confdefs.h <<\_ACEOF
 
     # Extract the first word of "ar", so it can be a program name with args.
 set dummy ar; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_AR+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $AR in
   [\\/]* | ?:[\\/]*)
@@ -30740,7 +32664,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_AR="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -30752,11 +32676,11 @@ esac
 fi
 AR=$ac_cv_path_AR
 if test -n "$AR"; then
-  { echo "$as_me:$LINENO: result: $AR" >&5
-echo "${ECHO_T}$AR" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $AR" >&5
+$as_echo "$AR" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
 
     # Extract the first word of "gettext", so it can be a program name with args.
 set dummy gettext; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_GETTEXT+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $GETTEXT in
   [\\/]* | ?:[\\/]*)
@@ -30783,7 +32707,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_GETTEXT="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -30795,11 +32719,11 @@ esac
 fi
 GETTEXT=$ac_cv_path_GETTEXT
 if test -n "$GETTEXT"; then
-  { echo "$as_me:$LINENO: result: $GETTEXT" >&5
-echo "${ECHO_T}$GETTEXT" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $GETTEXT" >&5
+$as_echo "$GETTEXT" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -30808,10 +32732,10 @@ 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; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_prog_AWK+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$AWK"; then
   ac_cv_prog_AWK="$AWK" # Let the user override the test.
@@ -30824,7 +32748,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 fi
 AWK=$ac_cv_prog_AWK
 if test -n "$AWK"; then
-  { echo "$as_me:$LINENO: result: $AWK" >&5
-echo "${ECHO_T}$AWK" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -30850,10 +32774,10 @@ for ac_prog in 'bison -y' byacc
 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; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_prog_YACC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$YACC"; then
   ac_cv_prog_YACC="$YACC" # Let the user override the test.
@@ -30866,7 +32790,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_YACC="$ac_prog"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 fi
 YACC=$ac_cv_prog_YACC
 if test -n "$YACC"; then
-  { echo "$as_me:$LINENO: result: $YACC" >&5
-echo "${ECHO_T}$YACC" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $YACC" >&5
+$as_echo "$YACC" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
 done
 test -n "$YACC" || YACC="yacc"
 
-{ echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5
-echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5
+$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
 if test -z "$MKDIR_P"; then
   if test "${ac_cv_path_mkdir+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
     MKDIR_P="$ac_install_sh -d"
   fi
 fi
-{ echo "$as_me:$LINENO: result: $MKDIR_P" >&5
-echo "${ECHO_T}$MKDIR_P" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
 
 
 
     # Extract the first word of "dd", so it can be a program name with args.
 set dummy dd; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_DD+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $DD in
   [\\/]* | ?:[\\/]*)
@@ -30953,7 +32877,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_DD="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -30965,11 +32889,11 @@ esac
 fi
 DD=$ac_cv_path_DD
 if test -n "$DD"; then
-  { echo "$as_me:$LINENO: result: $DD" >&5
-echo "${ECHO_T}$DD" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $DD" >&5
+$as_echo "$DD" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
 
     # Extract the first word of "bash", so it can be a program name with args.
 set dummy bash; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_BASH+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $BASH in
   [\\/]* | ?:[\\/]*)
@@ -30996,7 +32920,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_BASH="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -31008,11 +32932,11 @@ esac
 fi
 BASH=$ac_cv_path_BASH
 if test -n "$BASH"; then
-  { echo "$as_me:$LINENO: result: $BASH" >&5
-echo "${ECHO_T}$BASH" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $BASH" >&5
+$as_echo "$BASH" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
 
     # Extract the first word of "sort", so it can be a program name with args.
 set dummy sort; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_SORT+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $SORT in
   [\\/]* | ?:[\\/]*)
@@ -31041,7 +32965,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_SORT="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -31054,19 +32978,19 @@ esac
 fi
 SORT=$ac_cv_path_SORT
 if test -n "$SORT"; then
-  { echo "$as_me:$LINENO: result: $SORT" >&5
-echo "${ECHO_T}$SORT" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $SORT" >&5
+$as_echo "$SORT" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
 
     # sort is only needed in the server build
     if test x"$SORT" = x"NONE" && $WANT_SERVER; then
-        { { echo "$as_me:$LINENO: error: Set SORT to the path of the sort program." >&5
-echo "$as_me: error: Set SORT to the path of the sort program." >&2;}
+        { { $as_echo "$as_me:$LINENO: error: Set SORT to the path of the sort program." >&5
+$as_echo "$as_me: error: Set SORT to the path of the sort program." >&2;}
    { (exit 1); exit 1; }; }
     fi
 
@@ -31082,10 +33006,10 @@ _ACEOF
 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; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_MAILER+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $MAILER in
   [\\/]* | ?:[\\/]*)
@@ -31100,7 +33024,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_MAILER="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -31112,11 +33036,11 @@ esac
 fi
 MAILER=$ac_cv_path_MAILER
 if test -n "$MAILER"; then
-  { echo "$as_me:$LINENO: result: $MAILER" >&5
-echo "${ECHO_T}$MAILER" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $MAILER" >&5
+$as_echo "$MAILER" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -31126,8 +33050,8 @@ test -n "$MAILER" || MAILER="NONE"
 
     if test x"$MAILER" = x"NONE"; then
 
-    { echo "$as_me:$LINENO: WARNING: WARNING: Amanda cannot send mail reports without a mailer." >&5
-echo "$as_me: WARNING: WARNING: Amanda cannot send mail reports without a mailer." >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: WARNING: Amanda cannot send mail reports without a mailer." >&5
+$as_echo "$as_me: WARNING: WARNING: Amanda cannot send mail reports without a mailer." >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
@@ -31135,22 +33059,25 @@ WARNING: Amanda cannot send mail reports without a mailer.
 AAW_EOF
 
 
+       DEFAULT_MAILER=""
     else
+       DEFAULT_MAILER="$MAILER"
+    fi
 
 cat >>confdefs.h <<_ACEOF
-#define MAILER "$MAILER"
+#define DEFAULT_MAILER "$DEFAULT_MAILER"
 _ACEOF
 
-    fi
+
 
 
 
     # Extract the first word of "mt", so it can be a program name with args.
 set dummy mt; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_MT+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $MT in
   [\\/]* | ?:[\\/]*)
@@ -31165,7 +33092,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_MT="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -31178,11 +33105,11 @@ esac
 fi
 MT=$ac_cv_path_MT
 if test -n "$MT"; then
-  { echo "$as_me:$LINENO: result: $MT" >&5
-echo "${ECHO_T}$MT" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $MT" >&5
+$as_echo "$MT" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -31206,10 +33133,10 @@ _ACEOF
 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; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_PRINT+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $PRINT in
   [\\/]* | ?:[\\/]*)
@@ -31224,7 +33151,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_PRINT="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -31236,11 +33163,11 @@ esac
 fi
 PRINT=$ac_cv_path_PRINT
 if test -n "$PRINT"; then
-  { echo "$as_me:$LINENO: result: $PRINT" >&5
-echo "${ECHO_T}$PRINT" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $PRINT" >&5
+$as_echo "$PRINT" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -31254,10 +33181,10 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
-       { echo "$as_me:$LINENO: checking which flag to use to select a printer" >&5
-echo $ECHO_N "checking which flag to use to select a printer... $ECHO_C" >&6; }
+       { $as_echo "$as_me:$LINENO: checking which flag to use to select a printer" >&5
+$as_echo_n "checking which flag to use to select a printer... " >&6; }
 if test "${amanda_cv_printer_flag+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
            amanda_cv_printer_flag=$PRINTER_FLAG
@@ -31267,8 +33194,8 @@ else
            esac
 
 fi
-{ echo "$as_me:$LINENO: result: $amanda_cv_printer_flag" >&5
-echo "${ECHO_T}$amanda_cv_printer_flag" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $amanda_cv_printer_flag" >&5
+$as_echo "$amanda_cv_printer_flag" >&6; }
        if test ! -z "$amanda_cv_printer_flag"; then
 
 cat >>confdefs.h <<_ACEOF
@@ -31277,8 +33204,8 @@ _ACEOF
 
        else
 
-    { echo "$as_me:$LINENO: WARNING: WARNING: amanda will always print to the default printer" >&5
-echo "$as_me: WARNING: WARNING: amanda will always print to the default printer" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: WARNING: amanda will always print to the default printer" >&5
+$as_echo "$as_me: WARNING: WARNING: amanda will always print to the default printer" >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
@@ -31293,10 +33220,10 @@ AAW_EOF
 
     # Extract the first word of "pcat", so it can be a program name with args.
 set dummy pcat; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_PCAT+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $PCAT in
   [\\/]* | ?:[\\/]*)
@@ -31311,7 +33238,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_PCAT="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -31323,11 +33250,11 @@ esac
 fi
 PCAT=$ac_cv_path_PCAT
 if test -n "$PCAT"; then
-  { echo "$as_me:$LINENO: result: $PCAT" >&5
-echo "${ECHO_T}$PCAT" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $PCAT" >&5
+$as_echo "$PCAT" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
 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; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_PERL+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $PERL in
   [\\/]* | ?:[\\/]*)
@@ -31356,7 +33283,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -31368,11 +33295,11 @@ esac
 fi
 PERL=$ac_cv_path_PERL
 if test -n "$PERL"; then
-  { echo "$as_me:$LINENO: result: $PERL" >&5
-echo "${ECHO_T}$PERL" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $PERL" >&5
+$as_echo "$PERL" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -31384,10 +33311,10 @@ done
 if test -z "$PERL"; then
 # Extract the first word of "perl", so it can be a program name with args.
 set dummy perl; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_prog_PERL+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$PERL"; then
   ac_cv_prog_PERL="$PERL" # Let the user override the test.
@@ -31400,7 +33327,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_PERL="perl"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 fi
 PERL=$ac_cv_prog_PERL
 if test -n "$PERL"; then
-  { echo "$as_me:$LINENO: result: $PERL" >&5
-echo "${ECHO_T}$PERL" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $PERL" >&5
+$as_echo "$PERL" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
 ac_perl_version="5.6.0"
 
 if test "x$PERL" != "x"; then
-  { echo "$as_me:$LINENO: checking for perl version greater than or equal to $ac_perl_version" >&5
-echo $ECHO_N "checking for perl version greater than or equal to $ac_perl_version... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for perl version greater than or equal to $ac_perl_version" >&5
+$as_echo_n "checking for perl version greater than or equal to $ac_perl_version... " >&6; }
   # NB: It would be nice to log the error if there is one, but we cannot rely
   # on autoconf internals
   $PERL -e "use $ac_perl_version;" > /dev/null 2>&1
   if test $? -ne 0; then
-    { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; };
+    { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; };
 
-       { { echo "$as_me:$LINENO: error: Amanda requires at least perl 5.6.0" >&5
-echo "$as_me: error: Amanda requires at least perl 5.6.0" >&2;}
+       { { $as_echo "$as_me:$LINENO: error: Amanda requires at least perl 5.6.0" >&5
+$as_echo "$as_me: error: Amanda requires at least perl 5.6.0" >&2;}
    { (exit 1); exit 1; }; }
 
   else
-    { echo "$as_me:$LINENO: result: ok" >&5
-echo "${ECHO_T}ok" >&6; };
+    { $as_echo "$as_me:$LINENO: result: ok" >&5
+$as_echo "ok" >&6; };
 
   fi
 else
-  { echo "$as_me:$LINENO: WARNING: could not find perl" >&5
-echo "$as_me: WARNING: could not find perl" >&2;}
+  { $as_echo "$as_me:$LINENO: WARNING: could not find perl" >&5
+$as_echo "$as_me: WARNING: could not find perl" >&2;}
 fi
 
 
 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; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_SWIG+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $SWIG in
   [\\/]* | ?:[\\/]*)
@@ -31473,7 +33400,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_SWIG="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -31485,11 +33412,11 @@ esac
 fi
 SWIG=$ac_cv_path_SWIG
 if test -n "$SWIG"; then
-  { echo "$as_me:$LINENO: result: $SWIG" >&5
-echo "${ECHO_T}$SWIG" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $SWIG" >&5
+$as_echo "$SWIG" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -31500,10 +33427,10 @@ done
 
         # Extract the first word of "swig", so it can be a program name with args.
 set dummy swig; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_SWIG+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $SWIG in
   [\\/]* | ?:[\\/]*)
@@ -31518,7 +33445,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_SWIG="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -31530,22 +33457,22 @@ esac
 fi
 SWIG=$ac_cv_path_SWIG
 if test -n "$SWIG"; then
-  { echo "$as_me:$LINENO: result: $SWIG" >&5
-echo "${ECHO_T}$SWIG" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $SWIG" >&5
+$as_echo "$SWIG" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
         if test -z "$SWIG" ; then
                 SWIG='echo "Error: SWIG is not installed. You should look at http://www.swig.org" ; false'
         elif test -n "1.3.28" ; then
-                { echo "$as_me:$LINENO: checking for SWIG version" >&5
-echo $ECHO_N "checking for SWIG version... $ECHO_C" >&6; }
+                { $as_echo "$as_me:$LINENO: checking for SWIG version" >&5
+$as_echo_n "checking for SWIG version... " >&6; }
                 swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`
-                { echo "$as_me:$LINENO: result: $swig_version" >&5
-echo "${ECHO_T}$swig_version" >&6; }
+                { $as_echo "$as_me:$LINENO: result: $swig_version" >&5
+$as_echo "$swig_version" >&6; }
                 if test -n "$swig_version" ; then
                         # Calculate the required version number components
                         required=1.3.28
@@ -31594,6 +33521,107 @@ echo "${ECHO_T}$swig_version" >&6; }
 
 
 
+    # Extract the first word of "ps", so it can be a program name with args.
+set dummy ps; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_PS+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  case $PS in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PS="$PS" # Let the user override the test with a path.
+  ;;
+  *)
+  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_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_PS="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+PS=$ac_cv_path_PS
+if test -n "$PS"; then
+  { $as_echo "$as_me:$LINENO: result: $PS" >&5
+$as_echo "$PS" >&6; }
+else
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    { $as_echo "$as_me:$LINENO: checking ps argument to use" >&5
+$as_echo_n "checking ps argument to use... " >&6; }
+    PS_ARGUMENT=
+
+    # ps is *very* non-portable, and across many systems, the same option
+    # (e.g., -e) can mean different things.  So this macro tries to
+    # special-case most known systems, and makes an effort to detect unknown
+    # systems
+    case "$target" in
+       *-*-solaris*)
+           PS_ARGUMENT="-eo pid,ppid,comm"
+           ;;
+
+       *-*-linux-*)
+           PS_ARGUMENT="-eo pid,ppid,command"
+           ;;
+
+       *-*-*bsd*)
+           PS_ARGUMENT="-axo pid,ppid,command"
+           ;;
+
+       *-apple-darwin*)
+           PS_ARGUMENT="-aAco pid,ppid,command"
+           ;;
+
+       *-pc-cygwin)
+           # Cygwin is special-cased in Amanda::Process
+           PS_ARGUMENT=CYGWIN
+           ;;
+
+       *-*-hpux*)
+           # HPUX's 'PS' needs the env var UNIX95 to run in "xpg4" mode
+           PS="UNIX95=1 $PS"
+           PS_ARGUMENT="-eo pid,ppid,comm"
+           ;;
+
+       *)
+           for try in \
+               "-axo pid,ppid,command" \
+               "-aAco pid,ppid,command" \
+               "-eo pid,ppid,comm"
+           do
+               ps $try >/dev/null 2>/dev/null
+               if test $? -eq 0; then
+                   PS_ARGUMENT="$try"
+                   break
+               fi
+           done
+           if test -z "$PS_ARGUMENT"; then
+               { { $as_echo "$as_me:$LINENO: error: Can't find ps argument to use." >&5
+$as_echo "$as_me: error: Can't find ps argument to use." >&2;}
+   { (exit 1); exit 1; }; }
+           fi
+           ;;
+    esac
+
+    { $as_echo "$as_me:$LINENO: result: $PS_ARGUMENT" >&5
+$as_echo "$PS_ARGUMENT" >&6; }
+
+
+
 
 #
 # Compiler / system characteristics
@@ -31603,10 +33631,10 @@ echo "${ECHO_T}$swig_version" >&6; }
 # compiler
 #
 if test $ac_cv_c_compiler_gnu = yes; then
-    { echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5
-echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5
+$as_echo_n "checking whether $CC needs -traditional... " >&6; }
 if test "${ac_cv_prog_gcc_traditional+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
     ac_pattern="Autoconf.*'x'"
   cat >conftest.$ac_ext <<_ACEOF
@@ -31645,17 +33673,17 @@ rm -f conftest*
 
   fi
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5
-echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5
+$as_echo "$ac_cv_prog_gcc_traditional" >&6; }
   if test $ac_cv_prog_gcc_traditional = yes; then
     CC="$CC -traditional"
   fi
 fi
 
-{ echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
-echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
+$as_echo_n "checking for an ANSI C-conforming const... " >&6; }
 if test "${ac_cv_c_const+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -31727,20 +33755,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_c_const=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_c_const=no
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
-echo "${ECHO_T}$ac_cv_c_const" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
+$as_echo "$ac_cv_c_const" >&6; }
 if test $ac_cv_c_const = no; then
 
 cat >>confdefs.h <<\_ACEOF
-#define const
+#define const /**/
 _ACEOF
 
 fi
 
-{ echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
-echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6; }
+
+ { $as_echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
+$as_echo_n "checking whether byte ordering is bigendian... " >&6; }
 if test "${ac_cv_c_bigendian+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
-  # See if sys/param.h defines the BYTE_ORDER macro.
-cat >conftest.$ac_ext <<_ACEOF
+  ac_cv_c_bigendian=unknown
+    # See if we're dealing with a universal compiler.
+    cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifndef __APPLE_CC__
+              not a universal capable compiler
+            #endif
+            typedef int dummy;
+
+_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+
+       # Check for potential -arch flags.  It is not universal unless
+       # there are some -arch flags.  Note that *ppc* also matches
+       # ppc64.  This check is also rather less than ideal.
+       case "${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}" in  #(
+         *-arch*ppc*|*-arch*i386*|*-arch*x86_64*) ac_cv_c_bigendian=universal;;
+       esac
+else
+  $as_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
+    if test $ac_cv_c_bigendian = unknown; then
+      # See if sys/param.h defines the BYTE_ORDER macro.
+      cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #include <sys/types.h>
-#include <sys/param.h>
+            #include <sys/param.h>
 
 int
 main ()
 {
-#if  ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \
-       && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN)
- bogus endian macros
-#endif
+#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \
+                    && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \
+                    && LITTLE_ENDIAN)
+             bogus endian macros
+            #endif
 
   ;
   return 0;
@@ -31791,33 +33870,34 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   # It does; now see whether it defined to BIG_ENDIAN or not.
-cat >conftest.$ac_ext <<_ACEOF
+        cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #include <sys/types.h>
-#include <sys/param.h>
+               #include <sys/param.h>
 
 int
 main ()
 {
 #if BYTE_ORDER != BIG_ENDIAN
- not big endian
-#endif
               not big endian
+               #endif
 
   ;
   return 0;
@@ -31829,20 +33909,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_c_bigendian=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_c_bigendian=no
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-       # It does not; compile a test program.
-if test "$cross_compiling" = yes; then
-  # try to guess the endianness by grepping values into an object file
-  ac_cv_c_bigendian=unknown
-  cat >conftest.$ac_ext <<_ACEOF
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+    fi
+    if test $ac_cv_c_bigendian = unknown; then
+      # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris).
+      cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
-short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
-void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; }
-short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
-short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
-void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }
+#include <limits.h>
+
 int
 main ()
 {
- _ascii (); _ebcdic ();
+#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN)
+             bogus endian macros
+            #endif
+
   ;
   return 0;
 }
@@ -31883,30 +33966,139 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  # It does; now see whether it defined to _BIG_ENDIAN or not.
+        cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <limits.h>
+
+int
+main ()
+{
+#ifndef _BIG_ENDIAN
+                not big endian
+               #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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
-  if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then
   ac_cv_c_bigendian=yes
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_c_bigendian=no
 fi
-if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
-  if test "$ac_cv_c_bigendian" = unknown; then
-    ac_cv_c_bigendian=no
-  else
-    # finding both strings is unlikely to happen, but who knows?
-    ac_cv_c_bigendian=unknown
-  fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+  $as_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
+    if test $ac_cv_c_bigendian = unknown; then
+      # Compile a test program.
+      if test "$cross_compiling" = yes; then
+  # Try to guess by grepping values from an object file.
+        cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+short int ascii_mm[] =
+                 { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
+               short int ascii_ii[] =
+                 { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
+               int use_ascii (int i) {
+                 return ascii_mm[i] + ascii_ii[i];
+               }
+               short int ebcdic_ii[] =
+                 { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
+               short int ebcdic_mm[] =
+                 { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
+               int use_ebcdic (int i) {
+                 return ebcdic_mm[i] + ebcdic_ii[i];
+               }
+               extern int foo;
+
+int
+main ()
+{
+return use_ascii (foo) == use_ebcdic (foo);
+  ;
+  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then
+             ac_cv_c_bigendian=yes
+           fi
+           if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
+             if test "$ac_cv_c_bigendian" = unknown; then
+               ac_cv_c_bigendian=no
+             else
+               # finding both strings is unlikely to happen, but who knows?
+               ac_cv_c_bigendian=unknown
+             fi
+           fi
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
@@ -31925,14 +34117,14 @@ int
 main ()
 {
 
-  /* Are we little or big endian?  From Harbison&Steele.  */
-  union
-  {
-    long int l;
-    char c[sizeof (long int)];
-  } u;
-  u.l = 1;
-  return u.c[sizeof (long int) - 1] == 1;
+            /* Are we little or big endian?  From Harbison&Steele.  */
+            union
+            {
+              long int l;
+              char c[sizeof (long int)];
+            } u;
+            u.l = 1;
+            return u.c[sizeof (long int) - 1] == 1;
 
   ;
   return 0;
@@ -31944,55 +34136,62 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_c_bigendian=no
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
 ac_cv_c_bigendian=yes
 fi
+rm -rf conftest.dSYM
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 
 
+    fi
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5
-echo "${ECHO_T}$ac_cv_c_bigendian" >&6; }
-case $ac_cv_c_bigendian in
-  yes)
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5
+$as_echo "$ac_cv_c_bigendian" >&6; }
+ case $ac_cv_c_bigendian in #(
+   yes)
+     cat >>confdefs.h <<\_ACEOF
+#define WORDS_BIGENDIAN 1
+_ACEOF
+;; #(
+   no)
+      ;; #(
+   universal)
 
 cat >>confdefs.h <<\_ACEOF
-#define WORDS_BIGENDIAN 1
+#define AC_APPLE_UNIVERSAL_BUILD 1
 _ACEOF
- ;;
-  no)
-     ;;
-  *)
-    { { echo "$as_me:$LINENO: error: unknown endianness
-presetting ac_cv_c_bigendian=no (or yes) will help" >&5
-echo "$as_me: error: unknown endianness
-presetting ac_cv_c_bigendian=no (or yes) will help" >&2;}
+
+     ;; #(
+   *)
+     { { $as_echo "$as_me:$LINENO: error: unknown endianness
+ presetting ac_cv_c_bigendian=no (or yes) will help" >&5
+$as_echo "$as_me: error: unknown endianness
+ presetting ac_cv_c_bigendian=no (or yes) will help" >&2;}
    { (exit 1); exit 1; }; } ;;
-esac
+ esac
 
 
 # GCC_COMPILER is needed in the gnulib Makefile to silence errors
 
 
 
-    { echo "$as_me:$LINENO: checking for gcc flag -Wparentheses" >&5
-echo $ECHO_N "checking for gcc flag -Wparentheses... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for gcc flag -Wparentheses" >&5
+$as_echo_n "checking for gcc flag -Wparentheses... " >&6; }
     if test "x$GCC" = "xyes"; then
-               $CC -v --help 2>&1 | $EGREP -- '[^[:alnum:]]-Wparentheses[^[:alnum:]-]' 2>&1 > /dev/null
+               (gcc --help={target,optimizers,warnings,undocumented,params,c} 2>&1 ||
+           $CC -v --help 2>&1) |
+         $EGREP -- '[^[:alnum:]]-Wparentheses[^[:alnum:]-]' 2>&1 > /dev/null
                if test $? -eq 0; then
            found_warning=yes
-           { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+           { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
        else
            found_warning=no
-           { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+           { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
        fi
     else
        found_warning=no
-       { echo "$as_me:$LINENO: result: no (not using gcc)" >&5
-echo "${ECHO_T}no (not using gcc)" >&6; }
+       { $as_echo "$as_me:$LINENO: result: no (not using gcc)" >&5
+$as_echo "no (not using gcc)" >&6; }
     fi
 
     if test x"$found_warning" = x"yes"; then
@@ -32044,23 +34245,25 @@ echo "${ECHO_T}no (not using gcc)" >&6; }
 
 
 
-    { echo "$as_me:$LINENO: checking for gcc flag -Wdeclaration-after-statement" >&5
-echo $ECHO_N "checking for gcc flag -Wdeclaration-after-statement... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for gcc flag -Wdeclaration-after-statement" >&5
+$as_echo_n "checking for gcc flag -Wdeclaration-after-statement... " >&6; }
     if test "x$GCC" = "xyes"; then
-               $CC -v --help 2>&1 | $EGREP -- '[^[:alnum:]]-Wdeclaration-after-statement[^[:alnum:]-]' 2>&1 > /dev/null
+               (gcc --help={target,optimizers,warnings,undocumented,params,c} 2>&1 ||
+           $CC -v --help 2>&1) |
+         $EGREP -- '[^[:alnum:]]-Wdeclaration-after-statement[^[:alnum:]-]' 2>&1 > /dev/null
                if test $? -eq 0; then
            found_warning=yes
-           { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+           { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
        else
            found_warning=no
-           { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+           { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
        fi
     else
        found_warning=no
-       { echo "$as_me:$LINENO: result: no (not using gcc)" >&5
-echo "${ECHO_T}no (not using gcc)" >&6; }
+       { $as_echo "$as_me:$LINENO: result: no (not using gcc)" >&5
+$as_echo "no (not using gcc)" >&6; }
     fi
 
     if test x"$found_warning" = x"yes"; then
@@ -32076,23 +34279,25 @@ echo "${ECHO_T}no (not using gcc)" >&6; }
 
 
 
-    { echo "$as_me:$LINENO: checking for gcc flag -Wmissing-prototypes" >&5
-echo $ECHO_N "checking for gcc flag -Wmissing-prototypes... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for gcc flag -Wmissing-prototypes" >&5
+$as_echo_n "checking for gcc flag -Wmissing-prototypes... " >&6; }
     if test "x$GCC" = "xyes"; then
-               $CC -v --help 2>&1 | $EGREP -- '[^[:alnum:]]-Wmissing-prototypes[^[:alnum:]-]' 2>&1 > /dev/null
+               (gcc --help={target,optimizers,warnings,undocumented,params,c} 2>&1 ||
+           $CC -v --help 2>&1) |
+         $EGREP -- '[^[:alnum:]]-Wmissing-prototypes[^[:alnum:]-]' 2>&1 > /dev/null
                if test $? -eq 0; then
            found_warning=yes
-           { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+           { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
        else
            found_warning=no
-           { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+           { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
        fi
     else
        found_warning=no
-       { echo "$as_me:$LINENO: result: no (not using gcc)" >&5
-echo "${ECHO_T}no (not using gcc)" >&6; }
+       { $as_echo "$as_me:$LINENO: result: no (not using gcc)" >&5
+$as_echo "no (not using gcc)" >&6; }
     fi
 
     if test x"$found_warning" = x"yes"; then
@@ -32108,23 +34313,25 @@ echo "${ECHO_T}no (not using gcc)" >&6; }
 
 
 
-    { echo "$as_me:$LINENO: checking for gcc flag -Wstrict-prototypes" >&5
-echo $ECHO_N "checking for gcc flag -Wstrict-prototypes... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for gcc flag -Wstrict-prototypes" >&5
+$as_echo_n "checking for gcc flag -Wstrict-prototypes... " >&6; }
     if test "x$GCC" = "xyes"; then
-               $CC -v --help 2>&1 | $EGREP -- '[^[:alnum:]]-Wstrict-prototypes[^[:alnum:]-]' 2>&1 > /dev/null
+               (gcc --help={target,optimizers,warnings,undocumented,params,c} 2>&1 ||
+           $CC -v --help 2>&1) |
+         $EGREP -- '[^[:alnum:]]-Wstrict-prototypes[^[:alnum:]-]' 2>&1 > /dev/null
                if test $? -eq 0; then
            found_warning=yes
-           { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+           { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
        else
            found_warning=no
-           { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+           { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
        fi
     else
        found_warning=no
-       { echo "$as_me:$LINENO: result: no (not using gcc)" >&5
-echo "${ECHO_T}no (not using gcc)" >&6; }
+       { $as_echo "$as_me:$LINENO: result: no (not using gcc)" >&5
+$as_echo "no (not using gcc)" >&6; }
     fi
 
     if test x"$found_warning" = x"yes"; then
@@ -32140,23 +34347,25 @@ echo "${ECHO_T}no (not using gcc)" >&6; }
 
 
 
-    { echo "$as_me:$LINENO: checking for gcc flag -Wmissing-declarations" >&5
-echo $ECHO_N "checking for gcc flag -Wmissing-declarations... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for gcc flag -Wmissing-declarations" >&5
+$as_echo_n "checking for gcc flag -Wmissing-declarations... " >&6; }
     if test "x$GCC" = "xyes"; then
-               $CC -v --help 2>&1 | $EGREP -- '[^[:alnum:]]-Wmissing-declarations[^[:alnum:]-]' 2>&1 > /dev/null
+               (gcc --help={target,optimizers,warnings,undocumented,params,c} 2>&1 ||
+           $CC -v --help 2>&1) |
+         $EGREP -- '[^[:alnum:]]-Wmissing-declarations[^[:alnum:]-]' 2>&1 > /dev/null
                if test $? -eq 0; then
            found_warning=yes
-           { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+           { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
        else
            found_warning=no
-           { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+           { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
        fi
     else
        found_warning=no
-       { echo "$as_me:$LINENO: result: no (not using gcc)" >&5
-echo "${ECHO_T}no (not using gcc)" >&6; }
+       { $as_echo "$as_me:$LINENO: result: no (not using gcc)" >&5
+$as_echo "no (not using gcc)" >&6; }
     fi
 
     if test x"$found_warning" = x"yes"; then
@@ -32172,23 +34381,25 @@ echo "${ECHO_T}no (not using gcc)" >&6; }
 
 
 
-    { echo "$as_me:$LINENO: checking for gcc flag -Wformat" >&5
-echo $ECHO_N "checking for gcc flag -Wformat... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for gcc flag -Wformat" >&5
+$as_echo_n "checking for gcc flag -Wformat... " >&6; }
     if test "x$GCC" = "xyes"; then
-               $CC -v --help 2>&1 | $EGREP -- '[^[:alnum:]]-Wformat[^[:alnum:]-]' 2>&1 > /dev/null
+               (gcc --help={target,optimizers,warnings,undocumented,params,c} 2>&1 ||
+           $CC -v --help 2>&1) |
+         $EGREP -- '[^[:alnum:]]-Wformat[^[:alnum:]-]' 2>&1 > /dev/null
                if test $? -eq 0; then
            found_warning=yes
-           { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+           { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
        else
            found_warning=no
-           { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+           { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
        fi
     else
        found_warning=no
-       { echo "$as_me:$LINENO: result: no (not using gcc)" >&5
-echo "${ECHO_T}no (not using gcc)" >&6; }
+       { $as_echo "$as_me:$LINENO: result: no (not using gcc)" >&5
+$as_echo "no (not using gcc)" >&6; }
     fi
 
     if test x"$found_warning" = x"yes"; then
@@ -32204,23 +34415,59 @@ echo "${ECHO_T}no (not using gcc)" >&6; }
 
 
 
-    { echo "$as_me:$LINENO: checking for gcc flag -Wsign-compare" >&5
-echo $ECHO_N "checking for gcc flag -Wsign-compare... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for gcc flag -Wformat-security" >&5
+$as_echo_n "checking for gcc flag -Wformat-security... " >&6; }
+    if test "x$GCC" = "xyes"; then
+               (gcc --help={target,optimizers,warnings,undocumented,params,c} 2>&1 ||
+           $CC -v --help 2>&1) |
+         $EGREP -- '[^[:alnum:]]-Wformat-security[^[:alnum:]-]' 2>&1 > /dev/null
+               if test $? -eq 0; then
+           found_warning=yes
+           { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+       else
+           found_warning=no
+           { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+       fi
+    else
+       found_warning=no
+       { $as_echo "$as_me:$LINENO: result: no (not using gcc)" >&5
+$as_echo "no (not using gcc)" >&6; }
+    fi
+
+    if test x"$found_warning" = x"yes"; then
+       AMANDA_WARNING_CFLAGS="$AMANDA_WARNING_CFLAGS -Wformat-security"
+
+
+    else
+       :
+    fi
+
+
+
+
+
+
+    { $as_echo "$as_me:$LINENO: checking for gcc flag -Wsign-compare" >&5
+$as_echo_n "checking for gcc flag -Wsign-compare... " >&6; }
     if test "x$GCC" = "xyes"; then
-               $CC -v --help 2>&1 | $EGREP -- '[^[:alnum:]]-Wsign-compare[^[:alnum:]-]' 2>&1 > /dev/null
+               (gcc --help={target,optimizers,warnings,undocumented,params,c} 2>&1 ||
+           $CC -v --help 2>&1) |
+         $EGREP -- '[^[:alnum:]]-Wsign-compare[^[:alnum:]-]' 2>&1 > /dev/null
                if test $? -eq 0; then
            found_warning=yes
-           { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+           { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
        else
            found_warning=no
-           { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+           { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
        fi
     else
        found_warning=no
-       { echo "$as_me:$LINENO: result: no (not using gcc)" >&5
-echo "${ECHO_T}no (not using gcc)" >&6; }
+       { $as_echo "$as_me:$LINENO: result: no (not using gcc)" >&5
+$as_echo "no (not using gcc)" >&6; }
     fi
 
     if test x"$found_warning" = x"yes"; then
@@ -32236,23 +34483,25 @@ echo "${ECHO_T}no (not using gcc)" >&6; }
 
 
 
-    { echo "$as_me:$LINENO: checking for gcc flag -Wfloat-equal" >&5
-echo $ECHO_N "checking for gcc flag -Wfloat-equal... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for gcc flag -Wfloat-equal" >&5
+$as_echo_n "checking for gcc flag -Wfloat-equal... " >&6; }
     if test "x$GCC" = "xyes"; then
-               $CC -v --help 2>&1 | $EGREP -- '[^[:alnum:]]-Wfloat-equal[^[:alnum:]-]' 2>&1 > /dev/null
+               (gcc --help={target,optimizers,warnings,undocumented,params,c} 2>&1 ||
+           $CC -v --help 2>&1) |
+         $EGREP -- '[^[:alnum:]]-Wfloat-equal[^[:alnum:]-]' 2>&1 > /dev/null
                if test $? -eq 0; then
            found_warning=yes
-           { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+           { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
        else
            found_warning=no
-           { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+           { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
        fi
     else
        found_warning=no
-       { echo "$as_me:$LINENO: result: no (not using gcc)" >&5
-echo "${ECHO_T}no (not using gcc)" >&6; }
+       { $as_echo "$as_me:$LINENO: result: no (not using gcc)" >&5
+$as_echo "no (not using gcc)" >&6; }
     fi
 
     if test x"$found_warning" = x"yes"; then
@@ -32268,23 +34517,25 @@ echo "${ECHO_T}no (not using gcc)" >&6; }
 
 
 
-    { echo "$as_me:$LINENO: checking for gcc flag -Wold-style-definition" >&5
-echo $ECHO_N "checking for gcc flag -Wold-style-definition... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for gcc flag -Wold-style-definition" >&5
+$as_echo_n "checking for gcc flag -Wold-style-definition... " >&6; }
     if test "x$GCC" = "xyes"; then
-               $CC -v --help 2>&1 | $EGREP -- '[^[:alnum:]]-Wold-style-definition[^[:alnum:]-]' 2>&1 > /dev/null
+               (gcc --help={target,optimizers,warnings,undocumented,params,c} 2>&1 ||
+           $CC -v --help 2>&1) |
+         $EGREP -- '[^[:alnum:]]-Wold-style-definition[^[:alnum:]-]' 2>&1 > /dev/null
                if test $? -eq 0; then
            found_warning=yes
-           { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+           { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
        else
            found_warning=no
-           { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+           { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
        fi
     else
        found_warning=no
-       { echo "$as_me:$LINENO: result: no (not using gcc)" >&5
-echo "${ECHO_T}no (not using gcc)" >&6; }
+       { $as_echo "$as_me:$LINENO: result: no (not using gcc)" >&5
+$as_echo "no (not using gcc)" >&6; }
     fi
 
     if test x"$found_warning" = x"yes"; then
@@ -32301,23 +34552,25 @@ echo "${ECHO_T}no (not using gcc)" >&6; }
 
 
 
-    { echo "$as_me:$LINENO: checking for gcc flag -Wstrict-aliasing" >&5
-echo $ECHO_N "checking for gcc flag -Wstrict-aliasing... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for gcc flag -Wstrict-aliasing" >&5
+$as_echo_n "checking for gcc flag -Wstrict-aliasing... " >&6; }
     if test "x$GCC" = "xyes"; then
-               $CC -v --help 2>&1 | $EGREP -- '[^[:alnum:]]-Wstrict-aliasing[^[:alnum:]-]' 2>&1 > /dev/null
+               (gcc --help={target,optimizers,warnings,undocumented,params,c} 2>&1 ||
+           $CC -v --help 2>&1) |
+         $EGREP -- '[^[:alnum:]]-Wstrict-aliasing[^[:alnum:]-]' 2>&1 > /dev/null
                if test $? -eq 0; then
            found_warning=yes
-           { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+           { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
        else
            found_warning=no
-           { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+           { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
        fi
     else
        found_warning=no
-       { echo "$as_me:$LINENO: result: no (not using gcc)" >&5
-echo "${ECHO_T}no (not using gcc)" >&6; }
+       { $as_echo "$as_me:$LINENO: result: no (not using gcc)" >&5
+$as_echo "no (not using gcc)" >&6; }
     fi
 
     if test x"$found_warning" = x"yes"; then
@@ -32334,23 +34587,25 @@ echo "${ECHO_T}no (not using gcc)" >&6; }
 
 
 
-    { echo "$as_me:$LINENO: checking for gcc flag -Wunknown-pragmas" >&5
-echo $ECHO_N "checking for gcc flag -Wunknown-pragmas... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for gcc flag -Wunknown-pragmas" >&5
+$as_echo_n "checking for gcc flag -Wunknown-pragmas... " >&6; }
     if test "x$GCC" = "xyes"; then
-               $CC -v --help 2>&1 | $EGREP -- '[^[:alnum:]]-Wunknown-pragmas[^[:alnum:]-]' 2>&1 > /dev/null
+               (gcc --help={target,optimizers,warnings,undocumented,params,c} 2>&1 ||
+           $CC -v --help 2>&1) |
+         $EGREP -- '[^[:alnum:]]-Wunknown-pragmas[^[:alnum:]-]' 2>&1 > /dev/null
                if test $? -eq 0; then
            found_warning=yes
-           { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+           { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
        else
            found_warning=no
-           { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+           { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
        fi
     else
        found_warning=no
-       { echo "$as_me:$LINENO: result: no (not using gcc)" >&5
-echo "${ECHO_T}no (not using gcc)" >&6; }
+       { $as_echo "$as_me:$LINENO: result: no (not using gcc)" >&5
+$as_echo "no (not using gcc)" >&6; }
     fi
 
     if test x"$found_warning" = x"yes"; then
@@ -32439,10 +34694,10 @@ else
 fi
 
 
-{ echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
-echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
 if test "${lt_cv_path_SED+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   # Loop through the user's path and test for sed and gsed.
 # Then use that list of sed's as ones to test for truncation.
@@ -32493,8 +34748,8 @@ done
 fi
 
 SED=$lt_cv_path_SED
-{ echo "$as_me:$LINENO: result: $SED" >&5
-echo "${ECHO_T}$SED" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $SED" >&5
+$as_echo "$SED" >&6; }
 
 
 # Check whether --with-gnu-ld was given.
@@ -32507,8 +34762,8 @@ fi
 ac_prog=ld
 if test "$GCC" = yes; then
   # Check if gcc -print-prog-name=ld gives a path.
-  { echo "$as_me:$LINENO: checking for ld used by $CC" >&5
-echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&6; }
   case $host in
   *-*-mingw*)
     # gcc leaves a trailing carriage return which upsets mingw
@@ -32537,14 +34792,14 @@ echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; }
     ;;
   esac
 elif test "$with_gnu_ld" = yes; then
-  { echo "$as_me:$LINENO: checking for GNU ld" >&5
-echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
 else
-  { echo "$as_me:$LINENO: checking for non-GNU ld" >&5
-echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
 fi
 if test "${lt_cv_path_LD+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test -z "$LD"; then
   lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
 
 LD="$lt_cv_path_LD"
 if test -n "$LD"; then
-  { echo "$as_me:$LINENO: result: $LD" >&5
-echo "${ECHO_T}$LD" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $LD" >&5
+$as_echo "$LD" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
-test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
-echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+test -z "$LD" && { { $as_echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+$as_echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
    { (exit 1); exit 1; }; }
-{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
-echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
 if test "${lt_cv_prog_gnu_ld+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   # I'd rather use --version here, but apparently some GNU lds only accept -v.
 case `$LD -v 2>&1 </dev/null` in
@@ -32598,20 +34853,20 @@ case `$LD -v 2>&1 </dev/null` in
   ;;
 esac
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
-echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+$as_echo "$lt_cv_prog_gnu_ld" >&6; }
 with_gnu_ld=$lt_cv_prog_gnu_ld
 
 
-{ echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
-echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
+$as_echo_n "checking for $LD option to reload object files... " >&6; }
 if test "${lt_cv_ld_reload_flag+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   lt_cv_ld_reload_flag='-r'
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
-echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
+$as_echo "$lt_cv_ld_reload_flag" >&6; }
 reload_flag=$lt_cv_ld_reload_flag
 case $reload_flag in
 "" | " "*) ;;
@@ -32628,10 +34883,10 @@ case $host_os in
     ;;
 esac
 
-{ echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5
-echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5
+$as_echo_n "checking for BSD-compatible nm... " >&6; }
 if test "${lt_cv_path_NM+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$NM"; then
   # Let the user override the test.
@@ -32670,25 +34925,25 @@ else
   test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
 fi
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5
-echo "${ECHO_T}$lt_cv_path_NM" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5
+$as_echo "$lt_cv_path_NM" >&6; }
 NM="$lt_cv_path_NM"
 
-{ echo "$as_me:$LINENO: checking whether ln -s works" >&5
-echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking whether ln -s works" >&5
+$as_echo_n "checking whether ln -s works... " >&6; }
 LN_S=$as_ln_s
 if test "$LN_S" = "ln -s"; then
-  { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+  { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no, using $LN_S" >&5
-echo "${ECHO_T}no, using $LN_S" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+$as_echo "no, using $LN_S" >&6; }
 fi
 
-{ echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5
-echo $ECHO_N "checking how to recognise dependent libraries... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking how to recognise dependent libraries" >&5
+$as_echo_n "checking how to recognise dependent libraries... " >&6; }
 if test "${lt_cv_deplibs_check_method+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   lt_cv_file_magic_cmd='$MAGIC_CMD'
 lt_cv_file_magic_test_file=
@@ -32857,8 +35112,8 @@ sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7* | sysv4*uw2*)
 esac
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
-echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
+$as_echo "$lt_cv_deplibs_check_method" >&6; }
 file_magic_cmd=$lt_cv_file_magic_cmd
 deplibs_check_method=$lt_cv_deplibs_check_method
 test -z "$deplibs_check_method" && deplibs_check_method=unknown
@@ -32886,7 +35141,7 @@ ia64-*-hpux*)
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; then
     case `/usr/bin/file conftest.$ac_objext` in
     *ELF-32*)
@@ -32901,11 +35156,11 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 32904 "configure"' > conftest.$ac_ext
+  echo '#line 35159 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; then
    if test "$lt_cv_prog_gnu_ld" = yes; then
     case `/usr/bin/file conftest.$ac_objext` in
@@ -32942,7 +35197,7 @@ x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; then
     case `/usr/bin/file conftest.o` in
     *32-bit*)
@@ -32986,10 +35241,10 @@ x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
   SAVE_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS -belf"
-  { echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
-echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
+$as_echo_n "checking whether the C compiler needs -belf... " >&6; }
 if test "${lt_cv_cc_needs_belf+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -33018,26 +35273,30 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   lt_cv_cc_needs_belf=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        lt_cv_cc_needs_belf=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
      ac_ext=c
@@ -33047,8 +35306,8 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
-echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
+$as_echo "$lt_cv_cc_needs_belf" >&6; }
   if test x"$lt_cv_cc_needs_belf" != x"yes"; then
     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
     CFLAGS="$SAVE_CFLAGS"
@@ -33063,20 +35322,21 @@ need_locks="$enable_libtool_lock"
 
 for ac_header in dlfcn.h
 do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+as_ac_Header=`$as_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; }
+  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -33092,32 +35352,33 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -33131,69 +35392,73 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
         test ! -s conftest.err
        }; then
   ac_header_preproc=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&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; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
 
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
+as_val=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -33214,10 +35479,10 @@ if test -z "$CXX"; then
   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; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_prog_CXX+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$CXX"; then
   ac_cv_prog_CXX="$CXX" # Let the user override the test.
@@ -33230,7 +35495,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 fi
 CXX=$ac_cv_prog_CXX
 if test -n "$CXX"; then
-  { echo "$as_me:$LINENO: result: $CXX" >&5
-echo "${ECHO_T}$CXX" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $CXX" >&5
+$as_echo "$CXX" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -33258,10 +35523,10 @@ if test -z "$CXX"; then
 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; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CXX"; then
   ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
@@ -33274,7 +35539,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 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; }
+  { $as_echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
+$as_echo "$ac_ct_CXX" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -33301,12 +35566,8 @@ done
   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;}
+{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
     CXX=$ac_ct_CXX
   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`
+$as_echo "$as_me:$LINENO: checking for C++ compiler version" >&5
+set X $ac_compile
+ac_compiler=$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_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_compiler --version >&5") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_compiler -v >&5") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_compiler -V >&5") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
+$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
 if test "${ac_cv_cxx_compiler_gnu+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -33378,20 +35643,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_cxx_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_compiler_gnu=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_compiler_gnu=no
@@ -33401,15 +35667,19 @@ 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`
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
+$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GXX=yes
+else
+  GXX=
+fi
 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; }
+{ $as_echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
+$as_echo_n "checking whether $CXX accepts -g... " >&6; }
 if test "${ac_cv_prog_cxx_g+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_save_cxx_werror_flag=$ac_cxx_werror_flag
    ac_cxx_werror_flag=yes
@@ -33436,20 +35706,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_cxx_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_prog_cxx_g=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        CXXFLAGS=""
@@ -33474,20 +35745,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_cxx_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   :
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cxx_werror_flag=$ac_save_cxx_werror_flag
@@ -33513,20 +35785,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_cxx_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_prog_cxx_g=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
@@ -33541,8 +35814,8 @@ 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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
+$as_echo "$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
@@ -33566,10 +35839,10 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 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; }
+{ $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
 if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&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
@@ -33657,8 +35930,8 @@ else
 fi
 
 fi
-{ echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5
-echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; }
 CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
 
  if
@@ -33682,11 +35955,11 @@ 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; }
+{ $as_echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5
+$as_echo_n "checking how to run the C++ preprocessor... " >&6; }
 if test -z "$CXXCPP"; then
   if test "${ac_cv_prog_CXXCPP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
       # Double quotes because CXXCPP needs to be expanded
     for CXXCPP in "$CXX -E" "/lib/cpp"
@@ -33718,20 +35991,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
         test ! -s conftest.err
        }; then
   :
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
   # Broken: fails on valid input.
@@ -33755,13 +36029,14 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
         test ! -s conftest.err
@@ -33769,7 +36044,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   # Broken: success on invalid input.
 continue
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
   # Passes both tests.
@@ -33794,8 +36069,8 @@ fi
 else
   ac_cv_prog_CXXCPP=$CXXCPP
 fi
-{ echo "$as_me:$LINENO: result: $CXXCPP" >&5
-echo "${ECHO_T}$CXXCPP" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $CXXCPP" >&5
+$as_echo "$CXXCPP" >&6; }
 ac_preproc_ok=false
 for ac_cxx_preproc_warn_flag in '' yes
 do
@@ -33823,20 +36098,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
         test ! -s conftest.err
        }; then
   :
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
   # Broken: fails on valid input.
@@ -33860,13 +36136,14 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
         test ! -s conftest.err
@@ -33874,7 +36151,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
   # Broken: success on invalid input.
 continue
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
   # Passes both tests.
@@ -33890,11 +36167,13 @@ rm -f conftest.err conftest.$ac_ext
 if $ac_preproc_ok; then
   :
 else
-  { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_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
+$as_echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check
 See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+   { (exit 1); exit 1; }; }; }
 fi
 
 ac_ext=cpp
@@ -33915,10 +36194,10 @@ if test -n "$ac_tool_prefix"; then
   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; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_prog_F77+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$F77"; then
   ac_cv_prog_F77="$F77" # Let the user override the test.
@@ -33931,7 +36210,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_F77="$ac_tool_prefix$ac_prog"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 fi
 F77=$ac_cv_prog_F77
 if test -n "$F77"; then
-  { echo "$as_me:$LINENO: result: $F77" >&5
-echo "${ECHO_T}$F77" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $F77" >&5
+$as_echo "$F77" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -33959,10 +36238,10 @@ if test -z "$F77"; then
 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; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_prog_ac_ct_F77+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_F77"; then
   ac_cv_prog_ac_ct_F77="$ac_ct_F77" # Let the user override the test.
@@ -33975,7 +36254,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_F77="$ac_prog"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 fi
 ac_ct_F77=$ac_cv_prog_ac_ct_F77
 if test -n "$ac_ct_F77"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_F77" >&5
-echo "${ECHO_T}$ac_ct_F77" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $ac_ct_F77" >&5
+$as_echo "$ac_ct_F77" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -34002,12 +36281,8 @@ done
   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;}
+{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
     F77=$ac_ct_F77
 
 
 # Provide some information about the compiler.
-echo "$as_me:$LINENO: checking for Fortran 77 compiler version" >&5
-ac_compiler=`set X $ac_compile; echo $2`
+$as_echo "$as_me:$LINENO: checking for Fortran 77 compiler version" >&5
+set X $ac_compile
+ac_compiler=$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_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_compiler --version >&5") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_compiler -v >&5") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_compiler -V >&5") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }
 rm -f a.out
 
@@ -34054,10 +36333,10 @@ rm -f a.out
 # input file.  (Note that this only needs to work for GNU compilers.)
 ac_save_ext=$ac_ext
 ac_ext=F
-{ echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5
+$as_echo_n "checking whether we are using the GNU Fortran 77 compiler... " >&6; }
 if test "${ac_cv_f77_compiler_gnu+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
       program main
@@ -34073,20 +36352,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_f77_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_compiler_gnu=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_compiler_gnu=no
@@ -34096,16 +36376,16 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_cv_f77_compiler_gnu=$ac_compiler_gnu
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5
+$as_echo "$ac_cv_f77_compiler_gnu" >&6; }
 ac_ext=$ac_save_ext
 ac_test_FFLAGS=${FFLAGS+set}
 ac_save_FFLAGS=$FFLAGS
 FFLAGS=
-{ echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5
-echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5
+$as_echo_n "checking whether $F77 accepts -g... " >&6; }
 if test "${ac_cv_prog_f77_g+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   FFLAGS=-g
 cat >conftest.$ac_ext <<_ACEOF
@@ -34119,20 +36399,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_f77_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_prog_f77_g=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_prog_f77_g=no
@@ -34141,8 +36422,8 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5
-echo "${ECHO_T}$ac_cv_prog_f77_g" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5
+$as_echo "$ac_cv_prog_f77_g" >&6; }
 if test "$ac_test_FFLAGS" = set; then
   FFLAGS=$ac_save_FFLAGS
 elif test $ac_cv_prog_f77_g = yes; then
@@ -34159,7 +36440,11 @@ else
   fi
 fi
 
-G77=`test $ac_compiler_gnu = yes && echo yes`
+if test $ac_compiler_gnu = yes; then
+  G77=yes
+else
+  G77=
+fi
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -34171,10 +36456,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 # Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
 
 # find the maximum length of command line arguments
-{ echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5
-echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5
+$as_echo_n "checking the maximum length of command line arguments... " >&6; }
 if test "${lt_cv_sys_max_cmd_len+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
     i=0
   teststring="ABCD"
@@ -34263,21 +36548,21 @@ else
 fi
 
 if test -n $lt_cv_sys_max_cmd_len ; then
-  { echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5
-echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5
+$as_echo "$lt_cv_sys_max_cmd_len" >&6; }
 else
-  { echo "$as_me:$LINENO: result: none" >&5
-echo "${ECHO_T}none" >&6; }
+  { $as_echo "$as_me:$LINENO: result: none" >&5
+$as_echo "none" >&6; }
 fi
 
 
 
 
 # Check for command to grab the raw symbol name followed by C symbol from nm.
-{ echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5
-echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5
+$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
 if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 # These are sane defaults that work on at least a few old systems.
@@ -34373,14 +36658,14 @@ EOF
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; then
     # Now try to grab the symbols.
     nlist=conftest.nm
     if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5
   (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && test -s "$nlist"; then
       # Try sorting and uniquifying the output.
       if sort "$nlist" | uniq > "$nlist"T; then
@@ -34435,7 +36720,7 @@ EOF
          if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && test -s conftest${ac_exeext}; then
            pipe_works=yes
          fi
@@ -34470,17 +36755,17 @@ if test -z "$lt_cv_sys_global_symbol_pipe"; then
   lt_cv_sys_global_symbol_to_cdecl=
 fi
 if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
-  { echo "$as_me:$LINENO: result: failed" >&5
-echo "${ECHO_T}failed" >&6; }
+  { $as_echo "$as_me:$LINENO: result: failed" >&5
+$as_echo "failed" >&6; }
 else
-  { echo "$as_me:$LINENO: result: ok" >&5
-echo "${ECHO_T}ok" >&6; }
+  { $as_echo "$as_me:$LINENO: result: ok" >&5
+$as_echo "ok" >&6; }
 fi
 
-{ echo "$as_me:$LINENO: checking for objdir" >&5
-echo $ECHO_N "checking for objdir... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for objdir" >&5
+$as_echo_n "checking for objdir... " >&6; }
 if test "${lt_cv_objdir+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   rm -f .libs 2>/dev/null
 mkdir .libs 2>/dev/null
@@ -34492,8 +36777,8 @@ else
 fi
 rmdir .libs 2>/dev/null
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5
-echo "${ECHO_T}$lt_cv_objdir" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5
+$as_echo "$lt_cv_objdir" >&6; }
 objdir=$lt_cv_objdir
 
 
@@ -34544,10 +36829,10 @@ with_gnu_ld="$lt_cv_prog_gnu_ld"
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ar; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_prog_AR+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$AR"; then
   ac_cv_prog_AR="$AR" # Let the user override the test.
@@ -34560,7 +36845,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_AR="${ac_tool_prefix}ar"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 fi
 AR=$ac_cv_prog_AR
 if test -n "$AR"; then
-  { echo "$as_me:$LINENO: result: $AR" >&5
-echo "${ECHO_T}$AR" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $AR" >&5
+$as_echo "$AR" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -34584,10 +36869,10 @@ if test -z "$ac_cv_prog_AR"; then
   ac_ct_AR=$AR
   # Extract the first word of "ar", so it can be a program name with args.
 set dummy ar; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_AR"; then
   ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
@@ -34600,7 +36885,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_AR="ar"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 fi
 ac_ct_AR=$ac_cv_prog_ac_ct_AR
 if test -n "$ac_ct_AR"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
-echo "${ECHO_T}$ac_ct_AR" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
+$as_echo "$ac_ct_AR" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
   if test "x$ac_ct_AR" = x; then
   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;}
+{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
     AR=$ac_ct_AR
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_prog_RANLIB+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$RANLIB"; then
   ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
@@ -34656,7 +36937,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 fi
 RANLIB=$ac_cv_prog_RANLIB
 if test -n "$RANLIB"; then
-  { echo "$as_me:$LINENO: result: $RANLIB" >&5
-echo "${ECHO_T}$RANLIB" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $RANLIB" >&5
+$as_echo "$RANLIB" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -34680,10 +36961,10 @@ if test -z "$ac_cv_prog_RANLIB"; then
   ac_ct_RANLIB=$RANLIB
   # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_RANLIB"; then
   ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
@@ -34696,7 +36977,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_RANLIB="ranlib"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 fi
 ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
 if test -n "$ac_ct_RANLIB"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
-echo "${ECHO_T}$ac_ct_RANLIB" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+$as_echo "$ac_ct_RANLIB" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
   if test "x$ac_ct_RANLIB" = x; then
   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;}
+{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
     RANLIB=$ac_ct_RANLIB
 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; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_prog_STRIP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$STRIP"; then
   ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
@@ -34752,7 +37029,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 fi
 STRIP=$ac_cv_prog_STRIP
 if test -n "$STRIP"; then
-  { echo "$as_me:$LINENO: result: $STRIP" >&5
-echo "${ECHO_T}$STRIP" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -34776,10 +37053,10 @@ 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; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_STRIP"; then
   ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
@@ -34792,7 +37069,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 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; }
+  { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
   if test "x$ac_ct_STRIP" = x; then
   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;}
+{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
     STRIP=$ac_ct_STRIP
@@ -34882,10 +37155,10 @@ cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
 case $deplibs_check_method in
 file_magic*)
   if test "$file_magic_cmd" = '$MAGIC_CMD'; then
-    { echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
-echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
+$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
 if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $MAGIC_CMD in
 [\\/*] |  ?:[\\/]*)
 
 MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
 if test -n "$MAGIC_CMD"; then
-  { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
-echo "${ECHO_T}$MAGIC_CMD" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 if test -z "$lt_cv_path_MAGIC_CMD"; then
   if test -n "$ac_tool_prefix"; then
-    { echo "$as_me:$LINENO: checking for file" >&5
-echo $ECHO_N "checking for file... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for file" >&5
+$as_echo_n "checking for file... " >&6; }
 if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $MAGIC_CMD in
 [\\/*] |  ?:[\\/]*)
 
 MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
 if test -n "$MAGIC_CMD"; then
-  { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
-echo "${ECHO_T}$MAGIC_CMD" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
   else
@@ -35091,8 +37364,8 @@ if test "$GCC" = no; then
 fi
 if test -n "$lt_prog_cc_shlib"; then
 
-    { echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&5
-echo "$as_me: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&5
+$as_echo "$as_me: WARNING: \`$CC' requires \`$lt_prog_cc_shlib' to build shared libraries" >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
@@ -35103,8 +37376,8 @@ AAW_EOF
   if echo "$old_CC $old_CFLAGS " | grep "[     ]$lt_prog_cc_shlib[     ]" >/dev/null; then :
   else
 
-    { echo "$as_me:$LINENO: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5
-echo "$as_me: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5
+$as_echo "$as_me: WARNING: add \`$lt_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
 #
 # Check to make sure the static flag actually works.
 #
-{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_prog_compiler_static works" >&5
-echo $ECHO_N "checking if $compiler static flag $lt_prog_compiler_static works... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking if $compiler static flag $lt_prog_compiler_static works" >&5
+$as_echo_n "checking if $compiler static flag $lt_prog_compiler_static works... " >&6; }
 if test "${lt_prog_compiler_static_works+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   lt_prog_compiler_static_works=no
    save_LDFLAGS="$LDFLAGS"
@@ -35148,8 +37421,8 @@ else
    LDFLAGS="$save_LDFLAGS"
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5
-echo "${ECHO_T}$lt_prog_compiler_static_works" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5
+$as_echo "$lt_prog_compiler_static_works" >&6; }
 
 if test x"$lt_prog_compiler_static_works" = xyes; then
     :
@@ -35170,10 +37443,10 @@ if test "$GCC" = yes; then
   lt_prog_compiler_no_builtin_flag=' -fno-builtin'
 
 
-{ echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
-echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
 if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_rtti_exceptions=no
   ac_outfile=conftest.$ac_objext
@@ -35188,11 +37461,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:35191: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:37464: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:35195: \$? = $ac_status" >&5
+   echo "$as_me:37468: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -35205,8 +37478,8 @@ else
    $rm conftest*
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; }
 
 if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
     lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
@@ -35220,8 +37493,8 @@ lt_prog_compiler_wl=
 lt_prog_compiler_pic=
 lt_prog_compiler_static=
 
-{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
-echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
 
   if test "$GCC" = yes; then
     lt_prog_compiler_wl='-Wl,'
@@ -35424,18 +37697,18 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
     esac
   fi
 
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5
+$as_echo "$lt_prog_compiler_pic" >&6; }
 
 #
 # Check to make sure the PIC flag actually works.
 #
 if test -n "$lt_prog_compiler_pic"; then
 
-{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
-echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
 if test "${lt_prog_compiler_pic_works+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   lt_prog_compiler_pic_works=no
   ac_outfile=conftest.$ac_objext
@@ -35450,11 +37723,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:35453: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:37726: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:35457: \$? = $ac_status" >&5
+   echo "$as_me:37730: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -35467,8 +37740,8 @@ else
    $rm conftest*
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5
+$as_echo "$lt_prog_compiler_pic_works" >&6; }
 
 if test x"$lt_prog_compiler_pic_works" = xyes; then
     case $lt_prog_compiler_pic in
@@ -35491,10 +37764,10 @@ case $host_os in
     ;;
 esac
 
-{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
-echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
 if test "${lt_cv_prog_compiler_c_o+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_c_o=no
    $rm -r conftest 2>/dev/null
@@ -35512,11 +37785,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:35515: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:37788: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:35519: \$? = $ac_status" >&5
+   echo "$as_me:37792: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -35538,27 +37811,27 @@ else
    $rm conftest*
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
 
 
 hard_links="nottested"
 if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
   # do not overwrite the value of need_locks provided by the user
-  { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
-echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
   hard_links=yes
   $rm conftest*
   ln conftest.a conftest.b 2>/dev/null && hard_links=no
   touch conftest.a
   ln conftest.a conftest.b 2>&5 || hard_links=no
   ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  { echo "$as_me:$LINENO: result: $hard_links" >&5
-echo "${ECHO_T}$hard_links" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
   if test "$hard_links" = no; then
 
-    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
-echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
@@ -35572,8 +37845,8 @@ else
   need_locks=no
 fi
 
-{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
-echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
 
   runpath_var=
   allow_undefined_flag=
@@ -35945,18 +38218,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
 
 aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
 }'`
@@ -35964,12 +38240,13 @@ aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File S
 if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
 }'`; fi
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
@@ -36004,18 +38281,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
 
 aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
 }'`
@@ -36023,12 +38303,13 @@ aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File S
 if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
 }'`; fi
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
@@ -36474,8 +38755,8 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
     esac
   fi
 
-{ echo "$as_me:$LINENO: result: $ld_shlibs" >&5
-echo "${ECHO_T}$ld_shlibs" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ld_shlibs" >&5
+$as_echo "$ld_shlibs" >&6; }
 test "$ld_shlibs" = no && can_build_shared=no
 
 variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
@@ -36500,15 +38781,15 @@ x|xyes)
       # Test whether the compiler implicitly links with -lc since on some
       # systems, -lgcc has to come before -lc. If gcc already passes -lc
       # to ld, don't add -lc before -lgcc.
-      { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
-echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+      { $as_echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
       $rm conftest*
       printf "$lt_simple_compile_test_code" > conftest.$ac_ext
 
       if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } 2>conftest.err; then
         soname=conftest
         lib=conftest
@@ -36525,7 +38806,7 @@ echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&
         if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
   (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }
         then
          archive_cmds_need_lc=no
@@ -36537,16 +38818,16 @@ echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&
         cat conftest.err 1>&5
       fi
       $rm conftest*
-      { echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5
-echo "${ECHO_T}$archive_cmds_need_lc" >&6; }
+      { $as_echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5
+$as_echo "$archive_cmds_need_lc" >&6; }
       ;;
     esac
   fi
   ;;
 esac
 
-{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
-echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
 library_names_spec=
 libname_spec='lib$name'
 soname_spec=
@@ -37099,12 +39380,12 @@ uts4*)
   dynamic_linker=no
   ;;
 esac
-{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
-echo "${ECHO_T}$dynamic_linker" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
 test "$dynamic_linker" = no && can_build_shared=no
 
-{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
-echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
 hardcode_action=
 if test -n "$hardcode_libdir_flag_spec" || \
    test -n "$runpath_var" || \
@@ -37128,8 +39409,8 @@ else
   # directories.
   hardcode_action=unsupported
 fi
-{ echo "$as_me:$LINENO: result: $hardcode_action" >&5
-echo "${ECHO_T}$hardcode_action" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $hardcode_action" >&5
+$as_echo "$hardcode_action" >&6; }
 
 if test "$hardcode_action" = relink; then
   # Fast installation is not supported
 
 striplib=
 old_striplib=
-{ echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
-echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
+$as_echo_n "checking whether stripping libraries is possible... " >&6; }
 if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
   test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
   test -z "$striplib" && striplib="$STRIP --strip-unneeded"
-  { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+  { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
 else
 # FIXME - insert some real tests, host_os isn't really good enough
   case $host_os in
    darwin*)
        if test -n "$STRIP" ; then
          striplib="$STRIP -x"
-         { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+         { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
        else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
        ;;
    *)
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
     ;;
   esac
 fi
@@ -37196,10 +39477,10 @@ else
 
   darwin*)
   # if libdl is installed we need to link against it
-    { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
-echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
 if test "${ac_cv_lib_dl_dlopen+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldl  $LIBS"
@@ -37231,33 +39512,37 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_dl_dlopen=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_dl_dlopen=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
-if test $ac_cv_lib_dl_dlopen = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = x""yes; then
   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
 else
 
    ;;
 
   *)
-    { echo "$as_me:$LINENO: checking for shl_load" >&5
-echo $ECHO_N "checking for shl_load... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for shl_load" >&5
+$as_echo_n "checking for shl_load... " >&6; }
 if test "${ac_cv_func_shl_load+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -37326,38 +39611,42 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_func_shl_load=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_func_shl_load=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
-echo "${ECHO_T}$ac_cv_func_shl_load" >&6; }
-if test $ac_cv_func_shl_load = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
+$as_echo "$ac_cv_func_shl_load" >&6; }
+if test "x$ac_cv_func_shl_load" = x""yes; then
   lt_cv_dlopen="shl_load"
 else
-  { echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
-echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+$as_echo_n "checking for shl_load in -ldld... " >&6; }
 if test "${ac_cv_lib_dld_shl_load+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldld  $LIBS"
@@ -37389,39 +39678,43 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_dld_shl_load=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_dld_shl_load=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
-echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6; }
-if test $ac_cv_lib_dld_shl_load = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+$as_echo "$ac_cv_lib_dld_shl_load" >&6; }
+if test "x$ac_cv_lib_dld_shl_load" = x""yes; then
   lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"
 else
-  { echo "$as_me:$LINENO: checking for dlopen" >&5
-echo $ECHO_N "checking for dlopen... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for dlopen" >&5
+$as_echo_n "checking for dlopen... " >&6; }
 if test "${ac_cv_func_dlopen+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -37474,38 +39767,42 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_func_dlopen=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_func_dlopen=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
-echo "${ECHO_T}$ac_cv_func_dlopen" >&6; }
-if test $ac_cv_func_dlopen = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
+$as_echo "$ac_cv_func_dlopen" >&6; }
+if test "x$ac_cv_func_dlopen" = x""yes; then
   lt_cv_dlopen="dlopen"
 else
-  { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
-echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
 if test "${ac_cv_lib_dl_dlopen+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldl  $LIBS"
@@ -37537,39 +39834,43 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_dl_dlopen=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_dl_dlopen=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
-if test $ac_cv_lib_dl_dlopen = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = x""yes; then
   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
 else
-  { echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
-echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
+$as_echo_n "checking for dlopen in -lsvld... " >&6; }
 if test "${ac_cv_lib_svld_dlopen+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lsvld  $LIBS"
@@ -37601,39 +39902,43 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_svld_dlopen=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_svld_dlopen=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6; }
-if test $ac_cv_lib_svld_dlopen = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
+$as_echo "$ac_cv_lib_svld_dlopen" >&6; }
+if test "x$ac_cv_lib_svld_dlopen" = x""yes; then
   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
 else
-  { echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
-echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
+$as_echo_n "checking for dld_link in -ldld... " >&6; }
 if test "${ac_cv_lib_dld_dld_link+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldld  $LIBS"
@@ -37665,33 +39970,37 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_dld_dld_link=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_dld_dld_link=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
-echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6; }
-if test $ac_cv_lib_dld_dld_link = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
+$as_echo "$ac_cv_lib_dld_dld_link" >&6; }
+if test "x$ac_cv_lib_dld_dld_link" = x""yes; then
   lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"
 fi
 
     save_LIBS="$LIBS"
     LIBS="$lt_cv_dlopen_libs $LIBS"
 
-    { echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
-echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
+$as_echo_n "checking whether a program can dlopen itself... " >&6; }
 if test "${lt_cv_dlopen_self+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
          if test "$cross_compiling" = yes; then :
   lt_cv_dlopen_self=cross
@@ -37741,7 +40050,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 37744 "configure"
+#line 40053 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -37805,7 +40114,7 @@ EOF
   if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
     (./conftest; exit; ) >&5 2>/dev/null
     lt_status=$?
@@ -37823,15 +40132,15 @@ rm -fr conftest*
 
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
-echo "${ECHO_T}$lt_cv_dlopen_self" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
+$as_echo "$lt_cv_dlopen_self" >&6; }
 
     if test "x$lt_cv_dlopen_self" = xyes; then
       LDFLAGS="$LDFLAGS $link_static_flag"
-      { echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
-echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6; }
+      { $as_echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
+$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
 if test "${lt_cv_dlopen_self_static+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
          if test "$cross_compiling" = yes; then :
   lt_cv_dlopen_self_static=cross
@@ -37839,7 +40148,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 37842 "configure"
+#line 40151 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -37903,7 +40212,7 @@ EOF
   if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
     (./conftest; exit; ) >&5 2>/dev/null
     lt_status=$?
@@ -37921,8 +40230,8 @@ rm -fr conftest*
 
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
-echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
+$as_echo "$lt_cv_dlopen_self_static" >&6; }
     fi
 
     CPPFLAGS="$save_CPPFLAGS"
 
 
 # Report which librarie types wil actually be built
-{ echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
-echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; }
-{ echo "$as_me:$LINENO: result: $can_build_shared" >&5
-echo "${ECHO_T}$can_build_shared" >&6; }
+{ $as_echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
+$as_echo_n "checking if libtool supports shared libraries... " >&6; }
+{ $as_echo "$as_me:$LINENO: result: $can_build_shared" >&5
+$as_echo "$can_build_shared" >&6; }
 
-{ echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
-echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
+$as_echo_n "checking whether to build shared libraries... " >&6; }
 test "$can_build_shared" = "no" && enable_shared=no
 
 # On AIX, shared libraries and static libraries use the same namespace, and
@@ -37970,15 +40279,15 @@ aix4* | aix5*)
   fi
     ;;
 esac
-{ echo "$as_me:$LINENO: result: $enable_shared" >&5
-echo "${ECHO_T}$enable_shared" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $enable_shared" >&5
+$as_echo "$enable_shared" >&6; }
 
-{ echo "$as_me:$LINENO: checking whether to build static libraries" >&5
-echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking whether to build static libraries" >&5
+$as_echo_n "checking whether to build static libraries... " >&6; }
 # Make sure either enable_shared or enable_static is yes.
 test "$enable_shared" = yes || enable_static=yes
-{ echo "$as_me:$LINENO: result: $enable_static" >&5
-echo "${ECHO_T}$enable_static" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $enable_static" >&5
+$as_echo "$enable_static" >&6; }
 
 # The else clause should only fire when bootstrapping the
 # libtool distribution, otherwise you forgot to ship ltmain.sh
@@ -38069,8 +40378,8 @@ if test -f "$ltmain"; then
 cfgfile="${ofile}T"
   trap "$rm \"$cfgfile\"; exit 1" 1 2 15
   $rm -f "$cfgfile"
-  { echo "$as_me:$LINENO: creating $ofile" >&5
-echo "$as_me: creating $ofile" >&6;}
+  { $as_echo "$as_me:$LINENO: creating $ofile" >&5
+$as_echo "$as_me: creating $ofile" >&6;}
 
   cat <<__EOF__ >> "$cfgfile"
 #! $SHELL
@@ -38476,8 +40785,8 @@ fi
 if test -f "$ltmain" && test -n "$tagnames"; then
   if test ! -f "${ofile}"; then
 
-    { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5
-echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5
+$as_echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
@@ -38491,8 +40800,8 @@ AAW_EOF
     eval "`$SHELL ${ofile} --config | grep '^LTCC='`"
     if test -z "$LTCC"; then
 
-    { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5
-echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5
+$as_echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
@@ -38502,8 +40811,8 @@ AAW_EOF
 
     else
 
-    { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5
-echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5
+$as_echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
@@ -38524,16 +40833,16 @@ AAW_EOF
     # Check whether tagname contains only valid characters
     case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in
     "") ;;
-    *)  { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5
-echo "$as_me: error: invalid tag name: $tagname" >&2;}
+    *)  { { $as_echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5
+$as_echo "$as_me: error: invalid tag name: $tagname" >&2;}
    { (exit 1); exit 1; }; }
        ;;
     esac
 
     if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null
     then
-      { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5
-echo "$as_me: error: tag name \"$tagname\" already exists" >&2;}
+      { { $as_echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5
+$as_echo "$as_me: error: tag name \"$tagname\" already exists" >&2;}
    { (exit 1); exit 1; }; }
     fi
 
@@ -38671,8 +40980,8 @@ fi
 ac_prog=ld
 if test "$GCC" = yes; then
   # Check if gcc -print-prog-name=ld gives a path.
-  { echo "$as_me:$LINENO: checking for ld used by $CC" >&5
-echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&6; }
   case $host in
   *-*-mingw*)
     # gcc leaves a trailing carriage return which upsets mingw
@@ -38701,14 +41010,14 @@ echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; }
     ;;
   esac
 elif test "$with_gnu_ld" = yes; then
-  { echo "$as_me:$LINENO: checking for GNU ld" >&5
-echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
 else
-  { echo "$as_me:$LINENO: checking for non-GNU ld" >&5
-echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
 fi
 if test "${lt_cv_path_LD+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test -z "$LD"; then
   lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
 
 LD="$lt_cv_path_LD"
 if test -n "$LD"; then
-  { echo "$as_me:$LINENO: result: $LD" >&5
-echo "${ECHO_T}$LD" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $LD" >&5
+$as_echo "$LD" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
-test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
-echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+test -z "$LD" && { { $as_echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+$as_echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
    { (exit 1); exit 1; }; }
-{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
-echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
 if test "${lt_cv_prog_gnu_ld+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   # I'd rather use --version here, but apparently some GNU lds only accept -v.
 case `$LD -v 2>&1 </dev/null` in
@@ -38762,8 +41071,8 @@ case `$LD -v 2>&1 </dev/null` in
   ;;
 esac
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
-echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+$as_echo "$lt_cv_prog_gnu_ld" >&6; }
 with_gnu_ld=$lt_cv_prog_gnu_ld
 
 
@@ -38813,8 +41122,8 @@ else
 fi
 
 # PORTME: fill in a description of your system's C++ link characteristics
-{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
-echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
 ld_shlibs_CXX=yes
 case $host_os in
   aix3*)
@@ -38929,18 +41238,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_cxx_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
 
 aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
 }'`
@@ -38948,12 +41260,13 @@ aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File S
 if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
 }'`; fi
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
@@ -38989,18 +41302,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_cxx_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
 
 aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
 }'`
@@ -39008,12 +41324,13 @@ aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File S
 if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
 }'`; fi
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
@@ -39702,8 +42019,8 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
     ld_shlibs_CXX=no
     ;;
 esac
-{ echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
-echo "${ECHO_T}$ld_shlibs_CXX" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
+$as_echo "$ld_shlibs_CXX" >&6; }
 test "$ld_shlibs_CXX" = no && can_build_shared=no
 
 GCC_CXX="$GXX"
@@ -39727,7 +42044,7 @@ EOF
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; then
   # Parse the compiler output and extract the necessary
   # objects, libraries and library flags.
@@ -39837,8 +42154,8 @@ lt_prog_compiler_wl_CXX=
 lt_prog_compiler_pic_CXX=
 lt_prog_compiler_static_CXX=
 
-{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
-echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
 
   # C++ specific cases for pic, static, wl, etc.
   if test "$GXX" = yes; then
@@ -40112,18 +42429,18 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
     esac
   fi
 
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5
+$as_echo "$lt_prog_compiler_pic_CXX" >&6; }
 
 #
 # Check to make sure the PIC flag actually works.
 #
 if test -n "$lt_prog_compiler_pic_CXX"; then
 
-{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5
-echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; }
 if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   lt_prog_compiler_pic_works_CXX=no
   ac_outfile=conftest.$ac_objext
@@ -40138,11 +42455,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:40141: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:42458: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:40145: \$? = $ac_status" >&5
+   echo "$as_me:42462: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -40155,8 +42472,8 @@ else
    $rm conftest*
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5
+$as_echo "$lt_prog_compiler_pic_works_CXX" >&6; }
 
 if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then
     case $lt_prog_compiler_pic_CXX in
@@ -40179,10 +42496,10 @@ case $host_os in
     ;;
 esac
 
-{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
-echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
 if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_c_o_CXX=no
    $rm -r conftest 2>/dev/null
@@ -40200,11 +42517,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:40203: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:42520: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:40207: \$? = $ac_status" >&5
+   echo "$as_me:42524: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -40226,27 +42543,27 @@ else
    $rm conftest*
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; }
 
 
 hard_links="nottested"
 if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then
   # do not overwrite the value of need_locks provided by the user
-  { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
-echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
   hard_links=yes
   $rm conftest*
   ln conftest.a conftest.b 2>/dev/null && hard_links=no
   touch conftest.a
   ln conftest.a conftest.b 2>&5 || hard_links=no
   ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  { echo "$as_me:$LINENO: result: $hard_links" >&5
-echo "${ECHO_T}$hard_links" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
   if test "$hard_links" = no; then
 
-    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
-echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
@@ -40260,8 +42577,8 @@ else
   need_locks=no
 fi
 
-{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
-echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
 
   export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
   case $host_os in
@@ -40285,8 +42602,8 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar
   ;;
   esac
 
-{ echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
-echo "${ECHO_T}$ld_shlibs_CXX" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
+$as_echo "$ld_shlibs_CXX" >&6; }
 test "$ld_shlibs_CXX" = no && can_build_shared=no
 
 variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
@@ -40311,15 +42628,15 @@ x|xyes)
       # Test whether the compiler implicitly links with -lc since on some
       # systems, -lgcc has to come before -lc. If gcc already passes -lc
       # to ld, don't add -lc before -lgcc.
-      { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
-echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+      { $as_echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
       $rm conftest*
       printf "$lt_simple_compile_test_code" > conftest.$ac_ext
 
       if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } 2>conftest.err; then
         soname=conftest
         lib=conftest
@@ -40336,7 +42653,7 @@ echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&
         if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
   (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }
         then
          archive_cmds_need_lc_CXX=no
@@ -40348,16 +42665,16 @@ echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&
         cat conftest.err 1>&5
       fi
       $rm conftest*
-      { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5
-echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6; }
+      { $as_echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5
+$as_echo "$archive_cmds_need_lc_CXX" >&6; }
       ;;
     esac
   fi
   ;;
 esac
 
-{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
-echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
 library_names_spec=
 libname_spec='lib$name'
 soname_spec=
@@ -40910,12 +43227,12 @@ uts4*)
   dynamic_linker=no
   ;;
 esac
-{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
-echo "${ECHO_T}$dynamic_linker" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
 test "$dynamic_linker" = no && can_build_shared=no
 
-{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
-echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
 hardcode_action_CXX=
 if test -n "$hardcode_libdir_flag_spec_CXX" || \
    test -n "$runpath_var_CXX" || \
@@ -40939,8 +43256,8 @@ else
   # directories.
   hardcode_action_CXX=unsupported
 fi
-{ echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5
-echo "${ECHO_T}$hardcode_action_CXX" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5
+$as_echo "$hardcode_action_CXX" >&6; }
 
 if test "$hardcode_action_CXX" = relink; then
   # Fast installation is not supported
 
 striplib=
 old_striplib=
-{ echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
-echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
+$as_echo_n "checking whether stripping libraries is possible... " >&6; }
 if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
   test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
   test -z "$striplib" && striplib="$STRIP --strip-unneeded"
-  { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+  { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
 else
 # FIXME - insert some real tests, host_os isn't really good enough
   case $host_os in
    darwin*)
        if test -n "$STRIP" ; then
          striplib="$STRIP -x"
-         { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+         { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
        else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
        ;;
    *)
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
     ;;
   esac
 fi
@@ -41007,10 +43324,10 @@ else
 
   darwin*)
   # if libdl is installed we need to link against it
-    { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
-echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
 if test "${ac_cv_lib_dl_dlopen+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldl  $LIBS"
@@ -41042,33 +43359,37 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_cxx_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_dl_dlopen=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_dl_dlopen=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
-if test $ac_cv_lib_dl_dlopen = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = x""yes; then
   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
 else
 
    ;;
 
   *)
-    { echo "$as_me:$LINENO: checking for shl_load" >&5
-echo $ECHO_N "checking for shl_load... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for shl_load" >&5
+$as_echo_n "checking for shl_load... " >&6; }
 if test "${ac_cv_func_shl_load+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -41137,38 +43458,42 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_cxx_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_func_shl_load=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_func_shl_load=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
-echo "${ECHO_T}$ac_cv_func_shl_load" >&6; }
-if test $ac_cv_func_shl_load = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
+$as_echo "$ac_cv_func_shl_load" >&6; }
+if test "x$ac_cv_func_shl_load" = x""yes; then
   lt_cv_dlopen="shl_load"
 else
-  { echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
-echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+$as_echo_n "checking for shl_load in -ldld... " >&6; }
 if test "${ac_cv_lib_dld_shl_load+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldld  $LIBS"
@@ -41200,39 +43525,43 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_cxx_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_dld_shl_load=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_dld_shl_load=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
-echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6; }
-if test $ac_cv_lib_dld_shl_load = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+$as_echo "$ac_cv_lib_dld_shl_load" >&6; }
+if test "x$ac_cv_lib_dld_shl_load" = x""yes; then
   lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"
 else
-  { echo "$as_me:$LINENO: checking for dlopen" >&5
-echo $ECHO_N "checking for dlopen... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for dlopen" >&5
+$as_echo_n "checking for dlopen... " >&6; }
 if test "${ac_cv_func_dlopen+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -41285,38 +43614,42 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_cxx_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_func_dlopen=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_func_dlopen=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
-echo "${ECHO_T}$ac_cv_func_dlopen" >&6; }
-if test $ac_cv_func_dlopen = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
+$as_echo "$ac_cv_func_dlopen" >&6; }
+if test "x$ac_cv_func_dlopen" = x""yes; then
   lt_cv_dlopen="dlopen"
 else
-  { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
-echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
 if test "${ac_cv_lib_dl_dlopen+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldl  $LIBS"
@@ -41348,39 +43681,43 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_cxx_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_dl_dlopen=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_dl_dlopen=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
-if test $ac_cv_lib_dl_dlopen = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = x""yes; then
   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
 else
-  { echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
-echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
+$as_echo_n "checking for dlopen in -lsvld... " >&6; }
 if test "${ac_cv_lib_svld_dlopen+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lsvld  $LIBS"
@@ -41412,39 +43749,43 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_cxx_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_svld_dlopen=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_svld_dlopen=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6; }
-if test $ac_cv_lib_svld_dlopen = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
+$as_echo "$ac_cv_lib_svld_dlopen" >&6; }
+if test "x$ac_cv_lib_svld_dlopen" = x""yes; then
   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
 else
-  { echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
-echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
+$as_echo_n "checking for dld_link in -ldld... " >&6; }
 if test "${ac_cv_lib_dld_dld_link+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldld  $LIBS"
@@ -41476,33 +43817,37 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_cxx_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_dld_dld_link=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_dld_dld_link=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
-echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6; }
-if test $ac_cv_lib_dld_dld_link = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
+$as_echo "$ac_cv_lib_dld_dld_link" >&6; }
+if test "x$ac_cv_lib_dld_dld_link" = x""yes; then
   lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"
 fi
 
     save_LIBS="$LIBS"
     LIBS="$lt_cv_dlopen_libs $LIBS"
 
-    { echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
-echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
+$as_echo_n "checking whether a program can dlopen itself... " >&6; }
 if test "${lt_cv_dlopen_self+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
          if test "$cross_compiling" = yes; then :
   lt_cv_dlopen_self=cross
@@ -41552,7 +43897,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 41555 "configure"
+#line 43900 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -41616,7 +43961,7 @@ EOF
   if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
     (./conftest; exit; ) >&5 2>/dev/null
     lt_status=$?
@@ -41634,15 +43979,15 @@ rm -fr conftest*
 
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
-echo "${ECHO_T}$lt_cv_dlopen_self" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
+$as_echo "$lt_cv_dlopen_self" >&6; }
 
     if test "x$lt_cv_dlopen_self" = xyes; then
       LDFLAGS="$LDFLAGS $link_static_flag"
-      { echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
-echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6; }
+      { $as_echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
+$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
 if test "${lt_cv_dlopen_self_static+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
          if test "$cross_compiling" = yes; then :
   lt_cv_dlopen_self_static=cross
@@ -41650,7 +43995,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 41653 "configure"
+#line 43998 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -41714,7 +44059,7 @@ EOF
   if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
     (./conftest; exit; ) >&5 2>/dev/null
     lt_status=$?
@@ -41732,8 +44077,8 @@ rm -fr conftest*
 
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
-echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
+$as_echo "$lt_cv_dlopen_self_static" >&6; }
     fi
 
     CPPFLAGS="$save_CPPFLAGS"
@@ -42261,13 +44606,13 @@ done
 cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
 
 
-{ echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
-echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; }
-{ echo "$as_me:$LINENO: result: $can_build_shared" >&5
-echo "${ECHO_T}$can_build_shared" >&6; }
+{ $as_echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
+$as_echo_n "checking if libtool supports shared libraries... " >&6; }
+{ $as_echo "$as_me:$LINENO: result: $can_build_shared" >&5
+$as_echo "$can_build_shared" >&6; }
 
-{ echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
-echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
+$as_echo_n "checking whether to build shared libraries... " >&6; }
 test "$can_build_shared" = "no" && enable_shared=no
 
 # On AIX, shared libraries and static libraries use the same namespace, and
@@ -42286,15 +44631,15 @@ aix4* | aix5*)
   fi
   ;;
 esac
-{ echo "$as_me:$LINENO: result: $enable_shared" >&5
-echo "${ECHO_T}$enable_shared" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $enable_shared" >&5
+$as_echo "$enable_shared" >&6; }
 
-{ echo "$as_me:$LINENO: checking whether to build static libraries" >&5
-echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking whether to build static libraries" >&5
+$as_echo_n "checking whether to build static libraries... " >&6; }
 # Make sure either enable_shared or enable_static is yes.
 test "$enable_shared" = yes || enable_static=yes
-{ echo "$as_me:$LINENO: result: $enable_static" >&5
-echo "${ECHO_T}$enable_static" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $enable_static" >&5
+$as_echo "$enable_static" >&6; }
 
 test "$ld_shlibs_F77" = no && can_build_shared=no
 
@@ -42305,8 +44650,8 @@ lt_prog_compiler_wl_F77=
 lt_prog_compiler_pic_F77=
 lt_prog_compiler_static_F77=
 
-{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
-echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
 
   if test "$GCC" = yes; then
     lt_prog_compiler_wl_F77='-Wl,'
@@ -42509,18 +44854,18 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
     esac
   fi
 
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5
+$as_echo "$lt_prog_compiler_pic_F77" >&6; }
 
 #
 # Check to make sure the PIC flag actually works.
 #
 if test -n "$lt_prog_compiler_pic_F77"; then
 
-{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5
-echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... " >&6; }
 if test "${lt_prog_compiler_pic_works_F77+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   lt_prog_compiler_pic_works_F77=no
   ac_outfile=conftest.$ac_objext
@@ -42535,11 +44880,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:42538: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:44883: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:42542: \$? = $ac_status" >&5
+   echo "$as_me:44887: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -42552,8 +44897,8 @@ else
    $rm conftest*
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5
+$as_echo "$lt_prog_compiler_pic_works_F77" >&6; }
 
 if test x"$lt_prog_compiler_pic_works_F77" = xyes; then
     case $lt_prog_compiler_pic_F77 in
@@ -42576,10 +44921,10 @@ case $host_os in
     ;;
 esac
 
-{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
-echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
 if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_c_o_F77=no
    $rm -r conftest 2>/dev/null
@@ -42597,11 +44942,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:42600: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:44945: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:42604: \$? = $ac_status" >&5
+   echo "$as_me:44949: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -42623,27 +44968,27 @@ else
    $rm conftest*
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5
+$as_echo "$lt_cv_prog_compiler_c_o_F77" >&6; }
 
 
 hard_links="nottested"
 if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then
   # do not overwrite the value of need_locks provided by the user
-  { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
-echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
   hard_links=yes
   $rm conftest*
   ln conftest.a conftest.b 2>/dev/null && hard_links=no
   touch conftest.a
   ln conftest.a conftest.b 2>&5 || hard_links=no
   ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  { echo "$as_me:$LINENO: result: $hard_links" >&5
-echo "${ECHO_T}$hard_links" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
   if test "$hard_links" = no; then
 
-    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
-echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
@@ -42657,8 +45002,8 @@ else
   need_locks=no
 fi
 
-{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
-echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
 
   runpath_var=
   allow_undefined_flag_F77=
@@ -43020,18 +45365,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_f77_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
 
 aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
 }'`
@@ -43039,12 +45387,13 @@ aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File S
 if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
 }'`; fi
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
@@ -43069,18 +45418,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_f77_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
 
 aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
 }'`
@@ -43088,12 +45440,13 @@ aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File S
 if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
 }'`; fi
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
@@ -43539,8 +45892,8 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
     esac
   fi
 
-{ echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5
-echo "${ECHO_T}$ld_shlibs_F77" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5
+$as_echo "$ld_shlibs_F77" >&6; }
 test "$ld_shlibs_F77" = no && can_build_shared=no
 
 variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
@@ -43565,15 +45918,15 @@ x|xyes)
       # Test whether the compiler implicitly links with -lc since on some
       # systems, -lgcc has to come before -lc. If gcc already passes -lc
       # to ld, don't add -lc before -lgcc.
-      { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
-echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+      { $as_echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
       $rm conftest*
       printf "$lt_simple_compile_test_code" > conftest.$ac_ext
 
       if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } 2>conftest.err; then
         soname=conftest
         lib=conftest
@@ -43590,7 +45943,7 @@ echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&
         if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
   (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }
         then
          archive_cmds_need_lc_F77=no
@@ -43602,16 +45955,16 @@ echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&
         cat conftest.err 1>&5
       fi
       $rm conftest*
-      { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5
-echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6; }
+      { $as_echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5
+$as_echo "$archive_cmds_need_lc_F77" >&6; }
       ;;
     esac
   fi
   ;;
 esac
 
-{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
-echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
 library_names_spec=
 libname_spec='lib$name'
 soname_spec=
@@ -44164,12 +46517,12 @@ uts4*)
   dynamic_linker=no
   ;;
 esac
-{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
-echo "${ECHO_T}$dynamic_linker" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
 test "$dynamic_linker" = no && can_build_shared=no
 
-{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
-echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
 hardcode_action_F77=
 if test -n "$hardcode_libdir_flag_spec_F77" || \
    test -n "$runpath_var_F77" || \
@@ -44193,8 +46546,8 @@ else
   # directories.
   hardcode_action_F77=unsupported
 fi
-{ echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5
-echo "${ECHO_T}$hardcode_action_F77" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5
+$as_echo "$hardcode_action_F77" >&6; }
 
 if test "$hardcode_action_F77" = relink; then
   # Fast installation is not supported
 
 striplib=
 old_striplib=
-{ echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
-echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
+$as_echo_n "checking whether stripping libraries is possible... " >&6; }
 if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
   test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
   test -z "$striplib" && striplib="$STRIP --strip-unneeded"
-  { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+  { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
 else
 # FIXME - insert some real tests, host_os isn't really good enough
   case $host_os in
    darwin*)
        if test -n "$STRIP" ; then
          striplib="$STRIP -x"
-         { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+         { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
        else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
        ;;
    *)
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
     ;;
   esac
 fi
@@ -44726,10 +47079,10 @@ if test "$GCC" = yes; then
   lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin'
 
 
-{ echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
-echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
 if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_rtti_exceptions=no
   ac_outfile=conftest.$ac_objext
@@ -44744,11 +47097,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:44747: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:47100: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:44751: \$? = $ac_status" >&5
+   echo "$as_me:47104: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -44761,8 +47114,8 @@ else
    $rm conftest*
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; }
 
 if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
     lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions"
@@ -44776,8 +47129,8 @@ lt_prog_compiler_wl_GCJ=
 lt_prog_compiler_pic_GCJ=
 lt_prog_compiler_static_GCJ=
 
-{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
-echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
 
   if test "$GCC" = yes; then
     lt_prog_compiler_wl_GCJ='-Wl,'
@@ -44980,18 +47333,18 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
     esac
   fi
 
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5
+$as_echo "$lt_prog_compiler_pic_GCJ" >&6; }
 
 #
 # Check to make sure the PIC flag actually works.
 #
 if test -n "$lt_prog_compiler_pic_GCJ"; then
 
-{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5
-echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... " >&6; }
 if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   lt_prog_compiler_pic_works_GCJ=no
   ac_outfile=conftest.$ac_objext
@@ -45006,11 +47359,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:45009: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:47362: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:45013: \$? = $ac_status" >&5
+   echo "$as_me:47366: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -45023,8 +47376,8 @@ else
    $rm conftest*
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5
+$as_echo "$lt_prog_compiler_pic_works_GCJ" >&6; }
 
 if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then
     case $lt_prog_compiler_pic_GCJ in
@@ -45047,10 +47400,10 @@ case $host_os in
     ;;
 esac
 
-{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
-echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
 if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_c_o_GCJ=no
    $rm -r conftest 2>/dev/null
@@ -45068,11 +47421,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:45071: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:47424: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:45075: \$? = $ac_status" >&5
+   echo "$as_me:47428: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -45094,27 +47447,27 @@ else
    $rm conftest*
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5
+$as_echo "$lt_cv_prog_compiler_c_o_GCJ" >&6; }
 
 
 hard_links="nottested"
 if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then
   # do not overwrite the value of need_locks provided by the user
-  { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
-echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
   hard_links=yes
   $rm conftest*
   ln conftest.a conftest.b 2>/dev/null && hard_links=no
   touch conftest.a
   ln conftest.a conftest.b 2>&5 || hard_links=no
   ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  { echo "$as_me:$LINENO: result: $hard_links" >&5
-echo "${ECHO_T}$hard_links" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
   if test "$hard_links" = no; then
 
-    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
-echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
 
 
     cat <<AAW_EOF >>config.warnings
@@ -45128,8 +47481,8 @@ else
   need_locks=no
 fi
 
-{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
-echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
 
   runpath_var=
   allow_undefined_flag_GCJ=
@@ -45501,18 +47854,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
 
 aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
 }'`
@@ -45520,12 +47876,13 @@ aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File S
 if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
 }'`; fi
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
@@ -45560,18 +47917,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
 
 aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
 }'`
@@ -45579,12 +47939,13 @@ aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File S
 if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
 }'`; fi
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
@@ -46030,8 +48391,8 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
     esac
   fi
 
-{ echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5
-echo "${ECHO_T}$ld_shlibs_GCJ" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5
+$as_echo "$ld_shlibs_GCJ" >&6; }
 test "$ld_shlibs_GCJ" = no && can_build_shared=no
 
 variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
@@ -46056,15 +48417,15 @@ x|xyes)
       # Test whether the compiler implicitly links with -lc since on some
       # systems, -lgcc has to come before -lc. If gcc already passes -lc
       # to ld, don't add -lc before -lgcc.
-      { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
-echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+      { $as_echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
       $rm conftest*
       printf "$lt_simple_compile_test_code" > conftest.$ac_ext
 
       if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } 2>conftest.err; then
         soname=conftest
         lib=conftest
@@ -46081,7 +48442,7 @@ echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&
         if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
   (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }
         then
          archive_cmds_need_lc_GCJ=no
@@ -46093,16 +48454,16 @@ echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&
         cat conftest.err 1>&5
       fi
       $rm conftest*
-      { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5
-echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6; }
+      { $as_echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5
+$as_echo "$archive_cmds_need_lc_GCJ" >&6; }
       ;;
     esac
   fi
   ;;
 esac
 
-{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
-echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
 library_names_spec=
 libname_spec='lib$name'
 soname_spec=
@@ -46655,12 +49016,12 @@ uts4*)
   dynamic_linker=no
   ;;
 esac
-{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
-echo "${ECHO_T}$dynamic_linker" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
 test "$dynamic_linker" = no && can_build_shared=no
 
-{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
-echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
 hardcode_action_GCJ=
 if test -n "$hardcode_libdir_flag_spec_GCJ" || \
    test -n "$runpath_var_GCJ" || \
@@ -46684,8 +49045,8 @@ else
   # directories.
   hardcode_action_GCJ=unsupported
 fi
-{ echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5
-echo "${ECHO_T}$hardcode_action_GCJ" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5
+$as_echo "$hardcode_action_GCJ" >&6; }
 
 if test "$hardcode_action_GCJ" = relink; then
   # Fast installation is not supported
 
 striplib=
 old_striplib=
-{ echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
-echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
+$as_echo_n "checking whether stripping libraries is possible... " >&6; }
 if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
   test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
   test -z "$striplib" && striplib="$STRIP --strip-unneeded"
-  { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+  { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
 else
 # FIXME - insert some real tests, host_os isn't really good enough
   case $host_os in
    darwin*)
        if test -n "$STRIP" ; then
          striplib="$STRIP -x"
-         { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+         { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
        else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
        ;;
    *)
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
     ;;
   esac
 fi
@@ -46752,10 +49113,10 @@ else
 
   darwin*)
   # if libdl is installed we need to link against it
-    { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
-echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
 if test "${ac_cv_lib_dl_dlopen+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldl  $LIBS"
@@ -46787,33 +49148,37 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_dl_dlopen=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_dl_dlopen=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
-if test $ac_cv_lib_dl_dlopen = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = x""yes; then
   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
 else
 
    ;;
 
   *)
-    { echo "$as_me:$LINENO: checking for shl_load" >&5
-echo $ECHO_N "checking for shl_load... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for shl_load" >&5
+$as_echo_n "checking for shl_load... " >&6; }
 if test "${ac_cv_func_shl_load+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -46882,38 +49247,42 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_func_shl_load=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_func_shl_load=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
-echo "${ECHO_T}$ac_cv_func_shl_load" >&6; }
-if test $ac_cv_func_shl_load = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
+$as_echo "$ac_cv_func_shl_load" >&6; }
+if test "x$ac_cv_func_shl_load" = x""yes; then
   lt_cv_dlopen="shl_load"
 else
-  { echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
-echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+$as_echo_n "checking for shl_load in -ldld... " >&6; }
 if test "${ac_cv_lib_dld_shl_load+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldld  $LIBS"
@@ -46945,39 +49314,43 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_dld_shl_load=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_dld_shl_load=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
-echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6; }
-if test $ac_cv_lib_dld_shl_load = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+$as_echo "$ac_cv_lib_dld_shl_load" >&6; }
+if test "x$ac_cv_lib_dld_shl_load" = x""yes; then
   lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"
 else
-  { echo "$as_me:$LINENO: checking for dlopen" >&5
-echo $ECHO_N "checking for dlopen... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for dlopen" >&5
+$as_echo_n "checking for dlopen... " >&6; }
 if test "${ac_cv_func_dlopen+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -47030,38 +49403,42 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_func_dlopen=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_func_dlopen=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
-echo "${ECHO_T}$ac_cv_func_dlopen" >&6; }
-if test $ac_cv_func_dlopen = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
+$as_echo "$ac_cv_func_dlopen" >&6; }
+if test "x$ac_cv_func_dlopen" = x""yes; then
   lt_cv_dlopen="dlopen"
 else
-  { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
-echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
 if test "${ac_cv_lib_dl_dlopen+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldl  $LIBS"
@@ -47093,39 +49470,43 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_dl_dlopen=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_dl_dlopen=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
-if test $ac_cv_lib_dl_dlopen = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = x""yes; then
   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
 else
-  { echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
-echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
+$as_echo_n "checking for dlopen in -lsvld... " >&6; }
 if test "${ac_cv_lib_svld_dlopen+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lsvld  $LIBS"
@@ -47157,39 +49538,43 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_svld_dlopen=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_svld_dlopen=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6; }
-if test $ac_cv_lib_svld_dlopen = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
+$as_echo "$ac_cv_lib_svld_dlopen" >&6; }
+if test "x$ac_cv_lib_svld_dlopen" = x""yes; then
   lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
 else
-  { echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
-echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
+$as_echo_n "checking for dld_link in -ldld... " >&6; }
 if test "${ac_cv_lib_dld_dld_link+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldld  $LIBS"
@@ -47221,33 +49606,37 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_dld_dld_link=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_dld_dld_link=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
-echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6; }
-if test $ac_cv_lib_dld_dld_link = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
+$as_echo "$ac_cv_lib_dld_dld_link" >&6; }
+if test "x$ac_cv_lib_dld_dld_link" = x""yes; then
   lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"
 fi
 
     save_LIBS="$LIBS"
     LIBS="$lt_cv_dlopen_libs $LIBS"
 
-    { echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
-echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
+$as_echo_n "checking whether a program can dlopen itself... " >&6; }
 if test "${lt_cv_dlopen_self+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
          if test "$cross_compiling" = yes; then :
   lt_cv_dlopen_self=cross
@@ -47297,7 +49686,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 47300 "configure"
+#line 49689 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -47361,7 +49750,7 @@ EOF
   if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
     (./conftest; exit; ) >&5 2>/dev/null
     lt_status=$?
@@ -47379,15 +49768,15 @@ rm -fr conftest*
 
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
-echo "${ECHO_T}$lt_cv_dlopen_self" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
+$as_echo "$lt_cv_dlopen_self" >&6; }
 
     if test "x$lt_cv_dlopen_self" = xyes; then
       LDFLAGS="$LDFLAGS $link_static_flag"
-      { echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
-echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6; }
+      { $as_echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
+$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
 if test "${lt_cv_dlopen_self_static+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
          if test "$cross_compiling" = yes; then :
   lt_cv_dlopen_self_static=cross
@@ -47395,7 +49784,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 47398 "configure"
+#line 49787 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -47459,7 +49848,7 @@ EOF
   if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   (eval $ac_link) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
     (./conftest; exit; ) >&5 2>/dev/null
     lt_status=$?
@@ -47477,8 +49866,8 @@ rm -fr conftest*
 
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
-echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
+$as_echo "$lt_cv_dlopen_self_static" >&6; }
     fi
 
     CPPFLAGS="$save_CPPFLAGS"
@@ -48389,8 +50778,8 @@ CC="$lt_save_CC"
        ;;
 
       *)
-       { { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5
-echo "$as_me: error: Unsupported tag name: $tagname" >&2;}
+       { { $as_echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5
+$as_echo "$as_me: error: Unsupported tag name: $tagname" >&2;}
    { (exit 1); exit 1; }; }
        ;;
       esac
@@ -48409,8 +50798,8 @@ echo "$as_me: error: Unsupported tag name: $tagname" >&2;}
     chmod +x "$ofile"
   else
     rm -f "${ofile}T"
-    { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5
-echo "$as_me: error: unable to update list of available tagged configurations." >&2;}
+    { { $as_echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5
+$as_echo "$as_me: error: unable to update list of available tagged configurations." >&2;}
    { (exit 1); exit 1; }; }
   fi
 fi
@@ -48453,8 +50842,8 @@ if test "${enable_static_binary+set}" = set; then
            "" | y | ye | yes)
                AMANDA_STATIC_LDFLAGS=-static
                if test x"$enable_static" = x"no"; then
-                       { { echo "$as_me:$LINENO: error: *** --enable-static-binary is incompatible with --disable-static" >&5
-echo "$as_me: error: *** --enable-static-binary is incompatible with --disable-static" >&2;}
+                       { { $as_echo "$as_me:$LINENO: error: *** --enable-static-binary is incompatible with --disable-static" >&5
+$as_echo "$as_me: error: *** --enable-static-binary is incompatible with --disable-static" >&2;}
    { (exit 1); exit 1; }; }
                fi
                ;;
 #
 # headers
 #
-{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
+
+
+
+
+
+ac_header_dirent=no
+for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
+  as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5
+$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  $as_echo_n "(cached) " >&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 <sys/types.h>
+#include <$ac_hdr>
+
+int
+main ()
+{
+if ((DIR *) 0)
+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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  eval "$as_ac_Header=yes"
+else
+  $as_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 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
+_ACEOF
+
+ac_header_dirent=$ac_hdr; break
+fi
+
+done
+# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
+if test $ac_header_dirent = dirent.h; then
+  { $as_echo "$as_me:$LINENO: checking for library containing opendir" >&5
+$as_echo_n "checking for library containing opendir... " >&6; }
+if test "${ac_cv_search_opendir+set}" = set; then
+  $as_echo_n "(cached) " >&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 opendir ();
+int
+main ()
+{
+return opendir ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' dir; 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
+  ac_cv_search_opendir=$ac_res
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext
+  if test "${ac_cv_search_opendir+set}" = set; then
+  break
+fi
+done
+if test "${ac_cv_search_opendir+set}" = set; then
+  :
+else
+  ac_cv_search_opendir=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
+$as_echo "$ac_cv_search_opendir" >&6; }
+ac_res=$ac_cv_search_opendir
+if test "$ac_res" != no; then
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+else
+  { $as_echo "$as_me:$LINENO: checking for library containing opendir" >&5
+$as_echo_n "checking for library containing opendir... " >&6; }
+if test "${ac_cv_search_opendir+set}" = set; then
+  $as_echo_n "(cached) " >&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 opendir ();
+int
+main ()
+{
+return opendir ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' x; 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
+  ac_cv_search_opendir=$ac_res
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext
+  if test "${ac_cv_search_opendir+set}" = set; then
+  break
+fi
+done
+if test "${ac_cv_search_opendir+set}" = set; then
+  :
+else
+  ac_cv_search_opendir=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
+$as_echo "$ac_cv_search_opendir" >&6; }
+ac_res=$ac_cv_search_opendir
+if test "$ac_res" != no; then
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+fi
+
+{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
 if test "${ac_cv_header_stdc+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -48501,20 +51143,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_header_stdc=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_header_stdc=no
@@ -48606,37 +51249,40 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
 ac_cv_header_stdc=no
 fi
+rm -rf conftest.dSYM
 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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
 if test $ac_cv_header_stdc = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -48645,10 +51291,10 @@ _ACEOF
 
 fi
 
-{ echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
-echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
+$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; }
 if test "${ac_cv_header_time+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -48675,20 +51321,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_header_time=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_header_time=no
@@ -48696,8 +51343,8 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
-echo "${ECHO_T}$ac_cv_header_time" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
+$as_echo "$ac_cv_header_time" >&6; }
 if test $ac_cv_header_time = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -48729,6 +51376,7 @@ fi
 
 
 
+
 
 
 for ac_header in arpa/inet.h \
@@ -48739,9 +51387,9 @@ for ac_header in arpa/inet.h \
        math.h \
        netdb.h \
        netinet/in.h \
+       regex.h \
        stdarg.h \
        stdlib.h \
-       string.h \
        strings.h \
        sys/file.h \
        sys/ioctl.h \
@@ -48755,23 +51403,25 @@ for ac_header in arpa/inet.h \
        sys/types.h \
        sys/uio.h \
        syslog.h \
+       time.h \
        unistd.h \
 
 do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+as_ac_Header=`$as_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; }
+  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -48787,32 +51437,33 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -48826,69 +51477,73 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
         test ! -s conftest.err
        }; then
   ac_header_preproc=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&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; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
 
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
+as_val=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
 done
 
 
-#
-# Types
-#
-{ echo "$as_me:$LINENO: checking if sockaddr_storage struct exists" >&5
-echo $ECHO_N "checking if sockaddr_storage struct exists... $ECHO_C" >&6; }
-    if test "${ac_cv_has_sockaddr_storage+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_AMANDA_H 1
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
 
-#      include <sys/types.h>
-#      include <sys/socket.h>
-int
-main ()
-{
-u_int i = sizeof (struct sockaddr_storage)
-  ;
-  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); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_has_sockaddr_storage=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_cv_has_sockaddr_storage=no
-fi
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_UTIL_H 1
+_ACEOF
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
 
-    { echo "$as_me:$LINENO: result: $ac_cv_has_sockaddr_storage" >&5
-echo "${ECHO_T}$ac_cv_has_sockaddr_storage" >&6; }
-    if test $ac_cv_has_sockaddr_storage = yes ; then
 
 cat >>confdefs.h <<\_ACEOF
-#define HAVE_SOCKADDR_STORAGE 1
-_ACEOF
-
-    fi
-{ echo "$as_me:$LINENO: checking for int" >&5
-echo $ECHO_N "checking for int... $ECHO_C" >&6; }
-if test "${ac_cv_type_int+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 int ac__type_new_;
-int
-main ()
-{
-if ((ac__type_new_ *) 0)
-  return 0;
-if (sizeof (ac__type_new_))
-  return 0;
-  ;
-  return 0;
-}
+#define USE_GETTEXT 1
 _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); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_type_int=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_cv_type_int=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5
-echo "${ECHO_T}$ac_cv_type_int" >&6; }
 
+#
+# Types
+#
 # The cast to long int works around a bug in the HP C Compiler
 # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
 # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
 # This bug is HP SR number 8606223364.
-{ echo "$as_me:$LINENO: checking size of int" >&5
-echo $ECHO_N "checking size of int... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking size of int" >&5
+$as_echo_n "checking size of int... " >&6; }
 if test "${ac_cv_sizeof_int+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test "$cross_compiling" = yes; then
   # Depending upon the size, compute the lo and hi bounds.
@@ -49030,11 +51588,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef int ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
+static int test_array [1 - 2 * !(((long int) (sizeof (int))) >= 0)];
 test_array [0] = 0
 
   ;
@@ -49047,13 +51604,14 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
@@ -49067,11 +51625,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef int ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (int))) <= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -49084,20 +51641,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_hi=$ac_mid; break
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_lo=`expr $ac_mid + 1`
@@ -49111,7 +51669,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   done
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        cat >conftest.$ac_ext <<_ACEOF
@@ -49121,11 +51679,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef int ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
+static int test_array [1 - 2 * !(((long int) (sizeof (int))) < 0)];
 test_array [0] = 0
 
   ;
@@ -49138,13 +51695,14 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
@@ -49158,11 +51716,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef int ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (int))) >= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -49175,20 +51732,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_lo=$ac_mid; break
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_hi=`expr '(' $ac_mid ')' - 1`
@@ -49202,7 +51760,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   done
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_lo= ac_hi=
@@ -49222,11 +51780,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef int ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (int))) <= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -49239,20 +51796,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_hi=$ac_mid
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_lo=`expr '(' $ac_mid ')' + 1`
@@ -49263,11 +51821,13 @@ done
 case $ac_lo in
 ?*) ac_cv_sizeof_int=$ac_lo;;
 '') if test "$ac_cv_type_int" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (int)
+     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (int)
 See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (int)
+$as_echo "$as_me: error: cannot compute sizeof (int)
 See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
+   { (exit 77); exit 77; }; }; }
    else
      ac_cv_sizeof_int=0
    fi ;;
@@ -49280,9 +51840,8 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef int ac__type_sizeof_;
-static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
-static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
+static long int longval () { return (long int) (sizeof (int)); }
+static unsigned long int ulongval () { return (long int) (sizeof (int)); }
 #include <stdio.h>
 #include <stdlib.h>
 int
@@ -49292,20 +51851,22 @@ main ()
   FILE *f = fopen ("conftest.val", "w");
   if (! f)
     return 1;
-  if (((long int) (sizeof (ac__type_sizeof_))) < 0)
+  if (((long int) (sizeof (int))) < 0)
     {
       long int i = longval ();
-      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+      if (i != ((long int) (sizeof (int))))
        return 1;
-      fprintf (f, "%ld\n", i);
+      fprintf (f, "%ld", i);
     }
   else
     {
       unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+      if (i != ((long int) (sizeof (int))))
        return 1;
-      fprintf (f, "%lu\n", i);
+      fprintf (f, "%lu", i);
     }
+  /* Do not output a trailing newline, as this causes \r\n confusion
+     on some platforms.  */
   return ferror (f) || fclose (f) != 0;
 
   ;
@@ -49318,43 +51879,48 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_sizeof_int=`cat conftest.val`
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
 if test "$ac_cv_type_int" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (int)
+     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (int)
 See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (int)
+$as_echo "$as_me: error: cannot compute sizeof (int)
 See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
+   { (exit 77); exit 77; }; }; }
    else
      ac_cv_sizeof_int=0
    fi
 fi
+rm -rf conftest.dSYM
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 rm -f conftest.val
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5
-echo "${ECHO_T}$ac_cv_sizeof_int" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5
+$as_echo "$ac_cv_sizeof_int" >&6; }
 
 
 
@@ -49363,473 +51929,14 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
-{ echo "$as_me:$LINENO: checking for long" >&5
-echo $ECHO_N "checking for long... $ECHO_C" >&6; }
-if test "${ac_cv_type_long+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 long 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); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_type_long=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_type_long=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5
-echo "${ECHO_T}$ac_cv_type_long" >&6; }
-
 # The cast to long int works around a bug in the HP C Compiler
 # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
 # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
 # This bug is HP SR number 8606223364.
-{ echo "$as_me:$LINENO: checking size of long" >&5
-echo $ECHO_N "checking size of long... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking size of long" >&5
+$as_echo_n "checking size of long... " >&6; }
 if test "${ac_cv_sizeof_long+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-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 long ac__type_sizeof_;
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
-test_array [0] = 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); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=0 ac_mid=0
-  while :; do
-    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 long ac__type_sizeof_;
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
-test_array [0] = 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); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid; break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_lo=`expr $ac_mid + 1`
-                       if test $ac_lo -le $ac_mid; then
-                         ac_lo= ac_hi=
-                         break
-                       fi
-                       ac_mid=`expr 2 '*' $ac_mid + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       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 long ac__type_sizeof_;
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
-test_array [0] = 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); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    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 long ac__type_sizeof_;
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
-test_array [0] = 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); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=$ac_mid; break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_hi=`expr '(' $ac_mid ')' - 1`
-                       if test $ac_mid -le $ac_hi; then
-                         ac_lo= ac_hi=
-                         break
-                       fi
-                       ac_mid=`expr 2 '*' $ac_mid`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_lo= ac_hi=
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  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 long ac__type_sizeof_;
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
-test_array [0] = 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); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_long=$ac_lo;;
-'') if test "$ac_cv_type_long" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (long)
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (long)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
-   else
-     ac_cv_sizeof_long=0
-   fi ;;
-esac
-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 long ac__type_sizeof_;
-static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
-static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
-
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (((long int) (sizeof (ac__type_sizeof_))) < 0)
-    {
-      long int i = longval ();
-      if (i != ((long int) (sizeof (ac__type_sizeof_))))
-       return 1;
-      fprintf (f, "%ld\n", i);
-    }
-  else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (ac__type_sizeof_))))
-       return 1;
-      fprintf (f, "%lu\n", i);
-    }
-  return ferror (f) || fclose (f) != 0;
-
-  ;
-  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
-  ac_cv_sizeof_long=`cat conftest.val`
-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 )
-if test "$ac_cv_type_long" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (long)
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (long)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
-   else
-     ac_cv_sizeof_long=0
-   fi
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.val
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5
-echo "${ECHO_T}$ac_cv_sizeof_long" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_LONG $ac_cv_sizeof_long
-_ACEOF
-
-
-{ echo "$as_me:$LINENO: checking for long long" >&5
-echo $ECHO_N "checking for long long... $ECHO_C" >&6; }
-if test "${ac_cv_type_long_long+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 long long 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); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_type_long_long=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_type_long_long=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5
-echo "${ECHO_T}$ac_cv_type_long_long" >&6; }
-
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ echo "$as_me:$LINENO: checking size of long long" >&5
-echo $ECHO_N "checking size of long long... $ECHO_C" >&6; }
-if test "${ac_cv_sizeof_long_long+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test "$cross_compiling" = yes; then
   # Depending upon the size, compute the lo and hi bounds.
@@ -49840,11 +51947,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef long long ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
+static int test_array [1 - 2 * !(((long int) (sizeof (long))) >= 0)];
 test_array [0] = 0
 
   ;
@@ -49857,13 +51963,14 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
@@ -49877,11 +51984,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef long long ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (long))) <= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -49894,20 +52000,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_hi=$ac_mid; break
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_lo=`expr $ac_mid + 1`
@@ -49921,7 +52028,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   done
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        cat >conftest.$ac_ext <<_ACEOF
@@ -49931,11 +52038,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef long long ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
+static int test_array [1 - 2 * !(((long int) (sizeof (long))) < 0)];
 test_array [0] = 0
 
   ;
@@ -49948,13 +52054,14 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
@@ -49968,11 +52075,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef long long ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (long))) >= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -49985,20 +52091,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_lo=$ac_mid; break
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_hi=`expr '(' $ac_mid ')' - 1`
@@ -50012,7 +52119,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   done
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_lo= ac_hi=
@@ -50032,11 +52139,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef long long ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (long))) <= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -50049,20 +52155,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_hi=$ac_mid
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_lo=`expr '(' $ac_mid ')' + 1`
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 done
 case $ac_lo in
-?*) ac_cv_sizeof_long_long=$ac_lo;;
-'') if test "$ac_cv_type_long_long" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long)
+?*) ac_cv_sizeof_long=$ac_lo;;
+'') if test "$ac_cv_type_long" = yes; then
+     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long)
 See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (long long)
+$as_echo "$as_me: error: cannot compute sizeof (long)
 See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
+   { (exit 77); exit 77; }; }; }
    else
-     ac_cv_sizeof_long_long=0
+     ac_cv_sizeof_long=0
    fi ;;
 esac
 else
@@ -50090,9 +52199,8 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef long long ac__type_sizeof_;
-static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
-static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
+static long int longval () { return (long int) (sizeof (long)); }
+static unsigned long int ulongval () { return (long int) (sizeof (long)); }
 #include <stdio.h>
 #include <stdlib.h>
 int
@@ -50102,20 +52210,22 @@ main ()
   FILE *f = fopen ("conftest.val", "w");
   if (! f)
     return 1;
-  if (((long int) (sizeof (ac__type_sizeof_))) < 0)
+  if (((long int) (sizeof (long))) < 0)
     {
       long int i = longval ();
-      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+      if (i != ((long int) (sizeof (long))))
        return 1;
-      fprintf (f, "%ld\n", i);
+      fprintf (f, "%ld", i);
     }
   else
     {
       unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+      if (i != ((long int) (sizeof (long))))
        return 1;
-      fprintf (f, "%lu\n", i);
+      fprintf (f, "%lu", i);
     }
+  /* Do not output a trailing newline, as this causes \r\n confusion
+     on some platforms.  */
   return ferror (f) || fclose (f) != 0;
 
   ;
@@ -50128,71 +52238,272 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_sizeof_long_long=`cat conftest.val`
+  ac_cv_sizeof_long=`cat conftest.val`
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
-if test "$ac_cv_type_long_long" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long)
+if test "$ac_cv_type_long" = yes; then
+     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long)
 See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (long long)
+$as_echo "$as_me: error: cannot compute sizeof (long)
 See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
+   { (exit 77); exit 77; }; }; }
    else
-     ac_cv_sizeof_long_long=0
+     ac_cv_sizeof_long=0
    fi
 fi
+rm -rf conftest.dSYM
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 rm -f conftest.val
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long" >&5
-echo "${ECHO_T}$ac_cv_sizeof_long_long" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5
+$as_echo "$ac_cv_sizeof_long" >&6; }
 
 
 
 cat >>confdefs.h <<_ACEOF
-#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
+#define SIZEOF_LONG $ac_cv_sizeof_long
 _ACEOF
 
 
-{ echo "$as_me:$LINENO: checking for intmax_t" >&5
-echo $ECHO_N "checking for intmax_t... $ECHO_C" >&6; }
-if test "${ac_cv_type_intmax_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:$LINENO: checking size of long long" >&5
+$as_echo_n "checking size of long long... " >&6; }
+if test "${ac_cv_sizeof_long_long+set}" = set; then
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
+  if test "$cross_compiling" = yes; then
+  # Depending upon the size, compute the lo and hi bounds.
+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 intmax_t ac__type_new_;
 int
 main ()
 {
-if ((ac__type_new_ *) 0)
+static int test_array [1 - 2 * !(((long int) (sizeof (long long))) >= 0)];
+test_array [0] = 0
+
+  ;
   return 0;
-if (sizeof (ac__type_new_))
+}
+_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=0 ac_mid=0
+  while :; do
+    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
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (long long))) <= $ac_mid)];
+test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=$ac_mid; break
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_lo=`expr $ac_mid + 1`
+                       if test $ac_lo -le $ac_mid; then
+                         ac_lo= ac_hi=
+                         break
+                       fi
+                       ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       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
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (long long))) < 0)];
+test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    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
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (long long))) >= $ac_mid)];
+test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_lo=$ac_mid; break
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_hi=`expr '(' $ac_mid ')' - 1`
+                       if test $ac_mid -le $ac_hi; then
+                         ac_lo= ac_hi=
+                         break
+                       fi
+                       ac_mid=`expr 2 '*' $ac_mid`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_lo= ac_hi=
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+  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
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (long long))) <= $ac_mid)];
+test_array [0] = 0
+
   ;
   return 0;
 }
@@ -50203,38 +52514,147 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
-  ac_cv_type_intmax_t=yes
+  ac_hi=$ac_mid
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_cv_type_intmax_t=no
+       ac_lo=`expr '(' $ac_mid ')' + 1`
 fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_long_long=$ac_lo;;
+'') if test "$ac_cv_type_long_long" = yes; then
+     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long long)
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot compute sizeof (long long)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }; }
+   else
+     ac_cv_sizeof_long_long=0
+   fi ;;
+esac
+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
+static long int longval () { return (long int) (sizeof (long long)); }
+static unsigned long int ulongval () { return (long int) (sizeof (long long)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    return 1;
+  if (((long int) (sizeof (long long))) < 0)
+    {
+      long int i = longval ();
+      if (i != ((long int) (sizeof (long long))))
+       return 1;
+      fprintf (f, "%ld", i);
+    }
+  else
+    {
+      unsigned long int i = ulongval ();
+      if (i != ((long int) (sizeof (long long))))
+       return 1;
+      fprintf (f, "%lu", i);
+    }
+  /* Do not output a trailing newline, as this causes \r\n confusion
+     on some platforms.  */
+  return ferror (f) || fclose (f) != 0;
+
+  ;
+  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_sizeof_long_long=`cat conftest.val`
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+if test "$ac_cv_type_long_long" = yes; then
+     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long long)
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot compute sizeof (long long)
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }; }
+   else
+     ac_cv_sizeof_long_long=0
+   fi
+fi
+rm -rf conftest.dSYM
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.val
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_intmax_t" >&5
-echo "${ECHO_T}$ac_cv_type_intmax_t" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long" >&5
+$as_echo "$ac_cv_sizeof_long_long" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
+_ACEOF
+
 
 # The cast to long int works around a bug in the HP C Compiler
 # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
 # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
 # This bug is HP SR number 8606223364.
-{ echo "$as_me:$LINENO: checking size of intmax_t" >&5
-echo $ECHO_N "checking size of intmax_t... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking size of intmax_t" >&5
+$as_echo_n "checking size of intmax_t... " >&6; }
 if test "${ac_cv_sizeof_intmax_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test "$cross_compiling" = yes; then
   # Depending upon the size, compute the lo and hi bounds.
@@ -50245,11 +52665,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef intmax_t ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
+static int test_array [1 - 2 * !(((long int) (sizeof (intmax_t))) >= 0)];
 test_array [0] = 0
 
   ;
@@ -50262,13 +52681,14 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
@@ -50282,11 +52702,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef intmax_t ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (intmax_t))) <= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -50299,20 +52718,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_hi=$ac_mid; break
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_lo=`expr $ac_mid + 1`
@@ -50326,7 +52746,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   done
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        cat >conftest.$ac_ext <<_ACEOF
@@ -50336,11 +52756,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef intmax_t ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
+static int test_array [1 - 2 * !(((long int) (sizeof (intmax_t))) < 0)];
 test_array [0] = 0
 
   ;
@@ -50353,13 +52772,14 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
@@ -50373,11 +52793,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef intmax_t ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (intmax_t))) >= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -50390,20 +52809,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_lo=$ac_mid; break
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_hi=`expr '(' $ac_mid ')' - 1`
@@ -50417,7 +52837,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   done
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_lo= ac_hi=
@@ -50437,11 +52857,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef intmax_t ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (intmax_t))) <= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -50454,20 +52873,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_hi=$ac_mid
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_lo=`expr '(' $ac_mid ')' + 1`
@@ -50478,11 +52898,13 @@ done
 case $ac_lo in
 ?*) ac_cv_sizeof_intmax_t=$ac_lo;;
 '') if test "$ac_cv_type_intmax_t" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (intmax_t)
+     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (intmax_t)
 See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (intmax_t)
+$as_echo "$as_me: error: cannot compute sizeof (intmax_t)
 See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
+   { (exit 77); exit 77; }; }; }
    else
      ac_cv_sizeof_intmax_t=0
    fi ;;
@@ -50495,9 +52917,8 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef intmax_t ac__type_sizeof_;
-static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
-static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
+static long int longval () { return (long int) (sizeof (intmax_t)); }
+static unsigned long int ulongval () { return (long int) (sizeof (intmax_t)); }
 #include <stdio.h>
 #include <stdlib.h>
 int
@@ -50507,20 +52928,22 @@ main ()
   FILE *f = fopen ("conftest.val", "w");
   if (! f)
     return 1;
-  if (((long int) (sizeof (ac__type_sizeof_))) < 0)
+  if (((long int) (sizeof (intmax_t))) < 0)
     {
       long int i = longval ();
-      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+      if (i != ((long int) (sizeof (intmax_t))))
        return 1;
-      fprintf (f, "%ld\n", i);
+      fprintf (f, "%ld", i);
     }
   else
     {
       unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+      if (i != ((long int) (sizeof (intmax_t))))
        return 1;
-      fprintf (f, "%lu\n", i);
+      fprintf (f, "%lu", i);
     }
+  /* Do not output a trailing newline, as this causes \r\n confusion
+     on some platforms.  */
   return ferror (f) || fclose (f) != 0;
 
   ;
@@ -50533,43 +52956,48 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_sizeof_intmax_t=`cat conftest.val`
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
 if test "$ac_cv_type_intmax_t" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (intmax_t)
+     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (intmax_t)
 See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (intmax_t)
+$as_echo "$as_me: error: cannot compute sizeof (intmax_t)
 See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
+   { (exit 77); exit 77; }; }; }
    else
      ac_cv_sizeof_intmax_t=0
    fi
 fi
+rm -rf conftest.dSYM
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 rm -f conftest.val
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_intmax_t" >&5
-echo "${ECHO_T}$ac_cv_sizeof_intmax_t" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_intmax_t" >&5
+$as_echo "$ac_cv_sizeof_intmax_t" >&6; }
 
 
 
@@ -50578,68 +53006,14 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
-{ echo "$as_me:$LINENO: checking for off_t" >&5
-echo $ECHO_N "checking for off_t... $ECHO_C" >&6; }
-if test "${ac_cv_type_off_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 off_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); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_type_off_t=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_type_off_t=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5
-echo "${ECHO_T}$ac_cv_type_off_t" >&6; }
-
 # The cast to long int works around a bug in the HP C Compiler
 # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
 # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
 # This bug is HP SR number 8606223364.
-{ echo "$as_me:$LINENO: checking size of off_t" >&5
-echo $ECHO_N "checking size of off_t... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking size of off_t" >&5
+$as_echo_n "checking size of off_t... " >&6; }
 if test "${ac_cv_sizeof_off_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test "$cross_compiling" = yes; then
   # Depending upon the size, compute the lo and hi bounds.
@@ -50650,11 +53024,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef off_t ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
+static int test_array [1 - 2 * !(((long int) (sizeof (off_t))) >= 0)];
 test_array [0] = 0
 
   ;
@@ -50667,13 +53040,14 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
@@ -50687,11 +53061,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef off_t ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (off_t))) <= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -50704,20 +53077,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_hi=$ac_mid; break
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_lo=`expr $ac_mid + 1`
@@ -50731,7 +53105,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   done
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        cat >conftest.$ac_ext <<_ACEOF
@@ -50741,11 +53115,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef off_t ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
+static int test_array [1 - 2 * !(((long int) (sizeof (off_t))) < 0)];
 test_array [0] = 0
 
   ;
@@ -50758,13 +53131,14 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
@@ -50778,11 +53152,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef off_t ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (off_t))) >= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -50795,20 +53168,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_lo=$ac_mid; break
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_hi=`expr '(' $ac_mid ')' - 1`
@@ -50822,7 +53196,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   done
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_lo= ac_hi=
@@ -50842,11 +53216,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef off_t ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (off_t))) <= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -50859,20 +53232,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_hi=$ac_mid
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_lo=`expr '(' $ac_mid ')' + 1`
@@ -50883,11 +53257,13 @@ done
 case $ac_lo in
 ?*) ac_cv_sizeof_off_t=$ac_lo;;
 '') if test "$ac_cv_type_off_t" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (off_t)
+     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (off_t)
 See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (off_t)
+$as_echo "$as_me: error: cannot compute sizeof (off_t)
 See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
+   { (exit 77); exit 77; }; }; }
    else
      ac_cv_sizeof_off_t=0
    fi ;;
@@ -50900,9 +53276,8 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef off_t ac__type_sizeof_;
-static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
-static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
+static long int longval () { return (long int) (sizeof (off_t)); }
+static unsigned long int ulongval () { return (long int) (sizeof (off_t)); }
 #include <stdio.h>
 #include <stdlib.h>
 int
@@ -50912,20 +53287,22 @@ main ()
   FILE *f = fopen ("conftest.val", "w");
   if (! f)
     return 1;
-  if (((long int) (sizeof (ac__type_sizeof_))) < 0)
+  if (((long int) (sizeof (off_t))) < 0)
     {
       long int i = longval ();
-      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+      if (i != ((long int) (sizeof (off_t))))
        return 1;
-      fprintf (f, "%ld\n", i);
+      fprintf (f, "%ld", i);
     }
   else
     {
       unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+      if (i != ((long int) (sizeof (off_t))))
        return 1;
-      fprintf (f, "%lu\n", i);
+      fprintf (f, "%lu", i);
     }
+  /* Do not output a trailing newline, as this causes \r\n confusion
+     on some platforms.  */
   return ferror (f) || fclose (f) != 0;
 
   ;
@@ -50938,43 +53315,48 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_sizeof_off_t=`cat conftest.val`
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
 if test "$ac_cv_type_off_t" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (off_t)
+     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (off_t)
 See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (off_t)
+$as_echo "$as_me: error: cannot compute sizeof (off_t)
 See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
+   { (exit 77); exit 77; }; }; }
    else
      ac_cv_sizeof_off_t=0
    fi
 fi
+rm -rf conftest.dSYM
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 rm -f conftest.val
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_off_t" >&5
-echo "${ECHO_T}$ac_cv_sizeof_off_t" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_off_t" >&5
+$as_echo "$ac_cv_sizeof_off_t" >&6; }
 
 
 
@@ -50983,68 +53365,14 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
-{ echo "$as_me:$LINENO: checking for size_t" >&5
-echo $ECHO_N "checking for size_t... $ECHO_C" >&6; }
-if test "${ac_cv_type_size_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 size_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); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_type_size_t=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_type_size_t=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
-echo "${ECHO_T}$ac_cv_type_size_t" >&6; }
-
 # The cast to long int works around a bug in the HP C Compiler
 # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
 # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
 # This bug is HP SR number 8606223364.
-{ echo "$as_me:$LINENO: checking size of size_t" >&5
-echo $ECHO_N "checking size of size_t... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking size of size_t" >&5
+$as_echo_n "checking size of size_t... " >&6; }
 if test "${ac_cv_sizeof_size_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test "$cross_compiling" = yes; then
   # Depending upon the size, compute the lo and hi bounds.
@@ -51055,11 +53383,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef size_t ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
+static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) >= 0)];
 test_array [0] = 0
 
   ;
@@ -51072,13 +53399,14 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
@@ -51092,11 +53420,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef size_t ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) <= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -51109,20 +53436,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_hi=$ac_mid; break
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_lo=`expr $ac_mid + 1`
@@ -51136,7 +53464,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   done
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        cat >conftest.$ac_ext <<_ACEOF
@@ -51146,11 +53474,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef size_t ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
+static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) < 0)];
 test_array [0] = 0
 
   ;
@@ -51163,13 +53490,14 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
@@ -51183,11 +53511,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef size_t ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) >= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -51200,20 +53527,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_lo=$ac_mid; break
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_hi=`expr '(' $ac_mid ')' - 1`
@@ -51227,7 +53555,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   done
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_lo= ac_hi=
@@ -51247,11 +53575,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef size_t ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) <= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -51264,20 +53591,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_hi=$ac_mid
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_lo=`expr '(' $ac_mid ')' + 1`
@@ -51288,11 +53616,13 @@ done
 case $ac_lo in
 ?*) ac_cv_sizeof_size_t=$ac_lo;;
 '') if test "$ac_cv_type_size_t" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (size_t)
+     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (size_t)
 See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (size_t)
+$as_echo "$as_me: error: cannot compute sizeof (size_t)
 See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
+   { (exit 77); exit 77; }; }; }
    else
      ac_cv_sizeof_size_t=0
    fi ;;
@@ -51305,9 +53635,8 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef size_t ac__type_sizeof_;
-static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
-static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
+static long int longval () { return (long int) (sizeof (size_t)); }
+static unsigned long int ulongval () { return (long int) (sizeof (size_t)); }
 #include <stdio.h>
 #include <stdlib.h>
 int
@@ -51317,20 +53646,22 @@ main ()
   FILE *f = fopen ("conftest.val", "w");
   if (! f)
     return 1;
-  if (((long int) (sizeof (ac__type_sizeof_))) < 0)
+  if (((long int) (sizeof (size_t))) < 0)
     {
       long int i = longval ();
-      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+      if (i != ((long int) (sizeof (size_t))))
        return 1;
-      fprintf (f, "%ld\n", i);
+      fprintf (f, "%ld", i);
     }
   else
     {
       unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+      if (i != ((long int) (sizeof (size_t))))
        return 1;
-      fprintf (f, "%lu\n", i);
+      fprintf (f, "%lu", i);
     }
+  /* Do not output a trailing newline, as this causes \r\n confusion
+     on some platforms.  */
   return ferror (f) || fclose (f) != 0;
 
   ;
@@ -51343,43 +53674,48 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_sizeof_size_t=`cat conftest.val`
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
 if test "$ac_cv_type_size_t" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (size_t)
+     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (size_t)
 See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (size_t)
+$as_echo "$as_me: error: cannot compute sizeof (size_t)
 See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
+   { (exit 77); exit 77; }; }; }
    else
      ac_cv_sizeof_size_t=0
    fi
 fi
+rm -rf conftest.dSYM
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 rm -f conftest.val
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_size_t" >&5
-echo "${ECHO_T}$ac_cv_sizeof_size_t" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_size_t" >&5
+$as_echo "$ac_cv_sizeof_size_t" >&6; }
 
 
 
@@ -51388,68 +53724,14 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
-{ echo "$as_me:$LINENO: checking for ssize_t" >&5
-echo $ECHO_N "checking for ssize_t... $ECHO_C" >&6; }
-if test "${ac_cv_type_ssize_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 ssize_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); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_type_ssize_t=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_type_ssize_t=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_ssize_t" >&5
-echo "${ECHO_T}$ac_cv_type_ssize_t" >&6; }
-
 # The cast to long int works around a bug in the HP C Compiler
 # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
 # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
 # This bug is HP SR number 8606223364.
-{ echo "$as_me:$LINENO: checking size of ssize_t" >&5
-echo $ECHO_N "checking size of ssize_t... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking size of ssize_t" >&5
+$as_echo_n "checking size of ssize_t... " >&6; }
 if test "${ac_cv_sizeof_ssize_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test "$cross_compiling" = yes; then
   # Depending upon the size, compute the lo and hi bounds.
@@ -51460,11 +53742,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef ssize_t ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
+static int test_array [1 - 2 * !(((long int) (sizeof (ssize_t))) >= 0)];
 test_array [0] = 0
 
   ;
@@ -51477,13 +53758,14 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
@@ -51497,11 +53779,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef ssize_t ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (ssize_t))) <= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -51514,20 +53795,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_hi=$ac_mid; break
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_lo=`expr $ac_mid + 1`
@@ -51541,7 +53823,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   done
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        cat >conftest.$ac_ext <<_ACEOF
@@ -51551,11 +53833,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef ssize_t ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
+static int test_array [1 - 2 * !(((long int) (sizeof (ssize_t))) < 0)];
 test_array [0] = 0
 
   ;
@@ -51568,13 +53849,14 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
@@ -51588,11 +53870,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef ssize_t ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (ssize_t))) >= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -51605,20 +53886,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_lo=$ac_mid; break
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_hi=`expr '(' $ac_mid ')' - 1`
@@ -51632,7 +53914,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   done
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_lo= ac_hi=
@@ -51652,11 +53934,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef ssize_t ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (ssize_t))) <= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -51669,20 +53950,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_hi=$ac_mid
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_lo=`expr '(' $ac_mid ')' + 1`
@@ -51693,11 +53975,13 @@ done
 case $ac_lo in
 ?*) ac_cv_sizeof_ssize_t=$ac_lo;;
 '') if test "$ac_cv_type_ssize_t" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (ssize_t)
+     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (ssize_t)
 See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (ssize_t)
+$as_echo "$as_me: error: cannot compute sizeof (ssize_t)
 See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
+   { (exit 77); exit 77; }; }; }
    else
      ac_cv_sizeof_ssize_t=0
    fi ;;
@@ -51710,9 +53994,8 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef ssize_t ac__type_sizeof_;
-static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
-static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
+static long int longval () { return (long int) (sizeof (ssize_t)); }
+static unsigned long int ulongval () { return (long int) (sizeof (ssize_t)); }
 #include <stdio.h>
 #include <stdlib.h>
 int
@@ -51722,20 +54005,22 @@ main ()
   FILE *f = fopen ("conftest.val", "w");
   if (! f)
     return 1;
-  if (((long int) (sizeof (ac__type_sizeof_))) < 0)
+  if (((long int) (sizeof (ssize_t))) < 0)
     {
       long int i = longval ();
-      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+      if (i != ((long int) (sizeof (ssize_t))))
        return 1;
-      fprintf (f, "%ld\n", i);
+      fprintf (f, "%ld", i);
     }
   else
     {
       unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+      if (i != ((long int) (sizeof (ssize_t))))
        return 1;
-      fprintf (f, "%lu\n", i);
+      fprintf (f, "%lu", i);
     }
+  /* Do not output a trailing newline, as this causes \r\n confusion
+     on some platforms.  */
   return ferror (f) || fclose (f) != 0;
 
   ;
@@ -51748,43 +54033,48 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_sizeof_ssize_t=`cat conftest.val`
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
 if test "$ac_cv_type_ssize_t" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (ssize_t)
+     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (ssize_t)
 See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (ssize_t)
+$as_echo "$as_me: error: cannot compute sizeof (ssize_t)
 See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
+   { (exit 77); exit 77; }; }; }
    else
      ac_cv_sizeof_ssize_t=0
    fi
 fi
+rm -rf conftest.dSYM
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 rm -f conftest.val
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_ssize_t" >&5
-echo "${ECHO_T}$ac_cv_sizeof_ssize_t" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_ssize_t" >&5
+$as_echo "$ac_cv_sizeof_ssize_t" >&6; }
 
 
 
@@ -51793,68 +54083,14 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
-{ echo "$as_me:$LINENO: checking for time_t" >&5
-echo $ECHO_N "checking for time_t... $ECHO_C" >&6; }
-if test "${ac_cv_type_time_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 time_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); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_type_time_t=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_type_time_t=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_time_t" >&5
-echo "${ECHO_T}$ac_cv_type_time_t" >&6; }
-
 # The cast to long int works around a bug in the HP C Compiler
 # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
 # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
 # This bug is HP SR number 8606223364.
-{ echo "$as_me:$LINENO: checking size of time_t" >&5
-echo $ECHO_N "checking size of time_t... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking size of time_t" >&5
+$as_echo_n "checking size of time_t... " >&6; }
 if test "${ac_cv_sizeof_time_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test "$cross_compiling" = yes; then
   # Depending upon the size, compute the lo and hi bounds.
@@ -51865,11 +54101,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef time_t ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
+static int test_array [1 - 2 * !(((long int) (sizeof (time_t))) >= 0)];
 test_array [0] = 0
 
   ;
@@ -51882,13 +54117,14 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
@@ -51902,11 +54138,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef time_t ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (time_t))) <= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -51919,20 +54154,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_hi=$ac_mid; break
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_lo=`expr $ac_mid + 1`
@@ -51946,7 +54182,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   done
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        cat >conftest.$ac_ext <<_ACEOF
@@ -51956,11 +54192,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef time_t ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
+static int test_array [1 - 2 * !(((long int) (sizeof (time_t))) < 0)];
 test_array [0] = 0
 
   ;
@@ -51973,13 +54208,14 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
@@ -51993,11 +54229,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef time_t ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (time_t))) >= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -52010,20 +54245,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_lo=$ac_mid; break
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_hi=`expr '(' $ac_mid ')' - 1`
@@ -52037,7 +54273,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   done
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_lo= ac_hi=
@@ -52057,11 +54293,10 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef time_t ac__type_sizeof_;
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+static int test_array [1 - 2 * !(((long int) (sizeof (time_t))) <= $ac_mid)];
 test_array [0] = 0
 
   ;
@@ -52074,20 +54309,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_hi=$ac_mid
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_lo=`expr '(' $ac_mid ')' + 1`
@@ -52098,11 +54334,13 @@ done
 case $ac_lo in
 ?*) ac_cv_sizeof_time_t=$ac_lo;;
 '') if test "$ac_cv_type_time_t" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (time_t)
+     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (time_t)
 See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (time_t)
+$as_echo "$as_me: error: cannot compute sizeof (time_t)
 See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
+   { (exit 77); exit 77; }; }; }
    else
      ac_cv_sizeof_time_t=0
    fi ;;
@@ -52115,9 +54353,8 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
-   typedef time_t ac__type_sizeof_;
-static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
-static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
+static long int longval () { return (long int) (sizeof (time_t)); }
+static unsigned long int ulongval () { return (long int) (sizeof (time_t)); }
 #include <stdio.h>
 #include <stdlib.h>
 int
@@ -52127,20 +54364,22 @@ main ()
   FILE *f = fopen ("conftest.val", "w");
   if (! f)
     return 1;
-  if (((long int) (sizeof (ac__type_sizeof_))) < 0)
+  if (((long int) (sizeof (time_t))) < 0)
     {
       long int i = longval ();
-      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+      if (i != ((long int) (sizeof (time_t))))
        return 1;
-      fprintf (f, "%ld\n", i);
+      fprintf (f, "%ld", i);
     }
   else
     {
       unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (ac__type_sizeof_))))
+      if (i != ((long int) (sizeof (time_t))))
        return 1;
-      fprintf (f, "%lu\n", i);
+      fprintf (f, "%lu", i);
     }
+  /* Do not output a trailing newline, as this causes \r\n confusion
+     on some platforms.  */
   return ferror (f) || fclose (f) != 0;
 
   ;
@@ -52153,43 +54392,48 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_sizeof_time_t=`cat conftest.val`
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
 if test "$ac_cv_type_time_t" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (time_t)
+     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (time_t)
 See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (time_t)
+$as_echo "$as_me: error: cannot compute sizeof (time_t)
 See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
+   { (exit 77); exit 77; }; }; }
    else
      ac_cv_sizeof_time_t=0
    fi
 fi
+rm -rf conftest.dSYM
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 rm -f conftest.val
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_time_t" >&5
-echo "${ECHO_T}$ac_cv_sizeof_time_t" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_time_t" >&5
+$as_echo "$ac_cv_sizeof_time_t" >&6; }
 
 
 
@@ -52198,26 +54442,58 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
-{ echo "$as_me:$LINENO: checking for off_t" >&5
-echo $ECHO_N "checking for off_t... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for off_t" >&5
+$as_echo_n "checking for off_t... " >&6; }
 if test "${ac_cv_type_off_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
+  ac_cv_type_off_t=no
+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 off_t ac__type_new_;
 int
 main ()
 {
-if ((ac__type_new_ *) 0)
-  return 0;
-if (sizeof (ac__type_new_))
+if (sizeof (off_t))
+       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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  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
+int
+main ()
+{
+if (sizeof ((off_t)))
+         return 0;
   ;
   return 0;
 }
@@ -52228,30 +54504,39 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
-  ac_cv_type_off_t=yes
+  :
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_cv_type_off_t=no
+       ac_cv_type_off_t=yes
 fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5
-echo "${ECHO_T}$ac_cv_type_off_t" >&6; }
-if test $ac_cv_type_off_t = yes; then
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5
+$as_echo "$ac_cv_type_off_t" >&6; }
+if test "x$ac_cv_type_off_t" = x""yes; then
   :
 else
 
@@ -52261,26 +54546,58 @@ _ACEOF
 
 fi
 
-{ echo "$as_me:$LINENO: checking for pid_t" >&5
-echo $ECHO_N "checking for pid_t... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for pid_t" >&5
+$as_echo_n "checking for pid_t... " >&6; }
 if test "${ac_cv_type_pid_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
+  ac_cv_type_pid_t=no
+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 pid_t ac__type_new_;
 int
 main ()
 {
-if ((ac__type_new_ *) 0)
-  return 0;
-if (sizeof (ac__type_new_))
+if (sizeof (pid_t))
+       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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  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
+int
+main ()
+{
+if (sizeof ((pid_t)))
+         return 0;
   ;
   return 0;
 }
@@ -52291,30 +54608,39 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
-  ac_cv_type_pid_t=yes
+  :
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_cv_type_pid_t=no
+       ac_cv_type_pid_t=yes
 fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5
-echo "${ECHO_T}$ac_cv_type_pid_t" >&6; }
-if test $ac_cv_type_pid_t = yes; then
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5
+$as_echo "$ac_cv_type_pid_t" >&6; }
+if test "x$ac_cv_type_pid_t" = x""yes; then
   :
 else
 
@@ -52324,26 +54650,58 @@ _ACEOF
 
 fi
 
-{ echo "$as_me:$LINENO: checking for size_t" >&5
-echo $ECHO_N "checking for size_t... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for size_t" >&5
+$as_echo_n "checking for size_t... " >&6; }
 if test "${ac_cv_type_size_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
+  ac_cv_type_size_t=no
+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 size_t ac__type_new_;
 int
 main ()
 {
-if ((ac__type_new_ *) 0)
-  return 0;
-if (sizeof (ac__type_new_))
+if (sizeof (size_t))
+       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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  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
+int
+main ()
+{
+if (sizeof ((size_t)))
+         return 0;
   ;
   return 0;
 }
@@ -52354,30 +54712,39 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
-  ac_cv_type_size_t=yes
+  :
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_type_size_t=yes
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_cv_type_size_t=no
+
 fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
-echo "${ECHO_T}$ac_cv_type_size_t" >&6; }
-if test $ac_cv_type_size_t = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
+$as_echo "$ac_cv_type_size_t" >&6; }
+if test "x$ac_cv_type_size_t" = x""yes; then
   :
 else
 
@@ -52387,10 +54754,10 @@ _ACEOF
 
 fi
 
-{ echo "$as_me:$LINENO: checking for uid_t in sys/types.h" >&5
-echo $ECHO_N "checking for uid_t in sys/types.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for uid_t in sys/types.h" >&5
+$as_echo_n "checking for uid_t in sys/types.h... " >&6; }
 if test "${ac_cv_type_uid_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -52410,8 +54777,8 @@ fi
 rm -f conftest*
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_uid_t" >&5
-echo "${ECHO_T}$ac_cv_type_uid_t" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_uid_t" >&5
+$as_echo "$ac_cv_type_uid_t" >&6; }
 if test $ac_cv_type_uid_t = no; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -52425,10 +54792,10 @@ _ACEOF
 
 fi
 
-{ echo "$as_me:$LINENO: checking return type of signal handlers" >&5
-echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking return type of signal handlers" >&5
+$as_echo_n "checking return type of signal handlers... " >&6; }
 if test "${ac_cv_type_signal+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -52453,20 +54820,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_type_signal=int
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_type_signal=void
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5
-echo "${ECHO_T}$ac_cv_type_signal" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5
+$as_echo "$ac_cv_type_signal" >&6; }
 
 cat >>confdefs.h <<_ACEOF
 #define RETSIGTYPE $ac_cv_type_signal
 _ACEOF
 
 
-{ echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5
-echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5
+$as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; }
 if test "${ac_cv_struct_tm+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -52501,7 +54869,7 @@ main ()
 {
 struct tm tm;
                                     int *p = &tm.tm_sec;
-                                    return !p;
+                                    return !p;
   ;
   return 0;
 }
@@ -52512,20 +54880,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_struct_tm=time.h
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_struct_tm=sys/time.h
@@ -52533,8 +54902,8 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5
-echo "${ECHO_T}$ac_cv_struct_tm" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5
+$as_echo "$ac_cv_struct_tm" >&6; }
 if test $ac_cv_struct_tm = sys/time.h; then
 
 cat >>confdefs.h <<\_ACEOF
 
 
       ## lifted from config/gnulib/socklen.m4
-            { echo "$as_me:$LINENO: checking for socklen_t equivalent" >&5
-echo $ECHO_N "checking for socklen_t equivalent... $ECHO_C" >&6; }
+            { $as_echo "$as_me:$LINENO: checking for socklen_t equivalent" >&5
+$as_echo_n "checking for socklen_t equivalent... " >&6; }
       if test "${gl_cv_socklen_t_equiv+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   # Systems have either "struct sockaddr *" or
         # "void *" as the second argument to getpeername
@@ -52580,20 +54949,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   gl_cv_socklen_t_equiv="$t"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 
@@ -52612,8 +54982,8 @@ fi
       if test "$gl_cv_socklen_t_equiv" = ""; then
        gl_cv_socklen_t_equiv=socklen_t
       fi
-      { echo "$as_me:$LINENO: result: $gl_cv_socklen_t_equiv" >&5
-echo "${ECHO_T}$gl_cv_socklen_t_equiv" >&6; }
+      { $as_echo "$as_me:$LINENO: result: $gl_cv_socklen_t_equiv" >&5
+$as_echo "$gl_cv_socklen_t_equiv" >&6; }
 
 
 cat >>confdefs.h <<_ACEOF
@@ -52623,18 +54993,22 @@ _ACEOF
 
 
 
-    { echo "$as_me:$LINENO: checking for sa_family_t" >&5
-echo $ECHO_N "checking for sa_family_t... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for sa_family_t" >&5
+$as_echo_n "checking for sa_family_t... " >&6; }
 if test "${ac_cv_type_sa_family_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
+  ac_cv_type_sa_family_t=no
+cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
 #ifdef STDC_HEADERS
 #include <stdlib.h>
 #include <stddef.h>
@@ -52643,14 +55017,56 @@ cat >>conftest.$ac_ext <<_ACEOF
 
 
 
-typedef sa_family_t ac__type_new_;
 int
 main ()
 {
-if ((ac__type_new_ *) 0)
-  return 0;
-if (sizeof (ac__type_new_))
+if (sizeof (sa_family_t))
+       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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+#include <sys/socket.h>
+
+
+
+int
+main ()
+{
+if (sizeof ((sa_family_t)))
+         return 0;
   ;
   return 0;
 }
@@ -52661,30 +55077,39 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
-  ac_cv_type_sa_family_t=yes
+  :
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_cv_type_sa_family_t=no
+       ac_cv_type_sa_family_t=yes
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+  $as_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
-{ echo "$as_me:$LINENO: result: $ac_cv_type_sa_family_t" >&5
-echo "${ECHO_T}$ac_cv_type_sa_family_t" >&6; }
-if test $ac_cv_type_sa_family_t = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_sa_family_t" >&5
+$as_echo "$ac_cv_type_sa_family_t" >&6; }
+if test "x$ac_cv_type_sa_family_t" = x""yes; then
   :
 else
 
 
 
 
-    { echo "$as_me:$LINENO: checking for in_port_t" >&5
-echo $ECHO_N "checking for in_port_t... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for in_port_t" >&5
+$as_echo_n "checking for in_port_t... " >&6; }
 if test "${ac_cv_type_in_port_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
+  ac_cv_type_in_port_t=no
+cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
 #ifdef STDC_HEADERS
 #include <stdlib.h>
 #include <stddef.h>
@@ -52719,14 +55148,56 @@ cat >>conftest.$ac_ext <<_ACEOF
 
 
 
-typedef in_port_t ac__type_new_;
 int
 main ()
 {
-if ((ac__type_new_ *) 0)
-  return 0;
-if (sizeof (ac__type_new_))
+if (sizeof (in_port_t))
+       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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+#include <netinet/in.h>
+
+
+
+int
+main ()
+{
+if (sizeof ((in_port_t)))
+         return 0;
   ;
   return 0;
 }
@@ -52737,30 +55208,39 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
-  ac_cv_type_in_port_t=yes
+  :
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_cv_type_in_port_t=no
+       ac_cv_type_in_port_t=yes
 fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_in_port_t" >&5
-echo "${ECHO_T}$ac_cv_type_in_port_t" >&6; }
-if test $ac_cv_type_in_port_t = yes; then
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_in_port_t" >&5
+$as_echo "$ac_cv_type_in_port_t" >&6; }
+if test "x$ac_cv_type_in_port_t" = x""yes; then
   :
 else
 
 
 for ac_header in sys/wait.h wait.h
 do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+as_ac_Header=`$as_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; }
+  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -52808,32 +55289,33 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -52847,79 +55329,83 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
         test ! -s conftest.err
        }; then
   ac_header_preproc=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&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; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
 
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
+as_val=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
 
 done
 
-    { echo "$as_me:$LINENO: checking whether wait uses union wait" >&5
-echo $ECHO_N "checking whether wait uses union wait... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking whether wait uses union wait" >&5
+$as_echo_n "checking whether wait uses union wait... " >&6; }
 if test "${cf_cv_arg_union_wait+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
         cat >conftest.$ac_ext <<_ACEOF
@@ -52960,20 +55446,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   cf_cv_arg_union_wait=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        cf_cv_arg_union_wait=no
@@ -52981,8 +55468,8 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $cf_cv_arg_union_wait" >&5
-echo "${ECHO_T}$cf_cv_arg_union_wait" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $cf_cv_arg_union_wait" >&5
+$as_echo "$cf_cv_arg_union_wait" >&6; }
     if test $cf_cv_arg_union_wait = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -52997,20 +55484,21 @@ _ACEOF
 
 for ac_header in sys/wait.h wait.h
 do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+as_ac_Header=`$as_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; }
+  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -53026,32 +55514,33 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -53065,79 +55554,83 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
         test ! -s conftest.err
        }; then
   ac_header_preproc=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&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; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
 
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
+as_val=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
 
 done
 
-    { echo "$as_me:$LINENO: checking whether wait uses int" >&5
-echo $ECHO_N "checking whether wait uses int... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking whether wait uses int" >&5
+$as_echo_n "checking whether wait uses int... " >&6; }
 if test "${cf_cv_arg_int+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
         cat >conftest.$ac_ext <<_ACEOF
@@ -53178,20 +55671,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   cf_cv_arg_int=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        cf_cv_arg_int=no
@@ -53199,8 +55693,8 @@ fi
 
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $cf_cv_arg_int" >&5
-echo "${ECHO_T}$cf_cv_arg_int" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $cf_cv_arg_int" >&5
+$as_echo "$cf_cv_arg_int" >&6; }
 if test $cf_cv_arg_int = yes; then
 
 cat >>confdefs.h <<\_ACEOF
 #
 # cur_colr is on some HP's
 
-{ echo "$as_me:$LINENO: checking for main in -lcur_colr" >&5
-echo $ECHO_N "checking for main in -lcur_colr... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for main in -lcur_colr" >&5
+$as_echo_n "checking for main in -lcur_colr... " >&6; }
 if test "${ac_cv_lib_cur_colr_main+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lcur_colr  $LIBS"
@@ -53244,33 +55738,37 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_cur_colr_main=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_cur_colr_main=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_cur_colr_main" >&5
-echo "${ECHO_T}$ac_cv_lib_cur_colr_main" >&6; }
-if test $ac_cv_lib_cur_colr_main = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_cur_colr_main" >&5
+$as_echo "$ac_cv_lib_cur_colr_main" >&6; }
+if test "x$ac_cv_lib_cur_colr_main" = x""yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBCUR_COLR 1
 _ACEOF
@@ -53280,10 +55778,10 @@ _ACEOF
 fi
 
 
-{ echo "$as_me:$LINENO: checking for main in -lintl" >&5
-echo $ECHO_N "checking for main in -lintl... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for main in -lintl" >&5
+$as_echo_n "checking for main in -lintl... " >&6; }
 if test "${ac_cv_lib_intl_main+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lintl  $LIBS"
@@ -53309,33 +55807,37 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_intl_main=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_intl_main=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_intl_main" >&5
-echo "${ECHO_T}$ac_cv_lib_intl_main" >&6; }
-if test $ac_cv_lib_intl_main = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_intl_main" >&5
+$as_echo "$ac_cv_lib_intl_main" >&6; }
+if test "x$ac_cv_lib_intl_main" = x""yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBINTL 1
 _ACEOF
     case "$target" in
        *sgi-irix*)
 
-{ echo "$as_me:$LINENO: checking for main in -lsocket" >&5
-echo $ECHO_N "checking for main in -lsocket... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for main in -lsocket" >&5
+$as_echo_n "checking for main in -lsocket... " >&6; }
 if test "${ac_cv_lib_socket_main+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lsocket  $LIBS"
@@ -53378,33 +55880,37 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_socket_main=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_socket_main=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_socket_main" >&5
-echo "${ECHO_T}$ac_cv_lib_socket_main" >&6; }
-if test $ac_cv_lib_socket_main = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_socket_main" >&5
+$as_echo "$ac_cv_lib_socket_main" >&6; }
+if test "x$ac_cv_lib_socket_main" = x""yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBSOCKET 1
 _ACEOF
                            ;;
        *)
 
-{ echo "$as_me:$LINENO: checking for main in -lresolv" >&5
-echo $ECHO_N "checking for main in -lresolv... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for main in -lresolv" >&5
+$as_echo_n "checking for main in -lresolv... " >&6; }
 if test "${ac_cv_lib_resolv_main+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lresolv  $LIBS"
@@ -53445,33 +55951,37 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_resolv_main=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_resolv_main=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_resolv_main" >&5
-echo "${ECHO_T}$ac_cv_lib_resolv_main" >&6; }
-if test $ac_cv_lib_resolv_main = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_resolv_main" >&5
+$as_echo "$ac_cv_lib_resolv_main" >&6; }
+if test "x$ac_cv_lib_resolv_main" = x""yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBRESOLV 1
 _ACEOF
@@ -53481,10 +55991,10 @@ _ACEOF
 fi
 
 
-{ echo "$as_me:$LINENO: checking for main in -lnsl" >&5
-echo $ECHO_N "checking for main in -lnsl... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for main in -lnsl" >&5
+$as_echo_n "checking for main in -lnsl... " >&6; }
 if test "${ac_cv_lib_nsl_main+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lnsl  $LIBS"
@@ -53510,33 +56020,37 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_nsl_main=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_nsl_main=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_main" >&5
-echo "${ECHO_T}$ac_cv_lib_nsl_main" >&6; }
-if test $ac_cv_lib_nsl_main = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_main" >&5
+$as_echo "$ac_cv_lib_nsl_main" >&6; }
+if test "x$ac_cv_lib_nsl_main" = x""yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBNSL 1
 _ACEOF
@@ -53546,10 +56060,10 @@ _ACEOF
 fi
 
 
-{ echo "$as_me:$LINENO: checking for main in -lsocket" >&5
-echo $ECHO_N "checking for main in -lsocket... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for main in -lsocket" >&5
+$as_echo_n "checking for main in -lsocket... " >&6; }
 if test "${ac_cv_lib_socket_main+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lsocket  $LIBS"
@@ -53575,33 +56089,37 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_socket_main=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_socket_main=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_socket_main" >&5
-echo "${ECHO_T}$ac_cv_lib_socket_main" >&6; }
-if test $ac_cv_lib_socket_main = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_socket_main" >&5
+$as_echo "$ac_cv_lib_socket_main" >&6; }
+if test "x$ac_cv_lib_socket_main" = x""yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBSOCKET 1
 _ACEOF
@@ -53611,10 +56129,10 @@ _ACEOF
 fi
 
 
-{ echo "$as_me:$LINENO: checking for main in -lsun" >&5
-echo $ECHO_N "checking for main in -lsun... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for main in -lsun" >&5
+$as_echo_n "checking for main in -lsun... " >&6; }
 if test "${ac_cv_lib_sun_main+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lsun  $LIBS"
@@ -53640,33 +56158,37 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_sun_main=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_sun_main=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_sun_main" >&5
-echo "${ECHO_T}$ac_cv_lib_sun_main" >&6; }
-if test $ac_cv_lib_sun_main = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_sun_main" >&5
+$as_echo "$ac_cv_lib_sun_main" >&6; }
+if test "x$ac_cv_lib_sun_main" = x""yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBSUN 1
 _ACEOF
     # system-specific search paths.
     # Extract the first word of "pkg-config", so it can be a program name with args.
 set dummy pkg-config; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_PKG_CONFIG+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $PKG_CONFIG in
   [\\/]* | ?:[\\/]*)
@@ -53702,7 +56224,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -53714,11 +56236,11 @@ esac
 fi
 PKG_CONFIG=$ac_cv_path_PKG_CONFIG
 if test -n "$PKG_CONFIG"; then
-  { echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5
-echo "${ECHO_T}$PKG_CONFIG" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -53760,6 +56282,9 @@ fi
          gthread)
              pkg_config_args="$pkg_config_args gthread-2.0"
          ;;
+         gio*)
+             pkg_config_args="$pkg_config_args $module-2.0"
+         ;;
       esac
   done
 
@@ -53769,10 +56294,10 @@ if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
        if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
 set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_PKG_CONFIG+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $PKG_CONFIG in
   [\\/]* | ?:[\\/]*)
@@ -53787,7 +56312,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -53799,11 +56324,11 @@ esac
 fi
 PKG_CONFIG=$ac_cv_path_PKG_CONFIG
 if test -n "$PKG_CONFIG"; then
-  { echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5
-echo "${ECHO_T}$PKG_CONFIG" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -53812,10 +56337,10 @@ if test -z "$ac_cv_path_PKG_CONFIG"; then
   ac_pt_PKG_CONFIG=$PKG_CONFIG
   # Extract the first word of "pkg-config", so it can be a program name with args.
 set dummy pkg-config; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $ac_pt_PKG_CONFIG in
   [\\/]* | ?:[\\/]*)
@@ -53830,7 +56355,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -53842,11 +56367,11 @@ esac
 fi
 ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
 if test -n "$ac_pt_PKG_CONFIG"; then
-  { echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5
-echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5
+$as_echo "$ac_pt_PKG_CONFIG" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
   if test "x$ac_pt_PKG_CONFIG" = x; then
   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;}
+{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
     PKG_CONFIG=$ac_pt_PKG_CONFIG
 
 fi
 if test -n "$PKG_CONFIG"; then
-       _pkg_min_version=0.16
-       { echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5
-echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6; }
+       _pkg_min_version=0.7
+       { $as_echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5
+$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
        if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
-               { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+               { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
        else
-               { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+               { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
                PKG_CONFIG=""
        fi
 
@@ -53892,8 +56413,8 @@ fi
   fi
 
   min_glib_version=2.2.0
-  { echo "$as_me:$LINENO: checking for GLIB - version >= $min_glib_version" >&5
-echo $ECHO_N "checking for GLIB - version >= $min_glib_version... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for GLIB - version >= $min_glib_version" >&5
+$as_echo_n "checking for GLIB - version >= $min_glib_version... " >&6; }
 
   if test x$PKG_CONFIG != xno ; then
     ## don't try to run the test against uninstalled libtool libs
@@ -54016,29 +56537,32 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
 no_glib=yes
 fi
+rm -rf conftest.dSYM
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 
      fi
   fi
   if test "x$no_glib" = x ; then
-     { echo "$as_me:$LINENO: result: yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)" >&5
-echo "${ECHO_T}yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)" >&6; }
+     { $as_echo "$as_me:$LINENO: result: yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)" >&5
+$as_echo "yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)" >&6; }
      :
   else
-     { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+     { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
      if test "$PKG_CONFIG" = "no" ; then
        echo "*** A new enough version of pkg-config was not found."
        echo "*** See http://www.freedesktop.org/software/pkgconfig/"
@@ -54090,18 +56614,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
    echo "*** The test program compiled, but did not run. This usually means"
           echo "*** that the run-time linker is not finding GLIB or finding the wrong"
           echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
@@ -54112,13 +56639,14 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
           echo "*** If you have an old version installed, it is best to remove it, although"
           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
         echo "*** The test program failed to compile or link. See the file config.log for the"
           echo "*** exact error that occured. This usually means GLIB is incorrectly installed."
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
           CFLAGS="$ac_save_CFLAGS"
@@ -54131,8 +56659,8 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
      GOBJECT_QUERY=""
      GLIB_MKENUMS=""
 
-       { { echo "$as_me:$LINENO: error: glib not found or too old; See http://wiki.zmanda.com/index.php/Installation for help" >&5
-echo "$as_me: error: glib not found or too old; See http://wiki.zmanda.com/index.php/Installation for help" >&2;}
+       { { $as_echo "$as_me:$LINENO: error: glib not found or too old; See http://wiki.zmanda.com/index.php/Installation for help" >&5
+$as_echo "$as_me: error: glib not found or too old; See http://wiki.zmanda.com/index.php/Installation for help" >&2;}
    { (exit 1); exit 1; }; }
 
   fi
@@ -54143,9 +56671,8 @@ echo "$as_me: error: glib not found or too old; See http://wiki.zmanda.com/index
 
   rm -f conf.glibtest
 
-    CFLAGS="$CFLAGS $GLIB_CFLAGS"
-
-    CPPFLAGS="$CPPFLAGS $GLIB_CPPFLAGS"
+    # GLIB_CPPFLAGS is not set by autoconf, yet GLIB_CFLAGS contains what GLIB_CPPFLAGS should contain.
+    CPPFLAGS="$CPPFLAGS $GLIB_CFLAGS"
 
     LIBS="$GLIB_LIBS $LIBS"
 
@@ -54157,8 +56684,8 @@ if test "${with_readline+set}" = set; then
   withval=$with_readline;
             case "$withval" in
                 y | ye | yes | n | no) : ;;
-                *) { { echo "$as_me:$LINENO: error: *** --with-readline does not take a value" >&5
-echo "$as_me: error: *** --with-readline does not take a value" >&2;}
+                *) { { $as_echo "$as_me:$LINENO: error: *** --with-readline does not take a value" >&5
+$as_echo "$as_me: error: *** --with-readline does not take a value" >&2;}
    { (exit 1); exit 1; }; }
             esac
             want_readline="$withval"
     if test x"$want_readline" != x"no"; then
         # we need a tgetent() somewhere..
         proceed="false"
-        { echo "$as_me:$LINENO: checking for tgetent in -ltermcap" >&5
-echo $ECHO_N "checking for tgetent in -ltermcap... $ECHO_C" >&6; }
+        { $as_echo "$as_me:$LINENO: checking for tgetent in -ltermcap" >&5
+$as_echo_n "checking for tgetent in -ltermcap... " >&6; }
 if test "${ac_cv_lib_termcap_tgetent+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ltermcap  $LIBS"
@@ -54209,43 +56736,47 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_termcap_tgetent=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_termcap_tgetent=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_termcap_tgetent" >&5
-echo "${ECHO_T}$ac_cv_lib_termcap_tgetent" >&6; }
-if test $ac_cv_lib_termcap_tgetent = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_termcap_tgetent" >&5
+$as_echo "$ac_cv_lib_termcap_tgetent" >&6; }
+if test "x$ac_cv_lib_termcap_tgetent" = x""yes; then
 
             READLINE_LIBS="-ltermcap"
             proceed="true"
 
 else
 
-            { echo "$as_me:$LINENO: checking for tgetent in -lcurses" >&5
-echo $ECHO_N "checking for tgetent in -lcurses... $ECHO_C" >&6; }
+            { $as_echo "$as_me:$LINENO: checking for tgetent in -lcurses" >&5
+$as_echo_n "checking for tgetent in -lcurses... " >&6; }
 if test "${ac_cv_lib_curses_tgetent+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lcurses  $LIBS"
@@ -54277,43 +56808,47 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_curses_tgetent=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_curses_tgetent=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_curses_tgetent" >&5
-echo "${ECHO_T}$ac_cv_lib_curses_tgetent" >&6; }
-if test $ac_cv_lib_curses_tgetent = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_curses_tgetent" >&5
+$as_echo "$ac_cv_lib_curses_tgetent" >&6; }
+if test "x$ac_cv_lib_curses_tgetent" = x""yes; then
 
                 READLINE_LIBS="-lcurses"
                 proceed="true"
 
 else
 
-                { echo "$as_me:$LINENO: checking for tgetent in -lncurses" >&5
-echo $ECHO_N "checking for tgetent in -lncurses... $ECHO_C" >&6; }
+                { $as_echo "$as_me:$LINENO: checking for tgetent in -lncurses" >&5
+$as_echo_n "checking for tgetent in -lncurses... " >&6; }
 if test "${ac_cv_lib_ncurses_tgetent+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lncurses  $LIBS"
@@ -54345,33 +56880,37 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_ncurses_tgetent=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_ncurses_tgetent=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_ncurses_tgetent" >&5
-echo "${ECHO_T}$ac_cv_lib_ncurses_tgetent" >&6; }
-if test $ac_cv_lib_ncurses_tgetent = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_ncurses_tgetent" >&5
+$as_echo "$ac_cv_lib_ncurses_tgetent" >&6; }
+if test "x$ac_cv_lib_ncurses_tgetent" = x""yes; then
 
                     READLINE_LIBS="-lncurses"
                     proceed="true"
 
 for ac_header in history.h readline.h readline/history.h readline/readline.h
 do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+as_ac_Header=`$as_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; }
+  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -54422,32 +56962,33 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -54461,69 +57002,73 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
         test ! -s conftest.err
        }; then
   ac_header_preproc=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&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; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
 
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
+as_val=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
                 # found at least one of the headers, so we can proceed.
@@ -54537,10 +57082,10 @@ done
 
         if $proceed; then
             proceed="false"
-            { echo "$as_me:$LINENO: checking for readline in -lreadline" >&5
-echo $ECHO_N "checking for readline in -lreadline... $ECHO_C" >&6; }
+            { $as_echo "$as_me:$LINENO: checking for readline in -lreadline" >&5
+$as_echo_n "checking for readline in -lreadline... " >&6; }
 if test "${ac_cv_lib_readline_readline+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lreadline $READLINE_LIBS $LIBS"
@@ -54572,33 +57117,37 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_readline_readline=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_readline_readline=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_readline_readline" >&5
-echo "${ECHO_T}$ac_cv_lib_readline_readline" >&6; }
-if test $ac_cv_lib_readline_readline = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_readline_readline" >&5
+$as_echo "$ac_cv_lib_readline_readline" >&6; }
+if test "x$ac_cv_lib_readline_readline" = x""yes; then
 
                 READLINE_LIBS="-lreadline $READLINE_LIBS"
                 proceed="true"
@@ -54617,8 +57166,8 @@ _ACEOF
         else
             # no readline.  if the user *really* wanted it, bail out.
             if test x"$want_readline" = x"yes"; then
-                { { echo "$as_me:$LINENO: error: *** No readline implementation found.  Try using --with-libraries and --with-includes" >&5
-echo "$as_me: error: *** No readline implementation found.  Try using --with-libraries and --with-includes" >&2;}
+                { { $as_echo "$as_me:$LINENO: error: *** No readline implementation found.  Try using --with-libraries and --with-includes" >&5
+$as_echo "$as_me: error: *** No readline implementation found.  Try using --with-libraries and --with-includes" >&2;}
    { (exit 1); exit 1; }; }
             fi
             READLINE_LIBS=""
@@ -54627,10 +57176,10 @@ echo "$as_me: error: *** No readline implementation found.  Try using --with-lib
 
 
 
-{ echo "$as_me:$LINENO: checking for modf in -lm" >&5
-echo $ECHO_N "checking for modf in -lm... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for modf in -lm" >&5
+$as_echo_n "checking for modf in -lm... " >&6; }
 if test "${ac_cv_lib_m_modf+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lm  $LIBS"
@@ -54662,33 +57211,37 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_m_modf=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_m_modf=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_m_modf" >&5
-echo "${ECHO_T}$ac_cv_lib_m_modf" >&6; }
-if test $ac_cv_lib_m_modf = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_m_modf" >&5
+$as_echo "$ac_cv_lib_m_modf" >&6; }
+if test "x$ac_cv_lib_m_modf" = x""yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBM 1
 _ACEOF
 
 
     if test "${ac_cv_header_execinfo_h+set}" = set; then
-  { echo "$as_me:$LINENO: checking for execinfo.h" >&5
-echo $ECHO_N "checking for execinfo.h... $ECHO_C" >&6; }
+  { $as_echo "$as_me:$LINENO: checking for execinfo.h" >&5
+$as_echo_n "checking for execinfo.h... " >&6; }
 if test "${ac_cv_header_execinfo_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_execinfo_h" >&5
-echo "${ECHO_T}$ac_cv_header_execinfo_h" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_execinfo_h" >&5
+$as_echo "$ac_cv_header_execinfo_h" >&6; }
 else
   # Is the header compilable?
-{ echo "$as_me:$LINENO: checking execinfo.h usability" >&5
-echo $ECHO_N "checking execinfo.h usability... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking execinfo.h usability" >&5
+$as_echo_n "checking execinfo.h usability... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -54725,32 +57278,33 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
 
 # Is the header present?
-{ echo "$as_me:$LINENO: checking execinfo.h presence" >&5
-echo $ECHO_N "checking execinfo.h presence... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking execinfo.h presence" >&5
+$as_echo_n "checking execinfo.h presence... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -54764,71 +57318,72 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
         test ! -s conftest.err
        }; then
   ac_header_preproc=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
   yes:no: )
-    { echo "$as_me:$LINENO: WARNING: execinfo.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: execinfo.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: execinfo.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: execinfo.h: proceeding with the compiler's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: execinfo.h: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: execinfo.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: execinfo.h: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: execinfo.h: proceeding with the compiler's result" >&2;}
     ac_header_preproc=yes
     ;;
   no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: execinfo.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: execinfo.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: execinfo.h:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: execinfo.h:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: execinfo.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: execinfo.h: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: execinfo.h:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: execinfo.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: execinfo.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: execinfo.h: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: execinfo.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: execinfo.h: in the future, the compiler will take precedence" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: execinfo.h: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: execinfo.h: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: execinfo.h:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: execinfo.h:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: execinfo.h: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: execinfo.h: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: execinfo.h:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: execinfo.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: execinfo.h: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: execinfo.h: proceeding with the preprocessor's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: execinfo.h: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: execinfo.h: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for execinfo.h" >&5
-echo $ECHO_N "checking for execinfo.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for execinfo.h" >&5
+$as_echo_n "checking for execinfo.h... " >&6; }
 if test "${ac_cv_header_execinfo_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_cv_header_execinfo_h=$ac_header_preproc
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_execinfo_h" >&5
-echo "${ECHO_T}$ac_cv_header_execinfo_h" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_execinfo_h" >&5
+$as_echo "$ac_cv_header_execinfo_h" >&6; }
 
 fi
-if test $ac_cv_header_execinfo_h = yes; then
+if test "x$ac_cv_header_execinfo_h" = x""yes; then
 
-       { echo "$as_me:$LINENO: checking for backtrace_symbols_fd" >&5
-echo $ECHO_N "checking for backtrace_symbols_fd... $ECHO_C" >&6; }
+       { $as_echo "$as_me:$LINENO: checking for backtrace_symbols_fd" >&5
+$as_echo_n "checking for backtrace_symbols_fd... " >&6; }
 if test "${ac_cv_func_backtrace_symbols_fd+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -54881,32 +57436,36 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_func_backtrace_symbols_fd=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_func_backtrace_symbols_fd=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_backtrace_symbols_fd" >&5
-echo "${ECHO_T}$ac_cv_func_backtrace_symbols_fd" >&6; }
-if test $ac_cv_func_backtrace_symbols_fd = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_backtrace_symbols_fd" >&5
+$as_echo "$ac_cv_func_backtrace_symbols_fd" >&6; }
+if test "x$ac_cv_func_backtrace_symbols_fd" = x""yes; then
 
 
 cat >>confdefs.h <<\_ACEOF
@@ -54936,11 +57495,11 @@ ice_have_accept=no
 
 for ac_func in accept
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -54993,45 +57552,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_accept=yes
 fi
 done
 
 if test "${ice_have_accept}" = yes; then
-{ echo "$as_me:$LINENO: checking for accept declaration in sys/types.h sys/socket.h" >&5
-echo $ECHO_N "checking for accept declaration in sys/types.h sys/socket.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for accept declaration in sys/types.h sys/socket.h" >&5
+$as_echo_n "checking for accept declaration in sys/types.h sys/socket.h... " >&6; }
 if test "${ice_cv_have_accept_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_accept_decl=no
@@ -55080,8 +57646,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_accept_decl" >&5
-echo "${ECHO_T}$ice_cv_have_accept_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_accept_decl" >&5
+$as_echo "$ice_cv_have_accept_decl" >&6; }
 if test "$ice_cv_have_accept_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
 
 # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
 # for constant arguments.  Useless!
-{ echo "$as_me:$LINENO: checking for working alloca.h" >&5
-echo $ECHO_N "checking for working alloca.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for working alloca.h" >&5
+$as_echo_n "checking for working alloca.h... " >&6; }
 if test "${ac_cv_working_alloca_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -55120,31 +57686,35 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_working_alloca_h=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_working_alloca_h=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_working_alloca_h" >&5
-echo "${ECHO_T}$ac_cv_working_alloca_h" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_working_alloca_h" >&5
+$as_echo "$ac_cv_working_alloca_h" >&6; }
 if test $ac_cv_working_alloca_h = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -55153,10 +57723,10 @@ _ACEOF
 
 fi
 
-{ echo "$as_me:$LINENO: checking for alloca" >&5
-echo $ECHO_N "checking for alloca... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for alloca" >&5
+$as_echo_n "checking for alloca... " >&6; }
 if test "${ac_cv_func_alloca_works+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -55200,31 +57770,35 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_func_alloca_works=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_func_alloca_works=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_alloca_works" >&5
-echo "${ECHO_T}$ac_cv_func_alloca_works" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_alloca_works" >&5
+$as_echo "$ac_cv_func_alloca_works" >&6; }
 
 if test $ac_cv_func_alloca_works = yes; then
 
@@ -55245,10 +57819,10 @@ cat >>confdefs.h <<\_ACEOF
 _ACEOF
 
 
-{ echo "$as_me:$LINENO: checking whether \`alloca.c' needs Cray hooks" >&5
-echo $ECHO_N "checking whether \`alloca.c' needs Cray hooks... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking whether \`alloca.c' needs Cray hooks" >&5
+$as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; }
 if test "${ac_cv_os_cray+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 rm -f conftest*
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_os_cray" >&5
-echo "${ECHO_T}$ac_cv_os_cray" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_os_cray" >&5
+$as_echo "$ac_cv_os_cray" >&6; }
 if test $ac_cv_os_cray = yes; then
   for ac_func in _getb67 GETB67 getb67; 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; }
+    as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -55333,33 +57907,40 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
 
 cat >>confdefs.h <<_ACEOF
 #define CRAY_STACKSEG_END $ac_func
   done
 fi
 
-{ echo "$as_me:$LINENO: checking stack direction for C alloca" >&5
-echo $ECHO_N "checking stack direction for C alloca... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking stack direction for C alloca" >&5
+$as_echo_n "checking stack direction for C alloca... " >&6; }
 if test "${ac_cv_c_stack_direction+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test "$cross_compiling" = yes; then
   ac_cv_c_stack_direction=0
@@ -55412,36 +57993,39 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_c_stack_direction=1
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
 ac_cv_c_stack_direction=-1
 fi
+rm -rf conftest.dSYM
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5
-echo "${ECHO_T}$ac_cv_c_stack_direction" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5
+$as_echo "$ac_cv_c_stack_direction" >&6; }
 
 cat >>confdefs.h <<_ACEOF
 #define STACK_DIRECTION $ac_cv_c_stack_direction
 
 for ac_func in atexit
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -55510,35 +58094,42 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -55549,11 +58140,11 @@ ice_have_atof=no
 
 for ac_func in atof
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -55606,45 +58197,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_atof=yes
 fi
 done
 
 if test "${ice_have_atof}" = yes; then
-{ echo "$as_me:$LINENO: checking for atof declaration in stdlib.h" >&5
-echo $ECHO_N "checking for atof declaration in stdlib.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for atof declaration in stdlib.h" >&5
+$as_echo_n "checking for atof declaration in stdlib.h... " >&6; }
 if test "${ice_cv_have_atof_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_atof_decl=no
@@ -55693,8 +58291,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_atof_decl" >&5
-echo "${ECHO_T}$ice_cv_have_atof_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_atof_decl" >&5
+$as_echo "$ice_cv_have_atof_decl" >&6; }
 if test "$ice_cv_have_atof_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -55709,11 +58307,11 @@ ice_have_atol=no
 
 for ac_func in atol
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -55766,45 +58364,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_atol=yes
 fi
 done
 
 if test "${ice_have_atol}" = yes; then
-{ echo "$as_me:$LINENO: checking for atol declaration in stdlib.h" >&5
-echo $ECHO_N "checking for atol declaration in stdlib.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for atol declaration in stdlib.h" >&5
+$as_echo_n "checking for atol declaration in stdlib.h... " >&6; }
 if test "${ice_cv_have_atol_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_atol_decl=no
@@ -55853,8 +58458,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_atol_decl" >&5
-echo "${ECHO_T}$ice_cv_have_atol_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_atol_decl" >&5
+$as_echo "$ice_cv_have_atol_decl" >&6; }
 if test "$ice_cv_have_atol_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -55869,11 +58474,11 @@ ice_have_atoll=no
 
 for ac_func in atoll
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -55926,45 +58531,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_atoll=yes
 fi
 done
 
 if test "${ice_have_atoll}" = yes; then
-{ echo "$as_me:$LINENO: checking for atoll declaration in stdlib.h" >&5
-echo $ECHO_N "checking for atoll declaration in stdlib.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for atoll declaration in stdlib.h" >&5
+$as_echo_n "checking for atoll declaration in stdlib.h... " >&6; }
 if test "${ice_cv_have_atoll_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_atoll_decl=no
@@ -56013,8 +58625,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_atoll_decl" >&5
-echo "${ECHO_T}$ice_cv_have_atoll_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_atoll_decl" >&5
+$as_echo "$ice_cv_have_atoll_decl" >&6; }
 if test "$ice_cv_have_atoll_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -56029,11 +58641,11 @@ ice_have_strtol=no
 
 for ac_func in strtol
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -56086,45 +58698,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_strtol=yes
 fi
 done
 
 if test "${ice_have_strtol}" = yes; then
-{ echo "$as_me:$LINENO: checking for strtol declaration in stdlib.h" >&5
-echo $ECHO_N "checking for strtol declaration in stdlib.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for strtol declaration in stdlib.h" >&5
+$as_echo_n "checking for strtol declaration in stdlib.h... " >&6; }
 if test "${ice_cv_have_strtol_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_strtol_decl=no
@@ -56173,8 +58792,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_strtol_decl" >&5
-echo "${ECHO_T}$ice_cv_have_strtol_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_strtol_decl" >&5
+$as_echo "$ice_cv_have_strtol_decl" >&6; }
 if test "$ice_cv_have_strtol_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -56189,11 +58808,11 @@ ice_have_strtoll=no
 
 for ac_func in strtoll
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -56246,45 +58865,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_strtoll=yes
 fi
 done
 
 if test "${ice_have_strtoll}" = yes; then
-{ echo "$as_me:$LINENO: checking for strtoll declaration in stdlib.h" >&5
-echo $ECHO_N "checking for strtoll declaration in stdlib.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for strtoll declaration in stdlib.h" >&5
+$as_echo_n "checking for strtoll declaration in stdlib.h... " >&6; }
 if test "${ice_cv_have_strtoll_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_strtoll_decl=no
@@ -56333,8 +58959,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_strtoll_decl" >&5
-echo "${ECHO_T}$ice_cv_have_strtoll_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_strtoll_decl" >&5
+$as_echo "$ice_cv_have_strtoll_decl" >&6; }
 if test "$ice_cv_have_strtoll_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
 
 for ac_func in basename
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -56404,35 +59030,42 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -56443,11 +59076,11 @@ ice_have_bind=no
 
 for ac_func in bind
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -56500,45 +59133,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_bind=yes
 fi
 done
 
 if test "${ice_have_bind}" = yes; then
-{ echo "$as_me:$LINENO: checking for bind declaration in sys/types.h sys/socket.h" >&5
-echo $ECHO_N "checking for bind declaration in sys/types.h sys/socket.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for bind declaration in sys/types.h sys/socket.h" >&5
+$as_echo_n "checking for bind declaration in sys/types.h sys/socket.h... " >&6; }
 if test "${ice_cv_have_bind_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_bind_decl=no
@@ -56587,8 +59227,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_bind_decl" >&5
-echo "${ECHO_T}$ice_cv_have_bind_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_bind_decl" >&5
+$as_echo "$ice_cv_have_bind_decl" >&6; }
 if test "$ice_cv_have_bind_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -56603,11 +59243,11 @@ ice_have_bcopy=no
 
 for ac_func in bcopy
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -56660,45 +59300,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_bcopy=yes
 fi
 done
 
 if test "${ice_have_bcopy}" = yes; then
-{ echo "$as_me:$LINENO: checking for bcopy declaration in string.h strings.h stdlib.h" >&5
-echo $ECHO_N "checking for bcopy declaration in string.h strings.h stdlib.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for bcopy declaration in string.h strings.h stdlib.h" >&5
+$as_echo_n "checking for bcopy declaration in string.h strings.h stdlib.h... " >&6; }
 if test "${ice_cv_have_bcopy_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_bcopy_decl=no
@@ -56747,8 +59394,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_bcopy_decl" >&5
-echo "${ECHO_T}$ice_cv_have_bcopy_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_bcopy_decl" >&5
+$as_echo "$ice_cv_have_bcopy_decl" >&6; }
 if test "$ice_cv_have_bcopy_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -56763,11 +59410,11 @@ ice_have_bzero=no
 
 for ac_func in bzero
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -56820,45 +59467,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_bzero=yes
 fi
 done
 
 if test "${ice_have_bzero}" = yes; then
-{ echo "$as_me:$LINENO: checking for bzero declaration in string.h strings.h stdlib.h" >&5
-echo $ECHO_N "checking for bzero declaration in string.h strings.h stdlib.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for bzero declaration in string.h strings.h stdlib.h" >&5
+$as_echo_n "checking for bzero declaration in string.h strings.h stdlib.h... " >&6; }
 if test "${ice_cv_have_bzero_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_bzero_decl=no
@@ -56907,8 +59561,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_bzero_decl" >&5
-echo "${ECHO_T}$ice_cv_have_bzero_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_bzero_decl" >&5
+$as_echo "$ice_cv_have_bzero_decl" >&6; }
 if test "$ice_cv_have_bzero_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -56918,10 +59572,10 @@ _ACEOF
 fi
 fi
 
-{ echo "$as_me:$LINENO: checking whether closedir returns void" >&5
-echo $ECHO_N "checking whether closedir returns void... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking whether closedir returns void" >&5
+$as_echo_n "checking whether closedir returns void... " >&6; }
 if test "${ac_cv_func_closedir_void+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test "$cross_compiling" = yes; then
   ac_cv_func_closedir_void=yes
@@ -56952,36 +59606,39 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_func_closedir_void=no
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
 ac_cv_func_closedir_void=yes
 fi
+rm -rf conftest.dSYM
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_closedir_void" >&5
-echo "${ECHO_T}$ac_cv_func_closedir_void" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_closedir_void" >&5
+$as_echo "$ac_cv_func_closedir_void" >&6; }
 if test $ac_cv_func_closedir_void = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -56995,11 +59652,11 @@ ice_have_closelog=no
 
 for ac_func in closelog
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -57052,45 +59709,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_closelog=yes
 fi
 done
 
 if test "${ice_have_closelog}" = yes; then
-{ echo "$as_me:$LINENO: checking for closelog declaration in syslog.h" >&5
-echo $ECHO_N "checking for closelog declaration in syslog.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for closelog declaration in syslog.h" >&5
+$as_echo_n "checking for closelog declaration in syslog.h... " >&6; }
 if test "${ice_cv_have_closelog_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_closelog_decl=no
@@ -57139,8 +59803,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_closelog_decl" >&5
-echo "${ECHO_T}$ice_cv_have_closelog_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_closelog_decl" >&5
+$as_echo "$ice_cv_have_closelog_decl" >&6; }
 if test "$ice_cv_have_closelog_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -57155,11 +59819,11 @@ ice_have_connect=no
 
 for ac_func in connect
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -57212,45 +59876,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_connect=yes
 fi
 done
 
 if test "${ice_have_connect}" = yes; then
-{ echo "$as_me:$LINENO: checking for connect declaration in sys/types.h sys/socket.h" >&5
-echo $ECHO_N "checking for connect declaration in sys/types.h sys/socket.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for connect declaration in sys/types.h sys/socket.h" >&5
+$as_echo_n "checking for connect declaration in sys/types.h sys/socket.h... " >&6; }
 if test "${ice_cv_have_connect_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_connect_decl=no
@@ -57299,8 +59970,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_connect_decl" >&5
-echo "${ECHO_T}$ice_cv_have_connect_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_connect_decl" >&5
+$as_echo "$ice_cv_have_connect_decl" >&6; }
 if test "$ice_cv_have_connect_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -57315,11 +59986,11 @@ ice_have_fclose=no
 
 for ac_func in fclose
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -57372,45 +60043,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_fclose=yes
 fi
 done
 
 if test "${ice_have_fclose}" = yes; then
-{ echo "$as_me:$LINENO: checking for fclose declaration in stdio.h" >&5
-echo $ECHO_N "checking for fclose declaration in stdio.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for fclose declaration in stdio.h" >&5
+$as_echo_n "checking for fclose declaration in stdio.h... " >&6; }
 if test "${ice_cv_have_fclose_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_fclose_decl=no
@@ -57459,8 +60137,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_fclose_decl" >&5
-echo "${ECHO_T}$ice_cv_have_fclose_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_fclose_decl" >&5
+$as_echo "$ice_cv_have_fclose_decl" >&6; }
 if test "$ice_cv_have_fclose_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -57475,11 +60153,11 @@ ice_have_fflush=no
 
 for ac_func in fflush
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -57532,45 +60210,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_fflush=yes
 fi
 done
 
 if test "${ice_have_fflush}" = yes; then
-{ echo "$as_me:$LINENO: checking for fflush declaration in stdio.h" >&5
-echo $ECHO_N "checking for fflush declaration in stdio.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for fflush declaration in stdio.h" >&5
+$as_echo_n "checking for fflush declaration in stdio.h... " >&6; }
 if test "${ice_cv_have_fflush_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_fflush_decl=no
@@ -57619,8 +60304,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_fflush_decl" >&5
-echo "${ECHO_T}$ice_cv_have_fflush_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_fflush_decl" >&5
+$as_echo "$ice_cv_have_fflush_decl" >&6; }
 if test "$ice_cv_have_fflush_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -57635,11 +60320,11 @@ ice_have_fprintf=no
 
 for ac_func in fprintf
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -57692,45 +60377,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_fprintf=yes
 fi
 done
 
 if test "${ice_have_fprintf}" = yes; then
-{ echo "$as_me:$LINENO: checking for fprintf declaration in stdio.h" >&5
-echo $ECHO_N "checking for fprintf declaration in stdio.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for fprintf declaration in stdio.h" >&5
+$as_echo_n "checking for fprintf declaration in stdio.h... " >&6; }
 if test "${ice_cv_have_fprintf_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_fprintf_decl=no
@@ -57779,8 +60471,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_fprintf_decl" >&5
-echo "${ECHO_T}$ice_cv_have_fprintf_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_fprintf_decl" >&5
+$as_echo "$ice_cv_have_fprintf_decl" >&6; }
 if test "$ice_cv_have_fprintf_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -57795,11 +60487,11 @@ ice_have_fputc=no
 
 for ac_func in fputc
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -57852,45 +60544,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_fputc=yes
 fi
 done
 
 if test "${ice_have_fputc}" = yes; then
-{ echo "$as_me:$LINENO: checking for fputc declaration in stdio.h" >&5
-echo $ECHO_N "checking for fputc declaration in stdio.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for fputc declaration in stdio.h" >&5
+$as_echo_n "checking for fputc declaration in stdio.h... " >&6; }
 if test "${ice_cv_have_fputc_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_fputc_decl=no
@@ -57939,8 +60638,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_fputc_decl" >&5
-echo "${ECHO_T}$ice_cv_have_fputc_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_fputc_decl" >&5
+$as_echo "$ice_cv_have_fputc_decl" >&6; }
 if test "$ice_cv_have_fputc_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -57955,11 +60654,11 @@ ice_have_fputs=no
 
 for ac_func in fputs
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -58012,45 +60711,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_fputs=yes
 fi
 done
 
 if test "${ice_have_fputs}" = yes; then
-{ echo "$as_me:$LINENO: checking for fputs declaration in stdio.h" >&5
-echo $ECHO_N "checking for fputs declaration in stdio.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for fputs declaration in stdio.h" >&5
+$as_echo_n "checking for fputs declaration in stdio.h... " >&6; }
 if test "${ice_cv_have_fputs_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_fputs_decl=no
@@ -58099,8 +60805,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_fputs_decl" >&5
-echo "${ECHO_T}$ice_cv_have_fputs_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_fputs_decl" >&5
+$as_echo "$ice_cv_have_fputs_decl" >&6; }
 if test "$ice_cv_have_fputs_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -58115,11 +60821,11 @@ ice_have_fread=no
 
 for ac_func in fread
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -58172,45 +60878,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_fread=yes
 fi
 done
 
 if test "${ice_have_fread}" = yes; then
-{ echo "$as_me:$LINENO: checking for fread declaration in stdio.h stdlib.h" >&5
-echo $ECHO_N "checking for fread declaration in stdio.h stdlib.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for fread declaration in stdio.h stdlib.h" >&5
+$as_echo_n "checking for fread declaration in stdio.h stdlib.h... " >&6; }
 if test "${ice_cv_have_fread_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_fread_decl=no
@@ -58259,8 +60972,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_fread_decl" >&5
-echo "${ECHO_T}$ice_cv_have_fread_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_fread_decl" >&5
+$as_echo "$ice_cv_have_fread_decl" >&6; }
 if test "$ice_cv_have_fread_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -58275,11 +60988,11 @@ ice_have_fseek=no
 
 for ac_func in fseek
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -58332,45 +61045,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_fseek=yes
 fi
 done
 
 if test "${ice_have_fseek}" = yes; then
-{ echo "$as_me:$LINENO: checking for fseek declaration in stdio.h" >&5
-echo $ECHO_N "checking for fseek declaration in stdio.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for fseek declaration in stdio.h" >&5
+$as_echo_n "checking for fseek declaration in stdio.h... " >&6; }
 if test "${ice_cv_have_fseek_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_fseek_decl=no
@@ -58419,8 +61139,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_fseek_decl" >&5
-echo "${ECHO_T}$ice_cv_have_fseek_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_fseek_decl" >&5
+$as_echo "$ice_cv_have_fseek_decl" >&6; }
 if test "$ice_cv_have_fseek_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -58435,11 +61155,11 @@ ice_have_fwrite=no
 
 for ac_func in fwrite
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -58492,45 +61212,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_fwrite=yes
 fi
 done
 
 if test "${ice_have_fwrite}" = yes; then
-{ echo "$as_me:$LINENO: checking for fwrite declaration in stdio.h stdlib.h" >&5
-echo $ECHO_N "checking for fwrite declaration in stdio.h stdlib.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for fwrite declaration in stdio.h stdlib.h" >&5
+$as_echo_n "checking for fwrite declaration in stdio.h stdlib.h... " >&6; }
 if test "${ice_cv_have_fwrite_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_fwrite_decl=no
@@ -58579,8 +61306,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_fwrite_decl" >&5
-echo "${ECHO_T}$ice_cv_have_fwrite_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_fwrite_decl" >&5
+$as_echo "$ice_cv_have_fwrite_decl" >&6; }
 if test "$ice_cv_have_fwrite_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
 
 for ac_func in getgrgid_r
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -58650,35 +61377,42 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -58687,11 +61421,11 @@ done
 
 for ac_func in getpwuid_r
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -58744,35 +61478,42 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -58783,11 +61524,11 @@ ice_have_gethostname=no
 
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -58840,45 +61581,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_gethostname=yes
 fi
 done
 
 if test "${ice_have_gethostname}" = yes; then
-{ echo "$as_me:$LINENO: checking for gethostname declaration in unistd.h" >&5
-echo $ECHO_N "checking for gethostname declaration in unistd.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for gethostname declaration in unistd.h" >&5
+$as_echo_n "checking for gethostname declaration in unistd.h... " >&6; }
 if test "${ice_cv_have_gethostname_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_gethostname_decl=no
@@ -58927,8 +61675,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_gethostname_decl" >&5
-echo "${ECHO_T}$ice_cv_have_gethostname_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_gethostname_decl" >&5
+$as_echo "$ice_cv_have_gethostname_decl" >&6; }
 if test "$ice_cv_have_gethostname_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -58943,11 +61691,11 @@ ice_have_getopt=no
 
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -59000,45 +61748,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_getopt=yes
 fi
 done
 
 if test "${ice_have_getopt}" = yes; then
-{ echo "$as_me:$LINENO: checking for getopt declaration in stdlib.h unistd.h libc.h" >&5
-echo $ECHO_N "checking for getopt declaration in stdlib.h unistd.h libc.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for getopt declaration in stdlib.h unistd.h libc.h" >&5
+$as_echo_n "checking for getopt declaration in stdlib.h unistd.h libc.h... " >&6; }
 if test "${ice_cv_have_getopt_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_getopt_decl=no
@@ -59087,8 +61842,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_getopt_decl" >&5
-echo "${ECHO_T}$ice_cv_have_getopt_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_getopt_decl" >&5
+$as_echo "$ice_cv_have_getopt_decl" >&6; }
 if test "$ice_cv_have_getopt_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -59103,11 +61858,11 @@ ice_have_getpeername=no
 
 for ac_func in getpeername
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -59160,45 +61915,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_getpeername=yes
 fi
 done
 
 if test "${ice_have_getpeername}" = yes; then
-{ echo "$as_me:$LINENO: checking for getpeername declaration in sys/types.h sys/socket.h" >&5
-echo $ECHO_N "checking for getpeername declaration in sys/types.h sys/socket.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for getpeername declaration in sys/types.h sys/socket.h" >&5
+$as_echo_n "checking for getpeername declaration in sys/types.h sys/socket.h... " >&6; }
 if test "${ice_cv_have_getpeername_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_getpeername_decl=no
@@ -59247,8 +62009,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_getpeername_decl" >&5
-echo "${ECHO_T}$ice_cv_have_getpeername_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_getpeername_decl" >&5
+$as_echo "$ice_cv_have_getpeername_decl" >&6; }
 if test "$ice_cv_have_getpeername_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -59258,10 +62020,10 @@ _ACEOF
 fi
 fi
 
-{ echo "$as_me:$LINENO: checking for getpgrp" >&5
-echo $ECHO_N "checking for getpgrp... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for getpgrp" >&5
+$as_echo_n "checking for getpgrp... " >&6; }
 if test "${ac_cv_func_getpgrp+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -59314,36 +62076,40 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_func_getpgrp=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_func_getpgrp=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_getpgrp" >&5
-echo "${ECHO_T}$ac_cv_func_getpgrp" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_getpgrp" >&5
+$as_echo "$ac_cv_func_getpgrp" >&6; }
 
-{ echo "$as_me:$LINENO: checking whether getpgrp requires zero arguments" >&5
-echo $ECHO_N "checking whether getpgrp requires zero arguments... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking whether getpgrp requires zero arguments" >&5
+$as_echo_n "checking whether getpgrp requires zero arguments... " >&6; }
 if test "${ac_cv_func_getpgrp_void+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   # Use it with a single arg.
 cat >conftest.$ac_ext <<_ACEOF
@@ -59367,20 +62133,21 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_cv_func_getpgrp_void=no
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_func_getpgrp_void=yes
@@ -59389,8 +62156,8 @@ fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_getpgrp_void" >&5
-echo "${ECHO_T}$ac_cv_func_getpgrp_void" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_getpgrp_void" >&5
+$as_echo "$ac_cv_func_getpgrp_void" >&6; }
 if test $ac_cv_func_getpgrp_void = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -59404,11 +62171,11 @@ ice_have_getsockname=no
 
 for ac_func in getsockname
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -59461,45 +62228,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_getsockname=yes
 fi
 done
 
 if test "${ice_have_getsockname}" = yes; then
-{ echo "$as_me:$LINENO: checking for getsockname declaration in sys/types.h sys/socket.h" >&5
-echo $ECHO_N "checking for getsockname declaration in sys/types.h sys/socket.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for getsockname declaration in sys/types.h sys/socket.h" >&5
+$as_echo_n "checking for getsockname declaration in sys/types.h sys/socket.h... " >&6; }
 if test "${ice_cv_have_getsockname_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_getsockname_decl=no
@@ -59548,8 +62322,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_getsockname_decl" >&5
-echo "${ECHO_T}$ice_cv_have_getsockname_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_getsockname_decl" >&5
+$as_echo "$ice_cv_have_getsockname_decl" >&6; }
 if test "$ice_cv_have_getsockname_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -59564,11 +62338,11 @@ ice_have_getsockopt=no
 
 for ac_func in getsockopt
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -59621,45 +62395,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_getsockopt=yes
 fi
 done
 
 if test "${ice_have_getsockopt}" = yes; then
-{ echo "$as_me:$LINENO: checking for getsockopt declaration in sys/types.h sys/socket.h" >&5
-echo $ECHO_N "checking for getsockopt declaration in sys/types.h sys/socket.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for getsockopt declaration in sys/types.h sys/socket.h" >&5
+$as_echo_n "checking for getsockopt declaration in sys/types.h sys/socket.h... " >&6; }
 if test "${ice_cv_have_getsockopt_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_getsockopt_decl=no
@@ -59708,8 +62489,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_getsockopt_decl" >&5
-echo "${ECHO_T}$ice_cv_have_getsockopt_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_getsockopt_decl" >&5
+$as_echo "$ice_cv_have_getsockopt_decl" >&6; }
 if test "$ice_cv_have_getsockopt_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -59724,11 +62505,11 @@ ice_have_initgroups=no
 
 for ac_func in initgroups
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -59781,45 +62562,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_initgroups=yes
 fi
 done
 
 if test "${ice_have_initgroups}" = yes; then
-{ echo "$as_me:$LINENO: checking for initgroups declaration in grp.h sys/types.h unistd.h libc.h" >&5
-echo $ECHO_N "checking for initgroups declaration in grp.h sys/types.h unistd.h libc.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for initgroups declaration in grp.h sys/types.h unistd.h libc.h" >&5
+$as_echo_n "checking for initgroups declaration in grp.h sys/types.h unistd.h libc.h... " >&6; }
 if test "${ice_cv_have_initgroups_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_initgroups_decl=no
@@ -59868,8 +62656,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_initgroups_decl" >&5
-echo "${ECHO_T}$ice_cv_have_initgroups_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_initgroups_decl" >&5
+$as_echo "$ice_cv_have_initgroups_decl" >&6; }
 if test "$ice_cv_have_initgroups_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -59884,11 +62672,11 @@ ice_have_ioctl=no
 
 for ac_func in ioctl
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -59941,45 +62729,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_ioctl=yes
 fi
 done
 
 if test "${ice_have_ioctl}" = yes; then
-{ echo "$as_me:$LINENO: checking for ioctl declaration in sys/ioctl.h unistd.h libc.h" >&5
-echo $ECHO_N "checking for ioctl declaration in sys/ioctl.h unistd.h libc.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for ioctl declaration in sys/ioctl.h unistd.h libc.h" >&5
+$as_echo_n "checking for ioctl declaration in sys/ioctl.h unistd.h libc.h... " >&6; }
 if test "${ice_cv_have_ioctl_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_ioctl_decl=no
@@ -60028,8 +62823,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_ioctl_decl" >&5
-echo "${ECHO_T}$ice_cv_have_ioctl_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_ioctl_decl" >&5
+$as_echo "$ice_cv_have_ioctl_decl" >&6; }
 if test "$ice_cv_have_ioctl_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -60044,11 +62839,11 @@ ice_have_isnormal=no
 
 for ac_func in isnormal
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -60101,45 +62896,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_isnormal=yes
 fi
 done
 
 if test "${ice_have_isnormal}" = yes; then
-{ echo "$as_me:$LINENO: checking for isnormal declaration in math.h" >&5
-echo $ECHO_N "checking for isnormal declaration in math.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for isnormal declaration in math.h" >&5
+$as_echo_n "checking for isnormal declaration in math.h... " >&6; }
 if test "${ice_cv_have_isnormal_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_isnormal_decl=no
@@ -60188,8 +62990,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_isnormal_decl" >&5
-echo "${ECHO_T}$ice_cv_have_isnormal_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_isnormal_decl" >&5
+$as_echo "$ice_cv_have_isnormal_decl" >&6; }
 if test "$ice_cv_have_isnormal_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -60204,11 +63006,11 @@ ice_have_listen=no
 
 for ac_func in listen
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -60261,45 +63063,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_listen=yes
 fi
 done
 
 if test "${ice_have_listen}" = yes; then
-{ echo "$as_me:$LINENO: checking for listen declaration in sys/types.h sys/socket.h" >&5
-echo $ECHO_N "checking for listen declaration in sys/types.h sys/socket.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for listen declaration in sys/types.h sys/socket.h" >&5
+$as_echo_n "checking for listen declaration in sys/types.h sys/socket.h... " >&6; }
 if test "${ice_cv_have_listen_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_listen_decl=no
@@ -60348,8 +63157,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_listen_decl" >&5
-echo "${ECHO_T}$ice_cv_have_listen_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_listen_decl" >&5
+$as_echo "$ice_cv_have_listen_decl" >&6; }
 if test "$ice_cv_have_listen_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -60364,11 +63173,11 @@ ice_have_lstat=no
 
 for ac_func in lstat
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -60421,45 +63230,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_lstat=yes
 fi
 done
 
 if test "${ice_have_lstat}" = yes; then
-{ echo "$as_me:$LINENO: checking for lstat declaration in sys/types.h sys/stat.h" >&5
-echo $ECHO_N "checking for lstat declaration in sys/types.h sys/stat.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for lstat declaration in sys/types.h sys/stat.h" >&5
+$as_echo_n "checking for lstat declaration in sys/types.h sys/stat.h... " >&6; }
 if test "${ice_cv_have_lstat_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_lstat_decl=no
@@ -60508,8 +63324,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_lstat_decl" >&5
-echo "${ECHO_T}$ice_cv_have_lstat_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_lstat_decl" >&5
+$as_echo "$ice_cv_have_lstat_decl" >&6; }
 if test "$ice_cv_have_lstat_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -60524,11 +63340,11 @@ ice_have_malloc=no
 
 for ac_func in malloc
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -60581,45 +63397,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_malloc=yes
 fi
 done
 
 if test "${ice_have_malloc}" = yes; then
-{ echo "$as_me:$LINENO: checking for malloc declaration in stdlib.h" >&5
-echo $ECHO_N "checking for malloc declaration in stdlib.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for malloc declaration in stdlib.h" >&5
+$as_echo_n "checking for malloc declaration in stdlib.h... " >&6; }
 if test "${ice_cv_have_malloc_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_malloc_decl=no
@@ -60668,8 +63491,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_malloc_decl" >&5
-echo "${ECHO_T}$ice_cv_have_malloc_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_malloc_decl" >&5
+$as_echo "$ice_cv_have_malloc_decl" >&6; }
 if test "$ice_cv_have_malloc_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -60684,11 +63507,11 @@ ice_have_memmove=no
 
 for ac_func in memmove
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -60741,45 +63564,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_memmove=yes
 fi
 done
 
 if test "${ice_have_memmove}" = yes; then
-{ echo "$as_me:$LINENO: checking for memmove declaration in string.h strings.h" >&5
-echo $ECHO_N "checking for memmove declaration in string.h strings.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for memmove declaration in string.h strings.h" >&5
+$as_echo_n "checking for memmove declaration in string.h strings.h... " >&6; }
 if test "${ice_cv_have_memmove_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_memmove_decl=no
@@ -60828,8 +63658,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_memmove_decl" >&5
-echo "${ECHO_T}$ice_cv_have_memmove_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_memmove_decl" >&5
+$as_echo "$ice_cv_have_memmove_decl" >&6; }
 if test "$ice_cv_have_memmove_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -60844,11 +63674,11 @@ ice_have_memset=no
 
 for ac_func in memset
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -60901,45 +63731,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_memset=yes
 fi
 done
 
 if test "${ice_have_memset}" = yes; then
-{ echo "$as_me:$LINENO: checking for memset declaration in string.h strings.h" >&5
-echo $ECHO_N "checking for memset declaration in string.h strings.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for memset declaration in string.h strings.h" >&5
+$as_echo_n "checking for memset declaration in string.h strings.h... " >&6; }
 if test "${ice_cv_have_memset_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_memset_decl=no
@@ -60988,8 +63825,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_memset_decl" >&5
-echo "${ECHO_T}$ice_cv_have_memset_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_memset_decl" >&5
+$as_echo "$ice_cv_have_memset_decl" >&6; }
 if test "$ice_cv_have_memset_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -61004,11 +63841,11 @@ ice_have_mkstemp=no
 
 for ac_func in mkstemp
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -61061,45 +63898,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_mkstemp=yes
 fi
 done
 
 if test "${ice_have_mkstemp}" = yes; then
-{ echo "$as_me:$LINENO: checking for mkstemp declaration in stdlib.h" >&5
-echo $ECHO_N "checking for mkstemp declaration in stdlib.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for mkstemp declaration in stdlib.h" >&5
+$as_echo_n "checking for mkstemp declaration in stdlib.h... " >&6; }
 if test "${ice_cv_have_mkstemp_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_mkstemp_decl=no
@@ -61148,8 +63992,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_mkstemp_decl" >&5
-echo "${ECHO_T}$ice_cv_have_mkstemp_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_mkstemp_decl" >&5
+$as_echo "$ice_cv_have_mkstemp_decl" >&6; }
 if test "$ice_cv_have_mkstemp_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -61164,11 +64008,11 @@ ice_have_mktemp=no
 
 for ac_func in mktemp
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -61221,45 +64065,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_mktemp=yes
 fi
 done
 
 if test "${ice_have_mktemp}" = yes; then
-{ echo "$as_me:$LINENO: checking for mktemp declaration in stdlib.h" >&5
-echo $ECHO_N "checking for mktemp declaration in stdlib.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for mktemp declaration in stdlib.h" >&5
+$as_echo_n "checking for mktemp declaration in stdlib.h... " >&6; }
 if test "${ice_cv_have_mktemp_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_mktemp_decl=no
@@ -61308,8 +64159,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_mktemp_decl" >&5
-echo "${ECHO_T}$ice_cv_have_mktemp_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_mktemp_decl" >&5
+$as_echo "$ice_cv_have_mktemp_decl" >&6; }
 if test "$ice_cv_have_mktemp_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -61324,11 +64175,11 @@ ice_have_mktime=no
 
 for ac_func in mktime
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -61381,45 +64232,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_mktime=yes
 fi
 done
 
 if test "${ice_have_mktime}" = yes; then
-{ echo "$as_me:$LINENO: checking for mktime declaration in time.h sys/time.h" >&5
-echo $ECHO_N "checking for mktime declaration in time.h sys/time.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for mktime declaration in time.h sys/time.h" >&5
+$as_echo_n "checking for mktime declaration in time.h sys/time.h... " >&6; }
 if test "${ice_cv_have_mktime_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_mktime_decl=no
@@ -61468,8 +64326,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_mktime_decl" >&5
-echo "${ECHO_T}$ice_cv_have_mktime_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_mktime_decl" >&5
+$as_echo "$ice_cv_have_mktime_decl" >&6; }
 if test "$ice_cv_have_mktime_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
 
 for ac_func in on_exit
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -61539,35 +64397,42 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -61578,11 +64443,11 @@ ice_have_openlog=no
 
 for ac_func in openlog
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -61635,45 +64500,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_openlog=yes
 fi
 done
 
 if test "${ice_have_openlog}" = yes; then
-{ echo "$as_me:$LINENO: checking for openlog declaration in syslog.h" >&5
-echo $ECHO_N "checking for openlog declaration in syslog.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for openlog declaration in syslog.h" >&5
+$as_echo_n "checking for openlog declaration in syslog.h... " >&6; }
 if test "${ice_cv_have_openlog_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_openlog_decl=no
@@ -61722,8 +64594,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_openlog_decl" >&5
-echo "${ECHO_T}$ice_cv_have_openlog_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_openlog_decl" >&5
+$as_echo "$ice_cv_have_openlog_decl" >&6; }
 if test "$ice_cv_have_openlog_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -61738,11 +64610,11 @@ ice_have_pclose=no
 
 for ac_func in pclose
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -61795,45 +64667,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_pclose=yes
 fi
 done
 
 if test "${ice_have_pclose}" = yes; then
-{ echo "$as_me:$LINENO: checking for pclose declaration in stdio.h" >&5
-echo $ECHO_N "checking for pclose declaration in stdio.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for pclose declaration in stdio.h" >&5
+$as_echo_n "checking for pclose declaration in stdio.h... " >&6; }
 if test "${ice_cv_have_pclose_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_pclose_decl=no
@@ -61882,8 +64761,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_pclose_decl" >&5
-echo "${ECHO_T}$ice_cv_have_pclose_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_pclose_decl" >&5
+$as_echo "$ice_cv_have_pclose_decl" >&6; }
 if test "$ice_cv_have_pclose_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -61898,11 +64777,11 @@ ice_have_perror=no
 
 for ac_func in perror
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -61955,45 +64834,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_perror=yes
 fi
 done
 
 if test "${ice_have_perror}" = yes; then
-{ echo "$as_me:$LINENO: checking for perror declaration in stdio.h" >&5
-echo $ECHO_N "checking for perror declaration in stdio.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for perror declaration in stdio.h" >&5
+$as_echo_n "checking for perror declaration in stdio.h... " >&6; }
 if test "${ice_cv_have_perror_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_perror_decl=no
@@ -62042,8 +64928,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_perror_decl" >&5
-echo "${ECHO_T}$ice_cv_have_perror_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_perror_decl" >&5
+$as_echo "$ice_cv_have_perror_decl" >&6; }
 if test "$ice_cv_have_perror_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -62058,11 +64944,11 @@ ice_have_printf=no
 
 for ac_func in printf
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -62115,45 +65001,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_printf=yes
 fi
 done
 
 if test "${ice_have_printf}" = yes; then
-{ echo "$as_me:$LINENO: checking for printf declaration in stdio.h" >&5
-echo $ECHO_N "checking for printf declaration in stdio.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for printf declaration in stdio.h" >&5
+$as_echo_n "checking for printf declaration in stdio.h... " >&6; }
 if test "${ice_cv_have_printf_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_printf_decl=no
@@ -62202,8 +65095,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_printf_decl" >&5
-echo "${ECHO_T}$ice_cv_have_printf_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_printf_decl" >&5
+$as_echo "$ice_cv_have_printf_decl" >&6; }
 if test "$ice_cv_have_printf_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
 
 for ac_func in putenv
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -62273,35 +65166,42 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -62312,11 +65212,11 @@ ice_have_puts=no
 
 for ac_func in puts
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -62369,45 +65269,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_puts=yes
 fi
 done
 
 if test "${ice_have_puts}" = yes; then
-{ echo "$as_me:$LINENO: checking for puts declaration in stdio.h" >&5
-echo $ECHO_N "checking for puts declaration in stdio.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for puts declaration in stdio.h" >&5
+$as_echo_n "checking for puts declaration in stdio.h... " >&6; }
 if test "${ice_cv_have_puts_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_puts_decl=no
@@ -62456,8 +65363,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_puts_decl" >&5
-echo "${ECHO_T}$ice_cv_have_puts_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_puts_decl" >&5
+$as_echo "$ice_cv_have_puts_decl" >&6; }
 if test "$ice_cv_have_puts_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -62472,11 +65379,11 @@ ice_have_realloc=no
 
 for ac_func in realloc
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -62529,45 +65436,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_realloc=yes
 fi
 done
 
 if test "${ice_have_realloc}" = yes; then
-{ echo "$as_me:$LINENO: checking for realloc declaration in stdlib.h" >&5
-echo $ECHO_N "checking for realloc declaration in stdlib.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for realloc declaration in stdlib.h" >&5
+$as_echo_n "checking for realloc declaration in stdlib.h... " >&6; }
 if test "${ice_cv_have_realloc_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_realloc_decl=no
@@ -62616,8 +65530,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_realloc_decl" >&5
-echo "${ECHO_T}$ice_cv_have_realloc_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_realloc_decl" >&5
+$as_echo "$ice_cv_have_realloc_decl" >&6; }
 if test "$ice_cv_have_realloc_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -62632,11 +65546,11 @@ ice_have_recvfrom=no
 
 for ac_func in recvfrom
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -62689,45 +65603,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_recvfrom=yes
 fi
 done
 
 if test "${ice_have_recvfrom}" = yes; then
-{ echo "$as_me:$LINENO: checking for recvfrom declaration in sys/types.h sys/socket.h" >&5
-echo $ECHO_N "checking for recvfrom declaration in sys/types.h sys/socket.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for recvfrom declaration in sys/types.h sys/socket.h" >&5
+$as_echo_n "checking for recvfrom declaration in sys/types.h sys/socket.h... " >&6; }
 if test "${ice_cv_have_recvfrom_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_recvfrom_decl=no
@@ -62776,8 +65697,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_recvfrom_decl" >&5
-echo "${ECHO_T}$ice_cv_have_recvfrom_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_recvfrom_decl" >&5
+$as_echo "$ice_cv_have_recvfrom_decl" >&6; }
 if test "$ice_cv_have_recvfrom_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -62792,11 +65713,11 @@ ice_have_remove=no
 
 for ac_func in remove
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -62849,45 +65770,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_remove=yes
 fi
 done
 
 if test "${ice_have_remove}" = yes; then
-{ echo "$as_me:$LINENO: checking for remove declaration in stdio.h" >&5
-echo $ECHO_N "checking for remove declaration in stdio.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for remove declaration in stdio.h" >&5
+$as_echo_n "checking for remove declaration in stdio.h... " >&6; }
 if test "${ice_cv_have_remove_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_remove_decl=no
@@ -62936,8 +65864,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_remove_decl" >&5
-echo "${ECHO_T}$ice_cv_have_remove_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_remove_decl" >&5
+$as_echo "$ice_cv_have_remove_decl" >&6; }
 if test "$ice_cv_have_remove_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -62952,11 +65880,11 @@ ice_have_rename=no
 
 for ac_func in rename
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -63009,45 +65937,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_rename=yes
 fi
 done
 
 if test "${ice_have_rename}" = yes; then
-{ echo "$as_me:$LINENO: checking for rename declaration in stdio.h" >&5
-echo $ECHO_N "checking for rename declaration in stdio.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for rename declaration in stdio.h" >&5
+$as_echo_n "checking for rename declaration in stdio.h... " >&6; }
 if test "${ice_cv_have_rename_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_rename_decl=no
@@ -63096,8 +66031,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_rename_decl" >&5
-echo "${ECHO_T}$ice_cv_have_rename_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_rename_decl" >&5
+$as_echo "$ice_cv_have_rename_decl" >&6; }
 if test "$ice_cv_have_rename_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -63112,11 +66047,11 @@ ice_have_rewind=no
 
 for ac_func in rewind
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -63169,45 +66104,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_rewind=yes
 fi
 done
 
 if test "${ice_have_rewind}" = yes; then
-{ echo "$as_me:$LINENO: checking for rewind declaration in stdio.h" >&5
-echo $ECHO_N "checking for rewind declaration in stdio.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for rewind declaration in stdio.h" >&5
+$as_echo_n "checking for rewind declaration in stdio.h... " >&6; }
 if test "${ice_cv_have_rewind_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_rewind_decl=no
@@ -63256,8 +66198,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_rewind_decl" >&5
-echo "${ECHO_T}$ice_cv_have_rewind_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_rewind_decl" >&5
+$as_echo "$ice_cv_have_rewind_decl" >&6; }
 if test "$ice_cv_have_rewind_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -63272,11 +66214,11 @@ ice_have_ruserok=no
 
 for ac_func in ruserok
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -63329,45 +66271,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_ruserok=yes
 fi
 done
 
 if test "${ice_have_ruserok}" = yes; then
-{ echo "$as_me:$LINENO: checking for ruserok declaration in netdb.h sys/socket.h libc.h unistd.h" >&5
-echo $ECHO_N "checking for ruserok declaration in netdb.h sys/socket.h libc.h unistd.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for ruserok declaration in netdb.h sys/socket.h libc.h unistd.h" >&5
+$as_echo_n "checking for ruserok declaration in netdb.h sys/socket.h libc.h unistd.h... " >&6; }
 if test "${ice_cv_have_ruserok_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_ruserok_decl=no
@@ -63416,8 +66365,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_ruserok_decl" >&5
-echo "${ECHO_T}$ice_cv_have_ruserok_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_ruserok_decl" >&5
+$as_echo "$ice_cv_have_ruserok_decl" >&6; }
 if test "$ice_cv_have_ruserok_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -63432,11 +66381,11 @@ ice_have_select=no
 
 for ac_func in select
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -63489,45 +66438,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_select=yes
 fi
 done
 
 if test "${ice_have_select}" = yes; then
-{ echo "$as_me:$LINENO: checking for select declaration in sys/types.h sys/socket.h sys/select.h time.h sys/time.h" >&5
-echo $ECHO_N "checking for select declaration in sys/types.h sys/socket.h sys/select.h time.h sys/time.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for select declaration in sys/types.h sys/socket.h sys/select.h time.h sys/time.h" >&5
+$as_echo_n "checking for select declaration in sys/types.h sys/socket.h sys/select.h time.h sys/time.h... " >&6; }
 if test "${ice_cv_have_select_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_select_decl=no
@@ -63576,8 +66532,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_select_decl" >&5
-echo "${ECHO_T}$ice_cv_have_select_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_select_decl" >&5
+$as_echo "$ice_cv_have_select_decl" >&6; }
 if test "$ice_cv_have_select_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -63601,20 +66557,21 @@ for ac_header in sys/time.h \
            unistd.h \
 
 do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+as_ac_Header=`$as_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; }
+  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -63630,32 +66587,33 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
        } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$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; }
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -63669,69 +66627,73 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } >/dev/null && {
         test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
         test ! -s conftest.err
        }; then
   ac_header_preproc=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_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; }
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_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;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
 
     ;;
 esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
 if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&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; }
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
 
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
+as_val=`eval 'as_val=${'$as_ac_Header'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
 done
 
 
-       { echo "$as_me:$LINENO: checking for select() argument type" >&5
-echo $ECHO_N "checking for select() argument type... $ECHO_C" >&6; }
+       { $as_echo "$as_me:$LINENO: checking for select() argument type" >&5
+$as_echo_n "checking for select() argument type... " >&6; }
 if test "${amanda_cv_select_arg_type+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
                rm -f conftest.c
@@ -63814,8 +66776,8 @@ EOF
 
 
 fi
-{ echo "$as_me:$LINENO: result: $amanda_cv_select_arg_type" >&5
-echo "${ECHO_T}$amanda_cv_select_arg_type" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $amanda_cv_select_arg_type" >&5
+$as_echo "$amanda_cv_select_arg_type" >&6; }
 
 cat >>confdefs.h <<_ACEOF
 #define SELECT_ARG_TYPE $amanda_cv_select_arg_type
@@ -63828,11 +66790,11 @@ ice_have_sendto=no
 
 for ac_func in sendto
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -63885,45 +66847,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_sendto=yes
 fi
 done
 
 if test "${ice_have_sendto}" = yes; then
-{ echo "$as_me:$LINENO: checking for sendto declaration in sys/types.h sys/socket.h" >&5
-echo $ECHO_N "checking for sendto declaration in sys/types.h sys/socket.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for sendto declaration in sys/types.h sys/socket.h" >&5
+$as_echo_n "checking for sendto declaration in sys/types.h sys/socket.h... " >&6; }
 if test "${ice_cv_have_sendto_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_sendto_decl=no
@@ -63972,8 +66941,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_sendto_decl" >&5
-echo "${ECHO_T}$ice_cv_have_sendto_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_sendto_decl" >&5
+$as_echo "$ice_cv_have_sendto_decl" >&6; }
 if test "$ice_cv_have_sendto_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -63988,11 +66957,11 @@ ice_have_setegid=no
 
 for ac_func in setegid
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -64045,45 +67014,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_setegid=yes
 fi
 done
 
 if test "${ice_have_setegid}" = yes; then
-{ echo "$as_me:$LINENO: checking for setegid declaration in unistd.h" >&5
-echo $ECHO_N "checking for setegid declaration in unistd.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for setegid declaration in unistd.h" >&5
+$as_echo_n "checking for setegid declaration in unistd.h... " >&6; }
 if test "${ice_cv_have_setegid_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_setegid_decl=no
@@ -64132,8 +67108,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_setegid_decl" >&5
-echo "${ECHO_T}$ice_cv_have_setegid_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_setegid_decl" >&5
+$as_echo "$ice_cv_have_setegid_decl" >&6; }
 if test "$ice_cv_have_setegid_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -64148,11 +67124,11 @@ ice_have_seteuid=no
 
 for ac_func in seteuid
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -64205,45 +67181,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_seteuid=yes
 fi
 done
 
 if test "${ice_have_seteuid}" = yes; then
-{ echo "$as_me:$LINENO: checking for seteuid declaration in unistd.h" >&5
-echo $ECHO_N "checking for seteuid declaration in unistd.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for seteuid declaration in unistd.h" >&5
+$as_echo_n "checking for seteuid declaration in unistd.h... " >&6; }
 if test "${ice_cv_have_seteuid_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_seteuid_decl=no
@@ -64292,8 +67275,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_seteuid_decl" >&5
-echo "${ECHO_T}$ice_cv_have_seteuid_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_seteuid_decl" >&5
+$as_echo "$ice_cv_have_seteuid_decl" >&6; }
 if test "$ice_cv_have_seteuid_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -64308,11 +67291,11 @@ ice_have_setresgid=no
 
 for ac_func in setresgid
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -64365,45 +67348,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_setresgid=yes
 fi
 done
 
 if test "${ice_have_setresgid}" = yes; then
-{ echo "$as_me:$LINENO: checking for setresgid declaration in unistd.h" >&5
-echo $ECHO_N "checking for setresgid declaration in unistd.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for setresgid declaration in unistd.h" >&5
+$as_echo_n "checking for setresgid declaration in unistd.h... " >&6; }
 if test "${ice_cv_have_setresgid_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_setresgid_decl=no
@@ -64452,8 +67442,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_setresgid_decl" >&5
-echo "${ECHO_T}$ice_cv_have_setresgid_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_setresgid_decl" >&5
+$as_echo "$ice_cv_have_setresgid_decl" >&6; }
 if test "$ice_cv_have_setresgid_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -64468,169 +67458,11 @@ ice_have_setresuid=no
 
 for ac_func in setresuid
 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); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; 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_ipa8_conftest.oo \
-      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
- ice_have_setresuid=yes
-fi
-done
-
-if test "${ice_have_setresuid}" = yes; then
-{ echo "$as_me:$LINENO: checking for setresuid declaration in unistd.h" >&5
-echo $ECHO_N "checking for setresuid declaration in unistd.h... $ECHO_C" >&6; }
-if test "${ice_cv_have_setresuid_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-
-ice_cv_have_setresuid_decl=no
-ice_re_params='[a-zA-Z_][a-zA-Z0-9_]*'
-ice_re_word='(^|[^a-zA-Z0-9_])'
-for header in unistd.h; do
-# Check for ordinary declaration
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$header>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "${ice_re_word}setresuid[     ]*\(" >/dev/null 2>&1; then
-  ice_cv_have_setresuid_decl=yes
-fi
-rm -f conftest*
-
-if test "$ice_cv_have_setresuid_decl" = yes; then
-       break
-fi
-# Check for "fixed" declaration like "getpid _PARAMS((int))"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$header>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "${ice_re_word}setresuid[     ]*$ice_re_params\(\(" >/dev/null 2>&1; then
-  ice_cv_have_setresuid_decl=yes
-fi
-rm -f conftest*
-
-if test "$ice_cv_have_setresuid_decl" = yes; then
-       break
-fi
-done
-
-fi
-
-{ echo "$as_me:$LINENO: result: $ice_cv_have_setresuid_decl" >&5
-echo "${ECHO_T}$ice_cv_have_setresuid_decl" >&6; }
-if test "$ice_cv_have_setresuid_decl" = yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_SETRESUID_DECL 1
-_ACEOF
-
-fi
-fi
-
-
-for ac_func in shquote
-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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -64683,50 +67515,121 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+ ice_have_setresuid=yes
+fi
+done
+
+if test "${ice_have_setresuid}" = yes; then
+{ $as_echo "$as_me:$LINENO: checking for setresuid declaration in unistd.h" >&5
+$as_echo_n "checking for setresuid declaration in unistd.h... " >&6; }
+if test "${ice_cv_have_setresuid_decl+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+
+ice_cv_have_setresuid_decl=no
+ice_re_params='[a-zA-Z_][a-zA-Z0-9_]*'
+ice_re_word='(^|[^a-zA-Z0-9_])'
+for header in unistd.h; do
+# Check for ordinary declaration
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$header>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "${ice_re_word}setresuid[     ]*\(" >/dev/null 2>&1; then
+  ice_cv_have_setresuid_decl=yes
+fi
+rm -f conftest*
+
+if test "$ice_cv_have_setresuid_decl" = yes; then
+       break
+fi
+# Check for "fixed" declaration like "getpid _PARAMS((int))"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
 _ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$header>
 
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "${ice_re_word}setresuid[     ]*$ice_re_params\(\(" >/dev/null 2>&1; then
+  ice_cv_have_setresuid_decl=yes
+fi
+rm -f conftest*
+
+if test "$ice_cv_have_setresuid_decl" = yes; then
+       break
 fi
 done
 
+fi
+
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_setresuid_decl" >&5
+$as_echo "$ice_cv_have_setresuid_decl" >&6; }
+if test "$ice_cv_have_setresuid_decl" = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_SETRESUID_DECL 1
+_ACEOF
+
+fi
+fi
+
 
 ice_have_snprintf=no
 
 for ac_func in snprintf
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -64779,45 +67682,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_snprintf=yes
 fi
 done
 
 if test "${ice_have_snprintf}" = yes; then
-{ echo "$as_me:$LINENO: checking for snprintf declaration in stdio.h" >&5
-echo $ECHO_N "checking for snprintf declaration in stdio.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for snprintf declaration in stdio.h" >&5
+$as_echo_n "checking for snprintf declaration in stdio.h... " >&6; }
 if test "${ice_cv_have_snprintf_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_snprintf_decl=no
@@ -64866,8 +67776,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_snprintf_decl" >&5
-echo "${ECHO_T}$ice_cv_have_snprintf_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_snprintf_decl" >&5
+$as_echo "$ice_cv_have_snprintf_decl" >&6; }
 if test "$ice_cv_have_snprintf_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -64882,11 +67792,11 @@ ice_have_vsnprintf=no
 
 for ac_func in vsnprintf
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -64939,45 +67849,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_vsnprintf=yes
 fi
 done
 
 if test "${ice_have_vsnprintf}" = yes; then
-{ echo "$as_me:$LINENO: checking for vsnprintf declaration in stdio.h" >&5
-echo $ECHO_N "checking for vsnprintf declaration in stdio.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for vsnprintf declaration in stdio.h" >&5
+$as_echo_n "checking for vsnprintf declaration in stdio.h... " >&6; }
 if test "${ice_cv_have_vsnprintf_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_vsnprintf_decl=no
@@ -65026,8 +67943,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_vsnprintf_decl" >&5
-echo "${ECHO_T}$ice_cv_have_vsnprintf_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_vsnprintf_decl" >&5
+$as_echo "$ice_cv_have_vsnprintf_decl" >&6; }
 if test "$ice_cv_have_vsnprintf_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
 fi
 
 
-    { echo "$as_me:$LINENO: checking for setpgid" >&5
-echo $ECHO_N "checking for setpgid... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking for setpgid" >&5
+$as_echo_n "checking for setpgid... " >&6; }
 if test "${ac_cv_func_setpgid+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -65094,32 +68011,36 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_func_setpgid=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_func_setpgid=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_setpgid" >&5
-echo "${ECHO_T}$ac_cv_func_setpgid" >&6; }
-if test $ac_cv_func_setpgid = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_setpgid" >&5
+$as_echo "$ac_cv_func_setpgid" >&6; }
+if test "x$ac_cv_func_setpgid" = x""yes; then
 
 
 cat >>confdefs.h <<\_ACEOF
@@ -65131,11 +68052,11 @@ ice_have_setpgid=no
 
 for ac_func in setpgid
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -65188,45 +68109,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_setpgid=yes
 fi
 done
 
 if test "${ice_have_setpgid}" = yes; then
-{ echo "$as_me:$LINENO: checking for setpgid declaration in sys/types.h unistd.h" >&5
-echo $ECHO_N "checking for setpgid declaration in sys/types.h unistd.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for setpgid declaration in sys/types.h unistd.h" >&5
+$as_echo_n "checking for setpgid declaration in sys/types.h unistd.h... " >&6; }
 if test "${ice_cv_have_setpgid_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_setpgid_decl=no
@@ -65275,8 +68203,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_setpgid_decl" >&5
-echo "${ECHO_T}$ice_cv_have_setpgid_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_setpgid_decl" >&5
+$as_echo "$ice_cv_have_setpgid_decl" >&6; }
 if test "$ice_cv_have_setpgid_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
 fi
 
 
-{ echo "$as_me:$LINENO: checking for setpgrp" >&5
-echo $ECHO_N "checking for setpgrp... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for setpgrp" >&5
+$as_echo_n "checking for setpgrp... " >&6; }
 if test "${ac_cv_func_setpgrp+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -65346,40 +68274,44 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_func_setpgrp=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_func_setpgrp=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_setpgrp" >&5
-echo "${ECHO_T}$ac_cv_func_setpgrp" >&6; }
-if test $ac_cv_func_setpgrp = yes; then
-  { echo "$as_me:$LINENO: checking whether setpgrp takes no argument" >&5
-echo $ECHO_N "checking whether setpgrp takes no argument... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_setpgrp" >&5
+$as_echo "$ac_cv_func_setpgrp" >&6; }
+if test "x$ac_cv_func_setpgrp" = x""yes; then
+  { $as_echo "$as_me:$LINENO: checking whether setpgrp takes no argument" >&5
+$as_echo_n "checking whether setpgrp takes no argument... " >&6; }
 if test "${ac_cv_func_setpgrp_void+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   if test "$cross_compiling" = yes; then
-  { { echo "$as_me:$LINENO: error: cannot check setpgrp when cross compiling" >&5
-echo "$as_me: error: cannot check setpgrp when cross compiling" >&2;}
+  { { $as_echo "$as_me:$LINENO: error: cannot check setpgrp when cross compiling" >&5
+$as_echo "$as_me: error: cannot check setpgrp when cross compiling" >&2;}
    { (exit 1); exit 1; }; }
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -65406,36 +68338,39 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
   (eval "$ac_try") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
   ac_cv_func_setpgrp_void=no
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 ( exit $ac_status )
 ac_cv_func_setpgrp_void=yes
 fi
+rm -rf conftest.dSYM
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 
 
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_setpgrp_void" >&5
-echo "${ECHO_T}$ac_cv_func_setpgrp_void" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_setpgrp_void" >&5
+$as_echo "$ac_cv_func_setpgrp_void" >&6; }
 if test $ac_cv_func_setpgrp_void = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -65451,11 +68386,11 @@ ice_have_setpgrp=no
 
 for ac_func in setpgrp
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -65508,45 +68443,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_setpgrp=yes
 fi
 done
 
 if test "${ice_have_setpgrp}" = yes; then
-{ echo "$as_me:$LINENO: checking for setpgrp declaration in sys/types.h unistd.h libc.h" >&5
-echo $ECHO_N "checking for setpgrp declaration in sys/types.h unistd.h libc.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for setpgrp declaration in sys/types.h unistd.h libc.h" >&5
+$as_echo_n "checking for setpgrp declaration in sys/types.h unistd.h libc.h... " >&6; }
 if test "${ice_cv_have_setpgrp_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_setpgrp_decl=no
@@ -65595,8 +68537,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_setpgrp_decl" >&5
-echo "${ECHO_T}$ice_cv_have_setpgrp_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_setpgrp_decl" >&5
+$as_echo "$ice_cv_have_setpgrp_decl" >&6; }
 if test "$ice_cv_have_setpgrp_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -65611,11 +68553,11 @@ ice_have_setsockopt=no
 
 for ac_func in setsockopt
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -65668,45 +68610,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_setsockopt=yes
 fi
 done
 
 if test "${ice_have_setsockopt}" = yes; then
-{ echo "$as_me:$LINENO: checking for setsockopt declaration in sys/types.h sys/socket.h" >&5
-echo $ECHO_N "checking for setsockopt declaration in sys/types.h sys/socket.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for setsockopt declaration in sys/types.h sys/socket.h" >&5
+$as_echo_n "checking for setsockopt declaration in sys/types.h sys/socket.h... " >&6; }
 if test "${ice_cv_have_setsockopt_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_setsockopt_decl=no
@@ -65755,8 +68704,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_setsockopt_decl" >&5
-echo "${ECHO_T}$ice_cv_have_setsockopt_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_setsockopt_decl" >&5
+$as_echo "$ice_cv_have_setsockopt_decl" >&6; }
 if test "$ice_cv_have_setsockopt_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
 
 for ac_func in sigaction sigemptyset sigvec
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -65828,35 +68777,42 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -65867,11 +68823,11 @@ ice_have_socket=no
 
 for ac_func in socket
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -65924,45 +68880,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_socket=yes
 fi
 done
 
 if test "${ice_have_socket}" = yes; then
-{ echo "$as_me:$LINENO: checking for socket declaration in sys/types.h sys/socket.h" >&5
-echo $ECHO_N "checking for socket declaration in sys/types.h sys/socket.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for socket declaration in sys/types.h sys/socket.h" >&5
+$as_echo_n "checking for socket declaration in sys/types.h sys/socket.h... " >&6; }
 if test "${ice_cv_have_socket_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_socket_decl=no
@@ -66011,8 +68974,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_socket_decl" >&5
-echo "${ECHO_T}$ice_cv_have_socket_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_socket_decl" >&5
+$as_echo "$ice_cv_have_socket_decl" >&6; }
 if test "$ice_cv_have_socket_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -66027,11 +68990,11 @@ ice_have_socketpair=no
 
 for ac_func in socketpair
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -66084,45 +69047,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_socketpair=yes
 fi
 done
 
 if test "${ice_have_socketpair}" = yes; then
-{ echo "$as_me:$LINENO: checking for socketpair declaration in sys/types.h sys/socket.h" >&5
-echo $ECHO_N "checking for socketpair declaration in sys/types.h sys/socket.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for socketpair declaration in sys/types.h sys/socket.h" >&5
+$as_echo_n "checking for socketpair declaration in sys/types.h sys/socket.h... " >&6; }
 if test "${ice_cv_have_socketpair_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_socketpair_decl=no
@@ -66171,8 +69141,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_socketpair_decl" >&5
-echo "${ECHO_T}$ice_cv_have_socketpair_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_socketpair_decl" >&5
+$as_echo "$ice_cv_have_socketpair_decl" >&6; }
 if test "$ice_cv_have_socketpair_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -66187,11 +69157,11 @@ ice_have_sscanf=no
 
 for ac_func in sscanf
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -66244,45 +69214,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_sscanf=yes
 fi
 done
 
 if test "${ice_have_sscanf}" = yes; then
-{ echo "$as_me:$LINENO: checking for sscanf declaration in stdio.h" >&5
-echo $ECHO_N "checking for sscanf declaration in stdio.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for sscanf declaration in stdio.h" >&5
+$as_echo_n "checking for sscanf declaration in stdio.h... " >&6; }
 if test "${ice_cv_have_sscanf_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_sscanf_decl=no
@@ -66331,8 +69308,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_sscanf_decl" >&5
-echo "${ECHO_T}$ice_cv_have_sscanf_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_sscanf_decl" >&5
+$as_echo "$ice_cv_have_sscanf_decl" >&6; }
 if test "$ice_cv_have_sscanf_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -66347,11 +69324,11 @@ ice_have_strerror=no
 
 for ac_func in strerror
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -66404,45 +69381,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_strerror=yes
 fi
 done
 
 if test "${ice_have_strerror}" = yes; then
-{ echo "$as_me:$LINENO: checking for strerror declaration in string.h strings.h" >&5
-echo $ECHO_N "checking for strerror declaration in string.h strings.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for strerror declaration in string.h strings.h" >&5
+$as_echo_n "checking for strerror declaration in string.h strings.h... " >&6; }
 if test "${ice_cv_have_strerror_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_strerror_decl=no
@@ -66491,8 +69475,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_strerror_decl" >&5
-echo "${ECHO_T}$ice_cv_have_strerror_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_strerror_decl" >&5
+$as_echo "$ice_cv_have_strerror_decl" >&6; }
 if test "$ice_cv_have_strerror_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
 
 for ac_func in strftime
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -66562,43 +69546,50 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
 else
   # strftime is in -lintl on SCO UNIX.
-{ echo "$as_me:$LINENO: checking for strftime in -lintl" >&5
-echo $ECHO_N "checking for strftime in -lintl... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for strftime in -lintl" >&5
+$as_echo_n "checking for strftime in -lintl... " >&6; }
 if test "${ac_cv_lib_intl_strftime+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lintl  $LIBS"
@@ -66630,33 +69621,37 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_lib_intl_strftime=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_lib_intl_strftime=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_intl_strftime" >&5
-echo "${ECHO_T}$ac_cv_lib_intl_strftime" >&6; }
-if test $ac_cv_lib_intl_strftime = yes; then
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_intl_strftime" >&5
+$as_echo "$ac_cv_lib_intl_strftime" >&6; }
+if test "x$ac_cv_lib_intl_strftime" = x""yes; then
   cat >>confdefs.h <<\_ACEOF
 #define HAVE_STRFTIME 1
 _ACEOF
@@ -66672,11 +69667,11 @@ ice_have_strftime=no
 
 for ac_func in strftime
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -66729,45 +69724,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_strftime=yes
 fi
 done
 
 if test "${ice_have_strftime}" = yes; then
-{ echo "$as_me:$LINENO: checking for strftime declaration in time.h sys/time.h" >&5
-echo $ECHO_N "checking for strftime declaration in time.h sys/time.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for strftime declaration in time.h sys/time.h" >&5
+$as_echo_n "checking for strftime declaration in time.h sys/time.h... " >&6; }
 if test "${ice_cv_have_strftime_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_strftime_decl=no
@@ -66816,8 +69818,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_strftime_decl" >&5
-echo "${ECHO_T}$ice_cv_have_strftime_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_strftime_decl" >&5
+$as_echo "$ice_cv_have_strftime_decl" >&6; }
 if test "$ice_cv_have_strftime_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -66832,11 +69834,11 @@ ice_have_strncasecmp=no
 
 for ac_func in strncasecmp
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -66889,45 +69891,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_strncasecmp=yes
 fi
 done
 
 if test "${ice_have_strncasecmp}" = yes; then
-{ echo "$as_me:$LINENO: checking for strncasecmp declaration in string.h strings.h" >&5
-echo $ECHO_N "checking for strncasecmp declaration in string.h strings.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for strncasecmp declaration in string.h strings.h" >&5
+$as_echo_n "checking for strncasecmp declaration in string.h strings.h... " >&6; }
 if test "${ice_cv_have_strncasecmp_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_strncasecmp_decl=no
@@ -66976,8 +69985,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_strncasecmp_decl" >&5
-echo "${ECHO_T}$ice_cv_have_strncasecmp_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_strncasecmp_decl" >&5
+$as_echo "$ice_cv_have_strncasecmp_decl" >&6; }
 if test "$ice_cv_have_strncasecmp_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -66992,11 +70001,11 @@ ice_have_syslog=no
 
 for ac_func in syslog
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -67049,45 +70058,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_syslog=yes
 fi
 done
 
 if test "${ice_have_syslog}" = yes; then
-{ echo "$as_me:$LINENO: checking for syslog declaration in syslog.h" >&5
-echo $ECHO_N "checking for syslog declaration in syslog.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for syslog declaration in syslog.h" >&5
+$as_echo_n "checking for syslog declaration in syslog.h... " >&6; }
 if test "${ice_cv_have_syslog_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_syslog_decl=no
@@ -67136,8 +70152,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_syslog_decl" >&5
-echo "${ECHO_T}$ice_cv_have_syslog_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_syslog_decl" >&5
+$as_echo "$ice_cv_have_syslog_decl" >&6; }
 if test "$ice_cv_have_syslog_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -67152,11 +70168,11 @@ ice_have_system=no
 
 for ac_func in system
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -67209,45 +70225,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_system=yes
 fi
 done
 
 if test "${ice_have_system}" = yes; then
-{ echo "$as_me:$LINENO: checking for system declaration in stdlib.h" >&5
-echo $ECHO_N "checking for system declaration in stdlib.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for system declaration in stdlib.h" >&5
+$as_echo_n "checking for system declaration in stdlib.h... " >&6; }
 if test "${ice_cv_have_system_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_system_decl=no
@@ -67296,8 +70319,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_system_decl" >&5
-echo "${ECHO_T}$ice_cv_have_system_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_system_decl" >&5
+$as_echo "$ice_cv_have_system_decl" >&6; }
 if test "$ice_cv_have_system_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -67312,11 +70335,11 @@ ice_have_time=no
 
 for ac_func in time
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -67369,45 +70392,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_time=yes
 fi
 done
 
 if test "${ice_have_time}" = yes; then
-{ echo "$as_me:$LINENO: checking for time declaration in time.h sys/time.h" >&5
-echo $ECHO_N "checking for time declaration in time.h sys/time.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for time declaration in time.h sys/time.h" >&5
+$as_echo_n "checking for time declaration in time.h sys/time.h... " >&6; }
 if test "${ice_cv_have_time_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_time_decl=no
@@ -67456,8 +70486,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_time_decl" >&5
-echo "${ECHO_T}$ice_cv_have_time_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_time_decl" >&5
+$as_echo "$ice_cv_have_time_decl" >&6; }
 if test "$ice_cv_have_time_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -67472,11 +70502,11 @@ ice_have_tolower=no
 
 for ac_func in tolower
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -67529,45 +70559,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_tolower=yes
 fi
 done
 
 if test "${ice_have_tolower}" = yes; then
-{ echo "$as_me:$LINENO: checking for tolower declaration in ctype.h" >&5
-echo $ECHO_N "checking for tolower declaration in ctype.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for tolower declaration in ctype.h" >&5
+$as_echo_n "checking for tolower declaration in ctype.h... " >&6; }
 if test "${ice_cv_have_tolower_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_tolower_decl=no
@@ -67616,8 +70653,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_tolower_decl" >&5
-echo "${ECHO_T}$ice_cv_have_tolower_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_tolower_decl" >&5
+$as_echo "$ice_cv_have_tolower_decl" >&6; }
 if test "$ice_cv_have_tolower_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -67632,11 +70669,11 @@ ice_have_toupper=no
 
 for ac_func in toupper
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -67689,45 +70726,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_toupper=yes
 fi
 done
 
 if test "${ice_have_toupper}" = yes; then
-{ echo "$as_me:$LINENO: checking for toupper declaration in ctype.h" >&5
-echo $ECHO_N "checking for toupper declaration in ctype.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for toupper declaration in ctype.h" >&5
+$as_echo_n "checking for toupper declaration in ctype.h... " >&6; }
 if test "${ice_cv_have_toupper_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_toupper_decl=no
@@ -67776,8 +70820,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_toupper_decl" >&5
-echo "${ECHO_T}$ice_cv_have_toupper_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_toupper_decl" >&5
+$as_echo "$ice_cv_have_toupper_decl" >&6; }
 if test "$ice_cv_have_toupper_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -67792,11 +70836,11 @@ ice_have_ungetc=no
 
 for ac_func in ungetc
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -67849,45 +70893,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_ungetc=yes
 fi
 done
 
 if test "${ice_have_ungetc}" = yes; then
-{ echo "$as_me:$LINENO: checking for ungetc declaration in stdio.h" >&5
-echo $ECHO_N "checking for ungetc declaration in stdio.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for ungetc declaration in stdio.h" >&5
+$as_echo_n "checking for ungetc declaration in stdio.h... " >&6; }
 if test "${ice_cv_have_ungetc_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_ungetc_decl=no
@@ -67936,8 +70987,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_ungetc_decl" >&5
-echo "${ECHO_T}$ice_cv_have_ungetc_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_ungetc_decl" >&5
+$as_echo "$ice_cv_have_ungetc_decl" >&6; }
 if test "$ice_cv_have_ungetc_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -67952,11 +71003,11 @@ ice_have_vfprintf=no
 
 for ac_func in vfprintf
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -68009,45 +71060,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_vfprintf=yes
 fi
 done
 
 if test "${ice_have_vfprintf}" = yes; then
-{ echo "$as_me:$LINENO: checking for vfprintf declaration in stdio.h stdlib.h" >&5
-echo $ECHO_N "checking for vfprintf declaration in stdio.h stdlib.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for vfprintf declaration in stdio.h stdlib.h" >&5
+$as_echo_n "checking for vfprintf declaration in stdio.h stdlib.h... " >&6; }
 if test "${ice_cv_have_vfprintf_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_vfprintf_decl=no
@@ -68096,8 +71154,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_vfprintf_decl" >&5
-echo "${ECHO_T}$ice_cv_have_vfprintf_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_vfprintf_decl" >&5
+$as_echo "$ice_cv_have_vfprintf_decl" >&6; }
 if test "$ice_cv_have_vfprintf_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -68112,11 +71170,11 @@ ice_have_vprintf=no
 
 for ac_func in vprintf
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -68169,45 +71227,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_vprintf=yes
 fi
 done
 
 if test "${ice_have_vprintf}" = yes; then
-{ echo "$as_me:$LINENO: checking for vprintf declaration in stdio.h stdlib.h" >&5
-echo $ECHO_N "checking for vprintf declaration in stdio.h stdlib.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for vprintf declaration in stdio.h stdlib.h" >&5
+$as_echo_n "checking for vprintf declaration in stdio.h stdlib.h... " >&6; }
 if test "${ice_cv_have_vprintf_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_vprintf_decl=no
@@ -68256,8 +71321,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_vprintf_decl" >&5
-echo "${ECHO_T}$ice_cv_have_vprintf_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_vprintf_decl" >&5
+$as_echo "$ice_cv_have_vprintf_decl" >&6; }
 if test "$ice_cv_have_vprintf_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -68267,10 +71332,10 @@ _ACEOF
 fi
 fi
 
-{ echo "$as_me:$LINENO: checking for wait4" >&5
-echo $ECHO_N "checking for wait4... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for wait4" >&5
+$as_echo_n "checking for wait4... " >&6; }
 if test "${ac_cv_func_wait4+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -68323,42 +71388,46 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   ac_cv_func_wait4=yes
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_cv_func_wait4=no
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_wait4" >&5
-echo "${ECHO_T}$ac_cv_func_wait4" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_wait4" >&5
+$as_echo "$ac_cv_func_wait4" >&6; }
 
 
 ice_have_writev=no
 
 for ac_func in writev
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -68411,45 +71480,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_writev=yes
 fi
 done
 
 if test "${ice_have_writev}" = yes; then
-{ echo "$as_me:$LINENO: checking for writev declaration in unistd.h sys/uio.h" >&5
-echo $ECHO_N "checking for writev declaration in unistd.h sys/uio.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for writev declaration in unistd.h sys/uio.h" >&5
+$as_echo_n "checking for writev declaration in unistd.h sys/uio.h... " >&6; }
 if test "${ice_cv_have_writev_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_writev_decl=no
@@ -68498,8 +71574,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_writev_decl" >&5
-echo "${ECHO_T}$ice_cv_have_writev_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_writev_decl" >&5
+$as_echo "$ice_cv_have_writev_decl" >&6; }
 if test "$ice_cv_have_writev_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -68514,11 +71590,11 @@ ice_have_strcasecmp=no
 
 for ac_func in strcasecmp
 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; }
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -68571,45 +71647,52 @@ 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_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$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
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && {
         test -z "$ac_c_werror_flag" ||
         test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        $as_test_x conftest$ac_exeext
+       }; then
   eval "$as_ac_var=yes"
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
        eval "$as_ac_var=no"
 fi
 
+rm -rf conftest.dSYM
 rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
+ac_res=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+as_val=`eval 'as_val=${'$as_ac_var'}
+                $as_echo "$as_val"'`
+   if test "x$as_val" = x""yes; then
   cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  ice_have_strcasecmp=yes
 fi
 done
 
 if test "${ice_have_strcasecmp}" = yes; then
-{ echo "$as_me:$LINENO: checking for strcasecmp declaration in string.h strings.h" >&5
-echo $ECHO_N "checking for strcasecmp declaration in string.h strings.h... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for strcasecmp declaration in string.h strings.h" >&5
+$as_echo_n "checking for strcasecmp declaration in string.h strings.h... " >&6; }
 if test "${ice_cv_have_strcasecmp_decl+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
 
 ice_cv_have_strcasecmp_decl=no
@@ -68658,8 +71741,8 @@ done
 
 fi
 
-{ echo "$as_me:$LINENO: result: $ice_cv_have_strcasecmp_decl" >&5
-echo "${ECHO_T}$ice_cv_have_strcasecmp_decl" >&6; }
+{ $as_echo "$as_me:$LINENO: result: $ice_cv_have_strcasecmp_decl" >&5
+$as_echo "$ice_cv_have_strcasecmp_decl" >&6; }
 if test "$ice_cv_have_strcasecmp_decl" = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -68671,7 +71754,7 @@ fi
 
 
 
-ac_config_files="$ac_config_files Makefile amandad-src/Makefile amplot/Makefile changer-src/Makefile client-src/Makefile common-src/Makefile common-src/versuff.c config/Makefile device-src/Makefile device-src/tests/Makefile dumper-src/Makefile example/Makefile example/amanda-client.conf example/amanda.conf example/chg-mcutil.conf example/template.d/amanda-S3.conf example/template.d/advanced.conf example/template.d/amanda-harddisk.conf example/template.d/amanda-single-tape.conf example/template.d/amanda-tape-changer.conf gnulib/Makefile installcheck/Makefile man/Makefile oldrecover-src/Makefile packaging/Makefile perl/Makefile po/Makefile recover-src/Makefile restore-src/Makefile server-src/Makefile tape-src/Makefile"
+ac_config_files="$ac_config_files Makefile amandad-src/Makefile amar-src/Makefile amplot/Makefile changer-src/Makefile client-src/Makefile common-src/Makefile common-src/versuff.c config/Makefile device-src/Makefile application-src/Makefile example/Makefile example/amanda-client.conf example/amanda.conf example/xinetd.amandaclient example/xinetd.amandaserver example/inetd.conf.amandaclient example/inetd.conf.amandaserver example/chg-mcutil.conf example/template.d/advanced.conf example/template.d/amanda-S3.conf example/template.d/amanda-harddisk.conf example/template.d/amanda-single-tape.conf example/template.d/amanda-tape-changer.conf gnulib/Makefile installcheck/Makefile man/Makefile oldrecover-src/Makefile packaging/Makefile perl/Makefile po/Makefile recover-src/Makefile restore-src/Makefile server-src/Makefile xfer-src/Makefile"
 
 
 cat >confcache <<\_ACEOF
@@ -68701,11 +71784,12 @@ _ACEOF
     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;} ;;
+      *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
       esac
       case $ac_var in #(
       _ | IFS | as_nl) ;; #(
+      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
       *) $as_unset $ac_var ;;
       esac ;;
     esac
@@ -68738,12 +71822,12 @@ echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
 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;}
+      { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5
+$as_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;}
+    { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
   fi
 fi
 rm -f confcache
@@ -68759,7 +71843,7 @@ 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"`
+  ac_i=`$as_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"
@@ -68771,23 +71855,23 @@ LTLIBOBJS=$ac_ltlibobjs
 
 
 if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
+  { { $as_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.
+$as_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__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+  { { $as_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.
+$as_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 "${GL_COND_LIBTOOL_TRUE}" && test -z "${GL_COND_LIBTOOL_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"GL_COND_LIBTOOL\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"GL_COND_LIBTOOL\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"GL_COND_LIBTOOL\" was never defined.
+$as_echo "$as_me: error: conditional \"GL_COND_LIBTOOL\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
     gl_LTLIBOBJS=$gl_ltlibobjs
 
 
+
+    gltests_libobjs=
+    gltests_ltlibobjs=
+    if test -n "$gltests_LIBOBJS"; then
+      # Remove the extension.
+      sed_drop_objext='s/\.o$//;s/\.obj$//'
+      for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed "$sed_drop_objext" | sort | uniq`; do
+        gltests_libobjs="$gltests_libobjs $i.$ac_objext"
+        gltests_ltlibobjs="$gltests_ltlibobjs $i.lo"
+      done
+    fi
+    gltests_LIBOBJS=$gltests_libobjs
+
+    gltests_LTLIBOBJS=$gltests_ltlibobjs
+
+
 if test -z "${WANT_SETUID_CLIENT_TRUE}" && test -z "${WANT_SETUID_CLIENT_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_SETUID_CLIENT\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_SETUID_CLIENT\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_SETUID_CLIENT\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_SETUID_CLIENT\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_INSTALLPERMS_TRUE}" && test -z "${WANT_INSTALLPERMS_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_INSTALLPERMS\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_INSTALLPERMS\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_INSTALLPERMS\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_INSTALLPERMS\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_CLIENT_TRUE}" && test -z "${WANT_CLIENT_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_CLIENT\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_CLIENT\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_CLIENT\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_CLIENT\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_RESTORE_TRUE}" && test -z "${WANT_RESTORE_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_RESTORE\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_RESTORE\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_RESTORE\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_RESTORE\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_SERVER_TRUE}" && test -z "${WANT_SERVER_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_SERVER\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_SERVER\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_SERVER\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_SERVER\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_RECOVER_TRUE}" && test -z "${WANT_RECOVER_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_RECOVER\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_RECOVER\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_RECOVER\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_RECOVER\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_TAPE_TRUE}" && test -z "${WANT_TAPE_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_TAPE\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_TAPE\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_TAPE\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_TAPE\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_AMPLOT_TRUE}" && test -z "${WANT_AMPLOT_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_AMPLOT\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_AMPLOT\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_AMPLOT\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_AMPLOT\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${ENABLE_MANPAGE_BUILD_TRUE}" && test -z "${ENABLE_MANPAGE_BUILD_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"ENABLE_MANPAGE_BUILD\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"ENABLE_MANPAGE_BUILD\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"ENABLE_MANPAGE_BUILD\" was never defined.
+$as_echo "$as_me: error: conditional \"ENABLE_MANPAGE_BUILD\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_CHG_SCSI_TRUE}" && test -z "${WANT_CHG_SCSI_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_CHG_SCSI\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_CHG_SCSI\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_CHG_SCSI\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_CHG_SCSI\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_SCSI_LINUX_TRUE}" && test -z "${WANT_SCSI_LINUX_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_SCSI_LINUX\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_SCSI_LINUX\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_SCSI_LINUX\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_SCSI_LINUX\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_SCSI_HPUX_NEW_TRUE}" && test -z "${WANT_SCSI_HPUX_NEW_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_SCSI_HPUX_NEW\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_SCSI_HPUX_NEW\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_SCSI_HPUX_NEW\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_SCSI_HPUX_NEW\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_SCSI_IRIX_TRUE}" && test -z "${WANT_SCSI_IRIX_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_SCSI_IRIX\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_SCSI_IRIX\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_SCSI_IRIX\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_SCSI_IRIX\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_SCSI_SOLARIS_TRUE}" && test -z "${WANT_SCSI_SOLARIS_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_SCSI_SOLARIS\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_SCSI_SOLARIS\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_SCSI_SOLARIS\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_SCSI_SOLARIS\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_SCSI_AIX_TRUE}" && test -z "${WANT_SCSI_AIX_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_SCSI_AIX\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_SCSI_AIX\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_SCSI_AIX\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_SCSI_AIX\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_SCSI_CAM_TRUE}" && test -z "${WANT_SCSI_CAM_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_SCSI_CAM\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_SCSI_CAM\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_SCSI_CAM\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_SCSI_CAM\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_SCSI_BSD_TRUE}" && test -z "${WANT_SCSI_BSD_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_SCSI_BSD\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_SCSI_BSD\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_SCSI_BSD\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_SCSI_BSD\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_CHG_SCSI_CHIO_TRUE}" && test -z "${WANT_CHG_SCSI_CHIO_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_CHG_SCSI_CHIO\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_CHG_SCSI_CHIO\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_CHG_SCSI_CHIO\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_CHG_SCSI_CHIO\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_SCSI_HPUX_TRUE}" && test -z "${WANT_SCSI_HPUX_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_SCSI_HPUX\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_SCSI_HPUX\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_SCSI_HPUX\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_SCSI_HPUX\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_SCSI_CHIO_TRUE}" && test -z "${WANT_SCSI_CHIO_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_SCSI_CHIO\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_SCSI_CHIO\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_SCSI_CHIO\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_SCSI_CHIO\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_AMFLOCK_POSIX_TRUE}" && test -z "${WANT_AMFLOCK_POSIX_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_AMFLOCK_POSIX\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_AMFLOCK_POSIX\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_AMFLOCK_POSIX\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_AMFLOCK_POSIX\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_AMFLOCK_FLOCK_TRUE}" && test -z "${WANT_AMFLOCK_FLOCK_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_AMFLOCK_FLOCK\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_AMFLOCK_FLOCK\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_AMFLOCK_FLOCK\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_AMFLOCK_FLOCK\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_AMFLOCK_LOCKF_TRUE}" && test -z "${WANT_AMFLOCK_LOCKF_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_AMFLOCK_LOCKF\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_AMFLOCK_LOCKF\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_AMFLOCK_LOCKF\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_AMFLOCK_LOCKF\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_AMFLOCK_LNLOCK_TRUE}" && test -z "${WANT_AMFLOCK_LNLOCK_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_AMFLOCK_LNLOCK\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_AMFLOCK_LNLOCK\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_AMFLOCK_LNLOCK\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_AMFLOCK_LNLOCK\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_CYGWIN_COPY_PERL_DLL_TRUE}" && test -z "${WANT_CYGWIN_COPY_PERL_DLL_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_CYGWIN_COPY_PERL_DLL\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_CYGWIN_COPY_PERL_DLL\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_CYGWIN_COPY_PERL_DLL\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_CYGWIN_COPY_PERL_DLL\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_S3_DEVICE_TRUE}" && test -z "${WANT_S3_DEVICE_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_S3_DEVICE\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_S3_DEVICE\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-if test -z "${WANT_DEVPAY_TRUE}" && test -z "${WANT_DEVPAY_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_DEVPAY\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_S3_DEVICE\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_DEVPAY\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_S3_DEVICE\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_TAPE_XENIX_TRUE}" && test -z "${WANT_TAPE_XENIX_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_TAPE_XENIX\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_TAPE_XENIX\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_TAPE_XENIX\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_TAPE_XENIX\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_TAPE_AIX_TRUE}" && test -z "${WANT_TAPE_AIX_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_TAPE_AIX\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_TAPE_AIX\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_TAPE_AIX\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_TAPE_AIX\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_TAPE_UWARE_TRUE}" && test -z "${WANT_TAPE_UWARE_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_TAPE_UWARE\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_TAPE_UWARE\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_TAPE_UWARE\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_TAPE_UWARE\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_TAPE_POSIX_TRUE}" && test -z "${WANT_TAPE_POSIX_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_TAPE_POSIX\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_TAPE_POSIX\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_TAPE_POSIX\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_TAPE_POSIX\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_TAPE_DEVICE_TRUE}" && test -z "${WANT_TAPE_DEVICE_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_TAPE_DEVICE\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_TAPE_DEVICE\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_TAPE_DEVICE\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_TAPE_DEVICE\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_BSD_SECURITY_TRUE}" && test -z "${WANT_BSD_SECURITY_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_BSD_SECURITY\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_BSD_SECURITY\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_BSD_SECURITY\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_BSD_SECURITY\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_BSDTCP_SECURITY_TRUE}" && test -z "${WANT_BSDTCP_SECURITY_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_BSDTCP_SECURITY\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_BSDTCP_SECURITY\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_BSDTCP_SECURITY\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_BSDTCP_SECURITY\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_BSDUDP_SECURITY_TRUE}" && test -z "${WANT_BSDUDP_SECURITY_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_BSDUDP_SECURITY\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_BSDUDP_SECURITY\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_BSDUDP_SECURITY\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_BSDUDP_SECURITY\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_RSH_SECURITY_TRUE}" && test -z "${WANT_RSH_SECURITY_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_RSH_SECURITY\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_RSH_SECURITY\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_RSH_SECURITY\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_RSH_SECURITY\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_SSH_SECURITY_TRUE}" && test -z "${WANT_SSH_SECURITY_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_SSH_SECURITY\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_SSH_SECURITY\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_SSH_SECURITY\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_SSH_SECURITY\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_KRB4_SECURITY_TRUE}" && test -z "${WANT_KRB4_SECURITY_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_KRB4_SECURITY\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_KRB4_SECURITY\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_KRB4_SECURITY\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_KRB4_SECURITY\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_KRB5_SECURITY_TRUE}" && test -z "${WANT_KRB5_SECURITY_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_KRB5_SECURITY\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_KRB5_SECURITY\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_KRB5_SECURITY\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_KRB5_SECURITY\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
 if test -z "${WANT_SAMBA_TRUE}" && test -z "${WANT_SAMBA_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"WANT_SAMBA\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"WANT_SAMBA\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WANT_SAMBA\" was never defined.
+$as_echo "$as_me: error: conditional \"WANT_SAMBA\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
+
 if test -z "${GCC_COMPILER_TRUE}" && test -z "${GCC_COMPILER_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"GCC_COMPILER\" was never defined.
+  { { $as_echo "$as_me:$LINENO: error: conditional \"GCC_COMPILER\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"GCC_COMPILER\" was never defined.
+$as_echo "$as_me: error: conditional \"GCC_COMPILER\" 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.
+  { { $as_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.
+$as_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
 
 : ${CONFIG_STATUS=./config.status}
+ac_write_fail=0
 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
+{ $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 #! $SHELL
 # Generated by $as_me.
 # Run this file to recreate the current configuration.
@@ -69120,7 +72215,7 @@ ac_cs_silent=false
 SHELL=\${CONFIG_SHELL-$SHELL}
 _ACEOF
 
-cat >>$CONFIG_STATUS <<\_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 ## --------------------- ##
 ## M4sh Initialization.  ##
 ## --------------------- ##
@@ -69130,7 +72225,7 @@ DUALCASE=1; export DUALCASE # for MKS sh
 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
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
   # is contrary to our usage.  Disable this feature.
   alias -g '${1+"$@"}'='"$@"'
   setopt NO_GLOB_SUBST
@@ -69152,17 +72247,45 @@ 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=';'
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='printf %s\n'
+  as_echo_n='printf %s'
+else
+  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+    as_echo_n='/usr/ucb/echo -n'
   else
-    PATH_SEPARATOR=:
+    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+    as_echo_n_body='eval
+      arg=$1;
+      case $arg in
+      *"$as_nl"*)
+       expr "X$arg" : "X\\(.*\\)$as_nl";
+       arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+      esac;
+      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+    '
+    export as_echo_n_body
+    as_echo_n='sh -c $as_echo_n_body as_echo'
   fi
-  rm -f conf$$.sh
+  export as_echo_body
+  as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+      PATH_SEPARATOR=';'
+  }
 fi
 
 # Support unset when possible.
@@ -69178,8 +72301,6 @@ fi
 # 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.
@@ -69202,7 +72323,7 @@ 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
+  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
   { (exit 1); exit 1; }
 fi
 
@@ -69215,17 +72336,10 @@ 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
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
 
 # Required to use basename.
 if expr a : '\(a\)' >/dev/null 2>&1 &&
@@ -69247,7 +72361,7 @@ as_me=`$as_basename -- "$0" ||
 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
         X"$0" : 'X\(//\)$' \| \
         X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-echo X/"$0" |
+$as_echo X/"$0" |
     sed '/^.*\/\([^/][^/]*\)\/*$/{
            s//\1/
            q
@@ -69298,7 +72412,7 @@ $as_unset CDPATH
       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
+    { $as_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
@@ -69326,7 +72440,6 @@ case `echo -n x` in
 *)
   ECHO_N='-n';;
 esac
-
 if expr a : '\(a\)' >/dev/null 2>&1 &&
    test "X`expr 00001 : '.*\(...\)'`" = X001; then
   as_expr=expr
@@ -69339,19 +72452,22 @@ 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 ||
+  mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+  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'
-elif ln conf$$.file conf$$ 2>/dev/null; then
-  as_ln_s=ln
+  fi
 else
   as_ln_s='cp -p'
 fi
@@ -69376,10 +72492,10 @@ else
   as_test_x='
     eval sh -c '\''
       if test -d "$1"; then
-        test -d "$1/.";
+       test -d "$1/.";
       else
        case $1 in
-        -*)set "./$1";;
+       -*)set "./$1";;
        esac;
        case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
        ???[sx]*):;;*)false;;esac;fi
@@ -69402,7 +72518,7 @@ exec 6>&1
 # values after options handling.
 ac_log="
 This file was extended by $as_me, which was
-generated by GNU Autoconf 2.61.  Invocation command line was
+generated by GNU Autoconf 2.63.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -69415,7 +72531,16 @@ on `(hostname || uname -n) 2>/dev/null | sed 1q`
 
 _ACEOF
 
-cat >>$CONFIG_STATUS <<_ACEOF
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+case $ac_config_headers in *"
+"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
+esac
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 # Files that config.status was made for.
 config_files="$ac_config_files"
 config_headers="$ac_config_headers"
@@ -69423,22 +72548,23 @@ config_commands="$ac_config_commands"
 
 _ACEOF
 
-cat >>$CONFIG_STATUS <<\_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 ac_cs_usage="\
 \`$as_me' instantiates files from templates according to the
 current configuration.
 
-Usage: $0 [OPTIONS] [FILE]...
+Usage: $0 [OPTION]... [FILE]...
 
   -h, --help       print this help, then exit
   -V, --version    print version number and configuration settings, then exit
-  -q, --quiet      do not print progress messages
+  -q, --quiet, --silent
+                   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
+      --file=FILE[:TEMPLATE]
+                   instantiate the configuration file FILE
+      --header=FILE[:TEMPLATE]
+                   instantiate the configuration header FILE
 
 Configuration files:
 $config_files
@@ -69452,13 +72578,13 @@ $config_commands
 Report bugs to <bug-autoconf@gnu.org>."
 
 _ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_version="\\
 config.status
-configured by $0, generated by GNU Autoconf 2.61,
-  with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+configured by $0, generated by GNU Autoconf 2.63,
+  with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
 
-Copyright (C) 2006 Free Software Foundation, Inc.
+Copyright (C) 2008 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
 
@@ -69466,11 +72592,12 @@ ac_pwd='$ac_pwd'
 srcdir='$srcdir'
 INSTALL='$INSTALL'
 MKDIR_P='$MKDIR_P'
+AWK='$AWK'
+test -n "\$AWK" || AWK=awk
 _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.
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
 ac_need_defaults=:
 while test $# != 0
 do
   -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
     ac_cs_recheck=: ;;
   --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
-    echo "$ac_cs_version"; exit ;;
+    $as_echo "$ac_cs_version"; exit ;;
   --debug | --debu | --deb | --de | --d | -d )
     debug=: ;;
   --file | --fil | --fi | --f )
     $ac_shift
-    CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+    case $ac_optarg in
+    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    CONFIG_FILES="$CONFIG_FILES '$ac_optarg'"
     ac_need_defaults=false;;
   --header | --heade | --head | --hea )
     $ac_shift
-    CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+    case $ac_optarg in
+    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'"
     ac_need_defaults=false;;
   --he | --h)
     # Conflict between --help and --header
-    { echo "$as_me: error: ambiguous option: $1
+    { $as_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 ;;
+    $as_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
+  -*) { $as_echo "$as_me: error: unrecognized option: $1
 Try \`$0 --help' for more information." >&2
    { (exit 1); exit 1; }; } ;;
 
@@ -69534,27 +72667,29 @@ if $ac_cs_silent; then
 fi
 
 _ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 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
+  set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+  shift
+  \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+  CONFIG_SHELL='$SHELL'
   export CONFIG_SHELL
-  exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+  exec "\$@"
 fi
 
 _ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 exec 5>>config.log
 {
   echo
   sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
 ## Running $as_me. ##
 _ASBOX
-  echo "$ac_log"
+  $as_echo "$ac_log"
 } >&5
 
 _ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 #
 # INIT-COMMANDS
 #
@@ -69569,7 +72704,7 @@ AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
 
 _ACEOF
 
-cat >>$CONFIG_STATUS <<\_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 
 # Handling of arguments.
 for ac_config_target in $ac_config_targets
@@ -69580,6 +72715,7 @@ do
     "po-directories") CONFIG_COMMANDS="$CONFIG_COMMANDS po-directories" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
     "amandad-src/Makefile") CONFIG_FILES="$CONFIG_FILES amandad-src/Makefile" ;;
+    "amar-src/Makefile") CONFIG_FILES="$CONFIG_FILES amar-src/Makefile" ;;
     "amplot/Makefile") CONFIG_FILES="$CONFIG_FILES amplot/Makefile" ;;
     "changer-src/Makefile") CONFIG_FILES="$CONFIG_FILES changer-src/Makefile" ;;
     "client-src/Makefile") CONFIG_FILES="$CONFIG_FILES client-src/Makefile" ;;
     "common-src/versuff.c") CONFIG_FILES="$CONFIG_FILES common-src/versuff.c" ;;
     "config/Makefile") CONFIG_FILES="$CONFIG_FILES config/Makefile" ;;
     "device-src/Makefile") CONFIG_FILES="$CONFIG_FILES device-src/Makefile" ;;
-    "device-src/tests/Makefile") CONFIG_FILES="$CONFIG_FILES device-src/tests/Makefile" ;;
-    "dumper-src/Makefile") CONFIG_FILES="$CONFIG_FILES dumper-src/Makefile" ;;
+    "application-src/Makefile") CONFIG_FILES="$CONFIG_FILES application-src/Makefile" ;;
     "example/Makefile") CONFIG_FILES="$CONFIG_FILES example/Makefile" ;;
     "example/amanda-client.conf") CONFIG_FILES="$CONFIG_FILES example/amanda-client.conf" ;;
     "example/amanda.conf") CONFIG_FILES="$CONFIG_FILES example/amanda.conf" ;;
+    "example/xinetd.amandaclient") CONFIG_FILES="$CONFIG_FILES example/xinetd.amandaclient" ;;
+    "example/xinetd.amandaserver") CONFIG_FILES="$CONFIG_FILES example/xinetd.amandaserver" ;;
+    "example/inetd.conf.amandaclient") CONFIG_FILES="$CONFIG_FILES example/inetd.conf.amandaclient" ;;
+    "example/inetd.conf.amandaserver") CONFIG_FILES="$CONFIG_FILES example/inetd.conf.amandaserver" ;;
     "example/chg-mcutil.conf") CONFIG_FILES="$CONFIG_FILES example/chg-mcutil.conf" ;;
-    "example/template.d/amanda-S3.conf") CONFIG_FILES="$CONFIG_FILES example/template.d/amanda-S3.conf" ;;
     "example/template.d/advanced.conf") CONFIG_FILES="$CONFIG_FILES example/template.d/advanced.conf" ;;
+    "example/template.d/amanda-S3.conf") CONFIG_FILES="$CONFIG_FILES example/template.d/amanda-S3.conf" ;;
     "example/template.d/amanda-harddisk.conf") CONFIG_FILES="$CONFIG_FILES example/template.d/amanda-harddisk.conf" ;;
     "example/template.d/amanda-single-tape.conf") CONFIG_FILES="$CONFIG_FILES example/template.d/amanda-single-tape.conf" ;;
     "example/template.d/amanda-tape-changer.conf") CONFIG_FILES="$CONFIG_FILES example/template.d/amanda-tape-changer.conf" ;;
     "recover-src/Makefile") CONFIG_FILES="$CONFIG_FILES recover-src/Makefile" ;;
     "restore-src/Makefile") CONFIG_FILES="$CONFIG_FILES restore-src/Makefile" ;;
     "server-src/Makefile") CONFIG_FILES="$CONFIG_FILES server-src/Makefile" ;;
-    "tape-src/Makefile") CONFIG_FILES="$CONFIG_FILES tape-src/Makefile" ;;
+    "xfer-src/Makefile") CONFIG_FILES="$CONFIG_FILES xfer-src/Makefile" ;;
 
-  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
-echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+  *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
    { (exit 1); exit 1; }; };;
   esac
 done
@@ -69652,711 +72791,144 @@ $debug ||
   (umask 077 && mkdir "$tmp")
 } ||
 {
-   echo "$me: cannot create a temporary directory in ." >&2
+   $as_echo "$as_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
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./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
-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
-target!$target$ac_delim
-target_cpu!$target_cpu$ac_delim
-target_vendor!$target_vendor$ac_delim
-target_os!$target_os$ac_delim
-PACKAGE!$PACKAGE$ac_delim
-INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
-INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim
-INSTALL_DATA!$INSTALL_DATA$ac_delim
-am__isrc!$am__isrc$ac_delim
-CYGPATH_W!$CYGPATH_W$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
-SNAPSHOT_STAMP!$SNAPSHOT_STAMP$ac_delim
-VERSION_MAJOR!$VERSION_MAJOR$ac_delim
-VERSION_MINOR!$VERSION_MINOR$ac_delim
-VERSION_PATCH!$VERSION_PATCH$ac_delim
-VERSION_COMMENT!$VERSION_COMMENT$ac_delim
-VERSION_SUFFIX!$VERSION_SUFFIX$ac_delim
-CC!$CC$ac_delim
-CFLAGS!$CFLAGS$ac_delim
-LDFLAGS!$LDFLAGS$ac_delim
-CPPFLAGS!$CPPFLAGS$ac_delim
-ac_ct_CC!$ac_ct_CC$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
-CCDEPMODE!$CCDEPMODE$ac_delim
-am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim
-am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim
-RANLIB!$RANLIB$ac_delim
-CPP!$CPP$ac_delim
-GREP!$GREP$ac_delim
-EGREP!$EGREP$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`
+ac_cr='\r'
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+  ac_cs_awk_cr='\\r'
+else
+  ac_cs_awk_cr=$ac_cr
 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
+echo 'BEGIN {' >"$tmp/subs1.awk" &&
 _ACEOF
 
 
-ac_delim='%!_!# '
-for ac_last_try in false false false false false :; do
-  cat >conf$$subs.sed <<_ACEOF
-GL_COND_LIBTOOL_TRUE!$GL_COND_LIBTOOL_TRUE$ac_delim
-GL_COND_LIBTOOL_FALSE!$GL_COND_LIBTOOL_FALSE$ac_delim
-ALLOCA!$ALLOCA$ac_delim
-ALLOCA_H!$ALLOCA_H$ac_delim
-ARPA_INET_H!$ARPA_INET_H$ac_delim
-INCLUDE_NEXT!$INCLUDE_NEXT$ac_delim
-NEXT_FLOAT_H!$NEXT_FLOAT_H$ac_delim
-FLOAT_H!$FLOAT_H$ac_delim
-NEXT_SYS_SOCKET_H!$NEXT_SYS_SOCKET_H$ac_delim
-HAVE_SYS_SOCKET_H!$HAVE_SYS_SOCKET_H$ac_delim
-HAVE_WINSOCK2_H!$HAVE_WINSOCK2_H$ac_delim
-HAVE_WS2TCPIP_H!$HAVE_WS2TCPIP_H$ac_delim
-SYS_SOCKET_H!$SYS_SOCKET_H$ac_delim
-LIBINTL!$LIBINTL$ac_delim
-LTLIBINTL!$LTLIBINTL$ac_delim
-NEXT_SYS_TIME_H!$NEXT_SYS_TIME_H$ac_delim
-HAVE_SYS_TIME_H!$HAVE_SYS_TIME_H$ac_delim
-HAVE_STRUCT_TIMEVAL!$HAVE_STRUCT_TIMEVAL$ac_delim
-REPLACE_GETTIMEOFDAY!$REPLACE_GETTIMEOFDAY$ac_delim
-SYS_TIME_H!$SYS_TIME_H$ac_delim
-LIBPTH!$LIBPTH$ac_delim
-LTLIBPTH!$LTLIBPTH$ac_delim
-LIBTHREAD!$LIBTHREAD$ac_delim
-LTLIBTHREAD!$LTLIBTHREAD$ac_delim
-LIBMULTITHREAD!$LIBMULTITHREAD$ac_delim
-LTLIBMULTITHREAD!$LTLIBMULTITHREAD$ac_delim
-HAVE_MALLOC_POSIX!$HAVE_MALLOC_POSIX$ac_delim
-GNULIB_MALLOC_POSIX!$GNULIB_MALLOC_POSIX$ac_delim
-GNULIB_REALLOC_POSIX!$GNULIB_REALLOC_POSIX$ac_delim
-GNULIB_CALLOC_POSIX!$GNULIB_CALLOC_POSIX$ac_delim
-GNULIB_GETSUBOPT!$GNULIB_GETSUBOPT$ac_delim
-GNULIB_MKDTEMP!$GNULIB_MKDTEMP$ac_delim
-GNULIB_MKSTEMP!$GNULIB_MKSTEMP$ac_delim
-HAVE_CALLOC_POSIX!$HAVE_CALLOC_POSIX$ac_delim
-HAVE_GETSUBOPT!$HAVE_GETSUBOPT$ac_delim
-HAVE_MKDTEMP!$HAVE_MKDTEMP$ac_delim
-HAVE_REALLOC_POSIX!$HAVE_REALLOC_POSIX$ac_delim
-REPLACE_MKSTEMP!$REPLACE_MKSTEMP$ac_delim
-NEXT_NETINET_IN_H!$NEXT_NETINET_IN_H$ac_delim
-HAVE_NETINET_IN_H!$HAVE_NETINET_IN_H$ac_delim
-NETINET_IN_H!$NETINET_IN_H$ac_delim
-GNULIB_FPRINTF_POSIX!$GNULIB_FPRINTF_POSIX$ac_delim
-GNULIB_PRINTF_POSIX!$GNULIB_PRINTF_POSIX$ac_delim
-GNULIB_SNPRINTF!$GNULIB_SNPRINTF$ac_delim
-GNULIB_SPRINTF_POSIX!$GNULIB_SPRINTF_POSIX$ac_delim
-GNULIB_VFPRINTF_POSIX!$GNULIB_VFPRINTF_POSIX$ac_delim
-GNULIB_VPRINTF_POSIX!$GNULIB_VPRINTF_POSIX$ac_delim
-GNULIB_VSNPRINTF!$GNULIB_VSNPRINTF$ac_delim
-GNULIB_VSPRINTF_POSIX!$GNULIB_VSPRINTF_POSIX$ac_delim
-GNULIB_VASPRINTF!$GNULIB_VASPRINTF$ac_delim
-GNULIB_FSEEK!$GNULIB_FSEEK$ac_delim
-GNULIB_FSEEKO!$GNULIB_FSEEKO$ac_delim
-GNULIB_FTELL!$GNULIB_FTELL$ac_delim
-GNULIB_FTELLO!$GNULIB_FTELLO$ac_delim
-GNULIB_FFLUSH!$GNULIB_FFLUSH$ac_delim
-GNULIB_GETDELIM!$GNULIB_GETDELIM$ac_delim
-GNULIB_GETLINE!$GNULIB_GETLINE$ac_delim
-REPLACE_FPRINTF!$REPLACE_FPRINTF$ac_delim
-REPLACE_VFPRINTF!$REPLACE_VFPRINTF$ac_delim
-REPLACE_PRINTF!$REPLACE_PRINTF$ac_delim
-REPLACE_VPRINTF!$REPLACE_VPRINTF$ac_delim
-REPLACE_SNPRINTF!$REPLACE_SNPRINTF$ac_delim
-HAVE_DECL_SNPRINTF!$HAVE_DECL_SNPRINTF$ac_delim
-REPLACE_VSNPRINTF!$REPLACE_VSNPRINTF$ac_delim
-HAVE_DECL_VSNPRINTF!$HAVE_DECL_VSNPRINTF$ac_delim
-REPLACE_SPRINTF!$REPLACE_SPRINTF$ac_delim
-REPLACE_VSPRINTF!$REPLACE_VSPRINTF$ac_delim
-HAVE_VASPRINTF!$HAVE_VASPRINTF$ac_delim
-REPLACE_VASPRINTF!$REPLACE_VASPRINTF$ac_delim
-HAVE_FSEEKO!$HAVE_FSEEKO$ac_delim
-REPLACE_FSEEKO!$REPLACE_FSEEKO$ac_delim
-REPLACE_FSEEK!$REPLACE_FSEEK$ac_delim
-HAVE_FTELLO!$HAVE_FTELLO$ac_delim
-REPLACE_FTELLO!$REPLACE_FTELLO$ac_delim
-REPLACE_FTELL!$REPLACE_FTELL$ac_delim
-REPLACE_FFLUSH!$REPLACE_FFLUSH$ac_delim
-HAVE_DECL_GETDELIM!$HAVE_DECL_GETDELIM$ac_delim
-HAVE_DECL_GETLINE!$HAVE_DECL_GETLINE$ac_delim
-REPLACE_GETLINE!$REPLACE_GETLINE$ac_delim
-STDBOOL_H!$STDBOOL_H$ac_delim
-HAVE__BOOL!$HAVE__BOOL$ac_delim
-HAVE_LONG_LONG_INT!$HAVE_LONG_LONG_INT$ac_delim
-HAVE_UNSIGNED_LONG_LONG_INT!$HAVE_UNSIGNED_LONG_LONG_INT$ac_delim
-HAVE_INTTYPES_H!$HAVE_INTTYPES_H$ac_delim
-HAVE_SYS_TYPES_H!$HAVE_SYS_TYPES_H$ac_delim
-NEXT_STDINT_H!$NEXT_STDINT_H$ac_delim
-HAVE_STDINT_H!$HAVE_STDINT_H$ac_delim
-HAVE_SYS_INTTYPES_H!$HAVE_SYS_INTTYPES_H$ac_delim
-HAVE_SYS_BITYPES_H!$HAVE_SYS_BITYPES_H$ac_delim
-BITSIZEOF_PTRDIFF_T!$BITSIZEOF_PTRDIFF_T$ac_delim
-BITSIZEOF_SIG_ATOMIC_T!$BITSIZEOF_SIG_ATOMIC_T$ac_delim
-BITSIZEOF_SIZE_T!$BITSIZEOF_SIZE_T$ac_delim
-BITSIZEOF_WCHAR_T!$BITSIZEOF_WCHAR_T$ac_delim
-BITSIZEOF_WINT_T!$BITSIZEOF_WINT_T$ac_delim
-HAVE_SIGNED_SIG_ATOMIC_T!$HAVE_SIGNED_SIG_ATOMIC_T$ac_delim
-HAVE_SIGNED_WCHAR_T!$HAVE_SIGNED_WCHAR_T$ac_delim
-HAVE_SIGNED_WINT_T!$HAVE_SIGNED_WINT_T$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;}
+{
+  echo "cat >conf$$subs.awk <<_ACEOF" &&
+  echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+  echo "_ACEOF"
+} >conf$$subs.sh ||
+  { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+$as_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
-_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_num=`echo "$ac_subst_vars" | grep -c '$'`
 ac_delim='%!_!# '
 for ac_last_try in false false false false false :; do
-  cat >conf$$subs.sed <<_ACEOF
-PTRDIFF_T_SUFFIX!$PTRDIFF_T_SUFFIX$ac_delim
-SIG_ATOMIC_T_SUFFIX!$SIG_ATOMIC_T_SUFFIX$ac_delim
-SIZE_T_SUFFIX!$SIZE_T_SUFFIX$ac_delim
-WCHAR_T_SUFFIX!$WCHAR_T_SUFFIX$ac_delim
-WINT_T_SUFFIX!$WINT_T_SUFFIX$ac_delim
-STDINT_H!$STDINT_H$ac_delim
-NEXT_STDIO_H!$NEXT_STDIO_H$ac_delim
-NEXT_STDLIB_H!$NEXT_STDLIB_H$ac_delim
-GNULIB_MEMMEM!$GNULIB_MEMMEM$ac_delim
-GNULIB_MEMPCPY!$GNULIB_MEMPCPY$ac_delim
-GNULIB_MEMRCHR!$GNULIB_MEMRCHR$ac_delim
-GNULIB_STPCPY!$GNULIB_STPCPY$ac_delim
-GNULIB_STPNCPY!$GNULIB_STPNCPY$ac_delim
-GNULIB_STRCHRNUL!$GNULIB_STRCHRNUL$ac_delim
-GNULIB_STRDUP!$GNULIB_STRDUP$ac_delim
-GNULIB_STRNDUP!$GNULIB_STRNDUP$ac_delim
-GNULIB_STRNLEN!$GNULIB_STRNLEN$ac_delim
-GNULIB_STRPBRK!$GNULIB_STRPBRK$ac_delim
-GNULIB_STRSEP!$GNULIB_STRSEP$ac_delim
-GNULIB_STRCASESTR!$GNULIB_STRCASESTR$ac_delim
-GNULIB_STRTOK_R!$GNULIB_STRTOK_R$ac_delim
-GNULIB_MBSLEN!$GNULIB_MBSLEN$ac_delim
-GNULIB_MBSNLEN!$GNULIB_MBSNLEN$ac_delim
-GNULIB_MBSCHR!$GNULIB_MBSCHR$ac_delim
-GNULIB_MBSRCHR!$GNULIB_MBSRCHR$ac_delim
-GNULIB_MBSSTR!$GNULIB_MBSSTR$ac_delim
-GNULIB_MBSCASECMP!$GNULIB_MBSCASECMP$ac_delim
-GNULIB_MBSNCASECMP!$GNULIB_MBSNCASECMP$ac_delim
-GNULIB_MBSPCASECMP!$GNULIB_MBSPCASECMP$ac_delim
-GNULIB_MBSCASESTR!$GNULIB_MBSCASESTR$ac_delim
-GNULIB_MBSCSPN!$GNULIB_MBSCSPN$ac_delim
-GNULIB_MBSPBRK!$GNULIB_MBSPBRK$ac_delim
-GNULIB_MBSSPN!$GNULIB_MBSSPN$ac_delim
-GNULIB_MBSSEP!$GNULIB_MBSSEP$ac_delim
-GNULIB_MBSTOK_R!$GNULIB_MBSTOK_R$ac_delim
-HAVE_DECL_MEMMEM!$HAVE_DECL_MEMMEM$ac_delim
-HAVE_MEMPCPY!$HAVE_MEMPCPY$ac_delim
-HAVE_DECL_MEMRCHR!$HAVE_DECL_MEMRCHR$ac_delim
-HAVE_STPCPY!$HAVE_STPCPY$ac_delim
-HAVE_STPNCPY!$HAVE_STPNCPY$ac_delim
-HAVE_STRCASECMP!$HAVE_STRCASECMP$ac_delim
-HAVE_DECL_STRNCASECMP!$HAVE_DECL_STRNCASECMP$ac_delim
-HAVE_STRCHRNUL!$HAVE_STRCHRNUL$ac_delim
-HAVE_DECL_STRDUP!$HAVE_DECL_STRDUP$ac_delim
-HAVE_STRNDUP!$HAVE_STRNDUP$ac_delim
-HAVE_DECL_STRNDUP!$HAVE_DECL_STRNDUP$ac_delim
-HAVE_DECL_STRNLEN!$HAVE_DECL_STRNLEN$ac_delim
-HAVE_STRPBRK!$HAVE_STRPBRK$ac_delim
-HAVE_STRSEP!$HAVE_STRSEP$ac_delim
-HAVE_STRCASESTR!$HAVE_STRCASESTR$ac_delim
-HAVE_DECL_STRTOK_R!$HAVE_DECL_STRTOK_R$ac_delim
-NEXT_STRING_H!$NEXT_STRING_H$ac_delim
-HAVE_LSTAT!$HAVE_LSTAT$ac_delim
-HAVE_DECL_MKDIR!$HAVE_DECL_MKDIR$ac_delim
-HAVE_IO_H!$HAVE_IO_H$ac_delim
-NEXT_SYS_STAT_H!$NEXT_SYS_STAT_H$ac_delim
-SYS_STAT_H!$SYS_STAT_H$ac_delim
-GNULIB_CHOWN!$GNULIB_CHOWN$ac_delim
-GNULIB_DUP2!$GNULIB_DUP2$ac_delim
-GNULIB_FCHDIR!$GNULIB_FCHDIR$ac_delim
-GNULIB_FTRUNCATE!$GNULIB_FTRUNCATE$ac_delim
-GNULIB_GETCWD!$GNULIB_GETCWD$ac_delim
-GNULIB_GETLOGIN_R!$GNULIB_GETLOGIN_R$ac_delim
-GNULIB_LCHOWN!$GNULIB_LCHOWN$ac_delim
-GNULIB_LSEEK!$GNULIB_LSEEK$ac_delim
-GNULIB_READLINK!$GNULIB_READLINK$ac_delim
-GNULIB_SLEEP!$GNULIB_SLEEP$ac_delim
-HAVE_DUP2!$HAVE_DUP2$ac_delim
-HAVE_FTRUNCATE!$HAVE_FTRUNCATE$ac_delim
-HAVE_READLINK!$HAVE_READLINK$ac_delim
-HAVE_SLEEP!$HAVE_SLEEP$ac_delim
-HAVE_DECL_GETLOGIN_R!$HAVE_DECL_GETLOGIN_R$ac_delim
-REPLACE_CHOWN!$REPLACE_CHOWN$ac_delim
-REPLACE_FCHDIR!$REPLACE_FCHDIR$ac_delim
-REPLACE_GETCWD!$REPLACE_GETCWD$ac_delim
-REPLACE_LCHOWN!$REPLACE_LCHOWN$ac_delim
-REPLACE_LSEEK!$REPLACE_LSEEK$ac_delim
-NEXT_UNISTD_H!$NEXT_UNISTD_H$ac_delim
-HAVE_UNISTD_H!$HAVE_UNISTD_H$ac_delim
-EOVERFLOW!$EOVERFLOW$ac_delim
-CFLAG_VISIBILITY!$CFLAG_VISIBILITY$ac_delim
-HAVE_VISIBILITY!$HAVE_VISIBILITY$ac_delim
-GNULIB_WCWIDTH!$GNULIB_WCWIDTH$ac_delim
-HAVE_DECL_WCWIDTH!$HAVE_DECL_WCWIDTH$ac_delim
-REPLACE_WCWIDTH!$REPLACE_WCWIDTH$ac_delim
-WCHAR_H!$WCHAR_H$ac_delim
-HAVE_WCHAR_H!$HAVE_WCHAR_H$ac_delim
-NEXT_WCHAR_H!$NEXT_WCHAR_H$ac_delim
-AMANDA_WARNING_CFLAGS!$AMANDA_WARNING_CFLAGS$ac_delim
-CLIENT_LOGIN!$CLIENT_LOGIN$ac_delim
-SETUID_GROUP!$SETUID_GROUP$ac_delim
-CONFIG_DIR!$CONFIG_DIR$ac_delim
-USE_VERSION_SUFFIXES!$USE_VERSION_SUFFIXES$ac_delim
-GNUTAR_LISTED_INCREMENTAL_DIR!$GNUTAR_LISTED_INCREMENTAL_DIR$ac_delim
-AMANDA_TMPDIR!$AMANDA_TMPDIR$ac_delim
-BINARY_OWNER!$BINARY_OWNER$ac_delim
-MAXTAPEBLOCKSIZE!$MAXTAPEBLOCKSIZE$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;}
+  . ./conf$$subs.sh ||
+    { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+$as_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-3.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
-AMANDA_DBGDIR!$AMANDA_DBGDIR$ac_delim
-AMANDA_DEBUG_DAYS!$AMANDA_DEBUG_DAYS$ac_delim
-SERVICE_SUFFIX!$SERVICE_SUFFIX$ac_delim
-WANT_SETUID_CLIENT_TRUE!$WANT_SETUID_CLIENT_TRUE$ac_delim
-WANT_SETUID_CLIENT_FALSE!$WANT_SETUID_CLIENT_FALSE$ac_delim
-WANT_INSTALLPERMS_TRUE!$WANT_INSTALLPERMS_TRUE$ac_delim
-WANT_INSTALLPERMS_FALSE!$WANT_INSTALLPERMS_FALSE$ac_delim
-WANT_CLIENT_TRUE!$WANT_CLIENT_TRUE$ac_delim
-WANT_CLIENT_FALSE!$WANT_CLIENT_FALSE$ac_delim
-WANT_RESTORE_TRUE!$WANT_RESTORE_TRUE$ac_delim
-WANT_RESTORE_FALSE!$WANT_RESTORE_FALSE$ac_delim
-WANT_SERVER_TRUE!$WANT_SERVER_TRUE$ac_delim
-WANT_SERVER_FALSE!$WANT_SERVER_FALSE$ac_delim
-WANT_RECOVER_TRUE!$WANT_RECOVER_TRUE$ac_delim
-WANT_RECOVER_FALSE!$WANT_RECOVER_FALSE$ac_delim
-WANT_TAPE_TRUE!$WANT_TAPE_TRUE$ac_delim
-WANT_TAPE_FALSE!$WANT_TAPE_FALSE$ac_delim
-GNUPLOT!$GNUPLOT$ac_delim
-PCAT!$PCAT$ac_delim
-COMPRESS!$COMPRESS$ac_delim
-GZIP!$GZIP$ac_delim
-AMPLOT_COMPRESS!$AMPLOT_COMPRESS$ac_delim
-AMPLOT_CAT_GZIP!$AMPLOT_CAT_GZIP$ac_delim
-AMPLOT_CAT_COMPRESS!$AMPLOT_CAT_COMPRESS$ac_delim
-AMPLOT_CAT_PACK!$AMPLOT_CAT_PACK$ac_delim
-WANT_AMPLOT_TRUE!$WANT_AMPLOT_TRUE$ac_delim
-WANT_AMPLOT_FALSE!$WANT_AMPLOT_FALSE$ac_delim
-XSLTPROC_FLAGS!$XSLTPROC_FLAGS$ac_delim
-XSLTPROC!$XSLTPROC$ac_delim
-ENABLE_MANPAGE_BUILD_TRUE!$ENABLE_MANPAGE_BUILD_TRUE$ac_delim
-ENABLE_MANPAGE_BUILD_FALSE!$ENABLE_MANPAGE_BUILD_FALSE$ac_delim
-XSLREL!$XSLREL$ac_delim
-DOC_BUILD_DATE!$DOC_BUILD_DATE$ac_delim
-DEFAULT_SERVER!$DEFAULT_SERVER$ac_delim
-DEFAULT_CONFIG!$DEFAULT_CONFIG$ac_delim
-DEFAULT_TAPE_SERVER!$DEFAULT_TAPE_SERVER$ac_delim
-DEFAULT_TAPE_DEVICE!$DEFAULT_TAPE_DEVICE$ac_delim
-EXAMPLE_TAPEDEV!$EXAMPLE_TAPEDEV$ac_delim
-DEFAULT_CHANGER_DEVICE!$DEFAULT_CHANGER_DEVICE$ac_delim
-DEFAULT_AMANDATES_FILE!$DEFAULT_AMANDATES_FILE$ac_delim
-GETCONF!$GETCONF$ac_delim
-CHIO!$CHIO$ac_delim
-CHS!$CHS$ac_delim
-MTX!$MTX$ac_delim
-MCUTIL!$MCUTIL$ac_delim
-WANT_CHG_SCSI_TRUE!$WANT_CHG_SCSI_TRUE$ac_delim
-WANT_CHG_SCSI_FALSE!$WANT_CHG_SCSI_FALSE$ac_delim
-WANT_SCSI_LINUX_TRUE!$WANT_SCSI_LINUX_TRUE$ac_delim
-WANT_SCSI_LINUX_FALSE!$WANT_SCSI_LINUX_FALSE$ac_delim
-WANT_SCSI_HPUX_NEW_TRUE!$WANT_SCSI_HPUX_NEW_TRUE$ac_delim
-WANT_SCSI_HPUX_NEW_FALSE!$WANT_SCSI_HPUX_NEW_FALSE$ac_delim
-WANT_SCSI_IRIX_TRUE!$WANT_SCSI_IRIX_TRUE$ac_delim
-WANT_SCSI_IRIX_FALSE!$WANT_SCSI_IRIX_FALSE$ac_delim
-WANT_SCSI_SOLARIS_TRUE!$WANT_SCSI_SOLARIS_TRUE$ac_delim
-WANT_SCSI_SOLARIS_FALSE!$WANT_SCSI_SOLARIS_FALSE$ac_delim
-WANT_SCSI_AIX_TRUE!$WANT_SCSI_AIX_TRUE$ac_delim
-WANT_SCSI_AIX_FALSE!$WANT_SCSI_AIX_FALSE$ac_delim
-WANT_SCSI_CAM_TRUE!$WANT_SCSI_CAM_TRUE$ac_delim
-WANT_SCSI_CAM_FALSE!$WANT_SCSI_CAM_FALSE$ac_delim
-WANT_SCSI_BSD_TRUE!$WANT_SCSI_BSD_TRUE$ac_delim
-WANT_SCSI_BSD_FALSE!$WANT_SCSI_BSD_FALSE$ac_delim
-WANT_CHG_SCSI_CHIO_TRUE!$WANT_CHG_SCSI_CHIO_TRUE$ac_delim
-WANT_CHG_SCSI_CHIO_FALSE!$WANT_CHG_SCSI_CHIO_FALSE$ac_delim
-WANT_SCSI_HPUX_TRUE!$WANT_SCSI_HPUX_TRUE$ac_delim
-WANT_SCSI_HPUX_FALSE!$WANT_SCSI_HPUX_FALSE$ac_delim
-WANT_SCSI_CHIO_TRUE!$WANT_SCSI_CHIO_TRUE$ac_delim
-WANT_SCSI_CHIO_FALSE!$WANT_SCSI_CHIO_FALSE$ac_delim
-WANT_AMFLOCK_POSIX_TRUE!$WANT_AMFLOCK_POSIX_TRUE$ac_delim
-WANT_AMFLOCK_POSIX_FALSE!$WANT_AMFLOCK_POSIX_FALSE$ac_delim
-WANT_AMFLOCK_FLOCK_TRUE!$WANT_AMFLOCK_FLOCK_TRUE$ac_delim
-WANT_AMFLOCK_FLOCK_FALSE!$WANT_AMFLOCK_FLOCK_FALSE$ac_delim
-WANT_AMFLOCK_LOCKF_TRUE!$WANT_AMFLOCK_LOCKF_TRUE$ac_delim
-WANT_AMFLOCK_LOCKF_FALSE!$WANT_AMFLOCK_LOCKF_FALSE$ac_delim
-WANT_AMFLOCK_LNLOCK_TRUE!$WANT_AMFLOCK_LNLOCK_TRUE$ac_delim
-WANT_AMFLOCK_LNLOCK_FALSE!$WANT_AMFLOCK_LNLOCK_FALSE$ac_delim
-SWIG!$SWIG$ac_delim
-SWIG_LIB!$SWIG_LIB$ac_delim
-PERL!$PERL$ac_delim
-PERL_INC!$PERL_INC$ac_delim
-WANT_CYGWIN_COPY_PERL_DLL_TRUE!$WANT_CYGWIN_COPY_PERL_DLL_TRUE$ac_delim
-WANT_CYGWIN_COPY_PERL_DLL_FALSE!$WANT_CYGWIN_COPY_PERL_DLL_FALSE$ac_delim
-PERLEXTLIBS!$PERLEXTLIBS$ac_delim
-CAT!$CAT$ac_delim
-CLIENT_SCRIPTS_OPT!$CLIENT_SCRIPTS_OPT$ac_delim
-amlibdir!$amlibdir$ac_delim
-amlibexecdir!$amlibexecdir$ac_delim
-amincludedir!$amincludedir$ac_delim
-amperldir!$amperldir$ac_delim
-DUMPER_DIR!$DUMPER_DIR$ac_delim
-MSGFMT!$MSGFMT$ac_delim
-GETTEXT!$GETTEXT$ac_delim
-USE_NLS!$USE_NLS$ac_delim
-GMSGFMT!$GMSGFMT$ac_delim
-MSGFMT_015!$MSGFMT_015$ac_delim
-GMSGFMT_015!$GMSGFMT_015$ac_delim
-XGETTEXT!$XGETTEXT$ac_delim
-XGETTEXT_015!$XGETTEXT_015$ac_delim
-_ACEOF
-
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
+  ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+  if test $ac_delim_n = $ac_delim_num; 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;}
+    { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+$as_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
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\).*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\).*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+  N
+  s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$tmp/subs1.awk" <<_ACAWK &&
+  for (key in S) S_is_set[key] = 1
+  FS = "\a"
 
-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-4.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
-MSGMERGE!$MSGMERGE$ac_delim
-INTL_MACOSX_LIBS!$INTL_MACOSX_LIBS$ac_delim
-LIBICONV!$LIBICONV$ac_delim
-LTLIBICONV!$LTLIBICONV$ac_delim
-INTLLIBS!$INTLLIBS$ac_delim
-POSUB!$POSUB$ac_delim
-CURL_CONFIG!$CURL_CONFIG$ac_delim
-_libcurl_config!$_libcurl_config$ac_delim
-LIBCURL_CPPFLAGS!$LIBCURL_CPPFLAGS$ac_delim
-LIBCURL!$LIBCURL$ac_delim
-WANT_S3_DEVICE_TRUE!$WANT_S3_DEVICE_TRUE$ac_delim
-WANT_S3_DEVICE_FALSE!$WANT_S3_DEVICE_FALSE$ac_delim
-WANT_DEVPAY_TRUE!$WANT_DEVPAY_TRUE$ac_delim
-WANT_DEVPAY_FALSE!$WANT_DEVPAY_FALSE$ac_delim
-WANT_TAPE_XENIX_TRUE!$WANT_TAPE_XENIX_TRUE$ac_delim
-WANT_TAPE_XENIX_FALSE!$WANT_TAPE_XENIX_FALSE$ac_delim
-WANT_TAPE_AIX_TRUE!$WANT_TAPE_AIX_TRUE$ac_delim
-WANT_TAPE_AIX_FALSE!$WANT_TAPE_AIX_FALSE$ac_delim
-WANT_TAPE_UWARE_TRUE!$WANT_TAPE_UWARE_TRUE$ac_delim
-WANT_TAPE_UWARE_FALSE!$WANT_TAPE_UWARE_FALSE$ac_delim
-WANT_TAPE_POSIX_TRUE!$WANT_TAPE_POSIX_TRUE$ac_delim
-WANT_TAPE_POSIX_FALSE!$WANT_TAPE_POSIX_FALSE$ac_delim
-WANT_TAPE_DEVICE_TRUE!$WANT_TAPE_DEVICE_TRUE$ac_delim
-WANT_TAPE_DEVICE_FALSE!$WANT_TAPE_DEVICE_FALSE$ac_delim
-WANT_BSD_SECURITY_TRUE!$WANT_BSD_SECURITY_TRUE$ac_delim
-WANT_BSD_SECURITY_FALSE!$WANT_BSD_SECURITY_FALSE$ac_delim
-WANT_BSDTCP_SECURITY_TRUE!$WANT_BSDTCP_SECURITY_TRUE$ac_delim
-WANT_BSDTCP_SECURITY_FALSE!$WANT_BSDTCP_SECURITY_FALSE$ac_delim
-WANT_BSDUDP_SECURITY_TRUE!$WANT_BSDUDP_SECURITY_TRUE$ac_delim
-WANT_BSDUDP_SECURITY_FALSE!$WANT_BSDUDP_SECURITY_FALSE$ac_delim
-WANT_RSH_SECURITY_TRUE!$WANT_RSH_SECURITY_TRUE$ac_delim
-WANT_RSH_SECURITY_FALSE!$WANT_RSH_SECURITY_FALSE$ac_delim
-SSH!$SSH$ac_delim
-WANT_SSH_SECURITY_TRUE!$WANT_SSH_SECURITY_TRUE$ac_delim
-WANT_SSH_SECURITY_FALSE!$WANT_SSH_SECURITY_FALSE$ac_delim
-WANT_KRB4_SECURITY_TRUE!$WANT_KRB4_SECURITY_TRUE$ac_delim
-WANT_KRB4_SECURITY_FALSE!$WANT_KRB4_SECURITY_FALSE$ac_delim
-WANT_KRB5_SECURITY_TRUE!$WANT_KRB5_SECURITY_TRUE$ac_delim
-WANT_KRB5_SECURITY_FALSE!$WANT_KRB5_SECURITY_FALSE$ac_delim
-XFSDUMP!$XFSDUMP$ac_delim
-XFSRESTORE!$XFSRESTORE$ac_delim
-VXDUMP!$VXDUMP$ac_delim
-VXRESTORE!$VXRESTORE$ac_delim
-VDUMP!$VDUMP$ac_delim
-VRESTORE!$VRESTORE$ac_delim
-DUMP!$DUMP$ac_delim
-RESTORE!$RESTORE$ac_delim
-GNUTAR!$GNUTAR$ac_delim
-SAMBA_CLIENT!$SAMBA_CLIENT$ac_delim
-WANT_SAMBA_TRUE!$WANT_SAMBA_TRUE$ac_delim
-WANT_SAMBA_FALSE!$WANT_SAMBA_FALSE$ac_delim
-AMLINT!$AMLINT$ac_delim
-AMLINTFLAGS!$AMLINTFLAGS$ac_delim
-LEX!$LEX$ac_delim
-LEX_OUTPUT_ROOT!$LEX_OUTPUT_ROOT$ac_delim
-LEXLIB!$LEXLIB$ac_delim
-AR!$AR$ac_delim
-YACC!$YACC$ac_delim
-YFLAGS!$YFLAGS$ac_delim
-DD!$DD$ac_delim
-BASH!$BASH$ac_delim
-SORT!$SORT$ac_delim
-MAILER!$MAILER$ac_delim
-MT!$MT$ac_delim
-MT_FILE_FLAG!$MT_FILE_FLAG$ac_delim
-PRINT!$PRINT$ac_delim
-GCC_COMPILER_TRUE!$GCC_COMPILER_TRUE$ac_delim
-GCC_COMPILER_FALSE!$GCC_COMPILER_FALSE$ac_delim
-LN_S!$LN_S$ac_delim
-ECHO!$ECHO$ac_delim
-CXX!$CXX$ac_delim
-CXXFLAGS!$CXXFLAGS$ac_delim
-ac_ct_CXX!$ac_ct_CXX$ac_delim
-CXXDEPMODE!$CXXDEPMODE$ac_delim
-am__fastdepCXX_TRUE!$am__fastdepCXX_TRUE$ac_delim
-am__fastdepCXX_FALSE!$am__fastdepCXX_FALSE$ac_delim
-CXXCPP!$CXXCPP$ac_delim
-F77!$F77$ac_delim
-FFLAGS!$FFLAGS$ac_delim
-ac_ct_F77!$ac_ct_F77$ac_delim
-LIBTOOL!$LIBTOOL$ac_delim
-LIBTOOL_DEPS!$LIBTOOL_DEPS$ac_delim
-AMANDA_STATIC_LDFLAGS!$AMANDA_STATIC_LDFLAGS$ac_delim
-PKG_CONFIG!$PKG_CONFIG$ac_delim
-GLIB_CFLAGS!$GLIB_CFLAGS$ac_delim
-GLIB_LIBS!$GLIB_LIBS$ac_delim
-GLIB_GENMARSHAL!$GLIB_GENMARSHAL$ac_delim
-GOBJECT_QUERY!$GOBJECT_QUERY$ac_delim
-GLIB_MKENUMS!$GLIB_MKENUMS$ac_delim
-READLINE_LIBS!$READLINE_LIBS$ac_delim
-LIBOBJS!$LIBOBJS$ac_delim
-LTLIBOBJS!$LTLIBOBJS$ac_delim
-gl_LIBOBJS!$gl_LIBOBJS$ac_delim
-gl_LTLIBOBJS!$gl_LTLIBOBJS$ac_delim
-_ACEOF
-
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 94; 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
+}
+{
+  line = $ 0
+  nfields = split(line, field, "@")
+  substed = 0
+  len = length(field[1])
+  for (i = 2; i < nfields; i++) {
+    key = field[i]
+    keylen = length(key)
+    if (S_is_set[key]) {
+      value = S[key]
+      line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+      len += length(value) + length(field[++i])
+      substed = 1
+    } else
+      len += 1 + keylen
+  }
 
-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
+  print line
+}
 
-cat >>$CONFIG_STATUS <<_ACEOF
-cat >"\$tmp/subs-5.sed" <<\CEOF$ac_eof
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
+_ACAWK
 _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
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+  sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+  cat
+fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
+  || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5
+$as_echo "$as_me: error: could not setup config files machinery" >&2;}
+   { (exit 1); exit 1; }; }
 _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
@@ -70372,19 +72944,133 @@ s/^[^=]*=[    ]*$//
 }'
 fi
 
-cat >>$CONFIG_STATUS <<\_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 fi # test -n "$CONFIG_FILES"
 
+# Set up the scripts for CONFIG_HEADERS section.
+# No need to generate them if there are no CONFIG_HEADERS.
+# This happens for instance with `./config.status Makefile'.
+if test -n "$CONFIG_HEADERS"; then
+cat >"$tmp/defines.awk" <<\_ACAWK ||
+BEGIN {
+_ACEOF
+
+# Transform confdefs.h into an awk script `defines.awk', embedded as
+# here-document in config.status, that substitutes the proper values into
+# config.h.in to produce config.h.
 
-for ac_tag in  :F $CONFIG_FILES  :H $CONFIG_HEADERS    :C $CONFIG_COMMANDS
+# Create a delimiter string that does not exist in confdefs.h, to ease
+# handling of long lines.
+ac_delim='%!_!# '
+for ac_last_try in false false :; do
+  ac_t=`sed -n "/$ac_delim/p" confdefs.h`
+  if test -z "$ac_t"; then
+    break
+  elif $ac_last_try; then
+    { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5
+$as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;}
+   { (exit 1); exit 1; }; }
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+
+# For the awk script, D is an array of macro values keyed by name,
+# likewise P contains macro parameters if any.  Preserve backslash
+# newline sequences.
+
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+sed -n '
+s/.\{148\}/&'"$ac_delim"'/g
+t rset
+:rset
+s/^[    ]*#[    ]*define[       ][      ]*/ /
+t def
+d
+:def
+s/\\$//
+t bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[    ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3"/p
+s/^ \('"$ac_word_re"'\)[        ]*\(.*\)/D["\1"]=" \2"/p
+d
+:bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[    ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3\\\\\\n"\\/p
+t cont
+s/^ \('"$ac_word_re"'\)[        ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
+t cont
+d
+:cont
+n
+s/.\{148\}/&'"$ac_delim"'/g
+t clear
+:clear
+s/\\$//
+t bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/"/p
+d
+:bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
+b cont
+' <confdefs.h | sed '
+s/'"$ac_delim"'/"\\\
+"/g' >>$CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+  for (key in D) D_is_set[key] = 1
+  FS = "\a"
+}
+/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
+  line = \$ 0
+  split(line, arg, " ")
+  if (arg[1] == "#") {
+    defundef = arg[2]
+    mac1 = arg[3]
+  } else {
+    defundef = substr(arg[1], 2)
+    mac1 = arg[2]
+  }
+  split(mac1, mac2, "(") #)
+  macro = mac2[1]
+  prefix = substr(line, 1, index(line, defundef) - 1)
+  if (D_is_set[macro]) {
+    # Preserve the white space surrounding the "#".
+    print prefix "define", macro P[macro] D[macro]
+    next
+  } else {
+    # 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.
+    if (defundef == "undef") {
+      print "/*", prefix defundef, macro, "*/"
+      next
+    }
+  }
+}
+{ print }
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+  { { $as_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5
+$as_echo "$as_me: error: could not setup config headers machinery" >&2;}
+   { (exit 1); exit 1; }; }
+fi # test -n "$CONFIG_HEADERS"
+
+
+eval set X "  :F $CONFIG_FILES  :H $CONFIG_HEADERS    :C $CONFIG_COMMANDS"
+shift
+for ac_tag
 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;}
+  :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5
+$as_echo "$as_me: error: invalid tag $ac_tag" >&2;}
    { (exit 1); exit 1; }; };;
   :[FH]-) ac_tag=-:-;;
   :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
@@ -70413,26 +73099,38 @@ echo "$as_me: error: Invalid tag $ac_tag." >&2;}
           [\\/$]*) 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;}
+          { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
+$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;}
    { (exit 1); exit 1; }; };;
       esac
-      ac_file_inputs="$ac_file_inputs $ac_f"
+      case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; 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."
+    configure_input='Generated from '`
+         $as_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;}
+      { $as_echo "$as_me:$LINENO: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
     fi
+    # Neutralize special characters interpreted by sed in replacement strings.
+    case $configure_input in #(
+    *\&* | *\|* | *\\* )
+       ac_sed_conf_input=`$as_echo "$configure_input" |
+       sed 's/[\\\\&|]/\\\\&/g'`;; #(
+    *) ac_sed_conf_input=$configure_input;;
+    esac
 
     case $ac_tag in
-    *:-:* | *:-) cat >"$tmp/stdin";;
+    *:-:* | *:-) cat >"$tmp/stdin" \
+      || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
+$as_echo "$as_me: error: could not create $ac_file" >&2;}
+   { (exit 1); exit 1; }; } ;;
     esac
     ;;
   esac
@@ -70442,7 +73140,7 @@ $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" |
+$as_echo X"$ac_file" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
            s//\1/
            q
@@ -70468,7 +73166,7 @@ echo X"$ac_file" |
     as_dirs=
     while :; do
       case $as_dir in #(
-      *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
+      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
       *) as_qdir=$as_dir;;
       esac
       as_dirs="'$as_qdir' $as_dirs"
@@ -70477,7 +73175,7 @@ $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" |
+$as_echo X"$as_dir" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
            s//\1/
            q
@@ -70498,17 +73196,17 @@ echo X"$as_dir" |
       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;}
+  } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+$as_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,^\.[\\/],,'`
+  ac_dir_suffix=/`$as_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,/,,'`
+  ac_top_builddir_sub=`$as_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/ ;;
@@ -70553,12 +73251,13 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
   esac
 _ACEOF
 
-cat >>$CONFIG_STATUS <<\_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # 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/ {
+ac_sed_dataroot='
+/datarootdir/ {
   p
   q
 }
@@ -70567,13 +73266,14 @@ case `sed -n '/datarootdir/ {
 /@infodir@/p
 /@localedir@/p
 /@mandir@/p
-' $ac_file_inputs` in
+'
+case `eval "sed -n \"\$ac_sed_dataroot\" $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;}
+  { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
 _ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
   ac_datarootdir_hack='
   s&@datadir@&$datadir&g
   s&@docdir@&$docdir&g
@@ -70587,15 +73287,16 @@ _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
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
 $extrasub
 _ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 :t
 /@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s&@configure_input@&$configure_input&;t t
+s|@configure_input@|$ac_sed_conf_input|;t t
 s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
 s&@srcdir@&$ac_srcdir&;t t
 s&@abs_srcdir@&$ac_abs_srcdir&;t t
 s&@top_srcdir@&$ac_top_srcdir&;t t
@@ -70606,135 +73307,75 @@ s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
 s&@INSTALL@&$ac_INSTALL&;t t
 s&@MKDIR_P@&$ac_MKDIR_P&;t t
 $ac_datarootdir_hack
-" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" | sed -f "$tmp/subs-3.sed" | sed -f "$tmp/subs-4.sed" | sed -f "$tmp/subs-5.sed" >$tmp/out
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
+  || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
+$as_echo "$as_me: error: could not create $ac_file" >&2;}
+   { (exit 1); exit 1; }; }
 
 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'
+  { $as_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'
+$as_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
+  -) cat "$tmp/out" && rm -f "$tmp/out";;
+  *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
+  esac \
+  || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
+$as_echo "$as_me: error: could not create $ac_file" >&2;}
+   { (exit 1); exit 1; }; }
  ;;
   :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;}
+    {
+      $as_echo "/* $configure_input  */" \
+      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
+    } >"$tmp/config.h" \
+      || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
+$as_echo "$as_me: error: could not create $ac_file" >&2;}
+   { (exit 1); exit 1; }; }
+    if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
+      { $as_echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+$as_echo "$as_me: $ac_file is unchanged" >&6;}
     else
-      rm -f $ac_file
-      mv "$tmp/config.h" $ac_file
+      rm -f "$ac_file"
+      mv "$tmp/config.h" "$ac_file" \
+       || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
+$as_echo "$as_me: error: could not create $ac_file" >&2;}
+   { (exit 1); exit 1; }; }
     fi
   else
-    echo "/* $configure_input  */"
-    cat "$ac_result"
+    $as_echo "/* $configure_input  */" \
+      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
+      || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5
+$as_echo "$as_me: error: could not create -" >&2;}
+   { (exit 1); exit 1; }; }
   fi
-  rm -f "$tmp/out12"
-# Compute $ac_file's index in $config_headers.
+# Compute "$ac_file"'s index in $config_headers.
+_am_arg="$ac_file"
 _am_stamp_count=1
 for _am_header in $config_headers :; do
   case $_am_header in
-    $ac_file | $ac_file:* )
+    $_am_arg | $_am_arg:* )
       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 |
+echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" ||
+$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$_am_arg" : 'X\(//\)[^/]' \| \
+        X"$_am_arg" : 'X\(//\)$' \| \
+        X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$_am_arg" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
            s//\1/
            q
@@ -70754,8 +73395,8 @@ echo X$ac_file |
          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;}
+  :C)  { $as_echo "$as_me:$LINENO: executing $ac_file commands" >&5
+$as_echo "$as_me: executing $ac_file commands" >&6;}
  ;;
   esac
 
@@ -70771,13 +73412,13 @@ echo "$as_me: executing $ac_file commands" >&6;}
   # each Makefile.in and add a new line on top of each file to say so.
   # Grep'ing the whole file is not good either: AIX grep has a line
   # limit of 2048, but all sed's we know have understand at least 4000.
-  if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then
+  if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/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" |
+$as_echo X"$mf" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
            s//\1/
            q
@@ -70821,7 +73462,7 @@ $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
         X"$file" : 'X\(//\)[^/]' \| \
         X"$file" : 'X\(//\)$' \| \
         X"$file" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$file" |
+$as_echo X"$file" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
            s//\1/
            q
@@ -70847,7 +73488,7 @@ echo X"$file" |
     as_dirs=
     while :; do
       case $as_dir in #(
-      *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
+      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
       *) as_qdir=$as_dir;;
       esac
       as_dirs="'$as_qdir' $as_dirs"
@@ -70856,7 +73497,7 @@ $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" |
+$as_echo X"$as_dir" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
            s//\1/
            q
@@ -70877,8 +73518,8 @@ echo X"$as_dir" |
       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;}
+  } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+$as_echo "$as_me: error: cannot create directory $as_dir" >&2;}
    { (exit 1); exit 1; }; }; }
     # echo "creating $dirpart/$file"
     echo '# dummy' > "$dirpart/$file"
@@ -71008,6 +73649,11 @@ _ACEOF
 chmod +x $CONFIG_STATUS
 ac_clean_files=$ac_clean_files_save
 
+test $ac_write_fail = 0 ||
+  { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;}
+   { (exit 1); exit 1; }; }
+
 
 # configure is writing to config.log, and then calls config.status.
 # config.status does its own redirection, appending to config.log.
@@ -71029,6 +73675,10 @@ if test "$no_create" != yes; then
   # would make configure fail if this is the last instruction.
   $ac_cs_success || { (exit 1); exit 1; }
 fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+  { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+fi
 
 
 
 
     # Extract the first word of "svn", so it can be a program name with args.
 set dummy svn; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
 if test "${ac_cv_path_SVN+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  $as_echo_n "(cached) " >&6
 else
   case $SVN in
   [\\/]* | ?:[\\/]*)
@@ -71054,7 +73704,7 @@ do
   for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_SVN="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
@@ -71066,16 +73716,16 @@ esac
 fi
 SVN=$ac_cv_path_SVN
 if test -n "$SVN"; then
-  { echo "$as_me:$LINENO: result: $SVN" >&5
-echo "${ECHO_T}$SVN" >&6; }
+  { $as_echo "$as_me:$LINENO: result: $SVN" >&5
+$as_echo "$SVN" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
-    { echo "$as_me:$LINENO: checking Subversion revision information" >&5
-echo $ECHO_N "checking Subversion revision information... $ECHO_C" >&6; }
+    { $as_echo "$as_me:$LINENO: checking Subversion revision information" >&5
+$as_echo_n "checking Subversion revision information... " >&6; }
     if test -d $srcdir/.svn && test -n "$SVN" && (cd $srcdir > /dev/null ; $SVN info . ) > conftemp.svn; then
        rev=`$GREP Revision: conftemp.svn|cut -d: -f 2|cut -c2-`
        url=`$GREP URL: conftemp.svn|cut -d: -f 2-|cut -c2-`
@@ -71083,18 +73733,18 @@ echo $ECHO_N "checking Subversion revision information... $ECHO_C" >&6; }
          echo '#define BUILT_BRANCH "'`basename "$url"`'"'
        ) > common-src/svn-info.h
 
-       { echo "$as_me:$LINENO: result: updated" >&5
-echo "${ECHO_T}updated" >&6; }
+       { $as_echo "$as_me:$LINENO: result: updated" >&5
+$as_echo "updated" >&6; }
     else
        # Makefiles will be upset if the file doesn't exist, so double-check
        if test -f common-src/svn-info.h; then
            : # all good
-           { echo "$as_me:$LINENO: result: not changed" >&5
-echo "${ECHO_T}not changed" >&6; }
+           { $as_echo "$as_me:$LINENO: result: not changed" >&5
+$as_echo "not changed" >&6; }
        else
            echo '/* no information available */' > common-src/svn-info.h
-           { echo "$as_me:$LINENO: result: not available" >&5
-echo "${ECHO_T}not available" >&6; }
+           { $as_echo "$as_me:$LINENO: result: not available" >&5
+$as_echo "not available" >&6; }
        fi
     fi
 
@@ -71141,10 +73791,11 @@ echo "${ECHO_T}not available" >&6; }
 
 
     echo "Directories:"
-    echo "  Perl modules (amperldir): $amperldir"
-    echo "  Dumper: $DUMPER_DIR"
+    echo "  Application: $APPLICATION_DIR"
     echo "  Configuration: $CONFIG_DIR"
     echo "  GNU Tar lists: $GNUTAR_LISTED_INCREMENTAL_DIR"
+    echo "  Perl modules (amperldir): $amperldir"
+    echo "  Template and example data files (amdatadir): $amdatadir"
     echo "  Temporary: $AMANDA_TMPDIR"
 
     if test -f config.warnings; then
index b5eee29592b7b48329893e1e17dcccc0331a1156..338abfed355b3f6bc9ab23063a48a50b08eb5e05 100644 (file)
@@ -6,7 +6,7 @@ AC_CANONICAL_TARGET([])
 PACKAGE=amanda
 AC_SUBST(PACKAGE)
 
-AM_INIT_AUTOMAKE(amanda, "2.6.0p2")
+AM_INIT_AUTOMAKE(amanda, "2.6.1")
 AC_CONFIG_HEADERS([config/config.h])
 
 dnl Minimum Autoconf version required.
@@ -41,7 +41,7 @@ dnl -------------------------------------------------------------------------
 
 AMANDA_WITH_USER
 AMANDA_WITH_GROUP
-AMANDA_WITH_DUMPERDIR
+AMANDA_WITH_APPLICATIONDIR
 AMANDA_WITH_CONFIGDIR
 AMANDA_WITH_INDEXDIR
 AMANDA_WITH_DBDIR
@@ -142,6 +142,7 @@ AMANDA_PROG_PRINT
 AMANDA_PROG_PCAT
 AMANDA_PROG_PERL
 AMANDA_PROG_SWIG
+AMANDA_PS_ARGUMENT
 
 dnl -------------------------------------------------------------------------
 
@@ -168,6 +169,7 @@ AMANDA_ENABLE_GCC_WARNING([missing-prototypes])
 AMANDA_ENABLE_GCC_WARNING([strict-prototypes])
 AMANDA_ENABLE_GCC_WARNING([missing-declarations])
 AMANDA_ENABLE_GCC_WARNING([format])
+AMANDA_ENABLE_GCC_WARNING([format-security])
 AMANDA_ENABLE_GCC_WARNING([sign-compare])
 AMANDA_ENABLE_GCC_WARNING([float-equal])
 AMANDA_ENABLE_GCC_WARNING([old-style-definition])
@@ -185,6 +187,7 @@ AMANDA_STATIC_FLAGS
 #
 # headers
 #
+AC_HEADER_DIRENT
 AC_HEADER_STDC
 AC_HEADER_TIME
 AC_CHECK_HEADERS(
@@ -196,9 +199,9 @@ AC_CHECK_HEADERS(
        math.h \
        netdb.h \
        netinet/in.h \
+       regex.h \
        stdarg.h \
        stdlib.h \
-       string.h \
        strings.h \
        sys/file.h \
        sys/ioctl.h \
@@ -212,13 +215,17 @@ AC_CHECK_HEADERS(
        sys/types.h \
        sys/uio.h \
        syslog.h \
+       time.h \
        unistd.h \
 )
+AC_DEFINE([HAVE_AMANDA_H], 1, [Define to 1 if you have the "amanda.h" header file.])
+AC_DEFINE([HAVE_UTIL_H], 1, [Define to 1 if you have the "util.h" header file.])
+
+AC_DEFINE([USE_GETTEXT], 1, [Define to 1 if files will be processed with gettextize])
 
 #
 # Types
 #
-AC_SOCKADDR_STORAGE
 AC_CHECK_SIZEOF(int)
 AC_CHECK_SIZEOF(long)
 AC_CHECK_SIZEOF(long long)
@@ -323,7 +330,6 @@ ICE_CHECK_DECL(setegid,unistd.h)
 ICE_CHECK_DECL(seteuid,unistd.h)
 ICE_CHECK_DECL(setresgid,unistd.h)
 ICE_CHECK_DECL(setresuid,unistd.h)
-AC_CHECK_FUNCS(shquote)
 ICE_CHECK_DECL(snprintf,stdio.h)
 ICE_CHECK_DECL(vsnprintf,stdio.h)
 AMANDA_FUNC_SETPGID
@@ -359,6 +365,7 @@ dnl
 AC_CONFIG_FILES([
     Makefile
     amandad-src/Makefile
+    amar-src/Makefile
     amplot/Makefile
     changer-src/Makefile
     client-src/Makefile
@@ -366,14 +373,17 @@ AC_CONFIG_FILES([
     common-src/versuff.c
     config/Makefile
     device-src/Makefile
-    device-src/tests/Makefile
-    dumper-src/Makefile
+    application-src/Makefile
     example/Makefile
     example/amanda-client.conf
     example/amanda.conf
+    example/xinetd.amandaclient
+    example/xinetd.amandaserver
+    example/inetd.conf.amandaclient
+    example/inetd.conf.amandaserver
     example/chg-mcutil.conf
-    example/template.d/amanda-S3.conf
     example/template.d/advanced.conf
+    example/template.d/amanda-S3.conf
     example/template.d/amanda-harddisk.conf
     example/template.d/amanda-single-tape.conf
     example/template.d/amanda-tape-changer.conf
@@ -387,7 +397,7 @@ AC_CONFIG_FILES([
     recover-src/Makefile
     restore-src/Makefile
     server-src/Makefile
-    tape-src/Makefile
+    xfer-src/Makefile
 ])
 
 AC_OUTPUT
index 75177d7d738cccb2b64b4336014e223c7e1df39e..41c5b23d88d06af184a8151a62645e71afd3840a 100644 (file)
@@ -1,7 +1,7 @@
 # Makefile for Amanda tape library.
 
-SUBDIRS = . tests
-
+include $(top_srcdir)/config/automake/vars.am
+include $(top_srcdir)/config/automake/scripts.am
 include $(top_srcdir)/config/automake/precompile.am
 
 INCLUDES =     -I$(top_builddir)/common-src \
@@ -13,11 +13,15 @@ AM_LDFLAGS = $(AMANDA_STATIC_LDFLAGS)
 
 sbin_PROGRAMS =
 
+CHECK_PERL = amtapetype
+SCRIPTS_PERL = $(CHECK_PERL)
+sbin_SCRIPTS = $(SCRIPTS_PERL)
+
 ## libamdevice.la
 
 amlib_LTLIBRARIES =    libamdevice.la
 libamdevice_la_LDFLAGS = -release $(VERSION) 
-libamdevice_la_SOURCES = property.c device.c queueing.c semaphore.c \
+libamdevice_la_SOURCES = property.c device.c device-queueing.c \
        null-device.c rait-device.c vfs-device.c 
 libamdevice_la_LIBADD = ../common-src/libamanda.la
 
@@ -44,21 +48,35 @@ endif
 endif
 
 if WANT_S3_DEVICE
-libamdevice_la_SOURCES += s3-device.c s3.c
+libamdevice_la_SOURCES += s3-device.c s3.c s3-util.c
 endif
 
+## automake-style tests
+
+TESTS = vfs-test
+noinst_PROGRAMS = $(TESTS)
+
+vfs_test_SOURCES = vfs-test.c
+vfs_test_LDADD = \
+       ../common-src/libtestutils.la \
+       libamdevice.la
+
 ## activate-devpay
 
-if WANT_DEVPAY
+if WANT_S3_DEVICE
 sbin_PROGRAMS += activate-devpay
 activate_devpay_SOURCES = activate-devpay.c
 endif
 
 ## headers
 
-noinst_HEADERS = null-device.h semaphore.h \
-       tape-ops.h property.h rait-device.h s3.h \
-       s3-device.h tape-device.h vfs-device.h \
-       device.h queueing.h
+noinst_HEADERS = \
+       device-queueing.h \
+       device.h \
+       property.h \
+       s3.h \
+       s3-util.h \
+       tape-device.h \
+       tape-ops.h
        
 aminclude_HEADERS = 
index 70898dd42826df26b74c5daabdb33978315a1fe4..7b310fccad3a95f7ab67f59102f5c21d3c6e1e37 100644 (file)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  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.
 # Makefile for Amanda tape library.
 
 # vim:ft=automake
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+# 
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License version 2.1 as 
+# published by the Free Software Foundation.
+# 
+# This 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 this library; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+# 
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+# simple include file to pre-define variables which are then +='d by other
+# scripts in this directory.
+
+# vim:ft=automake
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+# 
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License version 2.1 as 
+# published by the Free Software Foundation.
+# 
+# This 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 this library; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+# 
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+# SYNOPSIS:
+#
+# Automake magic to handle the various tasks of building scripts.  Scripts can
+# be built down to extensionless executables (e.g., foo.pl -> foo), or to 
+# files with the usual extension (foo-lib.sh.in -> foo.sh).
+#
+# Files which support it are syntax-checked when the user invokes 'make check'.
+#
+# All *target* filenames must be listed in SCRIPTS_SHELL, SCRIPTS_PERL, and 
+# SCRIPTS_AWK to support 'make check', 'make dist', and 'make distclean'. No
+# files which are not substituted by config.status should be included in
+# SCRIPTS_PERL, SCRIPTS_SHELL, or SCRIPTS_AWK.  If non-generated files are listed
+# for installation, then Automake will figure out that they should be distributed;
+# otherwise, include them in EXTRA_DIST.
+#
+# USAGE:
+#
+#   include $(top_srcdir)/config/automake/vars.am
+#   include $(top_srcdir)/config/automake/scripts.am
+#   ...
+#   SCRIPTS_PERL = fooscript barscript perl-lib.pl perlmod.pm
+#   SCRIPTS_SHELL = shell1 shell2 sh-lib.sh
+#   SCRIPTS_AWK = talk balk chalk awk-lib.awk
+#   sbin_SCRIPTS = not-subbed
+#   EXTRA_DIST = util-script.pl
+#
+# with the corresponding files in the repository:
+#
+#   fooscript.pl barscript.pl perl-lib.pl.in perlmod.pm.in
+#   shell1.sh shell2.sh sh-lib.sh.in
+#   talk.awk balk.awk chalk.awk awk-lib.awk.in
+#   not-subbed util-script.pl
+#
+# by default, all shell and perl scripts are syntax checked.  If this is
+# a problem (for example, perl scripts depending on Amanda extension 
+# modules), then assign to CHECK_{PERL,SHELL} the list of files you wish
+# to be checked (which can be empty).
+#
+# To add extra flags to the perl checks (e.g., to add new -I flags), set
+# CHECK_PERL_FLAGS.
+
+# Implementation note:
+#
+# This file uses config.status to substitute @foo@ in those scripts while
+# converting them. It also adds the executable bits (a+x) to extensionless
+# files.  The substitution works even though the files are not listed in 
+# configure.in
+
+# vim:ft=automake
+
 
 
 
@@ -41,8 +131,10 @@ host_triplet = @host@
 target_triplet = @target@
 DIST_COMMON = $(aminclude_HEADERS) $(noinst_HEADERS) \
        $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
-       $(top_srcdir)/config/automake/precompile.am
-sbin_PROGRAMS = $(am__EXEEXT_1)
+       $(top_srcdir)/config/automake/precompile.am \
+       $(top_srcdir)/config/automake/scripts.am \
+       $(top_srcdir)/config/automake/vars.am
+sbin_PROGRAMS = $(am__EXEEXT_2)
 
 # tape-device has *lots* of conditionals; the first is whether to support
 # the device at all, and the remainder select a particular kind of OS-specific
@@ -52,12 +144,15 @@ sbin_PROGRAMS = $(am__EXEEXT_1)
 @WANT_TAPE_AIX_TRUE@@WANT_TAPE_DEVICE_TRUE@am__append_3 = tape-aix.c
 @WANT_TAPE_DEVICE_TRUE@@WANT_TAPE_UWARE_TRUE@am__append_4 = tape-uware.c
 @WANT_TAPE_DEVICE_TRUE@@WANT_TAPE_POSIX_TRUE@am__append_5 = tape-posix.c
-@WANT_S3_DEVICE_TRUE@am__append_6 = s3-device.c s3.c
-@WANT_DEVPAY_TRUE@am__append_7 = activate-devpay
+@WANT_S3_DEVICE_TRUE@am__append_6 = s3-device.c s3.c s3-util.c
+TESTS = vfs-test$(EXEEXT)
+noinst_PROGRAMS = $(am__EXEEXT_1)
+@WANT_S3_DEVICE_TRUE@am__append_7 = activate-devpay
 subdir = device-src
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps =  \
        $(top_srcdir)/config/macro-archive/ac_define_dir.m4 \
+       $(top_srcdir)/config/macro-archive/ac_perl_module_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_perl_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_swig.m4 \
        $(top_srcdir)/config/macro-archive/ax_compare_version.m4 \
@@ -91,6 +186,7 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/amanda/libs.m4 \
        $(top_srcdir)/config/amanda/net.m4 \
        $(top_srcdir)/config/amanda/progs.m4 \
+       $(top_srcdir)/config/amanda/ps.m4 \
        $(top_srcdir)/config/amanda/readdir.m4 \
        $(top_srcdir)/config/amanda/readline.m4 \
        $(top_srcdir)/config/amanda/rsh-security.m4 \
@@ -113,7 +209,9 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/float_h.m4 \
        $(top_srcdir)/config/gnulib/fsusage.m4 \
        $(top_srcdir)/config/gnulib/getaddrinfo.m4 \
+       $(top_srcdir)/config/gnulib/getopt.m4 \
        $(top_srcdir)/config/gnulib/gettimeofday.m4 \
+       $(top_srcdir)/config/gnulib/gnulib-common.m4 \
        $(top_srcdir)/config/gnulib/gnulib-comp.m4 \
        $(top_srcdir)/config/gnulib/include_next.m4 \
        $(top_srcdir)/config/gnulib/inet_ntop.m4 \
@@ -141,7 +239,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/sys_stat_h.m4 \
        $(top_srcdir)/config/gnulib/sys_time_h.m4 \
        $(top_srcdir)/config/gnulib/tempname.m4 \
-       $(top_srcdir)/config/gnulib/ulonglong.m4 \
        $(top_srcdir)/config/gnulib/unistd_h.m4 \
        $(top_srcdir)/config/gnulib/vasnprintf.m4 \
        $(top_srcdir)/config/gnulib/visibility.m4 \
@@ -152,7 +249,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gettext-macros/lib-ld.m4 \
        $(top_srcdir)/config/gettext-macros/lib-link.m4 \
        $(top_srcdir)/config/gettext-macros/lib-prefix.m4 \
-       $(top_srcdir)/config/gettext-macros/longlong.m4 \
        $(top_srcdir)/config/gettext-macros/nls.m4 \
        $(top_srcdir)/config/gettext-macros/po.m4 \
        $(top_srcdir)/config/gettext-macros/progtest.m4 \
@@ -174,14 +270,14 @@ am__vpath_adj = case $$p in \
   esac;
 am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
 am__installdirs = "$(DESTDIR)$(amlibdir)" "$(DESTDIR)$(sbindir)" \
-       "$(DESTDIR)$(amincludedir)"
+       "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(amincludedir)"
 amlibLTLIBRARIES_INSTALL = $(INSTALL)
 LTLIBRARIES = $(amlib_LTLIBRARIES)
 libamdevice_la_DEPENDENCIES = ../common-src/libamanda.la
-am__libamdevice_la_SOURCES_DIST = property.c device.c queueing.c \
-       semaphore.c null-device.c rait-device.c vfs-device.c \
+am__libamdevice_la_SOURCES_DIST = property.c device.c \
+       device-queueing.c null-device.c rait-device.c vfs-device.c \
        tape-device.c tape-xenix.c tape-aix.c tape-uware.c \
-       tape-posix.c s3-device.c s3.c
+       tape-posix.c s3-device.c s3.c s3-util.c
 @WANT_TAPE_DEVICE_TRUE@am__objects_1 = tape-device.lo
 @WANT_TAPE_DEVICE_TRUE@@WANT_TAPE_XENIX_TRUE@am__objects_2 =  \
 @WANT_TAPE_DEVICE_TRUE@@WANT_TAPE_XENIX_TRUE@  tape-xenix.lo
@@ -191,24 +287,30 @@ am__libamdevice_la_SOURCES_DIST = property.c device.c queueing.c \
 @WANT_TAPE_DEVICE_TRUE@@WANT_TAPE_UWARE_TRUE@  tape-uware.lo
 @WANT_TAPE_DEVICE_TRUE@@WANT_TAPE_POSIX_TRUE@am__objects_5 =  \
 @WANT_TAPE_DEVICE_TRUE@@WANT_TAPE_POSIX_TRUE@  tape-posix.lo
-@WANT_S3_DEVICE_TRUE@am__objects_6 = s3-device.lo s3.lo
-am_libamdevice_la_OBJECTS = property.lo device.lo queueing.lo \
-       semaphore.lo null-device.lo rait-device.lo vfs-device.lo \
-       $(am__objects_1) $(am__objects_2) $(am__objects_3) \
-       $(am__objects_4) $(am__objects_5) $(am__objects_6)
+@WANT_S3_DEVICE_TRUE@am__objects_6 = s3-device.lo s3.lo s3-util.lo
+am_libamdevice_la_OBJECTS = property.lo device.lo device-queueing.lo \
+       null-device.lo rait-device.lo vfs-device.lo $(am__objects_1) \
+       $(am__objects_2) $(am__objects_3) $(am__objects_4) \
+       $(am__objects_5) $(am__objects_6)
 libamdevice_la_OBJECTS = $(am_libamdevice_la_OBJECTS)
 libamdevice_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
        $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
        $(libamdevice_la_LDFLAGS) $(LDFLAGS) -o $@
-@WANT_DEVPAY_TRUE@am__EXEEXT_1 = activate-devpay$(EXEEXT)
+am__EXEEXT_1 = vfs-test$(EXEEXT)
+@WANT_S3_DEVICE_TRUE@am__EXEEXT_2 = activate-devpay$(EXEEXT)
 sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
-PROGRAMS = $(sbin_PROGRAMS)
+PROGRAMS = $(noinst_PROGRAMS) $(sbin_PROGRAMS)
 am__activate_devpay_SOURCES_DIST = activate-devpay.c
-@WANT_DEVPAY_TRUE@am_activate_devpay_OBJECTS =  \
-@WANT_DEVPAY_TRUE@     activate-devpay.$(OBJEXT)
+@WANT_S3_DEVICE_TRUE@am_activate_devpay_OBJECTS =  \
+@WANT_S3_DEVICE_TRUE@  activate-devpay.$(OBJEXT)
 activate_devpay_OBJECTS = $(am_activate_devpay_OBJECTS)
 activate_devpay_LDADD = $(LDADD)
-DEFAULT_INCLUDES = -I. -I$(top_builddir)/config@am__isrc@
+am_vfs_test_OBJECTS = vfs-test.$(OBJEXT)
+vfs_test_OBJECTS = $(am_vfs_test_OBJECTS)
+vfs_test_DEPENDENCIES = ../common-src/libtestutils.la libamdevice.la
+sbinSCRIPT_INSTALL = $(INSTALL_SCRIPT)
+SCRIPTS = $(sbin_SCRIPTS)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/config
 depcomp = $(SHELL) $(top_srcdir)/config/depcomp
 am__depfiles_maybe = depfiles
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
@@ -220,25 +322,17 @@ CCLD = $(CC)
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
        --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
        $(LDFLAGS) -o $@
-SOURCES = $(libamdevice_la_SOURCES) $(activate_devpay_SOURCES)
+SOURCES = $(libamdevice_la_SOURCES) $(activate_devpay_SOURCES) \
+       $(vfs_test_SOURCES)
 DIST_SOURCES = $(am__libamdevice_la_SOURCES_DIST) \
-       $(am__activate_devpay_SOURCES_DIST)
-RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
-       html-recursive info-recursive install-data-recursive \
-       install-dvi-recursive install-exec-recursive \
-       install-html-recursive install-info-recursive \
-       install-pdf-recursive install-ps-recursive install-recursive \
-       installcheck-recursive installdirs-recursive pdf-recursive \
-       ps-recursive uninstall-recursive
+       $(am__activate_devpay_SOURCES_DIST) $(vfs_test_SOURCES)
 amincludeHEADERS_INSTALL = $(INSTALL_HEADER)
 HEADERS = $(aminclude_HEADERS) $(noinst_HEADERS)
-RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive        \
-  distclean-recursive maintainer-clean-recursive
 ETAGS = etags
 CTAGS = ctags
-DIST_SUBDIRS = $(SUBDIRS)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
+AIX_BACKUP = @AIX_BACKUP@
 ALLOCA = @ALLOCA@
 ALLOCA_H = @ALLOCA_H@
 AMANDA_DBGDIR = @AMANDA_DBGDIR@
@@ -253,8 +347,10 @@ AMPLOT_CAT_GZIP = @AMPLOT_CAT_GZIP@
 AMPLOT_CAT_PACK = @AMPLOT_CAT_PACK@
 AMPLOT_COMPRESS = @AMPLOT_COMPRESS@
 AMTAR = @AMTAR@
+APPLICATION_DIR = @APPLICATION_DIR@
 AR = @AR@
 ARPA_INET_H = @ARPA_INET_H@
+ASSERTIONS = @ASSERTIONS@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -266,16 +362,28 @@ BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@
 BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@
 BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@
 BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@
+BSDTCP_SECURITY = @BSDTCP_SECURITY@
+BSDUDP_SECURITY = @BSDUDP_SECURITY@
+BSD_SECURITY = @BSD_SECURITY@
 CAT = @CAT@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
+CHECK_USERID = @CHECK_USERID@
 CHIO = @CHIO@
 CHS = @CHS@
+CLIENT_HOST_INSTANCE = @CLIENT_HOST_INSTANCE@
+CLIENT_HOST_KEY_FILE = @CLIENT_HOST_KEY_FILE@
+CLIENT_HOST_PRINCIPAL = @CLIENT_HOST_PRINCIPAL@
 CLIENT_LOGIN = @CLIENT_LOGIN@
 CLIENT_SCRIPTS_OPT = @CLIENT_SCRIPTS_OPT@
 COMPRESS = @COMPRESS@
+COMPRESS_BEST_OPT = @COMPRESS_BEST_OPT@
+COMPRESS_FAST_OPT = @COMPRESS_FAST_OPT@
+COMPRESS_PATH = @COMPRESS_PATH@
+COMPRESS_SUFFIX = @COMPRESS_SUFFIX@
+CONFIG_CLOBBER_MY_CONFIG = @CONFIG_CLOBBER_MY_CONFIG@
 CONFIG_DIR = @CONFIG_DIR@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
@@ -289,6 +397,7 @@ DD = @DD@
 DEFAULT_AMANDATES_FILE = @DEFAULT_AMANDATES_FILE@
 DEFAULT_CHANGER_DEVICE = @DEFAULT_CHANGER_DEVICE@
 DEFAULT_CONFIG = @DEFAULT_CONFIG@
+DEFAULT_MAILER = @DEFAULT_MAILER@
 DEFAULT_SERVER = @DEFAULT_SERVER@
 DEFAULT_TAPE_DEVICE = @DEFAULT_TAPE_DEVICE@
 DEFAULT_TAPE_SERVER = @DEFAULT_TAPE_SERVER@
@@ -296,7 +405,7 @@ DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DOC_BUILD_DATE = @DOC_BUILD_DATE@
 DUMP = @DUMP@
-DUMPER_DIR = @DUMPER_DIR@
+DUMP_RETURNS_1 = @DUMP_RETURNS_1@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -309,6 +418,7 @@ F77 = @F77@
 FFLAGS = @FFLAGS@
 FLOAT_H = @FLOAT_H@
 GETCONF = @GETCONF@
+GETOPT_H = @GETOPT_H@
 GETTEXT = @GETTEXT@
 GLIB_CFLAGS = @GLIB_CFLAGS@
 GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
@@ -319,9 +429,12 @@ GMSGFMT_015 = @GMSGFMT_015@
 GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
 GNULIB_CHOWN = @GNULIB_CHOWN@
 GNULIB_DUP2 = @GNULIB_DUP2@
+GNULIB_ENVIRON = @GNULIB_ENVIRON@
 GNULIB_FCHDIR = @GNULIB_FCHDIR@
 GNULIB_FFLUSH = @GNULIB_FFLUSH@
+GNULIB_FOPEN = @GNULIB_FOPEN@
 GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
+GNULIB_FREOPEN = @GNULIB_FREOPEN@
 GNULIB_FSEEK = @GNULIB_FSEEK@
 GNULIB_FSEEKO = @GNULIB_FSEEKO@
 GNULIB_FTELL = @GNULIB_FTELL@
@@ -331,6 +444,7 @@ GNULIB_GETCWD = @GNULIB_GETCWD@
 GNULIB_GETDELIM = @GNULIB_GETDELIM@
 GNULIB_GETLINE = @GNULIB_GETLINE@
 GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
+GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@
 GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
 GNULIB_LCHOWN = @GNULIB_LCHOWN@
 GNULIB_LSEEK = @GNULIB_LSEEK@
@@ -355,8 +469,10 @@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
 GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
 GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
 GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
+GNULIB_PUTENV = @GNULIB_PUTENV@
 GNULIB_READLINK = @GNULIB_READLINK@
 GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@
+GNULIB_SETENV = @GNULIB_SETENV@
 GNULIB_SLEEP = @GNULIB_SLEEP@
 GNULIB_SNPRINTF = @GNULIB_SNPRINTF@
 GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@
@@ -365,11 +481,15 @@ GNULIB_STPNCPY = @GNULIB_STPNCPY@
 GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
 GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
 GNULIB_STRDUP = @GNULIB_STRDUP@
+GNULIB_STRERROR = @GNULIB_STRERROR@
 GNULIB_STRNDUP = @GNULIB_STRNDUP@
 GNULIB_STRNLEN = @GNULIB_STRNLEN@
 GNULIB_STRPBRK = @GNULIB_STRPBRK@
 GNULIB_STRSEP = @GNULIB_STRSEP@
+GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@
+GNULIB_STRSTR = @GNULIB_STRSTR@
 GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
+GNULIB_UNSETENV = @GNULIB_UNSETENV@
 GNULIB_VASPRINTF = @GNULIB_VASPRINTF@
 GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@
 GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
@@ -383,6 +503,7 @@ GOBJECT_QUERY = @GOBJECT_QUERY@
 GREP = @GREP@
 GZIP = @GZIP@
 HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@
+HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@
 HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@
 HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@
 HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
@@ -391,9 +512,10 @@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
 HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@
 HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
 HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
-HAVE_DECL_STRNCASECMP = @HAVE_DECL_STRNCASECMP@
+HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@
 HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
 HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
+HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@
 HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
 HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
 HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
@@ -401,7 +523,9 @@ HAVE_DUP2 = @HAVE_DUP2@
 HAVE_FSEEKO = @HAVE_FSEEKO@
 HAVE_FTELLO = @HAVE_FTELLO@
 HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
+HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
 HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
+HAVE_GZIP = @HAVE_GZIP@
 HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
 HAVE_IO_H = @HAVE_IO_H@
 HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
@@ -410,8 +534,10 @@ HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@
 HAVE_MEMPCPY = @HAVE_MEMPCPY@
 HAVE_MKDTEMP = @HAVE_MKDTEMP@
 HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@
+HAVE_OS_H = @HAVE_OS_H@
 HAVE_READLINK = @HAVE_READLINK@
 HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@
+HAVE_SETENV = @HAVE_SETENV@
 HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
 HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
 HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
@@ -419,7 +545,6 @@ HAVE_SLEEP = @HAVE_SLEEP@
 HAVE_STDINT_H = @HAVE_STDINT_H@
 HAVE_STPCPY = @HAVE_STPCPY@
 HAVE_STPNCPY = @HAVE_STPNCPY@
-HAVE_STRCASECMP = @HAVE_STRCASECMP@
 HAVE_STRCASESTR = @HAVE_STRCASESTR@
 HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
 HAVE_STRNDUP = @HAVE_STRNDUP@
@@ -428,10 +553,12 @@ HAVE_STRSEP = @HAVE_STRSEP@
 HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@
 HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
 HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
+HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
 HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
 HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
 HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
 HAVE_UNISTD_H = @HAVE_UNISTD_H@
+HAVE_UNSETENV = @HAVE_UNSETENV@
 HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
 HAVE_VASPRINTF = @HAVE_VASPRINTF@
 HAVE_VISIBILITY = @HAVE_VISIBILITY@
@@ -447,6 +574,8 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 INTLLIBS = @INTLLIBS@
 INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+KRB4_SECURITY = @KRB4_SECURITY@
+KRB5_SECURITY = @KRB5_SECURITY@
 LDFLAGS = @LDFLAGS@
 LEX = @LEX@
 LEXLIB = @LEXLIB@
@@ -463,6 +592,8 @@ LIBTHREAD = @LIBTHREAD@
 LIBTOOL = @LIBTOOL@
 LIBTOOL_DEPS = @LIBTOOL_DEPS@
 LN_S = @LN_S@
+LOCKING = @LOCKING@
+LOW_TCPPORTRANGE = @LOW_TCPPORTRANGE@
 LTLIBICONV = @LTLIBICONV@
 LTLIBINTL = @LTLIBINTL@
 LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
@@ -471,7 +602,6 @@ LTLIBPTH = @LTLIBPTH@
 LTLIBTHREAD = @LTLIBTHREAD@
 MAILER = @MAILER@
 MAKEINFO = @MAKEINFO@
-MAXTAPEBLOCKSIZE = @MAXTAPEBLOCKSIZE@
 MCUTIL = @MCUTIL@
 MKDIR_P = @MKDIR_P@
 MSGFMT = @MSGFMT@
@@ -507,26 +637,37 @@ PERL_INC = @PERL_INC@
 PKG_CONFIG = @PKG_CONFIG@
 POSUB = @POSUB@
 PRINT = @PRINT@
+PS = @PS@
+PS_ARGUMENT = @PS_ARGUMENT@
 PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
 RANLIB = @RANLIB@
 READLINE_LIBS = @READLINE_LIBS@
 REPLACE_CHOWN = @REPLACE_CHOWN@
 REPLACE_FCHDIR = @REPLACE_FCHDIR@
 REPLACE_FFLUSH = @REPLACE_FFLUSH@
+REPLACE_FOPEN = @REPLACE_FOPEN@
 REPLACE_FPRINTF = @REPLACE_FPRINTF@
+REPLACE_FREOPEN = @REPLACE_FREOPEN@
 REPLACE_FSEEK = @REPLACE_FSEEK@
 REPLACE_FSEEKO = @REPLACE_FSEEKO@
 REPLACE_FTELL = @REPLACE_FTELL@
 REPLACE_FTELLO = @REPLACE_FTELLO@
 REPLACE_GETCWD = @REPLACE_GETCWD@
 REPLACE_GETLINE = @REPLACE_GETLINE@
+REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
 REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
 REPLACE_LCHOWN = @REPLACE_LCHOWN@
 REPLACE_LSEEK = @REPLACE_LSEEK@
+REPLACE_MEMMEM = @REPLACE_MEMMEM@
 REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
 REPLACE_PRINTF = @REPLACE_PRINTF@
+REPLACE_PUTENV = @REPLACE_PUTENV@
 REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
 REPLACE_SPRINTF = @REPLACE_SPRINTF@
+REPLACE_STRCASESTR = @REPLACE_STRCASESTR@
+REPLACE_STRERROR = @REPLACE_STRERROR@
+REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@
+REPLACE_STRSTR = @REPLACE_STRSTR@
 REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
 REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
 REPLACE_VPRINTF = @REPLACE_VPRINTF@
@@ -534,7 +675,11 @@ REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
 REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
 REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
 RESTORE = @RESTORE@
+RSH_SECURITY = @RSH_SECURITY@
 SAMBA_CLIENT = @SAMBA_CLIENT@
+SERVER_HOST_INSTANCE = @SERVER_HOST_INSTANCE@
+SERVER_HOST_KEY_FILE = @SERVER_HOST_KEY_FILE@
+SERVER_HOST_PRINCIPAL = @SERVER_HOST_PRINCIPAL@
 SERVICE_SUFFIX = @SERVICE_SUFFIX@
 SETUID_GROUP = @SETUID_GROUP@
 SET_MAKE = @SET_MAKE@
@@ -544,6 +689,7 @@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
 SNAPSHOT_STAMP = @SNAPSHOT_STAMP@
 SORT = @SORT@
 SSH = @SSH@
+SSH_SECURITY = @SSH_SECURITY@
 STDBOOL_H = @STDBOOL_H@
 STDINT_H = @STDINT_H@
 STRIP = @STRIP@
@@ -553,7 +699,14 @@ SWIG_LIB = @SWIG_LIB@
 SYS_SOCKET_H = @SYS_SOCKET_H@
 SYS_STAT_H = @SYS_STAT_H@
 SYS_TIME_H = @SYS_TIME_H@
+TCPPORTRANGE = @TCPPORTRANGE@
+TICKET_LIFETIME = @TICKET_LIFETIME@
+UDPPORTRANGE = @UDPPORTRANGE@
+UNCOMPRESS_OPT = @UNCOMPRESS_OPT@
+UNCOMPRESS_PATH = @UNCOMPRESS_PATH@
+USE_AMANDAHOSTS = @USE_AMANDAHOSTS@
 USE_NLS = @USE_NLS@
+USE_RUNDUMP = @USE_RUNDUMP@
 USE_VERSION_SUFFIXES = @USE_VERSION_SUFFIXES@
 VDUMP = @VDUMP@
 VERSION = @VERSION@
@@ -562,6 +715,7 @@ VERSION_MAJOR = @VERSION_MAJOR@
 VERSION_MINOR = @VERSION_MINOR@
 VERSION_PATCH = @VERSION_PATCH@
 VERSION_SUFFIX = @VERSION_SUFFIX@
+VOID_UNSETENV = @VOID_UNSETENV@
 VRESTORE = @VRESTORE@
 VXDUMP = @VXDUMP@
 VXRESTORE = @VXRESTORE@
@@ -590,6 +744,7 @@ am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+amdatadir = @amdatadir@
 amincludedir = @amincludedir@
 amlibdir = @amlibdir@
 amlibexecdir = @amlibexecdir@
@@ -608,6 +763,8 @@ dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 gl_LIBOBJS = @gl_LIBOBJS@
 gl_LTLIBOBJS = @gl_LTLIBOBJS@
+gltests_LIBOBJS = @gltests_LIBOBJS@
+gltests_LTLIBOBJS = @gltests_LTLIBOBJS@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
@@ -637,34 +794,62 @@ target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-SUBDIRS = . tests
+SUFFIXES = 
+EXTRA_DIST = 
+BUILT_SOURCES = 
+MOSTLYCLEANFILES = 
+
+# config.status leaves config.log files around
+CLEANFILES = config.log
+
+# and we'll need to clean up our generated files for distclean
+DISTCLEANFILES = $(SCRIPTS_SHELL) $(SCRIPTS_PERL) $(SCRIPTS_AWK) \
+       $(SCRIPTS_INCLUDE)
+MAINTAINERCLEANFILES = 
+
+# syntax-check shell scripts on 'make check'
+CHECK_SHELL = $(SCRIPTS_SHELL)
 INCLUDES = -I$(top_builddir)/common-src \
                -I$(top_srcdir)/common-src \
                -I$(top_srcdir)/gnulib
 
 AM_CFLAGS = $(AMANDA_WARNING_CFLAGS)
 AM_LDFLAGS = $(AMANDA_STATIC_LDFLAGS)
+CHECK_PERL = amtapetype
+SCRIPTS_PERL = $(CHECK_PERL)
+sbin_SCRIPTS = $(SCRIPTS_PERL)
 amlib_LTLIBRARIES = libamdevice.la
 libamdevice_la_LDFLAGS = -release $(VERSION) 
-libamdevice_la_SOURCES = property.c device.c queueing.c semaphore.c \
+libamdevice_la_SOURCES = property.c device.c device-queueing.c \
        null-device.c rait-device.c vfs-device.c $(am__append_1) \
        $(am__append_2) $(am__append_3) $(am__append_4) \
        $(am__append_5) $(am__append_6)
 libamdevice_la_LIBADD = ../common-src/libamanda.la
-@WANT_DEVPAY_TRUE@activate_devpay_SOURCES = activate-devpay.c
-noinst_HEADERS = null-device.h semaphore.h \
-       tape-ops.h property.h rait-device.h s3.h \
-       s3-device.h tape-device.h vfs-device.h \
-       device.h queueing.h
+vfs_test_SOURCES = vfs-test.c
+vfs_test_LDADD = \
+       ../common-src/libtestutils.la \
+       libamdevice.la
+
+@WANT_S3_DEVICE_TRUE@activate_devpay_SOURCES = activate-devpay.c
+noinst_HEADERS = \
+       device-queueing.h \
+       device.h \
+       property.h \
+       s3.h \
+       s3-util.h \
+       tape-device.h \
+       tape-ops.h
 
 aminclude_HEADERS = 
-all: all-recursive
+all: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) all-am
 
 .SUFFIXES:
 .SUFFIXES: .c .lo .o .obj
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(top_srcdir)/config/automake/precompile.am $(am__configure_deps)
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(top_srcdir)/config/automake/vars.am $(top_srcdir)/config/automake/scripts.am $(top_srcdir)/config/automake/precompile.am $(am__configure_deps)
        @for dep in $?; do \
          case '$(am__configure_deps)' in \
            *$$dep*) \
@@ -699,8 +884,8 @@ install-amlibLTLIBRARIES: $(amlib_LTLIBRARIES)
        @list='$(amlib_LTLIBRARIES)'; for p in $$list; do \
          if test -f $$p; then \
            f=$(am__strip_dir) \
-           echo " $(LIBTOOL) --mode=install $(amlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(amlibdir)/$$f'"; \
-           $(LIBTOOL) --mode=install $(amlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(amlibdir)/$$f"; \
+           echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(amlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(amlibdir)/$$f'"; \
+           $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(amlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(amlibdir)/$$f"; \
          else :; fi; \
        done
 
@@ -708,8 +893,8 @@ uninstall-amlibLTLIBRARIES:
        @$(NORMAL_UNINSTALL)
        @list='$(amlib_LTLIBRARIES)'; for p in $$list; do \
          p=$(am__strip_dir) \
-         echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(amlibdir)/$$p'"; \
-         $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(amlibdir)/$$p"; \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(amlibdir)/$$p'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(amlibdir)/$$p"; \
        done
 
 clean-amlibLTLIBRARIES:
@@ -722,6 +907,13 @@ clean-amlibLTLIBRARIES:
        done
 libamdevice.la: $(libamdevice_la_OBJECTS) $(libamdevice_la_DEPENDENCIES) 
        $(libamdevice_la_LINK) -rpath $(amlibdir) $(libamdevice_la_OBJECTS) $(libamdevice_la_LIBADD) $(LIBS)
+
+clean-noinstPROGRAMS:
+       @list='$(noinst_PROGRAMS)'; for p in $$list; do \
+         f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+         echo " rm -f $$p $$f"; \
+         rm -f $$p $$f ; \
+       done
 install-sbinPROGRAMS: $(sbin_PROGRAMS)
        @$(NORMAL_INSTALL)
        test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)"
@@ -731,8 +923,8 @@ install-sbinPROGRAMS: $(sbin_PROGRAMS)
             || test -f $$p1 \
          ; then \
            f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
-          echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \
-          $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(sbindir)/$$f" || exit 1; \
+          echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \
+          $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(sbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(sbindir)/$$f" || exit 1; \
          else :; fi; \
        done
 
@@ -753,6 +945,28 @@ clean-sbinPROGRAMS:
 activate-devpay$(EXEEXT): $(activate_devpay_OBJECTS) $(activate_devpay_DEPENDENCIES) 
        @rm -f activate-devpay$(EXEEXT)
        $(LINK) $(activate_devpay_OBJECTS) $(activate_devpay_LDADD) $(LIBS)
+vfs-test$(EXEEXT): $(vfs_test_OBJECTS) $(vfs_test_DEPENDENCIES) 
+       @rm -f vfs-test$(EXEEXT)
+       $(LINK) $(vfs_test_OBJECTS) $(vfs_test_LDADD) $(LIBS)
+install-sbinSCRIPTS: $(sbin_SCRIPTS)
+       @$(NORMAL_INSTALL)
+       test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)"
+       @list='$(sbin_SCRIPTS)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         if test -f $$d$$p; then \
+           f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+           echo " $(sbinSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(sbindir)/$$f'"; \
+           $(sbinSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(sbindir)/$$f"; \
+         else :; fi; \
+       done
+
+uninstall-sbinSCRIPTS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(sbin_SCRIPTS)'; for p in $$list; do \
+         f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+         echo " rm -f '$(DESTDIR)$(sbindir)/$$f'"; \
+         rm -f "$(DESTDIR)$(sbindir)/$$f"; \
+       done
 
 mostlyclean-compile:
        -rm -f *.$(OBJEXT)
@@ -761,20 +975,21 @@ distclean-compile:
        -rm -f *.tab.c
 
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/activate-devpay.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/device-queueing.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/device.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/null-device.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/property.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/queueing.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rait-device.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s3-device.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s3-util.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s3.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/semaphore.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tape-aix.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tape-device.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tape-posix.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tape-uware.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tape-xenix.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vfs-device.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vfs-test.Po@am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@   $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -820,125 +1035,41 @@ uninstall-amincludeHEADERS:
          rm -f "$(DESTDIR)$(amincludedir)/$$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"
-
-$(RECURSIVE_CLEAN_TARGETS):
-       @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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
        mkid -fID $$unique
 tags: TAGS
 
-TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+TAGS:  $(HEADERS) $(SOURCES)  $(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)  $(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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { 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)  $(TAGS_DEPENDENCIES) \
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
                $(TAGS_FILES) $(LISP)
        tags=; \
-       here=`pwd`; \
        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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
        test -z "$(CTAGS_ARGS)$$tags$$unique" \
          || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
             $$tags $$unique
@@ -951,6 +1082,79 @@ GTAGS:
 distclean-tags:
        -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
+check-TESTS: $(TESTS)
+       @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[        ]'; \
+       srcdir=$(srcdir); export srcdir; \
+       list=' $(TESTS) '; \
+       if test -n "$$list"; then \
+         for tst in $$list; do \
+           if test -f ./$$tst; then dir=./; \
+           elif test -f $$tst; then dir=; \
+           else dir="$(srcdir)/"; fi; \
+           if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+             all=`expr $$all + 1`; \
+             case " $(XFAIL_TESTS) " in \
+             *$$ws$$tst$$ws*) \
+               xpass=`expr $$xpass + 1`; \
+               failed=`expr $$failed + 1`; \
+               echo "XPASS: $$tst"; \
+             ;; \
+             *) \
+               echo "PASS: $$tst"; \
+             ;; \
+             esac; \
+           elif test $$? -ne 77; then \
+             all=`expr $$all + 1`; \
+             case " $(XFAIL_TESTS) " in \
+             *$$ws$$tst$$ws*) \
+               xfail=`expr $$xfail + 1`; \
+               echo "XFAIL: $$tst"; \
+             ;; \
+             *) \
+               failed=`expr $$failed + 1`; \
+               echo "FAIL: $$tst"; \
+             ;; \
+             esac; \
+           else \
+             skip=`expr $$skip + 1`; \
+             echo "SKIP: $$tst"; \
+           fi; \
+         done; \
+         if test "$$failed" -eq 0; then \
+           if test "$$xfail" -eq 0; then \
+             banner="All $$all tests passed"; \
+           else \
+             banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
+           fi; \
+         else \
+           if test "$$xpass" -eq 0; then \
+             banner="$$failed of $$all tests failed"; \
+           else \
+             banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
+           fi; \
+         fi; \
+         dashes="$$banner"; \
+         skipped=""; \
+         if test "$$skip" -ne 0; then \
+           skipped="($$skip tests were not run)"; \
+           test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+             dashes="$$skipped"; \
+         fi; \
+         report=""; \
+         if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+           report="Please report to $(PACKAGE_BUGREPORT)"; \
+           test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+             dashes="$$report"; \
+         fi; \
+         dashes=`echo "$$dashes" | sed s/./=/g`; \
+         echo "$$dashes"; \
+         echo "$$banner"; \
+         test -z "$$skipped" || echo "$$skipped"; \
+         test -z "$$report" || echo "$$report"; \
+         echo "$$dashes"; \
+         test "$$failed" -eq 0; \
+       else :; fi
+
 distdir: $(DISTFILES)
        @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
        topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
@@ -977,136 +1181,221 @@ distdir: $(DISTFILES)
            || 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" \
-               am__remove_distdir=: \
-               am__skip_length_check=: \
-               distdir) \
-             || exit 1; \
-         fi; \
-       done
+       $(MAKE) $(AM_MAKEFLAGS) \
+         top_distdir="$(top_distdir)" distdir="$(distdir)" \
+         dist-hook
 check-am: all-am
-check: check-recursive
-all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS)
-installdirs: installdirs-recursive
-installdirs-am:
-       for dir in "$(DESTDIR)$(amlibdir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(amincludedir)"; do \
+       $(MAKE) $(AM_MAKEFLAGS) check-TESTS check-local
+check: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) $(HEADERS)
+installdirs:
+       for dir in "$(DESTDIR)$(amlibdir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(amincludedir)"; 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: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
 
 install-am: all-am
        @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
 
-installcheck: installcheck-recursive
+installcheck: installcheck-am
 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:
+       -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
 
 clean-generic:
+       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
        -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+       -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
 
 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
+       -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+       -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-am
 
 clean-am: clean-amlibLTLIBRARIES clean-generic clean-libtool \
-       clean-sbinPROGRAMS mostlyclean-am
+       clean-noinstPROGRAMS clean-sbinPROGRAMS mostlyclean-am
 
-distclean: distclean-recursive
+distclean: distclean-am
        -rm -rf ./$(DEPDIR)
        -rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
        distclean-tags
 
-dvi: dvi-recursive
+dvi: dvi-am
 
 dvi-am:
 
-html: html-recursive
+html: html-am
 
-info: info-recursive
+info: info-am
 
 info-am:
 
 install-data-am: install-amincludeHEADERS install-amlibLTLIBRARIES
 
-install-dvi: install-dvi-recursive
+install-dvi: install-dvi-am
 
-install-exec-am: install-sbinPROGRAMS
+install-exec-am: install-sbinPROGRAMS install-sbinSCRIPTS
 
-install-html: install-html-recursive
+install-html: install-html-am
 
-install-info: install-info-recursive
+install-info: install-info-am
 
 install-man:
 
-install-pdf: install-pdf-recursive
+install-pdf: install-pdf-am
 
-install-ps: install-ps-recursive
+install-ps: install-ps-am
 
-installcheck-am:
+installcheck-am: installcheck-local
 
-maintainer-clean: maintainer-clean-recursive
+maintainer-clean: maintainer-clean-am
        -rm -rf ./$(DEPDIR)
        -rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
-mostlyclean: mostlyclean-recursive
+mostlyclean: mostlyclean-am
 
 mostlyclean-am: mostlyclean-compile mostlyclean-generic \
        mostlyclean-libtool
 
-pdf: pdf-recursive
+pdf: pdf-am
 
 pdf-am:
 
-ps: ps-recursive
+ps: ps-am
 
 ps-am:
 
 uninstall-am: uninstall-amincludeHEADERS uninstall-amlibLTLIBRARIES \
-       uninstall-sbinPROGRAMS
+       uninstall-sbinPROGRAMS uninstall-sbinSCRIPTS
 
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
-       install-strip
+.MAKE: install-am install-strip
 
-.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
-       all all-am check check-am clean clean-amlibLTLIBRARIES \
-       clean-generic clean-libtool clean-sbinPROGRAMS ctags \
-       ctags-recursive distclean distclean-compile distclean-generic \
+.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am check-local \
+       clean clean-amlibLTLIBRARIES clean-generic clean-libtool \
+       clean-noinstPROGRAMS clean-sbinPROGRAMS ctags dist-hook \
+       distclean distclean-compile distclean-generic \
        distclean-libtool distclean-tags distdir dvi dvi-am html \
        html-am info info-am install install-am \
        install-amincludeHEADERS install-amlibLTLIBRARIES install-data \
        install-data-am install-dvi install-dvi-am install-exec \
        install-exec-am install-html install-html-am install-info \
        install-info-am install-man install-pdf install-pdf-am \
-       install-ps install-ps-am install-sbinPROGRAMS install-strip \
-       installcheck installcheck-am installdirs installdirs-am \
-       maintainer-clean maintainer-clean-generic mostlyclean \
-       mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
-       pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
-       uninstall-amincludeHEADERS uninstall-amlibLTLIBRARIES \
-       uninstall-sbinPROGRAMS
+       install-ps install-ps-am install-sbinPROGRAMS \
+       install-sbinSCRIPTS install-strip installcheck installcheck-am \
+       installcheck-local installdirs maintainer-clean \
+       maintainer-clean-generic mostlyclean mostlyclean-compile \
+       mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+       tags uninstall uninstall-am uninstall-amincludeHEADERS \
+       uninstall-amlibLTLIBRARIES uninstall-sbinPROGRAMS \
+       uninstall-sbinSCRIPTS
+
+
+# Perl
+%: %.pl $(top_builddir)/config.status
+       $(top_builddir)/config.status --file=$@:$<
+       chmod a+x $@
+       @if test -f $(top_builddir)/perl/.libs/libCmdline.so -o -f $(top_builddir)/perl/libCmdline.so; then \
+               grep -v '^use lib' $@ > $@.nouselib; \
+               $(PERL) $(CHECK_PERL_FLAGS) -I$(top_builddir)/perl -I$(top_builddir)/perl/.libs -I$(top_srcdir)/perl -c -w -T $@.nouselib || exit 1; \
+               rm $@.nouselib; \
+       fi
 
+%.pl: %.pl.in $(top_builddir)/config.status
+       $(top_builddir)/config.status --file=$@:$<
+
+%.pm: %.pm.in $(top_builddir)/config.status
+       $(top_builddir)/config.status --file=$@:$<
+
+# Shell
+%: %.sh $(top_builddir)/config.status
+       $(top_builddir)/config.status --file=$@:$<
+       chmod a+x $@
+
+%.sh: %.sh.in $(top_builddir)/config.status
+       $(top_builddir)/config.status --file=$@:$<
+
+# Awk
+%: %.awk $(top_builddir)/config.status
+       $(top_builddir)/config.status --file=$@:$<
+       chmod a+x $@
+
+%.awk: %.awk.in $(top_builddir)/config.status
+       $(top_builddir)/config.status --file=$@:$<
+
+# syntax-check perl scripts on 'make check'
+check-perl: $(CHECK_PERL)
+       @CHECK_PERL="$(CHECK_PERL)"; \
+       if test -f $(top_builddir)/perl/.libs/libCmdline.so -o -f $(top_builddir)/perl/libCmdline.so; then \
+               if test -n "$(PERL)"; then \
+                       for perlobj in $$CHECK_PERL; do \
+                               grep -v '^use lib' $$perlobj > $$perlobj.nouselib; \
+                               $(PERL) $(CHECK_PERL_FLAGS) -I$(top_builddir)/perl -I$(top_builddir)/perl/.libs -I$(top_srcdir)/perl -c -w -T $$perlobj.nouselib || exit 1; \
+                               rm $$perlobj.nouselib; \
+                       done; \
+               fi \
+       fi
+check-local: check-perl
+
+# syntax-check perl scripts on 'make installcheck'
+installcheck-perl: $(CHECK_PERL)
+       @CHECK_PERL="$(CHECK_PERL)"; \
+       if test -n "$(PERL)"; then \
+               for perlobj in $$CHECK_PERL; do \
+                       $(PERL) $(CHECK_PERL_FLAGS) -c -w -T $$perlobj || exit 1; \
+               done; \
+       fi
+installcheck-local: installcheck-perl
+check-shell: $(CHECK_SHELL)
+       @CHECK_SHELL="$(CHECK_SHELL)"; \
+       if test -n "$$CHECK_SHELL"; then \
+               if test -n "$(BASH)"; then \
+                       for shobj in $$CHECK_SHELL; do \
+                               if $(BASH) -n $$shobj; then \
+                                       echo "$$shobj syntax OK"; \
+                               else \
+                                       echo "$$shobj syntax error"; \
+                                       exit 1; \
+                               fi; \
+                       done; \
+               else \
+                       echo "No 'bash' available -- cannot syntax-check shell scripts"; \
+               fi; \
+       fi
+check-local: check-shell
+
+# make sure that the sources for all shell and perl scripts get included
+# in the distribution
+dist-scripts:
+       SCRIPTS_PERL="$(SCRIPTS_PERL)"; SCRIPTS_SHELL="$(SCRIPTS_SHELL)"; SCRIPTS_AWK="$(SCRIPTS_AWK)"; \
+       for script in $$SCRIPTS_PERL; do \
+               test -f $(srcdir)/$${script}.pl && { cp -p $(srcdir)/$${script}.pl $(distdir)/ || exit 1; } \
+       done; \
+       for script in $$SCRIPTS_SHELL; do \
+               test -f $(srcdir)/$${script}.sh && { cp -p $(srcdir)/$${script}.sh $(distdir)/ || exit 1; } \
+       done; \
+       for script in $$SCRIPTS_AWK; do \
+               test -f $(srcdir)/$${script}.awk && { cp -p $(srcdir)/$${script}.awk $(distdir)/ || exit 1; } \
+       done; \
+       for script in $$SCRIPTS_SHELL $$SCRIPTS_PERL $$SCRIPTS_AWK; do \
+               test -f $(srcdir)/$${script}.in && { cp -p $(srcdir)/$${script}.in $(distdir)/ || exit 1; } \
+       done; \
+       true
+dist-hook: dist-scripts
 
 # A rule to make precompiler output from C files.  This is not used during
 # ordinary builds, but but can very useful in debugging problems on strange
index 196834d6cf03b1f20e32b8886ea7bd24bfa58faf..9563071d70d78fd10e3fd4a4697b8c779b24dc99 100644 (file)
 #include "base64.h"
 #include "s3.h"
 
-#ifndef WANT_DEVPAY
-# error activate_devpay only works if devpay is enabled.
-#endif
-
 #define MAX_RESPONSE_SIZE (1024*1024)
 
 typedef struct {
@@ -147,7 +143,7 @@ static void parser_got_text(GMarkupParseContext * context,
             /* Do nothing; wait for the message. */
         }
     } else if (g_strrstr(current_tag, "Message")) {
-        g_set_error(error, G_MARKUP_ERROR, -1, "%.*s", text_len, text);
+        g_set_error(error, G_MARKUP_ERROR, -1, "%.*s", (int)text_len, text);
     }
 }               
 
diff --git a/device-src/amtapetype.pl b/device-src/amtapetype.pl
new file mode 100644 (file)
index 0000000..299bd77
--- /dev/null
@@ -0,0 +1,399 @@
+#! @PERL@
+# Copyright (c) 2008 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+# This is a tool to examine a device and generate a reasonable tapetype
+# entry accordingly.
+
+use lib '@amperldir@';
+use strict;
+
+use File::Basename;
+use Getopt::Long;
+use Math::BigInt;
+use Amanda::BigIntCompat;
+
+use Amanda::Device qw( :constants );
+use Amanda::Debug qw( :logging );
+use Amanda::Util qw( :constants );
+use Amanda::Config qw( :init :getconf config_dir_relative );
+use Amanda::MainLoop;
+use Amanda::Xfer;
+use Amanda::Constants;
+use Amanda::Types;
+
+# command-line options
+my $opt_only_compression = 0;
+my $opt_blocksize;
+my $opt_tapetype_name = 'unknown-tapetype';
+my $opt_force = 0;
+my $opt_label = "amtapetype-".(int rand 2**31);
+my $opt_device_name;
+
+# global "hint" from the compression heuristic as to how fast this
+# drive is.
+my $device_speed_estimate;
+
+# open up a device, optionally check its label, and start it in ACCESS_WRITE.
+sub open_device {
+    my $device = Amanda::Device->new($opt_device_name);
+    if ($device->status() != $DEVICE_STATUS_SUCCESS) {
+       die("Could not open device $opt_device_name: ".$device->error()."\n");
+    }
+
+    if (defined $opt_blocksize) {
+       $device->property_set('BLOCK_SIZE', $opt_blocksize)
+           or die "Error setting blocksize: " . $device->error_or_status();
+    }
+
+    if (!$opt_force) {
+       my $read_label_status = $device->read_label();
+       if ($read_label_status & $DEVICE_STATUS_VOLUME_UNLABELED) {
+           if ($device->volume_label) {
+               die "Volume in device $opt_device_name has Amanda label '" .
+                   {$device->volume_label} . "'. Giving up.";
+           }
+       } elsif ($read_label_status != $DEVICE_STATUS_SUCCESS) {
+           die "Error reading label: " . $device->error_or_status();
+       }
+    }
+
+    return $device;
+}
+
+sub start_device {
+    my ($device) = @_;
+
+    if (!$device->start($ACCESS_WRITE, $opt_label, undef)) {
+       die("Error writing label '$opt_label': ". $device->error_or_status());
+    }
+
+    return $device;
+}
+
+# Write a single file to the device, and record the results in STATS.
+# write_one_file(
+#   STATS => $stats_hashref,   (see below)
+#   DEVICE => $dev,            (device to write to)
+#   PATTERN => RANDOM or FIXED, (data pattern to write)
+#   BYTES => nn,               (number of bytes; optional)
+#   MAX_TIME => secs);         (cancel write after this time; optional)
+#
+# Returns 0 on success (including EOM), "TIMEOUT" on timeout, or an error message
+# on failure.
+#
+# STATS is a multi-level hashref; write_one_file adds to any values
+# already in the data structure.
+#   $stats->{$pattern}->{TIME} - number of seconds spent writing
+#   $stats->{$pattern}->{FILES} - number of files written
+#   $stats->{$pattern}->{BYTES} - number of bytes written (approximate)
+#
+sub write_one_file(%) {
+    my %options = @_;
+    my $stats = $options{'STATS'} || { };
+    my $device = $options{'DEVICE'};
+    my $bytes = $options{'MAX_BYTES'} || 0;
+    my $pattern = $options{'PATTERN'} || 'FIXED';
+    my $max_time = $options{'MAX_TIME'} || 0;
+
+    # start the device
+    my $hdr = Amanda::Types::dumpfile_t->new();
+    $hdr->{type} = $Amanda::Types::F_DUMPFILE;
+    $hdr->{name} = "amtapetype";
+    $hdr->{disk} = "/test";
+    $hdr->{datestamp} = "X";
+    $device->start_file($hdr)
+       or return $device->error_or_status();
+
+    # set up the transfer
+    my ($source, $dest, $xfer);
+    if ($pattern eq 'FIXED') {
+       # a simple 256-byte pattern to dodge run length encoding.
+       my $non_random_pattern = pack("C*", 0..255);
+       $source = Amanda::Xfer::Source::Pattern->new($bytes, $non_random_pattern);
+    } elsif ($pattern eq 'RANDOM') {
+       $source = Amanda::Xfer::Source::Random->new($bytes, 1 + int rand 100);
+    } else {
+       die "Unknown PATTERN $pattern";
+    }
+    $dest = Amanda::Xfer::Dest::Device->new($device, 0);
+    $xfer = Amanda::Xfer->new([$source, $dest]);
+
+    # set up the relevant callbacks
+    my ($timeout_src, $xfer_src, $spinner_src);
+    my $got_error = 0;
+    my $got_timeout = 0;
+
+    $xfer_src = $xfer->get_source();
+    $xfer_src->set_callback(sub {
+       my ($src, $xmsg, $xfer) = @_;
+       if ($xmsg->{type} == $Amanda::Xfer::XMSG_ERROR) {
+           $got_error = $xmsg->{message};
+       }
+       if ($xfer->get_status() == $Amanda::Xfer::XFER_DONE) {
+           Amanda::MainLoop::quit();
+       }
+    });
+
+    if ($max_time) {
+       $timeout_src = Amanda::MainLoop::timeout_source($max_time * 1000);
+       $timeout_src->set_callback(sub {
+           my ($src) = @_;
+           $got_timeout = 1;
+           $xfer->cancel(); # will result in an XFER_DONE
+       });
+    }
+
+    $spinner_src = Amanda::MainLoop::timeout_source(1000);
+    $spinner_src->set_callback(sub {
+       my ($src) = @_;
+       my ($file, $block) = ($device->file(), $device->block());
+       print STDERR "File $file, block $block    \r";
+    });
+
+    my $start_time = time();
+
+    $xfer->start();
+    Amanda::MainLoop::run();
+    $xfer_src->remove();
+    $spinner_src->remove();
+    $timeout_src->remove() if ($timeout_src);
+    print STDERR " " x 60, "\r";
+
+    my $duration = time() - $start_time;
+
+    # OK, we finished, update statistics (even if we saw an error)
+    my $blocks_written = $device->block();
+    my $block_size = $device->property_get("block_size");
+    $stats->{$pattern}->{BYTES} += $blocks_written * $block_size;
+    $stats->{$pattern}->{FILES} += 1;
+    $stats->{$pattern}->{TIME}  += $duration;
+
+    if ($device->status() != $Amanda::Device::DEVICE_STATUS_SUCCESS) {
+       return $device->error_or_status();
+    }
+
+    if ($got_error) {
+       return $got_error;
+    }
+
+    if ($got_timeout) {
+       return "TIMEOUT";
+    }
+
+    return 0;
+}
+
+sub check_compression {
+    my ($device) = @_;
+
+    # Check compression status here by property query. If the device can answer
+    # the question, there's no reason to investigate further.
+    my $compression_enabled = $device->property_get("compression");
+
+    if (defined $compression_enabled) {
+       return $compression_enabled;
+    }
+
+    # Need to use heuristic to find out if compression is enabled.  Also, we
+    # rewind between passes so that the second pass doesn't get some kind of
+    # buffering advantage.
+
+    print STDERR "Applying heuristic check for compression.\n";
+
+    # We base our determination on whether it's faster to write random data or
+    # patterned data.  That starts by writing random data for a short length of
+    # time, then measuring the elapsed time and total data written.  Due to
+    # potential delay in cancelling a transfer, the elapsed time will be a bit
+    # longer than the intended time.   We then write the same amount of
+    # patterned data, and again measure the elapsed time.  We can then
+    # calculate the speeds of the two operations.  If the compressible speed
+    # was faster by more than min_ratio, then we assume compression is enabled.
+
+    my $compression_check_time = 60;
+    my $compression_check_min_ratio = 1.2;
+
+    my $stats = { };
+
+    start_device($device);
+
+    my $err = write_one_file(
+                   DEVICE => $device,
+                   STATS => $stats,
+                   MAX_TIME => $compression_check_time,
+                   PATTERN => 'RANDOM');
+
+    if ($err != 'TIMEOUT') {
+       die $err;
+    }
+
+    # restart the device to rewind it
+    start_device($device);
+
+    $err = write_one_file(
+                   DEVICE => $device,
+                   STATS => $stats,
+                   MAX_BYTES => $stats->{'RANDOM'}->{'BYTES'},
+                   PATTERN => 'FIXED');
+    if ($err) {
+       die $err;
+    }
+
+    # speed calculations are a little tricky: BigInt * float comes out to NaN, so we
+    # cast the BigInts to float first
+    my $random_speed = ($stats->{RANDOM}->{BYTES} . "") / $stats->{RANDOM}->{TIME};
+    my $fixed_speed = ($stats->{FIXED}->{BYTES} . "") / $stats->{FIXED}->{TIME};
+
+    print STDERR "Wrote random (uncompressible) data at $random_speed bytes/sec\n";
+    print STDERR "Wrote fixed (compressible) data at $fixed_speed bytes/sec\n";
+
+    # sock this away for make_tapetype's use
+    $device_speed_estimate = $random_speed;
+
+    $compression_enabled =
+       ($fixed_speed / $random_speed > $compression_check_min_ratio);
+    return $compression_enabled;
+}
+
+sub make_tapetype {
+    my ($device, $compression_enabled) = @_;
+    my $blocksize = $device->property_get("BLOCK_SIZE");
+
+    # First, write one very long file to get the total tape length
+    print STDERR "Writing one file to fill the volume.\n";
+    my $stats = {};
+    start_device($device);
+    my $err = write_one_file(
+               DEVICE => $device,
+               STATS => $stats,
+               PATTERN => 'RANDOM');
+
+    if ($stats->{RANDOM}->{BYTES} < 1024 * 1024 * 100) {
+       die "Wrote less than 100MB to the device: $err\n";
+    }
+    my $volume_size_estimate = $stats->{RANDOM}->{BYTES};
+    my $speed_estimate = (($stats->{RANDOM}->{BYTES}."") / 1024)
+                       / $stats->{RANDOM}->{TIME};
+    $speed_estimate = int $speed_estimate;
+    print STDERR "Wrote $volume_size_estimate bytes at $speed_estimate kb/sec\n";
+
+    # now we want to write about 100 filemarks; round down to the blocksize
+    # to avoid counting padding as part of the filemark
+    my $file_size = $volume_size_estimate / 100;
+    $file_size -= $file_size % $blocksize;
+
+    print STDERR "Writing smaller files ($file_size bytes) to determine filemark.\n";
+    $stats = {};
+    start_device($device);
+    while (!write_one_file(
+                       DEVICE => $device,
+                       STATS => $stats,
+                       MAX_BYTES => $file_size,
+                       PATTERN => 'RANDOM')) { }
+
+    my $filemark_estimate = ($volume_size_estimate - $stats->{RANDOM}->{BYTES})
+                         / ($stats->{RANDOM}->{FILES} - 1);
+    if ($filemark_estimate < 0) {
+       $filemark_estimate = 0;
+    }
+
+    my $comment = "Created by amtapetype; compression "
+       . ($compression_enabled? "enabled" : "disabled");
+
+    print <<EOF;
+    define tapetype $opt_tapetype_name {
+       comment "$comment"
+       length $volume_size_estimate bytes
+       filemark $filemark_estimate bytes
+       speed $speed_estimate kps
+       blocksize $blocksize bytes
+    }
+EOF
+}
+
+sub usage {
+    print STDERR <<EOF;
+Usage: amtapetype [-h] [-c] [-f] [-b blocksize] [-t typename] [-l label]
+                 [ [-o config_overwrite] ... ] device
+        -h   Display this message
+        -c   Only check hardware compression state
+        -f   Run amtapetype even if the loaded volume is already in use
+             or compression is enabled.
+        -b   Blocksize to use (default 32k)
+        -t   Name to give to the new tapetype definition
+        -l   Label to write to the tape (default is randomly generated)
+        -o   Overwrite configuration parameter (such as device properties)
+    Blocksize can include an optional suffix (k, m, or g)
+EOF
+    exit(1);
+}
+
+## Application initialization
+
+Amanda::Util::setup_application("amtapetype", "server", $CONTEXT_CMDLINE);
+config_init(0, undef);
+
+my $config_overwrites = new_config_overwrites($#ARGV+1);
+
+Getopt::Long::Configure(qw(bundling));
+GetOptions(
+    'help|usage|?|h' => \&usage,
+    'c' => \$opt_only_compression,
+    'b=s' => sub {
+       my ($num, $suff) = ($_[1] =~ /^([0-9]+)\s*(.*)$/);
+       die "Invalid blocksize '$_[1]'" unless (defined $num);
+       my $mult = (defined $suff)?
+           Amanda::Config::find_multiplier($suff) : 1;
+       die "Invalid suffix '$suff'" unless ($mult);
+       $opt_blocksize = $num * $mult;
+    },
+    't=s' => \$opt_tapetype_name,
+    'f' => \$opt_force,
+    'l' => \$opt_label,
+    'o=s' => sub { add_config_overwrite_opt($config_overwrites, $_[1]); },
+) or usage();
+usage() if (@ARGV != 1);
+
+$opt_device_name= shift @ARGV;
+
+apply_config_overwrites($config_overwrites);
+my ($cfgerr_level, @cfgerr_errors) = config_errors();
+if ($cfgerr_level >= $CFGERR_WARNINGS) {
+    config_print_errors();
+    if ($cfgerr_level >= $CFGERR_ERRORS) {
+       die("errors processing configuration options");
+    }
+}
+
+Amanda::Util::finish_setup($RUNNING_AS_ANY);
+
+my $device = open_device();
+
+my $compression_enabled = check_compression($device);
+print STDERR "Compression: ",
+    $compression_enabled? "enabled" : "disabled",
+    "\n";
+
+if ($compression_enabled and !$opt_force) {
+    print STDERR "Turn off compression or run amtapetype with the -f option\n";
+    exit(1);
+}
+
+if (!$opt_only_compression) {
+    make_tapetype($device, $compression_enabled);
+}
diff --git a/device-src/device-queueing.c b/device-src/device-queueing.c
new file mode 100644 (file)
index 0000000..7582c1b
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2005-2008 Zmanda, Inc.  All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License version 2.1 as
+ * published by the Free Software Foundation.
+ *
+ * This 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 this library; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+ *
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+ */
+
+#include "amanda.h"
+#include "device-queueing.h"
+#include "device.h"
+
+producer_result_t device_read_producer(gpointer devicep,
+                                       queue_buffer_t *buffer,
+                                       size_t hint_size G_GNUC_UNUSED) {
+    Device* device;
+
+    device = (Device*) devicep;
+    g_assert(IS_DEVICE(device));
+
+    buffer->offset = 0;
+    for (;;) {
+        int result, read_size;
+        read_size = buffer->alloc_size;
+        result = device_read_block(device, buffer->data, &read_size);
+        if (result > 0) {
+            buffer->data_size = read_size;
+            return PRODUCER_MORE;
+        } else if (result == 0) {
+           /* unfortunately, the best "memory" we have of needing a larger
+            * block size is the next time this buffer comes around, and even
+            * this is incomplete as buffers may be resized periodically.  So
+            * we'll end up calling read_block with small buffers more often
+            * than strictly necessary. */
+            buffer->data = realloc(buffer->data, read_size);
+            buffer->alloc_size = read_size;
+        } else if (device->is_eof) {
+            return PRODUCER_FINISHED;
+        } else {
+            buffer->data_size = 0;
+            return PRODUCER_ERROR;
+        }
+    }
+}
+
+ssize_t device_write_consumer(gpointer devicep, queue_buffer_t *buffer) {
+    Device* device;
+    size_t write_size;
+    gsize block_size;
+
+    device = DEVICE(devicep);
+
+    block_size = device->block_size;
+    write_size = MIN(buffer->data_size, block_size);
+
+    /* we assume that the queueing module is providing us with
+     * appropriately-sized blocks until the last block. */
+    if (device_write_block(device, write_size,
+                           buffer->data + buffer->offset)) {
+        /* Success! */
+        return write_size;
+    } else {
+        /* Nope, really an error. */
+        return -1;
+    }
+}
+
diff --git a/device-src/device-queueing.h b/device-src/device-queueing.h
new file mode 100644 (file)
index 0000000..75d54db
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2005-2008 Zmanda, Inc.  All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License version 2.1 as 
+ * published by the Free Software Foundation.
+ *
+ * This 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 this library; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+ *
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+ */
+
+#ifndef DEVICE_QUEUEING_H
+#define DEVICE_QUEUEING_H
+
+/* some utilities for using queueing with device */
+
+#include "queueing.h"
+
+/* These functions will call device_read_block and device_write_block
+ * respectively. The user data should be a Device*.
+ *
+ * device_write_consumer assumes that the block_size passed to
+ * do_consumer_producer_queue_full is at least device->block_size();
+ * do_consumer_thread() will not pass a buffer of less than block_size
+ * to the consumer unless it has received EOF from the producer thread.
+ *
+ * Similarly, device_read_producer works similarly, but will expand its
+ * buffers if the device encounters larger blocks - this is Amanda's
+ * ability to read volumes written with larger block sizes.
+ */
+producer_result_t device_read_producer(gpointer device,
+                                       queue_buffer_t *buffer,
+                                       size_t hint_size);
+ssize_t device_write_consumer(gpointer device, queue_buffer_t *buffer);
+
+#endif /* DEVICE_QUEUEING_H */
index 001db2ac08ed2102c9a98be8979232b3d8ec7789..ddb357cc8acf468262c3d2f5abd39cc917255689 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+ * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
  * 
  * This library is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License version 2.1 as 
@@ -14,8 +14,8 @@
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  * 
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 /* The Device API abstracts device workings, interaction, properties, and
 
 #include "device.h"
 #include "queueing.h"
+#include "device-queueing.h"
 #include "property.h"
 
-#include "null-device.h"
 #include "timestamp.h"
-#include "vfs-device.h"
 #include "util.h"
-#ifdef WANT_TAPE_DEVICE
-#include "tape-device.h"
-#endif
-#include "rait-device.h"
+
+/*
+ * Prototypes for subclass registration functions
+ */
+
+void    null_device_register    (void);
+void   rait_device_register    (void);
 #ifdef WANT_S3_DEVICE
-  #include "s3-device.h"
+void    s3_device_register    (void);
+#endif
+#ifdef WANT_TAPE_DEVICE
+void    tape_device_register    (void);
 #endif
+void    vfs_device_register     (void);
+
+/*
+ * Registration infrastructure
+ */
 
 static GHashTable* driverList = NULL;
 
 void device_api_init(void) {
-    g_type_init();
-    amanda_thread_init();
+    glib_init();
     device_property_init();
     driverList = g_hash_table_new(g_str_hash, g_str_equal);
 
@@ -63,9 +72,13 @@ void device_api_init(void) {
 #endif
 }
 
-void register_device(DeviceFactory factory,
-                     const char ** device_prefix_list) {
+void
+register_device(
+    DeviceFactory factory,
+    const char ** device_prefix_list)
+{
     char ** tmp;
+
     g_assert(driverList != NULL);
     g_assert(factory != NULL);
     g_return_if_fail(device_prefix_list != NULL);
@@ -78,44 +91,44 @@ void register_device(DeviceFactory factory,
     }
 }
 
-static DeviceFactory lookup_device_factory(const char *device_name) {
+static DeviceFactory lookup_device_factory(const char *device_type) {
     gpointer key, value;
     g_assert(driverList != NULL);
 
-    if (g_hash_table_lookup_extended(driverList, device_name, &key, &value)) {
+    if (g_hash_table_lookup_extended(driverList, device_type, &key, &value)) {
         return (DeviceFactory)value;
     } else {
         return NULL;
     }
 }
 
-static const GFlagsValue read_label_status_flags_values[] = {
-    { READ_LABEL_STATUS_SUCCESS,
-      "READ_LABEL_STATUS_SUCCESS",
+static const GFlagsValue device_status_flags_values[] = {
+    { DEVICE_STATUS_SUCCESS,
+      "DEVICE_STATUS_SUCCESS",
       "Success" },
-    { READ_LABEL_STATUS_DEVICE_MISSING,
-      "READ_LABEL_STATUS_DEVICE_MISSING",
-      "Device not found" },
-    { READ_LABEL_STATUS_DEVICE_ERROR,
-      "READ_LABEL_STATUS_DEVICE_ERROR",
+    { DEVICE_STATUS_DEVICE_ERROR,
+      "DEVICE_STATUS_DEVICE_ERROR",
       "Device error" },
-    { READ_LABEL_STATUS_VOLUME_MISSING,
-      "READ_LABEL_STATUS_VOLUME_MISSING",
+    { DEVICE_STATUS_DEVICE_BUSY,
+      "DEVICE_STATUS_DEVICE_BUSY",
+      "Device busy" },
+    { DEVICE_STATUS_VOLUME_MISSING,
+      "DEVICE_STATUS_VOLUME_MISSING",
       "Volume not found" },
-    { READ_LABEL_STATUS_VOLUME_UNLABELED,
-      "READ_LABEL_STATUS_VOLUME_UNLABELED",
+    { DEVICE_STATUS_VOLUME_UNLABELED,
+      "DEVICE_STATUS_VOLUME_UNLABELED",
       "Volume not labeled" },
-    { READ_LABEL_STATUS_VOLUME_ERROR,
-      "READ_LABEL_STATUS_VOLUME_ERROR",
+    { DEVICE_STATUS_VOLUME_ERROR,
+      "DEVICE_STATUS_VOLUME_ERROR",
       "Volume error" },
     { 0, NULL, NULL }
 };
 
-GType read_label_status_flags_get_type(void) {
+GType device_status_flags_get_type(void) {
     static GType type = 0;
     if (G_UNLIKELY(type == 0)) {
-        type = g_flags_register_static("ReadLabelStatusFlags",
-                                       read_label_status_flags_values);
+        type = g_flags_register_static("DeviceStatusFlags",
+                                       device_status_flags_values);
     }
     return type;
 }
@@ -123,43 +136,76 @@ GType read_label_status_flags_get_type(void) {
 /* Device class definition starts here. */
 
 struct DevicePrivate_s {
-    /* This is the return value of the device_get_property_list()
-       method. */
-    GArray *property_list;
-    GHashTable * property_response;
+    /* hash table mapping ID to SimpleProperty object */
+    GHashTable * simple_properties;
+
+    /* In writing mode, after a short block is written, no additional blocks
+     * are allowed the file is finished and a new file started. This is only
+     * used for assertions. */
+    gboolean wrote_short_block;
+
+    /* Holds an error message if the function returned an error. */
+    char * errmsg;
+
+    /* temporary holding place for device_status_error() */
+    char * statusmsg;
+    DeviceStatusFlags last_status;
 };
 
 /* This holds the default response to a particular property. */
 typedef struct {
-    PropertyAccessFlags access;
+    DeviceProperty *prop;
     GValue response;
-} PropertyResponse;
+    PropertySurety surety;
+    PropertySource source;
+} SimpleProperty;
 
 #define selfp (self->private)
 
 /* here are local prototypes, so we can make function pointers. */
-static void device_init (Device * o) G_GNUC_UNUSED;
-static void device_class_init (DeviceClass * c) G_GNUC_UNUSED;
-
-static void property_response_free(PropertyResponse *o);
-
-static gboolean default_device_open_device(Device * self, char * device_name);
-static gboolean default_device_finish(Device * self);
-static gboolean default_device_start(Device * self, DeviceAccessMode mode,
-                                     char * label, char * timestamp);
-static gboolean default_device_start_file (Device * self,
-                                           const dumpfile_t * jobinfo);
-static gboolean default_device_write_block (Device * self, guint size,
-                                            gpointer data, gboolean last);
-static gboolean default_device_write_from_fd(Device *self, int fd);
-static gboolean default_device_finish_file (Device * self);
-static dumpfile_t* default_device_seek_file (Device * self, guint file);
-static gboolean default_device_seek_block (Device * self, guint64 block);
-static int default_device_read_block (Device * self, gpointer buffer,
-                                      int * size);
-static gboolean default_device_read_to_fd(Device *self, int fd);
-static gboolean default_device_property_get(Device * self, DevicePropertyId ID,
-                                            GValue * value);
+static void device_init (Device * o);
+static void device_class_init (DeviceClass * c);
+static void device_base_init (DeviceClass * c);
+
+static void simple_property_free(SimpleProperty *o);
+
+static void default_device_open_device(Device * self, char * device_name,
+                                   char * device_type, char * device_node);
+static gboolean default_device_configure(Device *self, gboolean use_global_config);
+static gboolean default_device_write_from_fd(Device *self,
+                                            queue_fd_t *queue_fd);
+static gboolean default_device_read_to_fd(Device *self, queue_fd_t *queue_fd);
+static gboolean default_device_property_get_ex(Device * self, DevicePropertyId id,
+                                              GValue * val,
+                                              PropertySurety *surety,
+                                              PropertySource *source);
+static gboolean default_device_property_set_ex(Device *self,
+                                              DevicePropertyId id,
+                                              GValue * val,
+                                              PropertySurety surety,
+                                              PropertySource source);
+static void set_properties_from_global_config(Device * device);
+static void set_properties_from_device_config(Device * device, device_config_t *dc);
+
+static gboolean property_get_block_size_fn(Device *self,
+    DevicePropertyBase *base, GValue *val,
+    PropertySurety *surety, PropertySource *source);
+
+static gboolean property_set_block_size_fn(Device *self,
+    DevicePropertyBase *base, GValue *val,
+    PropertySurety surety, PropertySource source);
+
+static gboolean property_get_min_block_size_fn(Device *self,
+    DevicePropertyBase *base, GValue *val,
+    PropertySurety *surety, PropertySource *source);
+
+static gboolean property_get_max_block_size_fn(Device *self,
+    DevicePropertyBase *base, GValue *val,
+    PropertySurety *surety, PropertySource *source);
+
+static gboolean property_get_canonical_name_fn(Device *self,
+    DevicePropertyBase *base, GValue *val,
+    PropertySurety *surety, PropertySource *source);
 
 /* pointer to the class of our parent */
 static GObjectClass *parent_class = NULL;
@@ -168,11 +214,11 @@ GType
 device_get_type (void)
 {
     static GType type = 0;
-    
+
     if G_UNLIKELY(type == 0) {
         static const GTypeInfo info = {
             sizeof (DeviceClass),
-            (GBaseInitFunc) NULL,
+            (GBaseInitFunc) device_base_init,
             (GBaseFinalizeFunc) NULL,
             (GClassInitFunc) device_class_init,
             (GClassFinalizeFunc) NULL,
@@ -204,13 +250,15 @@ static void device_finalize(GObject *obj_self) {
     amfree(self->device_name);
     amfree(self->volume_label);
     amfree(self->volume_time);
-    g_array_free(selfp->property_list, TRUE);
-    g_hash_table_destroy(selfp->property_response);
+    amfree(self->volume_header);
+    amfree(selfp->errmsg);
+    amfree(selfp->statusmsg);
+    g_hash_table_destroy(selfp->simple_properties);
     amfree(self->private);
 }
 
 static void 
-device_init (Device * self G_GNUC_UNUSED)
+device_init (Device * self)
 {
     self->private = malloc(sizeof(DevicePrivate));
     self->device_name = NULL;
@@ -221,40 +269,92 @@ device_init (Device * self G_GNUC_UNUSED)
     self->in_file = FALSE;
     self->volume_label = NULL;
     self->volume_time = NULL;
-    selfp->property_list = g_array_new(TRUE, FALSE, sizeof(DeviceProperty));
-    selfp->property_response =
+    self->status = DEVICE_STATUS_SUCCESS;
+    self->min_block_size = 1;
+    self->max_block_size = SIZE_MAX; /* subclasses *really* should choose something smaller */
+    self->block_size = DISK_BLOCK_BYTES;
+    selfp->errmsg = NULL;
+    selfp->statusmsg = NULL;
+    selfp->last_status = 0;
+    selfp->simple_properties =
         g_hash_table_new_full(g_direct_hash,
                               g_direct_equal,
                               NULL,
-                              (GDestroyNotify) property_response_free);
+                              (GDestroyNotify) simple_property_free);
 }
 
 static void 
-device_class_init (DeviceClass * c G_GNUC_UNUSED)
+device_class_init (DeviceClass * device_class)
 {
-    GObjectClass *g_object_class G_GNUC_UNUSED = (GObjectClass*) c;
+    GObjectClass *g_object_class = (GObjectClass*) device_class;
     
     parent_class = g_type_class_ref (G_TYPE_OBJECT);
     
-    c->open_device = default_device_open_device;
-    c->finish = default_device_finish;
-    c->read_label = NULL;
-    c->start = default_device_start;
-    c->start_file = default_device_start_file;
-    c->write_block = default_device_write_block;
-    c->write_from_fd = default_device_write_from_fd;
-    c->finish_file = default_device_finish_file;
-    c->seek_file = default_device_seek_file;
-    c->seek_block = default_device_seek_block;
-    c->read_block = default_device_read_block;
-    c->read_to_fd = default_device_read_to_fd;
-    c->property_get = default_device_property_get;
-    c->property_set = NULL;
-    c->recycle_file = NULL;
+    device_class->open_device = default_device_open_device;
+    device_class->configure = default_device_configure;
+    device_class->write_from_fd = default_device_write_from_fd;
+    device_class->read_to_fd = default_device_read_to_fd;
+    device_class->property_get_ex = default_device_property_get_ex;
+    device_class->property_set_ex = default_device_property_set_ex;
     g_object_class->finalize = device_finalize;
 }
 
-static void property_response_free(PropertyResponse * resp) {
+static void
+device_base_init (DeviceClass * device_class)
+{
+    /* The base_init function is called once each time a child class is
+     * created, before the class_init functions (even our own) are called.  */
+
+    device_class->class_properties = g_array_new(FALSE, TRUE, sizeof(DeviceProperty));
+    device_class->class_properties_list = NULL;
+
+    device_class_register_property(device_class, PROPERTY_BLOCK_SIZE,
+           PROPERTY_ACCESS_GET_MASK | PROPERTY_ACCESS_SET_BEFORE_START,
+           property_get_block_size_fn,
+           property_set_block_size_fn);
+
+    device_class_register_property(device_class, PROPERTY_MIN_BLOCK_SIZE,
+           PROPERTY_ACCESS_GET_MASK,
+           property_get_min_block_size_fn,
+           NULL);
+
+    device_class_register_property(device_class, PROPERTY_MAX_BLOCK_SIZE,
+           PROPERTY_ACCESS_GET_MASK,
+           property_get_max_block_size_fn,
+           NULL);
+
+    device_class_register_property(device_class, PROPERTY_CANONICAL_NAME,
+           PROPERTY_ACCESS_GET_MASK,
+           property_get_canonical_name_fn,
+           NULL);
+
+    device_class_register_property(device_class, PROPERTY_CONCURRENCY,
+           PROPERTY_ACCESS_GET_MASK,
+           device_simple_property_get_fn,
+           device_simple_property_set_fn);
+
+    device_class_register_property(device_class, PROPERTY_STREAMING,
+           PROPERTY_ACCESS_GET_MASK,
+           device_simple_property_get_fn,
+           device_simple_property_set_fn);
+
+    device_class_register_property(device_class, PROPERTY_APPENDABLE,
+           PROPERTY_ACCESS_GET_MASK,
+           device_simple_property_get_fn,
+           device_simple_property_set_fn);
+
+    device_class_register_property(device_class, PROPERTY_PARTIAL_DELETION,
+           PROPERTY_ACCESS_GET_MASK,
+           device_simple_property_get_fn,
+           device_simple_property_set_fn);
+
+    device_class_register_property(device_class, PROPERTY_MEDIUM_ACCESS_TYPE,
+           PROPERTY_ACCESS_GET_MASK,
+           device_simple_property_get_fn,
+           device_simple_property_set_fn);
+}
+
+static void simple_property_free(SimpleProperty * resp) {
     g_value_unset(&(resp->response));
     amfree(resp);
 }
@@ -273,7 +373,7 @@ regex_message(int result, regex_t *regex) {
 
 static gboolean
 handle_device_regex(const char * user_name, char ** driver_name,
-                    char ** device) {
+                    char ** device, char **errmsg) {
     regex_t regex;
     int reg_result;
     regmatch_t pmatch[3];
@@ -284,28 +384,31 @@ handle_device_regex(const char * user_name, char ** driver_name,
     reg_result = regcomp(&regex, regex_string, REG_EXTENDED | REG_ICASE);
     if (reg_result != 0) {
         char * message = regex_message(reg_result, &regex);
-        g_fprintf(stderr, "Error compiling regular expression \"%s\": %s\n",
-               regex_string, message);
-        amfree(message);
+       *errmsg = newvstrallocf(*errmsg, "Error compiling regular expression \"%s\": %s\n",
+                             regex_string, message);
+       amfree(message);
         return FALSE;
     }
 
     reg_result = regexec(&regex, user_name, 3, pmatch, 0);
     if (reg_result != 0 && reg_result != REG_NOMATCH) {
         char * message = regex_message(reg_result, &regex);
-        g_fprintf(stderr, "Error applying regular expression \"%s\" to string \"%s\":\n"
-               "%s\n", user_name, regex_string, message);
+       *errmsg = newvstrallocf(*errmsg,
+                       "Error applying regular expression \"%s\" to string \"%s\": %s\n",
+                       user_name, regex_string, message);
+       amfree(message);
         regfree(&regex);
         return FALSE;
     } else if (reg_result == REG_NOMATCH) {
 #ifdef WANT_TAPE_DEVICE
-        g_fprintf(stderr, "\"%s\" uses deprecated device naming convention; \n"
+       g_warning(
+               "\"%s\" uses deprecated device naming convention; \n"
                 "using \"tape:%s\" instead.\n",
                 user_name, user_name);
         *driver_name = stralloc("tape");
         *device = stralloc(user_name);
 #else /* !WANT_TAPE_DEVICE */
-        g_fprintf(stderr, "\"%s\" is not a valid device name.\n", user_name);
+       errmsg = newvstrallocf(errmsg, "\"%s\" is not a valid device name.\n", user_name);
        regfree(&regex);
        return FALSE;
 #endif /* WANT_TAPE_DEVICE */
@@ -317,168 +420,202 @@ handle_device_regex(const char * user_name, char ** driver_name,
     return TRUE;
 }
 
+/* helper function for device_open */
+static Device *
+make_null_error(char *errmsg, DeviceStatusFlags status)
+{
+    DeviceFactory factory;
+    Device *device;
+
+    factory = lookup_device_factory("null");
+    g_assert(factory != NULL);
+
+    device = factory("null:", "null", "");
+    device_set_error(device, errmsg, status);
+
+    return device;
+}
+
 Device* 
 device_open (char * device_name)
 {
-    char *device_driver_name = NULL;
-    char *device_node_name = NULL;
+    char *device_type = NULL;
+    char *device_node = NULL;
+    char *errmsg = NULL;
+    char *unaliased_name = NULL;
     DeviceFactory factory;
     Device *device;
+    device_config_t *dc;
 
-    g_return_val_if_fail (device_name != NULL, NULL);
+    g_assert(device_name != NULL);
 
     if (driverList == NULL) {
-        g_log(G_LOG_DOMAIN, G_LOG_LEVEL_ERROR,
-              "device_open() called without device_api_init()!\n");
+        g_critical("device_open() called without device_api_init()!");
         g_assert_not_reached();
     }
 
-    if (!handle_device_regex(device_name, &device_driver_name, &device_node_name)) {
-        amfree(device_driver_name);
-        amfree(device_node_name);
-        return NULL;
+    if (device_name == NULL)
+       return make_null_error(stralloc(_("No device name specified")), DEVICE_STATUS_DEVICE_ERROR);
+
+    /* look up the unaliased device name in the configuration */
+    if ((dc = lookup_device_config(device_name))) {
+       if (!(unaliased_name = device_config_get_tapedev(dc))
+           || unaliased_name[0] == '\0') {
+           return make_null_error(
+               vstrallocf(_("Device '%s' has no tapedev"), device_name),
+               DEVICE_STATUS_DEVICE_ERROR);
+       }
+    } else {
+       unaliased_name = device_name;
+    }
+
+    if (!handle_device_regex(unaliased_name, &device_type, &device_node,
+                            &errmsg)) {
+       amfree(device_type);
+       amfree(device_node);
+       return make_null_error(errmsg, DEVICE_STATUS_DEVICE_ERROR);
     }
 
-    factory = lookup_device_factory(device_driver_name);
+    factory = lookup_device_factory(device_type);
 
     if (factory == NULL) {
-        g_fprintf(stderr, "Device driver %s is not known.\n",
-                device_driver_name);
-        amfree(device_driver_name);
-        amfree(device_node_name);
-        return NULL;
+       Device *nulldev = make_null_error(vstrallocf(_("Device type %s is not known."),
+           device_type), DEVICE_STATUS_DEVICE_ERROR);
+       amfree(device_type);
+       amfree(device_node);
+       return nulldev;
     }
 
-    device = factory(device_driver_name, device_node_name);
-    amfree(device_driver_name);
-    amfree(device_node_name);
+    device = factory(device_name, device_type, device_node);
+    g_assert(device != NULL); /* factories must always return a device */
+
+    amfree(device_type);
+    amfree(device_node);
+
     return device;
 }
 
-void 
-device_add_property (Device * self, DeviceProperty * prop, GValue * response)
+char *
+device_error(Device * self)
 {
-    unsigned int i;
-    g_return_if_fail (self != NULL);
-    g_return_if_fail (IS_DEVICE (self));
-    g_assert(selfp->property_list != NULL);
-    g_assert(selfp->property_response != NULL);
-
-    /* Delete it if it already exists. */
-    for(i = 0; i < selfp->property_list->len; i ++) {
-        if (g_array_index(selfp->property_list,
-                          DeviceProperty, i).base->ID == prop->base->ID) {
-            g_array_remove_index_fast(selfp->property_list, i);
-            break;
-        }
-    }
-
-    g_array_append_val(selfp->property_list, *prop);
-    
-    if (response != NULL) {
-        PropertyResponse * property_response;
-        
-        g_return_if_fail(G_IS_VALUE(response));
-        
-        property_response = malloc(sizeof(*property_response));
-        property_response->access = prop->access;
-        bzero(&(property_response->response),
-              sizeof(property_response->response));
-        g_value_init(&(property_response->response),
-                     G_VALUE_TYPE(response));
-        g_value_copy(response, &(property_response->response));
-        
-        g_hash_table_insert(selfp->property_response,
-                            GINT_TO_POINTER(prop->base->ID),
-                            property_response);
+    if (self == NULL) {
+        return device_error_or_status(self);
+    } else if (selfp->errmsg) {
+       return selfp->errmsg;
+    } else {
+        return "Unknown Device error";
     }
 }
 
-const DeviceProperty * 
-device_property_get_list (Device * self)
+char *
+device_status_error(Device * self)
 {
-       g_return_val_if_fail (self != NULL, (const DeviceProperty * )0);
-       g_return_val_if_fail (IS_DEVICE (self), (const DeviceProperty * )0);
+    char **status_strv;
+    char *statusmsg;
 
-        return (const DeviceProperty*) selfp->property_list->data;
-}
-
-guint device_write_min_size(Device * self) {
-    GValue g_tmp;
-    int block_size, min_block_size;
-    
-    bzero(&g_tmp, sizeof(g_tmp));
-    device_property_get(self, PROPERTY_BLOCK_SIZE, &g_tmp);
-    block_size = g_value_get_int(&g_tmp);
-    g_value_unset(&g_tmp);
-    if (block_size > 0) {
-        return block_size;
+    if (self == NULL) {
+        return device_error_or_status(self);
     }
 
-    /* variable block size */
-    device_property_get(self, PROPERTY_MIN_BLOCK_SIZE, &g_tmp);
-    min_block_size = g_value_get_uint(&g_tmp);
-    g_value_unset(&g_tmp);
-    return min_block_size;
-}
+    /* reuse a previous statusmsg, if it was for the same status */
+    if (selfp->statusmsg && selfp->last_status == self->status)
+       return selfp->statusmsg;
 
-guint device_write_max_size(Device * self) {
-    GValue g_tmp;
-    int block_size, max_block_size;
-    
-    bzero(&g_tmp, sizeof(g_tmp));
-    device_property_get(self, PROPERTY_BLOCK_SIZE, &g_tmp);
-    block_size = g_value_get_int(&g_tmp);
-    g_value_unset(&g_tmp);
-    if (block_size > 0) {
-        return block_size;
+    amfree(selfp->statusmsg);
+
+    status_strv = g_flags_nick_to_strv(self->status, DEVICE_STATUS_FLAGS_TYPE);
+    g_assert(g_strv_length(status_strv) > 0);
+    if (g_strv_length(status_strv) == 1) {
+       statusmsg = stralloc(*status_strv);
+    } else {
+       char * status_list = g_english_strjoinv(status_strv, "or");
+       statusmsg = g_strdup_printf("one of %s", status_list);
+       amfree(status_list);
     }
+    g_strfreev(status_strv);
 
-    /* variable block size */
-    device_property_get(self, PROPERTY_MAX_BLOCK_SIZE, &g_tmp);
-    max_block_size = g_value_get_uint(&g_tmp);
-    g_value_unset(&g_tmp);
-    return max_block_size;
+    selfp->statusmsg = statusmsg;
+    selfp->last_status = self->status;
+    return statusmsg;
 }
 
-guint device_read_max_size(Device * self) {
-    GValue g_tmp;
-    
-    bzero(&g_tmp, sizeof(g_tmp));
-    if (device_property_get(self, PROPERTY_READ_BUFFER_SIZE, &g_tmp)) {
-        guint rval = g_value_get_uint(&g_tmp);
-        g_value_unset(&g_tmp);
-        return rval;
+char *
+device_error_or_status(Device * self)
+{
+    if (self == NULL) {
+        return "Device is NULL";
+    } else if (selfp->errmsg) {
+       return selfp->errmsg;
     } else {
-        return device_write_max_size(self);
+       return device_status_error(self);
+    }
+}
+
+void
+device_set_error(Device *self, char *errmsg, DeviceStatusFlags new_flags)
+{
+    char **flags_strv;
+    char *flags_str;
+    char *device_name;
+
+    if (!self) {
+       g_warning("device_set_error called with a NULL device: '%s'", errmsg? errmsg:"(NULL)");
+       amfree(errmsg);
+       return;
+    }
+
+    device_name = self->device_name? self->device_name : "(unknown device)";
+
+    if (errmsg && (!selfp->errmsg || strcmp(errmsg, selfp->errmsg) != 0))
+       g_debug("Device %s error = '%s'", device_name, errmsg);
+
+    amfree(selfp->errmsg);
+    selfp->errmsg = errmsg;
+
+    if (new_flags != DEVICE_STATUS_SUCCESS) {
+       flags_strv = g_flags_name_to_strv(new_flags, DEVICE_STATUS_FLAGS_TYPE);
+       g_assert(g_strv_length(flags_strv) > 0);
+       flags_str = g_english_strjoinv(flags_strv, "and");
+       g_debug("Device %s setting status flag(s): %s", device_name, flags_str);
+       amfree(flags_str);
+       g_strfreev(flags_strv);
     }
+
+    self->status = new_flags;
 }
 
 char * device_build_amanda_header(Device * self, const dumpfile_t * info,
                                   int * size, gboolean * oneblock) {
     char *amanda_header;
-    unsigned int min_header_length;
-    unsigned int header_buffer_size;
+    size_t min_header_length;
+    size_t header_buffer_size;
 
-    min_header_length = device_write_min_size(self);
+    min_header_length = self->block_size;
     amanda_header = build_header(info, min_header_length);
     header_buffer_size = MAX(min_header_length, strlen(amanda_header)+1);
     if (size != NULL)
         *size = header_buffer_size;
     if (oneblock != NULL)
-        *oneblock = (header_buffer_size <=  device_write_max_size(self));
+        *oneblock = (header_buffer_size <= self->block_size);
     return amanda_header;
 }
 
 dumpfile_t * make_tapestart_header(Device * self, char * label,
                                    char * timestamp) {
     dumpfile_t * rval;
+    GValue val;
+    bzero(&val, sizeof(val));
 
-    g_return_val_if_fail(label != NULL, NULL);
+    g_assert(label != NULL);
 
     rval = malloc(sizeof(*rval));
     fh_init(rval);
     rval->type = F_TAPESTART;
+    if (device_property_get(self, PROPERTY_BLOCK_SIZE, &val)) {
+       rval->blocksize = g_value_get_int(&val);
+       g_value_unset(&val);
+    }
+
     amfree(self->volume_time);
     if (get_timestamp_state(timestamp) == TIME_STATE_REPLACE) {
         self->volume_time = get_proper_stamp_from_time(time(NULL));
@@ -503,71 +640,72 @@ dumpfile_t * make_tapeend_header(void) {
     return rval;
 }
 
-/* Try setting max/fixed blocksize on a device. Check results, fallback, and
- * print messages for problems. */
-static void try_set_blocksize(Device * device, guint blocksize,
-                              gboolean try_max_first) {
+/* Try setting the blocksize on a device. Check results, fallback, and
+ * set error status for problems. */
+static gboolean
+try_set_blocksize(Device * device, guint blocksize) {
     GValue val;
     gboolean success;
     bzero(&val, sizeof(val));
-    g_value_init(&val, G_TYPE_UINT);
-    g_value_set_uint(&val, blocksize);
-    if (try_max_first) {
-        success = device_property_set(device,
-                                      PROPERTY_MAX_BLOCK_SIZE,
-                                      &val);
-        if (!success) {
-            g_fprintf(stderr, "Setting MAX_BLOCK_SIZE to %u "
-                    "not supported for device %s.\n"
-                    "trying BLOCK_SIZE instead.\n",
-                    blocksize, device->device_name);
-        } else {
-            g_value_unset(&val);
-            return;
-        }
-    }
 
-    g_value_unset(&val);
     g_value_init(&val, G_TYPE_INT);
     g_value_set_int(&val, blocksize);
-    success = device_property_set(device,
-                                  PROPERTY_BLOCK_SIZE,
-                                  &val);
+    success = device_property_set(device, PROPERTY_BLOCK_SIZE, &val);
+    g_value_unset(&val);
+
     if (!success) {
-        g_fprintf(stderr, "Setting BLOCK_SIZE to %u "
-                "not supported for device %s.\n",
-                blocksize, device->device_name);
+       device_set_error(device,
+           vstrallocf(_("Setting BLOCK_SIZE to %u "
+                   "not supported for device %s.\n"),
+                   blocksize, device->device_name),
+           DEVICE_STATUS_DEVICE_ERROR);
     }
-    g_value_unset(&val);
+
+    return success;
 }
 
 /* A GHFunc (callback for g_hash_table_foreach) */
 static void set_device_property(gpointer key_p, gpointer value_p,
                                    gpointer user_data_p) {
-    char * property_s = key_p;
-    char * value_s = value_p;
+    char   * property_s = key_p;
+    property_t * property = value_p;
     Device * device = user_data_p;
     const DevicePropertyBase* property_base;
     GValue property_value;
+    char   * value;
 
     g_return_if_fail(IS_DEVICE(device));
     g_return_if_fail(property_s != NULL);
-    g_return_if_fail(value_s != NULL);
+    g_return_if_fail(property != NULL);
+    g_return_if_fail(property->values != NULL);
+
+    /* don't continue beating on a device that's already erroring */
+    if (device_in_error(device)) return;
 
     property_base = device_property_get_by_name(property_s);
     if (property_base == NULL) {
         /* Nonexistant property name. */
-        g_fprintf(stderr, _("Unknown device property name %s.\n"), property_s);
+       device_set_error(device,
+           vstrallocf(_("unknown device property name '%s'"), property_s),
+           DEVICE_STATUS_DEVICE_ERROR);
         return;
     }
+    if (g_slist_length(property->values) > 1) {
+       device_set_error(device,
+           vstrallocf(_("multiple values for device property '%s'"), property_s),
+           DEVICE_STATUS_DEVICE_ERROR);
+       return;
+    }
     
     bzero(&property_value, sizeof(property_value));
     g_value_init(&property_value, property_base->type);
-    if (!g_value_set_from_string(&property_value, value_s)) {
+    value = property->values->data;
+    if (!g_value_set_from_string(&property_value, value)) {
         /* Value type could not be interpreted. */
-        g_fprintf(stderr,
-                _("Could not parse property value %s for property type %s.\n"),
-                value_s, g_type_name(property_base->type));
+       device_set_error(device,
+           vstrallocf(_("Could not parse property value '%s' for property '%s'"),
+                       value, g_type_name(property_base->type)),
+           DEVICE_STATUS_DEVICE_ERROR);
         return;
     } else {
         g_assert (G_VALUE_HOLDS(&property_value, property_base->type));
@@ -575,15 +713,21 @@ static void set_device_property(gpointer key_p, gpointer value_p,
 
     if (!device_property_set(device, property_base->ID, &property_value)) {
         /* Device rejects property. */
-        g_fprintf(stderr, _("Could not set property %s to %s on device %s.\n"),
-                property_base->name, value_s, device->device_name);
+        if (!device_in_error(device)) {
+           device_set_error(device,
+               vstrallocf(_("Could not set property '%s' to '%s' on %s"),
+                       property_base->name, value, device->device_name),
+               DEVICE_STATUS_DEVICE_ERROR);
+       }
         return;
     }
 }
 
-/* Set up first-run properties, including DEVICE_MAX_VOLUME_USAGE property
- * based on the tapetype. */
-void device_set_startup_properties_from_config(Device * device) {
+/* Set up properties based on various taper-related configuration parameters
+ * and from the tapetype.
+ */
+static void
+set_properties_from_global_config(Device * device) {
     char * tapetype_name = getconf_str(CNF_TAPETYPE);
     if (tapetype_name != NULL) {
         tapetype_t * tapetype = lookup_tapetype(tapetype_name);
@@ -613,17 +757,16 @@ void device_set_startup_properties_from_config(Device * device) {
                                               &val);
                 g_value_unset(&val);
                 if (!success) {
-                    g_fprintf(stderr, "Setting READ_BUFFER_SIZE to %llu "
-                            "not supported for device %s.\n",
-                            1024*(long long unsigned int)blocksize_kb,
-                           device->device_name);
+                   /* a non-fatal error */
+                    g_warning("Setting READ_BUFFER_SIZE to %ju not supported for device %s.",
+                            1024*(uintmax_t)blocksize_kb, device->device_name);
                 }
             }
 
             if (tapetype_seen(tapetype, TAPETYPE_BLOCKSIZE)) {
                blocksize_kb = tapetype_get_blocksize(tapetype);
-                try_set_blocksize(device, blocksize_kb * 1024,
-                                  !tapetype_get_file_pad(tapetype));
+               /* TODO: handle errors */
+                (void)try_set_blocksize(device, blocksize_kb * 1024);
             }
         }
     }
@@ -632,6 +775,33 @@ void device_set_startup_properties_from_config(Device * device) {
                          set_device_property, device);
 }
 
+/* Set properties specified within a device definition */
+static void
+set_properties_from_device_config(Device * device, device_config_t *dc) {
+    g_hash_table_foreach(device_config_get_property(dc),
+                         set_device_property, device);
+}
+
+static gboolean
+default_device_configure(Device *self, gboolean use_global_config)
+{
+    device_config_t *dc;
+
+    if (device_in_error(self))
+       return FALSE;
+
+    if (use_global_config)
+       set_properties_from_global_config(self);
+
+    if (device_in_error(self))
+       return FALSE;
+
+    if ((dc = lookup_device_config(self->device_name)))
+       set_properties_from_device_config(self, dc);
+
+    return !device_in_error(self);
+}
+
 void device_clear_volume_details(Device * device) {
     if (device == NULL || device->access_mode != ACCESS_NULL) {
         return;
@@ -646,137 +816,243 @@ void device_clear_volume_details(Device * device) {
    incomplete functionality. But they do offer the useful commonality
    that all devices can expect to need. */
 
-/* This function only updates access_mode, volume_label, and volume_time. */
+static void default_device_open_device(Device * self, char * device_name,
+                   char * device_type G_GNUC_UNUSED, char * device_node G_GNUC_UNUSED) {
+    /* Set the device_name property */
+    self->device_name = stralloc(device_name);
+}
+
 static gboolean
-default_device_start (Device * self, DeviceAccessMode mode, char * label,
-                      char * timestamp) {
-    if (mode != ACCESS_WRITE && self->volume_label == NULL) {
-       g_debug("default_device_start calling device_read_label with mode %d", mode);
-        if (device_read_label(self) != READ_LABEL_STATUS_SUCCESS)
-            return FALSE;
-    } else if (mode == ACCESS_WRITE) {
-        self->volume_label = newstralloc(self->volume_label, label);
-        self->volume_time = newstralloc(self->volume_time, timestamp);
-    }
-    self->access_mode = mode;
+property_get_block_size_fn(
+       Device *self,
+       DevicePropertyBase *base G_GNUC_UNUSED,
+       GValue *val,
+       PropertySurety *surety,
+       PropertySource *source)
+{
+    g_value_unset_init(val, G_TYPE_INT);
+    g_assert(self->block_size < G_MAXINT); /* gsize -> gint */
+    g_value_set_int(val, (gint)self->block_size);
+
+    if (surety)
+       *surety = self->block_size_surety;
+
+    if (source)
+       *source = self->block_size_source;
 
     return TRUE;
 }
 
-static gboolean default_device_open_device(Device * self,
-                                           char * device_name) {
-    DeviceProperty prop;
-    guint i;
+static gboolean
+property_set_block_size_fn(
+       Device *self,
+       DevicePropertyBase *base G_GNUC_UNUSED,
+       GValue *val,
+       PropertySurety surety,
+       PropertySource source)
+{
+    gint block_size = g_value_get_int(val);
 
-    self->device_name = stralloc(device_name);
+    g_assert(block_size >= 0); /* int -> gsize (unsigned) */
+    if ((gsize)block_size < self->min_block_size
+       || (gsize)block_size > self->max_block_size)
+       return FALSE;
 
-    prop.base = &device_property_canonical_name;
-    prop.access = PROPERTY_ACCESS_GET_MASK;
-
-    for(i = 0; i < selfp->property_list->len; i ++) {
-        if (g_array_index(selfp->property_list,
-                          DeviceProperty, i).base->ID == prop.base->ID) {
-            return TRUE;
-        }
-    }
-    /* If we got here, the property was not registered. */
-    device_add_property(self, &prop, NULL);
+    self->block_size = block_size;
+    self->block_size_surety = surety;
+    self->block_size_source = source;
 
     return TRUE;
 }
 
-/* This default implementation does very little. */
 static gboolean
-default_device_finish (Device * self) {
-    self->access_mode = ACCESS_NULL;
+property_get_min_block_size_fn(
+       Device *self,
+       DevicePropertyBase *base G_GNUC_UNUSED,
+       GValue *val,
+       PropertySurety *surety,
+       PropertySource *source)
+{
+    g_value_unset_init(val, G_TYPE_UINT);
+    g_assert(self->block_size < G_MAXUINT); /* gsize -> guint */
+    g_value_set_uint(val, (guint)self->min_block_size);
+
+    if (surety)
+       *surety = PROPERTY_SURETY_GOOD;
+
+    if (source)
+       *source = PROPERTY_SOURCE_DEFAULT;
+
     return TRUE;
 }
 
-/* This function updates the file, in_file, and block attributes. */
 static gboolean
-default_device_start_file (Device * self,
-                           const dumpfile_t * jobInfo G_GNUC_UNUSED) {
-    self->in_file = TRUE;
-    if (self->file <= 0)
-        self->file = 1;
-    else
-        self->file ++;
-    self->block = 0;
+property_get_max_block_size_fn(
+       Device *self,
+       DevicePropertyBase *base G_GNUC_UNUSED,
+       GValue *val,
+       PropertySurety *surety,
+       PropertySource *source)
+{
+    g_value_unset_init(val, G_TYPE_UINT);
+    g_assert(self->block_size < G_MAXUINT); /* gsize -> guint */
+    g_value_set_uint(val, (guint)self->max_block_size);
+
+    if (surety)
+       *surety = PROPERTY_SURETY_GOOD;
+
+    if (source)
+       *source = PROPERTY_SOURCE_DEFAULT;
+
     return TRUE;
 }
 
-/* This function lies: It updates the block number and maybe calls
-   device_finish_file(), but returns FALSE. */
 static gboolean
-default_device_write_block(Device * self, guint size G_GNUC_UNUSED,
-                           gpointer data G_GNUC_UNUSED, gboolean last_block) {
-    self->block ++;
-    if (last_block)
-        device_finish_file(self);
-    return FALSE;
-}
+property_get_canonical_name_fn(
+       Device *self,
+       DevicePropertyBase *base G_GNUC_UNUSED,
+       GValue *val,
+       PropertySurety *surety,
+       PropertySource *source)
+{
+    g_value_unset_init(val, G_TYPE_STRING);
+    g_value_set_string(val, self->device_name);
 
-/* This function lies: It updates the block number, but returns
-   -1. */
-static int
-default_device_read_block(Device * self, gpointer buf G_GNUC_UNUSED,
-                          int * size G_GNUC_UNUSED) {
-    self->block ++;
-    return -1;
-}
+    if (surety)
+       *surety = PROPERTY_SURETY_GOOD;
+
+    if (source)
+       *source = PROPERTY_SOURCE_DEFAULT;
 
-/* This function just updates the in_file field. */
-static gboolean
-default_device_finish_file(Device * self) {
-    self->in_file = FALSE;
     return TRUE;
 }
 
-/* This function just updates the file number. */
-static dumpfile_t *
-default_device_seek_file(Device * self, guint file) {
-    self->in_file = TRUE;
-    self->file = file;
-    return NULL;
+/* util function */
+static PropertyPhaseFlags
+state_to_phase(
+    Device *self)
+{
+    if (self->access_mode == ACCESS_NULL) {
+       return PROPERTY_PHASE_BEFORE_START;
+    } else if (IS_WRITABLE_ACCESS_MODE(self->access_mode)) {
+       if (self->in_file) {
+           return PROPERTY_PHASE_INSIDE_FILE_WRITE;
+       } else {
+           return PROPERTY_PHASE_BETWEEN_FILE_WRITE;
+       }
+    } else { /* read mode */
+       if (self->in_file) {
+           return PROPERTY_PHASE_INSIDE_FILE_READ;
+       } else {
+           return PROPERTY_PHASE_BETWEEN_FILE_READ;
+       }
+    }
 }
 
-/* This function just updates the block number. */
+/* This default implementation serves up static responses, and
+   implements a few default responses based on values from the Device
+   struct. */
 static gboolean
-default_device_seek_block(Device * self, guint64 block) {
-    self->block = block;
+default_device_property_get_ex(
+       Device * self,
+       DevicePropertyId id,
+       GValue * val,
+       PropertySurety *surety,
+       PropertySource *source)
+{
+    DeviceProperty *prop;
+    GArray *class_properties;
+    PropertyPhaseFlags cur_phase;
+
+    /* Most of this function's job is to sanity-check everything, then
+     * call the relevant getter. */
+
+    if (device_in_error(self))
+       return FALSE;
+
+    class_properties = DEVICE_GET_CLASS(self)->class_properties;
+    if (id >= class_properties->len)
+       return FALSE;
+
+    prop = &g_array_index(class_properties, DeviceProperty, id);
+    if (prop->base == NULL)
+       return FALSE;
+
+    if (val || surety || source) {
+       /* check the phase */
+       cur_phase = state_to_phase(self);
+       if (!(prop->access & cur_phase))
+           return FALSE;
+
+       if (prop->getter == NULL)
+           return FALSE;
+
+       if (!prop->getter(self, prop->base, val, surety, source))
+           return FALSE;
+    }
+
     return TRUE;
 }
 
-/* This default implementation serves up static responses, and
-   implements a default response to the "canonical name" property. */
-
 static gboolean
-default_device_property_get(Device * self, DevicePropertyId ID,
-                            GValue * value) {
-    const PropertyResponse * resp;
-
-    resp = (PropertyResponse*)g_hash_table_lookup(selfp->property_response,
-                                                  GINT_TO_POINTER(ID));
-    if (resp == NULL) {
-        if (ID == PROPERTY_CANONICAL_NAME) {
-            g_value_unset_init(value, G_TYPE_STRING);
-            g_value_set_string(value, self->device_name);
-           return TRUE;
-        } else {
-            return FALSE;
-        }
-    }
+default_device_property_set_ex(
+    Device *self,
+    DevicePropertyId id,
+    GValue * val,
+    PropertySurety surety,
+    PropertySource source)
+{
+    DeviceProperty *prop;
+    GArray *class_properties;
+    PropertyPhaseFlags cur_phase;
+
+    /* Most of this function's job is to sanity-check everything, then
+     * call the relevant setter. */
+
+    if (device_in_error(self))
+       return FALSE;
+
+    class_properties = DEVICE_GET_CLASS(self)->class_properties;
+    if (id >= class_properties->len)
+       return FALSE;
 
-    g_value_unset_copy(&resp->response, value);
+    prop = &g_array_index(class_properties, DeviceProperty, id);
+    if (prop->base == NULL)
+       return FALSE;
+
+    /* check that the type matches */
+    if (!G_VALUE_HOLDS(val, prop->base->type))
+       return FALSE;
+
+    /* check the phase */
+    cur_phase = state_to_phase(self) << PROPERTY_PHASE_SHIFT;
+    if (!(prop->access & cur_phase))
+       return FALSE;
+
+    if (prop->setter == NULL)
+       return FALSE;
+
+    if (!prop->setter(self, prop->base, val, surety, source))
+       return FALSE;
 
     return TRUE;
 }
 
+const GSList *
+device_property_get_list (Device * self)
+{
+    g_assert(IS_DEVICE(self));
+
+    return DEVICE_GET_CLASS(self)->class_properties_list;
+}
+
 static gboolean
-default_device_read_to_fd(Device *self, int fd) {
+default_device_read_to_fd(Device *self, queue_fd_t *queue_fd) {
     GValue val;
     StreamingRequirement streaming_mode;
 
+    if (device_in_error(self)) return FALSE;
+
     /* Get the device's parameters */
     bzero(&val, sizeof(val));
     if (!device_property_get(self, PROPERTY_STREAMING, &val)
@@ -791,17 +1067,19 @@ default_device_read_to_fd(Device *self, int fd) {
            device_read_producer,
            self,
            fd_write_consumer,
-           GINT_TO_POINTER(fd),
-           device_read_max_size(self),
+           queue_fd,
+           self->block_size,
            DEFAULT_MAX_BUFFER_MEMORY,
            streaming_mode);
 }
 
 static gboolean
-default_device_write_from_fd(Device *self, int fd) {
+default_device_write_from_fd(Device *self, queue_fd_t *queue_fd) {
     GValue val;
     StreamingRequirement streaming_mode;
 
+    if (device_in_error(self)) return FALSE;
+
     /* Get the device's parameters */
     bzero(&val, sizeof(val));
     if (!device_property_get(self, PROPERTY_STREAMING, &val)
@@ -814,10 +1092,10 @@ default_device_write_from_fd(Device *self, int fd) {
     return QUEUE_SUCCESS ==
        do_consumer_producer_queue_full(
            fd_read_producer,
-           GINT_TO_POINTER(fd),
+           queue_fd,
            device_write_consumer,
            self,
-           device_write_max_size(self),
+           self->block_size,
            DEFAULT_MAX_BUFFER_MEMORY,
            streaming_mode);
 }
@@ -828,294 +1106,396 @@ default_device_write_from_fd(Device *self, int fd) {
  * will do what you expect vis-a-vis virtual functions. But don't put code
  * in them beyond error checking and VFT lookup. */
 
-gboolean 
-device_open_device (Device * self, char * device_name)
+void
+device_open_device (Device * self, char * device_name,
+       char * device_type, char * device_node)
 {
-        DeviceClass *klass;
-       g_return_val_if_fail (self != NULL, FALSE);
-       g_return_val_if_fail (IS_DEVICE (self), FALSE);
-       g_return_val_if_fail (device_name != NULL, FALSE);
-       klass = DEVICE_GET_CLASS(self);
-
-       if(klass->open_device)
-            return (*klass->open_device)(self,device_name);
-       else
-               return FALSE;
+    DeviceClass *klass;
+
+    g_assert(IS_DEVICE(self));
+    g_assert(device_name != NULL);
+
+    klass = DEVICE_GET_CLASS(self);
+    g_assert(klass->open_device);
+    (klass->open_device)(self, device_name, device_type, device_node);
 }
 
-ReadLabelStatusFlags device_read_label(Device * self) {
+DeviceStatusFlags device_read_label(Device * self) {
     DeviceClass * klass;
-    g_debug("device_read_label; mode = %d", self->access_mode);
-    g_return_val_if_fail(self != NULL, FALSE);
-    g_return_val_if_fail(IS_DEVICE(self), FALSE);
-    g_return_val_if_fail(self->access_mode == ACCESS_NULL, FALSE);
+
+    g_assert(self != NULL);
+    g_assert(IS_DEVICE(self));
+    g_assert(self->access_mode == ACCESS_NULL);
 
     klass = DEVICE_GET_CLASS(self);
-    if (klass->read_label) {
-        return (klass->read_label)(self);
-    } else {
-        return ~ READ_LABEL_STATUS_SUCCESS;
-    }
+    g_assert(klass->read_label);
+    return (klass->read_label)(self);
 }
 
 gboolean
 device_finish (Device * self) {
-       DeviceClass *klass;
-       g_return_val_if_fail (self != NULL, FALSE);
-       g_return_val_if_fail (IS_DEVICE (self), FALSE);
-
-        if (self->access_mode == ACCESS_NULL)
-            return TRUE;
-
-       klass = DEVICE_GET_CLASS(self);
-        if (klass->finish) {
-            return (*klass->finish)(self);
-        } else {
-            return FALSE;
-        }
+    DeviceClass *klass;
+
+    g_assert(IS_DEVICE (self));
+
+    klass = DEVICE_GET_CLASS(self);
+    g_assert(klass->finish);
+    return (klass->finish)(self);
+}
+
+gboolean
+device_configure (Device * self, gboolean use_global_config)
+{
+    DeviceClass *klass;
+
+    g_assert(IS_DEVICE (self));
+    g_assert(self->access_mode == ACCESS_NULL);
+
+    klass = DEVICE_GET_CLASS(self);
+    if(klass->configure) {
+       return (klass->configure)(self, use_global_config);
+    } else {
+       device_set_error(self,
+           stralloc(_("Unimplemented method")),
+           DEVICE_STATUS_DEVICE_ERROR);
+       return FALSE;
+    }
 }
 
-/* For a good combination of synchronization and public simplicity,
-   this stub function does not take a timestamp, but the actual
-   implementation function does. We generate the timestamp here with
-   time(). */
 gboolean 
 device_start (Device * self, DeviceAccessMode mode,
               char * label, char * timestamp)
 {
-       DeviceClass *klass;
-
-       g_debug("device_start mode = %d", mode);
-       g_return_val_if_fail (self != NULL, FALSE);
-       g_return_val_if_fail (IS_DEVICE (self), FALSE);
-        g_return_val_if_fail (mode != ACCESS_NULL, FALSE);
-        g_return_val_if_fail (mode != ACCESS_WRITE || label != NULL,
-                              FALSE);
-       klass = DEVICE_GET_CLASS(self);
-
-       if(klass->start) {
-           char * local_timestamp = NULL;
-           gboolean rv;
-
-           /* fill in a timestamp if none was given */
-           if (mode == ACCESS_WRITE &&
-               get_timestamp_state(timestamp) == TIME_STATE_REPLACE) {
-               local_timestamp = timestamp = 
-                   get_proper_stamp_from_time(time(NULL));
-           }
-
-            rv = (*klass->start)(self, mode, label, timestamp);
-           amfree(local_timestamp);
-           g_debug("device_start done; dev->access_mode = %d, result %d", self->access_mode, rv);
-           return rv;
-        } else {
-            return FALSE;
-        }
+    DeviceClass *klass;
+    char * local_timestamp = NULL;
+    gboolean rv;
+
+    g_assert(IS_DEVICE (self));
+    g_assert(mode != ACCESS_NULL);
+    g_assert(mode != ACCESS_WRITE || label != NULL);
+
+    klass = DEVICE_GET_CLASS(self);
+    g_assert(klass->start);
+
+    /* For a good combination of synchronization and public simplicity,
+       this stub function does not require a timestamp, but the actual
+       implementation function does. We generate the timestamp here with
+       time(). */
+    if (mode == ACCESS_WRITE &&
+       get_timestamp_state(timestamp) == TIME_STATE_REPLACE) {
+       local_timestamp = timestamp =
+           get_proper_stamp_from_time(time(NULL));
+    }
+
+    rv = (klass->start)(self, mode, label, timestamp);
+    amfree(local_timestamp);
+    return rv;
 }
 
 gboolean
-device_write_block (Device * self, guint size, gpointer block,
-                    gboolean short_block)
+device_write_block (Device * self, guint size, gpointer block)
 {
     DeviceClass *klass;
-    g_return_val_if_fail (self != NULL, FALSE);
-    g_return_val_if_fail (IS_DEVICE (self), FALSE);
-    g_return_val_if_fail (size > 0, FALSE);
-    g_return_val_if_fail (short_block ||
-                          size >= device_write_min_size(self), FALSE);
-    g_return_val_if_fail (size <= device_write_max_size(self), FALSE);
-    g_return_val_if_fail (block != NULL, FALSE);
-    g_return_val_if_fail (IS_WRITABLE_ACCESS_MODE(self->access_mode),
-                          FALSE);
+
+    g_assert(IS_DEVICE (self));
+    g_assert(size > 0);
+
+    /* these are all things that the caller should take care to
+     * guarantee, so we just assert them here */
+    g_assert(size <= self->block_size);
+    g_assert(self->in_file);
+    g_assert(!selfp->wrote_short_block);
+    g_assert(block != NULL);
+    g_assert(IS_WRITABLE_ACCESS_MODE(self->access_mode));
+
+    if (size < self->block_size)
+       selfp->wrote_short_block = TRUE;
 
     klass = DEVICE_GET_CLASS(self);
-    
-    if(klass->write_block)
-        return (*klass->write_block)(self,size, block, short_block);
-    else
-        return FALSE;
+    g_assert(klass->write_block);
+    return (*klass->write_block)(self,size, block);
 }
 
 gboolean 
-device_write_from_fd (Device * self, int fd)
+device_write_from_fd (Device * self, queue_fd_t * queue_fd)
 {
-       DeviceClass *klass;
-       g_return_val_if_fail (self != NULL, FALSE);
-       g_return_val_if_fail (IS_DEVICE (self), FALSE);
-       g_return_val_if_fail (fd >= 0, FALSE);
-        g_return_val_if_fail (IS_WRITABLE_ACCESS_MODE(self->access_mode),
-                              FALSE);
-
-       klass = DEVICE_GET_CLASS(self);
-
-       if(klass->write_from_fd)
-               return (*klass->write_from_fd)(self,fd);
-       else
-               return FALSE;
+    DeviceClass *klass;
+
+    g_assert(IS_DEVICE (self));
+    g_assert(queue_fd->fd >= 0);
+    g_assert(IS_WRITABLE_ACCESS_MODE(self->access_mode));
+
+    klass = DEVICE_GET_CLASS(self);
+    g_assert(klass->write_from_fd);
+    return (klass->write_from_fd)(self,queue_fd);
 }
 
 gboolean
-device_start_file (Device * self, const dumpfile_t * jobInfo) {
+device_start_file (Device * self, dumpfile_t * jobInfo) {
     DeviceClass * klass;
-    g_return_val_if_fail (self != NULL, FALSE);
-    g_return_val_if_fail (IS_DEVICE (self), FALSE);
-    g_return_val_if_fail (!(self->in_file), FALSE);
-    g_return_val_if_fail (jobInfo != NULL, FALSE);
+
+    g_assert(IS_DEVICE (self));
+    g_assert(!(self->in_file));
+    g_assert(jobInfo != NULL);
+
+    selfp->wrote_short_block = FALSE;
 
     klass = DEVICE_GET_CLASS(self);
-    
-    if(klass->start_file)
-        return (*klass->start_file)(self, jobInfo );
-    else
-        return FALSE;
+    g_assert(klass->start_file);
+    return (klass->start_file)(self, jobInfo );
 }
 
 gboolean 
 device_finish_file (Device * self)
 {
-       DeviceClass *klass;
-       g_return_val_if_fail (self != NULL, FALSE);
-       g_return_val_if_fail (IS_DEVICE (self), FALSE);
-        g_return_val_if_fail (IS_WRITABLE_ACCESS_MODE(self->access_mode),
-                              FALSE);
-        g_return_val_if_fail (self->in_file, FALSE);
-
-       klass = DEVICE_GET_CLASS(self);
-
-       if(klass->finish_file)
-               return (*klass->finish_file)(self);
-       else
-               return FALSE;
+    DeviceClass *klass;
+
+    g_assert(IS_DEVICE (self));
+    g_assert(IS_WRITABLE_ACCESS_MODE(self->access_mode));
+    g_assert(self->in_file);
+
+    klass = DEVICE_GET_CLASS(self);
+    g_assert(klass->finish_file);
+    return (klass->finish_file)(self);
 }
 
 dumpfile_t*
 device_seek_file (Device * self, guint file)
 {
-       DeviceClass *klass;
-       g_return_val_if_fail (self != NULL, NULL);
-       g_return_val_if_fail (IS_DEVICE (self), NULL);
-        g_return_val_if_fail (self->access_mode == ACCESS_READ,
-                              NULL);
-
-       klass = DEVICE_GET_CLASS(self);
-
-       if(klass->seek_file)
-               return (*klass->seek_file)(self,file);
-       else
-               return FALSE;
+    DeviceClass *klass;
+
+    g_assert(IS_DEVICE (self));
+    g_assert(self->access_mode == ACCESS_READ);
+
+    klass = DEVICE_GET_CLASS(self);
+    g_assert(klass->seek_file);
+    return (klass->seek_file)(self,file);
 }
 
 gboolean 
 device_seek_block (Device * self, guint64 block)
 {
-       DeviceClass *klass;
-       g_return_val_if_fail (self != NULL, FALSE);
-       g_return_val_if_fail (IS_DEVICE (self), FALSE);
-        g_return_val_if_fail (self->access_mode == ACCESS_READ,
-                              FALSE);
-        g_return_val_if_fail (self->in_file, FALSE);
-
-       klass = DEVICE_GET_CLASS(self);
-
-       if(klass->seek_block)
-               return (*klass->seek_block)(self,block);
-       else
-               return FALSE;
+    DeviceClass *klass;
+
+    g_assert(IS_DEVICE (self));
+    g_assert(self->access_mode == ACCESS_READ);
+    g_assert(self->in_file);
+
+    klass = DEVICE_GET_CLASS(self);
+    g_assert(klass->seek_block);
+    return (klass->seek_block)(self,block);
 }
 
 int
 device_read_block (Device * self, gpointer buffer, int * size)
 {
-       DeviceClass *klass;
-       g_return_val_if_fail (self != NULL, -1);
-       g_return_val_if_fail (IS_DEVICE (self), -1);
-       g_return_val_if_fail (size != NULL, -1);
-        g_return_val_if_fail (self->access_mode == ACCESS_READ, -1);
-        if (*size != 0) {
-            g_return_val_if_fail (buffer != NULL, -1);
-        }
+    DeviceClass *klass;
 
-        /* Do a quick check here, so fixed-block subclasses don't have to. */
-        if (*size == 0 &&
-            device_write_min_size(self) == device_write_max_size(self)) {
-            *size = device_write_min_size(self);
-            return 0;
-        }
+    g_assert(IS_DEVICE (self));
+    g_assert(size != NULL);
+    g_assert(self->access_mode == ACCESS_READ);
 
-       klass = DEVICE_GET_CLASS(self);
+    if (*size != 0) {
+       g_assert(buffer != NULL);
+    }
 
-       if(klass->read_block)
-            return (*klass->read_block)(self,buffer,size);
-       else
-            return -1;
+    klass = DEVICE_GET_CLASS(self);
+    g_assert(klass->read_block);
+    return (klass->read_block)(self,buffer,size);
 }
 
 gboolean 
-device_read_to_fd (Device * self, int fd)
+device_read_to_fd (Device * self, queue_fd_t *queue_fd)
 {
-       DeviceClass *klass;
-       g_return_val_if_fail (self != NULL, FALSE);
-       g_return_val_if_fail (IS_DEVICE (self), FALSE);
-       g_return_val_if_fail (fd >= 0, FALSE);
-        g_return_val_if_fail (self->access_mode == ACCESS_READ, FALSE);
-
-       klass = DEVICE_GET_CLASS(self);
-
-       if(klass->read_to_fd)
-               return (*klass->read_to_fd)(self,fd);
-       else
-               return FALSE;
+    DeviceClass *klass;
+
+    g_assert(IS_DEVICE (self));
+    g_assert(queue_fd->fd >= 0);
+    g_assert(self->access_mode == ACCESS_READ);
+
+    klass = DEVICE_GET_CLASS(self);
+    g_assert(klass->read_to_fd);
+    return (klass->read_to_fd)(self,queue_fd);
 }
 
 
 gboolean 
-device_property_get (Device * self, DevicePropertyId id, GValue * val)
+device_property_get_ex(
+       Device * self,
+       DevicePropertyId id,
+       GValue * val,
+       PropertySurety *surety,
+       PropertySource *source)
 {
-       DeviceClass *klass;
-       g_return_val_if_fail (self != NULL, FALSE);
-       g_return_val_if_fail (IS_DEVICE (self), FALSE);
-        g_return_val_if_fail (device_property_get_by_id(id) != NULL, FALSE);
+    DeviceClass *klass;
 
-       klass = DEVICE_GET_CLASS(self);
+    g_assert(IS_DEVICE (self));
+    g_assert(device_property_get_by_id(id) != NULL);
 
-        /* FIXME: Check access flags? */
+    klass = DEVICE_GET_CLASS(self);
 
-       if(klass->property_get)
-               return (*klass->property_get)(self,id,val);
-       else
-               return FALSE;
+    g_assert(klass->property_get_ex);
+    return (klass->property_get_ex)(self, id, val, surety, source);
 }
 
-gboolean 
-device_property_set (Device * self, DevicePropertyId id, GValue * val)
+gboolean
+device_property_set_ex(
+       Device * self,
+       DevicePropertyId id,
+       GValue * val,
+       PropertySurety surety,
+       PropertySource source)
 {
-       DeviceClass *klass;
-       g_return_val_if_fail (self != NULL, FALSE);
-       g_return_val_if_fail (IS_DEVICE (self), FALSE);
+    DeviceClass *klass;
 
-       klass = DEVICE_GET_CLASS(self);
+    g_assert(IS_DEVICE (self));
 
-        /* FIXME: Check access flags? */
+    klass = DEVICE_GET_CLASS(self);
 
-       if(klass->property_set)
-               return (*klass->property_set)(self,id,val);
-       else
-               return FALSE;
+    g_assert(klass->property_set_ex);
+    return (klass->property_set_ex)(self, id, val, surety, source);
 }
 
 gboolean 
 device_recycle_file (Device * self, guint filenum)
 {
-       DeviceClass *klass;
-       g_return_val_if_fail (self != NULL, FALSE);
-       g_return_val_if_fail (IS_DEVICE (self), FALSE);
-        g_return_val_if_fail (self->access_mode == ACCESS_APPEND, FALSE);
+    DeviceClass *klass;
 
-       klass = DEVICE_GET_CLASS(self);
+    g_assert(self != NULL);
+    g_assert(IS_DEVICE (self));
+    g_assert(self->access_mode == ACCESS_APPEND);
+    g_assert(!self->in_file);
+
+    klass = DEVICE_GET_CLASS(self);
 
-       if(klass->recycle_file)
-               return (*klass->recycle_file)(self,filenum);
-       else
-               return FALSE;
+    g_assert(klass->recycle_file);
+    return (klass->recycle_file)(self,filenum);
 }
 
+/* Property handling */
+
+void
+device_class_register_property(
+       DeviceClass *klass,
+       DevicePropertyId id,
+       PropertyAccessFlags access,
+       PropertyGetFn getter,
+       PropertySetFn setter)
+{
+    DevicePropertyBase *base;
+    DeviceProperty *prop;
+    GSList *proplist;
+    guint i;
+
+    g_assert(klass != NULL);
+
+    base = device_property_get_by_id(id);
+    g_assert(base != NULL);
+
+    if (klass->class_properties->len <= id) {
+       g_array_set_size(klass->class_properties, id+1);
+    }
+
+    prop = &g_array_index(klass->class_properties, DeviceProperty, id);
+    prop->base = base;
+    prop->access = access;
+    prop->getter = getter;
+    prop->setter = setter;
+
+    /* completely rewrite the list of prop pointers, as they may have changed,
+     * or we may have replaced an existing property*/
+
+    if (klass->class_properties_list) {
+       g_slist_free(klass->class_properties_list);
+    }
+
+    proplist = NULL;
+    for (i = 0; i < klass->class_properties->len; i++) {
+       prop = &g_array_index(klass->class_properties, DeviceProperty, i);
+       if (!prop->base)
+           continue;
+       proplist = g_slist_prepend(proplist, prop);
+    }
+
+    klass->class_properties_list = proplist;
+}
+
+gboolean
+device_set_simple_property(
+       Device *self,
+       DevicePropertyId id,
+       GValue *val,
+       PropertySurety surety,
+       PropertySource source)
+{
+    SimpleProperty *simp;
+    DeviceProperty *prop;
+
+    prop = &g_array_index(DEVICE_GET_CLASS(self)->class_properties,
+                         DeviceProperty, id);
+
+    /* these assertions should already be checked, but let's be sure */
+    g_assert(prop->base != NULL);   /* prop must be registered with device */
+    g_assert(G_VALUE_HOLDS(val, prop->base->type));
+
+    simp = g_new0(SimpleProperty, 1);
+    simp->prop = prop;
+    g_value_unset_copy(val, &(simp->response));
+    simp->surety = surety;
+    simp->source = source;
+
+    g_hash_table_insert(selfp->simple_properties,
+                       GINT_TO_POINTER(id),
+                       simp);
+
+    return TRUE;
+}
+
+gboolean
+device_simple_property_set_fn(
+       Device *self,
+       DevicePropertyBase *base,
+       GValue *val,
+       PropertySurety surety,
+       PropertySource source)
+{
+    return device_set_simple_property(self, base->ID, val, surety, source);
+}
+
+gboolean
+device_get_simple_property(
+       Device *self,
+       DevicePropertyId id,
+       GValue *val,
+       PropertySurety *surety,
+       PropertySource *source)
+{
+    SimpleProperty *simp =
+       g_hash_table_lookup(selfp->simple_properties,
+                           GINT_TO_POINTER(id));
+
+    if (!simp)
+       return FALSE;
+
+    if (val)
+       g_value_unset_copy(&(simp->response), val);
+
+    if (surety)
+       *surety = simp->surety;
+
+    if (source)
+       *source = simp->source;
+
+    return TRUE;
+}
+
+gboolean
+device_simple_property_get_fn(
+       Device *self,
+       DevicePropertyBase *base,
+       GValue *val,
+       PropertySurety *surety,
+       PropertySource *source)
+{
+    return device_get_simple_property(self, base->ID, val, surety, source);
+}
index 262be39e4f99794163068844c0e2b0ed8b37c980..0230970c24f316828c5787fd859948539069336c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+ * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
  * 
  * This library is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License version 2.1 as 
@@ -14,8 +14,8 @@
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  * 
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 /* The Device API abstracts device workings, interaction, properties, and
@@ -52,135 +52,237 @@ typedef enum {
 /*
  * Type checking and casting macros
  */
+GType  device_get_type (void);
 #define TYPE_DEVICE    (device_get_type())
 #define DEVICE(obj)    G_TYPE_CHECK_INSTANCE_CAST((obj), device_get_type(), Device)
 #define DEVICE_CONST(obj)      G_TYPE_CHECK_INSTANCE_CAST((obj), device_get_type(), Device const)
 #define DEVICE_CLASS(klass)    G_TYPE_CHECK_CLASS_CAST((klass), device_get_type(), DeviceClass)
 #define IS_DEVICE(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), device_get_type ())
-
 #define DEVICE_GET_CLASS(obj)  G_TYPE_INSTANCE_GET_CLASS((obj), device_get_type(), DeviceClass)
 
 typedef struct DevicePrivate_s DevicePrivate;
 
+/* This structure is a Flags (bitwise OR of values). Zero indicates success;
+ * any other value indicates some kind of problem reading the label. If
+ * multiple bits are set, it does not necessarily indicate that /all/ of
+ * the specified issues occured, but rather that /at least one/ did. */
+typedef enum {
+    /* When changing, Also update device_status_flags_values in
+     * device-src/device.c and perl/Amanda/Device.swg */
+    DEVICE_STATUS_SUCCESS          = 0,
+
+    /* The device is in an unresolvable error state, and
+     * further retries are unlikely to change the status */
+    DEVICE_STATUS_DEVICE_ERROR     = (1 << 0),
+
+    /* The device is in use, and should be retried later */
+    DEVICE_STATUS_DEVICE_BUSY      = (1 << 1),
+
+    /* The device itself is OK, but has no media loaded.  This
+     * may change if media is loaded by the user or a changer */
+    DEVICE_STATUS_VOLUME_MISSING   = (1 << 2),
+
+    /* The device is OK and media is laoded, but there is
+     * no Amanda header or an invalid header on the media. */
+    DEVICE_STATUS_VOLUME_UNLABELED = (1 << 3),
+
+    /* The device is OK, but there was an unresolvable error
+     * loading the header from the media, so subsequent reads
+     * or writes will probably fail. */
+    DEVICE_STATUS_VOLUME_ERROR     = (1 << 4),
+
+    DEVICE_STATUS_FLAGS_MAX        = (1 << 5)
+} DeviceStatusFlags;
+
+#define DEVICE_STATUS_FLAGS_MASK (DEVICE_STATUS_MAX-1)
+#define DEVICE_STATUS_FLAGS_TYPE (device_status_flags_get_type())
+GType device_status_flags_get_type(void);
+
 /*
  * Main object structure
  */
-typedef struct {
+typedef struct Device {
     GObject __parent__;
 
     /* You can peek at the stuff below, but only subclasses should
        change these values.*/
 
-    /* What file, block are we at? (and are we in the middle of a
-     * file?) This is automatically updated by
-     * the default implementations of start_file, finish_file,
-     * write_block, read_block, seek_file, and seek_block. */
+    /* What file, block are we at? (and are we in the middle of a * file?) */
     int file;
     guint64 block;
     gboolean in_file;
-    /* Holds the user-specified device name. */
+
+    /* Holds the user-specified device name, which may be an alias */
     char * device_name;
-    /* Holds the user-specified access-mode. */
+
+    /* Holds the user-specified access-mode, or ACCESS_NULL if the device
+     * has not yet been started*/
     DeviceAccessMode access_mode;
+
     /* In reading mode, FALSE unless all the data from the current file
-     * was successfully read. */
+     * was successfully read.  In writing mode, TRUE if the end of tape
+     * has been reached. */
     gboolean is_eof;
+
     /* Holds the label and time of the currently-inserted volume,
      * or NULL if it has not been read/written yet. */
     char * volume_label;
     char * volume_time;
 
+    /* The most recently read volume header, or NULL if no header was
+     * read from this device.  Callers can use this to glean information
+     * about the volume beyond volume_label and volume_time.  */
+    dumpfile_t *volume_header;
+
+    /* The latest status for the device */
+    DeviceStatusFlags status;
+
+    /* device block-size ranges.  These are also available as properties,
+     * and by default users can set block_size via property BLOCK_SIZE.
+     * Writers should use block_size, and readers should initially use
+     * block_size, and expand buffers as directed by read_block. */
+    gsize min_block_size;
+    gsize max_block_size;
+    gsize block_size;
+
+    /* surety and source for the block size; if you set block_size directly,
+     * set these, too! */
+    PropertySurety block_size_surety;
+    PropertySource block_size_source;
+
     DevicePrivate * private;
 } Device;
 
-/* Pointer to factory function for device types. The factory functions
-   take control of their arguments, which should be dynamically
-   allocated. The factory should call open_device() with this
-   device_name. */
-typedef Device* (*DeviceFactory)(char * device_type,
-                                 char * device_name);
+/* Pointer to factory function for device types.
+ *
+ * device_name is the full name ("tape:/dev/nst0")
+ * device_prefix is the prefix ("tape")
+ * device_node is what follows the prefix ("/dev/nst0")
+ *
+ * The caller retains responsibility to free or otherwise handle
+ * the passed strings.
+ */
+typedef Device* (*DeviceFactory)(char *device_name,
+                                char * device_prefix,
+                                char * device_node);
 
 /* This function registers a new device with the allocation system.
  * Call it after you register your type with the GLib type system.
- * This function takes ownership of the strings inside device_prefix_list,
- * but not the device_prefix_list itself. */
+ * This function assumes that the strings in device_prefix_list are
+ * statically allocated. */
 extern void register_device(DeviceFactory factory,
                             const char ** device_prefix_list);
 
-/* This structure is a Flags (bitwise OR of values). Zero indicates success;
- * any other value indicates some kind of problem reading the label. If
- * multiple bits are set, it does not necessarily indicate that /all/ of
- * the specified issues occured, but rather that /at least one/ did. */
-typedef enum {
-    /* When changing, Also update read_label_status_flags_values in device.c */
-    READ_LABEL_STATUS_SUCCESS          = 0,
-    READ_LABEL_STATUS_DEVICE_MISSING   = (1 << 0),
-    READ_LABEL_STATUS_DEVICE_ERROR     = (1 << 1),
-    READ_LABEL_STATUS_VOLUME_MISSING   = (1 << 2),
-    READ_LABEL_STATUS_VOLUME_UNLABELED = (1 << 3),
-    READ_LABEL_STATUS_VOLUME_ERROR     = (1 << 4),
-    READ_LABEL_STATUS_FLAGS_MAX              = (1 << 5)
-} ReadLabelStatusFlags;
-
-#define READ_LABEL_STATUS_FLAGS_MASK (READ_LABEL_STATUS_MAX-1)
-#define READ_LABEL_STATUS_FLAGS_TYPE (read_label_status_flags_get_type())
-GType read_label_status_flags_get_type(void);
-
 /*
  * Class definition
  */
 typedef struct _DeviceClass DeviceClass;
 struct _DeviceClass {
     GObjectClass __parent__;
-    gboolean (* open_device) (Device * self,
-                              char * device_name); /* protected */
-    ReadLabelStatusFlags (* read_label)(Device * self);
+    void (* open_device) (Device * self, char * device_name,
+                   char * device_prefix, char * device_node);
+    gboolean (* configure) (Device * self, gboolean use_global_config);
+    DeviceStatusFlags (* read_label)(Device * self);
     gboolean (* start) (Device * self, DeviceAccessMode mode,
                         char * label, char * timestamp);
-    gboolean (* start_file) (Device * self, const dumpfile_t * info);
-    gboolean (* write_block) (Device * self, guint size, gpointer data,
-                              gboolean last_block);
-    gboolean (* write_from_fd) (Device * self, int fd);
+    gboolean (* start_file) (Device * self, dumpfile_t * info);
+    gboolean (* write_block) (Device * self, guint size, gpointer data);
+    gboolean (* write_from_fd) (Device * self, queue_fd_t *queue_fd);
     gboolean (* finish_file) (Device * self);
     dumpfile_t* (* seek_file) (Device * self, guint file);
     gboolean (* seek_block) (Device * self, guint64 block);
     int (* read_block) (Device * self, gpointer buf, int * size);
-    gboolean (* read_to_fd) (Device * self, int fd);
-    gboolean (* property_get) (Device * self, DevicePropertyId id,
-                               GValue * val);
-    gboolean (* property_set) (Device * self, DevicePropertyId id,
-                               GValue * val);
+    gboolean (* read_to_fd) (Device * self, queue_fd_t *queue_fd);
+    gboolean (* property_get_ex) (Device * self, DevicePropertyId id,
+                                 GValue * val,
+                                 PropertySurety *surety,
+                                 PropertySource *source);
+    gboolean (* property_set_ex) (Device * self,
+                                 DevicePropertyId id,
+                                 GValue * val,
+                                 PropertySurety surety,
+                                 PropertySource source);
     gboolean (* recycle_file) (Device * self, guint filenum);
     gboolean (* finish) (Device * self);
+
+    /* array of DeviceProperty objects for this class, keyed by ID */
+    GArray *class_properties;
+
+    /* The return value of device_property_get_list */
+    GSList * class_properties_list;
 };
 
+/*
+ * Device Instantiation
+ */
+
+/* This is how you get a new Device. Pass in a device name or alias.
+ *
+ * A Device is *always* returned, even for an invalid device name. You
+ * must check the resulting device->status to know if the device is valid
+ * to be used. If device->status is not DEVICE_STATUS_SUCCESS, then there
+ * was an error opening the device.
+ *
+ * Note that the Amanda configuration must be initialized, as this function
+ * looks for device definitions and other configuration information.
+ */
+Device*                device_open     (char * device_name);
+
+/* Once you have a new device, you should configure it.  This sets properties
+ * on the device based on the user's configuation.  If USE_GLOBAL_CONFIG is
+ * true, then any global device_property parameters are processed, along with
+ * tapetype and othe relevant parameters.
+ */
+gboolean device_configure(Device *self, gboolean use_global_config);
 
 /*
- * Public methods
+ * Error Handling
+ */
+
+/* return the error message or the string "Unknown Device error".  The
+ * string remains the responsibility of the Device, and should not
+ * be freed by the caller. */
+char *device_error(Device * self);
+
+/* return a string version of the status.  The string remains the
+ * responsibility of the Device, and should not be freed by the
+ * caller. */
+char *device_status_error(Device * self);
+
+/* Return errmsg if it is set or a string version of the status.  The
+ * string remains the responsibility of the Device, and should not
+ * be freed by the caller. */
+char *device_error_or_status(Device * self);
+
+/* Set the error message for this device; for use internally to the
+ * API.  The string becomes the responsibility of the Device.  If
+ * ERRMSG is NULL, the message is cleared.  Note that the given flags
+ * are OR'd with any existing status flags. */
+void device_set_error(Device * self, char *errmsg, DeviceStatusFlags new_flags);
+
+/* Mostly for internal use, this is a boolean check to see whether a given
+ * device is in an error state.  If this is TRUE, most operations on the
+ * device will fail.
  *
- * Note to implementors: The default implementation of many of these
- * methods does not follow the documentation. For example, the default
- * implementation of device_read_block will always return -1, but
- * nonetheless update the block index in the Device structure. In
- * general, it is OK to chain up to the default implmentation after
- * successfully implementing whatever appears below. The particulars
- * of what the default implementations do is documented in device.c.
+ * The check is for DEVICE_STATUS_DEVICE_ERROR *alone*; if any other bits
+ * (e.g., VOLUME_UNLABELED) are set, then the device may not actually be in
+ * an error state.
  */
-GType  device_get_type (void);
+#define device_in_error(dev) \
+    ((DEVICE(dev))->status == DEVICE_STATUS_DEVICE_ERROR)
 
-/* This is how you get a new Device. Pass in a device name like
- * file:/path/to/storage, and (assuming everything goes OK) you will get
- * back a nice happy Device* that you can do operations on. Note that you
- * must device_start() it before you can do anything besides talk about
- * properties or read the label. device_name remains the responsibility
- * of the caller. */
-Device*        device_open     (char * device_name);
+/*
+ * Public methods
+ */
 
-/* This instructs the device to read the label on the current
- * volume. device->volume_label will not be initalized until after this
- * is called. You are encouraged to read the label only after setting any
- * properties that may affect the label-reading process. */
-ReadLabelStatusFlags        device_read_label (Device * self);
+/* This instructs the device to read the label on the current volume.
+ * device->volume_label will not be initalized until read_label or start is
+ * called. You are encouraged to read the label only after setting any
+ * properties that may affect the label-reading process. Also, after
+ * calling this function, device->volume_label and device->volume_time
+ * will be non-NULL if and only if this function returns
+ * DEVICE_STATUS_SUCCESS. */
+DeviceStatusFlags        device_read_label (Device * self);
 
 /* This tells the Device that it's OK to start reading and writing
  * data. Before you call this, you can only call
@@ -190,56 +292,47 @@ ReadLabelStatusFlags        device_read_label (Device * self);
  * You should pass a label and timestamp if and only if you are
  * opening in WRITE mode (not READ or APPEND). The label and timestamp
  * remain the caller's responsibility in terms of memory management. The
- * passed timestamp may be NULL, in which case it will be filled in with 
- * the current time. */
+ * passed timestamp may be NULL, in which case it will be filled in with
+ * the current time.
+ *
+ * Note that implementations need not calculate a the current time: the
+ * dispatch function does it for you. */
 gboolean       device_start    (Device * self,
                                  DeviceAccessMode mode, char * label,
                                  char * timestamp);
 
 /* This undoes device_start, returning you to the NULL state. Do this
  * if you want to (for example) change access mode.
- * 
+ *
  * Note to subclass implementors: Call this function first from your
  * finalization function. */
 gboolean       device_finish   (Device * self);
 
-/* But you can't write any data until you call this function, too.
- * This function does not take ownership of the passed dumpfile_t; you must
- * free it yourself. */
+/* But you can't write any data until you call this function, too.  This
+ * function does not take ownership of the passed dumpfile_t; you must free it
+ * yourself.  Note that this function *does* set the blocksize field of the
+ * header properly, based on the size of the header block.  */
 gboolean        device_start_file       (Device * self,
-                                         const dumpfile_t * jobInfo);
-
-guint           device_write_min_size   (Device * self);
-guint           device_write_max_size   (Device * self);
-guint           device_read_max_size   (Device * self);
+                                         dumpfile_t * jobInfo);
 
-/* Does what you expect. size had better be inside the block size
- * range, or this function will write nothing.
- *
- * The short_block parameter needs some additional explanation: If
- * short_block is set to TRUE, then this function will accept a write
- * smaller than the minimum block size, subject to the following
- * caveats:
- * % The block may be padded with NULL bytes, which will be present on
- *   restore.
- * % device_write_block will automatically call device_finish_file()
- *   after writing this short block.
- * It is permitted to use short_block with a block that is not short;
- * in this case, it is equivalent to calling device_write() and then
- * calling device_finish_file(). */
+/* Does what you expect. Size must be device->block_size or less.
+ * If less, then this is the final block in the file, and no more blocks
+ * may be written until finish_file and start_file have been called. */
 gboolean       device_write_block      (Device * self,
                                          guint size,
-                                         gpointer data,
-                                         gboolean short_block);
+                                         gpointer data);
 
 /* This will drain the given fd (reading until EOF), and write the
- * resulting data out to the device using maximally-sized blocks. */
+ * resulting data out to the device using maximally-sized blocks.
+ * This function does not call device_finish_file automatically.
+ */
 gboolean       device_write_from_fd    (Device * self,
-                                       int fd);
+                                       queue_fd_t *queue_fd);
 
-/* Call this when you are finished writing a file. This function will
- * write a filemark or the local equivalent, flush the buffers, and do
- * whatever dirty work needs to be done at such a point in time. */
+/* Call this when you are finished writing a file.
+ * This function will write a filemark or the local
+ * equivalent, flush the buffers, and do whatever dirty work needs
+ * to be done at such a point in time. */
 gboolean       device_finish_file      (Device * self);
 
 /* For reading only: Seeks to the beginning of a particular
@@ -247,10 +340,11 @@ gboolean  device_finish_file      (Device * self);
  * ACCESS_WRITE will start you out at the first file, and opening in
  * ACCESS_APPEND will automatically seek to the end of the medium.
  * 
- * If the requested file doesn't exist, this function will seek to the
- * next-numbered valid file. You can check where this function seeked to
- * by examining the file field of the Device structure. If the requested
- * file number is exactly one more than the last valid file, this
+ * If the requested file doesn't exist, as might happen when a volume has
+ * had files recycled, then this function will seek to the next file that
+ * does exist. You can check which file this function selected by
+ * examining the file field of the Device structure. If the requested
+ * file number is *exactly* one more than the last valid file, this
  * function returns a TAPEEND header.
  *
  * If an error occurs or if the requested file is two or more beyond the
@@ -282,39 +376,53 @@ gboolean  device_seek_block       (Device * self,
  * no read is performed, the function returns 0, and *size is set
  * to the minimum buffer size required to read the next block. If an
  * error occurs, the function returns -1  and *size is left unchanged.
- * 
- * It is not an error if buffer == NULL and *size == 0. This should be
- * treated as a query as to the possible size of the next block. */
-int    device_read_block       (Device * self,
-                                 gpointer buffer,
-                                 int * size);
+ *
+ * Note that this function may request a block size bigger than
+ * dev->block_size, if it discovers an oversized block.  This allows Amanda to
+ * read from volumes regardless of the block size used to write them. It is not
+ * an error if buffer == NULL and *size == 0. This should be treated as a query
+ * as to the possible size of the next block, although it is not an error for
+ * the next read to request an even larger block size.  */
+int    device_read_block       (Device * self, gpointer buffer, int * size);
 
 /* This is the reading equivalent of device_write_from_fd(). It will
  * read from the device from the current location until end of file,
  * and drains the results out into the specified fd. Returns FALSE if
  * there is a problem writing to the fd. */
 gboolean       device_read_to_fd       (Device * self,
-                                       int fd);
+                                       queue_fd_t *queue_fd);
 
-/* This function tells you what properties are supported by this
- * device, and when you are allowed to get and set them. The return
- * value is an array of DeviceProperty structs. The last struct in
- * the array is zeroed, so you know when the end is (check the
- * pointer element "base"). The return value from this function on any
- * given object (or physical device) should be invariant. */
-const DeviceProperty *         device_property_get_list        (Device * self);
+/* This function tells you what properties are supported by this device, and
+ * when you are allowed to get and set them. The return value is an list of
+ * DeviceProperty structs.  Do not free the resulting list. */
+const GSList * device_property_get_list        (Device * self);
 
 /* These functions get or set a particular property. The val should be
  * compatible with the DevicePropertyBase associated with the given
- * DevicePropertyId, and this function should only be called when
- * DeviceProperty.access says it is OK. Otherwise you will get an
- * error and not the tasty property action you wanted. */
-gboolean       device_property_get     (Device * self,
+ * DevicePropertyId, and these functions should only be called when
+ * DeviceProperty.access says it is OK. Otherwise you will get an error and not
+ * the tasty property action you wanted.
+ *
+ * All device_property_get_ex parameters but the first two are output
+ * parameters, and can be left NULL if you are not interested in their value.
+ * If you only need the value, use the simpler device_property_get macro. */
+
+gboolean       device_property_get_ex  (Device * self,
                                          DevicePropertyId id,
-                                         GValue * val);
-gboolean       device_property_set     (Device * self,
+                                         GValue * val,
+                                        PropertySurety *surety,
+                                        PropertySource *source);
+#define                device_property_get(self, id, val) \
+    device_property_get_ex((self), (id), (val), NULL, NULL)
+
+gboolean       device_property_set_ex  (Device * self,
                                          DevicePropertyId id,
-                                         GValue * val);
+                                         GValue * val,
+                                        PropertySurety surety,
+                                        PropertySource source);
+#define                device_property_set(self, id, val) \
+    device_property_set_ex((self), (id), (val), \
+           PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_USER)
 
 /* On devices that support it (check PROPERTY_PARTIAL_DELETION),
  * this will free only the space associated with a particular file. 
@@ -332,28 +440,12 @@ gboolean  device_recycle_file     (Device * self,
 
 /* Protected methods. Don't call these except in subclass implementations. */
 
-/* Registers a new device / property pair. Every superclass of Device
- * should call this in its init() function. At the moment, any
- * particular property Id can only be registered once per object.
- *
- * If you want to register a standard response to a property (e.g.,
- * whether or not the device supports compression), you can pass a
- * non-NULL response. Then the default implementation of
- * device_get_property (which you may override) will return this
- * response.
- * The contents of prop and response are copied into a private array, so the
- * calling function retains ownership of all arguments.
- */
-void            device_add_property(Device * self, DeviceProperty * prop,
-                                    GValue * response);
-
 /* This method provides post-construction initalization once the
  * device name is known. It should only be used by Device
  * factories. It is provided here as a virtual method (instead of
  * a static function) because some devices may want to chain
  * initilization to their parents. */
-gboolean device_open_device (Device * self,
-                             char * device_name);
+void device_open_device (Device * self, char *device_name, char *device_type, char *device_node);
 
 /* Builds a proper header based on device block size possibilities.
  * If non-null, size is filled in with the number of bytes that should
@@ -371,13 +463,54 @@ dumpfile_t * make_tapestart_header(Device * self, char * label,
 /* Does what you expect. Uses the current time. */
 dumpfile_t * make_tapeend_header(void);
 
-/* Set up first-run properties from loaded configuration file, including
- * DEVICE_MAX_VOLUME_USAGE property based on the tapetype. */
-void device_set_startup_properties_from_config(Device * device);
-
 /* Erase any stored volume information. Use this if something happens (e.g.,
  * a property is set) that voids previously-read volume details.
  * This function is a NOOP unless the device is in the NULL state. */
 void device_clear_volume_details(Device * device);
 
+/* Property Handling */
+
+/* Registers a property for a new device class; device drivers' GClassInitFunc
+ * should call this function for each device-specific property of the class.
+ * If either getter or setter is NULL, then the corresponding operation will
+ * return FALSE.
+ *
+ * Note that this will replace any existing registration (e.g., from a parent
+ * class).
+ */
+void device_class_register_property(DeviceClass *klass, DevicePropertyId id,
+                                   PropertyAccessFlags access,
+                                   PropertyGetFn getter,
+                                   PropertySetFn setter);
+
+/* Set a 'simple' property on the device.  This tucks the value away in the
+ * object, to be retrieved by device_simple_property_get_fn.  This is most
+ * often used in GInstanceInit functions, but can be used at any time to set or
+ * change the value of a simple property */
+gboolean device_set_simple_property(Device *self, DevicePropertyId id,
+                               GValue *val, PropertySurety surety,
+                               PropertySource source);
+
+/* Get a simple property set with device_set_simple_property.  This is a little
+ * bit quicker than calling device_property_get_ex(), and does not affect the
+ * device's error state.  Returns FALSE if the property has not been set.
+ * Surety and source are output parameters and will be ignored if they are
+ * NULL. */
+gboolean device_get_simple_property(Device *self, DevicePropertyId id,
+                                   GValue *val, PropertySurety *surety,
+                                   PropertySource *source);
+
+/* A useful PropertySetFn.  If your subclass also needs to intercept sets, for
+ * example to flush a cache or update a member variable, then write a stub
+ * function which "calls up" to this function. */
+gboolean device_simple_property_set_fn(Device *self, DevicePropertyBase *base,
+                                      GValue *val, PropertySurety surety,
+                                      PropertySource source);
+
+/* A useful PropertyGetFn -- returns the value, source, and surety set with
+ * device_set_simple_property */
+gboolean device_simple_property_get_fn(Device *self, DevicePropertyBase *base,
+                                      GValue *val, PropertySurety *surety,
+                                      PropertySource *source);
+
 #endif /* DEVICE_H */
index a6b1a0256af0e1d8884e0479bc4eeba890bf858b..eefa4acd1c84f9c6cf379b5c6758acf51c2cf240 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+ * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
  * 
  * This library is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License version 2.1 as 
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  * 
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 #include "amanda.h"
 #include "device.h"
-#include "null-device.h"
 
 #define NULL_DEVICE_MIN_BLOCK_SIZE (1)
-#define NULL_DEVICE_MAX_BLOCK_SIZE SHRT_MAX
+#define NULL_DEVICE_MAX_BLOCK_SIZE (INT_MAX)
+#define NULL_DEVICE_DEFAULT_BLOCK_SIZE DISK_BLOCK_BYTES
+
+/*
+ * Type checking and casting macros
+ */
+#define TYPE_NULL_DEVICE       (null_device_get_type())
+#define NULL_DEVICE(obj)       G_TYPE_CHECK_INSTANCE_CAST((obj), null_device_get_type(), NullDevice)
+#define NULL_DEVICE_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), null_device_get_type(), NullDevice const)
+#define NULL_DEVICE_CLASS(klass)       G_TYPE_CHECK_CLASS_CAST((klass), null_device_get_type(), NullDeviceClass)
+#define IS_NULL_DEVICE(obj)    G_TYPE_CHECK_INSTANCE_TYPE((obj), null_device_get_type ())
+#define NULL_DEVICE_GET_CLASS(obj)     G_TYPE_INSTANCE_GET_CLASS((obj), null_device_get_type(), NullDeviceClass)
+static GType null_device_get_type (void);
+
+/*
+ * Main object structure
+ */
+typedef struct _NullDevice NullDevice;
+struct _NullDevice {
+       Device __parent__;
+};
+
+/*
+ * Class definition
+ */
+typedef struct _NullDeviceClass NullDeviceClass;
+struct _NullDeviceClass {
+    DeviceClass __parent__;
+    gboolean in_file;
+};
+
+void null_device_register(void);
 
 /* here are local prototypes */
 static void null_device_init (NullDevice * o);
 static void null_device_class_init (NullDeviceClass * c);
+static void null_device_base_init (NullDeviceClass * c);
+static DeviceStatusFlags null_device_read_label(Device * dself);
+static void null_device_open_device(Device * self, char *device_name,
+                                   char * device_type, char * device_node);
 static gboolean null_device_start (Device * self, DeviceAccessMode mode,
                                    char * label, char * timestamp);
-static gboolean null_device_write_block (Device * self, guint size,
-                                         gpointer data, gboolean last);
-static Device* null_device_factory(char * device_type,
-                                   char * device_name);
+static gboolean null_device_finish (Device * pself);
+static gboolean null_device_start_file(Device * self, dumpfile_t * jobInfo);
+static gboolean null_device_write_block (Device * self, guint size, gpointer data);
+static gboolean null_device_finish_file(Device * self);
+static Device* null_device_factory(char * device_name, char * device_type, char * device_node);
 
 /* pointer to the class of our parent */
 static DeviceClass *parent_class = NULL;
@@ -43,7 +78,7 @@ void null_device_register(void) {
     register_device(null_device_factory, device_prefix_list);
 }
 
-GType
+static GType
 null_device_get_type (void)
 {
     static GType type = 0;
@@ -51,7 +86,7 @@ null_device_get_type (void)
     if G_UNLIKELY(type == 0) {
         static const GTypeInfo info = {
             sizeof (NullDeviceClass),
-            (GBaseInitFunc) NULL,
+            (GBaseInitFunc) null_device_base_init,
             (GBaseFinalizeFunc) NULL,
             (GClassInitFunc) null_device_class_init,
             (GClassFinalizeFunc) NULL,
@@ -72,124 +107,178 @@ null_device_get_type (void)
 static void 
 null_device_init (NullDevice * self)
 {
-    Device * o;
-    DeviceProperty prop;
+    Device * dself;
     GValue response;
 
-    o = (Device*)(self);
+    dself = (Device*)(self);
     bzero(&response, sizeof(response));
 
     /* Register properties */
-    prop.base = &device_property_concurrency;
-    prop.access = PROPERTY_ACCESS_GET_MASK;
     g_value_init(&response, CONCURRENCY_PARADIGM_TYPE);
     g_value_set_enum(&response, CONCURRENCY_PARADIGM_RANDOM_ACCESS);
-    device_add_property(o, &prop, &response);
+    device_set_simple_property(dself, PROPERTY_CONCURRENCY,
+           &response, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DETECTED);
     g_value_unset(&response);
-    
 
-    prop.base = &device_property_streaming;
     g_value_init(&response, STREAMING_REQUIREMENT_TYPE);
     g_value_set_enum(&response, STREAMING_REQUIREMENT_NONE);
-    device_add_property(o, &prop, &response);
-    g_value_unset(&response);
-    
-    prop.base = &device_property_block_size;
-    g_value_init(&response, G_TYPE_INT);
-    g_value_set_int(&response, -1);
-    device_add_property(o, &prop, &response);
-    g_value_unset(&response);
-    
-    prop.base = &device_property_min_block_size;
-    g_value_init(&response, G_TYPE_UINT);
-    g_value_set_uint(&response, NULL_DEVICE_MIN_BLOCK_SIZE);
-    device_add_property(o, &prop, &response);
-
-    prop.base = &device_property_max_block_size;
-    g_value_set_uint(&response, NULL_DEVICE_MAX_BLOCK_SIZE);
-    device_add_property(o, &prop, &response);
+    device_set_simple_property(dself, PROPERTY_STREAMING,
+           &response, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DETECTED);
     g_value_unset(&response);
 
-    prop.base = &device_property_appendable;
     g_value_init(&response, G_TYPE_BOOLEAN);
     g_value_set_boolean(&response, FALSE);
-    device_add_property(o, &prop, &response);
+    device_set_simple_property(dself, PROPERTY_APPENDABLE,
+           &response, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DETECTED);
+    g_value_unset(&response);
 
-    prop.base = &device_property_partial_deletion;
-    device_add_property(o, &prop, &response);
+    g_value_init(&response, G_TYPE_BOOLEAN);
+    g_value_set_boolean(&response, FALSE);
+    device_set_simple_property(dself, PROPERTY_PARTIAL_DELETION,
+           &response, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DETECTED);
     g_value_unset(&response);
 
-    prop.base = &device_property_canonical_name;
+    /* this device's canonical name is always "null:", regardless of
+     * the name the user supplies; note that we install the simple
+     * getter in null_device_class_init. */
     g_value_init(&response, G_TYPE_STRING);
     g_value_set_static_string(&response, "null:");
-    device_add_property(o, &prop, &response);
+    device_set_simple_property(dself, PROPERTY_CANONICAL_NAME,
+           &response, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DEFAULT);
     g_value_unset(&response);
 
-    prop.base = &device_property_medium_access_type;
     g_value_init(&response, MEDIA_ACCESS_MODE_TYPE);
     g_value_set_enum(&response, MEDIA_ACCESS_MODE_WRITE_ONLY);
-    device_add_property(o, &prop, &response);
+    device_set_simple_property(dself, PROPERTY_MEDIUM_ACCESS_TYPE,
+           &response, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DETECTED);
     g_value_unset(&response);
 }
 
 static void 
-null_device_class_init (NullDeviceClass * c G_GNUC_UNUSED)
+null_device_class_init (NullDeviceClass * c)
 {
     DeviceClass *device_class = (DeviceClass *)c;
 
     parent_class = g_type_class_ref (TYPE_DEVICE);
 
+    device_class->read_label = null_device_read_label;
+    device_class->open_device = null_device_open_device;
     device_class->start = null_device_start;
+    device_class->finish = null_device_finish;
+    device_class->start_file = null_device_start_file;
     device_class->write_block = null_device_write_block;
+    device_class->finish_file = null_device_finish_file;
 }
 
+static void
+null_device_base_init (NullDeviceClass * c)
+{
+    DeviceClass *device_class = (DeviceClass *)c;
 
-static Device* null_device_factory(char * device_type,
-                                   char * device_name G_GNUC_UNUSED) {
+    /* Our canonical name is simpler than most devices' */
+    device_class_register_property(device_class, PROPERTY_CANONICAL_NAME,
+           PROPERTY_ACCESS_GET_MASK,
+           device_simple_property_get_fn,
+           device_simple_property_set_fn);
+}
+
+
+static Device* null_device_factory(char * device_name, char * device_type, char * device_node) {
+    Device * device;
     g_assert(0 == strcmp(device_type, "null"));
-    return DEVICE(g_object_new(TYPE_NULL_DEVICE, NULL));
-    
+    device = DEVICE(g_object_new(TYPE_NULL_DEVICE, NULL));
+    device_open_device(device, device_name, device_type, device_node);
+    return device;
 }
 
 /* Begin virtual function overrides */
 
-static gboolean 
+static DeviceStatusFlags
+null_device_read_label(Device * dself) {
+    if (device_in_error(dself)) return FALSE;
+
+    device_set_error(dself,
+       stralloc(_("Can't open NULL device for reading or appending.")),
+       DEVICE_STATUS_DEVICE_ERROR);
+    return FALSE;
+}
+
+static void
+null_device_open_device(Device * pself, char *device_name,
+                       char * device_type, char * device_node)
+{
+    pself->min_block_size = NULL_DEVICE_MIN_BLOCK_SIZE;
+    pself->max_block_size = NULL_DEVICE_MAX_BLOCK_SIZE;
+    pself->block_size = NULL_DEVICE_DEFAULT_BLOCK_SIZE;
+
+    if (parent_class->open_device) {
+        parent_class->open_device(pself, device_name, device_type, device_node);
+    }
+}
+
+static gboolean
 null_device_start (Device * pself, DeviceAccessMode mode,
                    char * label, char * timestamp) {
     NullDevice * self;
     self = NULL_DEVICE(pself);
-    g_return_val_if_fail (self != NULL, FALSE);
+
+    if (device_in_error(self)) return FALSE;
+
+    pself->access_mode = mode;
+    pself->in_file = FALSE;
 
     if (mode == ACCESS_WRITE) {
-        if (parent_class->start) {
-            return parent_class->start((Device*)self, mode, label, timestamp);
-        } else {
-            return TRUE;
-        }
+        pself->volume_label = newstralloc(pself->volume_label, label);
+        pself->volume_time = newstralloc(pself->volume_time, timestamp);
+       return TRUE;
     } else {
-        g_fprintf(stderr, "Can't open NULL device for reading or appending.\n");
+       device_set_error(pself,
+           stralloc(_("Can't open NULL device for reading or appending.")),
+           DEVICE_STATUS_DEVICE_ERROR);
         return FALSE;
     }
 }
 
+/* This default implementation does very little. */
 static gboolean
-null_device_write_block (Device * pself, guint size, gpointer data,
-                         gboolean last_block) {
+null_device_finish (Device * pself) {
+    if (device_in_error(pself)) return FALSE;
+
+    pself->access_mode = ACCESS_NULL;
+    return TRUE;
+}
+
+static gboolean
+null_device_start_file(Device * d_self,
+                   dumpfile_t * jobInfo G_GNUC_UNUSED)
+{
+    d_self->in_file = TRUE;
+    d_self->block = 0;
+    if (d_self->file <= 0)
+        d_self->file = 1;
+    else
+        d_self->file ++;
+
+    return TRUE;
+}
+
+static gboolean
+null_device_write_block (Device * pself, guint size G_GNUC_UNUSED,
+           gpointer data G_GNUC_UNUSED) {
     NullDevice * self;
     self = NULL_DEVICE(pself);
-    g_return_val_if_fail (self != NULL, FALSE);
-    g_return_val_if_fail (data != NULL, FALSE);
-    
-    if ((size < NULL_DEVICE_MIN_BLOCK_SIZE && !last_block) ||
-        size > NULL_DEVICE_MAX_BLOCK_SIZE) {
-        return FALSE;
-    } else {
-        if (parent_class->write_block) {
-            /* Calls device_finish_file(). */
-            parent_class->write_block((Device*)self, size, data, last_block);
-        }
-        return TRUE;
-    }
 
-    g_assert_not_reached();
+    if (device_in_error(self)) return FALSE;
+
+    pself->block++;
+
+    return TRUE;
+}
+
+static gboolean
+null_device_finish_file(Device * pself) {
+    if (device_in_error(pself)) return FALSE;
+
+    pself->in_file = FALSE;
+    return TRUE;
 }
diff --git a/device-src/null-device.h b/device-src/null-device.h
deleted file mode 100644 (file)
index b68a824..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
- * 
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License version 2.1 as 
- * published by the Free Software Foundation.
- * 
- * This 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 this library; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
- * 
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
- */
-
-/* The NULL device accepts data and sends it to the bit bucket. Like
-   /dev/null, you cannot read from the NULL device -- only
-   write. While useful for testing, the NULL device is incredibly
-   dangerous in practice (because it eats your data). So it will
-   generate warnings whenever you use it. */
-
-#include <glib.h>
-#include <glib-object.h>
-#ifndef __NULL_DEVICE_H__
-#define __NULL_DEVICE_H__
-
-/* This header file is very boring, because the class just overrides
-   existing methods. */
-
-/*
- * Type checking and casting macros
- */
-#define TYPE_NULL_DEVICE       (null_device_get_type())
-#define NULL_DEVICE(obj)       G_TYPE_CHECK_INSTANCE_CAST((obj), null_device_get_type(), NullDevice)
-#define NULL_DEVICE_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), null_device_get_type(), NullDevice const)
-#define NULL_DEVICE_CLASS(klass)       G_TYPE_CHECK_CLASS_CAST((klass), null_device_get_type(), NullDeviceClass)
-#define IS_NULL_DEVICE(obj)    G_TYPE_CHECK_INSTANCE_TYPE((obj), null_device_get_type ())
-
-#define NULL_DEVICE_GET_CLASS(obj)     G_TYPE_INSTANCE_GET_CLASS((obj), null_device_get_type(), NullDeviceClass)
-
-/*
- * Main object structure
- */
-#ifndef __TYPEDEF_NULL_DEVICE__
-#define __TYPEDEF_NULL_DEVICE__
-typedef struct _NullDevice NullDevice;
-#endif
-struct _NullDevice {
-       Device __parent__;
-};
-
-/*
- * Class definition
- */
-typedef struct _NullDeviceClass NullDeviceClass;
-struct _NullDeviceClass {
-    DeviceClass __parent__;
-    gboolean in_file;
-};
-
-
-/*
- * Public methods
- */
-GType  null_device_get_type    (void);
-void    null_device_register    (void);
-
-#endif
index 3980a3f6c2326b5f3e84a6b02a95ab6c3d0db38f..275cc8088bf0871a2324945466e9fae6b2db9467 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+ * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
  * 
  * This library is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License version 2.1 as 
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  * 
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 #include "amanda.h"
 
 #include "property.h"
+#include "glib-util.h"
+
+/*****
+ * Property-specific Types, etc.
+ */
 
 static const GEnumValue _concurrency_paradigm_values[] = {
         { CONCURRENCY_PARADIGM_EXCLUSIVE,
@@ -93,7 +98,7 @@ GType media_access_mode_get_type (void) {
 
 /* Copy function for GBoxed QualifiedSize. */
 static gpointer qualified_size_copy(gpointer source) {
-    gpointer rval = malloc(sizeof(QualifiedSize));
+    gpointer rval = g_new(QualifiedSize, 1);
     memcpy(rval, source, sizeof(QualifiedSize));
     return rval;
 }
@@ -108,122 +113,98 @@ GType qualified_size_get_type (void) {
     return type;
 }
 
-static const GFlagsValue _feature_support_flags_values[] = {
-    { FEATURE_STATUS_ENABLED,
-      "FEATURE_STATUS_ENABLED",
-      "enabled" },
-    { FEATURE_STATUS_DISABLED,
-      "FEATURE_STATUS_DISABLED",
-      "disabled" },
-    { FEATURE_SURETY_BAD,
-      "FEATURE_SURETY_BAD",
-      "bad" },
-    { FEATURE_SURETY_GOOD,
-      "FEATURE_SURETY_GOOD",
-      "good" },
-    { FEATURE_SOURCE_DEFAULT,
-      "FEATURE_SOURCE_DEFAULT",
-      "default" },
-    { FEATURE_SOURCE_DETECTED,
-      "FEATURE_SOURCE_DETECTED",
-      "detected" },
-    { FEATURE_SOURCE_USER,
-      "FEATURE_SOURCE_USER",
-      "user"},
-    { 0, NULL, NULL }
-};
+/******
+ * Property registration and lookup
+ */
 
-GType feature_support_get_type (void) {
-    static GType type = 0;
-    if (G_UNLIKELY(type == 0)) {
-        type = g_flags_register_static ("FeatureSupportFlags",
-                                        _feature_support_flags_values);
-    }
-    return type;
-}
+static GPtrArray *device_property_bases = NULL;
+static GHashTable *device_property_bases_by_name = NULL;
 
-gboolean feature_support_flags_is_valid(FeatureSupportFlags f) {
-    int status = 0, surety = 0, source = 0;
-
-    if (f & FEATURE_STATUS_ENABLED)
-        status ++;
-    if (f & FEATURE_STATUS_DISABLED)
-        status ++;
-    if (f & FEATURE_SURETY_BAD)
-        surety ++;
-    if (f & FEATURE_SURETY_GOOD)
-        surety ++;
-    if (f & FEATURE_SOURCE_DEFAULT)
-        source ++;
-    if (f & FEATURE_SOURCE_DETECTED)
-        source ++;
-    if (f & FEATURE_SOURCE_USER)
-        source ++;
-
-    return (!(f & ~FEATURE_SUPPORT_FLAGS_MASK) &&
-            status == 1  &&  surety == 1  &&  source == 1);
+DevicePropertyBase* device_property_get_by_id(DevicePropertyId id) {
+    if (!device_property_bases || id >= device_property_bases->len)
+       return NULL;
+
+    return g_ptr_array_index(device_property_bases, id);
 }
 
-static GSList* device_property_base_list = NULL;
+DevicePropertyBase* device_property_get_by_name(const char *name) {
+    gpointer rv;
 
-const DevicePropertyBase* device_property_get_by_id(DevicePropertyId id) {
-    GSList *iter;
+    if (!device_property_bases_by_name)
+       return NULL;
 
-    iter = device_property_base_list;
-    while (iter != NULL) {
-        DevicePropertyBase* rval = (DevicePropertyBase*)(iter->data);
-        if (rval->ID == id) {
-            return rval;
-        }
-        iter = g_slist_next(iter);
-    }
+    rv = g_hash_table_lookup(device_property_bases_by_name, name);
+    if (rv)
+       return (DevicePropertyBase *)rv;
 
     return NULL;
 }
 
-const DevicePropertyBase* device_property_get_by_name(const char *name) {
-    GSList *iter = device_property_base_list;
+#define toupper_and_underscore(c) (((c)=='-')? '_' : g_ascii_toupper((c)))
+static guint
+device_property_hash(
+       gconstpointer key)
+{
+    /* modified version of glib's hash function, copyright
+     * GLib Team and others 1997-2000. */
+    const char *p = key;
+    guint h = toupper_and_underscore(*p);
+
+    if (h)
+       for (p += 1; *p != '\0'; p++)
+           h = (h << 5) - h + toupper_and_underscore(*p);
+
+    return h;
+}
 
-    g_return_val_if_fail(name != NULL, NULL);
+static gboolean
+device_property_equal(
+       gconstpointer v1,
+       gconstpointer v2)
+{
+    const char *s1 = v1, *s2 = v2;
 
-    while (iter != NULL) {
-        DevicePropertyBase* rval = (DevicePropertyBase*)(iter->data);
-        if (strcasecmp(rval->name, name) == 0) {
-            return rval;
-        }
-        iter = g_slist_next(iter);
+    while (*s1 && *s2) {
+       if (toupper_and_underscore(*s1) != toupper_and_underscore(*s2))
+           return FALSE;
+       s1++, s2++;
     }
+    if (*s1 || *s2)
+       return FALSE;
 
-    return NULL;
+    return TRUE;
 }
 
-DevicePropertyId device_property_register(DevicePropertyBase* base) {
-    static guint id = 0;
-    g_assert(base != NULL);
-    g_assert(base->ID == -1);
-    g_assert(base->name != NULL);
-    g_assert(base->description != NULL);
-    
-    base->ID = id++;
-
-    device_property_base_list = g_slist_prepend(device_property_base_list,
-                                                base);
-    return id;
-}
+void
+device_property_fill_and_register(DevicePropertyBase *base,
+                   GType type, const char * name, const char * desc) {
+
+    /* create the hash table and array if necessary */
+    if (!device_property_bases) {
+       device_property_bases = g_ptr_array_new();
+       device_property_bases_by_name = g_hash_table_new(device_property_hash, device_property_equal);
+    }
 
-/* Does the same thing, but fills in a new DevicePropertyBase. */
-static void
-device_property_fill_and_register(DevicePropertyBase * base,
-                                  GType type,
-                                  const char * name,
-                                  const char * desc) {
+    /* check for a duplicate */
+    if (device_property_get_by_name(name)) {
+       g_critical("A property named '%s' already exists!", name);
+    }
+
+    /* allocate space for this DPB and fill it in */
+    base->ID = device_property_bases->len;
     base->type = type;
-    base->name = name;
-    base->description = desc;
-    base->ID = -1;
-    device_property_register(base);
+    base->name = name; /* no strdup -- it's statically allocated */
+    base->description = desc; /* ditto */
+
+    /* add it to the array and hash table; note that its array index and its
+     * ID are the same. */
+    g_ptr_array_add(device_property_bases, base);
+    g_hash_table_insert(device_property_bases_by_name, (gpointer)name, (gpointer)base);
 }
 
+/******
+ * Initialization
+ */
 
 void device_property_init(void) {
     device_property_fill_and_register(&device_property_concurrency,
@@ -241,13 +222,16 @@ void device_property_init(void) {
           "averaged for some (currently undefined) period of time)");
     device_property_fill_and_register(&device_property_block_size,
                                       G_TYPE_INT, "block_size",
-                                      "Device blocking factor in bytes.");
+                                      "Block size to use while writing.");
     device_property_fill_and_register(&device_property_min_block_size,
                                       G_TYPE_UINT, "min_block_size",
       "Minimum supported blocking factor.");
     device_property_fill_and_register(&device_property_max_block_size,
                                       G_TYPE_UINT, "max_block_size",
       "Maximum supported blocking factor.");
+    device_property_fill_and_register(&device_property_read_buffer_size,
+                                      G_TYPE_UINT, "read_buffer_size",
+      "Minimum size of a read for this device (maximum expected block size)");
     device_property_fill_and_register(&device_property_appendable,
                                       G_TYPE_BOOLEAN, "appendable",
       "Does device support appending to previously-written media?");
@@ -267,43 +251,6 @@ void device_property_init(void) {
     device_property_fill_and_register(&device_property_max_volume_usage,
                                       G_TYPE_UINT64, "max_volume_usage",
       "Artificial limit to data written to volume.");
-    device_property_fill_and_register(&device_property_fsf,
-                                      FEATURE_SUPPORT_FLAGS_TYPE, "fsf",
-      "Does this drive support the MTFSF command?");
-    device_property_fill_and_register(&device_property_bsf,
-                                      FEATURE_SUPPORT_FLAGS_TYPE, "bsf",
-      "Does this drive support the MTBSF command?" );
-    device_property_fill_and_register(&device_property_fsr,
-                                      FEATURE_SUPPORT_FLAGS_TYPE, "fsr",
-      "Does this drive support the MTFSR command?");
-    device_property_fill_and_register(&device_property_bsr,
-                                      FEATURE_SUPPORT_FLAGS_TYPE, "bsr",
-      "Does this drive support the MTBSR command?");
-    /* FIXME: Is this feature even useful? */
-    device_property_fill_and_register(&device_property_eom,
-                                      FEATURE_SUPPORT_FLAGS_TYPE, "eom",
-      "Does this drive support the MTEOM command?");
-    device_property_fill_and_register(&device_property_bsf_after_eom,
-                                      FEATURE_SUPPORT_FLAGS_TYPE,
-                                      "bsf_after_eom",
-      "Does this drive require an MTBSF after MTEOM in order to append?" );
-    device_property_fill_and_register(&device_property_final_filemarks,
-                                      G_TYPE_UINT, "final_filemarks",
-      "How many filemarks to write after the last tape file?" );
-    device_property_fill_and_register(&device_property_read_buffer_size,
-                                      G_TYPE_UINT, "read_buffer_size",
-      "What buffer size should be used for reading?");
-    device_property_fill_and_register(&device_property_s3_secret_key,
-                                      G_TYPE_STRING, "s3_secret_key",
-       "Secret access key to authenticate with Amazon S3");
-    device_property_fill_and_register(&device_property_s3_access_key,
-                                      G_TYPE_STRING, "s3_access_key",
-       "Access key ID to authenticate with Amazon S3");
-#ifdef WANT_DEVPAY
-    device_property_fill_and_register(&device_property_s3_user_token,
-                                      G_TYPE_STRING, "s3_user_token",
-       "User token for authentication Amazon devpay requests");
-#endif
     device_property_fill_and_register(&device_property_verbose,
                                      G_TYPE_BOOLEAN, "verbose",
        "Should the device produce verbose output?");
@@ -316,21 +263,11 @@ DevicePropertyBase device_property_compression_rate;
 DevicePropertyBase device_property_block_size;
 DevicePropertyBase device_property_min_block_size;
 DevicePropertyBase device_property_max_block_size;
+DevicePropertyBase device_property_read_buffer_size;
 DevicePropertyBase device_property_appendable;
 DevicePropertyBase device_property_canonical_name;
 DevicePropertyBase device_property_medium_access_type;
 DevicePropertyBase device_property_partial_deletion;
 DevicePropertyBase device_property_free_space;
 DevicePropertyBase device_property_max_volume_usage;
-DevicePropertyBase device_property_fsf;
-DevicePropertyBase device_property_bsf;
-DevicePropertyBase device_property_fsr;
-DevicePropertyBase device_property_bsr;
-DevicePropertyBase device_property_eom;
-DevicePropertyBase device_property_bsf_after_eom;
-DevicePropertyBase device_property_final_filemarks;
-DevicePropertyBase device_property_read_buffer_size;
-DevicePropertyBase device_property_s3_access_key;
-DevicePropertyBase device_property_s3_secret_key;
-DevicePropertyBase device_property_s3_user_token;
 DevicePropertyBase device_property_verbose;
index 8138a05a2ace7662f7949c4ff60c232b57191e9e..273f2de416df07dea30e7c8fc07a63764b40178c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+ * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
  * 
  * This library is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License version 2.1 as 
@@ -14,8 +14,8 @@
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  * 
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 #ifndef DEVICE_PROPERTY_H
@@ -23,6 +23,7 @@
 
 #include <glib.h>
 #include <glib-object.h>
+#include "queueing.h" /* for StreamingRequirement */
 
 /* The properties interface defines define capabilities and other interesting
  * properties. */
@@ -37,7 +38,7 @@ typedef enum {
 } PropertyPhaseFlags;
 
 #define PROPERTY_PHASE_MASK (PROPERTY_PHASE_MAX-1)
-#define PROPERTY_PHASE_SHIFT (PROPERTY_PHASE_MASK/2)
+#define PROPERTY_PHASE_SHIFT 8
 
 typedef enum {
     PROPERTY_ACCESS_GET_BEFORE_START = (PROPERTY_PHASE_BEFORE_START),
@@ -63,13 +64,37 @@ typedef enum {
 #define PROPERTY_ACCESS_GET_MASK (PROPERTY_PHASE_MASK)
 #define PROPERTY_ACCESS_SET_MASK (PROPERTY_PHASE_MASK << PROPERTY_PHASE_SHIFT)
 
+/* Some properties can only be occasionally (or unreliably) detected, so
+ * this enum allows the user to override the detected or default
+ * setting.  Surety indicates a level of confidence in the value, while
+ * source describes how we found out about it. */
+typedef enum {
+    /* Support is not based on conclusive evidence. */
+    PROPERTY_SURETY_BAD,
+    /* Support is based on conclusive evidence. */
+    PROPERTY_SURETY_GOOD,
+} PropertySurety;
 
-/* This structure is usually statically allocated.
- * It holds information about a property that is common to all devices of
- * a given type. */
+typedef enum {
+    /* property is from default setting. */
+    PROPERTY_SOURCE_DEFAULT,
+    /* property is from device query. */
+    PROPERTY_SOURCE_DETECTED,
+    /* property is from user override (configuration). */
+    PROPERTY_SOURCE_USER,
+} PropertySource;
+
+/*****
+ * Initialization
+ */
 
-typedef int DevicePropertyId;
+/* This should be called exactly once from device_api_init(). */
+extern void device_property_init(void);
 
+/* This structure is usually statically allocated.  It holds information about
+ * a property that is common across all devices.
+ */
+typedef guint DevicePropertyId;
 typedef struct {
     DevicePropertyId ID; /* Set by device_property_register() */
     GType type;
@@ -77,24 +102,55 @@ typedef struct {
     const char *description;
 } DevicePropertyBase;
 
-/* This structure is usually held inside a Device object. It holds
- * information about a property that is specific to the device/medium
- * in question. */
-typedef struct {
-    const DevicePropertyBase *base;
-    PropertyAccessFlags access;
-} DeviceProperty;
-
 /* Registers a new property and returns its ID. This function takes ownership
- * of its argument; it must not be freed later. */
+ * of its argument; it must not be freed later.  It should be called from a
+ * device driver's registration function. */
 extern DevicePropertyId device_property_register(DevicePropertyBase*);
 
-/* This should be called exactly once from device_api_init(). */
-extern void device_property_init(void);
+/* Does the same thing, but fills in a new DevicePropertyBase with the given
+ * values first, and does not return the ID.  This is more convenient for
+ * device-specific properties. */
+extern void device_property_fill_and_register(
+    DevicePropertyBase * base,
+    GType type,
+    const char * name,
+    const char * desc);
 
 /* Gets a DevicePropertyBase from its ID. */
-extern const DevicePropertyBase* device_property_get_by_id(DevicePropertyId);
-extern const DevicePropertyBase* device_property_get_by_name(const char*);
+DevicePropertyBase* device_property_get_by_id(DevicePropertyId);
+DevicePropertyBase* device_property_get_by_name(const char*);
+
+/*****
+ * Class-level Property Information
+ */
+
+/* This structure is held inside a Device object. It holds information about a
+ * property that is specific to the device driver, but not to a specific
+ * instance of the driver. */
+struct Device; /* forward declaration */
+typedef gboolean (*PropertySetFn)(
+    struct Device *self,
+    DevicePropertyBase *base,
+    GValue *val,
+    PropertySurety surety,
+    PropertySource source);
+typedef gboolean (*PropertyGetFn)(
+    struct Device *self,
+    DevicePropertyBase *base,
+    GValue *val,
+    PropertySurety *surety,
+    PropertySource *source);
+
+typedef struct {
+    DevicePropertyBase *base;
+    PropertyAccessFlags access;
+    PropertySetFn setter;
+    PropertyGetFn getter;
+} DeviceProperty;
+
+/*****
+ * Property-specific Types, etc.
+ */
 
 /* Standard property value types here.
  * Important: see property.c for the other half of type declarations.*/
@@ -106,11 +162,6 @@ typedef enum {
 #define CONCURRENCY_PARADIGM_TYPE concurrency_paradigm_get_type()
 GType concurrency_paradigm_get_type (void);
 
-typedef enum {
-    STREAMING_REQUIREMENT_NONE,
-    STREAMING_REQUIREMENT_DESIRED,
-    STREAMING_REQUIREMENT_REQUIRED
-} StreamingRequirement;
 #define STREAMING_REQUIREMENT_TYPE streaming_requirement_get_type()
 GType streaming_requirement_get_type (void);
 
@@ -138,46 +189,6 @@ typedef struct {
 #define QUALIFIED_SIZE_TYPE qualified_size_get_type()
 GType qualified_size_get_type (void);
 
-/* Some features can only be occasionally (or unreliably) detected, so
-   this enum allows the user to override the detected or default
-   setting. */
-typedef enum {
-    /* Feature support status. (exactly one of these is set) */
-        /* Feature is supported & will be used */
-        FEATURE_STATUS_ENABLED   = (1 << 0),
-        /* Features will not be used. */
-        FEATURE_STATUS_DISABLED  = (1 << 1),
-
-    /* Feature support confidence. (exactly one of these is set). */
-        /* Support is not based on conclusive evidence. */
-        FEATURE_SURETY_BAD       = (1 << 2),
-        /* Support is based on conclusive evidence. */
-        FEATURE_SURETY_GOOD      = (1 << 3),
-
-   /* Source of this information. (exactly one of these is set). */
-        /* Source of status is from default setting. */
-        FEATURE_SOURCE_DEFAULT   = (1 << 4),
-        /* Source of status is from device query. */
-        FEATURE_SOURCE_DETECTED  = (1 << 5),
-        /* Source of status is from user override. */
-        FEATURE_SOURCE_USER      = (1 << 6),
-
-    FEATURE_SUPPORT_FLAGS_MAX = (1 << 7)
-} FeatureSupportFlags;
-
-#define FEATURE_SUPPORT_FLAGS_MASK (FEATURE_SUPPORT_FLAGS_MAX-1)
-#define FEATURE_SUPPORT_FLAGS_STATUS_MASK (FEATURE_STATUS_ENABLED |  \
-                                           FEATURE_STATUS_DISABLED)
-#define FEATURE_SUPPORT_FLAGS_SURETY_MASK (FEATURE_SURETY_BAD |      \
-                                           FEATURE_SURETY_GOOD)
-#define FEATURE_SUPPORT_FLAGS_SOURCE_MASK (FEATURE_SOURCE_DEFAULT |  \
-                                           FEATURE_SOURCE_DETECTED | \
-                                           FEATURE_SOURCE_USER)
-/* Checks that mutually exclusive flags are not set. */
-gboolean feature_support_flags_is_valid(FeatureSupportFlags);
-#define FEATURE_SUPPORT_FLAGS_TYPE feature_support_get_type()
-GType feature_support_get_type (void);    
-
 /* Standard property definitions follow. See also property.c. */
 
 /* Value is a ConcurrencyParadigm */
@@ -197,16 +208,22 @@ extern DevicePropertyBase device_property_compression;
 extern DevicePropertyBase device_property_compression_rate;
 #define PROPERTY_COMPRESSION_RATE (device_property_compression_rate.ID)
 
-/* Value is a gint, where a negative number indicates variable block size. */
+/* Value is a gint; gives the write block size. */
 extern DevicePropertyBase device_property_block_size;
 #define PROPERTY_BLOCK_SIZE (device_property_block_size.ID)
 
-/* Value is a guint. */
+/* Read-only.  Value is a guint. */
 extern DevicePropertyBase device_property_min_block_size;
 extern DevicePropertyBase device_property_max_block_size;
 #define PROPERTY_MIN_BLOCK_SIZE (device_property_min_block_size.ID)
 #define PROPERTY_MAX_BLOCK_SIZE (device_property_max_block_size.ID)
 
+/* Value is a guint; gives the minimum buffer size for reads. Only
+ * the tape device implements this, but it corresponds to the tapetype
+ * readblocksize parameter, so it's a global property*/
+extern DevicePropertyBase device_property_read_buffer_size;
+#define PROPERTY_READ_BUFFER_SIZE (device_property_read_buffer_size.ID)
+
 /* Value is a gboolean. */
 extern DevicePropertyBase device_property_appendable;
 #define PROPERTY_APPENDABLE (device_property_appendable.ID)
@@ -217,7 +234,7 @@ extern DevicePropertyBase device_property_canonical_name;
 
 /* Value is MediaAccessMode. */
 extern DevicePropertyBase device_property_medium_access_type;
-#define PROPERTY_MEDIUM_TYPE (device_property_medium_access_type.ID)
+#define PROPERTY_MEDIUM_ACCESS_TYPE (device_property_medium_access_type.ID)
 
 /* Value is a gboolean. */
 extern DevicePropertyBase device_property_partial_deletion;
@@ -234,53 +251,8 @@ extern DevicePropertyBase device_property_free_space;
 extern DevicePropertyBase device_property_max_volume_usage;
 #define PROPERTY_MAX_VOLUME_USAGE (device_property_max_volume_usage.ID)
 
-/* Tape device properties. These properties do not exist on non-linear
-   devices. All of them have a value type of FeatureSupportFlags. */
-extern DevicePropertyBase device_property_fsf;
-#define PROPERTY_FSF (device_property_fsf.ID)
-
-extern DevicePropertyBase device_property_bsf;
-#define PROPERTY_BSF (device_property_bsf.ID)
-
-extern DevicePropertyBase device_property_fsr;
-#define PROPERTY_FSR (device_property_fsr.ID)
-
-extern DevicePropertyBase device_property_bsr;
-#define PROPERTY_BSR (device_property_bsr.ID)
-
-/* Is EOM supported? Must be able to read file number afterwards as
-   well. */
-extern DevicePropertyBase device_property_eom;
-#define PROPERTY_EOM (device_property_eom.ID)
-
-/* Is it necessary to perform a BSF after EOM? */
-extern DevicePropertyBase device_property_bsf_after_eom;
-#define PROPERTY_BSF_AFTER_EOM (device_property_bsf_after_eom.ID)
-
-/* How many filemarks to write at EOD? (Default is 2).
- * This property is a G_TYPE_UINT, but can only really be set to 1 or 2. */
-extern DevicePropertyBase device_property_final_filemarks;
-#define PROPERTY_FINAL_FILEMARKS (device_property_final_filemarks.ID)
-
-/* What buffer size is used for reading? */
-extern DevicePropertyBase device_property_read_buffer_size;
-#define PROPERTY_READ_BUFFER_SIZE (device_property_read_buffer_size.ID)
-
-/* Authentication information for Amazon S3. Both of these are strings. */
-extern DevicePropertyBase device_property_s3_secret_key;
-extern DevicePropertyBase device_property_s3_access_key;
-#define PROPERTY_S3_SECRET_KEY (device_property_s3_secret_key.ID)
-#define PROPERTY_S3_ACCESS_KEY (device_property_s3_access_key.ID)
-
-#ifdef WANT_DEVPAY
-/* Same, but for S3 with DevPay. This directory can be relative to the
- * config director, or absolute. */
-extern DevicePropertyBase device_property_s3_user_token;
-#define PROPERTY_S3_USER_TOKEN (device_property_s3_user_token.ID)
-#endif
-
 /* Should the device produce verbose output?  Value is a gboolean.  Not
- * recognized by all devices. */
+ * present in all devices. */
 extern DevicePropertyBase device_property_verbose;
 #define PROPERTY_VERBOSE (device_property_verbose.ID)
 
diff --git a/device-src/queueing.c b/device-src/queueing.c
deleted file mode 100644 (file)
index 2ec0e8c..0000000
+++ /dev/null
@@ -1,548 +0,0 @@
-/*
- * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
- * 
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License version 2.1 as 
- * published by the Free Software Foundation.
- * 
- * This 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 this library; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
- * 
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
- */
-
-#include "queueing.h"
-#include "device.h"
-#include "semaphore.h"
-#include "amanda.h"
-
-/* Queueing framework here. */
-typedef struct {
-    guint block_size;
-    ProducerFunctor producer;
-    gpointer producer_user_data;
-    ConsumerFunctor consumer;
-    gpointer consumer_user_data;
-    GAsyncQueue *data_queue, *free_queue;
-    semaphore_t *free_memory;
-    StreamingRequirement streaming_mode;
-} queue_data_t;
-
-static queue_buffer_t *invent_buffer(void) {
-    queue_buffer_t *rval;
-    rval = malloc(sizeof(*rval));
-
-    rval->data = NULL;
-    rval->alloc_size = 0;
-    rval->data_size = 0;
-    rval->offset = 0;
-
-    return rval;
-}
-
-void free_buffer(queue_buffer_t *buf) {
-    if (buf != NULL)
-        amfree(buf->data);
-    amfree(buf);
-}
-
-static queue_buffer_t * merge_buffers(queue_buffer_t *buf1,
-                                      queue_buffer_t *buf2) {
-    if (buf1 == NULL)
-        return buf2;
-    else if (buf2 == NULL)
-        return buf1;
-
-    if (buf2->offset >= buf1->data_size) {
-        /* We can fit buf1 at the beginning of buf2. */
-        memcpy(buf2->data + buf2->offset - buf1->data_size,
-               buf1->data + buf1->offset,
-               buf1->data_size);
-        buf2->offset -= buf1->data_size;
-        buf2->data_size += buf1->data_size;
-        free_buffer(buf1);
-        return buf2;
-    } else if (buf1->alloc_size - buf1->offset - buf1->data_size
-               >= buf2->data_size) {
-        /* We can fit buf2 at the end of buf1. */
-        memcpy(buf1->data + buf1->offset + buf1->data_size,
-               buf2->data + buf2->offset, buf2->data_size);
-        buf1->data_size += buf2->data_size;
-        free_buffer(buf2);
-        return buf1;
-    } else {
-        /* We can grow buf1 and put everything there. */
-        if (buf1->offset != 0) {
-            /* But first we have to fix up buf1. */
-            memmove(buf1->data, buf1->data + buf1->offset, buf1->data_size);
-            buf1->offset = 0;
-        }
-        buf1->alloc_size = buf1->data_size + buf2->data_size;
-        buf1->data = realloc(buf1->data, buf1->alloc_size);
-        memcpy(buf1->data + buf1->data_size, buf2->data + buf2->offset,
-               buf2->data_size);
-        buf1->data_size = buf1->alloc_size;
-        free_buffer(buf2);
-        return buf1;
-    }
-}
-
-/* Invalidate the first "bytes" bytes of the buffer, by adjusting the
-   offset and data size. */
-static void consume_buffer(queue_buffer_t* buf, int bytes) {
-    buf->offset += bytes;
-    buf->data_size -= bytes;
-}
-
-/* Looks at the buffer to see how much free space it has. If it has more than
- * twice the data size of unused space at the end, or more than four times
- * the data size of unused space at the beginning, then that space is
- * reclaimed. */
-static void heatshrink_buffer(queue_buffer_t *buf) {
-    if (buf == NULL)
-        return;
-
-    if (G_UNLIKELY(buf->data_size * 4 > buf->offset)) {
-        /* Consolodate with memmove. We will reclaim the space in the next
-         * step. */
-        memmove(buf->data, buf->data + buf->offset, buf->data_size);
-        buf->offset = 0;
-    } 
-
-    if (buf->alloc_size > buf->data_size*2 + buf->offset) {
-        buf->alloc_size = buf->data_size + buf->offset;
-        buf->data = realloc(buf->data, buf->alloc_size);
-    }
-}
-
-static gpointer do_producer_thread(gpointer datap) {
-    queue_data_t* data = datap;
-
-    for (;;) {
-        queue_buffer_t *buf;
-        gboolean result;
-
-        semaphore_decrement(data->free_memory, 0);
-        buf = g_async_queue_try_pop(data->free_queue);
-        if (buf != NULL && buf->data == NULL) {
-            /* Consumer is finished, then so are we. */
-            amfree(buf);
-            return GINT_TO_POINTER(TRUE);
-        }
-
-        if (buf == NULL) {
-            buf = invent_buffer();
-        }
-        buf->offset = 0;
-        buf->data_size = 0;
-
-        result = data->producer(data->producer_user_data, buf,
-                                data->block_size);
-
-        // Producers can allocate way too much memory.
-        heatshrink_buffer(buf);
-
-        if (buf->data_size > 0) {
-            semaphore_force_adjust(data->free_memory, -buf->alloc_size);
-            
-            g_async_queue_push(data->data_queue, buf);
-            buf = NULL;
-        } else {
-            g_assert(result != PRODUCER_MORE);
-            free_buffer(buf);
-            buf = NULL;
-        }
-
-
-        if (result == PRODUCER_MORE) {
-            continue;
-        } else {
-            /* We are finished (and the first to do so). */
-            g_async_queue_push(data->data_queue, invent_buffer());
-            semaphore_force_set(data->free_memory, INT_MIN);
-
-            return GINT_TO_POINTER(result == PRODUCER_FINISHED);
-        }
-    }
-}
-
-static gpointer do_consumer_thread(gpointer datap) {
-    queue_data_t* data = datap;
-    gboolean finished = FALSE;
-    queue_buffer_t *buf = NULL;
-
-    if (data->streaming_mode != STREAMING_REQUIREMENT_NONE) {
-        semaphore_wait_empty(data->free_memory);
-    }
-
-    for (;;) {
-        gboolean result;
-
-        if (finished) {
-            return GINT_TO_POINTER(TRUE);
-        }
-
-        while (buf == NULL || buf->data_size < data->block_size) {
-            queue_buffer_t *next_buf;
-            if (data->streaming_mode == STREAMING_REQUIREMENT_DESIRED) {
-                do {
-                    next_buf = g_async_queue_try_pop(data->data_queue);
-                    if (next_buf == NULL) {
-                        semaphore_wait_empty(data->free_memory);
-                    }
-                } while (next_buf == NULL);
-            } else {
-                next_buf = g_async_queue_pop(data->data_queue);
-                g_assert(next_buf != NULL);
-            }
-
-            if (next_buf->data == NULL) {
-                /* Producer is finished, then so are we.*/
-                free_buffer(next_buf);
-                if (buf != NULL) {
-                    /* But we can't quit yet, we have a buffer to flush.*/
-                    finished = TRUE;
-                    break;
-                } else {
-                    /* We are so outta here. */
-                    return GINT_TO_POINTER(TRUE);
-                }            
-            }
-
-            semaphore_increment(data->free_memory, next_buf->alloc_size);
-            
-            buf = merge_buffers(buf, next_buf);
-        }
-
-        result = data->consumer(data->consumer_user_data, buf);
-
-        if (result > 0) {
-            consume_buffer(buf, result);
-            if (buf->data_size == 0) {
-                g_async_queue_push(data->free_queue, buf);
-                buf = NULL;
-            }
-            continue;
-        } else {
-            free_buffer(buf);
-            return GINT_TO_POINTER(FALSE);
-        }
-    }
-}
-
-/* Empties a buffer queue and frees all the buffers associated with it.
- *
- * If full_cleanup is TRUE, then we delete the queue itself.
- * If full_cleanup is FALSE, then we leave the queue around, with a
- *         signal element in it. */
-static void cleanup_buffer_queue(GAsyncQueue *Q, gboolean full_cleanup) {
-    g_async_queue_lock(Q);
-    for (;;) {
-        queue_buffer_t *buftmp;
-        buftmp = g_async_queue_try_pop_unlocked(Q);
-        if (buftmp == NULL)
-            break;
-
-        free_buffer(buftmp);
-    }
-    if (!full_cleanup)
-        g_async_queue_push_unlocked(Q, invent_buffer());
-
-    g_async_queue_unlock(Q);
-    
-    if (full_cleanup)
-        g_async_queue_unref(Q);
-}
-
-/* This function sacrifices performance, but will still work just
-   fine, on systems where threads are not supported. */
-static queue_result_flags
-do_unthreaded_consumer_producer_queue(guint block_size,
-                                      ProducerFunctor producer,
-                                      gpointer producer_user_data,
-                                      ConsumerFunctor consumer,
-                                      gpointer consumer_user_data) {
-    queue_buffer_t *buf = NULL, *next_buf = NULL;
-    gboolean finished = FALSE;
-    queue_result_flags rval = 0;
-
-    /* The basic theory of operation here is to read until we have
-       enough data to write, then write until we don't.. */
-    while (!finished) {
-        int result;
-        
-        while ((buf == NULL || buf->data_size < block_size) && !finished) {
-            if (next_buf == NULL)
-                next_buf = invent_buffer();
-
-            result = producer(producer_user_data, next_buf, block_size);
-
-            if (result != PRODUCER_MORE) {
-                finished = TRUE;
-                if (result != PRODUCER_FINISHED) {
-                    rval |= QUEUE_PRODUCER_ERROR;
-                }
-            }
-
-            buf = merge_buffers(buf, next_buf);
-            next_buf = NULL;
-        }
-
-        while (buf != NULL && buf->data_size > 0 &&
-               (buf->data_size >= block_size || finished)) {
-            result = consumer(consumer_user_data, buf);
-            
-            if (result > 0) {
-                consume_buffer(buf, result);
-                if (buf->data_size == 0) {
-                    next_buf = buf;
-                    buf = NULL;
-                }
-            } else {
-                finished = TRUE;
-                rval |= QUEUE_CONSUMER_ERROR;
-                break;
-            }
-        }
-    }
-
-    free_buffer(buf);
-    free_buffer(next_buf);
-    return rval;
-}
-
-gboolean do_consumer_producer_queue(ProducerFunctor producer,
-                                    gpointer producer_user_data,
-                                    ConsumerFunctor consumer,
-                                    gpointer consumer_user_data) {
-    return QUEUE_SUCCESS ==
-        do_consumer_producer_queue_full(producer, producer_user_data,
-                                        consumer, consumer_user_data,
-                                        0, DEFAULT_MAX_BUFFER_MEMORY,
-                                        STREAMING_REQUIREMENT_NONE);
-}
-
-queue_result_flags
-do_consumer_producer_queue_full(ProducerFunctor producer,
-                                gpointer producer_user_data,
-                                ConsumerFunctor consumer,
-                                gpointer consumer_user_data,
-                                int block_size,
-                                size_t max_memory,
-                                StreamingRequirement streaming_mode) {
-    GThread     * producer_thread;
-    GThread     * consumer_thread;
-    queue_data_t  queue_data;
-    gpointer      producer_result;
-    gpointer      consumer_result;
-    queue_result_flags rval;
-
-    if (block_size <= 0) {
-        block_size = DISK_BLOCK_BYTES;
-    }
-
-    g_return_val_if_fail(producer != NULL, FALSE);
-    g_return_val_if_fail(consumer != NULL, FALSE);
-
-    if (!g_thread_supported()) {
-        return do_unthreaded_consumer_producer_queue(block_size, producer,
-                                                     producer_user_data,
-                                                     consumer,
-                                                     consumer_user_data);
-    }
-
-    queue_data.block_size = block_size;
-    queue_data.producer = producer;
-    queue_data.producer_user_data = producer_user_data;
-    queue_data.consumer = consumer;
-    queue_data.consumer_user_data = consumer_user_data;
-    queue_data.streaming_mode = streaming_mode;
-
-    queue_data.data_queue = g_async_queue_new();
-    queue_data.free_queue = g_async_queue_new();
-
-    max_memory = MAX(1,MIN(max_memory, INT_MAX / 2));
-    queue_data.free_memory = semaphore_new_with_value(max_memory);
-
-    producer_thread = g_thread_create(do_producer_thread, &queue_data,
-                                      TRUE,
-                                      NULL /* FIXME: Should handle
-                                              errors. */);
-    consumer_thread = g_thread_create(do_consumer_thread, &queue_data,
-                                      TRUE,
-                                      NULL /* FIXME: Should handle
-                                              errors. */);
-    
-    /* The order of cleanup here is very important, to avoid deadlock. */
-    /* 1) Reap the consumer. */
-    consumer_result = g_thread_join(consumer_thread);
-    /* 2) Stop the producer. */
-    semaphore_force_set(queue_data.free_memory, -1);
-    /* 3) Cleanup the free queue; add a signal flag. */
-    cleanup_buffer_queue(queue_data.free_queue, FALSE);
-    /* 4) Restart the producer (so it can exit). */
-    semaphore_force_set(queue_data.free_memory, INT_MAX);
-    /* 5) Reap the producer. */
-    producer_result = g_thread_join(producer_thread);
-
-    cleanup_buffer_queue(queue_data.free_queue, TRUE);
-    cleanup_buffer_queue(queue_data.data_queue, TRUE);
-
-    semaphore_free(queue_data.free_memory);
-    
-    rval = 0;
-    if (!GPOINTER_TO_INT(producer_result)) {
-        rval |= QUEUE_PRODUCER_ERROR;
-    }
-    if (!GPOINTER_TO_INT(consumer_result)) {
-        rval |= QUEUE_CONSUMER_ERROR;
-    }
-    return rval;
-}
-
-/* Commonly-useful producers and consumers below. */
-
-producer_result_t device_read_producer(gpointer devicep,
-                                       queue_buffer_t *buffer,
-                                       int hint_size G_GNUC_UNUSED) {
-    Device* device;
-
-    device = (Device*) devicep;
-    g_assert(IS_DEVICE(device));
-
-    buffer->offset = 0;
-    for (;;) {
-        int result, read_size;
-        read_size = buffer->alloc_size;
-        result = device_read_block(device, buffer->data, &read_size);
-        if (result > 0) {
-            buffer->data_size = read_size;
-            return PRODUCER_MORE;
-        } else if (result == 0) {
-            buffer->data = realloc(buffer->data, read_size);
-            buffer->alloc_size = read_size;
-        } else if (device->is_eof) {
-            return PRODUCER_FINISHED;
-        } else {
-            buffer->data_size = 0;
-            return PRODUCER_ERROR;
-        }
-    }
-}
-
-int device_write_consumer(gpointer devicep, queue_buffer_t *buffer) {
-    Device* device;
-    unsigned int write_size;
-    static gboolean wrote_blocksize = FALSE;
-
-    device = (Device*) devicep;
-    g_assert(IS_DEVICE(device));
-    write_size = MIN(buffer->data_size,
-                     device_write_max_size(device));
-
-    if (!wrote_blocksize) {
-       wrote_blocksize = TRUE;
-       dbprintf("USING BLOCKSIZE %d bytes\n", write_size);
-    }
-
-    if (device_write_block(device, write_size,
-                           buffer->data + buffer->offset,
-                           buffer->data_size <
-                               device_write_min_size(device))) {
-        /* Success! */
-        return write_size;
-    } else {
-        /* Nope, really an error. */
-        return -1;
-    }
-}
-
-producer_result_t fd_read_producer(gpointer fdp, queue_buffer_t *buffer,
-                                   int hint_size) {
-    int fd;
-
-    fd = GPOINTER_TO_INT(fdp);
-    g_assert(fd >= 0);
-    g_assert(buffer->data_size == 0);
-
-    buffer->offset = 0;
-
-    if (buffer->data == NULL) {
-        /* Set up the buffer. */
-        buffer->data = malloc(hint_size);
-        buffer->alloc_size = hint_size;
-    }
-
-    for (;;) {
-        int result;
-        result = read(fd, buffer->data, buffer->alloc_size);
-
-        if (result > 0) {
-            buffer->data_size = result;
-            return PRODUCER_MORE;
-        } else if (result == 0) {
-            /* End of file. */
-            return PRODUCER_FINISHED;
-        } else if (0
-#ifdef EAGAIN
-                || errno == EAGAIN
-#endif
-#ifdef EWOULDBLOCK
-                || errno == EWOULDBLOCK
-#endif
-#ifdef EINTR
-                || errno == EINTR
-#endif
-                ) {
-                /* Try again. */
-                continue;
-        } else {
-            /* Error occured. */
-            g_fprintf(stderr, "Error reading fd %d: %s\n", fd, strerror(errno));
-            return PRODUCER_ERROR;
-        }
-    }
-}
-
-int fd_write_consumer(gpointer fdp, queue_buffer_t *buffer) {
-    int fd;
-
-    fd = GPOINTER_TO_INT(fdp);
-    g_assert(fd >= 0);
-
-    g_return_val_if_fail(buffer->data_size > 0, 0);
-
-    for (;;) {
-        int write_size;
-        write_size = write(fd, buffer->data + buffer->offset,
-                           buffer->data_size);
-        
-        if (write_size > 0) {
-            return write_size;
-        } else if (0
-#ifdef EAGAIN
-                || errno == EAGAIN
-#endif
-#ifdef EWOULDBLOCK
-                || errno == EWOULDBLOCK
-#endif
-#ifdef EINTR
-                || errno == EINTR
-#endif
-                ) {
-                /* Try again. */
-                continue;
-        } else {
-            /* Error occured. */
-            g_fprintf(stderr, "Error writing fd %d: %s\n", fd, strerror(errno));
-            return -1;
-        }        
-    }
-}
diff --git a/device-src/queueing.h b/device-src/queueing.h
deleted file mode 100644 (file)
index 4a22081..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
- * 
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License version 2.1 as 
- * published by the Free Software Foundation.
- * 
- * This 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 this library; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
- * 
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
- */
-
-#ifndef QUEUEING_H
-#define QUEUEING_H
-
-/* This file contains the code for fast threaded reading and writing to/from
- * media, for devices that don't require any special handling. Some
- * devices (e.g., CD-ROM) may use a different method for bulk reads or
- * writes. */
-
-#include <glib.h>
-#include "property.h"
-
-#define DEFAULT_MAX_BUFFER_MEMORY (1*1024*1024)
-
-/* Valid data in this structure starts at data + offset, and has size
- * data_size. Allocation starts at data and has size alloc_size. */
-typedef struct {
-    char *data;
-    guint alloc_size;
-    guint data_size;
-    guint offset;
-} queue_buffer_t;
-
-void free_buffer(queue_buffer_t*);
-
-typedef enum {
-    PRODUCER_MORE,     /* Means the producer should be run again. */
-    PRODUCER_FINISHED, /* Means that no error occured, but the
-                          producer should not be run again. */
-    PRODUCER_ERROR     /* Means an error occured, and the producer
-                          should not be run again. */
-} producer_result_t;
-
-typedef enum {
-    QUEUE_SUCCESS = 0,
-    QUEUE_PRODUCER_ERROR = 1 << 0,
-    QUEUE_CONSUMER_ERROR = 1 << 1,
-    QUEUE_INTERNAL_ERROR = 1 << 2
-} queue_result_flags;
-
-/* The producer takes the given buffer (which is not itself NULL, but
- * may contain a NULL data segment), and fills it with data. The
- * producer should feel free to allocate or reallocate data as
- * necessary; the queueing system will free it when necessary. The
- * result of the production operation is specified in the return
- * value, but if the buffer is left without data, then that is
- * interpreted as PRODUCER_ERROR. It is preferred (but not required)
- * that the producer produce hint_size bytes of data, 
- *
- * The consumer takes the given buffer (which will not be NULL, nor
- * contain a NULL data segment) and processess it. If there is a
- * problem consuming data (such that no further data should be
- * consumed), the consumer may return -1. Otherwise, the consumer
- * should return the number of bytes actually consumed.
- * If an error occurs, return -1, regardless of the number of bytes consumed.
- * If the amount of data written is not a full block, then this is the
- * last (partial block) of data. The consumer should do whatever is
- * appropriate in that case.
- *
- * Note that the handling of the queue_buffer_t is different between
- * the two functions: The producer should update queue_buffer_t as
- * necessary to corespond to read data, while the consumer should
- * leave the queue_buffer_t unadjusted: The queueing framework will
- * invalidate data in the buffer according to the return value of the
- * consumer.*/
-typedef producer_result_t (* ProducerFunctor)(gpointer user_data,
-                                              queue_buffer_t* buffer,
-                                              int hint_size);
-typedef int (* ConsumerFunctor)(gpointer user_data,
-                                queue_buffer_t* buffer);
-
-
-/* These functions make the magic happen. The first one assumes
-   reasonable defaults, the second one provides more options.
-   % producer           : A function that provides data to write.
-   % producer_user_data : A pointer to pass to that function.
-   % consumer           : A function that writes data out.
-   % consumer_user_data : A pointer to pass to that function.
-   % block_size         : Size of chunks to write out to consumer. If
-                          nonpositive, data will be written in
-                          variable-sized chunks.
-   % max_memory         : Amount of memory to be used for buffering.
-                          (default is DEFAULT_MAX_BUFFER_MEMORY).
-   % streaming_mode     : Describes streaming mode.
-         STREAMING_REQUIREMENT_NONE:     Data will be written as fast
-                                         as possible. No prebuffering
-                                         will be done.
-         STREAMING_REQUIREMENT_DESIRED:  max_memory bytes of data will
-                                         be prebuffered, and if the
-                                         buffer ever empties, no data
-                                         will be written until it
-                                         fills again.
-         STREAMING_REQUIREMENT_REQUIRED: max_memory bytes of data will
-                                         be prebuffered, and
-                                         thereafter data will be
-                                         written as fast as possible.
-*/
-gboolean
-do_consumer_producer_queue(ProducerFunctor producer,
-                           gpointer producer_user_data,
-                           ConsumerFunctor consumer,
-                           gpointer consumer_user_data);
-queue_result_flags
-do_consumer_producer_queue_full(ProducerFunctor producer,
-                                gpointer producer_user_data,
-                                ConsumerFunctor consumer,
-                                gpointer consumer_user_data,
-                                int block_size,
-                                size_t max_memory,
-                                StreamingRequirement streaming_mode);
-
-/* Some commonly-useful producers and consumers.*/
-
-/* These functions will call device_read_block and device_write_block
- * respectively. The user data should be a Device*.
- *
- * device_write_consumer assumes that the block_size passed to
- * do_consumer_producer_queue_full is at least device_write_min_size();
- * do_consumer_thread() will not pass a buffer of less than block_size
- * to the consumer unless it has received EOF from the producer thread.
- */
-producer_result_t device_read_producer(gpointer device,
-                                       queue_buffer_t *buffer,
-                                       int hint_size);
-int device_write_consumer(gpointer device, queue_buffer_t *buffer);
-
-/* These functions will call read() or write() respectively. The user
-   data should be a file descriptor stored with GINT_TO_POINTER. */
-producer_result_t fd_read_producer(gpointer fd, queue_buffer_t *buffer,
-                                   int hint_size);
-int fd_write_consumer(gpointer fd, queue_buffer_t *buffer);
-
-
-
-#endif /* QUEUEING_H */
index 72f7c6dfff0114bb84f73571601805775d1db9b2..5b348927853094df26b103aafed9f599f0ee2c09 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+ * Copyright (c) 2005-2008 Zmanda, Inc.  All Rights Reserved.
  * 
  * This library is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License version 2.1 as 
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  * 
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 /* The RAIT device encapsulates some number of other devices into a single
  * redundant device. */
 
-#include "rait-device.h"
 #include <amanda.h>
 #include "property.h"
 #include "util.h"
+#include <glib.h>
+#include "glib-util.h"
+#include "device.h"
+#include "fileheader.h"
+#include "semaphore.h"
+
+/* Just a note about the failure mode of different operations:
+   - Recovers from a failure (enters degraded mode)
+     open_device()
+     seek_file() -- explodes if headers don't match.
+     seek_block() -- explodes if headers don't match.
+     read_block() -- explodes if data doesn't match.
+
+   - Operates in degraded mode (but dies if a new problem shows up)
+     read_label() -- but dies on label mismatch.
+     start() -- but dies when writing in degraded mode.
+     property functions
+     finish()
+
+   - Dies in degraded mode (even if remaining devices are OK)
+     start_file()
+     write_block()
+     finish_file()
+     recycle_file()
+*/
+
+/*
+ * Type checking and casting macros
+ */
+#define TYPE_RAIT_DEVICE       (rait_device_get_type())
+#define RAIT_DEVICE(obj)       G_TYPE_CHECK_INSTANCE_CAST((obj), rait_device_get_type(), RaitDevice)
+#define RAIT_DEVICE_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), rait_device_get_type(), RaitDevice const)
+#define RAIT_DEVICE_CLASS(klass)       G_TYPE_CHECK_CLASS_CAST((klass), rait_device_get_type(), RaitDeviceClass)
+#define IS_RAIT_DEVICE(obj)    G_TYPE_CHECK_INSTANCE_TYPE((obj), rait_device_get_type ())
+
+#define RAIT_DEVICE_GET_CLASS(obj)     G_TYPE_INSTANCE_GET_CLASS((obj), rait_device_get_type(), RaitDeviceClass)
+static GType   rait_device_get_type    (void);
+
+/*
+ * Main object structure
+ */
+typedef struct RaitDevice_s {
+    Device __parent__;
+
+    struct RaitDevicePrivate_s * private;
+} RaitDevice;
+
+/*
+ * Class definition
+ */
+typedef struct _RaitDeviceClass RaitDeviceClass;
+struct _RaitDeviceClass {
+    DeviceClass __parent__;
+};
 
 typedef enum {
     RAIT_STATUS_COMPLETE, /* All subdevices OK. */
@@ -32,63 +85,133 @@ typedef enum {
     RAIT_STATUS_FAILED    /* Two or more subdevices failed. */
 } RaitStatus;
 
-struct RaitDevicePrivate_s {
+/* Older versions of glib have a deadlock in their thread pool implementations,
+ * so we include a simple thread-pool implementation here to replace it.
+ *
+ * This implementation assumes that threads are used for paralellizing a single
+ * operation, so all threads run a function to completion before the main thread
+ * continues.  This simplifies some of the locking semantics, and in particular
+ * there is no need to wait for stray threads to finish an operation when
+ * finalizing the RaitDevice object or when beginning a new operation.
+ */
+#if !(GLIB_CHECK_VERSION(2,10,0))
+#define USE_INTERNAL_THREADPOOL
+#endif
+
+typedef struct RaitDevicePrivate_s {
     GPtrArray * children;
     /* These flags are only relevant for reading. */
     RaitStatus status;
     /* If status == RAIT_STATUS_DEGRADED, this holds the index of the
        failed node. It holds a negative number otherwise. */
     int failed;
-    guint block_size;
-};
+
+    /* the child block size */
+    gsize child_block_size;
+
+#ifdef USE_INTERNAL_THREADPOOL
+    /* array of ThreadInfo for performing parallel operations */
+    GArray *threads;
+
+    /* value of this semaphore is the number of threaded operations
+     * in progress */
+    semaphore_t *threads_sem;
+#endif
+} RaitDevicePrivate;
+
+#ifdef USE_INTERNAL_THREADPOOL
+typedef struct ThreadInfo {
+    GThread *thread;
+
+    /* struct fields below are protected by this mutex and condition variable */
+    GMutex *mutex;
+    GCond *cond;
+
+    gboolean die;
+    GFunc func;
+    gpointer data;
+
+    /* give threads access to active_threads and its mutex/cond */
+    struct RaitDevicePrivate_s *private;
+} ThreadInfo;
+#endif
+
 
 #define PRIVATE(o) (o->private)
 
+#define rait_device_in_error(dev) \
+    (device_in_error((dev)) || PRIVATE(RAIT_DEVICE((dev)))->status == RAIT_STATUS_FAILED)
+
+void rait_device_register (void);
+
 /* here are local prototypes */
 static void rait_device_init (RaitDevice * o);
 static void rait_device_class_init (RaitDeviceClass * c);
-static gboolean rait_device_open_device (Device * self, char * device_name);
+static void rait_device_base_init (RaitDeviceClass * c);
+static void rait_device_open_device (Device * self, char * device_name, char * device_type, char * device_node);
 static gboolean rait_device_start (Device * self, DeviceAccessMode mode,
                                    char * label, char * timestamp);
-static gboolean rait_device_start_file(Device * self, const dumpfile_t * info);
-static gboolean rait_device_write_block (Device * self, guint size,
-                                         gpointer data, gboolean last_block);
+static gboolean rait_device_configure(Device * self, gboolean use_global_config);
+static gboolean rait_device_start_file(Device * self, dumpfile_t * info);
+static gboolean rait_device_write_block (Device * self, guint size, gpointer data);
 static gboolean rait_device_finish_file (Device * self);
 static dumpfile_t * rait_device_seek_file (Device * self, guint file);
 static gboolean rait_device_seek_block (Device * self, guint64 block);
 static int      rait_device_read_block (Device * self, gpointer buf,
                                         int * size);
-static gboolean rait_device_property_get (Device * self, DevicePropertyId id,
-                                          GValue * val);
-static gboolean rait_device_property_set (Device * self, DevicePropertyId id,
-                                          GValue * val);
 static gboolean rait_device_recycle_file (Device * self, guint filenum);
 static gboolean rait_device_finish (Device * self);
-static ReadLabelStatusFlags rait_device_read_label(Device * dself);
+static DeviceStatusFlags rait_device_read_label(Device * dself);
 static void find_simple_params(RaitDevice * self, guint * num_children,
-                               guint * data_children, int * blocksize);
+                               guint * data_children);
 
-/* pointer to the class of our parent */
-static DeviceClass *parent_class = NULL;
+/* property handlers */
 
-/* This function is replicated here in case we have GLib from before 2.4.
- * It should probably go eventually. */
-#if !GLIB_CHECK_VERSION(2,4,0)
-static void
-g_ptr_array_foreach (GPtrArray *array,
-                     GFunc      func,
-                     gpointer   user_data)
-{
-  guint i;
+static gboolean property_get_block_size_fn(Device *self,
+    DevicePropertyBase *base, GValue *val,
+    PropertySurety *surety, PropertySource *source);
 
-  g_return_if_fail (array);
+static gboolean property_set_block_size_fn(Device *self,
+    DevicePropertyBase *base, GValue *val,
+    PropertySurety surety, PropertySource source);
 
-  for (i = 0; i < array->len; i++)
-    (*func) (array->pdata[i], user_data);
-}
-#endif
+static gboolean property_get_canonical_name_fn(Device *self,
+    DevicePropertyBase *base, GValue *val,
+    PropertySurety *surety, PropertySource *source);
+
+static gboolean property_get_concurrency_fn(Device *self,
+    DevicePropertyBase *base, GValue *val,
+    PropertySurety *surety, PropertySource *source);
+
+static gboolean property_get_streaming_fn(Device *self,
+    DevicePropertyBase *base, GValue *val,
+    PropertySurety *surety, PropertySource *source);
+
+static gboolean property_get_boolean_and_fn(Device *self,
+    DevicePropertyBase *base, GValue *val,
+    PropertySurety *surety, PropertySource *source);
+
+static gboolean property_get_medium_access_type_fn(Device *self,
+    DevicePropertyBase *base, GValue *val,
+    PropertySurety *surety, PropertySource *source);
+
+static gboolean property_get_free_space_fn(Device *self,
+    DevicePropertyBase *base, GValue *val,
+    PropertySurety *surety, PropertySource *source);
 
-GType
+static gboolean property_get_max_volume_usage_fn(Device *self,
+    DevicePropertyBase *base, GValue *val,
+    PropertySurety *surety, PropertySource *source);
+
+static gboolean property_set_max_volume_usage_fn(Device *self,
+    DevicePropertyBase *base, GValue *val,
+    PropertySurety surety, PropertySource source);
+
+
+/* pointer to the class of our parent */
+static DeviceClass *parent_class = NULL;
+
+static GType
 rait_device_get_type (void)
 {
     static GType type = 0;
@@ -96,7 +219,7 @@ rait_device_get_type (void)
     if G_UNLIKELY(type == 0) {
         static const GTypeInfo info = {
             sizeof (RaitDeviceClass),
-            (GBaseInitFunc) NULL,
+            (GBaseInitFunc) rait_device_base_init,
             (GBaseFinalizeFunc) NULL,
             (GClassInitFunc) rait_device_class_init,
             (GClassFinalizeFunc) NULL,
@@ -116,14 +239,15 @@ rait_device_get_type (void)
 
 static void g_object_unref_foreach(gpointer data,
                                    gpointer user_data G_GNUC_UNUSED) {
-    g_return_if_fail(G_IS_OBJECT(data));
-    g_object_unref(data);
+    if (data != NULL && G_IS_OBJECT(data)) {
+        g_object_unref(data);
+    }
 }
 
 static void
 rait_device_finalize(GObject *obj_self)
 {
-    RaitDevice *self G_GNUC_UNUSED = RAIT_DEVICE (obj_self);
+    RaitDevice *self = RAIT_DEVICE (obj_self);
     if(G_OBJECT_CLASS(parent_class)->finalize) \
            (* G_OBJECT_CLASS(parent_class)->finalize)(obj_self);
     if(self->private->children) {
@@ -132,27 +256,64 @@ rait_device_finalize(GObject *obj_self)
         g_ptr_array_free (self->private->children, TRUE);
         self->private->children = NULL;
     }
+#ifdef USE_INTERNAL_THREADPOOL
+    g_assert(PRIVATE(self)->threads_sem == NULL || PRIVATE(self)->threads_sem->value == 0);
+
+    if (PRIVATE(self)->threads) {
+       guint i;
+
+       for (i = 0; i < PRIVATE(self)->threads->len; i++) {
+           ThreadInfo *inf = &g_array_index(PRIVATE(self)->threads, ThreadInfo, i);
+           if (inf->thread) {
+               /* NOTE: the thread is waiting on this condition right now, not
+                * executing an operation. */
+
+               /* ask the thread to die */
+               g_mutex_lock(inf->mutex);
+               inf->die = TRUE;
+               g_cond_signal(inf->cond);
+               g_mutex_unlock(inf->mutex);
+
+               /* and wait for it to die, which should happen soon */
+               g_thread_join(inf->thread);
+           }
+
+           if (inf->mutex)
+               g_mutex_free(inf->mutex);
+           if (inf->cond)
+               g_cond_free(inf->cond);
+       }
+    }
+
+    if (PRIVATE(self)->threads_sem)
+       semaphore_free(PRIVATE(self)->threads_sem);
+#endif
     amfree(self->private);
 }
 
 static void 
 rait_device_init (RaitDevice * o G_GNUC_UNUSED)
 {
-    PRIVATE(o) = malloc(sizeof(RaitDevicePrivate));
+    PRIVATE(o) = g_new(RaitDevicePrivate, 1);
     PRIVATE(o)->children = g_ptr_array_new();
     PRIVATE(o)->status = RAIT_STATUS_COMPLETE;
     PRIVATE(o)->failed = -1;
+#ifdef USE_INTERNAL_THREADPOOL
+    PRIVATE(o)->threads = NULL;
+    PRIVATE(o)->threads_sem = NULL;
+#endif
 }
 
 static void 
-rait_device_class_init (RaitDeviceClass * c G_GNUC_UNUSED)
+rait_device_class_init (RaitDeviceClass * c)
 {
-    GObjectClass *g_object_class G_GNUC_UNUSED = (GObjectClass*) c;
+    GObjectClass *g_object_class = (GObjectClass*) c;
     DeviceClass *device_class = (DeviceClass *)c;
 
     parent_class = g_type_class_ref (TYPE_DEVICE);
 
     device_class->open_device = rait_device_open_device;
+    device_class->configure = rait_device_configure;
     device_class->start = rait_device_start;
     device_class->start_file = rait_device_start_file;
     device_class->write_block = rait_device_write_block;
@@ -160,20 +321,18 @@ rait_device_class_init (RaitDeviceClass * c G_GNUC_UNUSED)
     device_class->seek_file = rait_device_seek_file;
     device_class->seek_block = rait_device_seek_block;
     device_class->read_block = rait_device_read_block;
-    device_class->property_get = rait_device_property_get;
-    device_class->property_set = rait_device_property_set;
     device_class->recycle_file = rait_device_recycle_file; 
     device_class->finish = rait_device_finish;
     device_class->read_label = rait_device_read_label;
 
     g_object_class->finalize = rait_device_finalize;
 
+#ifndef USE_INTERNAL_THREADPOOL
+#if !GLIB_CHECK_VERSION(2,10,2)
     /* Versions of glib before 2.10.2 crash if
      * g_thread_pool_set_max_unused_threads is called before the first
      * invocation of g_thread_pool_new.  So we make up a thread pool, but don't
      * start any threads in it, and free it */
-
-#if !GLIB_CHECK_VERSION(2,10,2)
     {
        GThreadPool *pool = g_thread_pool_new((GFunc)-1, NULL, -1, FALSE, NULL);
        g_thread_pool_free(pool, TRUE, FALSE);
@@ -181,6 +340,53 @@ rait_device_class_init (RaitDeviceClass * c G_GNUC_UNUSED)
 #endif
 
     g_thread_pool_set_max_unused_threads(-1);
+#endif
+}
+
+static void
+rait_device_base_init (RaitDeviceClass * c)
+{
+    DeviceClass *device_class = (DeviceClass *)c;
+
+    /* the RAIT device overrides most of the standard properties, so that it
+     * can calculate them by querying the same property on the children */
+    device_class_register_property(device_class, PROPERTY_BLOCK_SIZE,
+           PROPERTY_ACCESS_GET_MASK | PROPERTY_ACCESS_SET_BEFORE_START,
+           property_get_block_size_fn,
+           property_set_block_size_fn);
+
+    device_class_register_property(device_class, PROPERTY_CANONICAL_NAME,
+           PROPERTY_ACCESS_GET_MASK,
+           property_get_canonical_name_fn, NULL);
+
+    device_class_register_property(device_class, PROPERTY_CONCURRENCY,
+           PROPERTY_ACCESS_GET_MASK,
+           property_get_concurrency_fn, NULL);
+
+    device_class_register_property(device_class, PROPERTY_STREAMING,
+           PROPERTY_ACCESS_GET_MASK,
+           property_get_streaming_fn, NULL);
+
+    device_class_register_property(device_class, PROPERTY_APPENDABLE,
+           PROPERTY_ACCESS_GET_MASK,
+           property_get_boolean_and_fn, NULL);
+
+    device_class_register_property(device_class, PROPERTY_PARTIAL_DELETION,
+           PROPERTY_ACCESS_GET_MASK,
+           property_get_boolean_and_fn, NULL);
+
+    device_class_register_property(device_class, PROPERTY_MEDIUM_ACCESS_TYPE,
+           PROPERTY_ACCESS_GET_MASK,
+           property_get_medium_access_type_fn, NULL);
+
+    device_class_register_property(device_class, PROPERTY_FREE_SPACE,
+           PROPERTY_ACCESS_GET_MASK,
+           property_get_free_space_fn, NULL);
+
+    device_class_register_property(device_class, PROPERTY_MAX_VOLUME_USAGE,
+           PROPERTY_ACCESS_GET_MASK,
+           property_get_max_volume_usage_fn,
+           property_set_max_volume_usage_fn);
 }
 
 /* This function does something a little clever and a little
@@ -194,12 +400,81 @@ rait_device_class_init (RaitDeviceClass * c G_GNUC_UNUSED)
  * 
  * When it returns, all the operations have been successfully
  * executed. If you want results from your operations, do it yourself
- * through the array. */
-static void do_thread_pool_op(GFunc func, GPtrArray * ops, gpointer data) {
+ * through the array.
+ */
+
+#ifdef USE_INTERNAL_THREADPOOL
+static gpointer rait_thread_pool_func(gpointer data) {
+    ThreadInfo *inf = data;
+
+    g_mutex_lock(inf->mutex);
+    while (TRUE) {
+       while (!inf->die && !inf->func)
+           g_cond_wait(inf->cond, inf->mutex);
+
+       if (inf->die)
+           break;
+
+       if (inf->func) {
+           /* invoke the function */
+           inf->func(inf->data, NULL);
+           inf->func = NULL;
+           inf->data = NULL;
+
+            /* indicate that we're finished; will not block */
+           semaphore_down(inf->private->threads_sem);
+       }
+    }
+    g_mutex_unlock(inf->mutex);
+    return NULL;
+}
+
+static void do_thread_pool_op(RaitDevice *self, GFunc func, GPtrArray * ops) {
+    guint i;
+
+    if (PRIVATE(self)->threads_sem == NULL)
+       PRIVATE(self)->threads_sem = semaphore_new_with_value(0);
+
+    if (PRIVATE(self)->threads == NULL)
+       PRIVATE(self)->threads = g_array_sized_new(FALSE, TRUE,
+                                           sizeof(ThreadInfo), ops->len);
+
+    g_assert(PRIVATE(self)->threads_sem->value == 0);
+
+    if (PRIVATE(self)->threads->len < ops->len)
+       g_array_set_size(PRIVATE(self)->threads, ops->len);
+
+    /* the semaphore will hit zero when each thread has decremented it */
+    semaphore_force_set(PRIVATE(self)->threads_sem, ops->len);
+
+    for (i = 0; i < ops->len; i++) {
+       ThreadInfo *inf = &g_array_index(PRIVATE(self)->threads, ThreadInfo, i);
+       if (!inf->thread) {
+           inf->mutex = g_mutex_new();
+           inf->cond = g_cond_new();
+           inf->private = PRIVATE(self);
+           inf->thread = g_thread_create(rait_thread_pool_func, inf, TRUE, NULL);
+       }
+
+       /* set up the info the thread needs and trigger it to start */
+       g_mutex_lock(inf->mutex);
+       inf->data = g_ptr_array_index(ops, i);
+       inf->func = func;
+       g_cond_signal(inf->cond);
+       g_mutex_unlock(inf->mutex);
+    }
+
+    /* wait until semaphore hits zero */
+    semaphore_wait_empty(PRIVATE(self)->threads_sem);
+}
+
+#else /* USE_INTERNAL_THREADPOOL */
+
+static void do_thread_pool_op(RaitDevice *self G_GNUC_UNUSED, GFunc func, GPtrArray * ops) {
     GThreadPool * pool;
     guint i;
 
-    pool = g_thread_pool_new(func, data, -1, FALSE, NULL);
+    pool = g_thread_pool_new(func, NULL, -1, FALSE, NULL);
     for (i = 0; i < ops->len; i ++) {
         g_thread_pool_push(pool, g_ptr_array_index(ops, i), NULL);
     }
@@ -207,9 +482,10 @@ static void do_thread_pool_op(GFunc func, GPtrArray * ops, gpointer data) {
     g_thread_pool_free(pool, FALSE, TRUE);
 }
 
+#endif /* USE_INTERNAL_THREADPOOL */
+
 /* This does the above, in a serial fashion (and without using threads) */
-static void do_unthreaded_ops(GFunc func, GPtrArray * ops,
-                              gpointer data G_GNUC_UNUSED) {
+static void do_unthreaded_ops(RaitDevice *self G_GNUC_UNUSED, GFunc func, GPtrArray * ops) {
     guint i;
 
     for (i = 0; i < ops->len; i ++) {
@@ -220,231 +496,358 @@ static void do_unthreaded_ops(GFunc func, GPtrArray * ops,
 /* This is the one that code below should call. It switches
    automatically between do_thread_pool_op and do_unthreaded_ops,
    depending on g_thread_supported(). */
-static void do_rait_child_ops(GFunc func, GPtrArray * ops, gpointer data) {
+static void do_rait_child_ops(RaitDevice *self, GFunc func, GPtrArray * ops) {
     if (g_thread_supported()) {
-        do_thread_pool_op(func, ops, data);
+        do_thread_pool_op(self, func, ops);
     } else {
-        do_unthreaded_ops(func, ops, data);
+        do_unthreaded_ops(self, func, ops);
     }
 }
 
-/* Take a text string user_name, and break it out into an argv-style
-   array of strings. For example, {foo,{bar,baz},bat} would return the
-   strings "foo", "{bar,baz}", "bat", and NULL. Returns NULL on
-   error. */
-static char ** parse_device_name(char * user_name) {
-    GPtrArray * rval;
-    char * cur_end = user_name;
-    char * cur_begin = user_name;
-    
-    rval = g_ptr_array_new();
-    
-    /* Check opening brace. */
-    if (*cur_begin != '{')
-        return NULL;
-    cur_begin ++;
-    
-    cur_end = cur_begin;
-    for (;;) {
-        switch (*cur_end) {
-        case ',': {
-            g_ptr_array_add(rval, g_strndup(cur_begin, cur_end - cur_begin));
-            cur_end ++;
-            cur_begin = cur_end;
-            continue;
-        }
+/* Helper for parse_device_name; returns a list of un-escaped strings for
+ * the first "component" of str, where a component is a plain string or a
+ * brace-enclosed set of alternatives.  str is pointing to the first character
+ * of the next component on return. */
+static GPtrArray *
+parse_device_name_component(char **str)
+{
+    GPtrArray *result = g_ptr_array_new();
+
+    if (**str == '{') {
+       char *p = (*str)+1;
+       char *local = g_malloc(strlen(*str)+1);
+       char *current = local;
+       char *c = current;
+
+       while (1) {
+           if (*p == '\0' || *p == '{') {
+               /* unterminated { .. } or extra '{' */
+               amfree(local);
+               g_ptr_array_free(result, TRUE);
+               return NULL;
+           }
+
+           if (*p == '}' || *p == ',') {
+               *c = '\0';
+               g_ptr_array_add(result, g_strdup(current));
+               current = ++c;
+
+               if (*p == '}')
+                   break;
+               else
+                   p++;
+           }
+
+           if (*p == '\\') {
+               if (*(p+1) == '{' || *(p+1) == '}' || *(p+1) == '\\' || *(p+1) == ',')
+                   p++;
+           }
+           *(c++) = *(p++);
+       }
 
-        case '{':
-            /* We read until the matching closing brace. */
-            while (*cur_end != '}' && *cur_end != '\0')
-                cur_end ++;
-            if (*cur_end == '}')
-                cur_end ++;
-            continue;
-            
-        case '}':
-            g_ptr_array_add(rval, g_strndup(cur_begin, cur_end - cur_begin));
-            goto OUTER_END; /* break loop, not switch */
-
-        case '\0':
-            /* Unexpected NULL; abort. */
-            g_fprintf(stderr, "Invalid RAIT device name %s\n", user_name);
-            g_ptr_array_free_full(rval);
-            return NULL;
-
-        default:
-            cur_end ++;
-            continue;
-        }
-        g_assert_not_reached();
-    }
- OUTER_END:
-    
-    if (cur_end[1] != '\0') {
-        g_fprintf(stderr, "Invalid RAIT device name %s\n", user_name);
-        g_ptr_array_free_full(rval);
-        return NULL;
+       amfree(local);
+
+       if (*p)
+           *str = p+1;
+       else
+           *str = p;
+    } else {
+       /* no braces -- just un-escape a plain string */
+       char *local = g_malloc(strlen(*str)+1);
+       char *r = local;
+       char *p = *str;
+
+       while (*p && *p != '{') {
+           if (*p == '\\') {
+               if (*(p+1) == '{' || *(p+1) == '}' || *(p+1) == '\\' || *(p+1) == ',')
+                   p++;
+           }
+           *(r++) = *(p++);
+       }
+       *r = '\0';
+       g_ptr_array_add(result, local);
+       *str = p;
     }
 
-    g_ptr_array_add(rval, NULL);
+    return result;
+}
+
+/* Take a text string user_name, and break it out into an argv-style
+   array of strings, using a {..,..} syntax similar to shell brace expansion.
+   For example:
+
+     "{foo,bar,bat}" -> [ "foo", "bar", "bat" ]
+     "foo{1,2}bar" -> [ "foo1bar", "foo2bar" ]
+     "foo{1\,2,3}bar" -> [ "foo1,2bar", "foo3bar" ]
+     "{a,b}-{1,2}" -> [ "a-1", "a-2", "b-1", "b-2" ]
+
+   Note that nested braces are not processed.  Braces, commas, and backslashes
+   may be escaped with backslashes.  Returns NULL on invalid strings.
+   */
+
+static GPtrArray *
+parse_device_name(char * user_name)
+{
+    GPtrArray *rval = g_ptr_array_new();
+
+    g_ptr_array_add(rval, g_strdup(""));
 
-    return (char**) g_ptr_array_free(rval, FALSE);
+    while (*user_name) {
+       GPtrArray *new_components;
+       GPtrArray *new_rval;
+       guint i, j;
+
+       new_components = parse_device_name_component(&user_name);
+       if (!new_components) {
+           /* parse error */
+           g_ptr_array_free(rval, TRUE);
+           return NULL;
+       }
+
+       new_rval = g_ptr_array_new();
+
+       /* do a cartesian join of rval and new_components */
+       for (i = 0; i < rval->len; i++) {
+           for (j = 0; j < new_components->len; j++) {
+               g_ptr_array_add(new_rval, g_strconcat(
+                   g_ptr_array_index(rval, i),
+                   g_ptr_array_index(new_components, j),
+                   NULL));
+           }
+       }
+
+       g_ptr_array_free(rval, TRUE);
+       g_ptr_array_free(new_components, TRUE);
+       rval = new_rval;
+    }
+
+    return rval;
 }
 
-/* Find a workable block size. */
-static gboolean find_block_size(RaitDevice * self) {
-    uint min = 0;
-    uint max = G_MAXUINT;
-    uint result;
-    GValue val;
-    gboolean rval;
+static char *
+child_device_names_to_rait_name(RaitDevice * self) {
+    GString *rait_name = NULL;
     guint i;
-    guint data_children;
-    
+
+    rait_name = g_string_new("rait:{");
+
     for (i = 0; i < self->private->children->len; i ++) {
-        uint child_min, child_max;
-        GValue property_result;
-        bzero(&property_result, sizeof(property_result));
+       Device *child = g_ptr_array_index(self->private->children, i);
+       const char *child_name = NULL;
+        GValue val;
+       gboolean got_prop = FALSE;
+
+        bzero(&val, sizeof(val));
+
+        if ((signed)i != self->private->failed) {
+           if (device_property_get(child, PROPERTY_CANONICAL_NAME, &val)) {
+               child_name = g_value_get_string(&val);
+               got_prop = TRUE;
+           }
+       }
 
-        if (!device_property_get(g_ptr_array_index(self->private->children, i),
-                                 PROPERTY_MIN_BLOCK_SIZE, &property_result))
-            return FALSE;
-        child_min = g_value_get_uint(&property_result);
-        g_return_val_if_fail(child_min > 0, FALSE);
-        if (!device_property_get(g_ptr_array_index(self->private->children, i),
-                                 PROPERTY_MAX_BLOCK_SIZE, &property_result))
-            return FALSE;
-        child_max = g_value_get_uint(&property_result);
-        g_return_val_if_fail(child_max > 0, FALSE);
-        
-        if (child_min > max || child_max < min || child_min == 0) {
-            return FALSE;
-        } else {
-            min = MAX(min, child_min);
-            max = MIN(max, child_max);
-        }
-    }
+       if (!got_prop)
+            child_name = "MISSING";
 
-    /* Now pick a number. */
-    g_assert(min <= max);
-    if (max < MAX_TAPE_BLOCK_BYTES)
-        result = max;
-    else if (min > MAX_TAPE_BLOCK_BYTES)
-        result = min;
-    else
-        result = MAX_TAPE_BLOCK_BYTES;
+       g_string_append_printf(rait_name, "%s%s", child_name,
+               (i < self->private->children->len-1)? "," : "");
 
-    /* User reads and writes bigger blocks. */
-    find_simple_params(self, NULL, &data_children, NULL);
-    self->private->block_size = result * data_children;
+       if (got_prop)
+           g_value_unset(&val);
+    }
 
-    bzero(&val, sizeof(val));
-    g_value_init(&val, G_TYPE_INT);
-    g_value_set_int(&val, result);
-    /* We can't do device_property_set because it's disallowed
-       according to the registered property base. */
-    rval = rait_device_property_set(DEVICE(self), PROPERTY_BLOCK_SIZE, &val);
-    g_value_unset(&val);
-    return rval;
+    g_string_append(rait_name, "}");
+    return g_string_free(rait_name, FALSE);
 }
 
-/* Register properties that belong to the RAIT device proper, and not
-   to subdevices. */
-static void register_rait_properties(RaitDevice * self) {
-    Device * o = DEVICE(self);
-    DeviceProperty prop;
+/* Find a workable child block size, based on the block size ranges of our
+ * child devices.
+ *
+ * The algorithm is to construct the intersection of all child devices'
+ * [min,max] block size ranges, and then pick the block size closest to 32k
+ * that is in the resulting range.  This avoids picking ridiculously small (1
+ * byte) or large (INT_MAX) block sizes when using devices with wide-open block
+ * size ranges.
+
+ * This function returns the calculated child block size directly, and the RAIT
+ * device's blocksize via rait_size, if not NULL.  It is resilient to errors in
+ * a single child device, but sets the device's error status and returns 0 if
+ * it cannot determine an agreeable block size.
+ */
+static gsize
+calculate_block_size_from_children(RaitDevice * self, gsize *rait_size)
+{
+    gsize min = 0;
+    gsize max = SIZE_MAX;
+    gboolean found_one = FALSE;
+    gsize result;
+    guint i;
+
+    for (i = 0; i < self->private->children->len; i ++) {
+        gsize child_min = SIZE_MAX, child_max = 0;
+       Device *child;
+        GValue property_result;
+       PropertySource source;
 
-    prop.access = PROPERTY_ACCESS_GET_MASK;
+        bzero(&property_result, sizeof(property_result));
 
-    prop.base = &device_property_min_block_size;
-    device_add_property(o, &prop, NULL);
+       if ((signed)i == self->private->failed)
+           continue;
 
-    prop.base = &device_property_max_block_size;
-    device_add_property(o, &prop, NULL);
-  
-    prop.base = &device_property_block_size;
-    device_add_property(o, &prop, NULL);
+       child = g_ptr_array_index(self->private->children, i);
+        if (!device_property_get_ex(child, PROPERTY_BLOCK_SIZE,
+                                &property_result, NULL, &source)) {
+           g_warning("Error getting BLOCK_SIZE from %s: %s",
+                   child->device_name, device_error_or_status(child));
+            continue;
+       }
 
-    prop.base = &device_property_canonical_name;
-    device_add_property(o, &prop, NULL);
-}
+       /* if the block size has been set explicitly, then we need to use that blocksize;
+        * otherwise (even if it was DETECTED), override it. */
+       if (source == PROPERTY_SOURCE_USER) {
+           child_min = child_max = g_value_get_int(&property_result);
+       } else {
+           if (!device_property_get(child, PROPERTY_MIN_BLOCK_SIZE,
+                                    &property_result)) {
+               g_warning("Error getting MIN_BLOCK_SIZE from %s: %s",
+                       child->device_name, device_error_or_status(child));
+               continue;
+           }
+           child_min = g_value_get_uint(&property_result);
+
+           if (!device_property_get(child, PROPERTY_MAX_BLOCK_SIZE,
+                                    &property_result)) {
+               g_warning("Error getting MAX_BLOCK_SIZE from %s: %s",
+                       child->device_name, device_error_or_status(child));
+               continue;
+           }
+           child_max = g_value_get_uint(&property_result);
+
+           if (child_min == 0 || child_max == 0 || (child_min > child_max)) {
+               g_warning("Invalid min, max block sizes from %s", child->device_name);
+               continue;
+           }
+       }
 
-static void property_hash_union(GHashTable * properties,
-                                const DeviceProperty * prop) {
-    PropertyAccessFlags before, after;
-    gpointer tmp;
-    gboolean found;
-    
-    found = g_hash_table_lookup_extended(properties,
-                                         GUINT_TO_POINTER(prop->base->ID),
-                                         NULL, &tmp);
-    before = GPOINTER_TO_UINT(tmp);
-    
-    if (!found) {
-        after = prop->access;
-    } else {
-        after = before & prop->access;
+       found_one = TRUE;
+       min = MAX(min, child_min);
+       max = MIN(max, child_max);
     }
-    
-    g_hash_table_insert(properties, GUINT_TO_POINTER(prop->base->ID),
-                        GUINT_TO_POINTER(after));
-}
 
-/* A GHRFunc. */
-static gboolean zero_value(gpointer key G_GNUC_UNUSED, gpointer value,
-                           gpointer user_data G_GNUC_UNUSED) {
-    return (0 == GPOINTER_TO_UINT(value));
-}
+    if (!found_one) {
+       device_set_error((Device*)self,
+           stralloc(_("Could not find any child devices' block size ranges")),
+           DEVICE_STATUS_DEVICE_ERROR);
+       return 0;
+    }
 
-/* A GHFunc */
-static void register_property_hash(gpointer key, gpointer value,
-                                   gpointer user_data) {
-    DevicePropertyId id = GPOINTER_TO_UINT(key);
-    DeviceProperty prop;
-    Device * device = (Device*)user_data;
+    if (min > max) {
+       device_set_error((Device*)self,
+           stralloc(_("No block size is acceptable to all child devices")),
+           DEVICE_STATUS_DEVICE_ERROR);
+       return 0;
+    }
 
-    g_assert(IS_DEVICE(device));
+    /* Now pick a number.  If 32k is in range, we use that; otherwise, we use
+     * the nearest acceptable size. */
+    result = CLAMP(32768, min, max);
 
-    prop.access = GPOINTER_TO_UINT(value);
-    prop.base = device_property_get_by_id(id);
+    if (rait_size) {
+       guint data_children;
+       find_simple_params(self, NULL, &data_children);
+       *rait_size = result * data_children;
+    }
 
-    device_add_property(device, &prop, NULL);
+    return result;
 }
 
-/* This function figures out which properties exist for all children, and 
- * exports the unioned access mask. */
-static void register_properties(RaitDevice * self) {
-    GHashTable * properties; /* PropertyID => PropertyAccessFlags */
-    guint j;
-    
-    properties = g_hash_table_new(g_direct_hash, g_direct_equal);
+/* Set BLOCK_SIZE on all children */
+static gboolean
+set_block_size_on_children(RaitDevice *self, gsize child_block_size)
+{
+    GValue val;
+    guint i;
+    PropertySource source;
 
-    /* Iterate the device list, find all properties. */
-    for (j = 0; j < self->private->children->len; j ++) {
-        int i;
-        Device * child = g_ptr_array_index(self->private->children, j);
-        const DeviceProperty* device_property_list;
+    bzero(&val, sizeof(val));
 
-        device_property_list = device_property_get_list(child);
-        for (i = 0; device_property_list[i].base != NULL; i ++) {
-            property_hash_union(properties, &(device_property_list[i]));
-        }
+    g_assert(child_block_size < INT_MAX);
+    g_value_init(&val, G_TYPE_INT);
+    g_value_set_int(&val, (gint)child_block_size);
+
+    for (i = 0; i < self->private->children->len; i ++) {
+       Device *child;
+       GValue property_result;
+
+       bzero(&property_result, sizeof(property_result));
+
+       if ((signed)i == self->private->failed)
+           continue;
+
+       child = g_ptr_array_index(self->private->children, i);
+
+       /* first, make sure the block size is at its default, or is already
+        * correct */
+        if (device_property_get_ex(child, PROPERTY_BLOCK_SIZE,
+                                &property_result, NULL, &source)) {
+           gsize from_child = g_value_get_int(&property_result);
+           if (source != PROPERTY_SOURCE_DEFAULT
+                   && from_child != child_block_size) {
+               device_set_error((Device *)self,
+                   vstrallocf(_("Child device %s already has its block size set to %zd, not %zd"),
+                               child->device_name, from_child, child_block_size),
+                   DEVICE_STATUS_DEVICE_ERROR);
+               return FALSE;
+           }
+       } else {
+           /* failing to get the block size isn't necessarily fatal.. */
+           g_warning("Error getting BLOCK_SIZE from %s: %s",
+                   child->device_name, device_error_or_status(child));
+       }
+       g_value_unset(&property_result);
+
+       if (!device_property_set(child, PROPERTY_BLOCK_SIZE, &val)) {
+           device_set_error((Device *)self,
+               vstrallocf(_("Error setting block size on %s"), child->device_name),
+               DEVICE_STATUS_DEVICE_ERROR);
+           return FALSE;
+       }
     }
 
-    /* Then toss properties that can't be accessed. */
-    g_hash_table_foreach_remove(properties, zero_value, NULL);
-    g_hash_table_remove(properties, GINT_TO_POINTER(PROPERTY_BLOCK_SIZE));
-    g_hash_table_remove(properties, GINT_TO_POINTER(PROPERTY_MIN_BLOCK_SIZE));
-    g_hash_table_remove(properties, GINT_TO_POINTER(PROPERTY_MAX_BLOCK_SIZE));
-    g_hash_table_remove(properties, GINT_TO_POINTER(PROPERTY_CANONICAL_NAME));
+    return TRUE;
+}
+
+/* The time for users to specify block sizes has ended; set this device's
+ * block-size attributes for easy access by other RAIT functions.  Returns
+ * FALSE on error, with the device's error status already set. */
+static gboolean
+fix_block_size(RaitDevice *self)
+{
+    Device *dself = (Device *)self;
+    gsize my_block_size, child_block_size;
+
+    if (dself->block_size_source == PROPERTY_SOURCE_DEFAULT) {
+       child_block_size = calculate_block_size_from_children(self, &my_block_size);
+       if (child_block_size == 0)
+           return FALSE;
+
+       self->private->child_block_size = child_block_size;
+       dself->block_size = my_block_size;
+       dself->block_size_surety = PROPERTY_SURETY_GOOD;
+       dself->block_size_source = PROPERTY_SOURCE_DETECTED;
+    } else {
+       guint data_children;
 
-    /* Finally, register the lot. */
-    g_hash_table_foreach(properties, register_property_hash, self);
+       find_simple_params(self, NULL, &data_children);
+       g_assert((dself->block_size % data_children) == 0);
+       child_block_size = dself->block_size / data_children;
+    }
 
-    g_hash_table_destroy(properties);
+    /* now tell the children we mean it */
+    if (!set_block_size_on_children(self, child_block_size))
+       return FALSE;
 
-    /* Then we have some of our own properties to register. */
-    register_rait_properties(self);
+    return TRUE;
 }
 
 /* This structure contains common fields for many operations. Not all
@@ -477,7 +880,9 @@ static gboolean extract_boolean_pointer_op(gpointer data) {
 /* Does the equivalent of this perl command:
      ! (first { !extractor($_) } @_
    That is, calls extractor on each element of the array, and returns
-   TRUE if and only if all calls to extractor return TRUE.
+   TRUE if and only if all calls to extractor return TRUE. This function
+   stops as soon as an extractor returns false, so it's best if extractor
+   functions have no side effects.
 */
 static gboolean g_ptr_array_and(GPtrArray * array,
                                 BooleanExtractor extractor) {
@@ -493,23 +898,6 @@ static gboolean g_ptr_array_and(GPtrArray * array,
     return TRUE;
 }
 
-/* Calls extractor on each element of the array, and returns
-   TRUE if at least one of the calls to extractor return TRUE.
-*/
-static gboolean g_ptr_array_or(GPtrArray * array,
-                                BooleanExtractor extractor) {
-    guint i;
-    if (array == NULL || array->len <= 0)
-        return FALSE;
-
-    for (i = 0; i < array->len; i ++) {
-        if (extractor(g_ptr_array_index(array, i)))
-            return TRUE;
-    }
-
-    return FALSE;
-}
-
 /* Takes a RaitDevice, and makes a GPtrArray of GenericOp. */
 static GPtrArray * make_generic_boolean_op_array(RaitDevice* self) {
     GPtrArray * rval;
@@ -518,7 +906,12 @@ static GPtrArray * make_generic_boolean_op_array(RaitDevice* self) {
     rval = g_ptr_array_sized_new(self->private->children->len);
     for (i = 0; i < self->private->children->len; i ++) {
         GenericOp * op;
-        op = malloc(sizeof(*op));
+
+        if ((signed)i == self->private->failed) {
+            continue;
+        }
+
+        op = g_new(GenericOp, 1);
         op->child = g_ptr_array_index(self->private->children, i);
         op->child_index = i;
         g_ptr_array_add(rval, op);
@@ -533,20 +926,22 @@ static GPtrArray * make_generic_boolean_op_array(RaitDevice* self) {
    occured. */
 static gboolean g_ptr_array_union_robust(RaitDevice * self, GPtrArray * ops,
                                          BooleanExtractor extractor) {
-    int nfailed;
+    int nfailed = 0;
+    int lastfailed = 0;
     guint i;
 
     /* We found one or more failed elements.  See which elements failed, and
      * isolate them*/
-    nfailed = 0;
     for (i = 0; i < ops->len; i ++) {
        GenericOp * op = g_ptr_array_index(ops, i);
        if (!extractor(op)) {
            self->private->failed = op->child_index;
-           g_fprintf(stderr, "RAIT array %s isolated device %s\n",
+           g_warning("RAIT array %s isolated device %s: %s",
                    DEVICE(self)->device_name,
-                   op->child->device_name);
+                   op->child->device_name,
+                   device_error(op->child));
            nfailed++;
+            lastfailed = i;
        }
     }
 
@@ -557,27 +952,37 @@ static gboolean g_ptr_array_union_robust(RaitDevice * self, GPtrArray * ops,
     /* a single failure in COMPLETE just puts us in DEGRADED mode */
     if (self->private->status == RAIT_STATUS_COMPLETE && nfailed == 1) {
        self->private->status = RAIT_STATUS_DEGRADED;
-       g_fprintf(stderr, "RAIT array %s DEGRADED\n", DEVICE(self)->device_name);
+        self->private->failed = lastfailed;
+       g_warning("RAIT array %s DEGRADED", DEVICE(self)->device_name);
        return TRUE;
     } else {
        self->private->status = RAIT_STATUS_FAILED;
-       g_fprintf(stderr, "RAIT array %s FAILED\n", DEVICE(self)->device_name);
+       g_warning("RAIT array %s FAILED", DEVICE(self)->device_name);
        return FALSE;
     }
 }
 
 typedef struct {
-    Device * result;    /* IN */
-    char * device_name; /* OUT */
+    RaitDevice * self;
+    char *rait_name;
+    char * device_name; /* IN */
+    Device * result;    /* OUT */
 } OpenDeviceOp;
 
 /* A GFunc. */
-static void open_device_do_op(gpointer data,
+static void device_open_do_op(gpointer data,
                               gpointer user_data G_GNUC_UNUSED) {
     OpenDeviceOp * op = data;
 
-    op->result = device_open(op->device_name);
-    amfree(op->device_name);
+    if (strcmp(op->device_name, "ERROR") == 0 ||
+        strcmp(op->device_name, "MISSING") == 0 ||
+        strcmp(op->device_name, "DEGRADED") == 0) {
+        g_warning("RAIT device %s contains a missing element, attempting "
+                  "degraded mode.\n", op->rait_name);
+        op->result = NULL;
+    } else {
+        op->result = device_open(op->device_name);
+    }
 }
 
 /* Returns TRUE if and only if the volume label and time are equal. */
@@ -586,64 +991,111 @@ static gboolean compare_volume_results(Device * a, Device * b) {
         && 0 == compare_possibly_null_strings(a->volume_label, b->volume_label));
 }
 
-static gboolean 
-rait_device_open_device (Device * dself, char * device_name) {
-    char ** device_names;
-    GPtrArray * open_device_ops;
+/* Stickes new_message at the end of *old_message; frees new_message and
+ * may change *old_message. */
+static void append_message(char ** old_message, char * new_message) {
+    char * rval;
+    if (*old_message == NULL || **old_message == '\0') {
+        rval = new_message;
+    } else {
+        rval = g_strdup_printf("%s; %s", *old_message, new_message);
+        amfree(new_message);
+    }
+    amfree(*old_message);
+    *old_message = rval;
+}
+
+static void
+rait_device_open_device (Device * dself, char * device_name,
+           char * device_type G_GNUC_UNUSED, char * device_node) {
+    GPtrArray *device_names;
+    GPtrArray * device_open_ops;
     guint i;
     gboolean failure;
+    char *failure_errmsgs;
+    DeviceStatusFlags failure_flags;
     RaitDevice * self;
 
     self = RAIT_DEVICE(dself);
-    g_return_val_if_fail(self != NULL, FALSE);
-    g_return_val_if_fail (device_name != NULL, FALSE);
 
-    device_names = parse_device_name(device_name);
-    
-    if (device_names == NULL)
-        return FALSE;
+    device_names = parse_device_name(device_node);
+
+    if (device_names == NULL) {
+       device_set_error(dself,
+           vstrallocf(_("Invalid RAIT device name '%s'"), device_name),
+           DEVICE_STATUS_DEVICE_ERROR);
+        return;
+    }
 
     /* Open devices in a separate thread, in case they have to rewind etc. */
-    open_device_ops = g_ptr_array_new();
+    device_open_ops = g_ptr_array_new();
 
-    for (i = 0; device_names[i] != NULL; i ++) {
+    for (i = 0; i < device_names->len; i++) {
         OpenDeviceOp *op;
+       char *name = g_ptr_array_index(device_names, i);
 
-        op = malloc(sizeof(*op));
-        op->device_name = device_names[i];
+        op = g_new(OpenDeviceOp, 1);
+        op->device_name = name;
         op->result = NULL;
-        g_ptr_array_add(open_device_ops, op);
+        op->self = self;
+       op->rait_name = device_name;
+        g_ptr_array_add(device_open_ops, op);
     }
 
-    free(device_names);
-    do_rait_child_ops(open_device_do_op, open_device_ops, NULL);
+    g_ptr_array_free(device_names, TRUE);
+    do_rait_child_ops(self, device_open_do_op, device_open_ops);
 
     failure = FALSE;
+    failure_errmsgs = NULL;
+    failure_flags = 0;
+
     /* Check results of opening devices. */
-    for (i = 0; i < open_device_ops->len; i ++) {
-        OpenDeviceOp *op = g_ptr_array_index(open_device_ops, i);
-        
-        if (op->result != NULL) {
-            g_ptr_array_add(self->private->children, op->result);
+    for (i = 0; i < device_open_ops->len; i ++) {
+        OpenDeviceOp *op = g_ptr_array_index(device_open_ops, i);
+
+        if (op->result != NULL &&
+            op->result->status == DEVICE_STATUS_SUCCESS) {
+           g_ptr_array_add(self->private->children, op->result);
         } else {
-            failure = TRUE;
+            char * this_failure_errmsg =
+                g_strdup_printf("%s: %s", op->device_name,
+                                device_error_or_status(op->result));
+            DeviceStatusFlags status =
+                op->result == NULL ?
+                    DEVICE_STATUS_DEVICE_ERROR : op->result->status;
+            append_message(&failure_errmsgs,
+                           strdup(this_failure_errmsg));
+           failure_flags |= status;
+            if (self->private->status == RAIT_STATUS_COMPLETE) {
+                /* The first failure just puts us in degraded mode. */
+                g_warning("%s: %s",
+                          device_name, this_failure_errmsg);
+               g_warning("%s: %s failed, entering degraded mode.",
+                          device_name, op->device_name);
+                g_ptr_array_add(self->private->children, op->result);
+                self->private->status = RAIT_STATUS_DEGRADED;
+                self->private->failed = i;
+            } else {
+                /* The second and further failures are fatal. */
+                failure = TRUE;
+            }
         }
+        amfree(op->device_name);
     }
 
-    g_ptr_array_free_full(open_device_ops);
-
-    failure = failure || !find_block_size(self);
-    if (failure)
-        return FALSE; /* This will clean up any created children. */
+    g_ptr_array_free_full(device_open_ops);
 
-    register_properties(self);
+    if (failure) {
+        self->private->status = RAIT_STATUS_FAILED;
+       device_set_error(dself, failure_errmsgs, failure_flags);
+        return;
+    }
 
     /* Chain up. */
     if (parent_class->open_device) {
-        return parent_class->open_device(dself, device_name);
-    } else {
-        return TRUE;
+        parent_class->open_device(dself, device_name, device_type, device_node);
     }
+    return;
 }
 
 /* A GFunc. */
@@ -653,72 +1105,63 @@ static void read_label_do_op(gpointer data,
     op->result = GINT_TO_POINTER(device_read_label(op->child));
 }
 
-static ReadLabelStatusFlags rait_device_read_label(Device * dself) {
+static DeviceStatusFlags rait_device_read_label(Device * dself) {
     RaitDevice * self;
     GPtrArray * ops;
-    ReadLabelStatusFlags failed_result = 0;
-    ReadLabelStatusFlags rval;
-    GenericOp * failed_op = NULL; /* If this is non-null, we will isolate. */
+    DeviceStatusFlags failed_result = 0;
+    char *failed_errmsg = NULL;
     unsigned int i;
     Device * first_success = NULL;
 
     self = RAIT_DEVICE(dself);
-    g_return_val_if_fail(self != NULL, FALSE);
 
+    amfree(dself->volume_time);
     amfree(dself->volume_label);
+    amfree(dself->volume_header);
+
+    if (rait_device_in_error(self))
+        return dself->status | DEVICE_STATUS_DEVICE_ERROR;
+
+    /* nail down our block size, if we haven't already */
+    if (!fix_block_size(self))
+       return FALSE;
 
     ops = make_generic_boolean_op_array(self);
     
-    do_rait_child_ops(read_label_do_op, ops, NULL);
+    do_rait_child_ops(self, read_label_do_op, ops);
     
     for (i = 0; i < ops->len; i ++) {
         GenericOp * op = g_ptr_array_index(ops, i);
-        ReadLabelStatusFlags result = GPOINTER_TO_INT(op->result);
-        if (op->result == READ_LABEL_STATUS_SUCCESS) {
+        DeviceStatusFlags result = GPOINTER_TO_INT(op->result);
+        if (op->result == DEVICE_STATUS_SUCCESS) {
             if (first_success == NULL) {
                 /* This is the first successful device. */
                 first_success = op->child;
             } else if (!compare_volume_results(first_success, op->child)) {
                 /* Doesn't match. :-( */
-                g_fprintf(stderr, "Inconsistant volume labels: "
-                        "Got %s/%s against %s/%s.\n",
+               failed_errmsg = vstrallocf("Inconsistent volume labels/datestamps: "
+                        "Got %s/%s on %s against %s/%s on %s.",
                         first_success->volume_label,
-                        first_success->volume_time, 
+                        first_success->volume_time,
+                       first_success->device_name,
                         op->child->volume_label,
-                        op->child->volume_time);
-                failed_result |= READ_LABEL_STATUS_VOLUME_ERROR;
-                failed_op = NULL;
+                        op->child->volume_time,
+                       op->child->device_name);
+               g_warning("%s", failed_errmsg);
+                failed_result |= DEVICE_STATUS_VOLUME_ERROR;
             }
         } else {
-            if (failed_result == 0 &&
-                self->private->status == RAIT_STATUS_COMPLETE) {
-                /* This is the first failed device; note it and we'll isolate
-                   later. */
-                failed_op = op;
-                failed_result = result;
-            } else {
-                /* We've encountered multiple failures. OR them together. */
-                failed_result |= result;
-                failed_op = NULL;
-            }
+            failed_result |= result;
         }
     }
 
-    if (failed_op != NULL) {
-        /* We have a single device to isolate. */
-        failed_result = READ_LABEL_STATUS_SUCCESS; /* Recover later */
-        self->private->failed = failed_op->child_index;
-        g_fprintf(stderr, "RAIT array %s Isolated device %s.\n",
-                dself->device_name,
-                failed_op->child->device_name);
-    }
-
-    if (failed_result != READ_LABEL_STATUS_SUCCESS) {
+    if (failed_result != DEVICE_STATUS_SUCCESS) {
         /* We had multiple failures or an inconsistency. */
-        rval = failed_result;
+       device_set_error(dself, failed_errmsg, failed_result);
     } else {
         /* Everything peachy. */
-        rval = READ_LABEL_STATUS_SUCCESS;
+       amfree(failed_errmsg);
+
         g_assert(first_success != NULL);
         if (first_success->volume_label != NULL) {
             dself->volume_label = g_strdup(first_success->volume_label);
@@ -726,11 +1169,14 @@ static ReadLabelStatusFlags rait_device_read_label(Device * dself) {
         if (first_success->volume_time != NULL) {
             dself->volume_time = g_strdup(first_success->volume_time);
         }
+        if (first_success->volume_header != NULL) {
+            dself->volume_header = dumpfile_copy(first_success->volume_header);
+        }
     }
     
     g_ptr_array_free_full(ops);
 
-    return rval;
+    return dself->status;
 }
 
 typedef struct {
@@ -756,25 +1202,74 @@ static void start_do_op(gpointer data, gpointer user_data G_GNUC_UNUSED) {
     }
 }
 
-static gboolean 
-rait_device_start (Device * dself, DeviceAccessMode mode, char * label,
+static gboolean
+rait_device_configure(Device * dself, gboolean use_global_config)
+{
+    RaitDevice *self = RAIT_DEVICE(dself);
+    guint i;
+
+    for (i = 0; i < self->private->children->len; i ++) {
+       Device *child;
+
+       if ((signed)i == self->private->failed)
+           continue;
+
+       child = g_ptr_array_index(self->private->children, i);
+       /* unconditionally configure the child without the global
+        * configuration */
+       if (!device_configure(child, FALSE))
+           return FALSE;
+    }
+
+    if (parent_class->configure) {
+        return parent_class->configure(dself, use_global_config);
+    }
+
+    return TRUE;
+}
+
+static gboolean 
+rait_device_start (Device * dself, DeviceAccessMode mode, char * label,
                    char * timestamp) {
     GPtrArray * ops;
     guint i;
     gboolean success;
     RaitDevice * self;
+    DeviceStatusFlags total_status;
+    char *failure_errmsgs = NULL;
     char * label_from_device = NULL;
 
     self = RAIT_DEVICE(dself);
-    g_return_val_if_fail(self != NULL, FALSE);
 
-    amfree(dself->volume_label);
-    amfree(dself->volume_time);
+    if (rait_device_in_error(self)) return FALSE;
+
+    /* No starting in degraded mode. */
+    if (self->private->status != RAIT_STATUS_COMPLETE &&
+        (mode == ACCESS_WRITE || mode == ACCESS_APPEND)) {
+        device_set_error(dself,
+                         g_strdup_printf(_("RAIT device %s is read-only "
+                                           "because it is in degraded mode.\n"),
+                                         dself->device_name),
+                         DEVICE_STATUS_DEVICE_ERROR);
+        return FALSE;
+    }
+
+    /* nail down our block size, if we haven't already */
+    if (!fix_block_size(self))
+       return FALSE;
+
+    dself->access_mode = mode;
+    dself->in_file = FALSE;
 
     ops = g_ptr_array_sized_new(self->private->children->len);
     for (i = 0; i < self->private->children->len; i ++) {
         StartOp * op;
-        op = malloc(sizeof(*op));
+        
+        if ((signed)i == self->private->failed) {
+            continue;
+        }
+
+        op = g_new(StartOp, 1);
         op->base.child = g_ptr_array_index(self->private->children, i);
         op->mode = mode;
         op->label = g_strdup(label);
@@ -782,30 +1277,42 @@ rait_device_start (Device * dself, DeviceAccessMode mode, char * label,
         g_ptr_array_add(ops, op);
     }
     
-    do_rait_child_ops(start_do_op, ops, NULL);
+    do_rait_child_ops(self, start_do_op, ops);
 
     success = g_ptr_array_and(ops, extract_boolean_generic_op);
 
-    /* check that all of the volume labels agree */
-    if (success) {
-       for (i = 0; i < self->private->children->len; i ++) {
-           Device *child = g_ptr_array_index(self->private->children, i);
-
+    /* Check results of starting devices; this is mostly about the
+     * VOLUME_UNLABELED flag. */
+    total_status = 0;
+    for (i = 0; i < ops->len; i ++) {
+        StartOp * op = g_ptr_array_index(ops, i);
+        Device *child = op->base.child;
+
+        total_status |= child->status;
+       if (child->status != DEVICE_STATUS_SUCCESS) {
+           /* record the error message and move on. */
+            append_message(&failure_errmsgs,
+                           g_strdup_printf("%s: %s",
+                                           child->device_name,
+                                           device_error_or_status(child)));
+        } else {
            if (child->volume_label != NULL && child->volume_time != NULL) {
                 if (dself->volume_label != NULL && dself->volume_time != NULL) {
                     if (strcmp(child->volume_label, dself->volume_label) != 0 ||
                         strcmp(child->volume_time, dself->volume_time) != 0) {
                         /* Mismatch! (Two devices provided different labels) */
-                       g_fprintf(stderr, "%s: Label (%s/%s) is different "
-                                          "from label (%s/%s) found at "
-                                          "device %s",
-                                          child->device_name,
-                                          child->volume_label,
-                                          child->volume_time,
-                                          dself->volume_label,
-                                          dself->volume_time,
-                                          label_from_device);
-                       success = FALSE;
+                        char * this_message =
+                            g_strdup_printf("%s: Label (%s/%s) is different "
+                                            "from label (%s/%s) found at "
+                                            "device %s",
+                                            child->device_name,
+                                            child->volume_label,
+                                            child->volume_time,
+                                            dself->volume_label,
+                                            dself->volume_time,
+                                            label_from_device);
+                        append_message(&failure_errmsgs, this_message);
+                        total_status |= DEVICE_STATUS_DEVICE_ERROR;
                     }
                 } else {
                     /* First device with a volume. */
@@ -815,11 +1322,11 @@ rait_device_start (Device * dself, DeviceAccessMode mode, char * label,
                 }
             } else {
                 /* Device problem, it says it succeeded but sets no label? */
-               g_fprintf(stderr, "%s: %s",
-                                  child->device_name,
-                                  "Says label read, but device->volume_label "
-                                  " is NULL.");
-               success = FALSE;
+                char * this_message =
+                    g_strdup_printf("%s: Says label read, but no volume "
+                                     "label found.", child->device_name);
+                append_message(&failure_errmsgs, this_message);
+                total_status |= DEVICE_STATUS_DEVICE_ERROR;
             }
        }
     }
@@ -827,18 +1334,20 @@ rait_device_start (Device * dself, DeviceAccessMode mode, char * label,
     amfree(label_from_device);
     g_ptr_array_free_full(ops);
 
+    dself->status = total_status;
+
     if (!success) {
+       device_set_error(dself, failure_errmsgs, total_status);
         return FALSE;
-    } else if (parent_class->start) {
-        return parent_class->start(dself, mode, label, timestamp);
-    } else {
-        return TRUE;
     }
+
+    amfree(failure_errmsgs);
+    return TRUE;
 }
 
 typedef struct {
     GenericOp base;
-    const dumpfile_t * info; /* IN */
+    dumpfile_t * info; /* IN */
     int fileno;
 } StartFileOp;
 
@@ -854,7 +1363,7 @@ static void start_file_do_op(gpointer data, gpointer user_data G_GNUC_UNUSED) {
 }
 
 static gboolean
-rait_device_start_file (Device * dself, const dumpfile_t * info) {
+rait_device_start_file (Device * dself, dumpfile_t * info) {
     GPtrArray * ops;
     guint i;
     gboolean success;
@@ -862,18 +1371,22 @@ rait_device_start_file (Device * dself, const dumpfile_t * info) {
     int actual_file = -1;
 
     self = RAIT_DEVICE(dself);
-    g_return_val_if_fail(self != NULL, FALSE);
+
+    if (rait_device_in_error(self)) return FALSE;
+    if (self->private->status != RAIT_STATUS_COMPLETE) return FALSE;
 
     ops = g_ptr_array_sized_new(self->private->children->len);
     for (i = 0; i < self->private->children->len; i ++) {
         StartFileOp * op;
-        op = malloc(sizeof(*op));
+        op = g_new(StartFileOp, 1);
         op->base.child = g_ptr_array_index(self->private->children, i);
-        op->info = info;
+       /* each child gets its own copy of the header, to munge as it
+        * likes (setting blocksize, at least) */
+        op->info = dumpfile_copy(info);
         g_ptr_array_add(ops, op);
     }
     
-    do_rait_child_ops(start_file_do_op, ops, NULL);
+    do_rait_child_ops(self, start_file_do_op, ops);
 
     success = g_ptr_array_and(ops, extract_boolean_generic_op);
     
@@ -887,38 +1400,45 @@ rait_device_start_file (Device * dself, const dumpfile_t * info) {
         }
         if (actual_file != op->fileno) {
             /* File number mismatch! Aah, my hair is on fire! */
-           g_fprintf(stderr, "File number mismatch in "
-                            "rait_device_start_file(): "
-                            "Child %s reported file number "
-                            "%d, another child reported "
-                            "file number %d.",
-                            op->base.child->device_name,
-                            op->fileno, actual_file);
+            device_set_error(dself,
+                             g_strdup_printf("File number mismatch in "
+                                             "rait_device_start_file(): "
+                                             "Child %s reported file number "
+                                             "%d, another child reported "
+                                             "file number %d.",
+                                             op->base.child->device_name,
+                                             op->fileno, actual_file),
+                             DEVICE_STATUS_DEVICE_ERROR);
             success = FALSE;
             op->base.result = FALSE;
         }
     }
 
+    for (i = 0; i < ops->len && success; i ++) {
+        StartFileOp * op = g_ptr_array_index(ops, i);
+       if (op->info) dumpfile_free(op->info);
+    }
     g_ptr_array_free_full(ops);
 
-    g_assert(actual_file >= 1);
-    dself->file = actual_file - 1; /* chain-up, below, will re-increment this */
-    dself->in_file = TRUE;
-
     if (!success) {
-       g_fprintf(stderr, _("One or more devices failed to start_file"));
+        if (!device_in_error(dself)) {
+            device_set_error(dself, stralloc("One or more devices "
+                                             "failed to start_file"),
+                             DEVICE_STATUS_DEVICE_ERROR);
+        }
         return FALSE;
-    } else if (parent_class->start_file) {
-        return parent_class->start_file(dself, info);
-    } else {
-        return TRUE;
     }
+
+    dself->in_file = TRUE;
+    g_assert(actual_file >= 1);
+    dself->file = actual_file;
+
+    return TRUE;
 }
 
 static void find_simple_params(RaitDevice * self,
                                guint * num_children,
-                               guint * data_children,
-                               int * blocksize) {
+                               guint * data_children) {
     int num, data;
     
     num = self->private->children->len;
@@ -930,17 +1450,12 @@ static void find_simple_params(RaitDevice * self,
         *num_children = num;
     if (data_children != NULL)
         *data_children = data;
-
-    if (blocksize != NULL) {
-        *blocksize = device_write_min_size(DEVICE(self));
-    }
 }
 
 typedef struct {
     GenericOp base;
     guint size;           /* IN */
     gpointer data;        /* IN */
-    gboolean short_block; /* IN */
     gboolean data_needs_free; /* bookkeeping */
 } WriteBlockOp;
 
@@ -950,8 +1465,7 @@ static void write_block_do_op(gpointer data,
     WriteBlockOp * op = data;
 
     op->base.result =
-        GINT_TO_POINTER(device_write_block(op->base.child, op->size, op->data,
-                                           op->short_block));
+        GINT_TO_POINTER(device_write_block(op->base.child, op->size, op->data));
 }
 
 /* Parity block generation. Performance of this function can be improved
@@ -996,12 +1510,12 @@ static char * extract_data_block(char * data, guint size,
     char * rval;
     guint chunk_size;
 
-    g_return_val_if_fail(chunks > 0 && chunk > 0 && chunk <= chunks, NULL);
-    g_return_val_if_fail(data != NULL, NULL);
-    g_return_val_if_fail(size > 0 && size % (chunks - 1) == 0, NULL);
+    g_assert(chunks > 0 && chunk > 0 && chunk <= chunks);
+    g_assert(data != NULL);
+    g_assert(size > 0 && size % (chunks - 1) == 0);
 
     chunk_size = size / (chunks - 1);
-    rval = malloc(chunk_size);
+    rval = g_malloc(chunk_size);
     if (chunks != chunk) {
         /* data block. */
         memcpy(rval, data + chunk_size * (chunk - 1), chunk_size);
@@ -1013,32 +1527,35 @@ static char * extract_data_block(char * data, guint size,
 }
 
 static gboolean 
-rait_device_write_block (Device * dself, guint size, gpointer data,
-                         gboolean last_block) {
+rait_device_write_block (Device * dself, guint size, gpointer data) {
     GPtrArray * ops;
     guint i;
     gboolean success;
     guint data_children, num_children;
-    int blocksize;
+    gsize blocksize = dself->block_size;
     RaitDevice * self;
+    gboolean last_block = (size < blocksize);
 
     self = RAIT_DEVICE(dself);
-    g_return_val_if_fail(self != NULL, FALSE);
 
-    find_simple_params(RAIT_DEVICE(self), &num_children, &data_children,
-                       &blocksize);
+    if (rait_device_in_error(self)) return FALSE;
+    if (self->private->status != RAIT_STATUS_COMPLETE) return FALSE;
+
+    find_simple_params(RAIT_DEVICE(self), &num_children, &data_children);
     num_children = self->private->children->len;
     if (num_children != 1)
         data_children = num_children - 1;
     else
         data_children = num_children;
     
-    g_return_val_if_fail(size % data_children == 0 || last_block, FALSE);
+    g_assert(size % data_children == 0 || last_block);
 
+    /* zero out to the end of a short block -- tape devices only write
+     * whole blocks. */
     if (last_block) {
         char *new_data;
 
-        new_data = malloc(blocksize);
+        new_data = g_malloc(blocksize);
         memcpy(new_data, data, size);
         bzero(new_data + size, blocksize - size);
 
@@ -1049,9 +1566,8 @@ rait_device_write_block (Device * dself, guint size, gpointer data,
     ops = g_ptr_array_sized_new(num_children);
     for (i = 0; i < self->private->children->len; i ++) {
         WriteBlockOp * op;
-        op = malloc(sizeof(*op));
+        op = g_malloc(sizeof(*op));
         op->base.child = g_ptr_array_index(self->private->children, i);
-        op->short_block = last_block;
         op->size = size / data_children;
         if (num_children <= 2) {
             op->data = data;
@@ -1063,7 +1579,7 @@ rait_device_write_block (Device * dself, guint size, gpointer data,
         g_ptr_array_add(ops, op);
     }
 
-    do_rait_child_ops(write_block_do_op, ops, NULL);
+    do_rait_child_ops(self, write_block_do_op, ops);
 
     success = g_ptr_array_and(ops, extract_boolean_generic_op);
 
@@ -1086,16 +1602,12 @@ rait_device_write_block (Device * dself, guint size, gpointer data,
         * status, and finish_file all of the non-EOF children. What's
         * more fun is when one device fails and must be isolated at
         * the same time another hits EOF. */
-       g_fprintf(stderr, "One or more devices failed to write_block");
+       device_set_error(dself,
+           stralloc("One or more devices failed to write_block"),
+           DEVICE_STATUS_DEVICE_ERROR);
         return FALSE;
     } else {
-        /* We don't chain up here because we must handle finish_file
-           differently. If we were called with last_block, then the
-           children have already called finish_file themselves. So we
-           update the device block numbers manually. */
         dself->block ++;
-        if (last_block)
-            dself->in_file = FALSE;
 
         return TRUE;
     }
@@ -1105,29 +1617,41 @@ rait_device_write_block (Device * dself, guint size, gpointer data,
 static void finish_file_do_op(gpointer data,
                               gpointer user_data G_GNUC_UNUSED) {
     GenericOp * op = data;
-    op->result = GINT_TO_POINTER(device_finish_file(op->child));
+    if (op->child) {
+        op->result = GINT_TO_POINTER(device_finish_file(op->child));
+    } else {
+        op->result = FALSE;
+    }
 }
 
 static gboolean 
-rait_device_finish_file (Device * self) {
+rait_device_finish_file (Device * dself) {
     GPtrArray * ops;
     gboolean success;
+    RaitDevice * self = RAIT_DEVICE(dself);
 
-    ops = make_generic_boolean_op_array(RAIT_DEVICE(self));
+    g_assert(self != NULL);
+    if (rait_device_in_error(dself)) return FALSE;
+    if (self->private->status != RAIT_STATUS_COMPLETE) return FALSE;
+
+    ops = make_generic_boolean_op_array(self);
     
-    do_rait_child_ops(finish_file_do_op, ops, NULL);
+    do_rait_child_ops(self, finish_file_do_op, ops);
 
     success = g_ptr_array_and(ops, extract_boolean_generic_op);
 
     g_ptr_array_free_full(ops);
 
     if (!success) {
+       /* TODO: be more specific here */
+       device_set_error(dself,
+                         g_strdup("One or more devices failed to finish_file"),
+           DEVICE_STATUS_DEVICE_ERROR);
         return FALSE;
-    } else if (parent_class->finish_file) {
-        return parent_class->finish_file(self);
-    } else {
-        return TRUE;
     }
+
+    dself->in_file = FALSE;
+    return TRUE;
 }
 
 typedef struct {
@@ -1151,21 +1675,27 @@ rait_device_seek_file (Device * dself, guint file) {
     dumpfile_t * rval;
     RaitDevice * self = RAIT_DEVICE(dself);
     guint actual_file = 0;
-    g_return_val_if_fail(self != NULL, FALSE);
+    gboolean in_file = FALSE;
+
+    if (rait_device_in_error(self)) return NULL;
+
+    dself->in_file = FALSE;
+    dself->is_eof = FALSE;
+    dself->block = 0;
 
     ops = g_ptr_array_sized_new(self->private->children->len);
     for (i = 0; i < self->private->children->len; i ++) {
         SeekFileOp * op;
         if ((int)i == self->private->failed)
             continue; /* This device is broken. */
-        op = malloc(sizeof(*op));
+        op = g_new(SeekFileOp, 1);
         op->base.child = g_ptr_array_index(self->private->children, i);
         op->base.child_index = i;
         op->requested_file = file;
         g_ptr_array_add(ops, op);
     }
     
-    do_rait_child_ops(seek_file_do_op, ops, NULL);
+    do_rait_child_ops(self, seek_file_do_op, ops);
 
     /* This checks for NULL values, but we still have to check for
        consistant headers. */
@@ -1173,23 +1703,29 @@ rait_device_seek_file (Device * dself, guint file) {
                                        ops, extract_boolean_pointer_op);
 
     rval = NULL;
-    for (i = 0; i < self->private->children->len; i ++) {
+    for (i = 0; i < ops->len; i ++) {
         SeekFileOp * this_op;
         dumpfile_t * this_result;
         guint this_actual_file;
-        if ((int)i == self->private->failed)
-            continue;
+       gboolean this_in_file;
         
         this_op = (SeekFileOp*)g_ptr_array_index(ops, i);
+
+        if ((signed)this_op->base.child_index == self->private->failed)
+            continue;
+
         this_result = this_op->base.result;
         this_actual_file = this_op->actual_file;
+       this_in_file = this_op->base.child->in_file;
 
         if (rval == NULL) {
             rval = this_result;
             actual_file = this_actual_file;
+           in_file = this_in_file;
         } else {
             if (headers_are_equal(rval, this_result) &&
-                actual_file == this_actual_file) {
+                actual_file == this_actual_file &&
+               in_file == this_in_file) {
                 /* Do nothing. */
             } else {
                 success = FALSE;
@@ -1202,11 +1738,17 @@ rait_device_seek_file (Device * dself, guint file) {
 
     if (!success) {
         amfree(rval);
+       /* TODO: be more specific here */
+       device_set_error(dself,
+                         g_strdup("One or more devices failed to seek_file"),
+           DEVICE_STATUS_DEVICE_ERROR);
         return NULL;
-    } else if (parent_class->seek_file) {
-        parent_class->seek_file(dself, file);
     }
 
+    /* update our state */
+    dself->in_file = in_file;
+    dself->file = actual_file;
+
     return rval;
 }
 
@@ -1229,21 +1771,22 @@ rait_device_seek_block (Device * dself, guint64 block) {
     gboolean success;
 
     RaitDevice * self = RAIT_DEVICE(dself);
-    g_return_val_if_fail(self != NULL, FALSE);
+
+    if (rait_device_in_error(self)) return FALSE;
 
     ops = g_ptr_array_sized_new(self->private->children->len);
     for (i = 0; i < self->private->children->len; i ++) {
         SeekBlockOp * op;
         if ((int)i == self->private->failed)
             continue; /* This device is broken. */
-        op = malloc(sizeof(*op));
+        op = g_new(SeekBlockOp, 1);
         op->base.child = g_ptr_array_index(self->private->children, i);
         op->base.child_index = i;
         op->block = block;
         g_ptr_array_add(ops, op);
     }
     
-    do_rait_child_ops(seek_block_do_op, ops, NULL);
+    do_rait_child_ops(self, seek_block_do_op, ops);
 
     success = g_ptr_array_union_robust(RAIT_DEVICE(self),
                                        ops, extract_boolean_generic_op);
@@ -1251,12 +1794,15 @@ rait_device_seek_block (Device * dself, guint64 block) {
     g_ptr_array_free_full(ops);
 
     if (!success) {
+       /* TODO: be more specific here */
+       device_set_error(dself,
+           stralloc("One or more devices failed to seek_block"),
+           DEVICE_STATUS_DEVICE_ERROR);
         return FALSE;
-    } else if (parent_class->seek_block) {
-        return parent_class->seek_block(dself, block);
-    } else {
-        return success;
     }
+
+    dself->block = block;
+    return TRUE;
 }
 
 typedef struct {
@@ -1273,6 +1819,10 @@ static void read_block_do_op(gpointer data,
     op->base.result =
         GINT_TO_POINTER(device_read_block(op->base.child, op->buffer,
                                           &(op->read_size)));
+    if (op->read_size > op->desired_read_size) {
+       g_warning("child device %s tried to return an oversized block, which the RAIT device does not support",
+                 op->base.child->device_name);
+    }
 }
 
 /* A BooleanExtractor. This one checks for a successful read. */
@@ -1302,14 +1852,18 @@ static int g_ptr_array_count(GPtrArray * array, BooleanExtractor filter) {
 static gboolean raid_block_reconstruction(RaitDevice * self, GPtrArray * ops,
                                       gpointer buf, size_t bufsize) {
     guint num_children, data_children;
-    int blocksize, child_blocksize;
+    gsize blocksize;
+    gsize child_blocksize;
     guint i;
     int parity_child;
     gpointer parity_block = NULL;
     gboolean success;
 
     success = TRUE;
-    find_simple_params(self, &num_children, &data_children, &blocksize);
+
+    blocksize = DEVICE(self)->block_size;
+    find_simple_params(self, &num_children, &data_children);
+
     if (num_children > 1)
         parity_child = num_children - 1;
     else
@@ -1329,6 +1883,7 @@ static gboolean raid_block_reconstruction(RaitDevice * self, GPtrArray * ops,
                    child_blocksize);
         }
     }
+    g_assert(parity_block != NULL); /* should have found parity_child */
 
     if (self->private->status == RAIT_STATUS_COMPLETE) {
         if (num_children >= 2) {
@@ -1337,7 +1892,7 @@ static gboolean raid_block_reconstruction(RaitDevice * self, GPtrArray * ops,
             gpointer constructed_parity;
             GPtrArray * data_extents;
             
-            constructed_parity = malloc(child_blocksize);
+            constructed_parity = g_malloc(child_blocksize);
             data_extents = g_ptr_array_sized_new(data_children);
             for (i = 0; i < data_children; i ++) {
                 ReadBlockOp * op = g_ptr_array_index(ops, i);
@@ -1351,8 +1906,10 @@ static gboolean raid_block_reconstruction(RaitDevice * self, GPtrArray * ops,
             
             if (0 != memcmp(parity_block, constructed_parity,
                             child_blocksize)) {
-                g_fprintf(stderr, "RAIT is inconsistant: "
-                        "Parity block did not match data blocks.\n");
+                device_set_error(DEVICE(self),
+                   stralloc(_("RAIT is inconsistent: Parity block did not match data blocks.")),
+                   DEVICE_STATUS_DEVICE_ERROR);
+               /* TODO: can't we just isolate the device in this case? */
                 success = FALSE;
             }
             g_ptr_array_free(data_extents, TRUE);
@@ -1388,6 +1945,7 @@ static gboolean raid_block_reconstruction(RaitDevice * self, GPtrArray * ops,
             g_assert_not_reached();
         }
     } else {
+       /* device is already in FAILED state -- we shouldn't even be here */
         success = FALSE;
     }
     return success;
@@ -1399,24 +1957,23 @@ rait_device_read_block (Device * dself, gpointer buf, int * size) {
     guint i;
     gboolean success;
     guint num_children, data_children;
-    int blocksize;
+    gsize blocksize = dself->block_size;
     gsize child_blocksize;
 
     RaitDevice * self = RAIT_DEVICE(dself);
-    g_return_val_if_fail(self != NULL, -1);
 
-    find_simple_params(self, &num_children, &data_children,
-                       &blocksize);
+    if (rait_device_in_error(self)) return -1;
+
+    find_simple_params(self, &num_children, &data_children);
 
     /* tell caller they haven't given us a big enough buffer */
-    if (blocksize < *size) {
-       *size = blocksize;
+    if (blocksize > (gsize)*size) {
+       g_assert(blocksize < INT_MAX);
+       *size = (int)blocksize;
        return 0;
     }
 
-    g_return_val_if_fail(*size >= (int)device_write_min_size(dself), -1);
-
-    g_assert(blocksize % data_children == 0); /* If not we are screwed */
+    g_assert(blocksize % data_children == 0); /* see find_block_size */
     child_blocksize = blocksize / data_children;
 
     ops = g_ptr_array_sized_new(num_children);
@@ -1424,22 +1981,27 @@ rait_device_read_block (Device * dself, gpointer buf, int * size) {
         ReadBlockOp * op;
         if ((int)i == self->private->failed)
             continue; /* This device is broken. */
-        op = malloc(sizeof(*op));
+        op = g_new(ReadBlockOp, 1);
         op->base.child = g_ptr_array_index(self->private->children, i);
         op->base.child_index = i;
-        op->buffer = malloc(child_blocksize);
-        op->desired_read_size = op->read_size = blocksize / data_children;
+        op->buffer = g_malloc(child_blocksize);
+        op->desired_read_size = op->read_size = child_blocksize;
         g_ptr_array_add(ops, op);
     }
     
-    do_rait_child_ops(read_block_do_op, ops, NULL);
+    do_rait_child_ops(self, read_block_do_op, ops);
 
     if (g_ptr_array_count(ops, extract_boolean_read_block_op_data)) {
         if (!g_ptr_array_union_robust(RAIT_DEVICE(self),
                                      ops,
                                      extract_boolean_read_block_op_data)) {
+           /* TODO: be more specific */
+           device_set_error(dself,
+               stralloc(_("Error occurred combining blocks from child devices")),
+               DEVICE_STATUS_DEVICE_ERROR);
            success = FALSE;
        } else {
+           /* raid_block_reconstruction sets the error status if necessary */
            success = raid_block_reconstruction(RAIT_DEVICE(self),
                                                 ops, buf, (size_t)*size);
        }
@@ -1448,11 +2010,15 @@ rait_device_read_block (Device * dself, gpointer buf, int * size) {
         if (g_ptr_array_union_robust(RAIT_DEVICE(self),
                                      ops,
                                      extract_boolean_read_block_op_eof)) {
-            /* We hit EOF. */
+           device_set_error(dself,
+               stralloc(_("EOF")),
+               DEVICE_STATUS_SUCCESS);
             dself->is_eof = TRUE;
            dself->in_file = FALSE;
         } else {
-           g_fprintf(stderr, _("All child devices failed to read, but not all are at eof"));
+           device_set_error(dself,
+               stralloc(_("All child devices failed to read, but not all are at eof")),
+               DEVICE_STATUS_DEVICE_ERROR);
        }
     }
 
@@ -1463,8 +2029,7 @@ rait_device_read_block (Device * dself, gpointer buf, int * size) {
     g_ptr_array_free_full(ops);
 
     if (success) {
-        if (parent_class->read_block)
-            parent_class->read_block(dself, buf, size);
+       dself->block++;
        *size = blocksize;
         return blocksize;
     } else {
@@ -1472,29 +2037,41 @@ rait_device_read_block (Device * dself, gpointer buf, int * size) {
     }
 }
 
+/* property utility functions */
+
 typedef struct {
     GenericOp base;
     DevicePropertyId id;   /* IN */
     GValue value;          /* IN/OUT */
-    gboolean label_changed; /* Did the device label change? OUT; _set only*/
+    PropertySurety surety; /* IN (for set) */
+    PropertySource source; /* IN (for set) */
 } PropertyOp;
 
 /* Creates a GPtrArray of PropertyOf for a get or set operation. */
 static GPtrArray * make_property_op_array(RaitDevice * self,
                                           DevicePropertyId id,
-                                          GValue * value) {
+                                          GValue * value,
+                                         PropertySurety surety,
+                                         PropertySource source) {
     guint i;
     GPtrArray * ops;
     ops = g_ptr_array_sized_new(self->private->children->len);
     for (i = 0; i < self->private->children->len; i ++) {
         PropertyOp * op;
-        op = malloc(sizeof(*op));
+
+        if ((signed)i == self->private->failed) {
+            continue;
+        }
+
+        op = g_new(PropertyOp, 1);
         op->base.child = g_ptr_array_index(self->private->children, i);
         op->id = id;
         bzero(&(op->value), sizeof(op->value));
         if (value != NULL) {
             g_value_unset_copy(value, &(op->value));
         }
+       op->surety = surety;
+       op->source = source;
         g_ptr_array_add(ops, op);
     }
 
@@ -1512,16 +2089,134 @@ static void property_get_do_op(gpointer data,
                                             &(op->value)));
 }
 
-/* Merge ConcurrencyParadigm results. */
-static gboolean property_get_concurrency(GPtrArray * ops, GValue * val) {
-    ConcurrencyParadigm result = CONCURRENCY_PARADIGM_RANDOM_ACCESS;
-    guint i = 0;
-    
+/* A GFunc. */
+static void property_set_do_op(gpointer data,
+                               gpointer user_data G_GNUC_UNUSED) {
+    PropertyOp * op = data;
+
+    op->base.result =
+        GINT_TO_POINTER(device_property_set_ex(op->base.child, op->id,
+                                              &(op->value), op->surety,
+                                              op->source));
+    g_value_unset(&(op->value));
+}
+
+/* PropertyGetFns and PropertySetFns */
+
+static gboolean
+property_get_block_size_fn(Device *dself,
+    DevicePropertyBase *base G_GNUC_UNUSED, GValue *val,
+    PropertySurety *surety, PropertySource *source)
+{
+    RaitDevice *self = RAIT_DEVICE(dself);
+    gsize my_block_size;
+
+    if (dself->block_size_source != PROPERTY_SOURCE_DEFAULT) {
+       my_block_size = dself->block_size;
+
+       if (surety)
+           *surety = dself->block_size_surety;
+    } else {
+       gsize child_block_size;
+       child_block_size = calculate_block_size_from_children(self,
+                                                   &my_block_size);
+       if (child_block_size == 0)
+           return FALSE;
+
+       if (surety)
+           *surety = PROPERTY_SURETY_BAD; /* may still change */
+    }
+
+    if (val) {
+       g_value_unset_init(val, G_TYPE_INT);
+       g_assert(my_block_size < G_MAXINT); /* gsize -> gint */
+       g_value_set_int(val, (gint)my_block_size);
+    }
+
+    if (source)
+       *source = dself->block_size_source;
+
+    return TRUE;
+}
+
+static gboolean
+property_set_block_size_fn(Device *dself,
+    DevicePropertyBase *base G_GNUC_UNUSED, GValue *val,
+    PropertySurety surety, PropertySource source)
+{
+    RaitDevice *self = RAIT_DEVICE(dself);
+    gint my_block_size = g_value_get_int(val);
+    guint data_children;
+
+    find_simple_params(self, NULL, &data_children);
+    if ((my_block_size % data_children) != 0) {
+       device_set_error(dself,
+           vstrallocf(_("Block size must be a multiple of %d"), data_children),
+           DEVICE_STATUS_DEVICE_ERROR);
+       return FALSE;
+    }
+
+    dself->block_size = my_block_size;
+    dself->block_size_source = source;
+    dself->block_size_surety = surety;
+
+    if (!fix_block_size(self))
+       return FALSE;
+
+    return TRUE;
+}
+
+static gboolean
+property_get_canonical_name_fn(Device *dself,
+    DevicePropertyBase *base G_GNUC_UNUSED, GValue *val,
+    PropertySurety *surety, PropertySource *source)
+{
+    RaitDevice *self = RAIT_DEVICE(dself);
+    char *canonical = child_device_names_to_rait_name(self);
+
+    if (val) {
+       g_value_unset_init(val, G_TYPE_STRING);
+       g_value_set_string(val, canonical);
+       g_free(canonical);
+    }
+
+    if (surety)
+       *surety = PROPERTY_SURETY_GOOD;
+
+    if (source)
+       *source = PROPERTY_SOURCE_DETECTED;
+
+    return TRUE;
+}
+
+static gboolean
+property_get_concurrency_fn(Device *dself,
+    DevicePropertyBase *base G_GNUC_UNUSED, GValue *val,
+    PropertySurety *surety, PropertySource *source)
+{
+    RaitDevice *self = RAIT_DEVICE(dself);
+    ConcurrencyParadigm result;
+    guint i;
+    GPtrArray * ops;
+    gboolean success;
+
+    ops = make_property_op_array(self, PROPERTY_CONCURRENCY, NULL, 0, 0);
+    do_rait_child_ops(self, property_get_do_op, ops);
+
+    /* find the most restrictive paradigm acceptable to all
+     * child devices */
+    result = CONCURRENCY_PARADIGM_RANDOM_ACCESS;
+    success = TRUE;
     for (i = 0; i < ops->len; i ++) {
         ConcurrencyParadigm cur;
         PropertyOp * op = g_ptr_array_index(ops, i);
-        g_return_val_if_fail(G_VALUE_TYPE(&(op->value)) ==
-                             CONCURRENCY_PARADIGM_TYPE, FALSE);
+
+        if (!op->base.result
+           || G_VALUE_TYPE(&(op->value)) != CONCURRENCY_PARADIGM_TYPE) {
+           success = FALSE;
+           break;
+       }
+
         cur = g_value_get_enum(&(op->value));
         if (result == CONCURRENCY_PARADIGM_EXCLUSIVE ||
             cur == CONCURRENCY_PARADIGM_EXCLUSIVE) {
@@ -1533,25 +2228,57 @@ static gboolean property_get_concurrency(GPtrArray * ops, GValue * val) {
                    cur == CONCURRENCY_PARADIGM_RANDOM_ACCESS) {
             result = CONCURRENCY_PARADIGM_RANDOM_ACCESS;
         } else {
-            g_return_val_if_fail(FALSE, FALSE);
+            success = FALSE;
+           break;
         }
     }
 
-    g_value_unset_init(val, CONCURRENCY_PARADIGM_TYPE);
-    g_value_set_enum(val, result);
-    return TRUE;
+    g_ptr_array_free_full(ops);
+
+    if (success) {
+       if (val) {
+           g_value_unset_init(val, CONCURRENCY_PARADIGM_TYPE);
+           g_value_set_enum(val, result);
+       }
+
+       if (surety)
+           *surety = PROPERTY_SURETY_GOOD;
+
+       if (source)
+           *source = PROPERTY_SOURCE_DETECTED;
+    }
+
+    return success;
 }
 
-/* Merge StreamingRequirement results. */
-static gboolean property_get_streaming(GPtrArray * ops, GValue * val) {
-    StreamingRequirement result = STREAMING_REQUIREMENT_NONE;
-    guint i = 0;
-    
+static gboolean
+property_get_streaming_fn(Device *dself,
+    DevicePropertyBase *base G_GNUC_UNUSED, GValue *val,
+    PropertySurety *surety, PropertySource *source)
+{
+    RaitDevice *self = RAIT_DEVICE(dself);
+    StreamingRequirement result;
+    guint i;
+    GPtrArray * ops;
+    gboolean success;
+
+    ops = make_property_op_array(self, PROPERTY_STREAMING, NULL, 0, 0);
+    do_rait_child_ops(self, property_get_do_op, ops);
+
+    /* combine the child streaming requirements, selecting the strongest
+     * requirement of the bunch. */
+    result = STREAMING_REQUIREMENT_NONE;
+    success = TRUE;
     for (i = 0; i < ops->len; i ++) {
         StreamingRequirement cur;
         PropertyOp * op = g_ptr_array_index(ops, i);
-        g_return_val_if_fail(G_VALUE_TYPE(&(op->value)) ==
-                             STREAMING_REQUIREMENT_TYPE, FALSE);
+
+        if (!op->base.result
+           || G_VALUE_TYPE(&(op->value)) != STREAMING_REQUIREMENT_TYPE) {
+           success = FALSE;
+           break;
+       }
+
         cur = g_value_get_enum(&(op->value));
         if (result == STREAMING_REQUIREMENT_REQUIRED ||
             cur == STREAMING_REQUIREMENT_REQUIRED) {
@@ -1563,68 +2290,182 @@ static gboolean property_get_streaming(GPtrArray * ops, GValue * val) {
                    cur == STREAMING_REQUIREMENT_NONE) {
             result = STREAMING_REQUIREMENT_NONE;
         } else {
-            g_return_val_if_fail(FALSE, FALSE);
+            success = FALSE;
+           break;
         }
     }
 
-    g_value_unset_init(val, STREAMING_REQUIREMENT_TYPE);
-    g_value_set_enum(val, result);
-    return TRUE;
+    g_ptr_array_free_full(ops);
+
+    if (success) {
+       if (val) {
+           g_value_unset_init(val, STREAMING_REQUIREMENT_TYPE);
+           g_value_set_enum(val, result);
+       }
+
+       if (surety)
+           *surety = PROPERTY_SURETY_GOOD;
+
+       if (source)
+           *source = PROPERTY_SOURCE_DETECTED;
+    }
+
+    return success;
+}
+
+static gboolean
+property_get_boolean_and_fn(Device *dself,
+    DevicePropertyBase *base, GValue *val,
+    PropertySurety *surety, PropertySource *source)
+{
+    RaitDevice *self = RAIT_DEVICE(dself);
+    gboolean result;
+    guint i;
+    GPtrArray * ops;
+    gboolean success;
+
+    ops = make_property_op_array(self, base->ID, NULL, 0, 0);
+    do_rait_child_ops(self, property_get_do_op, ops);
+
+    /* combine the child values, applying a simple AND */
+    result = TRUE;
+    success = TRUE;
+    for (i = 0; i < ops->len; i ++) {
+        PropertyOp * op = g_ptr_array_index(ops, i);
+
+        if (!op->base.result || !G_VALUE_HOLDS_BOOLEAN(&(op->value))) {
+           success = FALSE;
+           break;
+       }
+
+       if (!g_value_get_boolean(&(op->value))) {
+           result = FALSE;
+           break;
+       }
+    }
+
+    g_ptr_array_free_full(ops);
+
+    if (success) {
+       if (val) {
+           g_value_unset_init(val, G_TYPE_BOOLEAN);
+           g_value_set_boolean(val, result);
+       }
+
+       if (surety)
+           *surety = PROPERTY_SURETY_GOOD;
+
+       if (source)
+           *source = PROPERTY_SOURCE_DETECTED;
+    }
+
+    return success;
 }
-    
-/* Merge MediaAccessMode results. */
-static gboolean property_get_medium_type(GPtrArray * ops, GValue * val) {
-    MediaAccessMode result = 0;
-    guint i = 0;
 
+static gboolean
+property_get_medium_access_type_fn(Device *dself,
+    DevicePropertyBase *base G_GNUC_UNUSED, GValue *val,
+    PropertySurety *surety, PropertySource *source)
+{
+    RaitDevice *self = RAIT_DEVICE(dself);
+    MediaAccessMode result;
+    guint i;
+    GPtrArray * ops;
+    gboolean success;
+
+    ops = make_property_op_array(self, PROPERTY_MEDIUM_ACCESS_TYPE, NULL, 0, 0);
+    do_rait_child_ops(self, property_get_do_op, ops);
+
+    /* combine the modes as best we can */
+    result = 0;
+    success = TRUE;
     for (i = 0; i < ops->len; i ++) {
         MediaAccessMode cur;
         PropertyOp * op = g_ptr_array_index(ops, i);
-        g_return_val_if_fail(G_VALUE_TYPE(&(op->value)) ==
-                             MEDIA_ACCESS_MODE_TYPE, FALSE);
+
+        if (!op->base.result || G_VALUE_TYPE(&(op->value)) != MEDIA_ACCESS_MODE_TYPE) {
+           success = FALSE;
+           break;
+       }
+
         cur = g_value_get_enum(&(op->value));
-        
-        if (i == 0) {
-            result = cur;
-        } else if ((result == MEDIA_ACCESS_MODE_READ_ONLY &&
-                    cur == MEDIA_ACCESS_MODE_WRITE_ONLY) ||
-                   (result == MEDIA_ACCESS_MODE_WRITE_ONLY &&
-                    cur == MEDIA_ACCESS_MODE_READ_ONLY)) {
-            /* Invalid combination; one device can only read, other
-               can only write. */
-            return FALSE;
-        } else if (result == MEDIA_ACCESS_MODE_READ_ONLY ||
-                   cur == MEDIA_ACCESS_MODE_READ_ONLY) {
-            result = MEDIA_ACCESS_MODE_READ_ONLY;
-        } else if (result == MEDIA_ACCESS_MODE_WRITE_ONLY ||
-                   cur == MEDIA_ACCESS_MODE_WRITE_ONLY) {
-            result = MEDIA_ACCESS_MODE_WRITE_ONLY;
-        } else if (result == MEDIA_ACCESS_MODE_WORM ||
-                   cur == MEDIA_ACCESS_MODE_WORM) {
-            result = MEDIA_ACCESS_MODE_WORM;
-        } else if (result == MEDIA_ACCESS_MODE_READ_WRITE &&
-                   cur == MEDIA_ACCESS_MODE_READ_WRITE) {
-            result = MEDIA_ACCESS_MODE_READ_WRITE;
-        } else {
-            g_return_val_if_fail(FALSE, FALSE);
-        }
+
+       if (i == 0) {
+           result = cur;
+       } else if ((result == MEDIA_ACCESS_MODE_READ_ONLY &&
+                   cur == MEDIA_ACCESS_MODE_WRITE_ONLY) ||
+                  (result == MEDIA_ACCESS_MODE_WRITE_ONLY &&
+                   cur == MEDIA_ACCESS_MODE_READ_ONLY)) {
+           /* Invalid combination; one device can only read, other
+              can only write. */
+           success = FALSE;
+           break;
+       } else if (result == MEDIA_ACCESS_MODE_READ_ONLY ||
+                  cur == MEDIA_ACCESS_MODE_READ_ONLY) {
+           result = MEDIA_ACCESS_MODE_READ_ONLY;
+       } else if (result == MEDIA_ACCESS_MODE_WRITE_ONLY ||
+                  cur == MEDIA_ACCESS_MODE_WRITE_ONLY) {
+           result = MEDIA_ACCESS_MODE_WRITE_ONLY;
+       } else if (result == MEDIA_ACCESS_MODE_WORM ||
+                  cur == MEDIA_ACCESS_MODE_WORM) {
+           result = MEDIA_ACCESS_MODE_WORM;
+       } else if (result == MEDIA_ACCESS_MODE_READ_WRITE &&
+                  cur == MEDIA_ACCESS_MODE_READ_WRITE) {
+           result = MEDIA_ACCESS_MODE_READ_WRITE;
+       } else {
+           success = FALSE;
+           break;
+       }
     }
-    
-    g_value_unset_init(val, MEDIA_ACCESS_MODE_TYPE);
-    g_value_set_enum(val, result);
-    return TRUE;
+
+    g_ptr_array_free_full(ops);
+
+    if (success) {
+       if (val) {
+           g_value_unset_init(val, MEDIA_ACCESS_MODE_TYPE);
+           g_value_set_enum(val, result);
+       }
+
+       if (surety)
+           *surety = PROPERTY_SURETY_GOOD;
+
+       if (source)
+           *source = PROPERTY_SOURCE_DETECTED;
+    }
+
+    return success;
 }
-    
-/* Merge QualifiedSize results. */
-static gboolean property_get_free_space(GPtrArray * ops, GValue * val) {
+
+static gboolean
+property_get_free_space_fn(Device *dself,
+    DevicePropertyBase *base G_GNUC_UNUSED, GValue *val,
+    PropertySurety *surety, PropertySource *source)
+{
+    RaitDevice *self = RAIT_DEVICE(dself);
     QualifiedSize result;
-    guint i = 0;
+    guint i;
+    GPtrArray * ops;
+    guint data_children;
+
+    ops = make_property_op_array(self, PROPERTY_MEDIUM_ACCESS_TYPE, NULL, 0, 0);
+    do_rait_child_ops(self, property_get_do_op, ops);
 
+    /* Find the minimal available space of any child, with some funny business
+     * to deal with varying degrees of accuracy. */
+    result.accuracy = SIZE_ACCURACY_UNKNOWN;
+    result.bytes = 0;
     for (i = 0; i < ops->len; i ++) {
         QualifiedSize cur;
         PropertyOp * op = g_ptr_array_index(ops, i);
-        g_return_val_if_fail(G_VALUE_TYPE(&(op->value)) ==
-                             QUALIFIED_SIZE_TYPE, FALSE);
+
+        if (!op->base.result || G_VALUE_TYPE(&(op->value)) != QUALIFIED_SIZE_TYPE) {
+           /* maybe this child can't tell us .. so this is just an estimate */
+           if (result.accuracy == SIZE_ACCURACY_REAL)
+               result.accuracy = SIZE_ACCURACY_ESTIMATE;
+
+           continue;
+       }
+
         cur = *(QualifiedSize*)(g_value_get_boxed(&(op->value)));
 
         if (result.accuracy != cur.accuracy) {
@@ -1642,171 +2483,124 @@ static gboolean property_get_free_space(GPtrArray * ops, GValue * val) {
         }
     }
 
-    g_value_unset_init(val, QUALIFIED_SIZE_TYPE);
-    g_value_set_boxed(val, &result);
-    return TRUE;
-}
-    
-/* Merge boolean results by ANDing them together. */
-static gboolean property_get_boolean_and(GPtrArray * ops, GValue * val) {
-    gboolean result = FALSE;
-    guint i = 0;
+    g_ptr_array_free_full(ops);
 
-    for (i = 0; i < ops->len; i ++) {
-        gboolean cur;
-        PropertyOp * op = g_ptr_array_index(ops, i);
-        g_return_val_if_fail(G_VALUE_HOLDS_BOOLEAN(&(op->value)), FALSE);
-        cur = g_value_get_boolean(&(op->value));
+    /* result contains the minimum size available on any child.  We
+     * can use that space on each of our data children, so the total
+     * is larger */
+    find_simple_params(self, NULL, &data_children);
+    result.bytes *= data_children;
 
-        result = result && cur;
+    if (val) {
+       g_value_unset_init(val, QUALIFIED_SIZE_TYPE);
+       g_value_set_boxed(val, &result);
     }
 
-    g_value_unset_init(val, G_TYPE_BOOLEAN);
-    g_value_set_boolean(val, result);
+    if (surety)
+       *surety = (result.accuracy == SIZE_ACCURACY_UNKNOWN)?
+                   PROPERTY_SURETY_BAD : PROPERTY_SURETY_GOOD;
+
+    if (source)
+       *source = PROPERTY_SOURCE_DETECTED;
+
     return TRUE;
 }
-    
 
-static gboolean 
-rait_device_property_get (Device * dself, DevicePropertyId id, GValue * val) {
-    GPtrArray * ops;
+static gboolean
+property_get_max_volume_usage_fn(Device *dself,
+    DevicePropertyBase *base G_GNUC_UNUSED, GValue *val,
+    PropertySurety *surety, PropertySource *source)
+{
+    RaitDevice *self = RAIT_DEVICE(dself);
+    guint64 result;
     guint i;
-    gboolean success;
-    GValue result;
-    GValue * first_value;
-    RaitDevice * self = RAIT_DEVICE(dself);
-    g_return_val_if_fail(self != NULL, FALSE);
+    GPtrArray * ops;
+    guint data_children;
 
-    /* Some properties are handled completely differently. */
-    if (id == PROPERTY_BLOCK_SIZE) {
-        g_value_unset_init(val, G_TYPE_INT);
-        g_value_set_int(val, self->private->block_size);
-        return TRUE;
-    } else if (id == PROPERTY_MIN_BLOCK_SIZE ||
-        id == PROPERTY_MAX_BLOCK_SIZE) {
-        g_value_unset_init(val, G_TYPE_UINT);
-        g_value_set_uint(val, self->private->block_size);
-        return TRUE;
-    } else if (id == PROPERTY_CANONICAL_NAME) {
-        if (parent_class->property_get != NULL) {
-            return parent_class->property_get(dself, id, val);
-        } else {
-            return FALSE;
-        }
-    }
+    ops = make_property_op_array(self, PROPERTY_MAX_VOLUME_USAGE, NULL, 0, 0);
+    do_rait_child_ops(self, property_get_do_op, ops);
 
-    ops = make_property_op_array(self, id, NULL);
-    
-    do_rait_child_ops(property_get_do_op, ops, NULL);
-
-    if (id == PROPERTY_CONCURRENCY) {
-        success = property_get_concurrency(ops, val);
-    } else if (id == PROPERTY_STREAMING) { 
-        success = property_get_streaming(ops, val);
-    } else if (id == PROPERTY_APPENDABLE ||
-               id == PROPERTY_PARTIAL_DELETION) {
-        success = property_get_boolean_and(ops, val);
-    } else if (id == PROPERTY_MEDIUM_TYPE) {
-        success = property_get_medium_type(ops, val);
-    } else if (id == PROPERTY_FREE_SPACE) {
-        success = property_get_free_space(ops, val);
-    } else {
-        /* Generic handling; if all results are the same, we succeed
-           and return that result. If not, we fail. */
-        success = TRUE;
-        
-        /* Set up comparison value. */
-        bzero(&result, sizeof(result));
-        first_value = &(((PropertyOp*)g_ptr_array_index(ops,0))->value);
-        if (G_IS_VALUE(first_value)) {
-            g_value_unset_copy(first_value, &result);
-        } else {
-            success = FALSE;
-        }
-        
-        for (i = 0; i < ops->len; i ++) {
-            PropertyOp * op = g_ptr_array_index(ops, i);
-            if (!GPOINTER_TO_INT(op->base.result) ||
-                !G_IS_VALUE(first_value) ||
-                !g_value_compare(&result, &(op->value))) {
-                success = FALSE;
-            }
-           /* free the GValue if the child call succeeded */
-           if (GPOINTER_TO_INT(op->base.result))
-               g_value_unset(&(op->value));
-        }
+    /* look for the smallest value that is set */
+    result = 0;
+    for (i = 0; i < ops->len; i ++) {
+        guint64 cur;
+        PropertyOp * op = g_ptr_array_index(ops, i);
 
-        if (success) {
-            memcpy(val, &result, sizeof(result));
-        } else if (G_IS_VALUE(&result)) {
-            g_value_unset(&result);
-        }
+        if (!op->base.result || !G_VALUE_HOLDS_UINT64(&(op->value))) {
+           continue; /* ignore children without this property */
+       }
+
+        cur = g_value_get_uint64(&(op->value));
+
+       result = MIN(cur, result);
     }
 
     g_ptr_array_free_full(ops);
 
-    return success;
-}
+    if (result) {
+       /* result contains the minimum usage on any child.  We can use that space
+        * on each of our data children, so the total is larger */
+       find_simple_params(self, NULL, &data_children);
+       result *= data_children;
 
-/* A GFunc. */
-static void property_set_do_op(gpointer data,
-                               gpointer user_data G_GNUC_UNUSED) {
-    PropertyOp * op = data;
-    gboolean label_set = (op->base.child->volume_label != NULL);
-    op->base.result =
-        GINT_TO_POINTER(device_property_set(op->base.child, op->id,
-                                            &(op->value)));
-    op->label_changed = (label_set != (op->base.child->volume_label != NULL));
-}
+       if (val) {
+           g_value_unset_init(val, G_TYPE_UINT64);
+           g_value_set_uint64(val, result);
+       }
 
-/* A BooleanExtractor */
-static gboolean extract_label_changed_property_op(gpointer data) {
-    PropertyOp * op = data;
-    return op->label_changed;
-}
+       if (surety)
+           *surety = PROPERTY_SURETY_GOOD;
 
-/* A GFunc. */
-static void clear_volume_details_do_op(gpointer data,
-                                       gpointer user_data G_GNUC_UNUSED) {
-    GenericOp * op = data;
-    device_clear_volume_details(op->child);
+       if (source)
+           *source = PROPERTY_SOURCE_DETECTED;
+
+       return TRUE;
+    } else {
+       /* no result from any children, so we effectively don't have this property */
+       return FALSE;
+    }
 }
 
-static gboolean 
-rait_device_property_set (Device * d_self, DevicePropertyId id, GValue * val) {
-    RaitDevice * self;
-    GPtrArray * ops;
+static gboolean
+property_set_max_volume_usage_fn(Device *dself,
+    DevicePropertyBase *base G_GNUC_UNUSED, GValue *val,
+    PropertySurety surety, PropertySource source)
+{
+    RaitDevice *self = RAIT_DEVICE(dself);
+    guint64 parent_usage;
+    guint64 child_usage;
+    GValue child_val;
+    guint i;
     gboolean success;
-    gboolean label_changed;
+    GPtrArray * ops;
+    guint data_children;
 
-    self = RAIT_DEVICE(d_self);
-    g_return_val_if_fail(self != NULL, FALSE);
+    parent_usage = g_value_get_uint64(val);
+    find_simple_params(self, NULL, &data_children);
 
-    /* it doesn't make sense to hand these properties down to our child devices,
-     * so we'll just pretend we set them.  This is a 2.6.0 hack -- the device gets
-     * this right in 2.6.1.  */
-    if (id == PROPERTY_BLOCK_SIZE
-       || id == PROPERTY_MIN_BLOCK_SIZE
-       || id == PROPERTY_MAX_BLOCK_SIZE) {
-       return TRUE; /* lies! */
-    }
+    child_usage = parent_usage / data_children;
 
-    ops = make_property_op_array(self, id, val);
-    
-    do_rait_child_ops(property_set_do_op, ops, NULL);
+    bzero(&child_val, sizeof(child_val));
+    g_value_init(&child_val, G_TYPE_UINT64);
+    g_value_set_uint64(&child_val, child_usage);
 
-    success = g_ptr_array_union_robust(self, ops, extract_boolean_generic_op);
-    label_changed = g_ptr_array_or(ops, extract_label_changed_property_op);
-    g_ptr_array_free_full(ops);
+    ops = make_property_op_array(self, PROPERTY_MAX_VOLUME_USAGE,
+                               &child_val, surety, source);
+    do_rait_child_ops(self, property_set_do_op, ops);
+
+    /* if any of the kids succeeded, then we did too */
+    success = FALSE;
+    for (i = 0; i < ops->len; i ++) {
+        PropertyOp * op = g_ptr_array_index(ops, i);
 
-    if (label_changed) {
-        /* At least one device considered this property set a label-changing
-         * operation, so now we clear labels on all devices. */
-        ops = make_generic_boolean_op_array(self);
-        do_rait_child_ops(clear_volume_details_do_op, ops, NULL);
-        g_ptr_array_free_full(ops);
+        if (op->base.result) {
+           success = TRUE;
+           break;
+       }
     }
 
+    g_ptr_array_free_full(ops);
+
     return success;
 }
 
@@ -1830,30 +2624,32 @@ rait_device_recycle_file (Device * dself, guint filenum) {
     gboolean success;
 
     RaitDevice * self = RAIT_DEVICE(dself);
-    g_return_val_if_fail(self != NULL, FALSE);
+
+    if (rait_device_in_error(self)) return FALSE;
 
     ops = g_ptr_array_sized_new(self->private->children->len);
     for (i = 0; i < self->private->children->len; i ++) {
         RecycleFileOp * op;
-        op = malloc(sizeof(*op));
+        op = g_new(RecycleFileOp, 1);
         op->base.child = g_ptr_array_index(self->private->children, i);
         op->filenum = filenum;
         g_ptr_array_add(ops, op);
     }
     
-    do_rait_child_ops(recycle_file_do_op, ops, NULL);
+    do_rait_child_ops(self, recycle_file_do_op, ops);
 
     success = g_ptr_array_and(ops, extract_boolean_generic_op);
 
     g_ptr_array_free_full(ops);
 
     if (!success) {
+       /* TODO: be more specific here */
+       device_set_error(dself,
+           stralloc(_("One or more devices failed to recycle_file")),
+           DEVICE_STATUS_DEVICE_ERROR);
         return FALSE;
-    } else if (parent_class->recycle_file) {
-        return parent_class->recycle_file(dself, filenum);
-    } else {
-        return TRUE;
     }
+    return TRUE;
 }
 
 /* GFunc */
@@ -1867,65 +2663,31 @@ rait_device_finish (Device * self) {
     GPtrArray * ops;
     gboolean success;
 
+    if (rait_device_in_error(self)) return FALSE;
+
     ops = make_generic_boolean_op_array(RAIT_DEVICE(self));
     
-    do_rait_child_ops(finish_do_op, ops, NULL);
+    do_rait_child_ops(RAIT_DEVICE(self), finish_do_op, ops);
 
     success = g_ptr_array_and(ops, extract_boolean_generic_op);
 
     g_ptr_array_free_full(ops);
 
-    if (!success) {
+    self->access_mode = ACCESS_NULL;
+
+    if (!success)
         return FALSE;
-    } else if (parent_class->finish) {
-        return parent_class->finish(self);
-    } else {
-        return TRUE;
-    }
+
+    return TRUE;
 }
 
-Device *
-rait_device_factory (char * type, char * name) {
+static Device *
+rait_device_factory (char * device_name, char * device_type, char * device_node) {
     Device * rval;
-    g_assert(0 == strcmp(type, "rait"));
+    g_assert(0 == strcmp(device_type, "rait"));
     rval = DEVICE(g_object_new(TYPE_RAIT_DEVICE, NULL));
-    if (!device_open_device(rval, name)) {
-        g_object_unref(rval);
-        return NULL;
-    } else {
-        return rval;
-    }
-}
-
-Device * rait_device_new_from_devices(Device ** devices) {
-    RaitDevice * rval;
-    int i;
-    gboolean success = TRUE;
-
-    g_return_val_if_fail(devices != NULL && *devices != NULL, NULL);
-
-    rval = RAIT_DEVICE(g_object_new(TYPE_RAIT_DEVICE, NULL));
-
-    for (i = 0; devices[i] != NULL; i ++) {
-        g_assert(IS_DEVICE(devices[i]));
-        if (devices[i]->access_mode != ACCESS_NULL) {
-            success = FALSE;
-            break;
-        }
-        g_object_ref(devices[i]);
-        g_ptr_array_add(PRIVATE(rval)->children, devices[i]);
-    }
-
-    success = success && find_block_size(rval);
-
-    if (!success) {
-        g_ptr_array_free(PRIVATE(rval)->children, TRUE);
-        return NULL;
-    } else {
-        register_properties(rval);
-
-        return DEVICE(rval);
-    }
+    device_open_device(rval, device_name, device_type, device_node);
+    return rval;
 }
 
 void 
diff --git a/device-src/rait-device.h b/device-src/rait-device.h
deleted file mode 100644 (file)
index b7df6bb..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
- * 
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License version 2.1 as 
- * published by the Free Software Foundation.
- * 
- * This 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 this library; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
- * 
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
- */
-
-/* The RAIT device encapsulates some number of other devices into a single
- * redundant device. */
-
-#ifndef RAIT_DEVICE_H
-#define RAIT_DEVICE_H
-
-#include <glib.h>
-#include <glib-object.h>
-#include "device.h"
-
-/*
- * Type checking and casting macros
- */
-#define TYPE_RAIT_DEVICE       (rait_device_get_type())
-#define RAIT_DEVICE(obj)       G_TYPE_CHECK_INSTANCE_CAST((obj), rait_device_get_type(), RaitDevice)
-#define RAIT_DEVICE_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), rait_device_get_type(), RaitDevice const)
-#define RAIT_DEVICE_CLASS(klass)       G_TYPE_CHECK_CLASS_CAST((klass), rait_device_get_type(), RaitDeviceClass)
-#define IS_RAIT_DEVICE(obj)    G_TYPE_CHECK_INSTANCE_TYPE((obj), rait_device_get_type ())
-
-#define RAIT_DEVICE_GET_CLASS(obj)     G_TYPE_INSTANCE_GET_CLASS((obj), rait_device_get_type(), RaitDeviceClass)
-
-/*
- * Main object structure
- */
-typedef struct RaitDevicePrivate_s RaitDevicePrivate;
-typedef struct RaitDevice_s {
-    Device __parent__;
-
-    RaitDevicePrivate * private;
-} RaitDevice;
-
-/*
- * Class definition
- */
-typedef struct _RaitDeviceClass RaitDeviceClass;
-struct _RaitDeviceClass {
-    DeviceClass __parent__;
-};
-
-
-/*
- * Public methods
- */
-GType  rait_device_get_type    (void);
-Device * rait_device_factory   (char * type,
-                                 char * name);
-/* Pass this factory a NULL-terminated array of Devices, and it will make a
-   RAIT out of them. The returned device refss the passed devices, so unref
-   them yourself. */
-Device * rait_device_new_from_devices(Device ** devices);
-void   rait_device_register    (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
index bebb6efb436a5dd002a343502f850d69dcbb6921..0fe3bb0b8abb13e3b702bfec54c011cd64ceca7b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+ * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
  * 
  * This library is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License version 2.1 as 
@@ -14,8 +14,8 @@
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  * 
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 /* An S3 device uses Amazon's S3 service (http://www.amazon.com/s3) to store 
@@ -35,7 +35,7 @@
 #include "amanda.h"
 #include "conffile.h"
 #include "device.h"
-#include "s3-device.h"
+#include "s3.h"
 #include <curl/curl.h>
 #ifdef HAVE_OPENSSL_HMAC_H
 # include <openssl/hmac.h>
 # endif
 #endif
 
+/*
+ * Type checking and casting macros
+ */
+#define TYPE_S3_DEVICE (s3_device_get_type())
+#define S3_DEVICE(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), s3_device_get_type(), S3Device)
+#define S3_DEVICE_CONST(obj)   G_TYPE_CHECK_INSTANCE_CAST((obj), s3_device_get_type(), S3Device const)
+#define S3_DEVICE_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), s3_device_get_type(), S3DeviceClass)
+#define IS_S3_DEVICE(obj)      G_TYPE_CHECK_INSTANCE_TYPE((obj), s3_device_get_type ())
+
+#define S3_DEVICE_GET_CLASS(obj)       G_TYPE_INSTANCE_GET_CLASS((obj), s3_device_get_type(), S3DeviceClass)
+static GType   s3_device_get_type      (void);
+
+/*
+ * Main object structure
+ */
+typedef struct _S3MetadataFile S3MetadataFile;
+
+typedef struct _S3Device S3Device;
+struct _S3Device {
+    Device __parent__;
+
+    /* The "easy" curl handle we use to access Amazon S3 */
+    S3Handle *s3;
+
+    /* S3 access information */
+    char *bucket;
+    char *prefix;
+
+    /* The S3 access information. */
+    char *secret_key;
+    char *access_key;
+    char *user_token;
+    gboolean is_devpay;
+
+    char *bucket_location;
+
+    /* a cache for unsuccessful reads (where we get the file but the caller
+     * doesn't have space for it or doesn't want it), where we expect the
+     * next call will request the same file.
+     */
+    char *cached_buf;
+    char *cached_key;
+    int cached_size;
+
+    /* Produce verbose output? */
+    gboolean verbose;
+
+    /* Use SSL? */
+    gboolean use_ssl;
+};
+
+/*
+ * Class definition
+ */
+typedef struct _S3DeviceClass S3DeviceClass;
+struct _S3DeviceClass {
+    DeviceClass __parent__;
+};
+
+
 /*
  * Constants and static data
  */
 
+#define S3_DEVICE_NAME "s3"
+#define DEVPAY_DEVICE_NAME "s3zmanda"
+
 /* Maximum key length as specified in the S3 documentation
  * (*excluding* null terminator) */
 #define S3_MAX_KEY_LENGTH 1024
 
+/* Note: for compatability, min can only be decreased and max increased */
 #define S3_DEVICE_MIN_BLOCK_SIZE 1024
-#define S3_DEVICE_MAX_BLOCK_SIZE (10*1024*1024)
+#define S3_DEVICE_MAX_BLOCK_SIZE (100*1024*1024)
+#define S3_DEVICE_DEFAULT_BLOCK_SIZE (10*1024*1024)
 
 /* This goes in lieu of file number for metadata. */
 #define SPECIAL_INFIX "special-"
 /* pointer to the class of our parent */
 static DeviceClass *parent_class = NULL;
 
+/*
+ * device-specific properties
+ */
+
+/* Authentication information for Amazon S3. Both of these are strings. */
+static DevicePropertyBase device_property_s3_access_key;
+static DevicePropertyBase device_property_s3_secret_key;
+#define PROPERTY_S3_SECRET_KEY (device_property_s3_secret_key.ID)
+#define PROPERTY_S3_ACCESS_KEY (device_property_s3_access_key.ID)
+
+/* Same, but for S3 with DevPay. */
+static DevicePropertyBase device_property_s3_user_token;
+#define PROPERTY_S3_USER_TOKEN (device_property_s3_user_token.ID)
+
+/* Location constraint for new buckets created on Amazon S3. */
+static DevicePropertyBase device_property_s3_bucket_location;
+#define PROPERTY_S3_BUCKET_LOCATION (device_property_s3_bucket_location.ID)
+
+/* Whether to use SSL with Amazon S3. */
+static DevicePropertyBase device_property_s3_ssl;
+#define PROPERTY_S3_SSL (device_property_s3_ssl.ID)
+
+
 /*
  * prototypes
  */
 
+void s3_device_register(void);
+
 /* 
  * utility functions */
 
@@ -133,17 +223,15 @@ static gboolean
 delete_file(S3Device *self, 
             int file);
 
-/* Set up self->s3 as best as possible.  Unless SILENT is TRUE,
- * any problems will generate warnings (with g_warning).  Regardless,
- * the return value is TRUE iff self->s3 is useable.
+/* Set up self->s3 as best as possible.
+ *
+ * The return value is TRUE iff self->s3 is useable.
  *
  * @param self: the S3Device object
- * @param silent: silence warnings
  * @returns: TRUE if the handle is set up
  */
 static gboolean 
-setup_handle(S3Device * self, 
-            gboolean ignore_problems);
+setup_handle(S3Device * self);
 
 /* 
  * class mechanics */
@@ -158,17 +246,43 @@ static void
 s3_device_finalize(GObject * o);
 
 static Device*
-s3_device_factory(char * device_type,
-                  char * device_name);
+s3_device_factory(char * device_name, char * device_type, char * device_node);
+
+/*
+ * Property{Get,Set}Fns */
+
+static gboolean s3_device_set_access_key_fn(Device *self,
+    DevicePropertyBase *base, GValue *val,
+    PropertySurety surety, PropertySource source);
+
+static gboolean s3_device_set_secret_key_fn(Device *self,
+    DevicePropertyBase *base, GValue *val,
+    PropertySurety surety, PropertySource source);
+
+static gboolean s3_device_set_user_token_fn(Device *self,
+    DevicePropertyBase *base, GValue *val,
+    PropertySurety surety, PropertySource source);
+
+static gboolean s3_device_set_bucket_location_fn(Device *self,
+    DevicePropertyBase *base, GValue *val,
+    PropertySurety surety, PropertySource source);
+
+static gboolean s3_device_set_verbose_fn(Device *self,
+    DevicePropertyBase *base, GValue *val,
+    PropertySurety surety, PropertySource source);
+
+static gboolean s3_device_set_ssl_fn(Device *self,
+    DevicePropertyBase *base, GValue *val,
+    PropertySurety surety, PropertySource source);
 
 /* 
  * virtual functions */
 
-static gboolean
-s3_device_open_device(Device *pself, 
-                      char *device_name);
+static void
+s3_device_open_device(Device *pself, char *device_name,
+                 char * device_type, char * device_node);
 
-static ReadLabelStatusFlags s3_device_read_label(Device * self);
+static DeviceStatusFlags s3_device_read_label(Device * self);
 
 static gboolean 
 s3_device_start(Device * self, 
@@ -176,15 +290,17 @@ s3_device_start(Device * self,
                 char * label, 
                 char * timestamp);
 
+static gboolean
+s3_device_finish(Device * self);
+
 static gboolean 
 s3_device_start_file(Device * self,
-                     const dumpfile_t * jobInfo);
+                     dumpfile_t * jobInfo);
 
 static gboolean 
 s3_device_write_block(Device * self, 
                       guint size, 
-                      gpointer data, 
-                      gboolean last);
+                      gpointer data);
 
 static gboolean 
 s3_device_finish_file(Device * self);
@@ -206,15 +322,10 @@ static gboolean
 s3_device_recycle_file(Device *pself, 
                        guint file);
 
-static gboolean s3_device_property_set(Device * p_self, DevicePropertyId id,
-                                       GValue * val);
-static gboolean s3_device_property_get(Device * p_self, DevicePropertyId id,
-                                       GValue * val);
 /*
  * Private functions
  */
 
-/* {{{ file_and_block_to_key */
 static char *
 file_and_block_to_key(S3Device *self, 
                       int file, 
@@ -225,9 +336,7 @@ file_and_block_to_key(S3Device *self,
     g_assert(strlen(s3_key) <= S3_MAX_KEY_LENGTH);
     return s3_key;
 }
-/* }}} */
 
-/* {{{ special_file_to_key */
 static char *
 special_file_to_key(S3Device *self, 
                     char *special_name, 
@@ -238,46 +347,46 @@ special_file_to_key(S3Device *self,
     else
         return g_strdup_printf("%sf%08x-%s", self->prefix, file, special_name);
 }
-/* }}} */
 
-/* {{{ write_amanda_header */
 static gboolean
 write_amanda_header(S3Device *self, 
                     char *label, 
                     char * timestamp)
 {
-    char * amanda_header = NULL;
+    CurlBuffer amanda_header = {NULL, 0, 0, 0};
     char * key = NULL;
-    int header_size;
     gboolean header_fits, result;
     dumpfile_t * dumpinfo = NULL;
+    Device *d_self = DEVICE(self);
 
     /* build the header */
     dumpinfo = make_tapestart_header(DEVICE(self), label, timestamp);
-    amanda_header = device_build_amanda_header(DEVICE(self), dumpinfo, 
-                                               &header_size, &header_fits);
+    amanda_header.buffer = device_build_amanda_header(DEVICE(self), dumpinfo, 
+        /* casting guint* to int* */
+        (int*) &amanda_header.buffer_len, &header_fits);
     if (!header_fits) {
-        fprintf(stderr,
-                _("Amanda tapestart header won't fit in a single block!\n"));
-       g_free(amanda_header);
+       device_set_error(d_self,
+           stralloc(_("Amanda tapestart header won't fit in a single block!")),
+           DEVICE_STATUS_DEVICE_ERROR);
+       g_free(amanda_header.buffer);
        return FALSE;
     }
 
     /* write out the header and flush the uploads. */
     key = special_file_to_key(self, "tapestart", -1);
-    result = s3_upload(self->s3, self->bucket, key, amanda_header, header_size);
-    g_free(amanda_header);
+    result = s3_upload(self->s3, self->bucket, key, S3_BUFFER_READ_FUNCS,
+                       &amanda_header, NULL, NULL);
+    g_free(amanda_header.buffer);
     g_free(key);
 
     if (!result) {
-        fprintf(stderr, _("While writing amanda header: %s\n"),
-                s3_strerror(self->s3));
+       device_set_error(d_self,
+           vstrallocf(_("While writing amanda header: %s"), s3_strerror(self->s3)),
+           DEVICE_STATUS_DEVICE_ERROR | DEVICE_STATUS_VOLUME_ERROR);
     }
     return result;
 }
-/* }}} */
 
-/* {{{ seek_to_end */
 static gboolean
 seek_to_end(S3Device *self) {
     int last_file;
@@ -292,7 +401,6 @@ seek_to_end(S3Device *self) {
 
     return TRUE;
 }
-/* }}} */
 
 /* Convert an object name into a file number, assuming the given prefix
  * length. Returns -1 if the object name is invalid, or 0 if the object name
@@ -302,7 +410,8 @@ static int key_to_file(guint prefix_len, const char * key) {
     int i;
     
     /* skip the prefix */
-    g_return_val_if_fail(strlen(key) > prefix_len, -1);
+    if (strlen(key) <= prefix_len)
+       return -1;
 
     key += prefix_len;
 
@@ -311,7 +420,8 @@ static int key_to_file(guint prefix_len, const char * key) {
     }
     
     /* check that key starts with 'f' */
-    g_return_val_if_fail(key[0] == 'f', -1);
+    if (key[0] != 'f')
+       return -1;
     key++;
     
     /* check that key is of the form "%08x-" */
@@ -334,7 +444,6 @@ static int key_to_file(guint prefix_len, const char * key) {
     return file;
 }
 
-/* {{{ find_last_file */
 /* Find the number of the last file that contains any data (even just a header). 
  * Returns -1 in event of an error
  */
@@ -344,12 +453,14 @@ find_last_file(S3Device *self) {
     GSList *keys;
     unsigned int prefix_len = strlen(self->prefix);
     int last_file = 0;
+    Device *d_self = DEVICE(self);
 
     /* list all keys matching C{PREFIX*-*}, stripping the C{-*} */
     result = s3_list_keys(self->s3, self->bucket, self->prefix, "-", &keys);
     if (!result) {
-        fprintf(stderr, _("While listing S3 keys: %s\n"),
-                s3_strerror(self->s3));
+       device_set_error(d_self,
+           vstrallocf(_("While listing S3 keys: %s"), s3_strerror(self->s3)),
+           DEVICE_STATUS_DEVICE_ERROR | DEVICE_STATUS_VOLUME_ERROR);
         return -1;
     }
 
@@ -363,9 +474,7 @@ find_last_file(S3Device *self) {
 
     return last_file;
 }
-/* }}} */
 
-/* {{{ find_next_file */
 /* Find the number of the file following the requested one, if any. 
  * Returns 0 if there is no such file or -1 in event of an error
  */
@@ -375,12 +484,14 @@ find_next_file(S3Device *self, int last_file) {
     GSList *keys;
     unsigned int prefix_len = strlen(self->prefix);
     int next_file = 0;
+    Device *d_self = DEVICE(self);
 
     /* list all keys matching C{PREFIX*-*}, stripping the C{-*} */
     result = s3_list_keys(self->s3, self->bucket, self->prefix, "-", &keys);
     if (!result) {
-        fprintf(stderr, _("While listing S3 keys: %s\n"),
-                s3_strerror(self->s3));
+       device_set_error(d_self,
+           vstrallocf(_("While listing S3 keys: %s"), s3_strerror(self->s3)),
+           DEVICE_STATUS_DEVICE_ERROR | DEVICE_STATUS_VOLUME_ERROR);
         return -1;
     }
 
@@ -403,9 +514,7 @@ find_next_file(S3Device *self, int last_file) {
 
     return last_file;
 }
-/* }}} */
 
-/* {{{ delete_file */
 static gboolean
 delete_file(S3Device *self,
             int file)
@@ -413,11 +522,13 @@ delete_file(S3Device *self,
     gboolean result;
     GSList *keys;
     char *my_prefix = g_strdup_printf("%sf%08x-", self->prefix, file);
+    Device *d_self = DEVICE(self);
     
     result = s3_list_keys(self->s3, self->bucket, my_prefix, NULL, &keys);
     if (!result) {
-        fprintf(stderr, _("While listing S3 keys: %s\n"),
-                s3_strerror(self->s3));
+       device_set_error(d_self,
+           vstrallocf(_("While listing S3 keys: %s"), s3_strerror(self->s3)),
+           DEVICE_STATUS_DEVICE_ERROR | DEVICE_STATUS_VOLUME_ERROR);
         return FALSE;
     }
 
@@ -425,8 +536,10 @@ delete_file(S3Device *self,
     for (; keys; keys = g_slist_remove(keys, keys->data)) {
         if (self->verbose) g_debug(_("Deleting %s"), (char*)keys->data);
         if (!s3_delete(self->s3, self->bucket, keys->data)) {
-            fprintf(stderr, _("While deleting key '%s': %s\n"),
-                    (char*)keys->data, s3_strerror(self->s3));
+           device_set_error(d_self,
+               vstrallocf(_("While deleting key '%s': %s"),
+                           (char*)keys->data, s3_strerror(self->s3)),
+               DEVICE_STATUS_DEVICE_ERROR);
             g_slist_free(keys);
             return FALSE;
         }
@@ -434,24 +547,40 @@ delete_file(S3Device *self,
 
     return TRUE;
 }
-/* }}} */
 
 /*
  * Class mechanics
  */
 
-/* {{{ s3_device_register */
 void 
 s3_device_register(void)
 {
-    static const char * device_prefix_list[] = { "s3", NULL };
+    static const char * device_prefix_list[] = { S3_DEVICE_NAME, DEVPAY_DEVICE_NAME, NULL };
     g_assert(s3_init());
+
+    /* set up our properties */
+    device_property_fill_and_register(&device_property_s3_secret_key,
+                                      G_TYPE_STRING, "s3_secret_key",
+       "Secret access key to authenticate with Amazon S3");
+    device_property_fill_and_register(&device_property_s3_access_key,
+                                      G_TYPE_STRING, "s3_access_key",
+       "Access key ID to authenticate with Amazon S3");
+    device_property_fill_and_register(&device_property_s3_user_token,
+                                      G_TYPE_STRING, "s3_user_token",
+       "User token for authentication Amazon devpay requests");
+    device_property_fill_and_register(&device_property_s3_bucket_location,
+                                      G_TYPE_STRING, "s3_bucket_location",
+       "Location constraint for buckets on Amazon S3");
+    device_property_fill_and_register(&device_property_s3_ssl,
+                                      G_TYPE_BOOLEAN, "s3_ssl",
+       "Whether to use SSL with Amazon S3");
+
+
+    /* register the device itself */
     register_device(s3_device_factory, device_prefix_list);
 }
-/* }}} */
 
-/* {{{ s3_device_get_type */
-GType
+static GType
 s3_device_get_type(void)
 {
     static GType type = 0;
@@ -476,86 +605,56 @@ s3_device_get_type(void)
 
     return type;
 }
-/* }}} */
 
-/* {{{ s3_device_init */
 static void 
 s3_device_init(S3Device * self)
 {
-    Device * o;
-    DeviceProperty prop;
+    Device * dself = DEVICE(self);
     GValue response;
 
-    self->initializing = TRUE;
-
-    /* Register property values */
-    o = (Device*)(self);
+    /* Register property values
+     * Note: Some aren't added until s3_device_open_device()
+     */
     bzero(&response, sizeof(response));
 
-    prop.base = &device_property_concurrency;
-    prop.access = PROPERTY_ACCESS_GET_MASK;
     g_value_init(&response, CONCURRENCY_PARADIGM_TYPE);
     g_value_set_enum(&response, CONCURRENCY_PARADIGM_SHARED_READ);
-    device_add_property(o, &prop, &response);
+    device_set_simple_property(dself, PROPERTY_CONCURRENCY,
+           &response, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DETECTED);
     g_value_unset(&response);
-    
-    prop.base = &device_property_streaming;
+
     g_value_init(&response, STREAMING_REQUIREMENT_TYPE);
     g_value_set_enum(&response, STREAMING_REQUIREMENT_NONE);
-    device_add_property(o, &prop, &response);
-    g_value_unset(&response);
-    
-    prop.base = &device_property_block_size;
-    g_value_init(&response, G_TYPE_INT);
-    g_value_set_int(&response, -1); /* indicates a variable block size; see below */
-    device_add_property(o, &prop, &response);
-    g_value_unset(&response);
-    
-    prop.base = &device_property_min_block_size;
-    g_value_init(&response, G_TYPE_UINT);
-    g_value_set_uint(&response, S3_DEVICE_MIN_BLOCK_SIZE);
-    device_add_property(o, &prop, &response);
-
-    prop.base = &device_property_max_block_size;
-    g_value_set_uint(&response, S3_DEVICE_MAX_BLOCK_SIZE);
-    device_add_property(o, &prop, &response);
+    device_set_simple_property(dself, PROPERTY_STREAMING,
+           &response, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DETECTED);
     g_value_unset(&response);
 
-    prop.base = &device_property_appendable;
     g_value_init(&response, G_TYPE_BOOLEAN);
     g_value_set_boolean(&response, TRUE);
-    device_add_property(o, &prop, &response);
+    device_set_simple_property(dself, PROPERTY_APPENDABLE,
+           &response, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DETECTED);
+    g_value_unset(&response);
 
-    prop.base = &device_property_partial_deletion;
+    g_value_init(&response, G_TYPE_BOOLEAN);
     g_value_set_boolean(&response, TRUE);
-    device_add_property(o, &prop, &response);
+    device_set_simple_property(dself, PROPERTY_PARTIAL_DELETION,
+           &response, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DETECTED);
     g_value_unset(&response);
 
-    prop.base = &device_property_canonical_name;
-    g_value_init(&response, G_TYPE_STRING);
-    g_value_set_static_string(&response, "s3:");
-    device_add_property(o, &prop, &response);
+    g_value_init(&response, G_TYPE_BOOLEAN);
+    g_value_set_boolean(&response, FALSE);
+    device_set_simple_property(dself, PROPERTY_COMPRESSION,
+           &response, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DETECTED);
     g_value_unset(&response);
 
-    prop.base = &device_property_medium_access_type;
     g_value_init(&response, MEDIA_ACCESS_MODE_TYPE);
     g_value_set_enum(&response, MEDIA_ACCESS_MODE_READ_WRITE);
-    device_add_property(o, &prop, &response);
+    device_set_simple_property(dself, PROPERTY_MEDIUM_ACCESS_TYPE,
+           &response, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DETECTED);
     g_value_unset(&response);
-    
-    prop.access = PROPERTY_ACCESS_GET_MASK | PROPERTY_ACCESS_SET_BEFORE_START;
-    prop.base = &device_property_s3_secret_key;
-    device_add_property(o, &prop, NULL);
-    prop.base = &device_property_s3_access_key;
-    device_add_property(o, &prop, NULL);
-#ifdef WANT_DEVPAY
-    prop.base = &device_property_s3_user_token;
-    device_add_property(o, &prop, NULL);
-#endif
+
 }
-/* }}} */
 
-/* {{{ s3_device_class_init */
 static void 
 s3_device_class_init(S3DeviceClass * c G_GNUC_UNUSED)
 {
@@ -567,6 +666,7 @@ s3_device_class_init(S3DeviceClass * c G_GNUC_UNUSED)
     device_class->open_device = s3_device_open_device;
     device_class->read_label = s3_device_read_label;
     device_class->start = s3_device_start;
+    device_class->finish = s3_device_finish;
 
     device_class->start_file = s3_device_start_file;
     device_class->write_block = s3_device_write_block;
@@ -577,81 +677,227 @@ s3_device_class_init(S3DeviceClass * c G_GNUC_UNUSED)
     device_class->read_block = s3_device_read_block;
     device_class->recycle_file = s3_device_recycle_file;
 
-    device_class->property_set = s3_device_property_set;
-    device_class->property_get = s3_device_property_get;
-
     g_object_class->finalize = s3_device_finalize;
+
+    device_class_register_property(device_class, PROPERTY_S3_ACCESS_KEY,
+           PROPERTY_ACCESS_GET_MASK | PROPERTY_ACCESS_SET_BEFORE_START,
+           device_simple_property_get_fn,
+           s3_device_set_access_key_fn);
+
+    device_class_register_property(device_class, PROPERTY_S3_SECRET_KEY,
+           PROPERTY_ACCESS_GET_MASK | PROPERTY_ACCESS_SET_BEFORE_START,
+           device_simple_property_get_fn,
+           s3_device_set_secret_key_fn);
+
+    device_class_register_property(device_class, PROPERTY_S3_USER_TOKEN,
+           PROPERTY_ACCESS_GET_MASK | PROPERTY_ACCESS_SET_BEFORE_START,
+           device_simple_property_get_fn,
+           s3_device_set_user_token_fn);
+
+    device_class_register_property(device_class, PROPERTY_S3_BUCKET_LOCATION,
+           PROPERTY_ACCESS_GET_MASK | PROPERTY_ACCESS_SET_BEFORE_START,
+           device_simple_property_get_fn,
+           s3_device_set_bucket_location_fn);
+
+    device_class_register_property(device_class, PROPERTY_VERBOSE,
+           PROPERTY_ACCESS_GET_MASK | PROPERTY_ACCESS_SET_BEFORE_START,
+           device_simple_property_get_fn,
+           s3_device_set_verbose_fn);
+
+    device_class_register_property(device_class, PROPERTY_S3_SSL,
+           PROPERTY_ACCESS_GET_MASK | PROPERTY_ACCESS_SET_BEFORE_START,
+           device_simple_property_get_fn,
+           s3_device_set_ssl_fn);
+
+    device_class_register_property(device_class, PROPERTY_COMPRESSION,
+           PROPERTY_ACCESS_GET_MASK,
+           device_simple_property_get_fn,
+           NULL);
+}
+
+static gboolean
+s3_device_set_access_key_fn(Device *p_self, DevicePropertyBase *base,
+    GValue *val, PropertySurety surety, PropertySource source)
+{
+    S3Device *self = S3_DEVICE(p_self);
+
+    amfree(self->access_key);
+    self->access_key = g_value_dup_string(val);
+    device_clear_volume_details(p_self);
+
+    return device_simple_property_set_fn(p_self, base, val, surety, source);
+}
+
+static gboolean
+s3_device_set_secret_key_fn(Device *p_self, DevicePropertyBase *base,
+    GValue *val, PropertySurety surety, PropertySource source)
+{
+    S3Device *self = S3_DEVICE(p_self);
+
+    amfree(self->secret_key);
+    self->secret_key = g_value_dup_string(val);
+    device_clear_volume_details(p_self);
+
+    return device_simple_property_set_fn(p_self, base, val, surety, source);
+}
+
+static gboolean
+s3_device_set_user_token_fn(Device *p_self, DevicePropertyBase *base,
+    GValue *val, PropertySurety surety, PropertySource source)
+{
+    S3Device *self = S3_DEVICE(p_self);
+
+    if (!self->is_devpay) {
+       device_set_error(p_self, stralloc(_(
+                  "Can't set a user token unless DevPay is in use")),
+           DEVICE_STATUS_DEVICE_ERROR);
+       return FALSE;
+    }
+
+    amfree(self->user_token);
+    self->user_token = g_value_dup_string(val);
+    device_clear_volume_details(p_self);
+
+    return device_simple_property_set_fn(p_self, base, val, surety, source);
+}
+
+static gboolean
+s3_device_set_bucket_location_fn(Device *p_self, DevicePropertyBase *base,
+    GValue *val, PropertySurety surety, PropertySource source)
+{
+    S3Device *self = S3_DEVICE(p_self);
+
+    if (self->use_ssl && !s3_curl_location_compat()) {
+       device_set_error(p_self, stralloc(_(
+               "Location constraint given for Amazon S3 bucket, "
+               "but libcurl is too old support wildcard certificates.")),
+           DEVICE_STATUS_DEVICE_ERROR);
+       return FALSE;
+    }
+
+    if (!s3_bucket_location_compat(self->bucket)) {
+       device_set_error(p_self, g_strdup_printf(_(
+               "Location constraint given for Amazon S3 bucket, "
+               "but the bucket name (%s) is not usable as a subdomain."),
+               self->bucket),
+           DEVICE_STATUS_DEVICE_ERROR);
+       return FALSE;
+    }
+
+    amfree(self->bucket_location);
+    self->bucket_location = g_value_dup_string(val);
+    device_clear_volume_details(p_self);
+
+    return device_simple_property_set_fn(p_self, base, val, surety, source);
+}
+
+static gboolean
+s3_device_set_verbose_fn(Device *p_self, DevicePropertyBase *base,
+    GValue *val, PropertySurety surety, PropertySource source)
+{
+    S3Device *self = S3_DEVICE(p_self);
+
+    self->verbose = g_value_get_boolean(val);
+    /* Our S3 handle may not yet have been instantiated; if so, it will
+     * get the proper verbose setting when it is created */
+    if (self->s3)
+       s3_verbose(self->s3, self->verbose);
+
+    return device_simple_property_set_fn(p_self, base, val, surety, source);
+}
+
+static gboolean
+s3_device_set_ssl_fn(Device *p_self, DevicePropertyBase *base,
+    GValue *val, PropertySurety surety, PropertySource source)
+{
+    S3Device *self = S3_DEVICE(p_self);
+    gboolean new_val;
+
+    new_val = g_value_get_boolean(val);
+    /* Our S3 handle may not yet have been instantiated; if so, it will
+     * get the proper use_ssl setting when it is created */
+    if (self->s3 && !s3_use_ssl(self->s3, new_val)) {
+       device_set_error(p_self, g_strdup_printf(_(
+                "Error setting S3 SSL/TLS use "
+                "(tried to enable SSL/TLS for S3, but curl doesn't support it?)")),
+           DEVICE_STATUS_DEVICE_ERROR);
+        return FALSE;
+    }
+    self->use_ssl = new_val;
+
+    return device_simple_property_set_fn(p_self, base, val, surety, source);
 }
-/* }}} */
 
-/* {{{ s3_device_factory */
 static Device* 
-s3_device_factory(char * device_type,
-                  char * device_name)
+s3_device_factory(char * device_name, char * device_type, char * device_node)
 {
     Device *rval;
     S3Device * s3_rval;
-    g_assert(0 == strcmp(device_type, "s3"));
+    g_assert(0 == strcmp(device_type, S3_DEVICE_NAME) ||
+             0 == strcmp(device_type, DEVPAY_DEVICE_NAME));
     rval = DEVICE(g_object_new(TYPE_S3_DEVICE, NULL));
     s3_rval = (S3Device*)rval;
 
-    if (!device_open_device(rval, device_name)) {
-        g_object_unref(rval);
-        return NULL;
-    } else {
-        s3_rval->initializing = FALSE;
-        return rval;
-    }
-    
+    device_open_device(rval, device_name, device_type, device_node);
+    return rval;
 }
-/* }}} */
 
 /*
  * Virtual function overrides
  */
 
-/* {{{ s3_device_open_device */
-static gboolean 
-s3_device_open_device(Device *pself, 
-                      char *device_name)
+static void
+s3_device_open_device(Device *pself, char *device_name,
+                       char * device_type, char * device_node)
 {
     S3Device *self = S3_DEVICE(pself);
     char * name_colon;
+    GValue tmp_value;
 
-    g_return_val_if_fail(self != NULL, FALSE);
+    pself->min_block_size = S3_DEVICE_MIN_BLOCK_SIZE;
+    pself->max_block_size = S3_DEVICE_MAX_BLOCK_SIZE;
+    pself->block_size = S3_DEVICE_DEFAULT_BLOCK_SIZE;
 
     /* Device name may be bucket/prefix, to support multiple volumes in a
      * single bucket. */
-    name_colon = index(device_name, '/');
+    name_colon = index(device_node, '/');
     if (name_colon == NULL) {
-        self->bucket = g_strdup(device_name);
+        self->bucket = g_strdup(device_node);
         self->prefix = g_strdup("");
     } else {
-        self->bucket = g_strndup(device_name, name_colon - device_name);
+        self->bucket = g_strndup(device_node, name_colon - device_node);
         self->prefix = g_strdup(name_colon + 1);
     }
     
+    self->is_devpay = !strcmp(device_type, DEVPAY_DEVICE_NAME);
+
     if (self->bucket == NULL || self->bucket[0] == '\0') {
-        fprintf(stderr, _("Empty bucket name in device %s.\n"), device_name);
+       device_set_error(pself,
+           vstrallocf(_("Empty bucket name in device %s"), device_name),
+           DEVICE_STATUS_DEVICE_ERROR);
         amfree(self->bucket);
         amfree(self->prefix);
-        return FALSE;
+        return;
     }
 
     g_debug(_("S3 driver using bucket '%s', prefix '%s'"), self->bucket, self->prefix);
 
-    /* default value */
+    /* default values */
     self->verbose = FALSE;
 
+    /* use SSL if available */
+    self->use_ssl = s3_curl_supports_ssl();
+    bzero(&tmp_value, sizeof(GValue));
+    g_value_init(&tmp_value, G_TYPE_BOOLEAN);
+    g_value_set_boolean(&tmp_value, self->use_ssl);
+    device_set_simple_property(pself, device_property_s3_ssl.ID,
+       &tmp_value, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DEFAULT);
+
     if (parent_class->open_device) {
-        parent_class->open_device(pself, device_name);
+        parent_class->open_device(pself, device_name, device_type, device_node);
     }
-
-    return TRUE;
 }
-/* }}} */
 
-/* {{{ s3_device_finalize */
 static void s3_device_finalize(GObject * obj_self) {
     S3Device *self = S3_DEVICE (obj_self);
 
@@ -661,55 +907,68 @@ static void s3_device_finalize(GObject * obj_self) {
     if(self->s3) s3_free(self->s3);
     if(self->bucket) g_free(self->bucket);
     if(self->prefix) g_free(self->prefix);
+    if(self->access_key) g_free(self->access_key);
+    if(self->secret_key) g_free(self->secret_key);
+    if(self->user_token) g_free(self->user_token);
+    if(self->bucket_location) g_free(self->bucket_location);
 }
-/* }}} */
 
-static gboolean setup_handle(S3Device * self, G_GNUC_UNUSED gboolean silent) {
+static gboolean setup_handle(S3Device * self) {
+    Device *d_self = DEVICE(self);
     if (self->s3 == NULL) {
-        if (self->access_key == NULL) {
-           if (!silent) fprintf(stderr, _("No S3 access key specified\n"));
+        if (self->access_key == NULL)
             return FALSE;
-       }
-       if (self->secret_key == NULL) {
-           if (!silent) fprintf(stderr, _("No S3 secret key specified\n"));
+       if (self->secret_key == NULL)
             return FALSE;
-       }
-#ifdef WANT_DEVPAY
-       if (self->user_token == NULL) {
-           if (!silent) fprintf(stderr, _("No S3 user token specified\n"));
+       if (self->is_devpay && self->user_token == NULL)
             return FALSE;
-       }
-#endif
-        self->s3 = s3_open(self->access_key, self->secret_key
-#ifdef WANT_DEVPAY
-                           , self->user_token
-#endif
-                           );
+
+        self->s3 = s3_open(self->access_key, self->secret_key, self->user_token,
+            self->bucket_location);
         if (self->s3 == NULL) {
-            fprintf(stderr, "Internal error creating S3 handle.\n");
+           device_set_error(d_self,
+               stralloc(_("Internal error creating S3 handle")),
+               DEVICE_STATUS_DEVICE_ERROR);
             return FALSE;
         }
     }
 
     s3_verbose(self->s3, self->verbose);
 
+    if (!s3_use_ssl(self->s3, self->use_ssl)) {
+       device_set_error(d_self, g_strdup_printf(_(
+                "Error setting S3 SSL/TLS use "
+                "(tried to enable SSL/TLS for S3, but curl doesn't support it?)")),
+           DEVICE_STATUS_DEVICE_ERROR);
+        return FALSE;
+    }
+
     return TRUE;
 }
 
-/* {{{ s3_device_read_label */
-static ReadLabelStatusFlags
+static DeviceStatusFlags
 s3_device_read_label(Device *pself) {
     S3Device *self = S3_DEVICE(pself);
     char *key;
-    gpointer buf;
-    guint buf_size;
-    dumpfile_t amanda_header;
-    
-    if (!setup_handle(self, self->initializing))
-        return READ_LABEL_STATUS_DEVICE_ERROR;
+    CurlBuffer buf = {NULL, 0, 0, S3_DEVICE_MAX_BLOCK_SIZE};
+    dumpfile_t *amanda_header;
+
+    /* note that this may be called from s3_device_start, when
+     * self->access_mode is not ACCESS_NULL */
+
+    amfree(pself->volume_label);
+    amfree(pself->volume_time);
+    amfree(pself->volume_header);
+
+    if (device_in_error(self)) return pself->status;
+
+    if (!setup_handle(self)) {
+       device_set_error(pself, stralloc(_("Error setting up S3 interface")), DEVICE_STATUS_DEVICE_ERROR);
+       return pself->status;
+    }
 
     key = special_file_to_key(self, "tapestart", -1);
-    if (!s3_read(self->s3, self->bucket, key, &buf, &buf_size, S3_DEVICE_MAX_BLOCK_SIZE)) {
+    if (!s3_read(self->s3, self->bucket, key, S3_BUFFER_WRITE_FUNCS, &buf, NULL, NULL)) {
         guint response_code;
         s3_error_code_t s3_error_code;
         s3_error(self->s3, NULL, &response_code, &s3_error_code, NULL, NULL, NULL);
@@ -718,36 +977,42 @@ s3_device_read_label(Device *pself) {
         if (response_code == 404 && 
              (s3_error_code == S3_ERROR_NoSuchKey || s3_error_code == S3_ERROR_NoSuchBucket)) {
             g_debug(_("Amanda header not found while reading tapestart header (this is expected for empty tapes)"));
-            return READ_LABEL_STATUS_VOLUME_UNLABELED;
+           device_set_error(pself,
+               stralloc(_("Amanda header not found -- unlabeled volume?")),
+                 DEVICE_STATUS_DEVICE_ERROR
+               | DEVICE_STATUS_VOLUME_ERROR
+               | DEVICE_STATUS_VOLUME_UNLABELED);
+            return pself->status;
         }
 
         /* otherwise, log it and return */
-        fprintf(stderr, _("While trying to read tapestart header: %s\n"),
-                s3_strerror(self->s3));
-        return READ_LABEL_STATUS_DEVICE_ERROR;
+       device_set_error(pself,
+           vstrallocf(_("While trying to read tapestart header: %s"), s3_strerror(self->s3)),
+           DEVICE_STATUS_DEVICE_ERROR | DEVICE_STATUS_VOLUME_ERROR);
+        return pself->status;
     }
 
-    g_assert(buf != NULL);
-    fh_init(&amanda_header);
-    parse_file_header(buf, &amanda_header, buf_size);
+    g_assert(buf.buffer != NULL);
+    amanda_header = g_new(dumpfile_t, 1);
+    parse_file_header(buf.buffer, amanda_header, buf.buffer_pos);
+    pself->volume_header = amanda_header;
 
-    g_free(buf);
+    g_free(buf.buffer);
 
-    if (amanda_header.type != F_TAPESTART) {
-        fprintf(stderr, _("Invalid amanda header\n"));
-        return READ_LABEL_STATUS_VOLUME_ERROR;
+    if (amanda_header->type != F_TAPESTART) {
+       device_set_error(pself, stralloc(_("Invalid amanda header")), DEVICE_STATUS_VOLUME_ERROR);
+        return pself->status;
     }
 
-    amfree(pself->volume_label);
-    pself->volume_label = g_strdup(amanda_header.name);
-    amfree(pself->volume_time);
-    pself->volume_time = g_strdup(amanda_header.datestamp);
+    pself->volume_label = g_strdup(amanda_header->name);
+    pself->volume_time = g_strdup(amanda_header->datestamp);
+    /* pself->volume_header is already set */
 
-    return READ_LABEL_STATUS_SUCCESS;
+    device_set_error(pself, NULL, DEVICE_STATUS_SUCCESS);
+
+    return pself->status;
 }
-/* }}} */
 
-/* {{{ s3_device_start */
 static gboolean 
 s3_device_start (Device * pself, DeviceAccessMode mode,
                  char * label, char * timestamp) {
@@ -755,10 +1020,18 @@ s3_device_start (Device * pself, DeviceAccessMode mode,
     int file, last_file;
 
     self = S3_DEVICE(pself);
-    g_return_val_if_fail (self != NULL, FALSE);
 
-    if (!setup_handle(self, FALSE))
-        return FALSE;
+    if (device_in_error(self)) return FALSE;
+
+    if (!setup_handle(self)) {
+       device_set_error(pself,
+           stralloc(_("Error setting up S3 interface")),
+           DEVICE_STATUS_DEVICE_ERROR);
+       return FALSE;
+    }
+
+    pself->access_mode = mode;
+    pself->in_file = FALSE;
 
     /* try creating the bucket, in case it doesn't exist */
     if (mode != ACCESS_READ && !s3_make_bucket(self->s3, self->bucket)) {
@@ -770,23 +1043,20 @@ s3_device_start (Device * pself, DeviceAccessMode mode,
          * return FALSE */
         if (response_code != 409 ||
             s3_error_code != S3_ERROR_BucketAlreadyExists) {
-            fprintf(stderr, _("While creating new S3 bucket: %s\n"),
-                    s3_strerror(self->s3));
+           device_set_error(pself,
+               vstrallocf(_("While creating new S3 bucket: %s"), s3_strerror(self->s3)),
+               DEVICE_STATUS_DEVICE_ERROR);
             return FALSE;
         }
     }
 
-    /* call up to the parent (Device) to set access_mode, volume_label,
-     * and volume_time, either from the arguments (ACCESS_WRITE) or by 
-     * reading from the 0th file (otherwise)
-     */
-    if (parent_class->start) 
-        if (!parent_class->start((Device*)self, mode, label, timestamp))
-            return FALSE;
-
     /* take care of any dirty work for this mode */
     switch (mode) {
         case ACCESS_READ:
+           if (pself->volume_label == NULL && s3_device_read_label(pself) != DEVICE_STATUS_SUCCESS) {
+               /* s3_device_read_label already set our error message */
+               return FALSE;
+           }
             break;
 
         case ACCESS_WRITE:
@@ -794,156 +1064,73 @@ s3_device_start (Device * pself, DeviceAccessMode mode,
             last_file = find_last_file(self);
             if (last_file < 0) return FALSE;
             for (file = 0; file <= last_file; file++) {
-                if (!delete_file(self, file)) return FALSE;
+                if (!delete_file(self, file))
+                   /* delete_file already set our error message */
+                   return FALSE;
             }
 
             /* write a new amanda header */
             if (!write_amanda_header(self, label, timestamp)) {
                 return FALSE;
             }
+
+           pself->volume_label = newstralloc(pself->volume_label, label);
+           pself->volume_time = newstralloc(pself->volume_time, timestamp);
+
+           /* unset the VOLUME_UNLABELED flag, if it was set */
+           device_set_error(pself, NULL, DEVICE_STATUS_SUCCESS);
             break;
 
         case ACCESS_APPEND:
+           if (pself->volume_label == NULL && s3_device_read_label(pself) != DEVICE_STATUS_SUCCESS) {
+               /* s3_device_read_label already set our error message */
+               return FALSE;
+           }
             return seek_to_end(self);
             break;
+
         case ACCESS_NULL:
             g_assert_not_reached();
     }
 
-    g_assert(pself->access_mode == mode);
-
     return TRUE;
 }
-/* }}} */
-
-static gboolean s3_device_property_get(Device * p_self, DevicePropertyId id,
-                                       GValue * val) {
-    S3Device * self;
-    const DevicePropertyBase * base;
-
-    self = S3_DEVICE(p_self);
-    g_return_val_if_fail(self != NULL, FALSE);
-
-    base = device_property_get_by_id(id);
-    g_return_val_if_fail(self != NULL, FALSE);
-    
-    g_value_unset_init(val, base->type);
-    
-    if (id == PROPERTY_S3_SECRET_KEY) {
-        if (self->secret_key != NULL) {
-            g_value_set_string(val, self->secret_key);
-            return TRUE;
-        } else {
-            return FALSE;
-        }
-    } else if (id == PROPERTY_S3_ACCESS_KEY) {
-        if (self->access_key != NULL) {
-            g_value_set_string(val, self->access_key);
-            return TRUE;
-        } else {
-            return FALSE;
-        }
-    }
-#ifdef WANT_DEVPAY
-    else if (id == PROPERTY_S3_USER_TOKEN) {
-        if (self->user_token != NULL) {
-            g_value_set_string(val, self->user_token);
-            return TRUE;
-        } else {
-            return FALSE;
-        }
-    }
-#endif /* WANT_DEVPAY */
-    else if (id == PROPERTY_VERBOSE) {
-        g_value_set_boolean(val, self->verbose);
-        return TRUE;
-    } else {
-        /* chain up */
-        if (parent_class->property_get) {
-            return (parent_class->property_get)(p_self, id, val);
-        } else {
-            return FALSE;
-        }
-    }
-
-    g_assert_not_reached();
-}
-
-static gboolean s3_device_property_set(Device * p_self, DevicePropertyId id,
-                                       GValue * val) {
-    S3Device * self;
-    const DevicePropertyBase * base;
-
-    self = S3_DEVICE(p_self);
-    g_return_val_if_fail(self != NULL, FALSE);
-
-    base = device_property_get_by_id(id);
-    g_return_val_if_fail(self != NULL, FALSE);
 
-    g_return_val_if_fail(G_VALUE_HOLDS(val, base->type), FALSE);
+static gboolean
+s3_device_finish (Device * pself) {
+    if (device_in_error(pself)) return FALSE;
 
-    if (id == PROPERTY_S3_SECRET_KEY) {
-        if (p_self->access_mode != ACCESS_NULL)
-            return FALSE;
-        amfree(self->secret_key);
-        self->secret_key = g_value_dup_string(val);
-        device_clear_volume_details(p_self);
-        return TRUE;
-    } else if (id == PROPERTY_S3_ACCESS_KEY) {
-        if (p_self->access_mode != ACCESS_NULL)
-            return FALSE;
-        amfree(self->access_key);
-        self->access_key = g_value_dup_string(val);
-        device_clear_volume_details(p_self);
-        return TRUE;
-    }
-#ifdef WANT_DEVPAY
-    else if (id == PROPERTY_S3_USER_TOKEN) {
-        if (p_self->access_mode != ACCESS_NULL)
-            return FALSE;
-        amfree(self->user_token);
-        self->user_token = g_value_dup_string(val);
-        device_clear_volume_details(p_self);
-        return TRUE;
-    }
-#endif /* WANT_DEVPAY */
-    else if (id == PROPERTY_VERBOSE) {
-        self->verbose = g_value_get_boolean(val);
-       /* Our S3 handle may not yet have been instantiated; if so, it will
-        * get the proper verbose setting when it is created */
-       if (self->s3)
-           s3_verbose(self->s3, self->verbose);
-       return TRUE;
-    } else {
-        if (parent_class->property_set) {
-            return (parent_class->property_set)(p_self, id, val);
-        } else {
-            return FALSE;
-        }
-    }
+    /* we're not in a file anymore */
+    pself->access_mode = ACCESS_NULL;
 
-    g_assert_not_reached();
+    return TRUE;
 }
 
 /* functions for writing */
 
-/* {{{ s3_device_start_file */
 
 static gboolean
-s3_device_start_file (Device *pself, const dumpfile_t *jobInfo) {
+s3_device_start_file (Device *pself, dumpfile_t *jobInfo) {
     S3Device *self = S3_DEVICE(pself);
-    char *amanda_header;
-    int header_size;
+    CurlBuffer amanda_header = {NULL, 0, 0, 0};
     gboolean header_fits, result;
     char *key;
 
-    g_return_val_if_fail (self != NULL, FALSE);
+    if (device_in_error(self)) return FALSE;
+
+    /* Set the blocksize to zero, since there's no header to skip (it's stored
+     * in a distinct file, rather than block zero) */
+    jobInfo->blocksize = 0;
 
     /* Build the amanda header. */
-    amanda_header = device_build_amanda_header(pself, jobInfo,
-                                               &header_size, &header_fits);
-    g_return_val_if_fail(amanda_header != NULL, FALSE);
-    g_return_val_if_fail(header_fits, FALSE);
+    amanda_header.buffer = device_build_amanda_header(pself, jobInfo,
+        (int *) &amanda_header.buffer_len, &header_fits);
+    if (!header_fits) {
+       device_set_error(pself,
+           stralloc(_("Amanda file header won't fit in a single block!")),
+           DEVICE_STATUS_DEVICE_ERROR);
+       return FALSE;
+    }
 
     /* set the file and block numbers correctly */
     pself->file = (pself->file > 0)? pself->file+1 : 1;
@@ -952,101 +1139,99 @@ s3_device_start_file (Device *pself, const dumpfile_t *jobInfo) {
 
     /* write it out as a special block (not the 0th) */
     key = special_file_to_key(self, "filestart", pself->file);
-    result = s3_upload(self->s3, self->bucket, key, amanda_header, header_size);
-    g_free(amanda_header);
+    result = s3_upload(self->s3, self->bucket, key, S3_BUFFER_READ_FUNCS,
+                       &amanda_header, NULL, NULL);
+    g_free(amanda_header.buffer);
     g_free(key);
     if (!result) {
-        fprintf(stderr, _("While writing filestart header: %s\n"),
-                s3_strerror(self->s3));
+       device_set_error(pself,
+           vstrallocf(_("While writing filestart header: %s"), s3_strerror(self->s3)),
+           DEVICE_STATUS_DEVICE_ERROR | DEVICE_STATUS_VOLUME_ERROR);
         return FALSE;
     }
 
     return TRUE;
 }
-/* }}} */
 
-/* {{{ s3_device_write_block */
 static gboolean
-s3_device_write_block (Device * pself, guint size, gpointer data,
-                         gboolean last_block) {
+s3_device_write_block (Device * pself, guint size, gpointer data) {
     gboolean result;
     char *filename;
-    S3Device * self = S3_DEVICE(pself);;
+    S3Device * self = S3_DEVICE(pself);
+    CurlBuffer to_write = {data, size, 0, 0};
 
     g_assert (self != NULL);
     g_assert (data != NULL);
+    if (device_in_error(self)) return FALSE;
     
     filename = file_and_block_to_key(self, pself->file, pself->block);
 
-    result = s3_upload(self->s3, self->bucket, filename, data, size);
+    result = s3_upload(self->s3, self->bucket, filename, S3_BUFFER_READ_FUNCS,
+        &to_write, NULL, NULL);
     g_free(filename);
     if (!result) {
-        fprintf(stderr, _("While writing data block to S3: %s\n"),
-                s3_strerror(self->s3));
+       device_set_error(pself,
+           vstrallocf(_("While writing data block to S3: %s"), s3_strerror(self->s3)),
+           DEVICE_STATUS_DEVICE_ERROR | DEVICE_STATUS_VOLUME_ERROR);
         return FALSE;
     }
 
     pself->block++;
 
-    /* if this is the last block, finish the file */
-    if (last_block) {
-        return s3_device_finish_file(pself);
-    }
-
     return TRUE;
 }
-/* }}} */
 
-/* {{{ s3_device_finish_file */
 static gboolean
 s3_device_finish_file (Device * pself) {
+    if (device_in_error(pself)) return FALSE;
+
     /* we're not in a file anymore */
     pself->in_file = FALSE;
 
     return TRUE;
 }
-/* }}} */
 
-/* {{{ s3_device_recycle_file */
 static gboolean
 s3_device_recycle_file(Device *pself, guint file) {
     S3Device *self = S3_DEVICE(pself);
+    if (device_in_error(self)) return FALSE;
 
     return delete_file(self, file);
+    /* delete_file already set our error message if necessary */
 }
-/* }}} */
 
 /* functions for reading */
 
-/* {{{ s3_device_seek_file */
 static dumpfile_t*
 s3_device_seek_file(Device *pself, guint file) {
     S3Device *self = S3_DEVICE(pself);
     gboolean result;
     char *key;
-    gpointer buf;
-    guint buf_size;
+    CurlBuffer buf = {NULL, 0, 0, S3_DEVICE_MAX_BLOCK_SIZE};
     dumpfile_t *amanda_header;
+    const char *errmsg = NULL;
+
+    if (device_in_error(self)) return NULL;
 
     pself->file = file;
+    pself->is_eof = FALSE;
+    pself->in_file = FALSE;
     pself->block = 0;
-    pself->in_file = TRUE;
 
     /* read it in */
     key = special_file_to_key(self, "filestart", pself->file);
-    result = s3_read(self->s3, self->bucket, key, &buf, &buf_size, S3_DEVICE_MAX_BLOCK_SIZE);
+    result = s3_read(self->s3, self->bucket, key, S3_BUFFER_WRITE_FUNCS,
+        &buf, NULL, NULL);
     g_free(key);
  
     if (!result) {
         guint response_code;
         s3_error_code_t s3_error_code;
-        s3_error(self->s3, NULL, &response_code, &s3_error_code, NULL, NULL, NULL);
+        s3_error(self->s3, &errmsg, &response_code, &s3_error_code, NULL, NULL, NULL);
 
         /* if it's an expected error (not found), check what to do. */
         if (response_code == 404 && s3_error_code == S3_ERROR_NoSuchKey) {
             int next_file;
-            pself->file = -1;
-            pself->in_file = FALSE;
             next_file = find_next_file(self, pself->file);
             if (next_file > 0) {
                 /* Note short-circut of dispatcher. */
@@ -1054,131 +1239,196 @@ s3_device_seek_file(Device *pself, guint file) {
             } else if (next_file == 0) {
                 /* No next file. Check if we are one past the end. */
                 key = special_file_to_key(self, "filestart", pself->file - 1);
-                result = s3_read(self->s3, self->bucket, key, &buf, &buf_size,
-                                 S3_DEVICE_MAX_BLOCK_SIZE);
+                result = s3_read(self->s3, self->bucket, key,
+                    S3_BUFFER_WRITE_FUNCS, &buf, NULL, NULL);
                 g_free(key);
                 if (result) {
+                   /* pself->file, etc. are already correct */
                     return make_tapeend_header();
                 } else {
+                   device_set_error(pself,
+                       stralloc(_("Attempt to read past tape-end file")),
+                       DEVICE_STATUS_SUCCESS);
                     return NULL;
                 }
             }
         } else {
-            /* An error occured finding out if we are the last file. */
+            /* An unexpected error occured finding out if we are the last file. */
+           device_set_error(pself,
+               stralloc(errmsg),
+               DEVICE_STATUS_DEVICE_ERROR);
             return NULL;
         }
     }
    
     /* and make a dumpfile_t out of it */
-    g_assert(buf != NULL);
+    g_assert(buf.buffer != NULL);
     amanda_header = g_new(dumpfile_t, 1);
     fh_init(amanda_header);
-    parse_file_header(buf, amanda_header, buf_size);
-    g_free(buf);
+    parse_file_header(buf.buffer, amanda_header, buf.buffer_pos);
+    g_free(buf.buffer);
 
     switch (amanda_header->type) {
         case F_DUMPFILE:
         case F_CONT_DUMPFILE:
         case F_SPLIT_DUMPFILE:
-            return amanda_header;
+            break;
 
         default:
-            fprintf(stderr,
-                    _("Invalid amanda header while reading file header\n"));
+           device_set_error(pself,
+               stralloc(_("Invalid amanda header while reading file header")),
+               DEVICE_STATUS_VOLUME_ERROR);
             g_free(amanda_header);
             return NULL;
     }
+
+    pself->in_file = TRUE;
+    return amanda_header;
 }
-/* }}} */
 
-/* {{{ s3_device_seek_block */
 static gboolean
 s3_device_seek_block(Device *pself, guint64 block) {
+    if (device_in_error(pself)) return FALSE;
+
     pself->block = block;
     return TRUE;
 }
-/* }}} */
 
-/* {{{ s3_device_read_block */
+typedef struct s3_read_block_data {
+    gpointer data;
+    int size_req;
+    int size_written;
+
+    CurlBuffer curl;
+} s3_read_block_data;
+
+/* wrapper around s3_buffer_write_func to write as much data as possible to
+ * the user's buffer, and switch to a dynamically allocated buffer if that
+ * isn't large enough */
+static size_t
+s3_read_block_write_func(void *ptr, size_t size, size_t nmemb, void *stream)
+{
+    s3_read_block_data *dat = stream;
+    guint new_bytes, bytes_needed;
+
+    /* if data is NULL, call through to s3_buffer_write_func */
+    if (!dat->data) {
+       return s3_buffer_write_func(ptr, size, nmemb, (void *)(&dat->curl));
+    }
+
+    new_bytes = (guint) size * nmemb;
+    bytes_needed = dat->size_written + new_bytes;
+
+    if (bytes_needed > (guint)dat->size_written) {
+       /* this read will overflow the user's buffer, so malloc ourselves
+        * a new buffer and keep reading */
+       dat->curl.buffer = g_malloc(bytes_needed);
+       dat->curl.buffer_len = bytes_needed;
+       dat->curl.buffer_pos = dat->size_written;
+       memcpy(dat->curl.buffer, dat->data, dat->size_written);
+       dat->data = NULL; /* signal that the user's buffer is too small */
+       return s3_buffer_write_func(ptr, size, nmemb, (void *)(&dat->curl));
+    }
+
+    memcpy(dat->data + dat->size_written, ptr, bytes_needed);
+    return new_bytes;
+}
+
 static int
 s3_device_read_block (Device * pself, gpointer data, int *size_req) {
     S3Device * self = S3_DEVICE(pself);
     char *key;
-    gpointer buf;
+    s3_read_block_data dat = {NULL, 0, 0, { NULL, 0, 0, S3_DEVICE_MAX_BLOCK_SIZE} };
     gboolean result;
-    guint buf_size;
 
     g_assert (self != NULL);
+    if (device_in_error(self)) return -1;
 
     /* get the file*/
     key = file_and_block_to_key(self, pself->file, pself->block);
     g_assert(key != NULL);
     if (self->cached_key && (0 == strcmp(key, self->cached_key))) {
-        /* use the cached copy and clear the cache */
-        buf = self->cached_buf;
-        buf_size = self->cached_size;
+       if (*size_req >= self->cached_size) {
+           /* use the cached copy and clear the cache */
+           memcpy(data, self->cached_buf, self->cached_size);
+           *size_req = self->cached_size;
+
+           g_free(key);
+           g_free(self->cached_key);
+           self->cached_key = NULL;
+           g_free(self->cached_buf);
+           self->cached_buf = NULL;
+
+           pself->block++;
+           return *size_req;
+       } else {
+           *size_req = self->cached_size;
+           g_free(key);
+           return 0;
+       }
+    }
 
-        self->cached_buf = NULL;
-        g_free(self->cached_key);
-        self->cached_key = NULL;
-    } else {
-        /* clear the cache and actually download the file */
-        if (self->cached_buf) {
-            g_free(self->cached_buf);
-            self->cached_buf = NULL;
-        }
-        if (self->cached_key) {
-            g_free(self->cached_key);
-            self->cached_key = NULL;
-        }
+    /* clear the cache, as it's useless to us */
+    if (self->cached_key) {
+       g_free(self->cached_key);
+       self->cached_key = NULL;
 
-        result = s3_read(self->s3, self->bucket, key, &buf, &buf_size, S3_DEVICE_MAX_BLOCK_SIZE);
-        if (!result) {
-            guint response_code;
-            s3_error_code_t s3_error_code;
-            s3_error(self->s3, NULL, &response_code, &s3_error_code, NULL, NULL, NULL);
+       g_free(self->cached_buf);
+       self->cached_buf = NULL;
+    }
 
-            g_free(key);
-            key = NULL;
+    /* set up dat for the write_func callback */
+    if (!data || *size_req <= 0) {
+       dat.data = NULL;
+       dat.size_req = 0;
+    } else {
+       dat.data = data;
+       dat.size_req = *size_req;
+    }
 
-            /* if it's an expected error (not found), just return -1 */
-            if (response_code == 404 && s3_error_code == S3_ERROR_NoSuchKey) {
-                pself->is_eof = TRUE;
-                pself->in_file = FALSE;
-                return -1;
-            }
+    result = s3_read(self->s3, self->bucket, key, s3_read_block_write_func,
+        s3_buffer_reset_func, &dat, NULL, NULL);
+    if (!result) {
+       guint response_code;
+       s3_error_code_t s3_error_code;
+       s3_error(self->s3, NULL, &response_code, &s3_error_code, NULL, NULL, NULL);
+
+       g_free(key);
+       key = NULL;
+
+       /* if it's an expected error (not found), just return -1 */
+       if (response_code == 404 && s3_error_code == S3_ERROR_NoSuchKey) {
+           pself->is_eof = TRUE;
+           pself->in_file = FALSE;
+           device_set_error(pself,
+               stralloc(_("EOF")),
+               DEVICE_STATUS_SUCCESS);
+           return -1;
+       }
 
-            /* otherwise, log it and return FALSE */
-            fprintf(stderr, _("While reading data block from S3: %s\n"),
-                    s3_strerror(self->s3));
-            return -1;
-        }
+       /* otherwise, log it and return FALSE */
+       device_set_error(pself,
+           vstrallocf(_("While reading data block from S3: %s"), s3_strerror(self->s3)),
+           DEVICE_STATUS_VOLUME_ERROR);
+       return -1;
     }
 
-    /* INVARIANT: cache is NULL */
-    g_assert(self->cached_buf == NULL);
-    g_assert(self->cached_key == NULL);
-
-    /* now see how the caller wants to deal with that */
-    if (data == NULL || *size_req < 0 || buf_size > (guint)*size_req) {
-        /* A size query or short buffer -- load the cache and return the size*/
-        self->cached_buf = buf;
+    if (dat.data == NULL) {
+       /* data was larger than the available space, so cache it and return
+        * the actual size */
+        self->cached_buf = dat.curl.buffer;
+        self->cached_size = dat.curl.buffer_pos;
         self->cached_key = key;
-        self->cached_size = buf_size;
+       key = NULL;
 
-        *size_req = buf_size;
+        *size_req = dat.curl.buffer_pos;
         return 0;
-    } else {
-        /* ok, all checks are passed -- copy the data */
-        *size_req = buf_size;
-        g_memmove(data, buf, buf_size);
-        g_free(key);
-        g_free(buf);
-
-        /* move on to the next block */
-        pself->block++;
-
-        return buf_size;
     }
+
+    /* ok, the read went directly to the user's buffer, so we need only
+     * set and return the size */
+    pself->block++;
+    g_free(key);
+    *size_req = dat.size_req;
+    return dat.size_req;
 }
-/* }}} */
diff --git a/device-src/s3-device.h b/device-src/s3-device.h
deleted file mode 100644 (file)
index 286cb36..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
- * 
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License version 2.1 as 
- * published by the Free Software Foundation.
- * 
- * This 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 this library; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
- * 
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
- */
-
-#ifndef __S3_DEVICE_H__
-#define __S3_DEVICE_H__
-#include <glib.h>
-#include <curl/curl.h>
-#include <glib-object.h>
-#include "s3.h"
-
-/*
- * Constants
- */
-
-/*
- * Type checking and casting macros
- */
-#define TYPE_S3_DEVICE (s3_device_get_type())
-#define S3_DEVICE(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), s3_device_get_type(), S3Device)
-#define S3_DEVICE_CONST(obj)   G_TYPE_CHECK_INSTANCE_CAST((obj), s3_device_get_type(), S3Device const)
-#define S3_DEVICE_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), s3_device_get_type(), S3DeviceClass)
-#define IS_S3_DEVICE(obj)      G_TYPE_CHECK_INSTANCE_TYPE((obj), s3_device_get_type ())
-
-#define S3_DEVICE_GET_CLASS(obj)       G_TYPE_INSTANCE_GET_CLASS((obj), s3_device_get_type(), S3DeviceClass)
-
-/*
- * Main object structure
- */
-typedef struct _S3MetadataFile S3MetadataFile;
-
-#ifndef __TYPEDEF_S3_DEVICE__
-#define __TYPEDEF_S3_DEVICE__
-typedef struct _S3Device S3Device;
-#endif
-struct _S3Device {
-    Device __parent__;
-    
-    /* The "easy" curl handle we use to access Amazon S3 */
-    S3Handle *s3;
-
-    /* S3 access information */
-    char *bucket;
-    char *prefix;
-
-    /* The S3 access information. */
-    char *secret_key;
-    char *access_key;
-#ifdef WANT_DEVPAY
-    char *user_token;
-#endif
-
-    /* a cache for unsuccessful reads (where we get the file but the caller
-     * doesn't have space for it or doesn't want it), where we expect the
-     * next call will request the same file.
-     */
-    char *cached_buf;
-    char *cached_key;
-    int cached_size;
-
-    /* Produce verbose output? */
-    gboolean verbose;
-    /* Set to FALSE once s3_device_open_device is finished. */
-    gboolean initializing;
-};
-
-/*
- * Class definition
- */
-typedef struct _S3DeviceClass S3DeviceClass;
-struct _S3DeviceClass {
-    DeviceClass __parent__;
-};
-
-
-/*
- * Public methods
- */
-GType  s3_device_get_type      (void);
-void    s3_device_register    (void);
-
-#endif
diff --git a/device-src/s3-util.c b/device-src/s3-util.c
new file mode 100644 (file)
index 0000000..2fe517f
--- /dev/null
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+ * 
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License version 2.1 as 
+ * published by the Free Software Foundation.
+ * 
+ * This 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 this library; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+ * 
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+ */
+
+
+#ifdef HAVE_CONFIG_H
+/* use a relative path here to avoid conflicting with Perl's config.h. */
+#include "../config/config.h"
+#endif
+#ifdef HAVE_REGEX_H
+#include <sys/types.h>
+#include <regex.h>
+#endif
+#ifdef HAVE_AMANDA_H
+#include "amanda.h"
+#endif
+
+#include <glib.h>
+#include <openssl/md5.h>
+#include <openssl/bio.h>
+#include <openssl/evp.h>
+#include <openssl/bn.h>
+#include "s3-util.h"
+
+#ifdef HAVE_REGEX_H
+int
+s3_regexec_wrap(regex_t *regex,
+           const char *str,
+           size_t nmatch,
+           regmatch_t pmatch[],
+           int eflags)
+{
+    char *message;
+    int size;
+    int reg_result;
+
+    reg_result = regexec(regex, str, nmatch, pmatch, eflags);
+    if (reg_result != 0 && reg_result != REG_NOMATCH) {
+        size = regerror(reg_result, regex, NULL, 0);
+        message = g_malloc(size);
+        regerror(reg_result, regex, message, size);
+
+        /* this is programmer error (bad regexp), so just log
+         * and abort().  There's no good way to signal a
+         * permanaent error from interpret_response. */
+        g_critical(_("Regex error: %s"), message);
+    }
+
+    return reg_result;
+}
+#else
+
+int
+s3_regexec_wrap(regex_t *regex,
+           const char *str,
+           size_t nmatch,
+           regmatch_t pmatch[],
+           int eflags)
+{
+    GMatchInfo *match_info;
+    int ret = REG_NOERROR;
+    guint i;
+
+    g_assert(regex && *regex);
+    g_regex_match(*regex, str, eflags, &match_info);
+    if (g_match_info_matches(match_info)) {
+        g_assert(g_match_info_get_match_count(match_info) <= (glong) nmatch);
+        for (i = 0; i < nmatch; i++) {
+            pmatch[i].rm_eo = pmatch[i].rm_so = -1;
+            g_match_info_fetch_pos(match_info, i, &pmatch[i].rm_so, &pmatch[i].rm_eo);
+        }
+    } else {
+        ret = REG_NOMATCH;
+    }
+    g_match_info_free(match_info);
+    return ret;
+}
+#endif
+
+#ifndef HAVE_AMANDA_H
+char*
+find_regex_substring(const char* base_string, const regmatch_t match)
+{
+    g_assert(match.rm_eo >= match.rm_so);
+    return g_strndup(base_string+match.rm_so, match.rm_eo - match.rm_so);
+}
+#endif
+
+gchar*
+s3_base64_encode(const GByteArray *to_enc) {
+    BIO *bio_b64 = NULL, *bio_buff = NULL;
+    long bio_b64_len;
+    char *bio_b64_data = NULL, *ret = NULL;
+    if (!to_enc) return NULL;
+    
+    /* Initialize base64 encoding filter */
+    bio_b64 = BIO_new(BIO_f_base64());
+    g_assert(bio_b64);
+    BIO_set_flags(bio_b64, BIO_FLAGS_BASE64_NO_NL);
+
+    /* Initialize memory buffer for the base64 encoding */
+    bio_buff = BIO_new(BIO_s_mem());
+    g_assert(bio_buff);
+    bio_buff = BIO_push(bio_b64, bio_buff);
+
+    /* Write the MD5 hash into the buffer to encode it in base64 */
+    BIO_write(bio_buff, to_enc->data, to_enc->len);
+    /* BIO_flush is a macro and GCC 4.1.2 complains without this cast*/
+    (void) BIO_flush(bio_buff);
+
+    /* Pull out the base64 encoding of the MD5 hash */
+    bio_b64_len = BIO_get_mem_data(bio_buff, &bio_b64_data);
+    g_assert(bio_b64_data);
+    ret = g_strndup(bio_b64_data, bio_b64_len);
+
+    /* If bio_b64 is freed separately, freeing bio_buff will 
+     * invalidly free memory and potentially segfault.
+     */
+    BIO_free_all(bio_buff);
+    return ret;
+}
+
+gchar*
+s3_hex_encode(const GByteArray *to_enc)  {
+    guint i;
+    gchar *ret = NULL, table[] = "0123456789abcdef";
+    if (!to_enc) return NULL;
+
+    ret = g_new(gchar, to_enc->len*2 + 1);
+    for (i = 0; i < to_enc->len; i++) {
+        /* most significant 4 bits */
+        ret[i*2] = table[to_enc->data[i] >> 4];
+        /* least significant 4 bits */
+        ret[i*2 + 1] = table[to_enc->data[i] & 0xf];
+    }
+    ret[to_enc->len*2] = '\0';
+
+    return ret;
+}
+
+GByteArray*
+s3_compute_md5_hash(const GByteArray *to_hash) {
+    MD5_CTX md5_ctx;
+    GByteArray *ret;
+    if (!to_hash) return NULL;
+    
+    ret = g_byte_array_sized_new(S3_MD5_HASH_BYTE_LEN);
+    g_byte_array_set_size(ret, S3_MD5_HASH_BYTE_LEN);
+    
+    MD5_Init(&md5_ctx);
+    MD5_Update(&md5_ctx, to_hash->data, to_hash->len);
+    MD5_Final(ret->data, &md5_ctx);
+    
+    return ret;
+}
diff --git a/device-src/s3-util.h b/device-src/s3-util.h
new file mode 100644 (file)
index 0000000..20634f2
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+ * 
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License version 2.1 as 
+ * published by the Free Software Foundation.
+ * 
+ * This 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 this library; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+ * 
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+ */
+
+#ifndef __S3_UTIL_H__
+#define __S3_UTIL_H__
+
+#ifdef HAVE_REGEX_H
+#  ifdef HAVE_SYS_TYPES_H
+#  include <sys/types.h>
+#  endif
+#include <regex.h>
+#endif
+#include <glib.h>
+
+/*
+ * Constants
+ */
+
+/* number of raw bytes in MD5 hash */
+#define S3_MD5_HASH_BYTE_LEN 16
+/* length of an MD5 hash encoded as base64 (not including terminating NULL) */
+#define S3_MD5_HASH_B64_LEN 25
+/* length of an MD5 hash encoded as hexadecimal (not including terminating NULL) */
+#define S3_MD5_HASH_HEX_LEN 32
+
+/*
+ * Types
+ */
+
+#ifndef HAVE_REGEX_H
+typedef GRegex* regex_t;
+
+typedef gint regoff_t;
+typedef struct
+{
+    regoff_t rm_so;  /* Byte offset from string's start to substring's start.  */
+    regoff_t rm_eo;  /* Byte offset from string's start to substring's end.  */
+} regmatch_t;
+
+typedef enum
+{
+    REG_NOERROR = 0,      /* Success.  */
+    REG_NOMATCH          /* Didn't find a match (for regexec).  */
+} reg_errcode_t;
+#endif
+
+/*
+ * Functions
+ */
+
+#ifndef USE_GETTEXT
+/* we don't use gettextize, so hack around this ... */
+#define _(str) (str)
+#endif
+
+/*
+ * Wrapper around regexec to handle programmer errors.
+ * Only returns if the regexec returns 0 (match) or REG_NOMATCH.
+ * See regexec(3) documentation for the rest.
+ */
+int
+s3_regexec_wrap(regex_t *regex,
+           const char *str,
+           size_t nmatch,
+           regmatch_t pmatch[],
+           int eflags);
+
+
+#ifndef HAVE_AMANDA_H
+char*
+find_regex_substring(const char* base_string,
+           const regmatch_t match);
+#endif
+
+/* 
+ * Encode bytes using Base-64
+ *
+ * @note: GLib 2.12+ has a function for this (g_base64_encode) 
+ *     but we support much older versions. gnulib does as well, but its
+ *     hard to use correctly (see its notes).
+ *
+ * @param to_enc: The data to encode.
+ * @returns:  A new, null-terminated string or NULL if to_enc is NULL.
+ */
+gchar*
+s3_base64_encode(const GByteArray *to_enc);
+
+/* 
+ * Encode bytes using hexadecimal
+ *
+ * @param to_enc: The data to encode.
+ * @returns:  A new, null-terminated string or NULL if to_enc is NULL.
+ */
+gchar*
+s3_hex_encode(const GByteArray *to_enc);
+
+/* 
+ * Compute the MD5 hash of a blob of data.
+ *
+ * @param to_hash: The data to compute the hash for.
+ * @returns:  A new GByteArray containing the MD5 hash of data or 
+ * NULL if to_hash is NULL.
+ */
+GByteArray*
+s3_compute_md5_hash(const GByteArray *to_hash);
+
+#endif
index dfd29dc42200762e642211cfe486fef10f27a77d..a9dbd67f8eb625268ac1849615fd368d8153b450 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+ * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
  * 
  * This library is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License version 2.1 as 
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  * 
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 /* TODO
- * - Compute and send Content-MD5 header
- * - check SSL certificate
  * - collect speed statistics
  * - debugging mode
  */
 
+#ifdef HAVE_CONFIG_H
+/* use a relative path here to avoid conflicting with Perl's config.h. */
+#include "../config/config.h"
+#endif
 #include <string.h>
+#include "s3.h"
+#include "s3-util.h"
+#ifdef HAVE_REGEX_H
+#include <regex.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>
+#endif
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
+#ifdef HAVE_DIRENT_H
 #include <dirent.h>
-#include <regex.h>
+#endif
+#ifdef HAVE_TIME_H
 #include <time.h>
+#endif
+#ifdef HAVE_UTIL_H
 #include "util.h"
+#endif
+#ifdef HAVE_AMANDA_H
 #include "amanda.h"
-#include "s3.h"
-#include "base64.h"
+#endif
+
 #include <curl/curl.h>
 
 /* Constant renamed after version 7.10.7 */
 
 #include <openssl/err.h>
 #include <openssl/ssl.h>
-
-/*
- * Constants / definitions
- */
+#include <openssl/md5.h>
 
 /* Maximum key length as specified in the S3 documentation
  * (*excluding* null terminator) */
 #define S3_MAX_KEY_LENGTH 1024
 
 #define AMAZON_SECURITY_HEADER "x-amz-security-token"
+#define AMAZON_BUCKET_CONF_TEMPLATE "\
+  <CreateBucketConfiguration>\n\
+    <LocationConstraint>%s</LocationConstraint>\n\
+  </CreateBucketConfiguration>"
 
 /* parameters for exponential backoff in the face of retriable errors */
 
 /* start at 0.01s */
-#define EXPONENTIAL_BACKOFF_START_USEC 10000
+#define EXPONENTIAL_BACKOFF_START_USEC G_USEC_PER_SEC/100
 /* double at each retry */
 #define EXPONENTIAL_BACKOFF_BASE 2
-/* retry 15 times (for a total of about 5 minutes spent waiting) */
-#define EXPONENTIAL_BACKOFF_MAX_RETRIES 5
+/* retry 14 times (for a total of about 3 minutes spent waiting) */
+#define EXPONENTIAL_BACKOFF_MAX_RETRIES 14
 
 /* general "reasonable size" parameters */
 #define MAX_ERROR_RESPONSE_LEN (100*1024)
 /* Results which should always be retried */
 #define RESULT_HANDLING_ALWAYS_RETRY \
         { 400,  S3_ERROR_RequestTimeout,     0,                         S3_RESULT_RETRY }, \
+        { 404,  S3_ERROR_NoSuchBucket,       0,                         S3_RESULT_RETRY }, \
         { 409,  S3_ERROR_OperationAborted,   0,                         S3_RESULT_RETRY }, \
         { 412,  S3_ERROR_PreconditionFailed, 0,                         S3_RESULT_RETRY }, \
         { 500,  S3_ERROR_InternalError,      0,                         S3_RESULT_RETRY }, \
         { 0,    0,                           CURLE_PARTIAL_FILE,        S3_RESULT_RETRY }, \
         { 0,    0,                           CURLE_OPERATION_TIMEOUTED, S3_RESULT_RETRY }, \
         { 0,    0,                           CURLE_SEND_ERROR,          S3_RESULT_RETRY }, \
-        { 0,    0,                           CURLE_RECV_ERROR,          S3_RESULT_RETRY }
+        { 0,    0,                           CURLE_RECV_ERROR,          S3_RESULT_RETRY }, \
+        { 0,    0,                           CURLE_GOT_NOTHING,         S3_RESULT_RETRY }
 
 /*
  * Data structures and associated functions
@@ -106,13 +128,14 @@ struct S3Handle {
 
     char *access_key;
     char *secret_key;
-#ifdef WANT_DEVPAY
     char *user_token;
-#endif
+
+    char *bucket_location;
 
     CURL *curl;
 
     gboolean verbose;
+    gboolean use_ssl;
 
     /* information from the last request */
     char *last_message;
@@ -124,6 +147,33 @@ struct S3Handle {
     guint last_response_body_size;
 };
 
+typedef struct {
+    CurlBuffer resp_buf;
+    s3_write_func write_func;
+    s3_reset_func reset_func;
+    gpointer write_data;
+
+    gboolean headers_done;
+    char *etag;
+} S3InternalData;
+
+/* Callback function to examine headers one-at-a-time
+ * 
+ * @note this is the same as CURLOPT_HEADERFUNCTION
+ *
+ * @param data: The pointer to read data from
+ * @param size: The size of each "element" of the data buffer in bytes
+ * @param nmemb: The number of elements in the data buffer.
+ * So, the buffer's size is size*nmemb bytes.
+ * @param stream: the header_data (an opaque pointer)
+ *
+ * @return The number of bytes written to the buffer or
+ * CURL_WRITEFUNC_PAUSE to pause.
+ * If it's the number of bytes written, it should match the buffer size
+ */
+typedef size_t (*s3_header_func)(void *data, size_t size, size_t nmemb, void *stream);
+
+
 /*
  * S3 errors */
 
@@ -153,12 +203,6 @@ s3_error_code_from_name(char *s3_error_name);
 static const char *
 s3_error_name_from_code(s3_error_code_t s3_error_code);
 
-/* Does this install of curl support SSL?
- *
- * @returns: boolean
- */
-static gboolean
-s3_curl_supports_ssl(void);
 
 /*
  * result handling */
@@ -201,27 +245,31 @@ lookup_result(const result_handling_t *result_handling,
 
 /*
  * Precompiled regular expressions */
-
-static const char *error_name_regex_string = "<Code>[:space:]*([^<]*)[:space:]*</Code>";
-static const char *message_regex_string = "<Message>[:space:]*([^<]*)[:space:]*</Message>";
-static regex_t error_name_regex, message_regex;
+static regex_t etag_regex, error_name_regex, message_regex, subdomain_regex,
+    location_con_regex;
 
 /*
  * Utility functions
  */
 
-/* Build a resource URI as /[bucket[/key]], with proper URL
- * escaping.
+/* Construct the URL for an Amazon S3 REST request.
  *
- * The caller is responsible for freeing the resulting string.
+ * A new string is allocated and returned; it is the responsiblity of the caller.
  *
- * @param bucket: the bucket, or NULL if none is involved
- * @param key: the key within the bucket, or NULL if none is involved
- * @returns: completed URI
+ * @param hdl: the S3Handle object
+ * @param verb: capitalized verb for this request ('PUT', 'GET', etc.)
+ * @param bucket: the bucket being accessed, or NULL for none
+ * @param key: the key being accessed, or NULL for none
+ * @param subresource: the sub-resource being accessed (e.g. "acl"), or NULL for none
+ * @param use_subdomain: if TRUE, a subdomain of s3.amazonaws.com will be used
  */
 static char *
-build_resource(const char *bucket,
-               const char *key);
+build_url(const char *bucket,
+      const char *key,
+      const char *subresource,
+      const char *query,
+      gboolean use_subdomain,
+      gboolean use_ssl);
 
 /* Create proper authorization headers for an Amazon S3 REST
  * request to C{headers}.
@@ -234,12 +282,22 @@ build_resource(const char *bucket,
  *
  * @param hdl: the S3Handle object
  * @param verb: capitalized verb for this request ('PUT', 'GET', etc.)
- * @param resource: the resource being accessed
+ * @param bucket: the bucket being accessed, or NULL for none
+ * @param key: the key being accessed, or NULL for none
+ * @param subresource: the sub-resource being accessed (e.g. "acl"), or NULL for none
+ * @param md5_hash: the MD5 hash of the request body, or NULL for none
+ * @param use_subdomain: if TRUE, a subdomain of s3.amazonaws.com will be used
  */
 static struct curl_slist *
 authenticate_request(S3Handle *hdl,
                      const char *verb,
-                     const char *resource);
+                     const char *bucket,
+                     const char *key,
+                     const char *subresource,
+                     const char *md5_hash,
+                     gboolean use_subdomain);
+
+
 
 /* Interpret the response to an S3 operation, assuming CURL completed its request
  * successfully.  This function fills in the relevant C{hdl->last*} members.
@@ -247,50 +305,99 @@ authenticate_request(S3Handle *hdl,
  * @param hdl: The S3Handle object
  * @param body: the response body
  * @param body_len: the length of the response body
+ * @param etag: The response's ETag header
+ * @param content_md5: The hex-encoded MD5 hash of the request body, 
+ *     which will be checked against the response's ETag header.
+ *     If NULL, the header is not checked.
+ *     If non-NULL, then the body should have the response headers at its beginnning.
  * @returns: TRUE if the response should be retried (e.g., network error)
  */
 static gboolean
 interpret_response(S3Handle *hdl,
                    CURLcode curl_code,
                    char *curl_error_buffer,
-                   void *body,
-                   guint body_len);
+                   gchar *body,
+                   guint body_len,
+                   const char *etag,
+                   const char *content_md5);
 
 /* Perform an S3 operation.  This function handles all of the details
  * of retryig requests and so on.
  * 
+ * The concepts of bucket and keys are defined by the Amazon S3 API.
+ * See: "Components of Amazon S3" - API Version 2006-03-01 pg. 8
+ *
+ * Individual sub-resources are defined in several places. In the REST API, 
+ * they they are represented by a "flag" in the "query string".
+ * See: "Constructing the CanonicalizedResource Element" - API Version 2006-03-01 pg. 60
+ *
  * @param hdl: the S3Handle object
- * @param resource: the UTF-8 encoded resource to access
-                    (without query parameters)
- * @param uri: the urlencoded URI to access at Amazon (may be identical to resource)
  * @param verb: the HTTP request method
- * @param request_body: the request body, or NULL if none should be sent
- * @param request_body_size: the length of the request body
- * @param max_response_size: the maximum number of bytes to accept in the
- * response, or 0 for no limit.
- * @param preallocate_response_size: for more efficient operation, preallocate
- * a buffer of this size for the response body.  Addition space will be allocated
- * if the response exceeds this size.
+ * @param bucket: the bucket to access, or NULL for none
+ * @param key: the key to access, or NULL for none
+ * @param subresource: the "sub-resource" to request (e.g. "acl") or NULL for none
+ * @param query: the query string to send (not including th initial '?'),
+ * or NULL for none
+ * @param read_func: the callback for reading data
+ *   Will use s3_empty_read_func if NULL is passed in.
+ * @param read_reset_func: the callback for to reset reading data
+ * @param size_func: the callback to get the number of bytes to upload
+ * @param md5_func: the callback to get the MD5 hash of the data to upload
+ * @param read_data: pointer to pass to the above functions
+ * @param write_func: the callback for writing data.
+ *   Will use s3_counter_write_func if NULL is passed in.
+ * @param write_reset_func: the callback for to reset writing data
+ * @param write_data: pointer to pass to C{write_func}
+ * @param progress_func: the callback for progress information
+ * @param progress_data: pointer to pass to C{progress_func}
  * @param result_handling: instructions for handling the results; see above.
  * @returns: the result specified by result_handling; details of the response
  * are then available in C{hdl->last*}
  */
 static s3_result_t
 perform_request(S3Handle *hdl,
-                const char *resource,
-                const char *uri,
                 const char *verb,
-                const void *request_body,
-                guint request_body_size,
-                guint max_response_size,
-                guint preallocate_response_size,
+                const char *bucket,
+                const char *key,
+                const char *subresource,
+                const char *query,
+                s3_read_func read_func,
+                s3_reset_func read_reset_func,
+                s3_size_func size_func,
+                s3_md5_func md5_func,
+                gpointer read_data,
+                s3_write_func write_func,
+                s3_reset_func write_reset_func,
+                gpointer write_data,
+                s3_progress_func progress_func,
+                gpointer progress_data,
                 const result_handling_t *result_handling);
 
 /*
- * Static function implementations
+ * a CURLOPT_WRITEFUNCTION to save part of the response in memory and 
+ * call an external function if one was provided.
  */
+static size_t
+s3_internal_write_func(void *ptr, size_t size, size_t nmemb, void * stream);
 
-/* {{{ s3_error_code_from_name */
+/*
+ * a function to reset to our internal buffer
+ */
+static void
+s3_internal_reset_func(void * stream);
+
+/*
+ * a CURLOPT_HEADERFUNCTION to save the ETag header only.
+ */
+static size_t
+s3_internal_header_func(void *ptr, size_t size, size_t nmemb, void * stream);
+
+static gboolean
+compile_regexes(void);
+
+/*
+ * Static function implementations
+ */
 static s3_error_code_t
 s3_error_code_from_name(char *s3_error_name)
 {
@@ -300,59 +407,47 @@ s3_error_code_from_name(char *s3_error_name)
 
     /* do a brute-force search through the list, since it's not sorted */
     for (i = 0; i < S3_ERROR_END; i++) {
-        if (strcasecmp(s3_error_name, s3_error_code_names[i]) == 0)
+        if (g_strcasecmp(s3_error_name, s3_error_code_names[i]) == 0)
             return i;
     }
 
     return S3_ERROR_Unknown;
 }
-/* }}} */
 
-/* {{{ s3_error_name_from_code */
 static const char *
 s3_error_name_from_code(s3_error_code_t s3_error_code)
 {
     if (s3_error_code >= S3_ERROR_END)
         s3_error_code = S3_ERROR_Unknown;
 
-    if (s3_error_code == 0)
-        return NULL;
-
     return s3_error_code_names[s3_error_code];
 }
-/* }}} */
 
-/* {{{ s3_curl_supports_ssl */
-static gboolean
+gboolean
 s3_curl_supports_ssl(void)
 {
     static int supported = -1;
-
     if (supported == -1) {
 #if defined(CURL_VERSION_SSL)
-       curl_version_info_data *info = curl_version_info(CURLVERSION_NOW);
-       if (info->features & CURL_VERSION_SSL)
-           supported = 1;
-       else
-           supported = 0;
+    curl_version_info_data *info = curl_version_info(CURLVERSION_NOW);
+    if (info->features & CURL_VERSION_SSL)
+        supported = 1;
+    else
+        supported = 0;
 #else
-       supported = 0;
+    supported = 0;
 #endif
     }
 
     return supported;
 }
-/* }}} */
 
-/* {{{ lookup_result */
 static s3_result_t
 lookup_result(const result_handling_t *result_handling,
               guint response_code,
               s3_error_code_t s3_error_code,
               CURLcode curl_code)
 {
-    g_return_val_if_fail(result_handling != NULL, S3_RESULT_FAIL);
-
     while (result_handling->response_code
         || result_handling->s3_error_code 
         || result_handling->curl_code) {
@@ -369,137 +464,210 @@ lookup_result(const result_handling_t *result_handling,
     /* return the result for the terminator, as the default */
     return result_handling->result;
 }
-/* }}} */
 
-/* {{{ build_resource */
 static char *
-build_resource(const char *bucket,
-               const char *key)
+build_url(const char *bucket,
+      const char *key,
+      const char *subresource,
+      const char *query,
+      gboolean use_subdomain,
+      gboolean use_ssl)
 {
+    GString *url = NULL;
     char *esc_bucket = NULL, *esc_key = NULL;
-    char *resource = NULL;
 
-    if (bucket)
-        if (!(esc_bucket = curl_escape(bucket, 0)))
-            goto cleanup;
+    /* scheme */
+    url = g_string_new("http");
+    if (use_ssl)
+        g_string_append(url, "s");
 
-    if (key)
-        if (!(esc_key = curl_escape(key, 0)))
-            goto cleanup;
+    g_string_append(url, "://");
 
-    if (esc_bucket) {
-        if (esc_key) {
-            resource = g_strdup_printf("/%s/%s", esc_bucket, esc_key);
-        } else {
-            resource = g_strdup_printf("/%s", esc_bucket);
-        }
-    } else {
-        resource = g_strdup("/");
+    /* domain */
+    if (use_subdomain && bucket)
+        g_string_append_printf(url, "%s.s3.amazonaws.com/", bucket);
+    else
+        g_string_append(url, "s3.amazonaws.com/");
+    
+    /* path */
+    if (!use_subdomain && bucket) {
+        esc_bucket = curl_escape(bucket, 0);
+    if (!esc_bucket) goto cleanup;
+        g_string_append_printf(url, "%s", esc_bucket);
+        if (key)
+            g_string_append(url, "/");
     }
+
+    if (key) {
+        esc_key = curl_escape(key, 0);
+    if (!esc_key) goto cleanup;
+        g_string_append_printf(url, "%s", esc_key);
+    }
+
+    /* query string */
+    if (subresource || query)
+        g_string_append(url, "?");
+
+    if (subresource)
+        g_string_append(url, subresource);
+
+    if (subresource && query)
+        g_string_append(url, "&");
+
+    if (query)
+        g_string_append(url, query);
+
 cleanup:
     if (esc_bucket) curl_free(esc_bucket);
     if (esc_key) curl_free(esc_key);
 
-    return resource;
+    return g_string_free(url, FALSE);
 }
-/* }}} */
 
-/* {{{ authenticate_request */
 static struct curl_slist *
 authenticate_request(S3Handle *hdl,
                      const char *verb,
-                     const char *resource) 
+                     const char *bucket,
+                     const char *key,
+                     const char *subresource,
+                     const char *md5_hash,
+             gboolean use_subdomain) 
 {
     time_t t;
     struct tm tmp;
     char date[100];
-    char * buf;
+    char *buf = NULL;
     HMAC_CTX ctx;
-    char md_value[EVP_MAX_MD_SIZE+1];
-    char auth_base64[40];
-    unsigned int md_len;
+    GByteArray *md = NULL;
+    char *auth_base64 = NULL;
     struct curl_slist *headers = NULL;
-    char * auth_string;
+    char *esc_bucket = NULL, *esc_key = NULL;
+    GString *auth_string = NULL;
+
+    /* Build the string to sign, per the S3 spec.
+     * See: "Authenticating REST Requests" - API Version 2006-03-01 pg 58
+     */
+    
+    /* verb */
+    auth_string = g_string_new(verb);
+    g_string_append(auth_string, "\n");
+    
+    /* Content-MD5 header */
+    if (md5_hash)
+        g_string_append(auth_string, md5_hash);
+    g_string_append(auth_string, "\n");
+
+    /* Content-Type is empty*/
+    g_string_append(auth_string, "\n");
+
 
     /* calculate the date */
     t = time(NULL);
+#ifdef _WIN32
+    if (!localtime_s(&tmp, &t)) g_debug("localtime error");
+#else
     if (!localtime_r(&t, &tmp)) perror("localtime");
+#endif
     if (!strftime(date, sizeof(date), "%a, %d %b %Y %H:%M:%S %Z", &tmp)) 
         perror("strftime");
 
+    g_string_append(auth_string, date);
+    g_string_append(auth_string, "\n");
+
+    if (hdl->user_token) {
+        g_string_append(auth_string, AMAZON_SECURITY_HEADER);
+        g_string_append(auth_string, ":");
+        g_string_append(auth_string, hdl->user_token);
+        g_string_append(auth_string, ",");
+        g_string_append(auth_string, STS_PRODUCT_TOKEN);
+        g_string_append(auth_string, "\n");
+    }
+
+    /* CanonicalizedResource */
+    g_string_append(auth_string, "/");
+    if (bucket) {
+        if (use_subdomain)
+            g_string_append(auth_string, bucket);
+        else {
+            esc_bucket = curl_escape(bucket, 0);
+            if (!esc_bucket) goto cleanup;
+            g_string_append(auth_string, esc_bucket);
+        }
+    }
+
+    if (bucket && (use_subdomain || key))
+        g_string_append(auth_string, "/");
+
+    if (key) {
+            esc_key = curl_escape(key, 0);
+            if (!esc_key) goto cleanup;
+            g_string_append(auth_string, esc_key);
+    }
+
+    if (subresource) {
+        g_string_append(auth_string, "?");
+        g_string_append(auth_string, subresource);
+    }
+
     /* run HMAC-SHA1 on the canonicalized string */
+    md = g_byte_array_sized_new(EVP_MAX_MD_SIZE+1);
     HMAC_CTX_init(&ctx);
-    HMAC_Init_ex(&ctx, hdl->secret_key, strlen(hdl->secret_key), EVP_sha1(), NULL);
-    auth_string = g_strconcat(verb, "\n\n\n", date, "\n",
-#ifdef WANT_DEVPAY
-                              AMAZON_SECURITY_HEADER, ":",
-                              hdl->user_token, ",",
-                              STS_PRODUCT_TOKEN, "\n",
-#endif
-                              resource, NULL);
-    HMAC_Update(&ctx, (unsigned char*) auth_string, strlen(auth_string));
-    g_free(auth_string);
-    md_len = EVP_MAX_MD_SIZE;
-    HMAC_Final(&ctx, (unsigned char*)md_value, &md_len);
+    HMAC_Init_ex(&ctx, hdl->secret_key, (int) strlen(hdl->secret_key), EVP_sha1(), NULL);
+    HMAC_Update(&ctx, (unsigned char*) auth_string->str, auth_string->len);
+    HMAC_Final(&ctx, md->data, &md->len);
     HMAC_CTX_cleanup(&ctx);
-    base64_encode(md_value, md_len, auth_base64, sizeof(auth_base64));
+    auth_base64 = s3_base64_encode(md);
 
     /* append the new headers */
-#ifdef WANT_DEVPAY
-    /* Devpay headers are included in hash. */
-    buf = g_strdup_printf(AMAZON_SECURITY_HEADER ": %s", hdl->user_token);
-    headers = curl_slist_append(headers, buf);
-    amfree(buf);
-
-    buf = g_strdup_printf(AMAZON_SECURITY_HEADER ": %s", STS_PRODUCT_TOKEN);
-    headers = curl_slist_append(headers, buf);
-    amfree(buf);
-#endif
+    if (hdl->user_token) {
+        /* Devpay headers are included in hash. */
+        buf = g_strdup_printf(AMAZON_SECURITY_HEADER ": %s", hdl->user_token);
+        headers = curl_slist_append(headers, buf);
+        g_free(buf);
+
+        buf = g_strdup_printf(AMAZON_SECURITY_HEADER ": %s", STS_PRODUCT_TOKEN);
+        headers = curl_slist_append(headers, buf);
+        g_free(buf);
+    }
 
     buf = g_strdup_printf("Authorization: AWS %s:%s",
                           hdl->access_key, auth_base64);
     headers = curl_slist_append(headers, buf);
-    amfree(buf);
+    g_free(buf);
     
+    if (md5_hash && '\0' != md5_hash[0]) {
+        buf = g_strdup_printf("Content-MD5: %s", md5_hash);
+        headers = curl_slist_append(headers, buf);
+        g_free(buf);
+    }
+
     buf = g_strdup_printf("Date: %s", date);
     headers = curl_slist_append(headers, buf);
-    amfree(buf);
+    g_free(buf);
+cleanup:
+    g_free(esc_bucket);
+    g_free(esc_key);
+    g_byte_array_free(md, TRUE);
+    g_free(auth_base64);
+    g_string_free(auth_string, TRUE);
 
     return headers;
 }
-/* }}} */
-
-/* {{{ interpret_response */
-static void
-regex_error(regex_t *regex, int reg_result)
-{
-    char *message;
-    int size;
-
-    size = regerror(reg_result, regex, NULL, 0);
-    message = g_malloc(size);
-    if (!message) abort(); /* we're really out of luck */
-    regerror(reg_result, regex, message, size);
-
-    /* this is programmer error (bad regexp), so just log
-     * and abort().  There's no good way to signal a
-     * permanaent error from interpret_response. */
-    g_error(_("Regex error: %s"), message);
-    g_assert_not_reached();
-}
 
 static gboolean
 interpret_response(S3Handle *hdl,
                    CURLcode curl_code,
                    char *curl_error_buffer,
-                   void *body,
-                   guint body_len)
+                   gchar *body,
+                   guint body_len,
+                   const char *etag,
+                   const char *content_md5)
 {
     long response_code = 0;
     regmatch_t pmatch[2];
-    int reg_result;
     char *error_name = NULL, *message = NULL;
     char *body_copy = NULL;
+    gboolean ret = TRUE;
 
     if (!hdl) return FALSE;
 
@@ -517,8 +685,17 @@ interpret_response(S3Handle *hdl,
     curl_easy_getinfo(hdl->curl, CURLINFO_RESPONSE_CODE, &response_code);
     hdl->last_response_code = response_code;
 
-    /* 2xx and 3xx codes won't have a response body*/
+    /* check ETag, if present */
+    if (etag && content_md5 && 200 == response_code) {
+        if (etag && g_strcasecmp(etag, content_md5))
+            hdl->last_message = g_strdup("S3 Error: Possible data corruption (ETag returned by Amazon did not match the MD5 hash of the data sent)");
+        else
+            ret = FALSE;
+        return ret;
+    }
+
     if (200 <= response_code && response_code < 400) {
+        /* 2xx and 3xx codes won't have a response body we care about */
         hdl->last_s3_error_code = S3_ERROR_None;
         return FALSE;
     }
@@ -539,29 +716,11 @@ interpret_response(S3Handle *hdl,
     body_copy = g_strndup(body, body_len);
     if (!body_copy) goto cleanup;
 
-    reg_result = regexec(&error_name_regex, body_copy, 2, pmatch, 0);
-    if (reg_result != 0) {
-        if (reg_result == REG_NOMATCH) {
-            error_name = NULL;
-        } else {
-            regex_error(&error_name_regex, reg_result);
-            g_assert_not_reached();
-        }
-    } else {
+    if (!s3_regexec_wrap(&error_name_regex, body_copy, 2, pmatch, 0))
         error_name = find_regex_substring(body_copy, pmatch[1]);
-    }
 
-    reg_result = regexec(&message_regex, body_copy, 2, pmatch, 0);
-    if (reg_result != 0) {
-        if (reg_result == REG_NOMATCH) {
-            message = NULL;
-        } else {
-            regex_error(&message_regex, reg_result);
-            g_assert_not_reached();
-        }
-    } else {
+    if (!s3_regexec_wrap(&message_regex, body_copy, 2, pmatch, 0))
         message = find_regex_substring(body_copy, pmatch[1]);
-    }
 
     if (error_name) {
         hdl->last_s3_error_code = s3_error_code_from_name(error_name);
@@ -573,19 +732,19 @@ interpret_response(S3Handle *hdl,
     }
 
 cleanup:
-    if (body_copy) g_free(body_copy);
-    if (message) g_free(message);
-    if (error_name) g_free(error_name);
+    g_free(body_copy);
+    g_free(message);
+    g_free(error_name);
 
     return FALSE;
 }
-/* }}} */
 
-/* {{{ perform_request */
-size_t buffer_readfunction(void *ptr, size_t size,
-                           size_t nmemb, void * stream) {
+/* a CURLOPT_READFUNCTION to read data from a buffer. */
+size_t
+s3_buffer_read_func(void *ptr, size_t size, size_t nmemb, void * stream)
+{
     CurlBuffer *data = stream;
-    guint bytes_desired = size * nmemb;
+    guint bytes_desired = (guint) size * nmemb;
 
     /* check the number of bytes remaining, just to be safe */
     if (bytes_desired > data->buffer_len - data->buffer_pos)
@@ -598,10 +757,34 @@ size_t buffer_readfunction(void *ptr, size_t size,
 }
 
 size_t
-buffer_writefunction(void *ptr, size_t size, size_t nmemb, void *stream)
+s3_buffer_size_func(void *stream)
+{
+    CurlBuffer *data = stream;
+    return data->buffer_len;
+}
+
+GByteArray*
+s3_buffer_md5_func(void *stream)
+{
+    CurlBuffer *data = stream;
+    GByteArray req_body_gba = {(guint8 *)data->buffer, data->buffer_len};
+
+    return s3_compute_md5_hash(&req_body_gba);
+}
+
+void
+s3_buffer_reset_func(void *stream)
+{
+    CurlBuffer *data = stream;
+    data->buffer_pos = 0;
+}
+
+/* a CURLOPT_WRITEFUNCTION to write data to a buffer. */
+size_t
+s3_buffer_write_func(void *ptr, size_t size, size_t nmemb, void *stream)
 {
     CurlBuffer * data = stream;
-    guint new_bytes = size * nmemb;
+    guint new_bytes = (guint) size * nmemb;
     guint bytes_needed = data->buffer_pos + new_bytes;
 
     /* error out if the new size is greater than the maximum allowed */
@@ -618,7 +801,8 @@ buffer_writefunction(void *ptr, size_t size, size_t nmemb, void *stream)
         data->buffer = g_realloc(data->buffer, new_size);
         data->buffer_len = new_size;
     }
-    g_return_val_if_fail(data->buffer, 0); /* returning zero signals an error to libcurl */
+    if (!data->buffer)
+        return 0; /* returning zero signals an error to libcurl */
 
     /* actually copy the data to the buffer */
     memcpy(data->buffer + data->buffer_pos, ptr, new_bytes);
@@ -628,44 +812,154 @@ buffer_writefunction(void *ptr, size_t size, size_t nmemb, void *stream)
     return new_bytes;
 }
 
+/* a CURLOPT_READFUNCTION that writes nothing. */
+size_t
+s3_empty_read_func(G_GNUC_UNUSED void *ptr, G_GNUC_UNUSED size_t size, G_GNUC_UNUSED size_t nmemb, G_GNUC_UNUSED void * stream)
+{
+    return 0;
+}
+
+size_t
+s3_empty_size_func(G_GNUC_UNUSED void *stream)
+{
+    return 0;
+}
+
+GByteArray*
+s3_empty_md5_func(G_GNUC_UNUSED void *stream)
+{
+    static const GByteArray empty = {(guint8 *) "", 0};
+
+    return s3_compute_md5_hash(&empty);
+}
+
+/* a CURLOPT_WRITEFUNCTION to write data that just counts data.
+ * s3_write_data should be NULL or a pointer to an gint64.
+ */
+size_t
+s3_counter_write_func(G_GNUC_UNUSED void *ptr, size_t size, size_t nmemb, void *stream)
+{
+    gint64 *count = (gint64*) stream, inc = nmemb*size;
+    
+    if (count) *count += inc;
+    return inc;
+}
+
+void
+s3_counter_reset_func(void *stream)
+{
+    gint64 *count = (gint64*) stream;
+
+    if (count) *count = 0;
+}
+
+#ifdef _WIN32
+/* a CURLOPT_READFUNCTION to read data from a file. */
+size_t
+s3_file_read_func(void *ptr, size_t size, size_t nmemb, void * stream)
+{
+    HANDLE *hFile = (HANDLE *) stream;
+    DWORD bytes_read;
+
+    ReadFile(hFile, ptr, (DWORD) size*nmemb, &bytes_read, NULL);
+    return bytes_read;
+}
+
+size_t
+s3_file_size_func(void *stream)
+{
+    HANDLE *hFile = (HANDLE *) stream;
+    DWORD size = GetFileSize(hFile, NULL);
+
+    if (INVALID_FILE_SIZE == size) {
+        return -1;
+    } else {
+        return size;
+    }
+}
+
+GByteArray*
+s3_file_md5_func(void *stream)
+{
+#define S3_MD5_BUF_SIZE (10*1024)
+    HANDLE *hFile = (HANDLE *) stream;
+    guint8 buf[S3_MD5_BUF_SIZE];
+    DWORD bytes_read;
+    MD5_CTX md5_ctx;
+    GByteArray *ret = NULL;
+
+    g_assert(INVALID_SET_FILE_POINTER != SetFilePointer(hFile, 0, NULL, FILE_BEGIN));
+
+    ret = g_byte_array_sized_new(S3_MD5_HASH_BYTE_LEN);
+    g_byte_array_set_size(ret, S3_MD5_HASH_BYTE_LEN);    
+    MD5_Init(&md5_ctx);
+
+    while (ReadFile(hFile, buf, S3_MD5_BUF_SIZE, &bytes_read, NULL)) {
+        MD5_Update(&md5_ctx, buf, bytes_read);
+    }
+    MD5_Final(ret->data, &md5_ctx);
+
+    g_assert(INVALID_SET_FILE_POINTER != SetFilePointer(hFile, 0, NULL, FILE_BEGIN));
+    return ret;
+#undef S3_MD5_BUF_SIZE
+}
+
+GByteArray*
+s3_file_reset_func(void *stream)
+{
+    g_assert(INVALID_SET_FILE_POINTER != SetFilePointer(hFile, 0, NULL, FILE_BEGIN));
+}
+
+/* a CURLOPT_WRITEFUNCTION to write data to a file. */
+size_t
+s3_file_write_func(void *ptr, size_t size, size_t nmemb, void *stream)
+{
+    HANDLE *hFile = (HANDLE *) stream;
+    DWORD bytes_written;
+
+    WriteFile(hFile, ptr, (DWORD) size*nmemb, &bytes_written, NULL);
+    return bytes_written;
+}
+#endif
+
 static int 
 curl_debug_message(CURL *curl G_GNUC_UNUSED, 
-                  curl_infotype type, 
-                  char *s, 
-                  size_t len, 
-                  void *unused G_GNUC_UNUSED)
+           curl_infotype type, 
+           char *s, 
+           size_t len, 
+           void *unused G_GNUC_UNUSED)
 {
     char *lineprefix;
     char *message;
     char **lines, **line;
 
     switch (type) {
-       case CURLINFO_TEXT:
-           lineprefix="";
-           break;
-
-       case CURLINFO_HEADER_IN:
-           lineprefix="Hdr In: ";
-           break;
-
-       case CURLINFO_HEADER_OUT:
-           lineprefix="Hdr Out: ";
-           break;
-
-       default:
-           /* ignore data in/out -- nobody wants to see that in the
-            * debug logs! */
-           return 0;
+    case CURLINFO_TEXT:
+        lineprefix="";
+        break;
+
+    case CURLINFO_HEADER_IN:
+        lineprefix="Hdr In: ";
+        break;
+
+    case CURLINFO_HEADER_OUT:
+        lineprefix="Hdr Out: ";
+        break;
+
+    default:
+        /* ignore data in/out -- nobody wants to see that in the
+         * debug logs! */
+        return 0;
     }
 
     /* split the input into lines */
-    message = g_strndup(s, len);
+    message = g_strndup(s, (gsize) len);
     lines = g_strsplit(message, "\n", -1);
     g_free(message);
 
     for (line = lines; *line; line++) {
-       if (**line == '\0') continue; /* skip blank lines */
-       g_debug("%s%s", lineprefix, *line);
+    if (**line == '\0') continue; /* skip blank lines */
+    g_debug("%s%s", lineprefix, *line);
     }
     g_strfreev(lines);
 
@@ -674,39 +968,89 @@ curl_debug_message(CURL *curl G_GNUC_UNUSED,
 
 static s3_result_t
 perform_request(S3Handle *hdl,
-                const char *resource,
-                const char *uri,
                 const char *verb,
-                const void *request_body,
-                guint request_body_size,
-                guint max_response_size,
-                guint preallocate_response_size,
+                const char *bucket,
+                const char *key,
+                const char *subresource,
+                const char *query,
+                s3_read_func read_func,
+                s3_reset_func read_reset_func,
+                s3_size_func size_func,
+                s3_md5_func md5_func,
+                gpointer read_data,
+                s3_write_func write_func,
+                s3_reset_func write_reset_func,
+                gpointer write_data,
+                s3_progress_func progress_func,
+                gpointer progress_data,
                 const result_handling_t *result_handling)
 {
-    const char *baseurl;
+    gboolean use_subdomain;
     char *url = NULL;
     s3_result_t result = S3_RESULT_FAIL; /* assume the worst.. */
     CURLcode curl_code = CURLE_OK;
     char curl_error_buffer[CURL_ERROR_SIZE] = "";
     struct curl_slist *headers = NULL;
-    CurlBuffer readdata = { (void*)request_body, request_body_size, 0, 0 };
-    CurlBuffer writedata = { NULL, 0, 0, max_response_size };
+    S3InternalData int_writedata = {{NULL, 0, 0, MAX_ERROR_RESPONSE_LEN}, NULL, NULL, NULL, FALSE, NULL};
     gboolean should_retry;
     guint retries = 0;
     gulong backoff = EXPONENTIAL_BACKOFF_START_USEC;
+    /* corresponds to PUT, HEAD, GET, and POST */
+    int curlopt_upload = 0, curlopt_nobody = 0, curlopt_httpget = 0, curlopt_post = 0;
+    /* do we want to examine the headers */
+    const char *curlopt_customrequest = NULL;
+    /* for MD5 calculation */
+    GByteArray *md5_hash = NULL;
+    gchar *md5_hash_hex = NULL, *md5_hash_b64 = NULL;
+    size_t request_body_size = 0;
 
-    g_return_val_if_fail(hdl != NULL && hdl->curl != NULL, S3_RESULT_FAIL);
+    g_assert(hdl != NULL && hdl->curl != NULL);
 
     s3_reset(hdl);
 
-    baseurl = s3_curl_supports_ssl()? "https://s3.amazonaws.com":"http://s3.amazonaws.com";
-    url = g_strconcat(baseurl, uri, NULL);
+    use_subdomain = hdl->bucket_location? TRUE : FALSE;
+    url = build_url(bucket, key, subresource, query, use_subdomain, hdl->use_ssl);
     if (!url) goto cleanup;
 
-    if (preallocate_response_size) {
-        writedata.buffer = g_malloc(preallocate_response_size);
-        if (!writedata.buffer) goto cleanup;
-        writedata.buffer_len = preallocate_response_size;
+    /* libcurl may behave strangely if these are not set correctly */
+    if (!strncmp(verb, "PUT", 4)) {
+        curlopt_upload = 1;
+    } else if (!strncmp(verb, "GET", 4)) {
+        curlopt_httpget = 1;
+    } else if (!strncmp(verb, "POST", 5)) {
+        curlopt_post = 1;
+    } else if (!strncmp(verb, "HEAD", 5)) {
+        curlopt_nobody = 1;
+    } else {
+        curlopt_customrequest = verb;
+    }
+
+    if (size_func) {
+        request_body_size = size_func(read_data);
+    }
+    if (md5_func) {
+
+        md5_hash = md5_func(read_data);
+        if (md5_hash) {
+            md5_hash_b64 = s3_base64_encode(md5_hash);
+            md5_hash_hex = s3_hex_encode(md5_hash);
+            g_byte_array_free(md5_hash, TRUE);
+        }
+    }
+    if (!read_func) {
+        /* Curl will use fread() otherwise */
+        read_func = s3_empty_read_func;
+    }
+
+    if (write_func) {
+        int_writedata.write_func = write_func;
+        int_writedata.reset_func = write_reset_func;
+        int_writedata.write_data = write_data;
+    } else {
+        /* Curl will use fwrite() otherwise */
+        int_writedata.write_func = s3_counter_write_func;
+        int_writedata.reset_func = s3_counter_reset_func;
+        int_writedata.write_data = NULL;
     }
 
     while (1) {
@@ -714,68 +1058,79 @@ perform_request(S3Handle *hdl,
         if (headers) {
             curl_slist_free_all(headers);
         }
-        readdata.buffer_pos = 0;
-        writedata.buffer_pos = 0;
-       curl_error_buffer[0] = '\0';
+        curl_error_buffer[0] = '\0';
+        if (read_reset_func) {
+            read_reset_func(read_data);
+        }
+        /* calls write_reset_func */
+        s3_internal_reset_func(&int_writedata);
 
         /* set up the request */
-        headers = authenticate_request(hdl, verb, resource);
+        headers = authenticate_request(hdl, verb, bucket, key, subresource,
+            md5_hash_b64, hdl->bucket_location? TRUE : FALSE);
 
         if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_VERBOSE, hdl->verbose)))
             goto curl_error;
-       if (hdl->verbose)
-           if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_DEBUGFUNCTION, 
-                                             curl_debug_message)))
-               goto curl_error;
+        if (hdl->verbose) {
+            if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_DEBUGFUNCTION, 
+                              curl_debug_message)))
+                goto curl_error;
+        }
         if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_ERRORBUFFER,
                                           curl_error_buffer)))
             goto curl_error;
         if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_NOPROGRESS, 1)))
             goto curl_error;
+        if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_FOLLOWLOCATION, 1)))
+            goto curl_error;
         if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_URL, url)))
             goto curl_error;
         if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_HTTPHEADER,
                                           headers)))
             goto curl_error;
-        if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_CUSTOMREQUEST,
-                                          verb)))
+        if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_WRITEFUNCTION, s3_internal_write_func))) 
             goto curl_error;
-        if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_WRITEFUNCTION, buffer_writefunction))) 
+        if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_WRITEDATA, &int_writedata))) 
             goto curl_error;
-        if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_WRITEDATA, &writedata))) 
+        /* Note: we always have to set this apparently, for consistent "end of header" detection */
+        if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_HEADERFUNCTION, s3_internal_header_func))) 
+            goto curl_error;
+        /* Note: if set, CURLOPT_HEADERDATA seems to also be used for CURLOPT_WRITEDATA ? */
+        if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_HEADERDATA, &int_writedata))) 
+            goto curl_error;
+        if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_PROGRESSFUNCTION, progress_func))) 
+            goto curl_error;
+        if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_PROGRESSDATA, progress_data))) 
             goto curl_error;
-        if (max_response_size) {
-#ifdef CURLOPT_MAXFILESIZE_LARGE
-            if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_MAXFILESIZE_LARGE, (curl_off_t)max_response_size))) 
-                goto curl_error;
-#else
-# ifdef CURLOPT_MAXFILESIZE
-            if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_MAXFILESIZE, (long)max_response_size))) 
-                goto curl_error;
-# else
-           /* no MAXFILESIZE option -- that's OK */
-# endif
-#endif
-       }
 
-        if (request_body) {
-            if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_UPLOAD, 1))) 
-                goto curl_error;
 #ifdef CURLOPT_INFILESIZE_LARGE
-           if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t)request_body_size))) 
-                goto curl_error;
+        if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t)request_body_size)))
+            goto curl_error;
 #else
-           if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_INFILESIZE, (long)request_body_size))) 
-                goto curl_error;
+        if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_INFILESIZE, (long)request_body_size)))
+            goto curl_error;
 #endif
-            if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_READFUNCTION, buffer_readfunction))) 
+
+        if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_HTTPGET, curlopt_httpget)))
+            goto curl_error;
+        if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_UPLOAD, curlopt_upload)))
+            goto curl_error;
+        if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_POST, curlopt_post)))
+            goto curl_error;
+        if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_NOBODY, curlopt_nobody)))
+            goto curl_error;
+        if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_CUSTOMREQUEST,
+                                          curlopt_customrequest)))
+            goto curl_error;
+
+
+        if (curlopt_upload) {
+            if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_READFUNCTION, read_func))) 
                 goto curl_error;
-            if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_READDATA, &readdata))) 
+            if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_READDATA, read_data))) 
                 goto curl_error;
         } else {
             /* Clear request_body options. */
-            if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_UPLOAD, 0))) 
-                goto curl_error;
             if ((curl_code = curl_easy_setopt(hdl->curl, CURLOPT_READFUNCTION,
                                               NULL)))
                 goto curl_error;
@@ -791,7 +1146,7 @@ perform_request(S3Handle *hdl,
         /* interpret the response into hdl->last* */
     curl_error: /* (label for short-circuiting the curl_easy_perform call) */
         should_retry = interpret_response(hdl, curl_code, curl_error_buffer, 
-                            writedata.buffer, writedata.buffer_pos);
+            int_writedata.resp_buf.buffer, int_writedata.resp_buf.buffer_pos, int_writedata.etag, md5_hash_hex);
         
         /* and, unless we know we need to retry, see what we're to do now */
         if (!should_retry) {
@@ -825,56 +1180,168 @@ perform_request(S3Handle *hdl,
     }
 
 cleanup:
-    if (url) g_free(url);
+    g_free(url);
     if (headers) curl_slist_free_all(headers);
+    g_free(md5_hash_b64);
+    g_free(md5_hash_hex);
     
     /* we don't deallocate the response body -- we keep it for later */
-    hdl->last_response_body = writedata.buffer;
-    hdl->last_response_body_size = writedata.buffer_pos;
+    hdl->last_response_body = int_writedata.resp_buf.buffer;
+    hdl->last_response_body_size = int_writedata.resp_buf.buffer_pos;
     hdl->last_num_retries = retries;
 
     return result;
 }
-/* }}} */
 
-/*
- * Public function implementations
- */
 
-/* {{{ s3_init */
-gboolean
-s3_init(void)
+static size_t
+s3_internal_write_func(void *ptr, size_t size, size_t nmemb, void * stream)
+{
+    S3InternalData *data = (S3InternalData *) stream;
+    size_t bytes_saved;
+
+    if (!data->headers_done)
+        return size*nmemb;
+
+    bytes_saved = s3_buffer_write_func(ptr, size, nmemb, &data->resp_buf);
+    if (data->write_func) {
+        return data->write_func(ptr, size, nmemb, data->write_data);
+    } else {
+        return bytes_saved;
+    }
+}
+
+static void
+s3_internal_reset_func(void * stream)
+{
+    S3InternalData *data = (S3InternalData *) stream;
+
+    s3_buffer_reset_func(&data->resp_buf);
+    data->headers_done = FALSE;
+    data->etag = NULL;
+    if (data->reset_func) {
+        data->reset_func(data->write_data);
+    }
+}
+
+static size_t
+s3_internal_header_func(void *ptr, size_t size, size_t nmemb, void * stream)
 {
+    static const char *final_header = "\r\n";
+    char *header;
+    regmatch_t pmatch[2];
+    S3InternalData *data = (S3InternalData *) stream;
+
+    header = g_strndup((gchar *) ptr, (gsize) size*nmemb);
+    if (!s3_regexec_wrap(&etag_regex, header, 2, pmatch, 0))
+            data->etag = find_regex_substring(header, pmatch[1]);
+    if (!strcmp(final_header, header))
+        data->headers_done = TRUE;
+
+    return size*nmemb;
+}
+
+static gboolean
+compile_regexes(void)
+{
+#ifdef HAVE_REGEX_H
+
+  /* using POSIX regular expressions */
+  struct {const char * str; int flags; regex_t *regex;} regexes[] = {
+        {"<Code>[[:space:]]*([^<]*)[[:space:]]*</Code>", REG_EXTENDED | REG_ICASE, &error_name_regex},
+        {"^ETag:[[:space:]]*\"([^\"]+)\"[[:space:]]*$", REG_EXTENDED | REG_ICASE | REG_NEWLINE, &etag_regex},
+        {"<Message>[[:space:]]*([^<]*)[[:space:]]*</Message>", REG_EXTENDED | REG_ICASE, &message_regex},
+        {"^[a-z0-9]((-*[a-z0-9])|(\\.[a-z0-9])){2,62}$", REG_EXTENDED | REG_NOSUB, &subdomain_regex},
+        {"(/>)|(>([^<]*)</LocationConstraint>)", REG_EXTENDED | REG_ICASE, &location_con_regex},
+        {NULL, 0, NULL}
+    };
     char regmessage[1024];
-    int size;
+    int size, i;
     int reg_result;
 
-    reg_result = regcomp(&error_name_regex, error_name_regex_string, REG_EXTENDED | REG_ICASE);
-    if (reg_result != 0) {
-        size = regerror(reg_result, &error_name_regex, regmessage, sizeof(regmessage));
-        g_error(_("Regex error: %s"), regmessage);
-        return FALSE;
+    for (i = 0; regexes[i].str; i++) {
+        reg_result = regcomp(regexes[i].regex, regexes[i].str, regexes[i].flags);
+        if (reg_result != 0) {
+            size = regerror(reg_result, regexes[i].regex, regmessage, sizeof(regmessage));
+            g_error(_("Regex error: %s"), regmessage);
+            return FALSE;
+        }
     }
+#else /* ! HAVE_REGEX_H */
+  /* using PCRE via GLib */
+  struct {const char * str; int flags; regex_t *regex;} regexes[] = {
+        {"<Code>\\s*([^<]*)\\s*</Code>",
+         G_REGEX_OPTIMIZE | G_REGEX_CASELESS,
+         &error_name_regex},
+        {"^ETag:\\s*\"([^\"]+)\"\\s*$",
+         G_REGEX_OPTIMIZE | G_REGEX_CASELESS,
+         &etag_regex},
+        {"<Message>\\s*([^<]*)\\s*</Message>",
+         G_REGEX_OPTIMIZE | G_REGEX_CASELESS,
+         &message_regex},
+        {"^[a-z0-9]((-*[a-z0-9])|(\\.[a-z0-9])){2,62}$",
+         G_REGEX_OPTIMIZE | G_REGEX_NO_AUTO_CAPTURE,
+         &subdomain_regex},
+        {"(/>)|(>([^<]*)</LocationConstraint>)",
+         G_REGEX_CASELESS,
+         &location_con_regex},
+        {NULL, 0, NULL}
+  };
+  int i;
+  GError *err = NULL;
+
+  for (i = 0; regexes[i].str; i++) {
+      *(regexes[i].regex) = g_regex_new(regexes[i].str, regexes[i].flags, 0, &err);
+      if (err) {
+          g_error(_("Regex error: %s"), err->message);
+          g_error_free(err);
+          return FALSE;
+      }
+  }
+#endif
+    return TRUE;
+}
 
-    reg_result = regcomp(&message_regex, message_regex_string, REG_EXTENDED | REG_ICASE);
-    if (reg_result != 0) {
-        size = regerror(reg_result, &message_regex, regmessage, sizeof(regmessage));
-        g_error(_("Regex error: %s"), regmessage);
-        return FALSE;
+/*
+ * Public function implementations
+ */
+
+gboolean s3_init(void)
+{
+    static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
+    static gboolean init = FALSE, ret;
+    
+    /* n.b. curl_global_init is called in common-src/glib-util.c:glib_init() */
+
+    g_static_mutex_lock (&mutex);
+    if (!init) {
+        ret = compile_regexes();
+        init = TRUE;
     }
+    g_static_mutex_unlock(&mutex);
+    return ret;
+}
 
-    return TRUE;
+gboolean
+s3_curl_location_compat(void)
+{
+    curl_version_info_data *info;
+
+    info = curl_version_info(CURLVERSION_NOW);
+    return info->version_num > 0x070a02;
+}
+
+gboolean
+s3_bucket_location_compat(const char *bucket)
+{
+    return !s3_regexec_wrap(&subdomain_regex, bucket, 0, NULL, 0);
 }
-/* }}} */
 
-/* {{{ s3_open */
 S3Handle *
 s3_open(const char *access_key,
-        const char *secret_key
-#ifdef WANT_DEVPAY
-        ,
-        const char *user_token
-#endif
+        const char *secret_key,
+        const char *user_token,
+        const char *bucket_location
         ) {
     S3Handle *hdl;
 
@@ -882,17 +1349,17 @@ s3_open(const char *access_key,
     if (!hdl) goto error;
 
     hdl->verbose = FALSE;
+    hdl->use_ssl = s3_curl_supports_ssl();
 
+    g_assert(access_key);
     hdl->access_key = g_strdup(access_key);
-    if (!hdl->access_key) goto error;
-
+    g_assert(secret_key);
     hdl->secret_key = g_strdup(secret_key);
-    if (!hdl->secret_key) goto error;
-
-#ifdef WANT_DEVPAY
+    /* NULL is okay */
     hdl->user_token = g_strdup(user_token);
-    if (!hdl->user_token) goto error;
-#endif
+
+    /* NULL is okay */
+    hdl->bucket_location = g_strdup(bucket_location);
 
     hdl->curl = curl_easy_init();
     if (!hdl->curl) goto error;
@@ -903,28 +1370,23 @@ error:
     s3_free(hdl);
     return NULL;
 }
-/* }}} */
 
-/* {{{ s3_free */
 void
 s3_free(S3Handle *hdl)
 {
     s3_reset(hdl);
 
     if (hdl) {
-        if (hdl->access_key) g_free(hdl->access_key);
-        if (hdl->secret_key) g_free(hdl->secret_key);
-#ifdef WANT_DEVPAY
+        g_free(hdl->access_key);
+        g_free(hdl->secret_key);
         if (hdl->user_token) g_free(hdl->user_token);
-#endif
+        if (hdl->bucket_location) g_free(hdl->bucket_location);
         if (hdl->curl) curl_easy_cleanup(hdl->curl);
 
         g_free(hdl);
     }
 }
-/* }}} */
 
-/* {{{ s3_reset */
 void
 s3_reset(S3Handle *hdl)
 {
@@ -950,9 +1412,7 @@ s3_reset(S3Handle *hdl)
         hdl->last_response_body_size = 0;
     }
 }
-/* }}} */
 
-/* {{{ s3_error */
 void
 s3_error(S3Handle *hdl,
          const char **message,
@@ -979,17 +1439,25 @@ s3_error(S3Handle *hdl,
         if (num_retries) *num_retries = 0;
     }
 }
-/* }}} */
 
-/* {{{ s3_verbose */
 void
 s3_verbose(S3Handle *hdl, gboolean verbose)
 {
     hdl->verbose = verbose;
 }
-/* }}} */
 
-/* {{{ s3_sterror */
+gboolean
+s3_use_ssl(S3Handle *hdl, gboolean use_ssl)
+{
+    gboolean ret = TRUE;
+    if (use_ssl & !s3_curl_supports_ssl()) {
+        ret = FALSE;
+    } else {
+        hdl->use_ssl = use_ssl;
+    }
+    return ret;
+}
+
 char *
 s3_strerror(S3Handle *hdl)
 {
@@ -1019,13 +1487,12 @@ s3_strerror(S3Handle *hdl)
 
     return g_strdup_printf("%s%s%s%s%s", message, s3_info, curl_info, response_info, retries_info);
 }
-/* }}} */
 
-/* {{{ s3_upload */
 /* Perform an upload. When this function returns, KEY and
  * BUFFER remain the responsibility of the caller.
  *
  * @param self: the s3 device
+ * @param bucket: the bucket to which the upload should be made
  * @param key: the key to which the upload should be made
  * @param buffer: the data to be uploaded
  * @param buffer_len: the length of the data to upload
@@ -1035,10 +1502,14 @@ gboolean
 s3_upload(S3Handle *hdl,
           const char *bucket,
           const char *key, 
-          gpointer buffer,
-          guint buffer_len)
+          s3_read_func read_func,
+          s3_reset_func reset_func,
+          s3_size_func size_func,
+          s3_md5_func md5_func,
+          gpointer read_data,
+          s3_progress_func progress_func,
+          gpointer progress_data)
 {
-    char *resource = NULL;
     s3_result_t result = S3_RESULT_FAIL;
     static result_handling_t result_handling[] = {
         { 200,  0,          0,                   S3_RESULT_OK },
@@ -1046,21 +1517,16 @@ s3_upload(S3Handle *hdl,
         { 0, 0,    0,                /* default: */ S3_RESULT_FAIL }
         };
 
-    g_return_val_if_fail(hdl != NULL, FALSE);
+    g_assert(hdl != NULL);
 
-    resource = build_resource(bucket, key);
-    if (resource) {
-        result = perform_request(hdl, resource, resource, "PUT",
-                                 buffer, buffer_len, MAX_ERROR_RESPONSE_LEN, 0,
-                                 result_handling);
-        g_free(resource);
-    }
+    result = perform_request(hdl, "PUT", bucket, key, NULL, NULL,
+                 read_func, reset_func, size_func, md5_func, read_data,
+                 NULL, NULL, NULL, progress_func, progress_data,
+                 result_handling);
 
     return result == S3_RESULT_OK;
 }
-/* }}} */
 
-/* {{{ s3_list_keys */
 
 /* Private structure for our "thunk", which tracks where the user is in the list
  * of keys. */
@@ -1092,17 +1558,17 @@ list_start_element(GMarkupParseContext *context G_GNUC_UNUSED,
     struct list_keys_thunk *thunk = (struct list_keys_thunk *)user_data;
 
     thunk->want_text = 0;
-    if (strcasecmp(element_name, "contents") == 0) {
+    if (g_strcasecmp(element_name, "contents") == 0) {
         thunk->in_contents = 1;
-    } else if (strcasecmp(element_name, "commonprefixes") == 0) {
+    } else if (g_strcasecmp(element_name, "commonprefixes") == 0) {
         thunk->in_common_prefixes = 1;
-    } else if (strcasecmp(element_name, "prefix") == 0 && thunk->in_common_prefixes) {
+    } else if (g_strcasecmp(element_name, "prefix") == 0 && thunk->in_common_prefixes) {
         thunk->want_text = 1;
-    } else if (strcasecmp(element_name, "key") == 0 && thunk->in_contents) {
+    } else if (g_strcasecmp(element_name, "key") == 0 && thunk->in_contents) {
         thunk->want_text = 1;
-    } else if (strcasecmp(element_name, "istruncated")) {
+    } else if (g_strcasecmp(element_name, "istruncated")) {
         thunk->want_text = 1;
-    } else if (strcasecmp(element_name, "nextmarker")) {
+    } else if (g_strcasecmp(element_name, "nextmarker")) {
         thunk->want_text = 1;
     }
 }
@@ -1115,20 +1581,20 @@ list_end_element(GMarkupParseContext *context G_GNUC_UNUSED,
 {
     struct list_keys_thunk *thunk = (struct list_keys_thunk *)user_data;
 
-    if (strcasecmp(element_name, "contents") == 0) {
+    if (g_strcasecmp(element_name, "contents") == 0) {
         thunk->in_contents = 0;
-    } else if (strcasecmp(element_name, "commonprefixes") == 0) {
+    } else if (g_strcasecmp(element_name, "commonprefixes") == 0) {
         thunk->in_common_prefixes = 0;
-    } else if (strcasecmp(element_name, "key") == 0 && thunk->in_contents) {
+    } else if (g_strcasecmp(element_name, "key") == 0 && thunk->in_contents) {
         thunk->filename_list = g_slist_prepend(thunk->filename_list, thunk->text);
         thunk->text = NULL;
-    } else if (strcasecmp(element_name, "prefix") == 0 && thunk->in_common_prefixes) {
+    } else if (g_strcasecmp(element_name, "prefix") == 0 && thunk->in_common_prefixes) {
         thunk->filename_list = g_slist_prepend(thunk->filename_list, thunk->text);
         thunk->text = NULL;
-    } else if (strcasecmp(element_name, "istruncated") == 0) {
-        if (thunk->text && strncasecmp(thunk->text, "false", 5) != 0)
+    } else if (g_strcasecmp(element_name, "istruncated") == 0) {
+        if (thunk->text && g_strncasecmp(thunk->text, "false", 5) != 0)
             thunk->is_truncated = TRUE;
-    } else if (strcasecmp(element_name, "nextmarker") == 0) {
+    } else if (g_strcasecmp(element_name, "nextmarker") == 0) {
         if (thunk->next_marker) g_free(thunk->next_marker);
         thunk->next_marker = thunk->text;
         thunk->text = NULL;
@@ -1150,78 +1616,55 @@ list_text(GMarkupParseContext *context G_GNUC_UNUSED,
     }
 }
 
-/* Helper function for list_fetch */
-static gboolean
-list_build_url_component(char **rv,
-                         const char *delim,
-                         const char *key,
-                         const char *value)
-{
-    char *esc_value = NULL;
-    char *new_rv = NULL;
-
-    esc_value = curl_escape(value, 0);
-    if (!esc_value) goto cleanup;
-
-    new_rv = g_strconcat(*rv, delim, key, "=", esc_value, NULL);
-    if (!new_rv) goto cleanup;
-
-    g_free(*rv);
-    *rv = new_rv;
-    curl_free(esc_value);
-
-    return TRUE;
-
-cleanup:
-    if (new_rv) g_free(new_rv);
-    if (esc_value) curl_free(esc_value);
-
-    return FALSE;
-}
-
 /* Perform a fetch from S3; several fetches may be involved in a
  * single listing operation */
 static s3_result_t
 list_fetch(S3Handle *hdl,
-           const char *resource,
+           const char *bucket,
            const char *prefix, 
            const char *delimiter, 
            const char *marker,
            const char *max_keys)
 {
-    char *urldelim = "?";
-    char *uri = g_strdup(resource);
-    s3_result_t result = S3_RESULT_FAIL;
+    s3_result_t result = S3_RESULT_FAIL;    
     static result_handling_t result_handling[] = {
         { 200,  0,          0,                   S3_RESULT_OK },
         RESULT_HANDLING_ALWAYS_RETRY,
         { 0, 0,    0,                /* default: */ S3_RESULT_FAIL  }
         };
-
-    /* build the URI */
-    if (prefix) {
-        if (!list_build_url_component(&uri, urldelim, "prefix", prefix)) goto cleanup;
-        urldelim = "&";
-    }
-    if (delimiter) {
-        if (!list_build_url_component(&uri, urldelim, "delimiter", delimiter)) goto cleanup;
-        urldelim = "&";
-    }
-    if (marker) {
-        if (!list_build_url_component(&uri, urldelim, "marker", marker)) goto cleanup;
-        urldelim = "&";
-    }
-    if (max_keys) {
-        if (!list_build_url_component(&uri, urldelim, "max-keys", max_keys)) goto cleanup;
-        urldelim = "&";
+   const char* pos_parts[][2] = {
+        {"prefix", prefix},
+        {"delimiter", delimiter},
+        {"marker", marker},
+        {"make-keys", max_keys},
+        {NULL, NULL}
+        };
+    char *esc_value;
+    GString *query;
+    guint i;
+    gboolean have_prev_part = FALSE;
+
+    /* loop over possible parts to build query string */
+    query = g_string_new("");
+    for (i = 0; pos_parts[i][0]; i++) {
+      if (pos_parts[i][1]) {
+          if (have_prev_part)
+              g_string_append(query, "&");
+          else
+              have_prev_part = TRUE;
+          esc_value = curl_escape(pos_parts[i][1], 0);
+          g_string_append_printf(query, "%s=%s", pos_parts[i][0], esc_value);
+          curl_free(esc_value);
+      }
     }
 
     /* and perform the request on that URI */
-    result = perform_request(hdl, resource, uri, "GET", NULL,
-                             0, MAX_ERROR_RESPONSE_LEN, 0, result_handling);
+    result = perform_request(hdl, "GET", bucket, NULL, NULL, query->str,
+                             NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+                             result_handling);
+
+    if (query) g_string_free(query, TRUE);
 
-cleanup:
-    if (uri) g_free(uri);
     return result;
 }
 
@@ -1232,7 +1675,6 @@ s3_list_keys(S3Handle *hdl,
               const char *delimiter,
               GSList **list)
 {
-    char *resource = NULL;
     struct list_keys_thunk thunk;
     GMarkupParseContext *ctxt = NULL;
     static GMarkupParser parser = { list_start_element, list_end_element, list_text, NULL, NULL };
@@ -1245,13 +1687,10 @@ s3_list_keys(S3Handle *hdl,
     thunk.text = NULL;
     thunk.next_marker = NULL;
 
-    resource = build_resource(bucket, NULL);
-    if (!resource) goto cleanup;
-
     /* Loop until S3 has given us the entire picture */
     do {
         /* get some data from S3 */
-        result = list_fetch(hdl, resource, prefix, delimiter, thunk.next_marker, NULL);
+        result = list_fetch(hdl, bucket, prefix, delimiter, thunk.next_marker, NULL);
         if (result != S3_RESULT_OK) goto cleanup;
 
         /* run the parser over it */
@@ -1285,7 +1724,6 @@ cleanup:
     if (err) g_error_free(err);
     if (thunk.text) g_free(thunk.text);
     if (thunk.next_marker) g_free(thunk.next_marker);
-    if (resource) g_free(resource);
     if (ctxt) g_markup_parse_context_free(ctxt);
 
     if (result != S3_RESULT_OK) {
@@ -1296,18 +1734,17 @@ cleanup:
         return TRUE;
     }
 }
-/* }}} */
 
-/* {{{ s3_read */
 gboolean
 s3_read(S3Handle *hdl,
         const char *bucket,
         const char *key,
-        gpointer *buf_ptr,
-        guint *buf_size,
-        guint max_size)
+        s3_write_func write_func,
+        s3_reset_func reset_func,
+        gpointer write_data,
+        s3_progress_func progress_func,
+        gpointer progress_data)
 {
-    char *resource = NULL;
     s3_result_t result = S3_RESULT_FAIL;
     static result_handling_t result_handling[] = {
         { 200,  0,          0,                   S3_RESULT_OK },
@@ -1315,41 +1752,21 @@ s3_read(S3Handle *hdl,
         { 0, 0,    0,                /* default: */ S3_RESULT_FAIL  }
         };
 
-    g_return_val_if_fail(hdl != NULL, FALSE);
-    g_assert(buf_ptr != NULL);
-    g_assert(buf_size != NULL);
-
-    *buf_ptr = NULL;
-    *buf_size = 0;
+    g_assert(hdl != NULL);
+    g_assert(write_func != NULL);
 
-    resource = build_resource(bucket, key);
-    if (resource) {
-        result = perform_request(hdl, resource, resource,
-                                 "GET", NULL, 0, max_size, 0, result_handling);
-        g_free(resource);
-
-        /* copy the pointer to the result parameters and remove
-         * our reference to it */
-        if (result == S3_RESULT_OK) {
-            *buf_ptr = hdl->last_response_body;
-            *buf_size = hdl->last_response_body_size;
-            
-            hdl->last_response_body = NULL;
-            hdl->last_response_body_size = 0;
-        }
-    }        
+    result = perform_request(hdl, "GET", bucket, key, NULL, NULL,
+        NULL, NULL, NULL, NULL, NULL, write_func, reset_func, write_data,
+        progress_func, progress_data, result_handling);
 
     return result == S3_RESULT_OK;
 }
-/* }}} */
 
-/* {{{ s3_delete */
 gboolean
 s3_delete(S3Handle *hdl,
           const char *bucket,
           const char *key)
 {
-    char *resource = NULL;
     s3_result_t result = S3_RESULT_FAIL;
     static result_handling_t result_handling[] = {
         { 204,  0,          0,                   S3_RESULT_OK },
@@ -1357,41 +1774,106 @@ s3_delete(S3Handle *hdl,
         { 0, 0,    0,                /* default: */ S3_RESULT_FAIL  }
         };
 
-    g_return_val_if_fail(hdl != NULL, FALSE);
+    g_assert(hdl != NULL);
 
-    resource = build_resource(bucket, key);
-    if (resource) {
-        result = perform_request(hdl, resource, resource, "DELETE", NULL, 0,
-                                 MAX_ERROR_RESPONSE_LEN, 0, result_handling);
-        g_free(resource);
-    }
+    result = perform_request(hdl, "DELETE", bucket, key, NULL, NULL,
+                 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+                 result_handling);
 
     return result == S3_RESULT_OK;
 }
-/* }}} */
 
-/* {{{ s3_make_bucket */
 gboolean
 s3_make_bucket(S3Handle *hdl,
                const char *bucket)
 {
-    char *resource = NULL;
-    s3_result_t result = result = S3_RESULT_FAIL;
+    char *body = NULL;
+    s3_result_t result = S3_RESULT_FAIL;
     static result_handling_t result_handling[] = {
         { 200,  0,          0,                   S3_RESULT_OK },
         RESULT_HANDLING_ALWAYS_RETRY,
         { 0, 0,    0,                /* default: */ S3_RESULT_FAIL  }
         };
+    regmatch_t pmatch[4];
+    char *loc_end_open, *loc_content;
+    CurlBuffer buf = {NULL, 0, 0, 0}, *ptr = NULL;
+    s3_read_func read_func = NULL;
+    s3_reset_func reset_func = NULL;
+    s3_md5_func md5_func = NULL;
+    s3_size_func size_func = NULL;
+
+    g_assert(hdl != NULL);
+    
+    if (hdl->bucket_location) {
+        if (s3_bucket_location_compat(bucket)) {
+            ptr = &buf;
+            buf.buffer = g_strdup_printf(AMAZON_BUCKET_CONF_TEMPLATE, hdl->bucket_location);
+            buf.buffer_len = (guint) strlen(body);
+            buf.buffer_pos = 0;
+            buf.max_buffer_size = buf.buffer_len;
+            read_func = s3_buffer_read_func;
+            reset_func = s3_buffer_reset_func;
+            size_func = s3_buffer_size_func;
+            md5_func = s3_buffer_md5_func;
+        } else {
+            hdl->last_message = g_strdup_printf(_(
+                "Location constraint given for Amazon S3 bucket, "
+                "but the bucket name (%s) is not usable as a subdomain."), bucket);
+            return FALSE;
+        }
+    }
 
-    g_return_val_if_fail(hdl != NULL, FALSE);
+    result = perform_request(hdl, "PUT", bucket, NULL, NULL, NULL,
+                 read_func, reset_func, size_func, md5_func, ptr,
+                 NULL, NULL, NULL, NULL, NULL, result_handling);
+
+   if (result == S3_RESULT_OK ||
+        (hdl->bucket_location && result != S3_RESULT_OK 
+         && hdl->last_s3_error_code == S3_ERROR_BucketAlreadyOwnedByYou)) {
+        /* verify the that the location constraint on the existing bucket matches
+         * the one that's configured.
+         */
+        result = perform_request(hdl, "GET", bucket, NULL, "location", NULL,
+                                 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+                                 NULL, NULL, result_handling);
+
+        /* note that we can check only one of the three AND conditions above 
+         * and infer that the others are true
+         */
+        if (result == S3_RESULT_OK && hdl->bucket_location) {
+            /* return to the default state of failure */
+            result = S3_RESULT_FAIL;
 
-    resource = build_resource(bucket, NULL);
-    if (resource) {
-        result = perform_request(hdl, resource, resource, "PUT", NULL, 0, 
-                                 MAX_ERROR_RESPONSE_LEN, 0, result_handling);
-        g_free(resource);
+            if (body) g_free(body);
+            /* use strndup to get a null-terminated string */
+            body = g_strndup(hdl->last_response_body, hdl->last_response_body_size);
+            if (!body) goto cleanup;
+            
+            if (!s3_regexec_wrap(&location_con_regex, body, 4, pmatch, 0)) {
+                loc_end_open = find_regex_substring(body, pmatch[1]);
+                loc_content = find_regex_substring(body, pmatch[3]);
+
+                /* The case of an empty string is special because XML allows
+                 * "self-closing" tags
+                 */
+                if ('\0' == hdl->bucket_location[0] &&
+                    '/' != loc_end_open[0] && '\0' != hdl->bucket_location[0])
+                    hdl->last_message = _("An empty location constraint is "
+                        "configured, but the bucket has a non-empty location constraint");
+                else if (strncmp(loc_content, hdl->bucket_location, strlen(hdl->bucket_location)))
+                    hdl->last_message = _("The location constraint configured "
+                        "does not match the constraint currently on the bucket");
+                else
+                    result = S3_RESULT_OK;
+      } else {
+              hdl->last_message = _("Unexpected location response from Amazon S3");
+          }
+      }
     }
 
+cleanup:
+    if (body) g_free(body);
+    
     return result == S3_RESULT_OK;
+
 }
-/* }}} */
index 086b6f0bb34615e9cd07c9c36a16600c8a59da54..b3d3b39ba880a3435c2414d1a0c4b67572df55fa 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+ * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
  * 
  * This library is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License version 2.1 as 
@@ -14,8 +14,8 @@
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  * 
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 #ifndef __S3_H__
  * in different threads simultaneously. */
 typedef struct S3Handle S3Handle;
 
+/* Callback function to read data to upload
+ * 
+ * @note this is the same as CURLOPT_READFUNCTION
+ *
+ * @param data: The pointer to write data to
+ * @param size: The size of each "element" of the data buffer in bytes
+ * @param nmemb: The number of elements in the data buffer.
+ * So, the buffer's size is size*nmemb bytes.
+ * @param stream: The read_data (an opaque pointer)
+ *
+ * @return The number of bytes written to the buffer,
+ * CURL_READFUNC_PAUSE to pause, or CURL_READFUNC_ABORT to abort.
+ * Return 0 only if there's no more data to be uploaded.
+ */
+typedef size_t (*s3_read_func)(void *data, size_t size, size_t nmemb, void *stream);
+
+/* This function is called to get size of the upload data
+ *
+ * @param data: The write_data (opaque pointer)
+ *
+ * @return The number of bytes of data, negative for error
+ */
+typedef size_t (*s3_size_func)(void *data);
+
+/* This function is called to get MD5 hash of the upload data
+ *
+ * @param data: The write_data (opaque pointer)
+ *
+ * @return The MD5 hash, NULL on error
+ */
+typedef GByteArray* (*s3_md5_func)(void *data);
+
+/* This function is called to reset an upload or download data stream
+ * to the beginning
+ *
+ * @param data: The read_data or write_data (opaque pointer)
+ *
+ * @return The number of bytes of data, negative for error
+ */
+typedef void (*s3_reset_func)(void *data);
+
+/* Callback function to write data that's been downloaded
+ * 
+ * @note this is the same as CURLOPT_WRITEFUNCTION
+ *
+ * @param data: The pointer to read data from
+ * @param size: The size of each "element" of the data buffer in bytes
+ * @param nmemb: The number of elements in the data buffer.
+ * So, the buffer's size is size*nmemb bytes.
+ * @param stream: the write_data (an opaque pointer)
+ *
+ * @return The number of bytes written to the buffer or
+ * CURL_WRITEFUNC_PAUSE to pause.
+ * If it's the number of bytes written, it should match the buffer size
+ */
+typedef size_t (*s3_write_func)(void *data, size_t size, size_t nmemb, void *stream);
+
+/**
+ * Callback function to track progress
+ *
+ * @note this is the same as CURLOPT_PROGRESSFUNCTION
+ *
+ * @param data: The progress_data
+ * @param dltotal: The total number of bytes to downloaded
+ * @param dlnow: The current number of bytes downloaded
+ * @param ultotal: The total number of bytes to downloaded
+ * @param ulnow: The current number of bytes downloaded
+ *
+ * @return 0 to continue, non-zero to abort.
+ */
+typedef curl_progress_callback s3_progress_func;
+
 /*
  * Constants
  */
 
-#ifdef WANT_DEVPAY
 /* These are assumed to be already URL-escaped. */
-# define STS_BASE_URL "https://sts.amazonaws.com/"
+# define STS_BASE_URL "https://ls.amazonaws.com/"
 # define STS_PRODUCT_TOKEN "{ProductToken}AAAGQXBwVGtu4geoGybuwuk8VEEPzJ9ZANpu0yzbf9g4Gs5Iarzff9B7qaDBEEaWcAzWpcN7zmdMO765jOtEFc4DWTRNkpPSzUnTdkHbdYUamath73OreaZtB86jy/JF0gsHZfhxeKc/3aLr8HNT//DsX3r272zYHLDPWWUbFguOwqNjllnt6BshYREx59l8RrWABLSa37dyJeN+faGvz3uQxiDakZRn3LfInOE6d9+fTFl50LPoP08LCqI/SJfpouzWix7D/cep3Jq8yYNyM1rgAOTF7/wh7r8OuPDLJ/xZUDLfykePIAM="
-#endif
 
 /* This preprocessor magic will enumerate constants named S3_ERROR_XxxYyy for
  * each of the errors in parentheses.
@@ -56,6 +126,7 @@ typedef struct S3Handle S3Handle;
     S3_ERROR(OperationAborted), \
     S3_ERROR(BadDigest), \
     S3_ERROR(BucketAlreadyExists), \
+    S3_ERROR(BucketAlreadyOwnedByYou), \
     S3_ERROR(BucketNotEmpty), \
     S3_ERROR(CredentialsNotSupported), \
     S3_ERROR(EntityTooLarge), \
@@ -106,10 +177,37 @@ typedef enum {
  * Functions
  */
 
-/* Initialize S3 operation
+/* Does this install of curl support SSL?
+ *
+ * @returns: boolean
+ */
+gboolean
+s3_curl_supports_ssl(void);
+
+/* Checks if the version of libcurl being used supports and checks
+ * wildcard certificates correctly (used for the subdomains required
+ * by location constraints).
+ *
+ * @returns: true if the version of libcurl is new enough
+ */
+gboolean
+s3_curl_location_compat(void);
+
+/* Checks if a bucket name is compatible with setting a location
+ * constraint.
  *
- * As a requirement of C{curl_global_init}, which this function calls,
- * s3_init I{must} be called before any other threads are started.
+ * @note This doesn't guarantee that bucket name is entirely valid,
+ * just that using it as one (or more) subdomain(s) of s3.amazonaws.com
+ * won't fail; that would prevent the reporting of useful messages from 
+ * the service.
+ *
+ * @param bucket: the bucket name
+ * @returns: true if the bucket name is compatible
+ */
+gboolean
+s3_bucket_location_compat(const char *bucket);
+
+/* Initialize S3 operation
  *
  * If an error occurs in this function, diagnostic information is 
  * printed to stderr.
@@ -120,13 +218,19 @@ gboolean
 s3_init(void);
 
 /* Set up an S3Handle.
+ *
+ * The concept of a bucket is defined by the Amazon S3 API.
+ * See: "Components of Amazon S3" - API Version 2006-03-01 pg. 8
+ *
+ * @param access_key: the secret key for Amazon Web Services
+ * @param secret_key: the secret key for Amazon Web Services
+ * @param user_token: the user token for Amazon DevPay
+ * @param bucket_location: the location constraint for buckets
+ * @returns: the new S3Handle
  */
 S3Handle *
-s3_open(const char * access_key, const char *secret_key
-#ifdef WANT_DEVPAY
-        , const char * user_token
-#endif
-        );
+s3_open(const char * access_key, const char *secret_key, const char * user_token, 
+        const char * bucket_location);
 
 /* Deallocate an S3Handle
  *
@@ -178,7 +282,16 @@ s3_error(S3Handle *hdl,
  */
 void
 s3_verbose(S3Handle *hdl,
-          gboolean verbose);
+       gboolean verbose);
+
+/* Control the use of SSL with HTTP transactions.
+ *
+ * @param hdl: the S3Handle object
+ * @param use_ssl: if true, use SSL (if curl supports it)
+ * @returns: true if the setting is valid
+ */
+gboolean
+s3_use_ssl(S3Handle *hdl, gboolean use_ssl);
 
 /* Get the error information from the last operation on this handle,
  * formatted as a string.
@@ -199,16 +312,27 @@ s3_strerror(S3Handle *hdl);
  * @param hdl: the S3Handle object
  * @param bucket: the bucket to which the upload should be made
  * @param key: the key to which the upload should be made
- * @param buffer: the data to be uploaded
- * @param buffer_len: the length of the data to upload
+ * @param read_func: the callback for reading data
+ * @param reset_func: the callback for to reset reading data
+ * @param size_func: the callback to get the number of bytes to upload
+ * @param md5_func: the callback to get the MD5 hash of the data to upload
+ * @param read_data: pointer to pass to the above functions
+ * @param progress_func: the callback for progress information
+ * @param progress_data: pointer to pass to C{progress_func}
+ *
  * @returns: false if an error ocurred
  */
 gboolean
 s3_upload(S3Handle *hdl,
           const char *bucket,
           const char *key, 
-          gpointer buffer,
-          guint buffer_len);
+          s3_read_func read_func,
+          s3_reset_func reset_func,
+          s3_size_func size_func,
+          s3_md5_func md5_func,
+          gpointer read_data,
+          s3_progress_func progress_func,
+          gpointer progress_data);
 
 /* List all of the files matching the pseudo-glob C{PREFIX*DELIMITER*}, 
  * returning only that portion which matches C{PREFIX*DELIMITER}.  S3 supports
@@ -229,26 +353,28 @@ s3_list_keys(S3Handle *hdl,
               const char *delimiter,
               GSList **list);
 
-/* Read an entire file.  The buffer returned is the responsibility of the caller.  A
- * buffer is only returned if no error occurred, and will be NULL otherwise.
+/* Read an entire file, passing the contents to write_func buffer
+ * by buffer.
  *
  * @param hdl: the S3Handle object
  * @param bucket: the bucket to read from
  * @param key: the key to read from
- * @param buf_ptr: (result) a pointer to a C{gpointer} which will contain a pointer to
- * the block read
- * @param buf_size: (result) a pointer to a C{guint} which will contain the size of the
- * block read
- * @param max_size: maximum size of the file
+ * @param write_func: the callback for writing data
+ * @param reset_func: the callback for to reset writing data
+ * @param write_data: pointer to pass to C{write_func}
+ * @param progress_func: the callback for progress information
+ * @param progress_data: pointer to pass to C{progress_func}
  * @returns: FALSE if an error occurs
  */
 gboolean
 s3_read(S3Handle *hdl,
         const char *bucket,
         const char *key,
-        gpointer *buf_ptr,
-        guint *buf_size,
-        guint max_size);
+        s3_write_func write_func,
+        s3_reset_func reset_func,
+        gpointer write_data,
+        s3_progress_func progress_func,
+        gpointer progress_data);
 
 /* Delete a file.
  *
@@ -286,13 +412,68 @@ typedef struct {
     guint max_buffer_size;
 } CurlBuffer;
 
+#define S3_BUFFER_READ_FUNCS s3_buffer_read_func, s3_buffer_reset_func, s3_buffer_size_func, s3_buffer_md5_func
+
+#define S3_BUFFER_WRITE_FUNCS s3_buffer_write_func, s3_buffer_reset_func
+
 /* a CURLOPT_READFUNCTION to read data from a buffer. */
-size_t buffer_readfunction(void *ptr, size_t size,
-                           size_t nmemb, void * stream);
+size_t
+s3_buffer_read_func(void *ptr, size_t size, size_t nmemb, void * stream);
+
+size_t
+s3_buffer_size_func(void *stream);
+
+GByteArray*
+s3_buffer_md5_func(void *stream);
+
+void
+s3_buffer_reset_func(void *stream);
+
+#define S3_EMPTY_READ_FUNCS s3_empty_read_func, NULL, s3_empty_size_func, s3_empty_md5_func
 
 /* a CURLOPT_WRITEFUNCTION to write data to a buffer. */
 size_t
-buffer_writefunction(void *ptr, size_t size, size_t nmemb, void *stream);
+s3_buffer_write_func(void *ptr, size_t size, size_t nmemb, void *stream);
+
+/* a CURLOPT_READFUNCTION that writes nothing. */
+size_t
+s3_empty_read_func(void *ptr, size_t size, size_t nmemb, void * stream);
+
+size_t
+s3_empty_size_func(void *stream);
+
+GByteArray*
+s3_empty_md5_func(void *stream);
+
+#define S3_COUNTER_WRITE_FUNCS s3_counter_write_func, s3_counter_reset_func
+
+/* a CURLOPT_WRITEFUNCTION to write data that just counts data.
+ * s3_write_data should be NULL or a pointer to an gint64.
+ */
+size_t
+s3_counter_write_func(void *ptr, size_t size, size_t nmemb, void *stream);
+
+void
+s3_counter_reset_func(void *stream);
+
+#ifdef _WIN32
+/* a CURLOPT_READFUNCTION to read data from a file. */
+size_t
+s3_file_read_func(void *ptr, size_t size, size_t nmemb, void * stream);
+
+size_t
+s3_file_size_func(void *stream);
+
+GByteArray*
+s3_file_md5_func(void *stream);
+
+size_t
+s3_file_reset_func(void *stream);
+
+/* a CURLOPT_WRITEFUNCTION to write data to a file. */
+size_t
+s3_file_write_func(void *ptr, size_t size, size_t nmemb, void *stream);
+#endif
 
 /* Adds a null termination to a buffer. */
 void terminate_buffer(CurlBuffer *);
diff --git a/device-src/semaphore.c b/device-src/semaphore.c
deleted file mode 100644 (file)
index 20a2a95..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
- * 
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License version 2.1 as 
- * published by the Free Software Foundation.
- * 
- * This 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 this library; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
- * 
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
- */
-
-/* GLib does not provide semaphores, which are useful in queue.c.
-   So, we implement it here. */
-
-#include "semaphore.h"
-#include "amanda.h"
-
-semaphore_t* semaphore_new_with_value(int value) {
-    semaphore_t *rval;
-
-    if (!g_thread_supported())
-        return NULL;
-
-    rval = malloc(sizeof(*rval));
-    rval->value = value;
-    rval->mutex = g_mutex_new();
-    rval->decrement_cond = g_cond_new();
-    rval->zero_cond = g_cond_new();
-    
-    if (rval->mutex == NULL || rval->decrement_cond == NULL ||
-        rval->zero_cond == NULL) {
-        semaphore_free(rval);
-        return NULL;
-    } else {
-        return rval;
-    }
-}
-
-void semaphore_free(semaphore_t* o) {
-    g_mutex_free(o->mutex);
-    g_cond_free(o->decrement_cond);
-    g_cond_free(o->zero_cond);
-    free(o);
-}
-
-/* This function checks if the semaphore would is zero or negative.
- * If so, the zero_cond is signalled. We assume that the mutex is
- * locked. */
-static void check_empty(semaphore_t * o) {
-    if (o->value <= 0) {
-        g_cond_broadcast(o->zero_cond);
-    }
-}
-
-void semaphore_increment(semaphore_t* o, unsigned int inc) {
-    g_return_if_fail(o != NULL);
-    g_return_if_fail(inc != 0);
-
-    semaphore_force_adjust(o, inc);
-}
-
-void semaphore_decrement(semaphore_t* o, unsigned int dec) {
-    int sdec;
-    g_return_if_fail(o != NULL);
-    sdec = (int) dec;
-    g_return_if_fail(sdec >= 0);
-
-    g_mutex_lock(o->mutex);
-    while (o->value < sdec) {
-        g_cond_wait(o->decrement_cond, o->mutex);
-    }
-    o->value -= sdec;
-    check_empty(o);
-    g_mutex_unlock(o->mutex);
-}
-
-void semaphore_force_adjust(semaphore_t* o, int inc) {
-    g_return_if_fail(o != NULL);
-
-    g_mutex_lock(o->mutex);
-    o->value += inc;
-    if (inc < 0)
-       check_empty(o);
-    else
-       g_cond_broadcast(o->decrement_cond);
-    g_mutex_unlock(o->mutex);
-
-}
-
-void semaphore_force_set(semaphore_t* o, int value) {
-    int oldvalue;
-    g_return_if_fail(o != NULL);
-    
-    g_mutex_lock(o->mutex);
-    oldvalue = o->value;
-    o->value = value;
-    if (value < oldvalue)
-       check_empty(o);
-    else
-       g_cond_broadcast(o->decrement_cond);
-    g_mutex_unlock(o->mutex);
-    
-}
-
-void semaphore_wait_empty(semaphore_t * o) {
-    g_return_if_fail(o != NULL);
-    
-    g_mutex_lock(o->mutex);
-    while (o->value > 0) {
-        g_cond_wait(o->zero_cond, o->mutex);
-    }
-    g_mutex_unlock(o->mutex);
-}
diff --git a/device-src/semaphore.h b/device-src/semaphore.h
deleted file mode 100644 (file)
index 17d41fe..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
- * 
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License version 2.1 as 
- * published by the Free Software Foundation.
- * 
- * This 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 this library; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
- * 
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
- */
-
-/* GLib does not provide semaphores, which are useful in queue.c.
-   So, we implement it here. */
-
-#include <glib.h>
-
-#ifndef SEMAPHORE_H
-
-typedef struct {
-    int value;
-    GMutex *mutex;
-    GCond * decrement_cond;
-    GCond * zero_cond;
-} semaphore_t;
-
-/* Create a new semaphore object with the given value.
- *
- * @param value: new value
- * @returns: newly allocated semaphore_t
- */
-semaphore_t* semaphore_new_with_value(int value);
-
-/* Shortcut to make a new semaphore with value 1.
- */
-#define semaphore_new() semaphore_new_with_value(1)
-
-/* Free a semaphore allocated by semaphore_with_new_value().  Be sure the
- * semaphore is no longer in use by any threads.
- *
- * @param sem: the semaphore to free
- */
-void semaphore_free(semaphore_t *sem);
-
-/* Increment the value of the semaphore by incr.  This corresponds to
- * Dijkstra's V(), or the typical semaphore's release().
- *
- * This function will not block, but may wake other threads waiting
- * on semaphore_decrement().
- *
- * @param sem: the semaphore
- * @param incr: added to the semaphore's value
- */
-void semaphore_increment(semaphore_t *sem, unsigned int incr);
-
-/* Shortcut to increment the semaphore by 1.
- */
-#define semaphore_up(semaphore) semphore_increment(semaphore,1)
-
-/* Decrement the value of the semaphore by incr.  If this operation
- * would make the semaphore zero or less, block until the semaphore
- * value is large enough, then perform the decerement operation. Threads
- * waiting on semaphore_wait_empty() may be awakened if the value
- * reaches 0.
- *
- * @param sem: the semaphore
- * @param decr: subtracted from the semaphore's value
- */
-void semaphore_decrement(semaphore_t *sem, unsigned int decr);
-
-/* Shortcut to decrement the semaphore by 1.
- */
-#define semaphore_down(semaphore) semaphore_decrement(semaphore, 1)
-
-/* Increment or decrement (with a negative incr) the value without
- * blocking.  Threads waiting on semaphore_decrement() or
- * semaphore_wait_empty() will be awakened if necessary.
- *
- * @param sem: the semaphore
- * @param incr: added to the semaphore's value
- */
-void semaphore_force_adjust(semaphore_t *sem, int incr);
-
-/* Set the semaphore to a given value without blocking.  Threads
- * waiting on semaphore_decrement() or semaphore_wait_empty()
- * will be awakened if necessary.
- *
- * @param sem: the semaphore
- * @param value: the new value
- */
-void semaphore_force_set(semaphore_t *sem, int value);
-
-/* Block until the semaphore's value is zero.
- *
- * @param sem: the semaphore
- */
-void semaphore_wait_empty(semaphore_t *sem);
-
-#endif /* SEMAPHORE_H */
index a9665a74f5982c4680681b53bb327e5bd8420fbd..cd2e626ed0062ce7d53606e1875a3f8839cb541d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+ * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
  * 
  * This library is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License version 2.1 as 
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  * 
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 #include <amanda.h>
+#include "glib-util.h"
 #include "tape-ops.h"
 
 /* Tape operations for AIX systems. Most of this stuff is based on
@@ -75,7 +76,7 @@ gboolean tape_bsr(int fd, guint count) {
     return 0 == ioctl(fd, STIOCTOP, &st);
 }
 
-gint tape_eod(int fd) {
+gint tape_eod(int fd G_GNUC_UNUSED) {
     g_assert_not_reached();
     return TAPE_OP_ERROR;
 }
@@ -87,55 +88,27 @@ gboolean tape_weof(int fd, guint8 count) {
     return 0 == ioctl(fd, STIOCTOP, &st);
 }
 
-gboolean tape_setcompression(int fd, gboolean on) {
+gboolean tape_setcompression(int fd G_GNUC_UNUSED, gboolean on G_GNUC_UNUSED) {
     return FALSE;
 }
 
-ReadLabelStatusFlags tape_is_tape_device(int fd) {
-    /* AIX doesn't have a no-op. */
-    return READ_LABEL_STATUS_SUCCESS;
+DeviceStatusFlags tape_is_tape_device(int fd G_GNUC_UNUSED) {
+    /* AIX doesn't have a no-op, so we'll just assume this is a tape device */
+    return DEVICE_STATUS_SUCCESS;
 }
 
-TapeCheckResult tape_is_ready(int fd) {
-    return TAPE_CHECK_UNKNOWN;
+DeviceStatusFlags tape_is_ready(int fd G_GNUC_UNUSED, TapeDevice *t_self G_GNUC_UNUSED) {
+    return DEVICE_STATUS_SUCCESS;
 }
 
-void tape_device_discover_capabilities(TapeDevice * t_self) {
-    Device * self;
-    GValue val;
-
-    self = DEVICE(t_self);
-    g_return_if_fail(self != NULL);
-
-    bzero(&val, sizeof(val));
-    g_value_init(&val, FEATURE_SUPPORT_FLAGS_TYPE);
-
-    g_value_set_flags(&val,
-                      FEATURE_STATUS_ENABLED | FEATURE_SURETY_BAD |
-                      FEATURE_SOURCE_DEFAULT);
-    device_property_set(self, PROPERTY_FSF, &val);
-    
-    g_value_set_flags(&val,
-                      FEATURE_STATUS_ENABLED | FEATURE_SURETY_BAD |
-                      FEATURE_SOURCE_DEFAULT);
-    device_property_set(self, PROPERTY_BSF, &val);
-    
-    g_value_set_flags(&val,
-                      FEATURE_STATUS_ENABLED | FEATURE_SURETY_BAD |
-                      FEATURE_SOURCE_DEFAULT);
-    device_property_set(self, PROPERTY_FSR, &val);
-    
-    g_value_set_flags(&val,
-                      FEATURE_STATUS_ENABLED | FEATURE_SURETY_BAD |
-                      FEATURE_SOURCE_DEFAULT);
-    device_property_set(self, PROPERTY_BSR, &val);
-    
-    g_value_set_flags(&val,
-                      FEATURE_STATUS_DISABLED | FEATURE_SURETY_GOOD |
-                      FEATURE_SOURCE_DEFAULT);
-    device_property_set(self, PROPERTY_EOM, &val);
-
-    g_value_unset_init(&val, G_TYPE_UINT);
-    g_value_set_uint(&val, 2);
-    device_property_set(self, PROPERTY_FINAL_FILEMARKS, &val);
+void tape_device_detect_capabilities(TapeDevice * t_self) {
+    tape_device_set_capabilities(t_self,
+       TRUE,  PROPERTY_SURETY_BAD,  PROPERTY_SOURCE_DEFAULT, /* fsf*/
+       TRUE,  PROPERTY_SURETY_BAD,  PROPERTY_SOURCE_DEFAULT, /* bsf*/
+       TRUE,  PROPERTY_SURETY_BAD,  PROPERTY_SOURCE_DEFAULT, /* fsr*/
+       TRUE,  PROPERTY_SURETY_BAD,  PROPERTY_SOURCE_DEFAULT, /* bsr*/
+       FALSE, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DEFAULT, /* eom*/
+       FALSE, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DEFAULT, /* bsf_after_eom*/
+       2,     PROPERTY_SURETY_BAD,  PROPERTY_SOURCE_DEFAULT  /* final_filemarks*/
+       );
 }
index 1274fcd993cfe581ec60a82d8233b12705617dee..f63e35a0fe78f92288acffc38c459a889daf7c01 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+ * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
  * 
  * This library is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License version 2.1 as 
@@ -14,8 +14,8 @@
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  * 
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 #include <string.h> /* memset() */
@@ -34,6 +34,8 @@ struct TapeDevicePrivate_s {
     /* This holds the total number of bytes written to the device,
        modulus RESETOFS_THRESHOLD. */
     int write_count;
+    char * device_filename;
+    gsize read_buffer_size;
 };
 
 /* Possible (abstracted) results from a system I/O operation. */
@@ -49,24 +51,49 @@ typedef enum {
     RESULT_MAX
 } IoResult;
 
+/*
+ * Our device-specific properties.  These are not static because they are
+ * accessed from the OS-specific tape-*.c files.
+ */
+DevicePropertyBase device_property_broken_gmt_online;
+DevicePropertyBase device_property_fsf;
+DevicePropertyBase device_property_bsf;
+DevicePropertyBase device_property_fsr;
+DevicePropertyBase device_property_bsr;
+DevicePropertyBase device_property_eom;
+DevicePropertyBase device_property_bsf_after_eom;
+DevicePropertyBase device_property_final_filemarks;
+
+void tape_device_register(void);
+
+#define tape_device_read_size(self) \
+    (((TapeDevice *)(self))->private->read_buffer_size? \
+       ((TapeDevice *)(self))->private->read_buffer_size : ((Device *)(self))->block_size)
+
 /* here are local prototypes */
 static void tape_device_init (TapeDevice * o);
 static void tape_device_class_init (TapeDeviceClass * c);
-static gboolean tape_device_open_device (Device * self, char * device_name);
-static ReadLabelStatusFlags tape_device_read_label(Device * self);
-static gboolean tape_device_write_block(Device * self, guint size,
-                                        gpointer data, gboolean short_block);
+static void tape_device_base_init (TapeDeviceClass * c);
+static gboolean tape_device_set_feature_property_fn(Device *p_self, DevicePropertyBase *base,
+                                   GValue *val, PropertySurety surety, PropertySource source);
+static gboolean tape_device_set_final_filemarks_fn(Device *p_self, DevicePropertyBase *base,
+                                   GValue *val, PropertySurety surety, PropertySource source);
+static gboolean tape_device_set_compression_fn(Device *p_self, DevicePropertyBase *base,
+                                   GValue *val, PropertySurety surety, PropertySource source);
+static gboolean tape_device_set_read_buffer_size_fn(Device *p_self, DevicePropertyBase *base,
+                                   GValue *val, PropertySurety surety, PropertySource source);
+static void tape_device_open_device (Device * self, char * device_name, char * device_type, char * device_node);
+static Device * tape_device_factory (char * device_name, char * device_type, char * device_node);
+static DeviceStatusFlags tape_device_read_label(Device * self);
+static gboolean tape_device_write_block(Device * self, guint size, gpointer data);
 static int tape_device_read_block(Device * self,  gpointer buf,
                                        int * size_req);
 static gboolean tape_device_start (Device * self, DeviceAccessMode mode,
                                    char * label, char * timestamp);
-static gboolean tape_device_start_file (Device * self, const dumpfile_t * ji);
+static gboolean tape_device_start_file (Device * self, dumpfile_t * ji);
+static gboolean tape_device_finish_file (Device * self);
 static dumpfile_t * tape_device_seek_file (Device * self, guint file);
 static gboolean tape_device_seek_block (Device * self, guint64 block);
-static gboolean tape_device_property_get (Device * self, DevicePropertyId id,
-                                          GValue * val);
-static gboolean tape_device_property_set (Device * self, DevicePropertyId id,
-                                          GValue * val);
 static gboolean tape_device_finish (Device * self);
 static IoResult tape_device_robust_read (TapeDevice * self, void * buf,
                                                int * count);
@@ -87,7 +114,7 @@ GType tape_device_get_type (void)
     if G_UNLIKELY(type == 0) {
         static const GTypeInfo info = {
             sizeof (TapeDeviceClass),
-            (GBaseInitFunc) NULL,
+            (GBaseInitFunc) tape_device_base_init,
             (GBaseFinalizeFunc) NULL,
             (GClassInitFunc) tape_device_class_init,
             (GClassFinalizeFunc) NULL,
@@ -107,86 +134,96 @@ GType tape_device_get_type (void)
 
 static void 
 tape_device_init (TapeDevice * self) {
-    Device * device_self;
-    DeviceProperty prop;
+    Device * d_self;
     GValue response;
 
-    device_self = (Device*)self;
+    d_self = DEVICE(self);
     bzero(&response, sizeof(response));
 
-    self->private = malloc(sizeof(TapeDevicePrivate));
+    self->private = g_new0(TapeDevicePrivate, 1);
 
     /* Clear all fields. */
-    self->min_block_size = self->fixed_block_size = 32768;
-    self->max_block_size = self->read_block_size = MAX_TAPE_BLOCK_BYTES;
+    d_self->block_size = 32768;
+    d_self->min_block_size = 32768;
+    d_self->max_block_size = LARGEST_BLOCK_ESTIMATE;
+    self->broken_gmt_online = FALSE;
 
     self->fd = -1;
-    
-    self->fsf = self->bsf = self->fsr = self->bsr = self->eom =
-        self->bsf_after_eom = self->compression = self->first_file = 0;
+
+    /* set all of the feature properties to an unsure default of FALSE */
+    self->broken_gmt_online = FALSE;
+    self->fsf = FALSE;
+    self->bsf = FALSE;
+    self->fsr = FALSE;
+    self->bsr = FALSE;
+    self->eom = FALSE;
+    self->bsf_after_eom = FALSE;
+
+    g_value_init(&response, G_TYPE_BOOLEAN);
+    g_value_set_boolean(&response, FALSE);
+    device_set_simple_property(d_self, PROPERTY_BROKEN_GMT_ONLINE,
+           &response, PROPERTY_SURETY_BAD, PROPERTY_SOURCE_DEFAULT);
+    device_set_simple_property(d_self, PROPERTY_FSF,
+           &response, PROPERTY_SURETY_BAD, PROPERTY_SOURCE_DEFAULT);
+    device_set_simple_property(d_self, PROPERTY_BSF,
+           &response, PROPERTY_SURETY_BAD, PROPERTY_SOURCE_DEFAULT);
+    device_set_simple_property(d_self, PROPERTY_FSR,
+           &response, PROPERTY_SURETY_BAD, PROPERTY_SOURCE_DEFAULT);
+    device_set_simple_property(d_self, PROPERTY_BSR,
+           &response, PROPERTY_SURETY_BAD, PROPERTY_SOURCE_DEFAULT);
+    device_set_simple_property(d_self, PROPERTY_EOM,
+           &response, PROPERTY_SURETY_BAD, PROPERTY_SOURCE_DEFAULT);
+    device_set_simple_property(d_self, PROPERTY_BSF_AFTER_EOM,
+           &response, PROPERTY_SURETY_BAD, PROPERTY_SOURCE_DEFAULT);
+    g_value_unset(&response);
+
     self->final_filemarks = 2;
+    g_value_init(&response, G_TYPE_UINT);
+    g_value_set_uint(&response, self->final_filemarks);
+    device_set_simple_property(d_self, PROPERTY_FINAL_FILEMARKS,
+           &response, PROPERTY_SURETY_BAD, PROPERTY_SOURCE_DEFAULT);
+    g_value_unset(&response);
+
+    self->private->read_buffer_size = 0;
+    g_value_init(&response, G_TYPE_UINT);
+    g_value_set_uint(&response, self->private->read_buffer_size);
+    device_set_simple_property(d_self, PROPERTY_READ_BUFFER_SIZE,
+           &response, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DEFAULT);
+    g_value_unset(&response);
 
     self->private->write_count = 0;
+    self->private->device_filename = NULL;
 
-    /* Register properites */
-    prop.base = &device_property_concurrency;
-    prop.access = PROPERTY_ACCESS_GET_MASK;
+    /* Static properites */
     g_value_init(&response, CONCURRENCY_PARADIGM_TYPE);
     g_value_set_enum(&response, CONCURRENCY_PARADIGM_EXCLUSIVE);
-    device_add_property(device_self, &prop, &response);
+    device_set_simple_property(d_self, PROPERTY_CONCURRENCY,
+           &response, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DETECTED);
     g_value_unset(&response);
 
-    prop.base = &device_property_streaming;
     g_value_init(&response, STREAMING_REQUIREMENT_TYPE);
     g_value_set_enum(&response, STREAMING_REQUIREMENT_DESIRED);
-    device_add_property(device_self, &prop, &response);
+    device_set_simple_property(d_self, PROPERTY_STREAMING,
+           &response, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DETECTED);
     g_value_unset(&response);
 
-    prop.base = &device_property_appendable;
     g_value_init(&response, G_TYPE_BOOLEAN);
-    g_value_set_boolean(&response, TRUE);
-    device_add_property(device_self, &prop, &response);
+    g_value_set_boolean(&response, FALSE);
+    device_set_simple_property(d_self, PROPERTY_APPENDABLE,
+           &response, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DETECTED);
+    g_value_unset(&response);
 
-    prop.base = &device_property_partial_deletion;
+    g_value_init(&response, G_TYPE_BOOLEAN);
     g_value_set_boolean(&response, FALSE);
-    device_add_property(device_self, &prop, &response);
+    device_set_simple_property(d_self, PROPERTY_PARTIAL_DELETION,
+           &response, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DETECTED);
     g_value_unset(&response);
 
-    prop.base = &device_property_medium_access_type;
     g_value_init(&response, MEDIA_ACCESS_MODE_TYPE);
     g_value_set_enum(&response, MEDIA_ACCESS_MODE_READ_WRITE);
-    device_add_property(device_self, &prop, &response);
+    device_set_simple_property(d_self, PROPERTY_MEDIUM_ACCESS_TYPE,
+           &response, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DETECTED);
     g_value_unset(&response);
-
-    prop.access = PROPERTY_ACCESS_GET_MASK | PROPERTY_ACCESS_SET_MASK;
-    prop.base = &device_property_compression;
-    device_add_property(device_self, &prop, NULL);
-
-    prop.access = PROPERTY_ACCESS_GET_MASK | PROPERTY_ACCESS_SET_BEFORE_START;
-    prop.base = &device_property_min_block_size;
-    device_add_property(device_self, &prop, NULL);
-    prop.base = &device_property_max_block_size;
-    device_add_property(device_self, &prop, NULL);
-    prop.base = &device_property_block_size;
-    device_add_property(device_self, &prop, NULL);
-    prop.base = &device_property_fsf;
-    device_add_property(device_self, &prop, NULL);
-    prop.base = &device_property_bsf;
-    device_add_property(device_self, &prop, NULL);
-    prop.base = &device_property_fsr;
-    device_add_property(device_self, &prop, NULL);
-    prop.base = &device_property_bsr;
-    device_add_property(device_self, &prop, NULL);
-    prop.base = &device_property_eom;
-    device_add_property(device_self, &prop, NULL);
-    prop.base = &device_property_bsf_after_eom;
-    device_add_property(device_self, &prop, NULL);
-    prop.base = &device_property_final_filemarks;
-    device_add_property(device_self, &prop, NULL);
-    
-    prop.access = PROPERTY_ACCESS_GET_MASK;
-    prop.base = &device_property_canonical_name;
-    device_add_property(device_self, &prop, NULL);
 }
 
 static void tape_device_finalize(GObject * obj_self) {
@@ -197,6 +234,7 @@ static void tape_device_finalize(GObject * obj_self) {
 
     robust_close(self->fd);
     self->fd = -1;
+    amfree(self->private->device_filename);
     amfree(self->private);
 }
 
@@ -214,160 +252,421 @@ tape_device_class_init (TapeDeviceClass * c)
     device_class->read_block = tape_device_read_block;
     device_class->start = tape_device_start;
     device_class->start_file = tape_device_start_file;
+    device_class->finish_file = tape_device_finish_file;
     device_class->seek_file = tape_device_seek_file;
     device_class->seek_block = tape_device_seek_block;
-    device_class->property_get = tape_device_property_get;
-    device_class->property_set = tape_device_property_set;
     device_class->finish = tape_device_finish;
     
     g_object_class->finalize = tape_device_finalize;
 }
 
+static void
+tape_device_base_init (TapeDeviceClass * c)
+{
+    DeviceClass *device_class = (DeviceClass *)c;
+
+    device_class_register_property(device_class, PROPERTY_BROKEN_GMT_ONLINE,
+           PROPERTY_ACCESS_GET_MASK | PROPERTY_ACCESS_SET_BEFORE_START,
+           device_simple_property_get_fn,
+           tape_device_set_feature_property_fn);
+
+    device_class_register_property(device_class, PROPERTY_FSF,
+           PROPERTY_ACCESS_GET_MASK | PROPERTY_ACCESS_SET_BEFORE_START,
+           device_simple_property_get_fn,
+           tape_device_set_feature_property_fn);
+
+    device_class_register_property(device_class, PROPERTY_BSF,
+           PROPERTY_ACCESS_GET_MASK | PROPERTY_ACCESS_SET_BEFORE_START,
+           device_simple_property_get_fn,
+           tape_device_set_feature_property_fn);
+
+    device_class_register_property(device_class, PROPERTY_FSR,
+           PROPERTY_ACCESS_GET_MASK | PROPERTY_ACCESS_SET_BEFORE_START,
+           device_simple_property_get_fn,
+           tape_device_set_feature_property_fn);
+
+    device_class_register_property(device_class, PROPERTY_BSR,
+           PROPERTY_ACCESS_GET_MASK | PROPERTY_ACCESS_SET_BEFORE_START,
+           device_simple_property_get_fn,
+           tape_device_set_feature_property_fn);
+
+    device_class_register_property(device_class, PROPERTY_EOM,
+           PROPERTY_ACCESS_GET_MASK | PROPERTY_ACCESS_SET_BEFORE_START,
+           device_simple_property_get_fn,
+           tape_device_set_feature_property_fn);
+
+    device_class_register_property(device_class, PROPERTY_BSF_AFTER_EOM,
+           PROPERTY_ACCESS_GET_MASK | PROPERTY_ACCESS_SET_BEFORE_START,
+           device_simple_property_get_fn,
+           tape_device_set_feature_property_fn);
+
+    device_class_register_property(device_class, PROPERTY_FINAL_FILEMARKS,
+           PROPERTY_ACCESS_GET_MASK | PROPERTY_ACCESS_SET_BEFORE_START,
+           device_simple_property_get_fn,
+           tape_device_set_final_filemarks_fn);
+
+    /* We don't (yet?) support reading the device's compression state, so not
+     * gettable. */
+    device_class_register_property(device_class, PROPERTY_COMPRESSION,
+           PROPERTY_ACCESS_SET_MASK,
+           NULL,
+           tape_device_set_compression_fn);
+
+    device_class_register_property(device_class, PROPERTY_READ_BUFFER_SIZE,
+           PROPERTY_ACCESS_GET_MASK | PROPERTY_ACCESS_SET_BEFORE_START,
+           device_simple_property_get_fn,
+           tape_device_set_read_buffer_size_fn);
+}
+
+static gboolean
+tape_device_set_feature_property_fn(Device *p_self, DevicePropertyBase *base,
+    GValue *val, PropertySurety surety, PropertySource source)
+{
+    TapeDevice *self = TAPE_DEVICE(p_self);
+    GValue old_val;
+    gboolean old_bool, new_bool;
+    PropertySurety old_surety;
+    PropertySource old_source;
+
+    new_bool = g_value_get_boolean(val);
+
+    /* get the old source and surety and see if we're willing to make this change */
+    bzero(&old_val, sizeof(old_val));
+    if (device_get_simple_property(p_self, base->ID, &old_val, &old_surety, &old_source)) {
+       old_bool = g_value_get_boolean(&old_val);
+
+       if (old_surety == PROPERTY_SURETY_GOOD && old_source == PROPERTY_SOURCE_DETECTED) {
+           if (new_bool != old_bool) {
+               device_set_error(p_self, vstrallocf(_(
+                          "Value for property '%s' was autodetected and cannot be changed"),
+                          base->name),
+                   DEVICE_STATUS_DEVICE_ERROR);
+               return FALSE;
+           } else {
+               /* pretend we set it, but don't change surety/source */
+               return TRUE;
+           }
+       }
+    }
+
+    /* (note: PROPERTY_* are not constants, so we can't use switch) */
+    if (base->ID == PROPERTY_BROKEN_GMT_ONLINE)
+       self->broken_gmt_online = new_bool;
+    else if (base->ID == PROPERTY_FSF)
+       self->fsf = new_bool;
+    else if (base->ID == PROPERTY_BSF)
+       self->bsf = new_bool;
+    else if (base->ID == PROPERTY_FSR)
+       self->fsr = new_bool;
+    else if (base->ID == PROPERTY_BSR)
+       self->bsr = new_bool;
+    else if (base->ID == PROPERTY_EOM)
+       self->eom = new_bool;
+    else if (base->ID == PROPERTY_BSF_AFTER_EOM)
+       self->bsf_after_eom = new_bool;
+    else
+       return FALSE; /* shouldn't happen */
+
+    return device_simple_property_set_fn(p_self, base, val, surety, source);
+}
+
+static gboolean
+tape_device_set_final_filemarks_fn(Device *p_self, DevicePropertyBase *base,
+    GValue *val, PropertySurety surety, PropertySource source)
+{
+    TapeDevice *self = TAPE_DEVICE(p_self);
+    GValue old_val;
+    gboolean old_int, new_int;
+    PropertySurety old_surety;
+    PropertySource old_source;
+
+    new_int = g_value_get_uint(val);
+
+    /* get the old source and surety and see if we're willing to make this change */
+    bzero(&old_val, sizeof(old_val));
+    if (device_get_simple_property(p_self, base->ID, &old_val, &old_surety, &old_source)) {
+       old_int = g_value_get_uint(&old_val);
+
+       if (old_surety == PROPERTY_SURETY_GOOD && old_source == PROPERTY_SOURCE_DETECTED) {
+           if (new_int != old_int) {
+               device_set_error(p_self, vstrallocf(_(
+                          "Value for property '%s' was autodetected and cannot be changed"),
+                          base->name),
+                   DEVICE_STATUS_DEVICE_ERROR);
+               return FALSE;
+           } else {
+               /* pretend we set it, but don't change surety/source */
+               return TRUE;
+           }
+       }
+    }
+
+    self->final_filemarks = new_int;
+
+    return device_simple_property_set_fn(p_self, base, val, surety, source);
+}
+
+static gboolean
+tape_device_set_compression_fn(Device *p_self, DevicePropertyBase *base,
+    GValue *val, PropertySurety surety, PropertySource source)
+{
+    TapeDevice *self = TAPE_DEVICE(p_self);
+    gboolean request = g_value_get_boolean(val);
+
+    /* We allow this property to be set at any time. This is mostly
+     * because setting compression is a hit-and-miss proposition
+     * at any time; some drives accept the mode setting but don't
+     * actually support compression, while others do support
+     * compression but do it via density settings or some other
+     * way. Set this property whenever you want, but all we'll do
+     * is report whether or not the ioctl succeeded. */
+    if (tape_setcompression(self->fd, request)) {
+       /* looks good .. let's start the device over, though */
+       device_clear_volume_details(p_self);
+    } else {
+       return FALSE;
+    }
+
+    return device_simple_property_set_fn(p_self, base, val, surety, source);
+}
+
+static gboolean
+tape_device_set_read_buffer_size_fn(Device *p_self, DevicePropertyBase *base,
+    GValue *val, PropertySurety surety, PropertySource source)
+{
+    TapeDevice *self = TAPE_DEVICE(p_self);
+    guint buffer_size = g_value_get_uint(val);
+
+    if (buffer_size != 0 &&
+           ((gsize)buffer_size < p_self->block_size ||
+            (gsize)buffer_size > p_self->max_block_size))
+       return FALSE;
+
+    self->private->read_buffer_size = buffer_size;
+
+    return device_simple_property_set_fn(p_self, base, val, surety, source);
+}
+
 void tape_device_register(void) {
     static const char * device_prefix_list[] = { "tape", NULL };
+
+    /* First register tape-specific properties */
+    device_property_fill_and_register(&device_property_broken_gmt_online,
+                                      G_TYPE_BOOLEAN, "broken_gmt_online",
+      "Does this drive support the GMT_ONLINE macro?");
+
+    device_property_fill_and_register(&device_property_fsf,
+                                      G_TYPE_BOOLEAN, "fsf",
+      "Does this drive support the MTFSF command?");
+
+    device_property_fill_and_register(&device_property_bsf,
+                                      G_TYPE_BOOLEAN, "bsf",
+      "Does this drive support the MTBSF command?" );
+
+    device_property_fill_and_register(&device_property_fsr,
+                                      G_TYPE_BOOLEAN, "fsr",
+      "Does this drive support the MTFSR command?");
+
+    device_property_fill_and_register(&device_property_bsr,
+                                      G_TYPE_BOOLEAN, "bsr",
+      "Does this drive support the MTBSR command?");
+
+    /* FIXME: Is this feature even useful? */
+    device_property_fill_and_register(&device_property_eom,
+                                      G_TYPE_BOOLEAN, "eom",
+      "Does this drive support the MTEOM command?");
+
+    device_property_fill_and_register(&device_property_bsf_after_eom,
+                                      G_TYPE_BOOLEAN,
+                                      "bsf_after_eom",
+      "Does this drive require an MTBSF after MTEOM in order to append?" );
+
+    device_property_fill_and_register(&device_property_final_filemarks,
+                                      G_TYPE_UINT, "final_filemarks",
+      "How many filemarks to write after the last tape file?" );
+
+    /* Then the device itself */
     register_device(tape_device_factory, device_prefix_list);
 }
 
-/* Open the tape device, trying various combinations of O_RDWR and
-   O_NONBLOCK.  Returns -1 and sets status_result for errors */
-static int try_open_tape_device(TapeDevice * self, char * device_filename,
-       ReadLabelStatusFlags *status_result) {
+static int try_open_tape_device(TapeDevice * self, char * device_filename) {
     int fd;
     int save_errno;
-    ReadLabelStatusFlags new_status;
-    TapeCheckResult tcr;
-    *status_result = READ_LABEL_STATUS_SUCCESS;
+    DeviceStatusFlags new_status;
 
-#ifdef O_NONBLOCK
-    fd  = robust_open(device_filename, O_RDWR | O_NONBLOCK, 0);
+    fd = robust_open(device_filename, O_RDWR,0);
     save_errno = errno;
-    if (fd < 0 && (save_errno == EWOULDBLOCK || save_errno == EINVAL)) {
-        /* Maybe we don't support O_NONBLOCK for tape devices. */
-        fd = robust_open(device_filename, O_RDWR, 0);
-       save_errno = errno;
-    }
-#else
-    fd = robust_open(device_filename, O_RDWR);
-    save_errno = errno;
-#endif
     if (fd >= 0) {
         self->write_open_errno = 0;
     } else {
         if (errno == EACCES || errno == EPERM) {
             /* Device is write-protected. */
             self->write_open_errno = errno;
-#ifdef O_NONBLOCK
-            fd = robust_open(device_filename, O_RDONLY | O_NONBLOCK, 0);
-           save_errno = errno;
-            if (fd < 0 && (save_errno == EWOULDBLOCK || save_errno == EINVAL)) {
-                fd = robust_open(device_filename, O_RDONLY, 0);
-               save_errno = errno;
-            }
-#else
-            fd = robust_open(device_filename, O_RDONLY);
+            fd = robust_open(device_filename, O_RDONLY,0);
            save_errno = errno;
-#endif
         }
     }
-#ifdef O_NONBLOCK
-    /* Clear O_NONBLOCK for operations from now on. */
-    if (fd >= 0)
-       fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) & ~O_NONBLOCK);
-    errno = save_errno;
-    /* function continues after #endif */
-
-#endif /* O_NONBLOCK */
 
     if (fd < 0) {
-       g_fprintf(stderr, _("Can't open tape device %s: %s\n"),
-           DEVICE(self)->device_name, strerror(errno));
-       *status_result = READ_LABEL_STATUS_DEVICE_ERROR;
+       DeviceStatusFlags status_flag = 0;
+       if (errno == EBUSY)
+           status_flag = DEVICE_STATUS_DEVICE_BUSY;
+       else
+           status_flag = DEVICE_STATUS_DEVICE_ERROR;
+       device_set_error(DEVICE(self),
+           vstrallocf(_("Can't open tape device %s: %s"), self->private->device_filename, strerror(errno)),
+           status_flag);
         return -1;
     }
 
     /* Check that this is actually a tape device. */
     new_status = tape_is_tape_device(fd);
-    if (new_status & (READ_LABEL_STATUS_DEVICE_ERROR | READ_LABEL_STATUS_VOLUME_MISSING)) {
-       g_fprintf(stderr, _("File %s is not a tape device\n"),
-           DEVICE(self)->device_name);
+    if (new_status & DEVICE_STATUS_DEVICE_ERROR) {
+       device_set_error(DEVICE(self),
+           vstrallocf(_("File %s is not a tape device"), self->private->device_filename),
+           new_status);
+        robust_close(fd);
+        return -1;
+    }
+    if (new_status & DEVICE_STATUS_VOLUME_MISSING) {
+       device_set_error(DEVICE(self),
+           vstrallocf(_("Tape device %s is not ready or is empty"), self->private->device_filename),
+           new_status);
         robust_close(fd);
-       *status_result = new_status;
         return -1;
     }
 
-    tcr = tape_is_ready(fd);
-    if (new_status == TAPE_CHECK_FAILURE) {
-       g_fprintf(stderr, _("Tape device %s is not ready or is empty\n"),
-           DEVICE(self)->device_name);
+    new_status = tape_is_ready(fd, self);
+    if (new_status & DEVICE_STATUS_VOLUME_MISSING) {
+       device_set_error(DEVICE(self),
+           vstrallocf(_("Tape device %s is empty"), self->private->device_filename),
+           new_status);
+        robust_close(fd);
+        return -1;
+    }
+    if (new_status != DEVICE_STATUS_SUCCESS) {
+       device_set_error(DEVICE(self),
+           vstrallocf(_("Tape device %s is not ready or is empty"), self->private->device_filename),
+           new_status);
         robust_close(fd);
-       *status_result = READ_LABEL_STATUS_DEVICE_ERROR;
         return -1;
     }
 
     return fd;
 }
 
-static gboolean 
-tape_device_open_device (Device * d_self, char * device_name) {
+static void
+tape_device_open_device (Device * d_self, char * device_name G_GNUC_UNUSED,
+                       char * device_type G_GNUC_UNUSED, char * device_node) {
     TapeDevice * self;
 
     self = TAPE_DEVICE(d_self);
-    g_return_val_if_fail (self != NULL, FALSE);
-    g_return_val_if_fail (device_name != NULL, FALSE);
+
+    self->fd = -1;
+    self->private->device_filename = stralloc(device_node);
 
     /* Get tape drive/OS info */
-    tape_device_discover_capabilities(self);
-
-    /* And verify the above. */
-    g_assert(feature_support_flags_is_valid(self->fsf));
-    g_assert(feature_support_flags_is_valid(self->bsf));
-    g_assert(feature_support_flags_is_valid(self->fsr));
-    g_assert(feature_support_flags_is_valid(self->bsr));
-    g_assert(feature_support_flags_is_valid(self->eom));
-    g_assert(feature_support_flags_is_valid(self->bsf_after_eom));
-    g_assert(self->final_filemarks == 1 ||
-             self->final_filemarks == 2);
+    tape_device_detect_capabilities(self);
 
     /* Chain up */
     if (parent_class->open_device) {
-        if (!(parent_class->open_device)(d_self, device_name)) {
-            robust_close(self->fd);
-            return FALSE;
-        }
+        parent_class->open_device(d_self, device_node, device_type, device_node);
     }
+}
 
-    return TRUE;
+void
+tape_device_set_capabilities(TapeDevice *self,
+       gboolean fsf, PropertySurety fsf_surety, PropertySource fsf_source,
+       gboolean bsf, PropertySurety bsf_surety, PropertySource bsf_source,
+       gboolean fsr, PropertySurety fsr_surety, PropertySource fsr_source,
+       gboolean bsr, PropertySurety bsr_surety, PropertySource bsr_source,
+       gboolean eom, PropertySurety eom_surety, PropertySource eom_source,
+       gboolean bsf_after_eom, PropertySurety bae_surety, PropertySource bae_source,
+       guint final_filemarks, PropertySurety ff_surety, PropertySource ff_source)
+{
+    Device *dself = DEVICE(self);
+    GValue val;
+
+    /* this function is called by tape_device_detect_capabilities, and basically
+     * exists to take care of the GValue mechanics in one place */
+
+    g_assert(final_filemarks == 1 || final_filemarks == 2);
+
+    bzero(&val, sizeof(val));
+    g_value_init(&val, G_TYPE_BOOLEAN);
+
+    self->fsf = fsf;
+    g_value_set_boolean(&val, fsf);
+    device_set_simple_property(dself, PROPERTY_FSF, &val, fsf_surety, fsf_source);
+
+    self->bsf = bsf;
+    g_value_set_boolean(&val, bsf);
+    device_set_simple_property(dself, PROPERTY_BSF, &val, bsf_surety, bsf_source);
+
+    self->fsr = fsr;
+    g_value_set_boolean(&val, fsr);
+    device_set_simple_property(dself, PROPERTY_FSR, &val, fsr_surety, fsr_source);
+
+    self->bsr = bsr;
+    g_value_set_boolean(&val, bsr);
+    device_set_simple_property(dself, PROPERTY_BSR, &val, bsr_surety, bsr_source);
+
+    self->eom = eom;
+    g_value_set_boolean(&val, eom);
+    device_set_simple_property(dself, PROPERTY_EOM, &val, eom_surety, eom_source);
+
+    self->bsf_after_eom = bsf_after_eom;
+    g_value_set_boolean(&val, bsf_after_eom);
+    device_set_simple_property(dself, PROPERTY_BSF_AFTER_EOM, &val, bae_surety, bae_source);
+
+    g_value_unset(&val);
+    g_value_init(&val, G_TYPE_UINT);
+
+    self->final_filemarks = final_filemarks;
+    g_value_set_uint(&val, final_filemarks);
+    device_set_simple_property(dself, PROPERTY_FINAL_FILEMARKS, &val, ff_surety, ff_source);
+
+    g_value_unset(&val);
 }
 
-static ReadLabelStatusFlags tape_device_read_label(Device * dself) {
+static DeviceStatusFlags tape_device_read_label(Device * dself) {
     TapeDevice * self;
     char * header_buffer;
     int buffer_len;
     IoResult result;
-    dumpfile_t header;
+    dumpfile_t *header;
+    DeviceStatusFlags new_status;
 
     self = TAPE_DEVICE(dself);
-    g_return_val_if_fail(self != NULL, FALSE);
 
     amfree(dself->volume_label);
     amfree(dself->volume_time);
+    amfree(dself->volume_header);
+
+    if (device_in_error(self)) return dself->status;
+
+    header = dself->volume_header = g_new(dumpfile_t, 1);
+    fh_init(header);
 
     if (self->fd == -1) {
-       ReadLabelStatusFlags status;
-        self->fd = try_open_tape_device(self, dself->device_name, &status);
+        self->fd = try_open_tape_device(self, self->private->device_filename);
+       /* if the open failed, then try_open_tape_device already set the
+        * approppriate error status */
        if (self->fd == -1)
-           return status;
+           return dself->status;
     }
 
     /* Rewind it. */
     if (!tape_rewind(self->fd)) {
-        g_fprintf(stderr, "Error rewinding device %s\n",
-                dself->device_name);
-        return (READ_LABEL_STATUS_DEVICE_ERROR |
-                READ_LABEL_STATUS_VOLUME_ERROR);
-    }   
+       device_set_error(dself,
+           vstrallocf(_("Error rewinding device %s"), self->private->device_filename),
+             DEVICE_STATUS_DEVICE_ERROR
+           | DEVICE_STATUS_VOLUME_ERROR);
+        robust_close(self->fd);
+        return dself->status;
+    }
 
-    buffer_len = self->read_block_size;
+    buffer_len = tape_device_read_size(self);
     header_buffer = malloc(buffer_len);
     result = tape_device_robust_read(self, header_buffer, &buffer_len);
 
@@ -375,66 +674,83 @@ static ReadLabelStatusFlags tape_device_read_label(Device * dself) {
         free(header_buffer);
         tape_rewind(self->fd);
         /* I/O error. */
-        g_fprintf(stderr, "Error reading Amanda header.\n");
         if (result == RESULT_NO_DATA) {
-            return (READ_LABEL_STATUS_VOLUME_ERROR |
-                    READ_LABEL_STATUS_VOLUME_UNLABELED);
+            new_status = (DEVICE_STATUS_VOLUME_ERROR |
+                         DEVICE_STATUS_VOLUME_UNLABELED);
         } else {
-            return (READ_LABEL_STATUS_DEVICE_ERROR |
-                    READ_LABEL_STATUS_VOLUME_ERROR |
-                    READ_LABEL_STATUS_VOLUME_UNLABELED);
+            new_status = (DEVICE_STATUS_DEVICE_ERROR |
+                         DEVICE_STATUS_VOLUME_ERROR |
+                         DEVICE_STATUS_VOLUME_UNLABELED);
         }
+       device_set_error(dself, stralloc(_("Error reading Amanda header")), new_status);
+       return dself->status;
     }
 
-    parse_file_header(header_buffer, &header, buffer_len);
+    parse_file_header(header_buffer, header, buffer_len);
     amfree(header_buffer);
-    if (header.type != F_TAPESTART) {
-        return READ_LABEL_STATUS_VOLUME_UNLABELED;
-    }
-     
-    dself->volume_label = g_strdup(header.name);
-    dself->volume_time = g_strdup(header.datestamp);
-   
-    if (parent_class->read_label) {
-        return parent_class->read_label(dself);
-    } else {
-        return READ_LABEL_STATUS_SUCCESS;
+    if (header->type != F_TAPESTART) {
+       device_set_error(dself,
+               stralloc(_("No tapestart header -- unlabeled device?")),
+               DEVICE_STATUS_VOLUME_UNLABELED);
+        return dself->status;
     }
+
+    dself->volume_label = g_strdup(header->name);
+    dself->volume_time = g_strdup(header->datestamp);
+    /* dself->volume_header is already set */
+
+    device_set_error(dself, NULL, DEVICE_STATUS_SUCCESS);
+
+    return dself->status;
 }
 
 static gboolean
-tape_device_write_block(Device * pself, guint size,
-                        gpointer data, gboolean short_block) {
+tape_device_write_block(Device * pself, guint size, gpointer data) {
     TapeDevice * self;
     char *replacement_buffer = NULL;
     IoResult result;
 
     self = TAPE_DEVICE(pself);
-    g_return_val_if_fail (self != NULL, FALSE);
-    g_return_val_if_fail (self->fd >= 0, FALSE);
-   
-    if (short_block && self->min_block_size > size) {
-        replacement_buffer = malloc(self->min_block_size);
+
+    g_assert(self->fd >= 0);
+    if (device_in_error(self)) return FALSE;
+
+    /* zero out to the end of a short block -- tape devices only write
+     * whole blocks. */
+    if (size < pself->block_size) {
+        replacement_buffer = malloc(pself->block_size);
         memcpy(replacement_buffer, data, size);
-        bzero(replacement_buffer+size, self->min_block_size-size);
-        
+        bzero(replacement_buffer+size, pself->block_size-size);
+
         data = replacement_buffer;
-        size = self->min_block_size;
+        size = pself->block_size;
     }
 
     result = tape_device_robust_write(self, data, size);
-    if (result == RESULT_SUCCESS) {
-        if (parent_class->write_block) {
-            (parent_class->write_block)(pself, size, data, short_block);
-        }
-        amfree(replacement_buffer);
-        return TRUE;
-    } else {
-        amfree(replacement_buffer);
-        return FALSE;
+    amfree(replacement_buffer);
+
+    switch (result) {
+       case RESULT_SUCCESS:
+           break;
+
+       case RESULT_NO_SPACE:
+           device_set_error(pself,
+               stralloc(_("No space left on device")),
+               DEVICE_STATUS_VOLUME_ERROR);
+           pself->is_eof = TRUE;
+           return FALSE;
+
+       default:
+       case RESULT_ERROR:
+           device_set_error(pself,
+               vstrallocf(_("Error writing block: %s"), strerror(errno)),
+               DEVICE_STATUS_DEVICE_ERROR);
+           return FALSE;
     }
-    
-    g_assert_not_reached();
+
+    pself->block++;
+
+    return TRUE;
 }
 
 static int tape_device_read_block (Device * pself, gpointer buf,
@@ -442,13 +758,17 @@ static int tape_device_read_block (Device * pself, gpointer buf,
     TapeDevice * self;
     int size;
     IoResult result;
+    gssize read_block_size = tape_device_read_size(pself);
     
     self = TAPE_DEVICE(pself);
-    g_return_val_if_fail (self != NULL, -1);
 
-    if (buf == NULL || *size_req < (int)self->read_block_size) {
+    g_assert(self->fd >= 0);
+    if (device_in_error(self)) return -1;
+
+    g_assert(read_block_size < INT_MAX); /* data type mismatch */
+    if (buf == NULL || *size_req < (int)read_block_size) {
         /* Just a size query. */
-        *size_req = self->read_block_size;
+        *size_req = (int)read_block_size;
         return 0;
     }
 
@@ -457,32 +777,51 @@ static int tape_device_read_block (Device * pself, gpointer buf,
     switch (result) {
     case RESULT_SUCCESS:
         *size_req = size;
+        pself->block++;
         return size;
     case RESULT_SMALL_BUFFER: {
-        int new_size;
+        gsize new_size;
+       GValue newval;
+
         /* If this happens, it means that we have:
          *     (next block size) > (buffer size) >= (read_block_size)
          * The solution is to ask for an even bigger buffer. We also play
          * some games to refrain from reading above the SCSI limit or from
-         * integer overflow. */
+         * integer overflow.  Note that not all devices will tell us about
+        * this problem -- some will just discard the "extra" data. */
         new_size = MIN(INT_MAX/2 - 1, *size_req) * 2;
         if (new_size > LARGEST_BLOCK_ESTIMATE &&
             *size_req < LARGEST_BLOCK_ESTIMATE) {
             new_size = LARGEST_BLOCK_ESTIMATE;
         }
-        if (new_size <= *size_req) {
-            return -1;
-        } else {
-            *size_req = new_size;
-            return 0;
-        }
+        g_assert (new_size > (gsize)*size_req);
+
+       g_warning("Device %s indicated blocksize %zd was too small; using %zd.",
+           pself->device_name, (gsize)*size_req, new_size);
+       *size_req = (int)new_size;
+       self->private->read_buffer_size = new_size;
+
+       bzero(&newval, sizeof(newval));
+       g_value_init(&newval, G_TYPE_UINT);
+       g_value_set_uint(&newval, self->private->read_buffer_size);
+       device_set_simple_property(pself, PROPERTY_READ_BUFFER_SIZE,
+               &newval, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DETECTED);
+       g_value_unset(&newval);
+
+       return 0;
     }
     case RESULT_NO_DATA:
         pself->is_eof = TRUE;
        pself->in_file = FALSE;
+       device_set_error(pself,
+           stralloc(_("EOF")),
+           DEVICE_STATUS_SUCCESS);
         return -1;
 
     default:
+       device_set_error(pself,
+           vstrallocf(_("Error reading from tape device: %s"), strerror(errno)),
+           DEVICE_STATUS_VOLUME_ERROR | DEVICE_STATUS_DEVICE_ERROR);
         return -1;
     }
 
@@ -506,17 +845,37 @@ static gboolean write_tapestart_header(TapeDevice * self, char * label,
                                              &header_fits);
      amfree(header);
      g_assert(header_buf != NULL);
-                                             
+
      if (!header_fits) {
          amfree(header_buf);
-         g_fprintf(stderr, "Tapestart header won't fit in a single block!\n");
+        device_set_error(d_self,
+           stralloc(_("Tapestart header won't fit in a single block!")),
+           DEVICE_STATUS_DEVICE_ERROR);
          return FALSE;
      }
 
-     g_assert(header_size >= (int)self->min_block_size);
+     g_assert(header_size >= (int)d_self->min_block_size);
      result = tape_device_robust_write(self, header_buf, header_size);
+     if (result != RESULT_SUCCESS) {
+        device_set_error(d_self,
+           vstrallocf(_("Error writing tapestart header: %s"), strerror(errno)),
+           DEVICE_STATUS_DEVICE_ERROR);
+       amfree(header_buf);
+       return FALSE;
+     }
+
      amfree(header_buf);
-     return (result == RESULT_SUCCESS);
+
+     if (!tape_weof(self->fd, 1)) {
+       device_set_error(d_self,
+                        vstrallocf(_("Error writing filemark: %s"),
+                                   strerror(errno)),
+                        DEVICE_STATUS_DEVICE_ERROR|DEVICE_STATUS_VOLUME_ERROR);
+       return FALSE;
+     }
+
+     return TRUE;
+
 }
 
 static gboolean 
@@ -525,18 +884,20 @@ tape_device_start (Device * d_self, DeviceAccessMode mode, char * label,
     TapeDevice * self;
 
     self = TAPE_DEVICE(d_self);
-    g_return_val_if_fail(self != NULL, FALSE);
+
+    if (device_in_error(self)) return FALSE;
 
     if (self->fd == -1) {
-       ReadLabelStatusFlags status;
-        self->fd = try_open_tape_device(self, d_self->device_name, &status);
+        self->fd = try_open_tape_device(self, self->private->device_filename);
+       /* if the open failed, then try_open_tape_device already set the
+        * approppriate error status */
        if (self->fd == -1)
-           return FALSE;   /* can't do anything with status here */
+           return FALSE;
     }
 
     if (mode != ACCESS_WRITE && d_self->volume_label == NULL) {
        /* we need a labeled volume for APPEND and READ */
-       if (tape_device_read_label(d_self) != READ_LABEL_STATUS_SUCCESS)
+       if (tape_device_read_label(d_self) != DEVICE_STATUS_SUCCESS)
            return FALSE;
     }
 
@@ -546,27 +907,45 @@ tape_device_start (Device * d_self, DeviceAccessMode mode, char * label,
     if (IS_WRITABLE_ACCESS_MODE(mode)) {
         if (self->write_open_errno != 0) {
             /* We tried and failed to open the device in write mode. */
-            g_fprintf(stderr, "Can't open tape device %s for writing: %s\n",
-                    d_self->device_name, strerror(self->write_open_errno));
+           device_set_error(d_self,
+               vstrallocf(_("Can't open tape device %s for writing: %s"),
+                           self->private->device_filename, strerror(self->write_open_errno)),
+               DEVICE_STATUS_DEVICE_ERROR | DEVICE_STATUS_VOLUME_ERROR);
             return FALSE;
         } else if (!tape_rewind(self->fd)) {
-            g_fprintf(stderr, "Couldn't rewind device: %s\n",
-                    strerror(errno));
+           device_set_error(d_self,
+               vstrallocf(_("Couldn't rewind device: %s"), strerror(errno)),
+               DEVICE_STATUS_DEVICE_ERROR);
+           return FALSE;
         }
     }
 
     /* Position the tape */
     switch (mode) {
     case ACCESS_APPEND:
-        if (!tape_device_eod(self))
+       if (d_self->volume_label == NULL && device_read_label(d_self) != DEVICE_STATUS_SUCCESS) {
+           /* device_read_label already set our error message */
             return FALSE;
-        self->first_file = TRUE;
+       }
+
+        if (!tape_device_eod(self)) {
+           device_set_error(d_self,
+               vstrallocf(_("Couldn't seek to end of tape: %s"), strerror(errno)),
+               DEVICE_STATUS_DEVICE_ERROR);
+            return FALSE;
+       }
         break;
         
     case ACCESS_READ:
+       if (d_self->volume_label == NULL && device_read_label(d_self) != DEVICE_STATUS_SUCCESS) {
+           /* device_read_label already set our error message */
+            return FALSE;
+       }
+
         if (!tape_rewind(self->fd)) {
-            g_fprintf(stderr, "Error rewinding device %s\n",
-                    d_self->device_name);
+           device_set_error(d_self,
+               vstrallocf(_("Couldn't rewind device: %s"), strerror(errno)),
+               DEVICE_STATUS_DEVICE_ERROR);
             return FALSE;
         }
         d_self->file = 0;
@@ -574,24 +953,27 @@ tape_device_start (Device * d_self, DeviceAccessMode mode, char * label,
 
     case ACCESS_WRITE:
         if (!write_tapestart_header(self, label, timestamp)) {
+           /* write_tapestart_header already set the error status */
             return FALSE;
         }
-        self->first_file = TRUE;
+
+        d_self->volume_label = newstralloc(d_self->volume_label, label);
+        d_self->volume_time = newstralloc(d_self->volume_time, timestamp);
+
+       /* unset the VOLUME_UNLABELED flag, if it was set */
+       device_set_error(d_self, NULL, DEVICE_STATUS_SUCCESS);
+        d_self->file = 0;
         break;
 
     default:
         g_assert_not_reached();
     }
 
-    if (parent_class->start) {
-        return parent_class->start(d_self, mode, label, timestamp);
-    } else {
-        return TRUE;
-    }
+    return TRUE;
 }
 
 static gboolean tape_device_start_file(Device * d_self,
-                                       const dumpfile_t * info) {
+                                       dumpfile_t * info) {
     TapeDevice * self;
     IoResult result;
     char * amanda_header;
@@ -599,35 +981,57 @@ static gboolean tape_device_start_file(Device * d_self,
     gboolean header_fits;
 
     self = TAPE_DEVICE(d_self);
-    g_return_val_if_fail(self != NULL, FALSE);
-    g_return_val_if_fail (self->fd >= 0, FALSE);
 
-    if (!(d_self->access_mode == ACCESS_APPEND && self->first_file)) {
-        if (!tape_weof(self->fd, 1)) {
-            g_fprintf(stderr, "Error writing filemark: %s\n", strerror(errno));
-            return FALSE;
-        }
-    }
+    g_assert(self->fd >= 0);
+    if (device_in_error(self)) return FALSE;
 
-    self->first_file = FALSE;
+    /* set the blocksize in the header properly */
+    info->blocksize = d_self->block_size;
 
     /* Make the Amanda header suitable for writing to the device. */
     /* Then write the damn thing. */
     amanda_header = device_build_amanda_header(d_self, info,
                                                &header_size, &header_fits);
-    g_return_val_if_fail(amanda_header != NULL, FALSE);
-    g_return_val_if_fail(header_fits, FALSE);
+    if (!header_fits) {
+       device_set_error(d_self,
+           stralloc(_("Amanda file header won't fit in a single block!")),
+           DEVICE_STATUS_DEVICE_ERROR);
+       return FALSE;
+    }
     result = tape_device_robust_write(self, amanda_header, header_size);
+    if (result != RESULT_SUCCESS) {
+       device_set_error(d_self,
+           vstrallocf(_("Error writing file header: %s"), strerror(errno)),
+           DEVICE_STATUS_DEVICE_ERROR);
+       amfree(amanda_header);
+        return FALSE;
+    }
     amfree(amanda_header);
-    if (result == RESULT_SUCCESS) {
-        /* Chain up. */
-        if (parent_class->start_file) {
-            parent_class->start_file(d_self, info);
-        }
-        return TRUE;
-    } else {
+
+    /* arrange the file numbers correctly */
+    d_self->in_file = TRUE;
+    d_self->block = 0;
+    if (d_self->file >= 0)
+        d_self->file ++;
+    return TRUE;
+}
+
+static gboolean
+tape_device_finish_file (Device * d_self) {
+    TapeDevice * self;
+
+    self = TAPE_DEVICE(d_self);
+    if (device_in_error(d_self)) return FALSE;
+
+    if (!tape_weof(self->fd, 1)) {
+       device_set_error(d_self,
+               vstrallocf(_("Error writing filemark: %s"), strerror(errno)),
+               DEVICE_STATUS_DEVICE_ERROR | DEVICE_STATUS_VOLUME_ERROR);
         return FALSE;
     }
+
+    d_self->in_file = FALSE;
+    return TRUE;
 }
 
 static dumpfile_t * 
@@ -640,9 +1044,8 @@ tape_device_seek_file (Device * d_self, guint file) {
     IoResult result;
 
     self = TAPE_DEVICE(d_self);
-    g_return_val_if_fail(d_self != NULL, NULL);
 
-    d_self->in_file = FALSE;
+    if (device_in_error(self)) return NULL;
 
     difference = file - d_self->file;
 
@@ -651,21 +1054,31 @@ tape_device_seek_file (Device * d_self, guint file) {
         difference --;
     }
 
+    d_self->in_file = FALSE;
+    d_self->is_eof = FALSE;
+    d_self->block = 0;
+
     if (difference > 0) {
         /* Seeking forwards */
         if (!tape_device_fsf(self, difference)) {
             tape_rewind(self->fd);
+           device_set_error(d_self,
+               vstrallocf(_("Could not seek forward to file %d"), file),
+               DEVICE_STATUS_VOLUME_ERROR | DEVICE_STATUS_DEVICE_ERROR);
             return NULL;
         }
     } else if (difference < 0) {
         /* Seeking backwards */
         if (!tape_device_bsf(self, -difference, d_self->file)) {
             tape_rewind(self->fd);
+           device_set_error(d_self,
+               vstrallocf(_("Could not seek backward to file %d"), file),
+               DEVICE_STATUS_VOLUME_ERROR | DEVICE_STATUS_DEVICE_ERROR);
             return NULL;
         }
     }
 
-    buffer_len = self->read_block_size;
+    buffer_len = tape_device_read_size(d_self);
     header_buffer = malloc(buffer_len);
     d_self->is_eof = FALSE;
     result = tape_device_robust_read(self, header_buffer, &buffer_len);
@@ -678,28 +1091,38 @@ tape_device_seek_file (Device * d_self, guint file) {
              * filemark, which indicates end of tape. This should
              * work even with QIC tapes on operating systems with
              * proper support. */
+           d_self->file = file; /* other attributes are already correct */
             return make_tapeend_header();
         }
         /* I/O error. */
-        g_fprintf(stderr, "Error reading Amanda header.\n");
-        return FALSE;
+       device_set_error(d_self,
+           stralloc(_("Error reading Amanda header")),
+           DEVICE_STATUS_DEVICE_ERROR | DEVICE_STATUS_VOLUME_ERROR);
+        return NULL;
     }
         
-    rval = malloc(sizeof(*rval));
+    rval = g_new(dumpfile_t, 1);
     parse_file_header(header_buffer, rval, buffer_len);
     amfree(header_buffer);
     switch (rval->type) {
     case F_DUMPFILE:
     case F_CONT_DUMPFILE:
     case F_SPLIT_DUMPFILE:
-        d_self->in_file = TRUE;
-        d_self->file = file;
-        return rval;
+        break;
+
     default:
         tape_rewind(self->fd);
+       device_set_error(d_self,
+           stralloc(_("Invalid amanda header while reading file header")),
+           DEVICE_STATUS_VOLUME_ERROR);
         amfree(rval);
         return NULL;
     }
+
+    d_self->in_file = TRUE;
+    d_self->file = file;
+
+    return rval;
 }
 
 static gboolean 
@@ -708,246 +1131,41 @@ tape_device_seek_block (Device * d_self, guint64 block) {
     int difference;
 
     self = TAPE_DEVICE(d_self);
-    g_return_val_if_fail(d_self != NULL, FALSE);
+
+    if (device_in_error(self)) return FALSE;
 
     difference = block - d_self->block;
     
     if (difference > 0) {
-        if (!tape_device_fsr(self, difference))
+        if (!tape_device_fsr(self, difference)) {
+           device_set_error(d_self,
+               vstrallocf(_("Could not seek forward to block %ju"), (uintmax_t)block),
+               DEVICE_STATUS_VOLUME_ERROR | DEVICE_STATUS_DEVICE_ERROR);
             return FALSE;
+       }
     } else if (difference < 0) {
-        if (!tape_device_bsr(self, difference, d_self->file, d_self->block))
-            return FALSE;
-    }
-
-    if (parent_class->seek_block) {
-        return (parent_class->seek_block)(d_self, block);
-    } else {
-        return TRUE;
-    }
-}
-
-/* Just checks that the flag is valid before setting it. */
-static gboolean get_feature_flag(GValue * val, FeatureSupportFlags f) {
-    if (feature_support_flags_is_valid(f)) {
-        g_value_set_flags(val, f);
-        return TRUE;
-    } else {
-        return FALSE;
-    }
-}
-
-static gboolean 
-tape_device_property_get (Device * d_self, DevicePropertyId id, GValue * val) {
-    TapeDevice * self;
-    const DevicePropertyBase * base;
-
-    self = TAPE_DEVICE(d_self);
-    g_return_val_if_fail(self != NULL, FALSE);
-
-    base = device_property_get_by_id(id);
-    g_return_val_if_fail(self != NULL, FALSE);
-
-    g_value_unset_init(val, base->type);
-
-    if (id == PROPERTY_COMPRESSION) {
-        g_value_set_boolean(val, self->compression);
-        return TRUE;
-    } else if (id == PROPERTY_MIN_BLOCK_SIZE) {
-        g_value_set_uint(val, self->min_block_size);
-        return TRUE;
-    } else if (id == PROPERTY_MAX_BLOCK_SIZE) {
-        g_value_set_uint(val, self->max_block_size);
-        return TRUE;
-    } else if (id == PROPERTY_BLOCK_SIZE) {
-        if (self->fixed_block_size == 0) {
-            g_value_set_int(val, -1);
-        } else {
-            g_value_set_int(val, self->fixed_block_size);
-        }
-        return TRUE;
-    } else if (id == PROPERTY_FSF) {
-        return get_feature_flag(val, self->fsf);
-    } else if (id == PROPERTY_BSF) {
-        return get_feature_flag(val, self->bsf);
-    } else if (id == PROPERTY_FSR) {
-        return get_feature_flag(val, self->fsr);
-    } else if (id == PROPERTY_BSR) {
-        return get_feature_flag(val, self->bsr);
-    } else if (id == PROPERTY_EOM) {
-        return get_feature_flag(val, self->eom);
-    } else if (id == PROPERTY_BSF_AFTER_EOM) {
-        return get_feature_flag(val, self->bsf_after_eom);
-    } else if (id == PROPERTY_FINAL_FILEMARKS) {
-        g_value_set_uint(val, self->final_filemarks);
-        return TRUE;
-    } else {
-        /* Chain up */
-        if (parent_class->property_get) {
-            return (parent_class->property_get)(d_self, id, val);
-        } else {
+        if (!tape_device_bsr(self, difference, d_self->file, d_self->block)) {
+           device_set_error(d_self,
+               vstrallocf(_("Could not seek backward to block %ju"), (uintmax_t)block),
+               DEVICE_STATUS_VOLUME_ERROR | DEVICE_STATUS_DEVICE_ERROR);
             return FALSE;
-        }
+       }
     }
 
-    g_assert_not_reached();
-}
-
-/* We don't allow overriding of flags with _GOOD surety. That way, if
-   e.g., a feature has no matching IOCTL on a given platform, we don't
-   ever try to set it. */
-static gboolean flags_settable(FeatureSupportFlags request,
-                               FeatureSupportFlags existing) {
-    if (!feature_support_flags_is_valid(request))
-        return FALSE;
-    else if (!feature_support_flags_is_valid(existing))
-        return TRUE;
-    else if (request == existing)
-        return TRUE;
-    else if (existing & FEATURE_SURETY_GOOD)
-        return FALSE;
-    else
-        return TRUE;
+    d_self->block = block;
+    return TRUE;
 }
 
-/* If the access listed is NULL, and the provided flags can override the
-   existing ones, then do it and return TRUE. */
-static gboolean try_set_feature(DeviceAccessMode mode,
-                                FeatureSupportFlags request,
-                                FeatureSupportFlags * existing) {
-    if (mode != ACCESS_NULL) {
-        return FALSE;
-    } else if (flags_settable(request, *existing)) {
-        *existing = request;
-        return TRUE;
-    } else {
-        return FALSE;
-    }
-}
 static gboolean 
-tape_device_property_set (Device * d_self, DevicePropertyId id, GValue * val) {
+tape_device_finish (Device * d_self) {
     TapeDevice * self;
-    FeatureSupportFlags feature_request_flags = 0;
-    const DevicePropertyBase * base;
 
     self = TAPE_DEVICE(d_self);
-    g_return_val_if_fail(self != NULL, FALSE);
-
-    base = device_property_get_by_id(id);
-    g_return_val_if_fail(self != NULL, FALSE);
-
-    g_return_val_if_fail(G_VALUE_HOLDS(val, base->type), FALSE);
-
-    if (base->type == FEATURE_SUPPORT_FLAGS_TYPE) {
-        feature_request_flags = g_value_get_flags(val);
-        g_return_val_if_fail(
-            feature_support_flags_is_valid(feature_request_flags), FALSE);
-    }
-
-    if (id == PROPERTY_COMPRESSION) {
-        /* We allow this property to be set at any time. This is mostly
-         * because setting compression is a hit-and-miss proposition
-         * at any time; some drives accept the mode setting but don't
-         * actually support compression, while others do support
-         * compression but do it via density settings or some other
-         * way. Set this property whenever you want, but all we'll do
-         * is report whether or not the ioctl succeeded. */
-        gboolean request = g_value_get_boolean(val);
-        if (tape_setcompression(self->fd, request)) {
-            self->compression = request;
-            device_clear_volume_details(d_self);
-            return TRUE;
-        } else {
-            return FALSE;
-        }
-    } else if (id == PROPERTY_MIN_BLOCK_SIZE) {
-        if (d_self->access_mode != ACCESS_NULL)
-            return FALSE;
-        self->min_block_size = g_value_get_uint(val);
-        device_clear_volume_details(d_self);
-        return TRUE;
-    } else if (id == PROPERTY_MAX_BLOCK_SIZE) {
-        if (d_self->access_mode != ACCESS_NULL)
-            return FALSE;
-        self->max_block_size = g_value_get_uint(val);
-        device_clear_volume_details(d_self);
-        return TRUE;
-    } else if (id == PROPERTY_BLOCK_SIZE) {
-        if (d_self->access_mode != ACCESS_NULL)
-            return FALSE;
-
-        self->fixed_block_size = g_value_get_int(val);
-        device_clear_volume_details(d_self);
-        return TRUE;
-    } else if (id == PROPERTY_READ_BUFFER_SIZE) {
-        if (d_self->access_mode != ACCESS_NULL)
-            return FALSE;
-        self->read_block_size = g_value_get_uint(val);
-        device_clear_volume_details(d_self);
-        return TRUE;
-    } else if (id == PROPERTY_FSF) {
-        return try_set_feature(d_self->access_mode,
-                               feature_request_flags,
-                               &(self->fsf));
-    } else if (id == PROPERTY_BSF) {
-        return try_set_feature(d_self->access_mode,
-                               feature_request_flags,
-                               &(self->bsf));
-    } else if (id == PROPERTY_FSR) {
-        return try_set_feature(d_self->access_mode,
-                               feature_request_flags,
-                               &(self->fsr));
-    } else if (id == PROPERTY_BSR) {
-        return try_set_feature(d_self->access_mode,
-                               feature_request_flags,
-                               &(self->bsr));
-    } else if (id == PROPERTY_EOM) {
-        /* Setting this to disabled also clears BSF after EOM. */
-        if (try_set_feature(d_self->access_mode,
-                            feature_request_flags,
-                            &(self->eom))) {
-            feature_request_flags &= ~FEATURE_SUPPORT_FLAGS_STATUS_MASK;
-            feature_request_flags |= FEATURE_STATUS_DISABLED;
-            self->bsf_after_eom = feature_request_flags;
-            return TRUE;
-        } else {
-            return FALSE;
-        }
-    } else if (id == PROPERTY_BSF_AFTER_EOM) {
-        /* You can only set this if EOM is enabled. */
-        if (self->bsf | FEATURE_STATUS_DISABLED)
-            return FALSE;
-        else
-            return try_set_feature(d_self->access_mode,
-                                   feature_request_flags,
-                                   &(self->bsf_after_eom));
-    } else if (id == PROPERTY_FINAL_FILEMARKS) {
-        guint request = g_value_get_uint(val);
-        if (request == 1 || request == 2) {
-            self->final_filemarks = request;
-            return TRUE;
-        } else {
-            return FALSE;
-        }
-    } else {
-        /* Chain up */
-        if (parent_class->property_set) {
-            return (parent_class->property_set)(d_self, id, val);
-        } else {
-            return FALSE;
-        }
-    }
 
-    g_assert_not_reached();
-}
-
-static gboolean 
-tape_device_finish (Device * d_self) {
-    TapeDevice * self;
+    if (device_in_error(self)) return FALSE;
 
-    self = TAPE_DEVICE(d_self);
-    g_return_val_if_fail(self != NULL, FALSE);
+    if (d_self->access_mode == ACCESS_NULL)
+       return TRUE;
 
     /* Polish off this file, if relevant. */
     if (d_self->in_file && IS_WRITABLE_ACCESS_MODE(d_self->access_mode)) {
@@ -957,29 +1175,30 @@ tape_device_finish (Device * d_self) {
 
     /* Write an extra filemark, if needed. The OS will give us one for
        sure. */
+    /* device_finish_file already wrote one for us */
+    /*
     if (self->final_filemarks > 1 &&
         IS_WRITABLE_ACCESS_MODE(d_self->access_mode)) {
         if (!tape_weof(self->fd, 1)) {
-            g_fprintf(stderr, "Error writing final filemark: %s\n",
-                    strerror(errno));
+       device_set_error(d_self,
+           vstrallocf(_("Error writing final filemark: %s"), strerror(errno)),
+           DEVICE_STATUS_DEVICE_ERROR | DEVICE_STATUS_VOLUME_ERROR);
             return FALSE;
         }
     }
+    */
 
     /* Rewind. */
     if (!tape_rewind(self->fd)) {
-        g_fprintf(stderr, "Error rewinding tape: %s\n", strerror(errno));
+       device_set_error(d_self,
+           vstrallocf(_("Couldn't rewind device: %s"), strerror(errno)),
+           DEVICE_STATUS_DEVICE_ERROR);
         return FALSE;
     }
 
     d_self->access_mode = ACCESS_NULL;
 
-    if (parent_class->finish) {
-        return (parent_class->finish)(d_self);
-    } else {
-        return TRUE;
-    }
-
+    return TRUE;
 }
 
 /* Works just like read(), except for the following:
@@ -992,10 +1211,9 @@ tape_device_robust_read (TapeDevice * self, void * buf, int * count) {
     int result;
 
     d_self = (Device*)self;
-    g_return_val_if_fail(self != NULL, RESULT_ERROR);
-    g_return_val_if_fail(*count >= 0, RESULT_ERROR);
+
     /* Callers should ensure this. */
-    g_assert((guint)(*count) <= self->read_block_size);
+    g_assert(*count >= 0);
 
     for (;;) {
         result = read(self->fd, buf, *count);
@@ -1019,8 +1237,7 @@ tape_device_robust_read (TapeDevice * self, void * buf, int * count) {
                 ) {
                 /* Interrupted system call */
                 continue;
-            } else if ((self->fixed_block_size == 0) &&
-                       (0
+            } else if ((0
 #ifdef ENOMEM
                         || errno == ENOMEM /* bad user-space buffer */
 #endif
@@ -1034,8 +1251,10 @@ tape_device_robust_read (TapeDevice * self, void * buf, int * count) {
                 /* Buffer too small. */
                 return RESULT_SMALL_BUFFER;
             } else {
-                g_fprintf(stderr, "Error reading %d bytes from %s: %s\n",
-                        *count, d_self->device_name, strerror(errno));
+               device_set_error(d_self,
+                   vstrallocf(_("Error reading %d bytes from %s: %s"),
+                               *count, self->private->device_filename, strerror(errno)),
+                   DEVICE_STATUS_DEVICE_ERROR | DEVICE_STATUS_VOLUME_ERROR);
                 return RESULT_ERROR;
             }
         }
@@ -1051,8 +1270,11 @@ tape_device_robust_read (TapeDevice * self, void * buf, int * count) {
 static void check_resetofs(TapeDevice * self G_GNUC_UNUSED,
                            int count G_GNUC_UNUSED) {
 #ifdef NEED_RESETOFS
+    Device * d_self;
     int result;
 
+    d_self = (Device*)self;
+
     self->private->write_count += count;
     if (self->private->write_count < RESETOFS_THRESHOLD) {
         return;
@@ -1060,8 +1282,8 @@ static void check_resetofs(TapeDevice * self G_GNUC_UNUSED,
 
     result = lseek(self->fd, 0, SEEK_SET);
     if (result < 0) {
-        g_fprintf(stderr,
-                "Warning: lseek() failed during kernel 2GB workaround.\n");
+       g_warning(_("lseek() failed during kernel 2GB workaround: %s"),
+              strerror(errno));
     }
 #endif
 }
@@ -1071,7 +1293,6 @@ tape_device_robust_write (TapeDevice * self, void * buf, int count) {
     Device * d_self;
     int result;
 
-    g_return_val_if_fail(self != NULL, RESULT_ERROR);
     d_self = (Device*)self;
     
     check_resetofs(self, count);
@@ -1086,9 +1307,10 @@ tape_device_robust_write (TapeDevice * self, void * buf, int count) {
             return RESULT_SUCCESS;
         } else if (result >= 0) {
             /* write() returned a short count. This should not happen. */
-            g_fprintf(stderr,
-                  "Mysterious short write on tape device: Tried %d, got %d.\n",
-                    count, result);
+           device_set_error(d_self,
+                    vstrallocf(_("Mysterious short write on tape device: Tried %d, got %d"),
+                               count, result),
+                   DEVICE_STATUS_DEVICE_ERROR);
             return RESULT_ERROR;
         } else if (0
 #ifdef EAGAIN
@@ -1114,16 +1336,17 @@ tape_device_robust_write (TapeDevice * self, void * buf, int count) {
             /* Probably EOT. Print a message if we got EIO. */
 #ifdef EIO
             if (errno == EIO) {
-                g_fprintf(stderr, "Got EIO on %s, assuming end of tape.\n",
-                        d_self->device_name);
+               g_warning(_("Got EIO on %s, assuming end of tape"),
+                       self->private->device_filename);
             }
 #endif
             return RESULT_NO_SPACE;
         } else {
             /* WTF */
-            g_fprintf(stderr,
-     "Kernel gave unexpected write() result of \"%s\" on device %s.\n",
-                    strerror(errno), d_self->device_name);
+           device_set_error(d_self,
+                   vstrallocf(_("Kernel gave unexpected write() result of \"%s\" on device %s"),
+                                       strerror(errno), self->private->device_filename),
+                   DEVICE_STATUS_DEVICE_ERROR);
             return RESULT_ERROR;
         }
     }
@@ -1138,10 +1361,10 @@ tape_device_robust_write (TapeDevice * self, void * buf, int count) {
    actually read. */
 static int drain_tape_blocks(TapeDevice * self, int count) {
     char * buffer;
-    int buffer_size;
+    gsize buffer_size;
     int i;
 
-    buffer_size = self->read_block_size;
+    buffer_size = tape_device_read_size(self);
 
     buffer = malloc(sizeof(buffer_size));
 
@@ -1153,7 +1376,7 @@ static int drain_tape_blocks(TapeDevice * self, int count) {
             i ++;
             continue;
         } else if (result == 0) {
-            free(buffer);
+            amfree(buffer);
             return i;
         } else {
             /* First check for interrupted system call. */
@@ -1187,7 +1410,7 @@ static int drain_tape_blocks(TapeDevice * self, int count) {
                 buffer_size *= 2;
 
                 if (buffer_size > 32*1024*1024) {
-                    free(buffer);
+                    amfree(buffer);
                     return -1;
                 } else {
                     buffer = realloc(buffer, buffer_size);
@@ -1197,6 +1420,7 @@ static int drain_tape_blocks(TapeDevice * self, int count) {
         }
     }
     
+    amfree(buffer);
     return count;
 }
 
@@ -1205,10 +1429,7 @@ static int drain_tape_blocks(TapeDevice * self, int count) {
 
 static gboolean 
 tape_device_fsf (TapeDevice * self, guint count) {
-    g_return_val_if_fail (self != NULL, (gboolean )0);
-    g_return_val_if_fail (IS_TAPE_DEVICE (self), (gboolean )0);
-    
-    if (self->fsf & FEATURE_STATUS_ENABLED) {
+    if (self->fsf) {
         return tape_fsf(self->fd, count);
     } else {
         guint i;
@@ -1223,10 +1444,7 @@ tape_device_fsf (TapeDevice * self, guint count) {
 /* Seek back over count + 1 filemarks to the start of the given file. */
 static gboolean 
 tape_device_bsf (TapeDevice * self, guint count, guint file) {
-    g_return_val_if_fail (self != NULL, (gboolean )0);
-    g_return_val_if_fail (IS_TAPE_DEVICE (self), (gboolean )0);
-
-    if (self->bsf & FEATURE_STATUS_ENABLED) {
+    if (self->bsf) {
         /* The BSF operation is not very smart; it includes the
            filemark of the present file as part of the count, and seeks
            to the wrong (BOT) side of the filemark. We compensate for
@@ -1251,10 +1469,7 @@ tape_device_bsf (TapeDevice * self, guint count, guint file) {
 
 static gboolean 
 tape_device_fsr (TapeDevice * self, guint count) {
-    g_return_val_if_fail (self != NULL, (gboolean )0);
-    g_return_val_if_fail (IS_TAPE_DEVICE (self), (gboolean )0);
-
-    if (self->fsr & FEATURE_STATUS_ENABLED) {
+    if (self->fsr) {
         return tape_fsr(self->fd, count);
     } else {
         int result = drain_tape_blocks(self, count);
@@ -1267,13 +1482,7 @@ tape_device_fsr (TapeDevice * self, guint count) {
 
 static gboolean 
 tape_device_bsr (TapeDevice * self, guint count, guint file, guint block) {
-    g_return_val_if_fail (self != NULL, (gboolean )0);
-    g_return_val_if_fail (IS_TAPE_DEVICE (self), (gboolean )0);
-    
-    g_return_val_if_fail (self != NULL, (gboolean )0);
-    g_return_val_if_fail (IS_TAPE_DEVICE (self), (gboolean )0);
-
-    if (self->bsr & FEATURE_STATUS_ENABLED) {
+    if (self->bsr) {
         return tape_bsr(self->fd, count);
     } else {
         /* We BSF, then FSR. */
@@ -1290,11 +1499,9 @@ tape_device_bsr (TapeDevice * self, guint count, guint file, guint block) {
 static gboolean 
 tape_device_eod (TapeDevice * self) {
     Device * d_self;
-    g_return_val_if_fail (self != NULL, (gboolean )0);
-    g_return_val_if_fail (IS_TAPE_DEVICE (self), (gboolean )0);
     d_self = (Device*)self;
 
-    if (self->eom & FEATURE_STATUS_ENABLED) {
+    if (self->eom) {
         int result;
         result = tape_eod(self->fd); 
         if (result == TAPE_OP_ERROR) {
@@ -1333,15 +1540,11 @@ tape_device_eod (TapeDevice * self) {
     }
 }
 
-Device *
-tape_device_factory (char * device_type, char * device_name) {
+static Device *
+tape_device_factory (char * device_name, char * device_type, char * device_node) {
     Device * rval;
     g_assert(0 == strcmp(device_type, "tape"));
     rval = DEVICE(g_object_new(TYPE_TAPE_DEVICE, NULL));
-    if (!device_open_device(rval, device_name)) {
-        g_object_unref(rval);
-        return NULL;
-    } else {
-        return rval;
-    }
+    device_open_device(rval, device_name, device_type, device_node);
+    return rval;
 }
index 7bfa1daa6ea24727ad5e92e7421a4da13bd2465a..201fcb78fb936174cf37c38166154b8d878c3a60 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+ * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
  * 
  * This library is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License version 2.1 as 
@@ -14,8 +14,8 @@
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  * 
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 #ifndef TAPE_DEVICE_H
 
 #include <device.h>
 
+/* Unlike other Device classes, this class is implemented across multiple source
+ * files, so its class declaration is placed in a header file.
+ */
+
 /*
  * Type checking and casting macros
  */
+
 #define TYPE_TAPE_DEVICE       (tape_device_get_type())
 #define TAPE_DEVICE(obj)       G_TYPE_CHECK_INSTANCE_CAST((obj), tape_device_get_type(), TapeDevice)
 #define TAPE_DEVICE_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), tape_device_get_type(), TapeDevice const)
 #define TAPE_DEVICE_CLASS(klass)       G_TYPE_CHECK_CLASS_CAST((klass), tape_device_get_type(), TapeDeviceClass)
 #define IS_TAPE_DEVICE(obj)    G_TYPE_CHECK_INSTANCE_TYPE((obj), tape_device_get_type ())
-
 #define TAPE_DEVICE_GET_CLASS(obj)     G_TYPE_INSTANCE_GET_CLASS((obj), tape_device_get_type(), TapeDeviceClass)
+GType  tape_device_get_type    (void);
 
 /*
  * Main object structure
@@ -43,13 +48,13 @@ typedef struct _TapeDevice {
 
     /* It should go without saying that all this stuff is
      * look-but-don't-touch. */
-    guint min_block_size, max_block_size, fixed_block_size, read_block_size;
-    FeatureSupportFlags fsf, bsf, fsr, bsr, eom, bsf_after_eom;
+
+    /* characteristics of the device */
+    gboolean fsf, bsf, fsr, bsr, eom, bsf_after_eom, broken_gmt_online;
     int final_filemarks;
-    gboolean compression;
+
     /* 0 if we opened with O_RDWR; error otherwise. */
     gboolean write_open_errno;
-    gboolean first_file; /* Is this the first file in append mode? */
     int fd;
 
     TapeDevicePrivate * private;
@@ -63,13 +68,45 @@ struct _TapeDeviceClass {
        DeviceClass __parent__;
 };
 
+/* Tape device properties. These properties do not exist on non-linear
+   devices. */
+extern DevicePropertyBase device_property_broken_gmt_online;
+#define PROPERTY_BROKEN_GMT_ONLINE (device_property_broken_gmt_online.ID)
 
-/*
- * Public methods
- */
-GType  tape_device_get_type    (void);
-Device*        tape_device_factory     (char * type,
-                                 char * name);
-void    tape_device_register    (void);
+extern DevicePropertyBase device_property_fsf;
+#define PROPERTY_FSF (device_property_fsf.ID)
+
+extern DevicePropertyBase device_property_bsf;
+#define PROPERTY_BSF (device_property_bsf.ID)
+
+extern DevicePropertyBase device_property_fsr;
+#define PROPERTY_FSR (device_property_fsr.ID)
+
+extern DevicePropertyBase device_property_bsr;
+#define PROPERTY_BSR (device_property_bsr.ID)
+
+/* Is EOM supported? Must be able to read file number afterwards as
+   well. */
+extern DevicePropertyBase device_property_eom;
+#define PROPERTY_EOM (device_property_eom.ID)
+
+/* Is it necessary to perform a BSF after EOM? */
+extern DevicePropertyBase device_property_bsf_after_eom;
+#define PROPERTY_BSF_AFTER_EOM (device_property_bsf_after_eom.ID)
+
+/* How many filemarks to write at EOD? (Default is 2).
+ * This property is a G_TYPE_UINT, but can only really be set to 1 or 2. */
+extern DevicePropertyBase device_property_final_filemarks;
+#define PROPERTY_FINAL_FILEMARKS (device_property_final_filemarks.ID)
+
+/* useful callback for tape ops */
+void tape_device_set_capabilities(TapeDevice *self,
+       gboolean fsf, PropertySurety fsf_surety, PropertySource fsf_source,
+       gboolean bsf, PropertySurety bsf_surety, PropertySource bsf_source,
+       gboolean fsr, PropertySurety fsr_surety, PropertySource fsr_source,
+       gboolean bsr, PropertySurety bsr_surety, PropertySource bsr_source,
+       gboolean eom, PropertySurety eom_surety, PropertySource eom_source,
+       gboolean bsf_after_eom, PropertySurety bae_surety, PropertySource bae_source,
+       guint final_filemarks, PropertySurety ff_surety, PropertySource ff_source);
 
 #endif
index bebe28abc3b32ca45c096f3002e49462d51a8f60..8a7d4e10db2393be2d662401cc33e8af402792f0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+ * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
  * 
  * This library is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License version 2.1 as 
@@ -14,8 +14,8 @@
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  * 
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 #ifndef TAPE_OPS_H
 # include <sys/mtio.h>
 #endif
 
-/* Return codes for tape_eod */
-#define TAPE_OP_ERROR -1
-#define TAPE_POSITION_UNKNOWN -2
+/* This file declares functions which are implemented in each of tape-*.c. The
+ * appropriate C file is selected at configure time. */
 
-/* Real Operations (always return FALSE if not implemented). These are
- * implemented in one of tape-{uware,aix,xenix,posix}.c, depending on
- * the platform. */
+/* Real Operations (always return FALSE if not implemented) */
 gboolean tape_rewind(int fd);
 gboolean tape_fsf(int fd, guint count);
 gboolean tape_bsf(int fd, guint count);
 gboolean tape_fsr(int fd, guint count);
 gboolean tape_bsr(int fd, guint count);
-/* Returns tape position file number, or one of the return codes above. */
+
+/* Sets attributes of the device to indicate which of the above operations
+ * are available in this device. */
+void tape_device_detect_capabilities(TapeDevice * self);
+
+/* Returns tape position file number, or one of these: */
+#define TAPE_OP_ERROR -1
+#define TAPE_POSITION_UNKNOWN -2
 gint tape_eod(int fd);
+
 gboolean tape_weof(int fd, guint8 count);
 gboolean tape_setcompression(int fd, gboolean on);
 
-typedef enum {
-    TAPE_CHECK_SUCCESS,
-    TAPE_CHECK_UNKNOWN,
-    TAPE_CHECK_FAILURE
-} TapeCheckResult;
-ReadLabelStatusFlags tape_is_tape_device(int fd);
-TapeCheckResult tape_is_ready(int fd);
-
-/* Also implemented in above files. Sets properties on the device. */
-void tape_device_discover_capabilities(TapeDevice * self);
+DeviceStatusFlags tape_is_tape_device(int fd);
+DeviceStatusFlags tape_is_ready(int fd, TapeDevice *t_self);
 
 #endif
 
index 70e948002f4f72b4fa8cc199f44c53eb4bb0d50f..80e2a50bec6a197d5d97eb72da3bc6ec649f4a08 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+ * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
  * 
  * This library is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License version 2.1 as 
@@ -14,8 +14,8 @@
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  * 
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 #include "amanda.h"
@@ -131,83 +131,60 @@ gboolean tape_setcompression(int fd G_GNUC_UNUSED,
 #endif
 }
 
-ReadLabelStatusFlags tape_is_tape_device(int fd) {
+DeviceStatusFlags tape_is_tape_device(int fd) {
     struct mtop mt;
     mt.mt_op = MTNOP;
     mt.mt_count = 1;
     if (0 == ioctl(fd, MTIOCTOP, &mt)) {
-        return READ_LABEL_STATUS_SUCCESS;
+        return DEVICE_STATUS_SUCCESS;
+#ifdef ENOMEDIUM
+    } else if (errno == ENOMEDIUM) {
+       return DEVICE_STATUS_VOLUME_MISSING;
+#endif
     } else {
-       dbprintf("tape_is_tape_device: ioctl(MTIOCTOP/MTNOP) failed: %s",
+       dbprintf("tape_is_tape_device: ioctl(MTIOCTOP/MTNOP) failed: %s\n",
                 strerror(errno));
        if (errno == EIO) {
            /* some devices return EIO while the drive is busy loading */
-           return READ_LABEL_STATUS_DEVICE_ERROR|READ_LABEL_STATUS_VOLUME_MISSING;
+           return DEVICE_STATUS_DEVICE_ERROR|DEVICE_STATUS_DEVICE_BUSY;
        } else {
-           return READ_LABEL_STATUS_DEVICE_ERROR;
+           return DEVICE_STATUS_DEVICE_ERROR;
        }
     }
 }
 
-TapeCheckResult tape_is_ready(int fd) {
+DeviceStatusFlags tape_is_ready(int fd, TapeDevice *t_self G_GNUC_UNUSED) {
     struct mtget get;
     if (0 == ioctl(fd, MTIOCGET, &get)) {
-#if defined(GMT_DR_OPEN)
-        if (!GMT_DR_OPEN(get.mt_gstat)) {
-            return TAPE_CHECK_SUCCESS;
+#if defined(GMT_ONLINE) || defined(GMT_DR_OPEN)
+        if (1
+#ifdef GMT_ONLINE
+            && (t_self->broken_gmt_online || GMT_ONLINE(get.mt_gstat))
+#endif
+#ifdef GMT_DR_OPEN
+            && !GMT_DR_OPEN(get.mt_gstat)
+#endif
+            ) {
+            return DEVICE_STATUS_SUCCESS;
         } else {
-           dbprintf("tape_is_read: ioctl(MTIOCGET) failed: %s", strerror(errno));
-            return TAPE_CHECK_FAILURE;
+            return DEVICE_STATUS_VOLUME_MISSING;
         }
 #else /* Neither macro is defined. */
-        return TAPE_CHECK_UNKNOWN;
+        return DEVICE_STATUS_SUCCESS;
 #endif
     } else {
-        return TAPE_CHECK_FAILURE;
+        return DEVICE_STATUS_VOLUME_ERROR;
     }
 }
 
-void tape_device_discover_capabilities(TapeDevice * t_self) {
-    Device * self;
-    GValue val;
-
-    self = DEVICE(t_self);
-    g_return_if_fail(self != NULL);
-
-    bzero(&val, sizeof(val));
-    g_value_init(&val, FEATURE_SUPPORT_FLAGS_TYPE);
-
-    g_value_set_flags(&val,
-                      FEATURE_STATUS_ENABLED | FEATURE_SURETY_BAD |
-                      FEATURE_SOURCE_DEFAULT);
-    device_property_set(self, PROPERTY_FSF, &val);
-    
-    g_value_set_flags(&val,
-                      FEATURE_STATUS_ENABLED | FEATURE_SURETY_BAD |
-                      FEATURE_SOURCE_DEFAULT);
-    device_property_set(self, PROPERTY_BSF, &val);
-    
-    g_value_set_flags(&val,
-                      FEATURE_STATUS_ENABLED | FEATURE_SURETY_BAD |
-                      FEATURE_SOURCE_DEFAULT);
-    device_property_set(self, PROPERTY_FSR, &val);
-    
-    g_value_set_flags(&val,
-                      FEATURE_STATUS_ENABLED | FEATURE_SURETY_BAD |
-                      FEATURE_SOURCE_DEFAULT);
-    device_property_set(self, PROPERTY_BSR, &val);
-    
-    g_value_set_flags(&val,
-                      FEATURE_STATUS_ENABLED | FEATURE_SURETY_BAD |
-                      FEATURE_SOURCE_DEFAULT);
-    device_property_set(self, PROPERTY_EOM, &val);
-
-    g_value_set_flags(&val,
-                      FEATURE_STATUS_DISABLED | FEATURE_SURETY_BAD | 
-                      FEATURE_SOURCE_DEFAULT);
-    device_property_set(self, PROPERTY_BSF_AFTER_EOM, &val);
-
-    g_value_unset_init(&val, G_TYPE_UINT);
-    g_value_set_uint(&val, 2);
-    device_property_set(self, PROPERTY_FINAL_FILEMARKS, &val);
+void tape_device_detect_capabilities(TapeDevice * t_self) {
+    tape_device_set_capabilities(t_self,
+       TRUE,  PROPERTY_SURETY_BAD, PROPERTY_SOURCE_DEFAULT, /* fsf*/
+       TRUE,  PROPERTY_SURETY_BAD, PROPERTY_SOURCE_DEFAULT, /* bsf*/
+       TRUE,  PROPERTY_SURETY_BAD, PROPERTY_SOURCE_DEFAULT, /* fsr*/
+       TRUE,  PROPERTY_SURETY_BAD, PROPERTY_SOURCE_DEFAULT, /* bsr*/
+       TRUE,  PROPERTY_SURETY_BAD, PROPERTY_SOURCE_DEFAULT, /* eom*/
+       FALSE, PROPERTY_SURETY_BAD, PROPERTY_SOURCE_DEFAULT, /* bsf_after_eom*/
+       2,     PROPERTY_SURETY_BAD, PROPERTY_SOURCE_DEFAULT  /* final_filemarks*/
+       );
 }
index 0b86761ec5c9c56ce925a12e77540030afc95289..ab13a5ba6d74a6b8431ae1b4026d653832610d1a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+ * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
  * 
  * This library is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License version 2.1 as 
@@ -14,8 +14,8 @@
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  * 
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 /* Tape operations for SVR4 systems. Most of this stuff is based on
@@ -23,6 +23,7 @@
 
 #include <amanda.h>
 #include <tape-ops.h>
+#include "glib-util.h"
 
 /* Uncomment to test on non-SYSV4 systems. */
 /* ---
@@ -63,7 +64,7 @@ gboolean tape_bsr(int fd, guint count) {
     return 0 == ioctl(fd, T_SBB, count);
 }
 
-int tape_eod(int fd) {
+gint tape_eod(int fd G_GNUC_UNUSED) {
     g_assert_not_reached();
     return TAPE_OP_ERROR;
 }
@@ -83,58 +84,29 @@ gboolean tape_setcompression(int fd, gboolean on) {
     return 0 == ioctl(fd, T_SETCOMP, cmd);
 }
 
-ReadLabelStatusFlags tape_is_tape_device(int fd) {
+DeviceStatusFlags tape_is_tape_device(int fd) {
     /* If we can read block information, it's probably a tape device. */
     struct blklen result;
     if (0 == ioctl(fd, T_RDBLKLEN, &result)) {
-        return READ_LABEL_STATUS_SUCCESS;
+        return DEVICE_STATUS_SUCCESS;
     } else {
-       dbprintf("tape_is_tape_device: ioctl(MTIOCTOP/MTNOP) failed: %s",
-                strerror(errno));
-       return READ_LABEL_STATUS_DEVICE_ERROR;
+        return DEVICE_STATUS_DEVICE_ERROR;
     }
 }
 
-TapeCheckResult tape_is_tape_ready(int fd) {
-    return TAPE_CHECK_UNKNOWN;
+DeviceStatusFlags tape_is_ready(int fd G_GNUC_UNUSED, TapeDevice *t_self G_GNUC_UNUSED) {
+    /* No good way to determine this, so assume it's ready */
+    return DEVICE_STATUS_SUCCESS;
 }
 
-void tape_device_discover_capabilities(TapeDevice * t_self) {
-    Device * self;
-    GValue val;
-
-    self = DEVICE(t_self);
-    g_return_if_fail(self != NULL);
-
-    bzero(&val, sizeof(val));
-    g_value_init(&val, FEATURE_SUPPORT_FLAGS_TYPE);
-
-    g_value_set_flags(&val,
-                      FEATURE_STATUS_ENABLED | FEATURE_SURETY_BAD |
-                      FEATURE_SOURCE_DEFAULT);
-    device_property_set(self, PROPERTY_FSF, &val);
-    
-    g_value_set_flags(&val,
-                      FEATURE_STATUS_ENABLED | FEATURE_SURETY_BAD |
-                      FEATURE_SOURCE_DEFAULT);
-    device_property_set(self, PROPERTY_BSF, &val);
-    
-    g_value_set_flags(&val,
-                      FEATURE_STATUS_ENABLED | FEATURE_SURETY_BAD |
-                      FEATURE_SOURCE_DEFAULT);
-    device_property_set(self, PROPERTY_FSR, &val);
-    
-    g_value_set_flags(&val,
-                      FEATURE_STATUS_ENABLED | FEATURE_SURETY_BAD |
-                      FEATURE_SOURCE_DEFAULT);
-    device_property_set(self, PROPERTY_BSR, &val);
-    
-    g_value_set_flags(&val,
-                      FEATURE_STATUS_DISABLED | FEATURE_SURETY_GOOD |
-                      FEATURE_SOURCE_DEFAULT);
-    device_property_set(self, PROPERTY_EOM, &val);
-
-    g_value_unset_init(&val, G_TYPE_UINT);
-    g_value_set_uint(&val, 2);
-    device_property_set(self, PROPERTY_FINAL_FILEMARKS, &val);
+void tape_device_detect_capabilities(TapeDevice * t_self) {
+    tape_device_set_capabilities(t_self,
+       TRUE,  PROPERTY_SURETY_BAD,  PROPERTY_SOURCE_DEFAULT, /* fsf*/
+       TRUE,  PROPERTY_SURETY_BAD,  PROPERTY_SOURCE_DEFAULT, /* bsf*/
+       TRUE,  PROPERTY_SURETY_BAD,  PROPERTY_SOURCE_DEFAULT, /* fsr*/
+       TRUE,  PROPERTY_SURETY_BAD,  PROPERTY_SOURCE_DEFAULT, /* bsr*/
+       FALSE, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DEFAULT, /* eom*/
+       FALSE, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DEFAULT, /* bsf_after_eom*/
+       2,     PROPERTY_SURETY_BAD,  PROPERTY_SOURCE_DEFAULT  /* final_filemarks*/
+       );
 }
index 1890cd20de66e3109463fd0186f567fd4ca53274..0d654433185e520ca8936d21b7fcf41545bfc9b2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+ * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
  * 
  * This library is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License version 2.1 as 
@@ -14,8 +14,8 @@
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  * 
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 /* Tape operations for XENIX systems. Most of this stuff is based on
@@ -25,6 +25,7 @@
 
 #include <amanda.h>
 #include <tape-ops.h>
+#include "glib-util.h"
 
 /* Uncomment to test compilation on non-XENIX systems. */
 /* --- 
@@ -41,35 +42,35 @@ gboolean tape_rewind(int fd) {
 }
 
 gboolean tape_fsf(int fd, guint count) {
-    while (--count >= 0) {
+    while (count-- > 0) {
         if (0 != ioctl(fd, T_RFM))
             return FALSE;
     }
     return TRUE;
 }
 
-gboolean tape_bsf(int fd, guint count) {
+gboolean tape_bsf(int fd G_GNUC_UNUSED, guint count G_GNUC_UNUSED) {
     g_assert_not_reached();
     return FALSE;
 }
 
-gboolean tape_fsr(int fd, guint count) {
+gboolean tape_fsr(int fd G_GNUC_UNUSED, guint count G_GNUC_UNUSED) {
     g_assert_not_reached();
     return FALSE;
 }
 
-gboolean tape_bsr(int fd, guint count) {
+gboolean tape_bsr(int fd G_GNUC_UNUSED, guint count G_GNUC_UNUSED) {
     g_assert_not_reached();
     return FALSE;
 }
 
-gint tape_eod(int fd) {
+gint tape_eod(int fd G_GNUC_UNUSED) {
     g_assert_not_reached();
     return TAPE_OP_ERROR;
 }
 
 gboolean tape_weof(int fd, guint8 count) {
-    while (count -- > 0) {
+    while (count-- > 0) {
         if (0 != ioctl(fd, T_WFM))
             return FALSE;
     } 
@@ -77,62 +78,32 @@ gboolean tape_weof(int fd, guint8 count) {
     return TRUE;
 }
 
-gboolean tape_setcompression(int fd, gboolean on) {
+gboolean tape_setcompression(int fd G_GNUC_UNUSED, gboolean on G_GNUC_UNUSED) {
     return FALSE;
 }
 
-ReadLabelStatusFlags tape_is_tape_device(int fd) {
+DeviceStatusFlags tape_is_tape_device(int fd) {
     struct tape_info result;
     if (0 == ioctl(fd, MT_STATUS, &result)) {
-        return READ_LABEL_STATUS_SUCCESS;
+        return DEVICE_STATUS_SUCCESS;
     } else {
-       dbprintf("tape_is_tape_device: ioctl(MTIOCTOP/MTNOP) failed: %s",
-                strerror(errno));
-       return READ_LABEL_STATUS_DEVICE_ERROR;
+        return DEVICE_STATUS_DEVICE_ERROR;
     }
 }
 
-TapeCheckResult tape_is_ready(int fd) {
+DeviceStatusFlags tape_is_ready(int fd G_GNUC_UNUSED, TapeDevice *t_self G_GNUC_UNUSED) {
     /* We can probably do better. */
-    return TAPE_CHECK_UNKNOWN;
+    return DEVICE_STATUS_SUCCESS;
 }
 
-void tape_device_discover_capabilities(TapeDevice * t_self) {
-    Device * self;
-    GValue val;
-
-    self = DEVICE(t_self);
-    g_return_if_fail(self != NULL);
-
-    bzero(&val, sizeof(val));
-    g_value_init(&val, FEATURE_SUPPORT_FLAGS_TYPE);
-
-    g_value_set_flags(&val,
-                      FEATURE_STATUS_ENABLED | FEATURE_SURETY_BAD |
-                      FEATURE_SOURCE_DEFAULT);
-    device_property_set(self, PROPERTY_FSF, &val);
-    
-    g_value_set_flags(&val,
-                      FEATURE_STATUS_DISABLED | FEATURE_SURETY_GOOD |
-                      FEATURE_SOURCE_DEFAULT);
-    device_property_set(self, PROPERTY_BSF, &val);
-    
-    g_value_set_flags(&val,
-                      FEATURE_STATUS_DISABLED | FEATURE_SURETY_GOOD |
-                      FEATURE_SOURCE_DEFAULT);
-    device_property_set(self, PROPERTY_FSR, &val);
-    
-    g_value_set_flags(&val,
-                      FEATURE_STATUS_DISABLED | FEATURE_SURETY_GOOD |
-                      FEATURE_SOURCE_DEFAULT);
-    device_property_set(self, PROPERTY_BSR, &val);
-    
-    g_value_set_flags(&val,
-                      FEATURE_STATUS_DISABLED | FEATURE_SURETY_GOOD |
-                      FEATURE_SOURCE_DEFAULT);
-    device_property_set(self, PROPERTY_EOM, &val);
-
-    g_value_unset_init(&val, G_TYPE_UINT);
-    g_value_set_uint(&val, 2);
-    device_property_set(self, PROPERTY_FINAL_FILEMARKS, &val);
+void tape_device_detect_capabilities(TapeDevice * t_self) {
+    tape_device_set_capabilities(t_self,
+       TRUE,  PROPERTY_SURETY_BAD,  PROPERTY_SOURCE_DEFAULT, /* fsf*/
+       FALSE, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DEFAULT, /* bsf*/
+       FALSE, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DEFAULT, /* fsr*/
+       FALSE, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DEFAULT, /* bsr*/
+       FALSE, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DEFAULT, /* eom*/
+       FALSE, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DEFAULT, /* bsf_after_eom*/
+       2,     PROPERTY_SURETY_BAD,  PROPERTY_SOURCE_DEFAULT  /* final_filemarks*/
+       );
 }
diff --git a/device-src/tests/Makefile.am b/device-src/tests/Makefile.am
deleted file mode 100644 (file)
index 9c54473..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-# Makefile for Amanda tape library.
-
-INCLUDES =     -I$(top_builddir)/common-src \
-               -I$(top_srcdir)/common-src \
-               -I$(top_srcdir)/gnulib \
-               -I$(top_srcdir)/device-src
-
-# automake-style tests
-
-noinst_PROGRAMS = queue_test device_test $(TESTS)
-
-###
-# Because libamanda includes routines (e.g. regex) provided by some system
-# libraries, and because of the way libtool sets up the command line, we
-# need to list libamanda twice here, first to override the system library
-# routines, and second to pick up any references in the other libraries.
-###
-LDADD = ../../common-src/libamanda.la \
-       ../libamdevice.la \
-       ../../common-src/libamanda.la \
-       ../../gnulib/libgnu.la
-
-
-TESTS = semaphore-test vfs_test
-
-semaphore_test_SOURCES = semaphore-test.c
-
-vfs_test_SOURCES = vfs_test.c
diff --git a/device-src/tests/Makefile.in b/device-src/tests/Makefile.in
deleted file mode 100644 (file)
index 37fe55e..0000000
+++ /dev/null
@@ -1,964 +0,0 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  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@
-
-# Makefile for Amanda tape library.
-
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-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@
-target_triplet = @target@
-noinst_PROGRAMS = queue_test$(EXEEXT) device_test$(EXEEXT) \
-       $(am__EXEEXT_1)
-TESTS = semaphore-test$(EXEEXT) vfs_test$(EXEEXT)
-subdir = device-src/tests
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps =  \
-       $(top_srcdir)/config/macro-archive/ac_define_dir.m4 \
-       $(top_srcdir)/config/macro-archive/ac_prog_perl_version.m4 \
-       $(top_srcdir)/config/macro-archive/ac_prog_swig.m4 \
-       $(top_srcdir)/config/macro-archive/ax_compare_version.m4 \
-       $(top_srcdir)/config/macro-archive/docbook-dtd.m4 \
-       $(top_srcdir)/config/macro-archive/docbook-xslt-min.m4 \
-       $(top_srcdir)/config/macro-archive/docbook-xslt.m4 \
-       $(top_srcdir)/config/macro-archive/xsltproc.m4 \
-       $(top_srcdir)/config/amanda/amplot.m4 \
-       $(top_srcdir)/config/amanda/bsd-security.m4 \
-       $(top_srcdir)/config/amanda/bsdtcp-security.m4 \
-       $(top_srcdir)/config/amanda/bsdudp-security.m4 \
-       $(top_srcdir)/config/amanda/changer.m4 \
-       $(top_srcdir)/config/amanda/components.m4 \
-       $(top_srcdir)/config/amanda/compress.m4 \
-       $(top_srcdir)/config/amanda/config.m4 \
-       $(top_srcdir)/config/amanda/debugging.m4 \
-       $(top_srcdir)/config/amanda/defaults.m4 \
-       $(top_srcdir)/config/amanda/devprefix.m4 \
-       $(top_srcdir)/config/amanda/dirs.m4 \
-       $(top_srcdir)/config/amanda/documentation.m4 \
-       $(top_srcdir)/config/amanda/dumpers.m4 \
-       $(top_srcdir)/config/amanda/flags.m4 \
-       $(top_srcdir)/config/amanda/flock.m4 \
-       $(top_srcdir)/config/amanda/funcs.m4 \
-       $(top_srcdir)/config/amanda/getfsent.m4 \
-       $(top_srcdir)/config/amanda/i18n.m4 \
-       $(top_srcdir)/config/amanda/ipv6.m4 \
-       $(top_srcdir)/config/amanda/krb4-security.m4 \
-       $(top_srcdir)/config/amanda/krb5-security.m4 \
-       $(top_srcdir)/config/amanda/lfs.m4 \
-       $(top_srcdir)/config/amanda/libs.m4 \
-       $(top_srcdir)/config/amanda/net.m4 \
-       $(top_srcdir)/config/amanda/progs.m4 \
-       $(top_srcdir)/config/amanda/readdir.m4 \
-       $(top_srcdir)/config/amanda/readline.m4 \
-       $(top_srcdir)/config/amanda/rsh-security.m4 \
-       $(top_srcdir)/config/amanda/s3-device.m4 \
-       $(top_srcdir)/config/amanda/shmem.m4 \
-       $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \
-       $(top_srcdir)/config/amanda/ssh-security.m4 \
-       $(top_srcdir)/config/amanda/summary.m4 \
-       $(top_srcdir)/config/amanda/swig.m4 \
-       $(top_srcdir)/config/amanda/syshacks.m4 \
-       $(top_srcdir)/config/amanda/tape.m4 \
-       $(top_srcdir)/config/amanda/types.m4 \
-       $(top_srcdir)/config/amanda/userid.m4 \
-       $(top_srcdir)/config/amanda/version.m4 \
-       $(top_srcdir)/config/gnulib/alloca.m4 \
-       $(top_srcdir)/config/gnulib/arpa_inet_h.m4 \
-       $(top_srcdir)/config/gnulib/base64.m4 \
-       $(top_srcdir)/config/gnulib/eoverflow.m4 \
-       $(top_srcdir)/config/gnulib/extensions.m4 \
-       $(top_srcdir)/config/gnulib/float_h.m4 \
-       $(top_srcdir)/config/gnulib/fsusage.m4 \
-       $(top_srcdir)/config/gnulib/getaddrinfo.m4 \
-       $(top_srcdir)/config/gnulib/gettimeofday.m4 \
-       $(top_srcdir)/config/gnulib/gnulib-comp.m4 \
-       $(top_srcdir)/config/gnulib/include_next.m4 \
-       $(top_srcdir)/config/gnulib/inet_ntop.m4 \
-       $(top_srcdir)/config/gnulib/intmax_t.m4 \
-       $(top_srcdir)/config/gnulib/lock.m4 \
-       $(top_srcdir)/config/gnulib/longlong.m4 \
-       $(top_srcdir)/config/gnulib/malloc.m4 \
-       $(top_srcdir)/config/gnulib/mkdtemp.m4 \
-       $(top_srcdir)/config/gnulib/netinet_in_h.m4 \
-       $(top_srcdir)/config/gnulib/onceonly_2_57.m4 \
-       $(top_srcdir)/config/gnulib/physmem.m4 \
-       $(top_srcdir)/config/gnulib/safe-read.m4 \
-       $(top_srcdir)/config/gnulib/safe-write.m4 \
-       $(top_srcdir)/config/gnulib/snprintf.m4 \
-       $(top_srcdir)/config/gnulib/socklen.m4 \
-       $(top_srcdir)/config/gnulib/sockpfaf.m4 \
-       $(top_srcdir)/config/gnulib/ssize_t.m4 \
-       $(top_srcdir)/config/gnulib/stdbool.m4 \
-       $(top_srcdir)/config/gnulib/stdint.m4 \
-       $(top_srcdir)/config/gnulib/stdio_h.m4 \
-       $(top_srcdir)/config/gnulib/stdlib_h.m4 \
-       $(top_srcdir)/config/gnulib/strdup.m4 \
-       $(top_srcdir)/config/gnulib/string_h.m4 \
-       $(top_srcdir)/config/gnulib/sys_socket_h.m4 \
-       $(top_srcdir)/config/gnulib/sys_stat_h.m4 \
-       $(top_srcdir)/config/gnulib/sys_time_h.m4 \
-       $(top_srcdir)/config/gnulib/tempname.m4 \
-       $(top_srcdir)/config/gnulib/ulonglong.m4 \
-       $(top_srcdir)/config/gnulib/unistd_h.m4 \
-       $(top_srcdir)/config/gnulib/vasnprintf.m4 \
-       $(top_srcdir)/config/gnulib/visibility.m4 \
-       $(top_srcdir)/config/gnulib/wchar.m4 \
-       $(top_srcdir)/config/gettext-macros/gettext.m4 \
-       $(top_srcdir)/config/gettext-macros/iconv.m4 \
-       $(top_srcdir)/config/gettext-macros/inttypes_h.m4 \
-       $(top_srcdir)/config/gettext-macros/lib-ld.m4 \
-       $(top_srcdir)/config/gettext-macros/lib-link.m4 \
-       $(top_srcdir)/config/gettext-macros/lib-prefix.m4 \
-       $(top_srcdir)/config/gettext-macros/longlong.m4 \
-       $(top_srcdir)/config/gettext-macros/nls.m4 \
-       $(top_srcdir)/config/gettext-macros/po.m4 \
-       $(top_srcdir)/config/gettext-macros/progtest.m4 \
-       $(top_srcdir)/config/gettext-macros/size_max.m4 \
-       $(top_srcdir)/config/gettext-macros/stdint_h.m4 \
-       $(top_srcdir)/config/gettext-macros/wchar_t.m4 \
-       $(top_srcdir)/config/gettext-macros/wint_t.m4 \
-       $(top_srcdir)/config/gettext-macros/xsize.m4 \
-       $(top_srcdir)/config/libtool.m4 $(top_srcdir)/configure.in
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-       $(ACLOCAL_M4)
-mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
-CONFIG_HEADER = $(top_builddir)/config/config.h
-CONFIG_CLEAN_FILES =
-am__EXEEXT_1 = semaphore-test$(EXEEXT) vfs_test$(EXEEXT)
-PROGRAMS = $(noinst_PROGRAMS)
-device_test_SOURCES = device_test.c
-device_test_OBJECTS = device_test.$(OBJEXT)
-device_test_LDADD = $(LDADD)
-device_test_DEPENDENCIES = ../../common-src/libamanda.la \
-       ../libamdevice.la ../../common-src/libamanda.la \
-       ../../gnulib/libgnu.la
-queue_test_SOURCES = queue_test.c
-queue_test_OBJECTS = queue_test.$(OBJEXT)
-queue_test_LDADD = $(LDADD)
-queue_test_DEPENDENCIES = ../../common-src/libamanda.la \
-       ../libamdevice.la ../../common-src/libamanda.la \
-       ../../gnulib/libgnu.la
-am_semaphore_test_OBJECTS = semaphore-test.$(OBJEXT)
-semaphore_test_OBJECTS = $(am_semaphore_test_OBJECTS)
-semaphore_test_LDADD = $(LDADD)
-semaphore_test_DEPENDENCIES = ../../common-src/libamanda.la \
-       ../libamdevice.la ../../common-src/libamanda.la \
-       ../../gnulib/libgnu.la
-am_vfs_test_OBJECTS = vfs_test.$(OBJEXT)
-vfs_test_OBJECTS = $(am_vfs_test_OBJECTS)
-vfs_test_LDADD = $(LDADD)
-vfs_test_DEPENDENCIES = ../../common-src/libamanda.la \
-       ../libamdevice.la ../../common-src/libamanda.la \
-       ../../gnulib/libgnu.la
-DEFAULT_INCLUDES = -I. -I$(top_builddir)/config@am__isrc@
-depcomp = $(SHELL) $(top_srcdir)/config/depcomp
-am__depfiles_maybe = depfiles
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-       --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
-       $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-       --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
-       $(LDFLAGS) -o $@
-SOURCES = device_test.c queue_test.c $(semaphore_test_SOURCES) \
-       $(vfs_test_SOURCES)
-DIST_SOURCES = device_test.c queue_test.c $(semaphore_test_SOURCES) \
-       $(vfs_test_SOURCES)
-ETAGS = etags
-CTAGS = ctags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-ALLOCA = @ALLOCA@
-ALLOCA_H = @ALLOCA_H@
-AMANDA_DBGDIR = @AMANDA_DBGDIR@
-AMANDA_DEBUG_DAYS = @AMANDA_DEBUG_DAYS@
-AMANDA_STATIC_LDFLAGS = @AMANDA_STATIC_LDFLAGS@
-AMANDA_TMPDIR = @AMANDA_TMPDIR@
-AMANDA_WARNING_CFLAGS = @AMANDA_WARNING_CFLAGS@
-AMLINT = @AMLINT@
-AMLINTFLAGS = @AMLINTFLAGS@
-AMPLOT_CAT_COMPRESS = @AMPLOT_CAT_COMPRESS@
-AMPLOT_CAT_GZIP = @AMPLOT_CAT_GZIP@
-AMPLOT_CAT_PACK = @AMPLOT_CAT_PACK@
-AMPLOT_COMPRESS = @AMPLOT_COMPRESS@
-AMTAR = @AMTAR@
-AR = @AR@
-ARPA_INET_H = @ARPA_INET_H@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-BASH = @BASH@
-BINARY_OWNER = @BINARY_OWNER@
-BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@
-BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@
-BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@
-BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@
-BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@
-CAT = @CAT@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
-CHIO = @CHIO@
-CHS = @CHS@
-CLIENT_LOGIN = @CLIENT_LOGIN@
-CLIENT_SCRIPTS_OPT = @CLIENT_SCRIPTS_OPT@
-COMPRESS = @COMPRESS@
-CONFIG_DIR = @CONFIG_DIR@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CURL_CONFIG = @CURL_CONFIG@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DD = @DD@
-DEFAULT_AMANDATES_FILE = @DEFAULT_AMANDATES_FILE@
-DEFAULT_CHANGER_DEVICE = @DEFAULT_CHANGER_DEVICE@
-DEFAULT_CONFIG = @DEFAULT_CONFIG@
-DEFAULT_SERVER = @DEFAULT_SERVER@
-DEFAULT_TAPE_DEVICE = @DEFAULT_TAPE_DEVICE@
-DEFAULT_TAPE_SERVER = @DEFAULT_TAPE_SERVER@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DOC_BUILD_DATE = @DOC_BUILD_DATE@
-DUMP = @DUMP@
-DUMPER_DIR = @DUMPER_DIR@
-ECHO = @ECHO@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EOVERFLOW = @EOVERFLOW@
-EXAMPLE_TAPEDEV = @EXAMPLE_TAPEDEV@
-EXEEXT = @EXEEXT@
-F77 = @F77@
-FFLAGS = @FFLAGS@
-FLOAT_H = @FLOAT_H@
-GETCONF = @GETCONF@
-GETTEXT = @GETTEXT@
-GLIB_CFLAGS = @GLIB_CFLAGS@
-GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
-GLIB_LIBS = @GLIB_LIBS@
-GLIB_MKENUMS = @GLIB_MKENUMS@
-GMSGFMT = @GMSGFMT@
-GMSGFMT_015 = @GMSGFMT_015@
-GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
-GNULIB_CHOWN = @GNULIB_CHOWN@
-GNULIB_DUP2 = @GNULIB_DUP2@
-GNULIB_FCHDIR = @GNULIB_FCHDIR@
-GNULIB_FFLUSH = @GNULIB_FFLUSH@
-GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
-GNULIB_FSEEK = @GNULIB_FSEEK@
-GNULIB_FSEEKO = @GNULIB_FSEEKO@
-GNULIB_FTELL = @GNULIB_FTELL@
-GNULIB_FTELLO = @GNULIB_FTELLO@
-GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@
-GNULIB_GETCWD = @GNULIB_GETCWD@
-GNULIB_GETDELIM = @GNULIB_GETDELIM@
-GNULIB_GETLINE = @GNULIB_GETLINE@
-GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
-GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
-GNULIB_LCHOWN = @GNULIB_LCHOWN@
-GNULIB_LSEEK = @GNULIB_LSEEK@
-GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@
-GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@
-GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@
-GNULIB_MBSCHR = @GNULIB_MBSCHR@
-GNULIB_MBSCSPN = @GNULIB_MBSCSPN@
-GNULIB_MBSLEN = @GNULIB_MBSLEN@
-GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@
-GNULIB_MBSNLEN = @GNULIB_MBSNLEN@
-GNULIB_MBSPBRK = @GNULIB_MBSPBRK@
-GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@
-GNULIB_MBSRCHR = @GNULIB_MBSRCHR@
-GNULIB_MBSSEP = @GNULIB_MBSSEP@
-GNULIB_MBSSPN = @GNULIB_MBSSPN@
-GNULIB_MBSSTR = @GNULIB_MBSSTR@
-GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@
-GNULIB_MEMMEM = @GNULIB_MEMMEM@
-GNULIB_MEMPCPY = @GNULIB_MEMPCPY@
-GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
-GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
-GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
-GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
-GNULIB_READLINK = @GNULIB_READLINK@
-GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@
-GNULIB_SLEEP = @GNULIB_SLEEP@
-GNULIB_SNPRINTF = @GNULIB_SNPRINTF@
-GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@
-GNULIB_STPCPY = @GNULIB_STPCPY@
-GNULIB_STPNCPY = @GNULIB_STPNCPY@
-GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
-GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
-GNULIB_STRDUP = @GNULIB_STRDUP@
-GNULIB_STRNDUP = @GNULIB_STRNDUP@
-GNULIB_STRNLEN = @GNULIB_STRNLEN@
-GNULIB_STRPBRK = @GNULIB_STRPBRK@
-GNULIB_STRSEP = @GNULIB_STRSEP@
-GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
-GNULIB_VASPRINTF = @GNULIB_VASPRINTF@
-GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@
-GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
-GNULIB_VSNPRINTF = @GNULIB_VSNPRINTF@
-GNULIB_VSPRINTF_POSIX = @GNULIB_VSPRINTF_POSIX@
-GNULIB_WCWIDTH = @GNULIB_WCWIDTH@
-GNUPLOT = @GNUPLOT@
-GNUTAR = @GNUTAR@
-GNUTAR_LISTED_INCREMENTAL_DIR = @GNUTAR_LISTED_INCREMENTAL_DIR@
-GOBJECT_QUERY = @GOBJECT_QUERY@
-GREP = @GREP@
-GZIP = @GZIP@
-HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@
-HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@
-HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@
-HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
-HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@
-HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
-HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@
-HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
-HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
-HAVE_DECL_STRNCASECMP = @HAVE_DECL_STRNCASECMP@
-HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
-HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
-HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
-HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
-HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
-HAVE_DUP2 = @HAVE_DUP2@
-HAVE_FSEEKO = @HAVE_FSEEKO@
-HAVE_FTELLO = @HAVE_FTELLO@
-HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
-HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
-HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
-HAVE_IO_H = @HAVE_IO_H@
-HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
-HAVE_LSTAT = @HAVE_LSTAT@
-HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@
-HAVE_MEMPCPY = @HAVE_MEMPCPY@
-HAVE_MKDTEMP = @HAVE_MKDTEMP@
-HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@
-HAVE_READLINK = @HAVE_READLINK@
-HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@
-HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
-HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
-HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
-HAVE_SLEEP = @HAVE_SLEEP@
-HAVE_STDINT_H = @HAVE_STDINT_H@
-HAVE_STPCPY = @HAVE_STPCPY@
-HAVE_STPNCPY = @HAVE_STPNCPY@
-HAVE_STRCASECMP = @HAVE_STRCASECMP@
-HAVE_STRCASESTR = @HAVE_STRCASESTR@
-HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
-HAVE_STRNDUP = @HAVE_STRNDUP@
-HAVE_STRPBRK = @HAVE_STRPBRK@
-HAVE_STRSEP = @HAVE_STRSEP@
-HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@
-HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
-HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
-HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
-HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
-HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
-HAVE_UNISTD_H = @HAVE_UNISTD_H@
-HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
-HAVE_VASPRINTF = @HAVE_VASPRINTF@
-HAVE_VISIBILITY = @HAVE_VISIBILITY@
-HAVE_WCHAR_H = @HAVE_WCHAR_H@
-HAVE_WINSOCK2_H = @HAVE_WINSOCK2_H@
-HAVE_WS2TCPIP_H = @HAVE_WS2TCPIP_H@
-HAVE__BOOL = @HAVE__BOOL@
-INCLUDE_NEXT = @INCLUDE_NEXT@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-INTLLIBS = @INTLLIBS@
-INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
-LDFLAGS = @LDFLAGS@
-LEX = @LEX@
-LEXLIB = @LEXLIB@
-LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
-LIBCURL = @LIBCURL@
-LIBCURL_CPPFLAGS = @LIBCURL_CPPFLAGS@
-LIBICONV = @LIBICONV@
-LIBINTL = @LIBINTL@
-LIBMULTITHREAD = @LIBMULTITHREAD@
-LIBOBJS = @LIBOBJS@
-LIBPTH = @LIBPTH@
-LIBS = @LIBS@
-LIBTHREAD = @LIBTHREAD@
-LIBTOOL = @LIBTOOL@
-LIBTOOL_DEPS = @LIBTOOL_DEPS@
-LN_S = @LN_S@
-LTLIBICONV = @LTLIBICONV@
-LTLIBINTL = @LTLIBINTL@
-LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
-LTLIBOBJS = @LTLIBOBJS@
-LTLIBPTH = @LTLIBPTH@
-LTLIBTHREAD = @LTLIBTHREAD@
-MAILER = @MAILER@
-MAKEINFO = @MAKEINFO@
-MAXTAPEBLOCKSIZE = @MAXTAPEBLOCKSIZE@
-MCUTIL = @MCUTIL@
-MKDIR_P = @MKDIR_P@
-MSGFMT = @MSGFMT@
-MSGFMT_015 = @MSGFMT_015@
-MSGMERGE = @MSGMERGE@
-MT = @MT@
-MTX = @MTX@
-MT_FILE_FLAG = @MT_FILE_FLAG@
-NETINET_IN_H = @NETINET_IN_H@
-NEXT_FLOAT_H = @NEXT_FLOAT_H@
-NEXT_NETINET_IN_H = @NEXT_NETINET_IN_H@
-NEXT_STDINT_H = @NEXT_STDINT_H@
-NEXT_STDIO_H = @NEXT_STDIO_H@
-NEXT_STDLIB_H = @NEXT_STDLIB_H@
-NEXT_STRING_H = @NEXT_STRING_H@
-NEXT_SYS_SOCKET_H = @NEXT_SYS_SOCKET_H@
-NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@
-NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@
-NEXT_UNISTD_H = @NEXT_UNISTD_H@
-NEXT_WCHAR_H = @NEXT_WCHAR_H@
-OBJEXT = @OBJEXT@
-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@
-PCAT = @PCAT@
-PERL = @PERL@
-PERLEXTLIBS = @PERLEXTLIBS@
-PERL_INC = @PERL_INC@
-PKG_CONFIG = @PKG_CONFIG@
-POSUB = @POSUB@
-PRINT = @PRINT@
-PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
-RANLIB = @RANLIB@
-READLINE_LIBS = @READLINE_LIBS@
-REPLACE_CHOWN = @REPLACE_CHOWN@
-REPLACE_FCHDIR = @REPLACE_FCHDIR@
-REPLACE_FFLUSH = @REPLACE_FFLUSH@
-REPLACE_FPRINTF = @REPLACE_FPRINTF@
-REPLACE_FSEEK = @REPLACE_FSEEK@
-REPLACE_FSEEKO = @REPLACE_FSEEKO@
-REPLACE_FTELL = @REPLACE_FTELL@
-REPLACE_FTELLO = @REPLACE_FTELLO@
-REPLACE_GETCWD = @REPLACE_GETCWD@
-REPLACE_GETLINE = @REPLACE_GETLINE@
-REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
-REPLACE_LCHOWN = @REPLACE_LCHOWN@
-REPLACE_LSEEK = @REPLACE_LSEEK@
-REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
-REPLACE_PRINTF = @REPLACE_PRINTF@
-REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
-REPLACE_SPRINTF = @REPLACE_SPRINTF@
-REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
-REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
-REPLACE_VPRINTF = @REPLACE_VPRINTF@
-REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
-REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
-REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
-RESTORE = @RESTORE@
-SAMBA_CLIENT = @SAMBA_CLIENT@
-SERVICE_SUFFIX = @SERVICE_SUFFIX@
-SETUID_GROUP = @SETUID_GROUP@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@
-SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
-SNAPSHOT_STAMP = @SNAPSHOT_STAMP@
-SORT = @SORT@
-SSH = @SSH@
-STDBOOL_H = @STDBOOL_H@
-STDINT_H = @STDINT_H@
-STRIP = @STRIP@
-SVN = @SVN@
-SWIG = @SWIG@
-SWIG_LIB = @SWIG_LIB@
-SYS_SOCKET_H = @SYS_SOCKET_H@
-SYS_STAT_H = @SYS_STAT_H@
-SYS_TIME_H = @SYS_TIME_H@
-USE_NLS = @USE_NLS@
-USE_VERSION_SUFFIXES = @USE_VERSION_SUFFIXES@
-VDUMP = @VDUMP@
-VERSION = @VERSION@
-VERSION_COMMENT = @VERSION_COMMENT@
-VERSION_MAJOR = @VERSION_MAJOR@
-VERSION_MINOR = @VERSION_MINOR@
-VERSION_PATCH = @VERSION_PATCH@
-VERSION_SUFFIX = @VERSION_SUFFIX@
-VRESTORE = @VRESTORE@
-VXDUMP = @VXDUMP@
-VXRESTORE = @VXRESTORE@
-WCHAR_H = @WCHAR_H@
-WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@
-WINT_T_SUFFIX = @WINT_T_SUFFIX@
-XFSDUMP = @XFSDUMP@
-XFSRESTORE = @XFSRESTORE@
-XGETTEXT = @XGETTEXT@
-XGETTEXT_015 = @XGETTEXT_015@
-XSLREL = @XSLREL@
-XSLTPROC = @XSLTPROC@
-XSLTPROC_FLAGS = @XSLTPROC_FLAGS@
-YACC = @YACC@
-YFLAGS = @YFLAGS@
-_libcurl_config = @_libcurl_config@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-amincludedir = @amincludedir@
-amlibdir = @amlibdir@
-amlibexecdir = @amlibexecdir@
-amperldir = @amperldir@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-gl_LIBOBJS = @gl_LIBOBJS@
-gl_LTLIBOBJS = @gl_LTLIBOBJS@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target = @target@
-target_alias = @target_alias@
-target_cpu = @target_cpu@
-target_os = @target_os@
-target_vendor = @target_vendor@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-INCLUDES = -I$(top_builddir)/common-src \
-               -I$(top_srcdir)/common-src \
-               -I$(top_srcdir)/gnulib \
-               -I$(top_srcdir)/device-src
-
-
-###
-# Because libamanda includes routines (e.g. regex) provided by some system
-# libraries, and because of the way libtool sets up the command line, we
-# need to list libamanda twice here, first to override the system library
-# routines, and second to pick up any references in the other libraries.
-###
-LDADD = ../../common-src/libamanda.la \
-       ../libamdevice.la \
-       ../../common-src/libamanda.la \
-       ../../gnulib/libgnu.la
-
-semaphore_test_SOURCES = semaphore-test.c
-vfs_test_SOURCES = vfs_test.c
-all: all-am
-
-.SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
-       @for dep in $?; do \
-         case '$(am__configure_deps)' in \
-           *$$dep*) \
-             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-               && exit 0; \
-             exit 1;; \
-         esac; \
-       done; \
-       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  device-src/tests/Makefile'; \
-       cd $(top_srcdir) && \
-         $(AUTOMAKE) --gnu  device-src/tests/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-       @case '$?' in \
-         *config.status*) \
-           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
-         *) \
-           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
-       esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure:  $(am__configure_deps)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-clean-noinstPROGRAMS:
-       @list='$(noinst_PROGRAMS)'; for p in $$list; do \
-         f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
-         echo " rm -f $$p $$f"; \
-         rm -f $$p $$f ; \
-       done
-device_test$(EXEEXT): $(device_test_OBJECTS) $(device_test_DEPENDENCIES) 
-       @rm -f device_test$(EXEEXT)
-       $(LINK) $(device_test_OBJECTS) $(device_test_LDADD) $(LIBS)
-queue_test$(EXEEXT): $(queue_test_OBJECTS) $(queue_test_DEPENDENCIES) 
-       @rm -f queue_test$(EXEEXT)
-       $(LINK) $(queue_test_OBJECTS) $(queue_test_LDADD) $(LIBS)
-semaphore-test$(EXEEXT): $(semaphore_test_OBJECTS) $(semaphore_test_DEPENDENCIES) 
-       @rm -f semaphore-test$(EXEEXT)
-       $(LINK) $(semaphore_test_OBJECTS) $(semaphore_test_LDADD) $(LIBS)
-vfs_test$(EXEEXT): $(vfs_test_OBJECTS) $(vfs_test_DEPENDENCIES) 
-       @rm -f vfs_test$(EXEEXT)
-       $(LINK) $(vfs_test_OBJECTS) $(vfs_test_LDADD) $(LIBS)
-
-mostlyclean-compile:
-       -rm -f *.$(OBJEXT)
-
-distclean-compile:
-       -rm -f *.tab.c
-
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/device_test.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/queue_test.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/semaphore-test.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vfs_test.Po@am__quote@
-
-.c.o:
-@am__fastdepCC_TRUE@   $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@   mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@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@   $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@   mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@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) '$<'`
-
-.c.lo:
-@am__fastdepCC_TRUE@   $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@   mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LTCOMPILE) -c -o $@ $<
-
-mostlyclean-libtool:
-       -rm -f *.lo
-
-clean-libtool:
-       -rm -rf .libs _libs
-
-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:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-               $(TAGS_FILES) $(LISP)
-       tags=; \
-       here=`pwd`; \
-       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; }'`; \
-       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:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-               $(TAGS_FILES) $(LISP)
-       tags=; \
-       here=`pwd`; \
-       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; }'`; \
-       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
-
-check-TESTS: $(TESTS)
-       @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[        ]'; \
-       srcdir=$(srcdir); export srcdir; \
-       list=' $(TESTS) '; \
-       if test -n "$$list"; then \
-         for tst in $$list; do \
-           if test -f ./$$tst; then dir=./; \
-           elif test -f $$tst; then dir=; \
-           else dir="$(srcdir)/"; fi; \
-           if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
-             all=`expr $$all + 1`; \
-             case " $(XFAIL_TESTS) " in \
-             *$$ws$$tst$$ws*) \
-               xpass=`expr $$xpass + 1`; \
-               failed=`expr $$failed + 1`; \
-               echo "XPASS: $$tst"; \
-             ;; \
-             *) \
-               echo "PASS: $$tst"; \
-             ;; \
-             esac; \
-           elif test $$? -ne 77; then \
-             all=`expr $$all + 1`; \
-             case " $(XFAIL_TESTS) " in \
-             *$$ws$$tst$$ws*) \
-               xfail=`expr $$xfail + 1`; \
-               echo "XFAIL: $$tst"; \
-             ;; \
-             *) \
-               failed=`expr $$failed + 1`; \
-               echo "FAIL: $$tst"; \
-             ;; \
-             esac; \
-           else \
-             skip=`expr $$skip + 1`; \
-             echo "SKIP: $$tst"; \
-           fi; \
-         done; \
-         if test "$$failed" -eq 0; then \
-           if test "$$xfail" -eq 0; then \
-             banner="All $$all tests passed"; \
-           else \
-             banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
-           fi; \
-         else \
-           if test "$$xpass" -eq 0; then \
-             banner="$$failed of $$all tests failed"; \
-           else \
-             banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
-           fi; \
-         fi; \
-         dashes="$$banner"; \
-         skipped=""; \
-         if test "$$skip" -ne 0; then \
-           skipped="($$skip tests were not run)"; \
-           test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
-             dashes="$$skipped"; \
-         fi; \
-         report=""; \
-         if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
-           report="Please report to $(PACKAGE_BUGREPORT)"; \
-           test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
-             dashes="$$report"; \
-         fi; \
-         dashes=`echo "$$dashes" | sed s/./=/g`; \
-         echo "$$dashes"; \
-         echo "$$banner"; \
-         test -z "$$skipped" || echo "$$skipped"; \
-         test -z "$$report" || echo "$$report"; \
-         echo "$$dashes"; \
-         test "$$failed" -eq 0; \
-       else :; fi
-
-distdir: $(DISTFILES)
-       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-       list='$(DISTFILES)'; \
-         dist_files=`for file in $$list; do echo $$file; done | \
-         sed -e "s|^$$srcdirstrip/||;t" \
-             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
-       case $$dist_files in \
-         */*) $(MKDIR_P) `echo "$$dist_files" | \
-                          sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
-                          sort -u` ;; \
-       esac; \
-       for file in $$dist_files; do \
-         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-         if test -d $$d/$$file; then \
-           dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
-           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
-check-am: all-am
-       $(MAKE) $(AM_MAKEFLAGS) check-TESTS
-check: check-am
-all-am: Makefile $(PROGRAMS)
-installdirs:
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
-       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-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:
-
-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-am
-
-clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
-       mostlyclean-am
-
-distclean: distclean-am
-       -rm -rf ./$(DEPDIR)
-       -rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
-       distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-am
-
-install-exec-am:
-
-install-html: install-html-am
-
-install-info: install-info-am
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-ps: install-ps-am
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
-       -rm -rf ./$(DEPDIR)
-       -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
-       mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am:
-
-.MAKE: install-am install-strip
-
-.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
-       clean-generic clean-libtool clean-noinstPROGRAMS ctags \
-       distclean distclean-compile distclean-generic \
-       distclean-libtool distclean-tags distdir dvi dvi-am html \
-       html-am info info-am install install-am install-data \
-       install-data-am install-dvi install-dvi-am install-exec \
-       install-exec-am install-html install-html-am install-info \
-       install-info-am install-man install-pdf install-pdf-am \
-       install-ps install-ps-am install-strip installcheck \
-       installcheck-am installdirs maintainer-clean \
-       maintainer-clean-generic mostlyclean mostlyclean-compile \
-       mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-       tags uninstall uninstall-am
-
-# 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/device-src/tests/device_test.c b/device-src/tests/device_test.c
deleted file mode 100644 (file)
index 9a46fee..0000000
+++ /dev/null
@@ -1,198 +0,0 @@
-#include <device.h>
-#include <amanda.h>
-#include <timestamp.h>
-
-int blocksize;
-unsigned int seed = 0;
-
-static char * make_rand_buf(int size) {
-    char * rval;
-    unsigned int i;
-
-    rval = malloc(size);
-    i = size;
-    while (i > sizeof(int)) {
-        int rand;
-        rand = rand_r(&seed);
-        memcpy(rval + size - i, &rand, sizeof(int));
-        i -= sizeof(int);
-    }
-    
-    if (size > 0) {
-        int rand;
-        rand = rand_r(&seed);
-        memcpy(rval + size - i, &rand, i);
-    }
-
-    return rval;
-}
-
-static gboolean write_whole_file(Device * device) {
-    dumpfile_t dumpfile;
-    char * tmp;
-    int i;
-
-    fh_init(&dumpfile);
-    dumpfile.type = F_DUMPFILE;
-    tmp = get_timestamp_from_time(time(NULL));
-    strcpy(dumpfile.datestamp, tmp);
-    amfree(tmp);
-    strcpy(dumpfile.name, "localhost");
-    tmp = g_get_current_dir();
-    strcpy(dumpfile.disk, tmp);
-    amfree(tmp);
-    strcpy(dumpfile.program, "TESTER");
-    strcpy(dumpfile.recover_cmd, "recover_cmd");
-
-    blocksize = device_write_max_size(device);
-    
-    g_return_val_if_fail(device_start_file(device, &dumpfile), FALSE);
-    
-    for (i = 0; i < 1000; i ++) {
-        int size;
-        char * buf;
-        if (i == 999)
-            size = blocksize / 2;
-        else
-            size = blocksize;
-        buf = make_rand_buf(size);
-        g_return_val_if_fail(device_write_block(device, size, buf, i == 999),
-                             FALSE);
-        amfree(buf);
-    }
-    
-    g_return_val_if_fail(device->in_file == FALSE, FALSE);
-
-    return TRUE;
-}
-
-static gboolean read_whole_file(Device * device, int fileno) {
-    int size = 0;
-    dumpfile_t * file = device_seek_file(device, fileno + 1);
-    int i;
-    char *buf;
-
-    if (file == NULL)
-        g_assert_not_reached();
-    else
-        amfree(file);
-
-    g_return_val_if_fail(device_seek_block(device, 0), FALSE);
-    
-    g_return_val_if_fail(0 == device_read_block(device, NULL, &size),
-                         FALSE);
-    g_assert(size >= blocksize);
-        
-    for (i = 0; i < 1000; i ++) {
-        int size, size2;
-        char buf2[blocksize];
-        size2 = blocksize;
-        if (i == 999)
-            size = blocksize/2;
-        else
-            size = blocksize;
-        buf = make_rand_buf(size);
-        
-        g_return_val_if_fail(device_read_block(device, buf2, &size2),
-                             FALSE);
-        g_assert(size2 == size || size2 == blocksize);
-        g_assert(memcmp(buf, buf2, size) == 0);
-        amfree(buf);
-    }
-    
-    size = blocksize;
-    buf = malloc(blocksize);
-    g_assert(-1 == device_read_block(device, &buf, &size));
-    g_return_val_if_fail(device->is_eof, FALSE);
-    free(buf);
-
-    return TRUE;
-}
-
-static MediaAccessMode get_medium_type(Device * device) {
-    GValue value;
-    MediaAccessMode rval;
-    
-    bzero(&value, sizeof(value));
-
-    g_return_val_if_fail(device_property_get(device, PROPERTY_MEDIUM_TYPE,
-                                             &value), 0);
-
-    rval = g_value_get_enum(&value);
-    g_value_unset(&value);
-    return rval;
-}
-
-int main(int argc, char ** argv) {
-    Device * device;
-    int h;
-    MediaAccessMode medium_type;
-    
-    g_return_val_if_fail(argc == 2, 1);
-
-    device_api_init();
-
-    device = device_open(argv[1]);
-    g_return_val_if_fail(device != NULL, 2);
-
-    medium_type = get_medium_type(device);
-
-    if (device->volume_label) {
-        printf("Last header: %s %s\n", device->volume_label,
-               device->volume_time);
-    }
-
-    if (medium_type != MEDIA_ACCESS_MODE_READ_ONLY) {
-        g_return_val_if_fail(device_start(device, ACCESS_WRITE, 
-                                          "foo", NULL),
-                             2);
-        
-        for (h = 0; h < 10; h ++) {
-            gboolean appendable;
-            GValue value;
-            g_return_val_if_fail(write_whole_file(device), 3);
-            
-            bzero(&value, sizeof(value));
-            g_return_val_if_fail(device_property_get(device,
-                                                     PROPERTY_APPENDABLE,
-                                                     &value), 4);
-            appendable = g_value_get_boolean(&value);
-            g_value_unset(&value);
-            
-            if (appendable && h == 5) {
-                g_object_unref(device);
-                
-                device = device_open(argv[1]);
-                g_return_val_if_fail(device != NULL, 6);
-                
-                g_return_val_if_fail(device_start(device, ACCESS_APPEND, 
-                                                  "foo", NULL),
-                                     2);
-            }
-        }
-        
-        g_object_unref(device);    
-        
-        device = device_open(argv[1]);
-        g_return_val_if_fail(device != NULL, 6);
-    }
-
-    /* Fixme: check for readable access mode. */
-    if (medium_type != MEDIA_ACCESS_MODE_WRITE_ONLY) {
-        g_return_val_if_fail(device->volume_label, 7);
-        printf("This header: %s %s\n", device->volume_label,
-               device->volume_time);    
-        
-        g_return_val_if_fail(device_start(device, ACCESS_READ, 
-                                          "foo", NULL),
-                             2);
-        seed = 0;
-        for (h = 0; h < 10; h ++) {
-            g_return_val_if_fail(read_whole_file(device, h), 8);
-        }
-    }
-
-    g_object_unref(device);    
-
-    return 0;
-}
diff --git a/device-src/tests/queue_test.c b/device-src/tests/queue_test.c
deleted file mode 100644 (file)
index f6cef95..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <queueing.h>
-#include <device.h>
-#include <amanda.h>
-
-int main(void) {
-    /* ignore SIGPIPE */
-    signal(SIGPIPE, SIG_IGN);
-
-    /* Comment out this line to disable threads. */
-    device_api_init();
-
-    /* The integer here is the block size to use. Set it to something
-     * bigger for better performance. */
-    return !do_consumer_producer_queue_full(fd_read_producer,
-                                            GINT_TO_POINTER(0),
-                                            fd_write_consumer,
-                                            GINT_TO_POINTER(1),
-                                            1,  /* Block size */
-                                            10, /* Buffer size. */
-                                            STREAMING_REQUIREMENT_DESIRED);
-}
diff --git a/device-src/tests/semaphore-test.c b/device-src/tests/semaphore-test.c
deleted file mode 100644 (file)
index 2e523c7..0000000
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License version 2.1 as
- * published by the Free Software Foundation.
- *
- * This 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 this library; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
- *
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
- */
-
-#include "semaphore.h"
-#include "amanda.h"
-#include "util.h"
-
-/*
- * test that decrement waits properly
- */
-
-struct test_decr_wait_data {
-    semaphore_t *sem;
-    gboolean increment_called;
-};
-
-static gpointer
-test_decr_wait_thread(gpointer datap)
-{
-    struct test_decr_wait_data *data = datap;
-
-    /* should block */
-    semaphore_decrement(data->sem, 20);
-
-    /* if increment hasn't been called yet, that's an error. */
-    if (!data->increment_called)
-       return GINT_TO_POINTER(0);
-
-    return GINT_TO_POINTER(1);
-}
-
-static gboolean
-test_decr_wait(void)
-{
-    GThread *th;
-    struct test_decr_wait_data data = { NULL, FALSE };
-    int rv;
-
-    data.sem = semaphore_new_with_value(10),
-
-    /* die after 10 seconds (default signal disposition is to fail) */
-    alarm(10);
-
-    th = g_thread_create(test_decr_wait_thread, (gpointer)&data, TRUE, NULL);
-
-    /* sleep to give semaphore_decrement() a chance to block (or not). */
-    g_usleep(G_USEC_PER_SEC / 4);
-
-    /* and then increment the semaphore enough that the decrement can succeed */
-    data.increment_called = TRUE;
-    semaphore_increment(data.sem, 10);
-
-    /* join the thread and see how it fared. */
-    rv = GPOINTER_TO_INT(g_thread_join(th));
-
-    semaphore_free(data.sem);
-
-    if (rv == 1) {
-       printf(" PASS: semaphore-test.test_decr_wait\n");
-       return TRUE;
-    } else {
-       printf(" FAIL: semaphore-test.test_decr_wait\n");
-       return FALSE;
-    }
-}
-
-
-/*
- * test that semaphore_wait_empty waits properly
- */
-
-static gpointer
-test_wait_empty_thread(gpointer datap)
-{
-    semaphore_t *sem = datap;
-
-    /* should block */
-    semaphore_decrement(sem, 20);
-
-    /* value should be 10 now (decremented from 30) */
-    if (sem->value != 10)
-       return GINT_TO_POINTER(1);
-
-    /* sleep for a bit */
-    g_usleep(G_USEC_PER_SEC / 4);
-
-    /* decrement those last 10, which should trigger the zero */
-    semaphore_decrement(sem, 10);
-
-    return GINT_TO_POINTER(0);
-}
-
-static gboolean
-test_wait_empty(void)
-{
-    GThread *th;
-    semaphore_t *sem = semaphore_new_with_value(10);
-    int rv;
-
-    /* die after 10 seconds (default signal disposition is to fail) */
-    alarm(10);
-
-    th = g_thread_create(test_wait_empty_thread, (gpointer)sem, TRUE, NULL);
-
-    /* sleep to give semaphore_decrement() a chance to block (or not). */
-    g_usleep(G_USEC_PER_SEC / 4);
-
-    /* add another 10, so decrement can hit zero next time it's called */
-    semaphore_increment(sem, 10);
-
-    /* and wait on the semaphore emptying */
-    semaphore_wait_empty(sem);
-
-    /* join the thread and see how it fared. */
-    rv = GPOINTER_TO_INT(g_thread_join(th));
-
-    semaphore_free(sem);
-
-    if (rv == 1) {
-       printf(" PASS: semaphore-test.test_wait_empty\n");
-       return TRUE;
-    } else {
-       printf(" FAIL: semaphore-test.test_wait_empty\n");
-       return FALSE;
-    }
-}
-
-/*
- * test that semaphore_force_adjust correctly wakes both
- * semaphore_decrement and semaphore_wait_empty.
- */
-
-static gpointer
-test_force_adjust_thread(gpointer datap)
-{
-    semaphore_t *sem = datap;
-
-    /* this should block */
-    semaphore_decrement(sem, 20);
-
-    /* and this should block, too - it's fun */
-    semaphore_wait_empty(sem);
-
-    return NULL;
-}
-
-static gboolean
-test_force_adjust(void)
-{
-    GThread *th;
-    semaphore_t *sem = semaphore_new_with_value(10);
-
-    /* die after 10 seconds (default signal disposition is to fail) */
-    alarm(10);
-
-    th = g_thread_create(test_force_adjust_thread, (gpointer)sem, TRUE, NULL);
-
-    /* sleep to give semaphore_decrement() a chance to block (or not). */
-    g_usleep(G_USEC_PER_SEC / 4);
-
-    /* add another 20, so decrement can proceed, but leave the value at 10 */
-    semaphore_force_adjust(sem, 20);
-
-    /* sleep to give semaphore_wait_empty() a chance to block (or not). */
-    g_usleep(G_USEC_PER_SEC / 4);
-
-    /* and empty out the semaphore */
-    semaphore_force_adjust(sem, -10);
-
-    g_thread_join(th);
-
-    semaphore_free(sem);
-
-    /* it we didn't hang yet, it's all good */
-    printf(" PASS: semaphore-test.test_force_adjust\n");
-    return TRUE;
-}
-
-/*
- * test that semaphore_force_set correctly wakes both
- * semaphore_decrement and semaphore_wait_empty.
- */
-
-static gpointer
-test_force_set_thread(gpointer datap)
-{
-    semaphore_t *sem = datap;
-
-    /* this should block */
-    semaphore_decrement(sem, 20);
-
-    /* and this should block, too - it's fun */
-    semaphore_wait_empty(sem);
-
-    return NULL;
-}
-
-static gboolean
-test_force_set(void)
-{
-    GThread *th;
-    semaphore_t *sem = semaphore_new_with_value(10);
-
-    /* die after 10 seconds (default signal disposition is to fail) */
-    alarm(10);
-
-    th = g_thread_create(test_force_set_thread, (gpointer)sem, TRUE, NULL);
-
-    /* sleep to give semaphore_decrement() a chance to block (or not). */
-    g_usleep(G_USEC_PER_SEC / 4);
-
-    /* set it to 30, so decrement can proceed, but leave the value at 10 */
-    semaphore_force_set(sem, 30);
-
-    /* sleep to give semaphore_wait_empty() a chance to block (or not). */
-    g_usleep(G_USEC_PER_SEC / 4);
-
-    /* and empty out the semaphore */
-    semaphore_force_set(sem, 0);
-
-    g_thread_join(th);
-
-    semaphore_free(sem);
-
-    /* it we didn't hang yet, it's all good */
-    printf(" PASS: semaphore-test.test_force_set\n");
-    return TRUE;
-}
-
-/*
- * Main loop
- */
-
-int
-main(void)
-{
-    gboolean pass = TRUE;
-
-#if defined(G_THREADS_ENABLED) && !defined(G_THREADS_IMPL_NONE)
-    amanda_thread_init();
-
-    pass = test_decr_wait() && pass;
-    pass = test_wait_empty() && pass;
-    pass = test_force_adjust() && pass;
-    pass = test_force_set() && pass;
-
-    return pass?0:1;
-#else
-    printf("No thread support on this platform -- nothing to test\n");
-    return 0;
-#endif
-}
diff --git a/device-src/tests/vfs_test.c b/device-src/tests/vfs_test.c
deleted file mode 100644 (file)
index b05ee78..0000000
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License version 2.1 as
- * published by the Free Software Foundation.
- *
- * This 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 this library; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
- *
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
- */
-
-#include <device.h>
-#include <amanda.h>
-#include "util.h"
-
-/* global so the 'atexit' handler can access it */
-
-static void
-cleanup_vtape_dir(char *device_path)
-{
-    char *quoted = g_shell_quote(device_path);
-    char *cmd = vstralloc("rm -rf ", quoted, NULL);
-
-    /* would you rather write 'rm -rf' here? */
-    if (system(cmd) == -1) {
-       exit(1);
-    }
-
-    amfree(cmd);
-    amfree(quoted);
-}
-
-static char *
-setup_vtape_dir(void)
-{
-    char *cwd = g_get_current_dir();
-    char *device_path = NULL;
-    char *data_dir = NULL;
-
-    device_path = vstralloc(cwd, "/vfs-test-XXXXXX", NULL);
-    amfree(cwd);
-
-    if (mkdtemp(device_path) == NULL) {
-       fprintf(stderr, "Could not create temporary directory in %s\n", cwd);
-       return NULL;
-    }
-
-    /* append "/data/" to that for the VFS device*/
-    data_dir = vstralloc(device_path, "/data/", NULL);
-    if (mkdir(data_dir, 0777) == -1) {
-       fprintf(stderr, "Could not create %s: %s\n", cwd, strerror(errno));
-       amfree(data_dir);
-       return NULL;
-    }
-
-    amfree(data_dir);
-    return device_path;
-}
-
-static Device *
-setup_device(char *device_path)
-{
-    Device *device;
-    char *device_name = NULL;
-
-    device_name = vstralloc("file:", device_path, NULL);
-    device = device_open(device_name);
-    if (!device) {
-       fprintf(stderr, "Could not open device %s\n", device_name);
-    }
-
-    amfree(device_name);
-    return device;
-}
-
-static gboolean
-check_free_space(Device *device)
-{
-    GValue value;
-    QualifiedSize qsize;
-
-    bzero(&value, sizeof(value));
-    if (!device_property_get(device, PROPERTY_FREE_SPACE, &value)) {
-       fprintf(stderr, "Could not get property_free_space\n");
-       return FALSE;
-    }
-
-    qsize = *(QualifiedSize*)g_value_get_boxed(&value);
-    g_value_unset(&value);
-
-    if (qsize.accuracy != SIZE_ACCURACY_REAL) {
-       fprintf(stderr, "property_free_space accuracy is not SIZE_ACCURACY_REAL\n");
-       return FALSE;
-    }
-
-    if (qsize.bytes == 0) {
-       fprintf(stderr, "property_free_space returned bytes=0\n");
-       return FALSE;
-    }
-
-    return TRUE;
-}
-
-int
-main(int argc G_GNUC_UNUSED, char **argv G_GNUC_UNUSED)
-{
-    Device *device = NULL;
-    gboolean ok = TRUE;
-    char *device_path = NULL;
-    pid_t pid;
-    amwait_t status;
-
-    amanda_thread_init();
-
-    device_path = setup_vtape_dir();
-
-    /* run the tests in a subprocess so we can clean up even if they fail */
-    switch (pid = fork()) {
-       case -1: /* error */
-           perror("fork");
-           g_assert_not_reached();
-
-       case 0: /* child */
-           device_api_init();
-
-           device = setup_device(device_path);
-           if (!device)
-               return 1;
-
-           ok = ok && check_free_space(device);
-
-           g_object_unref(device);
-
-           if (!ok) exit(1);
-           exit(0);
-           g_assert_not_reached();
-
-       default: /* parent */
-           if (waitpid(pid, &status, 0) == -1)
-               perror("waitpid");
-
-           /* cleanup */
-           cleanup_vtape_dir(device_path);
-           amfree(device_path);
-
-           /* figure our own return status */
-           if (WIFEXITED(status))
-               return WEXITSTATUS(status);
-           else if (WIFSIGNALED(status)) {
-               fprintf(stderr, "Test failed with signal %d\n", (int)WTERMSIG(status));
-               return 1;
-           } else {
-               /* weird.. */
-               return 1;
-           }
-           g_assert_not_reached();
-    }
-}
index a69b584f69943c85a7489f99caa5c3a42ad70e66..667c5489bc236e170b0f4f8a23fd3427d400bea2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+ * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
  * 
  * This library is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License version 2.1 as 
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  * 
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
-#include <string.h> /* memset() */
-
 #include "amanda.h"
-#include "vfs-device.h"
+#include <string.h> /* memset() */
 #include "fsusage.h"
 #include "util.h"
+#include "device.h"
 #include <regex.h>
 
+/*
+ * Type checking and casting macros
+ */
+#define TYPE_VFS_DEVICE        (vfs_device_get_type())
+#define VFS_DEVICE(obj)        G_TYPE_CHECK_INSTANCE_CAST((obj), vfs_device_get_type(), VfsDevice)
+#define VFS_DEVICE_CONST(obj)  G_TYPE_CHECK_INSTANCE_CAST((obj), vfs_device_get_type(), VfsDevice const)
+#define VFS_DEVICE_CLASS(klass)        G_TYPE_CHECK_CLASS_CAST((klass), vfs_device_get_type(), VfsDeviceClass)
+#define IS_VFS_DEVICE(obj)     G_TYPE_CHECK_INSTANCE_TYPE((obj), vfs_device_get_type ())
+
+#define VFS_DEVICE_GET_CLASS(obj)      G_TYPE_INSTANCE_GET_CLASS((obj), vfs_device_get_type(), VfsDeviceClass)
+static GType   vfs_device_get_type     (void);
+
+/*
+ * Main object structure
+ */
+typedef struct {
+    Device __parent__;
+
+    /*< private >*/
+    char * dir_name;
+    char * file_name;
+    int file_lock_fd;
+    char * file_lock_name;
+    int volume_lock_fd;
+    char * volume_lock_name;
+    int open_file_fd;
+
+    /* Properties */
+    guint64 volume_bytes;
+    guint64 volume_limit;
+} VfsDevice;
+
+/*
+ * Class definition
+ */
+typedef struct {
+    DeviceClass __parent__;
+} VfsDeviceClass;
+
+
 /* This regex will match all VfsDevice files in a directory. We use it
    for cleanup and verification. Note that this regex does NOT match
    the volume label. */
    generated by lockfile_name(0). */
 #define VOLUME_LOCKFILE_NAME "00000-lock"
 
+#define VFS_DEVICE_MIN_BLOCK_SIZE (1)
+#define VFS_DEVICE_MAX_BLOCK_SIZE (INT_MAX)
+#define VFS_DEVICE_DEFAULT_BLOCK_SIZE (DISK_BLOCK_BYTES)
+#define VFS_DEVICE_LABEL_SIZE (32768)
+
+/* This looks dangerous, but is actually modified by the umask. */
+#define VFS_DEVICE_CREAT_MODE 0666
+
 /* Possible (abstracted) results from a system I/O operation. */
 typedef enum {
     RESULT_SUCCESS,
@@ -46,29 +93,27 @@ typedef enum {
     RESULT_MAX
 } IoResult;
 
+void vfs_device_register(void);
+
 /* here are local prototypes */
 static void vfs_device_init (VfsDevice * o);
 static void vfs_device_class_init (VfsDeviceClass * c);
+static void vfs_device_base_init (VfsDeviceClass * c);
 static void vfs_device_finalize (GObject * o);
 
 static gboolean vfs_device_start(Device * pself, DeviceAccessMode mode,
                                  char * label, char * timestamp);
-static gboolean vfs_device_open_device (Device * pself,
-                                        char * device_name);
-static gboolean vfs_device_start_file (Device * pself, const dumpfile_t * ji);
+static gboolean vfs_device_finish (Device * pself);
+static void vfs_device_open_device (Device * pself, char * device_name,
+                               char * device_type, char * device_node);
+static gboolean vfs_device_start_file (Device * pself, dumpfile_t * ji);
 static gboolean vfs_device_finish_file (Device * pself);
 static dumpfile_t * vfs_device_seek_file (Device * self, guint file);
 static gboolean vfs_device_seek_block (Device * self, guint64 block);
-static gboolean vfs_device_property_get (Device * pself, DevicePropertyId ID,
-                                         GValue * val);
-static gboolean vfs_device_property_set (Device * pself, DevicePropertyId ID,
-                                         GValue * val);
 static gboolean vfs_device_recycle_file (Device * pself, guint filenum);
-static Device * vfs_device_factory(char * device_type,
-                                   char * device_name);
-static ReadLabelStatusFlags vfs_device_read_label(Device * dself);
-static gboolean vfs_device_write_block(Device * self, guint size,
-                                       gpointer data, gboolean last_block);
+static Device * vfs_device_factory(char * device_name, char * device_type, char * device_node);
+static DeviceStatusFlags vfs_device_read_label(Device * dself);
+static gboolean vfs_device_write_block(Device * self, guint size, gpointer data);
 static int vfs_device_read_block(Device * self, gpointer data, int * size_req);
 static IoResult vfs_device_robust_write(VfsDevice * self,  char *buf,
                                               int count);
@@ -77,21 +122,29 @@ static IoResult vfs_device_robust_read(VfsDevice * self, char *buf,
 
 /* Various helper functions. */
 static void release_file(VfsDevice * self);
-static gboolean check_is_dir(const char * name, gboolean printmsg);
+static gboolean check_is_dir(Device * d_self, const char * name);
 static char* file_number_to_file_name(VfsDevice * self, guint file);
 static gboolean file_number_to_file_name_functor(const char * filename,
                                                  gpointer datap);
+static gboolean vfs_device_set_max_volume_usage_fn(Device *p_self,
+                           DevicePropertyBase *base, GValue *val,
+                           PropertySurety surety, PropertySource source);
+gboolean vfs_device_get_free_space_fn(struct Device *p_self,
+                           DevicePropertyBase *base, GValue *val,
+                           PropertySurety *surety, PropertySource *source);
 //static char* lockfile_name(VfsDevice * self, guint file);
 static gboolean open_lock(VfsDevice * self, int file, gboolean exclusive);
 static void promote_volume_lock(VfsDevice * self);
 static void demote_volume_lock(VfsDevice * self);
-static gboolean delete_vfs_files(VfsDevice * self);
+static void delete_vfs_files(VfsDevice * self);
 static gboolean delete_vfs_files_functor(const char * filename,
                                          gpointer self);
 static gboolean check_dir_empty_functor(const char * filename,
                                         gpointer self);
 static gboolean clear_and_prepare_label(VfsDevice * self, char * label,
                                         char * timestamp);
+static int search_vfs_directory(VfsDevice *self, const char * regex,
+                       SearchDirectoryFunctor functor, gpointer user_data);
 static gint get_last_file_number(VfsDevice * self);
 static gboolean get_last_file_number_functor(const char * filename,
                                              gpointer datap);
@@ -106,7 +159,7 @@ void vfs_device_register(void) {
     register_device(vfs_device_factory, device_prefix_list);
 }
 
-GType
+static GType
 vfs_device_get_type (void)
 {
     static GType type = 0;
@@ -114,7 +167,7 @@ vfs_device_get_type (void)
     if G_UNLIKELY(type == 0) {
         static const GTypeInfo info = {
             sizeof (VfsDeviceClass),
-            (GBaseInitFunc) NULL,
+            (GBaseInitFunc) vfs_device_base_init,
             (GBaseFinalizeFunc) NULL,
             (GClassInitFunc) vfs_device_class_init,
             (GClassFinalizeFunc) NULL,
@@ -134,77 +187,57 @@ vfs_device_get_type (void)
 
 static void 
 vfs_device_init (VfsDevice * self) {
-    Device * o;
-    DeviceProperty prop;
+    Device * dself = DEVICE(self);
     GValue response;
 
-    self->dir_handle = NULL;
     self->dir_name = self->file_name = NULL;
     self->file_lock_name = self->volume_lock_name = NULL;
     self->file_lock_fd = self->volume_lock_fd = self->open_file_fd = -1;
-    self->block_size = VFS_DEVICE_DEFAULT_BLOCK_SIZE;
     self->volume_bytes = 0; 
     self->volume_limit = 0;
 
     /* Register Properties */
-    o = DEVICE(self);
     bzero(&response, sizeof(response));
-    prop.base = &device_property_concurrency;
-    prop.access = PROPERTY_ACCESS_GET_MASK;
+
     g_value_init(&response, CONCURRENCY_PARADIGM_TYPE);
     g_value_set_enum(&response, CONCURRENCY_PARADIGM_RANDOM_ACCESS);
-    device_add_property(o, &prop, &response);
+    device_set_simple_property(dself, PROPERTY_CONCURRENCY,
+           &response, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DETECTED);
     g_value_unset(&response);
 
-    prop.base = &device_property_streaming;
     g_value_init(&response, STREAMING_REQUIREMENT_TYPE);
     g_value_set_enum(&response, STREAMING_REQUIREMENT_NONE);
-    device_add_property(o, &prop, &response);
+    device_set_simple_property(dself, PROPERTY_STREAMING,
+           &response, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DETECTED);
     g_value_unset(&response);
 
-    prop.base = &device_property_min_block_size;
-    g_value_init(&response, G_TYPE_UINT);
-    g_value_set_uint(&response, VFS_DEVICE_MIN_BLOCK_SIZE);
-    device_add_property(o, &prop, &response);
-
-    prop.base = &device_property_max_block_size;
-    g_value_set_uint(&response, VFS_DEVICE_MAX_BLOCK_SIZE);
-    device_add_property(o, &prop, &response);
+    g_value_init(&response, G_TYPE_BOOLEAN);
+    g_value_set_boolean(&response, TRUE);
+    device_set_simple_property(dself, PROPERTY_APPENDABLE,
+           &response, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DETECTED);
     g_value_unset(&response);
 
-    prop.base = &device_property_appendable;
     g_value_init(&response, G_TYPE_BOOLEAN);
     g_value_set_boolean(&response, TRUE);
-    device_add_property(o, &prop, &response);
-
-    prop.base = &device_property_partial_deletion;
-    device_add_property(o, &prop, &response);
+    device_set_simple_property(dself, PROPERTY_PARTIAL_DELETION,
+           &response, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DETECTED);
     g_value_unset(&response);
 
-    /* This one is handled by Device's get_property handler. */
-    prop.base = &device_property_canonical_name;
-    device_add_property(o, &prop, NULL);
+    g_value_init(&response, G_TYPE_BOOLEAN);
+    g_value_set_boolean(&response, FALSE);
+    device_set_simple_property(dself, PROPERTY_COMPRESSION,
+           &response, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DETECTED);
+    g_value_unset(&response);
 
-    prop.base = &device_property_medium_access_type;
     g_value_init(&response, MEDIA_ACCESS_MODE_TYPE);
     g_value_set_enum(&response, MEDIA_ACCESS_MODE_READ_WRITE);
-    device_add_property(o, &prop, &response);
+    device_set_simple_property(dself, PROPERTY_MEDIUM_ACCESS_TYPE,
+           &response, PROPERTY_SURETY_GOOD, PROPERTY_SOURCE_DETECTED);
     g_value_unset(&response);
-
-    /* These are dynamic, handled in vfs_device_property_xxx */
-    prop.base = &device_property_block_size;
-    prop.access = PROPERTY_ACCESS_GET_MASK | PROPERTY_ACCESS_SET_BEFORE_START;
-    device_add_property(o, &prop, NULL);
-
-    prop.base = &device_property_max_volume_usage;
-    prop.access =
-        (PROPERTY_ACCESS_GET_MASK | PROPERTY_ACCESS_SET_MASK) &
-        (~ PROPERTY_ACCESS_SET_INSIDE_FILE_WRITE);
-    device_add_property(o, &prop, NULL);
 }
 
 static void 
-vfs_device_class_init (VfsDeviceClass * c G_GNUC_UNUSED)
+vfs_device_class_init (VfsDeviceClass * c)
 {
     GObjectClass *g_object_class = (GObjectClass*) c;
     DeviceClass *device_class = (DeviceClass *)c;
@@ -220,12 +253,84 @@ vfs_device_class_init (VfsDeviceClass * c G_GNUC_UNUSED)
     device_class->finish_file = vfs_device_finish_file;
     device_class->seek_file = vfs_device_seek_file;
     device_class->seek_block = vfs_device_seek_block;
-    device_class->property_get = vfs_device_property_get;
-    device_class->property_set = vfs_device_property_set;
     device_class->recycle_file = vfs_device_recycle_file;
+    device_class->finish = vfs_device_finish;
     g_object_class->finalize = vfs_device_finalize;
 }
 
+static void
+vfs_device_base_init (VfsDeviceClass * c)
+{
+    DeviceClass *device_class = (DeviceClass *)c;
+
+    device_class_register_property(device_class, PROPERTY_FREE_SPACE,
+           PROPERTY_ACCESS_GET_MASK,
+           vfs_device_get_free_space_fn,
+           NULL);
+
+    device_class_register_property(device_class, PROPERTY_MAX_VOLUME_USAGE,
+           (PROPERTY_ACCESS_GET_MASK | PROPERTY_ACCESS_SET_MASK) &
+                       (~ PROPERTY_ACCESS_SET_INSIDE_FILE_WRITE),
+           device_simple_property_get_fn,
+           vfs_device_set_max_volume_usage_fn);
+
+    device_class_register_property(device_class, PROPERTY_COMPRESSION,
+           PROPERTY_ACCESS_GET_MASK,
+           device_simple_property_get_fn,
+           NULL);
+}
+
+gboolean
+vfs_device_set_max_volume_usage_fn(Device *p_self,
+    DevicePropertyBase *base, GValue *val,
+    PropertySurety surety, PropertySource source)
+{
+    VfsDevice *self = VFS_DEVICE(p_self);
+
+    self->volume_limit = g_value_get_uint64(val);
+
+    return device_simple_property_set_fn(p_self, base, val, surety, source);
+}
+
+gboolean
+vfs_device_get_free_space_fn(struct Device *p_self,
+    DevicePropertyBase *base G_GNUC_UNUSED, GValue *val,
+    PropertySurety *surety, PropertySource *source)
+{
+    VfsDevice *self = VFS_DEVICE(p_self);
+    QualifiedSize qsize;
+    struct fs_usage fsusage;
+    guint64 bytes_avail;
+
+    if (get_fs_usage(self->dir_name, NULL, &fsusage) == 0) {
+       if (fsusage.fsu_bavail_top_bit_set)
+           bytes_avail = 0;
+       else
+           bytes_avail = fsusage.fsu_bavail * fsusage.fsu_blocksize;
+       if (self->volume_limit && (guint64)self->volume_limit < bytes_avail / 1024)
+           bytes_avail = (guint64)self->volume_limit * 1024;
+
+       qsize.accuracy = SIZE_ACCURACY_REAL;
+       qsize.bytes = bytes_avail;
+       if (surety)
+           *surety = PROPERTY_SURETY_GOOD;
+    } else {
+       g_warning(_("get_fs_usage('%s') failed: %s"), self->dir_name, strerror(errno));
+       qsize.accuracy = SIZE_ACCURACY_UNKNOWN;
+       qsize.bytes = 0;
+       if (surety)
+           *surety = PROPERTY_SURETY_BAD;
+    }
+
+    g_value_unset_init(val, QUALIFIED_SIZE_TYPE);
+    g_value_set_boxed(val, &qsize);
+
+    if (source)
+       *source = PROPERTY_SOURCE_DETECTED;
+
+    return TRUE;
+}
+
 /* Drops everything associated with the volume file: Its name and fd,
    its lock, and its lock's name and fd. */
 static void release_file(VfsDevice * self) {
@@ -254,11 +359,6 @@ static void vfs_device_finalize(GObject * obj_self) {
 
     amfree(self->dir_name);
 
-    if(self->dir_handle) {
-        closedir (self->dir_handle);
-        self->dir_handle = NULL;
-    }
-
     release_file(self);
 
     if (self->volume_lock_fd >= 0) {
@@ -269,38 +369,31 @@ static void vfs_device_finalize(GObject * obj_self) {
     amfree(self->volume_lock_name);
 }
 
-static Device * vfs_device_factory(char * device_type,
-                                   char * device_name) {
+static Device * vfs_device_factory(char * device_name, char * device_type, char * device_node) {
     Device * rval;
     g_assert(0 == strcmp(device_type, "file"));
     rval = DEVICE(g_object_new(TYPE_VFS_DEVICE, NULL));
-    if (!device_open_device(rval, device_name)) {
-        g_object_unref(rval);
-        return NULL;
-    } else {
-        return rval;
-    }
+    device_open_device(rval, device_name, device_type, device_node);
+    return rval;
 }
 
-static gboolean check_is_dir(const char * name, gboolean printmsg) {
+static gboolean check_is_dir(Device * d_self, const char * name) {
     struct stat dir_status;
     
     if (stat(name, &dir_status) < 0) {
 #ifdef EINTR
         if (errno == EINTR) {
-            return check_is_dir(name, printmsg);
+            return check_is_dir(d_self, name);
         }
 #endif /* EINTR */
-        if (printmsg) {
-            g_fprintf(stderr, "Error checking directory %s: %s\n",
-                    name, strerror(errno));
-        }
+       device_set_error(d_self,
+           vstrallocf(_("Error checking directory %s: %s"), name, strerror(errno)),
+           DEVICE_STATUS_DEVICE_ERROR);
         return FALSE;
     } else if (!S_ISDIR(dir_status.st_mode)) {
-        if (printmsg) {
-            g_fprintf(stderr, "VFS Device path %s is not a directory.\n",
-                    name);
-        }
+       device_set_error(d_self,
+                   vstrallocf(_("VFS Device path %s is not a directory"), name),
+                   DEVICE_STATUS_DEVICE_ERROR);
         return FALSE;
     } else {
         return TRUE;
@@ -325,11 +418,9 @@ static gboolean file_number_to_file_name_functor(const char * filename,
     /* Just to be thorough, let's check that it's a real
        file. */
     if (0 != stat(result_tmp, &file_status)) {
-        g_fprintf(stderr, "Cannot stat file %s (%s), ignoring it.\n", 
-                result_tmp, strerror(errno));
+       g_warning(_("Cannot stat file %s (%s), ignoring it"), result_tmp, strerror(errno));
     } else if (!S_ISREG(file_status.st_mode)) {
-        g_fprintf(stderr, "%s is not a regular file, ignoring it.\n",
-                result_tmp);
+       g_warning(_("%s is not a regular file, ignoring it"), result_tmp);
     } else {
         data->count ++;
         if (data->result == NULL) {
@@ -349,15 +440,14 @@ static char * file_number_to_file_name(VfsDevice * self, guint device_file) {
     char * regex;
     fnfn_data data;
 
-    g_return_val_if_fail(self != NULL, NULL);
     data.self = self;
     data.count = 0;
     data.result = NULL;
 
     regex = g_strdup_printf("^0*%u\\.", device_file);
 
-    search_directory(self->dir_handle, regex,
-                     file_number_to_file_name_functor, &data);
+    search_vfs_directory(self, regex,
+                         file_number_to_file_name_functor, &data);
 
     amfree(regex);
 
@@ -365,8 +455,7 @@ static char * file_number_to_file_name(VfsDevice * self, guint device_file) {
         g_assert(data.result == NULL);
         return NULL;
     } else if (data.count > 1) {
-        g_fprintf(stderr,
-                "Found multiple names for file number %d, choosing file %s.\n",
+       g_warning("Found multiple names for file number %d, choosing file %s",
                 device_file, data.result);
         return data.result;
     } else {
@@ -401,6 +490,7 @@ static gboolean open_lock(G_GNUC_UNUSED VfsDevice * self,
 /*
     int fd;
     char * name;
+    Device *d_self = DEVICE(self);
     if (file < 0) {
         if (self->volume_lock_name == NULL) {
             self->volume_lock_name = lockfile_name(self, 0);
@@ -422,8 +512,9 @@ static gboolean open_lock(G_GNUC_UNUSED VfsDevice * self,
     fd = robust_open(name, O_CREAT | O_WRONLY, VFS_DEVICE_CREAT_MODE);
 
     if (fd < 0) {
-        g_fprintf(stderr, "Can't open lock file %s: %s\n",
-                name, strerror(errno));
+       device_set_error(d_self,
+           vstrallocf(_("Can't open lock file %s: %s"), name, strerror(errno)),
+           DEVICE_STATUS_DEVICE_ERROR);
         return FALSE;
     }
 
@@ -459,14 +550,12 @@ static gboolean update_volume_size_functor(const char * filename,
     char * full_filename;
     struct stat stat_buf;
     VfsDevice * self = user_data;
-    g_return_val_if_fail(IS_VFS_DEVICE(self), FALSE);
-    
+
     full_filename = vstralloc(self->dir_name, "/", filename, NULL);
 
     if (stat(full_filename, &stat_buf) < 0) {
         /* Log it and keep going. */
-        g_fprintf(stderr, "Couldn't stat file %s: %s\n",
-                full_filename, strerror(errno));
+       g_warning(_("Couldn't stat file %s: %s"), full_filename, strerror(errno));
         amfree(full_filename);
         return TRUE;
     }
@@ -479,48 +568,26 @@ static gboolean update_volume_size_functor(const char * filename,
 
 static void update_volume_size(VfsDevice * self) {
     self->volume_bytes = 0;
-    search_directory(self->dir_handle, "^[0-9]+\\.",
-                     update_volume_size_functor, self);
+    search_vfs_directory(self, "^[0-9]+\\.",
+                         update_volume_size_functor, self);
 
 }
 
-static gboolean 
-vfs_device_open_device (Device * pself, char * device_name) {
+static void
+vfs_device_open_device (Device * pself, char * device_name, char * device_type, char * device_node) {
     VfsDevice * self;
-    dumpfile_t * rval;
-    
     self = VFS_DEVICE(pself);
-    g_return_val_if_fail (self != NULL, FALSE);
-    g_return_val_if_fail (device_name != NULL, FALSE);
+
+    pself->min_block_size = VFS_DEVICE_MIN_BLOCK_SIZE;
+    pself->max_block_size = VFS_DEVICE_MAX_BLOCK_SIZE;
+    pself->block_size = VFS_DEVICE_DEFAULT_BLOCK_SIZE;
 
     /* We don't have to free this ourselves; it will be freed by
      * vfs_device_finalize whether we succeed here or not. */
-    self->dir_name = g_strconcat(device_name, "/data/", NULL);
-    if (!check_is_dir(self->dir_name, TRUE)) {
-        return FALSE;
-    }
-
-    /* Next open the directory itself. */
-    self->dir_handle = opendir(self->dir_name);
-    if (self->dir_handle == NULL) {
-        g_fprintf(stderr, "Couldn't open directory %s for reading: %s\n",
-                device_name, strerror(errno));
-        return FALSE;
-    }
-
-    if (!open_lock(self, -1, FALSE))
-        return FALSE;
-
-    /* Not an error if this fails. Note that we ignore the class hierarchy.
-     */
-    rval = vfs_device_seek_file(pself, 0);
-    amfree(rval);
+    self->dir_name = g_strconcat(device_node, "/data/", NULL);
 
     if (parent_class->open_device) {
-        /* Will call vfs_device_read_label. */
-        return (parent_class->open_device)(pself, device_name);
-    } else {
-        return TRUE;
+        parent_class->open_device(pself, device_name, device_type, device_node);
     }
 }
 
@@ -528,10 +595,11 @@ vfs_device_open_device (Device * pself, char * device_name) {
 static gboolean delete_vfs_files_functor(const char * filename,
                                          gpointer user_data) {
     VfsDevice * self;
+    Device * d_self;
     char * path_name;
 
     self = VFS_DEVICE(user_data);
-    g_return_val_if_fail(self != NULL, FALSE);
+    d_self = DEVICE(self);
 
     /* Skip the volume lock. */
     if (strcmp(filename, VOLUME_LOCKFILE_NAME) == 0)
@@ -539,8 +607,7 @@ static gboolean delete_vfs_files_functor(const char * filename,
 
     path_name = vstralloc(self->dir_name, "/", filename, NULL);
     if (unlink(path_name) != 0) {
-        g_fprintf(stderr, "Error unlinking %s: %s\n", path_name,
-                strerror(errno));
+       g_warning(_("Error unlinking %s: %s"), path_name, strerror(errno));
     }
     amfree(path_name);
     return TRUE;
@@ -548,14 +615,12 @@ static gboolean delete_vfs_files_functor(const char * filename,
 
 /* delete_vfs_files deletes all VfsDevice files in the directory except the
    volume lockfile. */
-static gboolean delete_vfs_files(VfsDevice * self) {
+static void delete_vfs_files(VfsDevice * self) {
     g_assert(self != NULL);
-    g_assert(self->dir_handle != NULL);
 
     /* This function assumes that the volume is locked! */
-    search_directory(self->dir_handle, VFS_DEVICE_FILE_REGEX,
-                     delete_vfs_files_functor, self);
-    return TRUE;
+    search_vfs_directory(self, VFS_DEVICE_FILE_REGEX,
+                         delete_vfs_files_functor, self);
 }
 
 /* This is a functor suitable for search_directory. It simply prints a
@@ -564,16 +629,17 @@ static gboolean check_dir_empty_functor(const char * filename,
                                         gpointer user_data) {
     VfsDevice * self;
     char * path_name;
+    Device *d_self;
 
     self = VFS_DEVICE(user_data);
-    g_return_val_if_fail(self != NULL, FALSE);
+    d_self = DEVICE(self);
 
     if (strcmp(filename, VOLUME_LOCKFILE_NAME) == 0)
         return TRUE;
 
     path_name = vstralloc(self->dir_name, "/", filename, NULL);
 
-    g_fprintf(stderr, "Found spurious storage file %s\n", path_name);
+    g_warning(_("Found spurious storage file %s"), path_name);
 
     amfree(path_name);
     return TRUE;
@@ -584,17 +650,21 @@ static gboolean write_amanda_header(VfsDevice * self,
                                     const dumpfile_t * header) {
     char * label_buffer;
     IoResult result;
-    
-    g_return_val_if_fail(header != NULL, FALSE);
-    g_return_val_if_fail(self != NULL, FALSE);
+    Device *d_self = DEVICE(self);
+
+    g_assert(header != NULL);
+
     label_buffer = build_header(header, VFS_DEVICE_LABEL_SIZE);
     if (strlen(label_buffer)+1 > VFS_DEVICE_LABEL_SIZE) {
         amfree(label_buffer);
-        g_fprintf(stderr, "Amanda header header won't fit on VFS device!\n");
+       device_set_error(d_self,
+           stralloc(_("Amanda file header won't fit in a single block!")),
+           DEVICE_STATUS_DEVICE_ERROR);
         return FALSE;
     }
 
     result = vfs_device_robust_write(self, label_buffer, VFS_DEVICE_LABEL_SIZE);
+    /* vfs_device_robust_write sets error status if necessary */
     amfree(label_buffer);
     return (result == RESULT_SUCCESS);
 }
@@ -605,17 +675,16 @@ static gboolean write_amanda_header(VfsDevice * self,
 static gboolean clear_and_prepare_label(VfsDevice * self, char * label,
                                         char * timestamp) {
     dumpfile_t * label_header;
+    Device *d_self = DEVICE(self);
 
     release_file(self);
 
     /* Delete any extant data, except our volume lock. */
-    if (!delete_vfs_files(self)) {
-        return FALSE;
-    }
+    delete_vfs_files(self);
 
     /* Print warnings about any remaining files. */
-    search_directory(self->dir_handle, VFS_DEVICE_FILE_REGEX,
-                     check_dir_empty_functor, self);
+    search_vfs_directory(self, VFS_DEVICE_FILE_REGEX,
+                         check_dir_empty_functor, self);
 
     self->file_name = g_strdup_printf("%s/00000.%s", self->dir_name, label);
 
@@ -623,84 +692,132 @@ static gboolean clear_and_prepare_label(VfsDevice * self, char * label,
                                      O_CREAT | O_EXCL | O_WRONLY,
                                      VFS_DEVICE_CREAT_MODE);
     if (self->open_file_fd < 0) {
-        g_fprintf(stderr, "Can't open file %s: %s\n", self->file_name,
-                strerror(errno));
+       device_set_error(d_self,
+           vstrallocf(_("Can't open file %s: %s"), self->file_name, strerror(errno)),
+           DEVICE_STATUS_DEVICE_ERROR | DEVICE_STATUS_VOLUME_ERROR);
         return FALSE;
     }
 
     label_header = make_tapestart_header(DEVICE(self), label, timestamp);
-    if (write_amanda_header(self, label_header)) {
-        amfree(label_header);
-        self->volume_bytes = VFS_DEVICE_LABEL_SIZE;
-        return TRUE;
-    } else {
+    if (!write_amanda_header(self, label_header)) {
+       /* write_amanda_header sets error status if necessary */
         amfree(label_header);
         return FALSE;
     }
+    amfree(label_header);
+    self->volume_bytes = VFS_DEVICE_LABEL_SIZE;
+    return TRUE;
 }
 
-static ReadLabelStatusFlags vfs_device_read_label(Device * dself) {
+/* Just like search_directory, but returns -1 in the event of an error */
+static int
+search_vfs_directory(
+    VfsDevice *self,
+    const char * regex,
+    SearchDirectoryFunctor functor,
+    gpointer user_data)
+{
+    Device *dself = DEVICE(self);
+    DIR *dir_handle;
+    int result = -1;
+
+    dir_handle = opendir(self->dir_name);
+    if (dir_handle == NULL) {
+       device_set_error(dself,
+               vstrallocf(_("Couldn't open device %s (directory %s) for reading: %s"),
+                       dself->device_name, self->dir_name, strerror(errno)),
+               DEVICE_STATUS_DEVICE_ERROR);
+        goto error;
+    }
+
+    /* TODO: is this the right moment to acquire a lock?? */
+
+    result = search_directory(dir_handle, regex, functor, user_data);
+
+error:
+    if (dir_handle)
+       closedir(dir_handle);
+    return result;
+}
+
+static DeviceStatusFlags vfs_device_read_label(Device * dself) {
     dumpfile_t * amanda_header;
     VfsDevice * self;
 
     self = VFS_DEVICE(dself);
-    g_return_val_if_fail(self != NULL, ~READ_LABEL_STATUS_SUCCESS);
+    g_assert(self != NULL);
+
+    if (!check_is_dir(dself, self->dir_name)) {
+       /* error message set by check_is_dir */
+        return FALSE;
+    }
+
+    amfree(dself->volume_label);
+    amfree(dself->volume_time);
+    amfree(dself->volume_header);
 
-    amanda_header = vfs_device_seek_file(dself, 0);
+    if (device_in_error(self)) return dself->status;
+
+    amanda_header = dself->volume_header = vfs_device_seek_file(dself, 0);
     if (amanda_header == NULL) {
         /* This means an error occured getting locks or opening the header
          * file. */
-        return (READ_LABEL_STATUS_DEVICE_ERROR |
-                READ_LABEL_STATUS_VOLUME_ERROR |
-                READ_LABEL_STATUS_VOLUME_UNLABELED);
+       device_set_error(dself,
+               stralloc("Error loading device header -- unlabeled volume?"),
+                 DEVICE_STATUS_DEVICE_ERROR
+               | DEVICE_STATUS_VOLUME_ERROR
+               | DEVICE_STATUS_VOLUME_UNLABELED);
+       return dself->status;
     }
 
     if (amanda_header->type != F_TAPESTART) {
         /* This is an error, and should not happen. */
-        g_fprintf(stderr, "Got a bad volume label\n");
+       device_set_error(dself,
+               stralloc(_("Got a bad volume label")),
+               DEVICE_STATUS_VOLUME_ERROR);
         amfree(amanda_header);
-        return READ_LABEL_STATUS_VOLUME_ERROR;
+        return dself->status;
     }
 
     dself->volume_label = g_strdup(amanda_header->name);
     dself->volume_time = g_strdup(amanda_header->datestamp);
-    amfree(amanda_header);
+    /* dself->volume_header is already set */
+
+    device_set_error(dself, NULL, DEVICE_STATUS_SUCCESS);
 
     update_volume_size(self);
 
-    if (parent_class->read_label) {
-        return (parent_class->read_label)(dself);
-    } else {
-        return READ_LABEL_STATUS_SUCCESS;
-    }
+    return dself->status;
 }
 
-static gboolean vfs_device_write_block(Device * pself, guint size,
-                                       gpointer data, gboolean last_block) {
+static gboolean vfs_device_write_block(Device * pself, guint size, gpointer data) {
     VfsDevice * self = VFS_DEVICE(pself);
     IoResult result;
-    g_return_val_if_fail(self != NULL, FALSE);
-    g_return_val_if_fail(last_block || size >= (guint)self->block_size, FALSE);
-    g_return_val_if_fail(pself->in_file, FALSE);
+
+    if (device_in_error(self)) return FALSE;
+
     g_assert(self->open_file_fd >= 0);
 
     if (self->volume_limit > 0 &&
         self->volume_bytes + size > self->volume_limit) {
         /* Simulate EOF. */
         pself->is_eof = TRUE;
+       device_set_error(pself,
+           stralloc(_("No space left on device")),
+           DEVICE_STATUS_VOLUME_ERROR);
         return FALSE;
     }
 
     result = vfs_device_robust_write(self, data, size);
-    if (result == RESULT_SUCCESS) {
-        self->volume_bytes += size;
-        if (parent_class->write_block) {
-            (parent_class->write_block)(pself, size, data, last_block);
-        }
-        return TRUE;
-    } else {
+    if (result != RESULT_SUCCESS) {
+       /* vfs_device_robust_write set error status appropriately */
         return FALSE;
     }
+
+    self->volume_bytes += size;
+    pself->block ++;
+
+    return TRUE;
 }
 
 static int
@@ -710,25 +827,34 @@ vfs_device_read_block(Device * pself, gpointer data, int * size_req) {
     IoResult result;
     
     self = VFS_DEVICE(pself);
-    g_return_val_if_fail (self != NULL, -1);
 
-    if (data == NULL || *size_req < self->block_size) {
+    if (device_in_error(self)) return -1;
+
+    if (data == NULL || (gsize)*size_req < pself->block_size) {
         /* Just a size query. */
-        *size_req = self->block_size;
+       g_assert(pself->block_size < INT_MAX);
+        *size_req = (int)pself->block_size;
         return 0;
     }
 
-    size = self->block_size;
+    size = pself->block_size;
     result = vfs_device_robust_read(self, data, &size);
     switch (result) {
     case RESULT_SUCCESS:
         *size_req = size;
+       pself->block++;
         return size;
     case RESULT_NO_DATA:
         pself->is_eof = TRUE;
         pself->in_file = FALSE;
+       device_set_error(pself,
+           stralloc(_("EOF")),
+           DEVICE_STATUS_SUCCESS);
         return -1;
     default:
+       device_set_error(pself,
+           vstrallocf(_("Error reading from data file: %s"), strerror(errno)),
+           DEVICE_STATUS_DEVICE_ERROR);
         return -1;
     }
 
@@ -740,25 +866,53 @@ static gboolean   vfs_device_start(Device * pself,
                                  char * timestamp) {
     VfsDevice * self;
     self = VFS_DEVICE(pself);
-    g_return_val_if_fail(self != NULL, FALSE);
-    g_return_val_if_fail(parent_class->start != NULL, FALSE);
-    
+
+    if (!check_is_dir(pself, self->dir_name)) {
+       /* error message set by check_is_dir */
+        return FALSE;
+    }
+
+    pself->in_file = FALSE;
+
     if (mode == ACCESS_WRITE) {
         promote_volume_lock(self);
         if (!clear_and_prepare_label(self, label, timestamp)) {
+           /* clear_and_prepare_label sets error status if necessary */
             demote_volume_lock(self);
             return FALSE;
         }
+
+        pself->volume_label = newstralloc(pself->volume_label, label);
+        pself->volume_time = newstralloc(pself->volume_time, timestamp);
+
+       /* unset the VOLUME_UNLABELED flag, if it was set */
+       device_set_error(pself, NULL, DEVICE_STATUS_SUCCESS);
+
         demote_volume_lock(self);
+        pself->access_mode = mode;
+    } else {
+       if (pself->volume_label == NULL && device_read_label(pself) != DEVICE_STATUS_SUCCESS) {
+           /* device_read_label already set our error message */
+            return FALSE;
+       } else {
+            pself->access_mode = mode;
+        }
     }
 
     release_file(self);
  
-    if (parent_class->start) {
-        return parent_class->start(pself, mode, label, timestamp);
-    } else {
-        return TRUE;
-    }
+    return TRUE;
+}
+
+static gboolean
+vfs_device_finish (Device * pself) {
+    VfsDevice * self;
+    self = VFS_DEVICE(pself);
+
+    if (device_in_error(self)) return FALSE;
+
+    pself->access_mode = ACCESS_NULL;
+    return TRUE;
 }
 
 typedef struct {
@@ -771,11 +925,10 @@ static gboolean get_last_file_number_functor(const char * filename,
                                              gpointer datap) {
     guint64 file;
     glfn_data * data = (glfn_data*)datap;
-    g_return_val_if_fail(IS_VFS_DEVICE(data->self), FALSE);
+
     file = g_ascii_strtoull(filename, NULL, 10); /* Guaranteed to work. */
     if (file > G_MAXINT) {
-        g_fprintf(stderr, "Super-large device file %s found, ignoring.\n",
-               filename);
+       g_warning(_("Super-large device file %s found, ignoring"), filename);
         return TRUE;
     }
     /* This condition is needlessly complex due to sign issues. */
@@ -788,15 +941,18 @@ static gboolean get_last_file_number_functor(const char * filename,
 static gint get_last_file_number(VfsDevice * self) {
     glfn_data data;
     int count;
+    Device *d_self = DEVICE(self);
     data.self = self;
     data.rval = -1;
     
-    count = search_directory(self->dir_handle, "^[0-9]+\\.",
-                             get_last_file_number_functor, &data);
+    count = search_vfs_directory(self, "^[0-9]+\\.",
+                                 get_last_file_number_functor, &data);
 
     if (count <= 0) {
         /* Somebody deleted something important while we weren't looking. */
-        g_fprintf(stderr, "Error identifying VFS device contents!\n");
+       device_set_error(d_self,
+           stralloc(_("Error identifying VFS device contents!")),
+           DEVICE_STATUS_DEVICE_ERROR | DEVICE_STATUS_VOLUME_ERROR);
         return -1;
     } else {
         g_assert(data.rval >= 0);
@@ -816,11 +972,10 @@ static gboolean get_next_file_number_functor(const char * filename,
                                              gpointer datap) {
     guint file;
     gnfn_data * data = (gnfn_data*)datap;
-    g_return_val_if_fail(IS_VFS_DEVICE(data->self), FALSE);
+
     file = g_ascii_strtoull(filename, NULL, 10); /* Guaranteed to work. */
     if (file > G_MAXINT) {
-        g_fprintf(stderr, "Super-large device file %s found, ignoring.\n",
-               filename);
+       g_warning(_("Super-large device file %s found, ignoring"), filename);
         return TRUE;
     }
     /* This condition is needlessly complex due to sign issues. */
@@ -836,16 +991,19 @@ static gboolean get_next_file_number_functor(const char * filename,
 static gint get_next_file_number(VfsDevice * self, guint request) {
     gnfn_data data;
     int count;
+    Device *d_self = DEVICE(self);
     data.self = self;
     data.request = request;
     data.best_found = -1;
     
-    count = search_directory(self->dir_handle, "^[0-9]+\\.",
-                             get_next_file_number_functor, &data);
+    count = search_vfs_directory(self, "^[0-9]+\\.",
+                                 get_next_file_number_functor, &data);
 
     if (count <= 0) {
         /* Somebody deleted something important while we weren't looking. */
-        g_fprintf(stderr, "Error identifying VFS device contents!\n");
+       device_set_error(d_self,
+           stralloc(_("Error identifying VFS device contents!")),
+           DEVICE_STATUS_DEVICE_ERROR | DEVICE_STATUS_VOLUME_ERROR);
         return -1;
     }
     
@@ -885,16 +1043,21 @@ char * make_new_file_name(VfsDevice * self, const dumpfile_t * ji) {
 }
 
 static gboolean 
-vfs_device_start_file (Device * pself, const dumpfile_t * ji) {
+vfs_device_start_file (Device * pself, dumpfile_t * ji) {
     VfsDevice * self;
-
     self = VFS_DEVICE(pself);
-    g_return_val_if_fail (self != NULL, FALSE);
-    g_return_val_if_fail (ji != NULL, FALSE);
+
+    if (device_in_error(self)) return FALSE;
+
+    /* set the blocksize in the header to 32k, since the VFS header is always
+     * 32k regardless of the block_size setting */
+    ji->blocksize = 32768;
 
     if (self->volume_limit > 0 &&
         self->volume_bytes + VFS_DEVICE_LABEL_SIZE > self->volume_limit) {
-        /* No more room. */
+       device_set_error(pself,
+               stralloc(_("No space left on device")),
+               DEVICE_STATUS_DEVICE_ERROR);
         return FALSE;
     }
 
@@ -906,32 +1069,37 @@ vfs_device_start_file (Device * pself, const dumpfile_t * ji) {
        5) Chain up. */
 
     self->file_name = make_new_file_name(self, ji);
-    if (self->file_name == NULL)
+    if (self->file_name == NULL) {
+       device_set_error(pself,
+               stralloc(_("Could not create header filename")),
+               DEVICE_STATUS_DEVICE_ERROR);
         return FALSE;
+    }
 
     self->open_file_fd = robust_open(self->file_name,
                                      O_CREAT | O_EXCL | O_RDWR,
                                      VFS_DEVICE_CREAT_MODE);
     if (self->open_file_fd < 0) {
-        g_fprintf(stderr, "Can't create file %s: %s\n", self->file_name,
-                strerror(errno));
+       device_set_error(pself,
+               vstrallocf(_("Can't create file %s: %s"), self->file_name, strerror(errno)),
+               DEVICE_STATUS_DEVICE_ERROR);
         release_file(self);
         return FALSE;
     }
 
     
     if (!write_amanda_header(self, ji)) {
+       /* write_amanda_header sets error status if necessary */
         release_file(self);
         return FALSE;
     }
 
+    /* handle some accounting business */
     self->volume_bytes += VFS_DEVICE_LABEL_SIZE;
-    /* make_new_file_name set pself->file for us, but the parent class will increment it, so decrement it now */
-    pself->file--;
+    pself->in_file = TRUE;
+    pself->block = 0;
+    /* make_new_file_name set pself->file for us */
 
-    if (parent_class->start_file) {
-        parent_class->start_file(pself, ji);
-    }
     return TRUE;
 }
 
@@ -939,16 +1107,13 @@ static gboolean
 vfs_device_finish_file (Device * pself) {
     VfsDevice * self;
     self = VFS_DEVICE(pself);
-    g_return_val_if_fail(self != NULL, FALSE);
+
+    if (device_in_error(self)) return FALSE;
 
     release_file(self);
-    
-    if (parent_class->finish_file) {
-        return parent_class->finish_file(pself);
-    } else {
-        return TRUE;
-    }
-    g_assert_not_reached();
+
+    pself->in_file = FALSE;
+    return TRUE;
 }
 
 /* This function is used for two purposes, rather than one. In
@@ -965,9 +1130,12 @@ vfs_device_seek_file (Device * pself, guint requested_file) {
     IoResult result;
 
     self = VFS_DEVICE(pself);
-    g_return_val_if_fail (self != NULL, NULL);
+
+    if (device_in_error(self)) return NULL;
 
     pself->in_file = FALSE;
+    pself->is_eof = FALSE;
+    pself->block = 0;
     
     release_file(self);
 
@@ -983,26 +1151,37 @@ vfs_device_seek_file (Device * pself, guint requested_file) {
         tmp_file_name = file_number_to_file_name(self, requested_file - 1);
         if (tmp_file_name != NULL) {
             free(tmp_file_name);
+           pself->file = requested_file; /* other attributes are already correct */
             return make_tapeend_header();
         } else {
+           device_set_error(pself,
+               stralloc(_("Attempt to read past tape-end file")),
+               DEVICE_STATUS_SUCCESS);
             return NULL;
         }
     }
 
     if (!open_lock(self, file, FALSE)) {
+       device_set_error(pself,
+           stralloc(_("could not acquire lock")),
+           DEVICE_STATUS_DEVICE_ERROR);
         return NULL;
     }
 
     self->file_name = file_number_to_file_name(self, file);
     if (self->file_name == NULL) {
+       device_set_error(pself,
+           vstrallocf(_("File %d not found"), file),
+           DEVICE_STATUS_VOLUME_ERROR);
         release_file(self);
         return NULL;
     }
 
     self->open_file_fd = robust_open(self->file_name, O_RDONLY, 0);
-    if (self->open_file_fd <= 0) {
-        g_fprintf(stderr, "Couldn't open file %s: %s\n", self->file_name,
-                strerror(errno));
+    if (self->open_file_fd < 0) {
+       device_set_error(pself,
+           vstrallocf(_("Couldn't open file %s: %s"), self->file_name, strerror(errno)),
+           DEVICE_STATUS_DEVICE_ERROR);
         amfree(self->file_name);
         release_file(self);
         return NULL;
@@ -1011,34 +1190,42 @@ vfs_device_seek_file (Device * pself, guint requested_file) {
     result = vfs_device_robust_read(self, header_buffer,
                                     &header_buffer_size);
     if (result != RESULT_SUCCESS) {
-        g_fprintf(stderr, "Problem reading Amanda header.\n");
+       device_set_error(pself,
+           vstrallocf(_("Problem reading Amanda header: %s"), device_error(pself)),
+           DEVICE_STATUS_VOLUME_ERROR);
         release_file(self);
         return NULL;
     }
 
-    rval = malloc(sizeof(*rval));
+    rval = g_new(dumpfile_t, 1);
     parse_file_header(header_buffer, rval, header_buffer_size);
-    if (file > 0) {
-        switch (rval->type) {
+    switch (rval->type) {
         case F_DUMPFILE:
         case F_CONT_DUMPFILE:
         case F_SPLIT_DUMPFILE:
-            /* Chain up. */
-            if (parent_class->seek_file) {
-                parent_class->seek_file(pself, file);
-            }
-            return rval;
+           break;
+
+       case F_TAPESTART:
+           /* file 0 should have a TAPESTART header; vfs_device_read_label
+            * uses this */
+           if (requested_file == 0)
+               break;
+           /* FALLTHROUGH */
+
         default:
+           device_set_error(pself,
+               stralloc(_("Invalid amanda header while reading file header")),
+               DEVICE_STATUS_VOLUME_ERROR);
             amfree(rval);
             release_file(self);
             return NULL;
-        }
-    } else if (file == 0) {
-        return rval;
-    } else {
-        amfree(rval);
-        return NULL;
     }
+
+    /* update our state */
+    pself->in_file = TRUE;
+    pself->file = file;
+
+    return rval;
 }
 
 static gboolean 
@@ -1047,89 +1234,30 @@ vfs_device_seek_block (Device * pself, guint64 block) {
     off_t result;
 
     self = VFS_DEVICE(pself);
-    g_return_val_if_fail (self != NULL, FALSE);
-    g_return_val_if_fail (self->open_file_fd >= 0, FALSE);
+
+    g_assert(self->open_file_fd >= 0);
     g_assert(sizeof(off_t) >= sizeof(guint64));
+    if (device_in_error(self)) return FALSE;
 
     /* Pretty simple. We figure out the blocksize and use that. */
     result = lseek(self->open_file_fd,
-                   (block) * self->block_size + VFS_DEVICE_LABEL_SIZE,
+                   (block) * pself->block_size + VFS_DEVICE_LABEL_SIZE,
                    SEEK_SET);
-    return (result != (off_t)(-1));
-}
 
-static gboolean
-vfs_device_property_get (Device * pself, DevicePropertyId ID, GValue * val) {
-    VfsDevice * self;
-    self = VFS_DEVICE(pself);
-    g_return_val_if_fail(self != NULL, FALSE);
-    if (ID == PROPERTY_BLOCK_SIZE) {
-        g_value_unset_init(val, G_TYPE_INT);
-        g_value_set_int(val, self->block_size);
-        return TRUE;
-    } else if (ID == PROPERTY_MAX_VOLUME_USAGE) {
-        g_value_unset_init(val, G_TYPE_UINT64);
-        g_value_set_uint64(val, self->volume_limit);
-        return TRUE;
-    } else if (ID == PROPERTY_FREE_SPACE) {
-       QualifiedSize qsize;
-       struct fs_usage fsusage;
-       guint64 bytes_avail;
-
-       if (get_fs_usage(self->dir_name, NULL, &fsusage) == 0) {
-           if (fsusage.fsu_bavail_top_bit_set)
-               bytes_avail = 0;
-           else
-               bytes_avail = fsusage.fsu_bavail * fsusage.fsu_blocksize;
-           if (self->volume_limit && (guint64)self->volume_limit < bytes_avail / 1024)
-               bytes_avail = (guint64)self->volume_limit * 1024;
-
-           qsize.accuracy = SIZE_ACCURACY_REAL;
-           qsize.bytes = bytes_avail;
-       } else {
-           g_warning(_("get_fs_usage('%s') failed: %s"), self->dir_name, strerror(errno));
-           qsize.accuracy = SIZE_ACCURACY_UNKNOWN;
-           qsize.bytes = 0;
-       }
-       g_value_unset_init(val, QUALIFIED_SIZE_TYPE);
-       g_value_set_boxed(val, &qsize);
-       return TRUE;
-    } else {
-        if (parent_class->property_get) {
-            return parent_class->property_get(pself, ID, val);
-        } else {
-            return FALSE;
-        }
-    }
-    g_assert_not_reached();
-}
+    pself->block = block;
 
-static gboolean 
-vfs_device_property_set (Device * pself, DevicePropertyId ID, GValue * val) {
-    VfsDevice * self;
-    self = VFS_DEVICE(pself);
-    g_return_val_if_fail(self != NULL, FALSE);
-    if (ID == PROPERTY_BLOCK_SIZE) {
-        int block_size = g_value_get_int(val);
-        g_return_val_if_fail(block_size > 0, FALSE);
-        self->block_size = block_size;
-        return TRUE;
-    } else if (ID == PROPERTY_MAX_VOLUME_USAGE) {
-        self->volume_limit = g_value_get_uint64(val);
-        return TRUE;
-    } else {
-        if (parent_class->property_set) {
-            return parent_class->property_set(pself, ID, val);
-        } else {
-            return FALSE;
-        }
+    if (result == (off_t)(-1)) {
+       device_set_error(pself,
+           vstrallocf(_("Error seeking within file: %s"), strerror(errno)),
+           DEVICE_STATUS_DEVICE_ERROR);
+       return FALSE;
     }
-    g_assert_not_reached();
+
+    return TRUE;
 }
 
 static gboolean try_unlink(const char * file) {
     if (unlink(file) < 0) {
-        g_fprintf(stderr, "Can't unlink file %s: %s\n", file, strerror(errno));
         return FALSE;
     } else {
         return TRUE;
@@ -1143,8 +1271,8 @@ vfs_device_recycle_file (Device * pself, guint filenum) {
     off_t file_size;
 
     self = VFS_DEVICE(pself);
-    g_return_val_if_fail(self != NULL, FALSE);
-    g_return_val_if_fail(!(pself->in_file), FALSE);
+
+    if (device_in_error(self)) return FALSE;
 
     /* Game Plan:
      * 1) Get a write lock on the file in question.
@@ -1155,22 +1283,41 @@ vfs_device_recycle_file (Device * pself, guint filenum) {
      */
 
     self->file_name = file_number_to_file_name(self, filenum);
-
-    if (self->file_name == NULL)
+    if (self->file_name == NULL) {
+       device_set_error(pself,
+           vstrallocf(_("File %d not found"), filenum),
+           DEVICE_STATUS_VOLUME_ERROR);
         return FALSE;
+    }
 
-    if (!open_lock(self, filenum, TRUE))
+    if (!open_lock(self, filenum, FALSE)) {
+       device_set_error(pself,
+           stralloc(_("could not acquire lock")),
+           DEVICE_STATUS_DEVICE_ERROR);
         return FALSE;
+    }
 
     if (0 != stat(self->file_name, &file_status)) {
-        fprintf(stderr, "Cannot stat file %s (%s), so not removing.\n",
-                self->file_name, strerror(errno));
+       device_set_error(pself,
+           vstrallocf(_("Cannot stat file %s (%s), so not removing"),
+                                   self->file_name, strerror(errno)),
+           DEVICE_STATUS_VOLUME_ERROR);
         return FALSE;
     }
     file_size = file_status.st_size;
     
-    if (!try_unlink(self->file_name) ||
-        !try_unlink(self->file_lock_name)) {
+    if (!try_unlink(self->file_name)) {
+       device_set_error(pself,
+           vstrallocf(_("Unlink of %s failed: %s"), self->file_name, strerror(errno)),
+           DEVICE_STATUS_VOLUME_ERROR);
+        release_file(self);
+        return FALSE;
+    }
+
+    if (!try_unlink(self->file_lock_name)) {
+       device_set_error(pself,
+           vstrallocf(_("Unlink of %s failed: %s"), self->file_lock_name, strerror(errno)),
+           DEVICE_STATUS_VOLUME_ERROR);
         release_file(self);
         return FALSE;
     }
@@ -1183,6 +1330,7 @@ vfs_device_recycle_file (Device * pself, guint filenum) {
 static IoResult vfs_device_robust_read(VfsDevice * self, char *buf,
                                              int *count) {
     int fd = self->open_file_fd;
+    Device *d_self = DEVICE(self);
     int want = *count, got = 0;
 
     while (got < want) {
@@ -1213,9 +1361,11 @@ static IoResult vfs_device_robust_read(VfsDevice * self, char *buf,
             continue;
         } else {
             /* Error occured. */
-            g_fprintf(stderr, "Error reading fd %d: %s\n", fd, strerror(errno));
+           device_set_error(d_self,
+               vstrallocf(_("Error reading fd %d: %s"), fd, strerror(errno)),
+               DEVICE_STATUS_VOLUME_ERROR);
             *count = got;
-            return -1;
+            return RESULT_ERROR;
         }
     }
 
@@ -1226,6 +1376,7 @@ static IoResult vfs_device_robust_read(VfsDevice * self, char *buf,
 static IoResult
 vfs_device_robust_write(VfsDevice * self,  char *buf, int count) {
     int fd = self->open_file_fd;
+    Device *d_self = DEVICE(self);
     int rval = 0;
 
     while (rval < count) {
@@ -1256,12 +1407,15 @@ vfs_device_robust_write(VfsDevice * self,  char *buf, int count) {
 #endif
                    ) {
             /* We are definitely out of space. */
+           device_set_error(d_self,
+                   vstrallocf(_("No space left on device: %s"), strerror(errno)),
+                   DEVICE_STATUS_VOLUME_ERROR);
             return RESULT_NO_SPACE;
         } else {
             /* Error occured. Note that here we handle EIO as an error. */
-            g_fprintf(stderr, "Error writing device fd %d: %s\n",
-                    fd, strerror(errno));
-            
+           device_set_error(d_self,
+                   vstrallocf(_("Error writing device fd %d: %s"), fd, strerror(errno)),
+                   DEVICE_STATUS_VOLUME_ERROR);
             return RESULT_ERROR;
         }
     }
diff --git a/device-src/vfs-device.h b/device-src/vfs-device.h
deleted file mode 100644 (file)
index 6b5796f..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
- * 
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License version 2.1 as 
- * published by the Free Software Foundation.
- * 
- * This 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 this library; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
- * 
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
- */
-
-/* The VFS device is the driver formerly known as the vtape driver or
- * the file driver. It uses a directory on the UNIX filesystem as a
- * data store. */
-
-#include <glib.h>
-#include <glib-object.h>
-#include "device.h"
-#include <dirent.h>
-
-#ifndef VFS_DEVICE_H
-#define VFS_DEVICE_H
-
-#define VFS_DEVICE_MIN_BLOCK_SIZE (1)
-#define VFS_DEVICE_MAX_BLOCK_SIZE (INT_MAX)
-#define VFS_DEVICE_DEFAULT_BLOCK_SIZE (MAX_TAPE_BLOCK_BYTES)
-#define VFS_DEVICE_LABEL_SIZE (32768)
-
-/* This looks dangerous, but is actually modified by the umask. */
-#define VFS_DEVICE_CREAT_MODE 0666
-
-/*
- * Type checking and casting macros
- */
-#define TYPE_VFS_DEVICE        (vfs_device_get_type())
-#define VFS_DEVICE(obj)        G_TYPE_CHECK_INSTANCE_CAST((obj), vfs_device_get_type(), VfsDevice)
-#define VFS_DEVICE_CONST(obj)  G_TYPE_CHECK_INSTANCE_CAST((obj), vfs_device_get_type(), VfsDevice const)
-#define VFS_DEVICE_CLASS(klass)        G_TYPE_CHECK_CLASS_CAST((klass), vfs_device_get_type(), VfsDeviceClass)
-#define IS_VFS_DEVICE(obj)     G_TYPE_CHECK_INSTANCE_TYPE((obj), vfs_device_get_type ())
-
-#define VFS_DEVICE_GET_CLASS(obj)      G_TYPE_INSTANCE_GET_CLASS((obj), vfs_device_get_type(), VfsDeviceClass)
-
-/*
- * Main object structure
- */
-typedef struct {
-    Device __parent__;
-
-    /*< private >*/
-    DIR * dir_handle;
-    char * dir_name;
-    char * file_name;
-    int file_lock_fd;
-    char * file_lock_name;
-    int volume_lock_fd;
-    char * volume_lock_name;
-    int open_file_fd;
-    
-    /* Properties */
-    int block_size;
-    guint64 volume_bytes;
-    guint64 volume_limit;
-} VfsDevice;
-
-/*
- * Class definition
- */
-typedef struct {
-    DeviceClass __parent__;
-} VfsDeviceClass;
-
-
-/*
- * Public methods
- */
-GType  vfs_device_get_type     (void);
-void    vfs_device_register     (void);
-
-#endif
-
diff --git a/device-src/vfs-test.c b/device-src/vfs-test.c
new file mode 100644 (file)
index 0000000..1a0c436
--- /dev/null
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License version 2.1 as
+ * published by the Free Software Foundation.
+ *
+ * This 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 this library; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+ *
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+ */
+
+#include "glib-util.h"
+#include "amanda.h"
+#include "device.h"
+#include "conffile.h"
+#include "testutils.h"
+
+/* Global state set up for the tests */
+static char *device_path = NULL;
+
+/*
+ * Utilities
+ */
+
+static void
+cleanup_vtape_dir(char *device_path)
+{
+    char *quoted = g_shell_quote(device_path);
+    char *cmd = vstralloc("rm -rf ", quoted, NULL);
+
+    /* would you rather write 'rm -rf' here? */
+    if (system(cmd) == -1) {
+       exit(1);
+    }
+
+    amfree(cmd);
+    amfree(quoted);
+}
+
+static char *
+setup_vtape_dir(void)
+{
+    char *cwd = g_get_current_dir();
+    char *device_path = NULL;
+    char *data_dir = NULL;
+
+    device_path = vstralloc(cwd, "/vfs-test-XXXXXX", NULL);
+    amfree(cwd);
+
+    if (mkdtemp(device_path) == NULL) {
+       fprintf(stderr, "Could not create temporary directory in %s\n", cwd);
+       return NULL;
+    }
+
+    /* append "/data/" to that for the VFS device*/
+    data_dir = vstralloc(device_path, "/data/", NULL);
+    if (mkdir(data_dir, 0777) == -1) {
+       fprintf(stderr, "Could not create %s: %s\n", cwd, strerror(errno));
+       amfree(data_dir);
+       return NULL;
+    }
+
+    amfree(data_dir);
+    return device_path;
+}
+
+static Device *
+setup_device(void)
+{
+    Device *device;
+    char *device_name = NULL;
+
+    device_name = vstralloc("file:", device_path, NULL);
+    device = device_open(device_name);
+    if (device->status != DEVICE_STATUS_SUCCESS) {
+       g_critical("Could not open device %s: %s\n", device_name, device_error(device));
+    }
+
+    amfree(device_name);
+    return device;
+}
+
+/*
+ * Tests
+ */
+
+static int
+test_vfs_free_space(void)
+{
+    Device *device = NULL;
+    GValue value;
+    QualifiedSize qsize;
+
+    device = setup_device();
+    if (!device)
+       return FALSE;
+
+    bzero(&value, sizeof(value));
+    if (!device_property_get(device, PROPERTY_FREE_SPACE, &value)) {
+       g_debug("Could not get property_free_space\n");
+       return FALSE;
+    }
+
+    qsize = *(QualifiedSize*)g_value_get_boxed(&value);
+    g_value_unset(&value);
+
+    if (qsize.accuracy != SIZE_ACCURACY_REAL) {
+       g_debug("property_free_space accuracy is not SIZE_ACCURACY_REAL\n");
+       return FALSE;
+    }
+
+    if (qsize.bytes == 0) {
+       g_debug("property_free_space returned bytes=0\n");
+       return FALSE;
+    }
+
+    g_object_unref(device);
+
+    return TRUE;
+}
+
+/*
+ * Main driver
+ */
+
+int
+main(int argc, char **argv)
+{
+    int result;
+    static TestUtilsTest tests[] = {
+        TU_TEST(test_vfs_free_space, 5),
+       TU_END()
+    };
+
+    glib_init();
+    config_init(0, NULL);
+    device_api_init();
+
+    /* TODO: if more tests are added, we'll need a setup/cleanup hook
+     * for testutils */
+    device_path = setup_vtape_dir();
+
+    result = testutils_run_tests(argc, argv, tests);
+
+    cleanup_vtape_dir(device_path);
+    amfree(device_path);
+
+    return result;
+}
diff --git a/dumper-src/Makefile.am b/dumper-src/Makefile.am
deleted file mode 100644 (file)
index ed1aef9..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-# Makefile for Amanda wrapper programs.
-
-include $(top_srcdir)/config/automake/vars.am
-include $(top_srcdir)/config/automake/scripts.am
-include $(top_srcdir)/config/automake/installperms.am
-include $(top_srcdir)/config/automake/precompile.am
-
-INCLUDES =     -I$(top_builddir)/common-src \
-               -I$(top_srcdir)/common-src
-
-AM_CFLAGS = $(AMANDA_WARNING_CFLAGS)
-AM_LDFLAGS = $(AMANDA_STATIC_LDFLAGS)
-
-SCRIPTS_PERL = \
-           amgtar
-
-SCRIPTS_INCLUDE = \
-           generic-dumper
-EXTRA_DIST += generic-dumper.pl
-
-CHECK_PERL = $(SCRIPTS_PERL) $(SCRIPTS_INCLUDE)
-
-dumperdir = $(DUMPER_DIR)
-dumper_SCRIPTS = $(SCRIPTS_PERL)
-dumper_DATA = $(SCRIPTS_INCLUDE)
-
-INSTALLPERMS_data = dest=$(dumperdir) chown=amanda $(dumper_SCRIPTS)
diff --git a/dumper-src/Makefile.in b/dumper-src/Makefile.in
deleted file mode 100644 (file)
index bd21ff1..0000000
+++ /dev/null
@@ -1,1088 +0,0 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  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@
-
-# Makefile for Amanda wrapper programs.
-
-# vim:ft=automake
-# Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
-# 
-# This library is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License version 2.1 as 
-# published by the Free Software Foundation.
-# 
-# This 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 this library; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
-# 
-# Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
-# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
-
-# simple include file to pre-define variables which are then +='d by other
-# scripts in this directory.
-
-# vim:ft=automake
-# Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
-# 
-# This library is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License version 2.1 as 
-# published by the Free Software Foundation.
-# 
-# This 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 this library; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
-# 
-# Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
-# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
-
-# SYNOPSIS:
-#
-# Automake magic to handle the various tasks of building scripts.  Scripts can
-# be built down to extensionless executables (e.g., foo.pl -> foo), or to 
-# files with the usual extension (foo-lib.sh.in -> foo.sh).
-#
-# Files which support it are syntax-checked when the user invokes 'make check'.
-#
-# All *target* filenames must be listed in SCRIPTS_SHELL, SCRIPTS_PERL, and 
-# SCRIPTS_AWK to support 'make check', 'make dist', and 'make distclean'.
-#
-# USAGE:
-#
-#   include $(top_srcdir)/config/automake/vars.am
-#   include $(top_srcdir)/config/automake/scripts.am
-#   ...
-#   SCRIPTS_PERL = fooscript barscript perl-lib.pl perlmod.pm
-#   SCRIPTS_SHELL = shell1 shell2 sh-lib.sh
-#   SCRIPTS_AWK = talk balk chalk awk-lib.awk
-#
-# with the corresponding files in the repository:
-#
-#   fooscript.pl barscript.pl perl-lib.pl.in perlmod.pm.in
-#   shell1.sh shell2.sh sh-lib.sh.in
-#   talk.awk balk.awk chalk.awk awk-lib.awk.in
-#
-# by default, all shell and perl scripts are syntax checked.  If this is
-# a problem (for example, perl scripts depending on Amanda extension 
-# modules), then assign to CHECK_{PERL,SHELL} the list of files you wish
-# to be checked (which can be empty).
-#
-# To add extra flags to the perl checks (e.g., to add new -I flags), set
-# CHECK_PERL_FLAGS.
-
-# Implementation note:
-#
-# This file uses config.status to substitute @foo@ in those scripts while
-# converting them. It also adds the executable bits (a+x) to extensionless
-# files.  The substitution works even though the files are not listed in 
-# configure.in
-
-# vim:ft=automake
-#
-# Adjust post-install permissions settings.  This rule works off two
-# specially-formatted variables, INSTALLPERMS_exec and INSTALLPERMS_data. 
-# Each is a whitespace-separated list of commands, all of which are either
-# a variable assignment or a filename.  Three variables are available:
-#
-#  - dest= sets the destination directory to e.g., $(sbindir)
-#  - chown= controls changes in ownership; value is first argument to chown
-#  - chmod= controls changes in permissions; value is first argument to chmod
-#
-# As a special case, chown=amanda is taken as equivalent to 
-# chown=$(BINARY_OWNER):$(SETUID_GROUP), which may otherwise have problems with
-# whitespace in the user/group names.
-# 
-# when a filename is seen, the currently active variables are applied.
-#
-# Note that scripts are data, not executables!
-#
-# EXAMPLE
-#
-# sbin_PROGRAMS = foo bar bing
-# libexec_PROGRAMS = pro gram
-# sbin_SCRIPTS = sk ript
-# INSTALLPERMS_exec = \
-#      dest=$(sbindir) chown=amanda chmod= \
-#              foo bar \
-#      chmod=u+s,o-rwx \
-#              bing
-#      dest=$(libexecdir) chmod= \
-#              $(libexec_PROGRAMS)
-# INSTALLPERMS_data = \
-#      dest=$(sbindir) chown=amanda chmod= \
-#              $(sbin_SCRIPTS)
-#
-# This whole operation is not required when making builds for packaging,
-# and can be disabled with --disable-installperms, via the WANT_INSTALLPERMS
-# AM_CONDITIONAL.
-
-# vim:ft=automake
-
-
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-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@
-target_triplet = @target@
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
-       $(top_srcdir)/config/automake/installperms.am \
-       $(top_srcdir)/config/automake/precompile.am \
-       $(top_srcdir)/config/automake/scripts.am \
-       $(top_srcdir)/config/automake/vars.am
-subdir = dumper-src
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps =  \
-       $(top_srcdir)/config/macro-archive/ac_define_dir.m4 \
-       $(top_srcdir)/config/macro-archive/ac_prog_perl_version.m4 \
-       $(top_srcdir)/config/macro-archive/ac_prog_swig.m4 \
-       $(top_srcdir)/config/macro-archive/ax_compare_version.m4 \
-       $(top_srcdir)/config/macro-archive/docbook-dtd.m4 \
-       $(top_srcdir)/config/macro-archive/docbook-xslt-min.m4 \
-       $(top_srcdir)/config/macro-archive/docbook-xslt.m4 \
-       $(top_srcdir)/config/macro-archive/xsltproc.m4 \
-       $(top_srcdir)/config/amanda/amplot.m4 \
-       $(top_srcdir)/config/amanda/bsd-security.m4 \
-       $(top_srcdir)/config/amanda/bsdtcp-security.m4 \
-       $(top_srcdir)/config/amanda/bsdudp-security.m4 \
-       $(top_srcdir)/config/amanda/changer.m4 \
-       $(top_srcdir)/config/amanda/components.m4 \
-       $(top_srcdir)/config/amanda/compress.m4 \
-       $(top_srcdir)/config/amanda/config.m4 \
-       $(top_srcdir)/config/amanda/debugging.m4 \
-       $(top_srcdir)/config/amanda/defaults.m4 \
-       $(top_srcdir)/config/amanda/devprefix.m4 \
-       $(top_srcdir)/config/amanda/dirs.m4 \
-       $(top_srcdir)/config/amanda/documentation.m4 \
-       $(top_srcdir)/config/amanda/dumpers.m4 \
-       $(top_srcdir)/config/amanda/flags.m4 \
-       $(top_srcdir)/config/amanda/flock.m4 \
-       $(top_srcdir)/config/amanda/funcs.m4 \
-       $(top_srcdir)/config/amanda/getfsent.m4 \
-       $(top_srcdir)/config/amanda/i18n.m4 \
-       $(top_srcdir)/config/amanda/ipv6.m4 \
-       $(top_srcdir)/config/amanda/krb4-security.m4 \
-       $(top_srcdir)/config/amanda/krb5-security.m4 \
-       $(top_srcdir)/config/amanda/lfs.m4 \
-       $(top_srcdir)/config/amanda/libs.m4 \
-       $(top_srcdir)/config/amanda/net.m4 \
-       $(top_srcdir)/config/amanda/progs.m4 \
-       $(top_srcdir)/config/amanda/readdir.m4 \
-       $(top_srcdir)/config/amanda/readline.m4 \
-       $(top_srcdir)/config/amanda/rsh-security.m4 \
-       $(top_srcdir)/config/amanda/s3-device.m4 \
-       $(top_srcdir)/config/amanda/shmem.m4 \
-       $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \
-       $(top_srcdir)/config/amanda/ssh-security.m4 \
-       $(top_srcdir)/config/amanda/summary.m4 \
-       $(top_srcdir)/config/amanda/swig.m4 \
-       $(top_srcdir)/config/amanda/syshacks.m4 \
-       $(top_srcdir)/config/amanda/tape.m4 \
-       $(top_srcdir)/config/amanda/types.m4 \
-       $(top_srcdir)/config/amanda/userid.m4 \
-       $(top_srcdir)/config/amanda/version.m4 \
-       $(top_srcdir)/config/gnulib/alloca.m4 \
-       $(top_srcdir)/config/gnulib/arpa_inet_h.m4 \
-       $(top_srcdir)/config/gnulib/base64.m4 \
-       $(top_srcdir)/config/gnulib/eoverflow.m4 \
-       $(top_srcdir)/config/gnulib/extensions.m4 \
-       $(top_srcdir)/config/gnulib/float_h.m4 \
-       $(top_srcdir)/config/gnulib/fsusage.m4 \
-       $(top_srcdir)/config/gnulib/getaddrinfo.m4 \
-       $(top_srcdir)/config/gnulib/gettimeofday.m4 \
-       $(top_srcdir)/config/gnulib/gnulib-comp.m4 \
-       $(top_srcdir)/config/gnulib/include_next.m4 \
-       $(top_srcdir)/config/gnulib/inet_ntop.m4 \
-       $(top_srcdir)/config/gnulib/intmax_t.m4 \
-       $(top_srcdir)/config/gnulib/lock.m4 \
-       $(top_srcdir)/config/gnulib/longlong.m4 \
-       $(top_srcdir)/config/gnulib/malloc.m4 \
-       $(top_srcdir)/config/gnulib/mkdtemp.m4 \
-       $(top_srcdir)/config/gnulib/netinet_in_h.m4 \
-       $(top_srcdir)/config/gnulib/onceonly_2_57.m4 \
-       $(top_srcdir)/config/gnulib/physmem.m4 \
-       $(top_srcdir)/config/gnulib/safe-read.m4 \
-       $(top_srcdir)/config/gnulib/safe-write.m4 \
-       $(top_srcdir)/config/gnulib/snprintf.m4 \
-       $(top_srcdir)/config/gnulib/socklen.m4 \
-       $(top_srcdir)/config/gnulib/sockpfaf.m4 \
-       $(top_srcdir)/config/gnulib/ssize_t.m4 \
-       $(top_srcdir)/config/gnulib/stdbool.m4 \
-       $(top_srcdir)/config/gnulib/stdint.m4 \
-       $(top_srcdir)/config/gnulib/stdio_h.m4 \
-       $(top_srcdir)/config/gnulib/stdlib_h.m4 \
-       $(top_srcdir)/config/gnulib/strdup.m4 \
-       $(top_srcdir)/config/gnulib/string_h.m4 \
-       $(top_srcdir)/config/gnulib/sys_socket_h.m4 \
-       $(top_srcdir)/config/gnulib/sys_stat_h.m4 \
-       $(top_srcdir)/config/gnulib/sys_time_h.m4 \
-       $(top_srcdir)/config/gnulib/tempname.m4 \
-       $(top_srcdir)/config/gnulib/ulonglong.m4 \
-       $(top_srcdir)/config/gnulib/unistd_h.m4 \
-       $(top_srcdir)/config/gnulib/vasnprintf.m4 \
-       $(top_srcdir)/config/gnulib/visibility.m4 \
-       $(top_srcdir)/config/gnulib/wchar.m4 \
-       $(top_srcdir)/config/gettext-macros/gettext.m4 \
-       $(top_srcdir)/config/gettext-macros/iconv.m4 \
-       $(top_srcdir)/config/gettext-macros/inttypes_h.m4 \
-       $(top_srcdir)/config/gettext-macros/lib-ld.m4 \
-       $(top_srcdir)/config/gettext-macros/lib-link.m4 \
-       $(top_srcdir)/config/gettext-macros/lib-prefix.m4 \
-       $(top_srcdir)/config/gettext-macros/longlong.m4 \
-       $(top_srcdir)/config/gettext-macros/nls.m4 \
-       $(top_srcdir)/config/gettext-macros/po.m4 \
-       $(top_srcdir)/config/gettext-macros/progtest.m4 \
-       $(top_srcdir)/config/gettext-macros/size_max.m4 \
-       $(top_srcdir)/config/gettext-macros/stdint_h.m4 \
-       $(top_srcdir)/config/gettext-macros/wchar_t.m4 \
-       $(top_srcdir)/config/gettext-macros/wint_t.m4 \
-       $(top_srcdir)/config/gettext-macros/xsize.m4 \
-       $(top_srcdir)/config/libtool.m4 $(top_srcdir)/configure.in
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-       $(ACLOCAL_M4)
-mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
-CONFIG_HEADER = $(top_builddir)/config/config.h
-CONFIG_CLEAN_FILES =
-am__installdirs = "$(DESTDIR)$(dumperdir)" "$(DESTDIR)$(dumperdir)"
-dumperSCRIPT_INSTALL = $(INSTALL_SCRIPT)
-SCRIPTS = $(dumper_SCRIPTS)
-SOURCES =
-DIST_SOURCES =
-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|^.*/||'`;
-dumperDATA_INSTALL = $(INSTALL_DATA)
-DATA = $(dumper_DATA)
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-ALLOCA = @ALLOCA@
-ALLOCA_H = @ALLOCA_H@
-AMANDA_DBGDIR = @AMANDA_DBGDIR@
-AMANDA_DEBUG_DAYS = @AMANDA_DEBUG_DAYS@
-AMANDA_STATIC_LDFLAGS = @AMANDA_STATIC_LDFLAGS@
-AMANDA_TMPDIR = @AMANDA_TMPDIR@
-AMANDA_WARNING_CFLAGS = @AMANDA_WARNING_CFLAGS@
-AMLINT = @AMLINT@
-AMLINTFLAGS = @AMLINTFLAGS@
-AMPLOT_CAT_COMPRESS = @AMPLOT_CAT_COMPRESS@
-AMPLOT_CAT_GZIP = @AMPLOT_CAT_GZIP@
-AMPLOT_CAT_PACK = @AMPLOT_CAT_PACK@
-AMPLOT_COMPRESS = @AMPLOT_COMPRESS@
-AMTAR = @AMTAR@
-AR = @AR@
-ARPA_INET_H = @ARPA_INET_H@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-BASH = @BASH@
-BINARY_OWNER = @BINARY_OWNER@
-BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@
-BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@
-BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@
-BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@
-BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@
-CAT = @CAT@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
-CHIO = @CHIO@
-CHS = @CHS@
-CLIENT_LOGIN = @CLIENT_LOGIN@
-CLIENT_SCRIPTS_OPT = @CLIENT_SCRIPTS_OPT@
-COMPRESS = @COMPRESS@
-CONFIG_DIR = @CONFIG_DIR@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CURL_CONFIG = @CURL_CONFIG@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DD = @DD@
-DEFAULT_AMANDATES_FILE = @DEFAULT_AMANDATES_FILE@
-DEFAULT_CHANGER_DEVICE = @DEFAULT_CHANGER_DEVICE@
-DEFAULT_CONFIG = @DEFAULT_CONFIG@
-DEFAULT_SERVER = @DEFAULT_SERVER@
-DEFAULT_TAPE_DEVICE = @DEFAULT_TAPE_DEVICE@
-DEFAULT_TAPE_SERVER = @DEFAULT_TAPE_SERVER@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DOC_BUILD_DATE = @DOC_BUILD_DATE@
-DUMP = @DUMP@
-DUMPER_DIR = @DUMPER_DIR@
-ECHO = @ECHO@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EOVERFLOW = @EOVERFLOW@
-EXAMPLE_TAPEDEV = @EXAMPLE_TAPEDEV@
-EXEEXT = @EXEEXT@
-F77 = @F77@
-FFLAGS = @FFLAGS@
-FLOAT_H = @FLOAT_H@
-GETCONF = @GETCONF@
-GETTEXT = @GETTEXT@
-GLIB_CFLAGS = @GLIB_CFLAGS@
-GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
-GLIB_LIBS = @GLIB_LIBS@
-GLIB_MKENUMS = @GLIB_MKENUMS@
-GMSGFMT = @GMSGFMT@
-GMSGFMT_015 = @GMSGFMT_015@
-GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
-GNULIB_CHOWN = @GNULIB_CHOWN@
-GNULIB_DUP2 = @GNULIB_DUP2@
-GNULIB_FCHDIR = @GNULIB_FCHDIR@
-GNULIB_FFLUSH = @GNULIB_FFLUSH@
-GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
-GNULIB_FSEEK = @GNULIB_FSEEK@
-GNULIB_FSEEKO = @GNULIB_FSEEKO@
-GNULIB_FTELL = @GNULIB_FTELL@
-GNULIB_FTELLO = @GNULIB_FTELLO@
-GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@
-GNULIB_GETCWD = @GNULIB_GETCWD@
-GNULIB_GETDELIM = @GNULIB_GETDELIM@
-GNULIB_GETLINE = @GNULIB_GETLINE@
-GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
-GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
-GNULIB_LCHOWN = @GNULIB_LCHOWN@
-GNULIB_LSEEK = @GNULIB_LSEEK@
-GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@
-GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@
-GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@
-GNULIB_MBSCHR = @GNULIB_MBSCHR@
-GNULIB_MBSCSPN = @GNULIB_MBSCSPN@
-GNULIB_MBSLEN = @GNULIB_MBSLEN@
-GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@
-GNULIB_MBSNLEN = @GNULIB_MBSNLEN@
-GNULIB_MBSPBRK = @GNULIB_MBSPBRK@
-GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@
-GNULIB_MBSRCHR = @GNULIB_MBSRCHR@
-GNULIB_MBSSEP = @GNULIB_MBSSEP@
-GNULIB_MBSSPN = @GNULIB_MBSSPN@
-GNULIB_MBSSTR = @GNULIB_MBSSTR@
-GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@
-GNULIB_MEMMEM = @GNULIB_MEMMEM@
-GNULIB_MEMPCPY = @GNULIB_MEMPCPY@
-GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
-GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
-GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
-GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
-GNULIB_READLINK = @GNULIB_READLINK@
-GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@
-GNULIB_SLEEP = @GNULIB_SLEEP@
-GNULIB_SNPRINTF = @GNULIB_SNPRINTF@
-GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@
-GNULIB_STPCPY = @GNULIB_STPCPY@
-GNULIB_STPNCPY = @GNULIB_STPNCPY@
-GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
-GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
-GNULIB_STRDUP = @GNULIB_STRDUP@
-GNULIB_STRNDUP = @GNULIB_STRNDUP@
-GNULIB_STRNLEN = @GNULIB_STRNLEN@
-GNULIB_STRPBRK = @GNULIB_STRPBRK@
-GNULIB_STRSEP = @GNULIB_STRSEP@
-GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
-GNULIB_VASPRINTF = @GNULIB_VASPRINTF@
-GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@
-GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
-GNULIB_VSNPRINTF = @GNULIB_VSNPRINTF@
-GNULIB_VSPRINTF_POSIX = @GNULIB_VSPRINTF_POSIX@
-GNULIB_WCWIDTH = @GNULIB_WCWIDTH@
-GNUPLOT = @GNUPLOT@
-GNUTAR = @GNUTAR@
-GNUTAR_LISTED_INCREMENTAL_DIR = @GNUTAR_LISTED_INCREMENTAL_DIR@
-GOBJECT_QUERY = @GOBJECT_QUERY@
-GREP = @GREP@
-GZIP = @GZIP@
-HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@
-HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@
-HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@
-HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
-HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@
-HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
-HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@
-HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
-HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
-HAVE_DECL_STRNCASECMP = @HAVE_DECL_STRNCASECMP@
-HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
-HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
-HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
-HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
-HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
-HAVE_DUP2 = @HAVE_DUP2@
-HAVE_FSEEKO = @HAVE_FSEEKO@
-HAVE_FTELLO = @HAVE_FTELLO@
-HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
-HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
-HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
-HAVE_IO_H = @HAVE_IO_H@
-HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
-HAVE_LSTAT = @HAVE_LSTAT@
-HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@
-HAVE_MEMPCPY = @HAVE_MEMPCPY@
-HAVE_MKDTEMP = @HAVE_MKDTEMP@
-HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@
-HAVE_READLINK = @HAVE_READLINK@
-HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@
-HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
-HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
-HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
-HAVE_SLEEP = @HAVE_SLEEP@
-HAVE_STDINT_H = @HAVE_STDINT_H@
-HAVE_STPCPY = @HAVE_STPCPY@
-HAVE_STPNCPY = @HAVE_STPNCPY@
-HAVE_STRCASECMP = @HAVE_STRCASECMP@
-HAVE_STRCASESTR = @HAVE_STRCASESTR@
-HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
-HAVE_STRNDUP = @HAVE_STRNDUP@
-HAVE_STRPBRK = @HAVE_STRPBRK@
-HAVE_STRSEP = @HAVE_STRSEP@
-HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@
-HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
-HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
-HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
-HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
-HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
-HAVE_UNISTD_H = @HAVE_UNISTD_H@
-HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
-HAVE_VASPRINTF = @HAVE_VASPRINTF@
-HAVE_VISIBILITY = @HAVE_VISIBILITY@
-HAVE_WCHAR_H = @HAVE_WCHAR_H@
-HAVE_WINSOCK2_H = @HAVE_WINSOCK2_H@
-HAVE_WS2TCPIP_H = @HAVE_WS2TCPIP_H@
-HAVE__BOOL = @HAVE__BOOL@
-INCLUDE_NEXT = @INCLUDE_NEXT@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-INTLLIBS = @INTLLIBS@
-INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
-LDFLAGS = @LDFLAGS@
-LEX = @LEX@
-LEXLIB = @LEXLIB@
-LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
-LIBCURL = @LIBCURL@
-LIBCURL_CPPFLAGS = @LIBCURL_CPPFLAGS@
-LIBICONV = @LIBICONV@
-LIBINTL = @LIBINTL@
-LIBMULTITHREAD = @LIBMULTITHREAD@
-LIBOBJS = @LIBOBJS@
-LIBPTH = @LIBPTH@
-LIBS = @LIBS@
-LIBTHREAD = @LIBTHREAD@
-LIBTOOL = @LIBTOOL@
-LIBTOOL_DEPS = @LIBTOOL_DEPS@
-LN_S = @LN_S@
-LTLIBICONV = @LTLIBICONV@
-LTLIBINTL = @LTLIBINTL@
-LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
-LTLIBOBJS = @LTLIBOBJS@
-LTLIBPTH = @LTLIBPTH@
-LTLIBTHREAD = @LTLIBTHREAD@
-MAILER = @MAILER@
-MAKEINFO = @MAKEINFO@
-MAXTAPEBLOCKSIZE = @MAXTAPEBLOCKSIZE@
-MCUTIL = @MCUTIL@
-MKDIR_P = @MKDIR_P@
-MSGFMT = @MSGFMT@
-MSGFMT_015 = @MSGFMT_015@
-MSGMERGE = @MSGMERGE@
-MT = @MT@
-MTX = @MTX@
-MT_FILE_FLAG = @MT_FILE_FLAG@
-NETINET_IN_H = @NETINET_IN_H@
-NEXT_FLOAT_H = @NEXT_FLOAT_H@
-NEXT_NETINET_IN_H = @NEXT_NETINET_IN_H@
-NEXT_STDINT_H = @NEXT_STDINT_H@
-NEXT_STDIO_H = @NEXT_STDIO_H@
-NEXT_STDLIB_H = @NEXT_STDLIB_H@
-NEXT_STRING_H = @NEXT_STRING_H@
-NEXT_SYS_SOCKET_H = @NEXT_SYS_SOCKET_H@
-NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@
-NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@
-NEXT_UNISTD_H = @NEXT_UNISTD_H@
-NEXT_WCHAR_H = @NEXT_WCHAR_H@
-OBJEXT = @OBJEXT@
-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@
-PCAT = @PCAT@
-PERL = @PERL@
-PERLEXTLIBS = @PERLEXTLIBS@
-PERL_INC = @PERL_INC@
-PKG_CONFIG = @PKG_CONFIG@
-POSUB = @POSUB@
-PRINT = @PRINT@
-PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
-RANLIB = @RANLIB@
-READLINE_LIBS = @READLINE_LIBS@
-REPLACE_CHOWN = @REPLACE_CHOWN@
-REPLACE_FCHDIR = @REPLACE_FCHDIR@
-REPLACE_FFLUSH = @REPLACE_FFLUSH@
-REPLACE_FPRINTF = @REPLACE_FPRINTF@
-REPLACE_FSEEK = @REPLACE_FSEEK@
-REPLACE_FSEEKO = @REPLACE_FSEEKO@
-REPLACE_FTELL = @REPLACE_FTELL@
-REPLACE_FTELLO = @REPLACE_FTELLO@
-REPLACE_GETCWD = @REPLACE_GETCWD@
-REPLACE_GETLINE = @REPLACE_GETLINE@
-REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
-REPLACE_LCHOWN = @REPLACE_LCHOWN@
-REPLACE_LSEEK = @REPLACE_LSEEK@
-REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
-REPLACE_PRINTF = @REPLACE_PRINTF@
-REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
-REPLACE_SPRINTF = @REPLACE_SPRINTF@
-REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
-REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
-REPLACE_VPRINTF = @REPLACE_VPRINTF@
-REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
-REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
-REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
-RESTORE = @RESTORE@
-SAMBA_CLIENT = @SAMBA_CLIENT@
-SERVICE_SUFFIX = @SERVICE_SUFFIX@
-SETUID_GROUP = @SETUID_GROUP@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@
-SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
-SNAPSHOT_STAMP = @SNAPSHOT_STAMP@
-SORT = @SORT@
-SSH = @SSH@
-STDBOOL_H = @STDBOOL_H@
-STDINT_H = @STDINT_H@
-STRIP = @STRIP@
-SVN = @SVN@
-SWIG = @SWIG@
-SWIG_LIB = @SWIG_LIB@
-SYS_SOCKET_H = @SYS_SOCKET_H@
-SYS_STAT_H = @SYS_STAT_H@
-SYS_TIME_H = @SYS_TIME_H@
-USE_NLS = @USE_NLS@
-USE_VERSION_SUFFIXES = @USE_VERSION_SUFFIXES@
-VDUMP = @VDUMP@
-VERSION = @VERSION@
-VERSION_COMMENT = @VERSION_COMMENT@
-VERSION_MAJOR = @VERSION_MAJOR@
-VERSION_MINOR = @VERSION_MINOR@
-VERSION_PATCH = @VERSION_PATCH@
-VERSION_SUFFIX = @VERSION_SUFFIX@
-VRESTORE = @VRESTORE@
-VXDUMP = @VXDUMP@
-VXRESTORE = @VXRESTORE@
-WCHAR_H = @WCHAR_H@
-WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@
-WINT_T_SUFFIX = @WINT_T_SUFFIX@
-XFSDUMP = @XFSDUMP@
-XFSRESTORE = @XFSRESTORE@
-XGETTEXT = @XGETTEXT@
-XGETTEXT_015 = @XGETTEXT_015@
-XSLREL = @XSLREL@
-XSLTPROC = @XSLTPROC@
-XSLTPROC_FLAGS = @XSLTPROC_FLAGS@
-YACC = @YACC@
-YFLAGS = @YFLAGS@
-_libcurl_config = @_libcurl_config@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-amincludedir = @amincludedir@
-amlibdir = @amlibdir@
-amlibexecdir = @amlibexecdir@
-amperldir = @amperldir@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-gl_LIBOBJS = @gl_LIBOBJS@
-gl_LTLIBOBJS = @gl_LTLIBOBJS@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target = @target@
-target_alias = @target_alias@
-target_cpu = @target_cpu@
-target_os = @target_os@
-target_vendor = @target_vendor@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-SUFFIXES = 
-EXTRA_DIST = generic-dumper.pl
-BUILT_SOURCES = 
-MOSTLYCLEANFILES = 
-
-# config.status leaves config.log files around
-CLEANFILES = config.log
-
-# and we'll need to clean up our generated files for distclean
-DISTCLEANFILES = $(SCRIPTS_SHELL) $(SCRIPTS_PERL) $(SCRIPTS_AWK)
-MAINTAINERCLEANFILES = 
-
-# syntax-check shell scripts on 'make check'
-CHECK_SHELL = $(SCRIPTS_SHELL)
-
-# sed expression to strip leading directories from a filename; this converts e.g.,
-# src/foo/bar.so to bar.so.
-strip_leading_dirs = s|^.*/||
-INCLUDES = -I$(top_builddir)/common-src \
-               -I$(top_srcdir)/common-src
-
-AM_CFLAGS = $(AMANDA_WARNING_CFLAGS)
-AM_LDFLAGS = $(AMANDA_STATIC_LDFLAGS)
-SCRIPTS_PERL = \
-           amgtar
-
-SCRIPTS_INCLUDE = \
-           generic-dumper
-
-CHECK_PERL = $(SCRIPTS_PERL) $(SCRIPTS_INCLUDE)
-dumperdir = $(DUMPER_DIR)
-dumper_SCRIPTS = $(SCRIPTS_PERL)
-dumper_DATA = $(SCRIPTS_INCLUDE)
-INSTALLPERMS_data = dest=$(dumperdir) chown=amanda $(dumper_SCRIPTS)
-all: $(BUILT_SOURCES)
-       $(MAKE) $(AM_MAKEFLAGS) all-am
-
-.SUFFIXES:
-.SUFFIXES: 
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(top_srcdir)/config/automake/vars.am $(top_srcdir)/config/automake/scripts.am $(top_srcdir)/config/automake/installperms.am $(top_srcdir)/config/automake/precompile.am $(am__configure_deps)
-       @for dep in $?; do \
-         case '$(am__configure_deps)' in \
-           *$$dep*) \
-             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-               && exit 0; \
-             exit 1;; \
-         esac; \
-       done; \
-       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  dumper-src/Makefile'; \
-       cd $(top_srcdir) && \
-         $(AUTOMAKE) --gnu  dumper-src/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-       @case '$?' in \
-         *config.status*) \
-           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
-         *) \
-           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
-       esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure:  $(am__configure_deps)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-install-dumperSCRIPTS: $(dumper_SCRIPTS)
-       @$(NORMAL_INSTALL)
-       test -z "$(dumperdir)" || $(MKDIR_P) "$(DESTDIR)$(dumperdir)"
-       @list='$(dumper_SCRIPTS)'; for p in $$list; do \
-         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-         if test -f $$d$$p; then \
-           f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
-           echo " $(dumperSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(dumperdir)/$$f'"; \
-           $(dumperSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(dumperdir)/$$f"; \
-         else :; fi; \
-       done
-
-uninstall-dumperSCRIPTS:
-       @$(NORMAL_UNINSTALL)
-       @list='$(dumper_SCRIPTS)'; for p in $$list; do \
-         f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
-         echo " rm -f '$(DESTDIR)$(dumperdir)/$$f'"; \
-         rm -f "$(DESTDIR)$(dumperdir)/$$f"; \
-       done
-
-mostlyclean-libtool:
-       -rm -f *.lo
-
-clean-libtool:
-       -rm -rf .libs _libs
-install-dumperDATA: $(dumper_DATA)
-       @$(NORMAL_INSTALL)
-       test -z "$(dumperdir)" || $(MKDIR_P) "$(DESTDIR)$(dumperdir)"
-       @list='$(dumper_DATA)'; for p in $$list; do \
-         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-         f=$(am__strip_dir) \
-         echo " $(dumperDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(dumperdir)/$$f'"; \
-         $(dumperDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(dumperdir)/$$f"; \
-       done
-
-uninstall-dumperDATA:
-       @$(NORMAL_UNINSTALL)
-       @list='$(dumper_DATA)'; for p in $$list; do \
-         f=$(am__strip_dir) \
-         echo " rm -f '$(DESTDIR)$(dumperdir)/$$f'"; \
-         rm -f "$(DESTDIR)$(dumperdir)/$$f"; \
-       done
-tags: TAGS
-TAGS:
-
-ctags: CTAGS
-CTAGS:
-
-
-distdir: $(DISTFILES)
-       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-       list='$(DISTFILES)'; \
-         dist_files=`for file in $$list; do echo $$file; done | \
-         sed -e "s|^$$srcdirstrip/||;t" \
-             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
-       case $$dist_files in \
-         */*) $(MKDIR_P) `echo "$$dist_files" | \
-                          sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
-                          sort -u` ;; \
-       esac; \
-       for file in $$dist_files; do \
-         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-         if test -d $$d/$$file; then \
-           dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
-           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
-       $(MAKE) $(AM_MAKEFLAGS) \
-         top_distdir="$(top_distdir)" distdir="$(distdir)" \
-         dist-hook
-check-am: all-am
-       $(MAKE) $(AM_MAKEFLAGS) check-local
-check: $(BUILT_SOURCES)
-       $(MAKE) $(AM_MAKEFLAGS) check-am
-all-am: Makefile $(SCRIPTS) $(DATA)
-installdirs:
-       for dir in "$(DESTDIR)$(dumperdir)" "$(DESTDIR)$(dumperdir)"; do \
-         test -z "$$dir" || $(MKDIR_P) "$$dir"; \
-       done
-install: $(BUILT_SOURCES)
-       $(MAKE) $(AM_MAKEFLAGS) install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
-       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-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:
-       -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
-
-clean-generic:
-       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
-
-distclean-generic:
-       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-       -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
-
-maintainer-clean-generic:
-       @echo "This command is intended for maintainers to use"
-       @echo "it deletes files that may require special tools to rebuild."
-       -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
-       -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-@WANT_INSTALLPERMS_FALSE@install-exec-hook:
-@WANT_INSTALLPERMS_FALSE@install-data-hook:
-clean: clean-am
-
-clean-am: clean-generic clean-libtool mostlyclean-am
-
-distclean: distclean-am
-       -rm -f Makefile
-distclean-am: clean-am distclean-generic
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-info: info-am
-
-info-am:
-
-install-data-am: install-dumperDATA install-dumperSCRIPTS
-       @$(NORMAL_INSTALL)
-       $(MAKE) $(AM_MAKEFLAGS) install-data-hook
-
-install-dvi: install-dvi-am
-
-install-exec-am:
-       @$(NORMAL_INSTALL)
-       $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
-
-install-html: install-html-am
-
-install-info: install-info-am
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-ps: install-ps-am
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
-       -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-generic mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am: uninstall-dumperDATA uninstall-dumperSCRIPTS
-
-.MAKE: install-am install-data-am install-exec-am install-strip
-
-.PHONY: all all-am check check-am check-local clean clean-generic \
-       clean-libtool dist-hook distclean distclean-generic \
-       distclean-libtool distdir dvi dvi-am html html-am info info-am \
-       install install-am install-data install-data-am \
-       install-data-hook install-dumperDATA install-dumperSCRIPTS \
-       install-dvi install-dvi-am install-exec install-exec-am \
-       install-exec-hook install-html install-html-am install-info \
-       install-info-am install-man install-pdf install-pdf-am \
-       install-ps install-ps-am install-strip installcheck \
-       installcheck-am installdirs maintainer-clean \
-       maintainer-clean-generic mostlyclean mostlyclean-generic \
-       mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
-       uninstall-dumperDATA uninstall-dumperSCRIPTS
-
-
-# Perl
-%: %.pl $(top_builddir)/config.status
-       $(top_builddir)/config.status --file=$@:$<
-       chmod a+x $@
-
-%.pl: %.pl.in $(top_builddir)/config.status
-       $(top_builddir)/config.status --file=$@:$<
-
-%.pm: %.pm.in $(top_builddir)/config.status
-       $(top_builddir)/config.status --file=$@:$<
-
-# Shell
-%: %.sh $(top_builddir)/config.status
-       $(top_builddir)/config.status --file=$@:$<
-       chmod a+x $@
-
-%.sh: %.sh.in $(top_builddir)/config.status
-       $(top_builddir)/config.status --file=$@:$<
-
-# Awk
-%: %.awk $(top_builddir)/config.status
-       $(top_builddir)/config.status --file=$@:$<
-       chmod a+x $@
-
-%.awk: %.awk.in $(top_builddir)/config.status
-       $(top_builddir)/config.status --file=$@:$<
-
-# syntax-check perl scripts on 'make check'
-check-perl: $(CHECK_PERL)
-       @CHECK_PERL="$(CHECK_PERL)"; \
-       if test -n "$(PERL)"; then \
-               for perlobj in $$CHECK_PERL; do \
-                       $(PERL) $(CHECK_PERL_FLAGS) -c -w -T $$perlobj || exit 1; \
-               done; \
-       fi
-check-local: check-perl
-check-shell: $(CHECK_SHELL)
-       @CHECK_SHELL="$(CHECK_SHELL)"; \
-       if test -n "$$CHECK_SHELL"; then \
-               if test -n "$(BASH)"; then \
-                       for shobj in $$CHECK_SHELL; do \
-                               if $(BASH) -n $$shobj; then \
-                                       echo "$$shobj syntax OK"; \
-                               else \
-                                       echo "$$shobj syntax error"; \
-                                       exit 1; \
-                               fi; \
-                       done; \
-               else \
-                       echo "No 'bash' available -- cannot syntax-check shell scripts"; \
-               fi; \
-       fi
-check-local: check-shell
-
-# make sure that the sources for all shell and perl scripts get included
-# in the distribution
-dist-scripts:
-       SCRIPTS_PERL="$(SCRIPTS_PERL)"; SCRIPTS_SHELL="$(SCRIPTS_SHELL)"; SCRIPTS_AWK="$(SCRIPTS_AWK)"; \
-       for script in $$SCRIPTS_PERL; do \
-               test -f $(srcdir)/$${script}.pl && { cp -p $(srcdir)/$${script}.pl $(distdir)/ || exit 1; } \
-       done; \
-       for script in $$SCRIPTS_SHELL; do \
-               test -f $(srcdir)/$${script}.sh && { cp -p $(srcdir)/$${script}.sh $(distdir)/ || exit 1; } \
-       done; \
-       for script in $$SCRIPTS_AWK; do \
-               test -f $(srcdir)/$${script}.awk && { cp -p $(srcdir)/$${script}.awk $(distdir)/ || exit 1; } \
-       done; \
-       for script in $$SCRIPTS_SHELL $$SCRIPTS_PERL $$SCRIPTS_AWK; do \
-               test -f $(srcdir)/$${script}.in && { cp -p $(srcdir)/$${script}.in $(distdir)/ || exit 1; } \
-       done; \
-       true
-dist-hook: dist-scripts
-
-@WANT_INSTALLPERMS_TRUE@installperms-exec:
-@WANT_INSTALLPERMS_TRUE@       @installperms="$(INSTALLPERMS_exec)"; \
-@WANT_INSTALLPERMS_TRUE@       test -n "$$installperms" && echo "Setting installation permissions on executables"; \
-@WANT_INSTALLPERMS_TRUE@       dest=; chown=; chmod=; \
-@WANT_INSTALLPERMS_TRUE@       for cmd in $$installperms; do \
-@WANT_INSTALLPERMS_TRUE@           case "$$cmd" in \
-@WANT_INSTALLPERMS_TRUE@               chown=amanda) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
-@WANT_INSTALLPERMS_TRUE@               dest=*|chown=*|chmod=*) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; eval $$cmd;; \
-@WANT_INSTALLPERMS_TRUE@               *)  pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chown"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chown "$$chown" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chown "$$chown" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chmod"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chmod "$$chmod" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chmod "$$chmod" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@           esac; \
-@WANT_INSTALLPERMS_TRUE@       done
-
-@WANT_INSTALLPERMS_TRUE@installperms-data:
-@WANT_INSTALLPERMS_TRUE@       @installperms="$(INSTALLPERMS_data)"; \
-@WANT_INSTALLPERMS_TRUE@       test -n "$$installperms" && echo "Setting installation permissions on data"; \
-@WANT_INSTALLPERMS_TRUE@       dest=; chown=; chmod=; \
-@WANT_INSTALLPERMS_TRUE@       for cmd in $$installperms; do \
-@WANT_INSTALLPERMS_TRUE@           case "$$cmd" in \
-@WANT_INSTALLPERMS_TRUE@               chown=amanda) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
-@WANT_INSTALLPERMS_TRUE@               dest=*|chown=*|chmod=*) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; eval $$cmd;; \
-@WANT_INSTALLPERMS_TRUE@               *)  pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chown"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chown "$$chown" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chown "$$chown" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chmod"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chmod "$$chmod" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chmod "$$chmod" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@           esac; \
-@WANT_INSTALLPERMS_TRUE@       done
-
-@WANT_INSTALLPERMS_TRUE@install-exec-hook: installperms-exec
-@WANT_INSTALLPERMS_TRUE@install-data-hook: installperms-data
-
-# A rule to make precompiler output from C files.  This is not used during
-# ordinary builds, but but can very useful in debugging problems on strange
-# architectures.  With this rule, we can ask users to 'make foo.i' and send
-# the result to us.
-#
-# It touches some automake internals ($COMPILE), but since it's not
-# build-critical, that's OK.
-%.i : %.c
-       $(COMPILE) -E -o $@ $<
-# 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/dumper-src/amgtar.pl b/dumper-src/amgtar.pl
deleted file mode 100644 (file)
index 8fe9024..0000000
+++ /dev/null
@@ -1,326 +0,0 @@
-#!@PERL@ -T
-#
-
-# Run perl.
-eval '(exit $?0)' && eval 'exec @PERL@ -S $0 ${1+"$@"}'
-       & eval 'exec @PERL@ -S $0 $argv:q'
-               if 0;
-
-delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV', 'PATH'};
-$ENV{'PATH'} = "/usr/bin:/usr/sbin:/sbin:/bin";
-
-$debug=1;
-push(@INC, ".", "@DUMPER_DIR@");
-
-use File::Copy;
-use IPC::Open3;
-use Sys::Hostname;
-
-
-open(DEBUG,">>@AMANDA_DBGDIR@/amgtar.$$.debug") if ($debug==1);
-
-$prefix='@prefix@';
-$prefix = $prefix;
-$exec_prefix="@exec_prefix@";
-$exec_prefix=$exec_prefix;
-$amlibexecdir="@amlibexecdir@";
-$amlibexecdir=$amlibexecdir;
-
-$USE_VERSION_SUFFIXES='@USE_VERSION_SUFFIXES@';
-$suf = '';
-if ( $USE_VERSION_SUFFIXES =~ /^yes$/i ) {
-   $suf='-@VERSION@';
-}
-
-$myhost = hostname;
-$myhost =~ s/\..*$//;
-$runtar="${amlibexecdir}/runtar${suf}";
-$gnulist = '@GNUTAR_LISTED_INCREMENTAL_DIR@';
-$gnutar = '@GNUTAR@';
-
-
-
-$max_level    = 9;
-$index_line   = 1;
-$index_xml    = 0;
-$message_line = 1;
-$message_xml  = 0;
-$record       = 1;
-$include_file = 1;
-$include_list = 1;
-$exclude_file = 1;
-$exclude_list = 1;
-$collection   = 0;
-
-#$user_support  = "";
-#$group_support = "";
-
-#$user_selfcheck  = "";
-#$group_selfcheck = "";
-
-#$user_estimate  = "";
-#$group_estimate = "";
-
-#$user_estimate_parse  = "";
-#$group_estimate_parse = "";
-
-$user_backup  = "root";
-#$group_backup = "";
-
-#$user_backup_parse  = "";
-#$group_backup_parse = "";
-
-#$user_index_from_output  = "";
-#$group_index_from_output = "";
-
-#$user_index_from_image  = "";
-#$group_index_from_image = "";
-
-#$user_restore  = "";
-#$group_restore = "";
-
-#$user_print_command  = "";
-#$group_print_command = "";
-
-$user_default  = "amanda";
-$group_default = "amanda";
-
-
-sub command_support {
-   my($config, $host, $disk, $device, $level) = @_;
-   print "CONFIG YES\n";
-   print DEBUG "STDOUT: CONFIG YES\n" if ($debug == 1);
-   print "HOST YES\n";
-   print DEBUG "STDOUT: HOST YES\n" if ($debug == 1);
-   print "DISK YES\n";
-   print DEBUG "STDOUT: DISK YES\n" if ($debug == 1);
-   print "MAX-LEVEL 9\n";
-   print DEBUG "STDOUT: MAX-LEVEL 9\n" if ($debug == 1);
-   print "INDEX-LINE YES\n";
-   print DEBUG "STDOUT: INDEX-LINE YES\n" if ($debug == 1);
-   print "INDEX-XML NO\n";
-   print DEBUG "STDOUT: INDEX-XML NO\n" if ($debug == 1);
-   print "MESSAGE-LINE YES\n";
-   print DEBUG "STDOUT: MESSAGE-LINE YES\n" if ($debug == 1);
-   print "MESSAGE-XML NO\n";
-   print DEBUG "STDOUT: MESSAGE-XML NO\n" if ($debug == 1);
-   print "RECORD YES\n";
-   print DEBUG "STDOUT: RECORD YES\n" if ($debug == 1);
-   print "INCLUDE-FILE YES\n";
-   print "INCLUDE-LIST YES\n";
-   print "EXCLUDE-FILE YES\n";
-   print "EXCLUDE-LIST YES\n";
-   print "COLLECTION NO\n";
-}
-
-sub command_selfcheck {
-   my($config, $host, $disk, $device, $level) = @_;
-   print DEBUG "STDOUT: OK $disk\n" if ($debug == 1);
-   print DEBUG "STDOUT: OK $device\n" if ($debug == 1);
-   print "OK $disk\n";
-   print "OK $device\n";
-   #check binary
-   #check statefile
-   #check amdevice
-   #check property include/exclude
-}
-
-sub command_estimate {
-   my($config, $host, $disk, $device, $level) = @_;
-   my($listdir) = "$host$disk";
-   $listdir     =~ s/\//_/g;
-   if($level == 0) {
-      open(GNULIST, ">${gnulist}/${listdir}_${level}.new") || die();
-      close(GNULIST) || die();
-   }
-   else {
-      my($prev_level) = $level - 1;
-      if (-f "${gnulist}/${listdir}_${prev_level}") {
-        copy("${gnulist}/${listdir}_${prev_level}", "${gnulist}/${listdir}_${level}.new");
-      } else {
-        open(GNULIST, ">${gnulist}/${listdir}_${level}.new") || die();
-        close(GNULIST) || die();
-       #print "ERROR file ${gnulist}/${listdir}_${level}.new doesn't exist\n";
-      }
-   }
-   command_estimate_opt_direct($config, $host, $disk, $device, $level, $listdir);
-}
-
-
-sub command_estimate_opt_direct {
-   my($config, $host, $disk, $device, $level, $listdir) = @_;
-   my($size) = -1;
-   my(@cmd) = ($runtar, $config, $gnutar, "--create", "--directory", $device, "--listed-incremental", "${gnulist}/${listdir}_${level}.new", "--sparse", "--one-file-system", "--ignore-failed-read", "--totals", "--file", "/dev/null", ".");
-   #my(@cmd) = ($gnutar, "--create", "--directory", $device, "--listed-incremental", "${gnulist}/${listdir}_${level}.new", "--sparse", "--one-file-system", "--ignore-failed-read", "--totals", "--file", "/dev/null", ".");
-   print DEBUG "cmd:" , join(" ", @cmd), "\n" if ($debug == 1);
-   open3(\*WTRFH, '>&STDOUT', \*ESTIMATE, @cmd);
-
-   $size = parse_estimate(ESTIMATE);
-   close(ESTIMATE);
-   output_size($size);
-   unlink "${gnulist}/${listdir}_${level}.new";
-   exit 0;
-}
-
-sub parse_estimate {
-   my($fh) = @_;
-   my($size) = -1;
-   while(<$fh>) {
-print DEBUG "READ 2: $_" if ($debug == 1);
-      if ($_ =~ /^Total bytes written: (\d*)/) {
-         $size = $1;
-         last;
-      }
-   }
-   return $size;
-}
-
-sub output_size {
-   my($size) = @_;
-   if($size == -1) {
-      print DEBUG "STDOUT A: -1 -1\n" if ($debug == 1);
-      print "-1 -1\n";
-      exit 2;
-   }
-   else {
-      my($ksize) = int $size / (1024);
-      $ksize=32 if ($ksize<32);
-      print DEBUG "STDOUT B: $ksize 1\n" if ($debug == 1);
-      print "$ksize 1\n";
-   }
-}
-
-sub command_backup {
-   my($config, $host, $disk, $device, $level) = @_;
-   my($listdir) = "$host$disk";
-   my($verbose) = "";
-   $listdir     =~ s/\//_/g;
-
-print DEBUG "config =" . $config . "\n" if ($debug == 1);
-print DEBUG "host   =" . $host   . "\n" if ($debug == 1);
-print DEBUG "disk   =" . $disk   . "\n" if ($debug == 1);
-print DEBUG "device =" . $device . "\n" if ($debug == 1);
-print DEBUG "level  =" . $level  . "\n" if ($debug == 1);
-
-   if($level == 0) {
-      open(GNULIST, ">${gnulist}/${listdir}_${level}.new") || die();
-      close(GNULIST) || die();
-   }
-   else {
-      my($prev_level) = $level - 1;
-      copy("${gnulist}/${listdir}_${prev_level}", 
-           "${gnulist}/${listdir}_${level}.new");
-   }
-
-   if(defined($opt_index)) {
-      $verbose = "--verbose";
-   }
-   my(@cmd) = ($runtar, $config, $gnutar, "--create", $verbose, "--directory", $device, "--listed-incremental", "${gnulist}/${listdir}_${level}.new", "--sparse", "--one-file-system", "--ignore-failed-read", "--totals", "--file", "-", ".");
-   #my(@cmd) = ($gnutar, "--create", $verbose, "--directory", $device, "--listed-incremental", "${gnulist}/${listdir}_${level}.new", "--sparse", "--one-file-system", "--ignore-failed-read", "--totals", "--file", "-", ".");
-
-   print DEBUG "cmd:" , join(" ", @cmd), "\n" if ($debug == 1);
-
-   open3(\*WTRFH, '>&STDOUT', \*INDEX, @cmd) || die();
-
-   if(defined($opt_index)) {
-      open(INDEXOUT, '>&=3') || die();
-      parse_backup(INDEX, STDERR, INDEXOUT);
-      close(INDEXOUT);
-   }
-   else {
-      parse_backup(INDEX, STDERR, undef);
-   }
-   close(INDEX);
-   close(WTRFH);
-
-   if(defined($opt_record)) {
-      rename "${gnulist}/${listdir}_${level}.new", 
-             "${gnulist}/${listdir}_${level}";
-   }
-   else {
-      unlink "${gnulist}/${listdir}_${level}.new";
-   }
-   exit 0;
-}
-
-sub parse_backup {
-   my($fhin, $fhout, $indexout) = @_;
-   my($size) = -1;
-   while(<$fhin>) {
-print DEBUG "READ 3: $_" if ($debug == 1);
-      if ( /^\.\//) {
-         if(defined($indexout)) {
-           if(defined($opt_index)) {
-               s/^\.//;
-print DEBUG "INDEXOUT: $_" if ($debug == 1);
-               print $indexout $_;
-           }
-         }
-      }
-      else {
-            if (/^Total bytes written: (\d*)/) {
-               $size = $1;
-              $ksize = int ($size / 1024);
-            }
-            elsif(defined($fhout)) {
-               next if /: Directory is new$/;
-print DEBUG "FHOUT 2: $_" if ($debug == 1);
-               print $fhout $_;
-            }
-      }
-   }
-   if(defined($fhout)) {
-      if ($size == -1) {
-print DEBUG "FHOUT 4: $command -1 -1\n" if ($debug == 1);
-         print $fhout "$command -1 -1\n";
-      }
-      else {
-         my($ksize) = int ($size/1024);
-print DEBUG "FHOUT 5: sendbackup: size $ksize\n" if ($debug == 1);
-         print $fhout "sendbackup: size $ksize\n";
-print DEBUG "FHOUT 5: sendbackup: end\n" if ($debug == 1);
-              print $fhout "sendbackup: end\n";
-      }
-   }
-}
-
-sub command_index_from_output {
-   index_from_output(STDIN, STDOUT);
-   exit 0;
-}
-
-sub index_from_output {
-   my($fhin, $fhout) = @_;
-   my($size) = -1;
-   while(<$fhin>) {
-print DEBUG "READ 4: $_" if ($debug == 1);
-      next if /^Total bytes written:/;
-      next if !/^\.\//;
-      s/^\.//;
-print DEBUG "FHOUT 6: $_" if ($debug == 1);
-      print $fhout $_;
-   }
-}
-
-sub command_index_from_image {
-   my($config, $host, $disk, $device, $level) = @_;
-   open(INDEX, "$gnutar --list --file - |") || die();
-   index_from_output(INDEX, STDOUT);
-}
-
-sub command_restore {
-   my($config, $host, $disk, $device, $level) = @_;
-
-#   $ARGV[0] = undef;   
-   my(@cmd) = ($gnutar, "--numeric-owner", "-xpGvf", "-");
-   for($i=1;defined $ARGV[$i]; $i++) {
-      push @cmd, $ARGV[$i];
-   }
-   print DEBUG "cmd:" , join(" ", @cmd), "\n" if ($debug == 1);
-   exec @cmd;
-}
-
-sub command_print_command {
-}
-
-require "generic-dumper"
diff --git a/dumper-src/generic-dumper.pl b/dumper-src/generic-dumper.pl
deleted file mode 100644 (file)
index f1fc6d3..0000000
+++ /dev/null
@@ -1,273 +0,0 @@
-require "newgetopt.pl";
-use Text::ParseWords;
-
-print DEBUG "FHOUT 6: ARGV[0]=" . $ARGV[0] . "\n" if ($debug == 1);
-print DEBUG "FHOUT 6: ARGV[1]=" . $ARGV[1] . "\n" if ($debug == 1);
-print DEBUG "FHOUT 6: ARGV[2]=" . $ARGV[2] . "\n" if ($debug == 1);
-print DEBUG "FHOUT 6: ARGV[3]=" . $ARGV[3] . "\n" if ($debug == 1);
-print DEBUG "FHOUT 6: ARGV[4]=" . $ARGV[4] . "\n" if ($debug == 1);
-print DEBUG "FHOUT 6: ARGV[5]=" . $ARGV[5] . "\n" if ($debug == 1);
-print DEBUG "FHOUT 6: ARGV[6]=" . $ARGV[6] . "\n" if ($debug == 1);
-print DEBUG "FHOUT 6: ARGV[7]=" . $ARGV[7] . "\n" if ($debug == 1);
-print DEBUG "FHOUT 6: ARGV[8]=" . $ARGV[8] . "\n" if ($debug == 1);
-print DEBUG "FHOUT 6: ARGV[9]=" . $ARGV[9] . "\n" if ($debug == 1);
-
-$result = &NGetOpt ("config=s", "host=s", "disk=s", "device=s", "level=s", "index=s", "message=s", "collection", "record");
-$result = $result;
-
-print DEBUG "FHOUT 6: config    =" . $opt_config . "\n" if ($debug == 1);
-print DEBUG "FHOUT 6: disk      =" . $opt_disk   . "\n" if ($debug == 1);
-print DEBUG "FHOUT 6: host      =" . $opt_host   . "\n" if ($debug == 1);
-print DEBUG "FHOUT 6: device    =" . $opt_device . "\n" if ($debug == 1);
-print DEBUG "FHOUT 6: level     =" . $opt_level  . "\n" if ($debug == 1);
-print DEBUG "FHOUT 6: index     =" . $opt_index  . "\n" if ($debug == 1);
-print DEBUG "FHOUT 6: message   =" . $opt_message. "\n" if ($debug == 1);
-print DEBUG "FHOUT 6: collection=" . $opt_collection. "\n" if ($debug == 1);
-print DEBUG "FHOUT 6: record    =" . $opt_record . "\n" if ($debug == 1);
-
-print DEBUG "FHOUT 6: A-ARGV[0]=" . $ARGV[0] . "\n" if ($debug == 1);
-print DEBUG "FHOUT 6: A-ARGV[1]=" . $ARGV[1] . "\n" if ($debug == 1);
-print DEBUG "FHOUT 6: A-ARGV[2]=" . $ARGV[2] . "\n" if ($debug == 1);
-print DEBUG "FHOUT 6: A-ARGV[3]=" . $ARGV[3] . "\n" if ($debug == 1);
-print DEBUG "FHOUT 6: A-ARGV[4]=" . $ARGV[4] . "\n" if ($debug == 1);
-print DEBUG "FHOUT 6: A-ARGV[5]=" . $ARGV[5] . "\n" if ($debug == 1);
-print DEBUG "FHOUT 6: A-ARGV[6]=" . $ARGV[6] . "\n" if ($debug == 1);
-
-if (defined $opt_config) {
-  $opt_config =~ /^([\_\.A-Za-z0-9]*)$/;
-  $opt_config = $1;
-}
-
-if (defined $opt_host) {
-  $opt_host =~ /^([\_\.A-Za-z0-9]*)$/;
-  $opt_host = $1;
-}
-
-if (defined $opt_disk) {
-  $opt_disk =~ /^([\/\_\:\.A-Za-z0-9]*)$/;
-  $opt_disk = $1;
-}
-
-if (defined $opt_device) {
-  $opt_device =~ /^([\/\_\:\.A-Za-z0-9]*)$/;
-  $opt_device = $1;
-}
-
-if (defined $opt_level) {
-  $opt_level =~ /^(\d)$/;
-  $opt_level = $1;
-}
-
-# Read tool property
-
-$command = $ARGV[0];
-
-%property = ();
-while($property_line = <STDIN>) {
-  chomp $property_line;
-  ($prop_name, $prop_value) = shellwords($property_line);
-  push @{$property{$prop_name}}, $prop_value;
-  print DEBUG "$prop_name = $prop_value\n" if ($debug == 1);
-}
-
-if ($debug == 1) {
-  foreach $prop_name (keys(%property)) {
-    print DEBUG "PROPERTY: $prop_name\n";
-    print DEBUG "    VALUE: ", join(',',@{$property{$prop_name}}) , "\n";
-  }
-}
-
-sub wrapper_support();
-sub wrapper_selfcheck();
-sub wrapper_estimate();
-sub wrapper_backup();
-sub wrapper_restore();
-
-if ($command eq "support") {
-   wrapper_support();
-}
-elsif ($command eq "selfcheck") {
-   wrapper_selfcheck();
-}
-elsif ($command eq "estimate") {
-   wrapper_estimate();
-}
-elsif ($command eq "backup") {
-   wrapper_backup();
-}
-elsif ($command eq "restore") {
-   wrapper_restore();
-}
-else {
-   printf STDERR "Unknown command `$command'.\n";
-   exit 1;
-}
-
-
-sub wrapper_support() {
-   if(defined(&command_support)) {
-      command_support($opt_config, $opt_host, $opt_disk, $opt_device, $opt_level);
-      exit 0;
-   }
-   print "LEVEL 0-", $max_level , "\n" if defined($max_level);
-   print "INDEX-LINE YES\n"   if defined($index_line)   && $index_line   == 1;
-   print "INDEX-XML NO\n"     if defined($index_xml)    && $index_xml    == 1;
-   print "MESSAGE-LINE YES\n" if defined($message_line) && $message_line == 1;
-   print "MESSAGE-XML NO\n"   if defined($message_xml)  && $message_xml  == 1;
-   print "RECORD YES\n"       if defined($record)       && $record       == 1;
-   print "INCLUDE-FILE NO\n"  if defined($include_file) && $include_file == 1;
-   print "INCLUDE-LIST NO\n"  if defined($include_list) && $include_list == 1;
-   print "EXCLUDE-FILE NO\n"  if defined($exclude_file) && $exclude_file == 1;
-   print "EXCLUDE-LIST NO\n"  if defined($exclude_list) && $exclude_list == 1;
-   print "COLLECTION NO\n"    if defined($collection)   && $collection   == 1;
-   exit 1;
-}
-
-sub wrapper_selfcheck() {
-   if(defined(&command_selfcheck)) {
-      command_selfcheck($opt_config, $opt_host, $opt_disk, $opt_device, $opt_level);
-   }
-   else {
-      exit 1;
-   }
-}
-
-sub wrapper_estimate() {
-   if(defined(&command_estimate)) {
-      command_estimate($opt_config, $opt_host, $opt_disk, $opt_device, $opt_level);
-   } else {
-      exit 1;
-   }
-}
-
-sub wrapper_estimate_parse() {
-   if(defined(&command_estimate_parse)) {
-      command_estimate_parse($opt_config, $opt_host, $opt_disk, $opt_device, $opt_level);
-   }
-   else {
-      printf STDERR "`estimate-parse' is not supported.\n";
-      exit 1;
-   }
-}
-
-sub wrapper_backup() {
-   if(defined(&command_backup)) {
-      command_backup($opt_config, $opt_host, $opt_disk, $opt_device, $opt_level);
-   } else {
-print DEBUG "wrapper_backup: !defined(command_backup)\n" if ($debug == 1);
-      exit 1;
-   }
-}
-
-sub wrapper_backup_parse() {
-   if(defined(&command_backup_parse)) {
-      command_backup_parse($opt_config, $opt_host, $opt_disk, $opt_device, $opt_level);
-   }
-   else {
-      printf STDERR "`backup-parse' is not supported.\n";
-      exit 1;
-   }
-}
-
-sub wrapper_index_from_output() {
-   if(defined(&command_index_from_output)) {
-      command_index_from_output($opt_config, $opt_host, $opt_disk, $opt_device, $opt_level);
-   }
-   else {
-      printf STDERR "`index-from-output' is not supported.\n";
-      exit 1;
-   }
-}
-
-sub wrapper_index_from_image() {
-   if(defined(&command_index_from_image)) {
-      command_index_from_image($opt_config, $opt_host, $opt_disk, $opt_device, $opt_level);
-   }
-   else {
-      printf STDERR "command `index-from-image' is not supported.\n";
-      exit 1;
-   }
-}
-
-sub wrapper_restore() {
-   if(defined(&command_restore)) {
-      command_restore($opt_config, $opt_host, $opt_disk, $opt_device, $opt_level);
-   }
-   else {
-     printf STDERR "`restore' is not supported.\n";
-     exit 1;
-   }
-}
-
-sub parse_options() {
-   my($no_option) = @_;
-   my($options, @options, $option, $name, $option_name, $value);
-
-   while($no_option <= $#ARGV) {
-      $options = $ARGV[${no_option}];
-      @options = split (/;/,$options);
-      foreach $option (@options) {
-         if( $option =~ /=/ ) {
-            ($name,$value) = split(/=/,$option);
-         }
-         else {
-            $name  = $option;
-            $value = 1;
-         }
-         $option_name = "option_$name";
-         $option_name =~ s/\-/\_/g;
-        $$option_name = $value;
-      }
-      $no_option++;
-   }
-}
-
-sub check_file {
-   my($filename, $mode) = @_;
-
-   stat($filename);
-
-   if($mode eq "e") {
-      if( -e _ ) {
-         print "OK $filename exists\n";
-      }
-      else {
-         print "ERROR [can not find $filename]\n";
-      }
-   }
-   elsif($mode eq "x") {
-      if( -x _ ) {
-         print "OK $filename executable\n";
-      }
-      else {
-         print "ERROR [can not execute $filename]\n";
-      }
-   }
-   elsif($mode eq "r") {
-      if( -r _ ) {
-         print "OK $filename readable\n";
-      }
-      else {
-         print "ERROR [can not read $filename]\n";
-      }
-   }
-   elsif($mode eq "w") {
-      if( -w _ ) {
-         print "OK $filename writable\n";
-      }
-      else {
-         print "ERROR [can not write $filename]\n";
-      }
-   }
-   else {
-      print "ERROR [check_file: unknow mode $mode]\n";
-   }
-}
-
-sub check_dir {
-}
-
-sub check_suid {
-}
-
-1;
index 824aead04655caa0ad704e9ab8383fcdd563761e..6e51c9a312ad29ad480db961adaf9747ba0be03f 100644 (file)
@@ -1,13 +1,14 @@
 # Makefile for sample configuration files
 
+include $(top_srcdir)/config/automake/vars.am
 include $(top_srcdir)/config/automake/installperms.am
 
-amanda_dir     = $(localstatedir)/lib/amanda
+amanda_dir    = $(amdatadir)
 templatedir   = $(amanda_dir)/template.d
 exampledir    = $(amanda_dir)/example
 lbltempldir   = $(amanda_dir)/example/label-templates
 
-EXTRA_DIST   chg-multi.conf \
+EXTRA_DIST +=  chg-multi.conf \
                chg-scsi.conf \
                config.site \
                disklist \
@@ -26,6 +27,7 @@ dist_template_DATA = template.d/advanced.conf \
 dist_example_DATA = amanda.conf \
               amanda-client.conf \
               inetd.conf.amandaclient \
+              inetd.conf.amandaserver \
               xinetd.amandaclient \
               xinetd.amandaserver 
 
index f866f46cfd35cedb938b7dc2c9e0c98a3ac5f576..57f13b105f290432afe13da5f7fb5fd5ea7b42b7 100644 (file)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  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.
 
 # Makefile for sample configuration files
 
+# vim:ft=automake
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+# 
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License version 2.1 as 
+# published by the Free Software Foundation.
+# 
+# This 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 this library; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+# 
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+# simple include file to pre-define variables which are then +='d by other
+# scripts in this directory.
+
 # vim:ft=automake
 #
 # Adjust post-install permissions settings.  This rule works off two
@@ -43,7 +65,7 @@
 # INSTALLPERMS_exec = \
 #      dest=$(sbindir) chown=amanda chmod= \
 #              foo bar \
-#      chmod=u+s,o-rwx \
+#      chmod=07450 \
 #              bing
 #      dest=$(libexecdir) chmod= \
 #              $(libexec_PROGRAMS)
 #
 # This whole operation is not required when making builds for packaging,
 # and can be disabled with --disable-installperms, via the WANT_INSTALLPERMS
-# AM_CONDITIONAL.
+# AM_CONDITIONAL.  When disabled, the file 'installperms.sh' in the top-level
+# build directory is populated with a format suitable for shell interpretation,
+# with lines like this:
+#   installperm "amanda:disk" "04750" "/usr/local/sbin/bing"
+# the arguments being, respectively, owner:group, mode, and filename.  There will
+# be exactly one line for each file which has specific permissions.  The intention
+# is that this file be used by packaging scripts to set correct permissions at install
+# time.  Note that files which have no special permissions requirements do not appear 
+# in this file at all, due to limitations of Automake.
 
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
@@ -78,11 +108,18 @@ DIST_COMMON = $(dist_example_DATA) $(dist_lbltempl_DATA) \
        $(dist_template_DATA) $(srcdir)/Makefile.am \
        $(srcdir)/Makefile.in $(srcdir)/amanda-client.conf.in \
        $(srcdir)/amanda.conf.in $(srcdir)/chg-mcutil.conf.in \
-       $(top_srcdir)/config/automake/installperms.am
+       $(srcdir)/inetd.conf.amandaclient.in \
+       $(srcdir)/inetd.conf.amandaserver.in \
+       $(srcdir)/xinetd.amandaclient.in \
+       $(srcdir)/xinetd.amandaserver.in \
+       $(top_srcdir)/config/automake/installperms.am \
+       $(top_srcdir)/config/automake/vars.am
+@WANT_INSTALLPERMS_FALSE@am__append_1 = $(installperms_sh)
 subdir = example
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps =  \
        $(top_srcdir)/config/macro-archive/ac_define_dir.m4 \
+       $(top_srcdir)/config/macro-archive/ac_perl_module_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_perl_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_swig.m4 \
        $(top_srcdir)/config/macro-archive/ax_compare_version.m4 \
@@ -116,6 +153,7 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/amanda/libs.m4 \
        $(top_srcdir)/config/amanda/net.m4 \
        $(top_srcdir)/config/amanda/progs.m4 \
+       $(top_srcdir)/config/amanda/ps.m4 \
        $(top_srcdir)/config/amanda/readdir.m4 \
        $(top_srcdir)/config/amanda/readline.m4 \
        $(top_srcdir)/config/amanda/rsh-security.m4 \
@@ -138,7 +176,9 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/float_h.m4 \
        $(top_srcdir)/config/gnulib/fsusage.m4 \
        $(top_srcdir)/config/gnulib/getaddrinfo.m4 \
+       $(top_srcdir)/config/gnulib/getopt.m4 \
        $(top_srcdir)/config/gnulib/gettimeofday.m4 \
+       $(top_srcdir)/config/gnulib/gnulib-common.m4 \
        $(top_srcdir)/config/gnulib/gnulib-comp.m4 \
        $(top_srcdir)/config/gnulib/include_next.m4 \
        $(top_srcdir)/config/gnulib/inet_ntop.m4 \
@@ -166,7 +206,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/sys_stat_h.m4 \
        $(top_srcdir)/config/gnulib/sys_time_h.m4 \
        $(top_srcdir)/config/gnulib/tempname.m4 \
-       $(top_srcdir)/config/gnulib/ulonglong.m4 \
        $(top_srcdir)/config/gnulib/unistd_h.m4 \
        $(top_srcdir)/config/gnulib/vasnprintf.m4 \
        $(top_srcdir)/config/gnulib/visibility.m4 \
@@ -177,7 +216,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gettext-macros/lib-ld.m4 \
        $(top_srcdir)/config/gettext-macros/lib-link.m4 \
        $(top_srcdir)/config/gettext-macros/lib-prefix.m4 \
-       $(top_srcdir)/config/gettext-macros/longlong.m4 \
        $(top_srcdir)/config/gettext-macros/nls.m4 \
        $(top_srcdir)/config/gettext-macros/po.m4 \
        $(top_srcdir)/config/gettext-macros/progtest.m4 \
@@ -191,7 +229,10 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
        $(ACLOCAL_M4)
 mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/config/config.h
-CONFIG_CLEAN_FILES = amanda-client.conf amanda.conf chg-mcutil.conf
+CONFIG_CLEAN_FILES = amanda-client.conf amanda.conf \
+       xinetd.amandaclient xinetd.amandaserver \
+       inetd.conf.amandaclient inetd.conf.amandaserver \
+       chg-mcutil.conf
 SOURCES =
 DIST_SOURCES =
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
@@ -209,6 +250,7 @@ DATA = $(dist_example_DATA) $(dist_lbltempl_DATA) \
        $(dist_template_DATA)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
+AIX_BACKUP = @AIX_BACKUP@
 ALLOCA = @ALLOCA@
 ALLOCA_H = @ALLOCA_H@
 AMANDA_DBGDIR = @AMANDA_DBGDIR@
@@ -223,8 +265,10 @@ AMPLOT_CAT_GZIP = @AMPLOT_CAT_GZIP@
 AMPLOT_CAT_PACK = @AMPLOT_CAT_PACK@
 AMPLOT_COMPRESS = @AMPLOT_COMPRESS@
 AMTAR = @AMTAR@
+APPLICATION_DIR = @APPLICATION_DIR@
 AR = @AR@
 ARPA_INET_H = @ARPA_INET_H@
+ASSERTIONS = @ASSERTIONS@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -236,16 +280,28 @@ BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@
 BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@
 BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@
 BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@
+BSDTCP_SECURITY = @BSDTCP_SECURITY@
+BSDUDP_SECURITY = @BSDUDP_SECURITY@
+BSD_SECURITY = @BSD_SECURITY@
 CAT = @CAT@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
+CHECK_USERID = @CHECK_USERID@
 CHIO = @CHIO@
 CHS = @CHS@
+CLIENT_HOST_INSTANCE = @CLIENT_HOST_INSTANCE@
+CLIENT_HOST_KEY_FILE = @CLIENT_HOST_KEY_FILE@
+CLIENT_HOST_PRINCIPAL = @CLIENT_HOST_PRINCIPAL@
 CLIENT_LOGIN = @CLIENT_LOGIN@
 CLIENT_SCRIPTS_OPT = @CLIENT_SCRIPTS_OPT@
 COMPRESS = @COMPRESS@
+COMPRESS_BEST_OPT = @COMPRESS_BEST_OPT@
+COMPRESS_FAST_OPT = @COMPRESS_FAST_OPT@
+COMPRESS_PATH = @COMPRESS_PATH@
+COMPRESS_SUFFIX = @COMPRESS_SUFFIX@
+CONFIG_CLOBBER_MY_CONFIG = @CONFIG_CLOBBER_MY_CONFIG@
 CONFIG_DIR = @CONFIG_DIR@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
@@ -259,6 +315,7 @@ DD = @DD@
 DEFAULT_AMANDATES_FILE = @DEFAULT_AMANDATES_FILE@
 DEFAULT_CHANGER_DEVICE = @DEFAULT_CHANGER_DEVICE@
 DEFAULT_CONFIG = @DEFAULT_CONFIG@
+DEFAULT_MAILER = @DEFAULT_MAILER@
 DEFAULT_SERVER = @DEFAULT_SERVER@
 DEFAULT_TAPE_DEVICE = @DEFAULT_TAPE_DEVICE@
 DEFAULT_TAPE_SERVER = @DEFAULT_TAPE_SERVER@
@@ -266,7 +323,7 @@ DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DOC_BUILD_DATE = @DOC_BUILD_DATE@
 DUMP = @DUMP@
-DUMPER_DIR = @DUMPER_DIR@
+DUMP_RETURNS_1 = @DUMP_RETURNS_1@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -279,6 +336,7 @@ F77 = @F77@
 FFLAGS = @FFLAGS@
 FLOAT_H = @FLOAT_H@
 GETCONF = @GETCONF@
+GETOPT_H = @GETOPT_H@
 GETTEXT = @GETTEXT@
 GLIB_CFLAGS = @GLIB_CFLAGS@
 GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
@@ -289,9 +347,12 @@ GMSGFMT_015 = @GMSGFMT_015@
 GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
 GNULIB_CHOWN = @GNULIB_CHOWN@
 GNULIB_DUP2 = @GNULIB_DUP2@
+GNULIB_ENVIRON = @GNULIB_ENVIRON@
 GNULIB_FCHDIR = @GNULIB_FCHDIR@
 GNULIB_FFLUSH = @GNULIB_FFLUSH@
+GNULIB_FOPEN = @GNULIB_FOPEN@
 GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
+GNULIB_FREOPEN = @GNULIB_FREOPEN@
 GNULIB_FSEEK = @GNULIB_FSEEK@
 GNULIB_FSEEKO = @GNULIB_FSEEKO@
 GNULIB_FTELL = @GNULIB_FTELL@
@@ -301,6 +362,7 @@ GNULIB_GETCWD = @GNULIB_GETCWD@
 GNULIB_GETDELIM = @GNULIB_GETDELIM@
 GNULIB_GETLINE = @GNULIB_GETLINE@
 GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
+GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@
 GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
 GNULIB_LCHOWN = @GNULIB_LCHOWN@
 GNULIB_LSEEK = @GNULIB_LSEEK@
@@ -325,8 +387,10 @@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
 GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
 GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
 GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
+GNULIB_PUTENV = @GNULIB_PUTENV@
 GNULIB_READLINK = @GNULIB_READLINK@
 GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@
+GNULIB_SETENV = @GNULIB_SETENV@
 GNULIB_SLEEP = @GNULIB_SLEEP@
 GNULIB_SNPRINTF = @GNULIB_SNPRINTF@
 GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@
@@ -335,11 +399,15 @@ GNULIB_STPNCPY = @GNULIB_STPNCPY@
 GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
 GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
 GNULIB_STRDUP = @GNULIB_STRDUP@
+GNULIB_STRERROR = @GNULIB_STRERROR@
 GNULIB_STRNDUP = @GNULIB_STRNDUP@
 GNULIB_STRNLEN = @GNULIB_STRNLEN@
 GNULIB_STRPBRK = @GNULIB_STRPBRK@
 GNULIB_STRSEP = @GNULIB_STRSEP@
+GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@
+GNULIB_STRSTR = @GNULIB_STRSTR@
 GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
+GNULIB_UNSETENV = @GNULIB_UNSETENV@
 GNULIB_VASPRINTF = @GNULIB_VASPRINTF@
 GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@
 GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
@@ -353,6 +421,7 @@ GOBJECT_QUERY = @GOBJECT_QUERY@
 GREP = @GREP@
 GZIP = @GZIP@
 HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@
+HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@
 HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@
 HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@
 HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
@@ -361,9 +430,10 @@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
 HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@
 HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
 HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
-HAVE_DECL_STRNCASECMP = @HAVE_DECL_STRNCASECMP@
+HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@
 HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
 HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
+HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@
 HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
 HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
 HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
@@ -371,7 +441,9 @@ HAVE_DUP2 = @HAVE_DUP2@
 HAVE_FSEEKO = @HAVE_FSEEKO@
 HAVE_FTELLO = @HAVE_FTELLO@
 HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
+HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
 HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
+HAVE_GZIP = @HAVE_GZIP@
 HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
 HAVE_IO_H = @HAVE_IO_H@
 HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
@@ -380,8 +452,10 @@ HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@
 HAVE_MEMPCPY = @HAVE_MEMPCPY@
 HAVE_MKDTEMP = @HAVE_MKDTEMP@
 HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@
+HAVE_OS_H = @HAVE_OS_H@
 HAVE_READLINK = @HAVE_READLINK@
 HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@
+HAVE_SETENV = @HAVE_SETENV@
 HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
 HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
 HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
@@ -389,7 +463,6 @@ HAVE_SLEEP = @HAVE_SLEEP@
 HAVE_STDINT_H = @HAVE_STDINT_H@
 HAVE_STPCPY = @HAVE_STPCPY@
 HAVE_STPNCPY = @HAVE_STPNCPY@
-HAVE_STRCASECMP = @HAVE_STRCASECMP@
 HAVE_STRCASESTR = @HAVE_STRCASESTR@
 HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
 HAVE_STRNDUP = @HAVE_STRNDUP@
@@ -398,10 +471,12 @@ HAVE_STRSEP = @HAVE_STRSEP@
 HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@
 HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
 HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
+HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
 HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
 HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
 HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
 HAVE_UNISTD_H = @HAVE_UNISTD_H@
+HAVE_UNSETENV = @HAVE_UNSETENV@
 HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
 HAVE_VASPRINTF = @HAVE_VASPRINTF@
 HAVE_VISIBILITY = @HAVE_VISIBILITY@
@@ -417,6 +492,8 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 INTLLIBS = @INTLLIBS@
 INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+KRB4_SECURITY = @KRB4_SECURITY@
+KRB5_SECURITY = @KRB5_SECURITY@
 LDFLAGS = @LDFLAGS@
 LEX = @LEX@
 LEXLIB = @LEXLIB@
@@ -433,6 +510,8 @@ LIBTHREAD = @LIBTHREAD@
 LIBTOOL = @LIBTOOL@
 LIBTOOL_DEPS = @LIBTOOL_DEPS@
 LN_S = @LN_S@
+LOCKING = @LOCKING@
+LOW_TCPPORTRANGE = @LOW_TCPPORTRANGE@
 LTLIBICONV = @LTLIBICONV@
 LTLIBINTL = @LTLIBINTL@
 LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
@@ -441,7 +520,6 @@ LTLIBPTH = @LTLIBPTH@
 LTLIBTHREAD = @LTLIBTHREAD@
 MAILER = @MAILER@
 MAKEINFO = @MAKEINFO@
-MAXTAPEBLOCKSIZE = @MAXTAPEBLOCKSIZE@
 MCUTIL = @MCUTIL@
 MKDIR_P = @MKDIR_P@
 MSGFMT = @MSGFMT@
@@ -477,26 +555,37 @@ PERL_INC = @PERL_INC@
 PKG_CONFIG = @PKG_CONFIG@
 POSUB = @POSUB@
 PRINT = @PRINT@
+PS = @PS@
+PS_ARGUMENT = @PS_ARGUMENT@
 PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
 RANLIB = @RANLIB@
 READLINE_LIBS = @READLINE_LIBS@
 REPLACE_CHOWN = @REPLACE_CHOWN@
 REPLACE_FCHDIR = @REPLACE_FCHDIR@
 REPLACE_FFLUSH = @REPLACE_FFLUSH@
+REPLACE_FOPEN = @REPLACE_FOPEN@
 REPLACE_FPRINTF = @REPLACE_FPRINTF@
+REPLACE_FREOPEN = @REPLACE_FREOPEN@
 REPLACE_FSEEK = @REPLACE_FSEEK@
 REPLACE_FSEEKO = @REPLACE_FSEEKO@
 REPLACE_FTELL = @REPLACE_FTELL@
 REPLACE_FTELLO = @REPLACE_FTELLO@
 REPLACE_GETCWD = @REPLACE_GETCWD@
 REPLACE_GETLINE = @REPLACE_GETLINE@
+REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
 REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
 REPLACE_LCHOWN = @REPLACE_LCHOWN@
 REPLACE_LSEEK = @REPLACE_LSEEK@
+REPLACE_MEMMEM = @REPLACE_MEMMEM@
 REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
 REPLACE_PRINTF = @REPLACE_PRINTF@
+REPLACE_PUTENV = @REPLACE_PUTENV@
 REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
 REPLACE_SPRINTF = @REPLACE_SPRINTF@
+REPLACE_STRCASESTR = @REPLACE_STRCASESTR@
+REPLACE_STRERROR = @REPLACE_STRERROR@
+REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@
+REPLACE_STRSTR = @REPLACE_STRSTR@
 REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
 REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
 REPLACE_VPRINTF = @REPLACE_VPRINTF@
@@ -504,7 +593,11 @@ REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
 REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
 REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
 RESTORE = @RESTORE@
+RSH_SECURITY = @RSH_SECURITY@
 SAMBA_CLIENT = @SAMBA_CLIENT@
+SERVER_HOST_INSTANCE = @SERVER_HOST_INSTANCE@
+SERVER_HOST_KEY_FILE = @SERVER_HOST_KEY_FILE@
+SERVER_HOST_PRINCIPAL = @SERVER_HOST_PRINCIPAL@
 SERVICE_SUFFIX = @SERVICE_SUFFIX@
 SETUID_GROUP = @SETUID_GROUP@
 SET_MAKE = @SET_MAKE@
@@ -514,6 +607,7 @@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
 SNAPSHOT_STAMP = @SNAPSHOT_STAMP@
 SORT = @SORT@
 SSH = @SSH@
+SSH_SECURITY = @SSH_SECURITY@
 STDBOOL_H = @STDBOOL_H@
 STDINT_H = @STDINT_H@
 STRIP = @STRIP@
@@ -523,7 +617,14 @@ SWIG_LIB = @SWIG_LIB@
 SYS_SOCKET_H = @SYS_SOCKET_H@
 SYS_STAT_H = @SYS_STAT_H@
 SYS_TIME_H = @SYS_TIME_H@
+TCPPORTRANGE = @TCPPORTRANGE@
+TICKET_LIFETIME = @TICKET_LIFETIME@
+UDPPORTRANGE = @UDPPORTRANGE@
+UNCOMPRESS_OPT = @UNCOMPRESS_OPT@
+UNCOMPRESS_PATH = @UNCOMPRESS_PATH@
+USE_AMANDAHOSTS = @USE_AMANDAHOSTS@
 USE_NLS = @USE_NLS@
+USE_RUNDUMP = @USE_RUNDUMP@
 USE_VERSION_SUFFIXES = @USE_VERSION_SUFFIXES@
 VDUMP = @VDUMP@
 VERSION = @VERSION@
@@ -532,6 +633,7 @@ VERSION_MAJOR = @VERSION_MAJOR@
 VERSION_MINOR = @VERSION_MINOR@
 VERSION_PATCH = @VERSION_PATCH@
 VERSION_SUFFIX = @VERSION_SUFFIX@
+VOID_UNSETENV = @VOID_UNSETENV@
 VRESTORE = @VRESTORE@
 VXDUMP = @VXDUMP@
 VXRESTORE = @VXRESTORE@
@@ -560,6 +662,7 @@ am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+amdatadir = @amdatadir@
 amincludedir = @amincludedir@
 amlibdir = @amlibdir@
 amlibexecdir = @amlibexecdir@
@@ -578,6 +681,8 @@ dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 gl_LIBOBJS = @gl_LIBOBJS@
 gl_LTLIBOBJS = @gl_LTLIBOBJS@
+gltests_LIBOBJS = @gltests_LIBOBJS@
+gltests_LTLIBOBJS = @gltests_LTLIBOBJS@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
@@ -607,22 +712,44 @@ target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
+SUFFIXES = 
+EXTRA_DIST = chg-multi.conf chg-scsi.conf config.site disklist \
+       chg-mcutil.conf
+BUILT_SOURCES = 
+MOSTLYCLEANFILES = 
+CLEANFILES = 
+DISTCLEANFILES = $(am__append_1)
+MAINTAINERCLEANFILES = 
 
 # sed expression to strip leading directories from a filename; this converts e.g.,
 # src/foo/bar.so to bar.so.
 strip_leading_dirs = s|^.*/||
-amanda_dir = $(localstatedir)/lib/amanda
+@WANT_INSTALLPERMS_FALSE@do_file = pa="$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
+@WANT_INSTALLPERMS_FALSE@    echo "installperm \"$$chown\" \"$$chmod\" \"$$pa\"" >> "$(installperms_sh)"
+
+
+# define a snippet of the scripts below to either perform a chown/chmod operation,
+# or record that operation in the logfile.  On entry to the snippet, $$dest is the
+# destination directory, $$cmd is the srcdir-relative pathname of the target file,
+# $$chown is the ownership, and $$chmod is the permission pattern.
+@WANT_INSTALLPERMS_TRUE@do_file = pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
+@WANT_INSTALLPERMS_TRUE@    if test -n "$$chown"; then \
+@WANT_INSTALLPERMS_TRUE@       echo chown "$$chown" "$$pa"; \
+@WANT_INSTALLPERMS_TRUE@       chown "$$chown" "$$pa" || exit 1; \
+@WANT_INSTALLPERMS_TRUE@    fi; \
+@WANT_INSTALLPERMS_TRUE@    if test -n "$$chmod"; then \
+@WANT_INSTALLPERMS_TRUE@       echo chmod "$$chmod" "$$pa"; \
+@WANT_INSTALLPERMS_TRUE@       chmod "$$chmod" "$$pa" || exit 1; \
+@WANT_INSTALLPERMS_TRUE@    fi 
+
+@WANT_INSTALLPERMS_FALSE@installperms_sh = "$(top_builddir)/installperms.sh"
+amanda_dir = $(amdatadir)
 templatedir = $(amanda_dir)/template.d
 exampledir = $(amanda_dir)/example
 lbltempldir = $(amanda_dir)/example/label-templates
-EXTRA_DIST = chg-multi.conf \
-               chg-scsi.conf \
-               config.site \
-               disklist \
-               chg-mcutil.conf
-
 dist_template_DATA = template.d/advanced.conf \
                template.d/amanda-harddisk.conf \
                template.d/amanda-single-tape.conf \
@@ -636,6 +763,7 @@ dist_template_DATA = template.d/advanced.conf \
 dist_example_DATA = amanda.conf \
               amanda-client.conf \
               inetd.conf.amandaclient \
+              inetd.conf.amandaserver \
               xinetd.amandaclient \
               xinetd.amandaserver 
 
@@ -652,10 +780,12 @@ INSTALLPERMS_data = chown=amanda \
        dest=$(exampledir) $(dist_example_DATA) \
        dest=$(libtempldir) $(dist_libtempl_DATA) 
 
-all: all-am
+all: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) all-am
 
 .SUFFIXES:
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(top_srcdir)/config/automake/installperms.am $(am__configure_deps)
+.SUFFIXES: 
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(top_srcdir)/config/automake/vars.am $(top_srcdir)/config/automake/installperms.am $(am__configure_deps)
        @for dep in $?; do \
          case '$(am__configure_deps)' in \
            *$$dep*) \
@@ -688,6 +818,14 @@ amanda-client.conf: $(top_builddir)/config.status $(srcdir)/amanda-client.conf.i
        cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
 amanda.conf: $(top_builddir)/config.status $(srcdir)/amanda.conf.in
        cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+xinetd.amandaclient: $(top_builddir)/config.status $(srcdir)/xinetd.amandaclient.in
+       cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+xinetd.amandaserver: $(top_builddir)/config.status $(srcdir)/xinetd.amandaserver.in
+       cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+inetd.conf.amandaclient: $(top_builddir)/config.status $(srcdir)/inetd.conf.amandaclient.in
+       cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+inetd.conf.amandaserver: $(top_builddir)/config.status $(srcdir)/inetd.conf.amandaserver.in
+       cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
 chg-mcutil.conf: $(top_builddir)/config.status $(srcdir)/chg-mcutil.conf.in
        cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
 
@@ -781,13 +919,15 @@ distdir: $(DISTFILES)
          fi; \
        done
 check-am: all-am
-check: check-am
+check: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) check-am
 all-am: Makefile $(DATA)
 installdirs:
        for dir in "$(DESTDIR)$(exampledir)" "$(DESTDIR)$(lbltempldir)" "$(DESTDIR)$(templatedir)"; do \
          test -z "$$dir" || $(MKDIR_P) "$$dir"; \
        done
-install: install-am
+install: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) install-am
 install-exec: install-exec-am
 install-data: install-data-am
 uninstall: uninstall-am
@@ -802,17 +942,20 @@ install-strip:
          `test -z '$(STRIP)' || \
            echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
+       -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
 
 clean-generic:
+       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
        -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+       -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
 
 maintainer-clean-generic:
        @echo "This command is intended for maintainers to use"
        @echo "it deletes files that may require special tools to rebuild."
-@WANT_INSTALLPERMS_FALSE@install-exec-hook:
-@WANT_INSTALLPERMS_FALSE@install-data-hook:
+       -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+       -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
 clean: clean-am
 
 clean-am: clean-generic clean-libtool mostlyclean-am
@@ -891,52 +1034,40 @@ uninstall-am: uninstall-dist_exampleDATA uninstall-dist_lbltemplDATA \
        uninstall-dist_lbltemplDATA uninstall-dist_templateDATA
 
 
-@WANT_INSTALLPERMS_TRUE@installperms-exec:
-@WANT_INSTALLPERMS_TRUE@       @installperms="$(INSTALLPERMS_exec)"; \
-@WANT_INSTALLPERMS_TRUE@       test -n "$$installperms" && echo "Setting installation permissions on executables"; \
-@WANT_INSTALLPERMS_TRUE@       dest=; chown=; chmod=; \
-@WANT_INSTALLPERMS_TRUE@       for cmd in $$installperms; do \
-@WANT_INSTALLPERMS_TRUE@           case "$$cmd" in \
-@WANT_INSTALLPERMS_TRUE@               chown=amanda) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
-@WANT_INSTALLPERMS_TRUE@               dest=*|chown=*|chmod=*) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; eval $$cmd;; \
-@WANT_INSTALLPERMS_TRUE@               *)  pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chown"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chown "$$chown" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chown "$$chown" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chmod"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chmod "$$chmod" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chmod "$$chmod" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@           esac; \
-@WANT_INSTALLPERMS_TRUE@       done
-
-@WANT_INSTALLPERMS_TRUE@installperms-data:
-@WANT_INSTALLPERMS_TRUE@       @installperms="$(INSTALLPERMS_data)"; \
-@WANT_INSTALLPERMS_TRUE@       test -n "$$installperms" && echo "Setting installation permissions on data"; \
-@WANT_INSTALLPERMS_TRUE@       dest=; chown=; chmod=; \
-@WANT_INSTALLPERMS_TRUE@       for cmd in $$installperms; do \
-@WANT_INSTALLPERMS_TRUE@           case "$$cmd" in \
-@WANT_INSTALLPERMS_TRUE@               chown=amanda) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
-@WANT_INSTALLPERMS_TRUE@               dest=*|chown=*|chmod=*) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; eval $$cmd;; \
-@WANT_INSTALLPERMS_TRUE@               *)  pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chown"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chown "$$chown" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chown "$$chown" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chmod"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chmod "$$chmod" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chmod "$$chmod" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@           esac; \
-@WANT_INSTALLPERMS_TRUE@       done
-
-@WANT_INSTALLPERMS_TRUE@install-exec-hook: installperms-exec
-@WANT_INSTALLPERMS_TRUE@install-data-hook: installperms-data
+installperms-exec:
+       @installperms="$(INSTALLPERMS_exec)"; \
+       test -n "$$installperms" && echo "Setting installation permissions on executables"; \
+       dest=; chown=; chmod=; \
+       for cmd in $$installperms; do \
+           case "$$cmd" in \
+               chown=amanda) \
+                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
+               dest=*|chown=*|chmod=*) \
+                       echo "  ($$cmd)"; eval $$cmd;; \
+               *) $(do_file) ;; \
+           esac; \
+       done
+
+installperms-data:
+       @installperms="$(INSTALLPERMS_data)"; \
+       dest=; chown=; chmod=; \
+       for cmd in $$installperms; do \
+           case "$$cmd" in \
+               chown=amanda) \
+                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
+               dest=*|chown=*|chmod=*) \
+                       echo "  ($$cmd)"; eval $$cmd;; \
+               *)  $(do_file) ;; \
+           esac; \
+       done
+
+install-exec-hook: installperms-exec
+install-data-hook: installperms-data
+
+# define a rule to initialize the installperms manifest file
+@WANT_INSTALLPERMS_TRUE@installperms-init:
+@WANT_INSTALLPERMS_FALSE@installperms-init:
+@WANT_INSTALLPERMS_FALSE@      rm -f "$(installperms_sh)"
 # 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:
index 2179acb40575a5a277d38236159ee7cd1653f7a5..6cee6404501297ca1d6297cf4e8573e376a0d714 100644 (file)
@@ -6,9 +6,9 @@
 
 conf "DailySet1"               # your config name
 
-index_server "kdc.localdomain" # your amindexd server
-tape_server  "kdc.localdomain" # your amidxtaped server
-#tapedev      "tape:/dev/YOUR-TAPE-DEVICE-HERE"        # your tape device
+index_server "localhost.localdomain"   # your amindexd server
+tape_server  "localhost.localdomain"   # your amidxtaped server
+tapedev      "tape:/dev/YOUR-TAPE-DEVICE-HERE" # your tape device
                        # if not set, Use configure or ask server.
                        # if set to empty string "", ask server
                        # amrecover will use the changer if set to the value
index 10e859d269146ebf65c88479e24896109eb463cd..a6577aa7d0bdeec6b2ac205f1dc4219dacdedbbe 100644 (file)
@@ -8,7 +8,7 @@ conf "@DEFAULT_CONFIG@"         # your config name
 
 index_server "@DEFAULT_SERVER@"        # your amindexd server
 tape_server  "@DEFAULT_TAPE_SERVER@"   # your amidxtaped server
-#tapedev      "@EXAMPLE_TAPEDEV@"      # your tape device
+tapedev      "@EXAMPLE_TAPEDEV@"       # your tape device
                        # if not set, Use configure or ask server.
                        # if set to empty string "", ask server
                        # amrecover will use the changer if set to the value
index 61316b5b846a107a4126b80e05ba8bfedef34cc4..db0066c28dce30d076fc9d5fb4002fbdbb17df2e 100644 (file)
@@ -251,11 +251,7 @@ indexdir "/etc/amanda/DailySet1/index"             # index directory
 # are, and how fast the tape device is.
 
 # A filemark is the amount of wasted space every time a tape section
-# ends.  If you run `make tapetype' in tape-src, you'll get a program
-# that generates tapetype entries, but it is slow as hell, use it only
-# if you really must and, if you do, make sure you post the data to
-# the amanda mailing list, so that others can use what you found out
-# by searching the archives.
+# ends.
 
 # For completeness Amanda should calculate the inter-record gaps too,
 # but it doesn't.  For EXABYTE and DAT tapes this is ok.  Anyone using
@@ -725,6 +721,47 @@ define interface local {
 #    use 400 kbps
 #}
 
+#define application-tool and dumptype for the amgtar application
+define application-tool app_amgtar {
+    comment "amgtar"
+    plugin  "amgtar"
+    #property "GNUTAR-PATH" "/path/to/gtar"
+    #property "GNUTAR-LISTDIR" "/path/to/gnutar_list_dir"
+                    #default from gnutar_list_dir setting in amanda-client.conf
+}
+
+define dumptype dt_amgtar {
+    program "APPLICATION"
+    application "app_amgtar"
+}
+
+#define application-tool and dumptype for the amstar application
+define application-tool app_amstar {
+    comment "amstar"
+    plugin  "amstar"
+    #property "STAR-PATH" "/path/to/star"
+    #property "STAR-TARDUMP" "/path/to/tardumps"  # default /etc/tardumps
+    #property "STAR-DLE-TARDUMP" "no"
+       # if 'yes' then create a different tardump file for each DLE,
+        # it is required if you do many dump in parallel (maxdump>1)
+}
+
+define dumptype dt_amstar {
+    program "APPLICATION"
+    application "app_amstar"
+}
+
+#define a script-tool to send an email
+define script-tool sc-email {
+  comment "script-email"
+  plugin  "script-email"
+  execute_on pre-dle-amcheck, pre-host-amcheck, post-dle-amcheck, post-host-amcheck, pre-dle-estimate, pre-host-estimate, post-dle-estimate, post-host-estimate, pre-dle-backup, pre-host-backup, post-dle-backup, post-host-backup
+  execute_where server                 # or client
+  property "mailto" "martinea"
+}
+#your dumptype must include: script "sc-email"
+#to use the script
+
 # You may include other amanda configuration files, so you can share
 # dumptypes, tapetypes and interface definitions among several
 # configurations.
index 5e9df2bc155be3b35bd79221d8b694360461d6a4..57f1befc9baeb0032e2ec50b270c50acfc43bcfb 100644 (file)
@@ -251,11 +251,7 @@ indexdir "@CONFIG_DIR@/@DEFAULT_CONFIG@/index"             # index directory
 # are, and how fast the tape device is.
 
 # A filemark is the amount of wasted space every time a tape section
-# ends.  If you run `make tapetype' in tape-src, you'll get a program
-# that generates tapetype entries, but it is slow as hell, use it only
-# if you really must and, if you do, make sure you post the data to
-# the amanda mailing list, so that others can use what you found out
-# by searching the archives.
+# ends.
 
 # For completeness Amanda should calculate the inter-record gaps too,
 # but it doesn't.  For EXABYTE and DAT tapes this is ok.  Anyone using
@@ -725,6 +721,47 @@ define interface local {
 #    use 400 kbps
 #}
 
+#define application-tool and dumptype for the amgtar application
+define application-tool app_amgtar {
+    comment "amgtar"
+    plugin  "amgtar"
+    #property "GNUTAR-PATH" "/path/to/gtar"
+    #property "GNUTAR-LISTDIR" "/path/to/gnutar_list_dir"
+                    #default from gnutar_list_dir setting in amanda-client.conf
+}
+
+define dumptype dt_amgtar {
+    program "APPLICATION"
+    application "app_amgtar"
+}
+
+#define application-tool and dumptype for the amstar application
+define application-tool app_amstar {
+    comment "amstar"
+    plugin  "amstar"
+    #property "STAR-PATH" "/path/to/star"
+    #property "STAR-TARDUMP" "/path/to/tardumps"  # default /etc/tardumps
+    #property "STAR-DLE-TARDUMP" "no"
+       # if 'yes' then create a different tardump file for each DLE,
+        # it is required if you do many dump in parallel (maxdump>1)
+}
+
+define dumptype dt_amstar {
+    program "APPLICATION"
+    application "app_amstar"
+}
+
+#define a script-tool to send an email
+define script-tool sc-email {
+  comment "script-email"
+  plugin  "script-email"
+  execute_on pre-dle-amcheck, pre-host-amcheck, post-dle-amcheck, post-host-amcheck, pre-dle-estimate, pre-host-estimate, post-dle-estimate, post-host-estimate, pre-dle-backup, pre-host-backup, post-dle-backup, post-host-backup
+  execute_where server                 # or client
+  property "mailto" "martinea"
+}
+#your dumptype must include: script "sc-email"
+#to use the script
+
 # You may include other amanda configuration files, so you can share
 # dumptypes, tapetypes and interface definitions among several
 # configurations.
index d103b6d122c2b2acb6fe529f119079e1da880b4a..49ee6dfa398384ebc9ff8e1d843f43b0f7b43974 100644 (file)
@@ -1,2 +1,2 @@
-#amanda stream tcp nowait amandabackup /usr/lib/amanda/amandad -auth=bsdtcp amdump
-amanda stream tcp nowait amandabackup /usr/lib/amanda/amandad amandad -auth=bsdtcp amdump
+#amanda stream tcp nowait amandabackup /usr/libexec/amanda/amandad -auth=bsdtcp amdump
+amanda stream tcp nowait amandabackup /usr/libexec/amanda/amandad amandad -auth=bsdtcp amdump
diff --git a/example/inetd.conf.amandaclient.in b/example/inetd.conf.amandaclient.in
new file mode 100644 (file)
index 0000000..9d60e06
--- /dev/null
@@ -0,0 +1,2 @@
+#amanda stream tcp nowait amandabackup @amlibexecdir@/amandad -auth=bsdtcp amdump
+amanda stream tcp nowait amandabackup @amlibexecdir@/amandad amandad -auth=bsdtcp amdump
diff --git a/example/inetd.conf.amandaserver b/example/inetd.conf.amandaserver
new file mode 100644 (file)
index 0000000..be6a575
--- /dev/null
@@ -0,0 +1 @@
+amanda stream tcp nowait amandabackup /usr/libexec/amanda/amandad amandad -auth=bsdtcp amdump amindexd amidxtaped
diff --git a/example/inetd.conf.amandaserver.in b/example/inetd.conf.amandaserver.in
new file mode 100644 (file)
index 0000000..3228c79
--- /dev/null
@@ -0,0 +1 @@
+amanda stream tcp nowait amandabackup @amlibexecdir@/amandad amandad -auth=bsdtcp amdump amindexd amidxtaped
index 60360893b5f863104e93ff02ee40b7c659c1d902..53f57e3ff8fdc4eef65a60b8fe6e9622e69ab62e 100644 (file)
@@ -25,7 +25,7 @@ taperalgo first               # The algorithm used to choose which dump image to send
                        # largestfit    The largest dump image that will fit on the current tape.
                        # smallest      The smallest dump image.
                        # last          Last in - first out.
-displayunit "m"                # Possible values: "k|m|g|t"
+displayunit "g"                # Possible values: "k|m|g|t"
                        # Default: k. 
                        # The unit used to print many numbers.
                        # k=kilo, m=mega, g=giga, t=tera
@@ -52,8 +52,8 @@ device_output_buffer_size 1280k
 # Use with caution.
 ## label_new_tapes "DailySet1-%%%"
                        
-maxdumpsize -1         # Maximum number of bytes the planner will schedule
-                       # for a run (default: runtapes * tape_length).
+maxdumpsize -1         # Maximum total size the planner will schedule
+                       # for a run (default: runtapes * tape_length) (kbytes).
 amrecover_do_fsf yes           # amrecover will call amrestore with the
                                # -f flag for faster positioning of the tape.
 amrecover_check_label yes      # amrecover will call amrestore with the
index 19b963e982898c8928ea7a349e32ee000322be4a..1a0ee064ae16c45f46cd5c428ff9e0feea0f8b31 100644 (file)
@@ -25,7 +25,7 @@ taperalgo first               # The algorithm used to choose which dump image to send
                        # largestfit    The largest dump image that will fit on the current tape.
                        # smallest      The smallest dump image.
                        # last          Last in - first out.
-displayunit "m"                # Possible values: "k|m|g|t"
+displayunit "g"                # Possible values: "k|m|g|t"
                        # Default: k. 
                        # The unit used to print many numbers.
                        # k=kilo, m=mega, g=giga, t=tera
@@ -52,8 +52,8 @@ device_output_buffer_size 1280k
 # Use with caution.
 ## label_new_tapes "DailySet1-%%%"
                        
-maxdumpsize -1         # Maximum number of bytes the planner will schedule
-                       # for a run (default: runtapes * tape_length).
+maxdumpsize -1         # Maximum total size the planner will schedule
+                       # for a run (default: runtapes * tape_length) (kbytes).
 amrecover_do_fsf yes           # amrecover will call amrestore with the
                                # -f flag for faster positioning of the tape.
 amrecover_check_label yes      # amrecover will call amrestore with the
index 70297b0cfd6a31b2960e4e28ffaa05ae4653f904..e05b66d17434610ce202b18fa56ae89a4604a0a5 100644 (file)
@@ -14,7 +14,7 @@ tpchanger "chg-multi" # the tape-changer glue script
 tapedev "S3:"          # the no-rewind tape device to be used
 changerfile "/etc/amanda/DailySet1/changer.conf" 
 #changerdev "/dev/sg1"
-tapetype HARDDISK      # what kind of tape it is (see tapetypes below)
+tapetype S3    # what kind of tape it is (see tapetypes below)
 
 holdingdisk hd2 {
     directory "/var/lib/amanda/holdings/DailySet1"
@@ -34,9 +34,18 @@ define dumptype global {
         auth "bsdtcp"
 }
 
+#define application-tool and dumptype for the amgtar application
+define application-tool app_amgtar {
+    comment "amgtar"
+    plugin  "amgtar"
+    #property "GNUTAR-PATH" "/path/to/gtar"
+    #property "GNUTAR-LISTDIR" "/path/to/gnutar_list_dir"
+}
+
 define dumptype gui-base {
         global
-        program "GNUTAR"
+        program "APPLICATION"
+        application "app_amgtar"
         comment "gui base dumptype dumped with tar"
         compress none
         index yes
@@ -47,6 +56,10 @@ define tapetype HARDDISK {
     length 5000 mbytes
 }
 
+define tapetype S3 {
+    comment "S3 Bucket"
+    length 10240 gigabytes # Bucket size 10TB
+}
 
 includefile "./advanced.conf"
 includefile "/etc/amanda/template.d/dumptypes"
index 96592d62d301ef838751df3b5baca15253136547..149fc9efa057ce57da3ca999fe1549d82762548d 100644 (file)
@@ -14,7 +14,7 @@ tpchanger "chg-multi" # the tape-changer glue script
 tapedev "S3:"          # the no-rewind tape device to be used
 changerfile "@CONFIG_DIR@/@DEFAULT_CONFIG@/changer.conf" 
 #changerdev "/dev/sg1"
-tapetype HARDDISK      # what kind of tape it is (see tapetypes below)
+tapetype S3    # what kind of tape it is (see tapetypes below)
 
 holdingdisk hd2 {
     directory "/var/lib/amanda/holdings/@DEFAULT_CONFIG@"
@@ -34,9 +34,18 @@ define dumptype global {
         auth "bsdtcp"
 }
 
+#define application-tool and dumptype for the amgtar application
+define application-tool app_amgtar {
+    comment "amgtar"
+    plugin  "amgtar"
+    #property "GNUTAR-PATH" "/path/to/gtar"
+    #property "GNUTAR-LISTDIR" "/path/to/gnutar_list_dir"
+}
+
 define dumptype gui-base {
         global
-        program "GNUTAR"
+        program "APPLICATION"
+        application "app_amgtar"
         comment "gui base dumptype dumped with tar"
         compress none
         index yes
@@ -47,6 +56,10 @@ define tapetype HARDDISK {
     length 5000 mbytes
 }
 
+define tapetype S3 {
+    comment "S3 Bucket"
+    length 10240 gigabytes # Bucket size 10TB
+}
 
 includefile "./advanced.conf"
 includefile "@CONFIG_DIR@/template.d/dumptypes"
index 395a83643d32f8b69b03a3d2f8450242be3785b1..4a489735d979a8908d92cf91afb0b1632e0c590a 100644 (file)
@@ -26,9 +26,18 @@ define dumptype global {
         auth "bsdtcp"
 }
 
+#define application-tool and dumptype for the amgtar application
+define application-tool app_amgtar {
+    comment "amgtar"
+    plugin  "amgtar"
+    #property "GNUTAR-PATH" "/path/to/gtar"
+    #property "GNUTAR-LISTDIR" "/path/to/gnutar_list_dir"
+}
+
 define dumptype gui-base {
        global
-        program "GNUTAR"
+       program "APPLICATION"
+        application "app_amgtar"
         comment "gui base dumptype dumped with tar"
         compress none
         index yes
index e1c920be7383d6d88ce84a5dc24641717068dc24..53ec87b830dbecb12f3e07d14f94bd2c7f62f670 100644 (file)
@@ -26,9 +26,18 @@ define dumptype global {
         auth "bsdtcp"
 }
 
+#define application-tool and dumptype for the amgtar application
+define application-tool app_amgtar {
+    comment "amgtar"
+    plugin  "amgtar"
+    #property "GNUTAR-PATH" "/path/to/gtar"
+    #property "GNUTAR-LISTDIR" "/path/to/gnutar_list_dir"
+}
+
 define dumptype gui-base {
        global
-        program "GNUTAR"
+       program "APPLICATION"
+        application "app_amgtar"
         comment "gui base dumptype dumped with tar"
         compress none
         index yes
index 8cd47c9d9ed467b0e09a2b34006920fc62342e23..0add4f31e8906c37b26eba456fafaeb0a4bafb13 100644 (file)
@@ -11,7 +11,6 @@ tapecycle 10 tapes    # the number of tapes in rotation
                        # cycle
 
 runtapes 1             # number of tapes to be used in a single run of amdump
-tpchanger "chg-manual" # the tape-changer glue script
 tapedev "tape:/dev/nst0"       # the no-rewind tape device to be used
 changerfile "/etc/amanda/DailySet1/chg-manual.conf"
 changerdev "/dev/null"
@@ -34,9 +33,18 @@ define dumptype global {
         auth "bsdtcp"
 }
 
+#define application-tool and dumptype for the amgtar application
+define application-tool app_amgtar {
+    comment "amgtar"
+    plugin  "amgtar"
+    #property "GNUTAR-PATH" "/path/to/gtar"
+    #property "GNUTAR-LISTDIR" "/path/to/gnutar_list_dir"
+}
+
 define dumptype gui-base {
         global
-        program "GNUTAR"
+        program "APPLICATION"
+        application "app_amgtar"
         comment "gui base dumptype dumped with tar"
         compress none
         index yes
index 60123055a43913ad5d317f442bbead2928051f7d..7a26942f6ba05301da3d062e2604d9c70a76bd3a 100644 (file)
@@ -11,7 +11,6 @@ tapecycle 10 tapes    # the number of tapes in rotation
                        # cycle
 
 runtapes 1             # number of tapes to be used in a single run of amdump
-tpchanger "chg-manual" # the tape-changer glue script
 tapedev "tape:/dev/nst0"       # the no-rewind tape device to be used
 changerfile "@CONFIG_DIR@/@DEFAULT_CONFIG@/chg-manual.conf"
 changerdev "/dev/null"
@@ -34,9 +33,18 @@ define dumptype global {
         auth "bsdtcp"
 }
 
+#define application-tool and dumptype for the amgtar application
+define application-tool app_amgtar {
+    comment "amgtar"
+    plugin  "amgtar"
+    #property "GNUTAR-PATH" "/path/to/gtar"
+    #property "GNUTAR-LISTDIR" "/path/to/gnutar_list_dir"
+}
+
 define dumptype gui-base {
         global
-        program "GNUTAR"
+        program "APPLICATION"
+        application "app_amgtar"
         comment "gui base dumptype dumped with tar"
         compress none
         index yes
index 382259f23ccfb9b7266b3770215670e41f2278d2..d60fbd5e6cec576df553e1e6167c3c65dbbf26cc 100644 (file)
@@ -33,9 +33,18 @@ define dumptype global {
         auth "bsdtcp"
 }
 
+#define application-tool and dumptype for the amgtar application
+define application-tool app_amgtar {
+    comment "amgtar"
+    plugin  "amgtar"
+    #property "GNUTAR-PATH" "/path/to/gtar"
+    #property "GNUTAR-LISTDIR" "/path/to/gnutar_list_dir"
+}
+
 define dumptype gui-base {
         global
-        program "GNUTAR"
+        program "APPLICATION"
+        application "app_amgtar"
         comment "gui base dumptype dumped with tar"
         compress none
         index yes
index f46e7298775746d613a8f49631c286ead7e2120e..d2922a29fd8726fd59d2d15487fdb0bdd314d300 100644 (file)
@@ -33,9 +33,18 @@ define dumptype global {
         auth "bsdtcp"
 }
 
+#define application-tool and dumptype for the amgtar application
+define application-tool app_amgtar {
+    comment "amgtar"
+    plugin  "amgtar"
+    #property "GNUTAR-PATH" "/path/to/gtar"
+    #property "GNUTAR-LISTDIR" "/path/to/gnutar_list_dir"
+}
+
 define dumptype gui-base {
         global
-        program "GNUTAR"
+        program "APPLICATION"
+        application "app_amgtar"
         comment "gui base dumptype dumped with tar"
         compress none
         index yes
index d0f2ae8d1bd9df1010179df13d1dffa12191de33..da67d455808cbd9a24812c672c7b821c6aa36a9e 100644 (file)
@@ -419,4 +419,3 @@ define dumptype gui-encrypt-compress {
    encrypt server 
    server_encrypt "/usr/sbin/amcryptsimple"
 }
-
index effaeed5e31e133ea5d88339404bba42aeeb6524..4a85795b1a3f3dc1f285e6314f0fc5ddf7f3459b 100644 (file)
@@ -6,11 +6,7 @@
 # are, and how fast the tape device is.
 
 # A filemark is the amount of wasted space every time a tape section
-# ends.  If you run `make tapetype' in tape-src, you'll get a program
-# that generates tapetype entries, but it is slow as hell, use it only
-# if you really must and, if you do, make sure you post the data to
-# the amanda mailing list, so that others can use what you found out
-# by searching the archives.
+# ends.
 
 # For completeness Amanda should calculate the inter-record gaps too,
 # but it doesn't.  For EXABYTE and DAT tapes this is ok.  Anyone using
index 7747b0f698346700975ee5bad243b2cac269550c..9fc402bf18b109ad84600278c4eec0dae97f469f 100644 (file)
@@ -6,14 +6,13 @@
 service amanda
 {
        disable         = no
-       flags           = IPv4
-        flags          = IPv6
+       flags           = IPv6
        socket_type     = stream
        protocol        = tcp
        wait            = no
        user            = amandabackup
        group           = disk
        groups          = yes
-       server          = /usr/libexec/amanda/amandad 
+       server          = /usr/libexec/amanda/amandad
        server_args     = -auth=bsdtcp amdump
 }
diff --git a/example/xinetd.amandaclient.in b/example/xinetd.amandaclient.in
new file mode 100644 (file)
index 0000000..f7f3d7c
--- /dev/null
@@ -0,0 +1,18 @@
+# default: on
+#
+# description: The Amanda backup client should be enabled for systems
+#              which will be backed up by an Amanda backup server.
+
+service amanda
+{
+       disable         = no
+       flags           = IPv6
+       socket_type     = stream
+       protocol        = tcp
+       wait            = no
+       user            = amandabackup
+       group           = disk
+       groups          = yes
+       server          = @amlibexecdir@/amandad
+       server_args     = -auth=bsdtcp amdump
+}
index 8279d4ec0520dd600b61d570a45c0c2c007658fa..c67f73067ba4bfce0a4645f291eb4138a02a3e8c 100644 (file)
@@ -1,13 +1,12 @@
 # default: on
 #
 # description: Amanda services for Amanda server and client.
-#              
+#
 
 service amanda
 {
         disable         = no
-       flags           = IPv4
-        flags          = IPv6
+        flags           = IPv6
         socket_type     = stream
         protocol        = tcp
         wait            = no
diff --git a/example/xinetd.amandaserver.in b/example/xinetd.amandaserver.in
new file mode 100644 (file)
index 0000000..367d0e8
--- /dev/null
@@ -0,0 +1,18 @@
+# default: on
+#
+# description: Amanda services for Amanda server and client.
+#
+
+service amanda
+{
+        disable         = no
+        flags           = IPv6
+        socket_type     = stream
+        protocol        = tcp
+        wait            = no
+        user            = amandabackup
+        group           = disk
+        groups          = yes
+        server          = @amlibexecdir@/amandad
+        server_args     = -auth=bsdtcp amdump amindexd amidxtaped
+}
index 78cdadfdc373e0ef2dbc5a8a35b20dff052f595d..097892e381d448f29441d5822a78cfb019528996 100644 (file)
@@ -9,7 +9,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib --m4-base=config/gnulib --doc-base=doc --aux-dir=config --libtool --macro-prefix=gl base64 fsusage getaddrinfo lock mkdtemp physmem visibility
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib --m4-base=config/gnulib --doc-base=doc --aux-dir=config --libtool --macro-prefix=gl base64 fsusage full-read full-write getaddrinfo getopt lock mkdtemp physmem visibility
 
 AUTOMAKE_OPTIONS = 1.5 gnits
 
@@ -53,14 +53,14 @@ BUILT_SOURCES += $(ALLOCA_H)
 
 # We need the following in order to create <alloca.h> when the system
 # doesn't have one that works with the given compiler.
-alloca.h: alloca_.h
+alloca.h: alloca.in.h
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         cat $(srcdir)/alloca_.h; \
+         cat $(srcdir)/alloca.in.h; \
        } > $@-t
        mv -f $@-t $@
 MOSTLYCLEANFILES += alloca.h alloca.h-t
 
-EXTRA_DIST += alloca_.h
+EXTRA_DIST += alloca.in.h
 
 ## end   gnulib module alloca-opt
 
@@ -94,17 +94,17 @@ BUILT_SOURCES += $(FLOAT_H)
 
 # We need the following in order to create <float.h> when the system
 # doesn't have one that works with the given compiler.
-float.h: float_.h
+float.h: float.in.h
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
              -e 's|@''NEXT_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \
-             < $(srcdir)/float_.h; \
+             < $(srcdir)/float.in.h; \
        } > $@-t
        mv $@-t $@
 MOSTLYCLEANFILES += float.h float.h-t
 
-EXTRA_DIST += float_.h
+EXTRA_DIST += float.in.h
 
 ## end   gnulib module float
 
@@ -138,6 +138,25 @@ EXTRA_libgnu_la_SOURCES += gai_strerror.c getaddrinfo.c
 
 ## end   gnulib module getaddrinfo
 
+## begin gnulib module getopt
+
+BUILT_SOURCES += $(GETOPT_H)
+
+# We need the following in order to create <getopt.h> when the system
+# doesn't have one that works with the given compiler.
+getopt.h: getopt.in.h
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         cat $(srcdir)/getopt.in.h; \
+       } > $@-t
+       mv -f $@-t $@
+MOSTLYCLEANFILES += getopt.h getopt.h-t
+
+EXTRA_DIST += getopt.c getopt.in.h getopt1.c getopt_int.h
+
+EXTRA_libgnu_la_SOURCES += getopt.c getopt1.c
+
+## end   gnulib module getopt
+
 ## begin gnulib module gettext-h
 
 libgnu_la_SOURCES += gettext.h
@@ -209,20 +228,20 @@ BUILT_SOURCES += $(NETINET_IN_H)
 
 # We need the following in order to create <netinet/in.h> when the system
 # doesn't have one.
-netinet/in.h:
+netinet/in.h: netinet_in.in.h
        @MKDIR_P@ netinet
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
              -e 's|@''NEXT_NETINET_IN_H''@|$(NEXT_NETINET_IN_H)|g' \
              -e 's|@''HAVE_NETINET_IN_H''@|$(HAVE_NETINET_IN_H)|g' \
-             < $(srcdir)/netinet_in_.h; \
+             < $(srcdir)/netinet_in.in.h; \
        } > $@-t
        mv $@-t $@
 MOSTLYCLEANFILES += netinet/in.h netinet/in.h-t
 MOSTLYCLEANDIRS += netinet
 
-EXTRA_DIST += netinet_in_.h
+EXTRA_DIST += netinet_in.in.h
 
 ## end   gnulib module netinet_in
 
@@ -274,15 +293,15 @@ BUILT_SOURCES += $(STDBOOL_H)
 
 # We need the following in order to create <stdbool.h> when the system
 # doesn't have one that works.
-stdbool.h: stdbool_.h
+stdbool.h: stdbool.in.h
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h; \
+         sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \
        } > $@-t
        mv $@-t $@
 MOSTLYCLEANFILES += stdbool.h stdbool.h-t
 
-EXTRA_DIST += stdbool_.h
+EXTRA_DIST += stdbool.in.h
 
 ## end   gnulib module stdbool
 
@@ -292,7 +311,7 @@ BUILT_SOURCES += $(STDINT_H)
 
 # We need the following in order to create <stdint.h> when the system
 # doesn't have one that works with the given compiler.
-stdint.h: stdint_.h
+stdint.h: stdint.in.h
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
@@ -317,12 +336,12 @@ stdint.h: stdint_.h
              -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \
              -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \
              -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \
-             < $(srcdir)/stdint_.h; \
+             < $(srcdir)/stdint.in.h; \
        } > $@-t
        mv $@-t $@
 MOSTLYCLEANFILES += stdint.h stdint.h-t
 
-EXTRA_DIST += stdint_.h
+EXTRA_DIST += stdint.in.h
 
 ## end   gnulib module stdint
 
@@ -332,7 +351,7 @@ BUILT_SOURCES += stdio.h
 
 # We need the following in order to create <stdio.h> when the system
 # doesn't have one that works with the given compiler.
-stdio.h: stdio_.h
+stdio.h: stdio.in.h
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
@@ -346,6 +365,8 @@ stdio.h: stdio_.h
              -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \
              -e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \
              -e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \
+             -e 's|@''GNULIB_FOPEN''@|$(GNULIB_FOPEN)|g' \
+             -e 's|@''GNULIB_FREOPEN''@|$(GNULIB_FREOPEN)|g' \
              -e 's|@''GNULIB_FSEEK''@|$(GNULIB_FSEEK)|g' \
              -e 's|@''GNULIB_FSEEKO''@|$(GNULIB_FSEEKO)|g' \
              -e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \
@@ -365,6 +386,8 @@ stdio.h: stdio_.h
              -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \
              -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \
              -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \
+             -e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \
+             -e 's|@''REPLACE_FREOPEN''@|$(REPLACE_FREOPEN)|g' \
              -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \
              -e 's|@''REPLACE_FSEEK''@|$(REPLACE_FSEEK)|g' \
              -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \
@@ -374,12 +397,12 @@ stdio.h: stdio_.h
              -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \
              -e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
-             < $(srcdir)/stdio_.h; \
+             < $(srcdir)/stdio.in.h; \
        } > $@-t
        mv $@-t $@
 MOSTLYCLEANFILES += stdio.h stdio.h-t
 
-EXTRA_DIST += stdio_.h
+EXTRA_DIST += stdio.in.h
 
 ## end   gnulib module stdio
 
@@ -389,7 +412,7 @@ BUILT_SOURCES += stdlib.h
 
 # We need the following in order to create <stdlib.h> when the system
 # doesn't have one that works with the given compiler.
-stdlib.h: stdlib_.h
+stdlib.h: stdlib.in.h
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
@@ -400,19 +423,26 @@ stdlib.h: stdlib_.h
              -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \
              -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \
              -e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \
+             -e 's|@''GNULIB_PUTENV''@|$(GNULIB_PUTENV)|g' \
+             -e 's|@''GNULIB_SETENV''@|$(GNULIB_SETENV)|g' \
+             -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \
              -e 's|@''HAVE_CALLOC_POSIX''@|$(HAVE_CALLOC_POSIX)|g' \
              -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \
              -e 's|@''HAVE_MALLOC_POSIX''@|$(HAVE_MALLOC_POSIX)|g' \
              -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
              -e 's|@''HAVE_REALLOC_POSIX''@|$(HAVE_REALLOC_POSIX)|g' \
+             -e 's|@''HAVE_SETENV''@|$(HAVE_SETENV)|g' \
+             -e 's|@''HAVE_UNSETENV''@|$(HAVE_UNSETENV)|g' \
              -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
+             -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
+             -e 's|@''VOID_UNSETENV''@|$(VOID_UNSETENV)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
-             < $(srcdir)/stdlib_.h; \
+             < $(srcdir)/stdlib.in.h; \
        } > $@-t
        mv $@-t $@
 MOSTLYCLEANFILES += stdlib.h stdlib.h-t
 
-EXTRA_DIST += stdlib_.h
+EXTRA_DIST += stdlib.in.h
 
 ## end   gnulib module stdlib
 
@@ -431,7 +461,7 @@ BUILT_SOURCES += string.h
 
 # We need the following in order to create <string.h> when the system
 # doesn't have one that works with the given compiler.
-string.h: string_.h
+string.h: string.in.h
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
@@ -461,15 +491,16 @@ string.h: string_.h
              -e 's|@''GNULIB_STRNLEN''@|$(GNULIB_STRNLEN)|g' \
              -e 's|@''GNULIB_STRPBRK''@|$(GNULIB_STRPBRK)|g' \
              -e 's|@''GNULIB_STRSEP''@|$(GNULIB_STRSEP)|g' \
+             -e 's|@''GNULIB_STRSTR''@|$(GNULIB_STRSTR)|g' \
              -e 's|@''GNULIB_STRCASESTR''@|$(GNULIB_STRCASESTR)|g' \
              -e 's|@''GNULIB_STRTOK_R''@|$(GNULIB_STRTOK_R)|g' \
+             -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \
+             -e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \
              -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
              -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
              -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
              -e 's|@''HAVE_STPCPY''@|$(HAVE_STPCPY)|g' \
              -e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \
-             -e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \
-             -e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \
              -e 's|@''HAVE_STRCHRNUL''@|$(HAVE_STRCHRNUL)|g' \
              -e 's|@''HAVE_DECL_STRDUP''@|$(HAVE_DECL_STRDUP)|g' \
              -e 's|@''HAVE_STRNDUP''@|$(HAVE_STRNDUP)|g' \
@@ -479,13 +510,20 @@ string.h: string_.h
              -e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \
              -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \
              -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \
+             -e 's|@''HAVE_DECL_STRERROR''@|$(HAVE_DECL_STRERROR)|g' \
+             -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \
+             -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \
+             -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \
+             -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \
+             -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \
+             -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
-             < $(srcdir)/string_.h; \
+             < $(srcdir)/string.in.h; \
        } > $@-t
        mv $@-t $@
 MOSTLYCLEANFILES += string.h string.h-t
 
-EXTRA_DIST += string_.h
+EXTRA_DIST += string.in.h
 
 ## end   gnulib module string
 
@@ -495,7 +533,7 @@ BUILT_SOURCES += $(SYS_SOCKET_H)
 
 # We need the following in order to create <sys/socket.h> when the system
 # doesn't have one that works with the given compiler.
-sys/socket.h: sys_socket_.h
+sys/socket.h: sys_socket.in.h
        @MKDIR_P@ sys
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
@@ -503,13 +541,13 @@ sys/socket.h: sys_socket_.h
              -e 's|@''HAVE_SYS_SOCKET_H''@|$(HAVE_SYS_SOCKET_H)|g' \
              -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
              -e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \
-             < $(srcdir)/sys_socket_.h; \
+             < $(srcdir)/sys_socket.in.h; \
        } > $@-t
        mv -f $@-t $@
 MOSTLYCLEANFILES += sys/socket.h sys/socket.h-t
 MOSTLYCLEANDIRS += sys
 
-EXTRA_DIST += sys_socket_.h
+EXTRA_DIST += sys_socket.in.h
 
 ## end   gnulib module sys_socket
 
@@ -519,7 +557,7 @@ BUILT_SOURCES += $(SYS_STAT_H)
 
 # We need the following in order to create <sys/stat.h> when the system
 # has one that is incomplete.
-sys/stat.h: sys_stat_.h
+sys/stat.h: sys_stat.in.h
        @MKDIR_P@ sys
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -528,13 +566,13 @@ sys/stat.h: sys_stat_.h
              -e 's|@''HAVE_IO_H''@|$(HAVE_IO_H)|g' \
              -e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \
              -e 's|@''HAVE_DECL_MKDIR''@|$(HAVE_DECL_MKDIR)|g' \
-             < $(srcdir)/sys_stat_.h; \
+             < $(srcdir)/sys_stat.in.h; \
        } > $@-t
        mv $@-t $@
 MOSTLYCLEANFILES += sys/stat.h sys/stat.h-t
 MOSTLYCLEANDIRS += sys
 
-EXTRA_DIST += sys_stat_.h
+EXTRA_DIST += sys_stat.in.h
 
 ## end   gnulib module sys_stat
 
@@ -544,7 +582,7 @@ BUILT_SOURCES += $(SYS_TIME_H)
 
 # We need the following in order to create <sys/time.h> when the system
 # doesn't have one that works with the given compiler.
-sys/time.h: sys_time_.h
+sys/time.h: sys_time.in.h
        @MKDIR_P@ sys
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -553,12 +591,12 @@ sys/time.h: sys_time_.h
              -e 's|@''NEXT_SYS_TIME_H''@|$(NEXT_SYS_TIME_H)|g' \
              -e 's/@''REPLACE_GETTIMEOFDAY''@/$(REPLACE_GETTIMEOFDAY)/g' \
              -e 's/@''HAVE_STRUCT_TIMEVAL''@/$(HAVE_STRUCT_TIMEVAL)/g' \
-             < $(srcdir)/sys_time_.h; \
+             < $(srcdir)/sys_time.in.h; \
        } > $@-t
        mv $@-t $@
 MOSTLYCLEANFILES += sys/time.h sys/time.h-t
 
-EXTRA_DIST += sys_time_.h
+EXTRA_DIST += sys_time.in.h
 
 ## end   gnulib module sys_time
 
@@ -577,7 +615,7 @@ BUILT_SOURCES += unistd.h
 
 # We need the following in order to create an empty placeholder for
 # <unistd.h> when the system doesn't have one.
-unistd.h: unistd_.h
+unistd.h: unistd.in.h
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \
@@ -585,30 +623,37 @@ unistd.h: unistd_.h
              -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \
              -e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \
              -e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \
+             -e 's|@''GNULIB_ENVIRON''@|$(GNULIB_ENVIRON)|g' \
              -e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \
              -e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \
              -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \
              -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \
+             -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \
              -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \
              -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \
              -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \
              -e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \
              -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \
              -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \
+             -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \
              -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \
              -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \
+             -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \
              -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \
+             -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \
+             -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \
              -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \
              -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
              -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
+             -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
              -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \
              -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \
-             < $(srcdir)/unistd_.h; \
+             < $(srcdir)/unistd.in.h; \
        } > $@-t
        mv $@-t $@
 MOSTLYCLEANFILES += unistd.h unistd.h-t
 
-EXTRA_DIST += unistd_.h
+EXTRA_DIST += unistd.in.h
 
 ## end   gnulib module unistd
 
@@ -627,7 +672,7 @@ BUILT_SOURCES += $(WCHAR_H)
 
 # We need the following in order to create <wchar.h> when the system
 # version does not work standalone.
-wchar.h: wchar_.h
+wchar.h: wchar.in.h
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
@@ -637,12 +682,12 @@ wchar.h: wchar_.h
              -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \
              -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
-           < $(srcdir)/wchar_.h; \
+           < $(srcdir)/wchar.in.h; \
        } > $@-t
        mv $@-t $@
 MOSTLYCLEANFILES += wchar.h wchar.h-t
 
-EXTRA_DIST += wchar_.h
+EXTRA_DIST += wchar.in.h
 
 ## end   gnulib module wchar
 
@@ -662,4 +707,4 @@ mostlyclean-local: mostlyclean-generic
        :
 
 # Make sure regenerate/* are in the distribution tarball
-EXTRA_DIST += regenerate/getaddrinfo-cygwin.patch regenerate/no-error.patch regenerate/regenerate
+EXTRA_DIST += regenerate/getaddrinfo-cygwin.patch regenerate/no-error.patch regenerate/no-restrict.patch regenerate/regenerate
index aab44ad17d6183555072ca412dea319e406c71e9..009c668ad49f32dbdf746a5cb5f9563fd226ae30 100644 (file)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  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.
@@ -23,7 +23,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib --m4-base=config/gnulib --doc-base=doc --aux-dir=config --libtool --macro-prefix=gl base64 fsusage getaddrinfo lock mkdtemp physmem visibility
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=gnulib --m4-base=config/gnulib --doc-base=doc --aux-dir=config --libtool --macro-prefix=gl base64 fsusage full-read full-write getaddrinfo getopt lock mkdtemp physmem visibility
 
 
 
@@ -52,6 +52,7 @@ DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps =  \
        $(top_srcdir)/config/macro-archive/ac_define_dir.m4 \
+       $(top_srcdir)/config/macro-archive/ac_perl_module_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_perl_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_swig.m4 \
        $(top_srcdir)/config/macro-archive/ax_compare_version.m4 \
@@ -85,6 +86,7 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/amanda/libs.m4 \
        $(top_srcdir)/config/amanda/net.m4 \
        $(top_srcdir)/config/amanda/progs.m4 \
+       $(top_srcdir)/config/amanda/ps.m4 \
        $(top_srcdir)/config/amanda/readdir.m4 \
        $(top_srcdir)/config/amanda/readline.m4 \
        $(top_srcdir)/config/amanda/rsh-security.m4 \
@@ -107,7 +109,9 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/float_h.m4 \
        $(top_srcdir)/config/gnulib/fsusage.m4 \
        $(top_srcdir)/config/gnulib/getaddrinfo.m4 \
+       $(top_srcdir)/config/gnulib/getopt.m4 \
        $(top_srcdir)/config/gnulib/gettimeofday.m4 \
+       $(top_srcdir)/config/gnulib/gnulib-common.m4 \
        $(top_srcdir)/config/gnulib/gnulib-comp.m4 \
        $(top_srcdir)/config/gnulib/include_next.m4 \
        $(top_srcdir)/config/gnulib/inet_ntop.m4 \
@@ -135,7 +139,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/sys_stat_h.m4 \
        $(top_srcdir)/config/gnulib/sys_time_h.m4 \
        $(top_srcdir)/config/gnulib/tempname.m4 \
-       $(top_srcdir)/config/gnulib/ulonglong.m4 \
        $(top_srcdir)/config/gnulib/unistd_h.m4 \
        $(top_srcdir)/config/gnulib/vasnprintf.m4 \
        $(top_srcdir)/config/gnulib/visibility.m4 \
@@ -146,7 +149,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gettext-macros/lib-ld.m4 \
        $(top_srcdir)/config/gettext-macros/lib-link.m4 \
        $(top_srcdir)/config/gettext-macros/lib-prefix.m4 \
-       $(top_srcdir)/config/gettext-macros/longlong.m4 \
        $(top_srcdir)/config/gettext-macros/nls.m4 \
        $(top_srcdir)/config/gettext-macros/po.m4 \
        $(top_srcdir)/config/gettext-macros/progtest.m4 \
@@ -169,7 +171,7 @@ libgnu_la_OBJECTS = $(am_libgnu_la_OBJECTS)
 libgnu_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
        $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
        $(libgnu_la_LDFLAGS) $(LDFLAGS) -o $@
-DEFAULT_INCLUDES = -I. -I$(top_builddir)/config@am__isrc@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/config
 depcomp = $(SHELL) $(top_srcdir)/config/depcomp
 am__depfiles_maybe = depfiles
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
@@ -188,6 +190,7 @@ ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
+AIX_BACKUP = @AIX_BACKUP@
 ALLOCA = @ALLOCA@
 ALLOCA_H = @ALLOCA_H@
 AMANDA_DBGDIR = @AMANDA_DBGDIR@
@@ -202,8 +205,10 @@ AMPLOT_CAT_GZIP = @AMPLOT_CAT_GZIP@
 AMPLOT_CAT_PACK = @AMPLOT_CAT_PACK@
 AMPLOT_COMPRESS = @AMPLOT_COMPRESS@
 AMTAR = @AMTAR@
+APPLICATION_DIR = @APPLICATION_DIR@
 AR = @AR@
 ARPA_INET_H = @ARPA_INET_H@
+ASSERTIONS = @ASSERTIONS@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -215,16 +220,28 @@ BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@
 BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@
 BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@
 BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@
+BSDTCP_SECURITY = @BSDTCP_SECURITY@
+BSDUDP_SECURITY = @BSDUDP_SECURITY@
+BSD_SECURITY = @BSD_SECURITY@
 CAT = @CAT@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
+CHECK_USERID = @CHECK_USERID@
 CHIO = @CHIO@
 CHS = @CHS@
+CLIENT_HOST_INSTANCE = @CLIENT_HOST_INSTANCE@
+CLIENT_HOST_KEY_FILE = @CLIENT_HOST_KEY_FILE@
+CLIENT_HOST_PRINCIPAL = @CLIENT_HOST_PRINCIPAL@
 CLIENT_LOGIN = @CLIENT_LOGIN@
 CLIENT_SCRIPTS_OPT = @CLIENT_SCRIPTS_OPT@
 COMPRESS = @COMPRESS@
+COMPRESS_BEST_OPT = @COMPRESS_BEST_OPT@
+COMPRESS_FAST_OPT = @COMPRESS_FAST_OPT@
+COMPRESS_PATH = @COMPRESS_PATH@
+COMPRESS_SUFFIX = @COMPRESS_SUFFIX@
+CONFIG_CLOBBER_MY_CONFIG = @CONFIG_CLOBBER_MY_CONFIG@
 CONFIG_DIR = @CONFIG_DIR@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
@@ -238,6 +255,7 @@ DD = @DD@
 DEFAULT_AMANDATES_FILE = @DEFAULT_AMANDATES_FILE@
 DEFAULT_CHANGER_DEVICE = @DEFAULT_CHANGER_DEVICE@
 DEFAULT_CONFIG = @DEFAULT_CONFIG@
+DEFAULT_MAILER = @DEFAULT_MAILER@
 DEFAULT_SERVER = @DEFAULT_SERVER@
 DEFAULT_TAPE_DEVICE = @DEFAULT_TAPE_DEVICE@
 DEFAULT_TAPE_SERVER = @DEFAULT_TAPE_SERVER@
@@ -245,7 +263,7 @@ DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DOC_BUILD_DATE = @DOC_BUILD_DATE@
 DUMP = @DUMP@
-DUMPER_DIR = @DUMPER_DIR@
+DUMP_RETURNS_1 = @DUMP_RETURNS_1@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -258,6 +276,7 @@ F77 = @F77@
 FFLAGS = @FFLAGS@
 FLOAT_H = @FLOAT_H@
 GETCONF = @GETCONF@
+GETOPT_H = @GETOPT_H@
 GETTEXT = @GETTEXT@
 GLIB_CFLAGS = @GLIB_CFLAGS@
 GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
@@ -268,9 +287,12 @@ GMSGFMT_015 = @GMSGFMT_015@
 GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
 GNULIB_CHOWN = @GNULIB_CHOWN@
 GNULIB_DUP2 = @GNULIB_DUP2@
+GNULIB_ENVIRON = @GNULIB_ENVIRON@
 GNULIB_FCHDIR = @GNULIB_FCHDIR@
 GNULIB_FFLUSH = @GNULIB_FFLUSH@
+GNULIB_FOPEN = @GNULIB_FOPEN@
 GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
+GNULIB_FREOPEN = @GNULIB_FREOPEN@
 GNULIB_FSEEK = @GNULIB_FSEEK@
 GNULIB_FSEEKO = @GNULIB_FSEEKO@
 GNULIB_FTELL = @GNULIB_FTELL@
@@ -280,6 +302,7 @@ GNULIB_GETCWD = @GNULIB_GETCWD@
 GNULIB_GETDELIM = @GNULIB_GETDELIM@
 GNULIB_GETLINE = @GNULIB_GETLINE@
 GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
+GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@
 GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
 GNULIB_LCHOWN = @GNULIB_LCHOWN@
 GNULIB_LSEEK = @GNULIB_LSEEK@
@@ -304,8 +327,10 @@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
 GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
 GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
 GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
+GNULIB_PUTENV = @GNULIB_PUTENV@
 GNULIB_READLINK = @GNULIB_READLINK@
 GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@
+GNULIB_SETENV = @GNULIB_SETENV@
 GNULIB_SLEEP = @GNULIB_SLEEP@
 GNULIB_SNPRINTF = @GNULIB_SNPRINTF@
 GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@
@@ -314,11 +339,15 @@ GNULIB_STPNCPY = @GNULIB_STPNCPY@
 GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
 GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
 GNULIB_STRDUP = @GNULIB_STRDUP@
+GNULIB_STRERROR = @GNULIB_STRERROR@
 GNULIB_STRNDUP = @GNULIB_STRNDUP@
 GNULIB_STRNLEN = @GNULIB_STRNLEN@
 GNULIB_STRPBRK = @GNULIB_STRPBRK@
 GNULIB_STRSEP = @GNULIB_STRSEP@
+GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@
+GNULIB_STRSTR = @GNULIB_STRSTR@
 GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
+GNULIB_UNSETENV = @GNULIB_UNSETENV@
 GNULIB_VASPRINTF = @GNULIB_VASPRINTF@
 GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@
 GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
@@ -332,6 +361,7 @@ GOBJECT_QUERY = @GOBJECT_QUERY@
 GREP = @GREP@
 GZIP = @GZIP@
 HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@
+HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@
 HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@
 HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@
 HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
@@ -340,9 +370,10 @@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
 HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@
 HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
 HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
-HAVE_DECL_STRNCASECMP = @HAVE_DECL_STRNCASECMP@
+HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@
 HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
 HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
+HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@
 HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
 HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
 HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
@@ -350,7 +381,9 @@ HAVE_DUP2 = @HAVE_DUP2@
 HAVE_FSEEKO = @HAVE_FSEEKO@
 HAVE_FTELLO = @HAVE_FTELLO@
 HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
+HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
 HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
+HAVE_GZIP = @HAVE_GZIP@
 HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
 HAVE_IO_H = @HAVE_IO_H@
 HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
@@ -359,8 +392,10 @@ HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@
 HAVE_MEMPCPY = @HAVE_MEMPCPY@
 HAVE_MKDTEMP = @HAVE_MKDTEMP@
 HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@
+HAVE_OS_H = @HAVE_OS_H@
 HAVE_READLINK = @HAVE_READLINK@
 HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@
+HAVE_SETENV = @HAVE_SETENV@
 HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
 HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
 HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
@@ -368,7 +403,6 @@ HAVE_SLEEP = @HAVE_SLEEP@
 HAVE_STDINT_H = @HAVE_STDINT_H@
 HAVE_STPCPY = @HAVE_STPCPY@
 HAVE_STPNCPY = @HAVE_STPNCPY@
-HAVE_STRCASECMP = @HAVE_STRCASECMP@
 HAVE_STRCASESTR = @HAVE_STRCASESTR@
 HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
 HAVE_STRNDUP = @HAVE_STRNDUP@
@@ -377,10 +411,12 @@ HAVE_STRSEP = @HAVE_STRSEP@
 HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@
 HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
 HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
+HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
 HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
 HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
 HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
 HAVE_UNISTD_H = @HAVE_UNISTD_H@
+HAVE_UNSETENV = @HAVE_UNSETENV@
 HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
 HAVE_VASPRINTF = @HAVE_VASPRINTF@
 HAVE_VISIBILITY = @HAVE_VISIBILITY@
@@ -396,6 +432,8 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 INTLLIBS = @INTLLIBS@
 INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+KRB4_SECURITY = @KRB4_SECURITY@
+KRB5_SECURITY = @KRB5_SECURITY@
 LDFLAGS = @LDFLAGS@
 LEX = @LEX@
 LEXLIB = @LEXLIB@
@@ -412,6 +450,8 @@ LIBTHREAD = @LIBTHREAD@
 LIBTOOL = @LIBTOOL@
 LIBTOOL_DEPS = @LIBTOOL_DEPS@
 LN_S = @LN_S@
+LOCKING = @LOCKING@
+LOW_TCPPORTRANGE = @LOW_TCPPORTRANGE@
 LTLIBICONV = @LTLIBICONV@
 LTLIBINTL = @LTLIBINTL@
 LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
@@ -420,7 +460,6 @@ LTLIBPTH = @LTLIBPTH@
 LTLIBTHREAD = @LTLIBTHREAD@
 MAILER = @MAILER@
 MAKEINFO = @MAKEINFO@
-MAXTAPEBLOCKSIZE = @MAXTAPEBLOCKSIZE@
 MCUTIL = @MCUTIL@
 MKDIR_P = @MKDIR_P@
 MSGFMT = @MSGFMT@
@@ -456,26 +495,37 @@ PERL_INC = @PERL_INC@
 PKG_CONFIG = @PKG_CONFIG@
 POSUB = @POSUB@
 PRINT = @PRINT@
+PS = @PS@
+PS_ARGUMENT = @PS_ARGUMENT@
 PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
 RANLIB = @RANLIB@
 READLINE_LIBS = @READLINE_LIBS@
 REPLACE_CHOWN = @REPLACE_CHOWN@
 REPLACE_FCHDIR = @REPLACE_FCHDIR@
 REPLACE_FFLUSH = @REPLACE_FFLUSH@
+REPLACE_FOPEN = @REPLACE_FOPEN@
 REPLACE_FPRINTF = @REPLACE_FPRINTF@
+REPLACE_FREOPEN = @REPLACE_FREOPEN@
 REPLACE_FSEEK = @REPLACE_FSEEK@
 REPLACE_FSEEKO = @REPLACE_FSEEKO@
 REPLACE_FTELL = @REPLACE_FTELL@
 REPLACE_FTELLO = @REPLACE_FTELLO@
 REPLACE_GETCWD = @REPLACE_GETCWD@
 REPLACE_GETLINE = @REPLACE_GETLINE@
+REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
 REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
 REPLACE_LCHOWN = @REPLACE_LCHOWN@
 REPLACE_LSEEK = @REPLACE_LSEEK@
+REPLACE_MEMMEM = @REPLACE_MEMMEM@
 REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
 REPLACE_PRINTF = @REPLACE_PRINTF@
+REPLACE_PUTENV = @REPLACE_PUTENV@
 REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
 REPLACE_SPRINTF = @REPLACE_SPRINTF@
+REPLACE_STRCASESTR = @REPLACE_STRCASESTR@
+REPLACE_STRERROR = @REPLACE_STRERROR@
+REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@
+REPLACE_STRSTR = @REPLACE_STRSTR@
 REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
 REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
 REPLACE_VPRINTF = @REPLACE_VPRINTF@
@@ -483,7 +533,11 @@ REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
 REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
 REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
 RESTORE = @RESTORE@
+RSH_SECURITY = @RSH_SECURITY@
 SAMBA_CLIENT = @SAMBA_CLIENT@
+SERVER_HOST_INSTANCE = @SERVER_HOST_INSTANCE@
+SERVER_HOST_KEY_FILE = @SERVER_HOST_KEY_FILE@
+SERVER_HOST_PRINCIPAL = @SERVER_HOST_PRINCIPAL@
 SERVICE_SUFFIX = @SERVICE_SUFFIX@
 SETUID_GROUP = @SETUID_GROUP@
 SET_MAKE = @SET_MAKE@
@@ -493,6 +547,7 @@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
 SNAPSHOT_STAMP = @SNAPSHOT_STAMP@
 SORT = @SORT@
 SSH = @SSH@
+SSH_SECURITY = @SSH_SECURITY@
 STDBOOL_H = @STDBOOL_H@
 STDINT_H = @STDINT_H@
 STRIP = @STRIP@
@@ -502,7 +557,14 @@ SWIG_LIB = @SWIG_LIB@
 SYS_SOCKET_H = @SYS_SOCKET_H@
 SYS_STAT_H = @SYS_STAT_H@
 SYS_TIME_H = @SYS_TIME_H@
+TCPPORTRANGE = @TCPPORTRANGE@
+TICKET_LIFETIME = @TICKET_LIFETIME@
+UDPPORTRANGE = @UDPPORTRANGE@
+UNCOMPRESS_OPT = @UNCOMPRESS_OPT@
+UNCOMPRESS_PATH = @UNCOMPRESS_PATH@
+USE_AMANDAHOSTS = @USE_AMANDAHOSTS@
 USE_NLS = @USE_NLS@
+USE_RUNDUMP = @USE_RUNDUMP@
 USE_VERSION_SUFFIXES = @USE_VERSION_SUFFIXES@
 VDUMP = @VDUMP@
 VERSION = @VERSION@
@@ -511,6 +573,7 @@ VERSION_MAJOR = @VERSION_MAJOR@
 VERSION_MINOR = @VERSION_MINOR@
 VERSION_PATCH = @VERSION_PATCH@
 VERSION_SUFFIX = @VERSION_SUFFIX@
+VOID_UNSETENV = @VOID_UNSETENV@
 VRESTORE = @VRESTORE@
 VXDUMP = @VXDUMP@
 VXRESTORE = @VXRESTORE@
@@ -539,6 +602,7 @@ am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+amdatadir = @amdatadir@
 amincludedir = @amincludedir@
 amlibdir = @amlibdir@
 amlibexecdir = @amlibexecdir@
@@ -557,6 +621,8 @@ dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 gl_LIBOBJS = @gl_LIBOBJS@
 gl_LTLIBOBJS = @gl_LTLIBOBJS@
+gltests_LIBOBJS = @gltests_LIBOBJS@
+gltests_LTLIBOBJS = @gltests_LTLIBOBJS@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
@@ -586,6 +652,7 @@ target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 AUTOMAKE_OPTIONS = 1.5 gnits
@@ -594,30 +661,31 @@ noinst_LIBRARIES =
 noinst_LTLIBRARIES = libgnu.la
 
 # Make sure regenerate/* are in the distribution tarball
-EXTRA_DIST = alloca_.h float_.h fsusage.c fsusage.h gai_strerror.c \
-       getaddrinfo.c getaddrinfo.h gettimeofday.c \
-       $(top_srcdir)/config/config.rpath inet_ntop.c inet_ntop.h \
-       $(top_srcdir)/config/link-warning.h \
+EXTRA_DIST = alloca.in.h float.in.h fsusage.c fsusage.h gai_strerror.c \
+       getaddrinfo.c getaddrinfo.h getopt.c getopt.in.h getopt1.c \
+       getopt_int.h gettimeofday.c $(top_srcdir)/config/config.rpath \
+       inet_ntop.c inet_ntop.h $(top_srcdir)/config/link-warning.h \
        $(top_srcdir)/config/config.rpath malloc.c mkdtemp.c \
-       netinet_in_.h physmem.c physmem.h safe-read.c safe-read.h \
-       safe-write.c safe-write.h snprintf.c stdbool_.h stdint_.h \
-       stdio_.h stdlib_.h strdup.c string_.h sys_socket_.h \
-       sys_stat_.h sys_time_.h tempname.c tempname.h unistd_.h \
+       netinet_in.in.h physmem.c physmem.h safe-read.c safe-read.h \
+       safe-write.c safe-write.h snprintf.c stdbool.in.h stdint.in.h \
+       stdio.in.h stdlib.in.h strdup.c string.in.h sys_socket.in.h \
+       sys_stat.in.h sys_time.in.h tempname.c tempname.h unistd.in.h \
        asnprintf.c float+.h printf-args.c printf-args.h \
        printf-parse.c printf-parse.h vasnprintf.c vasnprintf.h \
-       wchar_.h regenerate/getaddrinfo-cygwin.patch \
-       regenerate/no-error.patch regenerate/regenerate
-BUILT_SOURCES = $(ALLOCA_H) $(ARPA_INET_H) $(FLOAT_H) $(NETINET_IN_H) \
-       $(STDBOOL_H) $(STDINT_H) stdio.h stdlib.h string.h \
-       $(SYS_SOCKET_H) $(SYS_STAT_H) $(SYS_TIME_H) unistd.h \
+       wchar.in.h regenerate/getaddrinfo-cygwin.patch \
+       regenerate/no-error.patch regenerate/no-restrict.patch \
+       regenerate/regenerate
+BUILT_SOURCES = $(ALLOCA_H) $(ARPA_INET_H) $(FLOAT_H) $(GETOPT_H) \
+       $(NETINET_IN_H) $(STDBOOL_H) $(STDINT_H) stdio.h stdlib.h \
+       string.h $(SYS_SOCKET_H) $(SYS_STAT_H) $(SYS_TIME_H) unistd.h \
        $(WCHAR_H)
 SUFFIXES = 
 MOSTLYCLEANFILES = core *.stackdump alloca.h alloca.h-t arpa/inet.h \
-       arpa/inet.h-t float.h float.h-t netinet/in.h netinet/in.h-t \
-       stdbool.h stdbool.h-t stdint.h stdint.h-t stdio.h stdio.h-t \
-       stdlib.h stdlib.h-t string.h string.h-t sys/socket.h \
-       sys/socket.h-t sys/stat.h sys/stat.h-t sys/time.h sys/time.h-t \
-       unistd.h unistd.h-t wchar.h wchar.h-t
+       arpa/inet.h-t float.h float.h-t getopt.h getopt.h-t \
+       netinet/in.h netinet/in.h-t stdbool.h stdbool.h-t stdint.h \
+       stdint.h-t stdio.h stdio.h-t stdlib.h stdlib.h-t string.h \
+       string.h-t sys/socket.h sys/socket.h-t sys/stat.h sys/stat.h-t \
+       sys/time.h sys/time.h-t unistd.h unistd.h-t wchar.h wchar.h-t
 MOSTLYCLEANDIRS = arpa netinet sys sys
 CLEANFILES = 
 DISTCLEANFILES = 
@@ -630,9 +698,10 @@ libgnu_la_SOURCES = base64.h base64.c full-read.h full-read.c \
 libgnu_la_LIBADD = $(gl_LTLIBOBJS)
 libgnu_la_DEPENDENCIES = $(gl_LTLIBOBJS)
 EXTRA_libgnu_la_SOURCES = fsusage.c gai_strerror.c getaddrinfo.c \
-       gettimeofday.c inet_ntop.c malloc.c mkdtemp.c physmem.c \
-       safe-read.c safe-write.c snprintf.c strdup.c tempname.c \
-       asnprintf.c printf-args.c printf-parse.c vasnprintf.c
+       getopt.c getopt1.c gettimeofday.c inet_ntop.c malloc.c \
+       mkdtemp.c physmem.c safe-read.c safe-write.c snprintf.c \
+       strdup.c tempname.c asnprintf.c printf-args.c printf-parse.c \
+       vasnprintf.c
 libgnu_la_LDFLAGS = $(AM_LDFLAGS)
 
 # Use this preprocessor expression to decide whether #include_next works.
@@ -702,6 +771,8 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/full-write.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gai_strerror.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getaddrinfo.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gettimeofday.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inet_ntop.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lock.Plo@am__quote@
@@ -749,8 +820,8 @@ ID: $(HEADERS) $(SOURCES) $(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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
        mkid -fID $$unique
 tags: TAGS
 
@@ -762,8 +833,8 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
        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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { 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) \
@@ -773,13 +844,12 @@ ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
                $(TAGS_FILES) $(LISP)
        tags=; \
-       here=`pwd`; \
        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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
        test -z "$(CTAGS_ARGS)$$tags$$unique" \
          || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
             $$tags $$unique
@@ -931,9 +1001,9 @@ uninstall-am:
 
 # We need the following in order to create <alloca.h> when the system
 # doesn't have one that works with the given compiler.
-alloca.h: alloca_.h
+alloca.h: alloca.in.h
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         cat $(srcdir)/alloca_.h; \
+         cat $(srcdir)/alloca.in.h; \
        } > $@-t
        mv -f $@-t $@
 
@@ -949,40 +1019,48 @@ arpa/inet.h:
 
 # We need the following in order to create <float.h> when the system
 # doesn't have one that works with the given compiler.
-float.h: float_.h
+float.h: float.in.h
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
              -e 's|@''NEXT_FLOAT_H''@|$(NEXT_FLOAT_H)|g' \
-             < $(srcdir)/float_.h; \
+             < $(srcdir)/float.in.h; \
        } > $@-t
        mv $@-t $@
 
+# We need the following in order to create <getopt.h> when the system
+# doesn't have one that works with the given compiler.
+getopt.h: getopt.in.h
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         cat $(srcdir)/getopt.in.h; \
+       } > $@-t
+       mv -f $@-t $@
+
 # We need the following in order to create <netinet/in.h> when the system
 # doesn't have one.
-netinet/in.h:
+netinet/in.h: netinet_in.in.h
        @MKDIR_P@ netinet
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
              -e 's|@''NEXT_NETINET_IN_H''@|$(NEXT_NETINET_IN_H)|g' \
              -e 's|@''HAVE_NETINET_IN_H''@|$(HAVE_NETINET_IN_H)|g' \
-             < $(srcdir)/netinet_in_.h; \
+             < $(srcdir)/netinet_in.in.h; \
        } > $@-t
        mv $@-t $@
 
 # We need the following in order to create <stdbool.h> when the system
 # doesn't have one that works.
-stdbool.h: stdbool_.h
+stdbool.h: stdbool.in.h
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool_.h; \
+         sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \
        } > $@-t
        mv $@-t $@
 
 # We need the following in order to create <stdint.h> when the system
 # doesn't have one that works with the given compiler.
-stdint.h: stdint_.h
+stdint.h: stdint.in.h
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
@@ -1007,13 +1085,13 @@ stdint.h: stdint_.h
              -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \
              -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \
              -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \
-             < $(srcdir)/stdint_.h; \
+             < $(srcdir)/stdint.in.h; \
        } > $@-t
        mv $@-t $@
 
 # We need the following in order to create <stdio.h> when the system
 # doesn't have one that works with the given compiler.
-stdio.h: stdio_.h
+stdio.h: stdio.in.h
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
@@ -1027,6 +1105,8 @@ stdio.h: stdio_.h
              -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \
              -e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \
              -e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \
+             -e 's|@''GNULIB_FOPEN''@|$(GNULIB_FOPEN)|g' \
+             -e 's|@''GNULIB_FREOPEN''@|$(GNULIB_FREOPEN)|g' \
              -e 's|@''GNULIB_FSEEK''@|$(GNULIB_FSEEK)|g' \
              -e 's|@''GNULIB_FSEEKO''@|$(GNULIB_FSEEKO)|g' \
              -e 's|@''GNULIB_FTELL''@|$(GNULIB_FTELL)|g' \
@@ -1046,6 +1126,8 @@ stdio.h: stdio_.h
              -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \
              -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \
              -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \
+             -e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \
+             -e 's|@''REPLACE_FREOPEN''@|$(REPLACE_FREOPEN)|g' \
              -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \
              -e 's|@''REPLACE_FSEEK''@|$(REPLACE_FSEEK)|g' \
              -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \
@@ -1055,13 +1137,13 @@ stdio.h: stdio_.h
              -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \
              -e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
-             < $(srcdir)/stdio_.h; \
+             < $(srcdir)/stdio.in.h; \
        } > $@-t
        mv $@-t $@
 
 # We need the following in order to create <stdlib.h> when the system
 # doesn't have one that works with the given compiler.
-stdlib.h: stdlib_.h
+stdlib.h: stdlib.in.h
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
@@ -1072,20 +1154,27 @@ stdlib.h: stdlib_.h
              -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \
              -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \
              -e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \
+             -e 's|@''GNULIB_PUTENV''@|$(GNULIB_PUTENV)|g' \
+             -e 's|@''GNULIB_SETENV''@|$(GNULIB_SETENV)|g' \
+             -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \
              -e 's|@''HAVE_CALLOC_POSIX''@|$(HAVE_CALLOC_POSIX)|g' \
              -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \
              -e 's|@''HAVE_MALLOC_POSIX''@|$(HAVE_MALLOC_POSIX)|g' \
              -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
              -e 's|@''HAVE_REALLOC_POSIX''@|$(HAVE_REALLOC_POSIX)|g' \
+             -e 's|@''HAVE_SETENV''@|$(HAVE_SETENV)|g' \
+             -e 's|@''HAVE_UNSETENV''@|$(HAVE_UNSETENV)|g' \
              -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
+             -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
+             -e 's|@''VOID_UNSETENV''@|$(VOID_UNSETENV)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
-             < $(srcdir)/stdlib_.h; \
+             < $(srcdir)/stdlib.in.h; \
        } > $@-t
        mv $@-t $@
 
 # We need the following in order to create <string.h> when the system
 # doesn't have one that works with the given compiler.
-string.h: string_.h
+string.h: string.in.h
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
          sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
@@ -1115,15 +1204,16 @@ string.h: string_.h
              -e 's|@''GNULIB_STRNLEN''@|$(GNULIB_STRNLEN)|g' \
              -e 's|@''GNULIB_STRPBRK''@|$(GNULIB_STRPBRK)|g' \
              -e 's|@''GNULIB_STRSEP''@|$(GNULIB_STRSEP)|g' \
+             -e 's|@''GNULIB_STRSTR''@|$(GNULIB_STRSTR)|g' \
              -e 's|@''GNULIB_STRCASESTR''@|$(GNULIB_STRCASESTR)|g' \
              -e 's|@''GNULIB_STRTOK_R''@|$(GNULIB_STRTOK_R)|g' \
+             -e 's|@''GNULIB_STRERROR''@|$(GNULIB_STRERROR)|g' \
+             -e 's|@''GNULIB_STRSIGNAL''@|$(GNULIB_STRSIGNAL)|g' \
              -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
              -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
              -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
              -e 's|@''HAVE_STPCPY''@|$(HAVE_STPCPY)|g' \
              -e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \
-             -e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \
-             -e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \
              -e 's|@''HAVE_STRCHRNUL''@|$(HAVE_STRCHRNUL)|g' \
              -e 's|@''HAVE_DECL_STRDUP''@|$(HAVE_DECL_STRDUP)|g' \
              -e 's|@''HAVE_STRNDUP''@|$(HAVE_STRNDUP)|g' \
@@ -1133,14 +1223,21 @@ string.h: string_.h
              -e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \
              -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \
              -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \
+             -e 's|@''HAVE_DECL_STRERROR''@|$(HAVE_DECL_STRERROR)|g' \
+             -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \
+             -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \
+             -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \
+             -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \
+             -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \
+             -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
-             < $(srcdir)/string_.h; \
+             < $(srcdir)/string.in.h; \
        } > $@-t
        mv $@-t $@
 
 # We need the following in order to create <sys/socket.h> when the system
 # doesn't have one that works with the given compiler.
-sys/socket.h: sys_socket_.h
+sys/socket.h: sys_socket.in.h
        @MKDIR_P@ sys
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
@@ -1148,13 +1245,13 @@ sys/socket.h: sys_socket_.h
              -e 's|@''HAVE_SYS_SOCKET_H''@|$(HAVE_SYS_SOCKET_H)|g' \
              -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
              -e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \
-             < $(srcdir)/sys_socket_.h; \
+             < $(srcdir)/sys_socket.in.h; \
        } > $@-t
        mv -f $@-t $@
 
 # We need the following in order to create <sys/stat.h> when the system
 # has one that is incomplete.
-sys/stat.h: sys_stat_.h
+sys/stat.h: sys_stat.in.h
        @MKDIR_P@ sys
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -1163,13 +1260,13 @@ sys/stat.h: sys_stat_.h
              -e 's|@''HAVE_IO_H''@|$(HAVE_IO_H)|g' \
              -e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \
              -e 's|@''HAVE_DECL_MKDIR''@|$(HAVE_DECL_MKDIR)|g' \
-             < $(srcdir)/sys_stat_.h; \
+             < $(srcdir)/sys_stat.in.h; \
        } > $@-t
        mv $@-t $@
 
 # We need the following in order to create <sys/time.h> when the system
 # doesn't have one that works with the given compiler.
-sys/time.h: sys_time_.h
+sys/time.h: sys_time.in.h
        @MKDIR_P@ sys
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -1178,13 +1275,13 @@ sys/time.h: sys_time_.h
              -e 's|@''NEXT_SYS_TIME_H''@|$(NEXT_SYS_TIME_H)|g' \
              -e 's/@''REPLACE_GETTIMEOFDAY''@/$(REPLACE_GETTIMEOFDAY)/g' \
              -e 's/@''HAVE_STRUCT_TIMEVAL''@/$(HAVE_STRUCT_TIMEVAL)/g' \
-             < $(srcdir)/sys_time_.h; \
+             < $(srcdir)/sys_time.in.h; \
        } > $@-t
        mv $@-t $@
 
 # We need the following in order to create an empty placeholder for
 # <unistd.h> when the system doesn't have one.
-unistd.h: unistd_.h
+unistd.h: unistd.in.h
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \
@@ -1192,31 +1289,38 @@ unistd.h: unistd_.h
              -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \
              -e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \
              -e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \
+             -e 's|@''GNULIB_ENVIRON''@|$(GNULIB_ENVIRON)|g' \
              -e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \
              -e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \
              -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \
              -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \
+             -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \
              -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \
              -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \
              -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \
              -e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \
              -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \
              -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \
+             -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \
              -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \
              -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \
+             -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \
              -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \
+             -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \
+             -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \
              -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \
              -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
              -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
+             -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
              -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \
              -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \
-             < $(srcdir)/unistd_.h; \
+             < $(srcdir)/unistd.in.h; \
        } > $@-t
        mv $@-t $@
 
 # We need the following in order to create <wchar.h> when the system
 # version does not work standalone.
-wchar.h: wchar_.h
+wchar.h: wchar.in.h
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's/@''INCLUDE_NEXT''@/$(INCLUDE_NEXT)/g' \
@@ -1226,7 +1330,7 @@ wchar.h: wchar_.h
              -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \
              -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
              -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \
-           < $(srcdir)/wchar_.h; \
+           < $(srcdir)/wchar.in.h; \
        } > $@-t
        mv $@-t $@
 
diff --git a/gnulib/alloca.in.h b/gnulib/alloca.in.h
new file mode 100644 (file)
index 0000000..6269607
--- /dev/null
@@ -0,0 +1,56 @@
+/* Memory allocation on the stack.
+
+   Copyright (C) 1995, 1999, 2001-2004, 2006-2008 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 3, 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.  */
+
+/* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H
+   means there is a real alloca function.  */
+#ifndef _GL_ALLOCA_H
+#define _GL_ALLOCA_H
+
+/* alloca (N) returns a pointer to N bytes of memory
+   allocated on the stack, which will last until the function returns.
+   Use of alloca should be avoided:
+     - inside arguments of function calls - undefined behaviour,
+     - in inline functions - the allocation may actually last until the
+       calling function returns,
+     - for huge N (say, N >= 65536) - you never know how large (or small)
+       the stack is, and when the stack cannot fulfill the memory allocation
+       request, the program just crashes.
+ */
+
+#ifndef alloca
+# ifdef __GNUC__
+#  define alloca __builtin_alloca
+# elif defined _AIX
+#  define alloca __alloca
+# elif defined _MSC_VER
+#  include <malloc.h>
+#  define alloca _alloca
+# elif defined __DECC && defined __VMS
+#  define alloca __ALLOCA
+# else
+#  include <stddef.h>
+#  ifdef  __cplusplus
+extern "C"
+#  endif
+void *alloca (size_t);
+# endif
+#endif
+
+#endif /* _GL_ALLOCA_H */
diff --git a/gnulib/alloca_.h b/gnulib/alloca_.h
deleted file mode 100644 (file)
index af274b9..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Memory allocation on the stack.
-
-   Copyright (C) 1995, 1999, 2001-2004, 2006-2007 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.  */
-
-/* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H
-   means there is a real alloca function.  */
-#ifndef _GL_ALLOCA_H
-#define _GL_ALLOCA_H
-
-/* alloca (N) returns a pointer to N bytes of memory
-   allocated on the stack, which will last until the function returns.
-   Use of alloca should be avoided:
-     - inside arguments of function calls - undefined behaviour,
-     - in inline functions - the allocation may actually last until the
-       calling function returns,
-     - for huge N (say, N >= 65536) - you never know how large (or small)
-       the stack is, and when the stack cannot fulfill the memory allocation
-       request, the program just crashes.
- */
-
-#ifndef alloca
-# ifdef __GNUC__
-#  define alloca __builtin_alloca
-# elif defined _AIX
-#  define alloca __alloca
-# elif defined _MSC_VER
-#  include <malloc.h>
-#  define alloca _alloca
-# else
-#  include <stddef.h>
-#  ifdef  __cplusplus
-extern "C"
-#  endif
-void *alloca (size_t);
-# endif
-#endif
-
-#endif /* _GL_ALLOCA_H */
index 26c3988b01eff997d89c2813db1a3a91f5c886c0..bf2abf3c9d1e09ea9e721a97a24bab66ab51a282 100644 (file)
@@ -3,7 +3,7 @@
 
    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)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    This program is distributed in the hope that it will be useful,
index f237cd63b4f6c7d77cccf2e1cb4eb28b82510fbd..188b36ac73d1fc4505634584f650a26f7b4e6d98 100644 (file)
@@ -4,7 +4,7 @@
 
    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)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    This program is distributed in the hope that it will be useful,
@@ -64,8 +64,8 @@ to_uchar (char ch)
    possible.  If OUTLEN is larger than BASE64_LENGTH(INLEN), also zero
    terminate the output buffer. */
 void
-base64_encode (const char *restrict in, size_t inlen,
-              char *restrict out, size_t outlen)
+base64_encode (const char *in, size_t inlen,
+              char *out, size_t outlen)
 {
   static const char b64str[64] =
     "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
@@ -310,8 +310,8 @@ isbase64 (char ch)
    that, when applicable, you must remove any line terminators that is
    part of the data stream before calling this function.  */
 bool
-base64_decode (const char *restrict in, size_t inlen,
-              char *restrict out, size_t *outlen)
+base64_decode (const char *in, size_t inlen,
+              char *out, size_t *outlen)
 {
   size_t outleft = *outlen;
 
index 6bb9a97f585c3ea80f73db252e4065d262396562..50f4712c6936c369cfd602ba191782375beb3814 100644 (file)
@@ -4,7 +4,7 @@
 
    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)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    This program is distributed in the hope that it will be useful,
 
 extern bool isbase64 (char ch);
 
-extern void base64_encode (const char *restrict in, size_t inlen,
-                          char *restrict out, size_t outlen);
+extern void base64_encode (const char *in, size_t inlen,
+                          char *out, size_t outlen);
 
 extern size_t base64_encode_alloc (const char *in, size_t inlen, char **out);
 
-extern bool base64_decode (const char *restrict in, size_t inlen,
-                          char *restrict out, size_t *outlen);
+extern bool base64_decode (const char *in, size_t inlen,
+                          char *out, size_t *outlen);
 
 extern bool base64_decode_alloc (const char *in, size_t inlen,
                                 char **out, size_t *outlen);
index 4de25a941eaced67fc0f5c340c4929fc46592aa8..240fe3658d42fd34f567a6bdee25eb936d439fad 100644 (file)
@@ -4,7 +4,7 @@
 
    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)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    This program is distributed in the hope that it will be useful,
diff --git a/gnulib/float.in.h b/gnulib/float.in.h
new file mode 100644 (file)
index 0000000..2504032
--- /dev/null
@@ -0,0 +1,58 @@
+/* A correct <float.h>.
+
+   Copyright (C) 2007 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 3 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, see <http://www.gnu.org/licenses/>.  */
+
+#ifndef _GL_FLOAT_H
+
+/* The include_next requires a split double-inclusion guard.  */
+#@INCLUDE_NEXT@ @NEXT_FLOAT_H@
+
+#ifndef _GL_FLOAT_H
+#define _GL_FLOAT_H
+
+/* 'long double' properties.  */
+#if defined __i386__ && (defined __BEOS__ || defined __OpenBSD__)
+/* Number of mantissa units, in base FLT_RADIX.  */
+# undef LDBL_MANT_DIG
+# define LDBL_MANT_DIG   64
+/* Number of decimal digits that is sufficient for representing a number.  */
+# undef LDBL_DIG
+# define LDBL_DIG        18
+/* x-1 where x is the smallest representable number > 1.  */
+# undef LDBL_EPSILON
+# define LDBL_EPSILON    1.0842021724855044340E-19L
+/* Minimum e such that FLT_RADIX^(e-1) is a normalized number.  */
+# undef LDBL_MIN_EXP
+# define LDBL_MIN_EXP    (-16381)
+/* Maximum e such that FLT_RADIX^(e-1) is a representable finite number.  */
+# undef LDBL_MAX_EXP
+# define LDBL_MAX_EXP    16384
+/* Minimum positive normalized number.  */
+# undef LDBL_MIN
+# define LDBL_MIN        3.3621031431120935063E-4932L
+/* Maximum representable finite number.  */
+# undef LDBL_MAX
+# define LDBL_MAX        1.1897314953572317650E+4932L
+/* Minimum e such that 10^e is in the range of normalized numbers.  */
+# undef LDBL_MIN_10_EXP
+# define LDBL_MIN_10_EXP (-4931)
+/* Maximum e such that 10^e is in the range of representable finite numbers.  */
+# undef LDBL_MAX_10_EXP
+# define LDBL_MAX_10_EXP 4932
+#endif
+
+#endif /* _GL_FLOAT_H */
+#endif /* _GL_FLOAT_H */
diff --git a/gnulib/float_.h b/gnulib/float_.h
deleted file mode 100644 (file)
index d61d630..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/* A correct <float.h>.
-
-   Copyright (C) 2007 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.  */
-
-#ifndef _GL_FLOAT_H
-
-/* The include_next requires a split double-inclusion guard.  */
-#@INCLUDE_NEXT@ @NEXT_FLOAT_H@
-
-#ifndef _GL_FLOAT_H
-#define _GL_FLOAT_H
-
-/* 'long double' properties.  */
-#if defined __i386__ && defined __BEOS__
-/* Number of mantissa units, in base FLT_RADIX.  */
-# undef LDBL_MANT_DIG
-# define LDBL_MANT_DIG   64
-/* Number of decimal digits that is sufficient for representing a number.  */
-# undef LDBL_DIG
-# define LDBL_DIG        18
-/* x-1 where x is the smallest representable number > 1.  */
-# undef LDBL_EPSILON
-# define LDBL_EPSILON    1.0842021724855044340E-19L
-/* Minimum e such that FLT_RADIX^(e-1) is a normalized number.  */
-# undef LDBL_MIN_EXP
-# define LDBL_MIN_EXP    (-16381)
-/* Maximum e such that FLT_RADIX^(e-1) is a representable finite number.  */
-# undef LDBL_MAX_EXP
-# define LDBL_MAX_EXP    16384
-/* Minimum positive normalized number.  */
-# undef LDBL_MIN
-# define LDBL_MIN        3.3621031431120935063E-4932L
-/* Maximum representable finite number.  */
-# undef LDBL_MAX
-# define LDBL_MAX        1.1897314953572317650E+4932L
-/* Minimum e such that 10^e is in the range of normalized numbers.  */
-# undef LDBL_MIN_10_EXP
-# define LDBL_MIN_10_EXP (-4931)
-/* Maximum e such that 10^e is in the range of representable finite numbers.  */
-# undef LDBL_MAX_10_EXP
-# define LDBL_MAX_10_EXP 4932
-#endif
-
-#endif /* _GL_FLOAT_H */
-#endif /* _GL_FLOAT_H */
index 337bf5315d97a2fa1c35b06c6f45300270c820f9..23d40ea1d1f62c1723b3e8e0ec3e97ebecc203e6 100644 (file)
@@ -3,10 +3,10 @@
    Copyright (C) 1991, 1992, 1996, 1998, 1999, 2002, 2003, 2004, 2005, 2006
    Free Software Foundation, Inc.
 
-   This program is free software; you can redistribute it and/or modify
+   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.
+   the Free Software Foundation; either version 3 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
@@ -14,8 +14,7 @@
    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.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 
index 7fa9f8d6acc5fc1ded836684c24f511ac7b4cd0c..b32abe1836a11886de26e8aefe237c6b27bae51a 100644 (file)
@@ -3,10 +3,10 @@
    Copyright (C) 1991, 1992, 1997, 2003, 2004, 2005, 2006 Free Software
    Foundation, Inc.
 
-   This program is free software; you can redistribute it and/or modify
+   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.
+   the Free Software Foundation; either version 3 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
@@ -14,8 +14,7 @@
    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.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* Space usage statistics for a file system.  Blocks are 512-byte. */
 
index 8c3472a40f34a1aaaeedefcd30d5b87dc32892ba..fb7212bbec811e51b1cdbbb32c6432091b32fac9 100644 (file)
@@ -1,10 +1,10 @@
 /* An interface to read that retries after partial reads and interrupts.
    Copyright (C) 2002, 2003 Free Software Foundation, Inc.
 
-   This program is free software; you can redistribute it and/or modify
+   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.
+   the Free Software Foundation; either version 3 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
@@ -12,8 +12,7 @@
    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.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #define FULL_READ
 #include "full-write.c"
index 05d83a762be0e2ffc8079824d33a8c7089fb9ba8..a341ee0060751052a6284e29836e20ed4ace4769 100644 (file)
@@ -2,10 +2,10 @@
 
    Copyright (C) 2002 Free Software Foundation, Inc.
 
-   This program is free software; you can redistribute it and/or modify
+   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.
+   the Free Software Foundation; either version 3 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
@@ -14,7 +14,7 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, read to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <stddef.h>
 
index cc168720eae94e1517a44d346a786cbb0a3e1c58..51f2d3819bf59909cb757d726160a08c1136c7d1 100644 (file)
@@ -3,10 +3,10 @@
    Copyright (C) 1993, 1994, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
    2004, 2005, 2006 Free Software Foundation, Inc.
 
-   This program is free software; you can redistribute it and/or modify
+   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.
+   the Free Software Foundation; either version 3 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
@@ -14,8 +14,7 @@
    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.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 
index d20d2fe4abdf757fde135740dcaf2ac16bfc85a3..9a8014644547aa39739fb63291148e1bbfa2c016 100644 (file)
@@ -2,10 +2,10 @@
 
    Copyright (C) 2002-2003 Free Software Foundation, Inc.
 
-   This program is free software; you can redistribute it and/or modify
+   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.
+   the Free Software Foundation; either version 3 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
@@ -13,8 +13,7 @@
    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.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <stddef.h>
 
index aa733d6cc397527d602b8368035f3453a8f4d018..9e4abbe6db935849b080636b863faec499ecc848 100644 (file)
@@ -4,7 +4,7 @@
 
    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)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    This program is distributed in the hope that it will be useful,
index 55462c43f9c3a2ff68b4fb667326810dcbc64957..b14f8096bd85463e5a34188af16fc31a9da0cd98 100644 (file)
@@ -5,7 +5,7 @@
 
    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)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    This program is distributed in the hope that it will be useful,
@@ -123,10 +123,10 @@ validate_family (int family)
 /* Translate name of a service location and/or a service name to set of
    socket addresses. */
 int
-getaddrinfo (const char *restrict nodename,
-            const char *restrict servname,
-            const struct addrinfo *restrict hints,
-            struct addrinfo **restrict res)
+getaddrinfo (const char *nodename,
+            const char *servname,
+            const struct addrinfo *hints,
+            struct addrinfo **res)
 {
   struct addrinfo *tmp;
   int port = 0;
@@ -332,14 +332,14 @@ freeaddrinfo (struct addrinfo *ai)
       cur = ai;
       ai = ai->ai_next;
 
-      if (cur->ai_canonname) free (cur->ai_canonname);
+      free (cur->ai_canonname);
       free (cur);
     }
 }
 
-int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen,
-               char *restrict node, socklen_t nodelen,
-               char *restrict service, socklen_t servicelen,
+int getnameinfo(const struct sockaddr *sa, socklen_t salen,
+               char *node, socklen_t nodelen,
+               char *service, socklen_t servicelen,
                int flags)
 {
 #ifdef WIN32_NATIVE
index b4ef242cf1a1f5f1914bf5a5b00ceb45bff4c0b1..97080976925fb619716d52787016ae5172f77c54 100644 (file)
@@ -5,7 +5,7 @@
 
    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)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    This program is distributed in the hope that it will be useful,
@@ -113,10 +113,10 @@ struct addrinfo
    socket addresses.
    For more details, see the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/getaddrinfo.html>.  */
-extern int getaddrinfo (const char *restrict nodename,
-                       const char *restrict servname,
-                       const struct addrinfo *restrict hints,
-                       struct addrinfo **restrict res);
+extern int getaddrinfo (const char *nodename,
+                       const char *servname,
+                       const struct addrinfo *hints,
+                       struct addrinfo **res);
 #endif
 
 #if !HAVE_DECL_FREEADDRINFO
@@ -137,9 +137,9 @@ extern const char *gai_strerror (int ecode);
 /* Convert socket address to printable node and service names.
    For more details, see the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/getnameinfo.html>.  */
-extern int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen,
-                      char *restrict node, socklen_t nodelen,
-                      char *restrict service, socklen_t servicelen,
+extern int getnameinfo(const struct sockaddr *sa, socklen_t salen,
+                      char *node, socklen_t nodelen,
+                      char *service, socklen_t servicelen,
                       int flags);
 
 #endif
diff --git a/gnulib/getopt.c b/gnulib/getopt.c
new file mode 100644 (file)
index 0000000..f1e6d1f
--- /dev/null
@@ -0,0 +1,1186 @@
+/* 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,2003,2004,2006,2008
+       Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   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 3 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, see <http://www.gnu.org/licenses/>.  */
+\f
+#ifndef _LIBC
+# include <config.h>
+#endif
+
+#include "getopt.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#ifdef _LIBC
+# include <libintl.h>
+#else
+# include "gettext.h"
+# define _(msgid) gettext (msgid)
+#endif
+
+#if defined _LIBC && defined USE_IN_LIBIO
+# include <wchar.h>
+#endif
+
+#ifndef attribute_hidden
+# define attribute_hidden
+#endif
+
+/* Unlike standard Unix `getopt', functions like `getopt_long'
+   let the user intersperse the options with the other arguments.
+
+   As `getopt_long' 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.
+
+   Using `getopt' or setting the environment variable POSIXLY_CORRECT
+   disables permutation.
+   Then the application's 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_int.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;
+
+/* 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 = '?';
+
+/* Keep a global copy of all internal members of getopt_data.  */
+
+static struct _getopt_data getopt_data;
+
+\f
+#if defined HAVE_DECL_GETENV && !HAVE_DECL_GETENV
+extern char *getenv ();
+#endif
+\f
+#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;
+# endif
+
+# ifdef USE_NONOPTION_FLAGS
+#  define SWAP_FLAGS(ch1, ch2) \
+  if (d->__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.  */
+
+static void
+exchange (char **argv, struct _getopt_data *d)
+{
+  int bottom = d->__first_nonopt;
+  int middle = d->__last_nonopt;
+  int top = d->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 (d->__nonoption_flags_len > 0 && top >= d->__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)
+       d->__nonoption_flags_len = d->__nonoption_flags_max_len = 0;
+      else
+       {
+         memset (__mempcpy (new_str, __getopt_nonoption_flags,
+                            d->__nonoption_flags_max_len),
+                 '\0', top + 1 - d->__nonoption_flags_max_len);
+         d->__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.  */
+
+  d->__first_nonopt += (d->optind - d->__last_nonopt);
+  d->__last_nonopt = d->optind;
+}
+
+/* Initialize the internal data when the first call is made.  */
+
+static const char *
+_getopt_initialize (int argc, char **argv, const char *optstring,
+                   int posixly_correct, struct _getopt_data *d)
+{
+  /* 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.  */
+
+  d->__first_nonopt = d->__last_nonopt = d->optind;
+
+  d->__nextchar = NULL;
+
+  d->__posixly_correct = posixly_correct || !!getenv ("POSIXLY_CORRECT");
+
+  /* Determine how to handle the ordering of options and nonoptions.  */
+
+  if (optstring[0] == '-')
+    {
+      d->__ordering = RETURN_IN_ORDER;
+      ++optstring;
+    }
+  else if (optstring[0] == '+')
+    {
+      d->__ordering = REQUIRE_ORDER;
+      ++optstring;
+    }
+  else if (d->__posixly_correct)
+    d->__ordering = REQUIRE_ORDER;
+  else
+    d->__ordering = PERMUTE;
+
+#if defined _LIBC && defined USE_NONOPTION_FLAGS
+  if (!d->__posixly_correct
+      && argc == __libc_argc && argv == __libc_argv)
+    {
+      if (d->__nonoption_flags_max_len == 0)
+       {
+         if (__getopt_nonoption_flags == NULL
+             || __getopt_nonoption_flags[0] == '\0')
+           d->__nonoption_flags_max_len = -1;
+         else
+           {
+             const char *orig_str = __getopt_nonoption_flags;
+             int len = d->__nonoption_flags_max_len = strlen (orig_str);
+             if (d->__nonoption_flags_max_len < argc)
+               d->__nonoption_flags_max_len = argc;
+             __getopt_nonoption_flags =
+               (char *) malloc (d->__nonoption_flags_max_len);
+             if (__getopt_nonoption_flags == NULL)
+               d->__nonoption_flags_max_len = -1;
+             else
+               memset (__mempcpy (__getopt_nonoption_flags, orig_str, len),
+                       '\0', d->__nonoption_flags_max_len - len);
+           }
+       }
+      d->__nonoption_flags_len = d->__nonoption_flags_max_len;
+    }
+  else
+    d->__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.
+
+   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.
+
+   If POSIXLY_CORRECT is nonzero, behave as if the POSIXLY_CORRECT
+   environment variable were set.  */
+
+int
+_getopt_internal_r (int argc, char **argv, const char *optstring,
+                   const struct option *longopts, int *longind,
+                   int long_only, int posixly_correct, struct _getopt_data *d)
+{
+  int print_errors = d->opterr;
+  if (optstring[0] == ':')
+    print_errors = 0;
+
+  if (argc < 1)
+    return -1;
+
+  d->optarg = NULL;
+
+  if (d->optind == 0 || !d->__initialized)
+    {
+      if (d->optind == 0)
+       d->optind = 1;  /* Don't scan ARGV[0], the program name.  */
+      optstring = _getopt_initialize (argc, argv, optstring,
+                                     posixly_correct, d);
+      d->__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[d->optind][0] != '-' || argv[d->optind][1] == '\0' \
+                     || (d->optind < d->__nonoption_flags_len                \
+                         && __getopt_nonoption_flags[d->optind] == '1'))
+#else
+# define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0')
+#endif
+
+  if (d->__nextchar == NULL || *d->__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 (d->__last_nonopt > d->optind)
+       d->__last_nonopt = d->optind;
+      if (d->__first_nonopt > d->optind)
+       d->__first_nonopt = d->optind;
+
+      if (d->__ordering == PERMUTE)
+       {
+         /* If we have just processed some options following some non-options,
+            exchange them so that the options come first.  */
+
+         if (d->__first_nonopt != d->__last_nonopt
+             && d->__last_nonopt != d->optind)
+           exchange ((char **) argv, d);
+         else if (d->__last_nonopt != d->optind)
+           d->__first_nonopt = d->optind;
+
+         /* Skip any additional non-options
+            and extend the range of non-options previously skipped.  */
+
+         while (d->optind < argc && NONOPTION_P)
+           d->optind++;
+         d->__last_nonopt = d->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 (d->optind != argc && !strcmp (argv[d->optind], "--"))
+       {
+         d->optind++;
+
+         if (d->__first_nonopt != d->__last_nonopt
+             && d->__last_nonopt != d->optind)
+           exchange ((char **) argv, d);
+         else if (d->__first_nonopt == d->__last_nonopt)
+           d->__first_nonopt = d->optind;
+         d->__last_nonopt = argc;
+
+         d->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 (d->optind == argc)
+       {
+         /* Set the next-arg-index to point at the non-options
+            that we previously skipped, so the caller will digest them.  */
+         if (d->__first_nonopt != d->__last_nonopt)
+           d->optind = d->__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 (d->__ordering == REQUIRE_ORDER)
+           return -1;
+         d->optarg = argv[d->optind++];
+         return 1;
+       }
+
+      /* We have found another option-ARGV-element.
+        Skip the initial punctuation.  */
+
+      d->__nextchar = (argv[d->optind] + 1
+                 + (longopts != NULL && argv[d->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[d->optind][1] == '-'
+         || (long_only && (argv[d->optind][2]
+                           || !strchr (optstring, argv[d->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 = d->__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, d->__nextchar, nameend - d->__nextchar))
+         {
+           if ((unsigned int) (nameend - d->__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[d->optind]) >= 0)
+               {
+                 _IO_flockfile (stderr);
+
+                 int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+                 ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
+
+                 __fxprintf (NULL, "%s", buf);
+
+                 ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+                 _IO_funlockfile (stderr);
+
+                 free (buf);
+               }
+#else
+             fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
+                      argv[0], argv[d->optind]);
+#endif
+           }
+         d->__nextchar += strlen (d->__nextchar);
+         d->optind++;
+         d->optopt = 0;
+         return '?';
+       }
+
+      if (pfound != NULL)
+       {
+         option_index = indfound;
+         d->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)
+               d->optarg = nameend + 1;
+             else
+               {
+                 if (print_errors)
+                   {
+#if defined _LIBC && defined USE_IN_LIBIO
+                     char *buf;
+                     int n;
+#endif
+
+                     if (argv[d->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[d->optind - 1][0],
+                                         pfound->name);
+#else
+                         fprintf (stderr, _("\
+%s: option `%c%s' doesn't allow an argument\n"),
+                                  argv[0], argv[d->optind - 1][0],
+                                  pfound->name);
+#endif
+                       }
+
+#if defined _LIBC && defined USE_IN_LIBIO
+                     if (n >= 0)
+                       {
+                         _IO_flockfile (stderr);
+
+                         int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+                         ((_IO_FILE *) stderr)->_flags2
+                           |= _IO_FLAGS2_NOTCANCEL;
+
+                         __fxprintf (NULL, "%s", buf);
+
+                         ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+                         _IO_funlockfile (stderr);
+
+                         free (buf);
+                       }
+#endif
+                   }
+
+                 d->__nextchar += strlen (d->__nextchar);
+
+                 d->optopt = pfound->val;
+                 return '?';
+               }
+           }
+         else if (pfound->has_arg == 1)
+           {
+             if (d->optind < argc)
+               d->optarg = argv[d->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[d->optind - 1]) >= 0)
+                       {
+                         _IO_flockfile (stderr);
+
+                         int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+                         ((_IO_FILE *) stderr)->_flags2
+                           |= _IO_FLAGS2_NOTCANCEL;
+
+                         __fxprintf (NULL, "%s", buf);
+
+                         ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+                         _IO_funlockfile (stderr);
+
+                         free (buf);
+                       }
+#else
+                     fprintf (stderr,
+                              _("%s: option `%s' requires an argument\n"),
+                              argv[0], argv[d->optind - 1]);
+#endif
+                   }
+                 d->__nextchar += strlen (d->__nextchar);
+                 d->optopt = pfound->val;
+                 return optstring[0] == ':' ? ':' : '?';
+               }
+           }
+         d->__nextchar += strlen (d->__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[d->optind][1] == '-'
+         || strchr (optstring, *d->__nextchar) == NULL)
+       {
+         if (print_errors)
+           {
+#if defined _LIBC && defined USE_IN_LIBIO
+             char *buf;
+             int n;
+#endif
+
+             if (argv[d->optind][1] == '-')
+               {
+                 /* --option */
+#if defined _LIBC && defined USE_IN_LIBIO
+                 n = __asprintf (&buf, _("%s: unrecognized option `--%s'\n"),
+                                 argv[0], d->__nextchar);
+#else
+                 fprintf (stderr, _("%s: unrecognized option `--%s'\n"),
+                          argv[0], d->__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[d->optind][0], d->__nextchar);
+#else
+                 fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),
+                          argv[0], argv[d->optind][0], d->__nextchar);
+#endif
+               }
+
+#if defined _LIBC && defined USE_IN_LIBIO
+             if (n >= 0)
+               {
+                 _IO_flockfile (stderr);
+
+                 int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+                 ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
+
+                 __fxprintf (NULL, "%s", buf);
+
+                 ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+                 _IO_funlockfile (stderr);
+
+                 free (buf);
+               }
+#endif
+           }
+         d->__nextchar = (char *) "";
+         d->optind++;
+         d->optopt = 0;
+         return '?';
+       }
+    }
+
+  /* Look at and handle the next short option-character.  */
+
+  {
+    char c = *d->__nextchar++;
+    char *temp = strchr (optstring, c);
+
+    /* Increment `optind' when we start to process its last character.  */
+    if (*d->__nextchar == '\0')
+      ++d->optind;
+
+    if (temp == NULL || c == ':')
+      {
+       if (print_errors)
+         {
+#if defined _LIBC && defined USE_IN_LIBIO
+             char *buf;
+             int n;
+#endif
+
+           if (d->__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)
+             {
+               _IO_flockfile (stderr);
+
+               int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+               ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
+
+               __fxprintf (NULL, "%s", buf);
+
+               ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+               _IO_funlockfile (stderr);
+
+               free (buf);
+             }
+#endif
+         }
+       d->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 (*d->__nextchar != '\0')
+         {
+           d->optarg = d->__nextchar;
+           /* If we end this ARGV-element by taking the rest as an arg,
+              we must advance to the next element now.  */
+           d->optind++;
+         }
+       else if (d->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)
+                 {
+                   _IO_flockfile (stderr);
+
+                   int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+                   ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
+
+                   __fxprintf (NULL, "%s", buf);
+
+                   ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+                   _IO_funlockfile (stderr);
+
+                   free (buf);
+                 }
+#else
+               fprintf (stderr, _("%s: option requires an argument -- %c\n"),
+                        argv[0], c);
+#endif
+             }
+           d->optopt = c;
+           if (optstring[0] == ':')
+             c = ':';
+           else
+             c = '?';
+           return c;
+         }
+       else
+         /* We already incremented `d->optind' once;
+            increment it again when taking next ARGV-elt as argument.  */
+         d->optarg = argv[d->optind++];
+
+       /* optarg is now the argument, see if it's in the
+          table of longopts.  */
+
+       for (d->__nextchar = nameend = d->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, d->__nextchar, nameend - d->__nextchar))
+           {
+             if ((unsigned int) (nameend - d->__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[d->optind]) >= 0)
+                 {
+                   _IO_flockfile (stderr);
+
+                   int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+                   ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
+
+                   __fxprintf (NULL, "%s", buf);
+
+                   ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+                   _IO_funlockfile (stderr);
+
+                   free (buf);
+                 }
+#else
+               fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"),
+                        argv[0], argv[d->optind]);
+#endif
+             }
+           d->__nextchar += strlen (d->__nextchar);
+           d->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)
+                 d->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)
+                         {
+                           _IO_flockfile (stderr);
+
+                           int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+                           ((_IO_FILE *) stderr)->_flags2
+                             |= _IO_FLAGS2_NOTCANCEL;
+
+                           __fxprintf (NULL, "%s", buf);
+
+                           ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+                           _IO_funlockfile (stderr);
+
+                           free (buf);
+                         }
+#else
+                       fprintf (stderr, _("\
+%s: option `-W %s' doesn't allow an argument\n"),
+                                argv[0], pfound->name);
+#endif
+                     }
+
+                   d->__nextchar += strlen (d->__nextchar);
+                   return '?';
+                 }
+             }
+           else if (pfound->has_arg == 1)
+             {
+               if (d->optind < argc)
+                 d->optarg = argv[d->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[d->optind - 1]) >= 0)
+                         {
+                           _IO_flockfile (stderr);
+
+                           int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+                           ((_IO_FILE *) stderr)->_flags2
+                             |= _IO_FLAGS2_NOTCANCEL;
+
+                           __fxprintf (NULL, "%s", buf);
+
+                           ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+                           _IO_funlockfile (stderr);
+
+                           free (buf);
+                         }
+#else
+                       fprintf (stderr,
+                                _("%s: option `%s' requires an argument\n"),
+                                argv[0], argv[d->optind - 1]);
+#endif
+                     }
+                   d->__nextchar += strlen (d->__nextchar);
+                   return optstring[0] == ':' ? ':' : '?';
+                 }
+             }
+           d->__nextchar += strlen (d->__nextchar);
+           if (longind != NULL)
+             *longind = option_index;
+           if (pfound->flag)
+             {
+               *(pfound->flag) = pfound->val;
+               return 0;
+             }
+           return pfound->val;
+         }
+         d->__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 (*d->__nextchar != '\0')
+             {
+               d->optarg = d->__nextchar;
+               d->optind++;
+             }
+           else
+             d->optarg = NULL;
+           d->__nextchar = NULL;
+         }
+       else
+         {
+           /* This is an option that requires an argument.  */
+           if (*d->__nextchar != '\0')
+             {
+               d->optarg = d->__nextchar;
+               /* If we end this ARGV-element by taking the rest as an arg,
+                  we must advance to the next element now.  */
+               d->optind++;
+             }
+           else if (d->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)
+                     {
+                       _IO_flockfile (stderr);
+
+                       int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
+                       ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
+
+                       __fxprintf (NULL, "%s", buf);
+
+                       ((_IO_FILE *) stderr)->_flags2 = old_flags2;
+                       _IO_funlockfile (stderr);
+
+                       free (buf);
+                     }
+#else
+                   fprintf (stderr,
+                            _("%s: option requires an argument -- %c\n"),
+                            argv[0], c);
+#endif
+                 }
+               d->optopt = c;
+               if (optstring[0] == ':')
+                 c = ':';
+               else
+                 c = '?';
+             }
+           else
+             /* We already incremented `optind' once;
+                increment it again when taking next ARGV-elt as argument.  */
+             d->optarg = argv[d->optind++];
+           d->__nextchar = NULL;
+         }
+      }
+    return c;
+  }
+}
+
+int
+_getopt_internal (int argc, char **argv, const char *optstring,
+                 const struct option *longopts, int *longind,
+                 int long_only, int posixly_correct)
+{
+  int result;
+
+  getopt_data.optind = optind;
+  getopt_data.opterr = opterr;
+
+  result = _getopt_internal_r (argc, argv, optstring, longopts, longind,
+                              long_only, posixly_correct, &getopt_data);
+
+  optind = getopt_data.optind;
+  optarg = getopt_data.optarg;
+  optopt = getopt_data.optopt;
+
+  return result;
+}
+
+/* glibc gets a LSB-compliant getopt.
+   Standalone applications get a POSIX-compliant getopt.  */
+#if _LIBC
+enum { POSIXLY_CORRECT = 0 };
+#else
+enum { POSIXLY_CORRECT = 1 };
+#endif
+
+int
+getopt (int argc, char *const *argv, const char *optstring)
+{
+  return _getopt_internal (argc, (char **) argv, optstring, NULL, NULL, 0,
+                          POSIXLY_CORRECT);
+}
+
+\f
+#ifdef TEST
+
+/* Compile with -DTEST to make an executable for use in testing
+   the above definition of `getopt'.  */
+
+int
+main (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/gnulib/getopt.in.h b/gnulib/getopt.in.h
new file mode 100644 (file)
index 0000000..d2d3e6e
--- /dev/null
@@ -0,0 +1,225 @@
+/* Declarations for getopt.
+   Copyright (C) 1989-1994,1996-1999,2001,2003,2004,2005,2006,2007
+   Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   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 3 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, see <http://www.gnu.org/licenses/>.  */
+
+#ifndef _GETOPT_H
+
+#ifndef __need_getopt
+# define _GETOPT_H 1
+#endif
+
+/* Standalone applications should #define __GETOPT_PREFIX to an
+   identifier that prefixes the external functions and variables
+   defined in this header.  When this happens, include the
+   headers that might declare getopt so that they will not cause
+   confusion if included after this file.  Then systematically rename
+   identifiers so that they do not collide with the system functions
+   and variables.  Renaming avoids problems with some compilers and
+   linkers.  */
+#if defined __GETOPT_PREFIX && !defined __need_getopt
+# include <stdlib.h>
+# include <stdio.h>
+# include <unistd.h>
+# undef __need_getopt
+# undef getopt
+# undef getopt_long
+# undef getopt_long_only
+# undef optarg
+# undef opterr
+# undef optind
+# undef optopt
+# define __GETOPT_CONCAT(x, y) x ## y
+# define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y)
+# define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y)
+# define getopt __GETOPT_ID (getopt)
+# define getopt_long __GETOPT_ID (getopt_long)
+# define getopt_long_only __GETOPT_ID (getopt_long_only)
+# define optarg __GETOPT_ID (optarg)
+# define opterr __GETOPT_ID (opterr)
+# define optind __GETOPT_ID (optind)
+# define optopt __GETOPT_ID (optopt)
+#endif
+
+/* Standalone applications get correct prototypes for getopt_long and
+   getopt_long_only; they declare "char **argv".  libc uses prototypes
+   with "char *const *argv" that are incorrect because getopt_long and
+   getopt_long_only can permute argv; this is required for backward
+   compatibility (e.g., for LSB 2.0.1).
+
+   This used to be `#if defined __GETOPT_PREFIX && !defined __need_getopt',
+   but it caused redefinition warnings if both unistd.h and getopt.h were
+   included, since unistd.h includes getopt.h having previously defined
+   __need_getopt.
+
+   The only place where __getopt_argv_const is used is in definitions
+   of getopt_long and getopt_long_only below, but these are visible
+   only if __need_getopt is not defined, so it is quite safe to rewrite
+   the conditional as follows:
+*/
+#if !defined __need_getopt
+# if defined __GETOPT_PREFIX
+#  define __getopt_argv_const /* empty */
+# else
+#  define __getopt_argv_const const
+# endif
+#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
+
+#ifndef __THROW
+# ifndef __GNUC_PREREQ
+#  define __GNUC_PREREQ(maj, min) (0)
+# endif
+# if defined __cplusplus && __GNUC_PREREQ (2,8)
+#  define __THROW      throw ()
+# else
+#  define __THROW
+# endif
+#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
+{
+  const char *name;
+  /* 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 '\1'.  This behavior is specific to the GNU
+   `getopt'.  If OPTS begins with `+', or POSIXLY_CORRECT is set in
+   the environment, then do not permute arguments.  */
+
+extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
+       __THROW;
+
+#ifndef __need_getopt
+extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv,
+                       const char *__shortopts,
+                       const struct option *__longopts, int *__longind)
+       __THROW;
+extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv,
+                            const char *__shortopts,
+                            const struct option *__longopts, int *__longind)
+       __THROW;
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+/* Make sure we later can get all the definitions and declarations.  */
+#undef __need_getopt
+
+#endif /* getopt.h */
diff --git a/gnulib/getopt1.c b/gnulib/getopt1.c
new file mode 100644 (file)
index 0000000..d6a3ecf
--- /dev/null
@@ -0,0 +1,170 @@
+/* getopt_long and getopt_long_only entry points for GNU getopt.
+   Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98,2004,2006
+     Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   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 3 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, see <http://www.gnu.org/licenses/>.  */
+\f
+#ifdef _LIBC
+# include <getopt.h>
+#else
+# include <config.h>
+# include "getopt.h"
+#endif
+#include "getopt_int.h"
+
+#include <stdio.h>
+
+/* 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 (int argc, char *__getopt_argv_const *argv, const char *options,
+            const struct option *long_options, int *opt_index)
+{
+  return _getopt_internal (argc, (char **) argv, options, long_options,
+                          opt_index, 0, 0);
+}
+
+int
+_getopt_long_r (int argc, char **argv, const char *options,
+               const struct option *long_options, int *opt_index,
+               struct _getopt_data *d)
+{
+  return _getopt_internal_r (argc, argv, options, long_options, opt_index,
+                            0, 0, d);
+}
+
+/* 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 (int argc, char *__getopt_argv_const *argv,
+                 const char *options,
+                 const struct option *long_options, int *opt_index)
+{
+  return _getopt_internal (argc, (char **) argv, options, long_options,
+                          opt_index, 1, 0);
+}
+
+int
+_getopt_long_only_r (int argc, char **argv, const char *options,
+                    const struct option *long_options, int *opt_index,
+                    struct _getopt_data *d)
+{
+  return _getopt_internal_r (argc, argv, options, long_options, opt_index,
+                            1, 0, d);
+}
+
+\f
+#ifdef TEST
+
+#include <stdio.h>
+
+int
+main (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 */
diff --git a/gnulib/getopt_int.h b/gnulib/getopt_int.h
new file mode 100644 (file)
index 0000000..3c6628b
--- /dev/null
@@ -0,0 +1,130 @@
+/* Internal declarations for getopt.
+   Copyright (C) 1989-1994,1996-1999,2001,2003,2004
+   Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   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 3 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, see <http://www.gnu.org/licenses/>.  */
+
+#ifndef _GETOPT_INT_H
+#define _GETOPT_INT_H  1
+
+extern int _getopt_internal (int ___argc, char **___argv,
+                            const char *__shortopts,
+                            const struct option *__longopts, int *__longind,
+                            int __long_only, int __posixly_correct);
+
+\f
+/* Reentrant versions which can handle parsing multiple argument
+   vectors at the same time.  */
+
+/* Data type for reentrant functions.  */
+struct _getopt_data
+{
+  /* These have exactly the same meaning as the corresponding global
+     variables, except that they are used for the reentrant
+     versions of getopt.  */
+  int optind;
+  int opterr;
+  int optopt;
+  char *optarg;
+
+  /* Internal members.  */
+
+  /* True if the internal members have been initialized.  */
+  int __initialized;
+
+  /* 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.  */
+  char *__nextchar;
+
+  /* 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, or by calling getopt.
+
+     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.  */
+
+  enum
+    {
+      REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
+    } __ordering;
+
+  /* If the POSIXLY_CORRECT environment variable is set
+     or getopt was called.  */
+  int __posixly_correct;
+
+
+  /* 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.  */
+
+  int __first_nonopt;
+  int __last_nonopt;
+
+#if defined _LIBC && defined USE_NONOPTION_FLAGS
+  int __nonoption_flags_max_len;
+  int __nonoption_flags_len;
+# endif
+};
+
+/* The initializer is necessary to set OPTIND and OPTERR to their
+   default values and to clear the initialization flag.  */
+#define _GETOPT_DATA_INITIALIZER       { 1, 1 }
+
+extern int _getopt_internal_r (int ___argc, char **___argv,
+                              const char *__shortopts,
+                              const struct option *__longopts, int *__longind,
+                              int __long_only, int __posixly_correct,
+                              struct _getopt_data *__data);
+
+extern int _getopt_long_r (int ___argc, char **___argv,
+                          const char *__shortopts,
+                          const struct option *__longopts, int *__longind,
+                          struct _getopt_data *__data);
+
+extern int _getopt_long_only_r (int ___argc, char **___argv,
+                               const char *__shortopts,
+                               const struct option *__longopts,
+                               int *__longind,
+                               struct _getopt_data *__data);
+
+#endif /* getopt_int.h */
index 9d76ec9afccff2785cad1c468b05251a6eba3de2..763dd3c1470ad11df04d2ed89d8c574f9c30a88f 100644 (file)
@@ -3,7 +3,7 @@
 
    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)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    This program is distributed in the hope that it will be useful,
index bd5576cb0993823f92f96a8f05b876cd78d6e771..7579130bc238aa5cb8d3ccd2ed75601938f71acb 100644 (file)
@@ -5,7 +5,7 @@
 
    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)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    This program is distributed in the hope that it will be useful,
@@ -48,7 +48,7 @@ static struct tm *localtime_buffer_addr = &tm_zero_buffer;
    localtime uses for its result.  */
 
 struct tm *
-localtime (time_t const *timep)
+rpl_localtime (time_t const *timep)
 {
 #undef localtime
   extern struct tm *localtime (time_t const *);
@@ -62,7 +62,7 @@ localtime (time_t const *timep)
 
 /* Same as above, since gmtime and localtime use the same buffer.  */
 struct tm *
-gmtime (time_t const *timep)
+rpl_gmtime (time_t const *timep)
 {
 #undef gmtime
   extern struct tm *gmtime (time_t const *);
@@ -80,7 +80,7 @@ gmtime (time_t const *timep)
 /* This is a wrapper for tzset, for systems on which tzset may clobber
    the static buffer used for localtime's result.  */
 void
-tzset (void)
+rpl_tzset (void)
 {
 #undef tzset
   extern void tzset (void);
@@ -98,7 +98,7 @@ tzset (void)
    causes problems.  */
 
 int
-rpl_gettimeofday (struct timeval *restrict tv, void *restrict tz)
+rpl_gettimeofday (struct timeval *tv, void *tz)
 {
 #undef gettimeofday
 #if HAVE_GETTIMEOFDAY
index 537b59fa5c143bae5ec9a2f71afdcb4fdfa7d4e6..a49b1e39e2dfbd530d346e82d5a384234af95692 100644 (file)
@@ -4,7 +4,7 @@
 
    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)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    This program is distributed in the hope that it will be useful,
@@ -70,8 +70,8 @@ static const char *inet_ntop6 (const unsigned char *src, char *dst, socklen_t si
  *     Paul Vixie, 1996.
  */
 const char *
-inet_ntop (int af, const void *restrict src,
-          char *restrict dst, socklen_t cnt)
+inet_ntop (int af, const void *src,
+          char *dst, socklen_t cnt)
 {
   switch (af)
     {
index bd1e085aed9418ee354ae9c8d649b3ead3d0044c..aecb214134326d1d124d7c47b22a365c60f81dcf 100644 (file)
@@ -3,7 +3,7 @@
 
    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)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    This program is distributed in the hope that it will be useful,
@@ -37,6 +37,6 @@
    <http://www.opengroup.org/susv3xsh/inet_ntop.html>.  */
 
 #if !HAVE_DECL_INET_NTOP
-extern const char *inet_ntop (int af, const void *restrict src,
-                             char *restrict dst, socklen_t cnt);
+extern const char *inet_ntop (int af, const void *src,
+                             char *dst, socklen_t cnt);
 #endif
index 34a59ab33910d6219c37b8d04df4c6bcf02d7d7b..73cdc411d235780cbef2bf8cef873bf54a660497 100644 (file)
@@ -1,9 +1,9 @@
 /* Locking in multithreaded situations.
-   Copyright (C) 2005-2006 Free Software Foundation, Inc.
+   Copyright (C) 2005-2007 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)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    This program is distributed in the hope that it will be useful,
@@ -250,7 +250,24 @@ glthread_rwlock_destroy (gl_rwlock_t *lock)
 
 # if HAVE_PTHREAD_MUTEX_RECURSIVE
 
-#  if !(defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER || defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
+#  if defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER || defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+
+void
+glthread_recursive_lock_init (gl_recursive_lock_t *lock)
+{
+  pthread_mutexattr_t attributes;
+
+  if (pthread_mutexattr_init (&attributes) != 0)
+    abort ();
+  if (pthread_mutexattr_settype (&attributes, PTHREAD_MUTEX_RECURSIVE) != 0)
+    abort ();
+  if (pthread_mutex_init (lock, &attributes) != 0)
+    abort ();
+  if (pthread_mutexattr_destroy (&attributes) != 0)
+    abort ();
+}
+
+#  else
 
 void
 glthread_recursive_lock_init (gl_recursive_lock_t *lock)
index e6b312af589ee7ee6d4a0e60927996943f18067e..0494732c71423ecb8feb36edae8f0b841417bc48 100644 (file)
@@ -1,9 +1,9 @@
 /* Locking in multithreaded situations.
-   Copyright (C) 2005-2006 Free Software Foundation, Inc.
+   Copyright (C) 2005-2007 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)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    This program is distributed in the hope that it will be useful,
@@ -147,13 +147,33 @@ typedef pthread_mutex_t gl_lock_t;
 # define gl_lock_initializer \
     PTHREAD_MUTEX_INITIALIZER
 # define gl_lock_init(NAME) \
-    if (pthread_in_use () && pthread_mutex_init (&NAME, NULL) != 0) abort ()
+    do                                                                  \
+      {                                                                 \
+        if (pthread_in_use () && pthread_mutex_init (&NAME, NULL) != 0) \
+          abort ();                                                     \
+      }                                                                 \
+    while (0)
 # define gl_lock_lock(NAME) \
-    if (pthread_in_use () && pthread_mutex_lock (&NAME) != 0) abort ()
+    do                                                            \
+      {                                                           \
+        if (pthread_in_use () && pthread_mutex_lock (&NAME) != 0) \
+          abort ();                                               \
+      }                                                           \
+    while (0)
 # define gl_lock_unlock(NAME) \
-    if (pthread_in_use () && pthread_mutex_unlock (&NAME) != 0) abort ()
+    do                                                              \
+      {                                                             \
+        if (pthread_in_use () && pthread_mutex_unlock (&NAME) != 0) \
+          abort ();                                                 \
+      }                                                             \
+    while (0)
 # define gl_lock_destroy(NAME) \
-    if (pthread_in_use () && pthread_mutex_destroy (&NAME) != 0) abort ()
+    do                                                               \
+      {                                                              \
+        if (pthread_in_use () && pthread_mutex_destroy (&NAME) != 0) \
+          abort ();                                                  \
+      }                                                              \
+    while (0)
 
 /* ------------------------- gl_rwlock_t datatype ------------------------- */
 
@@ -169,15 +189,40 @@ typedef pthread_rwlock_t gl_rwlock_t;
 #   define gl_rwlock_initializer \
       PTHREAD_RWLOCK_INITIALIZER
 #   define gl_rwlock_init(NAME) \
-      if (pthread_in_use () && pthread_rwlock_init (&NAME, NULL) != 0) abort ()
+      do                                                                   \
+        {                                                                  \
+          if (pthread_in_use () && pthread_rwlock_init (&NAME, NULL) != 0) \
+            abort ();                                                      \
+        }                                                                  \
+      while (0)
 #   define gl_rwlock_rdlock(NAME) \
-      if (pthread_in_use () && pthread_rwlock_rdlock (&NAME) != 0) abort ()
+      do                                                               \
+        {                                                              \
+          if (pthread_in_use () && pthread_rwlock_rdlock (&NAME) != 0) \
+            abort ();                                                  \
+        }                                                              \
+      while (0)
 #   define gl_rwlock_wrlock(NAME) \
-      if (pthread_in_use () && pthread_rwlock_wrlock (&NAME) != 0) abort ()
+      do                                                               \
+        {                                                              \
+          if (pthread_in_use () && pthread_rwlock_wrlock (&NAME) != 0) \
+            abort ();                                                  \
+        }                                                              \
+      while (0)
 #   define gl_rwlock_unlock(NAME) \
-      if (pthread_in_use () && pthread_rwlock_unlock (&NAME) != 0) abort ()
+      do                                                               \
+        {                                                              \
+          if (pthread_in_use () && pthread_rwlock_unlock (&NAME) != 0) \
+            abort ();                                                  \
+        }                                                              \
+      while (0)
 #   define gl_rwlock_destroy(NAME) \
-      if (pthread_in_use () && pthread_rwlock_destroy (&NAME) != 0) abort ()
+      do                                                                \
+        {                                                               \
+          if (pthread_in_use () && pthread_rwlock_destroy (&NAME) != 0) \
+            abort ();                                                   \
+        }                                                               \
+      while (0)
 
 #  else
 
@@ -195,15 +240,40 @@ typedef struct
 #   define gl_rwlock_initializer \
       { 0, PTHREAD_MUTEX_INITIALIZER }
 #   define gl_rwlock_init(NAME) \
-      if (pthread_in_use ()) glthread_rwlock_init (&NAME)
+      do                                  \
+        {                                 \
+          if (pthread_in_use ())          \
+            glthread_rwlock_init (&NAME); \
+        }                                 \
+      while (0)
 #   define gl_rwlock_rdlock(NAME) \
-      if (pthread_in_use ()) glthread_rwlock_rdlock (&NAME)
+      do                                    \
+        {                                   \
+          if (pthread_in_use ())            \
+            glthread_rwlock_rdlock (&NAME); \
+        }                                   \
+      while (0)
 #   define gl_rwlock_wrlock(NAME) \
-      if (pthread_in_use ()) glthread_rwlock_wrlock (&NAME)
+      do                                    \
+        {                                   \
+          if (pthread_in_use ())            \
+            glthread_rwlock_wrlock (&NAME); \
+        }                                   \
+      while (0)
 #   define gl_rwlock_unlock(NAME) \
-      if (pthread_in_use ()) glthread_rwlock_unlock (&NAME)
+      do                                    \
+        {                                   \
+          if (pthread_in_use ())            \
+            glthread_rwlock_unlock (&NAME); \
+        }                                   \
+      while (0)
 #   define gl_rwlock_destroy(NAME) \
-      if (pthread_in_use ()) glthread_rwlock_destroy (&NAME)
+      do                                     \
+        {                                    \
+          if (pthread_in_use ())             \
+            glthread_rwlock_destroy (&NAME); \
+        }                                    \
+      while (0)
 extern void glthread_rwlock_init (gl_rwlock_t *lock);
 extern void glthread_rwlock_rdlock (gl_rwlock_t *lock);
 extern void glthread_rwlock_wrlock (gl_rwlock_t *lock);
@@ -230,15 +300,40 @@ typedef struct
 # define gl_rwlock_initializer \
     { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER, 0, 0 }
 # define gl_rwlock_init(NAME) \
-    if (pthread_in_use ()) glthread_rwlock_init (&NAME)
+    do                                  \
+      {                                 \
+        if (pthread_in_use ())          \
+          glthread_rwlock_init (&NAME); \
+      }                                 \
+    while (0)
 # define gl_rwlock_rdlock(NAME) \
-    if (pthread_in_use ()) glthread_rwlock_rdlock (&NAME)
+    do                                    \
+      {                                   \
+        if (pthread_in_use ())            \
+          glthread_rwlock_rdlock (&NAME); \
+      }                                   \
+    while (0)
 # define gl_rwlock_wrlock(NAME) \
-    if (pthread_in_use ()) glthread_rwlock_wrlock (&NAME)
+    do                                    \
+      {                                   \
+        if (pthread_in_use ())            \
+          glthread_rwlock_wrlock (&NAME); \
+      }                                   \
+    while (0)
 # define gl_rwlock_unlock(NAME) \
-    if (pthread_in_use ()) glthread_rwlock_unlock (&NAME)
+    do                                    \
+      {                                   \
+        if (pthread_in_use ())            \
+          glthread_rwlock_unlock (&NAME); \
+      }                                   \
+    while (0)
 # define gl_rwlock_destroy(NAME) \
-    if (pthread_in_use ()) glthread_rwlock_destroy (&NAME)
+    do                                     \
+      {                                    \
+        if (pthread_in_use ())             \
+          glthread_rwlock_destroy (&NAME); \
+      }                                    \
+    while (0)
 extern void glthread_rwlock_init (gl_rwlock_t *lock);
 extern void glthread_rwlock_rdlock (gl_rwlock_t *lock);
 extern void glthread_rwlock_wrlock (gl_rwlock_t *lock);
@@ -266,13 +361,34 @@ typedef pthread_mutex_t gl_recursive_lock_t;
        PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
 #   endif
 #   define gl_recursive_lock_init(NAME) \
-      if (pthread_in_use () && pthread_mutex_init (&NAME, NULL) != 0) abort ()
+      do                                          \
+        {                                         \
+          if (pthread_in_use ())                  \
+            glthread_recursive_lock_init (&NAME); \
+        }                                         \
+      while (0)
 #   define gl_recursive_lock_lock(NAME) \
-      if (pthread_in_use () && pthread_mutex_lock (&NAME) != 0) abort ()
+      do                                                            \
+        {                                                           \
+          if (pthread_in_use () && pthread_mutex_lock (&NAME) != 0) \
+            abort ();                                               \
+        }                                                           \
+      while (0)
 #   define gl_recursive_lock_unlock(NAME) \
-      if (pthread_in_use () && pthread_mutex_unlock (&NAME) != 0) abort ()
+      do                                                              \
+        {                                                             \
+          if (pthread_in_use () && pthread_mutex_unlock (&NAME) != 0) \
+            abort ();                                                 \
+        }                                                             \
+      while (0)
 #   define gl_recursive_lock_destroy(NAME) \
-      if (pthread_in_use () && pthread_mutex_destroy (&NAME) != 0) abort ()
+      do                                                               \
+        {                                                              \
+          if (pthread_in_use () && pthread_mutex_destroy (&NAME) != 0) \
+            abort ();                                                  \
+        }                                                              \
+      while (0)
+extern void glthread_recursive_lock_init (gl_recursive_lock_t *lock);
 
 #  else
 
@@ -290,13 +406,33 @@ typedef struct
 #   define gl_recursive_lock_initializer \
       { PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER, 0 }
 #   define gl_recursive_lock_init(NAME) \
-      if (pthread_in_use ()) glthread_recursive_lock_init (&NAME)
+      do                                          \
+        {                                         \
+          if (pthread_in_use ())                  \
+            glthread_recursive_lock_init (&NAME); \
+        }                                         \
+      while (0)
 #   define gl_recursive_lock_lock(NAME) \
-      if (pthread_in_use ()) glthread_recursive_lock_lock (&NAME)
+      do                                          \
+        {                                         \
+          if (pthread_in_use ())                  \
+            glthread_recursive_lock_lock (&NAME); \
+        }                                         \
+      while (0)
 #   define gl_recursive_lock_unlock(NAME) \
-      if (pthread_in_use ()) glthread_recursive_lock_unlock (&NAME)
+      do                                            \
+        {                                           \
+          if (pthread_in_use ())                    \
+            glthread_recursive_lock_unlock (&NAME); \
+        }                                           \
+      while (0)
 #   define gl_recursive_lock_destroy(NAME) \
-      if (pthread_in_use ()) glthread_recursive_lock_destroy (&NAME)
+      do                                             \
+        {                                            \
+          if (pthread_in_use ())                     \
+            glthread_recursive_lock_destroy (&NAME); \
+        }                                            \
+      while (0)
 extern void glthread_recursive_lock_init (gl_recursive_lock_t *lock);
 extern void glthread_recursive_lock_lock (gl_recursive_lock_t *lock);
 extern void glthread_recursive_lock_unlock (gl_recursive_lock_t *lock);
@@ -323,13 +459,33 @@ typedef struct
 #  define gl_recursive_lock_initializer \
      { PTHREAD_MUTEX_INITIALIZER, (pthread_t) 0, 0 }
 #  define gl_recursive_lock_init(NAME) \
-     if (pthread_in_use ()) glthread_recursive_lock_init (&NAME)
+     do                                          \
+       {                                         \
+         if (pthread_in_use ())                  \
+           glthread_recursive_lock_init (&NAME); \
+       }                                         \
+     while (0)
 #  define gl_recursive_lock_lock(NAME) \
-     if (pthread_in_use ()) glthread_recursive_lock_lock (&NAME)
+     do                                          \
+       {                                         \
+         if (pthread_in_use ())                  \
+           glthread_recursive_lock_lock (&NAME); \
+       }                                         \
+     while (0)
 #  define gl_recursive_lock_unlock(NAME) \
-     if (pthread_in_use ()) glthread_recursive_lock_unlock (&NAME)
+     do                                            \
+       {                                           \
+         if (pthread_in_use ())                    \
+           glthread_recursive_lock_unlock (&NAME); \
+       }                                           \
+     while (0)
 #  define gl_recursive_lock_destroy(NAME) \
-     if (pthread_in_use ()) glthread_recursive_lock_destroy (&NAME)
+     do                                             \
+       {                                            \
+         if (pthread_in_use ())                     \
+           glthread_recursive_lock_destroy (&NAME); \
+       }                                            \
+     while (0)
 extern void glthread_recursive_lock_init (gl_recursive_lock_t *lock);
 extern void glthread_recursive_lock_lock (gl_recursive_lock_t *lock);
 extern void glthread_recursive_lock_unlock (gl_recursive_lock_t *lock);
@@ -409,11 +565,26 @@ typedef pth_mutex_t gl_lock_t;
 # define gl_lock_initializer \
     PTH_MUTEX_INIT
 # define gl_lock_init(NAME) \
-    if (pth_in_use() && !pth_mutex_init (&NAME)) abort ()
+    do                                               \
+      {                                              \
+        if (pth_in_use() && !pth_mutex_init (&NAME)) \
+          abort ();                                  \
+      }                                              \
+    while (0)
 # define gl_lock_lock(NAME) \
-    if (pth_in_use() && !pth_mutex_acquire (&NAME, 0, NULL)) abort ()
+    do                                                           \
+      {                                                          \
+        if (pth_in_use() && !pth_mutex_acquire (&NAME, 0, NULL)) \
+          abort ();                                              \
+      }                                                          \
+    while (0)
 # define gl_lock_unlock(NAME) \
-    if (pth_in_use() && !pth_mutex_release (&NAME)) abort ()
+    do                                                  \
+      {                                                 \
+        if (pth_in_use() && !pth_mutex_release (&NAME)) \
+          abort ();                                     \
+      }                                                 \
+    while (0)
 # define gl_lock_destroy(NAME) \
     (void)(&NAME)
 
@@ -427,13 +598,35 @@ typedef pth_rwlock_t gl_rwlock_t;
 #  define gl_rwlock_initializer \
      PTH_RWLOCK_INIT
 #  define gl_rwlock_init(NAME) \
-     if (pth_in_use() && !pth_rwlock_init (&NAME)) abort ()
+     do                                                \
+       {                                               \
+         if (pth_in_use() && !pth_rwlock_init (&NAME)) \
+           abort ();                                   \
+       }                                               \
+     while (0)
 #  define gl_rwlock_rdlock(NAME) \
-     if (pth_in_use() && !pth_rwlock_acquire (&NAME, PTH_RWLOCK_RD, 0, NULL)) abort ()
+     do                                                              \
+       {                                                             \
+         if (pth_in_use()                                            \
+             && !pth_rwlock_acquire (&NAME, PTH_RWLOCK_RD, 0, NULL)) \
+           abort ();                                                 \
+       }                                                             \
+     while (0)
 #  define gl_rwlock_wrlock(NAME) \
-     if (pth_in_use() && !pth_rwlock_acquire (&NAME, PTH_RWLOCK_RW, 0, NULL)) abort ()
+     do                                                              \
+       {                                                             \
+         if (pth_in_use()                                            \
+             && !pth_rwlock_acquire (&NAME, PTH_RWLOCK_RW, 0, NULL)) \
+           abort ();                                                 \
+       }                                                             \
+     while (0)
 #  define gl_rwlock_unlock(NAME) \
-     if (pth_in_use() && !pth_rwlock_release (&NAME)) abort ()
+     do                                                   \
+       {                                                  \
+         if (pth_in_use() && !pth_rwlock_release (&NAME)) \
+           abort ();                                      \
+       }                                                  \
+     while (0)
 #  define gl_rwlock_destroy(NAME) \
      (void)(&NAME)
 
@@ -448,11 +641,26 @@ typedef pth_mutex_t gl_recursive_lock_t;
 #  define gl_recursive_lock_initializer \
      PTH_MUTEX_INIT
 #  define gl_recursive_lock_init(NAME) \
-     if (pth_in_use() && !pth_mutex_init (&NAME)) abort ()
+     do                                               \
+       {                                              \
+         if (pth_in_use() && !pth_mutex_init (&NAME)) \
+           abort ();                                  \
+       }                                              \
+     while (0)
 #  define gl_recursive_lock_lock(NAME) \
-     if (pth_in_use() && !pth_mutex_acquire (&NAME, 0, NULL)) abort ()
+     do                                                           \
+       {                                                          \
+         if (pth_in_use() && !pth_mutex_acquire (&NAME, 0, NULL)) \
+           abort ();                                              \
+       }                                                          \
+     while (0)
 #  define gl_recursive_lock_unlock(NAME) \
-     if (pth_in_use() && !pth_mutex_release (&NAME)) abort ()
+     do                                                  \
+       {                                                 \
+         if (pth_in_use() && !pth_mutex_release (&NAME)) \
+           abort ();                                     \
+       }                                                 \
+     while (0)
 #  define gl_recursive_lock_destroy(NAME) \
      (void)(&NAME)
 
@@ -534,13 +742,33 @@ typedef mutex_t gl_lock_t;
 # define gl_lock_initializer \
     DEFAULTMUTEX
 # define gl_lock_init(NAME) \
-    if (thread_in_use () && mutex_init (&NAME, USYNC_THREAD, NULL) != 0) abort ()
+    do                                                                       \
+      {                                                                      \
+        if (thread_in_use () && mutex_init (&NAME, USYNC_THREAD, NULL) != 0) \
+          abort ();                                                          \
+      }                                                                      \
+    while (0)
 # define gl_lock_lock(NAME) \
-    if (thread_in_use () && mutex_lock (&NAME) != 0) abort ()
+    do                                                   \
+      {                                                  \
+        if (thread_in_use () && mutex_lock (&NAME) != 0) \
+          abort ();                                      \
+      }                                                  \
+    while (0)
 # define gl_lock_unlock(NAME) \
-    if (thread_in_use () && mutex_unlock (&NAME) != 0) abort ()
+    do                                                     \
+      {                                                    \
+        if (thread_in_use () && mutex_unlock (&NAME) != 0) \
+          abort ();                                        \
+      }                                                    \
+    while (0)
 # define gl_lock_destroy(NAME) \
-    if (thread_in_use () && mutex_destroy (&NAME) != 0) abort ()
+    do                                                      \
+      {                                                     \
+        if (thread_in_use () && mutex_destroy (&NAME) != 0) \
+          abort ();                                         \
+      }                                                     \
+    while (0)
 
 /* ------------------------- gl_rwlock_t datatype ------------------------- */
 
@@ -552,15 +780,40 @@ typedef rwlock_t gl_rwlock_t;
 # define gl_rwlock_initializer \
     DEFAULTRWLOCK
 # define gl_rwlock_init(NAME) \
-    if (thread_in_use () && rwlock_init (&NAME, USYNC_THREAD, NULL) != 0) abort ()
+    do                                                                        \
+      {                                                                       \
+        if (thread_in_use () && rwlock_init (&NAME, USYNC_THREAD, NULL) != 0) \
+          abort ();                                                           \
+      }                                                                       \
+    while (0)
 # define gl_rwlock_rdlock(NAME) \
-    if (thread_in_use () && rw_rdlock (&NAME) != 0) abort ()
+    do                                                  \
+      {                                                 \
+        if (thread_in_use () && rw_rdlock (&NAME) != 0) \
+          abort ();                                     \
+      }                                                 \
+    while (0)
 # define gl_rwlock_wrlock(NAME) \
-    if (thread_in_use () && rw_wrlock (&NAME) != 0) abort ()
+    do                                                  \
+      {                                                 \
+        if (thread_in_use () && rw_wrlock (&NAME) != 0) \
+          abort ();                                     \
+      }                                                 \
+    while (0)
 # define gl_rwlock_unlock(NAME) \
-    if (thread_in_use () && rw_unlock (&NAME) != 0) abort ()
+    do                                                  \
+      {                                                 \
+        if (thread_in_use () && rw_unlock (&NAME) != 0) \
+          abort ();                                     \
+      }                                                 \
+    while (0)
 # define gl_rwlock_destroy(NAME) \
-    if (thread_in_use () && rwlock_destroy (&NAME) != 0) abort ()
+    do                                                       \
+      {                                                      \
+        if (thread_in_use () && rwlock_destroy (&NAME) != 0) \
+          abort ();                                          \
+      }                                                      \
+    while (0)
 
 /* --------------------- gl_recursive_lock_t datatype --------------------- */
 
@@ -581,13 +834,33 @@ typedef struct
 # define gl_recursive_lock_initializer \
     { DEFAULTMUTEX, (thread_t) 0, 0 }
 # define gl_recursive_lock_init(NAME) \
-    if (thread_in_use ()) glthread_recursive_lock_init (&NAME)
+    do                                          \
+      {                                         \
+        if (thread_in_use ())                   \
+          glthread_recursive_lock_init (&NAME); \
+      }                                         \
+    while (0)
 # define gl_recursive_lock_lock(NAME) \
-    if (thread_in_use ()) glthread_recursive_lock_lock (&NAME)
+    do                                          \
+      {                                         \
+        if (thread_in_use ())                   \
+          glthread_recursive_lock_lock (&NAME); \
+      }                                         \
+    while (0)
 # define gl_recursive_lock_unlock(NAME) \
-    if (thread_in_use ()) glthread_recursive_lock_unlock (&NAME)
+    do                                            \
+      {                                           \
+        if (thread_in_use ())                     \
+          glthread_recursive_lock_unlock (&NAME); \
+      }                                           \
+    while (0)
 # define gl_recursive_lock_destroy(NAME) \
-    if (thread_in_use ()) glthread_recursive_lock_destroy (&NAME)
+    do                                             \
+      {                                            \
+        if (thread_in_use ())                      \
+          glthread_recursive_lock_destroy (&NAME); \
+      }                                            \
+    while (0)
 extern void glthread_recursive_lock_init (gl_recursive_lock_t *lock);
 extern void glthread_recursive_lock_lock (gl_recursive_lock_t *lock);
 extern void glthread_recursive_lock_unlock (gl_recursive_lock_t *lock);
index eba131d1f273049bbc0f3137ff48f193dee686e1..f2f66637907ec09e6c710d5be1e951b8705c55ae 100644 (file)
@@ -4,7 +4,7 @@
 
    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)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    This program is distributed in the hope that it will be useful,
index 36b6c7577ed8a991bcf58e29162e3fe72225486b..6b9dd15134d042b55a5865e485ca8d39a04def0a 100644 (file)
@@ -1,19 +1,18 @@
 /* Copyright (C) 1999, 2001-2003, 2006-2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
-   This program is free software; you can redistribute it and/or modify
+   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.
+   the Free Software Foundation; either version 3 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.  */
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* Extracted from misc/mkdtemp.c.  */
 
diff --git a/gnulib/netinet_in.in.h b/gnulib/netinet_in.in.h
new file mode 100644 (file)
index 0000000..c45e53b
--- /dev/null
@@ -0,0 +1,43 @@
+/* Substitute for <netinet/in.h>.
+   Copyright (C) 2007 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 3, 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.  */
+
+#ifndef _GL_NETINET_IN_H
+
+#if @HAVE_NETINET_IN_H@
+
+/* On many platforms, <netinet/in.h> assumes prior inclusion of
+   <sys/types.h>.  */
+# include <sys/types.h>
+
+/* The include_next requires a split double-inclusion guard.  */
+# @INCLUDE_NEXT@ @NEXT_NETINET_IN_H@
+
+#endif
+
+#ifndef _GL_NETINET_IN_H
+#define _GL_NETINET_IN_H
+
+#if !@HAVE_NETINET_IN_H@
+
+/* A platform that lacks <netinet/in.h>.  */
+
+# include <sys/socket.h>
+
+#endif
+
+#endif /* _GL_NETINET_IN_H */
+#endif /* _GL_NETINET_IN_H */
diff --git a/gnulib/netinet_in_.h b/gnulib/netinet_in_.h
deleted file mode 100644 (file)
index aa00e45..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Substitute for <netinet/in.h>.
-   Copyright (C) 2007 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.  */
-
-#ifndef _GL_NETINET_IN_H
-
-#if @HAVE_NETINET_IN_H@
-
-/* On many platforms, <netinet/in.h> assumes prior inclusion of
-   <sys/types.h>.  */
-# include <sys/types.h>
-
-/* The include_next requires a split double-inclusion guard.  */
-# @INCLUDE_NEXT@ @NEXT_NETINET_IN_H@
-
-#endif
-
-#ifndef _GL_NETINET_IN_H
-#define _GL_NETINET_IN_H
-
-#if !@HAVE_NETINET_IN_H@
-
-/* A platform that lacks <netinet/in.h>.  */
-
-# include <sys/socket.h>
-
-#endif
-
-#endif /* _GL_NETINET_IN_H */
-#endif /* _GL_NETINET_IN_H */
index 844817bf0a98e2fd28ef3baa17c8808b86867185..4b532e1a083db6236548a9093493049a3c80f27f 100644 (file)
@@ -3,10 +3,10 @@
    Copyright (C) 2000, 2001, 2003, 2005, 2006 Free Software
    Foundation, Inc.
 
-   This program is free software; you can redistribute it and/or modify
+   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.
+   the Free Software Foundation; either version 3 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
@@ -14,8 +14,7 @@
    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.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* Written by Paul Eggert.  */
 
index 931aede2a334e0452276e887b5af9786dacddf43..95375d797ae2edd281552a6ab8b0190a2c130b64 100644 (file)
@@ -2,10 +2,10 @@
 
    Copyright (C) 2000, 2003 Free Software Foundation, Inc.
 
-   This program is free software; you can redistribute it and/or modify
+   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.
+   the Free Software Foundation; either version 3 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
@@ -13,8 +13,7 @@
    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.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* Written by Paul Eggert.  */
 
index 497891466239c9078089c1d9c813d14e8ae86a01..871c720a9931a1cb26a9d090c7ceac007835fd78 100644 (file)
@@ -3,7 +3,7 @@
 
    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)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    This program is distributed in the hope that it will be useful,
index 6f75e2aea40ab226dafd173c0c2cd0278e93e5f8..67cb990cad30aedd50637eec0a27430792d90dfa 100644 (file)
@@ -3,7 +3,7 @@
 
    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)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    This program is distributed in the hope that it will be useful,
index 2e679809779bf325d6b193e7c403e0d30773a672..28b9bd41acdc60614a836d1b9742e14c568d9adb 100644 (file)
@@ -1,9 +1,9 @@
 /* Formatted output to strings.
-   Copyright (C) 1999-2000, 2002-2003, 2006-2007 Free Software Foundation, Inc.
+   Copyright (C) 1999-2000, 2002-2003, 2006-2008 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)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    This program is distributed in the hope that it will be useful,
@@ -49,7 +49,7 @@
 #include <stddef.h>
 
 /* Get intmax_t.  */
-#ifdef IN_LIBINTL
+#if defined IN_LIBINTL || defined IN_LIBASPRINTF
 # if HAVE_STDINT_H_WITH_UINTMAX
 #  include <stdint.h>
 # endif
@@ -63,6 +63,9 @@
 /* malloc(), realloc(), free().  */
 #include <stdlib.h>
 
+/* errno.  */
+#include <errno.h>
+
 /* Checked size_t computations.  */
 #include "xsize.h"
 
@@ -89,7 +92,7 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
   d->dir = (DIRECTIVE *) malloc (d_allocated * sizeof (DIRECTIVE));
   if (d->dir == NULL)
     /* Out of memory.  */
-    return -1;
+    goto out_of_memory_1;
 
   a->count = 0;
   a_allocated = 0;
@@ -109,13 +112,13 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
        memory_size = xtimes (a_allocated, sizeof (argument));          \
        if (size_overflow_p (memory_size))                              \
          /* Overflow, would lead to out of memory.  */                 \
-         goto error;                                                   \
+         goto out_of_memory;                                           \
        memory = (argument *) (a->arg                                   \
                               ? realloc (a->arg, memory_size)          \
                               : malloc (memory_size));                 \
        if (memory == NULL)                                             \
          /* Out of memory.  */                                         \
-         goto error;                                                   \
+         goto out_of_memory;                                           \
        a->arg = memory;                                                \
       }                                                                        \
     while (a->count <= n)                                              \
@@ -389,6 +392,44 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
                        }
                      cp++;
                    }
+#if defined __APPLE__ && defined __MACH__
+                 /* On MacOS X 10.3, PRIdMAX is defined as "qd".
+                    We cannot change it to "lld" because PRIdMAX must also
+                    be understood by the system's printf routines.  */
+                 else if (*cp == 'q')
+                   {
+                     if (64 / 8 > sizeof (long))
+                       {
+                         /* int64_t = long long */
+                         flags += 16;
+                       }
+                     else
+                       {
+                         /* int64_t = long */
+                         flags += 8;
+                       }
+                     cp++;
+                   }
+#endif
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+                 /* On native Win32, PRIdMAX is defined as "I64d".
+                    We cannot change it to "lld" because PRIdMAX must also
+                    be understood by the system's printf routines.  */
+                 else if (*cp == 'I' && cp[1] == '6' && cp[2] == '4')
+                   {
+                     if (64 / 8 > sizeof (long))
+                       {
+                         /* __int64 = long long */
+                         flags += 16;
+                       }
+                     else
+                       {
+                         /* __int64 = long */
+                         flags += 8;
+                       }
+                     cp += 3;
+                   }
+#endif
                  else
                    break;
                }
@@ -539,11 +580,11 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
              memory_size = xtimes (d_allocated, sizeof (DIRECTIVE));
              if (size_overflow_p (memory_size))
                /* Overflow, would lead to out of memory.  */
-               goto error;
+               goto out_of_memory;
              memory = (DIRECTIVE *) realloc (d->dir, memory_size);
              if (memory == NULL)
                /* Out of memory.  */
-               goto error;
+               goto out_of_memory;
              d->dir = memory;
            }
        }
@@ -566,6 +607,16 @@ error:
     free (a->arg);
   if (d->dir)
     free (d->dir);
+  errno = EINVAL;
+  return -1;
+
+out_of_memory:
+  if (a->arg)
+    free (a->arg);
+  if (d->dir)
+    free (d->dir);
+out_of_memory_1:
+  errno = ENOMEM;
   return -1;
 }
 
index de7fc49b6fbc17d79196cdd59b6eac099ba63624..e5d68d758849ea134b723b87d03202a15f98838e 100644 (file)
@@ -3,7 +3,7 @@
 
    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)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    This program is distributed in the hope that it will be useful,
diff --git a/gnulib/regenerate/no-restrict.patch b/gnulib/regenerate/no-restrict.patch
new file mode 100644 (file)
index 0000000..dbb5809
--- /dev/null
@@ -0,0 +1,217 @@
+Index: gnulib/inet_ntop.c
+===================================================================
+--- gnulib/inet_ntop.c (revision 10693)
++++ gnulib/inet_ntop.c (working copy)
+@@ -70,8 +70,8 @@
+  *    Paul Vixie, 1996.
+  */
+ const char *
+-inet_ntop (int af, const void *restrict src,
+-         char *restrict dst, socklen_t cnt)
++inet_ntop (int af, const void *src,
++         char *dst, socklen_t cnt)
+ {
+   switch (af)
+     {
+Index: gnulib/inet_ntop.h
+===================================================================
+--- gnulib/inet_ntop.h (revision 10693)
++++ gnulib/inet_ntop.h (working copy)
+@@ -37,6 +37,6 @@
+    <http://www.opengroup.org/susv3xsh/inet_ntop.html>.  */
+ #if !HAVE_DECL_INET_NTOP
+-extern const char *inet_ntop (int af, const void *restrict src,
+-                            char *restrict dst, socklen_t cnt);
++extern const char *inet_ntop (int af, const void *src,
++                            char *dst, socklen_t cnt);
+ #endif
+Index: gnulib/string.in.h
+===================================================================
+--- gnulib/string.in.h (revision 10693)
++++ gnulib/string.in.h (working copy)
+@@ -68,7 +68,7 @@
+    last written byte.  */
+ #if @GNULIB_MEMPCPY@
+ # if ! @HAVE_MEMPCPY@
+-extern void *mempcpy (void *restrict __dest, void const *restrict __src,
++extern void *mempcpy (void *__dest, void const *__src,
+                     size_t __n);
+ # endif
+ #elif defined GNULIB_POSIXCHECK
+@@ -96,7 +96,7 @@
+ /* Copy SRC to DST, returning the address of the terminating '\0' in DST.  */
+ #if @GNULIB_STPCPY@
+ # if ! @HAVE_STPCPY@
+-extern char *stpcpy (char *restrict __dst, char const *restrict __src);
++extern char *stpcpy (char *__dst, char const *__src);
+ # endif
+ #elif defined GNULIB_POSIXCHECK
+ # undef stpcpy
+@@ -111,7 +111,7 @@
+ #if @GNULIB_STPNCPY@
+ # if ! @HAVE_STPNCPY@
+ #  define stpncpy gnu_stpncpy
+-extern char *stpncpy (char *restrict __dst, char const *restrict __src,
++extern char *stpncpy (char *__dst, char const *__src,
+                     size_t __n);
+ # endif
+ #elif defined GNULIB_POSIXCHECK
+@@ -272,7 +272,7 @@
+    See also strtok_r().  */
+ #if @GNULIB_STRSEP@
+ # if ! @HAVE_STRSEP@
+-extern char *strsep (char **restrict __stringp, char const *restrict __delim);
++extern char *strsep (char **__stringp, char const *__delim);
+ # endif
+ # if defined GNULIB_POSIXCHECK
+ #  undef strsep
+@@ -359,8 +359,8 @@
+    See also strsep().  */
+ #if @GNULIB_STRTOK_R@
+ # if ! @HAVE_DECL_STRTOK_R@
+-extern char *strtok_r (char *restrict s, char const *restrict delim,
+-                     char **restrict save_ptr);
++extern char *strtok_r (char *s, char const *delim,
++                     char **save_ptr);
+ # endif
+ # if defined GNULIB_POSIXCHECK
+ #  undef strtok_r
+Index: gnulib/gettimeofday.c
+===================================================================
+--- gnulib/gettimeofday.c      (revision 10693)
++++ gnulib/gettimeofday.c      (working copy)
+@@ -98,7 +98,7 @@
+    causes problems.  */
+ int
+-rpl_gettimeofday (struct timeval *restrict tv, void *restrict tz)
++rpl_gettimeofday (struct timeval *tv, void *tz)
+ {
+ #undef gettimeofday
+ #if HAVE_GETTIMEOFDAY
+Index: gnulib/sys_time.in.h
+===================================================================
+--- gnulib/sys_time.in.h       (revision 10693)
++++ gnulib/sys_time.in.h       (working copy)
+@@ -46,7 +46,7 @@
+ # if @REPLACE_GETTIMEOFDAY@
+ #  undef gettimeofday
+ #  define gettimeofday rpl_gettimeofday
+-int gettimeofday (struct timeval *restrict, void *restrict);
++int gettimeofday (struct timeval *, void *);
+ # endif
+ #endif /* _GL_SYS_TIME_H */
+Index: gnulib/base64.c
+===================================================================
+--- gnulib/base64.c    (revision 10693)
++++ gnulib/base64.c    (working copy)
+@@ -64,8 +64,8 @@
+    possible.  If OUTLEN is larger than BASE64_LENGTH(INLEN), also zero
+    terminate the output buffer. */
+ void
+-base64_encode (const char *restrict in, size_t inlen,
+-             char *restrict out, size_t outlen)
++base64_encode (const char *in, size_t inlen,
++             char *out, size_t outlen)
+ {
+   static const char b64str[64] =
+     "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+@@ -310,8 +310,8 @@
+    that, when applicable, you must remove any line terminators that is
+    part of the data stream before calling this function.  */
+ bool
+-base64_decode (const char *restrict in, size_t inlen,
+-             char *restrict out, size_t *outlen)
++base64_decode (const char *in, size_t inlen,
++             char *out, size_t *outlen)
+ {
+   size_t outleft = *outlen;
+Index: gnulib/getaddrinfo.c
+===================================================================
+--- gnulib/getaddrinfo.c       (revision 10693)
++++ gnulib/getaddrinfo.c       (working copy)
+@@ -123,10 +123,10 @@
+ /* Translate name of a service location and/or a service name to set of
+    socket addresses. */
+ int
+-getaddrinfo (const char *restrict nodename,
+-           const char *restrict servname,
+-           const struct addrinfo *restrict hints,
+-           struct addrinfo **restrict res)
++getaddrinfo (const char *nodename,
++           const char *servname,
++           const struct addrinfo *hints,
++           struct addrinfo **res)
+ {
+   struct addrinfo *tmp;
+   int port = 0;
+@@ -337,9 +337,9 @@
+     }
+ }
+-int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen,
+-              char *restrict node, socklen_t nodelen,
+-              char *restrict service, socklen_t servicelen,
++int getnameinfo(const struct sockaddr *sa, socklen_t salen,
++              char *node, socklen_t nodelen,
++              char *service, socklen_t servicelen,
+               int flags)
+ {
+ #ifdef WIN32_NATIVE
+Index: gnulib/base64.h
+===================================================================
+--- gnulib/base64.h    (revision 10693)
++++ gnulib/base64.h    (working copy)
+@@ -31,13 +31,13 @@
+ extern bool isbase64 (char ch);
+-extern void base64_encode (const char *restrict in, size_t inlen,
+-                         char *restrict out, size_t outlen);
++extern void base64_encode (const char *in, size_t inlen,
++                         char *out, size_t outlen);
+ extern size_t base64_encode_alloc (const char *in, size_t inlen, char **out);
+-extern bool base64_decode (const char *restrict in, size_t inlen,
+-                         char *restrict out, size_t *outlen);
++extern bool base64_decode (const char *in, size_t inlen,
++                         char *out, size_t *outlen);
+ extern bool base64_decode_alloc (const char *in, size_t inlen,
+                                char **out, size_t *outlen);
+Index: gnulib/getaddrinfo.h
+===================================================================
+--- gnulib/getaddrinfo.h       (revision 10693)
++++ gnulib/getaddrinfo.h       (working copy)
+@@ -113,10 +113,10 @@
+    socket addresses.
+    For more details, see the POSIX:2001 specification
+    <http://www.opengroup.org/susv3xsh/getaddrinfo.html>.  */
+-extern int getaddrinfo (const char *restrict nodename,
+-                      const char *restrict servname,
+-                      const struct addrinfo *restrict hints,
+-                      struct addrinfo **restrict res);
++extern int getaddrinfo (const char *nodename,
++                      const char *servname,
++                      const struct addrinfo *hints,
++                      struct addrinfo **res);
+ #endif
+ #if !HAVE_DECL_FREEADDRINFO
+@@ -137,9 +137,9 @@
+ /* Convert socket address to printable node and service names.
+    For more details, see the POSIX:2001 specification
+    <http://www.opengroup.org/susv3xsh/getnameinfo.html>.  */
+-extern int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen,
+-                     char *restrict node, socklen_t nodelen,
+-                     char *restrict service, socklen_t servicelen,
++extern int getnameinfo(const struct sockaddr *sa, socklen_t salen,
++                     char *node, socklen_t nodelen,
++                     char *service, socklen_t servicelen,
+                      int flags);
+ #endif
index a32ab348b93e2dede03fa7401213099f9a5cef06..5669916877d155590ea73614af595138a9ddc032 100755 (executable)
@@ -1,7 +1,10 @@
 #! /bin/bash
 
-# Gnulib files in zmanda repo are from gnulib CVS updated with:
-#   cvs update -D '2007-10-25 17:00:00 -0600'
+# Gnulib files in zmanda repo are from gnulib GIT.  To check out the
+# same version as was used to generate the source in the repository,
+# run the following in your git repository:
+#
+#   git checkout 03400ebfaa064922caf3767d6641d7e1cdc8cd1b
 
 # get to the project root
 cd `dirname $0`/../..
@@ -36,7 +39,8 @@ shopt -u nullglob
 ## Add your modules here, then see below if you need to patch them. ##
 ######################################################################
 
-GNULIB_MODULES="getaddrinfo lock visibility base64 physmem fsusage mkdtemp"
+GNULIB_MODULES="getaddrinfo lock visibility base64 physmem fsusage"
+GNULIB_MODULES="$GNULIB_MODULES mkdtemp getopt full-read full-write"
 
 ######################################################################
 ## End modules                                                      ##
@@ -59,16 +63,17 @@ PATCH_DIR="`pwd`/gnulib/regenerate"
 # Patch Makefile.am to not error out on warnings
 patch -p0 < "${PATCH_DIR}/no-error.patch" || exit 1
 
-
 # Add John's patches to getaddrinfo.c for use in cygwin
 patch -p0 < "${PATCH_DIR}/getaddrinfo-cygwin.patch" || exit 1
 
+# Add John's patches to eliminate restrict attributes.
+patch -p0 < "${PATCH_DIR}/no-restrict.patch" || exit 1
 
 # Add info to the makefile to ensure all this stuff gets put in
 # the distribution tarball
 (   echo ""
     echo "# Make sure regenerate/* are in the distribution tarball"
-    echo "EXTRA_DIST += "`cd gnulib; find regenerate -name .svn -prune -o -type f -print `
+    echo "EXTRA_DIST += "`cd gnulib; find regenerate -name .svn -prune -o -type f -print | sort`
 ) >> gnulib/Makefile.am
 
 ######################################################################
index b7bf1d5cd60ef2cf12de123820a17d147af6a7c2..0cb1edee8bc789ab6589d2cd93c7e265ce1a418a 100644 (file)
@@ -3,10 +3,10 @@
    Copyright (C) 1993, 1994, 1998, 2002, 2003, 2004, 2005, 2006 Free
    Software Foundation, Inc.
 
-   This program is free software; you can redistribute it and/or modify
+   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.
+   the Free Software Foundation; either version 3 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
@@ -14,8 +14,7 @@
    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.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 
index 3451955ad4ff40e11cd846090caff89496722cfd..ba191713b681712ab85b59953e256a78a8b2d978 100644 (file)
@@ -1,10 +1,10 @@
 /* An interface to read() that retries after interrupts.
    Copyright (C) 2002, 2006 Free Software Foundation, Inc.
 
-   This program is free software; you can redistribute it and/or modify
+   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.
+   the Free Software Foundation; either version 3 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
@@ -12,8 +12,7 @@
    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.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <stddef.h>
 
index 4c375a6ca1905cde59f23f95d03a94b6d9865862..b644f7cff3aae6127cd5bbddda40f161419d1e5a 100644 (file)
@@ -1,10 +1,10 @@
 /* An interface to write that retries after interrupts.
    Copyright (C) 2002 Free Software Foundation, Inc.
 
-   This program is free software; you can redistribute it and/or modify
+   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.
+   the Free Software Foundation; either version 3 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
@@ -12,8 +12,7 @@
    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.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #define SAFE_WRITE
 #include "safe-read.c"
index c194636209f7a139251e4999b8cd1a5a6437535d..da036a97a1054a600bf808f5b9ed89969996c4ae 100644 (file)
@@ -1,10 +1,10 @@
 /* An interface to write() that retries after interrupts.
    Copyright (C) 2002 Free Software Foundation, Inc.
 
-   This program is free software; you can redistribute it and/or modify
+   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.
+   the Free Software Foundation; either version 3 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
@@ -12,8 +12,7 @@
    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.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <stddef.h>
 
index ed0bc137712250b0d4ae0aa44f5121c6f3890f2c..2ccc5f08624ca8fe0b086237bdc7a2b1cd112376 100644 (file)
@@ -4,7 +4,7 @@
 
    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)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    This program is distributed in the hope that it will be useful,
index 7314c83a3e11e81a35881cca16e224fc3c4719fe..960cfdb4060b5f5125702c79fabdfd826cc1357b 100644 (file)
@@ -4,7 +4,7 @@
 
    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)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    This program is distributed in the hope that it will be useful,
diff --git a/gnulib/stdbool.in.h b/gnulib/stdbool.in.h
new file mode 100644 (file)
index 0000000..171d70a
--- /dev/null
@@ -0,0 +1,119 @@
+/* Copyright (C) 2001, 2002, 2003, 2006, 2007 Free Software Foundation, Inc.
+   Written by Bruno Haible <haible@clisp.cons.org>, 2001.
+
+   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 3, 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.  */
+
+#ifndef _GL_STDBOOL_H
+#define _GL_STDBOOL_H
+
+/* ISO C 99 <stdbool.h> for platforms that lack it.  */
+
+/* Usage suggestions:
+
+   Programs that use <stdbool.h> should be aware of some limitations
+   and standards compliance issues.
+
+   Standards compliance:
+
+       - <stdbool.h> must be #included before 'bool', 'false', 'true'
+         can be used.
+
+       - You cannot assume that sizeof (bool) == 1.
+
+       - Programs should not undefine the macros bool, true, and false,
+         as C99 lists that as an "obsolescent feature".
+
+   Limitations of this substitute, when used in a C89 environment:
+
+       - <stdbool.h> must be #included before the '_Bool' type can be used.
+
+       - You cannot assume that _Bool is a typedef; it might be a macro.
+
+       - Bit-fields of type 'bool' are not supported.  Portable code
+         should use 'unsigned int foo : 1;' rather than 'bool foo : 1;'.
+
+       - In C99, casts and automatic conversions to '_Bool' or 'bool' are
+         performed in such a way that every nonzero value gets converted
+         to 'true', and zero gets converted to 'false'.  This doesn't work
+         with this substitute.  With this substitute, only the values 0 and 1
+         give the expected result when converted to _Bool' or 'bool'.
+
+   Also, it is suggested that programs use 'bool' rather than '_Bool';
+   this isn't required, but 'bool' is more common.  */
+
+
+/* 7.16. Boolean type and values */
+
+/* BeOS <sys/socket.h> already #defines false 0, true 1.  We use the same
+   definitions below, but temporarily we have to #undef them.  */
+#ifdef __BEOS__
+# include <OS.h> /* defines bool but not _Bool */
+# undef false
+# undef true
+#endif
+
+/* For the sake of symbolic names in gdb, we define true and false as
+   enum constants, not only as macros.
+   It is tempting to write
+      typedef enum { false = 0, true = 1 } _Bool;
+   so that gdb prints values of type 'bool' symbolically. But if we do
+   this, values of type '_Bool' may promote to 'int' or 'unsigned int'
+   (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int'
+   (see ISO C 99 6.3.1.1.(2)).  So we add a negative value to the
+   enum; this ensures that '_Bool' promotes to 'int'.  */
+#if defined __cplusplus || defined __BEOS__
+  /* A compiler known to have 'bool'.  */
+  /* If the compiler already has both 'bool' and '_Bool', we can assume they
+     are the same types.  */
+# if !@HAVE__BOOL@
+typedef bool _Bool;
+# endif
+#else
+# if !defined __GNUC__
+   /* If @HAVE__BOOL@:
+        Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when
+        the built-in _Bool type is used.  See
+          http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
+          http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
+          http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
+        Similar bugs are likely with other compilers as well; this file
+        wouldn't be used if <stdbool.h> was working.
+        So we override the _Bool type.
+      If !@HAVE__BOOL@:
+        Need to define _Bool ourselves. As 'signed char' or as an enum type?
+        Use of a typedef, with SunPRO C, leads to a stupid
+          "warning: _Bool is a keyword in ISO C99".
+        Use of an enum type, with IRIX cc, leads to a stupid
+          "warning(1185): enumerated type mixed with another type".
+        Even the existence of an enum type, without a typedef,
+          "Invalid enumerator. (badenum)" with HP-UX cc on Tru64.
+        The only benefit of the enum, debuggability, is not important
+        with these compilers.  So use 'signed char' and no enum.  */
+#  define _Bool signed char
+# else
+   /* With this compiler, trust the _Bool type if the compiler has it.  */
+#  if !@HAVE__BOOL@
+typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool;
+#  endif
+# endif
+#endif
+#define bool _Bool
+
+/* The other macros must be usable in preprocessor directives.  */
+#define false 0
+#define true 1
+#define __bool_true_false_are_defined 1
+
+#endif /* _GL_STDBOOL_H */
diff --git a/gnulib/stdbool_.h b/gnulib/stdbool_.h
deleted file mode 100644 (file)
index 150a010..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-/* Copyright (C) 2001, 2002, 2003, 2006, 2007 Free Software Foundation, Inc.
-   Written by Bruno Haible <haible@clisp.cons.org>, 2001.
-
-   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.  */
-
-#ifndef _GL_STDBOOL_H
-#define _GL_STDBOOL_H
-
-/* ISO C 99 <stdbool.h> for platforms that lack it.  */
-
-/* Usage suggestions:
-
-   Programs that use <stdbool.h> should be aware of some limitations
-   and standards compliance issues.
-
-   Standards compliance:
-
-       - <stdbool.h> must be #included before 'bool', 'false', 'true'
-         can be used.
-
-       - You cannot assume that sizeof (bool) == 1.
-
-       - Programs should not undefine the macros bool, true, and false,
-         as C99 lists that as an "obsolescent feature".
-
-   Limitations of this substitute, when used in a C89 environment:
-
-       - <stdbool.h> must be #included before the '_Bool' type can be used.
-
-       - You cannot assume that _Bool is a typedef; it might be a macro.
-
-       - Bit-fields of type 'bool' are not supported.  Portable code
-         should use 'unsigned int foo : 1;' rather than 'bool foo : 1;'.
-
-       - In C99, casts and automatic conversions to '_Bool' or 'bool' are
-         performed in such a way that every nonzero value gets converted
-         to 'true', and zero gets converted to 'false'.  This doesn't work
-         with this substitute.  With this substitute, only the values 0 and 1
-         give the expected result when converted to _Bool' or 'bool'.
-
-   Also, it is suggested that programs use 'bool' rather than '_Bool';
-   this isn't required, but 'bool' is more common.  */
-
-
-/* 7.16. Boolean type and values */
-
-/* BeOS <sys/socket.h> already #defines false 0, true 1.  We use the same
-   definitions below, but temporarily we have to #undef them.  */
-#ifdef __BEOS__
-# include <OS.h> /* defines bool but not _Bool */
-# undef false
-# undef true
-#endif
-
-/* For the sake of symbolic names in gdb, we define true and false as
-   enum constants, not only as macros.
-   It is tempting to write
-      typedef enum { false = 0, true = 1 } _Bool;
-   so that gdb prints values of type 'bool' symbolically. But if we do
-   this, values of type '_Bool' may promote to 'int' or 'unsigned int'
-   (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int'
-   (see ISO C 99 6.3.1.1.(2)).  So we add a negative value to the
-   enum; this ensures that '_Bool' promotes to 'int'.  */
-#if defined __cplusplus || defined __BEOS__
-  /* A compiler known to have 'bool'.  */
-  /* If the compiler already has both 'bool' and '_Bool', we can assume they
-     are the same types.  */
-# if !@HAVE__BOOL@
-typedef bool _Bool;
-# endif
-#else
-# if !defined __GNUC__
-   /* If @HAVE__BOOL@:
-        Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when
-        the built-in _Bool type is used.  See
-          http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
-          http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
-          http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
-        Similar bugs are likely with other compilers as well; this file
-        wouldn't be used if <stdbool.h> was working.
-        So we override the _Bool type.
-      If !@HAVE__BOOL@:
-        Need to define _Bool ourselves. As 'signed char' or as an enum type?
-        Use of a typedef, with SunPRO C, leads to a stupid
-          "warning: _Bool is a keyword in ISO C99".
-        Use of an enum type, with IRIX cc, leads to a stupid
-          "warning(1185): enumerated type mixed with another type".
-        The only benefit of the enum type, debuggability, is not important
-        with these compilers.  So use 'signed char' and no typedef.  */
-#  define _Bool signed char
-enum { false = 0, true = 1 };
-# else
-   /* With this compiler, trust the _Bool type if the compiler has it.  */
-#  if !@HAVE__BOOL@
-typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool;
-#  endif
-# endif
-#endif
-#define bool _Bool
-
-/* The other macros must be usable in preprocessor directives.  */
-#define false 0
-#define true 1
-#define __bool_true_false_are_defined 1
-
-#endif /* _GL_STDBOOL_H */
diff --git a/gnulib/stdint.in.h b/gnulib/stdint.in.h
new file mode 100644 (file)
index 0000000..67baceb
--- /dev/null
@@ -0,0 +1,522 @@
+/* Copyright (C) 2001-2002, 2004-2007 Free Software Foundation, Inc.
+   Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
+   This file is part of gnulib.
+
+   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 3, 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.  */
+
+/*
+ * ISO C 99 <stdint.h> for platforms that lack it.
+ * <http://www.opengroup.org/susv3xbd/stdint.h.html>
+ */
+
+#ifndef _GL_STDINT_H
+
+/* When including a system file that in turn includes <inttypes.h>,
+   use the system <inttypes.h>, not our substitute.  This avoids
+   problems with (for example) VMS, whose <sys/bitypes.h> includes
+   <inttypes.h>.  */
+#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
+
+/* Get those types that are already defined in other system include
+   files, so that we can "#define int8_t signed char" below without
+   worrying about a later system include file containing a "typedef
+   signed char int8_t;" that will get messed up by our macro.  Our
+   macros should all be consistent with the system versions, except
+   for the "fast" types and macros, which we recommend against using
+   in public interfaces due to compiler differences.  */
+
+#if @HAVE_STDINT_H@
+# if defined __sgi && ! defined __c99
+   /* Bypass IRIX's <stdint.h> if in C89 mode, since it merely annoys users
+      with "This header file is to be used only for c99 mode compilations"
+      diagnostics.  */
+#  define __STDINT_H__
+# endif
+  /* Other systems may have an incomplete or buggy <stdint.h>.
+     Include it before <inttypes.h>, since any "#include <stdint.h>"
+     in <inttypes.h> would reinclude us, skipping our contents because
+     _GL_STDINT_H is defined.
+     The include_next requires a split double-inclusion guard.  */
+# @INCLUDE_NEXT@ @NEXT_STDINT_H@
+#endif
+
+#if ! defined _GL_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H
+#define _GL_STDINT_H
+
+/* <sys/types.h> defines some of the stdint.h types as well, on glibc,
+   IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>).
+   AIX 5.2 <sys/types.h> isn't needed and causes troubles.
+   MacOS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but
+   relies on the system <stdint.h> definitions, so include
+   <sys/types.h> after @NEXT_STDINT_H@.  */
+#if @HAVE_SYS_TYPES_H@ && ! defined _AIX
+# include <sys/types.h>
+#endif
+
+/* Get LONG_MIN, LONG_MAX, ULONG_MAX.  */
+#include <limits.h>
+
+#if @HAVE_INTTYPES_H@
+  /* In OpenBSD 3.8, <inttypes.h> includes <machine/types.h>, which defines
+     int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__.
+     <inttypes.h> also defines intptr_t and uintptr_t.  */
+# include <inttypes.h>
+#elif @HAVE_SYS_INTTYPES_H@
+  /* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and
+     the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX.  */
+# include <sys/inttypes.h>
+#endif
+
+#if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__
+  /* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines
+     int{8,16,32,64}_t and __BIT_TYPES_DEFINED__.  In libc5 >= 5.2.2 it is
+     included by <sys/types.h>.  */
+# include <sys/bitypes.h>
+#endif
+
+#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
+
+/* Get WCHAR_MIN, WCHAR_MAX.  */
+# if ! (defined WCHAR_MIN && defined WCHAR_MAX)
+#  include <wchar.h>
+# endif
+
+#endif
+
+#undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
+
+/* Minimum and maximum values for a integer type under the usual assumption.
+   Return an unspecified value if BITS == 0, adding a check to pacify
+   picky compilers.  */
+
+#define _STDINT_MIN(signed, bits, zero) \
+  ((signed) ? (- ((zero) + 1) << ((bits) ? (bits) - 1 : 0)) : (zero))
+
+#define _STDINT_MAX(signed, bits, zero) \
+  ((signed) \
+   ? ~ _STDINT_MIN (signed, bits, zero) \
+   : /* The expression for the unsigned case.  The subtraction of (signed) \
+       is a nop in the unsigned case and avoids "signed integer overflow" \
+       warnings in the signed case.  */ \
+     ((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1)
+
+/* 7.18.1.1. Exact-width integer types */
+
+/* Here we assume a standard architecture where the hardware integer
+   types have 8, 16, 32, optionally 64 bits.  */
+
+#undef int8_t
+#undef uint8_t
+#define int8_t signed char
+#define uint8_t unsigned char
+
+#undef int16_t
+#undef uint16_t
+#define int16_t short int
+#define uint16_t unsigned short int
+
+#undef int32_t
+#undef uint32_t
+#define int32_t int
+#define uint32_t unsigned int
+
+/* Do not undefine int64_t if gnulib is not being used with 64-bit
+   types, since otherwise it breaks platforms like Tandem/NSK.  */
+#if LONG_MAX >> 31 >> 31 == 1
+# undef int64_t
+# define int64_t long int
+# define GL_INT64_T
+#elif defined _MSC_VER
+# undef int64_t
+# define int64_t __int64
+# define GL_INT64_T
+#elif @HAVE_LONG_LONG_INT@
+# undef int64_t
+# define int64_t long long int
+# define GL_INT64_T
+#endif
+
+#if ULONG_MAX >> 31 >> 31 >> 1 == 1
+# undef uint64_t
+# define uint64_t unsigned long int
+# define GL_UINT64_T
+#elif defined _MSC_VER
+# undef uint64_t
+# define uint64_t unsigned __int64
+# define GL_UINT64_T
+#elif @HAVE_UNSIGNED_LONG_LONG_INT@
+# undef uint64_t
+# define uint64_t unsigned long long int
+# define GL_UINT64_T
+#endif
+
+/* Avoid collision with Solaris 2.5.1 <pthread.h> etc.  */
+#define _UINT8_T
+#define _UINT32_T
+#define _UINT64_T
+
+
+/* 7.18.1.2. Minimum-width integer types */
+
+/* Here we assume a standard architecture where the hardware integer
+   types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
+   are the same as the corresponding N_t types.  */
+
+#undef int_least8_t
+#undef uint_least8_t
+#undef int_least16_t
+#undef uint_least16_t
+#undef int_least32_t
+#undef uint_least32_t
+#undef int_least64_t
+#undef uint_least64_t
+#define int_least8_t int8_t
+#define uint_least8_t uint8_t
+#define int_least16_t int16_t
+#define uint_least16_t uint16_t
+#define int_least32_t int32_t
+#define uint_least32_t uint32_t
+#ifdef GL_INT64_T
+# define int_least64_t int64_t
+#endif
+#ifdef GL_UINT64_T
+# define uint_least64_t uint64_t
+#endif
+
+/* 7.18.1.3. Fastest minimum-width integer types */
+
+/* Note: Other <stdint.h> substitutes may define these types differently.
+   It is not recommended to use these types in public header files. */
+
+/* Here we assume a standard architecture where the hardware integer
+   types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
+   are taken from the same list of types.  Assume that 'long int'
+   is fast enough for all narrower integers.  */
+
+#undef int_fast8_t
+#undef uint_fast8_t
+#undef int_fast16_t
+#undef uint_fast16_t
+#undef int_fast32_t
+#undef uint_fast32_t
+#undef int_fast64_t
+#undef uint_fast64_t
+#define int_fast8_t long int
+#define uint_fast8_t unsigned int_fast8_t
+#define int_fast16_t long int
+#define uint_fast16_t unsigned int_fast16_t
+#define int_fast32_t long int
+#define uint_fast32_t unsigned int_fast32_t
+#ifdef GL_INT64_T
+# define int_fast64_t int64_t
+#endif
+#ifdef GL_UINT64_T
+# define uint_fast64_t uint64_t
+#endif
+
+/* 7.18.1.4. Integer types capable of holding object pointers */
+
+#undef intptr_t
+#undef uintptr_t
+#define intptr_t long int
+#define uintptr_t unsigned long int
+
+/* 7.18.1.5. Greatest-width integer types */
+
+/* Note: These types are compiler dependent. It may be unwise to use them in
+   public header files. */
+
+#undef intmax_t
+#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
+# define intmax_t long long int
+#elif defined GL_INT64_T
+# define intmax_t int64_t
+#else
+# define intmax_t long int
+#endif
+
+#undef uintmax_t
+#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
+# define uintmax_t unsigned long long int
+#elif defined GL_UINT64_T
+# define uintmax_t uint64_t
+#else
+# define uintmax_t unsigned long int
+#endif
+
+/* Verify that intmax_t and uintmax_t have the same size.  Too much code
+   breaks if this is not the case.  If this check fails, the reason is likely
+   to be found in the autoconf macros.  */
+typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) - 1];
+
+/* 7.18.2. Limits of specified-width integer types */
+
+#if ! defined __cplusplus || defined __STDC_LIMIT_MACROS
+
+/* 7.18.2.1. Limits of exact-width integer types */
+
+/* Here we assume a standard architecture where the hardware integer
+   types have 8, 16, 32, optionally 64 bits.  */
+
+#undef INT8_MIN
+#undef INT8_MAX
+#undef UINT8_MAX
+#define INT8_MIN  (~ INT8_MAX)
+#define INT8_MAX  127
+#define UINT8_MAX  255
+
+#undef INT16_MIN
+#undef INT16_MAX
+#undef UINT16_MAX
+#define INT16_MIN  (~ INT16_MAX)
+#define INT16_MAX  32767
+#define UINT16_MAX  65535
+
+#undef INT32_MIN
+#undef INT32_MAX
+#undef UINT32_MAX
+#define INT32_MIN  (~ INT32_MAX)
+#define INT32_MAX  2147483647
+#define UINT32_MAX  4294967295U
+
+#undef INT64_MIN
+#undef INT64_MAX
+#ifdef GL_INT64_T
+/* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0
+   evaluates the latter incorrectly in preprocessor expressions.  */
+# define INT64_MIN  (- INTMAX_C (1) << 63)
+# define INT64_MAX  INTMAX_C (9223372036854775807)
+#endif
+
+#undef UINT64_MAX
+#ifdef GL_UINT64_T
+# define UINT64_MAX  UINTMAX_C (18446744073709551615)
+#endif
+
+/* 7.18.2.2. Limits of minimum-width integer types */
+
+/* Here we assume a standard architecture where the hardware integer
+   types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
+   are the same as the corresponding N_t types.  */
+
+#undef INT_LEAST8_MIN
+#undef INT_LEAST8_MAX
+#undef UINT_LEAST8_MAX
+#define INT_LEAST8_MIN  INT8_MIN
+#define INT_LEAST8_MAX  INT8_MAX
+#define UINT_LEAST8_MAX  UINT8_MAX
+
+#undef INT_LEAST16_MIN
+#undef INT_LEAST16_MAX
+#undef UINT_LEAST16_MAX
+#define INT_LEAST16_MIN  INT16_MIN
+#define INT_LEAST16_MAX  INT16_MAX
+#define UINT_LEAST16_MAX  UINT16_MAX
+
+#undef INT_LEAST32_MIN
+#undef INT_LEAST32_MAX
+#undef UINT_LEAST32_MAX
+#define INT_LEAST32_MIN  INT32_MIN
+#define INT_LEAST32_MAX  INT32_MAX
+#define UINT_LEAST32_MAX  UINT32_MAX
+
+#undef INT_LEAST64_MIN
+#undef INT_LEAST64_MAX
+#ifdef GL_INT64_T
+# define INT_LEAST64_MIN  INT64_MIN
+# define INT_LEAST64_MAX  INT64_MAX
+#endif
+
+#undef UINT_LEAST64_MAX
+#ifdef GL_UINT64_T
+# define UINT_LEAST64_MAX  UINT64_MAX
+#endif
+
+/* 7.18.2.3. Limits of fastest minimum-width integer types */
+
+/* Here we assume a standard architecture where the hardware integer
+   types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
+   are taken from the same list of types.  */
+
+#undef INT_FAST8_MIN
+#undef INT_FAST8_MAX
+#undef UINT_FAST8_MAX
+#define INT_FAST8_MIN  LONG_MIN
+#define INT_FAST8_MAX  LONG_MAX
+#define UINT_FAST8_MAX  ULONG_MAX
+
+#undef INT_FAST16_MIN
+#undef INT_FAST16_MAX
+#undef UINT_FAST16_MAX
+#define INT_FAST16_MIN  LONG_MIN
+#define INT_FAST16_MAX  LONG_MAX
+#define UINT_FAST16_MAX  ULONG_MAX
+
+#undef INT_FAST32_MIN
+#undef INT_FAST32_MAX
+#undef UINT_FAST32_MAX
+#define INT_FAST32_MIN  LONG_MIN
+#define INT_FAST32_MAX  LONG_MAX
+#define UINT_FAST32_MAX  ULONG_MAX
+
+#undef INT_FAST64_MIN
+#undef INT_FAST64_MAX
+#ifdef GL_INT64_T
+# define INT_FAST64_MIN  INT64_MIN
+# define INT_FAST64_MAX  INT64_MAX
+#endif
+
+#undef UINT_FAST64_MAX
+#ifdef GL_UINT64_T
+# define UINT_FAST64_MAX  UINT64_MAX
+#endif
+
+/* 7.18.2.4. Limits of integer types capable of holding object pointers */
+
+#undef INTPTR_MIN
+#undef INTPTR_MAX
+#undef UINTPTR_MAX
+#define INTPTR_MIN  LONG_MIN
+#define INTPTR_MAX  LONG_MAX
+#define UINTPTR_MAX  ULONG_MAX
+
+/* 7.18.2.5. Limits of greatest-width integer types */
+
+#undef INTMAX_MIN
+#undef INTMAX_MAX
+#ifdef INT64_MAX
+# define INTMAX_MIN  INT64_MIN
+# define INTMAX_MAX  INT64_MAX
+#else
+# define INTMAX_MIN  INT32_MIN
+# define INTMAX_MAX  INT32_MAX
+#endif
+
+#undef UINTMAX_MAX
+#ifdef UINT64_MAX
+# define UINTMAX_MAX  UINT64_MAX
+#else
+# define UINTMAX_MAX  UINT32_MAX
+#endif
+
+/* 7.18.3. Limits of other integer types */
+
+/* ptrdiff_t limits */
+#undef PTRDIFF_MIN
+#undef PTRDIFF_MAX
+#define PTRDIFF_MIN  \
+   _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
+#define PTRDIFF_MAX  \
+   _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
+
+/* sig_atomic_t limits */
+#undef SIG_ATOMIC_MIN
+#undef SIG_ATOMIC_MAX
+#define SIG_ATOMIC_MIN  \
+   _STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
+               0@SIG_ATOMIC_T_SUFFIX@)
+#define SIG_ATOMIC_MAX  \
+   _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
+               0@SIG_ATOMIC_T_SUFFIX@)
+
+
+/* size_t limit */
+#undef SIZE_MAX
+#define SIZE_MAX  _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@)
+
+/* wchar_t limits */
+#undef WCHAR_MIN
+#undef WCHAR_MAX
+#define WCHAR_MIN  \
+   _STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
+#define WCHAR_MAX  \
+   _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
+
+/* wint_t limits */
+#undef WINT_MIN
+#undef WINT_MAX
+#define WINT_MIN  \
+   _STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
+#define WINT_MAX  \
+   _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
+
+#endif /* !defined __cplusplus || defined __STDC_LIMIT_MACROS */
+
+/* 7.18.4. Macros for integer constants */
+
+#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
+
+/* 7.18.4.1. Macros for minimum-width integer constants */
+/* According to ISO C 99 Technical Corrigendum 1 */
+
+/* Here we assume a standard architecture where the hardware integer
+   types have 8, 16, 32, optionally 64 bits, and int is 32 bits.  */
+
+#undef INT8_C
+#undef UINT8_C
+#define INT8_C(x) x
+#define UINT8_C(x) x
+
+#undef INT16_C
+#undef UINT16_C
+#define INT16_C(x) x
+#define UINT16_C(x) x
+
+#undef INT32_C
+#undef UINT32_C
+#define INT32_C(x) x
+#define UINT32_C(x) x ## U
+
+#undef INT64_C
+#undef UINT64_C
+#if LONG_MAX >> 31 >> 31 == 1
+# define INT64_C(x) x##L
+#elif defined _MSC_VER
+# define INT64_C(x) x##i64
+#elif @HAVE_LONG_LONG_INT@
+# define INT64_C(x) x##LL
+#endif
+#if ULONG_MAX >> 31 >> 31 >> 1 == 1
+# define UINT64_C(x) x##UL
+#elif defined _MSC_VER
+# define UINT64_C(x) x##ui64
+#elif @HAVE_UNSIGNED_LONG_LONG_INT@
+# define UINT64_C(x) x##ULL
+#endif
+
+/* 7.18.4.2. Macros for greatest-width integer constants */
+
+#undef INTMAX_C
+#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
+# define INTMAX_C(x)   x##LL
+#elif defined GL_INT64_T
+# define INTMAX_C(x)   INT64_C(x)
+#else
+# define INTMAX_C(x)   x##L
+#endif
+
+#undef UINTMAX_C
+#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
+# define UINTMAX_C(x)  x##ULL
+#elif defined GL_UINT64_T
+# define UINTMAX_C(x)  UINT64_C(x)
+#else
+# define UINTMAX_C(x)  x##UL
+#endif
+
+#endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */
+
+#endif /* _GL_STDINT_H */
+#endif /* !defined _GL_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */
diff --git a/gnulib/stdint_.h b/gnulib/stdint_.h
deleted file mode 100644 (file)
index 121118c..0000000
+++ /dev/null
@@ -1,508 +0,0 @@
-/* Copyright (C) 2001-2002, 2004-2007 Free Software Foundation, Inc.
-   Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
-   This file is part of gnulib.
-
-   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.  */
-
-/*
- * ISO C 99 <stdint.h> for platforms that lack it.
- * <http://www.opengroup.org/susv3xbd/stdint.h.html>
- */
-
-#ifndef _GL_STDINT_H
-
-/* Get those types that are already defined in other system include
-   files, so that we can "#define int8_t signed char" below without
-   worrying about a later system include file containing a "typedef
-   signed char int8_t;" that will get messed up by our macro.  Our
-   macros should all be consistent with the system versions, except
-   for the "fast" types and macros, which we recommend against using
-   in public interfaces due to compiler differences.  */
-
-#if @HAVE_STDINT_H@
-# if defined __sgi && ! defined __c99
-   /* Bypass IRIX's <stdint.h> if in C89 mode, since it merely annoys users
-      with "This header file is to be used only for c99 mode compilations"
-      diagnostics.  */
-#  define __STDINT_H__
-# endif
-  /* Other systems may have an incomplete or buggy <stdint.h>.
-     Include it before <inttypes.h>, since any "#include <stdint.h>"
-     in <inttypes.h> would reinclude us, skipping our contents because
-     _GL_STDINT_H is defined.
-     The include_next requires a split double-inclusion guard.  */
-# @INCLUDE_NEXT@ @NEXT_STDINT_H@
-#endif
-
-#if ! defined _GL_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H
-#define _GL_STDINT_H
-
-/* <sys/types.h> defines some of the stdint.h types as well, on glibc,
-   IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>).
-   AIX 5.2 <sys/types.h> isn't needed and causes troubles.
-   MacOS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but
-   relies on the system <stdint.h> definitions, so include
-   <sys/types.h> after @NEXT_STDINT_H@.  */
-#if @HAVE_SYS_TYPES_H@ && ! defined _AIX
-# include <sys/types.h>
-#endif
-
-/* Get LONG_MIN, LONG_MAX, ULONG_MAX.  */
-#include <limits.h>
-
-#if @HAVE_INTTYPES_H@
-  /* In OpenBSD 3.8, <inttypes.h> includes <machine/types.h>, which defines
-     int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__.
-     <inttypes.h> also defines intptr_t and uintptr_t.  */
-# define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
-# include <inttypes.h>
-# undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
-#elif @HAVE_SYS_INTTYPES_H@
-  /* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and
-     the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX.  */
-# include <sys/inttypes.h>
-#endif
-
-#if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__
-  /* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines
-     int{8,16,32,64}_t and __BIT_TYPES_DEFINED__.  In libc5 >= 5.2.2 it is
-     included by <sys/types.h>.  */
-# include <sys/bitypes.h>
-#endif
-
-#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
-
-/* Get WCHAR_MIN, WCHAR_MAX.  */
-# if ! (defined WCHAR_MIN && defined WCHAR_MAX)
-#  include <wchar.h>
-# endif
-
-#endif
-
-/* Minimum and maximum values for a integer type under the usual assumption.
-   Return an unspecified value if BITS == 0, adding a check to pacify
-   picky compilers.  */
-
-#define _STDINT_MIN(signed, bits, zero) \
-  ((signed) ? (- ((zero) + 1) << ((bits) ? (bits) - 1 : 0)) : (zero))
-
-#define _STDINT_MAX(signed, bits, zero) \
-  ((signed) \
-   ? ~ _STDINT_MIN (signed, bits, zero) \
-   : ((((zero) + 1) << ((bits) ? (bits) - 1 : 0)) - 1) * 2 + 1)
-
-/* 7.18.1.1. Exact-width integer types */
-
-/* Here we assume a standard architecture where the hardware integer
-   types have 8, 16, 32, optionally 64 bits.  */
-
-#undef int8_t
-#undef uint8_t
-#define int8_t signed char
-#define uint8_t unsigned char
-
-#undef int16_t
-#undef uint16_t
-#define int16_t short int
-#define uint16_t unsigned short int
-
-#undef int32_t
-#undef uint32_t
-#define int32_t int
-#define uint32_t unsigned int
-
-/* Do not undefine int64_t if gnulib is not being used with 64-bit
-   types, since otherwise it breaks platforms like Tandem/NSK.  */
-#if LONG_MAX >> 31 >> 31 == 1
-# undef int64_t
-# define int64_t long int
-# define GL_INT64_T
-#elif defined _MSC_VER
-# undef int64_t
-# define int64_t __int64
-# define GL_INT64_T
-#elif @HAVE_LONG_LONG_INT@
-# undef int64_t
-# define int64_t long long int
-# define GL_INT64_T
-#endif
-
-#if ULONG_MAX >> 31 >> 31 >> 1 == 1
-# undef uint64_t
-# define uint64_t unsigned long int
-# define GL_UINT64_T
-#elif defined _MSC_VER
-# undef uint64_t
-# define uint64_t unsigned __int64
-# define GL_UINT64_T
-#elif @HAVE_UNSIGNED_LONG_LONG_INT@
-# undef uint64_t
-# define uint64_t unsigned long long int
-# define GL_UINT64_T
-#endif
-
-/* Avoid collision with Solaris 2.5.1 <pthread.h> etc.  */
-#define _UINT8_T
-#define _UINT32_T
-#define _UINT64_T
-
-
-/* 7.18.1.2. Minimum-width integer types */
-
-/* Here we assume a standard architecture where the hardware integer
-   types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
-   are the same as the corresponding N_t types.  */
-
-#undef int_least8_t
-#undef uint_least8_t
-#undef int_least16_t
-#undef uint_least16_t
-#undef int_least32_t
-#undef uint_least32_t
-#undef int_least64_t
-#undef uint_least64_t
-#define int_least8_t int8_t
-#define uint_least8_t uint8_t
-#define int_least16_t int16_t
-#define uint_least16_t uint16_t
-#define int_least32_t int32_t
-#define uint_least32_t uint32_t
-#ifdef GL_INT64_T
-# define int_least64_t int64_t
-#endif
-#ifdef GL_UINT64_T
-# define uint_least64_t uint64_t
-#endif
-
-/* 7.18.1.3. Fastest minimum-width integer types */
-
-/* Note: Other <stdint.h> substitutes may define these types differently.
-   It is not recommended to use these types in public header files. */
-
-/* Here we assume a standard architecture where the hardware integer
-   types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
-   are taken from the same list of types.  Assume that 'long int'
-   is fast enough for all narrower integers.  */
-
-#undef int_fast8_t
-#undef uint_fast8_t
-#undef int_fast16_t
-#undef uint_fast16_t
-#undef int_fast32_t
-#undef uint_fast32_t
-#undef int_fast64_t
-#undef uint_fast64_t
-#define int_fast8_t long int
-#define uint_fast8_t unsigned int_fast8_t
-#define int_fast16_t long int
-#define uint_fast16_t unsigned int_fast16_t
-#define int_fast32_t long int
-#define uint_fast32_t unsigned int_fast32_t
-#ifdef GL_INT64_T
-# define int_fast64_t int64_t
-#endif
-#ifdef GL_UINT64_T
-# define uint_fast64_t uint64_t
-#endif
-
-/* 7.18.1.4. Integer types capable of holding object pointers */
-
-#undef intptr_t
-#undef uintptr_t
-#define intptr_t long int
-#define uintptr_t unsigned long int
-
-/* 7.18.1.5. Greatest-width integer types */
-
-/* Note: These types are compiler dependent. It may be unwise to use them in
-   public header files. */
-
-#undef intmax_t
-#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
-# define intmax_t long long int
-#elif defined GL_INT64_T
-# define intmax_t int64_t
-#else
-# define intmax_t long int
-#endif
-
-#undef uintmax_t
-#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
-# define uintmax_t unsigned long long int
-#elif defined GL_UINT64_T
-# define uintmax_t uint64_t
-#else
-# define uintmax_t unsigned long int
-#endif
-
-/* 7.18.2. Limits of specified-width integer types */
-
-#if ! defined __cplusplus || defined __STDC_LIMIT_MACROS
-
-/* 7.18.2.1. Limits of exact-width integer types */
-
-/* Here we assume a standard architecture where the hardware integer
-   types have 8, 16, 32, optionally 64 bits.  */
-
-#undef INT8_MIN
-#undef INT8_MAX
-#undef UINT8_MAX
-#define INT8_MIN  (~ INT8_MAX)
-#define INT8_MAX  127
-#define UINT8_MAX  255
-
-#undef INT16_MIN
-#undef INT16_MAX
-#undef UINT16_MAX
-#define INT16_MIN  (~ INT16_MAX)
-#define INT16_MAX  32767
-#define UINT16_MAX  65535
-
-#undef INT32_MIN
-#undef INT32_MAX
-#undef UINT32_MAX
-#define INT32_MIN  (~ INT32_MAX)
-#define INT32_MAX  2147483647
-#define UINT32_MAX  4294967295U
-
-#undef INT64_MIN
-#undef INT64_MAX
-#ifdef GL_INT64_T
-/* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0
-   evaluates the latter incorrectly in preprocessor expressions.  */
-# define INT64_MIN  (- INTMAX_C (1) << 63)
-# define INT64_MAX  INTMAX_C (9223372036854775807)
-#endif
-
-#undef UINT64_MAX
-#ifdef GL_UINT64_T
-# define UINT64_MAX  UINTMAX_C (18446744073709551615)
-#endif
-
-/* 7.18.2.2. Limits of minimum-width integer types */
-
-/* Here we assume a standard architecture where the hardware integer
-   types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
-   are the same as the corresponding N_t types.  */
-
-#undef INT_LEAST8_MIN
-#undef INT_LEAST8_MAX
-#undef UINT_LEAST8_MAX
-#define INT_LEAST8_MIN  INT8_MIN
-#define INT_LEAST8_MAX  INT8_MAX
-#define UINT_LEAST8_MAX  UINT8_MAX
-
-#undef INT_LEAST16_MIN
-#undef INT_LEAST16_MAX
-#undef UINT_LEAST16_MAX
-#define INT_LEAST16_MIN  INT16_MIN
-#define INT_LEAST16_MAX  INT16_MAX
-#define UINT_LEAST16_MAX  UINT16_MAX
-
-#undef INT_LEAST32_MIN
-#undef INT_LEAST32_MAX
-#undef UINT_LEAST32_MAX
-#define INT_LEAST32_MIN  INT32_MIN
-#define INT_LEAST32_MAX  INT32_MAX
-#define UINT_LEAST32_MAX  UINT32_MAX
-
-#undef INT_LEAST64_MIN
-#undef INT_LEAST64_MAX
-#ifdef GL_INT64_T
-# define INT_LEAST64_MIN  INT64_MIN
-# define INT_LEAST64_MAX  INT64_MAX
-#endif
-
-#undef UINT_LEAST64_MAX
-#ifdef GL_UINT64_T
-# define UINT_LEAST64_MAX  UINT64_MAX
-#endif
-
-/* 7.18.2.3. Limits of fastest minimum-width integer types */
-
-/* Here we assume a standard architecture where the hardware integer
-   types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
-   are taken from the same list of types.  */
-
-#undef INT_FAST8_MIN
-#undef INT_FAST8_MAX
-#undef UINT_FAST8_MAX
-#define INT_FAST8_MIN  LONG_MIN
-#define INT_FAST8_MAX  LONG_MAX
-#define UINT_FAST8_MAX  ULONG_MAX
-
-#undef INT_FAST16_MIN
-#undef INT_FAST16_MAX
-#undef UINT_FAST16_MAX
-#define INT_FAST16_MIN  LONG_MIN
-#define INT_FAST16_MAX  LONG_MAX
-#define UINT_FAST16_MAX  ULONG_MAX
-
-#undef INT_FAST32_MIN
-#undef INT_FAST32_MAX
-#undef UINT_FAST32_MAX
-#define INT_FAST32_MIN  LONG_MIN
-#define INT_FAST32_MAX  LONG_MAX
-#define UINT_FAST32_MAX  ULONG_MAX
-
-#undef INT_FAST64_MIN
-#undef INT_FAST64_MAX
-#ifdef GL_INT64_T
-# define INT_FAST64_MIN  INT64_MIN
-# define INT_FAST64_MAX  INT64_MAX
-#endif
-
-#undef UINT_FAST64_MAX
-#ifdef GL_UINT64_T
-# define UINT_FAST64_MAX  UINT64_MAX
-#endif
-
-/* 7.18.2.4. Limits of integer types capable of holding object pointers */
-
-#undef INTPTR_MIN
-#undef INTPTR_MAX
-#undef UINTPTR_MAX
-#define INTPTR_MIN  LONG_MIN
-#define INTPTR_MAX  LONG_MAX
-#define UINTPTR_MAX  ULONG_MAX
-
-/* 7.18.2.5. Limits of greatest-width integer types */
-
-#undef INTMAX_MIN
-#undef INTMAX_MAX
-#ifdef INT64_MAX
-# define INTMAX_MIN  INT64_MIN
-# define INTMAX_MAX  INT64_MAX
-#else
-# define INTMAX_MIN  INT32_MIN
-# define INTMAX_MAX  INT32_MAX
-#endif
-
-#undef UINTMAX_MAX
-#ifdef UINT64_MAX
-# define UINTMAX_MAX  UINT64_MAX
-#else
-# define UINTMAX_MAX  UINT32_MAX
-#endif
-
-/* 7.18.3. Limits of other integer types */
-
-/* ptrdiff_t limits */
-#undef PTRDIFF_MIN
-#undef PTRDIFF_MAX
-#define PTRDIFF_MIN  \
-   _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
-#define PTRDIFF_MAX  \
-   _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
-
-/* sig_atomic_t limits */
-#undef SIG_ATOMIC_MIN
-#undef SIG_ATOMIC_MAX
-#define SIG_ATOMIC_MIN  \
-   _STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
-               0@SIG_ATOMIC_T_SUFFIX@)
-#define SIG_ATOMIC_MAX  \
-   _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
-               0@SIG_ATOMIC_T_SUFFIX@)
-
-
-/* size_t limit */
-#undef SIZE_MAX
-#define SIZE_MAX  _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@)
-
-/* wchar_t limits */
-#undef WCHAR_MIN
-#undef WCHAR_MAX
-#define WCHAR_MIN  \
-   _STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
-#define WCHAR_MAX  \
-   _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
-
-/* wint_t limits */
-#undef WINT_MIN
-#undef WINT_MAX
-#define WINT_MIN  \
-   _STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
-#define WINT_MAX  \
-   _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
-
-#endif /* !defined __cplusplus || defined __STDC_LIMIT_MACROS */
-
-/* 7.18.4. Macros for integer constants */
-
-#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
-
-/* 7.18.4.1. Macros for minimum-width integer constants */
-/* According to ISO C 99 Technical Corrigendum 1 */
-
-/* Here we assume a standard architecture where the hardware integer
-   types have 8, 16, 32, optionally 64 bits, and int is 32 bits.  */
-
-#undef INT8_C
-#undef UINT8_C
-#define INT8_C(x) x
-#define UINT8_C(x) x
-
-#undef INT16_C
-#undef UINT16_C
-#define INT16_C(x) x
-#define UINT16_C(x) x
-
-#undef INT32_C
-#undef UINT32_C
-#define INT32_C(x) x
-#define UINT32_C(x) x ## U
-
-#undef INT64_C
-#undef UINT64_C
-#if LONG_MAX >> 31 >> 31 == 1
-# define INT64_C(x) x##L
-#elif defined _MSC_VER
-# define INT64_C(x) x##i64
-#elif @HAVE_LONG_LONG_INT@
-# define INT64_C(x) x##LL
-#endif
-#if ULONG_MAX >> 31 >> 31 >> 1 == 1
-# define UINT64_C(x) x##UL
-#elif defined _MSC_VER
-# define UINT64_C(x) x##ui64
-#elif @HAVE_UNSIGNED_LONG_LONG_INT@
-# define UINT64_C(x) x##ULL
-#endif
-
-/* 7.18.4.2. Macros for greatest-width integer constants */
-
-#undef INTMAX_C
-#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
-# define INTMAX_C(x)   x##LL
-#elif defined GL_INT64_T
-# define INTMAX_C(x)   INT64_C(x)
-#else
-# define INTMAX_C(x)   x##L
-#endif
-
-#undef UINTMAX_C
-#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
-# define UINTMAX_C(x)  x##ULL
-#elif defined GL_UINT64_T
-# define UINTMAX_C(x)  UINT64_C(x)
-#else
-# define UINTMAX_C(x)  x##UL
-#endif
-
-#endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */
-
-#endif /* _GL_STDINT_H */
-#endif /* !defined _GL_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */
diff --git a/gnulib/stdio.in.h b/gnulib/stdio.in.h
new file mode 100644 (file)
index 0000000..434fa8e
--- /dev/null
@@ -0,0 +1,382 @@
+/* A GNU-like <stdio.h>.
+
+   Copyright (C) 2004, 2007-2008 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 3, 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.  */
+
+#if defined __need_FILE || defined __need___FILE
+/* Special invocation convention inside glibc header files.  */
+
+#@INCLUDE_NEXT@ @NEXT_STDIO_H@
+
+#else
+/* Normal invocation convention.  */
+
+#ifndef _GL_STDIO_H
+
+/* The include_next requires a split double-inclusion guard.  */
+#@INCLUDE_NEXT@ @NEXT_STDIO_H@
+
+#ifndef _GL_STDIO_H
+#define _GL_STDIO_H
+
+#include <stdarg.h>
+#include <stddef.h>
+
+#if (@GNULIB_FSEEKO@ && @REPLACE_FSEEKO@) \
+  || (@GNULIB_FTELLO@ && @REPLACE_FTELLO@) \
+  || (@GNULIB_GETDELIM@ && !@HAVE_DECL_GETDELIM@) \
+  || (@GNULIB_GETLINE@ && (!@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@))
+/* Get off_t and ssize_t.  */
+# include <sys/types.h>
+#endif
+
+#ifndef __attribute__
+/* This feature is available in gcc versions 2.5 and later.  */
+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
+#  define __attribute__(Spec) /* empty */
+# endif
+/* The __-protected variants of `format' and `printf' attributes
+   are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
+#  define __format__ format
+#  define __printf__ printf
+# endif
+#endif
+
+
+/* The definition of GL_LINK_WARNING is copied here.  */
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#if @GNULIB_FPRINTF_POSIX@
+# if @REPLACE_FPRINTF@
+#  define fprintf rpl_fprintf
+extern int fprintf (FILE *fp, const char *format, ...)
+       __attribute__ ((__format__ (__printf__, 2, 3)));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fprintf
+# define fprintf \
+    (GL_LINK_WARNING ("fprintf is not always POSIX compliant - " \
+                      "use gnulib module fprintf-posix for portable " \
+                      "POSIX compliance"), \
+     fprintf)
+#endif
+
+#if @GNULIB_VFPRINTF_POSIX@
+# if @REPLACE_VFPRINTF@
+#  define vfprintf rpl_vfprintf
+extern int vfprintf (FILE *fp, const char *format, va_list args)
+       __attribute__ ((__format__ (__printf__, 2, 0)));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef vfprintf
+# define vfprintf(s,f,a) \
+    (GL_LINK_WARNING ("vfprintf is not always POSIX compliant - " \
+                      "use gnulib module vfprintf-posix for portable " \
+                      "POSIX compliance"), \
+     vfprintf (s, f, a))
+#endif
+
+#if @GNULIB_PRINTF_POSIX@
+# if @REPLACE_PRINTF@
+/* Don't break __attribute__((format(printf,M,N))).  */
+#  define printf __printf__
+extern int printf (const char *format, ...)
+       __attribute__ ((__format__ (__printf__, 1, 2)));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef printf
+# define printf \
+    (GL_LINK_WARNING ("printf is not always POSIX compliant - " \
+                      "use gnulib module printf-posix for portable " \
+                      "POSIX compliance"), \
+     printf)
+/* Don't break __attribute__((format(printf,M,N))).  */
+# define format(kind,m,n) format (__##kind##__, m, n)
+# define __format__(kind,m,n) __format__ (__##kind##__, m, n)
+# define ____printf____ __printf__
+# define ____scanf____ __scanf__
+# define ____strftime____ __strftime__
+# define ____strfmon____ __strfmon__
+#endif
+
+#if @GNULIB_VPRINTF_POSIX@
+# if @REPLACE_VPRINTF@
+#  define vprintf rpl_vprintf
+extern int vprintf (const char *format, va_list args)
+       __attribute__ ((__format__ (__printf__, 1, 0)));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef vprintf
+# define vprintf(f,a) \
+    (GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \
+                      "use gnulib module vprintf-posix for portable " \
+                      "POSIX compliance"), \
+     vprintf (f, a))
+#endif
+
+#if @GNULIB_SNPRINTF@
+# if @REPLACE_SNPRINTF@
+#  define snprintf rpl_snprintf
+# endif
+# if @REPLACE_SNPRINTF@ || !@HAVE_DECL_SNPRINTF@
+extern int snprintf (char *str, size_t size, const char *format, ...)
+       __attribute__ ((__format__ (__printf__, 3, 4)));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef snprintf
+# define snprintf \
+    (GL_LINK_WARNING ("snprintf is unportable - " \
+                      "use gnulib module snprintf for portability"), \
+     snprintf)
+#endif
+
+#if @GNULIB_VSNPRINTF@
+# if @REPLACE_VSNPRINTF@
+#  define vsnprintf rpl_vsnprintf
+# endif
+# if @REPLACE_VSNPRINTF@ || !@HAVE_DECL_VSNPRINTF@
+extern int vsnprintf (char *str, size_t size, const char *format, va_list args)
+       __attribute__ ((__format__ (__printf__, 3, 0)));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef vsnprintf
+# define vsnprintf(b,s,f,a) \
+    (GL_LINK_WARNING ("vsnprintf is unportable - " \
+                      "use gnulib module vsnprintf for portability"), \
+     vsnprintf (b, s, f, a))
+#endif
+
+#if @GNULIB_SPRINTF_POSIX@
+# if @REPLACE_SPRINTF@
+#  define sprintf rpl_sprintf
+extern int sprintf (char *str, const char *format, ...)
+       __attribute__ ((__format__ (__printf__, 2, 3)));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef sprintf
+# define sprintf \
+    (GL_LINK_WARNING ("sprintf is not always POSIX compliant - " \
+                      "use gnulib module sprintf-posix for portable " \
+                      "POSIX compliance"), \
+     sprintf)
+#endif
+
+#if @GNULIB_VSPRINTF_POSIX@
+# if @REPLACE_VSPRINTF@
+#  define vsprintf rpl_vsprintf
+extern int vsprintf (char *str, const char *format, va_list args)
+       __attribute__ ((__format__ (__printf__, 2, 0)));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef vsprintf
+# define vsprintf(b,f,a) \
+    (GL_LINK_WARNING ("vsprintf is not always POSIX compliant - " \
+                      "use gnulib module vsprintf-posix for portable " \
+                      "POSIX compliance"), \
+     vsprintf (b, f, a))
+#endif
+
+#if @GNULIB_VASPRINTF@
+# if @REPLACE_VASPRINTF@
+#  define asprintf rpl_asprintf
+#  define vasprintf rpl_vasprintf
+# endif
+# if @REPLACE_VASPRINTF@ || !@HAVE_VASPRINTF@
+  /* Write formatted output to a string dynamically allocated with malloc().
+     If the memory allocation succeeds, store the address of the string in
+     *RESULT and return the number of resulting bytes, excluding the trailing
+     NUL.  Upon memory allocation error, or some other error, return -1.  */
+  extern int asprintf (char **result, const char *format, ...)
+    __attribute__ ((__format__ (__printf__, 2, 3)));
+  extern int vasprintf (char **result, const char *format, va_list args)
+    __attribute__ ((__format__ (__printf__, 2, 0)));
+# endif
+#endif
+
+#if @GNULIB_FOPEN@
+# if @REPLACE_FOPEN@
+#  define fopen rpl_fopen
+extern FILE * fopen (const char *filename, const char *mode);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fopen
+# define fopen(f,m) \
+   (GL_LINK_WARNING ("fopen on Win32 platforms is not POSIX compatible - " \
+                     "use gnulib module fopen for portability"), \
+    fopen (f, m))
+#endif
+
+#if @GNULIB_FREOPEN@
+# if @REPLACE_FREOPEN@
+#  define freopen rpl_freopen
+extern FILE * freopen (const char *filename, const char *mode, FILE *stream);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef freopen
+# define freopen(f,m,s) \
+   (GL_LINK_WARNING ("freopen on Win32 platforms is not POSIX compatible - " \
+                     "use gnulib module freopen for portability"), \
+    freopen (f, m, s))
+#endif
+
+#if @GNULIB_FSEEKO@
+# if @REPLACE_FSEEKO@
+/* Provide fseek, fseeko functions that are aware of a preceding
+   fflush(), and which detect pipes.  */
+#  define fseeko rpl_fseeko
+extern int fseeko (FILE *fp, off_t offset, int whence);
+#  define fseek(fp, offset, whence) fseeko (fp, (off_t)(offset), whence)
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fseeko
+# define fseeko(f,o,w) \
+   (GL_LINK_WARNING ("fseeko is unportable - " \
+                     "use gnulib module fseeko for portability"), \
+    fseeko (f, o, w))
+#endif
+
+#if @GNULIB_FSEEK@ && @REPLACE_FSEEK@
+extern int rpl_fseek (FILE *fp, long offset, int whence);
+# undef fseek
+# if defined GNULIB_POSIXCHECK
+#  define fseek(f,o,w) \
+     (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
+                       "on 32-bit platforms - " \
+                       "use fseeko function for handling of large files"), \
+      rpl_fseek (f, o, w))
+# else
+#  define fseek rpl_fseek
+# endif
+#elif defined GNULIB_POSIXCHECK
+# ifndef fseek
+#  define fseek(f,o,w) \
+     (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
+                       "on 32-bit platforms - " \
+                       "use fseeko function for handling of large files"), \
+      fseek (f, o, w))
+# endif
+#endif
+
+#if @GNULIB_FTELLO@
+# if @REPLACE_FTELLO@
+#  define ftello rpl_ftello
+extern off_t ftello (FILE *fp);
+#  define ftell(fp) ftello (fp)
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef ftello
+# define ftello(f) \
+   (GL_LINK_WARNING ("ftello is unportable - " \
+                     "use gnulib module ftello for portability"), \
+    ftello (f))
+#endif
+
+#if @GNULIB_FTELL@ && @REPLACE_FTELL@
+extern long rpl_ftell (FILE *fp);
+# undef ftell
+# if GNULIB_POSIXCHECK
+#  define ftell(f) \
+     (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
+                       "on 32-bit platforms - " \
+                       "use ftello function for handling of large files"), \
+      rpl_ftell (f))
+# else
+#  define ftell rpl_ftell
+# endif
+#elif defined GNULIB_POSIXCHECK
+# ifndef ftell
+#  define ftell(f) \
+     (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
+                       "on 32-bit platforms - " \
+                       "use ftello function for handling of large files"), \
+      ftell (f))
+# endif
+#endif
+
+#if @GNULIB_FFLUSH@
+# if @REPLACE_FFLUSH@
+#  define fflush rpl_fflush
+  /* Flush all pending data on STREAM according to POSIX rules.  Both
+     output and seekable input streams are supported.
+     Note! LOSS OF DATA can occur if fflush is applied on an input stream
+     that is _not_seekable_ or on an update stream that is _not_seekable_
+     and in which the most recent operation was input.  Seekability can
+     be tested with lseek(fileno(fp),0,SEEK_CUR).  */
+  extern int fflush (FILE *gl_stream);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fflush
+# define fflush(f) \
+   (GL_LINK_WARNING ("fflush is not always POSIX compliant - " \
+                     "use gnulib module fflush for portable " \
+                     "POSIX compliance"), \
+    fflush (f))
+#endif
+
+#if @GNULIB_GETDELIM@
+# if !@HAVE_DECL_GETDELIM@
+/* Read input, up to (and including) the next occurrence of DELIMITER, from
+   STREAM, store it in *LINEPTR (and NUL-terminate it).
+   *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
+   bytes of space.  It is realloc'd as necessary.
+   Return the number of bytes read and stored at *LINEPTR (not including the
+   NUL terminator), or -1 on error or EOF.  */
+extern ssize_t getdelim (char **lineptr, size_t *linesize, int delimiter,
+                        FILE *stream);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getdelim
+# define getdelim(l, s, d, f)                                      \
+  (GL_LINK_WARNING ("getdelim is unportable - "                            \
+                   "use gnulib module getdelim for portability"),  \
+   getdelim (l, s, d, f))
+#endif
+
+#if @GNULIB_GETLINE@
+# if @REPLACE_GETLINE@
+#  undef getline
+#  define getline rpl_getline
+# endif
+# if !@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@
+/* Read a line, up to (and including) the next newline, from STREAM, store it
+   in *LINEPTR (and NUL-terminate it).
+   *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE
+   bytes of space.  It is realloc'd as necessary.
+   Return the number of bytes read and stored at *LINEPTR (not including the
+   NUL terminator), or -1 on error or EOF.  */
+extern ssize_t getline (char **lineptr, size_t *linesize, FILE *stream);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getline
+# define getline(l, s, f)                                              \
+  (GL_LINK_WARNING ("getline is unportable - "                         \
+                   "use gnulib module getline for portability"),       \
+   getline (l, s, f))
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _GL_STDIO_H */
+#endif /* _GL_STDIO_H */
+#endif
diff --git a/gnulib/stdio_.h b/gnulib/stdio_.h
deleted file mode 100644 (file)
index 76d9856..0000000
+++ /dev/null
@@ -1,353 +0,0 @@
-/* A GNU-like <stdio.h>.
-
-   Copyright (C) 2004, 2007 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.  */
-
-#if defined __need_FILE || defined __need___FILE
-/* Special invocation convention inside glibc header files.  */
-
-#@INCLUDE_NEXT@ @NEXT_STDIO_H@
-
-#else
-/* Normal invocation convention.  */
-
-#ifndef _GL_STDIO_H
-
-/* The include_next requires a split double-inclusion guard.  */
-#@INCLUDE_NEXT@ @NEXT_STDIO_H@
-
-#ifndef _GL_STDIO_H
-#define _GL_STDIO_H
-
-#include <stdarg.h>
-#include <stddef.h>
-
-#if (@GNULIB_FSEEKO@ && @REPLACE_FSEEKO@) \
-  || (@GNULIB_FTELLO@ && @REPLACE_FTELLO@) \
-  || (@GNULIB_GETDELIM@ && !@HAVE_DECL_GETDELIM@) \
-  || (@GNULIB_GETLINE@ && (!@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@))
-/* Get off_t and ssize_t.  */
-# include <sys/types.h>
-#endif
-
-#ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
-#  define __attribute__(Spec) /* empty */
-# endif
-/* The __-protected variants of `format' and `printf' attributes
-   are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-#  define __format__ format
-#  define __printf__ printf
-# endif
-#endif
-
-
-/* The definition of GL_LINK_WARNING is copied here.  */
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#if @GNULIB_FPRINTF_POSIX@
-# if @REPLACE_FPRINTF@
-#  define fprintf rpl_fprintf
-extern int fprintf (FILE *fp, const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 2, 3)));
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef fprintf
-# define fprintf \
-    (GL_LINK_WARNING ("fprintf is not always POSIX compliant - " \
-                      "use gnulib module fprintf-posix for portable " \
-                      "POSIX compliance"), \
-     fprintf)
-#endif
-
-#if @GNULIB_VFPRINTF_POSIX@
-# if @REPLACE_VFPRINTF@
-#  define vfprintf rpl_vfprintf
-extern int vfprintf (FILE *fp, const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 2, 0)));
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef vfprintf
-# define vfprintf(s,f,a) \
-    (GL_LINK_WARNING ("vfprintf is not always POSIX compliant - " \
-                      "use gnulib module vfprintf-posix for portable " \
-                      "POSIX compliance"), \
-     vfprintf (s, f, a))
-#endif
-
-#if @GNULIB_PRINTF_POSIX@
-# if @REPLACE_PRINTF@
-/* Don't break __attribute__((format(printf,M,N))).  */
-#  define printf __printf__
-extern int printf (const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 1, 2)));
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef printf
-# define printf \
-    (GL_LINK_WARNING ("printf is not always POSIX compliant - " \
-                      "use gnulib module printf-posix for portable " \
-                      "POSIX compliance"), \
-     printf)
-/* Don't break __attribute__((format(printf,M,N))).  */
-# define format(kind,m,n) format (__##kind##__, m, n)
-# define __format__(kind,m,n) __format__ (__##kind##__, m, n)
-# define ____printf____ __printf__
-# define ____scanf____ __scanf__
-# define ____strftime____ __strftime__
-# define ____strfmon____ __strfmon__
-#endif
-
-#if @GNULIB_VPRINTF_POSIX@
-# if @REPLACE_VPRINTF@
-#  define vprintf rpl_vprintf
-extern int vprintf (const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 1, 0)));
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef vprintf
-# define vprintf(f,a) \
-    (GL_LINK_WARNING ("vprintf is not always POSIX compliant - " \
-                      "use gnulib module vprintf-posix for portable " \
-                      "POSIX compliance"), \
-     vprintf (f, a))
-#endif
-
-#if @GNULIB_SNPRINTF@
-# if @REPLACE_SNPRINTF@
-#  define snprintf rpl_snprintf
-# endif
-# if @REPLACE_SNPRINTF@ || !@HAVE_DECL_SNPRINTF@
-extern int snprintf (char *str, size_t size, const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 3, 4)));
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef snprintf
-# define snprintf \
-    (GL_LINK_WARNING ("snprintf is unportable - " \
-                      "use gnulib module snprintf for portability"), \
-     snprintf)
-#endif
-
-#if @GNULIB_VSNPRINTF@
-# if @REPLACE_VSNPRINTF@
-#  define vsnprintf rpl_vsnprintf
-# endif
-# if @REPLACE_VSNPRINTF@ || !@HAVE_DECL_VSNPRINTF@
-extern int vsnprintf (char *str, size_t size, const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 3, 0)));
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef vsnprintf
-# define vsnprintf(b,s,f,a) \
-    (GL_LINK_WARNING ("vsnprintf is unportable - " \
-                      "use gnulib module vsnprintf for portability"), \
-     vsnprintf (b, s, f, a))
-#endif
-
-#if @GNULIB_SPRINTF_POSIX@
-# if @REPLACE_SPRINTF@
-#  define sprintf rpl_sprintf
-extern int sprintf (char *str, const char *format, ...)
-       __attribute__ ((__format__ (__printf__, 2, 3)));
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef sprintf
-# define sprintf \
-    (GL_LINK_WARNING ("sprintf is not always POSIX compliant - " \
-                      "use gnulib module sprintf-posix for portable " \
-                      "POSIX compliance"), \
-     sprintf)
-#endif
-
-#if @GNULIB_VSPRINTF_POSIX@
-# if @REPLACE_VSPRINTF@
-#  define vsprintf rpl_vsprintf
-extern int vsprintf (char *str, const char *format, va_list args)
-       __attribute__ ((__format__ (__printf__, 2, 0)));
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef vsprintf
-# define vsprintf(b,f,a) \
-    (GL_LINK_WARNING ("vsprintf is not always POSIX compliant - " \
-                      "use gnulib module vsprintf-posix for portable " \
-                      "POSIX compliance"), \
-     vsprintf (b, f, a))
-#endif
-
-#if @GNULIB_VASPRINTF@
-# if @REPLACE_VASPRINTF@
-#  define asprintf rpl_asprintf
-#  define vasprintf rpl_vasprintf
-# endif
-# if @REPLACE_VASPRINTF@ || !@HAVE_VASPRINTF@
-  /* Write formatted output to a string dynamically allocated with malloc().
-     If the memory allocation succeeds, store the address of the string in
-     *RESULT and return the number of resulting bytes, excluding the trailing
-     NUL.  Upon memory allocation error, or some other error, return -1.  */
-  extern int asprintf (char **result, const char *format, ...)
-    __attribute__ ((__format__ (__printf__, 2, 3)));
-  extern int vasprintf (char **result, const char *format, va_list args)
-    __attribute__ ((__format__ (__printf__, 2, 0)));
-# endif
-#endif
-
-#if @GNULIB_FSEEKO@
-# if @REPLACE_FSEEKO@
-/* Provide fseek, fseeko functions that are aware of a preceding
-   fflush(), and which detect pipes.  */
-#  define fseeko rpl_fseeko
-extern int fseeko (FILE *fp, off_t offset, int whence);
-#  define fseek(fp, offset, whence) fseeko (fp, (off_t)(offset), whence)
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef fseeko
-# define fseeko(f,o,w) \
-   (GL_LINK_WARNING ("fseeko is unportable - " \
-                     "use gnulib module fseeko for portability"), \
-    fseeko (f, o, w))
-#endif
-
-#if @GNULIB_FSEEK@ && @REPLACE_FSEEK@
-extern int rpl_fseek (FILE *fp, long offset, int whence);
-# undef fseek
-# if defined GNULIB_POSIXCHECK
-#  define fseek(f,o,w) \
-     (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
-                       "on 32-bit platforms - " \
-                       "use fseeko function for handling of large files"), \
-      rpl_fseek (f, o, w))
-# else
-#  define fseek rpl_fseek
-# endif
-#elif defined GNULIB_POSIXCHECK
-# ifndef fseek
-#  define fseek(f,o,w) \
-     (GL_LINK_WARNING ("fseek cannot handle files larger than 4 GB " \
-                       "on 32-bit platforms - " \
-                       "use fseeko function for handling of large files"), \
-      fseek (f, o, w))
-# endif
-#endif
-
-#if @GNULIB_FTELLO@
-# if @REPLACE_FTELLO@
-#  define ftello rpl_ftello
-extern off_t ftello (FILE *fp);
-#  define ftell(fp) ftello (fp)
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef ftello
-# define ftello(f) \
-   (GL_LINK_WARNING ("ftello is unportable - " \
-                     "use gnulib module ftello for portability"), \
-    ftello (f))
-#endif
-
-#if @GNULIB_FTELL@ && @REPLACE_FTELL@
-extern long rpl_ftell (FILE *fp);
-# undef ftell
-# if GNULIB_POSIXCHECK
-#  define ftell(f) \
-     (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
-                       "on 32-bit platforms - " \
-                       "use ftello function for handling of large files"), \
-      rpl_ftell (f))
-# else
-#  define ftell rpl_ftell
-# endif
-#elif defined GNULIB_POSIXCHECK
-# ifndef ftell
-#  define ftell(f) \
-     (GL_LINK_WARNING ("ftell cannot handle files larger than 4 GB " \
-                       "on 32-bit platforms - " \
-                       "use ftello function for handling of large files"), \
-      ftell (f))
-# endif
-#endif
-
-#if @GNULIB_FFLUSH@
-# if @REPLACE_FFLUSH@
-#  define fflush rpl_fflush
-  /* Flush all pending data on STREAM according to POSIX rules.  Both
-     output and seekable input streams are supported.
-     Note! LOSS OF DATA can occur if fflush is applied on an input stream
-     that is _not_seekable_ or on an update stream that is _not_seekable_
-     and in which the most recent operation was input.  Seekability can
-     be tested with lseek(fileno(fp),0,SEEK_CUR).  */
-  extern int fflush (FILE *gl_stream);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef fflush
-# define fflush(f) \
-   (GL_LINK_WARNING ("fflush is not always POSIX compliant - " \
-                     "use gnulib module fflush for portable " \
-                     "POSIX compliance"), \
-    fflush (f))
-#endif
-
-#if @GNULIB_GETDELIM@
-# if !@HAVE_DECL_GETDELIM@
-  /* Read up to (and including) a DELIMITER from FP into *LINEPTR (and
-     NUL-terminate it).  *LINEPTR is a pointer returned from malloc (or
-     NULL), pointing to *N characters of space.  It is realloc'ed as
-     necessary.  Returns the number of characters read (not including
-     the null terminator), or -1 on error or EOF.  */
-  extern ssize_t getdelim (char **, size_t *, int delim, FILE *);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef getdelim
-# define getdelim(l, s, d, f)                                      \
-  (GL_LINK_WARNING ("getdelim is unportable - "                            \
-                   "use gnulib module getdelim for portability"),  \
-   getdelim (l, s, d, f))
-#endif
-
-#if @GNULIB_GETLINE@
-# if @REPLACE_GETLINE@
-#  undef getline
-#  define getline rpl_getline
-# endif
-# if !@HAVE_DECL_GETLINE@ || @REPLACE_GETLINE@
-  /* Read up to (and including) a newline from FP into *LINEPTR (and
-     NUL-terminate it).  *LINEPTR is a pointer returned from malloc (or
-     NULL), pointing to *N characters of space.  It is realloc'ed as
-     necessary.  Returns the number of characters read (not including
-     the null terminator), or -1 on error or EOF.  */
-  extern ssize_t getline (char **, size_t *, FILE *);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef getline
-# define getline(l, s, f)                                              \
-  (GL_LINK_WARNING ("getline is unportable - "                         \
-                   "use gnulib module getline for portability"),       \
-   getline (l, s, f))
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _GL_STDIO_H */
-#endif /* _GL_STDIO_H */
-#endif
diff --git a/gnulib/stdlib.in.h b/gnulib/stdlib.in.h
new file mode 100644 (file)
index 0000000..100ff52
--- /dev/null
@@ -0,0 +1,208 @@
+/* A GNU-like <stdlib.h>.
+
+   Copyright (C) 1995, 2001-2004, 2006-2007 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 3 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, see <http://www.gnu.org/licenses/>.  */
+
+#if defined __need_malloc_and_calloc
+/* Special invocation convention inside glibc header files.  */
+
+#@INCLUDE_NEXT@ @NEXT_STDLIB_H@
+
+#else
+/* Normal invocation convention.  */
+
+#ifndef _GL_STDLIB_H
+
+/* The include_next requires a split double-inclusion guard.  */
+#@INCLUDE_NEXT@ @NEXT_STDLIB_H@
+
+#ifndef _GL_STDLIB_H
+#define _GL_STDLIB_H
+
+
+/* The definition of GL_LINK_WARNING is copied here.  */
+
+
+/* Some systems do not define EXIT_*, despite otherwise supporting C89.  */
+#ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
+#endif
+/* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
+   with proper operation of xargs.  */
+#ifndef EXIT_FAILURE
+# define EXIT_FAILURE 1
+#elif EXIT_FAILURE != 1
+# undef EXIT_FAILURE
+# define EXIT_FAILURE 1
+#endif
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#if @GNULIB_MALLOC_POSIX@
+# if !@HAVE_MALLOC_POSIX@
+#  undef malloc
+#  define malloc rpl_malloc
+extern void * malloc (size_t size);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef malloc
+# define malloc(s) \
+    (GL_LINK_WARNING ("malloc is not POSIX compliant everywhere - " \
+                      "use gnulib module malloc-posix for portability"), \
+     malloc (s))
+#endif
+
+
+#if @GNULIB_REALLOC_POSIX@
+# if !@HAVE_REALLOC_POSIX@
+#  undef realloc
+#  define realloc rpl_realloc
+extern void * realloc (void *ptr, size_t size);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef realloc
+# define realloc(p,s) \
+    (GL_LINK_WARNING ("realloc is not POSIX compliant everywhere - " \
+                      "use gnulib module realloc-posix for portability"), \
+     realloc (p, s))
+#endif
+
+
+#if @GNULIB_CALLOC_POSIX@
+# if !@HAVE_CALLOC_POSIX@
+#  undef calloc
+#  define calloc rpl_calloc
+extern void * calloc (size_t nmemb, size_t size);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef calloc
+# define calloc(n,s) \
+    (GL_LINK_WARNING ("calloc is not POSIX compliant everywhere - " \
+                      "use gnulib module calloc-posix for portability"), \
+     calloc (n, s))
+#endif
+
+
+#if @GNULIB_GETSUBOPT@
+/* Assuming *OPTIONP is a comma separated list of elements of the form
+   "token" or "token=value", getsubopt parses the first of these elements.
+   If the first element refers to a "token" that is member of the given
+   NULL-terminated array of tokens:
+     - It replaces the comma with a NUL byte, updates *OPTIONP to point past
+       the first option and the comma, sets *VALUEP to the value of the
+       element (or NULL if it doesn't contain an "=" sign),
+     - It returns the index of the "token" in the given array of tokens.
+   Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
+   For more details see the POSIX:2001 specification.
+   http://www.opengroup.org/susv3xsh/getsubopt.html */
+# if !@HAVE_GETSUBOPT@
+extern int getsubopt (char **optionp, char *const *tokens, char **valuep);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getsubopt
+# define getsubopt(o,t,v) \
+    (GL_LINK_WARNING ("getsubopt is unportable - " \
+                      "use gnulib module getsubopt for portability"), \
+     getsubopt (o, t, v))
+#endif
+
+
+#if @GNULIB_MKDTEMP@
+# if !@HAVE_MKDTEMP@
+/* Create a unique temporary directory from TEMPLATE.
+   The last six characters of TEMPLATE must be "XXXXXX";
+   they are replaced with a string that makes the directory name unique.
+   Returns TEMPLATE, or a null pointer if it cannot get a unique name.
+   The directory is created mode 700.  */
+extern char * mkdtemp (char * /*template*/);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mkdtemp
+# define mkdtemp(t) \
+    (GL_LINK_WARNING ("mkdtemp is unportable - " \
+                      "use gnulib module mkdtemp for portability"), \
+     mkdtemp (t))
+#endif
+
+
+#if @GNULIB_MKSTEMP@
+# if @REPLACE_MKSTEMP@
+/* Create a unique temporary file from TEMPLATE.
+   The last six characters of TEMPLATE must be "XXXXXX";
+   they are replaced with a string that makes the file name unique.
+   The file is then created, ensuring it didn't exist before.
+   The file is created read-write (mask at least 0600 & ~umask), but it may be
+   world-readable and world-writable (mask 0666 & ~umask), depending on the
+   implementation.
+   Returns the open file descriptor if successful, otherwise -1 and errno
+   set.  */
+#  define mkstemp rpl_mkstemp
+extern int mkstemp (char * /*template*/);
+# else
+/* On MacOS X 10.3, only <unistd.h> declares mkstemp.  */
+#  include <unistd.h>
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mkstemp
+# define mkstemp(t) \
+    (GL_LINK_WARNING ("mkstemp is unportable - " \
+                      "use gnulib module mkstemp for portability"), \
+     mkstemp (t))
+#endif
+
+
+#if @GNULIB_PUTENV@
+# if @REPLACE_PUTENV@
+#  undef putenv
+#  define putenv rpl_putenv
+extern int putenv (char *string);
+# endif
+#endif
+
+
+#if @GNULIB_SETENV@
+# if !@HAVE_SETENV@
+/* Set NAME to VALUE in the environment.
+   If REPLACE is nonzero, overwrite an existing value.  */
+extern int setenv (const char *name, const char *value, int replace);
+# endif
+#endif
+
+
+#if @GNULIB_UNSETENV@
+# if @HAVE_UNSETENV@
+#  if @VOID_UNSETENV@
+/* On some systems, unsetenv() returns void.
+   This is the case for MacOS X 10.3, FreeBSD 4.8, NetBSD 1.6, OpenBSD 3.4.  */
+#   define unsetenv(name) ((unsetenv)(name), 0)
+#  endif
+# else
+/* Remove the variable NAME from the environment.  */
+extern int unsetenv (const char *name);
+# endif
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _GL_STDLIB_H */
+#endif /* _GL_STDLIB_H */
+#endif
diff --git a/gnulib/stdlib_.h b/gnulib/stdlib_.h
deleted file mode 100644 (file)
index a4946e6..0000000
+++ /dev/null
@@ -1,177 +0,0 @@
-/* A GNU-like <stdlib.h>.
-
-   Copyright (C) 1995, 2001-2002, 2006-2007 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.  */
-
-#if defined __need_malloc_and_calloc
-/* Special invocation convention inside glibc header files.  */
-
-#@INCLUDE_NEXT@ @NEXT_STDLIB_H@
-
-#else
-/* Normal invocation convention.  */
-
-#ifndef _GL_STDLIB_H
-
-/* The include_next requires a split double-inclusion guard.  */
-#@INCLUDE_NEXT@ @NEXT_STDLIB_H@
-
-#ifndef _GL_STDLIB_H
-#define _GL_STDLIB_H
-
-
-/* The definition of GL_LINK_WARNING is copied here.  */
-
-
-/* Some systems do not define EXIT_*, despite otherwise supporting C89.  */
-#ifndef EXIT_SUCCESS
-# define EXIT_SUCCESS 0
-#endif
-/* Tandem/NSK and other platforms that define EXIT_FAILURE as -1 interfere
-   with proper operation of xargs.  */
-#ifndef EXIT_FAILURE
-# define EXIT_FAILURE 1
-#elif EXIT_FAILURE != 1
-# undef EXIT_FAILURE
-# define EXIT_FAILURE 1
-#endif
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#if @GNULIB_MALLOC_POSIX@
-# if !@HAVE_MALLOC_POSIX@
-#  undef malloc
-#  define malloc rpl_malloc
-extern void * malloc (size_t size);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef malloc
-# define malloc(s) \
-    (GL_LINK_WARNING ("malloc is not POSIX compliant everywhere - " \
-                      "use gnulib module malloc-posix for portability"), \
-     malloc (s))
-#endif
-
-
-#if @GNULIB_REALLOC_POSIX@
-# if !@HAVE_REALLOC_POSIX@
-#  undef realloc
-#  define realloc rpl_realloc
-extern void * realloc (void *ptr, size_t size);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef realloc
-# define realloc(p,s) \
-    (GL_LINK_WARNING ("realloc is not POSIX compliant everywhere - " \
-                      "use gnulib module realloc-posix for portability"), \
-     realloc (p, s))
-#endif
-
-
-#if @GNULIB_CALLOC_POSIX@
-# if !@HAVE_CALLOC_POSIX@
-#  undef calloc
-#  define calloc rpl_calloc
-extern void * calloc (size_t nmemb, size_t size);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef calloc
-# define calloc(n,s) \
-    (GL_LINK_WARNING ("calloc is not POSIX compliant everywhere - " \
-                      "use gnulib module calloc-posix for portability"), \
-     calloc (n, s))
-#endif
-
-
-#if @GNULIB_GETSUBOPT@
-/* Assuming *OPTIONP is a comma separated list of elements of the form
-   "token" or "token=value", getsubopt parses the first of these elements.
-   If the first element refers to a "token" that is member of the given
-   NULL-terminated array of tokens:
-     - It replaces the comma with a NUL byte, updates *OPTIONP to point past
-       the first option and the comma, sets *VALUEP to the value of the
-       element (or NULL if it doesn't contain an "=" sign),
-     - It returns the index of the "token" in the given array of tokens.
-   Otherwise it returns -1, and *OPTIONP and *VALUEP are undefined.
-   For more details see the POSIX:2001 specification.
-   http://www.opengroup.org/susv3xsh/getsubopt.html */
-# if !@HAVE_GETSUBOPT@
-extern int getsubopt (char **optionp, char *const *tokens, char **valuep);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef getsubopt
-# define getsubopt(o,t,v) \
-    (GL_LINK_WARNING ("getsubopt is unportable - " \
-                      "use gnulib module getsubopt for portability"), \
-     getsubopt (o, t, v))
-#endif
-
-
-#if @GNULIB_MKDTEMP@
-# if !@HAVE_MKDTEMP@
-/* Create a unique temporary directory from TEMPLATE.
-   The last six characters of TEMPLATE must be "XXXXXX";
-   they are replaced with a string that makes the directory name unique.
-   Returns TEMPLATE, or a null pointer if it cannot get a unique name.
-   The directory is created mode 700.  */
-extern char * mkdtemp (char * /*template*/);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef mkdtemp
-# define mkdtemp(t) \
-    (GL_LINK_WARNING ("mkdtemp is unportable - " \
-                      "use gnulib module mkdtemp for portability"), \
-     mkdtemp (t))
-#endif
-
-
-#if @GNULIB_MKSTEMP@
-# if @REPLACE_MKSTEMP@
-/* Create a unique temporary file from TEMPLATE.
-   The last six characters of TEMPLATE must be "XXXXXX";
-   they are replaced with a string that makes the file name unique.
-   The file is then created, ensuring it didn't exist before.
-   The file is created read-write (mask at least 0600 & ~umask), but it may be
-   world-readable and world-writable (mask 0666 & ~umask), depending on the
-   implementation.
-   Returns the open file descriptor if successful, otherwise -1 and errno
-   set.  */
-#  define mkstemp rpl_mkstemp
-extern int mkstemp (char * /*template*/);
-# else
-/* On MacOS X 10.3, only <unistd.h> declares mkstemp.  */
-#  include <unistd.h>
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef mkstemp
-# define mkstemp(t) \
-    (GL_LINK_WARNING ("mkstemp is unportable - " \
-                      "use gnulib module mkstemp for portability"), \
-     mkstemp (t))
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _GL_STDLIB_H */
-#endif /* _GL_STDLIB_H */
-#endif
index c614108786854179a5499ab49b9b5a66cc33e472..bebe5c8fb4f50e00761c0106dfa9e491f281f1e6 100644 (file)
@@ -5,7 +5,7 @@
 
    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)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    This program is distributed in the hope that it will be useful,
diff --git a/gnulib/string.in.h b/gnulib/string.in.h
new file mode 100644 (file)
index 0000000..212846a
--- /dev/null
@@ -0,0 +1,569 @@
+/* A GNU-like <string.h>.
+
+   Copyright (C) 1995-1996, 2001-2008 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 3, 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.  */
+
+#ifndef _GL_STRING_H
+
+/* The include_next requires a split double-inclusion guard.  */
+#@INCLUDE_NEXT@ @NEXT_STRING_H@
+
+#ifndef _GL_STRING_H
+#define _GL_STRING_H
+
+
+#ifndef __attribute__
+/* This feature is available in gcc versions 2.5 and later.  */
+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
+#  define __attribute__(Spec) /* empty */
+# endif
+/* The attribute __pure__ was added in gcc 2.96.  */
+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 96)
+#  define __pure__ /* empty */
+# endif
+#endif
+
+
+/* The definition of GL_LINK_WARNING is copied here.  */
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Return the first occurrence of NEEDLE in HAYSTACK.  */
+#if @GNULIB_MEMMEM@
+# if @REPLACE_MEMMEM@
+#  define memmem rpl_memmem
+# endif
+# if ! @HAVE_DECL_MEMMEM@ || @REPLACE_MEMMEM@
+extern void *memmem (void const *__haystack, size_t __haystack_len,
+                    void const *__needle, size_t __needle_len)
+  __attribute__ ((__pure__));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef memmem
+# define memmem(a,al,b,bl) \
+    (GL_LINK_WARNING ("memmem is unportable and often quadratic - " \
+                      "use gnulib module memmem-simple for portability, " \
+                      "and module memmem for speed" ), \
+     memmem (a, al, b, bl))
+#endif
+
+/* Copy N bytes of SRC to DEST, return pointer to bytes after the
+   last written byte.  */
+#if @GNULIB_MEMPCPY@
+# if ! @HAVE_MEMPCPY@
+extern void *mempcpy (void *__dest, void const *__src,
+                     size_t __n);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef mempcpy
+# define mempcpy(a,b,n) \
+    (GL_LINK_WARNING ("mempcpy is unportable - " \
+                      "use gnulib module mempcpy for portability"), \
+     mempcpy (a, b, n))
+#endif
+
+/* Search backwards through a block for a byte (specified as an int).  */
+#if @GNULIB_MEMRCHR@
+# if ! @HAVE_DECL_MEMRCHR@
+extern void *memrchr (void const *, int, size_t)
+  __attribute__ ((__pure__));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef memrchr
+# define memrchr(a,b,c) \
+    (GL_LINK_WARNING ("memrchr is unportable - " \
+                      "use gnulib module memrchr for portability"), \
+     memrchr (a, b, c))
+#endif
+
+/* Copy SRC to DST, returning the address of the terminating '\0' in DST.  */
+#if @GNULIB_STPCPY@
+# if ! @HAVE_STPCPY@
+extern char *stpcpy (char *__dst, char const *__src);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef stpcpy
+# define stpcpy(a,b) \
+    (GL_LINK_WARNING ("stpcpy is unportable - " \
+                      "use gnulib module stpcpy for portability"), \
+     stpcpy (a, b))
+#endif
+
+/* Copy no more than N bytes of SRC to DST, returning a pointer past the
+   last non-NUL byte written into DST.  */
+#if @GNULIB_STPNCPY@
+# if ! @HAVE_STPNCPY@
+#  define stpncpy gnu_stpncpy
+extern char *stpncpy (char *__dst, char const *__src,
+                     size_t __n);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef stpncpy
+# define stpncpy(a,b,n) \
+    (GL_LINK_WARNING ("stpncpy is unportable - " \
+                      "use gnulib module stpncpy for portability"), \
+     stpncpy (a, b, n))
+#endif
+
+#if defined GNULIB_POSIXCHECK
+/* strchr() does not work with multibyte strings if the locale encoding is
+   GB18030 and the character to be searched is a digit.  */
+# undef strchr
+# define strchr(s,c) \
+    (GL_LINK_WARNING ("strchr cannot work correctly on character strings " \
+                      "in some multibyte locales - " \
+                      "use mbschr if you care about internationalization"), \
+     strchr (s, c))
+#endif
+
+/* Find the first occurrence of C in S or the final NUL byte.  */
+#if @GNULIB_STRCHRNUL@
+# if ! @HAVE_STRCHRNUL@
+extern char *strchrnul (char const *__s, int __c_in)
+  __attribute__ ((__pure__));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strchrnul
+# define strchrnul(a,b) \
+    (GL_LINK_WARNING ("strchrnul is unportable - " \
+                      "use gnulib module strchrnul for portability"), \
+     strchrnul (a, b))
+#endif
+
+/* Duplicate S, returning an identical malloc'd string.  */
+#if @GNULIB_STRDUP@
+# if ! @HAVE_DECL_STRDUP@ && ! defined strdup
+extern char *strdup (char const *__s);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strdup
+# define strdup(a) \
+    (GL_LINK_WARNING ("strdup is unportable - " \
+                      "use gnulib module strdup for portability"), \
+     strdup (a))
+#endif
+
+/* Return a newly allocated copy of at most N bytes of STRING.  */
+#if @GNULIB_STRNDUP@
+# if ! @HAVE_STRNDUP@
+#  undef strndup
+#  define strndup rpl_strndup
+# endif
+# if ! @HAVE_STRNDUP@ || ! @HAVE_DECL_STRNDUP@
+extern char *strndup (char const *__string, size_t __n);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strndup
+# define strndup(a,n) \
+    (GL_LINK_WARNING ("strndup is unportable - " \
+                      "use gnulib module strndup for portability"), \
+     strndup (a, n))
+#endif
+
+/* Find the length (number of bytes) of STRING, but scan at most
+   MAXLEN bytes.  If no '\0' terminator is found in that many bytes,
+   return MAXLEN.  */
+#if @GNULIB_STRNLEN@
+# if ! @HAVE_DECL_STRNLEN@
+extern size_t strnlen (char const *__string, size_t __maxlen)
+  __attribute__ ((__pure__));
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strnlen
+# define strnlen(a,n) \
+    (GL_LINK_WARNING ("strnlen is unportable - " \
+                      "use gnulib module strnlen for portability"), \
+     strnlen (a, n))
+#endif
+
+#if defined GNULIB_POSIXCHECK
+/* strcspn() assumes the second argument is a list of single-byte characters.
+   Even in this simple case, it does not work with multibyte strings if the
+   locale encoding is GB18030 and one of the characters to be searched is a
+   digit.  */
+# undef strcspn
+# define strcspn(s,a) \
+    (GL_LINK_WARNING ("strcspn cannot work correctly on character strings " \
+                      "in multibyte locales - " \
+                      "use mbscspn if you care about internationalization"), \
+     strcspn (s, a))
+#endif
+
+/* Find the first occurrence in S of any character in ACCEPT.  */
+#if @GNULIB_STRPBRK@
+# if ! @HAVE_STRPBRK@
+extern char *strpbrk (char const *__s, char const *__accept)
+  __attribute__ ((__pure__));
+# endif
+# if defined GNULIB_POSIXCHECK
+/* strpbrk() assumes the second argument is a list of single-byte characters.
+   Even in this simple case, it does not work with multibyte strings if the
+   locale encoding is GB18030 and one of the characters to be searched is a
+   digit.  */
+#  undef strpbrk
+#  define strpbrk(s,a) \
+     (GL_LINK_WARNING ("strpbrk cannot work correctly on character strings " \
+                       "in multibyte locales - " \
+                       "use mbspbrk if you care about internationalization"), \
+      strpbrk (s, a))
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strpbrk
+# define strpbrk(s,a) \
+    (GL_LINK_WARNING ("strpbrk is unportable - " \
+                      "use gnulib module strpbrk for portability"), \
+     strpbrk (s, a))
+#endif
+
+#if defined GNULIB_POSIXCHECK
+/* strspn() assumes the second argument is a list of single-byte characters.
+   Even in this simple case, it cannot work with multibyte strings.  */
+# undef strspn
+# define strspn(s,a) \
+    (GL_LINK_WARNING ("strspn cannot work correctly on character strings " \
+                      "in multibyte locales - " \
+                      "use mbsspn if you care about internationalization"), \
+     strspn (s, a))
+#endif
+
+#if defined GNULIB_POSIXCHECK
+/* strrchr() does not work with multibyte strings if the locale encoding is
+   GB18030 and the character to be searched is a digit.  */
+# undef strrchr
+# define strrchr(s,c) \
+    (GL_LINK_WARNING ("strrchr cannot work correctly on character strings " \
+                      "in some multibyte locales - " \
+                      "use mbsrchr if you care about internationalization"), \
+     strrchr (s, c))
+#endif
+
+/* Search the next delimiter (char listed in DELIM) starting at *STRINGP.
+   If one is found, overwrite it with a NUL, and advance *STRINGP
+   to point to the next char after it.  Otherwise, set *STRINGP to NULL.
+   If *STRINGP was already NULL, nothing happens.
+   Return the old value of *STRINGP.
+
+   This is a variant of strtok() that is multithread-safe and supports
+   empty fields.
+
+   Caveat: It modifies the original string.
+   Caveat: These functions cannot be used on constant strings.
+   Caveat: The identity of the delimiting character is lost.
+   Caveat: It doesn't work with multibyte strings unless all of the delimiter
+           characters are ASCII characters < 0x30.
+
+   See also strtok_r().  */
+#if @GNULIB_STRSEP@
+# if ! @HAVE_STRSEP@
+extern char *strsep (char **__stringp, char const *__delim);
+# endif
+# if defined GNULIB_POSIXCHECK
+#  undef strsep
+#  define strsep(s,d) \
+     (GL_LINK_WARNING ("strsep cannot work correctly on character strings " \
+                       "in multibyte locales - " \
+                       "use mbssep if you care about internationalization"), \
+      strsep (s, d))
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strsep
+# define strsep(s,d) \
+    (GL_LINK_WARNING ("strsep is unportable - " \
+                      "use gnulib module strsep for portability"), \
+     strsep (s, d))
+#endif
+
+#if @GNULIB_STRSTR@
+# if @REPLACE_STRSTR@
+#  define strstr rpl_strstr
+char *strstr (const char *haystack, const char *needle)
+  __attribute__ ((__pure__));
+# endif
+#elif defined GNULIB_POSIXCHECK
+/* strstr() does not work with multibyte strings if the locale encoding is
+   different from UTF-8:
+   POSIX says that it operates on "strings", and "string" in POSIX is defined
+   as a sequence of bytes, not of characters.  */
+# undef strstr
+# define strstr(a,b) \
+    (GL_LINK_WARNING ("strstr is quadratic on many systems, and cannot " \
+                      "work correctly on character strings in most "    \
+                      "multibyte locales - " \
+                      "use mbsstr if you care about internationalization, " \
+                      "or use strstr if you care about speed"), \
+     strstr (a, b))
+#endif
+
+/* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive
+   comparison.  */
+#if @GNULIB_STRCASESTR@
+# if @REPLACE_STRCASESTR@
+#  define strcasestr rpl_strcasestr
+# endif
+# if ! @HAVE_STRCASESTR@ || @REPLACE_STRCASESTR@
+extern char *strcasestr (const char *haystack, const char *needle)
+  __attribute__ ((__pure__));
+# endif
+#elif defined GNULIB_POSIXCHECK
+/* strcasestr() does not work with multibyte strings:
+   It is a glibc extension, and glibc implements it only for unibyte
+   locales.  */
+# undef strcasestr
+# define strcasestr(a,b) \
+    (GL_LINK_WARNING ("strcasestr does work correctly on character strings " \
+                      "in multibyte locales - " \
+                      "use mbscasestr if you care about " \
+                      "internationalization, or use c-strcasestr if you want " \
+                      "a locale independent function"), \
+     strcasestr (a, b))
+#endif
+
+/* Parse S into tokens separated by characters in DELIM.
+   If S is NULL, the saved pointer in SAVE_PTR is used as
+   the next starting point.  For example:
+       char s[] = "-abc-=-def";
+       char *sp;
+       x = strtok_r(s, "-", &sp);      // x = "abc", sp = "=-def"
+       x = strtok_r(NULL, "-=", &sp);  // x = "def", sp = NULL
+       x = strtok_r(NULL, "=", &sp);   // x = NULL
+               // s = "abc\0-def\0"
+
+   This is a variant of strtok() that is multithread-safe.
+
+   For the POSIX documentation for this function, see:
+   http://www.opengroup.org/susv3xsh/strtok.html
+
+   Caveat: It modifies the original string.
+   Caveat: These functions cannot be used on constant strings.
+   Caveat: The identity of the delimiting character is lost.
+   Caveat: It doesn't work with multibyte strings unless all of the delimiter
+           characters are ASCII characters < 0x30.
+
+   See also strsep().  */
+#if @GNULIB_STRTOK_R@
+# if ! @HAVE_DECL_STRTOK_R@
+extern char *strtok_r (char *s, char const *delim,
+                      char **save_ptr);
+# endif
+# if defined GNULIB_POSIXCHECK
+#  undef strtok_r
+#  define strtok_r(s,d,p) \
+     (GL_LINK_WARNING ("strtok_r cannot work correctly on character strings " \
+                       "in multibyte locales - " \
+                       "use mbstok_r if you care about internationalization"), \
+      strtok_r (s, d, p))
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strtok_r
+# define strtok_r(s,d,p) \
+    (GL_LINK_WARNING ("strtok_r is unportable - " \
+                      "use gnulib module strtok_r for portability"), \
+     strtok_r (s, d, p))
+#endif
+
+
+/* The following functions are not specified by POSIX.  They are gnulib
+   extensions.  */
+
+#if @GNULIB_MBSLEN@
+/* Return the number of multibyte characters in the character string STRING.
+   This considers multibyte characters, unlike strlen, which counts bytes.  */
+extern size_t mbslen (const char *string);
+#endif
+
+#if @GNULIB_MBSNLEN@
+/* Return the number of multibyte characters in the character string starting
+   at STRING and ending at STRING + LEN.  */
+extern size_t mbsnlen (const char *string, size_t len);
+#endif
+
+#if @GNULIB_MBSCHR@
+/* Locate the first single-byte character C in the character string STRING,
+   and return a pointer to it.  Return NULL if C is not found in STRING.
+   Unlike strchr(), this function works correctly in multibyte locales with
+   encodings such as GB18030.  */
+# define mbschr rpl_mbschr /* avoid collision with HP-UX function */
+extern char * mbschr (const char *string, int c);
+#endif
+
+#if @GNULIB_MBSRCHR@
+/* Locate the last single-byte character C in the character string STRING,
+   and return a pointer to it.  Return NULL if C is not found in STRING.
+   Unlike strrchr(), this function works correctly in multibyte locales with
+   encodings such as GB18030.  */
+# define mbsrchr rpl_mbsrchr /* avoid collision with HP-UX function */
+extern char * mbsrchr (const char *string, int c);
+#endif
+
+#if @GNULIB_MBSSTR@
+/* Find the first occurrence of the character string NEEDLE in the character
+   string HAYSTACK.  Return NULL if NEEDLE is not found in HAYSTACK.
+   Unlike strstr(), this function works correctly in multibyte locales with
+   encodings different from UTF-8.  */
+extern char * mbsstr (const char *haystack, const char *needle);
+#endif
+
+#if @GNULIB_MBSCASECMP@
+/* Compare the character strings S1 and S2, ignoring case, returning less than,
+   equal to or greater than zero if S1 is lexicographically less than, equal to
+   or greater than S2.
+   Note: This function may, in multibyte locales, return 0 for strings of
+   different lengths!
+   Unlike strcasecmp(), this function works correctly in multibyte locales.  */
+extern int mbscasecmp (const char *s1, const char *s2);
+#endif
+
+#if @GNULIB_MBSNCASECMP@
+/* Compare the initial segment of the character string S1 consisting of at most
+   N characters with the initial segment of the character string S2 consisting
+   of at most N characters, ignoring case, returning less than, equal to or
+   greater than zero if the initial segment of S1 is lexicographically less
+   than, equal to or greater than the initial segment of S2.
+   Note: This function may, in multibyte locales, return 0 for initial segments
+   of different lengths!
+   Unlike strncasecmp(), this function works correctly in multibyte locales.
+   But beware that N is not a byte count but a character count!  */
+extern int mbsncasecmp (const char *s1, const char *s2, size_t n);
+#endif
+
+#if @GNULIB_MBSPCASECMP@
+/* Compare the initial segment of the character string STRING consisting of
+   at most mbslen (PREFIX) characters with the character string PREFIX,
+   ignoring case, returning less than, equal to or greater than zero if this
+   initial segment is lexicographically less than, equal to or greater than
+   PREFIX.
+   Note: This function may, in multibyte locales, return 0 if STRING is of
+   smaller length than PREFIX!
+   Unlike strncasecmp(), this function works correctly in multibyte
+   locales.  */
+extern char * mbspcasecmp (const char *string, const char *prefix);
+#endif
+
+#if @GNULIB_MBSCASESTR@
+/* Find the first occurrence of the character string NEEDLE in the character
+   string HAYSTACK, using case-insensitive comparison.
+   Note: This function may, in multibyte locales, return success even if
+   strlen (haystack) < strlen (needle) !
+   Unlike strcasestr(), this function works correctly in multibyte locales.  */
+extern char * mbscasestr (const char *haystack, const char *needle);
+#endif
+
+#if @GNULIB_MBSCSPN@
+/* Find the first occurrence in the character string STRING of any character
+   in the character string ACCEPT.  Return the number of bytes from the
+   beginning of the string to this occurrence, or to the end of the string
+   if none exists.
+   Unlike strcspn(), this function works correctly in multibyte locales.  */
+extern size_t mbscspn (const char *string, const char *accept);
+#endif
+
+#if @GNULIB_MBSPBRK@
+/* Find the first occurrence in the character string STRING of any character
+   in the character string ACCEPT.  Return the pointer to it, or NULL if none
+   exists.
+   Unlike strpbrk(), this function works correctly in multibyte locales.  */
+# define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */
+extern char * mbspbrk (const char *string, const char *accept);
+#endif
+
+#if @GNULIB_MBSSPN@
+/* Find the first occurrence in the character string STRING of any character
+   not in the character string REJECT.  Return the number of bytes from the
+   beginning of the string to this occurrence, or to the end of the string
+   if none exists.
+   Unlike strspn(), this function works correctly in multibyte locales.  */
+extern size_t mbsspn (const char *string, const char *reject);
+#endif
+
+#if @GNULIB_MBSSEP@
+/* Search the next delimiter (multibyte character listed in the character
+   string DELIM) starting at the character string *STRINGP.
+   If one is found, overwrite it with a NUL, and advance *STRINGP to point
+   to the next multibyte character after it.  Otherwise, set *STRINGP to NULL.
+   If *STRINGP was already NULL, nothing happens.
+   Return the old value of *STRINGP.
+
+   This is a variant of mbstok_r() that supports empty fields.
+
+   Caveat: It modifies the original string.
+   Caveat: These functions cannot be used on constant strings.
+   Caveat: The identity of the delimiting character is lost.
+
+   See also mbstok_r().  */
+extern char * mbssep (char **stringp, const char *delim);
+#endif
+
+#if @GNULIB_MBSTOK_R@
+/* Parse the character string STRING into tokens separated by characters in
+   the character string DELIM.
+   If STRING is NULL, the saved pointer in SAVE_PTR is used as
+   the next starting point.  For example:
+       char s[] = "-abc-=-def";
+       char *sp;
+       x = mbstok_r(s, "-", &sp);      // x = "abc", sp = "=-def"
+       x = mbstok_r(NULL, "-=", &sp);  // x = "def", sp = NULL
+       x = mbstok_r(NULL, "=", &sp);   // x = NULL
+               // s = "abc\0-def\0"
+
+   Caveat: It modifies the original string.
+   Caveat: These functions cannot be used on constant strings.
+   Caveat: The identity of the delimiting character is lost.
+
+   See also mbssep().  */
+extern char * mbstok_r (char *string, const char *delim, char **save_ptr);
+#endif
+
+/* Map any int, typically from errno, into an error message.  */
+#if @GNULIB_STRERROR@
+# if @REPLACE_STRERROR@
+#  undef strerror
+#  define strerror rpl_strerror
+extern char *strerror (int);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strerror
+# define strerror(e) \
+    (GL_LINK_WARNING ("strerror is unportable - " \
+                      "use gnulib module strerror to guarantee non-NULL result"), \
+     strerror (e))
+#endif
+
+#if @GNULIB_STRSIGNAL@
+# if @REPLACE_STRSIGNAL@
+#  define strsignal rpl_strsignal
+# endif
+# if ! @HAVE_DECL_STRSIGNAL@ || @REPLACE_STRSIGNAL@
+extern char *strsignal (int __sig);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strsignal
+# define strsignal(a) \
+    (GL_LINK_WARNING ("strsignal is unportable - " \
+                      "use gnulib module strsignal for portability"), \
+     strsignal (a))
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _GL_STRING_H */
+#endif /* _GL_STRING_H */
diff --git a/gnulib/string_.h b/gnulib/string_.h
deleted file mode 100644 (file)
index bfb22b0..0000000
+++ /dev/null
@@ -1,548 +0,0 @@
-/* A GNU-like <string.h>.
-
-   Copyright (C) 1995-1996, 2001-2007 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.  */
-
-#ifndef _GL_STRING_H
-
-/* The include_next requires a split double-inclusion guard.  */
-#@INCLUDE_NEXT@ @NEXT_STRING_H@
-
-#ifndef _GL_STRING_H
-#define _GL_STRING_H
-
-
-/* The definition of GL_LINK_WARNING is copied here.  */
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Return the first occurrence of NEEDLE in HAYSTACK.  */
-#if @GNULIB_MEMMEM@
-# if ! @HAVE_DECL_MEMMEM@
-extern void *memmem (void const *__haystack, size_t __haystack_len,
-                    void const *__needle, size_t __needle_len);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef memmem
-# define memmem(a,al,b,bl) \
-    (GL_LINK_WARNING ("memmem is unportable - " \
-                      "use gnulib module memmem for portability"), \
-     memmem (a, al, b, bl))
-#endif
-
-/* Copy N bytes of SRC to DEST, return pointer to bytes after the
-   last written byte.  */
-#if @GNULIB_MEMPCPY@
-# if ! @HAVE_MEMPCPY@
-extern void *mempcpy (void *restrict __dest, void const *restrict __src,
-                     size_t __n);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef mempcpy
-# define mempcpy(a,b,n) \
-    (GL_LINK_WARNING ("mempcpy is unportable - " \
-                      "use gnulib module mempcpy for portability"), \
-     mempcpy (a, b, n))
-#endif
-
-/* Search backwards through a block for a byte (specified as an int).  */
-#if @GNULIB_MEMRCHR@
-# if ! @HAVE_DECL_MEMRCHR@
-extern void *memrchr (void const *, int, size_t);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef memrchr
-# define memrchr(a,b,c) \
-    (GL_LINK_WARNING ("memrchr is unportable - " \
-                      "use gnulib module memrchr for portability"), \
-     memrchr (a, b, c))
-#endif
-
-/* Copy SRC to DST, returning the address of the terminating '\0' in DST.  */
-#if @GNULIB_STPCPY@
-# if ! @HAVE_STPCPY@
-extern char *stpcpy (char *restrict __dst, char const *restrict __src);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef stpcpy
-# define stpcpy(a,b) \
-    (GL_LINK_WARNING ("stpcpy is unportable - " \
-                      "use gnulib module stpcpy for portability"), \
-     stpcpy (a, b))
-#endif
-
-/* Copy no more than N bytes of SRC to DST, returning a pointer past the
-   last non-NUL byte written into DST.  */
-#if @GNULIB_STPNCPY@
-# if ! @HAVE_STPNCPY@
-#  define stpncpy gnu_stpncpy
-extern char *stpncpy (char *restrict __dst, char const *restrict __src,
-                     size_t __n);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef stpncpy
-# define stpncpy(a,b,n) \
-    (GL_LINK_WARNING ("stpncpy is unportable - " \
-                      "use gnulib module stpncpy for portability"), \
-     stpncpy (a, b, n))
-#endif
-
-/* Compare strings S1 and S2, ignoring case, returning less than, equal to or
-   greater than zero if S1 is lexicographically less than, equal to or greater
-   than S2.
-   Note: This function does not work in multibyte locales.  */
-#if ! @HAVE_STRCASECMP@
-extern int strcasecmp (char const *s1, char const *s2);
-#endif
-#if defined GNULIB_POSIXCHECK
-/* strcasecmp() does not work with multibyte strings:
-   POSIX says that it operates on "strings", and "string" in POSIX is defined
-   as a sequence of bytes, not of characters.   */
-# undef strcasecmp
-# define strcasecmp(a,b) \
-    (GL_LINK_WARNING ("strcasecmp cannot work correctly on character strings " \
-                      "in multibyte locales - " \
-                      "use mbscasecmp if you care about " \
-                      "internationalization, or use c_strcasecmp (from " \
-                      "gnulib module c-strcase) if you want a locale " \
-                      "independent function"), \
-     strcasecmp (a, b))
-#endif
-
-/* Compare no more than N bytes of strings S1 and S2, ignoring case,
-   returning less than, equal to or greater than zero if S1 is
-   lexicographically less than, equal to or greater than S2.
-   Note: This function cannot work correctly in multibyte locales.  */
-#if ! @HAVE_DECL_STRNCASECMP@
-extern int strncasecmp (char const *s1, char const *s2, size_t n);
-#endif
-#if defined GNULIB_POSIXCHECK
-/* strncasecmp() does not work with multibyte strings:
-   POSIX says that it operates on "strings", and "string" in POSIX is defined
-   as a sequence of bytes, not of characters.  */
-# undef strncasecmp
-# define strncasecmp(a,b,n) \
-    (GL_LINK_WARNING ("strncasecmp cannot work correctly on character " \
-                      "strings in multibyte locales - " \
-                      "use mbsncasecmp or mbspcasecmp if you care about " \
-                      "internationalization, or use c_strncasecmp (from " \
-                      "gnulib module c-strcase) if you want a locale " \
-                      "independent function"), \
-     strncasecmp (a, b, n))
-#endif
-
-#if defined GNULIB_POSIXCHECK
-/* strchr() does not work with multibyte strings if the locale encoding is
-   GB18030 and the character to be searched is a digit.  */
-# undef strchr
-# define strchr(s,c) \
-    (GL_LINK_WARNING ("strchr cannot work correctly on character strings " \
-                      "in some multibyte locales - " \
-                      "use mbschr if you care about internationalization"), \
-     strchr (s, c))
-#endif
-
-/* Find the first occurrence of C in S or the final NUL byte.  */
-#if @GNULIB_STRCHRNUL@
-# if ! @HAVE_STRCHRNUL@
-extern char *strchrnul (char const *__s, int __c_in);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef strchrnul
-# define strchrnul(a,b) \
-    (GL_LINK_WARNING ("strchrnul is unportable - " \
-                      "use gnulib module strchrnul for portability"), \
-     strchrnul (a, b))
-#endif
-
-/* Duplicate S, returning an identical malloc'd string.  */
-#if @GNULIB_STRDUP@
-# if ! @HAVE_DECL_STRDUP@ && ! defined strdup
-extern char *strdup (char const *__s);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef strdup
-# define strdup(a) \
-    (GL_LINK_WARNING ("strdup is unportable - " \
-                      "use gnulib module strdup for portability"), \
-     strdup (a))
-#endif
-
-/* Return a newly allocated copy of at most N bytes of STRING.  */
-#if @GNULIB_STRNDUP@
-# if ! @HAVE_STRNDUP@
-#  undef strndup
-#  define strndup rpl_strndup
-# endif
-# if ! @HAVE_STRNDUP@ || ! @HAVE_DECL_STRNDUP@
-extern char *strndup (char const *__string, size_t __n);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef strndup
-# define strndup(a,n) \
-    (GL_LINK_WARNING ("strndup is unportable - " \
-                      "use gnulib module strndup for portability"), \
-     strndup (a, n))
-#endif
-
-/* Find the length (number of bytes) of STRING, but scan at most
-   MAXLEN bytes.  If no '\0' terminator is found in that many bytes,
-   return MAXLEN.  */
-#if @GNULIB_STRNLEN@
-# if ! @HAVE_DECL_STRNLEN@
-extern size_t strnlen (char const *__string, size_t __maxlen);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef strnlen
-# define strnlen(a,n) \
-    (GL_LINK_WARNING ("strnlen is unportable - " \
-                      "use gnulib module strnlen for portability"), \
-     strnlen (a, n))
-#endif
-
-#if defined GNULIB_POSIXCHECK
-/* strcspn() assumes the second argument is a list of single-byte characters.
-   Even in this simple case, it does not work with multibyte strings if the
-   locale encoding is GB18030 and one of the characters to be searched is a
-   digit.  */
-# undef strcspn
-# define strcspn(s,a) \
-    (GL_LINK_WARNING ("strcspn cannot work correctly on character strings " \
-                      "in multibyte locales - " \
-                      "use mbscspn if you care about internationalization"), \
-     strcspn (s, a))
-#endif
-
-/* Find the first occurrence in S of any character in ACCEPT.  */
-#if @GNULIB_STRPBRK@
-# if ! @HAVE_STRPBRK@
-extern char *strpbrk (char const *__s, char const *__accept);
-# endif
-# if defined GNULIB_POSIXCHECK
-/* strpbrk() assumes the second argument is a list of single-byte characters.
-   Even in this simple case, it does not work with multibyte strings if the
-   locale encoding is GB18030 and one of the characters to be searched is a
-   digit.  */
-#  undef strpbrk
-#  define strpbrk(s,a) \
-     (GL_LINK_WARNING ("strpbrk cannot work correctly on character strings " \
-                       "in multibyte locales - " \
-                       "use mbspbrk if you care about internationalization"), \
-      strpbrk (s, a))
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef strpbrk
-# define strpbrk(s,a) \
-    (GL_LINK_WARNING ("strpbrk is unportable - " \
-                      "use gnulib module strpbrk for portability"), \
-     strpbrk (s, a))
-#endif
-
-#if defined GNULIB_POSIXCHECK
-/* strspn() assumes the second argument is a list of single-byte characters.
-   Even in this simple case, it cannot work with multibyte strings.  */
-# undef strspn
-# define strspn(s,a) \
-    (GL_LINK_WARNING ("strspn cannot work correctly on character strings " \
-                      "in multibyte locales - " \
-                      "use mbsspn if you care about internationalization"), \
-     strspn (s, a))
-#endif
-
-#if defined GNULIB_POSIXCHECK
-/* strrchr() does not work with multibyte strings if the locale encoding is
-   GB18030 and the character to be searched is a digit.  */
-# undef strrchr
-# define strrchr(s,c) \
-    (GL_LINK_WARNING ("strrchr cannot work correctly on character strings " \
-                      "in some multibyte locales - " \
-                      "use mbsrchr if you care about internationalization"), \
-     strrchr (s, c))
-#endif
-
-/* Search the next delimiter (char listed in DELIM) starting at *STRINGP.
-   If one is found, overwrite it with a NUL, and advance *STRINGP
-   to point to the next char after it.  Otherwise, set *STRINGP to NULL.
-   If *STRINGP was already NULL, nothing happens.
-   Return the old value of *STRINGP.
-
-   This is a variant of strtok() that is multithread-safe and supports
-   empty fields.
-
-   Caveat: It modifies the original string.
-   Caveat: These functions cannot be used on constant strings.
-   Caveat: The identity of the delimiting character is lost.
-   Caveat: It doesn't work with multibyte strings unless all of the delimiter
-           characters are ASCII characters < 0x30.
-
-   See also strtok_r().  */
-#if @GNULIB_STRSEP@
-# if ! @HAVE_STRSEP@
-extern char *strsep (char **restrict __stringp, char const *restrict __delim);
-# endif
-# if defined GNULIB_POSIXCHECK
-#  undef strsep
-#  define strsep(s,d) \
-     (GL_LINK_WARNING ("strsep cannot work correctly on character strings " \
-                       "in multibyte locales - " \
-                       "use mbssep if you care about internationalization"), \
-      strsep (s, d))
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef strsep
-# define strsep(s,d) \
-    (GL_LINK_WARNING ("strsep is unportable - " \
-                      "use gnulib module strsep for portability"), \
-     strsep (s, d))
-#endif
-
-#if defined GNULIB_POSIXCHECK
-/* strstr() does not work with multibyte strings if the locale encoding is
-   different from UTF-8:
-   POSIX says that it operates on "strings", and "string" in POSIX is defined
-   as a sequence of bytes, not of characters.  */
-# undef strstr
-# define strstr(a,b) \
-    (GL_LINK_WARNING ("strstr cannot work correctly on character strings " \
-                      "in most multibyte locales - " \
-                      "use mbsstr if you care about internationalization"), \
-     strstr (a, b))
-#endif
-
-/* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive
-   comparison.  */
-#if ! @HAVE_STRCASESTR@
-extern char *strcasestr (const char *haystack, const char *needle);
-#endif
-#if defined GNULIB_POSIXCHECK
-/* strcasestr() does not work with multibyte strings:
-   It is a glibc extension, and glibc implements it only for unibyte
-   locales.  */
-# undef strcasestr
-# define strcasestr(a,b) \
-    (GL_LINK_WARNING ("strcasestr does work correctly on character strings " \
-                      "in multibyte locales - " \
-                      "use mbscasestr if you care about " \
-                      "internationalization, or use c-strcasestr if you want " \
-                      "a locale independent function"), \
-     strcasestr (a, b))
-#endif
-
-/* Parse S into tokens separated by characters in DELIM.
-   If S is NULL, the saved pointer in SAVE_PTR is used as
-   the next starting point.  For example:
-       char s[] = "-abc-=-def";
-       char *sp;
-       x = strtok_r(s, "-", &sp);      // x = "abc", sp = "=-def"
-       x = strtok_r(NULL, "-=", &sp);  // x = "def", sp = NULL
-       x = strtok_r(NULL, "=", &sp);   // x = NULL
-               // s = "abc\0-def\0"
-
-   This is a variant of strtok() that is multithread-safe.
-
-   For the POSIX documentation for this function, see:
-   http://www.opengroup.org/susv3xsh/strtok.html
-
-   Caveat: It modifies the original string.
-   Caveat: These functions cannot be used on constant strings.
-   Caveat: The identity of the delimiting character is lost.
-   Caveat: It doesn't work with multibyte strings unless all of the delimiter
-           characters are ASCII characters < 0x30.
-
-   See also strsep().  */
-#if @GNULIB_STRTOK_R@
-# if ! @HAVE_DECL_STRTOK_R@
-extern char *strtok_r (char *restrict s, char const *restrict delim,
-                      char **restrict save_ptr);
-# endif
-# if defined GNULIB_POSIXCHECK
-#  undef strtok_r
-#  define strtok_r(s,d,p) \
-     (GL_LINK_WARNING ("strtok_r cannot work correctly on character strings " \
-                       "in multibyte locales - " \
-                       "use mbstok_r if you care about internationalization"), \
-      strtok_r (s, d, p))
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef strtok_r
-# define strtok_r(s,d,p) \
-    (GL_LINK_WARNING ("strtok_r is unportable - " \
-                      "use gnulib module strtok_r for portability"), \
-     strtok_r (s, d, p))
-#endif
-
-
-/* The following functions are not specified by POSIX.  They are gnulib
-   extensions.  */
-
-#if @GNULIB_MBSLEN@
-/* Return the number of multibyte characters in the character string STRING.
-   This considers multibyte characters, unlike strlen, which counts bytes.  */
-extern size_t mbslen (const char *string);
-#endif
-
-#if @GNULIB_MBSNLEN@
-/* Return the number of multibyte characters in the character string starting
-   at STRING and ending at STRING + LEN.  */
-extern size_t mbsnlen (const char *string, size_t len);
-#endif
-
-#if @GNULIB_MBSCHR@
-/* Locate the first single-byte character C in the character string STRING,
-   and return a pointer to it.  Return NULL if C is not found in STRING.
-   Unlike strchr(), this function works correctly in multibyte locales with
-   encodings such as GB18030.  */
-# define mbschr rpl_mbschr /* avoid collision with HP-UX function */
-extern char * mbschr (const char *string, int c);
-#endif
-
-#if @GNULIB_MBSRCHR@
-/* Locate the last single-byte character C in the character string STRING,
-   and return a pointer to it.  Return NULL if C is not found in STRING.
-   Unlike strrchr(), this function works correctly in multibyte locales with
-   encodings such as GB18030.  */
-# define mbsrchr rpl_mbsrchr /* avoid collision with HP-UX function */
-extern char * mbsrchr (const char *string, int c);
-#endif
-
-#if @GNULIB_MBSSTR@
-/* Find the first occurrence of the character string NEEDLE in the character
-   string HAYSTACK.  Return NULL if NEEDLE is not found in HAYSTACK.
-   Unlike strstr(), this function works correctly in multibyte locales with
-   encodings different from UTF-8.  */
-extern char * mbsstr (const char *haystack, const char *needle);
-#endif
-
-#if @GNULIB_MBSCASECMP@
-/* Compare the character strings S1 and S2, ignoring case, returning less than,
-   equal to or greater than zero if S1 is lexicographically less than, equal to
-   or greater than S2.
-   Note: This function may, in multibyte locales, return 0 for strings of
-   different lengths!
-   Unlike strcasecmp(), this function works correctly in multibyte locales.  */
-extern int mbscasecmp (const char *s1, const char *s2);
-#endif
-
-#if @GNULIB_MBSNCASECMP@
-/* Compare the initial segment of the character string S1 consisting of at most
-   N characters with the initial segment of the character string S2 consisting
-   of at most N characters, ignoring case, returning less than, equal to or
-   greater than zero if the initial segment of S1 is lexicographically less
-   than, equal to or greater than the initial segment of S2.
-   Note: This function may, in multibyte locales, return 0 for initial segments
-   of different lengths!
-   Unlike strncasecmp(), this function works correctly in multibyte locales.
-   But beware that N is not a byte count but a character count!  */
-extern int mbsncasecmp (const char *s1, const char *s2, size_t n);
-#endif
-
-#if @GNULIB_MBSPCASECMP@
-/* Compare the initial segment of the character string STRING consisting of
-   at most mbslen (PREFIX) characters with the character string PREFIX,
-   ignoring case, returning less than, equal to or greater than zero if this
-   initial segment is lexicographically less than, equal to or greater than
-   PREFIX.
-   Note: This function may, in multibyte locales, return 0 if STRING is of
-   smaller length than PREFIX!
-   Unlike strncasecmp(), this function works correctly in multibyte
-   locales.  */
-extern char * mbspcasecmp (const char *string, const char *prefix);
-#endif
-
-#if @GNULIB_MBSCASESTR@
-/* Find the first occurrence of the character string NEEDLE in the character
-   string HAYSTACK, using case-insensitive comparison.
-   Note: This function may, in multibyte locales, return success even if
-   strlen (haystack) < strlen (needle) !
-   Unlike strcasestr(), this function works correctly in multibyte locales.  */
-extern char * mbscasestr (const char *haystack, const char *needle);
-#endif
-
-#if @GNULIB_MBSCSPN@
-/* Find the first occurrence in the character string STRING of any character
-   in the character string ACCEPT.  Return the number of bytes from the
-   beginning of the string to this occurrence, or to the end of the string
-   if none exists.
-   Unlike strcspn(), this function works correctly in multibyte locales.  */
-extern size_t mbscspn (const char *string, const char *accept);
-#endif
-
-#if @GNULIB_MBSPBRK@
-/* Find the first occurrence in the character string STRING of any character
-   in the character string ACCEPT.  Return the pointer to it, or NULL if none
-   exists.
-   Unlike strpbrk(), this function works correctly in multibyte locales.  */
-# define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */
-extern char * mbspbrk (const char *string, const char *accept);
-#endif
-
-#if @GNULIB_MBSSPN@
-/* Find the first occurrence in the character string STRING of any character
-   not in the character string REJECT.  Return the number of bytes from the
-   beginning of the string to this occurrence, or to the end of the string
-   if none exists.
-   Unlike strspn(), this function works correctly in multibyte locales.  */
-extern size_t mbsspn (const char *string, const char *reject);
-#endif
-
-#if @GNULIB_MBSSEP@
-/* Search the next delimiter (multibyte character listed in the character
-   string DELIM) starting at the character string *STRINGP.
-   If one is found, overwrite it with a NUL, and advance *STRINGP to point
-   to the next multibyte character after it.  Otherwise, set *STRINGP to NULL.
-   If *STRINGP was already NULL, nothing happens.
-   Return the old value of *STRINGP.
-
-   This is a variant of mbstok_r() that supports empty fields.
-
-   Caveat: It modifies the original string.
-   Caveat: These functions cannot be used on constant strings.
-   Caveat: The identity of the delimiting character is lost.
-
-   See also mbstok_r().  */
-extern char * mbssep (char **stringp, const char *delim);
-#endif
-
-#if @GNULIB_MBSTOK_R@
-/* Parse the character string STRING into tokens separated by characters in
-   the character string DELIM.
-   If STRING is NULL, the saved pointer in SAVE_PTR is used as
-   the next starting point.  For example:
-       char s[] = "-abc-=-def";
-       char *sp;
-       x = mbstok_r(s, "-", &sp);      // x = "abc", sp = "=-def"
-       x = mbstok_r(NULL, "-=", &sp);  // x = "def", sp = NULL
-       x = mbstok_r(NULL, "=", &sp);   // x = NULL
-               // s = "abc\0-def\0"
-
-   Caveat: It modifies the original string.
-   Caveat: These functions cannot be used on constant strings.
-   Caveat: The identity of the delimiting character is lost.
-
-   See also mbssep().  */
-extern char * mbstok_r (char *string, const char *delim, char **save_ptr);
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _GL_STRING_H */
-#endif /* _GL_STRING_H */
diff --git a/gnulib/sys_socket.in.h b/gnulib/sys_socket.in.h
new file mode 100644 (file)
index 0000000..5e0b097
--- /dev/null
@@ -0,0 +1,91 @@
+/* Provide a sys/socket header file for systems lacking it (read: MinGW).
+   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+   Written by Simon Josefsson.
+
+   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 3, 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.  */
+
+/* This file is supposed to be used on platforms that lack <sys/socket.h>
+   and on platforms where <sys/socket.h> cannot be included standalone.
+   It is intended to provide definitions and prototypes needed by an
+   application.  */
+
+#ifndef _GL_SYS_SOCKET_H
+
+#if @HAVE_SYS_SOCKET_H@
+
+/* On many platforms, <sys/socket.h> assumes prior inclusion of
+   <sys/types.h>.  */
+# include <sys/types.h>
+
+/* The include_next requires a split double-inclusion guard.  */
+# @INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@
+
+#endif
+
+#ifndef _GL_SYS_SOCKET_H
+#define _GL_SYS_SOCKET_H
+
+#if !@HAVE_SYS_SOCKET_H@
+
+/* A platform that lacks <sys/socket.h>.
+
+   Currently only MinGW is supported.  See the gnulib manual regarding
+   Windows sockets.  MinGW has the header files winsock2.h and
+   ws2tcpip.h that declare the sys/socket.h definitions we need.  Note
+   that you can influence which definitions you get by setting the
+   WINVER symbol before including these two files.  For example,
+   getaddrinfo is only available if _WIN32_WINNT >= 0x0501 (that
+   symbol is set indiriectly through WINVER).  You can set this by
+   adding AC_DEFINE(WINVER, 0x0501) to configure.ac.  Note that your
+   code may not run on older Windows releases then.  My Windows 2000
+   box was not able to run the code, for example.  The situation is
+   slightly confusing because:
+   http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/getaddrinfo_2.asp
+   suggests that getaddrinfo should be available on all Windows
+   releases. */
+
+
+# if @HAVE_WINSOCK2_H@
+#  include <winsock2.h>
+# endif
+# if @HAVE_WS2TCPIP_H@
+#  include <ws2tcpip.h>
+# endif
+
+/* For shutdown(). */
+# if !defined SHUT_RD && defined SD_RECEIVE
+#  define SHUT_RD SD_RECEIVE
+# endif
+# if !defined SHUT_WR && defined SD_SEND
+#  define SHUT_WR SD_SEND
+# endif
+# if !defined SHUT_RDWR && defined SD_BOTH
+#  define SHUT_RDWR SD_BOTH
+# endif
+
+# if defined _WIN32 || defined __WIN32__
+#  define ENOTSOCK                WSAENOTSOCK
+#  define EADDRINUSE              WSAEADDRINUSE
+#  define ENETRESET               WSAENETRESET
+#  define ECONNABORTED            WSAECONNABORTED
+#  define ECONNRESET              WSAECONNRESET
+#  define ENOTCONN                WSAENOTCONN
+#  define ESHUTDOWN               WSAESHUTDOWN
+# endif
+
+#endif /* HAVE_SYS_SOCKET_H */
+
+#endif /* _GL_SYS_SOCKET_H */
+#endif /* _GL_SYS_SOCKET_H */
diff --git a/gnulib/sys_socket_.h b/gnulib/sys_socket_.h
deleted file mode 100644 (file)
index c25b6ab..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/* Provide a sys/socket header file for systems lacking it (read: MinGW).
-   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
-   Written by Simon Josefsson.
-
-   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.  */
-
-/* This file is supposed to be used on platforms that lack <sys/socket.h>
-   and on platforms where <sys/socket.h> cannot be included standalone.
-   It is intended to provide definitions and prototypes needed by an
-   application.  */
-
-#ifndef _GL_SYS_SOCKET_H
-
-#if @HAVE_SYS_SOCKET_H@
-
-/* On many platforms, <sys/socket.h> assumes prior inclusion of
-   <sys/types.h>.  */
-# include <sys/types.h>
-
-/* The include_next requires a split double-inclusion guard.  */
-# @INCLUDE_NEXT@ @NEXT_SYS_SOCKET_H@
-
-#endif
-
-#ifndef _GL_SYS_SOCKET_H
-#define _GL_SYS_SOCKET_H
-
-#if !@HAVE_SYS_SOCKET_H@
-
-/* A platform that lacks <sys/socket.h>.
-
-   Currently only MinGW is supported.  See the gnulib manual regarding
-   Windows sockets.  MinGW has the header files winsock2.h and
-   ws2tcpip.h that declare the sys/socket.h definitions we need.  Note
-   that you can influence which definitions you get by setting the
-   WINVER symbol before including these two files.  For example,
-   getaddrinfo is only available if _WIN32_WINNT >= 0x0501 (that
-   symbol is set indiriectly through WINVER).  You can set this by
-   adding AC_DEFINE(WINVER, 0x0501) to configure.ac.  Note that your
-   code may not run on older Windows releases then.  My Windows 2000
-   box was not able to run the code, for example.  The situation is
-   slightly confusing because:
-   http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/getaddrinfo_2.asp
-   suggests that getaddrinfo should be available on all Windows
-   releases. */
-
-
-# if @HAVE_WINSOCK2_H@
-#  include <winsock2.h>
-# endif
-# if @HAVE_WS2TCPIP_H@
-#  include <ws2tcpip.h>
-# endif
-
-/* For shutdown(). */
-# if !defined SHUT_RD && defined SD_RECEIVE
-#  define SHUT_RD SD_RECEIVE
-# endif
-# if !defined SHUT_WR && defined SD_SEND
-#  define SHUT_WR SD_SEND
-# endif
-# if !defined SHUT_RDWR && defined SD_BOTH
-#  define SHUT_RDWR SD_BOTH
-# endif
-
-# if defined _WIN32 || defined __WIN32__
-#  define ENOTSOCK                WSAENOTSOCK
-#  define EADDRINUSE              WSAEADDRINUSE
-#  define ENETRESET               WSAENETRESET
-#  define ECONNABORTED            WSAECONNABORTED
-#  define ECONNRESET              WSAECONNRESET
-#  define ENOTCONN                WSAENOTCONN
-#  define ESHUTDOWN               WSAESHUTDOWN
-# endif
-
-#endif /* HAVE_SYS_SOCKET_H */
-
-#endif /* _GL_SYS_SOCKET_H */
-#endif /* _GL_SYS_SOCKET_H */
diff --git a/gnulib/sys_stat.in.h b/gnulib/sys_stat.in.h
new file mode 100644 (file)
index 0000000..b60e322
--- /dev/null
@@ -0,0 +1,280 @@
+/* Provide a more complete sys/stat header file.
+   Copyright (C) 2006, 2007 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 3, 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.  */
+
+/* Written by Eric Blake, Paul Eggert, and Jim Meyering.  */
+
+/* This file is supposed to be used on platforms where <sys/stat.h> is
+   incomplete.  It is intended to provide definitions and prototypes
+   needed by an application.  Start with what the system provides.  */
+
+#ifndef _GL_SYS_STAT_H
+
+/* The include_next requires a split double-inclusion guard.  */
+#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
+
+#ifndef _GL_SYS_STAT_H
+#define _GL_SYS_STAT_H
+
+#ifndef S_IFMT
+# define S_IFMT 0170000
+#endif
+
+#if STAT_MACROS_BROKEN
+# undef S_ISBLK
+# undef S_ISCHR
+# undef S_ISDIR
+# undef S_ISFIFO
+# undef S_ISLNK
+# undef S_ISNAM
+# undef S_ISMPB
+# undef S_ISMPC
+# undef S_ISNWK
+# undef S_ISREG
+# undef S_ISSOCK
+#endif
+
+#ifndef S_ISBLK
+# ifdef S_IFBLK
+#  define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
+# else
+#  define S_ISBLK(m) 0
+# endif
+#endif
+
+#ifndef S_ISCHR
+# ifdef S_IFCHR
+#  define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
+# else
+#  define S_ISCHR(m) 0
+# endif
+#endif
+
+#ifndef S_ISDIR
+# ifdef S_IFDIR
+#  define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+# else
+#  define S_ISDIR(m) 0
+# endif
+#endif
+
+#ifndef S_ISDOOR /* Solaris 2.5 and up */
+# define S_ISDOOR(m) 0
+#endif
+
+#ifndef S_ISFIFO
+# ifdef S_IFIFO
+#  define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
+# else
+#  define S_ISFIFO(m) 0
+# endif
+#endif
+
+#ifndef S_ISLNK
+# ifdef S_IFLNK
+#  define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
+# else
+#  define S_ISLNK(m) 0
+# endif
+#endif
+
+#ifndef S_ISMPB /* V7 */
+# ifdef S_IFMPB
+#  define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
+#  define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
+# else
+#  define S_ISMPB(m) 0
+#  define S_ISMPC(m) 0
+# endif
+#endif
+
+#ifndef S_ISNAM /* Xenix */
+# ifdef S_IFNAM
+#  define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
+# else
+#  define S_ISNAM(m) 0
+# endif
+#endif
+
+#ifndef S_ISNWK /* HP/UX */
+# ifdef S_IFNWK
+#  define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
+# else
+#  define S_ISNWK(m) 0
+# endif
+#endif
+
+#ifndef S_ISPORT /* Solaris 10 and up */
+# define S_ISPORT(m) 0
+#endif
+
+#ifndef S_ISREG
+# ifdef S_IFREG
+#  define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
+# else
+#  define S_ISREG(m) 0
+# endif
+#endif
+
+#ifndef S_ISSOCK
+# ifdef S_IFSOCK
+#  define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
+# else
+#  define S_ISSOCK(m) 0
+# endif
+#endif
+
+
+#ifndef S_TYPEISMQ
+# define S_TYPEISMQ(p) 0
+#endif
+
+#ifndef S_TYPEISTMO
+# define S_TYPEISTMO(p) 0
+#endif
+
+
+#ifndef S_TYPEISSEM
+# ifdef S_INSEM
+#  define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
+# else
+#  define S_TYPEISSEM(p) 0
+# endif
+#endif
+
+#ifndef S_TYPEISSHM
+# ifdef S_INSHD
+#  define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD)
+# else
+#  define S_TYPEISSHM(p) 0
+# endif
+#endif
+
+/* high performance ("contiguous data") */
+#ifndef S_ISCTG
+# define S_ISCTG(p) 0
+#endif
+
+/* Cray DMF (data migration facility): off line, with data  */
+#ifndef S_ISOFD
+# define S_ISOFD(p) 0
+#endif
+
+/* Cray DMF (data migration facility): off line, with no data  */
+#ifndef S_ISOFL
+# define S_ISOFL(p) 0
+#endif
+
+/* 4.4BSD whiteout */
+#ifndef S_ISWHT
+# define S_ISWHT(m) 0
+#endif
+
+/* If any of the following are undefined,
+   define them to their de facto standard values.  */
+#if !S_ISUID
+# define S_ISUID 04000
+#endif
+#if !S_ISGID
+# define S_ISGID 02000
+#endif
+
+/* S_ISVTX is a common extension to POSIX.  */
+#ifndef S_ISVTX
+# define S_ISVTX 01000
+#endif
+
+#if !S_IRUSR && S_IREAD
+# define S_IRUSR S_IREAD
+#endif
+#if !S_IRUSR
+# define S_IRUSR 00400
+#endif
+#if !S_IRGRP
+# define S_IRGRP (S_IRUSR >> 3)
+#endif
+#if !S_IROTH
+# define S_IROTH (S_IRUSR >> 6)
+#endif
+
+#if !S_IWUSR && S_IWRITE
+# define S_IWUSR S_IWRITE
+#endif
+#if !S_IWUSR
+# define S_IWUSR 00200
+#endif
+#if !S_IWGRP
+# define S_IWGRP (S_IWUSR >> 3)
+#endif
+#if !S_IWOTH
+# define S_IWOTH (S_IWUSR >> 6)
+#endif
+
+#if !S_IXUSR && S_IEXEC
+# define S_IXUSR S_IEXEC
+#endif
+#if !S_IXUSR
+# define S_IXUSR 00100
+#endif
+#if !S_IXGRP
+# define S_IXGRP (S_IXUSR >> 3)
+#endif
+#if !S_IXOTH
+# define S_IXOTH (S_IXUSR >> 6)
+#endif
+
+#if !S_IRWXU
+# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
+#endif
+#if !S_IRWXG
+# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
+#endif
+#if !S_IRWXO
+# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
+#endif
+
+/* S_IXUGO is a common extension to POSIX.  */
+#if !S_IXUGO
+# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
+#endif
+
+#ifndef S_IRWXUGO
+# define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
+#endif
+
+/* mingw does not support symlinks, therefore it does not have lstat.  But
+   without links, stat does just fine.  */
+#if ! @HAVE_LSTAT@
+# define lstat stat
+#endif
+
+/* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
+   Additionally, it declares _mkdir (and depending on compile flags, an
+   alias mkdir), only in the nonstandard io.h.  */
+#if ! @HAVE_DECL_MKDIR@ && @HAVE_IO_H@
+# include <io.h>
+
+static inline int
+rpl_mkdir (char const *name, mode_t mode)
+{
+  return _mkdir (name);
+}
+
+# define mkdir rpl_mkdir
+#endif
+
+#endif /* _GL_SYS_STAT_H */
+#endif /* _GL_SYS_STAT_H */
diff --git a/gnulib/sys_stat_.h b/gnulib/sys_stat_.h
deleted file mode 100644 (file)
index 2e411cd..0000000
+++ /dev/null
@@ -1,280 +0,0 @@
-/* Provide a more complete sys/stat header file.
-   Copyright (C) 2006, 2007 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.  */
-
-/* Written by Eric Blake, Paul Eggert, and Jim Meyering.  */
-
-/* This file is supposed to be used on platforms where <sys/stat.h> is
-   incomplete.  It is intended to provide definitions and prototypes
-   needed by an application.  Start with what the system provides.  */
-
-#ifndef _GL_SYS_STAT_H
-
-/* The include_next requires a split double-inclusion guard.  */
-#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@
-
-#ifndef _GL_SYS_STAT_H
-#define _GL_SYS_STAT_H
-
-#ifndef S_IFMT
-# define S_IFMT 0170000
-#endif
-
-#if STAT_MACROS_BROKEN
-# undef S_ISBLK
-# undef S_ISCHR
-# undef S_ISDIR
-# undef S_ISFIFO
-# undef S_ISLNK
-# undef S_ISNAM
-# undef S_ISMPB
-# undef S_ISMPC
-# undef S_ISNWK
-# undef S_ISREG
-# undef S_ISSOCK
-#endif
-
-#ifndef S_ISBLK
-# ifdef S_IFBLK
-#  define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
-# else
-#  define S_ISBLK(m) 0
-# endif
-#endif
-
-#ifndef S_ISCHR
-# ifdef S_IFCHR
-#  define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
-# else
-#  define S_ISCHR(m) 0
-# endif
-#endif
-
-#ifndef S_ISDIR
-# ifdef S_IFDIR
-#  define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
-# else
-#  define S_ISDIR(m) 0
-# endif
-#endif
-
-#ifndef S_ISDOOR /* Solaris 2.5 and up */
-# define S_ISDOOR(m) 0
-#endif
-
-#ifndef S_ISFIFO
-# ifdef S_IFIFO
-#  define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
-# else
-#  define S_ISFIFO(m) 0
-# endif
-#endif
-
-#ifndef S_ISLNK
-# ifdef S_IFLNK
-#  define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
-# else
-#  define S_ISLNK(m) 0
-# endif
-#endif
-
-#ifndef S_ISMPB /* V7 */
-# ifdef S_IFMPB
-#  define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
-#  define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
-# else
-#  define S_ISMPB(m) 0
-#  define S_ISMPC(m) 0
-# endif
-#endif
-
-#ifndef S_ISNAM /* Xenix */
-# ifdef S_IFNAM
-#  define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM)
-# else
-#  define S_ISNAM(m) 0
-# endif
-#endif
-
-#ifndef S_ISNWK /* HP/UX */
-# ifdef S_IFNWK
-#  define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
-# else
-#  define S_ISNWK(m) 0
-# endif
-#endif
-
-#ifndef S_ISPORT /* Solaris 10 and up */
-# define S_ISPORT(m) 0
-#endif
-
-#ifndef S_ISREG
-# ifdef S_IFREG
-#  define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
-# else
-#  define S_ISREG(m) 0
-# endif
-#endif
-
-#ifndef S_ISSOCK
-# ifdef S_IFSOCK
-#  define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
-# else
-#  define S_ISSOCK(m) 0
-# endif
-#endif
-
-
-#ifndef S_TYPEISMQ
-# define S_TYPEISMQ(p) 0
-#endif
-
-#ifndef S_TYPEISTMO
-# define S_TYPEISTMO(p) 0
-#endif
-
-
-#ifndef S_TYPEISSEM
-# ifdef S_INSEM
-#  define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM)
-# else
-#  define S_TYPEISSEM(p) 0
-# endif
-#endif
-
-#ifndef S_TYPEISSHM
-# ifdef S_INSHD
-#  define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD)
-# else
-#  define S_TYPEISSHM(p) 0
-# endif
-#endif
-
-/* high performance ("contiguous data") */
-#ifndef S_ISCTG
-# define S_ISCTG(p) 0
-#endif
-
-/* Cray DMF (data migration facility): off line, with data  */
-#ifndef S_ISOFD
-# define S_ISOFD(p) 0
-#endif
-
-/* Cray DMF (data migration facility): off line, with no data  */
-#ifndef S_ISOFL
-# define S_ISOFL(p) 0
-#endif
-
-/* 4.4BSD whiteout */
-#ifndef S_ISWHT
-# define S_ISWHT(m) 0
-#endif
-
-/* If any of the following are undefined,
-   define them to their de facto standard values.  */
-#if !S_ISUID
-# define S_ISUID 04000
-#endif
-#if !S_ISGID
-# define S_ISGID 02000
-#endif
-
-/* S_ISVTX is a common extension to POSIX.  */
-#ifndef S_ISVTX
-# define S_ISVTX 01000
-#endif
-
-#if !S_IRUSR && S_IREAD
-# define S_IRUSR S_IREAD
-#endif
-#if !S_IRUSR
-# define S_IRUSR 00400
-#endif
-#if !S_IRGRP
-# define S_IRGRP (S_IRUSR >> 3)
-#endif
-#if !S_IROTH
-# define S_IROTH (S_IRUSR >> 6)
-#endif
-
-#if !S_IWUSR && S_IWRITE
-# define S_IWUSR S_IWRITE
-#endif
-#if !S_IWUSR
-# define S_IWUSR 00200
-#endif
-#if !S_IWGRP
-# define S_IWGRP (S_IWUSR >> 3)
-#endif
-#if !S_IWOTH
-# define S_IWOTH (S_IWUSR >> 6)
-#endif
-
-#if !S_IXUSR && S_IEXEC
-# define S_IXUSR S_IEXEC
-#endif
-#if !S_IXUSR
-# define S_IXUSR 00100
-#endif
-#if !S_IXGRP
-# define S_IXGRP (S_IXUSR >> 3)
-#endif
-#if !S_IXOTH
-# define S_IXOTH (S_IXUSR >> 6)
-#endif
-
-#if !S_IRWXU
-# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
-#endif
-#if !S_IRWXG
-# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
-#endif
-#if !S_IRWXO
-# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
-#endif
-
-/* S_IXUGO is a common extension to POSIX.  */
-#if !S_IXUGO
-# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
-#endif
-
-#ifndef S_IRWXUGO
-# define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
-#endif
-
-/* mingw does not support symlinks, therefore it does not have lstat.  But
-   without links, stat does just fine.  */
-#if ! @HAVE_LSTAT@
-# define lstat stat
-#endif
-
-/* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
-   Additionally, it declares _mkdir (and depending on compile flags, an
-   alias mkdir), only in the nonstandard io.h.  */
-#if ! @HAVE_DECL_MKDIR@ && @HAVE_IO_H@
-# include <io.h>
-
-static inline int
-rpl_mkdir (char const *name, mode_t mode)
-{
-  return _mkdir (name);
-}
-
-# define mkdir rpl_mkdir
-#endif
-
-#endif /* _GL_SYS_STAT_H */
-#endif /* _GL_SYS_STAT_H */
diff --git a/gnulib/sys_time.in.h b/gnulib/sys_time.in.h
new file mode 100644 (file)
index 0000000..6b65cb6
--- /dev/null
@@ -0,0 +1,52 @@
+/* Provide a more complete sys/time.h.
+
+   Copyright (C) 2007 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 3, 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.  */
+
+/* Written by Paul Eggert.  */
+
+#if defined _GL_SYS_TIME_H
+
+/* Simply delegate to the system's header, without adding anything.  */
+# if @HAVE_SYS_TIME_H@
+#  @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
+# endif
+
+#else
+
+# define _GL_SYS_TIME_H
+
+# if @HAVE_SYS_TIME_H@
+#  @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
+# else
+#  include <time.h>
+# endif
+
+# if ! @HAVE_STRUCT_TIMEVAL@
+struct timeval
+{
+  time_t tv_sec;
+  long int tv_usec;
+};
+# endif
+
+# if @REPLACE_GETTIMEOFDAY@
+#  undef gettimeofday
+#  define gettimeofday rpl_gettimeofday
+int gettimeofday (struct timeval *, void *);
+# endif
+
+#endif /* _GL_SYS_TIME_H */
diff --git a/gnulib/sys_time_.h b/gnulib/sys_time_.h
deleted file mode 100644 (file)
index 296d20d..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Provide a more complete sys/time.h.
-
-   Copyright (C) 2007 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.  */
-
-/* Written by Paul Eggert.  */
-
-#if defined _GL_SYS_TIME_H
-
-/* Simply delegate to the system's header, without adding anything.  */
-# if @HAVE_SYS_TIME_H@
-#  @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
-# endif
-
-#else
-
-# define _GL_SYS_TIME_H
-
-# if @HAVE_SYS_TIME_H@
-#  @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
-# else
-#  include <time.h>
-# endif
-
-# if ! @HAVE_STRUCT_TIMEVAL@
-struct timeval
-{
-  time_t tv_sec;
-  long int tv_usec;
-};
-# endif
-
-# if @REPLACE_GETTIMEOFDAY@
-#  undef gettimeofday
-#  define gettimeofday rpl_gettimeofday
-int gettimeofday (struct timeval *restrict, void *restrict);
-# endif
-
-#endif /* _GL_SYS_TIME_H */
index e213600e3f2b33ea851e1d2bc418cb9646ce1bf4..5a3a3260c4e232fc87c3cf6fda9cf7c688932da9 100644 (file)
@@ -4,19 +4,18 @@
    2000, 2001, 2002, 2003, 2005, 2006, 2007 Free Software Foundation,
    Inc.
 
-   This program is free software; you can redistribute it and/or modify
+   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.
+   the Free Software Foundation; either version 3 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.  */
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* Extracted from glibc sysdeps/posix/tempname.c.  See also tmpdir.c.  */
 
index c51fa694240dd300c61c56db0681dca28f92a681..74da03b3b29de5c206cdbd42f62f3ce2477d0010 100644 (file)
@@ -2,10 +2,10 @@
 
    Copyright (C) 2006 Free Software Foundation, Inc.
 
-   This program is free software; you can redistribute it and/or modify
+   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.
+   the Free Software Foundation; either version 3 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
@@ -13,8 +13,7 @@
    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.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* header written by Eric Blake */
 
diff --git a/gnulib/unistd.in.h b/gnulib/unistd.in.h
new file mode 100644 (file)
index 0000000..17b29af
--- /dev/null
@@ -0,0 +1,340 @@
+/* Substitute for and wrapper around <unistd.h>.
+   Copyright (C) 2004-2008 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 3, 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.  */
+
+#ifndef _GL_UNISTD_H
+
+/* The include_next requires a split double-inclusion guard.  */
+#if @HAVE_UNISTD_H@
+# @INCLUDE_NEXT@ @NEXT_UNISTD_H@
+#endif
+
+#ifndef _GL_UNISTD_H
+#define _GL_UNISTD_H
+
+/* mingw doesn't define the SEEK_* macros in <unistd.h>.  */
+#if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET)
+# include <stdio.h>
+#endif
+
+/* mingw fails to declare _exit in <unistd.h>.  */
+#include <stdlib.h>
+
+/* The definition of GL_LINK_WARNING is copied here.  */
+
+
+/* Declare overridden functions.  */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#if @GNULIB_CHOWN@
+# if @REPLACE_CHOWN@
+#  ifndef REPLACE_CHOWN
+#   define REPLACE_CHOWN 1
+#  endif
+#  if REPLACE_CHOWN
+/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
+   to GID (if GID is not -1).  Follow symbolic links.
+   Return 0 if successful, otherwise -1 and errno set.
+   See the POSIX:2001 specification
+   <http://www.opengroup.org/susv3xsh/chown.html>.  */
+#   define chown rpl_chown
+extern int chown (const char *file, uid_t uid, gid_t gid);
+#  endif
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef chown
+# define chown(f,u,g) \
+    (GL_LINK_WARNING ("chown fails to follow symlinks on some systems and " \
+                      "doesn't treat a uid or gid of -1 on some systems - " \
+                      "use gnulib module chown for portability"), \
+     chown (f, u, g))
+#endif
+
+
+#if @GNULIB_DUP2@
+# if !@HAVE_DUP2@
+/* Copy the file descriptor OLDFD into file descriptor NEWFD.  Do nothing if
+   NEWFD = OLDFD, otherwise close NEWFD first if it is open.
+   Return 0 if successful, otherwise -1 and errno set.
+   See the POSIX:2001 specification
+   <http://www.opengroup.org/susv3xsh/dup2.html>.  */
+extern int dup2 (int oldfd, int newfd);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef dup2
+# define dup2(o,n) \
+    (GL_LINK_WARNING ("dup2 is unportable - " \
+                      "use gnulib module dup2 for portability"), \
+     dup2 (o, n))
+#endif
+
+
+#if @GNULIB_ENVIRON@
+# if !@HAVE_DECL_ENVIRON@
+/* Set of environment variables and values.  An array of strings of the form
+   "VARIABLE=VALUE", terminated with a NULL.  */
+#  if defined __APPLE__ && defined __MACH__
+#   include <crt_externs.h>
+#   define environ (*_NSGetEnviron ())
+#  else
+extern char **environ;
+#  endif
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef environ
+# define environ \
+    (GL_LINK_WARNING ("environ is unportable - " \
+                      "use gnulib module environ for portability"), \
+     environ)
+#endif
+
+
+#if @GNULIB_FCHDIR@
+# if @REPLACE_FCHDIR@
+
+/* Change the process' current working directory to the directory on which
+   the given file descriptor is open.
+   Return 0 if successful, otherwise -1 and errno set.
+   See the POSIX:2001 specification
+   <http://www.opengroup.org/susv3xsh/fchdir.html>.  */
+extern int fchdir (int /*fd*/);
+
+#  define close rpl_close
+extern int close (int);
+#  define dup rpl_dup
+extern int dup (int);
+#  define dup2 rpl_dup2
+extern int dup2 (int, int);
+
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef fchdir
+# define fchdir(f) \
+    (GL_LINK_WARNING ("fchdir is unportable - " \
+                      "use gnulib module fchdir for portability"), \
+     fchdir (f))
+#endif
+
+
+#if @GNULIB_FTRUNCATE@
+# if !@HAVE_FTRUNCATE@
+/* Change the size of the file to which FD is opened to become equal to LENGTH.
+   Return 0 if successful, otherwise -1 and errno set.
+   See the POSIX:2001 specification
+   <http://www.opengroup.org/susv3xsh/ftruncate.html>.  */
+extern int ftruncate (int fd, off_t length);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef ftruncate
+# define ftruncate(f,l) \
+    (GL_LINK_WARNING ("ftruncate is unportable - " \
+                      "use gnulib module ftruncate for portability"), \
+     ftruncate (f, l))
+#endif
+
+
+#if @GNULIB_GETCWD@
+/* Include the headers that might declare getcwd so that they will not
+   cause confusion if included after this file.  */
+# include <stdlib.h>
+# if @REPLACE_GETCWD@
+/* Get the name of the current working directory, and put it in SIZE bytes
+   of BUF.
+   Return BUF if successful, or NULL if the directory couldn't be determined
+   or SIZE was too small.
+   See the POSIX:2001 specification
+   <http://www.opengroup.org/susv3xsh/getcwd.html>.
+   Additionally, the gnulib module 'getcwd' guarantees the following GNU
+   extension: If BUF is NULL, an array is allocated with 'malloc'; the array
+   is SIZE bytes long, unless SIZE == 0, in which case it is as big as
+   necessary.  */
+#  define getcwd rpl_getcwd
+extern char * getcwd (char *buf, size_t size);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getcwd
+# define getcwd(b,s) \
+    (GL_LINK_WARNING ("getcwd is unportable - " \
+                      "use gnulib module getcwd for portability"), \
+     getcwd (b, s))
+#endif
+
+
+#if @GNULIB_GETLOGIN_R@
+/* Copies the user's login name to NAME.
+   The array pointed to by NAME has room for SIZE bytes.
+
+   Returns 0 if successful.  Upon error, an error number is returned, or -1 in
+   the case that the login name cannot be found but no specific error is
+   provided (this case is hopefully rare but is left open by the POSIX spec).
+
+   See <http://www.opengroup.org/susv3xsh/getlogin.html>.
+ */
+# if !@HAVE_DECL_GETLOGIN_R@
+#  include <stddef.h>
+extern int getlogin_r (char *name, size_t size);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getlogin_r
+# define getlogin_r(n,s) \
+    (GL_LINK_WARNING ("getlogin_r is unportable - " \
+                      "use gnulib module getlogin_r for portability"), \
+     getlogin_r (n, s))
+#endif
+
+
+#if @GNULIB_GETPAGESIZE@
+# if @REPLACE_GETPAGESIZE@
+#  define getpagesize rpl_getpagesize
+extern int getpagesize (void);
+# elif !@HAVE_GETPAGESIZE@
+/* This is for POSIX systems.  */
+#  if !defined getpagesize && defined _SC_PAGESIZE
+#   if ! (defined __VMS && __VMS_VER < 70000000)
+#    define getpagesize() sysconf (_SC_PAGESIZE)
+#   endif
+#  endif
+/* This is for older VMS.  */
+#  if !defined getpagesize && defined __VMS
+#   ifdef __ALPHA
+#    define getpagesize() 8192
+#   else
+#    define getpagesize() 512
+#   endif
+#  endif
+/* This is for BeOS.  */
+#  if !defined getpagesize && @HAVE_OS_H@
+#   include <OS.h>
+#   if defined B_PAGE_SIZE
+#    define getpagesize() B_PAGE_SIZE
+#   endif
+#  endif
+/* This is for AmigaOS4.0.  */
+#  if !defined getpagesize && defined __amigaos4__
+#   define getpagesize() 2048
+#  endif
+/* This is for older Unix systems.  */
+#  if !defined getpagesize && @HAVE_SYS_PARAM_H@
+#   include <sys/param.h>
+#   ifdef EXEC_PAGESIZE
+#    define getpagesize() EXEC_PAGESIZE
+#   else
+#    ifdef NBPG
+#     ifndef CLSIZE
+#      define CLSIZE 1
+#     endif
+#     define getpagesize() (NBPG * CLSIZE)
+#    else
+#     ifdef NBPC
+#      define getpagesize() NBPC
+#     endif
+#    endif
+#   endif
+#  endif
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef getpagesize
+# define getpagesize() \
+    (GL_LINK_WARNING ("getpagesize is unportable - " \
+                      "use gnulib module getpagesize for portability"), \
+     getpagesize ())
+#endif
+
+
+#if @GNULIB_LCHOWN@
+# if @REPLACE_LCHOWN@
+/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
+   to GID (if GID is not -1).  Do not follow symbolic links.
+   Return 0 if successful, otherwise -1 and errno set.
+   See the POSIX:2001 specification
+   <http://www.opengroup.org/susv3xsh/lchown.html>.  */
+#  define lchown rpl_lchown
+extern int lchown (char const *file, uid_t owner, gid_t group);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef lchown
+# define lchown(f,u,g) \
+    (GL_LINK_WARNING ("lchown is unportable to pre-POSIX.1-2001 " \
+                      "systems - use gnulib module lchown for portability"), \
+     lchown (f, u, g))
+#endif
+
+
+#if @GNULIB_LSEEK@
+# if @REPLACE_LSEEK@
+/* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
+   Return the new offset if successful, otherwise -1 and errno set.
+   See the POSIX:2001 specification
+   <http://www.opengroup.org/susv3xsh/lseek.html>.  */
+#  define lseek rpl_lseek
+   extern off_t lseek (int fd, off_t offset, int whence);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef lseek
+# define lseek(f,o,w) \
+    (GL_LINK_WARNING ("lseek does not fail with ESPIPE on pipes on some " \
+                      "systems - use gnulib module lseek for portability"), \
+     lseek (f, o, w))
+#endif
+
+
+#if @GNULIB_READLINK@
+/* Read the contents of the symbolic link FILE and place the first BUFSIZE
+   bytes of it into BUF.  Return the number of bytes placed into BUF if
+   successful, otherwise -1 and errno set.
+   See the POSIX:2001 specification
+   <http://www.opengroup.org/susv3xsh/readlink.html>.  */
+# if !@HAVE_READLINK@
+#  include <stddef.h>
+extern int readlink (const char *file, char *buf, size_t bufsize);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef readlink
+# define readlink(f,b,s) \
+    (GL_LINK_WARNING ("readlink is unportable - " \
+                      "use gnulib module readlink for portability"), \
+     readlink (f, b, s))
+#endif
+
+
+#if @GNULIB_SLEEP@
+/* Pause the execution of the current thread for N seconds.
+   Returns the number of seconds left to sleep.
+   See the POSIX:2001 specification
+   <http://www.opengroup.org/susv3xsh/sleep.html>.  */
+# if !@HAVE_SLEEP@
+extern unsigned int sleep (unsigned int n);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef sleep
+# define sleep(n) \
+    (GL_LINK_WARNING ("sleep is unportable - " \
+                      "use gnulib module sleep for portability"), \
+     sleep (n))
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* _GL_UNISTD_H */
+#endif /* _GL_UNISTD_H */
diff --git a/gnulib/unistd_.h b/gnulib/unistd_.h
deleted file mode 100644 (file)
index 07c4877..0000000
+++ /dev/null
@@ -1,262 +0,0 @@
-/* Substitute for and wrapper around <unistd.h>.
-   Copyright (C) 2004-2007 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.  */
-
-#ifndef _GL_UNISTD_H
-
-/* The include_next requires a split double-inclusion guard.  */
-#if @HAVE_UNISTD_H@
-# @INCLUDE_NEXT@ @NEXT_UNISTD_H@
-#endif
-
-#ifndef _GL_UNISTD_H
-#define _GL_UNISTD_H
-
-/* mingw doesn't define the SEEK_* macros in <unistd.h>.  */
-#if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET)
-# include <stdio.h>
-#endif
-
-/* mingw fails to declare _exit in <unistd.h>.  */
-#include <stdlib.h>
-
-/* The definition of GL_LINK_WARNING is copied here.  */
-
-
-/* Declare overridden functions.  */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#if @GNULIB_CHOWN@
-# if @REPLACE_CHOWN@
-#  ifndef REPLACE_CHOWN
-#   define REPLACE_CHOWN 1
-#  endif
-#  if REPLACE_CHOWN
-/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
-   to GID (if GID is not -1).  Follow symbolic links.
-   Return 0 if successful, otherwise -1 and errno set.
-   See the POSIX:2001 specification
-   <http://www.opengroup.org/susv3xsh/chown.html>.  */
-#   define chown rpl_chown
-extern int chown (const char *file, uid_t uid, gid_t gid);
-#  endif
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef chown
-# define chown(f,u,g) \
-    (GL_LINK_WARNING ("chown fails to follow symlinks on some systems and " \
-                      "doesn't treat a uid or gid of -1 on some systems - " \
-                      "use gnulib module chown for portability"), \
-     chown (f, u, g))
-#endif
-
-
-#if @GNULIB_DUP2@
-# if !@HAVE_DUP2@
-/* Copy the file descriptor OLDFD into file descriptor NEWFD.  Do nothing if
-   NEWFD = OLDFD, otherwise close NEWFD first if it is open.
-   Return 0 if successful, otherwise -1 and errno set.
-   See the POSIX:2001 specification
-   <http://www.opengroup.org/susv3xsh/dup2.html>.  */
-extern int dup2 (int oldfd, int newfd);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef dup2
-# define dup2(o,n) \
-    (GL_LINK_WARNING ("dup2 is unportable - " \
-                      "use gnulib module dup2 for portability"), \
-     dup2 (o, n))
-#endif
-
-
-#if @GNULIB_FCHDIR@
-# if @REPLACE_FCHDIR@
-
-/* Change the process' current working directory to the directory on which
-   the given file descriptor is open.
-   Return 0 if successful, otherwise -1 and errno set.
-   See the POSIX:2001 specification
-   <http://www.opengroup.org/susv3xsh/fchdir.html>.  */
-extern int fchdir (int /*fd*/);
-
-#  define close rpl_close
-extern int close (int);
-#  define dup rpl_dup
-extern int dup (int);
-#  define dup2 rpl_dup2
-extern int dup2 (int, int);
-
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef fchdir
-# define fchdir(f) \
-    (GL_LINK_WARNING ("fchdir is unportable - " \
-                      "use gnulib module fchdir for portability"), \
-     fchdir (f))
-#endif
-
-
-#if @GNULIB_FTRUNCATE@
-# if !@HAVE_FTRUNCATE@
-/* Change the size of the file to which FD is opened to become equal to LENGTH.
-   Return 0 if successful, otherwise -1 and errno set.
-   See the POSIX:2001 specification
-   <http://www.opengroup.org/susv3xsh/ftruncate.html>.  */
-extern int ftruncate (int fd, off_t length);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef ftruncate
-# define ftruncate(f,l) \
-    (GL_LINK_WARNING ("ftruncate is unportable - " \
-                      "use gnulib module ftruncate for portability"), \
-     ftruncate (f, l))
-#endif
-
-
-#if @GNULIB_GETCWD@
-/* Include the headers that might declare getcwd so that they will not
-   cause confusion if included after this file.  */
-# include <stdlib.h>
-# if @REPLACE_GETCWD@
-/* Get the name of the current working directory, and put it in SIZE bytes
-   of BUF.
-   Return BUF if successful, or NULL if the directory couldn't be determined
-   or SIZE was too small.
-   See the POSIX:2001 specification
-   <http://www.opengroup.org/susv3xsh/getcwd.html>.
-   Additionally, the gnulib module 'getcwd' guarantees the following GNU
-   extension: If BUF is NULL, an array is allocated with 'malloc'; the array
-   is SIZE bytes long, unless SIZE == 0, in which case it is as big as
-   necessary.  */
-#  define getcwd rpl_getcwd
-extern char * getcwd (char *buf, size_t size);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef getcwd
-# define getcwd(b,s) \
-    (GL_LINK_WARNING ("getcwd is unportable - " \
-                      "use gnulib module getcwd for portability"), \
-     getcwd (b, s))
-#endif
-
-
-#if @GNULIB_GETLOGIN_R@
-/* Copies the user's login name to NAME.
-   The array pointed to by NAME has room for SIZE bytes.
-
-   Returns 0 if successful.  Upon error, an error number is returned, or -1 in
-   the case that the login name cannot be found but no specific error is
-   provided (this case is hopefully rare but is left open by the POSIX spec).
-
-   See <http://www.opengroup.org/susv3xsh/getlogin.html>.
- */
-# if !@HAVE_DECL_GETLOGIN_R@
-#  include <stddef.h>
-extern int getlogin_r (char *name, size_t size);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef getlogin_r
-# define getlogin_r(n,s) \
-    (GL_LINK_WARNING ("getlogin_r is unportable - " \
-                      "use gnulib module getlogin_r for portability"), \
-     getlogin_r (n, s))
-#endif
-
-
-#if @GNULIB_LCHOWN@
-# if @REPLACE_LCHOWN@
-/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
-   to GID (if GID is not -1).  Do not follow symbolic links.
-   Return 0 if successful, otherwise -1 and errno set.
-   See the POSIX:2001 specification
-   <http://www.opengroup.org/susv3xsh/lchown.html>.  */
-#  define lchown rpl_lchown
-extern int lchown (char const *file, uid_t owner, gid_t group);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef lchown
-# define lchown(f,u,g) \
-    (GL_LINK_WARNING ("lchown is unportable to pre-POSIX.1-2001 " \
-                      "systems - use gnulib module lchown for portability"), \
-     lchown (f, u, g))
-#endif
-
-
-#if @GNULIB_LSEEK@
-# if @REPLACE_LSEEK@
-/* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END.
-   Return the new offset if successful, otherwise -1 and errno set.
-   See the POSIX:2001 specification
-   <http://www.opengroup.org/susv3xsh/lseek.html>.  */
-#  define lseek rpl_lseek
-   extern off_t lseek (int fd, off_t offset, int whence);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef lseek
-# define lseek(f,o,w) \
-    (GL_LINK_WARNING ("lseek does not fail with ESPIPE on pipes on some " \
-                      "systems - use gnulib module lseek for portability"), \
-     lseek (f, o, w))
-#endif
-
-
-#if @GNULIB_READLINK@
-/* Read the contents of the symbolic link FILE and place the first BUFSIZE
-   bytes of it into BUF.  Return the number of bytes placed into BUF if
-   successful, otherwise -1 and errno set.
-   See the POSIX:2001 specification
-   <http://www.opengroup.org/susv3xsh/readlink.html>.  */
-# if !@HAVE_READLINK@
-#  include <stddef.h>
-extern int readlink (const char *file, char *buf, size_t bufsize);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef readlink
-# define readlink(f,b,s) \
-    (GL_LINK_WARNING ("readlink is unportable - " \
-                      "use gnulib module readlink for portability"), \
-     readlink (f, b, s))
-#endif
-
-
-#if @GNULIB_SLEEP@
-/* Pause the execution of the current thread for N seconds.
-   Returns the number of seconds left to sleep.
-   See the POSIX:2001 specification
-   <http://www.opengroup.org/susv3xsh/sleep.html>.  */
-# if !@HAVE_SLEEP@
-extern unsigned int sleep (unsigned int n);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef sleep
-# define sleep(n) \
-    (GL_LINK_WARNING ("sleep is unportable - " \
-                      "use gnulib module sleep for portability"), \
-     sleep (n))
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* _GL_UNISTD_H */
-#endif /* _GL_UNISTD_H */
index f56382334919f19824971ece142a18194e211fba..d5b40286d5ca2deebd7e93bc7dbf5b8186183bff 100644 (file)
@@ -1,9 +1,9 @@
 /* vsprintf with automatic memory allocation.
-   Copyright (C) 1999, 2002-2007 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002-2008 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)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    This program is distributed in the hope that it will be useful,
 /* Checked size_t computations.  */
 #include "xsize.h"
 
-#if NEED_PRINTF_LONG_DOUBLE && !defined IN_LIBINTL
+#if (NEED_PRINTF_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL
 # include <math.h>
 # include "float+.h"
-# include "fpucw.h"
 #endif
 
-#if NEED_PRINTF_INFINITE_DOUBLE && !defined IN_LIBINTL
+#if (NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL
 # include <math.h>
-# include "isnan.h"
+# include "isnand.h"
 #endif
 
-#if NEED_PRINTF_INFINITE_LONG_DOUBLE && !defined IN_LIBINTL
+#if (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE) && !defined IN_LIBINTL
 # include <math.h>
 # include "isnanl-nolibm.h"
 # include "fpucw.h"
 #endif
 
-#if NEED_PRINTF_DIRECTIVE_A && !defined IN_LIBINTL
+#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL
 # include <math.h>
-# include "isnan.h"
+# include "isnand.h"
 # include "printf-frexp.h"
+#endif
+
+#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL
+# include <math.h>
 # include "isnanl-nolibm.h"
 # include "printf-frexpl.h"
 # include "fpucw.h"
@@ -200,7 +203,7 @@ local_wcslen (const wchar_t *s)
 /* Here we need to call the native sprintf, not rpl_sprintf.  */
 #undef sprintf
 
-#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL
+#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL
 /* Determine the decimal-point character according to the current locale.  */
 # ifndef decimal_point_char_defined
 #  define decimal_point_char_defined 1
@@ -227,18 +230,18 @@ decimal_point_char ()
 # endif
 #endif
 
-#if NEED_PRINTF_INFINITE_DOUBLE && !defined IN_LIBINTL
+#if NEED_PRINTF_INFINITE_DOUBLE && !NEED_PRINTF_DOUBLE && !defined IN_LIBINTL
 
 /* Equivalent to !isfinite(x) || x == 0, but does not require libm.  */
 static int
 is_infinite_or_zero (double x)
 {
-  return isnan (x) || x + x == x;
+  return isnand (x) || x + x == x;
 }
 
 #endif
 
-#if NEED_PRINTF_INFINITE_LONG_DOUBLE && !defined IN_LIBINTL
+#if NEED_PRINTF_INFINITE_LONG_DOUBLE && !NEED_PRINTF_LONG_DOUBLE && !defined IN_LIBINTL
 
 /* Equivalent to !isfinite(x), but does not require libm.  */
 static int
@@ -249,7 +252,7 @@ is_infinitel (long double x)
 
 #endif
 
-#if NEED_PRINTF_LONG_DOUBLE && !defined IN_LIBINTL
+#if (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL
 
 /* Converting 'long double' to decimal without rare rounding bugs requires
    real bignums.  We use the naming conventions of GNU gmp, but vastly simpler
@@ -795,6 +798,8 @@ convert_to_decimal (mpn_t a, size_t extra_zeroes)
   return c_ptr;
 }
 
+# if NEED_PRINTF_LONG_DOUBLE
+
 /* Assuming x is finite and >= 0:
    write x as x = 2^e * m, where m is a bignum.
    Return the allocated memory in case of success, NULL in case of memory
@@ -823,8 +828,8 @@ decode_long_double (long double x, int *ep, mpn_t *mp)
      2^31 and 2^32 to 'unsigned int', therefore play safe and cast only
      'long double' values between 0 and 2^16 (to 'unsigned int' or 'int',
      doesn't matter).  */
-# if (LDBL_MANT_BIT % GMP_LIMB_BITS) != 0
-#  if (LDBL_MANT_BIT % GMP_LIMB_BITS) > GMP_LIMB_BITS / 2
+#  if (LDBL_MANT_BIT % GMP_LIMB_BITS) != 0
+#   if (LDBL_MANT_BIT % GMP_LIMB_BITS) > GMP_LIMB_BITS / 2
     {
       mp_limb_t hi, lo;
       y *= (mp_limb_t) 1 << (LDBL_MANT_BIT % (GMP_LIMB_BITS / 2));
@@ -839,7 +844,7 @@ decode_long_double (long double x, int *ep, mpn_t *mp)
        abort ();
       m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = (hi << (GMP_LIMB_BITS / 2)) | lo;
     }
-#  else
+#   else
     {
       mp_limb_t d;
       y *= (mp_limb_t) 1 << (LDBL_MANT_BIT % GMP_LIMB_BITS);
@@ -849,8 +854,8 @@ decode_long_double (long double x, int *ep, mpn_t *mp)
        abort ();
       m.limbs[LDBL_MANT_BIT / GMP_LIMB_BITS] = d;
     }
+#   endif
 #  endif
-# endif
   for (i = LDBL_MANT_BIT / GMP_LIMB_BITS; i > 0; )
     {
       mp_limb_t hi, lo;
@@ -866,8 +871,11 @@ decode_long_double (long double x, int *ep, mpn_t *mp)
        abort ();
       m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo;
     }
+#if 0 /* On FreeBSD 6.1/x86, 'long double' numbers sometimes have excess
+         precision.  */
   if (!(y == 0.0L))
     abort ();
+#endif
   /* Normalise.  */
   while (m.nlimbs > 0 && m.limbs[m.nlimbs - 1] == 0)
     m.nlimbs--;
@@ -876,17 +884,101 @@ decode_long_double (long double x, int *ep, mpn_t *mp)
   return m.limbs;
 }
 
-/* Assuming x is finite and >= 0, and n is an integer:
+# endif
+
+# if NEED_PRINTF_DOUBLE
+
+/* Assuming x is finite and >= 0:
+   write x as x = 2^e * m, where m is a bignum.
+   Return the allocated memory in case of success, NULL in case of memory
+   allocation failure.  */
+static void *
+decode_double (double x, int *ep, mpn_t *mp)
+{
+  mpn_t m;
+  int exp;
+  double y;
+  size_t i;
+
+  /* Allocate memory for result.  */
+  m.nlimbs = (DBL_MANT_BIT + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS;
+  m.limbs = (mp_limb_t *) malloc (m.nlimbs * sizeof (mp_limb_t));
+  if (m.limbs == NULL)
+    return NULL;
+  /* Split into exponential part and mantissa.  */
+  y = frexp (x, &exp);
+  if (!(y >= 0.0 && y < 1.0))
+    abort ();
+  /* x = 2^exp * y = 2^(exp - DBL_MANT_BIT) * (y * DBL_MANT_BIT), and the
+     latter is an integer.  */
+  /* Convert the mantissa (y * DBL_MANT_BIT) to a sequence of limbs.
+     I'm not sure whether it's safe to cast a 'double' value between
+     2^31 and 2^32 to 'unsigned int', therefore play safe and cast only
+     'double' values between 0 and 2^16 (to 'unsigned int' or 'int',
+     doesn't matter).  */
+#  if (DBL_MANT_BIT % GMP_LIMB_BITS) != 0
+#   if (DBL_MANT_BIT % GMP_LIMB_BITS) > GMP_LIMB_BITS / 2
+    {
+      mp_limb_t hi, lo;
+      y *= (mp_limb_t) 1 << (DBL_MANT_BIT % (GMP_LIMB_BITS / 2));
+      hi = (int) y;
+      y -= hi;
+      if (!(y >= 0.0 && y < 1.0))
+       abort ();
+      y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
+      lo = (int) y;
+      y -= lo;
+      if (!(y >= 0.0 && y < 1.0))
+       abort ();
+      m.limbs[DBL_MANT_BIT / GMP_LIMB_BITS] = (hi << (GMP_LIMB_BITS / 2)) | lo;
+    }
+#   else
+    {
+      mp_limb_t d;
+      y *= (mp_limb_t) 1 << (DBL_MANT_BIT % GMP_LIMB_BITS);
+      d = (int) y;
+      y -= d;
+      if (!(y >= 0.0 && y < 1.0))
+       abort ();
+      m.limbs[DBL_MANT_BIT / GMP_LIMB_BITS] = d;
+    }
+#   endif
+#  endif
+  for (i = DBL_MANT_BIT / GMP_LIMB_BITS; i > 0; )
+    {
+      mp_limb_t hi, lo;
+      y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
+      hi = (int) y;
+      y -= hi;
+      if (!(y >= 0.0 && y < 1.0))
+       abort ();
+      y *= (mp_limb_t) 1 << (GMP_LIMB_BITS / 2);
+      lo = (int) y;
+      y -= lo;
+      if (!(y >= 0.0 && y < 1.0))
+       abort ();
+      m.limbs[--i] = (hi << (GMP_LIMB_BITS / 2)) | lo;
+    }
+  if (!(y == 0.0))
+    abort ();
+  /* Normalise.  */
+  while (m.nlimbs > 0 && m.limbs[m.nlimbs - 1] == 0)
+    m.nlimbs--;
+  *mp = m;
+  *ep = exp - DBL_MANT_BIT;
+  return m.limbs;
+}
+
+# endif
+
+/* Assuming x = 2^e * m is finite and >= 0, and n is an integer:
    Returns the decimal representation of round (x * 10^n).
    Return the allocated memory - containing the decimal digits in low-to-high
    order, terminated with a NUL character - in case of success, NULL in case
    of memory allocation failure.  */
 static char *
-scale10_round_decimal_long_double (long double x, int n)
+scale10_round_decimal_decoded (int e, mpn_t m, void *memory, int n)
 {
-  int e;
-  mpn_t m;
-  void *memory = decode_long_double (x, &e, &m);
   int s;
   size_t extra_zeroes;
   unsigned int abs_n;
@@ -1066,7 +1158,7 @@ scale10_round_decimal_long_double (long double x, int n)
                size_t count;
                for (count = m.nlimbs; count > 0; count--)
                  {
-                   accu += (mp_twolimb_t) *sourceptr++ << s;
+                   accu += (mp_twolimb_t) *sourceptr++ << s_bits;
                    *destptr++ = (mp_limb_t) accu;
                    accu = accu >> GMP_LIMB_BITS;
                  }
@@ -1099,6 +1191,44 @@ scale10_round_decimal_long_double (long double x, int n)
   return digits;
 }
 
+# if NEED_PRINTF_LONG_DOUBLE
+
+/* Assuming x is finite and >= 0, and n is an integer:
+   Returns the decimal representation of round (x * 10^n).
+   Return the allocated memory - containing the decimal digits in low-to-high
+   order, terminated with a NUL character - in case of success, NULL in case
+   of memory allocation failure.  */
+static char *
+scale10_round_decimal_long_double (long double x, int n)
+{
+  int e;
+  mpn_t m;
+  void *memory = decode_long_double (x, &e, &m);
+  return scale10_round_decimal_decoded (e, m, memory, n);
+}
+
+# endif
+
+# if NEED_PRINTF_DOUBLE
+
+/* Assuming x is finite and >= 0, and n is an integer:
+   Returns the decimal representation of round (x * 10^n).
+   Return the allocated memory - containing the decimal digits in low-to-high
+   order, terminated with a NUL character - in case of success, NULL in case
+   of memory allocation failure.  */
+static char *
+scale10_round_decimal_double (double x, int n)
+{
+  int e;
+  mpn_t m;
+  void *memory = decode_double (x, &e, &m);
+  return scale10_round_decimal_decoded (e, m, memory, n);
+}
+
+# endif
+
+# if NEED_PRINTF_LONG_DOUBLE
+
 /* Assuming x is finite and > 0:
    Return an approximation for n with 10^n <= x < 10^(n+1).
    The approximation is usually the right n, but may be off by 1 sometimes.  */
@@ -1186,6 +1316,99 @@ floorlog10l (long double x)
   return (int) l + (l < 0 ? -1 : 0);
 }
 
+# endif
+
+# if NEED_PRINTF_DOUBLE
+
+/* Assuming x is finite and > 0:
+   Return an approximation for n with 10^n <= x < 10^(n+1).
+   The approximation is usually the right n, but may be off by 1 sometimes.  */
+static int
+floorlog10 (double x)
+{
+  int exp;
+  double y;
+  double z;
+  double l;
+
+  /* Split into exponential part and mantissa.  */
+  y = frexp (x, &exp);
+  if (!(y >= 0.0 && y < 1.0))
+    abort ();
+  if (y == 0.0)
+    return INT_MIN;
+  if (y < 0.5)
+    {
+      while (y < (1.0 / (1 << (GMP_LIMB_BITS / 2)) / (1 << (GMP_LIMB_BITS / 2))))
+       {
+         y *= 1.0 * (1 << (GMP_LIMB_BITS / 2)) * (1 << (GMP_LIMB_BITS / 2));
+         exp -= GMP_LIMB_BITS;
+       }
+      if (y < (1.0 / (1 << 16)))
+       {
+         y *= 1.0 * (1 << 16);
+         exp -= 16;
+       }
+      if (y < (1.0 / (1 << 8)))
+       {
+         y *= 1.0 * (1 << 8);
+         exp -= 8;
+       }
+      if (y < (1.0 / (1 << 4)))
+       {
+         y *= 1.0 * (1 << 4);
+         exp -= 4;
+       }
+      if (y < (1.0 / (1 << 2)))
+       {
+         y *= 1.0 * (1 << 2);
+         exp -= 2;
+       }
+      if (y < (1.0 / (1 << 1)))
+       {
+         y *= 1.0 * (1 << 1);
+         exp -= 1;
+       }
+    }
+  if (!(y >= 0.5 && y < 1.0))
+    abort ();
+  /* Compute an approximation for l = log2(x) = exp + log2(y).  */
+  l = exp;
+  z = y;
+  if (z < 0.70710678118654752444)
+    {
+      z *= 1.4142135623730950488;
+      l -= 0.5;
+    }
+  if (z < 0.8408964152537145431)
+    {
+      z *= 1.1892071150027210667;
+      l -= 0.25;
+    }
+  if (z < 0.91700404320467123175)
+    {
+      z *= 1.0905077326652576592;
+      l -= 0.125;
+    }
+  if (z < 0.9576032806985736469)
+    {
+      z *= 1.0442737824274138403;
+      l -= 0.0625;
+    }
+  /* Now 0.95 <= z <= 1.01.  */
+  z = 1 - z;
+  /* log(1-z) = - z - z^2/2 - z^3/3 - z^4/4 - ...
+     Four terms are enough to get an approximation with error < 10^-7.  */
+  l -= z * (1.0 + z * (0.5 + z * ((1.0 / 3) + z * 0.25)));
+  /* Finally multiply with log(2)/log(10), yields an approximation for
+     log10(x).  */
+  l *= 0.30102999566398119523;
+  /* Round down to the next integer.  */
+  return (int) l + (l < 0 ? -1 : 0);
+}
+
+# endif
+
 #endif
 
 DCHAR_T *
@@ -1196,10 +1419,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
   arguments a;
 
   if (PRINTF_PARSE (format, &d, &a) < 0)
-    {
-      errno = EINVAL;
-      return NULL;
-    }
+    /* errno is already set.  */
+    return NULL;
 
 #define CLEANUP() \
   free (d.dir);                                                                \
@@ -1819,8 +2040,19 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                  }
              }
 #endif
-#if NEED_PRINTF_DIRECTIVE_A && !defined IN_LIBINTL
-           else if (dp->conversion == 'a' || dp->conversion == 'A')
+#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL
+           else if ((dp->conversion == 'a' || dp->conversion == 'A')
+# if !(NEED_PRINTF_DIRECTIVE_A || (NEED_PRINTF_LONG_DOUBLE && NEED_PRINTF_DOUBLE))
+                    && (0
+#  if NEED_PRINTF_DOUBLE
+                        || a.arg[dp->arg_index].type == TYPE_DOUBLE
+#  endif
+#  if NEED_PRINTF_LONG_DOUBLE
+                        || a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
+#  endif
+                       )
+# endif
+                   )
              {
                arg_type type = a.arg[dp->arg_index].type;
                int flags = dp->flags;
@@ -1938,6 +2170,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                p = tmp;
                if (type == TYPE_LONGDOUBLE)
                  {
+# if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE
                    long double arg = a.arg[dp->arg_index].a.a_longdouble;
 
                    if (isnanl (arg))
@@ -2057,7 +2290,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                                }
                              }
                              *p++ = dp->conversion - 'A' + 'P';
-# if WIDE_CHAR_VERSION
+#  if WIDE_CHAR_VERSION
                              {
                                static const wchar_t decimal_format[] =
                                  { '%', '+', 'd', '\0' };
@@ -2065,7 +2298,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                              }
                              while (*p != '\0')
                                p++;
-# else
+#  else
                              if (sizeof (DCHAR_T) == 1)
                                {
                                  sprintf ((char *) p, "%+d", exponent);
@@ -2080,17 +2313,21 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                                  for (ep = expbuf; (*p = *ep) != '\0'; ep++)
                                    p++;
                                }
-# endif
+#  endif
                          }
 
                        END_LONG_DOUBLE_ROUNDING ();
                      }
+# else
+                   abort ();
+# endif
                  }
                else
                  {
+# if NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_DOUBLE
                    double arg = a.arg[dp->arg_index].a.a_double;
 
-                   if (isnan (arg))
+                   if (isnand (arg))
                      {
                        if (dp->conversion == 'A')
                          {
@@ -2204,7 +2441,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                                }
                              }
                              *p++ = dp->conversion - 'A' + 'P';
-# if WIDE_CHAR_VERSION
+#  if WIDE_CHAR_VERSION
                              {
                                static const wchar_t decimal_format[] =
                                  { '%', '+', 'd', '\0' };
@@ -2212,7 +2449,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                              }
                              while (*p != '\0')
                                p++;
-# else
+#  else
                              if (sizeof (DCHAR_T) == 1)
                                {
                                  sprintf ((char *) p, "%+d", exponent);
@@ -2227,9 +2464,12 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                                  for (ep = expbuf; (*p = *ep) != '\0'; ep++)
                                    p++;
                                }
-# endif
+#  endif
                          }
                      }
+# else
+                   abort ();
+# endif
                  }
                /* The generated string now extends from tmp to p, with the
                   zero padding insertion point being at pad_ptr.  */
@@ -2292,13 +2532,15 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                }
              }
 #endif
-#if (NEED_PRINTF_INFINITE_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL
+#if (NEED_PRINTF_INFINITE_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_LONG_DOUBLE) && !defined IN_LIBINTL
            else if ((dp->conversion == 'f' || dp->conversion == 'F'
                      || dp->conversion == 'e' || dp->conversion == 'E'
                      || dp->conversion == 'g' || dp->conversion == 'G'
                      || dp->conversion == 'a' || dp->conversion == 'A')
                     && (0
-# if NEED_PRINTF_INFINITE_DOUBLE
+# if NEED_PRINTF_DOUBLE
+                        || a.arg[dp->arg_index].type == TYPE_DOUBLE
+# elif NEED_PRINTF_INFINITE_DOUBLE
                         || (a.arg[dp->arg_index].type == TYPE_DOUBLE
                             /* The systems (mingw) which produce wrong output
                                for Inf, -Inf, and NaN also do so for -0.0.
@@ -2315,7 +2557,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
 # endif
                        ))
              {
-# if NEED_PRINTF_INFINITE_DOUBLE && (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE)
+# if (NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && (NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE)
                arg_type type = a.arg[dp->arg_index].type;
 # endif
                int flags = dp->flags;
@@ -2398,17 +2640,21 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                  precision = 6;
 
                /* Allocate a temporary buffer of sufficient size.  */
-# if NEED_PRINTF_INFINITE_DOUBLE && NEED_PRINTF_LONG_DOUBLE
+# if NEED_PRINTF_DOUBLE && NEED_PRINTF_LONG_DOUBLE
+               tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : DBL_DIG + 1);
+# elif NEED_PRINTF_INFINITE_DOUBLE && NEED_PRINTF_LONG_DOUBLE
                tmp_length = (type == TYPE_LONGDOUBLE ? LDBL_DIG + 1 : 0);
 # elif NEED_PRINTF_LONG_DOUBLE
                tmp_length = LDBL_DIG + 1;
+# elif NEED_PRINTF_DOUBLE
+               tmp_length = DBL_DIG + 1;
 # else
                tmp_length = 0;
 # endif
                if (tmp_length < precision)
                  tmp_length = precision;
 # if NEED_PRINTF_LONG_DOUBLE
-#  if NEED_PRINTF_INFINITE_DOUBLE
+#  if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
                if (type == TYPE_LONGDOUBLE)
 #  endif
                  if (dp->conversion == 'f' || dp->conversion == 'F')
@@ -2422,6 +2668,22 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                            tmp_length = exponent + precision;
                        }
                    }
+# endif
+# if NEED_PRINTF_DOUBLE
+#  if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE
+               if (type == TYPE_DOUBLE)
+#  endif
+                 if (dp->conversion == 'f' || dp->conversion == 'F')
+                   {
+                     double arg = a.arg[dp->arg_index].a.a_double;
+                     if (!(isnand (arg) || arg + arg == arg))
+                       {
+                         /* arg is finite and nonzero.  */
+                         int exponent = floorlog10 (arg < 0 ? -arg : arg);
+                         if (exponent >= 0 && tmp_length < exponent + precision)
+                           tmp_length = exponent + precision;
+                       }
+                   }
 # endif
                /* Account for sign, decimal point etc. */
                tmp_length = xsum (tmp_length, 12);
@@ -2450,7 +2712,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                p = tmp;
 
 # if NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE
-#  if NEED_PRINTF_INFINITE_DOUBLE
+#  if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
                if (type == TYPE_LONGDOUBLE)
 #  endif
                  {
@@ -2810,16 +3072,15 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                        END_LONG_DOUBLE_ROUNDING ();
                      }
                  }
-#  if NEED_PRINTF_INFINITE_DOUBLE
+#  if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
                else
 #  endif
 # endif
-# if NEED_PRINTF_INFINITE_DOUBLE
+# if NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE
                  {
-                   /* Simpler than above: handle only NaN, Infinity, zero.  */
                    double arg = a.arg[dp->arg_index].a.a_double;
 
-                   if (isnan (arg))
+                   if (isnand (arg))
                      {
                        if (dp->conversion >= 'A' && dp->conversion <= 'Z')
                          {
@@ -2834,7 +3095,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                      {
                        int sign = 0;
 
-                       if (signbit (arg)) /* arg < 0.0L or negative zero */
+                       if (signbit (arg)) /* arg < 0.0 or negative zero */
                          {
                            sign = -1;
                            arg = -arg;
@@ -2860,25 +3121,351 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                          }
                        else
                          {
-                           if (!(arg == 0.0))
-                             abort ();
-
+#  if NEED_PRINTF_DOUBLE
                            pad_ptr = p;
 
                            if (dp->conversion == 'f' || dp->conversion == 'F')
                              {
-                               *p++ = '0';
+                               char *digits;
+                               size_t ndigits;
+
+                               digits =
+                                 scale10_round_decimal_double (arg, precision);
+                               if (digits == NULL)
+                                 goto out_of_memory;
+                               ndigits = strlen (digits);
+
+                               if (ndigits > precision)
+                                 do
+                                   {
+                                     --ndigits;
+                                     *p++ = digits[ndigits];
+                                   }
+                                 while (ndigits > precision);
+                               else
+                                 *p++ = '0';
+                               /* Here ndigits <= precision.  */
                                if ((flags & FLAG_ALT) || precision > 0)
                                  {
                                    *p++ = decimal_point_char ();
-                                   for (; precision > 0; precision--)
+                                   for (; precision > ndigits; precision--)
                                      *p++ = '0';
+                                   while (ndigits > 0)
+                                     {
+                                       --ndigits;
+                                       *p++ = digits[ndigits];
+                                     }
                                  }
+
+                               free (digits);
                              }
                            else if (dp->conversion == 'e' || dp->conversion == 'E')
                              {
-                               *p++ = '0';
-                               if ((flags & FLAG_ALT) || precision > 0)
+                               int exponent;
+
+                               if (arg == 0.0)
+                                 {
+                                   exponent = 0;
+                                   *p++ = '0';
+                                   if ((flags & FLAG_ALT) || precision > 0)
+                                     {
+                                       *p++ = decimal_point_char ();
+                                       for (; precision > 0; precision--)
+                                         *p++ = '0';
+                                     }
+                                 }
+                               else
+                                 {
+                                   /* arg > 0.0.  */
+                                   int adjusted;
+                                   char *digits;
+                                   size_t ndigits;
+
+                                   exponent = floorlog10 (arg);
+                                   adjusted = 0;
+                                   for (;;)
+                                     {
+                                       digits =
+                                         scale10_round_decimal_double (arg,
+                                                                       (int)precision - exponent);
+                                       if (digits == NULL)
+                                         goto out_of_memory;
+                                       ndigits = strlen (digits);
+
+                                       if (ndigits == precision + 1)
+                                         break;
+                                       if (ndigits < precision
+                                           || ndigits > precision + 2)
+                                         /* The exponent was not guessed
+                                            precisely enough.  */
+                                         abort ();
+                                       if (adjusted)
+                                         /* None of two values of exponent is
+                                            the right one.  Prevent an endless
+                                            loop.  */
+                                         abort ();
+                                       free (digits);
+                                       if (ndigits == precision)
+                                         exponent -= 1;
+                                       else
+                                         exponent += 1;
+                                       adjusted = 1;
+                                     }
+
+                                   /* Here ndigits = precision+1.  */
+                                   *p++ = digits[--ndigits];
+                                   if ((flags & FLAG_ALT) || precision > 0)
+                                     {
+                                       *p++ = decimal_point_char ();
+                                       while (ndigits > 0)
+                                         {
+                                           --ndigits;
+                                           *p++ = digits[ndigits];
+                                         }
+                                     }
+
+                                   free (digits);
+                                 }
+
+                               *p++ = dp->conversion; /* 'e' or 'E' */
+#   if WIDE_CHAR_VERSION
+                               {
+                                 static const wchar_t decimal_format[] =
+                                   /* Produce the same number of exponent digits
+                                      as the native printf implementation.  */
+#    if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+                                   { '%', '+', '.', '3', 'd', '\0' };
+#    else
+                                   { '%', '+', '.', '2', 'd', '\0' };
+#    endif
+                                 SNPRINTF (p, 6 + 1, decimal_format, exponent);
+                               }
+                               while (*p != '\0')
+                                 p++;
+#   else
+                               {
+                                 static const char decimal_format[] =
+                                   /* Produce the same number of exponent digits
+                                      as the native printf implementation.  */
+#    if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+                                   "%+.3d";
+#    else
+                                   "%+.2d";
+#    endif
+                                 if (sizeof (DCHAR_T) == 1)
+                                   {
+                                     sprintf ((char *) p, decimal_format, exponent);
+                                     while (*p != '\0')
+                                       p++;
+                                   }
+                                 else
+                                   {
+                                     char expbuf[6 + 1];
+                                     const char *ep;
+                                     sprintf (expbuf, decimal_format, exponent);
+                                     for (ep = expbuf; (*p = *ep) != '\0'; ep++)
+                                       p++;
+                                   }
+                               }
+#   endif
+                             }
+                           else if (dp->conversion == 'g' || dp->conversion == 'G')
+                             {
+                               if (precision == 0)
+                                 precision = 1;
+                               /* precision >= 1.  */
+
+                               if (arg == 0.0)
+                                 /* The exponent is 0, >= -4, < precision.
+                                    Use fixed-point notation.  */
+                                 {
+                                   size_t ndigits = precision;
+                                   /* Number of trailing zeroes that have to be
+                                      dropped.  */
+                                   size_t nzeroes =
+                                     (flags & FLAG_ALT ? 0 : precision - 1);
+
+                                   --ndigits;
+                                   *p++ = '0';
+                                   if ((flags & FLAG_ALT) || ndigits > nzeroes)
+                                     {
+                                       *p++ = decimal_point_char ();
+                                       while (ndigits > nzeroes)
+                                         {
+                                           --ndigits;
+                                           *p++ = '0';
+                                         }
+                                     }
+                                 }
+                               else
+                                 {
+                                   /* arg > 0.0.  */
+                                   int exponent;
+                                   int adjusted;
+                                   char *digits;
+                                   size_t ndigits;
+                                   size_t nzeroes;
+
+                                   exponent = floorlog10 (arg);
+                                   adjusted = 0;
+                                   for (;;)
+                                     {
+                                       digits =
+                                         scale10_round_decimal_double (arg,
+                                                                       (int)(precision - 1) - exponent);
+                                       if (digits == NULL)
+                                         goto out_of_memory;
+                                       ndigits = strlen (digits);
+
+                                       if (ndigits == precision)
+                                         break;
+                                       if (ndigits < precision - 1
+                                           || ndigits > precision + 1)
+                                         /* The exponent was not guessed
+                                            precisely enough.  */
+                                         abort ();
+                                       if (adjusted)
+                                         /* None of two values of exponent is
+                                            the right one.  Prevent an endless
+                                            loop.  */
+                                         abort ();
+                                       free (digits);
+                                       if (ndigits < precision)
+                                         exponent -= 1;
+                                       else
+                                         exponent += 1;
+                                       adjusted = 1;
+                                     }
+                                   /* Here ndigits = precision.  */
+
+                                   /* Determine the number of trailing zeroes
+                                      that have to be dropped.  */
+                                   nzeroes = 0;
+                                   if ((flags & FLAG_ALT) == 0)
+                                     while (nzeroes < ndigits
+                                            && digits[nzeroes] == '0')
+                                       nzeroes++;
+
+                                   /* The exponent is now determined.  */
+                                   if (exponent >= -4
+                                       && exponent < (long)precision)
+                                     {
+                                       /* Fixed-point notation:
+                                          max(exponent,0)+1 digits, then the
+                                          decimal point, then the remaining
+                                          digits without trailing zeroes.  */
+                                       if (exponent >= 0)
+                                         {
+                                           size_t count = exponent + 1;
+                                           /* Note: count <= precision = ndigits.  */
+                                           for (; count > 0; count--)
+                                             *p++ = digits[--ndigits];
+                                           if ((flags & FLAG_ALT) || ndigits > nzeroes)
+                                             {
+                                               *p++ = decimal_point_char ();
+                                               while (ndigits > nzeroes)
+                                                 {
+                                                   --ndigits;
+                                                   *p++ = digits[ndigits];
+                                                 }
+                                             }
+                                         }
+                                       else
+                                         {
+                                           size_t count = -exponent - 1;
+                                           *p++ = '0';
+                                           *p++ = decimal_point_char ();
+                                           for (; count > 0; count--)
+                                             *p++ = '0';
+                                           while (ndigits > nzeroes)
+                                             {
+                                               --ndigits;
+                                               *p++ = digits[ndigits];
+                                             }
+                                         }
+                                     }
+                                   else
+                                     {
+                                       /* Exponential notation.  */
+                                       *p++ = digits[--ndigits];
+                                       if ((flags & FLAG_ALT) || ndigits > nzeroes)
+                                         {
+                                           *p++ = decimal_point_char ();
+                                           while (ndigits > nzeroes)
+                                             {
+                                               --ndigits;
+                                               *p++ = digits[ndigits];
+                                             }
+                                         }
+                                       *p++ = dp->conversion - 'G' + 'E'; /* 'e' or 'E' */
+#   if WIDE_CHAR_VERSION
+                                       {
+                                         static const wchar_t decimal_format[] =
+                                           /* Produce the same number of exponent digits
+                                              as the native printf implementation.  */
+#    if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+                                           { '%', '+', '.', '3', 'd', '\0' };
+#    else
+                                           { '%', '+', '.', '2', 'd', '\0' };
+#    endif
+                                         SNPRINTF (p, 6 + 1, decimal_format, exponent);
+                                       }
+                                       while (*p != '\0')
+                                         p++;
+#   else
+                                       {
+                                         static const char decimal_format[] =
+                                           /* Produce the same number of exponent digits
+                                              as the native printf implementation.  */
+#    if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+                                           "%+.3d";
+#    else
+                                           "%+.2d";
+#    endif
+                                         if (sizeof (DCHAR_T) == 1)
+                                           {
+                                             sprintf ((char *) p, decimal_format, exponent);
+                                             while (*p != '\0')
+                                               p++;
+                                           }
+                                         else
+                                           {
+                                             char expbuf[6 + 1];
+                                             const char *ep;
+                                             sprintf (expbuf, decimal_format, exponent);
+                                             for (ep = expbuf; (*p = *ep) != '\0'; ep++)
+                                               p++;
+                                           }
+                                       }
+#   endif
+                                     }
+
+                                   free (digits);
+                                 }
+                             }
+                           else
+                             abort ();
+#  else
+                           /* arg is finite.  */
+                           if (!(arg == 0.0))
+                             abort ();
+
+                           pad_ptr = p;
+
+                           if (dp->conversion == 'f' || dp->conversion == 'F')
+                             {
+                               *p++ = '0';
+                               if ((flags & FLAG_ALT) || precision > 0)
+                                 {
+                                   *p++ = decimal_point_char ();
+                                   for (; precision > 0; precision--)
+                                     *p++ = '0';
+                                 }
+                             }
+                           else if (dp->conversion == 'e' || dp->conversion == 'E')
+                             {
+                               *p++ = '0';
+                               if ((flags & FLAG_ALT) || precision > 0)
                                  {
                                    *p++ = decimal_point_char ();
                                    for (; precision > 0; precision--)
@@ -2888,9 +3475,9 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                                *p++ = '+';
                                /* Produce the same number of exponent digits as
                                   the native printf implementation.  */
-#  if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+#   if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
                                *p++ = '0';
-#  endif
+#   endif
                                *p++ = '0';
                                *p++ = '0';
                              }
@@ -2908,6 +3495,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                              }
                            else
                              abort ();
+#  endif
                          }
                      }
                  }
@@ -2978,11 +3566,22 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
              {
                arg_type type = a.arg[dp->arg_index].type;
                int flags = dp->flags;
-#if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO
+#if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
                int has_width;
                size_t width;
 #endif
-#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO
+#if !USE_SNPRINTF || NEED_PRINTF_UNBOUNDED_PRECISION
+               int has_precision;
+               size_t precision;
+#endif
+#if NEED_PRINTF_UNBOUNDED_PRECISION
+               int prec_ourselves;
+#else
+#              define prec_ourselves 0
+#endif
+#if NEED_PRINTF_FLAG_LEFTADJUST
+#              define pad_ourselves 1
+#elif !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
                int pad_ourselves;
 #else
 #              define pad_ourselves 0
@@ -2996,7 +3595,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                TCHAR_T *tmp;
 #endif
 
-#if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO
+#if !USE_SNPRINTF || !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
                has_width = 0;
                width = 0;
                if (dp->width_start != dp->width_end)
@@ -3030,34 +3629,42 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                  }
 #endif
 
+#if !USE_SNPRINTF || NEED_PRINTF_UNBOUNDED_PRECISION
+               has_precision = 0;
+               precision = 6;
+               if (dp->precision_start != dp->precision_end)
+                 {
+                   if (dp->precision_arg_index != ARG_NONE)
+                     {
+                       int arg;
+
+                       if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
+                         abort ();
+                       arg = a.arg[dp->precision_arg_index].a.a_int;
+                       /* "A negative precision is taken as if the precision
+                           were omitted."  */
+                       if (arg >= 0)
+                         {
+                           precision = arg;
+                           has_precision = 1;
+                         }
+                     }
+                   else
+                     {
+                       const FCHAR_T *digitp = dp->precision_start + 1;
+
+                       precision = 0;
+                       while (digitp != dp->precision_end)
+                         precision = xsum (xtimes (precision, 10), *digitp++ - '0');
+                       has_precision = 1;
+                     }
+                 }
+#endif
+
 #if !USE_SNPRINTF
                /* Allocate a temporary buffer of sufficient size for calling
                   sprintf.  */
                {
-                 size_t precision;
-
-                 precision = 6;
-                 if (dp->precision_start != dp->precision_end)
-                   {
-                     if (dp->precision_arg_index != ARG_NONE)
-                       {
-                         int arg;
-
-                         if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
-                           abort ();
-                         arg = a.arg[dp->precision_arg_index].a.a_int;
-                         precision = (arg < 0 ? 0 : arg);
-                       }
-                     else
-                       {
-                         const FCHAR_T *digitp = dp->precision_start + 1;
-
-                         precision = 0;
-                         while (digitp != dp->precision_end)
-                           precision = xsum (xtimes (precision, 10), *digitp++ - '0');
-                       }
-                   }
-
                  switch (dp->conversion)
                    {
 
@@ -3262,8 +3869,23 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                  }
 #endif
 
+               /* Decide whether to handle the precision ourselves.  */
+#if NEED_PRINTF_UNBOUNDED_PRECISION
+               switch (dp->conversion)
+                 {
+                 case 'd': case 'i': case 'u':
+                 case 'o':
+                 case 'x': case 'X': case 'p':
+                   prec_ourselves = has_precision && (precision > 0);
+                   break;
+                 default:
+                   prec_ourselves = 0;
+                   break;
+                 }
+#endif
+
                /* Decide whether to perform the padding ourselves.  */
-#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO
+#if !NEED_PRINTF_FLAG_LEFTADJUST && (!DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION)
                switch (dp->conversion)
                  {
 # if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO
@@ -3280,7 +3902,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                    pad_ourselves = 1;
                    break;
                  default:
-                   pad_ourselves = 0;
+                   pad_ourselves = prec_ourselves;
                    break;
                  }
 #endif
@@ -3328,22 +3950,25 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                          }
                      }
                  }
-               if (dp->precision_start != dp->precision_end)
+               if (!prec_ourselves)
                  {
-                   size_t n = dp->precision_end - dp->precision_start;
-                   /* The precision specification is known to consist only
-                      of standard ASCII characters.  */
-                   if (sizeof (FCHAR_T) == sizeof (TCHAR_T))
+                   if (dp->precision_start != dp->precision_end)
                      {
-                       memcpy (fbp, dp->precision_start, n * sizeof (TCHAR_T));
-                       fbp += n;
-                     }
-                   else
-                     {
-                       const FCHAR_T *mp = dp->precision_start;
-                       do
-                         *fbp++ = (unsigned char) *mp++;
-                       while (--n > 0);
+                       size_t n = dp->precision_end - dp->precision_start;
+                       /* The precision specification is known to consist only
+                          of standard ASCII characters.  */
+                       if (sizeof (FCHAR_T) == sizeof (TCHAR_T))
+                         {
+                           memcpy (fbp, dp->precision_start, n * sizeof (TCHAR_T));
+                           fbp += n;
+                         }
+                       else
+                         {
+                           const FCHAR_T *mp = dp->precision_start;
+                           do
+                             *fbp++ = (unsigned char) *mp++;
+                           while (--n > 0);
+                         }
                      }
                  }
 
@@ -3385,9 +4010,36 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
 #endif
                  *fbp = dp->conversion;
 #if USE_SNPRINTF
+# if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
                fbp[1] = '%';
                fbp[2] = 'n';
                fbp[3] = '\0';
+# else
+               /* On glibc2 systems from glibc >= 2.3 - probably also older
+                  ones - we know that snprintf's returns value conforms to
+                  ISO C 99: the gl_SNPRINTF_DIRECTIVE_N test passes.
+                  Therefore we can avoid using %n in this situation.
+                  On glibc2 systems from 2004-10-18 or newer, the use of %n
+                  in format strings in writable memory may crash the program
+                  (if compiled with _FORTIFY_SOURCE=2), so we should avoid it
+                  in this situation.  */
+               /* On native Win32 systems (such as mingw), we can avoid using
+                  %n because:
+                    - Although the gl_SNPRINTF_TRUNCATION_C99 test fails,
+                      snprintf does not write more than the specified number
+                      of bytes. (snprintf (buf, 3, "%d %d", 4567, 89) writes
+                      '4', '5', '6' into buf, not '4', '5', '\0'.)
+                    - Although the gl_SNPRINTF_RETVAL_C99 test fails, snprintf
+                      allows us to recognize the case of an insufficient
+                      buffer size: it returns -1 in this case.
+                  On native Win32 systems (such as mingw) where the OS is
+                  Windows Vista, the use of %n in format strings by default
+                  crashes the program. See
+                    <http://gcc.gnu.org/ml/gcc/2007-06/msg00122.html> and
+                    <http://msdn2.microsoft.com/en-us/library/ms175782(VS.80).aspx>
+                  So we should avoid %n in this situation.  */
+               fbp[1] = '\0';
+# endif
 #else
                fbp[1] = '\0';
 #endif
@@ -3414,9 +4066,13 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                   sizeof (TCHAR_T) divides sizeof (DCHAR_T) and
                   alignof (TCHAR_T) <= alignof (DCHAR_T).  */
 # define TCHARS_PER_DCHAR (sizeof (DCHAR_T) / sizeof (TCHAR_T))
+               /* Ensure that maxlen below will be >= 2.  Needed on BeOS,
+                  where an snprintf() with maxlen==1 acts like sprintf().  */
+               ENSURE_ALLOCATION (xsum (length,
+                                        (2 + TCHARS_PER_DCHAR - 1)
+                                        / TCHARS_PER_DCHAR));
                /* Prepare checking whether snprintf returns the count
                   via %n.  */
-               ENSURE_ALLOCATION (xsum (length, 1));
                *(TCHAR_T *) (result + length) = '\0';
 #endif
 
@@ -3430,7 +4086,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                    /* SNPRINTF can fail if its second argument is
                       > INT_MAX.  */
                    if (maxlen > INT_MAX / TCHARS_PER_DCHAR)
-                     goto overflow;
+                     maxlen = INT_MAX / TCHARS_PER_DCHAR;
                    maxlen = maxlen * TCHARS_PER_DCHAR;
 # define SNPRINTF_BUF(arg) \
                    switch (prefix_count)                                   \
@@ -3648,20 +4304,102 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                      }
 
 #if USE_SNPRINTF
-                   /* Handle overflow of the allocated buffer.  */
-                   if (count >= maxlen)
+                   /* Handle overflow of the allocated buffer.
+                      If such an overflow occurs, a C99 compliant snprintf()
+                      returns a count >= maxlen.  However, a non-compliant
+                      snprintf() function returns only count = maxlen - 1.  To
+                      cover both cases, test whether count >= maxlen - 1.  */
+                   if ((unsigned int) count + 1 >= maxlen)
                      {
-                       /* Need at least count * sizeof (TCHAR_T) bytes.  But
-                          allocate proportionally, to avoid looping eternally
-                          if snprintf() reports a too small count.  */
-                       size_t n =
-                         xmax (xsum (length,
-                                     (count + TCHARS_PER_DCHAR - 1)
-                                     / TCHARS_PER_DCHAR),
-                               xtimes (allocated, 2));
+                       /* If maxlen already has attained its allowed maximum,
+                          allocating more memory will not increase maxlen.
+                          Instead of looping, bail out.  */
+                       if (maxlen == INT_MAX / TCHARS_PER_DCHAR)
+                         goto overflow;
+                       else
+                         {
+                           /* Need at least (count + 1) * sizeof (TCHAR_T)
+                              bytes.  (The +1 is for the trailing NUL.)
+                              But ask for (count + 2) * sizeof (TCHAR_T)
+                              bytes, so that in the next round, we likely get
+                                maxlen > (unsigned int) count + 1
+                              and so we don't get here again.
+                              And allocate proportionally, to avoid looping
+                              eternally if snprintf() reports a too small
+                              count.  */
+                           size_t n =
+                             xmax (xsum (length,
+                                         ((unsigned int) count + 2
+                                          + TCHARS_PER_DCHAR - 1)
+                                         / TCHARS_PER_DCHAR),
+                                   xtimes (allocated, 2));
+
+                           ENSURE_ALLOCATION (n);
+                           continue;
+                         }
+                     }
+#endif
 
-                       ENSURE_ALLOCATION (n);
-                       continue;
+#if NEED_PRINTF_UNBOUNDED_PRECISION
+                   if (prec_ourselves)
+                     {
+                       /* Handle the precision.  */
+                       TCHAR_T *prec_ptr =
+# if USE_SNPRINTF
+                         (TCHAR_T *) (result + length);
+# else
+                         tmp;
+# endif
+                       size_t prefix_count;
+                       size_t move;
+
+                       prefix_count = 0;
+                       /* Put the additional zeroes after the sign.  */
+                       if (count >= 1
+                           && (*prec_ptr == '-' || *prec_ptr == '+'
+                               || *prec_ptr == ' '))
+                         prefix_count = 1;
+                       /* Put the additional zeroes after the 0x prefix if
+                          (flags & FLAG_ALT) || (dp->conversion == 'p').  */
+                       else if (count >= 2
+                                && prec_ptr[0] == '0'
+                                && (prec_ptr[1] == 'x' || prec_ptr[1] == 'X'))
+                         prefix_count = 2;
+
+                       move = count - prefix_count;
+                       if (precision > move)
+                         {
+                           /* Insert zeroes.  */
+                           size_t insert = precision - move;
+                           TCHAR_T *prec_end;
+
+# if USE_SNPRINTF
+                           size_t n =
+                             xsum (length,
+                                   (count + insert + TCHARS_PER_DCHAR - 1)
+                                   / TCHARS_PER_DCHAR);
+                           length += (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR;
+                           ENSURE_ALLOCATION (n);
+                           length -= (count + TCHARS_PER_DCHAR - 1) / TCHARS_PER_DCHAR;
+                           prec_ptr = (TCHAR_T *) (result + length);
+# endif
+
+                           prec_end = prec_ptr + count;
+                           prec_ptr += prefix_count;
+
+                           while (prec_end > prec_ptr)
+                             {
+                               prec_end--;
+                               prec_end[insert] = prec_end[0];
+                             }
+
+                           prec_end += insert;
+                           do
+                             *--prec_end = '0';
+                           while (prec_end > prec_ptr);
+
+                           count += insert;
+                         }
                      }
 #endif
 
@@ -3773,7 +4511,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                    /* Here count <= allocated - length.  */
 
                    /* Perform padding.  */
-#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_ZERO
+#if !DCHAR_IS_TCHAR || ENABLE_UNISTDIO || NEED_PRINTF_FLAG_LEFTADJUST || NEED_PRINTF_FLAG_ZERO || NEED_PRINTF_UNBOUNDED_PRECISION
                    if (pad_ourselves && has_width)
                      {
                        size_t w;
@@ -3814,15 +4552,14 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
 # endif
                              DCHAR_T *p = rp + count;
                              DCHAR_T *end = p + pad;
-# if NEED_PRINTF_FLAG_ZERO
                              DCHAR_T *pad_ptr;
-#  if !DCHAR_IS_TCHAR
+# if !DCHAR_IS_TCHAR
                              if (dp->conversion == 'c'
                                  || dp->conversion == 's')
                                /* No zero-padding for string directives.  */
                                pad_ptr = NULL;
                              else
-#  endif
+# endif
                                {
                                  pad_ptr = (*rp == '-' ? rp + 1 : rp);
                                  /* No zero-padding of "inf" and "nan".  */
@@ -3830,7 +4567,6 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                                      || (*pad_ptr >= 'a' && *pad_ptr <= 'z'))
                                    pad_ptr = NULL;
                                }
-# endif
                              /* The generated string now extends from rp to p,
                                 with the zero padding insertion point being at
                                 pad_ptr.  */
@@ -3843,7 +4579,6 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                                  for (; pad > 0; pad--)
                                    *p++ = ' ';
                                }
-# if NEED_PRINTF_FLAG_ZERO
                              else if ((flags & FLAG_ZERO) && pad_ptr != NULL)
                                {
                                  /* Pad with zeroes.  */
@@ -3854,7 +4589,6 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
                                  for (; pad > 0; pad--)
                                    *p++ = '0';
                                }
-# endif
                              else
                                {
                                  /* Pad with spaces on the left.  */
@@ -3933,6 +4667,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
        not have this limitation.  */
     return result;
 
+#if USE_SNPRINTF
   overflow:
     if (!(result == resultbuf || result == NULL))
       free (result);
@@ -3941,6 +4676,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
     CLEANUP ();
     errno = EOVERFLOW;
     return NULL;
+#endif
 
   out_of_memory:
     if (!(result == resultbuf || result == NULL))
@@ -3957,9 +4693,11 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
 #undef TCHARS_PER_DCHAR
 #undef SNPRINTF
 #undef USE_SNPRINTF
+#undef DCHAR_CPY
 #undef PRINTF_PARSE
 #undef DIRECTIVES
 #undef DIRECTIVE
+#undef DCHAR_IS_TCHAR
 #undef TCHAR_T
 #undef DCHAR_T
 #undef FCHAR_T
index 7a0c01f4bfa327d6f0b3f8cdb0e6faeb4184c83c..b9a3d6edcdc819f27626764da978d5849955ea4b 100644 (file)
@@ -1,9 +1,9 @@
 /* vsprintf with automatic memory allocation.
-   Copyright (C) 2002-2004, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2002-2004, 2007-2008 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)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    This program is distributed in the hope that it will be useful,
@@ -26,7 +26,7 @@
 
 #ifndef __attribute__
 /* This feature is available in gcc versions 2.5 and later.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
+# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
 #  define __attribute__(Spec) /* empty */
 # endif
 /* The __-protected variants of `format' and `printf' attributes
diff --git a/gnulib/wchar.in.h b/gnulib/wchar.in.h
new file mode 100644 (file)
index 0000000..b721572
--- /dev/null
@@ -0,0 +1,82 @@
+/* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
+
+   Copyright (C) 2007 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 3, 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.  */
+
+/* Written by Eric Blake.  */
+
+/*
+ * ISO C 99 <wchar.h> for platforms that have issues.
+ * <http://www.opengroup.org/susv3xbd/wchar.h.html>
+ *
+ * For now, this just ensures proper prerequisite inclusion order and
+ * the declaration of wcwidth().
+ */
+
+#ifndef _GL_WCHAR_H
+
+/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
+   <wchar.h>.
+   BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
+   included before <wchar.h>.  */
+#include <stddef.h>
+#include <stdio.h>
+#include <time.h>
+
+/* Include the original <wchar.h> if it exists.
+   Some builds of uClibc lack it.  */
+/* The include_next requires a split double-inclusion guard.  */
+#if @HAVE_WCHAR_H@
+# @INCLUDE_NEXT@ @NEXT_WCHAR_H@
+#endif
+
+#ifndef _GL_WCHAR_H
+#define _GL_WCHAR_H
+
+/* The definition of GL_LINK_WARNING is copied here.  */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Return the number of screen columns needed for WC.  */
+#if @GNULIB_WCWIDTH@
+# if @REPLACE_WCWIDTH@
+#  undef wcwidth
+#  define wcwidth rpl_wcwidth
+extern int wcwidth (wchar_t);
+# else
+#  if !defined wcwidth && !@HAVE_DECL_WCWIDTH@
+/* wcwidth exists but is not declared.  */
+extern int wcwidth (int /* actually wchar_t */);
+#  endif
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef wcwidth
+# define wcwidth(w) \
+    (GL_LINK_WARNING ("wcwidth is unportable - " \
+                      "use gnulib module wcwidth for portability"), \
+     wcwidth (w))
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _GL_WCHAR_H */
+#endif /* _GL_WCHAR_H */
diff --git a/gnulib/wchar_.h b/gnulib/wchar_.h
deleted file mode 100644 (file)
index 924a338..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
-
-   Copyright (C) 2007 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.  */
-
-/* Written by Eric Blake.  */
-
-/*
- * ISO C 99 <wchar.h> for platforms that have issues.
- * <http://www.opengroup.org/susv3xbd/wchar.h.html>
- *
- * For now, this just ensures proper prerequisite inclusion order and
- * the declaration of wcwidth().
- */
-
-#ifndef _GL_WCHAR_H
-
-/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
-   <wchar.h>.
-   BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
-   included before <wchar.h>.  */
-#include <stddef.h>
-#include <stdio.h>
-#include <time.h>
-
-/* Include the original <wchar.h> if it exists.
-   Some builds of uClibc lack it.  */
-/* The include_next requires a split double-inclusion guard.  */
-#if @HAVE_WCHAR_H@
-# @INCLUDE_NEXT@ @NEXT_WCHAR_H@
-#endif
-
-#ifndef _GL_WCHAR_H
-#define _GL_WCHAR_H
-
-/* The definition of GL_LINK_WARNING is copied here.  */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/* Return the number of screen columns needed for WC.  */
-#if @GNULIB_WCWIDTH@
-# if @REPLACE_WCWIDTH@
-#  undef wcwidth
-#  define wcwidth rpl_wcwidth
-extern int wcwidth (wchar_t);
-# else
-#  if !defined wcwidth && !@HAVE_DECL_WCWIDTH@
-/* wcwidth exists but is not declared.  */
-extern int wcwidth (int /* actually wchar_t */);
-#  endif
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef wcwidth
-# define wcwidth(w) \
-    (GL_LINK_WARNING ("wcwidth is unportable - " \
-                      "use gnulib module wcwidth for portability"), \
-     wcwidth (w))
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _GL_WCHAR_H */
-#endif /* _GL_WCHAR_H */
index 341fb16ca796f796ff00f132050d331e56ff97c5..284cf7f6e18740534dce9cf458ec0f849485954c 100644 (file)
@@ -1,10 +1,10 @@
 /* xsize.h -- Checked size_t computations.
 
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2008 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)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    This program is distributed in the hope that it will be useful,
@@ -94,7 +94,7 @@ xmax (size_t size1, size_t size2)
 /* Multiplication of a count with an element size, with overflow check.
    The count must be >= 0 and the element size must be > 0.
    This is a macro, not an inline function, so that it works correctly even
-   when N is of a wider tupe and N > SIZE_MAX.  */
+   when N is of a wider type and N > SIZE_MAX.  */
 #define xtimes(N, ELSIZE) \
   ((N) <= SIZE_MAX / (ELSIZE) ? (size_t) (N) * (ELSIZE) : SIZE_MAX)
 
diff --git a/installcheck/Amanda_Archive.pl b/installcheck/Amanda_Archive.pl
new file mode 100644 (file)
index 0000000..560f548
--- /dev/null
@@ -0,0 +1,246 @@
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+use Test::More tests => 20;
+use strict;
+use warnings;
+
+# This test only puts the perl wrappers through their paces -- the underlying
+# library is well-covered by amar-test.
+
+use lib "@amperldir@";
+use Amanda::Archive;
+use Amanda::Paths;
+use Data::Dumper;
+
+my $arch_filename = "$AMANDA_TMPDIR/amanda_archive.bin";
+my $data_filename = "$AMANDA_TMPDIR/some_data.bin";
+my ($fh, $dfh, $ar, $f1, $f2, $a1, $a2, @res, $posn);
+
+# some versions of Test::More will fail tests if the identity
+# relationships of the two objects passed to is_deeply do not
+# match, so we use the same object for $user_data throughout.
+my $user_data = [ "x", "y", "z" ];
+
+# set up a large file full of data
+
+open($dfh, ">", $data_filename);
+my $onek = "abcd" x 256;
+my $onemeg = $onek x 1024;
+for (my $i = 0; $i < 5; $i++) {
+    print $dfh $onemeg;
+}
+$onek = $onemeg = undef;
+close($dfh);
+
+# utility functions for creating a "fake" archive file
+
+sub make_header {
+    my ($fh, $version) = @_;
+    my $hdr = "AMANDA ARCHIVE FORMAT $version";
+    $hdr .= "\0" x (28 - length $hdr);
+    print $fh $hdr;
+}
+
+sub make_record {
+    my ($fh, $filenum, $attrid, $data, $eoa) = @_;
+    my $size = length($data);
+    if ($eoa) {
+       $size |= 0x80000000;
+    }
+    print $fh pack("nnN", $filenum, $attrid, $size);
+    print $fh $data;
+}
+
+####
+## TEST WRITING
+
+open($fh, ">", $arch_filename) or die("opening $arch_filename: $!");
+$ar = Amanda::Archive->new(fileno($fh), ">");
+pass("Create a new archive");
+
+$f1 = $ar->new_file("filename1");
+pass("Start an archive file");
+
+$a1 = $f1->new_attr(18);
+$a1->add_data("foo!", 0);
+$a2 = $f1->new_attr(19);
+$a2->add_data("BAR!", 0);
+$a1->add_data("FOO.", 1);
+$a2->add_data("bar.", 0);
+pass("Write some interleaved data");
+
+$a1->close();
+pass("Close an attribute with the close() method");
+
+$a1 = Amanda::Archive::Attr->new($f1, 99);
+pass("Create an attribute with its constructor");
+
+open($dfh, "<", $data_filename);
+$a1->add_data_fd(fileno($dfh), 1);
+close($dfh);
+pass("Add data from a file descriptor");
+
+$a1 = undef;
+pass("Close attribute when its refcount hits zero");
+
+$f2 = Amanda::Archive::File->new($ar, "filename2");
+pass("Add a new file (filename2)");
+
+$a1 = $f2->new_attr(82);
+$a1->add_data("word", 1);
+pass("Add data to it");
+
+$a2->add_data("barrrrr?", 0);  # note no EOA
+pass("Add more data to first attribute");
+
+($f1, $posn) = $ar->new_file("posititioned file", 1);
+ok($posn > 0, "new_file returns a positive position");
+
+$ar = undef;
+pass("unref archive early");
+
+($ar, $f1, $f2, $a1, $a2) = ();
+pass("Close remaining objects");
+
+close($fh);
+
+####
+## TEST READING
+
+open($fh, ">", $arch_filename);
+make_header($fh, 1);
+make_record($fh, 16, 0, "/etc/passwd", 1);
+make_record($fh, 16, 20, "root:foo", 1);
+make_record($fh, 16, 21, "boot:foot", 0);
+make_record($fh, 16, 22, "dustin:snazzy", 1);
+make_record($fh, 16, 21, "..more-boot:foot", 1);
+make_record($fh, 16, 1, "", 1);
+close($fh);
+
+open($fh, "<", $arch_filename);
+$ar = Amanda::Archive->new(fileno($fh), "<");
+pass("Create a new archive for reading");
+
+@res = ();
+$ar->read(
+    file_start => sub {
+       push @res, [ "file_start", @_ ];
+       return "cows";
+    },
+    file_finish => sub {
+       push @res, [ "file_finish", @_ ];
+    },
+    0 => sub {
+       push @res, [ "frag", @_ ];
+       return "ants";
+    },
+    user_data => $user_data,
+);
+is_deeply([@res], [
+       [ 'file_start', $user_data, 16, '/etc/passwd' ],
+        [ 'frag', $user_data, 16, "cows", 20, undef, 'root:foo', 1, 0 ],
+        [ 'frag', $user_data, 16, "cows", 21, undef, 'boot:foot', 0, 0 ],
+        [ 'frag', $user_data, 16, "cows", 22, undef, 'dustin:snazzy', 1, 0 ],
+        [ 'frag', $user_data, 16, "cows", 21, "ants", '..more-boot:foot', 1, 0 ],
+        [ 'file_finish', $user_data, "cows", 16, 0 ]
+], "simple read callbacks called in the right order")
+    or diag(Dumper(\@res));
+$ar->close();
+close($fh);
+
+
+open($fh, "<", $arch_filename);
+$ar = Amanda::Archive->new(fileno($fh), "<");
+pass("Create a new archive for reading");
+
+@res = ();
+$ar->read(
+    file_start => sub {
+       push @res, [ "file_start", @_ ];
+       return "IGNORE";
+    },
+    file_finish => sub {
+       push @res, [ "file_finish", @_ ];
+    },
+    0 => sub {
+       push @res, [ "frag", @_ ];
+       return "ants";
+    },
+    user_data => $user_data,
+);
+is_deeply([@res], [
+       [ 'file_start', $user_data, 16, '/etc/passwd' ],
+], "'IGNORE' handled correctly")
+    or diag(Dumper(\@res));
+# TODO: check that file data gets dumped appropriately?
+
+
+open($fh, "<", $arch_filename);
+$ar = Amanda::Archive->new(fileno($fh), "<");
+
+@res = ();
+$ar->read(
+    file_start => sub {
+       push @res, [ "file_start", @_ ];
+       return "dogs";
+    },
+    file_finish => sub {
+       push @res, [ "file_finish", @_ ];
+    },
+    21 => [ 100, sub {
+       push @res, [ "fragbuf", @_ ];
+       return "pants";
+    } ],
+    0 => sub {
+       push @res, [ "frag", @_ ];
+       return "ants";
+    },
+    user_data => $user_data,
+);
+is_deeply([@res], [
+       [ 'file_start', $user_data, 16, '/etc/passwd' ],
+        [ 'frag', $user_data, 16, "dogs", 20, undef, 'root:foo', 1, 0 ],
+        [ 'frag', $user_data, 16, "dogs", 22, undef, 'dustin:snazzy', 1, 0 ],
+        [ 'fragbuf', $user_data, 16, "dogs", 21, undef, 'boot:foot..more-boot:foot', 1, 0 ],
+        [ 'file_finish', $user_data, "dogs", 16, 0 ]
+], "buffering parameters parsed correctly")
+    or diag(Dumper(\@res));
+
+
+open($fh, "<", $arch_filename);
+$ar = Amanda::Archive->new(fileno($fh), "<");
+
+@res = ();
+eval {
+    $ar->read(
+       file_start => sub {
+           push @res, [ "file_start", @_ ];
+           die "uh oh";
+       },
+       user_data => $user_data,
+    );
+};
+like($@, qr/uh oh at .*/, "exception propagated correctly");
+is_deeply([@res], [
+       [ 'file_start', $user_data, 16, '/etc/passwd' ],
+], "file_start called before exception was rasied")
+    or diag(Dumper(\@res));
+$ar->close();
+
+unlink($data_filename);
index d525fd6b313fa9d2e74848dd31faf5aa51650fb5..d2ce81b5ac8f31b49764c6b5de7012611d223102 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2006 Zmanda Inc.  All Rights Reserved.
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License version 2 as published
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 #
-# Contact information: Zmanda Inc, 505 N Mathlida Ave, Suite 120
-# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 
-use Test::More qw(no_plan);
-use Amconfig;
+use Test::More tests => 35;
 use File::Path;
 use strict;
 
 use lib "@amperldir@";
+use Installcheck::Config;
 use Amanda::Paths;
 use Amanda::Device;
 use Amanda::Debug;
+use Amanda::MainLoop;
 use Amanda::Config qw( :init :getconf config_dir_relative );
 use Amanda::Changer;
 
 # set up debugging so debug output doesn't interfere with test results
 Amanda::Debug::dbopen("installcheck");
 
-my $changer_filename = "$AMANDA_TMPDIR/chg-test";
+# and disable Debug's die() and warn() overrides
+Amanda::Debug::disable_die_override();
 
-sub setup_changer {
-    my ($changer_script) = @_;
+# --------
+# define a "test" changer for purposes of this installcheck
 
-    open my $chg_test, ">", $changer_filename or die("Could not create test changer");
-    
-    $changer_script =~ s/\$AMANDA_TMPDIR/$AMANDA_TMPDIR/g;
+package Amanda::Changer::test;
+use vars qw( @ISA );
+@ISA = qw( Amanda::Changer );
 
-    print $chg_test "#! /bin/sh\n";
-    print $chg_test $changer_script;
+# monkey-patch our test changer into Amanda::Changer, and indicate that
+# the module has already been required by adding a key to %INC
+$INC{'Amanda/Changer/test.pm'} = "Amanda_Changer";
 
-    close $chg_test;
-    chmod 0755, $changer_filename;
+sub new {
+    my $class = shift;
+    my ($cc, $tpchanger) = @_;
+
+    my $self = {
+       curslot => 0,
+       slots => [ 'TAPE-00', 'TAPE-01', 'TAPE-02', 'TAPE-03' ],
+       reserved_slots => [],
+        clean => 0,
+    };
+    bless ($self, $class);
+    return $self;
+}
+
+sub load {
+    my $self = shift;
+    my %params = @_;
+
+    my $cb = $params{'res_cb'};
+
+    if (exists $params{'label'}) {
+       # search by label
+       my $slot = -1;
+       my $label = $params{'label'};
+
+       for my $i (0 .. $#{$self->{'slots'}}) {
+           if ($self->{'slots'}->[$i] eq $label) {
+               $slot = $i;
+               last;
+           }
+       }
+       if ($slot == -1) {
+           $cb->("No such label '$label'", undef);
+           return;
+       }
+
+       # check that it's not in use
+       for my $used_slot (@{$self->{'reserved_slots'}}) {
+           if ($used_slot == $slot) {
+               $cb->("Volume with label '$label' is already in use", undef);
+               return;
+           }
+       }
+
+       # ok, let's use it.
+       push @{$self->{'reserved_slots'}}, $slot;
+
+        if (exists $params{'set_current'} && $params{'set_current'}) {
+            $self->{'curslot'} = $slot;
+        }
+
+       $cb->(undef, Amanda::Changer::test::Reservation->new($self, $slot, $label));
+    } elsif (exists $params{'slot'}) {
+       my $slot = $params{'slot'};
+       $slot = $self->{'curslot'}
+           if ($slot eq "current");
+
+       if (grep { $_ == $slot } @{$self->{'reserved_slots'}}) {
+           $cb->("Slot $slot is already in use", undef);
+            return;
+       }
+        my $label = $self->{'slots'}->[$slot];
+        push @{$self->{'reserved_slots'}}, $slot;
+
+        if (exists $params{'set_current'} && $params{'set_current'}) {
+            $self->{'curslot'} = $slot;
+        }
+
+        $cb->(undef, Amanda::Changer::test::Reservation->new($self, $slot, $label));
+    } else {
+       die "No label or slot parameter given";
+    }
+}
+
+sub reset {
+    my $self = shift;
+    my %params = @_;
+
+    $self->{'curslot'} = 0;
+
+    if (exists $params{'finished_cb'}) {
+       Amanda::MainLoop::call_later($params{'finished_cb'}, undef);
+    }
+}
+
+sub clean {
+    my $self = shift;
+    my %params = @_;
+
+    $self->{'clean'} = 1;
+
+    if (exists $params{'finished_cb'}) {
+       Amanda::MainLoop::call_later($params{'finished_cb'}, undef);
+    }
+}
+
+
+package Amanda::Changer::test::Reservation;
+use vars qw( @ISA );
+@ISA = qw( Amanda::Changer::Reservation );
+
+sub new {
+    my $class = shift;
+    my ($chg, $slot, $label) = @_;
+    my $self = Amanda::Changer::Reservation::new($class);
+
+    $self->{'chg'} = $chg;
+    $self->{'slot'} = $slot;
+    $self->{'label'} = $label;
+
+    $self->{'device_name'} = "test:slot-$slot";
+    $self->{'this_slot'} = $slot;
+    $self->{'next_slot'} = ($slot + 1) % (scalar @{$chg->{'slots'}});
+
+    return $self;
+}
+
+sub release {
+    my $self = shift;
+    my %params = @_;
+    my $slot = $self->{'slot'};
+    my $chg = $self->{'chg'};
+
+    $chg->{'reserved_slots'} = [ grep { $_ != $slot } @{$chg->{'reserved_slots'}} ];
+
+    if (exists $params{'finished_cb'}) {
+       Amanda::MainLoop::call_later($params{'finished_cb'}, undef);
+    }
+}
+
+sub set_label {
+    my $self = shift;
+    my %params = @_;
+    my $slot = $self->{'slot'};
+    my $chg = $self->{'chg'};
+
+    $self->{'chg'}->{'slots'}->[$self->{'slot'}] = $params{'label'};
+    $self->{'label'} = $params{'label'};
+
+    if (exists $params{'finished_cb'}) {
+       Amanda::MainLoop::call_later($params{'finished_cb'}, undef);
+    }
 }
 
-# set up and load a simple config with a tpchanger
-my $testconf = Amconfig->new();
-$testconf->add_param('tpchanger', "\"$changer_filename\"");
+# --------
+# back to the perl tests..
+
+package main;
+
+# work against a config specifying our test changer, to work out the kinks
+# when it opens devices to check their labels
+my $testconf;
+$testconf = Installcheck::Config->new();
+$testconf->add_changer("mychanger", [
+    'tpchanger' => '"chg-test:/foo"',
+]);
 $testconf->write();
-config_init($CONFIG_INIT_EXPLICIT_NAME, 'TESTCONF') or die("Could not load test config");
-
-# some variables we'll need
-my ($error, $slot, $device);
-
-# OK, let's get started with some simple stuff
-setup_changer <<'EOC';
-case "${1}" in
-    -slot)
-        case "${2}" in
-            1) echo "1 fake:1"; exit 0;;
-            2) echo "<ignored> slot 2 is empty"; exit 1;;
-            3) echo "<error> oh noes!"; exit 2;;
-            4) echo "1"; exit 0;; # test missing 'device' portion
-        esac;;
-    -reset) echo "reset ignored";;
-    -eject) echo "eject ignored";;
-    -clean) echo "clean ignored";;
-    -label)
-        case "${2}" in
-            foo?bar) echo "1 ok"; exit 0;;
-            *) echo "<error> bad label"; exit 1;;
-        esac;;
-    -info) echo "7 10 1 1"; exit 0;;
-    -search) 
-        case "${2}" in
-            TAPE?01) echo "5 fakedev"; exit 0;;
-            *) echo "<error> not found"; exit 2;;
-        esac;;
-esac
-EOC
-
-is_deeply([ Amanda::Changer::loadslot(1) ], [0, "1", "fake:1"],
-    "A successful loadslot() returns the right stuff");
-
-($error, $slot, $device) = Amanda::Changer::loadslot(2);
-is($error, "slot 2 is empty", "A loadslot() with a benign error returns the right stuff");
-
-eval { Amanda::Changer::loadslot(3); };
-like($@, qr/.*oh noes!.*/, "A loadslot() with a serious error croaks");
-
-is_deeply([ Amanda::Changer::loadslot(4) ], [0, "1", undef],
-    "a response without a device string returns undef");
-
-is_deeply([ Amanda::Changer::reset() ], [ 0, "reset" ],
-    "reset() calls tapechanger -reset");
-is_deeply([ Amanda::Changer::eject() ], [ 0, "eject" ],
-    "eject() calls tapechanger -eject");
-is_deeply([ Amanda::Changer::clean() ], [ 0, "clean" ],
-    "clean() calls tapechanger -clean");
-
-is_deeply([ Amanda::Changer::label("foo bar") ], [ 0 ],
-    "label('foo bar') calls tapechanger -label 'foo bar' (note spaces)");
-
-is_deeply([ Amanda::Changer::query() ], [ 0, 7, 10, 1, 1 ],
-    "query() returns the correct values for a 4-value changer script");
-
-is_deeply([ Amanda::Changer::find("TAPE 01") ], [ 0, "5", "fakedev" ],
-    "find on a searchable changer invokes -search");
-
-eval { Amanda::Changer::find("TAPE 02") };
-ok($@, "A searchable changer croaks when the label can't be found");
-
-# Now a simple changer that returns three values for -info
-setup_changer <<'EOC';
-case "${1}" in
-    -info) echo "11 13 0"; exit 0;;
-esac
-EOC
-
-is_deeply([ Amanda::Changer::query() ], [ 0, 11, 13, 0, 0 ],
-    "query() returns the correct values for a 4-value changer script");
-
-# set up 5 vtapes
-for (my $i = 0; $i < 5; $i++) {
-    my $vtapedir = "$AMANDA_TMPDIR/chg-test-tapes/$i/data";
-    if (-e $vtapedir) {
-        rmtree($vtapedir) 
-            or die("Could not remove '$vtapedir'");
+
+my $cfg_result = config_init($CONFIG_INIT_EXPLICIT_NAME, 'TESTCONF');
+if ($cfg_result != $CFGERR_OK) {
+    my ($level, @errors) = Amanda::Config::config_errors();
+    die(join "\n", @errors);
+}
+
+# test loading by label
+
+my $chg = Amanda::Changer->new("mychanger");
+{
+    my @labels = ( 'TAPE-02', 'TAPE-00', 'TAPE-03' );
+    my @reservations = ();
+    my $getres;
+
+    $getres = sub {
+       my $label = pop @labels;
+
+       $chg->load(label => $label,
+                   set_current => ($label eq "TAPE-02"),
+                  res_cb => sub {
+           my ($err, $reservation) = @_;
+           ok(!$err, "no error loading $label")
+               or diag($err);
+
+           # keep this reservation
+           if ($reservation) {
+               push @reservations, $reservation;
+           }
+
+           # and start on the next
+           if (@labels) {
+               $getres->();
+               return;
+           } else {
+               # try to load an already-reserved volume
+               $chg->load(label => 'TAPE-00',
+                          res_cb => sub {
+                   my ($err, $reservation) = @_;
+                   ok($err, "error when requesting already-reserved volume");
+                   Amanda::MainLoop::quit();
+               });
+           }
+       });
+    };
+
+    # start the loop
+    Amanda::MainLoop::call_later($getres);
+    Amanda::MainLoop::run();
+
+    # ditch the reservations and do it all again
+    @reservations = ();
+    @labels = ( 'TAPE-00', 'TAPE-01' );
+    is_deeply($chg->{'reserved_slots'}, [],
+       "reservations are released when the Reservation object goes out of scope");
+    Amanda::MainLoop::call_later($getres);
+    Amanda::MainLoop::run();
+
+    # explicitly release the reservations (without using the callback)
+    for my $res (@reservations) {
+        $res->release();
     }
-    mkpath($vtapedir)
-        or die("Could not create '$vtapedir'");
 }
 
-# label three of them (slot 2 is empty; slot 4 is unlabeled)
-for (my $i = 0; $i < 5; $i++) {
-    next if $i == 2 || $i == 4;
-    my $dev = Amanda::Device->new("file:$AMANDA_TMPDIR/chg-test-tapes/$i")
-        or die("Could not open device");
-    $dev->start($Amanda::Device::ACCESS_WRITE, "TAPE$i", "19780615010203") 
-        or die("Could not write label");
-    $dev->finish();
+# test loading by slot
+{
+    my ($start, $first_cb, $second_cb);
+
+    # reserves the current slot
+    $start = sub {
+        $chg->load(res_cb => $first_cb, slot => "current");
+    };
+
+    # gets a reservation for the "current" slot
+    $first_cb = sub {
+        my ($err, $res) = @_;
+        die $err if $err;
+
+        is($res->{'this_slot'}, 2,
+            "'current' slot loads slot 2");
+        is($res->{'device_name'}, "test:slot-2",
+            "..device is correct");
+        is($res->{'next_slot'}, 3,
+            "..and the next slot is slot 3");
+        $chg->load(res_cb => $second_cb, slot => $res->{'next_slot'}, set_current => 1);
+    };
+
+    # gets a reservation for the "next" slot
+    $second_cb = sub {
+        my ($err, $res) = @_;
+        die $err if $err;
+
+        is($res->{'this_slot'}, 3,
+            "next slot loads slot 3");
+        is($chg->{'curslot'}, 3,
+            "..which is also now the current slot");
+        is($res->{'next_slot'}, 0,
+            "..and the next slot is slot 0");
+
+        Amanda::MainLoop::quit();
+    };
+
+    Amanda::MainLoop::call_later($start);
+    Amanda::MainLoop::run();
+}
+
+# test set_label
+{
+    my ($start, $load1_cb, $set_cb, $load2_cb, $load3_cb);
+
+    # load TAPE-00
+    $start = sub {
+        $chg->load(res_cb => $load1_cb, label => "TAPE-00");
+    };
+
+    # rename it to TAPE-99
+    $load1_cb = sub {
+        my ($err, $res) = @_;
+        die $err if $err;
+
+        pass("loaded TAPE-00");
+        $res->set_label(label => "TAPE-99", finished_cb => $set_cb);
+        $res->release();
+    };
+
+    # try to load TAPE-00
+    $set_cb = sub {
+        my ($err) = @_;
+        die $err if $err;
+
+        pass("relabeled TAPE-00 to TAPE-99");
+        $chg->load(res_cb => $load2_cb, label => "TAPE-00");
+    };
+
+    # try to load TAPE-99
+    $load2_cb = sub {
+        my ($err, $res) = @_;
+
+        ok($err, "loading TAPE-00 is now an error");
+        $chg->load(res_cb => $load3_cb, label => "TAPE-99");
+    };
+
+    # check result
+    $load3_cb = sub {
+        my ($err, $res) = @_;
+        die $err if $err;
+
+        pass("but loading TAPE-99 is ok");
+
+        Amanda::MainLoop::quit();
+    };
+
+    Amanda::MainLoop::call_later($start);
+    Amanda::MainLoop::run();
+}
+
+# test reset and clean
+{
+    my ($do_reset, $do_clean);
+
+    $do_reset = sub {
+        $chg->reset(finished_cb => sub {
+            is($chg->{'curslot'}, 0,
+                "reset() resets to slot 0");
+            $do_clean->();
+        });
+    };
+
+    $do_clean = sub {
+        $chg->clean(finished_cb => sub {
+            ok($chg->{'clean'}, "clean 'cleaned' the changer");
+            Amanda::MainLoop::quit();
+        });
+    };
+
+    Amanda::MainLoop::call_later($do_reset);
+    Amanda::MainLoop::run();
+}
+
+# Test the various permutations of configuration setup, with a patched
+# _new_from_uri so we can monitor the result
+sub my_new_from_uri {
+    my ($uri, $cc, $name) = @_;
+    return [ $uri, $cc? "cc" : undef ];
+}
+*saved_new_from_uri = *Amanda::Changer::_new_from_uri;
+*Amanda::Changer::_new_from_uri = *my_new_from_uri;
+
+sub loadconfig {
+    my ($global_tapedev, $global_tpchanger, $defn_tpchanger) = @_;
+
+    $testconf = Installcheck::Config->new();
+
+    if (defined($global_tapedev)) {
+       $testconf->add_param('tapedev', "\"$global_tapedev\"")
+    }
+
+    if (defined($global_tpchanger)) {
+       $testconf->add_param('tpchanger', "\"$global_tpchanger\"")
+    }
+
+    if (defined($defn_tpchanger)) {
+       $testconf->add_changer("mychanger", [
+           'tpchanger' => "\"$defn_tpchanger\"",
+       ]);
+    }
+
+    $testconf->write();
+
+    my $cfg_result = config_init($CONFIG_INIT_EXPLICIT_NAME, 'TESTCONF');
+    if ($cfg_result != $CFGERR_OK) {
+       my ($level, @errors) = Amanda::Config::config_errors();
+       die(join "\n", @errors);
+    }
 }
 
-# And finally a "stateful" changer that can support "scan" and "find"
-setup_changer <<'EOC';
-STATEFILE="$AMANDA_TMPDIR/chg-test-state"
-SLOT=0
-[ -f "$STATEFILE" ] && . "$STATEFILE"
-
-case "${1}" in
-    -slot)
-        case "${2}" in
-            current) ;;
-            0|1|2|3|4|5) SLOT="${2}";;
-            next|advance) SLOT=`expr $SLOT + 1`;;
-            prev) SLOT=`expr $SLOT - 1`;;
-            first) SLOT=0;;
-            last) SLOT=4;;
-        esac
-
-        # normalize 0 <= $SLOT  < 5
-        while [ "$SLOT" -ge 5 ]; do SLOT=`expr $SLOT - 5`; done
-        while [ "$SLOT" -lt 0 ]; do SLOT=`expr $SLOT + 5`; done
-
-        # signal an empty slot for slot 2
-        if [ "$SLOT" = 2 ]; then
-            echo "$SLOT slot $SLOT is empty"
-            EXIT=1
-        else
-            echo "$SLOT" "file:$AMANDA_TMPDIR/chg-test-tapes/$SLOT"
-        fi
-        ;;
-    -info) echo "$SLOT 5 1 0";;
-esac
-
-echo SLOT=$SLOT > $STATEFILE
-exit $EXIT
-EOC
-
-($error, $slot, $device) = Amanda::Changer::loadslot(0);
-if ($error) { die("Error loading slot 0: $error"); }
-is_deeply([ Amanda::Changer::find("TAPE3") ], [0, "3", "file:$AMANDA_TMPDIR/chg-test-tapes/3"],
-    "Finds a tape after skipping an empty slot");
-
-($error, $slot, $device) = Amanda::Changer::loadslot(3);
-if ($error) { die("Error loading slot 3: $error"); }
-is_deeply([ Amanda::Changer::find("TAPE1") ], [0, "1", "file:$AMANDA_TMPDIR/chg-test-tapes/1"],
-    "Finds a tape after skipping an unlabeled but filled slot");
-
-my @scanresults;
-sub cb {
-    fail("called too many times") if (!@scanresults);
-    my $expected = shift @scanresults;
-    my $descr = pop @$expected;
-    my $done = pop @$expected;
-    is_deeply([ @_ ], $expected, $descr);
-    return 1;
+sub assert_invalid {
+    my ($global_tapedev, $global_tpchanger, $defn_tpchanger, $name, $msg) = @_;
+    loadconfig($global_tapedev, $global_tpchanger, $defn_tpchanger);
+    eval { Amanda::Changer->new($name); };
+    ok($@, $msg);
 }
 
-# scan the whole changer
-($error, $slot, $device) = Amanda::Changer::loadslot(0);
-if ($error) { die("Error loading slot 0: $error"); }
-@scanresults = (
-    [ "0", "file:$AMANDA_TMPDIR/chg-test-tapes/0", 0, 0, "scan starts with slot 0" ],
-    [ "1", "file:$AMANDA_TMPDIR/chg-test-tapes/1", 0, 0, "next in slot 1" ],
-    [ undef, undef, "slot 2 is empty",                0, "slot 2 is empty" ],
-    [ "3", "file:$AMANDA_TMPDIR/chg-test-tapes/3", 0, 0, "next in slot 3" ],
-    [ "4", "file:$AMANDA_TMPDIR/chg-test-tapes/4", 0, 0, "next in slot 4" ],
-);
-Amanda::Changer::scan(\&cb);
-
-# make sure it stops when "done"
-($error, $slot, $device) = Amanda::Changer::loadslot(0);
-if ($error) { die("Error loading slot 0: $error"); }
-@scanresults = (
-    [ "0", "file:$AMANDA_TMPDIR/chg-test-tapes/0", 0, 1, "scan starts with slot 0" ],
-);
-Amanda::Changer::scan(\&cb);
-
-# cleanup
-unlink("$AMANDA_TMPDIR/chg-test");
-unlink("$AMANDA_TMPDIR/chg-test-state");
-rmtree("$AMANDA_TMPDIR/chg-test-tapes");
+assert_invalid(undef, undef, undef, undef,
+    "supplying a nothing is invalid");
+
+loadconfig(undef, "file:/foo", undef);
+is_deeply( Amanda::Changer->new(), [ "chg-single:file:/foo", undef ],
+    "default changer with global tpchanger naming a device");
+
+loadconfig(undef, "chg-disk:/foo", undef);
+is_deeply( Amanda::Changer->new(), [ "chg-disk:/foo", undef ],
+    "default changer with global tpchanger naming a changer");
+
+loadconfig(undef, "mychanger", "chg-disk:/bar");
+is_deeply( Amanda::Changer->new(), [ "chg-disk:/bar", "cc" ],
+    "default changer with global tpchanger naming a defined changer with a uri");
+
+loadconfig(undef, "mychanger", "chg-zd-mtx");
+is_deeply( Amanda::Changer->new(), [ "chg-compat:chg-zd-mtx", "cc" ],
+    "default changer with global tpchanger naming a defined changer with a compat script");
+
+loadconfig(undef, "chg-zd-mtx", undef);
+is_deeply( Amanda::Changer->new(), [ "chg-compat:chg-zd-mtx", undef ],
+    "default changer with global tpchanger naming a compat script");
+
+loadconfig("tape:/dev/foo", undef, undef);
+is_deeply( Amanda::Changer->new(), [ "chg-single:tape:/dev/foo", undef ],
+    "default changer with global tapedev naming a device and no tpchanger");
+
+assert_invalid("tape:/dev/foo", "tape:/dev/foo", undef, undef,
+    "supplying a device for both tpchanger and tapedev is invalid");
+
+assert_invalid("tape:/dev/foo", "chg-disk:/foo", undef, undef,
+    "supplying a device for tapedev and a changer for tpchanger is invalid");
+
+loadconfig("tape:/dev/foo", 'chg-zd-mtx', undef);
+is_deeply( Amanda::Changer->new(), [ "chg-compat:chg-zd-mtx", undef ],
+    "default changer with global tapedev naming a device and a global tpchanger naming a compat script");
+
+assert_invalid("chg-disk:/foo", "tape:/dev/foo", undef, undef,
+    "supplying a changer for tapedev and a device for tpchanger is invalid");
+
+loadconfig("chg-disk:/foo", undef, undef);
+is_deeply( Amanda::Changer->new(), [ "chg-disk:/foo", undef ],
+    "default changer with global tapedev naming a device");
+
+loadconfig("mychanger", undef, "chg-disk:/bar");
+is_deeply( Amanda::Changer->new(), [ "chg-disk:/bar", "cc" ],
+    "default changer with global tapedev naming a defined changer with a uri");
+
+loadconfig("mychanger", undef, "chg-zd-mtx");
+is_deeply( Amanda::Changer->new(), [ "chg-compat:chg-zd-mtx", "cc" ],
+    "default changer with global tapedev naming a defined changer with a compat script");
+
+loadconfig(undef, undef, "chg-disk:/foo");
+is_deeply( Amanda::Changer->new("mychanger"), [ "chg-disk:/foo", "cc" ],
+    "named changer loads the proper definition");
+
+*Amanda::Changer::_new_from_uri = *saved_new_from_uri;
diff --git a/installcheck/Amanda_Changer_compat.pl b/installcheck/Amanda_Changer_compat.pl
new file mode 100644 (file)
index 0000000..2480204
--- /dev/null
@@ -0,0 +1,319 @@
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+use Test::More tests => 17;
+use File::Path;
+use strict;
+use warnings;
+
+use lib "@amperldir@";
+use Installcheck::Config;
+use Installcheck::Run;
+use Amanda::Paths;
+use Amanda::Device;
+use Amanda::Debug;
+use Amanda::MainLoop;
+use Amanda::Config qw( :init :getconf config_dir_relative );
+use Amanda::Changer;
+
+# set up debugging so debug output doesn't interfere with test results
+Amanda::Debug::dbopen("installcheck");
+
+# and disable Debug's die() and warn() overrides
+Amanda::Debug::disable_die_override();
+
+my $changer_filename = "$AMANDA_TMPDIR/chg-test";
+
+# Set up a 'test' changer; several of these are defined below.
+sub setup_changer {
+    my ($changer_script) = @_;
+
+    open my $chg_test, ">", $changer_filename or die("Could not create test changer");
+
+    $changer_script =~ s/\$AMANDA_TMPDIR/$AMANDA_TMPDIR/g;
+
+    print $chg_test "#! /bin/sh\n";
+    print $chg_test $changer_script;
+
+    close $chg_test;
+    chmod 0755, $changer_filename;
+}
+
+# Functions to invoke the changer and later verify the result
+{
+    my $expected_err_re;
+    my $expected_dev;
+    my $msg;
+
+    sub check_res_cb {
+       my ($err, $res) = @_;
+       Amanda::MainLoop::quit();
+
+       if ($err) {
+           if (defined($expected_err_re)) {
+               like($err, $expected_err_re, $msg);
+           } else {
+               fail($msg);
+               debug("Unexpected error: $err");
+           }
+       } else {
+           if (defined($expected_dev)) {
+               is($res->{'device_name'}, $expected_dev, $msg);
+           } else {
+               fail($msg);
+               diag("Unexpected reservation");
+           }
+       }
+    }
+
+    sub check_finished_cb {
+       my ($err) = @_;
+       Amanda::MainLoop::quit();
+
+       if ($err) {
+           if (defined($expected_err_re)) {
+               like($err, $expected_err_re, $msg);
+           } else {
+               fail($msg);
+               diag("Unexpected error: $err");
+           }
+       } else {
+           if (!defined($expected_err_re)) {
+               pass($msg);
+           } else {
+               fail($msg);
+               diag("Unexpected success");
+           }
+       }
+    }
+
+    sub try_run_changer {
+       my $sub;
+       ($sub, $expected_err_re, $expected_dev, $msg) = @_;
+
+       Amanda::MainLoop::call_later($sub);
+       Amanda::MainLoop::run();
+    }
+}
+
+# OK, let's get started with some simple stuff
+setup_changer <<'EOC';
+case "${1}" in
+    -slot)
+        case "${2}" in
+            1) echo "1 fake:1"; exit 0;;
+            2) echo "<ignored> slot 2 is empty"; exit 1;;
+            3) echo "1"; exit 0;; # test missing 'device' portion
+        esac;;
+    -reset) echo "reset ignored";;
+    -eject) echo "eject ignored";;
+    -clean) echo "clean ignored";;
+    -label)
+        case "${2}" in
+            foo?bar) echo "1 ok"; exit 0;;
+            *) echo "<error> bad label"; exit 1;;
+        esac;;
+    -info) echo "7 10 1 1"; exit 0;;
+    -search)
+        case "${2}" in
+            TAPE?01) echo "5 fakedev"; exit 0;;
+            *) echo "<error> not found"; exit 1;;
+        esac;;
+esac
+EOC
+
+# set up a config for this changer, implicitly using Amanda::Changer::Compat
+my $testconf;
+$testconf = Installcheck::Config->new();
+$testconf->add_param("tpchanger", "\"$changer_filename\"");
+$testconf->write();
+
+my $cfg_result = config_init($CONFIG_INIT_EXPLICIT_NAME, 'TESTCONF');
+if ($cfg_result != $CFGERR_OK) {
+    my ($level, @errors) = Amanda::Config::config_errors();
+    die(join "\n", @errors);
+}
+
+my $chg = Amanda::Changer->new();
+try_run_changer(
+    sub { $chg->load(label => 'TAPE-01', res_cb => \&check_res_cb); },
+    undef, "fakedev", "search by label");
+
+try_run_changer(
+    sub { $chg->load(label => 'TAPE-99', res_cb => \&check_res_cb); },
+    qr/^not found$/, undef, "search by label; nonexistent tape");
+
+try_run_changer(
+    sub { $chg->load(slot => '1', res_cb => \&check_res_cb); },
+    undef, "fake:1", "search by slot");
+
+try_run_changer(
+    sub { $chg->load(slot => '2', res_cb => \&check_res_cb); },
+    qr/^slot 2 is empty$/, undef, "search by slot; empty slot");
+
+# TODO: what *should* happen here?
+#try_run_changer(
+#    sub { $chg->load(slot => '3', res_cb => \&check_res_cb); },
+#    undef, undef, "search by slot; invalid response");
+
+try_run_changer(
+    sub { $chg->reset(finished_cb => \&check_finished_cb); },
+    undef, undef, "reset doesn't fail");
+
+try_run_changer(
+    sub { $chg->clean(finished_cb => \&check_finished_cb); },
+    undef, undef, "clean doesn't fail");
+
+# TODO test update()
+
+# make sure only one reservation can be held at once
+{
+    my $first_res;
+
+    my ($load_1, $load_2, $check_load_2, $check_eject);
+
+    $load_1 = sub {
+        $chg->load(slot => 1, res_cb => $load_2);
+    };
+
+    $load_2 = sub {
+        my ($err, $res) = @_;
+        die $err if ($err);
+
+        # keep this in scope through the next load
+        $first_res = $res;
+
+        $chg->load(slot => 2, res_cb => $check_load_2);
+    };
+
+    $check_load_2 = sub {
+        my ($err, $res) = @_;
+
+        like($err, qr/Changer is already reserved/,
+            "mulitple simultaneous reservations not alowed");
+
+        $first_res->release(eject => 1, finished_cb => $check_eject);
+    };
+
+    $check_eject = sub {
+        my ($err) = @_;
+
+        ok(!defined $err, "release with eject succeeds");
+
+        Amanda::MainLoop::quit();
+    };
+
+    Amanda::MainLoop::call_later($load_1);
+    Amanda::MainLoop::run();
+}
+
+## check chg-disk
+
+# Installcheck::Run sets up the whole chg-disk thing for us
+$testconf = Installcheck::Run->setup();
+$testconf->write();
+
+$cfg_result = config_init($CONFIG_INIT_EXPLICIT_NAME, 'TESTCONF');
+if ($cfg_result != $CFGERR_OK) {
+    my ($level, @errors) = Amanda::Config::config_errors();
+    die(join "\n", @errors);
+}
+
+$chg = Amanda::Changer->new();
+
+{
+    my ($get_info, $load_current, $label_current, $load_next,
+        $release_next, $load_by_label, $check_by_label);
+
+    $get_info = sub {
+        $chg->info(info_cb => $load_current, info => [ 'num_slots' ]);
+    };
+
+    $load_current = sub {
+        my $err = shift;
+        my %results = @_;
+        die($err) if defined($err);
+
+        is($results{'num_slots'}, 15, "info() returns the correct num_slots");
+
+        $chg->load(slot => "1", res_cb => $label_current);
+    };
+
+    $label_current = sub {
+        my ($err, $res) = @_;
+        die $err if ($err);
+
+        pass("seek to current slot succeeded");
+
+        my $dev = Amanda::Device->new($res->{'device_name'});
+        $dev->start($Amanda::Device::ACCESS_WRITE, "TESTCONF18", undef)
+            or die $dev->error_or_status();
+        $dev->finish()
+            or die $dev->error_or_status();
+
+        is($res->{'this_slot'}, "1", "this slot is '1'");
+        is($res->{'next_slot'}, "next", "next slot is 'next'");
+        $res->set_label(label => "TESTCONF18", finished_cb => $load_next);
+    };
+
+    $load_next = sub {
+        my ($err) = @_;
+        die $err if ($err);
+
+        pass("set_label succeeded");
+
+        $chg->load(slot => "next", res_cb => $release_next);
+    };
+
+    $release_next = sub {
+        my ($err, $res) = @_;
+        die $err if ($err);
+
+        pass("load 'next' succeeded");
+
+        $res->release(finished_cb => $load_by_label);
+    };
+
+    $load_by_label = sub {
+        my ($err) = @_;
+        die $err if ($err);
+
+        pass("release loaded");
+
+        $chg->load(label => "TESTCONF18", res_cb => $check_by_label);
+    };
+
+    $check_by_label = sub {
+        my ($err, $res) = @_;
+        die $err if ($err);
+
+        pass("load by label succeeded");
+
+        my $dev = Amanda::Device->new($res->{'device_name'});
+        $dev->read_label() == 0
+            or die $dev->error_or_status();
+
+        is($dev->volume_label(), "TESTCONF18",
+            "..and finds the right volume");
+
+        Amanda::MainLoop::quit();
+    };
+
+    Amanda::MainLoop::call_later($get_info);
+    Amanda::MainLoop::run();
+}
diff --git a/installcheck/Amanda_Changer_disk.pl b/installcheck/Amanda_Changer_disk.pl
new file mode 100644 (file)
index 0000000..c8db6bf
--- /dev/null
@@ -0,0 +1,230 @@
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+use Test::More tests => 14;
+use File::Path;
+use strict;
+
+use lib "@amperldir@";
+use Installcheck::Config;
+use Amanda::Paths;
+use Amanda::Device;
+use Amanda::Debug;
+use Amanda::MainLoop;
+use Amanda::Config qw( :init :getconf config_dir_relative );
+use Amanda::Changer;
+
+# set up debugging so debug output doesn't interfere with test results
+Amanda::Debug::dbopen("installcheck");
+
+# and disable Debug's die() and warn() overrides
+Amanda::Debug::disable_die_override();
+
+my $taperoot = "$AMANDA_TMPDIR/Amanda_Changer_Disk_test";
+
+sub reset_taperoot {
+    my ($nslots) = @_;
+
+    if (-d $taperoot) {
+       rmtree($taperoot);
+    }
+    mkpath($taperoot);
+
+    for my $slot (1 .. $nslots) {
+       mkdir("$taperoot/slot$slot")
+           or die("Could not mkdir: $!");
+    }
+}
+
+sub is_pointing_to {
+    my ($res, $slot, $msg) = @_;
+
+    my ($datalink) = ($res->{'device_name'} =~ /file:(.*)/);
+    $datalink .= "/data";
+    is(readlink($datalink), "../slot$slot", $msg);
+}
+
+# Build a configuration that specifies Amanda::Changer::Disk
+my $testconf = Installcheck::Config->new();
+$testconf->write();
+
+my $cfg_result = config_init($CONFIG_INIT_EXPLICIT_NAME, 'TESTCONF');
+if ($cfg_result != $CFGERR_OK) {
+    my ($level, @errors) = Amanda::Config::config_errors();
+    die(join "\n", @errors);
+}
+
+reset_taperoot(5);
+my $chg = Amanda::Changer->new("chg-disk:$taperoot");
+
+{
+    my @slots = ( 1, 3, 5 );
+    my @reservations = ();
+    my $getres;
+
+    $getres = sub {
+       my $slot = pop @slots;
+
+       $chg->load(slot => $slot,
+                   set_current => ($slot == 5),
+                  res_cb => sub {
+           my ($err, $reservation) = @_;
+           ok(!$err, "no error loading slot $slot")
+               or diag($err);
+
+           # keep this reservation
+           if ($reservation) {
+               push @reservations, $reservation;
+           }
+
+           # and start on the next
+           if (@slots) {
+               $getres->();
+               return;
+           } else {
+               # try to load an already-reserved slot
+               $chg->load(slot => 3,
+                          res_cb => sub {
+                   my ($err, $reservation) = @_;
+                   ok($err, "error when requesting already-reserved slot");
+                   Amanda::MainLoop::quit();
+               });
+           }
+       });
+    };
+
+    # start the loop
+    Amanda::MainLoop::call_later($getres);
+    Amanda::MainLoop::run();
+
+    # ditch the reservations and do it all again
+    @reservations = ();
+    @slots = ( 4, 2, 3 );
+    Amanda::MainLoop::call_later($getres);
+    Amanda::MainLoop::run();
+
+    @reservations = ();
+}
+
+# check "current" and "next" functionality
+{
+    # load the "current" slot, which should be 3
+    my ($load_current, $check_current_cb, $check_next_cb, $reset_finished_cb, $check_reset_cb);
+
+    $load_current = sub {
+       $chg->load(slot => "current", res_cb => $check_current_cb);
+    };
+
+    $check_current_cb = sub {
+        my ($err, $res) = @_;
+        die $err if $err;
+
+        is_pointing_to($res, 5, "'current' is slot 5");
+
+        $chg->load(slot => $res->{'next_slot'}, res_cb => $check_next_cb);
+    };
+
+    $check_next_cb = sub {
+        my ($err, $res) = @_;
+        die $err if $err;
+
+        is_pointing_to($res, 1, "'next' from there is slot 1");
+
+        $chg->reset(finished_cb => $reset_finished_cb);
+    };
+
+    $reset_finished_cb = sub {
+        my ($err) = @_;
+        die $err if $err;
+
+       $chg->load(slot => "current", res_cb => $check_reset_cb);
+    };
+
+    $check_reset_cb = sub {
+        my ($err, $res) = @_;
+        die $err if $err;
+
+        is_pointing_to($res, 1, "after reset, 'current' is slot 1");
+
+        Amanda::MainLoop::quit();
+    };
+
+    Amanda::MainLoop::call_later($load_current);
+    Amanda::MainLoop::run();
+}
+
+# test loading slot "next"
+{
+    my $load_next = sub {
+        $chg->load(slot => "next",
+            res_cb => sub {
+                my ($err, $res) = @_;
+                die $err if $err;
+
+                is_pointing_to($res, 2, "loading slot 'next' loads the correct slot");
+
+                Amanda::MainLoop::quit();
+            }
+        );
+    };
+
+    Amanda::MainLoop::call_later($load_next);
+    Amanda::MainLoop::run();
+}
+
+# check num_slots and loading by label
+{
+    my ($get_info, $load_label, $check_load_cb) = @_;
+
+    $get_info = sub {
+        $chg->info(info_cb => $load_label, info => [ 'num_slots' ]);
+    };
+
+    $load_label = sub {
+        my $err = shift;
+        my %results = @_;
+        die($err) if defined($err);
+
+        is($results{'num_slots'}, 5, "info() returns the correct num_slots");
+
+        # note use of a glob metacharacter in the label name
+        $chg->load(label => "FOO?BAR", res_cb => $check_load_cb);
+    };
+
+    $check_load_cb = sub {
+        my ($err, $res) = @_;
+        die $err if $err;
+
+        is_pointing_to($res, 4, "labeled volume found in slot 4");
+
+        Amanda::MainLoop::quit();
+    };
+
+    # label slot 4, using our own symlink
+    mkpath("$taperoot/tmp");
+    symlink("../slot4", "$taperoot/tmp/data") or die "While symlinking: $!";
+    my $dev = Amanda::Device->new("file:$taperoot/tmp");
+    $dev->start($Amanda::Device::ACCESS_WRITE, "FOO?BAR", undef)
+        or die $dev->error_or_status();
+    $dev->finish()
+        or die $dev->error_or_status();
+    rmtree("$taperoot/tmp");
+
+    Amanda::MainLoop::call_later($get_info);
+    Amanda::MainLoop::run();
+}
diff --git a/installcheck/Amanda_Changer_single.pl b/installcheck/Amanda_Changer_single.pl
new file mode 100644 (file)
index 0000000..f4b8f83
--- /dev/null
@@ -0,0 +1,91 @@
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+use Test::More tests => 4;
+use File::Path;
+use strict;
+
+use lib "@amperldir@";
+use Installcheck::Config;
+use Amanda::Paths;
+use Amanda::Device;
+use Amanda::Debug;
+use Amanda::MainLoop;
+use Amanda::Config qw( :init :getconf config_dir_relative );
+use Amanda::Changer;
+
+# set up debugging so debug output doesn't interfere with test results
+Amanda::Debug::dbopen("installcheck");
+
+# and disable Debug's die() and warn() overrides
+Amanda::Debug::disable_die_override();
+
+my $testconf = Installcheck::Config->new();
+$testconf->write();
+
+my $cfg_result = config_init($CONFIG_INIT_EXPLICIT_NAME, 'TESTCONF');
+if ($cfg_result != $CFGERR_OK) {
+    my ($level, @errors) = Amanda::Config::config_errors();
+    die(join "\n", @errors);
+}
+
+my $chg = Amanda::Changer->new("chg-single:tape:/foo");
+
+{
+    my ($held_res);
+    my ($get_info, $get_res, $got_res, $got_second_res);
+
+    $get_info = sub {
+        $chg->info(info_cb => $get_res, info => [ 'num_slots' ]);
+    };
+
+    $get_res = sub {
+        my $err = shift;
+        my %results = @_;
+        die($err) if defined($err);
+
+        is($results{'num_slots'}, 1, "info() returns the correct num_slots");
+
+       $chg->load(slot => "current",
+                  res_cb => $got_res);
+    };
+
+    $got_res = sub {
+       my ($err, $res) = @_;
+       ok(!$err, "no error loading slot 'current'")
+           or diag($err);
+       is($res->{'device_name'}, 'tape:/foo',
+           "returns correct device name");
+
+       $held_res = $res; # hang onto it while loading another slot
+
+       $chg->load(label => "FOO!",
+                  res_cb => $got_second_res);
+    };
+
+    $got_second_res = sub {
+       my ($err, $res) = @_;
+       ok($err, "second simultaneous reservation rejected");
+
+       Amanda::MainLoop::quit();
+    };
+
+    # start the loop
+    Amanda::MainLoop::call_later($get_info);
+    Amanda::MainLoop::run();
+}
index 399101abc3451be23124d9647fdd932118b09c0b..0698813f4508ceaaa8588bd6ff3d36d8e9cd669d 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2006 Zmanda Inc.  All Rights Reserved.
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License version 2 as published
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 #
-# Contact information: Zmanda Inc, 505 N Mathlida Ave, Suite 120
-# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 
-use Test::More qw( no_plan );
+use Test::More tests => 24;
 
 use lib "@amperldir@";
 use Amanda::Paths;
index 5a0bb2254fb879bbd3a544f7d9aeff144253efe5..c0bdbd22c06115a5ddab0e166a7cddf5c58ec818 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2006 Zmanda Inc.  All Rights Reserved.
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License version 2 as published
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 #
-# Contact information: Zmanda Inc, 505 N Mathlida Ave, Suite 120
-# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 
-use Test::More qw(no_plan);
-use Amconfig;
+use Test::More tests => 113;
 use strict;
 
 use lib "@amperldir@";
+use Installcheck::Config;
 use Amanda::Paths;
+use Amanda::Tests;
 use Amanda::Config qw( :init :getconf );
+use Amanda::Debug;
 
 my $testconf;
+my $config_overwrites;
+
+Amanda::Debug::dbopen("installcheck");
+
+# utility function
+
+sub diag_config_errors {
+    my ($level, @errors) = Amanda::Config::config_errors();
+    for my $errmsg (@errors) {
+       diag $errmsg;
+    }
+}
 
 ##
 # Try starting with no configuration at all
-ok(config_init(0, ''), "Initialize with no configuration");
+
+is(config_init(0, ''), $CFGERR_OK,
+    "Initialize with no configuration")
+    or diag_config_errors();
+
+is(config_init(0, undef), $CFGERR_OK,
+    "Initialize with no configuration, passing a NULL config name")
+    or diag_config_errors();
+
+$config_overwrites = new_config_overwrites(1);
+add_config_overwrite($config_overwrites, "tapedev", "null:TEST");
+apply_config_overwrites($config_overwrites);
+
+is(getconf($CNF_TAPEDEV), "null:TEST",
+    "config overwrites work with null config");
+
+##
+# Check out error handling
+
+$testconf = Installcheck::Config->new();
+$testconf->add_param('rawtapedev', '"/dev/medium-rare-please"'); # a deprecated keyword -> warning
+$testconf->write();
+
+{
+    is(config_init($CONFIG_INIT_EXPLICIT_NAME, "TESTCONF"), $CFGERR_WARNINGS,
+       "Deprecated keyword generates a warning");
+    my ($error_level, @errors) = Amanda::Config::config_errors();
+    like($errors[0], qr/is deprecated/, 
+       "config_get_errors returns the warning string");
+
+    Amanda::Config::config_clear_errors();
+    ($error_level, @errors) = Amanda::Config::config_errors();
+    is(scalar(@errors), 0, "config_clear_errors clears error list");
+}
+
+$testconf = Installcheck::Config->new();
+$testconf->add_param('invalid-param', 'random-value'); # a deprecated keyword -> warning
+$testconf->write();
+
+is(config_init($CONFIG_INIT_EXPLICIT_NAME, "NO-SUCH-CONFIGURATION"), $CFGERR_ERRORS,
+    "Non-existent config generates an error");
+
+is(config_init($CONFIG_INIT_EXPLICIT_NAME, "TESTCONF"), $CFGERR_ERRORS,
+    "Invalid keyword generates an error");
+
+##
+# try a client configuration
+
+$testconf = Installcheck::Config->new();
+$testconf->add_client_param('property', '"client-prop" "yep"');
+$testconf->add_client_param('property', 'priority "client-prop1" "foo"');
+$testconf->add_client_param('property', 'append "client-prop" "bar"');
+$testconf->write();
+
+my $cfg_result = config_init($CONFIG_INIT_CLIENT, undef);
+is($cfg_result, $CFGERR_OK,
+    "Load test client configuration")
+    or diag_config_errors();
+
+is_deeply(getconf($CNF_PROPERTY), { "client-prop1" => { priority => 1,
+                                                       append   => 0,
+                                                       values => [ "foo" ]},
+                                   "client-prop" => { priority => 0,
+                                                      append   => 1,
+                                                      values => [ "yep", "bar" ] }},
+    "Client PROPERTY parameter parsed correctly");
 
 ##
 # Parse up a basic configuration
 
-# invent "large" values for CONFTYPE_AM64 and CONFTYPE_SIZE
-my $am64_num = '171801575472'; # 0xA000B000C000 / 1024
-my $size_t_num = '2147483647'; # 0x7fffffff
+# invent a "large" unsigned number, and make $size_t_num 
+# depend on the length of size_t
+my $int64_num = '171801575472'; # 0xA000B000C000 / 1024
+my $size_t_num;
+if (Amanda::Tests::sizeof_size_t() > 4) {
+    $size_t_num = $int64_num;
+} else {
+    $size_t_num = '2147483647'; # 0x7fffffff
+}
 
-$testconf = Amconfig->new();
+$testconf = Installcheck::Config->new();
 $testconf->add_param('reserve', '75');
 $testconf->add_param('autoflush', 'yes');
 $testconf->add_param('tapedev', '"/dev/foo"');
-$testconf->add_param('bumpsize', $am64_num);
+$testconf->add_param('bumpsize', $int64_num);
 $testconf->add_param('bumpmult', '1.4');
-$testconf->add_param('reserved-udp-port', '100,200');
+$testconf->add_param('reserved_udp-port', '100,200'); # note use of '-' and '_'
 $testconf->add_param('device_output_buffer_size', $size_t_num);
 $testconf->add_param('taperalgo', 'last');
 $testconf->add_param('device_property', '"foo" "bar"');
-$testconf->add_param('device_property', '"blue" "car"');
+$testconf->add_param('device_property', '"blue" "car" "tar"');
 $testconf->add_param('displayunit', '"m"');
 $testconf->add_param('debug_auth', '1');
 $testconf->add_tapetype('mytapetype', [
     'comment' => '"mine"',
     'length' => '128 M',
 ]);
-$testconf->add_dumptype('mydumptype', [
+$testconf->add_dumptype('mydump-type', [    # note dash
     'comment' => '"mine"',
     'priority' => 'high',  # == 2
-    'bumpsize' => $am64_num,
+    'bumpsize' => $int64_num,
     'bumpmult' => 1.75,
     'starttime' => 1829,
     'holdingdisk' => 'required',
@@ -71,12 +156,22 @@ $testconf->add_dumptype('mydumptype', [
     'include list' => '"bing" "ting"',
     'include list append' => '"string" "fling"',
     'include file optional' => '"rhyme"',
+    'property' => '"prop" "erty"',
+    'property' => '"drop" "qwerty" "asdfg"',
+]);
+$testconf->add_dumptype('second_dumptype', [ # note underscore
+    '' => 'mydump-type',
+    'comment' => '"refers to mydump-type with a dash"',
 ]);
-$testconf->add_interface('inyoface', [
+$testconf->add_dumptype('third_dumptype', [
+    '' => 'second_dumptype',
+    'comment' => '"refers to second_dumptype with an underscore"',
+]);
+$testconf->add_interface('ethernet', [
     'comment' => '"mine"',
     'use' => '100',
 ]);
-$testconf->add_interface('inherface', [
+$testconf->add_interface('nic', [
     'comment' => '"empty"',
 ]);
 $testconf->add_holdingdisk('hd1', [
@@ -88,13 +183,38 @@ $testconf->add_holdingdisk('hd1', [
 $testconf->add_holdingdisk('hd2', [
     'comment' => '"empty"',
 ]);
+$testconf->add_application('my_app', [
+    'comment' => '"my_app_comment"',
+    'plugin' => '"amgtar"',
+]);
+$testconf->add_script('my_script', [
+  'comment' => '"my_script_comment"',
+  'plugin' => '"script-email"',
+  'execute-on' => 'pre-host-backup, post-host-backup',
+  'execute-where' => 'client',
+  'property' => '"mailto" "amandabackup" "amanda"',
+]);
+$testconf->add_device('my_device', [
+  'comment' => '"my device is mine, not yours"',
+  'tapedev' => '"tape:/dev/nst0"',
+  'device_property' => '"BLOCK_SIZE" "128k"',
+]);
+$testconf->add_changer('my_changer', [
+  'comment' => '"my changer is mine, not yours"',
+  'tpchanger' => '"chg-foo"',
+  'changerdev' => '"/dev/sg0"',
+  'changerfile' => '"chg.state"',
+]);
+
 $testconf->write();
 
-my $cfg_ok = config_init($CONFIG_INIT_EXPLICIT_NAME, 'TESTCONF');
-ok($cfg_ok, "Load test configuration");
+$cfg_result = config_init($CONFIG_INIT_EXPLICIT_NAME, 'TESTCONF');
+is($cfg_result, $CFGERR_OK,
+    "Load test configuration")
+    or diag_config_errors();
 
 SKIP: {
-    skip "error loading config", unless $cfg_ok;
+    skip "error loading config", 3 unless $cfg_result == $CFGERR_OK;
 
     is(Amanda::Config::get_config_name(), "TESTCONF", 
        "config_name set");
@@ -106,12 +226,12 @@ SKIP: {
 }
 
 SKIP: { # global parameters
-    skip "error loading config", unless $cfg_ok;
+    skip "error loading config", 11 unless $cfg_result == $CFGERR_OK;
 
     is(getconf($CNF_RESERVE), 75,
        "integer global confparm");
-    is(getconf($CNF_BUMPSIZE), $am64_num+0,
-       "am64 global confparm");
+    is(getconf($CNF_BUMPSIZE), $int64_num+0,
+       "int64 global confparm");
     is(getconf($CNF_TAPEDEV), "/dev/foo",
        "string global confparm");
     is(getconf($CNF_DEVICE_OUTPUT_BUFFER_SIZE), $size_t_num+0,
@@ -125,17 +245,18 @@ SKIP: { # global parameters
     is(getconf($CNF_DISPLAYUNIT), "M",
        "displayunit is correctly uppercased");
     is_deeply(getconf($CNF_DEVICE_PROPERTY),
-             { "foo" => "bar", "blue" => "car" },
+             { "foo" => { priority => 0, append => 0, values => ["bar"]},
+               "blue" => { priority => 0, append => 0,
+                           values => ["car", "tar"]} },
            "proplist global confparm");
-
     ok(getconf_seen($CNF_TAPEDEV),
        "'tapedev' parm was seen");
-    ok(!getconf_seen($CNF_NETUSAGE),
-       "'netusage' parm was not seen");
+    ok(!getconf_seen($CNF_CHANGERFILE),
+       "'changerfile' parm was not seen");
 }
 
 SKIP: { # derived values
-    skip "error loading config", unless $cfg_ok;
+    skip "error loading config", 3 unless $cfg_result == $CFGERR_OK;
 
     is(Amanda::Config::getconf_unit_divisor(), 1024, 
        "correct unit divisor (from displayunit -> KB)");
@@ -146,7 +267,7 @@ SKIP: { # derived values
 }
 
 SKIP: { # tapetypes
-    skip "error loading config", unless $cfg_ok;
+    skip "error loading config", 6 unless $cfg_result == $CFGERR_OK;
     my $ttyp = lookup_tapetype("mytapetype");
     ok($ttyp, "found mytapetype");
     is(tapetype_getconf($ttyp, $TAPETYPE_COMMENT), 'mine', 
@@ -165,15 +286,15 @@ SKIP: { # tapetypes
 }
 
 SKIP: { # dumptypes
-    skip "error loading config", unless $cfg_ok;
+    skip "error loading config", 17 unless $cfg_result == $CFGERR_OK;
 
-    my $dtyp = lookup_dumptype("mydumptype");
-    ok($dtyp, "found mydumptype");
+    my $dtyp = lookup_dumptype("mydump-type");
+    ok($dtyp, "found mydump-type");
     is(dumptype_getconf($dtyp, $DUMPTYPE_COMMENT), 'mine', 
        "dumptype string");
     is(dumptype_getconf($dtyp, $DUMPTYPE_PRIORITY), 2, 
        "dumptype priority");
-    is(dumptype_getconf($dtyp, $DUMPTYPE_BUMPSIZE), $am64_num+0,
+    is(dumptype_getconf($dtyp, $DUMPTYPE_BUMPSIZE), $int64_num+0,
        "dumptype size");
     is(dumptype_getconf($dtyp, $DUMPTYPE_BUMPMULT), 1.75,
        "dumptype real");
@@ -199,6 +320,11 @@ SKIP: { # dumptypes
          'list' => [ 'foo', 'bar', 'true', 'star' ],
          'optional' => 0 },
        "dumptype exclude list");
+    is_deeply(dumptype_getconf($dtyp, $DUMPTYPE_PROPERTY),
+             { "prop" => { priority => 0, append => 0, values => ["erty"]},
+               "drop" => { priority => 0, append => 0,
+                           values => ["qwerty", "asdfg"] }},
+           "dumptype proplist");
 
     ok(dumptype_seen($dtyp, $DUMPTYPE_EXCLUDE),
        "'exclude' parm was seen");
@@ -207,7 +333,7 @@ SKIP: { # dumptypes
 
     is_deeply([ sort(+getconf_list("dumptype")) ],
              [ sort(qw(
-               mydumptype
+               mydump-type second_dumptype third_dumptype 
                NO-COMPRESS COMPRESS-FAST COMPRESS-BEST COMPRESS-CUST
                SRVCOMPRESS BSD-AUTH KRB4-AUTH NO-RECORD NO-HOLD
                NO-FULL
@@ -216,30 +342,30 @@ SKIP: { # dumptypes
 }
 
 SKIP: { # interfaces
-    skip "error loading config" unless $cfg_ok;
-    my $iface = lookup_interface("inyoface");
-    ok($iface, "found inyoface");
-    is(interface_name($iface), "inyoface",
+    skip "error loading config", 8 unless $cfg_result == $CFGERR_OK;
+    my $iface = lookup_interface("ethernet");
+    ok($iface, "found ethernet");
+    is(interface_name($iface), "ethernet",
        "interface knows its name");
     is(interface_getconf($iface, $INTER_COMMENT), 'mine', 
        "interface comment");
     is(interface_getconf($iface, $INTER_MAXUSAGE), 100, 
        "interface maxusage");
 
-    $iface = lookup_interface("inherface");
-    ok($iface, "found inherface");
+    $iface = lookup_interface("nic");
+    ok($iface, "found nic");
     ok(interface_seen($iface, $INTER_COMMENT),
        "seen set for parameters that appeared");
     ok(!interface_seen($iface, $INTER_MAXUSAGE),
        "seen not set for parameters that did not appear");
 
     is_deeply([ sort(+getconf_list("interface")) ],
-             [ sort('inyoface', 'inherface', 'default') ],
+             [ sort('ethernet', 'nic', 'default') ],
        "getconf_list lists all interfaces (in any order)");
 }
 
 SKIP: { # holdingdisks
-    skip "error loading config" unless $cfg_ok;
+    skip "error loading config", 13 unless $cfg_result == $CFGERR_OK;
     my $hdisk = lookup_holdingdisk("hd1");
     ok($hdisk, "found hd1");
     is(holdingdisk_name($hdisk), "hd1",
@@ -276,6 +402,101 @@ SKIP: { # holdingdisks
        "getconf_list lists all holdingdisks (in any order)");
 }
 
+SKIP: { # application
+    skip "error loading config", 5 unless $cfg_result == $CFGERR_OK;
+    my $app = lookup_application("my_app");
+    ok($app, "found my_app");
+    is(application_name($app), "my_app",
+       "my_app knows its name");
+    is(application_getconf($app, $APPLICATION_COMMENT), 'my_app_comment', 
+       "application comment");
+    is(application_getconf($app, $APPLICATION_PLUGIN), 'amgtar',
+       "application plugin (amgtar)");
+
+    is_deeply([ sort(+getconf_list("application-tool")) ],
+             [ sort("my_app") ],
+       "getconf_list lists all application-tool");
+}
+
+SKIP: { # script
+    skip "error loading config", 7 unless $cfg_result == $CFGERR_OK;
+    my $sc = lookup_pp_script("my_script");
+    ok($sc, "found my_script");
+    is(pp_script_name($sc), "my_script",
+       "my_script knows its name");
+    is(pp_script_getconf($sc, $PP_SCRIPT_COMMENT), 'my_script_comment', 
+       "script comment");
+    is(pp_script_getconf($sc, $PP_SCRIPT_PLUGIN), 'script-email',
+       "script plugin (script-email)");
+    is(pp_script_getconf($sc, $PP_SCRIPT_EXECUTE_WHERE), $ES_CLIENT,
+       "script execute_where (client)");
+    is(pp_script_getconf($sc, $PP_SCRIPT_EXECUTE_ON),
+       $EXECUTE_ON_PRE_HOST_BACKUP|$EXECUTE_ON_POST_HOST_BACKUP,
+       "script execute_on");
+
+    is_deeply([ sort(+getconf_list("script-tool")) ],
+             [ sort("my_script") ],
+       "getconf_list lists all script-tool");
+}
+
+SKIP: { # device
+    skip "error loading config", 7 unless $cfg_result == $CFGERR_OK;
+    my $dc = lookup_device_config("my_device");
+    ok($dc, "found my_device");
+    is(device_config_name($dc), "my_device",
+       "my_device knows its name");
+    is(device_config_getconf($dc, $DEVICE_CONFIG_COMMENT), 'my device is mine, not yours',
+       "device comment");
+    is(device_config_getconf($dc, $DEVICE_CONFIG_TAPEDEV), 'tape:/dev/nst0',
+       "device tapedev");
+    # TODO do we really need all of this equipment for device properties?
+    is_deeply(device_config_getconf($dc, $DEVICE_CONFIG_DEVICE_PROPERTY),
+          { "BLOCK_SIZE" => { 'priority' => 0, 'values' => ["128k"], 'append' => 0 }, },
+        "device config proplist");
+
+    is_deeply([ sort(+getconf_list("device")) ],
+             [ sort("my_device") ],
+       "getconf_list lists all devices");
+}
+
+SKIP: { # changer
+    skip "error loading config", 7 unless $cfg_result == $CFGERR_OK;
+    my $dc = lookup_changer_config("my_changer");
+    ok($dc, "found my_changer");
+    is(changer_config_name($dc), "my_changer",
+       "my_changer knows its name");
+    is(changer_config_getconf($dc, $CHANGER_CONFIG_COMMENT), 'my changer is mine, not yours',
+       "changer comment");
+    is(changer_config_getconf($dc, $CHANGER_CONFIG_CHANGERDEV), '/dev/sg0',
+       "changer tapedev");
+
+    is_deeply([ sort(+getconf_list("changer")) ],
+             [ sort("my_changer") ],
+       "getconf_list lists all changers");
+}
+
+##
+# Test config overwrites (using the config from above)
+
+$config_overwrites = new_config_overwrites(1); # note estimate is too small
+add_config_overwrite($config_overwrites, "tapedev", "null:TEST");
+add_config_overwrite($config_overwrites, "tpchanger", "chg-test");
+add_config_overwrite_opt($config_overwrites, "org=KAOS");
+apply_config_overwrites($config_overwrites);
+
+is(getconf($CNF_TAPEDEV), "null:TEST",
+    "config overwrites work with real config");
+is(getconf($CNF_ORG), "KAOS",
+    "add_config_overwrite_opt parsed correctly");
+
+# introduce an error
+$config_overwrites = new_config_overwrites(1);
+add_config_overwrite($config_overwrites, "bogusparam", "foo");
+apply_config_overwrites($config_overwrites);
+
+my ($error_level, @errors) = Amanda::Config::config_errors();
+is($error_level, $CFGERR_ERRORS, "bogus config overwrite flagged as an error");
+
 ##
 # Test configuration dumping
 
@@ -288,11 +509,17 @@ if (!$pid) {
     Amanda::Config::dump_configuration();
     exit 1;
 }
-my $dump = join'', <$kid>;
+my $dump_first_line = <$kid>;
+my $dump = join'', $dump_first_line, <$kid>;
 close $kid;
+waitpid $pid, 0;
 
 my $fn = Amanda::Config::get_config_filename();
-like($dump, qr/AMANDA CONFIGURATION FROM FILE "$fn"/,
+my $dump_filename = $dump_first_line;
+chomp $dump_filename;
+$dump_filename =~ s/^# AMANDA CONFIGURATION FROM FILE "//g;
+$dump_filename =~ s/":$//g;
+is($dump_filename, $fn, 
     "config filename is included correctly");
 
 like($dump, qr/DEVICE_PROPERTY\s+"foo" "bar"\n/i,
@@ -319,43 +546,63 @@ like($dump, qr/INCLUDE\s+FILE OPTIONAL "rhyme"/i,
 # We may want to change this, but we should do so intentionally.
 # This is also tested by the 'amgetconf' installcheck.
 
-$testconf = Amconfig->new();
-$testconf->add_dumptype('mydumptype', [
+$testconf = Installcheck::Config->new();
+$testconf->add_dumptype('mydump-type', [
     'exclude list' => '"foo" "bar"',
     'exclude list optional append' => '"true" "star"',
     'exclude list append' => '"true" "star"',
 ]);
 $testconf->write();
 
-$cfg_ok = config_init($CONFIG_INIT_EXPLICIT_NAME, "TESTCONF");
+$cfg_result = config_init($CONFIG_INIT_EXPLICIT_NAME, "TESTCONF");
+is($cfg_result, $CFGERR_OK, 
+    "first exinclude parsing config loaded")
+    or diag_config_errors();
 SKIP: {
-    skip "error loading config", unless $cfg_ok;
+    skip "error loading config", 2 unless $cfg_result == $CFGERR_OK;
 
-    my $dtyp = lookup_dumptype("mydumptype");
-    ok($dtyp, "found mydumptype");
+    my $dtyp = lookup_dumptype("mydump-type");
+    ok($dtyp, "found mydump-type");
     is(dumptype_getconf($dtyp, $DUMPTYPE_EXCLUDE)->{'optional'}, 0,
        "'optional' has no effect when not on the last occurrence");
 }
 
-$testconf = Amconfig->new();
-$testconf->add_dumptype('mydumptype', [
-    'exclude file' => '"foo" "bar"',
-    'exclude file optional append' => '"true" "star"',
-    'exclude list append' => '"true" "star"',
+##
+# Check out where quoting is and is not required.
+
+$testconf = Installcheck::Config->new();
+
+# make sure an unquoted tapetype is OK
+$testconf->add_param('tapetype', 'TEST-TAPE'); # unquoted (Installcheck::Config uses quoted)
+
+# strings can optionally be quoted
+$testconf->add_param('org', '"MyOrg"');
+
+# enumerations (e.g., taperalgo) must not be quoted; implicitly tested above
+
+# definitions
+$testconf->add_dumptype('"parent"', [ # note quotes
+    'bumpsize' => '10240',
+]);
+$testconf->add_dumptype('child', [
+    '' => '"parent"', # note quotes
+]);
+$testconf->add_dumptype('child2', [
+    '' => 'parent',
 ]);
 $testconf->write();
 
-$cfg_ok = config_init($CONFIG_INIT_EXPLICIT_NAME, "TESTCONF");
+$cfg_result = config_init($CONFIG_INIT_EXPLICIT_NAME, "TESTCONF");
+is($cfg_result, $CFGERR_OK,
+    "parsed config to test strings vs. identifiers")
+    or diag_config_errors();
 SKIP: {
-    skip "error loading config", unless $cfg_ok;
-
-    my $dtyp = lookup_dumptype("mydumptype");
-    ok($dtyp, "found mydumptype");
-    is(dumptype_getconf($dtyp, $DUMPTYPE_EXCLUDE)->{'optional'}, 0,
-       "'optional' has no effect when not on the last occurrence of 'file'");
+    skip "error loading config", 3 unless $cfg_result == $CFGERR_OK;
+
+    my $dtyp = lookup_dumptype("parent");
+    ok($dtyp, "found parent");
+    $dtyp = lookup_dumptype("child");
+    ok($dtyp, "found child");
+    is(dumptype_getconf($dtyp, $DUMPTYPE_BUMPSIZE), 10240,
+       "child dumptype correctly inherited bumpsize");
 }
-
-# TODO:
-# overwrites
-# inheritance
-# more init
diff --git a/installcheck/Amanda_DB_Catalog.pl b/installcheck/Amanda_DB_Catalog.pl
new file mode 100644 (file)
index 0000000..a93c48f
--- /dev/null
@@ -0,0 +1,474 @@
+# Copyright (c) 2008 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+# TODO: check large values of 'kb'
+
+use Test::More tests => 35;
+use File::Path;
+use strict;
+
+use lib "@amperldir@";
+use Installcheck::Config;
+use Amanda::Config qw( :init :getconf config_dir_relative );
+use Amanda::DB::Catalog;
+
+# set up and load a simple config
+my $testconf = Installcheck::Config->new();
+$testconf->write();
+config_init($CONFIG_INIT_EXPLICIT_NAME, 'TESTCONF') == $CFGERR_OK
+    or die("Could not load test config");
+
+# test functions against an empty set of logfiles
+
+is_deeply([ Amanda::DB::Catalog::get_write_timestamps() ], [],
+    "No write_timestamps in an empty catalog");
+
+is_deeply(Amanda::DB::Catalog::get_latest_write_timestamp(), undef,
+    "No latest write_timestamp in an empty catalog");
+
+is_deeply([ Amanda::DB::Catalog::get_dumps() ], [],
+    "No dumpfiles in an empty catalog");
+
+# and add some logfiles to query, and a corresponding tapelist, while also gathering
+# a list of dumpfiles for comparison with the results from Amanda::DB::Catalog
+my $logdir = config_dir_relative(getconf($CNF_LOGDIR));
+my $tapelist_fn = config_dir_relative(getconf($CNF_TAPELIST));
+my $output;
+my $write_timestamp;
+my %dumpfiles;
+open (my $tapelist, ">", $tapelist_fn);
+while (<DATA>) {
+    # skip comments
+    next if (/^#/ or /^\S*$/);
+
+    # add to tapelist
+    if (/^:tapelist (\d+) (\S+)\s*$/) {
+       print $tapelist "$1 $2 reuse\n";
+       next;
+    }
+    
+    # new logfile
+    if (/^::: (.*)/) {
+       open $output, ">", "$logdir/$1" or die("Could not open $1 for writing: $!");
+       next;
+    }
+
+    # write_timestamp
+    if (/^:timestamp (\d+)/) {
+       $write_timestamp = $1;
+       next;
+    }
+
+    # new dumpfile
+    if (/^:dumpfile (\S+) (\S+) (\S+) (\S+) (\d+) (\S+) (\d+) (\d+) (\d+) (\S+) (\S+) (\d+)/) {
+       $dumpfiles{$1} = {
+           'dump_timestamp' => $2,     'hostname' => $3,           'diskname' => $4,
+           'level' => $5+0,            'label' => $6,              'filenum' => $7+0,
+           'partnum' => $8+0,          'nparts' => $9+0,           'status' => $10,
+           'sec' => $11+0.0,           'kb' => $12+0,
+           'write_timestamp' => $write_timestamp,
+       };
+       next;
+    }
+
+    die("syntax error") if (/^:/);
+
+    print $output $_;
+}
+close($output);
+close($tapelist);
+Amanda::DB::Catalog::_clear_cache();
+
+##
+# Test the timestamps
+
+is_deeply([ Amanda::DB::Catalog::get_write_timestamps(), ],
+    [ '20080111000000', '20080222222222', '20080313133333', '20080414144444' ],
+    "get_write_timestamps returns all logfile datestamps in proper order, with zero-padding");
+
+is(Amanda::DB::Catalog::get_latest_write_timestamp(), '20080414144444',
+    "get_latest_write_timestamp correctly returns the latest write timestamp");
+
+##
+# test get_dumps and sort_dumps
+
+# get dumps filtered by a regexp on the key
+sub dump_names($) {
+    my ($expr) = @_; 
+    my @selected_keys = grep { $_ =~ $expr } keys %dumpfiles;
+    return map { $dumpfiles{$_} } @selected_keys;
+}
+
+# get dumps filtered by an expression on the dumpfile itself
+sub dumps(&) {
+    my ($block) = @_; 
+    return grep { &$block } values %dumpfiles;
+}
+
+# put @_ in a canonical order
+sub sortdumps {
+    map {
+       # convert bigints to strings so is_deeply doesn't get confused
+       $_->{'level'} = "$_->{level}";
+       $_->{'filenum'} = "$_->{filenum}";
+       $_->{'kb'} = "$_->{kb}";
+       $_;
+    } sort {
+       $a->{'label'} cmp $b->{'label'}
+           or $a->{'filenum'} cmp $b->{'filenum'}
+    }
+    @_;
+}
+
+is_deeply([ sortdumps Amanda::DB::Catalog::get_dumps() ],
+    [ sortdumps dump_names qr/.*/ ],
+    "get_dumps returns all dumps when given no parameters");
+
+is_deeply([ sortdumps Amanda::DB::Catalog::get_dumps(write_timestamp => '20080111000000') ],
+    [ sortdumps dump_names qr/somebox_lib_20080111/ ],
+    "get_dumps parameter write_timestamp");
+is_deeply([ sortdumps Amanda::DB::Catalog::get_dumps(write_timestamp => '20080111') ],
+    [ sortdumps dump_names qr/somebox_lib_20080111/ ],
+    "get_dumps accepts a short write_timestamp and zero-pads it");
+is_deeply([ sortdumps Amanda::DB::Catalog::get_dumps(write_timestamps => ['20080111000000','20080222222222']) ],
+    [ sortdumps dump_names qr/(20080111|20080222222222)$/ ],
+    "get_dumps parameter write_timestamps");
+
+is_deeply([ sortdumps Amanda::DB::Catalog::get_dumps(dump_timestamp => '20080111000000') ],
+    [ sortdumps dump_names qr/somebox_lib_20080111/ ],
+    "get_dumps parameter dump_timestamp");
+is_deeply([ sortdumps Amanda::DB::Catalog::get_dumps(dump_timestamp => '20080111') ],
+    [ sortdumps dump_names qr/somebox_lib_20080111/ ],
+    "get_dumps accepts a short dump_timestamp and zero-pads it");
+is_deeply([ sortdumps Amanda::DB::Catalog::get_dumps(dump_timestamps => ['20080111000000','20080222222222']) ],
+    [ sortdumps dump_names qr/(20080111|20080222222222)$/ ],
+    "get_dumps parameter dump_timestamps");
+is_deeply([ sortdumps Amanda::DB::Catalog::get_dumps(dump_timestamp_match => '200801-2') ],
+    [ sortdumps dump_names qr/20080[12]/ ],
+    "get_dumps parameter dump_timestamp_match");
+
+is_deeply([ sortdumps Amanda::DB::Catalog::get_dumps(hostname => 'otherbox') ],
+    [ sortdumps dump_names qr/^otherbox_/ ],
+    "get_dumps parameter hostname");
+is_deeply([ sortdumps Amanda::DB::Catalog::get_dumps(hostnames => ['otherbox','somebox']) ],
+    [ sortdumps dump_names qr/^(otherbox_|somebox_)/ ],
+    "get_dumps parameter hostnames");
+is_deeply([ sortdumps Amanda::DB::Catalog::get_dumps(hostname_match => '*box') ],
+    [ sortdumps dump_names qr/box/ ],
+    "get_dumps parameter hostname_match");
+
+is_deeply([ sortdumps Amanda::DB::Catalog::get_dumps(diskname => '/lib') ],
+    [ sortdumps dump_names qr/_lib_/ ],
+    "get_dumps parameter diskname");
+is_deeply([ sortdumps Amanda::DB::Catalog::get_dumps(disknames => ['/lib','/usr/bin']) ],
+    [ sortdumps dump_names qr/(_lib_|_usr_bin_)/ ],
+    "get_dumps parameter disknames");
+is_deeply([ sortdumps Amanda::DB::Catalog::get_dumps(diskname_match => '/usr') ],
+    [ sortdumps dump_names qr/_usr_/ ],
+    "get_dumps parameter diskname_match");
+
+is_deeply([ sortdumps Amanda::DB::Catalog::get_dumps(label => 'Conf-001') ],
+    [ sortdumps dumps { $_->{'label'} eq 'Conf-001' } ],
+    "get_dumps parameter label");
+is_deeply([ sortdumps Amanda::DB::Catalog::get_dumps(labels => ['Conf-002','Conf-003']) ],
+    [ sortdumps dumps { $_->{'label'} eq 'Conf-002' or $_->{'label'} eq 'Conf-003' } ],
+    "get_dumps parameter labels");
+
+is_deeply([ sortdumps Amanda::DB::Catalog::get_dumps(level => 0) ],
+    [ sortdumps dumps { $_->{'level'} == 0 } ],
+    "get_dumps parameter level");
+is_deeply([ sortdumps Amanda::DB::Catalog::get_dumps(levels => [ 1 ]) ],
+    [ sortdumps dumps { $_->{'level'} == 1 } ],
+    "get_dumps parameter levels");
+
+is_deeply([ sortdumps Amanda::DB::Catalog::get_dumps(status => "OK") ],
+    [ sortdumps dumps { $_->{'status'} eq "OK" } ],
+    "get_dumps parameter status = OK");
+
+is_deeply([ sortdumps Amanda::DB::Catalog::get_dumps(status => "PARTIAL") ],
+    [ sortdumps dumps { $_->{'status'} eq "PARTIAL" } ],
+    "get_dumps parameter status = PARTIAL");
+
+## more complex, multi-parameter queries
+
+is_deeply([ sortdumps Amanda::DB::Catalog::get_dumps(hostname => 'somebox',
+                                                    diskname_match => '/lib') ],
+    [ sortdumps dump_names qr/^somebox_lib_/ ],
+    "get_dumps parameters hostname and diskname_match");
+
+is_deeply([ sortdumps Amanda::DB::Catalog::get_dumps(write_timestamp => '20080313133333',
+                                                    dump_timestamp => '20080311131133') ],
+    [ sortdumps dumps { $_->{'dump_timestamp'} eq '20080311131133' 
+                    and $_->{'write_timestamp'} eq '20080313133333' } ],
+    "get_dumps parameters write_timestamp and dump_timestamp");
+
+is_deeply([ sortdumps Amanda::DB::Catalog::get_dumps(write_timestamp => '20080414144444',
+                                                    status => 'OK') ],
+    [ ], # there were no OK dumps on that date
+    "get_dumps parameters write_timestamp status");
+
+## test sorting
+# (this is not exhaustive, as that would make the tests more complex than the
+#  code being tested)
+
+is_deeply([ Amanda::DB::Catalog::sort_dumps(['write_timestamp'],
+               @dumpfiles{'somebox_lib_20080222222222','somebox_lib_20080111'}) ],
+             [ @dumpfiles{'somebox_lib_20080111','somebox_lib_20080222222222'} ],
+    "sort by write_timestamps");
+is_deeply([ Amanda::DB::Catalog::sort_dumps(['-write_timestamp'],
+               @dumpfiles{'somebox_lib_20080111','somebox_lib_20080222222222'}) ],
+             [ @dumpfiles{'somebox_lib_20080222222222','somebox_lib_20080111'} ],
+    "sort by write_timestamps, reverse");
+
+is_deeply([ Amanda::DB::Catalog::sort_dumps(['hostname', '-diskname', 'write_timestamp'],
+               @dumpfiles{
+                   'somebox_lib_20080222222222',
+                   'somebox_usr_bin_20080313133333',
+                   'somebox_lib_20080313133333_p4',
+                   'otherbox_lib_20080313133333',
+                   'somebox_lib_20080111',
+                   }) ],
+             [ @dumpfiles{
+                   'otherbox_lib_20080313133333',
+                   'somebox_usr_bin_20080313133333',
+                   'somebox_lib_20080111',
+                   'somebox_lib_20080222222222',
+                   'somebox_lib_20080313133333_p4',
+                   } ],
+    "multi-key sort");
+
+## add log entries
+
+# one to an existing logfile, same tape
+Amanda::DB::Catalog::add_dump({
+    'write_timestamp' => '20080111',
+    'dump_timestamp' => '20080707070707',
+    'hostname' => 'newbox',
+    'diskname' => '/newdisk',
+    'level' => 3,
+    'label' => 'Conf-001',
+    'filenum' => 2,
+    'partnum' => 1,
+    'nparts' => 1,
+    'status' => 'OK',
+    'sec' => 13.0,
+    'kb' => 12380,
+});
+
+is_deeply([ sortdumps Amanda::DB::Catalog::get_dumps(hostname => 'newbox') ],
+    [ sortdumps {
+       'write_timestamp' => '20080111000000',
+       'dump_timestamp' => '20080707070707',
+       'hostname' => 'newbox',
+       'diskname' => '/newdisk',
+       'level' => 3,
+       'label' => 'Conf-001',
+       'filenum' => 2,
+       'partnum' => 1,
+       'nparts' => 1,
+       'status' => 'OK',
+       'sec' => 13.0,
+       'kb' => 12380,
+    } ],
+    "successfully re-read an added dump in an existing logfile");
+
+# and again, to test the last-logfile cache in Amanda::DB::Catalog
+Amanda::DB::Catalog::add_dump({
+    'write_timestamp' => '20080111',
+    'dump_timestamp' => '20080707070707',
+    'hostname' => 'newbox',
+    'diskname' => '/newdisk2',
+    'level' => 0,
+    'label' => 'Conf-001',
+    'filenum' => 3,
+    'partnum' => 1,
+    'nparts' => 1,
+    'status' => 'OK',
+    'sec' => 27.0,
+    'kb' => 32380,
+});
+
+is(scalar Amanda::DB::Catalog::get_dumps(hostname => 'newbox'), 2,
+    "adding another dump to that logfile and re-reading gives 2 dumps");
+
+# and another in a new file, as well as a tapelist entry
+Amanda::DB::Catalog::add_dump({
+    'write_timestamp' => '20080707070707',
+    'dump_timestamp' => '20080707070707',
+    'hostname' => 'newlog',
+    'diskname' => '/newdisk',
+    'level' => 3,
+    'label' => 'Conf-009',
+    'filenum' => 1,
+    'partnum' => 1,
+    'nparts' => 1,
+    'status' => 'OK',
+    'sec' => 13.0,
+    'kb' => 12380,
+});
+
+is_deeply([ sortdumps Amanda::DB::Catalog::get_dumps(hostname => 'newlog') ],
+    [ sortdumps {
+       'write_timestamp' => '20080707070707',
+       'dump_timestamp' => '20080707070707',
+       'hostname' => 'newlog',
+       'diskname' => '/newdisk',
+       'level' => 3,
+       'label' => 'Conf-009',
+       'filenum' => 1,
+       'partnum' => 1,
+       'nparts' => 1,
+       'status' => 'OK',
+       'sec' => 13.0,
+       'kb' => 12380,
+    } ],
+    "successfully re-read an added dump in a new logfile");
+
+# and add a multipart dump to that same logfile
+for (my $i = 1; $i <= 5; $i++) {
+    Amanda::DB::Catalog::add_dump({
+       'write_timestamp' => '20080707070707',
+       'dump_timestamp' => '20080707070707',
+       'hostname' => 'newlog',
+       'diskname' => '/bigdisk',
+       'level' => 1,
+       'label' => 'Conf-009',
+       'filenum' => $i+1,
+       'partnum' => $i,
+       'nparts' => 5,
+       'status' => 'OK',
+       'sec' => 13.0,
+       'kb' => 12380,
+    });
+}
+
+is(scalar Amanda::DB::Catalog::get_dumps(diskname => '/bigdisk'), 5,
+    "multi-part dump added and re-read successfully");
+
+__DATA__
+# a short-datestamp logfile with only a single, single-part file in it
+::: log.20080111.0
+:tapelist 20080111 Conf-001
+:timestamp 20080111000000
+DISK planner somebox /lib
+START planner date 20080111
+START driver date 20080111
+STATS driver hostname somebox
+STATS driver startup time 0.051
+FINISH planner date 20080111 time 82.721
+START taper datestamp 20080111 label Conf-001 tape 1
+SUCCESS dumper somebox /lib 20080111 0 [sec 0.209 kb 1970 kps 9382.2 orig-kb 1970]
+SUCCESS chunker somebox /lib 20080111 0 [sec 0.305 kb 420 kps 1478.7]
+STATS driver estimate somebox /lib 20080111 0 [sec 1 nkb 2002 ckb 480 kps 385]
+:dumpfile somebox_lib_20080111 20080111000000 somebox /lib 0 Conf-001 1 1 1 OK 4.813543 419
+PART taper Conf-001 1 somebox /lib 20080111 1/1 0 [sec 4.813543 kb 419 kps 87.133307]
+DONE taper somebox /lib 20080111 1 0 [sec 4.813543 kb 419 kps 87.133307]
+FINISH driver date 20080111 time 2167.581
+
+# a long-datestamp logfile, also fairly simple
+::: log.20080222222222.0
+:tapelist 20080222222222 Conf-002
+:timestamp 20080222222222
+DISK planner somebox /lib
+START planner date 20080222222222
+START driver date 20080222222222
+STATS driver hostname somebox
+STATS driver startup time 0.051
+FINISH planner date 20080222222222 time 0.102
+SUCCESS dumper somebox /lib 20080222222222 0 [sec 0.012 kb 100 kps 8115.6 orig-kb 100]
+SUCCESS chunker somebox /lib 20080222222222 0 [sec 5.075 kb 100 kps 26.0]
+STATS driver estimate somebox /lib 20080222222222 0 [sec 0 nkb 132 ckb 160 kps 1024]
+START taper datestamp 20080222222222 label Conf-002 tape 1
+:dumpfile somebox_lib_20080222222222 20080222222222 somebox /lib 0 Conf-002 1 1 1 OK 0.000733 100
+PART taper Conf-002 1 somebox /lib 20080222222222 1/1 0 [sec 0.000733 kb 100 kps 136425.648022]
+DONE taper somebox /lib 20080222222222 1 0 [sec 0.000733 kb 100 kps 136425.648022]
+FINISH driver date 20080222222222 time 6.206
+
+# a logfile with several dumps in it, one of which comes in many parts, and one of which is
+# from a previous run
+::: log.20080313133333.0
+:tapelist 20080313133333 Conf-003
+:timestamp 20080313133333
+DISK planner somebox /usr/bin
+DISK planner somebox /lib
+DISK planner otherbox /lib
+DISK planner otherbox /usr/bin
+START planner date 20080313133333
+START driver date 20080313133333
+STATS driver hostname somebox
+STATS driver startup time 0.059
+INFO planner Full dump of somebox:/lib promoted from 2 days ahead.
+FINISH planner date 20080313133333 time 0.286
+SUCCESS dumper somebox /usr/bin 20080313133333 1 [sec 0.001 kb 20 kps 10352.0 orig-kb 20]
+SUCCESS chunker somebox /usr/bin 20080313133333 1 [sec 1.023 kb 20 kps 50.8]
+STATS driver estimate somebox /usr/bin 20080313133333 1 [sec 0 nkb 52 ckb 64 kps 1024]
+START taper datestamp 20080313133333 label Conf-003 tape 1
+:dumpfile somebox_usr_bin_20080313133333 20080313133333 somebox /usr/bin 1 Conf-003 1 1 1 OK 0.000370 20
+PART taper Conf-003 1 somebox /usr/bin 20080313133333 1/1 1 [sec 0.000370 kb 20 kps 54054.054054]
+DONE taper somebox /usr/bin 20080313133333 1 1 [sec 0.000370 kb 20 kps 54054.054054]
+# a multi-part dump
+SUCCESS dumper somebox /lib 20080313133333 0 [sec 0.189 kb 3156 kps 50253.1 orig-kb 3156]
+SUCCESS chunker somebox /lib 20080313133333 0 [sec 5.250 kb 3156 kps 1815.5]
+STATS driver estimate somebox /lib 20080313133333 0 [sec 1 nkb 3156 ckb 3156 kps 9500]
+:dumpfile somebox_lib_20080313133333_p1 20080313133333 somebox /lib 0 Conf-003 2 1 4 OK 0.005621 1024
+PART taper Conf-003 2 somebox /lib 20080313133333 1/4 0 [sec 0.005621 kb 1024 kps 182173.990393]
+:dumpfile somebox_lib_20080313133333_p2 20080313133333 somebox /lib 0 Conf-003 3 2 4 OK 0.006527 1024
+PART taper Conf-003 3 somebox /lib 20080313133333 2/4 0 [sec 0.006527 kb 1024 kps 156886.777999]
+:dumpfile somebox_lib_20080313133333_p3 20080313133333 somebox /lib 0 Conf-003 4 3 4 OK 0.005854 1024
+PART taper Conf-003 4 somebox /lib 20080313133333 3/4 0 [sec 0.005854 kb 1024 kps 174923.129484]
+:dumpfile somebox_lib_20080313133333_p4 20080313133333 somebox /lib 0 Conf-003 5 4 4 OK 0.001919 284
+PART taper Conf-003 5 somebox /lib 20080313133333 4/4 0 [sec 0.001919 kb 284 kps 147993.746743]
+DONE taper somebox /lib 20080313133333 10 0 [sec 0.051436 kb 3156 kps 184695.543977]
+SUCCESS dumper otherbox /lib 20080313133333 0 [sec 0.001 kb 190 kps 10352.0 orig-kb 20]
+SUCCESS chunker otherbox /lib 20080313133333 0 [sec 1.023 kb 190 kps 50.8]
+STATS driver estimate otherbox /lib 20080313133333 0 [sec 0 nkb 190 ckb 190 kps 1024]
+# this dump is from a previous run, with an older dump_timestamp
+:dumpfile otherbox_usr_bin_20080313133333 20080311131133 otherbox /usr/bin 0 Conf-003 6 1 1 OK 0.002733 240
+PART taper Conf-003 6 otherbox /usr/bin 20080311131133 1/1 0 [sec 0.002733 kb 240 kps 136425.648022]
+:dumpfile otherbox_lib_20080313133333 20080313133333 otherbox /lib 0 Conf-003 7 1 1 OK 0.001733 190
+PART taper Conf-003 7 otherbox /lib 20080313133333 1/1 0 [sec 0.001733 kb 190 kps 136425.648022]
+DONE taper otherbox /lib 20080313133333 1 0 [sec 0.001733 kb 190 kps 136425.648022]
+FINISH driver date 20080313133333 time 24.777
+
+# A logfile with some partial parts (PARTPARTIAL) in it
+::: log.20080414144444.0
+:tapelist 20080414144444 Conf-004
+:tapelist 20080414144444 Conf-005
+:timestamp 20080414144444
+DISK planner otherbox /lib
+START planner date 20080414144444
+START driver date 20080414144444
+STATS driver hostname otherbox
+STATS driver startup time 0.075
+INFO taper Will write new label `Conf-004' to new (previously non-amanda) tape
+FINISH planner date 20080414144444 time 2.139
+SUCCESS dumper otherbox /lib 20080414144444 1 [sec 0.003 kb 60 kps 16304.3 orig-kb 60]
+SUCCESS chunker otherbox /lib 20080414144444 1 [sec 1.038 kb 60 kps 88.5]
+STATS driver estimate otherbox /lib 20080414144444 1 [sec 0 nkb 92 ckb 96 kps 1024]
+START taper datestamp 20080414144444 label Conf-004 tape 1
+:dumpfile otherbox_lib_20080414144444_try1 20080414144444 otherbox /lib 1 Conf-004 1 1 1 PARTIAL 0.000707 32
+PARTPARTIAL taper Conf-004 1 otherbox /lib 20080414144444 1/1 1 [sec 0.000707 kb 32 kps 45261.669024] ""
+INFO taper Will request retry of failed split part.
+INFO taper Will write new label `Conf-005' to new (previously non-amanda) tape
+START taper datestamp 20080414144444 label Conf-005 tape 2
+:dumpfile otherbox_lib_20080414144444_try2 20080414144444 otherbox /lib 1 Conf-005 1 1 1 PARTIAL 0.000540 32
+PARTPARTIAL taper Conf-005 1 otherbox /lib 20080414144444 1/1 1 [sec 0.000540 kb 32 kps 59259.259259] ""
+INFO taper Will request retry of failed split part.
+WARNING driver Out of tapes; going into degraded mode.
+PARTIAL taper otherbox /lib 20080414144444 1 1 [sec 0.000540 kb 32 kps 59259.259259] ""
+FINISH driver date 20080414144444 time 6.959
diff --git a/installcheck/Amanda_Debug.pl b/installcheck/Amanda_Debug.pl
new file mode 100644 (file)
index 0000000..8737290
--- /dev/null
@@ -0,0 +1,94 @@
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+use Test::More tests => 9;
+use File::Path;
+use strict;
+
+use lib "@amperldir@";
+use Amanda::Debug;
+
+## most failures of the debug module will just kill the process, so
+## the main goal of this test script is just to make it to the end :)
+
+my $fh;
+my $debug_text;
+my $pid;
+my $kid;
+
+# set up debugging so debug output doesn't interfere with test results
+Amanda::Debug::dbopen("installcheck");
+Amanda::Debug::dbrename("TESTCONF", "installcheck");
+
+# and disable Debug's die() and warn() overrides
+Amanda::Debug::disable_die_override();
+
+my $debug_fd = Amanda::Debug::dbfd();
+ok($debug_fd, "dbfd() returns something nonzero");
+
+my $debug_file = Amanda::Debug::dbfn();
+ok(-f $debug_file, "dbfn() returns a filename that exists");
+
+Amanda::Debug::debug('debug message');
+Amanda::Debug::info('info message');
+Amanda::Debug::message('message message');
+Amanda::Debug::warning('warning message');
+
+Amanda::Debug::dbclose();
+
+open ($fh, "<", $debug_file);
+$debug_text = do { local $/; <$fh> };
+close($fh);
+
+like($debug_text, qr/debug message/, "debug message is in debug log file");
+like($debug_text, qr/info message/, "info message is in debug log file");
+like($debug_text, qr/message message/, "message message is in debug log file");
+like($debug_text, qr/warning message/, "warning message is in debug log file");
+
+Amanda::Debug::dbreopen($debug_file, "oops, one more thing");
+Amanda::Debug::dbclose();
+
+open ($fh, "<", $debug_file);
+$debug_text = do { local $/; <$fh> };
+close($fh);
+
+like($debug_text, qr/warning message/, "dbreopen doesn't erase existing contents");
+like($debug_text, qr/oops, one more thing/, "dbreopen adds 'notation' to the debug log");
+
+Amanda::Debug::dbreopen($debug_file, "I've still got more stuff to test");
+
+# fork a child to call error()
+$pid = open($kid, "-|");
+die "Can't fork: $!" unless defined($pid);
+if (!$pid) {
+    $Amanda::Debug::erroutput_type = 0; # don't spew to stderr, too, please
+    Amanda::Debug::critical("morituri te salutamus");
+    exit 1; # just in case
+}
+close $kid;
+waitpid $pid, 0;
+
+# just hope this works -- Perl makes it very difficult to write to fd 2!
+Amanda::Debug::debug_dup_stderr_to_debug();
+Amanda::Debug::dbclose();
+
+open ($fh, "<", $debug_file);
+$debug_text = do { local $/; <$fh> };
+close($fh);
+
+like($debug_text, qr/morituri te salutamus/, "critical() writes its message to the debug log");
diff --git a/installcheck/Amanda_Device.pl b/installcheck/Amanda_Device.pl
new file mode 100644 (file)
index 0000000..d4c8454
--- /dev/null
@@ -0,0 +1,733 @@
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+use Test::More tests => 301;
+use File::Path qw( mkpath rmtree );
+use Sys::Hostname;
+use Carp;
+use strict;
+
+use lib "@amperldir@";
+use Installcheck::Config;
+use Amanda::Debug;
+use Amanda::Device qw( :constants );
+use Amanda::Config qw( :getconf :init );
+use Amanda::Types;
+use Amanda::Paths;
+use Amanda::Tests;
+
+my $dev;
+my $dev_name;
+my ($vtape1, $vtape2);
+my ($input_filename, $output_filename) =
+    ( "$AMANDA_TMPDIR/input.tmp", "$AMANDA_TMPDIR/output.tmp" );
+my $taperoot = "$AMANDA_TMPDIR/Amanda_Device_test_tapes";
+my $testconf;
+my $queue_fd;
+
+# we'll need some vtapes..
+sub mkvtape {
+    my ($num) = @_;
+
+    my $mytape = "$taperoot/$num";
+    if (-d $mytape) { rmtree($mytape); }
+    mkpath("$mytape/data");
+    return $mytape;
+}
+
+
+# make up a fake dumpfile_t to write with
+my $dumpfile = Amanda::Types::dumpfile_t->new();
+$dumpfile->{type} = $Amanda::Types::F_DUMPFILE;
+$dumpfile->{datestamp} = "20070102030405";
+$dumpfile->{dumplevel} = 0;
+$dumpfile->{compressed} = 1;
+$dumpfile->{name} = "localhost";
+$dumpfile->{disk} = "/home";
+$dumpfile->{program} = "INSTALLCHECK";
+
+# function to set up a queue_fd for a filename
+sub make_queue_fd {
+    my ($filename, $mode) = @_;
+
+    open(my $fd, $mode, $filename) or die("Could not open $filename: $!");
+    return $fd, Amanda::Device::queue_fd_t->new(fileno($fd));
+}
+
+my $write_file_count = 5;
+sub write_file {
+    my ($seed, $length, $filenum) = @_;
+
+    croak ("selected file size $length is *way* too big")
+       unless ($length < 1024*1024*10);
+    Amanda::Tests::write_random_file($seed, $length, $input_filename);
+
+    ok($dev->start_file($dumpfile),
+       "start file $filenum")
+       or diag($dev->error_or_status());
+
+    is($dev->file(), $filenum,
+       "Device has correct filenum");
+
+    my ($input, $queue_fd) = make_queue_fd($input_filename, "<");
+    ok($dev->write_from_fd($queue_fd),
+       "write some data")
+       or diag($dev->error_or_status());
+    close($input) or die("Error closing $input_filename");
+
+    if(ok($dev->in_file(),
+       "still in_file")) {
+       ok($dev->finish_file(),
+           "finish_file")
+           or diag($dev->error_or_status());
+    } else {
+       pass("not in file, so not calling finish_file");
+    }
+}
+
+my $verify_file_count = 5;
+sub verify_file {
+    my ($seed, $length, $filenum) = @_;
+
+    ok(my $read_dumpfile = $dev->seek_file($filenum),
+       "seek to file $filenum")
+       or diag($dev->error_or_status());
+    is($dev->file(), $filenum,
+       "device is really at file $filenum");
+    is($read_dumpfile->{name}, "localhost",
+       "header looks vaguely familiar")
+       or diag($dev->error_or_status());
+
+    my ($output, $queue_fd) = make_queue_fd($output_filename, ">");
+    ok($dev->read_to_fd($queue_fd),
+       "read data from file $filenum")
+       or diag($dev->error_or_status());
+    close($output) or die("Error closing $output_filename");
+
+    ok(Amanda::Tests::verify_random_file($seed, $length, $output_filename, 0),
+       "verified file contents");
+}
+
+# properties test
+
+my @common_properties = (
+    'appendable',
+    'block_size',
+    'canonical_name',
+    'concurrency',
+    'max_block_size',
+    'medium_access_type',
+    'min_block_size',
+    'partial_deletion',
+    'streaming',
+);
+
+sub properties_include {
+    my ($got, $should_include, $msg) = @_;
+    my %got = map { $_->{'name'}, 1 } @$got;
+    my @missing = grep { !defined($got{$_}) } @$should_include;
+    if (@missing) {
+       fail($msg);
+       diag(" Expected properties: " . join(", ", @$should_include));
+       diag("      Got properties: " . join(", ", @$got));
+       diag("  Missing properties: " . join(", ", @missing));
+    } else {
+       pass($msg);
+    }
+}
+
+####
+## get stuff set up
+
+$testconf = Installcheck::Config->new();
+$testconf->write();
+config_init($CONFIG_INIT_EXPLICIT_NAME, 'TESTCONF') == $CFGERR_OK
+    or die("Could not load configuration");
+
+# put the debug messages somewhere
+Amanda::Debug::dbopen("installcheck");
+
+####
+## Test errors a little bit
+
+$dev = Amanda::Device->new("foobar:");
+isnt($dev->status(), $DEVICE_STATUS_SUCCESS,
+    "creation of a bogus 'foobar:' device fails");
+
+$dev = Amanda::Device->new("rait:{{");
+isnt($dev->status(), $DEVICE_STATUS_SUCCESS,
+    "creation of a bogus 'rait:{{' device fails");
+
+$dev = Amanda::Device->new("rait:{a,b");
+isnt($dev->status(), $DEVICE_STATUS_SUCCESS,
+    "creation of a bogus 'rait:{a,b' device fails");
+
+####
+## first, test out the 'null' device.
+
+$dev_name = "null:";
+
+$dev = Amanda::Device->new($dev_name);
+is($dev->status(), $DEVICE_STATUS_SUCCESS,
+    "create null device")
+    or diag $dev->error_or_status();
+ok($dev->start($ACCESS_WRITE, "NULL1", "19780615010203"),
+    "start null device in write mode")
+    or diag $dev->error_or_status();
+
+# try properties
+properties_include([ $dev->property_list() ], [ @common_properties ],
+    "necessary properties listed on null device");
+is($dev->property_get("canonical_name"), "null:",
+    "property_get(canonical_name) on null device");
+is($dev->property_get("caNONical-name"), "null:",
+    "property_get(caNONical-name) on null device (case, dash-insensitivity)");
+is_deeply([ $dev->property_get("canonical_name") ],
+    [ "null:", $PROPERTY_SURETY_GOOD, $PROPERTY_SOURCE_DEFAULT ],
+    "extended property_get returns correct surety/source");
+for my $prop ($dev->property_list()) {
+    next unless $prop->{'name'} eq 'canonical_name';
+    is($prop->{'description'},
+       "The most reliable device name to use to refer to this device.",
+       "property info for canonical name is correct");
+}
+
+# and write a file to it
+write_file(0xabcde, 1024*256, 1);
+
+# (don't finish the device, testing the finalize method's cleanup)
+
+####
+## Now some full device tests
+
+## VFS device
+
+$vtape1 = mkvtape(1);
+$dev_name = "file:$vtape1";
+
+$dev = Amanda::Device->new($dev_name);
+is($dev->status(), $DEVICE_STATUS_SUCCESS,
+    "$dev_name: create successful")
+    or diag($dev->error_or_status());
+
+properties_include([ $dev->property_list() ],
+    [ @common_properties, 'max_volume_usage' ],
+    "necessary properties listed on vfs device");
+
+$dev->read_label();
+ok($dev->status() & $DEVICE_STATUS_VOLUME_UNLABELED,
+    "initially unlabeled")
+    or diag($dev->error_or_status());
+
+ok($dev->start($ACCESS_WRITE, "TESTCONF13", undef),
+    "start in write mode")
+    or diag($dev->error_or_status());
+
+ok(!($dev->status() & $DEVICE_STATUS_VOLUME_UNLABELED),
+    "not unlabeled anymore")
+    or diag($dev->error_or_status());
+
+for (my $i = 1; $i <= 3; $i++) {
+    write_file(0x2FACE, $dev->block_size()*10+17, $i);
+}
+
+ok($dev->finish(),
+    "finish device after write")
+    or diag($dev->error_or_status());
+
+$dev->read_label();
+ok(!($dev->status()),
+    "no error, at all, from read_label")
+    or diag($dev->error_or_status());
+
+# append one more copy, to test ACCESS_APPEND
+
+ok($dev->start($ACCESS_APPEND, undef, undef),
+    "start in append mode")
+    or diag($dev->error_or_status());
+
+write_file(0xD0ED0E, $dev->block_size()*4, 4);
+
+ok($dev->finish(),
+    "finish device after append")
+    or diag($dev->error_or_status());
+
+# try reading the third file back, creating a new device
+# object first, and skipping the read-label step.
+
+$dev = undef;
+$dev = Amanda::Device->new($dev_name);
+is($dev->status(), $DEVICE_STATUS_SUCCESS,
+    "$dev_name: re-create successful")
+    or diag($dev->error_or_status());
+
+ok($dev->start($ACCESS_READ, undef, undef),
+    "start in read mode")
+    or diag($dev->error_or_status());
+
+verify_file(0x2FACE, $dev->block_size()*10+17, 3);
+
+ok($dev->finish(),
+    "finish device after read")
+    or diag($dev->error_or_status());
+
+####
+## Test a RAIT device of two vfs devices.
+
+($vtape1, $vtape2) = (mkvtape(1), mkvtape(2));
+$dev_name = "rait:file:{$vtape1,$vtape2}";
+
+$dev = Amanda::Device->new($dev_name);
+is($dev->status(), $DEVICE_STATUS_SUCCESS,
+   "$dev_name: create successful")
+    or diag($dev->error_or_status());
+
+ok($dev->configure(1), "configure device");
+
+properties_include([ $dev->property_list() ], [ @common_properties ],
+    "necessary properties listed on rait device");
+
+is($dev->property_get("block_size"), 32768, # (RAIT default)
+    "rait device calculates a default block size correctly");
+
+ok($dev->property_set("block_size", 32768*16),
+    "rait device accepts an explicit block size");
+
+is($dev->property_get("block_size"), 32768*16,
+    "..and remembers it");
+
+$dev->read_label();
+ok($dev->status() & $DEVICE_STATUS_VOLUME_UNLABELED,
+   "initially unlabeled")
+    or diag($dev->error_or_status());
+
+ok($dev->start($ACCESS_WRITE, "TESTCONF13", undef),
+   "start in write mode")
+    or diag($dev->error_or_status());
+
+ok(!($dev->status() & $DEVICE_STATUS_VOLUME_UNLABELED),
+   "not unlabeled anymore")
+    or diag($dev->error_or_status());
+
+for (my $i = 1; $i <= 3; $i++) {
+    write_file(0x2FACE, $dev->block_size()*10+17, $i);
+}
+
+ok($dev->finish(),
+   "finish device after write")
+    or diag($dev->error_or_status());
+
+$dev->read_label();
+ok(!($dev->status()),
+   "no error, at all, from read_label")
+    or diag($dev->error_or_status());
+
+# append one more copy, to test ACCESS_APPEND
+
+ok($dev->start($ACCESS_APPEND, undef, undef),
+   "start in append mode")
+    or diag($dev->error_or_status());
+
+write_file(0xD0ED0E, $dev->block_size()*4, 4);
+
+ok($dev->finish(),
+   "finish device after append")
+    or diag($dev->error_or_status());
+
+# try reading the third file back, creating a new device
+# object first, and skipping the read-label step.
+
+$dev = undef;
+$dev = Amanda::Device->new($dev_name);
+is($dev->status(), $DEVICE_STATUS_SUCCESS,
+    "$dev_name: re-create successful")
+    or diag($dev->error_or_status());
+
+ok($dev->start($ACCESS_READ, undef, undef),
+   "start in read mode")
+    or diag($dev->error_or_status());
+
+verify_file(0x2FACE, $dev->block_size()*10+17, 3);
+
+ok($dev->finish(),
+   "finish device after read")
+    or diag($dev->error_or_status());
+
+ok($dev->start($ACCESS_READ, undef, undef),
+   "start in read mode after missing volume")
+    or diag($dev->error_or_status());
+
+# corrupt the device somehow and hope it keeps working
+rmtree("$taperoot/1");
+
+verify_file(0x2FACE, $dev->block_size()*10+17, 3);
+verify_file(0xD0ED0E, $dev->block_size()*4, 4);
+verify_file(0x2FACE, $dev->block_size()*10+17, 2);
+
+ok($dev->finish(),
+   "finish device read after missing volume")
+    or diag($dev->error_or_status());
+
+ok(!($dev->start($ACCESS_WRITE, "TESTCONF29", undef)),
+   "start in write mode fails with missing volume")
+    or diag($dev->error_or_status());
+
+undef $dev;
+
+$dev_name = "rait:{MISSING,file:$vtape2}";
+$dev = Amanda::Device->new($dev_name);
+
+ok($dev->start($ACCESS_READ, undef, undef),
+   "start in read mode with MISSING")
+    or diag($dev->error_or_status());
+
+verify_file(0x2FACE, $dev->block_size()*10+17, 3);
+verify_file(0xD0ED0E, $dev->block_size()*4, 4);
+verify_file(0x2FACE, $dev->block_size()*10+17, 2);
+
+ok($dev->finish(),
+   "finish device read with MISSING")
+    or diag($dev->error_or_status());
+
+ok(!($dev->start($ACCESS_WRITE, "TESTCONF29", undef)),
+   "start in write mode fails with MISSING")
+    or diag($dev->error_or_status());
+
+undef $dev;
+
+# Make two devices with different labels, should get a
+# message accordingly.
+($vtape1, $vtape2) = (mkvtape(1), mkvtape(2));
+
+my $n = 13;
+for $dev_name ("file:$vtape1", "file:$vtape2") {
+    my $dev = Amanda::Device->new($dev_name);
+    is($dev->status(), $DEVICE_STATUS_SUCCESS,
+       "$dev_name: Open successful")
+       or diag($dev->error_or_status());
+    ok($dev->start($ACCESS_WRITE, "TESTCONF$n", undef),
+       "wrote label 'TESTCONF$n'");
+    ok($dev->finish(), "finished device");
+    $n++;
+}
+
+$dev_name = "rait:{file:$vtape1,file:$vtape2}";
+$dev = Amanda::Device->new($dev_name);
+is($dev->status(), $DEVICE_STATUS_SUCCESS,
+   "$dev_name: Open successful")
+    or diag($dev->error_or_status());
+
+$dev->read_label();
+ok($dev->status() & $DEVICE_STATUS_VOLUME_ERROR,
+   "Label mismatch error handled correctly")
+    or diag($dev->error_or_status());
+
+# Use some config to set a block size on a child device
+($vtape1, $vtape2) = (mkvtape(1), mkvtape(2));
+$dev_name = "rait:{file:$vtape1,mytape2}";
+
+$testconf = Installcheck::Config->new();
+$testconf->add_device("mytape2", [
+    "tapedev" => "\"file:$vtape2\"",
+    "device_property" => "\"BLOCK_SIZE\" \"64k\""
+]);
+$testconf->write();
+config_init($CONFIG_INIT_EXPLICIT_NAME, 'TESTCONF') == $CFGERR_OK
+    or die("Could not load configuration");
+
+$dev = Amanda::Device->new($dev_name);
+is($dev->status(), $DEVICE_STATUS_SUCCESS,
+   "$dev_name: create successful")
+    or diag($dev->error_or_status());
+
+ok($dev->configure(1), "configure device");
+
+is($dev->property_get("block_size"), 65536,
+    "rait device calculates a block size from its children correctly");
+
+# Test an S3 device if the proper environment variables are set
+my $S3_SECRET_KEY = $ENV{'INSTALLCHECK_S3_SECRET_KEY'};
+my $S3_ACCESS_KEY = $ENV{'INSTALLCHECK_S3_ACCESS_KEY'};
+my $DEVPAY_SECRET_KEY = $ENV{'INSTALLCHECK_DEVPAY_SECRET_KEY'};
+my $DEVPAY_ACCESS_KEY = $ENV{'INSTALLCHECK_DEVPAY_ACCESS_KEY'};
+my $DEVPAY_USER_TOKEN = $ENV{'INSTALLCHECK_DEVPAY_USER_TOKEN'};
+
+my $run_s3_tests = defined $S3_SECRET_KEY && defined $S3_ACCESS_KEY;
+my $run_devpay_tests = defined $DEVPAY_SECRET_KEY && 
+    defined $DEVPAY_ACCESS_KEY && $DEVPAY_USER_TOKEN;
+
+my $dev_base_name;
+my $hostname  = hostname();
+
+my $s3_make_device_count = 6;
+sub s3_make_device($) {
+    my $dev_name = shift @_;
+    $dev = Amanda::Device->new($dev_name);
+    is($dev->status(), $DEVICE_STATUS_SUCCESS,
+       "$dev_name: create successful")
+        or diag($dev->error_or_status());
+
+    my @s3_props = ( 's3_access_key', 's3_secret_key' );
+    push @s3_props, 's3_user_token' if ($dev_name =~ /^s3zmanda:/);
+    properties_include([ $dev->property_list() ], [ @common_properties, @s3_props ],
+       "necessary properties listed on s3 device");
+
+    ok($dev->property_set('BLOCK_SIZE', 32768*2),
+       "set block size")
+       or diag($dev->error_or_status());
+
+    if ($dev_name =~ /^s3:/) {
+        # use regular S3 credentials
+        ok($dev->property_set('S3_ACCESS_KEY', $S3_ACCESS_KEY),
+           "set S3 access key")
+        or diag($dev->error_or_status());
+
+        ok($dev->property_set('S3_SECRET_KEY', $S3_SECRET_KEY),
+           "set S3 secret key")
+            or diag($dev->error_or_status());
+
+       pass("(placeholder)");
+    } elsif ($dev_name =~ /^s3zmanda:/) {
+        # use s3zmanda credentials
+        ok($dev->property_set('S3_ACCESS_KEY', $DEVPAY_ACCESS_KEY),
+           "set s3zmanda access key")
+        or diag($dev->error_or_status());
+
+        ok($dev->property_set('S3_SECRET_KEY', $DEVPAY_SECRET_KEY),
+           "set s3zmanda secret key")
+            or diag($dev->error_or_status());
+
+        ok($dev->property_set('S3_USER_TOKEN', $DEVPAY_USER_TOKEN),
+           "set s3zmanda user token")
+            or diag($dev->error_or_status());
+    } else {
+        croak("didn't recognize the device scheme, so no credentials were set");
+    }
+    return $dev;
+}
+
+my $s3_run_main_tests_count = 12
+       + 4 * $write_file_count
+       + 1 * $verify_file_count
+       + 3 * $s3_make_device_count;
+sub s3_run_main_tests($$) {
+    my ($dev_scheme, $base_name) = @_;
+    $dev_name = "$dev_scheme:$base_name-$dev_scheme";
+    $dev = s3_make_device($dev_name);
+    $dev->read_label();
+    my $status = $dev->status();
+    # this test appears very liberal, but catches the case where setup_handle fails without
+    # giving false positives
+    ok(($status == $DEVICE_STATUS_SUCCESS) || (($status & $DEVICE_STATUS_VOLUME_UNLABELED) != 0),
+       "status is either OK or possibly unlabeled")
+        or diag($dev->error_or_status());
+
+    ok($dev->start($ACCESS_WRITE, "TESTCONF13", undef),
+       "start in write mode")
+        or diag($dev->error_or_status());
+
+    ok(!($dev->status() & $DEVICE_STATUS_VOLUME_UNLABELED),
+       "it's labeled now")
+        or diag($dev->error_or_status());
+
+    for (my $i = 1; $i <= 3; $i++) {
+        write_file(0x2FACE, $dev->block_size()*10, $i);
+    }
+
+    ok($dev->finish(),
+       "finish device after write")
+        or diag($dev->error_or_status());
+
+    $dev->read_label();
+    ok(!($dev->status()),
+       "no error, at all, from read_label")
+       or diag($dev->error_or_status());
+
+    # append one more copy, to test ACCESS_APPEND
+
+    ok($dev->start($ACCESS_APPEND, undef, undef),
+       "start in append mode")
+        or diag($dev->error_or_status());
+
+    write_file(0xD0ED0E, $dev->block_size()*10, 4);
+
+    ok($dev->finish(),
+       "finish device after append")
+        or diag($dev->error_or_status());
+
+    # try reading the third file back
+
+    ok($dev->start($ACCESS_READ, undef, undef),
+       "start in read mode")
+        or diag($dev->error_or_status());
+
+    verify_file(0x2FACE, $dev->block_size()*10, 3);
+
+    ok($dev->finish(),
+       "finish device after read")
+        or diag($dev->error_or_status());    # (note: we don't use write_max_size here, as the maximum for S3 is very large)
+
+    # try a constrained bucket
+    $dev_name = lc("$dev_scheme:$base_name-$dev_scheme-eu");
+    $dev = s3_make_device($dev_name);
+    ok($dev->property_set('S3_BUCKET_LOCATION', 'EU'),
+       "set S3 bucket location")
+        or diag($dev->error_or_status());
+
+    $dev->read_label();
+    $status = $dev->status();
+    ok(($status == $DEVICE_STATUS_SUCCESS) || (($status & $DEVICE_STATUS_VOLUME_UNLABELED) != 0),
+       "status is either OK or possibly unlabeled")
+        or diag($dev->error_or_status());
+
+    # bucket name incompatible with location constraint
+    $dev_name = "$dev_scheme:-$base_name-$dev_scheme-eu";
+    $dev = s3_make_device($dev_name);
+
+    ok(!$dev->property_set('S3_BUCKET_LOCATION', 'EU'),
+       "should not be able to set S3 bucket location with an incompatible name")
+        or diag($dev->error_or_status());
+}
+
+SKIP: {
+    skip "define \$INSTALLCHECK_S3_{SECRET,ACCESS}_KEY to run S3 tests",
+                   1 + $s3_run_main_tests_count + $s3_make_device_count
+       unless $run_s3_tests;
+
+    # XXX for best results, the bucket should already exist (Amazon doesn't create
+    # buckets quickly enough to pass subsequent tests), but should be empty (so that
+    # the device appears unlabeled)
+    $dev_base_name = "$S3_ACCESS_KEY-installcheck-$hostname";
+
+    s3_run_main_tests('s3', $dev_base_name);
+
+    # can't set user token without devpay
+    $dev_name = "s3:$dev_base_name";
+    $dev = s3_make_device($dev_name);
+    ok(!$dev->property_set('S3_USER_TOKEN', '123'),
+       "set user token, but that shouldn't be possible (not using DevPay)")
+        or diag($dev->error_or_status());
+
+}
+
+SKIP: {
+    # in this case, most of our code has already been exercised
+    # just make sure that authentication works as a basic sanity check
+    skip "skipping abbreviated s3zmanda tests", $s3_make_device_count + 1
+       unless ($run_s3_tests and $run_devpay_tests);
+    $dev_name = "s3zmanda:$dev_base_name";
+    $dev = s3_make_device($dev_name);
+    $dev->read_label();
+    my $status = $dev->status();
+    # this test appears very liberal, but catches the case where setup_handle fails without
+    # giving false positives
+    ok(($status == 0) || (($status & $DEVICE_STATUS_VOLUME_UNLABELED) != 0),
+       "status is either OK or possibly unlabeled")
+       or diag($dev->error_or_status());
+}
+
+SKIP: {
+    # if we're running devpay tests and not S3 tests, then we do the whole suite with devpay
+    skip "define \$INSTALLCHECK_DEVPAY_{SECRET_KEY,ACCESS_KEY,USER_TOKEN} to run full s3zmanda tests", $s3_run_main_tests_count
+       unless (!$run_s3_tests and $run_devpay_tests);
+    s3_run_main_tests('s3zmanda', $dev_base_name);
+}
+
+# Test a tape device if the proper environment variables are set
+my $TAPE_DEVICE = $ENV{'INSTALLCHECK_TAPE_DEVICE'};
+my $run_tape_tests = defined $TAPE_DEVICE;
+SKIP: {
+    skip "define \$INSTALLCHECK_TAPE_DEVICE to run tape tests", 37
+       unless $run_tape_tests;
+
+    $dev_name = "tape:$TAPE_DEVICE";
+    $dev = Amanda::Device->new($dev_name);
+    is($dev->status(), $DEVICE_STATUS_SUCCESS,
+       "$dev_name: create successful")
+       or diag($dev->error_or_status());
+
+    my $status = $dev->read_label();
+    ok(($status == $DEVICE_STATUS_SUCCESS) || (($status & $DEVICE_STATUS_VOLUME_UNLABELED) != 0),
+       "status is either OK or possibly unlabeled")
+        or diag($dev->error_or_status());
+
+    ok($dev->start($ACCESS_WRITE, "TESTCONF13", undef),
+       "start in write mode")
+       or diag($dev->error_or_status());
+
+    ok(!($dev->status() & $DEVICE_STATUS_VOLUME_UNLABELED),
+       "not unlabeled anymore")
+       or diag($dev->error_or_status());
+
+    for (my $i = 1; $i <= 3; $i++) {
+       write_file(0x2FACE, $dev->block_size()*10+17, $i);
+    }
+
+    ok($dev->finish(),
+       "finish device after write")
+       or diag($dev->error_or_status());
+
+    $dev->read_label();
+    ok(!($dev->status()),
+       "no error, at all, from read_label")
+       or diag($dev->error_or_status());
+
+    is($dev->volume_label(), "TESTCONF13",
+       "read_label reads the correct label")
+       or diag($dev->error_or_status());
+
+    # append one more copy, to test ACCESS_APPEND
+
+    SKIP: {
+        skip "APPEND not supported", $write_file_count + 2
+            unless $dev->property_get("APPENDABLE");
+        ok($dev->start($ACCESS_APPEND, undef, undef),
+            "start in append mode")
+            or diag($dev->error_or_status());
+
+        write_file(0xD0ED0E, $dev->block_size()*4, 4);
+
+        ok($dev->finish(),
+            "finish device after append")
+            or diag($dev->error_or_status());
+    }
+
+    # try reading the third file back, creating a new device
+    # object first, and skipping the read-label step.
+
+    $dev = undef;
+    $dev = Amanda::Device->new($dev_name);
+    is($dev->status(), $DEVICE_STATUS_SUCCESS,
+       "$dev_name: re-create successful")
+       or diag($dev->error_or_status());
+
+    ok($dev->start($ACCESS_READ, undef, undef),
+       "start in read mode")
+       or diag($dev->error_or_status());
+
+    verify_file(0x2FACE, $dev->block_size()*10+17, 3);
+
+    ok($dev->finish(),
+       "finish device after read")
+       or diag($dev->error_or_status());
+
+}
+
+unlink($input_filename);
+unlink($output_filename);
+rmtree($taperoot);
index b6c6acd2874bccbcf6702601a53e93b0e1159a3a..3460b56cbb31ba9f8717d1cf39b1ccada9aef327 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2006 Zmanda Inc.  All Rights Reserved.
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License version 2 as published
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 #
-# Contact information: Zmanda Inc, 505 N Mathlida Ave, Suite 120
-# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 
-use Test::More qw(no_plan);
+use Test::More tests => 30;
 use File::Path;
-use Amconfig;
 use strict;
 
 use lib "@amperldir@";
+use Installcheck::Config;
 use Amanda::Paths;
-use Amanda::Tapefile;
+use Amanda::Tapelist;
+use Amanda::Cmdline;
 use Amanda::Logfile qw(:logtype_t :program_t open_logfile get_logline close_logfile);
 use Amanda::Config qw( :init :getconf config_dir_relative );
 
+my $log_filename = "$AMANDA_TMPDIR/Amanda_Logfile_test.log";
+
 # write a logfile and return the filename
 sub write_logfile {
     my ($contents) = @_;
-    my $filename = "$AMANDA_TMPDIR/Amanda_Logfile_test.log";
 
     if (!-e $AMANDA_TMPDIR) {
        mkpath($AMANDA_TMPDIR);
     }
 
-    open my $logfile, ">", $filename or die("Could not create temporary log file");
+    open my $logfile, ">", $log_filename or die("Could not create temporary log file '$log_filename': $!");
     print $logfile $contents;
     close $logfile;
 
-    return $filename;
+    return $log_filename;
+}
+
+sub unlink_logfile {
+    unlink($log_filename);
 }
 
 ####
@@ -142,31 +148,35 @@ sub res2arr {
        $res->{'timestamp'},
        $res->{'hostname'},
        $res->{'diskname'},
-       $res->{'level'},
+       "$res->{'level'}",
        $res->{'label'},
-       $res->{'filenum'},
+       "$res->{'filenum'}",
        $res->{'status'},
        $res->{'partnum'}
     ];
 }
 
 # set up a basic config
-my $testconf = Amconfig->new();
+my $testconf = Installcheck::Config->new();
 $testconf->add_param("tapecycle", "20");
 $testconf->write();
 
 # load the config
-ok(config_init($CONFIG_INIT_EXPLICIT_NAME, "TESTCONF"), "config_init is OK");
+config_init($CONFIG_INIT_EXPLICIT_NAME, "TESTCONF") == $CFGERR_OK
+    or die("Could not load config");
 my $tapelist = config_dir_relative("tapelist");
 
-# set up and read the tapelist
+# set up and read the tapelist (we don't use Amanda::Tapelist to write this,
+# in case it's broken)
 open my $tlf, ">", $tapelist or die("Could not write tapelist");
-print $tlf "20071111010002 TESTCONF004 reuse\n";
-print $tlf "20071110010002 TESTCONF003 reuse\n";
+print $tlf "20071111010002 TESTCONF006 reuse\n";
+print $tlf "20071110010002 TESTCONF005 reuse\n";
+print $tlf "20071109010002 TESTCONF004 reuse\n";
+print $tlf "20071109010002 TESTCONF003 reuse\n";
 print $tlf "20071109010002 TESTCONF002 reuse\n";
 print $tlf "20071108010001 TESTCONF001 reuse\n";
 close $tlf;
-Amanda::Tapefile::read_tapelist($tapelist) == 0 or die("Could not read tapelist");
+Amanda::Tapelist::read_tapelist($tapelist);
 
 # set up a number of logfiles in logdir.
 my $logf;
@@ -205,20 +215,28 @@ PART taper TESTCONF002 8 clihost /home 20071109010002 5/5 0 [multi-part dump]
 DONE taper clihost /home 20071109010002 5 0 [multi-part dump]
 PART taper TESTCONF002 9 thatbox /u_lose 20071109010002 1/4 2 [multi-part failure]
 PART taper TESTCONF002 10 thatbox /u_lose 20071109010002 2/4 2 [multi-part failure]
-PART taper TESTCONF002 11 thatbox /u_lose 20071109010002 3/4 2 [multi-part failure]
+PARTPARTIAL taper TESTCONF002 11 thatbox /u_lose 20071109010002  3/4 2 [multi-part retry]
+START taper datestamp 20071109010002 label TESTCONF003 tape 1
+PART taper TESTCONF003 1 thatbox /u_lose 20071109010002 3/4 2 [multi-part failure]
 FAIL taper thatbox /u_lose 20071109010002 2 "Oh no!"
-DONE taper thatbox /u_lose 20071109010002 4 2 [multi-part failure]
+PART taper TESTCONF003 2 thatbox /u_win 20071109010002 1/4 3 [multi-part retry]
+PART taper TESTCONF003 3 thatbox /u_win 20071109010002 2/4 3 [multi-part retry]
+PARTPARTIAL taper TESTCONF003 4 thatbox /u_win 20071109010002  3/4 3 [multi-part retry]
+START taper datestamp 20071109010002 label TESTCONF004 tape 1
+PART taper TESTCONF004 1 thatbox /u_win 20071109010002 3/4 3 [multi-part retry]
+PART taper TESTCONF004 2 thatbox /u_win 20071109010002 4/4 3 [multi-part retry]
+DONE taper thatbox /u_win 20071109010002 4 3 [multi-part retry]
 EOF
 close $logf;
 
 # "old-style amflush log"
 open $logf, ">", "$logdir/log.20071110010002.amflush" or die("Could not write logfile");
-print $logf "START taper datestamp 20071110010002 label TESTCONF003 tape 1\n";
+print $logf "START taper datestamp 20071110010002 label TESTCONF005 tape 1\n";
 close $logf;
 
 # "old-style main log"
 open $logf, ">", "$logdir/log.20071111010002" or die("Could not write logfile");
-print $logf "START taper datestamp 20071111010002 label TESTCONF004 tape 1\n";
+print $logf "START taper datestamp 20071111010002 label TESTCONF006 tape 1\n";
 close $logf;
 
 is_deeply([ Amanda::Logfile::find_log() ],
@@ -227,20 +245,31 @@ is_deeply([ Amanda::Logfile::find_log() ],
          "find_log returns correct logfiles in the correct order");
 
 my @results;
+my @results2;
+my @results3;
+my @results4;
 my @results_arr;
 
-@results = Amanda::Logfile::search_logfile("TESTCONF002", "20071109010002",
+@results2 = Amanda::Logfile::search_logfile("TESTCONF002", "20071109010002",
+                                          "$logdir/log.20071109010002.0", 1);
+@results3 = Amanda::Logfile::search_logfile("TESTCONF003", "20071109010002",
                                           "$logdir/log.20071109010002.0", 1);
-is($#results+1, 11, "search_logfile returned 11 results");
+@results4 = Amanda::Logfile::search_logfile("TESTCONF004", "20071109010002",
+                                          "$logdir/log.20071109010002.0", 1);
+@results = ();
+push @results, @results2, @results3, @results4;
+is($#results+1, 17, "search_logfile returned 15 results");
 
 # sort by filenum so we can compare each to what it should be
-@results = sort { $a->{'filenum'} <=> $b->{'filenum'} } @results;
+@results = sort { $a->{'label'} cmp $b->{'label'} ||
+                 $a->{'filenum'} <=> $b->{'filenum'} } @results;
 
 # and convert the hashes to arrays for easy comparison
 @results_arr = map { res2arr($_) } @results;
 
 is_deeply(\@results_arr,
-       [ [ '20071109010002', 'clihost', '/usr',            0, 'TESTCONF002', 1,  'OK', '1'   ],
+       [
+         [ '20071109010002', 'clihost', '/usr',            0, 'TESTCONF002', 1,  'OK', '1'   ],
          [ '20071109010002', 'clihost', '/my documents',   0, 'TESTCONF002', 2,  'OK', '1'   ],
          [ '20071109010002', 'thatbox', '/var',            1, 'TESTCONF002', 3,  'OK', '--'  ],
          [ '20071109010002', 'clihost', '/home',           0, 'TESTCONF002', 4,  'OK', '1/5' ],
@@ -248,35 +277,97 @@ is_deeply(\@results_arr,
          [ '20071109010002', 'clihost', '/home',           0, 'TESTCONF002', 6,  'OK', '3/5' ],
          [ '20071109010002', 'clihost', '/home',           0, 'TESTCONF002', 7,  'OK', '4/5' ],
          [ '20071109010002', 'clihost', '/home',           0, 'TESTCONF002', 8,  'OK', '5/5' ],
-         [ '20071109010002', 'thatbox', '/u_lose',   2, 'TESTCONF002', 9,  '"Oh no!"', '1/4' ],
-         [ '20071109010002', 'thatbox', '/u_lose',   2, 'TESTCONF002', 10, '"Oh no!"', '2/4' ],
-         [ '20071109010002', 'thatbox', '/u_lose',   2, 'TESTCONF002', 11, '"Oh no!"', '3/4' ] ],
-         "results are correct");
+         [ '20071109010002', 'thatbox', '/u_lose',   2, 'TESTCONF002', 9,  'OK', '1/4' ],
+         [ '20071109010002', 'thatbox', '/u_lose',   2, 'TESTCONF002', 10, 'OK', '2/4' ],
+         [ '20071109010002', 'thatbox', '/u_lose',   2, 'TESTCONF002', 11, 'PARTIAL', '3/4' ],
+         [ '20071109010002', 'thatbox', '/u_lose',   2, 'TESTCONF003', 1,  '"Oh no!"', '3/4' ],
+         [ '20071109010002', 'thatbox', '/u_win',    3, 'TESTCONF003', 2, 'OK', '1/4' ],
+         [ '20071109010002', 'thatbox', '/u_win',    3, 'TESTCONF003', 3, 'OK', '2/4' ],
+         [ '20071109010002', 'thatbox', '/u_win',    3, 'TESTCONF003', 4, 'PARTIAL', '3/4' ],
+         [ '20071109010002', 'thatbox', '/u_win',    3, 'TESTCONF004', 1, 'OK', '3/4' ],
+         [ '20071109010002', 'thatbox', '/u_win',    3, 'TESTCONF004', 2, 'OK', '4/4' ],
+       ], "results are correct");
 
 my @filtered;
 my @filtered_arr;
 
 @filtered = Amanda::Logfile::dumps_match([@results], "thatbox", undef, undef, undef, 0);
-is($#filtered+1, 4, "four results match 'thatbox'");
-@filtered = sort { $a->{'filenum'} <=> $b->{'filenum'} } @filtered;
+is($#filtered+1, 10, "ten results match 'thatbox'");
+@filtered = sort { $a->{'label'} cmp $b->{'label'} ||
+                  $a->{'filenum'} <=> $b->{'filenum'} } @filtered;
 
 @filtered_arr = map { res2arr($_) } @filtered;
 
 is_deeply(\@filtered_arr,
-       [ [ '20071109010002', 'thatbox', '/var',      1, 'TESTCONF002', 3,  'OK',       '--' ],
-         [ '20071109010002', 'thatbox', '/u_lose',   2, 'TESTCONF002', 9,  '"Oh no!"', '1/4' ],
-         [ '20071109010002', 'thatbox', '/u_lose',   2, 'TESTCONF002', 10, '"Oh no!"', '2/4' ],
-         [ '20071109010002', 'thatbox', '/u_lose',   2, 'TESTCONF002', 11, '"Oh no!"', '3/4' ] ],
-         "results are  correct");
+       [
+         [ '20071109010002', 'thatbox', '/var',      1, 'TESTCONF002', 3,  'OK',       '--' ],
+         [ '20071109010002', 'thatbox', '/u_lose',   2, 'TESTCONF002', 9,  'OK',       '1/4' ],
+         [ '20071109010002', 'thatbox', '/u_lose',   2, 'TESTCONF002', 10, 'OK',       '2/4' ],
+         [ '20071109010002', 'thatbox', '/u_lose',   2, 'TESTCONF002', 11, 'PARTIAL',  '3/4' ],
+         [ '20071109010002', 'thatbox', '/u_lose',   2, 'TESTCONF003', 1,  '"Oh no!"', '3/4' ],
+         [ '20071109010002', 'thatbox', '/u_win',    3, 'TESTCONF003', 2,  'OK',       '1/4' ],
+         [ '20071109010002', 'thatbox', '/u_win',    3, 'TESTCONF003', 3,  'OK',       '2/4' ],
+         [ '20071109010002', 'thatbox', '/u_win',    3, 'TESTCONF003', 4,  'PARTIAL',  '3/4' ],
+         [ '20071109010002', 'thatbox', '/u_win',    3, 'TESTCONF004', 1,  'OK',       '3/4' ],
+         [ '20071109010002', 'thatbox', '/u_win',    3, 'TESTCONF004', 2,  'OK',       '4/4' ],
+       ], "results are correct");
 
 @filtered = Amanda::Logfile::dumps_match([@results], "thatbox", "/var", undef, undef, 0);
 is($#filtered+1, 1, "only one result matches 'thatbox:/var'");
 
 @filtered = Amanda::Logfile::dumps_match([@results], undef, undef, "20071109010002", undef, 0);
-is($#filtered+1, 11, "all 11 results match '20071109010002'");
+is($#filtered+1, 17, "all 17 results match '20071109010002'");
 
 @filtered = Amanda::Logfile::dumps_match([@results], undef, undef, "20071109010002", undef, 1);
-is($#filtered+1, 8, "of those, 8 results are 'OK'");
+is($#filtered+1, 14, "of those, 14 results are 'OK'");
 
 @filtered = Amanda::Logfile::dumps_match([@results], undef, undef, undef, "2", 0);
-is($#filtered+1, 3, "3 results are at level 2");
+is($#filtered+1, 4, "4 results are at level 2");
+
+# test dumps_match_dumpspecs
+
+my @dumpspecs;
+
+@dumpspecs = Amanda::Cmdline::parse_dumpspecs(["thatbox", "/var"], 0);
+@filtered = Amanda::Logfile::dumps_match_dumpspecs([@results], [@dumpspecs], 0);
+is_deeply([ map { res2arr($_) } @filtered ],
+       [
+         [ '20071109010002', 'thatbox', '/var',            1, 'TESTCONF002', 3,  'OK', '--'  ],
+       ], "filter with dumpspecs 'thatbox /var'");
+
+@dumpspecs = Amanda::Cmdline::parse_dumpspecs(["thatbox", "/var", "clihost"], 0);
+@filtered = Amanda::Logfile::dumps_match_dumpspecs([@results], [@dumpspecs], 0);
+@filtered = sort { $a->{'label'} cmp $b->{'label'} ||
+                  $a->{'filenum'} <=> $b->{'filenum'} } @filtered;
+is_deeply([ map { res2arr($_) } @filtered ],
+       [
+         [ '20071109010002', 'clihost', '/usr',            0, 'TESTCONF002', 1,  'OK', '1'   ],
+         [ '20071109010002', 'clihost', '/my documents',   0, 'TESTCONF002', 2,  'OK', '1'   ],
+         [ '20071109010002', 'thatbox', '/var',            1, 'TESTCONF002', 3,  'OK', '--'  ],
+         [ '20071109010002', 'clihost', '/home',           0, 'TESTCONF002', 4,  'OK', '1/5' ],
+         [ '20071109010002', 'clihost', '/home',           0, 'TESTCONF002', 5,  'OK', '2/5' ],
+         [ '20071109010002', 'clihost', '/home',           0, 'TESTCONF002', 6,  'OK', '3/5' ],
+         [ '20071109010002', 'clihost', '/home',           0, 'TESTCONF002', 7,  'OK', '4/5' ],
+         [ '20071109010002', 'clihost', '/home',           0, 'TESTCONF002', 8,  'OK', '5/5' ],
+       ], "filter with dumpspecs 'thatbox /var clihost' (union of two disjoint sets)");
+
+# if multiple dumpspecs specify the same dump, it will be included in the output multiple times
+@dumpspecs = Amanda::Cmdline::parse_dumpspecs([".*", "/var", "thatbox"], 0);
+@filtered = Amanda::Logfile::dumps_match_dumpspecs([@results], [@dumpspecs], 0);
+@filtered = sort { $a->{'label'} cmp $b->{'label'} ||
+                  $a->{'filenum'} <=> $b->{'filenum'} } @filtered;
+is_deeply([ map { res2arr($_) } @filtered ],
+       [
+         [ '20071109010002', 'thatbox', '/var',      1, 'TESTCONF002', 3,  'OK',       '--'  ],
+         [ '20071109010002', 'thatbox', '/u_lose',   2, 'TESTCONF002', 9,  'OK',       '1/4' ],
+         [ '20071109010002', 'thatbox', '/u_lose',   2, 'TESTCONF002', 10, 'OK',       '2/4' ],
+         [ '20071109010002', 'thatbox', '/u_lose',   2, 'TESTCONF002', 11, 'PARTIAL',  '3/4' ],
+         [ '20071109010002', 'thatbox', '/u_lose',   2, 'TESTCONF003', 1,  '"Oh no!"', '3/4' ],
+         [ '20071109010002', 'thatbox', '/u_win',    3, 'TESTCONF003', 2,  'OK',       '1/4' ],
+         [ '20071109010002', 'thatbox', '/u_win',    3, 'TESTCONF003', 3,  'OK',       '2/4' ],
+         [ '20071109010002', 'thatbox', '/u_win',    3, 'TESTCONF003', 4,  'PARTIAL',  '3/4' ],
+         [ '20071109010002', 'thatbox', '/u_win',    3, 'TESTCONF004', 1,  'OK',       '3/4' ],
+         [ '20071109010002', 'thatbox', '/u_win',    3, 'TESTCONF004', 2,  'OK',       '4/4' ],
+       ], "filter with dumpspecs '.* /var thatbox' (union of two overlapping sets includes dupes)");
+
+unlink_logfile();
diff --git a/installcheck/Amanda_MainLoop.pl b/installcheck/Amanda_MainLoop.pl
new file mode 100644 (file)
index 0000000..c85e980
--- /dev/null
@@ -0,0 +1,395 @@
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+use Test::More tests => 17;
+use strict;
+use warnings;
+use POSIX qw(WIFEXITED WEXITSTATUS EINTR);
+
+use lib "@amperldir@";
+use Amanda::MainLoop qw( :GIOCondition );
+
+{
+    my $global = 0;
+
+    my $to = Amanda::MainLoop::timeout_source(200);
+    $to->set_callback(sub { 
+       # ignore $src argument
+       if (++$global >= 3) {
+           $to->remove();
+           Amanda::MainLoop::quit();
+       }
+    });
+
+    Amanda::MainLoop::run();
+    is($global, 3, "Timeout source works, calls back repeatedly (using a closure)");
+}
+
+{
+    my $global = 0;
+
+    my $to = Amanda::MainLoop::timeout_source(200);
+    $to->set_callback(sub { 
+       my ($src) = @_;
+       if (++$global >= 3) {
+           $src->remove();
+           Amanda::MainLoop::quit();
+       }
+    });
+    $to = undef; # remove the lexical reference to the source
+
+    Amanda::MainLoop::run();
+    is($global, 3, "Timeout source works, calls back repeatedly (no external reference to the source)");
+}
+
+{
+    my $global = 0;
+
+    my $id = Amanda::MainLoop::idle_source(5);
+    $id->set_callback(sub { 
+       my ($src) = @_;
+       if (++$global >= 30) {
+           $src->remove();
+           Amanda::MainLoop::quit();
+       }
+    });
+
+    Amanda::MainLoop::run();
+    is($global, 30, "Idle source works, calls back repeatedly");
+    $id->remove();
+}
+
+{
+    my $global = 0;
+
+    # to1 is removed before it runs, so it should never
+    # execute its callback
+    my $to1 = Amanda::MainLoop::timeout_source(10);
+    $to1->set_callback(sub { ++$global; });
+    $to1->remove();
+
+    my $to2 = Amanda::MainLoop::timeout_source(300);
+    $to2->set_callback(sub { Amanda::MainLoop::quit(); });
+
+    Amanda::MainLoop::run();
+    is($global, 0, "A remove()d source doesn't call back");
+
+    $to2->remove();
+}
+
+{
+    my $global = 0;
+
+    my $pid = fork();
+    if ($pid == 0) {
+       ## child
+       sleep(1);
+       exit(9);
+    }
+
+    ## parent
+
+    my $cw = Amanda::MainLoop::child_watch_source($pid);
+    $cw->set_callback(sub {
+       my ($src, $got_pid, $got_status) = @_;
+       Amanda::MainLoop::quit();
+       $src->remove();
+
+       if ($got_pid != $pid) {
+           diag("Got pid $got_pid, but expected $pid");
+           return;
+       }
+       if (!WIFEXITED($got_status)) {
+           diag("Didn't get an 'exited' status");
+           return;
+       }
+       if (WEXITSTATUS($got_status) != 9) {
+           diag("Didn't get exit status 9");
+           return;
+       }
+       $global = 1;
+    });
+
+    my $to = Amanda::MainLoop::timeout_source(3000);
+    $to->set_callback(sub {
+       my ($src) = @_;
+       $global = 7;
+
+       $src->remove();
+       Amanda::MainLoop::quit();
+    });
+
+    Amanda::MainLoop::run();
+    is($global, 1, "Child watch detects a dead child");
+
+    $cw->remove();
+    $to->remove();
+}
+
+{
+    my $global = 0;
+
+    my $pid = fork();
+    if ($pid == 0) {
+       ## child
+       exit(11);
+    }
+
+    ## parent
+
+    sleep(1);
+    my $cw = Amanda::MainLoop::child_watch_source($pid);
+    $cw->set_callback(sub {
+       my ($src, $got_pid, $got_status) = @_;
+       Amanda::MainLoop::quit();
+       $src->remove();
+
+       if ($got_pid != $pid) {
+           diag("Got pid $got_pid, but expected $pid");
+           return;
+       }
+       if (!WIFEXITED($got_status)) {
+           diag("Didn't get an 'exited' status");
+           return;
+       }
+       if (WEXITSTATUS($got_status) != 11) {
+           diag("Didn't get exit status 11");
+           return;
+       }
+       $global = 1;
+    });
+
+    my $to = Amanda::MainLoop::timeout_source(3000);
+    $to->set_callback(sub { $global = 7; Amanda::MainLoop::quit(); });
+
+    Amanda::MainLoop::run();
+    is($global, 1, "Child watch detects a dead child that dies before the callback is set");
+
+    $cw->remove();
+    $to->remove();
+}
+
+{
+    my $global = 0;
+    my ($readinfd, $writeinfd) = POSIX::pipe();
+    my ($readoutfd, $writeoutfd) = POSIX::pipe();
+
+    my $pid = fork();
+    if ($pid == 0) {
+       ## child
+
+       my $data;
+
+       POSIX::close($readinfd);
+       POSIX::close($writeoutfd);
+
+       # the read()s here are to synchronize with our parent; the
+       # results are ignored.
+       POSIX::read($readoutfd, $data, 1024);
+       POSIX::write($writeinfd, "HELLO\n", 6);
+       POSIX::read($readoutfd, $data, 1024);
+       POSIX::write($writeinfd, "WORLD\n", 6);
+       POSIX::read($readoutfd, $data, 1024);
+       exit(33);
+    }
+
+    ## parent
+
+    POSIX::close($writeinfd);
+    POSIX::close($readoutfd);
+
+    my @events;
+
+    my $to = Amanda::MainLoop::timeout_source(200);
+    my $times = 3;
+    $to->set_callback(sub {
+       push @events, "time";
+       POSIX::write($writeoutfd, "A", 1); # wake up the child
+       if (--$times == 0) {
+           $to->remove();
+       }
+    });
+
+    my $cw = Amanda::MainLoop::child_watch_source($pid);
+    $cw->set_callback(sub {
+       my ($src, $got_pid, $got_status) = @_;
+       $cw->remove();
+       Amanda::MainLoop::quit();
+
+       push @events, "died";
+    });
+
+    my $fd = Amanda::MainLoop::fd_source($readinfd, $G_IO_IN | $G_IO_HUP);
+    $fd->set_callback(sub {
+       my $str;
+       if (POSIX::read($readinfd, $str, 1024) == 0) {
+           # EOF
+           POSIX::close($readinfd);
+           POSIX::close($writeoutfd);
+           $fd->remove();
+           return;
+       }
+       chomp $str;
+       push @events, "read $str";
+    });
+
+    Amanda::MainLoop::run();
+    $to->remove();
+    $cw->remove();
+    $fd->remove();
+
+    is_deeply([ @events ],
+       [ "time", "read HELLO", "time", "read WORLD", "time", "died" ],
+       "fd source works for reading from a file descriptor");
+}
+
+# see if a "looping" callback with some closure values works.  This test teased
+# out some memory corruption bugs once upon a time.
+
+{
+    my $completed = 0;
+    sub loop {
+       my ($finished_cb) = @_;
+       my $time = 700;
+       my $to;
+
+       my $cb;
+       $cb = sub {
+           $time -= 300;
+           $to->remove();
+           if ($time <= 0) {
+               $finished_cb->();
+           } else {
+               $to = Amanda::MainLoop::timeout_source($time);
+               $to->set_callback($cb);
+           }
+       };
+       $to = Amanda::MainLoop::timeout_source($time);
+       $to->set_callback($cb);
+    };
+    loop(sub {
+       $completed = 1;
+       Amanda::MainLoop::quit();
+    });
+    Amanda::MainLoop::run();
+    is($completed, 1, "looping construct terminates with a callback");
+}
+
+# Make sure that a die() in a callback correctly kills the process.  Such
+# a die() skips the usual Perl handling, so an eval { } won't do -- we have
+# to fork a child.
+{
+    my $global = 0;
+    my ($readfd, $writefd) = POSIX::pipe();
+
+    my $pid = fork();
+    if ($pid == 0) {
+       ## child
+
+       my $data;
+
+       # fix up the file descriptors to hook fd 2 (stderr) to
+       # the pipe
+       POSIX::close($readfd);
+       POSIX::dup2($writefd, 2);
+       POSIX::close($writefd);
+
+       # and now die in a callback, using an eval {} in case the
+       # exception propagates out of the MainLoop run()
+       my $src = Amanda::MainLoop::timeout_source(10);
+       $src->set_callback(sub { die("Oh, the humanity"); });
+       eval { Amanda::MainLoop::run(); };
+       exit(33);
+    }
+
+    ## parent
+
+    POSIX::close($writefd);
+
+    # read from the child and wait for it to die.  There's no
+    # need to use MainLoop here.
+    my $str;
+    while (!defined(POSIX::read($readfd, $str, 1024))) {
+       # we may be interrupted by a SIGCHLD; keep going
+       next if ($! == EINTR);
+       die ("POSIX::read failed: $!");
+    }
+    POSIX::close($readfd);
+    waitpid($pid, 0);
+
+    ok($? != 33 && $? != 0, "die() in a callback exits with an error condition");
+    like($str, qr/Oh, the humanity/, "..and displays die message on stderr");
+}
+
+# test misc. management of sources.  Ideally it won't crash :)
+
+my $src = Amanda::MainLoop::idle_source(1);
+$src->set_callback(sub { 1; });
+$src->set_callback(sub { 1; });
+$src->set_callback(sub { 1; });
+pass("Can call set_callback a few times on the same source");
+
+$src->remove();
+$src->remove();
+pass("Calling remove twice is ok");
+
+{
+    my ($cb1, $cb2);
+    my $gothere = 0;
+
+    $cb1 = sub {
+       my ($a, $b) = @_;
+       ok(Amanda::MainLoop::is_running(),
+           "call_later waits until mainloop runs");
+       is($a+$b, 10,
+           "call_later passes arguments correctly");
+       Amanda::MainLoop::call_later($cb2);
+       Amanda::MainLoop::quit();
+    };
+
+    $cb2 = sub {
+       $gothere = 1;
+    };
+
+    ok(!Amanda::MainLoop::is_running(), "main loop is correctly recognized as not running");
+    Amanda::MainLoop::call_later($cb1, 7, 3);
+    Amanda::MainLoop::run();
+    ok($gothere, "call_later while already running calls immediately");
+
+    my @actions = ();
+
+    $cb1 = sub {
+        push @actions, "cb1 start";
+       Amanda::MainLoop::call_later($cb2, "hello");
+        push @actions, "cb1 end";
+    };
+
+    $cb2 = sub {
+       my ($greeting) = @_;
+
+        push @actions, "cb2 start $greeting";
+       Amanda::MainLoop::quit();
+        push @actions, "cb2 end";
+    };
+
+    Amanda::MainLoop::call_later($cb1);
+    Amanda::MainLoop::run();
+    is_deeply([ @actions ],
+              [ "cb1 start", "cb1 end", "cb2 start hello", "cb2 end" ],
+              "call_later doesn't call its argument immediately");
+}
diff --git a/installcheck/Amanda_Process.pl b/installcheck/Amanda_Process.pl
new file mode 100644 (file)
index 0000000..7895509
--- /dev/null
@@ -0,0 +1,142 @@
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+use Test::More tests => 11;
+use File::Path;
+use strict;
+
+use lib "@amperldir@";
+use Installcheck::Config;
+use Amanda::Paths;
+use Amanda::Debug;
+use Amanda::Config qw( :init :getconf config_dir_relative );
+use Amanda::Process;
+
+# set up debugging so debug output doesn't interfere with test results
+Amanda::Debug::dbopen("installcheck");
+
+# and disable Debug's die() and warn() overrides
+Amanda::Debug::disable_die_override();
+
+my $Amanda_process = Amanda::Process->new(0);
+
+$Amanda_process->load_ps_table();
+
+like($Amanda_process->{pstable}->{$$}, qr/perl/,
+   "installcheck is a perl program");
+is($Amanda_process->{ppid}->{$$}, getppid,
+   "load_ps_table get correct ppid for installcheck");
+
+#override works done by load_ps_table, override pstable
+$Amanda_process->{pstable} = {
+       1     => "init",
+       1001  => "bash",
+       30072 => "amdump",
+       30093 => "driver",
+       30099 => "taper",
+       30100 => "dumper",
+       30101 => "dumper",
+       30102 => "foobar",
+       30103 => "dumper",
+       30104 => "dumper",
+       30527 => "chunker",
+       30538 => "gzip",
+       30539 => "gzip",
+};
+
+#override works done by load_ps_table, override ppid
+$Amanda_process->{ppid} = {
+       1     => 1,
+       1001  => 1,
+       30072 => 1001,
+       30093 => 30072,
+       30099 => 30093,
+       30100 => 30093,
+       30101 => 30093,
+       30102 => 1,
+       30103 => 30093,
+       30104 => 30093,
+       30527 => 30093,
+       30538 => 30100,
+       30539 => 30100,
+};
+
+#create a log file
+my $log_filename = "$AMANDA_TMPDIR/Amanda_Logfile_test.log";
+open my $logfile, ">", $log_filename or die("Could not create temporary log file '$log_filename': $!");
+print $logfile <<LOGFILE;
+INFO amdump amdump pid 30072
+INFO driver driver pid 30093
+INFO planner planner pid 30092
+INFO dumper dumper pid 30100
+INFO taper taper pid 30099
+INFO dumper dumper pid 30103
+INFO dumper dumper pid 30104
+INFO dumper dumper pid 30101
+INFO planner pid-done 30092
+INFO chunker chunker pid 30475
+INFO dumper gzip pid 30500
+INFO dumper gzip pid 30501
+INFO dumper pid-done 30500
+INFO chunker pid-done 30475
+INFO dumper pid-done 30501
+INFO chunker chunker pid 30527
+LOGFILE
+close $logfile;
+
+#parse the log file
+$Amanda_process->scan_log($log_filename);
+is_deeply($Amanda_process->{pids},
+       {30072 => "amdump",
+        30093 => "driver",
+        30099 => "taper",
+        30100 => "dumper",
+        30101 => "dumper",
+        30103 => "dumper",
+        30104 => "dumper",
+        30527 => "chunker"},
+       "scan_log works");
+is($Amanda_process->{master_pname}, "amdump",
+   "master_name is set to 'amdump'");
+is($Amanda_process->{master_pid}, "30072",
+   "master_pid is set to '30072'");
+
+$Amanda_process->add_child();
+is_deeply($Amanda_process->{amprocess},
+       {30072 => 30072,
+        30093 => 30093,
+        30099 => 30099,
+        30100 => 30100,
+        30101 => 30101,
+        30103 => 30103,
+        30104 => 30104,
+        30527 => 30527,
+        30538 => 30538,
+        30539 => 30539},
+       "add_child add the 2 gzip process");
+
+is($Amanda_process->process_alive(30100, "dumper"), 1,
+   "process_alive return if pname match");
+is($Amanda_process->process_alive(30100, "driver"), '',
+   "process_alive return '' if pname doesn't match");
+is($Amanda_process->process_alive(30100), 1,
+   "process_alive return 1 without pname for amanda process");
+is($Amanda_process->process_alive(30102), 1,
+   "process_alive return 1 without pname for any process");
+is($Amanda_process->process_alive(30105), '',
+   "process_alive return '' if the process is dead");
diff --git a/installcheck/Amanda_Tapelist.pl b/installcheck/Amanda_Tapelist.pl
new file mode 100644 (file)
index 0000000..89bf270
--- /dev/null
@@ -0,0 +1,165 @@
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+use Test::More tests => 18;
+use strict;
+
+use lib "@amperldir@";
+use Installcheck::Config;
+use Amanda::Tapelist;
+use Amanda::Config qw( :init :getconf config_dir_relative );
+
+my $tl;
+my $tl_ok;
+my $line;
+my @lines;
+
+# First try reading a tapelist
+
+my $testconf = Installcheck::Config->new();
+$testconf->write();
+
+config_init($CONFIG_INIT_EXPLICIT_NAME, "TESTCONF") == $CFGERR_OK
+    or die("config_init failed");
+my $tapelist = config_dir_relative("tapelist");
+
+sub mktapelist {
+    my ($filename, @lines) = @_;
+    open(my $fh, ">", $filename) or die("Could not make tapelist '$filename'");
+    for my $line (@lines) {
+       print $fh $line;
+    }
+    close($fh);
+}
+
+sub readtapelist {
+    my ($filename) = @_;
+    open(my $fh, "<", $filename) or die("Could not read tapelist '$filename'");
+    my @reread_lines = <$fh>;
+    close($fh);
+    return @reread_lines;
+}
+
+@lines = (
+    "20071111010002 TESTCONF004 reuse\n",
+    "20071110010002 TESTCONF003 reuse\n",
+    "20071109010002 TESTCONF002 reuse #comment 2\n",
+    "20071108010001 TESTCONF001 no-reuse #comment 1\n",
+);
+mktapelist($tapelist, @lines);
+
+$tl = Amanda::Tapelist::read_tapelist($tapelist);
+$tl_ok = is_deeply($tl,        [
+  { 'datestamp' => '20071111010002', 'label' => 'TESTCONF004',
+    'reuse' => 1, 'position' => 1, 'comment' => undef },
+  { 'datestamp' => '20071110010002', 'label' => 'TESTCONF003',
+    'reuse' => 1, 'position' => 2, 'comment' => undef },
+  { 'datestamp' => '20071109010002', 'label' => 'TESTCONF002',
+    'reuse' => 1, 'position' => 3, 'comment' => 'comment 2' },
+  { 'datestamp' => '20071108010001', 'label' => 'TESTCONF001',
+    'reuse' => '', 'position' => 4, 'comment' => 'comment 1' },
+], "A simple tapelist is parsed correctly");
+
+SKIP: {
+    skip "Tapelist is parsed incorrectly, so these tests are unlikely to work", 15,
+       unless $tl_ok;
+
+    # now try writing it out and check that the results are the same
+    $tl->write("$tapelist-new");
+    my @reread_lines = readtapelist("$tapelist-new");
+    is_deeply(\@reread_lines, \@lines, "Lines of freshly written tapelist match the original");
+
+    is_deeply($tl->lookup_tapelabel('TESTCONF002'),
+       { 'datestamp' => '20071109010002', 'label' => 'TESTCONF002',
+         'reuse' => 1, 'position' => 3, 'comment' => 'comment 2' },
+       "lookup_tapelabel works");
+
+    is_deeply($tl->lookup_tapelabel('TESTCONF009'), undef,
+       "lookup_tapelabel returns undef on an unknown label");
+
+    is_deeply($tl->lookup_tapepos(4),
+       { 'datestamp' => '20071108010001', 'label' => 'TESTCONF001',
+         'reuse' => '', 'position' => 4, 'comment' => 'comment 1' },
+       "lookup_tapepos works");
+
+    is_deeply($tl->lookup_tapepos(9), undef,
+       "lookup_tapepos returns undef on an unknown position");
+
+    is_deeply($tl->lookup_tapedate('20071110010002'),
+       { 'datestamp' => '20071110010002', 'label' => 'TESTCONF003',
+         'reuse' => 1, 'position' => 2, 'comment' => undef },
+       "lookup_tapedate works");
+
+    is_deeply($tl->lookup_tapedate('12345678'), undef,
+       "lookup_tapedate returns undef on an unknown datestamp");
+
+    # try some edits
+    $tl->add_tapelabel("20080112010203", "TESTCONF007", "seven");
+    is(scalar @$tl, 5, "add_tapelabel adds a new element to the tapelist");
+
+    is_deeply($tl->lookup_tapepos(5),
+       { 'datestamp' => '20080112010203', 'label' => 'TESTCONF007',
+         'reuse' => 1, 'position' => 5, 'comment' => 'seven' },
+       ".. lookup_tapepos finds it");
+
+    is_deeply($tl->lookup_tapelabel("TESTCONF007"),
+       { 'datestamp' => '20080112010203', 'label' => 'TESTCONF007',
+         'reuse' => 1, 'position' => 5, 'comment' => 'seven' },
+       ".. lookup_tapelabel finds it");
+
+    is_deeply($tl->lookup_tapedate("20080112010203"),
+       { 'datestamp' => '20080112010203', 'label' => 'TESTCONF007',
+         'reuse' => 1, 'position' => 5, 'comment' => 'seven' },
+       ".. lookup_tapedate finds it");
+
+    $tl->remove_tapelabel("TESTCONF002");
+    is(scalar @$tl, 4, "remove_tapelabel removes an element from the tapelist");
+
+    is_deeply($tl->lookup_tapepos(4), # used to be in position 5
+       { 'datestamp' => '20080112010203', 'label' => 'TESTCONF007',
+         'reuse' => 1, 'position' => 4, 'comment' => 'seven' },
+       ".. tape positions are adjusted correctly");
+
+    is_deeply($tl->lookup_tapelabel("TESTCONF002"), undef,
+       ".. lookup_tapelabel no longer finds it");
+
+    is_deeply($tl->lookup_tapedate("20071109010002"), undef,
+       ".. lookup_tapedate no longer finds it");
+
+}
+
+# try parsing various invalid lines
+@lines = (
+    "2006123456 FOO reuse\n", # valid
+    "TESTCONF003 290385098 reuse\n", # invalid
+    "20071109010002 TESTCONF002 re-use\n", # invalid
+    "20071108010001 TESTCONF001\n", # invalid
+    "20071108010001 TESTCONF001 #comment\n", # invalid
+    "#comment\n", # invalid
+);
+mktapelist($tapelist, @lines);
+
+$tl = Amanda::Tapelist::read_tapelist($tapelist);
+is_deeply($tl, [
+  { 'datestamp' => '2006123456', 'label' => 'FOO',
+    'reuse' => 1, 'position' => 1, 'comment' => undef },
+], "Invalid lines are ignored");
+
+# make sure clear_tapelist is empty
+$tl = Amanda::Tapelist::clear_tapelist();
+is_deeply($tl, [ ], "clear_tapelist returns an empty tapelist");
index a301f80c39282ff19dc06ac03f4a6cf000cba3a5..59308ee7fb2239f3bcbdd113efcd54dbc234f172 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2006 Zmanda Inc.  All Rights Reserved.
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License version 2 as published
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 #
-# Contact information: Zmanda Inc, 505 N Mathlida Ave, Suite 120
-# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 
-use Test::More qw(no_plan);
-use Amconfig;
+use Test::More tests => 4;
 use strict;
 
 use lib "@amperldir@";
diff --git a/installcheck/Amanda_Util.pl b/installcheck/Amanda_Util.pl
new file mode 100644 (file)
index 0000000..44f08da
--- /dev/null
@@ -0,0 +1,78 @@
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+use Test::More tests => 28;
+
+use lib "@amperldir@";
+use Data::Dumper;
+use Amanda::Util;
+
+# Data::Dumper is used to output strings with control characters
+# in them, below
+$Data::Dumper::Useqq = 1;  # quote strings
+$Data::Dumper::Terse = 1;  # no $VAR1 = ..
+$Data::Dumper::Indent = 0; # no newlines
+
+# most of Amanda::Util is tested via running applications that use it
+
+# Tests for quote_string and unquote string.  First, some fuzzing of the
+# quote + unquote round-trip.
+my @fuzzstrs = (
+    '',
+    'abcd',
+    '"',
+    '""',
+    '\\',
+    "\t", "\r", "\n", "\f",
+    '\\\\\\\\', # memory overflow?
+    'backslash\nletter',
+    'backslash\tletter',
+    '"quoted"',
+    "line\nanother", # real newline
+    "ends with slash\\",
+    '"starts with quote',
+    'ends with quote"',
+    "single'quote",
+);
+
+for my $fuzzstr (@fuzzstrs) {
+    is(Amanda::Util::unquote_string(Amanda::Util::quote_string($fuzzstr)), $fuzzstr,
+       "fuzz " . Dumper($fuzzstr));
+}
+
+# since users often provide quoted strings (e.g., in config files), test that chosen
+# quoted strings are correctly unquoted.  The need to quote the quoted strings for perl
+# makes this a little hard to read..
+my %unquote_checks = (
+    '""' => '',
+    'abcd' => 'abcd',
+    '"abcd"' => 'abcd',
+    '"\t"' => "\t",
+    '"\r"' => "\r",
+    '"\n"' => "\n",
+    '"\f"' => "\f",
+    '"\t"' => "\t",
+    '"\\\\n"' => '\n', # literal \
+    '"\\\\"' => "\\",
+    '"\""' => "\"",
+);
+
+while (my ($qstr, $uqstr) = each %unquote_checks) {
+    is(Amanda::Util::unquote_string($qstr), $uqstr,
+       "unquote " . Dumper($qstr));
+}
diff --git a/installcheck/Amanda_Xfer.pl b/installcheck/Amanda_Xfer.pl
new file mode 100644 (file)
index 0000000..86a33a2
--- /dev/null
@@ -0,0 +1,334 @@
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+use Test::More tests => 12;
+use File::Path;
+use strict;
+
+use lib "@amperldir@";
+use Installcheck::Run;
+use Amanda::Xfer qw( :constants );
+use Amanda::Device qw( :constants );
+use Amanda::Types;
+use Amanda::Debug;
+use Amanda::MainLoop;
+use Amanda::Paths;
+use Amanda::Config;
+
+# set up debugging so debug output doesn't interfere with test results
+Amanda::Debug::dbopen("installcheck");
+
+# and disable Debug's die() and warn() overrides
+Amanda::Debug::disable_die_override();
+
+# initialize configuration for the device API
+Amanda::Config::config_init(0, undef);
+
+{
+    my $RANDOM_SEED = 0xD00D;
+
+    my $xfer = Amanda::Xfer->new([
+       Amanda::Xfer::Source::Random->new(1024*1024, $RANDOM_SEED),
+       Amanda::Xfer::Filter::Xor->new(0), # key of 0 -> no change, so random seeds match
+       Amanda::Xfer::Dest::Null->new($RANDOM_SEED),
+    ]);
+
+    pass("Creating a transfer doesn't crash"); # hey, it's a start..
+
+    my $got_msg = "(not received)";
+    $xfer->get_source()->set_callback(sub {
+       my ($src, $msg, $xfer) = @_;
+       if ($msg->{type} == $XMSG_ERROR) {
+           die $msg->{elt} . " failed: " . $msg->{message};
+       }
+       if ($msg->{type} == $XMSG_INFO) {
+           $got_msg = $msg->{message};
+       }
+       elsif ($xfer->get_status() == $Amanda::Xfer::XFER_DONE) {
+           $src->remove();
+           Amanda::MainLoop::quit();
+       }
+    });
+    $xfer->start();
+    Amanda::MainLoop::run();
+    pass("A simple transfer runs to completion");
+    is($got_msg, "Is this thing on?",
+       "XMSG_INFO from Amanda::Xfer::Dest::Null has correct message");
+}
+
+{
+    my $RANDOM_SEED = 0xDEADBEEF;
+
+    my $xfer1 = Amanda::Xfer->new([
+       Amanda::Xfer::Source::Random->new(1024*1024, $RANDOM_SEED),
+       Amanda::Xfer::Dest::Null->new($RANDOM_SEED),
+    ]);
+    my $xfer2 = Amanda::Xfer->new([
+       Amanda::Xfer::Source::Random->new(1024*1024*3, $RANDOM_SEED),
+       Amanda::Xfer::Filter::Xor->new(0xf0),
+       Amanda::Xfer::Filter::Xor->new(0xf0),
+       Amanda::Xfer::Dest::Null->new($RANDOM_SEED),
+    ]);
+
+    my $cb = sub {
+       my ($src, $msg, $xfer) = @_;
+       if ($msg->{type} == $XMSG_ERROR) {
+           die $msg->{elt} . " failed: " . $msg->{message};
+       }
+       if  ($xfer1->get_status() == $Amanda::Xfer::XFER_DONE
+        and $xfer2->get_status() == $Amanda::Xfer::XFER_DONE) {
+           $xfer1->get_source()->remove();
+           $xfer2->get_source()->remove();
+           Amanda::MainLoop::quit();
+       }
+    };
+
+    $xfer1->get_source()->set_callback($cb);
+    $xfer2->get_source()->set_callback($cb);
+
+    $xfer1->start();
+    $xfer2->start();
+}
+# let the already-started transfers go out of scope before they 
+# complete, as a memory management test..
+Amanda::MainLoop::run();
+pass("Two simultaneous transfers run to completion");
+
+{
+    my $RANDOM_SEED = 0xD0DEEDAA;
+    my @elts;
+
+    # note that, because the Xor filter is flexible, assembling
+    # long pipelines can take an exponentially long time.  A 10-elt
+    # pipeline exercises the linking algorithm without wasting
+    # too many CPU cycles
+
+    push @elts, Amanda::Xfer::Source::Random->new(1024*1024, $RANDOM_SEED);
+    for my $i (1 .. 4) {
+       push @elts, Amanda::Xfer::Filter::Xor->new($i);
+       push @elts, Amanda::Xfer::Filter::Xor->new($i);
+    }
+    push @elts, Amanda::Xfer::Dest::Null->new($RANDOM_SEED);
+    my $xfer = Amanda::Xfer->new(\@elts);
+
+    my $cb = sub {
+       my ($src, $msg, $xfer) = @_;
+       if ($msg->{type} == $XMSG_ERROR) {
+           die $msg->{elt} . " failed: " . $msg->{message};
+       }
+       if ($xfer->get_status() == $Amanda::Xfer::XFER_DONE) {
+           $xfer->get_source()->remove();
+           Amanda::MainLoop::quit();
+       }
+    };
+
+    $xfer->get_source()->set_callback($cb);
+    $xfer->start();
+
+    Amanda::MainLoop::run();
+    pass("One 10-element transfer runs to completion");
+}
+
+
+{
+    my $read_filename = "$Amanda::Paths::AMANDA_TMPDIR/xfer-junk-src.tmp";
+    my $write_filename = "$Amanda::Paths::AMANDA_TMPDIR/xfer-junk-dest.tmp";
+    my ($rfh, $wfh);
+
+    mkdir($Amanda::Paths::AMANDA_TMPDIR) unless (-e $Amanda::Paths::AMANDA_TMPDIR);
+
+    # fill the file with some stuff
+    open($wfh, ">", $read_filename) or die("Could not open '$read_filename' for writing");
+    for my $i (1 .. 100) { print $wfh "line $i\n"; }
+    close($wfh);
+
+    open($rfh, "<", $read_filename) or die("Could not open '$read_filename' for reading");
+    open($wfh, ">", "$write_filename") or die("Could not open '$write_filename' for writing");
+
+    # now run a transfer out of it
+    my $xfer = Amanda::Xfer->new([
+       Amanda::Xfer::Source::Fd->new(fileno($rfh)),
+       Amanda::Xfer::Filter::Xor->new(0xde),
+       Amanda::Xfer::Filter::Xor->new(0xde),
+       Amanda::Xfer::Dest::Fd->new(fileno($wfh)),
+    ]);
+
+    my $cb = sub {
+       my ($src, $msg, $xfer) = @_;
+       if ($msg->{type} == $XMSG_ERROR) {
+           die $msg->{elt} . " failed: " . $msg->{message};
+       }
+       if ($xfer->get_status() == $Amanda::Xfer::XFER_DONE) {
+           $xfer->get_source()->remove();
+           Amanda::MainLoop::quit();
+       }
+    };
+
+    $xfer->get_source()->set_callback($cb);
+    $xfer->start();
+
+    Amanda::MainLoop::run();
+
+    close($wfh);
+    close($rfh);
+
+    # now verify the file contents are identical
+    open($rfh, "<", $read_filename);
+    my $src = do { local $/; <$rfh> };
+
+    open($rfh, "<", $write_filename);
+    my $dest = do { local $/; <$rfh> };
+
+    is($src, $dest, "Source::Fd and Dest::Fd read and write files");
+
+    unlink($read_filename);
+    unlink($write_filename);
+}
+
+# exercise device source and destination
+{
+    my $RANDOM_SEED = 0xFACADE;
+    my $xfer;
+
+    my $quit_cb = sub {
+       my ($src, $msg, $xfer) = @_;
+       if ($msg->{type} == $XMSG_ERROR) {
+           die $msg->{elt} . " failed: " . $msg->{message};
+       }
+       if ($xfer->get_status() == $Amanda::Xfer::XFER_DONE) {
+           $xfer->get_source()->remove();
+           Amanda::MainLoop::quit();
+       }
+    };
+
+    # set up vtapes
+    my $testconf = Installcheck::Run::setup();
+    $testconf->write();
+
+    # set up a device for slot 1
+    my $device = Amanda::Device->new("file:" . Installcheck::Run::load_vtape(1));
+    die("Could not open VFS device: " . $device->error())
+       unless ($device->status() == $DEVICE_STATUS_SUCCESS);
+
+    # write to it
+    my $hdr = Amanda::Types::dumpfile_t->new();
+    $hdr->{type} = $Amanda::Types::F_DUMPFILE;
+    $hdr->{name} = "installcheck";
+    $hdr->{disk} = "/";
+    $hdr->{datestamp} = "20080102030405";
+
+    $device->finish();
+    $device->start($ACCESS_WRITE, "TESTCONF01", "20080102030405");
+    $device->start_file($hdr);
+
+    $xfer = Amanda::Xfer->new([
+       Amanda::Xfer::Source::Random->new(1024*1024, $RANDOM_SEED),
+       Amanda::Xfer::Dest::Device->new($device, $device->block_size() * 10),
+    ]);
+
+    $xfer->get_source()->set_callback($quit_cb);
+    $xfer->start();
+
+    Amanda::MainLoop::run();
+    pass("write to a device (completed succesfully; data may not be correct)");
+
+    # finish up the file and device
+    ok(!$device->in_file(), "not in_file");
+    ok($device->finish(), "finish");
+
+    # now turn around and read from it
+    $device->start($ACCESS_READ, undef, undef);
+    $device->seek_file(1);
+
+    $xfer = Amanda::Xfer->new([
+       Amanda::Xfer::Source::Device->new($device),
+       Amanda::Xfer::Dest::Null->new($RANDOM_SEED),
+    ]);
+
+    $xfer->get_source()->set_callback($quit_cb);
+    $xfer->start();
+
+    Amanda::MainLoop::run();
+    pass("read from a device succeeded, too, and data was correct");
+}
+
+{
+    my $RANDOM_SEED = 0x5EAF00D;
+
+    # build a transfer that will keep going forever
+    my $xfer = Amanda::Xfer->new([
+       Amanda::Xfer::Source::Random->new(0, $RANDOM_SEED),
+       Amanda::Xfer::Filter::Xor->new(14),
+       Amanda::Xfer::Filter::Xor->new(14),
+       Amanda::Xfer::Dest::Null->new($RANDOM_SEED),
+    ]);
+
+    my $got_timeout = 0;
+    Amanda::MainLoop::timeout_source(200)->set_callback(sub {
+       my ($src) = @_;
+       $got_timeout = 1;
+       $src->remove();
+       $xfer->cancel();
+    });
+    $xfer->get_source()->set_callback(sub {
+       my ($src, $msg, $xfer) = @_;
+       if ($msg->{type} == $XMSG_ERROR) {
+           die $msg->{elt} . " failed: " . $msg->{message};
+       }
+       if ($xfer->get_status() == $Amanda::Xfer::XFER_DONE) {
+           $src->remove();
+           Amanda::MainLoop::quit();
+       }
+    });
+    $xfer->start();
+    Amanda::MainLoop::run();
+    ok($got_timeout, "A neverending transfer finishes after being cancelled");
+    # (note that this does not test all of the cancellation possibilities)
+}
+
+{
+    # build a transfer that will write to a read-only fd
+    my $read_filename = "$Amanda::Paths::AMANDA_TMPDIR/xfer-junk-src.tmp";
+    my $rfh;
+
+    # create the file
+    open($rfh, ">", $read_filename) or die("Could not open '$read_filename' for writing");
+
+    # open it for reading
+    open($rfh, "<", $read_filename) or die("Could not open '$read_filename' for reading");;
+
+    my $xfer = Amanda::Xfer->new([
+       Amanda::Xfer::Source::Random->new(0, 1),
+       Amanda::Xfer::Dest::Fd->new(fileno($rfh)),
+    ]);
+
+    my $got_error = 0;
+    $xfer->get_source()->set_callback(sub {
+       my ($src, $msg, $xfer) = @_;
+       if ($msg->{type} == $XMSG_ERROR) {
+           $got_error = 1;
+       }
+       if ($xfer->get_status() == $Amanda::Xfer::XFER_DONE) {
+           $src->remove();
+           Amanda::MainLoop::quit();
+       }
+    });
+    $xfer->start();
+    Amanda::MainLoop::run();
+    ok($got_error, "A transfer with an error cancels itself after sending an error");
+}
diff --git a/installcheck/Amconfig.pm.in b/installcheck/Amconfig.pm.in
deleted file mode 100644 (file)
index c2b78fd..0000000
+++ /dev/null
@@ -1,302 +0,0 @@
-# vim:ft=perl
-# Copyright (c) 2006 Zmanda Inc.  All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 as published
-# by the Free Software Foundation.
-#
-# 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.,
-# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-#
-# Contact information: Zmanda Inc, 505 N Mathlida Ave, Suite 120
-# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
-
-package Amconfig;
-use File::Path;
-use Carp;
-
-=head1 NAME
-
-Amconfig - set up amanda configurations for installcheck testing
-
-=head1 SYNOPSIS
-
-  use Amconfig;
-
-  my $testconf = Amconfig->new();
-  $testconf->add_param("runtapes", "5");
-  $testconf->add_subsec("tapetype", "DUCKTAPE", { length => "10G", filemark => "4096k" });
-  # ...
-  $testconf->write();
-
-The resulting configuration is always named "TESTCONF".  The basic
-configuration contains only a few parameters that are necessary just
-to run Amanda applications in the test environment.  It also contains
-a tapetype, C<TEST-TAPE>.
-
-Note that it's quite possible to produce an invalid configuration with this
-package (and, in fact, some of the tests do just that).
-
-=head2 VTAPES
-
-This module can set up a vtape configuration, replete with the proper
-vtape directories, using C<setup_vtape>.  The vtapes are created under
-the "TESTCONF" configuration directory, for ease of later deletion.  Do
-not store anything large in these vtapes!
-
-=head1 WARNING
-
-Using this module I<will> destroy any existing configuration named
-TESTDIR.  I<Please> do not use this on a production machine!
-
-=head1 FUNCTIONS
-
-=over
-
-=item C<new()>
-
-Create a new configuration object
-
-=cut
-
-sub new {
-    my $class = shift;
-
-    # An instance is a blessed hash containing parameters.  Start with
-    # some defaults to make sure things run.
-    my $infofile = '@CONFIG_DIR@/TESTCONF/curinfo';
-    my $logdir = '@CONFIG_DIR@/TESTCONF/log';
-    my $indexdir = '@CONFIG_DIR@/TESTCONF/index';
-
-    my $self = {
-       'infofile' => $infofile,
-       'logdir' => $logdir,
-       'indexdir' => $indexdir,
-
-       'vtapes' => [],
-
-       # Global params are stored as an arrayref, so that the same declaration
-       # can appear multiple times
-       'params' => [
-           'mailto' => '"nobody@invalidomain"',
-           'dumpuser' => '"' . (getpwuid($<))[0] . '"', # current username
-
-           # These dirs are under CONFIG_DIR just for ease of destruction.
-           # This is not a recommended layout!
-           'infofile' => "\"$infofile\"",
-           'logdir' => "\"$logdir\"",
-           'indexdir' => "\"$indexdir\"",
-
-           'tapetype' => '"TEST-TAPE"',
-       ],
-
-       # Subsections are stored as a hashref of arrayrefs, keyed by
-       # subsection name
-
-       'tapetypes' => {
-           'TEST-TAPE' => [
-               'length' => '50 mbytes',
-               'filemark' => '4 kbytes'
-           ],
-       },
-
-       'dumptypes' => { },
-
-       'interfaces' => { },
-
-       'holdingdisks' => { },
-
-       'dles' => [ ],
-    };
-    bless($self, $class);
-    return $self;
-}
-
-=item C<add_param($param, $value)>
-
-Add the given parameter to the configuration file, overriding any
-previous value.  Note that strings which should be quoted in the configuration
-file itself must be double-quoted here, e.g.,
-
-  $testconf->add_param('org' => '"MyOrganization"');
-
-=cut
-
-sub add_param {
-    my $self = shift;
-    my ($param, $value) = @_;
-
-    push @{$self->{'params'}}, $param, $value;
-}
-
-=item C<add_tapetype($name, $values_hashref)>
-=item C<add_dumptype($name, $values_hashref)>
-=item C<addholdingdisk($name, $values_hashref)>
-=item C<add_interface($name, $values_arrayref)>
-
-Add the given subsection to the configuration file, including all
-values in the arrayref.  The values should be specified as alternating
-key/value pairs.
-
-=cut
-
-sub add_tapetype {
-    my $self = shift;
-    my ($name, $values_arrayref) = @_;
-    $self->{'tapetypes'}{$name} = $values_arrayref;
-}
-
-sub add_dumptype {
-    my $self = shift;
-    my ($name, $values_arrayref) = @_;
-    $self->{'dumptypes'}{$name} = $values_arrayref;
-}
-
-sub add_holdingdisk {
-    my $self = shift;
-    my ($name, $values_arrayref) = @_;
-    $self->{'holdingdisks'}{$name} = $values_arrayref;
-}
-
-sub add_interface {
-    my $self = shift;
-    my ($name, $values_arrayref) = @_;
-    $self->{'interfaces'}{$name} = $values_arrayref;
-}
-
-=item C<add_dle($line)>
-
-Add a disklist entry; C<$line> is inserted verbatim into the disklist.
-
-=cut
-
-sub add_dle {
-    my $self = shift;
-    my ($line) = @_;
-    push @{$self->{'dles'}}, $line;
-}
-
-=item C<setup_vtape()>
-
-Set up to use a single vtape (no changer).  This creates the proper
-directory hierarchy and sets C<tapedev> to the relevant path.
-
-=cut
-
-sub setup_vtape {
-    my $self = shift;
-    my $tapepath = "@CONFIG_DIR@/TESTCONF/vtapes/tape1";
-    push @{$self->{'vtapes'}}, $tapepath;
-    
-    $self->add_param("tapedev", "\"file:$tapepath\"");
-}
-
-=item C<write()>
-
-Write out the accumulated configuration file, along with any other
-files necessary to run Amanda.
-
-=cut
-
-sub write {
-    my $self = shift;
-
-    my $testconf_dir = '@CONFIG_DIR@/TESTCONF';
-    if (-e $testconf_dir) {
-       rmtree($testconf_dir) or die("Could not remove '$testconf_dir'");
-    }
-    mkpath($testconf_dir);
-
-    # set up curinfo dir, etc.
-    mkpath($self->{'infofile'}) or die("Could not create infofile directory");
-    mkpath($self->{'logdir'}) or die("Could not create logdir directory");
-    mkpath($self->{'indexdir'}) or die("Could not create indexdir directory");
-
-    # create any vtapes
-    for my $vtape (@{$self->{'vtapes'}}) {
-       mkpath("$vtape/data") or die("Could not create vtape directory '$vtape/data'");
-    }
-
-    $self->_write_tapelist("$testconf_dir/tapelist");
-    $self->_write_disklist("$testconf_dir/disklist");
-    $self->_write_amanda_conf("$testconf_dir/amanda.conf");
-}
-
-sub _write_tapelist {
-    my $self = shift;
-    my ($filename) = @_;
-
-    # create an empty tapelist
-    open(my $tapelist, ">", $filename);
-    close($tapelist);
-}
-
-sub _write_disklist {
-    my $self = shift;
-    my ($filename) = @_;
-
-    # don't bother writing a disklist if there are no dle's
-    return unless $self->{'dles'};
-
-    open(my $disklist, ">", $filename);
-
-    for my $dle_line (@{$self->{'dles'}}) {
-       print $disklist "$dle_line\n";
-    }
-
-    close($disklist);
-}
-
-sub _write_amanda_conf {
-    my $self = shift;
-    my ($filename) = @_;
-
-    open my $amanda_conf, ">", $filename
-       or croak("Could not open '$filename'");
-
-    # write key/value pairs
-    my @params = @{$self->{'params'}};
-    while (@params) {
-       $param = shift @params;
-       $value = shift @params;
-       print $amanda_conf "$param $value\n";
-    }
-
-    # write out subsections
-    $self->_write_amanda_conf_subsection($amanda_conf, "tapetype", $self->{"tapetypes"});
-    $self->_write_amanda_conf_subsection($amanda_conf, "dumptype", $self->{"dumptypes"});
-    $self->_write_amanda_conf_subsection($amanda_conf, "interface", $self->{"interfaces"});
-    $self->_write_amanda_conf_subsection($amanda_conf, "holdingdisk", $self->{"holdingdisks"});
-
-    close($amanda_conf);
-}
-
-sub _write_amanda_conf_subsection {
-    my $self = shift;
-    my ($amanda_conf, $subsec_type, $subsec_ref) = @_;
-
-    for my $subsec_name (keys %$subsec_ref) {
-       my @values = @{$subsec_ref->{$subsec_name}};
-       
-       if ($subsec_type eq "holdingdisk") {
-           print $amanda_conf "\nholdingdisk $subsec_name {\n";
-       } else {
-           print $amanda_conf "\ndefine $subsec_type $subsec_name {\n";
-       }
-
-       while (@values) {
-           $param = shift @values;
-           $value = shift @values;
-           print $amanda_conf "$param $value\n";
-       }
-       print $amanda_conf "}\n";
-    }
-}
-
-1;
diff --git a/installcheck/Installcheck/Config.pm b/installcheck/Installcheck/Config.pm
new file mode 100644 (file)
index 0000000..f6b2f23
--- /dev/null
@@ -0,0 +1,416 @@
+# vim:ft=perl
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+package Installcheck::Config;
+use Amanda::Paths;
+use Amanda::Constants;
+use File::Path;
+use Carp;
+
+=head1 NAME
+
+Installcheck::Config - set up amanda configurations for installcheck testing
+
+=head1 SYNOPSIS
+
+  use Installcheck::Config;
+
+  my $testconf = Installcheck::Config->new();
+  $testconf->add_param("runtapes", "5");
+  $testconf->add_subsec("tapetype", "DUCKTAPE", { length => "10G", filemark => "4096k" });
+  # ...
+  $testconf->write();
+
+The resulting configuration is always named "TESTCONF".  The basic
+configuration contains only a few parameters that are necessary
+just to run Amanda applications in the test environment.  It also
+contains a tapetype, C<TEST-TAPE>.  To change tapetype parameters,
+call C<$cf->add_tapetype> with a new definition of C<TEST-TAPE>.
+
+Note that it's quite possible to produce an invalid configuration with this
+package (and, in fact, some of the tests do just that).
+
+=head1 WARNING
+
+Using this module I<will> destroy any existing configuration named
+TESTDIR.  I<Please> do not use this on a production machine!
+
+=head1 FUNCTIONS
+
+=over
+
+=item C<new()>
+
+Create a new configuration object
+
+=cut
+
+sub new {
+    my $class = shift;
+
+    # An instance is a blessed hash containing parameters.  Start with
+    # some defaults to make sure things run.
+    my $infofile = "$CONFIG_DIR/TESTCONF/curinfo";
+    my $logdir = "$CONFIG_DIR/TESTCONF/log";
+    my $indexdir = "$CONFIG_DIR/TESTCONF/index";
+
+    my $self = {
+       'infofile' => $infofile,
+       'logdir' => $logdir,
+       'indexdir' => $indexdir,
+
+       # Global params are stored as an arrayref, so that the same declaration
+       # can appear multiple times
+       'params' => [
+           'dumpuser' => '"' . (getpwuid($<))[0] . '"', # current username
+
+           # These dirs are under CONFIG_DIR just for ease of destruction.
+           # This is not a recommended layout!
+           'infofile' => "\"$infofile\"",
+           'logdir' => "\"$logdir\"",
+           'indexdir' => "\"$indexdir\"",
+
+           # (this is actually added while writing the config file, if not
+           # overridden by the caller)
+           # 'tapetype' => '"TEST-TAPE"',
+       ],
+
+       # global client config
+       'client_params' => [
+           'amandates' => "\"$AMANDA_TMPDIR/TESTCONF/amandates\"",
+           'gnutar_list_dir' => "\"$AMANDA_TMPDIR/TESTCONF/gnutar_listdir\"",
+       ],
+
+       # config-specific client config
+       'client_config_params' => [
+       ],
+
+       # Subsections are stored as a hashref of arrayrefs, keyed by
+       # subsection name
+
+       'tapetypes' => [ ],
+       'dumptypes' => [ ],
+       'interfaces' => [ ],
+       'holdingdisks' => [ ],
+       'application-tool' => [ ],
+       'script-tool' => [ ],
+       'devices' => [ ],
+       'changers' => [ ],
+
+       'dles' => [ ],
+    };
+    bless($self, $class);
+
+    $self->add_tapetype('TEST-TAPE', [
+       'length' => '50 mbytes',
+       'filemark' => '4 kbytes'
+    ]);
+    return $self;
+}
+
+=item C<add_param($param, $value)>
+
+Add the given parameter to the configuration file, overriding any
+previous value.  Note that strings which should be quoted in the configuration
+file itself must be double-quoted here, e.g.,
+
+  $testconf->add_param('org' => '"MyOrganization"');
+
+=cut
+
+sub add_param {
+    my $self = shift;
+    my ($param, $value) = @_;
+
+    push @{$self->{'params'}}, $param, $value;
+}
+
+=item C<add_client_param($param, $value)>, C<add_client_config_param($param, $value)>
+
+Add the given parameter to the client configuration file, overriding any
+previous value, as C<add_param> does for the server configuration file.
+C<add_client_param> addresses the global client configuration file, while
+C<add_client_config_param> inserts parmeters into
+C<TESTCONF/amanda-client.conf>.
+
+  $testconf->add_client_param('auth' => '"krb2"');
+  $testconf->add_client_config_param('client_username' => '"freddy"');
+
+=cut
+
+sub add_client_param {
+    my $self = shift;
+    my ($param, $value) = @_;
+
+    push @{$self->{'client_params'}}, $param, $value;
+}
+
+sub add_client_config_param {
+    my $self = shift;
+    my ($param, $value) = @_;
+
+    push @{$self->{'client_config_params'}}, $param, $value;
+}
+
+=item C<add_tapetype($name, $values_arrayref)>
+=item C<add_dumptype($name, $values_arrayref)>
+=item C<add_holdingdisk($name, $values_arrayref)>
+=item C<add_interface($name, $values_arrayref)>
+=item C<add_application($name, $values_arrayref)>
+=item C<add_script($name, $values_arrayref)>
+=item C<add_device($name, $values_arrayref)>
+=item C<add_changer($name, $values_arrayref)>
+
+Add the given subsection to the configuration file, including all
+values in the arrayref.  The values should be specified as alternating
+key/value pairs.
+
+=cut
+
+sub _add_subsec {
+    my $self = shift;
+    my ($subsec, $name, $values_arrayref) = @_;
+
+    # first delete any existing subsections with that name
+    @{$self->{$subsec}} = grep { $_->[0] ne $name } @{$self->{$subsec}};
+    
+    # and now push the new subsection definition on the end
+    push @{$self->{$subsec}}, [$name, @$values_arrayref];
+}
+
+sub add_tapetype {
+    my $self = shift;
+    $self->_add_subsec("tapetypes", @_);
+}
+
+sub add_dumptype {
+    my $self = shift;
+    $self->_add_subsec("dumptypes", @_);
+}
+
+sub add_holdingdisk {
+    my $self = shift;
+    $self->_add_subsec("holdingdisks", @_);
+}
+
+sub add_interface {
+    my $self = shift;
+    $self->_add_subsec("interfaces", @_);
+}
+
+sub add_application {
+    my $self = shift;
+    $self->_add_subsec("application-tool", @_);
+}
+
+sub add_script {
+    my $self = shift;
+    $self->_add_subsec("script-tool", @_);
+}
+
+sub add_device {
+    my $self = shift;
+    $self->_add_subsec("devices", @_);
+}
+
+sub add_changer {
+    my $self = shift;
+    $self->_add_subsec("changers", @_);
+}
+
+=item C<add_dle($line)>
+
+Add a disklist entry; C<$line> is inserted verbatim into the disklist.
+
+=cut
+
+sub add_dle {
+    my $self = shift;
+    my ($line) = @_;
+    push @{$self->{'dles'}}, $line;
+}
+
+=item C<write()>
+
+Write out the accumulated configuration file, along with any other
+files necessary to run Amanda.
+
+=cut
+
+sub write {
+    my $self = shift;
+
+    my $testconf_dir = "$CONFIG_DIR/TESTCONF";
+    if (-e $testconf_dir) {
+       rmtree($testconf_dir) or die("Could not remove '$testconf_dir'");
+    }
+    mkpath($testconf_dir);
+
+    # set up curinfo dir, etc.
+    mkpath($self->{'infofile'}) or die("Could not create infofile directory");
+    mkpath($self->{'logdir'}) or die("Could not create logdir directory");
+    mkpath($self->{'indexdir'}) or die("Could not create indexdir directory");
+    my $amandates = $AMANDA_TMPDIR . "/TESTCONF/amandates";
+    my $gnutar_listdir = $AMANDA_TMPDIR . "/TESTCONF/gnutar_listdir";
+    if (! -d $gnutar_listdir) {
+       mkpath($gnutar_listdir)
+           or die("Could not create '$gnutar_listdir'");
+    }
+
+    $self->_write_tapelist("$testconf_dir/tapelist");
+    $self->_write_disklist("$testconf_dir/disklist");
+    $self->_write_amanda_conf("$testconf_dir/amanda.conf");
+    $self->_write_amandates($amandates);
+    $self->_write_amanda_client_conf("$CONFIG_DIR/amanda-client.conf");
+    $self->_write_amanda_client_config_conf("$testconf_dir/amanda-client.conf");
+}
+
+sub _write_tapelist {
+    my $self = shift;
+    my ($filename) = @_;
+
+    # create an empty tapelist
+    open(my $tapelist, ">", $filename);
+    close($tapelist);
+}
+
+sub _write_disklist {
+    my $self = shift;
+    my ($filename) = @_;
+
+    # don't bother writing a disklist if there are no dle's
+    return unless $self->{'dles'};
+
+    open(my $disklist, ">", $filename);
+
+    for my $dle_line (@{$self->{'dles'}}) {
+       print $disklist "$dle_line\n";
+    }
+
+    close($disklist);
+}
+
+sub _write_amanda_conf {
+    my $self = shift;
+    my ($filename) = @_;
+
+    open my $amanda_conf, ">", $filename
+       or croak("Could not open '$filename'");
+
+    # write key/value pairs
+    my @params = @{$self->{'params'}};
+    my $saw_tapetype = 0;
+    while (@params) {
+       $param = shift @params;
+       $value = shift @params;
+       print $amanda_conf "$param $value\n";
+       $saw_tapetype = 1 if ($param eq "tapetype");
+    }
+
+    # tapetype is special-cased: if the user has not specified a tapetype, use "TEST-TAPE".
+    if (!$saw_tapetype) {
+       print $amanda_conf "tapetype \"TEST-TAPE\"\n";
+    }
+
+    # write out subsections
+    $self->_write_amanda_conf_subsection($amanda_conf, "tapetype", $self->{"tapetypes"});
+    $self->_write_amanda_conf_subsection($amanda_conf, "application-tool", $self->{"application-tool"});
+    $self->_write_amanda_conf_subsection($amanda_conf, "script-tool", $self->{"script-tool"});
+    $self->_write_amanda_conf_subsection($amanda_conf, "dumptype", $self->{"dumptypes"});
+    $self->_write_amanda_conf_subsection($amanda_conf, "interface", $self->{"interfaces"});
+    $self->_write_amanda_conf_subsection($amanda_conf, "holdingdisk", $self->{"holdingdisks"});
+    $self->_write_amanda_conf_subsection($amanda_conf, "device", $self->{"devices"});
+    $self->_write_amanda_conf_subsection($amanda_conf, "changer", $self->{"changers"});
+
+    close($amanda_conf);
+}
+
+sub _write_amanda_conf_subsection {
+    my $self = shift;
+    my ($amanda_conf, $subsec_type, $subsec_ref) = @_;
+
+    for my $subsec_info (@$subsec_ref) {
+       my ($subsec_name, @values) = @$subsec_info;
+       
+       if ($subsec_type eq "holdingdisk") {
+           print $amanda_conf "\nholdingdisk $subsec_name {\n";
+       } else {
+           print $amanda_conf "\ndefine $subsec_type $subsec_name {\n";
+       }
+
+       while (@values) {
+           $param = shift @values;
+           $value = shift @values;
+           print $amanda_conf "$param $value\n";
+       }
+       print $amanda_conf "}\n";
+    }
+}
+
+sub _write_amandates {
+    my $self = shift;
+    my ($filename) = @_;
+
+    # make sure the containing directory exists
+    mkpath($filename =~ /(^.*)\/amandates/);
+
+    # truncate the file to eliminate any interference from previous runs
+    open(my $amandates, ">", $filename) or die("Could not write to '$filename'");
+    close($amandates);
+}
+
+sub _write_amanda_client_conf {
+    my $self = shift;
+    my ($filename, $amandates, $gnutar_listdir) = @_;
+
+    # just an empty file for now
+    open(my $amanda_client_conf, ">", $filename) 
+       or croak("Could not write to '$filename'");
+
+    # write key/value pairs
+    my @params = @{$self->{'client_params'}};
+    while (@params) {
+       $param = shift @params;
+       $value = shift @params;
+       print $amanda_client_conf "$param $value\n";
+    }
+
+    close($amanda_client_conf);
+}
+
+sub _write_amanda_client_config_conf {
+    my $self = shift;
+    my ($filename, $amandates, $gnutar_listdir) = @_;
+
+    # just an empty file for now
+    open(my $amanda_client_conf, ">", $filename) 
+       or croak("Could not write to '$filename'");
+
+    # write key/value pairs
+    my @params = @{$self->{'client_config_params'}};
+    while (@params) {
+       $param = shift @params;
+       $value = shift @params;
+       print $amanda_client_conf "$param $value\n";
+    }
+
+    close($amanda_client_conf);
+}
+
+1;
diff --git a/installcheck/Installcheck/Run.pm b/installcheck/Installcheck/Run.pm
new file mode 100644 (file)
index 0000000..117cf01
--- /dev/null
@@ -0,0 +1,388 @@
+# vim:ft=perl
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+package Installcheck::Run;
+
+=head1 NAME
+
+Installcheck::Run - utilities to set up and run amanda dumps and restores
+
+=head1 SYNOPSIS
+
+  use Installcheck::Run;
+
+  my $testconf = Installcheck::Run::setup();
+  # make any modifications you'd like to the configuration
+  $testconf->write();
+
+  ok(Installcheck::Run::run('amdump', 'TESTCONF'), "amdump completes successfully");
+
+  # It's generally polite to clean up your mess, although the test
+  # framework will clean up if your tests crash
+  Installcheck::Run::cleanup();
+
+  SKIP: {
+    skip "Expect.pm not installed", 7
+       unless $Installcheck::Run::have_expect;
+
+    my $exp = Installcheck::Run::run_expect('amflush', 'TESTCONF');
+    $exp->expect(..);
+    # ..
+  }
+
+=head1 USAGE
+
+High-level tests generally depend on a full-scale run of Amanda --
+a fairly messy project.  This module simplifies that process by
+abstracting away the mess.  It takes care of:
+
+=over
+=item Setting up a holding disk;
+=item Setting up several vtapes; and
+=item Setting up a DLE pointing to a reasonably-sized subdirectory of the build directory.
+=back
+
+Most of this magic is in C<setup()>, which returns a configuration
+object from C<Installcheck::Config>, allowing the test to
+modify that configuration before writing it out.  The hostname
+for the DLE is "localhost", and the disk name is available in
+C<Installcheck::Run::diskname>.
+
+This module also provides a convenient Perlish interface for running
+Amanda commands: C<run($app, $args, ...)>.  This function uses the
+appropriate path to get to $app, and returns true if the application
+exited with a status of zero.  The stdout and stderr of the application
+are left in C<Installcheck::Run::stdout> and C<stderr>, respectively.
+
+To check that a run is successful, and return its stdout (chomped), use
+C<run_get($app, $args, ...)>.  This function returns C<''> if the application
+returns a nonzero exit status.  Similarly, C<run_err> checks that a run returns
+a nonzero exit status, and then returns its stderr, chomped.  If you need a
+different output file, use a bare C<run> followed by C<get_stderr> or
+C<get_stdout> as needed.
+
+C<run> and friends can be used whether or not this module's C<setup>
+was invoked.
+
+Finally, C<cleanup()> cleans up from a run, deleting all backed-up
+data, holding disks, and configuration.  It's just good-neighborly
+to call this before your test script exits.
+
+=head2 VTAPES
+
+This module sets up a configuration with three 10M vtapes, replete with
+the proper vtape directories.  These are controlled by C<chg-disk>.
+The tapes are not labeled, and C<label_new_tapes> is not set by
+default, although C<labelstr> is set to C<TESTCONF[0-9][0-9]>.
+
+The vtapes are created in a subdirectory of C<AMANDA_TMPDIR> for ease of later
+deletion.  The subdirectory is available from C<vtape_dir($slot)>.
+C<load_vtape($slot)> will "load" the indicated slot just like chg-disk would,
+and return the resulting path.
+
+=head2 HOLDING
+
+The holding disk is also stored under C<AMANDA_TMPDIR>.  It is a 15M
+holding disk, with a chunksize of 1M (to help exercise the chunker).
+
+=head2 DISKLIST
+
+The disklist is empty by default.  Use something like the following
+to add an entry:
+
+  $testconf->add_dle("localhost $diskname installcheck-test");
+
+The C<installcheck-test> dumptype specifies
+  auth "local"
+  compress none
+  program "GNUTAR"
+
+but of course, it can be modified by the test module.
+
+=head2 INTERACTIVE APPLICATIONS
+
+This package provides a rudimentary wrapper around C<Expect.pm>, which is not
+typically included in a perl installation.  Consult C<$have_expect> to see if
+this module is installed, and skip any Expect-based tests if it is not.
+
+Otherwise, C<run_expect> takes arguments just like C<run>, but returns an Expect
+object which you can use as you would like.
+
+=head2 DIAGNOSTICS
+
+If your test runs 'amdump', a nonzero exit status may not be very helpful.  The
+function C<amdump_diag> will attempt to figure out what went wrong and display
+useful information for the user via diag().  If it is given an argument, then
+it will C<BAIL_OUT> with that message, causing L<Test::Harness> to stop running
+tests.  Otherwise, it will simply die(), which will only terminate this
+particular test script.
+
+=cut
+
+use Installcheck::Config;
+use Amanda::Paths;
+use File::Path;
+use IPC::Open3;
+use Cwd qw(abs_path getcwd);
+use Carp;
+use Test::More;
+use Amanda::Config qw( :init );
+
+require Exporter;
+
+@ISA = qw(Exporter);
+@EXPORT_OK = qw(setup 
+    run run_get run_err
+    cleanup 
+    $diskname $stdout $stderr
+    amdump_diag);
+@EXPORT = qw(exp_continue exp_continue_timeout);
+
+# global variables
+our $stdout = '';
+our $stderr = '';
+
+our $have_expect;
+
+BEGIN {
+    eval "use Expect;";
+    if ($@) {
+       $have_expect = 0;
+       sub ignore() { };
+       *exp_continue = *ignore;
+       *exp_continue_timeout = *ignore;
+    } else {
+       $have_expect = 1;
+    }
+};
+
+# diskname is device-src, which, when full of object files, is about 4M in
+# my environment.  Consider creating a directory full of a configurable amount
+# of junk and pointing to that, to eliminate a potential point of variation in
+# tests.
+our $diskname = abs_path(getcwd() . "/../device-src");
+
+# common paths
+my $taperoot = "$AMANDA_TMPDIR/installcheck-vtapes";
+my $holdingdir ="$AMANDA_TMPDIR/installcheck-holding";
+
+sub setup {
+    my $testconf = Installcheck::Config->new();
+
+    setup_vtapes($testconf, 3);
+    setup_holding($testconf, 25);
+    setup_disklist($testconf);
+
+    return $testconf;
+}
+
+sub setup_vtapes {
+    my ($testconf, $ntapes) = @_;
+    if (-d $taperoot) {
+       rmtree($taperoot);
+    }
+
+    # make each of the tape directories
+    for (my $i = 1; $i < $ntapes+1; $i++) {
+       my $tapepath = "$taperoot/slot$i";
+       mkpath("$tapepath");
+    }
+
+    load_vtape(1);
+
+    # set up the appropriate configuration
+    $testconf->add_param("tapedev", "\"file:$taperoot\"");
+    $testconf->add_param("tpchanger", "\"chg-disk\"");
+    $testconf->add_param("changerfile", "\"$CONFIG_DIR/TESTCONF/ignored-filename\"");
+    $testconf->add_param("labelstr", "\"TESTCONF[0-9][0-9]\"");
+
+    # this overwrites the existing TEST-TAPE tapetype
+    $testconf->add_tapetype('TEST-TAPE', [
+       'length' => '20 mbytes',
+       'filemark' => '4 kbytes',
+    ]);
+}
+
+sub setup_holding {
+    my ($testconf, $mbytes) = @_;
+
+    if (-d $holdingdir) {
+       rmtree($holdingdir);
+    }
+    mkpath($holdingdir);
+
+    $testconf->add_holdingdisk("hd1", [
+       'directory' => "\"$holdingdir\"",
+       'use' => "$mbytes mbytes",
+       'chunksize' => "1 mbyte",
+    ]);
+}
+
+sub setup_disklist {
+    my ($testconf) = @_;
+    
+    $testconf->add_dumptype("installcheck-test", [
+       'auth' => '"local"',
+       'compress' => 'none',
+       'program' => '"GNUTAR"',
+    ]);
+}
+
+sub vtape_dir {
+    my ($slot) = @_;
+    my $tapepath = "$taperoot/slot$slot";
+}
+
+sub load_vtape {
+    my ($slot) = @_;
+
+    # make the data/ symlink from our taperoot
+    unlink("$taperoot/data");
+    symlink(vtape_dir($slot), "$taperoot/data")
+       or die("Could not create 'data' symlink: $!");
+
+    return $taperoot;
+}
+
+sub run {
+    my $app = shift;
+    my @args = @_;
+    my $errtempfile = "$AMANDA_TMPDIR/stderr$$.out";
+
+    # use a temporary file for error output -- this eliminates synchronization
+    # problems between reading stderr and stdout
+    local (*INFH, *OUTFH, *ERRFH);
+    open(ERRFH, ">", $errtempfile);
+
+    my $pid = IPC::Open3::open3("INFH", "OUTFH", ">&ERRFH",
+       "$sbindir/$app", @args);
+    
+    # immediately close the child's stdin
+    close(INFH);
+
+    # read from stdout until it's closed
+    $stdout = do { local $/; <OUTFH> };
+    close(OUTFH);
+
+    # and wait for the kid to die
+    waitpid $pid, 0 or croak("Error waiting for child process to die: $@");
+    my $status = $?;
+    close(ERRFH);
+
+    # fetch stderr from the temporary file
+    open(ERRFH, "<", "$errtempfile") or croak("Could not open '$errtempfile'");
+    $stderr = do { local $/; <ERRFH> };
+    close(ERRFH);
+    unlink($errtempfile);
+
+    # and return true if the exit status was zero
+    return ($status >> 8) == 0;
+}
+
+sub run_get {
+    if (!run @_) {
+       Test::More::diag("run unexpectedly failed; no output to compare");
+       return '';
+    }
+
+    chomp $stdout;
+    return $stdout;
+}
+
+sub run_err {
+    if (run @_) {
+       Test::More::diag("run unexpectedly succeeded; no output to compare");
+       return '';
+    }
+
+    chomp $stderr;
+    return $stderr;
+}
+
+sub get_stdout {
+    chomp $stdout;
+    return $stdout;
+}
+
+sub get_stderr {
+    chomp $stderr;
+    return $stderr;
+}
+
+sub cleanup {
+    if (-d $taperoot) {
+       rmtree($taperoot);
+    }
+    if (-d $holdingdir) {
+       rmtree($holdingdir);
+    }
+}
+
+sub run_expect {
+    my $app = shift;
+    my @args = @_;
+
+    die "Expect.pm not found" unless $have_expect;
+
+    my $exp = Expect->new("$sbindir/$app", @args);
+
+    return $exp;
+}
+
+sub amdump_diag {
+    my ($msg) = @_;
+
+    # try running amreport
+    my $report = "failure-report.txt";
+    unlink($report);
+    my @logfiles = <$CONFIG_DIR/TESTCONF/log/log.*>;
+    if (@logfiles > 0) {
+       run('amreport', 'TESTCONF', '-f', $report, '-l', $logfiles[$#logfiles]);
+       if (-f $report) {
+           open(my $fh, "<", $report) or return;
+           for my $line (<$fh>) {
+               Test::More::diag($line);
+           }
+           unlink($report);
+           goto bail;
+       }
+    }
+
+    # maybe there was a config error
+    config_init($CONFIG_INIT_EXPLICIT_NAME, "TESTCONF");
+    my ($cfgerr_level, @cfgerr_errors) = config_errors();
+    if ($cfgerr_level >= $CFGERR_WARNINGS) {
+       foreach (@cfgerr_errors) {
+           Test::More::diag($_);
+       }
+       goto bail;
+    }
+
+    # huh.
+    Test::More::diag("no amreport available, and no config errors");
+
+bail:
+    if ($msg) {
+       Test::More::BAIL_OUT($msg);
+    } else {
+       die("amdump failed; cannot continue");
+    }
+}
+
+1;
index bb3e938d9c43d372d204bf1ce86c01e424191f34..705d215cded4ef384d61f0815cf4b583fbc34bc9 100644 (file)
@@ -7,53 +7,103 @@ include $(top_srcdir)/config/automake/scripts.am
 # Add your tests here.
 
 common_tests = \
+       Amanda_Archive \
        Amanda_Config \
-       Amanda_Types
+       Amanda_Debug \
+       Amanda_MainLoop \
+       Amanda_Types \
+       Amanda_Util \
+       amarchiver
 
 server_tests = \
        Amanda_Changer \
+       Amanda_Changer_compat \
+       Amanda_Changer_disk \
+       Amanda_Changer_single \
        Amanda_Cmdline \
+       Amanda_DB_Catalog \
+       Amanda_Device \
        Amanda_Logfile \
-       amcheckdump \
+       Amanda_Tapelist \
+       Amanda_Process \
+       Amanda_Xfer \
+       bigint \
+       amgetconf \
+       amtapetype
+
+full_tests = \
        amdevcheck \
-       amgetconf
+       amcheckdump \
+       amdump \
+       amservice \
+       amstatus \
+       pp-scripts
+
+restore_tests = \
+       amfetchdump
 
+# tests requiring neither client nor server
 tests = $(common_tests)
+
+# tests requiring server
 if WANT_SERVER
 tests += $(server_tests)
 endif
 
-# Add any common files (that should not be run as tests) here:
-test_utils = Amconfig.pm
+# tests requiring a client and a server (any tests that run amdump)
+if WANT_SERVER
+if WANT_CLIENT
+tests += $(full_tests)
+endif
+endif
+
+# tests requiring a client and a server AND restore facilities (any tests that run amdump)
+if WANT_SERVER
+if WANT_CLIENT
+if WANT_RESTORE
+tests += $(restore_tests)
+endif
+endif
+endif
+
+# Add any common files (that should not be run as tests, and that do not
+# require configure-variable substitution) here:
+test_utils = Installcheck/Config.pm Installcheck/Run.pm
+EXTRA_DIST += $(test_utils)
 
-SCRIPTS_PERL = $(common_tests) $(server_tests) $(test_utils)
+CHECK_PERL_FLAGS=-I$(top_srcdir)/installcheck
+
+SCRIPTS_PERL = $(tests)
 
 # we don't need to syntax check the test scripts..
 CHECK_PERL =
 
 .PHONY: clobber_my_config_is_ok
 clobber_my_config_is_ok:
-       @if test "$(CLOBBER_MY_CONFIG)" != "OK"; then \
+       @if test "$(CONFIG_CLOBBER_MY_CONFIG)" != "OK" -a \
+                 "$(CLOBBER_MY_CONFIG)" != "OK"; then \
                echo ""; \
                echo "'make installcheck' is a dangerous tool.  It will overwrite your"; \
-               echo "amanda-client.conf and amandates, and (if it"; \
-               echo "triggers an as-yet undetected bug) may do other unexpected things.  You are"; \
-               echo "strongly encouraged"; \
+               echo "amanda-client.conf and amandates, and (if it triggers an as-yet undetected"; \
+               echo "bug) may do other unexpected things.  You are strongly encouraged"; \
                echo "  - not to run installchecks on a production install"; \
                echo "  - not to run installchecks as root"; \
                echo "See http://wiki.zmanda.com/index.php/Testing for instructions on setting up a"; \
-               echo "test environment in which"; \
-               echo "potential damage is limited by your filesystem's permissions.  To actually run"; \
-               echo "the installchecks, invoke make"; \
-               echo "as follows:"; \
+               echo "test environment in which potential damage is limited by your filesystem's"; \
+               echo "permissions.  To actually run the installchecks, invoke make as follows:"; \
                echo "  $(MAKE) CLOBBER_MY_CONFIG=OK installcheck"; \
                exit 1; \
        fi
 
 installcheck-local: clobber_my_config_is_ok $(SCRIPTS_PERL)
-       $(mkdir_p) $(AMANDA_TMPDIR)
-       $(PERL) -I$(srcdir) -I$(builddir) -e 'use Test::Harness qw(&runtests); runtests(@ARGV);' $(tests)
+       @$(mkdir_p) $(AMANDA_TMPDIR)
+       @if test -f "$(CONFIG_DIR)/amanda-client.conf" -a ! -f "$(CONFIG_DIR)/amanda-client.conf.install-backup"; then \
+           cp "$(CONFIG_DIR)/amanda-client.conf" "$(CONFIG_DIR)/amanda-client.conf.install-backup"; \
+       fi 
+       $(PERL) -I$(srcdir) -I. -e 'use Test::Harness qw(&runtests); runtests(@ARGV);' $(tests)
        rm -rf "$(CONFIG_DIR)/TESTCONF"
-       rm -rf "$(CONFIG_DIR)/amanda-client.conf"
-       rm -rf "$(DEFAULT_AMANDATES_FILE)"
-       rm -rf "$(GNUTAR_LISTED_INCREMENTAL_DIR)"
+       @if test -f "$(CONFIG_DIR)/amanda-client.conf.install-backup"; then \
+           mv -f "$(CONFIG_DIR)/amanda-client.conf.install-backup" "$(CONFIG_DIR)/amanda-client.conf"; \
+       fi
+       rm -rf "$(AMANDA_TMPDIR)/TESTCONF/amandates"
+       rm -rf "$(AMANDA_TMPDIR)/TESTCONF/gnutar_listdir"
index afbc373e6f06faa7742aff214ee9c08fbfdc222a..f492a48fe706b7358398f5203848a47ae662857e 100644 (file)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  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.
@@ -18,7 +18,7 @@
 # or just client.  Neither is sufficiently test-able on its own.
 
 # vim:ft=automake
-# Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
 # 
 # This library is free software; you can redistribute it and/or modify it
 # under the terms of the GNU Lesser General Public License version 2.1 as 
 # along with this library; if not, write to the Free Software Foundation,
 # Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
 # 
-# Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
-# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 
 # simple include file to pre-define variables which are then +='d by other
 # scripts in this directory.
 
 # vim:ft=automake
-# Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
 # 
 # This library is free software; you can redistribute it and/or modify it
 # under the terms of the GNU Lesser General Public License version 2.1 as 
@@ -55,8 +55,8 @@
 # along with this library; if not, write to the Free Software Foundation,
 # Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
 # 
-# Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
-# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 
 # SYNOPSIS:
 #
 # Files which support it are syntax-checked when the user invokes 'make check'.
 #
 # All *target* filenames must be listed in SCRIPTS_SHELL, SCRIPTS_PERL, and 
-# SCRIPTS_AWK to support 'make check', 'make dist', and 'make distclean'.
+# SCRIPTS_AWK to support 'make check', 'make dist', and 'make distclean'. No
+# files which are not substituted by config.status should be included in
+# SCRIPTS_PERL, SCRIPTS_SHELL, or SCRIPTS_AWK.  If non-generated files are listed
+# for installation, then Automake will figure out that they should be distributed;
+# otherwise, include them in EXTRA_DIST.
 #
 # USAGE:
 #
 #   SCRIPTS_PERL = fooscript barscript perl-lib.pl perlmod.pm
 #   SCRIPTS_SHELL = shell1 shell2 sh-lib.sh
 #   SCRIPTS_AWK = talk balk chalk awk-lib.awk
+#   sbin_SCRIPTS = not-subbed
+#   EXTRA_DIST = util-script.pl
 #
 # with the corresponding files in the repository:
 #
 #   fooscript.pl barscript.pl perl-lib.pl.in perlmod.pm.in
 #   shell1.sh shell2.sh sh-lib.sh.in
 #   talk.awk balk.awk chalk.awk awk-lib.awk.in
+#   not-subbed util-script.pl
 #
 # by default, all shell and perl scripts are syntax checked.  If this is
 # a problem (for example, perl scripts depending on Amanda extension 
@@ -120,11 +127,20 @@ target_triplet = @target@
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
        $(top_srcdir)/config/automake/scripts.am \
        $(top_srcdir)/config/automake/vars.am
+
+# tests requiring server
 @WANT_SERVER_TRUE@am__append_1 = $(server_tests)
+
+# tests requiring a client and a server (any tests that run amdump)
+@WANT_CLIENT_TRUE@@WANT_SERVER_TRUE@am__append_2 = $(full_tests)
+
+# tests requiring a client and a server AND restore facilities (any tests that run amdump)
+@WANT_CLIENT_TRUE@@WANT_RESTORE_TRUE@@WANT_SERVER_TRUE@am__append_3 = $(restore_tests)
 subdir = installcheck
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps =  \
        $(top_srcdir)/config/macro-archive/ac_define_dir.m4 \
+       $(top_srcdir)/config/macro-archive/ac_perl_module_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_perl_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_swig.m4 \
        $(top_srcdir)/config/macro-archive/ax_compare_version.m4 \
@@ -158,6 +174,7 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/amanda/libs.m4 \
        $(top_srcdir)/config/amanda/net.m4 \
        $(top_srcdir)/config/amanda/progs.m4 \
+       $(top_srcdir)/config/amanda/ps.m4 \
        $(top_srcdir)/config/amanda/readdir.m4 \
        $(top_srcdir)/config/amanda/readline.m4 \
        $(top_srcdir)/config/amanda/rsh-security.m4 \
@@ -180,7 +197,9 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/float_h.m4 \
        $(top_srcdir)/config/gnulib/fsusage.m4 \
        $(top_srcdir)/config/gnulib/getaddrinfo.m4 \
+       $(top_srcdir)/config/gnulib/getopt.m4 \
        $(top_srcdir)/config/gnulib/gettimeofday.m4 \
+       $(top_srcdir)/config/gnulib/gnulib-common.m4 \
        $(top_srcdir)/config/gnulib/gnulib-comp.m4 \
        $(top_srcdir)/config/gnulib/include_next.m4 \
        $(top_srcdir)/config/gnulib/inet_ntop.m4 \
@@ -208,7 +227,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/sys_stat_h.m4 \
        $(top_srcdir)/config/gnulib/sys_time_h.m4 \
        $(top_srcdir)/config/gnulib/tempname.m4 \
-       $(top_srcdir)/config/gnulib/ulonglong.m4 \
        $(top_srcdir)/config/gnulib/unistd_h.m4 \
        $(top_srcdir)/config/gnulib/vasnprintf.m4 \
        $(top_srcdir)/config/gnulib/visibility.m4 \
@@ -219,7 +237,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gettext-macros/lib-ld.m4 \
        $(top_srcdir)/config/gettext-macros/lib-link.m4 \
        $(top_srcdir)/config/gettext-macros/lib-prefix.m4 \
-       $(top_srcdir)/config/gettext-macros/longlong.m4 \
        $(top_srcdir)/config/gettext-macros/nls.m4 \
        $(top_srcdir)/config/gettext-macros/po.m4 \
        $(top_srcdir)/config/gettext-macros/progtest.m4 \
@@ -238,6 +255,7 @@ SOURCES =
 DIST_SOURCES =
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
+AIX_BACKUP = @AIX_BACKUP@
 ALLOCA = @ALLOCA@
 ALLOCA_H = @ALLOCA_H@
 AMANDA_DBGDIR = @AMANDA_DBGDIR@
@@ -252,8 +270,10 @@ AMPLOT_CAT_GZIP = @AMPLOT_CAT_GZIP@
 AMPLOT_CAT_PACK = @AMPLOT_CAT_PACK@
 AMPLOT_COMPRESS = @AMPLOT_COMPRESS@
 AMTAR = @AMTAR@
+APPLICATION_DIR = @APPLICATION_DIR@
 AR = @AR@
 ARPA_INET_H = @ARPA_INET_H@
+ASSERTIONS = @ASSERTIONS@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -265,16 +285,28 @@ BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@
 BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@
 BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@
 BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@
+BSDTCP_SECURITY = @BSDTCP_SECURITY@
+BSDUDP_SECURITY = @BSDUDP_SECURITY@
+BSD_SECURITY = @BSD_SECURITY@
 CAT = @CAT@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
+CHECK_USERID = @CHECK_USERID@
 CHIO = @CHIO@
 CHS = @CHS@
+CLIENT_HOST_INSTANCE = @CLIENT_HOST_INSTANCE@
+CLIENT_HOST_KEY_FILE = @CLIENT_HOST_KEY_FILE@
+CLIENT_HOST_PRINCIPAL = @CLIENT_HOST_PRINCIPAL@
 CLIENT_LOGIN = @CLIENT_LOGIN@
 CLIENT_SCRIPTS_OPT = @CLIENT_SCRIPTS_OPT@
 COMPRESS = @COMPRESS@
+COMPRESS_BEST_OPT = @COMPRESS_BEST_OPT@
+COMPRESS_FAST_OPT = @COMPRESS_FAST_OPT@
+COMPRESS_PATH = @COMPRESS_PATH@
+COMPRESS_SUFFIX = @COMPRESS_SUFFIX@
+CONFIG_CLOBBER_MY_CONFIG = @CONFIG_CLOBBER_MY_CONFIG@
 CONFIG_DIR = @CONFIG_DIR@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
@@ -288,6 +320,7 @@ DD = @DD@
 DEFAULT_AMANDATES_FILE = @DEFAULT_AMANDATES_FILE@
 DEFAULT_CHANGER_DEVICE = @DEFAULT_CHANGER_DEVICE@
 DEFAULT_CONFIG = @DEFAULT_CONFIG@
+DEFAULT_MAILER = @DEFAULT_MAILER@
 DEFAULT_SERVER = @DEFAULT_SERVER@
 DEFAULT_TAPE_DEVICE = @DEFAULT_TAPE_DEVICE@
 DEFAULT_TAPE_SERVER = @DEFAULT_TAPE_SERVER@
@@ -295,7 +328,7 @@ DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DOC_BUILD_DATE = @DOC_BUILD_DATE@
 DUMP = @DUMP@
-DUMPER_DIR = @DUMPER_DIR@
+DUMP_RETURNS_1 = @DUMP_RETURNS_1@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -308,6 +341,7 @@ F77 = @F77@
 FFLAGS = @FFLAGS@
 FLOAT_H = @FLOAT_H@
 GETCONF = @GETCONF@
+GETOPT_H = @GETOPT_H@
 GETTEXT = @GETTEXT@
 GLIB_CFLAGS = @GLIB_CFLAGS@
 GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
@@ -318,9 +352,12 @@ GMSGFMT_015 = @GMSGFMT_015@
 GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
 GNULIB_CHOWN = @GNULIB_CHOWN@
 GNULIB_DUP2 = @GNULIB_DUP2@
+GNULIB_ENVIRON = @GNULIB_ENVIRON@
 GNULIB_FCHDIR = @GNULIB_FCHDIR@
 GNULIB_FFLUSH = @GNULIB_FFLUSH@
+GNULIB_FOPEN = @GNULIB_FOPEN@
 GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
+GNULIB_FREOPEN = @GNULIB_FREOPEN@
 GNULIB_FSEEK = @GNULIB_FSEEK@
 GNULIB_FSEEKO = @GNULIB_FSEEKO@
 GNULIB_FTELL = @GNULIB_FTELL@
@@ -330,6 +367,7 @@ GNULIB_GETCWD = @GNULIB_GETCWD@
 GNULIB_GETDELIM = @GNULIB_GETDELIM@
 GNULIB_GETLINE = @GNULIB_GETLINE@
 GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
+GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@
 GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
 GNULIB_LCHOWN = @GNULIB_LCHOWN@
 GNULIB_LSEEK = @GNULIB_LSEEK@
@@ -354,8 +392,10 @@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
 GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
 GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
 GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
+GNULIB_PUTENV = @GNULIB_PUTENV@
 GNULIB_READLINK = @GNULIB_READLINK@
 GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@
+GNULIB_SETENV = @GNULIB_SETENV@
 GNULIB_SLEEP = @GNULIB_SLEEP@
 GNULIB_SNPRINTF = @GNULIB_SNPRINTF@
 GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@
@@ -364,11 +404,15 @@ GNULIB_STPNCPY = @GNULIB_STPNCPY@
 GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
 GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
 GNULIB_STRDUP = @GNULIB_STRDUP@
+GNULIB_STRERROR = @GNULIB_STRERROR@
 GNULIB_STRNDUP = @GNULIB_STRNDUP@
 GNULIB_STRNLEN = @GNULIB_STRNLEN@
 GNULIB_STRPBRK = @GNULIB_STRPBRK@
 GNULIB_STRSEP = @GNULIB_STRSEP@
+GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@
+GNULIB_STRSTR = @GNULIB_STRSTR@
 GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
+GNULIB_UNSETENV = @GNULIB_UNSETENV@
 GNULIB_VASPRINTF = @GNULIB_VASPRINTF@
 GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@
 GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
@@ -382,6 +426,7 @@ GOBJECT_QUERY = @GOBJECT_QUERY@
 GREP = @GREP@
 GZIP = @GZIP@
 HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@
+HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@
 HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@
 HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@
 HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
@@ -390,9 +435,10 @@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
 HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@
 HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
 HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
-HAVE_DECL_STRNCASECMP = @HAVE_DECL_STRNCASECMP@
+HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@
 HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
 HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
+HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@
 HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
 HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
 HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
@@ -400,7 +446,9 @@ HAVE_DUP2 = @HAVE_DUP2@
 HAVE_FSEEKO = @HAVE_FSEEKO@
 HAVE_FTELLO = @HAVE_FTELLO@
 HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
+HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
 HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
+HAVE_GZIP = @HAVE_GZIP@
 HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
 HAVE_IO_H = @HAVE_IO_H@
 HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
@@ -409,8 +457,10 @@ HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@
 HAVE_MEMPCPY = @HAVE_MEMPCPY@
 HAVE_MKDTEMP = @HAVE_MKDTEMP@
 HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@
+HAVE_OS_H = @HAVE_OS_H@
 HAVE_READLINK = @HAVE_READLINK@
 HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@
+HAVE_SETENV = @HAVE_SETENV@
 HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
 HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
 HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
@@ -418,7 +468,6 @@ HAVE_SLEEP = @HAVE_SLEEP@
 HAVE_STDINT_H = @HAVE_STDINT_H@
 HAVE_STPCPY = @HAVE_STPCPY@
 HAVE_STPNCPY = @HAVE_STPNCPY@
-HAVE_STRCASECMP = @HAVE_STRCASECMP@
 HAVE_STRCASESTR = @HAVE_STRCASESTR@
 HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
 HAVE_STRNDUP = @HAVE_STRNDUP@
@@ -427,10 +476,12 @@ HAVE_STRSEP = @HAVE_STRSEP@
 HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@
 HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
 HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
+HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
 HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
 HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
 HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
 HAVE_UNISTD_H = @HAVE_UNISTD_H@
+HAVE_UNSETENV = @HAVE_UNSETENV@
 HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
 HAVE_VASPRINTF = @HAVE_VASPRINTF@
 HAVE_VISIBILITY = @HAVE_VISIBILITY@
@@ -446,6 +497,8 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 INTLLIBS = @INTLLIBS@
 INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+KRB4_SECURITY = @KRB4_SECURITY@
+KRB5_SECURITY = @KRB5_SECURITY@
 LDFLAGS = @LDFLAGS@
 LEX = @LEX@
 LEXLIB = @LEXLIB@
@@ -462,6 +515,8 @@ LIBTHREAD = @LIBTHREAD@
 LIBTOOL = @LIBTOOL@
 LIBTOOL_DEPS = @LIBTOOL_DEPS@
 LN_S = @LN_S@
+LOCKING = @LOCKING@
+LOW_TCPPORTRANGE = @LOW_TCPPORTRANGE@
 LTLIBICONV = @LTLIBICONV@
 LTLIBINTL = @LTLIBINTL@
 LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
@@ -470,7 +525,6 @@ LTLIBPTH = @LTLIBPTH@
 LTLIBTHREAD = @LTLIBTHREAD@
 MAILER = @MAILER@
 MAKEINFO = @MAKEINFO@
-MAXTAPEBLOCKSIZE = @MAXTAPEBLOCKSIZE@
 MCUTIL = @MCUTIL@
 MKDIR_P = @MKDIR_P@
 MSGFMT = @MSGFMT@
@@ -506,26 +560,37 @@ PERL_INC = @PERL_INC@
 PKG_CONFIG = @PKG_CONFIG@
 POSUB = @POSUB@
 PRINT = @PRINT@
+PS = @PS@
+PS_ARGUMENT = @PS_ARGUMENT@
 PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
 RANLIB = @RANLIB@
 READLINE_LIBS = @READLINE_LIBS@
 REPLACE_CHOWN = @REPLACE_CHOWN@
 REPLACE_FCHDIR = @REPLACE_FCHDIR@
 REPLACE_FFLUSH = @REPLACE_FFLUSH@
+REPLACE_FOPEN = @REPLACE_FOPEN@
 REPLACE_FPRINTF = @REPLACE_FPRINTF@
+REPLACE_FREOPEN = @REPLACE_FREOPEN@
 REPLACE_FSEEK = @REPLACE_FSEEK@
 REPLACE_FSEEKO = @REPLACE_FSEEKO@
 REPLACE_FTELL = @REPLACE_FTELL@
 REPLACE_FTELLO = @REPLACE_FTELLO@
 REPLACE_GETCWD = @REPLACE_GETCWD@
 REPLACE_GETLINE = @REPLACE_GETLINE@
+REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
 REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
 REPLACE_LCHOWN = @REPLACE_LCHOWN@
 REPLACE_LSEEK = @REPLACE_LSEEK@
+REPLACE_MEMMEM = @REPLACE_MEMMEM@
 REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
 REPLACE_PRINTF = @REPLACE_PRINTF@
+REPLACE_PUTENV = @REPLACE_PUTENV@
 REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
 REPLACE_SPRINTF = @REPLACE_SPRINTF@
+REPLACE_STRCASESTR = @REPLACE_STRCASESTR@
+REPLACE_STRERROR = @REPLACE_STRERROR@
+REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@
+REPLACE_STRSTR = @REPLACE_STRSTR@
 REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
 REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
 REPLACE_VPRINTF = @REPLACE_VPRINTF@
@@ -533,7 +598,11 @@ REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
 REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
 REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
 RESTORE = @RESTORE@
+RSH_SECURITY = @RSH_SECURITY@
 SAMBA_CLIENT = @SAMBA_CLIENT@
+SERVER_HOST_INSTANCE = @SERVER_HOST_INSTANCE@
+SERVER_HOST_KEY_FILE = @SERVER_HOST_KEY_FILE@
+SERVER_HOST_PRINCIPAL = @SERVER_HOST_PRINCIPAL@
 SERVICE_SUFFIX = @SERVICE_SUFFIX@
 SETUID_GROUP = @SETUID_GROUP@
 SET_MAKE = @SET_MAKE@
@@ -543,6 +612,7 @@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
 SNAPSHOT_STAMP = @SNAPSHOT_STAMP@
 SORT = @SORT@
 SSH = @SSH@
+SSH_SECURITY = @SSH_SECURITY@
 STDBOOL_H = @STDBOOL_H@
 STDINT_H = @STDINT_H@
 STRIP = @STRIP@
@@ -552,7 +622,14 @@ SWIG_LIB = @SWIG_LIB@
 SYS_SOCKET_H = @SYS_SOCKET_H@
 SYS_STAT_H = @SYS_STAT_H@
 SYS_TIME_H = @SYS_TIME_H@
+TCPPORTRANGE = @TCPPORTRANGE@
+TICKET_LIFETIME = @TICKET_LIFETIME@
+UDPPORTRANGE = @UDPPORTRANGE@
+UNCOMPRESS_OPT = @UNCOMPRESS_OPT@
+UNCOMPRESS_PATH = @UNCOMPRESS_PATH@
+USE_AMANDAHOSTS = @USE_AMANDAHOSTS@
 USE_NLS = @USE_NLS@
+USE_RUNDUMP = @USE_RUNDUMP@
 USE_VERSION_SUFFIXES = @USE_VERSION_SUFFIXES@
 VDUMP = @VDUMP@
 VERSION = @VERSION@
@@ -561,6 +638,7 @@ VERSION_MAJOR = @VERSION_MAJOR@
 VERSION_MINOR = @VERSION_MINOR@
 VERSION_PATCH = @VERSION_PATCH@
 VERSION_SUFFIX = @VERSION_SUFFIX@
+VOID_UNSETENV = @VOID_UNSETENV@
 VRESTORE = @VRESTORE@
 VXDUMP = @VXDUMP@
 VXRESTORE = @VXRESTORE@
@@ -589,6 +667,7 @@ am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+amdatadir = @amdatadir@
 amincludedir = @amincludedir@
 amlibdir = @amlibdir@
 amlibexecdir = @amlibexecdir@
@@ -607,6 +686,8 @@ dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 gl_LIBOBJS = @gl_LIBOBJS@
 gl_LTLIBOBJS = @gl_LTLIBOBJS@
+gltests_LIBOBJS = @gltests_LIBOBJS@
+gltests_LTLIBOBJS = @gltests_LTLIBOBJS@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
@@ -636,10 +717,11 @@ target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 SUFFIXES = 
-EXTRA_DIST = 
+EXTRA_DIST = $(test_utils)
 BUILT_SOURCES = 
 MOSTLYCLEANFILES = 
 
@@ -647,7 +729,8 @@ MOSTLYCLEANFILES =
 CLEANFILES = config.log
 
 # and we'll need to clean up our generated files for distclean
-DISTCLEANFILES = $(SCRIPTS_SHELL) $(SCRIPTS_PERL) $(SCRIPTS_AWK)
+DISTCLEANFILES = $(SCRIPTS_SHELL) $(SCRIPTS_PERL) $(SCRIPTS_AWK) \
+       $(SCRIPTS_INCLUDE)
 MAINTAINERCLEANFILES = 
 
 # syntax-check shell scripts on 'make check'
@@ -655,22 +738,51 @@ CHECK_SHELL = $(SCRIPTS_SHELL)
 
 # Add your tests here.
 common_tests = \
+       Amanda_Archive \
        Amanda_Config \
-       Amanda_Types
+       Amanda_Debug \
+       Amanda_MainLoop \
+       Amanda_Types \
+       Amanda_Util \
+       amarchiver
 
 server_tests = \
        Amanda_Changer \
+       Amanda_Changer_compat \
+       Amanda_Changer_disk \
+       Amanda_Changer_single \
        Amanda_Cmdline \
+       Amanda_DB_Catalog \
+       Amanda_Device \
        Amanda_Logfile \
-       amcheckdump \
+       Amanda_Tapelist \
+       Amanda_Process \
+       Amanda_Xfer \
+       bigint \
+       amgetconf \
+       amtapetype
+
+full_tests = \
        amdevcheck \
-       amgetconf
+       amcheckdump \
+       amdump \
+       amservice \
+       amstatus \
+       pp-scripts
+
+restore_tests = \
+       amfetchdump
 
-tests = $(common_tests) $(am__append_1)
 
-# Add any common files (that should not be run as tests) here:
-test_utils = Amconfig.pm
-SCRIPTS_PERL = $(common_tests) $(server_tests) $(test_utils)
+# tests requiring neither client nor server
+tests = $(common_tests) $(am__append_1) $(am__append_2) \
+       $(am__append_3)
+
+# Add any common files (that should not be run as tests, and that do not
+# require configure-variable substitution) here:
+test_utils = Installcheck/Config.pm Installcheck/Run.pm
+CHECK_PERL_FLAGS = -I$(top_srcdir)/installcheck
+SCRIPTS_PERL = $(tests)
 
 # we don't need to syntax check the test scripts..
 CHECK_PERL = 
@@ -859,6 +971,11 @@ uninstall-am:
 %: %.pl $(top_builddir)/config.status
        $(top_builddir)/config.status --file=$@:$<
        chmod a+x $@
+       @if test -f $(top_builddir)/perl/.libs/libCmdline.so -o -f $(top_builddir)/perl/libCmdline.so; then \
+               grep -v '^use lib' $@ > $@.nouselib; \
+               $(PERL) $(CHECK_PERL_FLAGS) -I$(top_builddir)/perl -I$(top_builddir)/perl/.libs -I$(top_srcdir)/perl -c -w -T $@.nouselib || exit 1; \
+               rm $@.nouselib; \
+       fi
 
 %.pl: %.pl.in $(top_builddir)/config.status
        $(top_builddir)/config.status --file=$@:$<
@@ -884,13 +1001,27 @@ uninstall-am:
 
 # syntax-check perl scripts on 'make check'
 check-perl: $(CHECK_PERL)
+       @CHECK_PERL="$(CHECK_PERL)"; \
+       if test -f $(top_builddir)/perl/.libs/libCmdline.so -o -f $(top_builddir)/perl/libCmdline.so; then \
+               if test -n "$(PERL)"; then \
+                       for perlobj in $$CHECK_PERL; do \
+                               grep -v '^use lib' $$perlobj > $$perlobj.nouselib; \
+                               $(PERL) $(CHECK_PERL_FLAGS) -I$(top_builddir)/perl -I$(top_builddir)/perl/.libs -I$(top_srcdir)/perl -c -w -T $$perlobj.nouselib || exit 1; \
+                               rm $$perlobj.nouselib; \
+                       done; \
+               fi \
+       fi
+check-local: check-perl
+
+# syntax-check perl scripts on 'make installcheck'
+installcheck-perl: $(CHECK_PERL)
        @CHECK_PERL="$(CHECK_PERL)"; \
        if test -n "$(PERL)"; then \
                for perlobj in $$CHECK_PERL; do \
                        $(PERL) $(CHECK_PERL_FLAGS) -c -w -T $$perlobj || exit 1; \
                done; \
        fi
-check-local: check-perl
+installcheck-local: installcheck-perl
 check-shell: $(CHECK_SHELL)
        @CHECK_SHELL="$(CHECK_SHELL)"; \
        if test -n "$$CHECK_SHELL"; then \
@@ -930,30 +1061,33 @@ dist-hook: dist-scripts
 
 .PHONY: clobber_my_config_is_ok
 clobber_my_config_is_ok:
-       @if test "$(CLOBBER_MY_CONFIG)" != "OK"; then \
+       @if test "$(CONFIG_CLOBBER_MY_CONFIG)" != "OK" -a \
+                 "$(CLOBBER_MY_CONFIG)" != "OK"; then \
                echo ""; \
                echo "'make installcheck' is a dangerous tool.  It will overwrite your"; \
-               echo "amanda-client.conf and amandates, and (if it"; \
-               echo "triggers an as-yet undetected bug) may do other unexpected things.  You are"; \
-               echo "strongly encouraged"; \
+               echo "amanda-client.conf and amandates, and (if it triggers an as-yet undetected"; \
+               echo "bug) may do other unexpected things.  You are strongly encouraged"; \
                echo "  - not to run installchecks on a production install"; \
                echo "  - not to run installchecks as root"; \
                echo "See http://wiki.zmanda.com/index.php/Testing for instructions on setting up a"; \
-               echo "test environment in which"; \
-               echo "potential damage is limited by your filesystem's permissions.  To actually run"; \
-               echo "the installchecks, invoke make"; \
-               echo "as follows:"; \
+               echo "test environment in which potential damage is limited by your filesystem's"; \
+               echo "permissions.  To actually run the installchecks, invoke make as follows:"; \
                echo "  $(MAKE) CLOBBER_MY_CONFIG=OK installcheck"; \
                exit 1; \
        fi
 
 installcheck-local: clobber_my_config_is_ok $(SCRIPTS_PERL)
-       $(mkdir_p) $(AMANDA_TMPDIR)
-       $(PERL) -I$(srcdir) -I$(builddir) -e 'use Test::Harness qw(&runtests); runtests(@ARGV);' $(tests)
+       @$(mkdir_p) $(AMANDA_TMPDIR)
+       @if test -f "$(CONFIG_DIR)/amanda-client.conf" -a ! -f "$(CONFIG_DIR)/amanda-client.conf.install-backup"; then \
+           cp "$(CONFIG_DIR)/amanda-client.conf" "$(CONFIG_DIR)/amanda-client.conf.install-backup"; \
+       fi 
+       $(PERL) -I$(srcdir) -I. -e 'use Test::Harness qw(&runtests); runtests(@ARGV);' $(tests)
        rm -rf "$(CONFIG_DIR)/TESTCONF"
-       rm -rf "$(CONFIG_DIR)/amanda-client.conf"
-       rm -rf "$(DEFAULT_AMANDATES_FILE)"
-       rm -rf "$(GNUTAR_LISTED_INCREMENTAL_DIR)"
+       @if test -f "$(CONFIG_DIR)/amanda-client.conf.install-backup"; then \
+           mv -f "$(CONFIG_DIR)/amanda-client.conf.install-backup" "$(CONFIG_DIR)/amanda-client.conf"; \
+       fi
+       rm -rf "$(AMANDA_TMPDIR)/TESTCONF/amandates"
+       rm -rf "$(AMANDA_TMPDIR)/TESTCONF/gnutar_listdir"
 # 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/installcheck/amarchiver.pl b/installcheck/amarchiver.pl
new file mode 100644 (file)
index 0000000..15e3cad
--- /dev/null
@@ -0,0 +1,114 @@
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+use Test::More tests => 18;
+
+use lib "@amperldir@";
+use Installcheck::Run qw( run run_get );
+use Amanda::Paths;
+use Amanda::Constants;
+use File::Path qw( mkpath rmtree );
+
+my $tmpdir = "$AMANDA_TMPDIR/amarchiver-installcheck";
+my $archfile = "$tmpdir/test.amar";
+my $data = "abcd" x 500;
+my $fh;
+
+rmtree($tmpdir);
+mkpath($tmpdir);
+chdir($tmpdir);
+
+open($fh, ">", "test.tmp-1");
+print $fh $data;
+close($fh);
+
+open($fh, ">", "test.tmp-2");
+print $fh $data;
+close($fh);
+
+ok(run('amarchiver', '--version'),
+    "amarchiver --version OK");
+like($Installcheck::Run::stdout,
+    qr{^amarchiver },
+    "..and output is reasonable");
+
+# test creating archives
+
+ok(run('amarchiver', '--create', "test.tmp-1"),
+    "archive creation without --file succeeds");
+like($Installcheck::Run::stdout, qr{^AMANDA ARCHIVE FORMAT },
+    "..and produces something that looks like an archive");
+
+unlink($archfile);
+ok(run('amarchiver', '--create', '--file', $archfile,
+       "$sbindir/amarchiver", "$sbindir/amgetconf"),
+    "archive creation succeeds");
+ok(-f $archfile, "..and target file exists");
+
+unlink($archfile);
+ok(run('amarchiver', '--create', '--verbose', '--file', $archfile,
+       "$sbindir/amarchiver", "$sbindir/amgetconf"),
+    "archive creation with --verbose succeeds");
+like($Installcheck::Run::stdout,
+    qr{^\Q$sbindir\E/amarchiver\n\Q$sbindir\E/amgetconf$},
+    "..and output is correct");
+
+ok(run('amarchiver', '--create', '--verbose', $archfile),
+    "archive creation with --verbose and without --file succeeds");
+like($Installcheck::Run::stderr,
+    qr{$archfile},
+    "..and output goes to stderr");
+
+unlink($archfile);
+ok(run('amarchiver', '--create', '--verbose', '--verbose', '--file', $archfile,
+       "$sbindir/amarchiver", "$sbindir/amgetconf", "test.tmp-1"),
+    "archive creation with two --verbose args succeeds");
+like($Installcheck::Run::stdout,
+    qr{^[[:digit:]]+ \Q$sbindir\E/amarchiver\n[[:digit:]]+ \Q$sbindir\E/amgetconf\n2000 test.tmp-1$},
+    "..and output is correct");
+
+# test listing archives
+
+run('amarchiver', '--create', '--file', $archfile, "test.tmp-1", "test.tmp-2")
+    or BAIL_OUT("could not create an archive to test listing/extracting");
+
+ok(run('amarchiver', '--list', '--file', $archfile),
+    "archive listing succeeds");
+is($Installcheck::Run::stdout, "test.tmp-1\ntest.tmp-2\n",
+    "..and output is correct");
+
+# test extracting archives
+
+unlink("test.tmp-1.16");
+unlink("test.tmp-2.16");
+ok(run('amarchiver', '--extract', '--file', $archfile),
+    "archive extraction succeeds");
+ok((-f "test.tmp-1.16" && -f "test.tmp-2.16"), "..and the files reappear")
+    or diag(`find .`);
+
+unlink("test.tmp-1.16");
+unlink("test.tmp-2.16");
+ok(run('amarchiver', '--extract', '--file', $archfile, "test.tmp-2"),
+    "archive extraction of only one file succeeds");
+ok((! -f "test.tmp-1.16" && -f "test.tmp-2.16"), "..and the file reappears")
+    or diag(`find .`);
+
+END {
+    chdir("$tmpdir/..");
+    rmtree($tmpdir);
+}
index ff6a150cfdd62b3f2dcfbcb221f6667850634ff7..65919111ae49f191c7ee95402b78af17e8ae0c3d 100644 (file)
@@ -1,34 +1,98 @@
-use Test::More qw( no_plan );
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 
-use Amconfig;
+use Test::More tests => 9;
 
 use lib "@amperldir@";
+use Installcheck::Config;
+use Installcheck::Run qw(run run_get run_err $diskname);
 use Amanda::Paths;
 
-sub amcheckdump {
-    my $cmd = "$sbindir/amcheckdump " . join(" ", @_) . " 2>&1";
-    my $result = `$cmd`;
-    chomp $result;
-    return $result;
-}
-
 my $testconf;
 
 ##
 # First, try amgetconf out without a config
 
-like(amcheckdump(), qr/\AUSAGE:/i, 
-    "bare 'amcheckdump' gives usage message");
-like(amcheckdump("this-probably-doesnt-exist"), qr(could not open conf file)i, 
-    "error message when configuration parameter doesn't exist");
+ok(!run('amcheckdump'),
+    "amcheckdump with no arguments returns an error exit status");
+like($Installcheck::Run::stdout, qr/\AUSAGE:/i, 
+    ".. and gives usage message");
+
+like(run_err('amcheckdump', 'this-probably-doesnt-exist'), qr(could not open conf file)i, 
+    "run with non-existent config fails with an appropriate error message.");
 
 ##
-# Now use a config with a vtape
+# Now use a config with a vtape and without usetimestamps
 
-# this is re-created for each test
-$testconf = Amconfig->new();
-$testconf->setup_vtape();
+$testconf = Installcheck::Run::setup();
+$testconf->add_param('label_new_tapes', '"TESTCONF%%"');
+$testconf->add_param('usetimestamps', 'no');
+$testconf->add_dle("localhost $diskname installcheck-test");
 $testconf->write();
 
-like(amcheckdump("TESTCONF"), qr(could not find)i,
-     "'amcheckdump' on a brand-new config finds no dumps.");
+ok(run('amcheckdump', 'TESTCONF'),
+    "amcheckdump with a new config succeeds");
+like($Installcheck::Run::stdout, qr(could not find)i,
+     "..but finds no dumps.");
+
+BAIL_OUT("amdump failed")
+    unless run('amdump', 'TESTCONF');
+
+like(run_get('amcheckdump', 'TESTCONF'), qr(Validating),
+    "amcheckdump succeeds, claims to validate something (usetimestamps=no)");
+
+##
+# and check command-line handling
+
+like(run_get('amcheckdump', 'TESTCONF', '-oorg=installcheck'), qr(Validating),
+    "amcheckdump accepts '-o' options on the command line");
+
+##
+# And a config with usetimestamps enabled
+
+$testconf = Installcheck::Run::setup();
+$testconf->add_param('label_new_tapes', '"TESTCONF%%"');
+$testconf->add_param('usetimestamps', 'yes');
+$testconf->add_dle("localhost $diskname installcheck-test");
+$testconf->write();
+
+BAIL_OUT("amdump failed")
+    unless run('amdump', 'TESTCONF');
+
+like(run_get('amcheckdump', 'TESTCONF'), qr(Validating),
+    "amcheckdump succeeds, claims to validate something (usetimestamps=yes)");
+
+##
+# now try zeroing out the dumps
+
+my $vtape1 = Installcheck::Run::vtape_dir(1);
+opendir(my $vtape_dir, $vtape1) || die "can't opendir $vtape1: $!";
+@dump1 = grep { /^0+1/ } readdir($vtape_dir);
+closedir $vtape_dir;
+
+for my $dumpfile (@dump1) {
+    open(my $dumpfh, "+<", "$vtape1/$dumpfile");
+    sysseek($dumpfh, 32768, 0); # jump past the header
+    syswrite($dumpfh, "\0" x 100); # and write some zeroes
+    close($dumpfh);
+}
+
+ok(!run('amcheckdump', 'TESTCONF'),
+    "amcheckdump detects a failure from a zeroed-out dumpfile");
+
+Installcheck::Run::cleanup();
index 895f73a107e5891642c635b4614edb7939cd242e..f82e37dd5605af98a59dd5e0e58ce1bb8860b1fb 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2006 Zmanda Inc.  All Rights Reserved.
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License version 2 as published
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 #
-# Contact information: Zmanda Inc, 505 N Mathlida Ave, Suite 120
-# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 
-use Test::More qw( no_plan );
+use Test::More tests => 10;
 
-use Amconfig;
 use lib "@amperldir@";
+use Installcheck::Config;
+use Installcheck::Run qw(run run_get run_err $diskname);
 use Amanda::Paths;
 
-sub amdevcheck {
-    my $cmd = "$sbindir/amdevcheck " . join(" ", @_) . " 2>&1";
-    my $result = `$cmd`;
-    chomp $result;
-    return $result;
-}
-
 my $testconf;
 
 ##
 # First, try amgetconf out without a config
 
-like(amdevcheck(), qr(\AUsage: )i, 
-    "bare 'amdevcheck' gives usage message");
-like(amdevcheck("this-probably-doesnt-exist"), qr(could not open conf file)i, 
-    "error message when configuration parameter doesn't exist");
+ok(!run('amdevcheck'),
+    "'amdevcheck' with no arguments returns an error exit status");
+like($Installcheck::Run::stdout, qr(\AUsage: )i, 
+    ".. and gives usage message on stdout");
+
+like(run_err('amdevcheck', 'this-probably-doesnt-exist'), qr(could not open conf file)i, 
+    "if the configuration doesn't exist, fail with the correct message");
 
 ##
 # Next, work against a basically empty config
 
 # this is re-created for each test
-$testconf = Amconfig->new();
+$testconf = Installcheck::Config->new();
 $testconf->add_param("tapedev", '"/dev/null"');
 $testconf->write();
 
 # test some defaults
-like(amdevcheck('TESTCONF'), qr{File /dev/null is not a tape device},
-    "uses tapedev by default");
+ok(run('amdevcheck', 'TESTCONF'), "run succeeds with a /dev/null tapedev");
+is_deeply([ sort split "\n", $Installcheck::Run::stdout],
+         [ sort "MESSAGE File /dev/null is not a tape device", "DEVICE_ERROR"],
+         "Fail with correct message for a /dev/null tapedev");
 
 ##
 # Now use a config with a vtape
 
 # this is re-created for each test
-$testconf = Amconfig->new();
-$testconf->setup_vtape();
+$testconf = Installcheck::Run::setup();
+$testconf->add_param('label_new_tapes', '"TESTCONF%%"');
+$testconf->add_dle("localhost $diskname installcheck-test");
 $testconf->write();
 
-is_deeply([ sort split "\n", amdevcheck('TESTCONF') ],
-         [ sort "VOLUME_UNLABELED", "VOLUME_ERROR", "DEVICE_ERROR" ],
-    "empty vtape described as VOLUME_UNLABELED, VOLUME_ERROR, DEVICE_ERROR");
+ok(run('amdevcheck', 'TESTCONF'), "run succeeds with an unlabeled tape");
+is_deeply([ sort split "\n", $Installcheck::Run::stdout],
+         [ sort "MESSAGE Error loading device header -- unlabeled volume?", "VOLUME_UNLABELED", "DEVICE_ERROR", "VOLUME_ERROR"],
+         "..and output is correct");
 
-like(amdevcheck('TESTCONF', "/dev/null"), qr{File /dev/null is not a tape device},
+ok(run('amdevcheck', 'TESTCONF', "/dev/null"),
     "can override device on the command line");
+is_deeply([ sort split "\n", $Installcheck::Run::stdout],
+         [ sort "MESSAGE File /dev/null is not a tape device", "DEVICE_ERROR"],
+    ".. and produce a corresponding error message");
+
+BAIL_OUT("amdump failed")
+    unless run('amdump', 'TESTCONF');
+
+is_deeply([ sort split "\n", run_get('amdevcheck', 'TESTCONF') ],
+         [ sort "SUCCESS" ],
+    "used vtape described as SUCCESS");
+
+Installcheck::Run::cleanup();
diff --git a/installcheck/amdump.pl b/installcheck/amdump.pl
new file mode 100644 (file)
index 0000000..508e6e9
--- /dev/null
@@ -0,0 +1,65 @@
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+use Test::More tests => 2;
+
+use lib "@amperldir@";
+use Installcheck::Config;
+use Installcheck::Run qw(run run_err $diskname amdump_diag);
+use Amanda::Config qw( :init );
+use Amanda::Paths;
+
+my $testconf;
+
+# Just run amdump.
+
+$testconf = Installcheck::Run::setup();
+$testconf->add_param('label_new_tapes', '"TESTCONF%%"');
+
+# one program "GNUTAR"
+$testconf->add_dle(<<EODLE);
+localhost diskname1 $diskname {
+    installcheck-test
+    program "GNUTAR"
+}
+EODLE
+
+# and one with the amgtar application
+$testconf->add_dle(<<EODLE);
+localhost diskname2 $diskname {
+    installcheck-test
+    program "APPLICATION"
+    application {
+       plugin "amgtar"
+       property "ATIME-PRESERVE" "NO"
+    }
+}
+EODLE
+$testconf->write();
+
+ok(run('amdump', 'TESTCONF'), "amdump runs successfully")
+    or amdump_diag();
+
+# Dump a nonexistant client, and see amdump fail.
+$testconf = Installcheck::Run::setup();
+$testconf->add_dle('does-not-exist.example.com / installcheck-test');
+$testconf->write();
+
+ok(!run('amdump', 'TESTCONF'), "amdump fails with nonexistent client");
+
+Installcheck::Run::cleanup();
diff --git a/installcheck/amfetchdump.pl b/installcheck/amfetchdump.pl
new file mode 100644 (file)
index 0000000..05aea85
--- /dev/null
@@ -0,0 +1,152 @@
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+use Test::More tests => 7;
+
+use lib "@amperldir@";
+use Installcheck::Config;
+use Installcheck::Run qw(run run_get run_err $diskname);
+use File::Path qw(rmtree mkpath);
+use Amanda::Paths;
+use Cwd;
+
+my $testconf;
+my $dumpok;
+
+my $testdir = "$AMANDA_TMPDIR/amfetchdump-installcheck";
+rmtree($testdir);
+mkpath($testdir);
+
+my $origdir = getcwd;
+chdir($testdir);
+
+sub cleandir {
+    for my $filename (<$testdir/*>) {
+       unlink($filename);
+    }
+}
+
+$testconf = Installcheck::Run::setup();
+$testconf->add_param('label_new_tapes', '"TESTCONF%%"');
+$testconf->add_dle("localhost $diskname installcheck-test");
+$testconf->write();
+
+run('amdump', 'TESTCONF')
+    or BAIL_OUT("amdump run failed");
+
+like(run_err('amfetchdump', 'TESTCONF'),
+    qr{^Usage:},
+    "'amfetchdump TESTCONF' gives usage message on stderr");
+
+SKIP: {
+    skip "Expect.pm not installed", 2
+       unless $Installcheck::Run::have_expect;
+
+    cleandir();
+
+    my $exp = Installcheck::Run::run_expect('amfetchdump', 'TESTCONF', 'localhost');
+    $exp->log_stdout(0);
+
+    my @results;
+    $exp->expect(60,
+       [ qr{1 tape\(s\) needed for restoration}, sub {
+           push @results, "tapes-needed";
+           exp_continue;
+       } ],
+       [ qr{amfetchdump: 1: restoring FILE: date [[:digit:]]+ host localhost disk .*},
+       sub {
+           push @results, "restoring";
+           exp_continue;
+       } ],
+       [ 'Press enter when ready', sub {
+           push @results, "press-enter";
+           $exp->send("\n");
+           exp_continue;
+       }, ],
+       [ 'eof', sub {
+           push @results, "eof";
+       }, ],
+    );
+    is_deeply([ @results ], [ "tapes-needed", "press-enter", "restoring", "eof" ],
+             "simple restore follows the correct steps");
+
+    my @filenames = <localhost.*>;
+    is(scalar @filenames, 1, "..and restored file is present in testdir")
+       or diag(join("\n", @filenames));
+}
+
+{
+    cleandir();
+
+    ok(run('amfetchdump', '-a', 'TESTCONF', 'localhost'),
+       "run with -a successful");
+
+    my @filenames = <localhost.*>;
+    is(scalar @filenames, 1, "..and restored file is present in testdir")
+       or diag(join("\n", @filenames));
+}
+
+SKIP: {
+    skip "Expect.pm not installed", 2
+       unless $Installcheck::Run::have_expect;
+
+    cleandir();
+    chdir($AMANDA_TMPDIR);
+
+    my $exp = Installcheck::Run::run_expect('amfetchdump', '-O', $testdir, 'TESTCONF', 'localhost');
+    $exp->log_stdout(0);
+
+    my @results;
+    $exp->expect(60,
+       [ qr{1 tape\(s\) needed for restoration}, sub {
+           push @results, "tapes-needed";
+           exp_continue;
+       } ],
+       [ qr{amfetchdump: 1: restoring FILE: date [[:digit:]]+ host localhost disk .*},
+       sub {
+           push @results, "restoring";
+           exp_continue;
+       } ],
+       [ 'Press enter when ready', sub {
+           push @results, "press-enter";
+           $exp->send("\n");
+           exp_continue;
+       }, ],
+       [ 'eof', sub {
+           push @results, "eof";
+       }, ],
+    );
+    is_deeply([ @results ], [ "tapes-needed", "press-enter", "restoring", "eof" ],
+             "restore with -O follows the correct steps");
+
+    chdir($testdir);
+    my @filenames = <localhost.*>;
+    is(scalar @filenames, 1, "..and restored file is present in testdir")
+       or diag(join("\n", @filenames));
+}
+
+# TODO:
+# - test piping (-p),
+# - test compression (-c and -C)
+# - test a specified device (-d)
+# - test splits (regular, -w, -n)
+
+END {
+    chdir("$testdir/..");
+    rmtree($testdir);
+}
index 31ea2041366e446f01cf6481b7ca7be2701c6e48..1916a22884ca09249187892bc992c3b4fcdb8e10 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2006 Zmanda Inc.  All Rights Reserved.
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License version 2 as published
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 #
-# Contact information: Zmanda Inc, 505 N Mathlida Ave, Suite 120
-# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 
-use Test::More qw(no_plan);
+use Test::More tests => 78;
 
-use Amconfig;
 use lib "@amperldir@";
+use Installcheck::Config;
+use Installcheck::Run qw(run run_get run_err);
 use Amanda::Paths;
-
-# wrapper to call amgetconf and return the results
-sub amgetconf {
-    # open amgetconf and read from it
-    my $cmd = "$sbindir/amgetconf " . join(" ", @_) . " 2>&1";
-    my $result = `$cmd`;
-    chomp $result;
-    return $result;
-}
+use Cwd;
 
 # this is re-created for each test
 my $testconf;
@@ -37,136 +30,275 @@ my $testconf;
 ##
 # First, try amgetconf out without a config
 
-like(amgetconf(), qr(\AUsage: )i, 
-    "bare 'amgetconf' gives usage message");
-like(amgetconf("this-probably-doesnt-exist"), qr(could not open conf file)i, 
+ok(!run('amgetconf'), "bare amgetconf fails");
+like($Installcheck::Run::stdout, qr(\AUsage: )i, 
+    ".. and gives usage message on stdout");
+like(run_err('amgetconf', 'this-probably-doesnt-exist', 'tapedev'),
+    qr(could not open conf file)i, 
     "error message when configuration parameter doesn't exist");
 
 ##
 # Next, work against a basically empty config
 
-$testconf = Amconfig->new();
+$testconf = Installcheck::Config->new();
 $testconf->write();
 
 # test some defaults
-is(amgetconf('TESTCONF', "reserve"), "100", 
+is(run_get('amgetconf', 'TESTCONF', "reserve"), "100", 
     "reserve defaults to 100");
-is(amgetconf('TESTCONF', "tapelist"), "tapelist", 
+is(run_get('amgetconf', 'TESTCONF', "tapelist"), "tapelist", 
     "tapelist defaults to 'tapelist'");
-is(amgetconf('TESTCONF', "usetimestamps"), "yes", 
+is(run_get('amgetconf', 'TESTCONF', "usetimestamps"), "yes", 
     "usetimestamps defaults to 'yes'");
+is(run_get('amgetconf', 'TESTCONF', "send_amreport_on"), "ALL",
+    "send_amreport_on defaults to 'ALL'"); # (enum value is 0)
+is(run_get('amgetconf', 'TESTCONF', "taperalgo"), "FIRST",
+    "taperalgo defaults to 'ALL'"); # (enum value is 0)
+is(run_get('amgetconf', 'TESTCONF', "printer"), "",
+    "printer defaults to empty string, which is not an error");
+
+# test command-line parsing
+is(run_get('amgetconf', 'TESTCONF', '--execute-where', 'client', 'amandates'),
+   $Amanda::Constants::DEFAULT_AMANDATES_FILE,
+    "--execute-where client");
+is(run_get('amgetconf', 'TESTCONF', '--execute-where=client', 'amandates'),
+   $Amanda::Constants::DEFAULT_AMANDATES_FILE,
+    "--execute-where=client");
+is(run_get('amgetconf', 'TESTCONF', '--client', 'amandates'),
+   $Amanda::Constants::DEFAULT_AMANDATES_FILE,
+    "--client");
+
+is(run_get('amgetconf', 'TESTCONF', '--execute-where', 'server', 'reserve'), "100",
+    "--execute-where server");
+is(run_get('amgetconf', 'TESTCONF', '--execute-where=server', 'reserve'), "100",
+    "--execute-where=server");
+is(run_get('amgetconf', 'TESTCONF', '--execute-where=server', '--execute-where=server', 'reserve'), "100",
+    "--execute-where=server --execute-where=server");
+is(run_get('amgetconf', 'TESTCONF', '--execute-where=client', '--execute-where=client', 'amandates'),
+   $Amanda::Constants::DEFAULT_AMANDATES_FILE,
+    "--execute-where=client --execute-where=client");
+
+like(run_err('amgetconf', 'TESTCONF', '--execute-where=server', '--execute-where=client'),
+    qr/conflicts with/,
+    "handles conflict --execute-where=server --execute-where=client");
+like(run_err('amgetconf', 'TESTCONF', '--execute-where=client', '--execute-where=server'),
+    qr/conflicts with/,
+    "handles conflict --execute-where=client --execute-where=server");
+like(run_err('amgetconf', 'TESTCONF', '--execute-where=server', '--client'),
+     qr/conflicts with/,
+    "handles conflict --execute-where=server --client");
+like(run_err('amgetconf', 'TESTCONF', '--client', '--execute-where=server'),
+    qr/conflicts with/, 
+    "handles conflict --client --execute-where=server");
+
+is(run_get('amgetconf', 'TESTCONF', '-o', 'reserve=50', 'reserve'), "50",
+    "-o reserve=50");
+is(run_get('amgetconf', 'TESTCONF', '-oreserve=50', 'reserve'), "50",
+    "-oreserve=50");
+is(run_get('amgetconf', '-o', 'reserve=50', 'TESTCONF', 'reserve'), "50",
+    "-oreserve=50 before config name");
+is(run_get('amgetconf', 'TESTCONF', 'reserve', 'a', 'table', 'for', 'two', '-o', 'reserve=50'), "50",
+    "extra command-line arguments are ignored");
 
 # test a nonexistent parameter
-like(amgetconf('TESTCONF', "foos_per_bar"), qr/no such parameter/, 
-    "handles nonexistent parameters");
-
-# test build parameters (just the most common)
-is(amgetconf('TESTCONF', "build.bindir"), $bindir, "build.bindir is correct");
-is(amgetconf('TESTCONF', "build.sbindir"), $sbindir, "build.sbindir is correct");
-is(amgetconf('TESTCONF', "build.amlibexecdir"), $amlibexecdir, "build.amlibexecdir is correct");
-is(amgetconf('TESTCONF', "build.mandir"), $mandir, "build.mandir is correct");
-is(amgetconf('TESTCONF', "build.AMANDA_DBGDIR"), $AMANDA_DBGDIR, "build.AMANDA_DBGDIR is correct");
-is(amgetconf('TESTCONF', "build.AMANDA_TMPDIR"), $AMANDA_TMPDIR, "build.AMANDA_TMPDIR is correct");
-is(amgetconf('TESTCONF', "build.CONFIG_DIR"), $CONFIG_DIR, "build.CONFIG_DIR is correct");
+like(run_err('amgetconf', 'TESTCONF', "foos_per_bar"), qr/no such parameter/, 
+    "handles nonexistent parameters as an error");
+like(run_err('amgetconf', 'TESTCONF', "build.foos_per_bar"), qr/no such parameter/, 
+    "handles nonexistent build parameters as an error");
+
+# Test build parameters that we can determine easily.  Testing all parameters
+# would be more of a maintenance bother than a help.
+is(run_get('amgetconf', 'TESTCONF', "build.bindir"), $bindir,
+    "build.bindir is correct");
+is(run_get('amgetconf', 'TESTCONF', "build.sbindir"), $sbindir,
+    "build.sbindir is correct");
+is(run_get('amgetconf', 'TESTCONF', "build.libexecdir"), $libexecdir,
+    "build.libexecdir is correct");
+is(run_get('amgetconf', 'TESTCONF', "build.amlibexecdir"), $amlibexecdir,
+    "build.amlibexecdir is correct");
+is(run_get('amgetconf', 'TESTCONF', "build.mandir"), $mandir,
+    "build.mandir is correct");
+is(run_get('amgetconf', 'TESTCONF', "build.AMANDA_DBGDIR"), $AMANDA_DBGDIR,
+    "build.AMANDA_DBGDIR is correct");
+is(run_get('amgetconf', 'TESTCONF', "build.AMANDA_TMPDIR"), $AMANDA_TMPDIR,
+    "build.AMANDA_TMPDIR is correct");
+is(run_get('amgetconf', 'TESTCONF', "build.CONFIG_DIR"), $CONFIG_DIR,
+    "build.CONFIG_DIR is correct");
+is(run_get('amgetconf', 'TESTCONF', "build.__empty"), "",
+    "empty build variables handled correctly");
+
+like(run_err('amgetconf', 'TESTCONF', "build.bogus-param"), qr(no such parameter),
+    "bogus build parameters result in an error");
+
+is(run_get('amgetconf', 'TESTCONF', "build.config_dir"), $CONFIG_DIR, 
+    "build parameters are case-insensitive");
+
+is(run_get('amgetconf', "build.bindir"), $bindir, "build variables are available without a config");
+
+# empty --list should return nothing
+is_deeply([sort(+split(/\n/, run_get('amgetconf', 'TESTCONF', '--list', 'holdingdisk')))], [ ],
+       "--list returns an empty list when there's nothing to return");
 
 # dbopen, dbclose
-my $dbfile = amgetconf('TESTCONF', "dbopen.foo");
-like($dbfile, qr(^$AMANDA_DBGDIR/server/foo.[0-9]*.debug$),
+my $dbfile = run_get('amgetconf', 'TESTCONF', "dbopen.foo");
+chomp $dbfile;
+like($dbfile, qr(^\Q$AMANDA_DBGDIR\E/server/foo.[0-9]*.debug$),
     "'amgetconf dbopen.foo' returns a proper debug filename");
-ok(-f $dbfile,
-    "'amgetconf dbopen.foo' creates the debug file");
-like(amgetconf('TESTCONF', "dbclose.foo"), qr/cannot parse/,
-    "dbclose without filename fails");
-is(amgetconf('TESTCONF', "dbclose.foo:$dbfile"), $dbfile, 
-    "'amgetconf dbclose.foo:<filename>' returns the debug filename");
+SKIP: {
+    skip "dbopen didn't work, so I'll skip the rest", 3
+       unless (-f $dbfile);
+    ok(!run('amgetconf', 'TESTCONF', "dbclose.foo"),
+       "dbclose without filename fails");
+    is(run_get('amgetconf', 'TESTCONF', "dbclose.foo:$dbfile"), $dbfile, 
+       "'amgetconf dbclose.foo:<filename>' returns the debug filename");
+
+    # sometimes shell scripts pass a full path as appname..
+    $dbfile = run_get('amgetconf', 'TESTCONF', 'dbopen./sbin/foo');
+    like($dbfile, qr(^\Q$AMANDA_DBGDIR\E/server/_sbin_foo.[0-9]*.debug$),
+       "'amgetconf dbopen./sbin/foo' doesn't get confused by the slashes");
+}
 
 ##
 # Test an invalid config file
 
-$testconf = Amconfig->new();
+$testconf = Installcheck::Config->new();
 $testconf->add_param("foos_per_bar", "10");
 $testconf->write();
 
-like(amgetconf('TESTCONF', "foos_per_bar"), qr/errors processing config file/, 
+like(run_err('amgetconf', 'TESTCONF', "foos_per_bar"), qr/errors processing config file/, 
     "gives error on invalid configuration");
 
 ##
 # Now let's fill in some interesting values
 
-$testconf = Amconfig->new();
+$testconf = Installcheck::Config->new();
 $testconf->add_param("reserved-udp-port", '100,200');
 $testconf->add_param("printer", '"/dev/lp"');
 $testconf->add_param("reserve", '27');
 $testconf->write();
 
-is(amgetconf('TESTCONF', "reserved-udp-port"), "100,200", 
+is(run_get('amgetconf', 'TESTCONF', "reserved-udp-port"), "100,200", 
     "correctly returns intrange parameters from the file");
-is(amgetconf('TESTCONF', "printer"), "/dev/lp", 
+is(run_get('amgetconf', 'TESTCONF', "printer"), "/dev/lp", 
     "correctly returns string parameters from the file");
-is(amgetconf('TESTCONF', "reserve"), "27", 
+is(run_get('amgetconf', 'TESTCONF', "reserve"), "27", 
     "correctly returns integer parameters from the file");
-is(amgetconf('TESTCONF', "rEsErVe"), "27", 
+is(run_get('amgetconf', 'TESTCONF', "rEsErVe"), "27", 
     "is case-insensitive");
+is(run_get('amgetconf', 'TESTCONF', "reserved_udp_port"), "100,200", 
+    "treats _ and - identically");
+
+# check runs without a config
+my $olddir = getcwd();
+chdir("$CONFIG_DIR/TESTCONF") or die("Could not 'cd' to TESTCONF directory");
+is(run_get('amgetconf', "printer"), "/dev/lp", 
+    "uses current directory when no configuration name is given");
+chdir($olddir) or die("Could not 'cd' back to my original directory");
 
 ##
 # device_property can appear multiple times
 
-$testconf = Amconfig->new();
+$testconf = Installcheck::Config->new();
 $testconf->add_param("device_property", '"power" "on"');
 $testconf->add_param("device_property", '"turbo" "engaged"');
 $testconf->write();
 
-is_deeply([sort(+split(qr/\n/, amgetconf('TESTCONF', 'device_property')))],
+is_deeply([sort(+split(qr/\n/, run_get('amgetconf', 'TESTCONF', 'device_property')))],
          [sort('"power" "on"', '"turbo" "engaged"')],
     "device_property can have multiple values");
 
 ##
 # Subsections
 
-$testconf = Amconfig->new();
+$testconf = Installcheck::Config->new();
 $testconf->add_tapetype("cassette", [ length => "32 k" ]);
 $testconf->add_tapetype("reel2reel", [ length => "1 M" ]);
 $testconf->add_tapetype("scotch", [ length => "500 bytes" ]); # (use a sharpie)
 $testconf->add_dumptype("testdump", [ comment => '"testdump-dumptype"' ]);
 $testconf->add_interface("testiface", [ use => '10' ]);
 $testconf->add_holdingdisk("hd17", [ chunksize => '128' ]);
+$testconf->add_application('app_amgtar', [ plugin => '"amgtar"' ]);
+$testconf->add_application('app_amstar', [ plugin => '"amstar"' ]);
+$testconf->add_script('my_script', [ "execute-on" => 'pre-dle-amcheck', 'plugin' => '"foo"' ]);
+$testconf->add_device('my_device', [ "tapedev" => '"foo:/bar"' ]);
 $testconf->write();
 
-is_deeply([sort(+split(/\n/, amgetconf('TESTCONF', '--list', 'tapetype')))],
+is_deeply([sort(+split(/\n/, run_get('amgetconf', 'TESTCONF', '--list', 'tapetype')))],
          [sort("cassette", "reel2reel", "scotch", "TEST-TAPE")],
        "--list returns correct set of tapetypes");
-is(amgetconf('TESTCONF', 'tapetype:scotch:length'), '500', 
+is(run_get('amgetconf', 'TESTCONF', 'tapetype:scotch:length'), '500', 
     "returns tapetype parameter correctly");
 
-ok(grep { $_ eq 'testdump' } split(/\n/, amgetconf('TESTCONF', '--list', 'dumptype')),
+ok(scalar(grep { $_ eq 'testdump' } 
+       split(/\n/, 
+           run_get('amgetconf', 'TESTCONF', '--list', 'dumptype'))),
        "--list returns a test dumptype among the default dumptypes");
-is(amgetconf('TESTCONF', 'dumptype:testdump:comment'), 'testdump-dumptype', 
+is(run_get('amgetconf', 'TESTCONF', 'dumptype:testdump:comment'), 'testdump-dumptype', 
     "returns dumptype parameter correctly");
 
-is_deeply([sort(+split(/\n/, amgetconf('TESTCONF', '--list', 'interface')))],
+is_deeply([sort(+split(/\n/, run_get('amgetconf', 'TESTCONF', '--list', 'interface')))], 
           [sort("testiface", "default")],
        "--list returns correct set of interfaces");
-is(amgetconf('TESTCONF', 'interface:testiface:use'), '10', 
+is(run_get('amgetconf', 'TESTCONF', 'interface:testiface:use'), '10', 
     "returns interface parameter correctly");
 
-is_deeply([sort(+split(/\n/, amgetconf('TESTCONF', '--list', 'holdingdisk')))],
-         [sort("hd17")],
+is_deeply([sort(+split(/\n/, run_get('amgetconf', 'TESTCONF', '--list', 'holdingdisk')))], 
+         [sort("hd17")], 
        "--list returns correct set of holdingdisks");
-is(amgetconf('TESTCONF', 'holdingdisk:hd17:chunksize'), '128',
+is(run_get('amgetconf', 'TESTCONF', 'holdingdisk:hd17:chunksize'), '128',
     "returns holdingdisk parameter correctly");
 
+like(run_get('amgetconf', 'TESTCONF', '--list', 'build'), qr(.*version.*),
+       "'--list build' lists build variables");
+
+is_deeply([sort(+split(/\n/, run_get('amgetconf', 'TESTCONF', '--list', 'application-tool')))],
+          [sort("app_amgtar", "app_amstar")],
+        "--list returns correct set of application-tool");
+
+is(run_get('amgetconf', 'TESTCONF', 'application-tool:app_amgtar:plugin'), 'amgtar',
+    "returns application-tool parameter correctly");
+
+is_deeply([sort(+split(/\n/, run_get('amgetconf', 'TESTCONF', '--list', 'script-tool')))],
+          [sort("my_script")],
+        "--list returns correct set of script-tool");
+
+is(run_get('amgetconf', 'TESTCONF', 'script-tool:my_script:execute-on'), 'PRE-DLE-AMCHECK',
+    "returns script-tool parameter correctly");
+is(run_get('amgetconf', 'TESTCONF', 'script_tOOl:my_script:execute-on'), 'PRE-DLE-AMCHECK',
+    "insensitive to case in subsec_type");
+is(run_get('amgetconf', 'TESTCONF', 'script-tool:my_script:execute-on'), 'PRE-DLE-AMCHECK',
+    "insensitive to -/_ in subsec_type");
+is(run_get('amgetconf', 'TESTCONF', 'script_tOOl:my_script:eXECute-on'), 'PRE-DLE-AMCHECK',
+    "insensitive to case in subsec_key");
+is(run_get('amgetconf', 'TESTCONF', 'script-tool:my_script:execute_on'), 'PRE-DLE-AMCHECK',
+    "insensitive to -/_ in subsec_key");
+
+is_deeply([sort(split(/\n/, run_get('amgetconf', 'TESTCONF', '--list', 'device')))],
+          [sort("my_device")],
+        "--list returns correct set of devices");
+
+is(run_get('amgetconf', 'TESTCONF', 'device:my_device:tapedev'), 'foo:/bar',
+    "returns device parameter correctly");
+
 # non-existent subsection types, names, and parameters
-like(amgetconf('TESTCONF', 'NOSUCHTYPE:testiface:comment'), qr/no such parameter/, 
+like(run_err('amgetconf', 'TESTCONF', 'NOSUCHTYPE:testiface:comment'), qr/no such parameter/, 
     "handles bad subsection type");
-like(amgetconf('TESTCONF', 'dumptype:NOSUCHDUMP:comment'), qr/no such parameter/, 
+like(run_err('amgetconf', 'TESTCONF', 'dumptype:NOSUCHDUMP:comment'), qr/no such parameter/, 
     "handles bad dumptype namek");
-like(amgetconf('TESTCONF', 'dumptype:testdump:NOSUCHPARAM'), qr/no such parameter/, 
+like(run_err('amgetconf', 'TESTCONF', 'dumptype:testdump:NOSUCHPARAM'), qr/no such parameter/, 
     "handles bad dumptype parameter name");
+like(run_err('amgetconf', 'TESTCONF', 'application-tool:app_amgtar:NOSUCHPARAM'), qr/no such parameter/, 
+    "handles bad application-tool parameter name");
+like(run_err('amgetconf', 'TESTCONF', 'script-tool:my-script:NOSUCHPARAM'), qr/no such parameter/, 
+    "handles bad script-tool parameter name");
+
+like(run_err('amgetconf', 'TESTCONF', '--list', 'frogs'), qr/no such parameter/,
+        "--list fails given an invalid subsection name");
 
 ##
 # exclude lists are a bit funny, too
 
-$testconf = Amconfig->new();
+$testconf = Installcheck::Config->new();
 $testconf->add_dumptype("testdump", [
     "exclude file optional" => '"f1"', # this optional will have no effect
     "exclude file append" => '"f2"',
@@ -177,13 +309,14 @@ $testconf->add_dumptype("testdump", [
     ]);
 $testconf->write();
 
-is_deeply([sort(+split(qr/\n/, amgetconf('TESTCONF', 'dumptype:testdump:exclude')))],
+is_deeply([sort(+split(qr/\n/, run_get('amgetconf', 'TESTCONF', 'dumptype:testdump:exclude')))],
          [sort('FILE "f1" "f2"',
                'LIST "l1" "l2"')],
     "exclude files and lists displayed correctly; a non-final optional is ignored");
 
-is_deeply([sort(+split(qr/\n/, amgetconf('TESTCONF', 'dumptype:testdump:include')))],
+is_deeply([sort(+split(qr/\n/, run_get('amgetconf', 'TESTCONF', 'dumptype:testdump:include')))],
          [sort('FILE OPTIONAL "ifo"',
                'LIST OPTIONAL "ilo"')],
     "a final 'OPTIONAL' makes the whole include/exclude optional")
 
+
diff --git a/installcheck/amservice.pl b/installcheck/amservice.pl
new file mode 100644 (file)
index 0000000..27d1df2
--- /dev/null
@@ -0,0 +1,105 @@
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+use Test::More tests => 3;
+
+use lib "@amperldir@";
+use Installcheck::Run qw( run run_get );
+use Amanda::Paths;
+use Amanda::Constants;
+
+my $input_filename = "$AMANDA_TMPDIR/amservice_input.txt";
+my $testconf = Installcheck::Run::setup();
+my $input;
+
+sub write_input_file {
+    my ($contents) = @_;
+    open my $fh, ">", $input_filename
+       or die("Could not write to $input_filename");
+    print $fh $contents;
+    close $fh;
+}
+
+sub all_lines_ok {
+    my ($output) = @_;
+    my $ok = 1;
+
+    return 0 if not $output;
+
+    for (split /\n/, $output) {
+       next if /^OPTIONS /;
+       next if /^OK /;
+       diag "Got unexpected line: $_";
+       $ok = 0;
+    }
+
+    return $ok;
+}
+
+# a simple run of amservice to begin with
+like(run_get('amservice', '-f', '/dev/null', 'localhost', 'local', 'noop'),
+    qr/^OPTIONS features=/,
+    "amservice runs noop successfully");
+
+$input = <<EOF;
+<dle>
+  <program>GNUTAR</program>
+  <disk>$AMANDA_TMPDIR</disk>
+</dle>
+EOF
+
+SKIP: {
+    skip "GNUTAR not installed", 1 unless $Amanda::Constants::GNUTAR;
+    write_input_file($input);
+    ok(all_lines_ok(
+       run_get('amservice', '-f', $input_filename, 'localhost', 'local', 'selfcheck')),
+       "GNUTAR program selfchecks successfully");
+}
+
+# (can't test DUMP, since we don't have a device)
+
+$input = <<EOF;
+<dle>
+  <program>APPLICATION</program>
+  <backup-program>
+    <plugin>amgtar</plugin>
+  </backup-program>
+  <disk>$AMANDA_TMPDIR</disk>
+</dle>
+EOF
+
+SKIP: {
+    skip "GNUTAR not installed", 1 unless $Amanda::Constants::GNUTAR;
+    write_input_file($input);
+    ok(all_lines_ok(
+       run_get('amservice', '-f', $input_filename, 'localhost', 'local', 'selfcheck')),
+       "amgtar application selfchecks successfully");
+}
+
+$input = <<EOF;
+<dle>
+  <program>APPLICATION</program>
+  <backup-program>
+    <plugin>amstar</plugin>
+  </backup-program>
+  <disk>$AMANDA_TMPDIR</disk>
+</dle>
+EOF
+
+Installcheck::Run::cleanup();
+unlink($input_filename);
diff --git a/installcheck/amstatus.pl b/installcheck/amstatus.pl
new file mode 100644 (file)
index 0000000..bd165f8
--- /dev/null
@@ -0,0 +1,314 @@
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+use Test::More tests => 7;
+
+use lib "@amperldir@";
+use Installcheck::Run qw( run run_get );
+use Amanda::Paths;
+use Amanda::Constants;
+
+my $filename="$AMANDA_TMPDIR/installcheck-amdump.1";
+my $testconf = Installcheck::Run::setup();
+$testconf->write();
+
+# read __DATA__ to a hash, keyed by the names following '%%%%'
+my %logfiles;
+my $key = undef;
+while (<DATA>) {
+    if (/^%%%% (.*)/) {
+       $key = $1;
+    } else {
+       $logfiles{$key} .= $_;
+    }
+}
+
+sub write_logfile {
+    my ($data) = @_;
+    open(my $fh, ">", $filename) or die("Could not open '$filename' for writing");
+    print $fh $data;
+    close($fh);
+};
+
+## try a few various options with a pretty normal logfile
+
+write_logfile($logfiles{'normal'});
+
+ok(run('amstatus', 'TESTCONF', '--file', $filename),
+    "plain amstatus runs without error");
+like($Installcheck::Run::stdout,
+    qr{clienthost:/some/dir\s*0\s*100k\s*finished\s*\(13:01:53\)},
+    "output is reasonable");
+
+ok(run('amstatus', 'TESTCONF', '--file', $filename, '--summary'),
+    "amstatus --summary runs without error");
+unlike($Installcheck::Run::stdout,
+    qr{clienthost:/some/dir\s*0\s*100k\s*finished\s*\(13:01:53\)},
+    "output does not contain the finished dump");
+like($Installcheck::Run::stdout,
+    qr{taped\s+:\s+1\s+},
+    "output contains summary info");
+
+## now test a file with spaces and other funny characters in filenames
+
+write_logfile($logfiles{'quoted'});
+
+ok(run('amstatus', 'TESTCONF', '--file', $filename),
+    "amstatus runs without error with quoted disknames");
+like($Installcheck::Run::stdout,
+    # note that amstatus' output is quoted, so backslashes are doubled
+    qr{clienthost:"C:\\\\Some Dir\\\\"\s*0\s*100k\s*finished\s*\(13:01:53\)},
+    "output is correct");
+
+unlink($filename);
+
+__DATA__
+%%%% normal
+amdump: start at Wed Jun 18 13:01:47 EDT 2008
+amdump: datestamp 20080618
+amdump: starttime 20080618130147
+amdump: starttime-locale-independent 2008-06-18 13:01:47 EDT
+planner: pid 4079 executable /path/to/planner version 9.8.7
+READING CONF INFO...
+planner: timestamp 20080618130147
+planner: time 0.000: startup took 0.000 secs
+
+SENDING FLUSHES...
+ENDFLUSH
+
+SETTING UP FOR ESTIMATES...
+planner: time 0.000: setting up estimates for clienthost:/some/dir
+clienthost:/some/dir overdue 14049 days for level 0
+setup_estimate: clienthost:/some/dir: command 0, options: none    last_level -1 next_level0 -14049 level_days 0    getting estimates 0 (-2) -1 (-2) -1 (-2)
+planner: time 0.000: setting up estimates took 0.000 secs
+
+GETTING ESTIMATES...
+driver: pid 4080 executable /path/to/driver version 9.8.7
+driver: adding holding disk 0 dir /holding size 868352 chunksize 1048576
+reserving 0 out of 868352 for degraded-mode dumps
+driver: send-cmd time 0.015 to taper: START-TAPER 20080618130147
+taper: pid 4084 executable taper version 9.8.7
+driver: started dumper0 pid 4086
+driver: send-cmd time 0.031 to dumper0: START 20080618130147
+planner: time 0.050: got partial result for host clienthost disk /some/dir: 0 -> -2K, -1 -> -2K, -1 -> -2K
+dumper: pid 4090 executable dumper1 version 9.8.7
+driver: started dumper1 pid 4090
+driver: send-cmd time 0.046 to dumper1: START 20080618130147
+driver: started dumper2 pid 4094
+driver: send-cmd time 0.048 to dumper2: START 20080618130147
+driver: started dumper3 pid 4095
+driver: send-cmd time 0.059 to dumper3: START 20080618130147
+driver: start time 0.059 inparallel 4 bandwidth 600 diskspace 868352  dir OBSOLETE datestamp 20080618130147 driver: drain-ends tapeq FIRST big-dumpers sssS
+dumper: pid 4094 executable dumper2 version 9.8.7
+planner: time 0.088: got partial result for host clienthost disk /some/dir: 0 -> 100K, -1 -> -2K, -1 -> -2K
+planner: time 0.091: got result for host clienthost disk /some/dir: 0 -> 100K, -1 -> -2K, -1 -> -2K
+planner: time 0.091: getting estimates took 0.090 secs
+FAILED QUEUE: empty
+DONE QUEUE:
+  0: clienthost     /some/dir
+
+ANALYZING ESTIMATES...
+pondering clienthost:/some/dir... next_level0 -14049 last_level -1 (due for level 0) (new disk, can't switch to degraded mode)
+  curr level 0 nsize 100 csize 100 total size 208 total_lev0 100 balanced-lev0size 50
+INITIAL SCHEDULE (size 208):
+  clienthost /some/dir pri 14050 lev 0 nsize 100 csize 100
+
+DELAYING DUMPS IF NEEDED, total_size 208, tape length 102400 mark 4
+  delay: Total size now 208.
+
+PROMOTING DUMPS IF NEEDED, total_lev0 100, balanced_size 50...
+planner: time 0.091: analysis took 0.000 secs
+
+GENERATING SCHEDULE:
+--------
+DUMP clienthost ffffffff9ffeffffffff1f /some/dir 20080618130147 14050 0 1970:1:1:0:0:0 100 100 0 1024
+--------
+dumper: pid 4086 executable dumper0 version 9.8.7
+dumper: pid 4095 executable dumper3 version 9.8.7
+taper: using label `Conf-001' date `20080618130147'
+driver: result time 1.312 from taper: TAPER-OK
+driver: state time 1.312 free kps: 600 space: 868352 taper: idle idle-dumpers: 4 qlen tapeq: 0 runq: 0 roomq: 0 wakeup: 0 driver-idle: not-idle
+driver: interface-state time 1.312 if default: free 600
+driver: hdisk-state time 1.312 hdisk 0: free 868352 dumpers 0
+driver: flush size 0
+driver: started chunker0 pid 4129
+driver: send-cmd time 1.314 to chunker0: START 20080618130147
+driver: send-cmd time 1.314 to chunker0: PORT-WRITE 00-00001 /holding/20080618130147/clienthost._some_dir.0 clienthost ffffffff9ffeffffffff1f /some/dir 0 1970:1:1:0:0:0 1048576 GNUTAR 192 |;auth=local;index;
+chunker: pid 4129 executable chunker0 version 9.8.7
+driver: result time 1.330 from chunker0: PORT 1487
+driver: send-cmd time 1.330 to dumper0: PORT-DUMP 00-00001 1487 clienthost ffffffff9ffeffffffff1f /some/dir NODEVICE 0 1970:1:1:0:0:0 GNUTAR X amanda X local |"  <auth>local</auth>\n  <record>YES</record>\n  <index>YES</index>\n"
+driver: state time 6.408 free kps: 0 space: 868160 taper: idle idle-dumpers: 3 qlen tapeq: 0 runq: 0 roomq: 0 wakeup: 0 driver-idle: no-dumpers
+driver: interface-state time 6.408 if default: free 0
+driver: hdisk-state time 6.408 hdisk 0: free 868160 dumpers 1
+driver: result time 6.408 from dumper0: DONE 00-00001 100 100 0 "[sec 0.012 kb 100 kps 7915.1 orig-kb 100]"
+driver: finished-cmd time 6.408 dumper0 dumped clienthost:/some/dir
+driver: send-cmd time 6.408 to chunker0: DONE 00-00001
+driver: state time 6.408 free kps: 0 space: 868160 taper: idle idle-dumpers: 3 qlen tapeq: 0 runq: 0 roomq: 0 wakeup: 0 driver-idle: no-dumpers
+driver: interface-state time 6.408 if default: free 0
+driver: hdisk-state time 6.408 hdisk 0: free 868160 dumpers 1
+driver: result time 6.408 from chunker0: DONE 00-00001 100 "[sec 5.075 kb 100 kps 26.0]"
+driver: finished-cmd time 6.408 chunker0 chunked clienthost:/some/dir
+driver: send-cmd time 6.410 to taper: FILE-WRITE 00-00002 /holding/20080618130147/clienthost._some_dir.0 clienthost /some/dir 0 20080618130147 0
+driver: startaflush: FIRST clienthost /some/dir 132 102400
+driver: state time 6.410 free kps: 600 space: 868220 taper: writing idle-dumpers: 4 qlen tapeq: 0 runq: 0 roomq: 0 wakeup: 0 driver-idle: no-dumpers
+driver: interface-state time 6.410 if default: free 600
+driver: hdisk-state time 6.410 hdisk 0: free 868220 dumpers 0
+driver: result time 6.411 from taper: REQUEST-NEW-TAPE 00-00002
+driver: send-cmd time 6.411 to taper: NEW-TAPE
+driver: state time 6.412 free kps: 600 space: 868220 taper: writing idle-dumpers: 4 qlen tapeq: 0 runq: 0 roomq: 0 wakeup: 0 driver-idle: no-dumpers
+driver: interface-state time 6.412 if default: free 600
+driver: hdisk-state time 6.412 hdisk 0: free 868220 dumpers 0
+driver: result time 6.412 from taper: NEW-TAPE 00-00002 Conf-001
+driver: state time 6.414 free kps: 600 space: 868220 taper: writing idle-dumpers: 4 qlen tapeq: 0 runq: 0 roomq: 0 wakeup: 0 driver-idle: no-dumpers
+driver: interface-state time 6.414 if default: free 600
+driver: hdisk-state time 6.414 hdisk 0: free 868220 dumpers 0
+driver: result time 6.415 from taper: PARTDONE 00-00002 Conf-001 1 100 "[sec 0.001177 kb 100 kps 84961.767205]"
+driver: state time 6.415 free kps: 600 space: 868220 taper: writing idle-dumpers: 4 qlen tapeq: 0 runq: 0 roomq: 0 wakeup: 0 driver-idle: no-dumpers
+driver: interface-state time 6.415 if default: free 600
+driver: hdisk-state time 6.415 hdisk 0: free 868220 dumpers 0
+driver: result time 6.415 from taper: DONE 00-00002 INPUT-GOOD TAPE-GOOD "[sec 0.001177 kb 100 kps 84961.767205]" "" ""
+driver: finished-cmd time 6.415 taper wrote clienthost:/some/dir
+driver: state time 6.415 free kps: 600 space: 868352 taper: idle idle-dumpers: 4 qlen tapeq: 0 runq: 0 roomq: 0 wakeup: 0 driver-idle: no-dumpers
+driver: interface-state time 6.415 if default: free 600
+driver: hdisk-state time 6.415 hdisk 0: free 868352 dumpers 0
+driver: QUITTING time 6.415 telling children to quit
+driver: send-cmd time 6.415 to dumper0: QUIT
+driver: send-cmd time 6.415 to dumper1: QUIT
+driver: send-cmd time 6.417 to dumper2: QUIT
+driver: send-cmd time 6.417 to dumper3: QUIT
+driver: send-cmd time 6.418 to taper: QUIT
+taper: DONE
+driver: FINISHED time 7.426
+amdump: end at Wed Jun 18 13:01:55 EDT 2008
+%%%% quoted
+amdump: start at Wed Jun 18 13:01:47 EDT 2008
+amdump: datestamp 20080618
+amdump: starttime 20080618130147
+amdump: starttime-locale-independent 2008-06-18 13:01:47 EDT
+planner: pid 4079 executable /path/to/planner version 9.8.7
+READING CONF INFO...
+planner: timestamp 20080618130147
+planner: time 0.000: startup took 0.000 secs
+
+SENDING FLUSHES...
+ENDFLUSH
+
+SETTING UP FOR ESTIMATES...
+planner: time 0.000: setting up estimates for clienthost:"C:\\Some Dir\\"
+clienthost:"C:\\Some Dir\\" overdue 14049 days for level 0
+setup_estimate: clienthost:"C:\\Some Dir\\": command 0, options: none    last_level -1 next_level0 -14049 level_days 0    getting estimates 0 (-2) -1 (-2) -1 (-2)
+planner: time 0.000: setting up estimates took 0.000 secs
+
+GETTING ESTIMATES...
+driver: pid 4080 executable /path/to/driver version 9.8.7
+driver: adding holding disk 0 dir /holding size 868352 chunksize 1048576
+reserving 0 out of 868352 for degraded-mode dumps
+driver: send-cmd time 0.015 to taper: START-TAPER 20080618130147
+taper: pid 4084 executable taper version 9.8.7
+driver: started dumper0 pid 4086
+driver: send-cmd time 0.031 to dumper0: START 20080618130147
+planner: time 0.050: got partial result for host clienthost disk "C:\\Some Dir\\": 0 -> -2K, -1 -> -2K, -1 -> -2K
+dumper: pid 4090 executable dumper1 version 9.8.7
+driver: started dumper1 pid 4090
+driver: send-cmd time 0.046 to dumper1: START 20080618130147
+driver: started dumper2 pid 4094
+driver: send-cmd time 0.048 to dumper2: START 20080618130147
+driver: started dumper3 pid 4095
+driver: send-cmd time 0.059 to dumper3: START 20080618130147
+driver: start time 0.059 inparallel 4 bandwidth 600 diskspace 868352  dir OBSOLETE datestamp 20080618130147 driver: drain-ends tapeq FIRST big-dumpers sssS
+dumper: pid 4094 executable dumper2 version 9.8.7
+planner: time 0.088: got partial result for host clienthost disk "C:\\Some Dir\\": 0 -> 100K, -1 -> -2K, -1 -> -2K
+planner: time 0.091: got result for host clienthost disk "C:\\Some Dir\\": 0 -> 100K, -1 -> -2K, -1 -> -2K
+planner: time 0.091: getting estimates took 0.090 secs
+FAILED QUEUE: empty
+DONE QUEUE:
+  0: clienthost     "C:\\Some Dir\\"
+
+ANALYZING ESTIMATES...
+pondering clienthost:"C:\\Some Dir\\"... next_level0 -14049 last_level -1 (due for level 0) (new disk, can't switch to degraded mode)
+  curr level 0 nsize 100 csize 100 total size 208 total_lev0 100 balanced-lev0size 50
+INITIAL SCHEDULE (size 208):
+  clienthost "C:\\Some Dir\\" pri 14050 lev 0 nsize 100 csize 100
+
+DELAYING DUMPS IF NEEDED, total_size 208, tape length 102400 mark 4
+  delay: Total size now 208.
+
+PROMOTING DUMPS IF NEEDED, total_lev0 100, balanced_size 50...
+planner: time 0.091: analysis took 0.000 secs
+
+GENERATING SCHEDULE:
+--------
+DUMP clienthost ffffffff9ffeffffffff1f "C:\\Some Dir\\" 20080618130147 14050 0 1970:1:1:0:0:0 100 100 0 1024
+--------
+dumper: pid 4086 executable dumper0 version 9.8.7
+dumper: pid 4095 executable dumper3 version 9.8.7
+taper: using label `Conf-001' date `20080618130147'
+driver: result time 1.312 from taper: TAPER-OK
+driver: state time 1.312 free kps: 600 space: 868352 taper: idle idle-dumpers: 4 qlen tapeq: 0 runq: 0 roomq: 0 wakeup: 0 driver-idle: not-idle
+driver: interface-state time 1.312 if default: free 600
+driver: hdisk-state time 1.312 hdisk 0: free 868352 dumpers 0
+driver: flush size 0
+driver: started chunker0 pid 4129
+driver: send-cmd time 1.314 to chunker0: START 20080618130147
+driver: send-cmd time 1.314 to chunker0: PORT-WRITE 00-00001 /holding/20080618130147/clienthost._some_dir.0 clienthost ffffffff9ffeffffffff1f "C:\\Some Dir\\" 0 1970:1:1:0:0:0 1048576 GNUTAR 192 |;auth=local;index;
+chunker: pid 4129 executable chunker0 version 9.8.7
+driver: result time 1.330 from chunker0: PORT 1487
+driver: send-cmd time 1.330 to dumper0: PORT-DUMP 00-00001 1487 clienthost ffffffff9ffeffffffff1f "C:\\Some Dir\\" NODEVICE 0 1970:1:1:0:0:0 GNUTAR X amanda X local |"  <auth>local</auth>\n  <record>YES</record>\n  <index>YES</index>\n"
+driver: state time 6.408 free kps: 0 space: 868160 taper: idle idle-dumpers: 3 qlen tapeq: 0 runq: 0 roomq: 0 wakeup: 0 driver-idle: no-dumpers
+driver: interface-state time 6.408 if default: free 0
+driver: hdisk-state time 6.408 hdisk 0: free 868160 dumpers 1
+driver: result time 6.408 from dumper0: DONE 00-00001 100 100 0 "[sec 0.012 kb 100 kps 7915.1 orig-kb 100]"
+driver: finished-cmd time 6.408 dumper0 dumped clienthost:"C:\\Some Dir\\"
+driver: send-cmd time 6.408 to chunker0: DONE 00-00001
+driver: state time 6.408 free kps: 0 space: 868160 taper: idle idle-dumpers: 3 qlen tapeq: 0 runq: 0 roomq: 0 wakeup: 0 driver-idle: no-dumpers
+driver: interface-state time 6.408 if default: free 0
+driver: hdisk-state time 6.408 hdisk 0: free 868160 dumpers 1
+driver: result time 6.408 from chunker0: DONE 00-00001 100 "[sec 5.075 kb 100 kps 26.0]"
+driver: finished-cmd time 6.408 chunker0 chunked clienthost:"C:\\Some Dir\\"
+driver: send-cmd time 6.410 to taper: FILE-WRITE 00-00002 /holding/20080618130147/clienthost._some_dir.0 clienthost "C:\\Some Dir\\" 0 20080618130147 0
+driver: startaflush: FIRST clienthost "C:\\Some Dir\\" 132 102400
+driver: state time 6.410 free kps: 600 space: 868220 taper: writing idle-dumpers: 4 qlen tapeq: 0 runq: 0 roomq: 0 wakeup: 0 driver-idle: no-dumpers
+driver: interface-state time 6.410 if default: free 600
+driver: hdisk-state time 6.410 hdisk 0: free 868220 dumpers 0
+driver: result time 6.411 from taper: REQUEST-NEW-TAPE 00-00002
+driver: send-cmd time 6.411 to taper: NEW-TAPE
+driver: state time 6.412 free kps: 600 space: 868220 taper: writing idle-dumpers: 4 qlen tapeq: 0 runq: 0 roomq: 0 wakeup: 0 driver-idle: no-dumpers
+driver: interface-state time 6.412 if default: free 600
+driver: hdisk-state time 6.412 hdisk 0: free 868220 dumpers 0
+driver: result time 6.412 from taper: NEW-TAPE 00-00002 Conf-001
+driver: state time 6.414 free kps: 600 space: 868220 taper: writing idle-dumpers: 4 qlen tapeq: 0 runq: 0 roomq: 0 wakeup: 0 driver-idle: no-dumpers
+driver: interface-state time 6.414 if default: free 600
+driver: hdisk-state time 6.414 hdisk 0: free 868220 dumpers 0
+driver: result time 6.415 from taper: PARTDONE 00-00002 Conf-001 1 100 "[sec 0.001177 kb 100 kps 84961.767205]"
+driver: state time 6.415 free kps: 600 space: 868220 taper: writing idle-dumpers: 4 qlen tapeq: 0 runq: 0 roomq: 0 wakeup: 0 driver-idle: no-dumpers
+driver: interface-state time 6.415 if default: free 600
+driver: hdisk-state time 6.415 hdisk 0: free 868220 dumpers 0
+driver: result time 6.415 from taper: DONE 00-00002 INPUT-GOOD TAPE-GOOD "[sec 0.001177 kb 100 kps 84961.767205]" "" ""
+driver: finished-cmd time 6.415 taper wrote clienthost:"C:\\Some Dir\\"
+driver: state time 6.415 free kps: 600 space: 868352 taper: idle idle-dumpers: 4 qlen tapeq: 0 runq: 0 roomq: 0 wakeup: 0 driver-idle: no-dumpers
+driver: interface-state time 6.415 if default: free 600
+driver: hdisk-state time 6.415 hdisk 0: free 868352 dumpers 0
+driver: QUITTING time 6.415 telling children to quit
+driver: send-cmd time 6.415 to dumper0: QUIT
+driver: send-cmd time 6.415 to dumper1: QUIT
+driver: send-cmd time 6.417 to dumper2: QUIT
+driver: send-cmd time 6.417 to dumper3: QUIT
+driver: send-cmd time 6.418 to taper: QUIT
+taper: DONE
+driver: FINISHED time 7.426
+amdump: end at Wed Jun 18 13:01:55 EDT 2008
diff --git a/installcheck/amtapetype.pl b/installcheck/amtapetype.pl
new file mode 100644 (file)
index 0000000..23d93d7
--- /dev/null
@@ -0,0 +1,34 @@
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+use Test::More tests => 2;
+
+use lib "@amperldir@";
+use Installcheck::Run qw(run run_get run_err);
+
+##
+# First, check that the script runs -- this is essentially a syntax/strict
+# check of the script.
+
+ok(!run('amtapetype'),
+    "'amtapetype' with no arguments returns an error exit status");
+like($Installcheck::Run::stderr, qr(\AUsage: )i,
+    ".. and gives usage message on stderr");
+
+# amtapetype demands far more resources than we can allow it to use in a
+# test situation, so for now this is the  best we can do.
diff --git a/installcheck/bigint.pl b/installcheck/bigint.pl
new file mode 100644 (file)
index 0000000..4472f75
--- /dev/null
@@ -0,0 +1,223 @@
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+use Test::More tests => 74;
+
+use lib "@amperldir@";
+use Amanda::Tests;
+use Math::BigInt;
+use Amanda::BigIntCompat;
+
+# define some constants; Perl doesn't have native 64-bit numbers, so
+# none are tested 
+$G_MAXUINT64_bigint = Math::BigInt->new('18446744073709551615');
+$G_MAXINT64_bigint = Math::BigInt->new('9223372036854775807');
+$G_MININT64_bigint = Math::BigInt->new('-9223372036854775808');
+
+$G_MAXUINT32_native = 2 ** 32 - 1;
+$G_MAXUINT32_double = 2.0 ** 32 - 1;
+$G_MAXUINT32_bigint = Math::BigInt->new('4294967295');
+$G_MAXINT32_native = 2 ** 31 - 1;
+$G_MAXINT32_double = 2.0 ** 31 - 1;
+$G_MAXINT32_bigint = Math::BigInt->new('2147483647');
+$G_MININT32_native = - 2 ** 31;
+$G_MININT32_double = - 2.0 ** 31;
+$G_MININT32_bigint = Math::BigInt->new('-2147483648');
+
+$G_MAXUINT16_native = 2 ** 16 - 1;
+$G_MAXUINT16_double = 2.0 ** 16 - 1;
+$G_MAXUINT16_bigint = Math::BigInt->new('65535');
+$G_MAXINT16_native = 2 ** 15 - 1;
+$G_MAXINT16_double = 2.0 ** 15 - 1;
+$G_MAXINT16_bigint = Math::BigInt->new('32767');
+$G_MININT16_native = - 2 ** 15;
+$G_MININT16_double = - 2.0 ** 15;
+$G_MININT16_bigint = Math::BigInt->new('-32768');
+
+$G_MAXUINT8_native = 2 ** 8 - 1;
+$G_MAXUINT8_double = 2.0 ** 8 - 1;
+$G_MAXUINT8_bigint = Math::BigInt->new('255');
+$G_MAXINT8_native = 2 ** 7 - 1;
+$G_MAXINT8_double = 2.0 ** 7 - 1;
+$G_MAXINT8_bigint = Math::BigInt->new('127');
+$G_MININT8_native = - 2 ** 7;
+$G_MININT8_double = - 2.0 ** 7;
+$G_MININT8_bigint = Math::BigInt->new('-128');
+
+# first test "taking" integers -- Perl -> C
+
+is(Amanda::Tests::take_guint64(0), "ZERO", 
+    "Perl->C guint64 0");
+is(Amanda::Tests::take_guint64($G_MAXUINT64_bigint), "MAX", 
+    "Perl->C guint64 bigint MAX ($G_MAXUINT64_bigint)");
+is(Amanda::Tests::take_gint64(0), "ZERO", 
+    "Perl->C gint64 0");
+is(Amanda::Tests::take_gint64($G_MAXINT64_bigint), "MAX", 
+    "Perl->C gint64 bigint MAX ($G_MAXINT64_bigint)");
+is(Amanda::Tests::take_gint64($G_MININT64_bigint), "MIN", 
+    "Perl->C gint64 bigint MIN ($G_MININT64_bigint)");
+
+is(Amanda::Tests::take_guint32(0), "ZERO", 
+    "Perl->C guint32 0");
+is(Amanda::Tests::take_guint32($G_MAXUINT32_bigint), "MAX", 
+    "Perl->C guint32 bigint MAX ($G_MAXUINT32_bigint)");
+is(Amanda::Tests::take_guint32($G_MAXUINT32_native), "MAX", 
+    "Perl->C guint32 native MAX ($G_MAXUINT32_native)");
+is(Amanda::Tests::take_guint32($G_MAXUINT32_double), "MAX", 
+    "Perl->C guint32 double MAX ($G_MAXUINT32_double)");
+is(Amanda::Tests::take_gint32(0), "ZERO", 
+    "Perl->C gint32 0");
+is(Amanda::Tests::take_gint32($G_MAXINT32_bigint), "MAX", 
+    "Perl->C gint32 bigint MAX ($G_MAXINT32_bigint)");
+is(Amanda::Tests::take_gint32($G_MAXINT32_native), "MAX", 
+    "Perl->C gint32 native MAX ($G_MAXINT32_native)");
+is(Amanda::Tests::take_gint32($G_MAXINT32_double), "MAX", 
+    "Perl->C gint32 double MAX ($G_MAXINT32_double)");
+is(Amanda::Tests::take_gint32($G_MININT32_bigint), "MIN", 
+    "Perl->C gint32 bigint MIN ($G_MININT32_bigint)");
+is(Amanda::Tests::take_gint32($G_MININT32_native), "MIN", 
+    "Perl->C gint32 native MIN ($G_MININT32_native)");
+is(Amanda::Tests::take_gint32($G_MININT32_double), "MIN", 
+    "Perl->C gint32 double MIN ($G_MININT32_double)");
+
+is(Amanda::Tests::take_guint16(0), "ZERO", 
+    "Perl->C guint16 0");
+is(Amanda::Tests::take_guint16($G_MAXUINT16_bigint), "MAX", 
+    "Perl->C guint16 bigint MAX ($G_MAXUINT16_bigint)");
+is(Amanda::Tests::take_guint16($G_MAXUINT16_native), "MAX", 
+    "Perl->C guint16 native MAX ($G_MAXUINT16_native)");
+is(Amanda::Tests::take_guint16($G_MAXUINT16_double), "MAX", 
+    "Perl->C guint16 double MAX ($G_MAXUINT16_double)");
+is(Amanda::Tests::take_gint16(0), "ZERO", 
+    "Perl->C gint16 0");
+is(Amanda::Tests::take_gint16($G_MAXINT16_bigint), "MAX", 
+    "Perl->C gint16 bigint MAX ($G_MAXINT16_bigint)");
+is(Amanda::Tests::take_gint16($G_MAXINT16_native), "MAX", 
+    "Perl->C gint16 native MAX ($G_MAXINT16_native)");
+is(Amanda::Tests::take_gint16($G_MAXINT16_double), "MAX", 
+    "Perl->C gint16 double MAX ($G_MAXINT16_double)");
+is(Amanda::Tests::take_gint16($G_MININT16_bigint), "MIN", 
+    "Perl->C gint16 bigint MIN ($G_MININT16_bigint)");
+is(Amanda::Tests::take_gint16($G_MININT16_native), "MIN", 
+    "Perl->C gint16 native MIN ($G_MININT16_native)");
+is(Amanda::Tests::take_gint16($G_MININT16_double), "MIN", 
+    "Perl->C gint16 double MIN ($G_MININT16_double)");
+
+is(Amanda::Tests::take_guint8(0), "ZERO", 
+    "Perl->C guint8 0");
+is(Amanda::Tests::take_guint8($G_MAXUINT8_bigint), "MAX", 
+    "Perl->C guint8 bigint MAX ($G_MAXUINT8_bigint)");
+is(Amanda::Tests::take_guint8($G_MAXUINT8_native), "MAX", 
+    "Perl->C guint8 native MAX ($G_MAXUINT8_native)");
+is(Amanda::Tests::take_guint8($G_MAXUINT8_double), "MAX", 
+    "Perl->C guint8 double MAX ($G_MAXUINT8_double)");
+is(Amanda::Tests::take_gint8(0), "ZERO", 
+    "Perl->C gint8 0");
+is(Amanda::Tests::take_gint8($G_MAXINT8_bigint), "MAX", 
+    "Perl->C gint8 bigint MAX ($G_MAXINT8_bigint)");
+is(Amanda::Tests::take_gint8($G_MAXINT8_native), "MAX", 
+    "Perl->C gint8 native MAX ($G_MAXINT8_native)");
+is(Amanda::Tests::take_gint8($G_MAXINT8_double), "MAX", 
+    "Perl->C gint8 double MAX ($G_MAXINT8_double)");
+is(Amanda::Tests::take_gint8($G_MININT8_bigint), "MIN", 
+    "Perl->C gint8 bigint MIN ($G_MININT8_bigint)");
+is(Amanda::Tests::take_gint8($G_MININT8_native), "MIN", 
+    "Perl->C gint8 native MIN ($G_MININT8_native)");
+is(Amanda::Tests::take_gint8($G_MININT8_double), "MIN", 
+    "Perl->C gint8 double MIN ($G_MININT8_double)");
+
+# now test giving integers -- C -> Perl
+
+is(Amanda::Tests::give_guint64("0"), 0, "C -> Perl guint64 0");
+is(Amanda::Tests::give_guint64("+"), $G_MAXUINT64_bigint, "C -> Perl guint64 MAX (always bigint)");
+is(Amanda::Tests::give_gint64("0"), 0, "C -> Perl gint64 0");
+is(Amanda::Tests::give_gint64("+"), $G_MAXINT64_bigint, "C -> Perl gint64 MAX (always bigint)");
+is(Amanda::Tests::give_gint64("-"), $G_MININT64_bigint, "C -> Perl gint64 MIN (always bigint)");
+
+is(Amanda::Tests::give_guint32("0"), 0, "C -> Perl guint32 0");
+is(Amanda::Tests::give_guint32("+"), $G_MAXUINT32_bigint, "C -> Perl guint32 MAX (always bigint)");
+is(Amanda::Tests::give_gint32("0"), 0, "C -> Perl gint32 0");
+is(Amanda::Tests::give_gint32("+"), $G_MAXINT32_bigint, "C -> Perl gint32 MAX (always bigint)");
+is(Amanda::Tests::give_gint32("-"), $G_MININT32_bigint, "C -> Perl gint32 MIN (always bigint)");
+
+is(Amanda::Tests::give_guint16("0"), 0, "C -> Perl guint16 0");
+is(Amanda::Tests::give_guint16("+"), $G_MAXUINT16_bigint, "C -> Perl guint16 MAX (always bigint)");
+is(Amanda::Tests::give_gint16("0"), 0, "C -> Perl gint16 0");
+is(Amanda::Tests::give_gint16("+"), $G_MAXINT16_bigint, "C -> Perl gint16 MAX (always bigint)");
+is(Amanda::Tests::give_gint16("-"), $G_MININT16_bigint, "C -> Perl gint16 MIN (always bigint)");
+
+is(Amanda::Tests::give_guint8("0"), 0, "C -> Perl guint8 0");
+is(Amanda::Tests::give_guint8("+"), $G_MAXUINT8_bigint, "C -> Perl guint8 MAX (always bigint)");
+is(Amanda::Tests::give_gint8("0"), 0, "C -> Perl gint8 0");
+is(Amanda::Tests::give_gint8("+"), $G_MAXINT8_bigint, "C -> Perl gint8 MAX (always bigint)");
+is(Amanda::Tests::give_gint8("-"), $G_MININT8_bigint, "C -> Perl gint8 MIN (always bigint)");
+
+# finally, test overflows in Perl -> C conversions; these all croak(), so we capture the errors
+# with an eval {}
+
+eval { Amanda::Tests::take_gint64($G_MAXINT64_bigint+1); };
+like($@, qr/Expected a signed 64-bit value or smaller/,
+    "gint64 rejects numbers greater than max");
+eval { Amanda::Tests::take_gint64($G_MININT64_bigint-1); };
+like($@, qr/Expected a signed 64-bit value or smaller/,
+    "gint64 rejects numbers less than min");
+eval { Amanda::Tests::take_guint64($G_MAXUINT64_bigint+1); };
+like($@, qr/Expected an unsigned 64-bit value or smaller/, 
+    "guint64 rejects numbers greater than max");
+eval { Amanda::Tests::take_guint64(-1); };
+like($@, qr/Expected an unsigned value, got a negative integer/, 
+    "guint64 rejects numbers less than zero");
+
+eval { Amanda::Tests::take_gint32($G_MAXINT32_native+1); };
+like($@, qr/Expected a 32-bit integer; value out of range/, 
+    "gint32 rejects numbers greater than max");
+eval { Amanda::Tests::take_gint32($G_MININT32_native-1); };
+like($@, qr/Expected a 32-bit integer; value out of range/, 
+    "gint32 rejects numbers less than min");
+eval { Amanda::Tests::take_guint32($G_MAXUINT32_native+1); };
+like($@, qr/Expected a 32-bit unsigned integer/, 
+    "guint32 rejects numbers greater than max");
+eval { Amanda::Tests::take_guint32(-1); };
+like($@, qr/Expected an unsigned value, got a negative integer/, 
+    "guint32 rejects numbers less than zero");
+
+eval { Amanda::Tests::take_gint16($G_MAXINT16_native+1); };
+like($@, qr/Expected a 16-bit integer; value out of range/, 
+    "gint16 rejects numbers greater than max");
+eval { Amanda::Tests::take_gint16($G_MININT16_native-1); };
+like($@, qr/Expected a 16-bit integer; value out of range/, 
+    "gint16 rejects numbers less than min");
+eval { Amanda::Tests::take_guint16($G_MAXUINT16_native+1); };
+like($@, qr/Expected a 16-bit unsigned integer/,
+    "guint16 rejects numbers greater than max");
+eval { Amanda::Tests::take_guint16(-1); };
+like($@, qr/Expected an unsigned value, got a negative integer/, 
+    "guint16 rejects numbers less than zero");
+
+eval { Amanda::Tests::take_gint8($G_MAXINT8_native+1); };
+like($@, qr/Expected a 8-bit integer; value out of range/, 
+    "gint8 rejects numbers greater than max");
+eval { Amanda::Tests::take_gint8($G_MININT8_native-1); };
+like($@, qr/Expected a 8-bit integer; value out of range/, 
+    "gint8 rejects numbers less than min");
+eval { Amanda::Tests::take_guint8($G_MAXUINT8_native+1); };
+like($@, qr/Expected a 8-bit unsigned integer/,
+    "guint8 rejects numbers greater than max");
+eval { Amanda::Tests::take_guint8(-1); };
+like($@, qr/Expected an unsigned value, got a negative integer/, 
+    "guint8 rejects numbers less than zero");
diff --git a/installcheck/pp-scripts.pl b/installcheck/pp-scripts.pl
new file mode 100644 (file)
index 0000000..c38550a
--- /dev/null
@@ -0,0 +1,167 @@
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+use Test::More tests => 8;
+
+use lib "@amperldir@";
+use Cwd qw(abs_path getcwd);
+use Installcheck::Config;
+use Installcheck::Run qw(run run_err $diskname amdump_diag);
+use Amanda::Config qw( :init );
+use Amanda::Paths;
+use warnings;
+use strict;
+
+my $testconf;
+
+# Run amdump with client- and server-side scripts
+
+my $templog = $Amanda::Paths::AMANDA_TMPDIR . "/check-script." . $$;
+
+sub verify_log {
+    my $msg = shift;
+    my @exp = @_;
+    my ($exp, $got);
+    my $logfile;
+
+    if (!open($logfile, "<", $templog)) {
+       fail($msg);
+       diag("Logfile '$templog' does not exist.");
+       return;
+    }
+
+    my $linenum = 1;
+    foreach $exp (@exp) {
+       $got = <$logfile>;
+       if (!$got) {
+           fail($msg);
+           diag("    Line: $linenum");
+           diag("Expected: '$exp'");
+           diag("     Got: EOF");
+           diag($exp);
+           return;
+       }
+       chomp $got;
+       if ($got ne $exp) {
+           fail($msg);
+           diag("    Line: $linenum");
+           diag("Expected: '$exp'");
+           diag("     Got: '$got'");
+           return;
+       }
+       $linenum++;
+    }
+    $got = <$logfile>;
+    if ($got) {
+       fail($msg);
+       diag("    Line: $linenum");
+       diag("Expected: EOF");
+       diag("     Got: '$got'");
+       diag($got);
+       return;
+    }
+    pass($msg);
+};
+
+# check script on client
+
+$testconf = Installcheck::Run::setup();
+$testconf->add_param('label_new_tapes', '"TESTCONF%%"');
+
+$testconf->add_dle(<<EODLE);
+localhost diskname1 $diskname {
+    installcheck-test
+    program "APPLICATION"
+    application {
+       plugin "amgtar"
+       property "atime_preserve" "no" # note underscore
+    }
+    script {
+       plugin "amlog-script"
+       execute-where client
+       execute-on pre-dle-amcheck, post-dle-amcheck, pre-dle-estimate, post-dle-estimate, pre-dle-backup, post-dle-backup
+       property "logfile" "$templog"
+    }
+}
+EODLE
+$testconf->write();
+
+unlink $templog;
+ok(run('amcheck', '-c', 'TESTCONF'), "amcheck runs successfully for client scripts.");
+
+verify_log("amcheck invokes correct script commands",
+    "TESTCONF pre-dle-amcheck client localhost diskname1 $diskname ",
+    "TESTCONF post-dle-amcheck client localhost diskname1 $diskname ",
+);
+
+unlink $templog;
+ok(run('amdump', 'TESTCONF'), "amdump runs successfully for client scripts.")
+    or amdump_diag();
+
+verify_log("amdump invokes correct script commands",
+    "TESTCONF pre-dle-estimate client localhost diskname1 $diskname 0",
+    "TESTCONF post-dle-estimate client localhost diskname1 $diskname 0",
+    "TESTCONF pre-dle-backup client localhost diskname1 $diskname 0",
+    "TESTCONF post-dle-backup client localhost diskname1 $diskname 0",
+);
+
+Installcheck::Run::cleanup();
+
+#check script on server
+$testconf = Installcheck::Run::setup();
+$testconf->add_param('label_new_tapes', '"TESTCONF%%"');
+
+$testconf->add_dle(<<EODLE);
+localhost diskname2 $diskname {
+    installcheck-test
+    program "APPLICATION"
+    application {
+       plugin "amgtar"
+       property "atime-preserve" "no"
+    }
+    script {
+       plugin "amlog-script"
+       execute-where server
+       execute-on pre-host-amcheck, post-host-amcheck, pre-host-estimate, post-host-estimate, pre-host-backup, post-host-backup
+       property "logfile" "$templog"
+    }
+}
+EODLE
+$testconf->write();
+
+unlink $templog;
+ok(run('amcheck', '-c', 'TESTCONF'), "amcheck runs successfully for server scripts.");
+
+verify_log("amcheck invokes correct script commands",
+    "TESTCONF pre-host-amcheck server localhost diskname2 $diskname ",
+    "TESTCONF post-host-amcheck server localhost diskname2 $diskname ",
+);
+
+unlink $templog;
+ok(run('amdump', 'TESTCONF'), "amdump runs successfully for server scripts.")
+    or amdump_diag();
+
+verify_log("amdump invokes correct script commands",
+    "TESTCONF pre-host-estimate server localhost diskname2 $diskname 0",
+    "TESTCONF post-host-estimate server localhost diskname2 $diskname 0",
+    "TESTCONF pre-host-backup server localhost diskname2 $diskname ",
+    "TESTCONF post-host-backup server localhost diskname2 $diskname ",
+);
+
+unlink $templog;
+Installcheck::Run::cleanup();
index c06034116a84722ffcb767645e6d6302481cee9a..2525dee74a8f6e56f445081fab0250746fb2be4d 100644 (file)
@@ -6,38 +6,53 @@ AMPLOT_MAN_PAGES =  amplot.8
 
 COMMON_MAN_PAGES =  amanda.8 \
                    amanda.conf.5 \
-                   amanda-client.conf.5
-
-SERVER_MAN_PAGES =  amadmin.8 \
-                   amcheck.8 \
-                   amcheckdb.8 \
-                   amcheckdump.8 \
-                   amcleanup.8 \
-                   amdd.8 \
-                   amdevcheck.8 \
-                   amdump.8 \
-                   amflush.8 \
-                   amgetconf.8 \
-                   amlabel.8 \
-                   ammt.8 \
-                   amoverview.8 \
-                   amreport.8 \
-                   amrmtape.8 \
-                   amstatus.8 \
-                   amtape.8 \
-                   amtapetype.8 \
-                   amtoc.8 \
-                   amverify.8 \
-                   amverifyrun.8 \
-                   amserverconfig.8 \
-                   amaddclient.8 \
-                   amcheckdump.8 \
-                   amcrypt.8 \
-                   amaespipe.8 \
-                   amgpgcrypt.8 \
-                   amcryptsimple.8  \
-                   amcrypt-ossl.8 \
-                   amcrypt-ossl-asym.8
+                   amanda-client.conf.5 \
+                   amanda-scripts.7 \
+                   amanda-archive-format.5 \
+                   amanda-auth.7 \
+                   amarchiver.8 \
+                   script-email.8
+
+CLIENT_MAN_PAGES = \
+    amanda-applications.7 \
+    amgtar.8 \
+    amsamba.8 \
+    amstar.8 \
+    amzfs-snapshot.8 \
+    amzfs-sendrecv.8
+
+SERVER_MAN_PAGES =  \
+    amanda-devices.7 \
+    amanda-changers.7 \
+    amaddclient.8    \
+    amadmin.8 \
+    amaespipe.8 \
+    amcheck.8 \
+    amcheckdb.8 \
+    amcheckdump.8 \
+    amcleanup.8 \
+    amcrypt-ossl-asym.8 \
+    amcrypt-ossl.8   \
+    amcrypt.8 \
+    amcryptsimple.8  \
+    amdevcheck.8 \
+    amdump.8 \
+    amflush.8 \
+    amgetconf.8 \
+    amgpgcrypt.8 \
+    amlabel.8 \
+    amoverview.8 \
+    amreport.8 \
+    amrmtape.8 \
+    amserverconfig.8 \
+    amservice.8 \
+    amstatus.8 \
+    amtape.8 \
+    amtapetype.8 \
+    amtoc.8 \
+    amvault.8 \
+    disklist.5 \
+    tapelist.5
 
 RECOVER_MAN_PAGES =  amrecover.8
 
@@ -45,7 +60,7 @@ RESTORE_MAN_PAGES =  amrestore.8 \
                     amfetchdump.8
 
 ALL_MAN_PAGES = $(AMPLOT_MAN_PAGES) \
-          $(COMMON_MAN_PAGES) \
+          $(CLIENT_MAN_PAGES) \
           $(COMMON_MAN_PAGES) \
           $(SERVER_MAN_PAGES) \
           $(RECOVER_MAN_PAGES) \
@@ -55,6 +70,9 @@ WANTED_MAN_PAGES = $(COMMON_MAN_PAGES)
 if WANT_AMPLOT
   WANTED_MAN_PAGES += $(AMPLOT_MAN_PAGES)
 endif
+if WANT_CLIENT
+  WANTED_MAN_PAGES += $(CLIENT_MAN_PAGES)
+endif
 if WANT_SERVER
   WANTED_MAN_PAGES += $(SERVER_MAN_PAGES)
 endif
@@ -73,7 +91,7 @@ EXTRA_XML = xslt/expand-sambadoc.xsl \
             xslt/man.xsl.in \
             xslt/html.xsl.in \
             xslt/settings.xsl \
-           entities/global.entities \
+           entities/global.entities.in \
            entities/xinclude.dtd
 
 EXTRA_DIST = $(ALL_MAN_PAGES) $(MAN_XML) $(EXTRA_HTML) $(EXTRA_XML)
@@ -86,17 +104,22 @@ MAINTAINERCLEANFILES = $(ALL_MAN_PAGES)
 # some of the XSL needs to know what docbook-xsl version we've selected
 %.xsl: %.xsl.in $(top_builddir)/config.status
        $(top_builddir)/config.status --file=$@:$<
+       rm -f config.log
+
+entities/global.entities: entities/global.entities.in $(top_builddir)/config.status
+       $(top_builddir)/config.status --file=$@:$<
+       rm -f config.log
 
 if   ENABLE_MANPAGE_BUILD
 # phase one of the documentation build expands some macros.
-xml-source/%.proc.xml: $(SRCMANPAGEDIR)/%.xml $(srcdir)/xslt/expand-sambadoc.xsl
+xml-source/%.proc.xml: $(SRCMANPAGEDIR)/%.xml $(srcdir)/xslt/expand-sambadoc.xsl entities/global.entities
        $(XSLTPROC) $(XSLTPROC_FLAGS) --path $(srcdir)/xslt/ --xinclude --stringparam latex.imagebasedir "$*/" --stringparam noreference 1 --output $@ $(srcdir)/xslt/expand-sambadoc.xsl $<
 
 # phase two generates a manpage from the resulting "expanded" docbook XML
-%: xml-source/%.proc.xml $(srcdir)/xslt/man.xsl
+%: xml-source/%.proc.xml $(srcdir)/xslt/man.xsl entities/global.entities
        $(XSLTPROC) $(XSLTPROC_FLAGS) --path $(srcdir)/xslt/ --output $@ xslt/man.xsl $<
 
-%.html: xml-source/%.proc.xml $(srcdir)/xslt/html.xsl
+%.html: xml-source/%.proc.xml $(srcdir)/xslt/html.xsl entities/global.entities
        $(XSLTPROC) $(XSLTPROC_FLAGS) --path $(srcdir)/xslt/ --output $@ xslt/html.xsl $<
 
 else   !ENABLE_MANPAGE_BUILD
index 80f0d8fb24228fb161c0560bf955afdec542f98e..fca1f539c1652f01e510c468b31861889c954606 100644 (file)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  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.
@@ -34,14 +34,16 @@ build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
 @WANT_AMPLOT_TRUE@am__append_1 = $(AMPLOT_MAN_PAGES)
-@WANT_SERVER_TRUE@am__append_2 = $(SERVER_MAN_PAGES)
-@WANT_RECOVER_TRUE@am__append_3 = $(RECOVER_MAN_PAGES)
-@WANT_RESTORE_TRUE@am__append_4 = $(RESTORE_MAN_PAGES)
+@WANT_CLIENT_TRUE@am__append_2 = $(CLIENT_MAN_PAGES)
+@WANT_SERVER_TRUE@am__append_3 = $(SERVER_MAN_PAGES)
+@WANT_RECOVER_TRUE@am__append_4 = $(RECOVER_MAN_PAGES)
+@WANT_RESTORE_TRUE@am__append_5 = $(RESTORE_MAN_PAGES)
 subdir = man
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps =  \
        $(top_srcdir)/config/macro-archive/ac_define_dir.m4 \
+       $(top_srcdir)/config/macro-archive/ac_perl_module_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_perl_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_swig.m4 \
        $(top_srcdir)/config/macro-archive/ax_compare_version.m4 \
@@ -75,6 +77,7 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/amanda/libs.m4 \
        $(top_srcdir)/config/amanda/net.m4 \
        $(top_srcdir)/config/amanda/progs.m4 \
+       $(top_srcdir)/config/amanda/ps.m4 \
        $(top_srcdir)/config/amanda/readdir.m4 \
        $(top_srcdir)/config/amanda/readline.m4 \
        $(top_srcdir)/config/amanda/rsh-security.m4 \
@@ -97,7 +100,9 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/float_h.m4 \
        $(top_srcdir)/config/gnulib/fsusage.m4 \
        $(top_srcdir)/config/gnulib/getaddrinfo.m4 \
+       $(top_srcdir)/config/gnulib/getopt.m4 \
        $(top_srcdir)/config/gnulib/gettimeofday.m4 \
+       $(top_srcdir)/config/gnulib/gnulib-common.m4 \
        $(top_srcdir)/config/gnulib/gnulib-comp.m4 \
        $(top_srcdir)/config/gnulib/include_next.m4 \
        $(top_srcdir)/config/gnulib/inet_ntop.m4 \
@@ -125,7 +130,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/sys_stat_h.m4 \
        $(top_srcdir)/config/gnulib/sys_time_h.m4 \
        $(top_srcdir)/config/gnulib/tempname.m4 \
-       $(top_srcdir)/config/gnulib/ulonglong.m4 \
        $(top_srcdir)/config/gnulib/unistd_h.m4 \
        $(top_srcdir)/config/gnulib/vasnprintf.m4 \
        $(top_srcdir)/config/gnulib/visibility.m4 \
@@ -136,7 +140,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gettext-macros/lib-ld.m4 \
        $(top_srcdir)/config/gettext-macros/lib-link.m4 \
        $(top_srcdir)/config/gettext-macros/lib-prefix.m4 \
-       $(top_srcdir)/config/gettext-macros/longlong.m4 \
        $(top_srcdir)/config/gettext-macros/nls.m4 \
        $(top_srcdir)/config/gettext-macros/po.m4 \
        $(top_srcdir)/config/gettext-macros/progtest.m4 \
@@ -154,13 +157,16 @@ CONFIG_CLEAN_FILES =
 SOURCES =
 DIST_SOURCES =
 man5dir = $(mandir)/man5
-am__installdirs = "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)"
+am__installdirs = "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man7dir)" \
+       "$(DESTDIR)$(man8dir)"
+man7dir = $(mandir)/man7
 man8dir = $(mandir)/man8
 NROFF = nroff
 MANS = $(man_MANS)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 transform = s,x,x,;
 ACLOCAL = @ACLOCAL@
+AIX_BACKUP = @AIX_BACKUP@
 ALLOCA = @ALLOCA@
 ALLOCA_H = @ALLOCA_H@
 AMANDA_DBGDIR = @AMANDA_DBGDIR@
@@ -175,8 +181,10 @@ AMPLOT_CAT_GZIP = @AMPLOT_CAT_GZIP@
 AMPLOT_CAT_PACK = @AMPLOT_CAT_PACK@
 AMPLOT_COMPRESS = @AMPLOT_COMPRESS@
 AMTAR = @AMTAR@
+APPLICATION_DIR = @APPLICATION_DIR@
 AR = @AR@
 ARPA_INET_H = @ARPA_INET_H@
+ASSERTIONS = @ASSERTIONS@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -188,16 +196,28 @@ BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@
 BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@
 BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@
 BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@
+BSDTCP_SECURITY = @BSDTCP_SECURITY@
+BSDUDP_SECURITY = @BSDUDP_SECURITY@
+BSD_SECURITY = @BSD_SECURITY@
 CAT = @CAT@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
+CHECK_USERID = @CHECK_USERID@
 CHIO = @CHIO@
 CHS = @CHS@
+CLIENT_HOST_INSTANCE = @CLIENT_HOST_INSTANCE@
+CLIENT_HOST_KEY_FILE = @CLIENT_HOST_KEY_FILE@
+CLIENT_HOST_PRINCIPAL = @CLIENT_HOST_PRINCIPAL@
 CLIENT_LOGIN = @CLIENT_LOGIN@
 CLIENT_SCRIPTS_OPT = @CLIENT_SCRIPTS_OPT@
 COMPRESS = @COMPRESS@
+COMPRESS_BEST_OPT = @COMPRESS_BEST_OPT@
+COMPRESS_FAST_OPT = @COMPRESS_FAST_OPT@
+COMPRESS_PATH = @COMPRESS_PATH@
+COMPRESS_SUFFIX = @COMPRESS_SUFFIX@
+CONFIG_CLOBBER_MY_CONFIG = @CONFIG_CLOBBER_MY_CONFIG@
 CONFIG_DIR = @CONFIG_DIR@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
@@ -211,6 +231,7 @@ DD = @DD@
 DEFAULT_AMANDATES_FILE = @DEFAULT_AMANDATES_FILE@
 DEFAULT_CHANGER_DEVICE = @DEFAULT_CHANGER_DEVICE@
 DEFAULT_CONFIG = @DEFAULT_CONFIG@
+DEFAULT_MAILER = @DEFAULT_MAILER@
 DEFAULT_SERVER = @DEFAULT_SERVER@
 DEFAULT_TAPE_DEVICE = @DEFAULT_TAPE_DEVICE@
 DEFAULT_TAPE_SERVER = @DEFAULT_TAPE_SERVER@
@@ -218,7 +239,7 @@ DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DOC_BUILD_DATE = @DOC_BUILD_DATE@
 DUMP = @DUMP@
-DUMPER_DIR = @DUMPER_DIR@
+DUMP_RETURNS_1 = @DUMP_RETURNS_1@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -231,6 +252,7 @@ F77 = @F77@
 FFLAGS = @FFLAGS@
 FLOAT_H = @FLOAT_H@
 GETCONF = @GETCONF@
+GETOPT_H = @GETOPT_H@
 GETTEXT = @GETTEXT@
 GLIB_CFLAGS = @GLIB_CFLAGS@
 GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
@@ -241,9 +263,12 @@ GMSGFMT_015 = @GMSGFMT_015@
 GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
 GNULIB_CHOWN = @GNULIB_CHOWN@
 GNULIB_DUP2 = @GNULIB_DUP2@
+GNULIB_ENVIRON = @GNULIB_ENVIRON@
 GNULIB_FCHDIR = @GNULIB_FCHDIR@
 GNULIB_FFLUSH = @GNULIB_FFLUSH@
+GNULIB_FOPEN = @GNULIB_FOPEN@
 GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
+GNULIB_FREOPEN = @GNULIB_FREOPEN@
 GNULIB_FSEEK = @GNULIB_FSEEK@
 GNULIB_FSEEKO = @GNULIB_FSEEKO@
 GNULIB_FTELL = @GNULIB_FTELL@
@@ -253,6 +278,7 @@ GNULIB_GETCWD = @GNULIB_GETCWD@
 GNULIB_GETDELIM = @GNULIB_GETDELIM@
 GNULIB_GETLINE = @GNULIB_GETLINE@
 GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
+GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@
 GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
 GNULIB_LCHOWN = @GNULIB_LCHOWN@
 GNULIB_LSEEK = @GNULIB_LSEEK@
@@ -277,8 +303,10 @@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
 GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
 GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
 GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
+GNULIB_PUTENV = @GNULIB_PUTENV@
 GNULIB_READLINK = @GNULIB_READLINK@
 GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@
+GNULIB_SETENV = @GNULIB_SETENV@
 GNULIB_SLEEP = @GNULIB_SLEEP@
 GNULIB_SNPRINTF = @GNULIB_SNPRINTF@
 GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@
@@ -287,11 +315,15 @@ GNULIB_STPNCPY = @GNULIB_STPNCPY@
 GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
 GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
 GNULIB_STRDUP = @GNULIB_STRDUP@
+GNULIB_STRERROR = @GNULIB_STRERROR@
 GNULIB_STRNDUP = @GNULIB_STRNDUP@
 GNULIB_STRNLEN = @GNULIB_STRNLEN@
 GNULIB_STRPBRK = @GNULIB_STRPBRK@
 GNULIB_STRSEP = @GNULIB_STRSEP@
+GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@
+GNULIB_STRSTR = @GNULIB_STRSTR@
 GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
+GNULIB_UNSETENV = @GNULIB_UNSETENV@
 GNULIB_VASPRINTF = @GNULIB_VASPRINTF@
 GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@
 GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
@@ -305,6 +337,7 @@ GOBJECT_QUERY = @GOBJECT_QUERY@
 GREP = @GREP@
 GZIP = @GZIP@
 HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@
+HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@
 HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@
 HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@
 HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
@@ -313,9 +346,10 @@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
 HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@
 HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
 HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
-HAVE_DECL_STRNCASECMP = @HAVE_DECL_STRNCASECMP@
+HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@
 HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
 HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
+HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@
 HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
 HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
 HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
@@ -323,7 +357,9 @@ HAVE_DUP2 = @HAVE_DUP2@
 HAVE_FSEEKO = @HAVE_FSEEKO@
 HAVE_FTELLO = @HAVE_FTELLO@
 HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
+HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
 HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
+HAVE_GZIP = @HAVE_GZIP@
 HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
 HAVE_IO_H = @HAVE_IO_H@
 HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
@@ -332,8 +368,10 @@ HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@
 HAVE_MEMPCPY = @HAVE_MEMPCPY@
 HAVE_MKDTEMP = @HAVE_MKDTEMP@
 HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@
+HAVE_OS_H = @HAVE_OS_H@
 HAVE_READLINK = @HAVE_READLINK@
 HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@
+HAVE_SETENV = @HAVE_SETENV@
 HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
 HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
 HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
@@ -341,7 +379,6 @@ HAVE_SLEEP = @HAVE_SLEEP@
 HAVE_STDINT_H = @HAVE_STDINT_H@
 HAVE_STPCPY = @HAVE_STPCPY@
 HAVE_STPNCPY = @HAVE_STPNCPY@
-HAVE_STRCASECMP = @HAVE_STRCASECMP@
 HAVE_STRCASESTR = @HAVE_STRCASESTR@
 HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
 HAVE_STRNDUP = @HAVE_STRNDUP@
@@ -350,10 +387,12 @@ HAVE_STRSEP = @HAVE_STRSEP@
 HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@
 HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
 HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
+HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
 HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
 HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
 HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
 HAVE_UNISTD_H = @HAVE_UNISTD_H@
+HAVE_UNSETENV = @HAVE_UNSETENV@
 HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
 HAVE_VASPRINTF = @HAVE_VASPRINTF@
 HAVE_VISIBILITY = @HAVE_VISIBILITY@
@@ -369,6 +408,8 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 INTLLIBS = @INTLLIBS@
 INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+KRB4_SECURITY = @KRB4_SECURITY@
+KRB5_SECURITY = @KRB5_SECURITY@
 LDFLAGS = @LDFLAGS@
 LEX = @LEX@
 LEXLIB = @LEXLIB@
@@ -385,6 +426,8 @@ LIBTHREAD = @LIBTHREAD@
 LIBTOOL = @LIBTOOL@
 LIBTOOL_DEPS = @LIBTOOL_DEPS@
 LN_S = @LN_S@
+LOCKING = @LOCKING@
+LOW_TCPPORTRANGE = @LOW_TCPPORTRANGE@
 LTLIBICONV = @LTLIBICONV@
 LTLIBINTL = @LTLIBINTL@
 LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
@@ -393,7 +436,6 @@ LTLIBPTH = @LTLIBPTH@
 LTLIBTHREAD = @LTLIBTHREAD@
 MAILER = @MAILER@
 MAKEINFO = @MAKEINFO@
-MAXTAPEBLOCKSIZE = @MAXTAPEBLOCKSIZE@
 MCUTIL = @MCUTIL@
 MKDIR_P = @MKDIR_P@
 MSGFMT = @MSGFMT@
@@ -429,26 +471,37 @@ PERL_INC = @PERL_INC@
 PKG_CONFIG = @PKG_CONFIG@
 POSUB = @POSUB@
 PRINT = @PRINT@
+PS = @PS@
+PS_ARGUMENT = @PS_ARGUMENT@
 PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
 RANLIB = @RANLIB@
 READLINE_LIBS = @READLINE_LIBS@
 REPLACE_CHOWN = @REPLACE_CHOWN@
 REPLACE_FCHDIR = @REPLACE_FCHDIR@
 REPLACE_FFLUSH = @REPLACE_FFLUSH@
+REPLACE_FOPEN = @REPLACE_FOPEN@
 REPLACE_FPRINTF = @REPLACE_FPRINTF@
+REPLACE_FREOPEN = @REPLACE_FREOPEN@
 REPLACE_FSEEK = @REPLACE_FSEEK@
 REPLACE_FSEEKO = @REPLACE_FSEEKO@
 REPLACE_FTELL = @REPLACE_FTELL@
 REPLACE_FTELLO = @REPLACE_FTELLO@
 REPLACE_GETCWD = @REPLACE_GETCWD@
 REPLACE_GETLINE = @REPLACE_GETLINE@
+REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
 REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
 REPLACE_LCHOWN = @REPLACE_LCHOWN@
 REPLACE_LSEEK = @REPLACE_LSEEK@
+REPLACE_MEMMEM = @REPLACE_MEMMEM@
 REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
 REPLACE_PRINTF = @REPLACE_PRINTF@
+REPLACE_PUTENV = @REPLACE_PUTENV@
 REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
 REPLACE_SPRINTF = @REPLACE_SPRINTF@
+REPLACE_STRCASESTR = @REPLACE_STRCASESTR@
+REPLACE_STRERROR = @REPLACE_STRERROR@
+REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@
+REPLACE_STRSTR = @REPLACE_STRSTR@
 REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
 REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
 REPLACE_VPRINTF = @REPLACE_VPRINTF@
@@ -456,7 +509,11 @@ REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
 REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
 REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
 RESTORE = @RESTORE@
+RSH_SECURITY = @RSH_SECURITY@
 SAMBA_CLIENT = @SAMBA_CLIENT@
+SERVER_HOST_INSTANCE = @SERVER_HOST_INSTANCE@
+SERVER_HOST_KEY_FILE = @SERVER_HOST_KEY_FILE@
+SERVER_HOST_PRINCIPAL = @SERVER_HOST_PRINCIPAL@
 SERVICE_SUFFIX = @SERVICE_SUFFIX@
 SETUID_GROUP = @SETUID_GROUP@
 SET_MAKE = @SET_MAKE@
@@ -466,6 +523,7 @@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
 SNAPSHOT_STAMP = @SNAPSHOT_STAMP@
 SORT = @SORT@
 SSH = @SSH@
+SSH_SECURITY = @SSH_SECURITY@
 STDBOOL_H = @STDBOOL_H@
 STDINT_H = @STDINT_H@
 STRIP = @STRIP@
@@ -475,7 +533,14 @@ SWIG_LIB = @SWIG_LIB@
 SYS_SOCKET_H = @SYS_SOCKET_H@
 SYS_STAT_H = @SYS_STAT_H@
 SYS_TIME_H = @SYS_TIME_H@
+TCPPORTRANGE = @TCPPORTRANGE@
+TICKET_LIFETIME = @TICKET_LIFETIME@
+UDPPORTRANGE = @UDPPORTRANGE@
+UNCOMPRESS_OPT = @UNCOMPRESS_OPT@
+UNCOMPRESS_PATH = @UNCOMPRESS_PATH@
+USE_AMANDAHOSTS = @USE_AMANDAHOSTS@
 USE_NLS = @USE_NLS@
+USE_RUNDUMP = @USE_RUNDUMP@
 USE_VERSION_SUFFIXES = @USE_VERSION_SUFFIXES@
 VDUMP = @VDUMP@
 VERSION = @VERSION@
@@ -484,6 +549,7 @@ VERSION_MAJOR = @VERSION_MAJOR@
 VERSION_MINOR = @VERSION_MINOR@
 VERSION_PATCH = @VERSION_PATCH@
 VERSION_SUFFIX = @VERSION_SUFFIX@
+VOID_UNSETENV = @VOID_UNSETENV@
 VRESTORE = @VRESTORE@
 VXDUMP = @VXDUMP@
 VXRESTORE = @VXRESTORE@
@@ -512,6 +578,7 @@ am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+amdatadir = @amdatadir@
 amincludedir = @amincludedir@
 amlibdir = @amlibdir@
 amlibexecdir = @amlibexecdir@
@@ -530,6 +597,8 @@ dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 gl_LIBOBJS = @gl_LIBOBJS@
 gl_LTLIBOBJS = @gl_LTLIBOBJS@
+gltests_LIBOBJS = @gltests_LIBOBJS@
+gltests_LTLIBOBJS = @gltests_LTLIBOBJS@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
@@ -559,64 +628,80 @@ target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 AMPLOT_MAN_PAGES = amplot.8
 COMMON_MAN_PAGES = amanda.8 \
                    amanda.conf.5 \
-                   amanda-client.conf.5
-
-SERVER_MAN_PAGES = amadmin.8 \
-                   amcheck.8 \
-                   amcheckdb.8 \
-                   amcheckdump.8 \
-                   amcleanup.8 \
-                   amdd.8 \
-                   amdevcheck.8 \
-                   amdump.8 \
-                   amflush.8 \
-                   amgetconf.8 \
-                   amlabel.8 \
-                   ammt.8 \
-                   amoverview.8 \
-                   amreport.8 \
-                   amrmtape.8 \
-                   amstatus.8 \
-                   amtape.8 \
-                   amtapetype.8 \
-                   amtoc.8 \
-                   amverify.8 \
-                   amverifyrun.8 \
-                   amserverconfig.8 \
-                   amaddclient.8 \
-                   amcheckdump.8 \
-                   amcrypt.8 \
-                   amaespipe.8 \
-                   amgpgcrypt.8 \
-                   amcryptsimple.8  \
-                   amcrypt-ossl.8 \
-                   amcrypt-ossl-asym.8
+                   amanda-client.conf.5 \
+                   amanda-scripts.7 \
+                   amanda-archive-format.5 \
+                   amanda-auth.7 \
+                   amarchiver.8 \
+                   script-email.8
+
+CLIENT_MAN_PAGES = \
+    amanda-applications.7 \
+    amgtar.8 \
+    amsamba.8 \
+    amstar.8 \
+    amzfs-snapshot.8 \
+    amzfs-sendrecv.8
+
+SERVER_MAN_PAGES = \
+    amanda-devices.7 \
+    amanda-changers.7 \
+    amaddclient.8    \
+    amadmin.8 \
+    amaespipe.8 \
+    amcheck.8 \
+    amcheckdb.8 \
+    amcheckdump.8 \
+    amcleanup.8 \
+    amcrypt-ossl-asym.8 \
+    amcrypt-ossl.8   \
+    amcrypt.8 \
+    amcryptsimple.8  \
+    amdevcheck.8 \
+    amdump.8 \
+    amflush.8 \
+    amgetconf.8 \
+    amgpgcrypt.8 \
+    amlabel.8 \
+    amoverview.8 \
+    amreport.8 \
+    amrmtape.8 \
+    amserverconfig.8 \
+    amservice.8 \
+    amstatus.8 \
+    amtape.8 \
+    amtapetype.8 \
+    amtoc.8 \
+    amvault.8 \
+    disklist.5 \
+    tapelist.5
 
 RECOVER_MAN_PAGES = amrecover.8
 RESTORE_MAN_PAGES = amrestore.8 \
                     amfetchdump.8
 
 ALL_MAN_PAGES = $(AMPLOT_MAN_PAGES) \
-          $(COMMON_MAN_PAGES) \
+          $(CLIENT_MAN_PAGES) \
           $(COMMON_MAN_PAGES) \
           $(SERVER_MAN_PAGES) \
           $(RECOVER_MAN_PAGES) \
           $(RESTORE_MAN_PAGES)
 
 WANTED_MAN_PAGES = $(COMMON_MAN_PAGES) $(am__append_1) $(am__append_2) \
-       $(am__append_3) $(am__append_4)
+       $(am__append_3) $(am__append_4) $(am__append_5)
 SRCMANPAGEDIR = $(srcdir)/xml-source
 MAN_XML = $(ALL_MAN_PAGES:%=xml-source/%.xml)
 EXTRA_XML = xslt/expand-sambadoc.xsl \
             xslt/man.xsl.in \
             xslt/html.xsl.in \
             xslt/settings.xsl \
-           entities/global.entities \
+           entities/global.entities.in \
            entities/xinclude.dtd
 
 
@@ -711,6 +796,51 @@ uninstall-man5:
          echo " rm -f '$(DESTDIR)$(man5dir)/$$inst'"; \
          rm -f "$(DESTDIR)$(man5dir)/$$inst"; \
        done
+install-man7: $(man7_MANS) $(man_MANS)
+       @$(NORMAL_INSTALL)
+       test -z "$(man7dir)" || $(MKDIR_P) "$(DESTDIR)$(man7dir)"
+       @list='$(man7_MANS) $(dist_man7_MANS) $(nodist_man7_MANS)'; \
+       l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+       for i in $$l2; do \
+         case "$$i" in \
+           *.7*) 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 \
+           7*) ;; \
+           *) ext='7' ;; \
+         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)$(man7dir)/$$inst'"; \
+         $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man7dir)/$$inst"; \
+       done
+uninstall-man7:
+       @$(NORMAL_UNINSTALL)
+       @list='$(man7_MANS) $(dist_man7_MANS) $(nodist_man7_MANS)'; \
+       l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+       for i in $$l2; do \
+         case "$$i" in \
+           *.7*) list="$$list $$i" ;; \
+         esac; \
+       done; \
+       for i in $$list; do \
+         ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+         case "$$ext" in \
+           7*) ;; \
+           *) ext='7' ;; \
+         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)$(man7dir)/$$inst'"; \
+         rm -f "$(DESTDIR)$(man7dir)/$$inst"; \
+       done
 install-man8: $(man8_MANS) $(man_MANS)
        @$(NORMAL_INSTALL)
        test -z "$(man8dir)" || $(MKDIR_P) "$(DESTDIR)$(man8dir)"
@@ -796,7 +926,7 @@ check-am: all-am
 check: check-am
 all-am: Makefile $(MANS)
 installdirs:
-       for dir in "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)"; do \
+       for dir in "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man7dir)" "$(DESTDIR)$(man8dir)"; do \
          test -z "$$dir" || $(MKDIR_P) "$$dir"; \
        done
 install: install-am
@@ -851,7 +981,7 @@ install-html: install-html-am
 
 install-info: install-info-am
 
-install-man: install-man5 install-man8
+install-man: install-man5 install-man7 install-man8
 
 install-pdf: install-pdf-am
 
@@ -877,7 +1007,7 @@ ps-am:
 
 uninstall-am: uninstall-man
 
-uninstall-man: uninstall-man5 uninstall-man8
+uninstall-man: uninstall-man5 uninstall-man7 uninstall-man8
 
 .MAKE: install-am install-strip
 
@@ -887,27 +1017,32 @@ uninstall-man: uninstall-man5 uninstall-man8
        install-am install-data install-data-am install-dvi \
        install-dvi-am install-exec install-exec-am install-html \
        install-html-am install-info install-info-am install-man \
-       install-man5 install-man8 install-pdf install-pdf-am \
-       install-ps install-ps-am install-strip installcheck \
-       installcheck-am installdirs maintainer-clean \
+       install-man5 install-man7 install-man8 install-pdf \
+       install-pdf-am install-ps install-ps-am install-strip \
+       installcheck installcheck-am installdirs maintainer-clean \
        maintainer-clean-generic mostlyclean mostlyclean-generic \
        mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
-       uninstall-man uninstall-man5 uninstall-man8
+       uninstall-man uninstall-man5 uninstall-man7 uninstall-man8
 
 
 # some of the XSL needs to know what docbook-xsl version we've selected
 %.xsl: %.xsl.in $(top_builddir)/config.status
        $(top_builddir)/config.status --file=$@:$<
+       rm -f config.log
+
+entities/global.entities: entities/global.entities.in $(top_builddir)/config.status
+       $(top_builddir)/config.status --file=$@:$<
+       rm -f config.log
 
 # phase one of the documentation build expands some macros.
-@ENABLE_MANPAGE_BUILD_TRUE@xml-source/%.proc.xml: $(SRCMANPAGEDIR)/%.xml $(srcdir)/xslt/expand-sambadoc.xsl
+@ENABLE_MANPAGE_BUILD_TRUE@xml-source/%.proc.xml: $(SRCMANPAGEDIR)/%.xml $(srcdir)/xslt/expand-sambadoc.xsl entities/global.entities
 @ENABLE_MANPAGE_BUILD_TRUE@    $(XSLTPROC) $(XSLTPROC_FLAGS) --path $(srcdir)/xslt/ --xinclude --stringparam latex.imagebasedir "$*/" --stringparam noreference 1 --output $@ $(srcdir)/xslt/expand-sambadoc.xsl $<
 
 # phase two generates a manpage from the resulting "expanded" docbook XML
-@ENABLE_MANPAGE_BUILD_TRUE@%: xml-source/%.proc.xml $(srcdir)/xslt/man.xsl
+@ENABLE_MANPAGE_BUILD_TRUE@%: xml-source/%.proc.xml $(srcdir)/xslt/man.xsl entities/global.entities
 @ENABLE_MANPAGE_BUILD_TRUE@    $(XSLTPROC) $(XSLTPROC_FLAGS) --path $(srcdir)/xslt/ --output $@ xslt/man.xsl $<
 
-@ENABLE_MANPAGE_BUILD_TRUE@%.html: xml-source/%.proc.xml $(srcdir)/xslt/html.xsl
+@ENABLE_MANPAGE_BUILD_TRUE@%.html: xml-source/%.proc.xml $(srcdir)/xslt/html.xsl entities/global.entities
 @ENABLE_MANPAGE_BUILD_TRUE@    $(XSLTPROC) $(XSLTPROC_FLAGS) --path $(srcdir)/xslt/ --output $@ xslt/html.xsl $<
 
 @ENABLE_MANPAGE_BUILD_FALSE@%: $(SRCMANPAGEDIR)/%.xml
index 0857293bd8efc18394003cf0af95bf6753dcaeb6..35d1cf72acdf688b2d5a515b217aa9b9e98a213e 100644 (file)
 .\"     Title: amaddclient
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
+.\"    Author: Kevin Till <kevin.till@zmanda.com>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
 .\"
-.TH "AMADDCLIENT" "8" "08/22/2008" "" ""
+.TH "AMADDCLIENT" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
 .ad l
-.SH "NAME"
-amaddclient - program to add client to an existing Amanda configuration
-.SH "SYNOPSIS"
-.HP 12
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amaddclient \- program to add client to an existing \fIAmanda\fR configuration
+.SH "Synopsis"
+.fam C
+.HP \w'\fBamaddclient\fR\ 'u
 \fBamaddclient\fR \-\-config \fIconfig\fR ||
  \-\-client \fIclient\ name\fR ||
  \-\-diskdev \fIdirectory\ to\ backup\fR [\-\-m] [\-\-dumptype\ \fIstring\fR] [\-\-includefile\ \fIstring\fR] [\-\-includelist\ \fIstring\fR] [\-\-excludefile\ \fIstring\fR] [\-\-excludelist\ \fIstring\fR] [\-\-user\ \fIstring\fR] [\-\-auth\ \fIstring\fR] [\-\-gnutar_list_dir\ \fIstring\fR] [\-\-amandates\ \fIstring\fR] [\-\-no\-client\-update] [\-\-batch] [\-\-help]
+.fam
 .SH "DESCRIPTION"
 .PP
 After Amanda rpms are successfully installed and
@@ -25,85 +183,90 @@ is run,
 \fBamaddclient\fR
 will add client to the
 \fIAmanda\fR
-configuration\.
+configuration\&.
 \fBamaddclient\fR
 create or update
 \fIAmanda\fR
-disklist file and create or update /var/lib/amanda/\.amandahosts file on the server\.
+\fBdisklist\fR(5)
+file and create or update /var/lib/amanda/\&.amandahosts file on the server\&.
 .PP
 If \-\-no\-client\-update is not specified,
 \fBamaddclient\fR
-will attempt to update or create /var/lib/amanda/\.amandahost, amanda\-client\.conf and gnutar\-lists on the client\. (See
+will attempt to update or create /var/lib/amanda/\&.amandahost, amanda\-client\&.conf and gnutar\-lists on the client\&. (See
 ssh\-keygen(1)
 and
 ssh\-add(1)
-for detail\.)
+for detail\&.)
 .PP
 
 \fBamaddclient\fR
-must be run by user amandabackup\.
+must be run by user amandabackup\&.
 .PP
-\-\-config, \-\-client and \-\-diskdev must be specified\.
-.SH "OPTIONS"
+\-\-config, \-\-client and \-\-diskdev must be specified\&.
+.SH "Options"
 .PP
 .RS 4
 
-Options may be abbreviated, as long as the abbreviation is not ambiguous\. Option argument can either separated by \'=\' or a space\.
-Example: \-\-conf=v253, \-\-client client8\.zmanda\.com
+Options may be abbreviated, as long as the abbreviation is not ambiguous\&. Option argument can either separated by \'=\' or a space\&.
+Example: \-\-conf=v253, \-\-client client8\&.zmanda\&.com
 .RE
 .PP
 \fB\-\-config config\fR
 .RS 4
 \fIAmanda\fR
-configuration which this program will add the client to\.
+configuration which this program will add the client to\&.
 .RE
 .PP
 \fB\-\-client client\fR
 .RS 4
-The name of the client machine to add\. FQDN name recommended\.
+The name of the client machine to add\&. FQDN name recommended\&.
 .RE
 .PP
 \fB\-\-diskdev diskdev\fR
 .RS 4
 Directory for this
 \fIAmanda\fR
-configuration to backup\.
+configuration to backup\&.
 .RE
 .PP
 \fB\-\-m\fR
 .RS 4
-Modify existing entry in the disklist file\.
+Modify existing entry in the
+\fBdisklist\fR(5)
+file\&.
 .sp
-Note: if disklist file has been modified manually, this option might not work\.
+Note: if
+\fBdisklist\fR(5)
+file has been modified manually, this option might not work\&.
 .RE
 .PP
 \fB\-\-dumptype dumptype\fR
 .RS 4
-dumptype to use\. Dumptype must be defined in /etc/amanda/template\.d/dumptypes or /etc/amanda/$config/amanda\.conf file\. Default: [user\-tar]
+dumptype to use\&. Dumptype must be defined in /etc/amanda/template\&.d/dumptypes or /etc/amanda/$config/amanda\&.conf file\&. Default: [user\-tar]
 .RE
 .PP
 \fB\-\-user string\fR
 .RS 4
 name of user using
 \fBamrecover\fR
-on the client, default is root\.
+on the client, default is root\&.
 .RE
 .PP
 \fB\-\-auth string\fR
 .RS 4
 authentication method to use when running
 \fBamrecover\fR
-from the client , default is bsdtcp\.
+from the client , default is bsdtcp\&.
 .RE
 .PP
 \fB\-\-gnutar_list_dir string\fR
 .RS 4
-directory where gnutar keep its state file on the client\. Absolute path required\. Default is /var/lib/amanda/gnutar\-lists\. If \-\-no\-client\-update is not set, this program will attempt to create the directory on the client\.
+directory where gnutar keep its state file on the client\&. Absolute path required\&. Default is /var/lib/amanda/gnutar\-lists\&. If \-\-no\-client\-update is not set, this program will attempt to create the directory on the client\&.
 .RE
 .PP
 \fB\-\-amandates string\fR
 .RS 4
-file where amanda keep the date of each dumplevel on the client, default is /etc/amandates\.
+file where amanda keep the date of each dumplevel on the client, default is /etc/amandates\&.
 .RE
 .PP
 \fB\-\-batch\fR
@@ -115,17 +278,17 @@ Turn on batch mode when copying files to the client, default is off
 .RS 4
 If this option is set,
 \fBamaddclient\fR
-will not attempt to update/create \.amandahosts, amanda\-client\.conf and gnutar\-lists file on the client\.
+will not attempt to update/create \&.amandahosts, amanda\-client\&.conf and gnutar\-lists file on the client\&.
 .RE
 .PP
 \fB\-\-help\fR
 .RS 4
-Display usage\.
+Display usage\&.
 .RE
 .PP
 .RS 4
  
-If any of the following four options are used,  \fBamaddclient\fR will extend the dumptype definition to an in\-line definition in the disklist file\. See \fBamanda\fR(8) DISKLIST FILE section for detail\.
+If any of the following four options are used,  \fBamaddclient\fR will extend the dumptype definition to an in\-line definition in the \fBdisklist\fR(5) file\&.
 .RE
 .PP
 \fB\-\-includefile string\fR
@@ -135,7 +298,7 @@ string is a glob expression
 .PP
 \fB\-\-includelist string\fR
 .RS 4
-string is a file name on the client containing glob expressions\. Specify either \-\-includefile or \-\-includelist\.
+string is a file name on the client containing glob expressions\&. Specify either \-\-includefile or \-\-includelist\&.
 .RE
 .PP
 \fB\-\-excludefile string\fR
@@ -145,11 +308,11 @@ string is a glob expression
 .PP
 \fB\-\-excludelist string\fR
 .RS 4
-string is a file name on the client containing glob expressions\. Specify either \-\-excludefile or \-\-excludelist\.
+string is a file name on the client containing glob expressions\&. Specify either \-\-excludefile or \-\-excludelist\&.
 .RE
-.SH "FILES"
+.SH "Files"
 .PP
-\fB/var/lib/amanda/template\.d\fR
+\fB/var/lib/amanda/template\&.d\fR
 .RS 4
 Amanda configuration template files install location
 .RE
@@ -159,48 +322,45 @@ Amanda configuration template files install location
 amandabackup home directory
 .RE
 .PP
-\fB/var/lib/amanda/\.amandahosts\fR
+\fB/var/lib/amanda/\&.amandahosts\fR
 .RS 4
 \fIAmanda\fR
-authentication file\.
+authentication file\&.
 .RE
 .PP
 \fB/var/lib/amanda/gnutar\-lists\fR
 .RS 4
-A directory which contains backup timestamp and list of files backed up\.
+A directory which contains backup timestamp and list of files backed up\&.
 .RE
 .PP
 \fB/etc/amanda/$config\fR
 .RS 4
 \fIAmanda\fR
-configuration files location for $config(e\.g: DailySet1)\.
+configuration files location for $config(e\&.g: DailySet1)\&.
 .RE
 .PP
-\fB/etc/amanda/template\.d\fR
+\fB/etc/amanda/template\&.d\fR
 .RS 4
 A directory contains dumptypes and tapetypes files used by all
 \fIAmanda\fR
-configurations\.
+configurations\&.
 .RE
 .PP
 \fB/etc/amandates\fR
 .RS 4
 \fIAmanda\fR
-file on the client\. It keeps track of structures of previous dumps\.
+file on the client\&. It keeps track of structures of previous dumps\&.
 .RE
 .PP
 \fB/tmp/amanda\fR
 .RS 4
 directory contains
 \fIAmanda\fR
-debug log files\.
+debug log files\&.
 .RE
 .SH "RETURN VALUE"
 
-On success, zero is returned\.  On error, 1 is returned\.
-.SH "AUTHOR"
-.PP
-The tool and its documentation was written by Zmanda, Inc (http://www\.zmanda\.com/)\.
+On success, zero is returned\&.  On error, 1 is returned\&.
 .SH "SEE ALSO"
 .PP
 \fBamanda\fR(8),
@@ -210,3 +370,9 @@ The tool and its documentation was written by Zmanda, Inc (http://www\.zmanda\.c
 \fBssh-add\fR(1)
 \fBscp\fR(1)
 : http://wiki.zmanda.com
+.SH "Author"
+.PP
+\fBKevin Till\fR <\&kevin\&.till@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
index 871d67914c20e97a277e61dc3d0e3ffd9053f3bc..c4455b33529d444c5473733bc54ff0c7a914d7b8 100644 (file)
 .\"     Title: amadmin
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
+.\"    Author: James da Silva <jds@amanda.org>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
 .\"
-.TH "AMADMIN" "8" "08/22/2008" "" ""
+.TH "AMADMIN" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
 .ad l
-.SH "NAME"
-amadmin - administrative interface to control Amanda backups
-.SH "SYNOPSIS"
-.HP 8
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amadmin \- administrative interface to control \fIAmanda\fR backups
+.SH "Synopsis"
+.fam C
+.HP \w'\fBamadmin\fR\ 'u
 \fBamadmin\fR \fIconfig\fR \fIcommand\fR [\fIcommand_options\fR...] [\fB\-o\ \fR\fIconfigoption\fR]...
+.fam
 .SH "DESCRIPTION"
 .PP
 \fBAmadmin\fR
 performs various administrative tasks on the
 \fIconfig\fR
 \fIAmanda\fR
-configuration\.
+configuration\&.
 .PP
 See the
 \fBamanda\fR(8)
 man page for more details about
-\fIAmanda\fR\.
+\fIAmanda\fR\&.
 .SH "COMMANDS"
 .PP
 Commands that take a
@@ -34,31 +192,31 @@ Commands that take a
 [
 \fIdisks\fR
 ] parameter pair operate on all disks in the
-\fIdisklist\fR
+\fBdisklist\fR(5)
 for that
 \fIhostname\fR
-if no disks are specified\. Where
+if no disks are specified\&. Where
 \fIhostname\fR
 is also marked as being optional, the command operates on all hosts and disks in the
-\fIdisklist\fR\. Both
+\fBdisklist\fR(5)\&. Both
 \fIhostname\fR
 and
 \fIdisks\fR
 are special expressions; see the "HOST & DISK EXPRESSION" section of
 \fBamanda\fR(8)
-for a description\.
+for a description\&.
 .PP
 Commands that take one or more
 \fIdumpspec\fR
-parameters operate on the set of dumps specified by all of the expressions\. See the "DUMP SPECIFICATIONS" section of
+parameters operate on the set of dumps specified by all of the expressions\&. See the "DUMP SPECIFICATIONS" section of
 \fBamanda\fR(8)
-for a description\.
+for a description\&.
 .PP
 \fBversion\fR
 .RS 4
-Show the current version and some compile time and runtime parameters\. The
+Show the current version and some compile time and runtime parameters\&. The
 \fIconfig\fR
-parameter must be present but is ignored\.
+parameter must be present but is ignored\&.
 .RE
 .PP
 \fBforce\-bump\fR [ \fIhostname\fR [ \fIdisks\fR ]* ]+
@@ -69,7 +227,7 @@ on
 \fIhostname\fR
 to bump to a new incremental level during the next
 \fIAmanda\fR
-run\.
+run\&.
 .RE
 .PP
 \fBforce\-no\-bump\fR [ \fIhostname\fR [ \fIdisks\fR ]* ]+
@@ -80,7 +238,7 @@ on
 \fIhostname\fR
 to not bump to a new incremental level during the next
 \fIAmanda\fR
-run\.
+run\&.
 .RE
 .PP
 \fBunforce\-bump\fR [ \fIhostname\fR [ \fIdisks\fR ]* ]+
@@ -89,7 +247,7 @@ Undo a previous
 \fBforce\-bump\fR
 or
 \fBforce\-no\-bump\fR
-command\.
+command\&.
 .RE
 .PP
 \fBforce\fR [ \fIhostname\fR [ \fIdisks\fR ]* ]+
@@ -100,45 +258,45 @@ on
 \fIhostname\fR
 to do a full (level 0) backup during the next
 \fIAmanda\fR
-run\.
+run\&.
 .RE
 .PP
 \fBunforce\fR [ \fIhostname\fR [ \fIdisks\fR ]* ]+
 .RS 4
 Undo a previous
 \fBforce\fR
-command\.
+command\&.
 .RE
 .PP
-\fBreuse\fR \fItapelabel\fR [ \.\.\. ]
+\fBreuse\fR \fItapelabel\fR [ \&.\&.\&. ]
 .RS 4
-The tapes listed will be available for reuse at their point in the tape cycle\.
+The tapes listed will be available for reuse at their point in the tape cycle\&.
 .RE
 .PP
-\fBno\-reuse\fR \fItapelabel\fR [ \.\.\. ]
+\fBno\-reuse\fR \fItapelabel\fR [ \&.\&.\&. ]
 .RS 4
-The tapes listed will not be reused when their turn comes up again in the tape cycle\. Note that if this causes the number of reusable tapes to drop below the
-\fBamanda\.conf\fR
+The tapes listed will not be reused when their turn comes up again in the tape cycle\&. Note that if this causes the number of reusable tapes to drop below the
+\fBamanda\&.conf\fR
 \fItapecycle\fR
 value,
 \fIAmanda\fR
-will request new tapes until the count is satisfied again\.
+will request new tapes until the count is satisfied again\&.
 .sp
 Tape marked
 \fIno\-reuse\fR
 are available for recovery, marking them
 \fIno\-reuse\fR
-is a security to be sure amanda will not overwrite them\.
+is a security to be sure amanda will not overwrite them\&.
 .RE
 .PP
 \fBdue\fR [ \fIhostname\fR [ \fIdisks\fR ]* ]*
 .RS 4
-Show when the next full dump is due\.
+Show when the next full dump is due\&.
 .RE
 .PP
-\fBfind\fR [ \fB\-\-sort\fR \fIhkdlpb\fR ] [ \fIhostname\fR [ \fIdisks\fR ]* ]*
+\fBfind\fR [ \fB\-\-sort\fR \fIhkdlpbfw\fR ] [ \fIhostname\fR [ \fIdisks\fR ]* ]*
 .RS 4
-Display all backups currently on tape or in the holding disk\. The tape label or holding disk filename, file number, and status are displayed\.
+Display all backups currently on tape or in the holding disk\&. The tape label or holding disk filename, file number, and status are displayed\&.
 .sp
 The
 \fB\-\-sort\fR
@@ -147,28 +305,30 @@ option changes the sort order using the following flags:
 .nf
 \fIh\fR: host name
 \fIk\fR: disk name
-\fId\fR: dump date
+\fId\fR: dump timestamp
 \fIl\fR: backup level
 \fIp\fR: dump part
 \fIb\fR: tape label
+\fIf\fR: filenum on tape
+\fIw\fR: write timestamp
 .fi
 .sp
-An uppercase letter reverses the sort order for that key\. The default sort order is
-\fBhkdlpb\fR\.
+An uppercase letter reverses the sort order for that key\&. The default sort order is
+\fBhkdlpbfw\fR\&.
 .RE
 .PP
-\fBholding delete\fR \fIhostname\fR [ \fIdisk\fR [ \fIdatestamp\fR [ \.\. ] ] ]
+\fBholding delete\fR \fIhostname\fR [ \fIdisk\fR [ \fIdatestamp\fR [ \&.\&. ] ] ]
 .RS 4
-Delete holding files matching the given specification\. At least a hostname must be provided\.
+Delete holding files matching the given specification\&. At least a hostname must be provided\&.
 .RE
 .PP
-\fBholding list\fR [\-l] [\-d] [ \fIhostname\fR [ \fIdisk\fR [ \fIdatestamp\fR [ \.\. ] ] ] ]
+\fBholding list\fR [\-l] [\-d] [ \fIhostname\fR [ \fIdisk\fR [ \fIdatestamp\fR [ \&.\&. ] ] ] ]
 .RS 4
-List holding files matching the given specification, or all holding files if no specification is provided\. With \'\-l\', additional information (size, level, and whether the dump is outdated) is provided\. With \'\-d\', only outdated dumps are shown\.
+List holding files matching the given specification, or all holding files if no specification is provided\&. With \'\-l\', additional information (size, level, and whether the dump is outdated) is provided\&. With \'\-d\', only outdated dumps are shown\&.
 .sp
 An outdated holding file is one which is not required for a restore of the
 \fImost recent\fR
-dump\. Note that outdated dumps may still be required for restores at earlier dates\. For example, assume that a DLE had a level 0 on Monday, level 1\'s Tuesday through Thursday, and a level 2 on Friday\. Then the files required for a restore of Fridays (the most recent) dump are those from Monday (level 0), Thursday (level 1), and Friday (level 2)\. Tuesday and Wednesday\'s files are outdated\.
+dump\&. Note that outdated dumps may still be required for restores at earlier dates\&. For example, assume that a DLE had a level 0 on Monday, level 1\'s Tuesday through Thursday, and a level 2 on Friday\&. Then the files required for a restore of Fridays (the most recent) dump are those from Monday (level 0), Thursday (level 1), and Friday (level 2)\&. Tuesday and Wednesday\'s files are outdated\&.
 .RE
 .PP
 \fBdelete\fR [ \fIhostname\fR [ \fIdisks\fR ]* ]+
@@ -179,36 +339,46 @@ on
 \fIhostname\fR
 from the
 \fIAmanda\fR
-database\.
+database\&.
+.if n \{\
 .sp
+.\}
+.RS 4
+.BM yellow
 .it 1 an-trap
 .nr an-no-space-flag 1
 .nr an-break-flag 1
 .br
-Note
+.ps +1
+\fBNote\fR
+.ps -1
+.br
 If you do not also remove the disk from the
-\fIdisklist\fR
+\fBdisklist\fR(5)
 file,
 \fIAmanda\fR
-will treat it as a new disk during the next run\.
+will treat it as a new disk during the next run\&.
+.sp .5v
+.EM yellow
+.RE
 .RE
 .PP
 \fBtape\fR
 .RS 4
 Display the tape(s)
 \fIAmanda\fR
-expects to write to during the next run\. See also
-\fBamcheck\fR(8)\.
+expects to write to during the next run\&. See also
+\fBamcheck\fR(8)\&.
 .RE
 .PP
 \fBbumpsize\fR
 .RS 4
-Display the current bump threshold parameters, calculated for all backup levels\.
+Display the current bump threshold parameters, calculated for all backup levels\&.
 .RE
 .PP
 \fBbalance\fR [ \fB\-\-days\fR \fI<num>\fR ]
 .RS 4
-Display the distribution of full backups throughout the dump schedule\.
+Display the distribution of full backups throughout the dump schedule\&.
 .RE
 .PP
 \fBexport\fR [ \fIhostname\fR [ \fIdisks\fR ]* ]*
@@ -218,7 +388,7 @@ Convert records from the
 database to a text format that may be transmitted to another
 \fIAmanda\fR
 machine and
-\fBimport\fRed\.
+\fBimport\fRed\&.
 .RE
 .PP
 \fBimport\fR
@@ -226,18 +396,18 @@ machine and
 Convert
 \fBexport\fRed records read from standard input to a form
 \fIAmanda\fR
-uses and insert them into the database on this machine\.
+uses and insert them into the database on this machine\&.
 .RE
 .PP
 \fBdisklist\fR [ \fIhostname\fR [ \fIdisks\fR ]* ]*
 .RS 4
 Display the
-\fIdisklist\fR
+\fBdisklist\fR(5)
 information for each of the
 \fIdisks\fR
 on
 \fIhostname\fR
-(or all hosts)\. Mostly used for debugging\.
+(or all hosts)\&. Mostly used for debugging\&.
 .RE
 .PP
 \fBinfo\fR [ \fIhostname\fR [ \fIdisks\fR ]* ]*
@@ -246,13 +416,13 @@ Display the database record for each of the
 \fIdisks\fR
 on
 \fIhostname\fR
-(or all hosts)\. Mostly used for debugging\.
+(or all hosts)\&. Mostly used for debugging\&.
 .RE
 .PP
 \fB\-o\fR \fIconfigoption\fR
 .RS 4
 See the "\fBCONFIGURATION OVERRIDE\fR" section in
-\fBamanda\fR(8)\.
+\fBamanda\fR(8)\&.
 .RE
 .SH "EXAMPLES"
 .PP
@@ -260,54 +430,54 @@ Request three specific file systems on
 \fImachine\-a\fR
 get a full level 0 backup during the next
 \fIAmanda\fR
-run\.
+run\&.
 .nf
 $ amadmin daily force machine\-a / /var /usr
-amadmin: machine\-a:/ is set to a forced level 0 tonight\.
-amadmin: machine\-a:/var is set to a forced level 0 tonight\.
-amadmin: machine\-a:/usr is set to a forced level 0 tonight\.
+amadmin: machine\-a:/ is set to a forced level 0 tonight\&.
+amadmin: machine\-a:/var is set to a forced level 0 tonight\&.
+amadmin: machine\-a:/usr is set to a forced level 0 tonight\&.
 .fi
 .PP
 Request all file systems on
 \fImachine\-b\fR
 get a full level 0 backup during the next
 \fIAmanda\fR
-run\.
+run\&.
 .nf
 $ amadmin daily force machine\-b
-amadmin: machine\-b:/ is set to a forced level 0 tonight\.
-amadmin: machine\-b:/var is set to a forced level 0 tonight\.
-amadmin: machine\-b:/usr is set to a forced level 0 tonight\.
-amadmin: machine\-b:/home is set to a forced level 0 tonight\.
+amadmin: machine\-b:/ is set to a forced level 0 tonight\&.
+amadmin: machine\-b:/var is set to a forced level 0 tonight\&.
+amadmin: machine\-b:/usr is set to a forced level 0 tonight\&.
+amadmin: machine\-b:/home is set to a forced level 0 tonight\&.
 .fi
 .PP
 Undo the previous
 \fBforce\fR
 request for
-\fI/home\fR
+\FC/home\F[]
 on
-\fImachine\-b\fR\. The other file systems will still get a full level 0 backup\.
+\fImachine\-b\fR\&. The other file systems will still get a full level 0 backup\&.
 .nf
 $ amadmin daily unforce machine\-b /home
-amadmin: force command for machine\-b:/home cleared\.
+amadmin: force command for machine\-b:/home cleared\&.
 .fi
 .PP
 Locate backup images of
-\fI/var\fR
+\FC/var\F[]
 from
-\fImachine\-c\fR\. The
+\fImachine\-c\fR\&. The
 \fItape or file\fR
-column displays either a tape label or a filename depending on whether the image is on tape or is still in the holding disk\. If the image is on tape, the
+column displays either a tape label or a filename depending on whether the image is on tape or is still in the holding disk\&. If the image is on tape, the
 \fIfile\fR
-column tells you which file on the tape has the image (file number zero is a tape label)\. This column shows zero and is not meaningful if the image is still in the holding disk\. The
+column tells you which file on the tape has the image (file number zero is a tape label)\&. This column shows zero and is not meaningful if the image is still in the holding disk\&. The
 \fIstatus\fR
-column tells you whether the backup was successful or had some type of error\.
+column tells you whether the backup was successful or had some type of error\&.
 .nf
 $ amadmin daily find machine\-c /var
 date        host      disk lv tape or file                 file part  status
 2000\-11\-09  machine\-c /var  0 000110                       9   \-\-  OK
 2000\-11\-08  machine\-c /var  2 000109                       2   \-\-  OK
-2000\-11\-07  machine\-c /var  2 /amanda/20001107/machine\-c\._var\.2  0 OK
+2000\-11\-07  machine\-c /var  2 /amanda/20001107/machine\-c\&._var\&.2  0 OK
 2000\-11\-06  machine\-c /var  2 000107                       2   \-\-  OK
 2000\-11\-05  machine\-c /var  2 000106                       3   \-\-  OK
 2000\-11\-04  machine\-c /var  2 000105                       2   \-\-  OK
@@ -318,80 +488,71 @@ date        host      disk lv tape or file                 file part  status
 .fi
 .PP
 Forget about the
-\fI/workspace\fR
+\FC/workspace\F[]
 disk on
-\fImachine\-d\fR\. If you do not also remove the disk from the
-\fIdisklist\fR
+\fImachine\-d\fR\&. If you do not also remove the disk from the
+\fBdisklist\fR(5)
 file,
 \fIAmanda\fR
-will treat it as a new disk during the next run\.
+will treat it as a new disk during the next run\&.
 .nf
 $ amadmin daily delete machine\-d /workspace
-amadmin: machine\-d:/workspace deleted from database\.
-amadmin: NOTE: you\'ll have to remove these from the disklist yourself\.
+amadmin: machine\-d:/workspace deleted from database\&.
+amadmin: NOTE: you\'ll have to remove these from the \fBdisklist\fR(5) yourself\&.
 .fi
 .PP
 Find the next tape
 \fIAmanda\fR
 will use (in this case,
-123456)\.
+\FC123456\F[])\&.
 .nf
 $ amadmin daily tape
-The next \fIAmanda\fR run should go onto tape 123456 or a new tape\.
+The next \fIAmanda\fR run should go onto tape 123456 or a new tape\&.
 .fi
 .PP
-Show how well full backups are balanced across the dump cycle\. The
+Show how well full backups are balanced across the dump cycle\&. The
 \fIdue\-date\fR
-column is the day the backups are due for a full backup\.
+column is the day the backups are due for a full backup\&.
 \fI#fs\fR
 shows the number of filesystems doing full backups that night, and
 \fIorig KB\fR
 and
 \fIout KB\fR
-show the estimated total size of the backups before and after any compression, respectively\.
+show the estimated total size of the backups before and after any compression, respectively\&.
 .PP
 The
 \fIbalance\fR
-column shows how far off that night\'s backups are from the average size (shown at the bottom of the balance column)\.
+column shows how far off that night\'s backups are from the average size (shown at the bottom of the balance column)\&.
 \fIAmanda\fR
 tries to keep the backups within +/\- 5%, but since the amount of data on each filesystem is always changing, and
 \fIAmanda\fR
-will never delay backups just to rebalance the schedule, it is common for the schedule to fluctuate by larger percentages\. In particular, in the case of a tape or backup failure, a bump will occur the following night, which will not be smoothed out until the next pass through the schedule\.
+will never delay backups just to rebalance the schedule, it is common for the schedule to fluctuate by larger percentages\&. In particular, in the case of a tape or backup failure, a bump will occur the following night, which will not be smoothed out until the next pass through the schedule\&.
 .PP
 The last line also shows an estimate of how many
 \fIAmanda\fR
-runs will be made between full backups for a file system\. In the example, a file system will probably have a full backup done every eight times
+runs will be made between full backups for a file system\&. In the example, a file system will probably have a full backup done every eight times
 \fIAmanda\fR
-is run (e\.g\. every eight days)\.
+is run (e\&.g\&. every eight days)\&.
 .nf
 $ amadmin daily balance
  due\-date  #fs   orig KB    out KB  balance
 \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
-11/10 Mon   21    930389    768753    +5\.1%
-11/11 Tue   29   1236272    733211    +0\.2%
-11/12 Wed   31   1552381    735796    +0\.6%
-11/13 Thu   23   1368447    684552    \-6\.4%
-11/14 Fri   32   1065603    758155    +3\.6%
-11/15 Sat   14   1300535    738430    +0\.9%
-11/16 Sun   31   1362696    740365    +1\.2%
-11/17 Mon   30   1427936    773397    +5\.7%
-11/18 Tue   11   1059191    721786    \-1\.3%
-11/19 Wed   19   1108737    661867    \-9\.5%
+11/10 Mon   21    930389    768753    +5\&.1%
+11/11 Tue   29   1236272    733211    +0\&.2%
+11/12 Wed   31   1552381    735796    +0\&.6%
+11/13 Thu   23   1368447    684552    \-6\&.4%
+11/14 Fri   32   1065603    758155    +3\&.6%
+11/15 Sat   14   1300535    738430    +0\&.9%
+11/16 Sun   31   1362696    740365    +1\&.2%
+11/17 Mon   30   1427936    773397    +5\&.7%
+11/18 Tue   11   1059191    721786    \-1\&.3%
+11/19 Wed   19   1108737    661867    \-9\&.5%
 \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
 TOTAL      241  12412187   7316312   731631  (estimated 8 runs per dumpcycle)
 .fi
 .SH "FILES"
 .PP
-/usr/local/etc/amanda/\fIconfig\fR/amanda\.conf
-.SH "AUTHOR"
-.PP
-James da Silva,
-<jds@amanda\.org>
-: Original text
-.PP
-Stefan G\. Weichinger,
-<sgw@amanda\.org>, maintainer of the
-\fIAmanda\fR\-documentation: XML\-conversion
+/usr/local/etc/amanda/\fIconfig\fR/amanda\&.conf
 .SH "SEE ALSO"
 .PP
 \fBamanda\fR(8),
@@ -400,3 +561,8 @@ Stefan G\. Weichinger,
 \fBamrestore\fR(8),
 \fBamfetchdump\fR(8),
 : http://wiki.zmanda.com
+.SH "Authors"
+.PP
+\fBJames da Silva\fR <\&jds@amanda\&.org\&>
+.PP
+\fBStefan G\&. Weichinger\fR <\&sgw@amanda\&.org\&>
index 5bf745110dcc3c305c52a03c381997f9b22879f7..383192e5453acfcb09b7a2ead1dbb60ebb4e0fcb 100644 (file)
 .\"     Title: amaespipe
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
+.\"    Author: Kevin Till <kevin.till@zmanda.com>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
 .\"
-.TH "AMAESPIPE" "8" "08/22/2008" "" ""
+.TH "AMAESPIPE" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
 .ad l
-.SH "NAME"
-amaespipe - wrapper program for aespipe
-.SH "SYNOPSIS"
-.HP 10
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amaespipe \- wrapper program for aespipe
+.SH "Synopsis"
+.fam C
+.HP \w'\fBamaespipe\fR\ 'u
 \fBamaespipe\fR
+.fam
 .SH "DESCRIPTION"
 .PP
 
@@ -24,12 +182,12 @@ requires
 \fBuuencode\fR
 and
 \fBgpg\fR
-to work\. Aespipe is available from
+to work\&. Aespipe is available from
 : http://loop-aes.sourceforge.net
 .PP
 
 \fBamaespipe\fR
-will search for the aespipe program in the following directories: /usr/bin:/usr/local/bin:/sbin:/usr/sbin\.
+will search for the aespipe program in the following directories: /usr/bin:/usr/local/bin:/sbin:/usr/sbin\&.
 .PP
 
 \fBamaespipe\fR
@@ -37,15 +195,15 @@ is called by
 \fBamcrypt\fR
 for
 \fIAmanda\fR
-data encryption\.
+data encryption\&.
 .PP
 
 \fBamaespipe\fR
-is based on aespipe\'s bzaespipe program\. It calls aespipe to encrypt data using AES256 as the encryption and SHA256 as the hash function\. GPG key should be stored in $AMANDA_HOME/\.gnupg/am_key\.gpg\.
+is based on aespipe\'s bzaespipe program\&. It calls aespipe to encrypt data using AES256 as the encryption and SHA256 as the hash function\&. GPG key should be stored in $AMANDA_HOME/\&.gnupg/am_key\&.gpg\&.
 \fBamaespipe\fR
-reads passphrase from file descriptor 3\. During decryption,
+reads passphrase from file descriptor 3\&. During decryption,
 \fBamaespipe\fR
-autodects encryption type and hash function from the encrypted image\.
+autodects encryption type and hash function from the encrypted image\&.
 .SH "SEE ALSO"
 .PP
 \fBamanda\fR(8),
@@ -54,3 +212,9 @@ autodects encryption type and hash function from the encrypted image\.
 \fBamcrypt\fR(8),
 \fBgpg\fR(1),
 : http://wiki.zmanda.com
+.SH "Author"
+.PP
+\fBKevin Till\fR <\&kevin\&.till@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
diff --git a/man/amanda-applications.7 b/man/amanda-applications.7
new file mode 100644 (file)
index 0000000..9c9e9e0
--- /dev/null
@@ -0,0 +1,241 @@
+.\"     Title: amanda-applications
+.\"    Author: Jean-Louis Martineau <martineau@zmanda.com>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: Miscellanea
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
+.\"
+.TH "AMANDA\-APPLICATIONS" "7" "01/22/2009" "Amanda 2\&.6\&.1" "Miscellanea"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amanda-applications \- Application\-api for amanda
+.SH "DESCRIPTION"
+.PP
+Describe how to use application with
+\fIAmanda\fR
+.SH "APPLICATIONS"
+.PP
+This section lists the applications included with
+\fIAmanda\fR\&. See the individual man pages for instructions on using them\&. For complete How\-To information, consult the Amanda wiki at http://wiki\&.zmanda\&.com\&.
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamgtar\fR(8),
+\- use GNU Tar to backup and restore data\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamsamba\fR(8),
+\- use smbclient to backup and restore data\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamstar\fR(8),
+\- use star to backup and restore data\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamzfs-sendrecv\fR(8),
+\- use zfs to create a snapshot and use \'zfs send\' to generate the backup\&.
+.RE
+.SH "SEE ALSO"
+.PP
+
+\fBamanda.conf\fR(5)
+.SH "Authors"
+.PP
+\fBJean\-Louis Martineau\fR <\&martineau@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
+.PP
+\fBDustin J\&. Mitchell\fR <\&dustin@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
diff --git a/man/amanda-archive-format.5 b/man/amanda-archive-format.5
new file mode 100644 (file)
index 0000000..46bbb50
--- /dev/null
@@ -0,0 +1,224 @@
+.\"     Title: amanda-archive-format
+.\"    Author: Dustin J. Mitchell <dustin@zmanda.com>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: File formats and conventions
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
+.\"
+.TH "AMANDA\-ARCHIVE\-FOR" "5" "01/22/2009" "Amanda 2\&.6\&.1" "File formats and conventions"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amanda-archive-format \- Format of amanda archive streams
+.SH "DESCRIPTION"
+.PP
+The
+\fIAmanda\fR
+archive format is designed to be a simple, efficient means of interleaving multiple simultaneous files, allowing an arbitrary number of data streams for a file\&. It is a streaming format in the sense that the writer need not know the size of files until they are completely written to the archive, and the reader can process the archive in constant space\&.
+.SH "DATA MODEL"
+.PP
+The data stored in an archive consists of an unlimited number of files\&. Each file consists of a number of "attributes", each identified by a 16\-bit ID\&. Each attribute can contain an unlimited amount of data\&.
+.PP
+Attribute IDs less than 16 (AMAR_ATTR_APP_START) are reserved for special purposes, but the remaining IDs are available for application\-specific uses\&.
+.SH "STRUCTURE"
+.SS "RECORDS"
+.PP
+A record can be either a header record or a data record\&. A header record serves as a "checkpoint" in the file, with a magic value that can be used to recognize archive files\&.
+.PP
+A header record has a fixed size of 28 bytes, as follows:
+.sp
+.nf
+  28 bytes:    magic string
+.fi
+The magic string is the ASCII text "AMANDA ARCHIVE FORMAT " followed by a decimal representation of the format version number (currently \'1\'), padded to 28 bytes with NUL bytes\&.
+.PP
+A data record has a variable size, as follows:
+.sp
+.nf
+  2 bytes:     file number
+  2 bytes:     attribute ID
+  4 bytes:     data size (N)
+  N bytes:     data
+.fi
+The file number and attribute ID serve to identify the data stream to which this data belongs\&. The low 31 bits of the data size give the number of data bytes following, while the high bit (the EOA bit) indicates the end of the attribute, as described below\&. Because records are generally read into memory in their entirety, the data size must not exceed 4MB (4194304 bytes)\&. All integers are in network byte order\&.
+.PP
+A header record is distinguished from a data record by the magic string\&. The file number 0x414d, corresponding to the characters "AM", is forbidden and must be skipped on writing\&.
+.PP
+Attribute ID 0 (AMAR_ATTR_FILENAME) gives the filename of a file\&. This attribute is mandatory for each file, must be nonempty, must fit in a single record, and must precede any other attributes for the same file in the archive\&. The filename should be a printable string (ASCII or UTF\-8), to facilitate use of generic archive\-display utilities, but the format permits any nonempty bytestring\&. The filename cannot span multiple records\&.
+.PP
+Attribute ID 1 (AMAR_ATTR_EOF) signals the end of a file\&. This attribute must contain no data, but should have the EOA bit set\&.
+.SS "CONNECTION TO DATA MODEL"
+.PP
+Each file in an archive is assigned a file number distinct from any other active file in the archive\&. The first record for a file must have attribute ID 0 (AMAR_ATTR_FILENAME), indicating a filename\&. A file ends with an empty record with ID 1 (AMAR_ATTR_EOF)\&. For every file at which a reader might want to begin reading, the filename record should be preceded by a header record\&. How often to write header records is left to the discretion of the application\&.
+.PP
+All data records with the same file number and attribute ID are considered a part of the same attribute\&. The boundaries between such records are not significant to the contents of the attribute, and both readers and writers are free to alter such boundaries as necessary\&.
+.PP
+The final data record for each attribute has the high bit (the EOA bit) of its data size field set\&. A writer must not reuse an attribute ID within a file\&. An attribute may be terminated by a record containing both data and an EOA bit, or by a zero\-length record with its EOA bit set\&.
+.SH "SEE ALSO"
+.PP
+
+\fBamanda\fR(8),
+.SH "Author"
+.PP
+\fBDustin J\&. Mitchell\fR <\&dustin@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
diff --git a/man/amanda-auth.7 b/man/amanda-auth.7
new file mode 100644 (file)
index 0000000..966a3d3
--- /dev/null
@@ -0,0 +1,835 @@
+.\"     Title: amanda-auth
+.\"    Author: Jean-Louis Martineau <martineau@zmanda.com>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: Miscellanea
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
+.\"
+.TH "AMANDA\-AUTH" "7" "01/22/2009" "Amanda 2\&.6\&.1" "Miscellanea"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amanda-auth \- Communication/Authentication methods between \fIAmanda\fR server and client
+.SH "DESCRIPTION"
+.PP
+\fIAmanda\fR
+offers 7 methods of communication between Amanda server (sometimes also called the tape server) and clients, each with its own authentication method\&. The desired communication method is specified by the
+\fIauth\fR
+parameter in the amanda\&.conf file (\fBamanda.conf\fR(5)) commonly as a dumptype\&. Valid values to the
+\fIauth\fR
+parameter are
+\fBbsd\fR,
+\fBbsdudp\fR,
+\fBbsdtcp\fR,
+\fBkrb4\fR,
+\fBkrb5\fR,
+\fBlocal\fR,
+\fBrsh\fR, and
+\fBssh\fR\&. Please note that
+\fBkrb4\fR
+will be removed in the next release\&. The authentication and communication method is used during the backup process
+\fBamdump\fR
+(amdump(8)) as well as the recovery process
+\fBamrecover\fR
+(amrecover(8))\&. For detailed information, please see http://wiki\&.zmanda\&.com/index\&.php/Server/Client_authentication\&.
+.SH "COMPILATION AND GENERAL INFORMATION"
+.PP
+The communication method and thus type of authentication that will be used by the Amanda server is specified by the
+\fIauth\fR
+parameter in the dumptype for each disklist entry (DLE)\&. The
+\fIauth\fR
+parameter thus may be easily and globally specified in the "global" dumptype\&. If
+\fIauth\fR
+is not specified, the
+\fBbsd\fR
+communication method is used\&. See
+\fBamanda.conf\fR(5)
+for more information on Amanda configuration and dumptypes, and
+\fBdisklist\fR(5)
+for more information on disklists\&.
+.PP
+On the client side, the Amanda daemon
+\fBamandad\fR
+validates the connection depending on the value of the
+\fBauth\fR
+argument passed to it (see
+\fIAmanda\fR(8))\&. Also, when it comes to recovery, the
+\fBauth\fR
+parameter can be specified in the
+\fBamanda-client.conf\fR(5)
+file to specify the communication method to be used by the client to the server\&.
+.PP
+When
+\fIAmanda\fR
+is being built from source code, desired communication and thus authentication methods (shown as "Authentication") must be specified as configure options at compilation time\&.
+.sp
+.nf
+Authentication   Configure option(s)
+ bsd                   \-\-with\-bsd\-security      \-\-with\-amandahosts (pre\-2\&.6)
+ bsdtcp                \-\-with\-bsdtcp\-security   \-\-with\-amandahosts (pre\-2\&.6)
+ bsdudp                \-\-with\-bsdudp\-security   \-\-with\-amandahosts (pre\-2\&.6)
+ krb5          \-\-with\-krb5\-security
+ local          (always included)
+ rsh                   \-\-with\-rsh\-security
+ ssh                   \-\-with\-ssh\-security
+.fi
+.PP
+There are additional configure options for
+\fBbsd\fR,
+\fBbsdudp\fR, and
+\fBbsdtcp\fR
+to allow for specifying explicit UDP and TCP port ranges\&.
+.sp
+.nf
+   \-\-with\-udpportrange
+   \-\-with\-tcpportrange
+   \-\-with\-low\-tcpportrange
+.fi
+.PP
+See
+\fBPORT USAGE\fR
+below for more information\&.
+.PP
+There are additional configure options for Kerberos if you so desire\&. All but the last option are for Kerberos 4\&. Defaults shown in square brackets\&.
+.sp
+.nf
+   \-\-with\-server\-principal=ARG    server host principal  [amanda]
+   \-\-with\-server\-instance=ARG     server host instance   []
+   \-\-with\-server\-keyfile=ARG      server host key file   [/\&.amanda]
+   \-\-with\-client\-principal=ARG    client host principal  [rcmd]
+   \-\-with\-client\-instance=ARG     client host instance   [HOSTNAME_INSTANCE]
+   \-\-with\-client\-keyfile=ARG      client host key file   [KEYFILE]
+   \-\-with\-ticket\-lifetime=ARG     ticket lifetime        [128]
+   \-\-with\-krb4\-security=DIR       where libkrb\&.a lives   [see below]
+   \-\-with\-krb5\-security=DIR       where libkrb\&.a lives   [see below]
+.fi
+.PP
+If configuring with \-\-with\-krb4\-security and/or \-\-with\-krb5\-security, the configure script will search under /usr/kerberos/lib, /usr/cygnus/lib, /usr/lib, and /opt/kerberos/lib for the kerberos bits, libkrb\&.a, in this order\&. Kerberos support will not be added if it does not find them\&. If the kerberos bits are found under some other hierarchy, you can specify this via \-\-with\-krb5\-security=DIR and/or \-\-with\-krb4\-security=DIR, where DIR is where the kerberos bits live\&. The configure script will then look in the \'lib\' directory under this hierarchy for libkrb\&.a\&.
+.PP
+The
+\fBauth\fR
+parameter selects a communication/authentication method to use between the client and the backup server\&. These methods are described each in their own section below\&.
+.SH "BSD, BSDUDP, AND BSDTCP COMMUNICATION AND AUTHENTICATION"
+.PP
+For more detail, see http://wiki\&.zmanda\&.com/index\&.php/Configuring_bsd/bsdudp/bsdtcp_authentication\&.
+.PP
+The
+\fBbsd\fR,
+\fBbsdudp\fR, and
+\fBbsdtcp\fR
+communication methods use either UDP, TCP, or both protocols operating as a network service to authenticate and exchange data between server and clients\&.
+.PP
+In addition to compilation and general configuration (see
+\fBCOMPILATION AND GENERAL INFORMATION\fR
+above), the authentication method that the client is configured to receive is specified by the
+\fBauth\fR
+parameter in the network service configuration for
+\fIAmanda\fR\&. The authentication method used by an Amanda client to reach the server during recovery is the authentication method specified by the
+\fIauth\fR
+parameter in the client\'s Amanda network service configuration or in its amanda\-client\&.conf file (see amanda\-client\&.conf(5))\&.
+.SS "\&.amandahosts file"
+.PP
+Servers and clients using the bsd, bsdudp, and bsdtcp authentication methods refer to the \&.amandahosts file to control access\&. Amanda should be compiled for this access control if one of these methods will be used and is the default compilation option for Amanda 2\&.6 (use \-\-with\-amandahosts when compiling pre\-2\&.6 versions of Amanda)\&.
+.PP
+Amanda looks for the \&.amandahosts file in the Amanda user\'s home directory, commonly /var/lib/amanda\&.
+.PP
+Each authorization is on its own line in the following format
+.PP
+\fIhostname\fR
+[
+\fIusername\fR
+[
+\fIservice\&.\&.\&.\fR
+] ]
+.PP
+If
+\fIusername\fR
+is ommitted, it defaults to the user running
+\fBamandad\fR, i\&.e\&. the user listed in the
+\fBinetd\fR
+or
+\fBxinetd\fR
+configuration file\&.
+.PP
+\fIservice\&.\&.\&.\fR
+is a space\-delimited list of services the client is authorized to execute:
+\fBnoop\fR,
+\fBselfcheck\fR,
+\fBsendsize\fR,
+\fBsendbackup\fR,
+\fBamdump\fR
+(a shortcut for the previous four services which are required on clients),
+\fBamindexd\fR, and
+\fBamidxtaped\fR\&. The last two services are required on a server for clients to connect to it using
+\fBamrecover\fR\&.
+.PP
+Example of the \&.amandahosts file on an Amanda client
+.sp
+.nf
+    \fBamandaserver\&.example\&.com   amandabackup   amdump\fR
+.fi
+.PP
+Example of the \&.amandahosts file on an Amanda server
+.sp
+.nf
+    \fBamandaclient1\&.example\&.com   root   amindexd amidxtaped\fR
+.fi
+.SS "bsd communication and authentication"
+.PP
+The authentication is done using \&.amandahosts file in the Amanda user\'s home directory\&. The protocol between Amanda server and client is UDP\&. The number of disk list entries (DLEs)\-\-number of Amanda clients\-\-is limited by the UDP packet size\&. This authentication protocol will use a different port for each data stream (see PORT USAGE below)
+.SS "bsdudp communication and authentication"
+.PP
+The authentication is done using \&.amandahosts files in the Amanda user\'s home directory\&. It uses UDP protocol between Amanda server and client for data and hence the number of DLEs is limited by the UDP packet size\&. It uses one TCP port to establish the connection and multiplexes all data streams using one port on the server (see PORT USAGE below)\&.
+.SS "bsdtcp communication and authentication"
+.PP
+The authentication is done using \&.amandahosts files in the backup user\'s (for example: amandabackup) home directory\&. It uses TCP protocol between Amanda server and client\&. On the client, two reserved ports are used\&. On the server, all data streams are multiplexed to one port (see PORT USAGE below)\&.
+.SS "USING INETD SERVER"
+.PP
+Template for Amanda client inetd service entry
+.sp
+.nf
+\fI   service_name\fR \fIsocket_type\fR \fIprotocol\fR \fIwait/nowait\fR \fIamanda_backup_user\fR \fIabsolute_path_to_amandad\fR amandad \fIserver_args\fR
+.fi
+.PP
+Client example of using
+\fBbsd\fR
+authorization for inetd server given Amanda user is "amandabackup":
+.sp
+.nf
+\fB   amanda dgram udp wait amandabackup /path/to/amandad amandad \-auth=bsd amdump\fR
+.fi
+.PP
+The same could be used for
+\fBbsdudp\fR
+if specifying \-auth=bsdudp instead of \-auth=bsd\&.
+.PP
+Client example of using
+\fBbsdtcp\fR
+authorization for inetd server given Amanda user is "amandabackup":
+.sp
+.nf
+\fB   amanda stream tcp nowait amanda /path/to/amandad amandad \-auth=bsdtcp amdump\fR
+.fi
+.PP
+\fBamindexd\fR
+and
+\fBamidxtaped\fR
+would typically be added at the end of the line as
+\fBamandad\fR
+server arguments for an Amanda server\&.
+.PP
+Server example of using
+\fBbsdtcp\fR
+authorization for inetd server given Amanda user is "amandabackup":
+.sp
+.nf
+\fB   amanda stream tcp nowait amanda /path/to/amandad amandad \-auth=bsdtcp amdump amindexd amidxtaped\fR
+.fi
+.PP
+For Amanda version 2\&.5\&.0 and earlier, remember that neither
+\fBbsdudp\fR
+nor
+\fBbsdtcp\fR
+are supported and the Amanda daemon
+\fBamandad\fR
+accepts no arguments\&. Because of the latter,
+\fBamrecover\fR
+as of Amanda version 2\&.5\&.1 is not compatible with 2\&.5\&.0 and earlier servers\&. Thus, servers that are 2\&.5\&.0 or earlier must, in addition to the
+\fIamanda\fR
+service, run
+\fIamindexd\fR
+and
+\fIamidxtaped\fR
+Amanda services as their own network services, amandaidx and amidxtape, respectively (see below)\&.
+.PP
+There are no compatibility issues if server and clients are all 2\&.5\&.0 or earlier\&. If your server is 2\&.5\&.1 or later, you can still have clients that are 2\&.5\&.0 and earlier although you must then use
+\fBbsd\fR
+communication/authentication with these clients and must also run
+\fIamindexd\fR
+and
+\fIamidxtaped\fR
+Amanda services on the server as their own network services, amandaidx and amidxtape, respectively (see below)\&. If you have a server that is 2\&.5\&.0 and earlier, clients of a later version on which you wish to run
+\fBamrecover\fR
+must use
+\fBamoldrecover\fR
+instead and, again, the server must be running the amandaidx and amidxtape network services\&.
+.PP
+Example of amindexd and amidxtaped Amanda daemon services configured as their own network services for a 2\&.5\&.0 or earlier server or a newer server having 2\&.5\&.0 or earlier clients
+.sp
+.nf
+\fB   amandaidx stream tcp nowait amanda /usr/local/libexec/amanda/current/amindexd   amindexd\fR
+\fB   amidxtape stream tcp nowait amanda /usr/local/libexec/amanda/current/amidxtaped amidxtaped\fR
+.fi
+.SS "USING XINETD SERVER"
+.PP
+Template for Amanda client xinetd service file
+.sp
+.nf
+service amanda
+{
+       only_from               = \fIAmanda server\fR
+       socket_type             = \fIsocket type\fR
+       protocol                = \fIprotocol\fR
+       wait                    = \fIyes/no\fR
+       user                    = \fIamanda backup user\fR
+       group                   = \fIamanda backup user group id\fR
+       groups                  = yes
+       server                  = \fIabsolute path to amandad\fR
+       server_args             = \fIamandad server arguments\fR
+       disable                 = no
+}
+.fi
+.PP
+The
+\fIonly_from\fR
+parameter can be used with xinetd but is usually in addition to the primary form of access control via the \&.amandahosts file\&.
+.PP
+Client example of using
+\fBbsd\fR
+authorization for xinetd server and for Amanda user "amandabackup":
+.sp
+.nf
+service amanda
+{
+       only_from       = amandaserver\&.example\&.com
+       socket_type     = dgram
+       protocol        = udp
+       wait            = yes
+       user            = amandabackup
+       group           = disk
+       groups          = yes
+       server          = /path/to/amandad
+       server_args     = \-auth=bsd amdump
+       disable         = no 
+}
+.fi
+.PP
+The same could be used for
+\fBbsdudp\fR
+if specifying \-auth=bsdudp instead of \-auth=bsd\&.
+.PP
+Client example of using
+\fBbsdtcp\fR
+authorization for xinetd server and for Amanda user "amandabackup":
+.sp
+.nf
+service amanda
+{
+       only_from       = amandaserver\&.example\&.com amandaclient\&.example\&.com
+       socket_type     = stream
+       protocol        = tcp
+       wait            = no
+       user            = amandabackup
+       group           = disk
+       groups          = yes
+       server          = /path/to/amandad
+       server_args     = \-auth=bsdtcp amdump
+       disable         = no 
+}
+.fi
+.PP
+\fBamindexd\fR
+and
+\fBamidxtaped\fR
+would typically be added as additional
+\fBamandad\fR
+\fIserver_args\fR
+for an Amanda server\&.
+.PP
+For Amanda version 2\&.5\&.0 and earlier, remember that neither
+\fBbsdudp\fR
+nor
+\fBbsdtcp\fR
+are supported and the Amanda daemon
+\fBamandad\fR
+accepts no arguments\&. Because of the latter,
+\fBamrecover\fR
+as of Amanda version 2\&.5\&.1 is not compatible with 2\&.5\&.0 and earlier servers\&. Thus, servers that are 2\&.5\&.0 or earlier must, in addition to the
+\fIamanda\fR
+service, run
+\fIamindexd\fR
+and
+\fIamidxtaped\fR
+Amanda services as their own network services, amandaidx and amidxtape, respectively (see below)\&.
+.PP
+There are no compatibility issues if server and clients are all 2\&.5\&.0 or earlier\&. If your server is 2\&.5\&.1 or later, you can still have clients that are 2\&.5\&.0 and earlier although you must then use
+\fBbsd\fR
+communication/authentication with these clients and must also run
+\fIamindexd\fR
+and
+\fIamidxtaped\fR
+Amanda services on the server as their own network services, amandaidx and amidxtape, respectively (see below)\&. If you have a server that is 2\&.5\&.0 and earlier, clients of a later version on which you wish to run
+\fBamrecover\fR
+must use
+\fBamoldrecover\fR
+instead and, again, the server must be running the amandaidx and amidxtape network services\&.
+.PP
+Example of amindexd and amidxtaped Amanda daemon services configured as their own network services for a 2\&.5\&.0 or earlier server or a newer server having 2\&.5\&.0 or earlier clients
+.sp
+.nf
+service amandaidx
+{
+       socket_type             = stream
+       protocol                = tcp
+       wait                    = no
+       user                    = amanda
+       group                   = disk
+       server                  = /usr/local/libexec/amanda/amindexd 
+       disable                 = no
+}
+
+service amidxtape
+{
+       socket_type             = stream
+       protocol                = tcp
+       wait                    = no
+       user                    = amanda
+       group                   = disk
+       server                  = /usr/local/libexec/amanda/amidxtaped
+       disable                 = no
+}
+.fi
+.SS "PORT USAGE"
+.PP
+List of TCP/UDP ports used by network service communication methods for Amanda server and client\&.
+.sp
+.nf
+   Key:
+       UP = Unreserved Port
+    RPpAP = Reserved Port per Amanda Process
+   UPpDLE = Unreserved Port per DLE
+     [\&.\&.] = Configure options that can be used at compile time to define port ranges
+
+Authentication Protocol        Amanda server                                   Amanda client
+bsd                    udp             1 RPpAP [\-\-with\-udpportrange]                10080
+                       tcp             1 UP [\-\-with\-tcpportrange]           3 UPpDLE [\-\-with\-tcpportrange]
+bsdudp         udp             1 RPpAP [\-\-with\-udpportrange]                10080
+                       tcp             1 UP [\-with\-tcpportrange]             1 UPpDLE [\-\-with\-tcpportrange]
+bsdtcp         tcp             1 RPpAP [\-\-with\-low\-tcpportrange]   10080
+.fi
+.PP
+Amanda server also uses two ports (dumper process) to communicate with the chunker/taper processes\&. These ports are in the range set by \-\-with\-tcpportrange\&.
+.PP
+You can override the default port ranges that Amanda was compiled with in each configuration using the
+\fIreserved\-udp\-port\fR,
+\fIreserved\-tcp\-port\fR, and
+\fIunreserved\-tcp\-port\fR
+parameters in amanda\&.conf and amanda\-client\&.conf configuration files (see
+\fBamanda.conf\fR(5)
+and
+\fBamanda-client.conf\fR(5))\&.
+.SH "KERBEROS COMMUNICATION AND AUTHENTICATION"
+
+For more detail, see http://wiki\&.zmanda\&.com/index\&.php/Kerberos_authentication\&.
+.PP
+Amanda supports Kerberos 4 and 5 communication methods between Amanda server and client\&. Please note, however, that support for Kerberos 4 will be removed in the next release\&.
+.PP
+General information including compilation are given above (see
+\fBCOMPILATION AND GENERAL INFORMATION\fR
+above)\&. Below sections give specific Kerberos 4 and 5 information\&.
+.SS "KERBEROS v4"
+
+Please note that support for Kerberos 4 will be removed in the next release\&.
+
+Kerberos 4 uses UDP protocol and the number of DLEs is limited by UDP packet size\&.
+
+The kerberized AMANDA service uses a different port on the client hosts\&. The /etc/services line is:
+
+    kamanda      10081/udp
+.PP
+And the /etc/inetd\&.conf line is:
+.sp
+.nf
+    kamanda dgram udp wait root /usr/local/libexec/amanda/amandad amandad \-auth=krb4
+.fi
+.PP
+Note that you\'re running this as root, rather than as your dump user\&. AMANDA will set its uid down to the dump user at times it doesn\'t need to read the srvtab file, and give up root permissions entirely before it goes off and runs dump\&. Alternately you can change your srvtab files to be readable by user amanda\&.
+.PP
+The following dumptype options apply to krb4:
+.sp
+.nf
+auth "krb4"    # use krb4 auth for this host
+               # (you can mingle krb hosts and bsd \&.rhosts in one conf)
+kencrypt       # encrypt this filesystem over the net using the krb4
+               # session key\&.  About 2x slower\&.  Good for those root
+               # partitions containing your keyfiles\&.  Don\'t want to
+               # give away the keys to an ethernet sniffer!
+               # This is currently always enabled\&.  There is no
+               # way to disable it\&.  This is a bug\&.
+.fi
+.SS "KERBEROS v5"
+.PP
+Kerberos 5 uses TCP and the server uses only one TCP port and data streams are multiplexed to this port\&.
+
+
+The \fBkrb5\fR driver script defaults to:
+
+/*
+ * The lifetime of our tickets in minutes\&.
+ */
+#define AMANDA_TKT_LIFETIME     (12*60)
+
+/*
+ * The name of the service in /etc/services\&.
+ */
+#define AMANDA_KRB5_SERVICE_NAME        "k5amanda"
+
+You can currently only override these by editing the source code\&.
+
+The kerberized AMANDA service uses a different port on the client hosts\&. The /etc/services line is:
+
+   k5amanda      10082/tcp
+.PP
+And the /etc/inetd\&.conf line is:
+.sp
+.nf
+   k5amanda stream tcp nowait root /usr/local/libexec/amanda/amandad amandad \-auth=krb5
+.fi
+.PP
+Note that you\'re running this as root, rather than as your dump user\&. AMANDA will set its UID down to the dump user at times it doesn\'t need to read the keytab file, and give up root permissions entirely before it goes off and runs dump\&. Alternately you can change your keytab files to be readable by user amanda\&. You should understand the security implications of this before changing the permissions on the keytab\&.
+.PP
+The following dumptype options apply to
+\fBkrb5\fR:
+.sp
+.nf
+   auth "krb5"    # use krb5 auth for this host
+                  # (you can mingle krb hosts and bsd \&.rhosts in one conf)
+.fi
+.PP
+The principal and keytab files that Amanda uses must be set in the amanda\&.conf file for kerberos 5 dumps to work\&. You can hardcode this in the source code if you really want to (common\-src/krb5\-security\&.c)
+.sp
+.nf
+   krb5keytab
+   krb5principal
+.fi
+.PP
+For example:
+.sp
+.nf
+   krb5keytab    "/etc/krb5\&.keytab\-amanda"
+   krb5principal  "amanda/saidin\&.omniscient\&.com"
+.fi
+.PP
+The principal in the second option must be contained in the first\&. The keytab should be readable by the amanda user (and definitely not world readable!) and is (obviously) on the server\&. In MIT\'s kadmin, the following:
+.sp
+.nf
+   addprinc \-randkey amanda/saidin\&.omniscient\&.com
+   ktadd \-k /etc/krb5\&.keytab\-amanda amanda/saidin\&.omniscient\&.com
+.fi
+.PP
+will do the trick\&. You will obviously want to change the principal name to reflect something appropriate for the conventions at your site\&.
+.PP
+You must also configure each client to allow the amanda principal in for dumps\&.
+.PP
+There are several ways to go about authorizing a server to connect to a client\&.
+.PP
+The normal way is via a \&.k5amandausers file or a \&.k5login file in the client user\'s home directory\&. The determination of which file to use is based on the way you ran configure on AMANDA\&. By default, AMANDA will use \&.k5amandahosts, but if you configured with \-\-without\-amandahosts, AMANDA will use \&.k5login\&. (similar to the default for \&.rhosts/\&.amandahosts\-style security)\&. The \&.k5login file syntax is a superset of the default
+\fBkrb5\fR
+\&.k5login\&. The routines to check it are implemented in amanda rather than using krb5_kuserok because the connections are actually gssapi based\&.
+.PP
+This \&.k5amandahosts/\&.k5login is a hybrid of the \&.amandahosts and a \&.k5login file\&. You can just list principal names, as in a \&.k5login file and the principal will be permitted in from any host\&. If you do NOT specify a realm, then there is no attempt to validate the realm (this is only really a concern if you have cross\-realm authentication set up with another realm or something else that allows you multiple realms in your kdc\&. If you do specify a realm, only that principal@realm will be permitted to connect\&.
+.PP
+You may prepend this with a hostname and whitespace, and only that principal (with optional realm as above) will be permitted to access from that hostname\&.
+.PP
+Here are examples of valid entries in the \&.k5amandahosts:
+.sp
+.nf
+   service/amanda
+   service/amanda@TEST\&.COM
+   dumpmaster\&.test\&.com service/amanda
+   dumpmaster\&.test\&.com service/amanda@TEST\&.COM
+.fi
+.PP
+Rather than using a \&.k5amandahosts or \&.k5login file, the easiest way is to use a principal named after the destination user, (such as amanda@TEST\&.COM in our example) and not have either a \&.k5amandahosts or \&.k5login file in the destination user\'s home directory\&.
+.PP
+There is no attempt to verify the realm in this case (only a concern if you have cross\-realm authentication setup)\&.
+.SH "LOCAL COMMUNICATION"
+.PP
+The Amanda server communicates with the client internally versus over the network, ie\&. the client is also the server\&.
+.PP
+This is the only method that requires no authentication as it is clearly not needed\&.
+.SH "RSH COMMUNICATION AND AUTHENTICATION"
+
+For more detail, see http://wiki\&.zmanda\&.com/index\&.php/Configuring_rsh_authentication\&.
+.PP
+The Amanda server communicates with its client as the Amanda user via the RSH protocol\&.
+.PP
+Please note that RSH protocol itself is insecure and should be used with caution especially on any servers and clients with public IPs\&.
+.PP
+Each Amanda client communicates with the server using one TCP port and all data streams from the client are multiplexed over one port\&. The number of Amanda clients is limited by the number of reserved ports available on the Amanda server\&. Some versions of RSH do not use reserved ports and, thus, this restriction is not valid\&.
+.PP
+General information including compilation is given above (see
+\fBCOMPILATION AND GENERAL INFORMATION\fR
+above)\&.
+.PP
+In addition to specifying the
+\fIauth\fR
+field in dumptype definition, it might be required to specify
+\fIclient_username\fR
+and
+\fBamandad\fR
+fields\&. If the backup user name is different on the Amanda client, the user name is specified as
+\fBclient_username\fR\&. If the location of the Amanda daemon
+\fBamandad\fR
+is different on the Amanda client, the location is specified as
+\fIamandad_path\fR
+field value\&.
+.sp
+.nf
+For example:
+define dumptype rsh_example {
+         \&.\&.\&.
+         auth "rsh"
+         client_username "amandabackup"
+         amandad_path "/usr/lib/exec/amandad"
+         \&.\&.\&.
+}
+.fi
+.SH "SSH COMMUNICATION AND AUTHENTICATION"
+
+For more detail, see http://wiki\&.zmanda\&.com/index\&.php/How_To:Set_up_transport_encryption_with_SSH\&.
+
+Amanda client sends data to the server using SSH\&. SSH keys have to be set up so that Amanda server can communicate with its clients using SSH\&.
+
+General information including compilation is given above (see \fBCOMPILATION AND GENERAL INFORMATION\fR above)\&.
+
+SSH provides transport encryption and authentication\&. To set up an SSH authentication session, Amanda will run the equivalent of the following to start the backup process\&.
+
+\fB   /path/to/ssh \-l \fR\fB\fIuser_name\fR\fR\fB client\&.zmanda\&.com $libexecdir/amandad\fR
+
+To use SSH, you need to set up SSH keys either by storing the passphrase in cleartext, using ssh\-agent, or using no passphrase at all\&.  All of these options have security implications which should be carefully considered before adoption\&.
+
+When you use a public key on the client to do data encryption (see http://wiki\&.zmanda\&.com/index\&.php/How_To:Set_up_data_encryption), you can lock away the private key in a secure place\&. Both, transport and storage will be encrypted with such a setup\&. See http://wiki\&.zmanda\&.com/index\&.php/Encryption for an overview of encryption options\&.
+
+Enable SSH authentication and set the ssh_keys option in all DLEs for that host by adding the following to the DLE itself or to the corresponding dumptype in amanda\&.conf:
+
+  auth "ssh"
+  ssh_keys "/home/amandabackup/\&.ssh/id_rsa_amdump"
+
+\fIssh_keys\fR is the path to the private key on the client\&. If the username to which Amanda should connect is different from the default, then you should also add
+
+  client_username "otherusername"
+
+If your server  \fBamandad\fR path and client  \fBamandad\fR path are different, you should also add
+
+  amandad_path "/client/amandad/path"
+.PP
+For a marginal increase in security, prepend the keys used for AMANDA in the clients\' authorized_keys file with the following:
+.sp
+.nf
+  from="amanda_server\&.your\&.domain\&.com",no\-port\-forwarding,no\-X11\-forwarding,no\-agent\-forwarding,command="/absolute/path/to/amandad \-auth=ssh amdump"
+.fi
+.PP
+This will limit that key to connect only from Amanda server and only be able to execute
+\fBamandad\fR(8)\&.
+.PP
+In the same way, prepend the key used for AMANDA in the server\'s authorized_keys file with:
+.sp
+.nf
+  from="amanda_client\&.your\&.domain\&.com",no\-port\-forwarding,no\-X11\-forwarding,no\-agent\-forwarding,command="/absolute/path/to/amandad \-auth=ssh amindexd amidxtaped"
+.fi
+.PP
+You can omit the from=\&.\&. option if you have too many clients to list, although this has obvious security implications\&.
+.PP
+Set ssh_keys and any other necessary options in /etc/amanda/amanda_client\&.conf:
+.sp
+.nf
+  auth "ssh"
+  ssh_keys "/root/\&.ssh/id_rsa_amrecover"
+  client_username "amanda"
+  amandad_path "/server/amandad/path"
+.fi
+.PP
+Besides user keys, SSH uses host keys to uniquely identify each host, to prevent one host from impersonating another\&. Unfortunately, the only easy way to set up these host keys is to make a connection and tell SSH that you trust the identity:
+.sp
+.nf
+  $ ssh client1\&.zmanda\&.com
+  The authenticity of host \'client1\&.zmanda\&.com (192\&.168\&.10\&.1)\' can\'t be established\&.
+  RSA key fingerprint is 26:4e:df:a2:be:c8:cb:20:1c:68:8b:cc:c0:3b:8e:9d\&.
+  Are you sure you want to continue connecting (yes/no)?yes
+.fi
+.PP
+As Amanda will not answer this question itself, you must manually make every connection (server to client and client to server) that you expect Amanda to make\&. Note that you must use the same username that Amanda will use (that is, ssh client and ssh client\&.domain\&.com are distinct)\&.
+.SH "SEE ALSO"
+.PP
+
+\fBamanda.conf\fR(5),
+\fBamanda-client.conf\fR(5),
+\fBdisklist\fR(5),
+\fBamdump\fR(8),
+\fBamrecover\fR(8)
+: http://wiki.zmanda.com
+.SH "Authors"
+.PP
+\fBJean\-Louis Martineau\fR <\&martineau@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
+.PP
+\fBDustin J\&. Mitchell\fR <\&dustin@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
+.PP
+\fBPaul Yeatman\fR <\&pyeatman@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
diff --git a/man/amanda-changers.7 b/man/amanda-changers.7
new file mode 100644 (file)
index 0000000..7eaafd6
--- /dev/null
@@ -0,0 +1,330 @@
+.\"     Title: amanda-changers
+.\"    Author: Dustin J. Mitchell <dustin@zmanda.com>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: Miscellanea
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
+.\"
+.TH "AMANDA\-CHANGERS" "7" "01/22/2009" "Amanda 2\&.6\&.1" "Miscellanea"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amanda-changers \- Configuring and Using Amanda Changers
+.SH "DESCRIPTION"
+.PP
+Amanda uses changers to arbitrate access to devices (\fBamanda-devices\fR(7)) and data volumes\&. Changers provide an abstraction of tape robots, but are used to manage non\-tape media, too\&. Amanda communicates with changers through the Changer API\&. This manpage contains a
+\fIuser\-level\fR
+overview of the API, and does not address details that are only of concern to developers\&. For that purpose, consult the Amanda source code and http://wiki\&.zmanda\&.com\&.
+.SH "TRANSITION"
+.PP
+The Amanda Changer API is in transition from version 1\&.0 \- driven by shell scripts invoked for each changer operation \- to version 2\&.0, composed of perl objects that can manage parallel access to multiple devices and other complexity\&. When this transition is complete, Amanda devices will, in general, be specified via a changer, which will provide the necessary device specifier to access a requested volume\&. In the interim, support for the "new" changer syntax is limited to the experimental
+\fBamvault\fR(8)\&.
+.SH "SPECIFYING CHANGERS"
+.PP
+Changer specifications are strings like
+\FCchg\-disk:/my/vtapes\F[]\&. The
+\FCchg\-\F[]
+prefix serves to differentiate changers from devices (see
+\fBamanda-devices\fR(7))\&. The next portion (\FCdisk\F[], in this case) identifies the particular changer driver to use, and everything that follows the
+\FC:\F[]
+is interpreted by the driver\&.
+.PP
+A name which does not match this pattern, but which matches an old changer script (e\&.g\&.,
+\FCchg\-zd\-mtx\F[]), invokes the backward\-compatibility changer driver as
+\FCchg\-compat:chg\-zd\-mtx\F[]\&. If the name does not match an old changer, then it is treated as an Amanda device, and is wrapped by the single\-device changer, e\&.g\&.,
+\FCchg\-single:tape:/dev/rmt/0\F[]\&.
+.PP
+Changers which require additional parameters can also be described in
+\fBamanda.conf\fR(5)
+with "changer" sections, for example,
+.sp
+.nf
+define changer hp\-robot {
+    tapedev "chg\-robot:/dev/sg1"
+    property "drives" "0=/dev/nst0;1=/dev/nst0"
+    property "slots" "1\-10"
+}
+.fi
+(note that "chg\-robot" is not yet implemented, so this is hypothetical)\&. A changer defininition creates a changer "alias", in this case named
+\fIhp\-robot\fR, which can then be named where an application expects a changer \- for example, the target of the
+\fBamvault\fR
+command\&.
+.SH "CHANGER DRIVERS"
+.PP
+This section lists the changer drivers included with Amanda, and basic instructions for using them\&. For complete How\-To information, consult the Amanda wiki at http://wiki\&.zmanda\&.com\&.
+.SS "chg\-disk (new)"
+.nf
+tpchanger "chg\-disk:/u01/vtapes"
+.fi
+.PP
+This changer driver replaces the old
+\fBchg\-disk\fR, supporting parallel access to vtapes stored in directories named
+\FCslotN\F[]
+in the directory specified after
+\FCchg\-disk:\F[]\&. It does so by creating numbered "drives" so that simultaneous processes can access distinct slots\&.
+.SS "chg\-disk (old)"
+.nf
+tapedev "file:/u01/vtapes"
+tpchanger "chg\-disk"
+.fi
+.PP
+This changer script supports sequential access to vtapes stored in directories named
+\FCslotN\F[]
+in the directory specified by the
+\fItapedev\fR
+parameter\&.
+.SS "chg\-multi"
+.nf
+tpchanger "chg\-multi"
+changerfile "chg\-multi\-state"
+.fi
+.PP
+This script simply round\-robins a number of distinct device names, as specified in its configuration file\&. It is useful when all volumes for a configuration have different device names \-\- for example, with S3 devices\&. The
+\fIchangerfile\fR
+need not exist; it is used as a prefix for filenames of state files\&.
+.SS "chg\-manual"
+.nf
+tpchanger "chg\-manual"
+changerfile "chg\-manual\&.conf"
+.fi
+.PP
+This script simply provides distinct device names in a round\-robin fashion, as specified in its configuration file\&. It is useful when all volumes for a configuration have different device names \-\- for example, with S3 devices\&. The configuration file parameters are (as listed in the script):
+.sp
+.nf
+resend_mail=900       # resend mail every __ seconds
+timeout_mail=604800   # time out after this many seconds (default 7 days)
+request="[type]"      # How to request a new tape (default "tty_email")
+  request="tty"       # Use the tty to ask the user to change tape\&.
+                      # Can\'t be use by cron
+  request="email"     # Send an email to ask the user to change tape\&.
+  request="tty_email" # Use the tty if it exist or send an email\&.
+.fi
+.SS "chg\-zd\-mtx"
+.nf
+tpchanger "chg\-zd\-mtx"
+changerdev "/dev/sg0"         # used with \'mtx \-f\'
+changerfile "chg\-zd\-mtx\&.conf"
+tapedev "tape:/dev/nst0"
+.fi
+.PP
+This script interfaces with a tape drive using the Zubkoff/Dandelion version of mtx\&. That\'s the version that takes a device specifier with the
+\fB\-f\fR
+option and has subcommands like
+\fBstatus\fR\&. The configuration file parameters are (as listed in the script itself):
+.sp
+.nf
+firstslot=?                 #### First storage slot (element)
+lastslot=?                  #### Last storage slot (element)
+cleanslot=\-1                #### Slot with cleaner tape \-\- default is "\-1"
+                            #### Set negative to indicate no cleaner available
+driveslot=0                 #### Drive slot number\&.  Defaults to 0
+                            #### Use the \'Data Transfer Element\' you want
+autoclean=0                 #### Set to \'1\' or greater to enable
+autocleancount=99           #### Number of access before a clean\&.
+havereader=0                #### If you have a barcode reader, set to 1\&.
+offline_before_unload=0     #### Does your robot require an
+                            #### \'mt offline\' before mtx unload?
+poll_drive_ready=NN         #### Time (seconds) between tests to see if
+                            #### the tape drive has gone ready (default: 3)\&.
+max_drive_wait=NN           #### Maximum time (seconds) to wait for the
+                            #### tape drive to become ready (default: 120)\&.
+initial_poll_delay=NN       #### initial delay after load before polling for
+                            #### readiness
+slotinfofile=FILENAME       #### record slot information to this file, in
+                            #### the line\-based format "SLOT LABEL\en"
+.fi
+.SS "chg\-rait"
+.nf
+tpchanger "chg\-rait"
+changerfile "chg\-rait\&.conf"
+.fi
+.PP
+This changer script constructs RAIT devices out of the devices provided by several "sub\-changers"\&. The configuration file specifies
+\FCnchangers\F[], the number of subchangers, and then provides
+\FCtpchanger\F[],
+\FCchangerdev_N\F[],
+\FCchangerfile_N\F[], and
+\FCtpchanger_N\F[]
+for each sub\-changer, 1 through N\&.
+.SS "chg\-null"
+.nf
+tpchanger "chg\-null"
+.fi
+.PP
+This changer always provides the device "null:"\&. It is sometimes useful in conjunction with
+\fBchg\-rait\fR\&.
+.SS "Unmaintained Changers"
+.PP
+Amanda has many other changer scripts and programs beyond those described here (see the
+\FCchanger\-src/\F[]
+in the source directory), but most of these scripts are unmaintained and undocumented, and will be removed when the new changer API is fully implemented\&.
+.SH "SEE ALSO"
+.PP
+
+\fBamanda\fR(8),
+\fBamanda.conf\fR(5),
+\fBamanda-devices\fR(7),
+.SH "Author"
+.PP
+\fBDustin J\&. Mitchell\fR <\&dustin@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
index fb15d229cd3c44fd8d39a08ec9003cef01536ba8..86b7a512890abda5703baabc2aec698a297d2c7a 100644 (file)
 .\"     Title: amanda-client.conf
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
+.\"    Author: James da Silva <jds@amanda.org>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: File formats and conventions
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
 .\"
-.TH "AMANDA\-CLIENT\.CONF" "5" "08/22/2008" "" ""
+.TH "AMANDA\-CLIENT\&.CON" "5" "01/22/2009" "Amanda 2\&.6\&.1" "File formats and conventions"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
 .ad l
-.SH "NAME"
-amanda-client.conf - Client configuration file for Amanda, the Advanced Maryland Automatic Network Disk Archiver
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amanda-client.conf \- Client configuration file for \fIAmanda\fR, the Advanced Maryland Automatic Network Disk Archiver
 .SH "DESCRIPTION"
 .PP
-\fIamanda\-client\.conf\fR
+\fBamanda-client.conf\fR(5)
 is the client configuration file for
-\fIAmanda\fR\. This manpage lists the relevant sections and parameters of this file for quick reference\.
+\fIAmanda\fR\&. This manpage lists the relevant sections and parameters of this file for quick reference\&.
 .PP
 The files
-\fB<CONFIG_DIR>/amanda\-client\.conf\fR
-and
-\fB<CONFIG_DIR>/<config>/amanda\-client\.conf\fR
-are loaded\.
-.SH "PARAMETERS"
-.PP
-There are a number of configuration parameters that control the behavior of the
-\fIAmanda\fR
-programs\. All have default values, so you need not specify the parameter in
-\fBamanda\-client\.conf\fR
-if the default is suitable\.
-.PP
-Lines starting with # are ignored, as are blank lines\. Comments may be placed on a line with a directive by starting the comment with a #\. The remainder of the line is ignored\.
-.PP
-Keywords are case insensitive, i\.e\.
-\fBauth\fR
+\fB<CONFIG_DIR>/amanda\-client\&.conf\fR
 and
-\fBAuth\fR
-are treated the same\.
-.PP
-Integer arguments may have one of the following (case insensitive) suffixes, some of which have a multiplier effect:
-.SS "POSSIBLE SUFFIXES"
-.PP
-\fBb byte bytes\fR
-.RS 4
-Some number of bytes\.
-.RE
-.PP
-\fBbps\fR
-.RS 4
-Some number of bytes per second\.
-.RE
-.PP
-\fBk kb kbyte kbytes kilobyte kilobytes\fR
-.RS 4
-Some number of kilobytes (bytes*1024)\.
-.RE
-.PP
-\fBkps kbps\fR
-.RS 4
-Some number of kilobytes per second (bytes*1024)\.
-.RE
-.PP
-\fBm mb meg mbyte mbytes megabyte megabytes\fR
-.RS 4
-Some number of megabytes (bytes*1024*1024)\.
-.RE
-.PP
-\fBmps mbps\fR
-.RS 4
-Some number of megabytes per second (bytes*1024*1024)\.
-.RE
-.PP
-\fBg gb gbyte gbytes gigabyte gigabytes\fR
-.RS 4
-Some number of gigabytes (bytes*1024*1024*1024)\.
-.RE
-.PP
-\fBtape tapes\fR
-.RS 4
-Some number of tapes\.
-.RE
+\fB<CONFIG_DIR>/<config>/amanda\-client\&.conf\fR
+are loaded\&.
+.SH "SYNTAX"
+
+
+The syntax of \fBamanda-client.conf\fR(5) is identical to that for
+\fBamanda.conf\fR(5)\&.
+.SH "GLOBAL PARAMETERS"
 .PP
-\fBday days\fR
+\fBconf\fR \fI string\fR
 .RS 4
-Some number of days\.
+Default:
+\fISet by configure\fR\&. The conf use by amrecover\&.
 .RE
 .PP
-\fBweek weeks\fR
-.RS 4
-Some number of weeks (days*7)\.
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-Note
-The value
-\fBinf\fR
-may be used in most places where an integer is expected to mean an infinite amount\.
-.sp
-Boolean arguments may have any of the values
-\fBy\fR,
-\fByes\fR,
-\fBt\fR,
-\fBtrue\fR
-or
-\fBon\fR
-to indicate a true state, or
-\fBn\fR,
-\fBno\fR,
-\fBf\fR,
-\fBfalse\fR
-or
-\fBoff\fR
-to indicate a false state\. If no argument is given,
-\fBtrue\fR
-is assumed\.
-.RE
-.SS "PARAMETERS"
-.PP
-\fBconf\fR \fI string\fR
+\fBclient_username\fR \fI string\fR
 .RS 4
 Default:
-\fISet by configure\fR\. The conf use by amrecover\.
+\fICLIENT_LOGIN\fR\&. Similar to the parameter of the same name in
+\fBamanda.conf\fR(5), this specifies the username that
+\fBamrecover\fR
+should send when connecting to the server\&. It should match the username specified in
+\FC\&.amandahosts\F[]
+on the server\&.
 .RE
 .PP
 \fBindex_server\fR \fI string\fR
 .RS 4
 Default:
-\fISet by configure\fR\. The amindexd server amrecover will connect to\.
+\fISet by configure\fR\&. The amindexd server amrecover will connect to\&.
 .RE
 .PP
 \fBtape_server\fR \fI string\fR
 .RS 4
 Default:
-\fISet by configure\fR\. The amidxtaped server amrecover will connect to\.
+\fISet by configure\fR\&. The amidxtaped server amrecover will connect to\&.
 .RE
 .PP
 \fBtapedev\fR \fI string\fR
 .RS 4
 Default:
-\fISet by configure\fR\. The tapedev amrecover will use\.
+\fISet by configure\fR\&. The tapedev amrecover will use\&.
 .RE
 .PP
 \fBauth\fR \fI string\fR
 .RS 4
 Default:
-\fIbsd\fR\. Type of authorization to perform between tape server and backup client hosts\.
+\fIbsd\fR\&. Type of authorization to perform between tape server and backup client hosts\&.
 .sp
-\fBbsd\fR, bsd authorization with udp initial connection and one tcp connection by data stream\.
+\fBbsd\fR, bsd authorization with udp initial connection and one tcp connection by data stream\&.
 .sp
-\fBbsdtcp\fR, bsd authorization but use only one tcp connection\.
+\fBbsdtcp\fR, bsd authorization but use only one tcp connection\&.
 .sp
-\fBbsdudp\fR, like bsd, but will use only one tcp connection for all data stream\.
+\fBbsdudp\fR, like bsd, but will use only one tcp connection for all data stream\&.
 .sp
 \fBkrb4\fR
-to use Kerberos\-IV authorization\.
+to use Kerberos\-IV authorization\&.
 .sp
 \fBkrb5\fR
-to use Kerberos\-V authorization\.
+to use Kerberos\-V authorization\&.
 .sp
-\fBlocal\fR, if the client is the server, it doesn\'t require authencation setup\.
+\fBlocal\fR, if the client is the server, it doesn\'t require authencation setup\&.
 .sp
 \fBrsh\fR
-to use rsh authorization\.
+to use rsh authorization\&.
 .sp
 \fBssh\fR
-to use OpenSSH authorization\.
+to use OpenSSH authorization\&.
 .RE
 .PP
 \fBssh_keys\fR \fI string\fR
 .RS 4
 Default:
-\fINo default\fR\. The key file the ssh auth will use, it must be the private key\. If this parameter is not specified, then the deafult ssh key will be used\.
+\fINo default\fR\&. The key file the ssh auth will use, it must be the private key\&. If this parameter is not specified, then the deafult ssh key will be used\&.
 .RE
 .PP
 \fBgnutar_list_dir\fR \fI string\fR
 .RS 4
 Default from configure
-\fI\-\-with\-gnutar\-listdir=DIR\fR\. The directory where gnutar keep its state file\.
+\fI\-\-with\-gnutar\-listdir=DIR\fR\&. The directory where gnutar keep its state file\&.
+.RE
+.PP
+\fBmailer\fR \fI string\fR
+.RS 4
+Default found by configure\&. A mail program that can send mail with \'\fIMAILER \-s "subject" user < message_file\fR\'\&.
 .RE
 .PP
 \fBamandates\fR \fI string\fR
 .RS 4
 Default:
-\fI/etc/amandates\fR\. The file where amanda keep the last date of each dumplevel\.
+\fI/etc/amandates\fR\&. The file where amanda keep the last date of each dumplevel\&.
 .RE
 .PP
 \fBconnect_tries\fR int
 .RS 4
 Default:
-\fI3\fR\. How many times the server will try a connection\.
+\fI3\fR\&. How many times the server will try a connection\&.
 .RE
 .PP
 \fBrep_tries\fR int
 .RS 4
 Default:
-\fI5\fR\. How many times amandad will resend a REP packet if it doesn\'t get the ACK packet\.
+\fI5\fR\&. How many times amandad will resend a REP packet if it doesn\'t get the ACK packet\&.
 .RE
 .PP
 \fBdebug_amandad\fR int
 .RS 4
 Default:
-\fI0\fR\. Debug level of the amandad process
+\fI0\fR\&. Debug level of the amandad process
 .RE
 .PP
 \fBdebug_amidxtaped\fR int
 .RS 4
 Default:
-\fI0\fR\. Debug level of the amidxtaped process
+\fI0\fR\&. Debug level of the amidxtaped process
 .RE
 .PP
 \fBdebug_amindexd\fR int
 .RS 4
 Default:
-\fI0\fR\. Debug level of the amindexd process
+\fI0\fR\&. Debug level of the amindexd process
 .RE
 .PP
 \fBdebug_amrecover\fR int
 .RS 4
 Default:
-\fI0\fR\. Debug level of the amrecover process
+\fI0\fR\&. Debug level of the amrecover process
 .RE
 .PP
 \fBdebug_auth\fR int
 .RS 4
 Default:
-\fI0\fR\. Debug level of the auth module
+\fI0\fR\&. Debug level of the auth module
 .RE
 .PP
 \fBdebug_event\fR int
 .RS 4
 Default:
-\fI0\fR\. Debug level of the event module
+\fI0\fR\&. Debug level of the event module
 .RE
 .PP
 \fBdebug_holding\fR int
 .RS 4
 Default:
-\fI0\fR\. Debug level of the holdingdisk module
+\fI0\fR\&. Debug level of the holdingdisk module
 .RE
 .PP
 \fBdebug_protocol\fR int
 .RS 4
 Default:
-\fI0\fR\. Debug level of the protocol module
+\fI0\fR\&. Debug level of the protocol module
 .RE
 .PP
 \fBdebug_selfcheck\fR int
 .RS 4
 Default:
-\fI0\fR\. Debug level of the selfcheck process
+\fI0\fR\&. Debug level of the selfcheck process
 .RE
 .PP
 \fBdebug_sendsize\fR int
 .RS 4
 Default:
-\fI0\fR\. Debug level of the sendsize process
+\fI0\fR\&. Debug level of the sendsize process
 .RE
 .PP
 \fBdebug_sendbackup\fR int
 .RS 4
 Default:
-\fI0\fR\. Debug level of the sendbackup process
+\fI0\fR\&. Debug level of the sendbackup process
 .RE
 .PP
 \fBreserved\-udp\-port\fR int,int
 .RS 4
 Default: \-\-with\-udpportrange or
-\fI512,1023\fR\. Reserved udp port that will be used (amrecover with bsd or bsdudp)
+\fI512,1023\fR\&. Reserved udp port that will be used (amrecover with bsd or bsdudp)
 .RE
 .PP
 \fBreserved\-tcp\-port\fR int,int
 .RS 4
 Default: \-\-with\-low\-tcpportrange or
-\fI512,1023\fR\. Reserved tcp port that will be used (amrecover with bsdtcp)
+\fI512,1023\fR\&. Reserved tcp port that will be used (amrecover with bsdtcp)
 .RE
 .PP
 \fBunreserved\-tcp\-port\fR int,int
 .RS 4
 Default: \-\-with\-tcpportrange or
-\fI1025,65536\fR\. Unreserved tcp port that will be used (bsd, bsdudp)
+\fI1025,65536\fR\&. Unreserved tcp port that will be used (bsd, bsdudp)
+.RE
+.PP
+\fBproperty\fR "name" "value"
+.RS 4
+Adds a global property for this client host, useful for e\&.g\&., Application API plugins\&.
+.RE
+.SH "APPLICATION SECTION"
+.PP
+The
+\fBamanda\&.conf\fR
+file may define multiple types of application\&. The information is entered in a
+\fBapplication\-tool\fR
+section, which looks like this:
+.nf
+define application\-tool "\fIname\fR" {
+    \fIapplication\-option\fR \fIappli
+cation\-value\fR
+    \FC\&.\&.\&.\F[]
+}
+.fi
+.PP
+\fIname\fR
+is the name of this type of application\&. It is referenced from the
+\fIdumptype\fR
+.PP
+The application\-tool options and values are:
+.PP
+\fBcomment\fR \fIstring\fR
+.RS 4
+Default:
+\fInone\fR\&. A comment string describing this application\&.
+.RE
+.PP
+\fBplugin\fR \fIstring\fR
+.RS 4
+No default\&. Must be set to the name of the program\&. This program must be in the
+\fI$libexecdir/amanda/application\fR
+directory on the client\&.
+.RE
+.PP
+\fBproperty\fR [append] [priority] \fIstring\fR \fIstring\fR+
+.RS 4
+No default\&. You can set property for the application, each application have a different set of property\&. Both strings are quoted; the first string contains the name of the property to set, and the others contains its values\&.
+\fBappend\fR
+keyword append the values to the list of values for that property\&.
+\fBpriority\fR
+keyword disallow the setting of that property on the server\&.
 .RE
-.SH "AUTHOR"
+.SH "SCRIPT SECTION"
 .PP
-James da Silva,
-<jds@amanda\.org>: Original text
+The
+\fBamanda\&.conf\fR
+file may define multiple types of script\&. The information is entered in a
+\fBscript\-tool\fR
+section, which looks like this:
+.nf
+define script\-tool "\fIname\fR" {
+    \fIscript\-option\fR \fIscript\-value\fR
+    \FC\&.\&.\&.\F[]
+}
+.fi
 .PP
-Stefan G\. Weichinger,
-<sgw@amanda\.org>, maintainer of the
-\fIAmanda\fR\-documentation: XML\-conversion, major update, splitting
+\fIname\fR
+is the name of this type of script\&. It is referenced from the
+\fIdumptype\fR
+.PP
+The script\-tool options and values are:
+.PP
+\fBcomment\fR \fIstring\fR
+.RS 4
+Default:
+\fInone\fR\&. A comment string describing this script\&.
+.RE
+.PP
+\fBplugin\fR \fIstring\fR
+.RS 4
+No default\&. Must be set to the name of the program\&. This program must be in the
+\fI$libdir/amanda/application\fR
+directory on the client and/or server\&.
+.RE
+.PP
+\fBexecute_where\fR [client|server]
+.RS 4
+Default:
+\fIclient\fR\&. Where the script must be executed, on the client or server\&. Only
+\fIclient\fR
+is valid\&.
+.RE
+.PP
+\fBexecute_on\fR \fIexecute_on\fR[,\fIexecute_on\fR]*
+.RS 4
+No default\&. When the script must be executed, you can specify many of them:
+.PP
+\fBpre\-dle\-amcheck\fR
+.RS 4
+Execute before the amcheck command for the dle\&.
+.RE
+.PP
+\fBpre\-host\-amcheck\fR
+.RS 4
+Execute before the amcheck command for all dle for the client\&.
+.RE
+.PP
+\fBpost\-dle\-amcheck\fR
+.RS 4
+Execute after the amcheck command for the dle\&.
+.RE
+.PP
+\fBpost\-host\-amcheck\fR
+.RS 4
+Execute after the amcheck command for all dle for the client\&.
+.RE
+.PP
+\fBpre\-dle\-estimate\fR
+.RS 4
+Execute before the estimate command for the dle\&.
+.RE
+.PP
+\fBpre\-host\-estimate\fR
+.RS 4
+Execute before the estimate command for all dle for the client\&.
+.RE
+.PP
+\fBpost\-dle\-estimate\fR
+.RS 4
+Execute after the estimate command for the dle\&.
+.RE
+.PP
+\fBpost\-host\-estimate\fR
+.RS 4
+Execute after the estimate command for all dle for the client\&.
+.RE
+.PP
+\fBpre\-dle\-backup\fR
+.RS 4
+Execute before the backup command for the dle\&.
+.RE
+.PP
+\fBpre\-host\-backup\fR
+.RS 4
+Execute before the backup command for all dle for the client\&.
+.RE
+.PP
+\fBpost\-dle\-backup\fR
+.RS 4
+Execute after the backup command for the dle\&.
+.RE
+.PP
+\fBpost\-host\-backup\fR
+.RS 4
+Execute after the backup command for all dle for the client\&.
+.RE
+.PP
+\fBpre\-recover\fR
+.RS 4
+Execute before any level is recovered\&.
+.RE
+.PP
+\fBpost\-recover\fR
+.RS 4
+Execute after all levels are recovered\&.
+.RE
+.PP
+\fBpre\-level\-recover\fR
+.RS 4
+Execute before each level recovery\&.
+.RE
+.PP
+\fBpost\-level\-recover\fR
+.RS 4
+Execute after each level recovery\&.
+.RE
+.PP
+\fBinter\-level\-recover\fR
+.RS 4
+Execute between two levels of recovery\&.
+.RE
+.RE
+.PP
+\fBproperty\fR [append] [priority] \fIstring\fR \fIstring\fR+
+.RS 4
+No default\&. You can set property for the script, each script have a different set of property\&. Both strings are quoted; the first string contains the name of the property to set, and the others contains its values\&.
+\fBappend\fR
+keyword append the values to the list of values for that property\&.
+\fBpriority\fR
+keyword disallow the setting of that property on the server\&.
+.RE
 .SH "SEE ALSO"
 .PP
 
@@ -299,3 +559,8 @@ Stefan G\. Weichinger,
 \fBamcrypt\fR(8),
 \fBaespipe\fR(1),
 : http://wiki.zmanda.com
+.SH "Authors"
+.PP
+\fBJames da Silva\fR <\&jds@amanda\&.org\&>
+.PP
+\fBStefan G\&. Weichinger\fR <\&sgw@amanda\&.org\&>
diff --git a/man/amanda-devices.7 b/man/amanda-devices.7
new file mode 100644 (file)
index 0000000..d566d88
--- /dev/null
@@ -0,0 +1,570 @@
+.\"     Title: amanda-devices
+.\"    Author: Ian Turner <ian@zmanda.com>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: Miscellanea
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
+.\"
+.TH "AMANDA\-DEVICES" "7" "01/22/2009" "Amanda 2\&.6\&.1" "Miscellanea"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amanda-devices \- Configuring and Using Amanda Devices
+.SH "DESCRIPTION"
+.PP
+The Device API specifies a generic interface between Amanda and storage devices such as tapes or disks\&. This manual page describes the device drivers included with Amanda\&.
+.PP
+This is a
+\fIuser\-level\fR
+description of the API, and does not address details that are only of concern to developers\&. For that purpose, consult the Amanda source code and http://wiki\&.zmanda\&.com\&.
+.PP
+The term "device driver" describes the software that can communicate with some kind of backend storage, e\&.g\&., a tape driver\&. A "device" is the storage element itself, usually a piece of hardware\&. When discussing a device and its driver as a unit, the term "device" is sometimes also used to refer to the combination of device and driver\&.
+.SH "SPECIFYING DEVICES"
+.PP
+Device names take the form
+\fITYPE:NODE\fR, where
+\fITYPE\fR
+selects a device driver, and
+\fINODE\fR
+provides further information to that driver\&. The syntax for each device driver is given in the corresponding section below\&.
+.PP
+Devices are described in
+\fBamanda.conf\fR(5)
+with "device" sections, e\&.g\&.,
+.sp
+.nf
+define device top_drive {
+    tapedev "tape:/dev/nst0"
+    device_property "BLOCK_SIZE" "131072"
+}
+.fi
+A device defininition creates a device "alias", in this case named
+\fItop_drive\fR, which can then be named in the global
+\fItapedev\fR
+parameter:
+.sp
+.nf
+tapedev "top_drive"
+.fi
+.PP
+The global
+\fItapedev\fR
+parameter can also specify a literal device name\&. For example,
+.sp
+.nf
+tapedev "file:/amdisks"
+.fi
+is equivalent to
+.sp
+.nf
+tapedev "default"
+define device default {
+    tapedev "file:/amdisks"
+}
+.fi
+Device properties specified outside of any device definition apply to all devices\&. This syntax is provided mainly for backward compatibility, and for simple Amanda configurations\&. Note that there is no way to provide properties specific to a device without defining a device alias\&.
+.PP
+See
+\fBamanda.conf\fR(5)
+for more information on Amanda configuration\&.
+.SH "DEVICES"
+.PP
+This section lists the device drivers included with Amanda, and basic instructions for using them\&. For complete How\-To information, consult the Amanda wiki at http://wiki\&.zmanda\&.com\&.
+.SS "Null Device"
+.nf
+tapedev "null:"
+.fi
+.PP
+The null device driver only supports writing, and discards all data\&. It is generally only useful for testing purposes\&.
+.SS "RAIT Device"
+.nf
+tapedev "rait:tape:/dev/rmt/tps0d{4,5,6}n"
+.fi
+.PP
+The RAIT device driver mirrors or stripes data over multiple "child" devices\&. The child devices are specified using a shell\-like syntax, where alternatives are enclosed in braces and separated by commas\&.
+.PP
+With two child devices, the RAIT device driver mirrors data such that the two devices contain identical data and can be used singly for recovery\&. With more than two devices, the RAIT device "stripes" data across all but one device and writes a parity block to the final device, usable for data recovery in the event of a device or volume failure\&. The RAIT device scales its blocksize as necessary to match the number of children that will be used to store data\&.
+.PP
+When a child device is known to have failed, the RAIT device should be reconfigured to replace that device with the text "ERROR", e\&.g\&.,
+.sp
+.nf
+tapedev "rait:{tape:/dev/st0,ERROR,tape:/dev/st2}"
+.fi
+This will cause the RAIT device to start up in degraded mode, reconstructing the data from the missing device\&.
+.PP
+Like ordinary RAID drivers, the RAIT device driver can automatically enter degraded mode when one of its child devices fails\&. However, the RAIT device cannot automatically recover from any write error nor write any data in degraded mode\&. When reading, certain errors may be fatal (rather than causing degraded mode)\&. And in any case, labels on all volumes must initially match (labeled or otherwise)\&. If you have lost one volume from a set, explicitly start the device in degraded mode as described above\&.
+.SS "Child Device Block Sizes"
+.PP
+The RAIT device driver requires that all of its child devices use the same block size\&. If no block sizes are specified, the driver selects the block size closest to 32k that is within the MIN_BLOCK_SIZE \- MAX_BLOCK_SIZE range of all child devices, and calculates its own blocksize according to the formula
+\fIrait_blocksize = child_blocksize * (num_children \- 1)\fR\&. If a block size is specified for the RAIT device, then it calculates its child block sizes according to the formula
+\fIchild_blocksize = rait_blocksize / (num_children \- 1)\fR\&. Either way, it sets the BLOCK_SIZE property of each child device accordingly\&.
+.SS "S3 Device"
+.nf
+tapedev "s3:foocorp\-backups/DailySet1\-"
+device_property "S3_ACCESS_KEY" "MYACCESSKEY"
+device_property "S3_SECRET_KEY" "MYSECRETKEY"
+.fi
+.PP
+The S3 device driver uploads data to the Amazon S3 "storage cloud"\&. Its device name is a slash\-sparated combination of bucket name and prefix: "s3:BUCKET/PREFIX"\&. Since buckets must be unique across all Amazon S3 users, and since the number of buckets allowed to each user is limited, the driver can store multiple Amanda volumes in a single S3 bucket, distinguished by prefix\&. The prefix and slash can be omitted if they are not needed: "s3:BUCKET"\&.
+.PP
+The access and secret keys used to authenticate to Amazon S3 are provided as properties\&.
+.PP
+The S3 device driver stores each block in a distinct S3 object\&. Due to high HTTP overhead for each request, use of larger than normal block sizes (> 1 megabyte) is reccomended with the S3 device\&.
+.PP
+You can control where your data is physically stored by Amazon S3 using a location constraint\&. Setting this affects can affect both billing and legal concerns, so you are encouraged to consult Amazon\'s documentation for details\&.
+.PP
+To control location constraints, set the S3_BUCKET_LOCATION property\&. Currently, there are two valid settings: "" (any location) and "EU" (Europe)\&. If the S3_BUCKET_LOCATION is set, Amanda will check to make sure that the setting agrees with the constraint currently on the bucket\&.
+.SS "Tape Device"
+.nf
+tapedev "tape:/dev/nst0"
+.fi
+.PP
+The tape device driver interacts with a tape drive\&. The device uses the operating system\'s built\-in tape support, which is generally similar to that available via the command\-line utilities dd(1) and mt(1)\&.
+.PP
+The tape device name should specify a path to the operating system\'s device file\&.
+.SS "VFS Device"
+.nf
+tapedev "file:/path/to/vtape"
+.fi
+.PP
+The VFS device driver stores data on a UNIX filesystem\&. Note that although one typically uses the VFS device driver to store data on hard disks, the driver does not interface with any hardware on a block level\&.
+.PP
+The device name specifies a path to a directory which must exist and contain a "data/" subdirectory\&. Each tape file is stored as a distinct file in this directory, the name of which reflects the Amanda header in the tape file\&. Block boundaries are not maintained: the driver supports reads of arbitrary size, regardless of the blocksize used to write the data\&.
+.SH "PROPERTIES"
+.PP
+Device drivers use
+\fIproperties\fR
+as a generic means to interact with other parts of Amanda\&. Some properties are set by the device driver and used by Amanda to determine how its devices should be used\&. Other properties can be set by Amanda or by the user to influence the driver\'s behavior\&. Properties are set for a particular device, so that if you have two tape devices, they will not share property values\&.
+.PP
+Properties are specified in
+\fIamanda\&.conf\fR
+with the
+\fIdevice\-property\fR
+parameter\&. The syntax looks like this:
+.sp
+.nf
+device_property "FROBNICATOR_PATH" "/var/frobd/state"
+device_property "BYTES_PER_FORTNIGHT" "128k"
+device_property "USE_QUBITS" "no"
+.fi
+.PP
+Both the property name and the property value are always quoted\&. String values are given as simple strings, like FROBNICATOR_PATH in the example above\&. Integer values can be specified with any of the suffixes given in the "VALUE SUFFIXES" section of
+\fBamanda.conf\fR(5), like BYTES_PER_FORTNIGHT, above\&. Boolean values can be specified as any of "true", "yes", "1", "0", "no", "false", like USE_QUBITS, above\&. Some properties have special formats, as described below\&.
+.PP
+Some properties are set based on other configuration values, such as tapetype parameters\&. These special cases are detailed under the appropriate property, below\&.
+.PP
+The order in which device properties are set is as follows:
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 1.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP "  1." 4.2
+.\}
+Tapetype parameters (including length, blocksize, and readblocksize) are translated into device properties and set accordingly\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04' 2.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP "  2." 4.2
+.\}
+Device properties from any device_property configuration parameters are set, in the order they appear in the configuration file\&.
+.RE
+.PP
+Properties described as read\-only are not accessible to users\&. They are listed here for completeness\&.
+.SS "COMMON PROPERTIES"
+.PP
+Note that some of these properties are currently unused, and present only for future expansion\&. Not all devices implement all of these properties\&.
+.PP
+APPENDABLE
+.RS 4
+
+ (read\-only) This boolean property indicates whether this device supports appending data to volumes\&.
+.RE
+.PP
+BLOCK_SIZE
+.RS 4
+
+ (read\-write) This property gives the block size, in bytes, that will be used to write to the device\&.  The usual suffixes ("kbytes", etc\&.) are allowed\&.  The tapetype parameter \fIblocksize\fR sets this property\&.
+.RE
+.PP
+CANONICAL_NAME
+.RS 4
+
+ (read\-only) This property contains the full canonical name for this device\&.  This name may not be the same as the user\-supplied name, but is a valid name by which to access this device\&.
+.RE
+.PP
+COMPRESSION
+.RS 4
+
+ (read\-write) This boolean property represents the compression status of the device, and can be used to enable and disable such compression\&.  This applies mostly to tape devices, although many tape devices do not support setting compression from software\&.
+.RE
+.PP
+COMPRESSION_RATE
+.RS 4
+
+ (read\-only) This property gives the compression rate, as a decimal ratio\&.  It may be a measured value over some unspecified period or a simple estimate\&.
+.RE
+.PP
+CONCURRENCY
+.RS 4
+
+ (read\-only) This property indicates the level of concurrent access that this device supports\&.
+.RE
+.PP
+FREE_SPACE
+.RS 4
+
+ (read\-only) This property gives the amount of free space available on the current volume, if known\&.  This is often an estimate; for example, tape devices can only estimate the amount of tape left on a spool\&.
+.RE
+.PP
+MAX_BLOCK_SIZE
+.RS 4
+
+ (read\-only) This property gives the maximum block size this device can support\&.  See BLOCK SIZES, below\&.
+.RE
+.PP
+MEDIUM_ACCESS_TYPE
+.RS 4
+
+ (read\-only) This property gives the type of the media in the device: read only, WORM (Write Once, Read Many), read/write, or write only\&.  Write\-only devices do not support recovery, but the data are not necessarily thrown out\&.
+.RE
+.PP
+MIN_BLOCK_SIZE
+.RS 4
+
+ (read\-write) This property gives the minimum block size this device can support\&.  See BLOCK SIZES, below\&.
+.RE
+.PP
+MAX_VOLUME_USAGE
+.RS 4
+
+ (read\-write) On devices that support it, this property will limit the total amount of data written to a volume; attempts to write beyond this point will cause the device to simulate "out of space\&."  Zero means no limit\&.  The tapetype parameter \fIlength\fR sets this property\&.
+.RE
+.PP
+PARTIAL_DELETION
+.RS 4
+
+ (read\-only) This property indicates whether the device supports deletion of specific files\&.  Aside from linear tapes, most devices can support this feature\&.  It is currently unused by Amanda\&.
+.RE
+.PP
+STREAMING
+.RS 4
+
+ (read\-only) This property gives the streaming requirement for this device\&.  For example, tape drives often require a steady supply of data to avoid shoe\-shining, while disk devices have no such requirement\&.
+.RE
+.PP
+VERBOSE
+.RS 4
+
+ (read\-write) If this boolean property is set, then the device will produce verbose debugging output\&.  This property is not recognized by all devices\&.
+.RE
+.SS "BLOCK SIZES"
+.PP
+Amanda writes device data in blocks\&. On most devices the block boundaries are embedded in the media along with the data itself, so subsequent reads must use the same block sizes\&. On tape devices, the block size is dictated by the capabilities of the hardware \-\- buffer sizes, physical format, and so on\&.
+.PP
+Amanda has historically supported a single, fixed block size \-\- usually 32k\&. The Device API adds the ability to specify a block size at runtime, using the BLOCK_SIZE property\&. Devices provide MIN_BLOCK_SIZE and MAX_BLOCK_SIZE as a guide to the range of acceptable block sizes\&. Note that this does not imply that all sizes in the range MIN_BLOCK_SIZE \- MAX_BLOCK_SIZE are available \-\- the device may require that block sizes are even multiples of some power of two, for example\&. Consult the documentation for your hardware and operating system for more information\&.
+.PP
+Most devices are flexible enough to read a volume using a different block size than that with which it was written\&. This can be useful when handling old volumes written with a smaller blocksize, or volumes of unknown blocksize\&. Unfortunately, some tape devices do not detect oversized blocks correctly, and may lose data if the configured block size is smaller than the volume\'s block size\&. The tape device driver has a READ_BUFFER_SIZE property which specifies the minimum buffer size that will be allocated for reads from tape\&. If the hardware supports it, setting this property allows Amanda to correctly read from tapes written with any blocksize less than or equal to READ_BUFFER SIZE\&.
+.if n \{\
+.sp
+.\}
+.RS 4
+.BM yellow
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.br
+.ps +1
+\fBNote\fR
+.ps -1
+.br
+.PP
+The RAIT device does not support flexible block sizes, as its parity algorithm requires that all child devices have the same, fixed block size\&.
+.sp .5v
+.EM yellow
+.RE
+.SS "DRIVER\-SPECIFIC PROPERTIES"
+.SS "S3 Device"
+.PP
+S3_ACCESS_KEY
+.RS 4
+
+ (read\-write) This property gives the Amazon S3 access key used to access the service\&.
+.RE
+.PP
+S3_BUCKET_LOCATION
+.RS 4
+
+ (read\-write) Location constraint for buckets on Amazon S3\&.
+Currently, it can be set to "", for no constraint (i\&.e\&. store data in the US), 
+or "EU" (i\&.e\&. store data in the EU)\&.
+See Amazon\'s documentation for details and latest information
+.RE
+.PP
+S3_SECRET_KEY
+.RS 4
+
+ (read\-write) This property gives the Amazon S3 secret key used to access the service\&.
+.RE
+.PP
+S3_SSL
+.RS 4
+
+ (read\-write) Whether or not to use SSL/TLS to secure communications with Amazon S3\&.
+.RE
+.PP
+S3_USER_TOKEN
+.RS 4
+
+ (read\-write) This property specifies the user token for Amanda Enterprise Edition customers\&.
+.RE
+.PP
+Most Amanda devices work just fine without any properties, but not the S3 device\&. A typical S3 configuration will have an access key and secret key specified:
+.sp
+.nf
+device_property "S3_ACCESS_KEY" "27D3B8C6C4E7AA423C2B37C72A0D22C8"
+device_property "S3_SECRET_KEY" "agphc2Q7Zmxragphc2RmO2xragpzZGY7a2xqCgr"
+.fi
+
+.SS "Tape Device"
+.PP
+Most of these properties are automatically detected, but can be overridden in the configuration file if the autodetection fails\&. Note that tape drives are required to at least support the MTREW (rewind) operation; all other operations can be emulated with the MTREW and read data operations\&.
+.PP
+BROKEN_GMT_ONLINE
+.RS 4
+
+ (read\-write) Set this boolean property if the system\'s GMT_ONLINE macro gives incorrect results\&.  This is currently true for the Linux IDE\-TAPE driver\&.
+.RE
+.PP
+BSF
+.RS 4
+
+ (read\-write) This boolean property specifies whether the device
+ driver may execute the MTBSF operation (backward seek file)\&.
+.RE
+.PP
+BSF_AFTER_EOM
+.RS 4
+
+ (read\-write) This boolean property specifies whether the device
+ driver should execute an MTBSF (backward seek file) operation after
+ MTEOM (seek to end of recorded data) in order to append\&.
+.RE
+.PP
+BSR
+.RS 4
+
+ (read\-write) This boolean property specifies whether the device
+ driver may use the MTBSR operation (backward seek record)\&.
+.RE
+.PP
+EOM
+.RS 4
+
+ (read\-write) This boolean property specifies whether the device
+ driver may use the MTEOM command (seek to end of recorded data)\&.
+.RE
+.PP
+FINAL_FILEMARKS
+.RS 4
+
+ (read\-write) This integer property gives the number of filemarks that should be written at EOD\&.  It is usually 1 or 2\&.
+.RE
+.PP
+FSF
+.RS 4
+
+ (read\-write) This boolean property specifies whether the device driver may use the MTFSF operation (forward seek file)\&.
+.RE
+.PP
+FSR
+.RS 4
+
+ (read\-write) This boolean property specifies whether the device driver may use the MTFSR operation (forward seek record)\&.
+.RE
+.PP
+READ_BUFFER_SIZE
+.RS 4
+
+ (read\-write) This property specifies the minimum buffer size that will be used for reads; this should be large enough to contain any block that may be read from the device, and must be larger than BLOCK_SIZE\&.  This property exists for tape devices which cannot determine the size of on\-tape blocks, or which may discard data which overflows a small buffer\&.  The tapetype parameter \fIREADBLOCKSIZE\fR sets this property\&.  See BLOCK SIZES, above\&.
+.RE
+.SH "SEE ALSO"
+.PP
+
+\fBamanda.conf\fR(5),
+.SH "Authors"
+.PP
+\fBIan Turner\fR <\&ian@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
+.PP
+\fBDustin J\&. Mitchell\fR <\&dustin@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
diff --git a/man/amanda-scripts.7 b/man/amanda-scripts.7
new file mode 100644 (file)
index 0000000..28a9320
--- /dev/null
@@ -0,0 +1,216 @@
+.\"     Title: amanda-scripts
+.\"    Author: Jean-Louis Martineau <martineau@zmanda.com>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: Miscellanea
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
+.\"
+.TH "AMANDA\-SCRIPTS" "7" "01/22/2009" "Amanda 2\&.6\&.1" "Miscellanea"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amanda-scripts \- Configuring and using the Script API
+.SH "DESCRIPTION"
+.PP
+The Script API is a flexible system for invoking user\-supplied scripts at various points in the execution of Amanda\&. This manual page describes the operation and configuration of the API\&. For help writing Script API scripts, see http://wiki\&.zmanda\&.com/index\&.php/Script_API\&.
+.SH "SCRIPTS"
+.PP
+This section lists the scripts included with
+\fIAmanda\fR, see the individual man page for instructions on using them\&. For complete How\-To information, consult the Amanda wiki at http://wiki\&.zmanda\&.com\&.
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamzfs-snapshot\fR(8),
+\- create/destroy zfs snapshot\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBscript-email\fR(8),
+\- send email\&.
+.RE
+.SH "SEE ALSO"
+.PP
+
+\fBamanda.conf\fR(5)
+.SH "Authors"
+.PP
+\fBJean\-Louis Martineau\fR <\&martineau@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
+.PP
+\fBDustin J\&. Mitchell\fR <\&dustin@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
index ef16e72828242ee6367e09560e46f69def53ff07..be00f849317312aa9e36b16d2f99f413cf2fb285 100644 (file)
 .\"     Title: amanda
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
+.\"    Author: James da Silva <jds@amanda.org>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
 .\"
-.TH "AMANDA" "8" "08/22/2008" "" ""
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.SH "NAME"
-amanda - Advanced Maryland Automatic Network Disk Archiver
-.SH "SYNOPSIS"
-.HP 8
-\fBamadmin\fR \fIconfig\fR \fIcommand\fR [\fIoptions\fR]
-.br
-
-.HP 8
-\fBamcheck\fR [\fIoptions\fR] \fIconfig\fR
-.br
-
-.HP 10
-\fBamcheckdb\fR \fIconfig\fR
-.br
-
-.HP 10
-\fBamcleanup\fR \fIconfig\fR
-.br
-
-.HP 8
-\fBamcrypt\fR
-.br
-
-.HP 5
-\fBamdd\fR [\fIoptions\fR]
-.HP 7
-\fBamdump\fR \fIconfig\fR
-.br
-
-.HP 10
-\fBamaespipe\fR
-.br
-
-.HP 8
-\fBamflush\fR [\-f] \fIconfig\fR
-.br
-
-.HP 10
-\fBamgetconf\fR [\fIconfig\fR] \fIparameter\fR
-.br
-
-.HP 8
-\fBamlabel\fR \fIconfig\fR \fIlabel\fR [\fIslot\fR\ \fIslot\fR]
-.br
-
-.HP 5
-\fBammt\fR [\fIoptions\fR]
-.HP 11
-\fBamoverview\fR \fIconfig\fR [\fIoptions\fR]
-.br
-
-.HP 7
-\fBamplot\fR [\fIoptions\fR] \fIamdump\-files\fR
-.br
-
-.HP 10
-\fBamrecover\fR [\fIconfig\fR] [\fIoptions\fR]
-.br
-
-.HP 9
-\fBamreport\fR [\fIconfig\fR] [\fIoptions\fR]
-.br
-
-.HP 10
-\fBamrestore\fR [\fIoptions\fR] \fItapedevice\fR [\fIhostname\fR\ [\fIdiskname\fR]]
-.br
-
-.HP 12
-\fBamfetchdump\fR [\fIoptions\fR] \fIconfig\fR [\fIhostname\fR\ [\fIdiskname\fR\ [\fIdate\fR\ [level]]]]
-.HP 9
-\fBamrmtape\fR [\fIoptions\fR] \fIconfig\fR \fIlabel\fR
-.br
-
-.HP 9
-\fBamstatus\fR \fIconfig\fR [\fIoptions\fR]
-.br
-
-.HP 7
-\fBamtape\fR \fIconfig\fR \fIcommand\fR [\fIoptions\fR]
-.br
-
-.HP 11
-\fBamtapetype\fR [\fIoptions\fR]
-.HP 6
-\fBamtoc\fR [\fIoptions\fR] \fIlogfile\fR
+.TH "AMANDA" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
 .br
-
-.HP 12
-\fBamcheckdump\fR [\fIoptions\fR] \fIconfig\fR
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
 .br
-
-.HP 15
-\fBamserverconfig\fR [\fIoptions\fR] \fIconfig\fR
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
 .br
-
-.HP 12
-\fBamaddclient\fR \fIconfig\fR [\fIoptions\fR]
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
 .br
-
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amanda \- The Open Source Backup Platform
 .SH "DESCRIPTION"
 .PP
+This manual page gives an overview of the
 \fIAmanda\fR
-is the "Advanced Maryland Automatic Network Disk Archiver"\. This manual page gives an overview of the
-\fIAmanda\fR
-commands and configuration files for quick reference\.
+commands and configuration files for quick reference\&.
+.SS "COMMANDS"
 .PP
 Here are all the
 \fIAmanda\fR
-commands\. Each one has its own manual page\. See them for all the gory details\.
-.PP
-\fBamdump\fR
+commands\&. Each one has its own manual page\&. See them for all the gory details\&.
+.sp
 .RS 4
-Take care of automatic
-\fIAmanda\fR
-backups\. This is normally executed by
-\fBcron\fR
-on a computer called the
-\fItape server host\fR
-and requests backups of file systems located on
-\fIbackup\fR
-\fIclients\fR\.
-\fBAmdump\fR
-backs up all disks in the
-\fIdisklist\fR
-file (discussed below) to tape or, if there is a problem, to a special
-\fIholding\fR
-\fIdisk\fR\. After all backups are done,
-\fBamdump\fR
-sends mail reporting failures and successes\.
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamaddclient\fR(8),
 .RE
-.PP
-\fBamflush\fR
+.sp
 .RS 4
-Flush backups from the holding disk to tape\.
-\fBAmflush\fR
-is used after
-\fBamdump\fR
-has reported it could not write backups to tape for some reason\. When this happens, backups stay in the holding disk\. Run
-\fBamflush\fR
-after the tape problem is corrected to write backups from the holding disk to tape\.
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamadmin\fR(8),
 .RE
-.PP
-\fBamcleanup\fR
+.sp
 .RS 4
-Clean up after an interrupted
-\fBamdump\fR\. This command is only needed if
-\fBamdump\fR
-was unable to complete for some reason, usually because the tape server host crashed while
-\fBamdump\fR
-was running\.
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamaespipe\fR(8),
 .RE
-.PP
-\fBamrecover\fR
+.sp
 .RS 4
-Provides an interactive interface to browse the
-\fIAmanda\fR
-index files (backup image catalogues) and select which tapes to recover files from\. It can also run
-\fBamrestore\fR
-and a restore program (e\.g\.
-\fBtar\fR) to actually recover the files\.
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamcheck\fR(8),
 .RE
-.PP
-\fBamrestore\fR
+.sp
 .RS 4
-Read an
-\fIAmanda\fR
-tape, searching for requested backups\.
-\fBAmrestore\fR
-is suitable for everything from interactive restores of single files to a full restore of all partitions on a failed disk\.
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamcheckdb\fR(8),
 .RE
-.PP
-\fBamfetchdump\fR
+.sp
 .RS 4
-Performs
-\fIAmanda\fR
-tape restoration, similar to
-\fBamrestore\fR\. Additional capabilities include "hands\-off" searching of multiple tapes, automatic retrieval of specific dump files based on dump logs, and assembly of tape\-spanning split dump files\.
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamcheckdump\fR(8),
 .RE
-.PP
-\fBamlabel\fR
+.sp
 .RS 4
-Write an
-\fIAmanda\fR
-format label onto a tape\. All
-\fIAmanda\fR
-tapes must be labeled with
-\fBamlabel\fR\.
-\fBAmdump\fR
-and
-\fBamflush\fR
-will not write to an unlabeled tape (see TAPE MANAGEMENT below)\.
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamcleanup\fR(8),
 .RE
-.PP
-\fBamcheck\fR
+.sp
 .RS 4
-Verify the correct tape is mounted and all file systems on all backup client systems are ready to be backed up\. Often run by
-\fBcron\fR
-before
-\fBamdump\fR
-to generate a mail warning that backups might fail unless corrective action is taken\.
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamcrypt-ossl-asym\fR(8),
 .RE
-.PP
-\fBamadmin\fR
+.sp
 .RS 4
-Take care of administrative tasks like finding out which tapes are needed to restore a filesystem, forcing hosts to do full backups of selected disks and looking at schedule balance information\.
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamcrypt-ossl\fR(8),
 .RE
-.PP
-\fBamtape\fR
+.sp
 .RS 4
-Take care of tape changer control operations like loading particular tapes, ejecting tapes and scanning the tape storage slots\.
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamcrypt\fR(8),
 .RE
-.PP
-\fBamcheckdump\fR
+.sp
 .RS 4
-Check the results of an
-\fIAmanda\fR
-dump\.
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamcryptsimple\fR(8),
 .RE
-.PP
-\fBamserverconfig\fR
+.sp
 .RS 4
-Program to setup initial
-\fIAmanda\fR
-configuration\.
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamdd\fR(8),
 .RE
-.PP
-\fBamaddclient\fR
+.sp
 .RS 4
-Program to add client to an existing
-\fIAmanda\fR
-configuration\.
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamdevcheck\fR(8),
 .RE
-.PP
-\fBamrmtape\fR
+.sp
 .RS 4
-Delete a tape from the
-\fIAmanda\fR
-databases\.
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamdump\fR(8),
 .RE
-.PP
-\fBamstatus\fR
+.sp
 .RS 4
-Report the status of a running or completed
-\fBamdump\fR\.
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamfetchdump\fR(8),
 .RE
-.PP
-\fBamoverview\fR
+.sp
 .RS 4
-Display a chart of hosts and file systems backed up every run\.
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamflush\fR(8),
 .RE
-.PP
-\fBamplot\fR
+.sp
 .RS 4
-Generate utilization plots of
-\fIAmanda\fR
-runs for performance tuning\.
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamgetconf\fR(8),
 .RE
-.PP
-\fBamreport\fR
+.sp
 .RS 4
-Generate an
-\fIAmanda\fR
-summary E\-mail report\.
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamgpgcrypt\fR(8),
 .RE
-.PP
-\fBamtoc\fR
+.sp
 .RS 4
-Generate table of content files for
-\fIAmanda\fR
-tapes\.
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamgtar\fR(8),
 .RE
-.PP
-\fBamcheckdb\fR
+.sp
 .RS 4
-Verify every tape
-\fIAmanda\fR
-knows about is consistent in the database\.
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamlabel\fR(8),
 .RE
-.PP
-\fBamgetconf\fR
+.sp
 .RS 4
-Look up parameters in the
-\fIAmanda\fR
-configuration file\.
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBammt\fR(8),
 .RE
-.PP
-\fBamtapetype\fR
+.sp
 .RS 4
-Generate a tapetype definition\.
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamoverview\fR(8),
 .RE
-.PP
-\fBamaespipe\fR
+.sp
 .RS 4
-Wrapper program from aespipe (data encryption utility)
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamplot\fR(8),
 .RE
-.PP
-\fBamcrypt\fR
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamrecover\fR(8),
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamreport\fR(8),
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamrestore\fR(8),
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamrmtape\fR(8),
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamsamba\fR(8),
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamserverconfig\fR(8),
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamservice\fR(8),
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamstar\fR(8),
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamstatus\fR(8),
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamtape\fR(8),
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamtapetype\fR(8),
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamtoc\fR(8),
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamvault\fR(8),
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamzfs-sendrecv\fR(8),
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamzfs-snapshot\fR(8),
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBscript-email\fR(8),
+.RE
+.SS "CONFIGURATION FILES"
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamanda.conf\fR(5),
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamanda-client.conf\fR(5),
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBdisklist\fR(5),
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBtapelist\fR(5),
+.RE
+.SS "DATA FORMATS"
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamanda-archive-format\fR(5),
+.RE
+.SS "CONCEPTS"
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamanda-applications\fR(7),
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamanda-auth\fR(7),
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamanda-changers\fR(7),
+.RE
+.sp
 .RS 4
-Reference encryption program for Amanda symmetric data encryption
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamanda-devices\fR(7),
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+\fBamanda-scripts\fR(7),
 .RE
 .SH "CONFIGURATION"
 .PP
-There are three user\-editable files that control the behavior of
-\fIAmanda\fR\.
+There are four user\-editable files that control the behavior of
+\fIAmanda\fR\&.
 .PP
-The first is
-\fBamanda\.conf\fR, the main configuration file\. It contains parameters to customize
-\fIAmanda\fR
-for the site\. Refer to the
-\fBamanda.conf\fR(5), manpage for details on
+The first two are
+\fBamanda.conf\fR(5)
+and
+\fBamanda-client.conf\fR(5), the main configuration files for the server and client, respectively\&. They contain parameters to customize
 \fIAmanda\fR
-configuration parameters\.
+for the site\&.
 .PP
-Second is the
-\fIdisklist\fR
-file, which lists hosts and disk partitions to back up\.
+Next is the
+\fBdisklist\fR(5)
+file, which lists hosts and disk partitions to back up\&.
 .PP
-Third is the
-\fItapelist\fR
-file, which lists tapes that are currently active\. These files are described in more detail in the following sections\.
+Last is the seldom\-edited
+\fBtapelist\fR(5)
+file, which lists tapes that are currently active\&. These files are described in more detail in the following sections\&.
 .PP
-All files are stored in individual configuration directories under
-\fI/usr/local/etc/amanda/\fR\. A site will often have more than one configuration\. For example, it might have a
+All files are stored in individual configuration directories, usually under
+\FC/etc/amanda/\F[]\&. A site will often have more than one configuration\&. For example, it might have a
 \fInormal\fR
 configuration for everyday backups and an
 \fIarchive\fR
-configuration for infrequent full archival backups\. The configuration files would be stored under directories
-\fI/usr/local/etc/amanda/normal/\fR
+configuration for infrequent full archival backups\&. The configuration files would be stored under directories
+\FC/etc/amanda/normal/\F[]
 and
-\fI/usr/local/etc/amanda/archive/\fR, respectively\. Part of the job of an
+\FC/etc/amanda/archive/\F[], respectively\&. Part of the job of an
 \fIAmanda\fR
-administrator is to create, populate and maintain these directories\.
+administrator is to create, populate and maintain these directories\&.
+.SH "LOG FILES"
 .PP
 All log and database files generated by
 \fIAmanda\fR
-go in corresponding directories somewhere\. The exact location is controlled by entries in
-\fBamanda\.conf\fR\. A typical location would be under
-\fI/var/adm/amanda\fR\. For the above example, the files might go in
-\fI/var/adm/amanda/normal/\fR
+go in corresponding directories somewhere\&. The exact location is controlled by entries in
+\fBamanda.conf\fR(5)\&. A typical location would be under
+\FC/var/adm/amanda\F[]\&. For the above example, the files might go in
+\FC/var/adm/amanda/normal/\F[]
 and
-\fI/var/adm/amanda/archive/\fR\.
+\FC/var/adm/amanda/archive/\F[]\&.
 .PP
 As log files are no longer needed (no longer contain relevant information),
 \fIAmanda\fR
-cycles them out in various ways, depending on the type of file\.
+cycles them out in various ways, depending on the type of file\&.
 .PP
 Detailed information about
 \fBamdump\fR
-runs are stored in files named
-\fBamdump\.\fR\fINN\fR
+runs are stored in dump logs \-\- files named
+\fBamdump\&.\fR\fINN\fR
 where
 \fINN\fR
-is a sequence number, with 1 being the most recent file\.
+is a sequence number, with 1 being the most recent file\&.
 \fBAmdump\fR
 rotates these files each run, keeping roughly the last
 \fBtapecycle\fR
-(see below) worth of them\.
+(see below) worth of them\&.
 .PP
 The file used by
 \fBamreport\fR
-to generate the mail summary is named
-\fBlog\.\fR\fIYYYYMMDD\.NN\fR
+to generate the mail summary is the trace log\&. This file constitutes the "catalog" describing the data on the tapes written in a run\&. It is named
+\fBlog\&.\fR\fIYYYYMMDDHHMMSS\&.NN\fR
 where
-\fIYYYYMMDD\fR
+\fIYYYYMMDDHHMMSS\fR
 is the datestamp of the start of the
 \fBamdump\fR
+or
+\fBamflush\fR
 run and
 \fINN\fR
-is a sequence number started at 0\. At the end of each
+is a sequence number started at 0\&. At the end of each
 \fBamdump\fR
 run, log files for runs whose tapes have been reused are renamed into a subdirectory of the main log directory (see the
 \fBlogdir\fR
 parameter below) named
-\fBoldlog\fR\. It is up to the
+\fBoldlog\fR\&. It is up to the
 \fIAmanda\fR
-administrator to remove them from this directory when desired\.
+administrator to remove them from this directory when desired\&.
 .PP
 Index (backup image catalogue) files older than the full dump matching the oldest backup image for a given client and disk are removed by
 \fBamdump\fR
-at the end of each run\.
-.SH "DISKLIST FILE"
+at the end of each run\&.
+.SH "Using Samba"
 .PP
-The
-\fIdisklist\fR
-file determines which disks will be backed up by
-\fIAmanda\fR\. The file usually contains one line per disk:
+For Samba access,
+\fIAmanda\fR
+needs a file on the Samba server (which may or may not also be the tape server) named
+\FC/etc/amandapass\F[]
+with share names, (clear text) passwords and (optional) domain names, in that order, one per line, whitespace separated\&. By default, the user used to connect to the PC is the same for all PC\'s and is compiled into
+\fIAmanda\fR\&. It may be changed on a host by host basis by listing it first in the password field followed by a percent sign and then the password\&. For instance:
 .nf
-\fIhostname diskname\fR [\fIdiskdevice\fR] \fIdumptype\fR [\fIspindle\fR [\fIinterface\fR] ]
+  //some\-pc/home normalpw
+  //another\-pc/disk otheruser%otherpw
 .fi
 .PP
-All pairs [
-\fIhostname diskname\fR
-] must be unique\.
+With clear text passwords, this file should obviously be tightly protected\&. It only needs to be readable by the
+\fIAmanda\fR\-user on the Samba server\&.
+.SH "HOST & DISK EXPRESSION"
+.PP
+All host and disk arguments to programs are special expressions\&. The command applies to all disks that match your arguments\&. This section describes the matcher\&.
 .PP
-Lines starting with # are ignored, as are blank lines\. The fields have the following meanings:
+The matcher matches by word, each word is a glob expression, words are separated by the separator \'\&.\' for host and \'/\' for disk\&. You can anchor the expression at left with a \'^\'\&. You can anchor the expression at right with a \'$\'\&. The matcher is case insensitive for host but is case sensitive for disk\&. A match succeeds if all words in your expression match contiguous words in the host or disk\&.
 .PP
-\fIhostname\fR
+dot (\&.)
 .RS 4
-The name of the host to be backed up\. If
-\fBdiskdevice\fR
-refers to a PC share, this is the host
-\fIAmanda\fR
-will run the Samba
-\fBsmbclient\fR
-program on to back up the share\.
+word separator for a host
 .RE
 .PP
-\fIdiskname\fR
-.RS 4
-The name of the disk (a label)\. In most case, you set your
-\fBdiskname\fR
-to the
-\fBdiskdevice\fR
-and you don\'t set the
-\fBdiskdevice\.\fR
-If you want multiple entries with the same
-\fBdiskdevice\fR, you must set a different
-\fBdiskname\fR
-for each entry\. It\'s the
-\fBdiskname\fR
-that you use on the commandline for any
-\fIAmanda\fR
-command\. Look at the example/disklist file for example\.
+/
+.RS 4
+word separator for a disk
 .RE
 .PP
-\fIdiskdevice\fR
+^
 .RS 4
-Default: same as diskname\. The name of the disk device to be backed up\. It may be a full device name, a device name without the
-\fI/dev/\fR
-prefix, e\.g\.
-\fIsd0a\fR, or a mount point such as
-\fI/usr\fR\.
-.sp
-It may also refer to a PC share by starting the name with two (forward) slashes, e\.g\.
-\fI//some\-pc/home\fR\. In this case, the
-\fBprogram\fR
-option in the associated
-\fBdumptype\fR
-must be entered as
-\fBGNUTAR\fR\. It is the combination of the double slash disk name and
-\fBprogram GNUTAR\fR
-in the
-\fBdumptype\fR
-that triggers the use of Samba\.
+anchor at left
 .RE
 .PP
-\fIdumptype\fR
+$
 .RS 4
-Refers to a
-\fBdumptype\fR
-defined in the
-\fBamanda\.conf\fR
-file\.
-\fIDumptype\fRs specify backup related parameters, such as whether to compress the backups, whether to record backup results in
-\fI/etc/dumpdates\fR, the disk\'s relative priority, etc\.
+anchor at right
 .RE
 .PP
-\fIspindle\fR
+?
 .RS 4
-Default:
-\fB\-1\fR\. A number used to balance backup load on a host\.
-\fIAmanda\fR
-will not run multiple backups at the same time on the same spindle, unless the spindle number is \-1, which means there is no spindle restriction\.
+match exactly one character except the separator
 .RE
 .PP
-\fIinterface\fR
+*
 .RS 4
-Default:
-\fIlocal\fR\. The name of a network interface definition in the
-\fBamanda\.conf\fR
-file, used to balance network load\.
+match zero or more characters except the separator
 .RE
 .PP
-Instead of naming a
-\fBdumptype\fR, it is possible to define one in\-line, enclosing
-\fBdumptype\fR
-options within curly braces, one per line, just like a
-\fBdumptype\fR
-definition in
-\fBamanda\.conf\fR\. Since pre\-existing
-\fBdumptype\fRs are valid option names, this syntax may be used to customize
-\fBdumptype\fRs for particular disks\.
-.PP
-A line break
-\fBmust\fR
-follow the left curly bracket\.
-.PP
-For instance, if a
-\fBdumptype\fR
-named
-\fInormal\fR
-is used for most disks, but use of the holding disk needs to be disabled for the file system that holds it, this would work instead of defining a new dumptype:
-.nf
-\fIhostname diskname\fR [ \fIdiskdevice\fR ] {
-  normal
-  holdingdisk never
-} [ \fIspindle\fR [ \fIinterface\fR ] ]
-.fi
-.SH "TAPE MANAGEMENT"
-.PP
-The
-\fItapelist\fR
-file contains the list of tapes in active use\. This file is maintained entirely by
-\fIAmanda\fR
-and should not be created or edited during normal operation\. It contains lines of the form:
-.PP
-.nf
-YYYYMMDD label flags
-.fi
-.PP
-Where
-\fIYYYYMMDD\fR
-is the date the tape was written,
-\fIlabel\fR
-is a label for the tape as written by
-\fBamlabel\fR
-and
-\fIflags\fR
-tell
-\fIAmanda\fR
-whether the tape may be reused, etc (see the
-\fBreuse\fR
-options of
-\fBamadmin\fR)\.
-.PP
-\fBAmdump\fR
-and
-\fBamflush\fR
-will refuse to write to an unlabeled tape, or to a labeled tape that is considered active\. There must be more tapes in active rotation (see the
-\fBtapecycle\fR
-option) than there are runs in the backup cycle (see the
-\fBdumpcycle\fR
-option) to prevent overwriting a backup image that would be needed to do a full recovery\.
-.SH "OUTPUT DRIVERS"
-.PP
-The normal value for the
-\fBtapedev\fR
-parameter, or for what a tape changer returns, is a full path name to a non\-rewinding tape device, such as
-\fI/dev/nst0\fR
-or
-\fI/dev/rmt/0mn\fR
-or
-\fI/dev/nst0\.1\fR
-or whatever conventions the operating system uses\.
-\fIAmanda\fR
-provides additional application level drivers that support non\-traditional tape\-simulations or features\. To access a specific output driver, set
-\fBtapedev\fR
-(or configure your changer to return) a string of the form
-\fIdriver\fR:\fIdriver\-info\fR
-where
-\fIdriver\fR
-is one of the supported drivers and
-\fIdriver\-info\fR
-is optional additional information needed by the driver\.
+**
+.RS 4
+match zero or more characters including the separator
+.RE
 .PP
-The supported drivers are:
+Some examples:
 .PP
-\fItape\fR
+hosta
 .RS 4
-This is the default driver\. The
-\fIdriver\-info\fR
-is the tape device name\. Entering
-.sp
-.nf
-tapedev /dev/rmt/0mn
-.fi
-is really a short hand for
-.sp
-.nf
-tapedev tape:/dev/rmt/0mn
-.fi
+Will match
+\FChosta\F[],
+\FCfoo\&.hosta\&.org\F[], and
+\FChoSTA\&.dOMAIna\&.ORG\F[]
+but not
+\FChostb\F[]\&.
 .RE
 .PP
-\fInull\fR
+host
 .RS 4
-This driver throws away anything written to it and returns EOF for any reads except a special case is made for reading a label, in which case a "fake" value is returned that
-\fIAmanda\fR
-checks for and allows through regardless of what you have set in
-\fBlabelstr\fR\. The
-\fIdriver\-info\fR
-field is not used and may be left blank:
-.sp
-.sp
-.nf
-tapedev null:
-.fi
-.sp
-The
-\fIlength\fR
-value from the associated
-\fBtapetype\fR
-is used to limit the amount of data written\. When the limit is reached, the driver will simulate end of tape\.
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-Note
-This driver should only be used for debugging and testing, and probably only with the
-\fBrecord\fR
-option set to
-\fIno\fR\.
+Will match
+\FChost\F[]
+but not
+\FChosta\F[]\&.
 .RE
 .PP
-\fIrait\fR
+host?
 .RS 4
-\fIR\fRedundant
-\fIA\fRrray of
-\fII\fRnexpensive (?)
-\fIT\fRapes\. Reads and writes tapes mounted on multiple drives by spreading the data across N\-1 drives and using the last drive for a checksum\. See docs/RAIT for more information\.
-.sp
-The
-\fIdriver\-info\fR
-field describes the devices to use\. Curly braces indicate multiple replacements in the string\. For instance:
-.sp
-.sp
-.nf
-tapedev rait:/dev/rmt/tps0d{4,5,6}n
-.fi
-.sp
-would use the following devices:
-.sp
-\fI/dev/rmt/tps0d4n\fR
-\fI/dev/rmt/tps0d5n\fR
-\fI/dev/rmt/tps0d6n\fR
+Will match
+\FChosta\F[]
+and
+\FChostb\F[], but not
+\FChost\F[]\&.
 .RE
 .PP
-\fIfile\fR
-.RS 4
-This driver emulates a tape device with a set of files in a directory\. The
-\fIdriver\-info\fR
-field must be the name of an existing directory\. The driver will test for a subdirectory of that named
-\fIdata\fR
-and return
-\fBoffline\fR
-until it is present\. When present, the driver uses two files in the
-\fIdata\fR
-subdirectory for each tape file\. One contains the actual data\. The other contains record length information\.
-.sp
-The driver uses a file named
-\fIstatus\fR
-in the
-\fBfile\fR
-device directory to hold driver status information, such as tape position\. If not present, the driver will create it as though the device is rewound\.
-.sp
-The
-\fIlength\fR
-value from the associated
-\fBtapetype\fR
-is used to limit the amount of data written\. When the limit is reached, the driver will simulate end of tape\.
-.sp
-One way to use this driver with a real device such as a CD\-writer is to create a directory for the
-\fBfile\fR
-device and one or more other directories for the actual data\. Create a symlink named
-\fIdata\fR
-in the
-\fBfile\fR
-directory to one of the data directories\. Set the
-\fBtapetype\fR
-length to whatever the medium will hold\.
-.sp
-When
-\fIAmanda\fR
-fills the
-\fBfile\fR
-device, remove the symlink and (optionally) create a new symlink to another data area\. Use a CD writer software package to burn the image from the first data area\.
-.sp
-To read the CD, mount it and create the
-\fIdata\fR
-symlink in the
-\fBfile\fR
-device directory\.
+ho*na
+.RS 4
+Will match
+\FChoina\F[]
+but not
+\FCho\&.aina\&.org\F[]\&.
 .RE
-.SH "AUTHORIZATION"
-.PP
-\fIAmanda\fR
-processes on the tape server host run as the
-\fBdumpuser\fR
-user listed in
-\fBamanda\.conf\fR\. When they connect to a backup client, they do so with an
-\fIAmanda\fR\-specific protocol\. They do not, for instance, use
-\fBrsh\fR
-or
-\fBssh\fR
-directly\.
 .PP
-On the client side, the
-\fBamandad\fR
-daemon validates the connection using one of several methods, depending on how it was compiled and on options it is passed:
+ho**na
+.RS 4
+Will match
+\FChoina\F[]
+and
+\FCho\&.aina\&.org\F[]\&.
+.RE
 .PP
-\.rhosts
+^hosta
 .RS 4
-Even though
-\fIAmanda\fR
-does not use
-\fBrsh\fR, it can use
-\fB\.rhosts\fR\-style authentication and a
-\fB\.rhosts\fR
-file\.
+Will match
+\FChosta\F[]
+but not
+\FCfoo\&.hosta\&.org\F[]\&.
 .RE
 .PP
-\.amandahosts
+sda*
 .RS 4
-This is essentially the same as
-\fB\.rhosts\fR
-authentication except a different file, with almost the same format, is used\. This is the default mechanism built into
-\fIAmanda\fR\.
-.sp
-The format of the
-\fI\.amandahosts\fR
-file is:
-.sp
-\fIhostname\fR
-[
-\fIusername\fR
-[
-\fIservice\fR
-]*]
-.sp
-If
-\fIusername\fR
-is ommitted, it defaults to the user running
-\fBamandad\fR, i\.e\. the user listed in the
-\fBinetd\fR
-or
-\fBxinetd\fR
-configuration file\.
-.sp
-The
-\fIservice\fR
-is a list of the service the client is authorized to execute:
-\fBamdump\fR,
-\fBnoop\fR,
-\fBselfcheck\fR,
-\fBsendsize\fR,
-\fBsendbackup\fR,
-\fBamindexd\fR,
-\fBamidxtaped\fR\.
-\fBamdump\fR
-is a shortcut for "noop selfcheck sendsize sendbackup"
+Will match
+\FC/dev/sda1\F[]
+and
+\FC/dev/sda12\F[]\&.
 .RE
 .PP
-Kerberos
+/opt
 .RS 4
-\fIAmanda\fR
-may use the Kerberos authentication system\. Further information is in the
-\fBdocs/KERBEROS\fR
-file that comes with an
-\fIAmanda\fR
-distribution\.
-.sp
-For Samba access,
-\fIAmanda\fR
-needs a file on the Samba server (which may or may not also be the tape server) named
-\fI/etc/amandapass\fR
-with share names, (clear text) passwords and (optional) domain names, in that order, one per line, whitespace separated\. By default, the user used to connect to the PC is the same for all PC\'s and is compiled into
-\fIAmanda\fR\. It may be changed on a host by host basis by listing it first in the password field followed by a percent sign and then the password\. For instance:
-.nf
-  //some\-pc/home normalpw
-  //another\-pc/disk otheruser%otherpw
-.fi
-With clear text passwords, this file should obviously be tightly protected\. It only needs to be readable by the
-\fIAmanda\fR\-user on the Samba server\.
-.sp
-You can find further information in the
-\fBdocs/SAMBA\fR
-file that comes with an
-\fIAmanda\fR
-distribution\.
+Will match the disk
+\FCopt\F[]
+but not the host
+\FCopt\F[]\&.
 .RE
-.SH "HOST & DISK EXPRESSION"
 .PP
-All host and disk arguments to programs are special expressions\. The command applies to all disks that match your arguments\. This section describes the matcher\.
+(note dots:) \&.opt\&.
+.RS 4
+Will match the host
+\FCopt\F[]
+but not the disk
+\FCopt\F[]\&.
+.RE
 .PP
-The matcher matches by word, each word is a glob expression, words are separated by the separator \'\.\' for host and \'/\' for disk\. You can anchor the expression at left with a \'^\'\. You can anchor the expression at right with a \'$\'\. The matcher is case insensitive for host but is case sensitive for disk\. A match succeeds if all words in your expression match contiguous words in the host or disk\.
-.TS
-tab(:);
-l l
-l l
-l l
-l l
-l l
-l l
-l l.
-T{
-\.
-T}:T{
-word separator for a host
-T}
-T{
 /
-T}:T{
-word separator for a disk
-T}
-T{
-^
-T}:T{
-anchor at left
-T}
-T{
-$
-T}:T{
-anchor at right
-T}
-T{
-?
-T}:T{
-match exactly one character except the separator
-T}
-T{
-*
-T}:T{
-match zero or more characters except the separator
-T}
-T{
-**
-T}:T{
-match zero or more characters including the separator
-T}
-.TE
+.RS 4
+Will match the disk
+\FC/\F[]
+but no other disk\&.
+.RE
 .PP
-Some examples:
-.TS
-tab(:);
-l l l
-l l l
-l l l
-l l l
-l l l
-l l l
-l l l
-l l l
-l l l
-l l l
-l l l
-l l l
-l l l
-l l l
-l l l
-l l l
-l l l
-l l l
-l l l.
-T{
-EXPRESSION
-T}:T{
-WILL MATCH
-T}:T{
-WILL NOT MATCH
-T}
-T{
-hosta
-T}:T{
-hosta
-T}:T{
-hostb
-T}
-T{
-\ 
-T}:T{
-hoSTA\.dOMAIna\.ORG
-T}:T{
-\ 
-T}
-T{
-\ 
-T}:T{
-foo\.hosta\.org
-T}:T{
-\ 
-T}
-T{
-host
-T}:T{
-host
-T}:T{
-hosta
-T}
-T{
-host?
-T}:T{
-hosta
-T}:T{
-host
-T}
-T{
-\ 
-T}:T{
-hostb
-T}:T{
-\ 
-T}
-T{
-ho*na
-T}:T{
-hoina
-T}:T{
-ho\.aina\.org
-T}
-T{
-ho**na
-T}:T{
-hoina
-T}:T{
-\ 
-T}
-T{
-\ 
-T}:T{
-ho\.aina\.org
-T}:T{
-\ 
-T}
-T{
-^hosta
-T}:T{
-hosta
-T}:T{
-foo\.hosta\.org
-T}
-T{
-sda*
-T}:T{
-/dev/sda1
-T}:T{
-\ 
-T}
-T{
-\ 
-T}:T{
-/dev/sda12
-T}:T{
-\ 
-T}
-T{
-/opt
-T}:T{
-opt (disk)
-T}:T{
-opt (host)
-T}
-T{
-\.opt\.
-T}:T{
-opt (host)
-T}:T{
-opt (disk)
-T}
-T{
-/
-T}:T{
-/
-T}:T{
-any other disk
-T}
-T{
-/usr
-T}:T{
 /usr
-T}:T{
-\ 
-T}
-T{
-\ 
-T}:T{
-/usr/opt
-T}:T{
-\ 
-T}
-T{
+.RS 4
+Will match the disks
+\FC/usr\F[]
+and
+\FC/usr/local\F[]\&.
+.RE
+.PP
 /usr$
-T}:T{
-/usr
-T}:T{
-/usr/opt
-T}
-.TE
-.sp
+.RS 4
+Will match the disks
+\FC/usr\F[]
+but not
+\FC/usr/local\F[]\&.
+.RE
 .SH "DATESTAMP EXPRESSION"
 .PP
 A
 \fIdatestamp\fR
-expression is a range expression where we only match the prefix\. Leading ^ is removed\. Trailing $ forces an exact match\.
-.TS
-allbox tab(:);
-l l
-l l
-l l
-l l
-l l
-l l
-l l.
-T{
+expression is a range expression where we only match the prefix\&. Leading ^ is removed\&. Trailing $ forces an exact match\&.
+.PP
 20001212\-14
-T}:T{
+.RS 4
 match all dates beginning with 20001212, 20001213 or 20001214
-T}
-T{
+.RE
+.PP
 20001212\-4
-T}:T{
+.RS 4
 same as previous
-T}
-T{
+.RE
+.PP
 20001212\-24
-T}:T{
+.RS 4
 match all dates between 20001212 and 20001224
-T}
-T{
+.RE
+.PP
 2000121
-T}:T{
+.RS 4
 match all dates that start with 2000121 (20001210\-20001219)
-T}
-T{
+.RE
+.PP
 2
-T}:T{
+.RS 4
 match all dates that start with 2 (20000101\-29991231)
-T}
-T{
+.RE
+.PP
 2000\-10
-T}:T{
+.RS 4
 match all dates between 20000101\-20101231
-T}
-T{
+.RE
+.PP
 200010$
-T}:T{
+.RS 4
 match only 200010
-T}
-.TE
-.PP
+.RE
 .SH "DUMP SPECIFICATIONS"
 .PP
-A dump specification selects one or more dumps\. It has the form
-\fI[host][:disk][@datestamp]\fR, where each component is a pattern as described above\. If a component is missing, it is treated as a wildcard\. The characters \':\', \'@\', and \'\e\' may be escaped within any component by preceding them with a \'\e\'\.
+A dump specification selects one or more dumps\&. It has the form
+\fI[host][:disk][@datestamp]\fR, where each component is a pattern as described above\&. If a component is missing, it is treated as a wildcard\&. The characters \':\', \'@\', and \'\e\' may be escaped within any component by preceding them with a \'\e\'\&.
 .PP
 Some examples:
-.TS
-tab(:);
-l l
-l l
-l l
-l l
-l l
-l l.
-T{
-DUMPSPEC
-T}:T{
-DESCRIPTION
-T}
-T{
+.PP
 client17
-T}:T{
+.RS 4
 all dumps of client17
-T}
-T{
+.RE
+.PP
 @20080615
-T}:T{
+.RS 4
 All dumps on with datestamps matching 20080615
-T}
-T{
+.RE
+.PP
 webserver:/var/www
-T}:T{
+.RS 4
 All dumps of /var/www on host webserver
-T}
-T{
+.RE
+.PP
 webserver:/var/www@200806150317
-T}:T{
+.RS 4
 The dump of webserver with datestamp 200806150317
-T}
-T{
+.RE
+.PP
 :/var/www
-T}:T{
+.RS 4
 All dumps of /var/www on any host
-T}
-.TE
-.sp
+.RE
 .SH "CONFIGURATION OVERRIDE"
 .PP
 Most commands allow the override of specific configuration options on the command line, using the
 \-o
-option\. This option has the form
-\-o\fIname\fR=\fIvalue\fR\. An optional space is allowed after the
-\-o\. Each configuration option should be specified in a separate command\-line option\.
+option\&. This option has the form
+\-o\fIname\fR=\fIvalue\fR\&. An optional space is allowed after the
+\-o\&. Each configuration option should be specified in a separate command\-line option\&.
 .PP
 For global options,
 \fIname\fR
-is simply the name of the option, e\.g\.,
+is simply the name of the option, e\&.g\&.,
 .sp
 .nf
 amdump \-oruntapes=2
@@ -1107,7 +1050,7 @@ has the form
 \fISECTION\fR
 is one of TAPETYPE, DUMPTYPE, HOLDINGDISK, or INTERFACE, and
 \fIsection_name\fR
-is the name of the tapetype, dumptype, holdingdisk, or interface\. Examples:
+is the name of the tapetype, dumptype, holdingdisk, or interface\&. Examples:
 .sp
 .nf
 amdump \-o TAPETYPE:HP\-DAT:length=2000m
@@ -1116,48 +1059,20 @@ amdump \-o HOLDINGDISK:hd1:use="\-100 mb"
 amdump \-o INTERFACE:local:use="2000 kbps"
 .fi
 .PP
-Note that configuration overrides are not effective for tape changers, which supply a tapedev based on their own configuration\. In order to override
+When overriding device properties, one must carefully quote the command line to simulate the syntax of real configuration files\&. The following example should serve as a guide:
+.sp
+.nf
+amdump \-o \'device\-property="PROPERTY_MAX_VOLUME_USAGE" "100000"\'
+.fi
+.PP
+Note that configuration overrides are not effective for tape changers, which supply a tapedev based on their own configuration\&. In order to override
 \fItapedev\fR, you must also disable any changer:
 .sp
 .nf
 amdump \-otapedev=/dev/nst1 \-otpchanger=\'\'
 .fi
-.SH "AUTHOR"
-.PP
-James da Silva,
-<jds@amanda\.org>
-: Original text
+.SH "Authors"
 .PP
-Stefan G\. Weichinger,
-<sgw@amanda\.org>, maintainer of the
-\fIAmanda\fR\-documentation: XML\-conversion, major update
-.SH "SEE ALSO"
+\fBJames da Silva\fR <\&jds@amanda\&.org\&>
 .PP
-
-\fBamadmin\fR(8),
-\fBamanda.conf\fR(5),
-\fBamanda-client.conf\fR(5),
-\fBamcheck\fR(8),
-\fBamcheckdb\fR(8),
-\fBamcleanup\fR(8),
-\fBamdd\fR(8),
-\fBamdump\fR(8),
-\fBamfetchdump\fR(8)
-\fBamflush\fR(8),
-\fBamgetconf\fR(8),
-\fBamlabel\fR(8),
-\fBammt\fR(8),
-\fBamoverview\fR(8),
-\fBamplot\fR(8),
-\fBamrecover\fR(8),
-\fBamreport\fR(8),
-\fBamrestore\fR(8),
-\fBamrmtape\fR(8),
-\fBamstatus\fR(8),
-\fBamtape\fR(8),
-\fBamtapetype\fR(8),
-\fBamtoc\fR(8),
-\fBamcheckdump\fR(8),
-\fBamserverconfig\fR(8),
-\fBamaddclient\fR(8),
-: http://wiki.zmanda.com
+\fBStefan G\&. Weichinger\fR <\&sgw@amanda\&.org\&>
index 31e7d4626d710595d3b37b57a0e6ce9ccc27f031..c0299afbff77495c5fafd4619d4413e58761a779 100644 (file)
 .\"     Title: amanda.conf
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
+.\"    Author: James da Silva <jds@amanda.org>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: File formats and conventions
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
 .\"
-.TH "AMANDA\.CONF" "5" "08/22/2008" "" ""
+.TH "AMANDA\&.CONF" "5" "01/22/2009" "Amanda 2\&.6\&.1" "File formats and conventions"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
 .ad l
-.SH "NAME"
-amanda.conf - Main configuration file for Amanda, the Advanced Maryland Automatic Network Disk Archiver
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amanda.conf \- Main configuration file for \fIAmanda\fR, the Advanced Maryland Automatic Network Disk Archiver
 .SH "DESCRIPTION"
 .PP
-\fIamanda\.conf\fR
+\fBamanda.conf\fR(5)
 is the main configuration file for
-\fIAmanda\fR\. This manpage lists the relevant sections and parameters of this file for quick reference\.
+\fIAmanda\fR\&. This manpage lists the relevant sections and parameters of this file for quick reference\&.
 .PP
 The file
-\fB<CONFIG_DIR>/<config>/amanda\.conf\fR
-is loaded\.
-.SH "PARAMETERS"
+\fB<CONFIG_DIR>/<config>/amanda\&.conf\fR
+is loaded\&.
+.SH "SYNTAX"
 .PP
 There are a number of configuration parameters that control the behavior of the
 \fIAmanda\fR
-programs\. All have default values, so you need not specify the parameter in
-\fBamanda\.conf\fR
-if the default is suitable\.
+programs\&. All have default values, so you need not specify the parameter in
+\fBamanda\&.conf\fR
+if the default is suitable\&.
+.SS "COMMENTS"
 .PP
-Lines starting with # are ignored, as are blank lines\. Comments may be placed on a line with a directive by starting the comment with a #\. The remainder of the line is ignored\.
+Lines starting with # are ignored, as are blank lines\&. Comments may be placed on a line with a directive by starting the comment with a #\&. The remainder of the line is ignored\&.
+.SS "KEYWORDS AND IDENTIFIERS"
 .PP
-Keywords are case insensitive, i\.e\.
+Keywords are case insensitive, i\&.e\&.
 \fBmailto\fR
 and
 \fBMailTo\fR
-are treated the same\.
+are treated the same\&. Also, the characters
+\fB\'\-\'\fR
+and
+\fB\'_\'\fR
+are interchangeable in all predefined
+\fIAmanda\fR
+keywords:
+\fBdevice_property\fR
+and
+\fBdevice\-property\fR
+have the same meaning\&.
+.PP
+Identifiers are names which are defined in the configuration itself, such as dumptypes or interfaces\&. Identifiers are are case\-insensitive, but sensitive to
+\fB\'\-\'\fR
+vs\&.
+\fB\'_\'\fR\&. Identifiers should be quoted in the configuration file, although For historical reasons, the quotes are optional\&.
+.PP
+Strings are always quoted with double quotes ("), and any double quotes or backslashes within the string are escaped with a backslash:
+.sp
+.nf
+tapelist "/path/to/tapelist"
+property "escaped\-string" "escaping: \e\e (backslash) and \e" (double\-quote)"
+.fi
+.PP
+To summarize, then:
+.sp
+.nf
+                          # QUOTES        CASE            \-/_
+logdir "logs"             # required      sensitive       sensitive
+send\-amreport\-on strange  # prohibited    insensitive     insensitive
+tapetype "EXABYTE"        # optional      insensitive     sensitive
+
+define dumptype "dt" {    # optional      insensitive     sensitive
+  "dumptype\-common"       # optional      insensitive     sensitive
+  strategy noincr         # prohibited    insensitive     insensitive
+}
+.fi
+.SS "VALUE SUFFIXES"
 .PP
 Integer arguments may have one of the following (case insensitive) suffixes, some of which have a multiplier effect:
-.SS "POSSIBLE SUFFIXES"
 .PP
 \fBb byte bytes\fR
 .RS 4
-Some number of bytes\.
+Some number of bytes\&.
 .RE
 .PP
 \fBbps\fR
 .RS 4
-Some number of bytes per second\.
+Some number of bytes per second\&.
 .RE
 .PP
 \fBk kb kbyte kbytes kilobyte kilobytes\fR
 .RS 4
-Some number of kilobytes (bytes*1024)\.
+Some number of kilobytes (bytes*1024)\&.
 .RE
 .PP
 \fBkps kbps\fR
 .RS 4
-Some number of kilobytes per second (bytes*1024)\.
+Some number of kilobytes per second (bytes*1024)\&.
+.sp
+It is the default multiplier for all size options\&.
 .RE
 .PP
 \fBm mb meg mbyte mbytes megabyte megabytes\fR
 .RS 4
-Some number of megabytes (bytes*1024*1024)\.
+Some number of megabytes (bytes*1024*1024)\&.
 .RE
 .PP
 \fBmps mbps\fR
 .RS 4
-Some number of megabytes per second (bytes*1024*1024)\.
+Some number of megabytes per second (bytes*1024*1024)\&.
 .RE
 .PP
 \fBg gb gbyte gbytes gigabyte gigabytes\fR
 .RS 4
-Some number of gigabytes (bytes*1024*1024*1024)\.
+Some number of gigabytes (bytes*1024*1024*1024)\&.
 .RE
 .PP
 \fBtape tapes\fR
 .RS 4
-Some number of tapes\.
+Some number of tapes\&.
 .RE
 .PP
 \fBday days\fR
 .RS 4
-Some number of days\.
+Some number of days\&.
 .RE
 .PP
 \fBweek weeks\fR
 .RS 4
-Some number of weeks (days*7)\.
+Some number of weeks (days*7)\&.
+.if n \{\
 .sp
+.\}
+.RS 4
+.BM yellow
 .it 1 an-trap
 .nr an-no-space-flag 1
 .nr an-break-flag 1
 .br
-Note
+.ps +1
+\fBNote\fR
+.ps -1
+.br
 The value
 \fBinf\fR
-may be used in most places where an integer is expected to mean an infinite amount\.
+may be used in most places where an integer is expected to mean an infinite amount\&.
 .sp
 Boolean arguments may have any of the values
 \fBy\fR,
@@ -112,351 +315,419 @@ to indicate a true state, or
 \fBfalse\fR
 or
 \fBoff\fR
-to indicate a false state\. If no argument is given,
+to indicate a false state\&. If no argument is given,
 \fBtrue\fR
-is assumed\.
+is assumed\&.
+.sp .5v
+.EM yellow
 .RE
-.SS "PARAMETERS"
+.RE
+.SS "PARAMETER ORDER"
+.PP
+In general, the order in which parameters occur in the configuration file does not matter, with the exception of subsection inheritance\&. For example, if dumptype "normal\-encrypt" which inherits from dumptype "normal", then "normal" must appear first in the configuration file\&.
+.SS "STRINGS"
+.PP
+Quoted strings in Amanda follow a common, C\-like syntax\&. Printable characters and whitespace are kept as\-is, except that the backslash character (\e) is used as an escape character, and a double\-quote ends the string\&. The allowed escape sequences are
+.sp
+.nf
+    ESCAPE SEQUENCE     BECOMES
+    \e\e                  \e
+    \e"                  "
+    \en                  (newline)
+    \et                  (tab)
+    \er                  (carriage return)
+    \ef                  (form\-feed)
+    \e1 \- \e7
+    \e01 \- \e77
+    \e001 \- \e377         (character specified in octal)
+.fi
+Illegally quoted strings are handled on a "best\-effort" basis, which may lead to unexpected results\&.
+.PP
+Examples:
+.sp
+.nf
+finserver "/data/finance/XYZ Corp\'s \e"real\e" finances" finance\-high eth0 \-1
+property "syspath" "C:\e\eWINDOWS\e\eSYSTEM"
+.fi
+.SH "GLOBAL PARAMETERS"
 .PP
 \fBorg\fR \fI string\fR
 .RS 4
 Default:
-\fIdaily\fR\. A descriptive name for the configuration\. This string appears in the Subject line of mail reports\. Each
+\fIdaily\fR\&. A descriptive name for the configuration\&. This string appears in the Subject line of mail reports\&. Each
 \fIAmanda\fR
-configuration should have a different string to keep mail reports distinct\.
+configuration should have a different string to keep mail reports distinct\&.
+.RE
+.PP
+\fBmailer\fR \fI string\fR
+.RS 4
+Default found by configure\&. A mail program that can send mail with \'\fIMAILER \-s "subject" user < message_file\fR\'\&.
 .RE
 .PP
 \fBmailto\fR \fI string\fR
 .RS 4
 Default:
-\fIoperators\fR\. A space separated list of recipients for mail reports\.
+\fIoperators\fR\&. A space separated list of recipients for mail reports\&.
+.RE
+.PP
+\fBsend\-amreport\-on\fR [all|strange|error|never]
+.RS 4
+Default:
+\fBall\fR\&. Specify which types of messages will trigger an email from amreport\&. amreport is used by amdump and amflush\&.
+.PP
+\fBall\fR
+.RS 4
+Send an email on any message\&.
+.RE
+.PP
+\fBstrange\fR
+.RS 4
+Send an email on strange or error message\&. A strange message occurs when the dump succeeded, but returned one or more errors unknown to
+\fIAmanda\fR\&.
+.RE
+.PP
+\fBerror\fR
+.RS 4
+Send an email only on error messages\&.
+.RE
+.PP
+\fBnever\fR
+.RS 4
+Never send an email\&.
+.RE
 .RE
 .PP
 \fBdumpcycle\fR \fI int\fR
 .RS 4
 Default:
-\fI10 days\fR\. The number of days in the backup cycle\. Each disk will get a full backup at least this often\. Setting this to zero tries to do a full backup each run\.
+\fI10 days\fR\&. The number of days in the backup cycle\&. Each disk will get a full backup at least this often\&. Setting this to zero tries to do a full backup each run\&.
+.if n \{\
 .sp
+.\}
+.RS 4
+.BM yellow
 .it 1 an-trap
 .nr an-no-space-flag 1
 .nr an-break-flag 1
 .br
-Note
+.ps +1
+\fBNote\fR
+.ps -1
+.br
 This parameter may also be set in a specific
 \fBdumptype\fR
-(see below)\. This value sets the default for all
+(see below)\&. This value sets the default for all
 \fBdumptype\fRs so must appear in
-\fBamanda\.conf\fR
+\fBamanda\&.conf\fR
 before any
-\fBdumptype\fRs are defined\.
+\fBdumptype\fRs are defined\&.
+.sp .5v
+.EM yellow
+.RE
 .RE
 .PP
 \fBrunspercycle\fR \fI int\fR
 .RS 4
 Default:
-\fIsame as dumpcycle\fR\. The number of amdump runs in
+\fIsame as dumpcycle\fR\&. The number of amdump runs in
 \fBdumpcycle\fR
-days\. A value of 0 means the same value as
-\fBdumpcycle\fR\. A value of \-1 means guess the number of runs from the
-\fItapelist\fR
+days\&. A value of 0 means the same value as
+\fBdumpcycle\fR\&. A value of \-1 means guess the number of runs from the
+\fBtapelist\fR(5)
 file, which is the number of tapes used in the last
 \fBdumpcycle\fR
 days /
-\fBruntapes\fR\.
+\fBruntapes\fR\&.
 .RE
 .PP
 \fBtapecycle\fR \fI int\fR
 .RS 4
 Default:
-\fI15 tapes\fR\. Typically tapes are used by
+\fI15 tapes\fR\&. Typically tapes are used by
 \fIAmanda\fR
-in an ordered rotation\. The
+in an ordered rotation\&. The
 \fBtapecycle\fR
-parameter defines the size of that rotation\. The number of tapes in rotation must be larger than the number of tapes required for a complete dump cycle (see the
+parameter defines the size of that rotation\&. The number of tapes in rotation must be larger than the number of tapes required for a complete dump cycle (see the
 \fBdumpcycle\fR
-parameter)\.
+parameter)\&.
 .sp
 This is calculated by multiplying the number of
 \fBamdump\fR
 runs per dump cycle (\fBrunspercycle\fR
 parameter) times the number of tapes used per run (\fBruntapes\fR
-parameter)\. Typically two to four times this calculated number of tapes are in rotation\. While
+parameter)\&. Typically two to four times this calculated number of tapes are in rotation\&. While
 \fIAmanda\fR
 is always willing to use a new tape in its rotation, it refuses to reuse a tape until at least \'\fBtapecycle\fR
-\-1\' number of other tapes have been used\.
+\-1\' number of other tapes have been used\&.
 .sp
 It is considered good administrative practice to set the
 \fBtapecycle\fR
-parameter slightly lower than the actual number of tapes in rotation\. This allows the administrator to more easily cope with damaged or misplaced tapes or schedule adjustments that call for slight adjustments in the rotation order\.
+parameter slightly lower than the actual number of tapes in rotation\&. This allows the administrator to more easily cope with damaged or misplaced tapes or schedule adjustments that call for slight adjustments in the rotation order\&.
 .RE
 .PP
 \fBusetimestamps\fR \fI bool\fR
 .RS 4
 Default:
-\fBYes\fR\. This option allows Amanda to track multiple runs per calendar day\. The only reason one might disable it is that Amanda versions before 2\.5\.1 can\'t read logfiles written when this option was enabled\.
+\fBYes\fR\&. This option allows Amanda to track multiple runs per calendar day\&. The only reason one might disable it is that Amanda versions before 2\&.5\&.1 can\'t read logfiles written when this option was enabled\&.
 .RE
 .PP
 \fBlabel_new_tapes\fR \fI string\fR
 .RS 4
-Default: not set\. When set, this directive will cause
+Default: not set\&. When set, this directive will cause
 \fIAmanda\fR
 to automatically write an
 \fIAmanda\fR
-tape label to any blank tape she encounters\. This option is DANGEROUS because when set,
+tape label to any blank tape she encounters\&. This option is DANGEROUS because when set,
 \fIAmanda\fR
 will ERASE any non\-\fIAmanda\fR
-tapes you may have, and may also ERASE any near\-failing tapes\. Use with caution\.
+tapes you may have, and may also ERASE any near\-failing tapes\&. Use with caution\&.
 .sp
-When using this directive, specify the template for new tape labels\. The template should contain some number of contiguous \'%\' characters, which will be replaced with a generated number\. Be sure to specify enough \'%\' characters that you do not run out of tape labels\. Example:
+When using this directive, specify the template for new tape labels\&. The template should contain some number of contiguous \'%\' characters, which will be replaced with a generated number\&. Be sure to specify enough \'%\' characters that you do not run out of tape labels\&. Example:
 \fBlabel_new_tapes "DailySet1\-%%%"\fR
 .RE
 .PP
 \fBdumpuser\fR \fI string\fR
 .RS 4
 Default:
-\fIamanda\fR\. The login name
+\fIamanda\fR\&. The login name
 \fIAmanda\fR
-uses to run the backups\. The backup client hosts must allow access from the tape server host as this user via
-\fB\.rhosts\fR
+uses to run the backups\&. The backup client hosts must allow access from the tape server host as this user via
+\fB\&.rhosts\fR
 or
-\fB\.amandahosts\fR, depending on how the
+\fB\&.amandahosts\fR, depending on how the
 \fIAmanda\fR
-software was built\.
+software was built\&.
 .RE
 .PP
 \fBprinter\fR string
 .RS 4
-Printer to use when doing tape labels\. See the
+Printer to use when doing tape labels\&. See the
 \fBlbl\-templ\fR
 \fBtapetype\fR
-option\.
+option\&.
 .RE
 .PP
 \fBtapedev\fR string
 .RS 4
 Default:
-\fInull:\fR\. The path name of the non\-rewinding tape device\. Non\-rewinding tape device names often have an \'n\' in the name, e\.g\.
-\fI/dev/rmt/0mn\fR, however this is operating system specific and you should consult that documentation for detailed naming information\.
+\FCnull:\F[]\&. The device name, referencing the name of a "device" section in the configuration file\&. See
+\fBamanda-devices\fR(7)
+for more information on device names\&.
 .sp
 If a tape changer is configured (see the
 \fBtpchanger\fR
-option), this option might not be used\.
+option), this option might not be used\&.
 .sp
-If the
-\fBnull\fR
-output driver is selected (see the section OUTPUT DRIVERS in the
-\fBamanda\fR(8)
-manpage for more information), programs such as
+If
+\fBtapedev\fR
+is
+\fBnull:\fR, programs such as
 \fBamdump\fR
-will run normally but all images will be thrown away\. This should only be used for debugging and testing, and probably only with the
+will run normally but all images will be thrown away\&. This should only be used for debugging and testing, and probably only with the
 \fBrecord\fR
 option set to
-\fIno\fR\.
+\fIno\fR\&.
 .RE
 .PP
 \fBdevice_property\fR string string
 .RS 4
-These options can set various device properties, including block size, maximum volume usage, authentication information, hardware feature support, and more\.Specifics of how properties are used are device\-dependent, though some common properties are supported across multiple device drivers\.
-.sp
-Both strings are quoted; the first string contains the name of the property to set, and the second contains its value\. For example, to set a fixed block size of 128k, do:
+These options can set various device properties\&. See
+\fBamanda-devices\fR(7)
+for more information on device properties and their syntax\&. Both strings are always quoted; the first string contains the name of the property to set, and the second contains its value\&. For example, to set a fixed block size of 128k, write:
 .nf
-device_property "BLOCK_SIZE" "131072".fi
-.sp
-The order in which device properties are set is as follows:
-.sp
-.RS 4
-\h'-04' 1.\h'+02'Tapetype parameters, including length, blocksize, readblocksize, file\-pad, are translated into device properties and set accordingly\.
+device_property "BLOCK_SIZE" "128k"
+.fi
 .RE
-.sp
+.PP
+\fBproperty\fR [append] string string+
 .RS 4
-\h'-04' 2.\h'+02'Device properties from any device_property configuration directives are set, in the order they appear in the configuration file\.
-.RE
+These options can set various properties, they can be used by third party software to store information in the configuration file\&. Both strings are quoted; the first string contains the name of the property to set, and the others contains its values\&.
+\fBappend\fR
+keyword append the values to the list of values for that property\&.
 .RE
 .PP
 \fBtpchanger\fR string
 .RS 4
 Default:
-\fInone\fR\. The name of the tape changer\. If a tape changer is not configured, this option is not used and should be commented out of the configuration file\.
+\fInone\fR\&. The name of the tape changer\&. If a tape changer is not configured, this option is not used and should be commented out of the configuration file\&.
 .sp
-If a tape changer is configured, choose one of the changer scripts (e\.g\.
-\fBchg\-scsi\fR) and enter that here\.
+If a tape changer is configured, choose one of the changer scripts (e\&.g\&.
+\fBchg\-scsi\fR) and enter that here\&.
 .RE
 .PP
 \fBchangerdev\fR string
 .RS 4
 Default:
-\fI/dev/null\fR\. A tape changer configuration parameter\. Usage depends on the particular changer defined with the
+\FC/dev/null\F[]\&. A tape changer configuration parameter\&. Usage depends on the particular changer defined with the
 \fBtpchanger\fR
-option\.
+option\&.
 .RE
 .PP
 \fBchangerfile\fR string
 .RS 4
 Default:
-\fI/usr/adm/amanda/log/changer\-status\fR\. A tape changer configuration parameter\. Usage depends on the particular changer defined with the
+\FC/usr/adm/amanda/log/changer\-status\F[]\&. A tape changer configuration parameter\&. Usage depends on the particular changer defined with the
 \fBtpchanger\fR
-option\.
+option\&.
 .RE
 .PP
 \fBruntapes\fR int
 .RS 4
 Default:
-1\. The maximum number of tapes used in a single run\. If a tape changer is not configured, this option is not used and should be commented out of the configuration file\.
+\FC1\F[]\&. The maximum number of tapes used in a single run\&. If a tape changer is not configured, this option is not used and should be commented out of the configuration file\&.
 .sp
 If a tape changer is configured, this may be set larger than one to let
 \fIAmanda\fR
-write to more than one tape\.
+write to more than one tape\&.
 .sp
 Note that this is an upper bound on the number of tapes, and
 \fIAmanda\fR
-may use less\.
+may use less\&.
 .sp
 Also note that as of this release,
 \fIAmanda\fR
-does not support true tape overflow\. When it reaches the end of one tape, the backup image
+does not support true tape overflow\&. When it reaches the end of one tape, the backup image
 \fIAmanda\fR
-was processing starts over again on the next tape\.
+was processing starts over again on the next tape\&.
 .RE
 .PP
 \fBmaxdumpsize\fR int
 .RS 4
 Default:
-\fIruntapes\fR*\fItape_length\fR\. Maximum number of bytes the planner will schedule for a run\.
+\fIruntapes\fR*\fItape_length\fR\&. Maximum number of bytes the planner will schedule for a run\&.
+.sp
+The default unit is Kbytes if it is not specified\&.
 .RE
 .PP
 \fBtaperalgo\fR [first|firstfit|largest|largestfit|smallest|last]
 .RS 4
 Default:
-\fIfirst\fR\. The algorithm used to choose which dump image to send to the taper\.
+\fIfirst\fR\&. The algorithm used to choose which dump image to send to the taper\&.
 .PP
 \fBfirst\fR
 .RS 4
-First in, first out\.
+First in, first out\&.
 .RE
 .PP
 \fBfirstfit\fR
 .RS 4
-The first dump image that will fit on the current tape\.
+The first dump image that will fit on the current tape\&.
 .RE
 .PP
 \fBlargest\fR
 .RS 4
-The largest dump image\.
+The largest dump image\&.
 .RE
 .PP
 \fBlargestfit\fR
 .RS 4
-The largest dump image that will fit on the current tape\.
+The largest dump image that will fit on the current tape\&.
 .RE
 .PP
 \fBsmallest\fR
 .RS 4
-The smallest dump image\.
+The smallest dump image\&.
 .RE
 .PP
 \fBlast\fR
 .RS 4
-Last in, first out\.
+Last in, first out\&.
 .RE
 .RE
 .PP
 \fBlabelstr\fR \fI string\fR
 .RS 4
 Default:
-\fI\.*\fR\. The tape label constraint regular expression\. All tape labels generated (see
-\fBamlabel\fR(8)) and used by this configuration must match the regular expression\. If multiple configurations are run from the same tape server host, it is helpful to set their labels to different strings (for example, "DAILY[0\-9][0\-9]*" vs\. "ARCHIVE[0\-9][0\-9]*") to avoid overwriting each other\'s tapes\.
+\fI\&.*\fR\&. The tape label constraint regular expression\&. All tape labels generated (see
+\fBamlabel\fR(8)) and used by this configuration must match the regular expression\&. If multiple configurations are run from the same tape server host, it is helpful to set their labels to different strings (for example, "DAILY[0\-9][0\-9]*" vs\&. "ARCHIVE[0\-9][0\-9]*") to avoid overwriting each other\'s tapes\&.
 .RE
 .PP
-\fBtapetype\fR \fI string\fR
+\fBtapetype\fR \fI identifier\fR
 .RS 4
 Default:
-\fIEXABYTE\fR\. The type of tape drive associated with
+\fI"EXABYTE"\fR\&. The type of tape drive associated with
 \fBtapedev\fR
 or
-\fBtpchanger\fR\. This refers to one of the defined
+\fBtpchanger\fR\&. This refers to one of the defined
 \fBtapetype\fRs in the config file (see below), which specify various tape parameters, like the
 \fBlength\fR,
 \fBfilemark\fR
 size, and
 \fBspeed\fR
-of the tape media and device\.
-.sp
-First character of a
-\fBtapetype\fR
-string must be an alphabetic character
+of the tape media and device\&.
 .RE
 .PP
 \fBctimeout\fR int
 .RS 4
 Default:
-\fI30 seconds\fR\. Maximum amount of time that
+\fI30 seconds\fR\&. Maximum amount of time that
 \fBamcheck\fR
-will wait for each client host\.
+will wait for each client host\&.
 .RE
 .PP
 \fBdtimeout\fR int
 .RS 4
 Default:
-\fI1800 seconds\fR\. Amount of idle time per disk on a given client that a
+\fI1800 seconds\fR\&. Amount of idle time per disk on a given client that a
 \fBdumper\fR
 running from within
 \fBamdump\fR
-will wait before it fails with a data timeout error\.
+will wait before it fails with a data timeout error\&.
 .RE
 .PP
 \fBetimeout\fR int
 .RS 4
 Default:
-\fI300 seconds\fR\. Amount of time per estimate on a given client that the
+\fI300 seconds\fR\&. Amount of time per estimate on a given client that the
 \fBplanner\fR
 step of
 \fBamdump\fR
-will wait to get the dump size estimates (note: Amanda runs up to 3 estimates for each DLE)\. For instance, with the default of 300 seconds and four DLE\'s, each estimating level 0 and level 1 on client A,
+will wait to get the dump size estimates (note: Amanda runs up to 3 estimates for each DLE)\&. For instance, with the default of 300 seconds and four DLE\'s, each estimating level 0 and level 1 on client A,
 \fBplanner\fR
-will wait up to 40 minutes for that machine\. A negative value will be interpreted as a total amount of time to wait per client instead of per disk\.
+will wait up to 40 minutes for that machine\&. A negative value will be interpreted as a total amount of time to wait per client instead of per disk\&.
 .RE
 .PP
 \fBconnect_tries\fR int
 .RS 4
 Default:
-\fI3\fR\. How many times the server will try a connection\.
+\fI3\fR\&. How many times the server will try a connection\&.
 .RE
 .PP
 \fBreq_tries\fR int
 .RS 4
 Default:
-\fI3\fR\. How many times the server will resend a REQ packet if it doesn\'t get the ACK packet\.
+\fI3\fR\&. How many times the server will resend a REQ packet if it doesn\'t get the ACK packet\&.
 .RE
 .PP
 \fBnetusage\fR int
 .RS 4
 Default:
-\fI8000 Kbps\fR\. The maximum network bandwidth allocated to
-\fIAmanda\fR, in Kbytes per second\. See also the
+\fI8000 Kbps\fR\&. The maximum network bandwidth allocated to
+\fIAmanda\fR, in Kbytes per second\&. See also the
 \fBinterface\fR
-section\.
+section\&.
 .RE
 .PP
 \fBinparallel\fR int
 .RS 4
 Default:
-10\. The maximum number of backups that
+\FC10\F[]\&. The maximum number of backups that
 \fIAmanda\fR
-will attempt to run in parallel\.
+will attempt to run in parallel\&.
 \fIAmanda\fR
-will stay within the constraints of network bandwidth and holding disk space available, so it doesn\'t hurt to set this number a bit high\. Some contention can occur with larger numbers of backups, but this effect is relatively small on most systems\.
+will stay within the constraints of network bandwidth and holding disk space available, so it doesn\'t hurt to set this number a bit high\&. Some contention can occur with larger numbers of backups, but this effect is relatively small on most systems\&.
 .RE
 .PP
 \fBdisplayunit\fR "k|m|g|t"
 .RS 4
 Default:
-"k"\. The unit used to print many numbers, k=kilo, m=mega, g=giga, t=tera\.
+\FC"k"\F[]\&. The unit used to print many numbers, k=kilo, m=mega, g=giga, t=tera\&.
 .RE
 .PP
 \fBdumporder\fR string
 .RS 4
 Default:
-\fItttTTTTTTT\fR\. The priority order of each dumper:
+\fItttTTTTTTT\fR\&. The priority order of each dumper:
 .sp
 .nf
 s: smallest size
@@ -471,190 +742,200 @@ B: largest bandwidth
 \fBmaxdumps\fR int
 .RS 4
 Default:
-1\. The maximum number of backups from a single host that
+\FC1\F[]\&. The maximum number of backups from a single host that
 \fIAmanda\fR
-will attempt to run in parallel\. See also the
+will attempt to run in parallel\&. See also the
 \fBinparallel\fR
-option\.
+option\&.
 .sp
 Note that this parameter may also be set in a specific
 \fBdumptype\fR
-(see below)\. This value sets the default for all
+(see below)\&. This value sets the default for all
 \fBdumptype\fRs so must appear in
-\fBamanda\.conf\fR
+\fBamanda\&.conf\fR
 before any
-\fBdumptype\fRs are defined\.
+\fBdumptype\fRs are defined\&.
 .RE
 .PP
 \fBbumpsize\fR int
 .RS 4
 Default:
-\fI10 Mbytes\fR\. The minimum savings required to trigger an automatic bump from one incremental level to the next, expressed as size\. If
+\fI10 Mbytes\fR\&. The minimum savings required to trigger an automatic bump from one incremental level to the next, expressed as size\&. If
 \fIAmanda\fR
-determines that the next higher backup level will be this much smaller than the current level, it will do the next level\. The value of this parameter is used only if the parameter
+determines that the next higher backup level will be this much smaller than the current level, it will do the next level\&. The value of this parameter is used only if the parameter
 \fIbumppercent\fR
-is set to 0\.
+is set to 0\&.
+.sp
+The default unit is Kbytes if it is not specified\&.
 .sp
-The global setting of this parameter can be overwritten inside of a dumptype\-definition\.
+The global setting of this parameter can be overwritten inside of a dumptype\-definition\&.
 .sp
 See also the options
 \fBbumppercent\fR,
 \fBbumpmult\fR
 and
-\fBbumpdays\fR\.
+\fBbumpdays\fR\&.
 .RE
 .PP
 \fBbumppercent\fR int
 .RS 4
 Default:
-\fI0 percent\fR\. The minimum savings required to trigger an automatic bump from one incremental level to the next, expressed as percentage of the current size of the DLE (size of current level 0)\. If
+\fI0 percent\fR\&. The minimum savings required to trigger an automatic bump from one incremental level to the next, expressed as percentage of the current size of the DLE (size of current level 0)\&. If
 \fIAmanda\fR
-determines that the next higher backup level will be this much smaller than the current level, it will do the next level\.
+determines that the next higher backup level will be this much smaller than the current level, it will do the next level\&.
 .sp
 If this parameter is set to 0, the value of the parameter
 \fIbumpsize\fR
-is used to trigger bumping\.
+is used to trigger bumping\&.
 .sp
-The global setting of this parameter can be overwritten inside of a dumptype\-definition\.
+The global setting of this parameter can be overwritten inside of a dumptype\-definition\&.
 .sp
 See also the options
 \fBbumpsize\fR,
 \fBbumpmult\fR
 and
-\fBbumpdays\fR\.
+\fBbumpdays\fR\&.
 .RE
 .PP
 \fBbumpmult\fR \fI float\fR
 .RS 4
 Default:
-1\.5\. The bump size multiplier\.
+\FC1\&.5\F[]\&. The bump size multiplier\&.
 \fIAmanda\fR
 multiplies
 \fBbumpsize\fR
-by this factor for each level\. This prevents active filesystems from bumping too much by making it harder to bump to the next level\. For example, with the default
+by this factor for each level\&. This prevents active filesystems from bumping too much by making it harder to bump to the next level\&. For example, with the default
 \fBbumpsize\fR
 and
 \fBbumpmult\fR
-set to 2\.0, the bump threshold will be 10 Mbytes for level one, 20 Mbytes for level two, 40 Mbytes for level three, and so on\.
+set to 2\&.0, the bump threshold will be 10 Mbytes for level one, 20 Mbytes for level two, 40 Mbytes for level three, and so on\&.
 .sp
-The global setting of this parameter can be overwritten inside of a dumptype\-definition\.
+The global setting of this parameter can be overwritten inside of a dumptype\-definition\&.
 .RE
 .PP
 \fBbumpdays\fR \fI int\fR
 .RS 4
 Default:
-\fI2 days\fR\. To insure redundancy in the dumps,
+\fI2 days\fR\&. To insure redundancy in the dumps,
 \fIAmanda\fR
 keeps filesystems at the same incremental level for at least
 \fBbumpdays\fR
-days, even if the other bump threshold criteria are met\.
+days, even if the other bump threshold criteria are met\&.
 .sp
-The global setting of this parameter can be overwritten inside of a dumptype\-definition\.
+The global setting of this parameter can be overwritten inside of a dumptype\-definition\&.
 .RE
 .PP
 \fBdiskfile\fR \fI string\fR
 .RS 4
 Default:
-\fIdisklist\fR\. The file name for the
+\fIdisklist\fR\&. The file name for the
 \fIdisklist\fR
-file holding client hosts, disks and other client dumping information\.
+file holding client hosts, disks and other client dumping information\&.
 .RE
 .PP
 \fBinfofile\fR \fI string\fR
 .RS 4
 Default:
-\fI/usr/adm/amanda/curinfo\fR\. The file or directory name for the historical information database\. If
+\FC/usr/adm/amanda/curinfo\F[]\&. The file or directory name for the historical information database\&. If
 \fIAmanda\fR
-was configured to use DBM databases, this is the base file name for them\. If it was configured to use text formated databases (the default), this is the base directory and within here will be a directory per client, then a directory per disk, then a text file of data\.
+was configured to use DBM databases, this is the base file name for them\&. If it was configured to use text formated databases (the default), this is the base directory and within here will be a directory per client, then a directory per disk, then a text file of data\&.
 .RE
 .PP
 \fBlogdir\fR \fI string\fR
 .RS 4
 Default:
-\fI/usr/adm/amanda\fR\. The directory for the
+\FC/usr/adm/amanda\F[]\&. The directory for the
 \fBamdump\fR
 and
 \fBlog\fR
-files\.
+files\&.
 .RE
 .PP
 \fBindexdir\fR \fI string\fR
 .RS 4
 Default
-\fI/usr/adm/amanda/index\fR\. The directory where index files (backup image catalogues) are stored\. Index files are only generated for filesystems whose
+\FC/usr/adm/amanda/index\F[]\&. The directory where index files (backup image catalogues) are stored\&. Index files are only generated for filesystems whose
 \fBdumptype\fR
 has the
 \fBindex\fR
-option enabled\.
+option enabled\&.
 .RE
 .PP
 \fBtapelist\fR \fI string\fR
 .RS 4
 Default:
-\fItapelist\fR\. The file name for the active
-\fItapelist\fR
-file\.
+\fItapelist\fR\&. The file name for the active
+\fBtapelist\fR(5)\&.
 \fIAmanda\fR
-maintains this file with information about the active set of tapes\.
+maintains this file with information about the active set of tapes\&.
 .RE
 .PP
 \fBdevice_output_buffer_size\fR \fI int\fR
 .RS 4
 Default:
-640k\. Controls the amount of memory used by
+\FC1280k\F[]\&. Controls the amount of memory used by
 \fIAmanda\fR
-to hold data as it is read from the network or disk before it is written to the output device\. Higher values may be useful on fast tape drives and optical media\.
+to hold data as it is read from the network or disk before it is written to the output device\&. Higher values may be useful on fast tape drives and optical media\&.
+.sp
+The default unit is bytes if it is not specified\&.
 .RE
 .PP
 \fBtapebufs\fR \fI int\fR
 .RS 4
 Default:
-20\. This option is deprecated; use the
+\FC20\F[]\&. This option is deprecated; use the
 \fBdevice_output_buffer_size\fR
-directive instead\.
+directive instead\&.
 \fBtapebufs\fR
-works the same way, but the number specified is multiplied by the device blocksize prior to use\.
+works the same way, but the number specified is multiplied by the device blocksize prior to use\&.
 .RE
 .PP
 \fBreserve\fR \fI number\fR
 .RS 4
 Default:
-100\. The part of holding\-disk space that should be reserved for incremental backups if no tape is available, expressed as a percentage of the available holding\-disk space (0\-100)\. By default, when there is no tape to write to, degraded mode (incremental) backups will be performed to the holding disk\. If full backups should also be allowed in this case, the amount of holding disk space reserved for incrementals should be lowered\.
+\FC100\F[]\&. The part of holding\-disk space that should be reserved for incremental backups if no tape is available, expressed as a percentage of the available holding\-disk space (0\-100)\&. By default, when there is no tape to write to, degraded mode (incremental) backups will be performed to the holding disk\&. If full backups should also be allowed in this case, the amount of holding disk space reserved for incrementals should be lowered\&.
 .RE
 .PP
 \fBautoflush\fR \fI bool\fR
 .RS 4
 Default:
-\fIoff\fR\. Whether an amdump run will flush the dumps from holding disk to tape\.
+\fIoff\fR\&. Whether an amdump run will flush the dumps from holding disk to tape\&.
 .RE
 .PP
 \fBamrecover_do_fsf\fR \fI bool\fR
 .RS 4
 Default:
-\fIon\fR\. Amrecover will call amrestore with the \-f flag for faster positioning of the tape\.
+\fIon\fR\&. Amrecover will call amrestore with the \-f flag for faster positioning of the tape\&.
 .RE
 .PP
 \fBamrecover_check_label\fR \fI bool\fR
 .RS 4
 Default:
-\fIon\fR\. Amrecover will call amrestore with the \-l flag to check the label\.
+\fIon\fR\&. Amrecover will call amrestore with the \-l flag to check the label\&.
 .RE
 .PP
 \fBamrecover_changer\fR \fI string\fR
 .RS 4
-Default: \'\'\. Amrecover will use the changer if you use \'settape <string>\' and that string is the same as the amrecover_changer setting\.
+Default: \'\'\&. Amrecover will use the changer if you use \'settape <string>\' and that string is the same as the amrecover_changer setting\&.
 .RE
 .PP
 \fBcolumnspec\fR \fI string\fR
 .RS 4
 Defines the width of columns
 \fBamreport\fR
-should use\.
+should use\&.
 \fIString\fR
-is a comma (\',\') separated list of triples\. Each triple consists of three parts which are separated by a equal sign (\'=\') and a colon (\':\') (see the example)\. These three parts specify:
+is a comma (\',\') separated list of triples\&. Each triple consists of three parts which are separated by a equal sign (\'=\') and a colon (\':\') (see the example)\&. These three parts specify:
 .sp
 .RS 4
-\h'-04' 1.\h'+02'the name of the column, which may be:
+.ie n \{\
+\h'-04' 1.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP "  1." 4.2
+.\}
+the name of the column, which may be:
 .nf
        Compress (compression ratio)
        Disk (client disk name)
@@ -666,124 +947,138 @@ is a comma (\',\') separated list of triples\. Each triple consists of three par
        OutKB (output image size in KBytes)
        TapeRate (tape writing rate in KBytes/sec)
        TapeTime (total tape time in hours:minutes)
-       .fi
+.fi
 .RE
 .sp
 .RS 4
-\h'-04' 2.\h'+02'the amount of space to display before the column (used to get whitespace between columns)\.
+.ie n \{\
+\h'-04' 2.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP "  2." 4.2
+.\}
+the amount of space to display before the column (used to get whitespace between columns)\&.
 .sp
 .RE
 .sp
 .RS 4
-\h'-04' 3.\h'+02'the width of the column itself\. If set to a negative value, the width will be calculated on demand to fit the largest entry in this column\.
+.ie n \{\
+\h'-04' 3.\h'+01'\c
+.\}
+.el \{\
+.sp -1
+.IP "  3." 4.2
+.\}
+the width of the column itself\&. If set to a negative value, the width will be calculated on demand to fit the largest entry in this column\&.
 .RE
-.IP "" 4
+.RS 4
 Here is an example:
 .sp
 .nf
 columnspec "Disk=1:18,HostName=0:10,OutKB=1:7"
 .fi
 .sp
-The above will display the disk information in 18 characters and put one space before it\. The hostname column will be 10 characters wide with no space to the left\. The output KBytes column is seven characters wide with one space before it\.
+The above will display the disk information in 18 characters and put one space before it\&. The hostname column will be 10 characters wide with no space to the left\&. The output KBytes column is seven characters wide with one space before it\&.
 .RE
 .PP
 \fBincludefile\fR \fI string\fR
 .RS 4
 Default:
-\fInone\fR\. The name of an
+\fInone\fR\&. The name of an
 \fIAmanda\fR
-configuration file to include within the current file\. Useful for sharing dumptypes, tapetypes and interface definitions among several configurations\. Relative pathnames are relative to the configuration directory\.
+configuration file to include within the current file\&. Useful for sharing dumptypes, tapetypes and interface definitions among several configurations\&. Relative pathnames are relative to the configuration directory\&.
 .RE
 .PP
 \fBdebug_auth\fR int
 .RS 4
 Default:
-\fI0\fR\. Debug level of the auth module
+\fI0\fR\&. Debug level of the auth module
 .RE
 .PP
 \fBdebug_event\fR int
 .RS 4
 Default:
-\fI0\fR\. Debug level of the event module
+\fI0\fR\&. Debug level of the event module
 .RE
 .PP
 \fBdebug_holding\fR int
 .RS 4
 Default:
-\fI0\fR\. Debug level of the holdingdisk module
+\fI0\fR\&. Debug level of the holdingdisk module
 .RE
 .PP
 \fBdebug_protocol\fR int
 .RS 4
 Default:
-\fI0\fR\. Debug level of the protocol module
+\fI0\fR\&. Debug level of the protocol module
 .RE
 .PP
 \fBdebug_planner\fR int
 .RS 4
 Default:
-\fI0\fR\. Debug level of the planner process
+\fI0\fR\&. Debug level of the planner process
 .RE
 .PP
 \fBdebug_driver\fR int
 .RS 4
 Default:
-\fI0\fR\. Debug level of the driver process
+\fI0\fR\&. Debug level of the driver process
 .RE
 .PP
 \fBdebug_dumper\fR int
 .RS 4
 Default:
-\fI0\fR\. Debug level of the dumper process
+\fI0\fR\&. Debug level of the dumper process
 .RE
 .PP
 \fBdebug_chunker\fR int
 .RS 4
 Default:
-\fI0\fR\. Debug level of the chunker process
+\fI0\fR\&. Debug level of the chunker process
 .RE
 .PP
 \fBdebug_taper\fR int
 .RS 4
 Default:
-\fI0\fR\. Debug level of the taper process
+\fI0\fR\&. Debug level of the taper process
 .RE
 .PP
 \fBflush\-threshold\-dumped\fR int
 .RS 4
 Default:
-\fI0\fR\.
+\fI0\fR\&.
 \fIAmanda\fR
-will not begin writing data to a new volume until the amount of data on the holding disk is at least this percentage of the volume size\. In other words,
+will not begin writing data to a new volume until the amount of data on the holding disk is at least this percentage of the volume size\&. In other words,
 \fIAmanda\fR
 will not begin until the inequality
-h < t \(mu d
+h > t \(mu d
 is satisfied, where
 h
 is the amount of data on the holding disk,
 t
 is the capacity of a volume, and
 d
-is this parameter, expressed as a percentage\.
+is this parameter, expressed as a percentage\&. This parameter may be larger than 100%, for example to keep more recent dumps on the holding disk for faster recovery\&.
 .sp
-Needless to say, your holding disk must be big enough that this criterion could be satisfied\. If the holding disk cannot be used for a particular dump (because, for example, there is no remaining holding space) then
+Needless to say, your holding disk must be big enough that this criterion could be satisfied\&. If the holding disk cannot be used for a particular dump (because, for example, there is no remaining holding space) then
 \fIAmanda\fR
-will disregard the constraint specified by this setting and start a new volume anyway\. Once writing to a volume has begun, this constraint is not applied unless and until a new volume is needed\.
+will disregard the constraint specified by this setting and start a new volume anyway\&. Once writing to a volume has begun, this constraint is not applied unless and until a new volume is needed\&.
 .sp
 The value of this parameter may not exceed than that of the
 \fBflush\-threshold\-scheduled\fR
-parameter\.
+parameter\&.
 .RE
 .PP
 \fBflush\-threshold\-scheduled\fR int
 .RS 4
 Default:
-\fI0\fR\.
+\fI0\fR\&.
 \fIAmanda\fR
-will not begin writing data to a new volume until the sum of the amount of data on the holding disk and the estimated amount of data remaining to be dumped during this run is at least this percentage of the volume size\. In other words,
+will not begin writing data to a new volume until the sum of the amount of data on the holding disk and the estimated amount of data remaining to be dumped during this run is at least this percentage of the volume size\&. In other words,
 \fIAmanda\fR
 will not begin until the inequality
-h + s < t \(mu d
+h + s > t \(mu d
 is satisfied, where
 h
 is the amount of data on the holding disk,
@@ -792,279 +1087,265 @@ is the total amount of data scheduled for this run but not dumped yet,
 t
 is the capacity of a volume, and
 d
-is this parameter, expressed as a percentage\.
+is this parameter, expressed as a percentage\&. This parameter may be larger than 100%\&.
 .sp
-Needless to say, your holding disk must be big enough that this criterion could be satisfied\. If the holding disk cannot be used for a particular dump (because, for example, there is no remaining holding space) then
+Needless to say, your holding disk must be big enough that this criterion could be satisfied\&. If the holding disk cannot be used for a particular dump (because, for example, there is no remaining holding space) then
 \fIAmanda\fR
-will disregard the constraint specified by this setting and start a new volume anyway\. Once writing to a volume has begun, this constraint is not applied unless and until a new volume is needed\.
+will disregard the constraint specified by this setting and start a new volume anyway\&. Once writing to a volume has begun, this constraint is not applied unless and until a new volume is needed\&.
 .sp
 The value of this parameter may not be less than that of the
 \fBflush\-threshold\-dumped\fR
 or
 \fBtaperflush\fR
-parameters\.
+parameters\&.
 .RE
 .PP
 \fBtaperflush\fR int
 .RS 4
 Default:
-\fI0\fR\. At the end of a run,
+\fI0\fR\&. At the end of a run,
 \fIAmanda\fR
-will start a new tape to flush remaining data if there is more data on the holding disk at the end of a run than this setting allows; the amount is specified as a percentage of the capacity of a single volume\. In other words, at the end of a run,
+will start a new tape to flush remaining data if there is more data on the holding disk at the end of a run than this setting allows; the amount is specified as a percentage of the capacity of a single volume\&. In other words, at the end of a run,
 \fIAmanda\fR
 will begin a new tape if the inequality
-h < t \(mu f
+h > t \(mu f
 is satisfied, where
 h
 is the amount of data remaining on the holding disk from this or previous runs,
 t
 is the capacity of a volume, and
 f
-is this parameter, expressed as a percentage\.
+is this parameter, expressed as a percentage\&. This parameter may be greater than 100%\&.
 .sp
 The value of this parameter may not exceed that of the
 \fBflush\-threshold\-scheduled\fR
-parameter\.;
+parameter\&.;
 \fBautoflush\fR
 must be set to \'yes\' if
 \fBtaperflush\fR
-is greater than 0\.
+is greater than 0\&.
 .RE
 .PP
 \fBreserved\-udp\-port\fR int,int
 .RS 4
 Default: \-\-with\-udpportrange or
-\fI512,1023\fR\. Reserved udp port that will be used (bsd, bsdudp)\. Range is inclusive\.
+\fI512,1023\fR\&. Reserved udp port that will be used (bsd, bsdudp)\&. Range is inclusive\&.
 .RE
 .PP
 \fBreserved\-tcp\-port\fR int,int
 .RS 4
 Default: \-\-with\-low\-tcpportrange or
-\fI512,1023\fR\. Reserved tcp port that will be used (bsdtcp)\. Range is inclusive\.
+\fI512,1023\fR\&. Reserved tcp port that will be used (bsdtcp)\&. Range is inclusive\&.
 .RE
 .PP
 \fBunreserved\-tcp\-port\fR int,int
 .RS 4
 Default: \-\-with\-tcpportrange or
-\fI1024,65535\fR\. Unreserved tcp port that will be used (bsd, bsdudp)\. Range is inclusive\.
+\fI1024,65535\fR\&. Unreserved tcp port that will be used (bsd, bsdudp)\&. Range is inclusive\&.
 .RE
 .SH "HOLDINGDISK SECTION"
 .PP
 The
-\fBamanda\.conf\fR
-file may define one or more holding disks used as buffers to hold backup images before they are written to tape\. The syntax is:
+\fBamanda\&.conf\fR
+file may define one or more holding disks used as buffers to hold backup images before they are written to tape\&. The syntax is:
 .nf
 holdingdisk \fIname\fR {
     \fIholdingdisk\-option\fR \fIholdingdisk\-value\fR
-    \.\.\.
+    \FC\&.\&.\&.\F[]
 }
 .fi
 .PP
 \fIName\fR
-is a logical name for this holding disk\.
+is a logical name for this holding disk\&.
 .PP
 The options and values are:
 .PP
 \fBcomment\fR \fI string\fR
 .RS 4
 Default:
-\fInone\fR\. A comment string describing this holding disk\.
+\fInone\fR\&. A comment string describing this holding disk\&.
 .RE
 .PP
 \fBdirectory\fR \fI disk\fR
 .RS 4
 Default:
-\fI/dumps/amanda\fR\. The path to this holding area\.
+\FC/dumps/amanda\F[]\&. The path to this holding area\&.
 .RE
 .PP
 \fBuse\fR \fI int\fR
 .RS 4
 Default:
-\fI0 Gb\fR\. Amount of space that can be used in this holding disk area\. If the value is zero, all available space on the file system is used\. If the value is negative,
+\fI0 Gb\fR\&. Amount of space that can be used in this holding disk area\&. If the value is zero, all available space on the file system is used\&. If the value is negative,
 \fIAmanda\fR
-will use all available space minus that value\.
+will use all available space minus that value\&.
 .RE
 .PP
 \fBchunksize\fR \fI int\fR
 .RS 4
 Default:
-\fI1 Gb\fR\. Holding disk chunk size\. Dumps larger than the specified size will be stored in multiple holding disk files\. The size of each chunk will not exceed the specified value\. However, even though dump images are split in the holding disk, they are concatenated as they are written to tape, so each dump image still corresponds to a single continuous tape section\.
+\fI1 Gb\fR\&. Holding disk chunk size\&. Dumps larger than the specified size will be stored in multiple holding disk files\&. The size of each chunk will not exceed the specified value\&. However, even though dump images are split in the holding disk, they are concatenated as they are written to tape, so each dump image still corresponds to a single continuous tape section\&.
+.sp
+The default unit is Kbytes if it is not specified\&.
 .sp
 If 0 is specified,
 \fIAmanda\fR
-will create holding disk chunks as large as ((INT_MAX/1024)\-64) Kbytes\.
+will create holding disk chunks as large as ((INT_MAX/1024)\-64) Kbytes\&.
 .sp
-Each holding disk chunk includes a 32 Kbyte header, so the minimum chunk size is 64 Kbytes (but that would be really silly)\.
+Each holding disk chunk includes a 32 Kbyte header, so the minimum chunk size is 64 Kbytes (but that would be really silly)\&.
 .sp
-Operating systems that are limited to a maximum file size of 2 Gbytes actually cannot handle files that large\. They must be at least one byte less than 2 Gbytes\. Since
+Operating systems that are limited to a maximum file size of 2 Gbytes actually cannot handle files that large\&. They must be at least one byte less than 2 Gbytes\&. Since
 \fIAmanda\fR
-works with 32 Kbyte blocks, and to handle the final read at the end of the chunk, the chunk size should be at least 64 Kbytes (2 * 32 Kbytes) smaller than the maximum file size, e\.g\. 2047 Mbytes\.
+works with 32 Kbyte blocks, and to handle the final read at the end of the chunk, the chunk size should be at least 64 Kbytes (2 * 32 Kbytes) smaller than the maximum file size, e\&.g\&. 2047 Mbytes\&.
 .RE
 .SH "DUMPTYPE SECTION"
 .PP
 The
-\fIamanda\.conf\fR
+\fBamanda.conf\fR(5)
 file may define multiple sets of backup options and refer to them by name from the
-\fIdisklist\fR
-file\. For instance, one set of options might be defined for file systems that can benefit from high compression, another set that does not compress well, another set for file systems that should always get a full backup and so on\.
+\fBdisklist\fR(5)
+file\&. For instance, one set of options might be defined for file systems that can benefit from high compression, another set that does not compress well, another set for file systems that should always get a full backup and so on\&.
 .PP
 A set of backup options are entered in a
 \fBdumptype\fR
 section, which looks like this:
 .nf
-define dumptype \fIname\fR {
+define dumptype "\fIname\fR" {
     \fIdumptype\-option\fR \fIdumptype\-value\fR
-    \.\.\.
+    \FC\&.\&.\&.\F[]
 }
 .fi
 .PP
 \fIName\fR
-is the name of this set of backup options\. It is referenced from the
-\fIdisklist\fR
-file\.
+is the name of this set of backup options\&. It is referenced from the
+\fBdisklist\fR(5)
+file\&.
 .PP
 Some of the options in a
 \fBdumptype\fR
 section are the same as those in the main part of
-\fIamanda\.conf\fR\. The main option value is used to set the default for all
+\fBamanda.conf\fR(5)\&. The main option value is used to set the default for all
 \fBdumptype\fR
-sections\. For instance, setting
+sections\&. For instance, setting
 \fBdumpcycle\fR
 to 50 in the main part of the config file causes all following
 \fBdumptype\fR
-sections to start with that value, but the value may be changed on a section by section basis\. Changes to variables in the main part of the config file must be done before (earlier in the file) any
-\fBdumptype\fRs are defined\.
+sections to start with that value, but the value may be changed on a section by section basis\&. Changes to variables in the main part of the config file must be done before (earlier in the file) any
+\fBdumptype\fRs are defined\&.
 .PP
 The dumptype options and values are:
 .PP
 \fBauth\fR \fI string\fR
 .RS 4
 Default:
-\fIbsd\fR\. Type of authorization to perform between tape server and backup client hosts\.
-.sp
-\fBbsd\fR, bsd authorization with udp initial connection and one tcp connection by data stream\.
-.sp
-\fBbsdtcp\fR, bsd authorization but use only one tcp connection\.
-.sp
-\fBbsdudp\fR, like bsd, but will use only one tcp connection for all data stream\.
-.sp
-\fBkrb4\fR
-to use Kerberos\-IV authorization\.
-.sp
-\fBkrb5\fR
-to use Kerberos\-V authorization\.
-.sp
-\fBlocal\fR, if the client is the server, it doesn\'t require authencation setup\.
-.sp
-\fBrsh\fR
-to use rsh authorization\.
-.sp
-\fBssh\fR
-to use OpenSSH authorization\.
+\fIbsd\fR\&. Type of authorization to perform between tape server and backup client hosts\&. See
+\fBamanda-auth\fR(7)
+for more detail\&.
 .RE
 .PP
 \fBamandad_path\fR \fI string\fR
 .RS 4
 Default:
-\fI$libexec/amandad\fR\. Specify the amandad path of the client, only use with rsh/ssh authentification\.
+\fI$libexec/amandad\fR\&. Specify the amandad path of the client, only use with rsh/ssh authentification\&.
 .RE
 .PP
 \fBclient_username\fR \fI string\fR
 .RS 4
 Default:
-\fICLIENT_LOGIN\fR\. Specify the username to connect on the client, only use with rsh/ssh authentification\.
+\fICLIENT_LOGIN\fR\&. Specify the username to connect on the client, only use with rsh/ssh authentification\&.
 .RE
 .PP
 \fBbumpsize\fR int
 .RS 4
 Default:
-\fI10 Mbytes\fR\. The minimum savings required to trigger an automatic bump from one incremental level to the next, expressed as size\. If
+\fI10 Mbytes\fR\&. The minimum savings required to trigger an automatic bump from one incremental level to the next, expressed as size\&. If
 \fIAmanda\fR
-determines that the next higher backup level will be this much smaller than the current level, it will do the next level\. The value of this parameter is used only if the parameter
+determines that the next higher backup level will be this much smaller than the current level, it will do the next level\&. The value of this parameter is used only if the parameter
 \fIbumppercent\fR
-is set to 0\.
+is set to 0\&.
+.sp
+The default unit is Kbytes if it is not specified\&.
 .sp
 See also the options
 \fBbumppercent\fR,
 \fBbumpmult\fR
 and
-\fBbumpdays\fR\.
+\fBbumpdays\fR\&.
 .RE
 .PP
 \fBbumppercent\fR int
 .RS 4
 Default:
-\fI0 percent\fR\. The minimum savings required to trigger an automatic bump from one incremental level to the next, expressed as percentage of the current size of the DLE (size of current level 0)\. If
+\fI0 percent\fR\&. The minimum savings required to trigger an automatic bump from one incremental level to the next, expressed as percentage of the current size of the DLE (size of current level 0)\&. If
 \fIAmanda\fR
-determines that the next higher backup level will be this much smaller than the current level, it will do the next level\.
+determines that the next higher backup level will be this much smaller than the current level, it will do the next level\&.
 .sp
 If this parameter is set to 0, the value of the parameter
 \fIbumpsize\fR
-is used to trigger bumping\.
+is used to trigger bumping\&.
 .sp
 See also the options
 \fBbumpsize\fR,
 \fBbumpmult\fR
 and
-\fBbumpdays\fR\.
+\fBbumpdays\fR\&.
 .RE
 .PP
 \fBbumpmult\fR \fI float\fR
 .RS 4
 Default:
-1\.5\. The bump size multiplier\.
+\FC1\&.5\F[]\&. The bump size multiplier\&.
 \fIAmanda\fR
 multiplies
 \fBbumpsize\fR
-by this factor for each level\. This prevents active filesystems from bumping too much by making it harder to bump to the next level\. For example, with the default
+by this factor for each level\&. This prevents active filesystems from bumping too much by making it harder to bump to the next level\&. For example, with the default
 \fBbumpsize\fR
 and
 \fBbumpmult\fR
-set to 2\.0, the bump threshold will be 10 Mbytes for level one, 20 Mbytes for level two, 40 Mbytes for level three, and so on\.
+set to 2\&.0, the bump threshold will be 10 Mbytes for level one, 20 Mbytes for level two, 40 Mbytes for level three, and so on\&.
 .RE
 .PP
 \fBbumpdays\fR \fI int\fR
 .RS 4
 Default:
-\fI2 days\fR\. To insure redundancy in the dumps,
+\fI2 days\fR\&. To insure redundancy in the dumps,
 \fIAmanda\fR
 keeps filesystems at the same incremental level for at least
 \fBbumpdays\fR
-days, even if the other bump threshold criteria are met\.
+days, even if the other bump threshold criteria are met\&.
 .RE
 .PP
 \fBcomment\fR \fI string\fR
 .RS 4
 Default:
-\fInone\fR\. A comment string describing this set of backup options\.
+\fInone\fR\&. A comment string describing this set of backup options\&.
 .RE
 .PP
 \fBcomprate\fR \fIfloat\fR [, \fIfloat\fR ]
 .RS 4
 Default:
-0\.50,
-0\.50\. The expected full and incremental compression factor for dumps\. It is only used if
+\FC0\&.50\F[],
+\FC0\&.50\F[]\&. The expected full and incremental compression factor for dumps\&. It is only used if
 \fIAmanda\fR
-does not have any history information on compression rates for a filesystem, so should not usually need to be set\. However, it may be useful for the first time a very large filesystem that compresses very little is backed up\.
+does not have any history information on compression rates for a filesystem, so should not usually need to be set\&. However, it may be useful for the first time a very large filesystem that compresses very little is backed up\&.
 .RE
 .PP
 \fBcompress [client|server]\fR \fI string\fR
 .RS 4
 Default:
-\fIclient fast\fR\. If
+\fIclient fast\fR\&. If
 \fIAmanda\fR
-does compression of the backup images, it can do so either on the backup client host before it crosses the network or on the tape server host as it goes from the network into the holding disk or to tape\. Which place to do compression (if at all) depends on how well the dump image usually compresses, the speed and load on the client or server, network capacity, holding disk capacity, availability of tape hardware compression, etc\.
+does compression of the backup images, it can do so either on the backup client host before it crosses the network or on the tape server host as it goes from the network into the holding disk or to tape\&. Which place to do compression (if at all) depends on how well the dump image usually compresses, the speed and load on the client or server, network capacity, holding disk capacity, availability of tape hardware compression, etc\&.
 .sp
 For either type of compression,
 \fIAmanda\fR
-also allows the selection of three styles of compression\.
+also allows the selection of three styles of compression\&.
 \fBBest\fR
-is the best compression available, often at the expense of CPU overhead\.
+is the best compression available, often at the expense of CPU overhead\&.
 \fBFast\fR
 is often not as good a compression as
-\fBbest\fR, but usually less CPU overhead\. Or to specify
+\fBbest\fR, but usually less CPU overhead\&. Or to specify
 \fBCustom\fR
-to use your own compression method\. (See dumptype custom\-compress in example/amanda\.conf for reference)
+to use your own compression method\&. (See dumptype custom\-compress in example/amanda\&.conf for reference)
 .sp
 So the
 \fBcompress\fR
@@ -1088,7 +1369,7 @@ Specify
 \fIclient_custom_compress\fR
 "PROG"
 .sp
-PROG must not contain white space and it must accept \-d for uncompress\.
+PROG must not contain white space and it must accept \-d for uncompress\&.
 .RE
 .PP
 compress server fast
@@ -1105,26 +1386,26 @@ Specify
 \fIserver_custom_compress\fR
 "PROG"
 .sp
-PROG must not contain white space and it must accept \-d for uncompress\.
+PROG must not contain white space and it must accept \-d for uncompress\&.
 .RE
 .sp
-Note that some tape devices do compression and this option has nothing to do with whether that is used\. If hardware compression is used (usually via a particular tape device name or
+Note that some tape devices do compression and this option has nothing to do with whether that is used\&. If hardware compression is used (usually via a particular tape device name or
 \fBmt\fR
 option),
 \fIAmanda\fR
-(software) compression should be disabled\.
+(software) compression should be disabled\&.
 .RE
 .PP
 \fBdumpcycle\fR \fI int\fR
 .RS 4
 Default:
-\fI10 days\fR\. The number of days in the backup cycle\. Each disk using this set of options will get a full backup at least this of ten\. Setting this to zero tries to do a full backup each run\.
+\fI10 days\fR\&. The number of days in the backup cycle\&. Each disk using this set of options will get a full backup at least this of ten\&. Setting this to zero tries to do a full backup each run\&.
 .RE
 .PP
 \fBencrypt [none|client|server]\fR
 .RS 4
 Default:
-\fInone\fR\. To encrypt backup images, it can do so either on the backup client host before it crosses the network or on the tape server host as it goes from the network into the holding disk or to tape\.
+\fInone\fR\&. To encrypt backup images, it can do so either on the backup client host before it crosses the network or on the tape server host as it goes from the network into the holding disk or to tape\&.
 .sp
 So the
 \fBencrypt\fR
@@ -1138,88 +1419,88 @@ encrypt client
 .RS 4
 Specify client_encrypt "PROG"
 .sp
-PROG must not contain white space\.
+PROG must not contain white space\&.
 .sp
 Specify client_decrypt_option "decryption\-parameter" Default: "\-d"
 .sp
-decryption\-parameter must not contain white space\.
+decryption\-parameter must not contain white space\&.
 .sp
-(See dumptype server\-encrypt\-fast in example/amanda\.conf for reference)
+(See dumptype client\-encrypt\-nocomp in example/amanda\&.conf for reference)
 .RE
 .PP
 encrypt server
 .RS 4
 Specify server_encrypt "PROG"
 .sp
-PROG must not contain white space\.
+PROG must not contain white space\&.
 .sp
 Specify server_decrypt_option "decryption\-parameter" Default: "\-d"
 .sp
-decryption\-parameter must not contain white space\.
+decryption\-parameter must not contain white space\&.
 .sp
-(See dumptype client\-encrypt\-nocomp in example/amanda\.conf for reference)
+(See dumptype server\-encrypt\-fast in example/amanda\&.conf for reference)
 .RE
 .sp
-Note that current logic assumes compression then encryption during backup(thus decrypt then uncompress during restore)\. So specifying client\-encryption AND server\-compression is not supported\.
+Note that current logic assumes compression then encryption during backup(thus decrypt then uncompress during restore)\&. So specifying client\-encryption AND server\-compression is not supported\&.
 \fIamcrypt\fR
 which is a wrapper of
 \fIaespipe\fR
-is provided as a reference symmetric encryption program\.
+is provided as a reference symmetric encryption program\&.
 .RE
 .PP
 \fBestimate\fR \fIclient|calcsize|server\fR
 .RS 4
 Default:
-\fIclient\fR\. Determine the way
+\fIclient\fR\&. Determine the way
 \fIAmanda\fR
-does it\'s estimate\.
+does it\'s estimate\&.
 .PP
 client
 .RS 4
-Use the same program as the dumping program, this is the most accurate way to do estimates, but it can take a long time\.
+Use the same program as the dumping program, this is the most accurate way to do estimates, but it can take a long time\&.
 .RE
 .PP
 calcsize
 .RS 4
-Use a faster program to do estimates, but the result is less accurate\.
+Use a faster program to do estimates, but the result is less accurate\&.
 .RE
 .PP
 server
 .RS 4
-Use only statistics from the previous run to give an estimate, it takes only a few seconds but the result is not accurate if your disk usage changes from day to day\.
+Use only statistics from the previous run to give an estimate, it takes only a few seconds but the result is not accurate if your disk usage changes from day to day\&.
 .RE
 .RE
 .PP
 \fBexclude\fR [ list|file ][[optional][ append ][ \fIstring\fR ]+]
 .RS 4
 Default:
-\fIfile\fR\. There are two exclude lists,
+\fIfile\fR\&. There are two exclude lists,
 \fBexclude file\fR
 and
-\fBexclude list\.\fR
+\fBexclude list\&.\fR
 With
 \fBexclude file\fR
 , the
 \fIstring\fR
 is a
 \fBGNU\-tar\fR
-exclude expression\. With
+exclude expression\&. With
 \fBexclude list\fR
 , the
 \fIstring\fR
 is a file name on the client containing
 \fBGNU\-tar\fR
-exclude expressions\. The path to the specified exclude list file, if present (see description of \'optional\' below), must be readable by the
+exclude expressions\&. The path to the specified exclude list file, if present (see description of \'optional\' below), must be readable by the
 \fIAmanda\fR
-user\.
+user\&.
 .sp
 All exclude expressions are concatenated in one file and passed to
 \fBGNU\-tar\fR
 as an
 \fB\-\-exclude\-from\fR
-argument\.
+argument\&.
 .sp
-Exclude expressions must always be specified as relative to the head directory of the DLE\.
+Exclude expressions must always be specified as relative to the head directory of the DLE\&.
 .sp
 With the
 \fBappend\fR
@@ -1227,260 +1508,304 @@ keyword, the
 \fIstring\fR
 is appended to the current list, without it, the
 \fIstring\fR
-overwrites the list\.
+overwrites the list\&.
 .sp
 If
 \fBoptional\fR
 is specified for
-\fBexclude list\fR, then amcheck will not complain if the file doesn\'t exist or is not readable\.
+\fBexclude list\fR, then amcheck will not complain if the file doesn\'t exist or is not readable\&.
 .sp
 For
-\fBexclude list\fR, if the file name is relative, the disk name being backed up is prepended\. So if this is entered:
+\fBexclude list\fR, if the file name is relative, the disk name being backed up is prepended\&. So if this is entered:
 .nf
-    exclude list "\.amanda\.excludes"
+    exclude list "\&.amanda\&.excludes"
 .fi
 the actual file used would be
-\fI/var/\.amanda\.excludes\fR
+\FC/var/\&.amanda\&.excludes\F[]
 for a backup of
-\fI/var\fR,
-\fI/usr/local/\.amanda\.excludes\fR
+\FC/var\F[],
+\FC/usr/local/\&.amanda\&.excludes\F[]
 for a backup of
-\fI/usr/local\fR, and so on\.
+\FC/usr/local\F[], and so on\&.
 .RE
 .PP
 \fBholdingdisk\fR [ never|auto|required ]
 .RS 4
 Default:
-\fIauto\fR\. Whether a holding disk should be used for these backups or whether they should go directly to tape\. If the holding disk is a portion of another file system that
+\fIauto\fR\&. Whether a holding disk should be used for these backups or whether they should go directly to tape\&. If the holding disk is a portion of another file system that
 \fIAmanda\fR
 is backing up, that file system should refer to a dumptype with
 \fBholdingdisk\fR
 set to
 \fInever\fR
-to avoid backing up the holding disk into itself\.
+to avoid backing up the holding disk into itself\&.
 .PP
 \fBnever\fR|no|false|off
 .RS 4
-Never use a holdingdisk, the dump will always go directly to tape\. There will be no dump if you have a tape error\.
+Never use a holdingdisk, the dump will always go directly to tape\&. There will be no dump if you have a tape error\&.
 .RE
 .PP
 \fBauto\fR|yes|true|on
 .RS 4
-Use the holding disk, unless there is a problem with the holding disk, the dump won\'t fit there or the medium doesn\'t require spooling (e\.g\., VFS device)
+Use the holding disk, unless there is a problem with the holding disk, the dump won\'t fit there or the medium doesn\'t require spooling (e\&.g\&., VFS device)
 .RE
 .PP
 \fBrequired\fR
 .RS 4
-Always dump to holdingdisk, never directly to tape\. There will be no dump if it doesn\'t fit on holdingdisk
+Always dump to holdingdisk, never directly to tape\&. There will be no dump if it doesn\'t fit on holdingdisk
 .RE
 .RE
 .PP
 \fBignore\fR \fI boolean\fR
 .RS 4
 Default:
-\fIno\fR\. Whether disks associated with this backup type should be backed up or not\. This option is useful when the
+\fIno\fR\&. Whether disks associated with this backup type should be backed up or not\&. This option is useful when the
 \fIdisklist\fR
-file is shared among several configurations, some of which should not back up all the listed file systems\.
+file is shared among several configurations, some of which should not back up all the listed file systems\&.
 .RE
 .PP
 \fBinclude\fR [ list|file ][[optional][ append ][ \fIstring\fR ]+]
 .RS 4
 Default:
 \fIfile\fR
-"\."\. There are two include lists,
+"\&."\&. There are two include lists,
 \fBinclude file\fR
 and
-\fBinclude list\.\fR
+\fBinclude list\&.\fR
 With
 \fBinclude file\fR
 , the
 \fIstring\fR
-is a glob expression\. With
+is a glob expression\&. With
 \fBinclude list\fR
 , the
 \fIstring\fR
-is a file name on the client containing glob expressions\.
+is a file name on the client containing glob expressions\&.
 .sp
 All include expressions are expanded by
 \fIAmanda\fR, concatenated in one file and passed to
 \fBGNU\-tar\fR
 as a
 \fB\-\-files\-from\fR
-argument\. They must start with "\./" and contain no other "/"\.
+argument\&. They must start with "\&./" and contain no other "/"\&.
 .sp
-Include expressions must always be specified as relative to the head directory of the DLE\.
+Include expressions must always be specified as relative to the head directory of the DLE\&.
+.if n \{\
 .sp
+.\}
+.RS 4
+.BM yellow
 .it 1 an-trap
 .nr an-no-space-flag 1
 .nr an-break-flag 1
 .br
-Note
+.ps +1
+\fBNote\fR
+.ps -1
+.br
 For globbing to work at all, even the limited single level, the top level directory of the DLE must be readable by the
 \fIAmanda\fR
-user\.
-
+user\&.
+.sp .5v
+.EM yellow
+.RE
 With the
 \fBappend\fR
 keyword, the
 \fIstring\fR
 is appended to the current list, without it, the
 \fIstring\fR
-overwrites the list\.
+overwrites the list\&.
 .sp
 If
 \fBoptional\fR
 is specified for
 \fBinclude list,\fR
-then amcheck will not complain if the file doesn\'t exist or is not readable\.
+then amcheck will not complain if the file doesn\'t exist or is not readable\&.
 .sp
 For
-\fBinclude list\fR, If the file name is relative, the disk name being backed up is prepended\.
+\fBinclude list\fR, If the file name is relative, the disk name being backed up is prepended\&.
 .RE
 .PP
 \fBindex\fR \fI boolean\fR
 .RS 4
 Default:
-\fIno\fR\. Whether an index (catalogue) of the backup should be generated and saved in
-\fBindexdir\fR\. These catalogues are used by the
+\fIno\fR\&. Whether an index (catalogue) of the backup should be generated and saved in
+\fBindexdir\fR\&. These catalogues are used by the
 \fBamrecover\fR
-utility\.
+utility\&.
 .RE
 .PP
 \fBkencrypt\fR \fI boolean\fR
 .RS 4
 Default:
-\fIno\fR\. Whether the backup image should be encrypted by Kerberos as it is sent across the network from the backup client host to the tape server host\.
+\fIno\fR\&. Whether the backup image should be encrypted by Kerberos as it is sent across the network from the backup client host to the tape server host\&.
 .RE
 .PP
 \fBmaxdumps\fR \fI int\fR
 .RS 4
 Default:
-1\. The maximum number of backups from a single host that
+\FC1\F[]\&. The maximum number of backups from a single host that
 \fIAmanda\fR
-will attempt to run in parallel\. See also the main section parameter
-\fBinparallel\fR\.
+will attempt to run in parallel\&. See also the main section parameter
+\fBinparallel\fR\&.
 .RE
 .PP
 \fBmaxpromoteday\fR \fI int\fR
 .RS 4
 Default:
-10000\. The maximum number of day for a promotion, set it 0 if you don\'t want promotion, set it to 1 or 2 if your disks get overpromoted\.
+\FC10000\F[]\&. The maximum number of day for a promotion, set it 0 if you don\'t want promotion, set it to 1 or 2 if your disks get overpromoted\&.
 .RE
 .PP
 \fBpriority\fR \fI string\fR
 .RS 4
 Default:
-\fImedium\fR\. When there is no tape to write to,
+\fImedium\fR\&. When there is no tape to write to,
 \fIAmanda\fR
-will do incremental backups in priority order to the holding disk\. The priority may be high (2), medium (1), low (0) or a number of your choice\.
+will do incremental backups in priority order to the holding disk\&. The priority may be high (2), medium (1), low (0) or a number of your choice\&.
 .RE
 .PP
-\fBprogram\fR \fI string\fR
+\fBprogram\fR [DUMP|GNUTAR|APPLICATION]
 .RS 4
 Default:
-\fIDUMP\fR\. The type of backup to perform\. Valid values are
+\fIDUMP\fR\&. The type of backup to perform\&. Valid values are:
+.PP
 \fBDUMP\fR
-for the native operating system backup program, and
+.RS 4
+The native operating system backup program\&.
+.RE
+.PP
 \fBGNUTAR\fR
-to use
-\fBGNU\-tar\fR
-or to do PC backups using Samba\.
+.RS 4
+To use GNU\-tar or to do PC backups using Samba\&.
+.RE
+.PP
+\fBAPPLICATION\fR
+.RS 4
+To use an application\-tool, see the
+\fIapplication\fR
+option\&.
+.RE
+.RE
+.PP
+\fBapplication\fR \fI string\fR
+.RS 4
+No default\&. Must be the name of an application\-tool if
+\fIprogram\fR
+is set to
+\fIAPPLICATION\fR\&. See APPLICATION SECTION below\&.
+.RE
+.PP
+\fBscript\fR \fI string\fR
+.RS 4
+No default\&. Must be the name of a script\-tool\&. You can have many script\&. See SCRIPT SECTION below\&.
+.RE
+.PP
+\fBproperty\fR [append] \fIstring\fR \fIstring\fR+
+.RS 4
+These options can set various properties, they can be used by third party software to store information in the configuration file\&. Both strings are quoted; the first string contains the name of the property to set, and the others contains its values\&.
+\fBappend\fR
+keyword append the values to the list of values for that property\&.
 .RE
 .PP
 \fBrecord\fR \fI boolean\fR
 .RS 4
 Default:
-\fIyes\fR\. Whether to ask the backup program to update its database (e\.g\.
-\fI/etc/dumpdates\fR
+\fIyes\fR\&. Whether to ask the backup program to update its database (e\&.g\&.
+\FC/etc/dumpdates\F[]
 for DUMP or
-\fI/usr/local/var/amanda/gnutar\-lists\fR
-for GNUTAR) of time stamps\. This is normally enabled for daily backups and turned off for periodic archival runs\.
+\FC/usr/local/var/amanda/gnutar\-lists\F[]
+for GNUTAR) of time stamps\&. This is normally enabled for daily backups and turned off for periodic archival runs\&.
 .RE
 .PP
 \fBskip\-full\fR \fI boolean\fR
 .RS 4
 Default:
-\fIno\fR\. If
+\fIno\fR\&. If
 \fItrue\fR
 and
 \fBplanner\fR
-has scheduled a full backup, these disks will be skipped, and full backups should be run off\-line on these days\. It was reported that
+has scheduled a full backup, these disks will be skipped, and full backups should be run off\-line on these days\&. It was reported that
 \fIAmanda\fR
-only schedules level 1 incrementals in this configuration; this is probably a bug\.
+only schedules level 1 incrementals in this configuration; this is probably a bug\&.
 .RE
 .PP
 \fBskip\-incr\fR \fI boolean\fR
 .RS 4
 Default:
-\fIno\fR\. If
+\fIno\fR\&. If
 \fItrue\fR
 and
 \fBplanner\fR
-has scheduled an incremental backup, these disks will be skipped\.
+has scheduled an incremental backup, these disks will be skipped\&.
 .RE
 .PP
 \fBstarttime\fR \fI int\fR
 .RS 4
 Default:
-\fInone\fR\. Backups will not start until after this time of day\. The value should be hh*100+mm, e\.g\. 6:30PM (18:30) would be entered as
-1830\.
+\fInone\fR\&. Backups will not start until after this time of day\&. The value should be hh*100+mm, e\&.g\&. 6:30PM (18:30) would be entered as
+\FC1830\F[]\&.
 .RE
 .PP
 \fBstrategy\fR \fI string\fR
 .RS 4
 Default:
-\fIstandard\fR\. Strategy to use when planning what level of backup to run next\. Values are:
+\fIstandard\fR\&. Strategy to use when planning what level of backup to run next\&. Values are:
 .PP
 \fBstandard\fR
 .RS 4
 The standard
 \fIAmanda\fR
-schedule\.
+schedule\&.
 .RE
 .PP
 \fBnofull\fR
 .RS 4
-Never do full backups, only level 1 incrementals\.
+Never do full backups, only level 1 incrementals\&.
 .RE
 .PP
 \fBnoinc\fR
 .RS 4
-Never do incremental backups, only full dumps\.
+Never do incremental backups, only full dumps\&.
 .RE
 .PP
 \fBskip\fR
 .RS 4
 Never do backups (useful when sharing the
 \fIdisklist\fR
-file)\.
+file)\&.
 .RE
 .PP
 \fBincronly\fR
 .RS 4
-Only do incremental dumps\.
+Only do incremental dumps\&.
 \fBamadmin force\fR
 should be used to tell
 \fIAmanda\fR
-that a full dump has been performed off\-line, so that it resets to level 1\.
+that a full dump has been performed off\-line, so that it resets to level 1\&.
 .RE
 .RE
 .PP
 \fBtape_splitsize\fR \fI int\fR
 .RS 4
 Default:
-\fInone\fR\. Split dump file on tape into pieces of a specified size\. This allows dumps to be spread across multiple tapes, and can potentially make more efficient use of tape space\. Note that if this value is too large (more than half the size of the average dump being split), substantial tape space can be wasted\. If too small, large dumps will be split into innumerable tiny dumpfiles, adding to restoration complexity\. A good rule of thumb, usually, is 1/10 of the size of your tape\.
+\fInone\fR\&. Split dump file on tape into pieces of a specified size\&. This allows dumps to be spread across multiple tapes, and can potentially make more efficient use of tape space\&. Note that if this value is too large (more than half the size of the average dump being split), substantial tape space can be wasted\&. If too small, large dumps will be split into innumerable tiny dumpfiles, adding to restoration complexity\&. A good rule of thumb, usually, is 1/10 of the size of your tape\&.
+.sp
+The default unit is Kbytes if it is not specified\&.
 .RE
 .PP
 \fBsplit_diskbuffer\fR \fI string\fR
 .RS 4
 Default:
-\fInone\fR\. When dumping a split dump in PORT\-WRITE mode (usually meaning "no holding disk"), buffer the split chunks to a file in the directory specified by this option\.
+\fInone\fR\&. When dumping a split dump in PORT\-WRITE mode (usually meaning "no holding disk"), buffer the split chunks to a file in the directory specified by this option\&.
 .RE
 .PP
 \fBfallback_splitsize\fR \fI int\fR
 .RS 4
 Default:
-\fI10M\fR\. When dumping a split dump in PORT\-WRITE mode, if no split_diskbuffer is specified (or if we somehow fail to use our split_diskbuffer), we must buffer split chunks in memory\. This specifies the maximum size split chunks can be in this scenario, and thus the maximum amount of memory consumed for in\-memory splitting\. The size of this buffer can be changed from its (very conservative) default to a value reflecting the amount of memory that each taper process on the dump server may reasonably consume\.
+\fI10M\fR\&. When dumping a split dump in PORT\-WRITE mode, if no split_diskbuffer is specified (or if we somehow fail to use our split_diskbuffer), we must buffer split chunks in memory\&. This specifies the maximum size split chunks can be in this scenario, and thus the maximum amount of memory consumed for in\-memory splitting\&. The size of this buffer can be changed from its (very conservative) default to a value reflecting the amount of memory that each taper process on the dump server may reasonably consume\&.
+.sp
+The default unit is Kbytes if it is not specified\&.
 .RE
 .PP
 The following
@@ -1488,31 +1813,31 @@ The following
 entries are predefined by
 \fIAmanda\fR:
 .nf
-define dumptype no\-compress {
+define dumptype "no\-compress" {
     compress none
 }
-define dumptype compress\-fast {
+define dumptype "compress\-fast" {
     compress client fast
 }
-define dumptype compress\-best {
+define dumptype "compress\-best" {
     compress client best
 }
-define dumptype srvcompress {
+define dumptype "srvcompress" {
     compress server fast
 }
-define dumptype bsd\-auth {
+define dumptype "bsd\-auth" {
     auth bsd
 }
-define dumptype krb4\-auth {
+define dumptype "krb4\-auth" {
     auth krb4
 }
-define dumptype no\-record {
+define dumptype "no\-record" {
     record no
 }
-define dumptype no\-hold {
+define dumptype "no\-hold" {
     holdingdisk no
 }
-define dumptype no\-full {
+define dumptype "no\-full" {
     skip\-full yes
 } 
 .fi
@@ -1521,22 +1846,22 @@ In addition to options in a
 \fBdumptype\fR
 section, one or more other
 \fBdumptype\fR
-names may be entered, which make this
+names may be supplied as identifiers, which make this
 \fBdumptype\fR
 inherit options from other previously defined
-\fBdumptype\fRs\. For instance, two sections might be the same except for the
+\fBdumptype\fRs\&. For instance, two sections might be the same except for the
 \fBrecord\fR
 option:
 .nf
-define dumptype normal {
+define dumptype "normal" {
     comment "Normal backup, no compression, do indexing"
     no\-compress
     index yes
     maxdumps 2
 }
-define dumptype testing {
+define dumptype "testing" {
     comment "Test backup, no compression, do indexing, no recording"
-    normal
+    "normal"
     record no
 }
 .fi
@@ -1547,123 +1872,115 @@ provides a
 named
 \fIglobal\fR
 in the sample
-\fBamanda\.conf\fR
+\fBamanda\&.conf\fR
 file that all
-\fBdumptype\fRs should reference\. This provides an easy place to make changes that will affect every
-\fBdumptype\fR\.
+\fBdumptype\fRs should reference\&. This provides an easy place to make changes that will affect every
+\fBdumptype\fR\&.
 .SH "TAPETYPE SECTION"
 .PP
 The
-\fBamanda\.conf\fR
-file may define multiple types of tape media and devices\. The information is entered in a
+\fBamanda\&.conf\fR
+file may define multiple types of tape media and devices\&. The information is entered in a
 \fBtapetype\fR
 section, which looks like this in the config file:
 .nf
-define tapetype \fIname\fR {
+define tapetype "\fIname\fR" {
     \fItapetype\-option\fR \fItapetype\-value\fR
-    \.\.\.
+    \FC\&.\&.\&.\F[]
 }
 .fi
 .PP
 \fIName\fR
-is the name of this type of tape medium/device\. It is referenced from the
+is the name of this type of tape medium/device\&. It is referenced from the
 \fBtapetype\fR
-option in the main part of the config file\.
+option in the main part of the config file\&.
 .PP
 The tapetype options and values are:
 .PP
 \fBcomment\fR \fI string\fR
 .RS 4
 Default:
-\fInone\fR\. A comment string describing this set of tape information\.
+\fInone\fR\&. A comment string describing this set of tape information\&.
 .RE
 .PP
 \fBfilemark\fR \fI int\fR
 .RS 4
 Default:
-\fI1 kbytes\fR\. How large a file mark (tape mark) is, measured in kbytes\. If the size is only known in some linear measurement (e\.g\. inches), convert it to kbytes using the device density\.
+\fI1 kbytes\fR\&. How large a file mark (tape mark) is, measured in kbytes\&. If the size is only known in some linear measurement (e\&.g\&. inches), convert it to kbytes using the device density\&.
 .RE
 .PP
 \fBlength\fR \fI int\fR
 .RS 4
 Default:
-\fI2000 kbytes\fR\. How much data will fit on a tape\.
+\fI2000 kbytes\fR\&. How much data will fit on a tape\&.
 .sp
 Note that this value is only used by
 \fIAmanda\fR
-to schedule which backups will be run\. Once the backups start,
+to schedule which backups will be run\&. Once the backups start,
 \fIAmanda\fR
 will continue to write to a tape until it gets an error, regardless of what value is entered for
 \fBlength\fR
 (but see the section OUTPUT DRIVERS in the
 \fBamanda\fR(8)
-manpage for exceptions)\.
+manpage for exceptions)\&.
+.sp
+The default unit is bytes if it is not specified\&.
 .RE
 .PP
 \fBblocksize\fR \fI int\fR
 .RS 4
 Default:
-\fI32 kbytes\fR\. How much data will be written in each tape record expressed in KiloBytes\. The tape record size (= blocksize) can not be reduced below the default 32 KBytes\. The parameter blocksize can only be raised if
-\fIAmanda\fR
-was compiled with the configure option \-\-with\-maxtapeblocksize=N set with "N" greater than 32 during
-\fBconfigure\fR\.
+\fI32 kbytes\fR\&. How much data will be written in each tape record\&. This is equivalent to the
+\fIBLOCK_SIZE\fR
+device property\&.
+.sp
+The default unit is Kbytes if it is not specified\&.
 .RE
 .PP
 \fBreadblocksize\fR \fI int\fR
 .RS 4
-Default: (\fIfrom configure \-\-with\-maxtapeblocksize\fR)\. How much data will be read in each tape record expressed in KiloBytes\. Some hardware require a value not too large, and some require it to be equal to the blocksize\. It is useful if you configured amanda with a big \-\-with\-maxtapeblocksize and your hardware don\'t work with a value that big\.
-.RE
-.PP
-\fBfile\-pad\fR \fI boolean\fR
-.RS 4
 Default:
-\fItrue\fR\. If true, every record, including the last one in the file, will have the same length\. This matches the way
-\fIAmanda\fR
-wrote tapes prior to the availability of this parameter\. It may also be useful on devices that only support a fixed blocksize\.
-.sp
-Note that the last record on the tape probably includes trailing null byte padding, which will be passed back to
-\fBgzip\fR,
-\fBcompress\fR
-or the restore program\. Most programs just ignore this (although possibly with a warning)\.
+\fI32 kytes\fR
+How much data will be read in each tape record\&. This can be used to override a device\'s block size for reads only\&. This may be useful, for example, in reading a tape written with a 256k block size when Amanda is configured to use 128k blocks\&. This unusual feature is not supported by all operating systems and tape devices\&.
 .sp
-If this parameter is false, the last record in a file may be shorter than the block size\. The file will contain the same amount of data the dump program generated, without trailing null byte padding\. When read, the same amount of data that was written will be returned\.
+The default unit is Kbytes if it is not specified\&.
 .RE
 .PP
 \fBspeed\fR \fI int\fR
 .RS 4
 Default:
-\fI200 bps\fR\. How fast the drive will accept data, in bytes per second\. This parameter is NOT currently used by
-\fIAmanda\fR\.
+\fI200 bps\fR\&. How fast the drive will accept data, in bytes per second\&. This parameter is NOT currently used by
+\fIAmanda\fR\&.
 .RE
 .PP
 \fBlbl\-templ\fR \fI string\fR
 .RS 4
 A PostScript template file used by
 \fBamreport\fR
-to generate labels\. Several sample files are provided with the
+to generate labels\&. Several sample files are provided with the
 \fIAmanda\fR
 sources in the
 \fIexample\fR
-directory\. See the
+directory\&. See the
 \fBamreport\fR(8)
-man page for more information\.
+man page for more information\&.
 .RE
 .PP
 In addition to options, another
 \fBtapetype\fR
-name may be entered, which makes this
+name may be supplie as an identifier, which makes this
 \fBtapetype\fR
 inherit options from another
-\fBtapetype\fR\. For instance, the only difference between a DLT4000 tape drive using Compact\-III tapes and one using Compact\-IV tapes is the length of the tape\. So they could be entered as:
+\fBtapetype\fR\&. For instance, the only difference between a DLT4000 tape drive using Compact\-III tapes and one using Compact\-IV tapes is the length of the tape\&. So they could be entered as:
 .nf
-define tapetype DLT4000\-III {
+define tapetype "DLT4000\-III" {
     comment "DLT4000 tape drives with Compact\-III tapes"
     length 12500 mbytes         # 10 Gig tapes with some compression
     filemark 2000 kbytes
     speed 1536 kps
 }
-define tapetype DLT4000\-IV {
-    DLT4000\-III
+define tapetype "DLT4000\-IV" {
+    "DLT4000\-III"
     comment "DLT4000 tape drives with Compact\-IV tapes"
     length 25000 mbytes         # 20 Gig tapes with some compression
 }
@@ -1671,57 +1988,289 @@ define tapetype DLT4000\-IV {
 .SH "INTERFACE SECTION"
 .PP
 The
-\fBamanda\.conf\fR
-file may define multiple types of network interfaces\. The information is entered in an
+\fBamanda\&.conf\fR
+file may define multiple types of network interfaces\&. The information is entered in an
 \fBinterface\fR
 section, which looks like this:
 .nf
-define interface \fIname\fR {
+define interface "\fIname\fR" {
     \fIinterface\-option\fR \fIinterface\-value\fR
-    \.\.\.
+    \FC\&.\&.\&.\F[]
 }
 .fi
 .PP
 \fIname\fR
-is the name of this type of network interface\. It is referenced from the
+is the name of this type of network interface\&. It is referenced from the
 \fIdisklist\fR
-file\.
+file\&.
 .PP
-Note that these sections define network interface characteristics, not the actual interface that will be used\. Nor do they impose limits on the bandwidth that will actually be taken up by
-\fIAmanda\fR\.
+Note that these sections define network interface characteristics, not the actual interface that will be used\&. Nor do they impose limits on the bandwidth that will actually be taken up by
+\fIAmanda\fR\&.
 \fIAmanda\fR
-computes the estimated bandwidth each file system backup will take based on the estimated size and time, then compares that plus any other running backups with the limit as another of the criteria when deciding whether to start the backup\. Once a backup starts,
+computes the estimated bandwidth each file system backup will take based on the estimated size and time, then compares that plus any other running backups with the limit as another of the criteria when deciding whether to start the backup\&. Once a backup starts,
 \fIAmanda\fR
-will use as much of the network as it can leaving throttling up to the operating system and network hardware\.
+will use as much of the network as it can leaving throttling up to the operating system and network hardware\&.
 .PP
 The interface options and values are:
 .PP
 \fBcomment\fR \fI string\fR
 .RS 4
 Default:
-\fInone\fR\. A comment string describing this set of network information\.
+\fInone\fR\&. A comment string describing this set of network information\&.
 .RE
 .PP
 \fBuse\fR \fI int\fR
 .RS 4
 Default:
-\fI8000 Kbps\fR\. The speed of the interface in Kbytes per second\.
+\fI8000 Kbps\fR\&. The speed of the interface in Kbytes per second\&.
 .RE
 .PP
 In addition to options, another
 \fBinterface\fR
-name may be entered, which makes this
+name may be supplied as an identifier, which makes this
 \fBinterface\fR
 inherit options from another
-\fBinterface\fR\. At the moment, this is of little use\.
-.SH "AUTHOR"
+\fBinterface\fR\&. At the moment, this is of little use\&.
+.SH "APPLICATION SECTION"
+.PP
+The
+\fBamanda\&.conf\fR
+file may define multiple types of application\&. The information is entered in a
+\fBapplication\-tool\fR
+section, which looks like this:
+.nf
+define application\-tool "\fIname\fR" {
+    \fIapplication\-option\fR \fIapplication\-value\fR
+    \FC\&.\&.\&.\F[]
+}
+.fi
+.PP
+\fIname\fR
+is the name of this type of application\&. It is referenced from the
+\fIdumptype\fR
+.PP
+The application\-tool options and values are:
+.PP
+\fBcomment\fR \fIstring\fR
+.RS 4
+Default:
+\fInone\fR\&. A comment string describing this application\&.
+.RE
+.PP
+\fBplugin\fR \fIstring\fR
+.RS 4
+No default\&. Must be set to the name of the program\&. This program must be in the
+\fI$libexecdir/amanda/application\fR
+directory on the client\&.
+.RE
+.PP
+\fBproperty\fR [append] [priority] \fIstring\fR \fIstring\fR+
+.RS 4
+No default\&. You can set property for the application, each application have a different set of property\&. Both strings are quoted; the first string contains the name of the property to set, and the others contains its values\&.
+\fBappend\fR
+keyword append the values to the list of values for that property\&.
+\fBpriority\fR
+keyword disallow the setting of that property on the client\&.
+.RE
+.SH "SCRIPT SECTION"
+.PP
+The
+\fBamanda\&.conf\fR
+file may define multiple types of script\&. The information is entered in a
+\fBscript\-tool\fR
+section, which looks like this:
+.nf
+define script\-tool "\fIname\fR" {
+    \fIscript\-option\fR \fIscript\-value\fR
+    \FC\&.\&.\&.\F[]
+}
+.fi
+.PP
+\fIname\fR
+is the name of this type of script\&. It is referenced from the
+\fIdumptype\fR
+.PP
+The script\-tool options and values are:
+.PP
+\fBcomment\fR \fIstring\fR
+.RS 4
+Default:
+\fInone\fR\&. A comment string describing this script\&.
+.RE
+.PP
+\fBplugin\fR \fIstring\fR
+.RS 4
+No default\&. Must be set to the name of the program\&. This program must be in the
+\fI$libexecdir/amanda/application\fR
+directory on the client and/or server\&.
+.RE
+.PP
+\fBexecute_where\fR [client|server]
+.RS 4
+Default:
+\fIclient\fR\&. Where the script must be executed, on the client or server\&.
+.RE
+.PP
+\fBexecute_on\fR \fIexecute_on\fR[,\fIexecute_on\fR]*
+.RS 4
+No default\&. When the script must be executed, you can specify many of them:
+.PP
+\fBpre\-dle\-amcheck\fR
+.RS 4
+Execute before the amcheck command for the dle\&.
+.RE
+.PP
+\fBpre\-host\-amcheck\fR
+.RS 4
+Execute before the amcheck command for all dle for the client\&.
+.RE
+.PP
+\fBpost\-dle\-amcheck\fR
+.RS 4
+Execute after the amcheck command for the dle\&.
+.RE
+.PP
+\fBpost\-host\-amcheck\fR
+.RS 4
+Execute after the amcheck command for all dle for the client\&.
+.RE
+.PP
+\fBpre\-dle\-estimate\fR
+.RS 4
+Execute before the estimate command for the dle\&.
+.RE
+.PP
+\fBpre\-host\-estimate\fR
+.RS 4
+Execute before the estimate command for all dle for the client\&.
+.RE
 .PP
-James da Silva,
-<jds@amanda\.org>: Original text
+\fBpost\-dle\-estimate\fR
+.RS 4
+Execute after the estimate command for the dle\&.
+.RE
+.PP
+\fBpost\-host\-estimate\fR
+.RS 4
+Execute after the estimate command for all dle for the client\&.
+.RE
+.PP
+\fBpre\-dle\-backup\fR
+.RS 4
+Execute before the backup command for the dle\&.
+.RE
+.PP
+\fBpre\-host\-backup\fR
+.RS 4
+Execute before the backup command for all dle for the client\&.
+.RE
+.PP
+\fBpost\-dle\-backup\fR
+.RS 4
+Execute after the backup command for the dle\&.
+.RE
+.PP
+\fBpost\-host\-backup\fR
+.RS 4
+Execute after the backup command for all dle for the client\&.
+.RE
+.PP
+\fBpre\-recover\fR
+.RS 4
+Execute before any level is recovered\&.
+.RE
+.PP
+\fBpost\-recover\fR
+.RS 4
+Execute after all levels are recovered\&.
+.RE
 .PP
-Stefan G\. Weichinger,
-<sgw@amanda\.org>, maintainer of the
-\fIAmanda\fR\-documentation: XML\-conversion, major update, splitting
+\fBpre\-level\-recover\fR
+.RS 4
+Execute before each level recovery\&.
+.RE
+.PP
+\fBpost\-level\-recover\fR
+.RS 4
+Execute after each level recovery\&.
+.RE
+.PP
+\fBinter\-level\-recover\fR
+.RS 4
+Execute between two levels of recovery\&.
+.RE
+.sp
+If you recover level 0 and 2 of the disk /usr with amrecover, it will execute:
+.nf
+script \-\-pre\-recover
+script \-\-pre\-level\-recover \-\-level 0
+#recovering level 0
+script \-\-post\-level\-recover \-\-level 0
+script \-\-inter\-level\-recover \-\-level 0 \-\-level 2
+script \-\-pre\-level\-recover \-\-level 2
+#recovering level 2
+script \-\-post\-level\-recover \-\-level 2
+script \-\-post\-recover
+.fi
+.RE
+.PP
+\fBproperty\fR [append] [priority] \fIstring\fR \fIstring\fR+
+.RS 4
+No default\&. You can set property for the script, each script have a different set of property\&. Both strings are quoted; the first string contains the name of the property to set, and the others contains its values\&.
+\fBappend\fR
+keyword append the values to the list of values for that property\&.
+\fBpriority\fR
+keyword disallow the setting of that property on the client\&.
+.RE
+.SH "DEVICE SECTION"
+.PP
+Backend storage devices are specified in
+\fBamanda\&.conf\fR
+in the form of "device" sections, which look like this:
+.nf
+define device \fIname\fR {
+    commend "\fIcomment (optional)\fR"
+    tapedev "\fIdevice\-specifier\fR"
+    device_property "\fIprop\-name\fR" "\fIprop\-value\fR"
+    \FC\&.\&.\&.\F[]
+}
+.fi
+.PP
+\fIname\fR
+is the user\-specified name of this device\&. It is referenced from the global
+\fItapedev\fR
+parameter\&. The
+\fIdevice\-specifier\fR
+specifies the device name to use; see
+\fBamanda-devices\fR(7)\&. As with most sections, the
+\fIcomment\fR
+parmeter is optional and only for the user\'s convenience\&.
+.PP
+An arbitrary number of
+\fIdevice_property\fR
+parameters can be specified\&. Again, see
+\fBamanda-devices\fR(7)
+for information on device properties\&.
+.SH "CHANGER SECTION"
+.PP
+Changers are described in
+\fBamanda\&.conf\fR
+in the form of "changer" sections, which look like this:
+.nf
+define changer \fIname\fR {
+    comment "\fIcomment (optional)\fR"
+    tapedev "\fItape\-device\fR"
+    tpchanger "\fIchanger\-type\fR"
+    changerdev "\fIdevice\-name\fR"
+    changerfile "\fIstate\-file\fR"
+    \FC\&.\&.\&.\F[]
+}
+.fi
+.PP
+\fIname\fR
+is the user\-specified name of this device\&. The remaining parameters are specific to the changer type selected\&.
+.PP
+TODO: more detail here once it\'s known
 .SH "SEE ALSO"
 .PP
 
@@ -1730,3 +2279,8 @@ Stefan G\. Weichinger,
 \fBamcrypt\fR(8),
 \fBaespipe\fR(1),
 : http://wiki.zmanda.com
+.SH "Authors"
+.PP
+\fBJames da Silva\fR <\&jds@amanda\&.org\&>
+.PP
+\fBStefan G\&. Weichinger\fR <\&sgw@amanda\&.org\&>
diff --git a/man/amarchiver.8 b/man/amarchiver.8
new file mode 100644 (file)
index 0000000..36cf6da
--- /dev/null
@@ -0,0 +1,229 @@
+.\"     Title: amarchiver
+.\"    Author: Dustin J. Mitchell <dustin@zmanda.com>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
+.\"
+.TH "AMARCHIVER" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amarchiver \- Create, extract or list amanda archive
+.SH "Synopsis"
+.fam C
+.HP \w'\fBamarchiver\fR\ 'u
+\fBamarchiver\fR \-\-version|\-\-create|\-\-extract|\-\-list [\-\-verbose] [\-\-file\ \fIfile\fR] [\fIfilename\fR]... 
+.fam
+.SH "DESCRIPTION"
+.PP
+\fBAmarchiver\fR
+manipulates amanda archive file\&. On creation, amarchiver doesn\'t recurse into directories\&. If a filename specifies a directory, it will be ignored\&. If it specifies a character device, amarchiver reads the device and archives the data\&. If a filename specifies a named pipe, amarchiver reads the named pipe and archives the data\&.
+.PP
+Note that this tool is more limited than the Amanda archive library, and may not be appropriate for some archive files \-\- particularly those which use non\-strings in their filenames\&.
+.SH "OPTIONS"
+.PP
+\fB\-\-version\fR
+.RS 4
+print the amarchiver version
+.RE
+.PP
+\fB\-\-create\fR
+.RS 4
+Create an amanda archive\&. Only the supplied filenames are included\&. With one
+\fB\-\-verbose\fR, lists the filenames\&. With two, lists the filenames and sizes\&.
+.RE
+.PP
+\fB\-\-list\fR
+.RS 4
+List the filenames in an amanda archive\&. No additional filenames are allowed on the command line\&.
+.RE
+.PP
+\fB\-\-extract\fR
+.RS 4
+Extract an amanda archive\&. If filenames are supplied, only those files are extracted\&. Files are created in the current directory, suffixed with a dot (\'\&.\') and the attribute ID\&.
+.RE
+.PP
+\fB\-\-verbose\fR
+.RS 4
+Give more information\&.
+.RE
+.PP
+\fB\-\-file\fR file
+.RS 4
+Create, list or extract from the given file instead of stdin/stdout\&.
+.RE
+.SH "SEE ALSO"
+.PP
+\fBamanda\fR(8)
+.PP
+\fBamanda-archive-format\fR(5)
+.SH "Authors"
+.PP
+\fBDustin J\&. Mitchell\fR <\&dustin@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
+.PP
+\fBJean\-Louis Martineau\fR <\&martineau@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
index e4d7f6fc45ec26bb990c10aa0622d43b85a99705..be35fcf02bbe08a6ce59b56cbb90c8b190d97bed 100644 (file)
 .\"     Title: amcheck
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
+.\"    Author: James da Silva <jds@amanda.org>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
 .\"
-.TH "AMCHECK" "8" "08/22/2008" "" ""
+.TH "AMCHECK" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
 .ad l
-.SH "NAME"
-amcheck - run Amanda self-checks
-.SH "SYNOPSIS"
-.HP 8
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amcheck \- run \fIAmanda\fR self\-checks
+.SH "Synopsis"
+.fam C
+.HP \w'\fBamcheck\fR\ 'u
 \fBamcheck\fR [\-am] [\-w] [\-sclt] [\-M\ \fIaddress\fR] \fIconfig\fR [\fIhost\fR\ [\fIdisk\fR...]...] [\-o\ \fIconfigoption\fR]...
+.fam
 .SH "DESCRIPTION"
 .PP
 \fBAmcheck\fR
@@ -22,71 +180,71 @@ runs a number of self\-checks on both the
 \fIAmanda\fR
 tape server host and the
 \fIAmanda\fR
-client hosts\.
+client hosts\&.
 .PP
 On the tape server host,
 \fBamcheck\fR
 can go through the same tape checking used at the start of the nightly
 \fBamdump\fR
-run to verify the correct tape for the next run is mounted\.
+run to verify the correct tape for the next run is mounted\&.
 .PP
 \fBAmcheck\fR
-can also do a self\-check on all client hosts to make sure each host is running and that permissions on filesystems to be backed up are correct\.
+can also do a self\-check on all client hosts to make sure each host is running and that permissions on filesystems to be backed up are correct\&.
 .PP
-You can specify many host/disk expressions, only disks that match an expression will be checked\. All disks are checked if no expressions are given\.
+You can specify many host/disk expressions, only disks that match an expression will be checked\&. All disks are checked if no expressions are given\&.
 .PP
 See the
 \fBamanda\fR(8)
 man page for more details about
-\fIAmanda\fR\.
+\fIAmanda\fR\&.
 .SH "OPTIONS"
 .PP
 \fB\-s\fR
 .RS 4
 Run the tape server local and tape checks (same as
-\fB\-lt\fR)\.
+\fB\-lt\fR)\&.
 .RE
 .PP
 \fB\-c\fR
 .RS 4
-Run the client host checks\. Multiple specific clients can be checked by specifying the client name\.
+Run the client host checks\&. Multiple specific clients can be checked by specifying the client name\&.
 .RE
 .PP
 \fB\-l\fR
 .RS 4
-Run the local tests (e\.g\. permissions) on the server host\.
+Run the local tests (e\&.g\&. permissions) on the server host\&.
 .RE
 .PP
 \fB\-t\fR
 .RS 4
-Run the tape tests on the server host\.
+Run the tape tests on the server host\&.
 .RE
 .PP
 \fB\-w\fR
 .RS 4
 Enables a DESTRUCTIVE check for write\-protection on the tape (which would otherwise cause the subsequent
 \fBamdump\fR
-to fail)\. If the tape is writable, this check causes all data after the tape label to be erased\. If the label_new_tapes option is enabled, this check may ERASE any non\-Amanda tape in the drive or changer\. The check enable the tape tests on the server host and is only made if the tape is otherwise correct\.
+to fail)\&. If the tape is writable, this check causes all data after the tape label to be erased\&. If the label_new_tapes option is enabled, this check may ERASE any non\-Amanda tape in the drive or changer\&. The check enable the tape tests on the server host and is only made if the tape is otherwise correct\&.
 .RE
 .PP
 \fB\-m\fR
 .RS 4
-Nothing is printed, but mail is sent if any errors are detected\. The mail goes to the
+Nothing is printed, but mail is sent if any errors are detected\&. The mail goes to the
 \fBmailto\fR
 address specified in the
-\fIamanda\.conf\fR
+\fIamanda\&.conf\fR
 file or the
 \fIaddress\fR
 value if
 \fB\-M\fR
-is set\.
+is set\&.
 .RE
 .PP
 \fB\-a\fR
 .RS 4
 Like
 \fB\-m\fR
-but the mail is always sent\.
+but the mail is always sent\&.
 .RE
 .PP
 \fB\-M\fR \fIaddress\fR
@@ -96,51 +254,51 @@ Mail the report to
 instead of the
 \fBmailto\fR
 value from
-\fIamanda\.conf\fR\. Implies
-\fB\-m\fR\.
+\fIamanda\&.conf\fR\&. Implies
+\fB\-m\fR\&.
 .RE
 .PP
 \fIhost\fR [\fIdisk\fR]*
 .RS 4
-Specify the host and disk on which the command will work\.
+Specify the host and disk on which the command will work\&.
 .RE
 .PP
 \fB\-o\fR \fIconfigoption\fR
 .RS 4
 See the "\fBCONFIGURATION OVERRIDE\fR" section in
-\fBamanda\fR(8)\.
+\fBamanda\fR(8)\&.
 .RE
 .PP
 The default is
-\fB\-cs\fR\.
+\fB\-cs\fR\&.
 .SH "EXAMPLES"
 .PP
-In this example, both the tape server and client tests are run\. The results are displayed on standard output\.
+In this example, both the tape server and client tests are run\&. The results are displayed on standard output\&.
 .nf
 % amcheck daily
 \fIAmanda\fR Tape Server Host Check
 \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
-/amanda2/amanda/work: 911475 KB disk space available, that\'s plenty\.
-NOTE: skipping tape\-writable test\.
-Tape VOL10 label ok\.
-Server check took 34\.966 seconds\.
+/amanda2/amanda/work: 911475 KB disk space available, that\'s plenty\&.
+NOTE: skipping tape\-writable test\&.
+Tape VOL10 label ok\&.
+Server check took 34\&.966 seconds\&.
 
 \fIAmanda\fR Backup Client Hosts Check
 \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
-WARNING: northstar: selfcheck request timed out\.  Host down?
-WARNING: drinkme: selfcheck request timed out\.  Host down?
-WARNING: scruffy: selfcheck request timed out\.  Host down?
-Client check: 136 hosts checked in 51\.945 seconds, 3 problems found\.
+WARNING: northstar: selfcheck request timed out\&.  Host down?
+WARNING: drinkme: selfcheck request timed out\&.  Host down?
+WARNING: scruffy: selfcheck request timed out\&.  Host down?
+Client check: 136 hosts checked in 51\&.945 seconds, 3 problems found\&.
 
-(brought to you by \fIAmanda\fR 2\.5\.0) 
+(brought to you by \fIAmanda\fR 2\&.5\&.0) 
 .fi
 .PP
 In this example, if the line
 \fBmailto csd\-amanda\fR
 is in
-\fIamanda\.conf\fR, mail will be sent to
+\fIamanda\&.conf\fR, mail will be sent to
 \fBcsd\-amanda\fR
-if the server check returns an error\.
+if the server check returns an error\&.
 .nf
 % amcheck \-s \-m daily 
 .fi
@@ -149,13 +307,13 @@ if the server check returns an error\.
 fatal slot \fIslot\fR: \fIerror message\fR
 .RS 4
 (error) The tape changer detected some kind of fatal error while trying to load slot
-\fIslot\fR\.
+\fIslot\fR\&.
 .RE
 .PP
 slot \fIslot\fR: \fIerror message\fR
 .RS 4
-(warning) The tape changer detected some kind of non\-fatal error (e\.g\. an empty slot was detected) while trying to load slot
-\fIslot\fR, or an error was detected trying to read the tape label\.
+(warning) The tape changer detected some kind of non\-fatal error (e\&.g\&. an empty slot was detected) while trying to load slot
+\fIslot\fR, or an error was detected trying to read the tape label\&.
 .RE
 .PP
 slot \fIslot\fR: date \fIYYYYMMDD\fR label \fIlabel\fR (\fIresult\fR)
@@ -165,14 +323,14 @@ slot \fIslot\fR: date \fIYYYYMMDD\fR label \fIlabel\fR (\fIresult\fR)
 in slot
 \fIslot\fR
 was loaded and found to have been last written on
-\fIYYYYMMDD\fR\. If the tape is new, the date field will be an
-\fIX\fR\. The
+\fIYYYYMMDD\fR\&. If the tape is new, the date field will be an
+\fIX\fR\&. The
 \fIresult\fR
 may be one of:
 .PP
 exact label match
 .RS 4
-This is the expected tape\.
+This is the expected tape\&.
 .RE
 .PP
 no match
@@ -180,12 +338,12 @@ no match
 This label does not match the
 \fBlabelstr\fR
 pattern in
-\fIamanda\.conf\fR\. Tape scanning will continue\.
+\fIamanda\&.conf\fR\&. Tape scanning will continue\&.
 .RE
 .PP
 active tape
 .RS 4
-This tape is still active and cannot be overwritten\. Tape scanning will continue\.
+This tape is still active and cannot be overwritten\&. Tape scanning will continue\&.
 .RE
 .PP
 first labelstr match
@@ -193,7 +351,7 @@ first labelstr match
 This tape is the first one that matches the
 \fBlabelstr\fR
 pattern in
-\fIamanda\.conf\fR\. Tape scanning will continue if necessary\.
+\fIamanda\&.conf\fR\&. Tape scanning will continue if necessary\&.
 .RE
 .PP
 labelstr match
@@ -201,7 +359,7 @@ labelstr match
 This tape is the next one that matches the
 \fBlabelstr\fR
 pattern in
-\fIamanda\.conf\fR\. Tape scanning will continue\.
+\fIamanda\&.conf\fR\&. Tape scanning will continue\&.
 .RE
 .sp
 .RE
@@ -211,8 +369,8 @@ ERROR: cannot look up dump user \fIuser\fR
 (error) Dump user
 \fIuser\fR
 from
-\fIamanda\.conf\fR
-could not be found in the system password information\.
+\fIamanda\&.conf\fR
+could not be found in the system password information\&.
 .RE
 .PP
 ERROR: cannot look up my own uid (\fIuid\fR)
@@ -221,7 +379,7 @@ ERROR: cannot look up my own uid (\fIuid\fR)
 \fIuid\fR
 running
 \fBamcheck\fR
-could not be found in the system password information\.
+could not be found in the system password information\&.
 .RE
 .PP
 ERROR: running as user \fIrunuser\fR instead of \fIdumpuser\fR
@@ -231,9 +389,9 @@ ERROR: running as user \fIrunuser\fR instead of \fIdumpuser\fR
 should be run as the dump user
 \fIdumpuser\fR
 from
-\fIamanda\.conf\fR
+\fIamanda\&.conf\fR
 instead of
-\fIrunuser\fR\.
+\fIrunuser\fR\&.
 .RE
 .PP
 ERROR: program dir \fIdirectory\fR: not accessible
@@ -241,42 +399,42 @@ ERROR: program dir \fIdirectory\fR: not accessible
 (error) The directory
 \fIAmanda\fR
 expects to find its auxiliary programs in,
-\fIdirectory\fR, is not accessible\.
+\fIdirectory\fR, is not accessible\&.
 .RE
 .PP
 ERROR: program \fIprogram\fR: does not exist
 .RS 4
 (error) Program
 \fIprogram\fR
-needed on the tape server could not be found\.
+needed on the tape server could not be found\&.
 .RE
 .PP
 ERROR: program \fIprogram\fR: not a file
 .RS 4
 (error) Program
 \fIprogram\fR
-needed on the tape server exists but is not a file\.
+needed on the tape server exists but is not a file\&.
 .RE
 .PP
 ERROR: program \fIprogram\fR: not executable
 .RS 4
 (error) Program
 \fIprogram\fR
-needed on the tape server exists but is not executable\.
+needed on the tape server exists but is not executable\&.
 .RE
 .PP
 WARNING: program \fIprogram\fR: not setuid\-root
 .RS 4
 (warning) Program
 \fIprogram\fR
-needed on the tape server exists but should be owned by user "root" and setuid\.
+needed on the tape server exists but should be owned by user "root" and setuid\&.
 .RE
 .PP
 ERROR: \fIXXX\fR dir \fIdirectory\fR: not writable
 .RS 4
 (error) Directory
 \fIdirectory\fR
-is either not writable, i\.e\. the dump user will not be able to create or remove files, or cannot be accessed, perhaps because a parent directory does not allow search permission\. The
+is either not writable, i\&.e\&. the dump user will not be able to create or remove files, or cannot be accessed, perhaps because a parent directory does not allow search permission\&. The
 \fIXXX\fR
 may be:
 .PP
@@ -287,7 +445,7 @@ for the
 log directory (see
 \fBlogdir\fR
 in
-\fBamanda\.conf\fR)
+\fBamanda\&.conf\fR)
 .RE
 .PP
 oldlog
@@ -295,7 +453,7 @@ oldlog
 for the directory that holds the old log files (see
 \fBlogdir\fR
 in
-\fBamanda\.conf\fR)
+\fBamanda\&.conf\fR)
 .RE
 .PP
 info
@@ -305,7 +463,7 @@ for an
 database information directory (see
 \fBcurinfo\fR
 in
-\fBamanda\.conf\fR) or
+\fBamanda\&.conf\fR) or
 .RE
 .PP
 index
@@ -315,29 +473,25 @@ for an
 index directory (see
 \fBindexdir\fR
 in
-\fBamanda\.conf\fR)
+\fBamanda\&.conf\fR)
 .RE
 .PP
 tapelist
 .RS 4
 for the
-\fIAmanda\fR
-tapelist directory (see
-\fBtapelist\fR
-in
-\fBamanda\.conf\fR)
+\fBtapelist\fR(5)
 .RE
 .sp
 .RE
 .PP
 NOTE: \fIXXX\fR dir \fIdirectory\fR: does not exist
 .RS 4
-(info) A database (info) or index directory does not exist or cannot be accessed\. This might just mean this is a new client or disk, but if that is not the case, this should be treated as an error\.
+(info) A database (info) or index directory does not exist or cannot be accessed\&. This might just mean this is a new client or disk, but if that is not the case, this should be treated as an error\&.
 .RE
 .PP
 NOTE: it will be created on the next run
 .RS 4
-(info) This indicates the info directory listed in the previous message will be created on the next run\.
+(info) This indicates the info directory listed in the previous message will be created on the next run\&.
 .RE
 .PP
 ERROR: \fIXXX\fR dir \fIname\fR: not a directory
@@ -346,33 +500,33 @@ ERROR: \fIXXX\fR dir \fIname\fR: not a directory
 \fBAmcheck\fR
 expected
 \fIname\fR
-to be a directory, but it is something else (e\.g\. file)\.
+to be a directory, but it is something else (e\&.g\&. file)\&.
 .RE
 .PP
-WARNING: info file \fIfile\fR: does not exist
+WARNING: info file \FCfile\F[]: does not exist
 .RS 4
 (warning) File
 \fIfile\fR
-does not exist in the text format database\. Since the parent directories do exist, the file should already have been created\.
+does not exist in the text format database\&. Since the parent directories do exist, the file should already have been created\&.
 .RE
 .PP
-ERROR: info file \fIname\fR: not a file
+ERROR: info file \FCname\F[]: not a file
 .RS 4
 (error)
 \fBAmcheck\fR
 expected
 \fIname\fR
-to be a file, but it is something else (e\.g\. file)\.
+to be a file, but it is something else (e\&.g\&. file)\&.
 .RE
 .PP
-ERROR: info file \fIfile\fR: not readable
+ERROR: info file \FCfile\F[]: not readable
 .RS 4
 (error) The text format database file
 \fIfile\fR
-is not readable\.
+is not readable\&.
 .RE
 .PP
-ERROR: log file \fIfile\fR: not writable
+ERROR: log file \FCfile\F[]: not writable
 .RS 4
 (error) Log file
 \fIfile\fR
@@ -381,31 +535,21 @@ ERROR: log file \fIfile\fR: not writable
 in
 \fBlogdir\fR
 from
-\fBamanda\.conf\fR) is either not writable, or cannot be accessed, perhaps because a parent directory does not allow search permission\.
+\fBamanda\&.conf\fR) is either not writable, or cannot be accessed, perhaps because a parent directory does not allow search permission\&.
 .RE
 .PP
 ERROR: tape list \fItapelist\fR: not writable
 .RS 4
 (error)
-\fIAmanda\fR
-tape list file
-\fItapelist\fR
-(see
-\fBtapelist\fR
-in
-\fBamanda\.conf\fR) is not writable or was not found\.
+\fBtapelist\fR(5)
+is not writable or was not found\&.
 .RE
 .PP
 ERROR: tape list \fItapelist\fR: parse error
 .RS 4
 (error)
-\fIAmanda\fR
-tape list file
-\fItapelist\fR
-(see
-\fBtapelist\fR
-in
-\fBamanda\.conf\fR) could not be read or parsed\.
+\fBtapelist\fR(5)
+could not be read or parsed\&.
 .RE
 .PP
 WARNING: tapedev is /dev/null, dumps will be thrown away
@@ -413,21 +557,21 @@ WARNING: tapedev is /dev/null, dumps will be thrown away
 (warning) The
 \fBtapedev\fR
 parameter in
-\fBamanda\.conf\fR
+\fBamanda\&.conf\fR
 is set to
-\fI/dev/null\fR
+\FC/dev/null\F[]
 and
 \fIAmanda\fR
-uses that when debugging to throw all the dump images away\.
+uses that when debugging to throw all the dump images away\&.
 .RE
 .PP
-WARNING: hold file \fIfile\fR exists
+WARNING: hold file \FCfile\F[] exists
 .RS 4
 (info) Hold file
 \fIfile\fR
 exists and will cause
 \fBamdump\fR
-to pause at the beginning until it is removed\.
+to pause at the beginning until it is removed\&.
 .RE
 .PP
 ERROR: holding disk \fIdisk\fR: statfs: \fIerror message\fR
@@ -436,16 +580,16 @@ ERROR: holding disk \fIdisk\fR: statfs: \fIerror message\fR
 \fIstatfs\fR
 system call on holding disk
 \fIdisk\fR
-(maybe because it does not exist)\.
+(maybe because it does not exist)\&.
 .RE
 .PP
 ERROR: holding disk \fIdisk\fR: not writable
 .RS 4
 (error) Holding disk
-\fIdisk\fR, is not writable, probably because the caller does not have write permission or a parent directory does not allow search permission\.
+\fIdisk\fR, is not writable, probably because the caller does not have write permission or a parent directory does not allow search permission\&.
 .RE
 .PP
-WARNING: holding disk \fIdisk\fR: available space unknown \fIN\fR KB requested\.
+WARNING: holding disk \fIdisk\fR: available space unknown \fIN\fR KB requested\&.
 .RS 4
 (warning)
 \fBAmcheck\fR
@@ -453,37 +597,47 @@ could not determine the amount of available space on holding disk
 \fIdisk\fR
 to see if there were at least
 \fIN\fR
-KBytes available\.
+KBytes available\&.
 .RE
 .PP
-WARNING: holding disk \fIdisk\fR: only \fIF\fR KB free (\fIR\fR KB requested)\.
+WARNING: holding disk \fIdisk\fR: only \fIF\fR KB free (\fIR\fR KB requested)\&.
 .RS 4
 (warning)
-\fIamanda\.conf\fR
+\fIamanda\&.conf\fR
 requested
 \fIR\fR
 KBytes of free space on holding disk
 \fIdisk\fR, but only
 \fIF\fR
-KBytes were available\. 10 MBytes is subtracted for each backup process (see the
+KBytes were available\&. 10 MBytes is subtracted for each backup process (see the
 \fBinparallel\fR
-\fIamanda\.conf\fR
-option) to allow for unexpected overruns\.
+\fIamanda\&.conf\fR
+option) to allow for unexpected overruns\&.
+.if n \{\
 .sp
+.\}
+.RS 4
+.BM yellow
 .it 1 an-trap
 .nr an-no-space-flag 1
 .nr an-break-flag 1
 .br
-Note
+.ps +1
+\fBNote\fR
+.ps -1
+.br
 Even though this message is listed as a warning, it causes
 \fBamcheck\fR
-to exit with a non\-zero status\.
+to exit with a non\-zero status\&.
+.sp .5v
+.EM yellow
+.RE
 .RE
 .PP
-Holding disk \fIdisk\fR: \fIN\fR KB disk space available, that\'s plenty\.
+Holding disk \fIdisk\fR: \fIN\fR KB disk space available, that\'s plenty\&.
 .RS 4
 (info) There was sufficient free space on holding disk
-\fIdisk\fR\.
+\fIdisk\fR\&.
 .RE
 .PP
 WARNING: holding disk \fIdisk\fR: only \fIF\fR KB free, using nothing
@@ -493,7 +647,7 @@ WARNING: holding disk \fIdisk\fR: only \fIF\fR KB free, using nothing
 has
 \fIF\fR
 KBytes of free space, but that is not enough for what is requested in
-\fIamanda\.conf\fR\.
+\fIamanda\&.conf\fR\&.
 .RE
 .PP
 Holding disk \fIdisk\fR: \fIF\fR KB disk space available, using \fIU\fR KB
@@ -506,78 +660,78 @@ KBytes of free space and
 \fIAmanda\fR
 will be using up to
 \fIU\fR
-Kbytes\.
+Kbytes\&.
 .RE
 .PP
-WARNING: if a tape changer is not available, runtapes must be set to 1\.
+WARNING: if a tape changer is not available, runtapes must be set to 1\&.
 .RS 4
 (warning) The
 \fBruntapes\fR
-\fIamanda\.conf\fR
+\fIamanda\&.conf\fR
 option must be set to 1 if the
 \fBtpchanger\fR
-\fIamanda\.conf\fR
-option is not set\.
+\fIamanda\&.conf\fR
+option is not set\&.
 .RE
 .PP
-ERROR: \fIerror message\fR\.
+ERROR: \fIerror message\fR\&.
 .RS 4
-(error) An error was detected while initializing the tape changer\.
+(error) An error was detected while initializing the tape changer\&.
 .RE
 .PP
-ERROR: \fItape device\fR: \fIerror message\fR\.
+ERROR: \fItape device\fR: \fIerror message\fR\&.
 .RS 4
-(error) An error was detected while processing the tape label\.
+(error) An error was detected while processing the tape label\&.
 .RE
 .PP
-ERROR: cannot overwrite active tape \fIlabel\fR\.
+ERROR: cannot overwrite active tape \fIlabel\fR\&.
 .RS 4
 (error) Tape
 \fIlabel\fR
-is still active and cannot be used\.
+is still active and cannot be used\&.
 .RE
 .PP
-ERROR: label \fIlabel\fR doesn\'t match labelstr \fIpattern\fR \.
+ERROR: label \fIlabel\fR doesn\'t match labelstr \fIpattern\fR \&.
 .RS 4
 (error) The label on tape
 \fIlabel\fR
 does not match the
 \fBlabelstr\fR
-\fIamanda\.conf\fR
-option\.
+\fIamanda\&.conf\fR
+option\&.
 .RE
 .PP
 (expecting a new tape)
 .RS 4
-(info) The tape is not OK and a new tape was expected\.
+(info) The tape is not OK and a new tape was expected\&.
 .RE
 .PP
 (expecting tape \fIlabel\fR or a new tape)
 .RS 4
 (info) The tape is not OK and either tape
 \fIlabel\fR
-or a new tape was expected\.
+or a new tape was expected\&.
 .RE
 .PP
-ERROR: tape \fIlabel\fR label ok, but is not writable\.
+ERROR: tape \fIlabel\fR label ok, but is not writable\&.
 .RS 4
 (error) Tape
 \fIlabel\fR
-is OK, but the write enable test failed\.
+is OK, but the write enable test failed\&.
 .RE
 .PP
-Tape \fIlabel\fR is writable\.
+Tape \fIlabel\fR is writable\&.
 .RS 4
 (info) Tape
 \fIlabel\fR
-is OK and the write enable test succeeded\.
+is OK and the write enable test succeeded\&.
 .RE
 .PP
-NOTE: skipping tape\-writable test\.
+NOTE: skipping tape\-writable test\&.
 .RS 4
 (info) The tape write test (see the
 \fB\-w\fR
-option) was not enabled\.
+option) was not enabled\&.
 .RE
 .PP
 WARNING: skipping tape test because amdump or amflush seem to be running, WARNING: if they are not, you must run amcleanup
@@ -588,54 +742,54 @@ like either
 \fBamdump\fR
 or
 \fBamflush\fR
-were running because a log file or amdump file exists\. If they are not running, you probably need to run
+were running because a log file or amdump file exists\&. If they are not running, you probably need to run
 \fBamcleanup\fR
-to clear up a previous failure\. Otherwise, you need to wait until they complete before running
-\fBamcheck\fR\.
+to clear up a previous failure\&. Otherwise, you need to wait until they complete before running
+\fBamcheck\fR\FC\&.\F[]
 .RE
 .PP
 NOTE: skipping tape checks
 .RS 4
 (info) The tape tests are being skipped because you used the
 \fB\-t\fR
-command line option\.
+command line option\&.
 .RE
 .PP
 WARNING: \fIcompress\fR is not executable, server\-compression and indexing will not work
 .RS 4
 (warning) Compression program
 \fIcompress\fR
-is not executable, so compression on the tape server host and creating index files will not work\.
+is not executable, so compression on the tape server host and creating index files will not work\&.
 .RE
 .PP
-Tape \fIlabel\fR label ok\.
+Tape \fIlabel\fR label ok\&.
 .RS 4
 (info) Tape
 \fIlabel\fR
-is OK for the next run\.
+is OK for the next run\&.
 .RE
 .PP
-Server check took \fIS\fR seconds\.
+Server check took \fIS\fR seconds\&.
 .RS 4
-(info) Reports how long the tape server host checks took\.
+(info) Reports how long the tape server host checks took\&.
 .RE
 .PP
 ERROR: \fIhost\fR: could not resolve hostname
 .RS 4
 (error) Could not look up client hostname
-\fIhost\fR\.
+\fIhost\fR\&.
 .RE
 .PP
-Client check: \fIH\fR hosts checked in \fIS\fR seconds, \fIN\fR problems found\.
+Client check: \fIH\fR hosts checked in \fIS\fR seconds, \fIN\fR problems found\&.
 .RS 4
-(info) Reports the number of client hosts checked, how long it took and the number of errors detected\.
+(info) Reports the number of client hosts checked, how long it took and the number of errors detected\&.
 .RE
 .PP
-WARNING: \fIhost\fR: selfcheck request timed out\. Host down?
+WARNING: \fIhost\fR: selfcheck request timed out\&. Host down?
 .RS 4
 (warning) There was no response from
 \fIhost\fR
-when trying to do the client checks\. The host might really be down or it might not be configured properly\.
+when trying to do the client checks\&. The host might really be down or it might not be configured properly\&.
 .RE
 .PP
 ERROR: \fIhost\fR NAK: \fImessage\fR
@@ -644,7 +798,7 @@ ERROR: \fIhost\fR NAK: \fImessage\fR
 \fIHost\fR
 reported a negative acknowledgment error of
 \fImessage\fR
-to the status check request\.
+to the status check request\&.
 .RE
 .PP
 ERROR: \fIhost\fR NAK: [NAK parse failed]
@@ -652,18 +806,18 @@ ERROR: \fIhost\fR NAK: [NAK parse failed]
 (error)
 \fBAmcheck\fR
 could not parse the negative acknowledgment error from
-\fIhost\fR\. There might be an
+\fIhost\fR\&. There might be an
 \fIAmanda\fR
 version mismatch between the host running
 \fBamcheck\fR
 and
-\fIhost\fR\.
+\fIhost\fR\&.
 .RE
 .PP
 ERROR: \fIhost\fR [mutual\-authentication failed]
 .RS 4
 (error) Kerberos authentication failed while contacting
-\fIhost\fR\.
+\fIhost\fR\&.
 .RE
 .PP
 ERROR: \fIhost\fR: \fImessage\fR
@@ -671,7 +825,7 @@ ERROR: \fIhost\fR: \fImessage\fR
 (error) Error
 \fImessage\fR
 was reported by the status check on
-\fIhost\fR\.
+\fIhost\fR\&.
 .RE
 .SH "EXIT CODE"
 
@@ -680,17 +834,13 @@ The exit code of \fBamcheck\fR is one of:
  0  = success
  1  = error
 .fi
-.SH "AUTHOR"
-.PP
-James da Silva,
-<jds@amanda\.org>
-: Original text
-.PP
-Stefan G\. Weichinger,
-<sgw@amanda\.org>, maintainer of the
-\fIAmanda\fR\-documentation: XML\-conversion
 .SH "SEE ALSO"
 .PP
 \fBamanda\fR(8),
 \fBamdump\fR(8),
 : http://wiki.zmanda.com
+.SH "Authors"
+.PP
+\fBJames da Silva\fR <\&jds@amanda\&.org\&>
+.PP
+\fBStefan G\&. Weichinger\fR <\&sgw@amanda\&.org\&>
index 754c3126d09427b98758b9e20f1a339bff3f2f1f..eb8bc429718089d7466ef00b7b1cbeb4cf54d89d 100644 (file)
 .\"     Title: amcheckdb
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
+.\"    Author: Adrian T. Filipi-Martin <atf3r@cs.virginia.edu>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
 .\"
-.TH "AMCHECKDB" "8" "08/22/2008" "" ""
+.TH "AMCHECKDB" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
 .ad l
-.SH "NAME"
-amcheckdb - check Amanda database for tape consistency
-.SH "SYNOPSIS"
-.HP 10
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amcheckdb \- check \fIAmanda\fR database for tape consistency
+.SH "Synopsis"
+.fam C
+.HP \w'\fBamcheckdb\fR\ 'u
 \fBamcheckdb\fR \fIconfig\fR
+.fam
 .SH "DESCRIPTION"
 .PP
 \fBAmcheckdb\fR
 verifies that every tape mentioned in the
 \fIAmanda\fR
 database is still valid in the
-\fItapelist\fR
-file\.
+\fBtapelist\fR(5)\&.
 .PP
 See the
 \fBamanda\fR(8)
 man page for more details about
-\fIAmanda\fR\.
+\fIAmanda\fR\&.
 .SH "EXAMPLE"
 .PP
 This shows a normal response:
 .nf
 # amcheckdb daily
-Ready\.
+Ready\&.
 .fi
 .PP
 This shows tape
 \fIDMP014\fR
 is still listed in the database but is no longer listed in the
-\fItapelist\fR
-file:
+\fBtapelist\fR(5):
 .nf
 # amcheckdb daily
 Tape DMP014 missing in /usr/local/etc/amanda//daily/tapelist
-Ready\.
+Ready\&.
 .fi
-.SH "AUTHOR"
-.PP
-Adrian T\. Filipi\-Martin <atf3r@cs\.virginia\.edu>: Original text
-.PP
-Stefan G\. Weichinger,
-<sgw@amanda\.org>, maintainer of the
-\fIAmanda\fR\-documentation: XML\-conversion
 .SH "SEE ALSO"
 .PP
 \fBamadmin\fR(8),
 \fBamrmtape\fR(8),
 \fBamanda\fR(8),
 : http://wiki.zmanda.com
+.SH "Authors"
+.PP
+\fBAdrian T\&. Filipi\-Martin\fR <\&atf3r@cs\&.virginia\&.edu\&>
+.PP
+\fBStefan G\&. Weichinger\fR <\&sgw@amanda\&.org\&>
index 4371b8353d86a1ee434f36b1772715827b142f4e..c3140e69f94c03d2c6aea4c03beca873fccb4ddb 100644 (file)
 .\"     Title: amcheckdump
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
+.\"    Author: Ian Turner <ian@zmanda.com>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
 .\"
-.TH "AMCHECKDUMP" "8" "08/22/2008" "" ""
+.TH "AMCHECKDUMP" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
 .ad l
-.SH "NAME"
-amcheckdump - check the results of an Amanda dump
-.SH "SYNOPSIS"
-.HP 12
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amcheckdump \- check the results of an \fIAmanda\fR dump
+.SH "Synopsis"
+.fam C
+.HP \w'\fBamcheckdump\fR\ 'u
 \fBamcheckdump\fR \fIconfig\fR [\-\-timestamp|\-t\ \fItimestamp\fR] [\-o\ \fIconfigoption\fR]...
+.fam
 .SH "DESCRIPTION"
 .PP
 \fBAmcheckdump\fR
 verifies
 \fIAmanda\fR
-dump images by reading them from storage volume(s) and verifying that the images can be parsed by the appropriate application (if available)\. For example, a GNUTAR image is passed to GNU Tar for parsing, and any errors (e\.g\., corrupt or missing data) are noted\.
+dump images by reading them from storage volume(s) and verifying that the images can be parsed by the appropriate application (if available)\&. For example, a GNUTAR image is passed to GNU Tar for parsing, and any errors (e\&.g\&., corrupt or missing data) are noted\&.
 .PP
 The application runs on the most recent dump or, if
 \fI\-\-timestamp\fR
-is specified, on the most recent dump with that timestamp\. Note that the verification is local to the
+is specified, on the most recent dump with that timestamp\&. Note that the verification is local to the
 \fIAmanda\fR
-server; if the dump application is not available, or is configured differently on the server than on the client, then the verification will most likely fail\.
+server; if the dump application is not available, or is configured differently on the server than on the client, then the verification will most likely fail\&.
 .PP
-If a changer is available, it is used to load the required tapes\. Otherwise, the application interactively requests the tapes\.
+If a changer is available, it is used to load the required tapes\&. Otherwise, the application interactively requests the tapes\&.
 .PP
 See the "\fBCONFIGURATION OVERRIDE\fR" section in
 \fBamanda\fR(8)
 for information on the
-\-o
-option\.
-.SH "SEE ALSO"
-.PP
-\fBamanda\fR(8),
-: http://wiki.zmanda.com
+\FC\-o\F[]
+option\&.
 .SH "EXAMPLE"
 .PP
 .nf
@@ -51,4 +205,10 @@ amcheckdump MYCONFIG \-\-timestamp 19780615
 .SH "SEE ALSO"
 .PP
 \fBamanda\fR(8),
-\fBhttp://wiki.zmanda.com\fR()
+: http://wiki.zmanda.com
+.SH "Author"
+.PP
+\fBIan Turner\fR <\&ian@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
index 04dc0f8b6354197d620c9f848961fce4122e0deb..9148da22cb0e4e25419a0b9c9b86b5175d5101c8 100644 (file)
 .\"     Title: amcleanup
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
+.\"    Author: James da Silva <jds@amanda.org>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
 .\"
-.TH "AMCLEANUP" "8" "08/22/2008" "" ""
+.TH "AMCLEANUP" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
 .ad l
-.SH "NAME"
-amcleanup - run the Amanda cleanup process after a failure
-.SH "SYNOPSIS"
-.HP 10
-\fBamcleanup\fR [\fB\-k\fR] [\fB\-v\fR] \fIconfig\fR
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amcleanup \- run the \fIAmanda\fR cleanup process after a failure
+.SH "Synopsis"
+.fam C
+.HP \w'\fBamcleanup\fR\ 'u
+\fBamcleanup\fR [\fB\-k\fR] [\fB\-p\fR] [\fB\-v\fR] \fIconfig\fR
+.fam
 .SH "DESCRIPTION"
 .PP
 \fBAmcleanup\fR
@@ -22,42 +180,47 @@ generates the
 \fI\fIAmanda\fR\fR\fI Mail Report\fR
 and updates the
 \fIAmanda\fR
-databases after a system failure on a tape server host\. This cleanup process is normally done automatically as part of the
+databases after a system failure on a tape server host\&. This cleanup process is normally done automatically as part of the
 \fBamdump\fR
 program, but if
 \fBamdump\fR
 cannot complete for some reason (usually because of a tape server host crash),
 \fBamcleanup\fR
-must be run some time later (usually during system boot)\.
+must be run some time later (usually during system boot)\&.
 .PP
 See the
 \fBamanda\fR(8)
 man page for more details about
-\fIAmanda\fR\.
+\fIAmanda\fR\&.
 .SH "OPTIONS"
 .PP
 \fB\-k\fR
 .RS 4
-Kill all Amanda processes\.
+Kill all process listed in the log file are their child\&. if there is no log file, then kill all amdump and amflush process and their child\&.
+.RE
+.PP
+\fB\-p\fR
+.RS 4
+Do the cleanup only if all process listed in the log file are already terminated\&.
 .RE
 .PP
 \fB\-v\fR
 .RS 4
-Generate verbose output\.
+Generate verbose output\&.
 .RE
 .SH "EXAMPLES"
 .PP
 This example runs the
 \fIAmanda\fR
-cleanup process by hand after a failure\.
+cleanup process by hand after a failure\&.
 .nf
 % amcleanup daily
 .fi
 .PP
-Putting the following line in a system boot script (e\.g\.
-\fI/etc/rc\.local\fR) runs the
+Putting the following line in a system boot script (e\&.g\&.
+\FC/etc/rc\&.local\F[]) runs the
 \fIAmanda\fR
-cleanup process as part of the reboot, eliminating the need to run it by hand\.
+cleanup process as part of the reboot, eliminating the need to run it by hand\&.
 .nf
 /usr/local/sbin/amcleanup daily
 .fi
@@ -66,18 +229,15 @@ If nothing needs to be done,
 \fBamcleanup\fR
 exits normally with the message:
 .nf
-amcleanup: no unprocessed logfile to clean up\.
+amcleanup: no unprocessed logfile to clean up\&.
 .fi
-.SH "AUTHOR"
-.PP
-James da Silva,
-<jds@amanda\.org>: Original text
-.PP
-Stefan G\. Weichinger,
-<sgw@amanda\.org>, maintainer of the
-\fIAmanda\fR\-documentation: XML\-conversion
 .SH "SEE ALSO"
 .PP
 \fBamanda\fR(8),
 \fBamdump\fR(8),
 : http://wiki.zmanda.com
+.SH "Authors"
+.PP
+\fBJames da Silva\fR <\&jds@amanda\&.org\&>
+.PP
+\fBStefan G\&. Weichinger\fR <\&sgw@amanda\&.org\&>
index 6971d8d32df9625ff4068eb212fe4fc63afe59c4..e9da0bb19f842bc6194444b9f5c726d14fd6a0f3 100644 (file)
 .\"     Title: amcrypt-ossl-asym
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
+.\"    Author: Kevin Till <kevin.till@zmanda.com>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
 .\"
-.TH "AMCRYPT\-OSSL\-ASYM" "8" "08/22/2008" "" ""
+.TH "AMCRYPT\-OSSL\-ASYM" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
 .ad l
-.SH "NAME"
-amcrypt-ossl-asym - crypt program for Amanda asymmetric data encryption using OpenSSL
-.SH "SYNOPSIS"
-.HP 18
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amcrypt-ossl-asym \- crypt program for \fIAmanda\fR asymmetric data encryption using OpenSSL
+.SH "Synopsis"
+.fam C
+.HP \w'\fBamcrypt\-ossl\-asym\fR\ 'u
 \fBamcrypt\-ossl\-asym\fR [\-d]
+.fam
 .SH "DESCRIPTION"
 .PP
 
 \fBamcrypt\-ossl\-asym\fR
 uses
 \fBOpenSSL\fR
-to encrypt and decrypt data\. OpenSSL is available from
-www\.openssl\.org\. OpenSSL offers a wide variety of cipher choices (
+to encrypt and decrypt data\&. OpenSSL is available from
+www\&.openssl\&.org\&. OpenSSL offers a wide variety of cipher choices (
 \fBamcrypt\-ossl\-asym\fR
-defaults to 256\-bit AES) and can use hardware cryptographic accelerators on several platforms\.
+defaults to 256\-bit AES) and can use hardware cryptographic accelerators on several platforms\&.
 .PP
 
 \fBamcrypt\-ossl\-asym\fR
-will search for the OpenSSL program in the following directories: /bin:/usr/bin:/usr/local/bin:/usr/ssl/bin:/usr/local/ssl/bin\.
+will search for the OpenSSL program in the following directories: /bin:/usr/bin:/usr/local/bin:/usr/ssl/bin:/usr/local/ssl/bin\&.
 .SH "GENERATING PUBLIC AND PRIVATE KEYS"
 .PP
-RSA keys can be generated with the standard OpenSSL commands, e\.g\.:
+RSA keys can be generated with the standard OpenSSL commands, e\&.g\&.:
 .nf
 $ cd /var/lib/amanda
-$ openssl genrsa \-aes128 \-out backup\-privkey\.pem 1024
+$ openssl genrsa \-aes128 \-out backup\-privkey\&.pem 1024
 Generating RSA private key, 1024 bit long modulus
-[\.\.\.]
-Enter pass phrase for backup\-privkey\.pem: \fIENTER YOUR PASS PHRASE\fR
-Verifying \- Enter pass phrase for backup\-key\.pem: \fIENTER YOUR PASS PHRASE\fR
+[\&.\&.\&.]
+Enter pass phrase for backup\-privkey\&.pem: \fIENTER YOUR PASS PHRASE\fR
+Verifying \- Enter pass phrase for backup\-key\&.pem: \fIENTER YOUR PASS PHRASE\fR
 
-$ openssl rsa \-in backup\-privkey\.pem \-pubout \-out backup\-pubkey\.pem
-Enter pass phrase for backup\-privkey\.pem: \fIENTER YOUR PASS PHRASE\fR
+$ openssl rsa \-in backup\-privkey\&.pem \-pubout \-out backup\-pubkey\&.pem
+Enter pass phrase for backup\-privkey\&.pem: \fIENTER YOUR PASS PHRASE\fR
 Writing RSA key
 .fi
 .PP
 To generate a private key without a passphrase, omit the
 \fB\-aes128\fR
-option\. See
+option\&. See
 \fBopenssl_genrsa\fR(1)
-for more key generation options\.
+for more key generation options\&.
 .PP
-Note that it is always possible to generate the public key from the private key\.
+Note that it is always possible to generate the public key from the private key\&.
 .SH "KEY AND PASSPHRASE MANAGEMENT"
 .PP
 
 \fBamcrypt\-ossl\-asym\fR
 uses the
 \fIpublic key\fR
-to encrypt data\. The security of the data does not depend on the confidentiality of the public key\. The
+to encrypt data\&. The security of the data does not depend on the confidentiality of the public key\&. The
 \fIprivate key\fR
-is used to decrypt data, and must be protected\. Encrypted backup data cannot be recovered without the private key\. The private key may optionally be encrypted with a passphrase\.
+is used to decrypt data, and must be protected\&. Encrypted backup data cannot be recovered without the private key\&. The private key may optionally be encrypted with a passphrase\&.
 .PP
-While the public key must be online at all times to perorm backups, the private key and optional passphrase are only needed to restore data\. It is recommended that the latter be stored offline all other times\. For example, you could keep the private key on removable media, and copy it into place for a restore; or you could keep the private key online, encrypted with a passphrase that is present only for a restore\.
+While the public key must be online at all times to perorm backups, the private key and optional passphrase are only needed to restore data\&. It is recommended that the latter be stored offline all other times\&. For example, you could keep the private key on removable media, and copy it into place for a restore; or you could keep the private key online, encrypted with a passphrase that is present only for a restore\&.
 .PP
-OpenSSL\'s key derivation routines use a salt to guard against dictionary attacks on the pass phrase; still it is important to pick a pass phrase that is hard to guess\. The Diceware method (see
-www\.diceware\.com) can be used to create passphrases that are difficult to guess and easy to remember\.
+OpenSSL\'s key derivation routines use a salt to guard against dictionary attacks on the pass phrase; still it is important to pick a pass phrase that is hard to guess\&. The Diceware method (see
+www\&.diceware\&.com) can be used to create passphrases that are difficult to guess and easy to remember\&.
 .SH "FILES"
 .PP
-/var/lib/amanda/backup\-privkey\.pem
+/var/lib/amanda/backup\-privkey\&.pem
 .RS 4
-File containing the RSA private key\. It should not be readable by any user other than the
+File containing the RSA private key\&. It should not be readable by any user other than the
 \fIAmanda\fR
-user\.
+user\&.
 .RE
 .PP
-/var/lib/amanda/backup\-pubkey\.pem
+/var/lib/amanda/backup\-pubkey\&.pem
 .RS 4
-File containing the RSA public key\.
+File containing the RSA public key\&.
 .RE
 .PP
-/var/lib/amanda/\.am_passphrase
+/var/lib/amanda/\&.am_passphrase
 .RS 4
-File containing the passphrase\. It should not be readable by any user other than the
+File containing the passphrase\&. It should not be readable by any user other than the
 \fIAmanda\fR
-user\.
+user\&.
 .RE
 .SH "SEE ALSO"
 .PP
@@ -94,7 +252,13 @@ user\.
 \fBopenssl\fR(1),
 \fBamcrypt-ossl\fR(8),
 : http://wiki.zmanda.com
-.SH "NOTES"
+.SH "Author"
+.PP
+\fBKevin Till\fR <\&kevin\&.till@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
+.SH "Notes"
 .IP " 1." 4
 www.openssl.org
 .RS 4
index 9e4903c96a8e92ba254526b73c3fe399a4b51f50..9e508d1d84d713abe99d355937a9d9c1a873242c 100644 (file)
 .\"     Title: amcrypt-ossl
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
+.\"    Author: Kevin Till <kevin.till@zmanda.com>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
 .\"
-.TH "AMCRYPT\-OSSL" "8" "08/22/2008" "" ""
+.TH "AMCRYPT\-OSSL" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
 .ad l
-.SH "NAME"
-amcrypt-ossl - crypt program for Amanda symmetric data encryption using OpenSSL
-.SH "SYNOPSIS"
-.HP 13
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amcrypt-ossl \- crypt program for \fIAmanda\fR symmetric data encryption using OpenSSL
+.SH "Synopsis"
+.fam C
+.HP \w'\fBamcrypt\-ossl\fR\ 'u
 \fBamcrypt\-ossl\fR [\-d]
+.fam
 .SH "DESCRIPTION"
 .PP
 
 \fBamcrypt\-ossl\fR
 uses
 \fBOpenSSL\fR
-to encrypt and decrypt data\. OpenSSL is available from
-www\.openssl\.org\. OpenSSL offers a wide variety of cipher choices (
+to encrypt and decrypt data\&. OpenSSL is available from
+www\&.openssl\&.org\&. OpenSSL offers a wide variety of cipher choices (
 \fBamcrypt\-ossl\fR
-defaults to 256\-bit AES) and can use hardware cryptographic accelerators on several platforms\.
+defaults to 256\-bit AES) and can use hardware cryptographic accelerators on several platforms\&.
 .PP
 
 \fBamcrypt\-ossl\fR
-will search for the OpenSSL program in the following directories: /bin:/usr/bin:/usr/local/bin:/usr/ssl/bin:/usr/local/ssl/bin\.
+will search for the OpenSSL program in the following directories: /bin:/usr/bin:/usr/local/bin:/usr/ssl/bin:/usr/local/ssl/bin\&.
 .SH "PASSPHRASE MANAGEMENT"
 .PP
 
 \fBamcrypt\-ossl\fR
-uses the same pass phrase to encrypt and decrypt data\. It is very important to store and protect the pass phrase properly\. Encrypted backup data can
+uses the same pass phrase to encrypt and decrypt data\&. It is very important to store and protect the pass phrase properly\&. Encrypted backup data can
 \fBonly\fR
-be recovered with the correct passphrase\.
+be recovered with the correct passphrase\&.
 .PP
-OpenSSL\'s key derivation routines use a salt to guard against dictionary attacks on the pass phrase; still it is important to pick a pass phrase that is hard to guess\. The Diceware method (see
-www\.diceware\.com) can be used to create passphrases that are difficult to guess and easy to remember\.
+OpenSSL\'s key derivation routines use a salt to guard against dictionary attacks on the pass phrase; still it is important to pick a pass phrase that is hard to guess\&. The Diceware method (see
+www\&.diceware\&.com) can be used to create passphrases that are difficult to guess and easy to remember\&.
 .SH "FILES"
 .PP
-/var/lib/amanda/\.am_passphrase
+/var/lib/amanda/\&.am_passphrase
 .RS 4
-File containing the pass phrase\. It should not be readable by any user other than the
+File containing the pass phrase\&. It should not be readable by any user other than the
 \fIAmanda\fR
-user\.
+user\&.
 .RE
 .SH "SEE ALSO"
 .PP
@@ -55,7 +213,13 @@ user\.
 \fBopenssl\fR(1),
 \fBamcrypt-ossl-asym\fR(8),
 : http://wiki.zmanda.com
-.SH "NOTES"
+.SH "Author"
+.PP
+\fBKevin Till\fR <\&kevin\&.till@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
+.SH "Notes"
 .IP " 1." 4
 www.openssl.org
 .RS 4
index 9b3276f3bfed1e0b751c358dd12b1aee6398f3fc..90d205cb6af6d1628bd521a33f25e81c7686a9a6 100644 (file)
 .\"     Title: amcrypt
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
+.\"    Author: Kevin Till <kevin.till@zmanda.com>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
 .\"
-.TH "AMCRYPT" "8" "08/22/2008" "" ""
+.TH "AMCRYPT" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
 .ad l
-.SH "NAME"
-amcrypt - reference crypt program for Amanda symmetric data encryption
-.SH "SYNOPSIS"
-.HP 8
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amcrypt \- reference crypt program for \fIAmanda\fR symmetric data encryption
+.SH "Synopsis"
+.fam C
+.HP \w'\fBamcrypt\fR\ 'u
 \fBamcrypt\fR
+.fam
 .SH "DESCRIPTION"
 .PP
 
@@ -24,12 +182,12 @@ requires
 \fBuuencode\fR
 and
 \fBgpg\fR
-to work\. Aespipe is available from
+to work\&. Aespipe is available from
 : http://loop-aes.sourceforge.net
 .PP
 
 \fBamcrypt\fR
-will search for the aespipe program in the following directories: /usr/bin:/usr/local/bin:/sbin:/usr/sbin\.
+will search for the aespipe program in the following directories: /usr/bin:/usr/local/bin:/sbin:/usr/sbin\&.
 .PP
 
 \fBamcrypt\fR
@@ -37,30 +195,30 @@ calls
 \fBamaespipe\fR
 and pass the
 \fBpassphrase\fR
-through file descriptor 3\. The passphrase should be stored in ~amanda/\.am_passphrase\.
-.SH "HOW TO CREATE ENCRYPTION KEYS FOR AMCRYPT"
+through file descriptor 3\&. The passphrase should be stored in ~amanda/\&.am_passphrase\&.
+.SH "How to create encryption keys for amcrypt"
 .PP
-1\. Create 65 random encryption keys and encrypt those keys using gpg\. Reading from /dev/random may take indefinitely long if kernel\'s random entropy pool is empty\. If that happens, do some other work on some other console (use keyboard, mouse and disks)\.
+1\&. Create 65 random encryption keys and encrypt those keys using gpg\&. Reading from /dev/random may take indefinitely long if kernel\'s random entropy pool is empty\&. If that happens, do some other work on some other console (use keyboard, mouse and disks)\&.
 .PP
-head \-c 2925 /dev/random | uuencode \-m \- | head \-n 66 | tail \-n 65 \e | gpg \-\-symmetric \-a > ~amanda/\.gnupg/am_key\.gpg
+head \-c 2925 /dev/random | uuencode \-m \- | head \-n 66 | tail \-n 65 \e | gpg \-\-symmetric \-a > ~amanda/\&.gnupg/am_key\&.gpg
 .PP
-This will ask for a passphrase\. Remember this passphrase as you will need it in the next step\.
+This will ask for a passphrase\&. Remember this passphrase as you will need it in the next step\&.
 .PP
-2\. Store the passphrase inside the home\-directory of the AMANDA\-user and protect it with proper permissions:
+2\&. Store the passphrase inside the home\-directory of the AMANDA\-user and protect it with proper permissions:
 .nf
-echo my_secret_passphrase > ~amanda/\.am_passphrase
-chown amanda:disk ~amanda/\.am_passphrase
-chmod 700 ~amanda/\.am_passphrase
+echo my_secret_passphrase > ~amanda/\&.am_passphrase
+chown amanda:disk ~amanda/\&.am_passphrase
+chmod 700 ~amanda/\&.am_passphrase
 .fi
-.SH "KEY AND PASSPHRASE"
+.SH "Key and Passphrase"
 .PP
 
 \fBamcrypt\fR
-uses the same key to encrypt and decrypt data\.
+uses the same key to encrypt and decrypt data\&.
 .PP
-It is very important to store and protect the key and the passphrase properly\. Encrypted backup data can
+It is very important to store and protect the key and the passphrase properly\&. Encrypted backup data can
 \fBonly\fR
-be recovered with the correct key and passphrase\.
+be recovered with the correct key and passphrase\&.
 .SH "SEE ALSO"
 .PP
 \fBamanda\fR(8),
@@ -69,3 +227,9 @@ be recovered with the correct key and passphrase\.
 \fBamaespipe\fR(8),
 \fBgpg\fR(1),
 : http://wiki.zmanda.com
+.SH "Author"
+.PP
+\fBKevin Till\fR <\&kevin\&.till@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
index cecbd1f134db855d88e38c8d4ba62db042fd6d90..4e3728f36c9aaf6091c63e3faaf88b4204c0e3bb 100644 (file)
 .\"     Title: amcryptsimple
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
+.\"    Author: Kevin Till <kevin.till@zmanda.com>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
 .\"
-.TH "AMCRYPTSIMPLE" "8" "08/22/2008" "" ""
+.TH "AMCRYPTSIMPLE" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
 .ad l
-.SH "NAME"
-amcryptsimple - reference simple crypt program for Amanda symmetric data encryption
-.SH "SYNOPSIS"
-.HP 14
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amcryptsimple \- reference simple crypt program for \fIAmanda\fR symmetric data encryption
+.SH "Synopsis"
+.fam C
+.HP \w'\fBamcryptsimple\fR\ 'u
 \fBamcryptsimple\fR  to be called by \fIAmanda\fR only 
+.fam
 .SH "DESCRIPTION"
 .PP
 
@@ -23,7 +181,7 @@ calls
 \fBgpg\fR
 to perform symmetric data encryption on
 \fIAmanda\fR
-backup\.
+backup\&.
 \fBamcryptsimple\fR
 will search for the gpg program in the following directories: /usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin
 .PP
@@ -33,28 +191,25 @@ uses one passphrase to encrypt the
 \fIAmanda\fR
 data and uses the same passphrase to decrypt the
 \fIAmanda\fR
-backup data\.
+backup data\&.
 \fBamcryptsimple\fR
-uses AES256 as the symmetric cipher\.
-.SH "HOW TO CREATE PASSPHRASE"
+uses AES256 as the symmetric cipher\&.
+.SH "How to Create Passphrase"
 
 
 Store  the  passphrase  inside the home\-directory of the AMANDA\-user($amanda_user) and protect it with proper permissions:
 
-   echo my_secret_passphrase > ~$amanda_user/\.am_passphrase
-   chown $amanda_user:disk ~$amanda_user/\.am_passphrase
-   chmod 700 ~$amanda_user/\.am_passphrase
+   echo my_secret_passphrase > ~$amanda_user/\&.am_passphrase
+   chown $amanda_user:disk ~$amanda_user/\&.am_passphrase
+   chmod 700 ~$amanda_user/\&.am_passphrase
 .SH "NOTES"
 .PP
-Choose a good passphrase and protect it properly\. Backup data can only be restored with the passphrase\. There is no backdoor\.
+Choose a good passphrase and protect it properly\&. Backup data can only be restored with the passphrase\&. There is no backdoor\&.
 .PP
 If storing and securing passphrase in your environment presents challenges,
 \fIAmanda\fR
 provide public\-key data encryption through
-\fBamgpgcrypt\fR\. Public\-key encryption uses the public key to encrypt and uses the private key to decrypt\.
-.SH "AUTHOR"
-.PP
-The tool and its documentation was written by Zmanda, Inc (http://www\.zmanda\.com/)\.
+\fBamgpgcrypt\fR\&. Public\-key encryption uses the public key to encrypt and uses the private key to decrypt\&.
 .SH "SEE ALSO"
 .PP
 \fBamanda\fR(8),
@@ -64,3 +219,9 @@ The tool and its documentation was written by Zmanda, Inc (http://www\.zmanda\.c
 \fBamrestore\fR(8),
 \fBgpg\fR(1),
 : http://wiki.zmanda.com
+.SH "Author"
+.PP
+\fBKevin Till\fR <\&kevin\&.till@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
diff --git a/man/amdd.8 b/man/amdd.8
deleted file mode 100644 (file)
index 55382d4..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-.\"     Title: amdd
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
-.\"
-.TH "AMDD" "8" "08/22/2008" "" ""
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.SH "NAME"
-amdd - Amanda version of dd
-.SH "SYNOPSIS"
-.HP 5
-\fBamdd\fR [\-d] [\fIif=input\fR] [\fIof=output\fR] [\fIbs=blocksize\fR] [\fIskip=count\fR] [\fIcount=count\fR]
-.SH "DESCRIPTION"
-.PP
-\fBAmdd\fR
-provides just enough of the standard UNIX
-\fBdd\fR
-command for the needs of
-\fIAmanda\fR\. This is handy when doing a full restore and the standard
-\fBdd\fR
-program has not yet been found\.
-.PP
-\fBAmdd\fR
-also provides access to the
-\fIAmanda\fR
-output drivers that support various tape simulations\. This may be used for debugging or to convert from one format to another\.
-.PP
-See the
-\fBamanda\fR(8)
-man page for more details about
-\fIAmanda\fR\. See the
-\fBOUTPUT DRIVERS\fR
-section of
-\fIamanda(8)\fR
-for more information on the
-\fIAmanda\fR
-output drivers\.
-.SH "OPTIONS"
-.PP
-\fB\-d\fR
-.RS 4
-Turn on debugging output\.
-.RE
-.PP
-\fB\-l\fR\fIlength\fR
-.RS 4
-Set the output length\. If the output driver limits the output size, this controls when end of tape will be simulated\.
-.sp
-\fILength\fR
-may have a multiplier suffix:
-.sp
-.RS 4
-.nf
-k \-> 1024 (Kilobytes)
-b \-> 512 (Blocks)
-M \-> 1024*1024 (Megabytes)
-.fi
-.RE
-The default is no multiplier (bytes)\.
-.RE
-.PP
-\fBif=\fR\fIinput\fR
-.RS 4
-Input to
-\fBdd\fR\. Default is stdin\.
-.RE
-.PP
-\fBof=\fR\fIoutput\fR
-.RS 4
-Where to send the output of
-\fBdd\fR\. Default is stdout\.
-.RE
-.PP
-\fBbs=\fR\fIblocksize\fR
-.RS 4
-Size of each record\. Input records smaller than this will
-\fInot\fR
-be padded\. Output records will be the same size as the corresponding input record\. Default is 512 bytes\.
-.sp
-\fIBlocksize\fR
-may have a multiplier suffix:
-.sp
-.RS 4
-.nf
-k \-> 1024 (Kilobytes)
-b \-> 512 (Blocks)
-M \-> 1024*1024 (Megabytes)
-.fi
-.RE
-The default is no multiplier (bytes)\.
-.RE
-.PP
-\fBcount=\fR\fIcount\fR
-.RS 4
-Number of records to copy\. Default is all records until end of file\.
-.RE
-.PP
-\fBskip=\fR\fIcount\fR
-.RS 4
-Number of records to skip before copying input to output\. Default is zero\.
-.RE
-.SH "AUTHOR"
-.PP
-Marc Mengel
-<mengel@fnal\.gov>, John R\. Jackson
-<jrj@purdue\.edu>
-: Original text
-.PP
-Stefan G\. Weichinger,
-<sgw@amanda\.org>, maintainer of the
-\fIAmanda\fR\-documentation: XML\-conversion
-.SH "SEE ALSO"
-.PP
-
-\fBamanda\fR(8),
-: http://wiki.zmanda.com
index a9b403ecbcf2a043abfb9568464585b02f500848..452c4450d383ad1a6dce9ea274fce11bb7302d04 100644 (file)
 .\"     Title: amdevcheck
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
+.\"    Author: Ian Turner <ian@zmanda.com>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
 .\"
-.TH "AMDEVCHECK" "8" "08/22/2008" "" ""
+.TH "AMDEVCHECK" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
 .ad l
-.SH "NAME"
-amdevcheck - Validate an Amanda device and volume.
-.SH "SYNOPSIS"
-.HP 11
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amdevcheck \- Validate an \fIAmanda\fR device and volume\&.
+.SH "Synopsis"
+.fam C
+.HP \w'\fBamdevcheck\fR\ 'u
 \fBamdevcheck\fR \fIconfig\fR [\fIdevice\ name\fR] [\-o\ \fIconfigoption\fR]...
+.fam
 .SH "DESCRIPTION"
 .PP
 
 \fBAmdevcheck\fR
 provides a way to check that a particular
 \fIAmanda\fR
-device is accessible, whether or not it contains a volume, and whether or not that volume is labeled\. Some devices can\'t distinguish between all of these cases; a missing volume and an unlabeled volume might generate the same error code, for example\. In those cases, this tool reports all possible causes of the error\.
+device is accessible, whether or not it contains a volume, and whether or not that volume is labeled\&. Some devices can\'t distinguish between all of these cases; a missing volume and an unlabeled volume might generate the same error code, for example\&. In those cases, this tool reports all possible causes of the error\&.
 .PP
 See the
 \fBamanda\fR(8)
 man page for more details about
-\fIAmanda\fR\. See the
-\fBOUTPUT DRIVERS\fR
-section of
-\fIamanda(8)\fR
-for more information on the
-\fIAmanda\fR
-output drivers\.
+\fIAmanda\fR\&. See
+\fBamanda-devices\fR(7)
+for more information on devices\&.
 .SH "OPTIONS"
 .PP
 \fIconfig\fR
 .RS 4
 
 \fIAmanda\fR
-configuration to use\. Note that
+configuration to use\&. Note that
 \fBamdevcheck\fR
-ignores any tape changer configuration\.
+ignores any tape changer configuration\&.
 .RE
 .PP
 \fI device\fR
 .RS 4
 
 \fIAmanda\fR
-device to use\. This option overrides any tapedev configuration specified in the configuration file\.
+device to use\&. This option overrides any tapedev configuration specified in the configuration file\&.
 .RE
 .PP
 \fB\-o\fR \fIclientconfigoption\fR
 .RS 4
 See the "\fBCONFIGURATION OVERRIDE\fR" section in
-\fBamanda\fR(8)\.
+\fBamanda\fR(8)\&.
+.RE
+.SH "OUTPUT"
+\fBAmdevcheck\fR returns one or more of the following lines\&. If multiple lines appear, then at least one, but not necessarily all of
+the messages apply\&.  This situation can occur when working with hardware or
+operating systems which cannot distinguish, for example, between a
+malfunctioning drive and a functional but unloaded drive\&.
+.PP
+\fBSUCCESS\fR
+.RS 4
+A tape is ready\&.
+.RE
+.PP
+\fBDEVICE_ERROR\fR
+.RS 4
+A device error has occurred\&.
+.RE
+.PP
+\fBDEVICE_BUSY\fR
+.RS 4
+The device is busy\&.
+.RE
+.PP
+\fBVOLUME_MISSING\fR
+.RS 4
+No tape is loaded in the drive\&.
+.RE
+.PP
+\fBVOLUME_UNLABELED\fR
+.RS 4
+The tape in the drive is unlabeled\&.
+.RE
+.PP
+\fBVOLUME_ERROR\fR
+.RS 4
+A volume error has occurred\&.
 .RE
-.SH "AUTHOR"
 .PP
-Ian Turner
-<ian@zmanda\.com>
-and others\. Authorship of this tool and its documentation was funded by Zmanda, Inc\.
+\fBMESSAGE\fR \fItext\fR
+.RS 4
+Where text provides a human\-readable description of the problem\&.
+.RE
 .SH "SEE ALSO"
 .PP
 
 \fBamanda\fR(8),
 \fBammt\fR(8),
 : http://wiki.zmanda.com
+.SH "Author"
+.PP
+\fBIan Turner\fR <\&ian@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
index 90b963c88b3c7e8d58952a6b25bb6d30af5be915..0889853d1e601c908f9ff39f22c244ddf74b01cf 100644 (file)
 .\"     Title: amdump
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
+.\"    Author: James da Silva <jds@amanda.org>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
 .\"
-.TH "AMDUMP" "8" "08/22/2008" "" ""
+.TH "AMDUMP" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
 .ad l
-.SH "NAME"
-amdump - back up all disks in an Amanda configuration
-.SH "SYNOPSIS"
-.HP 7
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amdump \- back up all disks in an \fIAmanda\fR configuration
+.SH "Synopsis"
+.fam C
+.HP \w'\fBamdump\fR\ 'u
 \fBamdump\fR \fIconfig\fR [\fIhost\fR\ [\fIdisk\fR...]...] [\-o\ \fIconfigoption\fR]...
+.fam
 .SH "DESCRIPTION"
 .PP
 \fBAmdump\fR
 switches to the appropriate
 \fIAmanda\fR
-configuration directory, e\.g\. /usr/local/etc/amanda/\fIconfig\fR, then attempts to back up every disk specified by the
-\fIamanda\.conf\fR
-file\.
+configuration directory, e\&.g\&. /usr/local/etc/amanda/\fIconfig\fR, then attempts to back up every disk specified by the
+\fIamanda\&.conf\fR
+file\&.
 \fBAmdump\fR
 is normally run by
-\fBcron\fR\.
+\fBcron\fR\&.
 .PP
-You can specify many host/disk expressions, only disks that match an expression will be dumped\. All disks are dumped if no expressions are given\.
+You can specify many host/disk expressions, only disks that match an expression will be dumped\&. All disks are dumped if no expressions are given\&.
 .PP
 If the file /usr/local/etc/amanda/\fIconfig\fR/hold exists,
 \fBamdump\fR
-will wait until it is removed before starting the backups\. This allows scheduled backups to be delayed when circumstances warrant, for example, if the tape device is being used for some other purpose\. While waiting,
+will wait until it is removed before starting the backups\&. This allows scheduled backups to be delayed when circumstances warrant, for example, if the tape device is being used for some other purpose\&. While waiting,
 \fBamdump\fR
-checks for the hold file every minute\.
+checks for the hold file every minute\&.
 .PP
 See the
 \fBamanda\fR(8)
 man page for more details about
-\fIAmanda\fR\.
+\fIAmanda\fR\&.
 .SH "OPTIONS"
 .PP
 \fIhost\fR [\fIdisk\fR]*
 .RS 4
-Specify the host and disk on which the command will work\.
+Specify the host and disk on which the command will work\&.
 .RE
 .PP
 \fB\-o\fR \fIconfigoption\fR
 .RS 4
 See the "\fBCONFIGURATION OVERRIDE\fR" section in
-\fBamanda\fR(8)\.
+\fBamanda\fR(8)\&.
 .RE
 .SH "EXAMPLE"
 .PP
-Here is a typical crontab entry\. It runs
+Here is a typical crontab entry\&. It runs
 \fBamdump\fR
-every weeknight at 1 a\.m\. as user
+every weeknight at 1 a\&.m\&. as user
 \fBbin\fR:
 .nf
 0 1 * * 1\-5 bin /usr/local/sbin/amdump daily
@@ -65,14 +223,14 @@ Please see the
 \fBcrontab\fR(5)
 or
 \fBcrontab\fR(1)
-manual page for the correct crontab format for your system\.
+manual page for the correct crontab format for your system\&.
 .SH "MESSAGES"
 .PP
 amdump: waiting for hold file to be removed
 .RS 4
 The "hold" file exists and
 \fBamdump\fR
-is waiting for it to be removed before starting backups\.
+is waiting for it to be removed before starting backups\&.
 .RE
 .PP
 amdump: amdump or amflush is already running, or you must run amcleanup
@@ -85,10 +243,10 @@ running, or the remains of a previous incomplete
 \fBamdump\fR
 or
 \fBamflush\fR
-run\. This run is terminated\. If the problem is caused by the remains of a previous run, you must execute
+run\&. This run is terminated\&. If the problem is caused by the remains of a previous run, you must execute
 \fBamcleanup\fR(8)
 and then rerun
-\fBamdump\fR\.
+\fBamdump\fR\&.
 .RE
 .SH "EXIT CODE"
 
@@ -101,15 +259,6 @@ The exit code of \fBamdump\fR is the ORed value of:
  8  = Don\'t know the status of a dle (RESULT_MISSING in the report)
  16 = tape error or no more tape
 .fi
-.SH "AUTHOR"
-.PP
-James da Silva,
-<jds@amanda\.org>
-: Original text
-.PP
-Stefan G\. Weichinger,
-<sgw@amanda\.org>, maintainer of the
-\fIAmanda\fR\-documentation: XML\-conversion
 .SH "SEE ALSO"
 .PP
 
@@ -120,3 +269,8 @@ Stefan G\. Weichinger,
 \fBamflush\fR(8),
 \fBcron\fR(8),
 : http://wiki.zmanda.com
+.SH "Authors"
+.PP
+\fBJames da Silva\fR <\&jds@amanda\&.org\&>
+.PP
+\fBStefan G\&. Weichinger\fR <\&sgw@amanda\&.org\&>
index 903599012c943f48559fbd364ade4690a1e3acd5..af28b2e34b619d943c6ab534903e8e5b73964b37 100644 (file)
 .\"     Title: amfetchdump
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
+.\"    Author: John Stange <building@nap.edu>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
 .\"
-.TH "AMFETCHDUMP" "8" "08/22/2008" "" ""
+.TH "AMFETCHDUMP" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
 .ad l
-.SH "NAME"
-amfetchdump - extract backup images from multiple Amanda tapes.
-.SH "SYNOPSIS"
-.HP 12
-\fBamfetchdump\fR [\-pcClawns] [\-d\ \fIdevice\fR] [\-O\ \fIdirectory\fR] [\-b\ \fIblocksize\fR] \fIconfig\fR \fIhostname\fR [\fIdisk\fR\ [\ \fIdate\fR\ [\ \fIlevel\fR\ [\ \fIhostname\fR\ [\.\.\.]\ ]\ ]\ ]] [\-o\ \fIconfigoption\fR]...
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amfetchdump \- extract backup images from multiple \fIAmanda\fR tapes\&.
+.SH "Synopsis"
+.fam C
+.HP \w'\fBamfetchdump\fR\ 'u
+\fBamfetchdump\fR [\-pcClawns] [\-d\ \fIdevice\fR] [\-O\ \fIdirectory\fR] [\-b\ \fIblocksize\fR] \fIconfig\fR \fIhostname\fR [\fIdisk\fR\ [\ \fIdate\fR\ [\ \fIlevel\fR\ [\ \fIhostname\fR\ [\&.\&.\&.]\ ]\ ]\ ]] [\-o\ \fIconfigoption\fR]...
+.fam
 .SH "DESCRIPTION"
 .PP
 \fBAmfetchdump\fR
-pulls one or more matching dumps from tape or from the holding disk, handling the reassembly of multi\-tape split dump files as well as any tape autochanger operations\.
+pulls one or more matching dumps from tape or from the holding disk, handling the reassembly of multi\-tape split dump files as well as any tape autochanger operations\&.
 .PP
 It will automatically use the logs created by
 \fBamdump\fR(8)
@@ -26,7 +184,7 @@ to locate available dumps on tape, in the same way that the
 \fBfind\fR
 feature of
 \fBamadmin\fR(8)
-lists available dumps\. If these logs are unavailable, it can search tape\-by\-tape to find what it needs, and can generate new logs to serve as an emergency tape inventory\.
+lists available dumps\&. If these logs are unavailable, it can search tape\-by\-tape to find what it needs, and can generate new logs to serve as an emergency tape inventory\&.
 .PP
 The
 \fIhostname\fR,
@@ -36,127 +194,122 @@ The
 dump pattern\-matching works as in
 \fBamrestore\fR(8), with the added requirement that at minimum a
 \fIhostname\fR
-must be specified when not in inventory mode\.
+must be specified when not in inventory mode\&.
 .PP
 Unless
 \fB\-p\fR
 is used, backup images are extracted to files in the current directory named:
 .PP
-\fIhostname\.diskname\.datestamp\.dumplevel\fR
+\fIhostname\&.diskname\&.datestamp\&.dumplevel\fR
 .SH "OPTIONS"
 .PP
 \fB\-p\fR
 .RS 4
 Pipe exactly one complete dump file to
-\fIstdout\fR, instead of writing the file to disk\. This will restore only the first matching dumpfile (where "first" is determined by the dump log search facility)\.
+\fIstdout\fR, instead of writing the file to disk\&. This will restore only the first matching dumpfile (where "first" is determined by the dump log search facility)\&.
 .RE
 .PP
 \fB\-d\fR \fIdevice\fR
 .RS 4
-Restore from this tape device instead of the default\.
+Restore from this tape device instead of the default\&.
 .RE
 .PP
 \fB\-O\fR \fIdirectory\fR
 .RS 4
-Output restored files to this directory, instead of to the current working directory\.
+Output restored files to this directory, instead of to the current working directory\&.
 .RE
 .PP
 \fB\-c\fR
 .RS 4
-Compress output, fastest method available\.
+Compress output, fastest method available\&.
 .RE
 .PP
 \fB\-C\fR
 .RS 4
-Compress output, smallest file size method available\.
+Compress output, smallest file size method available\&.
 .RE
 .PP
 \fB\-l\fR
 .RS 4
-Leave dumps in the compressed/uncompressed state in which they were found on tape\. By default,
+Leave dumps in the compressed/uncompressed state in which they were found on tape\&. By default,
 \fBamfetchdump\fR
-will automatically uncompress when restoring\.
+will automatically uncompress when restoring\&.
 .RE
 .PP
 \fB\-a\fR
 .RS 4
-Assume that all tapes are already available, via tape changer or otherwise, instead of prompting the operator to ensure that all tapes are loaded\.
+Assume that all tapes are already available, via tape changer or otherwise, instead of prompting the operator to ensure that all tapes are loaded\&.
 .RE
 .PP
 \fB\-w\fR
 .RS 4
-Wait to put split dumps together until all chunks have been restored\. Normally,
+Wait to put split dumps together until all chunks have been restored\&. Normally,
 \fBamfetchdump\fR
-will attempt to read pieces of a split file from tape in order, so that it can assemble them simply by appending each file to the first\. This option disables the appending behavior, and instead restores each piece as an individual file and reassembles them only after all have been restored\.
+will attempt to read pieces of a split file from tape in order, so that it can assemble them simply by appending each file to the first\&. This option disables the appending behavior, and instead restores each piece as an individual file and reassembles them only after all have been restored\&.
+.if n \{\
 .sp
+.\}
+.RS 4
+.BM yellow
 .it 1 an-trap
 .nr an-no-space-flag 1
 .nr an-break-flag 1
 .br
-Note
-This requires at least double the size of your dump in free disk space, in order to build the final assembled dumpfile\.
-
-This behavior is implicitly invoked in circumstances where knowing the location of all dumps on tape in advance is not possible, such as when you are restoring without log files\.
+.ps +1
+\fBNote\fR
+.ps -1
+.br
+This requires at least double the size of your dump in free disk space, in order to build the final assembled dumpfile\&.
+.sp .5v
+.EM yellow
+.RE
+This behavior is implicitly invoked in circumstances where knowing the location of all dumps on tape in advance is not possible, such as when you are restoring without log files\&.
 .RE
 .PP
 \fB\-n\fR
 .RS 4
-Do not reassemble split dump files at all, just restore each piece as an individual file\.
+Do not reassemble split dump files at all, just restore each piece as an individual file\&.
 .RE
 .PP
 \fB\-s\fR
 .RS 4
-Do not fast\-forward straight to needed files on tape\. This will slow down most restores substantially\. Only use this option if your tape drive does not properly support the fast\-forward operation\.
+Do not fast\-forward straight to needed files on tape\&. This will slow down most restores substantially\&. Only use this option if your tape drive does not properly support the fast\-forward operation\&.
 .RE
 .PP
 \fB\-b\fR \fIblocksize\fR
 .RS 4
-Force a particular block size when reading from tapes\. This value will usually be autodetected, and should not normally need to be set\.
+Force a particular block size when reading from tapes\&. This value will usually be autodetected, and should not normally need to be set\&.
 .RE
 .PP
 \fB\-o\fR \fIconfigoption\fR
 .RS 4
 See the "\fBCONFIGURATION OVERRIDE\fR" section in
-\fBamanda\fR(8)\.
+\fBamanda\fR(8)\&.
 .RE
 .SH "EXAMPLES"
 .PP
 All the examples here assume your configuration is called
-\fISetA\fR\.
+\fISetA\fR\&.
 .PP
-Here\'s a simple case, restoring all known dumps of the host vanya to the current working directory\.
-.sp
-.RS 4
+Here\'s a simple case, restoring all known dumps of the host vanya to the current working directory\&.
 .nf
 $ amfetchdump SetA vanya
 .fi
-.RE
 .PP
-A more likely scenario involves restoring a particular dump from a particular date\. We\'ll pipe this one to
+A more likely scenario involves restoring a particular dump from a particular date\&. We\'ll pipe this one to
 \fBGNU\-tar\fR
-as well, to automatically extract the dump\.
-.sp
-.RS 4
+as well, to automatically extract the dump\&.
 .nf
 $ amfetchdump \-p SetA vanya /home 20051020 | gtar \-xvpf \-
 .fi
-.RE
-.sp
 .SH "CAVEATS"
 .PP
 \fBAmfetchdump\fR
-is dependent on accessing your server\'s config, tape changer, and (normally) dump logs\. As such, it\'s not necessarily the most useful tool when those have all been wiped out and you desperately need to pull things from your tape\. Pains have been taken to make it as capable as possible, but for seriously minimialist restores, look to
+is dependent on accessing your server\'s config, tape changer, and (normally) dump logs\&. As such, it\'s not necessarily the most useful tool when those have all been wiped out and you desperately need to pull things from your tape\&. Pains have been taken to make it as capable as possible, but for seriously minimialist restores, look to
 \fBamrestore\fR(8)
 or
 \fBdd\fR(8)
-instead\.
-.SH "AUTHOR"
-.PP
-John Stange,
-<building@nap\.edu>, National Academies Press
-.PP
-Ian Turner,
-<ian@zmanda\.com>: XML\-conversion
+instead\&.
 .SH "SEE ALSO"
 .PP
 \fBamanda\fR(8),
@@ -165,3 +318,14 @@ Ian Turner,
 \fBtar\fR(1),
 \fBrestore\fR(8),
 : http://wiki.zmanda.com
+.SH "Authors"
+.PP
+\fBJohn Stange\fR <\&building@nap\&.edu\&>
+.RS 4
+National Academies Press
+.RE
+.PP
+\fBIan Turner\fR <\&ian@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
index 7568e4035a874576e61b466a9bdf515db1f492ed..26a50eeaa17a1c57f7fd4c411591ac1cc5ee8720 100644 (file)
 .\"     Title: amflush
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
+.\"    Author: James da Silva <jds@amanda.org>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
 .\"
-.TH "AMFLUSH" "8" "08/22/2008" "" ""
+.TH "AMFLUSH" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
 .ad l
-.SH "NAME"
-amflush - flush Amanda backup files from holding disk to tape
-.SH "SYNOPSIS"
-.HP 8
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amflush \- flush \fIAmanda\fR backup files from holding disk to tape
+.SH "Synopsis"
+.fam C
+.HP \w'\fBamflush\fR\ 'u
 \fBamflush\fR [\-b] [\-f] [\-s] [\-D\ \fIdatestamp\fR] \fIconfig\fR [\fIhost\fR\ [\fIdisk\fR...]...] [\-o\ \fIconfigoption\fR]...
+.fam
 .SH "DESCRIPTION"
 .PP
 \fBAmflush\fR
@@ -22,108 +180,115 @@ writes
 \fIAmanda\fR
 backups from the holding disks to tape, and updates the
 \fIAmanda\fR
-info database and tapelist accordingly\. Backups may stay in a holding disk when something is wrong with the tape at the time
+info database and
+\fBtapelist\fR(5)
+accordingly\&. Backups may stay in a holding disk when something is wrong with the tape at the time
 \fBamdump\fR
-is run\. When this happens, the problem must be corrected and
+is run\&. When this happens, the problem must be corrected and
 \fBamflush\fR
-run by hand\.
+run by hand\&.
 .SH "OPTIONS"
 .PP
 \fB\-b\fR
 .RS 4
 Run
 \fBamflush\fR
-in batch mode\. All datestamps are selected unless specified\. The flush is started without confirmation\.
+in batch mode\&. All datestamps are selected unless specified\&. The flush is started without confirmation\&.
 .RE
 .PP
 \fB\-f\fR
 .RS 4
 Run
 \fBamflush\fR
-in foreground\.
+in foreground\&.
 \fBAmflush\fR
-normally detaches itself from the tty and runs as a background process\. With the
+normally detaches itself from the tty and runs as a background process\&. With the
 \fB\-f\fR
 option,
 \fBamflush\fR
-stays in the foreground\. This is useful if
+stays in the foreground\&. This is useful if
 \fBamflush\fR
-is run as part of another script that, for example, advances the tape after the flush is completed\.
+is run as part of another script that, for example, advances the tape after the flush is completed\&.
 .RE
 .PP
 \fB\-s\fR
 .RS 4
-Write log to stdout/stderr instead of the amflush log file\. Requires the
+Write log to stdout/stderr instead of the amflush log file\&. Requires the
 \fB\-f\fR
-option\.
+option\&.
 .RE
 .PP
 \fB\-D datestamp\fR
 .RS 4
 specify a datestamp expression you want to flush, see the "DATESTAMP EXPRESSION" section of
 \fBamanda\fR(8)
-for a description\.
+for a description\&.
 \fB\-D 20001225\-7\fR
-will flush all dumps from 25 december 2000 to 27 december 2000\.
+will flush all dumps from 25 december 2000 to 27 december 2000\&.
 .RE
 .PP
 \fIhost\fR [\fIdisk\fR]*
 .RS 4
-Specify the host and disk on which the command will work\.
+Specify the host and disk on which the command will work\&.
 .RE
 .PP
 \fB\-o\fR \fIconfigoption\fR
 .RS 4
 See the "\fBCONFIGURATION OVERRIDE\fR" section in
-\fBamanda\fR(8)\.
+\fBamanda\fR(8)\&.
 .RE
 .PP
-You can specify many host/disk expressions, only disks that match an expression will be flushed\. All disks are flushed if no expressions are given\. see the "HOST & DISK EXPRESSION" section of
+You can specify many host/disk expressions, only disks that match an expression will be flushed\&. All disks are flushed if no expressions are given\&. see the "HOST & DISK EXPRESSION" section of
 \fBamanda\fR(8)
-for a description\.
+for a description\&.
 .PP
 \fBAmflush\fR
 will look in the holding disks specified by the
-\fIamanda\.conf\fR
+\fIamanda\&.conf\fR
 file in /usr/local/etc/amanda/\fIconfig\fR
 for any non\-empty
 \fIAmanda\fR
-work directories\. It then prompts you to select a directory or to process all of the directories\. The work directories in the holding disks are named by the date at the time
+work directories\&. It then prompts you to select a directory or to process all of the directories\&. The work directories in the holding disks are named by the date at the time
 \fBamdump\fR
-was run, e\.g\.
-19910215\.
+was run, e\&.g\&.
+\FC19910215\F[]\&.
 .PP
 See the
 \fBamanda\fR(8)
 man page for more details about
-\fIAmanda\fR\.
+\fIAmanda\fR\&.
 .SH "EXAMPLE"
 .PP
 \fBAmflush\fR
 will search for holding areas associated with the
 \fIdaily\fR
-configuration\. After you select which holding area to flush,
+configuration\&. After you select which holding area to flush,
 \fBamflush\fR
 writes the data to tape, updates the databases and sends a mail report similar to
-\fBamdump\fR(8)\.
+\fBamdump\fR(8)\&.
 .nf
-% amflush daily
-Scanning /amanda\-hold\.\.\.
-  20001113: found \fIAmanda\fR directory\.
-  20001114: found \fIAmanda\fR directory\.
+% amflush MyConfig
+Scanning /amanda\-hold\&.\&.\&.
+  20001113: found \fIAmanda\fR directory\&.
+  20001114: found \fIAmanda\fR directory\&.
 
 Multiple \fIAmanda\fR directories, please pick one by letter:
-  A\. 20001113
-  B\. 20001114
-Select directories to flush [A\.\.B]: [ALL] all
+  A\&. 20001113
+  B\&. 20001114
+Select directories to flush [A\&.\&.B]: [ALL] all
 
 Flushing dumps in 20001113, 20001114,
 today: 20001117
-to tape drive /dev/rmt/0mn\.
-Expecting tape DMP014 or a new tape\.  (The last dumps were to tape DMP013)
+to tape drive /dev/rmt/0mn\&.
+Expecting tape DMP014 or a new tape\&.  (The last dumps were to tape DMP013)
 Are you sure you want to do this? yes
-Running in background, you can log off now\.
-You\'ll get mail when amflush is finished\.
+Running in background, you can log off now\&.
+You\'ll get mail when amflush is finished\&.
+.fi
+.PP
+The following example causes amflush to flush everything to tape, then ejects tape, using \'at\' to run the task in the background\&.
+.nf
+% echo \'amflush \-b \-f MyConfig && mt offline\' | at now
 .fi
 .SH "EXIT CODE"
 
@@ -135,18 +300,14 @@ The exit code of \fBamflush\fR is the ORed value of:
  8  = Don\'t know the status of a dle (RESULT_MISSING in the report)
  16 = tape error or no more tape
 .fi
-.SH "AUTHOR"
-.PP
-James da Silva,
-<jds@amanda\.org>
-: Original text
-.PP
-Stefan G\. Weichinger,
-<sgw@amanda\.org>, maintainer of the
-\fIAmanda\fR\-documentation: XML\-conversion
 .SH "SEE ALSO"
 .PP
 
 \fBamanda\fR(8),
 \fBamdump\fR(8),
 : http://wiki.zmanda.com
+.SH "Authors"
+.PP
+\fBJames da Silva\fR <\&jds@amanda\&.org\&>
+.PP
+\fBStefan G\&. Weichinger\fR <\&sgw@amanda\&.org\&>
index 753a845d050a3dee106cbfbff424246d841e0cb9..07e7524c4ec7b7607aec29b152e0e9888198f55c 100644 (file)
 .\"     Title: amgetconf
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
+.\"    Author: Jean-Louis Martineau <martineau@zmanda.com>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
 .\"
-.TH "AMGETCONF" "8" "08/22/2008" "" ""
+.TH "AMGETCONF" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
 .ad l
-.SH "NAME"
-amgetconf - look up amanda.conf variables
-.SH "SYNOPSIS"
-.HP 10
-\fBamgetconf\fR [\fIconfig\fR] [\fI\-\-list\fR] \fIparameter\fR [\-o\ \fIconfigoption\fR]...
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amgetconf \- look up configuration parameters and manipulate debug logs
+.SH "Synopsis"
+.fam C
+.HP \w'\fBamgetconf\fR\ 'u
+\fBamgetconf\fR [\fI\-l|\-\-list\fR] [\-o\ \fIconfigoption\fR]... [\fI\-\-client\fR] [\fI\-\-execute\-where\ client|server\fR] [\fIconfig\fR] \fIparameter\fR
+.fam
 .SH "DESCRIPTION"
 .PP
 \fBAmgetconf\fR
-looks up parameters in
-\fIamanda\.conf\fR, the
-\fIAmanda\fR
-configuration file, or from the build and runtime environment, and returns their corresponding value\.
+has three main jobs:
+to fetch configuration information from the Amanda configuration; to fetch build\-time configuration values; and to open and close debug logs for shell scripts\&. Each is treated in its own subsection, below\&.
 .PP
 If
 \fIconfig\fR
 is not specified,
 \fBamgetconf\fR
 assumes it is being run from the configuration directory and that
-\fIamanda\.conf\fR
-is present\.
-.PP
-If
+\fIamanda\&.conf\fR
+is present\&. The order of options and arguments does not matter\&.
 \fIparameter\fR
-begins with
-\fIbuild\.\fR, the (case insensitive) string following the period is a build environment variable\. Variables without a value (e\.g\.
-\fIXFSDUMP\fR
-on a system that does not support that type of file system) will not report an error and will return an empty string as the value\. Flag variables (e\.g\.
-\fIUSE_AMANDAHOSTS\fR) will return
-1
-if the flag is set or an empty string if it is not\.
+is always case\-insensitive, and \'\-\' and \'_\' are treated as identical, just as in
+\fBamanda.conf\fR(5)\&.
+.PP
+See the "\fBCONFIGURATION OVERRIDE\fR" section in
+\fBamanda\fR(8)
+for information on the
+\FC\-o\F[]
+option\&.
+.SS "AMANDA CONFIGURATION"
 .PP
 If
 \fIparameter\fR
-begins with
-\fIdbopen\.\fR, the string following the period is a program name and an
-\fIAmanda\fR
-debug file will be created for the caller\. The name of the file is returned\.
+is a configuration keyword (from
+\fBamanda.conf\fR(5)), then amgetconf will return the corresponding value\&. For keywords which can take multiple values, amgetconf will return all values, one on each line\&.
+.PP
+Values in configuration subsections are specified with parameters of the form
+\FCTYPE:NAME:PARAMETER\F[], where
+\FCTYPE\F[]
+is the subsection type (one of
+\FCdumptype\F[],
+\FCtapetype\F[],
+\FCinterface\F[],
+\FCholdingdisk\F[],
+\FCapplication\-tool\F[], or
+\FCscript\-tool\F[];
+\FCNAME\F[]
+is the name of the subsection (e\&.g\&.,
+\FCuser\-tar\F[]), and
+\FCPARAMETER\F[]
+is the name of the disired parameter within that subsection\&.
+.PP
+The
+\FC\-\-list\F[]
+option lists the subsections of a certain type, where the type is givein as the parameter\&.
+.PP
+The
+\FC\-\-client\F[]
+option is equivalent to
+\FC\-\-execute\-where server\F[]
+(below)\&.
+.PP
+The
+\FC\-\-execute\-where\F[]
+option tells amgetconf whether to operate on the client or the server; the server is the default\&.
+.SS "BUILD CONFIGURATION"
 .PP
 If
 \fIparameter\fR
 begins with
-\fIdbclose\.\fR, the string following the period is a program name previously used with
-\fIdbopen\.\fR, followed by a colon (:) and the previously opened file name\.
+\FCbuild\&.\F[], then the following name is a build environment variable\&. Variables without a value (e\&.g\&.
+\FCXFSDUMP\F[]
+on a system that does not support that type of file system) will not report an error and will return an empty string as the value\&. Some boolean variables (e\&.g\&.
+\fIUSE_AMANDAHOSTS\fR) will return
+\FC1\F[]
+if the flag is set or an empty string if it is not, while others return
+\FCyes\F[]
+or
+\FCno\F[], as indicated below (the difference is historical)\&.
 .PP
-See the
-\fBamanda\fR(8)
-man page for more details about
-\fIAmanda\fR\.
-.SH "OPTIONS"
+Combining the
+\FC\-\-list\F[]
+option with the parameter
+\FCbuild\F[]
+will enumerate all available build parameters\&.
+.PP
+\fBBuild Parameters\fR
 .PP
-\fB\-\-list\fR
+\FCbindir\F[], \FCsbindir\F[], \FClibexecdir\F[], \FCmandir\F[]
 .RS 4
-The parameter must be \'tapetype\', \'dumptype, \'holdingdisk\' or \'interface\'\. It will output, one by line, the list of identifier for the parameter\.
+Install directories
+.RE
+.PP
+\FCAMANDA_TMPDIR\F[], \FCCONFIG_DIR\F[], \FCAMANDA_DBGDIR\F[], \FCGNUTAR_LISTED_INCREMENTAL_DIR\F[]
+.RS 4
+Runtime directories
+.RE
 .PP
-\-\-list tapetype
+\FClisted_inc_dir\F[]
 .RS 4
-Output the list of tapetype, one by line\.
+Same as
+\FCGNUTAR_LISTED_INCREMENTAL_DIR\F[]
 .RE
 .PP
-\-\-list dumptype
+\FCCC\F[], \FCVERSION\F[], \FCASSERTIONS\F[], \FCLOCKING\F[], \FCUSE_VERSION_SUFFIXES\F[]
 .RS 4
-Output the list of dumptype, one by line\.
+Build information\&.
+\FCASSERTIONS\F[]
+is 1 or empty, while
+\FCUSE_VERSION_SUFFIXES\F[]
+is yes/no\&.
 .RE
 .PP
-\-\-list holdingdisk
+\FCDUMP\F[], \FCRESTORE\F[], \FCVDUMP\F[], \FCVRESTORE\F[], \FCXFSDUMP\F[], \FCXFSRESTORE\F[], \FCVXDUMP\F[], \FCVXRESTORE\F[], \FCSAMBA_CLIENT\F[], \FCGNUTAR\F[], \FCSTAR\F[], \FCCOMPRESS_PATH\F[], \FCUNCOMPRESS_PATH\F[]
 .RS 4
-Output the list of holdingdisk, one by line\.
+Paths to various utility progarms (empty if they are not found or not used)
 .RE
 .PP
-\-\-list interface
+\FCAIX_BACKUP\F[]
 .RS 4
-Output the list of interface, one by line\.
+Is
+\FCDUMP\F[]
+the AIX backup program? (empty or 1)
 .RE
+.PP
+\FCDUMP_RETURNS_1\F[]
+.RS 4
+Does
+\FCDUMP\F[]
+return 1 on success? (empty or 1)
 .RE
 .PP
-\fBparameter\fR
+\FCBSD_SECURITY\F[], \FCBSDUDP_SECURITY\F[], \FCBSDTCP_SECURITY\F[], \FCKRB4_SECURITY\F[], \FCKRB5_SECURITY\F[], \FCSSH_SECURITY\F[], \FCRSH_SECURITY\F[]
 .RS 4
-It could be one of the below format:
+Indicate which authentication mechanisms are available (yes or no)\&.
+.RE
 .PP
-runtapes
+\FCUSE_AMANDAHOSTS\F[]
 .RS 4
+Should the "bsd" authentication mechanism use
+\FCamandahosts\F[]? (yes or no)\&.
 .RE
 .PP
-DUMPTYPE:no\-compress:compress
+\FCAMANDA_DEBUG_DAYS\F[]
 .RS 4
+Number of days after which debug logs are deleted\&.
 .RE
 .PP
-TAPETYPE:HP\-DAT:length
+\FCDEFAULT_SERVER\F[], \FCDEFAULT_CONFIG\F[], \FCDEFAULT_TAPE_SERVER\F[], \FCDEFAULT_TAPE_DEVICE\F[]
 .RS 4
+Default values for configuration parameters
 .RE
 .PP
-INTERFACE:local:use
+\FCCLIENT_LOGIN\F[]
 .RS 4
+Userid under which the client runs (from
+\FC\-\-with\-user\F[])\&.
 .RE
 .PP
-HOLDINGDISK:hd1:use
+\FCUSE_RUNDUMP\F[]
 .RS 4
+Should Amanda use the
+\FCrundump\F[]
+wrapper? (empty or 1)
 .RE
+.PP
+\FCCHECK_USERID\F[]
+.RS 4
+Does Amanda check that userids are correct? (empty or 1)
 .RE
 .PP
-\fB\-o\fR \fIconfigoption\fR
+\FCCOMPRESS_SUFFIX\F[], \FCCOMPRESS_FAST_OPT\F[], \FCCOMPRESS_BEST_OPT\F[], \FCUNCOMPRESS_OPT\F[]
 .RS 4
-See the "\fBCONFIGURATION OVERRIDE\fR" section in
-\fBamanda\fR(8)\.
+Command\-line options for the compression program\&.
 .RE
-.SH "EXAMPLE"
 .PP
-Find out the path to the log file directory:
+\FCTICKET_LIFETIME\F[], \FCSERVER_HOST_PRINCIPAL\F[], \FCSERVER_HOST_INSTANCE\F[], \FCSERVER_HOST_KEY_FILE\F[], \FCCLIENT_HOST_PRINCIPAL\F[], \FCCLIENT_HOST_INSTANCE\F[], \FCCLIENT_HOST_KEY_FILE\F[]
+.RS 4
+Kerberos parameters\&.
+.RE
+.SS "DEBUG LOG MANAGEMENT"
+.if n \{\
 .sp
+.\}
 .RS 4
+.BM yellow
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.br
+.ps +1
+\fBNote\fR
+.ps -1
+.br
+That this application is responsible for debug logs is a
+historical quirk, but the functionality is widely used\&..sp .5v
+.EM yellow
+.RE
+.PP
+If
+\fIparameter\fR
+begins with
+\fIdbopen\&.\fR, the string following the period is a program name and an
+\fIAmanda\fR
+debug file will be created for the caller\&. The name of the logfile is returned\&.
+.PP
+If
+\fIparameter\fR
+begins with
+\fIdbclose\&.\fR, the string following the period is a program name previously used with
+\fIdbopen\&.\fR, followed by a colon (:) and the previously opened file name\&. The name of the logfile is returned\&.
+.SH "EXAMPLES"
+.PP
+Find out the path to the log file directory:
 .nf
 % amgetconf daily logdir
-/usr/local/etc/amanda//daily
+/usr/local/etc/amanda/daily/logs
 .fi
-.RE
 .PP
 Find out the current tape type:
-.sp
-.RS 4
 .nf
 % amgetconf daily tapetype
 DLT4000\-IV
 .fi
-.RE
 .PP
-Find out the default configuration directory:
-.sp
-.RS 4
+Find out that tape type\'s length:
 .nf
-% amgetconf daily build\.CONFIG_DIR
+% amgetconf daily tapetype:DLT4000\-IV:length
+1024000
+.fi
+.PP
+List the other available tapetype:
+.nf
+% amgetconf daily \-\-list tapetype
+DISK
+QIC\-60
+DEC\-DLT2000
+\&.\&.\&.
+.fi
+.PP
+Find out the configuration directory:
+.nf
+% amgetconf build\&.CONFIG_DIR
 /usr/local/etc/amanda/
 .fi
-.RE
+.PP
+List all build\-time parameters
+.nf
+% amgetconf \-\-list build
+AIX_BACKUP
+AMANDA_DBGDIR
+AMANDA_DEBUG_DAYS
+\&.\&.\&.
+.fi
 .PP
 Create, use and close a debug file in a script:
-.sp
-.RS 4
 .nf
-% set debug_file = `amgetconf daily dbopen\.myscript`
+% debug_file=`amgetconf daily dbopen\&.myscript`
 % echo debug information >> $debug_file
-% amgetconf daily dbclose\.myscript:$debug_file
+% amgetconf daily dbclose\&.myscript:$debug_file
 .fi
-.RE
-.sp
 .SH "MESSAGES"
 .PP
 amgetconf: no such parameter \fIparam\fR
 .RS 4
 Parameter
 \fIparam\fR
-is not a known keyword (e\.g\. not a valid
-\fIamanda\.conf\fR
-keyword)\.
+is not a known keyword (e\&.g\&. not a valid
+\fIamanda\&.conf\fR
+keyword)\&.
 .RE
 .SH "SEE ALSO"
 .PP
 
 \fBamanda\fR(8),
 : http://wiki.zmanda.com
+.SH "Author"
+.PP
+\fBJean\-Louis Martineau\fR <\&martineau@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
index ad36e698176cf3a6f0f0ace1c6b4e690fae2364c..94c993c8a9bc2021c53b3475d312a025daa0b03c 100644 (file)
 .\"     Title: amgpgcrypt
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
+.\"    Author: Kevin Till <kevin.till@zmanda.com>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
 .\"
-.TH "AMGPGCRYPT" "8" "08/22/2008" "" ""
+.TH "AMGPGCRYPT" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
 .ad l
-.SH "NAME"
-amgpgcrypt - reference crypt program for Amanda public-key data encryption
-.SH "SYNOPSIS"
-.HP 11
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amgpgcrypt \- reference crypt program for \fIAmanda\fR public\-key data encryption
+.SH "Synopsis"
+.fam C
+.HP \w'\fBamgpgcrypt\fR\ 'u
 \fBamgpgcrypt\fR  to be called by \fIAmanda\fR only 
+.fam
 .SH "DESCRIPTION"
 .PP
 
@@ -23,59 +181,59 @@ calls
 \fBgpg\fR
 to perform public\-key data encryption on
 \fIAmanda\fR
-backup\.
+backup\&.
 \fBamgpgcrypt\fR
 will search for the gpg program in the following directories: /usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin
 .PP
 
 \fBamgpgcrypt\fR
-sets GNUPGHOME to $AMANDA_HOME/\.gnupg where gpg will look for the gpg keys\.
+sets GNUPGHOME to $AMANDA_HOME/\&.gnupg where gpg will look for the gpg keys\&.
 \fBamgpgcrypt\fR
 uses the public key to encrypt the
 \fIAmanda\fR
 data and uses the private key to decrypt the
 \fIAmanda\fR
-backup data\. Thus, passphrase is only required at the time of data restore\.
-.SH "KEY AND PASSPHRASE"
+backup data\&. Thus, passphrase is only required at the time of data restore\&.
+.SH "Key and Passphrase"
 .PP
 
 \fBamgpgcrypt\fR
 uses the private key to decrypt
 \fIAmanda\fR
-backup data\.
+backup data\&.
 
 It is very important to store, manage and  protect the key and the passphrase
-properly\. Encrypted backup data can \fBonly\fR be recovered with the correct key and
-passphrase\.
-.SH "HOW TO CREATE ENCRYPTION KEYS AND PASSPHRASE FOR AMGPGCRYPT"
+properly\&. Encrypted backup data can \fBonly\fR be recovered with the correct key and
+passphrase\&.
+.SH "How to create encryption keys and Passphrase for amgpgcrypt"
 .PP
 Store the passphrase that you used in following "gpg \-\-gen\-key" command inside the home\-directory of the AMANDA\-user($amanda_user) and protect it with proper permissions:
 
-   echo my_secret_passphrase > ~$amanda_user/\.am_passphrase
-   chown $amanda_user:disk ~$amanda_user/\.am_passphrase
-   chmod 700 ~$amanda_user/\.am_passphrase
+   echo my_secret_passphrase > ~$amanda_user/\&.am_passphrase
+   chown $amanda_user:disk ~$amanda_user/\&.am_passphrase
+   chmod 700 ~$amanda_user/\&.am_passphrase
 .PP
-Run "gpg \-\-gen\-key"\. Below is an example:
+Run "gpg \-\-gen\-key"\&. Below is an example:
 .nf
 $ gpg \-\-gen\-key
-gpg (GnuPG) 1\.2\.6; Copyright (C) 2004 Free Software Foundation, Inc\.
-This program comes with ABSOLUTELY NO WARRANTY\.
+gpg (GnuPG) 1\&.2\&.6; Copyright (C) 2004 Free Software Foundation, Inc\&.
+This program comes with ABSOLUTELY NO WARRANTY\&.
 This is free software, and you are welcome to redistribute it
-under certain conditions\. See the file COPYING for details\.
+under certain conditions\&. See the file COPYING for details\&.
 
 Please select what kind of key you want:
    (1) DSA and ElGamal (default)
    (2) DSA (sign only)
    (4) RSA (sign only)
 Your selection? 1
-DSA keypair will have 1024 bits\.
-About to generate a new ELG\-E keypair\.
+DSA keypair will have 1024 bits\&.
+About to generate a new ELG\-E keypair\&.
               minimum keysize is  768 bits
               default keysize is 1024 bits
     highest suggested keysize is 2048 bits
 What keysize do you want? (1024)
 Requested keysize is 1024 bits
-Please specify how long the key should be valid\.
+Please specify how long the key should be valid\&.
          0 = key does not expire
       (n)  = key expires in n days
       (n)w = key expires in n weeks
@@ -87,7 +245,7 @@ Is this correct (y/n)? y
 
 You need a User\-ID to identify your key; the software constructs the user id
 from Real Name, Comment and Email Address in this form:
-    "Heinrich Heine (Der Dichter) (heinrichh@duesseldorf\.de)"
+    "Heinrich Heine (Der Dichter) (heinrichh@duesseldorf\&.de)"
 
 Real name: amandabackup
 Email address:
@@ -96,52 +254,49 @@ You selected this USER\-ID:
     "amandabackup (gpg keys for amandabackup)"
 
 Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o
-You need a Passphrase to protect your secret key\.
+You need a Passphrase to protect your secret key\&.
 
-We need to generate a lot of random bytes\. It is a good idea to perform
+We need to generate a lot of random bytes\&. It is a good idea to perform
 some other action (type on the keyboard, move the mouse, utilize the
 disks) during the prime generation; this gives the random number
-generator a better chance to gain enough entropy\.
+generator a better chance to gain enough entropy\&.
 
-We need to generate a lot of random bytes\. It is a good idea to perform
+We need to generate a lot of random bytes\&. It is a good idea to perform
 some other action (type on the keyboard, move the mouse, utilize the
 disks) during the prime generation; this gives the random number
-generator a better chance to gain enough entropy\.
+generator a better chance to gain enough entropy\&.
 
-public and secret key created and signed\.
-key marked as ultimately trusted\.
+public and secret key created and signed\&.
+key marked as ultimately trusted\&.
 
 pub  1024D/4417A8CB 2006\-02\-07 amandabackup (gpg keys for amandabackup)
      Key fingerprint = 139C 6369 44FC 7F1A 655C  E5E9 7EAA 515A 4417 A8CB
 sub  1024g/8C3A6A78 2006\-02\-07 [expires: 2006\-08\-06]
 .fi
-.SH "FILES"
+.SH "Files"
 .PP
-\fB$AMANDA_HOME/\.gnupg/pubring\.gpg\fR
+\fB$AMANDA_HOME/\&.gnupg/pubring\&.gpg\fR
 .RS 4
-The public key\.
+The public key\&.
 \fBamgpgcrypt\fR
-encrypt data with this public key along with the cipher algorithm\.
+encrypt data with this public key along with the cipher algorithm\&.
 .RE
 .PP
-\fB$AMANDA_HOME/\.gnupg/secring\.gpg\fR
+\fB$AMANDA_HOME/\&.gnupg/secring\&.gpg\fR
 .RS 4
-The private/secret key\. It\'s only needed during amrecover/amrestore\. Store and protect it properly during other time\.
+The private/secret key\&. It\'s only needed during amrecover/amrestore\&. Store and protect it properly during other time\&.
 .RE
 .PP
-\fB$AMANDA_HOME/\.am_passphrase\fR
+\fB$AMANDA_HOME/\&.am_passphrase\fR
 .RS 4
-The passphrase\. It\'s only needed during amrecover/amrestore\. Store and protect it properly during other time\.
+The passphrase\&. It\'s only needed during amrecover/amrestore\&. Store and protect it properly during other time\&.
 .RE
 .SH "BUGS"
 .PP
 \fIAmanda\fR
-has problem with gpg mdc(modification detection code) in the binary mode\.
+has problem with gpg mdc(modification detection code) in the binary mode\&.
 \fBamgpgcrypt\fR
 calls gpg with mdc disabled
-.SH "AUTHOR"
-.PP
-The tool and its documentation was written by Zmanda, Inc (http://www\.zmanda\.com/)\.
 .SH "SEE ALSO"
 .PP
 
@@ -151,3 +306,9 @@ The tool and its documentation was written by Zmanda, Inc (http://www\.zmanda\.c
 \fBamrestore\fR(8),
 \fBgpg\fR(1),
 : http://wiki.zmanda.com
+.SH "Author"
+.PP
+\fBKevin Till\fR <\&kevin\&.till@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
diff --git a/man/amgtar.8 b/man/amgtar.8
new file mode 100644 (file)
index 0000000..1a03bcd
--- /dev/null
@@ -0,0 +1,302 @@
+.\"     Title: amgtar
+.\"    Author: Jean-Louis Martineau <martineau@zmanda.com>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
+.\"
+.TH "AMGTAR" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amgtar \- Amanda Application to interface with GNU Tar
+.SH "DESCRIPTION"
+.PP
+Amgtar is an
+\fIAmanda\fR
+Application API script\&. It should not be run by users directly\&. It uses GNU Tar to backup and restore data\&.
+.SH "PROPERTIES"
+.PP
+This section lists the properties that control amgtar\'s functionality\&. See
+\fBamanda-applications\fR(7)
+for information on application properties and how they are configured\&.
+.PP
+ATIME\-PRESERVE
+.RS 4
+
+If "YES" (the default), amgtar use the \fI\-\-atime\-preserve=system\fR option of gnutar to not update the atime of all files accessed; if "NO", gnutar will updates the atime for all files accessed\&. This property works only if you have gnutar 1\&.15\&.90 or newer, if not, you must set ATIME_PRESERVE to "NO"\&.
+.RE
+.PP
+CHECK\-DEVICE
+.RS 4
+
+If "YES" (the default), amgtar checks that the device number doesn\'t change for each file\&. If "NO", changes in device number are ignored\&.  To ignore device numbers, tar must support the \fI\-\-no\-check\-device\fR option (gnutar 1\&.19\&.90 and newer)\&. This option is needed for some filesystems and devices on which device numbers change frequently, such as LVM or FiberChannel\&.
+.RE
+.PP
+DIRECTORY
+.RS 4
+
+If set, gnutar will backup from that directory instead of the \fIdiskdevice\fR set by the DLE\&.
+.RE
+.PP
+GNUTAR\-LISTDIR
+.RS 4
+
+The directory where gnutar stores the database it uses to generate incremental dumps\&.  The default is set when \fIAmanda\fR is built\&.
+.RE
+.PP
+GNUTAR\-PATH
+.RS 4
+
+The path to the gnutar binary\&.  The default is set when \fIAmanda\fR is built\&.
+.RE
+.PP
+ONE\-FILE\-SYSTEM
+.RS 4
+
+If "YES" (the default), do not allow gnutar to cross filesystem boundaries\&. If "NO", gnutar will cross filesystem boundaries\&.  This corresponds to the \fI\-\-one\-filesystem\fR option of gnutar\&.
+.RE
+.PP
+TAR\-BLOCKSIZE
+.RS 4
+
+Block size of Nx512 bytes (default N=20)\&.  This corresponds to the \fI\-\-blocking\-factor\fR option of gnutar\&.
+.RE
+.PP
+SPARSE
+.RS 4
+
+If "YES" (the default), gnutar will store sparse files efficiently\&. If "NO", then the \fI\-\-sparse\fR option is not given to gnutar, and it will not try to detect sparse files\&.
+.RE
+.PP
+EXIT\-HANDLING
+.RS 4
+
+List which exit status of gtar are good or bad\&. eg\&. "1=GOOD 2=BAD", exit status of 1 will produce a good backup, exit status of 2 will give an error\&.
+.RE
+.PP
+NORMAL
+.RS 4
+
+List all regex (POSIX Extended Regular Expression syntax) that are normal output from gtar\&. These output are in the "FAILED DUMP DETAILS" section of the email report if the dump result is STRANGE or FAILED\&. Default values:
+.nf
+  "^could not open conf file"
+  "^Elapsed time:"
+  "^Throughput"
+  ": socket ignored$"
+  ": File \&.* shrunk by [0\-9][0\-9]* bytes, padding with zeros"
+  ": Cannot add file \&.*: No such file or directory$"
+  ": Error exit delayed from previous errors"
+.fi
+To treat one of these default patterns differently, specify it explicitly in a different property\&.
+.RE
+.PP
+IGNORE
+.RS 4
+
+List all regex (POSIX Extended Regular Expression syntax) that amanda ignore\&. These output are never in the email report\&. Default values:
+.nf
+  ": Directory is new$"
+  ": Directory has been renamed"
+.fi
+To treat one of these default patterns differently, specify it explicitly in a different property\&.
+.RE
+.PP
+STRANGE
+.RS 4
+
+List all regex (POSIX Extended Regular Expression syntax) that are strange output from gtar\&. All gtar output that doesn\'t match a normal or ignore regex are strange by default\&. The result of the dump is STRANGE if gtar produce a strange output\&. These output are in the "FAILED DUMP DETAILS" section of the email report\&.
+.RE
+.SH "EXAMPLE"
+.nf
+  define application\-tool app_amgtar {
+    property "ATIME\-PRESERVE" "NO"
+    property "CHECK\-DEVICE" "YES"
+    property "GNUTAR\-LISTDIR" "
+    property "GNUTAR\-PATH" "/bin/tar"
+    property "ONE\-FILE\-SYSTEM" "YES"
+    property "TAR_BLOCKSIZE" "20"
+    property "SPARSE" "YES"
+    property "EXIT\-HANDLING" "1=GOOD 2=BAD"
+    # change a default NORMAL regex to a STRANGE regex\&.
+    property "STRANGE" ": socket ignored$"
+    # add three new IGNORE regex
+    property "IGNORE" ": Directory is new$"
+    property append "IGNORE" ": Directory has been renamed"
+    property append "IGNORE" "file changed as we read it$"
+  }
+.fi
+.SH "SEE ALSO"
+.PP
+
+\fBamanda.conf\fR(5),
+\fBamanda-applications\fR(7)
+.SH "Authors"
+.PP
+\fBJean\-Louis Martineau\fR <\&martineau@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
+.PP
+\fBDustin J\&. Mitchell\fR <\&dustin@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
index f57e013fa670690c94e3cd225ff1f52a97f3fe10..918f2707520cd18c2c43da8fcfc206a56240e1e2 100644 (file)
 .\"     Title: amlabel
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
+.\"    Author: James da Silva <jds@amanda.org>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
 .\"
-.TH "AMLABEL" "8" "08/22/2008" "" ""
+.TH "AMLABEL" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
 .ad l
-.SH "NAME"
-amlabel - label an Amanda tape
-.SH "SYNOPSIS"
-.HP 8
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amlabel \- label an \fIAmanda\fR tape
+.SH "Synopsis"
+.fam C
+.HP \w'\fBamlabel\fR\ 'u
 \fBamlabel\fR [\-f] \fIconfig\fR \fIlabel\fR [slot\ \fIslot\fR] [\-o\ \fIconfigoption\fR]...
+.fam
 .SH "DESCRIPTION"
 .PP
 All
 \fIAmanda\fR
-tapes must be pre\-labeled before they are used\.
+tapes must be pre\-labeled before they are used\&.
 \fIAmanda\fR
 verifies the label in
 \fBamdump\fR
 and
 \fBamflush\fR
-before writing to make sure the proper tape is loaded\.
+before writing to make sure the proper tape is loaded\&.
 .PP
 \fBAmlabel\fR
 writes an
 \fIAmanda\fR
 label on the tape in the device specified by the
-\fIamanda\.conf\fR
-file in /usr/local/etc/amanda/\fIconfig\fR\.
+\fIamanda\&.conf\fR
+file in /usr/local/etc/amanda/\fIconfig\fR\&.
 \fILabel\fR
 may be any string that does not contain whitespace and that matches the
-\fIamanda\.conf\fR
+\fIamanda\&.conf\fR
 \fBlabelstr\fR
-regular expression option\. It is up to the system administrator to define a naming convention\.
+regular expression option\&. It is up to the system administrator to define a naming convention\&.
 .PP
 \fBAmlabel\fR
 appends the new tape to the
-\fItapelist\fR
+\fBtapelist\fR(5)
 file so it will be used by
 \fIAmanda\fR
-before it reuses any other tapes\. When you
+before it reuses any other tapes\&. When you
 \fBamlabel\fR
 multiple tapes, they will be used in the order you
 \fBamlabel\fR
-them\.
+them\&.
 .PP
 \fBAmlabel\fR
 will not write the label if the tape contains an active
 \fIAmanda\fR
-tape or if the label specified is on an active tape\. The
+tape or if the label specified is on an active tape\&. The
 \fB\-f\fR
-(force) flag bypasses these verifications\.
+(force) flag bypasses these verifications\&.
 .PP
 An optional
 \fIslot\fR
-may be specified after the tape label\. If a tape changer is in use,
+may be specified after the tape label\&. If a tape changer is in use,
 \fBamlabel\fR
-will label the tape in the specified slot instead of the currently loaded tape\.
+will label the tape in the specified slot instead of the currently loaded tape\&.
 .PP
 See the
 \fBamanda\fR(8)
 man page for more details about
-\fIAmanda\fR\.
+\fIAmanda\fR\&.
 .SH "OPTIONS"
 .PP
 \fB\-o\fR \fIconfigoption\fR
 .RS 4
 See the "\fBCONFIGURATION OVERRIDE\fR" section in
-\fBamanda\fR(8)\.
+\fBamanda\fR(8)\&.
 .RE
 .SH "EXAMPLE"
 .PP
@@ -80,7 +238,7 @@ Write an
 \fIAmanda\fR
 label with the string "DMP000" on the tape loaded in the device named in the
 \fBtapedev\fR
-option in /usr/local/etc/amanda/daily/amanda\.conf:
+option in /usr/local/etc/amanda/daily/amanda\&.conf:
 .nf
 % amlabel daily DMP000 
 .fi
@@ -100,7 +258,7 @@ on the command line does not match the
 regular expression
 \fIstr\fR
 from
-\fIamanda\.conf\fR\.
+\fIamanda\&.conf\fR\&.
 .RE
 .PP
 label \fIlabel\fR already on a tape
@@ -109,7 +267,7 @@ Label
 \fIlabel\fR
 is already listed as an active
 \fIAmanda\fR
-tape\.
+tape\&.
 .RE
 .PP
 no tpchanger specified in \fIpath\fR , so slot command invalid
@@ -117,10 +275,10 @@ no tpchanger specified in \fIpath\fR , so slot command invalid
 The command line has the
 \fBslot\fR
 parameter but the
-\fIamanda\.conf\fR
+\fIamanda\&.conf\fR
 file in
 \fIpath\fR
-does not have a tape changer configured\.
+does not have a tape changer configured\&.
 .RE
 .PP
 reading label \fIlabel\fR, tape is in another amanda configuration
@@ -131,7 +289,7 @@ tape, but label does not match
 \fBlabelstr\fR
 for this configuration so it is probably part of a different
 \fIAmanda\fR
-configuration\.
+configuration\&.
 .RE
 .PP
 reading label \fIlabel\fR, tape is active
@@ -140,7 +298,7 @@ Tape
 \fIlabel\fR
 appears to already be part of this
 \fIAmanda\fR
-configuration and active, i\.e\. has valid data on it\.
+configuration and active, i\&.e\&. has valid data on it\&.
 .RE
 .PP
 no label found, are you sure \fItape\fR is non\-rewinding?
@@ -150,19 +308,16 @@ While checking that the label was written correctly,
 got an error that might be caused by mis\-configuring
 \fIAmanda\fR
 with a rewinding tape device name instead of a non\-rewinding device name for
-\fItape\.\fR
+\fItape\&.\fR
 .RE
-.SH "AUTHOR"
-.PP
-James da Silva,
-<jds@amanda\.org>: Original text
-.PP
-Stefan G\. Weichinger,
-<sgw@amanda\.org>, maintainer of the
-\fIAmanda\fR\-documentation: XML\-conversion
 .SH "SEE ALSO"
 .PP
 \fBamanda\fR(8),
 \fBamdump\fR(8),
 \fBamflush\fR(8),
 : http://wiki.zmanda.com
+.SH "Authors"
+.PP
+\fBJames da Silva\fR <\&jds@amanda\&.org\&>
+.PP
+\fBStefan G\&. Weichinger\fR <\&sgw@amanda\&.org\&>
diff --git a/man/ammt.8 b/man/ammt.8
deleted file mode 100644 (file)
index 1283e23..0000000
+++ /dev/null
@@ -1,183 +0,0 @@
-.\"     Title: ammt
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
-.\"
-.TH "AMMT" "8" "08/22/2008" "" ""
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.SH "NAME"
-ammt - Amanda version of mt
-.SH "SYNOPSIS"
-.HP 5
-\fBammt\fR [\-d] [\-f | \-t | \fIdevice\fR] \fIcommand\fR [\fIcount\fR]
-.SH "DESCRIPTION"
-.PP
-\fBAmmt\fR
-provides just enough of the standard UNIX
-\fBmt\fR
-command for the needs of
-\fIAmanda\fR\. This is handy when doing a full restore and the standard
-\fBmt\fR
-program has not yet been found\.
-.PP
-\fBAmmt\fR
-also provides access to the
-\fIAmanda\fR
-output drivers that support various tape simulations\.
-.PP
-See the
-\fBamanda\fR(8)
-man page for more details about
-\fIAmanda\fR\. See the
-\fBOUTPUT DRIVERS\fR
-section of
-\fIamanda(8)\fR
-for more information on the
-\fIAmanda\fR
-output drivers\.
-.SH "OPTIONS"
-.PP
-\fB\-d\fR
-.RS 4
-Turn on debugging output\.
-.RE
-.PP
-\fB\-f\fR\fI device\fR
-.RS 4
-Access tape device
-\fIdevice\fR\. If not specified, the
-\fBTAPE\fR
-environment variable is used\.
-.RE
-.PP
-\fB\-t\fR\fI device\fR
-.RS 4
-Same as
-\fB\-f\fR\.
-.RE
-.PP
-\fBcommand\fR\fI count\fR
-.RS 4
-Which command to issue, and an optional count of operations\.
-.RE
-.SH "COMMANDS"
-.PP
-Each command may be abbreviated to whatever length makes it unique\.
-.PP
-\fBeof|weof\fR\fI count\fR
-.RS 4
-Write
-\fIcount\fR
-(default: 1) end of file marks (tapemarks)\.
-.RE
-.PP
-\fBfsf\fR\fI count\fR
-.RS 4
-Skip forward
-\fIcount\fR
-(default: 1) files\.
-.RE
-.PP
-\fBbsf\fR\fI count\fR
-.RS 4
-Skip backward
-\fIcount\fR
-(default: 1) files\.
-.RE
-.PP
-\fBasf\fR\fI count\fR
-.RS 4
-Position to file number
-\fIcount\fR
-(default: 0) where zero is beginning of tape\. This is the same as a
-\fBrewind\fR
-followed by a
-\fBfsf\fR
-\fIcount\fR\.
-.RE
-.PP
-\fBrewind\fR
-.RS 4
-Rewind to beginning of tape\.
-.RE
-.PP
-\fBoffline|rewoffl\fR
-.RS 4
-Rewind to beginning of tape and unload the tape from the drive\.
-.RE
-.PP
-\fBstatus\fR
-.RS 4
-Report status information about the drive\. Which data reported, and what it means, depends on the underlying operating system, and may include:
-.PP
-ONLINE
-.RS 4
-Indicates the drive is online and ready\.
-.RE
-.PP
-OFFLINE
-.RS 4
-Indicates the drive is offline or not ready\.
-.RE
-.PP
-BOT
-.RS 4
-Indicates the drive is at beginning of tape\.
-.RE
-.PP
-EOT
-.RS 4
-Indicates the drive is at end of tape\.
-.RE
-.PP
-PROTECTED
-.RS 4
-Indicates the tape is write protected\.
-.RE
-.PP
-ds
-.RS 4
-Device status\.
-.RE
-.PP
-er
-.RS 4
-Error register\.
-.RE
-.PP
-fileno
-.RS 4
-Current tape file number\.
-.RE
-.PP
-blkno
-.RS 4
-Current tape block number file\.
-.RE
-.RE
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-Note
-.PP
-Many systems only report good data when a tape is in the drive and ready\.
-.SH "AUTHOR"
-.PP
-Marc Mengel
-<mengel@fnal\.gov>, John R\. Jackson
-<jrj@purdue\.edu>: Original text
-.PP
-Stefan G\. Weichinger,
-<sgw@amanda\.org>, maintainer of the
-\fIAmanda\fR\-documentation: XML\-conversion
-.SH "SEE ALSO"
-.PP
-\fBamanda\fR(8),
-: http://wiki.zmanda.com
index 4ba2aaab8ee6a0b74baedd434f4d1dce0bbaac43..f6296c65fb15f104f3277511b94e26eeb7cb566e 100644 (file)
 .\"     Title: amoverview
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
+.\"    Author: Stefan G. Weichinger <sgw@amanda.org>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
 .\"
-.TH "AMOVERVIEW" "8" "08/22/2008" "" ""
+.TH "AMOVERVIEW" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
 .ad l
-.SH "NAME"
-amoverview - display file systems processed by Amanda over time
-.SH "SYNOPSIS"
-.HP 11
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amoverview \- display file systems processed by \fIAmanda\fR over time
+.SH "Synopsis"
+.fam C
+.HP \w'\fBamoverview\fR\ 'u
 \fBamoverview\fR [[\-config\ ]\ \fIconfig\fR] [\-hostwidth\ \fIwidth\fR] [\-diskwidth\ \fIwidth\fR] [\-skipmissed] [\-last] [\-num0] [\-togo0] [\-verbose]
+.fam
 .SH "DESCRIPTION"
 .PP
 \fBAmoverview\fR
 displays a chart showing hosts and file systems processed by
 \fIAmanda\fR
-along with the backup level performed each day\.
+along with the backup level performed each day\&.
 .PP
 See the
 \fBamanda\fR(8)
 man page for more details about
-\fIAmanda\fR\.
+\fIAmanda\fR\&.
 .SH "OPTIONS"
 .PP
 \fB\-config\fR \fIconfig\fR
 .RS 4
 Use configuration
 \fIconfig\fR
-instead of configuration daily\.
+instead of configuration daily\&.
 .RE
 .PP
 \fB\-hostwidth\fR \fIwidth\fR
@@ -41,7 +199,7 @@ Set
 \fBhost\fR
 field column width to
 \fIwidth\fR
-characters instead of 8\.
+characters instead of 8\&.
 .RE
 .PP
 \fB\-diskwidth\fR \fIwidth\fR
@@ -50,59 +208,59 @@ Set
 \fBdisk\fR
 field column width to
 \fIwidth\fR
-characters instead of 20\.
+characters instead of 20\&.
 .RE
 .PP
 \fB\-skipmissed\fR
 .RS 4
 Compacts the output by only printing stats for the days
 \fIAmanda\fR
-actually ran\.
+actually ran\&.
 .RE
 .PP
 \fB\-last\fR
 .RS 4
-Outputs the last status of each disk at the start\. Useful for long tapecycles and/or sparse reports\.
+Outputs the last status of each disk at the start\&. Useful for long tapecycles and/or sparse reports\&.
 .RE
 .PP
 \fB\-num0\fR
 .RS 4
-Outputs the number of level 0 dumps for each disk\.
+Outputs the number of level 0 dumps for each disk\&.
 .RE
 .PP
 \fB\-togo0\fR
 .RS 4
-Outputs the number of runs until the last level 0 dump is overwritten\.
+Outputs the number of runs until the last level 0 dump is overwritten\&.
 .RE
 .PP
 \fB\-verbose\fR
 .RS 4
 \fBAmoverview\fR
-can take a long while on large systems\. This option reports intermediate steps while it is working\.
+can take a long while on large systems\&. This option reports intermediate steps while it is working\&.
 .RE
 .SH "RESULTS"
 .PP
 \fBamoverview\fR
 is a summary of the output of "
 \fBamadmin <config> find\fR
-"\. When the last column of
+"\&. When the last column of
 \fBamadmin find\fR
-contains anything other than "OK", amoverview translates this into "E" for that day\.
+contains anything other than "OK", amoverview translates this into "E" for that day\&.
 .PP
-A number indicates the level of backup and it succeeded\. An "E" indicates an error for that day\. You get an "E" for all errors, like failed to connect, datatimeout, computer crashed, etc, but also for failing to write to tape\.
+A number indicates the level of backup and it succeeded\&. An "E" indicates an error for that day\&. You get an "E" for all errors, like failed to connect, datatimeout, computer crashed, etc, but also for failing to write to tape\&.
 .PP
-You can have an "E" followed by a number if a filesystem ran into end\-of\-tape once (gives an "E", and later that day, you flush it to a second tape (a number: the level, indicating success)\. If the flush failed too, you get a double "EE" for that day\.
+You can have an "E" followed by a number if a filesystem ran into end\-of\-tape once (gives an "E", and later that day, you flush it to a second tape (a number: the level, indicating success)\&. If the flush failed too, you get a double "EE" for that day\&.
 .PP
 You can also have a double code if you have two tapes in the changer and
 \fIAmanda\fR
-failed to write to tape the first time because it hit end of tape (resulting in "E0", for a full, "E1" for an incremental etc\.) or twice with error ("EE"), and may a successful flush afterwards giving maybe "EE0"\. (Only the latest 2 characters are printed)\.
+failed to write to tape the first time because it hit end of tape (resulting in "E0", for a full, "E1" for an incremental etc\&.) or twice with error ("EE"), and may a successful flush afterwards giving maybe "EE0"\&. (Only the latest 2 characters are printed)\&.
 .SH "EXAMPLE"
 .PP
 This shows the
-\fI/home\fR
+\FC/home\F[]
 file system on
 \fIhost2\fR
-was backed up at level 3 on the 8th, 9th and 10th of December, had a full backup on the 11th, a level 1 on the 12th and a level 2 on the 13th\.
+was backed up at level 3 on the 8th, 9th and 10th of December, had a full backup on the 11th, a level 1 on the 12th and a level 2 on the 13th\&.
 .nf
 # amoverview
                          date 12 12 12 12 12 12
@@ -120,3 +278,6 @@ host2    /var                  1  1  0  1  1  1
 \fBamadmin\fR(8),
 \fBamanda\fR(8),
 : http://wiki.zmanda.com
+.SH "Author"
+.PP
+\fBStefan G\&. Weichinger\fR <\&sgw@amanda\&.org\&>
index 6da1ecfc48f8046b0b9a2ddf63d0464a66c0d203..54f84348b5556ee6dd390c16b425ec28cbf58e98 100644 (file)
 .\"     Title: amplot
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
+.\"    Author: Olafur Gudmundsson <ogud@tis.com>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
 .\"
-.TH "AMPLOT" "8" "08/22/2008" "" ""
+.TH "AMPLOT" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
 .ad l
-.SH "NAME"
-amplot - visualize the behavior of Amanda
-.SH "SYNOPSIS"
-.HP 7
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amplot \- visualize the behavior of \fIAmanda\fR
+.SH "Synopsis"
+.fam C
+.HP \w'\fBamplot\fR\ 'u
 \fBamplot\fR [\-b] [\-c] [\-e] [\-g] [\-l] [\-p] [\-t\ \fIT\fR] \fIamdump_files\fR
 .br
 
+.fam
 .SH "DESCRIPTION"
 .PP
 \fBAmplot\fR
@@ -24,85 +182,85 @@ reads an
 \fBamdump\fR
 output file that
 \fIAmanda\fR
-generates each run (e\.g\.
-\fIamdump\.1\fR) and translates the information into a picture format that may be used to determine how your installation is doing and if any parameters need to be changed\.
+generates each run (e\&.g\&.
+\fIamdump\&.1\fR) and translates the information into a picture format that may be used to determine how your installation is doing and if any parameters need to be changed\&.
 \fBAmplot\fR
 also prints out
 \fBamdump\fR
-lines that it either does not understand or knows to be warning or error lines and a summary of the start, end and total time for each backup image\.
+lines that it either does not understand or knows to be warning or error lines and a summary of the start, end and total time for each backup image\&.
 .PP
 \fBAmplot\fR
 is a shell script that executes an
 \fBawk\fR
 program
-(\fIamplot\.awk\fR) to scan the
+(\fIamplot\&.awk\fR) to scan the
 \fBamdump\fR
-output file\. It then executes a
+output file\&. It then executes a
 \fBgnuplot\fR
 program
-(\fIamplot\.g\fR) to generate the graph\. The
+(\fIamplot\&.g\fR) to generate the graph\&. The
 \fBawk\fR
 program is written in an enhanced version of awk, such as GNU awk
 (\fIgawk\fR
-version 2\.15 or later) or
-\fBnawk\fR\.
+version 2\&.15 or later) or
+\fBnawk\fR\&.
 .PP
 During execution,
 \fBamplot\fR
 generates a few temporary files that
 \fBgnuplot\fR
-uses\. These files are deleted at the end of execution\.
+uses\&. These files are deleted at the end of execution\&.
 .PP
 See the
 \fBamanda\fR(8)
 man page for more details about
-\fIAmanda\fR\.
+\fIAmanda\fR\&.
 .SH "OPTIONS"
 .PP
 \fB\-b\fR
 .RS 4
 Generate b/w postscript file (need
-\fB\-p\fR)\.
+\fB\-p\fR)\&.
 .RE
 .PP
 \fB\-c\fR
 .RS 4
 Compress
 \fIamdump_files\fR
-after plotting\.
+after plotting\&.
 .RE
 .PP
 \fB\-e\fR
 .RS 4
-Extend the X (time) axis if needed\.
+Extend the X (time) axis if needed\&.
 .RE
 .PP
 \fB\-g\fR
 .RS 4
 Direct
 \fIgnuplot\fR
-output directly to the X11 display (default)\.
+output directly to the X11 display (default)\&.
 .RE
 .PP
 \fB\-p\fR
 .RS 4
 Direct postscript output to file
-\fIYYYYMMDD\fR\fI\.ps\fR
+\fIYYYYMMDD\fR\fI\&.ps\fR
 (opposite of
-\fB\-g\fR)\.
+\fB\-g\fR)\&.
 .RE
 .PP
 \fB\-l\fR
 .RS 4
 Generate landscape oriented output (needs
-\fB\-p\fR)\.
+\fB\-p\fR)\&.
 .RE
 .PP
 \fB\-t \fR\fIT\fR
 .RS 4
 Set the right edge of the plot to be
 \fIT\fR
-hours\.
+hours\&.
 .RE
 .PP
 The
@@ -111,43 +269,35 @@ may be in various compressed formats
 (\fIcompress\fR,
 \fBgzip\fR,
 \fBpact\fR,
-\fBcompact\fR)\.
+\fBcompact\fR)\&.
 .SH "INTERPRETATION"
 .PP
-The figure is divided into a number of regions\. There are titles on the top that show important statistical information about the configuration and from this execution of
-\fBamdump\fR\. In the figure, the X axis is time, with 0 being the moment
+The figure is divided into a number of regions\&. There are titles on the top that show important statistical information about the configuration and from this execution of
+\fBamdump\fR\&. In the figure, the X axis is time, with 0 being the moment
 \fBamdump\fR
-was started\. The Y axis is divided into 5 regions:
+was started\&. The Y axis is divided into 5 regions:
 .PP
 \fIQUEUES:\fR
-How many backups have not been started, how many are waiting on space in the holding disk and how many have been transferred successfully to tape\.
+How many backups have not been started, how many are waiting on space in the holding disk and how many have been transferred successfully to tape\&.
 .PP
 \fI%BANDWIDTH:\fR
-Percentage of allowed network bandwidth in use\.
+Percentage of allowed network bandwidth in use\&.
 .PP
 \fIHOLDING DISK:\fR
-The higher line depicts space allocated on the holding disk to backups in progress and completed backups waiting to be written to tape\. The lower line depicts the fraction of the holding disk containing completed backups waiting to be written to tape including the file currently being written to tape\. The scale is percentage of the holding disk\.
+The higher line depicts space allocated on the holding disk to backups in progress and completed backups waiting to be written to tape\&. The lower line depicts the fraction of the holding disk containing completed backups waiting to be written to tape including the file currently being written to tape\&. The scale is percentage of the holding disk\&.
 .PP
 \fITAPE:\fR
-Tape drive usage\.
+Tape drive usage\&.
 .PP
 \fI%DUMPERS:\fR
-Percentage of active dumpers\.
+Percentage of active dumpers\&.
 .PP
 The idle period at the left of the graph is time
 \fBamdump\fR
-is asking the machines how much data they are going to dump\. This process can take a while if hosts are down or it takes them a long time to generate estimates\.
-.SH "AUTHOR"
-.PP
-Olafur Gudmundsson
-<ogud@tis\.com>, Trusted Information Systems, formerly at University of Maryland, College Park: Original text
-.PP
-Stefan G\. Weichinger,
-<sgw@amanda\.org>, maintainer of the
-\fIAmanda\fR\-documentation: XML\-conversion
+is asking the machines how much data they are going to dump\&. This process can take a while if hosts are down or it takes them a long time to generate estimates\&.
 .SH "BUGS"
 .PP
-Reports lines it does not recognize, mainly error cases but some are legitimate lines the program needs to be taught about\.
+Reports lines it does not recognize, mainly error cases but some are legitimate lines the program needs to be taught about\&.
 .SH "SEE ALSO"
 .PP
 \fBamanda\fR(8),
@@ -160,3 +310,11 @@ Reports lines it does not recognize, mainly error cases but some are legitimate
 \fBcompress\fR(1),
 \fBgzip\fR(1),
 : http://wiki.zmanda.com
+.SH "Authors"
+.PP
+\fBOlafur Gudmundsson\fR <\&ogud@tis\&.com\&>
+.RS 4
+Trusted Information Systems
+.RE
+.PP
+\fBStefan G\&. Weichinger\fR <\&sgw@amanda\&.org\&>
index 01608fb097c5fdc7b4411595b06b7d7099efb742..4a1139234570eeda1696ea0ca7bf03138ddb5318 100644 (file)
 .\"     Title: amrecover
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
+.\"    Author: Alan M. McIvor <alan@kauri.auck.irl.cri.nz>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
 .\"
-.TH "AMRECOVER" "8" "08/22/2008" "" ""
+.TH "AMRECOVER" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
 .ad l
-.SH "NAME"
-amrecover - Amanda index database browser
-.SH "SYNOPSIS"
-.HP 10
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amrecover \- \fIAmanda\fR index database browser
+.SH "Synopsis"
+.fam C
+.HP \w'\fBamrecover\fR\ 'u
 \fBamrecover\fR [\-C\ \fIconfig\fR] [\-s\ \fIindex\-server\fR] [\-t\ \fItape\-server\fR] [\-d\ \fItape\-device\fR] [\-o\ \fIconfigoption\fR]...
+.fam
 .SH "DESCRIPTION"
 .PP
 \fBAmrecover\fR
 browses the database of
 \fIAmanda\fR
-index files to determine which tapes contain files to recover\. Furthermore, it is able to recover files\.
+index files to determine which tapes contain files to recover\&. Furthermore, it is able to recover files\&.
 .PP
 In order to restore files in place, you must invoke
 \fBamrecover\fR
 from the root of the backed up filesystem, or use
 \fBlcd\fR
-to move into that directory, otherwise a directory tree that resembles the backed up filesystem will be created in the current directory\. See the examples below for details\.
+to move into that directory, otherwise a directory tree that resembles the backed up filesystem will be created in the current directory\&. See the examples below for details\&.
 .PP
 Amrecover will read the
-\fBamanda\-client\.conf\fR
+\fBamanda\-client\&.conf\fR
 file and the
-\fIconfig\fR\fB/amanda\-client\.conf\fR
-file\.
+\fIconfig\fR\fB/amanda\-client\&.conf\fR
+file\&. If no configuration name is supplied on the command line, Amrecover will try the compiled\-in default configuration ,usually
+\fBDailySet1\fR\&.
 .PP
 See the
 \fBamanda\fR(8)
 man page for more details about
-\fIAmanda\fR\.
+\fIAmanda\fR\&.
 .SH "OPTIONS"
+.if n \{\
 .sp
+.\}
+.RS 4
+.BM yellow
 .it 1 an-trap
 .nr an-no-space-flag 1
 .nr an-break-flag 1
 .br
-Note
+.ps +1
+\fBNote\fR
+.ps -1
+.br
 .PP
-The Default values are those set at compile\-time\. Use
+The Default values are those set at compile\-time\&. Use
 \fBamrestore\fR
-to recover client\-encrypted or client\-custom\-compressed tapes\.
+to recover client\-encrypted or client\-custom\-compressed tapes\&.
+.sp .5v
+.EM yellow
+.RE
 .PP
 \fB[ \-C ] config\fR
 .RS 4
 \fIAmanda\fR
-configuration\.
+configuration\&.
 .RE
 .PP
 \fB\-s index\-server\fR
 .RS 4
-Host that runs the index daemon\.
+Host that runs the index daemon\&.
 .RE
 .PP
 \fB\-t tape\-server\fR
 .RS 4
-Host that runs the tape server daemon\.
+Host that runs the tape server daemon\&.
 .RE
 .PP
 \fB\-d tape\-device\fR
 .RS 4
-Tape device to use on the tape server host\.
+Tape device to use on the tape server host\&.
 .RE
 .PP
 \fB\-o\fR \fIclientconfigoption\fR
 .RS 4
 See the "\fBCONFIGURATION OVERRIDE\fR" section in
-\fBamanda\fR(8)\.
+\fBamanda\fR(8)\&.
 .RE
 .SH "COMMANDS"
 .PP
 \fBAmrecover\fR
-connects to the index server and then presents a command line prompt\. Usage is similar to an ftp client\. The GNU readline library is used to provide command line history and editing if it was built in to
-\fBamrecover\fR\.
+connects to the index server and then presents a command line prompt\&. Usage is similar to an ftp client\&. The GNU readline library is used to provide command line history and editing if it was built in to
+\fBamrecover\fR\&.
 .PP
 The purpose of browsing the database is to build up a
 \fIrestore list\fR
-of files to be extracted from the backup system\. The following commands are available:
+of files to be extracted from the backup system\&. The following commands are available:
 .PP
 \fBsethost hostname\fR
 .RS 4
-Specifies which host to look at backup files for (default: the local host)\.
+Specifies which host to look at backup files for (default: the local host)\&.
 .RE
 .PP
 \fBsetdate YYYY\-MM\-DD\-HH\-MM[\-SS] | YYYY\-MM\-DD\fR
 .RS 4
-Set the restore time (default: now)\. File listing commands only return information on backup images for this day, for the day before with the next lower dump level, and so on, until the most recent level 0 backup on or before the specified date is encountered\.
+Set the restore time (default: now)\&. File listing commands only return information on backup images for this day, for the day before with the next lower dump level, and so on, until the most recent level 0 backup on or before the specified date is encountered\&.
 .sp
 For example, if:
 .sp
+.if n \{\
 .RS 4
+.\}
+.fam C
+.ps -1
 .nf
+.if t \{\
+.sp -1
+.\}
+.BB lightgray adjust-for-leading-newline
+.sp -1
+
 1996\-07\-01 was a level 0 backup
 1996\-07\-02 through 1996\-07\-05 were level 1 backups
 1996\-07\-06 through 1997\-07\-08 were level 2 backups
+.EB lightgray adjust-for-leading-newline
+.if t \{\
+.sp 1
+.\}
 .fi
+.fam
+.ps +1
+.if n \{\
 .RE
+.\}
 .sp
 then the command
 \fBsetdate 1997\-07\-08\-00\fR
 would yield files from the following days:
 .sp
+.if n \{\
 .RS 4
+.\}
+.fam C
+.ps -1
 .nf
+.if t \{\
+.sp -1
+.\}
+.BB lightgray adjust-for-leading-newline
+.sp -1
+
 1997\-07\-08 (the latest level 2 backup)
 1997\-07\-05 (the latest level 1 backup)
 1997\-07\-01 (the latest level 0 backup)
+.EB lightgray adjust-for-leading-newline
+.if t \{\
+.sp 1
+.\}
 .fi
+.fam
+.ps +1
+.if n \{\
 .RE
+.\}
 .sp
-Only the most recent version of a file will be presented\.
+Only the most recent version of a file will be presented\&.
 .sp
 The following abbreviated date specifications are accepted:
 .PP
@@ -136,16 +341,15 @@ dates in the current month of the current year
 .RS 4
 Specifies which disk to consider (default: the disk holding the working directory where
 \fBamrecover\fR
-is started)\. It can only be set after the host is set with
-\fBsethost\fR\.
+is started)\&. It can only be set after the host is set with
+\fBsethost\fR\&.
 \fIDiskname\fR
 is the device name specified in the
-\fIamanda\.conf\fR
+\fIamanda\&.conf\fR
 or
-\fIdisklist\fR
-configuration file\. The disk must be local to the host\. If
+\fBdisklist\fR(5)\&. The disk must be local to the host\&. If
 \fImountpoint\fR
-is not specified, all pathnames will be relative to the (unknown) mount point instead of full pathnames\.
+is not specified, all pathnames will be relative to the (unknown) mount point instead of full pathnames\&.
 .RE
 .PP
 \fBlisthost\fR [\fIdiskdevice\fR]
@@ -162,15 +366,15 @@ List all
 .PP
 \fBsetdevice\fR [[\-h \fItape\-server\fR] \fItapedev\fR]
 .RS 4
-Specifies the host to use as the tape server, and which of its tape devices to use\. If the server is omitted, the server name reverts to the configure\-time default\. If the tape device is omitted, the default is used\.
+Specifies the host to use as the tape server, and which of its tape devices to use\&. If the server is omitted, the server name reverts to the configure\-time default\&. If the tape device is omitted, the default is used\&.
 .sp
 If you want amrecover to use your changer, the
 \fItapedev\fR
-must be equal to the amrecover_changer setting on the server\.
+must be equal to the amrecover_changer setting on the server\&.
 .sp
-If you need to change the protocol (tape:, rait:, file:, null:) then you must specify the hostname\.
+Since device names contain colons, you must always specify the hostname\&.
 .nf
-settape 192\.168\.0\.10:file:/file1
+settape 192\&.168\&.0\&.10:file:/file1
 .fi
 You can change the tape device when amrecover ask you to load the tape:
 .nf
@@ -178,58 +382,58 @@ Load tape DMP014 now
 Continue? [Y/n/t]: t
 Tape device: server2:/dev/nst2
 Continue? [Y/n/t]: Y
-Using tape /dev/nst2 from server server2\.
+Using tape /dev/nst2 from server server2\&.
 .fi
 .RE
 .PP
 \fBsetmode\fR \fImode\fR
 .RS 4
-Set the extraction mode for Samba shares\. If
+Set the extraction mode for Samba shares\&. If
 \fImode\fR
 is
-\fBsmb\fR, shares are sent to the Samba server to be restored back onto the PC\. If
+\fBsmb\fR, shares are sent to the Samba server to be restored back onto the PC\&. If
 \fImode\fR
 is
-\fBtar\fR, they are extracted on the local machine the same way tar volumes are extracted\.
+\fBtar\fR, they are extracted on the local machine the same way tar volumes are extracted\&.
 .RE
 .PP
 \fBmode\fR
 .RS 4
-Displays the extracting mode for Samba shares\.
+Displays the extracting mode for Samba shares\&.
 .RE
 .PP
 \fBhistory\fR
 .RS 4
-Show the backup history of the current host and disk\. Dates, levels, tapes and file position on tape of each backup are displayed\.
+Show the backup history of the current host and disk\&. Dates, levels, tapes and file position on tape of each backup are displayed\&.
 .RE
 .PP
 \fBpwd\fR
 .RS 4
-Display the name of the current backup working directory\.
+Display the name of the current backup working directory\&.
 .RE
 .PP
 \fBcd\fR \fIdir\fR
 .RS 4
 Change the backup working directory to
-\fIdir\.\fR
+\fIdir\&.\fR
 If the mount point was specified with
-\fBsetdisk\fR, this can be a full pathname or it can be relative to the current backup working directory\. If the mount point was not specified, paths are relative to the mount point if they start with "/", otherwise they are relative to the current backup working directory\. The
+\fBsetdisk\fR, this can be a full pathname or it can be relative to the current backup working directory\&. If the mount point was not specified, paths are relative to the mount point if they start with "/", otherwise they are relative to the current backup working directory\&. The
 \fIdir\fR
-can be a shell style wildcards\.
+can be a shell style wildcards\&.
 .RE
 .PP
 \fBcdx\fR \fIdir\fR
 .RS 4
 Like the
 \fBcd\fR
-command but allow regular expression\.
+command but allow regular expression\&.
 .RE
 .PP
 \fBlpwd\fR
 .RS 4
 Display the
 \fBamrecover\fR
-working directory\. Files will be restored under this directory, relative to the backed up filesystem\.
+working directory\&. Files will be restored under this directory, relative to the backed up filesystem\&.
 .RE
 .PP
 \fBlcd\fR \fIpath\fR
@@ -237,114 +441,114 @@ working directory\. Files will be restored under this directory, relative to the
 Change the
 \fBamrecover\fR
 working directory to
-\fIpath\fR\.
+\fIpath\fR\&.
 .RE
 .PP
 \fBls\fR
 .RS 4
-List the contents of the current backup working directory\. See the description of the
+List the contents of the current backup working directory\&. See the description of the
 \fBsetdate\fR
-command for how the view of the directory is built up\. The backup date is shown for each file\.
+command for how the view of the directory is built up\&. The backup date is shown for each file\&.
 .RE
 .PP
-\fBadd\fR \fIitem1 item2 \.\.\.\fR
+\fBadd\fR \fIitem1 item2 \&.\&.\&.\fR
 .RS 4
-Add the specified files or directories to the restore list\. Each item may have shell style wildcards\.
+Add the specified files or directories to the restore list\&. Each item may have shell style wildcards\&.
 .RE
 .PP
-\fBaddx\fR \fIitem1 item2 \.\.\.\fR
+\fBaddx\fR \fIitem1 item2 \&.\&.\&.\fR
 .RS 4
-Add the specified files or directories to the restore list\. Each item may be a regular expression\.
+Add the specified files or directories to the restore list\&. Each item may be a regular expression\&.
 .RE
 .PP
-\fBdelete\fR \fIitem1 item2 \.\.\.\fR
+\fBdelete\fR \fIitem1 item2 \&.\&.\&.\fR
 .RS 4
-Delete the specified files or directories from the restore list\. Each item may have shell style wildcards\.
+Delete the specified files or directories from the restore list\&. Each item may have shell style wildcards\&.
 .RE
 .PP
-\fBdeletex\fR \fIitem1 item2 \.\.\.\fR
+\fBdeletex\fR \fIitem1 item2 \&.\&.\&.\fR
 .RS 4
-Delete the specified files or directories from the restore list\. Each item may be a regular expression\.
+Delete the specified files or directories from the restore list\&. Each item may be a regular expression\&.
 .RE
 .PP
 \fBlist\fR \fIfile\fR
 .RS 4
-Display the contents of the restore list\. If a file name is specified, the restore list is written to that file\. This can be used to manually extract the files from the
+Display the contents of the restore list\&. If a file name is specified, the restore list is written to that file\&. This can be used to manually extract the files from the
 \fIAmanda\fR
 tapes with
-\fBamrestore\fR\.
+\fBamrestore\fR\&.
 .RE
 .PP
 \fBclear\fR
 .RS 4
-Clear the restore list\.
+Clear the restore list\&.
 .RE
 .PP
 \fBquit\fR
 .RS 4
-Close the connection to the index server and exit\.
+Close the connection to the index server and exit\&.
 .RE
 .PP
 \fBexit\fR
 .RS 4
-Close the connection to the index server and exit\.
+Close the connection to the index server and exit\&.
 .RE
 .PP
 \fBextract\fR
 .RS 4
-Start the extract sequence (see the examples below)\. Make sure the local working directory is the root of the backed up filesystem, or another directory that will behave like that\. Use
+Start the extract sequence (see the examples below)\&. Make sure the local working directory is the root of the backed up filesystem, or another directory that will behave like that\&. Use
 \fBlpwd\fR
 to display the local working directory, and
 \fBlcd\fR
-to change it\.
+to change it\&.
 .RE
 .PP
 \fBhelp\fR
 .RS 4
-Display a brief list of these commands\.
+Display a brief list of these commands\&.
 .RE
 .SH "EXAMPLES"
 .PP
 The following shows the recovery of an old
 \fIsyslog\fR
-file\.
+file\&.
 .nf
 # cd /var/log
-# ls \-l syslog\.7
-syslog\.7: No such file or directory
-# amrecover
-AMRECOVER Version 2\.4\.2\. Contacting server on oops \.\.\.
-220 oops \fIAmanda\fR index server (2\.4\.2) ready\.
+# ls \-l syslog\&.7
+syslog\&.7: No such file or directory
+# amrecover MyConfig
+AMRECOVER Version 2\&.4\&.2\&. Contacting server on oops \&.\&.\&.
+220 oops \fIAmanda\fR index server (2\&.4\&.2) ready\&.
 Setting restore date to today (1997\-12\-09)
-200 Working date set to 1997\-12\-09\.
-200 Config set to daily\.
-200 Dump host set to this\-host\.some\.org\.
-$CWD \'/var/log\' is on disk \'/var\' mounted at \'/var\'\.
-200 Disk set to /var\.
+200 Working date set to 1997\-12\-09\&.
+200 Config set to MyConfig\&.
+200 Dump host set to this\-host\&.some\&.org\&.
+$CWD \'/var/log\' is on disk \'/var\' mounted at \'/var\'\&.
+200 Disk set to /var\&.
 /var/log
 WARNING: not on root of selected filesystem, check man\-page!
 amrecover> ls
-1997\-12\-09 daemon\.log
+1997\-12\-09 daemon\&.log
 1997\-12\-09 syslog
 1997\-12\-08 authlog
-1997\-12\-08 sysidconfig\.log
-1997\-12\-08 syslog\.0
-1997\-12\-08 syslog\.1
-1997\-12\-08 syslog\.2
-1997\-12\-08 syslog\.3
-1997\-12\-08 syslog\.4
-1997\-12\-08 syslog\.5
-1997\-12\-08 syslog\.6
-1997\-12\-08 syslog\.7
-amrecover> add syslog\.7
-Added /log/syslog\.7
+1997\-12\-08 sysidconfig\&.log
+1997\-12\-08 syslog\&.0
+1997\-12\-08 syslog\&.1
+1997\-12\-08 syslog\&.2
+1997\-12\-08 syslog\&.3
+1997\-12\-08 syslog\&.4
+1997\-12\-08 syslog\&.5
+1997\-12\-08 syslog\&.6
+1997\-12\-08 syslog\&.7
+amrecover> add syslog\&.7
+Added /log/syslog\&.7
 amrecover> lpwd
 /var/log
-amrecover> lcd \.\.
+amrecover> lcd \&.\&.
 /var
 amrecover> extract
 
-Extracting files using tape drive /dev/nst0 on host 192\.168\.0\.10
+Extracting files using tape drive /dev/nst0 on host 192\&.168\&.0\&.10
 
 The following tapes are needed: DMP014
 
@@ -353,41 +557,41 @@ Continue? [Y/n]: y
 
 Load tape DMP014 now
 Continue? [Y/n/t]: y
-set owner/mode for \'\.\'? [yn] n
+set owner/mode for \'\&.\'? [yn] n
 amrecover> quit
-200 Good bye\.
-# ls \-l syslog\.7
+200 Good bye\&.
+# ls \-l syslog\&.7
 total 26
-\-rw\-r\-\-r\-\-   1 root     other      12678 Oct 14 16:36 syslog\.7
+\-rw\-r\-\-r\-\-   1 root     other      12678 Oct 14 16:36 syslog\&.7
 .fi
 .PP
 If you do not want to overwrite existing files, create a subdirectory to run
 \fBamrecover\fR
-from and then move the restored files afterward\.
+from and then move the restored files afterward\&.
 .nf
 # cd /var
-# (umask 077 ; mkdir \.restore)
-# cd \.restore
+# (umask 077 ; mkdir \&.restore)
+# cd \&.restore
 # amrecover
-AMRECOVER Version 2\.4\.2\. Contacting server on oops \.\.\.
-\.\.\.
+AMRECOVER Version 2\&.4\&.2\&. Contacting server on oops \&.\&.\&.
+\&.\&.\&.
 amrecover> cd log
 /var/log
 amrecover> ls
-\.\.\.
-amrecover> add syslog\.7
-Added /log/syslog\.7
+\&.\&.\&.
+amrecover> add syslog\&.7
+Added /log/syslog\&.7
 amrecover> lpwd
-/var/\.restore
+/var/\&.restore
 amrecover> extract
 
-Extracting files using tape drive /dev/nst0 on host 192\.168\.0\.10
-\.\.\.
+Extracting files using tape drive /dev/nst0 on host 192\&.168\&.0\&.10
+\&.\&.\&.
 amrecover> quit
-200 Good bye\.
-# mv \-i log/syslog\.7 \.\./log/syslog\.7\-restored
-# cd \.\.
-# rm \-fr \.restore
+200 Good bye\&.
+# mv \-i log/syslog\&.7 \&.\&./log/syslog\&.7\-restored
+# cd \&.\&.
+# rm \-fr \&.restore
 .fi
 .PP
 If you need to run
@@ -396,22 +600,22 @@ by hand instead of letting
 \fBamrecover\fR
 control it, use the
 \fBlist\fR
-command after browsing to display the needed tapes\.
+command after browsing to display the needed tapes\&.
 .nf
 # cd /var/log
 # amrecover
-AMRECOVER Version 2\.4\.2\. Contacting server on oops \.\.\.
-\.\.\.
+AMRECOVER Version 2\&.4\&.2\&. Contacting server on oops \&.\&.\&.
+\&.\&.\&.
 amrecover> ls
-\.\.\.
-amrecover> add syslog syslog\.6 syslog\.7
+\&.\&.\&.
+amrecover> add syslog syslog\&.6 syslog\&.7
 Added /log/syslog
-Added /log/syslog\.6
-Added /log/syslog\.7
+Added /log/syslog\&.6
+Added /log/syslog\&.7
 amrecover> list
 TAPE DMP014 LEVEL 0 DATE 1997\-12\-08
-        /log/syslog\.7
-        /log/syslog\.6
+        /log/syslog\&.7
+        /log/syslog\&.6
 TAPE DMP015 LEVEL 1 DATE 1997\-12\-09
         /log/syslog
 amrecover> quit 
@@ -419,16 +623,16 @@ amrecover> quit
 .PP
 The
 \fBhistory\fR
-command shows each tape that has a backup of the current disk along with the date of the backup, the level, the tape label and the file position on the tape\. All active tapes are listed, not just back to the most recent full dump\.
+command shows each tape that has a backup of the current disk along with the date of the backup, the level, the tape label and the file position on the tape\&. All active tapes are listed, not just back to the most recent full dump\&.
 .PP
-Tape file position zero is a label\. The first backup image is in file position one\.
+Tape file position zero is a label\&. The first backup image is in file position one\&.
 .nf
 # cd /var/log
 # amrecover
-AMRECOVER Version 2\.4\.2\. Contacting server on oops \.\.\.
-\.\.\.
+AMRECOVER Version 2\&.4\&.2\&. Contacting server on oops \&.\&.\&.
+\&.\&.\&.
 amrecover> history
-200\- Dump history for config "daily" host "this\-host\.some\.org" disk "/var"
+200\- Dump history for config "MyConfig" host "this\-host\&.some\&.org" disk "/var"
 201\- 1997\-12\-09 1 DMP015 9
 201\- 1997\-12\-08 1 DMP014 11
 201\- 1997\-12\-07 0 DMP013 22
@@ -439,7 +643,7 @@ amrecover> history
 201\- 1997\-12\-02 1 DMP008 7
 201\- 1997\-12\-01 1 DMP007 9
 201\- 1997\-11\-30 1 DMP006 6
-\.\.\.
+\&.\&.\&.
 amrecover> quit 
 .fi
 .SH "ENVIRONMENT"
@@ -449,24 +653,15 @@ The
 \fBls\fR
 and
 \fBlist\fR
-commands will use $PAGER to display the file lists\. Defaults to
+commands will use $PAGER to display the file lists\&. Defaults to
 \fImore\fR
-if PAGER is not set\.
+if PAGER is not set\&.
 .PP
 \fBAMANDA_SERVER\fR
-If set, $AMANDA_SERVER will be used as index\-server\. The value will take precedence over the compiled default, but will be overridden by the \-s switch\.
+If set, $AMANDA_SERVER will be used as index\-server\&. The value will take precedence over the compiled default, but will be overridden by the \-s switch\&.
 .PP
 \fBAMANDA_TAPE_SERVER\fR
-If set, $AMANDA_TAPE_SERVER will be used as tape\-server\. The value will take precedence over the compiled default, but will be overridden by the \-t switch\.
-.SH "AUTHOR"
-.PP
-Alan M\. McIvor
-<alan@kauri\.auck\.irl\.cri\.nz>
-: Original text
-.PP
-Stefan G\. Weichinger,
-<sgw@amanda\.org>, maintainer of the
-\fIAmanda\fR\-documentation: XML\-conversion
+If set, $AMANDA_TAPE_SERVER will be used as tape\-server\&. The value will take precedence over the compiled default, but will be overridden by the \-t switch\&.
 .SH "SEE ALSO"
 .PP
 \fBamanda\fR(8),
@@ -475,3 +670,8 @@ Stefan G\. Weichinger,
 \fBamfetchdump\fR(8),
 \fBreadline\fR(3),
 : http://wiki.zmanda.com
+.SH "Authors"
+.PP
+\fBAlan M\&. McIvor\fR <\&alan@kauri\&.auck\&.irl\&.cri\&.nz\&>
+.PP
+\fBStefan G\&. Weichinger\fR <\&sgw@amanda\&.org\&>
index d8feabbfe1f5632eaf88528c2ae96552154d3c59..d9948289e359c3dc0cef43f403f8f0299bddd6f6 100644 (file)
 .\"     Title: amreport
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
+.\"    Author: Stefan G. Weichinger <sgw@amanda.org>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
 .\"
-.TH "AMREPORT" "8" "08/22/2008" "" ""
+.TH "AMREPORT" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
 .ad l
-.SH "NAME"
-amreport - generate a formatted output of statistics for an Amanda run
-.SH "SYNOPSIS"
-.HP 9
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amreport \- generate a formatted output of statistics for an \fIAmanda\fR run
+.SH "Synopsis"
+.fam C
+.HP \w'\fBamreport\fR\ 'u
 \fBamreport\fR [\fIconfig\fR] [\-i] [\-M\ \fIaddress\fR] [\-l\ \fIlogfile\fR] [\-f\ \fIoutputfile\fR] [\-p\ \fIpostscriptfile\fR] [\-o\ \fIconfigoption\fR]...
+.fam
 .SH "DESCRIPTION"
 .PP
 \fBAmreport\fR
 generates a summary report of an
 \fBamanda\fR(8)
-backup run\. If no configuration name is specified, amanda\.conf is read from the current directory\.
+backup run\&. If no configuration name is specified, amanda\&.conf is read from the current directory\&.
 .PP
 See the
 \fBamanda\fR(8)
 man page for more details about
-\fIAmanda\fR\.
+\fIAmanda\fR\&.
 .SH "OPTIONS"
 .PP
 \fIconfig\fR
 .RS 4
-Name of the configuration to process\.
+Name of the configuration to process\&.
 .RE
 .PP
 \fB\-i\fR
 .RS 4
-Don\'t email the report\.
+Don\'t email the report\&.
 .RE
 .PP
 \fB\-M\fR \fIaddress\fR
@@ -45,19 +203,19 @@ Mail the report to
 instead of the
 \fBmailto\fR
 value from
-\fIamanda\.conf\fR\.
+\fIamanda\&.conf\fR\&.
 .RE
 .PP
 \fB\-l\fR \fIlogfile\fR
 .RS 4
-Name of the log file to parse to generate the report\. If a log file is not specified, it defaults to the file:
+Name of the log file to parse to generate the report\&. If a log file is not specified, it defaults to the file:
 .RE
 .PP
 \fIlogdir\fR/log
 .PP
 where
 \fIlogdir\fR
-is the log directory defined in amanda\.conf\.
+is the log directory defined in amanda\&.conf\&.
 .PP
 \fB\-f\fR \fIoutputfile\fR
 .RS 4
@@ -65,10 +223,10 @@ Normally,
 \fBamreport\fR
 sends the report via e\-mail to the
 \fImailto\fR
-user as defined in the amanda\.conf file\. If
+user as defined in the amanda\&.conf file\&. If
 \fIoutputfile\fR
 is specified, then the report is put in
-\fIoutputfile\fR\.
+\fIoutputfile\fR\&.
 .RE
 .PP
 \fB\-p\fR \fIpostscriptfile\fR
@@ -77,47 +235,65 @@ Send the postscript output to the file
 \fIpostscriptfile\fR
 instead of to the
 \fBlpr\fR(1)
-command\. This option has an effect only if the
+command\&. This option has an effect only if the
 \fIlbl\-templ\fR
-directive is specified in amanda\.conf\.
+directive is specified in amanda\&.conf\&.
 .RE
 .PP
 \fB\-o\fR \fIconfigoption\fR
 .RS 4
 See the "\fBCONFIGURATION OVERRIDE\fR" section in
-\fBamanda\fR(8)\.
+\fBamanda\fR(8)\&.
 .RE
 .SH "LABEL PRINTING"
 .PP
 \fIAmanda\fR
-can print postscript labels describing the contents of tape(s) written in a run\. The labels are designed to be folded and inserted into the tape case along with the tape or hole punched and put in a 3\-ring binder\. Various label templates are provided to format data for different tape sizes\.
+can print postscript labels describing the contents of tape(s) written in a run\&. The labels are designed to be folded and inserted into the tape case along with the tape or hole punched and put in a 3\-ring binder\&. Various label templates are provided to format data for different tape sizes\&.
 .PP
-The information printed varies slightly between label templates due to size constraints\. Labels contain one line for each host/file\-system pair and may also contain the file number on the tape, the level of the dump, the original size of the dump and the size of the (possibly compressed) tape file\.
+The information printed varies slightly between label templates due to size constraints\&. Labels contain one line for each host/file\-system pair and may also contain the file number on the tape, the level of the dump, the original size of the dump and the size of the (possibly compressed) tape file\&.
 .PP
 Add the
 \fIlbl\-templ\fR
-parameter to the tapetype definition in amanda\.conf to enable labels\. If you don\'t add this line to your tapetype definition,
+parameter to the tapetype definition in amanda\&.conf to enable labels\&. If you don\'t add this line to your tapetype definition,
 \fBamreport\fR
-will not print tape labels\.
+will not print tape labels\&.
 .PP
 You may use the
 \fIremap=\'I\'>printer\fR
-keyword in amanda\.conf to print to other than the system default printer\.
+keyword in amanda\&.conf to print to other than the system default printer\&.
 .SH "TEMPLATES"
 .PP
 \fIAmanda\fR
-provides label templates for the following tape types\. These are pretty generic labels and should be easy to customize for other tape types or particular site needs\.
+provides label templates for the following tape types\&. These are pretty generic labels and should be easy to customize for other tape types or particular site needs\&.
 .sp
+.if n \{\
 .RS 4
+.\}
+.fam C
+.ps -1
 .nf
+.if t \{\
+.sp -1
+.\}
+.BB lightgray adjust-for-leading-newline
+.sp -1
+
 * ExaByte 8mm tapes
 * DAT 4mm tapes
 * DLT tapes
 * 3\-ring binder
+.EB lightgray adjust-for-leading-newline
+.if t \{\
+.sp 1
+.\}
 .fi
+.fam
+.ps +1
+.if n \{\
 .RE
+.\}
 .PP
-The 3\-ring binder type is the most generic\. It may be used to make a hardcopy log of the tapes\.
+The 3\-ring binder type is the most generic\&. It may be used to make a hardcopy log of the tapes\&.
 .SH "EXIT CODE"
 
 The exit code of \fBamreport\fR is the ORed value of:
@@ -134,3 +310,6 @@ The exit code of \fBamreport\fR is the ORed value of:
 \fBamanda\fR(8),
 \fBamflush\fR(8),
 : http://wiki.zmanda.com
+.SH "Author"
+.PP
+\fBStefan G\&. Weichinger\fR <\&sgw@amanda\&.org\&>
index d7617d963bdb5af91b26533e94c3f995f48fa2ef..64615a0563ed691c61b9e0be217a4eb1becedc60 100644 (file)
 .\"     Title: amrestore
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
+.\"    Author: James da Silva <jds@amanda.org>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
 .\"
-.TH "AMRESTORE" "8" "08/22/2008" "" ""
+.TH "AMRESTORE" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
 .ad l
-.SH "NAME"
-amrestore - extract backup images from an Amanda tape
-.SH "SYNOPSIS"
-.HP 10
-\fBamrestore\fR [\-r | \-c | \-C] [\-b | \fIblocksize\fR] [\-f | \fIfileno\fR] [\-l | \fIlabel\fR] [\-p] [\-h] \fItapedevice\fR|\ \fIholdingfile\fR  [\fIhostname\fR [\fIdiskname\fR [\fIdatestamp\fR [\fIhostname\fR [\fIdiskname\fR [\fIdatestamp\fR | \.\.\.]]]]]]
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amrestore \- extract backup images from an \fIAmanda\fR tape
+.SH "Synopsis"
+.fam C
+.HP \w'\fBamrestore\fR\ 'u
+\fBamrestore\fR [\-r | \-c | \-C] [\-b | \fIblocksize\fR] [\-f | \fIfileno\fR] [\-l | \fIlabel\fR] [\-p] [\-h] \fItapedevice\fR|\ \fIholdingfile\fR  [\fIhostname\fR [\fIdiskname\fR [\fIdatestamp\fR [\fIhostname\fR [\fIdiskname\fR [\fIdatestamp\fR | \&.\&.\&.]]]]]]
+.fam
 .SH "DESCRIPTION"
 .PP
 \fBAmrestore\fR
@@ -27,70 +185,70 @@ that match
 \fIdiskname\fR
 and
 \fIdatestamp\fR
-patterns given on the command line\. The tape or holding file must be in a format written by the
+patterns given on the command line\&. The tape or holding file must be in a format written by the
 \fBamdump\fR
 or
 \fBamflush\fR
-program\.
+program\&.
 .PP
 If
 \fIdiskname\fR
 is not specified, all backups on the tape for the previous
 \fIhostname\fR
-are candidates\. If
+are candidates\&. If
 \fIdatestamp\fR
 is not specified, all backups on the tape for the previous
 \fIhostname\fR
 and
 \fIdiskname\fR
-are candidates\. If no
+are candidates\&. If no
 \fIhostname\fR,
 \fIdiskname\fR
 or
 \fIdatestamp\fR
-are specified, every backup on the tape is a candidate\.
+are specified, every backup on the tape is a candidate\&.
 .PP
 \fIHostname\fR
 and
 \fIdiskname\fR
 are special expressions described in the "HOST & DISK EXPRESSION" section of
-\fBamanda\fR(8)\.
+\fBamanda\fR(8)\&.
 \fIDatestamp\fR
 are special expression described in the "DATESTAMP EXPRESSION" section of
-\fBamanda\fR(8)\. For example, if
+\fBamanda\fR(8)\&. For example, if
 \fIdiskname\fR
 is "rz[23]a", it would match disks
 \fBrz2a\fR
 and
-\fBrz3a\fR\.
+\fBrz3a\fR\&.
 .PP
 \fIDatestamp\fR
 is useful if
 \fBamflush\fR
-writes multiple backup runs to a single tape\.
+writes multiple backup runs to a single tape\&.
 .PP
 Unless
 \fB\-p\fR
 is used, candidate backup images are extracted to files in the current directory named:
 .PP
-\fIhostname\.diskname\.datestamp\.dumplevel\fR
+\fIhostname\&.diskname\&.datestamp\&.dumplevel\fR
 .PP
 Amrestore doesn\'t use a changer, it restore from the tape already loaded in the
-\fItapedevice\.\fR
+\fItapedevice\&.\fR
 .SH "OPTIONS"
 .PP
 \fB\-b\fR
 .RS 4
-Set the blocksize used to read the tape or holding file\. All holding files must be read with a blocksize of 32 KBytes\.
+Set the blocksize used to read the tape or holding file\&. All holding files must be read with a blocksize of 32 KBytes\&.
 \fBAmrestore\fR
-should normally be able to determine the blocksize for tapes on its own and not need this parameter\.
+should normally be able to determine the blocksize for tapes on its own and not need this parameter\&.
 .RE
 .PP
-The default is 32 KBytes\.
+The default is 32 KBytes\&.
 .PP
 \fB\-f\fR
 .RS 4
-Do a rewind followed by a fsf <fileno> before trying to restore an image\.
+Do a rewind followed by a fsf <fileno> before trying to restore an image\&.
 .RE
 .PP
 \fB\-l\fR
@@ -101,109 +259,145 @@ Check if we restoring from the tape with the right
 .PP
 \fB\-p\fR
 .RS 4
-Pipe output\. The first matching backup image is sent to standard output, which is normally a pipe to
+Pipe output\&. The first matching backup image is sent to standard output, which is normally a pipe to
 \fBrestore\fR
 or
 \fBtar\fR, then
 \fBamrestore\fR
-quits\. It may be run again to continue selecting backups to process\. Make sure you specify the no\-rewind
+quits\&. It may be run again to continue selecting backups to process\&. Make sure you specify the no\-rewind
 \fItapedevice\fR
-when doing this\.
+when doing this\&.
 .RE
 .PP
 Note:
 \fBrestore\fR
-may report "short read" errors when reading from a pipe\. Most versions of
+may report "short read" errors when reading from a pipe\&. Most versions of
 \fBrestore\fR
-support a blocking factor option to let you set the read block size, and you should set it to 2\. See the example below\.
+support a blocking factor option to let you set the read block size, and you should set it to 2\&. See the example below\&.
 .PP
 \fB\-c\fR
 .RS 4
-Compress output using the fastest method the compression program provides\.
+Compress output using the fastest method the compression program provides\&.
 \fBAmrestore\fR
 normally writes output files in a format understood by
 \fBrestore\fR
 or
-\fBtar\fR, even if the backups on the tape are compressed\. With the
+\fBtar\fR, even if the backups on the tape are compressed\&. With the
 \fB\-c\fR
 or
 \fB\-C\fR
 option,
 \fBamrestore\fR
-writes all files in compressed format, even if the backups on the tape are not compressed\. Output file names will have a
-\fB\.Z\fR
+writes all files in compressed format, even if the backups on the tape are not compressed\&. Output file names will have a
+\fB\&.Z\fR
 or
-\fB\.gz\fR
+\fB\&.gz\fR
 extension depending on whether
 \fBcompress\fR
 or
 \fBgzip\fR
-is the preferred compression program\. This option is useful when the current directory disk is small\.
+is the preferred compression program\&. This option is useful when the current directory disk is small\&.
 .RE
 .PP
 \fB\-C\fR
 .RS 4
-Compress output using the best method the compression program provides (may be very CPU intensive)\. See the notes above about the
+Compress output using the best method the compression program provides (may be very CPU intensive)\&. See the notes above about the
 \fB\-c\fR
-option\.
+option\&.
 .RE
 .PP
 \fB\-r\fR
 .RS 4
-Raw output\. Backup images are output exactly as they are on the tape, including the
+Raw output\&. Backup images are output exactly as they are on the tape, including the
 \fBamdump\fR
-headers\. Output file names will have a
-\fB\.RAW\fR
-extension\. This option is only useful for debugging and other strange circumstances\.
+headers\&. Output file names will have a
+\fB\&.RAW\fR
+extension\&. This option is only useful for debugging and other strange circumstances\&.
 .RE
 .PP
 \fB\-h\fR
 .RS 4
-Header output\. The tape header block is output at the beginning of each file\. This is like
+Header output\&. The tape header block is output at the beginning of each file\&. This is like
 \fB\-r\fR
 except
 \fB\-c\fR
 or
 \fB\-C\fR
-may also be used to compress the result\.
+may also be used to compress the result\&.
 \fBAmrecover\fR
-uses the header to determine the restore program to use\.
+uses the header to determine the restore program to use\&.
 .RE
 .PP
-If a header is written (\-r or \-h), only 32 KBytes are output regardless of the tape blocksize\. This makes the resulting image usable as a holding file\.
+If a header is written (\-r or \-h), only 32 KBytes are output regardless of the tape blocksize\&. This makes the resulting image usable as a holding file\&.
 .PP
 \fB\-o\fR \fIconfigoption\fR
 .RS 4
 See the "\fBCONFIGURATION OVERRIDE\fR" section in
-\fBamanda\fR(8)\.
+\fBamanda\fR(8)\&.
 .RE
 .SH "EXAMPLES"
 .PP
 The following does an interactive restore of disk
 \fIrz3g\fR
 from host
-\fIseine\fR, to restore particular files\. Note the use of the
+\fIseine\fR, to restore particular files\&. Note the use of the
 \fBb\fR
 option to
-\fBrestore\fR, which causes it to read in units of two 512\-byte blocks (1 Kbyte) at a time\. This helps keep it from complaining about short reads\.
+\fBrestore\fR, which causes it to read in units of two 512\-byte blocks (1 Kbyte) at a time\&. This helps keep it from complaining about short reads\&.
 .sp
+.if n \{\
 .RS 4
+.\}
+.fam C
+.ps -1
 .nf
+.if t \{\
+.sp -1
+.\}
+.BB lightgray adjust-for-leading-newline
+.sp -1
+
 % amrestore \-p /dev/nrmt9 seine rz3g | restore \-ivbf 2 \-
+.EB lightgray adjust-for-leading-newline
+.if t \{\
+.sp 1
+.\}
 .fi
+.fam
+.ps +1
+.if n \{\
 .RE
+.\}
 .PP
 The next example extracts all backup images for host
-\fIseine\fR\. This is the usual way to extract all data for a host after a disk crash\.
+\fIseine\fR\&. This is the usual way to extract all data for a host after a disk crash\&.
 .sp
+.if n \{\
 .RS 4
+.\}
+.fam C
+.ps -1
 .nf
+.if t \{\
+.sp -1
+.\}
+.BB lightgray adjust-for-leading-newline
+.sp -1
+
 % amrestore /dev/nrmt9 seine
+.EB lightgray adjust-for-leading-newline
+.if t \{\
+.sp 1
+.\}
 .fi
+.fam
+.ps +1
+.if n \{\
 .RE
+.\}
 .PP
 If the backup datestamp in the above example is
-19910125
+\FC19910125\F[]
 and
 \fIseine\fR
 has level 0 backups of disks
@@ -212,49 +406,95 @@ and
 \fIrz1g\fR
 on the tape, these files will be created in the current directory:
 .sp
+.if n \{\
 .RS 4
+.\}
+.fam C
+.ps -1
 .nf
-seine\.rz1a\.19910125\.0
-seine\.rz1g\.19910125\.0
+.if t \{\
+.sp -1
+.\}
+.BB lightgray adjust-for-leading-newline
+.sp -1
+
+seine\&.rz1a\&.19910125\&.0
+seine\&.rz1g\&.19910125\&.0
+.EB lightgray adjust-for-leading-newline
+.if t \{\
+.sp 1
+.\}
 .fi
+.fam
+.ps +1
+.if n \{\
 .RE
+.\}
 .PP
 You may also use
 \fBamrestore\fR
 to extract a backup image from a holding disk file that has not yet been flushed to tape:
 .sp
+.if n \{\
 .RS 4
+.\}
+.fam C
+.ps -1
 .nf
-% amrestore \-p /amanda/20001119/seine\.rz1a\.2 | restore \-ivbf 2 \-
+.if t \{\
+.sp -1
+.\}
+.BB lightgray adjust-for-leading-newline
+.sp -1
+
+% amrestore \-p /amanda/20001119/seine\&.rz1a\&.2 | restore \-ivbf 2 \-
+.EB lightgray adjust-for-leading-newline
+.if t \{\
+.sp 1
+.\}
 .fi
+.fam
+.ps +1
+.if n \{\
 .RE
+.\}
 .PP
 \fBAmrestore\fR
 may be used to generate a listing of images on a tape:
 .sp
+.if n \{\
 .RS 4
+.\}
+.fam C
+.ps -1
 .nf
+.if t \{\
+.sp -1
+.\}
+.BB lightgray adjust-for-leading-newline
+.sp -1
+
 % mt \-f /dev/nrmt9 rewind
 % amrestore \-p /dev/nrmt9 no\-such\-host > /dev/null
+.EB lightgray adjust-for-leading-newline
+.if t \{\
+.sp 1
+.\}
 .fi
+.fam
+.ps +1
+.if n \{\
 .RE
+.\}
 .PP
 This asks
 \fBamrestore\fR
 to find images for host
-\fBno\-such\-host\fR\. It will not find any entries that match, but along the way will report each image it skips\.
+\fBno\-such\-host\fR\&. It will not find any entries that match, but along the way will report each image it skips\&.
 .SH "CAVEATS"
 .PP
 \fBGNU\-tar\fR
-must be used to restore files from backup images created with the GNUTAR dumptype\. Vendor tar programs sometimes fail to read GNU tar images\.
-.SH "AUTHOR"
-.PP
-James da Silva,
-<jds@amanda\.org>, University of Maryland, College Park: Original text
-.PP
-Stefan G\. Weichinger,
-<sgw@amanda\.org>, maintainer of the
-\fIAmanda\fR\-documentation: XML\-conversion
+must be used to restore files from backup images created with the GNUTAR dumptype\&. Vendor tar programs sometimes fail to read GNU tar images\&.
 .SH "SEE ALSO"
 .PP
 \fBamanda\fR(8),
@@ -263,3 +503,8 @@ Stefan G\. Weichinger,
 \fBtar\fR(1),
 \fBrestore\fR(8),
 : http://wiki.zmanda.com
+.SH "Authors"
+.PP
+\fBJames da Silva\fR <\&jds@amanda\&.org\&>
+.PP
+\fBStefan G\&. Weichinger\fR <\&sgw@amanda\&.org\&>
index e3f1cf7054fb4c87ff178fd1c26e5c286a4a57c8..b97ce1e7f53eb6d0811663461341110fb191f82e 100644 (file)
 .\"     Title: amrmtape
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
+.\"    Author: Adrian T. Filipi-Martin <atf3r@cs.virginia.edu>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
 .\"
-.TH "AMRMTAPE" "8" "08/22/2008" "" ""
+.TH "AMRMTAPE" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
 .ad l
-.SH "NAME"
-amrmtape - remove a tape from the Amanda database
-.SH "SYNOPSIS"
-.HP 9
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amrmtape \- remove a tape from the \fIAmanda\fR database
+.SH "Synopsis"
+.fam C
+.HP \w'\fBamrmtape\fR\ 'u
 \fBamrmtape\fR [\-n] [\-v] [\-q] [\-d] \fIconfig\fR \fIlabel\fR
+.fam
 .SH "DESCRIPTION"
 .PP
 \fBAmrmtape\fR
-invalidates the contents of an existing backup tape in the configuration database\. This is meant as a recovery mechanism when a good backup is damaged either by faulty hardware or user error, e\.g\. the tape is eaten by the drive or is overwritten\.
+invalidates the contents of an existing backup tape in the configuration database\&. This is meant as a recovery mechanism when a good backup is damaged either by faulty hardware or user error, e\&.g\&. the tape is eaten by the drive or is overwritten\&.
 .PP
 See the
 \fBamanda\fR(8)
 man page for more details about
-\fIAmanda\fR\.
+\fIAmanda\fR\&.
 .SH "OPTIONS"
 .PP
 \fB\-n\fR
 .RS 4
 Generate new
-\fItapelist\fR
+\fBtapelist\fR(5)
 and database files with
 \fIlabel\fR
 removed, but leave them in
-\fI/tmp\fR
-and do not update the original copies\.
+\FC/tmp\F[]
+and do not update the original copies\&.
 .RE
 .PP
 \fB\-v\fR
 .RS 4
-List backups of hosts and disks that are being discarded\. Enabled by default\.
+List backups of hosts and disks that are being discarded\&. Enabled by default\&.
 .RE
 .PP
 \fB\-q\fR
 .RS 4
 Opposite of
-\fB\-v\fR\.
+\fB\-v\fR\&.
 .RE
 .PP
 \fB\-d\fR
 .RS 4
-Run in debugging mode so all executed commands are shown\.
+Run in debugging mode so all executed commands are shown\&.
 .RE
 .SH "EXAMPLE"
 .PP
@@ -58,20 +216,17 @@ Remove tape labeled
 \fIDAILY034\fR
 from the
 \fIDailySet1\fR
-configuration\.
+configuration\&.
 .nf
 # amrmtape DailySet1 DAILY034
 .fi
-.SH "AUTHOR"
-.PP
-Adrian T\. Filipi\-Martin
-<atf3r@cs\.virginia\.edu>: Original text
-.PP
-Stefan G\. Weichinger,
-<sgw@amanda\.org>, maintainer of the
-\fIAmanda\fR\-documentation: XML\-conversion
 .SH "SEE ALSO"
 .PP
 \fBamadmin\fR(8),
 \fBamanda\fR(8),
 : http://wiki.zmanda.com
+.SH "Authors"
+.PP
+\fBAdrian T\&. Filipi\-Martin\fR <\&atf3r@cs\&.virginia\&.edu\&>
+.PP
+\fBStefan G\&. Weichinger\fR <\&sgw@amanda\&.org\&>
diff --git a/man/amsamba.8 b/man/amsamba.8
new file mode 100644 (file)
index 0000000..c6e0f4a
--- /dev/null
@@ -0,0 +1,229 @@
+.\"     Title: amsamba
+.\"    Author: Jean-Louis Martineau <martineau@zmanda.com>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
+.\"
+.TH "AMSAMBA" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amsamba \- Amanda Application to interface with smbclient
+.SH "DESCRIPTION"
+.PP
+Amsamba is an
+\fIAmanda\fR
+Application API script\&. It should not be run by users directly\&. It uses smbclient to backup and restore data\&.
+.PP
+The device name in the disklist must have the form \'//HOST/SHARE/SUBDIR\' where HOST is the CIFS host, SHARE is the share to connect and subdir is the subdirectory to backup\&. \'/subdir\' can be ommited, in which case the complete share is archived\&. The host in the disklist should be the name of an intermediate host that has smbclient installed, and is often the Amanda server itself\&.
+.PP
+Include or exclude can be used, but not both\&. The path for \'exclude list\' or \'include list\' must be absolute path on the client\&. The estimate calculates the complete size of the share, without regard for include or exclude directives\&. It will be larger than the actual dump if you use include or exclude\&. Using \'estimate server\' in the dumptype could give better estimate\&.
+.SH "PROPERTIES"
+.PP
+This section lists the properties that control amsamba\'s functionality\&. See
+\fBamanda-applications\fR(7)
+for information on application properties and how they are configured\&.
+.PP
+SMBCLIENT\-PATH
+.RS 4
+
+The path to the smbclient binary\&.  The default is set when \fIAmanda\fR is built\&.
+.RE
+.PP
+GNUTAR\-PATH
+.RS 4
+
+The path to the gnutar binary\&.  The default is set when \fIAmanda\fR is built\&. gnutar
+is use to create the index\&.
+.RE
+.PP
+AMANDAPASS
+.RS 4
+
+Location of the amandapass file, The default is "/etc/amandapass"\&.
+The format of the file is as follow:
+.nf
+  Sharename User%Password Domain
+.fi
+
+Sharename is \'//HOST/SHARE\' without the SUBDIR\&.
+Sharename can be quoted,
+it can be \'*\' to match all share,
+it can be \'//pc\-host/*\' to match all share on pc\-host\&.
+User is the username use to connect to the share\&.
+Password is the password use to connect to the share\&.
+Domain is optional\&. Example:
+.nf
+  //another\-pc/share otheruser%otherpw domain
+.fi
+.RE
+.SH "SEE ALSO"
+.PP
+
+\fBamanda.conf\fR(5),
+\fBamanda-applications\fR(7)
+.SH "Author"
+.PP
+\fBJean\-Louis Martineau\fR <\&martineau@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
index 093899de8468648c792327a8d6cf27a10b22f4ab..2838d193d190a56b9cebf30501a5182db716e8a5 100644 (file)
 .\"     Title: amserverconfig
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
+.\"    Author: Kevin Till <kevin.till@zmanda.com>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
 .\"
-.TH "AMSERVERCONFIG" "8" "08/22/2008" "" ""
+.TH "AMSERVERCONFIG" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
 .ad l
-.SH "NAME"
-amserverconfig - program to setup initial Amanda configuration
-.SH "SYNOPSIS"
-.HP 15
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amserverconfig \- program to setup initial \fIAmanda\fR configuration
+.SH "Synopsis"
+.fam C
+.HP \w'\fBamserverconfig\fR\ 'u
 \fBamserverconfig\fR \fIconfig\fR [\-\-template\ \fItemplate\fR] [\-\-no\-vtape] [\-\-tapetype\ \fItapetype\fR] [\-\-tpchanger\ \fItpchanger\fR] [\-\-tapedev\ \fItapedev\fR] [\-\-changerfile\ \fIchangerfile\fR] [\-\-changerdev\ \fIchangerdev\fR] [\-\-labelstr\ \fIlabelstr\fR] [\-\-mailto\ \fImailto\fR] [\-\-dumpcycle\ \fIdumpcycle\fR] [\-\-runspercycle\ \fIrunspercycle\fR] [\-\-runtapes\ \fIruntapes\fR] [\-\-tapecycle\ \fItapecycle\fR] [\-\-help]
+.fam
 .SH "DESCRIPTION"
 .PP
 After Amanda rpms are successfully installed,
 \fBamserverconfig\fR
 will setup initial
 \fIAmanda\fR
-configuration files\. It will create /var/lib/amanda/guntar\-lists directory if one does not exist\.
+configuration files\&. It will create /var/lib/amanda/guntar\-lists directory if one does not exist\&.
 \fBamserverconfig\fR
 does not change existing
 \fIAmanda\fR
-configurations\.
+configurations\&.
 \fBamserverconfig\fR
-must be run by user amandabackup\.
-.SH "OPTIONS"
+must be run by user amandabackup\&.
+.SH "Options"
 .PP
-Options may be abbreviated, as long as the abbreviation is not ambiguous\. Option argument can either separated by \'=\' or a space\. Example: \-\-templ=harddisk \-\-tapedev /dev/nst0
+Options may be abbreviated, as long as the abbreviation is not ambiguous\&. Option argument can either separated by \'=\' or a space\&. Example: \-\-templ=harddisk \-\-tapedev /dev/nst0
 .PP
 
 \fBamserverconfig\fR
 builds a new "config"
 \fIAmanda\fR
-configuration\. Customize the configuration with the options below\.
+configuration\&. Customize the configuration with the options below\&.
 .PP
 \fB\-\-template template\fR
 .RS 4
 build
 \fIAmanda\fR
-configuration with pre\-configured template files\. Currently,
+configuration with pre\-configured template files\&. Currently,
 \fBharddisk\fR,
 \fBsingle\-tape\fR,
 \fBtape\-changer\fR
 and
 \fBS3\fR
-are the valid inputs for this option\. Pre\-configured template files can be found in /var/lib/amanda/template\.d\. This option may be combined with other options\.
+are the valid inputs for this option\&. Pre\-configured template files can be found in /var/lib/amanda/template\&.d\&. This option may be combined with other options\&.
 .sp
-If tape\-changer is chosen for this option, program mtx is required\.
+If tape\-changer is chosen for this option, program mtx is required\&.
 \fBamserverconfig\fR
-will search for mtx in the following directory: "/usr/sbin", "/usr/local/sbin", "/usr/local/bin", "/usr/bin", "/bin" and amandabackup\'s PATH\.
+will search for mtx in the following directory: "/usr/sbin", "/usr/local/sbin", "/usr/local/bin", "/usr/bin", "/bin" and amandabackup\'s PATH\&.
 .sp
 If harddisk is chosen and \-\-no\-vtape is not specified,
 \fBamserverconfig\fR
-will create and label virtual tape file://var/lib/amanda/vtapes/$config\.
+will create and label virtual tape file://var/lib/amanda/vtapes/$config\&.
 .RE
 .PP
 \fB\-\-no\-vtape\fR
 .RS 4
-Do not create virtual tapes in the harddisk template case\.
+Do not create virtual tapes in the harddisk template case\&.
 .RE
 .PP
 \fB\-\-tapedev tapedev\fR
 .RS 4
-The path name of non\-rewinding tape device\. default [file://var/lib/amanda/vtapes/$config]
+The path name of non\-rewinding tape device\&. default [file://var/lib/amanda/vtapes/$config]
 .RE
 .PP
 \fB\-\-tpchanger tpchanger\fR
 .RS 4
-The name of the tape changer\. default [chg\-disk]
+The name of the tape changer\&. default [chg\-disk]
 .RE
 .PP
 \fB\-\-changerdev changerdev\fR
 .RS 4
-A tape changer configuration parameter\. default [/dev/null]
+A tape changer configuration parameter\&. default [/dev/null]
 .RE
 .PP
 \fB\-\-changerfile changerfile\fR
 .RS 4
-A tape changer configuration parameter\. default [/etc/amanda/$config/changer\.conf]
+A tape changer configuration parameter\&. default [/etc/amanda/$config/changer\&.conf]
 .RE
 .PP
 \fB\-\-labelstr labelstr\fR
 .RS 4
-The tape label constraint regular expression\. default [^$config\-[0\-9][0\-9]*$]
+The tape label constraint regular expression\&. default [^$config\-[0\-9][0\-9]*$]
 .sp
-If this option is used with \-\-template=harddisk, only alphanumeric string is supported\.
+If this option is used with \-\-template=harddisk, only alphanumeric string is supported\&.
 .RE
 .PP
 \fB\-\-tapetype tapetype\fR
 .RS 4
-The type of tape drive associated with tapedev or tpchanger\. default [HARDDISK]
+The type of tape drive associated with tapedev or tpchanger\&. default [HARDDISK]
 .RE
 .PP
 \fB\-\-mailto mailto\fR
 .RS 4
-A space separated list of recipients for mail reports\. default [amandabackup]
+A space separated list of recipients for mail reports\&. default [amandabackup]
 .RE
 .PP
 \fB\-\-dumpcycle dumpcycle\fR
 .RS 4
-The number of days in the backup cycle\. default [1week]
+The number of days in the backup cycle\&. default [1week]
 .RE
 .PP
 \fB\-\-runspercycle runspercycle\fR
 .RS 4
-The number of days in the backup cycle\. default [5]
+The number of days in the backup cycle\&. default [5]
 .RE
 .PP
 \fB\-\-runtapes runtapes\fR
 .RS 4
-The maximum number of tapes used in a single run\. default [1]
+The maximum number of tapes used in a single run\&. default [1]
 .RE
 .PP
 \fB\-\-tapecycle tapecycle\fR
 .RS 4
-The size of tape rotation\. default [25]
+The size of tape rotation\&. default [25]
 .RE
 .PP
 \fB\-\-help\fR
 .RS 4
-Display usage\.
+Display usage\&.
 .RE
-.SH "FILES"
+.SH "Files"
 .PP
-\fB/var/lib/amanda/template\.d\fR
+\fB/var/lib/amanda/template\&.d\fR
 .RS 4
 Amanda configuration template files install location
 .RE
@@ -139,43 +297,46 @@ amandabackup home directory
 .PP
 \fB/var/lib/amanda/gnutar\-lists\fR
 .RS 4
-A directory which contains backup timestamp and list of files backed up\.
+A directory which contains backup timestamp and list of files backed up\&.
 .RE
 .PP
 \fB/etc/amanda/$config\fR
 .RS 4
 \fIAmanda\fR
-configuration files location for $config(e\.g: DailySet1)\.
+configuration files location for $config(e\&.g: DailySet1)\&.
 .RE
 .PP
-\fB/etc/amanda/template\.d\fR
+\fB/etc/amanda/template\&.d\fR
 .RS 4
 A directory contains dumptypes and tapetypes files used by all
 \fIAmanda\fR
-configurations\.
+configurations\&.
 .RE
 .PP
 \fB/etc/amandates\fR
 .RS 4
 \fIAmanda\fR
-file on the client\. It keeps track of structures of previous dumps\.
+file on the client\&. It keeps track of structures of previous dumps\&.
 .RE
 .PP
 \fB/tmp/amanda\fR
 .RS 4
 directory contains
 \fIAmanda\fR
-debug log files\.
+debug log files\&.
 .RE
 .SH "RETURN VALUE"
 
-On success, zero is returned\.  On error, 1 is returned\.
-.SH "AUTHOR"
-.PP
-The tool and its documentation was written by Zmanda, Inc (http://www\.zmanda\.com/)\.
+On success, zero is returned\&.  On error, 1 is returned\&.
 .SH "SEE ALSO"
 .PP
 \fBamanda\fR(8),
 \fBamanda.conf\fR(5),
 \fBamaddclient\fR(8),
 : http://wiki.zmanda.com
+.SH "Author"
+.PP
+\fBKevin Till\fR <\&kevin\&.till@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
diff --git a/man/amservice.8 b/man/amservice.8
new file mode 100644 (file)
index 0000000..6278247
--- /dev/null
@@ -0,0 +1,247 @@
+.\"     Title: amservice
+.\"    Author: Jean-Louis Martineau <martineau@zmanda.com>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
+.\"
+.TH "AMSERVICE" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amservice \- run an amanda service on a client
+.SH "Synopsis"
+.fam C
+.HP \w'\fBamservice\fR\ 'u
+\fBamservice\fR \fIhostname\fR \fIauth\fR \fIservice\fR [\-f\ \fIinput_file\fR] [\-o\ \fIconfigoption\fR]...
+.fam
+.SH "DESCRIPTION"
+.PP
+\fBAmservice\fR
+execute an
+\fIAmanda\fR
+service on a client\&. It can be used without amanda server configuration (amanda\&.conf and disklist)\&. It can be used to check communication between a server and a client\&. Amservice reads stdin to capture the REQ packet to send to the client\&.
+.PP
+See the
+\fBamanda\fR(8)
+man page for more details about
+\fIAmanda\fR\&.
+.SH "OPTIONS"
+.PP
+\fBhostname\fR
+.RS 4
+The hostname of the client\&.
+.RE
+.PP
+\fBauth\fR
+.RS 4
+The auth to use, one of: bsd, bsdudp, bsdtcp, ssh, rsh or krb5\&. The client must be configured with this auth\&.
+.RE
+.PP
+\fBservice\fR
+.RS 4
+The amanda service to execute on the client\&. One of noop, selfcheck or sendsize\&.
+.RE
+.PP
+\fB\-f input_file\fR
+.RS 4
+Use the file input_file instead of stdin to read the REQ packet from\&.
+.RE
+.PP
+\fB\-o\fR \fIconfigoption\fR
+.RS 4
+See the "\fBCONFIGURATION OVERRIDE\fR" section in
+\fBamanda\fR(8)\&.
+.RE
+.SH "EXAMPLE"
+.PP
+The noop service is easy to execute because it does not require a REQ packet:
+.nf
+amservice hostname bsdtcp noop < /dev/null.fi
+.PP
+The example executes the noop service on the client using bsdtcp auth\&. This is useful for debugging connection problems\&. It print an OPTIONS line upon success\&.
+.PP
+It is more difficult to execute the selfcheck or sendsize service, as these require a valid REQ packet\&. If you have already uccessfully run amanda, you can find valid REQ packets in the amandad\&.*\&.debug files\&.
+.SH "EXIT CODE"
+
+The exit code of \fBamservice\fR is one of:
+.nf
+ 0  = success
+ 1  = error executing amandad on the client\&.
+.fi
+.PP
+As
+\fBamservice\fR
+doesn\'t parse the REP packet, it can only detect failures in executing amandad on the client\&.
+\fBamservice\fR
+can exit with value 0 even if the user is not authorized to execute the service\&. An error message will be printed\&.
+.SH "SEE ALSO"
+.PP
+\fBamanda\fR(8),
+\fBamcheck\fR(8),
+\fBamdump\fR(8),
+\fBamadmin\fR(8)
+.SH "Author"
+.PP
+\fBJean\-Louis Martineau\fR <\&martineau@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
diff --git a/man/amstar.8 b/man/amstar.8
new file mode 100644 (file)
index 0000000..c5830ce
--- /dev/null
@@ -0,0 +1,226 @@
+.\"     Title: amstar
+.\"    Author: Jean-Louis Martineau <martineau@zmanda.com>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
+.\"
+.TH "AMSTAR" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amstar \- Amanda Application to interface with star
+.SH "DESCRIPTION"
+.PP
+Amstar is an
+\fIAmanda\fR
+Application API script\&. It should not be run by users directly\&. It uses star to backup and restore data\&.
+.SH "PROPERTIES"
+.PP
+This section lists the properties that control amstar\'s functionality\&. See
+\fBamanda-applications\fR(7)
+for information on application properties and how they are configured\&.
+.PP
+ONE\-FILE\-SYSTEM
+.RS 4
+
+If "YES" (the default), do not allow star to cross filesystem boundaries\&. If "NO", star will cross filesystem boundaries\&.  This corresponds to the \fI\-xdev\fR option of star\&.
+.RE
+.PP
+SPARSE
+.RS 4
+
+If "YES" (the default), star will store sparse files efficiently\&. If "NO", then the \fI\-sparse\fR option is not given to star, and it will not try to detect sparse files\&.
+.RE
+.PP
+STAR\-DLE\-TARDUMP
+.RS 4
+
+If "YES", amstar will use a different tardump file for each DLE\&. The default is "NO"\&.  This property is needed with older versions of star doing many dumps in parallel, because of a race condition in updating the tardump file\&.
+.RE
+.PP
+STAR\-PATH
+.RS 4
+
+The path to the star binary\&.  The default is set when \fIAmanda\fR is built\&.
+.RE
+.PP
+STAR\-TARDUMP
+.RS 4
+
+The directory where star stores the database it uses to generate incremental dumps\&.  The default is set when \fIAmanda\fR is built\&.
+.RE
+.SH "SEE ALSO"
+.PP
+
+\fBamanda.conf\fR(5),
+\fBamanda-applications\fR(7)
+.SH "Authors"
+.PP
+\fBJean\-Louis Martineau\fR <\&martineau@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
+.PP
+\fBDustin J\&. Mitchell\fR <\&dustin@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
index f17d645534b71645d8765facb65230248318aadf..092c9a0eefae490cb75090370b0e2a44c1a43abd 100644 (file)
 .\"     Title: amstatus
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
+.\"    Author: Stefan G. Weichinger <sgw@amanda.org>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
 .\"
-.TH "AMSTATUS" "8" "08/22/2008" "" ""
+.TH "AMSTATUS" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
 .ad l
-.SH "NAME"
-amstatus - display the state of an Amanda run
-.SH "SYNOPSIS"
-.HP 9
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amstatus \- display the state of an \fIAmanda\fR run
+.SH "Synopsis"
+.fam C
+.HP \w'\fBamstatus\fR\ 'u
 \fBamstatus\fR [\-\-config] \fIconfig\fR [\-\-file\ \fIamdumpfile\fR] [\-\-summary] [\-\-dumping] [\-\-waitdumping] [\-\-waittaper] [\-\-dumpingtape] [\-\-writingtape] [\-\-finished] [\-\-failed] [\-\-estimate] [\-\-gestimate] [\-\-stats] [\-\-locale\-independent\-date\-format]
+.fam
 .SH "DESCRIPTION"
 .PP
 \fBAmstatus\fR
@@ -22,23 +180,23 @@ gives the current state of the
 \fIAmanda\fR
 run specified by the
 \fIconfig\fR
-configuration\. If there is no active
+configuration\&. If there is no active
 \fIAmanda\fR
-running, it summarizes the result of the last run\. It may also be used to summarize the results of a previous run\.
+running, it summarizes the result of the last run\&. It may also be used to summarize the results of a previous run\&.
 .PP
 See the
 \fBamanda\fR(8)
 man page for more details about
-\fIAmanda\fR\.
+\fIAmanda\fR\&.
 .SH "OPTIONS"
 .PP
-All options may be abbreviated to the shortest non\-ambiguous sub\-string\. If no options are given, everything is displayed\.
+All options may be abbreviated to the shortest non\-ambiguous sub\-string\&. If no options are given, everything is displayed\&.
 .PP
 \fB[\-\-config] config\fR
 .RS 4
 Specify the
 \fIAmanda\fR
-configuration you want to display the state for\.
+configuration you want to display the state for\&.
 .RE
 .PP
 \fB\-\-file amdumpfile\fR
@@ -47,67 +205,67 @@ Specify an alternate file instead of the
 \fIamdump\fR
 or
 \fIamflush\fR
-file\.
+file\&.
 .RE
 .PP
 \fB\-\-summary\fR
 .RS 4
-Display a summary of the state of the run\.
+Display a summary of the state of the run\&.
 .RE
 .PP
 \fB\-\-dumping\fR
 .RS 4
-Display all partitions that are dumping\.
+Display all partitions that are dumping\&.
 .RE
 .PP
 \fB\-\-waitdumping|wdumping\fR
 .RS 4
-Display all partitions that are waiting to be dumped\.
+Display all partitions that are waiting to be dumped\&.
 .RE
 .PP
 \fB\-\-waittaper|wtaper\fR
 .RS 4
-Display all partitions dumped that are waiting to be written to tape\.
+Display all partitions dumped that are waiting to be written to tape\&.
 .RE
 .PP
 \fB\-\-dumpingtape|dtape\fR
 .RS 4
-Display all partitions that are dumping directly to tape\.
+Display all partitions that are dumping directly to tape\&.
 .RE
 .PP
 \fB\-\-writingtape|wtape\fR
 .RS 4
-Display all partitions that are writing to tape\.
+Display all partitions that are writing to tape\&.
 .RE
 .PP
 \fB\-\-finished\fR
 .RS 4
-Display all partitions that are dumped and written to tape\.
+Display all partitions that are dumped and written to tape\&.
 .RE
 .PP
 \fB\-\-failed|error\fR
 .RS 4
-Display all partitions that failed\.
+Display all partitions that failed\&.
 .RE
 .PP
 \fB\-\-estimate\fR
 .RS 4
-Display all partitions whose estimate is finished\. Works only during the estimate phase\.
+Display all partitions whose estimate is finished\&. Works only during the estimate phase\&.
 .RE
 .PP
 \fB\-\-gestimate|gettingestimate\fR
 .RS 4
-Display all partitions whose estimate is not finished\. Works only during the estimate phase\.
+Display all partitions whose estimate is not finished\&. Works only during the estimate phase\&.
 .RE
 .PP
 \fB\-\-stats|statistics\fR
 .RS 4
-Display statistics about active\-time of taper and dumpers\.
+Display statistics about active\-time of taper and dumpers\&.
 .RE
 .PP
 \fB\-\-locale\-independent\-date\-format\fR
 .RS 4
-Output the date in a locale independent format\. The format is the same executing: date +\'%Y\-%m\-%d %H:%M:%S %Z\'
+Output the date in a locale independent format\&. The format is the same executing: date +\'%Y\-%m\-%d %H:%M:%S %Z\'
 .RE
 .SH "EXIT CODE"
 
@@ -127,3 +285,6 @@ The exit code of \fBamstatus\fR is the ORed value of:
 \fBamrestore\fR(8),
 \fBamadmin\fR(8),
 : http://wiki.zmanda.com
+.SH "Author"
+.PP
+\fBStefan G\&. Weichinger\fR <\&sgw@amanda\&.org\&>
index fcf3296bb4cffb64affad105e183bb2c6c0210f6..e0c6ae18dae5c6c97234737828764d3bdb5d64f9 100644 (file)
 .\"     Title: amtape
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
+.\"    Author: James da Silva <jds@amanda.org>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
 .\"
-.TH "AMTAPE" "8" "08/22/2008" "" ""
+.TH "AMTAPE" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
 .ad l
-.SH "NAME"
-amtape - user interface to Amanda tape changer controls
-.SH "SYNOPSIS"
-.HP 7
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amtape \- user interface to \fIAmanda\fR tape changer controls
+.SH "Synopsis"
+.fam C
+.HP \w'\fBamtape\fR\ 'u
 \fBamtape\fR \fIconfig\fR \fIcommand\fR [\fIcommand_options\fR...] [\fB\-o\ \fR\fIconfigoption\fR]...
+.fam
 .SH "DESCRIPTION"
 .PP
 \fBAmtape\fR
-performs tape changer control operations\. It uses the underlying tape changer script defined by the
+performs tape changer control operations\&. It uses the underlying tape changer script defined by the
 \fBtpchanger\fR
 option for a particular
 \fIAmanda\fR
 configuration as specified by the
 \fIconfig\fR
-argument\.
+argument\&.
 .PP
 Tape changers maintain a notion of the
 \fIcurrent\fR
 and
 \fInext\fR
-slot for each configuration\. These may or may not correspond to an actual physical state of the device, but do tend to minimize searching through the tape storage slots\. If the desired tape is in the current slot, it is likely the next tape needed is in the next slot rather than at some random position in the storage slots\.
+slot for each configuration\&. These may or may not correspond to an actual physical state of the device, but do tend to minimize searching through the tape storage slots\&. If the desired tape is in the current slot, it is likely the next tape needed is in the next slot rather than at some random position in the storage slots\&.
 .PP
 See the
 \fBamanda\fR(8)
 man page for more details about
-\fIAmanda\fR\.
+\fIAmanda\fR\&.
 .SH "COMMANDS"
 .PP
 \fBreset\fR
 .RS 4
-Reset the tape changer to a known state\. The
+Reset the tape changer to a known state\&. The
 \fIcurrent\fR
 slot is set to the
 \fIfirst\fR
-slot\. Other device\-specific side effects may occur\. Some gravity stackers need to be reset to the top position by hand\. This command notifies
+slot\&. Other device\-specific side effects may occur\&. Some gravity stackers need to be reset to the top position by hand\&. This command notifies
 \fIAmanda\fR
-the stacker is back in that position\.
+the stacker is back in that position\&.
 .RE
 .PP
 \fBeject\fR
 .RS 4
-If a tape is loaded in the drive, it is ejected and returned to the slot from which it was loaded\.
+If a tape is loaded in the drive, it is ejected and returned to the slot from which it was loaded\&.
 .RE
 .PP
 \fBclean\fR
 .RS 4
-If a cleaning tape is defined for the changer, it is used to clean the drive\.
+If a cleaning tape is defined for the changer, it is used to clean the drive\&.
 .RE
 .PP
 \fBshow\fR
 .RS 4
-Show the contents of all slots\. This can be slow\.
+Show the contents of all slots\&. This can be slow\&.
 .RE
 .PP
 \fBlabel\fR \fIlabel\fR
@@ -69,30 +227,30 @@ Show the contents of all slots\. This can be slow\.
 Search for and load the
 \fIAmanda\fR
 tape with label
-\fIlabel\fR\.
+\fIlabel\fR\&.
 .RE
 .PP
 \fBtaper\fR
 .RS 4
 Perform the
 \fBtaper\fR
-scan algorithm\. Load the next tape in the configuration\'s tape sequence, or a fresh tape with a suitable label\.
+scan algorithm\&. Load the next tape in the configuration\'s tape sequence, or a fresh tape with a suitable label\&.
 .RE
 .PP
 \fBdevice\fR
 .RS 4
 Display the name of the current tape device on
-\fIstdout\fR\.
+\fIstdout\fR\&.
 .RE
 .PP
 \fBcurrent\fR
 .RS 4
-Display the current slot\.
+Display the current slot\&.
 .RE
 .PP
 \fBupdate\fR
 .RS 4
-Update the changer label database, if it has one, to match the tapes now available\.
+Update the changer label database, if it has one, to match the tapes now available\&.
 .RE
 .PP
 \fBslot\fR \fIslot\fR
@@ -100,73 +258,56 @@ Update the changer label database, if it has one, to match the tapes now availab
 Eject any tape in the drive and put it away, then load the tape from slot
 \fIslot\fR
 and reset
-\fIcurrent\fR\.
+\fIcurrent\fR\&.
 .RE
 .PP
 \fBslot current\fR
 .RS 4
-Eject any tape in the drive and put it away, then load the tape from the current slot\.
-.RE
-.PP
-\fBslot prev\fR
-.RS 4
-Eject any tape in the drive and put it away, then load the tape from the previous slot and reset
-\fIcurrent\fR\.
+Eject any tape in the drive and put it away, then load the tape from the current slot\&.
 .RE
 .PP
 \fBslot next\fR
 .RS 4
 Eject any tape in the drive and put it away, then load the tape from the next slot and reset
-\fIcurrent\fR\.
+\fIcurrent\fR\&.
 .RE
 .PP
 \fBslot first\fR
 .RS 4
 Eject any tape in the drive and put it away, then load the tape from the first slot and reset
-\fIcurrent\fR\.
-.RE
-.PP
-\fBslot last\fR
-.RS 4
-Eject any tape in the drive and put it away, then load the tape from the last slot and reset
-\fIcurrent\fR\.
+\fIcurrent\fR\&.
 .RE
 .PP
 \fBslot advance\fR
 .RS 4
-Eject any tape in the drive and put it away\. Advance
-\fIcurrent\fR
-to the next tape, but do not load it\.
+Synonym for
+\fBslot next\fR\&.
 .RE
 .PP
 \fB\-o\fR \fIconfigoption\fR
 .RS 4
 See the "\fBCONFIGURATION OVERRIDE\fR" section in
-\fBamanda\fR(8)\.
+\fBamanda\fR(8)\&.
 .RE
 .PP
 This is useful with non\-gravity stackers to unload the last tape used and set up
 \fIAmanda\fR
-for the next run\. If you just use
-\fBeject\fR, the current tape will be mounted again in the next run, where it will be rejected as being still in use, ejected and the next tape requested\. Using
+for the next run\&. If you just use
+\fBeject\fR, the current tape will be mounted again in the next run, where it will be rejected as being still in use, ejected and the next tape requested\&. Using
 \fBslot next\fR
 followed by
 \fBeject\fR
-does an unnecessary mount\.
+does an unnecessary mount\&.
 .PP
 Note: most changers optimize the
 \fBslot\fR
-commands to not eject the loaded tape if it is the one being requested\.
-.SH "AUTHOR"
-.PP
-James da Silva,
-<jds@amanda\.org>
-: Original text
-.PP
-Stefan G\. Weichinger,
-<sgw@amanda\.org>, maintainer of the
-\fIAmanda\fR\-documentation: XML\-conversion
+commands to not eject the loaded tape if it is the one being requested\&.
 .SH "SEE ALSO"
 .PP
 \fBamanda\fR(8),
 : http://wiki.zmanda.com
+.SH "Authors"
+.PP
+\fBJames da Silva\fR <\&jds@amanda\&.org\&>
+.PP
+\fBStefan G\&. Weichinger\fR <\&sgw@amanda\&.org\&>
index a4f0b70fc171911ea0ef61a1d135f9ecc3e89e58..1632f6dcd7238d25995ef31001cb3c45754b6b4e 100644 (file)
 .\"     Title: amtapetype
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
+.\"    Author: Dustin J. Mitchell <dustin@zmanda.com>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
 .\"
-.TH "AMTAPETYPE" "8" "08/22/2008" "" ""
+.TH "AMTAPETYPE" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
 .ad l
-.SH "NAME"
-amtapetype - generate a tapetype definition.
-.SH "SYNOPSIS"
-.HP 11
-\fBamtapetype\fR [\-h] [\-c] [\-o] [\-b\ \fIblocksize\fR] \-e\ \fIestsize\fR [\-f\ \fItapedev\fR] [\-t\ \fItypename\fR]
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amtapetype \- generate a tapetype definition by testing the device directly
+.SH "Synopsis"
+.fam C
+.HP \w'\fBamtapetype\fR\ 'u
+\fBamtapetype\fR [\-h] [\-c] [\-f] [\-b\ \fIblocksize\fR] [\-t\ \fItypename\fR] [\-l\ \fIlabel\fR] [\-o\ \fIconfig_overwrite\fR] [\fIdevice\fR]
+.fam
 .SH "DESCRIPTION"
 .PP
 \fBamtapetype\fR
 generates a tapetype entry for
-\fIAmanda\fR\.
+\fIAmanda\fR
+by testing the device directly
 .SH "OPTIONS"
+.if n \{\
+.sp
+.\}
+.RS 4
+.BM yellow
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.br
+.ps +1
+\fBNote\fR
+.ps -1
+.br
+.PP
+The options for
+\fBamtapetype\fR
+have changed in version 2\&.6\&.1
+.sp .5v
+.EM yellow
+.RE
 .PP
 \fB\-h\fR
 .RS 4
-Display an help message\.
+Display the help message\&.
 .RE
 .PP
 \fB\-c\fR
 .RS 4
-Run only the hardware compression detection heuristic test and stop\. This takes a few minutes only\.
+Run only the hardware compression detection heuristic test and stop\&. This takes a few minutes only\&.
 .RE
 .PP
-\fB\-o\fR
+\fB\-f\fR
 .RS 4
-Overwrite the tape, even if it\'s an
-\fIAmanda\fR
-tape\.
+Run amtapetype even if the loaded volume is already in use or compression is enabled\&.
 .RE
 .PP
 \fB\-b\fR\fI blocksize\fR
 .RS 4
-record block size (default: 32k)
+block size to use with the device (default: 32k)
 .RE
 .PP
-\fB\-e\fR\fI estsize\fR
+\fB\-t\fR \fItypename\fR
 .RS 4
-estimated tape size (No default!)
+Name to give to the new tapetype definition\&.
 .RE
 .PP
-\fB\-f\fR\fI tapedev\fR
+\fB\-l\fR\fI label\fR
 .RS 4
-tape device name (default: $TAPE) The device to perform the test\.
+Label to write on the tape (default is randomly generated)\&.
 .RE
 .PP
-\fB\-t\fR\fI typename\fR
+\fB\-o\fR \fIconfigoption\fR
 .RS 4
-tapetype name (default: unknown\-tapetype)
+See the "\fBCONFIGURATION OVERRIDE\fR" section in
+\fBamanda\fR(8)\&.
 .RE
 .SH "EXAMPLE"
 .PP
 Generate a tapetype definition for your tape device:
 .sp
+.if n \{\
 .RS 4
+.\}
+.fam C
+.ps -1
 .nf
-% amtapetype \-f /dev/nst0 \-e 150G
+.if t \{\
+.sp -1
+.\}
+.BB lightgray adjust-for-leading-newline
+.sp -1
+
+% amtapetype \-f /dev/nst0
+.EB lightgray adjust-for-leading-newline
+.if t \{\
+.sp 1
+.\}
 .fi
+.fam
+.ps +1
+.if n \{\
 .RE
+.\}
 .SH "NOTES"
 .PP
-Hardware compression is detected by measuring the writing speed difference of the tape drive when writing an amount of compressable and uncompresseable data\. It does not rely on the status bits of the tape drive or the OS parameters\. If your tape drive has very large buffers or is very fast, the program could fail to detect hardware compression status reliably\.
-.PP
-During the first pass, it writes files that are estimated to be 1% of the expected tape capacity\. It gets the expected capacity from the \-e command line flag, or defaults to 1 GByte\. In a perfect world (which means there is zero chance of this happening with tapes :\-), there would be 100 files and 100 file marks\.
-.PP
-During the second pass, the file size is cut in half\. In that same fairyland world, this means 200 files and 200 file marks\.
-.PP
-In both passes the total amount of data written is summed as well as the number of file marks written\. At the end of the second pass, quoting from the code:
-.PP
-* Compute the size of a filemark as the difference in data written between pass 1 and pass 2 divided by the difference in number of file marks written between pass 1 and pass 2\. \.\.\. *
-.PP
-So if we wrote 1\.0 GBytes on the first pass and 100 file marks, and 0\.9 GBytes on the second pass with 200 file marks, those additional 100 file marks in the second pass took 0\.1 GBytes and therefor a file mark is 0\.001 GBytes (1 MByte)\.
+If the device cannot reliably report its comprssion status (and as of this writing, no devices can do so), hardware compression is detected by measuring the writing speed difference of the tape drive when writing an amount of compressable and uncompresseable data\&. If your tape drive has very large buffers or is very fast, the program could fail to detect hardware compression status reliably\&.
 .PP
-Note that if the estimated capacity is wrong, the only thing that happens is a lot more (or less, but unlikely) files, and thus, file marks, get written\. But the math still works out the same\. The \-e flag is there to keep the number of file marks down because they can be slow (since they force the drive to flush all its buffers to physical media)\.
+Volume capacity is determined by writing one large file until an error, interpereted as end\-of\-tape, is encountered\&. In the next phase, about 100 files are written to fill the tape\&. This second phase will write less data, because each filemark consumes some tape\&. With a little arithmetic,
+\fBamtapetype\fR
+calculates the size of these filemarks\&.
 .PP
-All sorts of things might happen to cause the amount of data written to vary enough to generate a big file mark size guess\. A little more "shoe shining" because of the additional file marks (and flushes), dirt left on the heads from the first pass of a brand new tape, the temperature/humidity changed during the multi\-hour run, a different amount of data was written after the last file mark before EOT was reported, etc\.
+All sorts of things might happen to cause the amount of data written to vary enough to generate a strange file mark size guess\&. A little more "shoe shining" because of the additional file marks (and flushes), dirt left on the heads from the first pass of a brand new tape, the temperature/humidity changed during the multi\-hour run, a different amount of data was written after the last file mark before EOT was reported, etc\&.
 .PP
 Note that the file mark size might really be zero for whatever device this is, and it was just the measured capacity variation that caused
 \fBamtapetype\fR
-to think those extra file marks in pass 2 actually took up space\.
+to think those extra file marks in pass 2 actually took up space\&.
+.SH "Authors"
 .PP
-It also explains why
-\fBamtapetype\fR
-used to sometimes report a negative file mark size if the math happened to end up that way\. When that happens now we just report it as zero\.
-.SH "SEE ALSO"
+\fBDustin J\&. Mitchell\fR <\&dustin@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
 .PP
-\fBamanda\fR(8),
-: http://wiki.zmanda.com
+\fBJean\-Louis Martineau\fR <\&martineau@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
index 045ff1d9c9299a89b17d88a729a8a9b04ce2218f..65c997a983c0bf31de6085a51bf08e637918cfa2 100644 (file)
 .\"     Title: amtoc
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
+.\"    Author: Nicolas Mayencourt <Nicolas.Mayencourt@cui.unige.ch>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
 .\"
-.TH "AMTOC" "8" "08/22/2008" "" ""
+.TH "AMTOC" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
 .\" disable hyphenation
 .nh
 .\" disable justification (adjust text to left margin only)
 .ad l
-.SH "NAME"
-amtoc - generate TOC (Table Of Contents) for an Amanda run
-.SH "SYNOPSIS"
-.HP 6
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amtoc \- generate TOC (Table Of Contents) for an \fIAmanda\fR run
+.SH "Synopsis"
+.fam C
+.HP \w'\fBamtoc\fR\ 'u
 \fBamtoc\fR [\-a] [\-i] [\-t] [\-f\ \fIfile\fR] [\-s\ \fIsubs\fR] [\-w] [\-\-] \fIlogfile\fR
+.fam
 .SH "DESCRIPTION"
 .PP
 \fIAmtoc\fR
 generates a table of contents for an
 \fIAmanda\fR
-run\. It\'s a perl script (if you don\'t have perl, install it first!)\.
+run\&. It\'s a perl script (if you don\'t have perl, install it first!)\&.
 .SH "OPTIONS"
 .PP
 \fB\-a\fR
 .RS 4
 The output file name will be
-\fIlabel\-of\-the\-tape\fR\.toc in the same directory as
-\fIlogfile\fR\.
+\fIlabel\-of\-the\-tape\fR\&.toc in the same directory as
+\fIlogfile\fR\&.
 .RE
 .PP
 \fB\-i\fR
 .RS 4
 Display help about
-\fBamtoc\fR\.
+\fBamtoc\fR\&.
 .RE
 .PP
 \fB\-t\fR
 .RS 4
-Generate the output in tabular form\.
+Generate the output in tabular form\&.
 .RE
 .PP
 \fB\-f file\fR
 .RS 4
-Write the output to a file (\'\-\' for stdout)\.
+Write the output to a file (\'\-\' for stdout)\&.
 .RE
 .PP
 \fB\-s subs\fR
 .RS 4
 Evaluate the output file name from
 \fIsubs\fR, with $_ set to
-\fIlabel\-of\-the\-tape\fR\. The
+\fIlabel\-of\-the\-tape\fR\&. The
 \fB\-a\fR
 option is equivalent to
 \fB\-s\fR
-\fI\'s/$_/\.toc/\'\fR\.
+\fI\'s/$_/\&.toc/\'\fR\&.
 .RE
 .PP
 \fB\-w\fR
 .RS 4
-Separate tapes with form\-feeds and display blank lines before totals\.
+Separate tapes with form\-feeds and display blank lines before totals\&.
 .RE
 .PP
 \fB\-\-\fR
 .RS 4
 Marks the last option so the next parameter is the
-\fIlogfile\fR\.
+\fIlogfile\fR\&.
 .RE
 .PP
 \fBlogfile\fR
@@ -80,7 +238,7 @@ The standard output has five fields separated by two spaces:
 0  daily\-05:  19991005  \-  \-
 1  cuisun15:/cuisun15/home  19991005  1  96
 2  cuinfs:/export/dentiste  19991005  1  96
-  \.\.\.
+  \&.\&.\&.
 103  cuisg11:/  19991005  0  4139136
 103  total:  \-  \-  16716288
 .fi
@@ -91,7 +249,7 @@ In tabular format (\-t), this would look like:
   0  daily\-05:                   19991005    \-         \-
   1  cuisun15:/cuisun15/home     19991005    1        96
   2  cuinfs:/export/dentiste     19991005    1        96
-  \.\.\.
+  \&.\&.\&.
 103  cuisg11:/                   19991005    0   4139136
 103  total:                      \-           \-  16716288
 .fi
@@ -104,13 +262,13 @@ right after
 in the
 \fIcron job:\fR
 .nf
-amdump daily ; logdir=`amgetconf daily logdir` ; log=`ls \-1t $logdir/log\.*\.[0\-9] | head \-1` ; amtoc \-a $log
+amdump daily ; logdir=`amgetconf daily logdir` ; log=`ls \-1t $logdir/log\&.*\&.[0\-9] | head \-1` ; amtoc \-a $log
 .fi
 .PP
-which will generate /usr/local/etc/amanda//daily/\fItape_label\fR\.toc\. You may also want to call
+which will generate /usr/local/etc/amanda//daily/\fItape_label\fR\&.toc\&. You may also want to call
 \fBamtoc\fR
 after an
-\fIamflush\fR\.
+\fIamflush\fR\&.
 .SH "SEE ALSO"
 .PP
 \fBamanda\fR(8),
@@ -118,11 +276,11 @@ after an
 \fBamflush\fR(8),
 \fBamgetconf\fR(8), cron, perl,
 : http://wiki.zmanda.com
-.SH "AUTHOR"
+.SH "Authors"
 .PP
-Nicolas Mayencourt
-<Nicolas\.Mayencourt@cui\.unige\.ch>, University of Geneva/Switzerland : Original text
+\fBNicolas Mayencourt\fR <\&Nicolas\&.Mayencourt@cui\&.unige\&.ch\&>
+.RS 4
+University of Geneva/Switzerland
+.RE
 .PP
-Stefan G\. Weichinger,
-<sgw@amanda\.org>, maintainer of the
-\fIAmanda\fR\-documentation: XML\-conversion
+\fBStefan G\&. Weichinger\fR <\&sgw@amanda\&.org\&>
diff --git a/man/amvault.8 b/man/amvault.8
new file mode 100644 (file)
index 0000000..5b36e39
--- /dev/null
@@ -0,0 +1,222 @@
+.\"     Title: amvault
+.\"    Author: Dustin J. Mitchell <dustin@zmanda.com>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
+.\"
+.TH "AMVAULT" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amvault \- Copy \fIAmanda\fR dumps from one volume to another
+.SH "Synopsis"
+.fam C
+.HP \w'\fBamvault\fR\ 'u
+\fBamvault\fR [\-o\ \fIconfigoption\fR]... \fIconfig\fR \fIsrc\-run\-timestamp\fR \fIdst\-changer\fR \fIlabel\-template\fR
+.fam
+.SH "WARNING"
+.PP
+This application is not yet in its final form, and is subject to major revision in subsequent versions of Amanda\&. Backward compatibility is not guaranteed\&.
+.PP
+The significant limitations of this version of amvault are: tapetypes for secondary and tertiary volumes much match (including length and device_properties); tertiary volumes must be blank (manual erasure is required to re\-use tertiary media; restore/recover operations will request tertiary media by label when dumpfiles are not found on secondary media, but there is no provision to automatically fetch such media from a different changer; and all dumpfiles on a secondary volume are moved to tertiary media \- there is no provision to filter dumps\&.
+.PP
+Feedback on and patches to this application are invited and encouraged!
+.SH "DESCRIPTION"
+.PP
+\fBAmvault\fR
+Copies data from the run with timestamp
+\fIsrc\-run\-timestamp\fR
+onto volumes using the changer
+\fIdst\-changer\fR, labeling new volumes with
+\fIlabel\-template\fR\&. If
+\fIsrc\-run\-timestamp\fR
+is "latest", then the most recent amdump or amflush run will be used\&.
+.PP
+In a vaulting operation, the source media is referred to as "secondary media", while the destination is referred to as "tertiary media"\&.
+.PP
+Each source volume will be copied to a new destination volume; no re\-assembly or splitting will be performed\&. Destination volumes must be at least as large as the source volumes\&.
+.PP
+The changer parameter should specify the name of a changer defined in
+\fBamanda.conf\fR(5)\&. For example:
+.sp
+.nf
+define changer vaulting_tape {
+    tapedev "/dev/rmt/1n"
+    tpchanger "chg\-zd\-mtx"
+    changerdev "/dev/sg0"
+    changerfile "vaulting\-changer\&.conf"
+}
+.fi
+.PP
+The label template functions identically to the
+\fIlabel\-new\-tapes\fR
+parameter in
+\fBamanda.conf\fR(5)\&.
+.SH "SEE ALSO"
+.PP
+\fBamanda\fR(8)
+.SH "Author"
+.PP
+\fBDustin J\&. Mitchell\fR <\&dustin@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
diff --git a/man/amverify.8 b/man/amverify.8
deleted file mode 100644 (file)
index d9ada11..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-.\"     Title: amverify
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
-.\"
-.TH "AMVERIFY" "8" "08/22/2008" "" ""
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.SH "NAME"
-amverify - check an Amanda tape for errors
-.SH "SYNOPSIS"
-.HP 9
-\fBamverify\fR \fIconfig\fR [\fIslot\fR\ [\fIruntapes\fR]]
-.SH "DESCRIPTION"
-.PP
-\fBAmverify\fR
-reads an Amanda format tape and makes sure each backup image can be processed by
-\fBamrestore\fR
-and, if possible, the appropriate restore program (e\.g\.
-\fBtar\fR)\.
-.PP
-\fBAmverify\fR
-runs
-\fBamrestore\fR
-on each file of the tape and pipes the output to a restore program (if available) with an option to create a catalogue of the backup\. The catalogue itself is discarded\. Only the success or failure of the operation itself is reported\.
-.PP
-If the backup image cannot be processed by the restore program, e\.g\. if it was written on a different operating system, the image is sent through
-\fBdd\fR
-to /dev/null\. This still determines if the tape is readable, but does not do any internal consistency check on the image\.
-.PP
-If
-\fIconfig\fR
-is set up to use a tape changer, the
-\fIslot\fR
-argument may be used to choose the first tape to process\. Otherwise, the
-\fBcurrent\fR
-slot is used\.
-.PP
-The
-\fBruntapes\fR
-configuration parameter determines how many tapes are processed unless it is specified on the command line\.
-.PP
-See the
-\fBamanda\fR(8)
-man page for more details about Amanda\.
-.SH "AUTHOR"
-.PP
-Axel Zinser
-<fifi@icem\.de>
-: Original text
-.PP
-Stefan G\. Weichinger,
-<sgw@amanda\.org>, maintainer of the
-\fIAmanda\fR\-documentation: XML\-conversion
-.SH "SEE ALSO"
-.PP
-\fBamrestore\fR(8),
-\fBamanda\fR(8),
-\fBamverifyrun\fR(8),
-: http://wiki.zmanda.com
diff --git a/man/amverifyrun.8 b/man/amverifyrun.8
deleted file mode 100644 (file)
index 8390574..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-.\"     Title: amverifyrun
-.\"    Author: 
-.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\"      Date: 08/22/2008
-.\"    Manual: 
-.\"    Source: 
-.\"
-.TH "AMVERIFYRUN" "8" "08/22/2008" "" ""
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.SH "NAME"
-amverifyrun - check the tapes written by the last Amanda run
-.SH "SYNOPSIS"
-.HP 12
-\fBamverifyrun\fR \fIconfig\fR
-.SH "DESCRIPTION"
-.PP
-\fBAmverifyrun\fR
-read the log from the last
-\fIAmanda\fR
-run to find the slot of the first tape used and the number of tapes used\. It call
-\fBamverify\fR
-with these argument\.
-.SH "SEE ALSO"
-.PP
-\fBamanda\fR(8),
-\fBamverify\fR(8),
-: http://wiki.zmanda.com
diff --git a/man/amzfs-sendrecv.8 b/man/amzfs-sendrecv.8
new file mode 100644 (file)
index 0000000..e0d6168
--- /dev/null
@@ -0,0 +1,268 @@
+.\"     Title: amzfs-sendrecv
+.\"    Author: Jean-Louis Martineau <martineau@zmanda.com>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
+.\"
+.TH "AMZFS\-SENDRECV" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amzfs-sendrecv \- Amanda script to create zfs sendrecv
+.SH "DESCRIPTION"
+.PP
+amzfs\-sendrecv is an
+\fIAmanda\fR
+application implementing the Application API\&. It should not be run by users directly\&. It create a zfs snapshot of the filesystem and backup the snapshot with \'zfs send\'\&. Snapshot are kept after the backup is done, this increase the disk space use on the client but it is neccesary to be able do to incremental backup\&. If you want only full backup, you can disable this feature by setting the KEEP\-SNAPSHOT property to \'NO\'\&. Only the restoration of the complete backup is allowed, it is impossible to restore a single file\&.
+.PP
+The application is run as the amanda user, it must have many zfs priviledge:
+.sp
+.nf
+    zfs allow \-ldu AMANDA_USER mount,create,rename,snapshot,destroy,send,receive FILESYSTEM
+.fi
+.PP
+Some system doesn\'t have "zfs allow", but you can give the Amanda backup user the rights to manipulate ZFS filesystems by using the following command:
+.sp
+.nf
+usermod \-P "ZFS File System Management,ZFS Storage Management" AMANDA_USER
+.fi
+This will require that your run zfs under pfexec, set the PFEXEC property to YES\&.
+.PP
+The format of the DLE must be one of:
+.sp
+.nf
+Desciption              Example
+\-\-\-\-\-\-\-\-\-\-              \-\-\-\-\-\-\-
+Mountpoint              /data
+ZFS pool name           datapool
+ZFS filesystem          datapool/database
+ZFS logical volume      datapool/dbvol
+.fi
+.PP
+The filesystem doesn\'t need to be mounted\&.
+.SH "PROPERTIES"
+.PP
+This section lists the properties that control amzfs\-sendrecv\'s functionality\&. See
+\fBamanda-applications\fR(7)
+for information on the Application API, application configuration\&.
+.PP
+DF\-PATH
+.RS 4
+
+Path to the \'df\' binary, search in $PATH by default\&.
+.RE
+.PP
+KEEP\-SNAPSHOT
+.RS 4
+
+If "YES" (the default), snapshot are kept after the backup, if set to "NO" then snapshot are no kept and incremental backup will fail\&.
+.RE
+.PP
+ZFS\-PATH
+.RS 4
+
+Path to the \'zfs\' binary, search in $PATH by default\&.
+.RE
+.PP
+PFEXEC\-PATH
+.RS 4
+
+Path to the \'pfexec\' binary, search in $PATH by default\&.
+.RE
+.PP
+PFEXEC
+.RS 4
+
+If "NO" (the default), pfexec is not used, if set to "YES" then pfexec is used\&.
+.RE
+.SH "EXAMPLE"
+
+
+In this example, a dumptype is defined to use amzfs\-sendrecv application to backup a zfs filesystem\&.
+.nf
+ define application\-tool amzfs_sendrecv {
+   comment "amzfs\-sendrecv"
+   plugin "amzfs\-sendrecv"
+   #property "DF\-PATH"  "/usr/sbin/df"
+   #property "KEEP\-SNAPSHOT" "YES"
+   #property "ZFS\-PATH" "/usr/sbin/zfs"
+   #property "PFEXEC\-PATH" "/usr/sbin/pfexec"
+   #property "PFEXEC" "NO"
+ }
+
+ define dumptype user\-zfs\-sendrecv {
+   program "APPLICATAION"
+   application "amzfs_sendrecv"
+ }
+.fi
+.SH "SEE ALSO"
+.PP
+
+\fBamanda.conf\fR(5),
+\fBamanda-client.conf\fR(5),
+\fBamanda-applications\fR(7)
+.SH "Author"
+.PP
+\fBJean\-Louis Martineau\fR <\&martineau@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
diff --git a/man/amzfs-snapshot.8 b/man/amzfs-snapshot.8
new file mode 100644 (file)
index 0000000..ab76f1e
--- /dev/null
@@ -0,0 +1,278 @@
+.\"     Title: amzfs-snapshot
+.\"    Author: Jean-Louis Martineau <martineau@zmanda.com>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
+.\"
+.TH "AMZFS\-SNAPSHOT" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+amzfs-snapshot \- Amanda script to create zfs snapshot
+.SH "DESCRIPTION"
+.PP
+amzfs\-snapshot is an
+\fIAmanda\fR
+script implementing the Script API\&. It should not be run by users directly\&. It create a zfs snapshot of the filesystem where the path specified is mounted\&.
+.PP
+PRE\-DLE\-* create a snapshot and the POST_DLE_* destroy the snapshot, *\-DLE\-AMCHECK, *\-DLE\-ESTIMATE and *\-DLE\-BACKUP must be set to be executed on the client:
+.sp
+.nf
+    execute\-on  pre\-dle\-amcheck, post\-dle\-amcheck, pre\-dle\-estimate, post\-dle\-estimate, pre\-dle\-backup, post\-dle\-backup
+    execute\-where client
+.fi
+.PP
+The PRE_DLE_* script output a DIRECTORY property telling where the directory is located in the snapshot\&. The application must be able to use the DIRECTORY property, amgtar can do it\&.
+.PP
+The script is run as the amanda user, it must have the priviledge to create and destroy snapshot:
+.sp
+.nf
+    zfs allow \-ldu AMANDA_USER mount,snapshot,destroy FILESYSTEM
+.fi
+.PP
+Some system doesn\'t have "zfs allow", but you can give the Amanda backup user the rights to manipulate ZFS filesystems by using the following command:
+.sp
+.nf
+usermod \-P "ZFS File System Management,ZFS Storage Management" AMANDA_USER
+.fi
+This will require that your run zfs under pfexec, set the PFEXEC property to YES\&.
+.PP
+The format of the DLE must be one of:
+.sp
+.nf
+Desciption              Example
+\-\-\-\-\-\-\-\-\-\-              \-\-\-\-\-\-\-
+Mountpoint              /data
+Arbitrary mounted dir   /data/interesting_dir
+ZFS pool name           datapool
+ZFS filesystem          datapool/database
+ZFS logical volume      datapool/dbvol
+.fi
+.PP
+The filesystem must be mounted\&.
+.SH "PROPERTIES"
+.PP
+This section lists the properties that control amzfs\-snapshot\'s functionality\&. See
+\fBamanda-scripts\fR(7)
+for information on the Script API, script configuration\&.
+.PP
+DF\-PATH
+.RS 4
+
+Path to the \'df\' binary, search in $PATH by default\&.
+.RE
+.PP
+ZFS\-PATH
+.RS 4
+
+Path to the \'zfs\' binary, search in $PATH by default\&.
+.RE
+.PP
+PFEXEC\-PATH
+.RS 4
+
+Path to the \'pfexec\' binary, search in $PATH by default\&.
+.RE
+.PP
+PFEXEC
+.RS 4
+
+If "NO" (the default), pfexec is not used, if set to "YES" then pfexec is used\&.
+.RE
+.SH "EXAMPLE"
+
+
+In this example, a dumptype is defined to use amzfs\-snapshot script to create a snapshot and use amgtar to backup the snapshot\&.
+.nf
+ define script\-tool amzfs_snapshot {
+   comment "backup of zfs snapshot"
+   plugin  "amzfs\-snapshot"
+   execute\-on  pre\-dle\-amcheck, post\-dle\-amcheck, pre\-dle\-estimate, post\-dle\-estimate, pre\-dle\-backup, post\-dle\-backup
+   execute\-where client
+   #property "DF\-PATH" "/usr/sbin/df"
+   #property "ZFS\-PATH" "/usr/sbin/zfs"
+   #property "PFEXEC\-PATH" "/usr/sbin/pfexec"
+   #property "PFEXEC" "NO"
+ }
+
+ define dumptype user\-zfs\-amgtar {
+   dt_amgtar
+   script "amzfs_snapshot"
+ }
+.fi
+.SH "SEE ALSO"
+.PP
+
+\fBamanda.conf\fR(5),
+\fBamanda-client.conf\fR(5),
+\fBamanda-scripts\fR(7)
+.SH "Authors"
+.PP
+\fBJean\-Louis Martineau\fR <\&martineau@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
+.PP
+\fBDustin J\&. Mitchell\fR <\&dustin@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
diff --git a/man/disklist.5 b/man/disklist.5
new file mode 100644 (file)
index 0000000..bd1b95f
--- /dev/null
@@ -0,0 +1,298 @@
+.\"     Title: disklist
+.\"    Author: James da Silva <jds@amanda.org>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: File formats and conventions
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
+.\"
+.TH "DISKLIST" "5" "01/22/2009" "Amanda 2\&.6\&.1" "File formats and conventions"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+disklist \- List of partitions to back up for \fIAmanda\fR
+.SH "DESCRIPTION"
+.PP
+The
+\fIdisklist\fR
+file determines which disks will be backed up by
+\fIAmanda\fR\&. The file usually contains one line per disk:
+.nf
+\fIhostname diskname\fR [\fIdiskdevice\fR] \fIdumptype\fR [\fIspindle\fR [\fIinterface\fR] ]
+.fi
+.PP
+All pairs [
+\fIhostname diskname\fR
+] must be unique\&.
+.PP
+Lines starting with # are ignored, as are blank lines\&. The fields have the following meanings:
+.PP
+\fIhostname\fR
+.RS 4
+The name of the host to be backed up\&. If
+\fBdiskdevice\fR
+refers to a PC share, this is the host
+\fIAmanda\fR
+will run the Samba
+\fBsmbclient\fR
+program on to back up the share\&.
+.RE
+.PP
+\fIdiskname\fR
+.RS 4
+The name of the disk (a label)\&. In most case, you set your
+\fBdiskname\fR
+to the
+\fBdiskdevice\fR
+and you don\'t set the
+\fBdiskdevice\&.\fR
+If you want multiple entries with the same
+\fBdiskdevice\fR, you must set a different
+\fBdiskname\fR
+for each entry\&. It\'s the
+\fBdiskname\fR
+that you use on the commandline for any
+\fIAmanda\fR
+command\&. Look at the example/disklist file for example\&.
+.RE
+.PP
+\fIdiskdevice\fR
+.RS 4
+Default: same as diskname\&. The name of the disk device to be backed up\&. It may be a full device name, a device name without the
+\FC/dev/\F[]
+prefix, e\&.g\&.
+\fIsd0a\fR, or a mount point such as
+\FC/usr\F[]\&.
+.sp
+It may also refer to a PC share by starting the name with two (forward) slashes, e\&.g\&.
+\FC//some\-pc/home\F[]\&. In this case, the
+\fBprogram\fR
+option in the associated
+\fBdumptype\fR
+must be entered as
+\fBGNUTAR\fR\&. It is the combination of the double slash disk name and
+\fBprogram GNUTAR\fR
+in the
+\fBdumptype\fR
+that triggers the use of Samba\&.
+.RE
+.PP
+\fIdumptype\fR
+.RS 4
+Refers to a
+\fBdumptype\fR
+defined in the
+\fBamanda\&.conf\fR
+file\&.
+\fIDumptype\fRs specify backup related parameters, such as whether to compress the backups, whether to record backup results in
+\FC/etc/dumpdates\F[], the disk\'s relative priority, etc\&.
+.RE
+.PP
+\fIspindle\fR
+.RS 4
+Default:
+\fB\-1\fR\&. A number used to balance backup load on a host\&.
+\fIAmanda\fR
+will not run multiple backups at the same time on the same spindle, unless the spindle number is \-1, which means there is no spindle restriction\&.
+.RE
+.PP
+\fIinterface\fR
+.RS 4
+Default:
+\fIlocal\fR\&. The name of a network interface definition in the
+\fBamanda\&.conf\fR
+file, used to balance network load\&.
+.RE
+.PP
+Instead of naming a
+\fBdumptype\fR, it is possible to define one in\-line, enclosing
+\fBdumptype\fR
+options within curly braces, one per line, just like a
+\fBdumptype\fR
+definition in
+\fBamanda\&.conf\fR\&. Since pre\-existing
+\fBdumptype\fRs are valid option names, this syntax may be used to customize
+\fBdumptype\fRs for particular disks\&.
+.PP
+A line break
+\fBmust\fR
+follow the left curly bracket\&.
+.PP
+For instance, if a
+\fBdumptype\fR
+named
+\fInormal\fR
+is used for most disks, but use of the holding disk needs to be disabled for the file system that holds it, this would work instead of defining a new dumptype:
+.nf
+\fIhostname diskname\fR [ \fIdiskdevice\fR ] {
+  normal
+  holdingdisk never
+} [ \fIspindle\fR [ \fIinterface\fR ] ]
+.fi
+.SH "Authors"
+.PP
+\fBJames da Silva\fR <\&jds@amanda\&.org\&>
+.PP
+\fBStefan G\&. Weichinger\fR <\&sgw@amanda\&.org\&>
+.PP
+\fBDustin J\&. Mitchell\fR <\&dustin@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
diff --git a/man/entities/global.entities b/man/entities/global.entities
deleted file mode 100644 (file)
index 99f9e49..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-<!-- Global Entities File -->
-
-<!ENTITY email.sgw '<email>sgw@amanda.org</email>'>
-<!ENTITY maintainer.sgw 'Stefan G. Weichinger, &email.sgw;, maintainer of the
-&A;-documentation'>
-<!ENTITY email.jds '<email>jds@amanda.org</email>'>
-<!ENTITY email.itt '<email>ian@zmanda.com</email>'>
-<!ENTITY email.jstange '<email>building@nap.edu</email>'>
-<!ENTITY A '<application><emphasis>Amanda</emphasis></application>'>
-
-<!-- IDs for AMANDA files-->
-<!ENTITY amandaddebug ' <filename>amandad.debug</filename>'>
-<!ENTITY amconf '<filename>amanda.conf</filename>'>
-<!ENTITY amclientconf '<filename>amanda-client.conf</filename>'>
-<!ENTITY amandahosts '<filename>.amandahosts</filename>'>
-<!ENTITY disklist '<filename>disklist</filename>'>
-<!ENTITY amandapass '<filename>/etc/amandapass</filename>'>
-<!ENTITY inetdconf '<filename>/etc/inetd.conf</filename>'>
-<!ENTITY tapelist '<filename>tapelist</filename>'>
-
-<!-- IDs for files used by AMANDA-->
-<!ENTITY dumpdates '<filename>/etc/dumpdates</filename>'>
-
-<!-- IDs for AMANDA commands-->
-<!ENTITY amadmin ' <command>amadmin</command>'>
-<!ENTITY amaespipe ' <command>amaespipe</command>'>
-<!ENTITY amcheck ' <command>amcheck</command>'>
-<!ENTITY amcheckdb ' <command>amcheckdb</command>'>
-<!ENTITY amcleanup ' <command>amcleanup</command>'>
-<!ENTITY amcrypt ' <command>amcrypt</command>'>
-<!ENTITY amcryptsimple ' <command>amcryptsimple</command>'>
-<!ENTITY amcryptossl ' <command>amcrypt-ossl</command>'>
-<!ENTITY amcryptosslasym ' <command>amcrypt-ossl-asym</command>'>
-<!ENTITY amgpgcrypt ' <command>amgpgcrypt</command>'>
-<!ENTITY amdd ' <command>amdd</command>'>
-<!ENTITY amaddclient ' <command>amaddclient</command>'>
-<!ENTITY amdump ' <command>amdump</command>'>
-<!ENTITY amflush ' <command>amflush</command>'>
-<!ENTITY amgetconf ' <command>amgetconf</command>'>
-<!ENTITY amlabel ' <command>amlabel</command>'>
-<!ENTITY ammt ' <command>ammt</command>'>
-<!ENTITY amoverview ' <command>amoverview</command>'>
-<!ENTITY amplot ' <command>amplot</command>'>
-<!ENTITY amrecover ' <command>amrecover</command>'>
-<!ENTITY amreport ' <command>amreport</command>'>
-<!ENTITY amrestore ' <command>amrestore</command>'>
-<!ENTITY amrmtape ' <command>amrmtape</command>'>
-<!ENTITY amserverconfig ' <command>amserverconfig</command>'>
-<!ENTITY amstatus ' <command>amstatus</command>'>
-<!ENTITY amtape ' <command>amtape</command>'>
-<!ENTITY amtapetype ' <command>amtapetype</command>'>
-<!ENTITY amtoc ' <command>amtoc</command>'>
-<!ENTITY amverify ' <command>amverify</command>'>
-<!ENTITY amverifyrun ' <command>amverifyrun</command>'>
-
-<!ENTITY amandad ' <command>amandad</command>'>
-<!ENTITY amandaidx ' <command>amandaidx</command>'>
-<!ENTITY amgetidx ' <command>amgetidx</command>'>
-<!ENTITY amidxtape ' <command>amidxtape </command>'>
-<!ENTITY amidxtaped ' <command>amidxtaped</command>'>
-<!ENTITY amindexd ' <command>amindexd</command>'>
-<!ENTITY amtrmidx ' <command>amtrmidx</command>'>
-<!ENTITY calcsize ' <command>calcsize</command>'>
-<!ENTITY driver ' <command>driver</command>'>
-<!ENTITY dumper ' <command>dumper</command>'>
-<!ENTITY planner ' <command>planner</command>'>
-<!ENTITY reporter ' <command>reporter</command>'>
-<!ENTITY runtar ' <command>runtar</command>'>
-<!ENTITY selfcheck ' <command>selfcheck</command>'>
-<!ENTITY sendbackup ' <command>sendbackup</command>'>
-<!ENTITY sendsize ' <command>sendsize</command>'>
-<!ENTITY taper ' <command>taper</command>'>
-
-<!-- IDs for commands used by AMANDA-->
-<!ENTITY mt '<command>mt</command>'>
-<!ENTITY mtx '<command>mtx</command>'>
-<!ENTITY tar '<command>tar</command>'>
-<!ENTITY gnutar '<command>GNU-tar</command>'>
-<!ENTITY gzip '<command>GNU-zip</command>'>
-
-<!ENTITY dump '<command>dump</command>'>
-<!ENTITY restore.binary '<command>restore</command>'>
-
-<!ENTITY dd '<command>dd</command>'>
-<!ENTITY cpio '<command>cpio</command>'>
-
-<!ENTITY gcc '<command>gcc</command>'>
-<!ENTITY configure '<command>configure</command>'>
-<!ENTITY make '<command>make</command>'>
-<!ENTITY ssh '<command>ssh</command>'>
-<!ENTITY rsh '<command>rsh</command>'>
-<!ENTITY inetd '<command>inetd</command>'>
-<!ENTITY xinetd '<command>xinetd</command>'>
-<!ENTITY lsof '<command>lsof</command>'>
-
-<!ENTITY runtapes '<command>runtapes</command>'>
-<!ENTITY dumpers '<command>dumpers</command>'>
-<!ENTITY dumptype '<command>dumptype</command>'>
-<!ENTITY dumpcycle '<command>dumpcycle</command>'>
diff --git a/man/entities/global.entities.in b/man/entities/global.entities.in
new file mode 100644 (file)
index 0000000..619bb6f
--- /dev/null
@@ -0,0 +1,153 @@
+<!-- Global Entities File -->
+
+<!-- extra refmiscinfo stuff -->
+<!ENTITY rmi.source '<refmiscinfo class="source">Amanda</refmiscinfo>'>
+<!ENTITY rmi.version '<refmiscinfo class="version">@VERSION@</refmiscinfo>'>
+<!ENTITY rmi.manual.5 '<refmiscinfo class="manual">File formats and conventions</refmiscinfo>'>
+<!ENTITY rmi.manual.7 '<refmiscinfo class="manual">Miscellanea</refmiscinfo>'>
+<!ENTITY rmi.manual.8 '<refmiscinfo class="manual">System Administration Commands</refmiscinfo>'>
+
+<!-- utilities for below -->
+<!ENTITY affil.zmanda '<affiliation><org>
+               <orgname>Zmanda, Inc.</orgname>
+               <uri type="webpage">http://www.zmanda.com</uri></org></affiliation>'>
+<!ENTITY affil.nap '<affiliation><org>
+               <orgname>National Academies Press</orgname></org></affiliation>'>
+<!ENTITY affil.tis '<affiliation><org>
+               <orgname>Trusted Information Systems</orgname></org></affiliation>'>
+<!ENTITY affil.unigech '<affiliation><org>
+               <orgname>University of Geneva/Switzerland</orgname></org></affiliation>'>
+
+<!-- author IDs; use these in an <info> -->
+<!ENTITY author.dustin '<author><personname>Dustin J. Mitchell</personname>
+                   &affil.zmanda;
+                   <email>dustin@zmanda.com</email></author>'>
+<!ENTITY author.jlm '<author><personname>Jean-Louis Martineau</personname>
+                   &affil.zmanda;
+                   <email>martineau@zmanda.com</email></author>'>
+<!ENTITY author.sgw '<author><personname>Stefan G. Weichinger</personname>
+                   <email>sgw@amanda.org</email></author>'>
+<!ENTITY author.sgw.xml '<author><personname>Stefan G. Weichinger</personname>
+                   <contrib>XML-conversion</contrib>
+                   <email>sgw@amanda.org</email></author>'>
+<!ENTITY author.ian '<author><personname>Ian Turner</personname>
+                   &affil.zmanda;
+                   <email>ian@zmanda.com</email></author>'>
+<!ENTITY author.jds '<author><personname>James da Silva</personname>
+                   <email>jds@amanda.org</email></author>'>
+<!ENTITY author.jstange '<author><personname>John Stange</personname>
+                   &affil.nap;
+                   <email>building@nap.edu</email></author>'>
+<!ENTITY author.ktill '<author><personname>Kevin Till</personname>
+                   &affil.zmanda;
+                   <email>kevin.till@zmanda.com</email></author>'>
+<!ENTITY author.dwlocks '<author><personname>Dan Locks</personname>
+                   &affil.zmanda;
+                   <email>dwlocks@zmanda.com</email></author>'>
+<!ENTITY author.ncoukouma '<author><personname>Nikolas Coukouma</personname>
+                   &affil.zmanda;
+                   <email>atrus@zmanda.com</email></author>'>
+<!ENTITY author.atf3r '<author><personname>Adrian T. Filipi-Martin</personname>
+                   <email>atf3r@cs.virginia.edu</email></author>'>
+<!ENTITY author.alan '<author><personname>Alan M. McIvor</personname>
+                   <email>alan@kauri.auck.irl.cri.nz</email></author>'>
+<!ENTITY author.ogud '<author><personname>Olafur Gudmundsson</personname>
+                   &affil.tis;
+                   <email>ogud@tis.com</email></author>'>
+<!ENTITY author.nm '<author><personname>Nicolas Mayencourt</personname>
+                   &affil.unigech;
+                   <email>Nicolas.Mayencourt@cui.unige.ch</email></author>'>
+<!ENTITY author.pby '<author><personname>Paul Yeatman</personname>
+                   &affil.zmanda;
+                   <email>pyeatman@zmanda.com</email></author>'>
+
+
+<!-- Amanda itself -->
+<!ENTITY A '<application><emphasis>Amanda</emphasis></application>'>
+
+<!-- IDs for AMANDA files-->
+<!ENTITY amconf '<citerefentry><refentrytitle>amanda.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>'>
+<!ENTITY amclientconf '<citerefentry><refentrytitle>amanda-client.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>'>
+<!ENTITY amandahosts '<filename>.amandahosts</filename>'>
+<!ENTITY disklist '<citerefentry><refentrytitle>disklist</refentrytitle><manvolnum>5</manvolnum></citerefentry>'>
+<!ENTITY amandapass '<filename>/etc/amandapass</filename>'>
+<!ENTITY inetdconf '<filename>/etc/inetd.conf</filename>'>
+<!ENTITY tapelist '<citerefentry><refentrytitle>tapelist</refentrytitle><manvolnum>5</manvolnum></citerefentry>'>
+
+<!-- IDs for files used by AMANDA-->
+<!ENTITY dumpdates '<filename>/etc/dumpdates</filename>'>
+
+<!-- IDs for AMANDA commands-->
+<!ENTITY amadmin ' <command>amadmin</command>'>
+<!ENTITY amaespipe ' <command>amaespipe</command>'>
+<!ENTITY amcheck ' <command>amcheck</command>'>
+<!ENTITY amcheckdb ' <command>amcheckdb</command>'>
+<!ENTITY amcleanup ' <command>amcleanup</command>'>
+<!ENTITY amcrypt ' <command>amcrypt</command>'>
+<!ENTITY amcryptsimple ' <command>amcryptsimple</command>'>
+<!ENTITY amcryptossl ' <command>amcrypt-ossl</command>'>
+<!ENTITY amcryptosslasym ' <command>amcrypt-ossl-asym</command>'>
+<!ENTITY amgpgcrypt ' <command>amgpgcrypt</command>'>
+<!ENTITY amdd ' <command>amdd</command>'>
+<!ENTITY amaddclient ' <command>amaddclient</command>'>
+<!ENTITY amdump ' <command>amdump</command>'>
+<!ENTITY amflush ' <command>amflush</command>'>
+<!ENTITY amgetconf ' <command>amgetconf</command>'>
+<!ENTITY amlabel ' <command>amlabel</command>'>
+<!ENTITY ammt ' <command>ammt</command>'>
+<!ENTITY amoverview ' <command>amoverview</command>'>
+<!ENTITY amplot ' <command>amplot</command>'>
+<!ENTITY amrecover ' <command>amrecover</command>'>
+<!ENTITY amreport ' <command>amreport</command>'>
+<!ENTITY amrestore ' <command>amrestore</command>'>
+<!ENTITY amrmtape ' <command>amrmtape</command>'>
+<!ENTITY amserverconfig ' <command>amserverconfig</command>'>
+<!ENTITY amstatus ' <command>amstatus</command>'>
+<!ENTITY amtape ' <command>amtape</command>'>
+<!ENTITY amtapetype ' <command>amtapetype</command>'>
+<!ENTITY amtoc ' <command>amtoc</command>'>
+
+<!ENTITY amandad ' <command>amandad</command>'>
+<!ENTITY amandaidx ' <command>amandaidx</command>'>
+<!ENTITY amgetidx ' <command>amgetidx</command>'>
+<!ENTITY amidxtape ' <command>amidxtape </command>'>
+<!ENTITY amidxtaped ' <command>amidxtaped</command>'>
+<!ENTITY amindexd ' <command>amindexd</command>'>
+<!ENTITY amtrmidx ' <command>amtrmidx</command>'>
+<!ENTITY calcsize ' <command>calcsize</command>'>
+<!ENTITY driver ' <command>driver</command>'>
+<!ENTITY dumper ' <command>dumper</command>'>
+<!ENTITY planner ' <command>planner</command>'>
+<!ENTITY reporter ' <command>reporter</command>'>
+<!ENTITY runtar ' <command>runtar</command>'>
+<!ENTITY selfcheck ' <command>selfcheck</command>'>
+<!ENTITY sendbackup ' <command>sendbackup</command>'>
+<!ENTITY sendsize ' <command>sendsize</command>'>
+<!ENTITY taper ' <command>taper</command>'>
+
+<!-- IDs for commands used by AMANDA-->
+<!ENTITY mt '<command>mt</command>'>
+<!ENTITY mtx '<command>mtx</command>'>
+<!ENTITY tar '<command>tar</command>'>
+<!ENTITY gnutar '<command>GNU-tar</command>'>
+<!ENTITY gzip '<command>GNU-zip</command>'>
+
+<!ENTITY dump '<command>dump</command>'>
+<!ENTITY restore.binary '<command>restore</command>'>
+
+<!ENTITY dd '<command>dd</command>'>
+<!ENTITY cpio '<command>cpio</command>'>
+
+<!ENTITY gcc '<command>gcc</command>'>
+<!ENTITY configure '<command>configure</command>'>
+<!ENTITY make '<command>make</command>'>
+<!ENTITY ssh '<command>ssh</command>'>
+<!ENTITY rsh '<command>rsh</command>'>
+<!ENTITY inetd '<command>inetd</command>'>
+<!ENTITY xinetd '<command>xinetd</command>'>
+<!ENTITY lsof '<command>lsof</command>'>
+
+<!ENTITY runtapes '<command>runtapes</command>'>
+<!ENTITY dumpers '<command>dumpers</command>'>
+<!ENTITY dumptype '<command>dumptype</command>'>
+<!ENTITY dumpcycle '<command>dumpcycle</command>'>
diff --git a/man/script-email.8 b/man/script-email.8
new file mode 100644 (file)
index 0000000..d548a56
--- /dev/null
@@ -0,0 +1,227 @@
+.\"     Title: script-email
+.\"    Author: Jean-Louis Martineau <martineau@zmanda.com>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: System Administration Commands
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
+.\"
+.TH "SCRIPT\-EMAIL" "8" "01/22/2009" "Amanda 2\&.6\&.1" "System Administration Commands"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+script-email \- Amanda script to send email notifications
+.SH "DESCRIPTION"
+.PP
+script\-email is an
+\fIAmanda\fR
+script implementing the Script API\&. It should not be run by users directly\&. It sends a notification email to the addresses specified in the MAILTO property\&.
+.SH "PROPERTIES"
+.PP
+This section lists the properties that control script\-email\'s functionality\&. See
+\fBamanda-scripts\fR(7)
+for information on the Script API, script configuration\&.
+.PP
+MAILTO
+.RS 4
+
+List of email addresses that will receive an email on command execution\&. It is a multi\-valued property:
+.nf
+  property "MAILTO" "amanda@domain\&.com" "sysadmin@domain\&.com" "amandauser@domain\&.com"
+.fi
+.RE
+.SH "EXAMPLE"
+
+
+In this example, script\-email is scheduled to be run before the DLE, on the
+server\&.  The unqualified email address \fIamanda\fR will be
+passed to the email system unchanged\&.  The script is then attached to a
+dumptype, which can then be specified for any DLEs which require notification\&.
+.nf
+ define script\-tool pre\-email {
+   comment "email me before this DLE is backed up"
+   plugin  "script\-email"
+   execute\-on pre\-dle\-backup
+   execute\-where server
+   property "mailto" "amanda"
+ }
+
+ define dumptype user\-tar\-email {
+   user\-tar
+   script "pre\-email"
+ }
+.fi
+.SH "SEE ALSO"
+.PP
+
+\fBamanda.conf\fR(5),
+\fBamanda-client.conf\fR(5),
+\fBamanda-scripts\fR(7)
+.SH "Authors"
+.PP
+\fBJean\-Louis Martineau\fR <\&martineau@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
+.PP
+\fBDustin J\&. Mitchell\fR <\&dustin@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
diff --git a/man/tapelist.5 b/man/tapelist.5
new file mode 100644 (file)
index 0000000..5d2ffb3
--- /dev/null
@@ -0,0 +1,216 @@
+.\"     Title: tapelist
+.\"    Author: James da Silva <jds@amanda.org>
+.\" Generator: DocBook XSL Stylesheets v1.74.0 <http://docbook.sf.net/>
+.\"      Date: 01/22/2009
+.\"    Manual: File formats and conventions
+.\"    Source: Amanda 2.6.1
+.\"  Language: English
+.\"
+.TH "TAPELIST" "5" "01/22/2009" "Amanda 2\&.6\&.1" "File formats and conventions"
+.\" -----------------------------------------------------------------
+.\" * (re)Define some macros
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" toupper - uppercase a string (locale-aware)
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de toupper
+.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
+\\$*
+.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH-xref - format a cross-reference to an SH section
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de SH-xref
+.ie n \{\
+.\}
+.toupper \\$*
+.el \{\
+\\$*
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SH - level-one heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SH
+.\" put an extra blank line of space above the head in non-TTY output
+.if t \{\
+.sp 1
+.\}
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[an-margin]u
+.ti 0
+.HTML-TAG ".NH \\n[an-level]"
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+\." make the size of the head bigger
+.ps +3
+.ft B
+.ne (2v + 1u)
+.ie n \{\
+.\" if n (TTY output), use uppercase
+.toupper \\$*
+.\}
+.el \{\
+.nr an-break-flag 0
+.\" if not n (not TTY), use normal case (not uppercase)
+\\$1
+.in \\n[an-margin]u
+.ti 0
+.\" if not n (not TTY), put a border/line under subheading
+.sp -.6
+\l'\n(.lu'
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" SS - level-two heading that works better for non-TTY output
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de1 SS
+.sp \\n[PD]u
+.nr an-level 1
+.set-an-margin
+.nr an-prevailing-indent \\n[IN]
+.fi
+.in \\n[IN]u
+.ti \\n[SN]u
+.it 1 an-trap
+.nr an-no-space-flag 1
+.nr an-break-flag 1
+.ps \\n[PS-SS]u
+\." make the size of the head bigger
+.ps +2
+.ft B
+.ne (2v + 1u)
+.if \\n[.$] \&\\$*
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BB/BE - put background/screen (filled box) around block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BB
+.if t \{\
+.sp -.5
+.br
+.in +2n
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EB
+.if t \{\
+.if "\\$2"adjust-for-leading-newline" \{\
+.sp -1
+.\}
+.br
+.di
+.in
+.ll
+.gcolor
+.nr BW \\n(.lu-\\n(.i
+.nr BH \\n(dn+.5v
+.ne \\n(BHu+.5v
+.ie "\\$2"adjust-for-leading-newline" \{\
+\M[\\$1]\h'1n'\v'+.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.el \{\
+\M[\\$1]\h'1n'\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
+.\}
+.in 0
+.sp -.5v
+.nf
+.BX
+.in
+.sp .5v
+.fi
+.\}
+..
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" BM/EM - put colored marker in margin next to block of text
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.de BM
+.if t \{\
+.br
+.ll -2n
+.gcolor red
+.di BX
+.\}
+..
+.de EM
+.if t \{\
+.br
+.di
+.ll
+.gcolor
+.nr BH \\n(dn
+.ne \\n(BHu
+\M[\\$1]\D'P -.75n 0 0 \\n(BHu -(\\n[.i]u - \\n(INu - .75n) 0 0 -\\n(BHu'\M[]
+.in 0
+.nf
+.BX
+.in
+.fi
+.\}
+..
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "Name"
+tapelist \- The list of \fIAmanda\fR volumes in use
+.SH "DESCRIPTION"
+.PP
+The
+\fItapelist\fR
+file contains the list of tapes in active use\&. This file is not ordinarily ordinarily edited or examined manually\&. Its format may change, or it may be removed altogether, in future versions of
+\fIAmanda\fR\&. It contains lines of the form:
+.PP
+.nf
+YYYYMMDD label flags [#comment]
+.fi
+.PP
+Where
+\fIYYYYMMDD\fR
+is the date the tape was written,
+\fIlabel\fR
+is a label for the tape as written by
+\fBamlabel\fR
+and
+\fIflags\fR
+is one of "reuse" or "no\-reuse" and tells
+\fIAmanda\fR
+whether the tape may be reused\&. A non\-reusable tape will not be overwritten, even if it is older than
+\fBdumpcycle\fR
+dumps\&. See the
+\fBreuse\fR
+options of
+\fBamadmin\fR(8)\&. The optional comment is prefixed with a \'#\' and continues to the end of the line\&. Amanda will maintain this comment until the tape is overwritten\&. Note that comments are not allowed on blank lines\&.
+.PP
+\fBAmdump\fR
+and
+\fBamflush\fR
+will by default refuse to write to an unlabeled tape, or to a labeled tape that is considered active or marked "no\-reuse"\&. There must be more tapes in active rotation (see the
+\fBtapecycle\fR
+option) than there are runs in the backup cycle (see the
+\fBdumpcycle\fR
+option) to prevent overwriting a backup image that would be needed to do a full recovery\&.
+.SH "Authors"
+.PP
+\fBJames da Silva\fR <\&jds@amanda\&.org\&>
+.PP
+\fBStefan G\&. Weichinger\fR <\&sgw@amanda\&.org\&>
+.PP
+\fBDustin J\&. Mitchell\fR <\&dustin@zmanda\&.com\&>
+.RS 4
+Zmanda, Inc\&. (\FChttp://www\&.zmanda\&.com\F[])
+.RE
index 36bb72a12344f466b5c2e52cdf1299720a9541aa..926a837acd9daec5a8c15f5ce087c834435e519f 100644 (file)
@@ -1,4 +1,3 @@
-
 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
                    "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"
 [
 <refmeta>
 <refentrytitle>amaddclient</refentrytitle>
 <manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
 </refmeta>
 <refnamediv>
 <refname>amaddclient</refname>
 <refpurpose>program to add client to an existing &A; configuration</refpurpose>
 </refnamediv>
+<refentryinfo>
+&author.ktill;
+</refentryinfo>
 <!-- body begins here -->
 <refsynopsisdiv>
 <cmdsynopsis>
@@ -46,7 +51,8 @@
 <para>After Amanda rpms are successfully installed and
 &amserverconfig; is run,
          &amaddclient; will add client to the  &A; configuration.
-&amaddclient; create or update &A; disklist file and create or update
+&amaddclient; create or update &A;  &disklist;
+file and create or update
 /var/lib/amanda/.amandahosts file on the server.</para>
 <para> If --no-client-update is not specified,
 &amaddclient; will attempt to update or create /var/lib/amanda/.amandahost,
@@ -94,8 +100,8 @@ Example: --conf=v253, --client client8.zmanda.com
   <varlistentry>
   <term><option>--m</option></term>
   <listitem>
-<para>Modify existing entry in the disklist file.</para>
-<para>Note: if disklist file has been modified manually, this option might not work.</para>
+<para>Modify existing entry in the &disklist; file.</para>
+<para>Note: if &disklist; file has been modified manually, this option might not work.</para>
   </listitem>
   </varlistentry>
 
@@ -162,7 +168,7 @@ set, this program will attempt to create the directory on the client. </para>
   </varlistentry>
 
 <varlistentry> 
-If any of the following four options are used, &amaddclient; will extend the dumptype definition to an in-line definition in the disklist file. See <citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry> DISKLIST FILE section for detail.
+If any of the following four options are used, &amaddclient; will extend the dumptype definition to an in-line definition in the &disklist; file.
 </varlistentry>
 
   <varlistentry>
@@ -266,12 +272,6 @@ Specify either --excludefile or --excludelist. </para>
 On success, zero is returned.  On error, 1 is returned.
 </refsect1>
 
-<refsect1><title>AUTHOR</title>
-  <para>
-    The tool and its documentation was written by Zmanda, Inc (http://www.zmanda.com/). 
-  </para>
-</refsect1>
-
 <refsect1><title>SEE ALSO</title>
 <para><citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
 <citerefentry><refentrytitle>amanda.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
index 7efd5198efb4eb176dcae77b39fd06ecda36b281..64153d43b970890120b24af8f511ae62fffaa845 100644 (file)
 <!-- lifted from troff+man by doclifter -->
 <refentry id='amadmin.8'>
 
+
 <refmeta>
 <refentrytitle>amadmin</refentrytitle>
 <manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
 </refmeta>
 <refnamediv>
 <refname>amadmin</refname>
 <refpurpose>administrative interface to control &A; backups</refpurpose>
 </refnamediv>
+<refentryinfo>
+&author.jds;
+&author.sgw.xml;
+</refentryinfo>
 <!-- body begins here -->
 <refsynopsisdiv>
 <cmdsynopsis>
@@ -43,10 +51,10 @@ man page for more details about &A;.</para>
 
 <refsect1><title>COMMANDS</title>
 <para>Commands that take a <emphasis remap='I'>hostname</emphasis> [ <emphasis remap='I'>disks</emphasis> ]
-parameter pair operate on all disks in the <emphasis remap='I'>disklist</emphasis> for that
+parameter pair operate on all disks in the &disklist; for that
 <emphasis remap='I'>hostname</emphasis> if no disks are specified.  Where
 <emphasis remap='I'>hostname</emphasis> is also marked as being optional,
-the command operates on all hosts and disks in the <emphasis remap='I'>disklist</emphasis>.
+the command operates on all hosts and disks in the &disklist;.
 Both <emphasis remap='I'>hostname</emphasis> and <emphasis remap='I'>disks</emphasis>
 are special expressions; see the &quot;HOST &amp; DISK EXPRESSION&quot; section
 of <citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>
@@ -144,7 +152,7 @@ security to be sure amanda will not overwrite them.</para>
   </listitem>
   </varlistentry>
   <varlistentry>
-  <term><emphasis remap='B'>find</emphasis> [ <option>--sort</option> <replaceable>hkdlpb</replaceable> ]<emphasis remap='B'></emphasis> [ <emphasis remap='I'>hostname</emphasis> [ <emphasis remap='I'>disks</emphasis> ]* ]*</term>
+  <term><emphasis remap='B'>find</emphasis> [ <option>--sort</option> <replaceable>hkdlpbfw</replaceable> ]<emphasis remap='B'></emphasis> [ <emphasis remap='I'>hostname</emphasis> [ <emphasis remap='I'>disks</emphasis> ]* ]*</term>
   <listitem>
 <para>Display all backups currently on tape or in the holding disk.
 The tape label or holding disk filename,
@@ -154,14 +162,16 @@ and status are displayed.</para>
 <programlisting>
 <emphasis>h</emphasis>: host name
 <emphasis>k</emphasis>: disk name
-<emphasis>d</emphasis>: dump date
+<emphasis>d</emphasis>: dump timestamp
 <emphasis>l</emphasis>: backup level
 <emphasis>p</emphasis>: dump part
 <emphasis>b</emphasis>: tape label
+<emphasis>f</emphasis>: filenum on tape
+<emphasis>w</emphasis>: write timestamp
 </programlisting></para>
 
 <para>An uppercase letter reverses the sort order for that key.
-The default sort order is <emphasis remap='B'>hkdlpb</emphasis>.</para>
+The default sort order is <emphasis remap='B'>hkdlpbfw</emphasis>.</para>
 </listitem>
 </varlistentry>
 
@@ -204,8 +214,7 @@ The default sort order is <emphasis remap='B'>hkdlpb</emphasis>.</para>
 on
 <emphasis remap='I'>hostname</emphasis>
 from the &A; database.</para>
-<note><para>If you do not also remove the disk from the
-<emphasis remap='I'>disklist</emphasis>
+<note><para>If you do not also remove the disk from the &disklist;
 file, &A; will treat it as a new disk during the next run.</para>
 </note>
   </listitem>
@@ -252,8 +261,7 @@ and insert them into the database on this machine.</para>
   <varlistentry>
   <term><emphasis remap='B'>disklist</emphasis> [ <emphasis remap='I'>hostname</emphasis> [ <emphasis remap='I'>disks</emphasis> ]* ]*</term>
   <listitem>
-<para>Display the
-<emphasis remap='I'>disklist</emphasis>
+<para>Display the &disklist;
 information for each of the
 <emphasis remap='I'>disks</emphasis>
 on
@@ -361,14 +369,13 @@ date        host      disk lv tape or file                 file part  status
 <filename>/workspace</filename>
 disk on
 <emphasis remap='I'>machine-d</emphasis>.
-If you do not also remove the disk from the
-<emphasis remap='I'>disklist</emphasis>
+If you do not also remove the disk from the &disklist;
 file, &A; will treat it as a new disk during the next run.</para>
 
 <programlisting remap='.nf'>
 $ amadmin daily delete machine-d /workspace
 amadmin: machine-d:/workspace deleted from database.
-amadmin: NOTE: you'll have to remove these from the disklist yourself.
+amadmin: NOTE: you'll have to remove these from the &disklist; yourself.
 </programlisting>
 
 <para>Find the next tape &A; will use (in this case, <literal>123456</literal>).</para>
@@ -429,11 +436,6 @@ TOTAL      241  12412187   7316312   731631  (estimated 8 runs per dumpcycle)
 <para>/usr/local/etc/amanda/<emphasis remap='I'>config</emphasis>/amanda.conf</para>
 </refsect1>
 
-<refsect1><title>AUTHOR</title>
-<para>James da Silva, &email.jds; : Original text</para>
-<para>&maintainer.sgw;: XML-conversion</para>
-</refsect1>
-
 <refsect1><title>SEE ALSO</title>
 <para><citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
 <citerefentry><refentrytitle>amcheck</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
index b3c87f0829f57078f2decaa4adb0e2b0695b93ad..7740f0c8eb28e461e7bb6d49e3100b1ca7ed11d3 100755 (executable)
 <refmeta>
 <refentrytitle>amaespipe</refentrytitle>
 <manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
 </refmeta>
 <refnamediv>
 <refname>amaespipe</refname>
 <refpurpose>wrapper program for aespipe</refpurpose>
 </refnamediv>
+<refentryinfo>
+&author.ktill;
+</refentryinfo>
 <!-- body begins here -->
 <refsynopsisdiv>
 <cmdsynopsis>
@@ -38,8 +44,6 @@ During decryption, &amaespipe; autodects encryption type and hash function from
 the encrypted image.</para>
 </refsect1>
 
-
-
 <refsect1><title>SEE ALSO</title>
 <para><citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
 <citerefentry><refentrytitle>amanda.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
diff --git a/man/xml-source/amanda-applications.7.xml b/man/xml-source/amanda-applications.7.xml
new file mode 100644 (file)
index 0000000..c59f6be
--- /dev/null
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"
+[
+  <!-- entities files to use -->
+  <!ENTITY % global_entities SYSTEM '../entities/global.entities'>
+  %global_entities;
+]>
+
+<refentry id='amanda-applications.7'>
+
+<refmeta>
+<refentrytitle>amanda-applications</refentrytitle>
+<manvolnum>7</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.7;
+</refmeta>
+<refnamediv>
+<refname>amanda-applications</refname>
+<refpurpose>Application-api for amanda</refpurpose>
+</refnamediv>
+<refentryinfo>
+&author.jlm;
+&author.dustin;
+</refentryinfo>
+<!-- body begins here -->
+
+<refsect1><title>DESCRIPTION</title>
+
+<para>Describe how to use application with &A;</para>
+</refsect1>
+
+<refsect1><title>APPLICATIONS</title>
+
+<para>This section lists the applications included with &A;. See the individual man pages for instructions on using them.  For complete How-To information, consult the Amanda wiki at http://wiki.zmanda.com.</para>
+
+<itemizedlist>
+<listitem>
+<citerefentry><refentrytitle>amgtar</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+- use GNU Tar to backup and restore data.
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amsamba</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+- use smbclient to backup and restore data.
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amstar</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+- use star to backup and restore data.
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amzfs-sendrecv</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+- use zfs to create a snapshot and use 'zfs send' to generate the backup.
+</listitem>
+</itemizedlist>
+
+</refsect1>
+
+<refsect1><title>SEE ALSO</title>
+<para>
+<citerefentry><refentrytitle>amanda.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+</para>
+
+</refsect1>
+</refentry>
diff --git a/man/xml-source/amanda-archive-format.5.xml b/man/xml-source/amanda-archive-format.5.xml
new file mode 100644 (file)
index 0000000..d7b729a
--- /dev/null
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"
+[
+  <!-- entities files to use -->
+  <!ENTITY % global_entities SYSTEM '../entities/global.entities'>
+  %global_entities;
+]>
+
+<refentry id='amanda-archive-format.5'>
+
+<refmeta>
+<refentrytitle>amanda-archive-format</refentrytitle>
+<manvolnum>5</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.5;
+</refmeta>
+<refnamediv>
+<refname>amanda-archive-format</refname>
+<refpurpose>Format of amanda archive streams</refpurpose>
+</refnamediv>
+<refentryinfo>
+&author.dustin;
+</refentryinfo>
+<!-- body begins here -->
+
+<refsect1><title>DESCRIPTION</title>
+
+<para>The &A; archive format is designed to be a simple, efficient means of interleaving multiple simultaneous files, allowing an arbitrary number of data streams for a file.  It is a streaming format in the sense that the writer need not know the size of files until they are completely written to the archive, and the reader can process the archive in constant space.</para>
+
+</refsect1>
+
+<refsect1><title>DATA MODEL</title>
+
+<para>The data stored in an archive consists of an unlimited number of files.  Each file consists of a number of "attributes", each identified by a 16-bit ID.  Each attribute can contain an unlimited amount of data.</para>
+
+<para>Attribute IDs less than 16 (AMAR_ATTR_APP_START) are reserved for special purposes, but the remaining IDs are available for application-specific uses.</para>
+
+</refsect1>
+
+<refsect1><title>STRUCTURE</title>
+
+<refsect2><title>RECORDS</title>
+
+<para>A record can be either a header record or a data record.  A header record serves as a "checkpoint" in the file, with a magic value that can be used to recognize archive files.</para>
+
+<para>A header record has a fixed size of 28 bytes, as follows:
+<programlisting>
+  28 bytes:    magic string
+</programlisting>
+The magic string is the ASCII text "AMANDA ARCHIVE FORMAT " followed by a decimal representation of the format version number (currently '1'), padded to 28 bytes with NUL bytes.</para>
+
+<para>A data record has a variable size, as follows:
+<programlisting>
+  2 bytes:     file number
+  2 bytes:     attribute ID
+  4 bytes:     data size (N)
+  N bytes:     data
+</programlisting>
+The file number and attribute ID serve to identify the data stream to which this data belongs.  The low 31 bits of the data size give the number of data bytes following, while the high bit (the EOA bit) indicates the end of the attribute, as described below.  Because records are generally read into memory in their entirety, the data size must not exceed 4MB (4194304 bytes).  All integers are in network byte order.</para>
+
+<para>A header record is distinguished from a data record by the magic string.  The file number 0x414d, corresponding to the characters "AM", is forbidden and must be skipped on writing.</para>
+
+<para>Attribute ID 0 (AMAR_ATTR_FILENAME) gives the filename of a file.  This attribute is mandatory for each file, must be nonempty, must fit in a single record, and must precede any other attributes for the same file in the archive.  The filename should be a printable string (ASCII or UTF-8), to facilitate use of generic archive-display utilities, but the format permits any nonempty bytestring.  The filename cannot span multiple records.</para>
+
+<para>Attribute ID 1 (AMAR_ATTR_EOF) signals the end of a file.  This attribute must contain no data, but should have the EOA bit set.</para>
+
+</refsect2>
+
+<refsect2><title>CONNECTION TO DATA MODEL</title>
+
+<para>Each file in an archive is assigned a file number distinct from any other active file in the archive.  The first record for a file must have attribute ID 0 (AMAR_ATTR_FILENAME), indicating a filename.  A file ends with an empty record with ID 1 (AMAR_ATTR_EOF).  For every file at which a reader might want to begin reading, the filename record should be preceded by a header record.  How often to write header records is left to the discretion of the application.</para>
+
+<para>All data records with the same file number and attribute ID are considered a part of the same attribute.  The boundaries between such records are not significant to the contents of the attribute, and both readers and writers are free to alter such boundaries as necessary.</para>
+
+<para>The final data record for each attribute has the high bit (the EOA bit) of its data size field set.  A writer must not reuse an attribute ID within a file.  An attribute may be terminated by a record containing both data and an EOA bit, or by a zero-length record with its EOA bit set.</para>
+
+</refsect2>
+
+</refsect1>
+
+<refsect1><title>SEE ALSO</title>
+<para>
+<citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</para>
+</refsect1>
+
+</refentry>
diff --git a/man/xml-source/amanda-auth.7.xml b/man/xml-source/amanda-auth.7.xml
new file mode 100644 (file)
index 0000000..0fb1715
--- /dev/null
@@ -0,0 +1,535 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"
+[
+  <!-- entities files to use -->
+  <!ENTITY % global_entities SYSTEM '../entities/global.entities'>
+  %global_entities;
+]>
+
+<refentry id='amanda-auth.7'>
+
+<refmeta>
+  <refentrytitle>amanda-auth</refentrytitle>
+  <manvolnum>7</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.7;
+</refmeta>
+<refnamediv>
+  <refname>amanda-auth</refname>
+  <refpurpose>Communication/Authentication methods between &A; server and client</refpurpose>
+</refnamediv>
+<refentryinfo>
+  &author.jlm;
+  &author.dustin;
+  &author.pby;
+</refentryinfo>
+
+<!-- body begins here -->
+
+<refsect1><title>DESCRIPTION</title>
+  <para>&A; offers 7 methods of communication between Amanda server (sometimes also called the tape server) and clients, each with its own authentication method.  The desired communication method is specified by the <emphasis remap='I'>auth</emphasis> parameter in the amanda.conf file (&amconf;) commonly as a dumptype.  Valid values to the <emphasis remap='I'>auth</emphasis> parameter are <emphasis remap='B'>bsd</emphasis>, <emphasis remap='B'>bsdudp</emphasis>, <emphasis remap='B'>bsdtcp</emphasis>, <emphasis remap='B'>krb4</emphasis>, <emphasis remap='B'>krb5</emphasis>, <emphasis remap='B'>local</emphasis>, <emphasis remap='B'>rsh</emphasis>, and <emphasis remap='B'>ssh</emphasis>. Please note that <emphasis remap='B'>krb4</emphasis> will be removed in the next release.  The authentication and communication method is used during the backup process &amdump; (amdump(8)) as well as the recovery process &amrecover; (amrecover(8)).  For detailed information, please see http://wiki.zmanda.com/index.php/Server/Client_authentication.</para>
+</refsect1>
+
+<refsect1><title>COMPILATION AND GENERAL INFORMATION</title>
+  <para>The communication method and thus type of authentication that will be used by the Amanda server is specified by the <emphasis remap='I'>auth</emphasis> parameter in the dumptype for each disklist entry (DLE).  The <emphasis remap='I'>auth</emphasis> parameter thus may be easily and globally specified in the "global" dumptype.  If <emphasis remap='I'>auth</emphasis> is not specified, the <emphasis remap='B'>bsd</emphasis> communication method is used.  See &amconf; for more information on Amanda configuration and dumptypes, and &disklist; for more information on disklists.</para>
+
+<para>On the client side, the Amanda daemon &amandad; validates the connection depending on the value of the <emphasis remap='B'>auth</emphasis> argument passed to it (see &A;(8)).  Also, when it comes to recovery, the <emphasis remap='B'>auth</emphasis> parameter can be specified in the &amclientconf; file to specify the communication method to be used by the client to the server.</para>
+
+  <para>When &A; is being built from source code, desired communication and thus authentication methods (shown as "Authentication") must be specified as configure options at compilation time.
+<programlisting>
+Authentication   Configure option(s)
+ bsd                   --with-bsd-security      --with-amandahosts (pre-2.6)
+ bsdtcp                --with-bsdtcp-security   --with-amandahosts (pre-2.6)
+ bsdudp                --with-bsdudp-security   --with-amandahosts (pre-2.6)
+ krb5          --with-krb5-security
+ local          (always included)
+ rsh                   --with-rsh-security
+ ssh                   --with-ssh-security
+</programlisting>
+  </para>
+<para>There are additional configure options for <emphasis remap='B'>bsd</emphasis>, <emphasis remap='B'>bsdudp</emphasis>, and <emphasis remap='B'>bsdtcp</emphasis> to allow for specifying explicit UDP and TCP port ranges.
+
+<programlisting>
+   --with-udpportrange
+   --with-tcpportrange
+   --with-low-tcpportrange
+</programlisting>
+</para>
+
+<para>See <emphasis remap='B'>PORT USAGE</emphasis> below for more information.</para>
+
+<para>There are additional configure options for Kerberos if you so desire.  All but the last option are for Kerberos 4.  Defaults shown in square brackets.
+
+<programlisting>
+   --with-server-principal=ARG    server host principal  [amanda]
+   --with-server-instance=ARG     server host instance   []
+   --with-server-keyfile=ARG      server host key file   [/.amanda]
+   --with-client-principal=ARG    client host principal  [rcmd]
+   --with-client-instance=ARG     client host instance   [HOSTNAME_INSTANCE]
+   --with-client-keyfile=ARG      client host key file   [KEYFILE]
+   --with-ticket-lifetime=ARG     ticket lifetime        [128]
+   --with-krb4-security=DIR       where libkrb.a lives   [see below]
+   --with-krb5-security=DIR       where libkrb.a lives   [see below]
+</programlisting>
+</para>
+
+<para>If configuring with --with-krb4-security and/or --with-krb5-security, the configure script will search under /usr/kerberos/lib, /usr/cygnus/lib, /usr/lib, and /opt/kerberos/lib for the kerberos bits, libkrb.a, in this order.  Kerberos support will not be added if it does not find them.  If the kerberos bits are found under some other hierarchy, you can specify this via --with-krb5-security=DIR and/or --with-krb4-security=DIR, where DIR is where the kerberos bits live.  The configure script will then look in the 'lib' directory under this hierarchy for libkrb.a.</para>
+
+<para>The <emphasis remap='B'>auth</emphasis> parameter selects a communication/authentication method to use between the client and the backup server. These methods are described each in their own section below.</para>
+</refsect1>
+
+<refsect1><title>BSD, BSDUDP, AND BSDTCP COMMUNICATION AND AUTHENTICATION</title>
+<para>For more detail, see http://wiki.zmanda.com/index.php/Configuring_bsd/bsdudp/bsdtcp_authentication.</para>
+
+  <para>The <emphasis remap='B'>bsd</emphasis>, <emphasis remap='B'>bsdudp</emphasis>, and <emphasis remap='B'>bsdtcp</emphasis> communication methods use either UDP, TCP, or both protocols operating as a network service to authenticate and exchange data between server and clients.</para>
+
+  <para>In addition to compilation and general configuration (see <emphasis remap='B'>COMPILATION AND GENERAL INFORMATION</emphasis> above), the authentication method that the client is configured to receive is specified by the <emphasis remap='B'>auth</emphasis> parameter in the network service configuration for &A;. The authentication method used by an Amanda client to reach the server during recovery is the authentication method specified by the <emphasis remap='I'>auth</emphasis> parameter in the client's Amanda network service configuration or in its amanda-client.conf file (see amanda-client.conf(5)).</para>
+                       
+  <refsect2><title>.amandahosts file</title>
+    <para> Servers and clients using the bsd, bsdudp, and bsdtcp authentication methods refer to the .amandahosts file to control access.  Amanda should be compiled for this access control if one of these methods will be used and is the default compilation option for Amanda 2.6 (use --with-amandahosts when compiling pre-2.6 versions of Amanda).</para>
+
+    <para>Amanda looks for the .amandahosts file in the Amanda user's home directory, commonly /var/lib/amanda.</para>
+
+    <para>Each authorization is on its own line in the following format</para>
+
+<para><emphasis remap='I'>hostname</emphasis> [ <emphasis remap='I'>username</emphasis> [ <emphasis remap='I'>service...</emphasis> ] ]</para>
+
+<para>If <emphasis remap='I'>username</emphasis> is ommitted, it defaults to the user running <emphasis remap='B'>amandad</emphasis>, i.e. the user listed in the <emphasis remap='B'>inetd</emphasis> or <emphasis remap='B'>xinetd</emphasis>
+configuration file.</para>
+
+<para><emphasis remap='I'>service...</emphasis> is a space-delimited list of services the client is authorized to execute:
+
+<emphasis remap='B'>noop</emphasis>,
+<emphasis remap='B'>selfcheck</emphasis>,
+<emphasis remap='B'>sendsize</emphasis>,
+
+<emphasis remap='B'>sendbackup</emphasis>,
+<emphasis remap='B'>amdump</emphasis> (a shortcut for the previous four services which are required on clients),
+<emphasis remap='B'>amindexd</emphasis>, and
+<emphasis remap='B'>amidxtaped</emphasis>.  The last two services are required on a server for clients to connect to it using <emphasis remap='B'>amrecover</emphasis>.</para>
+
+    <para>Example of the .amandahosts file on an Amanda client
+
+<programlisting>
+    <emphasis remap='B'>amandaserver.example.com   amandabackup   amdump</emphasis>
+</programlisting>
+    </para>
+
+    <para>Example of the .amandahosts file on an Amanda server
+
+<programlisting>
+    <emphasis remap='B'>amandaclient1.example.com   root   amindexd amidxtaped</emphasis>
+</programlisting>
+    </para>
+  </refsect2>
+
+  <refsect2><title>bsd communication and authentication</title>
+    <para>The authentication is done using .amandahosts file in the Amanda user's home directory. The protocol between Amanda server and client is UDP. The number of disk list entries (DLEs)--number of Amanda clients--is limited by the UDP packet size. This authentication protocol will use a different port for each data stream (see PORT USAGE below)</para>
+  </refsect2>
+
+  <refsect2><title>bsdudp communication and authentication</title>
+     <para>The authentication is done using .amandahosts files in the Amanda user's home directory. It uses UDP protocol between Amanda server and client for data and hence the number of DLEs is limited by the UDP packet size. It uses one TCP port to establish the connection and multiplexes all data streams using one port on the server (see PORT USAGE below).</para>
+  </refsect2>
+
+  <refsect2><title>bsdtcp communication and authentication</title>
+    <para>The authentication is done using .amandahosts files in the backup user's (for example: amandabackup) home directory. It uses TCP protocol between Amanda server and client. On the client, two reserved ports are used. On the server, all data streams are multiplexed to one port (see PORT USAGE below).</para>
+  </refsect2>
+
+  <refsect2><title>USING INETD SERVER</title>
+    <para>Template for Amanda client inetd service entry
+
+<programlisting>
+<emphasis remap='I'>   service_name</emphasis> <emphasis remap='I'>socket_type</emphasis> <emphasis remap='I'>protocol</emphasis> <emphasis remap='I'>wait/nowait</emphasis> <emphasis remap='I'>amanda_backup_user</emphasis> <emphasis remap='I'>absolute_path_to_amandad</emphasis> amandad <emphasis remap='I'>server_args</emphasis>
+</programlisting>
+    </para>
+    <para>Client example of using <emphasis remap='B'>bsd</emphasis> authorization for inetd server given Amanda user is "amandabackup":
+
+<programlisting>
+<emphasis remap='B'>   amanda dgram udp wait amandabackup /path/to/amandad amandad -auth=bsd amdump</emphasis>
+</programlisting>
+    </para>
+    <para>The same could be used for <emphasis remap='B'>bsdudp</emphasis> if specifying -auth=bsdudp instead of -auth=bsd.</para>
+    <para>Client example of using <emphasis remap='B'>bsdtcp</emphasis> authorization for inetd server given Amanda user is "amandabackup":
+
+<programlisting>
+<emphasis remap='B'>   amanda stream tcp nowait amanda /path/to/amandad amandad -auth=bsdtcp amdump</emphasis>
+</programlisting>
+    </para>
+    <para><emphasis remap='B'>amindexd</emphasis> and <emphasis remap='B'>amidxtaped</emphasis> would typically be added at the end of the line as &amandad; server arguments for an Amanda server.</para>
+    <para>Server example of using <emphasis remap='B'>bsdtcp</emphasis> authorization for inetd server given Amanda user is "amandabackup":
+
+<programlisting>
+<emphasis remap='B'>   amanda stream tcp nowait amanda /path/to/amandad amandad -auth=bsdtcp amdump amindexd amidxtaped</emphasis>
+</programlisting>
+    </para>
+    <para>For Amanda version 2.5.0 and earlier, remember that neither <emphasis remap='B'>bsdudp</emphasis> nor <emphasis remap='B'>bsdtcp</emphasis> are supported and the Amanda daemon &amandad; accepts no arguments.  Because of the latter, &amrecover; as of Amanda version 2.5.1  is not compatible with 2.5.0 and earlier servers.  Thus, servers that are 2.5.0 or earlier must, in addition to the <emphasis remap='I'>amanda</emphasis> service, run <emphasis remap='I'>amindexd</emphasis> and <emphasis remap='I'>amidxtaped</emphasis> Amanda services as their own network services, amandaidx and amidxtape, respectively (see below).</para>
+
+<para>There are no compatibility issues if server and clients are all 2.5.0 or earlier.  If your server is 2.5.1 or later, you can still have clients that are 2.5.0 and earlier although you must then use <emphasis remap='B'>bsd</emphasis> communication/authentication with these clients and must also run <emphasis remap='I'>amindexd</emphasis> and <emphasis remap='I'>amidxtaped</emphasis> Amanda services on the server as their own network services, amandaidx and amidxtape, respectively (see below).  If you have a server that is 2.5.0 and earlier, clients of a later version on which you wish to run &amrecover; must use <emphasis remap='B'>amoldrecover</emphasis> instead and, again, the server must be running the amandaidx and amidxtape network services.</para>
+
+<para>Example of amindexd and amidxtaped Amanda daemon services configured as their own network services for a 2.5.0 or earlier server or a newer server having 2.5.0 or earlier clients
+
+<programlisting>
+<emphasis remap='B'>   amandaidx stream tcp nowait amanda /usr/local/libexec/amanda/current/amindexd   amindexd</emphasis>
+<emphasis remap='B'>   amidxtape stream tcp nowait amanda /usr/local/libexec/amanda/current/amidxtaped amidxtaped</emphasis>
+</programlisting>
+</para>
+  </refsect2>
+
+  <refsect2><title>USING XINETD SERVER</title>
+    <para>Template for Amanda client xinetd service file
+
+<programlisting>
+service amanda
+{
+       only_from               = <emphasis remap='I'>Amanda server</emphasis>
+       socket_type             = <emphasis remap='I'>socket type</emphasis>
+       protocol                = <emphasis remap='I'>protocol</emphasis>
+       wait                    = <emphasis remap='I'>yes/no</emphasis>
+       user                    = <emphasis remap='I'>amanda backup user</emphasis>
+       group                   = <emphasis remap='I'>amanda backup user group id</emphasis>
+       groups                  = yes
+       server                  = <emphasis remap='I'>absolute path to amandad</emphasis>
+       server_args             = <emphasis remap='I'>amandad server arguments</emphasis>
+       disable                 = no
+}
+</programlisting>
+    </para>
+    <para>The <emphasis remap='I'>only_from</emphasis> parameter can be used with xinetd but is usually in addition to the primary form of access control via the .amandahosts file.</para>
+    <para>Client example of using <emphasis remap='B'>bsd</emphasis> authorization for xinetd server and for Amanda user "amandabackup":
+
+<programlisting>
+service amanda
+{
+       only_from       = amandaserver.example.com
+       socket_type     = dgram
+       protocol        = udp
+       wait            = yes
+       user            = amandabackup
+       group           = disk
+       groups          = yes
+       server          = /path/to/amandad
+       server_args     = -auth=bsd amdump
+       disable         = no 
+}
+</programlisting>
+    </para>
+    <para>The same could be used for <emphasis remap='B'>bsdudp</emphasis> if specifying -auth=bsdudp instead of -auth=bsd.</para>
+    <para>Client example of using <emphasis remap='B'>bsdtcp</emphasis> authorization for xinetd server and for Amanda user "amandabackup":
+
+<programlisting>
+service amanda
+{
+       only_from       = amandaserver.example.com amandaclient.example.com
+       socket_type     = stream
+       protocol        = tcp
+       wait            = no
+       user            = amandabackup
+       group           = disk
+       groups          = yes
+       server          = /path/to/amandad
+       server_args     = -auth=bsdtcp amdump
+       disable         = no 
+}
+</programlisting>
+    </para>
+    <para><emphasis remap='B'>amindexd</emphasis> and <emphasis remap='B'>amidxtaped</emphasis> would typically be added as additional &amandad; <emphasis remap='I'>server_args</emphasis> for an Amanda server.</para>
+    <para>For Amanda version 2.5.0 and earlier, remember that neither <emphasis remap='B'>bsdudp</emphasis> nor <emphasis remap='B'>bsdtcp</emphasis> are supported and the Amanda daemon &amandad; accepts no arguments.  Because of the latter, &amrecover; as of Amanda version 2.5.1  is not compatible with 2.5.0 and earlier servers.  Thus, servers that are 2.5.0 or earlier must, in addition to the <emphasis remap='I'>amanda</emphasis> service, run <emphasis remap='I'>amindexd</emphasis> and <emphasis remap='I'>amidxtaped</emphasis> Amanda services as their own network services, amandaidx and amidxtape, respectively (see below).</para>
+
+<para>There are no compatibility issues if server and clients are all 2.5.0 or earlier.  If your server is 2.5.1 or later, you can still have clients that are 2.5.0 and earlier although you must then use <emphasis remap='B'>bsd</emphasis> communication/authentication with these clients and must also run <emphasis remap='I'>amindexd</emphasis> and <emphasis remap='I'>amidxtaped</emphasis> Amanda services on the server as their own network services, amandaidx and amidxtape, respectively (see below).  If you have a server that is 2.5.0 and earlier, clients of a later version on which you wish to run &amrecover; must use <emphasis remap='B'>amoldrecover</emphasis> instead and, again, the server must be running the amandaidx and amidxtape network services.</para>
+
+<para>Example of amindexd and amidxtaped Amanda daemon services configured as their own network services for a 2.5.0 or earlier server or a newer server having 2.5.0 or earlier clients
+<programlisting>
+service amandaidx
+{
+       socket_type             = stream
+       protocol                = tcp
+       wait                    = no
+       user                    = amanda
+       group                   = disk
+       server                  = /usr/local/libexec/amanda/amindexd 
+       disable                 = no
+}
+
+service amidxtape
+{
+       socket_type             = stream
+       protocol                = tcp
+       wait                    = no
+       user                    = amanda
+       group                   = disk
+       server                  = /usr/local/libexec/amanda/amidxtaped
+       disable                 = no
+}
+
+</programlisting>
+</para>
+  </refsect2>
+
+  <refsect2><title>PORT USAGE</title>
+    <para>List of TCP/UDP ports used by network service communication methods for Amanda server and client.
+
+<programlisting>
+   Key:
+       UP = Unreserved Port
+    RPpAP = Reserved Port per Amanda Process
+   UPpDLE = Unreserved Port per DLE
+     [..] = Configure options that can be used at compile time to define port ranges
+
+Authentication Protocol        Amanda server                                   Amanda client
+bsd                    udp             1 RPpAP [--with-udpportrange]           10080
+                       tcp             1 UP [--with-tcpportrange]              3 UPpDLE [--with-tcpportrange]
+bsdudp         udp             1 RPpAP [--with-udpportrange]           10080
+                       tcp             1 UP [-with-tcpportrange]               1 UPpDLE [--with-tcpportrange]
+bsdtcp         tcp             1 RPpAP [--with-low-tcpportrange]       10080
+</programlisting>
+</para>
+    <para>Amanda server also uses two ports (dumper process) to communicate with the chunker/taper processes. These ports are in the range set by --with-tcpportrange.</para>
+<para>You can override the default port ranges that Amanda was compiled with in each configuration using the <emphasis remap='I'>reserved-udp-port</emphasis>, <emphasis remap='I'>reserved-tcp-port</emphasis>, and <emphasis remap='I'>unreserved-tcp-port</emphasis> parameters in amanda.conf and amanda-client.conf configuration files (see &amconf; and &amclientconf;).</para>
+  </refsect2>
+</refsect1>
+
+<refsect1><title>KERBEROS COMMUNICATION AND AUTHENTICATION</title>
+For more detail, see http://wiki.zmanda.com/index.php/Kerberos_authentication.
+
+<para>Amanda supports Kerberos 4 and 5 communication methods between Amanda server and client. Please note, however, that support for Kerberos 4 will be removed in the next release.</para>
+
+<para>General information including compilation are given above (see <emphasis remap='B'>COMPILATION AND GENERAL INFORMATION</emphasis> above).  Below sections give specific Kerberos 4 and 5 information.</para>
+
+<refsect2><title>KERBEROS v4</title>
+Please note that support for Kerberos 4 will be removed in the next release.
+
+Kerberos 4 uses UDP protocol and the number of DLEs is limited by UDP packet size.
+
+The kerberized AMANDA service uses a different port on the client hosts. The /etc/services line is:
+
+    kamanda      10081/udp
+
+<para>And the /etc/inetd.conf line is:
+
+<programlisting>
+    kamanda dgram udp wait root /usr/local/libexec/amanda/amandad amandad -auth=krb4
+</programlisting>
+</para>
+
+<para>Note that you're running this as root, rather than as your dump user. AMANDA will set its uid down to the dump user at times it doesn't need to read the srvtab file, and give up root permissions entirely before it goes off and runs dump. Alternately you can change your srvtab files to be readable by user amanda.</para>
+
+<para>The following dumptype options apply to krb4:
+
+<programlisting>
+auth "krb4"    # use krb4 auth for this host
+               # (you can mingle krb hosts and bsd .rhosts in one conf)
+kencrypt       # encrypt this filesystem over the net using the krb4
+               # session key.  About 2x slower.  Good for those root
+               # partitions containing your keyfiles.  Don't want to
+               # give away the keys to an ethernet sniffer!
+               # This is currently always enabled.  There is no
+               # way to disable it.  This is a bug.
+</programlisting>
+</para>
+</refsect2>
+
+<refsect2><title>KERBEROS v5</title>
+<para>Kerberos 5 uses TCP and the server uses only one TCP port and data streams are multiplexed to this port.</para>
+
+The <emphasis remap='B'>krb5</emphasis> driver script defaults to:
+
+/*
+ * The lifetime of our tickets in minutes.
+ */
+#define AMANDA_TKT_LIFETIME     (12*60)
+
+/*
+ * The name of the service in /etc/services.
+ */
+#define AMANDA_KRB5_SERVICE_NAME        "k5amanda"
+
+You can currently only override these by editing the source code.
+
+The kerberized AMANDA service uses a different port on the client hosts. The /etc/services line is:
+
+   k5amanda      10082/tcp
+
+<para>And the /etc/inetd.conf line is:
+
+<programlisting>
+   k5amanda stream tcp nowait root /usr/local/libexec/amanda/amandad amandad -auth=krb5
+</programlisting>
+</para>
+
+<para>Note that you're running this as root, rather than as your dump user.  AMANDA will set its UID down to the dump user at times it doesn't need to read the keytab file, and give up root permissions entirely before it goes off and runs dump.  Alternately you can change your keytab files to be readable by user amanda. You should understand the security implications of this before changing the permissions on the keytab.</para>
+
+<para>The following dumptype options apply to <emphasis remap='B'>krb5</emphasis>:
+
+<programlisting>
+   auth "krb5"    # use krb5 auth for this host
+                  # (you can mingle krb hosts and bsd .rhosts in one conf)
+</programlisting>
+</para>
+
+<para>The principal and keytab files that Amanda uses must be set in the amanda.conf file for kerberos 5 dumps to work. You can hardcode this in the source code if you really want to (common-src/krb5-security.c)
+
+<programlisting>
+   krb5keytab
+   krb5principal
+</programlisting>
+</para>
+
+<para>For example:
+
+<programlisting>
+   krb5keytab    "/etc/krb5.keytab-amanda"
+   krb5principal  "amanda/saidin.omniscient.com"
+</programlisting>
+</para>
+
+<para>The principal in the second option must be contained in the first. The keytab should be readable by the amanda user (and definitely not world readable!) and is (obviously) on the server.  In MIT's kadmin, the following:
+
+<programlisting>
+   addprinc -randkey amanda/saidin.omniscient.com
+   ktadd -k /etc/krb5.keytab-amanda amanda/saidin.omniscient.com
+</programlisting>
+</para>
+
+<para>will do the trick. You will obviously want to change the principal name to reflect something appropriate for the conventions at your site.</para>
+
+<para>You must also configure each client to allow the amanda principal in for dumps.</para>
+
+<para>There are several ways to go about authorizing a server to connect to a client.</para>
+
+<para>The normal way is via a .k5amandausers file or a .k5login file in the client user's home directory. The determination of which file to use is based on the way you ran configure on AMANDA. By default, AMANDA will use .k5amandahosts, but if you configured with --without-amandahosts, AMANDA will use .k5login. (similar to the default for .rhosts/.amandahosts-style security). The .k5login file syntax is a superset of the default <emphasis remap='B'>krb5</emphasis> .k5login. The routines to check it are implemented in amanda rather than using krb5_kuserok because the connections are actually gssapi based.</para>
+
+<para>This .k5amandahosts/.k5login is a hybrid of the .amandahosts and a .k5login file. You can just list principal names, as in a .k5login file and the principal will be permitted in from any host. If you do NOT specify a realm, then there is no attempt to validate the realm (this is only really a concern if you have cross-realm authentication set up with another realm or something else that allows you multiple realms in your kdc. If you do specify a realm, only that principal@realm will be permitted to connect.</para>
+
+<para>You may prepend this with a hostname and whitespace, and only that principal (with optional realm as above) will be permitted to access from that hostname.</para>
+
+<para>Here are examples of valid entries in the .k5amandahosts:
+
+<programlisting>
+   service/amanda
+   service/amanda@TEST.COM
+   dumpmaster.test.com service/amanda
+   dumpmaster.test.com service/amanda@TEST.COM
+</programlisting>
+</para>
+
+<para>Rather than using a .k5amandahosts or .k5login file, the easiest way is to use a principal named after the destination user, (such as amanda@TEST.COM in our example) and not have either a .k5amandahosts or .k5login file in the destination user's home directory.</para>
+
+<para>There is no attempt to verify the realm in this case (only a concern if you have cross-realm authentication setup).</para>
+</refsect2>
+</refsect1>
+
+<refsect1><title>LOCAL COMMUNICATION</title>
+<para>The Amanda server communicates with the client internally versus over the network, ie. the client is also the server.</para>
+<para>This is the only method that requires no authentication as it is clearly not needed.</para>
+</refsect1>
+
+<refsect1><title>RSH COMMUNICATION AND AUTHENTICATION</title>
+For more detail, see http://wiki.zmanda.com/index.php/Configuring_rsh_authentication.
+
+<para>The Amanda server communicates with its client as the Amanda user via the RSH protocol.</para>
+
+<para>Please note that RSH protocol itself is insecure and should be used with caution especially on any servers and clients with public IPs.</para>
+
+<para>Each Amanda client communicates with the server using one TCP port and all data streams from the client are multiplexed over one port. The number of Amanda clients is limited by the number of reserved ports available on the Amanda server. Some versions of RSH do not use reserved ports and, thus, this restriction is not valid.</para>
+
+<para>General information including compilation is given above (see <emphasis remap='B'>COMPILATION AND GENERAL INFORMATION</emphasis> above).</para>
+
+<para>In addition to specifying the <emphasis remap='I'>auth</emphasis> field in dumptype definition, it might be required to specify <emphasis remap='I'>client_username</emphasis> and &amandad; fields. If the backup user name is different on the Amanda client, the user name is specified as <emphasis remap='B'>client_username</emphasis>. If the location of the Amanda daemon &amandad; is different on the Amanda client, the location is specified as <emphasis remap='I'>amandad_path</emphasis> field value.
+
+<programlisting>
+For example:
+define dumptype rsh_example {
+         ...
+         auth "rsh"
+         client_username "amandabackup"
+         amandad_path "/usr/lib/exec/amandad"
+         ...
+}
+</programlisting>
+</para>
+</refsect1>
+
+<refsect1><title>SSH COMMUNICATION AND AUTHENTICATION</title>
+For more detail, see http://wiki.zmanda.com/index.php/How_To:Set_up_transport_encryption_with_SSH.
+
+Amanda client sends data to the server using SSH. SSH keys have to be set up so that Amanda server can communicate with its clients using SSH.
+
+General information including compilation is given above (see <emphasis remap='B'>COMPILATION AND GENERAL INFORMATION</emphasis> above).
+
+SSH provides transport encryption and authentication. To set up an SSH authentication session, Amanda will run the equivalent of the following to start the backup process.
+
+<emphasis remap='B'>   /path/to/ssh -l <emphasis remap='I'>user_name</emphasis> client.zmanda.com $libexecdir/amandad</emphasis>
+
+To use SSH, you need to set up SSH keys either by storing the passphrase in cleartext, using ssh-agent, or using no passphrase at all.  All of these options have security implications which should be carefully considered before adoption.
+
+When you use a public key on the client to do data encryption (see http://wiki.zmanda.com/index.php/How_To:Set_up_data_encryption), you can lock away the private key in a secure place. Both, transport and storage will be encrypted with such a setup. See http://wiki.zmanda.com/index.php/Encryption for an overview of encryption options.
+
+Enable SSH authentication and set the ssh_keys option in all DLEs for that host by adding the following to the DLE itself or to the corresponding dumptype in amanda.conf:
+
+  auth "ssh"
+  ssh_keys "/home/amandabackup/.ssh/id_rsa_amdump"
+
+<emphasis remap='I'>ssh_keys</emphasis> is the path to the private key on the client. If the username to which Amanda should connect is different from the default, then you should also add
+
+  client_username "otherusername"
+
+If your server &amandad; path and client &amandad; path are different, you should also add
+
+  amandad_path "/client/amandad/path"
+
+<para>For a marginal increase in security, prepend the keys used for AMANDA in the clients' authorized_keys file with the following:
+
+<programlisting>
+  from="amanda_server.your.domain.com",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,command="/absolute/path/to/amandad -auth=ssh amdump"
+</programlisting>
+</para>
+
+<para>This will limit that key to connect only from Amanda server and only be able to execute &amandad;(8).</para>
+
+<para>In the same way, prepend the key used for AMANDA in the server's authorized_keys file with:
+
+<programlisting>
+  from="amanda_client.your.domain.com",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,command="/absolute/path/to/amandad -auth=ssh amindexd amidxtaped"
+</programlisting>
+</para>
+
+<para>You can omit the from=.. option if you have too many clients to list, although this has obvious security implications.</para>
+
+<para>Set ssh_keys and any other necessary options in /etc/amanda/amanda_client.conf:
+
+<programlisting>
+  auth "ssh"
+  ssh_keys "/root/.ssh/id_rsa_amrecover"
+  client_username "amanda"
+  amandad_path "/server/amandad/path"
+</programlisting>
+</para>
+
+<para>Besides user keys, SSH uses host keys to uniquely identify each host, to prevent one host from impersonating another. Unfortunately, the only easy way to set up these host keys is to make a connection and tell SSH that you trust the identity:
+
+<programlisting>
+  $ ssh client1.zmanda.com
+  The authenticity of host 'client1.zmanda.com (192.168.10.1)' can't be established.
+  RSA key fingerprint is 26:4e:df:a2:be:c8:cb:20:1c:68:8b:cc:c0:3b:8e:9d.
+  Are you sure you want to continue connecting (yes/no)?yes
+</programlisting>
+</para>
+
+<para>As Amanda will not answer this question itself, you must manually make every connection (server to client and client to server) that you expect Amanda to make. Note that you must use the same username that Amanda will use (that is, ssh client and ssh client.domain.com are distinct).</para>
+</refsect1>
+
+<refsect1><title>SEE ALSO</title>
+<para>
+&amconf;,
+&amclientconf;,
+&disklist;,
+&amdump;(8),
+&amrecover;(8)
+<ulink url="http://wiki.zmanda.com"/>
+</para>
+</refsect1>
+
+</refentry>
diff --git a/man/xml-source/amanda-changers.7.xml b/man/xml-source/amanda-changers.7.xml
new file mode 100644 (file)
index 0000000..4d68e2c
--- /dev/null
@@ -0,0 +1,232 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"
+[
+  <!-- entities files to use -->
+  <!ENTITY % global_entities SYSTEM '../entities/global.entities'>
+  %global_entities;
+]>
+
+<refentry id='amanda-changers.7'>
+
+<refmeta>
+<refentrytitle>amanda-changers</refentrytitle>
+<manvolnum>7</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.7;
+</refmeta>
+<refnamediv>
+<refname>amanda-changers</refname>
+<refpurpose>Configuring and Using Amanda Changers</refpurpose>
+</refnamediv>
+<refentryinfo>
+&author.dustin;
+</refentryinfo>
+<!-- body begins here -->
+
+<refsect1><title>DESCRIPTION</title>
+
+<para>Amanda uses changers to arbitrate access to devices
+(<citerefentry><refentrytitle>amanda-devices</refentrytitle><manvolnum>7</manvolnum></citerefentry>)
+and data volumes.  Changers provide an abstraction of tape robots, but are used
+to manage non-tape media, too.  Amanda communicates with changers through the
+Changer API.  This manpage contains a <emphasis>user-level</emphasis> overview
+of the API, and does not address details that are only of concern to
+developers.  For that purpose, consult the Amanda source code and
+http://wiki.zmanda.com.</para>
+
+</refsect1>
+
+<refsect1><title>TRANSITION</title>
+
+<para>The Amanda Changer API is in transition from version 1.0 - driven by
+shell scripts invoked for each changer operation - to version 2.0, composed of
+perl objects that can manage parallel access to multiple devices and other
+complexity.  When this transition is complete, Amanda devices will, in general,
+be specified via a changer, which will provide the necessary device specifier
+to access a requested volume.  In the interim, support for the "new" changer
+syntax is limited to the experimental
+<citerefentry><refentrytitle>amvault</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
+
+</refsect1>
+
+<refsect1><title>SPECIFYING CHANGERS</title>
+
+<para>Changer specifications are strings like
+<computeroutput>chg-disk:/my/vtapes</computeroutput>.  The
+<computeroutput>chg-</computeroutput> prefix serves to differentiate changers
+from devices (see
+<citerefentry><refentrytitle>amanda-devices</refentrytitle><manvolnum>7</manvolnum></citerefentry>).
+The next portion (<computeroutput>disk</computeroutput>, in this case)
+identifies the particular changer driver to use, and everything that follows
+the <computeroutput>:</computeroutput> is interpreted by the driver.</para>
+
+<para>A name which does not match this pattern, but which matches an old
+changer script (e.g., <computeroutput>chg-zd-mtx</computeroutput>), invokes the
+backward-compatibility changer driver as
+<computeroutput>chg-compat:chg-zd-mtx</computeroutput>.  If the name does not
+match an old changer, then it is treated as an Amanda device, and is wrapped by
+the single-device changer, e.g.,
+<computeroutput>chg-single:tape:/dev/rmt/0</computeroutput>.</para>
+
+<para>Changers which require additional parameters can also be described in &amconf; with "changer" sections, for example,
+<programlisting>
+define changer hp-robot {
+    tapedev "chg-robot:/dev/sg1"
+    property "drives" "0=/dev/nst0;1=/dev/nst0"
+    property "slots" "1-10"
+}
+</programlisting>
+
+(note that "chg-robot" is not yet implemented, so this is hypothetical).  A
+changer defininition creates a changer "alias", in this case named
+<emphasis>hp-robot</emphasis>, which can then be named where an application
+expects a changer - for example, the target of the <command>amvault</command> command.</para>
+</refsect1>
+
+<refsect1><title>CHANGER DRIVERS</title>
+
+<para>This section lists the changer drivers included with Amanda, and basic instructions for using them.  For complete How-To information, consult the Amanda wiki at http://wiki.zmanda.com.</para>
+
+<refsect2><title>chg-disk (new)</title>
+<programlisting>
+tpchanger "chg-disk:/u01/vtapes"
+</programlisting>
+
+<para>This changer driver replaces the old <command>chg-disk</command>,
+supporting parallel access to vtapes stored in directories named
+<computeroutput>slotN</computeroutput> in the directory specified after
+<computeroutput>chg-disk:</computeroutput>.  It does so by creating numbered
+"drives" so that simultaneous processes can access distinct slots.</para>
+
+</refsect2>
+
+<refsect2><title>chg-disk (old)</title>
+<programlisting>
+tapedev "file:/u01/vtapes"
+tpchanger "chg-disk"
+</programlisting>
+
+<para>This changer script supports sequential access to vtapes stored in
+directories named <computeroutput>slotN</computeroutput> in the directory
+specified by the <emphasis>tapedev</emphasis> parameter.</para>
+
+</refsect2>
+
+<refsect2><title>chg-multi</title>
+<programlisting>
+tpchanger "chg-multi"
+changerfile "chg-multi-state"
+</programlisting>
+
+<para>This script simply round-robins a number of distinct device names, as
+specified in its configuration file.  It is useful when all volumes for a
+configuration have different device names -- for example, with S3 devices.
+The <emphasis>changerfile</emphasis> need not exist; it is used as a prefix
+for filenames of state files.
+</para>
+
+</refsect2>
+
+<refsect2><title>chg-manual</title>
+<programlisting>
+tpchanger "chg-manual"
+changerfile "chg-manual.conf"
+</programlisting>
+
+<para>This script simply provides distinct device names in a round-robin
+fashion, as specified in its configuration file.  It is useful when all volumes
+for a configuration have different device names -- for example, with S3
+devices.  The configuration file parameters are (as listed in the script):
+<programlisting>
+resend_mail=900       # resend mail every __ seconds
+timeout_mail=604800   # time out after this many seconds (default 7 days)
+request="[type]"      # How to request a new tape (default "tty_email")
+  request="tty"       # Use the tty to ask the user to change tape.
+                      # Can't be use by cron
+  request="email"     # Send an email to ask the user to change tape.
+  request="tty_email" # Use the tty if it exist or send an email.
+</programlisting>
+</para>
+
+</refsect2>
+
+<refsect2><title>chg-zd-mtx</title>
+<programlisting>
+tpchanger "chg-zd-mtx"
+changerdev "/dev/sg0"         # used with 'mtx -f'
+changerfile "chg-zd-mtx.conf"
+tapedev "tape:/dev/nst0"
+</programlisting>
+
+<para>This script interfaces with a tape drive using the Zubkoff/Dandelion
+version of mtx.  That's the version that takes a device specifier with the
+<command>-f</command> option and has subcommands like
+<command>status</command>.  The configuration file parameters are (as listed in
+the script itself):
+<programlisting>
+firstslot=?                 #### First storage slot (element)
+lastslot=?                  #### Last storage slot (element)
+cleanslot=-1                #### Slot with cleaner tape -- default is "-1"
+                            #### Set negative to indicate no cleaner available
+driveslot=0                 #### Drive slot number.  Defaults to 0
+                            #### Use the 'Data Transfer Element' you want
+autoclean=0                 #### Set to '1' or greater to enable
+autocleancount=99           #### Number of access before a clean.
+havereader=0                #### If you have a barcode reader, set to 1.
+offline_before_unload=0     #### Does your robot require an
+                            #### 'mt offline' before mtx unload?
+poll_drive_ready=NN         #### Time (seconds) between tests to see if
+                            #### the tape drive has gone ready (default: 3).
+max_drive_wait=NN           #### Maximum time (seconds) to wait for the
+                            #### tape drive to become ready (default: 120).
+initial_poll_delay=NN       #### initial delay after load before polling for
+                            #### readiness
+slotinfofile=FILENAME       #### record slot information to this file, in
+                            #### the line-based format "SLOT LABEL\n"
+</programlisting>
+</para>
+
+</refsect2>
+
+<refsect2><title>chg-rait</title>
+<programlisting>
+tpchanger "chg-rait"
+changerfile "chg-rait.conf"
+</programlisting>
+
+<para>This changer script constructs RAIT devices out of the devices provided by several "sub-changers".  The configuration file specifies <computeroutput>nchangers</computeroutput>, the number of
+subchangers, and then provides <computeroutput>tpchanger</computeroutput>, <computeroutput>changerdev_N</computeroutput>, <computeroutput>changerfile_N</computeroutput>, and <computeroutput>tpchanger_N</computeroutput> for each sub-changer, 1 through N.</para>
+
+</refsect2>
+
+<refsect2><title>chg-null</title>
+<programlisting>
+tpchanger "chg-null"
+</programlisting>
+
+<para>This changer always provides the device "null:".  It is sometimes useful in conjunction with <command>chg-rait</command>.</para>
+
+</refsect2>
+
+<refsect2><title>Unmaintained Changers</title>
+
+<para>Amanda has many other changer scripts and programs beyond those described
+here (see the <computeroutput>changer-src/</computeroutput> in the source
+directory), but most of these scripts are unmaintained and undocumented, and
+will be removed when the new changer API is fully implemented.</para>
+
+</refsect2>
+
+</refsect1>
+
+<refsect1><title>SEE ALSO</title>
+<para>
+<citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+<citerefentry><refentrytitle>amanda.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+<citerefentry><refentrytitle>amanda-devices</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
+</para>
+
+</refsect1>
+</refentry>
index d11029190c6c43dae4835b0dd7e064350e15bd5b..10b2d921aaa9efde6a0532765556258a86c5c5cc 100644 (file)
 <refmeta>
 <refentrytitle>amanda-client.conf</refentrytitle>
 <manvolnum>5</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.5;
 </refmeta>
 <refnamediv>
 <refname>amanda-client.conf</refname>
 <refpurpose>Client configuration file for &A;, the Advanced Maryland Automatic Network Disk Archiver</refpurpose>
 </refnamediv>
+<refentryinfo>
+&author.jds;
+&author.sgw.xml;
+</refentryinfo>
 <!-- body begins here -->
 
 <refsect1><title>DESCRIPTION</title>
@@ -25,131 +32,34 @@ relevant sections and parameters of this file for quick reference.</para>
 <para> The files <emphasis remap='B'>&lt;CONFIG_DIR&gt;/amanda-client.conf</emphasis> and <emphasis remap='B'>&lt;CONFIG_DIR&gt;/&lt;config&gt;/amanda-client.conf</emphasis> are loaded.</para>
 </refsect1>
 
-<refsect1><title>PARAMETERS</title>
+<refsect1><title>SYNTAX</title>
 
-<para>There are a number of configuration parameters that control the
-behavior of the &A; programs.
-All have default values,
-so you need not specify the parameter in
-<emphasis remap='B'>amanda-client.conf</emphasis>
-if the default is suitable.</para>
+The syntax of &amclientconf; is identical to that for
+<citerefentry><refentrytitle>amanda.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
 
-<para>Lines starting with # are ignored, as are blank lines.
-Comments may be placed on a line with a directive by starting
-the comment with a #.
-The remainder of the line is ignored.</para>
-
-<para>Keywords are case insensitive, i.e.
-<emphasis remap='B'>auth</emphasis>
-and
-<emphasis remap='B'>Auth</emphasis>
-are treated the same.</para>
-
-<para>Integer arguments may have one of the following (case insensitive) suffixes,
-some of which have a multiplier effect:</para>
+</refsect1>
 
-<refsect2><title>POSSIBLE SUFFIXES</title>
+<refsect1>
+<title>GLOBAL PARAMETERS</title>
 
 <variablelist remap='TP'>
   <varlistentry>
-  <term><emphasis remap='B'>b byte bytes</emphasis></term>
-  <listitem>
-<para>Some number of bytes.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>bps</emphasis></term>
-  <listitem>
-<para>Some number of bytes per second.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>k kb kbyte kbytes kilobyte kilobytes</emphasis></term>
-  <listitem>
-<para>Some number of kilobytes (bytes*1024).</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>kps kbps</emphasis></term>
-  <listitem>
-<para>Some number of kilobytes per second (bytes*1024).</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>m mb meg mbyte mbytes megabyte megabytes</emphasis></term>
-  <listitem>
-<para>Some number of megabytes (bytes*1024*1024).</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>mps mbps</emphasis></term>
-  <listitem>
-<para>Some number of megabytes per second (bytes*1024*1024).</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>g gb gbyte gbytes gigabyte gigabytes</emphasis></term>
-  <listitem>
-<para>Some number of gigabytes (bytes*1024*1024*1024).</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>tape tapes</emphasis></term>
-  <listitem>
-<para>Some number of tapes.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>day days</emphasis></term>
-  <listitem>
-<para>Some number of days.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>week weeks</emphasis></term>
+  <term><emphasis remap='B'>conf</emphasis> <emphasis remap='I'> string</emphasis></term>
   <listitem>
-<para>Some number of weeks (days*7).</para>
-
-<note><para>The value
-<emphasis remap='B'>inf</emphasis>
-may be used in most places where an integer is expected
-to mean an infinite amount.</para>
-
-<para>Boolean arguments may have any of the values
-<emphasis remap='B'>y</emphasis>,
-<emphasis remap='B'>yes</emphasis>,
-<emphasis remap='B'>t</emphasis>,
-<emphasis remap='B'>true</emphasis>
-or
-<emphasis remap='B'>on</emphasis>
-to indicate a true state, or
-<emphasis remap='B'>n</emphasis>,
-<emphasis remap='B'>no</emphasis>,
-<emphasis remap='B'>f</emphasis>,
-<emphasis remap='B'>false</emphasis>
-or
-<emphasis remap='B'>off</emphasis>
-to indicate a false state.
-If no argument is given,
-<emphasis remap='B'>true</emphasis>
-is assumed.
-</para>
-</note>
+<para>Default:
+<emphasis remap='I'>Set by configure</emphasis>.
+The conf use by amrecover.</para>
   </listitem>
   </varlistentry>
-</variablelist>
-</refsect2>
 
-<refsect2>
-<title>PARAMETERS</title>
-
-<variablelist remap='TP'>
   <varlistentry>
-  <term><emphasis remap='B'>conf</emphasis> <emphasis remap='I'> string</emphasis></term>
+  <term><emphasis remap='B'>client_username</emphasis> <emphasis remap='I'> string</emphasis></term>
   <listitem>
 <para>Default:
-<emphasis remap='I'>Set by configure</emphasis>.
-The conf use by amrecover.</para>
+<emphasis remap='I'>CLIENT_LOGIN</emphasis>.
+Similar to the parameter of the same name in &amconf;, this specifies the username that
+&amrecover; should send when connecting to the server.  It should match the username
+specified in &amandahosts; on the server.</para>
   </listitem>
   </varlistentry>
 
@@ -224,6 +134,13 @@ The directory where gnutar keep its state file.</para>
   </listitem>
   </varlistentry>
 
+  <varlistentry>
+  <term><emphasis remap='B'>mailer</emphasis> <emphasis remap='I'> string</emphasis></term>
+  <listitem>
+<para>Default found by configure. A mail program that can send mail with '<emphasis remap='I'>MAILER -s "subject" user &lt; message_file</emphasis>'.</para>
+  </listitem>
+  </varlistentry>
+
   <varlistentry>
   <term><emphasis remap='B'>amandates</emphasis> <emphasis remap='I'> string</emphasis></term>
   <listitem>
@@ -377,13 +294,228 @@ Unreserved tcp port that will be used (bsd, bsdudp)</para>
   </listitem>
   </varlistentry>
 
+  <varlistentry>
+  <term><emphasis remap='B'>property</emphasis> "name" "value"</term>
+  <listitem>
+<para>Adds a global property for this client host, useful for e.g., Application API plugins.</para>
+  </listitem>
+  </varlistentry>
+
+</variablelist>
+</refsect1>
+
+<refsect1><title>APPLICATION SECTION</title>
+<para>The
+<emphasis remap='B'>amanda.conf</emphasis>
+file may define multiple types of application.
+The information is entered in a <emphasis remap='B'>application-tool</emphasis>
+section, which looks like this:</para>
+
+<programlisting>
+define application-tool "<emphasis remap='I'>name</emphasis>" {
+    <emphasis remap='I'>application-option</emphasis> <emphasis remap='I'>appli
+cation-value</emphasis>
+    <literal>...</literal>
+}
+</programlisting>
+
+<para><emphasis remap='I'>name</emphasis>
+is the name of this type of application. It is referenced from the
+<emphasis remap='I'>dumptype</emphasis></para>
+
+<para>The application-tool options and values are:</para>
+<variablelist remap='TP'>
+  <varlistentry>
+  <term><emphasis remap='B'>comment</emphasis> <emphasis remap='I'>string</emphasis></term>
+  <listitem>
+<para>Default:
+<emphasis remap='I'>none</emphasis>.
+A comment string describing this application.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><emphasis remap='B'>plugin</emphasis> <emphasis remap='I'>string</emphasis></term>
+  <listitem>
+<para>No default. Must be set to the name of the program. This program must be
+in the <emphasis remap='I'>$libexecdir/amanda/application</emphasis> directory
+on the client.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><emphasis remap='B'>property</emphasis> [append] [priority] <emphasis remap='I'>string</emphasis> <emphasis remap='I'>string</emphasis>+</term>
+  <listitem>
+<para>No default. You can set property for the application, each application have a different set of property. Both strings are quoted; the first string contains the name of
+the property to set, and the others contains its values.
+<emphasis remap='B'>append</emphasis> keyword append the values to the list of values for that property.
+<emphasis remap='B'>priority</emphasis> keyword disallow the setting of that property on the server.
+</para>
+  </listitem>
+  </varlistentry>
 </variablelist>
-</refsect2>
 </refsect1>
 
-<refsect1><title>AUTHOR</title>
-<para>James da Silva, &email.jds;: Original text</para>
-<para>&maintainer.sgw;: XML-conversion, major update, splitting</para>
+<refsect1><title>SCRIPT SECTION</title>
+<para>The
+<emphasis remap='B'>amanda.conf</emphasis>
+file may define multiple types of script.
+The information is entered in a <emphasis remap='B'>script-tool</emphasis>
+section, which looks like this:</para>
+
+<programlisting>
+define script-tool "<emphasis remap='I'>name</emphasis>" {
+    <emphasis remap='I'>script-option</emphasis> <emphasis remap='I'>script-value</emphasis>
+    <literal>...</literal>
+}
+</programlisting>
+
+<para><emphasis remap='I'>name</emphasis>
+is the name of this type of script. It is referenced from the
+<emphasis remap='I'>dumptype</emphasis></para>
+
+<para>The script-tool options and values are:</para>
+<variablelist remap='TP'>
+  <varlistentry>
+  <term><emphasis remap='B'>comment</emphasis> <emphasis remap='I'>string</emphasis></term>
+  <listitem>
+<para>Default:
+<emphasis remap='I'>none</emphasis>.
+A comment string describing this script.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><emphasis remap='B'>plugin</emphasis> <emphasis remap='I'>string</emphasis></term>
+  <listitem>
+<para>No default. Must be set to the name of the program. This program must be in the <emphasis remap='I'>$libdir/amanda/application</emphasis> directory on the client and/or server.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><emphasis remap='B'>execute_where</emphasis> [client|server]</term>
+  <listitem>
+<para>Default: <emphasis remap='I'>client</emphasis>. Where the script must be executed, on the client or server. Only <emphasis remap='I'>client</emphasis> is valid.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><emphasis remap='B'>execute_on</emphasis> <emphasis remap='I'>execute_on</emphasis>[,<emphasis remap='I'>execute_on</emphasis>]*</term>
+  <listitem>
+<para>No default. When the script must be executed, you can specify many of them:</para>
+    <!-- .RS -->
+    <variablelist remap='TP'>
+      <varlistentry>
+      <term><emphasis remap='B'>pre-dle-amcheck</emphasis></term>
+      <listitem>
+<para>Execute before the amcheck command for the dle.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>pre-host-amcheck</emphasis></term>
+      <listitem>
+<para>Execute before the amcheck command for all dle for the client.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>post-dle-amcheck</emphasis></term>
+      <listitem>
+<para>Execute after the amcheck command for the dle.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>post-host-amcheck</emphasis></term>
+      <listitem>
+<para>Execute after the amcheck command for all dle for the client.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>pre-dle-estimate</emphasis></term>
+      <listitem>
+<para>Execute before the estimate command for the dle.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>pre-host-estimate</emphasis></term>
+      <listitem>
+<para>Execute before the estimate command for all dle for the client.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>post-dle-estimate</emphasis></term>
+      <listitem>
+<para>Execute after the estimate command for the dle.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>post-host-estimate</emphasis></term>
+      <listitem>
+<para>Execute after the estimate command for all dle for the client.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>pre-dle-backup</emphasis></term>
+      <listitem>
+<para>Execute before the backup command for the dle.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>pre-host-backup</emphasis></term>
+      <listitem>
+<para>Execute before the backup command for all dle for the client.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>post-dle-backup</emphasis></term>
+      <listitem>
+<para>Execute after the backup command for the dle.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>post-host-backup</emphasis></term>
+      <listitem>
+<para>Execute after the backup command for all dle for the client.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>pre-recover</emphasis></term>
+      <listitem>
+<para>Execute before any level is recovered.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>post-recover</emphasis></term>
+      <listitem>
+<para>Execute after all levels are recovered.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>pre-level-recover</emphasis></term>
+      <listitem>
+<para>Execute before each level recovery.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>post-level-recover</emphasis></term>
+      <listitem>
+<para>Execute after each level recovery.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>inter-level-recover</emphasis></term>
+      <listitem>
+<para>Execute between two levels of recovery.</para>
+      </listitem>
+      </varlistentry>
+    </variablelist>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><emphasis remap='B'>property</emphasis> [append] [priority] <emphasis remap='I'>string</emphasis> <emphasis remap='I'>string</emphasis>+</term>
+  <listitem>
+<para>No default. You can set property for the script, each script have a different set of property. Both strings are quoted; the first string contains the name of
+the property to set, and the others contains its values.
+<emphasis remap='B'>append</emphasis> keyword append the values to the list of values for that property.
+<emphasis remap='B'>priority</emphasis> keyword disallow the setting of that property on the server.
+</para>
+  </listitem>
+  </varlistentry>
+</variablelist>
 </refsect1>
 
 <refsect1><title>SEE ALSO</title>
diff --git a/man/xml-source/amanda-devices.7.xml b/man/xml-source/amanda-devices.7.xml
new file mode 100644 (file)
index 0000000..852f75f
--- /dev/null
@@ -0,0 +1,466 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"
+[
+  <!-- entities files to use -->
+  <!ENTITY % global_entities SYSTEM '../entities/global.entities'>
+  %global_entities;
+]>
+
+<refentry id='amanda-devices.7'>
+
+<refmeta>
+<refentrytitle>amanda-devices</refentrytitle>
+<manvolnum>7</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.7;
+</refmeta>
+<refnamediv>
+<refname>amanda-devices</refname>
+<refpurpose>Configuring and Using Amanda Devices</refpurpose>
+</refnamediv>
+<refentryinfo>
+&author.ian;
+&author.dustin;
+</refentryinfo>
+<!-- body begins here -->
+
+<refsect1><title>DESCRIPTION</title>
+
+<para>The Device API specifies a generic interface between Amanda and storage
+devices such as tapes or disks.  This manual page describes the device
+drivers included with Amanda.</para>
+
+<para>This is a <emphasis>user-level</emphasis> description of the API, and
+does not address details that are only of concern to developers.  For that
+purpose, consult the Amanda source code and http://wiki.zmanda.com.</para>
+
+<para>The term "device driver" describes the software that can communicate with
+some kind of backend storage, e.g., a tape driver.  A "device" is the
+  storage element itself, usually a piece of hardware. When discussing
+  a device and its driver as a unit, the term  "device" is sometimes
+  also used to refer to the combination of device and driver.</para>
+
+
+</refsect1>
+
+<refsect1><title>SPECIFYING DEVICES</title>
+
+<para>Device names take the form <emphasis>TYPE:NODE</emphasis>, where <emphasis>TYPE</emphasis> selects a device driver, and <emphasis>NODE</emphasis> provides further information to that driver.  The syntax for each device driver is given in the corresponding section below.</para>
+
+<para>Devices are described in &amconf; with "device" sections, e.g.,
+<programlisting>
+define device top_drive {
+    tapedev "tape:/dev/nst0"
+    device_property "BLOCK_SIZE" "131072"
+}
+</programlisting>
+A device defininition creates a device "alias", in this case named <emphasis>top_drive</emphasis>, which can then be named in the global <emphasis>tapedev</emphasis> parameter:
+<programlisting>
+tapedev "top_drive"
+</programlisting>
+</para>
+
+<para>The global <emphasis>tapedev</emphasis> parameter can also specify a literal device name.  For example,
+<programlisting>
+tapedev "file:/amdisks"
+</programlisting>
+is equivalent to
+<programlisting>
+tapedev "default"
+define device default {
+    tapedev "file:/amdisks"
+}
+</programlisting>
+Device properties specified outside of any device definition apply to all devices.  This syntax is provided mainly for backward compatibility, and for simple Amanda configurations.  Note that there is no way to provide properties specific to a device without defining a device alias.</para>
+
+<para>See <citerefentry><refentrytitle>amanda.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+for more information on Amanda configuration.</para>
+
+</refsect1>
+
+<refsect1><title>DEVICES</title>
+
+<para>This section lists the device drivers included with Amanda, and basic instructions for using them.  For complete How-To information, consult the Amanda wiki at http://wiki.zmanda.com.</para>
+
+<refsect2><title>Null Device</title>
+<programlisting>
+tapedev "null:"
+</programlisting>
+
+<para>The null device driver only supports writing, and discards all data.  It is
+generally only useful for testing purposes.</para>
+
+</refsect2>
+
+<refsect2><title>RAIT Device</title>
+<programlisting>
+tapedev "rait:tape:/dev/rmt/tps0d{4,5,6}n"
+</programlisting>
+
+<para>The RAIT device driver mirrors or stripes data over multiple "child" devices.
+The child devices are specified using a shell-like syntax, where alternatives
+are enclosed in braces and separated by commas.</para>
+
+<para>With two child devices, the RAIT device driver mirrors data such that the
+two devices contain identical data and can be used singly for
+  recovery.  With more than two devices, the RAIT device "stripes"
+  data across all but one device and writes a parity block to the
+  final device, usable for data recovery in the event of a device or
+  volume failure.  The RAIT device scales its blocksize as necessary
+  to match the number of children that will be used to store data.</para>
+
+<para>When a child device is known to have failed, the RAIT device should be reconfigured to replace that device with the text "ERROR", e.g.,
+<programlisting>
+tapedev "rait:{tape:/dev/st0,ERROR,tape:/dev/st2}"
+</programlisting>
+This will cause the RAIT device to start up in degraded mode, reconstructing the data from the missing device.
+</para>
+
+<para>Like ordinary RAID drivers, the RAIT device driver can automatically
+enter degraded mode when one of its child devices fails.  However, the RAIT
+device cannot automatically recover from any write error nor write any data in
+degraded mode.  When reading, certain errors may be fatal (rather than causing
+degraded mode).  And in any case, labels on all volumes must initially match
+(labeled or otherwise).  If you have lost one volume from a set, explicitly
+start the device in degraded mode as described above.</para>
+
+<refsect3><title>Child Device Block Sizes</title>
+
+<para>The RAIT device driver requires that all of its child devices use the
+same block size.  If no block sizes are specified, the driver selects the block
+size closest to 32k that is within the MIN_BLOCK_SIZE - MAX_BLOCK_SIZE range of
+all child devices, and calculates its own blocksize according to the formula
+<emphasis>rait_blocksize = child_blocksize * (num_children - 1)</emphasis>.  If
+a block size is specified for the RAIT device, then it calculates its child
+block sizes according to the formula <emphasis>child_blocksize = rait_blocksize
+/ (num_children - 1)</emphasis>.  Either way, it sets the BLOCK_SIZE property
+of each child device accordingly.</para>
+
+</refsect3>
+
+</refsect2>
+
+<refsect2><title>S3 Device</title>
+<programlisting>
+tapedev "s3:foocorp-backups/DailySet1-"
+device_property "S3_ACCESS_KEY" "MYACCESSKEY"
+device_property "S3_SECRET_KEY" "MYSECRETKEY"
+</programlisting>
+
+<para>The S3 device driver uploads data to the Amazon S3 "storage cloud".  Its
+device name is a slash-sparated combination of bucket name and prefix:
+"s3:BUCKET/PREFIX".  Since buckets must be unique across all Amazon S3 users,
+and since the number of buckets allowed to each user is limited, the driver can
+store multiple Amanda volumes in a single S3 bucket, distinguished by prefix.
+The prefix and slash can be omitted if they are not needed: "s3:BUCKET".</para>
+
+<para>The access and secret keys used to authenticate to Amazon S3 are provided
+as properties.</para>
+
+<para>The S3 device driver stores each block in a distinct S3 object.  Due to
+high HTTP overhead for each request, use of larger than normal block
+  sizes (&gt; 1 megabyte) is reccomended with the S3 device.</para>
+
+<para>You can control where your data is physically stored by Amazon S3 using 
+a location constraint. Setting this affects can affect both billing and legal 
+concerns, so you are encouraged to consult Amazon's documentation for details.
+</para>
+
+<para>
+To control location constraints, set the S3_BUCKET_LOCATION property.
+Currently, there are two valid settings: "" (any location) and "EU" (Europe).
+If the S3_BUCKET_LOCATION is set, Amanda will check to make sure that the 
+setting agrees with the constraint currently on the bucket.
+</para>
+
+</refsect2>
+
+<refsect2><title>Tape Device</title>
+<programlisting>
+tapedev "tape:/dev/nst0"
+</programlisting>
+
+<para>The tape device driver interacts with a tape drive.  The device uses the
+operating system's built-in tape support, which is generally similar to that
+available via the command-line utilities dd(1) and mt(1).</para>
+
+<para>The tape device name should specify a path to the operating system's
+device file.</para>
+
+</refsect2>
+
+<refsect2><title>VFS Device</title>
+<programlisting>
+tapedev "file:/path/to/vtape"
+</programlisting>
+
+<para>The VFS device driver stores data on a UNIX filesystem. Note
+  that although one typically uses the VFS device driver to store data
+  on hard disks, the driver does not interface with any hardware on a
+  block level.</para>
+
+<para>The device name specifies a path to a directory which must exist and
+contain a "data/" subdirectory.  Each tape file is stored as a distinct file in
+this directory, the name of which reflects the Amanda header in the tape file.
+Block boundaries are not maintained: the driver supports reads of arbitrary
+size, regardless of the blocksize used to write the data.</para>
+
+</refsect2>
+
+</refsect1>
+
+<refsect1><title>PROPERTIES</title>
+
+<para>Device drivers use <emphasis>properties</emphasis> as a generic means to
+interact with other parts of Amanda.  Some properties are set by the device
+driver and used by Amanda to determine how its devices should be used.  Other
+properties can be set by Amanda or by the user to influence the driver's
+behavior. Properties are set for a particular device, so that if you have two
+tape devices, they will not share property values.</para>
+
+<para>Properties are specified in <emphasis>amanda.conf</emphasis> with the
+<emphasis>device-property</emphasis> parameter.  The syntax looks like this:
+<programlisting>
+device_property "FROBNICATOR_PATH" "/var/frobd/state"
+device_property "BYTES_PER_FORTNIGHT" "128k"
+device_property "USE_QUBITS" "no"
+</programlisting></para>
+
+<para>Both the property name and the property value are always quoted.  String
+values are given as simple strings, like FROBNICATOR_PATH in the example above.
+Integer values can be specified with any of the suffixes given in the "VALUE
+SUFFIXES" section of &amconf;, like BYTES_PER_FORTNIGHT, above.  Boolean values
+can be specified as any of "true", "yes", "1", "0", "no", "false", like
+USE_QUBITS, above.  Some properties have special formats, as described
+below.</para>
+
+<para>Some properties are set based on other configuration values, such as
+tapetype parameters.  These special cases are detailed under the appropriate
+property, below.</para>
+
+<para>The order in which device properties are set is as follows:
+<orderedlist>
+<listitem><para>Tapetype parameters (including length, blocksize, and readblocksize) are translated into device properties and set accordingly.</para></listitem>
+<listitem><para>Device properties from any device_property
+    configuration parameters are set, in the order they appear in the
+    configuration file.</para>
+</listitem>
+</orderedlist></para>
+
+<para>Properties described as read-only are not accessible to users.  They are
+listed here for completeness.</para>
+
+<refsect2><title>COMMON PROPERTIES</title>
+
+<para>Note that some of these properties are currently unused, and present only
+for future expansion.  Not all devices implement all of these properties.</para>
+
+<!-- PLEASE KEEP THIS LIST IN ALPHABETICAL ORDER -->
+
+<variablelist>
+ <!-- ==== -->
+ <varlistentry><term>APPENDABLE</term><listitem>
+ (read-only) This boolean property indicates whether this device supports appending data to volumes.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>BLOCK_SIZE</term><listitem>
+ (read-write) This property gives the block size, in bytes, that will be used to write to the device.  The usual suffixes ("kbytes", etc.) are allowed.  The tapetype parameter <emphasis>blocksize</emphasis> sets this property.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>CANONICAL_NAME</term><listitem>
+ (read-only) This property contains the full canonical name for this device.  This name may not be the same as the user-supplied name, but is a valid name by which to access this device.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>COMPRESSION</term><listitem>
+ (read-write) This boolean property represents the compression status of the device, and can be used to enable and disable such compression.  This applies mostly to tape devices, although many tape devices do not support setting compression from software.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>COMPRESSION_RATE</term><listitem>
+ (read-only) This property gives the compression rate, as a decimal ratio.  It may be a measured value over some unspecified period or a simple estimate.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>CONCURRENCY</term><listitem>
+ (read-only) This property indicates the level of concurrent access that this device supports.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>FREE_SPACE</term><listitem>
+ (read-only) This property gives the amount of free space available on the current volume, if known.  This is often an estimate; for example, tape devices can only estimate the amount of tape left on a spool.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>MAX_BLOCK_SIZE</term><listitem>
+ (read-only) This property gives the maximum block size this device can support.  See BLOCK SIZES, below.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>MEDIUM_ACCESS_TYPE</term><listitem>
+ (read-only) This property gives the type of the media in the device: read only, WORM (Write Once, Read Many), read/write, or write only.  Write-only devices do not support recovery, but the data are not necessarily thrown out.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>MIN_BLOCK_SIZE</term><listitem>
+ (read-write) This property gives the minimum block size this device can support.  See BLOCK SIZES, below.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>MAX_VOLUME_USAGE</term><listitem>
+ (read-write) On devices that support it, this property will limit the total amount of data written to a volume; attempts to write beyond this point will cause the device to simulate "out of space."  Zero means no limit.  The tapetype parameter <emphasis>length</emphasis> sets this property.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>PARTIAL_DELETION</term><listitem>
+ (read-only) This property indicates whether the device supports deletion of specific files.  Aside from linear tapes, most devices can support this feature.  It is currently unused by Amanda.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>STREAMING</term><listitem>
+ (read-only) This property gives the streaming requirement for this device.  For example, tape drives often require a steady supply of data to avoid shoe-shining, while disk devices have no such requirement.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>VERBOSE</term><listitem>
+ (read-write) If this boolean property is set, then the device will produce verbose debugging output.  This property is not recognized by all devices.
+</listitem></varlistentry>
+ <!-- ==== -->
+</variablelist>
+
+<refsect3><title>BLOCK SIZES</title>
+
+<para>Amanda writes device data in blocks. On most devices the block
+boundaries are embedded in the media along with the data itself, so subsequent
+reads must use the same block sizes.  On tape devices, the block size is
+dictated by the capabilities of the hardware -- buffer sizes, physical format,
+and so on.</para>
+
+<para>Amanda has historically supported a single, fixed block size -- usually
+32k.  The Device API adds the ability to specify a block size at runtime, using
+the BLOCK_SIZE property.  Devices provide MIN_BLOCK_SIZE and MAX_BLOCK_SIZE as
+a guide to the range of acceptable block sizes. Note that this does not imply
+that all sizes in the range MIN_BLOCK_SIZE - MAX_BLOCK_SIZE are available --
+the device may require that block sizes are even multiples of some power of
+two, for example.  Consult the documentation for your hardware and operating
+system for more information.</para>
+
+<para>Most devices are flexible enough to read a volume using a different block
+size than that with which it was written.  This can be useful when handling old
+volumes written with a smaller blocksize, or volumes of unknown blocksize.
+Unfortunately, some tape devices do not detect oversized blocks correctly, and
+may lose data if the configured block size is smaller than the volume's block
+size.  The tape device driver has a READ_BUFFER_SIZE property which specifies
+the minimum buffer size that will be allocated for reads from tape.  If the
+hardware supports it, setting this property allows Amanda to correctly read
+from tapes written with any blocksize less than or equal to READ_BUFFER
+SIZE.</para>
+
+<note><para>The RAIT device does not support flexible block sizes, as its
+parity algorithm requires that all child devices have the same, fixed block
+size.</para></note>
+
+</refsect3>
+
+</refsect2>
+
+<refsect2><title>DRIVER-SPECIFIC PROPERTIES</title>
+
+<refsect3><title>S3 Device</title>
+
+<!-- PLEASE KEEP THIS LIST IN ALPHABETICAL ORDER -->
+<variablelist>
+ <!-- ==== -->
+ <varlistentry><term>S3_ACCESS_KEY</term><listitem>
+ (read-write) This property gives the Amazon S3 access key used to access the service.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>S3_BUCKET_LOCATION</term><listitem>
+ (read-write) Location constraint for buckets on Amazon S3.
+Currently, it can be set to "", for no constraint (i.e. store data in the US), 
+or "EU" (i.e. store data in the EU).
+See Amazon's documentation for details and latest information
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>S3_SECRET_KEY</term><listitem>
+ (read-write) This property gives the Amazon S3 secret key used to access the service.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>S3_SSL</term><listitem>
+ (read-write) Whether or not to use SSL/TLS to secure communications with Amazon S3.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>S3_USER_TOKEN</term><listitem>
+ (read-write) This property specifies the user token for Amanda Enterprise Edition customers.
+</listitem></varlistentry>
+ <!-- ==== -->
+</variablelist>
+
+<para>Most Amanda devices work just fine without any properties, but not the S3
+device.  A typical S3 configuration will have an access key and secret key
+specified:
+
+<programlisting>
+device_property "S3_ACCESS_KEY" "27D3B8C6C4E7AA423C2B37C72A0D22C8"
+device_property "S3_SECRET_KEY" "agphc2Q7Zmxragphc2RmO2xragpzZGY7a2xqCgr"
+</programlisting></para>
+
+</refsect3>
+
+<refsect3><title>Tape Device</title>
+
+<para>Most of these properties are automatically detected, but can be
+overridden in the configuration file if the autodetection fails. Note that tape
+drives are required to at least support the MTREW (rewind) operation; all other
+operations can be emulated with the MTREW and read data operations.</para>
+
+<!-- PLEASE KEEP THIS LIST IN ALPHABETICAL ORDER -->
+<variablelist>
+ <!-- ==== -->
+ <varlistentry><term>BROKEN_GMT_ONLINE</term><listitem>
+ (read-write) Set this boolean property if the system's GMT_ONLINE macro gives incorrect results.  This is currently true for the Linux IDE-TAPE driver.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>BSF</term><listitem>
+ (read-write) This boolean property specifies whether the device
+ driver may execute the MTBSF operation (backward seek file).
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>BSF_AFTER_EOM</term><listitem>
+ (read-write) This boolean property specifies whether the device
+ driver should execute an MTBSF (backward seek file) operation after
+ MTEOM (seek to end of recorded data) in order to append.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>BSR</term><listitem>
+ (read-write) This boolean property specifies whether the device
+ driver may use the MTBSR operation (backward seek record).
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>EOM</term><listitem>
+ (read-write) This boolean property specifies whether the device
+ driver may use the MTEOM command (seek to end of recorded data).
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>FINAL_FILEMARKS</term><listitem>
+ (read-write) This integer property gives the number of filemarks that should be written at EOD.  It is usually 1 or 2.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>FSF</term><listitem>
+ (read-write) This boolean property specifies whether the device driver may use the MTFSF operation (forward seek file).
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>FSR</term><listitem>
+ (read-write) This boolean property specifies whether the device driver may use the MTFSR operation (forward seek record).
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>READ_BUFFER_SIZE</term><listitem>
+ (read-write) This property specifies the minimum buffer size that will be used for reads; this should be large enough to contain any block that may be read from the device, and must be larger than BLOCK_SIZE.  This property exists for tape devices which cannot determine the size of on-tape blocks, or which may discard data which overflows a small buffer.  The tapetype parameter <emphasis>READBLOCKSIZE</emphasis> sets this property.  See BLOCK SIZES, above.
+</listitem></varlistentry>
+ <!-- ==== -->
+</variablelist>
+
+</refsect3>
+
+</refsect2>
+
+</refsect1>
+
+<refsect1><title>SEE ALSO</title>
+<para>
+<citerefentry><refentrytitle>amanda.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+</para>
+
+</refsect1>
+</refentry>
diff --git a/man/xml-source/amanda-scripts.7.xml b/man/xml-source/amanda-scripts.7.xml
new file mode 100644 (file)
index 0000000..43aa973
--- /dev/null
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"
+[
+  <!-- entities files to use -->
+  <!ENTITY % global_entities SYSTEM '../entities/global.entities'>
+  %global_entities;
+]>
+
+<refentry id='amanda-scripts.7'>
+
+<refmeta>
+<refentrytitle>amanda-scripts</refentrytitle>
+<manvolnum>7</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.7;
+</refmeta>
+<refnamediv>
+<refname>amanda-scripts</refname>
+<refpurpose>Configuring and using the Script API</refpurpose>
+</refnamediv>
+<refentryinfo>
+&author.jlm;
+&author.dustin;
+</refentryinfo>
+<!-- body begins here -->
+
+<refsect1><title>DESCRIPTION</title>
+
+<para>The Script API is a flexible system for invoking user-supplied scripts at
+various points in the execution of Amanda.  This manual page describes the
+operation and configuration of the API.  For help writing Script API scripts,
+see http://wiki.zmanda.com/index.php/Script_API.</para>
+
+</refsect1>
+
+<refsect1><title>SCRIPTS</title>
+
+<para>This section lists the scripts included with &A;, see the individual man page for instructions on using them.  For complete How-To information, consult the Amanda wiki at http://wiki.zmanda.com.</para>
+
+<itemizedlist>
+<listitem>
+<citerefentry><refentrytitle>amzfs-snapshot</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+- create/destroy zfs snapshot.
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>script-email</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+- send email.
+</listitem>
+</itemizedlist>
+
+</refsect1>
+
+<refsect1><title>SEE ALSO</title>
+<para>
+<citerefentry><refentrytitle>amanda.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+</para>
+
+</refsect1>
+</refentry>
index 383e35a98263b1ad65951a8043453f0219772690..96d548eecfe074f6d51828d55c8657a68f2dd9f6 100644 (file)
 <refmeta>
 <refentrytitle>amanda</refentrytitle>
 <manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
 </refmeta>
 <refnamediv>
 <refname>amanda</refname>
-<refpurpose>Advanced Maryland Automatic Network Disk Archiver</refpurpose>
+<refpurpose>The Open Source Backup Platform</refpurpose>
 </refnamediv>
+<refentryinfo>
+&author.jds;
+&author.sgw.xml;
+</refentryinfo>
 <!-- body begins here -->
-<refsynopsisdiv>
-
-<cmdsynopsis>
-    <command>amadmin</command>
-    <arg choice='plain'><replaceable>config</replaceable></arg>
-    <arg choice='plain'><replaceable>command</replaceable></arg>
-    <arg choice='opt'><replaceable>options</replaceable></arg>
-    <sbr/>
-</cmdsynopsis>
-
-<cmdsynopsis>
-    <command>amcheck</command>
-    <arg choice='opt'><replaceable>options</replaceable></arg>
-    <arg choice='plain'><replaceable>config</replaceable></arg>
-    <sbr/>
-</cmdsynopsis>
-
-<cmdsynopsis>
-    <command>amcheckdb</command>
-    <arg choice='plain'><replaceable>config</replaceable></arg>
-    <sbr/>
-</cmdsynopsis>
-
-
-<cmdsynopsis>
-    <command>amcleanup</command>
-    <arg choice='plain'><replaceable>config</replaceable></arg>
-    <sbr/>
-</cmdsynopsis>
-
-<cmdsynopsis>
-    <command>amcrypt</command>
-    <sbr/>
-</cmdsynopsis>
-
-<cmdsynopsis>
-  <command>amdd</command>    
-    <arg choice='opt'><replaceable>options</replaceable></arg>
-</cmdsynopsis>
-
-<cmdsynopsis>
-  <command>amdump</command>    
-    <arg choice='plain'><replaceable>config</replaceable></arg>
-    <sbr/>
-</cmdsynopsis>
-
-<cmdsynopsis>
-    <command>amaespipe</command>
-    <sbr/>
-</cmdsynopsis>
-
-<cmdsynopsis>
-  <command>amflush</command>    
-    <arg choice='opt'>-f </arg>
-    <arg choice='plain'><replaceable>config</replaceable></arg>
-    <sbr/>
-</cmdsynopsis>
-
-<cmdsynopsis>
-    <command>amgetconf</command>
-    <arg choice='opt'><replaceable>config</replaceable></arg>
-    <arg choice='plain'><replaceable>parameter</replaceable></arg>
-    <sbr/>
-</cmdsynopsis>
-
-<cmdsynopsis>
-    <command>amlabel</command>
-    <arg choice='plain'><replaceable>config</replaceable></arg>
-    <arg choice='plain'><replaceable>label</replaceable></arg>
-    <arg choice='opt'><arg choice='plain'><replaceable>slot</replaceable></arg><arg choice='plain'><replaceable>slot</replaceable></arg></arg>
-    <sbr/>
-</cmdsynopsis>
-
-<cmdsynopsis>
-  <command>ammt</command>    
-    <arg choice='opt'><replaceable>options</replaceable></arg>
-</cmdsynopsis>
-
-<cmdsynopsis>
-    <command>amoverview</command>
-    <arg choice='plain'><replaceable>config</replaceable></arg>
-    <arg choice='opt'><replaceable>options</replaceable></arg>
-    <sbr/>
-</cmdsynopsis>
-
-<cmdsynopsis>
-    <command>amplot</command>
-    <arg choice='opt'><replaceable>options</replaceable></arg>
-    <arg choice='plain'><replaceable>amdump-files</replaceable></arg>
-    <sbr/>
-</cmdsynopsis>
-
-<cmdsynopsis>
-    <command>amrecover</command>
-    <arg choice='opt'><replaceable>config</replaceable></arg>
-    <arg choice='opt'><replaceable>options</replaceable></arg>
-    <sbr/>
-</cmdsynopsis>
-
-<cmdsynopsis>
-    <command>amreport</command>
-    <arg choice='opt'><replaceable>config</replaceable></arg>
-    <arg choice='opt'><replaceable>options</replaceable></arg>
-    <sbr/>
-</cmdsynopsis>
-
-<cmdsynopsis>
-    <command>amrestore</command>
-    <arg choice='opt'><replaceable>options</replaceable></arg>
-    <arg choice='plain'><replaceable>tapedevice</replaceable></arg>
-    <arg choice='opt'><arg choice='plain'><replaceable>hostname</replaceable></arg><arg choice='opt'><replaceable>diskname</replaceable></arg></arg>
-    <sbr/>
-</cmdsynopsis>
-
-<cmdsynopsis>
-    <command>amfetchdump</command>
-    <arg choice='opt'><replaceable>options</replaceable></arg>
-    <arg choice='plain'><replaceable>config</replaceable></arg>
-    <arg choice='opt'><arg choice='plain'><replaceable>hostname</replaceable></arg><arg choice='opt'><arg choice='plain'><replaceable>diskname</replaceable></arg><arg choice='opt'><arg choice='plain'><replaceable>date</replaceable></arg><arg choice='opt'>level</arg></arg></arg></arg>
-</cmdsynopsis>
-
-<cmdsynopsis>
-    <command>amrmtape</command>
-    <arg choice='opt'><replaceable>options</replaceable></arg>
-    <arg choice='plain'><replaceable>config</replaceable></arg>
-    <arg choice='plain'><replaceable>label</replaceable></arg>
-    <sbr/>
-</cmdsynopsis>
-
-<cmdsynopsis>
-    <command>amstatus</command>
-    <arg choice='plain'><replaceable>config</replaceable></arg>
-    <arg choice='opt'><replaceable>options</replaceable></arg>
-    <sbr/>
-</cmdsynopsis>
-
-<cmdsynopsis>
-    <command>amtape</command>
-    <arg choice='plain'><replaceable>config</replaceable></arg>
-    <arg choice='plain'><replaceable>command</replaceable></arg>
-    <arg choice='opt'><replaceable>options</replaceable></arg>
-    <sbr/>
-</cmdsynopsis>
-
-<cmdsynopsis>
-  <command>amtapetype</command>    
-    <arg choice='opt'><replaceable>options</replaceable></arg>
-</cmdsynopsis>
-
-<cmdsynopsis>
-    <command>amtoc</command>
-    <arg choice='opt'><replaceable>options</replaceable></arg>
-    <arg choice='plain'><replaceable>logfile</replaceable></arg>
-    <sbr/>
-</cmdsynopsis>
-
-<cmdsynopsis>
-    <command>amcheckdump</command>
-    <arg choice='opt'><replaceable>options</replaceable></arg>
-    <arg choice='plain'><replaceable>config</replaceable></arg>
-    <sbr/>
-</cmdsynopsis>
-
-<cmdsynopsis>
-    <command>amserverconfig</command>
-    <arg choice='opt'><replaceable>options</replaceable></arg>
-    <arg choice='plain'><replaceable>config</replaceable></arg>
-    <sbr/>
-</cmdsynopsis>
-
-<cmdsynopsis>
-    <command>amaddclient</command>
-    <arg choice='plain'><replaceable>config</replaceable></arg>
-    <arg choice='opt'><replaceable>options</replaceable></arg>
-    <sbr/>
-</cmdsynopsis>
-</refsynopsisdiv>
-
 
 <refsect1><title>DESCRIPTION</title>
-<para>&A; is the 
-&quot;Advanced Maryland Automatic Network Disk Archiver&quot;.
-This manual page gives an overview of the &A; commands and
+<para>This manual page gives an overview of the &A; commands and
 configuration files for quick reference.</para>
 
-<para>Here are all the &A; commands.
-Each one has its own manual page.
-See them for all the gory details.</para>
-<variablelist remap='TP'>
-  <varlistentry>
-  <term><emphasis remap='B'>amdump</emphasis></term>
-  <listitem>
-<para>Take care of automatic &A; backups.
-This is normally executed by
-<emphasis remap='B'>cron</emphasis>
-on a computer called the
-<emphasis remap='I'>tape server host</emphasis>
-and requests backups of file systems located on
-<emphasis remap='I'>backup</emphasis>
-<emphasis remap='I'>clients</emphasis>.
-<emphasis remap='B'>Amdump</emphasis>
-backs up all disks in the
-<emphasis remap='I'>disklist</emphasis>
-file (discussed below) to tape or, if there is a problem, to a special
-<emphasis remap='I'>holding</emphasis>
-<emphasis remap='I'>disk</emphasis>.
-After all backups are done,
-<command>amdump</command>
-sends mail reporting failures and successes.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>amflush</emphasis></term>
-  <listitem>
-<para>Flush backups from the holding disk to tape.
-<emphasis remap='B'>Amflush</emphasis>
-is used after
-<command>amdump</command>
-has reported it could not write backups to tape for some reason.
-When this happens, backups stay in the holding disk.
-Run <emphasis remap='B'>amflush</emphasis> after the tape problem is corrected
-to write backups from the holding disk to tape.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>amcleanup</emphasis></term>
-  <listitem>
-<para>Clean up after an interrupted
-<command>amdump</command>.
-This command is only needed if
-<command>amdump</command>
-was unable to complete for some reason, usually because the
-tape server host crashed while
-<command>amdump</command>
-was running.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>amrecover</emphasis></term>
-  <listitem>
-<para>Provides an interactive interface to browse the &A; index files
-(backup image catalogues)
-and select which tapes to recover files from.
-It can also run
-<emphasis remap='B'>amrestore</emphasis>
-and a restore program (e.g.
-<emphasis remap='B'>tar</emphasis>)
-to actually recover the files.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>amrestore</emphasis></term>
-  <listitem>
-<para>Read an &A; tape, searching for requested backups.
-<emphasis remap='B'>Amrestore</emphasis>
-is suitable for everything from interactive restores of single files
-to a full restore of all partitions on a failed disk.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>amfetchdump</emphasis></term>
-  <listitem>
-<para>Performs &A; tape restoration, similar to <emphasis
-  remap='B'>amrestore</emphasis>. Additional capabilities include
-  "hands-off" searching of multiple tapes, automatic
-  retrieval of specific dump files based on dump logs, and assembly of
-  tape-spanning split dump files.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>amlabel</emphasis></term>
-  <listitem>
-<para>Write an &A; format label onto a tape.
-All &A; tapes must be labeled with
-<emphasis remap='B'>amlabel</emphasis>.
-<emphasis remap='B'>Amdump</emphasis>
-and
-<emphasis remap='B'>amflush</emphasis>
-will not write to an unlabeled tape (see TAPE MANAGEMENT below).</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>amcheck</emphasis></term>
-  <listitem>
-<para>Verify the correct tape is mounted and all file systems on all backup client systems
-are ready to be backed up. Often run by
-<emphasis remap='B'>cron</emphasis>
-before
-<command>amdump</command>
-to generate a mail warning that backups might fail
-unless corrective action is taken.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>amadmin</emphasis></term>
-  <listitem>
-<para>Take care of administrative tasks like finding out which
-tapes are needed to restore a filesystem,
-forcing hosts to do full backups of selected disks
-and looking at schedule balance information.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>amtape</emphasis></term>
-  <listitem>
-<para>Take care of tape changer control operations like loading particular tapes,
-ejecting tapes and scanning the tape storage slots.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>amcheckdump</emphasis></term>
-  <listitem>
-<para>Check the results of an &A; dump.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>amserverconfig</emphasis></term>
-  <listitem>
-<para>Program to setup initial &A; configuration.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>amaddclient</emphasis></term>
-  <listitem>
-<para>Program to add client to an existing &A; configuration.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>amrmtape</emphasis></term>
-  <listitem>
-<para>Delete a tape from the &A; databases.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>amstatus</emphasis></term>
-  <listitem>
-<para>Report the status of a running or completed
-<command>amdump</command>.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>amoverview</emphasis></term>
-  <listitem>
-<para>Display a chart of hosts and file systems backed up every run.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>amplot</emphasis></term>
-  <listitem>
-<para>Generate utilization plots of &A; runs for performance tuning.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>amreport</emphasis></term>
-  <listitem>
-<para>Generate an &A; summary E-mail report.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>amtoc</emphasis></term>
-  <listitem>
-<para>Generate table of content files for &A; tapes.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>amcheckdb</emphasis></term>
-  <listitem>
-<para>Verify every tape &A; knows about is consistent in the database.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>amgetconf</emphasis></term>
-  <listitem>
-<para>Look up parameters in the &A; configuration file.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>amtapetype</emphasis></term>
-  <listitem>
-<para>Generate a tapetype definition.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>amaespipe</emphasis></term>
-  <listitem>
-<para>Wrapper program from aespipe (data encryption utility)</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>amcrypt</emphasis></term>
-  <listitem>
-<para>Reference encryption program for Amanda symmetric data encryption</para>
-  </listitem>
-  </varlistentry>
-</variablelist>
+<!--
+ - NOTE: the comma after each citerefentry works around a bug in the docbook-to-man conversion; using &nbsp;
+ - causes problems in the docbook-to-html conversion.
+-->
+
+<refsect2><title>COMMANDS</title> <!-- a.k.a. any section 8 manpage -->
+<para>Here are all the &A; commands.  Each one has its own manual page.  See them for all the gory details.</para>
+<itemizedlist>
+<listitem>
+<citerefentry><refentrytitle>amaddclient</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amadmin</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amaespipe</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amcheck</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amcheckdb</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amcheckdump</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amcleanup</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amcrypt-ossl-asym</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amcrypt-ossl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amcrypt</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amcryptsimple</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amdd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amdevcheck</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amdump</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amfetchdump</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amflush</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amgetconf</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amgpgcrypt</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amgtar</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amlabel</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>ammt</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amoverview</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amplot</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amrecover</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amreport</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amrestore</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amrmtape</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amsamba</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amserverconfig</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amservice</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amstar</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amstatus</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amtape</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amtapetype</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amtoc</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amvault</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amzfs-sendrecv</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amzfs-snapshot</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>script-email</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+</listitem>
+</itemizedlist>
+</refsect2>
+<refsect2><title>CONFIGURATION FILES</title> <!-- a.k.a. most section 5 manpages -->
+<itemizedlist>
+<listitem>
+<citerefentry><refentrytitle>amanda.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amanda-client.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>disklist</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>tapelist</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+</listitem>
+</itemizedlist>
+</refsect2>
+<refsect2><title>DATA FORMATS</title> <!-- a.k.a. section 5 manpages about internal data formats -->
+<itemizedlist>
+<listitem>
+<citerefentry><refentrytitle>amanda-archive-format</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+</listitem>
+</itemizedlist>
+</refsect2>
+<refsect2><title>CONCEPTS</title> <!-- a.k.a. any section 7 manpage -->
+<itemizedlist>
+<listitem>
+<citerefentry><refentrytitle>amanda-applications</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amanda-auth</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amanda-changers</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amanda-devices</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
+</listitem>
+<listitem>
+<citerefentry><refentrytitle>amanda-scripts</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
+</listitem>
+</itemizedlist>
+</refsect2>
 </refsect1>
 
 <refsect1><title>CONFIGURATION</title>
-<para>There are three user-editable files that control the behavior of &A;.
+<para>There are four user-editable files that control the behavior of &A;.
 </para>
 <para>
-The first is
-<emphasis remap='B'>amanda.conf</emphasis>,
-the main configuration file.
-It contains parameters to customize &A; for the site.
-Refer to the 
-<citerefentry><refentrytitle>amanda.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
-manpage for details on &A; configuration parameters.
+The first two are &amconf; and &amclientconf;,
+the main configuration files for the server and client, respectively.
+They contain parameters to customize &A; for the site.
 </para>
 <para>
-Second is the
-<emphasis remap='I'>disklist</emphasis>
-file, which lists hosts and disk partitions to back up.
+Next is the &disklist; file, which lists hosts and disk partitions to back up.
 </para>
 <para>
-Third is the
-<emphasis remap='I'>tapelist</emphasis>
+Last is the seldom-edited &tapelist;
 file, which lists tapes that are currently active.
 These files are described in more detail in the following sections.</para>
 
 <para>All files are stored in individual configuration
-directories under <filename>/usr/local/etc/amanda/</filename>.
+directories, usually under <filename>/etc/amanda/</filename>.
 A site will often have more than
 one configuration.
 For example, it might have a
@@ -449,15 +228,17 @@ configuration for everyday backups and an
 <emphasis remap='I'>archive</emphasis>
 configuration for infrequent full archival backups.
 The configuration files would be stored under directories
-<filename>/usr/local/etc/amanda/normal/</filename> and
-<filename>/usr/local/etc/amanda/archive/</filename>, respectively.
+<filename>/etc/amanda/normal/</filename> and
+<filename>/etc/amanda/archive/</filename>, respectively.
 Part of the job of an &A; administrator is to create,
 populate and maintain these directories.</para>
+</refsect1>
 
+<refsect1><title>LOG FILES</title>
 <para>All log and database files generated by &A; go in corresponding
 directories somewhere.
 The exact location is controlled by entries in
-<emphasis remap='B'>amanda.conf</emphasis>.
+<citerefentry><refentrytitle>amanda.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
 A typical location would be under <filename>/var/adm/amanda</filename>.
 For the above example, the files might go in
 <filename>/var/adm/amanda/normal/</filename> and
@@ -469,7 +250,7 @@ For the above example, the files might go in
 
 <para>Detailed information about
 <command>amdump</command>
-runs are stored in files named
+runs are stored in dump logs -- files named
 <emphasis remap='B'>amdump.</emphasis><emphasis remap='I'>NN</emphasis>
 where
 <emphasis remap='I'>NN</emphasis>
@@ -482,12 +263,13 @@ worth of them.</para>
 
 <para>The file used by
 <emphasis remap='B'>amreport</emphasis>
-to generate the mail summary is named
-<emphasis remap='B'>log.</emphasis><emphasis remap='I'>YYYYMMDD.NN</emphasis>
+to generate the mail summary is the trace log.  This file constitutes the "catalog"
+describing the data on the tapes written in a run.  It is named
+<emphasis remap='B'>log.</emphasis><emphasis remap='I'>YYYYMMDDHHMMSS.NN</emphasis>
 where
-<emphasis remap='I'>YYYYMMDD</emphasis>
+<emphasis remap='I'>YYYYMMDDHHMMSS</emphasis>
 is the datestamp of the start of the
-<command>amdump</command>
+<command>amdump</command> or <command>amflush</command>
 run and
 <emphasis remap='I'>NN</emphasis>
 is a sequence number started at 0.
@@ -510,425 +292,9 @@ are removed by
 at the end of each run.</para>
 </refsect1>
 
-<refsect1><title>DISKLIST FILE</title>
-<para>The
-<emphasis remap='I'>disklist</emphasis>
-file determines which disks will be backed up by &A;.
-The file usually contains one line per disk:</para>
-
-<programlisting>
-<emphasis>hostname diskname</emphasis> [<emphasis>diskdevice</emphasis>] <emphasis>dumptype</emphasis> [<emphasis>spindle</emphasis> [<emphasis>interface</emphasis>] ]
-</programlisting>
-
-<para>All pairs [ <emphasis>hostname diskname</emphasis> ] must be unique.</para>
-
-<para>Lines starting with # are ignored, as are blank lines.
-The fields have the following meanings:</para>
-<variablelist remap='TP'>
-  <varlistentry>
-  <term><emphasis remap='I'>hostname</emphasis></term>
-  <listitem>
-<para>The name of the host to be backed up.
-If
-<emphasis remap='B'>diskdevice</emphasis>
-refers to a PC share, this is the host &A; will run the Samba
-<emphasis remap='B'>smbclient</emphasis> program on to back up the share.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='I'>diskname</emphasis></term>
-  <listitem>
-<para>The name of the disk (a label).
-In most case, you set your
-<emphasis remap='B'>diskname</emphasis>
-to the
-<emphasis remap='B'>diskdevice</emphasis>
-and you don't set the
-<emphasis remap='B'>diskdevice.</emphasis>
-If you want multiple entries with the same
-<emphasis remap='B'>diskdevice</emphasis>,
-you must set a different
-<emphasis remap='B'>diskname</emphasis>
-for each entry. It's the
-<emphasis remap='B'>diskname</emphasis>
-that you use on the commandline for any &A; command.
-Look at the example/disklist file for example.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='I'>diskdevice</emphasis></term>
-  <listitem>
-<para>Default: same as diskname.
-The name of the disk device to be backed up. It may be a full device name,
-a device name without the
-<filename>/dev/</filename>
-prefix, e.g.
-<emphasis remap='I'>sd0a</emphasis>,
-or a mount point such as
-<filename>/usr</filename>.</para>
-
-<para>It may also refer to a PC share by starting the name with two (forward) slashes, e.g.
-<filename>//some-pc/home</filename>.
-In this case, the
-<emphasis remap='B'>program</emphasis>
-option in the associated
-<emphasis remap='B'>dumptype</emphasis>
-must be entered as
-<emphasis remap='B'>GNUTAR</emphasis>.
-It is the combination of the double slash disk name and
-<emphasis remap='B'>program GNUTAR</emphasis>
-in the
-<emphasis remap='B'>dumptype</emphasis>
-that triggers the use of Samba.</para>
-</listitem>
-</varlistentry>
-  
-  <varlistentry>
-  <term><emphasis remap='I'>dumptype</emphasis></term>
-  <listitem>
-<para>Refers to a
-<emphasis remap='B'>dumptype</emphasis>
-defined in the
-<emphasis remap='B'>amanda.conf</emphasis>
-file.
-<emphasis remap='I'>Dumptype</emphasis>s
-specify backup related parameters,
-such as whether to compress the backups,
-whether to record backup results in
-<filename>/etc/dumpdates</filename>, the disk's relative priority, etc.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='I'>spindle</emphasis></term>
-  <listitem>
-<para>Default:
-<option>-1</option>.
-A number used to balance backup load on a host.
-&A; will not run multiple backups at the same time
-on the same spindle, unless the spindle number is -1,
-which means there is no spindle restriction.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='I'>interface</emphasis></term>
-  <listitem>
-<para>Default:
-<emphasis remap='I'>local</emphasis>.
-The name of a network interface definition in the
-<emphasis remap='B'>amanda.conf</emphasis>
-file, used to balance network load.</para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-
-<para>Instead of naming a
-<emphasis remap='B'>dumptype</emphasis>,
-it is possible to define one in-line, enclosing
-<emphasis remap='B'>dumptype</emphasis>
-options within curly braces, one per line, just like a
-<emphasis remap='B'>dumptype</emphasis>
-definition in
-<emphasis remap='B'>amanda.conf</emphasis>.
-Since pre-existing
-<emphasis remap='B'>dumptype</emphasis>s
-are valid option names, this syntax may be used to customize
-<emphasis remap='B'>dumptype</emphasis>s
-for particular disks.</para>
-
-<para>A line break
-<emphasis remap='B'>must</emphasis>
-follow the left curly bracket.</para>
-
-<para>For instance, if a
-<emphasis remap='B'>dumptype</emphasis>
-named
-<emphasis remap='I'>normal</emphasis>
-is used for most disks, but use of the holding disk needs to be disabled
-for the file system that holds it, this would work instead of defining
-a new dumptype:</para>
-
-<programlisting>
-<emphasis remap='I'>hostname diskname</emphasis> [ <emphasis remap='I'>diskdevice</emphasis> ] {
-  normal
-  holdingdisk never
-} [ <emphasis remap='I'>spindle</emphasis> [ <emphasis remap='I'>interface</emphasis> ] ]
-</programlisting>
-
-</refsect1>
-
-<refsect1><title>TAPE MANAGEMENT</title>
-<para>The
-<emphasis remap='I'>tapelist</emphasis>
-file contains the list of tapes in active use.
-This file is maintained entirely by &A; and should not be created
-or edited during normal operation.
-It contains lines of the form:</para>
-
-<para><programlisting>YYYYMMDD label flags
-</programlisting></para>
-
-<para>Where
-<emphasis remap='I'>YYYYMMDD</emphasis>
-is the date the tape was written,
-<emphasis remap='I'>label</emphasis>
-is a label for the tape as written by
-<emphasis remap='B'>amlabel</emphasis>
-and
-<emphasis remap='I'>flags</emphasis>
-tell &A; whether the tape may be reused, etc (see the
-<emphasis remap='B'>reuse</emphasis>
-options of
-<emphasis remap='B'>amadmin</emphasis>).</para>
-
-<para><emphasis remap='B'>Amdump</emphasis>
-and
-<emphasis remap='B'>amflush</emphasis>
-will refuse to write to an unlabeled tape, or to a labeled tape that is considered active.
-There must be more tapes in active rotation (see the
-<emphasis remap='B'>tapecycle</emphasis>
-option) than there are runs in the backup cycle (see the
-<emphasis remap='B'>dumpcycle</emphasis>
-option) to prevent overwriting a backup image that would be needed to do a full recovery.</para>
-</refsect1>
-
-<refsect1 id='output_drivers'><title>OUTPUT DRIVERS</title>
-<para>The normal value for the
-<emphasis remap='B'>tapedev</emphasis>
-parameter, or for what a tape changer returns,
-is a full path name to a non-rewinding tape device, such as
-<filename>/dev/nst0</filename>
-or
-<filename>/dev/rmt/0mn</filename>
-or
-<filename>/dev/nst0.1</filename>
-or whatever conventions the operating system uses. &A; provides additional application level drivers that
-support non-traditional tape-simulations or features. To access a specific output driver, set
-<emphasis remap='B'>tapedev</emphasis>
-(or configure your changer to return) a string of the form
-<emphasis remap='I'>driver</emphasis>:<emphasis remap='I'>driver-info</emphasis>
-where
-<emphasis remap='I'>driver</emphasis>
-is one of the supported drivers and
-<emphasis remap='I'>driver-info</emphasis>
-is optional additional information needed by the driver.</para>
-
-<para>The supported drivers are:</para>
-<variablelist remap='TP'>
-  <varlistentry>
-  <term><emphasis remap='I'>tape</emphasis></term>
-  <listitem>
-<para>This is the default driver.
-The
-<emphasis remap='I'>driver-info</emphasis>
-is the tape device name.
-Entering
-<programlisting>tapedev /dev/rmt/0mn
-</programlisting>
-is really a short hand for
-<programlisting>tapedev tape:/dev/rmt/0mn
-</programlisting></para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='I'>null</emphasis></term>
-  <listitem>
-<para>This driver throws away anything written to it and returns EOF
-for any reads except a special case is made for reading a label,
-in which case a &quot;fake&quot; value is returned that &A; checks for
-and allows through regardless of what you have set in
-<emphasis remap='B'>labelstr</emphasis>.
-The
-<emphasis remap='I'>driver-info</emphasis>
-field is not used and may be left blank:</para>
-
-<para><programlisting>tapedev null:
-</programlisting></para>
-
-<para>The <emphasis remap='I'>length</emphasis>
-value from the associated
-<emphasis remap='B'>tapetype</emphasis>
-is used to limit the amount of data written. When the limit is reached, the driver will simulate end of tape.</para>
-
-<note><para>This driver should only be used for debugging and testing,
-and probably only with the
-<emphasis remap='B'>record</emphasis>
-option set to
-<emphasis remap='I'>no</emphasis>.
-</para>
-</note>
-  </listitem>
-  </varlistentry>
-
-  <varlistentry>
-  <term><emphasis remap='I'>rait</emphasis></term>
-  <listitem>
-<para><emphasis remap='I'>R</emphasis>edundant
-<emphasis remap='I'>A</emphasis>rray
-of
-<emphasis remap='I'>I</emphasis>nexpensive (?)
-<emphasis remap='I'>T</emphasis>apes.
-Reads and writes tapes mounted on multiple drives by spreading
-the data across N-1 drives and using the last drive for a checksum.
-See docs/RAIT for more information.</para>
-
-<para>The
-<emphasis remap='I'>driver-info</emphasis>
-field describes the devices to use. Curly braces indicate multiple replacements in the string.
-For instance:</para>
-
-<para><programlisting>tapedev rait:/dev/rmt/tps0d{4,5,6}n
-</programlisting></para>
-
-<para>would use the following devices:</para>
 
-<para><filename>/dev/rmt/tps0d4n</filename>
-<filename>/dev/rmt/tps0d5n</filename>
-<filename>/dev/rmt/tps0d6n</filename>
-</para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-<variablelist remap='TP'>
-  <varlistentry>
-  <term><emphasis remap='I'>file</emphasis></term>
-  <listitem>
-<para>This driver emulates a tape device with a set of files in a directory.
-The
-<emphasis remap='I'>driver-info</emphasis>
-field must be the name of an existing directory.
-The driver will test for a subdirectory of that named
-<emphasis remap='I'>data</emphasis>
-and return
-<emphasis remap='B'>offline</emphasis>
-until it is present.
-When present, the driver uses two files in the
-<emphasis remap='I'>data</emphasis>
-subdirectory for each tape file. One contains the actual data.
-The other contains record length information.</para>
-
-<para>The driver uses a file named
-<emphasis remap='I'>status</emphasis>
-in the
-<emphasis remap='B'>file</emphasis>
-device directory to hold driver status information, such as tape position.
-If not present, the driver will create it as though the device is rewound.</para>
-
-<para>The
-<emphasis remap='I'>length</emphasis>
-value from the associated
-<emphasis remap='B'>tapetype</emphasis>
-is used to limit the amount of data written.
-When the limit is reached, the driver will simulate end of tape.</para>
-
-<para>One way to use this driver with a real device such as a CD-writer is to
-create a directory for the
-<emphasis remap='B'>file</emphasis>
-device and one or more other directories for the actual data.
-Create a symlink named
-<emphasis remap='I'>data</emphasis>
-in the
-<emphasis remap='B'>file</emphasis>
-directory to one of the data directories.
-Set the
-<emphasis remap='B'>tapetype</emphasis>
-length to whatever the medium will hold.</para>
-
-<para>When &A; fills the
-<emphasis remap='B'>file</emphasis>
-device, remove the symlink and (optionally) create a new symlink to another
-data area.
-Use a CD writer software package to burn the image from the first data area.</para>
-
-<para>To read the CD, mount it and create the
-<emphasis remap='I'>data</emphasis>
-symlink in the
-<emphasis remap='B'>file</emphasis>
-device directory.</para>
-</listitem>
-</varlistentry>
-</variablelist>
-</refsect1>
-
-<refsect1><title>AUTHORIZATION</title>
-<para>&A; processes on the tape server host run as the
-<emphasis remap='B'>dumpuser</emphasis>
-user listed in
-<emphasis remap='B'>amanda.conf</emphasis>.
-When they connect to a backup client, they do so with an &A;-specific protocol.
-They do not, for instance, use
-<emphasis remap='B'>rsh</emphasis>
-or
-<emphasis remap='B'>ssh</emphasis>
-directly.</para>
-
-<para>On the client side, the
-<emphasis remap='B'>amandad</emphasis>
-daemon validates the connection using one of several methods,
-depending on how it was compiled and on options it is passed:</para>
-
-<variablelist remap='IP'>
-  <varlistentry>
-  <term>.rhosts</term>
-  <listitem>
-<para>Even though &A; does not use
-<emphasis remap='B'>rsh</emphasis>,
-it can use
-<markup>.rhosts</markup>-style
-authentication and a
-<markup>.rhosts</markup>
-file.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term>.amandahosts</term>
-  <listitem>
-<para>This is essentially the same as
-<markup>.rhosts</markup>
-authentication except a different file, with almost the same format, is used.
-This is the default mechanism built into &A;.</para>
-
-<para>The format of the
-<filename>.amandahosts</filename>
-file is:</para>
-
-<para><emphasis remap='I'>hostname</emphasis>
-[
-<emphasis remap='I'>username</emphasis>
-[
-<emphasis remap='I'>service</emphasis>
-]*]</para>
-
-<para>If
-<emphasis remap='I'>username</emphasis>
-is ommitted, it defaults to the user running
-<emphasis remap='B'>amandad</emphasis>,
-i.e. the user listed in the
-<emphasis remap='B'>inetd</emphasis>
-or
-<emphasis remap='B'>xinetd</emphasis>
-configuration file.</para>
-<para>The <emphasis remap='I'>service</emphasis> is a list of the service the client is authorized to execute:
-<emphasis remap='B'>amdump</emphasis>,
-<emphasis remap='B'>noop</emphasis>,
-<emphasis remap='B'>selfcheck</emphasis>,
-<emphasis remap='B'>sendsize</emphasis>,
-<emphasis remap='B'>sendbackup</emphasis>,
-<emphasis remap='B'>amindexd</emphasis>,
-<emphasis remap='B'>amidxtaped</emphasis>.
-<emphasis remap='B'>amdump</emphasis> is a shortcut for "noop selfcheck sendsize sendbackup"</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term>Kerberos</term>
-  <listitem>
-<para>&A; may use the Kerberos authentication system.
-Further information is in the
-<emphasis remap='B'>docs/KERBEROS</emphasis>
-<!-- TODO: edit link -->
-file that comes with an &A; distribution.</para>
-
-<para>For Samba access,
-&A; needs a file on the Samba server (which may
+<refsect1><title>Using Samba</title>
+<para>For Samba access, &A; needs a file on the Samba server (which may
 or may not also be the tape server) named
 <filename>/etc/amandapass</filename>
 with share names, (clear text) passwords and (optional) domain names,
@@ -945,14 +311,6 @@ For instance:</para>
 </programlisting>
 <para>With clear text passwords, this file should obviously be tightly protected.
 It only needs to be readable by the &A;-user on the Samba server.  </para>
-<para>You can find further information in the
-<emphasis remap='B'>docs/SAMBA</emphasis>
-<!-- TODO: edit link -->
-file that comes with an &A; distribution.</para>
-
-</listitem>
-</varlistentry>
-</variablelist>
 </refsect1>
 
 <refsect1><title>HOST &amp; DISK EXPRESSION</title>
@@ -969,172 +327,144 @@ succeeds if all words in your expression match contiguous words in
 the host or disk.</para>
 
 
-<informaltable frame="none">
-<tgroup cols="2" align="left">
-<tbody>
-
-<row>
-<entry>.  </entry>
-<entry>word separator for a host</entry>
-</row>
-
-<row>
-<entry>/</entry>
-<entry>word separator for a disk</entry>
-</row>
-
-<row>
-<entry>^</entry>
-<entry>anchor at left</entry>
-</row>
-
-<row>
-<entry>$</entry>
-<entry>anchor at right</entry>
-</row>
-
-<row>
-<entry>?</entry>
-<entry>match exactly one character except the separator</entry>
-</row>
-
-<row>
-<entry>*</entry>
-<entry>match zero or more characters except the separator</entry>
-</row>
+<variablelist remap='TP'>
 
-<row>
-<entry>**</entry>
-<entry>match zero or more characters including the separator</entry>
-</row>
+    <varlistentry>
+    <term>dot (.)</term> <!-- troff gets confused by a plain dot -->
+    <listitem><para>word separator for a host</para></listitem>
+    </varlistentry>
+
+    <varlistentry>
+    <term>/</term>
+    <listitem><para>word separator for a disk</para></listitem>
+    </varlistentry>
+
+    <varlistentry>
+    <term>^</term>
+    <listitem><para>anchor at left</para></listitem>
+    </varlistentry>
+
+    <varlistentry>
+    <term>$</term>
+    <listitem><para>anchor at right</para></listitem>
+    </varlistentry>
+
+    <varlistentry>
+    <term>?</term>
+    <listitem><para>match exactly one character except the separator</para></listitem>
+    </varlistentry>
+
+    <varlistentry>
+    <term>*</term>
+    <listitem><para>match zero or more characters except the separator</para></listitem>
+    </varlistentry>
+
+    <varlistentry>
+    <term>**</term>
+    <listitem><para>match zero or more characters including the separator</para></listitem>
+    </varlistentry>
 
-</tbody>
-</tgroup>
-</informaltable>
+</variablelist>
 
 <para>Some examples:</para>
 
-<informaltable frame="none">
-<tgroup cols="3" align="left">
-<tbody>
-
-<row>
-<entry>EXPRESSION  </entry>
-<entry>WILL MATCH</entry>
-<entry>WILL NOT MATCH</entry>
-</row>
-
-<row>
-<entry>hosta</entry>
-<entry>hosta</entry>
-<entry>hostb</entry>
-</row>
-
-<row>
-<entry></entry>
-<entry>hoSTA.dOMAIna.ORG</entry>
-<entry></entry>
-</row>
-
-<row>
-<entry></entry>
-<entry>foo.hosta.org</entry>
-<entry></entry>
-</row>
-
-<row>
-<entry>host</entry>
-<entry>host</entry>
-<entry>hosta</entry>
-</row>
-
-<row>
-<entry>host?</entry>
-<entry>hosta</entry>
-<entry>host</entry>
-</row>
-
-<row>
-<entry></entry>
-<entry>hostb</entry>
-<entry></entry>
-</row>
-
-<row>
-<entry>ho*na</entry>
-<entry>hoina</entry>
-<entry>ho.aina.org</entry>
-</row>
-
-<row>
-<entry>ho**na</entry>
-<entry>hoina</entry>
-<entry></entry>
-</row>
-
-<row>
-<entry></entry>
-<entry>ho.aina.org</entry>
-<entry></entry>
-</row>
-
-<row>
-<entry>^hosta</entry>
-<entry>hosta</entry>
-<entry>foo.hosta.org</entry>
-</row>
-
-<row>
-<entry>sda*</entry>
-<entry>/dev/sda1</entry>
-<entry></entry>
-</row>
-
-<row>
-<entry></entry>
-<entry>/dev/sda12</entry>
-<entry></entry>
-</row>
-
-<row>
-<entry>/opt</entry>
-<entry>opt (disk)</entry>
-<entry>opt (host)</entry>
-</row>
-
-<row>
-<entry>.opt.</entry>
-<entry>opt (host)</entry>
-<entry>opt (disk)</entry>
-</row>
-
-<row>
-<entry>/</entry>
-<entry>/</entry>
-<entry>any other disk</entry>
-</row>
-
-<row>
-<entry>/usr</entry>
-<entry>/usr</entry>
-<entry></entry>
-</row>
-
-<row>
-<entry></entry>
-<entry>/usr/opt</entry>
-<entry></entry>
-</row>
-
-<row>
-<entry>/usr$</entry>
-<entry>/usr</entry>
-<entry>/usr/opt</entry>
-</row>
-
-</tbody>
-</tgroup>
-</informaltable>
+<variablelist remap='TP'>
+    <varlistentry>
+    <term>hosta</term>
+    <listitem><para>
+    Will match <filename>hosta</filename>, <filename>foo.hosta.org</filename>, and
+    <filename>hoSTA.dOMAIna.ORG</filename> but not <filename>hostb</filename>.
+    </para></listitem>
+    </varlistentry>
+
+    <varlistentry>
+    <term>host</term>
+    <listitem><para>
+    Will match <filename>host</filename> but not <filename>hosta</filename>.
+    </para></listitem>
+    </varlistentry>
+
+    <varlistentry>
+    <term>host?</term>
+    <listitem><para>
+    Will match <filename>hosta</filename> and <filename>hostb</filename>, but
+    not <filename>host</filename>.
+    </para></listitem>
+    </varlistentry>
+
+    <varlistentry>
+    <term>ho*na</term>
+    <listitem><para>
+    Will match <filename>hoina</filename>
+    but not <filename>ho.aina.org</filename>.
+    </para></listitem>
+    </varlistentry>
+
+    <varlistentry>
+    <term>ho**na</term>
+    <listitem><para>
+    Will match <filename>hoina</filename>
+    and <filename>ho.aina.org</filename>.
+    </para></listitem>
+    </varlistentry>
+
+    <varlistentry>
+    <term>^hosta</term>
+    <listitem><para>
+    Will match <filename>hosta</filename>
+    but not <filename>foo.hosta.org</filename>.
+    </para></listitem>
+    </varlistentry>
+
+    <varlistentry>
+    <term>sda*</term>
+    <listitem><para>
+    Will match <filename>/dev/sda1</filename>
+    and <filename>/dev/sda12</filename>.
+    </para></listitem>
+    </varlistentry>
+
+    <varlistentry>
+    <term>/opt</term>
+    <listitem><para>
+    Will match the disk <filename>opt</filename>
+    but not the host <filename>opt</filename>.
+    </para></listitem>
+    </varlistentry>
+
+    <varlistentry>
+    <term>(note dots:) .opt.</term> <!-- nroff gets confused by dots -->
+    <listitem><para>
+    Will match the host <filename>opt</filename>
+    but not the disk <filename>opt</filename>.
+    </para></listitem>
+    </varlistentry>
+
+    <varlistentry>
+    <term>/</term>
+    <listitem><para>
+    Will match the disk <filename>/</filename>
+    but no other disk.
+    </para></listitem>
+    </varlistentry>
+
+    <varlistentry>
+    <term>/usr</term>
+    <listitem><para>
+    Will match the disks <filename>/usr</filename>
+    and <filename>/usr/local</filename>.
+    </para></listitem>
+    </varlistentry>
+
+    <varlistentry>
+    <term>/usr$</term>
+    <listitem><para>
+    Will match the disks <filename>/usr</filename>
+    but not <filename>/usr/local</filename>.
+    </para></listitem>
+    </varlistentry>
+
+</variablelist>
 
 
 </refsect1>
@@ -1145,49 +475,44 @@ the host or disk.</para>
 expression is a range expression where we only match the prefix.
 Leading ^ is removed. Trailing $ forces an exact match.</para>
 
-<informaltable frame="all">
-<tgroup cols="2" align="left">
-<tbody>
-
-<row>
-<entry>20001212-14</entry>
-<entry>match all dates beginning with 20001212, 20001213 or 20001214</entry>
-</row>
-
-<row>
-<entry>20001212-4</entry>
-<entry>same as previous</entry>
-</row>
-
-<row>
-<entry>20001212-24</entry>
-<entry>match all dates between 20001212 and 20001224</entry>
-</row>
-
-<row>
-<entry>2000121</entry>
-<entry>match all dates that start with 2000121 (20001210-20001219)</entry>
-</row>
-
-<row>
-<entry>2</entry>
-<entry>match all dates that start with 2 (20000101-29991231)</entry>
-</row>
-
-<row>
-<entry>2000-10</entry>
-<entry>match all dates between 20000101-20101231</entry>
-</row>
-
-<row>
-<entry>200010$</entry>
-<entry>match only 200010</entry>
-</row>
-
-</tbody>
-</tgroup>
-</informaltable>
-<para/>
+<variablelist remap="TP">
+
+    <varlistentry>
+    <term>20001212-14</term>
+    <listitem><para>match all dates beginning with 20001212, 20001213 or 20001214</para></listitem>
+    </varlistentry>
+
+    <varlistentry>
+    <term>20001212-4</term>
+    <listitem><para>same as previous</para></listitem>
+    </varlistentry>
+
+    <varlistentry>
+    <term>20001212-24</term>
+    <listitem><para>match all dates between 20001212 and 20001224</para></listitem>
+    </varlistentry>
+
+    <varlistentry>
+    <term>2000121</term>
+    <listitem><para>match all dates that start with 2000121 (20001210-20001219)</para></listitem>
+    </varlistentry>
+
+    <varlistentry>
+    <term>2</term>
+    <listitem><para>match all dates that start with 2 (20000101-29991231)</para></listitem>
+    </varlistentry>
+
+    <varlistentry>
+    <term>2000-10</term>
+    <listitem><para>match all dates between 20000101-20101231</para></listitem>
+    </varlistentry>
+
+    <varlistentry>
+    <term>200010$</term>
+    <listitem><para>match only 200010</para></listitem>
+    </varlistentry>
+
+</variablelist>
 
 </refsect1>
 
@@ -1200,43 +525,32 @@ escaped within any component by preceding them with a '\'.</para>
 
 <para>Some examples:</para>
 
-<informaltable frame="none">
-<tgroup cols="2" align="left">
-<tbody>
-
-<row>
-<entry>DUMPSPEC</entry>
-<entry>DESCRIPTION</entry>
-</row>
-
-<row>
-<entry>client17</entry>
-<entry>all dumps of client17</entry>
-</row>
-
-<row>
-<entry>@20080615</entry>
-<entry>All dumps on with datestamps matching 20080615</entry>
-</row>
-
-<row>
-<entry>webserver:/var/www</entry>
-<entry>All dumps of /var/www on host webserver</entry>
-</row>
-
-<row>
-<entry>webserver:/var/www@200806150317</entry>
-<entry>The dump of webserver with datestamp 200806150317</entry>
-</row>
-
-<row>
-<entry>:/var/www</entry>
-<entry>All dumps of /var/www on any host</entry>
-</row>
-
-</tbody>
-</tgroup>
-</informaltable>
+<variablelist remap='TP'>
+    <varlistentry>
+    <term>client17</term>
+    <listitem><para>all dumps of client17</para></listitem>
+    </varlistentry>
+
+    <varlistentry>
+    <term>@20080615</term>
+    <listitem><para>All dumps on with datestamps matching 20080615</para></listitem>
+    </varlistentry>
+
+    <varlistentry>
+    <term>webserver:/var/www</term>
+    <listitem><para>All dumps of /var/www on host webserver</para></listitem>
+    </varlistentry>
+
+    <varlistentry>
+    <term>webserver:/var/www@200806150317</term>
+    <listitem><para>The dump of webserver with datestamp 200806150317</para></listitem>
+    </varlistentry>
+
+    <varlistentry>
+    <term>:/var/www</term>
+    <listitem><para>All dumps of /var/www on any host</para></listitem>
+    </varlistentry>
+</variablelist>
 
 
 </refsect1>
@@ -1267,6 +581,13 @@ amdump -o INTERFACE:local:use="2000 kbps"
 </programlisting>
 </para>
 
+<para>When overriding device properties, one must carefully quote the
+  command line to simulate the syntax of real configuration files. The
+  following example should serve as a guide:
+<programlisting>
+amdump -o 'device-property="PROPERTY_MAX_VOLUME_USAGE" "100000"'
+</programlisting></para>
+
 <para>Note that configuration overrides are not effective for tape
 changers, which supply a tapedev based on their own configuration.  In order to
 override <emphasis remap="I">tapedev</emphasis>, you must also disable any changer:
@@ -1277,41 +598,5 @@ amdump -otapedev=/dev/nst1 -otpchanger=''
 
 </refsect1>
 
-<refsect1><title>AUTHOR</title>
-<para>James da Silva, &email.jds; : Original text</para>
-<para>&maintainer.sgw;: XML-conversion, major update</para>
-</refsect1>
-
-<refsect1><title>SEE ALSO</title>
-<para>
-<citerefentry><refentrytitle>amadmin</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-<citerefentry><refentrytitle>amanda.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
-<citerefentry><refentrytitle>amanda-client.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
-<citerefentry><refentrytitle>amcheck</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-<citerefentry><refentrytitle>amcheckdb</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-<citerefentry><refentrytitle>amcleanup</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-<citerefentry><refentrytitle>amdd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-<citerefentry><refentrytitle>amdump</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-<citerefentry><refentrytitle>amfetchdump</refentrytitle><manvolnum>8</manvolnum></citerefentry>
-<citerefentry><refentrytitle>amflush</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-<citerefentry><refentrytitle>amgetconf</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-<citerefentry><refentrytitle>amlabel</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-<citerefentry><refentrytitle>ammt</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-<citerefentry><refentrytitle>amoverview</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-<citerefentry><refentrytitle>amplot</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-<citerefentry><refentrytitle>amrecover</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-<citerefentry><refentrytitle>amreport</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-<citerefentry><refentrytitle>amrestore</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-<citerefentry><refentrytitle>amrmtape</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-<citerefentry><refentrytitle>amstatus</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-<citerefentry><refentrytitle>amtape</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-<citerefentry><refentrytitle>amtapetype</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-<citerefentry><refentrytitle>amtoc</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-<citerefentry><refentrytitle>amcheckdump</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-<citerefentry><refentrytitle>amserverconfig</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-<citerefentry><refentrytitle>amaddclient</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-<ulink url="http://wiki.zmanda.com"/>
-</para>
-</refsect1>
 </refentry>
 
index 6b15ca7ddf6fe6b2469d288b816a6d4638b1a22f..79a7f059d37a13b77d5d095240ef3f3f12db3a9a 100644 (file)
 <refmeta>
 <refentrytitle>amanda.conf</refentrytitle>
 <manvolnum>5</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.5;
 </refmeta>
 <refnamediv>
 <refname>amanda.conf</refname>
 <refpurpose>Main configuration file for &A;, the Advanced Maryland Automatic Network Disk Archiver</refpurpose>
 </refnamediv>
+<refentryinfo>
+&author.jds;
+&author.sgw.xml;
+</refentryinfo>
 <!-- body begins here -->
 
 <refsect1><title>DESCRIPTION</title>
@@ -25,7 +32,7 @@ relevant sections and parameters of this file for quick reference.</para>
 <para> The file <emphasis remap='B'>&lt;CONFIG_DIR&gt;/&lt;config&gt;/amanda.conf</emphasis> is loaded.</para>
 </refsect1>
 
-<refsect1><title>PARAMETERS</title>
+<refsect1><title>SYNTAX</title>
 
 <para>There are a number of configuration parameters that control the
 behavior of the &A; programs.
@@ -34,22 +41,68 @@ so you need not specify the parameter in
 <emphasis remap='B'>amanda.conf</emphasis>
 if the default is suitable.</para>
 
+<refsect2><title>COMMENTS</title>
+
 <para>Lines starting with # are ignored, as are blank lines.
 Comments may be placed on a line with a directive by starting
 the comment with a #.
 The remainder of the line is ignored.</para>
+</refsect2>
+
+<refsect2><title>KEYWORDS AND IDENTIFIERS</title>
 
 <para>Keywords are case insensitive, i.e.
 <emphasis remap='B'>mailto</emphasis>
 and
 <emphasis remap='B'>MailTo</emphasis>
-are treated the same.</para>
+are treated the same.  Also, the characters
+<emphasis remap='B'>'-'</emphasis>
+and
+<emphasis remap='B'>'_'</emphasis>
+are interchangeable in all predefined &A; keywords:
+<emphasis remap='B'>device_property</emphasis>
+and
+<emphasis remap='B'>device-property</emphasis>
+have the same meaning.</para>
+
+<para>Identifiers are names which are defined in the configuration itself, such
+as dumptypes or interfaces.  Identifiers are are case-insensitive, but
+sensitive to
+<emphasis remap='B'>'-'</emphasis>
+vs.
+<emphasis remap='B'>'_'</emphasis>.
+Identifiers should be quoted in the configuration file, although For historical
+reasons, the quotes are optional.</para>
+
+<para>Strings are always quoted with double quotes ("), and any double quotes
+or backslashes within the string are escaped with a backslash:
+<programlisting>
+tapelist "/path/to/tapelist"
+property "escaped-string" "escaping: \\ (backslash) and \" (double-quote)"
+</programlisting>
+</para>
+
+<para>To summarize, then:
+<programlisting>
+                          # QUOTES        CASE            -/_
+logdir "logs"             # required      sensitive       sensitive
+send-amreport-on strange  # prohibited    insensitive     insensitive
+tapetype "EXABYTE"        # optional      insensitive     sensitive
+
+define dumptype "dt" {    # optional      insensitive     sensitive
+  "dumptype-common"       # optional      insensitive     sensitive
+  strategy noincr         # prohibited    insensitive     insensitive
+}
+</programlisting>
+</para>
+
+</refsect2>
+
+<refsect2><title>VALUE SUFFIXES</title>
 
 <para>Integer arguments may have one of the following (case insensitive) suffixes,
 some of which have a multiplier effect:</para>
 
-<refsect2><title>POSSIBLE SUFFIXES</title>
-
 <variablelist remap='TP'>
   <varlistentry>
   <term><emphasis remap='B'>b byte bytes</emphasis></term>
@@ -73,6 +126,7 @@ some of which have a multiplier effect:</para>
   <term><emphasis remap='B'>kps kbps</emphasis></term>
   <listitem>
 <para>Some number of kilobytes per second (bytes*1024).</para>
+<para>It is the default multiplier for all size options.</para>
   </listitem>
   </varlistentry>
   <varlistentry>
@@ -140,8 +194,46 @@ is assumed.
 </variablelist>
 </refsect2>
 
-<refsect2>
-<title>PARAMETERS</title>
+<refsect2><title>PARAMETER ORDER</title>
+
+<para>In general, the order in which parameters occur in the configuration file
+does not matter, with the exception of subsection inheritance.  For example, if
+dumptype "normal-encrypt" which inherits from dumptype "normal", then "normal"
+must appear first in the configuration file.</para>
+
+</refsect2>
+
+<refsect2><title>STRINGS</title>
+<para>Quoted strings in Amanda follow a common, C-like syntax.  Printable
+characters and whitespace are kept as-is, except that the backslash character
+(\) is used as an escape character, and a double-quote ends the string.  The allowed
+escape sequences are
+<programlisting>
+    ESCAPE SEQUENCE     BECOMES
+    \\                  \
+    \"                  "
+    \n                  (newline)
+    \t                  (tab)
+    \r                  (carriage return)
+    \f                  (form-feed)
+    \1 - \7
+    \01 - \77
+    \001 - \377         (character specified in octal)
+</programlisting>
+Illegally quoted strings are handled on a "best-effort" basis, which may lead to
+unexpected results.
+</para>
+<para>Examples:
+<programlisting>
+finserver "/data/finance/XYZ Corp's \"real\" finances" finance-high eth0 -1
+property "syspath" "C:\\WINDOWS\\SYSTEM"
+</programlisting>
+</para>
+</refsect2>
+</refsect1>
+
+<refsect1>
+<title>GLOBAL PARAMETERS</title>
 
 <variablelist remap='TP'>
   <varlistentry>
@@ -153,6 +245,12 @@ A descriptive name for the configuration.
 This string appears in the Subject line of mail reports.
 Each &A; configuration should have a different string to keep
 mail reports distinct.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><emphasis remap='B'>mailer</emphasis> <emphasis remap='I'> string</emphasis></term>
+  <listitem>
+<para>Default found by configure. A mail program that can send mail with '<emphasis remap='I'>MAILER -s "subject" user &lt; message_file</emphasis>'.</para>
   </listitem>
   </varlistentry>
   <varlistentry>
@@ -164,6 +262,41 @@ A space separated list of recipients for mail reports.</para>
   </listitem>
   </varlistentry>
   <varlistentry>
+  <term><emphasis remap='B'>send-amreport-on</emphasis> [all|strange|error|never]</term>
+  <listitem>
+<para>Default:
+<emphasis remap='B'>all</emphasis>.
+Specify which types of messages will trigger an email from amreport. amreport is used by amdump and amflush.</para>
+  <!-- .RS -->
+    <variablelist remap='TP'>
+      <varlistentry>
+      <term><emphasis remap='B'>all</emphasis></term>
+      <listitem>
+<para>Send an email on any message.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>strange</emphasis></term>
+      <listitem>
+<para>Send an email on strange or error message. A strange message occurs when the dump succeeded, but returned one or more errors unknown to &A;.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>error</emphasis></term>
+      <listitem>
+<para>Send an email only on error messages.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>never</emphasis></term>
+      <listitem>
+<para>Never send an email.</para>
+      </listitem>
+      </varlistentry>
+    </variablelist>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
   <term><emphasis remap='B'>dumpcycle</emphasis> <emphasis remap='I'> int</emphasis></term>
   <listitem>
 <para>Default:
@@ -195,9 +328,7 @@ The number of amdump runs in
 days.
 A value of 0 means the same value as 
 <emphasis remap='B'>dumpcycle</emphasis>.
-A value of -1 means guess the number of runs from the
-<emphasis remap='I'>tapelist</emphasis>
-file, 
+A value of -1 means guess the number of runs from the &tapelist; file,
 which is the number of tapes used in the last 
 <emphasis remap='B'>dumpcycle</emphasis>
 days / 
@@ -289,24 +420,17 @@ option.</para>
   <listitem>
 <para>Default:
 <filename>null:</filename>.
-The path name of the non-rewinding tape device.
-Non-rewinding tape device names often have an 'n' in the name,
-e.g.
-<filename>/dev/rmt/0mn</filename>,
-however this is operating system specific and you should consult
-that documentation for detailed naming information.</para>
+The device name, referencing the name of a "device" section in the configuration file.  See
+<citerefentry><refentrytitle>amanda-devices</refentrytitle><manvolnum>7</manvolnum></citerefentry>
+for more information on device names.</para>
 
 <para>If a tape changer is configured
 (see the
 <emphasis remap='B'>tpchanger</emphasis>
 option), this option might not be used.</para>
 
-<para>If the
-<emphasis remap='B'>null</emphasis>
-output driver is selected
-(see the section OUTPUT DRIVERS in the 
-<citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry> 
-manpage for more information),
+<para>If <emphasis remap='B'>tapedev</emphasis> is
+<emphasis remap='B'>null:</emphasis>,
 programs such as
 &amdump;
 will run normally but all images will be thrown away.
@@ -321,22 +445,28 @@ option set to
   <varlistentry>
   <term><emphasis remap='B'>device_property</emphasis> string string</term>
   <listitem>
-<para>These options can set various device properties, including block size,
-maximum volume usage, authentication information, hardware feature support,
-and more.Specifics of how properties are used are device-dependent, though
-some common properties are supported across multiple device drivers.</para>
-
-<para> Both strings are quoted; the first string contains the name of
+<para>These options can set various device properties.  See
+<citerefentry><refentrytitle>amanda-devices</refentrytitle><manvolnum>7</manvolnum></citerefentry>
+for more information on device properties and their syntax.
+Both strings are always quoted; the first string contains the name of
 the property to set, and the second contains its value. For example, to set
-a fixed block size of 128k, do:</para><programlisting>device_property "BLOCK_SIZE" "131072"</programlisting>
-<para></para>
-<para>The order in which device properties are set is as follows:
-<orderedlist><listitem><para>Tapetype parameters, including length, blocksize,
-readblocksize, file-pad, are translated into device properties and set
-accordingly.</para></listitem>
-<listitem><para>Device properties from any device_property configuration directives
-are set, in the order they appear in the configuration file.</para></listitem>
-</orderedlist></para>
+a fixed block size of 128k, write:</para>
+<programlisting>
+device_property "BLOCK_SIZE" "128k"
+</programlisting>
+
+  </listitem>
+  </varlistentry>
+
+  <varlistentry>
+  <term><emphasis remap='B'>property</emphasis> [append] string string+</term>
+  <listitem>
+<para>These options can set various properties, they can be used by third
+ party software to store information in the configuration file.
+Both strings are quoted; the first string contains the name of
+the property to set, and the others contains its values.
+<emphasis remap='B'>append</emphasis> keyword append the values to the list of values for that property.
+</para>
   </listitem>
   </varlistentry>
 
@@ -400,6 +530,7 @@ the backup image &A; was processing starts over again on the next tape.</para>
 <para>Default:
 <emphasis remap='I'>runtapes</emphasis>*<emphasis remap='I'>tape_length</emphasis>.
 Maximum number of bytes the planner will schedule for a run.</para>
+<para>The default unit is Kbytes if it is not specified.</para>
   </listitem>
   </varlistentry>
   <varlistentry>
@@ -467,10 +598,10 @@ to avoid overwriting each other's tapes.</para>
 </listitem>
 </varlistentry>
   <varlistentry>
-  <term><emphasis remap='B'>tapetype</emphasis> <emphasis remap='I'> string</emphasis></term>
+  <term><emphasis remap='B'>tapetype</emphasis> <emphasis remap='I'> identifier</emphasis></term>
   <listitem>
 <para>Default:
-<emphasis remap='I'>EXABYTE</emphasis>.
+<emphasis remap='I'>"EXABYTE"</emphasis>.
 The type of tape drive associated with
 <emphasis remap='B'>tapedev</emphasis>
 or
@@ -483,8 +614,6 @@ like the
 size, and
 <emphasis remap='B'>speed</emphasis>
 of the tape media and device.</para>
-<para>First character of a <emphasis remap='B'>tapetype</emphasis> string must
-be an alphabetic character</para>
   </listitem>
   </varlistentry>
   <varlistentry>
@@ -634,6 +763,7 @@ it will do the next level.
 The value of this parameter is used only if the parameter 
 <emphasis>bumppercent</emphasis> is set to 0.
 </para>
+<para>The default unit is Kbytes if it is not specified.</para>
 <para>
 The global setting of this parameter can be overwritten inside of a  
 dumptype-definition.  
@@ -767,9 +897,7 @@ option enabled.</para>
   <listitem>
 <para>Default:
 <emphasis remap='I'>tapelist</emphasis>.
-The file name for the active
-<emphasis remap='I'>tapelist</emphasis>
-file.
+The file name for the active &tapelist;.
 &A; maintains this file with information about the active set of tapes.</para>
   </listitem>
   </varlistentry>
@@ -777,11 +905,12 @@ file.
   <term><emphasis remap='B'>device_output_buffer_size</emphasis> <emphasis remap='I'> int</emphasis></term>
   <listitem>
 <para>Default:
-<literal>640k</literal>.
+<literal>1280k</literal>.
 Controls the amount of memory used by &A;
 to hold data as it is read from the network or disk before it is written to
 the output device. Higher values may be
 useful on fast tape drives and optical media.</para>
+<para>The default unit is bytes if it is not specified.</para>
   </listitem>
   </varlistentry>
   <varlistentry>
@@ -855,7 +984,7 @@ These three parts specify:</para>
   <listitem>
       <para>the name of the column, which may be:</para>
 
-       <programlisting>
+<programlisting>
        Compress (compression ratio)
        Disk (client disk name)
        DumpRate (dump rate in KBytes/sec)
@@ -866,7 +995,7 @@ These three parts specify:</para>
        OutKB (output image size in KBytes)
        TapeRate (tape writing rate in KBytes/sec)
        TapeTime (total tape time in hours:minutes)
-       </programlisting>
+</programlisting>
 
   </listitem>
 
@@ -992,12 +1121,13 @@ Debug level of the taper process</para>
   &A; will not begin writing data to a new volume until the amount of
   data on the holding disk is at least this percentage of the volume
   size. In other words, &A; will not begin until the
-  inequality <inlineequation><mathphrase>h &lt; t &#215;
+  inequality <inlineequation><mathphrase>h &gt; t &#215;
   d</mathphrase></inlineequation> is satisfied,
   where <mathphrase>h</mathphrase> is the amount of data on the
   holding disk, <mathphrase>t</mathphrase> is the capacity of a
   volume, and <mathphrase>d</mathphrase> is this parameter, expressed as a
-  percentage.</para>
+  percentage.  This parameter may be larger than 100%, for example to keep
+  more recent dumps on the holding disk for faster recovery.</para>
 <para> Needless to say, your holding disk must be big enough
   that this criterion could be satisfied. If the holding disk cannot
   be used for a particular dump (because, for example, there is no
@@ -1019,14 +1149,14 @@ Debug level of the taper process</para>
   amount of data on the holding disk and the estimated amount of data
   remaining to be dumped during this run is at least this percentage
   of the volume size. In other words, &A; will not begin until the
-  inequality <inlineequation><mathphrase>h + s &lt; t &#215;
+  inequality <inlineequation><mathphrase>h + s &gt; t &#215;
   d</mathphrase></inlineequation> is satisfied,
   where <mathphrase>h</mathphrase> is the amount of data on the
   holding disk, <mathphrase>s</mathphrase> is the total amount of
   data scheduled for this run but not dumped
   yet, <mathphrase>t</mathphrase> is the capacity of a volume,
   and <mathphrase>d</mathphrase> is this parameter, expressed as a
-  percentage.</para>
+  percentage.  This parameter may be larger than 100%.</para>
 <para>  Needless to say, your holding disk must be big enough
   that this criterion could be satisfied. If the holding disk cannot
   be used for a particular dump (because, for example, there is no
@@ -1052,13 +1182,13 @@ Debug level of the taper process</para>
   the capacity of a single
   volume. In other words, at the end of a run, &A; will begin
   a new tape if the 
-  inequality <inlineequation><mathphrase>h &lt; t &#215;
+  inequality <inlineequation><mathphrase>h &gt; t &#215;
   f</mathphrase></inlineequation> is satisfied,
   where <mathphrase>h</mathphrase> is the amount of data remaining on the
   holding disk from this or previous runs, <mathphrase>t</mathphrase>
   is the capacity of a volume,
   and <mathphrase>f</mathphrase> is this parameter, expressed as a
-  percentage.</para>
+  percentage.  This parameter may be greater than 100%.</para>
 <para> The value of this parameter may not exceed that of
   the <emphasis remap='B'>flush-threshold-scheduled</emphasis>
   parameter.; <emphasis remap='B'>autoflush</emphasis> must be set to 'yes' if
@@ -1097,7 +1227,6 @@ Range is inclusive.</para>
   </varlistentry>
 
 </variablelist>
-</refsect2>
 </refsect1>
 
 <refsect1><title>HOLDINGDISK SECTION</title>
@@ -1158,6 +1287,7 @@ holding disk files. The size of each chunk will not exceed the specified value.
 However, even though dump images are split in the holding disk, they are concatenated as 
 they are written to tape, so each dump image still corresponds to a single continuous 
 tape section.</para>
+<para>The default unit is Kbytes if it is not specified.</para>
 
 <para>If 0 is specified, &A; will create holding disk chunks as large as
 ((INT_MAX/1024)-64) Kbytes.</para>
@@ -1189,7 +1319,7 @@ another set for file systems that should always get a full backup and so on.</pa
 section, which looks like this:</para>
 
 <programlisting>
-define dumptype <emphasis remap='I'>name</emphasis> {
+define dumptype "<emphasis remap='I'>name</emphasis>" {
     <emphasis remap='I'>dumptype-option</emphasis> <emphasis remap='I'>dumptype-value</emphasis>
     <literal>...</literal>
 }
@@ -1223,24 +1353,7 @@ are defined.</para>
   <listitem>
 <para>Default:
 <emphasis remap='I'>bsd</emphasis>.
-Type of authorization to perform between tape server and backup client hosts.</para>
-<para><emphasis remap='B'>bsd</emphasis>, bsd authorization with udp initial
-connection and one tcp connection by data stream.</para>
-<para><emphasis remap='B'>bsdtcp</emphasis>, bsd authorization but use only
-one tcp connection.</para> 
-<para><emphasis remap='B'>bsdudp</emphasis>, like bsd, but will use only one
-tcp connection for all data stream.</para>
-<para><emphasis remap='B'>krb4</emphasis> to use Kerberos-IV
-authorization.</para>
-<para><emphasis remap='B'>krb5</emphasis> to use Kerberos-V
-authorization.</para>
-<para><emphasis remap='B'>local</emphasis>, if the client is the server, it 
-doesn't require authencation setup.</para>
-<para><emphasis remap='B'>rsh</emphasis> to use rsh
-authorization.</para>
-<para><emphasis remap='B'>ssh</emphasis> to use OpenSSH
-authorization.</para>
-
+Type of authorization to perform between tape server and backup client hosts.  See <citerefentry><refentrytitle>amanda-auth</refentrytitle><manvolnum>7</manvolnum></citerefentry> for more detail.</para>
   </listitem>
   </varlistentry>
 
@@ -1279,6 +1392,7 @@ it will do the next level.
 The value of this parameter is used only if the parameter 
 <emphasis>bumppercent</emphasis> is set to 0.
 </para>
+<para>The default unit is Kbytes if it is not specified.</para>
 <para>
 See also the options 
 <emphasis remap='B'>bumppercent</emphasis>,
@@ -1453,7 +1567,7 @@ server host as it goes from the network into the holding disk or to tape.</para>
       <para>PROG must not contain white space.</para>
       <para>Specify client_decrypt_option &quot;decryption-parameter&quot; Default: &quot;-d&quot;</para>
       <para>decryption-parameter must not contain white space.</para>
-      <para>(See dumptype server-encrypt-fast in example/amanda.conf for reference)</para>
+      <para>(See dumptype client-encrypt-nocomp in example/amanda.conf for reference)</para>
     </listitem>
   </varlistentry>
   <varlistentry>
@@ -1463,7 +1577,7 @@ server host as it goes from the network into the holding disk or to tape.</para>
       <para>PROG must not contain white space.</para>
       <para>Specify server_decrypt_option &quot;decryption-parameter&quot; Default: &quot;-d&quot;</para>
       <para>decryption-parameter must not contain white space.</para>
-      <para>(See dumptype client-encrypt-nocomp in example/amanda.conf for reference)</para>
+      <para>(See dumptype server-encrypt-fast in example/amanda.conf for reference)</para>
     </listitem>
   </varlistentry>
 </variablelist>
@@ -1701,17 +1815,58 @@ high (2), medium (1), low (0) or a number of your choice.</para>
   </listitem>
   </varlistentry>
   <varlistentry>
-  <term><emphasis remap='B'>program</emphasis> <emphasis remap='I'> string</emphasis></term>
+  <term><emphasis remap='B'>program</emphasis> [DUMP|GNUTAR|APPLICATION]</term>
   <listitem>
 <para>Default:
 <emphasis remap='I'>DUMP</emphasis>.
-The type of backup to perform. Valid values are
-<emphasis remap='B'>DUMP</emphasis>
-for the native operating system backup program, and
-<emphasis remap='B'>GNUTAR</emphasis>
-to use &gnutar; or to do PC backups using Samba.</para>
+The type of backup to perform. Valid values are:</para>
+  <!-- .RS -->
+    <variablelist remap='TP'>
+      <varlistentry>
+      <term><emphasis remap='B'>DUMP</emphasis></term>
+      <listitem>
+<para>The native operating system backup program.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>GNUTAR</emphasis></term>
+      <listitem>
+<para>To use GNU-tar or to do PC backups using Samba.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>APPLICATION</emphasis></term>
+      <listitem>
+<para>To use an application-tool, see the <emphasis>application</emphasis> option.</para>
+      </listitem>
+      </varlistentry>
+    </variablelist>
   </listitem>
   </varlistentry>
+  <varlistentry>
+  <term><emphasis remap='B'>application</emphasis> <emphasis remap='I'> string</emphasis></term>
+  <listitem>
+<para>No default. Must be the name of an application-tool if <emphasis>program</emphasis> is set to <emphasis remap='I'>APPLICATION</emphasis>. See APPLICATION SECTION below.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><emphasis remap='B'>script</emphasis> <emphasis remap='I'> string</emphasis></term>
+  <listitem>
+<para>No default. Must be the name of a script-tool. You can have many script. See SCRIPT SECTION below.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><emphasis remap='B'>property</emphasis> [append] <emphasis remap='I'>string</emphasis> <emphasis remap='I'>string</emphasis>+</term>
+  <listitem>
+<para>These options can set various properties, they can be used by third
+ party software to store information in the configuration file.
+Both strings are quoted; the first string contains the name of
+the property to set, and the others contains its values.
+<emphasis remap='B'>append</emphasis> keyword append the values to the list of values for that property.
+</para>
+  </listitem>
+  </varlistentry>
+
   <varlistentry>
   <term><emphasis remap='B'>record</emphasis> <emphasis remap='I'> boolean</emphasis></term>
   <listitem>
@@ -1805,6 +1960,7 @@ average dump being split), substantial tape space can be wasted.
 If too small, large dumps will be split into innumerable tiny dumpfiles,
 adding to restoration complexity.
 A good rule of thumb, usually, is 1/10 of the size of your tape.</para>
+<para>The default unit is Kbytes if it is not specified.</para>
   </listitem>
   </varlistentry>
 
@@ -1832,6 +1988,7 @@ The size of this buffer can be changed from its (very conservative) default
 to a value reflecting the amount of memory that each taper process on
 the dump server may reasonably consume.
 </para>
+<para>The default unit is Kbytes if it is not specified.</para>
   </listitem>
   </varlistentry>
 </variablelist>
@@ -1839,31 +1996,31 @@ the dump server may reasonably consume.
 <para>The following <emphasis remap='B'>dumptype</emphasis> entries are predefined by &A;:</para>
 
 <programlisting remap='.nf'>
-define dumptype no-compress {
+define dumptype "no-compress" {
     compress none
 }
-define dumptype compress-fast {
+define dumptype "compress-fast" {
     compress client fast
 }
-define dumptype compress-best {
+define dumptype "compress-best" {
     compress client best
 }
-define dumptype srvcompress {
+define dumptype "srvcompress" {
     compress server fast
 }
-define dumptype bsd-auth {
+define dumptype "bsd-auth" {
     auth bsd
 }
-define dumptype krb4-auth {
+define dumptype "krb4-auth" {
     auth krb4
 }
-define dumptype no-record {
+define dumptype "no-record" {
     record no
 }
-define dumptype no-hold {
+define dumptype "no-hold" {
     holdingdisk no
 }
-define dumptype no-full {
+define dumptype "no-full" {
     skip-full yes
 } 
 </programlisting>
@@ -1872,7 +2029,7 @@ define dumptype no-full {
 <emphasis remap='B'>dumptype</emphasis>
 section, one or more other
 <emphasis remap='B'>dumptype</emphasis>
-names may be entered, which make this
+names may be supplied as identifiers, which make this
 <emphasis remap='B'>dumptype</emphasis>
 inherit options from other previously defined
 <emphasis remap='B'>dumptype</emphasis>s.
@@ -1880,15 +2037,15 @@ For instance, two sections might be the same except for the
 <emphasis remap='B'>record</emphasis> option:</para>
 
 <programlisting remap='.nf'>
-define dumptype normal {
+define dumptype "normal" {
     comment &quot;Normal backup, no compression, do indexing&quot;
     no-compress
     index yes
     maxdumps 2
 }
-define dumptype testing {
+define dumptype "testing" {
     comment &quot;Test backup, no compression, do indexing, no recording&quot;
-    normal
+    "normal"
     record no
 }
 </programlisting>
@@ -1914,7 +2071,7 @@ The information is entered in a
 section, which looks like this in the config file:</para>
 
 <programlisting>
-define tapetype <emphasis remap='I'>name</emphasis> {
+define tapetype "<emphasis remap='I'>name</emphasis>" {
     <emphasis remap='I'>tapetype-option</emphasis> <emphasis remap='I'>tapetype-value</emphasis>
     <literal>...</literal>
 }
@@ -1958,7 +2115,9 @@ regardless of what value is entered for <emphasis remap='B'>length</emphasis>
 (but see the section OUTPUT DRIVERS in the 
 <citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry> 
 manpage for exceptions).
- </para> </listitem>
+ </para>
+<para>The default unit is bytes if it is not specified.</para>
+  </listitem>
   </varlistentry>
 
 <varlistentry>
@@ -1966,45 +2125,22 @@ manpage for exceptions).
 <listitem>
 <para>Default:
 <emphasis remap='I'>32 kbytes</emphasis>.
-How much data will be written in each tape record expressed in KiloBytes.
-The tape record size (= blocksize) can not be reduced below the default 32 KBytes.
-The parameter blocksize can only be raised if &A; was compiled with the configure option
---with-maxtapeblocksize=N set with &quot;N&quot; greater than 32 during
-&configure;.
+How much data will be written in each tape record.  This is equivalent to the <emphasis remap="I">BLOCK_SIZE</emphasis> device property.
 </para>
+<para>The default unit is Kbytes if it is not specified.</para>
   </listitem>
   </varlistentry>
 <varlistentry>
 <term><emphasis remap='B'>readblocksize</emphasis> <emphasis remap='I'> int</emphasis></term>
 <listitem>
-<para>Default:
-(<emphasis remap='I'>from configure --with-maxtapeblocksize</emphasis>).
-How much data will be read in each tape record expressed in KiloBytes.
-Some hardware require a value not too large, and some require it to be equal to the blocksize.
-It is useful if you configured amanda with a big --with-maxtapeblocksize and your 
-hardware don't work with a value that big.
+<para>Default: <emphasis remap="I">32 kytes</emphasis>
+How much data will be read in each tape record.  This can be used to override a
+device's block size for reads only.  This may be useful, for example, in
+reading a tape written with a 256k block size when Amanda is configured to use
+128k blocks.  This unusual feature is not supported by all operating systems and
+tape devices.
 </para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>file-pad</emphasis> <emphasis remap='I'> boolean</emphasis></term>
-  <listitem>
-<para>Default:
-<emphasis remap='I'>true</emphasis>.
-If true, every record, including the last one in the file, will have the same length.
-This matches the way &A; wrote tapes prior to the availability of this parameter.
-It may also be useful on devices that only support a fixed blocksize.</para>
-
-<para>Note that the last record on the tape probably includes trailing
-null byte padding, which will be passed back to
-<emphasis remap='B'>gzip</emphasis>,
-<emphasis remap='B'>compress</emphasis>
-or the restore program. Most programs just ignore this (although possibly with a warning).</para>
-
-<para>If this parameter is false, the last record in a file may be shorter
-than the block size. The file will contain the same amount of data the dump program generated,
-without trailing null byte padding. When read, the same amount of data that was written 
-will be returned.</para>
+<para>The default unit is Kbytes if it is not specified.</para>
   </listitem>
   </varlistentry>
   
@@ -2033,7 +2169,7 @@ man page for more information.</para>
 
 <para>In addition to options, another
 <emphasis remap='B'>tapetype</emphasis>
-name may be entered, which makes this
+name may be supplie as an identifier, which makes this
 <emphasis remap='B'>tapetype</emphasis>
 inherit options from another
 <emphasis remap='B'>tapetype</emphasis>.
@@ -2042,14 +2178,14 @@ Compact-III tapes and one using Compact-IV tapes is the length of the tape.
 So they could be entered as:</para>
 
 <programlisting remap='.nf'>
-define tapetype DLT4000-III {
+define tapetype "DLT4000-III" {
     comment &quot;DLT4000 tape drives with Compact-III tapes&quot;
     length 12500 mbytes         # 10 Gig tapes with some compression
     filemark 2000 kbytes
     speed 1536 kps
 }
-define tapetype DLT4000-IV {
-    DLT4000-III
+define tapetype "DLT4000-IV" {
+    "DLT4000-III"
     comment &quot;DLT4000 tape drives with Compact-IV tapes&quot;
     length 25000 mbytes         # 20 Gig tapes with some compression
 }
@@ -2070,7 +2206,7 @@ The information is entered in an <emphasis remap='B'>interface</emphasis>
 section, which looks like this:</para>
 
 <programlisting>
-define interface <emphasis remap='I'>name</emphasis> {
+define interface "<emphasis remap='I'>name</emphasis>" {
     <emphasis remap='I'>interface-option</emphasis> <emphasis remap='I'>interface-value</emphasis>
     <literal>...</literal>
 }
@@ -2111,16 +2247,290 @@ The speed of the interface in Kbytes per second.</para>
 
 <para>In addition to options, another
 <emphasis remap='B'>interface</emphasis>
-name may be entered, which makes this
+name may be supplied as an identifier, which makes this
 <emphasis remap='B'>interface</emphasis>
 inherit options from another
 <emphasis remap='B'>interface</emphasis>.
 At the moment, this is of little use.</para>
 </refsect1>
 
-<refsect1><title>AUTHOR</title>
-<para>James da Silva, &email.jds;: Original text</para>
-<para>&maintainer.sgw;: XML-conversion, major update, splitting</para>
+<refsect1><title>APPLICATION SECTION</title>
+<para>The
+<emphasis remap='B'>amanda.conf</emphasis>
+file may define multiple types of application.
+The information is entered in a <emphasis remap='B'>application-tool</emphasis>
+section, which looks like this:</para>
+
+<programlisting>
+define application-tool "<emphasis remap='I'>name</emphasis>" {
+    <emphasis remap='I'>application-option</emphasis> <emphasis remap='I'>application-value</emphasis>
+    <literal>...</literal>
+}
+</programlisting>
+
+<para><emphasis remap='I'>name</emphasis>
+is the name of this type of application. It is referenced from the
+<emphasis remap='I'>dumptype</emphasis></para>
+
+<para>The application-tool options and values are:</para>
+<variablelist remap='TP'>
+  <varlistentry>
+  <term><emphasis remap='B'>comment</emphasis> <emphasis remap='I'>string</emphasis></term>
+  <listitem>
+<para>Default:
+<emphasis remap='I'>none</emphasis>.
+A comment string describing this application.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><emphasis remap='B'>plugin</emphasis> <emphasis remap='I'>string</emphasis></term>
+  <listitem>
+<para>No default. Must be set to the name of the program. This program must be in the <emphasis remap='I'>$libexecdir/amanda/application</emphasis> directory on the client.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><emphasis remap='B'>property</emphasis> [append] [priority] <emphasis remap='I'>string</emphasis> <emphasis remap='I'>string</emphasis>+</term>
+  <listitem>
+<para>No default. You can set property for the application, each application have a different set of property. Both strings are quoted; the first string contains the name of
+the property to set, and the others contains its values.
+<emphasis remap='B'>append</emphasis> keyword append the values to the list of values for that property.
+<emphasis remap='B'>priority</emphasis> keyword disallow the setting of that property on the client.
+</para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</refsect1>
+
+<refsect1><title>SCRIPT SECTION</title>
+<para>The
+<emphasis remap='B'>amanda.conf</emphasis>
+file may define multiple types of script. 
+The information is entered in a <emphasis remap='B'>script-tool</emphasis>
+section, which looks like this:</para>
+
+<programlisting>
+define script-tool "<emphasis remap='I'>name</emphasis>" {
+    <emphasis remap='I'>script-option</emphasis> <emphasis remap='I'>script-value</emphasis>
+    <literal>...</literal>
+}
+</programlisting>
+
+<para><emphasis remap='I'>name</emphasis>
+is the name of this type of script. It is referenced from the
+<emphasis remap='I'>dumptype</emphasis></para>
+
+<para>The script-tool options and values are:</para>
+<variablelist remap='TP'>
+  <varlistentry>
+  <term><emphasis remap='B'>comment</emphasis> <emphasis remap='I'>string</emphasis></term>
+  <listitem>
+<para>Default:
+<emphasis remap='I'>none</emphasis>.
+A comment string describing this script.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><emphasis remap='B'>plugin</emphasis> <emphasis remap='I'>string</emphasis></term>
+  <listitem>
+<para>No default. Must be set to the name of the program. This program must be in the <emphasis remap='I'>$libexecdir/amanda/application</emphasis> directory on the client and/or server.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><emphasis remap='B'>execute_where</emphasis> [client|server]</term>
+  <listitem>
+<para>Default: <emphasis remap='I'>client</emphasis>. Where the script must be executed, on the client or server.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><emphasis remap='B'>execute_on</emphasis> <emphasis remap='I'>execute_on</emphasis>[,<emphasis remap='I'>execute_on</emphasis>]*</term>
+  <listitem>
+<para>No default. When the script must be executed, you can specify many of them:</para>
+    <!-- .RS -->
+    <variablelist remap='TP'>
+      <varlistentry>
+      <term><emphasis remap='B'>pre-dle-amcheck</emphasis></term>
+      <listitem>
+<para>Execute before the amcheck command for the dle.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>pre-host-amcheck</emphasis></term>
+      <listitem>
+<para>Execute before the amcheck command for all dle for the client.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>post-dle-amcheck</emphasis></term>
+      <listitem>
+<para>Execute after the amcheck command for the dle.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>post-host-amcheck</emphasis></term>
+      <listitem>
+<para>Execute after the amcheck command for all dle for the client.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>pre-dle-estimate</emphasis></term>
+      <listitem>
+<para>Execute before the estimate command for the dle.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>pre-host-estimate</emphasis></term>
+      <listitem>
+<para>Execute before the estimate command for all dle for the client.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>post-dle-estimate</emphasis></term>
+      <listitem>
+<para>Execute after the estimate command for the dle.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>post-host-estimate</emphasis></term>
+      <listitem>
+<para>Execute after the estimate command for all dle for the client.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>pre-dle-backup</emphasis></term>
+      <listitem>
+<para>Execute before the backup command for the dle.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>pre-host-backup</emphasis></term>
+      <listitem>
+<para>Execute before the backup command for all dle for the client.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>post-dle-backup</emphasis></term>
+      <listitem>
+<para>Execute after the backup command for the dle.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>post-host-backup</emphasis></term>
+      <listitem>
+<para>Execute after the backup command for all dle for the client.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>pre-recover</emphasis></term>
+      <listitem>
+<para>Execute before any level is recovered.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>post-recover</emphasis></term>
+      <listitem>
+<para>Execute after all levels are recovered.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>pre-level-recover</emphasis></term>
+      <listitem>
+<para>Execute before each level recovery.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>post-level-recover</emphasis></term>
+      <listitem>
+<para>Execute after each level recovery.</para>
+      </listitem>
+      </varlistentry>
+      <varlistentry>
+      <term><emphasis remap='B'>inter-level-recover</emphasis></term>
+      <listitem>
+<para>Execute between two levels of recovery.</para>
+      </listitem>
+      </varlistentry>
+    </variablelist>
+    <para>If you recover level 0 and 2 of the disk /usr with amrecover, it will execute:</para>
+<programlisting>
+script --pre-recover
+script --pre-level-recover --level 0
+#recovering level 0
+script --post-level-recover --level 0
+script --inter-level-recover --level 0 --level 2
+script --pre-level-recover --level 2
+#recovering level 2
+script --post-level-recover --level 2
+script --post-recover
+</programlisting>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><emphasis remap='B'>property</emphasis> [append] [priority] <emphasis remap='I'>string</emphasis> <emphasis remap='I'>string</emphasis>+</term>
+  <listitem>
+<para>No default. You can set property for the script, each script have a different set of property. Both strings are quoted; the first string contains the name of
+the property to set, and the others contains its values.
+<emphasis remap='B'>append</emphasis> keyword append the values to the list of values for that property.
+<emphasis remap='B'>priority</emphasis> keyword disallow the setting of that property on the client.
+</para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</refsect1>
+
+<refsect1><title>DEVICE SECTION</title>
+<para>Backend storage devices are specified in
+<emphasis remap='B'>amanda.conf</emphasis>
+in the form of "device" sections, which look like this:</para>
+
+<programlisting>
+define device <emphasis remap='I'>name</emphasis> {
+    commend "<emphasis remap='I'>comment (optional)</emphasis>"
+    tapedev "<emphasis remap='I'>device-specifier</emphasis>"
+    device_property "<emphasis remap='I'>prop-name</emphasis>" "<emphasis remap='I'>prop-value</emphasis>"
+    <literal>...</literal>
+}
+</programlisting>
+
+<para><emphasis remap='I'>name</emphasis> is the user-specified name of
+this device. It is referenced from the global <emphasis
+remap='I'>tapedev</emphasis> parameter.  The <emphasis
+remap='I'>device-specifier</emphasis> specifies the device name to use;
+see <citerefentry><refentrytitle>amanda-devices</refentrytitle><manvolnum>7</manvolnum></citerefentry>.
+As with most sections, the <emphasis remap='I'>comment</emphasis>
+parmeter is optional and only for the user's convenience.</para>
+
+<para>An arbitrary number of <emphasis
+remap='I'>device_property</emphasis> parameters can be specified.
+Again, see
+<citerefentry><refentrytitle>amanda-devices</refentrytitle><manvolnum>7</manvolnum></citerefentry>
+for information on device properties.</para>
+
+</refsect1>
+
+<refsect1><title>CHANGER SECTION</title>
+<para>Changers are described in
+<emphasis remap='B'>amanda.conf</emphasis>
+in the form of "changer" sections, which look like this:</para>
+
+<programlisting>
+define changer <emphasis remap='I'>name</emphasis> {
+    comment "<emphasis remap='I'>comment (optional)</emphasis>"
+    tapedev "<emphasis remap='I'>tape-device</emphasis>"
+    tpchanger "<emphasis remap='I'>changer-type</emphasis>"
+    changerdev "<emphasis remap='I'>device-name</emphasis>"
+    changerfile "<emphasis remap='I'>state-file</emphasis>"
+    <literal>...</literal>
+}
+</programlisting>
+
+<para><emphasis remap='I'>name</emphasis> is the user-specified name of this
+device. The remaining parameters are specific to the changer type selected.
+</para>
+
+<para>
+TODO: more detail here once it's known
+</para>
+
 </refsect1>
 
 <refsect1><title>SEE ALSO</title>
diff --git a/man/xml-source/amarchiver.8.xml b/man/xml-source/amarchiver.8.xml
new file mode 100644 (file)
index 0000000..1722d7e
--- /dev/null
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"
+[
+  <!-- entities files to use -->
+  <!ENTITY % global_entities SYSTEM '../entities/global.entities'>
+  %global_entities;
+]>
+
+<refentry id='amarchiver.8'>
+
+<refmeta>
+<refentrytitle>amarchiver</refentrytitle>
+<manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
+</refmeta>
+<refnamediv>
+<refname>amarchiver</refname>
+<refpurpose>Create, extract or list amanda archive</refpurpose>
+</refnamediv>
+<refentryinfo>
+&author.dustin;
+&author.jlm;
+</refentryinfo>
+<!-- body begins here -->
+<refsynopsisdiv>
+<cmdsynopsis>
+  <command>amarchiver</command>
+    <arg choice='plain'>--version|--create|--extract|--list</arg>
+    <arg choice='opt'>--verbose</arg>
+    <arg choice='opt'>--file <replaceable>file</replaceable></arg>
+    <arg choice='plain' rep='repeat'><arg choice='opt'><replaceable>filename</replaceable></arg></arg>
+</cmdsynopsis>
+</refsynopsisdiv>
+
+<refsect1><title>DESCRIPTION</title>
+
+<para><emphasis remap='B'>Amarchiver</emphasis> manipulates amanda archive
+file.  On creation, amarchiver doesn't recurse into directories. If a filename
+specifies a directory, it will be ignored.  If it specifies a character device,
+amarchiver reads the device and archives the data.  If a filename specifies a
+named pipe, amarchiver reads the named pipe and archives the data.</para>
+
+<para>Note that this tool is more limited than the Amanda archive library, and
+may not be appropriate for some archive files -- particularly those which use
+non-strings in their filenames.</para>
+
+</refsect1>
+
+<refsect1><title>OPTIONS</title>
+<variablelist remap='TP'>
+  <varlistentry>
+  <term><option>--version</option></term>
+  <listitem>
+<para>print the amarchiver version</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><option>--create</option></term>
+  <listitem>
+
+<para>Create an amanda archive. Only the supplied filenames are included.  With one <option>--verbose</option>, lists the filenames.  With two, lists the filenames and sizes.</para>
+
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><option>--list</option></term>
+  <listitem>
+<para>List the filenames in an amanda archive.  No additional filenames are allowed on the command line.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><option>--extract</option></term>
+  <listitem>
+<para>Extract an amanda archive.  If filenames are supplied, only those files are extracted.  Files are created in the current directory, suffixed with a dot ('.') and the attribute ID.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><option>--verbose</option></term>
+  <listitem>
+<para>Give more information.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><option>--file</option> file</term>
+  <listitem>
+<para>Create, list or extract from the given file instead of stdin/stdout.</para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</refsect1>
+
+<refsect1><title>SEE ALSO</title>
+<para><citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry></para>
+<para><citerefentry><refentrytitle>amanda-archive-format</refentrytitle><manvolnum>5</manvolnum></citerefentry></para>
+</refsect1>
+</refentry>
index 0ee87d5ef46052a79af6950472d899490435c379..ada507228e8021a32108df9eeb82369afaf5a2e9 100644 (file)
 <refmeta>
 <refentrytitle>amcheck</refentrytitle>
 <manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
 </refmeta>
 <refnamediv>
 <refname>amcheck</refname>
 <refpurpose>run &A; self-checks</refpurpose>
 </refnamediv>
+<refentryinfo>
+&author.jds;
+&author.sgw.xml;
+</refentryinfo>
 <!-- body begins here -->
 <refsynopsisdiv>
 <cmdsynopsis>
@@ -418,10 +425,7 @@ in
       <varlistentry>
       <term>tapelist</term>
       <listitem>
-<para>for the &A; tapelist directory (see
-<emphasis remap='B'>tapelist</emphasis>
-in
-<emphasis remap='B'>amanda.conf</emphasis>)</para>
+<para>for the &tapelist;</para>
       </listitem>
       </varlistentry>
     </variablelist>
@@ -507,27 +511,13 @@ does not allow search permission.</para>
   <varlistentry>
   <term>ERROR: tape list <emphasis remap='I'>tapelist</emphasis>: not writable</term>
   <listitem>
-<para>(error)
-&A; tape list file
-<emphasis remap='I'>tapelist</emphasis>
-(see
-<emphasis remap='B'>tapelist</emphasis>
-in
-<emphasis remap='B'>amanda.conf</emphasis>)
-is not writable or was not found.</para>
+<para>(error) &tapelist; is not writable or was not found.</para>
   </listitem>
   </varlistentry>
   <varlistentry>
   <term>ERROR: tape list <emphasis remap='I'>tapelist</emphasis>: parse error</term>
   <listitem>
-<para>(error)
-&A; tape list file
-<emphasis remap='I'>tapelist</emphasis>
-(see
-<emphasis remap='B'>tapelist</emphasis>
-in
-<emphasis remap='B'>amanda.conf</emphasis>)
-could not be read or parsed.</para>
+<para>(error) &tapelist; could not be read or parsed.</para>
   </listitem>
   </varlistentry>
   <varlistentry>
@@ -870,11 +860,6 @@ The exit code of <command>amcheck</command> is one of:
 </programlisting>
 </refsect1>
 
-<refsect1><title>AUTHOR</title>
-<para>James da Silva, &email.jds; : Original text</para>
-<para>&maintainer.sgw;: XML-conversion</para>
-</refsect1>
-
 <refsect1><title>SEE ALSO</title>
 <para><citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
 <citerefentry><refentrytitle>amdump</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
index 7585a8ba91138783ee1c1998eef186e58a9d7a01..2b52a78b56c80dd13e9feabf889c4b1127f959ed 100644 (file)
 <refmeta>
 <refentrytitle>amcheckdb</refentrytitle>
 <manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
 </refmeta>
 <refnamediv>
 <refname>amcheckdb</refname>
 <refpurpose>check &A; database for tape consistency</refpurpose>
 </refnamediv>
+<refentryinfo>
+&author.atf3r;
+&author.sgw.xml;
+</refentryinfo>
 <!-- body begins here -->
 <refsynopsisdiv>
 <cmdsynopsis>
@@ -30,9 +37,7 @@
 <refsect1><title>DESCRIPTION</title>
 <para><emphasis remap='B'>Amcheckdb</emphasis>
 verifies that every tape mentioned in the &A; database
-is still valid in the
-<emphasis remap='I'>tapelist</emphasis>
-file.</para>
+is still valid in the &tapelist;.</para>
 
 <para>See the
 <citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>
@@ -49,9 +54,7 @@ Ready.
 
 <para>This shows tape
 <emphasis remap='I'>DMP014</emphasis>
-is still listed in the database but is no longer listed in the
-<emphasis remap='I'>tapelist</emphasis>
-file:</para>
+is still listed in the database but is no longer listed in the &tapelist;:</para>
 
 <programlisting>
 # amcheckdb daily
@@ -60,11 +63,6 @@ Ready.
 </programlisting>
 </refsect1>
 
-<refsect1><title>AUTHOR</title>
-<para>Adrian T. Filipi-Martin &lt;atf3r@cs.virginia.edu&gt;: Original text</para>
-<para>&maintainer.sgw;: XML-conversion</para>
-</refsect1>
-
 <refsect1><title>SEE ALSO</title>
 <para><citerefentry><refentrytitle>amadmin</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
 <citerefentry><refentrytitle>amrmtape</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
index e37da3558b731e45f72e5159ce4875c693dea8d2..47cb4e19ba451cb9f1214ef67ff9a092c1364f2b 100644 (file)
 <refmeta>
 <refentrytitle>amcheckdump</refentrytitle>
 <manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
 </refmeta>
 <refnamediv>
 <refname>amcheckdump</refname>
 <refpurpose>check the results of an &A; dump</refpurpose>
 </refnamediv>
+<refentryinfo>
+&author.ian;
+</refentryinfo>
 <!-- body begins here -->
 <refsynopsisdiv>
 <cmdsynopsis>
@@ -48,11 +54,6 @@ remap='B'>CONFIGURATION OVERRIDE</emphasis>" section in
 <citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>
 for information on the <literal>-o</literal> option.</para>
 </refsect1>
- <refsect1><title>SEE ALSO</title>
- <para><citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
- <ulink url="http://wiki.zmanda.com"/>
- </para>
- </refsect1> 
 
 <refsect1><title>EXAMPLE</title>
 <para><programlisting>
@@ -64,8 +65,9 @@ amcheckdump MYCONFIG --timestamp 19780615
 </programlisting></para>
 </refsect1>
  <refsect1><title>SEE ALSO</title>
- <para><citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>,  
- <citerefentry><refentrytitle>http://wiki.zmanda.com</refentrytitle></citerefentry>          
+ <para><citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+ <ulink url="http://wiki.zmanda.com"/>
  </para>
- </refsect1>                                                                          
+ </refsect1> 
+
 </refentry>
index 76c9f1d45f26179aaa907aacac2e50d125d53171..3e61f6b198d55f4316f293632a4a17001fd9e148 100644 (file)
 <refmeta>
 <refentrytitle>amcleanup</refentrytitle>
 <manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
 </refmeta>
 <refnamediv>
 <refname>amcleanup</refname>
 <refpurpose>run the &A; cleanup process after a failure</refpurpose>
 </refnamediv>
+<refentryinfo>
+&author.jds;
+&author.sgw.xml;
+</refentryinfo>
 <!-- body begins here -->
 <refsynopsisdiv>
 <cmdsynopsis>
   <command>amcleanup</command>    
     <arg choice='opt'><option>-k</option></arg>
+    <arg choice='opt'><option>-p</option></arg>
     <arg choice='opt'><option>-v</option></arg>
     <arg choice='plain'><replaceable>config</replaceable></arg>
 </cmdsynopsis>
@@ -52,7 +60,13 @@ man page for more details about &A;.</para>
   <varlistentry>
   <term><option>-k</option></term>
   <listitem>
-   <para>Kill all Amanda processes.</para>
+   <para>Kill all process listed in the log file are their child. if there is no log file, then kill all amdump and amflush process and their child.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><option>-p</option></term>
+  <listitem>
+   <para>Do the cleanup only if all process listed in the log file are already terminated.</para>
   </listitem>
   </varlistentry>
   <varlistentry>
@@ -90,11 +104,6 @@ amcleanup: no unprocessed logfile to clean up.
 </programlisting>
 </refsect1>
 
-<refsect1><title>AUTHOR</title>
-<para>James da Silva, &email.jds;: Original text</para>
-<para>&maintainer.sgw;: XML-conversion</para>
-</refsect1>
-
 <refsect1><title>SEE ALSO</title>
 <para><citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
 <citerefentry><refentrytitle>amdump</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
index 3c2a9740ea2dc6baac81cd7abed7a3c09e9293cb..ea0d7be5960b58d24694a6dff5599d9d73c84fdc 100644 (file)
 <refmeta>
   <refentrytitle>amcrypt-ossl-asym</refentrytitle>
   <manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
 </refmeta>
 <refnamediv>
   <refname>amcrypt-ossl-asym</refname>
   <refpurpose>crypt program for &A; asymmetric data encryption using OpenSSL</refpurpose>
 </refnamediv>
+<refentryinfo>
+&author.ktill;
+</refentryinfo>
 <!-- body begins here -->
 <refsynopsisdiv>
   <cmdsynopsis>
@@ -127,6 +133,7 @@ Writing RSA key
     </varlistentry>
   </variablelist>
 </refsect1>
+
 <refsect1>
   <title>SEE ALSO</title>
   <para>
index 1b6e7a2a14d34ef9fc2aa8f68511f42136e95296..6c966d9437bc0cb63c545b083a9d3bbd13286e5f 100644 (file)
 <refmeta>
   <refentrytitle>amcrypt-ossl</refentrytitle>
   <manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
 </refmeta>
 <refnamediv>
   <refname>amcrypt-ossl</refname>
   <refpurpose>crypt program for &A; symmetric data encryption using OpenSSL</refpurpose>
 </refnamediv>
+<refentryinfo>
+&author.ktill;
+</refentryinfo>
 <!-- body begins here -->
 <refsynopsisdiv>
   <cmdsynopsis>
@@ -68,6 +74,7 @@
     </varlistentry>
   </variablelist>
 </refsect1>
+
 <refsect1>
   <title>SEE ALSO</title>
   <para>
index 5d93ea30eca63ae9d3286af1ee433dc5817487d6..b4008bd6fbc781967941376102938a39cb76ec10 100755 (executable)
 <refmeta>
 <refentrytitle>amcrypt</refentrytitle>
 <manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
 </refmeta>
 <refnamediv>
 <refname>amcrypt</refname>
 <refpurpose>reference crypt program for &A; symmetric data encryption</refpurpose>
 </refnamediv>
+<refentryinfo>
+&author.ktill;
+</refentryinfo>
 <!-- body begins here -->
 <refsynopsisdiv>
 <cmdsynopsis>
index 29151e15b96ac88de34e49033d3de07ff40fcbc2..49bd78007e497dcca92903ddf05421a549f50399 100644 (file)
 <refmeta>
 <refentrytitle>amcryptsimple</refentrytitle>
 <manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
 </refmeta>
 <refnamediv>
 <refname>amcryptsimple</refname>
 <refpurpose>reference simple crypt program for &A; symmetric data encryption</refpurpose>
 </refnamediv>
+<refentryinfo>
+&author.ktill;
+</refentryinfo>
 <!-- body begins here -->
 <refsynopsisdiv>
 <cmdsynopsis>
@@ -52,12 +58,6 @@ restored with the passphrase. There is no backdoor.</para>
 encryption uses the public key to encrypt and uses the private key to decrypt.</para>
 </refsect1>
 
-<refsect1><title>AUTHOR</title>
-  <para>
-    The tool and its documentation was written by Zmanda, Inc (http://www.zmanda.com/). 
-  </para>
-</refsect1>
-
 <refsect1><title>SEE ALSO</title>
 <para><citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
 <citerefentry><refentrytitle>amanda.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
diff --git a/man/xml-source/amdd.8.xml b/man/xml-source/amdd.8.xml
deleted file mode 100644 (file)
index 02a206f..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
-                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"
-[
-  <!-- entities files to use -->
-  <!ENTITY % global_entities SYSTEM '../entities/global.entities'>
-  %global_entities;
-]>
-
-<!-- lifted from troff+man+tkman by doclifter -->
-<refentry id='amdd.8'>
-
-<!-- CO listing suppressed (not used) -->
-<refmeta>
-<refentrytitle>amdd</refentrytitle>
-<manvolnum>8</manvolnum>
-</refmeta>
-<refnamediv>
-<refname>amdd</refname>
-<refpurpose>&A; version of dd</refpurpose>
-</refnamediv>
-<!-- body begins here -->
-<refsynopsisdiv>
-<cmdsynopsis>
-  <command>amdd</command>    
-    <arg choice='opt'>-d </arg>
-    <arg choice='opt'><replaceable>if=input</replaceable></arg>
-    <arg choice='opt'><replaceable>of=output</replaceable></arg>
-    <arg choice='opt'><replaceable>bs=blocksize</replaceable></arg>
-    <arg choice='opt'><replaceable>skip=count</replaceable></arg>
-    <arg choice='opt'><replaceable>count=count</replaceable></arg>
-</cmdsynopsis>
-</refsynopsisdiv>
-
-
-<refsect1><title>DESCRIPTION</title>
-<para><emphasis remap='B'>Amdd</emphasis>
-provides just enough of the standard UNIX
-<emphasis remap='B'>dd</emphasis>
-command for the needs of &A;.
-This is handy when doing a full restore and the standard
-<emphasis remap='B'>dd</emphasis>
-program has not yet been found.</para>
-
-<para><emphasis remap='B'>Amdd</emphasis>
-also provides access to the &A; output drivers that support various tape simulations.
-This may be used for debugging or to convert from one format to another.</para>
-
-<para>See the
-<citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>
-man page for more details about &A;.
-See the
-<emphasis remap='B'>OUTPUT DRIVERS</emphasis>
-section of
-<emphasis remap='I'>amanda(8)</emphasis>
-for more information on the &A; output drivers.</para>
-</refsect1>
-
-<refsect1><title>OPTIONS</title>
-<variablelist remap='TP'>
-  <varlistentry>
-  <term><option>-d</option></term>
-  <listitem>
-<para>Turn on debugging output.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><option>-l</option><replaceable>length</replaceable></term>
-  <listitem>
-<para>Set the output length.
-If the output driver limits the output size, this controls
-when end of tape will be simulated.</para>
-<para><emphasis remap='I'>Length</emphasis>
-may have a multiplier suffix:</para>
-
-<literallayout>
-k -> 1024 (Kilobytes)
-b -> 512 (Blocks)
-M -> 1024*1024 (Megabytes)
-</literallayout>
-
-<para>The default is no multiplier (bytes).</para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-
-<variablelist remap='TP'>
-  <varlistentry>
-  <term><emphasis remap='B'>if=</emphasis><emphasis remap='I'>input</emphasis></term>
-  <listitem>
-<para>Input to
-<emphasis remap='B'>dd</emphasis>.
-Default is stdin.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>of=</emphasis><emphasis remap='I'>output</emphasis></term>
-  <listitem>
-<para>Where to send the output of
-<emphasis remap='B'>dd</emphasis>.
-Default is stdout.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>bs=</emphasis><emphasis remap='I'>blocksize</emphasis></term>
-  <listitem>
-<para>Size of each record.
-Input records smaller than this will
-<emphasis remap='I'>not</emphasis>
-be padded.
-Output records will be the same size as the corresponding input record.
-Default is 512 bytes.</para>
-<para><emphasis remap='I'>Blocksize</emphasis>
-may have a multiplier suffix:</para>
-<literallayout>
-k -> 1024 (Kilobytes)
-b -> 512 (Blocks)
-M -> 1024*1024 (Megabytes)
-</literallayout>
-<para>The default is no multiplier (bytes).</para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-
-<variablelist remap='TP'>
-  <varlistentry>
-  <term><emphasis remap='B'>count=</emphasis><emphasis remap='I'>count</emphasis></term>
-  <listitem>
-<para>Number of records to copy.
-Default is all records until end of file.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>skip=</emphasis><emphasis remap='I'>count</emphasis></term>
-  <listitem>
-<para>Number of records to skip before copying input to output.
-Default is zero.</para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-</refsect1>
-
-<refsect1><title>AUTHOR</title>
-<para>Marc Mengel <email>mengel@fnal.gov</email>, John R. Jackson
-<email>jrj@purdue.edu</email> : Original text</para>
-<para>&maintainer.sgw;: XML-conversion</para>
-</refsect1>
-
-<refsect1><title>SEE ALSO</title>
-<para>
-  <citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-  <ulink url="http://wiki.zmanda.com"/>
-</para>
-</refsect1>
-</refentry>
-
index d4ca82df9e7c4e79a6aa47330b04b23f5585978e..764607803bf31859b787b752817b2324b4070f2b 100644 (file)
   <refmeta>
     <refentrytitle>amdevcheck</refentrytitle>
     <manvolnum>8</manvolnum>
+    &rmi.source;
+    &rmi.version;
+    &rmi.manual.8;
   </refmeta>
   <refnamediv>
     <refname>amdevcheck</refname>
     <refpurpose>Validate an &A; device and volume.</refpurpose>
   </refnamediv>
+  <refentryinfo>
+    &author.ian;
+  </refentryinfo>
   <!-- body begins here -->
   <refsynopsisdiv>
     <cmdsynopsis>
     
     <para>See the
       <citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>
-      man page for more details about &A;.
-      See the
-      <emphasis remap='B'>OUTPUT DRIVERS</emphasis>
-      section of
-      <emphasis remap='I'>amanda(8)</emphasis>
-      for more information on the &A; output drivers.
+      man page for more details about &A;.  See
+      <citerefentry><refentrytitle>amanda-devices</refentrytitle><manvolnum>7</manvolnum></citerefentry>
+      for more information on devices.
   </para>
   </refsect1>
 
     </variablelist>
   </refsect1>
 
-  <refsect1><title>AUTHOR</title>
-    <para>
-      Ian Turner <email>ian@zmanda.com</email> and others. Authorship of this
-      tool and its documentation was funded by Zmanda, Inc.
-    </para>
+  <refsect1><title>OUTPUT</title>
+    <emphasis remap='B'>Amdevcheck</emphasis> returns one or more of the following lines. If multiple lines appear, then at least one, but not necessarily all of
+the messages apply.  This situation can occur when working with hardware or
+operating systems which cannot distinguish, for example, between a
+malfunctioning drive and a functional but unloaded drive.
+<!-- .RS -->
+      <variablelist remap='TP'>
+        <varlistentry>
+         <term><emphasis remap='B'>SUCCESS</emphasis></term>
+           <listitem><para>A tape is ready.</para></listitem>
+       </varlistentry>
+        <varlistentry>
+         <term><emphasis remap='B'>DEVICE_ERROR</emphasis></term>
+           <listitem><para>A device error has occurred.</para></listitem>
+       </varlistentry>
+        <varlistentry>
+          <term><emphasis remap='B'>DEVICE_BUSY</emphasis></term>
+           <listitem><para>The device is busy.</para></listitem>
+       </varlistentry>
+        <varlistentry>
+          <term><emphasis remap='B'>VOLUME_MISSING</emphasis></term>
+           <listitem><para>No tape is loaded in the drive.</para></listitem>
+       </varlistentry>
+        <varlistentry>
+          <term><emphasis remap='B'>VOLUME_UNLABELED</emphasis></term>
+           <listitem><para>The tape in the drive is unlabeled.</para></listitem>
+       </varlistentry>
+        <varlistentry>
+         <term><emphasis remap='B'>VOLUME_ERROR</emphasis></term>
+           <listitem><para>A volume error has occurred.</para></listitem>
+       </varlistentry>
+        <varlistentry>
+         <term><emphasis remap='B'>MESSAGE</emphasis> <emphasis remap='I'>text</emphasis></term>
+           <listitem><para>Where text provides a human-readable description of the problem.</para></listitem>
+       </varlistentry>
+       </variablelist>
   </refsect1>
 
   <refsect1><title>SEE ALSO</title>
index c559cfd8d7a15bb0b20fbc6ea741f5354941b1b5..5a6cba82e5ba0696322e52ee1f0cd10f463a7f54 100644 (file)
 <refmeta>
 <refentrytitle>amdump</refentrytitle>
 <manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
 </refmeta>
 <refnamediv>
 <refname>amdump</refname>
 <refpurpose>back up all disks in an &A; configuration</refpurpose>
 </refnamediv>
+<refentryinfo>
+&author.jds;
+&author.sgw.xml;
+</refentryinfo>
 <!-- body begins here -->
 <refsynopsisdiv>
 <cmdsynopsis>
@@ -135,11 +142,6 @@ The exit code of <command>amdump</command> is the ORed value of:
 </programlisting>
 </refsect1>
 
-<refsect1><title>AUTHOR</title>
-<para>James da Silva, &email.jds; : Original text</para>
-<para>&maintainer.sgw;: XML-conversion</para>
-</refsect1>
-
 <refsect1><title>SEE ALSO</title>
 <para>
   <citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
index 5a7d120f63a095a59079d55f34ade7bd4b2165c0..727f4ccfcdcc7e6adb666f3e8ecf067df2fe30f4 100644 (file)
 <refmeta>
 <refentrytitle>amfetchdump</refentrytitle>
 <manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
 </refmeta>
 <refnamediv>
 <refname>amfetchdump</refname>
 <refpurpose>extract backup images from multiple &A; tapes.</refpurpose>
 </refnamediv>
+<refentryinfo>
+&author.jstange;
+&author.ian;
+</refentryinfo>
 <!-- body begins here -->
 <refsynopsisdiv>
 <cmdsynopsis>
@@ -177,18 +184,16 @@ operation.</para></listitem>
 
 <para>Here's a simple case, restoring all known dumps of the host
 vanya to the current working directory.</para>
-<!-- .RS -->
-<literallayout remap='.nf'>
+<programlisting>
 $ amfetchdump SetA vanya
-</literallayout> <!-- .fi -->
+</programlisting>
 
 <para>A more likely scenario involves restoring a particular dump from
 a particular date. We'll pipe this one to &gnutar; as well, to
 automatically extract the dump.</para>
-<!-- .RS -->
-<literallayout remap='.nf'>
+<programlisting>
 $ amfetchdump -p SetA vanya /home 20051020 | gtar -xvpf -
-</literallayout> <!-- .fi -->
+</programlisting>
 
 </refsect1>
 
@@ -205,11 +210,6 @@ or
 instead.</para>
 </refsect1>
 
-<refsect1><title>AUTHOR</title>
-<para>John Stange, &email.jstange;, National Academies Press</para>
-<para>Ian Turner, &email.itt;: XML-conversion</para>
-</refsect1>
-
 <refsect1><title>SEE ALSO</title>
 <para><citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
 <citerefentry><refentrytitle>amadmin</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
index 24fde4e0af651f09c0678f2de94a6c7c5dda75d3..50b4760baa3db9a33b99700bc27a30e2889bb329 100644 (file)
 <refmeta>
 <refentrytitle>amflush</refentrytitle>
 <manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
 </refmeta>
 <refnamediv>
 <refname>amflush</refname>
 <refpurpose>flush &A; backup files from holding disk to tape</refpurpose>
 </refnamediv>
+<refentryinfo>
+&author.jds;
+&author.sgw.xml;
+</refentryinfo>
 <!-- body begins here -->
 <refsynopsisdiv>
 <cmdsynopsis>
@@ -39,7 +46,7 @@
 <refsect1><title>DESCRIPTION</title>
 <para><emphasis remap='B'>Amflush</emphasis>
 writes &A; backups from the holding disks to tape,
-and updates the &A; info database and tapelist accordingly.
+and updates the &A; info database and &tapelist; accordingly.
 Backups may stay in a holding disk when something is wrong with the tape
 at the time
 <emphasis remap='B'>amdump</emphasis>
@@ -151,7 +158,7 @@ a mail report similar to
 <citerefentry><refentrytitle>amdump</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
 
 <programlisting>
-% amflush daily
+% amflush MyConfig
 Scanning /amanda-hold...
   20001113: found &A; directory.
   20001114: found &A; directory.
@@ -169,6 +176,13 @@ Are you sure you want to do this? yes
 Running in background, you can log off now.
 You'll get mail when amflush is finished.
 </programlisting>
+
+<para>The following example causes amflush to flush everything to tape, then
+ejects tape, using 'at' to run the task in the background.</para>
+
+<programlisting>
+% echo 'amflush -b -f MyConfig &amp;&amp; mt offline' | at now
+</programlisting>
 </refsect1>
 
 <refsect1><title>EXIT CODE</title>
@@ -182,11 +196,6 @@ The exit code of <command>amflush</command> is the ORed value of:
 </programlisting>
 </refsect1>
 
-<refsect1><title>AUTHOR</title>
-<para>James da Silva, &email.jds; : Original text</para>
-<para>&maintainer.sgw;: XML-conversion</para>
-</refsect1>
-
 <refsect1><title>SEE ALSO</title>
 <para>
   <citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
index 9dab51140584b49b525b7710cbb7a271b220b368..5be005a1054a87833e177b1c785ed2b180aa2400 100644 (file)
 <refmeta>
 <refentrytitle>amgetconf</refentrytitle>
 <manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
 </refmeta>
 <refnamediv>
 <refname>amgetconf</refname>
-<refpurpose>look up amanda.conf variables</refpurpose>
+<refpurpose>look up configuration parameters and manipulate debug logs</refpurpose>
 </refnamediv>
+<refentryinfo>
+&author.jlm;
+</refentryinfo>
 <!-- body begins here -->
 <refsynopsisdiv>
 <cmdsynopsis>
   <command>amgetconf</command>    
+    <arg choice='opt'><replaceable>-l|--list</replaceable></arg>
+    <arg choice='plain' rep='repeat'><group><arg choice='plain'>-o </arg><replaceable>configoption</replaceable></group></arg>
+    <arg choice='opt'><replaceable>--client</replaceable></arg>
+    <arg choice='opt'><replaceable>--execute-where client|server</replaceable></arg>
     <arg choice='opt'><replaceable>config</replaceable></arg>
-    <arg choice='opt'><replaceable>--list</replaceable></arg>
     <arg choice='plain'><replaceable>parameter</replaceable></arg>
-    <arg choice='plain' rep='repeat'><group><arg choice='plain'>-o </arg><replaceable>configoption</replaceable></group></arg>
 </cmdsynopsis>
 </refsynopsisdiv>
 
-
 <refsect1><title>DESCRIPTION</title>
-<para><emphasis remap='B'>Amgetconf</emphasis>
-looks up parameters in
-<emphasis remap='I'>amanda.conf</emphasis>,
-the &A; configuration file,
-or from the build and runtime environment,
-and returns their corresponding value.</para>
-
-<para>If
-<emphasis remap='I'>config</emphasis>
-is not specified,
-<command>amgetconf</command>
-assumes it is being run from the configuration directory and that
-<emphasis remap='I'>amanda.conf</emphasis>
-is present.</para>
-
-<para>If
-<emphasis remap='I'>parameter</emphasis>
-begins with
-<emphasis remap='I'>build.</emphasis>,
-the (case insensitive) string following the period
-is a build environment variable.
-Variables without a value (e.g.
-<emphasis remap='I'>XFSDUMP</emphasis>
-on a system that does not support that type of file system)
-will not report an error and will return an empty string as the value.
-Flag variables (e.g.
-<emphasis remap='I'>USE_AMANDAHOSTS</emphasis>)
-will return
-<literal>1</literal>
-if the flag is set or an empty string if it is not.</para>
-
-<para>If
-<emphasis remap='I'>parameter</emphasis>
-begins with
-<emphasis remap='I'>dbopen.</emphasis>,
-the string following the period is a program name and an &A; debug
-file will be created for the caller.
-The name of the file is returned.</para>
-
-<para>If
-<emphasis remap='I'>parameter</emphasis>
-begins with
-<emphasis remap='I'>dbclose.</emphasis>,
-the string following the period is a program name previously used with
-<emphasis remap='I'>dbopen.</emphasis>,
-followed by a colon (:) and the previously opened file name.</para>
-
-<para>See the
+
+<para><emphasis remap='B'>Amgetconf</emphasis> has three main jobs:
+<!-- itemizedlist doesn't work in translation to a manpage.. --> to
+fetch configuration information from the Amanda configuration; to fetch
+build-time configuration values; and to open and close debug logs for
+shell scripts.  Each is treated in its own subsection, below.</para>
+
+<para>If <emphasis remap='I'>config</emphasis> is not
+specified, <command>amgetconf</command> assumes it is
+being run from the configuration directory and that <emphasis
+remap='I'>amanda.conf</emphasis> is present. The order of options and
+arguments does not matter.  <emphasis remap='I'>parameter</emphasis>
+is always case-insensitive, and '-' and '_' are treated as identical, just
+as in <citerefentry><refentrytitle>amanda.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
+
+<para>See the "<emphasis
+remap='B'>CONFIGURATION OVERRIDE</emphasis>" section in
 <citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>
-man page for more details about &A;.</para>
-</refsect1>
+for information on the <literal>-o</literal> option.</para>
 
-<refsect1><title>OPTIONS</title>
-<variablelist remap='TP'>
+<refsect2><title>AMANDA CONFIGURATION</title>
 
-  <varlistentry>
-  <term><emphasis remap='B'>--list</emphasis></term>
-  <listitem>
-<para>The parameter must be 'tapetype', 'dumptype, 'holdingdisk' or 'interface'. It will output, one by line, the list of identifier for the parameter.</para>
-<variablelist remap='TP'>
-<varlistentry>
-  <term>--list tapetype</term>
-  <listitem>
-    <para>Output the list of tapetype, one by line.</para>
-  </listitem>
-</varlistentry>
-<varlistentry>
-  <term>--list dumptype</term>
-  <listitem>
-    <para>Output the list of dumptype, one by line.</para>
-  </listitem>
-</varlistentry>
-<varlistentry>
-  <term>--list holdingdisk</term>
-  <listitem>
-    <para>Output the list of holdingdisk, one by line.</para>
-  </listitem>
-</varlistentry>
-<varlistentry>
-  <term>--list interface</term>
-  <listitem>
-    <para>Output the list of interface, one by line.</para>
-  </listitem>
-</varlistentry>
-</variablelist>
-  </listitem>
-  </varlistentry>
+<para>If <emphasis remap='I'>parameter</emphasis> is a configuration
+keyword (from <citerefentry> <refentrytitle>amanda.conf</refentrytitle>
+<manvolnum>5</manvolnum> </citerefentry>), then amgetconf will return
+the corresponding value.  For keywords which can take multiple values,
+amgetconf will return all values, one on each line.</para>
 
-  <varlistentry>
-  <term><emphasis remap='B'>parameter</emphasis></term>
-  <listitem>
-    <para>It could be one of the below format:</para>
-<variablelist remap='TP'>
-<varlistentry>
-    <term>runtapes</term><listitem><para></para></listitem>
-</varlistentry>
-<varlistentry>
-    <term>DUMPTYPE:no-compress:compress</term><listitem><para></para></listitem>
-</varlistentry>
-<varlistentry>
-    <term>TAPETYPE:HP-DAT:length</term><listitem><para></para></listitem>
-</varlistentry>
-<varlistentry>
-    <term>INTERFACE:local:use</term><listitem><para></para></listitem>
-</varlistentry>
-<varlistentry>
-    <term>HOLDINGDISK:hd1:use</term><listitem><para></para></listitem>
-</varlistentry>
-</variablelist>
-  </listitem>
-  </varlistentry>
+<para>Values in configuration subsections are specified with
+parameters of the form <literal>TYPE:NAME:PARAMETER</literal>,
+where <literal>TYPE</literal> is the subsection type (one
+of <literal>dumptype</literal>, <literal>tapetype</literal>,
+<literal>interface</literal>, <literal>holdingdisk</literal>,
+<literal>application-tool</literal>, or <literal>script-tool</literal>;
+<literal>NAME</literal> is the name of the subsection (e.g.,
+<literal>user-tar</literal>), and <literal>PARAMETER</literal> is
+the name of the disired parameter within that subsection.</para>
 
-<varlistentry>
-<term><emphasis remap='B'>-o</emphasis> <replaceable>configoption</replaceable></term>
-  <listitem>
-<para>See the "<emphasis remap='B'>CONFIGURATION OVERRIDE</emphasis>" section in <citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
-  </listitem>
-  </varlistentry>
+<para>The <literal>--list</literal> option lists the subsections of
+a certain type, where the type is givein as the parameter.</para>
+
+<para>The <literal>--client</literal> option is equivalent to 
+<literal>--execute-where server</literal> (below).</para>
+
+<para>The <literal>--execute-where</literal> option tells amgetconf whether
+to operate on the client or the server; the server is the default.</para>
+
+</refsect2>
+
+<refsect2><title>BUILD CONFIGURATION</title>
+
+<para>If <emphasis remap='I'>parameter</emphasis> begins
+with <literal>build.</literal>, then the following name is a
+build environment variable.  Variables without a value (e.g.
+<literal>XFSDUMP</literal> on a system that does not support that
+type of file system) will not report an error and will return an
+empty string as the value.  Some boolean variables (e.g.  <emphasis
+remap='I'>USE_AMANDAHOSTS</emphasis>) will return <literal>1</literal>
+if the flag is set or an empty string if it is not, while others
+return <literal>yes</literal> or <literal>no</literal>, as indicated
+below (the difference is historical).</para>
+
+<para>Combining the <literal>--list</literal> option with the parameter
+<literal>build</literal> will enumerate all available build parameters.</para>
+
+<variablelist><title>Build Parameters</title>
+ <varlistentry><term><literal>bindir</literal></term>
+               <term><literal>sbindir</literal></term>
+               <term><literal>libexecdir</literal></term>
+               <term><literal>mandir</literal></term>
+  <listitem><para>Install directories</para></listitem>
+ </varlistentry>
+
+ <varlistentry><term><literal>AMANDA_TMPDIR</literal></term>
+               <term><literal>CONFIG_DIR</literal></term>
+               <term><literal>AMANDA_DBGDIR</literal></term>
+               <term><literal>GNUTAR_LISTED_INCREMENTAL_DIR</literal></term>
+  <listitem><para>Runtime directories</para></listitem>
+ </varlistentry>
+ <varlistentry><term><literal>listed_inc_dir</literal></term>
+  <listitem><para>Same as <literal>GNUTAR_LISTED_INCREMENTAL_DIR</literal></para></listitem>
+ </varlistentry>
+
+ <varlistentry><term><literal>CC</literal></term>
+               <term><literal>VERSION</literal></term>
+               <term><literal>ASSERTIONS</literal></term>
+               <term><literal>LOCKING</literal></term>
+               <term><literal>USE_VERSION_SUFFIXES</literal></term>
 
+  <listitem><para>Build information.  <literal>ASSERTIONS</literal>
+  is 1 or empty, while <literal>USE_VERSION_SUFFIXES</literal> is
+  yes/no.</para></listitem>
+ </varlistentry>
 
+ <varlistentry><term><literal>DUMP</literal></term>
+               <term><literal>RESTORE</literal></term>
+               <term><literal>VDUMP</literal></term>
+               <term><literal>VRESTORE</literal></term>
+               <term><literal>XFSDUMP</literal></term>
+               <term><literal>XFSRESTORE</literal></term>
+               <term><literal>VXDUMP</literal></term>
+               <term><literal>VXRESTORE</literal></term>
+               <term><literal>SAMBA_CLIENT</literal></term>
+               <term><literal>GNUTAR</literal></term>
+               <term><literal>STAR</literal></term>
+               <term><literal>COMPRESS_PATH</literal></term>
+               <term><literal>UNCOMPRESS_PATH</literal></term>
+  <listitem><para>Paths to various utility progarms (empty if they
+  are not found or not used)</para></listitem>
+ </varlistentry>
+
+ <varlistentry><term><literal>AIX_BACKUP</literal></term>
+  <listitem><para>Is <literal>DUMP</literal> the AIX backup program? (empty or 1)</para></listitem>
+ </varlistentry>
+
+ <varlistentry><term><literal>DUMP_RETURNS_1</literal></term>
+  <listitem><para>Does <literal>DUMP</literal> return 1 on success? (empty or 1)</para></listitem>
+ </varlistentry>
+
+ <varlistentry><term><literal>BSD_SECURITY</literal></term>
+               <term><literal>BSDUDP_SECURITY</literal></term>
+               <term><literal>BSDTCP_SECURITY</literal></term>
+               <term><literal>KRB4_SECURITY</literal></term>
+               <term><literal>KRB5_SECURITY</literal></term>
+               <term><literal>SSH_SECURITY</literal></term>
+               <term><literal>RSH_SECURITY</literal></term>
+  <listitem><para>Indicate which authentication mechanisms are
+  available (yes or no).</para></listitem>
+ </varlistentry>
+
+ <varlistentry><term><literal>USE_AMANDAHOSTS</literal></term>
+  <listitem><para>Should the "bsd" authentication mechanism use
+  <filename>amandahosts</filename>?  (yes or no).</para></listitem>
+ </varlistentry>
+
+ <varlistentry><term><literal>AMANDA_DEBUG_DAYS</literal></term>
+  <listitem><para>Number of days after which debug logs are deleted.</para></listitem>
+ </varlistentry>
+
+ <varlistentry><term><literal>DEFAULT_SERVER</literal></term>
+               <term><literal>DEFAULT_CONFIG</literal></term>
+               <term><literal>DEFAULT_TAPE_SERVER</literal></term>
+               <term><literal>DEFAULT_TAPE_DEVICE</literal></term>
+  <listitem><para>Default values for configuration parameters</para></listitem>
+ </varlistentry>
+
+ <varlistentry><term><literal>CLIENT_LOGIN</literal></term>
+  <listitem><para>Userid under which the client runs (from
+  <literal>--with-user</literal>).</para></listitem>
+ </varlistentry>
+
+ <varlistentry><term><literal>USE_RUNDUMP</literal></term>
+  <listitem><para>Should Amanda use the <literal>rundump</literal>
+  wrapper? (empty or 1)</para></listitem>
+ </varlistentry>
+
+ <varlistentry><term><literal>CHECK_USERID</literal></term>
+  <listitem><para>Does Amanda check that userids are correct? (empty or 1)</para></listitem>
+ </varlistentry>
+
+ <varlistentry><term><literal>COMPRESS_SUFFIX</literal></term>
+               <term><literal>COMPRESS_FAST_OPT</literal></term>
+               <term><literal>COMPRESS_BEST_OPT</literal></term>
+               <term><literal>UNCOMPRESS_OPT</literal></term>
+  <listitem><para>Command-line options for the compression program.</para></listitem>
+ </varlistentry>
+
+ <varlistentry><term><literal>TICKET_LIFETIME</literal></term>
+               <term><literal>SERVER_HOST_PRINCIPAL</literal></term>
+               <term><literal>SERVER_HOST_INSTANCE</literal></term>
+               <term><literal>SERVER_HOST_KEY_FILE</literal></term>
+               <term><literal>CLIENT_HOST_PRINCIPAL</literal></term>
+               <term><literal>CLIENT_HOST_INSTANCE</literal></term>
+               <term><literal>CLIENT_HOST_KEY_FILE</literal></term>
+  <listitem><para>Kerberos parameters.</para></listitem>
+ </varlistentry>
 </variablelist>
+
+</refsect2>
+
+<refsect2><title>DEBUG LOG MANAGEMENT</title>
+
+<note>That this application is responsible for debug logs is a
+historical quirk, but the functionality is widely used.</note>
+
+<para>If <emphasis remap='I'>parameter</emphasis> begins with <emphasis
+remap='I'>dbopen.</emphasis>, the string following the period is a
+program name and an &A; debug file will be created for the caller.
+The name of the logfile is returned.</para>
+
+<para>If <emphasis remap='I'>parameter</emphasis> begins with
+<emphasis remap='I'>dbclose.</emphasis>, the string following
+the period is a program name previously used with <emphasis
+remap='I'>dbopen.</emphasis>, followed by a colon (:) and
+the previously opened file name.  The name of the logfile is
+returned.</para>
+
+</refsect2>
 </refsect1>
 
-<refsect1><title>EXAMPLE</title>
+
+<refsect1><title>EXAMPLES</title>
 <para>Find out the path to the log file directory:</para>
 
-<!-- .RS -->
-<literallayout remap='.nf'>
+<programlisting remap='.nf'>
 % amgetconf daily logdir
-/usr/local/etc/amanda//daily
-</literallayout> <!-- .fi -->
+/usr/local/etc/amanda/daily/logs
+</programlisting>
 
 <para>Find out the current tape type:</para>
-
-<!-- .RS -->
-<literallayout remap='.nf'>
+<programlisting remap='.nf'>
 % amgetconf daily tapetype
 DLT4000-IV
-</literallayout> <!-- .fi -->
+</programlisting>
 
-<para>Find out the default configuration directory:</para>
+<para>Find out that tape type's length:</para>
+<programlisting remap='.nf'>
+% amgetconf daily tapetype:DLT4000-IV:length
+1024000
+</programlisting>
 
-<!-- .RS -->
-<literallayout remap='.nf'>
-% amgetconf daily build.CONFIG_DIR
+<para>List the other available tapetype:</para>
+<programlisting remap='.nf'>
+% amgetconf daily --list tapetype
+DISK
+QIC-60
+DEC-DLT2000
+...
+</programlisting>
+
+<para>Find out the configuration directory:</para>
+<programlisting remap='.nf'>
+% amgetconf build.CONFIG_DIR
 /usr/local/etc/amanda/
-</literallayout> <!-- .fi -->
+</programlisting>
 
-<para>Create, use and close a debug file in a script:</para>
+<para>List all build-time parameters</para>
+<programlisting remap='.nf'>
+% amgetconf --list build
+AIX_BACKUP
+AMANDA_DBGDIR
+AMANDA_DEBUG_DAYS
+...
+</programlisting>
 
-<!-- .RS -->
-<literallayout remap='.nf'>
-% set debug_file = `amgetconf daily dbopen.myscript`
+<para>Create, use and close a debug file in a script:</para>
+<programlisting remap='.nf'>
+% debug_file=`amgetconf daily dbopen.myscript`
 % echo debug information &gt;&gt; $debug_file
 % amgetconf daily dbclose.myscript:$debug_file
-</literallayout> <!-- .fi -->
+</programlisting>
 </refsect1>
 
 <refsect1><title>MESSAGES</title>
 <variablelist remap='TP'>
   <varlistentry>
   <term>amgetconf: no such parameter <emphasis remap='I'>param</emphasis></term>
-  <listitem>
-<para>Parameter
-<emphasis remap='I'>param</emphasis>
-is not a known keyword
-(e.g. not a valid
-<emphasis remap='I'>amanda.conf</emphasis>
-keyword).
-</para>
-  </listitem>
+
+  <listitem><para>Parameter <emphasis remap='I'>param</emphasis>
+  is not a known keyword (e.g. not a valid <emphasis
+  remap='I'>amanda.conf</emphasis> keyword).</para></listitem>
   </varlistentry>
 </variablelist>
 </refsect1>
@@ -213,4 +310,3 @@ keyword).
 </para>
 </refsect1>
 </refentry>
-
index a2db4688d9e3066567d61e1c96bce1312800d51e..b8da64b133acf5fabf2d53d60c694293b8cf6a2a 100644 (file)
 <refmeta>
 <refentrytitle>amgpgcrypt</refentrytitle>
 <manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
 </refmeta>
 <refnamediv>
 <refname>amgpgcrypt</refname>
 <refpurpose>reference crypt program for &A; public-key data encryption</refpurpose>
 </refnamediv>
+<refentryinfo>
+&author.ktill;
+</refentryinfo>
 <!-- body begins here -->
 <refsynopsisdiv>
 <cmdsynopsis>
@@ -152,12 +158,6 @@ and protect it properly during other time.</para>
 mode. &amgpgcrypt; calls gpg with mdc disabled</para>
 </refsect1>
 
-<refsect1><title>AUTHOR</title>
-  <para>
-    The tool and its documentation was written by Zmanda, Inc (http://www.zmanda.com/). 
-  </para>
-</refsect1>
-
 <refsect1><title>SEE ALSO</title>
 <para>
   <citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
diff --git a/man/xml-source/amgtar.8.xml b/man/xml-source/amgtar.8.xml
new file mode 100644 (file)
index 0000000..480cedf
--- /dev/null
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"
+[
+  <!-- entities files to use -->
+  <!ENTITY % global_entities SYSTEM '../entities/global.entities'>
+  %global_entities;
+]>
+
+<refentry id='amgtar.8'>
+
+<refmeta>
+<refentrytitle>amgtar</refentrytitle>
+<manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
+</refmeta>
+<refnamediv>
+<refname>amgtar</refname>
+<refpurpose>Amanda Application to interface with GNU Tar</refpurpose>
+</refnamediv>
+<refentryinfo>
+&author.jlm;
+&author.dustin;
+</refentryinfo>
+<!-- body begins here -->
+
+<refsect1><title>DESCRIPTION</title>
+
+<para>Amgtar is an &A; Application API script.  It should not be run
+by users directly.  It uses GNU Tar to backup and restore data.</para>
+
+</refsect1>
+
+<refsect1><title>PROPERTIES</title>
+
+<para>This section lists the properties that control amgtar's functionality.
+See <citerefentry><refentrytitle>amanda-applications</refentrytitle><manvolnum>7</manvolnum></citerefentry>
+for information on application properties and how they are configured.</para>
+
+<!-- PLEASE KEEP THIS LIST IN ALPHABETICAL ORDER -->
+<variablelist>
+ <!-- ==== -->
+ <varlistentry><term>ATIME-PRESERVE</term><listitem>
+If "YES" (the default), amgtar use the <emphasis>--atime-preserve=system</emphasis> option of gnutar to not update the atime of all files accessed; if "NO", gnutar will updates the atime for all files accessed. This property works only if you have gnutar 1.15.90 or newer, if not, you must set ATIME_PRESERVE to "NO".
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>CHECK-DEVICE</term><listitem>
+If "YES" (the default), amgtar checks that the device number doesn't change for each file. If "NO", changes in device number are ignored.  To ignore device numbers, tar must support the <emphasis>--no-check-device</emphasis> option (gnutar 1.19.90 and newer). This option is needed for some filesystems and devices on which device numbers change frequently, such as LVM or FiberChannel.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>DIRECTORY</term><listitem>
+If set, gnutar will backup from that directory instead of the <emphasis>diskdevice</emphasis> set by the DLE.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>GNUTAR-LISTDIR</term><listitem>
+The directory where gnutar stores the database it uses to generate incremental dumps.  The default is set when &A; is built.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>GNUTAR-PATH</term><listitem>
+The path to the gnutar binary.  The default is set when &A; is built.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>ONE-FILE-SYSTEM</term><listitem>
+If "YES" (the default), do not allow gnutar to cross filesystem boundaries. If "NO", gnutar will cross filesystem boundaries.  This corresponds to the <emphasis>--one-filesystem</emphasis> option of gnutar.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>TAR-BLOCKSIZE</term><listitem>
+Block size of Nx512 bytes (default N=20).  This corresponds to the <emphasis>--blocking-factor</emphasis> option of gnutar.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>SPARSE</term><listitem>
+If "YES" (the default), gnutar will store sparse files efficiently. If "NO", then the <emphasis>--sparse</emphasis> option is not given to gnutar, and it will not try to detect sparse files.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>EXIT-HANDLING</term><listitem>
+List which exit status of gtar are good or bad. eg. "1=GOOD 2=BAD", exit status of 1 will produce a good backup, exit status of 2 will give an error.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>NORMAL</term><listitem>
+List all regex (POSIX Extended Regular Expression syntax) that are normal output from gtar. These output are in the "FAILED DUMP DETAILS" section of the email report if the dump result is STRANGE or FAILED. Default values:
+<programlisting>
+  "^could not open conf file"
+  "^Elapsed time:"
+  "^Throughput"
+  ": socket ignored$"
+  ": File .* shrunk by [0-9][0-9]* bytes, padding with zeros"
+  ": Cannot add file .*: No such file or directory$"
+  ": Error exit delayed from previous errors"
+</programlisting>
+<para>To treat one of these default patterns differently, specify it explicitly in a different property.</para>
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>IGNORE</term><listitem>
+List all regex (POSIX Extended Regular Expression syntax) that amanda ignore. These output are never in the email report. Default values:
+<programlisting>
+  ": Directory is new$"
+  ": Directory has been renamed"
+</programlisting>
+<para>To treat one of these default patterns differently, specify it explicitly in a different property.</para>
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>STRANGE</term><listitem>
+List all regex (POSIX Extended Regular Expression syntax) that are strange output from gtar. All gtar output that doesn't match a normal or ignore regex are strange by default. The result of the dump is STRANGE if gtar produce a strange output. These output are in the "FAILED DUMP DETAILS" section of the email report.
+</listitem></varlistentry>
+</variablelist>
+
+</refsect1>
+
+<refsect1><title>EXAMPLE</title>
+<programlisting>
+  define application-tool app_amgtar {
+    property "ATIME-PRESERVE" "NO"
+    property "CHECK-DEVICE" "YES"
+    property "GNUTAR-LISTDIR" "
+    property "GNUTAR-PATH" "/bin/tar"
+    property "ONE-FILE-SYSTEM" "YES"
+    property "TAR_BLOCKSIZE" "20"
+    property "SPARSE" "YES"
+    property "EXIT-HANDLING" "1=GOOD 2=BAD"
+    # change a default NORMAL regex to a STRANGE regex.
+    property "STRANGE" ": socket ignored$"
+    # add three new IGNORE regex
+    property "IGNORE" ": Directory is new$"
+    property append "IGNORE" ": Directory has been renamed"
+    property append "IGNORE" "file changed as we read it$"
+  }
+</programlisting>
+</refsect1>
+
+<refsect1><title>SEE ALSO</title>
+<para>
+<citerefentry><refentrytitle>amanda.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+<citerefentry><refentrytitle>amanda-applications</refentrytitle><manvolnum>7</manvolnum></citerefentry>
+</para>
+
+</refsect1>
+</refentry>
index 47717a0ab606046192fdabaf74a512820e933977..3e46026a55606882f4728f5544b917c57d90714f 100644 (file)
 <refmeta>
 <refentrytitle>amlabel</refentrytitle>
 <manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
 </refmeta>
 <refnamediv>
 <refname>amlabel</refname>
 <refpurpose>label an &A; tape</refpurpose>
 </refnamediv>
+<refentryinfo>
+&author.jds;
+&author.sgw.xml;
+</refentryinfo>
 <!-- body begins here -->
 <refsynopsisdiv>
 <cmdsynopsis>
@@ -51,8 +58,7 @@ regular expression option.
 It is up to the system administrator to define a naming convention.</para>
 
 <para><emphasis remap='B'>Amlabel</emphasis>
-appends the new tape to the
-<emphasis remap='I'>tapelist</emphasis>
+appends the new tape to the &tapelist;
 file so it will be used by &A; before it reuses any other tapes.
 When you
 <command>amlabel</command>
@@ -178,11 +184,6 @@ instead of a non-rewinding device name for
 </variablelist>
 </refsect1>
 
-<refsect1><title>AUTHOR</title>
-<para>James da Silva, &email.jds;: Original text</para>
-<para>&maintainer.sgw;: XML-conversion</para>
-</refsect1>
-
 <refsect1><title>SEE ALSO</title>
 <para><citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
 <citerefentry><refentrytitle>amdump</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
diff --git a/man/xml-source/ammt.8.xml b/man/xml-source/ammt.8.xml
deleted file mode 100644 (file)
index 509eef8..0000000
+++ /dev/null
@@ -1,226 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
-                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"
-[
-  <!-- entities files to use -->
-  <!ENTITY % global_entities SYSTEM '../entities/global.entities'>
-  %global_entities;
-]>
-
-<!-- lifted from troff+man by doclifter -->
-<refentry id='ammt.8'>
-
-<refmeta>
-<refentrytitle>ammt</refentrytitle>
-<manvolnum>8</manvolnum>
-</refmeta>
-<refnamediv>
-<refname>ammt</refname>
-<refpurpose>&A; version of mt</refpurpose>
-</refnamediv>
-<!-- body begins here -->
-<refsynopsisdiv>
-<cmdsynopsis>
-  <command>ammt</command>    
-    <arg choice='opt'>-d </arg>
-    <group choice='opt'><arg choice='plain'>-f </arg><arg choice='plain'>-t </arg><arg choice='plain'><replaceable>device</replaceable></arg></group>
-    <arg choice='plain'><replaceable>command</replaceable></arg>
-    <arg choice='opt'><replaceable>count</replaceable></arg>
-</cmdsynopsis>
-</refsynopsisdiv>
-
-
-<refsect1><title>DESCRIPTION</title>
-<para><emphasis remap='B'>Ammt</emphasis>
-provides just enough of the standard UNIX
-<emphasis remap='B'>mt</emphasis>
-command for the needs of &A;.
-This is handy when doing a full restore and the standard
-<emphasis remap='B'>mt</emphasis>
-program has not yet been found.</para>
-
-<para><emphasis remap='B'>Ammt</emphasis>
-also provides access to the &A; output drivers that support
-various tape simulations.</para>
-
-<para>See the
-<citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>
-man page for more details about &A;.
-See the
-<emphasis remap='B'>OUTPUT DRIVERS</emphasis>
-section of
-<emphasis remap='I'>amanda(8)</emphasis>
-for more information on the &A; output drivers.</para>
-</refsect1>
-
-<refsect1><title>OPTIONS</title>
-<variablelist remap='TP'>
-  <varlistentry>
-  <term><option>-d</option></term>
-  <listitem>
-<para>Turn on debugging output.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><option>-f</option><replaceable> device</replaceable></term>
-  <listitem>
-<para>Access tape device
-<emphasis remap='I'>device</emphasis>.
-If not specified, the
-<emphasis remap='B'>TAPE</emphasis>
-environment variable is used.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><option>-t</option><replaceable> device</replaceable></term>
-  <listitem>
-<para>Same as
-<option>-f</option>.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>command</emphasis><emphasis remap='I'> count</emphasis></term>
-  <listitem>
-<para>Which command to issue, and an optional count of operations.</para>
-  </listitem>
-  </varlistentry>
-</variablelist>
-</refsect1>
-
-<refsect1><title>COMMANDS</title>
-<para>Each command may be abbreviated to whatever length makes it unique.</para>
-<variablelist remap='TP'>
-  <varlistentry>
-  <term><emphasis remap='B'>eof|weof</emphasis><emphasis remap='I'> count</emphasis></term>
-  <listitem>
-<para>Write
-<emphasis remap='I'>count</emphasis>
-(default: 1) end of file marks (tapemarks).</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>fsf</emphasis><emphasis remap='I'> count</emphasis></term>
-  <listitem>
-<para>Skip forward
-<emphasis remap='I'>count</emphasis>
-(default: 1) files.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>bsf</emphasis><emphasis remap='I'> count</emphasis></term>
-  <listitem>
-<para>Skip backward
-<emphasis remap='I'>count</emphasis>
-(default: 1) files.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>asf</emphasis><emphasis remap='I'> count</emphasis></term>
-  <listitem>
-<para>Position to file number
-<emphasis remap='I'>count</emphasis>
-(default: 0)
-where zero is beginning of tape.
-This is the same as a
-<emphasis remap='B'>rewind</emphasis>
-followed by a
-<emphasis remap='B'>fsf</emphasis>
-<emphasis remap='I'>count</emphasis>.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>rewind</emphasis></term>
-  <listitem>
-<para>Rewind to beginning of tape.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>offline|rewoffl</emphasis></term>
-  <listitem>
-<para>Rewind to beginning of tape and unload the tape from the drive.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>status</emphasis></term>
-  <listitem>
-<para>Report status information about the drive.
-Which data reported, and what it means,
-depends on the underlying operating system,
-and may include:</para>
-    <variablelist remap='TP'>
-      <varlistentry>
-      <term>ONLINE</term>
-      <listitem>
-<para>Indicates the drive is online and ready.</para>
-      </listitem>
-      </varlistentry>
-      <varlistentry>
-      <term>OFFLINE</term>
-      <listitem>
-<para>Indicates the drive is offline or not ready.</para>
-      </listitem>
-      </varlistentry>
-      <varlistentry>
-      <term>BOT</term>
-      <listitem>
-<para>Indicates the drive is at beginning of tape.</para>
-      </listitem>
-      </varlistentry>
-      <varlistentry>
-      <term>EOT</term>
-      <listitem>
-<para>Indicates the drive is at end of tape.</para>
-      </listitem>
-      </varlistentry>
-      <varlistentry>
-      <term>PROTECTED</term>
-      <listitem>
-<para>Indicates the tape is write protected.</para>
-      </listitem>
-      </varlistentry>
-      <varlistentry>
-      <term>ds</term>
-      <listitem>
-<para>Device status.</para>
-      </listitem>
-      </varlistentry>
-      <varlistentry>
-      <term>er</term>
-      <listitem>
-<para>Error register.</para>
-      </listitem>
-      </varlistentry>
-      <varlistentry>
-      <term>fileno</term>
-      <listitem>
-<para>Current tape file number.</para>
-      </listitem>
-      </varlistentry>
-      <varlistentry>
-      <term>blkno</term>
-      <listitem>
-<para>Current tape block number file.</para>
-      </listitem>
-      </varlistentry>
-    </variablelist>
-  </listitem>
-  </varlistentry>
-</variablelist>
-
-<note><para>Many systems only report good data when a tape is in the drive and ready.</para>
-</note>
-</refsect1>
-
-<refsect1><title>AUTHOR</title>
-<para>Marc Mengel <email>mengel@fnal.gov</email>, John R. Jackson
-<email>jrj@purdue.edu</email>: Original text</para>
-<para>&maintainer.sgw;: XML-conversion</para>
-</refsect1>
-
-<refsect1><title>SEE ALSO</title>
-<para><citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
- <ulink url="http://wiki.zmanda.com"/>
-</para>
-</refsect1>
-</refentry>
-
index 910eded0ad83aeaeed1662ddb603ed158b684c73..cef7a8a3b57a69e340be3a23a5796319c5da20d5 100644 (file)
 <refmeta>
 <refentrytitle>amoverview</refentrytitle>
 <manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
 </refmeta>
 <refnamediv>
 <refname>amoverview</refname>
 <refpurpose>display file systems processed by &A; over time</refpurpose>
 </refnamediv>
+<refentryinfo>
+&author.sgw.xml;
+</refentryinfo>
 <!-- body begins here -->
 <refsynopsisdiv>
 <cmdsynopsis>
index eac7c387d01811cc3b0e6a16a7925d99fe92d091..5fa8fc086dca5fff0747dbe75147e0ff21583e7c 100644 (file)
 <refmeta>
 <refentrytitle>amplot</refentrytitle>
 <manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
 </refmeta>
 <refnamediv>
 <refname>amplot</refname>
 <refpurpose>visualize the behavior of &A;</refpurpose>
 </refnamediv>
+<refentryinfo>
+&author.ogud;
+&author.sgw.xml;
+</refentryinfo>
 <!-- body begins here -->
 <refsynopsisdiv>
 <cmdsynopsis>
@@ -188,13 +195,6 @@ This process can take a while if hosts are down
 or it takes them a long time to generate estimates.</para>
 </refsect1>
 
-<refsect1><title>AUTHOR</title>
-<para>Olafur Gudmundsson <email>ogud@tis.com</email>,
-Trusted Information Systems,
-formerly at University of Maryland, College Park: Original text</para>
-<para>&maintainer.sgw;: XML-conversion</para>
-</refsect1>
-
 <refsect1><title>BUGS</title>
 <para>Reports lines it does not recognize, mainly error cases but some are
 legitimate lines the program needs to be taught about.</para>
index 38770b33d9649da77bc05eb93e7d1ab00637d56a..722658a25bcea6411cafcd0105432c905851cb2b 100644 (file)
 <refmeta>
 <refentrytitle>amrecover</refentrytitle>
 <manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
 </refmeta>
 <refnamediv>
 <refname>amrecover</refname>
 <refpurpose>&A; index database browser</refpurpose>
 </refnamediv>
+<refentryinfo>
+&author.alan;
+&author.sgw.xml;
+</refentryinfo>
 <!-- body begins here -->
 <refsynopsisdiv>
 <cmdsynopsis>
@@ -45,7 +52,7 @@ to move into that directory, otherwise a directory tree that resembles
 the backed up filesystem will be created in the current directory.
 See the examples below for details.</para>
 
-<para>Amrecover will read the <emphasis remap='B'>amanda-client.conf</emphasis> file and the <replaceable>config</replaceable><emphasis remap='B'>/amanda-client.conf</emphasis> file.</para>
+<para>Amrecover will read the <emphasis remap='B'>amanda-client.conf</emphasis> file and the <replaceable>config</replaceable><emphasis remap='B'>/amanda-client.conf</emphasis> file.  If no configuration name is supplied on the command line, Amrecover will try the compiled-in default configuration ,usually <emphasis remap='B'>DailySet1</emphasis>.</para>
 
 <para>See the
 <citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>
@@ -178,9 +185,7 @@ It can only be set after the host is set with
 <emphasis remap='I'>Diskname</emphasis>
 is the device name specified in the
 <emphasis remap='I'>amanda.conf</emphasis>
-or
-<emphasis remap='I'>disklist</emphasis>
-configuration file.
+or &disklist;.
 The disk must be local to the host.
 If
 <emphasis remap='I'>mountpoint</emphasis>
@@ -213,8 +218,7 @@ If the tape device is omitted, the default is used.</para>
 <emphasis remap='I'>tapedev</emphasis>
 must be equal to the amrecover_changer setting on the server.</para>
 
-<para>If you need to change the protocol (tape:, rait:, file:, null:) then you
-must specify the hostname.</para>
+<para>Since device names contain colons, you must always specify the hostname.</para>
 
 <programlisting>
 settape 192.168.0.10:file:/file1
@@ -411,12 +415,12 @@ file.</para>
 # cd /var/log
 # ls -l syslog.7
 syslog.7: No such file or directory
-# amrecover
+# amrecover MyConfig
 AMRECOVER Version 2.4.2. Contacting server on oops ...
 220 oops &A; index server (2.4.2) ready.
 Setting restore date to today (1997-12-09)
 200 Working date set to 1997-12-09.
-200 Config set to daily.
+200 Config set to MyConfig.
 200 Dump host set to this-host.some.org.
 $CWD '/var/log' is on disk '/var' mounted at '/var'.
 200 Disk set to /var.
@@ -539,7 +543,7 @@ The first backup image is in file position one.</para>
 AMRECOVER Version 2.4.2. Contacting server on oops ...
 ...
 amrecover&gt; history
-200- Dump history for config &quot;daily&quot; host &quot;this-host.some.org&quot; disk &quot;/var&quot;
+200- Dump history for config &quot;MyConfig&quot; host &quot;this-host.some.org&quot; disk &quot;/var&quot;
 201- 1997-12-09 1 DMP015 9
 201- 1997-12-08 1 DMP014 11
 201- 1997-12-07 0 DMP013 22
@@ -579,11 +583,6 @@ but will be overridden by the -t switch.
 <!-- .RE -->
 </refsect1>
 
-<refsect1><title>AUTHOR</title>
-<para>Alan M. McIvor <email>alan@kauri.auck.irl.cri.nz</email> : Original text</para>
-<para>&maintainer.sgw;: XML-conversion</para>
-</refsect1>
-
 <refsect1><title>SEE ALSO</title>
 <para><citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
 <citerefentry><refentrytitle>amanda-client.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
index 38e7fbea06b74fee5b7de333031f365a96c4db22..72c5395942aaf44361ef4ab03f1240cd57739a9d 100644 (file)
 <refmeta>
 <refentrytitle>amreport</refentrytitle>
 <manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
 </refmeta>
 <refnamediv>
 <refname>amreport</refname>
 <refpurpose>generate a formatted output of statistics for an &A; run</refpurpose>
 </refnamediv>
+<refentryinfo>
+&author.sgw.xml;
+</refentryinfo>
 <!-- body begins here -->
 <refsynopsisdiv>
 <cmdsynopsis>
index 009e7df18cae51c6c43e0a3ca6320cccd0e09500..50064fc75cf0daeb85f833bbe3ab596e9611d87d 100644 (file)
 <refmeta>
 <refentrytitle>amrestore</refentrytitle>
 <manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
 </refmeta>
 <refnamediv>
 <refname>amrestore</refname>
 <refpurpose>extract backup images from an &A; tape</refpurpose>
 </refnamediv>
+<refentryinfo>
+&author.jds;
+&author.sgw.xml;
+</refentryinfo>
 <!-- body begins here -->
 <refsynopsisdiv>
 <cmdsynopsis>
@@ -331,12 +338,6 @@ the GNUTAR dumptype.
 Vendor tar programs sometimes fail to read GNU tar images.</para>
 </refsect1>
 
-<refsect1><title>AUTHOR</title>
-<para>James da Silva, &email.jds;, University of Maryland,
-College Park: Original text</para>
-<para>&maintainer.sgw;: XML-conversion</para>
-</refsect1>
-
 <refsect1><title>SEE ALSO</title>
 <para><citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
 <citerefentry><refentrytitle>amdump</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
index acdcb78dca5c02777bf0fa91923f46cc9d6c2456..359da03a0a54b4b3dfdc1109e4e80d7d6d3ad55c 100644 (file)
 <refmeta>
 <refentrytitle>amrmtape</refentrytitle>
 <manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
 </refmeta>
 <refnamediv>
 <refname>amrmtape</refname>
 <refpurpose>remove a tape from the &A; database</refpurpose>
 </refnamediv>
+<refentryinfo>
+&author.atf3r;
+&author.sgw.xml;
+</refentryinfo>
 <!-- body begins here -->
 <refsynopsisdiv>
 <cmdsynopsis>
@@ -50,9 +57,7 @@ man page for more details about &A;.</para>
   <varlistentry>
   <term><option>-n</option></term>
   <listitem>
-<para>Generate new
-<emphasis remap='I'>tapelist</emphasis>
-and database files with
+<para>Generate new &tapelist; and database files with
 <emphasis remap='I'>label</emphasis>
 removed, but leave them in
 <filename>/tmp</filename>
@@ -93,11 +98,6 @@ configuration.</para>
 </programlisting>
 </refsect1>
 
-<refsect1><title>AUTHOR</title>
-<para>Adrian T. Filipi-Martin <email>atf3r@cs.virginia.edu</email>: Original text</para>
-<para>&maintainer.sgw;: XML-conversion</para>
-</refsect1>
-
 <refsect1><title>SEE ALSO</title>
 <para><citerefentry><refentrytitle>amadmin</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
 <citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
diff --git a/man/xml-source/amsamba.8.xml b/man/xml-source/amsamba.8.xml
new file mode 100644 (file)
index 0000000..4722149
--- /dev/null
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"
+[
+  <!-- entities files to use -->
+  <!ENTITY % global_entities SYSTEM '../entities/global.entities'>
+  %global_entities;
+]>
+
+<refentry id='amsamba.8'>
+
+<refmeta>
+<refentrytitle>amsamba</refentrytitle>
+<manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
+</refmeta>
+<refnamediv>
+<refname>amsamba</refname>
+<refpurpose>Amanda Application to interface with smbclient</refpurpose>
+</refnamediv>
+<refentryinfo>
+&author.jlm;
+</refentryinfo>
+<!-- body begins here -->
+
+<refsect1><title>DESCRIPTION</title>
+
+<para>Amsamba is an &A; Application API script.  It should not be run
+by users directly.  It uses smbclient to backup and restore data.</para>
+
+<para>The device name in the disklist must have the form '//HOST/SHARE/SUBDIR'
+where HOST is the CIFS host, SHARE is the share to connect and subdir is the
+subdirectory to backup.  '/subdir' can be ommited, in which case the complete
+share is archived.  The host in the disklist should be the name of an
+intermediate host that has smbclient installed, and is often the Amanda server
+itself.</para>
+
+<para>Include or exclude can be used, but not both. The path for 'exclude list'
+or 'include list' must be absolute path on the client. The estimate calculates
+the complete size of the share, without regard for include or exclude
+directives.  It will be larger than the actual dump if you use include or
+exclude.  Using 'estimate server' in the dumptype could give better
+estimate.</para>
+
+</refsect1>
+
+<refsect1><title>PROPERTIES</title>
+
+<para>This section lists the properties that control amsamba's functionality.
+See <citerefentry><refentrytitle>amanda-applications</refentrytitle><manvolnum>7</manvolnum></citerefentry>
+for information on application properties and how they are configured.</para>
+
+<!-- PLEASE KEEP THIS LIST IN ALPHABETICAL ORDER -->
+<variablelist>
+ <!-- ==== -->
+ <varlistentry><term>SMBCLIENT-PATH</term><listitem>
+The path to the smbclient binary.  The default is set when &A; is built.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>GNUTAR-PATH</term><listitem>
+The path to the gnutar binary.  The default is set when &A; is built. gnutar
+is use to create the index.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>AMANDAPASS</term><listitem>
+Location of the amandapass file, The default is "/etc/amandapass".
+The format of the file is as follow:
+<programlisting>
+  Sharename User%Password Domain
+</programlisting>
+Sharename is '//HOST/SHARE' without the SUBDIR.
+Sharename can be quoted,
+it can be '*' to match all share,
+it can be '//pc-host/*' to match all share on pc-host.
+User is the username use to connect to the share.
+Password is the password use to connect to the share.
+Domain is optional. Example:
+<programlisting>
+  //another-pc/share otheruser%otherpw domain
+</programlisting>
+</listitem></varlistentry>
+</variablelist>
+
+</refsect1>
+
+<refsect1><title>SEE ALSO</title>
+<para>
+<citerefentry><refentrytitle>amanda.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+<citerefentry><refentrytitle>amanda-applications</refentrytitle><manvolnum>7</manvolnum></citerefentry>
+</para>
+
+</refsect1>
+</refentry>
index 22a4f44473f06d1f22a1b8f33f0e29e0488b1dfd..97b5826280819dff9c1ba9589ce60e90ceaff019 100644 (file)
 <refmeta>
 <refentrytitle>amserverconfig</refentrytitle>
 <manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
 </refmeta>
 <refnamediv>
 <refname>amserverconfig</refname>
 <refpurpose>program to setup initial &A; configuration</refpurpose>
 </refnamediv>
+<refentryinfo>
+&author.ktill;
+</refentryinfo>
 <!-- body begins here -->
 <refsynopsisdiv>
 <cmdsynopsis>
@@ -233,13 +239,6 @@ is supported.</para>
 On success, zero is returned.  On error, 1 is returned.
 </refsect1>
 
-<refsect1><title>AUTHOR</title>
-  <para>
-    The tool and its documentation was written by Zmanda, Inc (http://www.zmanda.com/). 
-  </para>
-</refsect1>
-
-
 <refsect1><title>SEE ALSO</title>
 <para><citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
 <citerefentry><refentrytitle>amanda.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
diff --git a/man/xml-source/amservice.8.xml b/man/xml-source/amservice.8.xml
new file mode 100644 (file)
index 0000000..de36456
--- /dev/null
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"
+[
+  <!-- entities files to use -->
+  <!ENTITY % global_entities SYSTEM '../entities/global.entities'>
+  %global_entities;
+]>
+
+<!-- lifted from troff+man by doclifter -->
+
+<refentry id='amservice.8'>
+
+<refmeta>
+<refentrytitle>amservice</refentrytitle>
+<manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
+</refmeta>
+<refnamediv>
+<refname>amservice</refname>
+<refpurpose>run an amanda service on a client</refpurpose>
+</refnamediv>
+<refentryinfo>
+&author.jlm;
+</refentryinfo>
+<!-- body begins here -->
+<refsynopsisdiv>
+<cmdsynopsis>
+  <command>amservice</command>    
+    <arg choice='plain'><replaceable>hostname</replaceable></arg>
+    <arg choice='plain'><replaceable>auth</replaceable></arg>
+    <arg choice='plain'><replaceable>service</replaceable></arg>
+    <arg choice='opt'><arg choice='plain'>-f</arg><arg choice='plain'><replaceable>input_file</replaceable></arg></arg>
+    <arg choice='plain' rep='repeat'><group><arg choice='plain'>-o </arg><replaceable>configoption</replaceable></group></arg>
+</cmdsynopsis>
+</refsynopsisdiv>
+
+
+<refsect1><title>DESCRIPTION</title>
+<para><emphasis remap='B'>Amservice</emphasis>
+execute an &A; service on a client.
+It can be used without amanda server configuration (amanda.conf and disklist).
+It can be used to check communication between a server and a client.
+Amservice reads stdin to capture the REQ packet to send to the client.</para>
+<para>See the
+<citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+man page for more details about &A;.</para>
+</refsect1>
+
+<refsect1><title>OPTIONS</title>
+<variablelist remap='TP'>
+  <varlistentry>
+  <term><emphasis remap='B'>hostname</emphasis></term>
+  <listitem>
+<para>The hostname of the client.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><option>auth</option></term>
+  <listitem>
+<para>The auth to use, one of: bsd, bsdudp, bsdtcp, ssh, rsh or krb5.
+The client must be configured with this auth.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><option>service</option></term>
+  <listitem>
+<para>The amanda service to execute on the client. One of noop, selfcheck or sendsize.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><option>-f input_file</option></term>
+  <listitem>
+<para>Use the file input_file instead of stdin to read the REQ packet from.</para>
+  </listitem>
+  </varlistentry>
+
+  <varlistentry>
+  <term><emphasis remap='B'>-o</emphasis> <replaceable>configoption</replaceable></term>
+  <listitem>
+<para>See the "<emphasis remap='B'>CONFIGURATION OVERRIDE</emphasis>" section in <citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
+  </listitem>
+  </varlistentry>
+
+</variablelist>
+</refsect1>
+
+<refsect1><title>EXAMPLE</title>
+
+<para>The noop service is easy to execute because it does not require a REQ packet:</para>
+<programlisting>amservice hostname bsdtcp noop &lt; /dev/null</programlisting>
+<para>The example executes the noop service on the client using bsdtcp auth.
+This is useful for debugging connection problems.
+It print an OPTIONS line upon success.</para>
+
+<para>It is more difficult to execute the selfcheck or sendsize service, as these require a valid REQ packet. If you have already uccessfully run amanda, you can find valid REQ packets in the amandad.*.debug files.</para>
+</refsect1>
+
+<refsect1><title>EXIT CODE</title>
+The exit code of <command>amservice</command> is one of:
+<programlisting>
+ 0  = success
+ 1  = error executing amandad on the client.
+</programlisting>
+<para>As <command>amservice</command> doesn't parse the REP packet,
+it can only detect failures in executing amandad on the client.
+<command>amservice</command> can exit with value 0 even if the user
+is not authorized to execute the service.  An error message will be printed.
+</para>
+</refsect1>
+
+<refsect1><title>SEE ALSO</title>
+<para><citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+<citerefentry><refentrytitle>amcheck</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+<citerefentry><refentrytitle>amdump</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+<citerefentry><refentrytitle>amadmin</refentrytitle><manvolnum>8</manvolnum></citerefentry></para>
+</refsect1>
+</refentry>
+
diff --git a/man/xml-source/amstar.8.xml b/man/xml-source/amstar.8.xml
new file mode 100644 (file)
index 0000000..036035b
--- /dev/null
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"
+[
+  <!-- entities files to use -->
+  <!ENTITY % global_entities SYSTEM '../entities/global.entities'>
+  %global_entities;
+]>
+
+<refentry id='amstar.8'>
+
+<refmeta>
+<refentrytitle>amstar</refentrytitle>
+<manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
+</refmeta>
+<refnamediv>
+<refname>amstar</refname>
+<refpurpose>Amanda Application to interface with star</refpurpose>
+</refnamediv>
+<refentryinfo>
+&author.jlm;
+&author.dustin;
+</refentryinfo>
+<!-- body begins here -->
+
+<refsect1><title>DESCRIPTION</title>
+
+<para>Amstar is an &A; Application API script.  It should not be run
+by users directly.  It uses star to backup and restore data.</para>
+
+</refsect1>
+
+<refsect1><title>PROPERTIES</title>
+
+<para>This section lists the properties that control amstar's functionality.
+See <citerefentry><refentrytitle>amanda-applications</refentrytitle><manvolnum>7</manvolnum></citerefentry>
+for information on application properties and how they are configured.</para>
+
+<!-- PLEASE KEEP THIS LIST IN ALPHABETICAL ORDER -->
+<variablelist>
+ <!-- ==== -->
+ <varlistentry><term>ONE-FILE-SYSTEM</term><listitem>
+If "YES" (the default), do not allow star to cross filesystem boundaries. If "NO", star will cross filesystem boundaries.  This corresponds to the <emphasis>-xdev</emphasis> option of star.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>SPARSE</term><listitem>
+If "YES" (the default), star will store sparse files efficiently. If "NO", then the <emphasis>-sparse</emphasis> option is not given to star, and it will not try to detect sparse files.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>STAR-DLE-TARDUMP</term><listitem>
+If "YES", amstar will use a different tardump file for each DLE. The default is "NO".  This property is needed with older versions of star doing many dumps in parallel, because of a race condition in updating the tardump file.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>STAR-PATH</term><listitem>
+The path to the star binary.  The default is set when &A; is built.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>STAR-TARDUMP</term><listitem>
+The directory where star stores the database it uses to generate incremental dumps.  The default is set when &A; is built.
+</listitem></varlistentry>
+</variablelist>
+
+</refsect1>
+
+<refsect1><title>SEE ALSO</title>
+<para>
+<citerefentry><refentrytitle>amanda.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+<citerefentry><refentrytitle>amanda-applications</refentrytitle><manvolnum>7</manvolnum></citerefentry>
+</para>
+
+</refsect1>
+</refentry>
index 10730239f3c6635dba6b37a56c47ee71b3f01341..bf90a9a3ed44725ad1ec68591fb217d6965ae317 100644 (file)
 <refmeta>
 <refentrytitle>amstatus</refentrytitle>
 <manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
 </refmeta>
 <refnamediv>
 <refname>amstatus</refname>
 <refpurpose>display the state of an &A; run</refpurpose>
 </refnamediv>
+<refentryinfo>
+&author.sgw.xml;
+</refentryinfo>
 <!-- body begins here -->
 <refsynopsisdiv>
 <cmdsynopsis>
index 0d650526369fe9b6a6a146e0547c369d166bf24c..db4d20cf0347cdbe6777c28568f9da7bf35524fd 100644 (file)
 <refmeta>
 <refentrytitle>amtape</refentrytitle>
 <manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
 </refmeta>
 <refnamediv>
 <refname>amtape</refname>
 <refpurpose>user interface to &A; tape changer controls</refpurpose>
 </refnamediv>
+<refentryinfo>
+&author.jds;
+&author.sgw.xml;
+</refentryinfo>
 <!-- body begins here -->
 <refsynopsisdiv>
 <cmdsynopsis>
@@ -145,14 +152,6 @@ and reset
   <listitem>
 <para>Eject any tape in the drive and put it away,
 then load the tape from the current slot.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>slot prev</emphasis></term>
-  <listitem>
-<para>Eject any tape in the drive and put it away,
-then load the tape from the previous slot and reset
-<emphasis remap='I'>current</emphasis>.</para>
   </listitem>
   </varlistentry>
   <varlistentry>
@@ -168,24 +167,13 @@ then load the tape from the next slot and reset
   <listitem>
 <para>Eject any tape in the drive and put it away,
 then load the tape from the first slot and reset
-<emphasis remap='I'>current</emphasis>.</para>
-  </listitem>
-  </varlistentry>
-  <varlistentry>
-  <term><emphasis remap='B'>slot last</emphasis></term>
-  <listitem>
-<para>Eject any tape in the drive and put it away,
-then load the tape from the last slot and reset
 <emphasis remap='I'>current</emphasis>.</para>
   </listitem>
   </varlistentry>
   <varlistentry>
   <term><emphasis remap='B'>slot advance</emphasis></term>
   <listitem>
-<para>Eject any tape in the drive and put it away.
-Advance
-<emphasis remap='I'>current</emphasis>
-to the next tape, but do not load it.</para>
+<para>Synonym for <emphasis remap='B'>slot next</emphasis>.</para>
   </listitem>
   </varlistentry>
 
@@ -217,11 +205,6 @@ does an unnecessary mount.</para>
 commands to not eject the loaded tape if it is the one being requested.</para>
 </refsect1>
 
-<refsect1><title>AUTHOR</title>
-<para>James da Silva, &email.jds; : Original text</para>
-<para>&maintainer.sgw;: XML-conversion</para>
-</refsect1>
-
 <refsect1><title>SEE ALSO</title>
 <para><citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
 <ulink url="http://wiki.zmanda.com"/>
index 06dbae4e8719137971d9555ddad1779725e7875e..9f96324490d7a0b99bb78422243f33a2261fac5d 100644 (file)
 <refmeta>
 <refentrytitle>amtapetype</refentrytitle>
 <manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
 </refmeta>
 <refnamediv>
 <refname>amtapetype</refname>
-<refpurpose>generate a tapetype definition.</refpurpose>
+<refpurpose>generate a tapetype definition by testing the device directly</refpurpose>
 </refnamediv>
+<refentryinfo>
+&author.dustin;
+&author.jlm;
+</refentryinfo>
 <!-- body begins here -->
 <refsynopsisdiv>
 <cmdsynopsis>
   <command>amtapetype</command>    
     <arg choice='opt'>-h </arg>
     <arg choice='opt'>-c </arg>
-    <arg choice='opt'>-o </arg>
+    <arg choice='opt'>-f </arg>
     <arg choice='opt'>-b <replaceable>blocksize</replaceable></arg>
-    <arg choice='plain'>-e <replaceable>estsize</replaceable></arg>
-    <arg choice='opt'>-f <replaceable>tapedev</replaceable></arg>
     <arg choice='opt'>-t <replaceable>typename</replaceable></arg>
+    <arg choice='opt'>-l <replaceable>label</replaceable></arg>
+    <arg choice='opt'>-o <replaceable>config_overwrite</replaceable></arg>
+    <arg><replaceable>device</replaceable></arg>
 </cmdsynopsis>
 </refsynopsisdiv>
 
-
 <refsect1><title>DESCRIPTION</title>
 <para><emphasis remap='B'>amtapetype</emphasis>
-generates a tapetype entry for &A;.</para>
+generates a tapetype entry for &A; by testing the device directly</para>
 </refsect1>
 
 <refsect1><title>OPTIONS</title>
+<note><para>The options for &amtapetype; have changed in version 2.6.1</para></note>
 <variablelist remap='TP'>
   <varlistentry>
   <term><option>-h</option></term>
   <listitem>
-<para>Display an help message.</para>
+<para>Display the help message.</para>
   </listitem>
   </varlistentry>
   <varlistentry>
@@ -55,35 +63,34 @@ This takes a few minutes only.</para>
   </listitem>
   </varlistentry>
   <varlistentry>
-  <term><option>-o</option></term>
+  <term><option>-f</option></term>
   <listitem>
-<para>Overwrite the tape, even if it's an &A; tape.</para>
+<para>Run amtapetype even if the loaded volume is already in use or compression
+is enabled.</para>
   </listitem>
   </varlistentry>
   <varlistentry>
   <term><option>-b</option><replaceable> blocksize</replaceable></term>
   <listitem>
-<para>record block size (default: 32k)</para>
+<para>block size to use with the device (default: 32k)</para>
   </listitem>
   </varlistentry>
   <varlistentry>
-  <term><option>-e</option><replaceable> estsize</replaceable></term>
+  <term><option>-t</option> <replaceable>typename</replaceable></term>
   <listitem>
-<para>estimated tape size (No default!)</para>
+<para>Name to give to the new tapetype definition.</para>
   </listitem>
   </varlistentry>
   <varlistentry>
-  <term><option>-f</option><replaceable> tapedev</replaceable></term>
+  <term><option>-l</option><replaceable> label</replaceable></term>
   <listitem>
-<para>tape device name (default: $TAPE)
-The device to perform the test.</para>
+<para>Label to write on the tape (default is randomly generated).</para>
   </listitem>
   </varlistentry>
   <varlistentry>
-  <term><option>-t</option><replaceable> typename</replaceable></term>
+  <term><option>-o</option> <replaceable>configoption</replaceable></term>
   <listitem>
-<para>tapetype name (default: unknown-tapetype)</para>
-<!-- .PD -->
+<para>See the "<emphasis remap='B'>CONFIGURATION OVERRIDE</emphasis>" section in <citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
   </listitem>
   </varlistentry>
 </variablelist>
@@ -94,65 +101,34 @@ The device to perform the test.</para>
 
 <!-- .RS -->
 <literallayout remap='.nf'>
-% amtapetype -f /dev/nst0 -e 150G
+% amtapetype -f /dev/nst0
 </literallayout></refsect1>
 
 <refsect1><title>NOTES</title>
-<para>Hardware compression is detected by measuring
-the writing speed difference of the tape drive
-when writing an amount of compressable and uncompresseable data.
-It does not rely on the status bits of the tape drive or the OS parameters.
-If your tape drive has very large buffers or is very fast, the program
-could fail to detect hardware compression status reliably.</para>
-
-<para>During the first pass, it writes files that are estimated to be 1%
-of the expected tape capacity.  It gets the expected capacity from
-the -e command line flag, or defaults to 1 GByte.  In a perfect world
-(which means there is zero chance of this happening with tapes :-),
-there would be 100 files and 100 file marks.</para>
-
-<para>During the second pass, the file size is cut in half.  In that same
-fairyland world, this means 200 files and 200 file marks.</para>
-
-<para>In both passes the total amount of data written is summed as well as the
-number of file marks written.  At the end of the second pass, quoting
-from the code:</para>
-
-<para>* Compute the size of a filemark as the difference in data written
-between pass 1 and pass 2 divided by the difference in number of
-file marks written between pass 1 and pass 2. ... *</para>
-
-<para>So if we wrote 1.0 GBytes on the first pass and 100 file marks, and
-0.9 GBytes on the second pass with 200 file marks, those additional 100
-file marks in the second pass took 0.1 GBytes and therefor a file mark
-is 0.001 GBytes (1 MByte).</para>
-
-<para>Note that if the estimated capacity is wrong, the only thing that happens
-is a lot more (or less, but unlikely) files, and thus, file marks,
-get written.  But the math still works out the same.  The -e flag is
-there to keep the number of file marks down because they can be slow
-(since they force the drive to flush all its buffers to physical media).</para>
-
-<para>All sorts of things might happen to cause the amount of data
-written to vary enough to generate a big file mark size guess.  A little
-more &quot;shoe shining&quot; because of the additional file marks (and flushes),
+<para>If the device cannot reliably report its comprssion status (and as of
+this writing, no devices can do so), hardware compression is detected by
+measuring the writing speed difference of the tape drive when writing an amount
+of compressable and uncompresseable data.  If your tape drive has very large
+buffers or is very fast, the program could fail to detect hardware compression
+status reliably.</para>
+
+<para>Volume capacity is determined by writing one large file until an error,
+interpereted as end-of-tape, is encountered.  In the next phase, about 100
+files are written to fill the tape.  This second phase will write less data,
+because each filemark consumes some tape.  With a little arithmetic,
+&amtapetype; calculates the size of these filemarks.</para>
+
+<para>All sorts of things might happen to cause the amount of data written to
+vary enough to generate a strange file mark size guess.  A little more
+&quot;shoe shining&quot; because of the additional file marks (and flushes),
 dirt left on the heads from the first pass of a brand new tape, the
-temperature/humidity changed during the multi-hour run, a different amount
-of data was written after the last file mark before EOT was reported, etc.</para>
+temperature/humidity changed during the multi-hour run, a different amount of
+data was written after the last file mark before EOT was reported, etc.</para>
 
 <para>Note that the file mark size might really be zero for whatever device this
 is, and it was just the measured capacity variation that caused &amtapetype;
 to think those extra file marks in pass 2 actually took up space.</para>
 
-<para>It also explains why &amtapetype; used to sometimes report a negative file
-mark size if the math happened to end up that way.  When that happens
-now we just report it as zero.</para>
 </refsect1>
 
-<refsect1><title>SEE ALSO</title>
-<para><citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-<ulink url="http://wiki.zmanda.com"/>
-</para>
-</refsect1>
 </refentry>
-
index b4eb1eb1be7bec0871cd25a8de019522b3897809..303bc23a46676e9024102e22844ccaf9da7f1360 100644 (file)
 <refmeta>
 <refentrytitle>amtoc</refentrytitle>
 <manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
 </refmeta>
 <refnamediv>
 <refname>amtoc</refname>
 <refpurpose>generate TOC (Table Of Contents) for an &A; run</refpurpose>
 </refnamediv>
+<refentryinfo>
+&author.nm;
+&author.sgw.xml;
+</refentryinfo>
 <!-- body begins here -->
 <refsynopsisdiv>
 <cmdsynopsis>
@@ -160,9 +167,5 @@ perl,
 </para>
 </refsect1>
 
-<refsect1><title>AUTHOR</title>
-<para>Nicolas Mayencourt <email>Nicolas.Mayencourt@cui.unige.ch</email>, University of Geneva/Switzerland : Original text</para>
-<para>&maintainer.sgw;: XML-conversion</para>
-</refsect1>
 </refentry>
 
diff --git a/man/xml-source/amvault.8.xml b/man/xml-source/amvault.8.xml
new file mode 100644 (file)
index 0000000..fd337ea
--- /dev/null
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"
+[
+  <!-- entities files to use -->
+  <!ENTITY % global_entities SYSTEM '../entities/global.entities'>
+  %global_entities;
+]>
+
+<refentry id='amvault.8'>
+<refmeta>
+<refentrytitle>amvault</refentrytitle>
+<manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
+</refmeta>
+<refnamediv>
+<refname>amvault</refname>
+<refpurpose>Copy &A; dumps from one volume to another</refpurpose>
+</refnamediv>
+<refentryinfo>
+&author.dustin;
+</refentryinfo>
+<!-- body begins here -->
+<refsynopsisdiv>
+<cmdsynopsis>
+  <command>amvault</command>
+    <arg choice='plain' rep='repeat'><group><arg choice='plain'>-o </arg><replaceable>configoption</replaceable></group></arg>
+    <arg choice='plain'><replaceable>config</replaceable></arg>
+    <arg choice='plain'><replaceable>src-run-timestamp</replaceable></arg>
+    <arg choice='plain'><replaceable>dst-changer</replaceable></arg>
+    <arg choice='plain'><replaceable>label-template</replaceable></arg>
+</cmdsynopsis>
+</refsynopsisdiv>
+
+<refsect1><title>WARNING</title>
+<para>This application is not yet in its final form, and is subject to major revision
+in subsequent versions of Amanda.  Backward compatibility is not guaranteed.</para>
+
+<para>The significant limitations of this version of amvault are: tapetypes for
+secondary and tertiary volumes much match (including length and
+device_properties); tertiary volumes must be blank (manual erasure is required
+to re-use tertiary media; restore/recover operations will request tertiary
+media by label when dumpfiles are not found on secondary media, but there is no
+provision to automatically fetch such media from a different changer; and all
+dumpfiles on a secondary volume are moved to tertiary media - there is no
+provision to filter dumps.</para>
+
+<para>Feedback on and patches to this application are invited and
+encouraged!</para>
+
+</refsect1>
+
+<refsect1><title>DESCRIPTION</title>
+
+<para><emphasis remap='B'>Amvault</emphasis> Copies data from the run with
+timestamp <emphasis remap='I'>src-run-timestamp</emphasis> onto volumes using
+the changer <emphasis remap='I'>dst-changer</emphasis>, labeling new volumes
+with <emphasis remap='I'>label-template</emphasis>.  If <emphasis
+remap='I'>src-run-timestamp</emphasis> is "latest", then the most recent amdump
+or amflush run will be used.</para>
+
+<para>In a vaulting operation, the source media is referred to as "secondary
+media", while the destination is referred to as "tertiary media".</para>
+
+<para>Each source volume will be copied to a new destination volume; no
+re-assembly or splitting will be performed.  Destination volumes must be at
+least as large as the source volumes.</para>
+
+<para>The changer parameter should specify the name of a changer defined in
+&amconf;.  For example:
+<programlisting>
+define changer vaulting_tape {
+    tapedev "/dev/rmt/1n"
+    tpchanger "chg-zd-mtx"
+    changerdev "/dev/sg0"
+    changerfile "vaulting-changer.conf"
+}
+</programlisting></para>
+
+<para>The label template functions identically to the <emphasis
+remap='I'>label-new-tapes</emphasis> parameter in &amconf;.</para>
+
+</refsect1>
+
+<refsect1><title>SEE ALSO</title>
+<para><citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry></para>
+</refsect1>
+</refentry>
+
diff --git a/man/xml-source/amverify.8.xml b/man/xml-source/amverify.8.xml
deleted file mode 100644 (file)
index f68db90..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
-                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"
-[
-  <!-- entities files to use -->
-  <!ENTITY % global_entities SYSTEM '../entities/global.entities'>
-  %global_entities;
-]>
-
-<!-- lifted from troff+man by doclifter -->
-<refentry id='amverify.8'>
-
-<refmeta>
-<refentrytitle>amverify</refentrytitle>
-<manvolnum>8</manvolnum>
-</refmeta>
-<refnamediv>
-<refname>amverify</refname>
-<refpurpose>check an Amanda tape for errors</refpurpose>
-</refnamediv>
-<!-- body begins here -->
-<refsynopsisdiv>
-<cmdsynopsis>
-  <command>amverify</command>    
-    <arg choice='plain'><replaceable>config</replaceable></arg>
-    <arg choice='opt'><arg choice='plain'><replaceable>slot</replaceable></arg><arg choice='opt'><replaceable>runtapes</replaceable></arg></arg>
-</cmdsynopsis>
-</refsynopsisdiv>
-
-
-<refsect1><title>DESCRIPTION</title>
-<para><emphasis remap='B'>Amverify</emphasis>
-reads an Amanda format tape and makes sure each backup image
-can be processed by
-<emphasis remap='B'>amrestore</emphasis>
-and, if possible, the appropriate restore program (e.g.
-<emphasis remap='B'>tar</emphasis>).</para>
-
-<para><emphasis remap='B'>Amverify</emphasis>
-runs
-<emphasis remap='B'>amrestore</emphasis>
-on each file of the tape and pipes the output
-to a restore program (if available) with an option to create a catalogue
-of the backup.
-The catalogue itself is discarded.
-Only the success or failure of the operation itself is reported.</para>
-
-<para>If the backup image cannot be processed by the restore program,
-e.g. if it was written on a different operating system,
-the image is sent through
-<emphasis remap='B'>dd</emphasis>
-to /dev/null.
-This still determines if the tape is readable,
-but does not do any internal consistency check on the image.</para>
-
-<para>If
-<emphasis remap='I'>config</emphasis>
-is set up to use a tape changer,
-the
-<emphasis remap='I'>slot</emphasis>
-argument may be used to choose the first tape to process.
-Otherwise,
-the
-<emphasis remap='B'>current</emphasis>
-slot is used.</para>
-
-<para>The
-<emphasis remap='B'>runtapes</emphasis>
-configuration parameter determines how many tapes are processed unless
-it is specified on the command line.</para>
-
-<para>See the
-<citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>
-man page for more details about Amanda.</para>
-</refsect1>
-
-<refsect1><title>AUTHOR</title>
-<para>Axel Zinser <email>fifi@icem.de</email> : Original text</para>
-<para>&maintainer.sgw;: XML-conversion</para>
-</refsect1>
-
-<refsect1><title>SEE ALSO</title>
-<para><citerefentry><refentrytitle>amrestore</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-<citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-<citerefentry><refentrytitle>amverifyrun</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-<ulink url="http://wiki.zmanda.com"/>
-</para>
-</refsect1>
-</refentry>
-
diff --git a/man/xml-source/amverifyrun.8.xml b/man/xml-source/amverifyrun.8.xml
deleted file mode 100644 (file)
index 24043a6..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
-                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"
-[
-  <!-- entities files to use -->
-  <!ENTITY % global_entities SYSTEM '../entities/global.entities'>
-  %global_entities;
-]>
-
-<!-- lifted from troff+man by doclifter -->
-<refentry id='amverifyrun.8'>
-<refmeta>
-<refentrytitle>amverifyrun</refentrytitle>
-<manvolnum>8</manvolnum>
-</refmeta>
-<refnamediv>
-<refname>amverifyrun</refname>
-<refpurpose>check the tapes written by the last &A; run</refpurpose>
-</refnamediv>
-<!-- body begins here -->
-<refsynopsisdiv>
-<cmdsynopsis>
-  <command>amverifyrun</command>    
-    <arg choice='plain'><replaceable>config</replaceable></arg>
-</cmdsynopsis>
-</refsynopsisdiv>
-
-
-<refsect1><title>DESCRIPTION</title>
-<para><emphasis remap='B'>Amverifyrun</emphasis>
-read the log from the last &A; run to find the slot of the first tape
-used and the number of tapes used.
-It call
-<emphasis remap='B'>amverify</emphasis>
-with these argument.</para>
-
-</refsect1>
-
-<refsect1><title>SEE ALSO</title>
-<para><citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-<citerefentry><refentrytitle>amverify</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
-<ulink url="http://wiki.zmanda.com"/>
-</para>
-</refsect1>
-</refentry>
-
diff --git a/man/xml-source/amzfs-sendrecv.8.xml b/man/xml-source/amzfs-sendrecv.8.xml
new file mode 100644 (file)
index 0000000..c97a921
--- /dev/null
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"
+[
+  <!-- entities files to use -->
+  <!ENTITY % global_entities SYSTEM '../entities/global.entities'>
+  %global_entities;
+]>
+
+<refentry id='amzfs-sendrecv.8'>
+
+<refmeta>
+<refentrytitle>amzfs-sendrecv</refentrytitle>
+<manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
+</refmeta>
+<refnamediv>
+<refname>amzfs-sendrecv</refname>
+<refpurpose>Amanda script to create zfs sendrecv</refpurpose>
+</refnamediv>
+<refentryinfo>
+&author.jlm;
+</refentryinfo>
+<!-- body begins here -->
+
+<refsect1><title>DESCRIPTION</title>
+
+<para>amzfs-sendrecv is an &A; application implementing the Application API.
+It should not be run by users directly.
+It create a zfs snapshot of the filesystem and backup the snapshot with 'zfs send'.
+Snapshot are kept after the backup is done, this increase the disk space use on the client but it is neccesary to be able do to incremental backup.
+If you want only full backup, you can disable this feature by setting the KEEP-SNAPSHOT property to 'NO'.
+Only the restoration of the complete backup is allowed, it is impossible to restore a single file.</para>
+
+<para>The application is run as the amanda user, it must have many zfs priviledge:
+<programlisting>
+    zfs allow -ldu AMANDA_USER mount,create,rename,snapshot,destroy,send,receive FILESYSTEM
+</programlisting></para>
+
+<para>Some system doesn't have "zfs allow", but you can give the Amanda backup user the rights to manipulate ZFS filesystems by using the following command:
+<programlisting>
+usermod -P "ZFS File System Management,ZFS Storage Management" AMANDA_USER
+</programlisting>
+This will require that your run zfs under pfexec, set the PFEXEC property to YES.</para>
+
+<para>The format of the DLE must be one of:
+<programlisting>
+Desciption              Example
+----------              -------
+Mountpoint              /data
+ZFS pool name           datapool
+ZFS filesystem          datapool/database
+ZFS logical volume      datapool/dbvol
+</programlisting></para>
+
+<para>The filesystem doesn't need to be mounted.</para>
+
+</refsect1>
+
+<refsect1><title>PROPERTIES</title>
+
+<para>This section lists the properties that control amzfs-sendrecv's functionality.
+See <citerefentry><refentrytitle>amanda-applications</refentrytitle><manvolnum>7</manvolnum></citerefentry>
+for information on the Application API, application configuration.</para>
+
+<!-- PLEASE KEEP THIS LIST IN ALPHABETICAL ORDER -->
+<variablelist>
+ <!-- ==== -->
+ <varlistentry><term>DF-PATH</term><listitem>
+Path to the 'df' binary, search in $PATH by default.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>KEEP-SNAPSHOT</term><listitem>
+If "YES" (the default), snapshot are kept after the backup, if set to "NO" then snapshot are no kept and incremental backup will fail.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>ZFS-PATH</term><listitem>
+Path to the 'zfs' binary, search in $PATH by default.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>PFEXEC-PATH</term><listitem>
+Path to the 'pfexec' binary, search in $PATH by default.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>PFEXEC</term><listitem>
+If "NO" (the default), pfexec is not used, if set to "YES" then pfexec is used.
+</listitem></varlistentry>
+</variablelist>
+
+</refsect1>
+
+<refsect1><title>EXAMPLE</title>
+
+In this example, a dumptype is defined to use amzfs-sendrecv application to backup a zfs filesystem.
+
+<programlisting>
+ define application-tool amzfs_sendrecv {
+   comment "amzfs-sendrecv"
+   plugin "amzfs-sendrecv"
+   #property "DF-PATH"  "/usr/sbin/df"
+   #property "KEEP-SNAPSHOT" "YES"
+   #property "ZFS-PATH" "/usr/sbin/zfs"
+   #property "PFEXEC-PATH" "/usr/sbin/pfexec"
+   #property "PFEXEC" "NO"
+ }
+
+ define dumptype user-zfs-sendrecv {
+   program "APPLICATAION"
+   application "amzfs_sendrecv"
+ }
+</programlisting>
+</refsect1>
+
+<refsect1><title>SEE ALSO</title>
+<para>
+<citerefentry><refentrytitle>amanda.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+<citerefentry><refentrytitle>amanda-client.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+<citerefentry><refentrytitle>amanda-applications</refentrytitle><manvolnum>7</manvolnum></citerefentry>
+</para>
+
+</refsect1>
+</refentry>
diff --git a/man/xml-source/amzfs-snapshot.8.xml b/man/xml-source/amzfs-snapshot.8.xml
new file mode 100644 (file)
index 0000000..f679de9
--- /dev/null
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"
+[
+  <!-- entities files to use -->
+  <!ENTITY % global_entities SYSTEM '../entities/global.entities'>
+  %global_entities;
+]>
+
+<refentry id='amzfs-snapshot.8'>
+
+<refmeta>
+<refentrytitle>amzfs-snapshot</refentrytitle>
+<manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
+</refmeta>
+<refnamediv>
+<refname>amzfs-snapshot</refname>
+<refpurpose>Amanda script to create zfs snapshot</refpurpose>
+</refnamediv>
+<refentryinfo>
+&author.jlm;
+&author.dustin;
+</refentryinfo>
+<!-- body begins here -->
+
+<refsect1><title>DESCRIPTION</title>
+
+<para>amzfs-snapshot is an &A; script implementing the Script API.  It should
+not be run by users directly.  It create a zfs snapshot of the filesystem
+where the path specified is mounted.</para>
+
+<para>PRE-DLE-* create a snapshot and the POST_DLE_* destroy the snapshot,
+*-DLE-AMCHECK, *-DLE-ESTIMATE and *-DLE-BACKUP must be set to be executed on the client:
+<programlisting>
+    execute-on  pre-dle-amcheck, post-dle-amcheck, pre-dle-estimate, post-dle-estimate, pre-dle-backup, post-dle-backup
+    execute-where client
+</programlisting></para>
+<para>The PRE_DLE_* script output a DIRECTORY property telling where the directory is located in the snapshot. The application must be able to use the DIRECTORY property, amgtar can do it.</para>
+
+<para>The script is run as the amanda user, it must have the priviledge to create and destroy snapshot:
+<programlisting>
+    zfs allow -ldu AMANDA_USER mount,snapshot,destroy FILESYSTEM
+</programlisting></para>
+
+<para>Some system doesn't have "zfs allow", but you can give the Amanda backup user the rights to manipulate ZFS filesystems by using the following command:
+<programlisting>
+usermod -P "ZFS File System Management,ZFS Storage Management" AMANDA_USER
+</programlisting>
+This will require that your run zfs under pfexec, set the PFEXEC property to YES.</para>
+
+<para>The format of the DLE must be one of:
+<programlisting>
+Desciption              Example
+----------              -------
+Mountpoint              /data
+Arbitrary mounted dir   /data/interesting_dir
+ZFS pool name           datapool
+ZFS filesystem          datapool/database
+ZFS logical volume      datapool/dbvol
+</programlisting></para>
+<para>The filesystem must be mounted.</para>
+
+</refsect1>
+
+<refsect1><title>PROPERTIES</title>
+
+<para>This section lists the properties that control amzfs-snapshot's functionality.
+See <citerefentry><refentrytitle>amanda-scripts</refentrytitle><manvolnum>7</manvolnum></citerefentry>
+for information on the Script API, script configuration.</para>
+
+<!-- PLEASE KEEP THIS LIST IN ALPHABETICAL ORDER -->
+<variablelist>
+ <!-- ==== -->
+ <varlistentry><term>DF-PATH</term><listitem>
+Path to the 'df' binary, search in $PATH by default.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>ZFS-PATH</term><listitem>
+Path to the 'zfs' binary, search in $PATH by default.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>PFEXEC-PATH</term><listitem>
+Path to the 'pfexec' binary, search in $PATH by default.
+</listitem></varlistentry>
+ <!-- ==== -->
+ <varlistentry><term>PFEXEC</term><listitem>
+If "NO" (the default), pfexec is not used, if set to "YES" then pfexec is used.
+</listitem></varlistentry>
+</variablelist>
+
+</refsect1>
+
+<refsect1><title>EXAMPLE</title>
+
+In this example, a dumptype is defined to use amzfs-snapshot script to create a snapshot and use amgtar to backup the snapshot.
+
+<programlisting>
+ define script-tool amzfs_snapshot {
+   comment "backup of zfs snapshot"
+   plugin  "amzfs-snapshot"
+   execute-on  pre-dle-amcheck, post-dle-amcheck, pre-dle-estimate, post-dle-estimate, pre-dle-backup, post-dle-backup
+   execute-where client
+   #property "DF-PATH" "/usr/sbin/df"
+   #property "ZFS-PATH" "/usr/sbin/zfs"
+   #property "PFEXEC-PATH" "/usr/sbin/pfexec"
+   #property "PFEXEC" "NO"
+ }
+
+ define dumptype user-zfs-amgtar {
+   dt_amgtar
+   script "amzfs_snapshot"
+ }
+</programlisting>
+</refsect1>
+
+<refsect1><title>SEE ALSO</title>
+<para>
+<citerefentry><refentrytitle>amanda.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+<citerefentry><refentrytitle>amanda-client.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+<citerefentry><refentrytitle>amanda-scripts</refentrytitle><manvolnum>7</manvolnum></citerefentry>
+</para>
+
+</refsect1>
+</refentry>
diff --git a/man/xml-source/disklist.5.xml b/man/xml-source/disklist.5.xml
new file mode 100644 (file)
index 0000000..110d440
--- /dev/null
@@ -0,0 +1,176 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"
+[
+  <!-- entities files to use -->
+  <!ENTITY % global_entities SYSTEM '../entities/global.entities'>
+  %global_entities;
+]>
+
+<refentry id='disklist.5'>
+
+<refmeta>
+<refentrytitle>disklist</refentrytitle>
+<manvolnum>5</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.5;
+</refmeta>
+<refnamediv>
+<refname>disklist</refname>
+<refpurpose>List of partitions to back up for &A;</refpurpose>
+</refnamediv>
+<refentryinfo>
+&author.jds;
+&author.sgw.xml;
+&author.dustin;
+</refentryinfo>
+<!-- body begins here -->
+
+<refsect1><title>DESCRIPTION</title>
+<para>The
+<emphasis remap='I'>disklist</emphasis>
+file determines which disks will be backed up by &A;.
+The file usually contains one line per disk:</para>
+
+<programlisting>
+<emphasis>hostname diskname</emphasis> [<emphasis>diskdevice</emphasis>] <emphasis>dumptype</emphasis> [<emphasis>spindle</emphasis> [<emphasis>interface</emphasis>] ]
+</programlisting>
+
+<para>All pairs [ <emphasis>hostname diskname</emphasis> ] must be unique.</para>
+
+<para>Lines starting with # are ignored, as are blank lines.
+The fields have the following meanings:</para>
+<variablelist remap='TP'>
+  <varlistentry>
+  <term><emphasis remap='I'>hostname</emphasis></term>
+  <listitem>
+<para>The name of the host to be backed up.
+If
+<emphasis remap='B'>diskdevice</emphasis>
+refers to a PC share, this is the host &A; will run the Samba
+<emphasis remap='B'>smbclient</emphasis> program on to back up the share.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><emphasis remap='I'>diskname</emphasis></term>
+  <listitem>
+<para>The name of the disk (a label).
+In most case, you set your
+<emphasis remap='B'>diskname</emphasis>
+to the
+<emphasis remap='B'>diskdevice</emphasis>
+and you don't set the
+<emphasis remap='B'>diskdevice.</emphasis>
+If you want multiple entries with the same
+<emphasis remap='B'>diskdevice</emphasis>,
+you must set a different
+<emphasis remap='B'>diskname</emphasis>
+for each entry. It's the
+<emphasis remap='B'>diskname</emphasis>
+that you use on the commandline for any &A; command.
+Look at the example/disklist file for example.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><emphasis remap='I'>diskdevice</emphasis></term>
+  <listitem>
+<para>Default: same as diskname.
+The name of the disk device to be backed up. It may be a full device name,
+a device name without the
+<filename>/dev/</filename>
+prefix, e.g.
+<emphasis remap='I'>sd0a</emphasis>,
+or a mount point such as
+<filename>/usr</filename>.</para>
+
+<para>It may also refer to a PC share by starting the name with two (forward) slashes, e.g.
+<filename>//some-pc/home</filename>.
+In this case, the
+<emphasis remap='B'>program</emphasis>
+option in the associated
+<emphasis remap='B'>dumptype</emphasis>
+must be entered as
+<emphasis remap='B'>GNUTAR</emphasis>.
+It is the combination of the double slash disk name and
+<emphasis remap='B'>program GNUTAR</emphasis>
+in the
+<emphasis remap='B'>dumptype</emphasis>
+that triggers the use of Samba.</para>
+</listitem>
+</varlistentry>
+
+  <varlistentry>
+  <term><emphasis remap='I'>dumptype</emphasis></term>
+  <listitem>
+<para>Refers to a
+<emphasis remap='B'>dumptype</emphasis>
+defined in the
+<emphasis remap='B'>amanda.conf</emphasis>
+file.
+<emphasis remap='I'>Dumptype</emphasis>s
+specify backup related parameters,
+such as whether to compress the backups,
+whether to record backup results in
+<filename>/etc/dumpdates</filename>, the disk's relative priority, etc.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><emphasis remap='I'>spindle</emphasis></term>
+  <listitem>
+<para>Default:
+<option>-1</option>.
+A number used to balance backup load on a host.
+&A; will not run multiple backups at the same time
+on the same spindle, unless the spindle number is -1,
+which means there is no spindle restriction.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><emphasis remap='I'>interface</emphasis></term>
+  <listitem>
+<para>Default:
+<emphasis remap='I'>local</emphasis>.
+The name of a network interface definition in the
+<emphasis remap='B'>amanda.conf</emphasis>
+file, used to balance network load.</para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+
+<para>Instead of naming a
+<emphasis remap='B'>dumptype</emphasis>,
+it is possible to define one in-line, enclosing
+<emphasis remap='B'>dumptype</emphasis>
+options within curly braces, one per line, just like a
+<emphasis remap='B'>dumptype</emphasis>
+definition in
+<emphasis remap='B'>amanda.conf</emphasis>.
+Since pre-existing
+<emphasis remap='B'>dumptype</emphasis>s
+are valid option names, this syntax may be used to customize
+<emphasis remap='B'>dumptype</emphasis>s
+for particular disks.</para>
+
+<para>A line break
+<emphasis remap='B'>must</emphasis>
+follow the left curly bracket.</para>
+
+<para>For instance, if a
+<emphasis remap='B'>dumptype</emphasis>
+named
+<emphasis remap='I'>normal</emphasis>
+is used for most disks, but use of the holding disk needs to be disabled
+for the file system that holds it, this would work instead of defining
+a new dumptype:</para>
+
+<programlisting>
+<emphasis remap='I'>hostname diskname</emphasis> [ <emphasis remap='I'>diskdevice</emphasis> ] {
+  normal
+  holdingdisk never
+} [ <emphasis remap='I'>spindle</emphasis> [ <emphasis remap='I'>interface</emphasis> ] ]
+</programlisting>
+
+</refsect1>
+
+</refentry>
diff --git a/man/xml-source/script-email.8.xml b/man/xml-source/script-email.8.xml
new file mode 100644 (file)
index 0000000..0708637
--- /dev/null
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"
+[
+  <!-- entities files to use -->
+  <!ENTITY % global_entities SYSTEM '../entities/global.entities'>
+  %global_entities;
+]>
+
+<refentry id='script-email.8'>
+
+<refmeta>
+<refentrytitle>script-email</refentrytitle>
+<manvolnum>8</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.8;
+</refmeta>
+<refnamediv>
+<refname>script-email</refname>
+<refpurpose>Amanda script to send email notifications</refpurpose>
+</refnamediv>
+<refentryinfo>
+&author.jlm;
+&author.dustin;
+</refentryinfo>
+<!-- body begins here -->
+
+<refsect1><title>DESCRIPTION</title>
+
+<para>script-email is an &A; script implementing the Script API.  It should not
+be run by users directly.  It sends a notification email to the addresses
+specified in the MAILTO property.</para>
+
+</refsect1>
+
+<refsect1><title>PROPERTIES</title>
+
+<para>This section lists the properties that control script-email's functionality.
+See <citerefentry><refentrytitle>amanda-scripts</refentrytitle><manvolnum>7</manvolnum></citerefentry>
+for information on the Script API, script configuration.</para>
+
+<!-- PLEASE KEEP THIS LIST IN ALPHABETICAL ORDER -->
+<variablelist>
+ <!-- ==== -->
+ <varlistentry><term>MAILTO</term><listitem>
+List of email addresses that will receive an email on command execution. It is a multi-valued property:
+<programlisting>
+  property "MAILTO" "amanda@domain.com" "sysadmin@domain.com" "amandauser@domain.com"
+</programlisting>
+</listitem></varlistentry>
+ <!-- ==== -->
+</variablelist>
+
+</refsect1>
+
+<refsect1><title>EXAMPLE</title>
+
+In this example, script-email is scheduled to be run before the DLE, on the
+server.  The unqualified email address <emphasis>amanda</emphasis> will be
+passed to the email system unchanged.  The script is then attached to a
+dumptype, which can then be specified for any DLEs which require notification.
+
+<programlisting>
+ define script-tool pre-email {
+   comment "email me before this DLE is backed up"
+   plugin  "script-email"
+   execute-on pre-dle-backup
+   execute-where server
+   property "mailto" "amanda"
+ }
+
+ define dumptype user-tar-email {
+   user-tar
+   script "pre-email"
+ }
+</programlisting>
+</refsect1>
+
+<refsect1><title>SEE ALSO</title>
+<para>
+<citerefentry><refentrytitle>amanda.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+<citerefentry><refentrytitle>amanda-client.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+<citerefentry><refentrytitle>amanda-scripts</refentrytitle><manvolnum>7</manvolnum></citerefentry>
+</para>
+
+</refsect1>
+</refentry>
diff --git a/man/xml-source/tapelist.5.xml b/man/xml-source/tapelist.5.xml
new file mode 100644 (file)
index 0000000..ae5c343
--- /dev/null
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"
+[
+  <!-- entities files to use -->
+  <!ENTITY % global_entities SYSTEM '../entities/global.entities'>
+  %global_entities;
+]>
+
+<refentry id='tapelist.5'>
+
+<refmeta>
+<refentrytitle>tapelist</refentrytitle>
+<manvolnum>5</manvolnum>
+&rmi.source;
+&rmi.version;
+&rmi.manual.5;
+</refmeta>
+<refnamediv>
+<refname>tapelist</refname>
+<refpurpose>The list of &A; volumes in use</refpurpose>
+</refnamediv>
+<refentryinfo>
+&author.jds;
+&author.sgw.xml;
+&author.dustin;
+</refentryinfo>
+<!-- body begins here -->
+
+<refsect1><title>DESCRIPTION</title>
+
+<para>The <emphasis remap='I'>tapelist</emphasis> file contains the list of
+tapes in active use.  This file is not ordinarily ordinarily edited or examined
+manually.  Its format may change, or it may be removed altogether, in future
+versions of &A;.  It contains lines of the form:</para>
+
+<para><programlisting>YYYYMMDD label flags [#comment]
+</programlisting></para>
+
+<para>Where
+<emphasis remap='I'>YYYYMMDD</emphasis>
+is the date the tape was written,
+<emphasis remap='I'>label</emphasis>
+is a label for the tape as written by
+<emphasis remap='B'>amlabel</emphasis>
+and
+<emphasis remap='I'>flags</emphasis>
+is one of "reuse" or "no-reuse" and tells &A; whether the tape may be reused.
+A non-reusable tape will not be overwritten, even if it is older than <emphasis
+remap='B'>dumpcycle</emphasis> dumps.  See the
+<emphasis remap='B'>reuse</emphasis>
+options of
+<citerefentry><refentrytitle>amadmin</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
+The optional comment is prefixed with a '#' and continues to the end of the line.  Amanda
+will maintain this comment until the tape is overwritten.  Note that comments are not
+allowed on blank lines.</para>
+
+<para><emphasis remap='B'>Amdump</emphasis>
+and
+<emphasis remap='B'>amflush</emphasis>
+will by default refuse to write to an unlabeled tape, or to a labeled tape that
+is considered active or marked "no-reuse".  There must be more tapes in active
+rotation (see the
+<emphasis remap='B'>tapecycle</emphasis>
+option) than there are runs in the backup cycle (see the
+<emphasis remap='B'>dumpcycle</emphasis>
+option) to prevent overwriting a backup image that would be needed to do a full recovery.</para>
+</refsect1>
+
+</refentry>
index 03ae3854e71f4eb7e70aa931c9fdf739d7e9f115..5f2fcd5206d45bff7f2eb5757fe6a1ef6ab23aa2 100644 (file)
 <xsl:param name="use.id.as.filename" select="'0'"/>
 <xsl:param name="use.local.olink.style" select="1"/>
 <xsl:param name="use.role.as.xrefstyle" select="1"/>
+<xsl:param name="refentry.generate.title" select="1"/>
 
 <!-- generate correct links to other manpages -->
 <xsl:template name="generate.citerefentry.link">
   <xsl:value-of select="refentrytitle"/><xsl:text>.</xsl:text><xsl:value-of select="manvolnum"/><xsl:text>.html</xsl:text>
 </xsl:template>
 
-<xsl:template match="author">
+<!--  add missing AUTHOR(S) section -->
+<!-- this section originated with fglrx_man:
+       http://vcs.wgdd.de/cvsweb/fglrx_man/fglrx_html.xsl?rev=1.5
+     License information from that file:
+       This file is free software. The copyright owner gives unlimited
+       permission to copy, distribute and modify it.
+  -->
+<xsl:template match="refentry">
+  <div class="refentry">
+  <xsl:apply-templates/>
+  <xsl:choose>
+    <xsl:when test="refentryinfo//author">
+      <xsl:apply-templates select="refentryinfo" mode="authorsect"/>
+    </xsl:when>
+  </xsl:choose>
+  </div>
+</xsl:template>
+
+<xsl:template match="refentryinfo" mode="authorsect">
+  <div class="refsect1">
+    <h2>
+      <xsl:text>AUTHOR</xsl:text>
+      <xsl:if test="count(.//author)+count(.//othercredit)>1">
+       <xsl:text>S</xsl:text>
+      </xsl:if>
+    </h2>
+    <xsl:text>&#10;</xsl:text>
+    <xsl:if test="count(.//author)>0">
+      <p>
+       <xsl:text>This manual page was written by </xsl:text>
+       <xsl:for-each select=".//author">
+         <xsl:if test="position() > 1">
+           <xsl:choose>
+             <xsl:when test="position() = last()">
+               <xsl:text> and </xsl:text>
+             </xsl:when>
+             <xsl:otherwise>
+               <xsl:text>, </xsl:text>
+             </xsl:otherwise>
+           </xsl:choose>
+         </xsl:if>
+         <xsl:apply-templates select="." mode="authorsect"/>
+       </xsl:for-each>
+       <xsl:text>.</xsl:text>
+      </p>
+    </xsl:if>
+    <xsl:if test="count(.//othercredit)>0">
+      <p>
+       <xsl:text>Contributions were derived from </xsl:text>
+       <xsl:for-each select=".//othercredit">
+         <xsl:if test="position() > 1">
+           <xsl:choose>
+             <xsl:when test="position() = last()">
+               <xsl:text> and </xsl:text>
+             </xsl:when>
+             <xsl:otherwise>
+               <xsl:text>, </xsl:text>
+             </xsl:otherwise>
+           </xsl:choose>
+         </xsl:if>
+         <xsl:apply-templates select="." mode="authorsect"/>
+       </xsl:for-each>
+       <xsl:text>.</xsl:text>
+      </p>
+    </xsl:if>
+    <xsl:if test="count(.//editor)>0">
+      <p>
+       <xsl:text disable-output-escaping="yes">Edited by </xsl:text>
+       <xsl:for-each select=".//editor">
+         <xsl:if test="position() > 1">
+           <xsl:choose>
+             <xsl:when test="position() = last()">
+               <xsl:text> and </xsl:text>
+             </xsl:when>
+             <xsl:otherwise>
+               <xsl:text>, </xsl:text>
+             </xsl:otherwise>
+           </xsl:choose>
+         </xsl:if>
+         <xsl:apply-templates select="." mode="authorsect"/>
+       </xsl:for-each>
+       <xsl:text>.</xsl:text>
+      </p>
+    </xsl:if>
+  </div>
+</xsl:template>
+
+<xsl:template match="affiliation" mode="authorsect">
+  <xsl:choose>
+    <xsl:when test="./org/uri">
+      <a>
+       <xsl:attribute name="href">
+        <xsl:apply-templates select="./org/uri" />
+       </xsl:attribute>
+       <xsl:apply-templates select="./org/orgname" />
+      </a>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:apply-templates select="./org/orgname" />
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="author|editor|othercredit" mode="authorsect">
+  <span class="{name(.)}">
+    <xsl:call-template name="anchor"/>
+    <xsl:call-template name="person.name"/>
+    <xsl:if test=".//email">
+      <xsl:text> </xsl:text>
+      <xsl:apply-templates select=".//email"/>
+    </xsl:if>
+    <xsl:if test=".//affiliation">
+      <xsl:text> (</xsl:text>
+      <xsl:apply-templates mode="authorsect" select="./affiliation"/>
+      <xsl:text>)</xsl:text>
+    </xsl:if>
+  </span>
 </xsl:template>
 
 </xsl:stylesheet>
index 2453bc0b4e3ac29cff4251bc14832f1faa4edc12..2cd21d6ff4a851c4ec8178976e89cc787bfb7468 100644 (file)
@@ -13,6 +13,7 @@
 <xsl:param name="chunk.section.depth" select="0"/>
 <xsl:param name="chunk.first.sections" select="1"/>
 <xsl:param name="use.id.as.filename" select="0"/>
+<xsl:param name="refentry.meta.get.quietly" select="1"/>  <!-- silence warnings -->
 
 <!--
     Our ulink stylesheet omits @url part if content was specified
   <xsl:apply-templates/>
 </xsl:template>
 
+<!-- fix authors -->
+<!-- a modified, simplified version of the docbook affiliation template -->
+<xsl:template match="affiliation" mode="authorsect">
+  <xsl:if test="./org/orgname">
+    <xsl:text>.RS 4&#10;</xsl:text>
+    <xsl:apply-templates select="./org/orgname" />
+    <xsl:if test="./org/uri">
+      <xsl:text> (</xsl:text><xsl:apply-templates select="./org/uri" /><xsl:text>)</xsl:text>
+    </xsl:if>
+  </xsl:if>
+  <xsl:text>&#10;.RE&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template name="attribution">
+<!-- no attributions -->
+</xsl:template>
 
 </xsl:stylesheet>
index 8a0472d4b3af50c8ed01d3d4eaa9fd02008d8883..77c7fa86db1b5c81b2d3b9634cc911e1b81722ab 100644 (file)
@@ -1,5 +1,6 @@
 # Makefile for Amanda file recovery programs.
 
+include $(top_srcdir)/config/automake/vars.am
 include $(top_srcdir)/config/automake/installperms.am
 include $(top_srcdir)/config/automake/precompile.am
 
@@ -11,8 +12,8 @@ INCLUDES =    -I$(top_builddir)/common-src \
 AM_CFLAGS = $(AMANDA_WARNING_CFLAGS)
 AM_LDFLAGS = $(AMANDA_STATIC_LDFLAGS)
 
-LINT=@AMLINT@
-LINTFLAGS=@AMLINTFLAGS@
+LINT=$(AMLINT)
+LINTFLAGS=$(AMLINTFLAGS)
 
 LIB_EXTENSION = la
 
@@ -29,8 +30,7 @@ LDADD = ../common-src/libamanda.$(LIB_EXTENSION) \
        @LEXLIB@ \
        $(READLINE_LIBS) \
        ../client-src/libamclient.$(LIB_EXTENSION) \
-       ../common-src/libamanda.$(LIB_EXTENSION) \
-       ../gnulib/libgnu.$(LIB_EXTENSION)
+       ../common-src/libamanda.$(LIB_EXTENSION)
 
 amoldrecover_CSRC =    amrecover.c                                     \
                        display_commands.c              extract_list.c  \
@@ -56,7 +56,7 @@ uparse.$(OBJEXT): uparse.c
 
 
 INSTALLPERMS_exec = \
-       dest=$(sbindir) chown=amanda chmod=o-rwx $(sbin_PROGRAMS)
+       dest=$(sbindir) chown=amanda chmod=0750 $(sbin_PROGRAMS)
 
 lint:
        @ f="$(amoldrecover_CSRC)";                                             \
index 3caa50fdaee614cda85a7271c1b50c65df6f8b5b..6ec29409a23ce25afeaccf87509dab5805cea698 100644 (file)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  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.
 
 # Makefile for Amanda file recovery programs.
 
+# vim:ft=automake
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+# 
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License version 2.1 as 
+# published by the Free Software Foundation.
+# 
+# This 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 this library; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+# 
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+# simple include file to pre-define variables which are then +='d by other
+# scripts in this directory.
+
 # vim:ft=automake
 #
 # Adjust post-install permissions settings.  This rule works off two
@@ -43,7 +65,7 @@
 # INSTALLPERMS_exec = \
 #      dest=$(sbindir) chown=amanda chmod= \
 #              foo bar \
-#      chmod=u+s,o-rwx \
+#      chmod=07450 \
 #              bing
 #      dest=$(libexecdir) chmod= \
 #              $(libexec_PROGRAMS)
 #
 # This whole operation is not required when making builds for packaging,
 # and can be disabled with --disable-installperms, via the WANT_INSTALLPERMS
-# AM_CONDITIONAL.
+# AM_CONDITIONAL.  When disabled, the file 'installperms.sh' in the top-level
+# build directory is populated with a format suitable for shell interpretation,
+# with lines like this:
+#   installperm "amanda:disk" "04750" "/usr/local/sbin/bing"
+# the arguments being, respectively, owner:group, mode, and filename.  There will
+# be exactly one line for each file which has specific permissions.  The intention
+# is that this file be used by packaging scripts to set correct permissions at install
+# time.  Note that files which have no special permissions requirements do not appear 
+# in this file at all, due to limitations of Automake.
 
 # vim:ft=automake
 
@@ -80,13 +110,16 @@ target_triplet = @target@
 DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
        $(srcdir)/Makefile.in \
        $(top_srcdir)/config/automake/installperms.am \
-       $(top_srcdir)/config/automake/precompile.am uparse.c uparse.h \
+       $(top_srcdir)/config/automake/precompile.am \
+       $(top_srcdir)/config/automake/vars.am uparse.c uparse.h \
        uscan.c
+@WANT_INSTALLPERMS_FALSE@am__append_1 = $(installperms_sh)
 sbin_PROGRAMS = amoldrecover$(EXEEXT)
 subdir = oldrecover-src
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps =  \
        $(top_srcdir)/config/macro-archive/ac_define_dir.m4 \
+       $(top_srcdir)/config/macro-archive/ac_perl_module_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_perl_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_swig.m4 \
        $(top_srcdir)/config/macro-archive/ax_compare_version.m4 \
@@ -120,6 +153,7 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/amanda/libs.m4 \
        $(top_srcdir)/config/amanda/net.m4 \
        $(top_srcdir)/config/amanda/progs.m4 \
+       $(top_srcdir)/config/amanda/ps.m4 \
        $(top_srcdir)/config/amanda/readdir.m4 \
        $(top_srcdir)/config/amanda/readline.m4 \
        $(top_srcdir)/config/amanda/rsh-security.m4 \
@@ -142,7 +176,9 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/float_h.m4 \
        $(top_srcdir)/config/gnulib/fsusage.m4 \
        $(top_srcdir)/config/gnulib/getaddrinfo.m4 \
+       $(top_srcdir)/config/gnulib/getopt.m4 \
        $(top_srcdir)/config/gnulib/gettimeofday.m4 \
+       $(top_srcdir)/config/gnulib/gnulib-common.m4 \
        $(top_srcdir)/config/gnulib/gnulib-comp.m4 \
        $(top_srcdir)/config/gnulib/include_next.m4 \
        $(top_srcdir)/config/gnulib/inet_ntop.m4 \
@@ -170,7 +206,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/sys_stat_h.m4 \
        $(top_srcdir)/config/gnulib/sys_time_h.m4 \
        $(top_srcdir)/config/gnulib/tempname.m4 \
-       $(top_srcdir)/config/gnulib/ulonglong.m4 \
        $(top_srcdir)/config/gnulib/unistd_h.m4 \
        $(top_srcdir)/config/gnulib/vasnprintf.m4 \
        $(top_srcdir)/config/gnulib/visibility.m4 \
@@ -181,7 +216,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gettext-macros/lib-ld.m4 \
        $(top_srcdir)/config/gettext-macros/lib-link.m4 \
        $(top_srcdir)/config/gettext-macros/lib-prefix.m4 \
-       $(top_srcdir)/config/gettext-macros/longlong.m4 \
        $(top_srcdir)/config/gettext-macros/nls.m4 \
        $(top_srcdir)/config/gettext-macros/po.m4 \
        $(top_srcdir)/config/gettext-macros/progtest.m4 \
@@ -209,9 +243,8 @@ am__DEPENDENCIES_1 =
 amoldrecover_DEPENDENCIES = ../common-src/libamanda.$(LIB_EXTENSION) \
        $(am__DEPENDENCIES_1) \
        ../client-src/libamclient.$(LIB_EXTENSION) \
-       ../common-src/libamanda.$(LIB_EXTENSION) \
-       ../gnulib/libgnu.$(LIB_EXTENSION)
-DEFAULT_INCLUDES = -I. -I$(top_builddir)/config@am__isrc@
+       ../common-src/libamanda.$(LIB_EXTENSION)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/config
 depcomp = $(SHELL) $(top_srcdir)/config/depcomp
 am__depfiles_maybe = depfiles
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
@@ -237,6 +270,7 @@ ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
+AIX_BACKUP = @AIX_BACKUP@
 ALLOCA = @ALLOCA@
 ALLOCA_H = @ALLOCA_H@
 AMANDA_DBGDIR = @AMANDA_DBGDIR@
@@ -251,8 +285,10 @@ AMPLOT_CAT_GZIP = @AMPLOT_CAT_GZIP@
 AMPLOT_CAT_PACK = @AMPLOT_CAT_PACK@
 AMPLOT_COMPRESS = @AMPLOT_COMPRESS@
 AMTAR = @AMTAR@
+APPLICATION_DIR = @APPLICATION_DIR@
 AR = @AR@
 ARPA_INET_H = @ARPA_INET_H@
+ASSERTIONS = @ASSERTIONS@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -264,16 +300,28 @@ BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@
 BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@
 BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@
 BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@
+BSDTCP_SECURITY = @BSDTCP_SECURITY@
+BSDUDP_SECURITY = @BSDUDP_SECURITY@
+BSD_SECURITY = @BSD_SECURITY@
 CAT = @CAT@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
+CHECK_USERID = @CHECK_USERID@
 CHIO = @CHIO@
 CHS = @CHS@
+CLIENT_HOST_INSTANCE = @CLIENT_HOST_INSTANCE@
+CLIENT_HOST_KEY_FILE = @CLIENT_HOST_KEY_FILE@
+CLIENT_HOST_PRINCIPAL = @CLIENT_HOST_PRINCIPAL@
 CLIENT_LOGIN = @CLIENT_LOGIN@
 CLIENT_SCRIPTS_OPT = @CLIENT_SCRIPTS_OPT@
 COMPRESS = @COMPRESS@
+COMPRESS_BEST_OPT = @COMPRESS_BEST_OPT@
+COMPRESS_FAST_OPT = @COMPRESS_FAST_OPT@
+COMPRESS_PATH = @COMPRESS_PATH@
+COMPRESS_SUFFIX = @COMPRESS_SUFFIX@
+CONFIG_CLOBBER_MY_CONFIG = @CONFIG_CLOBBER_MY_CONFIG@
 CONFIG_DIR = @CONFIG_DIR@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
@@ -287,6 +335,7 @@ DD = @DD@
 DEFAULT_AMANDATES_FILE = @DEFAULT_AMANDATES_FILE@
 DEFAULT_CHANGER_DEVICE = @DEFAULT_CHANGER_DEVICE@
 DEFAULT_CONFIG = @DEFAULT_CONFIG@
+DEFAULT_MAILER = @DEFAULT_MAILER@
 DEFAULT_SERVER = @DEFAULT_SERVER@
 DEFAULT_TAPE_DEVICE = @DEFAULT_TAPE_DEVICE@
 DEFAULT_TAPE_SERVER = @DEFAULT_TAPE_SERVER@
@@ -294,7 +343,7 @@ DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DOC_BUILD_DATE = @DOC_BUILD_DATE@
 DUMP = @DUMP@
-DUMPER_DIR = @DUMPER_DIR@
+DUMP_RETURNS_1 = @DUMP_RETURNS_1@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -307,6 +356,7 @@ F77 = @F77@
 FFLAGS = @FFLAGS@
 FLOAT_H = @FLOAT_H@
 GETCONF = @GETCONF@
+GETOPT_H = @GETOPT_H@
 GETTEXT = @GETTEXT@
 GLIB_CFLAGS = @GLIB_CFLAGS@
 GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
@@ -317,9 +367,12 @@ GMSGFMT_015 = @GMSGFMT_015@
 GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
 GNULIB_CHOWN = @GNULIB_CHOWN@
 GNULIB_DUP2 = @GNULIB_DUP2@
+GNULIB_ENVIRON = @GNULIB_ENVIRON@
 GNULIB_FCHDIR = @GNULIB_FCHDIR@
 GNULIB_FFLUSH = @GNULIB_FFLUSH@
+GNULIB_FOPEN = @GNULIB_FOPEN@
 GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
+GNULIB_FREOPEN = @GNULIB_FREOPEN@
 GNULIB_FSEEK = @GNULIB_FSEEK@
 GNULIB_FSEEKO = @GNULIB_FSEEKO@
 GNULIB_FTELL = @GNULIB_FTELL@
@@ -329,6 +382,7 @@ GNULIB_GETCWD = @GNULIB_GETCWD@
 GNULIB_GETDELIM = @GNULIB_GETDELIM@
 GNULIB_GETLINE = @GNULIB_GETLINE@
 GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
+GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@
 GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
 GNULIB_LCHOWN = @GNULIB_LCHOWN@
 GNULIB_LSEEK = @GNULIB_LSEEK@
@@ -353,8 +407,10 @@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
 GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
 GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
 GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
+GNULIB_PUTENV = @GNULIB_PUTENV@
 GNULIB_READLINK = @GNULIB_READLINK@
 GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@
+GNULIB_SETENV = @GNULIB_SETENV@
 GNULIB_SLEEP = @GNULIB_SLEEP@
 GNULIB_SNPRINTF = @GNULIB_SNPRINTF@
 GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@
@@ -363,11 +419,15 @@ GNULIB_STPNCPY = @GNULIB_STPNCPY@
 GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
 GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
 GNULIB_STRDUP = @GNULIB_STRDUP@
+GNULIB_STRERROR = @GNULIB_STRERROR@
 GNULIB_STRNDUP = @GNULIB_STRNDUP@
 GNULIB_STRNLEN = @GNULIB_STRNLEN@
 GNULIB_STRPBRK = @GNULIB_STRPBRK@
 GNULIB_STRSEP = @GNULIB_STRSEP@
+GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@
+GNULIB_STRSTR = @GNULIB_STRSTR@
 GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
+GNULIB_UNSETENV = @GNULIB_UNSETENV@
 GNULIB_VASPRINTF = @GNULIB_VASPRINTF@
 GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@
 GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
@@ -381,6 +441,7 @@ GOBJECT_QUERY = @GOBJECT_QUERY@
 GREP = @GREP@
 GZIP = @GZIP@
 HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@
+HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@
 HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@
 HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@
 HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
@@ -389,9 +450,10 @@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
 HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@
 HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
 HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
-HAVE_DECL_STRNCASECMP = @HAVE_DECL_STRNCASECMP@
+HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@
 HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
 HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
+HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@
 HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
 HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
 HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
@@ -399,7 +461,9 @@ HAVE_DUP2 = @HAVE_DUP2@
 HAVE_FSEEKO = @HAVE_FSEEKO@
 HAVE_FTELLO = @HAVE_FTELLO@
 HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
+HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
 HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
+HAVE_GZIP = @HAVE_GZIP@
 HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
 HAVE_IO_H = @HAVE_IO_H@
 HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
@@ -408,8 +472,10 @@ HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@
 HAVE_MEMPCPY = @HAVE_MEMPCPY@
 HAVE_MKDTEMP = @HAVE_MKDTEMP@
 HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@
+HAVE_OS_H = @HAVE_OS_H@
 HAVE_READLINK = @HAVE_READLINK@
 HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@
+HAVE_SETENV = @HAVE_SETENV@
 HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
 HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
 HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
@@ -417,7 +483,6 @@ HAVE_SLEEP = @HAVE_SLEEP@
 HAVE_STDINT_H = @HAVE_STDINT_H@
 HAVE_STPCPY = @HAVE_STPCPY@
 HAVE_STPNCPY = @HAVE_STPNCPY@
-HAVE_STRCASECMP = @HAVE_STRCASECMP@
 HAVE_STRCASESTR = @HAVE_STRCASESTR@
 HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
 HAVE_STRNDUP = @HAVE_STRNDUP@
@@ -426,10 +491,12 @@ HAVE_STRSEP = @HAVE_STRSEP@
 HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@
 HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
 HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
+HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
 HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
 HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
 HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
 HAVE_UNISTD_H = @HAVE_UNISTD_H@
+HAVE_UNSETENV = @HAVE_UNSETENV@
 HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
 HAVE_VASPRINTF = @HAVE_VASPRINTF@
 HAVE_VISIBILITY = @HAVE_VISIBILITY@
@@ -445,6 +512,8 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 INTLLIBS = @INTLLIBS@
 INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+KRB4_SECURITY = @KRB4_SECURITY@
+KRB5_SECURITY = @KRB5_SECURITY@
 LDFLAGS = @LDFLAGS@
 LEX = @LEX@
 LEXLIB = @LEXLIB@
@@ -461,6 +530,8 @@ LIBTHREAD = @LIBTHREAD@
 LIBTOOL = @LIBTOOL@
 LIBTOOL_DEPS = @LIBTOOL_DEPS@
 LN_S = @LN_S@
+LOCKING = @LOCKING@
+LOW_TCPPORTRANGE = @LOW_TCPPORTRANGE@
 LTLIBICONV = @LTLIBICONV@
 LTLIBINTL = @LTLIBINTL@
 LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
@@ -469,7 +540,6 @@ LTLIBPTH = @LTLIBPTH@
 LTLIBTHREAD = @LTLIBTHREAD@
 MAILER = @MAILER@
 MAKEINFO = @MAKEINFO@
-MAXTAPEBLOCKSIZE = @MAXTAPEBLOCKSIZE@
 MCUTIL = @MCUTIL@
 MKDIR_P = @MKDIR_P@
 MSGFMT = @MSGFMT@
@@ -505,26 +575,37 @@ PERL_INC = @PERL_INC@
 PKG_CONFIG = @PKG_CONFIG@
 POSUB = @POSUB@
 PRINT = @PRINT@
+PS = @PS@
+PS_ARGUMENT = @PS_ARGUMENT@
 PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
 RANLIB = @RANLIB@
 READLINE_LIBS = @READLINE_LIBS@
 REPLACE_CHOWN = @REPLACE_CHOWN@
 REPLACE_FCHDIR = @REPLACE_FCHDIR@
 REPLACE_FFLUSH = @REPLACE_FFLUSH@
+REPLACE_FOPEN = @REPLACE_FOPEN@
 REPLACE_FPRINTF = @REPLACE_FPRINTF@
+REPLACE_FREOPEN = @REPLACE_FREOPEN@
 REPLACE_FSEEK = @REPLACE_FSEEK@
 REPLACE_FSEEKO = @REPLACE_FSEEKO@
 REPLACE_FTELL = @REPLACE_FTELL@
 REPLACE_FTELLO = @REPLACE_FTELLO@
 REPLACE_GETCWD = @REPLACE_GETCWD@
 REPLACE_GETLINE = @REPLACE_GETLINE@
+REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
 REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
 REPLACE_LCHOWN = @REPLACE_LCHOWN@
 REPLACE_LSEEK = @REPLACE_LSEEK@
+REPLACE_MEMMEM = @REPLACE_MEMMEM@
 REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
 REPLACE_PRINTF = @REPLACE_PRINTF@
+REPLACE_PUTENV = @REPLACE_PUTENV@
 REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
 REPLACE_SPRINTF = @REPLACE_SPRINTF@
+REPLACE_STRCASESTR = @REPLACE_STRCASESTR@
+REPLACE_STRERROR = @REPLACE_STRERROR@
+REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@
+REPLACE_STRSTR = @REPLACE_STRSTR@
 REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
 REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
 REPLACE_VPRINTF = @REPLACE_VPRINTF@
@@ -532,7 +613,11 @@ REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
 REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
 REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
 RESTORE = @RESTORE@
+RSH_SECURITY = @RSH_SECURITY@
 SAMBA_CLIENT = @SAMBA_CLIENT@
+SERVER_HOST_INSTANCE = @SERVER_HOST_INSTANCE@
+SERVER_HOST_KEY_FILE = @SERVER_HOST_KEY_FILE@
+SERVER_HOST_PRINCIPAL = @SERVER_HOST_PRINCIPAL@
 SERVICE_SUFFIX = @SERVICE_SUFFIX@
 SETUID_GROUP = @SETUID_GROUP@
 SET_MAKE = @SET_MAKE@
@@ -542,6 +627,7 @@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
 SNAPSHOT_STAMP = @SNAPSHOT_STAMP@
 SORT = @SORT@
 SSH = @SSH@
+SSH_SECURITY = @SSH_SECURITY@
 STDBOOL_H = @STDBOOL_H@
 STDINT_H = @STDINT_H@
 STRIP = @STRIP@
@@ -551,7 +637,14 @@ SWIG_LIB = @SWIG_LIB@
 SYS_SOCKET_H = @SYS_SOCKET_H@
 SYS_STAT_H = @SYS_STAT_H@
 SYS_TIME_H = @SYS_TIME_H@
+TCPPORTRANGE = @TCPPORTRANGE@
+TICKET_LIFETIME = @TICKET_LIFETIME@
+UDPPORTRANGE = @UDPPORTRANGE@
+UNCOMPRESS_OPT = @UNCOMPRESS_OPT@
+UNCOMPRESS_PATH = @UNCOMPRESS_PATH@
+USE_AMANDAHOSTS = @USE_AMANDAHOSTS@
 USE_NLS = @USE_NLS@
+USE_RUNDUMP = @USE_RUNDUMP@
 USE_VERSION_SUFFIXES = @USE_VERSION_SUFFIXES@
 VDUMP = @VDUMP@
 VERSION = @VERSION@
@@ -560,6 +653,7 @@ VERSION_MAJOR = @VERSION_MAJOR@
 VERSION_MINOR = @VERSION_MINOR@
 VERSION_PATCH = @VERSION_PATCH@
 VERSION_SUFFIX = @VERSION_SUFFIX@
+VOID_UNSETENV = @VOID_UNSETENV@
 VRESTORE = @VRESTORE@
 VXDUMP = @VXDUMP@
 VXRESTORE = @VXRESTORE@
@@ -588,6 +682,7 @@ am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+amdatadir = @amdatadir@
 amincludedir = @amincludedir@
 amlibdir = @amlibdir@
 amlibexecdir = @amlibexecdir@
@@ -606,6 +701,8 @@ dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 gl_LIBOBJS = @gl_LIBOBJS@
 gl_LTLIBOBJS = @gl_LTLIBOBJS@
+gltests_LIBOBJS = @gltests_LIBOBJS@
+gltests_LTLIBOBJS = @gltests_LTLIBOBJS@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
@@ -635,12 +732,39 @@ target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
+SUFFIXES = 
+EXTRA_DIST = 
+BUILT_SOURCES = 
+MOSTLYCLEANFILES = 
+CLEANFILES = 
+DISTCLEANFILES = $(am__append_1)
+MAINTAINERCLEANFILES = 
 
 # sed expression to strip leading directories from a filename; this converts e.g.,
 # src/foo/bar.so to bar.so.
 strip_leading_dirs = s|^.*/||
+@WANT_INSTALLPERMS_FALSE@do_file = pa="$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
+@WANT_INSTALLPERMS_FALSE@    echo "installperm \"$$chown\" \"$$chmod\" \"$$pa\"" >> "$(installperms_sh)"
+
+
+# define a snippet of the scripts below to either perform a chown/chmod operation,
+# or record that operation in the logfile.  On entry to the snippet, $$dest is the
+# destination directory, $$cmd is the srcdir-relative pathname of the target file,
+# $$chown is the ownership, and $$chmod is the permission pattern.
+@WANT_INSTALLPERMS_TRUE@do_file = pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
+@WANT_INSTALLPERMS_TRUE@    if test -n "$$chown"; then \
+@WANT_INSTALLPERMS_TRUE@       echo chown "$$chown" "$$pa"; \
+@WANT_INSTALLPERMS_TRUE@       chown "$$chown" "$$pa" || exit 1; \
+@WANT_INSTALLPERMS_TRUE@    fi; \
+@WANT_INSTALLPERMS_TRUE@    if test -n "$$chmod"; then \
+@WANT_INSTALLPERMS_TRUE@       echo chmod "$$chmod" "$$pa"; \
+@WANT_INSTALLPERMS_TRUE@       chmod "$$chmod" "$$pa" || exit 1; \
+@WANT_INSTALLPERMS_TRUE@    fi 
+
+@WANT_INSTALLPERMS_FALSE@installperms_sh = "$(top_builddir)/installperms.sh"
 INCLUDES = -I$(top_builddir)/common-src \
                -I$(top_srcdir)/common-src   \
                -I$(top_srcdir)/client-src   \
@@ -648,8 +772,8 @@ INCLUDES = -I$(top_builddir)/common-src \
 
 AM_CFLAGS = $(AMANDA_WARNING_CFLAGS)
 AM_LDFLAGS = $(AMANDA_STATIC_LDFLAGS)
-LINT = @AMLINT@
-LINTFLAGS = @AMLINTFLAGS@
+LINT = $(AMLINT)
+LINTFLAGS = $(AMLINTFLAGS)
 LIB_EXTENSION = la
 
 ###
@@ -662,8 +786,7 @@ LDADD = ../common-src/libamanda.$(LIB_EXTENSION) \
        @LEXLIB@ \
        $(READLINE_LIBS) \
        ../client-src/libamclient.$(LIB_EXTENSION) \
-       ../common-src/libamanda.$(LIB_EXTENSION) \
-       ../gnulib/libgnu.$(LIB_EXTENSION)
+       ../common-src/libamanda.$(LIB_EXTENSION)
 
 amoldrecover_CSRC = amrecover.c                                        \
                        display_commands.c              extract_list.c  \
@@ -673,13 +796,14 @@ amoldrecover_SOURCES = $(amoldrecover_CSRC)       uparse.y        uscan.l
 noinst_HEADERS = amrecover.h uparse.h
 AM_YFLAGS = -d
 INSTALLPERMS_exec = \
-       dest=$(sbindir) chown=amanda chmod=o-rwx $(sbin_PROGRAMS)
+       dest=$(sbindir) chown=amanda chmod=0750 $(sbin_PROGRAMS)
 
-all: all-am
+all: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) all-am
 
 .SUFFIXES:
 .SUFFIXES: .c .l .lo .o .obj .y
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(top_srcdir)/config/automake/installperms.am $(top_srcdir)/config/automake/precompile.am $(am__configure_deps)
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(top_srcdir)/config/automake/vars.am $(top_srcdir)/config/automake/installperms.am $(top_srcdir)/config/automake/precompile.am $(am__configure_deps)
        @for dep in $?; do \
          case '$(am__configure_deps)' in \
            *$$dep*) \
@@ -717,8 +841,8 @@ install-sbinPROGRAMS: $(sbin_PROGRAMS)
             || test -f $$p1 \
          ; then \
            f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
-          echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \
-          $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(sbindir)/$$f" || exit 1; \
+          echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \
+          $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(sbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(sbindir)/$$f" || exit 1; \
          else :; fi; \
        done
 
@@ -797,8 +921,8 @@ ID: $(HEADERS) $(SOURCES) $(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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
        mkid -fID $$unique
 tags: TAGS
 
@@ -810,8 +934,8 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
        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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { 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) \
@@ -821,13 +945,12 @@ ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
                $(TAGS_FILES) $(LISP)
        tags=; \
-       here=`pwd`; \
        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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
        test -z "$(CTAGS_ARGS)$$tags$$unique" \
          || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
             $$tags $$unique
@@ -867,13 +990,15 @@ distdir: $(DISTFILES)
          fi; \
        done
 check-am: all-am
-check: check-am
+check: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) check-am
 all-am: Makefile $(PROGRAMS) $(HEADERS)
 installdirs:
        for dir in "$(DESTDIR)$(sbindir)"; do \
          test -z "$$dir" || $(MKDIR_P) "$$dir"; \
        done
-install: install-am
+install: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) install-am
 install-exec: install-exec-am
 install-data: install-data-am
 uninstall: uninstall-am
@@ -888,11 +1013,14 @@ install-strip:
          `test -z '$(STRIP)' || \
            echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
+       -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
 
 clean-generic:
+       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
        -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+       -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
 
 maintainer-clean-generic:
        @echo "This command is intended for maintainers to use"
@@ -900,8 +1028,8 @@ maintainer-clean-generic:
        -rm -f uparse.c
        -rm -f uparse.h
        -rm -f uscan.c
-@WANT_INSTALLPERMS_FALSE@install-exec-hook:
-@WANT_INSTALLPERMS_FALSE@install-data-hook:
+       -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+       -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
 clean: clean-am
 
 clean-am: clean-generic clean-libtool clean-sbinPROGRAMS \
@@ -983,52 +1111,40 @@ uninstall-am: uninstall-sbinPROGRAMS
        uninstall-sbinPROGRAMS
 
 
-@WANT_INSTALLPERMS_TRUE@installperms-exec:
-@WANT_INSTALLPERMS_TRUE@       @installperms="$(INSTALLPERMS_exec)"; \
-@WANT_INSTALLPERMS_TRUE@       test -n "$$installperms" && echo "Setting installation permissions on executables"; \
-@WANT_INSTALLPERMS_TRUE@       dest=; chown=; chmod=; \
-@WANT_INSTALLPERMS_TRUE@       for cmd in $$installperms; do \
-@WANT_INSTALLPERMS_TRUE@           case "$$cmd" in \
-@WANT_INSTALLPERMS_TRUE@               chown=amanda) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
-@WANT_INSTALLPERMS_TRUE@               dest=*|chown=*|chmod=*) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; eval $$cmd;; \
-@WANT_INSTALLPERMS_TRUE@               *)  pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chown"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chown "$$chown" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chown "$$chown" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chmod"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chmod "$$chmod" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chmod "$$chmod" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@           esac; \
-@WANT_INSTALLPERMS_TRUE@       done
-
-@WANT_INSTALLPERMS_TRUE@installperms-data:
-@WANT_INSTALLPERMS_TRUE@       @installperms="$(INSTALLPERMS_data)"; \
-@WANT_INSTALLPERMS_TRUE@       test -n "$$installperms" && echo "Setting installation permissions on data"; \
-@WANT_INSTALLPERMS_TRUE@       dest=; chown=; chmod=; \
-@WANT_INSTALLPERMS_TRUE@       for cmd in $$installperms; do \
-@WANT_INSTALLPERMS_TRUE@           case "$$cmd" in \
-@WANT_INSTALLPERMS_TRUE@               chown=amanda) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
-@WANT_INSTALLPERMS_TRUE@               dest=*|chown=*|chmod=*) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; eval $$cmd;; \
-@WANT_INSTALLPERMS_TRUE@               *)  pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chown"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chown "$$chown" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chown "$$chown" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chmod"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chmod "$$chmod" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chmod "$$chmod" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@           esac; \
-@WANT_INSTALLPERMS_TRUE@       done
-
-@WANT_INSTALLPERMS_TRUE@install-exec-hook: installperms-exec
-@WANT_INSTALLPERMS_TRUE@install-data-hook: installperms-data
+installperms-exec:
+       @installperms="$(INSTALLPERMS_exec)"; \
+       test -n "$$installperms" && echo "Setting installation permissions on executables"; \
+       dest=; chown=; chmod=; \
+       for cmd in $$installperms; do \
+           case "$$cmd" in \
+               chown=amanda) \
+                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
+               dest=*|chown=*|chmod=*) \
+                       echo "  ($$cmd)"; eval $$cmd;; \
+               *) $(do_file) ;; \
+           esac; \
+       done
+
+installperms-data:
+       @installperms="$(INSTALLPERMS_data)"; \
+       dest=; chown=; chmod=; \
+       for cmd in $$installperms; do \
+           case "$$cmd" in \
+               chown=amanda) \
+                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
+               dest=*|chown=*|chmod=*) \
+                       echo "  ($$cmd)"; eval $$cmd;; \
+               *)  $(do_file) ;; \
+           esac; \
+       done
+
+install-exec-hook: installperms-exec
+install-data-hook: installperms-data
+
+# define a rule to initialize the installperms manifest file
+@WANT_INSTALLPERMS_TRUE@installperms-init:
+@WANT_INSTALLPERMS_FALSE@installperms-init:
+@WANT_INSTALLPERMS_FALSE@      rm -f "$(installperms_sh)"
 
 # A rule to make precompiler output from C files.  This is not used during
 # ordinary builds, but but can very useful in debugging problems on strange
index 43d839d96616b61a3ac08b9df29fd8988bd30c6a..6f2dde3a3437a9fa22797c6dc2b668ba5ce7d796 100644 (file)
@@ -453,6 +453,13 @@ main(
 
     config_init(CONFIG_INIT_CLIENT, NULL);
 
+    if (config_errors(NULL) >= CFGERR_WARNINGS) {
+       config_print_errors();
+       if (config_errors(NULL) >= CFGERR_ERRORS) {
+           g_critical(_("errors processing config file"));
+       }
+    }
+
     if (argc > 1 && argv[1][0] != '-')
     {
        /*
index 61c9a6aa695e2e6aa2f33785560ea9496d08713b..d1d89556bda5af8b6137410e6b94cfe6cffe3b21 100644 (file)
@@ -1254,7 +1254,7 @@ okay_to_continue(
            break;
        }
        s = line;
-       while ((ch = *s++) != '\0' && isspace(ch)) {
+       while ((ch = *s++) != '\0' && g_ascii_isspace(ch)) {
            (void)ch;  /* Quiet empty loop body warning */
        }
        if (ch == '?') {
@@ -1301,9 +1301,9 @@ send_to_tape_server(
 {
     char *msg = stralloc2(cmd, "\r\n");
 
-    if (fullwrite(tss, msg, strlen(msg)) < 0)
+    if (full_write(tss, msg, strlen(msg)) < strlen(msg))
     {
-       error(_("Error writing to tape server"));
+       error(_("Error writing to tape server: %s"), strerror(errno));
        /*NOTREACHED*/
     }
     amfree(msg);
@@ -1447,7 +1447,7 @@ extract_files_setup(
        am_has_feature(indexsrv_features, fe_amidxtaped_datestamp)) {
 
        if(am_has_feature(indexsrv_features, fe_amidxtaped_config)) {
-           tt = newstralloc2(tt, "CONFIG=", config_name);
+           tt = newstralloc2(tt, "CONFIG=", config);
            send_to_tape_server(tape_control_sock, tt);
        }
        if(am_has_feature(indexsrv_features, fe_amidxtaped_label) &&
@@ -1874,7 +1874,7 @@ writer_intermediary(
     int child_pipe[2];
     pid_t pid;
     char buffer[DISK_BLOCK_BYTES];
-    ssize_t bytes_read;
+    size_t bytes_read;
     amwait_t extractor_status;
     int max_fd, nfound;
     SELECT_ARG_TYPE readset, selectset;
@@ -2014,7 +2014,7 @@ writer_intermediary(
                  * spit what we got from the server to the child
                  *  process handling actual dumpfile extraction
                  */
-                if(fullwrite(child_pipe[1], buffer, (size_t)bytes_read) < 0) {
+                if(full_write(child_pipe[1], buffer, bytes_read) < bytes_read) {
                     if(errno == EPIPE) {
                         error(_("pipe data reader has quit: %s\n"),
                               strerror(errno));
index 01f7936bb5d1f0591884c1555d7c49d5fda6b39a..923f357e5236b3277c1cc8ea77e36636284e5f9e 100644 (file)
@@ -8,7 +8,7 @@
 #define FLEX_SCANNER
 #define YY_FLEX_MAJOR_VERSION 2
 #define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 33
+#define YY_FLEX_SUBMINOR_VERSION 35
 #if YY_FLEX_SUBMINOR_VERSION > 0
 #define FLEX_BETA
 #endif
@@ -30,7 +30,7 @@
 
 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
 
-#if __STDC_VERSION__ >= 199901L
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
 
 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
  * if you want the limit (max/min) macros for int types. 
@@ -93,11 +93,12 @@ typedef unsigned int flex_uint32_t;
 
 #else  /* ! __cplusplus */
 
-#if __STDC__
+/* C99 requires __STDC__ to be defined as 1. */
+#if defined (__STDC__)
 
 #define YY_USE_CONST
 
-#endif /* __STDC__ */
+#endif /* defined (__STDC__) */
 #endif /* ! __cplusplus */
 
 #ifdef YY_USE_CONST
@@ -177,14 +178,9 @@ extern FILE *yyin, *yyout;
 
 #define unput(c) yyunput( c, (yytext_ptr)  )
 
-/* The following is because we cannot portably get our hands on size_t
- * (without autoconf's help, which isn't available because we want
- * flex-generated scanners to compile on their own).
- */
-
 #ifndef YY_TYPEDEF_YY_SIZE_T
 #define YY_TYPEDEF_YY_SIZE_T
-typedef unsigned int yy_size_t;
+typedef size_t yy_size_t;
 #endif
 
 #ifndef YY_STRUCT_YY_BUFFER_STATE
@@ -593,7 +589,7 @@ int         process_line(char *line);
 
 #line 62 "uscan.l"
 static char *string_buf = NULL;
-#line 597 "uscan.c"
+#line 593 "uscan.c"
 
 #define INITIAL 0
 #define quotedpath 1
@@ -683,7 +679,7 @@ static int input (void );
 /* This used to be an fputs(), but since the string might contain NUL's,
  * we now use fwrite().
  */
-#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
+#define ECHO fwrite( yytext, yyleng, 1, yyout )
 #endif
 
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
@@ -694,7 +690,7 @@ static int input (void );
        if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
                { \
                int c = '*'; \
-               size_t n; \
+               unsigned n; \
                for ( n = 0; n < max_size && \
                             (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
                        buf[n] = (char) c; \
@@ -783,7 +779,7 @@ YY_DECL
     /* literal keyword tokens */
 
 
-#line 787 "uscan.c"
+#line 783 "uscan.c"
 
        if ( !(yy_init) )
                {
@@ -1109,7 +1105,7 @@ YY_RULE_SETUP
 #line 165 "uscan.l"
 ECHO;
        YY_BREAK
-#line 1113 "uscan.c"
+#line 1109 "uscan.c"
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(quotedpath):
        yyterminate();
@@ -1341,7 +1337,7 @@ static int yy_get_next_buffer (void)
 
                /* Read in more data. */
                YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
-                       (yy_n_chars), num_to_read );
+                       (yy_n_chars), (size_t) num_to_read );
 
                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
                }
@@ -1365,6 +1361,14 @@ static int yy_get_next_buffer (void)
        else
                ret_val = EOB_ACT_CONTINUE_SCAN;
 
+       if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+               /* Extend the array by 50%, plus the number we really need. */
+               yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
+               YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
+               if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+                       YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+       }
+
        (yy_n_chars) += number_to_move;
        YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
        YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
@@ -1780,7 +1784,9 @@ static void yyensure_buffer_stack (void)
                (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
                                                                (num_to_alloc * sizeof(struct yy_buffer_state*)
                                                                );
-               
+               if ( ! (yy_buffer_stack) )
+                       YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+                                                                 
                memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
                                
                (yy_buffer_stack_max) = num_to_alloc;
@@ -1798,6 +1804,8 @@ static void yyensure_buffer_stack (void)
                                                                ((yy_buffer_stack),
                                                                num_to_alloc * sizeof(struct yy_buffer_state*)
                                                                );
+               if ( ! (yy_buffer_stack) )
+                       YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
 
                /* zero only the new slots.*/
                memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
@@ -1842,7 +1850,7 @@ YY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size )
 
 /** Setup the input buffer state to scan a string. The next call to yylex() will
  * scan from a @e copy of @a str.
- * @param str a NUL-terminated string to scan
+ * @param yystr a NUL-terminated string to scan
  * 
  * @return the newly allocated buffer state object.
  * @note If you want to scan bytes that may contain NUL values, then use
index 1952026447374300f8b4bdbf26a56ca37cb693c9..562403cf47aa50640898cf839447aca47d2f87b9 100644 (file)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  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.
@@ -37,6 +37,7 @@ DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps =  \
        $(top_srcdir)/config/macro-archive/ac_define_dir.m4 \
+       $(top_srcdir)/config/macro-archive/ac_perl_module_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_perl_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_swig.m4 \
        $(top_srcdir)/config/macro-archive/ax_compare_version.m4 \
@@ -70,6 +71,7 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/amanda/libs.m4 \
        $(top_srcdir)/config/amanda/net.m4 \
        $(top_srcdir)/config/amanda/progs.m4 \
+       $(top_srcdir)/config/amanda/ps.m4 \
        $(top_srcdir)/config/amanda/readdir.m4 \
        $(top_srcdir)/config/amanda/readline.m4 \
        $(top_srcdir)/config/amanda/rsh-security.m4 \
@@ -92,7 +94,9 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/float_h.m4 \
        $(top_srcdir)/config/gnulib/fsusage.m4 \
        $(top_srcdir)/config/gnulib/getaddrinfo.m4 \
+       $(top_srcdir)/config/gnulib/getopt.m4 \
        $(top_srcdir)/config/gnulib/gettimeofday.m4 \
+       $(top_srcdir)/config/gnulib/gnulib-common.m4 \
        $(top_srcdir)/config/gnulib/gnulib-comp.m4 \
        $(top_srcdir)/config/gnulib/include_next.m4 \
        $(top_srcdir)/config/gnulib/inet_ntop.m4 \
@@ -120,7 +124,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/sys_stat_h.m4 \
        $(top_srcdir)/config/gnulib/sys_time_h.m4 \
        $(top_srcdir)/config/gnulib/tempname.m4 \
-       $(top_srcdir)/config/gnulib/ulonglong.m4 \
        $(top_srcdir)/config/gnulib/unistd_h.m4 \
        $(top_srcdir)/config/gnulib/vasnprintf.m4 \
        $(top_srcdir)/config/gnulib/visibility.m4 \
@@ -131,7 +134,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gettext-macros/lib-ld.m4 \
        $(top_srcdir)/config/gettext-macros/lib-link.m4 \
        $(top_srcdir)/config/gettext-macros/lib-prefix.m4 \
-       $(top_srcdir)/config/gettext-macros/longlong.m4 \
        $(top_srcdir)/config/gettext-macros/nls.m4 \
        $(top_srcdir)/config/gettext-macros/po.m4 \
        $(top_srcdir)/config/gettext-macros/progtest.m4 \
@@ -150,6 +152,7 @@ SOURCES =
 DIST_SOURCES =
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
+AIX_BACKUP = @AIX_BACKUP@
 ALLOCA = @ALLOCA@
 ALLOCA_H = @ALLOCA_H@
 AMANDA_DBGDIR = @AMANDA_DBGDIR@
@@ -164,8 +167,10 @@ AMPLOT_CAT_GZIP = @AMPLOT_CAT_GZIP@
 AMPLOT_CAT_PACK = @AMPLOT_CAT_PACK@
 AMPLOT_COMPRESS = @AMPLOT_COMPRESS@
 AMTAR = @AMTAR@
+APPLICATION_DIR = @APPLICATION_DIR@
 AR = @AR@
 ARPA_INET_H = @ARPA_INET_H@
+ASSERTIONS = @ASSERTIONS@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -177,16 +182,28 @@ BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@
 BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@
 BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@
 BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@
+BSDTCP_SECURITY = @BSDTCP_SECURITY@
+BSDUDP_SECURITY = @BSDUDP_SECURITY@
+BSD_SECURITY = @BSD_SECURITY@
 CAT = @CAT@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
+CHECK_USERID = @CHECK_USERID@
 CHIO = @CHIO@
 CHS = @CHS@
+CLIENT_HOST_INSTANCE = @CLIENT_HOST_INSTANCE@
+CLIENT_HOST_KEY_FILE = @CLIENT_HOST_KEY_FILE@
+CLIENT_HOST_PRINCIPAL = @CLIENT_HOST_PRINCIPAL@
 CLIENT_LOGIN = @CLIENT_LOGIN@
 CLIENT_SCRIPTS_OPT = @CLIENT_SCRIPTS_OPT@
 COMPRESS = @COMPRESS@
+COMPRESS_BEST_OPT = @COMPRESS_BEST_OPT@
+COMPRESS_FAST_OPT = @COMPRESS_FAST_OPT@
+COMPRESS_PATH = @COMPRESS_PATH@
+COMPRESS_SUFFIX = @COMPRESS_SUFFIX@
+CONFIG_CLOBBER_MY_CONFIG = @CONFIG_CLOBBER_MY_CONFIG@
 CONFIG_DIR = @CONFIG_DIR@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
@@ -200,6 +217,7 @@ DD = @DD@
 DEFAULT_AMANDATES_FILE = @DEFAULT_AMANDATES_FILE@
 DEFAULT_CHANGER_DEVICE = @DEFAULT_CHANGER_DEVICE@
 DEFAULT_CONFIG = @DEFAULT_CONFIG@
+DEFAULT_MAILER = @DEFAULT_MAILER@
 DEFAULT_SERVER = @DEFAULT_SERVER@
 DEFAULT_TAPE_DEVICE = @DEFAULT_TAPE_DEVICE@
 DEFAULT_TAPE_SERVER = @DEFAULT_TAPE_SERVER@
@@ -207,7 +225,7 @@ DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DOC_BUILD_DATE = @DOC_BUILD_DATE@
 DUMP = @DUMP@
-DUMPER_DIR = @DUMPER_DIR@
+DUMP_RETURNS_1 = @DUMP_RETURNS_1@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -220,6 +238,7 @@ F77 = @F77@
 FFLAGS = @FFLAGS@
 FLOAT_H = @FLOAT_H@
 GETCONF = @GETCONF@
+GETOPT_H = @GETOPT_H@
 GETTEXT = @GETTEXT@
 GLIB_CFLAGS = @GLIB_CFLAGS@
 GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
@@ -230,9 +249,12 @@ GMSGFMT_015 = @GMSGFMT_015@
 GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
 GNULIB_CHOWN = @GNULIB_CHOWN@
 GNULIB_DUP2 = @GNULIB_DUP2@
+GNULIB_ENVIRON = @GNULIB_ENVIRON@
 GNULIB_FCHDIR = @GNULIB_FCHDIR@
 GNULIB_FFLUSH = @GNULIB_FFLUSH@
+GNULIB_FOPEN = @GNULIB_FOPEN@
 GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
+GNULIB_FREOPEN = @GNULIB_FREOPEN@
 GNULIB_FSEEK = @GNULIB_FSEEK@
 GNULIB_FSEEKO = @GNULIB_FSEEKO@
 GNULIB_FTELL = @GNULIB_FTELL@
@@ -242,6 +264,7 @@ GNULIB_GETCWD = @GNULIB_GETCWD@
 GNULIB_GETDELIM = @GNULIB_GETDELIM@
 GNULIB_GETLINE = @GNULIB_GETLINE@
 GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
+GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@
 GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
 GNULIB_LCHOWN = @GNULIB_LCHOWN@
 GNULIB_LSEEK = @GNULIB_LSEEK@
@@ -266,8 +289,10 @@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
 GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
 GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
 GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
+GNULIB_PUTENV = @GNULIB_PUTENV@
 GNULIB_READLINK = @GNULIB_READLINK@
 GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@
+GNULIB_SETENV = @GNULIB_SETENV@
 GNULIB_SLEEP = @GNULIB_SLEEP@
 GNULIB_SNPRINTF = @GNULIB_SNPRINTF@
 GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@
@@ -276,11 +301,15 @@ GNULIB_STPNCPY = @GNULIB_STPNCPY@
 GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
 GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
 GNULIB_STRDUP = @GNULIB_STRDUP@
+GNULIB_STRERROR = @GNULIB_STRERROR@
 GNULIB_STRNDUP = @GNULIB_STRNDUP@
 GNULIB_STRNLEN = @GNULIB_STRNLEN@
 GNULIB_STRPBRK = @GNULIB_STRPBRK@
 GNULIB_STRSEP = @GNULIB_STRSEP@
+GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@
+GNULIB_STRSTR = @GNULIB_STRSTR@
 GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
+GNULIB_UNSETENV = @GNULIB_UNSETENV@
 GNULIB_VASPRINTF = @GNULIB_VASPRINTF@
 GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@
 GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
@@ -294,6 +323,7 @@ GOBJECT_QUERY = @GOBJECT_QUERY@
 GREP = @GREP@
 GZIP = @GZIP@
 HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@
+HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@
 HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@
 HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@
 HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
@@ -302,9 +332,10 @@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
 HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@
 HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
 HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
-HAVE_DECL_STRNCASECMP = @HAVE_DECL_STRNCASECMP@
+HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@
 HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
 HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
+HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@
 HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
 HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
 HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
@@ -312,7 +343,9 @@ HAVE_DUP2 = @HAVE_DUP2@
 HAVE_FSEEKO = @HAVE_FSEEKO@
 HAVE_FTELLO = @HAVE_FTELLO@
 HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
+HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
 HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
+HAVE_GZIP = @HAVE_GZIP@
 HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
 HAVE_IO_H = @HAVE_IO_H@
 HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
@@ -321,8 +354,10 @@ HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@
 HAVE_MEMPCPY = @HAVE_MEMPCPY@
 HAVE_MKDTEMP = @HAVE_MKDTEMP@
 HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@
+HAVE_OS_H = @HAVE_OS_H@
 HAVE_READLINK = @HAVE_READLINK@
 HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@
+HAVE_SETENV = @HAVE_SETENV@
 HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
 HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
 HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
@@ -330,7 +365,6 @@ HAVE_SLEEP = @HAVE_SLEEP@
 HAVE_STDINT_H = @HAVE_STDINT_H@
 HAVE_STPCPY = @HAVE_STPCPY@
 HAVE_STPNCPY = @HAVE_STPNCPY@
-HAVE_STRCASECMP = @HAVE_STRCASECMP@
 HAVE_STRCASESTR = @HAVE_STRCASESTR@
 HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
 HAVE_STRNDUP = @HAVE_STRNDUP@
@@ -339,10 +373,12 @@ HAVE_STRSEP = @HAVE_STRSEP@
 HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@
 HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
 HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
+HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
 HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
 HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
 HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
 HAVE_UNISTD_H = @HAVE_UNISTD_H@
+HAVE_UNSETENV = @HAVE_UNSETENV@
 HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
 HAVE_VASPRINTF = @HAVE_VASPRINTF@
 HAVE_VISIBILITY = @HAVE_VISIBILITY@
@@ -358,6 +394,8 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 INTLLIBS = @INTLLIBS@
 INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+KRB4_SECURITY = @KRB4_SECURITY@
+KRB5_SECURITY = @KRB5_SECURITY@
 LDFLAGS = @LDFLAGS@
 LEX = @LEX@
 LEXLIB = @LEXLIB@
@@ -374,6 +412,8 @@ LIBTHREAD = @LIBTHREAD@
 LIBTOOL = @LIBTOOL@
 LIBTOOL_DEPS = @LIBTOOL_DEPS@
 LN_S = @LN_S@
+LOCKING = @LOCKING@
+LOW_TCPPORTRANGE = @LOW_TCPPORTRANGE@
 LTLIBICONV = @LTLIBICONV@
 LTLIBINTL = @LTLIBINTL@
 LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
@@ -382,7 +422,6 @@ LTLIBPTH = @LTLIBPTH@
 LTLIBTHREAD = @LTLIBTHREAD@
 MAILER = @MAILER@
 MAKEINFO = @MAKEINFO@
-MAXTAPEBLOCKSIZE = @MAXTAPEBLOCKSIZE@
 MCUTIL = @MCUTIL@
 MKDIR_P = @MKDIR_P@
 MSGFMT = @MSGFMT@
@@ -418,26 +457,37 @@ PERL_INC = @PERL_INC@
 PKG_CONFIG = @PKG_CONFIG@
 POSUB = @POSUB@
 PRINT = @PRINT@
+PS = @PS@
+PS_ARGUMENT = @PS_ARGUMENT@
 PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
 RANLIB = @RANLIB@
 READLINE_LIBS = @READLINE_LIBS@
 REPLACE_CHOWN = @REPLACE_CHOWN@
 REPLACE_FCHDIR = @REPLACE_FCHDIR@
 REPLACE_FFLUSH = @REPLACE_FFLUSH@
+REPLACE_FOPEN = @REPLACE_FOPEN@
 REPLACE_FPRINTF = @REPLACE_FPRINTF@
+REPLACE_FREOPEN = @REPLACE_FREOPEN@
 REPLACE_FSEEK = @REPLACE_FSEEK@
 REPLACE_FSEEKO = @REPLACE_FSEEKO@
 REPLACE_FTELL = @REPLACE_FTELL@
 REPLACE_FTELLO = @REPLACE_FTELLO@
 REPLACE_GETCWD = @REPLACE_GETCWD@
 REPLACE_GETLINE = @REPLACE_GETLINE@
+REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
 REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
 REPLACE_LCHOWN = @REPLACE_LCHOWN@
 REPLACE_LSEEK = @REPLACE_LSEEK@
+REPLACE_MEMMEM = @REPLACE_MEMMEM@
 REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
 REPLACE_PRINTF = @REPLACE_PRINTF@
+REPLACE_PUTENV = @REPLACE_PUTENV@
 REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
 REPLACE_SPRINTF = @REPLACE_SPRINTF@
+REPLACE_STRCASESTR = @REPLACE_STRCASESTR@
+REPLACE_STRERROR = @REPLACE_STRERROR@
+REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@
+REPLACE_STRSTR = @REPLACE_STRSTR@
 REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
 REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
 REPLACE_VPRINTF = @REPLACE_VPRINTF@
@@ -445,7 +495,11 @@ REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
 REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
 REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
 RESTORE = @RESTORE@
+RSH_SECURITY = @RSH_SECURITY@
 SAMBA_CLIENT = @SAMBA_CLIENT@
+SERVER_HOST_INSTANCE = @SERVER_HOST_INSTANCE@
+SERVER_HOST_KEY_FILE = @SERVER_HOST_KEY_FILE@
+SERVER_HOST_PRINCIPAL = @SERVER_HOST_PRINCIPAL@
 SERVICE_SUFFIX = @SERVICE_SUFFIX@
 SETUID_GROUP = @SETUID_GROUP@
 SET_MAKE = @SET_MAKE@
@@ -455,6 +509,7 @@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
 SNAPSHOT_STAMP = @SNAPSHOT_STAMP@
 SORT = @SORT@
 SSH = @SSH@
+SSH_SECURITY = @SSH_SECURITY@
 STDBOOL_H = @STDBOOL_H@
 STDINT_H = @STDINT_H@
 STRIP = @STRIP@
@@ -464,7 +519,14 @@ SWIG_LIB = @SWIG_LIB@
 SYS_SOCKET_H = @SYS_SOCKET_H@
 SYS_STAT_H = @SYS_STAT_H@
 SYS_TIME_H = @SYS_TIME_H@
+TCPPORTRANGE = @TCPPORTRANGE@
+TICKET_LIFETIME = @TICKET_LIFETIME@
+UDPPORTRANGE = @UDPPORTRANGE@
+UNCOMPRESS_OPT = @UNCOMPRESS_OPT@
+UNCOMPRESS_PATH = @UNCOMPRESS_PATH@
+USE_AMANDAHOSTS = @USE_AMANDAHOSTS@
 USE_NLS = @USE_NLS@
+USE_RUNDUMP = @USE_RUNDUMP@
 USE_VERSION_SUFFIXES = @USE_VERSION_SUFFIXES@
 VDUMP = @VDUMP@
 VERSION = @VERSION@
@@ -473,6 +535,7 @@ VERSION_MAJOR = @VERSION_MAJOR@
 VERSION_MINOR = @VERSION_MINOR@
 VERSION_PATCH = @VERSION_PATCH@
 VERSION_SUFFIX = @VERSION_SUFFIX@
+VOID_UNSETENV = @VOID_UNSETENV@
 VRESTORE = @VRESTORE@
 VXDUMP = @VXDUMP@
 VXRESTORE = @VXRESTORE@
@@ -501,6 +564,7 @@ am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+amdatadir = @amdatadir@
 amincludedir = @amincludedir@
 amlibdir = @amlibdir@
 amlibexecdir = @amlibexecdir@
@@ -519,6 +583,8 @@ dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 gl_LIBOBJS = @gl_LIBOBJS@
 gl_LTLIBOBJS = @gl_LTLIBOBJS@
+gltests_LIBOBJS = @gltests_LIBOBJS@
+gltests_LTLIBOBJS = @gltests_LTLIBOBJS@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
@@ -548,6 +614,7 @@ target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 EXTRA_DIST = \
index 3e572efabf04529cac9f3093a4cc650a4c043c96..e8d0b3559255d1f79d066453be49008f917efc7b 100644 (file)
@@ -7,11 +7,15 @@ usr/sbin/amcryp*
 usr/sbin/amgpgcrypt
 usr/sbin/amoldrecover
 usr/sbin/amrecover
+usr/sbin/amgetconf
 usr/share/man/man5/amanda.conf.5
 usr/share/man/man5/amanda-client.conf.5
+usr/share/man/man7/amanda-devices.7
+usr/share/man/man7/amanda-applications.7
 usr/share/man/man8/amanda.8
 usr/share/man/man8/amcheckdump.8
 usr/share/man/man8/amrecover.8
+usr/share/man/man8/amgetconf.8
 var/lib/amanda/*
 var/lib/amanda/gnutar-lists/*
 var/lib/amanda/example/xinetd.amandaclient
index b7069a4158028cc71b27a018a07c4c1fda934a5b..adea0975274b1a8e4271d9716fac6f14ee899324 100644 (file)
@@ -9,7 +9,6 @@ amanda-backup-client: file-in-unusual-dir usr/libexec/amanda/*
 amanda-backup-client: manpage-has-bad-whatis-entry
 amanda-backup-client: non-standard-dir-in-usr usr/libexec
 amanda-backup-client: non-standard-dir-in-var var/log/amanda
-amanda-backup-client: non-standard-dir-in-var var/amanda
 amanda-backup-client: non-standard-dir-perm var/lib/amanda/gnutar-lists
 amanda-backup-client: non-standard-dir-perm var/log/amanda 
 amanda-backup-client: package-name-doesnt-match-sonames
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 42e429db1dd768a90afc26b9b9aaf44f44e3d021..36dfe3e19302a086290306a9de15287e8b52e7ed 100644 (file)
@@ -4,6 +4,7 @@ usr/libexec/amanda/*
 usr/libexec/amanda/application/*
 usr/sbin/*
 usr/share/man/man5/*
+usr/share/man/man7/*
 usr/share/man/man8/*
 var/lib/amanda/*
 var/lib/amanda/gnutar-lists/*
old mode 100755 (executable)
new mode 100644 (file)
index 260db60..82769c6
@@ -49,6 +49,18 @@ echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '${AMTMP}'."
 chown ${amanda_user}:${amanda_group} ${AMTMP} || exit 1
 chmod 0640 ${AMTMP} || exit 1
 
+# install am_passphrase file to server
+echo "`date +'%b %e %Y %T'`: Checking '${AMANDAHOMEDIR}/.am_passphrase' file." 
+if [ ! -f ${AMANDAHOMEDIR}/.am_passphrase ] ; then
+        echo "`date +'%b %e %Y %T'`: Create '${AMANDAHOMEDIR}/.am_passphrase' file." 
+        touch ${AMANDAHOMEDIR}/.am_passphrase || exit 1
+        phrase=`echo $RANDOM | md5sum | awk '{print $1}'`
+        echo ${phrase} >>${AMANDAHOMEDIR}/.am_passphrase
+
+        chown ${amanda_user}:${amanda_group} ${AMANDAHOMEDIR}/.am_passphrase
+        chmod 0700 ${AMANDAHOMEDIR}/.am_passphrase 
+fi
+
 # Install .gnupg directory
 echo "`date +'%b %e %Y %T'`: Installing '${AMHOMEDIR}/.gnupg'." 
 if [ ! -d ${AMHOMEDIR}/.gnupg ] ; then
old mode 100755 (executable)
new mode 100644 (file)
index 4cee2d6fa759b46ec5ba474f80262db7e365e565..c054e3245e0d9a25447d1a2e485f0e7ccb857b02 100755 (executable)
@@ -49,7 +49,7 @@ fi
 
 if [ -z $AMVER ]
 then
-    AMVER=amanda-2.6.0p2
+    AMVER=amanda-2.6.1
 fi
 
 if [ -z $AMTARBALL ]
index 63eabb3891900112437d54f8acf31a1fe3184f22..306d3dc371b300af3333cbf400ba1b34bdca0edb 100644 (file)
@@ -1,9 +1,6 @@
-amanda (2.6.0p1-1) unstable; urgency=low
+amanda (2.6.1-1) unstable; urgency=low
 
   * Initial debian release: This package is based on Bdale Garbee's work as
     the official debian maintainer for amanda.
-  * Found by Daniel_p: Fixed typos in preinst and postrm.  Added permission
-    check for /tmp/amanda.  Fixed rules to append default perl site_lib to
-    .install file so that perl modules are installed.
 
- -- Zmanda <support@zmanda.com>  Mon, 10 Mar 2008 1:00:09 -0600
+ -- Zmanda <support@zmanda.com>  Wed, 26 Nov 2008 23:00:09 -0600
index bae37a02d27424c654a7cd569048c6ee81d47849..6fcae65c84d01641387ff3094f0de8c23cf00e87 100755 (executable)
@@ -8,7 +8,7 @@
 
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
-AMVER=2.6.0p2
+AMVER=2.6.1
 
 # These are variables that the user can override.  They get used in various
 # places during configure, build, and install.
@@ -60,7 +60,8 @@ build-stamp: /sbin/dump /usr/bin/smbclient
                --libexecdir=$(LIBEXECDIR) \
                --enable-shared \
                --sysconfdir=$(SYSCONFDIR) \
-               --localstatedir=$(LOCALSTATEDIR)\
+               --localstatedir=$(LOCALSTATEDIR) \
+               --with-amdatadir=$(AMHOMEDIR) \
                --with-gnutar-listdir=$(AMHOMEDIR)/gnutar-lists \
                --with-index-server=localhost \
                --with-tape-server=localhost \
@@ -149,10 +150,14 @@ binary-arch: build
        chmod -R u=rwX,g=rwX,o-rwx  $(client)/$(AMHOMEDIR)/gnutar-lists $(server)/$(AMHOMEDIR)/gnutar-lists
        # .. setuid
        chown root:disk \
+               $(client)/$(AMLIBEXECDIR)/application/amgtar \
+               $(client)/$(AMLIBEXECDIR)/application/amstar \
                $(client)/$(AMLIBEXECDIR)/killpgrp \
                $(client)/$(AMLIBEXECDIR)/rundump \
                $(client)/$(AMLIBEXECDIR)/runtar \
                $(client)/$(AMLIBEXECDIR)/calcsize \
+               $(server)/$(AMLIBEXECDIR)/application/amgtar \
+               $(server)/$(AMLIBEXECDIR)/application/amstar \
                $(server)/$(AMLIBEXECDIR)/killpgrp \
                $(server)/$(AMLIBEXECDIR)/rundump \
                $(server)/$(AMLIBEXECDIR)/runtar \
@@ -161,10 +166,14 @@ binary-arch: build
                $(server)/$(AMLIBEXECDIR)/planner \
                $(server)/usr/sbin/amcheck
        chmod u=srwx,g=rx,o=r \
+               $(client)/$(AMLIBEXECDIR)/application/amgtar \
+               $(client)/$(AMLIBEXECDIR)/application/amstar \
                $(client)$(AMLIBEXECDIR)/killpgrp \
                $(client)$(AMLIBEXECDIR)/rundump \
                $(client)$(AMLIBEXECDIR)/runtar \
                $(client)$(AMLIBEXECDIR)/calcsize \
+               $(server)/$(AMLIBEXECDIR)/application/amgtar \
+               $(server)/$(AMLIBEXECDIR)/application/amstar \
                $(server)$(AMLIBEXECDIR)/killpgrp \
                $(server)$(AMLIBEXECDIR)/rundump \
                $(server)$(AMLIBEXECDIR)/runtar \
index 64deb845989da8419ea1954fa900e3b598660d25..acb6d233699deae766c36fa77eba7a8fc585ee88 100644 (file)
@@ -15,8 +15,8 @@
 #  with this program; if not, write to the Free Software Foundation, Inc.,
 #  59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 # 
-#  Contact information: Zmanda Inc, 505 N Mathlida Ave, Suite 120
-#  Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+#  Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+#  Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 #
 
 
         %define disttag fc
         %define distver 7
     %endif
-    %if %(awk '$1 == "Fedora" && $3 ~ /8.*/ { exit 1; }' /etc/redhat-release; echo $?)
+    # if macro cannot have an empty test and we're just testing the existance
+    %if %{?fedora:yes}%{!?fedora:no} == yes
         %define dist fedora
         %define disttag fc
-        %define distver 8
-        # TODO: generalize this so that any platform can cross compile
+        %define distver %{fedora}
         %if %{_host_cpu} == x86_64 && %{_target_cpu} == i686
                 # Do nothing if PKG_CONFIG_PATH was set by the user above.
                 %{!?PKG_CONFIG_PATH: %define PKG_CONFIG_PATH /usr/lib/pkgconfig}
         %define distver 4
         %define tarver 1.14
     %endif
+    %if %(awk '$1 == "CentOS" && $3 ~ /4.*/ { exit 1; }' /etc/redhat-release; echo $?)
+       %define dist redhat
+       %define disttag rhel
+       %define distver 4
+       %define tarver 1.14
+    %endif
     %if %(awk '$1 == "Red" && $7 ~ /5.*/ { exit 1; }' /etc/redhat-release; echo $?)
         %define dist redhat
         %define disttag rhel
         %define distver 5
     %endif
+    %if %(awk '$1 == "CentOS" && $3 ~ /5.*/ { exit 1; }' /etc/redhat-release; echo $?)
+        %define dist redhat
+        %define disttag rhel
+        %define distver 5
+    %endif
+    
+    # If dist is undefined, we didn't detect.
+    %{!?dist:%define dist unknown}
 %endif
 # Detect Suse variants.  Suse gives us some nice macros in their rpms
 %if %{_vendor} == "suse"
-    %if %{suse_version} == 910
-        %define dist SuSE
-        %define disttag sles
-        %define distver 9
-    %endif
-    %if %{suse_version} == 1010
-        %define dist SuSE
-        %define disttag sles
-        %define distver 10
-    %endif
-    %if %{suse_version} == 1000
-        %define dist SuSE
-        %define disttag suse
-        %define distver 10
+    %define dist SuSE
+    %if %{sles_version} == 0
+       %define disttag suse
+       %if %{suse_version} == 910
+           %define distver 9
+       %endif
+       %if %{suse_version} == 1000
+           %define distver 10
+       %endif
+       %if %{suse_version} == 1010
+           %define distver 10
+       %endif
+       # Written against SLES11-beta2, which is using SUSE11's rpm system.
+       # This will change when they release, I assume.
+       %if %{suse_version} == 1100
+           # assume it's sles11 in disguise, for now
+           %define disttag sles
+           %define distver 11
+       %endif
+       %if %{suse_version} == 1110
+           %define distver 11.1
+       %endif
+    %else
+       %define disttag sles
+       # sles versions are simple integers, just like we want
+       %define distver %{sles_version}
     %endif
+   
+    # If dist is undefined, we didn't detect.
+    %{!?dist:%define dist unknown}
 %endif
 
 # Set options per distribution
     %define xinetd_reload restart
 %endif
 
+# Let's die if we haven't detected the distro. This might save some frustration.
+# RPM does not provide a way to  exit gracefully, hence the tag_to_cause_exit. 
+%{!?distver: %{error:"Your distribution and its version were not detected."}; %tag_to_cause_exit }
 # Set minimum tar version if it wasn't set in the per-distro section
 %{!?tarver: %define tarver 1.15}
 
 # --- Definitions ---
 
 # Define amanda_version if it is not already defined.
-%{!?amanda_version: %define amanda_version 2.6.0p2}
+%{!?amanda_version: %define amanda_version 2.6.1}
 %{!?amanda_release: %define amanda_release 1}
 %define amanda_version_info "Amanda Community Edition - version %{amanda_version}"
 %define amanda_user amandabackup
@@ -159,7 +191,12 @@ BuildRequires: flex
 BuildRequires: gcc
 BuildRequires: glibc >= 2.2.0
 BuildRequires: readline
+BuildRequires: readline-devel
 BuildRequires: curl >= 7.10.0
+BuildRequires: curl-devel >= 7.10.0
+BuildRequires: openssl
+BuildRequires: openssl-devel
+BuildRequires: perl(ExtUtils::Embed)
 Requires: /bin/awk
 Requires: /bin/date
 Requires: /usr/bin/id
@@ -174,11 +211,15 @@ Requires: libc.so.6
 Requires: libm.so.6
 Requires: libnsl.so.1
 Requires: curl >= 7.10.0
+Requires: openssl
 Requires: xinetd
 Requires: perl >= 5.6.0
 Requires: tar >= %{tarver}
-%if  %{dist} == redhat || %{dist}== fedora
+Requires: readline
+%if  %{dist} == redhat || %{dist} == fedora
+  %if %{distver} <= 8
 Requires: libtermcap.so.2
+  %endif
 Requires: initscripts
 %endif
 Provides: amanda-backup_client = %{amanda_version}, amanda-backup_server = %{amanda_version}
@@ -190,7 +231,9 @@ Requires: /bin/awk
 Requires: fileutils
 Requires: grep
 %if  %{dist} == redhat || %{dist}== fedora
+  %if %{distver} <= 8
 Requires: libtermcap.so.2
+  %endif
 Requires: initscripts
 %endif
 Requires: xinetd
@@ -198,7 +241,8 @@ Requires: libc.so.6
 Requires: libm.so.6
 Requires: libnsl.so.1
 Requires: perl >= 5.6.0
-Requires: tar >= 1.15
+Requires: tar >= %{tarver}
+Requires: readline
 Provides: amanda-backup_client = %{amanda_version}
 Provides: libamclient-%{version}.so = %{amanda_version}
 Provides: libamanda-%{version}.so = %{amanda_version}
@@ -214,12 +258,14 @@ Requires: libc.so.6
 Requires: libm.so.6
 Requires: libnsl.so.1
 %if  %{dist} == redhat || %{dist}== fedora
+  %if %{distver} <= 8
 Requires: libtermcap.so.2
+  %endif
 Requires: initscripts
 %endif
 Requires: xinetd
 Requires: perl >= 5.6.0
-Requires: tar >= 1.15
+Requires: tar >= %{tarver}
 Provides: amanda-backup_server = %{amanda_version}
 Provides: libamclient-%{version}.so = %{amanda_version}
 Provides: libamanda-%{version}.so = %{amanda_version}
@@ -278,6 +324,7 @@ Amanda Documentation is available at: http://wiki.zmanda.com/
 %define DATADIR         %{PREFIX}/share
 %define SYSCONFDIR      /etc
 %define LOCALSTATEDIR   /var
+%define AMANDATES       %{AMANDAHOMEDIR}/amandates
 %define AMANDAHOMEDIR   %{LOCALSTATEDIR}/lib/amanda
 %ifarch x86_64
 %define LIBDIR          %{EPREFIX}/lib64
@@ -289,6 +336,7 @@ Amanda Documentation is available at: http://wiki.zmanda.com/
 %define MANDIR          %{DATADIR}/man
 %define LOGDIR          /var/log/amanda
 %define PERLSITELIB     %(eval "`perl -V:installsitelib`"; echo $installsitelib)
+%define AMDATADIR      /var/lib/amanda
 
 # Installation directories:
 %define ROOT_SBINDIR            %{buildroot}/%{SBINDIR}
@@ -300,6 +348,7 @@ Amanda Documentation is available at: http://wiki.zmanda.com/
 %define ROOT_LIBDIR             %{buildroot}/%{LIBDIR}
 %define ROOT_MANDIR             %{buildroot}/%{MANDIR}
 %define ROOT_LOGDIR             %{buildroot}/%{LOGDIR}
+%define ROOT_AMDATADIR          %{buildroot}/%{AMDATADIR}
 
 # --- Unpack ---
 
@@ -321,8 +370,8 @@ Amanda Documentation is available at: http://wiki.zmanda.com/
         --localstatedir=%{LOCALSTATEDIR} \
         --libdir=%{LIBDIR} \
         --includedir=%{INCLUDEDIR} \
+       --with-amdatadir=%{AMDATADIR} \
         --with-gnuplot=/usr/bin/gnuplot \
-        --with-gnutar=/bin/tar \
         --with-gnutar-listdir=%{AMANDAHOMEDIR}/gnutar-lists \
         --with-index-server=localhost \
         --with-tape-server=localhost \
@@ -354,6 +403,7 @@ Amanda Documentation is available at: http://wiki.zmanda.com/
         --localstatedir=%{LOCALSTATEDIR} \
         --libdir=%{LIBDIR} \
         --includedir=%{INCLUDEDIR} \
+       --with-amdatadir=%{AMDATADIR} \
         --with-star=/usr/bin/star \
         --with-gnuplot=/usr/bin/gnuplot \
         --with-gnutar=/bin/tar \
@@ -612,29 +662,29 @@ if [ -e /etc/xinetd.d ] && [ -d /etc/xinetd.d ] ; then
         fi
 fi
 
-echo "`date +'%b %e %Y %T'`: Installing '%{LOCALSTATEDIR}/amanda/amandates'." >${TMPFILE}
+echo "`date +'%b %e %Y %T'`: Installing '%{AMANDATES}'." >${TMPFILE}
 ret_val=0
-if [ ! -f %{LOCALSTATEDIR}/amanda/amandates ] ; then
-        touch %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1
+if [ ! -f %{AMANDATES} ] ; then
+        touch %{AMANDATES} >>${TMPFILE} 2>&1
         ret_val=$?
         if [ ${ret_val} -eq 0 ]; then
-                echo "`date +'%b %e %Y %T'`: The file '%{LOCALSTATEDIR}/amanda/amandates' has been created." >>${TMPFILE}
+                echo "`date +'%b %e %Y %T'`: The file '%{AMANDATES}' has been created." >>${TMPFILE}
         fi
 fi
 if [ ${ret_val} -eq 0 ]; then
-        echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{LOCALSTATEDIR}/amanda/amandates'." >>${TMPFILE}
-        chown %{amanda_user}:%{amanda_group} %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1
-        chmod 0640 %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1
+        echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{AMANDATES}'." >>${TMPFILE}
+        chown %{amanda_user}:%{amanda_group} %{AMANDATES} >>${TMPFILE} 2>&1
+        chmod 0640 %{AMANDATES} >>${TMPFILE} 2>&1
         if [ -x /sbin/restorecon ] ; then
-              /sbin/restorecon %{LOCALSTATEDIR}/amanda/amandates  >>${TMPFILE} 2>&1
+              /sbin/restorecon %{AMANDATES}  >>${TMPFILE} 2>&1
         fi
 fi
 if [ ${ret_val} -eq 0 ]; then
-        echo "`date +'%b %e %Y %T'`: '%{LOCALSTATEDIR}/amanda/amandates' Installation successful." >>${TMPFILE}
+        echo "`date +'%b %e %Y %T'`: '%{AMANDATES}' Installation successful." >>${TMPFILE}
         cat ${TMPFILE}
         cat ${TMPFILE} >>${INSTALL_LOG}
 else
-        echo "`date +'%b %e %Y %T'`: '%{LOCALSTATEDIR}/amanda/amandates' Installation failed." >>${TMPFILE}
+        echo "`date +'%b %e %Y %T'`: '%{AMANDATES}' Installation failed." >>${TMPFILE}
         cat ${TMPFILE}
         cat ${TMPFILE} >>${INSTALL_ERR}
 fi
@@ -977,26 +1027,26 @@ if [ -e /etc/xinetd.d ] && [ -d /etc/xinetd.d ] ; then
         fi
 fi
 
-echo "`date +'%b %e %Y %T'`: Installing '%{LOCALSTATEDIR}/amanda/amandates'." >${TMPFILE}
+echo "`date +'%b %e %Y %T'`: Installing '%{AMANDATES}'." >${TMPFILE}
 ret_val=0
-if [ ! -f %{LOCALSTATEDIR}/amanda/amandates ] ; then
-        touch %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1
+if [ ! -f %{AMANDATES} ] ; then
+        touch %{AMANDATES} >>${TMPFILE} 2>&1
         ret_val=$?
         if [ ${ret_val} -eq 0 ]; then
-                echo "`date +'%b %e %Y %T'`: The file '%{LOCALSTATEDIR}/amanda/amandates' has been created." >>${TMPFILE}
+                echo "`date +'%b %e %Y %T'`: The file '%{AMANDATES}' has been created." >>${TMPFILE}
         fi
 fi
 if [ ${ret_val} -eq 0 ]; then
-        echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{LOCALSTATEDIR}/amanda/amandates'." >>${TMPFILE}
-        chown %{amanda_user}:%{amanda_group} %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1
-        chmod 0640 %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1
+        echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{AMANDATES}'." >>${TMPFILE}
+        chown %{amanda_user}:%{amanda_group} %{AMANDATES} >>${TMPFILE} 2>&1
+        chmod 0640 %{AMANDATES} >>${TMPFILE} 2>&1
 fi
 if [ ${ret_val} -eq 0 ]; then
-        echo "`date +'%b %e %Y %T'`: '%{LOCALSTATEDIR}/amanda/amandates' Installation successful." >>${TMPFILE}
+        echo "`date +'%b %e %Y %T'`: '%{AMANDATES}' Installation successful." >>${TMPFILE}
         cat ${TMPFILE}
         cat ${TMPFILE} >>${INSTALL_LOG}
 else
-        echo "`date +'%b %e %Y %T'`: '%{LOCALSTATEDIR}/amanda/amandates' Installation failed." >>${TMPFILE}
+        echo "`date +'%b %e %Y %T'`: '%{AMANDATES}' Installation failed." >>${TMPFILE}
         cat ${TMPFILE}
         cat ${TMPFILE} >>${INSTALL_ERR}
 fi
@@ -1034,7 +1084,7 @@ echo "`date +'%b %e %Y %T'`: Checking '%{AMANDAHOMEDIR}/.am_passphrase' file." >
 if [ ! -f %{AMANDAHOMEDIR}/.am_passphrase ] ; then
         echo "`date +'%b %e %Y %T'`: Create '%{AMANDAHOMEDIR}/.am_passphrase' file." >${TMPFILE}
         touch %{AMANDAHOMEDIR}/.am_passphrase >>${TMPFILE} 2>&1
-        phrase=`echo "amandabackup" | md5sum | awk '{print $1}'`
+        phrase=`echo $RANDOM | md5sum | awk '{print $1}'`
         echo ${phrase} >>%{AMANDAHOMEDIR}/.am_passphrase
 
         chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.am_passphrase >>${TMPFILE} 2>&1
@@ -1361,26 +1411,26 @@ if [ -e /etc/xinetd.d ] && [ -d /etc/xinetd.d ] ; then
         fi
 fi
 
-echo "`date +'%b %e %Y %T'`: Installing '%{LOCALSTATEDIR}/amanda/amandates'." >${TMPFILE}
+echo "`date +'%b %e %Y %T'`: Installing '%{AMANDATES}'." >${TMPFILE}
 ret_val=0
-if [ ! -f %{LOCALSTATEDIR}/amanda/amandates ] ; then
-        touch %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1
+if [ ! -f %{AMANDATES} ] ; then
+        touch %{AMANDATES} >>${TMPFILE} 2>&1
         ret_val=$?
         if [ ${ret_val} -eq 0 ]; then
-                echo "`date +'%b %e %Y %T'`: The file '%{LOCALSTATEDIR}/amanda/amandates' has been created." >>${TMPFILE}
+                echo "`date +'%b %e %Y %T'`: The file '%{AMANDATES}' has been created." >>${TMPFILE}
         fi
 fi
 if [ ${ret_val} -eq 0 ]; then
-        echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{LOCALSTATEDIR}/amanda/amandates'." >>${TMPFILE}
-        chown %{amanda_user}:%{amanda_group} %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1
-        chmod 0640 %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1
+        echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{AMANDATES}'." >>${TMPFILE}
+        chown %{amanda_user}:%{amanda_group} %{AMANDATES} >>${TMPFILE} 2>&1
+        chmod 0640 %{AMANDATES} >>${TMPFILE} 2>&1
 fi
 if [ ${ret_val} -eq 0 ]; then
-        echo "`date +'%b %e %Y %T'`: '%{LOCALSTATEDIR}/amanda/amandates' Installation successful." >>${TMPFILE}
+        echo "`date +'%b %e %Y %T'`: '%{AMANDATES}' Installation successful." >>${TMPFILE}
         cat ${TMPFILE}
         cat ${TMPFILE} >>${INSTALL_LOG}
 else
-        echo "`date +'%b %e %Y %T'`: '%{LOCALSTATEDIR}/amanda/amandates' Installation failed." >>${TMPFILE}
+        echo "`date +'%b %e %Y %T'`: '%{AMANDATES}' Installation failed." >>${TMPFILE}
         cat ${TMPFILE}
         cat ${TMPFILE} >>${INSTALL_ERR}
 fi
@@ -1508,14 +1558,13 @@ echo "Amanda installation log can be found in '${INSTALL_LOG}' and errors (if an
 # Notes:  Do not use wildcards on directories not wholly owned by amanda.  An
 # uninstall of the software will attempt to delete whatever matches here.
 %files backup_client
-%defattr(0755,%{amanda_user},%{amanda_group})
-%{SYSCONFDIR}/amanda
-%{AMANDAHOMEDIR}
+%defattr(0755,%{amanda_user},%{amanda_group},0755)
 %{AMLIBEXECDIR}
 %{AMLIBDIR}
-%{AMLIBEXECDIR}/amanda-sh-lib.sh
-%{LOCALSTATEDIR}/amanda
+%{PERLSITELIB}/auto/Amanda
 %defattr(4750,root,disk)
+%{AMLIBEXECDIR}/application/amgtar
+%{AMLIBEXECDIR}/application/amstar
 %{AMLIBEXECDIR}/calcsize
 %{AMLIBEXECDIR}/killpgrp
 %{AMLIBEXECDIR}/rundump
@@ -1527,17 +1576,30 @@ echo "Amanda installation log can be found in '${INSTALL_LOG}' and errors (if an
 %{SBINDIR}/amgpgcrypt
 %{SBINDIR}/amoldrecover
 %{SBINDIR}/amrecover
-%defattr(0644,%{amanda_user},%{amanda_group})
+%defattr(0644,%{amanda_user},%{amanda_group},0755)
+%{LOCALSTATEDIR}/amanda
+%{PERLSITELIB}/Amanda
+%{SYSCONFDIR}/amanda
 %docdir %{MANDIR}
 %{MANDIR}/man5/amanda.conf.5.gz
 %{MANDIR}/man5/amanda-client.conf.5.gz
+%{MANDIR}/man7/amanda-devices.7.gz
+%{MANDIR}/man7/amanda-applications.7.gz
+%{MANDIR}/man7/amanda-scripts.7.gz
+%{MANDIR}/man8/amaespipe.8.gz
 %{MANDIR}/man8/amanda.8.gz
 %{MANDIR}/man8/amcheckdump.8.gz
+%{MANDIR}/man8/amcrypt*
+%{MANDIR}/man8/amgpgcrypt.8.gz
 %{MANDIR}/man8/amrecover.8.gz
 %{AMLIBEXECDIR}/amcat.awk
-%{AMANDAHOMEDIR}/amanda-release
-%{AMANDAHOMEDIR}/example/xinetd.amandaclient
-%{AMANDAHOMEDIR}/example/amanda-client.conf
+%{AMANDAHOMEDIR}/gnutar-lists
+%doc %{AMANDAHOMEDIR}/amanda-release
+%doc %{AMANDAHOMEDIR}/example/xinetd.amandaclient
+%doc %{AMANDAHOMEDIR}/example/xinetd.amandaserver
+%doc %{AMANDAHOMEDIR}/example/amanda-client.conf
+%doc %{AMANDAHOMEDIR}/template.d/README
+%doc %{AMANDAHOMEDIR}/template.d/dumptypes
 
 %files backup_server
 %defattr(0755,%{amanda_user},%{amanda_group})
@@ -1548,32 +1610,7 @@ echo "Amanda installation log can be found in '${INSTALL_LOG}' and errors (if an
 %{PERLSITELIB}/auto/Amanda
 %{AMANDAHOMEDIR}
 %{LOCALSTATEDIR}/amanda
-%{SBINDIR}/amaddclient
-%{SBINDIR}/amadmin
-%{SBINDIR}/amcheckdb
-%{SBINDIR}/amcheckdump
-%{SBINDIR}/amcleanup
-%{SBINDIR}/amdd
-%{SBINDIR}/amdevcheck
-%{SBINDIR}/amdump
-%{SBINDIR}/amfetchdump
-%{SBINDIR}/amflush
-%{SBINDIR}/amgetconf
-%{SBINDIR}/amlabel
-%{SBINDIR}/ammt
-%{SBINDIR}/amoverview
-%{SBINDIR}/amplot
-%{SBINDIR}/amreport
-%{SBINDIR}/amrestore
-%{SBINDIR}/amrmtape
-%{SBINDIR}/amserverconfig
-%{SBINDIR}/amstatus
-%{SBINDIR}/amtape
-%{SBINDIR}/amtapetype
-%{SBINDIR}/amtoc
-%{SBINDIR}/amverify
-%{SBINDIR}/amverifyrun
-%{AMLIBEXECDIR}/amanda-sh-lib.sh
+%{SBINDIR}/am*
 %defattr(4750,root,disk)
 %{AMLIBEXECDIR}/calcsize
 %{AMLIBEXECDIR}/killpgrp
@@ -1584,11 +1621,9 @@ echo "Amanda installation log can be found in '${INSTALL_LOG}' and errors (if an
 %{SBINDIR}/amcheck
 %defattr(0750,%{amanda_user},%{amanda_group})
 %{LOGDIR}
+%{SBINDIR}/activate-devpay
 %{SBINDIR}/amaespipe
-%{SBINDIR}/amcrypt
-%{SBINDIR}/amcrypt-ossl
-%{SBINDIR}/amcrypt-ossl-asym
-%{SBINDIR}/amcryptsimple
+%{SBINDIR}/amcrypt*
 %{SBINDIR}/amgpgcrypt
 %{SBINDIR}/amoldrecover
 %{SBINDIR}/amrecover
@@ -1598,55 +1633,32 @@ echo "Amanda installation log can be found in '${INSTALL_LOG}' and errors (if an
 %{AMLIBEXECDIR}/amplot.g
 %{AMLIBEXECDIR}/amplot.gp
 %docdir %{MANDIR}
-%{MANDIR}/man5/amanda.conf.5.gz
-%{MANDIR}/man5/amanda-client.conf.5.gz
-%{MANDIR}/man8/amaddclient.8.gz
-%{MANDIR}/man8/amadmin.8.gz
-%{MANDIR}/man8/amanda.8.gz
-%{MANDIR}/man8/amcheck.8.gz
-%{MANDIR}/man8/amcheckdb.8.gz
-%{MANDIR}/man8/amcheckdump.8.gz
-%{MANDIR}/man8/amcleanup.8.gz
-%{MANDIR}/man8/amdd.8.gz
-%{MANDIR}/man8/amdump.8.gz
-%{MANDIR}/man8/amfetchdump.8.gz
-%{MANDIR}/man8/amflush.8.gz
-%{MANDIR}/man8/amgetconf.8.gz
-%{MANDIR}/man8/amlabel.8.gz
-%{MANDIR}/man8/ammt.8.gz
-%{MANDIR}/man8/amoverview.8.gz
-%{MANDIR}/man8/amplot.8.gz
-%{MANDIR}/man8/amrecover.8.gz
-%{MANDIR}/man8/amreport.8.gz
-%{MANDIR}/man8/amrestore.8.gz
-%{MANDIR}/man8/amrmtape.8.gz
-%{MANDIR}/man8/amserverconfig.8.gz
-%{MANDIR}/man8/amstatus.8.gz
-%{MANDIR}/man8/amtape.8.gz
-%{MANDIR}/man8/amtapetype.8.gz
-%{MANDIR}/man8/amtoc.8.gz
-%{MANDIR}/man8/amverify.8.gz
-%{MANDIR}/man8/amverifyrun.8.gz
-%{MANDIR}/man8/amcrypt.8.gz
-%{MANDIR}/man8/amcrypt-ossl.8.gz
-%{MANDIR}/man8/amcrypt-ossl-asym.8.gz
-%{MANDIR}/man8/amcryptsimple.8.gz
-%{MANDIR}/man8/amgpgcrypt.8.gz
-%{MANDIR}/man8/amaespipe.8.gz
-%{MANDIR}/man8/amdevcheck.8.gz
-%{AMANDAHOMEDIR}/amanda-release
-%{AMANDAHOMEDIR}/example/amanda-client.conf
-%{AMANDAHOMEDIR}/example/xinetd.amandaserver
+%{MANDIR}/man5/am*
+%{MANDIR}/man5/disklist.5.gz
+%{MANDIR}/man5/tapelist.5.gz
+%{MANDIR}/man7/am*
+%{MANDIR}/man8/am*
+%{MANDIR}/man8/script-email.8.gz
+%doc %{AMANDAHOMEDIR}/amanda-release
+%docdir %{AMANDAHOMEDIR}/example
+%docdir %{AMANDAHOMEDIR}/template.d
 
 # --- ChangeLog
 
 %changelog
+* Mon Sep 15 2008 Dan Locks <dwlocks at zmanda dot com> 2.6.1alpha
+- Added detection of CentOS 4 and 5 as suggested by dswartz
+- graceful failure when Distro/version is not detected correctly
+* Thu Jun 12 2008 Dan Locks <dwlocks at zmanda dot com> 2.6.1alpha
+- install amgtar and amstar suid root
+* Mon Jun 09 2008 Dan Locks <dwlocks at zmanda dot com> 2.6.1alpha
+- Replaced individual SBINDIR/am... entries with SBINDIR/am* in %%files
 * Fri May 02 2008 Dan Locks <dwlocks at zmanda dot com>
 - Changed instances of ${ to %%{ where applicable
 * Tue Mar 11 2008 Dan Locks <dwlocks at zmanda dot com>
 - fixed many rpmlint complaints
 - added --quiet to configure statements
-- moved PERLSITELIB to definitions section
+- added PERLSITELIB to definitions section and perl files to %%files section
 * Wed Feb 13 2008 Dan Locks <dwlocks at zmanda dot com>
 - added an environment check for PKG_CONFIG_PATH
 - added PKG_CONFIG_PATH conditional to handle cross comp on FC8 (environment 
index 6361d140ae15049bcedbeb51152a5f57bf1676ec..d2b39341631cd0d182ee815bb26958ff43188cf9 100755 (executable)
@@ -1,13 +1,35 @@
 #!/bin/bash
-# Buildpkg script for producing RPM packages. Does not require root access.
+
+# Buildpkg script for producing RPM packages. (Does not require root access.)
+# Buildpkg is designed to be used by both buildbot (to automate rpm production)
+# and by J Random User (to build an rpm for kicks).  The odd way of handling
+# all optioins through environment variables is a product of buildbot.
+#
+# AMVER: the version of amanda we're working on.  This will become part of the
+#     rpm name.  AMVER must line up with the version number mentioned in the
+#     .spec file.
+# AMTARBALL: the name of the tarball which contains the source code.  it must
+#     unpack into a directory named AMVER.  It's easiest and safest to just 
+#     let the script create a new one for you, even if it's a bit more overhead
+# AMPKGDIR: Rpmbuild expects absolute paths, so we provide this var.  It also
+#     allows you to build somewhere other than `pwd`.  You probably don't want
+#     to use the system-wide location, as the script tries to blow these
+#     directories away.
+# 
+# Other Hints:
+# Not everyone will want to use the ./configure options we provide.  The
+# easiest way to change them is by editing the .spec file.  This isn't so
+# easy, unfortunately.  Look at the %build section, and the %define xxxx 
+# statements immediately above it. good luck.
 
 # This is useful for debugging
 set -x
 # Buildbot exports some useful env variables.
 # Check for $AMVER.  I couldn't come up with a good way to detect it.
 if [ -z $AMVER ]; then
-    AMVER=amanda-2.6.0p2
+    AMVER=amanda-2.6.1
 fi
+
 # Check for AMTARBALL variable.
 if [ -z $AMTARBALL ]; then 
     AMTARBALL=$AMVER.tar.gz
@@ -17,7 +39,7 @@ fi
 if [ ! -f ${AMTARBALL} ]; then
     mkdir ${AMVER}
     cp -Rfp * ${AMVER}/
-    tar -cf ${AMTARBALL} -z ${AMVER}
+    tar -cf ${AMTARBALL} -z ${AMVER} || exit 1
     rm -rf ${AMVER}
 fi
 
@@ -26,27 +48,27 @@ if [ -z $AMPKGDIR ]; then
     AMPKGDIR=${PWD}
 fi
 if [ ! -d ${AMPKGDIR} ]; then
-    mkdir ${AMPKGDIR}
+    mkdir ${AMPKGDIR} || exit 1
 fi
 cd ${AMPKGDIR}
 
 if [ -d rpm ]; then
-    rm -rf rpm
+    rm -rf rpm || exit 1
 fi
 mkdir rpm
 mkdir rpm/SOURCES
 mkdir rpm/SRPMS
 mkdir rpm/SPECS
 mkdir rpm/BUILD
-mkdir rpm/RPMS
+mkdir rpm/RPMS || exit 1
 
 # Make a copy of the tarball with the name that rpmbuild expects
-cp ${AMTARBALL} rpm/SOURCES/${AMVER}.tar.gz
-cp packaging/rpm/amanda.spec rpm/SPECS/amanda.spec
+cp ${AMTARBALL} rpm/SOURCES/${AMVER}.tar.gz || exit 1
+cp packaging/rpm/amanda.spec rpm/SPECS || exit 1
 # Rpmbuild requires absolute paths.  annoying.  If you need to change the 
 # default value of some rpm.spec variable, just pass extra --define options.
 # this is useful for changing %amanda_release or %amanda_version
 rpmbuild -ba --define "_topdir ${AMPKGDIR}/rpm" \
-             ${AMPKGDIR}/rpm/SPECS/amanda.spec 
+             ${AMPKGDIR}/rpm/SPECS/amanda.spec || exit 1
 cp rpm/RPMS/*/*.rpm . || exit 1
 cp rpm/SRPMS/*.rpm . || exit 1
diff --git a/perl/Amanda/Application.c b/perl/Amanda/Application.c
new file mode 100644 (file)
index 0000000..1462e23
--- /dev/null
@@ -0,0 +1,2020 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ * 
+ * This file is not intended to be easily readable and contains a number of 
+ * coding conventions designed to improve portability and efficiency. Do not make
+ * changes to this file unless you know what you are doing--modify the SWIG 
+ * interface file instead. 
+ * ----------------------------------------------------------------------------- */
+
+#define SWIGPERL
+#define SWIG_CASTRANK_MODE
+/* -----------------------------------------------------------------------------
+ *  This section contains generic SWIG labels for method/variable
+ *  declarations/attributes, and other compiler dependent labels.
+ * ----------------------------------------------------------------------------- */
+
+/* template workaround for compilers that cannot correctly implement the C++ standard */
+#ifndef SWIGTEMPLATEDISAMBIGUATOR
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# elif defined(__HP_aCC)
+/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
+/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# else
+#  define SWIGTEMPLATEDISAMBIGUATOR
+# endif
+#endif
+
+/* inline attribute */
+#ifndef SWIGINLINE
+# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
+#   define SWIGINLINE inline
+# else
+#   define SWIGINLINE
+# endif
+#endif
+
+/* attribute recognised by some compilers to avoid 'unused' warnings */
+#ifndef SWIGUNUSED
+# if defined(__GNUC__)
+#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#     define SWIGUNUSED __attribute__ ((__unused__)) 
+#   else
+#     define SWIGUNUSED
+#   endif
+# elif defined(__ICC)
+#   define SWIGUNUSED __attribute__ ((__unused__)) 
+# else
+#   define SWIGUNUSED 
+# endif
+#endif
+
+#ifndef SWIGUNUSEDPARM
+# ifdef __cplusplus
+#   define SWIGUNUSEDPARM(p)
+# else
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
+# endif
+#endif
+
+/* internal SWIG method */
+#ifndef SWIGINTERN
+# define SWIGINTERN static SWIGUNUSED
+#endif
+
+/* internal inline SWIG method */
+#ifndef SWIGINTERNINLINE
+# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
+#endif
+
+/* exporting methods */
+#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#  ifndef GCC_HASCLASSVISIBILITY
+#    define GCC_HASCLASSVISIBILITY
+#  endif
+#endif
+
+#ifndef SWIGEXPORT
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   if defined(STATIC_LINKED)
+#     define SWIGEXPORT
+#   else
+#     define SWIGEXPORT __declspec(dllexport)
+#   endif
+# else
+#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
+#     define SWIGEXPORT __attribute__ ((visibility("default")))
+#   else
+#     define SWIGEXPORT
+#   endif
+# endif
+#endif
+
+/* calling conventions for Windows */
+#ifndef SWIGSTDCALL
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   define SWIGSTDCALL __stdcall
+# else
+#   define SWIGSTDCALL
+# endif 
+#endif
+
+/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
+#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
+# define _SCL_SECURE_NO_DEPRECATE
+#endif
+
+
+/* -----------------------------------------------------------------------------
+ * swigrun.swg
+ *
+ * This file contains generic CAPI SWIG runtime support for pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+/* This should only be incremented when either the layout of swig_type_info changes,
+   or for whatever reason, the runtime changes incompatibly */
+#define SWIG_RUNTIME_VERSION "4"
+
+/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
+#ifdef SWIG_TYPE_TABLE
+# define SWIG_QUOTE_STRING(x) #x
+# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
+# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
+#else
+# define SWIG_TYPE_TABLE_NAME
+#endif
+
+/*
+  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
+  creating a static or dynamic library from the swig runtime code.
+  In 99.9% of the cases, swig just needs to declare them as 'static'.
+  
+  But only do this if is strictly necessary, ie, if you have problems
+  with your compiler or so.
+*/
+
+#ifndef SWIGRUNTIME
+# define SWIGRUNTIME SWIGINTERN
+#endif
+
+#ifndef SWIGRUNTIMEINLINE
+# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
+#endif
+
+/*  Generic buffer size */
+#ifndef SWIG_BUFFER_SIZE
+# define SWIG_BUFFER_SIZE 1024
+#endif
+
+/* Flags for pointer conversions */
+#define SWIG_POINTER_DISOWN        0x1
+#define SWIG_CAST_NEW_MEMORY       0x2
+
+/* Flags for new pointer objects */
+#define SWIG_POINTER_OWN           0x1
+
+
+/* 
+   Flags/methods for returning states.
+   
+   The swig conversion methods, as ConvertPtr, return and integer 
+   that tells if the conversion was successful or not. And if not,
+   an error code can be returned (see swigerrors.swg for the codes).
+   
+   Use the following macros/flags to set or process the returning
+   states.
+   
+   In old swig versions, you usually write code as:
+
+     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
+       // success code
+     } else {
+       //fail code
+     }
+
+   Now you can be more explicit as:
+
+    int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+    } else {
+      // fail code
+    }
+
+   that seems to be the same, but now you can also do
+
+    Type *ptr;
+    int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+      if (SWIG_IsNewObj(res) {
+        ...
+       delete *ptr;
+      } else {
+        ...
+      }
+    } else {
+      // fail code
+    }
+    
+   I.e., now SWIG_ConvertPtr can return new objects and you can
+   identify the case and take care of the deallocation. Of course that
+   requires also to SWIG_ConvertPtr to return new result values, as
+
+      int SWIG_ConvertPtr(obj, ptr,...) {         
+        if (<obj is ok>) {                            
+          if (<need new object>) {                    
+            *ptr = <ptr to new allocated object>; 
+            return SWIG_NEWOBJ;                       
+          } else {                                    
+            *ptr = <ptr to old object>;               
+            return SWIG_OLDOBJ;                       
+          }                                   
+        } else {                                      
+          return SWIG_BADOBJ;                 
+        }                                             
+      }
+
+   Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
+   more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
+   swig errors code.
+
+   Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
+   allows to return the 'cast rank', for example, if you have this
+
+       int food(double)
+       int fooi(int);
+
+   and you call
+      food(1)   // cast rank '1'  (1 -> 1.0)
+      fooi(1)   // cast rank '0'
+
+   just use the SWIG_AddCast()/SWIG_CheckState()
+
+
+ */
+#define SWIG_OK                    (0) 
+#define SWIG_ERROR                 (-1)
+#define SWIG_IsOK(r)               (r >= 0)
+#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)  
+
+/* The CastRankLimit says how many bits are used for the cast rank */
+#define SWIG_CASTRANKLIMIT         (1 << 8)
+/* The NewMask denotes the object was created (using new/malloc) */
+#define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
+/* The TmpMask is for in/out typemaps that use temporal objects */
+#define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
+/* Simple returning values */
+#define SWIG_BADOBJ                (SWIG_ERROR)
+#define SWIG_OLDOBJ                (SWIG_OK)
+#define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
+#define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
+/* Check, add and del mask methods */
+#define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
+#define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
+#define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
+#define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
+#define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
+#define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
+
+
+/* Cast-Rank Mode */
+#if defined(SWIG_CASTRANK_MODE)
+#  ifndef SWIG_TypeRank
+#    define SWIG_TypeRank             unsigned long
+#  endif
+#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
+#    define SWIG_MAXCASTRANK          (2)
+#  endif
+#  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
+#  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
+SWIGINTERNINLINE int SWIG_AddCast(int r) { 
+  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
+}
+SWIGINTERNINLINE int SWIG_CheckState(int r) { 
+  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
+}
+#else /* no cast-rank mode */
+#  define SWIG_AddCast
+#  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
+#endif
+
+
+
+
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void *(*swig_converter_func)(void *, int *);
+typedef struct swig_type_info *(*swig_dycast_func)(void **);
+
+/* Structure to store information on one type */
+typedef struct swig_type_info {
+  const char             *name;                        /* mangled name of this type */
+  const char             *str;                 /* human readable name of this type */
+  swig_dycast_func        dcast;               /* dynamic cast function down a hierarchy */
+  struct swig_cast_info  *cast;                        /* linked list of types that can cast into this type */
+  void                   *clientdata;          /* language specific type data */
+  int                    owndata;              /* flag if the structure owns the clientdata */
+} swig_type_info;
+
+/* Structure to store a type and conversion function used for casting */
+typedef struct swig_cast_info {
+  swig_type_info         *type;                        /* pointer to type that is equivalent to this type */
+  swig_converter_func     converter;           /* function to cast the void pointers */
+  struct swig_cast_info  *next;                        /* pointer to next cast in linked list */
+  struct swig_cast_info  *prev;                        /* pointer to the previous cast */
+} swig_cast_info;
+
+/* Structure used to store module information
+ * Each module generates one structure like this, and the runtime collects
+ * all of these structures and stores them in a circularly linked list.*/
+typedef struct swig_module_info {
+  swig_type_info         **types;              /* Array of pointers to swig_type_info structures that are in this module */
+  size_t                 size;                 /* Number of types in this module */
+  struct swig_module_info *next;               /* Pointer to next element in circularly linked list */
+  swig_type_info         **type_initial;       /* Array of initially generated type structures */
+  swig_cast_info         **cast_initial;       /* Array of initially generated casting structures */
+  void                    *clientdata;         /* Language specific module data */
+} swig_module_info;
+
+/* 
+  Compare two type names skipping the space characters, therefore
+  "char*" == "char *" and "Class<int>" == "Class<int >", etc.
+
+  Return 0 when the two name types are equivalent, as in
+  strncmp, but skipping ' '.
+*/
+SWIGRUNTIME int
+SWIG_TypeNameComp(const char *f1, const char *l1,
+                 const char *f2, const char *l2) {
+  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
+    while ((*f1 == ' ') && (f1 != l1)) ++f1;
+    while ((*f2 == ' ') && (f2 != l2)) ++f2;
+    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
+  }
+  return (int)((l1 - f1) - (l2 - f2));
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if not equal, 1 if equal
+*/
+SWIGRUNTIME int
+SWIG_TypeEquiv(const char *nb, const char *tb) {
+  int equiv = 0;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (!equiv && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
+*/
+SWIGRUNTIME int
+SWIG_TypeCompare(const char *nb, const char *tb) {
+  int equiv = 0;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (!equiv && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
+
+
+/* think of this as a c++ template<> or a scheme macro */
+#define SWIG_TypeCheck_Template(comparison, ty)         \
+  if (ty) {                                             \
+    swig_cast_info *iter = ty->cast;                    \
+    while (iter) {                                      \
+      if (comparison) {                                 \
+        if (iter == ty->cast) return iter;              \
+        /* Move iter to the top of the linked list */   \
+        iter->prev->next = iter->next;                  \
+        if (iter->next)                                 \
+          iter->next->prev = iter->prev;                \
+        iter->next = ty->cast;                          \
+        iter->prev = 0;                                 \
+        if (ty->cast) ty->cast->prev = iter;            \
+        ty->cast = iter;                                \
+        return iter;                                    \
+      }                                                 \
+      iter = iter->next;                                \
+    }                                                   \
+  }                                                     \
+  return 0
+
+/*
+  Check the typename
+*/
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheck(const char *c, swig_type_info *ty) {
+  SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
+}
+
+/* Same as previous function, except strcmp is replaced with a pointer comparison */
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
+  SWIG_TypeCheck_Template(iter->type == from, into);
+}
+
+/*
+  Cast a pointer up an inheritance hierarchy
+*/
+SWIGRUNTIMEINLINE void *
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
+}
+
+/* 
+   Dynamic pointer casting. Down an inheritance hierarchy
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
+  swig_type_info *lastty = ty;
+  if (!ty || !ty->dcast) return ty;
+  while (ty && (ty->dcast)) {
+    ty = (*ty->dcast)(ptr);
+    if (ty) lastty = ty;
+  }
+  return lastty;
+}
+
+/*
+  Return the name associated with this type
+*/
+SWIGRUNTIMEINLINE const char *
+SWIG_TypeName(const swig_type_info *ty) {
+  return ty->name;
+}
+
+/*
+  Return the pretty name associated with this type,
+  that is an unmangled type name in a form presentable to the user.
+*/
+SWIGRUNTIME const char *
+SWIG_TypePrettyName(const swig_type_info *type) {
+  /* The "str" field contains the equivalent pretty names of the
+     type, separated by vertical-bar characters.  We choose
+     to print the last name, as it is often (?) the most
+     specific. */
+  if (!type) return NULL;
+  if (type->str != NULL) {
+    const char *last_name = type->str;
+    const char *s;
+    for (s = type->str; *s; s++)
+      if (*s == '|') last_name = s+1;
+    return last_name;
+  }
+  else
+    return type->name;
+}
+
+/* 
+   Set the clientdata field for a type
+*/
+SWIGRUNTIME void
+SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
+  swig_cast_info *cast = ti->cast;
+  /* if (ti->clientdata == clientdata) return; */
+  ti->clientdata = clientdata;
+  
+  while (cast) {
+    if (!cast->converter) {
+      swig_type_info *tc = cast->type;
+      if (!tc->clientdata) {
+       SWIG_TypeClientData(tc, clientdata);
+      }
+    }    
+    cast = cast->next;
+  }
+}
+SWIGRUNTIME void
+SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
+  SWIG_TypeClientData(ti, clientdata);
+  ti->owndata = 1;
+}
+  
+/*
+  Search for a swig_type_info structure only by mangled name
+  Search is a O(log #types)
+  
+  We start searching at module start, and finish searching when start == end.  
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_MangledTypeQueryModule(swig_module_info *start, 
+                            swig_module_info *end, 
+                           const char *name) {
+  swig_module_info *iter = start;
+  do {
+    if (iter->size) {
+      register size_t l = 0;
+      register size_t r = iter->size - 1;
+      do {
+       /* since l+r >= 0, we can (>> 1) instead (/ 2) */
+       register size_t i = (l + r) >> 1; 
+       const char *iname = iter->types[i]->name;
+       if (iname) {
+         register int compare = strcmp(name, iname);
+         if (compare == 0) {       
+           return iter->types[i];
+         } else if (compare < 0) {
+           if (i) {
+             r = i - 1;
+           } else {
+             break;
+           }
+         } else if (compare > 0) {
+           l = i + 1;
+         }
+       } else {
+         break; /* should never happen */
+       }
+      } while (l <= r);
+    }
+    iter = iter->next;
+  } while (iter != end);
+  return 0;
+}
+
+/*
+  Search for a swig_type_info structure for either a mangled name or a human readable name.
+  It first searches the mangled names of the types, which is a O(log #types)
+  If a type is not found it then searches the human readable names, which is O(#types).
+  
+  We start searching at module start, and finish searching when start == end.  
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeQueryModule(swig_module_info *start, 
+                     swig_module_info *end, 
+                    const char *name) {
+  /* STEP 1: Search the name field using binary search */
+  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
+  if (ret) {
+    return ret;
+  } else {
+    /* STEP 2: If the type hasn't been found, do a complete search
+       of the str field (the human readable name) */
+    swig_module_info *iter = start;
+    do {
+      register size_t i = 0;
+      for (; i < iter->size; ++i) {
+       if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
+         return iter->types[i];
+      }
+      iter = iter->next;
+    } while (iter != end);
+  }
+  
+  /* neither found a match */
+  return 0;
+}
+
+/* 
+   Pack binary data into a string
+*/
+SWIGRUNTIME char *
+SWIG_PackData(char *c, void *ptr, size_t sz) {
+  static const char hex[17] = "0123456789abcdef";
+  register const unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu =  u + sz;
+  for (; u != eu; ++u) {
+    register unsigned char uu = *u;
+    *(c++) = hex[(uu & 0xf0) >> 4];
+    *(c++) = hex[uu & 0xf];
+  }
+  return c;
+}
+
+/* 
+   Unpack binary data from a string
+*/
+SWIGRUNTIME const char *
+SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
+  register unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu = u + sz;
+  for (; u != eu; ++u) {
+    register char d = *(c++);
+    register unsigned char uu;
+    if ((d >= '0') && (d <= '9'))
+      uu = ((d - '0') << 4);
+    else if ((d >= 'a') && (d <= 'f'))
+      uu = ((d - ('a'-10)) << 4);
+    else 
+      return (char *) 0;
+    d = *(c++);
+    if ((d >= '0') && (d <= '9'))
+      uu |= (d - '0');
+    else if ((d >= 'a') && (d <= 'f'))
+      uu |= (d - ('a'-10));
+    else 
+      return (char *) 0;
+    *u = uu;
+  }
+  return c;
+}
+
+/* 
+   Pack 'void *' into a string buffer.
+*/
+SWIGRUNTIME char *
+SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
+  char *r = buff;
+  if ((2*sizeof(void *) + 2) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,&ptr,sizeof(void *));
+  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
+  strcpy(r,name);
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      *ptr = (void *) 0;
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sizeof(void *));
+}
+
+SWIGRUNTIME char *
+SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
+  char *r = buff;
+  size_t lname = (name ? strlen(name) : 0);
+  if ((2*sz + 2 + lname) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  if (lname) {
+    strncpy(r,name,lname+1);
+  } else {
+    *r = 0;
+  }
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      memset(ptr,0,sz);
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sz);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/*  Errors in SWIG */
+#define  SWIG_UnknownError        -1 
+#define  SWIG_IOError             -2 
+#define  SWIG_RuntimeError        -3 
+#define  SWIG_IndexError          -4 
+#define  SWIG_TypeError           -5 
+#define  SWIG_DivisionByZero      -6 
+#define  SWIG_OverflowError       -7 
+#define  SWIG_SyntaxError         -8 
+#define  SWIG_ValueError          -9 
+#define  SWIG_SystemError         -10
+#define  SWIG_AttributeError      -11
+#define  SWIG_MemoryError         -12 
+#define  SWIG_NullReferenceError   -13
+
+
+
+#ifdef __cplusplus
+/* Needed on some windows machines---since MS plays funny games with the header files under C++ */
+#include <math.h>
+#include <stdlib.h>
+extern "C" {
+#endif
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+/* Add in functionality missing in older versions of Perl. Much of this is based on Devel-PPPort on cpan. */
+
+/* Add PERL_REVISION, PERL_VERSION, PERL_SUBVERSION if missing */
+#ifndef PERL_REVISION
+#  if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION))
+#    define PERL_PATCHLEVEL_H_IMPLICIT
+#    include <patchlevel.h>
+#  endif
+#  if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL)))
+#    include <could_not_find_Perl_patchlevel.h>
+#  endif
+#  ifndef PERL_REVISION
+#    define PERL_REVISION       (5)
+#    define PERL_VERSION        PATCHLEVEL
+#    define PERL_SUBVERSION     SUBVERSION
+#  endif
+#endif
+
+#if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE)
+#define PerlIO_exportFILE(fh,fl) (FILE*)(fh)
+#endif
+
+#ifndef SvIOK_UV
+# define SvIOK_UV(sv)       (SvIOK(sv) && (SvUVX(sv) == SvIVX(sv)))
+#endif
+
+#ifndef SvUOK
+# define SvUOK(sv)           SvIOK_UV(sv)
+#endif
+
+#if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5)))
+#  define PL_sv_undef               sv_undef
+#  define PL_na                            na
+#  define PL_errgv                  errgv
+#  define PL_sv_no                  sv_no
+#  define PL_sv_yes                 sv_yes
+#  define PL_markstack_ptr          markstack_ptr
+#endif
+
+#ifndef IVSIZE
+#  ifdef LONGSIZE
+#    define IVSIZE LONGSIZE
+#  else
+#    define IVSIZE 4 /* A bold guess, but the best we can make. */
+#  endif
+#endif
+
+#ifndef INT2PTR
+#  if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)
+#    define PTRV                  UV
+#    define INT2PTR(any,d)        (any)(d)
+#  else
+#    if PTRSIZE == LONGSIZE
+#      define PTRV                unsigned long
+#    else
+#      define PTRV                unsigned
+#    endif
+#    define INT2PTR(any,d)        (any)(PTRV)(d)
+#  endif
+
+#  define NUM2PTR(any,d)  (any)(PTRV)(d)
+#  define PTR2IV(p)       INT2PTR(IV,p)
+#  define PTR2UV(p)       INT2PTR(UV,p)
+#  define PTR2NV(p)       NUM2PTR(NV,p)
+
+#  if PTRSIZE == LONGSIZE
+#    define PTR2ul(p)     (unsigned long)(p)
+#  else
+#    define PTR2ul(p)     INT2PTR(unsigned long,p)
+#  endif
+#endif /* !INT2PTR */
+
+#ifndef SvPV_nolen
+# define SvPV_nolen(x) SvPV(x,PL_na)
+#endif
+
+#ifndef get_sv
+#  define get_sv perl_get_sv
+#endif
+
+#ifndef ERRSV
+#  define ERRSV get_sv("@",FALSE)
+#endif
+
+#ifndef pTHX_
+#define pTHX_
+#endif   
+
+#include <string.h>
+#ifdef __cplusplus
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ * error manipulation
+ * ----------------------------------------------------------------------------- */
+
+SWIGINTERN const char*
+SWIG_Perl_ErrorType(int code) {
+  const char* type = 0;
+  switch(code) {
+  case SWIG_MemoryError:
+    type = "MemoryError";
+    break;
+  case SWIG_IOError:
+    type = "IOError";
+    break;
+  case SWIG_RuntimeError:
+    type = "RuntimeError";
+    break;
+  case SWIG_IndexError:
+    type = "IndexError";
+    break;
+  case SWIG_TypeError:
+    type = "TypeError";
+    break;
+  case SWIG_DivisionByZero:
+    type = "ZeroDivisionError";
+    break;
+  case SWIG_OverflowError:
+    type = "OverflowError";
+    break;
+  case SWIG_SyntaxError:
+    type = "SyntaxError";
+    break;
+  case SWIG_ValueError:
+    type = "ValueError";
+    break;
+  case SWIG_SystemError:
+    type = "SystemError";
+    break;
+  case SWIG_AttributeError:
+    type = "AttributeError";
+    break;
+  default:
+    type = "RuntimeError";
+  }
+  return type;
+}
+
+
+
+
+/* -----------------------------------------------------------------------------
+ * perlrun.swg
+ *
+ * This file contains the runtime support for Perl modules
+ * and includes code for managing global variables and pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef PERL_OBJECT
+#define SWIG_PERL_OBJECT_DECL CPerlObj *SWIGUNUSEDPARM(pPerl),
+#define SWIG_PERL_OBJECT_CALL pPerl,
+#else
+#define SWIG_PERL_OBJECT_DECL
+#define SWIG_PERL_OBJECT_CALL
+#endif
+
+/* Common SWIG API */
+
+/* for raw pointers */
+#define SWIG_ConvertPtr(obj, pp, type, flags)           SWIG_Perl_ConvertPtr(SWIG_PERL_OBJECT_CALL obj, pp, type, flags)
+#define SWIG_NewPointerObj(p, type, flags)              SWIG_Perl_NewPointerObj(SWIG_PERL_OBJECT_CALL p, type, flags)
+
+/* for raw packed data */
+#define SWIG_ConvertPacked(obj, p, s, type)             SWIG_Perl_ConvertPacked(SWIG_PERL_OBJECT_CALL obj, p, s, type)
+#define SWIG_NewPackedObj(p, s, type)                  SWIG_Perl_NewPackedObj(SWIG_PERL_OBJECT_CALL p, s, type)
+
+/* for class or struct pointers */
+#define SWIG_ConvertInstance(obj, pptr, type, flags)    SWIG_ConvertPtr(obj, pptr, type, flags)
+#define SWIG_NewInstanceObj(ptr, type, flags)           SWIG_NewPointerObj(ptr, type, flags)
+
+/* for C or C++ function pointers */
+#define SWIG_ConvertFunctionPtr(obj, pptr, type)        SWIG_ConvertPtr(obj, pptr, type, 0)
+#define SWIG_NewFunctionPtrObj(ptr, type)               SWIG_NewPointerObj(ptr, type, 0)
+
+/* for C++ member pointers, ie, member methods */
+#define SWIG_ConvertMember(obj, ptr, sz, ty)            SWIG_ConvertPacked(obj, ptr, sz, ty)
+#define SWIG_NewMemberObj(ptr, sz, type)                SWIG_NewPackedObj(ptr, sz, type)
+
+
+/* Runtime API */
+
+#define SWIG_GetModule(clientdata)                      SWIG_Perl_GetModule()
+#define SWIG_SetModule(clientdata, pointer)             SWIG_Perl_SetModule(pointer)
+
+
+/* Error manipulation */
+
+#define SWIG_ErrorType(code)                            SWIG_Perl_ErrorType(code)               
+#define SWIG_Error(code, msg)                          sv_setpvf(GvSV(PL_errgv),"%s %s\n", SWIG_ErrorType(code), msg)
+#define SWIG_fail                                      goto fail                                                   
+
+/* Perl-specific SWIG API */
+
+#define SWIG_MakePtr(sv, ptr, type, flags)              SWIG_Perl_MakePtr(SWIG_PERL_OBJECT_CALL sv, ptr, type, flags)
+#define SWIG_MakePackedObj(sv, p, s, type)             SWIG_Perl_MakePackedObj(SWIG_PERL_OBJECT_CALL sv, p, s, type)
+#define SWIG_SetError(str)                              SWIG_Error(SWIG_RuntimeError, str)
+
+
+#define SWIG_PERL_DECL_ARGS_1(arg1)                     (SWIG_PERL_OBJECT_DECL arg1)
+#define SWIG_PERL_CALL_ARGS_1(arg1)                     (SWIG_PERL_OBJECT_CALL arg1)
+#define SWIG_PERL_DECL_ARGS_2(arg1, arg2)               (SWIG_PERL_OBJECT_DECL arg1, arg2)
+#define SWIG_PERL_CALL_ARGS_2(arg1, arg2)               (SWIG_PERL_OBJECT_CALL arg1, arg2)
+
+/* -----------------------------------------------------------------------------
+ * pointers/data manipulation
+ * ----------------------------------------------------------------------------- */
+
+/* For backward compatibility only */
+#define SWIG_POINTER_EXCEPTION  0
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SWIG_OWNER   SWIG_POINTER_OWN
+#define SWIG_SHADOW  SWIG_OWNER << 1
+
+#define SWIG_MAYBE_PERL_OBJECT SWIG_PERL_OBJECT_DECL
+
+/* SWIG Perl macros */
+
+/* Macro to declare an XS function */
+#ifndef XSPROTO
+#   define XSPROTO(name) void name(pTHX_ CV* cv)
+#endif
+
+/* Macro to call an XS function */
+#ifdef PERL_OBJECT 
+#  define SWIG_CALLXS(_name) _name(cv,pPerl) 
+#else 
+#  ifndef MULTIPLICITY 
+#    define SWIG_CALLXS(_name) _name(cv) 
+#  else 
+#    define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv) 
+#  endif 
+#endif 
+
+#ifdef PERL_OBJECT
+#define MAGIC_PPERL  CPerlObj *pPerl = (CPerlObj *) this;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
+#define SWIGCLASS_STATIC
+
+#else /* PERL_OBJECT */
+
+#define MAGIC_PPERL
+#define SWIGCLASS_STATIC static SWIGUNUSED
+
+#ifndef MULTIPLICITY
+#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (*SwigMagicFunc)(SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#else /* MULTIPLICITY */
+
+#define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MULTIPLICITY */
+#endif /* PERL_OBJECT */
+
+/* Workaround for bug in perl 5.6.x croak and earlier */
+#if (PERL_VERSION < 8)
+#  ifdef PERL_OBJECT
+#    define SWIG_croak_null() SWIG_Perl_croak_null(pPerl)
+static void SWIG_Perl_croak_null(CPerlObj *pPerl)
+#  else
+static void SWIG_croak_null()
+#  endif
+{
+  SV *err=ERRSV;
+#  if (PERL_VERSION < 6)
+  croak("%_", err);
+#  else
+  if (SvOK(err) && !SvROK(err)) croak("%_", err);
+  croak(Nullch);
+#  endif
+}
+#else
+#  define SWIG_croak_null() croak(Nullch)
+#endif
+
+
+/* 
+   Define how strict is the cast between strings and integers/doubles
+   when overloading between these types occurs.
+   
+   The default is making it as strict as possible by using SWIG_AddCast
+   when needed.
+   
+   You can use -DSWIG_PERL_NO_STRICT_STR2NUM at compilation time to
+   disable the SWIG_AddCast, making the casting between string and
+   numbers less strict.
+
+   In the end, we try to solve the overloading between strings and
+   numerical types in the more natural way, but if you can avoid it,
+   well, avoid it using %rename, for example.
+*/
+#ifndef SWIG_PERL_NO_STRICT_STR2NUM
+# ifndef SWIG_PERL_STRICT_STR2NUM
+#  define SWIG_PERL_STRICT_STR2NUM
+# endif
+#endif
+#ifdef SWIG_PERL_STRICT_STR2NUM
+/* string takes precedence */
+#define SWIG_Str2NumCast(x) SWIG_AddCast(x)  
+#else
+/* number takes precedence */
+#define SWIG_Str2NumCast(x) x
+#endif
+
+
+
+#include <stdlib.h>
+
+SWIGRUNTIME const char *
+SWIG_Perl_TypeProxyName(const swig_type_info *type) {
+  if (!type) return NULL;
+  if (type->clientdata != NULL) {
+    return (const char*) type->clientdata;
+  } 
+  else {
+    return type->name;
+  }
+}
+
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
+  SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp(iter->type->name, c) == 0)) 
+                           || (iter->type->clientdata && (strcmp((char*)iter->type->clientdata, c) == 0))), ty);
+}
+
+
+/* Function for getting a pointer value */
+
+SWIGRUNTIME int
+SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags) {
+  swig_cast_info *tc;
+  void *voidptr = (void *)0;
+  SV *tsv = 0;
+  /* If magical, apply more magic */
+  if (SvGMAGICAL(sv))
+    mg_get(sv);
+
+  /* Check to see if this is an object */
+  if (sv_isobject(sv)) {
+    IV tmp = 0;
+    tsv = (SV*) SvRV(sv);
+    if ((SvTYPE(tsv) == SVt_PVHV)) {
+      MAGIC *mg;
+      if (SvMAGICAL(tsv)) {
+        mg = mg_find(tsv,'P');
+        if (mg) {
+          sv = mg->mg_obj;
+          if (sv_isobject(sv)) {
+           tsv = (SV*)SvRV(sv);
+            tmp = SvIV(tsv);
+          }
+        }
+      } else {
+        return SWIG_ERROR;
+      }
+    } else {
+      tmp = SvIV(tsv);
+    }
+    voidptr = INT2PTR(void *,tmp);
+  } else if (! SvOK(sv)) {            /* Check for undef */
+    *(ptr) = (void *) 0;
+    return SWIG_OK;
+  } else if (SvTYPE(sv) == SVt_RV) {  /* Check for NULL pointer */
+    if (!SvROK(sv)) {
+      *(ptr) = (void *) 0;
+      return SWIG_OK;
+    } else {
+      return SWIG_ERROR;
+    }
+  } else {                            /* Don't know what it is */
+    return SWIG_ERROR;
+  }
+  if (_t) {
+    /* Now see if the types match */
+    char *_c = HvNAME(SvSTASH(SvRV(sv)));
+    tc = SWIG_TypeProxyCheck(_c,_t);
+    if (!tc) {
+      return SWIG_ERROR;
+    }
+    {
+      int newmemory = 0;
+      *ptr = SWIG_TypeCast(tc,voidptr,&newmemory);
+      assert(!newmemory); /* newmemory handling not yet implemented */
+    }
+  } else {
+    *ptr = voidptr;
+  }
+
+  /* 
+   *  DISOWN implementation: we need a perl guru to check this one.
+   */
+  if (tsv && (flags & SWIG_POINTER_DISOWN)) {
+    /* 
+     *  almost copy paste code from below SWIG_POINTER_OWN setting
+     */
+    SV *obj = sv;
+    HV *stash = SvSTASH(SvRV(obj));
+    GV *gv = *(GV**) hv_fetch(stash, "OWNER", 5, TRUE);
+    if (isGV(gv)) {
+      HV *hv = GvHVn(gv);
+      /*
+       * To set ownership (see below), a newSViv(1) entry is added. 
+       * Hence, to remove ownership, we delete the entry.
+       */
+      if (hv_exists_ent(hv, obj, 0)) {
+       hv_delete_ent(hv, obj, 0, 0);
+      }
+    }
+  }
+  return SWIG_OK;
+}
+
+SWIGRUNTIME void
+SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, swig_type_info *t, int flags) {
+  if (ptr && (flags & SWIG_SHADOW)) {
+    SV *self;
+    SV *obj=newSV(0);
+    HV *hash=newHV();
+    HV *stash;
+    sv_setref_pv(obj, (char *) SWIG_Perl_TypeProxyName(t), ptr);
+    stash=SvSTASH(SvRV(obj));
+    if (flags & SWIG_POINTER_OWN) {
+      HV *hv;
+      GV *gv=*(GV**)hv_fetch(stash, "OWNER", 5, TRUE);
+      if (!isGV(gv))
+        gv_init(gv, stash, "OWNER", 5, FALSE);
+      hv=GvHVn(gv);
+      hv_store_ent(hv, obj, newSViv(1), 0);
+    }
+    sv_magic((SV *)hash, (SV *)obj, 'P', Nullch, 0);
+    SvREFCNT_dec(obj);
+    self=newRV_noinc((SV *)hash);
+    sv_setsv(sv, self);
+    SvREFCNT_dec((SV *)self);
+    sv_bless(sv, stash);
+  }
+  else {
+    sv_setref_pv(sv, (char *) SWIG_Perl_TypeProxyName(t), ptr);
+  }
+}
+
+SWIGRUNTIMEINLINE SV *
+SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info *t, int flags) {
+  SV *result = sv_newmortal();
+  SWIG_MakePtr(result, ptr, t, flags);
+  return result;
+}
+
+SWIGRUNTIME void
+SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, int sz, swig_type_info *type) {
+  char result[1024];
+  char *r = result;
+  if ((2*sz + 1 + strlen(SWIG_Perl_TypeProxyName(type))) > 1000) return;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  strcpy(r,SWIG_Perl_TypeProxyName(type));
+  sv_setpv(sv, result);
+}
+
+SWIGRUNTIME SV *
+SWIG_Perl_NewPackedObj(SWIG_MAYBE_PERL_OBJECT void *ptr, int sz, swig_type_info *type) {
+  SV *result = sv_newmortal();
+  SWIG_Perl_MakePackedObj(result, ptr, sz, type);
+  return result;
+}
+
+/* Convert a packed value value */
+SWIGRUNTIME int
+SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty) {
+  swig_cast_info *tc;
+  const char  *c = 0;
+
+  if ((!obj) || (!SvOK(obj))) return SWIG_ERROR;
+  c = SvPV_nolen(obj);
+  /* Pointer values must start with leading underscore */
+  if (*c != '_') return SWIG_ERROR;
+  c++;
+  c = SWIG_UnpackData(c,ptr,sz);
+  if (ty) {
+    tc = SWIG_TypeCheck(c,ty);
+    if (!tc) return SWIG_ERROR;
+  }
+  return SWIG_OK;
+}
+
+
+/* Macros for low-level exception handling */
+#define SWIG_croak(x)    { SWIG_Error(SWIG_RuntimeError, x); SWIG_fail; }
+
+
+typedef XSPROTO(SwigPerlWrapper);
+typedef SwigPerlWrapper *SwigPerlWrapperPtr;
+
+/* Structure for command table */
+typedef struct {
+  const char         *name;
+  SwigPerlWrapperPtr  wrapper;
+} swig_command_info;
+
+/* Information for constant table */
+
+#define SWIG_INT     1
+#define SWIG_FLOAT   2
+#define SWIG_STRING  3
+#define SWIG_POINTER 4
+#define SWIG_BINARY  5
+
+/* Constant information structure */
+typedef struct swig_constant_info {
+    int              type;
+    const char      *name;
+    long             lvalue;
+    double           dvalue;
+    void            *pvalue;
+    swig_type_info **ptype;
+} swig_constant_info;
+
+
+/* Structure for variable table */
+typedef struct {
+  const char   *name;
+  SwigMagicFunc   set;
+  SwigMagicFunc   get;
+  swig_type_info  **type;
+} swig_variable_info;
+
+/* Magic variable code */
+#ifndef PERL_OBJECT
+#define swig_create_magic(s,a,b,c) _swig_create_magic(s,a,b,c)
+  #ifndef MULTIPLICITY
+     SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) 
+  #else
+     SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) 
+  #endif
+#else
+#  define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c)
+SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) 
+#endif
+{
+  MAGIC *mg;
+  sv_magic(sv,sv,'U',(char *) name,strlen(name));
+  mg = mg_find(sv,'U');
+  mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
+  mg->mg_virtual->svt_get = (SwigMagicFunc) get;
+  mg->mg_virtual->svt_set = (SwigMagicFunc) set;
+  mg->mg_virtual->svt_len = 0;
+  mg->mg_virtual->svt_clear = 0;
+  mg->mg_virtual->svt_free = 0;
+}
+
+
+SWIGRUNTIME swig_module_info *
+SWIG_Perl_GetModule(void) {
+  static void *type_pointer = (void *)0;
+  SV *pointer;
+
+  /* first check if pointer already created */
+  if (!type_pointer) {
+    pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI);
+    if (pointer && SvOK(pointer)) {
+      type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
+    }
+  }
+
+  return (swig_module_info *) type_pointer;
+}
+
+SWIGRUNTIME void
+SWIG_Perl_SetModule(swig_module_info *module) {
+  SV *pointer;
+
+  /* create a new pointer */
+  pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI);
+  sv_setiv(pointer, PTR2IV(module));
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/* Workaround perl5 global namespace pollution. Note that undefining library
+ * functions like fopen will not solve the problem on all platforms as fopen
+ * might be a macro on Windows but not necessarily on other operating systems. */
+#ifdef do_open
+  #undef do_open
+#endif
+#ifdef do_close
+  #undef do_close
+#endif
+#ifdef scalar
+  #undef scalar
+#endif
+#ifdef list
+  #undef list
+#endif
+#ifdef apply
+  #undef apply
+#endif
+#ifdef convert
+  #undef convert
+#endif
+#ifdef Error
+  #undef Error
+#endif
+#ifdef form
+  #undef form
+#endif
+#ifdef vform
+  #undef vform
+#endif
+#ifdef LABEL
+  #undef LABEL
+#endif
+#ifdef METHOD
+  #undef METHOD
+#endif
+#ifdef Move
+  #undef Move
+#endif
+#ifdef yylex
+  #undef yylex
+#endif
+#ifdef yyparse
+  #undef yyparse
+#endif
+#ifdef yyerror
+  #undef yyerror
+#endif
+#ifdef invert
+  #undef invert
+#endif
+#ifdef ref
+  #undef ref
+#endif
+#ifdef read
+  #undef read
+#endif
+#ifdef write
+  #undef write
+#endif
+#ifdef eof
+  #undef eof
+#endif
+#ifdef bool
+  #undef bool
+#endif
+#ifdef close
+  #undef close
+#endif
+#ifdef rewind
+  #undef rewind
+#endif
+#ifdef free
+  #undef free
+#endif
+#ifdef malloc
+  #undef malloc
+#endif
+#ifdef calloc
+  #undef calloc
+#endif
+#ifdef Stat
+  #undef Stat
+#endif
+#ifdef check
+  #undef check
+#endif
+#ifdef seekdir
+  #undef seekdir
+#endif
+#ifdef open
+  #undef open
+#endif
+
+
+
+#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
+
+#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else 
+
+
+
+  #define SWIG_exception(code, msg) do { SWIG_Error(code, msg); SWIG_fail;; } while(0) 
+
+
+/* -------- TYPES TABLE (BEGIN) -------- */
+
+#define SWIGTYPE_p_GSList swig_types[0]
+#define SWIGTYPE_p_char swig_types[1]
+#define SWIGTYPE_p_double swig_types[2]
+#define SWIGTYPE_p_float swig_types[3]
+#define SWIGTYPE_p_int swig_types[4]
+#define SWIGTYPE_p_unsigned_char swig_types[5]
+static swig_type_info *swig_types[7];
+static swig_module_info swig_module = {swig_types, 6, 0, 0, 0, 0};
+#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
+#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
+
+/* -------- TYPES TABLE (END) -------- */
+
+#define SWIG_init    boot_Amanda__Application
+
+#define SWIG_name   "Amanda::Applicationc::boot_Amanda__Application"
+#define SWIG_prefix "Amanda::Applicationc::"
+
+#define SWIGVERSION 0x010335 
+#define SWIG_VERSION SWIGVERSION
+
+
+#define SWIG_as_voidptr(a) (void *)((const void *)(a)) 
+#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) 
+
+
+#ifdef __cplusplus
+extern "C"
+#endif
+#ifndef PERL_OBJECT
+#ifndef MULTIPLICITY
+SWIGEXPORT void SWIG_init (CV* cv);
+#else
+SWIGEXPORT void SWIG_init (pTHXo_ CV* cv);
+#endif
+#else
+SWIGEXPORT void SWIG_init (CV *cv, CPerlObj *);
+#endif
+
+
+#include "amglue.h"
+
+
+#include "amglue.h"
+
+
+#include "amglue.h"
+
+
+#include "amanda.h"
+#include "client_util.h"
+
+
+SWIGINTERN swig_type_info*
+SWIG_pchar_descriptor(void)
+{
+  static int init = 0;
+  static swig_type_info* info = 0;
+  if (!init) {
+    info = SWIG_TypeQuery("_p_char");
+    init = 1;
+  }
+  return info;
+}
+
+
+SWIGINTERN int
+SWIG_AsCharPtrAndSize(SV *obj, char** cptr, size_t* psize, int *alloc)
+{
+  if (SvPOK(obj)) {
+    STRLEN len = 0;
+    char *cstr = SvPV(obj, len); 
+    size_t size = len + 1;
+    if (cptr)  {
+      if (alloc) {
+       if (*alloc == SWIG_NEWOBJ) {
+         *cptr = (char *)memcpy((char *)malloc((size)*sizeof(char)), cstr, sizeof(char)*(size));
+       } else {
+         *cptr = cstr;
+         *alloc = SWIG_OLDOBJ;
+       }
+      }
+    }
+    if (psize) *psize = size;
+    return SWIG_OK;
+  } else {
+    swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
+    if (pchar_descriptor) {
+      char* vptr = 0; 
+      if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_descriptor, 0) == SWIG_OK) {
+       if (cptr) *cptr = vptr;
+       if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0;
+       if (alloc) *alloc = SWIG_OLDOBJ;
+       return SWIG_OK;
+      }
+    }
+  }
+  return SWIG_TypeError;
+}
+
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef PERL_OBJECT
+#define MAGIC_CLASS _wrap_Amanda::Application_var::
+class _wrap_Amanda::Application_var : public CPerlObj {
+public:
+#else
+#define MAGIC_CLASS
+#endif
+SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *SWIGUNUSEDPARM(sv), MAGIC *SWIGUNUSEDPARM(mg)) {
+    MAGIC_PPERL
+    croak("Value is read-only.");
+    return 0;
+}
+
+
+#ifdef PERL_OBJECT
+};
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+XS(_wrap_run_calcsize_C) {
+  {
+    char *arg1 = (char *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    char *arg4 = (char *) 0 ;
+    GSList *arg5 = (GSList *) 0 ;
+    char *arg6 = (char *) 0 ;
+    char *arg7 = (char *) 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int res4 ;
+    char *buf4 = 0 ;
+    int alloc4 = 0 ;
+    int res6 ;
+    char *buf6 = 0 ;
+    int alloc6 = 0 ;
+    int res7 ;
+    char *buf7 = 0 ;
+    int alloc7 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 7) || (items > 7)) {
+      SWIG_croak("Usage: run_calcsize_C(config,program,disk,dirname,levels,file_exclude,file_include);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "run_calcsize_C" "', argument " "1"" of type '" "char *""'");
+    }
+    arg1 = (char *)(buf1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "run_calcsize_C" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = (char *)(buf2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "run_calcsize_C" "', argument " "3"" of type '" "char *""'");
+    }
+    arg3 = (char *)(buf3);
+    res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+    if (!SWIG_IsOK(res4)) {
+      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "run_calcsize_C" "', argument " "4"" of type '" "char *""'");
+    }
+    arg4 = (char *)(buf4);
+    {
+      AV     *tempav;
+      GSList *level = NULL;
+      int     num;
+      int     i;
+      SV    **tv;
+      
+      if (!SvROK(ST(4)))
+      croak("Argument 5 is not a reference.");
+      if (SvTYPE(SvRV(ST(4))) != SVt_PVAV)
+      croak("Argument 5 is not an array.");
+      tempav = (AV*)SvRV(ST(4));
+      num = av_len(tempav);
+      for (i=0; i <= num; i++) {
+        tv = av_fetch(tempav, i, 0);
+        level = g_slist_append(level, GINT_TO_POINTER(SvIV(*tv)));
+      }
+      arg5 = level;
+    }
+    res6 = SWIG_AsCharPtrAndSize(ST(5), &buf6, NULL, &alloc6);
+    if (!SWIG_IsOK(res6)) {
+      SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "run_calcsize_C" "', argument " "6"" of type '" "char *""'");
+    }
+    arg6 = (char *)(buf6);
+    res7 = SWIG_AsCharPtrAndSize(ST(6), &buf7, NULL, &alloc7);
+    if (!SWIG_IsOK(res7)) {
+      SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "run_calcsize_C" "', argument " "7"" of type '" "char *""'");
+    }
+    arg7 = (char *)(buf7);
+    run_calcsize(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
+    
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
+    if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
+    if (alloc4 == SWIG_NEWOBJ) free((char*)buf4);
+    {
+      if(arg5)
+      g_slist_free(arg5);
+    }
+    if (alloc6 == SWIG_NEWOBJ) free((char*)buf6);
+    if (alloc7 == SWIG_NEWOBJ) free((char*)buf7);
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
+    if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
+    if (alloc4 == SWIG_NEWOBJ) free((char*)buf4);
+    {
+      if(arg5)
+      g_slist_free(arg5);
+    }
+    if (alloc6 == SWIG_NEWOBJ) free((char*)buf6);
+    if (alloc7 == SWIG_NEWOBJ) free((char*)buf7);
+    SWIG_croak_null();
+  }
+}
+
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
+
+static swig_type_info _swigt__p_GSList = {"_p_GSList", "GSList *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_char = {"_p_char", "gchar *|char *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_double = {"_p_double", "double *|gdouble *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_float = {"_p_float", "float *|gfloat *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_int = {"_p_int", "int *|gboolean *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "guchar *|unsigned char *", 0, 0, (void*)0, 0};
+
+static swig_type_info *swig_type_initial[] = {
+  &_swigt__p_GSList,
+  &_swigt__p_char,
+  &_swigt__p_double,
+  &_swigt__p_float,
+  &_swigt__p_int,
+  &_swigt__p_unsigned_char,
+};
+
+static swig_cast_info _swigc__p_GSList[] = {  {&_swigt__p_GSList, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_double[] = {  {&_swigt__p_double, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_float[] = {  {&_swigt__p_float, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_int[] = {  {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_unsigned_char[] = {  {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
+
+static swig_cast_info *swig_cast_initial[] = {
+  _swigc__p_GSList,
+  _swigc__p_char,
+  _swigc__p_double,
+  _swigc__p_float,
+  _swigc__p_int,
+  _swigc__p_unsigned_char,
+};
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
+
+static swig_constant_info swig_constants[] = {
+{0,0,0,0,0,0}
+};
+#ifdef __cplusplus
+}
+#endif
+static swig_variable_info swig_variables[] = {
+{0,0,0,0}
+};
+static swig_command_info swig_commands[] = {
+{"Amanda::Applicationc::run_calcsize_C", _wrap_run_calcsize_C},
+{0,0}
+};
+/* -----------------------------------------------------------------------------
+ * Type initialization:
+ * This problem is tough by the requirement that no dynamic 
+ * memory is used. Also, since swig_type_info structures store pointers to 
+ * swig_cast_info structures and swig_cast_info structures store pointers back
+ * to swig_type_info structures, we need some lookup code at initialization. 
+ * The idea is that swig generates all the structures that are needed. 
+ * The runtime then collects these partially filled structures. 
+ * The SWIG_InitializeModule function takes these initial arrays out of 
+ * swig_module, and does all the lookup, filling in the swig_module.types
+ * array with the correct data and linking the correct swig_cast_info
+ * structures together.
+ *
+ * The generated swig_type_info structures are assigned staticly to an initial 
+ * array. We just loop through that array, and handle each type individually.
+ * First we lookup if this type has been already loaded, and if so, use the
+ * loaded structure instead of the generated one. Then we have to fill in the
+ * cast linked list. The cast data is initially stored in something like a
+ * two-dimensional array. Each row corresponds to a type (there are the same
+ * number of rows as there are in the swig_type_initial array). Each entry in
+ * a column is one of the swig_cast_info structures for that type.
+ * The cast_initial array is actually an array of arrays, because each row has
+ * a variable number of columns. So to actually build the cast linked list,
+ * we find the array of casts associated with the type, and loop through it 
+ * adding the casts to the list. The one last trick we need to do is making
+ * sure the type pointer in the swig_cast_info struct is correct.
+ *
+ * First off, we lookup the cast->type name to see if it is already loaded. 
+ * There are three cases to handle:
+ *  1) If the cast->type has already been loaded AND the type we are adding
+ *     casting info to has not been loaded (it is in this module), THEN we
+ *     replace the cast->type pointer with the type pointer that has already
+ *     been loaded.
+ *  2) If BOTH types (the one we are adding casting info to, and the 
+ *     cast->type) are loaded, THEN the cast info has already been loaded by
+ *     the previous module so we just ignore it.
+ *  3) Finally, if cast->type has not already been loaded, then we add that
+ *     swig_cast_info to the linked list (because the cast->type) pointer will
+ *     be correct.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#if 0
+} /* c-mode */
+#endif
+#endif
+
+#if 0
+#define SWIGRUNTIME_DEBUG
+#endif
+
+
+SWIGRUNTIME void
+SWIG_InitializeModule(void *clientdata) {
+  size_t i;
+  swig_module_info *module_head, *iter;
+  int found, init;
+  
+  clientdata = clientdata;
+  
+  /* check to see if the circular list has been setup, if not, set it up */
+  if (swig_module.next==0) {
+    /* Initialize the swig_module */
+    swig_module.type_initial = swig_type_initial;
+    swig_module.cast_initial = swig_cast_initial;
+    swig_module.next = &swig_module;
+    init = 1;
+  } else {
+    init = 0;
+  }
+  
+  /* Try and load any already created modules */
+  module_head = SWIG_GetModule(clientdata);
+  if (!module_head) {
+    /* This is the first module loaded for this interpreter */
+    /* so set the swig module into the interpreter */
+    SWIG_SetModule(clientdata, &swig_module);
+    module_head = &swig_module;
+  } else {
+    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
+    found=0;
+    iter=module_head;
+    do {
+      if (iter==&swig_module) {
+        found=1;
+        break;
+      }
+      iter=iter->next;
+    } while (iter!= module_head);
+    
+    /* if the is found in the list, then all is done and we may leave */
+    if (found) return;
+    /* otherwise we must add out module into the list */
+    swig_module.next = module_head->next;
+    module_head->next = &swig_module;
+  }
+  
+  /* When multiple interpeters are used, a module could have already been initialized in
+       a different interpreter, but not yet have a pointer in this interpreter.
+       In this case, we do not want to continue adding types... everything should be
+       set up already */
+  if (init == 0) return;
+  
+  /* Now work on filling in swig_module.types */
+#ifdef SWIGRUNTIME_DEBUG
+  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
+#endif
+  for (i = 0; i < swig_module.size; ++i) {
+    swig_type_info *type = 0;
+    swig_type_info *ret;
+    swig_cast_info *cast;
+    
+#ifdef SWIGRUNTIME_DEBUG
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+#endif
+    
+    /* if there is another module already loaded */
+    if (swig_module.next != &swig_module) {
+      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
+    }
+    if (type) {
+      /* Overwrite clientdata field */
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: found type %s\n", type->name);
+#endif
+      if (swig_module.type_initial[i]->clientdata) {
+        type->clientdata = swig_module.type_initial[i]->clientdata;
+#ifdef SWIGRUNTIME_DEBUG
+        printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
+#endif
+      }
+    } else {
+      type = swig_module.type_initial[i];
+    }
+    
+    /* Insert casting types */
+    cast = swig_module.cast_initial[i];
+    while (cast->type) {
+      /* Don't need to add information already in the list */
+      ret = 0;
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
+#endif
+      if (swig_module.next != &swig_module) {
+        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
+#ifdef SWIGRUNTIME_DEBUG
+        if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
+#endif
+      }
+      if (ret) {
+        if (type == swig_module.type_initial[i]) {
+#ifdef SWIGRUNTIME_DEBUG
+          printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
+#endif
+          cast->type = ret;
+          ret = 0;
+        } else {
+          /* Check for casting already in the list */
+          swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
+#ifdef SWIGRUNTIME_DEBUG
+          if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
+#endif
+          if (!ocast) ret = 0;
+        }
+      }
+      
+      if (!ret) {
+#ifdef SWIGRUNTIME_DEBUG
+        printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
+#endif
+        if (type->cast) {
+          type->cast->prev = cast;
+          cast->next = type->cast;
+        }
+        type->cast = cast;
+      }
+      cast++;
+    }
+    /* Set entry in modules->types array equal to the type */
+    swig_module.types[i] = type;
+  }
+  swig_module.types[i] = 0;
+  
+#ifdef SWIGRUNTIME_DEBUG
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+  for (i = 0; i < swig_module.size; ++i) {
+    int j = 0;
+    swig_cast_info *cast = swig_module.cast_initial[i];
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+    while (cast->type) {
+      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
+      cast++;
+      ++j;
+    }
+    printf("---- Total casts: %d\n",j);
+  }
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+#endif
+}
+
+/* This function will propagate the clientdata field of type to
+* any new swig_type_info structures that have been added into the list
+* of equivalent types.  It is like calling
+* SWIG_TypeClientData(type, clientdata) a second time.
+*/
+SWIGRUNTIME void
+SWIG_PropagateClientData(void) {
+  size_t i;
+  swig_cast_info *equiv;
+  static int init_run = 0;
+  
+  if (init_run) return;
+  init_run = 1;
+  
+  for (i = 0; i < swig_module.size; i++) {
+    if (swig_module.types[i]->clientdata) {
+      equiv = swig_module.types[i]->cast;
+      while (equiv) {
+        if (!equiv->converter) {
+          if (equiv->type && !equiv->type->clientdata)
+          SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
+        }
+        equiv = equiv->next;
+      }
+    }
+  }
+}
+
+#ifdef __cplusplus
+#if 0
+{
+  /* c-mode */
+#endif
+}
+#endif
+
+
+
+#ifdef __cplusplus
+extern "C"
+#endif
+
+XS(SWIG_init) {
+  dXSARGS;
+  int i;
+  
+  SWIG_InitializeModule(0);
+  
+  /* Install commands */
+  for (i = 0; swig_commands[i].name; i++) {
+    newXS((char*) swig_commands[i].name,swig_commands[i].wrapper, (char*)__FILE__);
+  }
+  
+  /* Install variables */
+  for (i = 0; swig_variables[i].name; i++) {
+    SV *sv;
+    sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI);
+    if (swig_variables[i].type) {
+      SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0);
+    } else {
+      sv_setiv(sv,(IV) 0);
+    }
+    swig_create_magic(sv, (char *) swig_variables[i].name, swig_variables[i].set, swig_variables[i].get); 
+  }
+  
+  /* Install constant */
+  for (i = 0; swig_constants[i].type; i++) {
+    SV *sv;
+    sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI);
+    switch(swig_constants[i].type) {
+    case SWIG_INT:
+      sv_setiv(sv, (IV) swig_constants[i].lvalue);
+      break;
+    case SWIG_FLOAT:
+      sv_setnv(sv, (double) swig_constants[i].dvalue);
+      break;
+    case SWIG_STRING:
+      sv_setpv(sv, (char *) swig_constants[i].pvalue);
+      break;
+    case SWIG_POINTER:
+      SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype),0);
+      break;
+    case SWIG_BINARY:
+      SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype));
+      break;
+    default:
+      break;
+    }
+    SvREADONLY_on(sv);
+  }
+  
+  ST(0) = &PL_sv_yes;
+  XSRETURN(1);
+}
+
diff --git a/perl/Amanda/Application.pm b/perl/Amanda/Application.pm
new file mode 100644 (file)
index 0000000..9fa02a0
--- /dev/null
@@ -0,0 +1,126 @@
+# This file was automatically generated by SWIG (http://www.swig.org).
+# Version 1.3.35
+#
+# Don't modify this file, modify the SWIG interface instead.
+
+package Amanda::Application;
+require Exporter;
+require DynaLoader;
+@ISA = qw(Exporter DynaLoader);
+package Amanda::Applicationc;
+bootstrap Amanda::Application;
+package Amanda::Application;
+@EXPORT = qw( );
+
+# ---------- BASE METHODS -------------
+
+package Amanda::Application;
+
+sub TIEHASH {
+    my ($classname,$obj) = @_;
+    return bless $obj, $classname;
+}
+
+sub CLEAR { }
+
+sub FIRSTKEY { }
+
+sub NEXTKEY { }
+
+sub FETCH {
+    my ($self,$field) = @_;
+    my $member_func = "swig_${field}_get";
+    $self->$member_func();
+}
+
+sub STORE {
+    my ($self,$field,$newval) = @_;
+    my $member_func = "swig_${field}_set";
+    $self->$member_func($newval);
+}
+
+sub this {
+    my $ptr = shift;
+    return tied(%$ptr);
+}
+
+
+# ------- FUNCTION WRAPPERS --------
+
+package Amanda::Application;
+
+*run_calcsize_C = *Amanda::Applicationc::run_calcsize_C;
+
+# ------- VARIABLE STUBS --------
+
+package Amanda::Application;
+
+
+@EXPORT_OK = ();
+%EXPORT_TAGS = ();
+
+push @ISA, qw(Amanda::Script_App);
+require Amanda::Script_App;
+
+use strict;
+use warnings;
+
+=head1 NAME
+
+Amanda::Application - perl utility functions for Applications.
+
+=head1 SYNOPSIS
+
+  package Amanda::Application::my_application;
+  use base qw(Amanda::Application);
+
+  sub new {
+    my $class = shift;
+    my ($foo, $bar) = @_;
+    my $self = $class->SUPER::new();
+
+    $self->{'foo'} = $foo;
+    $self->{'bar'} = $bar;
+
+    return $self;
+  }
+
+  # Define all command_* subs that you need, e.g.,
+  sub command_support {
+    my $self = shift;
+    # ...
+  }
+
+  package main;
+
+  # .. parse arguments ..
+
+  my $application = Amanda::Application::my_application->new($opt_foo, $opt_bar);
+  $application->do($cmd);
+
+=cut
+
+sub new {
+    my $class = shift;
+
+    my $self = Amanda::Script_App::new($class, "client", "application", @_);
+
+    $self->{known_commands} = {
+        support   => 1,
+        selfcheck => 1,
+        estimate  => 1,
+        backup    => 1,
+        restore   => 1,
+        validate  => 1,
+    };
+    return $self;
+}
+
+sub run_calcsize {
+    my $self = shift;
+    my $program = shift;
+
+    run_calcsize_C($self->{config}, $program, $self->{disk}, $self->{device}, $self->{level}, undef, undef);
+
+}
+1;
diff --git a/perl/Amanda/Application.swg b/perl/Amanda/Application.swg
new file mode 100644 (file)
index 0000000..471cc33
--- /dev/null
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) Zmanda, Inc.  All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ *
+ * This 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 this library; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+ *
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+ */
+
+%module "Amanda::Application"
+%include "amglue/amglue.swg"
+%include "exception.i"
+%include "cstring.i"
+
+%perlcode %{
+push @ISA, qw(Amanda::Script_App);
+require Amanda::Script_App;
+
+use strict;
+use warnings;
+
+=head1 NAME
+
+Amanda::Application - perl utility functions for Applications.
+
+=head1 SYNOPSIS
+
+  package Amanda::Application::my_application;
+  use base qw(Amanda::Application);
+
+  sub new {
+    my $class = shift;
+    my ($foo, $bar) = @_;
+    my $self = $class->SUPER::new();
+
+    $self->{'foo'} = $foo;
+    $self->{'bar'} = $bar;
+
+    return $self;
+  }
+
+  # Define all command_* subs that you need, e.g.,
+  sub command_support {
+    my $self = shift;
+    # ...
+  }
+
+  package main;
+
+  # .. parse arguments ..
+
+  my $application = Amanda::Application::my_application->new($opt_foo, $opt_bar);
+  $application->do($cmd);
+
+=cut
+
+sub new {
+    my $class = shift;
+
+    my $self = Amanda::Script_App::new($class, "client", "application", @_);
+
+    $self->{known_commands} = {
+        support   => 1,
+        selfcheck => 1,
+        estimate  => 1,
+        backup    => 1,
+        restore   => 1,
+        validate  => 1,
+    };
+    return $self;
+}
+
+sub run_calcsize {
+    my $self = shift;
+    my $program = shift;
+
+    run_calcsize_C($self->{config}, $program, $self->{disk}, $self->{device}, $self->{level}, undef, undef);
+
+}
+%}
+
+/* C interfaces used by the above */
+
+%{
+#include "amanda.h"
+#include "client_util.h"
+%}
+
+%typemap(in) GSList *levels {
+    AV     *tempav;
+    GSList *level = NULL;
+    int     num;
+    int     i;
+    SV    **tv;
+
+    if (!SvROK($input))
+       croak("Argument $argnum is not a reference.");
+    if (SvTYPE(SvRV($input)) != SVt_PVAV)
+       croak("Argument $argnum is not an array.");
+    tempav = (AV*)SvRV($input);
+    num = av_len(tempav);
+    for (i=0; i <= num; i++) {
+       tv = av_fetch(tempav, i, 0);
+       level = g_slist_append(level, GINT_TO_POINTER(SvIV(*tv)));
+    }
+    $1 = level;
+}
+/* free the list */
+%typemap(freearg) GSList *levels {
+    if($1)
+       g_slist_free($1);
+}
+
+%rename(run_calcsize_C) run_calcsize;
+void
+run_calcsize(char *config, char *program, char *disk, char *dirname,
+            GSList *levels, char *file_exclude, char *file_include);
+
+%typemap(in) GSList *levels;
+%typemap(freearg) GSList *levels;
diff --git a/perl/Amanda/Application/Zfs.pm b/perl/Amanda/Application/Zfs.pm
new file mode 100644 (file)
index 0000000..8c7e716
--- /dev/null
@@ -0,0 +1,394 @@
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+#
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License version 2.1 as
+# published by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+package Amanda::Application::Zfs;
+
+use strict;
+use warnings;
+use Symbol;
+use IPC::Open3;
+use Amanda::Debug qw( :logging );
+
+=head1 NAME
+
+Amanda::Application::Zfs -- collection of function to use with zfs
+
+=head1 SYNOPSIS
+
+=head1 INTERFACE
+
+=cut
+
+sub zfs_set_value {
+    my $self = shift;
+
+    my $action = $_[0];
+
+    if (defined $self->{execute_where} && $self->{execute_where} ne "client") {
+       $self->print_to_server_and_die($action, " Script must be run on the client 'execute_where client'", $Amanda::Script_App::ERROR);
+    }
+    if (!defined $self->{device}) {
+       $self->print_to_server_and_die($action, "'--device' is not provided",
+                        $Amanda::Script_App::ERROR);
+    }
+    if ($self->{df_path} ne "df" && !-e $self->{df_path}) {
+       $self->print_to_server_and_die($action, "Can't execute DF-PATH '$self->{df_path}' command",
+                        $Amanda::Script_App::ERROR);
+    }
+    if ($self->{zfs_path} ne "zfs" && !-e $self->{zfs_path}) {
+        $self->print_to_server_and_die($action, "Can't execute ZFS-PATH '$self->{zfs_path}' command",
+                        $Amanda::Script_App::ERROR);
+    }
+
+    if ($self->{pfexec} =~ /^YES$/i) {
+        $self->{pfexec_cmd} = $self->{pfexec_path};
+    }
+    if (defined $self->{pfexec_cmd} && $self->{pfexec_cmd} ne "pfexec" && !-e $self->{pfexec_cmd}) {
+        $self->print_to_server_and_die($action, "Can't execute PFEXEC-PATH '$self->{pfexec_cmd}' command",
+                        $Amanda::Script_App::ERROR);
+    }
+    if (!defined $self->{pfexec_cmd}) {
+        $self->{pfexec_cmd} = "";
+    }
+
+    # determine if $self->{device} is a mountpoint or ZFS dataset
+    my $cmd = "$self->{pfexec_cmd} $self->{zfs_path} get -H -o value mountpoint $self->{device}";
+    debug "running: $cmd";
+    my($wtr, $rdr, $err, $pid);
+    $err = Symbol::gensym;
+    $pid = open3($wtr, $rdr, $err, $cmd);
+    close $wtr;
+    my $zmountpoint = <$rdr>;
+    waitpid $pid, 0;
+    close $rdr;
+    close $err;
+
+    if ($? == 0) {
+        chomp $zmountpoint;
+
+        # zfs dataset supplied
+        $self->{filesystem} = $self->{device};
+
+        # check if zfs volume
+        if ($zmountpoint ne '-') {
+            $self->{mountpoint} = $zmountpoint;
+        } else {
+            $self->{mountpoint} = undef;
+        }
+    } else {
+        # filesystem, directory or invalid ZFS dataset name
+        $cmd = "$self->{df_path} $self->{device}";
+        debug "running: $self->{df_path} $self->{device}";
+        $err = Symbol::gensym;
+        $pid = open3($wtr, $rdr, $err, $cmd);
+        close $wtr;
+        my @ret;
+        while (<$rdr>) {
+            chomp;
+            push @ret,$_;
+        }
+        my $errmsg = <$err>;
+        waitpid $pid, 0;
+        close $rdr;
+        close $err;
+
+        if ($? != 0) {
+           my $ret = $ret[0];
+            # invalid filesystem of ZFS dataset name
+            if (defined $errmsg) {
+                chomp $errmsg;
+            }
+            if (defined $ret && defined $errmsg) {
+                $self->print_to_server_and_die($action, "$ret, $errmsg", $Amanda::Script_App::ERROR);
+            } elsif (defined $ret) {
+                $self->print_to_server_and_die($action, $ret, $Amanda::Script_App::ERROR);
+            } elsif (defined $errmsg) {
+                $self->print_to_server_and_die($action, $errmsg, $Amanda::Script_App::ERROR);
+            } else {
+                $self->print_to_server_and_die($action,
+                            "Failed to find mount points: $self->{device}",
+                            $Amanda::Script_App::ERROR);
+            }
+        }
+
+        my $size = @ret;
+        if ($size eq 1) {
+            # Solaris type df
+            @ret = split /:/, $ret[0];
+            if ($ret[0] =~ /(\S*)(\s*)(\()(\S*)(\s*)(\))$/) {
+                $self->{mountpoint} = $1;
+                $self->{filesystem} = $4;
+            } else {
+                $self->print_to_server_and_die($action,
+                            "Failed to find mount points: $self->{device}",
+                            $Amanda::Script_App::ERROR);
+            }
+        } else {
+            # FreeBSD type df with header
+            if ($ret[1] =~ /^(\S+)(\s+)((\S+)(\s+))+(\S+)(\s*)$/) {
+                $self->{mountpoint} = $6;
+                $self->{filesystem} = $1;
+            } else {
+                $self->print_to_server_and_die($action,
+                            "Failed to find mount points: $self->{device}",
+                            $Amanda::Script_App::ERROR);
+            }
+        }
+
+        $cmd = "$self->{pfexec_cmd} $self->{zfs_path} get -H -o value mountpoint $self->{filesystem}";
+        debug "running: $cmd|";
+        $err = Symbol::gensym;
+        $pid = open3($wtr, $rdr, $err, $cmd);
+        close $wtr;
+        $zmountpoint = <$rdr>;
+       chomp $zmountpoint;
+        $errmsg = <$err>;
+        waitpid $pid, 0;
+        close $rdr;
+        close $err;
+
+        if ($? != 0) {
+            if (defined $errmsg) {
+                chomp $errmsg;
+            }
+            if (defined $zmountpoint && defined $errmsg) {
+                $self->print_to_server_and_die($action, $zmountpoint, $errmsg, $Amanda::Script_App::ERROR);
+            } elsif (defined $zmountpoint) {
+                $self->print_to_server_and_die($action, $zmountpoint, $Amanda::Script_App::ERROR);
+            } elsif (defined $errmsg) {
+                $self->print_to_server_and_die($action, $errmsg, $Amanda::Script_App::ERROR);
+            } else {
+                $self->print_to_server_and_die($action,
+                        "Failed to find mount points: $self->{filesystem}",
+                        $Amanda::Script_App::ERROR);
+            }
+        }
+        if ($zmountpoint ne 'legacy' && $zmountpoint ne $self->{mountpoint}) {
+            $self->print_to_server_and_die($action,
+                "mountpoint from 'df' ($self->{mountpoint}) and 'zfs list' ($zmountpoint) differ",
+                $Amanda::Script_App::ERROR);
+        }
+
+        if (!($self->{device} =~ /^$self->{mountpoint}/)) {
+            $self->print_to_server_and_die($action,
+                "mountpoint '$self->{mountpoint}' is not a prefix of diskdevice '$self->{device}'",
+                $Amanda::Script_App::ERROR);
+        }
+
+    }
+
+    if ($action eq 'check') {
+      $self->{snapshot} = $self->zfs_build_snapshotname($self->{device}, -1);
+    } else {
+      $self->{snapshot} = $self->zfs_build_snapshotname($self->{device});
+    }
+    if (defined $self->{mountpoint}) {
+       if ($self->{device} =~ /^$self->{mountpoint}/) {
+            $self->{dir} = $self->{device};
+            $self->{dir} =~ s,^$self->{mountpoint},,;
+            $self->{directory} = $self->{mountpoint} . "/.zfs/snapshot/" .
+                                 $self->{snapshot} . $self->{dir};
+       } else { # device is not the mountpoint
+           $self->{directory} = $self->{mountpoint} . "/.zfs/snapshot/" .
+                                $self->{snapshot};
+       }
+    }
+}
+
+sub zfs_create_snapshot {
+    my $self = shift;
+    my $action = shift;
+
+    my $cmd = "$self->{pfexec_cmd} $self->{zfs_path} snapshot $self->{filesystem}\@$self->{snapshot}";
+    debug "running: $cmd";
+    my($wtr, $rdr, $err, $pid);
+    $err = Symbol::gensym;
+    $pid = open3($wtr, $rdr, $err, $cmd);
+    close $wtr;
+    my ($msg) = <$rdr>;
+    my ($errmsg) = <$err>;
+    waitpid $pid, 0;
+    close $rdr;
+    close $err;
+    if( $? != 0 ) {
+        if(defined $msg && defined $errmsg) {
+            $self->print_to_server_and_die($action, "$msg, $errmsg", $Amanda::Script_App::ERROR);
+        } elsif (defined $msg) {
+            $self->print_to_server_and_die($action, $msg, $Amanda::Script_App::ERROR);
+        } elsif (defined $errmsg) {
+            $self->print_to_server_and_die($action, $errmsg, $Amanda::Script_App::ERROR);
+        } else {
+            $self->print_to_server_and_die($action, "cannot create snapshot '$self->{filesystem}\@$self->{snapshot}': unknown reason", $Amanda::Script_App::ERROR);
+        }
+    }
+}
+
+sub zfs_destroy_snapshot {
+    my $self = shift;
+    my $action = shift;
+
+    my $cmd = "$self->{pfexec_cmd} $self->{zfs_path} destroy $self->{filesystem}\@$self->{snapshot}";
+    debug "running: $cmd|";
+    my($wtr, $rdr, $err, $pid);
+    my($msg, $errmsg);
+    $err = Symbol::gensym;
+    $pid = open3($wtr, $rdr, $err, $cmd);
+    close $wtr;
+    $msg = <$rdr>;
+    $errmsg = <$err>;
+    waitpid $pid, 0;
+    close $rdr;
+    close $err;
+    if( $? != 0 ) {
+        if(defined $msg && defined $errmsg) {
+            $self->print_to_server_and_die($action, "$msg, $errmsg", $Amanda::Script_App::ERROR);
+        } elsif (defined $msg) {
+            $self->print_to_server_and_die($action, $msg, $Amanda::Script_App::ERROR);
+        } elsif (defined $errmsg) {
+            $self->print_to_server_and_die($action, $errmsg, $Amanda::Script_App::ERROR);
+        } else {
+            $self->print_to_server_and_die($action, "cannot destroy snapshot '$self->{filesystem}\@$self->{snapshot}': unknown reason", $Amanda::Script_App::ERROR);
+        }
+    }
+}
+
+sub zfs_destroy_snapshot_level {
+    my $self = shift;
+    my $level = shift;
+    my $action = shift;
+
+    my $snapshotname = $self->zfs_find_snapshot_level($level);
+    debug "zfs_destroy_snapshot_level: Current $snapshotname";
+    if ($snapshotname ne "") {
+      my $cmd = "$self->{pfexec_cmd} $self->{zfs_path} destroy  $self->{filesystem}\@$snapshotname";
+      debug "running: $cmd|";
+      my($wtr, $rdr, $err, $pid);
+      my($msg, $errmsg);
+      $err = Symbol::gensym;
+      $pid = open3($wtr, $rdr, $err, $cmd);
+      close $wtr;
+      $msg = <$rdr>;
+      $errmsg = <$err>;
+      waitpid $pid, 0;
+      close $rdr;
+      close $err;
+      if( $? != 0 ) {
+          if(defined $msg && defined $errmsg) {
+              $self->print_to_server_and_die($action, "$msg, $errmsg", $Amanda::Script_App::ERROR);
+          } elsif (defined $msg) {
+              $self->print_to_server_and_die($action, $msg, $Amanda::Script_App::ERROR);
+          } elsif (defined $errmsg) {
+              $self->print_to_server_and_die($action, $errmsg, $Amanda::Script_App::ERROR);
+          } else {
+              $self->print_to_server_and_die($action, "cannot destroy snapshot '$self->{filesystem}\@$self->{snapshot}': unknown reason", $Amanda::Script_App::ERROR);
+          }
+      }
+    }
+}
+
+sub zfs_rename_snapshot {
+    my $self = shift;
+    my $level = shift;
+    my $action = shift;
+
+    my $newsnapshotname = $self->zfs_build_snapshotname($self->{device}, $level);
+    my $cmd = "$self->{pfexec_cmd} $self->{zfs_path} rename $self->{filesystem}\@$self->{snapshot} $newsnapshotname";
+    debug "running: $cmd|";
+    my($wtr, $rdr, $err, $pid);
+    my($msg, $errmsg);
+    $err = Symbol::gensym;
+    $pid = open3($wtr, $rdr, $err, $cmd);
+    close $wtr;
+    $msg = <$rdr>;
+    $errmsg = <$err>;
+    waitpid $pid, 0;
+    close $rdr;
+    close $err;
+    if( $? != 0 ) {
+        if(defined $msg && defined $errmsg) {
+            $self->print_to_server_and_die($action, "$msg, $errmsg", $Amanda::Script_App::ERROR);
+        } elsif (defined $msg) {
+            $self->print_to_server_and_die($action, $msg, $Amanda::Script_App::ERROR);
+        } elsif (defined $errmsg) {
+            $self->print_to_server_and_die($action, $errmsg, $Amanda::Script_App::ERROR);
+        } else {
+            $self->print_to_server_and_die($action, "cannot rename snapshot '$self->{filesystem}\@$self->{snapshot}': unknown reason", $Amanda::Script_App::ERROR);
+        }
+    }
+}
+
+sub zfs_purge_snapshot {
+    my $self = shift;
+    my $minlevel = shift;
+    my $maxlevel = shift;
+    my $action = shift;
+
+    my $level;
+    for ($level = $maxlevel; $level >= $minlevel; $level--) {
+       debug "zfs_purge_snapshot: Check for existing snapshot at level $level";
+        $self->zfs_destroy_snapshot_level($level, $action);
+    }
+}
+
+sub zfs_find_snapshot_level {
+    my $self = shift;
+    my $level = shift;
+    my $action = shift;
+
+    my $snapshotname = $self->zfs_build_snapshotname($self->{device}, $level);
+
+    my $cmd =  "$self->{pfexec_cmd} $self->{zfs_path} list -t snapshot $self->{filesystem}\@$snapshotname";
+    debug "running: $cmd|";
+    my($wtr, $rdr, $err, $pid);
+    my($msg, $errmsg);
+    $err = Symbol::gensym;
+    $pid = open3($wtr, $rdr, $err, $cmd);
+    close $wtr;
+    $msg = <$rdr>;
+    $errmsg = <$err>;
+    waitpid $pid, 0;
+    close $rdr;
+    close $err;
+    if( $? != 0 ) {
+       return "";
+    }
+    return $snapshotname;
+}
+
+sub zfs_build_snapshotname {
+    my $self = shift;
+    my $device = shift;
+    my $level = shift;
+    my $action = shift;
+
+    my $snapshotname = "";
+
+    if (!defined $level) {
+      $snapshotname = "amanda-" . Amanda::Util::sanitise_filename($device) . "-current";
+    } else {
+      if ($level < 0) {
+       $snapshotname = "amanda-" . Amanda::Util::sanitise_filename($device) . "-check";
+      } else {
+        $snapshotname = "amanda-" . Amanda::Util::sanitise_filename($device) . "-" . $level;
+      }
+    } 
+
+    return $snapshotname;
+}
+
+1;
diff --git a/perl/Amanda/Archive.c b/perl/Amanda/Archive.c
new file mode 100644 (file)
index 0000000..feec4de
--- /dev/null
@@ -0,0 +1,2874 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ * 
+ * This file is not intended to be easily readable and contains a number of 
+ * coding conventions designed to improve portability and efficiency. Do not make
+ * changes to this file unless you know what you are doing--modify the SWIG 
+ * interface file instead. 
+ * ----------------------------------------------------------------------------- */
+
+#define SWIGPERL
+#define SWIG_CASTRANK_MODE
+/* -----------------------------------------------------------------------------
+ *  This section contains generic SWIG labels for method/variable
+ *  declarations/attributes, and other compiler dependent labels.
+ * ----------------------------------------------------------------------------- */
+
+/* template workaround for compilers that cannot correctly implement the C++ standard */
+#ifndef SWIGTEMPLATEDISAMBIGUATOR
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# elif defined(__HP_aCC)
+/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
+/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# else
+#  define SWIGTEMPLATEDISAMBIGUATOR
+# endif
+#endif
+
+/* inline attribute */
+#ifndef SWIGINLINE
+# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
+#   define SWIGINLINE inline
+# else
+#   define SWIGINLINE
+# endif
+#endif
+
+/* attribute recognised by some compilers to avoid 'unused' warnings */
+#ifndef SWIGUNUSED
+# if defined(__GNUC__)
+#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#     define SWIGUNUSED __attribute__ ((__unused__)) 
+#   else
+#     define SWIGUNUSED
+#   endif
+# elif defined(__ICC)
+#   define SWIGUNUSED __attribute__ ((__unused__)) 
+# else
+#   define SWIGUNUSED 
+# endif
+#endif
+
+#ifndef SWIGUNUSEDPARM
+# ifdef __cplusplus
+#   define SWIGUNUSEDPARM(p)
+# else
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
+# endif
+#endif
+
+/* internal SWIG method */
+#ifndef SWIGINTERN
+# define SWIGINTERN static SWIGUNUSED
+#endif
+
+/* internal inline SWIG method */
+#ifndef SWIGINTERNINLINE
+# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
+#endif
+
+/* exporting methods */
+#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#  ifndef GCC_HASCLASSVISIBILITY
+#    define GCC_HASCLASSVISIBILITY
+#  endif
+#endif
+
+#ifndef SWIGEXPORT
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   if defined(STATIC_LINKED)
+#     define SWIGEXPORT
+#   else
+#     define SWIGEXPORT __declspec(dllexport)
+#   endif
+# else
+#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
+#     define SWIGEXPORT __attribute__ ((visibility("default")))
+#   else
+#     define SWIGEXPORT
+#   endif
+# endif
+#endif
+
+/* calling conventions for Windows */
+#ifndef SWIGSTDCALL
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   define SWIGSTDCALL __stdcall
+# else
+#   define SWIGSTDCALL
+# endif 
+#endif
+
+/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
+#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
+# define _SCL_SECURE_NO_DEPRECATE
+#endif
+
+
+/* -----------------------------------------------------------------------------
+ * swigrun.swg
+ *
+ * This file contains generic CAPI SWIG runtime support for pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+/* This should only be incremented when either the layout of swig_type_info changes,
+   or for whatever reason, the runtime changes incompatibly */
+#define SWIG_RUNTIME_VERSION "4"
+
+/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
+#ifdef SWIG_TYPE_TABLE
+# define SWIG_QUOTE_STRING(x) #x
+# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
+# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
+#else
+# define SWIG_TYPE_TABLE_NAME
+#endif
+
+/*
+  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
+  creating a static or dynamic library from the swig runtime code.
+  In 99.9% of the cases, swig just needs to declare them as 'static'.
+  
+  But only do this if is strictly necessary, ie, if you have problems
+  with your compiler or so.
+*/
+
+#ifndef SWIGRUNTIME
+# define SWIGRUNTIME SWIGINTERN
+#endif
+
+#ifndef SWIGRUNTIMEINLINE
+# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
+#endif
+
+/*  Generic buffer size */
+#ifndef SWIG_BUFFER_SIZE
+# define SWIG_BUFFER_SIZE 1024
+#endif
+
+/* Flags for pointer conversions */
+#define SWIG_POINTER_DISOWN        0x1
+#define SWIG_CAST_NEW_MEMORY       0x2
+
+/* Flags for new pointer objects */
+#define SWIG_POINTER_OWN           0x1
+
+
+/* 
+   Flags/methods for returning states.
+   
+   The swig conversion methods, as ConvertPtr, return and integer 
+   that tells if the conversion was successful or not. And if not,
+   an error code can be returned (see swigerrors.swg for the codes).
+   
+   Use the following macros/flags to set or process the returning
+   states.
+   
+   In old swig versions, you usually write code as:
+
+     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
+       // success code
+     } else {
+       //fail code
+     }
+
+   Now you can be more explicit as:
+
+    int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+    } else {
+      // fail code
+    }
+
+   that seems to be the same, but now you can also do
+
+    Type *ptr;
+    int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+      if (SWIG_IsNewObj(res) {
+        ...
+       delete *ptr;
+      } else {
+        ...
+      }
+    } else {
+      // fail code
+    }
+    
+   I.e., now SWIG_ConvertPtr can return new objects and you can
+   identify the case and take care of the deallocation. Of course that
+   requires also to SWIG_ConvertPtr to return new result values, as
+
+      int SWIG_ConvertPtr(obj, ptr,...) {         
+        if (<obj is ok>) {                            
+          if (<need new object>) {                    
+            *ptr = <ptr to new allocated object>; 
+            return SWIG_NEWOBJ;                       
+          } else {                                    
+            *ptr = <ptr to old object>;               
+            return SWIG_OLDOBJ;                       
+          }                                   
+        } else {                                      
+          return SWIG_BADOBJ;                 
+        }                                             
+      }
+
+   Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
+   more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
+   swig errors code.
+
+   Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
+   allows to return the 'cast rank', for example, if you have this
+
+       int food(double)
+       int fooi(int);
+
+   and you call
+      food(1)   // cast rank '1'  (1 -> 1.0)
+      fooi(1)   // cast rank '0'
+
+   just use the SWIG_AddCast()/SWIG_CheckState()
+
+
+ */
+#define SWIG_OK                    (0) 
+#define SWIG_ERROR                 (-1)
+#define SWIG_IsOK(r)               (r >= 0)
+#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)  
+
+/* The CastRankLimit says how many bits are used for the cast rank */
+#define SWIG_CASTRANKLIMIT         (1 << 8)
+/* The NewMask denotes the object was created (using new/malloc) */
+#define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
+/* The TmpMask is for in/out typemaps that use temporal objects */
+#define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
+/* Simple returning values */
+#define SWIG_BADOBJ                (SWIG_ERROR)
+#define SWIG_OLDOBJ                (SWIG_OK)
+#define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
+#define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
+/* Check, add and del mask methods */
+#define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
+#define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
+#define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
+#define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
+#define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
+#define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
+
+
+/* Cast-Rank Mode */
+#if defined(SWIG_CASTRANK_MODE)
+#  ifndef SWIG_TypeRank
+#    define SWIG_TypeRank             unsigned long
+#  endif
+#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
+#    define SWIG_MAXCASTRANK          (2)
+#  endif
+#  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
+#  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
+SWIGINTERNINLINE int SWIG_AddCast(int r) { 
+  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
+}
+SWIGINTERNINLINE int SWIG_CheckState(int r) { 
+  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
+}
+#else /* no cast-rank mode */
+#  define SWIG_AddCast
+#  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
+#endif
+
+
+
+
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void *(*swig_converter_func)(void *, int *);
+typedef struct swig_type_info *(*swig_dycast_func)(void **);
+
+/* Structure to store information on one type */
+typedef struct swig_type_info {
+  const char             *name;                        /* mangled name of this type */
+  const char             *str;                 /* human readable name of this type */
+  swig_dycast_func        dcast;               /* dynamic cast function down a hierarchy */
+  struct swig_cast_info  *cast;                        /* linked list of types that can cast into this type */
+  void                   *clientdata;          /* language specific type data */
+  int                    owndata;              /* flag if the structure owns the clientdata */
+} swig_type_info;
+
+/* Structure to store a type and conversion function used for casting */
+typedef struct swig_cast_info {
+  swig_type_info         *type;                        /* pointer to type that is equivalent to this type */
+  swig_converter_func     converter;           /* function to cast the void pointers */
+  struct swig_cast_info  *next;                        /* pointer to next cast in linked list */
+  struct swig_cast_info  *prev;                        /* pointer to the previous cast */
+} swig_cast_info;
+
+/* Structure used to store module information
+ * Each module generates one structure like this, and the runtime collects
+ * all of these structures and stores them in a circularly linked list.*/
+typedef struct swig_module_info {
+  swig_type_info         **types;              /* Array of pointers to swig_type_info structures that are in this module */
+  size_t                 size;                 /* Number of types in this module */
+  struct swig_module_info *next;               /* Pointer to next element in circularly linked list */
+  swig_type_info         **type_initial;       /* Array of initially generated type structures */
+  swig_cast_info         **cast_initial;       /* Array of initially generated casting structures */
+  void                    *clientdata;         /* Language specific module data */
+} swig_module_info;
+
+/* 
+  Compare two type names skipping the space characters, therefore
+  "char*" == "char *" and "Class<int>" == "Class<int >", etc.
+
+  Return 0 when the two name types are equivalent, as in
+  strncmp, but skipping ' '.
+*/
+SWIGRUNTIME int
+SWIG_TypeNameComp(const char *f1, const char *l1,
+                 const char *f2, const char *l2) {
+  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
+    while ((*f1 == ' ') && (f1 != l1)) ++f1;
+    while ((*f2 == ' ') && (f2 != l2)) ++f2;
+    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
+  }
+  return (int)((l1 - f1) - (l2 - f2));
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if not equal, 1 if equal
+*/
+SWIGRUNTIME int
+SWIG_TypeEquiv(const char *nb, const char *tb) {
+  int equiv = 0;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (!equiv && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
+*/
+SWIGRUNTIME int
+SWIG_TypeCompare(const char *nb, const char *tb) {
+  int equiv = 0;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (!equiv && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
+
+
+/* think of this as a c++ template<> or a scheme macro */
+#define SWIG_TypeCheck_Template(comparison, ty)         \
+  if (ty) {                                             \
+    swig_cast_info *iter = ty->cast;                    \
+    while (iter) {                                      \
+      if (comparison) {                                 \
+        if (iter == ty->cast) return iter;              \
+        /* Move iter to the top of the linked list */   \
+        iter->prev->next = iter->next;                  \
+        if (iter->next)                                 \
+          iter->next->prev = iter->prev;                \
+        iter->next = ty->cast;                          \
+        iter->prev = 0;                                 \
+        if (ty->cast) ty->cast->prev = iter;            \
+        ty->cast = iter;                                \
+        return iter;                                    \
+      }                                                 \
+      iter = iter->next;                                \
+    }                                                   \
+  }                                                     \
+  return 0
+
+/*
+  Check the typename
+*/
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheck(const char *c, swig_type_info *ty) {
+  SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
+}
+
+/* Same as previous function, except strcmp is replaced with a pointer comparison */
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
+  SWIG_TypeCheck_Template(iter->type == from, into);
+}
+
+/*
+  Cast a pointer up an inheritance hierarchy
+*/
+SWIGRUNTIMEINLINE void *
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
+}
+
+/* 
+   Dynamic pointer casting. Down an inheritance hierarchy
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
+  swig_type_info *lastty = ty;
+  if (!ty || !ty->dcast) return ty;
+  while (ty && (ty->dcast)) {
+    ty = (*ty->dcast)(ptr);
+    if (ty) lastty = ty;
+  }
+  return lastty;
+}
+
+/*
+  Return the name associated with this type
+*/
+SWIGRUNTIMEINLINE const char *
+SWIG_TypeName(const swig_type_info *ty) {
+  return ty->name;
+}
+
+/*
+  Return the pretty name associated with this type,
+  that is an unmangled type name in a form presentable to the user.
+*/
+SWIGRUNTIME const char *
+SWIG_TypePrettyName(const swig_type_info *type) {
+  /* The "str" field contains the equivalent pretty names of the
+     type, separated by vertical-bar characters.  We choose
+     to print the last name, as it is often (?) the most
+     specific. */
+  if (!type) return NULL;
+  if (type->str != NULL) {
+    const char *last_name = type->str;
+    const char *s;
+    for (s = type->str; *s; s++)
+      if (*s == '|') last_name = s+1;
+    return last_name;
+  }
+  else
+    return type->name;
+}
+
+/* 
+   Set the clientdata field for a type
+*/
+SWIGRUNTIME void
+SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
+  swig_cast_info *cast = ti->cast;
+  /* if (ti->clientdata == clientdata) return; */
+  ti->clientdata = clientdata;
+  
+  while (cast) {
+    if (!cast->converter) {
+      swig_type_info *tc = cast->type;
+      if (!tc->clientdata) {
+       SWIG_TypeClientData(tc, clientdata);
+      }
+    }    
+    cast = cast->next;
+  }
+}
+SWIGRUNTIME void
+SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
+  SWIG_TypeClientData(ti, clientdata);
+  ti->owndata = 1;
+}
+  
+/*
+  Search for a swig_type_info structure only by mangled name
+  Search is a O(log #types)
+  
+  We start searching at module start, and finish searching when start == end.  
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_MangledTypeQueryModule(swig_module_info *start, 
+                            swig_module_info *end, 
+                           const char *name) {
+  swig_module_info *iter = start;
+  do {
+    if (iter->size) {
+      register size_t l = 0;
+      register size_t r = iter->size - 1;
+      do {
+       /* since l+r >= 0, we can (>> 1) instead (/ 2) */
+       register size_t i = (l + r) >> 1; 
+       const char *iname = iter->types[i]->name;
+       if (iname) {
+         register int compare = strcmp(name, iname);
+         if (compare == 0) {       
+           return iter->types[i];
+         } else if (compare < 0) {
+           if (i) {
+             r = i - 1;
+           } else {
+             break;
+           }
+         } else if (compare > 0) {
+           l = i + 1;
+         }
+       } else {
+         break; /* should never happen */
+       }
+      } while (l <= r);
+    }
+    iter = iter->next;
+  } while (iter != end);
+  return 0;
+}
+
+/*
+  Search for a swig_type_info structure for either a mangled name or a human readable name.
+  It first searches the mangled names of the types, which is a O(log #types)
+  If a type is not found it then searches the human readable names, which is O(#types).
+  
+  We start searching at module start, and finish searching when start == end.  
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeQueryModule(swig_module_info *start, 
+                     swig_module_info *end, 
+                    const char *name) {
+  /* STEP 1: Search the name field using binary search */
+  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
+  if (ret) {
+    return ret;
+  } else {
+    /* STEP 2: If the type hasn't been found, do a complete search
+       of the str field (the human readable name) */
+    swig_module_info *iter = start;
+    do {
+      register size_t i = 0;
+      for (; i < iter->size; ++i) {
+       if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
+         return iter->types[i];
+      }
+      iter = iter->next;
+    } while (iter != end);
+  }
+  
+  /* neither found a match */
+  return 0;
+}
+
+/* 
+   Pack binary data into a string
+*/
+SWIGRUNTIME char *
+SWIG_PackData(char *c, void *ptr, size_t sz) {
+  static const char hex[17] = "0123456789abcdef";
+  register const unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu =  u + sz;
+  for (; u != eu; ++u) {
+    register unsigned char uu = *u;
+    *(c++) = hex[(uu & 0xf0) >> 4];
+    *(c++) = hex[uu & 0xf];
+  }
+  return c;
+}
+
+/* 
+   Unpack binary data from a string
+*/
+SWIGRUNTIME const char *
+SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
+  register unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu = u + sz;
+  for (; u != eu; ++u) {
+    register char d = *(c++);
+    register unsigned char uu;
+    if ((d >= '0') && (d <= '9'))
+      uu = ((d - '0') << 4);
+    else if ((d >= 'a') && (d <= 'f'))
+      uu = ((d - ('a'-10)) << 4);
+    else 
+      return (char *) 0;
+    d = *(c++);
+    if ((d >= '0') && (d <= '9'))
+      uu |= (d - '0');
+    else if ((d >= 'a') && (d <= 'f'))
+      uu |= (d - ('a'-10));
+    else 
+      return (char *) 0;
+    *u = uu;
+  }
+  return c;
+}
+
+/* 
+   Pack 'void *' into a string buffer.
+*/
+SWIGRUNTIME char *
+SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
+  char *r = buff;
+  if ((2*sizeof(void *) + 2) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,&ptr,sizeof(void *));
+  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
+  strcpy(r,name);
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      *ptr = (void *) 0;
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sizeof(void *));
+}
+
+SWIGRUNTIME char *
+SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
+  char *r = buff;
+  size_t lname = (name ? strlen(name) : 0);
+  if ((2*sz + 2 + lname) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  if (lname) {
+    strncpy(r,name,lname+1);
+  } else {
+    *r = 0;
+  }
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      memset(ptr,0,sz);
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sz);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/*  Errors in SWIG */
+#define  SWIG_UnknownError        -1 
+#define  SWIG_IOError             -2 
+#define  SWIG_RuntimeError        -3 
+#define  SWIG_IndexError          -4 
+#define  SWIG_TypeError           -5 
+#define  SWIG_DivisionByZero      -6 
+#define  SWIG_OverflowError       -7 
+#define  SWIG_SyntaxError         -8 
+#define  SWIG_ValueError          -9 
+#define  SWIG_SystemError         -10
+#define  SWIG_AttributeError      -11
+#define  SWIG_MemoryError         -12 
+#define  SWIG_NullReferenceError   -13
+
+
+
+#ifdef __cplusplus
+/* Needed on some windows machines---since MS plays funny games with the header files under C++ */
+#include <math.h>
+#include <stdlib.h>
+extern "C" {
+#endif
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+/* Add in functionality missing in older versions of Perl. Much of this is based on Devel-PPPort on cpan. */
+
+/* Add PERL_REVISION, PERL_VERSION, PERL_SUBVERSION if missing */
+#ifndef PERL_REVISION
+#  if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION))
+#    define PERL_PATCHLEVEL_H_IMPLICIT
+#    include <patchlevel.h>
+#  endif
+#  if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL)))
+#    include <could_not_find_Perl_patchlevel.h>
+#  endif
+#  ifndef PERL_REVISION
+#    define PERL_REVISION       (5)
+#    define PERL_VERSION        PATCHLEVEL
+#    define PERL_SUBVERSION     SUBVERSION
+#  endif
+#endif
+
+#if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE)
+#define PerlIO_exportFILE(fh,fl) (FILE*)(fh)
+#endif
+
+#ifndef SvIOK_UV
+# define SvIOK_UV(sv)       (SvIOK(sv) && (SvUVX(sv) == SvIVX(sv)))
+#endif
+
+#ifndef SvUOK
+# define SvUOK(sv)           SvIOK_UV(sv)
+#endif
+
+#if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5)))
+#  define PL_sv_undef               sv_undef
+#  define PL_na                            na
+#  define PL_errgv                  errgv
+#  define PL_sv_no                  sv_no
+#  define PL_sv_yes                 sv_yes
+#  define PL_markstack_ptr          markstack_ptr
+#endif
+
+#ifndef IVSIZE
+#  ifdef LONGSIZE
+#    define IVSIZE LONGSIZE
+#  else
+#    define IVSIZE 4 /* A bold guess, but the best we can make. */
+#  endif
+#endif
+
+#ifndef INT2PTR
+#  if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)
+#    define PTRV                  UV
+#    define INT2PTR(any,d)        (any)(d)
+#  else
+#    if PTRSIZE == LONGSIZE
+#      define PTRV                unsigned long
+#    else
+#      define PTRV                unsigned
+#    endif
+#    define INT2PTR(any,d)        (any)(PTRV)(d)
+#  endif
+
+#  define NUM2PTR(any,d)  (any)(PTRV)(d)
+#  define PTR2IV(p)       INT2PTR(IV,p)
+#  define PTR2UV(p)       INT2PTR(UV,p)
+#  define PTR2NV(p)       NUM2PTR(NV,p)
+
+#  if PTRSIZE == LONGSIZE
+#    define PTR2ul(p)     (unsigned long)(p)
+#  else
+#    define PTR2ul(p)     INT2PTR(unsigned long,p)
+#  endif
+#endif /* !INT2PTR */
+
+#ifndef SvPV_nolen
+# define SvPV_nolen(x) SvPV(x,PL_na)
+#endif
+
+#ifndef get_sv
+#  define get_sv perl_get_sv
+#endif
+
+#ifndef ERRSV
+#  define ERRSV get_sv("@",FALSE)
+#endif
+
+#ifndef pTHX_
+#define pTHX_
+#endif   
+
+#include <string.h>
+#ifdef __cplusplus
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ * error manipulation
+ * ----------------------------------------------------------------------------- */
+
+SWIGINTERN const char*
+SWIG_Perl_ErrorType(int code) {
+  const char* type = 0;
+  switch(code) {
+  case SWIG_MemoryError:
+    type = "MemoryError";
+    break;
+  case SWIG_IOError:
+    type = "IOError";
+    break;
+  case SWIG_RuntimeError:
+    type = "RuntimeError";
+    break;
+  case SWIG_IndexError:
+    type = "IndexError";
+    break;
+  case SWIG_TypeError:
+    type = "TypeError";
+    break;
+  case SWIG_DivisionByZero:
+    type = "ZeroDivisionError";
+    break;
+  case SWIG_OverflowError:
+    type = "OverflowError";
+    break;
+  case SWIG_SyntaxError:
+    type = "SyntaxError";
+    break;
+  case SWIG_ValueError:
+    type = "ValueError";
+    break;
+  case SWIG_SystemError:
+    type = "SystemError";
+    break;
+  case SWIG_AttributeError:
+    type = "AttributeError";
+    break;
+  default:
+    type = "RuntimeError";
+  }
+  return type;
+}
+
+
+
+
+/* -----------------------------------------------------------------------------
+ * perlrun.swg
+ *
+ * This file contains the runtime support for Perl modules
+ * and includes code for managing global variables and pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef PERL_OBJECT
+#define SWIG_PERL_OBJECT_DECL CPerlObj *SWIGUNUSEDPARM(pPerl),
+#define SWIG_PERL_OBJECT_CALL pPerl,
+#else
+#define SWIG_PERL_OBJECT_DECL
+#define SWIG_PERL_OBJECT_CALL
+#endif
+
+/* Common SWIG API */
+
+/* for raw pointers */
+#define SWIG_ConvertPtr(obj, pp, type, flags)           SWIG_Perl_ConvertPtr(SWIG_PERL_OBJECT_CALL obj, pp, type, flags)
+#define SWIG_NewPointerObj(p, type, flags)              SWIG_Perl_NewPointerObj(SWIG_PERL_OBJECT_CALL p, type, flags)
+
+/* for raw packed data */
+#define SWIG_ConvertPacked(obj, p, s, type)             SWIG_Perl_ConvertPacked(SWIG_PERL_OBJECT_CALL obj, p, s, type)
+#define SWIG_NewPackedObj(p, s, type)                  SWIG_Perl_NewPackedObj(SWIG_PERL_OBJECT_CALL p, s, type)
+
+/* for class or struct pointers */
+#define SWIG_ConvertInstance(obj, pptr, type, flags)    SWIG_ConvertPtr(obj, pptr, type, flags)
+#define SWIG_NewInstanceObj(ptr, type, flags)           SWIG_NewPointerObj(ptr, type, flags)
+
+/* for C or C++ function pointers */
+#define SWIG_ConvertFunctionPtr(obj, pptr, type)        SWIG_ConvertPtr(obj, pptr, type, 0)
+#define SWIG_NewFunctionPtrObj(ptr, type)               SWIG_NewPointerObj(ptr, type, 0)
+
+/* for C++ member pointers, ie, member methods */
+#define SWIG_ConvertMember(obj, ptr, sz, ty)            SWIG_ConvertPacked(obj, ptr, sz, ty)
+#define SWIG_NewMemberObj(ptr, sz, type)                SWIG_NewPackedObj(ptr, sz, type)
+
+
+/* Runtime API */
+
+#define SWIG_GetModule(clientdata)                      SWIG_Perl_GetModule()
+#define SWIG_SetModule(clientdata, pointer)             SWIG_Perl_SetModule(pointer)
+
+
+/* Error manipulation */
+
+#define SWIG_ErrorType(code)                            SWIG_Perl_ErrorType(code)               
+#define SWIG_Error(code, msg)                          sv_setpvf(GvSV(PL_errgv),"%s %s\n", SWIG_ErrorType(code), msg)
+#define SWIG_fail                                      goto fail                                                   
+
+/* Perl-specific SWIG API */
+
+#define SWIG_MakePtr(sv, ptr, type, flags)              SWIG_Perl_MakePtr(SWIG_PERL_OBJECT_CALL sv, ptr, type, flags)
+#define SWIG_MakePackedObj(sv, p, s, type)             SWIG_Perl_MakePackedObj(SWIG_PERL_OBJECT_CALL sv, p, s, type)
+#define SWIG_SetError(str)                              SWIG_Error(SWIG_RuntimeError, str)
+
+
+#define SWIG_PERL_DECL_ARGS_1(arg1)                     (SWIG_PERL_OBJECT_DECL arg1)
+#define SWIG_PERL_CALL_ARGS_1(arg1)                     (SWIG_PERL_OBJECT_CALL arg1)
+#define SWIG_PERL_DECL_ARGS_2(arg1, arg2)               (SWIG_PERL_OBJECT_DECL arg1, arg2)
+#define SWIG_PERL_CALL_ARGS_2(arg1, arg2)               (SWIG_PERL_OBJECT_CALL arg1, arg2)
+
+/* -----------------------------------------------------------------------------
+ * pointers/data manipulation
+ * ----------------------------------------------------------------------------- */
+
+/* For backward compatibility only */
+#define SWIG_POINTER_EXCEPTION  0
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SWIG_OWNER   SWIG_POINTER_OWN
+#define SWIG_SHADOW  SWIG_OWNER << 1
+
+#define SWIG_MAYBE_PERL_OBJECT SWIG_PERL_OBJECT_DECL
+
+/* SWIG Perl macros */
+
+/* Macro to declare an XS function */
+#ifndef XSPROTO
+#   define XSPROTO(name) void name(pTHX_ CV* cv)
+#endif
+
+/* Macro to call an XS function */
+#ifdef PERL_OBJECT 
+#  define SWIG_CALLXS(_name) _name(cv,pPerl) 
+#else 
+#  ifndef MULTIPLICITY 
+#    define SWIG_CALLXS(_name) _name(cv) 
+#  else 
+#    define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv) 
+#  endif 
+#endif 
+
+#ifdef PERL_OBJECT
+#define MAGIC_PPERL  CPerlObj *pPerl = (CPerlObj *) this;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
+#define SWIGCLASS_STATIC
+
+#else /* PERL_OBJECT */
+
+#define MAGIC_PPERL
+#define SWIGCLASS_STATIC static SWIGUNUSED
+
+#ifndef MULTIPLICITY
+#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (*SwigMagicFunc)(SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#else /* MULTIPLICITY */
+
+#define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MULTIPLICITY */
+#endif /* PERL_OBJECT */
+
+/* Workaround for bug in perl 5.6.x croak and earlier */
+#if (PERL_VERSION < 8)
+#  ifdef PERL_OBJECT
+#    define SWIG_croak_null() SWIG_Perl_croak_null(pPerl)
+static void SWIG_Perl_croak_null(CPerlObj *pPerl)
+#  else
+static void SWIG_croak_null()
+#  endif
+{
+  SV *err=ERRSV;
+#  if (PERL_VERSION < 6)
+  croak("%_", err);
+#  else
+  if (SvOK(err) && !SvROK(err)) croak("%_", err);
+  croak(Nullch);
+#  endif
+}
+#else
+#  define SWIG_croak_null() croak(Nullch)
+#endif
+
+
+/* 
+   Define how strict is the cast between strings and integers/doubles
+   when overloading between these types occurs.
+   
+   The default is making it as strict as possible by using SWIG_AddCast
+   when needed.
+   
+   You can use -DSWIG_PERL_NO_STRICT_STR2NUM at compilation time to
+   disable the SWIG_AddCast, making the casting between string and
+   numbers less strict.
+
+   In the end, we try to solve the overloading between strings and
+   numerical types in the more natural way, but if you can avoid it,
+   well, avoid it using %rename, for example.
+*/
+#ifndef SWIG_PERL_NO_STRICT_STR2NUM
+# ifndef SWIG_PERL_STRICT_STR2NUM
+#  define SWIG_PERL_STRICT_STR2NUM
+# endif
+#endif
+#ifdef SWIG_PERL_STRICT_STR2NUM
+/* string takes precedence */
+#define SWIG_Str2NumCast(x) SWIG_AddCast(x)  
+#else
+/* number takes precedence */
+#define SWIG_Str2NumCast(x) x
+#endif
+
+
+
+#include <stdlib.h>
+
+SWIGRUNTIME const char *
+SWIG_Perl_TypeProxyName(const swig_type_info *type) {
+  if (!type) return NULL;
+  if (type->clientdata != NULL) {
+    return (const char*) type->clientdata;
+  } 
+  else {
+    return type->name;
+  }
+}
+
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
+  SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp(iter->type->name, c) == 0)) 
+                           || (iter->type->clientdata && (strcmp((char*)iter->type->clientdata, c) == 0))), ty);
+}
+
+
+/* Function for getting a pointer value */
+
+SWIGRUNTIME int
+SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags) {
+  swig_cast_info *tc;
+  void *voidptr = (void *)0;
+  SV *tsv = 0;
+  /* If magical, apply more magic */
+  if (SvGMAGICAL(sv))
+    mg_get(sv);
+
+  /* Check to see if this is an object */
+  if (sv_isobject(sv)) {
+    IV tmp = 0;
+    tsv = (SV*) SvRV(sv);
+    if ((SvTYPE(tsv) == SVt_PVHV)) {
+      MAGIC *mg;
+      if (SvMAGICAL(tsv)) {
+        mg = mg_find(tsv,'P');
+        if (mg) {
+          sv = mg->mg_obj;
+          if (sv_isobject(sv)) {
+           tsv = (SV*)SvRV(sv);
+            tmp = SvIV(tsv);
+          }
+        }
+      } else {
+        return SWIG_ERROR;
+      }
+    } else {
+      tmp = SvIV(tsv);
+    }
+    voidptr = INT2PTR(void *,tmp);
+  } else if (! SvOK(sv)) {            /* Check for undef */
+    *(ptr) = (void *) 0;
+    return SWIG_OK;
+  } else if (SvTYPE(sv) == SVt_RV) {  /* Check for NULL pointer */
+    if (!SvROK(sv)) {
+      *(ptr) = (void *) 0;
+      return SWIG_OK;
+    } else {
+      return SWIG_ERROR;
+    }
+  } else {                            /* Don't know what it is */
+    return SWIG_ERROR;
+  }
+  if (_t) {
+    /* Now see if the types match */
+    char *_c = HvNAME(SvSTASH(SvRV(sv)));
+    tc = SWIG_TypeProxyCheck(_c,_t);
+    if (!tc) {
+      return SWIG_ERROR;
+    }
+    {
+      int newmemory = 0;
+      *ptr = SWIG_TypeCast(tc,voidptr,&newmemory);
+      assert(!newmemory); /* newmemory handling not yet implemented */
+    }
+  } else {
+    *ptr = voidptr;
+  }
+
+  /* 
+   *  DISOWN implementation: we need a perl guru to check this one.
+   */
+  if (tsv && (flags & SWIG_POINTER_DISOWN)) {
+    /* 
+     *  almost copy paste code from below SWIG_POINTER_OWN setting
+     */
+    SV *obj = sv;
+    HV *stash = SvSTASH(SvRV(obj));
+    GV *gv = *(GV**) hv_fetch(stash, "OWNER", 5, TRUE);
+    if (isGV(gv)) {
+      HV *hv = GvHVn(gv);
+      /*
+       * To set ownership (see below), a newSViv(1) entry is added. 
+       * Hence, to remove ownership, we delete the entry.
+       */
+      if (hv_exists_ent(hv, obj, 0)) {
+       hv_delete_ent(hv, obj, 0, 0);
+      }
+    }
+  }
+  return SWIG_OK;
+}
+
+SWIGRUNTIME void
+SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, swig_type_info *t, int flags) {
+  if (ptr && (flags & SWIG_SHADOW)) {
+    SV *self;
+    SV *obj=newSV(0);
+    HV *hash=newHV();
+    HV *stash;
+    sv_setref_pv(obj, (char *) SWIG_Perl_TypeProxyName(t), ptr);
+    stash=SvSTASH(SvRV(obj));
+    if (flags & SWIG_POINTER_OWN) {
+      HV *hv;
+      GV *gv=*(GV**)hv_fetch(stash, "OWNER", 5, TRUE);
+      if (!isGV(gv))
+        gv_init(gv, stash, "OWNER", 5, FALSE);
+      hv=GvHVn(gv);
+      hv_store_ent(hv, obj, newSViv(1), 0);
+    }
+    sv_magic((SV *)hash, (SV *)obj, 'P', Nullch, 0);
+    SvREFCNT_dec(obj);
+    self=newRV_noinc((SV *)hash);
+    sv_setsv(sv, self);
+    SvREFCNT_dec((SV *)self);
+    sv_bless(sv, stash);
+  }
+  else {
+    sv_setref_pv(sv, (char *) SWIG_Perl_TypeProxyName(t), ptr);
+  }
+}
+
+SWIGRUNTIMEINLINE SV *
+SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info *t, int flags) {
+  SV *result = sv_newmortal();
+  SWIG_MakePtr(result, ptr, t, flags);
+  return result;
+}
+
+SWIGRUNTIME void
+SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, int sz, swig_type_info *type) {
+  char result[1024];
+  char *r = result;
+  if ((2*sz + 1 + strlen(SWIG_Perl_TypeProxyName(type))) > 1000) return;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  strcpy(r,SWIG_Perl_TypeProxyName(type));
+  sv_setpv(sv, result);
+}
+
+SWIGRUNTIME SV *
+SWIG_Perl_NewPackedObj(SWIG_MAYBE_PERL_OBJECT void *ptr, int sz, swig_type_info *type) {
+  SV *result = sv_newmortal();
+  SWIG_Perl_MakePackedObj(result, ptr, sz, type);
+  return result;
+}
+
+/* Convert a packed value value */
+SWIGRUNTIME int
+SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty) {
+  swig_cast_info *tc;
+  const char  *c = 0;
+
+  if ((!obj) || (!SvOK(obj))) return SWIG_ERROR;
+  c = SvPV_nolen(obj);
+  /* Pointer values must start with leading underscore */
+  if (*c != '_') return SWIG_ERROR;
+  c++;
+  c = SWIG_UnpackData(c,ptr,sz);
+  if (ty) {
+    tc = SWIG_TypeCheck(c,ty);
+    if (!tc) return SWIG_ERROR;
+  }
+  return SWIG_OK;
+}
+
+
+/* Macros for low-level exception handling */
+#define SWIG_croak(x)    { SWIG_Error(SWIG_RuntimeError, x); SWIG_fail; }
+
+
+typedef XSPROTO(SwigPerlWrapper);
+typedef SwigPerlWrapper *SwigPerlWrapperPtr;
+
+/* Structure for command table */
+typedef struct {
+  const char         *name;
+  SwigPerlWrapperPtr  wrapper;
+} swig_command_info;
+
+/* Information for constant table */
+
+#define SWIG_INT     1
+#define SWIG_FLOAT   2
+#define SWIG_STRING  3
+#define SWIG_POINTER 4
+#define SWIG_BINARY  5
+
+/* Constant information structure */
+typedef struct swig_constant_info {
+    int              type;
+    const char      *name;
+    long             lvalue;
+    double           dvalue;
+    void            *pvalue;
+    swig_type_info **ptype;
+} swig_constant_info;
+
+
+/* Structure for variable table */
+typedef struct {
+  const char   *name;
+  SwigMagicFunc   set;
+  SwigMagicFunc   get;
+  swig_type_info  **type;
+} swig_variable_info;
+
+/* Magic variable code */
+#ifndef PERL_OBJECT
+#define swig_create_magic(s,a,b,c) _swig_create_magic(s,a,b,c)
+  #ifndef MULTIPLICITY
+     SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) 
+  #else
+     SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) 
+  #endif
+#else
+#  define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c)
+SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) 
+#endif
+{
+  MAGIC *mg;
+  sv_magic(sv,sv,'U',(char *) name,strlen(name));
+  mg = mg_find(sv,'U');
+  mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
+  mg->mg_virtual->svt_get = (SwigMagicFunc) get;
+  mg->mg_virtual->svt_set = (SwigMagicFunc) set;
+  mg->mg_virtual->svt_len = 0;
+  mg->mg_virtual->svt_clear = 0;
+  mg->mg_virtual->svt_free = 0;
+}
+
+
+SWIGRUNTIME swig_module_info *
+SWIG_Perl_GetModule(void) {
+  static void *type_pointer = (void *)0;
+  SV *pointer;
+
+  /* first check if pointer already created */
+  if (!type_pointer) {
+    pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI);
+    if (pointer && SvOK(pointer)) {
+      type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
+    }
+  }
+
+  return (swig_module_info *) type_pointer;
+}
+
+SWIGRUNTIME void
+SWIG_Perl_SetModule(swig_module_info *module) {
+  SV *pointer;
+
+  /* create a new pointer */
+  pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI);
+  sv_setiv(pointer, PTR2IV(module));
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/* Workaround perl5 global namespace pollution. Note that undefining library
+ * functions like fopen will not solve the problem on all platforms as fopen
+ * might be a macro on Windows but not necessarily on other operating systems. */
+#ifdef do_open
+  #undef do_open
+#endif
+#ifdef do_close
+  #undef do_close
+#endif
+#ifdef scalar
+  #undef scalar
+#endif
+#ifdef list
+  #undef list
+#endif
+#ifdef apply
+  #undef apply
+#endif
+#ifdef convert
+  #undef convert
+#endif
+#ifdef Error
+  #undef Error
+#endif
+#ifdef form
+  #undef form
+#endif
+#ifdef vform
+  #undef vform
+#endif
+#ifdef LABEL
+  #undef LABEL
+#endif
+#ifdef METHOD
+  #undef METHOD
+#endif
+#ifdef Move
+  #undef Move
+#endif
+#ifdef yylex
+  #undef yylex
+#endif
+#ifdef yyparse
+  #undef yyparse
+#endif
+#ifdef yyerror
+  #undef yyerror
+#endif
+#ifdef invert
+  #undef invert
+#endif
+#ifdef ref
+  #undef ref
+#endif
+#ifdef read
+  #undef read
+#endif
+#ifdef write
+  #undef write
+#endif
+#ifdef eof
+  #undef eof
+#endif
+#ifdef bool
+  #undef bool
+#endif
+#ifdef close
+  #undef close
+#endif
+#ifdef rewind
+  #undef rewind
+#endif
+#ifdef free
+  #undef free
+#endif
+#ifdef malloc
+  #undef malloc
+#endif
+#ifdef calloc
+  #undef calloc
+#endif
+#ifdef Stat
+  #undef Stat
+#endif
+#ifdef check
+  #undef check
+#endif
+#ifdef seekdir
+  #undef seekdir
+#endif
+#ifdef open
+  #undef open
+#endif
+
+
+
+#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
+
+#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else 
+
+
+
+  #define SWIG_exception(code, msg) do { SWIG_Error(code, msg); SWIG_fail;; } while(0) 
+
+
+/* -------- TYPES TABLE (BEGIN) -------- */
+
+#define SWIGTYPE_p_amar_attr_t swig_types[0]
+#define SWIGTYPE_p_amar_file_t swig_types[1]
+#define SWIGTYPE_p_amar_t swig_types[2]
+#define SWIGTYPE_p_char swig_types[3]
+#define SWIGTYPE_p_double swig_types[4]
+#define SWIGTYPE_p_float swig_types[5]
+#define SWIGTYPE_p_gsize swig_types[6]
+#define SWIGTYPE_p_guint16 swig_types[7]
+#define SWIGTYPE_p_int swig_types[8]
+#define SWIGTYPE_p_off_t swig_types[9]
+#define SWIGTYPE_p_unsigned_char swig_types[10]
+static swig_type_info *swig_types[12];
+static swig_module_info swig_module = {swig_types, 11, 0, 0, 0, 0};
+#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
+#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
+
+/* -------- TYPES TABLE (END) -------- */
+
+#define SWIG_init    boot_Amanda__Archive
+
+#define SWIG_name   "Amanda::Archivec::boot_Amanda__Archive"
+#define SWIG_prefix "Amanda::Archivec::"
+
+#define SWIGVERSION 0x010335 
+#define SWIG_VERSION SWIGVERSION
+
+
+#define SWIG_as_voidptr(a) (void *)((const void *)(a)) 
+#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) 
+
+
+#ifdef __cplusplus
+extern "C"
+#endif
+#ifndef PERL_OBJECT
+#ifndef MULTIPLICITY
+SWIGEXPORT void SWIG_init (CV* cv);
+#else
+SWIGEXPORT void SWIG_init (pTHXo_ CV* cv);
+#endif
+#else
+SWIGEXPORT void SWIG_init (CV *cv, CPerlObj *);
+#endif
+
+
+#include "amglue.h"
+
+
+#include "amglue.h"
+
+
+#include "amglue.h"
+
+
+#include "amar.h"
+
+
+/* Support code (not directly available from perl) */
+
+/* A C object to contain all of the relevant callbacks and other state during a
+ * read operation; this becomes the user_data during the read */
+typedef struct perl_read_data_s {
+    SV *user_data;
+    SV *file_start_sub;
+    SV *file_finish_sub;
+
+    amar_attr_handling_t *handling_array;
+} perl_read_data_t;
+
+static gboolean
+read_start_file_cb(
+       gpointer user_data,
+       uint16_t filenum,
+       gpointer filename,
+       gsize filename_len,
+       gboolean *ignore,
+       gpointer *file_data)
+{
+    dSP;
+    perl_read_data_t *dat = user_data;
+    SV *rv = NULL;
+    STRLEN len;
+    int count;
+
+    *file_data = NULL;
+
+    g_assert(dat->file_start_sub != NULL);
+
+    ENTER;
+    SAVETMPS;
+
+    PUSHMARK(SP);
+    XPUSHs(dat->user_data);
+    XPUSHs(sv_2mortal(newSViv(filenum)));
+    XPUSHs(sv_2mortal(newSVpvn(filename, filename_len)));
+    PUTBACK;
+
+    count = call_sv(dat->file_start_sub, G_EVAL|G_SCALAR);
+
+    SPAGAIN;
+
+    if (count != 1)
+       croak("file_start_sub returned nothing");
+
+    rv = POPs;
+
+    /* if it's the string "IGNORE", then ignore it */
+    if (SvPOK(rv)) {
+       static const char *ign = "IGNORE";
+       char *rvstr = SvPV(rv, len);
+       if (strlen(ign) == len && 0 == strncmp(ign, rvstr, len))
+           *ignore = TRUE;
+    }
+
+    /* otherwise, keep the value */
+    if (!*ignore)
+       *(SV **)(file_data) = SvREFCNT_inc(rv);
+
+    PUTBACK;
+    FREETMPS;
+    LEAVE;
+
+    if (SvTRUE(ERRSV))
+       return FALSE;
+    return TRUE;
+}
+
+static gboolean
+read_finish_file_cb(
+       gpointer user_data,
+       uint16_t filenum,
+       gpointer *file_data,
+       gboolean truncated)
+{
+    dSP;
+    perl_read_data_t *dat = user_data;
+
+    g_assert(dat->file_finish_sub != NULL);
+
+    ENTER;
+    SAVETMPS;
+
+    PUSHMARK(SP); XPUSHs(dat->user_data); XPUSHs(*(SV **)file_data);
+    XPUSHs(sv_2mortal(newSViv(filenum)));
+    XPUSHs(sv_2mortal(newSViv(truncated))); PUTBACK;
+
+    call_sv(dat->file_finish_sub, G_EVAL|G_DISCARD);
+
+    /* we're done with this file's file_data */
+    SvREFCNT_dec(*(SV **)file_data);
+
+    FREETMPS;
+    LEAVE;
+
+    if (SvTRUE(ERRSV))
+       return FALSE;
+    return TRUE;
+}
+
+static gboolean
+read_frag_cb(
+       gpointer user_data,
+       uint16_t filenum,
+       gpointer file_data,
+       uint16_t attrid,
+       gpointer attrid_data,
+       gpointer *attr_data,
+       gpointer data,
+       gsize size,
+       gboolean eoa,
+       gboolean truncated)
+{
+    dSP;
+    perl_read_data_t *dat = user_data;
+    SV *rv;
+    int count;
+
+    if (!attrid_data)
+       return TRUE;
+
+    ENTER;
+    SAVETMPS;
+
+    PUSHMARK(SP);
+    XPUSHs(dat->user_data);
+    XPUSHs(sv_2mortal(newSViv(filenum)));
+    XPUSHs((SV *)file_data);
+    XPUSHs(sv_2mortal(newSViv(attrid)));
+    if (*attr_data)
+        XPUSHs((SV *)(*attr_data));
+    else
+        XPUSHs(&PL_sv_undef);
+    XPUSHs(sv_2mortal(newSVpvn(data, size)));
+    XPUSHs(sv_2mortal(newSViv(eoa)));
+    XPUSHs(sv_2mortal(newSViv(truncated)));
+    PUTBACK;
+
+    count = call_sv(attrid_data, G_EVAL|G_SCALAR);
+
+    SPAGAIN;
+
+    if (count != 1)
+       croak("fragment callback returned nothing");
+
+    rv = POPs;
+
+    if (eoa) {
+        SvREFCNT_dec(*attr_data);
+    } else {
+        /* increment before decrement here, in case they're the same object */
+        SvREFCNT_inc(rv);
+        SvREFCNT_dec(*attr_data);
+        *attr_data = rv;
+    }
+
+    FREETMPS;
+    LEAVE;
+
+    if (SvTRUE(ERRSV))
+       return FALSE;
+    return TRUE;
+}
+
+static void
+croak_gerror(GError **error)
+{
+    static char *errstr = NULL;
+    if (errstr) g_free(errstr);
+    errstr = g_strdup((*error)->message);
+    g_clear_error(error);
+    croak("Amanda archive: %s", errstr);
+}
+
+/* generic function to recognize when a string+len represents a number and
+ * incidentally return the resulting value.  Note that this does not handle
+ * negative numbers. */
+static gboolean
+is_number(char *str, int len, int *result)
+{
+    char *end = str+len;
+    int r = 0;
+
+    while (str < end) {
+       if (!g_ascii_isdigit(*str)) return FALSE;
+       r = r * 10 + (int)(*str - '0');
+       if (r < 0) {
+           /* overflow */
+           return FALSE;
+       }
+       str++;
+    }
+
+    *result = r;
+    return TRUE;
+}
+
+
+
+
+/* Wrapper functions, mostly dealing with error handling */
+
+amar_t *amar_new_(int fd, char *modestr) {
+    GError *error = NULL;
+    amar_t *rv;
+    int mode;
+
+    if (strcmp(modestr, ">") == 0)
+       mode = O_WRONLY;
+    else if (strcmp(modestr, "<") == 0)
+       mode = O_RDONLY;
+    else
+       croak("mode must be '<' or '>'");
+
+    if ((rv = amar_new(fd, mode, &error))) {
+       return rv;
+    }
+
+    croak_gerror(&error);
+    return NULL;
+}
+
+void amar_close_(amar_t *arch) {
+    GError *error = NULL;
+    if (!amar_close(arch, &error))
+       croak_gerror(&error);
+}
+
+amar_file_t *
+amar_new_file_(amar_t *arch, char *filename, gsize filename_len, off_t *want_position) {
+    GError *error = NULL;
+    amar_file_t *file;
+    g_assert(arch != NULL);
+
+    file = amar_new_file(arch, filename, filename_len, want_position, &error);
+    if (file)
+       return file;
+
+    croak_gerror(&error);
+    return NULL;
+}
+
+void amar_file_close_(amar_file_t *file) {
+    GError *error = NULL;
+    if (!amar_file_close(file, &error))
+       croak_gerror(&error);
+}
+
+amar_attr_t *
+amar_new_attr_(amar_file_t *file, guint16 attrid) {
+    GError *error = NULL;
+    amar_attr_t *attr;
+
+    g_assert(file != NULL);
+
+    attr = amar_new_attr(file, attrid, &error);
+    if (attr)
+       return attr;
+
+    croak_gerror(&error);
+    return NULL;
+}
+
+void amar_attr_close_(amar_attr_t *attr) {
+    GError *error = NULL;
+    if (!amar_attr_close(attr, &error))
+       croak_gerror(&error);
+}
+
+void amar_attr_add_data_buffer_(amar_attr_t *attr, char *buffer, gsize size, gboolean eoa) {
+    GError *error = NULL;
+    if (!amar_attr_add_data_buffer(attr, buffer, size, eoa, &error))
+       croak_gerror(&error);
+}
+
+size_t
+amar_attr_add_data_fd_(amar_attr_t *attr, int fd, gboolean eoa) {
+    GError *error = NULL;
+    size_t rv = amar_attr_add_data_fd(attr, fd, eoa, &error);
+    if (rv < 0)
+       croak_gerror(&error);
+    return rv;
+}
+
+/* reading */
+
+void amar_read_(amar_t *archive, SV *params_hashref) {
+    perl_read_data_t *dat = g_new0(perl_read_data_t, 1);
+    GError *error = NULL;
+    gboolean success;
+    HV *params;
+    HE *param;
+    I32 len;
+    int maxhandlers;
+    int hdl_idx;
+
+    /* make sure we got a hashref */
+    if (!SvROK(params_hashref) || SvTYPE(SvRV(params_hashref)) != SVt_PVHV)
+       croak("read() expects a single hashref");
+    params = (HV *)SvRV(params_hashref);
+    len = hv_iterinit(params);
+
+    maxhandlers = hdl_idx = len;
+    dat->handling_array = g_new0(amar_attr_handling_t, len+1);
+
+    /* loop through the parameters */
+    while ((param = hv_iternext(params))) {
+       I32 keylen;
+       char *key = hv_iterkey(param, &keylen);
+       int attrid;
+
+       /* if it's a number, it's handling information for an attrid */
+       if (is_number(key, keylen, &attrid)) {
+           SV *val = hv_iterval(params, param);
+           SV *coderef;
+           UV bufsize = 0;
+           int i;
+
+           if (!SvROK(val)) goto croak_hdl;
+
+           switch (SvTYPE(SvRV(val))) {
+               case SVt_PVCV:
+                   coderef = val;
+                   break;
+
+               case SVt_PVAV: {
+                   AV *arr = (AV *)SvRV(val);
+                   SV **svp;
+
+                   if (av_len(arr) != 1) /* av_len == largest index, not length */
+                       goto croak_hdl;
+
+                   /* get the bufsize */
+                   svp = av_fetch(arr, 0, 0);
+                   if (!SvIOK(*svp))
+                       goto croak_hdl;
+                   bufsize = SvUV(*svp);
+
+                   /* and the coderef */
+                   svp = av_fetch(arr, 1, 0);
+                   if (!SvROK(*svp) || SvTYPE(SvRV(*svp)) != SVt_PVCV)
+                       goto croak_hdl;
+                   coderef = *svp;
+                   break;
+               }
+
+               default:
+                   goto croak_hdl;
+           }
+
+           /* fill in the handling array, putting attrid 0 at the end, and
+            * filling in entries backward from there */
+           i = (attrid == 0)? maxhandlers : --hdl_idx;
+           dat->handling_array[i].attrid = attrid;
+           dat->handling_array[i].min_size = bufsize;
+           dat->handling_array[i].callback = read_frag_cb;
+           dat->handling_array[i].attrid_data = coderef;
+           SvREFCNT_inc(coderef);
+           continue;
+
+       croak_hdl:
+           croak("Expected CODEREF or [ MIN_SIZE, CODEREF ] for attrid %d", attrid);
+       }
+
+#define key_compare(key, val, keylen) \
+    (keylen == sizeof(val)-1) && (0 == strncmp(key, val, keylen))
+
+       if (key_compare(key, "file_start", keylen)) {
+           SV *val = hv_iterval(params, param);
+           if (!SvROK(val) || SvTYPE(SvRV(val)) != SVt_PVCV)
+               croak("Expected a CODEREF for file_start");
+           dat->file_start_sub = val;
+           SvREFCNT_inc(val);
+           continue;
+       }
+
+       if (key_compare(key, "file_finish", keylen)) {
+           SV *val = hv_iterval(params, param);
+           if (!SvROK(val) || SvTYPE(SvRV(val)) != SVt_PVCV)
+               croak("Expected a CODEREF for file_finish");
+           dat->file_finish_sub = val;
+           SvREFCNT_inc(val);
+           continue;
+       }
+
+       if (key_compare(key, "user_data", keylen)) {
+           SV *val = hv_iterval(params, param);
+           dat->user_data = val;
+           SvREFCNT_inc(val);
+           continue;
+       }
+#undef key_compare
+       croak("Invalid parameter named '%*s'", (int)keylen, key);
+    }
+
+    if (!dat->user_data)
+       dat->user_data = &PL_sv_undef;
+
+    success = amar_read(archive, dat, dat->handling_array + hdl_idx,
+       dat->file_start_sub? read_start_file_cb : NULL,
+       dat->file_finish_sub? read_finish_file_cb : NULL,
+       &error);
+
+    /* now unreference and free everything we referenced earlier */
+    if (dat->file_start_sub)
+       SvREFCNT_dec(dat->file_start_sub);
+    if (dat->file_finish_sub)
+       SvREFCNT_dec(dat->file_finish_sub);
+    if (dat->user_data && dat->user_data != &PL_sv_undef)
+       SvREFCNT_dec(dat->user_data);
+
+    for (hdl_idx = 0; hdl_idx <= maxhandlers; hdl_idx++) {
+       if (dat->handling_array[hdl_idx].attrid_data)
+           SvREFCNT_dec(dat->handling_array[hdl_idx].attrid_data);
+    }
+
+    g_free(dat->handling_array);
+    g_free(dat);
+
+    /* if amar_read returned FALSE, then either we hit an internal
+     * error, or one of the perl callbacks raised an exception, and $@
+     * is still set */
+    if (!success) {
+       if (error)
+           croak_gerror(&error);
+       else
+           croak(NULL);
+    }
+}
+
+
+
+SWIGINTERN swig_type_info*
+SWIG_pchar_descriptor(void)
+{
+  static int init = 0;
+  static swig_type_info* info = 0;
+  if (!init) {
+    info = SWIG_TypeQuery("_p_char");
+    init = 1;
+  }
+  return info;
+}
+
+
+SWIGINTERN int
+SWIG_AsCharPtrAndSize(SV *obj, char** cptr, size_t* psize, int *alloc)
+{
+  if (SvPOK(obj)) {
+    STRLEN len = 0;
+    char *cstr = SvPV(obj, len); 
+    size_t size = len + 1;
+    if (cptr)  {
+      if (alloc) {
+       if (*alloc == SWIG_NEWOBJ) {
+         *cptr = (char *)memcpy((char *)malloc((size)*sizeof(char)), cstr, sizeof(char)*(size));
+       } else {
+         *cptr = cstr;
+         *alloc = SWIG_OLDOBJ;
+       }
+      }
+    }
+    if (psize) *psize = size;
+    return SWIG_OK;
+  } else {
+    swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
+    if (pchar_descriptor) {
+      char* vptr = 0; 
+      if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_descriptor, 0) == SWIG_OK) {
+       if (cptr) *cptr = vptr;
+       if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0;
+       if (alloc) *alloc = SWIG_OLDOBJ;
+       return SWIG_OK;
+      }
+    }
+  }
+  return SWIG_TypeError;
+}
+
+
+
+
+
+#include <limits.h>
+#if !defined(SWIG_NO_LLONG_MAX)
+# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
+#   define LLONG_MAX __LONG_LONG_MAX__
+#   define LLONG_MIN (-LLONG_MAX - 1LL)
+#   define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
+# endif
+#endif
+
+
+SWIGINTERN int
+SWIG_AsVal_double SWIG_PERL_DECL_ARGS_2(SV *obj, double *val)
+{
+  if (SvNIOK(obj)) {
+    if (val) *val = SvNV(obj);
+    return SWIG_OK;
+  } else if (SvIOK(obj)) {
+    if (val) *val = (double) SvIV(obj);
+    return SWIG_AddCast(SWIG_OK);
+  } else {
+    const char *nptr = SvPV_nolen(obj);
+    if (nptr) {
+      char *endptr;
+      double v = strtod(nptr, &endptr);
+      if (errno == ERANGE) {
+       errno = 0;
+       return SWIG_OverflowError;
+      } else {
+       if (*endptr == '\0') {
+         if (val) *val = v;
+         return SWIG_Str2NumCast(SWIG_OK);
+       }
+      }
+    }
+  }
+  return SWIG_TypeError;
+}
+
+
+#include <float.h>
+
+
+#include <math.h>
+
+
+SWIGINTERNINLINE int
+SWIG_CanCastAsInteger(double *d, double min, double max) {
+  double x = *d;
+  if ((min <= x && x <= max)) {
+   double fx = floor(x);
+   double cx = ceil(x);
+   double rd =  ((x - fx) < 0.5) ? fx : cx; /* simple rint */
+   if ((errno == EDOM) || (errno == ERANGE)) {
+     errno = 0;
+   } else {
+     double summ, reps, diff;
+     if (rd < x) {
+       diff = x - rd;
+     } else if (rd > x) {
+       diff = rd - x;
+     } else {
+       return 1;
+     }
+     summ = rd + x;
+     reps = diff/summ;
+     if (reps < 8*DBL_EPSILON) {
+       *d = rd;
+       return 1;
+     }
+   }
+  }
+  return 0;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_long SWIG_PERL_DECL_ARGS_2(SV *obj, long* val)
+{
+  if (SvIOK(obj)) {
+    if (val) *val = SvIV(obj);
+    return SWIG_OK;
+  } else {
+    int dispatch = 0;
+    const char *nptr = SvPV_nolen(obj);
+    if (nptr) {
+      char *endptr;
+      long v;
+      errno = 0;
+      v = strtol(nptr, &endptr,0);
+      if (errno == ERANGE) {
+       errno = 0;
+       return SWIG_OverflowError;
+      } else {
+       if (*endptr == '\0') {
+         if (val) *val = v;
+         return SWIG_Str2NumCast(SWIG_OK);
+       }
+      }
+    }
+    if (!dispatch) {
+      double d;
+      int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj,&d));
+      if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
+       if (val) *val = (long)(d);
+       return res;
+      }
+    }
+  }
+  return SWIG_TypeError;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_int SWIG_PERL_DECL_ARGS_2(SV * obj, int *val)
+{
+  long v;
+  int res = SWIG_AsVal_long SWIG_PERL_CALL_ARGS_2(obj, &v);
+  if (SWIG_IsOK(res)) {
+    if ((v < INT_MIN || v > INT_MAX)) {
+      return SWIG_OverflowError;
+    } else {
+      if (val) *val = (int)(v);
+    }
+  }  
+  return res;
+}
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef PERL_OBJECT
+#define MAGIC_CLASS _wrap_Amanda::Archive_var::
+class _wrap_Amanda::Archive_var : public CPerlObj {
+public:
+#else
+#define MAGIC_CLASS
+#endif
+SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *SWIGUNUSEDPARM(sv), MAGIC *SWIGUNUSEDPARM(mg)) {
+    MAGIC_PPERL
+    croak("Value is read-only.");
+    return 0;
+}
+
+
+#ifdef PERL_OBJECT
+};
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+XS(_wrap_amar_new) {
+  {
+    int arg1 ;
+    char *arg2 = (char *) 0 ;
+    amar_t *result = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: amar_new(fd,modestr);");
+    }
+    {
+      if (sizeof(signed int) == 1) {
+        arg1 = amglue_SvI8(ST(0));
+      } else if (sizeof(signed int) == 2) {
+        arg1 = amglue_SvI16(ST(0));
+      } else if (sizeof(signed int) == 4) {
+        arg1 = amglue_SvI32(ST(0));
+      } else if (sizeof(signed int) == 8) {
+        arg1 = amglue_SvI64(ST(0));
+      } else {
+        g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
+      }
+    }
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "amar_new" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = (char *)(buf2);
+    result = (amar_t *)amar_new_(arg1,arg2);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_amar_t, 0 | 0); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_amar_close) {
+  {
+    amar_t *arg1 = (amar_t *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: amar_close(arch);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_amar_t, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "amar_close" "', argument " "1"" of type '" "amar_t *""'"); 
+    }
+    arg1 = (amar_t *)(argp1);
+    amar_close_(arg1);
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_amar_new_file) {
+  {
+    amar_t *arg1 = (amar_t *) 0 ;
+    char *arg2 = (char *) 0 ;
+    gsize arg3 ;
+    off_t *arg4 = (off_t *) 0 ;
+    amar_file_t *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    size_t size2 = 0 ;
+    int alloc2 = 0 ;
+    off_t position4 ;
+    int argvi = 0;
+    SV * _saved[1] ;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: amar_new_file(arch,filename,filename_len,want_position);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_amar_t, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "amar_new_file" "', argument " "1"" of type '" "amar_t *""'"); 
+    }
+    arg1 = (amar_t *)(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, &size2, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "amar_new_file" "', argument " "2"" of type '" "char *""'");
+    }  
+    arg2 = (char *)(buf2);
+    arg3 = (gsize)(size2 - 1);
+    {
+      if (SvTRUE(ST(2))) {
+        position4 = 0;
+        arg4 = &position4;
+      } else {
+        arg4 = NULL;
+      }
+    }
+    _saved[0] = ST(2);
+    result = (amar_file_t *)amar_new_file_(arg1,arg2,arg3,arg4);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_amar_file_t, 0 | 0); argvi++ ;
+    {
+      if (arg4) {
+        ST(argvi) = amglue_newSVi64(*arg4);
+        argvi++;
+      }
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
+    
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_amar_file_close) {
+  {
+    amar_file_t *arg1 = (amar_file_t *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: amar_file_close(file);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_amar_file_t, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "amar_file_close" "', argument " "1"" of type '" "amar_file_t *""'"); 
+    }
+    arg1 = (amar_file_t *)(argp1);
+    amar_file_close_(arg1);
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_amar_new_attr) {
+  {
+    amar_file_t *arg1 = (amar_file_t *) 0 ;
+    guint16 arg2 ;
+    amar_attr_t *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: amar_new_attr(file,attrid);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_amar_file_t, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "amar_new_attr" "', argument " "1"" of type '" "amar_file_t *""'"); 
+    }
+    arg1 = (amar_file_t *)(argp1);
+    {
+      arg2 = amglue_SvU16(ST(1));
+    }
+    result = (amar_attr_t *)amar_new_attr_(arg1,arg2);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_amar_attr_t, 0 | 0); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_amar_attr_close) {
+  {
+    amar_attr_t *arg1 = (amar_attr_t *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: amar_attr_close(attr);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_amar_attr_t, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "amar_attr_close" "', argument " "1"" of type '" "amar_attr_t *""'"); 
+    }
+    arg1 = (amar_attr_t *)(argp1);
+    amar_attr_close_(arg1);
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_amar_attr_add_data_buffer) {
+  {
+    amar_attr_t *arg1 = (amar_attr_t *) 0 ;
+    char *arg2 = (char *) 0 ;
+    gsize arg3 ;
+    gboolean arg4 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    size_t size2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: amar_attr_add_data_buffer(attr,buffer,size,eoa);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_amar_attr_t, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "amar_attr_add_data_buffer" "', argument " "1"" of type '" "amar_attr_t *""'"); 
+    }
+    arg1 = (amar_attr_t *)(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, &size2, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "amar_attr_add_data_buffer" "', argument " "2"" of type '" "char *""'");
+    }  
+    arg2 = (char *)(buf2);
+    arg3 = (gsize)(size2 - 1);
+    {
+      if (sizeof(signed int) == 1) {
+        arg4 = amglue_SvI8(ST(2));
+      } else if (sizeof(signed int) == 2) {
+        arg4 = amglue_SvI16(ST(2));
+      } else if (sizeof(signed int) == 4) {
+        arg4 = amglue_SvI32(ST(2));
+      } else if (sizeof(signed int) == 8) {
+        arg4 = amglue_SvI64(ST(2));
+      } else {
+        g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
+      }
+    }
+    amar_attr_add_data_buffer_(arg1,arg2,arg3,arg4);
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
+    
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_amar_attr_add_data_fd) {
+  {
+    amar_attr_t *arg1 = (amar_attr_t *) 0 ;
+    int arg2 ;
+    gboolean arg3 ;
+    size_t result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: amar_attr_add_data_fd(attr,fd,eoa);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_amar_attr_t, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "amar_attr_add_data_fd" "', argument " "1"" of type '" "amar_attr_t *""'"); 
+    }
+    arg1 = (amar_attr_t *)(argp1);
+    {
+      if (sizeof(signed int) == 1) {
+        arg2 = amglue_SvI8(ST(1));
+      } else if (sizeof(signed int) == 2) {
+        arg2 = amglue_SvI16(ST(1));
+      } else if (sizeof(signed int) == 4) {
+        arg2 = amglue_SvI32(ST(1));
+      } else if (sizeof(signed int) == 8) {
+        arg2 = amglue_SvI64(ST(1));
+      } else {
+        g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
+      }
+    }
+    {
+      if (sizeof(signed int) == 1) {
+        arg3 = amglue_SvI8(ST(2));
+      } else if (sizeof(signed int) == 2) {
+        arg3 = amglue_SvI16(ST(2));
+      } else if (sizeof(signed int) == 4) {
+        arg3 = amglue_SvI32(ST(2));
+      } else if (sizeof(signed int) == 8) {
+        arg3 = amglue_SvI64(ST(2));
+      } else {
+        g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
+      }
+    }
+    result = amar_attr_add_data_fd_(arg1,arg2,arg3);
+    {
+      ST(argvi) = sv_2mortal(amglue_newSVu64(result));
+      argvi++;
+    }
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_amar_read) {
+  {
+    amar_t *arg1 = (amar_t *) 0 ;
+    SV *arg2 = (SV *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: amar_read(archive,params_hashref);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_amar_t, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "amar_read" "', argument " "1"" of type '" "amar_t *""'"); 
+    }
+    arg1 = (amar_t *)(argp1);
+    arg2 = ST(1);
+    amar_read_(arg1,arg2);
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
+
+static swig_type_info _swigt__p_amar_attr_t = {"_p_amar_attr_t", "amar_attr_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_amar_file_t = {"_p_amar_file_t", "amar_file_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_amar_t = {"_p_amar_t", "amar_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_char = {"_p_char", "gchar *|char *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_double = {"_p_double", "double *|gdouble *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_float = {"_p_float", "float *|gfloat *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_gsize = {"_p_gsize", "gsize *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_guint16 = {"_p_guint16", "guint16 *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_int = {"_p_int", "int *|gboolean *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_off_t = {"_p_off_t", "off_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "guchar *|unsigned char *", 0, 0, (void*)0, 0};
+
+static swig_type_info *swig_type_initial[] = {
+  &_swigt__p_amar_attr_t,
+  &_swigt__p_amar_file_t,
+  &_swigt__p_amar_t,
+  &_swigt__p_char,
+  &_swigt__p_double,
+  &_swigt__p_float,
+  &_swigt__p_gsize,
+  &_swigt__p_guint16,
+  &_swigt__p_int,
+  &_swigt__p_off_t,
+  &_swigt__p_unsigned_char,
+};
+
+static swig_cast_info _swigc__p_amar_attr_t[] = {  {&_swigt__p_amar_attr_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_amar_file_t[] = {  {&_swigt__p_amar_file_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_amar_t[] = {  {&_swigt__p_amar_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_double[] = {  {&_swigt__p_double, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_float[] = {  {&_swigt__p_float, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_gsize[] = {  {&_swigt__p_gsize, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_guint16[] = {  {&_swigt__p_guint16, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_int[] = {  {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_off_t[] = {  {&_swigt__p_off_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_unsigned_char[] = {  {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
+
+static swig_cast_info *swig_cast_initial[] = {
+  _swigc__p_amar_attr_t,
+  _swigc__p_amar_file_t,
+  _swigc__p_amar_t,
+  _swigc__p_char,
+  _swigc__p_double,
+  _swigc__p_float,
+  _swigc__p_gsize,
+  _swigc__p_guint16,
+  _swigc__p_int,
+  _swigc__p_off_t,
+  _swigc__p_unsigned_char,
+};
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
+
+static swig_constant_info swig_constants[] = {
+{0,0,0,0,0,0}
+};
+#ifdef __cplusplus
+}
+#endif
+static swig_variable_info swig_variables[] = {
+{0,0,0,0}
+};
+static swig_command_info swig_commands[] = {
+{"Amanda::Archivec::amar_new", _wrap_amar_new},
+{"Amanda::Archivec::amar_close", _wrap_amar_close},
+{"Amanda::Archivec::amar_new_file", _wrap_amar_new_file},
+{"Amanda::Archivec::amar_file_close", _wrap_amar_file_close},
+{"Amanda::Archivec::amar_new_attr", _wrap_amar_new_attr},
+{"Amanda::Archivec::amar_attr_close", _wrap_amar_attr_close},
+{"Amanda::Archivec::amar_attr_add_data_buffer", _wrap_amar_attr_add_data_buffer},
+{"Amanda::Archivec::amar_attr_add_data_fd", _wrap_amar_attr_add_data_fd},
+{"Amanda::Archivec::amar_read", _wrap_amar_read},
+{0,0}
+};
+/* -----------------------------------------------------------------------------
+ * Type initialization:
+ * This problem is tough by the requirement that no dynamic 
+ * memory is used. Also, since swig_type_info structures store pointers to 
+ * swig_cast_info structures and swig_cast_info structures store pointers back
+ * to swig_type_info structures, we need some lookup code at initialization. 
+ * The idea is that swig generates all the structures that are needed. 
+ * The runtime then collects these partially filled structures. 
+ * The SWIG_InitializeModule function takes these initial arrays out of 
+ * swig_module, and does all the lookup, filling in the swig_module.types
+ * array with the correct data and linking the correct swig_cast_info
+ * structures together.
+ *
+ * The generated swig_type_info structures are assigned staticly to an initial 
+ * array. We just loop through that array, and handle each type individually.
+ * First we lookup if this type has been already loaded, and if so, use the
+ * loaded structure instead of the generated one. Then we have to fill in the
+ * cast linked list. The cast data is initially stored in something like a
+ * two-dimensional array. Each row corresponds to a type (there are the same
+ * number of rows as there are in the swig_type_initial array). Each entry in
+ * a column is one of the swig_cast_info structures for that type.
+ * The cast_initial array is actually an array of arrays, because each row has
+ * a variable number of columns. So to actually build the cast linked list,
+ * we find the array of casts associated with the type, and loop through it 
+ * adding the casts to the list. The one last trick we need to do is making
+ * sure the type pointer in the swig_cast_info struct is correct.
+ *
+ * First off, we lookup the cast->type name to see if it is already loaded. 
+ * There are three cases to handle:
+ *  1) If the cast->type has already been loaded AND the type we are adding
+ *     casting info to has not been loaded (it is in this module), THEN we
+ *     replace the cast->type pointer with the type pointer that has already
+ *     been loaded.
+ *  2) If BOTH types (the one we are adding casting info to, and the 
+ *     cast->type) are loaded, THEN the cast info has already been loaded by
+ *     the previous module so we just ignore it.
+ *  3) Finally, if cast->type has not already been loaded, then we add that
+ *     swig_cast_info to the linked list (because the cast->type) pointer will
+ *     be correct.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#if 0
+} /* c-mode */
+#endif
+#endif
+
+#if 0
+#define SWIGRUNTIME_DEBUG
+#endif
+
+
+SWIGRUNTIME void
+SWIG_InitializeModule(void *clientdata) {
+  size_t i;
+  swig_module_info *module_head, *iter;
+  int found, init;
+  
+  clientdata = clientdata;
+  
+  /* check to see if the circular list has been setup, if not, set it up */
+  if (swig_module.next==0) {
+    /* Initialize the swig_module */
+    swig_module.type_initial = swig_type_initial;
+    swig_module.cast_initial = swig_cast_initial;
+    swig_module.next = &swig_module;
+    init = 1;
+  } else {
+    init = 0;
+  }
+  
+  /* Try and load any already created modules */
+  module_head = SWIG_GetModule(clientdata);
+  if (!module_head) {
+    /* This is the first module loaded for this interpreter */
+    /* so set the swig module into the interpreter */
+    SWIG_SetModule(clientdata, &swig_module);
+    module_head = &swig_module;
+  } else {
+    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
+    found=0;
+    iter=module_head;
+    do {
+      if (iter==&swig_module) {
+        found=1;
+        break;
+      }
+      iter=iter->next;
+    } while (iter!= module_head);
+    
+    /* if the is found in the list, then all is done and we may leave */
+    if (found) return;
+    /* otherwise we must add out module into the list */
+    swig_module.next = module_head->next;
+    module_head->next = &swig_module;
+  }
+  
+  /* When multiple interpeters are used, a module could have already been initialized in
+       a different interpreter, but not yet have a pointer in this interpreter.
+       In this case, we do not want to continue adding types... everything should be
+       set up already */
+  if (init == 0) return;
+  
+  /* Now work on filling in swig_module.types */
+#ifdef SWIGRUNTIME_DEBUG
+  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
+#endif
+  for (i = 0; i < swig_module.size; ++i) {
+    swig_type_info *type = 0;
+    swig_type_info *ret;
+    swig_cast_info *cast;
+    
+#ifdef SWIGRUNTIME_DEBUG
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+#endif
+    
+    /* if there is another module already loaded */
+    if (swig_module.next != &swig_module) {
+      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
+    }
+    if (type) {
+      /* Overwrite clientdata field */
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: found type %s\n", type->name);
+#endif
+      if (swig_module.type_initial[i]->clientdata) {
+        type->clientdata = swig_module.type_initial[i]->clientdata;
+#ifdef SWIGRUNTIME_DEBUG
+        printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
+#endif
+      }
+    } else {
+      type = swig_module.type_initial[i];
+    }
+    
+    /* Insert casting types */
+    cast = swig_module.cast_initial[i];
+    while (cast->type) {
+      /* Don't need to add information already in the list */
+      ret = 0;
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
+#endif
+      if (swig_module.next != &swig_module) {
+        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
+#ifdef SWIGRUNTIME_DEBUG
+        if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
+#endif
+      }
+      if (ret) {
+        if (type == swig_module.type_initial[i]) {
+#ifdef SWIGRUNTIME_DEBUG
+          printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
+#endif
+          cast->type = ret;
+          ret = 0;
+        } else {
+          /* Check for casting already in the list */
+          swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
+#ifdef SWIGRUNTIME_DEBUG
+          if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
+#endif
+          if (!ocast) ret = 0;
+        }
+      }
+      
+      if (!ret) {
+#ifdef SWIGRUNTIME_DEBUG
+        printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
+#endif
+        if (type->cast) {
+          type->cast->prev = cast;
+          cast->next = type->cast;
+        }
+        type->cast = cast;
+      }
+      cast++;
+    }
+    /* Set entry in modules->types array equal to the type */
+    swig_module.types[i] = type;
+  }
+  swig_module.types[i] = 0;
+  
+#ifdef SWIGRUNTIME_DEBUG
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+  for (i = 0; i < swig_module.size; ++i) {
+    int j = 0;
+    swig_cast_info *cast = swig_module.cast_initial[i];
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+    while (cast->type) {
+      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
+      cast++;
+      ++j;
+    }
+    printf("---- Total casts: %d\n",j);
+  }
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+#endif
+}
+
+/* This function will propagate the clientdata field of type to
+* any new swig_type_info structures that have been added into the list
+* of equivalent types.  It is like calling
+* SWIG_TypeClientData(type, clientdata) a second time.
+*/
+SWIGRUNTIME void
+SWIG_PropagateClientData(void) {
+  size_t i;
+  swig_cast_info *equiv;
+  static int init_run = 0;
+  
+  if (init_run) return;
+  init_run = 1;
+  
+  for (i = 0; i < swig_module.size; i++) {
+    if (swig_module.types[i]->clientdata) {
+      equiv = swig_module.types[i]->cast;
+      while (equiv) {
+        if (!equiv->converter) {
+          if (equiv->type && !equiv->type->clientdata)
+          SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
+        }
+        equiv = equiv->next;
+      }
+    }
+  }
+}
+
+#ifdef __cplusplus
+#if 0
+{
+  /* c-mode */
+#endif
+}
+#endif
+
+
+
+#ifdef __cplusplus
+extern "C"
+#endif
+
+XS(SWIG_init) {
+  dXSARGS;
+  int i;
+  
+  SWIG_InitializeModule(0);
+  
+  /* Install commands */
+  for (i = 0; swig_commands[i].name; i++) {
+    newXS((char*) swig_commands[i].name,swig_commands[i].wrapper, (char*)__FILE__);
+  }
+  
+  /* Install variables */
+  for (i = 0; swig_variables[i].name; i++) {
+    SV *sv;
+    sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI);
+    if (swig_variables[i].type) {
+      SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0);
+    } else {
+      sv_setiv(sv,(IV) 0);
+    }
+    swig_create_magic(sv, (char *) swig_variables[i].name, swig_variables[i].set, swig_variables[i].get); 
+  }
+  
+  /* Install constant */
+  for (i = 0; swig_constants[i].type; i++) {
+    SV *sv;
+    sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI);
+    switch(swig_constants[i].type) {
+    case SWIG_INT:
+      sv_setiv(sv, (IV) swig_constants[i].lvalue);
+      break;
+    case SWIG_FLOAT:
+      sv_setnv(sv, (double) swig_constants[i].dvalue);
+      break;
+    case SWIG_STRING:
+      sv_setpv(sv, (char *) swig_constants[i].pvalue);
+      break;
+    case SWIG_POINTER:
+      SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype),0);
+      break;
+    case SWIG_BINARY:
+      SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype));
+      break;
+    default:
+      break;
+    }
+    SvREADONLY_on(sv);
+  }
+  
+  ST(0) = &PL_sv_yes;
+  XSRETURN(1);
+}
+
diff --git a/perl/Amanda/Archive.pm b/perl/Amanda/Archive.pm
new file mode 100644 (file)
index 0000000..b06dfc4
--- /dev/null
@@ -0,0 +1,380 @@
+# This file was automatically generated by SWIG (http://www.swig.org).
+# Version 1.3.35
+#
+# Don't modify this file, modify the SWIG interface instead.
+
+package Amanda::Archive;
+require Exporter;
+require DynaLoader;
+@ISA = qw(Exporter DynaLoader);
+package Amanda::Archivec;
+bootstrap Amanda::Archive;
+package Amanda::Archive;
+@EXPORT = qw( );
+
+# ---------- BASE METHODS -------------
+
+package Amanda::Archive;
+
+sub TIEHASH {
+    my ($classname,$obj) = @_;
+    return bless $obj, $classname;
+}
+
+sub CLEAR { }
+
+sub FIRSTKEY { }
+
+sub NEXTKEY { }
+
+sub FETCH {
+    my ($self,$field) = @_;
+    my $member_func = "swig_${field}_get";
+    $self->$member_func();
+}
+
+sub STORE {
+    my ($self,$field,$newval) = @_;
+    my $member_func = "swig_${field}_set";
+    $self->$member_func($newval);
+}
+
+sub this {
+    my $ptr = shift;
+    return tied(%$ptr);
+}
+
+
+# ------- FUNCTION WRAPPERS --------
+
+package Amanda::Archive;
+
+*amar_new = *Amanda::Archivec::amar_new;
+*amar_close = *Amanda::Archivec::amar_close;
+*amar_new_file = *Amanda::Archivec::amar_new_file;
+*amar_file_close = *Amanda::Archivec::amar_file_close;
+*amar_new_attr = *Amanda::Archivec::amar_new_attr;
+*amar_attr_close = *Amanda::Archivec::amar_attr_close;
+*amar_attr_add_data_buffer = *Amanda::Archivec::amar_attr_add_data_buffer;
+*amar_attr_add_data_fd = *Amanda::Archivec::amar_attr_add_data_fd;
+*amar_read = *Amanda::Archivec::amar_read;
+
+# ------- VARIABLE STUBS --------
+
+package Amanda::Archive;
+
+
+@EXPORT_OK = ();
+%EXPORT_TAGS = ();
+
+=head1 NAME
+
+Amanda::Archive - Perl access to the  amanda archive library
+
+=head1 SYNOPSIS
+
+  use Amanda::Archive
+
+  # Write to the file descriptor $fd, and add /etc/hosts to it
+  my $archive = Amanda::Archive->new($fd, ">");
+  my $file = $archive->new_file("/etc/hosts");
+  my $attr = $file->new_attr(16);
+  open(my $fh, "<", "/etc/hosts");
+  $attr->add_data_fd(fileno($fh), 1);
+  $file->close();
+  $archive->close();
+
+  # Read from an archive
+  my $archive = Amanda::Archive->new($fd, "<");
+  $ar->read(
+      file_start => sub {
+         my ($user_data, $filenum, $filename) = @_;
+         # ...
+         return "foo"; # this becomes $file_data
+      },
+      file_finish => sub {
+         my ($user_data, $file_data, $filenum, $truncated) = @_;
+         # ...
+      },
+      21 => [ 32768,   # buffer into 32k chunks
+             sub {
+                 my ($user_data, $filenum, $file_data, $attrid,
+                     $attr_data, $data, $eoa, $truncated) = @_;
+                 return "pants"; # becomes the new $attr_data for
+                                 # any subsequent fragments
+             } ],
+      0 => sub {       # note no buffering here; attrid 0 is "default"
+         my ($user_data, $filenum, $file_data, $attrid,
+             $attr_data, $data, $eoa, $truncated) = @_;
+         return "shorts"; # becomes the new $attr_data for
+                          # any subsequent fragments
+      },
+      user_data => [ "mydata" ], # sent to all callbacks
+  );
+
+=head1 WRITING
+
+=head2 Amanda::Archive::Archive Objects
+
+Note that C<Amanda::Archive->new> and C<Amanda::Archive::Archive->new> are
+equivalent.
+
+=over
+
+=item C<new($fd, $mode)>
+
+Create a new archive for reading ("<") or writing (">") from or to file
+descriptor C<$fd>.
+
+=item C<new_file($filename, $want_posn)>
+
+Create a new C<Amanda::Archive::File> object with the given filename (writing
+only).  Equivalent to
+
+  Amanda::Archive::File->new($archive, $filename, $want_posn);
+
+if C<$want_posn> is false, then this method returns a new
+C<Amanda::Archive::File> object.  If C<$want_posn> is true, then it returns
+C<($file, $posn)> where C<$file> is the object and C<$posn> is the offset into
+the datastream at which this file begins.  This offset can be stored in an
+index and used later to seek into the file.
+
+=item C<read(..)>
+
+See I<READING>, below.
+
+=item C<close()>
+
+Flush all buffers and close this archive. This does not close the file descriptor.
+
+=back
+
+=head2 Amanda::Archive::File Objects
+
+=over
+
+=item C<new($archive, $filename, $want_posn)>
+
+Create a new file in the given archive.  See C<Amanda::Archive::Archive::new_file>, above.
+
+=item C<new_attr($attrid)>
+
+Create a new C<Amanda::Archive::Attribute> object.  Equivalent to
+
+  Amanda::Archive::Attr->new($file, $attrid);
+
+=item C<close()>
+
+Close this file, writing an EOF record.
+
+=back
+
+=head2 Amanda::Archive::Attribute Objects
+
+=over
+
+=item C<add_data($data, $eoa)>
+
+Add C<$data> to this attribute, adding an EOA (end-of-attribute) bit if C<$eoa> is true.
+
+=item C<add_data_fd($fd, $eoa)>
+
+Copy data from C<$fd> to this attribute, adding an EOA (end-of-attribute) bit if C<$eoa> is true.
+
+=item C<close()>
+
+Close this attribute, adding an EOA bit if none has been written already.
+
+=back
+
+=head1 READING
+
+The C<Amanda::Archive::Archive> method C<read()> handles reading archives via a callback mechanism.  It takes its arguments in hash form, with the following keys:
+
+    file_start => sub {
+       my ($user_data, $filenum, $filename) = @_;
+       # ..
+    },
+
+C<file_start> gives a sub which is called for every file in the archive.  It
+can return an arbitrary value which will become the C<$file_data> for
+subsequent callbacks in this file, or the string "IGNORE" which will cause the
+reader to ignore all data for this file.  In this case, no other callbacks will
+be made for the file (not even C<file_finish>).
+
+    file_finish => sub {
+       my ($user_data, $file_data, $filenum, $truncated) = @_;
+       # ..
+    },
+
+C<file_finish> gives a sub which is called when an EOF record appears.
+C<$file_data> comes from the return value of the C<file_start> callback.
+C<$truncated> is true if the file may be missing data (e.g., when an early EOF
+is detected).
+
+    user_data => $my_object,
+
+C<user_data> gives an arbitrary value which is passed to each callback as C<$user_data>.
+
+    13 => sub {
+       my ($user_data, $filenum, $file_data, $attrid,
+           $attr_data, $data, $eoa, $truncated) = @_;
+       # ...
+    },
+    19 => [ 10240, sub { ... } ],
+
+Any numeric key is treated as an attribute ID, and specifies the handling for
+that attribute.  Attribute ID zero is treated as a wildcard, and will match any
+attribute without an explicit handler.  The handler can be specified as a sub
+(as for attribute ID 13 in the example above) or as an arrayref C<[$minsize,
+$sub]>.  In the latter case, the sub is only called when at least C<$minsize>
+bytes of data are available for the attribute, or at the end of the attribute
+data.
+
+The parameters to the callback include C<$file_data>, the value returned from
+C<file_start>, and C<$attr_data>, which is the return value of the last
+invocation of this sub for this attribute.  If this is the last fragment of
+data for this attribute, then C<$eoa> is true.  The meaning of C<$truncated>
+is similar to that in C<file_finish>.
+
+=head2 EXAMPLE
+
+    sub read_to_files {
+       my ($arch_fh, $basedir) = @_;
+
+       my $arch = Amanda::Archive->new(fileno($arch_fh), "<");
+       $arch->read(
+           file_start => sub {
+               my ($user_data, $filenum, $filename) = @_;
+               return "$basedir/$filenum"; # becomes $file_data
+           },
+           0 => [ 32768, sub {
+               my ($user_data, $filenum, $file_data, $attrid,
+                   $attr_data, $data, $eoa, $truncated) = @_;
+               warn("file $filename attribute $attrid is truncated")
+                   if ($truncated);
+               # store the open filehandle in $attr_data
+               if (!$attr_data) {
+                   open($attr_data, "$file_data.$attrid", ">")
+                       or die("open: $!");
+               }
+               print $attr_data $data;
+               if ($eoa) {
+                   close($attr_data);
+               }
+               return $attr_data;
+           },
+       );
+    }
+
+=cut
+
+package Amanda::Archive;
+
+# Expose the Archive constructor at Amanda::Archive->new
+sub new {
+    my $pkg = shift;
+    Amanda::Archive::Archive->new(@_);
+}
+
+package Amanda::Archive::Archive;
+
+sub new {
+    my ($class, $fd, $mode) = @_;
+    my $arch = Amanda::Archive::amar_new($fd, $mode);
+    return bless (\$arch, $class);
+}
+
+sub close {
+    my $self = shift;
+    if ($$self) {
+       Amanda::Archive::amar_close($$self);
+       $$self = undef;
+    }
+}
+
+sub DESTROY {
+    my $self = shift;
+    $self->close();
+}
+
+sub new_file {
+    my ($self, $filename, $want_offset) = @_;
+    return Amanda::Archive::File->new($self, $filename, $want_offset);
+}
+
+sub Amanda::Archive::Archive::read {
+    my $self = shift;
+    die "Archive is not open" unless ($$self);
+    # pass a hashref to the C code
+    my %h = @_;
+    Amanda::Archive::amar_read($$self, \%h);
+}
+
+package Amanda::Archive::File;
+
+sub new {
+    my ($class, $arch, $filename, $want_offset) = @_;
+    die "Archive is not open" unless ($$arch);
+    if ($want_offset) {
+       # note that posn is returned first by the SWIG wrapper
+       my ($file, $posn) = Amanda::Archive::amar_new_file($$arch, $filename, $want_offset);
+       return (bless([ $file, $arch ], $class), $posn);
+    } else {
+       my $file = Amanda::Archive::amar_new_file($$arch, $filename, $want_offset);
+       return bless([ $file, $arch ], $class);
+    }
+}
+
+sub close {
+    my $self = shift;
+    if ($self->[0]) {
+       Amanda::Archive::amar_file_close($self->[0]);
+       $self->[0] = undef;
+    }
+}
+
+sub DESTROY {
+    my $self = shift;
+    $self->close();
+}
+
+sub new_attr {
+    my ($self, $attrid) = @_;
+    return Amanda::Archive::Attr->new($self, $attrid);
+}
+
+package Amanda::Archive::Attr;
+
+sub new {
+    my ($class, $file, $attrid) = @_;
+    die "File is not open" unless ($file->[0]);
+    my $attr = Amanda::Archive::amar_new_attr($file->[0], $attrid);
+    return bless ([$attr, $file], $class);
+}
+
+sub close {
+    my $self = shift;
+    if ($self->[0]) {
+       Amanda::Archive::amar_attr_close($self->[0]);
+       $self->[0] = undef;
+    }
+}
+
+sub DESTROY {
+    my $self = shift;
+    $self->close();
+}
+
+sub add_data {
+    my ($self, $data, $eoa) = @_;
+    die "Attr is not open" unless ($self->[0]);
+    Amanda::Archive::amar_attr_add_data_buffer($self->[0], $data, $eoa);
+}
+
+sub add_data_fd {
+    my ($self, $fd, $eoa) = @_;
+    die "Attr is not open" unless ($self->[0]);
+    return Amanda::Archive::amar_attr_add_data_fd($self->[0], $fd, $eoa);
+}
+1;
diff --git a/perl/Amanda/Archive.swg b/perl/Amanda/Archive.swg
new file mode 100644 (file)
index 0000000..22626c5
--- /dev/null
@@ -0,0 +1,814 @@
+/*
+ * Copyright (c) Zmanda, Inc.  All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ *
+ * This 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 this library; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+ *
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+ */
+
+%module "Amanda::Archive"
+%include "amglue/amglue.swg"
+%include "exception.i"
+%include "cstring.i"
+
+%{
+#include "amar.h"
+%}
+
+%perlcode %{
+=head1 NAME
+
+Amanda::Archive - Perl access to the  amanda archive library
+
+=head1 SYNOPSIS
+
+  use Amanda::Archive
+
+  # Write to the file descriptor $fd, and add /etc/hosts to it
+  my $archive = Amanda::Archive->new($fd, ">");
+  my $file = $archive->new_file("/etc/hosts");
+  my $attr = $file->new_attr(16);
+  open(my $fh, "<", "/etc/hosts");
+  $attr->add_data_fd(fileno($fh), 1);
+  $file->close();
+  $archive->close();
+
+  # Read from an archive
+  my $archive = Amanda::Archive->new($fd, "<");
+  $ar->read(
+      file_start => sub {
+         my ($user_data, $filenum, $filename) = @_;
+         # ...
+         return "foo"; # this becomes $file_data
+      },
+      file_finish => sub {
+         my ($user_data, $file_data, $filenum, $truncated) = @_;
+         # ...
+      },
+      21 => [ 32768,   # buffer into 32k chunks
+             sub {
+                 my ($user_data, $filenum, $file_data, $attrid,
+                     $attr_data, $data, $eoa, $truncated) = @_;
+                 return "pants"; # becomes the new $attr_data for
+                                 # any subsequent fragments
+             } ],
+      0 => sub {       # note no buffering here; attrid 0 is "default"
+         my ($user_data, $filenum, $file_data, $attrid,
+             $attr_data, $data, $eoa, $truncated) = @_;
+         return "shorts"; # becomes the new $attr_data for
+                          # any subsequent fragments
+      },
+      user_data => [ "mydata" ], # sent to all callbacks
+  );
+
+=head1 WRITING
+
+=head2 Amanda::Archive::Archive Objects
+
+Note that C<Amanda::Archive->new> and C<Amanda::Archive::Archive->new> are
+equivalent.
+
+=over
+
+=item C<new($fd, $mode)>
+
+Create a new archive for reading ("<") or writing (">") from or to file
+descriptor C<$fd>.
+
+=item C<new_file($filename, $want_posn)>
+
+Create a new C<Amanda::Archive::File> object with the given filename (writing
+only).  Equivalent to
+
+  Amanda::Archive::File->new($archive, $filename, $want_posn);
+
+if C<$want_posn> is false, then this method returns a new
+C<Amanda::Archive::File> object.  If C<$want_posn> is true, then it returns
+C<($file, $posn)> where C<$file> is the object and C<$posn> is the offset into
+the datastream at which this file begins.  This offset can be stored in an
+index and used later to seek into the file.
+
+=item C<read(..)>
+
+See I<READING>, below.
+
+=item C<close()>
+
+Flush all buffers and close this archive. This does not close the file descriptor.
+
+=back
+
+=head2 Amanda::Archive::File Objects
+
+=over
+
+=item C<new($archive, $filename, $want_posn)>
+
+Create a new file in the given archive.  See C<Amanda::Archive::Archive::new_file>, above.
+
+=item C<new_attr($attrid)>
+
+Create a new C<Amanda::Archive::Attribute> object.  Equivalent to
+
+  Amanda::Archive::Attr->new($file, $attrid);
+
+=item C<close()>
+
+Close this file, writing an EOF record.
+
+=back
+
+=head2 Amanda::Archive::Attribute Objects
+
+=over
+
+=item C<add_data($data, $eoa)>
+
+Add C<$data> to this attribute, adding an EOA (end-of-attribute) bit if C<$eoa> is true.
+
+=item C<add_data_fd($fd, $eoa)>
+
+Copy data from C<$fd> to this attribute, adding an EOA (end-of-attribute) bit if C<$eoa> is true.
+
+=item C<close()>
+
+Close this attribute, adding an EOA bit if none has been written already.
+
+=back
+
+=head1 READING
+
+The C<Amanda::Archive::Archive> method C<read()> handles reading archives via a callback mechanism.  It takes its arguments in hash form, with the following keys:
+
+    file_start => sub {
+       my ($user_data, $filenum, $filename) = @_;
+       # ..
+    },
+
+C<file_start> gives a sub which is called for every file in the archive.  It
+can return an arbitrary value which will become the C<$file_data> for
+subsequent callbacks in this file, or the string "IGNORE" which will cause the
+reader to ignore all data for this file.  In this case, no other callbacks will
+be made for the file (not even C<file_finish>).
+
+    file_finish => sub {
+       my ($user_data, $file_data, $filenum, $truncated) = @_;
+       # ..
+    },
+
+C<file_finish> gives a sub which is called when an EOF record appears.
+C<$file_data> comes from the return value of the C<file_start> callback.
+C<$truncated> is true if the file may be missing data (e.g., when an early EOF
+is detected).
+
+    user_data => $my_object,
+
+C<user_data> gives an arbitrary value which is passed to each callback as C<$user_data>.
+
+    13 => sub {
+       my ($user_data, $filenum, $file_data, $attrid,
+           $attr_data, $data, $eoa, $truncated) = @_;
+       # ...
+    },
+    19 => [ 10240, sub { ... } ],
+
+Any numeric key is treated as an attribute ID, and specifies the handling for
+that attribute.  Attribute ID zero is treated as a wildcard, and will match any
+attribute without an explicit handler.  The handler can be specified as a sub
+(as for attribute ID 13 in the example above) or as an arrayref C<[$minsize,
+$sub]>.  In the latter case, the sub is only called when at least C<$minsize>
+bytes of data are available for the attribute, or at the end of the attribute
+data.
+
+The parameters to the callback include C<$file_data>, the value returned from
+C<file_start>, and C<$attr_data>, which is the return value of the last
+invocation of this sub for this attribute.  If this is the last fragment of
+data for this attribute, then C<$eoa> is true.  The meaning of C<$truncated>
+is similar to that in C<file_finish>.
+
+=head2 EXAMPLE
+
+    sub read_to_files {
+       my ($arch_fh, $basedir) = @_;
+
+       my $arch = Amanda::Archive->new(fileno($arch_fh), "<");
+       $arch->read(
+           file_start => sub {
+               my ($user_data, $filenum, $filename) = @_;
+               return "$basedir/$filenum"; # becomes $file_data
+           },
+           0 => [ 32768, sub {
+               my ($user_data, $filenum, $file_data, $attrid,
+                   $attr_data, $data, $eoa, $truncated) = @_;
+               warn("file $filename attribute $attrid is truncated")
+                   if ($truncated);
+               # store the open filehandle in $attr_data
+               if (!$attr_data) {
+                   open($attr_data, "$file_data.$attrid", ">")
+                       or die("open: $!");
+               }
+               print $attr_data $data;
+               if ($eoa) {
+                   close($attr_data);
+               }
+               return $attr_data;
+           },
+       );
+    }
+
+=cut
+%}
+
+%{
+/* Support code (not directly available from perl) */
+
+/* A C object to contain all of the relevant callbacks and other state during a
+ * read operation; this becomes the user_data during the read */
+typedef struct perl_read_data_s {
+    SV *user_data;
+    SV *file_start_sub;
+    SV *file_finish_sub;
+
+    amar_attr_handling_t *handling_array;
+} perl_read_data_t;
+
+static gboolean
+read_start_file_cb(
+       gpointer user_data,
+       uint16_t filenum,
+       gpointer filename,
+       gsize filename_len,
+       gboolean *ignore,
+       gpointer *file_data)
+{
+    dSP;
+    perl_read_data_t *dat = user_data;
+    SV *rv = NULL;
+    STRLEN len;
+    int count;
+
+    *file_data = NULL;
+
+    g_assert(dat->file_start_sub != NULL);
+
+    ENTER;
+    SAVETMPS;
+
+    PUSHMARK(SP);
+    XPUSHs(dat->user_data);
+    XPUSHs(sv_2mortal(newSViv(filenum)));
+    XPUSHs(sv_2mortal(newSVpvn(filename, filename_len)));
+    PUTBACK;
+
+    count = call_sv(dat->file_start_sub, G_EVAL|G_SCALAR);
+
+    SPAGAIN;
+
+    if (count != 1)
+       croak("file_start_sub returned nothing");
+
+    rv = POPs;
+
+    /* if it's the string "IGNORE", then ignore it */
+    if (SvPOK(rv)) {
+       static const char *ign = "IGNORE";
+       char *rvstr = SvPV(rv, len);
+       if (strlen(ign) == len && 0 == strncmp(ign, rvstr, len))
+           *ignore = TRUE;
+    }
+
+    /* otherwise, keep the value */
+    if (!*ignore)
+       *(SV **)(file_data) = SvREFCNT_inc(rv);
+
+    PUTBACK;
+    FREETMPS;
+    LEAVE;
+
+    if (SvTRUE(ERRSV))
+       return FALSE;
+    return TRUE;
+}
+
+static gboolean
+read_finish_file_cb(
+       gpointer user_data,
+       uint16_t filenum,
+       gpointer *file_data,
+       gboolean truncated)
+{
+    dSP;
+    perl_read_data_t *dat = user_data;
+
+    g_assert(dat->file_finish_sub != NULL);
+
+    ENTER;
+    SAVETMPS;
+
+    PUSHMARK(SP); XPUSHs(dat->user_data); XPUSHs(*(SV **)file_data);
+    XPUSHs(sv_2mortal(newSViv(filenum)));
+    XPUSHs(sv_2mortal(newSViv(truncated))); PUTBACK;
+
+    call_sv(dat->file_finish_sub, G_EVAL|G_DISCARD);
+
+    /* we're done with this file's file_data */
+    SvREFCNT_dec(*(SV **)file_data);
+
+    FREETMPS;
+    LEAVE;
+
+    if (SvTRUE(ERRSV))
+       return FALSE;
+    return TRUE;
+}
+
+static gboolean
+read_frag_cb(
+       gpointer user_data,
+       uint16_t filenum,
+       gpointer file_data,
+       uint16_t attrid,
+       gpointer attrid_data,
+       gpointer *attr_data,
+       gpointer data,
+       gsize size,
+       gboolean eoa,
+       gboolean truncated)
+{
+    dSP;
+    perl_read_data_t *dat = user_data;
+    SV *rv;
+    int count;
+
+    if (!attrid_data)
+       return TRUE;
+
+    ENTER;
+    SAVETMPS;
+
+    PUSHMARK(SP);
+    XPUSHs(dat->user_data);
+    XPUSHs(sv_2mortal(newSViv(filenum)));
+    XPUSHs((SV *)file_data);
+    XPUSHs(sv_2mortal(newSViv(attrid)));
+    if (*attr_data)
+        XPUSHs((SV *)(*attr_data));
+    else
+        XPUSHs(&PL_sv_undef);
+    XPUSHs(sv_2mortal(newSVpvn(data, size)));
+    XPUSHs(sv_2mortal(newSViv(eoa)));
+    XPUSHs(sv_2mortal(newSViv(truncated)));
+    PUTBACK;
+
+    count = call_sv(attrid_data, G_EVAL|G_SCALAR);
+
+    SPAGAIN;
+
+    if (count != 1)
+       croak("fragment callback returned nothing");
+
+    rv = POPs;
+
+    if (eoa) {
+        SvREFCNT_dec(*attr_data);
+    } else {
+        /* increment before decrement here, in case they're the same object */
+        SvREFCNT_inc(rv);
+        SvREFCNT_dec(*attr_data);
+        *attr_data = rv;
+    }
+
+    FREETMPS;
+    LEAVE;
+
+    if (SvTRUE(ERRSV))
+       return FALSE;
+    return TRUE;
+}
+
+static void
+croak_gerror(GError **error)
+{
+    static char *errstr = NULL;
+    if (errstr) g_free(errstr);
+    errstr = g_strdup((*error)->message);
+    g_clear_error(error);
+    croak("Amanda archive: %s", errstr);
+}
+
+/* generic function to recognize when a string+len represents a number and
+ * incidentally return the resulting value.  Note that this does not handle
+ * negative numbers. */
+static gboolean
+is_number(char *str, int len, int *result)
+{
+    char *end = str+len;
+    int r = 0;
+
+    while (str < end) {
+       if (!g_ascii_isdigit(*str)) return FALSE;
+       r = r * 10 + (int)(*str - '0');
+       if (r < 0) {
+           /* overflow */
+           return FALSE;
+       }
+       str++;
+    }
+
+    *result = r;
+    return TRUE;
+}
+
+%}
+
+/* Rename all of the below wrapper functions (suffixed with '_') for
+ * consumption by perl */
+%rename(amar_new) amar_new_;
+%rename(amar_close) amar_close_;
+%rename(amar_new_file) amar_new_file_;
+%rename(amar_file_close) amar_file_close_;
+%rename(amar_new_attr) amar_new_attr_;
+%rename(amar_attr_close) amar_attr_close_;
+%rename(amar_attr_add_data_buffer) amar_attr_add_data_buffer_;
+%rename(amar_attr_add_data_fd) amar_attr_add_data_fd_;
+%rename(amar_read) amar_read_;
+
+/* typemaps for the below */
+%apply (char *STRING, int LENGTH) { (char *filename, gsize filename_len) };
+%apply (char *STRING, int LENGTH) { (char *buffer, gsize size) };
+%typemap(in) SV * "$1 = $input;"
+
+%typemap(in) off_t *want_position (off_t position) {
+    if (SvTRUE($input)) {
+       position = 0;
+       $1 = &position;
+    } else {
+       $1 = NULL;
+    }
+}
+%typemap(argout) off_t *want_position {
+    if ($1) {
+       $result = amglue_newSVi64(*$1);
+       argvi++;
+    }
+}
+
+%inline %{
+
+/* Wrapper functions, mostly dealing with error handling */
+
+amar_t *amar_new_(int fd, char *modestr) {
+    GError *error = NULL;
+    amar_t *rv;
+    int mode;
+
+    if (strcmp(modestr, ">") == 0)
+       mode = O_WRONLY;
+    else if (strcmp(modestr, "<") == 0)
+       mode = O_RDONLY;
+    else
+       croak("mode must be '<' or '>'");
+
+    if ((rv = amar_new(fd, mode, &error))) {
+       return rv;
+    }
+
+    croak_gerror(&error);
+    return NULL;
+}
+
+void amar_close_(amar_t *arch) {
+    GError *error = NULL;
+    if (!amar_close(arch, &error))
+       croak_gerror(&error);
+}
+
+amar_file_t *
+amar_new_file_(amar_t *arch, char *filename, gsize filename_len, off_t *want_position) {
+    GError *error = NULL;
+    amar_file_t *file;
+    g_assert(arch != NULL);
+
+    file = amar_new_file(arch, filename, filename_len, want_position, &error);
+    if (file)
+       return file;
+
+    croak_gerror(&error);
+    return NULL;
+}
+
+void amar_file_close_(amar_file_t *file) {
+    GError *error = NULL;
+    if (!amar_file_close(file, &error))
+       croak_gerror(&error);
+}
+
+amar_attr_t *
+amar_new_attr_(amar_file_t *file, guint16 attrid) {
+    GError *error = NULL;
+    amar_attr_t *attr;
+
+    g_assert(file != NULL);
+
+    attr = amar_new_attr(file, attrid, &error);
+    if (attr)
+       return attr;
+
+    croak_gerror(&error);
+    return NULL;
+}
+
+void amar_attr_close_(amar_attr_t *attr) {
+    GError *error = NULL;
+    if (!amar_attr_close(attr, &error))
+       croak_gerror(&error);
+}
+
+void amar_attr_add_data_buffer_(amar_attr_t *attr, char *buffer, gsize size, gboolean eoa) {
+    GError *error = NULL;
+    if (!amar_attr_add_data_buffer(attr, buffer, size, eoa, &error))
+       croak_gerror(&error);
+}
+
+size_t
+amar_attr_add_data_fd_(amar_attr_t *attr, int fd, gboolean eoa) {
+    GError *error = NULL;
+    size_t rv = amar_attr_add_data_fd(attr, fd, eoa, &error);
+    if (rv < 0)
+       croak_gerror(&error);
+    return rv;
+}
+
+/* reading */
+
+void amar_read_(amar_t *archive, SV *params_hashref) {
+    perl_read_data_t *dat = g_new0(perl_read_data_t, 1);
+    GError *error = NULL;
+    gboolean success;
+    HV *params;
+    HE *param;
+    I32 len;
+    int maxhandlers;
+    int hdl_idx;
+
+    /* make sure we got a hashref */
+    if (!SvROK(params_hashref) || SvTYPE(SvRV(params_hashref)) != SVt_PVHV)
+       croak("read() expects a single hashref");
+    params = (HV *)SvRV(params_hashref);
+    len = hv_iterinit(params);
+
+    maxhandlers = hdl_idx = len;
+    dat->handling_array = g_new0(amar_attr_handling_t, len+1);
+
+    /* loop through the parameters */
+    while ((param = hv_iternext(params))) {
+       I32 keylen;
+       char *key = hv_iterkey(param, &keylen);
+       int attrid;
+
+       /* if it's a number, it's handling information for an attrid */
+       if (is_number(key, keylen, &attrid)) {
+           SV *val = hv_iterval(params, param);
+           SV *coderef;
+           UV bufsize = 0;
+           int i;
+
+           if (!SvROK(val)) goto croak_hdl;
+
+           switch (SvTYPE(SvRV(val))) {
+               case SVt_PVCV:
+                   coderef = val;
+                   break;
+
+               case SVt_PVAV: {
+                   AV *arr = (AV *)SvRV(val);
+                   SV **svp;
+
+                   if (av_len(arr) != 1) /* av_len == largest index, not length */
+                       goto croak_hdl;
+
+                   /* get the bufsize */
+                   svp = av_fetch(arr, 0, 0);
+                   if (!SvIOK(*svp))
+                       goto croak_hdl;
+                   bufsize = SvUV(*svp);
+
+                   /* and the coderef */
+                   svp = av_fetch(arr, 1, 0);
+                   if (!SvROK(*svp) || SvTYPE(SvRV(*svp)) != SVt_PVCV)
+                       goto croak_hdl;
+                   coderef = *svp;
+                   break;
+               }
+
+               default:
+                   goto croak_hdl;
+           }
+
+           /* fill in the handling array, putting attrid 0 at the end, and
+            * filling in entries backward from there */
+           i = (attrid == 0)? maxhandlers : --hdl_idx;
+           dat->handling_array[i].attrid = attrid;
+           dat->handling_array[i].min_size = bufsize;
+           dat->handling_array[i].callback = read_frag_cb;
+           dat->handling_array[i].attrid_data = coderef;
+           SvREFCNT_inc(coderef);
+           continue;
+
+       croak_hdl:
+           croak("Expected CODEREF or [ MIN_SIZE, CODEREF ] for attrid %d", attrid);
+       }
+
+#define key_compare(key, val, keylen) \
+    (keylen == sizeof(val)-1) && (0 == strncmp(key, val, keylen))
+
+       if (key_compare(key, "file_start", keylen)) {
+           SV *val = hv_iterval(params, param);
+           if (!SvROK(val) || SvTYPE(SvRV(val)) != SVt_PVCV)
+               croak("Expected a CODEREF for file_start");
+           dat->file_start_sub = val;
+           SvREFCNT_inc(val);
+           continue;
+       }
+
+       if (key_compare(key, "file_finish", keylen)) {
+           SV *val = hv_iterval(params, param);
+           if (!SvROK(val) || SvTYPE(SvRV(val)) != SVt_PVCV)
+               croak("Expected a CODEREF for file_finish");
+           dat->file_finish_sub = val;
+           SvREFCNT_inc(val);
+           continue;
+       }
+
+       if (key_compare(key, "user_data", keylen)) {
+           SV *val = hv_iterval(params, param);
+           dat->user_data = val;
+           SvREFCNT_inc(val);
+           continue;
+       }
+#undef key_compare
+       croak("Invalid parameter named '%*s'", (int)keylen, key);
+    }
+
+    if (!dat->user_data)
+       dat->user_data = &PL_sv_undef;
+
+    success = amar_read(archive, dat, dat->handling_array + hdl_idx,
+       dat->file_start_sub? read_start_file_cb : NULL,
+       dat->file_finish_sub? read_finish_file_cb : NULL,
+       &error);
+
+    /* now unreference and free everything we referenced earlier */
+    if (dat->file_start_sub)
+       SvREFCNT_dec(dat->file_start_sub);
+    if (dat->file_finish_sub)
+       SvREFCNT_dec(dat->file_finish_sub);
+    if (dat->user_data && dat->user_data != &PL_sv_undef)
+       SvREFCNT_dec(dat->user_data);
+
+    for (hdl_idx = 0; hdl_idx <= maxhandlers; hdl_idx++) {
+       if (dat->handling_array[hdl_idx].attrid_data)
+           SvREFCNT_dec(dat->handling_array[hdl_idx].attrid_data);
+    }
+
+    g_free(dat->handling_array);
+    g_free(dat);
+
+    /* if amar_read returned FALSE, then either we hit an internal
+     * error, or one of the perl callbacks raised an exception, and $@
+     * is still set */
+    if (!success) {
+       if (error)
+           croak_gerror(&error);
+       else
+           croak(NULL);
+    }
+}
+
+%}
+
+/* now wrap those flat functions in Perl classes, depending on the perl
+ * refcounting to close objects in the right order */
+
+%perlcode %{
+package Amanda::Archive;
+
+# Expose the Archive constructor at Amanda::Archive->new
+sub new {
+    my $pkg = shift;
+    Amanda::Archive::Archive->new(@_);
+}
+
+package Amanda::Archive::Archive;
+
+sub new {
+    my ($class, $fd, $mode) = @_;
+    my $arch = Amanda::Archive::amar_new($fd, $mode);
+    return bless (\$arch, $class);
+}
+
+sub close {
+    my $self = shift;
+    if ($$self) {
+       Amanda::Archive::amar_close($$self);
+       $$self = undef;
+    }
+}
+
+sub DESTROY {
+    my $self = shift;
+    $self->close();
+}
+
+sub new_file {
+    my ($self, $filename, $want_offset) = @_;
+    return Amanda::Archive::File->new($self, $filename, $want_offset);
+}
+
+sub Amanda::Archive::Archive::read {
+    my $self = shift;
+    die "Archive is not open" unless ($$self);
+    # pass a hashref to the C code
+    my %h = @_;
+    Amanda::Archive::amar_read($$self, \%h);
+}
+
+package Amanda::Archive::File;
+
+sub new {
+    my ($class, $arch, $filename, $want_offset) = @_;
+    die "Archive is not open" unless ($$arch);
+    if ($want_offset) {
+       # note that posn is returned first by the SWIG wrapper
+       my ($file, $posn) = Amanda::Archive::amar_new_file($$arch, $filename, $want_offset);
+       return (bless([ $file, $arch ], $class), $posn);
+    } else {
+       my $file = Amanda::Archive::amar_new_file($$arch, $filename, $want_offset);
+       return bless([ $file, $arch ], $class);
+    }
+}
+
+sub close {
+    my $self = shift;
+    if ($self->[0]) {
+       Amanda::Archive::amar_file_close($self->[0]);
+       $self->[0] = undef;
+    }
+}
+
+sub DESTROY {
+    my $self = shift;
+    $self->close();
+}
+
+sub new_attr {
+    my ($self, $attrid) = @_;
+    return Amanda::Archive::Attr->new($self, $attrid);
+}
+
+package Amanda::Archive::Attr;
+
+sub new {
+    my ($class, $file, $attrid) = @_;
+    die "File is not open" unless ($file->[0]);
+    my $attr = Amanda::Archive::amar_new_attr($file->[0], $attrid);
+    return bless ([$attr, $file], $class);
+}
+
+sub close {
+    my $self = shift;
+    if ($self->[0]) {
+       Amanda::Archive::amar_attr_close($self->[0]);
+       $self->[0] = undef;
+    }
+}
+
+sub DESTROY {
+    my $self = shift;
+    $self->close();
+}
+
+sub add_data {
+    my ($self, $data, $eoa) = @_;
+    die "Attr is not open" unless ($self->[0]);
+    Amanda::Archive::amar_attr_add_data_buffer($self->[0], $data, $eoa);
+}
+
+sub add_data_fd {
+    my ($self, $fd, $eoa) = @_;
+    die "Attr is not open" unless ($self->[0]);
+    return Amanda::Archive::amar_attr_add_data_fd($self->[0], $fd, $eoa);
+}
+%}
diff --git a/perl/Amanda/BigIntCompat.pm b/perl/Amanda/BigIntCompat.pm
new file mode 100644 (file)
index 0000000..485657b
--- /dev/null
@@ -0,0 +1,99 @@
+# Copyright (c) 2005-2008 Zmanda, Inc.  All Rights Reserved.
+# 
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License version 2.1 as 
+# published by the Free Software Foundation.
+# 
+# This 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 this library; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+# 
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+package Amanda::BigIntCompat;
+
+use strict;
+use warnings;
+use overload;
+use Math::BigInt;
+
+=head1 NAME
+
+Amanda::BigIntCompat -- make C<Math::BigInt> behave consistently
+
+=head1 SYNOPSIS
+
+  use Amanda::BigIntCompat;
+  use Math::BigInt;
+
+  my $bn = Math::BigInt->new(1);
+  print "okay\n" if $bn eq "1";
+
+=head1 API STATUS
+
+Stable
+
+=head1 INTERFACE
+
+This module will modify C<Math::BigInt> to hide inconsistent behaviors across
+Perl versions. Spefically, it handles the following.
+
+=over
+
+=item stringification
+
+Older versions of C<Math::BigInt>, like the one shipped with Perl 5.6.1,
+stringify positive numbers with a leading C<+> (e.g. C<+1> instead of C<1>).
+
+=back
+
+=cut
+
+my $test_num = Math::BigInt->new(1);
+our $stringify = overload::Method($test_num, '""');
+
+if ($test_num =~ /^\+/) {
+    eval <<'EVAL';
+        package Math::BigInt;
+        use overload 'eq' => sub {
+           my ($self, $other) = @_;
+           return "$self" eq "$other";
+        };
+
+       # stringify is already overloaded; seems to be no good way to
+       # re-overload it without triggering a warning
+       no warnings 'redefine';
+       sub stringify {
+            my $str = $Amanda::BigIntCompat::stringify->(@_);
+            $str =~ s/^\+//;
+           return $str;
+       }
+EVAL
+    die $@ if $@;
+}
+
+# the "sign" method does not exist in older versions, either, but is used
+# by bigint2uint64().
+if (!$test_num->can("sign")) {
+    eval <<'EVAL';
+       package Math::BigInt;
+       sub sign { ($_[0] =~ /^-/)? "-" : "+"; }
+EVAL
+    die $@ if $@;
+}
+
+# similarly for bstr
+if (!$test_num->can("bstr")) {
+    eval <<'EVAL';
+       package Math::BigInt;
+       sub bstr { "$_[0]"; }
+EVAL
+    die $@ if $@;
+}
+1;
index bfad1bff77fa642ef4ab349060c4f3dfbe78bc84..a0126508a416a5d2dac86c97db3a6f4345e6c50a 100644 (file)
@@ -1,8 +1,8 @@
-# Copyright (c) 2006 Zmanda Inc.  All Rights Reserved.
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
 #
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 as published
-# by the Free Software Foundation.
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License version 2.1 as 
+# published by the Free Software Foundation.
 #
 # This program is distributed in the hope that it will be useful, but
 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 #
-# Contact information: Zmanda Inc, 505 N Mathlida Ave, Suite 120
-# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 
 package Amanda::Changer;
 
+use strict;
+use warnings;
 use Carp;
 use POSIX ();
-use Exporter;
-@ISA = qw( Exporter );
-
-@EXPORT_OK = qw(
-    reset clean eject label
-    query loadslot find scan
-);
+use vars qw( @ISA );
 
 use Amanda::Paths;
 use Amanda::Util;
-use Amanda::Device qw( :constants );
 use Amanda::Config qw( :getconf );
+use Amanda::Device qw( :constants );
 
 =head1 NAME
 
@@ -39,311 +35,554 @@ Amanda::Changer -- interface to changer scripts
 
 =head1 SYNOPSIS
 
-  use Amanda::Changer;
+    use Amanda::Changer;
 
-  my ($error, $slot) = Amanda::Changer::reset();
+    my $chg = Amanda::Changer->new(); # loads the default changer; OR
+    $chg = Amanda::Changer->new("somechanger"); # references a defined changer in amanda.conf
 
-  my ($nslots, $curslot, $backwards, $searchable) = Amanda::Changer::query();
+    $chg->load(
+       label => "TAPE-012",
+       res_cb => sub {
+           my ($err, $reservation) = @_;
+           if ($err) {
+               die $err->{message};
+           }
+           $dev = Amanda::Device->new($reservation->{device_name});
+           # use device..
+       });
 
-  my ($tpslot, $tpdevice) = Amanda::Changer::find("TAPE018");
-
-  sub slot_callback {
-    my ($slot, $device, $error) = @_;
-    if (!$error) print "Slot $slot: $device\n";
-    return 0;
-  }
-  Amanda::Changer::scan(\&slot_callback);
+    # later..
+    $reservation->release(finished_cb => $start_next_volume);
 
 =head1 API STATUS
 
-Stable
+This interface will change before the next release.
+
+=head1 INTERFACE
+
+All operations in the module return immediately, and take as an argument a
+callback function which will indicate completion of the changer operation -- a
+kind of continuation.  The caller should run a main loop (see
+L<Amanda::MainLoop>) to allow the interactions with the changer script to
+continue.
+
+A new object is created with the C<new> function as follows:
+
+  my $chg = Amanda::Changer->new($changer);
+
+to create a named changer (a name provided by the user, either specifying a
+changer directly or specifying a changer definition), or
+
+  my $chg = Amanda::Changer->new();
+
+to run the default changer.  This function handles the many ways a user can
+configure a changer.
 
-=head1 FUNCTIONS
+=head2 CALLBACKS
 
-All of these functions return an array of values, beginning with
-C<$error>, and containing any other results appropriate to the
-operation.
+A res_cb C<$cb> is called back as:
 
-The functions C<croak()> in the event of a serious error (problems
-running the changer script, or an exit status of 2 or higher).
-"Benign" errors, corresponding to an exit status of 1 or a slot named
-"<error>", result in the return of a single-element array containing
-the error message.  Error-handling for calls can be written
+ $cb->($error, undef);
 
-C<$error> and C<$slot>.  The first is false unless a "benign"
-error, such as a positioning error, has occurred, in which case it
-contains the message from the changer script, and the other results
-are undefined.  C<$slot> is the first word returned from the changer
-script, and is usually a number, but occasionally a string such as
-"<none>".
+in the event of an error, or
 
-=over
+ $cb->(undef, $reservation);
 
-=item reset
+with a successful reservation. res_cb must always be specified.  A finished_cb
+C<$cb> is called back as
 
 my ($error, $slot) = reset();
$cb->($error);
 
-Resets the tape changer, if supported, by calling
+in the event of an error, or
 
-  $tpchanger -reset
+ $cb->(undef);
 
-=item clean
+on success. A finished_cb may be omitted if no notification of completion is
+required.
 
-  my ($error, $slot) = clean();
+=head2 CURRENT SLOT
 
-Triggers a cleaning cycle, if supported, by calling
+Changers maintain a global concept of a "current" slot, for
+compatibility with Amanda algorithms such as the taperscan.  However, it
+is not compatible with concurrent use of the same changer, and may be
+inefficient for some changers, so new algorithms should avoid using it,
+preferring instead to load the correct tape immediately (with C<load>),
+and to progress from tape to tape using the reservation objects'
+C<next_slot> attribute.
 
-  $tpchanger -clean
+=head2 CHANGER OBJECTS
 
-=item eject
+=head3 $chg->load(res_cb => $cb, label => $label, set_current => $sc)
 
-  my ($error, $slot) = eject();
+Load a volume with the given label. This may leverage any barcodes or other
+indices that the changer has created, or may resort to a sequential scan of
+media. If set_current is specified and true, then the changer's current slot
+should be updated to correspond to $slot. If not, then the changer should not
+update its current slot (but some changers will anyway - specifically,
+chg-compat).
 
-Ejects the tape in the current slot, if supported, by calling
+Note that the changer I<tries> to load the requested volume, but it's a mean
+world out there, and you may not get what you want, so check the label on the
+loaded volume before getting started.
 
-  $tpchanger -eject
+=head3 $chg->load(res_cb => $cb, slot => "current")
 
-=item label
+Reserve the volume in the "current" slot. This is used by the sequential
+taperscan algorithm to begin its search.
 
-  my ($error) = label($label);
+=head3 $chg->load(res_cb => $cb, slot => "next")
 
-Inform the changer that the tape in the current slot is labeled C<$label>.  Calls
+Reserve the volume that follows the current slot.  This may not be a
+very efficient operation on all devices.
 
-  $tpchanger -label $label
+=head3 $chg->load(res_cb => $cb, slot => $slot, set_current => $sc)
 
-=item query
+Reserve the volume in the given slot. $slot must be a string that appeared in a
+reservation's 'next_slot' field at some point, or a string from the user (e.g.,
+an argument to amtape).
+
+=head3 $chg->info(info_cb => $cb, info => [ $key1, $key2, .. ])
+
+Query the changer for miscellaneous information.  Any number of keys may be
+specified.  The C<info_cb> is called with C<$error> as the first argument,
+much like a C<res_cb>, but the remaining arguments form a hash giving values
+for all of the requested keys that are supported by the changer.  The preamble
+to such a callback is usually
+
+  info_cb => sub {
+    my $error = shift;
+    my %results = @_;
+    # ..
+  }
+
+Supported keys are:
+
+=over 2
+
+=item num_slots
+
+The total number of slots in the changer device.  If this key is not
+present, then the device cannot determine its slot count (for example,
+an archival device that names slots by timestamp could potentially run
+until the heat-death of the universe).
+
+=item vendor_string
+
+A string describing the name and model of the changer device.
+
+=back
 
-  my ($error, $slot, $nslots, $backwards, $searchable) = query();
+=head3 $chg->reset(finished_cb => $cb)
 
-Query the changer to determine the current slot (C<$slot>), the
-number of slots (C<$nslots>), whether it can move backward through tapes
-(C<$backwards>), and whether it is searchable (that is, has a barcode
-reader; C<$searchable>).  A changer which cannot move backward through
-tapes is also known as a gravity feeder.
+Reset the changer to a "base" state. This will generally reset the "current"
+slot to something the user would think of as the "first" tape, unload any
+loaded drives, etc. It is an error to call this while any reservations are
+outstanding.
 
-This function runs
+=head3 $chg->clean(finished_cb => $cb, drive => $drivename)
 
-  $tpchanger -info
+Clean a drive, if the changer supports it. Drivename can be an empty string for
+devices with only one drive, or can be an arbitrary string from the user (e.g.,
+an amtape argument). Note that some changers cannot detect the completion of a
+cleaning cycle; in this case, the user will just need to delay further Amanda
+activities until the cleaning is complete.
 
-=item loadslot
+=head3 $chg->update(finished_cb => $cb, changed => $changed)
 
-  my ($error, $slot, $device) = loadslot($desired_slot);
+The user has changed something -- loading or unloading tapes,
+reconfiguring the changer, etc. -- that may have invalidated the
+database.  C<$changed> is a changer-specific string indicating what has
+changed; if it is omitted, the changer will check everything.
 
-Load the tape in the given slot, returning its slot and device.
-C<$desired_slot> can be a numeric slot number or one of the symbolic
-names defined by the changer API, e.g., "next", "current", or "first".
+=head3 $chg->import(finished_cb => $cb, slots => $slots)
 
-  $tpchanger -slot $slot
+The user has placed volumes in the import/export slots, and would like the
+changer to place them in storage slots. This is a very changer-specific
+operation, and $slots should be supplied by the user for verbatim transmission
+to the changer, and may specify which import/export slots, for example, contain
+the new volumes.
 
-=item find
+=head3 $chg->export(finished_cb => $cb, slot => $slot)
 
-  my ($error, $tpslot, $tpdevice) = Amanda::Changer::find($label);
+=head3 $chg->export(finished_cb => $cb, label => $label)
 
-Search the changer for a tape with the given label, returning with
-C<$tpslot = "<none>"> if the given label is not found.
+Place the indicated volume (by $label, or in $slot) into an available
+import/export slot. This, too, is a very changer-specific operation.
 
-If the changer is searchable, this function calls
+=head3 $chg->move(finished_cb => $cb, from_slot => $from, to_slot => $to)
 
-  $tpchanger -search $label
+Move a volume between two slots in the changer. These slots are provided by the
+user, and have meaning for the changer.
 
-Otherwise it scans all slots in order, beginning with the current slot,
-until it finds one with a label equal to C<$label> or exhausts all
-slots.  Note that it is considered a fatal error if the label is not
-found.
+=head2 RESERVATION OBJECTS
 
-=item scan
+=head3 $res->{'device_name'}
 
-  my ($error) = Amanda::Changer::scan(\&slot_callback);
+This is the name of the device reserved by a reservation object.
 
-Call C<slot_callback> for all slots, beginning with the current slot,
-until C<slot_callback> returns a nonzero value or all slots are
-exhausted.  C<slot_callback> gets three arguments: a slot number, a
-device name for that slot, and a boolean value which is true if the
-changer successfully loaded the slot.
+=head3 $res->{'this_slot'}
+
+This is the name of this slot.  It is an arbitrary string which will
+have some meaning to the changer's C<load()> method. It is safe to
+access this field after the reservation has been released.
+
+=head3 $res->{'next_slot'}
+
+This is the "next" slot after this one. It is safe to access this field,
+too, after the reservation has been released (and, in changers with only
+one "drive", this is the only way you will get to the next volume!)
+
+=head3 $res->release(finished_cb => $cb, eject => $eject)
+
+This is how an Amanda application indicates that it no longer needs the
+reserved volume. The callback is called after any related operations are
+complete -- possibly immediately. Some drives and changers have a notion of
+"ejecting" a volume, and some don't. In particular, a manual changer can cause
+the tape drive to eject the tape, while a tape robot can move a tape back to
+storage, leaving the drive empty. If the eject parameter is given and true, it
+indicates that Amanda is done with the volume and has reason to believe the
+user is done with the volume, too -- for example, when a tape has been written
+completely.
+
+A reservation will be released automatically when the object is destroyed, but
+in this case no finished_cb is given, so the release operation may not complete
+before the process exits. Wherever possible, reservations should be explicitly
+released.
+
+=head3 $res->set_label(finished_cb => $cb, label => $label)
+
+This is how Amanda indicates to the changer that the volume in the device has
+been (re-)labeled. Changers can keep a database of volume labels by slot or by
+barcode, or just ignore this function and call $cb immediately. Note that the
+reservation must still be held when this function is called.
+
+=head1 SEE ALSO
+
+See the other changer packages, including:
+
+=over 2
+
+=item L<Amanda::Changer::disk>
+
+=item L<Amanda::Changer::compat>
+
+=item L<Amanda::Changer::single>
 
 =back
 
-=cut
+=head1 TODO
 
-sub reset {
-    my ($error, $slot, $rest) = run_tpchanger("-reset");
-    return ($error) if $error;
+ - support loading by barcode, showing barcodes in reservations
+ - support deadlock avoidance by returning more information in load errors
+ - Amanda::Changer::Single
+
+=cut
 
-    return (0, $slot);
+# this is a "virtual" constructor which instantiates objects of different
+# classes based on its argument.  Subclasses should not try to chain up!
+sub new {
+    shift eq 'Amanda::Changer'
+       or die("Do not call the Amanda::Changer constructor from subclasses");
+    my ($name) = @_;
+    my ($uri, $cc);
+
+    # creating a named changer is a bit easier
+    if (defined($name)) {
+       # first, is it a changer alias?
+       if (($uri,$cc) = _changer_alias_to_uri($name)) {
+           return _new_from_uri($uri, $cc, $name);
+       }
+
+       # maybe a straight-up changer URI?
+       if (_uri_to_pkgname($name)) {
+           return _new_from_uri($name, undef, $name);
+       }
+
+       # assume it's a device name or alias, and invoke the single-changer
+       return _new_from_uri("chg-single:$name", undef, $name);
+    } else { # !defined($name)
+       if (getconf_seen($CNF_TPCHANGER)) {
+           my $tpchanger = getconf($CNF_TPCHANGER);
+
+           # first, is it an old changer script?
+           if ($uri = _old_script_to_uri($tpchanger)) {
+               return _new_from_uri($uri, undef, $name);
+           }
+
+           # if not, then there had better be no tapdev
+           if (getconf_seen($CNF_TAPEDEV)) {
+               die "Cannot specify both 'tapedev' and 'tpchanger' unless using an old-style changer script";
+           }
+
+           # maybe a changer alias?
+           if (($uri,$cc) = _changer_alias_to_uri($tpchanger)) {
+               return _new_from_uri($uri, $cc, $name);
+           }
+
+           # maybe a straight-up changer URI?
+           if (_uri_to_pkgname($tpchanger)) {
+               return _new_from_uri($tpchanger, undef, $name);
+           }
+
+           # assume it's a device name or alias, and invoke the single-changer
+           return _new_from_uri("chg-single:$tpchanger", undef, $name);
+       } elsif (getconf_seen($CNF_TAPEDEV)) {
+           my $tapedev = getconf($CNF_TAPEDEV);
+
+           # first, is it a changer alias?
+           if (($uri,$cc) = _changer_alias_to_uri($tapedev)) {
+               return _new_from_uri($uri, $cc, $name);
+           }
+
+           # maybe a straight-up changer URI?
+           if (_uri_to_pkgname($tapedev)) {
+               return _new_from_uri($tapedev, undef, $name);
+           }
+
+           # assume it's a device name or alias, and invoke the single-changer
+           return _new_from_uri("chg-single:$tapedev", undef, $name);
+       } else {
+           die "Must specify one of 'tapedev' or 'tpchanger'";
+       }
+    }
 }
 
-sub clean {
-    my ($error, $slot, $rest) = run_tpchanger("-clean");
-    return ($error) if $error;
+# helper functions for new
+
+sub _changer_alias_to_uri {
+    my ($name) = @_;
+
+    my $cc = Amanda::Config::lookup_changer_config($name);
+    if ($cc) {
+       my $tpchanger = changer_config_getconf($cc, $CHANGER_CONFIG_TPCHANGER);
+       if (my $uri = _old_script_to_uri($tpchanger)) {
+           return ($uri, $cc);
+       } elsif (_uri_to_pkgname($tpchanger)) {
+           return ($tpchanger, $cc);
+       } else {
+           die "Changer '$name' specifies invalid tpchanger '$tpchanger'";
+       }
+    }
 
-    return (0, $slot);
+    # not an alias
+    return;
 }
 
-sub eject {
-    my ($error, $slot, $rest) = run_tpchanger("-eject");
-    return ($error) if $error;
+sub _old_script_to_uri {
+    my ($name) = @_;
+
+    if ((-x "$amlibexecdir/$name") or (($name =~ qr{^/}) and (-x $name))) {
+       return "chg-compat:$name"
+    }
 
-    return (0, $slot);
+    # not an old script
+    return;
 }
 
-sub label {
-    my ($label) = @_;
+# try to load the package for the given URI.  $@ is set properly
+# if this function returns a false value.
+sub _uri_to_pkgname {
+    my ($name) = @_;
 
-    my ($error, $slot, $rest) = run_tpchanger("-label", $label);
-    return ($error) if $error;
+    my ($type) = ($name =~ /^chg-([A-Za-z_]+):/);
+    if (!defined $type) {
+       $@ = "'$name' is not a changer URI";
+       return 0;
+    }
+
+    $type =~ tr/A-Z-/a-z_/;
+
+    # create a package name to see if it's already imported
+    my $pkgname = "Amanda::Changer::$type";
+    my $filename = $pkgname;
+    $filename =~ s|::|/|g;
+    $filename .= '.pm';
+    return $pkgname if (exists $INC{$filename});
+
+    # try loading it
+    eval "use $pkgname;";
+    if ($@) {
+        my $err = $@;
+
+        # determine whether the module doesn't exist at all, or if there was an
+        # error loading it; die if we found a syntax error
+        if (exists $INC{$filename}) {
+            die($err);
+        }
 
-    return (0);
+        return 0;
+    }
+
+    return $pkgname;
 }
 
-sub query {
-    my ($error, $slot, $rest) = run_tpchanger("-info");
-    return ($error) if $error;
+# already-instsantiated changer objects (using 'our' so that the installcheck
+# and reset this list as necessary)
+our %changers_by_uri_cc = ();
+
+sub _new_from_uri { # (note: this sub is patched by the installcheck)
+    my ($uri, $cc, $name) = @_;
 
-    # old, unsearchable changers don't return the third result, so it's optional in the regex
-    $rest =~ /(\d+) (\d+) ?(\d+)?/ or croak("Malformed response from changer -seek: $rest");
+    # make up a key for our hash of already-instantiated objects,
+    # using a newline as a separator, since perl can't use tuples
+    # as keys
+    my $uri_cc = "$uri\n";
+    if (defined $cc) {
+       $uri_cc = $uri_cc . changer_config_name($cc);
+    }
+
+    # return a pre-existing changer, if possible
 
-    # return array: error, nslots, curslot, backwards, searchable
-    return (0, $slot, $1, $2, $3?1:0);
+    if (exists($changers_by_uri_cc{$uri_cc})) {
+       return $changers_by_uri_cc{$uri_cc};
+    }
+
+    # look up the type and load the class
+    my $pkgname = _uri_to_pkgname($uri);
+    if (!$pkgname) {
+       die $@;
+    }
+
+    my $rv = $pkgname->new($cc, $uri);
+    die "$pkgname->new did not return an Amanda::Changer object"
+       unless ($rv->isa("Amanda::Changer"));
+
+    # store this in our cache for next time
+    $changers_by_uri_cc{$uri_cc} = $rv;
+
+    return $rv;
 }
 
-sub loadslot {
-    my ($desired_slot) = @_;
+# parent-class methods; mostly "unimplemented method"
 
-    my ($error, $slot, $rest) = run_tpchanger("-slot", $desired_slot);
-    return ($error) if $error;
+sub load {
+    my $self = shift;
+    my %params = @_;
 
-    return (0, $slot, $rest);
+    my $class = ref($self);
+    $params{'res_cb'}->("$class does not support load()", undef);
 }
 
-sub find {
-    my ($label) = @_;
-
-    my ($error, $curslot, $nslots, $backwards, $searchable) = query();
-    return ($error) if $error;
-
-    if ($searchable) {
-        # search using the barcode reader, etc.
-        my ($error, $slot, $rest) = run_tpchanger("-search", $label);
-        return ($error) if $error;
-        return ($error, $slot, $rest);
-    } else {
-        # search manually, starting with "current"
-        my $slotstr = "current";
-        for (my $checked = 0; $checked < $nslots; $checked++) {
-            my ($error, $slot, $rest) = run_tpchanger("-slot", $slotstr);
-            $slotstr = "next";
-
-            # ignore "benign" errors
-            next if $error;
-
-            my $device = Amanda::Device->new($rest);
-            next if (!$device);
-            next if ($device->read_label() != $READ_LABEL_STATUS_SUCESS);
-
-            # we found it!
-            if ($device->{'volume_label'} eq $label) {
-                return (0, $slot, $rest);
-            }
-        }
+sub reset {
+    my $self = shift;
+    my %params = @_;
 
-        croak("Label $label not found in any slot");
+    my $class = ref($self);
+    if (exists $params{'finished_cb'}) {
+       $params{'finished_cb'}->("$class does not support reset()");
     }
 }
 
-sub scan {
-    my ($slot_callback) = @_;
+sub info {
+    my $self = shift;
+    my %params = @_;
 
-    my ($error, $curslot, $nslots, $backwards, $searchable) = query();
-    return ($error) if $error;
+    my $class = ref($self);
+    if (exists $params{'info_cb'}) {
+       $params{'info_cb'}->("$class does not support info()");
+    }
+}
 
-    my $slotstr = "current";
-    my $done = 0;
-    for (my $checked = 0; $checked < $nslots; $checked++) {
-        my ($error, $slot, $rest) = run_tpchanger("-slot", $slotstr);
-        $slotstr = "next";
+sub clean {
+    my $self = shift;
+    my %params = @_;
 
-        if ($error) {
-            $done = $slot_callback->(undef, undef, $error);
-        } else {
-            $done = $slot_callback->($slot, $rest, 0);
-        }
+    my $class = ref($self);
+    if (exists $params{'finished_cb'}) {
+       $params{'finished_cb'}->("$class does not support clean()");
+    }
+}
+
+sub update {
+    my $self = shift;
+    my %params = @_;
 
-        last if $done;
+    my $class = ref($self);
+    if (exists $params{'finished_cb'}) {
+       $params{'finished_cb'}->("$class does not support update()");
     }
-    
-    return (0);
 }
 
-# Internal-use function to actually invoke a changer script and parse 
-# its output.  If the script's exit status is neither 0 nor 1, or if an error
-# occurs running the script, then run_tpchanger croaks with the error message.
-#
-# @params @args: command-line arguments to follow the name of the changer
-# @returns: array ($error, $slot, $rest), where $error is an error message if
-#       a benign error occurred, or 0 if no error occurred
-sub run_tpchanger {
-    my @args = @_;
-
-    # get the tape changer and extend it to a full path
-    my $tapechanger = getconf($CNF_TPCHANGER);
-    if ($tapechanger !~ qr(^/)) {
-        $tapechanger = "$amlibexecdir/$tapechanger";
+sub import {
+    my $self = shift;
+    my %params = @_;
+
+    my $class = ref($self);
+    if (exists $params{'finished_cb'}) {
+       $params{'finished_cb'}->("$class does not support import()");
     }
+}
 
-    my $pid = open(my $child, "-|");
-    if (!defined($pid)) {
-        croak("Can't fork to run changer script: $!");
+sub export {
+    my $self = shift;
+    my %params = @_;
+
+    my $class = ref($self);
+    if (exists $params{'finished_cb'}) {
+       $params{'finished_cb'}->("$class does not support export()");
     }
+}
 
-    if (!$pid) {
-        # child
-
-        # cd into the config dir, if one exists
-        # TODO: construct a "fake" config dir including any "-o" overrides
-        my $config_dir = Amanda::Config::get_config_dir();
-        if ($config_dir) {
-            if (!chdir($config_dir)) {
-                print "<error> Could not chdir to '$config_dir'\n";
-                exit(2);
-            }
-        }
+sub move {
+    my $self = shift;
+    my %params = @_;
+
+    my $class = ref($self);
+    if (exists $params{'finished_cb'}) {
+       $params{'finished_cb'}->("$class does not support move()");
+    }
+}
 
-        %ENV = Amanda::Util::safe_env();
+package Amanda::Changer::Reservation;
 
-        exec { $tapechanger } $tapechanger, @args or
-            print "<error> Could not exec $tapechanger: $!\n";
-        exit 2;
+# this is a simple base class with stub method or two.
+
+sub new {
+    my $class = shift;
+    my $self = {
+       released => 0,
+    };
+    return bless ($self, $class)
+}
+
+sub DESTROY {
+    my ($self) = @_;
+    if (!$self->{'released'}) {
+       $self->release(finished_cb => sub {
+           my ($err) = @_;
+           if (defined $err) {
+               warn "While releasing reservation: $err";
+           }
+       });
     }
+}
 
-    # parent
-    my @child_output = <$child>;
+sub set_label {
+    my $self = shift;
+    my %params = @_;
 
-    # close the child and get its exit status
-    my $child_exit = 0;
-    if (!close($child)) {
-        if ($!) {
-            croak("Error running changer script: $!");
-        } else {
-            $child_exit = $?;
-        }
+    # nothing to do: just call the finished callback
+    if (exists $params{'finished_cb'}) {
+       Amanda::MainLoop::call_later($params{'finished_cb'}, undef);
     }
+}
 
-    # parse the response
-    croak("Malformed output from changer script -- no output")
-        if (@child_output < 1);
-    croak("Malformed output from changer script -- too many lines")
-        if (@child_output > 1);
-    croak("Malformed output from changer script: '$child_output[0]'")
-        if ($child_output[0] !~ /\s*([^\s]+)\s+(.+)?/);
-    my ($slot, $rest) = ($1, $2);
-
-    if ($child_exit == 0) {
-        return (0, $slot, $rest);
-    } elsif (POSIX::WIFEXITED($child_exit) && POSIX::WEXITSTATUS($child_exit) == 1) {
-        return ($rest); # non-fatal error
-    } else {
-        croak("Fatal error from changer script: $rest");
+sub release {
+    my $self = shift;
+    my %params = @_;
+
+    return if $self->{'released'};
+
+    $self->{'released'} = 1;
+    $self->do_release(%params);
+
+    if (exists $params{'finished_cb'}) {
+       Amanda::MainLoop::call_later($params{'finished_cb'}, undef);
     }
 }
 
+sub do_release {
+    # this is the one subclasses should override
+}
+
 1;
diff --git a/perl/Amanda/Changer/compat.pm b/perl/Amanda/Changer/compat.pm
new file mode 100644 (file)
index 0000000..3a96935
--- /dev/null
@@ -0,0 +1,537 @@
+# Copyright (c) 2005-2008 Zmanda, Inc.  All Rights Reserved.
+#
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License version 2.1 as
+# published by the Free Software Foundation.
+#
+# This 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 this library; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+#
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+package Amanda::Changer::compat;
+
+use strict;
+use warnings;
+use vars qw( @ISA );
+@ISA = qw( Amanda::Changer );
+
+use Carp;
+use File::Glob qw( :glob );
+use File::Path;
+use Amanda::Paths;
+use Amanda::MainLoop qw( :GIOCondition );
+use Amanda::Config qw( :getconf );
+use Amanda::Debug;
+use Amanda::Device qw( :constants );
+use Amanda::Changer;
+
+=head1 NAME
+
+Amanda::Changer::compat -- run "old" changer scripts
+
+=head1 DESCRIPTION
+
+This package, calls through to old Changer API shell scripts using the new API.
+If necessary, this writes temporary configurations under C<$AMANDA_TMPDIR> and
+invokes the changer there, allowing multiple distinct changers to run within
+the same Amanda process.
+
+=head1 TODO
+
+In-process reservations are handled correctly - only one device may be used at
+a time.  However, the underlying scripts do not support reservations, so
+another application can easily run the script and change the current device.
+Caveat emptor.
+
+Concurrent _run_tpchanger invocations are currently forbidden with a die() --
+that should change to a simple FIFO queue of tpchanger invocations to make.
+
+Clean out old changer temporary directories on object destruction.
+
+Support 'update'
+
+=cut
+
+sub new {
+    my $class = shift;
+    my ($cc, $tpchanger) = @_;
+    my ($script) = ($tpchanger =~ /chg-compat:(.*)/);
+
+    my $self = {
+        script => $script,
+       reserved => 0,
+       nslots => undef,
+       backwards => undef,
+       searchable => undef,
+    };
+    bless ($self, $class);
+
+    $self->_make_cfg_dir($cc);
+
+    return $self;
+}
+
+sub load {
+    my $self = shift;
+    my %params = @_;
+
+    die "no callback supplied" unless (exists $params{'res_cb'});
+    my $cb = $params{'res_cb'};
+
+    if ($self->{'reserved'}) {
+       $cb->("Changer is already reserved: '" . $self->{'reserved'} . "'", undef);
+       return;
+    }
+
+    # make sure the info is loaded, and re-call load() if we have to wait
+    if (!defined($self->{'nslots'})) {
+       $self->_get_info(
+           sub {
+                my ($err) = @_;
+               $self->load(%params);
+           },
+           sub {
+               my ($msg) = @_;
+               $cb->($msg, undef);
+           });
+       return;
+    }
+
+    my $run_success_cb = sub {
+        my ($slot, $rest) = @_;
+        my $res = Amanda::Changer::compat::Reservation->new($self, $slot, $rest);
+        $cb->(undef, $res);
+    };
+    my $run_fail_cb = sub {
+        my ($exitval, $message) = @_;
+        $cb->($message, undef);
+    };
+
+    if (exists $params{'label'}) {
+        if ($self->{'searchable'}) {
+            $self->_run_tpchanger($run_success_cb, $run_fail_cb, "-search", $params{'label'});
+        } else {
+            # not searchable -- run a manual scan
+            $self->_manual_scan(%params);
+        }
+    } elsif (exists $params{'slot'}) {
+        $self->_run_tpchanger($run_success_cb, $run_fail_cb, "-slot", $params{'slot'});
+    }
+}
+
+sub _manual_scan {
+    my $self = shift;
+    my %params = @_;
+    my $nchecked = 0;
+    my $check_slot;
+
+    # search manually, starting with "current".  This is complicated, because
+    # it's an event-based loop.
+
+    # TODO: support the case where nslots == -1
+
+    $check_slot = sub {
+        my ($err, $res) = @_;
+
+        TRYSLOT: {
+            # ignore "benign" errors
+            next TRYSLOT if $err;
+
+            my $device = Amanda::Device->new($res->{'device_name'});
+            next TRYSLOT unless $device;
+            next TRYSLOT if ($device->read_label() != $DEVICE_STATUS_SUCCESS);
+            next TRYSLOT unless ($device->volume_label() eq $params{'label'});
+
+            # we found the correct slot
+            Amanda::MainLoop::call_later($params{'res_cb'}, undef, $res);
+            return;
+        }
+
+        # on to the next slot
+        if (++$nchecked >= $self->{'nslots'}) {
+            Amanda::MainLoop::call_later($params{'res_cb'},
+                    "Volume '$params{label}' not found", undef);
+            return;
+        } else {
+            # loop again with the next slot
+            $res->release(); # we know this completes immediately
+            $self->load(slot => "next", res_cb => $check_slot);
+        }
+    };
+
+    # kick off the loop with the current slot
+    $self->load(slot => "current", res_cb => $check_slot);
+}
+
+sub info {
+    my $self = shift;
+    my %params = @_;
+    my %results;
+
+    die "no info_cb supplied" unless (exists $params{'info_cb'});
+    die "no info supplied" unless (exists $params{'info'});
+
+    # make sure the info is loaded, and re-call info() if we have to wait
+    if (!defined($self->{'nslots'}) && grep(/^num_slots$/, @{$params{'info'}})) {
+       $self->_get_info(
+           sub {
+                my ($err) = @_;
+               $self->info(%params);
+           },
+           sub {
+               my ($msg) = @_;
+               $params{'info_cb'}->($msg);
+           });
+       return;
+    }
+
+    # ok, info is loaded, so call back with the results
+    for my $inf (@{$params{'info'}}) {
+        if ($inf eq 'num_slots') {
+            $results{$inf} = $self->{'nslots'};
+        } else {
+            warn "Ignoring request for info key '$inf'";
+        }
+    }
+
+    Amanda::MainLoop::call_later($params{'info_cb'}, undef, %results);
+}
+
+# run a simple op -- no arguments, no slot returned
+sub _simple_op {
+    my $self = shift;
+    my $op = shift;
+    my %params = @_;
+
+    my $run_success_cb = sub {
+        if (exists $params{'finished_cb'}) {
+            $params{'finished_cb'}->(undef);
+        }
+    };
+    my $run_fail_cb = sub {
+       my ($exitval, $message) = @_;
+        if (exists $params{'finished_cb'}) {
+            $params{'finished_cb'}->($message);
+        }
+    };
+    $self->_run_tpchanger($run_success_cb, $run_fail_cb, "-$op");
+}
+
+sub reset {
+    my $self = shift;
+    my %params = @_;
+
+    $self->_simple_op("reset", %params);
+}
+
+sub clean {
+    my $self = shift;
+    my %params = @_;
+
+    # note: parameter 'drive' is ignored
+    $self->_simple_op("clean", %params);
+}
+
+sub update {
+    my $self = shift;
+    my %params = @_;
+
+    # TODO: not implemented
+    # -- need to shuffle the driver over every slot
+    if (exists $params{'finished_cb'}) {
+       $params{'finished_cb'}->(undef);
+    }
+}
+
+# Internal function to call the script's -info, store the results in $self, and
+# call either $success_cb (with no arguments) or $error_cb (with an error
+# message).
+sub _get_info {
+    my ($self, $success_cb, $error_cb) = @_;
+
+    my $run_success_cb = sub {
+       my ($slot, $rest) = @_;
+       # old, unsearchable changers don't return the third result, so it's
+       # optional in the regex
+       $rest =~ /(\d+) (\d+) ?(\d+)?/ or
+           croak("Malformed response from changer -info: $rest");
+
+       $self->{'nslots'} = $1;
+       $self->{'backward'} = $2;
+       $self->{'searchable'} = $3? 1:0;
+
+       $success_cb->();
+    };
+    my $run_fail_cb = sub {
+       my ($exitval, $message) = @_;
+       $error_cb->($message);
+    };
+    $self->_run_tpchanger($run_success_cb, $run_fail_cb, "-info");
+}
+
+# Internal function to create a temporary configuration directory, which persists
+# for the duration of this changer's lifetime (and beyond, TODO)
+sub _make_cfg_dir {
+    my ($self, $cc) = @_;
+
+    if (defined $cc) {
+       my $cfg_name = Amanda::Config::get_config_name();
+       my $changer_name = changer_config_name($cc);
+       my $tapedev = changer_config_getconf($cc, $CHANGER_CONFIG_TAPEDEV);
+       my $tpchanger = changer_config_getconf($cc, $CHANGER_CONFIG_TPCHANGER);
+       my $changerdev = changer_config_getconf($cc, $CHANGER_CONFIG_CHANGERDEV);
+       my $changerfile = changer_config_getconf($cc, $CHANGER_CONFIG_CHANGERFILE);
+
+       my $cfg_dir = "$AMANDA_TMPDIR/Amanda::Changer::compat/$cfg_name-$changer_name";
+
+       if (-d $cfg_dir) {
+           rmtree($cfg_dir)
+               or die("Could not delete '$cfg_dir'");
+       }
+
+       mkpath($cfg_dir)
+           or die("Could not create '$cfg_dir'");
+
+       # Write an amanda.conf
+       open(my $amconf, ">", "$cfg_dir/amanda.conf")
+           or die ("Could not write '$cfg_dir/amanda.conf'");
+
+       print $amconf "# automatically generated by Amanda::Changer::compat\n";
+       print $amconf 'org "', getconf($CNF_ORG), "\"\n"
+           if getconf_seen($CNF_ORG);
+       print $amconf 'mailto "', getconf($CNF_MAILTO), "\"\n"
+           if getconf_seen($CNF_MAILTO);
+       print $amconf 'mailer "', getconf($CNF_MAILER), "\"\n"
+           if getconf_seen($CNF_MAILER);
+       print $amconf "tapedev \"$tapedev\"\n"
+           if defined($tapedev);
+       print $amconf "tpchanger \"$tpchanger\"\n"
+           if defined($tpchanger);
+       print $amconf "changerdev \"$changerdev\"\n"
+           if defined($changerdev);
+       print $amconf "changerfile \"",
+               Amanda::Config::config_dir_relative($changerfile),
+               "\"\n"
+           if defined($changerfile);
+
+       # TODO: device_property, tapetype, and the tapetype def
+
+       close $amconf;
+
+       $self->{'cfg_dir'} = $cfg_dir;
+    } else {
+       # for the default changer, we don't need to invent a config..
+       $self->{'cfg_dir'} = Amanda::Config::get_config_dir();
+    }
+
+}
+
+# Internal-use function to actually invoke a changer script and parse
+# its output.
+#
+# @param $success_cb: called with ($slot, $rest) on success
+# @param $failure_cb: called with ($exitval, $message) on any failure
+# @params @args: command-line arguments to follow the name of the changer
+# @returns: array ($error, $slot, $rest), where $error is an error message if
+#       a benign error occurred, or 0 if no error occurred
+sub _run_tpchanger {
+    my ($self, $success_cb, $failure_cb, @args) = @_;
+
+    if ($self->{'busy'}) {
+       croak("Changer is already in use");
+    }
+
+    my ($readfd, $writefd) = POSIX::pipe();
+    if (!defined($writefd)) {
+       croak("Error creating pipe to run changer script: $!");
+    }
+
+    my $pid = fork();
+    if (!defined($pid) or $pid < 0) {
+        croak("Can't fork to run changer script: $!");
+    }
+
+    if (!$pid) {
+        ## child
+
+       # get our file-handle house in order
+       POSIX::close($readfd);
+       POSIX::dup2($writefd, 1);
+       POSIX::close($writefd);
+
+        # cd into the config dir
+        if (!chdir($self->{'cfg_dir'})) {
+            print "<error> Could not chdir to '" . $self->{cfg_dir} . "'\n";
+            exit(2);
+        }
+
+        %ENV = Amanda::Util::safe_env();
+
+       my $script = $self->{'script'};
+        unless (-x $script) {
+            $script = "$amlibexecdir/$script";
+        }
+        { exec { $script } $script, @args; } # braces protect against warning
+
+       my $err = "<error> Could not exec $script: $!\n";
+       POSIX::write($writefd, $err, length($err));
+        exit 2;
+    }
+
+    ## parent
+
+    # clean up file descriptors from the fork
+    POSIX::close($writefd);
+
+    # mark this object as "busy", so we can't begin another operation
+    # until this one is finished.
+    $self->{'busy'} = 1;
+
+    # the callbacks that follow share these lexical variables
+    my $child_eof = 0;
+    my $child_output = '';
+    my $child_dead = 0;
+    my $child_exit_status = 0;
+    my ($fdsrc, $cwsrc);
+    my ($maybe_finished, $fd_source_cb, $child_watch_source_cb);
+
+    # Perl note: we have to use anonymous subs here, as they are instantiated
+    # at runtime, rather than at compile time.
+
+    $maybe_finished = sub {
+       return unless $child_eof;
+       return unless $child_dead;
+
+       # everything is finished -- process the results and invoke the callback
+       chomp $child_output;
+
+       # handle fatal errors
+       if (!POSIX::WIFEXITED($child_exit_status) || POSIX::WEXITSTATUS($child_exit_status) > 1) {
+           $failure_cb->(POSIX::WEXITSTATUS($child_exit_status),
+               "Fatal error from changer script: ".$child_output);
+           return;
+       }
+
+       # parse the child's output
+       my @child_output = split '\n', $child_output;
+       $failure_cb->(2, "Malformed output from changer script -- no output")
+           if (@child_output < 1);
+       $failure_cb->(2, "Malformed output from changer script -- too many lines")
+           if (@child_output > 1);
+       $failure_cb->(2, "Malformed output from changer script: '$child_output[0]'")
+           if ($child_output[0] !~ /\s*([^\s]+)(?:\s+(.+))?/);
+       my ($slot, $rest) = ($1, $2);
+
+       # mark this object as no longer busy.  This frees the
+       # object up to begin the next operation, which may happen
+       # during the invocation of the callback
+       $self->{'busy'} = 0;
+
+       # let the callback take care of any further interpretation
+       my $exitval = POSIX::WEXITSTATUS($child_exit_status);
+       if ($exitval == 0) {
+           $success_cb->($slot, $rest);
+       } else {
+           $failure_cb->($exitval, $rest);
+       }
+    };
+
+    $fd_source_cb = sub {
+       my ($fdsrc) = @_;
+       my ($len, $bytes);
+       $len = POSIX::read($readfd, $bytes, 1024);
+
+       # if we got an EOF, shut things down.
+       if ($len == 0) {
+           $child_eof = 1;
+           POSIX::close($readfd);
+           $fdsrc->remove();
+           $fdsrc = undef; # break a reference loop
+           $maybe_finished->();
+       } else {
+           # otherwise, just keep the bytes
+           $child_output .= $bytes;
+       }
+    };
+    $fdsrc = Amanda::MainLoop::fd_source($readfd, $G_IO_IN | $G_IO_ERR | $G_IO_HUP);
+    $fdsrc->set_callback($fd_source_cb);
+
+    $child_watch_source_cb = sub {
+       my ($cwsrc, $got_pid, $got_status) = @_;
+       $cwsrc->remove();
+       $cwsrc = undef; # break a reference loop
+       $child_dead = 1;
+       $child_exit_status = $got_status;
+
+       $maybe_finished->();
+    };
+    $cwsrc = Amanda::MainLoop::child_watch_source($pid);
+    $cwsrc->set_callback($child_watch_source_cb);
+}
+
+package Amanda::Changer::compat::Reservation;
+use vars qw( @ISA );
+@ISA = qw( Amanda::Changer::Reservation );
+
+sub new {
+    my $class = shift;
+    my ($chg, $slot, $device_name) = @_;
+    my $self = Amanda::Changer::Reservation::new($class);
+
+    $self->{'chg'} = $chg;
+
+    $self->{'device_name'} = $device_name;
+    $self->{'this_slot'} = $slot;
+    $self->{'next_slot'} = "next"; # clever, no?
+
+    # mark the changer as reserved
+    $self->{'chg'}->{'reserved'} = $device_name;
+
+    return $self;
+}
+
+sub do_release {
+    my $self = shift;
+    my %params = @_;
+
+    $self->{'chg'}->{'reserved'} = 0;
+}
+
+sub set_label {
+    my $self = shift;
+    my %params = @_;
+
+    # non-searchable changers don't get -label, except that chg-zd-mtx needs
+    # it to maintain its slotinfofile (this is a hack)
+    if (!$self->{'chg'}->{'searchable'}
+       && $self->{'chg'}->{'script'} !~ /chg-zd-mtx$/) {
+        if (exists $params{'finished_cb'}) {
+            Amanda::MainLoop::call_later($params{'finished_cb'}, undef);
+        }
+        return;
+    }
+
+    my $run_success_cb = sub {
+        if (exists $params{'finished_cb'}) {
+            Amanda::MainLoop::call_later($params{'finished_cb'}, undef);
+        }
+    };
+    my $run_fail_cb = sub {
+       my ($exitval, $message) = @_;
+        if (exists $params{'finished_cb'}) {
+            Amanda::MainLoop::call_later($params{'finished_cb'}, $message);
+        }
+    };
+    $self->{'chg'}->_run_tpchanger(
+        $run_success_cb, $run_fail_cb, "-label", $params{'label'});
+}
+
+1;
diff --git a/perl/Amanda/Changer/disk.pm b/perl/Amanda/Changer/disk.pm
new file mode 100644 (file)
index 0000000..05e34a7
--- /dev/null
@@ -0,0 +1,390 @@
+# Copyright (c) 2005-2008 Zmanda, Inc.  All Rights Reserved.
+#
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License version 2.1 as
+# published by the Free Software Foundation.
+#
+# This 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 this library; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+#
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+package Amanda::Changer::disk;
+
+use strict;
+use warnings;
+use vars qw( @ISA );
+@ISA = qw( Amanda::Changer );
+
+use File::Glob qw( :glob );
+use File::Path;
+use Amanda::Config qw( :getconf );
+use Amanda::Debug;
+use Amanda::Changer;
+use Amanda::MainLoop;
+
+=head1 NAME
+
+Amanda::Changer::disk
+
+=head1 DESCRIPTION
+
+This changer operates within a root directory, specified in the changer
+string, which it arranges as follows:
+
+  $dir -|
+        |- drive0/ -|
+        |           | data -> '../slot4'
+        |- drive1/ -|
+        |           | data -> '../slot1'
+        |- current -> slot5
+        |- slot1/
+        |- slot2/
+        |- ...
+        |- slot$n/
+
+The user should create the desired number C<slot$n> subdirectories, and
+the changer will take care of dynamically creating the drives as needed,
+and track the "current" slot using the eponymous symlink.
+
+Drives are dynamically allocated as Amanda applications request access to
+particular slots.  Each drive is represented as a subdirectory containing a
+'data' symlink pointing to the "loaded" slot.
+
+=head1 TODO
+
+ - better locking (at least to work on a shared filesystem, if not NFS)
+ - manpage
+
+=cut
+
+sub new {
+    my $class = shift;
+    my ($cc, $tpchanger) = @_;
+    my ($dir) = ($tpchanger =~ /chg-disk:(.*)/);
+
+    # note that we don't track outstanding Reservation objects -- we know
+    # they're gone when they delete their drive directory
+    my $self = {
+       dir => $dir,
+    };
+
+    bless ($self, $class);
+    return $self;
+}
+
+sub load {
+    my $self = shift;
+    my %params = @_;
+
+    die "no res_cb supplied" unless (exists $params{'res_cb'});
+
+    if (exists $params{'slot'}) {
+        $self->_load_by_slot(%params);
+    } elsif (exists $params{'label'}) {
+        $self->_load_by_label(%params);
+    } else {
+       die "Invalid parameters to 'load'";
+    }
+}
+
+sub info {
+    my $self = shift;
+    my %params = @_;
+    my %results;
+
+    die "no info_cb supplied" unless (exists $params{'info_cb'});
+    die "no info supplied" unless (exists $params{'info'});
+
+    for my $inf (@{$params{'info'}}) {
+        if ($inf eq 'num_slots') {
+            my @slots = $self->_all_slots();
+            $results{$inf} = scalar @slots;
+        } else {
+            warn "Ignoring request for info key '$inf'";
+        }
+    }
+
+    Amanda::MainLoop::call_later($params{'info_cb'}, undef, %results);
+}
+
+sub reset {
+    my $self = shift;
+    my %params = @_;
+    my $slot;
+    my @slots = $self->_all_slots();
+
+    $slot = (scalar @slots)? $slots[0] : 0;
+    $self->_set_current($slot);
+
+    if (exists $params{'finished_cb'}) {
+       Amanda::MainLoop::call_later($params{'finished_cb'});
+    }
+}
+
+sub _load_by_slot {
+    my $self = shift;
+    my %params = @_;
+    my $slot = $params{'slot'};
+    my $drive;
+
+    if ($slot eq "current") {
+        $slot = $self->_get_current();
+    } elsif ($slot eq "next") {
+        $slot = $self->_get_current();
+        $slot = $self->_get_next($slot);
+    }
+
+    if (!$self->_slot_exists($slot)) {
+        Amanda::MainLoop::call_later($params{'res_cb'},
+                "Slot $slot not found", undef);
+        return;
+    }
+
+    if ($drive = $self->_is_slot_in_use($slot)) {
+        Amanda::MainLoop::call_later($params{'res_cb'},
+                "Slot $slot is already in use by drive '$drive'", undef);
+        return;
+    }
+
+    $drive = $self->_alloc_drive();
+    $self->_load_drive($drive, $slot);
+    $self->_set_current($slot) if ($params{'set_current'});
+
+    my $next_slot = $self->_get_next($slot);
+
+    Amanda::MainLoop::call_later($params{'res_cb'},
+            undef, Amanda::Changer::disk::Reservation->new($self, $drive, $slot, $next_slot));
+}
+
+sub _load_by_label {
+    my $self = shift;
+    my %params = @_;
+    my $label = $params{'label'};
+    my $slot;
+    my $drive;
+
+    $slot = $self->_find_label($label);
+    if (!defined $slot) {
+        Amanda::MainLoop::call_later($params{'res_cb'},
+            "Label '$label' not found", undef);
+       return;
+    }
+
+    if ($drive = $self->_is_slot_in_use($slot)) {
+        Amanda::MainLoop::call_later($params{'res_cb'},
+           "Slot $slot, containing '$label', is already in use by drive '$drive'", undef);
+    }
+
+    $drive = $self->_alloc_drive();
+    $self->_load_drive($drive, $slot);
+    $self->_set_current($slot) if ($params{'set_current'});
+
+    my $next_slot = $self->_get_next($slot);
+
+    Amanda::MainLoop::call_later($params{'res_cb'},
+            undef, Amanda::Changer::disk::Reservation->new($self, $drive, $slot, $next_slot));
+}
+
+# Internal function to find an unused (nonexistent) driveN subdirectory and
+# create it.  Note that this does not add a 'data' symlink inside the directory.
+sub _alloc_drive {
+    my ($self) = @_;
+    my $n = 0;
+
+    while (1) {
+       my $drive = $self->{'dir'} . "/drive$n";
+       $n++;
+
+       warn "$drive is not a directory; please remove it" if (-e $drive and ! -d $drive);
+       next if (-e $drive);
+       next if (!mkdir($drive)); # TODO probably not a very effective locking mechanism..
+
+       return $drive;
+    }
+}
+
+# Internal function to enumerate all available slots.  Slots are described by
+# integers.
+sub _all_slots {
+    my ($self) = @_;
+    my $dir = _quote_glob($self->{'dir'});
+    my @slots;
+
+    for my $slotname (bsd_glob("$dir/slot*/")) {
+       my $slot;
+       next unless (($slot) = ($slotname =~ /.*slot([0-9]+)\/$/));
+       push @slots, $slot + 0;
+    }
+
+    return sort @slots;
+}
+
+# Internal function to determine whether a slot exists.
+sub _slot_exists {
+    my ($self, $slot) = @_;
+    return (-d $self->{'dir'} . "/slot$slot");
+}
+
+# Internal function to determine if a slot (specified by number) is in use by a
+# drive, and return the path for that drive if so.
+sub _is_slot_in_use {
+    my ($self, $slot) = @_;
+    my $dir = _quote_glob($self->{'dir'});
+
+    for my $symlink (bsd_glob("$dir/drive*/data")) {
+       if (! -l $symlink) {
+           warn "'$symlink' is not a symlink; please remove it";
+           next;
+       }
+
+       my $target = readlink($symlink);
+       if (!$target) {
+           warn "could not read '$symlink': $!";
+           next;
+       }
+
+       my $tslot;
+       if (!(($tslot) = ($target =~ /..\/slot([0-9]+)/))) {
+           warn "invalid changer symlink '$symlink' -> '$target'";
+           next;
+       }
+
+       if ($tslot+0 == $slot) {
+           $symlink =~ s{/data$}{}; # strip the trailing '/data'
+           return $symlink;
+       }
+    }
+
+    return 0;
+}
+
+# Internal function to point a drive to a slot
+sub _load_drive {
+    my ($self, $drive, $slot) = @_;
+
+    die "'$drive' does not exist" unless (-d $drive);
+    if (-e "$drive/data") {
+       unlink("$drive/data");
+    }
+
+    symlink("../slot$slot", "$drive/data");
+    # TODO: read it to be sure??
+}
+
+# Internal function to return the slot containing a volume with the given
+# label.  This takes advantage of the naming convention used by vtapes.
+sub _find_label {
+    my ($self, $label) = @_;
+    my $dir = _quote_glob($self->{'dir'});
+    $label = _quote_glob($label);
+
+    my @tapelabels = bsd_glob("$dir/slot*/00000.$label");
+    if (!@tapelabels) {
+        return undef;
+    }
+
+    if (scalar @tapelabels > 1) {
+        warn "Multiple slots with label '$label': " . (join ", ", @tapelabels);
+    }
+
+    my ($slot) = ($tapelabels[0] =~ qr{/slot([0-9]+)/00000.});
+    return $slot;
+}
+
+# Internal function to get the next slot after $slot.
+sub _get_next {
+    my ($self, $slot) = @_;
+    my $next_slot;
+
+    # Try just incrementing the slot number
+    $next_slot = $slot+1;
+    return $next_slot if (-d $self->{'dir'} . "/slot$next_slot");
+
+    # Otherwise, search through all slots
+    my @all_slots = $self->_all_slots();
+    my $prev = $all_slots[-1];
+    for $next_slot (@all_slots) {
+        return $next_slot if ($prev == $slot);
+        $prev = $next_slot;
+    }
+
+    # not found? take a guess.
+    return $all_slots[0];
+}
+
+# Get the 'current' slot, represented as a symlink named 'current'
+sub _get_current {
+    my ($self) = @_;
+    my $curlink = $self->{'dir'} . "/current";
+
+    if (-l $curlink) {
+        my $target = readlink($curlink);
+        if ($target =~ "^slot([0-9]+)/?") {
+            return $1;
+        }
+    }
+
+    # get the first slot as a default
+    my @slots = $self->_all_slots();
+    return 0 unless (@slots);
+    return $slots[0];
+}
+
+# Set the 'current' slot
+sub _set_current {
+    my ($self, $slot) = @_;
+    my $curlink = $self->{'dir'} . "/current";
+
+    if (-e $curlink) {
+        unlink($curlink)
+            or die("Could not unlink '$curlink'");
+    }
+
+    # TODO: locking
+    symlink("slot$slot", $curlink);
+}
+
+# utility function
+sub _quote_glob {
+    my ($filename) = @_;
+    $filename =~ s/([]{}\\?*[])/\\$1/g;
+    return $filename;
+}
+
+package Amanda::Changer::disk::Reservation;
+use vars qw( @ISA );
+@ISA = qw( Amanda::Changer::Reservation );
+
+sub new {
+    my $class = shift;
+    my ($chg, $drive, $slot, $next_slot) = @_;
+    my $self = Amanda::Changer::Reservation::new($class);
+
+    $self->{'chg'} = $chg;
+    $self->{'drive'} = $drive;
+
+    $self->{'device_name'} = "file:$drive";
+    $self->{'this_slot'} = $slot;
+    $self->{'next_slot'} = $next_slot;
+
+    return $self;
+}
+
+sub do_release {
+    my $self = shift;
+    my %params = @_;
+    my $drive = $self->{'drive'};
+
+    unlink("$drive/data")
+       or warn("Could not unlink '$drive/data': $!");
+    rmdir("$drive")
+       or warn("Could not rmdir '$drive': $!");
+}
diff --git a/perl/Amanda/Changer/single.pm b/perl/Amanda/Changer/single.pm
new file mode 100644 (file)
index 0000000..33bf291
--- /dev/null
@@ -0,0 +1,125 @@
+# Copyright (c) 2005-2008 Zmanda, Inc.  All Rights Reserved.
+#
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License version 2.1 as
+# published by the Free Software Foundation.
+#
+# This 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 this library; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+#
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+package Amanda::Changer::single;
+
+use strict;
+use warnings;
+use vars qw( @ISA );
+@ISA = qw( Amanda::Changer );
+
+use File::Glob qw( :glob );
+use File::Path;
+use Amanda::Config qw( :getconf );
+use Amanda::Debug;
+use Amanda::Changer;
+use Amanda::MainLoop;
+
+=head1 NAME
+
+Amanda::Changer::single
+
+=head1 DESCRIPTION
+
+This changer represents a single drive as a changer.  It may eventually morph
+into something similar to the old C<chg-manual>.
+
+Whatever you load, you get the volume in the drive.  The volume's either
+reserved or not.  All pretty straightforward.
+
+=head1 TODO
+
+Support notifying the user that a tape is required, and some kind of "OK,
+loaded" feedback mechanism -- perhaps a utility script of some sort, or an
+amtape subcommand?
+
+=cut
+
+sub new {
+    my $class = shift;
+    my ($cc, $tpchanger) = @_;
+    my ($device_name) = ($tpchanger =~ /chg-single:(.*)/);
+
+    my $self = {
+       device_name => $device_name,
+       reserved => 0,
+    };
+
+    bless ($self, $class);
+    return $self;
+}
+
+sub load {
+    my $self = shift;
+    my %params = @_;
+
+    die "no res_cb supplied" unless (exists $params{'res_cb'});
+
+    if ($self->{'reserved'}) {
+       Amanda::MainLoop::call_later($params{'res_cb'},
+           "'{$self->{device_name}}' is already reserved", undef);
+    } else {
+       Amanda::MainLoop::call_later($params{'res_cb'},
+               undef, Amanda::Changer::single::Reservation->new($self));
+    }
+}
+
+sub info {
+    my $self = shift;
+    my %params = @_;
+    my %results;
+
+    die "no info_cb supplied" unless (exists $params{'info_cb'});
+    die "no info supplied" unless (exists $params{'info'});
+
+    for my $inf (@{$params{'info'}}) {
+        if ($inf eq 'num_slots') {
+            $results{$inf} = 1;
+        } else {
+            warn "Ignoring request for info key '$inf'";
+        }
+    }
+
+    Amanda::MainLoop::call_later($params{'info_cb'}, undef, %results);
+}
+
+package Amanda::Changer::single::Reservation;
+use vars qw( @ISA );
+@ISA = qw( Amanda::Changer::Reservation );
+
+sub new {
+    my $class = shift;
+    my ($chg, $drive, $next_slot) = @_;
+    my $self = Amanda::Changer::Reservation::new($class);
+
+    $self->{'chg'} = $chg;
+
+    $self->{'device_name'} = $chg->{'device_name'};
+    $self->{'this_slot'} = '1';
+    $self->{'next_slot'} = '1';
+    $chg->{'reserved'} = 1;
+
+    return $self;
+}
+
+sub do_release {
+    my $self = shift;
+    my %params = @_;
+
+    $self->{'chg'}->{'reserved'} = 0;
+}
index d23c52a686865e46dfc1c62e58b3b6cc5b584ff0..8388453d3c10a00fedb3b7acc092051a906dff91 100644 (file)
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.33
+ * Version 1.3.35
  * 
  * This file is not intended to be easily readable and contains a number of 
  * coding conventions designed to improve portability and efficiency. Do not make
 
 /* This should only be incremented when either the layout of swig_type_info changes,
    or for whatever reason, the runtime changes incompatibly */
-#define SWIG_RUNTIME_VERSION "3"
+#define SWIG_RUNTIME_VERSION "4"
 
 /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
 #ifdef SWIG_TYPE_TABLE
 
 /* Flags for pointer conversions */
 #define SWIG_POINTER_DISOWN        0x1
+#define SWIG_CAST_NEW_MEMORY       0x2
 
 /* Flags for new pointer objects */
 #define SWIG_POINTER_OWN           0x1
@@ -297,10 +298,10 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) {
 extern "C" {
 #endif
 
-typedef void *(*swig_converter_func)(void *);
+typedef void *(*swig_converter_func)(void *, int *);
 typedef struct swig_type_info *(*swig_dycast_func)(void **);
 
-/* Structure to store inforomation on one type */
+/* Structure to store information on one type */
 typedef struct swig_type_info {
   const char             *name;                        /* mangled name of this type */
   const char             *str;                 /* human readable name of this type */
@@ -427,8 +428,8 @@ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
   Cast a pointer up an inheritance hierarchy
 */
 SWIGRUNTIMEINLINE void *
-SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
-  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
 }
 
 /* 
@@ -1061,7 +1062,7 @@ SWIG_Perl_TypeProxyName(const swig_type_info *type) {
 
 SWIGRUNTIME swig_cast_info *
 SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
-  SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp((char*)iter->type->name, c) == 0)) 
+  SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp(iter->type->name, c) == 0)) 
                            || (iter->type->clientdata && (strcmp((char*)iter->type->clientdata, c) == 0))), ty);
 }
 
@@ -1119,7 +1120,11 @@ SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *
     if (!tc) {
       return SWIG_ERROR;
     }
-    *ptr = SWIG_TypeCast(tc,voidptr);
+    {
+      int newmemory = 0;
+      *ptr = SWIG_TypeCast(tc,voidptr,&newmemory);
+      assert(!newmemory); /* newmemory handling not yet implemented */
+    }
   } else {
     *ptr = voidptr;
   }
@@ -1294,7 +1299,7 @@ SWIG_Perl_GetModule(void) {
 
   /* first check if pointer already created */
   if (!type_pointer) {
-    pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE);
+    pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI);
     if (pointer && SvOK(pointer)) {
       type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
     }
@@ -1308,7 +1313,7 @@ SWIG_Perl_SetModule(swig_module_info *module) {
   SV *pointer;
 
   /* create a new pointer */
-  pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE);
+  pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI);
   sv_setiv(pointer, PTR2IV(module));
 }
 
@@ -1443,7 +1448,7 @@ static swig_module_info swig_module = {swig_types, 8, 0, 0, 0, 0};
 #define SWIG_name   "Amanda::Cmdlinec::boot_Amanda__Cmdline"
 #define SWIG_prefix "Amanda::Cmdlinec::"
 
-#define SWIGVERSION 0x010333 
+#define SWIGVERSION 0x010335 
 #define SWIG_VERSION SWIGVERSION
 
 
@@ -2230,7 +2235,7 @@ SWIGRUNTIME void
 SWIG_InitializeModule(void *clientdata) {
   size_t i;
   swig_module_info *module_head, *iter;
-  int found;
+  int found, init;
   
   clientdata = clientdata;
   
@@ -2240,6 +2245,9 @@ SWIG_InitializeModule(void *clientdata) {
     swig_module.type_initial = swig_type_initial;
     swig_module.cast_initial = swig_cast_initial;
     swig_module.next = &swig_module;
+    init = 1;
+  } else {
+    init = 0;
   }
   
   /* Try and load any already created modules */
@@ -2268,6 +2276,12 @@ SWIG_InitializeModule(void *clientdata) {
     module_head->next = &swig_module;
   }
   
+  /* When multiple interpeters are used, a module could have already been initialized in
+       a different interpreter, but not yet have a pointer in this interpreter.
+       In this case, we do not want to continue adding types... everything should be
+       set up already */
+  if (init == 0) return;
+  
   /* Now work on filling in swig_module.types */
 #ifdef SWIGRUNTIME_DEBUG
   printf("SWIG_InitializeModule: size %d\n", swig_module.size);
@@ -2421,7 +2435,7 @@ XS(SWIG_init) {
   /* Install variables */
   for (i = 0; swig_variables[i].name; i++) {
     SV *sv;
-    sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2);
+    sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI);
     if (swig_variables[i].type) {
       SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0);
     } else {
@@ -2433,7 +2447,7 @@ XS(SWIG_init) {
   /* Install constant */
   for (i = 0; swig_constants[i].type; i++) {
     SV *sv;
-    sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2);
+    sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI);
     switch(swig_constants[i].type) {
     case SWIG_INT:
       sv_setiv(sv, (IV) swig_constants[i].lvalue);
@@ -2457,18 +2471,18 @@ XS(SWIG_init) {
   }
   
   SWIG_TypeClientData(SWIGTYPE_p_dumpspec_t, (void*) "Amanda::Cmdline::dumpspec_t");
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CMDLINE_PARSE_DATESTAMP", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CMDLINE_PARSE_DATESTAMP", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CMDLINE_PARSE_DATESTAMP)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CMDLINE_PARSE_LEVEL", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CMDLINE_PARSE_LEVEL", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CMDLINE_PARSE_LEVEL)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CMDLINE_EMPTY_TO_WILDCARD", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CMDLINE_EMPTY_TO_WILDCARD", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CMDLINE_EMPTY_TO_WILDCARD)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
index fa99ed1c2023d58e1589954f9330ca892e1e93ac..fe6792f1d783084f6835ef925a109a2be241b345 100644 (file)
@@ -1,5 +1,5 @@
 # This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.33
+# Version 1.3.35
 #
 # Don't modify this file, modify the SWIG interface instead.
 
index 953edabafe35ef0aa84003c0197b8a082ce4ba60..9b0c6e99875a5c068f74b5ccdf8968b7420882c1 100644 (file)
@@ -14,8 +14,8 @@
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  *
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 %module "Amanda::Cmdline"
index dfd13c548ef461d44a6f5d6c370a116746227e0a..d32954d21e12181a82d515814463bbeeac878bba 100644 (file)
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.33
+ * Version 1.3.35
  * 
  * This file is not intended to be easily readable and contains a number of 
  * coding conventions designed to improve portability and efficiency. Do not make
 
 /* This should only be incremented when either the layout of swig_type_info changes,
    or for whatever reason, the runtime changes incompatibly */
-#define SWIG_RUNTIME_VERSION "3"
+#define SWIG_RUNTIME_VERSION "4"
 
 /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
 #ifdef SWIG_TYPE_TABLE
 
 /* Flags for pointer conversions */
 #define SWIG_POINTER_DISOWN        0x1
+#define SWIG_CAST_NEW_MEMORY       0x2
 
 /* Flags for new pointer objects */
 #define SWIG_POINTER_OWN           0x1
@@ -297,10 +298,10 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) {
 extern "C" {
 #endif
 
-typedef void *(*swig_converter_func)(void *);
+typedef void *(*swig_converter_func)(void *, int *);
 typedef struct swig_type_info *(*swig_dycast_func)(void **);
 
-/* Structure to store inforomation on one type */
+/* Structure to store information on one type */
 typedef struct swig_type_info {
   const char             *name;                        /* mangled name of this type */
   const char             *str;                 /* human readable name of this type */
@@ -427,8 +428,8 @@ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
   Cast a pointer up an inheritance hierarchy
 */
 SWIGRUNTIMEINLINE void *
-SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
-  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
 }
 
 /* 
@@ -1061,7 +1062,7 @@ SWIG_Perl_TypeProxyName(const swig_type_info *type) {
 
 SWIGRUNTIME swig_cast_info *
 SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
-  SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp((char*)iter->type->name, c) == 0)) 
+  SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp(iter->type->name, c) == 0)) 
                            || (iter->type->clientdata && (strcmp((char*)iter->type->clientdata, c) == 0))), ty);
 }
 
@@ -1119,7 +1120,11 @@ SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *
     if (!tc) {
       return SWIG_ERROR;
     }
-    *ptr = SWIG_TypeCast(tc,voidptr);
+    {
+      int newmemory = 0;
+      *ptr = SWIG_TypeCast(tc,voidptr,&newmemory);
+      assert(!newmemory); /* newmemory handling not yet implemented */
+    }
   } else {
     *ptr = voidptr;
   }
@@ -1294,7 +1299,7 @@ SWIG_Perl_GetModule(void) {
 
   /* first check if pointer already created */
   if (!type_pointer) {
-    pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE);
+    pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI);
     if (pointer && SvOK(pointer)) {
       type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
     }
@@ -1308,7 +1313,7 @@ SWIG_Perl_SetModule(swig_module_info *module) {
   SV *pointer;
 
   /* create a new pointer */
-  pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE);
+  pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI);
   sv_setiv(pointer, PTR2IV(module));
 }
 
@@ -1423,19 +1428,24 @@ SWIG_Perl_SetModule(swig_module_info *module) {
 
 /* -------- TYPES TABLE (BEGIN) -------- */
 
-#define SWIGTYPE_p_char swig_types[0]
-#define SWIGTYPE_p_config_overwrites_t swig_types[1]
-#define SWIGTYPE_p_double swig_types[2]
-#define SWIGTYPE_p_dumptype_t swig_types[3]
-#define SWIGTYPE_p_float swig_types[4]
-#define SWIGTYPE_p_holdingdisk_t swig_types[5]
-#define SWIGTYPE_p_int swig_types[6]
-#define SWIGTYPE_p_interface_t swig_types[7]
-#define SWIGTYPE_p_p_char swig_types[8]
-#define SWIGTYPE_p_tapetype_t swig_types[9]
-#define SWIGTYPE_p_unsigned_char swig_types[10]
-static swig_type_info *swig_types[12];
-static swig_module_info swig_module = {swig_types, 11, 0, 0, 0, 0};
+#define SWIGTYPE_p_application_t swig_types[0]
+#define SWIGTYPE_p_changer_config_t swig_types[1]
+#define SWIGTYPE_p_char swig_types[2]
+#define SWIGTYPE_p_config_overwrites_t swig_types[3]
+#define SWIGTYPE_p_device_config_t swig_types[4]
+#define SWIGTYPE_p_double swig_types[5]
+#define SWIGTYPE_p_dumptype_t swig_types[6]
+#define SWIGTYPE_p_float swig_types[7]
+#define SWIGTYPE_p_holdingdisk_t swig_types[8]
+#define SWIGTYPE_p_int swig_types[9]
+#define SWIGTYPE_p_interface_t swig_types[10]
+#define SWIGTYPE_p_p_GSList swig_types[11]
+#define SWIGTYPE_p_p_char swig_types[12]
+#define SWIGTYPE_p_pp_script_t swig_types[13]
+#define SWIGTYPE_p_tapetype_t swig_types[14]
+#define SWIGTYPE_p_unsigned_char swig_types[15]
+static swig_type_info *swig_types[17];
+static swig_module_info swig_module = {swig_types, 16, 0, 0, 0, 0};
 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
 
@@ -1446,7 +1456,7 @@ static swig_module_info swig_module = {swig_types, 11, 0, 0, 0, 0};
 #define SWIG_name   "Amanda::Configc::boot_Amanda__Config"
 #define SWIG_prefix "Amanda::Configc::"
 
-#define SWIGVERSION 0x010333 
+#define SWIGVERSION 0x010335 
 #define SWIG_VERSION SWIGVERSION
 
 
@@ -1675,6 +1685,14 @@ SWIG_AsCharPtrAndSize(SV *obj, char** cptr, size_t* psize, int *alloc)
 
 
 
+typedef char **val_t_strs;
+val_t_strs getconf_byname_strs(char *key, int str_needs_quotes) {
+    val_t *val = getconf_byname(key);
+    if (!val) return NULL;
+    return val_t_display_strs(val, str_needs_quotes);
+}
+
+
 SWIGINTERNINLINE SV *
 SWIG_FromCharPtrAndSize(const char* carray, size_t size)
 {
@@ -1694,11 +1712,6 @@ SWIG_FromCharPtr(const char *cptr)
   return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
 }
 
-
-    char *get_config_name(void) { return config_name; }
-    char *get_config_dir(void) { return config_dir; }
-    char *get_config_filename(void) { return config_filename; }
-
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -2105,123 +2118,131 @@ XS(_wrap_getconf) {
     }
     result = (val_t *)getconf(arg1);
     {
-      switch (result->type) {
-        case CONFTYPE_RATE: {
-          ST(argvi)= sv_newmortal();
-          sv_setnv(ST(argvi), val_t__rate(result)[0]);
-          argvi++;
+      if (!result) {
+        ST(argvi) = &PL_sv_undef;
+        argvi++;
+      } else {
+        switch (result->type) {
+          case CONFTYPE_RATE: {
+            ST(argvi)= sv_newmortal();
+            sv_setnv(ST(argvi), val_t__rate(result)[0]);
+            argvi++;
+            
+            ST(argvi)= sv_newmortal();
+            sv_setnv(ST(argvi), val_t__rate(result)[1]);
+            argvi++;
+            break;
+          }
+          
+          case CONFTYPE_INTRANGE: {
+            ST(argvi)= sv_newmortal();
+            sv_setiv(ST(argvi), val_t__intrange(result)[0]);
+            argvi++;
+            
+            ST(argvi)= sv_newmortal();
+            sv_setiv(ST(argvi), val_t__intrange(result)[1]);
+            argvi++;
+            break;
+            break;
+          }
+          
+          case CONFTYPE_EXINCLUDE: {
+            /* exincludes are represented in perl as {
+                        *      'list' : [ 'list1', 'list2', ..],
+                        *      'file' : [ 'file1', 'file2', ..],
+                        *      'optional' : 1,
+                        * }
+                        */
+            exinclude_t *ei = &val_t__exinclude(result);
+            AV *list_entries = (AV *)sv_2mortal((SV *)newAV());
+            AV *file_entries = (AV *)sv_2mortal((SV *)newAV());
+            SV *optional = sv_newmortal();
+            HV *hv;
+            sle_t *iter;
+            
+            /* first set up each of the hash values */
+            
+            if (ei->sl_list) {
+              for (iter = ei->sl_list->first; iter != NULL; iter = iter->next) {
+                av_push(list_entries, newSVpv(iter->name, 0));
+              }
+            }
+            
+            if(ei->sl_file) {
+              for (iter = ei->sl_file->first; iter != NULL; iter = iter->next) {
+                av_push(file_entries, newSVpv(iter->name, 0));
+              }
+            }
+            
+            sv_setiv(optional, ei->optional);
+            
+            /* now build the hash */
+            hv = (HV *)sv_2mortal((SV *)newHV());
+            
+            hv_store(hv, "file", 4, newRV((SV *)file_entries), 0);
+            hv_store(hv, "list", 4, newRV((SV *)list_entries), 0);
+            hv_store(hv, "optional", 8, optional, 0);
+            SvREFCNT_inc(optional);
+            
+            ST(argvi) = sv_2mortal(newRV((SV *)hv));
+            argvi++;
+            break;
+          }
           
-          ST(argvi)= sv_newmortal();
-          sv_setnv(ST(argvi), val_t__rate(result)[1]);
+        case CONFTYPE_PROPLIST:
+          ST(argvi) = sv_2mortal(g_hash_table_to_hashref_property(val_t__proplist(result)));
           argvi++;
           break;
-        }
-        
-        case CONFTYPE_INTRANGE: {
-          ST(argvi)= sv_newmortal();
-          sv_setiv(ST(argvi), val_t__intrange(result)[0]);
-          argvi++;
           
-          ST(argvi)= sv_newmortal();
-          sv_setiv(ST(argvi), val_t__intrange(result)[1]);
+        case CONFTYPE_SIZE:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__size(result)));
           argvi++;
           break;
-          break;
-        }
-        
-        case CONFTYPE_EXINCLUDE: {
-          /* exincludes are represented in perl as {
-                    *  'list' : [ 'list1', 'list2', ..],
-                    *  'file' : [ 'file1', 'file2', ..],
-                    *  'optional' : 1,
-                    * }
-                    */
-          exinclude_t *ei = &val_t__exinclude(result);
-          AV *list_entries = (AV *)sv_2mortal((SV *)newAV());
-          AV *file_entries = (AV *)sv_2mortal((SV *)newAV());
-          SV *optional = sv_newmortal();
-          HV *hv;
-          sle_t *iter;
-          
-          /* first set up each of the hash values */
-          
-          if (ei->sl_list) {
-            for (iter = ei->sl_list->first; iter != NULL; iter = iter->next) {
-              av_push(list_entries, newSVpv(iter->name, 0));
-            }
-          }
           
-          if(ei->sl_file) {
-            for (iter = ei->sl_file->first; iter != NULL; iter = iter->next) {
-              av_push(file_entries, newSVpv(iter->name, 0));
-            }
-          }
+        case CONFTYPE_INT64:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__int64(result)));
+          argvi++;
+          break;
           
-          sv_setiv(optional, ei->optional);
+          case CONFTYPE_BOOLEAN:           /* all same as INT.. */
+        case CONFTYPE_COMPRESS:
+        case CONFTYPE_ENCRYPT:
+        case CONFTYPE_ESTIMATE:
+        case CONFTYPE_STRATEGY:
+        case CONFTYPE_TAPERALGO:
+        case CONFTYPE_PRIORITY:
+        case CONFTYPE_HOLDING:
+        case CONFTYPE_EXECUTE_ON:
+        case CONFTYPE_EXECUTE_WHERE:
+        case CONFTYPE_SEND_AMREPORT_ON:
+        case CONFTYPE_INT:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__int(result)));
+          argvi++;
+          break;
           
-          /* now build the hash */
-          hv = (HV *)sv_2mortal((SV *)newHV());
+        case CONFTYPE_TIME:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__time(result)));
+          argvi++;
+          break;
           
-          hv_store(hv, "file", 4, newRV((SV *)file_entries), 0);
-          hv_store(hv, "list", 4, newRV((SV *)list_entries), 0);
-          hv_store(hv, "optional", 8, optional, 0);
-          SvREFCNT_inc(optional);
+        case CONFTYPE_REAL:
+          ST(argvi) = sv_newmortal();
+          sv_setnv(ST(argvi), val_t__real(result));
+          argvi++;
+          break;
           
-          ST(argvi) = sv_2mortal(newRV((SV *)hv));
+          case CONFTYPE_IDENT:     /* same as STRING */
+        case CONFTYPE_STR:
+          ST(argvi) = sv_newmortal();
+          sv_setpv(ST(argvi), val_t__str(result));
           argvi++;
           break;
+          
+          /* No match yet -> not one of the "complex" types */
+        default:
+          SWIG_exception(SWIG_TypeError, "Unknown val_t conftype");
+          break;
         }
-        
-      case CONFTYPE_PROPLIST:
-        ST(argvi) = sv_2mortal(g_hash_table_to_hashref(val_t__proplist(result)));
-        argvi++;
-        break;
-        
-      case CONFTYPE_SIZE:
-        ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__size(result)));
-        argvi++;
-        break;
-        
-      case CONFTYPE_AM64:
-        ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__am64(result)));
-        argvi++;
-        break;
-        
-        case CONFTYPE_BOOLEAN:     /* all same as INT.. */
-      case CONFTYPE_COMPRESS:
-      case CONFTYPE_ENCRYPT:
-      case CONFTYPE_ESTIMATE:
-      case CONFTYPE_STRATEGY:
-      case CONFTYPE_TAPERALGO:
-      case CONFTYPE_PRIORITY:
-      case CONFTYPE_HOLDING:
-      case CONFTYPE_INT:
-        ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__int(result)));
-        argvi++;
-        break;
-        
-      case CONFTYPE_TIME:
-        ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__time(result)));
-        argvi++;
-        break;
-        
-      case CONFTYPE_REAL:
-        ST(argvi) = sv_newmortal();
-        sv_setnv(ST(argvi), val_t__real(result));
-        argvi++;
-        break;
-        
-        case CONFTYPE_IDENT:       /* same as STRING */
-      case CONFTYPE_STR:
-        ST(argvi) = sv_newmortal();
-        sv_setpv(ST(argvi), val_t__str(result));
-        argvi++;
-        break;
-        
-        /* No match yet -> not one of the "complex" types */
-      default:
-        SWIG_exception(SWIG_TypeError, "Unknown val_t conftype");
-        break;
       }
     }
     
@@ -2290,123 +2311,131 @@ XS(_wrap_getconf_byname) {
     arg1 = (char *)(buf1);
     result = (val_t *)getconf_byname(arg1);
     {
-      switch (result->type) {
-        case CONFTYPE_RATE: {
-          ST(argvi)= sv_newmortal();
-          sv_setnv(ST(argvi), val_t__rate(result)[0]);
-          argvi++;
+      if (!result) {
+        ST(argvi) = &PL_sv_undef;
+        argvi++;
+      } else {
+        switch (result->type) {
+          case CONFTYPE_RATE: {
+            ST(argvi)= sv_newmortal();
+            sv_setnv(ST(argvi), val_t__rate(result)[0]);
+            argvi++;
+            
+            ST(argvi)= sv_newmortal();
+            sv_setnv(ST(argvi), val_t__rate(result)[1]);
+            argvi++;
+            break;
+          }
           
-          ST(argvi)= sv_newmortal();
-          sv_setnv(ST(argvi), val_t__rate(result)[1]);
+          case CONFTYPE_INTRANGE: {
+            ST(argvi)= sv_newmortal();
+            sv_setiv(ST(argvi), val_t__intrange(result)[0]);
+            argvi++;
+            
+            ST(argvi)= sv_newmortal();
+            sv_setiv(ST(argvi), val_t__intrange(result)[1]);
+            argvi++;
+            break;
+            break;
+          }
+          
+          case CONFTYPE_EXINCLUDE: {
+            /* exincludes are represented in perl as {
+                        *      'list' : [ 'list1', 'list2', ..],
+                        *      'file' : [ 'file1', 'file2', ..],
+                        *      'optional' : 1,
+                        * }
+                        */
+            exinclude_t *ei = &val_t__exinclude(result);
+            AV *list_entries = (AV *)sv_2mortal((SV *)newAV());
+            AV *file_entries = (AV *)sv_2mortal((SV *)newAV());
+            SV *optional = sv_newmortal();
+            HV *hv;
+            sle_t *iter;
+            
+            /* first set up each of the hash values */
+            
+            if (ei->sl_list) {
+              for (iter = ei->sl_list->first; iter != NULL; iter = iter->next) {
+                av_push(list_entries, newSVpv(iter->name, 0));
+              }
+            }
+            
+            if(ei->sl_file) {
+              for (iter = ei->sl_file->first; iter != NULL; iter = iter->next) {
+                av_push(file_entries, newSVpv(iter->name, 0));
+              }
+            }
+            
+            sv_setiv(optional, ei->optional);
+            
+            /* now build the hash */
+            hv = (HV *)sv_2mortal((SV *)newHV());
+            
+            hv_store(hv, "file", 4, newRV((SV *)file_entries), 0);
+            hv_store(hv, "list", 4, newRV((SV *)list_entries), 0);
+            hv_store(hv, "optional", 8, optional, 0);
+            SvREFCNT_inc(optional);
+            
+            ST(argvi) = sv_2mortal(newRV((SV *)hv));
+            argvi++;
+            break;
+          }
+          
+        case CONFTYPE_PROPLIST:
+          ST(argvi) = sv_2mortal(g_hash_table_to_hashref_property(val_t__proplist(result)));
           argvi++;
           break;
-        }
-        
-        case CONFTYPE_INTRANGE: {
-          ST(argvi)= sv_newmortal();
-          sv_setiv(ST(argvi), val_t__intrange(result)[0]);
-          argvi++;
           
-          ST(argvi)= sv_newmortal();
-          sv_setiv(ST(argvi), val_t__intrange(result)[1]);
+        case CONFTYPE_SIZE:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__size(result)));
           argvi++;
           break;
-          break;
-        }
-        
-        case CONFTYPE_EXINCLUDE: {
-          /* exincludes are represented in perl as {
-                    *  'list' : [ 'list1', 'list2', ..],
-                    *  'file' : [ 'file1', 'file2', ..],
-                    *  'optional' : 1,
-                    * }
-                    */
-          exinclude_t *ei = &val_t__exinclude(result);
-          AV *list_entries = (AV *)sv_2mortal((SV *)newAV());
-          AV *file_entries = (AV *)sv_2mortal((SV *)newAV());
-          SV *optional = sv_newmortal();
-          HV *hv;
-          sle_t *iter;
-          
-          /* first set up each of the hash values */
-          
-          if (ei->sl_list) {
-            for (iter = ei->sl_list->first; iter != NULL; iter = iter->next) {
-              av_push(list_entries, newSVpv(iter->name, 0));
-            }
-          }
           
-          if(ei->sl_file) {
-            for (iter = ei->sl_file->first; iter != NULL; iter = iter->next) {
-              av_push(file_entries, newSVpv(iter->name, 0));
-            }
-          }
+        case CONFTYPE_INT64:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__int64(result)));
+          argvi++;
+          break;
           
-          sv_setiv(optional, ei->optional);
+          case CONFTYPE_BOOLEAN:           /* all same as INT.. */
+        case CONFTYPE_COMPRESS:
+        case CONFTYPE_ENCRYPT:
+        case CONFTYPE_ESTIMATE:
+        case CONFTYPE_STRATEGY:
+        case CONFTYPE_TAPERALGO:
+        case CONFTYPE_PRIORITY:
+        case CONFTYPE_HOLDING:
+        case CONFTYPE_EXECUTE_ON:
+        case CONFTYPE_EXECUTE_WHERE:
+        case CONFTYPE_SEND_AMREPORT_ON:
+        case CONFTYPE_INT:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__int(result)));
+          argvi++;
+          break;
           
-          /* now build the hash */
-          hv = (HV *)sv_2mortal((SV *)newHV());
+        case CONFTYPE_TIME:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__time(result)));
+          argvi++;
+          break;
           
-          hv_store(hv, "file", 4, newRV((SV *)file_entries), 0);
-          hv_store(hv, "list", 4, newRV((SV *)list_entries), 0);
-          hv_store(hv, "optional", 8, optional, 0);
-          SvREFCNT_inc(optional);
+        case CONFTYPE_REAL:
+          ST(argvi) = sv_newmortal();
+          sv_setnv(ST(argvi), val_t__real(result));
+          argvi++;
+          break;
           
-          ST(argvi) = sv_2mortal(newRV((SV *)hv));
+          case CONFTYPE_IDENT:     /* same as STRING */
+        case CONFTYPE_STR:
+          ST(argvi) = sv_newmortal();
+          sv_setpv(ST(argvi), val_t__str(result));
           argvi++;
           break;
+          
+          /* No match yet -> not one of the "complex" types */
+        default:
+          SWIG_exception(SWIG_TypeError, "Unknown val_t conftype");
+          break;
         }
-        
-      case CONFTYPE_PROPLIST:
-        ST(argvi) = sv_2mortal(g_hash_table_to_hashref(val_t__proplist(result)));
-        argvi++;
-        break;
-        
-      case CONFTYPE_SIZE:
-        ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__size(result)));
-        argvi++;
-        break;
-        
-      case CONFTYPE_AM64:
-        ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__am64(result)));
-        argvi++;
-        break;
-        
-        case CONFTYPE_BOOLEAN:     /* all same as INT.. */
-      case CONFTYPE_COMPRESS:
-      case CONFTYPE_ENCRYPT:
-      case CONFTYPE_ESTIMATE:
-      case CONFTYPE_STRATEGY:
-      case CONFTYPE_TAPERALGO:
-      case CONFTYPE_PRIORITY:
-      case CONFTYPE_HOLDING:
-      case CONFTYPE_INT:
-        ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__int(result)));
-        argvi++;
-        break;
-        
-      case CONFTYPE_TIME:
-        ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__time(result)));
-        argvi++;
-        break;
-        
-      case CONFTYPE_REAL:
-        ST(argvi) = sv_newmortal();
-        sv_setnv(ST(argvi), val_t__real(result));
-        argvi++;
-        break;
-        
-        case CONFTYPE_IDENT:       /* same as STRING */
-      case CONFTYPE_STR:
-        ST(argvi) = sv_newmortal();
-        sv_setpv(ST(argvi), val_t__str(result));
-        argvi++;
-        break;
-        
-        /* No match yet -> not one of the "complex" types */
-      default:
-        SWIG_exception(SWIG_TypeError, "Unknown val_t conftype");
-        break;
       }
     }
     if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
@@ -2457,6 +2486,60 @@ XS(_wrap_getconf_list) {
 }
 
 
+XS(_wrap_getconf_byname_strs) {
+  {
+    char *arg1 = (char *) 0 ;
+    int arg2 ;
+    val_t_strs result;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: getconf_byname_strs(key,str_needs_quotes);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getconf_byname_strs" "', argument " "1"" of type '" "char *""'");
+    }
+    arg1 = (char *)(buf1);
+    {
+      if (sizeof(signed int) == 1) {
+        arg2 = amglue_SvI8(ST(1));
+      } else if (sizeof(signed int) == 2) {
+        arg2 = amglue_SvI16(ST(1));
+      } else if (sizeof(signed int) == 4) {
+        arg2 = amglue_SvI32(ST(1));
+      } else if (sizeof(signed int) == 8) {
+        arg2 = amglue_SvI64(ST(1));
+      } else {
+        g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
+      }
+    }
+    result = (val_t_strs)getconf_byname_strs(arg1,arg2);
+    {
+      char **it = result;
+      
+      while (it && *it) {
+        ST(argvi) = sv_2mortal(newSVpv(*it, 0));
+        argvi++;
+        it++;
+      }
+      g_strfreev(result);
+    }
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    
+    SWIG_croak_null();
+  }
+}
+
+
 XS(_wrap_lookup_tapetype) {
   {
     char *arg1 = (char *) 0 ;
@@ -2519,123 +2602,131 @@ XS(_wrap_tapetype_getconf) {
     }
     result = (val_t *)tapetype_getconf(arg1,arg2);
     {
-      switch (result->type) {
-        case CONFTYPE_RATE: {
-          ST(argvi)= sv_newmortal();
-          sv_setnv(ST(argvi), val_t__rate(result)[0]);
-          argvi++;
+      if (!result) {
+        ST(argvi) = &PL_sv_undef;
+        argvi++;
+      } else {
+        switch (result->type) {
+          case CONFTYPE_RATE: {
+            ST(argvi)= sv_newmortal();
+            sv_setnv(ST(argvi), val_t__rate(result)[0]);
+            argvi++;
+            
+            ST(argvi)= sv_newmortal();
+            sv_setnv(ST(argvi), val_t__rate(result)[1]);
+            argvi++;
+            break;
+          }
           
-          ST(argvi)= sv_newmortal();
-          sv_setnv(ST(argvi), val_t__rate(result)[1]);
+          case CONFTYPE_INTRANGE: {
+            ST(argvi)= sv_newmortal();
+            sv_setiv(ST(argvi), val_t__intrange(result)[0]);
+            argvi++;
+            
+            ST(argvi)= sv_newmortal();
+            sv_setiv(ST(argvi), val_t__intrange(result)[1]);
+            argvi++;
+            break;
+            break;
+          }
+          
+          case CONFTYPE_EXINCLUDE: {
+            /* exincludes are represented in perl as {
+                        *      'list' : [ 'list1', 'list2', ..],
+                        *      'file' : [ 'file1', 'file2', ..],
+                        *      'optional' : 1,
+                        * }
+                        */
+            exinclude_t *ei = &val_t__exinclude(result);
+            AV *list_entries = (AV *)sv_2mortal((SV *)newAV());
+            AV *file_entries = (AV *)sv_2mortal((SV *)newAV());
+            SV *optional = sv_newmortal();
+            HV *hv;
+            sle_t *iter;
+            
+            /* first set up each of the hash values */
+            
+            if (ei->sl_list) {
+              for (iter = ei->sl_list->first; iter != NULL; iter = iter->next) {
+                av_push(list_entries, newSVpv(iter->name, 0));
+              }
+            }
+            
+            if(ei->sl_file) {
+              for (iter = ei->sl_file->first; iter != NULL; iter = iter->next) {
+                av_push(file_entries, newSVpv(iter->name, 0));
+              }
+            }
+            
+            sv_setiv(optional, ei->optional);
+            
+            /* now build the hash */
+            hv = (HV *)sv_2mortal((SV *)newHV());
+            
+            hv_store(hv, "file", 4, newRV((SV *)file_entries), 0);
+            hv_store(hv, "list", 4, newRV((SV *)list_entries), 0);
+            hv_store(hv, "optional", 8, optional, 0);
+            SvREFCNT_inc(optional);
+            
+            ST(argvi) = sv_2mortal(newRV((SV *)hv));
+            argvi++;
+            break;
+          }
+          
+        case CONFTYPE_PROPLIST:
+          ST(argvi) = sv_2mortal(g_hash_table_to_hashref_property(val_t__proplist(result)));
           argvi++;
           break;
-        }
-        
-        case CONFTYPE_INTRANGE: {
-          ST(argvi)= sv_newmortal();
-          sv_setiv(ST(argvi), val_t__intrange(result)[0]);
-          argvi++;
           
-          ST(argvi)= sv_newmortal();
-          sv_setiv(ST(argvi), val_t__intrange(result)[1]);
+        case CONFTYPE_SIZE:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__size(result)));
           argvi++;
           break;
-          break;
-        }
-        
-        case CONFTYPE_EXINCLUDE: {
-          /* exincludes are represented in perl as {
-                    *  'list' : [ 'list1', 'list2', ..],
-                    *  'file' : [ 'file1', 'file2', ..],
-                    *  'optional' : 1,
-                    * }
-                    */
-          exinclude_t *ei = &val_t__exinclude(result);
-          AV *list_entries = (AV *)sv_2mortal((SV *)newAV());
-          AV *file_entries = (AV *)sv_2mortal((SV *)newAV());
-          SV *optional = sv_newmortal();
-          HV *hv;
-          sle_t *iter;
-          
-          /* first set up each of the hash values */
-          
-          if (ei->sl_list) {
-            for (iter = ei->sl_list->first; iter != NULL; iter = iter->next) {
-              av_push(list_entries, newSVpv(iter->name, 0));
-            }
-          }
           
-          if(ei->sl_file) {
-            for (iter = ei->sl_file->first; iter != NULL; iter = iter->next) {
-              av_push(file_entries, newSVpv(iter->name, 0));
-            }
-          }
+        case CONFTYPE_INT64:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__int64(result)));
+          argvi++;
+          break;
           
-          sv_setiv(optional, ei->optional);
+          case CONFTYPE_BOOLEAN:           /* all same as INT.. */
+        case CONFTYPE_COMPRESS:
+        case CONFTYPE_ENCRYPT:
+        case CONFTYPE_ESTIMATE:
+        case CONFTYPE_STRATEGY:
+        case CONFTYPE_TAPERALGO:
+        case CONFTYPE_PRIORITY:
+        case CONFTYPE_HOLDING:
+        case CONFTYPE_EXECUTE_ON:
+        case CONFTYPE_EXECUTE_WHERE:
+        case CONFTYPE_SEND_AMREPORT_ON:
+        case CONFTYPE_INT:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__int(result)));
+          argvi++;
+          break;
           
-          /* now build the hash */
-          hv = (HV *)sv_2mortal((SV *)newHV());
+        case CONFTYPE_TIME:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__time(result)));
+          argvi++;
+          break;
           
-          hv_store(hv, "file", 4, newRV((SV *)file_entries), 0);
-          hv_store(hv, "list", 4, newRV((SV *)list_entries), 0);
-          hv_store(hv, "optional", 8, optional, 0);
-          SvREFCNT_inc(optional);
+        case CONFTYPE_REAL:
+          ST(argvi) = sv_newmortal();
+          sv_setnv(ST(argvi), val_t__real(result));
+          argvi++;
+          break;
           
-          ST(argvi) = sv_2mortal(newRV((SV *)hv));
+          case CONFTYPE_IDENT:     /* same as STRING */
+        case CONFTYPE_STR:
+          ST(argvi) = sv_newmortal();
+          sv_setpv(ST(argvi), val_t__str(result));
           argvi++;
           break;
+          
+          /* No match yet -> not one of the "complex" types */
+        default:
+          SWIG_exception(SWIG_TypeError, "Unknown val_t conftype");
+          break;
         }
-        
-      case CONFTYPE_PROPLIST:
-        ST(argvi) = sv_2mortal(g_hash_table_to_hashref(val_t__proplist(result)));
-        argvi++;
-        break;
-        
-      case CONFTYPE_SIZE:
-        ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__size(result)));
-        argvi++;
-        break;
-        
-      case CONFTYPE_AM64:
-        ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__am64(result)));
-        argvi++;
-        break;
-        
-        case CONFTYPE_BOOLEAN:     /* all same as INT.. */
-      case CONFTYPE_COMPRESS:
-      case CONFTYPE_ENCRYPT:
-      case CONFTYPE_ESTIMATE:
-      case CONFTYPE_STRATEGY:
-      case CONFTYPE_TAPERALGO:
-      case CONFTYPE_PRIORITY:
-      case CONFTYPE_HOLDING:
-      case CONFTYPE_INT:
-        ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__int(result)));
-        argvi++;
-        break;
-        
-      case CONFTYPE_TIME:
-        ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__time(result)));
-        argvi++;
-        break;
-        
-      case CONFTYPE_REAL:
-        ST(argvi) = sv_newmortal();
-        sv_setnv(ST(argvi), val_t__real(result));
-        argvi++;
-        break;
-        
-        case CONFTYPE_IDENT:       /* same as STRING */
-      case CONFTYPE_STR:
-        ST(argvi) = sv_newmortal();
-        sv_setpv(ST(argvi), val_t__str(result));
-        argvi++;
-        break;
-        
-        /* No match yet -> not one of the "complex" types */
-      default:
-        SWIG_exception(SWIG_TypeError, "Unknown val_t conftype");
-        break;
       }
     }
     
@@ -2786,123 +2877,131 @@ XS(_wrap_dumptype_getconf) {
     }
     result = (val_t *)dumptype_getconf(arg1,arg2);
     {
-      switch (result->type) {
-        case CONFTYPE_RATE: {
-          ST(argvi)= sv_newmortal();
-          sv_setnv(ST(argvi), val_t__rate(result)[0]);
-          argvi++;
+      if (!result) {
+        ST(argvi) = &PL_sv_undef;
+        argvi++;
+      } else {
+        switch (result->type) {
+          case CONFTYPE_RATE: {
+            ST(argvi)= sv_newmortal();
+            sv_setnv(ST(argvi), val_t__rate(result)[0]);
+            argvi++;
+            
+            ST(argvi)= sv_newmortal();
+            sv_setnv(ST(argvi), val_t__rate(result)[1]);
+            argvi++;
+            break;
+          }
+          
+          case CONFTYPE_INTRANGE: {
+            ST(argvi)= sv_newmortal();
+            sv_setiv(ST(argvi), val_t__intrange(result)[0]);
+            argvi++;
+            
+            ST(argvi)= sv_newmortal();
+            sv_setiv(ST(argvi), val_t__intrange(result)[1]);
+            argvi++;
+            break;
+            break;
+          }
+          
+          case CONFTYPE_EXINCLUDE: {
+            /* exincludes are represented in perl as {
+                        *      'list' : [ 'list1', 'list2', ..],
+                        *      'file' : [ 'file1', 'file2', ..],
+                        *      'optional' : 1,
+                        * }
+                        */
+            exinclude_t *ei = &val_t__exinclude(result);
+            AV *list_entries = (AV *)sv_2mortal((SV *)newAV());
+            AV *file_entries = (AV *)sv_2mortal((SV *)newAV());
+            SV *optional = sv_newmortal();
+            HV *hv;
+            sle_t *iter;
+            
+            /* first set up each of the hash values */
+            
+            if (ei->sl_list) {
+              for (iter = ei->sl_list->first; iter != NULL; iter = iter->next) {
+                av_push(list_entries, newSVpv(iter->name, 0));
+              }
+            }
+            
+            if(ei->sl_file) {
+              for (iter = ei->sl_file->first; iter != NULL; iter = iter->next) {
+                av_push(file_entries, newSVpv(iter->name, 0));
+              }
+            }
+            
+            sv_setiv(optional, ei->optional);
+            
+            /* now build the hash */
+            hv = (HV *)sv_2mortal((SV *)newHV());
+            
+            hv_store(hv, "file", 4, newRV((SV *)file_entries), 0);
+            hv_store(hv, "list", 4, newRV((SV *)list_entries), 0);
+            hv_store(hv, "optional", 8, optional, 0);
+            SvREFCNT_inc(optional);
+            
+            ST(argvi) = sv_2mortal(newRV((SV *)hv));
+            argvi++;
+            break;
+          }
           
-          ST(argvi)= sv_newmortal();
-          sv_setnv(ST(argvi), val_t__rate(result)[1]);
+        case CONFTYPE_PROPLIST:
+          ST(argvi) = sv_2mortal(g_hash_table_to_hashref_property(val_t__proplist(result)));
           argvi++;
           break;
-        }
-        
-        case CONFTYPE_INTRANGE: {
-          ST(argvi)= sv_newmortal();
-          sv_setiv(ST(argvi), val_t__intrange(result)[0]);
-          argvi++;
           
-          ST(argvi)= sv_newmortal();
-          sv_setiv(ST(argvi), val_t__intrange(result)[1]);
+        case CONFTYPE_SIZE:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__size(result)));
           argvi++;
           break;
-          break;
-        }
-        
-        case CONFTYPE_EXINCLUDE: {
-          /* exincludes are represented in perl as {
-                    *  'list' : [ 'list1', 'list2', ..],
-                    *  'file' : [ 'file1', 'file2', ..],
-                    *  'optional' : 1,
-                    * }
-                    */
-          exinclude_t *ei = &val_t__exinclude(result);
-          AV *list_entries = (AV *)sv_2mortal((SV *)newAV());
-          AV *file_entries = (AV *)sv_2mortal((SV *)newAV());
-          SV *optional = sv_newmortal();
-          HV *hv;
-          sle_t *iter;
-          
-          /* first set up each of the hash values */
           
-          if (ei->sl_list) {
-            for (iter = ei->sl_list->first; iter != NULL; iter = iter->next) {
-              av_push(list_entries, newSVpv(iter->name, 0));
-            }
-          }
-          
-          if(ei->sl_file) {
-            for (iter = ei->sl_file->first; iter != NULL; iter = iter->next) {
-              av_push(file_entries, newSVpv(iter->name, 0));
-            }
-          }
+        case CONFTYPE_INT64:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__int64(result)));
+          argvi++;
+          break;
           
-          sv_setiv(optional, ei->optional);
+          case CONFTYPE_BOOLEAN:           /* all same as INT.. */
+        case CONFTYPE_COMPRESS:
+        case CONFTYPE_ENCRYPT:
+        case CONFTYPE_ESTIMATE:
+        case CONFTYPE_STRATEGY:
+        case CONFTYPE_TAPERALGO:
+        case CONFTYPE_PRIORITY:
+        case CONFTYPE_HOLDING:
+        case CONFTYPE_EXECUTE_ON:
+        case CONFTYPE_EXECUTE_WHERE:
+        case CONFTYPE_SEND_AMREPORT_ON:
+        case CONFTYPE_INT:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__int(result)));
+          argvi++;
+          break;
           
-          /* now build the hash */
-          hv = (HV *)sv_2mortal((SV *)newHV());
+        case CONFTYPE_TIME:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__time(result)));
+          argvi++;
+          break;
           
-          hv_store(hv, "file", 4, newRV((SV *)file_entries), 0);
-          hv_store(hv, "list", 4, newRV((SV *)list_entries), 0);
-          hv_store(hv, "optional", 8, optional, 0);
-          SvREFCNT_inc(optional);
+        case CONFTYPE_REAL:
+          ST(argvi) = sv_newmortal();
+          sv_setnv(ST(argvi), val_t__real(result));
+          argvi++;
+          break;
           
-          ST(argvi) = sv_2mortal(newRV((SV *)hv));
+          case CONFTYPE_IDENT:     /* same as STRING */
+        case CONFTYPE_STR:
+          ST(argvi) = sv_newmortal();
+          sv_setpv(ST(argvi), val_t__str(result));
           argvi++;
           break;
+          
+          /* No match yet -> not one of the "complex" types */
+        default:
+          SWIG_exception(SWIG_TypeError, "Unknown val_t conftype");
+          break;
         }
-        
-      case CONFTYPE_PROPLIST:
-        ST(argvi) = sv_2mortal(g_hash_table_to_hashref(val_t__proplist(result)));
-        argvi++;
-        break;
-        
-      case CONFTYPE_SIZE:
-        ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__size(result)));
-        argvi++;
-        break;
-        
-      case CONFTYPE_AM64:
-        ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__am64(result)));
-        argvi++;
-        break;
-        
-        case CONFTYPE_BOOLEAN:     /* all same as INT.. */
-      case CONFTYPE_COMPRESS:
-      case CONFTYPE_ENCRYPT:
-      case CONFTYPE_ESTIMATE:
-      case CONFTYPE_STRATEGY:
-      case CONFTYPE_TAPERALGO:
-      case CONFTYPE_PRIORITY:
-      case CONFTYPE_HOLDING:
-      case CONFTYPE_INT:
-        ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__int(result)));
-        argvi++;
-        break;
-        
-      case CONFTYPE_TIME:
-        ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__time(result)));
-        argvi++;
-        break;
-        
-      case CONFTYPE_REAL:
-        ST(argvi) = sv_newmortal();
-        sv_setnv(ST(argvi), val_t__real(result));
-        argvi++;
-        break;
-        
-        case CONFTYPE_IDENT:       /* same as STRING */
-      case CONFTYPE_STR:
-        ST(argvi) = sv_newmortal();
-        sv_setpv(ST(argvi), val_t__str(result));
-        argvi++;
-        break;
-        
-        /* No match yet -> not one of the "complex" types */
-      default:
-        SWIG_exception(SWIG_TypeError, "Unknown val_t conftype");
-        break;
       }
     }
     
@@ -3053,123 +3152,131 @@ XS(_wrap_interface_getconf) {
     }
     result = (val_t *)interface_getconf(arg1,arg2);
     {
-      switch (result->type) {
-        case CONFTYPE_RATE: {
-          ST(argvi)= sv_newmortal();
-          sv_setnv(ST(argvi), val_t__rate(result)[0]);
-          argvi++;
+      if (!result) {
+        ST(argvi) = &PL_sv_undef;
+        argvi++;
+      } else {
+        switch (result->type) {
+          case CONFTYPE_RATE: {
+            ST(argvi)= sv_newmortal();
+            sv_setnv(ST(argvi), val_t__rate(result)[0]);
+            argvi++;
+            
+            ST(argvi)= sv_newmortal();
+            sv_setnv(ST(argvi), val_t__rate(result)[1]);
+            argvi++;
+            break;
+          }
+          
+          case CONFTYPE_INTRANGE: {
+            ST(argvi)= sv_newmortal();
+            sv_setiv(ST(argvi), val_t__intrange(result)[0]);
+            argvi++;
+            
+            ST(argvi)= sv_newmortal();
+            sv_setiv(ST(argvi), val_t__intrange(result)[1]);
+            argvi++;
+            break;
+            break;
+          }
+          
+          case CONFTYPE_EXINCLUDE: {
+            /* exincludes are represented in perl as {
+                        *      'list' : [ 'list1', 'list2', ..],
+                        *      'file' : [ 'file1', 'file2', ..],
+                        *      'optional' : 1,
+                        * }
+                        */
+            exinclude_t *ei = &val_t__exinclude(result);
+            AV *list_entries = (AV *)sv_2mortal((SV *)newAV());
+            AV *file_entries = (AV *)sv_2mortal((SV *)newAV());
+            SV *optional = sv_newmortal();
+            HV *hv;
+            sle_t *iter;
+            
+            /* first set up each of the hash values */
+            
+            if (ei->sl_list) {
+              for (iter = ei->sl_list->first; iter != NULL; iter = iter->next) {
+                av_push(list_entries, newSVpv(iter->name, 0));
+              }
+            }
+            
+            if(ei->sl_file) {
+              for (iter = ei->sl_file->first; iter != NULL; iter = iter->next) {
+                av_push(file_entries, newSVpv(iter->name, 0));
+              }
+            }
+            
+            sv_setiv(optional, ei->optional);
+            
+            /* now build the hash */
+            hv = (HV *)sv_2mortal((SV *)newHV());
+            
+            hv_store(hv, "file", 4, newRV((SV *)file_entries), 0);
+            hv_store(hv, "list", 4, newRV((SV *)list_entries), 0);
+            hv_store(hv, "optional", 8, optional, 0);
+            SvREFCNT_inc(optional);
+            
+            ST(argvi) = sv_2mortal(newRV((SV *)hv));
+            argvi++;
+            break;
+          }
           
-          ST(argvi)= sv_newmortal();
-          sv_setnv(ST(argvi), val_t__rate(result)[1]);
+        case CONFTYPE_PROPLIST:
+          ST(argvi) = sv_2mortal(g_hash_table_to_hashref_property(val_t__proplist(result)));
           argvi++;
           break;
-        }
-        
-        case CONFTYPE_INTRANGE: {
-          ST(argvi)= sv_newmortal();
-          sv_setiv(ST(argvi), val_t__intrange(result)[0]);
+          
+        case CONFTYPE_SIZE:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__size(result)));
           argvi++;
+          break;
           
-          ST(argvi)= sv_newmortal();
-          sv_setiv(ST(argvi), val_t__intrange(result)[1]);
+        case CONFTYPE_INT64:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__int64(result)));
           argvi++;
           break;
+          
+          case CONFTYPE_BOOLEAN:           /* all same as INT.. */
+        case CONFTYPE_COMPRESS:
+        case CONFTYPE_ENCRYPT:
+        case CONFTYPE_ESTIMATE:
+        case CONFTYPE_STRATEGY:
+        case CONFTYPE_TAPERALGO:
+        case CONFTYPE_PRIORITY:
+        case CONFTYPE_HOLDING:
+        case CONFTYPE_EXECUTE_ON:
+        case CONFTYPE_EXECUTE_WHERE:
+        case CONFTYPE_SEND_AMREPORT_ON:
+        case CONFTYPE_INT:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__int(result)));
+          argvi++;
           break;
-        }
-        
-        case CONFTYPE_EXINCLUDE: {
-          /* exincludes are represented in perl as {
-                    *  'list' : [ 'list1', 'list2', ..],
-                    *  'file' : [ 'file1', 'file2', ..],
-                    *  'optional' : 1,
-                    * }
-                    */
-          exinclude_t *ei = &val_t__exinclude(result);
-          AV *list_entries = (AV *)sv_2mortal((SV *)newAV());
-          AV *file_entries = (AV *)sv_2mortal((SV *)newAV());
-          SV *optional = sv_newmortal();
-          HV *hv;
-          sle_t *iter;
           
-          /* first set up each of the hash values */
+        case CONFTYPE_TIME:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__time(result)));
+          argvi++;
+          break;
           
-          if (ei->sl_list) {
-            for (iter = ei->sl_list->first; iter != NULL; iter = iter->next) {
-              av_push(list_entries, newSVpv(iter->name, 0));
-            }
-          }
+        case CONFTYPE_REAL:
+          ST(argvi) = sv_newmortal();
+          sv_setnv(ST(argvi), val_t__real(result));
+          argvi++;
+          break;
           
-          if(ei->sl_file) {
-            for (iter = ei->sl_file->first; iter != NULL; iter = iter->next) {
-              av_push(file_entries, newSVpv(iter->name, 0));
-            }
-          }
+          case CONFTYPE_IDENT:     /* same as STRING */
+        case CONFTYPE_STR:
+          ST(argvi) = sv_newmortal();
+          sv_setpv(ST(argvi), val_t__str(result));
+          argvi++;
+          break;
           
-          sv_setiv(optional, ei->optional);
-          
-          /* now build the hash */
-          hv = (HV *)sv_2mortal((SV *)newHV());
-          
-          hv_store(hv, "file", 4, newRV((SV *)file_entries), 0);
-          hv_store(hv, "list", 4, newRV((SV *)list_entries), 0);
-          hv_store(hv, "optional", 8, optional, 0);
-          SvREFCNT_inc(optional);
-          
-          ST(argvi) = sv_2mortal(newRV((SV *)hv));
-          argvi++;
+          /* No match yet -> not one of the "complex" types */
+        default:
+          SWIG_exception(SWIG_TypeError, "Unknown val_t conftype");
           break;
         }
-        
-      case CONFTYPE_PROPLIST:
-        ST(argvi) = sv_2mortal(g_hash_table_to_hashref(val_t__proplist(result)));
-        argvi++;
-        break;
-        
-      case CONFTYPE_SIZE:
-        ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__size(result)));
-        argvi++;
-        break;
-        
-      case CONFTYPE_AM64:
-        ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__am64(result)));
-        argvi++;
-        break;
-        
-        case CONFTYPE_BOOLEAN:     /* all same as INT.. */
-      case CONFTYPE_COMPRESS:
-      case CONFTYPE_ENCRYPT:
-      case CONFTYPE_ESTIMATE:
-      case CONFTYPE_STRATEGY:
-      case CONFTYPE_TAPERALGO:
-      case CONFTYPE_PRIORITY:
-      case CONFTYPE_HOLDING:
-      case CONFTYPE_INT:
-        ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__int(result)));
-        argvi++;
-        break;
-        
-      case CONFTYPE_TIME:
-        ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__time(result)));
-        argvi++;
-        break;
-        
-      case CONFTYPE_REAL:
-        ST(argvi) = sv_newmortal();
-        sv_setnv(ST(argvi), val_t__real(result));
-        argvi++;
-        break;
-        
-        case CONFTYPE_IDENT:       /* same as STRING */
-      case CONFTYPE_STR:
-        ST(argvi) = sv_newmortal();
-        sv_setpv(ST(argvi), val_t__str(result));
-        argvi++;
-        break;
-        
-        /* No match yet -> not one of the "complex" types */
-      default:
-        SWIG_exception(SWIG_TypeError, "Unknown val_t conftype");
-        break;
       }
     }
     
@@ -3366,123 +3473,131 @@ XS(_wrap_holdingdisk_getconf) {
     }
     result = (val_t *)holdingdisk_getconf(arg1,arg2);
     {
-      switch (result->type) {
-        case CONFTYPE_RATE: {
-          ST(argvi)= sv_newmortal();
-          sv_setnv(ST(argvi), val_t__rate(result)[0]);
-          argvi++;
+      if (!result) {
+        ST(argvi) = &PL_sv_undef;
+        argvi++;
+      } else {
+        switch (result->type) {
+          case CONFTYPE_RATE: {
+            ST(argvi)= sv_newmortal();
+            sv_setnv(ST(argvi), val_t__rate(result)[0]);
+            argvi++;
+            
+            ST(argvi)= sv_newmortal();
+            sv_setnv(ST(argvi), val_t__rate(result)[1]);
+            argvi++;
+            break;
+          }
+          
+          case CONFTYPE_INTRANGE: {
+            ST(argvi)= sv_newmortal();
+            sv_setiv(ST(argvi), val_t__intrange(result)[0]);
+            argvi++;
+            
+            ST(argvi)= sv_newmortal();
+            sv_setiv(ST(argvi), val_t__intrange(result)[1]);
+            argvi++;
+            break;
+            break;
+          }
+          
+          case CONFTYPE_EXINCLUDE: {
+            /* exincludes are represented in perl as {
+                        *      'list' : [ 'list1', 'list2', ..],
+                        *      'file' : [ 'file1', 'file2', ..],
+                        *      'optional' : 1,
+                        * }
+                        */
+            exinclude_t *ei = &val_t__exinclude(result);
+            AV *list_entries = (AV *)sv_2mortal((SV *)newAV());
+            AV *file_entries = (AV *)sv_2mortal((SV *)newAV());
+            SV *optional = sv_newmortal();
+            HV *hv;
+            sle_t *iter;
+            
+            /* first set up each of the hash values */
+            
+            if (ei->sl_list) {
+              for (iter = ei->sl_list->first; iter != NULL; iter = iter->next) {
+                av_push(list_entries, newSVpv(iter->name, 0));
+              }
+            }
+            
+            if(ei->sl_file) {
+              for (iter = ei->sl_file->first; iter != NULL; iter = iter->next) {
+                av_push(file_entries, newSVpv(iter->name, 0));
+              }
+            }
+            
+            sv_setiv(optional, ei->optional);
+            
+            /* now build the hash */
+            hv = (HV *)sv_2mortal((SV *)newHV());
+            
+            hv_store(hv, "file", 4, newRV((SV *)file_entries), 0);
+            hv_store(hv, "list", 4, newRV((SV *)list_entries), 0);
+            hv_store(hv, "optional", 8, optional, 0);
+            SvREFCNT_inc(optional);
+            
+            ST(argvi) = sv_2mortal(newRV((SV *)hv));
+            argvi++;
+            break;
+          }
           
-          ST(argvi)= sv_newmortal();
-          sv_setnv(ST(argvi), val_t__rate(result)[1]);
+        case CONFTYPE_PROPLIST:
+          ST(argvi) = sv_2mortal(g_hash_table_to_hashref_property(val_t__proplist(result)));
           argvi++;
           break;
-        }
-        
-        case CONFTYPE_INTRANGE: {
-          ST(argvi)= sv_newmortal();
-          sv_setiv(ST(argvi), val_t__intrange(result)[0]);
-          argvi++;
           
-          ST(argvi)= sv_newmortal();
-          sv_setiv(ST(argvi), val_t__intrange(result)[1]);
+        case CONFTYPE_SIZE:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__size(result)));
           argvi++;
           break;
-          break;
-        }
-        
-        case CONFTYPE_EXINCLUDE: {
-          /* exincludes are represented in perl as {
-                    *  'list' : [ 'list1', 'list2', ..],
-                    *  'file' : [ 'file1', 'file2', ..],
-                    *  'optional' : 1,
-                    * }
-                    */
-          exinclude_t *ei = &val_t__exinclude(result);
-          AV *list_entries = (AV *)sv_2mortal((SV *)newAV());
-          AV *file_entries = (AV *)sv_2mortal((SV *)newAV());
-          SV *optional = sv_newmortal();
-          HV *hv;
-          sle_t *iter;
-          
-          /* first set up each of the hash values */
-          
-          if (ei->sl_list) {
-            for (iter = ei->sl_list->first; iter != NULL; iter = iter->next) {
-              av_push(list_entries, newSVpv(iter->name, 0));
-            }
-          }
           
-          if(ei->sl_file) {
-            for (iter = ei->sl_file->first; iter != NULL; iter = iter->next) {
-              av_push(file_entries, newSVpv(iter->name, 0));
-            }
-          }
+        case CONFTYPE_INT64:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__int64(result)));
+          argvi++;
+          break;
           
-          sv_setiv(optional, ei->optional);
+          case CONFTYPE_BOOLEAN:           /* all same as INT.. */
+        case CONFTYPE_COMPRESS:
+        case CONFTYPE_ENCRYPT:
+        case CONFTYPE_ESTIMATE:
+        case CONFTYPE_STRATEGY:
+        case CONFTYPE_TAPERALGO:
+        case CONFTYPE_PRIORITY:
+        case CONFTYPE_HOLDING:
+        case CONFTYPE_EXECUTE_ON:
+        case CONFTYPE_EXECUTE_WHERE:
+        case CONFTYPE_SEND_AMREPORT_ON:
+        case CONFTYPE_INT:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__int(result)));
+          argvi++;
+          break;
           
-          /* now build the hash */
-          hv = (HV *)sv_2mortal((SV *)newHV());
+        case CONFTYPE_TIME:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__time(result)));
+          argvi++;
+          break;
           
-          hv_store(hv, "file", 4, newRV((SV *)file_entries), 0);
-          hv_store(hv, "list", 4, newRV((SV *)list_entries), 0);
-          hv_store(hv, "optional", 8, optional, 0);
-          SvREFCNT_inc(optional);
+        case CONFTYPE_REAL:
+          ST(argvi) = sv_newmortal();
+          sv_setnv(ST(argvi), val_t__real(result));
+          argvi++;
+          break;
           
-          ST(argvi) = sv_2mortal(newRV((SV *)hv));
+          case CONFTYPE_IDENT:     /* same as STRING */
+        case CONFTYPE_STR:
+          ST(argvi) = sv_newmortal();
+          sv_setpv(ST(argvi), val_t__str(result));
           argvi++;
           break;
+          
+          /* No match yet -> not one of the "complex" types */
+        default:
+          SWIG_exception(SWIG_TypeError, "Unknown val_t conftype");
+          break;
         }
-        
-      case CONFTYPE_PROPLIST:
-        ST(argvi) = sv_2mortal(g_hash_table_to_hashref(val_t__proplist(result)));
-        argvi++;
-        break;
-        
-      case CONFTYPE_SIZE:
-        ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__size(result)));
-        argvi++;
-        break;
-        
-      case CONFTYPE_AM64:
-        ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__am64(result)));
-        argvi++;
-        break;
-        
-        case CONFTYPE_BOOLEAN:     /* all same as INT.. */
-      case CONFTYPE_COMPRESS:
-      case CONFTYPE_ENCRYPT:
-      case CONFTYPE_ESTIMATE:
-      case CONFTYPE_STRATEGY:
-      case CONFTYPE_TAPERALGO:
-      case CONFTYPE_PRIORITY:
-      case CONFTYPE_HOLDING:
-      case CONFTYPE_INT:
-        ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__int(result)));
-        argvi++;
-        break;
-        
-      case CONFTYPE_TIME:
-        ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__time(result)));
-        argvi++;
-        break;
-        
-      case CONFTYPE_REAL:
-        ST(argvi) = sv_newmortal();
-        sv_setnv(ST(argvi), val_t__real(result));
-        argvi++;
-        break;
-        
-        case CONFTYPE_IDENT:       /* same as STRING */
-      case CONFTYPE_STR:
-        ST(argvi) = sv_newmortal();
-        sv_setpv(ST(argvi), val_t__str(result));
-        argvi++;
-        break;
-        
-        /* No match yet -> not one of the "complex" types */
-      default:
-        SWIG_exception(SWIG_TypeError, "Unknown val_t conftype");
-        break;
       }
     }
     
@@ -3571,22 +3686,1347 @@ XS(_wrap_holdingdisk_seen) {
 }
 
 
-XS(_wrap_getconf_unit_divisor) {
+XS(_wrap_lookup_application) {
   {
-    long result;
+    char *arg1 = (char *) 0 ;
+    application_t *result = 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
     int argvi = 0;
     dXSARGS;
     
-    if ((items < 0) || (items > 0)) {
-      SWIG_croak("Usage: getconf_unit_divisor();");
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: lookup_application(identifier);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "lookup_application" "', argument " "1"" of type '" "char *""'");
+    }
+    arg1 = (char *)(buf1);
+    result = (application_t *)lookup_application(arg1);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_application_t, 0 | 0); argvi++ ;
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_application_getconf) {
+  {
+    application_t *arg1 = (application_t *) 0 ;
+    application_key arg2 ;
+    val_t *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: application_getconf(app,key);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_application_t, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "application_getconf" "', argument " "1"" of type '" "application_t *""'"); 
+    }
+    arg1 = (application_t *)(argp1);
+    {
+      if (sizeof(signed int) == 1) {
+        arg2 = amglue_SvI8(ST(1));
+      } else if (sizeof(signed int) == 2) {
+        arg2 = amglue_SvI16(ST(1));
+      } else if (sizeof(signed int) == 4) {
+        arg2 = amglue_SvI32(ST(1));
+      } else if (sizeof(signed int) == 8) {
+        arg2 = amglue_SvI64(ST(1));
+      } else {
+        g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
+      }
+    }
+    result = (val_t *)application_getconf(arg1,arg2);
+    {
+      if (!result) {
+        ST(argvi) = &PL_sv_undef;
+        argvi++;
+      } else {
+        switch (result->type) {
+          case CONFTYPE_RATE: {
+            ST(argvi)= sv_newmortal();
+            sv_setnv(ST(argvi), val_t__rate(result)[0]);
+            argvi++;
+            
+            ST(argvi)= sv_newmortal();
+            sv_setnv(ST(argvi), val_t__rate(result)[1]);
+            argvi++;
+            break;
+          }
+          
+          case CONFTYPE_INTRANGE: {
+            ST(argvi)= sv_newmortal();
+            sv_setiv(ST(argvi), val_t__intrange(result)[0]);
+            argvi++;
+            
+            ST(argvi)= sv_newmortal();
+            sv_setiv(ST(argvi), val_t__intrange(result)[1]);
+            argvi++;
+            break;
+            break;
+          }
+          
+          case CONFTYPE_EXINCLUDE: {
+            /* exincludes are represented in perl as {
+                        *      'list' : [ 'list1', 'list2', ..],
+                        *      'file' : [ 'file1', 'file2', ..],
+                        *      'optional' : 1,
+                        * }
+                        */
+            exinclude_t *ei = &val_t__exinclude(result);
+            AV *list_entries = (AV *)sv_2mortal((SV *)newAV());
+            AV *file_entries = (AV *)sv_2mortal((SV *)newAV());
+            SV *optional = sv_newmortal();
+            HV *hv;
+            sle_t *iter;
+            
+            /* first set up each of the hash values */
+            
+            if (ei->sl_list) {
+              for (iter = ei->sl_list->first; iter != NULL; iter = iter->next) {
+                av_push(list_entries, newSVpv(iter->name, 0));
+              }
+            }
+            
+            if(ei->sl_file) {
+              for (iter = ei->sl_file->first; iter != NULL; iter = iter->next) {
+                av_push(file_entries, newSVpv(iter->name, 0));
+              }
+            }
+            
+            sv_setiv(optional, ei->optional);
+            
+            /* now build the hash */
+            hv = (HV *)sv_2mortal((SV *)newHV());
+            
+            hv_store(hv, "file", 4, newRV((SV *)file_entries), 0);
+            hv_store(hv, "list", 4, newRV((SV *)list_entries), 0);
+            hv_store(hv, "optional", 8, optional, 0);
+            SvREFCNT_inc(optional);
+            
+            ST(argvi) = sv_2mortal(newRV((SV *)hv));
+            argvi++;
+            break;
+          }
+          
+        case CONFTYPE_PROPLIST:
+          ST(argvi) = sv_2mortal(g_hash_table_to_hashref_property(val_t__proplist(result)));
+          argvi++;
+          break;
+          
+        case CONFTYPE_SIZE:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__size(result)));
+          argvi++;
+          break;
+          
+        case CONFTYPE_INT64:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__int64(result)));
+          argvi++;
+          break;
+          
+          case CONFTYPE_BOOLEAN:           /* all same as INT.. */
+        case CONFTYPE_COMPRESS:
+        case CONFTYPE_ENCRYPT:
+        case CONFTYPE_ESTIMATE:
+        case CONFTYPE_STRATEGY:
+        case CONFTYPE_TAPERALGO:
+        case CONFTYPE_PRIORITY:
+        case CONFTYPE_HOLDING:
+        case CONFTYPE_EXECUTE_ON:
+        case CONFTYPE_EXECUTE_WHERE:
+        case CONFTYPE_SEND_AMREPORT_ON:
+        case CONFTYPE_INT:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__int(result)));
+          argvi++;
+          break;
+          
+        case CONFTYPE_TIME:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__time(result)));
+          argvi++;
+          break;
+          
+        case CONFTYPE_REAL:
+          ST(argvi) = sv_newmortal();
+          sv_setnv(ST(argvi), val_t__real(result));
+          argvi++;
+          break;
+          
+          case CONFTYPE_IDENT:     /* same as STRING */
+        case CONFTYPE_STR:
+          ST(argvi) = sv_newmortal();
+          sv_setpv(ST(argvi), val_t__str(result));
+          argvi++;
+          break;
+          
+          /* No match yet -> not one of the "complex" types */
+        default:
+          SWIG_exception(SWIG_TypeError, "Unknown val_t conftype");
+          break;
+        }
+      }
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_application_name) {
+  {
+    application_t *arg1 = (application_t *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: application_name(app);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_application_t, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "application_name" "', argument " "1"" of type '" "application_t *""'"); 
+    }
+    arg1 = (application_t *)(argp1);
+    result = (char *)application_name(arg1);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_application_seen) {
+  {
+    application_t *arg1 = (application_t *) 0 ;
+    application_key arg2 ;
+    gboolean result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: application_seen(app,key);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_application_t, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "application_seen" "', argument " "1"" of type '" "application_t *""'"); 
+    }
+    arg1 = (application_t *)(argp1);
+    {
+      if (sizeof(signed int) == 1) {
+        arg2 = amglue_SvI8(ST(1));
+      } else if (sizeof(signed int) == 2) {
+        arg2 = amglue_SvI16(ST(1));
+      } else if (sizeof(signed int) == 4) {
+        arg2 = amglue_SvI32(ST(1));
+      } else if (sizeof(signed int) == 8) {
+        arg2 = amglue_SvI64(ST(1));
+      } else {
+        g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
+      }
+    }
+    result = (gboolean)application_seen(arg1,arg2);
+    {
+      ST(argvi) = sv_2mortal(amglue_newSVi64(result));
+      argvi++;
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_lookup_pp_script) {
+  {
+    char *arg1 = (char *) 0 ;
+    pp_script_t *result = 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: lookup_pp_script(identifier);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "lookup_pp_script" "', argument " "1"" of type '" "char *""'");
+    }
+    arg1 = (char *)(buf1);
+    result = (pp_script_t *)lookup_pp_script(arg1);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_pp_script_t, 0 | 0); argvi++ ;
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_pp_script_getconf) {
+  {
+    pp_script_t *arg1 = (pp_script_t *) 0 ;
+    pp_script_key arg2 ;
+    val_t *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: pp_script_getconf(pps,key);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_pp_script_t, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pp_script_getconf" "', argument " "1"" of type '" "pp_script_t *""'"); 
+    }
+    arg1 = (pp_script_t *)(argp1);
+    {
+      if (sizeof(signed int) == 1) {
+        arg2 = amglue_SvI8(ST(1));
+      } else if (sizeof(signed int) == 2) {
+        arg2 = amglue_SvI16(ST(1));
+      } else if (sizeof(signed int) == 4) {
+        arg2 = amglue_SvI32(ST(1));
+      } else if (sizeof(signed int) == 8) {
+        arg2 = amglue_SvI64(ST(1));
+      } else {
+        g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
+      }
+    }
+    result = (val_t *)pp_script_getconf(arg1,arg2);
+    {
+      if (!result) {
+        ST(argvi) = &PL_sv_undef;
+        argvi++;
+      } else {
+        switch (result->type) {
+          case CONFTYPE_RATE: {
+            ST(argvi)= sv_newmortal();
+            sv_setnv(ST(argvi), val_t__rate(result)[0]);
+            argvi++;
+            
+            ST(argvi)= sv_newmortal();
+            sv_setnv(ST(argvi), val_t__rate(result)[1]);
+            argvi++;
+            break;
+          }
+          
+          case CONFTYPE_INTRANGE: {
+            ST(argvi)= sv_newmortal();
+            sv_setiv(ST(argvi), val_t__intrange(result)[0]);
+            argvi++;
+            
+            ST(argvi)= sv_newmortal();
+            sv_setiv(ST(argvi), val_t__intrange(result)[1]);
+            argvi++;
+            break;
+            break;
+          }
+          
+          case CONFTYPE_EXINCLUDE: {
+            /* exincludes are represented in perl as {
+                        *      'list' : [ 'list1', 'list2', ..],
+                        *      'file' : [ 'file1', 'file2', ..],
+                        *      'optional' : 1,
+                        * }
+                        */
+            exinclude_t *ei = &val_t__exinclude(result);
+            AV *list_entries = (AV *)sv_2mortal((SV *)newAV());
+            AV *file_entries = (AV *)sv_2mortal((SV *)newAV());
+            SV *optional = sv_newmortal();
+            HV *hv;
+            sle_t *iter;
+            
+            /* first set up each of the hash values */
+            
+            if (ei->sl_list) {
+              for (iter = ei->sl_list->first; iter != NULL; iter = iter->next) {
+                av_push(list_entries, newSVpv(iter->name, 0));
+              }
+            }
+            
+            if(ei->sl_file) {
+              for (iter = ei->sl_file->first; iter != NULL; iter = iter->next) {
+                av_push(file_entries, newSVpv(iter->name, 0));
+              }
+            }
+            
+            sv_setiv(optional, ei->optional);
+            
+            /* now build the hash */
+            hv = (HV *)sv_2mortal((SV *)newHV());
+            
+            hv_store(hv, "file", 4, newRV((SV *)file_entries), 0);
+            hv_store(hv, "list", 4, newRV((SV *)list_entries), 0);
+            hv_store(hv, "optional", 8, optional, 0);
+            SvREFCNT_inc(optional);
+            
+            ST(argvi) = sv_2mortal(newRV((SV *)hv));
+            argvi++;
+            break;
+          }
+          
+        case CONFTYPE_PROPLIST:
+          ST(argvi) = sv_2mortal(g_hash_table_to_hashref_property(val_t__proplist(result)));
+          argvi++;
+          break;
+          
+        case CONFTYPE_SIZE:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__size(result)));
+          argvi++;
+          break;
+          
+        case CONFTYPE_INT64:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__int64(result)));
+          argvi++;
+          break;
+          
+          case CONFTYPE_BOOLEAN:           /* all same as INT.. */
+        case CONFTYPE_COMPRESS:
+        case CONFTYPE_ENCRYPT:
+        case CONFTYPE_ESTIMATE:
+        case CONFTYPE_STRATEGY:
+        case CONFTYPE_TAPERALGO:
+        case CONFTYPE_PRIORITY:
+        case CONFTYPE_HOLDING:
+        case CONFTYPE_EXECUTE_ON:
+        case CONFTYPE_EXECUTE_WHERE:
+        case CONFTYPE_SEND_AMREPORT_ON:
+        case CONFTYPE_INT:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__int(result)));
+          argvi++;
+          break;
+          
+        case CONFTYPE_TIME:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__time(result)));
+          argvi++;
+          break;
+          
+        case CONFTYPE_REAL:
+          ST(argvi) = sv_newmortal();
+          sv_setnv(ST(argvi), val_t__real(result));
+          argvi++;
+          break;
+          
+          case CONFTYPE_IDENT:     /* same as STRING */
+        case CONFTYPE_STR:
+          ST(argvi) = sv_newmortal();
+          sv_setpv(ST(argvi), val_t__str(result));
+          argvi++;
+          break;
+          
+          /* No match yet -> not one of the "complex" types */
+        default:
+          SWIG_exception(SWIG_TypeError, "Unknown val_t conftype");
+          break;
+        }
+      }
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_pp_script_name) {
+  {
+    pp_script_t *arg1 = (pp_script_t *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: pp_script_name(pps);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_pp_script_t, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pp_script_name" "', argument " "1"" of type '" "pp_script_t *""'"); 
+    }
+    arg1 = (pp_script_t *)(argp1);
+    result = (char *)pp_script_name(arg1);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_pp_script_seen) {
+  {
+    pp_script_t *arg1 = (pp_script_t *) 0 ;
+    pp_script_key arg2 ;
+    gboolean result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: pp_script_seen(app,key);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_pp_script_t, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pp_script_seen" "', argument " "1"" of type '" "pp_script_t *""'"); 
+    }
+    arg1 = (pp_script_t *)(argp1);
+    {
+      if (sizeof(signed int) == 1) {
+        arg2 = amglue_SvI8(ST(1));
+      } else if (sizeof(signed int) == 2) {
+        arg2 = amglue_SvI16(ST(1));
+      } else if (sizeof(signed int) == 4) {
+        arg2 = amglue_SvI32(ST(1));
+      } else if (sizeof(signed int) == 8) {
+        arg2 = amglue_SvI64(ST(1));
+      } else {
+        g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
+      }
+    }
+    result = (gboolean)pp_script_seen(arg1,arg2);
+    {
+      ST(argvi) = sv_2mortal(amglue_newSVi64(result));
+      argvi++;
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_lookup_device_config) {
+  {
+    char *arg1 = (char *) 0 ;
+    device_config_t *result = 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: lookup_device_config(identifier);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "lookup_device_config" "', argument " "1"" of type '" "char *""'");
+    }
+    arg1 = (char *)(buf1);
+    result = (device_config_t *)lookup_device_config(arg1);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_device_config_t, 0 | 0); argvi++ ;
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_device_config_getconf) {
+  {
+    device_config_t *arg1 = (device_config_t *) 0 ;
+    device_config_key arg2 ;
+    val_t *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: device_config_getconf(pps,key);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_device_config_t, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "device_config_getconf" "', argument " "1"" of type '" "device_config_t *""'"); 
+    }
+    arg1 = (device_config_t *)(argp1);
+    {
+      if (sizeof(signed int) == 1) {
+        arg2 = amglue_SvI8(ST(1));
+      } else if (sizeof(signed int) == 2) {
+        arg2 = amglue_SvI16(ST(1));
+      } else if (sizeof(signed int) == 4) {
+        arg2 = amglue_SvI32(ST(1));
+      } else if (sizeof(signed int) == 8) {
+        arg2 = amglue_SvI64(ST(1));
+      } else {
+        g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
+      }
+    }
+    result = (val_t *)device_config_getconf(arg1,arg2);
+    {
+      if (!result) {
+        ST(argvi) = &PL_sv_undef;
+        argvi++;
+      } else {
+        switch (result->type) {
+          case CONFTYPE_RATE: {
+            ST(argvi)= sv_newmortal();
+            sv_setnv(ST(argvi), val_t__rate(result)[0]);
+            argvi++;
+            
+            ST(argvi)= sv_newmortal();
+            sv_setnv(ST(argvi), val_t__rate(result)[1]);
+            argvi++;
+            break;
+          }
+          
+          case CONFTYPE_INTRANGE: {
+            ST(argvi)= sv_newmortal();
+            sv_setiv(ST(argvi), val_t__intrange(result)[0]);
+            argvi++;
+            
+            ST(argvi)= sv_newmortal();
+            sv_setiv(ST(argvi), val_t__intrange(result)[1]);
+            argvi++;
+            break;
+            break;
+          }
+          
+          case CONFTYPE_EXINCLUDE: {
+            /* exincludes are represented in perl as {
+                        *      'list' : [ 'list1', 'list2', ..],
+                        *      'file' : [ 'file1', 'file2', ..],
+                        *      'optional' : 1,
+                        * }
+                        */
+            exinclude_t *ei = &val_t__exinclude(result);
+            AV *list_entries = (AV *)sv_2mortal((SV *)newAV());
+            AV *file_entries = (AV *)sv_2mortal((SV *)newAV());
+            SV *optional = sv_newmortal();
+            HV *hv;
+            sle_t *iter;
+            
+            /* first set up each of the hash values */
+            
+            if (ei->sl_list) {
+              for (iter = ei->sl_list->first; iter != NULL; iter = iter->next) {
+                av_push(list_entries, newSVpv(iter->name, 0));
+              }
+            }
+            
+            if(ei->sl_file) {
+              for (iter = ei->sl_file->first; iter != NULL; iter = iter->next) {
+                av_push(file_entries, newSVpv(iter->name, 0));
+              }
+            }
+            
+            sv_setiv(optional, ei->optional);
+            
+            /* now build the hash */
+            hv = (HV *)sv_2mortal((SV *)newHV());
+            
+            hv_store(hv, "file", 4, newRV((SV *)file_entries), 0);
+            hv_store(hv, "list", 4, newRV((SV *)list_entries), 0);
+            hv_store(hv, "optional", 8, optional, 0);
+            SvREFCNT_inc(optional);
+            
+            ST(argvi) = sv_2mortal(newRV((SV *)hv));
+            argvi++;
+            break;
+          }
+          
+        case CONFTYPE_PROPLIST:
+          ST(argvi) = sv_2mortal(g_hash_table_to_hashref_property(val_t__proplist(result)));
+          argvi++;
+          break;
+          
+        case CONFTYPE_SIZE:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__size(result)));
+          argvi++;
+          break;
+          
+        case CONFTYPE_INT64:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__int64(result)));
+          argvi++;
+          break;
+          
+          case CONFTYPE_BOOLEAN:           /* all same as INT.. */
+        case CONFTYPE_COMPRESS:
+        case CONFTYPE_ENCRYPT:
+        case CONFTYPE_ESTIMATE:
+        case CONFTYPE_STRATEGY:
+        case CONFTYPE_TAPERALGO:
+        case CONFTYPE_PRIORITY:
+        case CONFTYPE_HOLDING:
+        case CONFTYPE_EXECUTE_ON:
+        case CONFTYPE_EXECUTE_WHERE:
+        case CONFTYPE_SEND_AMREPORT_ON:
+        case CONFTYPE_INT:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__int(result)));
+          argvi++;
+          break;
+          
+        case CONFTYPE_TIME:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__time(result)));
+          argvi++;
+          break;
+          
+        case CONFTYPE_REAL:
+          ST(argvi) = sv_newmortal();
+          sv_setnv(ST(argvi), val_t__real(result));
+          argvi++;
+          break;
+          
+          case CONFTYPE_IDENT:     /* same as STRING */
+        case CONFTYPE_STR:
+          ST(argvi) = sv_newmortal();
+          sv_setpv(ST(argvi), val_t__str(result));
+          argvi++;
+          break;
+          
+          /* No match yet -> not one of the "complex" types */
+        default:
+          SWIG_exception(SWIG_TypeError, "Unknown val_t conftype");
+          break;
+        }
+      }
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_device_config_name) {
+  {
+    device_config_t *arg1 = (device_config_t *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: device_config_name(pps);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_device_config_t, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "device_config_name" "', argument " "1"" of type '" "device_config_t *""'"); 
+    }
+    arg1 = (device_config_t *)(argp1);
+    result = (char *)device_config_name(arg1);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_device_config_seen) {
+  {
+    device_config_t *arg1 = (device_config_t *) 0 ;
+    device_config_key arg2 ;
+    gboolean result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: device_config_seen(app,key);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_device_config_t, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "device_config_seen" "', argument " "1"" of type '" "device_config_t *""'"); 
+    }
+    arg1 = (device_config_t *)(argp1);
+    {
+      if (sizeof(signed int) == 1) {
+        arg2 = amglue_SvI8(ST(1));
+      } else if (sizeof(signed int) == 2) {
+        arg2 = amglue_SvI16(ST(1));
+      } else if (sizeof(signed int) == 4) {
+        arg2 = amglue_SvI32(ST(1));
+      } else if (sizeof(signed int) == 8) {
+        arg2 = amglue_SvI64(ST(1));
+      } else {
+        g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
+      }
+    }
+    result = (gboolean)device_config_seen(arg1,arg2);
+    {
+      ST(argvi) = sv_2mortal(amglue_newSVi64(result));
+      argvi++;
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_lookup_changer_config) {
+  {
+    char *arg1 = (char *) 0 ;
+    changer_config_t *result = 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: lookup_changer_config(identifier);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "lookup_changer_config" "', argument " "1"" of type '" "char *""'");
+    }
+    arg1 = (char *)(buf1);
+    result = (changer_config_t *)lookup_changer_config(arg1);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_changer_config_t, 0 | 0); argvi++ ;
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_changer_config_getconf) {
+  {
+    changer_config_t *arg1 = (changer_config_t *) 0 ;
+    changer_config_key arg2 ;
+    val_t *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: changer_config_getconf(pps,key);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_changer_config_t, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "changer_config_getconf" "', argument " "1"" of type '" "changer_config_t *""'"); 
+    }
+    arg1 = (changer_config_t *)(argp1);
+    {
+      if (sizeof(signed int) == 1) {
+        arg2 = amglue_SvI8(ST(1));
+      } else if (sizeof(signed int) == 2) {
+        arg2 = amglue_SvI16(ST(1));
+      } else if (sizeof(signed int) == 4) {
+        arg2 = amglue_SvI32(ST(1));
+      } else if (sizeof(signed int) == 8) {
+        arg2 = amglue_SvI64(ST(1));
+      } else {
+        g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
+      }
+    }
+    result = (val_t *)changer_config_getconf(arg1,arg2);
+    {
+      if (!result) {
+        ST(argvi) = &PL_sv_undef;
+        argvi++;
+      } else {
+        switch (result->type) {
+          case CONFTYPE_RATE: {
+            ST(argvi)= sv_newmortal();
+            sv_setnv(ST(argvi), val_t__rate(result)[0]);
+            argvi++;
+            
+            ST(argvi)= sv_newmortal();
+            sv_setnv(ST(argvi), val_t__rate(result)[1]);
+            argvi++;
+            break;
+          }
+          
+          case CONFTYPE_INTRANGE: {
+            ST(argvi)= sv_newmortal();
+            sv_setiv(ST(argvi), val_t__intrange(result)[0]);
+            argvi++;
+            
+            ST(argvi)= sv_newmortal();
+            sv_setiv(ST(argvi), val_t__intrange(result)[1]);
+            argvi++;
+            break;
+            break;
+          }
+          
+          case CONFTYPE_EXINCLUDE: {
+            /* exincludes are represented in perl as {
+                        *      'list' : [ 'list1', 'list2', ..],
+                        *      'file' : [ 'file1', 'file2', ..],
+                        *      'optional' : 1,
+                        * }
+                        */
+            exinclude_t *ei = &val_t__exinclude(result);
+            AV *list_entries = (AV *)sv_2mortal((SV *)newAV());
+            AV *file_entries = (AV *)sv_2mortal((SV *)newAV());
+            SV *optional = sv_newmortal();
+            HV *hv;
+            sle_t *iter;
+            
+            /* first set up each of the hash values */
+            
+            if (ei->sl_list) {
+              for (iter = ei->sl_list->first; iter != NULL; iter = iter->next) {
+                av_push(list_entries, newSVpv(iter->name, 0));
+              }
+            }
+            
+            if(ei->sl_file) {
+              for (iter = ei->sl_file->first; iter != NULL; iter = iter->next) {
+                av_push(file_entries, newSVpv(iter->name, 0));
+              }
+            }
+            
+            sv_setiv(optional, ei->optional);
+            
+            /* now build the hash */
+            hv = (HV *)sv_2mortal((SV *)newHV());
+            
+            hv_store(hv, "file", 4, newRV((SV *)file_entries), 0);
+            hv_store(hv, "list", 4, newRV((SV *)list_entries), 0);
+            hv_store(hv, "optional", 8, optional, 0);
+            SvREFCNT_inc(optional);
+            
+            ST(argvi) = sv_2mortal(newRV((SV *)hv));
+            argvi++;
+            break;
+          }
+          
+        case CONFTYPE_PROPLIST:
+          ST(argvi) = sv_2mortal(g_hash_table_to_hashref_property(val_t__proplist(result)));
+          argvi++;
+          break;
+          
+        case CONFTYPE_SIZE:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__size(result)));
+          argvi++;
+          break;
+          
+        case CONFTYPE_INT64:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__int64(result)));
+          argvi++;
+          break;
+          
+          case CONFTYPE_BOOLEAN:           /* all same as INT.. */
+        case CONFTYPE_COMPRESS:
+        case CONFTYPE_ENCRYPT:
+        case CONFTYPE_ESTIMATE:
+        case CONFTYPE_STRATEGY:
+        case CONFTYPE_TAPERALGO:
+        case CONFTYPE_PRIORITY:
+        case CONFTYPE_HOLDING:
+        case CONFTYPE_EXECUTE_ON:
+        case CONFTYPE_EXECUTE_WHERE:
+        case CONFTYPE_SEND_AMREPORT_ON:
+        case CONFTYPE_INT:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__int(result)));
+          argvi++;
+          break;
+          
+        case CONFTYPE_TIME:
+          ST(argvi) = sv_2mortal(amglue_newSVi64(val_t__time(result)));
+          argvi++;
+          break;
+          
+        case CONFTYPE_REAL:
+          ST(argvi) = sv_newmortal();
+          sv_setnv(ST(argvi), val_t__real(result));
+          argvi++;
+          break;
+          
+          case CONFTYPE_IDENT:     /* same as STRING */
+        case CONFTYPE_STR:
+          ST(argvi) = sv_newmortal();
+          sv_setpv(ST(argvi), val_t__str(result));
+          argvi++;
+          break;
+          
+          /* No match yet -> not one of the "complex" types */
+        default:
+          SWIG_exception(SWIG_TypeError, "Unknown val_t conftype");
+          break;
+        }
+      }
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_changer_config_name) {
+  {
+    changer_config_t *arg1 = (changer_config_t *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: changer_config_name(pps);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_changer_config_t, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "changer_config_name" "', argument " "1"" of type '" "changer_config_t *""'"); 
+    }
+    arg1 = (changer_config_t *)(argp1);
+    result = (char *)changer_config_name(arg1);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_changer_config_seen) {
+  {
+    changer_config_t *arg1 = (changer_config_t *) 0 ;
+    changer_config_key arg2 ;
+    gboolean result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: changer_config_seen(app,key);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_changer_config_t, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "changer_config_seen" "', argument " "1"" of type '" "changer_config_t *""'"); 
+    }
+    arg1 = (changer_config_t *)(argp1);
+    {
+      if (sizeof(signed int) == 1) {
+        arg2 = amglue_SvI8(ST(1));
+      } else if (sizeof(signed int) == 2) {
+        arg2 = amglue_SvI16(ST(1));
+      } else if (sizeof(signed int) == 4) {
+        arg2 = amglue_SvI32(ST(1));
+      } else if (sizeof(signed int) == 8) {
+        arg2 = amglue_SvI64(ST(1));
+      } else {
+        g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
+      }
+    }
+    result = (gboolean)changer_config_seen(arg1,arg2);
+    {
+      ST(argvi) = sv_2mortal(amglue_newSVi64(result));
+      argvi++;
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_getconf_unit_divisor) {
+  {
+    long result;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: getconf_unit_divisor();");
+    }
+    result = (long)getconf_unit_divisor();
+    {
+      ST(argvi) = sv_2mortal(amglue_newSVi64(result));
+      argvi++;
+    }
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_config_init) {
+  {
+    config_init_flags arg1 ;
+    char *arg2 = (char *) 0 ;
+    gboolean result;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: config_init(flags,arg_config_name);");
+    }
+    {
+      if (sizeof(signed int) == 1) {
+        arg1 = amglue_SvI8(ST(0));
+      } else if (sizeof(signed int) == 2) {
+        arg1 = amglue_SvI16(ST(0));
+      } else if (sizeof(signed int) == 4) {
+        arg1 = amglue_SvI32(ST(0));
+      } else if (sizeof(signed int) == 8) {
+        arg1 = amglue_SvI64(ST(0));
+      } else {
+        g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
+      }
+    }
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "config_init" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = (char *)(buf2);
+    result = (gboolean)config_init(arg1,arg2);
+    {
+      ST(argvi) = sv_2mortal(amglue_newSVi64(result));
+      argvi++;
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_config_uninit) {
+  {
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: config_uninit();");
+    }
+    config_uninit();
+    
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_get_config_options) {
+  {
+    int arg1 ;
+    char **result = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: get_config_options(first);");
+    }
+    {
+      if (sizeof(signed int) == 1) {
+        arg1 = amglue_SvI8(ST(0));
+      } else if (sizeof(signed int) == 2) {
+        arg1 = amglue_SvI16(ST(0));
+      } else if (sizeof(signed int) == 4) {
+        arg1 = amglue_SvI32(ST(0));
+      } else if (sizeof(signed int) == 8) {
+        arg1 = amglue_SvI64(ST(0));
+      } else {
+        g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
+      }
+    }
+    result = (char **)get_config_options(arg1);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_p_char, 0 | 0); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_get_config_name) {
+  {
+    char *result = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: get_config_name();");
+    }
+    result = (char *)get_config_name();
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_get_config_dir) {
+  {
+    char *result = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: get_config_dir();");
+    }
+    result = (char *)get_config_dir();
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_get_config_filename) {
+  {
+    char *result = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: get_config_filename();");
+    }
+    result = (char *)get_config_filename();
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_config_print_errors) {
+  {
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: config_print_errors();");
+    }
+    config_print_errors();
+    
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_config_clear_errors) {
+  {
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: config_clear_errors();");
+    }
+    config_clear_errors();
+    
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_config_errors) {
+  {
+    GSList **arg1 = (GSList **) 0 ;
+    cfgerr_level_t result;
+    GSList *templist1 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    {
+      templist1 = NULL;
+      arg1 = &templist1;
+    }
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: config_errors();");
     }
-    result = (long)getconf_unit_divisor();
+    result = (cfgerr_level_t)config_errors(arg1);
     {
       ST(argvi) = sv_2mortal(amglue_newSVi64(result));
       argvi++;
     }
+    {
+      GSList *it = *arg1;
+      
+      while (it) {
+        ST(argvi) = sv_2mortal(newSVpv(it->data, 0));
+        argvi++;
+        it = it->next;
+      }
+    }
+    
     XSRETURN(argvi);
   fail:
+    
     SWIG_croak_null();
   }
 }
@@ -3743,6 +5183,7 @@ XS(_wrap_add_config_overwrite_opt) {
 XS(_wrap_apply_config_overwrites) {
   {
     config_overwrites_t *arg1 = (config_overwrites_t *) 0 ;
+    cfgerr_level_t result;
     void *argp1 = 0 ;
     int res1 = 0 ;
     int argvi = 0;
@@ -3756,165 +5197,15 @@ XS(_wrap_apply_config_overwrites) {
       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "apply_config_overwrites" "', argument " "1"" of type '" "config_overwrites_t *""'"); 
     }
     arg1 = (config_overwrites_t *)(argp1);
-    apply_config_overwrites(arg1);
-    
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
-
-
-XS(_wrap_config_init) {
-  {
-    config_init_flags arg1 ;
-    char *arg2 = (char *) 0 ;
-    gboolean result;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: config_init(flags,arg_config_name);");
-    }
-    {
-      if (sizeof(signed int) == 1) {
-        arg1 = amglue_SvI8(ST(0));
-      } else if (sizeof(signed int) == 2) {
-        arg1 = amglue_SvI16(ST(0));
-      } else if (sizeof(signed int) == 4) {
-        arg1 = amglue_SvI32(ST(0));
-      } else if (sizeof(signed int) == 8) {
-        arg1 = amglue_SvI64(ST(0));
-      } else {
-        g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
-      }
-    }
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "config_init" "', argument " "2"" of type '" "char *""'");
-    }
-    arg2 = (char *)(buf2);
-    result = (gboolean)config_init(arg1,arg2);
+    result = (cfgerr_level_t)apply_config_overwrites(arg1);
     {
       ST(argvi) = sv_2mortal(amglue_newSVi64(result));
       argvi++;
     }
     
-    if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
-    XSRETURN(argvi);
-  fail:
-    
-    if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
-    SWIG_croak_null();
-  }
-}
-
-
-XS(_wrap_config_uninit) {
-  {
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 0) || (items > 0)) {
-      SWIG_croak("Usage: config_uninit();");
-    }
-    config_uninit();
-    
-    XSRETURN(argvi);
-  fail:
-    SWIG_croak_null();
-  }
-}
-
-
-XS(_wrap_get_config_options) {
-  {
-    int arg1 ;
-    char **result = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: get_config_options(first);");
-    }
-    {
-      if (sizeof(signed int) == 1) {
-        arg1 = amglue_SvI8(ST(0));
-      } else if (sizeof(signed int) == 2) {
-        arg1 = amglue_SvI16(ST(0));
-      } else if (sizeof(signed int) == 4) {
-        arg1 = amglue_SvI32(ST(0));
-      } else if (sizeof(signed int) == 8) {
-        arg1 = amglue_SvI64(ST(0));
-      } else {
-        g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
-      }
-    }
-    result = (char **)get_config_options(arg1);
-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_p_char, 0 | 0); argvi++ ;
-    
-    XSRETURN(argvi);
-  fail:
-    
-    SWIG_croak_null();
-  }
-}
-
-
-XS(_wrap_get_config_name) {
-  {
-    char *result = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 0) || (items > 0)) {
-      SWIG_croak("Usage: get_config_name();");
-    }
-    result = (char *)get_config_name();
-    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-    XSRETURN(argvi);
-  fail:
-    SWIG_croak_null();
-  }
-}
-
-
-XS(_wrap_get_config_dir) {
-  {
-    char *result = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 0) || (items > 0)) {
-      SWIG_croak("Usage: get_config_dir();");
-    }
-    result = (char *)get_config_dir();
-    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
     XSRETURN(argvi);
   fail:
-    SWIG_croak_null();
-  }
-}
-
-
-XS(_wrap_get_config_filename) {
-  {
-    char *result = 0 ;
-    int argvi = 0;
-    dXSARGS;
     
-    if ((items < 0) || (items > 0)) {
-      SWIG_croak("Usage: get_config_filename();");
-    }
-    result = (char *)get_config_filename();
-    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-    XSRETURN(argvi);
-  fail:
     SWIG_croak_null();
   }
 }
@@ -3958,6 +5249,7 @@ XS(_wrap_config_dir_relative) {
     result = (char *)config_dir_relative(arg1);
     ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
     if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    free((char*)result);
     XSRETURN(argvi);
   fail:
     if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
@@ -4035,54 +5327,74 @@ XS(_wrap_find_multiplier) {
 
 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
 
+static swig_type_info _swigt__p_application_t = {"_p_application_t", "application_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_changer_config_t = {"_p_changer_config_t", "changer_config_t *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_char = {"_p_char", "gchar *|char *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_config_overwrites_t = {"_p_config_overwrites_t", "config_overwrites_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_device_config_t = {"_p_device_config_t", "device_config_t *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_double = {"_p_double", "double *|gdouble *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_dumptype_t = {"_p_dumptype_t", "dumptype_t *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_float = {"_p_float", "float *|gfloat *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_holdingdisk_t = {"_p_holdingdisk_t", "holdingdisk_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_int = {"_p_int", "strategy_t *|int *|comp_t *|dump_holdingdisk_t *|holdingdisk_key *|interface_key *|confparm_key *|dumptype_key *|tapetype_key *|encrypt_t *|taperalgo_t *|gboolean *|estimate_t *|config_init_flags *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_int = {"_p_int", "application_key *|strategy_t *|pp_script_key *|int *|comp_t *|dump_holdingdisk_t *|holdingdisk_key *|device_config_key *|changer_config_key *|confparm_key *|interface_key *|dumptype_key *|tapetype_key *|cfgerr_level_t *|encrypt_t *|taperalgo_t *|gboolean *|execute_on_t *|send_amreport_on_t *|estimate_t *|config_init_flags *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_interface_t = {"_p_interface_t", "interface_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_p_GSList = {"_p_p_GSList", "GSList **", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_p_char = {"_p_p_char", "char **", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_pp_script_t = {"_p_pp_script_t", "pp_script_t *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_tapetype_t = {"_p_tapetype_t", "tapetype_t *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "guchar *|unsigned char *", 0, 0, (void*)0, 0};
 
 static swig_type_info *swig_type_initial[] = {
+  &_swigt__p_application_t,
+  &_swigt__p_changer_config_t,
   &_swigt__p_char,
   &_swigt__p_config_overwrites_t,
+  &_swigt__p_device_config_t,
   &_swigt__p_double,
   &_swigt__p_dumptype_t,
   &_swigt__p_float,
   &_swigt__p_holdingdisk_t,
   &_swigt__p_int,
   &_swigt__p_interface_t,
+  &_swigt__p_p_GSList,
   &_swigt__p_p_char,
+  &_swigt__p_pp_script_t,
   &_swigt__p_tapetype_t,
   &_swigt__p_unsigned_char,
 };
 
+static swig_cast_info _swigc__p_application_t[] = {  {&_swigt__p_application_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_changer_config_t[] = {  {&_swigt__p_changer_config_t, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_config_overwrites_t[] = {  {&_swigt__p_config_overwrites_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_device_config_t[] = {  {&_swigt__p_device_config_t, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_double[] = {  {&_swigt__p_double, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_dumptype_t[] = {  {&_swigt__p_dumptype_t, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_float[] = {  {&_swigt__p_float, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_holdingdisk_t[] = {  {&_swigt__p_holdingdisk_t, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_int[] = {  {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_interface_t[] = {  {&_swigt__p_interface_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_p_GSList[] = {  {&_swigt__p_p_GSList, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_p_char[] = {  {&_swigt__p_p_char, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_pp_script_t[] = {  {&_swigt__p_pp_script_t, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_tapetype_t[] = {  {&_swigt__p_tapetype_t, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_unsigned_char[] = {  {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
 
 static swig_cast_info *swig_cast_initial[] = {
+  _swigc__p_application_t,
+  _swigc__p_changer_config_t,
   _swigc__p_char,
   _swigc__p_config_overwrites_t,
+  _swigc__p_device_config_t,
   _swigc__p_double,
   _swigc__p_dumptype_t,
   _swigc__p_float,
   _swigc__p_holdingdisk_t,
   _swigc__p_int,
   _swigc__p_interface_t,
+  _swigc__p_p_GSList,
   _swigc__p_p_char,
+  _swigc__p_pp_script_t,
   _swigc__p_tapetype_t,
   _swigc__p_unsigned_char,
 };
@@ -4120,6 +5432,7 @@ static swig_command_info swig_commands[] = {
 {"Amanda::Configc::getconf_seen", _wrap_getconf_seen},
 {"Amanda::Configc::getconf_byname", _wrap_getconf_byname},
 {"Amanda::Configc::getconf_list", _wrap_getconf_list},
+{"Amanda::Configc::getconf_byname_strs", _wrap_getconf_byname_strs},
 {"Amanda::Configc::lookup_tapetype", _wrap_lookup_tapetype},
 {"Amanda::Configc::tapetype_getconf", _wrap_tapetype_getconf},
 {"Amanda::Configc::tapetype_name", _wrap_tapetype_name},
@@ -4138,18 +5451,37 @@ static swig_command_info swig_commands[] = {
 {"Amanda::Configc::holdingdisk_getconf", _wrap_holdingdisk_getconf},
 {"Amanda::Configc::holdingdisk_name", _wrap_holdingdisk_name},
 {"Amanda::Configc::holdingdisk_seen", _wrap_holdingdisk_seen},
+{"Amanda::Configc::lookup_application", _wrap_lookup_application},
+{"Amanda::Configc::application_getconf", _wrap_application_getconf},
+{"Amanda::Configc::application_name", _wrap_application_name},
+{"Amanda::Configc::application_seen", _wrap_application_seen},
+{"Amanda::Configc::lookup_pp_script", _wrap_lookup_pp_script},
+{"Amanda::Configc::pp_script_getconf", _wrap_pp_script_getconf},
+{"Amanda::Configc::pp_script_name", _wrap_pp_script_name},
+{"Amanda::Configc::pp_script_seen", _wrap_pp_script_seen},
+{"Amanda::Configc::lookup_device_config", _wrap_lookup_device_config},
+{"Amanda::Configc::device_config_getconf", _wrap_device_config_getconf},
+{"Amanda::Configc::device_config_name", _wrap_device_config_name},
+{"Amanda::Configc::device_config_seen", _wrap_device_config_seen},
+{"Amanda::Configc::lookup_changer_config", _wrap_lookup_changer_config},
+{"Amanda::Configc::changer_config_getconf", _wrap_changer_config_getconf},
+{"Amanda::Configc::changer_config_name", _wrap_changer_config_name},
+{"Amanda::Configc::changer_config_seen", _wrap_changer_config_seen},
 {"Amanda::Configc::getconf_unit_divisor", _wrap_getconf_unit_divisor},
-{"Amanda::Configc::new_config_overwrites", _wrap_new_config_overwrites},
-{"Amanda::Configc::free_config_overwrites", _wrap_free_config_overwrites},
-{"Amanda::Configc::add_config_overwrite", _wrap_add_config_overwrite},
-{"Amanda::Configc::add_config_overwrite_opt", _wrap_add_config_overwrite_opt},
-{"Amanda::Configc::apply_config_overwrites", _wrap_apply_config_overwrites},
 {"Amanda::Configc::config_init", _wrap_config_init},
 {"Amanda::Configc::config_uninit", _wrap_config_uninit},
 {"Amanda::Configc::get_config_options", _wrap_get_config_options},
 {"Amanda::Configc::get_config_name", _wrap_get_config_name},
 {"Amanda::Configc::get_config_dir", _wrap_get_config_dir},
 {"Amanda::Configc::get_config_filename", _wrap_get_config_filename},
+{"Amanda::Configc::config_print_errors", _wrap_config_print_errors},
+{"Amanda::Configc::config_clear_errors", _wrap_config_clear_errors},
+{"Amanda::Configc::config_errors", _wrap_config_errors},
+{"Amanda::Configc::new_config_overwrites", _wrap_new_config_overwrites},
+{"Amanda::Configc::free_config_overwrites", _wrap_free_config_overwrites},
+{"Amanda::Configc::add_config_overwrite", _wrap_add_config_overwrite},
+{"Amanda::Configc::add_config_overwrite_opt", _wrap_add_config_overwrite_opt},
+{"Amanda::Configc::apply_config_overwrites", _wrap_apply_config_overwrites},
 {"Amanda::Configc::dump_configuration", _wrap_dump_configuration},
 {"Amanda::Configc::config_dir_relative", _wrap_config_dir_relative},
 {"Amanda::Configc::taperalgo2str", _wrap_taperalgo2str},
@@ -4213,7 +5545,7 @@ SWIGRUNTIME void
 SWIG_InitializeModule(void *clientdata) {
   size_t i;
   swig_module_info *module_head, *iter;
-  int found;
+  int found, init;
   
   clientdata = clientdata;
   
@@ -4223,6 +5555,9 @@ SWIG_InitializeModule(void *clientdata) {
     swig_module.type_initial = swig_type_initial;
     swig_module.cast_initial = swig_cast_initial;
     swig_module.next = &swig_module;
+    init = 1;
+  } else {
+    init = 0;
   }
   
   /* Try and load any already created modules */
@@ -4251,6 +5586,12 @@ SWIG_InitializeModule(void *clientdata) {
     module_head->next = &swig_module;
   }
   
+  /* When multiple interpeters are used, a module could have already been initialized in
+       a different interpreter, but not yet have a pointer in this interpreter.
+       In this case, we do not want to continue adding types... everything should be
+       set up already */
+  if (init == 0) return;
+  
   /* Now work on filling in swig_module.types */
 #ifdef SWIGRUNTIME_DEBUG
   printf("SWIG_InitializeModule: size %d\n", swig_module.size);
@@ -4404,7 +5745,7 @@ XS(SWIG_init) {
   /* Install variables */
   for (i = 0; swig_variables[i].name; i++) {
     SV *sv;
-    sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2);
+    sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI);
     if (swig_variables[i].type) {
       SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0);
     } else {
@@ -4416,7 +5757,7 @@ XS(SWIG_init) {
   /* Install constant */
   for (i = 0; swig_constants[i].type; i++) {
     SV *sv;
-    sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2);
+    sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI);
     switch(swig_constants[i].type) {
     case SWIG_INT:
       sv_setiv(sv, (IV) swig_constants[i].lvalue);
@@ -4439,841 +5780,1036 @@ XS(SWIG_init) {
     SvREADONLY_on(sv);
   }
   
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_ORG", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_ORG", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_ORG)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_CONF", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_CONF", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_CONF)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_INDEX_SERVER", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_INDEX_SERVER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_INDEX_SERVER)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_TAPE_SERVER", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_TAPE_SERVER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_TAPE_SERVER)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_AUTH", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_AUTH", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_AUTH)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_SSH_KEYS", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_SSH_KEYS", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_SSH_KEYS)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_AMANDAD_PATH", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_AMANDAD_PATH", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_AMANDAD_PATH)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_CLIENT_USERNAME", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_CLIENT_USERNAME", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_CLIENT_USERNAME)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_GNUTAR_LIST_DIR", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_GNUTAR_LIST_DIR", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_GNUTAR_LIST_DIR)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_AMANDATES", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_AMANDATES", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_AMANDATES)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_MAILTO", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_MAILER", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_MAILER)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_MAILTO", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_MAILTO)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_DUMPUSER", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_DUMPUSER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_DUMPUSER)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_TAPEDEV", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_TAPEDEV", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_TAPEDEV)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEVICE_PROPERTY", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEVICE_PROPERTY", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_DEVICE_PROPERTY)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_CHANGERDEV", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_PROPERTY", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_PROPERTY)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_CHANGERDEV", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_CHANGERDEV)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_CHANGERFILE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_CHANGERFILE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_CHANGERFILE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_LABELSTR", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_LABELSTR", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_LABELSTR)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_TAPELIST", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_TAPELIST", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_TAPELIST)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_DISKFILE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_DISKFILE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_DISKFILE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_INFOFILE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_INFOFILE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_INFOFILE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_LOGDIR", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_LOGDIR", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_LOGDIR)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_INDEXDIR", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_INDEXDIR", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_INDEXDIR)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_TAPETYPE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_TAPETYPE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_TAPETYPE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_DUMPCYCLE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_DUMPCYCLE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_DUMPCYCLE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_RUNSPERCYCLE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_RUNSPERCYCLE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_RUNSPERCYCLE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_TAPECYCLE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_TAPECYCLE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_TAPECYCLE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_NETUSAGE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_NETUSAGE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_NETUSAGE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_INPARALLEL", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_INPARALLEL", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_INPARALLEL)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_DUMPORDER", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_DUMPORDER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_DUMPORDER)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_BUMPPERCENT", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_BUMPPERCENT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_BUMPPERCENT)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_BUMPSIZE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_BUMPSIZE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_BUMPSIZE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_BUMPMULT", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_BUMPMULT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_BUMPMULT)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_BUMPDAYS", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_BUMPDAYS", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_BUMPDAYS)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_TPCHANGER", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_TPCHANGER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_TPCHANGER)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_RUNTAPES", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_RUNTAPES", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_RUNTAPES)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_MAXDUMPS", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_MAXDUMPS", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_MAXDUMPS)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_ETIMEOUT", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_ETIMEOUT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_ETIMEOUT)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_DTIMEOUT", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_DTIMEOUT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_DTIMEOUT)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_CTIMEOUT", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_CTIMEOUT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_CTIMEOUT)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_TAPEBUFS", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_TAPEBUFS", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_TAPEBUFS)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEVICE_OUTPUT_BUFFER_SIZE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEVICE_OUTPUT_BUFFER_SIZE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_DEVICE_OUTPUT_BUFFER_SIZE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_PRINTER", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_PRINTER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_PRINTER)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_AUTOFLUSH", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_AUTOFLUSH", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_AUTOFLUSH)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_RESERVE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_RESERVE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_RESERVE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_MAXDUMPSIZE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_MAXDUMPSIZE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_MAXDUMPSIZE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_COLUMNSPEC", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_COLUMNSPEC", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_COLUMNSPEC)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_AMRECOVER_DO_FSF", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_AMRECOVER_DO_FSF", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_AMRECOVER_DO_FSF)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_AMRECOVER_CHECK_LABEL", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_AMRECOVER_CHECK_LABEL", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_AMRECOVER_CHECK_LABEL)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_AMRECOVER_CHANGER", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_AMRECOVER_CHANGER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_AMRECOVER_CHANGER)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_TAPERALGO", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_TAPERALGO", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_TAPERALGO)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_FLUSH_THRESHOLD_DUMPED", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_FLUSH_THRESHOLD_DUMPED", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_FLUSH_THRESHOLD_DUMPED)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_FLUSH_THRESHOLD_SCHEDULED", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_FLUSH_THRESHOLD_SCHEDULED", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_FLUSH_THRESHOLD_SCHEDULED)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_TAPERFLUSH", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_TAPERFLUSH", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_TAPERFLUSH)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_DISPLAYUNIT", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_DISPLAYUNIT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_DISPLAYUNIT)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_KRB5KEYTAB", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_KRB5KEYTAB", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_KRB5KEYTAB)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_KRB5PRINCIPAL", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_KRB5PRINCIPAL", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_KRB5PRINCIPAL)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_LABEL_NEW_TAPES", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_LABEL_NEW_TAPES", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_LABEL_NEW_TAPES)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_USETIMESTAMPS", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_USETIMESTAMPS", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_USETIMESTAMPS)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_REP_TRIES", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_REP_TRIES", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_REP_TRIES)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_CONNECT_TRIES", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_CONNECT_TRIES", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_CONNECT_TRIES)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_REQ_TRIES", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_REQ_TRIES", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_REQ_TRIES)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEBUG_AMANDAD", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEBUG_AMANDAD", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_DEBUG_AMANDAD)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEBUG_AMIDXTAPED", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEBUG_AMIDXTAPED", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_DEBUG_AMIDXTAPED)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEBUG_AMINDEXD", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEBUG_AMINDEXD", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_DEBUG_AMINDEXD)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEBUG_AMRECOVER", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEBUG_AMRECOVER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_DEBUG_AMRECOVER)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEBUG_AUTH", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEBUG_AUTH", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_DEBUG_AUTH)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEBUG_EVENT", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEBUG_EVENT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_DEBUG_EVENT)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEBUG_HOLDING", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEBUG_HOLDING", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_DEBUG_HOLDING)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEBUG_PROTOCOL", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEBUG_PROTOCOL", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_DEBUG_PROTOCOL)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEBUG_PLANNER", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEBUG_PLANNER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_DEBUG_PLANNER)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEBUG_DRIVER", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEBUG_DRIVER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_DEBUG_DRIVER)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEBUG_DUMPER", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEBUG_DUMPER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_DEBUG_DUMPER)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEBUG_CHUNKER", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEBUG_CHUNKER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_DEBUG_CHUNKER)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEBUG_TAPER", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEBUG_TAPER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_DEBUG_TAPER)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEBUG_SELFCHECK", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEBUG_SELFCHECK", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_DEBUG_SELFCHECK)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEBUG_SENDSIZE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEBUG_SENDSIZE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_DEBUG_SENDSIZE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEBUG_SENDBACKUP", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_DEBUG_SENDBACKUP", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_DEBUG_SENDBACKUP)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_RESERVED_UDP_PORT", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_RESERVED_UDP_PORT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_RESERVED_UDP_PORT)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_RESERVED_TCP_PORT", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_RESERVED_TCP_PORT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_RESERVED_TCP_PORT)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CNF_UNRESERVED_TCP_PORT", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CNF_UNRESERVED_TCP_PORT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CNF_UNRESERVED_TCP_PORT)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "TAPETYPE_COMMENT", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "TAPETYPE_COMMENT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(TAPETYPE_COMMENT)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "TAPETYPE_LBL_TEMPL", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "TAPETYPE_LBL_TEMPL", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(TAPETYPE_LBL_TEMPL)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "TAPETYPE_BLOCKSIZE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "TAPETYPE_BLOCKSIZE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(TAPETYPE_BLOCKSIZE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "TAPETYPE_READBLOCKSIZE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "TAPETYPE_READBLOCKSIZE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(TAPETYPE_READBLOCKSIZE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "TAPETYPE_LENGTH", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "TAPETYPE_LENGTH", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(TAPETYPE_LENGTH)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "TAPETYPE_FILEMARK", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "TAPETYPE_FILEMARK", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(TAPETYPE_FILEMARK)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "TAPETYPE_SPEED", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "TAPETYPE_SPEED", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(TAPETYPE_SPEED)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "TAPETYPE_FILE_PAD", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "TAPETYPE_FILE_PAD", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(TAPETYPE_FILE_PAD)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_COMMENT", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_COMMENT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_COMMENT)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_PROGRAM", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_PROGRAM", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_PROGRAM)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_SRVCOMPPROG", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_SRVCOMPPROG", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_SRVCOMPPROG)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_CLNTCOMPPROG", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_CLNTCOMPPROG", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_CLNTCOMPPROG)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_SRV_ENCRYPT", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_SRV_ENCRYPT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_SRV_ENCRYPT)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_CLNT_ENCRYPT", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_CLNT_ENCRYPT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_CLNT_ENCRYPT)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_AMANDAD_PATH", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_AMANDAD_PATH", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_AMANDAD_PATH)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_CLIENT_USERNAME", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_CLIENT_USERNAME", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_CLIENT_USERNAME)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_SSH_KEYS", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_SSH_KEYS", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_SSH_KEYS)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_SECURITY_DRIVER", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_SECURITY_DRIVER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_SECURITY_DRIVER)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_EXCLUDE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_EXCLUDE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_EXCLUDE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_INCLUDE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_INCLUDE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_INCLUDE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_PRIORITY", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_PRIORITY", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_PRIORITY)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_DUMPCYCLE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_DUMPCYCLE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_DUMPCYCLE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_MAXDUMPS", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_MAXDUMPS", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_MAXDUMPS)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_MAXPROMOTEDAY", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_MAXPROMOTEDAY", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_MAXPROMOTEDAY)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_BUMPPERCENT", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_BUMPPERCENT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_BUMPPERCENT)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_BUMPSIZE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_BUMPSIZE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_BUMPSIZE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_BUMPDAYS", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_BUMPDAYS", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_BUMPDAYS)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_BUMPMULT", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_BUMPMULT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_BUMPMULT)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_STARTTIME", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_STARTTIME", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_STARTTIME)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_STRATEGY", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_STRATEGY", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_STRATEGY)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_ESTIMATE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_ESTIMATE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_ESTIMATE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_COMPRESS", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_COMPRESS", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_COMPRESS)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_ENCRYPT", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_ENCRYPT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_ENCRYPT)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_SRV_DECRYPT_OPT", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_SRV_DECRYPT_OPT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_SRV_DECRYPT_OPT)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_CLNT_DECRYPT_OPT", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_CLNT_DECRYPT_OPT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_CLNT_DECRYPT_OPT)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_COMPRATE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_COMPRATE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_COMPRATE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_TAPE_SPLITSIZE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_TAPE_SPLITSIZE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_TAPE_SPLITSIZE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_FALLBACK_SPLITSIZE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_FALLBACK_SPLITSIZE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_FALLBACK_SPLITSIZE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_SPLIT_DISKBUFFER", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_SPLIT_DISKBUFFER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_SPLIT_DISKBUFFER)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_RECORD", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_RECORD", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_RECORD)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_SKIP_INCR", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_SKIP_INCR", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_SKIP_INCR)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_SKIP_FULL", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_SKIP_FULL", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_SKIP_FULL)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_HOLDINGDISK", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_HOLDINGDISK", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_HOLDINGDISK)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_KENCRYPT", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_KENCRYPT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_KENCRYPT)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_IGNORE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_IGNORE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_IGNORE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_INDEX", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_INDEX", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_INDEX)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "INTER_COMMENT", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_APPLICATION", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_APPLICATION)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_PP_SCRIPTLIST", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_PP_SCRIPTLIST)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DUMPTYPE_PROPERTY", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DUMPTYPE_PROPERTY)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "INTER_COMMENT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(INTER_COMMENT)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "INTER_MAXUSAGE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "INTER_MAXUSAGE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(INTER_MAXUSAGE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "HOLDING_COMMENT", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "HOLDING_COMMENT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(HOLDING_COMMENT)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "HOLDING_DISKDIR", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "HOLDING_DISKDIR", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(HOLDING_DISKDIR)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "HOLDING_DISKSIZE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "HOLDING_DISKSIZE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(HOLDING_DISKSIZE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "HOLDING_CHUNKSIZE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "HOLDING_CHUNKSIZE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(HOLDING_CHUNKSIZE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "HOLD_NEVER", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "APPLICATION_COMMENT", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(APPLICATION_COMMENT)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "APPLICATION_PLUGIN", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(APPLICATION_PLUGIN)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "APPLICATION_PROPERTY", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(APPLICATION_PROPERTY)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "PP_SCRIPT_COMMENT", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PP_SCRIPT_COMMENT)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "PP_SCRIPT_PLUGIN", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PP_SCRIPT_PLUGIN)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "PP_SCRIPT_PROPERTY", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PP_SCRIPT_PROPERTY)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "PP_SCRIPT_EXECUTE_ON", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PP_SCRIPT_EXECUTE_ON)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "PP_SCRIPT_EXECUTE_WHERE", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PP_SCRIPT_EXECUTE_WHERE)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DEVICE_CONFIG_COMMENT", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DEVICE_CONFIG_COMMENT)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DEVICE_CONFIG_TAPEDEV", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DEVICE_CONFIG_TAPEDEV)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DEVICE_CONFIG_DEVICE_PROPERTY", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DEVICE_CONFIG_DEVICE_PROPERTY)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CHANGER_CONFIG_COMMENT", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CHANGER_CONFIG_COMMENT)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CHANGER_CONFIG_TAPEDEV", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CHANGER_CONFIG_TAPEDEV)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CHANGER_CONFIG_TPCHANGER", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CHANGER_CONFIG_TPCHANGER)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CHANGER_CONFIG_CHANGERDEV", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CHANGER_CONFIG_CHANGERDEV)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CHANGER_CONFIG_CHANGERFILE", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CHANGER_CONFIG_CHANGERFILE)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "HOLD_NEVER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(HOLD_NEVER)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "HOLD_AUTO", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "HOLD_AUTO", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(HOLD_AUTO)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "HOLD_REQUIRED", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "HOLD_REQUIRED", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(HOLD_REQUIRED)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "COMP_NONE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "COMP_NONE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(COMP_NONE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "COMP_FAST", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "COMP_FAST", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(COMP_FAST)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "COMP_BEST", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "COMP_BEST", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(COMP_BEST)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "COMP_CUST", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "COMP_CUST", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(COMP_CUST)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "COMP_SERVER_FAST", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "COMP_SERVER_FAST", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(COMP_SERVER_FAST)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "COMP_SERVER_BEST", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "COMP_SERVER_BEST", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(COMP_SERVER_BEST)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "COMP_SERVER_CUST", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "COMP_SERVER_CUST", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(COMP_SERVER_CUST)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "ENCRYPT_NONE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "ENCRYPT_NONE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(ENCRYPT_NONE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "ENCRYPT_CUST", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "ENCRYPT_CUST", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(ENCRYPT_CUST)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "ENCRYPT_SERV_CUST", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "ENCRYPT_SERV_CUST", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(ENCRYPT_SERV_CUST)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DS_SKIP", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DS_SKIP", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DS_SKIP)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DS_STANDARD", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DS_STANDARD", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DS_STANDARD)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DS_NOFULL", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DS_NOFULL", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DS_NOFULL)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DS_NOINC", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DS_NOINC", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DS_NOINC)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DS_4", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DS_4", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DS_4)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DS_5", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DS_5", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DS_5)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DS_HANOI", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DS_HANOI", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DS_HANOI)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "DS_INCRONLY", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DS_INCRONLY", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DS_INCRONLY)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "ES_CLIENT", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "ES_CLIENT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(ES_CLIENT)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "ES_SERVER", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "ES_SERVER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(ES_SERVER)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "ES_CALCSIZE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "ES_CALCSIZE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(ES_CALCSIZE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "ALGO_FIRST", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "ALGO_FIRST", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(ALGO_FIRST)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "ALGO_FIRSTFIT", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "ALGO_FIRSTFIT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(ALGO_FIRSTFIT)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "ALGO_LARGEST", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "ALGO_LARGEST", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(ALGO_LARGEST)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "ALGO_LARGESTFIT", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "ALGO_LARGESTFIT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(ALGO_LARGESTFIT)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "ALGO_SMALLEST", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "ALGO_SMALLEST", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(ALGO_SMALLEST)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "ALGO_LAST", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "ALGO_LAST", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(ALGO_LAST)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CONFIG_INIT_EXPLICIT_NAME", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "EXECUTE_ON_PRE_DLE_AMCHECK", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(EXECUTE_ON_PRE_DLE_AMCHECK)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "EXECUTE_ON_PRE_HOST_AMCHECK", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(EXECUTE_ON_PRE_HOST_AMCHECK)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "EXECUTE_ON_POST_DLE_AMCHECK", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(EXECUTE_ON_POST_DLE_AMCHECK)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "EXECUTE_ON_POST_HOST_AMCHECK", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(EXECUTE_ON_POST_HOST_AMCHECK)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "EXECUTE_ON_PRE_DLE_ESTIMATE", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(EXECUTE_ON_PRE_DLE_ESTIMATE)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "EXECUTE_ON_PRE_HOST_ESTIMATE", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(EXECUTE_ON_PRE_HOST_ESTIMATE)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "EXECUTE_ON_POST_DLE_ESTIMATE", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(EXECUTE_ON_POST_DLE_ESTIMATE)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "EXECUTE_ON_POST_HOST_ESTIMATE", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(EXECUTE_ON_POST_HOST_ESTIMATE)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "EXECUTE_ON_PRE_DLE_BACKUP", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(EXECUTE_ON_PRE_DLE_BACKUP)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "EXECUTE_ON_PRE_HOST_BACKUP", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(EXECUTE_ON_PRE_HOST_BACKUP)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "EXECUTE_ON_POST_DLE_BACKUP", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(EXECUTE_ON_POST_DLE_BACKUP)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "EXECUTE_ON_POST_HOST_BACKUP", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(EXECUTE_ON_POST_HOST_BACKUP)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SEND_AMREPORT_ALL", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(SEND_AMREPORT_ALL)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SEND_AMREPORT_STRANGE", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(SEND_AMREPORT_STRANGE)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SEND_AMREPORT_ERROR", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(SEND_AMREPORT_ERROR)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SEND_AMREPORT_NEVER", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(SEND_AMREPORT_NEVER)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CFGERR_OK", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CFGERR_OK)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CFGERR_WARNINGS", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CFGERR_WARNINGS)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CFGERR_ERRORS", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CFGERR_ERRORS)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CONFIG_INIT_EXPLICIT_NAME", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CONFIG_INIT_EXPLICIT_NAME)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CONFIG_INIT_USE_CWD", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CONFIG_INIT_USE_CWD", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CONFIG_INIT_USE_CWD)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CONFIG_INIT_CLIENT", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CONFIG_INIT_CLIENT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CONFIG_INIT_CLIENT)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CONFIG_INIT_OVERLAY", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CONFIG_INIT_OVERLAY", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CONFIG_INIT_OVERLAY)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CONFIG_INIT_FATAL", TRUE | 0x2);
-    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CONFIG_INIT_FATAL)));
-    SvREADONLY_on(sv);
-  } while(0) /*@SWIG@*/;
   ST(0) = &PL_sv_yes;
   XSRETURN(1);
 }
index b254c923cbab11e5306b141017dbeee779915f01..beaf07ba6659639a39507f270e449ea4628bf846 100644 (file)
@@ -1,5 +1,5 @@
 # This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.33
+# Version 1.3.35
 #
 # Don't modify this file, modify the SWIG interface instead.
 
@@ -53,6 +53,7 @@ package Amanda::Config;
 *getconf_seen = *Amanda::Configc::getconf_seen;
 *getconf_byname = *Amanda::Configc::getconf_byname;
 *getconf_list = *Amanda::Configc::getconf_list;
+*getconf_byname_strs = *Amanda::Configc::getconf_byname_strs;
 *lookup_tapetype = *Amanda::Configc::lookup_tapetype;
 *tapetype_getconf = *Amanda::Configc::tapetype_getconf;
 *tapetype_name = *Amanda::Configc::tapetype_name;
@@ -71,18 +72,37 @@ package Amanda::Config;
 *holdingdisk_getconf = *Amanda::Configc::holdingdisk_getconf;
 *holdingdisk_name = *Amanda::Configc::holdingdisk_name;
 *holdingdisk_seen = *Amanda::Configc::holdingdisk_seen;
+*lookup_application = *Amanda::Configc::lookup_application;
+*application_getconf = *Amanda::Configc::application_getconf;
+*application_name = *Amanda::Configc::application_name;
+*application_seen = *Amanda::Configc::application_seen;
+*lookup_pp_script = *Amanda::Configc::lookup_pp_script;
+*pp_script_getconf = *Amanda::Configc::pp_script_getconf;
+*pp_script_name = *Amanda::Configc::pp_script_name;
+*pp_script_seen = *Amanda::Configc::pp_script_seen;
+*lookup_device_config = *Amanda::Configc::lookup_device_config;
+*device_config_getconf = *Amanda::Configc::device_config_getconf;
+*device_config_name = *Amanda::Configc::device_config_name;
+*device_config_seen = *Amanda::Configc::device_config_seen;
+*lookup_changer_config = *Amanda::Configc::lookup_changer_config;
+*changer_config_getconf = *Amanda::Configc::changer_config_getconf;
+*changer_config_name = *Amanda::Configc::changer_config_name;
+*changer_config_seen = *Amanda::Configc::changer_config_seen;
 *getconf_unit_divisor = *Amanda::Configc::getconf_unit_divisor;
-*new_config_overwrites = *Amanda::Configc::new_config_overwrites;
-*free_config_overwrites = *Amanda::Configc::free_config_overwrites;
-*add_config_overwrite = *Amanda::Configc::add_config_overwrite;
-*add_config_overwrite_opt = *Amanda::Configc::add_config_overwrite_opt;
-*apply_config_overwrites = *Amanda::Configc::apply_config_overwrites;
 *config_init = *Amanda::Configc::config_init;
 *config_uninit = *Amanda::Configc::config_uninit;
 *get_config_options = *Amanda::Configc::get_config_options;
 *get_config_name = *Amanda::Configc::get_config_name;
 *get_config_dir = *Amanda::Configc::get_config_dir;
 *get_config_filename = *Amanda::Configc::get_config_filename;
+*config_print_errors = *Amanda::Configc::config_print_errors;
+*config_clear_errors = *Amanda::Configc::config_clear_errors;
+*config_errors = *Amanda::Configc::config_errors;
+*new_config_overwrites = *Amanda::Configc::new_config_overwrites;
+*free_config_overwrites = *Amanda::Configc::free_config_overwrites;
+*add_config_overwrite = *Amanda::Configc::add_config_overwrite;
+*add_config_overwrite_opt = *Amanda::Configc::add_config_overwrite_opt;
+*apply_config_overwrites = *Amanda::Configc::apply_config_overwrites;
 *dump_configuration = *Amanda::Configc::dump_configuration;
 *config_dir_relative = *Amanda::Configc::config_dir_relative;
 *taperalgo2str = *Amanda::Configc::taperalgo2str;
@@ -102,10 +122,12 @@ package Amanda::Config;
 *CNF_CLIENT_USERNAME = *Amanda::Configc::CNF_CLIENT_USERNAME;
 *CNF_GNUTAR_LIST_DIR = *Amanda::Configc::CNF_GNUTAR_LIST_DIR;
 *CNF_AMANDATES = *Amanda::Configc::CNF_AMANDATES;
+*CNF_MAILER = *Amanda::Configc::CNF_MAILER;
 *CNF_MAILTO = *Amanda::Configc::CNF_MAILTO;
 *CNF_DUMPUSER = *Amanda::Configc::CNF_DUMPUSER;
 *CNF_TAPEDEV = *Amanda::Configc::CNF_TAPEDEV;
 *CNF_DEVICE_PROPERTY = *Amanda::Configc::CNF_DEVICE_PROPERTY;
+*CNF_PROPERTY = *Amanda::Configc::CNF_PROPERTY;
 *CNF_CHANGERDEV = *Amanda::Configc::CNF_CHANGERDEV;
 *CNF_CHANGERFILE = *Amanda::Configc::CNF_CHANGERFILE;
 *CNF_LABELSTR = *Amanda::Configc::CNF_LABELSTR;
@@ -218,12 +240,31 @@ package Amanda::Config;
 *DUMPTYPE_KENCRYPT = *Amanda::Configc::DUMPTYPE_KENCRYPT;
 *DUMPTYPE_IGNORE = *Amanda::Configc::DUMPTYPE_IGNORE;
 *DUMPTYPE_INDEX = *Amanda::Configc::DUMPTYPE_INDEX;
+*DUMPTYPE_APPLICATION = *Amanda::Configc::DUMPTYPE_APPLICATION;
+*DUMPTYPE_PP_SCRIPTLIST = *Amanda::Configc::DUMPTYPE_PP_SCRIPTLIST;
+*DUMPTYPE_PROPERTY = *Amanda::Configc::DUMPTYPE_PROPERTY;
 *INTER_COMMENT = *Amanda::Configc::INTER_COMMENT;
 *INTER_MAXUSAGE = *Amanda::Configc::INTER_MAXUSAGE;
 *HOLDING_COMMENT = *Amanda::Configc::HOLDING_COMMENT;
 *HOLDING_DISKDIR = *Amanda::Configc::HOLDING_DISKDIR;
 *HOLDING_DISKSIZE = *Amanda::Configc::HOLDING_DISKSIZE;
 *HOLDING_CHUNKSIZE = *Amanda::Configc::HOLDING_CHUNKSIZE;
+*APPLICATION_COMMENT = *Amanda::Configc::APPLICATION_COMMENT;
+*APPLICATION_PLUGIN = *Amanda::Configc::APPLICATION_PLUGIN;
+*APPLICATION_PROPERTY = *Amanda::Configc::APPLICATION_PROPERTY;
+*PP_SCRIPT_COMMENT = *Amanda::Configc::PP_SCRIPT_COMMENT;
+*PP_SCRIPT_PLUGIN = *Amanda::Configc::PP_SCRIPT_PLUGIN;
+*PP_SCRIPT_PROPERTY = *Amanda::Configc::PP_SCRIPT_PROPERTY;
+*PP_SCRIPT_EXECUTE_ON = *Amanda::Configc::PP_SCRIPT_EXECUTE_ON;
+*PP_SCRIPT_EXECUTE_WHERE = *Amanda::Configc::PP_SCRIPT_EXECUTE_WHERE;
+*DEVICE_CONFIG_COMMENT = *Amanda::Configc::DEVICE_CONFIG_COMMENT;
+*DEVICE_CONFIG_TAPEDEV = *Amanda::Configc::DEVICE_CONFIG_TAPEDEV;
+*DEVICE_CONFIG_DEVICE_PROPERTY = *Amanda::Configc::DEVICE_CONFIG_DEVICE_PROPERTY;
+*CHANGER_CONFIG_COMMENT = *Amanda::Configc::CHANGER_CONFIG_COMMENT;
+*CHANGER_CONFIG_TAPEDEV = *Amanda::Configc::CHANGER_CONFIG_TAPEDEV;
+*CHANGER_CONFIG_TPCHANGER = *Amanda::Configc::CHANGER_CONFIG_TPCHANGER;
+*CHANGER_CONFIG_CHANGERDEV = *Amanda::Configc::CHANGER_CONFIG_CHANGERDEV;
+*CHANGER_CONFIG_CHANGERFILE = *Amanda::Configc::CHANGER_CONFIG_CHANGERFILE;
 *HOLD_NEVER = *Amanda::Configc::HOLD_NEVER;
 *HOLD_AUTO = *Amanda::Configc::HOLD_AUTO;
 *HOLD_REQUIRED = *Amanda::Configc::HOLD_REQUIRED;
@@ -254,6 +295,22 @@ package Amanda::Config;
 *ALGO_LARGESTFIT = *Amanda::Configc::ALGO_LARGESTFIT;
 *ALGO_SMALLEST = *Amanda::Configc::ALGO_SMALLEST;
 *ALGO_LAST = *Amanda::Configc::ALGO_LAST;
+*EXECUTE_ON_PRE_DLE_AMCHECK = *Amanda::Configc::EXECUTE_ON_PRE_DLE_AMCHECK;
+*EXECUTE_ON_PRE_HOST_AMCHECK = *Amanda::Configc::EXECUTE_ON_PRE_HOST_AMCHECK;
+*EXECUTE_ON_POST_DLE_AMCHECK = *Amanda::Configc::EXECUTE_ON_POST_DLE_AMCHECK;
+*EXECUTE_ON_POST_HOST_AMCHECK = *Amanda::Configc::EXECUTE_ON_POST_HOST_AMCHECK;
+*EXECUTE_ON_PRE_DLE_ESTIMATE = *Amanda::Configc::EXECUTE_ON_PRE_DLE_ESTIMATE;
+*EXECUTE_ON_PRE_HOST_ESTIMATE = *Amanda::Configc::EXECUTE_ON_PRE_HOST_ESTIMATE;
+*EXECUTE_ON_POST_DLE_ESTIMATE = *Amanda::Configc::EXECUTE_ON_POST_DLE_ESTIMATE;
+*EXECUTE_ON_POST_HOST_ESTIMATE = *Amanda::Configc::EXECUTE_ON_POST_HOST_ESTIMATE;
+*EXECUTE_ON_PRE_DLE_BACKUP = *Amanda::Configc::EXECUTE_ON_PRE_DLE_BACKUP;
+*EXECUTE_ON_PRE_HOST_BACKUP = *Amanda::Configc::EXECUTE_ON_PRE_HOST_BACKUP;
+*EXECUTE_ON_POST_DLE_BACKUP = *Amanda::Configc::EXECUTE_ON_POST_DLE_BACKUP;
+*EXECUTE_ON_POST_HOST_BACKUP = *Amanda::Configc::EXECUTE_ON_POST_HOST_BACKUP;
+*SEND_AMREPORT_ALL = *Amanda::Configc::SEND_AMREPORT_ALL;
+*SEND_AMREPORT_STRANGE = *Amanda::Configc::SEND_AMREPORT_STRANGE;
+*SEND_AMREPORT_ERROR = *Amanda::Configc::SEND_AMREPORT_ERROR;
+*SEND_AMREPORT_NEVER = *Amanda::Configc::SEND_AMREPORT_NEVER;
 *debug_amandad = *Amanda::Configc::debug_amandad;
 *debug_amidxtaped = *Amanda::Configc::debug_amidxtaped;
 *debug_amindexd = *Amanda::Configc::debug_amindexd;
@@ -270,11 +327,13 @@ package Amanda::Config;
 *debug_selfcheck = *Amanda::Configc::debug_selfcheck;
 *debug_sendsize = *Amanda::Configc::debug_sendsize;
 *debug_sendbackup = *Amanda::Configc::debug_sendbackup;
+*CFGERR_OK = *Amanda::Configc::CFGERR_OK;
+*CFGERR_WARNINGS = *Amanda::Configc::CFGERR_WARNINGS;
+*CFGERR_ERRORS = *Amanda::Configc::CFGERR_ERRORS;
 *CONFIG_INIT_EXPLICIT_NAME = *Amanda::Configc::CONFIG_INIT_EXPLICIT_NAME;
 *CONFIG_INIT_USE_CWD = *Amanda::Configc::CONFIG_INIT_USE_CWD;
 *CONFIG_INIT_CLIENT = *Amanda::Configc::CONFIG_INIT_CLIENT;
 *CONFIG_INIT_OVERLAY = *Amanda::Configc::CONFIG_INIT_OVERLAY;
-*CONFIG_INIT_FATAL = *Amanda::Configc::CONFIG_INIT_FATAL;
 
 @EXPORT_OK = ();
 %EXPORT_TAGS = ();
@@ -329,9 +388,6 @@ is loaded.
 =item If C<CONFIG_INIT_OVERLAY> is given, then any existing
 configuration is not reset.
 
-=item If C<CONFIG_INIT_FATAL> is given, then any errors are considered
-fatal, and C<config_init> does not return.
-
 =back
 
 See C<conffile.h> for more detailed information on these flags and
@@ -346,6 +402,19 @@ and filename (C</etc/amanda/DailySet1/amanda.conf>) are
 available from C<get_config_name()>, C<get_config_dir()>, and
 C<get_config_filename()>, respectively.
 
+=head3 CONFIG ERRORS
+
+This module collects configuration errors and warnings in a list, and also
+tracks the overall error level with an enumeration: C<$CFGERR_OK>,
+C<$CFGERR_WARNINGS>, and C<$CFGERR_ERRORS>.  C<config_init> and
+C<apply_config_overwrites> both return the current level.  The level and the
+list of error messages are available from C<config_errors>:
+
+  my ($cfgerr_level, @errors) = Amanda::Configconfig_errors();
+
+As a convenience, C<config_print_errors> will print all error messages to
+stderr.  The error state can be cleared with C<config_clear_errors>.
+
 =head2 CONFIG OVERWRITES
 
 Most Amanda applications accept the command-line option C<-o>
@@ -434,6 +503,10 @@ with constants beginning with C<$TAPETYPE_>
 
 with constants beginning with C<$DUMPTYPE_>
 
+=item C<interface>
+
+with constants beginning with C<$INTER_>
+
 =item C<holdingdisk>
 
 with constants beginning with C<$HOLDING_>
@@ -446,14 +519,28 @@ with constants beginning with C<$APPLICATION_>
 
 with constants beginning with C<$PP_SCRIPT_>
 
+=item C<device>
+
+with constants beginning with C<$DEVICE_CONFIG_>.
+
+=item C<changer>
+
+with constants beginning with C<$CHANGER_CONFIG_>.
+
 =back
 
 See C<conffile.h> for the names of the constants themselves.
 
-Parameter values are available by name from C<getconf_byname($name)>.
-This function implements the C<TYP:NAME:PARAM> syntax advertised by
-C<amgetconf> to access values in subsections.  C<getconf_list($typ)>
-returns a list of the names of all subsections of the given type.
+Parameter values are available by name from C<getconf_byname($name)> and
+C<getconf_byname_strs($name, $str_needs_quotes)>.  These functions implement
+the C<TYP:NAME:PARAM> syntax advertised by C<amgetconf> to access values in
+subsections.  The first function returns a perl value, while the second returns
+a string suitable for use in C<amanda.conf>, including quotes around strings if
+C<$str_needs_quotes> is true.
+
+C<getconf_list($typ)> returns a list of the names of all subsections of the
+given type.  C<%subsection_names> is a hash whose keys are allowed subsection
+names.
 
 The C<$CNF_DISPLAYUNIT> implies a certain divisor to convert from
 kilobytes to the desired unit.  This divisor is available from
@@ -557,6 +644,11 @@ push @{$EXPORT_TAGS{"confparm_key"}}, qw($CNF_AMANDATES);
 
 $_confparm_key_VALUES{"CNF_AMANDATES"} = $CNF_AMANDATES;
 
+push @EXPORT_OK, qw($CNF_MAILER);
+push @{$EXPORT_TAGS{"confparm_key"}}, qw($CNF_MAILER);
+
+$_confparm_key_VALUES{"CNF_MAILER"} = $CNF_MAILER;
+
 push @EXPORT_OK, qw($CNF_MAILTO);
 push @{$EXPORT_TAGS{"confparm_key"}}, qw($CNF_MAILTO);
 
@@ -577,6 +669,11 @@ push @{$EXPORT_TAGS{"confparm_key"}}, qw($CNF_DEVICE_PROPERTY);
 
 $_confparm_key_VALUES{"CNF_DEVICE_PROPERTY"} = $CNF_DEVICE_PROPERTY;
 
+push @EXPORT_OK, qw($CNF_PROPERTY);
+push @{$EXPORT_TAGS{"confparm_key"}}, qw($CNF_PROPERTY);
+
+$_confparm_key_VALUES{"CNF_PROPERTY"} = $CNF_PROPERTY;
+
 push @EXPORT_OK, qw($CNF_CHANGERDEV);
 push @{$EXPORT_TAGS{"confparm_key"}}, qw($CNF_CHANGERDEV);
 
@@ -1185,6 +1282,21 @@ push @{$EXPORT_TAGS{"dumptype_key"}}, qw($DUMPTYPE_INDEX);
 
 $_dumptype_key_VALUES{"DUMPTYPE_INDEX"} = $DUMPTYPE_INDEX;
 
+push @EXPORT_OK, qw($DUMPTYPE_APPLICATION);
+push @{$EXPORT_TAGS{"dumptype_key"}}, qw($DUMPTYPE_APPLICATION);
+
+$_dumptype_key_VALUES{"DUMPTYPE_APPLICATION"} = $DUMPTYPE_APPLICATION;
+
+push @EXPORT_OK, qw($DUMPTYPE_PP_SCRIPTLIST);
+push @{$EXPORT_TAGS{"dumptype_key"}}, qw($DUMPTYPE_PP_SCRIPTLIST);
+
+$_dumptype_key_VALUES{"DUMPTYPE_PP_SCRIPTLIST"} = $DUMPTYPE_PP_SCRIPTLIST;
+
+push @EXPORT_OK, qw($DUMPTYPE_PROPERTY);
+push @{$EXPORT_TAGS{"dumptype_key"}}, qw($DUMPTYPE_PROPERTY);
+
+$_dumptype_key_VALUES{"DUMPTYPE_PROPERTY"} = $DUMPTYPE_PROPERTY;
+
 #copy symbols in dumptype_key to getconf
 push @{$EXPORT_TAGS{"getconf"}},  @{$EXPORT_TAGS{"dumptype_key"}};
 
@@ -1266,6 +1378,182 @@ $_holdingdisk_key_VALUES{"HOLDING_CHUNKSIZE"} = $HOLDING_CHUNKSIZE;
 #copy symbols in holdingdisk_key to getconf
 push @{$EXPORT_TAGS{"getconf"}},  @{$EXPORT_TAGS{"holdingdisk_key"}};
 
+push @EXPORT_OK, qw(application_key_to_string);
+push @{$EXPORT_TAGS{"application_key"}}, qw(application_key_to_string);
+
+my %_application_key_VALUES;
+#Convert an enum value to a single string
+sub application_key_to_string {
+    my ($enumval) = @_;
+
+    for my $k (keys %_application_key_VALUES) {
+       my $v = $_application_key_VALUES{$k};
+
+       #is this a matching flag?
+       if ($enumval == $v) {
+           return $k;
+       }
+    }
+
+#default, just return the number
+    return $enumval;
+}
+
+push @EXPORT_OK, qw($APPLICATION_COMMENT);
+push @{$EXPORT_TAGS{"application_key"}}, qw($APPLICATION_COMMENT);
+
+$_application_key_VALUES{"APPLICATION_COMMENT"} = $APPLICATION_COMMENT;
+
+push @EXPORT_OK, qw($APPLICATION_PLUGIN);
+push @{$EXPORT_TAGS{"application_key"}}, qw($APPLICATION_PLUGIN);
+
+$_application_key_VALUES{"APPLICATION_PLUGIN"} = $APPLICATION_PLUGIN;
+
+push @EXPORT_OK, qw($APPLICATION_PROPERTY);
+push @{$EXPORT_TAGS{"application_key"}}, qw($APPLICATION_PROPERTY);
+
+$_application_key_VALUES{"APPLICATION_PROPERTY"} = $APPLICATION_PROPERTY;
+
+#copy symbols in application_key to getconf
+push @{$EXPORT_TAGS{"getconf"}},  @{$EXPORT_TAGS{"application_key"}};
+
+push @EXPORT_OK, qw(pp_script_key_to_string);
+push @{$EXPORT_TAGS{"pp_script_key"}}, qw(pp_script_key_to_string);
+
+my %_pp_script_key_VALUES;
+#Convert an enum value to a single string
+sub pp_script_key_to_string {
+    my ($enumval) = @_;
+
+    for my $k (keys %_pp_script_key_VALUES) {
+       my $v = $_pp_script_key_VALUES{$k};
+
+       #is this a matching flag?
+       if ($enumval == $v) {
+           return $k;
+       }
+    }
+
+#default, just return the number
+    return $enumval;
+}
+
+push @EXPORT_OK, qw($PP_SCRIPT_COMMENT);
+push @{$EXPORT_TAGS{"pp_script_key"}}, qw($PP_SCRIPT_COMMENT);
+
+$_pp_script_key_VALUES{"PP_SCRIPT_COMMENT"} = $PP_SCRIPT_COMMENT;
+
+push @EXPORT_OK, qw($PP_SCRIPT_PLUGIN);
+push @{$EXPORT_TAGS{"pp_script_key"}}, qw($PP_SCRIPT_PLUGIN);
+
+$_pp_script_key_VALUES{"PP_SCRIPT_PLUGIN"} = $PP_SCRIPT_PLUGIN;
+
+push @EXPORT_OK, qw($PP_SCRIPT_PROPERTY);
+push @{$EXPORT_TAGS{"pp_script_key"}}, qw($PP_SCRIPT_PROPERTY);
+
+$_pp_script_key_VALUES{"PP_SCRIPT_PROPERTY"} = $PP_SCRIPT_PROPERTY;
+
+push @EXPORT_OK, qw($PP_SCRIPT_EXECUTE_ON);
+push @{$EXPORT_TAGS{"pp_script_key"}}, qw($PP_SCRIPT_EXECUTE_ON);
+
+$_pp_script_key_VALUES{"PP_SCRIPT_EXECUTE_ON"} = $PP_SCRIPT_EXECUTE_ON;
+
+push @EXPORT_OK, qw($PP_SCRIPT_EXECUTE_WHERE);
+push @{$EXPORT_TAGS{"pp_script_key"}}, qw($PP_SCRIPT_EXECUTE_WHERE);
+
+$_pp_script_key_VALUES{"PP_SCRIPT_EXECUTE_WHERE"} = $PP_SCRIPT_EXECUTE_WHERE;
+
+#copy symbols in pp_script_key to getconf
+push @{$EXPORT_TAGS{"getconf"}},  @{$EXPORT_TAGS{"pp_script_key"}};
+
+push @EXPORT_OK, qw(device_config_key_to_string);
+push @{$EXPORT_TAGS{"device_config_key"}}, qw(device_config_key_to_string);
+
+my %_device_config_key_VALUES;
+#Convert an enum value to a single string
+sub device_config_key_to_string {
+    my ($enumval) = @_;
+
+    for my $k (keys %_device_config_key_VALUES) {
+       my $v = $_device_config_key_VALUES{$k};
+
+       #is this a matching flag?
+       if ($enumval == $v) {
+           return $k;
+       }
+    }
+
+#default, just return the number
+    return $enumval;
+}
+
+push @EXPORT_OK, qw($DEVICE_CONFIG_COMMENT);
+push @{$EXPORT_TAGS{"device_config_key"}}, qw($DEVICE_CONFIG_COMMENT);
+
+$_device_config_key_VALUES{"DEVICE_CONFIG_COMMENT"} = $DEVICE_CONFIG_COMMENT;
+
+push @EXPORT_OK, qw($DEVICE_CONFIG_TAPEDEV);
+push @{$EXPORT_TAGS{"device_config_key"}}, qw($DEVICE_CONFIG_TAPEDEV);
+
+$_device_config_key_VALUES{"DEVICE_CONFIG_TAPEDEV"} = $DEVICE_CONFIG_TAPEDEV;
+
+push @EXPORT_OK, qw($DEVICE_CONFIG_DEVICE_PROPERTY);
+push @{$EXPORT_TAGS{"device_config_key"}}, qw($DEVICE_CONFIG_DEVICE_PROPERTY);
+
+$_device_config_key_VALUES{"DEVICE_CONFIG_DEVICE_PROPERTY"} = $DEVICE_CONFIG_DEVICE_PROPERTY;
+
+#copy symbols in device_config_key to getconf
+push @{$EXPORT_TAGS{"getconf"}},  @{$EXPORT_TAGS{"device_config_key"}};
+
+push @EXPORT_OK, qw(changer_config_key_to_string);
+push @{$EXPORT_TAGS{"changer_config_key"}}, qw(changer_config_key_to_string);
+
+my %_changer_config_key_VALUES;
+#Convert an enum value to a single string
+sub changer_config_key_to_string {
+    my ($enumval) = @_;
+
+    for my $k (keys %_changer_config_key_VALUES) {
+       my $v = $_changer_config_key_VALUES{$k};
+
+       #is this a matching flag?
+       if ($enumval == $v) {
+           return $k;
+       }
+    }
+
+#default, just return the number
+    return $enumval;
+}
+
+push @EXPORT_OK, qw($CHANGER_CONFIG_COMMENT);
+push @{$EXPORT_TAGS{"changer_config_key"}}, qw($CHANGER_CONFIG_COMMENT);
+
+$_changer_config_key_VALUES{"CHANGER_CONFIG_COMMENT"} = $CHANGER_CONFIG_COMMENT;
+
+push @EXPORT_OK, qw($CHANGER_CONFIG_TAPEDEV);
+push @{$EXPORT_TAGS{"changer_config_key"}}, qw($CHANGER_CONFIG_TAPEDEV);
+
+$_changer_config_key_VALUES{"CHANGER_CONFIG_TAPEDEV"} = $CHANGER_CONFIG_TAPEDEV;
+
+push @EXPORT_OK, qw($CHANGER_CONFIG_TPCHANGER);
+push @{$EXPORT_TAGS{"changer_config_key"}}, qw($CHANGER_CONFIG_TPCHANGER);
+
+$_changer_config_key_VALUES{"CHANGER_CONFIG_TPCHANGER"} = $CHANGER_CONFIG_TPCHANGER;
+
+push @EXPORT_OK, qw($CHANGER_CONFIG_CHANGERDEV);
+push @{$EXPORT_TAGS{"changer_config_key"}}, qw($CHANGER_CONFIG_CHANGERDEV);
+
+$_changer_config_key_VALUES{"CHANGER_CONFIG_CHANGERDEV"} = $CHANGER_CONFIG_CHANGERDEV;
+
+push @EXPORT_OK, qw($CHANGER_CONFIG_CHANGERFILE);
+push @{$EXPORT_TAGS{"changer_config_key"}}, qw($CHANGER_CONFIG_CHANGERFILE);
+
+$_changer_config_key_VALUES{"CHANGER_CONFIG_CHANGERFILE"} = $CHANGER_CONFIG_CHANGERFILE;
+
+#copy symbols in changer_config_key to getconf
+push @{$EXPORT_TAGS{"getconf"}},  @{$EXPORT_TAGS{"changer_config_key"}};
+
 push @EXPORT_OK, qw(dump_holdingdisk_t_to_string);
 push @{$EXPORT_TAGS{"dump_holdingdisk_t"}}, qw(dump_holdingdisk_t_to_string);
 
@@ -1560,10 +1848,140 @@ $_taperalgo_t_VALUES{"ALGO_LAST"} = $ALGO_LAST;
 #copy symbols in taperalgo_t to getconf
 push @{$EXPORT_TAGS{"getconf"}},  @{$EXPORT_TAGS{"taperalgo_t"}};
 
+push @EXPORT_OK, qw(execute_on_t_to_string);
+push @{$EXPORT_TAGS{"execute_on_t"}}, qw(execute_on_t_to_string);
+
+my %_execute_on_t_VALUES;
+#Convert an enum value to a single string
+sub execute_on_t_to_string {
+    my ($enumval) = @_;
+
+    for my $k (keys %_execute_on_t_VALUES) {
+       my $v = $_execute_on_t_VALUES{$k};
+
+       #is this a matching flag?
+       if ($enumval == $v) {
+           return $k;
+       }
+    }
+
+#default, just return the number
+    return $enumval;
+}
+
+push @EXPORT_OK, qw($EXECUTE_ON_PRE_DLE_AMCHECK);
+push @{$EXPORT_TAGS{"execute_on_t"}}, qw($EXECUTE_ON_PRE_DLE_AMCHECK);
+
+$_execute_on_t_VALUES{"EXECUTE_ON_PRE_DLE_AMCHECK"} = $EXECUTE_ON_PRE_DLE_AMCHECK;
+
+push @EXPORT_OK, qw($EXECUTE_ON_PRE_HOST_AMCHECK);
+push @{$EXPORT_TAGS{"execute_on_t"}}, qw($EXECUTE_ON_PRE_HOST_AMCHECK);
+
+$_execute_on_t_VALUES{"EXECUTE_ON_PRE_HOST_AMCHECK"} = $EXECUTE_ON_PRE_HOST_AMCHECK;
+
+push @EXPORT_OK, qw($EXECUTE_ON_POST_DLE_AMCHECK);
+push @{$EXPORT_TAGS{"execute_on_t"}}, qw($EXECUTE_ON_POST_DLE_AMCHECK);
+
+$_execute_on_t_VALUES{"EXECUTE_ON_POST_DLE_AMCHECK"} = $EXECUTE_ON_POST_DLE_AMCHECK;
+
+push @EXPORT_OK, qw($EXECUTE_ON_POST_HOST_AMCHECK);
+push @{$EXPORT_TAGS{"execute_on_t"}}, qw($EXECUTE_ON_POST_HOST_AMCHECK);
+
+$_execute_on_t_VALUES{"EXECUTE_ON_POST_HOST_AMCHECK"} = $EXECUTE_ON_POST_HOST_AMCHECK;
+
+push @EXPORT_OK, qw($EXECUTE_ON_PRE_DLE_ESTIMATE);
+push @{$EXPORT_TAGS{"execute_on_t"}}, qw($EXECUTE_ON_PRE_DLE_ESTIMATE);
+
+$_execute_on_t_VALUES{"EXECUTE_ON_PRE_DLE_ESTIMATE"} = $EXECUTE_ON_PRE_DLE_ESTIMATE;
+
+push @EXPORT_OK, qw($EXECUTE_ON_PRE_HOST_ESTIMATE);
+push @{$EXPORT_TAGS{"execute_on_t"}}, qw($EXECUTE_ON_PRE_HOST_ESTIMATE);
+
+$_execute_on_t_VALUES{"EXECUTE_ON_PRE_HOST_ESTIMATE"} = $EXECUTE_ON_PRE_HOST_ESTIMATE;
+
+push @EXPORT_OK, qw($EXECUTE_ON_POST_DLE_ESTIMATE);
+push @{$EXPORT_TAGS{"execute_on_t"}}, qw($EXECUTE_ON_POST_DLE_ESTIMATE);
+
+$_execute_on_t_VALUES{"EXECUTE_ON_POST_DLE_ESTIMATE"} = $EXECUTE_ON_POST_DLE_ESTIMATE;
+
+push @EXPORT_OK, qw($EXECUTE_ON_POST_HOST_ESTIMATE);
+push @{$EXPORT_TAGS{"execute_on_t"}}, qw($EXECUTE_ON_POST_HOST_ESTIMATE);
+
+$_execute_on_t_VALUES{"EXECUTE_ON_POST_HOST_ESTIMATE"} = $EXECUTE_ON_POST_HOST_ESTIMATE;
+
+push @EXPORT_OK, qw($EXECUTE_ON_PRE_DLE_BACKUP);
+push @{$EXPORT_TAGS{"execute_on_t"}}, qw($EXECUTE_ON_PRE_DLE_BACKUP);
+
+$_execute_on_t_VALUES{"EXECUTE_ON_PRE_DLE_BACKUP"} = $EXECUTE_ON_PRE_DLE_BACKUP;
+
+push @EXPORT_OK, qw($EXECUTE_ON_PRE_HOST_BACKUP);
+push @{$EXPORT_TAGS{"execute_on_t"}}, qw($EXECUTE_ON_PRE_HOST_BACKUP);
+
+$_execute_on_t_VALUES{"EXECUTE_ON_PRE_HOST_BACKUP"} = $EXECUTE_ON_PRE_HOST_BACKUP;
+
+push @EXPORT_OK, qw($EXECUTE_ON_POST_DLE_BACKUP);
+push @{$EXPORT_TAGS{"execute_on_t"}}, qw($EXECUTE_ON_POST_DLE_BACKUP);
+
+$_execute_on_t_VALUES{"EXECUTE_ON_POST_DLE_BACKUP"} = $EXECUTE_ON_POST_DLE_BACKUP;
+
+push @EXPORT_OK, qw($EXECUTE_ON_POST_HOST_BACKUP);
+push @{$EXPORT_TAGS{"execute_on_t"}}, qw($EXECUTE_ON_POST_HOST_BACKUP);
+
+$_execute_on_t_VALUES{"EXECUTE_ON_POST_HOST_BACKUP"} = $EXECUTE_ON_POST_HOST_BACKUP;
+
+#copy symbols in execute_on_t to getconf
+push @{$EXPORT_TAGS{"getconf"}},  @{$EXPORT_TAGS{"execute_on_t"}};
+
+push @EXPORT_OK, qw(send_amreport_on_t_to_string);
+push @{$EXPORT_TAGS{"send_amreport_on_t"}}, qw(send_amreport_on_t_to_string);
+
+my %_send_amreport_on_t_VALUES;
+#Convert an enum value to a single string
+sub send_amreport_on_t_to_string {
+    my ($enumval) = @_;
+
+    for my $k (keys %_send_amreport_on_t_VALUES) {
+       my $v = $_send_amreport_on_t_VALUES{$k};
+
+       #is this a matching flag?
+       if ($enumval == $v) {
+           return $k;
+       }
+    }
+
+#default, just return the number
+    return $enumval;
+}
+
+push @EXPORT_OK, qw($SEND_AMREPORT_ALL);
+push @{$EXPORT_TAGS{"send_amreport_on_t"}}, qw($SEND_AMREPORT_ALL);
+
+$_send_amreport_on_t_VALUES{"SEND_AMREPORT_ALL"} = $SEND_AMREPORT_ALL;
+
+push @EXPORT_OK, qw($SEND_AMREPORT_STRANGE);
+push @{$EXPORT_TAGS{"send_amreport_on_t"}}, qw($SEND_AMREPORT_STRANGE);
+
+$_send_amreport_on_t_VALUES{"SEND_AMREPORT_STRANGE"} = $SEND_AMREPORT_STRANGE;
+
+push @EXPORT_OK, qw($SEND_AMREPORT_ERROR);
+push @{$EXPORT_TAGS{"send_amreport_on_t"}}, qw($SEND_AMREPORT_ERROR);
+
+$_send_amreport_on_t_VALUES{"SEND_AMREPORT_ERROR"} = $SEND_AMREPORT_ERROR;
+
+push @EXPORT_OK, qw($SEND_AMREPORT_NEVER);
+push @{$EXPORT_TAGS{"send_amreport_on_t"}}, qw($SEND_AMREPORT_NEVER);
+
+$_send_amreport_on_t_VALUES{"SEND_AMREPORT_NEVER"} = $SEND_AMREPORT_NEVER;
+
+#copy symbols in send_amreport_on_t to getconf
+push @{$EXPORT_TAGS{"getconf"}},  @{$EXPORT_TAGS{"send_amreport_on_t"}};
+
 push @EXPORT_OK, qw(getconf getconf_seen 
-    getconf_byname getconf_list);
+    getconf_byname getconf_byname_strs
+    getconf_list);
 push @{$EXPORT_TAGS{"getconf"}}, qw(getconf getconf_seen 
-    getconf_byname getconf_list);
+    getconf_byname getconf_byname_strs
+    getconf_list);
 
 push @EXPORT_OK, qw(lookup_tapetype tapetype_getconf tapetype_name
     tapetype_seen tapetype_seen);
@@ -1587,6 +2005,40 @@ push @{$EXPORT_TAGS{"getconf"}}, qw(lookup_holdingdisk holdingdisk_getconf holdi
     getconf_holdingdisks holdingdisk_next
     holdingdisk_seen holdingdisk_seen);
 
+push @EXPORT_OK, qw(lookup_application application_getconf application_name
+    application_seen application_seen);
+push @{$EXPORT_TAGS{"getconf"}}, qw(lookup_application application_getconf application_name
+    application_seen application_seen);
+
+push @EXPORT_OK, qw(lookup_pp_script pp_script_getconf pp_script_name
+    pp_script_seen pp_script_seen);
+push @{$EXPORT_TAGS{"getconf"}}, qw(lookup_pp_script pp_script_getconf pp_script_name
+    pp_script_seen pp_script_seen);
+
+push @EXPORT_OK, qw(lookup_device_config device_config_getconf device_config_name
+    device_config_seen device_config_seen);
+push @{$EXPORT_TAGS{"getconf"}}, qw(lookup_device_config device_config_getconf device_config_name
+    device_config_seen device_config_seen);
+
+push @EXPORT_OK, qw(lookup_changer_config changer_config_getconf changer_config_name
+    changer_config_seen changer_config_seen);
+push @{$EXPORT_TAGS{"getconf"}}, qw(lookup_changer_config changer_config_getconf changer_config_name
+    changer_config_seen changer_config_seen);
+
+our %subsection_names = (
+    "tapetype" => 1,
+    "dumptype" => 1,
+    "interface" => 1,
+    "holdingdisk" => 1,
+    "application-tool" => 1,
+    "script-tool" => 1,
+    "device" => 1,
+    "changer" => 1,
+);
+
+push @EXPORT_OK, qw(%subsection_names);
+push @{$EXPORT_TAGS{"getconf"}}, qw(%subsection_names);
+
 push @EXPORT_OK, qw(getconf_unit_divisor
 
     $debug_amandad $debug_amidxtaped $debug_amindexd $debug_amrecover
@@ -1600,10 +2052,44 @@ push @{$EXPORT_TAGS{"getconf"}}, qw(getconf_unit_divisor
     $debug_planner $debug_driver $debug_dumper $debug_chunker
     $debug_taper $debug_selfcheck $debug_sendsize $debug_sendbackup);
 
-push @EXPORT_OK, qw(new_config_overwrites free_config_overwrites add_config_overwrite
-    add_config_overwrite_opt apply_config_overwrites);
-push @{$EXPORT_TAGS{"init"}}, qw(new_config_overwrites free_config_overwrites add_config_overwrite
-    add_config_overwrite_opt apply_config_overwrites);
+push @EXPORT_OK, qw(cfgerr_level_t_to_string);
+push @{$EXPORT_TAGS{"cfgerr_level_t"}}, qw(cfgerr_level_t_to_string);
+
+my %_cfgerr_level_t_VALUES;
+#Convert an enum value to a single string
+sub cfgerr_level_t_to_string {
+    my ($enumval) = @_;
+
+    for my $k (keys %_cfgerr_level_t_VALUES) {
+       my $v = $_cfgerr_level_t_VALUES{$k};
+
+       #is this a matching flag?
+       if ($enumval == $v) {
+           return $k;
+       }
+    }
+
+#default, just return the number
+    return $enumval;
+}
+
+push @EXPORT_OK, qw($CFGERR_OK);
+push @{$EXPORT_TAGS{"cfgerr_level_t"}}, qw($CFGERR_OK);
+
+$_cfgerr_level_t_VALUES{"CFGERR_OK"} = $CFGERR_OK;
+
+push @EXPORT_OK, qw($CFGERR_WARNINGS);
+push @{$EXPORT_TAGS{"cfgerr_level_t"}}, qw($CFGERR_WARNINGS);
+
+$_cfgerr_level_t_VALUES{"CFGERR_WARNINGS"} = $CFGERR_WARNINGS;
+
+push @EXPORT_OK, qw($CFGERR_ERRORS);
+push @{$EXPORT_TAGS{"cfgerr_level_t"}}, qw($CFGERR_ERRORS);
+
+$_cfgerr_level_t_VALUES{"CFGERR_ERRORS"} = $CFGERR_ERRORS;
+
+#copy symbols in cfgerr_level_t to init
+push @{$EXPORT_TAGS{"init"}},  @{$EXPORT_TAGS{"cfgerr_level_t"}};
 
 push @EXPORT_OK, qw(config_init_flags_to_strings);
 push @{$EXPORT_TAGS{"config_init_flags"}}, qw(config_init_flags_to_strings);
@@ -1651,23 +2137,19 @@ push @{$EXPORT_TAGS{"config_init_flags"}}, qw($CONFIG_INIT_OVERLAY);
 
 $_config_init_flags_VALUES{"CONFIG_INIT_OVERLAY"} = $CONFIG_INIT_OVERLAY;
 
-push @EXPORT_OK, qw($CONFIG_INIT_FATAL);
-push @{$EXPORT_TAGS{"config_init_flags"}}, qw($CONFIG_INIT_FATAL);
-
-$_config_init_flags_VALUES{"CONFIG_INIT_FATAL"} = $CONFIG_INIT_FATAL;
-
 #copy symbols in config_init_flags to init
 push @{$EXPORT_TAGS{"init"}},  @{$EXPORT_TAGS{"config_init_flags"}};
 
-push @EXPORT_OK, qw(config_init config_uninit get_config_options);
-push @{$EXPORT_TAGS{"init"}}, qw(config_init config_uninit get_config_options);
-
-push @EXPORT_OK, qw(get_config_name 
-    get_config_dir 
-    get_config_filename);
-push @{$EXPORT_TAGS{"init"}}, qw(get_config_name 
-    get_config_dir 
-    get_config_filename);
+push @EXPORT_OK, qw(config_init config_uninit get_config_options
+    get_config_name get_config_dir get_config_filename
+    config_print_errors config_clear_errors config_errors
+    new_config_overwrites free_config_overwrites add_config_overwrite
+    add_config_overwrite_opt apply_config_overwrites);
+push @{$EXPORT_TAGS{"init"}}, qw(config_init config_uninit get_config_options
+    get_config_name get_config_dir get_config_filename
+    config_print_errors config_clear_errors config_errors
+    new_config_overwrites free_config_overwrites add_config_overwrite
+    add_config_overwrite_opt apply_config_overwrites);
 
 push @EXPORT_OK, qw(dump_configuration config_dir_relative taperalgo2str find_multiplier);
 1;
index ddeab5ed986896767c140d86138c6cb783d1847f..06f35641ce2792210fae03484f425b775a95753b 100644 (file)
@@ -14,8 +14,8 @@
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  *
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 %module "Amanda::Config"
@@ -77,9 +77,6 @@ is loaded.
 =item If C<CONFIG_INIT_OVERLAY> is given, then any existing
 configuration is not reset.
 
-=item If C<CONFIG_INIT_FATAL> is given, then any errors are considered
-fatal, and C<config_init> does not return.
-
 =back
 
 See C<conffile.h> for more detailed information on these flags and
@@ -94,6 +91,19 @@ and filename (C</etc/amanda/DailySet1/amanda.conf>) are
 available from C<get_config_name()>, C<get_config_dir()>, and
 C<get_config_filename()>, respectively.
 
+=head3 CONFIG ERRORS
+
+This module collects configuration errors and warnings in a list, and also
+tracks the overall error level with an enumeration: C<$CFGERR_OK>,
+C<$CFGERR_WARNINGS>, and C<$CFGERR_ERRORS>.  C<config_init> and
+C<apply_config_overwrites> both return the current level.  The level and the
+list of error messages are available from C<config_errors>:
+
+  my ($cfgerr_level, @errors) = Amanda::Configconfig_errors();
+
+As a convenience, C<config_print_errors> will print all error messages to
+stderr.  The error state can be cleared with C<config_clear_errors>.
+
 =head2 CONFIG OVERWRITES
 
 Most Amanda applications accept the command-line option C<-o>
@@ -182,6 +192,10 @@ with constants beginning with C<$TAPETYPE_>
 
 with constants beginning with C<$DUMPTYPE_>
 
+=item C<interface>
+
+with constants beginning with C<$INTER_>
+
 =item C<holdingdisk>
 
 with constants beginning with C<$HOLDING_>
@@ -194,14 +208,28 @@ with constants beginning with C<$APPLICATION_>
 
 with constants beginning with C<$PP_SCRIPT_>
 
+=item C<device>
+
+with constants beginning with C<$DEVICE_CONFIG_>.
+
+=item C<changer>
+
+with constants beginning with C<$CHANGER_CONFIG_>.
+
 =back
 
 See C<conffile.h> for the names of the constants themselves.
 
-Parameter values are available by name from C<getconf_byname($name)>.
-This function implements the C<TYP:NAME:PARAM> syntax advertised by
-C<amgetconf> to access values in subsections.  C<getconf_list($typ)>
-returns a list of the names of all subsections of the given type.
+Parameter values are available by name from C<getconf_byname($name)> and
+C<getconf_byname_strs($name, $str_needs_quotes)>.  These functions implement
+the C<TYP:NAME:PARAM> syntax advertised by C<amgetconf> to access values in
+subsections.  The first function returns a perl value, while the second returns
+a string suitable for use in C<amanda.conf>, including quotes around strings if
+C<$str_needs_quotes> is true.
+
+C<getconf_list($typ)> returns a list of the names of all subsections of the
+given type.  C<%subsection_names> is a hash whose keys are allowed subsection
+names.
 
 The C<$CNF_DISPLAYUNIT> implies a certain divisor to convert from
 kilobytes to the desired unit.  This divisor is available from
@@ -252,10 +280,12 @@ amglue_add_constant(CNF_AMANDAD_PATH, confparm_key);
 amglue_add_constant(CNF_CLIENT_USERNAME, confparm_key);
 amglue_add_constant(CNF_GNUTAR_LIST_DIR, confparm_key);
 amglue_add_constant(CNF_AMANDATES, confparm_key);
+amglue_add_constant(CNF_MAILER, confparm_key);
 amglue_add_constant(CNF_MAILTO, confparm_key);
 amglue_add_constant(CNF_DUMPUSER, confparm_key);
 amglue_add_constant(CNF_TAPEDEV, confparm_key);
 amglue_add_constant(CNF_DEVICE_PROPERTY, confparm_key);
+amglue_add_constant(CNF_PROPERTY, confparm_key);
 amglue_add_constant(CNF_CHANGERDEV, confparm_key);
 amglue_add_constant(CNF_CHANGERFILE, confparm_key);
 amglue_add_constant(CNF_LABELSTR, confparm_key);
@@ -374,6 +404,9 @@ amglue_add_constant(DUMPTYPE_HOLDINGDISK, dumptype_key);
 amglue_add_constant(DUMPTYPE_KENCRYPT, dumptype_key);
 amglue_add_constant(DUMPTYPE_IGNORE, dumptype_key);
 amglue_add_constant(DUMPTYPE_INDEX, dumptype_key);
+amglue_add_constant(DUMPTYPE_APPLICATION, dumptype_key);
+amglue_add_constant(DUMPTYPE_PP_SCRIPTLIST, dumptype_key);
+amglue_add_constant(DUMPTYPE_PROPERTY, dumptype_key);
 amglue_copy_to_tag(dumptype_key, getconf);
 
 amglue_add_enum_tag_fns(interface_key);
@@ -388,6 +421,34 @@ amglue_add_constant(HOLDING_DISKSIZE, holdingdisk_key);
 amglue_add_constant(HOLDING_CHUNKSIZE, holdingdisk_key);
 amglue_copy_to_tag(holdingdisk_key, getconf);
 
+amglue_add_enum_tag_fns(application_key);
+amglue_add_constant(APPLICATION_COMMENT, application_key);
+amglue_add_constant(APPLICATION_PLUGIN, application_key);
+amglue_add_constant(APPLICATION_PROPERTY, application_key);
+amglue_copy_to_tag(application_key, getconf);
+
+amglue_add_enum_tag_fns(pp_script_key);
+amglue_add_constant(PP_SCRIPT_COMMENT, pp_script_key);
+amglue_add_constant(PP_SCRIPT_PLUGIN, pp_script_key);
+amglue_add_constant(PP_SCRIPT_PROPERTY, pp_script_key);
+amglue_add_constant(PP_SCRIPT_EXECUTE_ON, pp_script_key);
+amglue_add_constant(PP_SCRIPT_EXECUTE_WHERE, pp_script_key);
+amglue_copy_to_tag(pp_script_key, getconf);
+
+amglue_add_enum_tag_fns(device_config_key);
+amglue_add_constant(DEVICE_CONFIG_COMMENT, device_config_key);
+amglue_add_constant(DEVICE_CONFIG_TAPEDEV, device_config_key);
+amglue_add_constant(DEVICE_CONFIG_DEVICE_PROPERTY, device_config_key);
+amglue_copy_to_tag(device_config_key, getconf);
+
+amglue_add_enum_tag_fns(changer_config_key);
+amglue_add_constant(CHANGER_CONFIG_COMMENT, changer_config_key);
+amglue_add_constant(CHANGER_CONFIG_TAPEDEV, changer_config_key);
+amglue_add_constant(CHANGER_CONFIG_TPCHANGER, changer_config_key);
+amglue_add_constant(CHANGER_CONFIG_CHANGERDEV, changer_config_key);
+amglue_add_constant(CHANGER_CONFIG_CHANGERFILE, changer_config_key);
+amglue_copy_to_tag(changer_config_key, getconf);
+
 /*
  * Various enumerated conftypes
  */
@@ -440,143 +501,175 @@ amglue_add_constant(ALGO_SMALLEST, taperalgo_t);
 amglue_add_constant(ALGO_LAST, taperalgo_t);
 amglue_copy_to_tag(taperalgo_t, getconf);
 
+amglue_add_enum_tag_fns(execute_on_t);
+amglue_add_constant(EXECUTE_ON_PRE_DLE_AMCHECK, execute_on_t);
+amglue_add_constant(EXECUTE_ON_PRE_HOST_AMCHECK, execute_on_t);
+amglue_add_constant(EXECUTE_ON_POST_DLE_AMCHECK, execute_on_t);
+amglue_add_constant(EXECUTE_ON_POST_HOST_AMCHECK, execute_on_t);
+amglue_add_constant(EXECUTE_ON_PRE_DLE_ESTIMATE, execute_on_t);
+amglue_add_constant(EXECUTE_ON_PRE_HOST_ESTIMATE, execute_on_t);
+amglue_add_constant(EXECUTE_ON_POST_DLE_ESTIMATE, execute_on_t);
+amglue_add_constant(EXECUTE_ON_POST_HOST_ESTIMATE, execute_on_t);
+amglue_add_constant(EXECUTE_ON_PRE_DLE_BACKUP, execute_on_t);
+amglue_add_constant(EXECUTE_ON_PRE_HOST_BACKUP, execute_on_t);
+amglue_add_constant(EXECUTE_ON_POST_DLE_BACKUP, execute_on_t);
+amglue_add_constant(EXECUTE_ON_POST_HOST_BACKUP, execute_on_t);
+amglue_copy_to_tag(execute_on_t, getconf);
+
+amglue_add_enum_tag_fns(send_amreport_on_t);
+amglue_add_constant(SEND_AMREPORT_ALL, send_amreport_on_t);
+amglue_add_constant(SEND_AMREPORT_STRANGE, send_amreport_on_t);
+amglue_add_constant(SEND_AMREPORT_ERROR, send_amreport_on_t);
+amglue_add_constant(SEND_AMREPORT_NEVER, send_amreport_on_t);
+amglue_copy_to_tag(send_amreport_on_t, getconf);
+
 /*
  * val_t typemaps
  */
 
 /* Typemap to convert a val_t, the union in which config values are
  * stored, to a Perl value of the appropriate type.  This converts:
- *  - CONFTYPE_SIZE, CONFTYPE_INT, CONFTYPE_AM64,
+ *  - CONFTYPE_SIZE, CONFTYPE_INT, CONFTYPE_INT64,
  *    CONFTYPE_BOOLEAN -> IV
  *  - CONFTYPE_REAL -> NV
  *  - CONFTYPE_STR, CONFTYPE_IDENT -> PV
  *  - CONFTYPE_TIME -> IV (epoch timestamp)
  *  - CONFTYPE_COMPRESS, CONFTYPE_ENCRYPT, CONFTYPE_ESTIMATE, CONFTYPE_STRATEGY,
- *    CONFTYPE_TAPERALGO, CONFTYPE_PRIORITY, CONFTYPE_HOLDING -> IV (enums)
+ *    CONFTYPE_TAPERALGO, CONFTYPE_PRIORITY, CONFTYPE_HOLDING, CONFTYPE_EXECUTE_ON,
+ *    CONFTYPE_EXECUTE_WHERE, SEND_AMREPORT_ON -> IV (enums)
  *  - CONFTYPE_RATE -> list of two NVs
  *  - CONFTYPE_INTRANGE -> list of two IVs
  *  - CONFTYPE_EXINCLUDE -> hashref with keys 'list' (listref), 'file' (listref), 
  *    and 'optional' (int)
- *  - CONFTYPE_PROPLIST -> hashref
+ *  - CONFTYPE_PROPLIST -> hashref of hashref with keys 'append' (IV), 'priority' (IV),
+ *                                                     'values' (listref)
  */
 %typemap (out) val_t * {
-    switch ($1->type) {
-       case CONFTYPE_RATE: {
-           $result= sv_newmortal();
-           sv_setnv($result, val_t__rate($1)[0]);
-           argvi++;
-
-           $result= sv_newmortal();
-           sv_setnv($result, val_t__rate($1)[1]);
-           argvi++;
-           break;
-       }
+    if (!$1) {
+       $result = &PL_sv_undef;
+       argvi++;
+    } else {
+       switch ($1->type) {
+           case CONFTYPE_RATE: {
+               $result= sv_newmortal();
+               sv_setnv($result, val_t__rate($1)[0]);
+               argvi++;
+
+               $result= sv_newmortal();
+               sv_setnv($result, val_t__rate($1)[1]);
+               argvi++;
+               break;
+           }
 
-       case CONFTYPE_INTRANGE: {
-           $result= sv_newmortal();
-           sv_setiv($result, val_t__intrange($1)[0]);
-           argvi++;
+           case CONFTYPE_INTRANGE: {
+               $result= sv_newmortal();
+               sv_setiv($result, val_t__intrange($1)[0]);
+               argvi++;
 
-           $result= sv_newmortal();
-           sv_setiv($result, val_t__intrange($1)[1]);
-           argvi++;
-           break;
-           break;
-       }
+               $result= sv_newmortal();
+               sv_setiv($result, val_t__intrange($1)[1]);
+               argvi++;
+               break;
+               break;
+           }
 
-       case CONFTYPE_EXINCLUDE: {
-           /* exincludes are represented in perl as {
-            *  'list' : [ 'list1', 'list2', ..],
-            *  'file' : [ 'file1', 'file2', ..],
-            *  'optional' : 1,
-            * }
-            */
-           exinclude_t *ei = &val_t__exinclude($1);
-           AV *list_entries = (AV *)sv_2mortal((SV *)newAV());
-           AV *file_entries = (AV *)sv_2mortal((SV *)newAV());
-           SV *optional = sv_newmortal();
-           HV *hv;
-           sle_t *iter;
-
-           /* first set up each of the hash values */
-
-           if (ei->sl_list) {
-               for (iter = ei->sl_list->first; iter != NULL; iter = iter->next) {
-                   av_push(list_entries, newSVpv(iter->name, 0));
+           case CONFTYPE_EXINCLUDE: {
+               /* exincludes are represented in perl as {
+                *      'list' : [ 'list1', 'list2', ..],
+                *      'file' : [ 'file1', 'file2', ..],
+                *      'optional' : 1,
+                * }
+                */
+               exinclude_t *ei = &val_t__exinclude($1);
+               AV *list_entries = (AV *)sv_2mortal((SV *)newAV());
+               AV *file_entries = (AV *)sv_2mortal((SV *)newAV());
+               SV *optional = sv_newmortal();
+               HV *hv;
+               sle_t *iter;
+
+               /* first set up each of the hash values */
+
+               if (ei->sl_list) {
+                   for (iter = ei->sl_list->first; iter != NULL; iter = iter->next) {
+                       av_push(list_entries, newSVpv(iter->name, 0));
+                   }
                }
-           }
 
-           if(ei->sl_file) {
-               for (iter = ei->sl_file->first; iter != NULL; iter = iter->next) {
-                   av_push(file_entries, newSVpv(iter->name, 0));
+               if(ei->sl_file) {
+                   for (iter = ei->sl_file->first; iter != NULL; iter = iter->next) {
+                       av_push(file_entries, newSVpv(iter->name, 0));
+                   }
                }
-           }
 
-           sv_setiv(optional, ei->optional);
+               sv_setiv(optional, ei->optional);
 
-           /* now build the hash */
-           hv = (HV *)sv_2mortal((SV *)newHV());
-           
-           hv_store(hv, "file", 4, newRV((SV *)file_entries), 0);
-           hv_store(hv, "list", 4, newRV((SV *)list_entries), 0);
-           hv_store(hv, "optional", 8, optional, 0);
-           SvREFCNT_inc(optional);
+               /* now build the hash */
+               hv = (HV *)sv_2mortal((SV *)newHV());
+               
+               hv_store(hv, "file", 4, newRV((SV *)file_entries), 0);
+               hv_store(hv, "list", 4, newRV((SV *)list_entries), 0);
+               hv_store(hv, "optional", 8, optional, 0);
+               SvREFCNT_inc(optional);
 
-           $result = sv_2mortal(newRV((SV *)hv));
-           argvi++;
-           break;
-       }
+               $result = sv_2mortal(newRV((SV *)hv));
+               argvi++;
+               break;
+           }
 
-       case CONFTYPE_PROPLIST:
-           $result = sv_2mortal(g_hash_table_to_hashref(val_t__proplist($1)));
-           argvi++;
-           break;
-
-       case CONFTYPE_SIZE:
-           $result = sv_2mortal(amglue_newSVi64(val_t__size($1)));
-           argvi++;
-           break;
-
-       case CONFTYPE_AM64:
-           $result = sv_2mortal(amglue_newSVi64(val_t__am64($1)));
-           argvi++;
-           break;
-
-       case CONFTYPE_BOOLEAN:      /* all same as INT.. */
-       case CONFTYPE_COMPRESS:
-       case CONFTYPE_ENCRYPT:
-       case CONFTYPE_ESTIMATE:
-       case CONFTYPE_STRATEGY:
-       case CONFTYPE_TAPERALGO:
-       case CONFTYPE_PRIORITY:
-       case CONFTYPE_HOLDING:
-       case CONFTYPE_INT:
-           $result = sv_2mortal(amglue_newSVi64(val_t__int($1)));
-           argvi++;
-           break;
-
-       case CONFTYPE_TIME:
-           $result = sv_2mortal(amglue_newSVi64(val_t__time($1)));
-           argvi++;
-           break;
-
-       case CONFTYPE_REAL:
-           $result = sv_newmortal();
-           sv_setnv($result, val_t__real($1));
-           argvi++;
-           break;
-
-       case CONFTYPE_IDENT:        /* same as STRING */
-       case CONFTYPE_STR:
-           $result = sv_newmortal();
-           sv_setpv($result, val_t__str($1));
-           argvi++;
-           break;
-
-       /* No match yet -> not one of the "complex" types */
-       default:
-           SWIG_exception(SWIG_TypeError, "Unknown val_t conftype");
-           break;
+           case CONFTYPE_PROPLIST:
+               $result = sv_2mortal(g_hash_table_to_hashref_property(val_t__proplist($1)));
+               argvi++;
+               break;
+
+           case CONFTYPE_SIZE:
+               $result = sv_2mortal(amglue_newSVi64(val_t__size($1)));
+               argvi++;
+               break;
+
+           case CONFTYPE_INT64:
+               $result = sv_2mortal(amglue_newSVi64(val_t__int64($1)));
+               argvi++;
+               break;
+
+           case CONFTYPE_BOOLEAN:          /* all same as INT.. */
+           case CONFTYPE_COMPRESS:
+           case CONFTYPE_ENCRYPT:
+           case CONFTYPE_ESTIMATE:
+           case CONFTYPE_STRATEGY:
+           case CONFTYPE_TAPERALGO:
+           case CONFTYPE_PRIORITY:
+           case CONFTYPE_HOLDING:
+           case CONFTYPE_EXECUTE_ON:
+           case CONFTYPE_EXECUTE_WHERE:
+           case CONFTYPE_SEND_AMREPORT_ON:
+           case CONFTYPE_INT:
+               $result = sv_2mortal(amglue_newSVi64(val_t__int($1)));
+               argvi++;
+               break;
+
+           case CONFTYPE_TIME:
+               $result = sv_2mortal(amglue_newSVi64(val_t__time($1)));
+               argvi++;
+               break;
+
+           case CONFTYPE_REAL:
+               $result = sv_newmortal();
+               sv_setnv($result, val_t__real($1));
+               argvi++;
+               break;
+
+           case CONFTYPE_IDENT:            /* same as STRING */
+           case CONFTYPE_STR:
+               $result = sv_newmortal();
+               sv_setpv($result, val_t__str($1));
+               argvi++;
+               break;
+
+           /* No match yet -> not one of the "complex" types */
+           default:
+               SWIG_exception(SWIG_TypeError, "Unknown val_t conftype");
+               break;
+       }
     }
 }
 
@@ -596,13 +689,37 @@ amglue_copy_to_tag(taperalgo_t, getconf);
     g_slist_free($1);
 }
 
+/* typedef and typemap for getconf_byname_strs, which is like getconf_byname, 
+ * but converts the result with val_t_dispaly_strs
+ */
+%typemap (out) val_t_strs {
+    char **it = $1;
+
+    while (it && *it) {
+       $result = sv_2mortal(newSVpv(*it, 0));
+       argvi++;
+       it++;
+    }
+    g_strfreev($1);
+}
+
 val_t *getconf(confparm_key key);
 gboolean getconf_seen(confparm_key key);
 val_t *getconf_byname(char *key);
 GSList *getconf_list(char *listname);
+%inline %{
+typedef char **val_t_strs;
+val_t_strs getconf_byname_strs(char *key, int str_needs_quotes) {
+    val_t *val = getconf_byname(key);
+    if (!val) return NULL;
+    return val_t_display_strs(val, str_needs_quotes);
+}
+%}
+
 amglue_export_tag(getconf,
     getconf getconf_seen 
-    getconf_byname getconf_list
+    getconf_byname getconf_byname_strs
+    getconf_list
 );
 
 tapetype_t *lookup_tapetype(char *identifier);
@@ -644,6 +761,56 @@ amglue_export_tag(getconf,
     holdingdisk_seen holdingdisk_seen
 );
 
+application_t *lookup_application(char *identifier);
+val_t *application_getconf(application_t *app, application_key key);
+char *application_name(application_t *app);
+gboolean application_seen(application_t *app, application_key key);
+amglue_export_tag(getconf,
+    lookup_application application_getconf application_name
+    application_seen application_seen
+);
+
+pp_script_t *lookup_pp_script(char *identifier);
+val_t *pp_script_getconf(pp_script_t *pps, pp_script_key key);
+char *pp_script_name(pp_script_t *pps);
+gboolean pp_script_seen(pp_script_t *app, pp_script_key key);
+amglue_export_tag(getconf,
+    lookup_pp_script pp_script_getconf pp_script_name
+    pp_script_seen pp_script_seen
+);
+
+device_config_t *lookup_device_config(char *identifier);
+val_t *device_config_getconf(device_config_t *pps, device_config_key key);
+char *device_config_name(device_config_t *pps);
+gboolean device_config_seen(device_config_t *app, device_config_key key);
+amglue_export_tag(getconf,
+    lookup_device_config device_config_getconf device_config_name
+    device_config_seen device_config_seen
+);
+
+changer_config_t *lookup_changer_config(char *identifier);
+val_t *changer_config_getconf(changer_config_t *pps, changer_config_key key);
+char *changer_config_name(changer_config_t *pps);
+gboolean changer_config_seen(changer_config_t *app, changer_config_key key);
+amglue_export_tag(getconf,
+    lookup_changer_config changer_config_getconf changer_config_name
+    changer_config_seen changer_config_seen
+);
+
+%perlcode %{
+our %subsection_names = (
+    "tapetype" => 1,
+    "dumptype" => 1,
+    "interface" => 1,
+    "holdingdisk" => 1,
+    "application-tool" => 1,
+    "script-tool" => 1,
+    "device" => 1,
+    "changer" => 1,
+);
+%}
+amglue_export_tag(getconf, %subsection_names);
+
 long int getconf_unit_divisor(void);
 
 extern int debug_amandad;
@@ -675,50 +842,64 @@ amglue_export_tag(getconf,
  * Initialization
  */
 
-config_overwrites_t *new_config_overwrites(int size_estimate);
-void free_config_overwrites(config_overwrites_t *co);
-void add_config_overwrite(config_overwrites_t *co,
-                        char *key,
-                        char *value);
-void add_config_overwrite_opt(config_overwrites_t *co,
-                             char *optarg);
-void apply_config_overwrites(config_overwrites_t *co);
-amglue_export_tag(init,
-    new_config_overwrites free_config_overwrites add_config_overwrite
-    add_config_overwrite_opt apply_config_overwrites
-);
-
-
-
+amglue_add_enum_tag_fns(cfgerr_level_t);
+amglue_add_constant(CFGERR_OK, cfgerr_level_t);
+amglue_add_constant(CFGERR_WARNINGS, cfgerr_level_t);
+amglue_add_constant(CFGERR_ERRORS, cfgerr_level_t);
+amglue_copy_to_tag(cfgerr_level_t, init);
 
 amglue_add_flag_tag_fns(config_init_flags);
 amglue_add_constant(CONFIG_INIT_EXPLICIT_NAME, config_init_flags);
 amglue_add_constant(CONFIG_INIT_USE_CWD, config_init_flags);
 amglue_add_constant(CONFIG_INIT_CLIENT, config_init_flags);
 amglue_add_constant(CONFIG_INIT_OVERLAY, config_init_flags);
-amglue_add_constant(CONFIG_INIT_FATAL, config_init_flags);
 amglue_copy_to_tag(config_init_flags, init);
 
 gboolean config_init(config_init_flags flags,
                     char *arg_config_name);
 void config_uninit(void);
 char **get_config_options(int first);
-amglue_export_tag(init,
-    config_init config_uninit get_config_options
-);
+char *get_config_name(void);
+char *get_config_dir(void);
+char *get_config_filename(void);
+
+void config_print_errors(void);
+void config_clear_errors(void);
+
+/* Typemap for config_errors' result parameter; this is a GSList of strings
+ * which should *not* be freed. */
+%typemap(in, numinputs=0) GSList **ERRLIST (GSList *templist) {
+   templist = NULL;
+   $1 = &templist;
+}
+
+%typemap (argout) GSList **ERRLIST {
+    GSList *it = *$1;
+
+    while (it) {
+       $result = sv_2mortal(newSVpv(it->data, 0));
+       argvi++;
+       it = it->next;
+    }
+}
+cfgerr_level_t config_errors(GSList **ERRLIST);
+
+
+config_overwrites_t *new_config_overwrites(int size_estimate);
+void free_config_overwrites(config_overwrites_t *co);
+void add_config_overwrite(config_overwrites_t *co,
+                        char *key,
+                        char *value);
+void add_config_overwrite_opt(config_overwrites_t *co,
+                             char *optarg);
+cfgerr_level_t apply_config_overwrites(config_overwrites_t *co);
 
-/* These are accessor functions, because SWIG's wrapping of global string
- * variables is no so good -- the resulting strings can't be passed to other
- * functions expecting char * arguments.  */
-%inline %{
-    char *get_config_name(void) { return config_name; }
-    char *get_config_dir(void) { return config_dir; }
-    char *get_config_filename(void) { return config_filename; }
-%}
 amglue_export_tag(init,
-    get_config_name 
-    get_config_dir 
-    get_config_filename
+    config_init config_uninit get_config_options
+    get_config_name get_config_dir get_config_filename
+    config_print_errors config_clear_errors config_errors
+    new_config_overwrites free_config_overwrites add_config_overwrite
+    add_config_overwrite_opt apply_config_overwrites
 );
 
 /*
@@ -726,9 +907,11 @@ amglue_export_tag(init,
  */
 
 void dump_configuration(void);
+%newobject config_dir_relative;
 char *config_dir_relative(char *filename);
 char *taperalgo2str(taperalgo_t taperalgo);
 gint64 find_multiplier(char * casestr);
+
 amglue_export_ok(
     dump_configuration config_dir_relative taperalgo2str find_multiplier
 );
diff --git a/perl/Amanda/Constants.pm.in b/perl/Amanda/Constants.pm.in
new file mode 100644 (file)
index 0000000..50630c6
--- /dev/null
@@ -0,0 +1,106 @@
+# vim:ft=perl
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+package Amanda::Constants;
+
+=head1 NAME
+
+Amanda::Constants - perl access to build-time configuration values
+
+=head1 SYNOPSIS
+
+  use Amanda::Constants;
+
+  my $default_config = $Amanda::Constants::DEFAULT_CONFIG;
+
+This package is a means of getting all of the necessary variables
+provided by configure into Perl scripts, without a bunch of
+boilerplate, and without requiring config.status substitution for
+every .pm file.  
+
+This module does not automatically export any of its values.
+
+See the source for the list of constants available.
+
+=head1 API STATUS
+
+Constants will not be removed from this file unless they are no longer available in the codebase.
+
+=cut
+
+# the 'warnings' pragma doesn't recognized exported variables as "used", and generates warnings
+# for variables only used once.  We turn it off for this module.
+no warnings;
+
+# (keep this list sorted in alphabetical order, for ease of updates)
+
+$AIX_BACKUP = "@AIX_BACKUP@";
+$AMANDA_DEBUG_DAYS = "@AMANDA_DEBUG_DAYS@";
+$ASSERTIONS = "@ASSERTIONS@";
+$BSDTCP_SECURITY = "@BSDTCP_SECURITY@";
+$BSDUDP_SECURITY = "@BSDUDP_SECURITY@";
+$BSD_SECURITY = "@BSD_SECURITY@";
+$CC = "@CC@";
+$CHECK_USERID = "@CHECK_USERID@";
+$CLIENT_HOST_INSTANCE = "@CLIENT_HOST_INSTANCE@";
+$CLIENT_HOST_KEY_FILE = "@CLIENT_HOST_KEY_FILE@";
+$CLIENT_HOST_PRINCIPAL = "@CLIENT_HOST_PRINCIPAL@";
+$CLIENT_LOGIN = "@CLIENT_LOGIN@";
+$COMPRESS_BEST_OPT = "@COMPRESS_BEST_OPT@";
+$COMPRESS_FAST_OPT = "@COMPRESS_FAST_OPT@";
+$COMPRESS_PATH = "@COMPRESS_PATH@";
+$COMPRESS_SUFFIX = "@COMPRESS_SUFFIX@";
+$DEFAULT_AMANDATES_FILE = "@DEFAULT_AMANDATES_FILE@";
+$DEFAULT_CONFIG = "@DEFAULT_CONFIG@";
+$DEFAULT_SERVER = "@DEFAULT_SERVER@";
+$DEFAULT_TAPE_DEVICE = "@DEFAULT_TAPE_DEVICE@";
+$DEFAULT_TAPE_SERVER = "@DEFAULT_TAPE_SERVER@";
+$DUMP = "@DUMP@";
+$DUMP_RETURNS_1 = "@DUMP_RETURNS_1@";
+$GNUTAR = "@GNUTAR@";
+$HAVE_GZIP = "@HAVE_GZIP@";
+$KRB4_SECURITY = "@KRB4_SECURITY@";
+$KRB5_SECURITY = "@KRB5_SECURITY@";
+$LOCKING = "@LOCKING@";
+$MAILER = "@MAILER@";
+$RESTORE = "@RESTORE@";
+$PS = "@PS@";
+$PS_ARGUMENT = "@PS_ARGUMENT@";
+$RSH_SECURITY = "@RSH_SECURITY@";
+$SAMBA_CLIENT = "@SAMBA_CLIENT@";
+$SERVER_HOST_INSTANCE = "@SERVER_HOST_INSTANCE@";
+$SERVER_HOST_KEY_FILE = "@SERVER_HOST_KEY_FILE@";
+$SERVER_HOST_PRINCIPAL = "@SERVER_HOST_PRINCIPAL@";
+$SSH_SECURITY = "@SSH_SECURITY@";
+$STAR = "@STAR@";
+$TICKET_LIFETIME = "@TICKET_LIFETIME@";
+$UNCOMPRESS_OPT = "@UNCOMPRESS_OPT@";
+$UNCOMPRESS_PATH = "@UNCOMPRESS_PATH@";
+$USE_AMANDAHOSTS = "@USE_AMANDAHOSTS@";
+$USE_RUNDUMP = "@USE_RUNDUMP@";
+$USE_VERSION_SUFFIXES = "@USE_VERSION_SUFFIXES@";
+$VDUMP = "@VDUMP@";
+$VERSION = "@VERSION@";
+$VRESTORE = "@VRESTORE@";
+$VXDUMP = "@VXDUMP@";
+$VXRESTORE = "@VXRESTORE@";
+$XFSDUMP = "@XFSDUMP@";
+$XFSRESTORE = "@XFSRESTORE@";
+
+1;
diff --git a/perl/Amanda/DB/Catalog.pm b/perl/Amanda/DB/Catalog.pm
new file mode 100644 (file)
index 0000000..8e457ea
--- /dev/null
@@ -0,0 +1,652 @@
+# Copyright (c) 2006 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc, 505 N Mathlida Ave, Suite 120
+# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+
+package Amanda::DB::Catalog;
+
+=head1 NAME
+
+Amanda::DB::Catalog - access to the Amanda catalog: where is that dump?
+
+=head1 SYNOPSIS
+
+  use Amanda::DB::Catalog;
+
+  # get all dump timestamps on record
+  my @timestamps = Amanda::DB::Catalog::get_timestamps();
+
+  # loop over those timestamps, printing dump info for each one
+  for my $timestamp (@timestamps) {
+      my @dumpfiles = Amanda::DB::Catalog::get_dumps(
+         timestamp => $timestamp,
+         ok => 1
+      );
+      print "$timstamp:\n";
+      for my $dumpfile (@dumpfiles) {
+         print " ", $dumpfile->{hostname}, ":", $dumpfile->{diskname}, 
+               " level ", $dumpfile->{level}, "\n";
+      }
+  }
+
+=head1 DESCRIPTION
+
+=head2 MODEL
+
+The Amanda catalog is a set of dumpfiles, where each dumpfile corresponds to a
+single file in a storage volume.  On tapes, files are separated by filemarks
+and numbered sequentially.  This model is preserved on non-tape media such as
+the VFS and S3 devices.  A dumpfile, then, is completely specified by a volume
+label and a file number (I<filenum>).
+
+The catalog is presented as a single table containing one row per dumpfile.
+Each row has the following values:
+
+=over
+
+=item label
+
+(string) -- volume label
+
+=item filenum
+
+(integer) -- file on that volume
+
+=item dump_timestamp
+
+(string) -- timestamp of the run in which the dump was created
+
+=item write_timestamp
+
+(string) -- timestamp of the run in which the dump was written to this volume
+
+=item hostname
+
+(string) -- dump hostname
+
+=item diskname
+
+(string) -- dump diskname
+
+=item level
+
+(integer) -- dump level
+
+=item status
+
+(string) -- "OK", "PARTIAL" or some other descriptor
+
+=item partnum
+
+(integer) -- part number of a split dump (1-based)
+
+=item nparts
+
+(integer) -- number of parts in this dump (estimated)
+
+=item kb
+
+(integer) -- size (in kb) of this dumpfile
+
+=item sec
+
+(integer) -- time (in seconds) spent writing this dumpfile
+
+=back
+
+A dumpfile is represented as a hashref with these keys.
+
+The label and filenum serve as a primary key.  The dump_timestamp, hostname,
+diskname, and level uniquely identify the dump.  The write_timestamp gives the
+time that the dump was written to this volume.  The write_timestamp may differ
+from the dump_timestamp if, for example, I<amflush> wrote the dump to tape
+after the initial dump.  The remaining fields are informational.
+
+=head2 NOTES
+
+A dumpfile may be a part of a larger (split) dump, or may be partial (due to
+end of tape or some other error), so the contents of the catalog require some
+interpretation in order to find a particular dump.
+
+All timestamps used in this module are full-length, in the format
+C<YYYYMMDDHHMMSS>.  If the underlying data contains only datestamps, they are
+zero-extended into timestamps: C<YYYYMMDD000000>.  A dump_timestamp always
+corresponds to the initiation of the I<original> dump run, while
+write_timestamp gives the time the file was written to the volume.  When
+dumpfiles are migrated from volume to volume (e.g., by I<amflush>), the
+dump_timestamp does not change.  
+
+In Amanda, the tuple (hostname, diskname, level, dump_timestamp) serves as a unique
+identifier for a dump.  Since all of this information is preserved during
+migrations, a catalog query with these four terms will return all dumpfiles
+relevant to that dump.
+
+=head2 QUERIES
+
+This API is read-only at the moment.  The following functions are available:
+
+=over
+
+=item get_write_timestamps()
+
+Get a list of all write timestamps, sorted in chronological order.
+
+=item get_latest_write_timestamp()
+
+Return the most recent write timestamp.
+
+=item get_labels_written_at_timestamp($ts)
+
+Return a list of labels for volumes written at the given timestamp.
+
+=item get_dumps(%parameters)
+
+This function is the workhorse query interface, and returns a sequence of
+dumpfiles.  Values in C<%parameters> restrict the set of dumpfiles that are
+returned.  The hash can have any of the following keys:
+
+=over
+
+=item write_timestamp
+
+restrict to dumpfiles written at this timestamp
+
+=item write_timestamps
+
+(arrayref) restrict to dumpfiles written at any of these timestamps
+
+=item dump_timestamp
+
+restrict to dumpfiles with exactly this timestamp
+
+=item dump_timestamps
+
+(arrayref) restrict to dumpfiles with any of these timestamps
+
+=item dump_timestamp_match
+
+restrict to dumpfiles with timestamps matching this expression
+
+=item hostname
+
+restrict to dumpfiles with exactly this hostname
+
+=item hostnames
+
+(arrayref) restrict to dumpfiles with any of these hostnames
+
+=item hostname_match
+
+restrict to dumpfiles with hostnames matching this expression
+
+=item diskname
+
+restrict to dumpfiles with exactly this diskname
+
+=item disknames
+
+(arrayref) restrict to dumpfiles with any of these disknames
+
+=item diskname_match
+
+restrict to dumpfiles with disknames matching this expression
+
+=item label
+
+restrict to dumpfiles with exactly this label
+
+=item labels
+
+(arrayref) restrict to dumpfiles with any of these labels
+
+=item level
+
+restrict to dumpfiles with exactly this level
+
+=item levels
+
+(arrayref) restrict to dumpfiles with any of these levels
+
+=item status
+
+restrict to dumpfiles with this status
+
+=back
+
+Match expressions are described in the amanda(8) manual page.
+
+=item sort_dumps([ $key1, $key2, .. ], @dumps)
+
+Given a list of dumps, this function sorts that list by the requested keys.
+The following keys are available:
+
+=over
+
+=item hostname
+
+=item diskname
+
+=item write_timestamp
+
+=item dump_timestamp
+
+=item level
+
+=item filenum
+
+=item label
+
+=item partnum
+
+=item kb
+
+=item sec
+
+=back
+
+Keys are processed from left to right: if two dumps have the same value for
+C<$key1>, then C<$key2> is examined, and so on.  Key names may be prefixed by
+"C<->" to reverse the order.
+
+=item add_dump($dumpfile)
+
+Add the given dumpfile to the database.  In terms of logfiles, this will either
+create a new logfile (if the dump's C<write_timestamp> has not been seen
+before) or append to an existing logfile.  Note that a new logfile will require
+a corresponding new entry in the tapelist.
+
+Note that no locking is performed: multiple simultaneous calls to this function
+can result in a corrupted or incorrect logfile.
+
+=back
+
+=head1 API STATUS
+
+New summary functions may be added to reduce code duplication in other parts of
+Amanda.
+
+Support for loading and modifying the tapelist may eventually be folded into
+this module.
+
+=cut
+
+use Amanda::Logfile;
+use Amanda::Tapelist;
+use Amanda::Config qw( :init :getconf config_dir_relative );
+use Amanda::Util qw( quote_string );
+use warnings;
+use strict;
+
+# tapelist cache
+my $tapelist = undef;
+my $tapelist_filename = undef;
+
+# utility function
+sub zeropad {
+    my ($timestamp) = @_;
+    if (length($timestamp) == 8) {
+       return $timestamp."000000";
+    }
+    return $timestamp;
+}
+
+sub get_write_timestamps {
+    my @rv;
+
+    # find_log assumes that the tapelist has been loaded, so load it now
+    _load_tapelist();
+
+    for (Amanda::Logfile::find_log()) {
+       next unless (my ($timestamp) = /^log\.([0-9]+)(?:\.[0-9]+|\.amflush)?$/);
+       push @rv, zeropad($timestamp);
+    }
+
+    return sort @rv;
+}
+
+sub get_latest_write_timestamp {
+    # get all of the timestamps and select the last one
+    my @timestamps = get_write_timestamps();
+
+    if (@timestamps) {
+       return $timestamps[-1];
+    }
+
+    return undef;
+}
+
+sub get_dumps {
+    my %params = @_;
+    my $logfile_dir = config_dir_relative(getconf($CNF_LOGDIR));
+
+    # find_log assumes that the tapelist has been loaded, so load it now
+    _load_tapelist();
+
+    # pre-process params by appending all of the "singular" parameters to the "plurals"
+    push @{$params{'write_timestamps'}}, map { zeropad($_) } $params{'write_timestamp'} 
+       if exists($params{'write_timestamp'});
+    push @{$params{'dump_timestamps'}}, map { zeropad($_) } $params{'dump_timestamp'} 
+       if exists($params{'dump_timestamp'});
+    push @{$params{'hostnames'}}, $params{'hostname'} 
+       if exists($params{'hostname'});
+    push @{$params{'disknames'}}, $params{'diskname'} 
+       if exists($params{'diskname'});
+    push @{$params{'levels'}}, $params{'level'} 
+       if exists($params{'level'});
+    push @{$params{'labels'}}, $params{'label'} 
+       if exists($params{'label'});
+
+    # Since we're working from logfiles, we have to pick the logfiles we'll use first.
+    # Then we can use search_logfile.
+    my @logfiles;
+    if (exists($params{'write_timestamps'})) {
+       # if we have specific write_timestamps, the job is pretty easy.
+       my %timestamps_hash = map { ($_, undef) } @{$params{'write_timestamps'}};
+       for my $logfile (Amanda::Logfile::find_log()) {
+           next unless (my ($timestamp) = $logfile =~ /^log\.([0-9]+)(?:\.[0-9]+|\.amflush)?$/);
+           next unless (exists($timestamps_hash{zeropad($timestamp)}));
+           push @logfiles, $logfile;
+       }
+    } elsif (exists($params{'dump_timestamps'})) {
+       # otherwise, we need only look in logfiles at or after the earliest dump timestamp
+       my @sorted_timestamps = sort @{$params{'dump_timestamps'}};
+       my $earliest_timestamp = $sorted_timestamps[0];
+       for my $logfile (Amanda::Logfile::find_log()) {
+           next unless (my ($timestamp) = $logfile =~ /^log\.([0-9]+)(?:\.[0-9]+|\.amflush)?$/);
+           next unless (zeropad($timestamp) ge $earliest_timestamp);
+           push @logfiles, $logfile;
+       }
+    } else {
+       # oh well -- it looks like we'll have to read all existing logfiles.
+       @logfiles = Amanda::Logfile::find_log();
+    }
+
+    # Set up some hash tables for speedy lookups of various attributes
+    my (%dump_timestamps_hash, %hostnames_hash, %disknames_hash, %levels_hash, %labels_hash);
+    %dump_timestamps_hash = map { ($_, undef) } @{$params{'dump_timestamps'}}
+       if (exists($params{'dump_timestamps'}));
+    %hostnames_hash = map { ($_, undef) } @{$params{'hostnames'}}
+       if (exists($params{'hostnames'}));
+    %disknames_hash = map { ($_, undef) } @{$params{'disknames'}}
+       if (exists($params{'disknames'}));
+    %levels_hash = map { ($_, undef) } @{$params{'levels'}}
+       if (exists($params{'levels'}));
+    %labels_hash = map { ($_, undef) } @{$params{'labels'}}
+       if (exists($params{'labels'}));
+
+    # now loop over those logfiles and use search_logfile to load the dumpfiles
+    # from them, then process each entry from the logfile
+    my @results;
+    for my $logfile (@logfiles) {
+       # get the raw contents from search_logfile
+       my @find_results = Amanda::Logfile::search_logfile(undef, undef,
+                                                   "$logfile_dir/$logfile", 1);
+
+       # filter against *_match with dumps_match
+       @find_results = Amanda::Logfile::dumps_match([@find_results],
+           exists($params{'hostname_match'})? $params{'hostname_match'} : undef,
+           exists($params{'diskname_match'})? $params{'diskname_match'} : undef,
+           exists($params{'dump_timestamp_match'})? $params{'dump_timestamp_match'} : undef,
+           undef,
+           0);
+
+       # convert to dumpfile hashes, including the write_timestamp from the logfile name
+       my ($timestamp) = $logfile =~ /^log\.([0-9]+)(?:\.[0-9]+|\.amflush)?$/;
+       my $write_timestamp = zeropad($timestamp);
+
+       # loop over each entry in the logfile.
+       for my $find_result (@find_results) {
+
+           # filter out the non-dump error messages that find.c produces
+           next unless (defined $find_result->{'label'});
+
+           # bail out on this result early, if possible
+           next if (%dump_timestamps_hash 
+               and !exists($dump_timestamps_hash{zeropad($find_result->{'timestamp'})}));
+           next if (%hostnames_hash 
+               and !exists($hostnames_hash{$find_result->{'hostname'}}));
+           next if (%disknames_hash 
+               and !exists($disknames_hash{$find_result->{'diskname'}}));
+           next if (%levels_hash 
+               and !exists($levels_hash{$find_result->{'level'}}));
+           next if (%labels_hash 
+               and !exists($labels_hash{$find_result->{'label'}}));
+           next if (exists($params{'status'}) 
+               and $find_result->{'status'} ne $params{'status'});
+
+           # start setting up a dumpfile hash for this result
+           my %dumpfile = (
+               'write_timestamp' => $write_timestamp,
+               'dump_timestamp' => zeropad($find_result->{'timestamp'}),
+               'hostname' => $find_result->{'hostname'},
+               'diskname' => $find_result->{'diskname'},
+               'level' => $find_result->{'level'},
+               'label' => $find_result->{'label'},
+               'filenum' => $find_result->{'filenum'},
+               'status' => $find_result->{'status'},
+               'sec' => $find_result->{'sec'},
+               'kb' => $find_result->{'kb'},
+           );
+
+           # partnum and nparts takes some special interpretation
+           if (my ($partnum, $nparts) = $find_result->{'partnum'} =~ m$(\d+)/(-?\d+)$) {
+               $dumpfile{'partnum'} = $partnum+0;
+               $dumpfile{'nparts'} = $nparts+0;
+           } else {
+               $dumpfile{'partnum'} = 1;
+               $dumpfile{'nparts'} = 1;
+           }
+
+           # check partnum and nparts
+           next if (defined($params{'partnum'}) and $dumpfile{'partnum'} != $params{'partnum'});
+           next if (defined($params{'nparts'}) and $dumpfile{'nparts'} != $params{'nparts'});
+
+           push @results, \%dumpfile;
+       }
+    }
+
+    return @results;
+}
+
+sub sort_dumps {
+    my ($keys, @dumps) = @_;
+
+    return sort {
+       my $r;
+       for my $key (@$keys) {
+           if ($key =~ /^-(.*)$/) {
+               $r = $b->{$1} cmp $a->{$1}; # note: $a and $b are reversed
+           } else {
+               $r = $a->{$key} cmp $b->{$key};
+           }
+           return $r if $r;
+       }
+       return 0;
+    } @dumps;
+}
+
+# caches for add_dump() to avoid repeatedly looking up the log
+# filename for a particular write_timestamp.
+my $add_dump_last_label = undef;
+my $add_dump_last_write_timestamp = undef;
+my $add_dump_last_logfile = undef;
+
+sub add_dump {
+    my ($dump) = @_;
+    my $found;
+    my $logfh;
+    my $logfile;
+    my $find_result;
+    my $logdir = getconf($CNF_LOGDIR);
+    my ($last_filenum, $last_secs, $last_kbs);
+
+    # first order of business is to find out whether we need to make a new
+    # dumpfile for this.
+    my $write_timestamp = zeropad($dump->{'write_timestamp'});
+    die "dump has no 'write_timestamp'" unless defined $write_timestamp;
+
+    # consult our one-element cache for this label and write_timestamp
+    if (!defined $add_dump_last_label
+       or $add_dump_last_label ne $dump->{'label'}
+       or $add_dump_last_write_timestamp ne $dump->{'write_timestamp'}) {
+
+       # update the cache
+       $add_dump_last_logfile = undef;
+       LOGFILE:
+       for my $lf (Amanda::Logfile::find_log()) {
+           next unless (my ($log_timestamp) = $lf =~ /^log\.([0-9]+)(?:\.[0-9]+|\.amflush)?$/);
+           next unless (zeropad($log_timestamp) eq $write_timestamp);
+
+           # write timestamp matches; now check the label
+           LOGFILE_DUMP:
+           for $find_result (Amanda::Logfile::search_logfile(undef, undef,
+                                       "$logdir/$lf", 1)) {
+               next unless (defined $find_result->{'label'});
+
+               if ($find_result->{'label'} eq $dump->{'label'}) {
+                   $add_dump_last_label = $dump->{'label'};
+                   $add_dump_last_write_timestamp = $dump->{'write_timestamp'};
+                   $add_dump_last_logfile = $lf;
+                   last LOGFILE;
+               }
+           }
+       }
+    }
+    $logfile = $add_dump_last_logfile;
+
+    # truncate the write_timestamp if we're not using timestamps
+    if (!getconf($CNF_USETIMESTAMPS)) {
+       $write_timestamp = substr($write_timestamp, 0, 8);
+    }
+
+    # get the information on the last dump and part in this logfile, or create
+    # a new logfile if none exists, then open the logfile for writing.
+    if (defined $logfile) {
+       $last_filenum = -1;
+
+       # NOTE: this depends on an implementation detail of search_logfile: it
+       # returns the results in the reverse order of appearance in the logfile.
+       # Since we're concerned with the last elements of this logfile that we
+       # will be appending to shortly, we simply reverse this list.  As this
+       # package is rewritten to parse logfiles on its own (or access a relational
+       # database), this implementation detail will no longer be relevant.
+       my @find_results = reverse Amanda::Logfile::search_logfile(undef, undef,
+                                                   "$logdir/$logfile", 1);
+       for $find_result (@find_results) {
+           # filter out the non-dump error messages that find.c produces
+           next unless (defined $find_result->{'label'});
+
+           $last_filenum = $find_result->{'filenum'};
+
+           # if this is part number 1, reset our secs and kbs counters on the
+           # assumption that this is the beginning of a new dump
+           if ($find_result->{'partnum'} =~ qr{1/\d}) {
+               $last_secs = $last_kbs = 0;
+           }
+           $last_secs += $find_result->{'sec'};
+           $last_kbs += $find_result->{'kb'};
+       }
+
+       open($logfh, ">>", "$logdir/$logfile");
+    } else {
+       $last_filenum = -1;
+       $last_secs = 0;
+       $last_kbs = 0;
+
+       # pick an unused log filename
+       my $i = 0;
+       while (1) {
+           $logfile = "log.$write_timestamp.$i";
+           last unless -f "$logdir/$logfile";
+           $i++;
+       }
+
+       open($logfh, ">", "$logdir/$logfile")
+           or die("Could not write '$logdir/$logfile': $!");
+
+       print $logfh
+           "INFO taper This logfile was generated by Amanda::DB::Catalog\n";
+
+       print $logfh
+           "START taper datestamp $write_timestamp label $dump->{label} tape $i\n";
+
+       if (!defined $tapelist_filename) {
+           $tapelist_filename = config_dir_relative(getconf($CNF_TAPELIST));
+       }
+
+       # reload the tapelist immediately, in case it's been modified
+       $tapelist = Amanda::Tapelist::read_tapelist($tapelist_filename);
+
+       # see if we need to add an entry to the tapelist for this dump
+       if (!grep { $_->{'label'} eq $dump->{'label'}
+                   and zeropad($_->{'datestamp'}) eq zeropad($dump->{'write_timestamp'})
+               } @$tapelist) {
+           $tapelist->add_tapelabel($write_timestamp, $dump->{'label'});
+           $tapelist->write($tapelist_filename);
+       }
+    }
+
+    if ($last_filenum >= 0 && $last_filenum+1 != $dump->{'filenum'}) {
+       warn "Discontinuity in filenums in $logfile: " .
+            "from $last_filenum to $dump->{filenum}";
+    }
+
+    my $kps = $dump->{'sec'}? (($dump->{'kb'} + 0.0) / $dump->{'sec'}) : 0.0;
+
+    my $part_line = "PART taper ";
+    $part_line .= "$dump->{label} ";
+    $part_line .= "$dump->{filenum} ";
+    $part_line .= quote_string($dump->{hostname}) . " ";
+    $part_line .= quote_string($dump->{diskname}) . " ";
+    $part_line .= "$dump->{dump_timestamp} ";
+    $part_line .= "$dump->{partnum}/$dump->{nparts} ";
+    $part_line .= "$dump->{level} ";
+    $part_line .= "[sec $dump->{sec} kb $dump->{kb} kps $kps]";
+    print $logfh "$part_line\n";
+
+    # TODO: we don't always know nparts when writing a part, so
+    # this is not always an effective way to detect a complete dump.
+    # However, it works for purposes of data vaulting.
+    if ($dump->{'partnum'} == $dump->{'nparts'}) {
+       my $secs = $last_secs + $dump->{'sec'};
+       my $kbs = $last_kbs + $dump->{'kb'};
+       $kps = $secs? ($kbs + 0.0) / $secs : 0.0;
+
+       my $done_line = "DONE taper ";
+       $done_line .= quote_string($dump->{hostname}) ." ";
+       $done_line .= quote_string($dump->{diskname}) ." ";
+       $done_line .= "$dump->{dump_timestamp} ";
+       $done_line .= "$dump->{nparts} ";
+       $done_line .= "$dump->{level} ";
+       $done_line .= "[sec $secs kb $kbs kps $kps]";
+       print $logfh "$done_line\n";
+    }
+
+    close($logfh);
+}
+
+sub _load_tapelist {
+    if (!defined $tapelist) {
+       $tapelist_filename = config_dir_relative(getconf($CNF_TAPELIST));
+       $tapelist = Amanda::Tapelist::read_tapelist($tapelist_filename);
+    }
+}
+
+sub _clear_cache { # (used by installcheck)
+    $tapelist = $tapelist_filename = undef;
+}
+
+1;
index b3ff7ae5268a3e111fbf9799c2b37432c9fba214..89c9cc3f25b3966c0ef75b677e8b9d5d59f4c19a 100644 (file)
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.33
+ * Version 1.3.35
  * 
  * This file is not intended to be easily readable and contains a number of 
  * coding conventions designed to improve portability and efficiency. Do not make
 
 /* This should only be incremented when either the layout of swig_type_info changes,
    or for whatever reason, the runtime changes incompatibly */
-#define SWIG_RUNTIME_VERSION "3"
+#define SWIG_RUNTIME_VERSION "4"
 
 /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
 #ifdef SWIG_TYPE_TABLE
 
 /* Flags for pointer conversions */
 #define SWIG_POINTER_DISOWN        0x1
+#define SWIG_CAST_NEW_MEMORY       0x2
 
 /* Flags for new pointer objects */
 #define SWIG_POINTER_OWN           0x1
@@ -297,10 +298,10 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) {
 extern "C" {
 #endif
 
-typedef void *(*swig_converter_func)(void *);
+typedef void *(*swig_converter_func)(void *, int *);
 typedef struct swig_type_info *(*swig_dycast_func)(void **);
 
-/* Structure to store inforomation on one type */
+/* Structure to store information on one type */
 typedef struct swig_type_info {
   const char             *name;                        /* mangled name of this type */
   const char             *str;                 /* human readable name of this type */
@@ -427,8 +428,8 @@ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
   Cast a pointer up an inheritance hierarchy
 */
 SWIGRUNTIMEINLINE void *
-SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
-  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
 }
 
 /* 
@@ -1061,7 +1062,7 @@ SWIG_Perl_TypeProxyName(const swig_type_info *type) {
 
 SWIGRUNTIME swig_cast_info *
 SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
-  SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp((char*)iter->type->name, c) == 0)) 
+  SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp(iter->type->name, c) == 0)) 
                            || (iter->type->clientdata && (strcmp((char*)iter->type->clientdata, c) == 0))), ty);
 }
 
@@ -1119,7 +1120,11 @@ SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *
     if (!tc) {
       return SWIG_ERROR;
     }
-    *ptr = SWIG_TypeCast(tc,voidptr);
+    {
+      int newmemory = 0;
+      *ptr = SWIG_TypeCast(tc,voidptr,&newmemory);
+      assert(!newmemory); /* newmemory handling not yet implemented */
+    }
   } else {
     *ptr = voidptr;
   }
@@ -1294,7 +1299,7 @@ SWIG_Perl_GetModule(void) {
 
   /* first check if pointer already created */
   if (!type_pointer) {
-    pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE);
+    pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI);
     if (pointer && SvOK(pointer)) {
       type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
     }
@@ -1308,7 +1313,7 @@ SWIG_Perl_SetModule(swig_module_info *module) {
   SV *pointer;
 
   /* create a new pointer */
-  pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE);
+  pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI);
   sv_setiv(pointer, PTR2IV(module));
 }
 
@@ -1440,7 +1445,7 @@ static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0};
 #define SWIG_name   "Amanda::Debugc::boot_Amanda__Debug"
 #define SWIG_prefix "Amanda::Debugc::"
 
-#define SWIGVERSION 0x010333 
+#define SWIGVERSION 0x010335 
 #define SWIG_VERSION SWIGVERSION
 
 
@@ -1770,6 +1775,23 @@ SWIGCLASS_STATIC int _wrap_error_exit_status_get(pTHX_ SV *sv, MAGIC *SWIGUNUSED
 #ifdef __cplusplus
 extern "C" {
 #endif
+XS(_wrap_debug_init) {
+  {
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: debug_init();");
+    }
+    debug_init();
+    
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
 XS(_wrap_dbopen) {
   {
     char *arg1 = (char *) 0 ;
@@ -2163,6 +2185,7 @@ static swig_variable_info swig_variables[] = {
 {0,0,0,0}
 };
 static swig_command_info swig_commands[] = {
+{"Amanda::Debugc::debug_init", _wrap_debug_init},
 {"Amanda::Debugc::dbopen", _wrap_dbopen},
 {"Amanda::Debugc::dbreopen", _wrap_dbreopen},
 {"Amanda::Debugc::dbrename", _wrap_dbrename},
@@ -2235,7 +2258,7 @@ SWIGRUNTIME void
 SWIG_InitializeModule(void *clientdata) {
   size_t i;
   swig_module_info *module_head, *iter;
-  int found;
+  int found, init;
   
   clientdata = clientdata;
   
@@ -2245,6 +2268,9 @@ SWIG_InitializeModule(void *clientdata) {
     swig_module.type_initial = swig_type_initial;
     swig_module.cast_initial = swig_cast_initial;
     swig_module.next = &swig_module;
+    init = 1;
+  } else {
+    init = 0;
   }
   
   /* Try and load any already created modules */
@@ -2273,6 +2299,12 @@ SWIG_InitializeModule(void *clientdata) {
     module_head->next = &swig_module;
   }
   
+  /* When multiple interpeters are used, a module could have already been initialized in
+       a different interpreter, but not yet have a pointer in this interpreter.
+       In this case, we do not want to continue adding types... everything should be
+       set up already */
+  if (init == 0) return;
+  
   /* Now work on filling in swig_module.types */
 #ifdef SWIGRUNTIME_DEBUG
   printf("SWIG_InitializeModule: size %d\n", swig_module.size);
@@ -2426,7 +2458,7 @@ XS(SWIG_init) {
   /* Install variables */
   for (i = 0; swig_variables[i].name; i++) {
     SV *sv;
-    sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2);
+    sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI);
     if (swig_variables[i].type) {
       SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0);
     } else {
@@ -2438,7 +2470,7 @@ XS(SWIG_init) {
   /* Install constant */
   for (i = 0; swig_constants[i].type; i++) {
     SV *sv;
-    sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2);
+    sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI);
     switch(swig_constants[i].type) {
     case SWIG_INT:
       sv_setiv(sv, (IV) swig_constants[i].lvalue);
@@ -2461,18 +2493,18 @@ XS(SWIG_init) {
     SvREADONLY_on(sv);
   }
   
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "ERR_INTERACTIVE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "ERR_INTERACTIVE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(ERR_INTERACTIVE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "ERR_SYSLOG", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "ERR_SYSLOG", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(ERR_SYSLOG)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "ERR_AMANDALOG", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "ERR_AMANDALOG", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(ERR_AMANDALOG)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
index ad6795f942e17bad8a790419199ca72313d87d83..fc1d6b1a44170f39d68d69bd72a536277f44e189 100644 (file)
@@ -1,5 +1,5 @@
 # This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.33
+# Version 1.3.35
 #
 # Don't modify this file, modify the SWIG interface instead.
 
@@ -49,6 +49,7 @@ sub this {
 
 package Amanda::Debug;
 
+*debug_init = *Amanda::Debugc::debug_init;
 *dbopen = *Amanda::Debugc::dbopen;
 *dbreopen = *Amanda::Debugc::dbreopen;
 *dbrename = *Amanda::Debugc::dbrename;
@@ -82,15 +83,14 @@ Amanda::Debug - support for debugging Amanda applications
 
 =head1 SYNOPSIS
 
-  use Amanda::Debug qw( :init :logging );
+  use Amanda::Util qw( :constants );
 
-  # (note: dbopen and such are usually handled by 
-  #  Amanda::Util::setup_applicaton)
-  dbopen("server");
+  Amanda::Util::setup_application("amcooltool", "server", $CONTEXT_CMDLINE);
 
   debug("this is a debug message");
+  die("Unable to frobnicate the ergonator");
 
-See C<debug.h> for a more in-depth description of the functionality of
+See C<debug.h> for a more in-depth description of the logging functionality of
 this module.
 
 =head1 API STATUS
@@ -99,7 +99,7 @@ Stable
 
 =head1 DEBUG LOGGING
 
-Several debug logging messages, each taking a single string, are
+Several debug logging functions, each taking a single string, are
 available:
 
 =over
@@ -118,7 +118,10 @@ available:
 
 =back
 
-ALl of the debug logging functions are available via the export tag
+Perl's built-in C<die> and C<warn> functions are patched to call C<critical>
+and C<warning>, respectively. 
+
+All of the debug logging functions are available via the export tag
 C<:logging>.
 
 =head1 ADVANCED USAGE
@@ -157,9 +160,9 @@ applications which may produce error output.
 
 =cut
 
-push @EXPORT_OK, qw(dbopen dbreopen dbrename dbclose
+push @EXPORT_OK, qw(debug_init dbopen dbreopen dbrename dbclose
     $erroutput_type $error_exit_status);
-push @{$EXPORT_TAGS{"init"}}, qw(dbopen dbreopen dbrename dbclose
+push @{$EXPORT_TAGS{"init"}}, qw(debug_init dbopen dbreopen dbrename dbclose
     $erroutput_type $error_exit_status);
 
 push @EXPORT_OK, qw(erroutput_type_t_to_strings);
@@ -203,6 +206,33 @@ push @{$EXPORT_TAGS{"erroutput_type_t"}}, qw($ERR_AMANDALOG);
 
 $_erroutput_type_t_VALUES{"AMANDALOG"} = $ERR_AMANDALOG;
 
+sub _my_die {
+    # $^S is set if we're in an eval { .. }, in which case we want
+    # to use the default Perl semantics.
+    if ($^S) {
+       die(@_);
+    } else {
+       my ($msg) = @_;
+       chomp $msg;
+       critical(@_);
+    }
+};
+$SIG{__DIE__} = \&my_die;
+
+sub _my_warn {
+    my ($msg) = @_;
+    chomp $msg;
+    warning(@_);
+};
+$SIG{__WARN__} = \&my_warn;
+
+# utility function for test scripts, which want to use the regular
+# perl mechanisms
+sub disable_die_override {
+    delete $SIG{__DIE__};
+    delete $SIG{__WARN__};
+}
+
 push @EXPORT_OK, qw(error critical warning message info debug);
 push @{$EXPORT_TAGS{"logging"}}, qw(error critical warning message info debug);
 1;
index e1285d6bfdf144db7fd3d8e1b58922b133e16368..1610b7c4aaf4f6672e796f51be4cb0f930276c57 100644 (file)
@@ -14,8 +14,8 @@
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  *
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 %module "Amanda::Debug"
@@ -34,15 +34,14 @@ Amanda::Debug - support for debugging Amanda applications
 
 =head1 SYNOPSIS
 
-  use Amanda::Debug qw( :init :logging );
+  use Amanda::Util qw( :constants );
 
-  # (note: dbopen and such are usually handled by 
-  #  Amanda::Util::setup_applicaton)
-  dbopen("server");
+  Amanda::Util::setup_application("amcooltool", "server", $CONTEXT_CMDLINE);
 
   debug("this is a debug message");
+  die("Unable to frobnicate the ergonator");
 
-See C<debug.h> for a more in-depth description of the functionality of
+See C<debug.h> for a more in-depth description of the logging functionality of
 this module.
 
 =head1 API STATUS
@@ -51,7 +50,7 @@ Stable
 
 =head1 DEBUG LOGGING
 
-Several debug logging messages, each taking a single string, are
+Several debug logging functions, each taking a single string, are
 available:
 
 =over
@@ -70,7 +69,10 @@ available:
 
 =back
 
-ALl of the debug logging functions are available via the export tag
+Perl's built-in C<die> and C<warn> functions are patched to call C<critical>
+and C<warning>, respectively. 
+
+All of the debug logging functions are available via the export tag
 C<:logging>.
 
 =head1 ADVANCED USAGE
@@ -115,10 +117,11 @@ applications which may produce error output.
  */
 
 amglue_export_tag(init,
-    dbopen dbreopen dbrename dbclose
+    debug_init dbopen dbreopen dbrename dbclose
     $erroutput_type $error_exit_status
 );
 
+void   debug_init(void);
 void   dbopen(char *subdir);
 void   dbreopen(char *file, char *notation);
 void   dbrename(char *config, char *subdir);
@@ -133,6 +136,38 @@ amglue_copy_tag_to(erroutput_type_t, init);
 erroutput_type_t erroutput_type;
 int error_exit_status;
 
+/*
+ * Override die() and warn()
+ */
+%perlcode %{
+sub _my_die {
+    # $^S is set if we're in an eval { .. }, in which case we want
+    # to use the default Perl semantics.
+    if ($^S) {
+       die(@_);
+    } else {
+       my ($msg) = @_;
+       chomp $msg;
+       critical(@_);
+    }
+};
+$SIG{__DIE__} = \&my_die;
+
+sub _my_warn {
+    my ($msg) = @_;
+    chomp $msg;
+    warning(@_);
+};
+$SIG{__WARN__} = \&my_warn;
+
+# utility function for test scripts, which want to use the regular
+# perl mechanisms
+sub disable_die_override {
+    delete $SIG{__DIE__};
+    delete $SIG{__WARN__};
+}
+%}
+
 /*
  * Logging
  */
index 0b4111811399539f86d26775531a670349a9d156..aff3abdd22e429dc454755966b45062d91812425 100644 (file)
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.33
+ * Version 1.3.35
  * 
  * This file is not intended to be easily readable and contains a number of 
  * coding conventions designed to improve portability and efficiency. Do not make
 
 /* This should only be incremented when either the layout of swig_type_info changes,
    or for whatever reason, the runtime changes incompatibly */
-#define SWIG_RUNTIME_VERSION "3"
+#define SWIG_RUNTIME_VERSION "4"
 
 /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
 #ifdef SWIG_TYPE_TABLE
 
 /* Flags for pointer conversions */
 #define SWIG_POINTER_DISOWN        0x1
+#define SWIG_CAST_NEW_MEMORY       0x2
 
 /* Flags for new pointer objects */
 #define SWIG_POINTER_OWN           0x1
@@ -297,10 +298,10 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) {
 extern "C" {
 #endif
 
-typedef void *(*swig_converter_func)(void *);
+typedef void *(*swig_converter_func)(void *, int *);
 typedef struct swig_type_info *(*swig_dycast_func)(void **);
 
-/* Structure to store inforomation on one type */
+/* Structure to store information on one type */
 typedef struct swig_type_info {
   const char             *name;                        /* mangled name of this type */
   const char             *str;                 /* human readable name of this type */
@@ -427,8 +428,8 @@ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
   Cast a pointer up an inheritance hierarchy
 */
 SWIGRUNTIMEINLINE void *
-SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
-  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
 }
 
 /* 
@@ -1061,7 +1062,7 @@ SWIG_Perl_TypeProxyName(const swig_type_info *type) {
 
 SWIGRUNTIME swig_cast_info *
 SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
-  SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp((char*)iter->type->name, c) == 0)) 
+  SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp(iter->type->name, c) == 0)) 
                            || (iter->type->clientdata && (strcmp((char*)iter->type->clientdata, c) == 0))), ty);
 }
 
@@ -1119,7 +1120,11 @@ SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *
     if (!tc) {
       return SWIG_ERROR;
     }
-    *ptr = SWIG_TypeCast(tc,voidptr);
+    {
+      int newmemory = 0;
+      *ptr = SWIG_TypeCast(tc,voidptr,&newmemory);
+      assert(!newmemory); /* newmemory handling not yet implemented */
+    }
   } else {
     *ptr = voidptr;
   }
@@ -1294,7 +1299,7 @@ SWIG_Perl_GetModule(void) {
 
   /* first check if pointer already created */
   if (!type_pointer) {
-    pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE);
+    pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI);
     if (pointer && SvOK(pointer)) {
       type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
     }
@@ -1308,7 +1313,7 @@ SWIG_Perl_SetModule(swig_module_info *module) {
   SV *pointer;
 
   /* create a new pointer */
-  pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE);
+  pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI);
   sv_setiv(pointer, PTR2IV(module));
 }
 
@@ -1434,9 +1439,10 @@ SWIG_Perl_SetModule(swig_module_info *module) {
 #define SWIGTYPE_p_guint swig_types[8]
 #define SWIGTYPE_p_guint64 swig_types[9]
 #define SWIGTYPE_p_int swig_types[10]
-#define SWIGTYPE_p_unsigned_char swig_types[11]
-static swig_type_info *swig_types[13];
-static swig_module_info swig_module = {swig_types, 12, 0, 0, 0, 0};
+#define SWIGTYPE_p_queue_fd_t swig_types[11]
+#define SWIGTYPE_p_unsigned_char swig_types[12]
+static swig_type_info *swig_types[14];
+static swig_module_info swig_module = {swig_types, 13, 0, 0, 0, 0};
 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
 
@@ -1447,7 +1453,7 @@ static swig_module_info swig_module = {swig_types, 12, 0, 0, 0, 0};
 #define SWIG_name   "Amanda::Devicec::boot_Amanda__Device"
 #define SWIG_prefix "Amanda::Devicec::"
 
-#define SWIGVERSION 0x010333 
+#define SWIGVERSION 0x010335 
 #define SWIG_VERSION SWIGVERSION
 
 
@@ -1526,7 +1532,7 @@ set_sv_from_gvalue(GValue *value)
                sv = newRV((SV *)hv);
                return newRV((SV *)hv);
            } else {
-               warn("Unsupported boxed property type #%d", boxed_type);
+               warn("Unsupported boxed property type #%d", (int)boxed_type);
 
                sv = sv_newmortal();
                sv_setsv(sv, &PL_sv_undef);
@@ -1584,7 +1590,7 @@ set_sv_from_gvalue(GValue *value)
        case G_TYPE_INTERFACE:
        case G_TYPE_OBJECT:
        case G_TYPE_PARAM:
-           warn("Unsupported fundamental property type #%d", fundamental);
+           warn("Unsupported fundamental property type #%d", (int)fundamental);
            sv_setsv(sv, &PL_sv_undef);
            break;
     }
@@ -1696,66 +1702,6 @@ SWIG_FromCharPtr(const char *cptr)
 }
 
 
-SWIGINTERN swig_type_info*
-SWIG_pchar_descriptor(void)
-{
-  static int init = 0;
-  static swig_type_info* info = 0;
-  if (!init) {
-    info = SWIG_TypeQuery("_p_char");
-    init = 1;
-  }
-  return info;
-}
-
-
-SWIGINTERN int
-SWIG_AsCharPtrAndSize(SV *obj, char** cptr, size_t* psize, int *alloc)
-{
-  if (SvPOK(obj)) {
-    STRLEN len = 0;
-    char *cstr = SvPV(obj, len); 
-    size_t size = len + 1;
-    if (cptr)  {
-      if (alloc) {
-       if (*alloc == SWIG_NEWOBJ) {
-         *cptr = (char *)memcpy((char *)malloc((size)*sizeof(char)), cstr, sizeof(char)*(size));
-       } else {
-         *cptr = cstr;
-         *alloc = SWIG_OLDOBJ;
-       }
-      }
-    }
-    if (psize) *psize = size;
-    return SWIG_OK;
-  } else {
-    swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
-    if (pchar_descriptor) {
-      char* vptr = 0; 
-      if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_descriptor, 0) == SWIG_OK) {
-       if (cptr) *cptr = vptr;
-       if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0;
-       if (alloc) *alloc = SWIG_OLDOBJ;
-       return SWIG_OK;
-      }
-    }
-  }
-  return SWIG_TypeError;
-}
-
-
-
-
-SWIGINTERN Device *new_Device(char *device_name){
-           return device_open(device_name);
-       }
-SWIGINTERN void delete_Device(Device *self){
-           g_object_unref(self);
-       }
-SWIGINTERN ReadLabelStatusFlags Device_read_label(Device *self){
-           return device_read_label(self);
-       }
-
 #include <limits.h>
 #if !defined(SWIG_NO_LLONG_MAX)
 # if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
@@ -1883,29 +1829,99 @@ SWIG_AsVal_int SWIG_PERL_DECL_ARGS_2(SV * obj, int *val)
   return res;
 }
 
+SWIGINTERN queue_fd_t *new_queue_fd_t(int fd){
+           return queue_fd_new(fd, NULL);
+       }
+SWIGINTERN void delete_queue_fd_t(queue_fd_t *self){
+           amfree(self->errmsg);
+           g_free(self);
+       }
+
+SWIGINTERN swig_type_info*
+SWIG_pchar_descriptor(void)
+{
+  static int init = 0;
+  static swig_type_info* info = 0;
+  if (!init) {
+    info = SWIG_TypeQuery("_p_char");
+    init = 1;
+  }
+  return info;
+}
+
+
+SWIGINTERN int
+SWIG_AsCharPtrAndSize(SV *obj, char** cptr, size_t* psize, int *alloc)
+{
+  if (SvPOK(obj)) {
+    STRLEN len = 0;
+    char *cstr = SvPV(obj, len); 
+    size_t size = len + 1;
+    if (cptr)  {
+      if (alloc) {
+       if (*alloc == SWIG_NEWOBJ) {
+         *cptr = (char *)memcpy((char *)malloc((size)*sizeof(char)), cstr, sizeof(char)*(size));
+       } else {
+         *cptr = cstr;
+         *alloc = SWIG_OLDOBJ;
+       }
+      }
+    }
+    if (psize) *psize = size;
+    return SWIG_OK;
+  } else {
+    swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
+    if (pchar_descriptor) {
+      char* vptr = 0; 
+      if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_descriptor, 0) == SWIG_OK) {
+       if (cptr) *cptr = vptr;
+       if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0;
+       if (alloc) *alloc = SWIG_OLDOBJ;
+       return SWIG_OK;
+      }
+    }
+  }
+  return SWIG_TypeError;
+}
+
+
+
+
+SWIGINTERN Device *new_Device(char *device_name){
+           return device_open(device_name);
+       }
+SWIGINTERN void delete_Device(Device *self){
+           g_object_unref(self);
+       }
+SWIGINTERN gboolean Device_configure(Device *self,gboolean use_global_config){
+           return device_configure(self, use_global_config);
+       }
+SWIGINTERN char *Device_error(Device *self){
+           return device_error(self);
+       }
+SWIGINTERN char *Device_status_error(Device *self){
+           return device_status_error(self);
+       }
+SWIGINTERN char *Device_error_or_status(Device *self){
+           return device_error_or_status(self);
+       }
+SWIGINTERN DeviceStatusFlags Device_read_label(Device *self){
+           return device_read_label(self);
+       }
 SWIGINTERN gboolean Device_start(Device *self,DeviceAccessMode mode,char *label,char *timestamp){
            return device_start(self, mode, label, timestamp);
        }
 SWIGINTERN gboolean Device_finish(Device *self){
            return device_finish(self);
        }
-SWIGINTERN gboolean Device_start_file(Device *self,dumpfile_t const *jobInfo){
+SWIGINTERN gboolean Device_start_file(Device *self,dumpfile_t *jobInfo){
            return device_start_file(self, jobInfo);
        }
-SWIGINTERN guint Device_write_min_size(Device *self){
-           return device_write_min_size(self);
-       }
-SWIGINTERN guint Device_write_max_size(Device *self){
-           return device_write_max_size(self);
-       }
-SWIGINTERN guint Device_read_max_size(Device *self){
-           return device_read_max_size(self);
+SWIGINTERN gboolean Device_write_block(Device *self,guint size,gpointer data){
+           return device_write_block(self, size, data);
        }
-SWIGINTERN gboolean Device_write_block(Device *self,guint size,gpointer data,gboolean short_block){
-           return device_write_block(self, size, data, short_block);
-       }
-SWIGINTERN gboolean Device_write_from_fd(Device *self,int fd){
-           return device_write_from_fd(self, fd);
+SWIGINTERN gboolean Device_write_from_fd(Device *self,queue_fd_t *queue_fd){
+           return device_write_from_fd(self, queue_fd);
        }
 SWIGINTERN gboolean Device_finish_file(Device *self){
            return device_finish_file(self);
@@ -1919,14 +1935,14 @@ SWIGINTERN gboolean Device_seek_block(Device *self,guint64 block){
 SWIGINTERN int Device_read_block(Device *self,gpointer buffer,int *size){
            return device_read_block(self, buffer, size);
        }
-SWIGINTERN gboolean Device_read_to_fd(Device *self,int fd){
-           return device_read_to_fd(self, fd);
+SWIGINTERN gboolean Device_read_to_fd(Device *self,queue_fd_t *queue_fd){
+           return device_read_to_fd(self, queue_fd);
        }
-SWIGINTERN DeviceProperty const *Device_property_list(Device *self){
+SWIGINTERN GSList const *Device_property_list(Device *self){
            return device_property_get_list(self);
        }
-SWIGINTERN void Device_property_get(Device *self,DevicePropertyBase *pbase,GValue *out_val,gboolean *val_found){
-           *val_found = device_property_get(self, pbase->ID, out_val);
+SWIGINTERN void Device_property_get(Device *self,DevicePropertyBase *pbase,GValue *out_val,PropertySurety *surety,PropertySource *source,gboolean *val_found){
+           *val_found = device_property_get_ex(self, pbase->ID, out_val, surety, source);
        }
 SWIGINTERN gboolean Device_property_set(Device *self,DevicePropertyBase *pbase,SV *sv){
            GValue gval;
@@ -1938,6 +1954,22 @@ SWIGINTERN gboolean Device_property_set(Device *self,DevicePropertyBase *pbase,S
            if (!device_property_set(self, pbase->ID, &gval))
                goto fail;
 
+           g_value_unset(&gval);
+           return TRUE;
+       fail:
+           g_value_unset(&gval);
+           return FALSE;
+       }
+SWIGINTERN gboolean Device_property_set_ex(Device *self,DevicePropertyBase *pbase,SV *sv,PropertySurety surety,PropertySource source){
+           GValue gval;
+           memset(&gval, 0, sizeof(gval));
+           g_value_init(&gval, pbase->type);
+           if (!set_gvalue_from_sv(sv, &gval))
+               goto fail;
+
+           if (!device_property_set_ex(self, pbase->ID, &gval, surety, source))
+               goto fail;
+
            g_value_unset(&gval);
            return TRUE;
        fail:
@@ -1947,9 +1979,19 @@ SWIGINTERN gboolean Device_property_set(Device *self,DevicePropertyBase *pbase,S
 SWIGINTERN gboolean Device_recycle_file(Device *self,guint filenum){
            return device_recycle_file(self, filenum);
        }
-SWIGINTERN void Device_set_startup_properties_from_config(Device *self){
-           device_set_startup_properties_from_config(self);
-       }
+SWIGINTERN int Device_file(Device *self){ return self->file; }
+SWIGINTERN guint64 Device_block(Device *self){ return self->block; }
+SWIGINTERN gboolean Device_in_file(Device *self){ return self->in_file; }
+SWIGINTERN char *Device_device_name(Device *self){ return self->device_name; }
+SWIGINTERN DeviceAccessMode Device_access_mode(Device *self){ return self->access_mode; }
+SWIGINTERN gboolean Device_is_eof(Device *self){ return self->is_eof; }
+SWIGINTERN char *Device_volume_label(Device *self){ return self->volume_label; }
+SWIGINTERN char *Device_volume_time(Device *self){ return self->volume_time; }
+SWIGINTERN DeviceStatusFlags Device_status(Device *self){ return self->status; }
+SWIGINTERN gsize Device_min_block_size(Device *self){ return self->min_block_size; }
+SWIGINTERN gsize Device_max_block_size(Device *self){ return self->max_block_size; }
+SWIGINTERN gsize Device_block_size(Device *self){ return self->block_size; }
+SWIGINTERN dumpfile_t *Device_volume_header(Device *self){ return self->volume_header; }
 
 SWIGINTERNINLINE SV *
 SWIG_From_long  SWIG_PERL_DECL_ARGS_1(long value)
@@ -1995,9 +2037,9 @@ SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *SWIGUNUSEDPARM(sv), MAGIC *SW
 #ifdef __cplusplus
 extern "C" {
 #endif
-XS(_wrap_Device_file_get) {
+XS(_wrap_queue_fd_t_fd_get) {
   {
-    Device *arg1 = (Device *) 0 ;
+    queue_fd_t *arg1 = (queue_fd_t *) 0 ;
     int result;
     void *argp1 = 0 ;
     int res1 = 0 ;
@@ -2005,14 +2047,14 @@ XS(_wrap_Device_file_get) {
     dXSARGS;
     
     if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: Device_file_get(self);");
+      SWIG_croak("Usage: queue_fd_t_fd_get(self);");
     }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_queue_fd_t, 0 |  0 );
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_file_get" "', argument " "1"" of type '" "Device *""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "queue_fd_t_fd_get" "', argument " "1"" of type '" "queue_fd_t *""'"); 
     }
-    arg1 = (Device *)(argp1);
-    result = (int) ((arg1)->file);
+    arg1 = (queue_fd_t *)(argp1);
+    result = (int) ((arg1)->fd);
     {
       ST(argvi) = sv_2mortal(amglue_newSVi64(result));
       argvi++;
@@ -2026,28 +2068,25 @@ XS(_wrap_Device_file_get) {
 }
 
 
-XS(_wrap_Device_block_get) {
+XS(_wrap_queue_fd_t_errmsg_get) {
   {
-    Device *arg1 = (Device *) 0 ;
-    guint64 result;
+    queue_fd_t *arg1 = (queue_fd_t *) 0 ;
+    char *result = 0 ;
     void *argp1 = 0 ;
     int res1 = 0 ;
     int argvi = 0;
     dXSARGS;
     
     if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: Device_block_get(self);");
+      SWIG_croak("Usage: queue_fd_t_errmsg_get(self);");
     }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_queue_fd_t, 0 |  0 );
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_block_get" "', argument " "1"" of type '" "Device *""'"); 
-    }
-    arg1 = (Device *)(argp1);
-    result =  ((arg1)->block);
-    {
-      ST(argvi) = sv_2mortal(amglue_newSVu64(result));
-      argvi++;
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "queue_fd_t_errmsg_get" "', argument " "1"" of type '" "queue_fd_t *""'"); 
     }
+    arg1 = (queue_fd_t *)(argp1);
+    result = (char *) ((arg1)->errmsg);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
     
     XSRETURN(argvi);
   fail:
@@ -2057,28 +2096,31 @@ XS(_wrap_Device_block_get) {
 }
 
 
-XS(_wrap_Device_in_file_get) {
+XS(_wrap_new_queue_fd_t) {
   {
-    Device *arg1 = (Device *) 0 ;
-    gboolean result;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
+    int arg1 ;
+    queue_fd_t *result = 0 ;
     int argvi = 0;
     dXSARGS;
     
     if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: Device_in_file_get(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_in_file_get" "', argument " "1"" of type '" "Device *""'"); 
+      SWIG_croak("Usage: new_queue_fd_t(fd);");
     }
-    arg1 = (Device *)(argp1);
-    result = (gboolean) ((arg1)->in_file);
     {
-      ST(argvi) = sv_2mortal(amglue_newSVi64(result));
-      argvi++;
+      if (sizeof(signed int) == 1) {
+        arg1 = amglue_SvI8(ST(0));
+      } else if (sizeof(signed int) == 2) {
+        arg1 = amglue_SvI16(ST(0));
+      } else if (sizeof(signed int) == 4) {
+        arg1 = amglue_SvI32(ST(0));
+      } else if (sizeof(signed int) == 8) {
+        arg1 = amglue_SvI64(ST(0));
+      } else {
+        g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
+      }
     }
+    result = (queue_fd_t *)new_queue_fd_t(arg1);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_queue_fd_t, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
     
     XSRETURN(argvi);
   fail:
@@ -2088,25 +2130,25 @@ XS(_wrap_Device_in_file_get) {
 }
 
 
-XS(_wrap_Device_device_name_get) {
+XS(_wrap_delete_queue_fd_t) {
   {
-    Device *arg1 = (Device *) 0 ;
-    char *result = 0 ;
+    queue_fd_t *arg1 = (queue_fd_t *) 0 ;
     void *argp1 = 0 ;
     int res1 = 0 ;
     int argvi = 0;
     dXSARGS;
     
     if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: Device_device_name_get(self);");
+      SWIG_croak("Usage: delete_queue_fd_t(self);");
     }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_queue_fd_t, SWIG_POINTER_DISOWN |  0 );
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_device_name_get" "', argument " "1"" of type '" "Device *""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_queue_fd_t" "', argument " "1"" of type '" "queue_fd_t *""'"); 
     }
-    arg1 = (Device *)(argp1);
-    result = (char *) ((arg1)->device_name);
-    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    arg1 = (queue_fd_t *)(argp1);
+    delete_queue_fd_t(arg1);
+    
+    
     
     XSRETURN(argvi);
   fail:
@@ -2116,28 +2158,54 @@ XS(_wrap_Device_device_name_get) {
 }
 
 
-XS(_wrap_Device_access_mode_get) {
+XS(_wrap_new_Device) {
+  {
+    char *arg1 = (char *) 0 ;
+    Device *result = 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: new_Device(device_name);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Device" "', argument " "1"" of type '" "char *""'");
+    }
+    arg1 = (char *)(buf1);
+    result = (Device *)new_Device(arg1);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Device, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_delete_Device) {
   {
     Device *arg1 = (Device *) 0 ;
-    DeviceAccessMode result;
     void *argp1 = 0 ;
     int res1 = 0 ;
     int argvi = 0;
     dXSARGS;
     
     if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: Device_access_mode_get(self);");
+      SWIG_croak("Usage: delete_Device(self);");
     }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, SWIG_POINTER_DISOWN |  0 );
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_access_mode_get" "', argument " "1"" of type '" "Device *""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Device" "', argument " "1"" of type '" "Device *""'"); 
     }
     arg1 = (Device *)(argp1);
-    result = (DeviceAccessMode) ((arg1)->access_mode);
-    {
-      ST(argvi) = sv_2mortal(amglue_newSVi64(result));
-      argvi++;
-    }
+    delete_Device(arg1);
+    
+    
     
     XSRETURN(argvi);
   fail:
@@ -2147,38 +2215,54 @@ XS(_wrap_Device_access_mode_get) {
 }
 
 
-XS(_wrap_Device_is_eof_get) {
+XS(_wrap_Device_configure) {
   {
     Device *arg1 = (Device *) 0 ;
+    gboolean arg2 ;
     gboolean result;
     void *argp1 = 0 ;
     int res1 = 0 ;
     int argvi = 0;
     dXSARGS;
     
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: Device_is_eof_get(self);");
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Device_configure(self,use_global_config);");
     }
     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_is_eof_get" "', argument " "1"" of type '" "Device *""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_configure" "', argument " "1"" of type '" "Device *""'"); 
     }
     arg1 = (Device *)(argp1);
-    result = (gboolean) ((arg1)->is_eof);
+    {
+      if (sizeof(signed int) == 1) {
+        arg2 = amglue_SvI8(ST(1));
+      } else if (sizeof(signed int) == 2) {
+        arg2 = amglue_SvI16(ST(1));
+      } else if (sizeof(signed int) == 4) {
+        arg2 = amglue_SvI32(ST(1));
+      } else if (sizeof(signed int) == 8) {
+        arg2 = amglue_SvI64(ST(1));
+      } else {
+        g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
+      }
+    }
+    result = (gboolean)Device_configure(arg1,arg2);
     {
       ST(argvi) = sv_2mortal(amglue_newSVi64(result));
       argvi++;
     }
     
+    
     XSRETURN(argvi);
   fail:
     
+    
     SWIG_croak_null();
   }
 }
 
 
-XS(_wrap_Device_volume_label_get) {
+XS(_wrap_Device_error) {
   {
     Device *arg1 = (Device *) 0 ;
     char *result = 0 ;
@@ -2188,14 +2272,14 @@ XS(_wrap_Device_volume_label_get) {
     dXSARGS;
     
     if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: Device_volume_label_get(self);");
+      SWIG_croak("Usage: Device_error(self);");
     }
     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_volume_label_get" "', argument " "1"" of type '" "Device *""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_error" "', argument " "1"" of type '" "Device *""'"); 
     }
     arg1 = (Device *)(argp1);
-    result = (char *) ((arg1)->volume_label);
+    result = (char *)Device_error(arg1);
     ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
     
     XSRETURN(argvi);
@@ -2206,7 +2290,7 @@ XS(_wrap_Device_volume_label_get) {
 }
 
 
-XS(_wrap_Device_volume_time_get) {
+XS(_wrap_Device_status_error) {
   {
     Device *arg1 = (Device *) 0 ;
     char *result = 0 ;
@@ -2216,14 +2300,14 @@ XS(_wrap_Device_volume_time_get) {
     dXSARGS;
     
     if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: Device_volume_time_get(self);");
+      SWIG_croak("Usage: Device_status_error(self);");
     }
     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_volume_time_get" "', argument " "1"" of type '" "Device *""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_status_error" "', argument " "1"" of type '" "Device *""'"); 
     }
     arg1 = (Device *)(argp1);
-    result = (char *) ((arg1)->volume_time);
+    result = (char *)Device_status_error(arg1);
     ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
     
     XSRETURN(argvi);
@@ -2234,54 +2318,25 @@ XS(_wrap_Device_volume_time_get) {
 }
 
 
-XS(_wrap_new_Device) {
+XS(_wrap_Device_error_or_status) {
   {
-    char *arg1 = (char *) 0 ;
-    Device *result = 0 ;
-    int res1 ;
-    char *buf1 = 0 ;
-    int alloc1 = 0 ;
+    Device *arg1 = (Device *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
     int argvi = 0;
     dXSARGS;
     
     if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: new_Device(device_name);");
+      SWIG_croak("Usage: Device_error_or_status(self);");
     }
-    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Device" "', argument " "1"" of type '" "char *""'");
-    }
-    arg1 = (char *)(buf1);
-    result = (Device *)new_Device(arg1);
-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Device, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
-    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
-    XSRETURN(argvi);
-  fail:
-    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
-    SWIG_croak_null();
-  }
-}
-
-
-XS(_wrap_delete_Device) {
-  {
-    Device *arg1 = (Device *) 0 ;
-    void *argp1 = 0 ;
-    int res1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: delete_Device(self);");
-    }
-    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, SWIG_POINTER_DISOWN |  0 );
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Device" "', argument " "1"" of type '" "Device *""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_error_or_status" "', argument " "1"" of type '" "Device *""'"); 
     }
     arg1 = (Device *)(argp1);
-    delete_Device(arg1);
-    
-    
+    result = (char *)Device_error_or_status(arg1);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
     
     XSRETURN(argvi);
   fail:
@@ -2294,7 +2349,7 @@ XS(_wrap_delete_Device) {
 XS(_wrap_Device_read_label) {
   {
     Device *arg1 = (Device *) 0 ;
-    ReadLabelStatusFlags result;
+    DeviceStatusFlags result;
     void *argp1 = 0 ;
     int res1 = 0 ;
     int argvi = 0;
@@ -2308,7 +2363,7 @@ XS(_wrap_Device_read_label) {
       SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_read_label" "', argument " "1"" of type '" "Device *""'"); 
     }
     arg1 = (Device *)(argp1);
-    result = (ReadLabelStatusFlags)Device_read_label(arg1);
+    result = (DeviceStatusFlags)Device_read_label(arg1);
     {
       ST(argvi) = sv_2mortal(amglue_newSVi64(result));
       argvi++;
@@ -2444,10 +2499,10 @@ XS(_wrap_Device_start_file) {
     arg1 = (Device *)(argp1);
     res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_dumpfile_t, 0 |  0 );
     if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Device_start_file" "', argument " "2"" of type '" "dumpfile_t const *""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Device_start_file" "', argument " "2"" of type '" "dumpfile_t *""'"); 
     }
     arg2 = (dumpfile_t *)(argp2);
-    result = (gboolean)Device_start_file(arg1,(dumpfile_t const *)arg2);
+    result = (gboolean)Device_start_file(arg1,arg2);
     {
       ST(argvi) = sv_2mortal(amglue_newSVi64(result));
       argvi++;
@@ -2463,88 +2518,120 @@ XS(_wrap_Device_start_file) {
 }
 
 
-XS(_wrap_Device_write_min_size) {
+XS(_wrap_Device_write_block) {
   {
     Device *arg1 = (Device *) 0 ;
-    guint result;
+    guint arg2 ;
+    gpointer arg3 = (gpointer) 0 ;
+    gboolean result;
     void *argp1 = 0 ;
     int res1 = 0 ;
+    int res3 ;
     int argvi = 0;
     dXSARGS;
     
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: Device_write_min_size(self);");
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Device_write_block(self,size,data);");
     }
     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_write_min_size" "', argument " "1"" of type '" "Device *""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_write_block" "', argument " "1"" of type '" "Device *""'"); 
     }
     arg1 = (Device *)(argp1);
-    result = Device_write_min_size(arg1);
     {
-      ST(argvi) = sv_2mortal(amglue_newSVu64(result));
+      if (sizeof(guint) == 1) {
+        arg2 = amglue_SvU8(ST(1));
+      } else if (sizeof(guint) == 2) {
+        arg2 = amglue_SvU16(ST(1));
+      } else if (sizeof(guint) == 4) {
+        arg2 = amglue_SvU32(ST(1));
+      } else if (sizeof(guint) == 8) {
+        arg2 = amglue_SvU64(ST(1));
+      } else {
+        croak("Unexpected guint >64 bits?"); /* should be optimized out unless sizeof(guint) > 8 */
+      }
+    }
+    res3 = SWIG_ConvertPtr(ST(2),SWIG_as_voidptrptr(&arg3), 0, 0);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Device_write_block" "', argument " "3"" of type '" "gpointer""'"); 
+    }
+    result = (gboolean)Device_write_block(arg1,arg2,arg3);
+    {
+      ST(argvi) = sv_2mortal(amglue_newSVi64(result));
       argvi++;
     }
     
+    
     XSRETURN(argvi);
   fail:
     
+    
     SWIG_croak_null();
   }
 }
 
 
-XS(_wrap_Device_write_max_size) {
+XS(_wrap_Device_write_from_fd) {
   {
     Device *arg1 = (Device *) 0 ;
-    guint result;
+    queue_fd_t *arg2 = (queue_fd_t *) 0 ;
+    gboolean result;
     void *argp1 = 0 ;
     int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
     int argvi = 0;
     dXSARGS;
     
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: Device_write_max_size(self);");
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Device_write_from_fd(self,queue_fd);");
     }
     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_write_max_size" "', argument " "1"" of type '" "Device *""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_write_from_fd" "', argument " "1"" of type '" "Device *""'"); 
     }
     arg1 = (Device *)(argp1);
-    result = Device_write_max_size(arg1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_queue_fd_t, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Device_write_from_fd" "', argument " "2"" of type '" "queue_fd_t *""'"); 
+    }
+    arg2 = (queue_fd_t *)(argp2);
+    result = (gboolean)Device_write_from_fd(arg1,arg2);
     {
-      ST(argvi) = sv_2mortal(amglue_newSVu64(result));
+      ST(argvi) = sv_2mortal(amglue_newSVi64(result));
       argvi++;
     }
     
+    
     XSRETURN(argvi);
   fail:
     
+    
     SWIG_croak_null();
   }
 }
 
 
-XS(_wrap_Device_read_max_size) {
+XS(_wrap_Device_finish_file) {
   {
     Device *arg1 = (Device *) 0 ;
-    guint result;
+    gboolean result;
     void *argp1 = 0 ;
     int res1 = 0 ;
     int argvi = 0;
     dXSARGS;
     
     if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: Device_read_max_size(self);");
+      SWIG_croak("Usage: Device_finish_file(self);");
     }
     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_read_max_size" "', argument " "1"" of type '" "Device *""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_finish_file" "', argument " "1"" of type '" "Device *""'"); 
     }
     arg1 = (Device *)(argp1);
-    result = Device_read_max_size(arg1);
+    result = (gboolean)Device_finish_file(arg1);
     {
-      ST(argvi) = sv_2mortal(amglue_newSVu64(result));
+      ST(argvi) = sv_2mortal(amglue_newSVi64(result));
       argvi++;
     }
     
@@ -2556,25 +2643,22 @@ XS(_wrap_Device_read_max_size) {
 }
 
 
-XS(_wrap_Device_write_block) {
+XS(_wrap_Device_seek_file) {
   {
     Device *arg1 = (Device *) 0 ;
     guint arg2 ;
-    gpointer arg3 = (gpointer) 0 ;
-    gboolean arg4 ;
-    gboolean result;
+    dumpfile_t *result = 0 ;
     void *argp1 = 0 ;
     int res1 = 0 ;
-    int res3 ;
     int argvi = 0;
     dXSARGS;
     
-    if ((items < 4) || (items > 4)) {
-      SWIG_croak("Usage: Device_write_block(self,size,data,short_block);");
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Device_seek_file(self,file);");
     }
     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_write_block" "', argument " "1"" of type '" "Device *""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_seek_file" "', argument " "1"" of type '" "Device *""'"); 
     }
     arg1 = (Device *)(argp1);
     {
@@ -2590,10 +2674,354 @@ XS(_wrap_Device_write_block) {
         croak("Unexpected guint >64 bits?"); /* should be optimized out unless sizeof(guint) > 8 */
       }
     }
-    res3 = SWIG_ConvertPtr(ST(2),SWIG_as_voidptrptr(&arg3), 0, 0);
+    result = (dumpfile_t *)Device_seek_file(arg1,arg2);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_dumpfile_t, 0 | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Device_seek_block) {
+  {
+    Device *arg1 = (Device *) 0 ;
+    guint64 arg2 ;
+    gboolean result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Device_seek_block(self,block);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_seek_block" "', argument " "1"" of type '" "Device *""'"); 
+    }
+    arg1 = (Device *)(argp1);
+    {
+      arg2 = amglue_SvU64(ST(1));
+    }
+    result = (gboolean)Device_seek_block(arg1,arg2);
+    {
+      ST(argvi) = sv_2mortal(amglue_newSVi64(result));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Device_read_block) {
+  {
+    Device *arg1 = (Device *) 0 ;
+    gpointer arg2 = (gpointer) 0 ;
+    int *arg3 = (int *) 0 ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    void *argp3 = 0 ;
+    int res3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Device_read_block(self,buffer,size);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_read_block" "', argument " "1"" of type '" "Device *""'"); 
+    }
+    arg1 = (Device *)(argp1);
+    res2 = SWIG_ConvertPtr(ST(1),SWIG_as_voidptrptr(&arg2), 0, 0);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Device_read_block" "', argument " "2"" of type '" "gpointer""'"); 
+    }
+    res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_int, 0 |  0 );
     if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Device_write_block" "', argument " "3"" of type '" "gpointer""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Device_read_block" "', argument " "3"" of type '" "int *""'"); 
+    }
+    arg3 = (int *)(argp3);
+    result = (int)Device_read_block(arg1,arg2,arg3);
+    {
+      ST(argvi) = sv_2mortal(amglue_newSVi64(result));
+      argvi++;
+    }
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Device_read_to_fd) {
+  {
+    Device *arg1 = (Device *) 0 ;
+    queue_fd_t *arg2 = (queue_fd_t *) 0 ;
+    gboolean result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Device_read_to_fd(self,queue_fd);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_read_to_fd" "', argument " "1"" of type '" "Device *""'"); 
+    }
+    arg1 = (Device *)(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_queue_fd_t, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Device_read_to_fd" "', argument " "2"" of type '" "queue_fd_t *""'"); 
+    }
+    arg2 = (queue_fd_t *)(argp2);
+    result = (gboolean)Device_read_to_fd(arg1,arg2);
+    {
+      ST(argvi) = sv_2mortal(amglue_newSVi64(result));
+      argvi++;
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Device_property_list) {
+  {
+    Device *arg1 = (Device *) 0 ;
+    GSList *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Device_property_list(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_property_list" "', argument " "1"" of type '" "Device *""'"); 
+    }
+    arg1 = (Device *)(argp1);
+    result = (GSList *)Device_property_list(arg1);
+    {
+      GSList *iter;
+      
+      /* Count the DeviceProperties */
+      EXTEND(SP, g_slist_length(result)); /* make room for return values */
+      
+      /* Note that we set ST(argvi) several times. the nature of
+            * SWIG's wrapping is such that incrementing argvi points
+            * ST(argvi) to the next location in perl's argument stack.
+                   */
+      
+      for (iter = result; iter; iter = g_slist_next(iter)) {
+        DeviceProperty *prop = iter->data;
+        HV *hash = newHV();
+        SV *rv = newRV_noinc((SV *)hash);
+        
+        hv_store(hash, "name", 4,
+          newSVpv(prop->base->name, 0), 0);
+        hv_store(hash, "description", 11,
+          newSVpv(prop->base->description, 0), 0);
+        hv_store(hash, "access", 6,
+          newSViv(prop->access), 0);
+        ST(argvi) = sv_2mortal(rv);
+        argvi++;
+      }
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Device_property_get) {
+  {
+    Device *arg1 = (Device *) 0 ;
+    DevicePropertyBase *arg2 = (DevicePropertyBase *) 0 ;
+    GValue *arg3 = (GValue *) 0 ;
+    PropertySurety *arg4 = (PropertySurety *) 0 ;
+    PropertySource *arg5 = (PropertySource *) 0 ;
+    gboolean *arg6 = (gboolean *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    GValue val3 ;
+    PropertySurety surety3 ;
+    PropertySource source3 ;
+    gboolean found3 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    {
+      memset(&val3, 0, sizeof(val3));
+      arg3 = &val3;
+      if (GIMME_V == G_ARRAY) {
+        arg4 = &surety3;
+        arg5 = &source3;
+      }
+      arg6 = &found3;
+    }
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Device_property_get(self,pbase,surety,source,val_found);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_property_get" "', argument " "1"" of type '" "Device *""'"); 
+    }
+    arg1 = (Device *)(argp1);
+    {
+      char *pname = NULL;
+      
+      if (SvPOK(ST(1)))
+      pname = SvPV_nolen(ST(1));
+      
+      if (pname) arg2 = (DevicePropertyBase *)device_property_get_by_name(pname);
+      if (!pname || !arg2) {
+        SWIG_exception_fail(SWIG_ValueError, "Invalid property name");
+      }
+    }
+    Device_property_get(arg1,arg2,arg3,arg4,arg5,arg6);
+    
+    {
+      /* if the result is valid */
+      if (*arg6) {
+        /* move data from arg3 to ST(argvi), somehow */
+        ST(argvi) = set_sv_from_gvalue(arg3);
+        argvi++;
+        
+        /* free any memory for the GValue */
+        g_value_unset(arg3);
+        
+        if (GIMME_V == G_ARRAY) {
+          ST(argvi) = newSViv(*arg4);
+          argvi++;
+          ST(argvi) = newSViv(*arg5);
+          argvi++;
+        }
+      }
+      /* otherwise, return nothing */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Device_property_set) {
+  {
+    Device *arg1 = (Device *) 0 ;
+    DevicePropertyBase *arg2 = (DevicePropertyBase *) 0 ;
+    SV *arg3 = (SV *) 0 ;
+    gboolean result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Device_property_set(self,pbase,sv);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_property_set" "', argument " "1"" of type '" "Device *""'"); 
+    }
+    arg1 = (Device *)(argp1);
+    {
+      char *pname = NULL;
+      
+      if (SvPOK(ST(1)))
+      pname = SvPV_nolen(ST(1));
+      
+      if (pname) arg2 = (DevicePropertyBase *)device_property_get_by_name(pname);
+      if (!pname || !arg2) {
+        SWIG_exception_fail(SWIG_ValueError, "Invalid property name");
+      }
+    }
+    arg3 = ST(2);
+    result = (gboolean)Device_property_set(arg1,arg2,arg3);
+    {
+      ST(argvi) = sv_2mortal(amglue_newSVi64(result));
+      argvi++;
+    }
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Device_property_set_ex) {
+  {
+    Device *arg1 = (Device *) 0 ;
+    DevicePropertyBase *arg2 = (DevicePropertyBase *) 0 ;
+    SV *arg3 = (SV *) 0 ;
+    PropertySurety arg4 ;
+    PropertySource arg5 ;
+    gboolean result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 5) || (items > 5)) {
+      SWIG_croak("Usage: Device_property_set_ex(self,pbase,sv,surety,source);");
     }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_property_set_ex" "', argument " "1"" of type '" "Device *""'"); 
+    }
+    arg1 = (Device *)(argp1);
+    {
+      char *pname = NULL;
+      
+      if (SvPOK(ST(1)))
+      pname = SvPV_nolen(ST(1));
+      
+      if (pname) arg2 = (DevicePropertyBase *)device_property_get_by_name(pname);
+      if (!pname || !arg2) {
+        SWIG_exception_fail(SWIG_ValueError, "Invalid property name");
+      }
+    }
+    arg3 = ST(2);
     {
       if (sizeof(signed int) == 1) {
         arg4 = amglue_SvI8(ST(3));
@@ -2607,7 +3035,20 @@ XS(_wrap_Device_write_block) {
         g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
       }
     }
-    result = (gboolean)Device_write_block(arg1,arg2,arg3,arg4);
+    {
+      if (sizeof(signed int) == 1) {
+        arg5 = amglue_SvI8(ST(4));
+      } else if (sizeof(signed int) == 2) {
+        arg5 = amglue_SvI16(ST(4));
+      } else if (sizeof(signed int) == 4) {
+        arg5 = amglue_SvI32(ST(4));
+      } else if (sizeof(signed int) == 8) {
+        arg5 = amglue_SvI64(ST(4));
+      } else {
+        g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
+      }
+    }
+    result = (gboolean)Device_property_set_ex(arg1,arg2,arg3,arg4,arg5);
     {
       ST(argvi) = sv_2mortal(amglue_newSVi64(result));
       argvi++;
@@ -2615,20 +3056,24 @@ XS(_wrap_Device_write_block) {
     
     
     
+    
+    
     XSRETURN(argvi);
   fail:
     
     
     
+    
+    
     SWIG_croak_null();
   }
 }
 
 
-XS(_wrap_Device_write_from_fd) {
+XS(_wrap_Device_recycle_file) {
   {
     Device *arg1 = (Device *) 0 ;
-    int arg2 ;
+    guint arg2 ;
     gboolean result;
     void *argp1 = 0 ;
     int res1 = 0 ;
@@ -2636,43 +3081,103 @@ XS(_wrap_Device_write_from_fd) {
     dXSARGS;
     
     if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: Device_write_from_fd(self,fd);");
+      SWIG_croak("Usage: Device_recycle_file(self,filenum);");
     }
     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_write_from_fd" "', argument " "1"" of type '" "Device *""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_recycle_file" "', argument " "1"" of type '" "Device *""'"); 
     }
     arg1 = (Device *)(argp1);
     {
-      if (sizeof(signed int) == 1) {
-        arg2 = amglue_SvI8(ST(1));
-      } else if (sizeof(signed int) == 2) {
-        arg2 = amglue_SvI16(ST(1));
-      } else if (sizeof(signed int) == 4) {
-        arg2 = amglue_SvI32(ST(1));
-      } else if (sizeof(signed int) == 8) {
-        arg2 = amglue_SvI64(ST(1));
+      if (sizeof(guint) == 1) {
+        arg2 = amglue_SvU8(ST(1));
+      } else if (sizeof(guint) == 2) {
+        arg2 = amglue_SvU16(ST(1));
+      } else if (sizeof(guint) == 4) {
+        arg2 = amglue_SvU32(ST(1));
+      } else if (sizeof(guint) == 8) {
+        arg2 = amglue_SvU64(ST(1));
       } else {
-        g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
+        croak("Unexpected guint >64 bits?"); /* should be optimized out unless sizeof(guint) > 8 */
       }
     }
-    result = (gboolean)Device_write_from_fd(arg1,arg2);
+    result = (gboolean)Device_recycle_file(arg1,arg2);
+    {
+      ST(argvi) = sv_2mortal(amglue_newSVi64(result));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Device_file) {
+  {
+    Device *arg1 = (Device *) 0 ;
+    int result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Device_file(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_file" "', argument " "1"" of type '" "Device *""'"); 
+    }
+    arg1 = (Device *)(argp1);
+    result = (int)Device_file(arg1);
+    {
+      ST(argvi) = sv_2mortal(amglue_newSVi64(result));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Device_block) {
+  {
+    Device *arg1 = (Device *) 0 ;
+    guint64 result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Device_block(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_block" "', argument " "1"" of type '" "Device *""'"); 
+    }
+    arg1 = (Device *)(argp1);
+    result = Device_block(arg1);
     {
-      ST(argvi) = sv_2mortal(amglue_newSVi64(result));
+      ST(argvi) = sv_2mortal(amglue_newSVu64(result));
       argvi++;
     }
     
-    
     XSRETURN(argvi);
   fail:
     
-    
     SWIG_croak_null();
   }
 }
 
 
-XS(_wrap_Device_finish_file) {
+XS(_wrap_Device_in_file) {
   {
     Device *arg1 = (Device *) 0 ;
     gboolean result;
@@ -2682,14 +3187,14 @@ XS(_wrap_Device_finish_file) {
     dXSARGS;
     
     if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: Device_finish_file(self);");
+      SWIG_croak("Usage: Device_in_file(self);");
     }
     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_finish_file" "', argument " "1"" of type '" "Device *""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_in_file" "', argument " "1"" of type '" "Device *""'"); 
     }
     arg1 = (Device *)(argp1);
-    result = (gboolean)Device_finish_file(arg1);
+    result = (gboolean)Device_in_file(arg1);
     {
       ST(argvi) = sv_2mortal(amglue_newSVi64(result));
       argvi++;
@@ -2703,39 +3208,25 @@ XS(_wrap_Device_finish_file) {
 }
 
 
-XS(_wrap_Device_seek_file) {
+XS(_wrap_Device_device_name) {
   {
     Device *arg1 = (Device *) 0 ;
-    guint arg2 ;
-    dumpfile_t *result = 0 ;
+    char *result = 0 ;
     void *argp1 = 0 ;
     int res1 = 0 ;
     int argvi = 0;
     dXSARGS;
     
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: Device_seek_file(self,file);");
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Device_device_name(self);");
     }
     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_seek_file" "', argument " "1"" of type '" "Device *""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_device_name" "', argument " "1"" of type '" "Device *""'"); 
     }
     arg1 = (Device *)(argp1);
-    {
-      if (sizeof(guint) == 1) {
-        arg2 = amglue_SvU8(ST(1));
-      } else if (sizeof(guint) == 2) {
-        arg2 = amglue_SvU16(ST(1));
-      } else if (sizeof(guint) == 4) {
-        arg2 = amglue_SvU32(ST(1));
-      } else if (sizeof(guint) == 8) {
-        arg2 = amglue_SvU64(ST(1));
-      } else {
-        croak("Unexpected guint >64 bits?"); /* should be optimized out unless sizeof(guint) > 8 */
-      }
-    }
-    result = (dumpfile_t *)Device_seek_file(arg1,arg2);
-    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_dumpfile_t, 0 | SWIG_SHADOW); argvi++ ;
+    result = (char *)Device_device_name(arg1);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
     
     XSRETURN(argvi);
   fail:
@@ -2745,28 +3236,24 @@ XS(_wrap_Device_seek_file) {
 }
 
 
-XS(_wrap_Device_seek_block) {
+XS(_wrap_Device_access_mode) {
   {
     Device *arg1 = (Device *) 0 ;
-    guint64 arg2 ;
-    gboolean result;
+    DeviceAccessMode result;
     void *argp1 = 0 ;
     int res1 = 0 ;
     int argvi = 0;
     dXSARGS;
     
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: Device_seek_block(self,block);");
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Device_access_mode(self);");
     }
     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_seek_block" "', argument " "1"" of type '" "Device *""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_access_mode" "', argument " "1"" of type '" "Device *""'"); 
     }
     arg1 = (Device *)(argp1);
-    {
-      arg2 = amglue_SvU64(ST(1));
-    }
-    result = (gboolean)Device_seek_block(arg1,arg2);
+    result = (DeviceAccessMode)Device_access_mode(arg1);
     {
       ST(argvi) = sv_2mortal(amglue_newSVi64(result));
       argvi++;
@@ -2780,139 +3267,84 @@ XS(_wrap_Device_seek_block) {
 }
 
 
-XS(_wrap_Device_read_block) {
+XS(_wrap_Device_is_eof) {
   {
     Device *arg1 = (Device *) 0 ;
-    gpointer arg2 = (gpointer) 0 ;
-    int *arg3 = (int *) 0 ;
-    int result;
+    gboolean result;
     void *argp1 = 0 ;
     int res1 = 0 ;
-    int res2 ;
-    void *argp3 = 0 ;
-    int res3 = 0 ;
     int argvi = 0;
     dXSARGS;
     
-    if ((items < 3) || (items > 3)) {
-      SWIG_croak("Usage: Device_read_block(self,buffer,size);");
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Device_is_eof(self);");
     }
     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_read_block" "', argument " "1"" of type '" "Device *""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_is_eof" "', argument " "1"" of type '" "Device *""'"); 
     }
     arg1 = (Device *)(argp1);
-    res2 = SWIG_ConvertPtr(ST(1),SWIG_as_voidptrptr(&arg2), 0, 0);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Device_read_block" "', argument " "2"" of type '" "gpointer""'"); 
-    }
-    res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_int, 0 |  0 );
-    if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Device_read_block" "', argument " "3"" of type '" "int *""'"); 
-    }
-    arg3 = (int *)(argp3);
-    result = (int)Device_read_block(arg1,arg2,arg3);
+    result = (gboolean)Device_is_eof(arg1);
     {
       ST(argvi) = sv_2mortal(amglue_newSVi64(result));
       argvi++;
     }
     
-    
-    
     XSRETURN(argvi);
   fail:
     
-    
-    
     SWIG_croak_null();
   }
 }
 
 
-XS(_wrap_Device_read_to_fd) {
+XS(_wrap_Device_volume_label) {
   {
     Device *arg1 = (Device *) 0 ;
-    int arg2 ;
-    gboolean result;
+    char *result = 0 ;
     void *argp1 = 0 ;
     int res1 = 0 ;
     int argvi = 0;
     dXSARGS;
     
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: Device_read_to_fd(self,fd);");
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Device_volume_label(self);");
     }
     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_read_to_fd" "', argument " "1"" of type '" "Device *""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_volume_label" "', argument " "1"" of type '" "Device *""'"); 
     }
     arg1 = (Device *)(argp1);
-    {
-      if (sizeof(signed int) == 1) {
-        arg2 = amglue_SvI8(ST(1));
-      } else if (sizeof(signed int) == 2) {
-        arg2 = amglue_SvI16(ST(1));
-      } else if (sizeof(signed int) == 4) {
-        arg2 = amglue_SvI32(ST(1));
-      } else if (sizeof(signed int) == 8) {
-        arg2 = amglue_SvI64(ST(1));
-      } else {
-        g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
-      }
-    }
-    result = (gboolean)Device_read_to_fd(arg1,arg2);
-    {
-      ST(argvi) = sv_2mortal(amglue_newSVi64(result));
-      argvi++;
-    }
-    
+    result = (char *)Device_volume_label(arg1);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
     
     XSRETURN(argvi);
   fail:
     
-    
     SWIG_croak_null();
   }
 }
 
 
-XS(_wrap_Device_property_list) {
+XS(_wrap_Device_volume_time) {
   {
     Device *arg1 = (Device *) 0 ;
-    DeviceProperty *result = 0 ;
+    char *result = 0 ;
     void *argp1 = 0 ;
     int res1 = 0 ;
     int argvi = 0;
     dXSARGS;
     
     if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: Device_property_list(self);");
+      SWIG_croak("Usage: Device_volume_time(self);");
     }
     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_property_list" "', argument " "1"" of type '" "Device *""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_volume_time" "', argument " "1"" of type '" "Device *""'"); 
     }
     arg1 = (Device *)(argp1);
-    result = (DeviceProperty *)Device_property_list(arg1);
-    {
-      int i = 0;
-      int len = 0;
-      
-      /* Count the DeviceProperties */
-      while (result[len].base) len++;
-      EXTEND(SP, len); /* make room for return values */
-      
-      /* Note that we set ST(argvi) several times. the nature of
-            * SWIG's wrapping is such that incrementing argvi points
-            * ST(argvi) to the next location in perl's argument stack.
-                   */
-      
-      for (i = 0; i < len ; i++) {
-        ST(argvi) = sv_newmortal(); 
-        sv_setpv(ST(argvi), result[i].base->name); 
-        argvi++;
-      }; 
-    }
+    result = (char *)Device_volume_time(arg1);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
     
     XSRETURN(argvi);
   fail:
@@ -2922,154 +3354,88 @@ XS(_wrap_Device_property_list) {
 }
 
 
-XS(_wrap_Device_property_get) {
+XS(_wrap_Device_status) {
   {
     Device *arg1 = (Device *) 0 ;
-    DevicePropertyBase *arg2 = (DevicePropertyBase *) 0 ;
-    GValue *arg3 = (GValue *) 0 ;
-    gboolean *arg4 = (gboolean *) 0 ;
+    DeviceStatusFlags result;
     void *argp1 = 0 ;
     int res1 = 0 ;
-    GValue val3 ;
-    gboolean found3 ;
     int argvi = 0;
     dXSARGS;
     
-    {
-      memset(&val3, 0, sizeof(val3));
-      arg3 = &val3;
-      arg4 = &found3;
-    }
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: Device_property_get(self,pbase,val_found);");
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Device_status(self);");
     }
     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_property_get" "', argument " "1"" of type '" "Device *""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_status" "', argument " "1"" of type '" "Device *""'"); 
     }
     arg1 = (Device *)(argp1);
+    result = (DeviceStatusFlags)Device_status(arg1);
     {
-      char *pname = NULL;
-      
-      if (SvPOK(ST(1)))
-      pname = SvPV_nolen(ST(1));
-      
-      if (pname) arg2 = (DevicePropertyBase *)device_property_get_by_name(pname);
-      if (!pname || !arg2) {
-        SWIG_exception_fail(SWIG_ValueError, "Invalid property name");
-      }
-    }
-    Device_property_get(arg1,arg2,arg3,arg4);
-    
-    {
-      /* if the result is valid */
-      if (*arg4) {
-        /* move data from arg3 to ST(argvi), somehow */
-        ST(argvi) = set_sv_from_gvalue(arg3);
-        
-        /* free any memory for the GValue */
-        g_value_unset(arg3);
-      } else {
-        /* silently return 'undef', the sentinel for "undefined" */
-        ST(argvi) = sv_newmortal();
-        sv_setsv(ST(argvi), &PL_sv_undef);
-      }
+      ST(argvi) = sv_2mortal(amglue_newSVi64(result));
       argvi++;
     }
     
-    
     XSRETURN(argvi);
   fail:
     
-    
     SWIG_croak_null();
   }
 }
 
 
-XS(_wrap_Device_property_set) {
+XS(_wrap_Device_min_block_size) {
   {
     Device *arg1 = (Device *) 0 ;
-    DevicePropertyBase *arg2 = (DevicePropertyBase *) 0 ;
-    SV *arg3 = (SV *) 0 ;
-    gboolean result;
+    gsize result;
     void *argp1 = 0 ;
     int res1 = 0 ;
     int argvi = 0;
     dXSARGS;
     
-    if ((items < 3) || (items > 3)) {
-      SWIG_croak("Usage: Device_property_set(self,pbase,sv);");
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Device_min_block_size(self);");
     }
     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_property_set" "', argument " "1"" of type '" "Device *""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_min_block_size" "', argument " "1"" of type '" "Device *""'"); 
     }
     arg1 = (Device *)(argp1);
+    result = Device_min_block_size(arg1);
     {
-      char *pname = NULL;
-      
-      if (SvPOK(ST(1)))
-      pname = SvPV_nolen(ST(1));
-      
-      if (pname) arg2 = (DevicePropertyBase *)device_property_get_by_name(pname);
-      if (!pname || !arg2) {
-        SWIG_exception_fail(SWIG_ValueError, "Invalid property name");
-      }
-    }
-    arg3 = ST(2);
-    result = (gboolean)Device_property_set(arg1,arg2,arg3);
-    {
-      ST(argvi) = sv_2mortal(amglue_newSVi64(result));
+      ST(argvi) = sv_2mortal(amglue_newSVu64(result));
       argvi++;
     }
     
-    
-    
     XSRETURN(argvi);
   fail:
     
-    
-    
     SWIG_croak_null();
   }
 }
 
 
-XS(_wrap_Device_recycle_file) {
+XS(_wrap_Device_max_block_size) {
   {
     Device *arg1 = (Device *) 0 ;
-    guint arg2 ;
-    gboolean result;
+    gsize result;
     void *argp1 = 0 ;
     int res1 = 0 ;
     int argvi = 0;
     dXSARGS;
     
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: Device_recycle_file(self,filenum);");
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Device_max_block_size(self);");
     }
     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_recycle_file" "', argument " "1"" of type '" "Device *""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_max_block_size" "', argument " "1"" of type '" "Device *""'"); 
     }
     arg1 = (Device *)(argp1);
+    result = Device_max_block_size(arg1);
     {
-      if (sizeof(guint) == 1) {
-        arg2 = amglue_SvU8(ST(1));
-      } else if (sizeof(guint) == 2) {
-        arg2 = amglue_SvU16(ST(1));
-      } else if (sizeof(guint) == 4) {
-        arg2 = amglue_SvU32(ST(1));
-      } else if (sizeof(guint) == 8) {
-        arg2 = amglue_SvU64(ST(1));
-      } else {
-        croak("Unexpected guint >64 bits?"); /* should be optimized out unless sizeof(guint) > 8 */
-      }
-    }
-    result = (gboolean)Device_recycle_file(arg1,arg2);
-    {
-      ST(argvi) = sv_2mortal(amglue_newSVi64(result));
+      ST(argvi) = sv_2mortal(amglue_newSVu64(result));
       argvi++;
     }
     
@@ -3081,24 +3447,28 @@ XS(_wrap_Device_recycle_file) {
 }
 
 
-XS(_wrap_Device_set_startup_properties_from_config) {
+XS(_wrap_Device_block_size) {
   {
     Device *arg1 = (Device *) 0 ;
+    gsize result;
     void *argp1 = 0 ;
     int res1 = 0 ;
     int argvi = 0;
     dXSARGS;
     
     if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: Device_set_startup_properties_from_config(self);");
+      SWIG_croak("Usage: Device_block_size(self);");
     }
     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_set_startup_properties_from_config" "', argument " "1"" of type '" "Device *""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_block_size" "', argument " "1"" of type '" "Device *""'"); 
     }
     arg1 = (Device *)(argp1);
-    Device_set_startup_properties_from_config(arg1);
-    
+    result = Device_block_size(arg1);
+    {
+      ST(argvi) = sv_2mortal(amglue_newSVu64(result));
+      argvi++;
+    }
     
     XSRETURN(argvi);
   fail:
@@ -3108,34 +3478,25 @@ XS(_wrap_Device_set_startup_properties_from_config) {
 }
 
 
-XS(_wrap_IS_WRITABLE_ACCESS_MODE) {
+XS(_wrap_Device_volume_header) {
   {
-    DeviceAccessMode arg1 ;
-    gboolean result;
+    Device *arg1 = (Device *) 0 ;
+    dumpfile_t *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
     int argvi = 0;
     dXSARGS;
     
     if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: IS_WRITABLE_ACCESS_MODE(mode);");
-    }
-    {
-      if (sizeof(signed int) == 1) {
-        arg1 = amglue_SvI8(ST(0));
-      } else if (sizeof(signed int) == 2) {
-        arg1 = amglue_SvI16(ST(0));
-      } else if (sizeof(signed int) == 4) {
-        arg1 = amglue_SvI32(ST(0));
-      } else if (sizeof(signed int) == 8) {
-        arg1 = amglue_SvI64(ST(0));
-      } else {
-        g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
-      }
+      SWIG_croak("Usage: Device_volume_header(self);");
     }
-    result = (gboolean)IS_WRITABLE_ACCESS_MODE(arg1);
-    {
-      ST(argvi) = sv_2mortal(amglue_newSVi64(result));
-      argvi++;
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Device_volume_header" "', argument " "1"" of type '" "Device *""'"); 
     }
+    arg1 = (Device *)(argp1);
+    result = (dumpfile_t *)Device_volume_header(arg1);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_dumpfile_t, 0 | SWIG_SHADOW); argvi++ ;
     
     XSRETURN(argvi);
   fail:
@@ -3145,15 +3506,15 @@ XS(_wrap_IS_WRITABLE_ACCESS_MODE) {
 }
 
 
-XS(_wrap_feature_support_flags_is_valid) {
+XS(_wrap_IS_WRITABLE_ACCESS_MODE) {
   {
-    FeatureSupportFlags arg1 ;
+    DeviceAccessMode arg1 ;
     gboolean result;
     int argvi = 0;
     dXSARGS;
     
     if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: feature_support_flags_is_valid(FeatureSupportFlags);");
+      SWIG_croak("Usage: IS_WRITABLE_ACCESS_MODE(mode);");
     }
     {
       if (sizeof(signed int) == 1) {
@@ -3168,7 +3529,7 @@ XS(_wrap_feature_support_flags_is_valid) {
         g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
       }
     }
-    result = (gboolean)feature_support_flags_is_valid(arg1);
+    result = (gboolean)IS_WRITABLE_ACCESS_MODE(arg1);
     {
       ST(argvi) = sv_2mortal(amglue_newSVi64(result));
       argvi++;
@@ -3195,7 +3556,8 @@ static swig_type_info _swigt__p_dumpfile_t = {"_p_dumpfile_t", "dumpfile_t *", 0
 static swig_type_info _swigt__p_float = {"_p_float", "float *|gfloat *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_guint = {"_p_guint", "guint *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_guint64 = {"_p_guint64", "guint64 *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_int = {"_p_int", "int *|ConcurrencyParadigm *|filetype_t *|SizeAccuracy *|StreamingRequirement *|gboolean *|DeviceAccessMode *|MediaAccessMode *|FeatureSupportFlags *|ReadLabelStatusFlags *|PropertyPhaseFlags *|PropertyAccessFlags *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_int = {"_p_int", "int *|PropertySurety *|ConcurrencyParadigm *|filetype_t *|PropertySource *|SizeAccuracy *|StreamingRequirement *|gboolean *|DeviceAccessMode *|MediaAccessMode *|DeviceStatusFlags *|PropertyPhaseFlags *|PropertyAccessFlags *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_queue_fd_t = {"_p_queue_fd_t", "struct queue_fd_t *|queue_fd_t *", 0, 0, (void*)"Amanda::Device::queue_fd_t", 0};
 static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "guchar *|unsigned char *", 0, 0, (void*)0, 0};
 
 static swig_type_info *swig_type_initial[] = {
@@ -3210,6 +3572,7 @@ static swig_type_info *swig_type_initial[] = {
   &_swigt__p_guint,
   &_swigt__p_guint64,
   &_swigt__p_int,
+  &_swigt__p_queue_fd_t,
   &_swigt__p_unsigned_char,
 };
 
@@ -3224,6 +3587,7 @@ static swig_cast_info _swigc__p_float[] = {  {&_swigt__p_float, 0, 0, 0},{0, 0,
 static swig_cast_info _swigc__p_guint[] = {  {&_swigt__p_guint, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_guint64[] = {  {&_swigt__p_guint64, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_int[] = {  {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_queue_fd_t[] = {  {&_swigt__p_queue_fd_t, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_unsigned_char[] = {  {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
 
 static swig_cast_info *swig_cast_initial[] = {
@@ -3238,6 +3602,7 @@ static swig_cast_info *swig_cast_initial[] = {
   _swigc__p_guint,
   _swigc__p_guint64,
   _swigc__p_int,
+  _swigc__p_queue_fd_t,
   _swigc__p_unsigned_char,
 };
 
@@ -3254,23 +3619,20 @@ static swig_variable_info swig_variables[] = {
 {0,0,0,0}
 };
 static swig_command_info swig_commands[] = {
-{"Amanda::Devicec::Device_file_get", _wrap_Device_file_get},
-{"Amanda::Devicec::Device_block_get", _wrap_Device_block_get},
-{"Amanda::Devicec::Device_in_file_get", _wrap_Device_in_file_get},
-{"Amanda::Devicec::Device_device_name_get", _wrap_Device_device_name_get},
-{"Amanda::Devicec::Device_access_mode_get", _wrap_Device_access_mode_get},
-{"Amanda::Devicec::Device_is_eof_get", _wrap_Device_is_eof_get},
-{"Amanda::Devicec::Device_volume_label_get", _wrap_Device_volume_label_get},
-{"Amanda::Devicec::Device_volume_time_get", _wrap_Device_volume_time_get},
+{"Amanda::Devicec::queue_fd_t_fd_get", _wrap_queue_fd_t_fd_get},
+{"Amanda::Devicec::queue_fd_t_errmsg_get", _wrap_queue_fd_t_errmsg_get},
+{"Amanda::Devicec::new_queue_fd_t", _wrap_new_queue_fd_t},
+{"Amanda::Devicec::delete_queue_fd_t", _wrap_delete_queue_fd_t},
 {"Amanda::Devicec::new_Device", _wrap_new_Device},
 {"Amanda::Devicec::delete_Device", _wrap_delete_Device},
+{"Amanda::Devicec::Device_configure", _wrap_Device_configure},
+{"Amanda::Devicec::Device_error", _wrap_Device_error},
+{"Amanda::Devicec::Device_status_error", _wrap_Device_status_error},
+{"Amanda::Devicec::Device_error_or_status", _wrap_Device_error_or_status},
 {"Amanda::Devicec::Device_read_label", _wrap_Device_read_label},
 {"Amanda::Devicec::Device_start", _wrap_Device_start},
 {"Amanda::Devicec::Device_finish", _wrap_Device_finish},
 {"Amanda::Devicec::Device_start_file", _wrap_Device_start_file},
-{"Amanda::Devicec::Device_write_min_size", _wrap_Device_write_min_size},
-{"Amanda::Devicec::Device_write_max_size", _wrap_Device_write_max_size},
-{"Amanda::Devicec::Device_read_max_size", _wrap_Device_read_max_size},
 {"Amanda::Devicec::Device_write_block", _wrap_Device_write_block},
 {"Amanda::Devicec::Device_write_from_fd", _wrap_Device_write_from_fd},
 {"Amanda::Devicec::Device_finish_file", _wrap_Device_finish_file},
@@ -3281,10 +3643,22 @@ static swig_command_info swig_commands[] = {
 {"Amanda::Devicec::Device_property_list", _wrap_Device_property_list},
 {"Amanda::Devicec::Device_property_get", _wrap_Device_property_get},
 {"Amanda::Devicec::Device_property_set", _wrap_Device_property_set},
+{"Amanda::Devicec::Device_property_set_ex", _wrap_Device_property_set_ex},
 {"Amanda::Devicec::Device_recycle_file", _wrap_Device_recycle_file},
-{"Amanda::Devicec::Device_set_startup_properties_from_config", _wrap_Device_set_startup_properties_from_config},
+{"Amanda::Devicec::Device_file", _wrap_Device_file},
+{"Amanda::Devicec::Device_block", _wrap_Device_block},
+{"Amanda::Devicec::Device_in_file", _wrap_Device_in_file},
+{"Amanda::Devicec::Device_device_name", _wrap_Device_device_name},
+{"Amanda::Devicec::Device_access_mode", _wrap_Device_access_mode},
+{"Amanda::Devicec::Device_is_eof", _wrap_Device_is_eof},
+{"Amanda::Devicec::Device_volume_label", _wrap_Device_volume_label},
+{"Amanda::Devicec::Device_volume_time", _wrap_Device_volume_time},
+{"Amanda::Devicec::Device_status", _wrap_Device_status},
+{"Amanda::Devicec::Device_min_block_size", _wrap_Device_min_block_size},
+{"Amanda::Devicec::Device_max_block_size", _wrap_Device_max_block_size},
+{"Amanda::Devicec::Device_block_size", _wrap_Device_block_size},
+{"Amanda::Devicec::Device_volume_header", _wrap_Device_volume_header},
 {"Amanda::Devicec::IS_WRITABLE_ACCESS_MODE", _wrap_IS_WRITABLE_ACCESS_MODE},
-{"Amanda::Devicec::feature_support_flags_is_valid", _wrap_feature_support_flags_is_valid},
 {0,0}
 };
 /* -----------------------------------------------------------------------------
@@ -3344,7 +3718,7 @@ SWIGRUNTIME void
 SWIG_InitializeModule(void *clientdata) {
   size_t i;
   swig_module_info *module_head, *iter;
-  int found;
+  int found, init;
   
   clientdata = clientdata;
   
@@ -3354,6 +3728,9 @@ SWIG_InitializeModule(void *clientdata) {
     swig_module.type_initial = swig_type_initial;
     swig_module.cast_initial = swig_cast_initial;
     swig_module.next = &swig_module;
+    init = 1;
+  } else {
+    init = 0;
   }
   
   /* Try and load any already created modules */
@@ -3382,6 +3759,12 @@ SWIG_InitializeModule(void *clientdata) {
     module_head->next = &swig_module;
   }
   
+  /* When multiple interpeters are used, a module could have already been initialized in
+       a different interpreter, but not yet have a pointer in this interpreter.
+       In this case, we do not want to continue adding types... everything should be
+       set up already */
+  if (init == 0) return;
+  
   /* Now work on filling in swig_module.types */
 #ifdef SWIGRUNTIME_DEBUG
   printf("SWIG_InitializeModule: size %d\n", swig_module.size);
@@ -3535,7 +3918,7 @@ XS(SWIG_init) {
   /* Install variables */
   for (i = 0; swig_variables[i].name; i++) {
     SV *sv;
-    sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2);
+    sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI);
     if (swig_variables[i].type) {
       SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0);
     } else {
@@ -3547,7 +3930,7 @@ XS(SWIG_init) {
   /* Install constant */
   for (i = 0; swig_constants[i].type; i++) {
     SV *sv;
-    sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2);
+    sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI);
     switch(swig_constants[i].type) {
     case SWIG_INT:
       sv_setiv(sv, (IV) swig_constants[i].lvalue);
@@ -3574,285 +3957,251 @@ XS(SWIG_init) {
   /* Initialize the Device API on load */
   device_api_init();
   
+  SWIG_TypeClientData(SWIGTYPE_p_queue_fd_t, (void*) "Amanda::Device::queue_fd_t");
   SWIG_TypeClientData(SWIGTYPE_p_Device, (void*) "Amanda::Device::Device");
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "ACCESS_NULL", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "ACCESS_NULL", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(ACCESS_NULL)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "ACCESS_READ", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "ACCESS_READ", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(ACCESS_READ)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "ACCESS_WRITE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "ACCESS_WRITE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(ACCESS_WRITE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "ACCESS_APPEND", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "ACCESS_APPEND", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(ACCESS_APPEND)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "READ_LABEL_STATUS_SUCCESS", TRUE | 0x2);
-    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(READ_LABEL_STATUS_SUCCESS)));
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DEVICE_STATUS_SUCCESS", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DEVICE_STATUS_SUCCESS)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "READ_LABEL_STATUS_DEVICE_MISSING", TRUE | 0x2);
-    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(READ_LABEL_STATUS_DEVICE_MISSING)));
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DEVICE_STATUS_DEVICE_ERROR", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DEVICE_STATUS_DEVICE_ERROR)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "READ_LABEL_STATUS_DEVICE_ERROR", TRUE | 0x2);
-    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(READ_LABEL_STATUS_DEVICE_ERROR)));
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DEVICE_STATUS_DEVICE_BUSY", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DEVICE_STATUS_DEVICE_BUSY)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "READ_LABEL_STATUS_VOLUME_MISSING", TRUE | 0x2);
-    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(READ_LABEL_STATUS_VOLUME_MISSING)));
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DEVICE_STATUS_VOLUME_MISSING", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DEVICE_STATUS_VOLUME_MISSING)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "READ_LABEL_STATUS_VOLUME_UNLABELED", TRUE | 0x2);
-    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(READ_LABEL_STATUS_VOLUME_UNLABELED)));
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DEVICE_STATUS_VOLUME_UNLABELED", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DEVICE_STATUS_VOLUME_UNLABELED)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "READ_LABEL_STATUS_VOLUME_ERROR", TRUE | 0x2);
-    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(READ_LABEL_STATUS_VOLUME_ERROR)));
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DEVICE_STATUS_VOLUME_ERROR", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DEVICE_STATUS_VOLUME_ERROR)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "READ_LABEL_STATUS_FLAGS_MAX", TRUE | 0x2);
-    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(READ_LABEL_STATUS_FLAGS_MAX)));
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DEVICE_STATUS_FLAGS_MAX", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(DEVICE_STATUS_FLAGS_MAX)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_PHASE_BEFORE_START", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_PHASE_BEFORE_START", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_PHASE_BEFORE_START)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_PHASE_BETWEEN_FILE_WRITE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_PHASE_BETWEEN_FILE_WRITE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_PHASE_BETWEEN_FILE_WRITE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_PHASE_INSIDE_FILE_WRITE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_PHASE_INSIDE_FILE_WRITE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_PHASE_INSIDE_FILE_WRITE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_PHASE_BETWEEN_FILE_READ", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_PHASE_BETWEEN_FILE_READ", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_PHASE_BETWEEN_FILE_READ)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_PHASE_INSIDE_FILE_READ", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_PHASE_INSIDE_FILE_READ", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_PHASE_INSIDE_FILE_READ)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_PHASE_MAX", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_PHASE_MAX", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_PHASE_MAX)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_PHASE_MASK", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_PHASE_MASK", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_PHASE_MASK)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_PHASE_SHIFT", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_PHASE_SHIFT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_PHASE_SHIFT)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_GET_BEFORE_START", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_GET_BEFORE_START", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_ACCESS_GET_BEFORE_START)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_GET_BETWEEN_FILE_WRITE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_GET_BETWEEN_FILE_WRITE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_ACCESS_GET_BETWEEN_FILE_WRITE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_GET_INSIDE_FILE_WRITE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_GET_INSIDE_FILE_WRITE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_ACCESS_GET_INSIDE_FILE_WRITE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_GET_BETWEEN_FILE_READ", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_GET_BETWEEN_FILE_READ", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_ACCESS_GET_BETWEEN_FILE_READ)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_GET_INSIDE_FILE_READ", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_GET_INSIDE_FILE_READ", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_ACCESS_GET_INSIDE_FILE_READ)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_SET_BEFORE_START", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_SET_BEFORE_START", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_ACCESS_SET_BEFORE_START)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_SET_BETWEEN_FILE_WRITE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_SET_BETWEEN_FILE_WRITE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_ACCESS_SET_BETWEEN_FILE_WRITE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_SET_INSIDE_FILE_WRITE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_SET_INSIDE_FILE_WRITE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_ACCESS_SET_INSIDE_FILE_WRITE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_SET_BETWEEN_FILE_READ", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_SET_BETWEEN_FILE_READ", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_ACCESS_SET_BETWEEN_FILE_READ)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_SET_INSIDE_FILE_READ", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_SET_INSIDE_FILE_READ", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_ACCESS_SET_INSIDE_FILE_READ)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_GET_MASK", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_GET_MASK", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_ACCESS_GET_MASK)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_SET_MASK", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_ACCESS_SET_MASK", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_ACCESS_SET_MASK)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CONCURRENCY_PARADIGM_EXCLUSIVE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CONCURRENCY_PARADIGM_EXCLUSIVE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CONCURRENCY_PARADIGM_EXCLUSIVE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CONCURRENCY_PARADIGM_SHARED_READ", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CONCURRENCY_PARADIGM_SHARED_READ", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CONCURRENCY_PARADIGM_SHARED_READ)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "CONCURRENCY_PARADIGM_RANDOM_ACCESS", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CONCURRENCY_PARADIGM_RANDOM_ACCESS", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CONCURRENCY_PARADIGM_RANDOM_ACCESS)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "STREAMING_REQUIREMENT_NONE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "STREAMING_REQUIREMENT_NONE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(STREAMING_REQUIREMENT_NONE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "STREAMING_REQUIREMENT_DESIRED", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "STREAMING_REQUIREMENT_DESIRED", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(STREAMING_REQUIREMENT_DESIRED)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "STREAMING_REQUIREMENT_REQUIRED", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "STREAMING_REQUIREMENT_REQUIRED", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(STREAMING_REQUIREMENT_REQUIRED)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "MEDIA_ACCESS_MODE_READ_ONLY", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "MEDIA_ACCESS_MODE_READ_ONLY", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(MEDIA_ACCESS_MODE_READ_ONLY)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "MEDIA_ACCESS_MODE_WORM", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "MEDIA_ACCESS_MODE_WORM", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(MEDIA_ACCESS_MODE_WORM)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "MEDIA_ACCESS_MODE_READ_WRITE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "MEDIA_ACCESS_MODE_READ_WRITE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(MEDIA_ACCESS_MODE_READ_WRITE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "MEDIA_ACCESS_MODE_WRITE_ONLY", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "MEDIA_ACCESS_MODE_WRITE_ONLY", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(MEDIA_ACCESS_MODE_WRITE_ONLY)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "SIZE_ACCURACY_UNKNOWN", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SIZE_ACCURACY_UNKNOWN", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(SIZE_ACCURACY_UNKNOWN)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "SIZE_ACCURACY_ESTIMATE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SIZE_ACCURACY_ESTIMATE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(SIZE_ACCURACY_ESTIMATE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "SIZE_ACCURACY_REAL", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SIZE_ACCURACY_REAL", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(SIZE_ACCURACY_REAL)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "FEATURE_STATUS_ENABLED", TRUE | 0x2);
-    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(FEATURE_STATUS_ENABLED)));
-    SvREADONLY_on(sv);
-  } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "FEATURE_STATUS_DISABLED", TRUE | 0x2);
-    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(FEATURE_STATUS_DISABLED)));
-    SvREADONLY_on(sv);
-  } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "FEATURE_SURETY_BAD", TRUE | 0x2);
-    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(FEATURE_SURETY_BAD)));
-    SvREADONLY_on(sv);
-  } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "FEATURE_SURETY_GOOD", TRUE | 0x2);
-    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(FEATURE_SURETY_GOOD)));
-    SvREADONLY_on(sv);
-  } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "FEATURE_SOURCE_DEFAULT", TRUE | 0x2);
-    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(FEATURE_SOURCE_DEFAULT)));
-    SvREADONLY_on(sv);
-  } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "FEATURE_SOURCE_DETECTED", TRUE | 0x2);
-    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(FEATURE_SOURCE_DETECTED)));
-    SvREADONLY_on(sv);
-  } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "FEATURE_SOURCE_USER", TRUE | 0x2);
-    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(FEATURE_SOURCE_USER)));
-    SvREADONLY_on(sv);
-  } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "FEATURE_SUPPORT_FLAGS_MAX", TRUE | 0x2);
-    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(FEATURE_SUPPORT_FLAGS_MAX)));
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_SURETY_BAD", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_SURETY_BAD)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "FEATURE_SUPPORT_FLAGS_MASK", TRUE | 0x2);
-    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(FEATURE_SUPPORT_FLAGS_MASK)));
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_SURETY_GOOD", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_SURETY_GOOD)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "FEATURE_SUPPORT_FLAGS_STATUS_MASK", TRUE | 0x2);
-    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(FEATURE_SUPPORT_FLAGS_STATUS_MASK)));
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_SOURCE_DEFAULT", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_SOURCE_DEFAULT)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "FEATURE_SUPPORT_FLAGS_SURETY_MASK", TRUE | 0x2);
-    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(FEATURE_SUPPORT_FLAGS_SURETY_MASK)));
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_SOURCE_DETECTED", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_SOURCE_DETECTED)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "FEATURE_SUPPORT_FLAGS_SOURCE_MASK", TRUE | 0x2);
-    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(FEATURE_SUPPORT_FLAGS_SOURCE_MASK)));
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "PROPERTY_SOURCE_USER", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(PROPERTY_SOURCE_USER)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
   ST(0) = &PL_sv_yes;
index 5549f1160c7f077e7ecefd074d982c05fdc01e84..81a989fa7041eab3ebba17313d3922b9d64f4bab 100644 (file)
@@ -1,5 +1,5 @@
 # This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.33
+# Version 1.3.35
 #
 # Don't modify this file, modify the SWIG interface instead.
 
@@ -51,7 +51,47 @@ sub this {
 package Amanda::Device;
 
 *IS_WRITABLE_ACCESS_MODE = *Amanda::Devicec::IS_WRITABLE_ACCESS_MODE;
-*feature_support_flags_is_valid = *Amanda::Devicec::feature_support_flags_is_valid;
+
+############# Class : Amanda::Device::queue_fd_t ##############
+
+package Amanda::Device::queue_fd_t;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+@ISA = qw( Amanda::Device );
+%OWNER = ();
+%ITERATORS = ();
+*swig_fd_get = *Amanda::Devicec::queue_fd_t_fd_get;
+*swig_fd_set = *Amanda::Devicec::queue_fd_t_fd_set;
+*swig_errmsg_get = *Amanda::Devicec::queue_fd_t_errmsg_get;
+*swig_errmsg_set = *Amanda::Devicec::queue_fd_t_errmsg_set;
+sub new {
+    my $pkg = shift;
+    my $self = Amanda::Devicec::new_queue_fd_t(@_);
+    bless $self, $pkg if defined($self);
+}
+
+sub DESTROY {
+    return unless $_[0]->isa('HASH');
+    my $self = tied(%{$_[0]});
+    return unless defined $self;
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        Amanda::Devicec::delete_queue_fd_t($self);
+        delete $OWNER{$self};
+    }
+}
+
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
 
 ############# Class : Amanda::Device::Device ##############
 
@@ -60,22 +100,6 @@ use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
 @ISA = qw( Amanda::Device );
 %OWNER = ();
 %ITERATORS = ();
-*swig_file_get = *Amanda::Devicec::Device_file_get;
-*swig_file_set = *Amanda::Devicec::Device_file_set;
-*swig_block_get = *Amanda::Devicec::Device_block_get;
-*swig_block_set = *Amanda::Devicec::Device_block_set;
-*swig_in_file_get = *Amanda::Devicec::Device_in_file_get;
-*swig_in_file_set = *Amanda::Devicec::Device_in_file_set;
-*swig_device_name_get = *Amanda::Devicec::Device_device_name_get;
-*swig_device_name_set = *Amanda::Devicec::Device_device_name_set;
-*swig_access_mode_get = *Amanda::Devicec::Device_access_mode_get;
-*swig_access_mode_set = *Amanda::Devicec::Device_access_mode_set;
-*swig_is_eof_get = *Amanda::Devicec::Device_is_eof_get;
-*swig_is_eof_set = *Amanda::Devicec::Device_is_eof_set;
-*swig_volume_label_get = *Amanda::Devicec::Device_volume_label_get;
-*swig_volume_label_set = *Amanda::Devicec::Device_volume_label_set;
-*swig_volume_time_get = *Amanda::Devicec::Device_volume_time_get;
-*swig_volume_time_set = *Amanda::Devicec::Device_volume_time_set;
 sub new {
     my $pkg = shift;
     my $self = Amanda::Devicec::new_Device(@_);
@@ -93,13 +117,14 @@ sub DESTROY {
     }
 }
 
+*configure = *Amanda::Devicec::Device_configure;
+*error = *Amanda::Devicec::Device_error;
+*status_error = *Amanda::Devicec::Device_status_error;
+*error_or_status = *Amanda::Devicec::Device_error_or_status;
 *read_label = *Amanda::Devicec::Device_read_label;
 *start = *Amanda::Devicec::Device_start;
 *finish = *Amanda::Devicec::Device_finish;
 *start_file = *Amanda::Devicec::Device_start_file;
-*write_min_size = *Amanda::Devicec::Device_write_min_size;
-*write_max_size = *Amanda::Devicec::Device_write_max_size;
-*read_max_size = *Amanda::Devicec::Device_read_max_size;
 *write_block = *Amanda::Devicec::Device_write_block;
 *write_from_fd = *Amanda::Devicec::Device_write_from_fd;
 *finish_file = *Amanda::Devicec::Device_finish_file;
@@ -110,8 +135,21 @@ sub DESTROY {
 *property_list = *Amanda::Devicec::Device_property_list;
 *property_get = *Amanda::Devicec::Device_property_get;
 *property_set = *Amanda::Devicec::Device_property_set;
+*property_set_ex = *Amanda::Devicec::Device_property_set_ex;
 *recycle_file = *Amanda::Devicec::Device_recycle_file;
-*set_startup_properties_from_config = *Amanda::Devicec::Device_set_startup_properties_from_config;
+*file = *Amanda::Devicec::Device_file;
+*block = *Amanda::Devicec::Device_block;
+*in_file = *Amanda::Devicec::Device_in_file;
+*device_name = *Amanda::Devicec::Device_device_name;
+*access_mode = *Amanda::Devicec::Device_access_mode;
+*is_eof = *Amanda::Devicec::Device_is_eof;
+*volume_label = *Amanda::Devicec::Device_volume_label;
+*volume_time = *Amanda::Devicec::Device_volume_time;
+*status = *Amanda::Devicec::Device_status;
+*min_block_size = *Amanda::Devicec::Device_min_block_size;
+*max_block_size = *Amanda::Devicec::Device_max_block_size;
+*block_size = *Amanda::Devicec::Device_block_size;
+*volume_header = *Amanda::Devicec::Device_volume_header;
 sub DISOWN {
     my $self = shift;
     my $ptr = tied(%$self);
@@ -133,13 +171,13 @@ package Amanda::Device;
 *ACCESS_READ = *Amanda::Devicec::ACCESS_READ;
 *ACCESS_WRITE = *Amanda::Devicec::ACCESS_WRITE;
 *ACCESS_APPEND = *Amanda::Devicec::ACCESS_APPEND;
-*READ_LABEL_STATUS_SUCCESS = *Amanda::Devicec::READ_LABEL_STATUS_SUCCESS;
-*READ_LABEL_STATUS_DEVICE_MISSING = *Amanda::Devicec::READ_LABEL_STATUS_DEVICE_MISSING;
-*READ_LABEL_STATUS_DEVICE_ERROR = *Amanda::Devicec::READ_LABEL_STATUS_DEVICE_ERROR;
-*READ_LABEL_STATUS_VOLUME_MISSING = *Amanda::Devicec::READ_LABEL_STATUS_VOLUME_MISSING;
-*READ_LABEL_STATUS_VOLUME_UNLABELED = *Amanda::Devicec::READ_LABEL_STATUS_VOLUME_UNLABELED;
-*READ_LABEL_STATUS_VOLUME_ERROR = *Amanda::Devicec::READ_LABEL_STATUS_VOLUME_ERROR;
-*READ_LABEL_STATUS_FLAGS_MAX = *Amanda::Devicec::READ_LABEL_STATUS_FLAGS_MAX;
+*DEVICE_STATUS_SUCCESS = *Amanda::Devicec::DEVICE_STATUS_SUCCESS;
+*DEVICE_STATUS_DEVICE_ERROR = *Amanda::Devicec::DEVICE_STATUS_DEVICE_ERROR;
+*DEVICE_STATUS_DEVICE_BUSY = *Amanda::Devicec::DEVICE_STATUS_DEVICE_BUSY;
+*DEVICE_STATUS_VOLUME_MISSING = *Amanda::Devicec::DEVICE_STATUS_VOLUME_MISSING;
+*DEVICE_STATUS_VOLUME_UNLABELED = *Amanda::Devicec::DEVICE_STATUS_VOLUME_UNLABELED;
+*DEVICE_STATUS_VOLUME_ERROR = *Amanda::Devicec::DEVICE_STATUS_VOLUME_ERROR;
+*DEVICE_STATUS_FLAGS_MAX = *Amanda::Devicec::DEVICE_STATUS_FLAGS_MAX;
 *PROPERTY_PHASE_BEFORE_START = *Amanda::Devicec::PROPERTY_PHASE_BEFORE_START;
 *PROPERTY_PHASE_BETWEEN_FILE_WRITE = *Amanda::Devicec::PROPERTY_PHASE_BETWEEN_FILE_WRITE;
 *PROPERTY_PHASE_INSIDE_FILE_WRITE = *Amanda::Devicec::PROPERTY_PHASE_INSIDE_FILE_WRITE;
@@ -173,18 +211,11 @@ package Amanda::Device;
 *SIZE_ACCURACY_UNKNOWN = *Amanda::Devicec::SIZE_ACCURACY_UNKNOWN;
 *SIZE_ACCURACY_ESTIMATE = *Amanda::Devicec::SIZE_ACCURACY_ESTIMATE;
 *SIZE_ACCURACY_REAL = *Amanda::Devicec::SIZE_ACCURACY_REAL;
-*FEATURE_STATUS_ENABLED = *Amanda::Devicec::FEATURE_STATUS_ENABLED;
-*FEATURE_STATUS_DISABLED = *Amanda::Devicec::FEATURE_STATUS_DISABLED;
-*FEATURE_SURETY_BAD = *Amanda::Devicec::FEATURE_SURETY_BAD;
-*FEATURE_SURETY_GOOD = *Amanda::Devicec::FEATURE_SURETY_GOOD;
-*FEATURE_SOURCE_DEFAULT = *Amanda::Devicec::FEATURE_SOURCE_DEFAULT;
-*FEATURE_SOURCE_DETECTED = *Amanda::Devicec::FEATURE_SOURCE_DETECTED;
-*FEATURE_SOURCE_USER = *Amanda::Devicec::FEATURE_SOURCE_USER;
-*FEATURE_SUPPORT_FLAGS_MAX = *Amanda::Devicec::FEATURE_SUPPORT_FLAGS_MAX;
-*FEATURE_SUPPORT_FLAGS_MASK = *Amanda::Devicec::FEATURE_SUPPORT_FLAGS_MASK;
-*FEATURE_SUPPORT_FLAGS_STATUS_MASK = *Amanda::Devicec::FEATURE_SUPPORT_FLAGS_STATUS_MASK;
-*FEATURE_SUPPORT_FLAGS_SURETY_MASK = *Amanda::Devicec::FEATURE_SUPPORT_FLAGS_SURETY_MASK;
-*FEATURE_SUPPORT_FLAGS_SOURCE_MASK = *Amanda::Devicec::FEATURE_SUPPORT_FLAGS_SOURCE_MASK;
+*PROPERTY_SURETY_BAD = *Amanda::Devicec::PROPERTY_SURETY_BAD;
+*PROPERTY_SURETY_GOOD = *Amanda::Devicec::PROPERTY_SURETY_GOOD;
+*PROPERTY_SOURCE_DEFAULT = *Amanda::Devicec::PROPERTY_SOURCE_DEFAULT;
+*PROPERTY_SOURCE_DETECTED = *Amanda::Devicec::PROPERTY_SOURCE_DETECTED;
+*PROPERTY_SOURCE_USER = *Amanda::Devicec::PROPERTY_SOURCE_USER;
 
 @EXPORT_OK = ();
 %EXPORT_TAGS = ();
@@ -198,8 +229,7 @@ Amanda::Device - interact with Amanda data-storage devices
   use Amanda::Device qw( :constants );
 
   my $dev = Amanda::Device->new($device_name);
-  $dev->set_startup_properties_from_config();
-  if ($dev->read_label() == $READ_LABEL_STATUS_SUCCESS) {
+  if ($dev->read_label() == $DEVICE_STATUS_SUCCESS) {
       print "Label on $device_name is '$dev->volume_label'\n";
   }
   
@@ -211,33 +241,12 @@ Stable
 
 =head1 Amanda::Device Objects
 
-=head2 Instance Variables
+See the wiki for descriptions of these functions.  Note that C instance variables
+are represented by accessor functions of the same name.
 
 =over
 
-=item C<$file>
-
-=item C<$block>
-
-=item C<$in_file>
-
-=item C<$device_name>
-
-=item C<$access_mode>
-
-=item C<$is_eof>
-
-=item C<$volume_label>
-
-=item C<$volume_time>
-
-=back
-
-=head2 Methods
-
-See the wiki for descriptions of these functions
-
-=over
+=item C<configure($use_global_config)>
 
 =item C<read_label()>
 
@@ -247,13 +256,7 @@ See the wiki for descriptions of these functions
 
 =item C<start_file($jobinfo)>
 
-where C<$jobinfo> is a C<dumpfile_t> (see L<Amanda::Datatypes>)
-
-=item C<write_min_size()>
-
-=item C<write_max_size()>
-
-=item C<read_max_size()>
+where C<$jobinfo> is a C<dumpfile_t> (see L<Amanda::Types>)
 
 =item C<write_block($size, $data, $short_block)>
 
@@ -261,7 +264,7 @@ Note that Perl code is not expected to handle on-device data, so there
 is currently no way to provide data to this function from Perl.  This may
 change in future revisions.
 
-=item C<write_from_fd($fd)>
+=item C<write_from_fd($queue_fd)>
 
 where C<$fd> is an integer file descriptor, not a filehandle
 
@@ -273,7 +276,7 @@ where C<$fd> is an integer file descriptor, not a filehandle
 
 =item C<read_block($size)>
 
-=item C<read_to_fd($fd)>
+=item C<read_to_fd($queue_fd)>
 
 where C<$fd> is an integer file descriptor, not a filehandle
 
@@ -283,19 +286,50 @@ change in future revisions.
 
 =item C<property_list()>
 
-returns a list of property names.
+returns a list of properties, each represented as a hash:
+
+  { 'access' => $access_flags,
+    'name' => $property_name,
+    'description' => $property_description }
 
 =item C<property_get($property_name)>
 
-returns the property as the appropriate Perl type.
+returns the property, with the appropriate Perl type, or undef.  In array
+context, returns the list C<($value, $surety, $source)>.
 
 =item C<property_set($property_name, $value)>
 
-where $value is of an appropriate type for the given property
+=item C<property_set_ex($property_name, $value, $surety, $source)>
+
+where C<$value> is of an appropriate type for the given property, C<$surety> is
+a C<$PROPERTY_SURETY_*> constant, and C<$source> is a C<$PROPERTY_SOURCE_*>
+constant.
 
 =item C<recycle_file($filenum)>
 
-=item C<set_startup_properties_from_config()>
+=item C<file()> (accessor function)
+
+=item C<block()> (accessor function)
+
+=item C<in_file()> (accessor function)
+
+=item C<device_name()> (accessor function)
+
+=item C<access_mode()> (accessor function)
+
+=item C<is_eof()> (accessor function)
+
+=item C<volume_label()> (accessor function)
+
+=item C<volume_time()> (accessor function)
+
+=item C<min_block_size()> (accessor function)
+
+=item C<max_block_size()> (accessor function)
+
+=item C<block_size()> (accessor function)
+
+=item C<volume_header()> (accessor function)
 
 =back
 
@@ -304,7 +338,7 @@ where $value is of an appropriate type for the given property
 This module defines a large number of constants.  Again, consult the
 wiki or C<device.h> for the details on their meaning.  These constants
 are available from the package namespace (e.g.,
-C<Amanda::Device::ACCESS_WRITE>), of imported with the C<:constant>
+C<Amanda::Device::ACCESS_WRITE>), or imported with the C<:constant>
 import tag.
 
 =cut
@@ -361,17 +395,17 @@ push @{$EXPORT_TAGS{"DeviceAccessMode"}}, qw(IS_WRITABLE_ACCESS_MODE);
 #copy symbols in DeviceAccessMode to constants
 push @{$EXPORT_TAGS{"constants"}},  @{$EXPORT_TAGS{"DeviceAccessMode"}};
 
-push @EXPORT_OK, qw(ReadLabelStatusFlags_to_strings);
-push @{$EXPORT_TAGS{"ReadLabelStatusFlags"}}, qw(ReadLabelStatusFlags_to_strings);
+push @EXPORT_OK, qw(DeviceStatusFlags_to_strings);
+push @{$EXPORT_TAGS{"DeviceStatusFlags"}}, qw(DeviceStatusFlags_to_strings);
 
-my %_ReadLabelStatusFlags_VALUES;
+my %_DeviceStatusFlags_VALUES;
 #Convert a flag value to a list of names for flags that are set.
-sub ReadLabelStatusFlags_to_strings {
+sub DeviceStatusFlags_to_strings {
     my ($flags) = @_;
     my @result = ();
 
-    for my $k (keys %_ReadLabelStatusFlags_VALUES) {
-       my $v = $_ReadLabelStatusFlags_VALUES{$k};
+    for my $k (keys %_DeviceStatusFlags_VALUES) {
+       my $v = $_DeviceStatusFlags_VALUES{$k};
 
        #is this a matching flag?
        if (($v == 0 && $flags == 0) || ($v != 0 && ($flags & $v) == $v)) {
@@ -387,41 +421,41 @@ sub ReadLabelStatusFlags_to_strings {
     return @result;
 }
 
-push @EXPORT_OK, qw($READ_LABEL_STATUS_SUCCESS);
-push @{$EXPORT_TAGS{"ReadLabelStatusFlags"}}, qw($READ_LABEL_STATUS_SUCCESS);
+push @EXPORT_OK, qw($DEVICE_STATUS_SUCCESS);
+push @{$EXPORT_TAGS{"DeviceStatusFlags"}}, qw($DEVICE_STATUS_SUCCESS);
 
-$_ReadLabelStatusFlags_VALUES{"SUCCESS"} = $READ_LABEL_STATUS_SUCCESS;
+$_DeviceStatusFlags_VALUES{"SUCCESS"} = $DEVICE_STATUS_SUCCESS;
 
-push @EXPORT_OK, qw($READ_LABEL_STATUS_DEVICE_MISSING);
-push @{$EXPORT_TAGS{"ReadLabelStatusFlags"}}, qw($READ_LABEL_STATUS_DEVICE_MISSING);
+push @EXPORT_OK, qw($DEVICE_STATUS_DEVICE_ERROR);
+push @{$EXPORT_TAGS{"DeviceStatusFlags"}}, qw($DEVICE_STATUS_DEVICE_ERROR);
 
-$_ReadLabelStatusFlags_VALUES{"DEVICE_MISSING"} = $READ_LABEL_STATUS_DEVICE_MISSING;
+$_DeviceStatusFlags_VALUES{"DEVICE_ERROR"} = $DEVICE_STATUS_DEVICE_ERROR;
 
-push @EXPORT_OK, qw($READ_LABEL_STATUS_DEVICE_ERROR);
-push @{$EXPORT_TAGS{"ReadLabelStatusFlags"}}, qw($READ_LABEL_STATUS_DEVICE_ERROR);
+push @EXPORT_OK, qw($DEVICE_STATUS_DEVICE_BUSY);
+push @{$EXPORT_TAGS{"DeviceStatusFlags"}}, qw($DEVICE_STATUS_DEVICE_BUSY);
 
-$_ReadLabelStatusFlags_VALUES{"DEVICE_ERROR"} = $READ_LABEL_STATUS_DEVICE_ERROR;
+$_DeviceStatusFlags_VALUES{"DEVICE_BUSY"} = $DEVICE_STATUS_DEVICE_BUSY;
 
-push @EXPORT_OK, qw($READ_LABEL_STATUS_VOLUME_MISSING);
-push @{$EXPORT_TAGS{"ReadLabelStatusFlags"}}, qw($READ_LABEL_STATUS_VOLUME_MISSING);
+push @EXPORT_OK, qw($DEVICE_STATUS_VOLUME_MISSING);
+push @{$EXPORT_TAGS{"DeviceStatusFlags"}}, qw($DEVICE_STATUS_VOLUME_MISSING);
 
-$_ReadLabelStatusFlags_VALUES{"VOLUME_MISSING"} = $READ_LABEL_STATUS_VOLUME_MISSING;
+$_DeviceStatusFlags_VALUES{"VOLUME_MISSING"} = $DEVICE_STATUS_VOLUME_MISSING;
 
-push @EXPORT_OK, qw($READ_LABEL_STATUS_VOLUME_UNLABELED);
-push @{$EXPORT_TAGS{"ReadLabelStatusFlags"}}, qw($READ_LABEL_STATUS_VOLUME_UNLABELED);
+push @EXPORT_OK, qw($DEVICE_STATUS_VOLUME_UNLABELED);
+push @{$EXPORT_TAGS{"DeviceStatusFlags"}}, qw($DEVICE_STATUS_VOLUME_UNLABELED);
 
-$_ReadLabelStatusFlags_VALUES{"VOLUME_UNLABELED"} = $READ_LABEL_STATUS_VOLUME_UNLABELED;
+$_DeviceStatusFlags_VALUES{"VOLUME_UNLABELED"} = $DEVICE_STATUS_VOLUME_UNLABELED;
 
-push @EXPORT_OK, qw($READ_LABEL_STATUS_VOLUME_ERROR);
-push @{$EXPORT_TAGS{"ReadLabelStatusFlags"}}, qw($READ_LABEL_STATUS_VOLUME_ERROR);
+push @EXPORT_OK, qw($DEVICE_STATUS_VOLUME_ERROR);
+push @{$EXPORT_TAGS{"DeviceStatusFlags"}}, qw($DEVICE_STATUS_VOLUME_ERROR);
 
-$_ReadLabelStatusFlags_VALUES{"VOLUME_ERROR"} = $READ_LABEL_STATUS_VOLUME_ERROR;
+$_DeviceStatusFlags_VALUES{"VOLUME_ERROR"} = $DEVICE_STATUS_VOLUME_ERROR;
 
-push @EXPORT_OK, qw($READ_LABEL_STATUS_FLAGS_MAX);
-push @{$EXPORT_TAGS{"ReadLabelStatusFlags"}}, qw($READ_LABEL_STATUS_FLAGS_MAX);
+push @EXPORT_OK, qw($DEVICE_STATUS_FLAGS_MAX);
+push @{$EXPORT_TAGS{"DeviceStatusFlags"}}, qw($DEVICE_STATUS_FLAGS_MAX);
 
-#copy symbols in ReadLabelStatusFlags to constants
-push @{$EXPORT_TAGS{"constants"}},  @{$EXPORT_TAGS{"ReadLabelStatusFlags"}};
+#copy symbols in DeviceStatusFlags to constants
+push @{$EXPORT_TAGS{"constants"}},  @{$EXPORT_TAGS{"DeviceStatusFlags"}};
 
 push @EXPORT_OK, qw(PropertyPhaseFlags_to_strings);
 push @{$EXPORT_TAGS{"PropertyPhaseFlags"}}, qw(PropertyPhaseFlags_to_strings);
@@ -732,17 +766,17 @@ $_SizeAccuracy_VALUES{"REAL"} = $SIZE_ACCURACY_REAL;
 #copy symbols in SizeAccuracy to constants
 push @{$EXPORT_TAGS{"constants"}},  @{$EXPORT_TAGS{"SizeAccuracy"}};
 
-push @EXPORT_OK, qw(FeatureSupportFlags_to_strings);
-push @{$EXPORT_TAGS{"FeatureSupportFlags"}}, qw(FeatureSupportFlags_to_strings);
+push @EXPORT_OK, qw(PropertySurety_to_strings);
+push @{$EXPORT_TAGS{"PropertySurety"}}, qw(PropertySurety_to_strings);
 
-my %_FeatureSupportFlags_VALUES;
+my %_PropertySurety_VALUES;
 #Convert a flag value to a list of names for flags that are set.
-sub FeatureSupportFlags_to_strings {
+sub PropertySurety_to_strings {
     my ($flags) = @_;
     my @result = ();
 
-    for my $k (keys %_FeatureSupportFlags_VALUES) {
-       my $v = $_FeatureSupportFlags_VALUES{$k};
+    for my $k (keys %_PropertySurety_VALUES) {
+       my $v = $_PropertySurety_VALUES{$k};
 
        #is this a matching flag?
        if (($v == 0 && $flags == 0) || ($v != 0 && ($flags & $v) == $v)) {
@@ -758,61 +792,62 @@ sub FeatureSupportFlags_to_strings {
     return @result;
 }
 
-push @EXPORT_OK, qw($FEATURE_STATUS_ENABLED);
-push @{$EXPORT_TAGS{"FeatureSupportFlags"}}, qw($FEATURE_STATUS_ENABLED);
-
-$_FeatureSupportFlags_VALUES{"STATUS_ENABLED"} = $FEATURE_STATUS_ENABLED;
-
-push @EXPORT_OK, qw($FEATURE_STATUS_DISABLED);
-push @{$EXPORT_TAGS{"FeatureSupportFlags"}}, qw($FEATURE_STATUS_DISABLED);
-
-$_FeatureSupportFlags_VALUES{"STATUS_DISABLED"} = $FEATURE_STATUS_DISABLED;
+push @EXPORT_OK, qw($PROPERTY_SURETY_BAD);
+push @{$EXPORT_TAGS{"PropertySurety"}}, qw($PROPERTY_SURETY_BAD);
 
-push @EXPORT_OK, qw($FEATURE_SURETY_BAD);
-push @{$EXPORT_TAGS{"FeatureSupportFlags"}}, qw($FEATURE_SURETY_BAD);
+$_PropertySurety_VALUES{"SURETY_BAD"} = $PROPERTY_SURETY_BAD;
 
-$_FeatureSupportFlags_VALUES{"SURETY_BAD"} = $FEATURE_SURETY_BAD;
+push @EXPORT_OK, qw($PROPERTY_SURETY_GOOD);
+push @{$EXPORT_TAGS{"PropertySurety"}}, qw($PROPERTY_SURETY_GOOD);
 
-push @EXPORT_OK, qw($FEATURE_SURETY_GOOD);
-push @{$EXPORT_TAGS{"FeatureSupportFlags"}}, qw($FEATURE_SURETY_GOOD);
+$_PropertySurety_VALUES{"SURETY_GOOD"} = $PROPERTY_SURETY_GOOD;
 
-$_FeatureSupportFlags_VALUES{"SURETY_GOOD"} = $FEATURE_SURETY_GOOD;
+#copy symbols in PropertySurety to constants
+push @{$EXPORT_TAGS{"constants"}},  @{$EXPORT_TAGS{"PropertySurety"}};
 
-push @EXPORT_OK, qw($FEATURE_SOURCE_DEFAULT);
-push @{$EXPORT_TAGS{"FeatureSupportFlags"}}, qw($FEATURE_SOURCE_DEFAULT);
+push @EXPORT_OK, qw(PropertySource_to_strings);
+push @{$EXPORT_TAGS{"PropertySource"}}, qw(PropertySource_to_strings);
 
-$_FeatureSupportFlags_VALUES{"SOURCE_DEFAULT"} = $FEATURE_SOURCE_DEFAULT;
+my %_PropertySource_VALUES;
+#Convert a flag value to a list of names for flags that are set.
+sub PropertySource_to_strings {
+    my ($flags) = @_;
+    my @result = ();
 
-push @EXPORT_OK, qw($FEATURE_SOURCE_DETECTED);
-push @{$EXPORT_TAGS{"FeatureSupportFlags"}}, qw($FEATURE_SOURCE_DETECTED);
+    for my $k (keys %_PropertySource_VALUES) {
+       my $v = $_PropertySource_VALUES{$k};
 
-$_FeatureSupportFlags_VALUES{"SOURCE_DETECTED"} = $FEATURE_SOURCE_DETECTED;
+       #is this a matching flag?
+       if (($v == 0 && $flags == 0) || ($v != 0 && ($flags & $v) == $v)) {
+           push @result, $k;
+       }
+    }
 
-push @EXPORT_OK, qw($FEATURE_SOURCE_USER);
-push @{$EXPORT_TAGS{"FeatureSupportFlags"}}, qw($FEATURE_SOURCE_USER);
+#by default, just return the number as a 1-element list
+    if (!@result) {
+       return ($flags);
+    }
 
-$_FeatureSupportFlags_VALUES{"SOURCE_USER"} = $FEATURE_SOURCE_USER;
+    return @result;
+}
 
-push @EXPORT_OK, qw($FEATURE_SUPPORT_FLAGS_MAX);
-push @{$EXPORT_TAGS{"FeatureSupportFlags"}}, qw($FEATURE_SUPPORT_FLAGS_MAX);
+push @EXPORT_OK, qw($PROPERTY_SOURCE_DEFAULT);
+push @{$EXPORT_TAGS{"PropertySource"}}, qw($PROPERTY_SOURCE_DEFAULT);
 
-push @EXPORT_OK, qw($FEATURE_SUPPORT_FLAGS_MASK);
-push @{$EXPORT_TAGS{"FeatureSupportFlags"}}, qw($FEATURE_SUPPORT_FLAGS_MASK);
+$_PropertySource_VALUES{"SOURCE_DEFAULT"} = $PROPERTY_SOURCE_DEFAULT;
 
-push @EXPORT_OK, qw($FEATURE_SUPPORT_FLAGS_STATUS_MASK);
-push @{$EXPORT_TAGS{"FeatureSupportFlags"}}, qw($FEATURE_SUPPORT_FLAGS_STATUS_MASK);
+push @EXPORT_OK, qw($PROPERTY_SOURCE_DETECTED);
+push @{$EXPORT_TAGS{"PropertySource"}}, qw($PROPERTY_SOURCE_DETECTED);
 
-push @EXPORT_OK, qw($FEATURE_SUPPORT_FLAGS_SURETY_MASK);
-push @{$EXPORT_TAGS{"FeatureSupportFlags"}}, qw($FEATURE_SUPPORT_FLAGS_SURETY_MASK);
+$_PropertySource_VALUES{"SOURCE_DETECTED"} = $PROPERTY_SOURCE_DETECTED;
 
-push @EXPORT_OK, qw($FEATURE_SUPPORT_FLAGS_SOURCE_MASK);
-push @{$EXPORT_TAGS{"FeatureSupportFlags"}}, qw($FEATURE_SUPPORT_FLAGS_SOURCE_MASK);
+push @EXPORT_OK, qw($PROPERTY_SOURCE_USER);
+push @{$EXPORT_TAGS{"PropertySource"}}, qw($PROPERTY_SOURCE_USER);
 
-push @EXPORT_OK, qw(feature_support_flags_is_valid);
-push @{$EXPORT_TAGS{"FeatureSupportFlags"}}, qw(feature_support_flags_is_valid);
+$_PropertySource_VALUES{"SOURCE_USER"} = $PROPERTY_SOURCE_USER;
 
-#copy symbols in FeatureSupportFlags to constants
-push @{$EXPORT_TAGS{"constants"}},  @{$EXPORT_TAGS{"FeatureSupportFlags"}};
+#copy symbols in PropertySource to constants
+push @{$EXPORT_TAGS{"constants"}},  @{$EXPORT_TAGS{"PropertySource"}};
 
 
 # SWIG produces a sub-package for the Device "class", in this case named 
index 73aac3137fd8f920a5d43d2e6664e4e909dfe4b3..b83d70b556590608ef984f093a3d79a752db722a 100644 (file)
@@ -14,8 +14,8 @@
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  *
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 %module "Amanda::Device"
@@ -41,8 +41,7 @@ Amanda::Device - interact with Amanda data-storage devices
   use Amanda::Device qw( :constants );
 
   my $dev = Amanda::Device->new($device_name);
-  $dev->set_startup_properties_from_config();
-  if ($dev->read_label() == $READ_LABEL_STATUS_SUCCESS) {
+  if ($dev->read_label() == $DEVICE_STATUS_SUCCESS) {
       print "Label on $device_name is '$dev->volume_label'\n";
   }
   
@@ -54,33 +53,12 @@ Stable
 
 =head1 Amanda::Device Objects
 
-=head2 Instance Variables
+See the wiki for descriptions of these functions.  Note that C instance variables
+are represented by accessor functions of the same name.
 
 =over
 
-=item C<$file>
-
-=item C<$block>
-
-=item C<$in_file>
-
-=item C<$device_name>
-
-=item C<$access_mode>
-
-=item C<$is_eof>
-
-=item C<$volume_label>
-
-=item C<$volume_time>
-
-=back
-
-=head2 Methods
-
-See the wiki for descriptions of these functions
-
-=over
+=item C<configure($use_global_config)>
 
 =item C<read_label()>
 
@@ -90,13 +68,7 @@ See the wiki for descriptions of these functions
 
 =item C<start_file($jobinfo)>
 
-where C<$jobinfo> is a C<dumpfile_t> (see L<Amanda::Datatypes>)
-
-=item C<write_min_size()>
-
-=item C<write_max_size()>
-
-=item C<read_max_size()>
+where C<$jobinfo> is a C<dumpfile_t> (see L<Amanda::Types>)
 
 =item C<write_block($size, $data, $short_block)>
 
@@ -104,7 +76,7 @@ Note that Perl code is not expected to handle on-device data, so there
 is currently no way to provide data to this function from Perl.  This may
 change in future revisions.
 
-=item C<write_from_fd($fd)>
+=item C<write_from_fd($queue_fd)>
 
 where C<$fd> is an integer file descriptor, not a filehandle
 
@@ -116,7 +88,7 @@ where C<$fd> is an integer file descriptor, not a filehandle
 
 =item C<read_block($size)>
 
-=item C<read_to_fd($fd)>
+=item C<read_to_fd($queue_fd)>
 
 where C<$fd> is an integer file descriptor, not a filehandle
 
@@ -126,19 +98,50 @@ change in future revisions.
 
 =item C<property_list()>
 
-returns a list of property names.
+returns a list of properties, each represented as a hash:
+
+  { 'access' => $access_flags,
+    'name' => $property_name,
+    'description' => $property_description }
 
 =item C<property_get($property_name)>
 
-returns the property as the appropriate Perl type.
+returns the property, with the appropriate Perl type, or undef.  In array
+context, returns the list C<($value, $surety, $source)>.
 
 =item C<property_set($property_name, $value)>
 
-where $value is of an appropriate type for the given property
+=item C<property_set_ex($property_name, $value, $surety, $source)>
+
+where C<$value> is of an appropriate type for the given property, C<$surety> is
+a C<$PROPERTY_SURETY_*> constant, and C<$source> is a C<$PROPERTY_SOURCE_*>
+constant.
 
 =item C<recycle_file($filenum)>
 
-=item C<set_startup_properties_from_config()>
+=item C<file()> (accessor function)
+
+=item C<block()> (accessor function)
+
+=item C<in_file()> (accessor function)
+
+=item C<device_name()> (accessor function)
+
+=item C<access_mode()> (accessor function)
+
+=item C<is_eof()> (accessor function)
+
+=item C<volume_label()> (accessor function)
+
+=item C<volume_time()> (accessor function)
+
+=item C<min_block_size()> (accessor function)
+
+=item C<max_block_size()> (accessor function)
+
+=item C<block_size()> (accessor function)
+
+=item C<volume_header()> (accessor function)
 
 =back
 
@@ -147,7 +150,7 @@ where $value is of an appropriate type for the given property
 This module defines a large number of constants.  Again, consult the
 wiki or C<device.h> for the details on their meaning.  These constants
 are available from the package namespace (e.g.,
-C<Amanda::Device::ACCESS_WRITE>), of imported with the C<:constant>
+C<Amanda::Device::ACCESS_WRITE>), or imported with the C<:constant>
 import tag.
 
 =cut
@@ -202,7 +205,7 @@ set_sv_from_gvalue(GValue *value)
                sv = newRV((SV *)hv);
                return newRV((SV *)hv);
            } else {
-               warn("Unsupported boxed property type #%d", boxed_type);
+               warn("Unsupported boxed property type #%d", (int)boxed_type);
 
                sv = sv_newmortal();
                sv_setsv(sv, &PL_sv_undef);
@@ -260,7 +263,7 @@ set_sv_from_gvalue(GValue *value)
        case G_TYPE_INTERFACE:
        case G_TYPE_OBJECT:
        case G_TYPE_PARAM:
-           warn("Unsupported fundamental property type #%d", fundamental);
+           warn("Unsupported fundamental property type #%d", (int)fundamental);
            sv_setsv(sv, &PL_sv_undef);
            break;
     }
@@ -356,19 +359,31 @@ set_gvalue_from_sv(SV *sv, GValue *value)
  * Device struct, %extend-ed into a Perl class
  */
 
-typedef struct Device {
+typedef struct queue_fd_t {
     /* Instance variables -- all readonly */
     %immutable;
-    int file;
-    guint64 block;
-    gboolean in_file;
-    char * device_name;
-    DeviceAccessMode access_mode;
-    gboolean is_eof;
-    char * volume_label;
-    char * volume_time;
+    int fd;
+    char *errmsg;
+
     %mutable;
 
+    /* methods */
+    %extend {
+       /* constructor */
+       queue_fd_t(int fd) {
+           return queue_fd_new(fd, NULL);
+       }
+
+       /* destructor */
+       ~queue_fd_t() {
+           amfree(self->errmsg);
+           g_free(self);
+       }
+    }
+} queue_fd_t;
+
+typedef struct Device {
+
     /* methods */
     %extend {
        /* constructor */
@@ -380,7 +395,27 @@ typedef struct Device {
            g_object_unref(self);
        }
 
-       ReadLabelStatusFlags
+       gboolean
+       configure(gboolean use_global_config) {
+           return device_configure(self, use_global_config);
+       }
+
+       char *
+       error() {
+           return device_error(self);
+       }
+
+       char *
+       status_error() {
+           return device_status_error(self);
+       }
+
+       char *
+       error_or_status() {
+           return device_error_or_status(self);
+       }
+
+       DeviceStatusFlags
        read_label() {
            return device_read_label(self);
        }
@@ -396,33 +431,18 @@ typedef struct Device {
        }
 
        gboolean
-       start_file(const dumpfile_t *jobInfo) {
+       start_file(dumpfile_t *jobInfo) {
            return device_start_file(self, jobInfo);
        }
 
-       guint
-       write_min_size() {
-           return device_write_min_size(self);
-       }
-
-       guint
-       write_max_size() {
-           return device_write_max_size(self);
-       }
-
-       guint
-       read_max_size() {
-           return device_read_max_size(self);
-       }
-
        gboolean
-       write_block(guint size, gpointer data, gboolean short_block) {
-           return device_write_block(self, size, data, short_block);
+       write_block(guint size, gpointer data) {
+           return device_write_block(self, size, data);
        }
 
        gboolean
-       write_from_fd(int fd) {
-           return device_write_from_fd(self, fd);
+       write_from_fd(queue_fd_t *queue_fd) {
+           return device_write_from_fd(self, queue_fd);
        }
 
        gboolean
@@ -445,34 +465,41 @@ typedef struct Device {
            return device_read_block(self, buffer, size);
        }
 
-       gboolean read_to_fd(int fd) {
-           return device_read_to_fd(self, fd);
+       gboolean read_to_fd(queue_fd_t *queue_fd) {
+           return device_read_to_fd(self, queue_fd);
        }
 
-       %typemap(out) const DeviceProperty * {
-           int i = 0;
-           int len = 0;
+       %typemap(out) const GSList * {
+           GSList *iter;
 
            /* Count the DeviceProperties */
-           while ($1[len].base) len++;
-           EXTEND(SP, len); /* make room for return values */
+           EXTEND(SP, g_slist_length($1)); /* make room for return values */
 
            /* Note that we set $result several times. the nature of
             * SWIG's wrapping is such that incrementing argvi points
             * $result to the next location in perl's argument stack.
              */
 
-           for (i = 0; i < len ; i++) { 
-               $result = sv_newmortal(); 
-               sv_setpv($result, $1[i].base->name); 
+           for (iter = $1; iter; iter = g_slist_next(iter)) {
+               DeviceProperty *prop = iter->data;
+               HV *hash = newHV();
+               SV *rv = newRV_noinc((SV *)hash);
+
+               hv_store(hash, "name", 4,
+                       newSVpv(prop->base->name, 0), 0);
+               hv_store(hash, "description", 11,
+                       newSVpv(prop->base->description, 0), 0);
+               hv_store(hash, "access", 6,
+                       newSViv(prop->access), 0);
+               $result = sv_2mortal(rv);
                argvi++;
-           }
+           }
        }
-       const DeviceProperty * property_list(void) {
+       const GSList * property_list(void) {
            return device_property_get_list(self);
        }
 
-       %typemap(out) const DeviceProperty *; /* remove typemap */
+       %typemap(out) const GSList *; /* remove typemap */
 
        /* A typemap to convert a property name to a DevicePropertyBase. */
        %typemap(in) DevicePropertyBase * {
@@ -490,31 +517,45 @@ typedef struct Device {
        /* A typemap to convert the GValue in property_get to a return value.  The
         * (in) typemap sets up storage for the parameters, while the (argout) converts
         * them to a perl SV. */
-       %typemap(in,numinputs=0) (GValue *out_val, gboolean *val_found)
-                           (GValue val, gboolean found) {
+       %typemap(in,numinputs=0) (GValue *out_val, PropertySurety *surety,
+                                 PropertySource *source, gboolean *val_found)
+                           (GValue val,
+                            PropertySurety surety,
+                            PropertySource source,
+                            gboolean found) {
            memset(&val, 0, sizeof(val));
            $1 = &val;
-           $2 = &found;
+           if (GIMME_V == G_ARRAY) {
+               $2 = &surety;
+               $3 = &source;
+           }
+           $4 = &found;
        }
-       %typemap(argout) (GValue *out_val, gboolean *val_found) {
+       %typemap(argout) (GValue *out_val, PropertySurety *surety,
+                         PropertySource *source, gboolean *val_found) {
            /* if the result is valid */
-           if (*$2) {
+           if (*$4) {
                /* move data from $1 to $result, somehow */
                $result = set_sv_from_gvalue($1);
+               argvi++;
 
                /* free any memory for the GValue */
                g_value_unset($1);
-           } else {
-               /* silently return 'undef', the sentinel for "undefined" */
-               $result = sv_newmortal();
-               sv_setsv($result, &PL_sv_undef);
+
+               if (GIMME_V == G_ARRAY) {
+                   $result = newSViv(*$2);
+                   argvi++;
+                   $result = newSViv(*$3);
+                   argvi++;
+               }
            }
-           argvi++;
+           /* otherwise, return nothing */
        }
 
        void
-       property_get(DevicePropertyBase *pbase, GValue *out_val, gboolean *val_found) {
-           *val_found = device_property_get(self, pbase->ID, out_val);
+       property_get(DevicePropertyBase *pbase, GValue *out_val, PropertySurety *surety,
+                    PropertySource *source, gboolean *val_found) {
+           *val_found = device_property_get_ex(self, pbase->ID, out_val, surety, source);
        }
 
        /* delete typemaps */
@@ -544,14 +585,46 @@ typedef struct Device {
            return FALSE;
        }
 
+       gboolean
+       property_set_ex(DevicePropertyBase *pbase, SV *sv,
+                       PropertySurety surety, PropertySource source) {
+           GValue gval;
+           memset(&gval, 0, sizeof(gval));
+           g_value_init(&gval, pbase->type);
+           if (!set_gvalue_from_sv(sv, &gval))
+               goto fail;
+
+           if (!device_property_set_ex(self, pbase->ID, &gval, surety, source))
+               goto fail;
+
+           g_value_unset(&gval);
+           return TRUE;
+       fail:
+           g_value_unset(&gval);
+           return FALSE;
+       }
+
        gboolean recycle_file(guint filenum) {
            return device_recycle_file(self, filenum);
        }
        
-       void set_startup_properties_from_config(void) {
-           device_set_startup_properties_from_config(self);
-       }
+       /* accessor functions */
+
+       int file(void) { return self->file; }
+       guint64 block(void) { return self->block; }
+       gboolean in_file(void) { return self->in_file; }
+       char * device_name(void) { return self->device_name; }
+       DeviceAccessMode access_mode(void) { return self->access_mode; }
+       gboolean is_eof(void) { return self->is_eof; }
+       char * volume_label(void) { return self->volume_label; }
+       char * volume_time(void) { return self->volume_time; }
+       DeviceStatusFlags status(void) { return self->status; }
+       gsize min_block_size(void) { return self->min_block_size; }
+       gsize max_block_size(void) { return self->max_block_size; }
+       gsize block_size(void) { return self->block_size; }
+       dumpfile_t *volume_header(void) { return self->volume_header; }
     };
+
 } Device;
 
 /*
@@ -569,15 +642,15 @@ gboolean IS_WRITABLE_ACCESS_MODE(DeviceAccessMode mode);
 amglue_export_tag(DeviceAccessMode, IS_WRITABLE_ACCESS_MODE);
 amglue_copy_to_tag(DeviceAccessMode, constants);
 
-amglue_add_flag_tag_fns(ReadLabelStatusFlags);
-amglue_add_constant_short(READ_LABEL_STATUS_SUCCESS, "SUCCESS", ReadLabelStatusFlags);
-amglue_add_constant_short(READ_LABEL_STATUS_DEVICE_MISSING, "DEVICE_MISSING", ReadLabelStatusFlags);
-amglue_add_constant_short(READ_LABEL_STATUS_DEVICE_ERROR, "DEVICE_ERROR", ReadLabelStatusFlags);
-amglue_add_constant_short(READ_LABEL_STATUS_VOLUME_MISSING, "VOLUME_MISSING", ReadLabelStatusFlags);
-amglue_add_constant_short(READ_LABEL_STATUS_VOLUME_UNLABELED, "VOLUME_UNLABELED", ReadLabelStatusFlags);
-amglue_add_constant_short(READ_LABEL_STATUS_VOLUME_ERROR, "VOLUME_ERROR", ReadLabelStatusFlags);
-amglue_add_constant_noshort(READ_LABEL_STATUS_FLAGS_MAX, ReadLabelStatusFlags);
-amglue_copy_to_tag(ReadLabelStatusFlags, constants);
+amglue_add_flag_tag_fns(DeviceStatusFlags);
+amglue_add_constant_short(DEVICE_STATUS_SUCCESS, "SUCCESS", DeviceStatusFlags);
+amglue_add_constant_short(DEVICE_STATUS_DEVICE_ERROR, "DEVICE_ERROR", DeviceStatusFlags);
+amglue_add_constant_short(DEVICE_STATUS_DEVICE_BUSY, "DEVICE_BUSY", DeviceStatusFlags);
+amglue_add_constant_short(DEVICE_STATUS_VOLUME_MISSING, "VOLUME_MISSING", DeviceStatusFlags);
+amglue_add_constant_short(DEVICE_STATUS_VOLUME_UNLABELED, "VOLUME_UNLABELED", DeviceStatusFlags);
+amglue_add_constant_short(DEVICE_STATUS_VOLUME_ERROR, "VOLUME_ERROR", DeviceStatusFlags);
+amglue_add_constant_noshort(DEVICE_STATUS_FLAGS_MAX, DeviceStatusFlags);
+amglue_copy_to_tag(DeviceStatusFlags, constants);
 
 amglue_add_flag_tag_fns(PropertyPhaseFlags);
 amglue_add_constant_short(PROPERTY_PHASE_BEFORE_START, "BEFORE_START", PropertyPhaseFlags);
@@ -640,23 +713,16 @@ amglue_add_constant_short(SIZE_ACCURACY_ESTIMATE, "ESTIMATE", SizeAccuracy);
 amglue_add_constant_short(SIZE_ACCURACY_REAL, "REAL", SizeAccuracy);
 amglue_copy_to_tag(SizeAccuracy, constants);
 
-amglue_add_flag_tag_fns(FeatureSupportFlags);
-amglue_add_constant_short(FEATURE_STATUS_ENABLED, "STATUS_ENABLED", FeatureSupportFlags);
-amglue_add_constant_short(FEATURE_STATUS_DISABLED, "STATUS_DISABLED", FeatureSupportFlags);
-amglue_add_constant_short(FEATURE_SURETY_BAD, "SURETY_BAD", FeatureSupportFlags);
-amglue_add_constant_short(FEATURE_SURETY_GOOD, "SURETY_GOOD", FeatureSupportFlags);
-amglue_add_constant_short(FEATURE_SOURCE_DEFAULT, "SOURCE_DEFAULT", FeatureSupportFlags);
-amglue_add_constant_short(FEATURE_SOURCE_DETECTED, "SOURCE_DETECTED", FeatureSupportFlags);
-amglue_add_constant_short(FEATURE_SOURCE_USER, "SOURCE_USER", FeatureSupportFlags);
-amglue_add_constant_noshort(FEATURE_SUPPORT_FLAGS_MAX, FeatureSupportFlags);
-amglue_add_constant_noshort(FEATURE_SUPPORT_FLAGS_MASK, FeatureSupportFlags);
-amglue_add_constant_noshort(FEATURE_SUPPORT_FLAGS_STATUS_MASK, FeatureSupportFlags);
-amglue_add_constant_noshort(FEATURE_SUPPORT_FLAGS_SURETY_MASK, FeatureSupportFlags);
-amglue_add_constant_noshort(FEATURE_SUPPORT_FLAGS_SOURCE_MASK, FeatureSupportFlags);
-
-gboolean feature_support_flags_is_valid(FeatureSupportFlags);
-amglue_export_tag(FeatureSupportFlags, feature_support_flags_is_valid);
-amglue_copy_to_tag(FeatureSupportFlags, constants);
+amglue_add_flag_tag_fns(PropertySurety);
+amglue_add_constant_short(PROPERTY_SURETY_BAD, "SURETY_BAD", PropertySurety);
+amglue_add_constant_short(PROPERTY_SURETY_GOOD, "SURETY_GOOD", PropertySurety);
+amglue_copy_to_tag(PropertySurety, constants);
+
+amglue_add_flag_tag_fns(PropertySource);
+amglue_add_constant_short(PROPERTY_SOURCE_DEFAULT, "SOURCE_DEFAULT", PropertySource);
+amglue_add_constant_short(PROPERTY_SOURCE_DETECTED, "SOURCE_DETECTED", PropertySource);
+amglue_add_constant_short(PROPERTY_SOURCE_USER, "SOURCE_USER", PropertySource);
+amglue_copy_to_tag(PropertySource, constants);
 
 %perlcode %{
 
index a022c0f7985edcabb3ad4b7f383862bb699e65f4..6f884944a5e0527cffadc15771a3d2edc7c25690 100644 (file)
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.33
+ * Version 1.3.35
  * 
  * This file is not intended to be easily readable and contains a number of 
  * coding conventions designed to improve portability and efficiency. Do not make
 
 /* This should only be incremented when either the layout of swig_type_info changes,
    or for whatever reason, the runtime changes incompatibly */
-#define SWIG_RUNTIME_VERSION "3"
+#define SWIG_RUNTIME_VERSION "4"
 
 /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
 #ifdef SWIG_TYPE_TABLE
 
 /* Flags for pointer conversions */
 #define SWIG_POINTER_DISOWN        0x1
+#define SWIG_CAST_NEW_MEMORY       0x2
 
 /* Flags for new pointer objects */
 #define SWIG_POINTER_OWN           0x1
@@ -297,10 +298,10 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) {
 extern "C" {
 #endif
 
-typedef void *(*swig_converter_func)(void *);
+typedef void *(*swig_converter_func)(void *, int *);
 typedef struct swig_type_info *(*swig_dycast_func)(void **);
 
-/* Structure to store inforomation on one type */
+/* Structure to store information on one type */
 typedef struct swig_type_info {
   const char             *name;                        /* mangled name of this type */
   const char             *str;                 /* human readable name of this type */
@@ -427,8 +428,8 @@ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
   Cast a pointer up an inheritance hierarchy
 */
 SWIGRUNTIMEINLINE void *
-SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
-  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
 }
 
 /* 
@@ -1061,7 +1062,7 @@ SWIG_Perl_TypeProxyName(const swig_type_info *type) {
 
 SWIGRUNTIME swig_cast_info *
 SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
-  SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp((char*)iter->type->name, c) == 0)) 
+  SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp(iter->type->name, c) == 0)) 
                            || (iter->type->clientdata && (strcmp((char*)iter->type->clientdata, c) == 0))), ty);
 }
 
@@ -1119,7 +1120,11 @@ SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *
     if (!tc) {
       return SWIG_ERROR;
     }
-    *ptr = SWIG_TypeCast(tc,voidptr);
+    {
+      int newmemory = 0;
+      *ptr = SWIG_TypeCast(tc,voidptr,&newmemory);
+      assert(!newmemory); /* newmemory handling not yet implemented */
+    }
   } else {
     *ptr = voidptr;
   }
@@ -1294,7 +1299,7 @@ SWIG_Perl_GetModule(void) {
 
   /* first check if pointer already created */
   if (!type_pointer) {
-    pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE);
+    pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI);
     if (pointer && SvOK(pointer)) {
       type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
     }
@@ -1308,7 +1313,7 @@ SWIG_Perl_SetModule(swig_module_info *module) {
   SV *pointer;
 
   /* create a new pointer */
-  pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE);
+  pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI);
   sv_setiv(pointer, PTR2IV(module));
 }
 
@@ -1444,7 +1449,7 @@ static swig_module_info swig_module = {swig_types, 9, 0, 0, 0, 0};
 #define SWIG_name   "Amanda::Logfilec::boot_Amanda__Logfile"
 #define SWIG_prefix "Amanda::Logfilec::"
 
-#define SWIGVERSION 0x010333 
+#define SWIGVERSION 0x010335 
 #define SWIG_VERSION SWIGVERSION
 
 
@@ -1594,6 +1599,15 @@ SWIG_FromCharPtr(const char *cptr)
 }
 
 
+SWIGINTERNINLINE SV *
+SWIG_From_double  SWIG_PERL_DECL_ARGS_1(double value)
+{    
+  SV *obj = sv_newmortal();
+  sv_setnv(obj, value);
+  return obj;
+}
+
+
 find_result_t *search_logfile_wrap(char *label, char *datestamp, 
                                   char *logfile, int add_missing_disks) {
     find_result_t *rv = NULL;
@@ -2117,6 +2131,65 @@ XS(_wrap_find_result_t_partnum_get) {
 }
 
 
+XS(_wrap_find_result_t_sec_get) {
+  {
+    find_result_t *arg1 = (find_result_t *) 0 ;
+    double result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: find_result_t_sec_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_find_result_t, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "find_result_t_sec_get" "', argument " "1"" of type '" "find_result_t *""'"); 
+    }
+    arg1 = (find_result_t *)(argp1);
+    result = (double) ((arg1)->sec);
+    ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1((double)(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_find_result_t_kb_get) {
+  {
+    find_result_t *arg1 = (find_result_t *) 0 ;
+    size_t result;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: find_result_t_kb_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_find_result_t, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "find_result_t_kb_get" "', argument " "1"" of type '" "find_result_t *""'"); 
+    }
+    arg1 = (find_result_t *)(argp1);
+    result =  ((arg1)->kb);
+    {
+      ST(argvi) = sv_2mortal(amglue_newSVu64(result));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
 XS(_wrap_new_find_result_t) {
   {
     find_result_t *result = 0 ;
@@ -2126,7 +2199,7 @@ XS(_wrap_new_find_result_t) {
     if ((items < 0) || (items > 0)) {
       SWIG_croak("Usage: new_find_result_t();");
     }
-    result = (find_result_t *)(find_result_t *) calloc(1, sizeof(find_result_t));
+    result = (find_result_t *)calloc(1, sizeof(find_result_t));
     ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_find_result_t, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
     XSRETURN(argvi);
   fail:
@@ -2616,6 +2689,8 @@ static swig_command_info swig_commands[] = {
 {"Amanda::Logfilec::find_result_t_filenum_get", _wrap_find_result_t_filenum_get},
 {"Amanda::Logfilec::find_result_t_status_get", _wrap_find_result_t_status_get},
 {"Amanda::Logfilec::find_result_t_partnum_get", _wrap_find_result_t_partnum_get},
+{"Amanda::Logfilec::find_result_t_sec_get", _wrap_find_result_t_sec_get},
+{"Amanda::Logfilec::find_result_t_kb_get", _wrap_find_result_t_kb_get},
 {"Amanda::Logfilec::new_find_result_t", _wrap_new_find_result_t},
 {"Amanda::Logfilec::find_log", _wrap_find_log},
 {"Amanda::Logfilec::search_logfile", _wrap_search_logfile},
@@ -2680,7 +2755,7 @@ SWIGRUNTIME void
 SWIG_InitializeModule(void *clientdata) {
   size_t i;
   swig_module_info *module_head, *iter;
-  int found;
+  int found, init;
   
   clientdata = clientdata;
   
@@ -2690,6 +2765,9 @@ SWIG_InitializeModule(void *clientdata) {
     swig_module.type_initial = swig_type_initial;
     swig_module.cast_initial = swig_cast_initial;
     swig_module.next = &swig_module;
+    init = 1;
+  } else {
+    init = 0;
   }
   
   /* Try and load any already created modules */
@@ -2718,6 +2796,12 @@ SWIG_InitializeModule(void *clientdata) {
     module_head->next = &swig_module;
   }
   
+  /* When multiple interpeters are used, a module could have already been initialized in
+       a different interpreter, but not yet have a pointer in this interpreter.
+       In this case, we do not want to continue adding types... everything should be
+       set up already */
+  if (init == 0) return;
+  
   /* Now work on filling in swig_module.types */
 #ifdef SWIGRUNTIME_DEBUG
   printf("SWIG_InitializeModule: size %d\n", swig_module.size);
@@ -2871,7 +2955,7 @@ XS(SWIG_init) {
   /* Install variables */
   for (i = 0; swig_variables[i].name; i++) {
     SV *sv;
-    sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2);
+    sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI);
     if (swig_variables[i].type) {
       SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0);
     } else {
@@ -2883,7 +2967,7 @@ XS(SWIG_init) {
   /* Install constant */
   for (i = 0; swig_constants[i].type; i++) {
     SV *sv;
-    sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2);
+    sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI);
     switch(swig_constants[i].type) {
     case SWIG_INT:
       sv_setiv(sv, (IV) swig_constants[i].lvalue);
@@ -2906,148 +2990,148 @@ XS(SWIG_init) {
     SvREADONLY_on(sv);
   }
   
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "L_BOGUS", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "L_BOGUS", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(L_BOGUS)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "L_FATAL", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "L_FATAL", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(L_FATAL)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "L_ERROR", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "L_ERROR", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(L_ERROR)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "L_WARNING", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "L_WARNING", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(L_WARNING)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "L_INFO", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "L_INFO", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(L_INFO)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "L_SUMMARY", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "L_SUMMARY", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(L_SUMMARY)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "L_START", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "L_START", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(L_START)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "L_FINISH", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "L_FINISH", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(L_FINISH)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "L_DISK", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "L_DISK", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(L_DISK)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "L_DONE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "L_DONE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(L_DONE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "L_PART", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "L_PART", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(L_PART)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "L_PARTPARTIAL", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "L_PARTPARTIAL", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(L_PARTPARTIAL)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "L_SUCCESS", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "L_SUCCESS", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(L_SUCCESS)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "L_PARTIAL", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "L_PARTIAL", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(L_PARTIAL)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "L_FAIL", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "L_FAIL", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(L_FAIL)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "L_STRANGE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "L_STRANGE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(L_STRANGE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "L_CHUNK", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "L_CHUNK", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(L_CHUNK)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "L_CHUNKSUCCESS", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "L_CHUNKSUCCESS", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(L_CHUNKSUCCESS)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "L_STATS", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "L_STATS", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(L_STATS)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "L_MARKER", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "L_MARKER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(L_MARKER)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "L_CONT", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "L_CONT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(L_CONT)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "P_UNKNOWN", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "P_UNKNOWN", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(P_UNKNOWN)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "P_PLANNER", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "P_PLANNER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(P_PLANNER)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "P_DRIVER", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "P_DRIVER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(P_DRIVER)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "P_REPORTER", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "P_REPORTER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(P_REPORTER)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "P_DUMPER", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "P_DUMPER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(P_DUMPER)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "P_CHUNKER", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "P_CHUNKER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(P_CHUNKER)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "P_TAPER", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "P_TAPER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(P_TAPER)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "P_AMFLUSH", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "P_AMFLUSH", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(P_AMFLUSH)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
index 4bec9e9c52465eaa9efc958c79ba9b06b322ad41..282478f2bde33c562241ede707eccbae2ea6e3ca 100644 (file)
@@ -1,5 +1,5 @@
 # This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.33
+# Version 1.3.35
 #
 # Don't modify this file, modify the SWIG interface instead.
 
@@ -92,6 +92,10 @@ sub DESTROY {
 *swig_status_set = *Amanda::Logfilec::find_result_t_status_set;
 *swig_partnum_get = *Amanda::Logfilec::find_result_t_partnum_get;
 *swig_partnum_set = *Amanda::Logfilec::find_result_t_partnum_set;
+*swig_sec_get = *Amanda::Logfilec::find_result_t_sec_get;
+*swig_sec_set = *Amanda::Logfilec::find_result_t_sec_set;
+*swig_kb_get = *Amanda::Logfilec::find_result_t_kb_get;
+*swig_kb_set = *Amanda::Logfilec::find_result_t_kb_set;
 sub new {
     my $pkg = shift;
     my $self = Amanda::Logfilec::new_find_result_t(@_);
@@ -154,7 +158,7 @@ Amanda::Logfile - manage Amanda trace logs
 
 =head1 SYNOPSIS
 
-  use Amanda::Logfile qw(:logtype_t); # XXX change
+  use Amanda::Logfile qw(:logtype_t);
   use Amanda::Config qw( :getconf config_dir_relative );
 
   for my $logfile (Amanda::Logfile::find_log()) {
@@ -169,7 +173,7 @@ Amanda::Logfile - manage Amanda trace logs
     }
     Amanda::Logfile::close_logfile($log);
 
-    my @dumps = Amanda::Logfile::search_logfile("TapeLabel-001", "19780615", $logfile);
+    my @dumps = Amanda::Logfile::search_logfile("TapeLabel-001", "19780615", $logfile, 1);
 
     my @matching = Amanda::Logfile::dumps_match([@dumps], "myhost", "/usr", undef, undef, 0);
     for my $dump (@matching) {
@@ -224,24 +228,33 @@ Instance variables are:
 
 =over
 
-=item C<$timestamp>
+=item C<timestamp>
 
-=item C<$hostname>
+=item C<hostname>
 
-=item C<$diskname>
+=item C<diskname>
 
-=item C<$level>
+=item C<level>
 
-=item C<$label>
+=item C<label>
 
-=item C<$filenum>
+=item C<filenum>
 
-=item C<$status>
+=item C<status>
 
-=item C<$partnum>
+=item C<partnum>
+
+=item C<sec>
+
+=item C<kb>
 
 =back
 
+Note that the format for these variables are based on that found in the
+logfiles.  In particular, C<partnum> is a string, usually with a slash (C</>)
+in it.  Also, C<timestamp> is the timestamp for the run in which the client
+dump took place, and not for the timestamp of the logfile.
+
 =head1 HIGHER-LEVEL FUNCTIONS
 
 Functions in this section extract information from logfiles.
@@ -251,8 +264,7 @@ Functions in this section extract information from logfiles.
 =item C<find_log()>
 
 Return a list of logfiles for active tapes.  The tapelist must be loaded before
-this function is called (see L<Amanda::Tapefile>, and note that this module will be
-renamed to L<Amanda::Tapelist> in Amanda-2.6.1).
+this function is called (see L<Amanda::Tapelist>).
 
 =item C<search_logfile($label, $datestamp, $logfile, $add_missing_disks)>
 
index cab431a0773637bae288395fdd1dd82f2a44f911..a7adac64a32af0925b99edd378afba63515de4ef 100644 (file)
@@ -14,8 +14,8 @@
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  *
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 %module "Amanda::Logfile"
@@ -38,7 +38,7 @@ Amanda::Logfile - manage Amanda trace logs
 
 =head1 SYNOPSIS
 
-  use Amanda::Logfile qw(:logtype_t); # XXX change
+  use Amanda::Logfile qw(:logtype_t);
   use Amanda::Config qw( :getconf config_dir_relative );
 
   for my $logfile (Amanda::Logfile::find_log()) {
@@ -53,7 +53,7 @@ Amanda::Logfile - manage Amanda trace logs
     }
     Amanda::Logfile::close_logfile($log);
 
-    my @dumps = Amanda::Logfile::search_logfile("TapeLabel-001", "19780615", $logfile);
+    my @dumps = Amanda::Logfile::search_logfile("TapeLabel-001", "19780615", $logfile, 1);
 
     my @matching = Amanda::Logfile::dumps_match([@dumps], "myhost", "/usr", undef, undef, 0);
     for my $dump (@matching) {
@@ -108,24 +108,33 @@ Instance variables are:
 
 =over
 
-=item C<$timestamp>
+=item C<timestamp>
 
-=item C<$hostname>
+=item C<hostname>
 
-=item C<$diskname>
+=item C<diskname>
 
-=item C<$level>
+=item C<level>
 
-=item C<$label>
+=item C<label>
 
-=item C<$filenum>
+=item C<filenum>
 
-=item C<$status>
+=item C<status>
 
-=item C<$partnum>
+=item C<partnum>
+
+=item C<sec>
+
+=item C<kb>
 
 =back
 
+Note that the format for these variables are based on that found in the
+logfiles.  In particular, C<partnum> is a string, usually with a slash (C</>)
+in it.  Also, C<timestamp> is the timestamp for the run in which the client
+dump took place, and not for the timestamp of the logfile.
+
 =head1 HIGHER-LEVEL FUNCTIONS
 
 Functions in this section extract information from logfiles.
@@ -135,8 +144,7 @@ Functions in this section extract information from logfiles.
 =item C<find_log()>
 
 Return a list of logfiles for active tapes.  The tapelist must be loaded before
-this function is called (see L<Amanda::Tapefile>, and note that this module will be
-renamed to L<Amanda::Tapelist> in Amanda-2.6.1).
+this function is called (see L<Amanda::Tapelist>).
 
 =item C<search_logfile($label, $datestamp, $logfile, $add_missing_disks)>
 
@@ -250,6 +258,8 @@ typedef struct {
     off_t filenum;
     char *status;
     char *partnum;
+    double sec;
+    size_t kb;
     %mutable;
 } find_result_t;
 
diff --git a/perl/Amanda/MainLoop.c b/perl/Amanda/MainLoop.c
new file mode 100644 (file)
index 0000000..0d15fa6
--- /dev/null
@@ -0,0 +1,2560 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ * 
+ * This file is not intended to be easily readable and contains a number of 
+ * coding conventions designed to improve portability and efficiency. Do not make
+ * changes to this file unless you know what you are doing--modify the SWIG 
+ * interface file instead. 
+ * ----------------------------------------------------------------------------- */
+
+#define SWIGPERL
+#define SWIG_CASTRANK_MODE
+/* -----------------------------------------------------------------------------
+ *  This section contains generic SWIG labels for method/variable
+ *  declarations/attributes, and other compiler dependent labels.
+ * ----------------------------------------------------------------------------- */
+
+/* template workaround for compilers that cannot correctly implement the C++ standard */
+#ifndef SWIGTEMPLATEDISAMBIGUATOR
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# elif defined(__HP_aCC)
+/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
+/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# else
+#  define SWIGTEMPLATEDISAMBIGUATOR
+# endif
+#endif
+
+/* inline attribute */
+#ifndef SWIGINLINE
+# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
+#   define SWIGINLINE inline
+# else
+#   define SWIGINLINE
+# endif
+#endif
+
+/* attribute recognised by some compilers to avoid 'unused' warnings */
+#ifndef SWIGUNUSED
+# if defined(__GNUC__)
+#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#     define SWIGUNUSED __attribute__ ((__unused__)) 
+#   else
+#     define SWIGUNUSED
+#   endif
+# elif defined(__ICC)
+#   define SWIGUNUSED __attribute__ ((__unused__)) 
+# else
+#   define SWIGUNUSED 
+# endif
+#endif
+
+#ifndef SWIGUNUSEDPARM
+# ifdef __cplusplus
+#   define SWIGUNUSEDPARM(p)
+# else
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
+# endif
+#endif
+
+/* internal SWIG method */
+#ifndef SWIGINTERN
+# define SWIGINTERN static SWIGUNUSED
+#endif
+
+/* internal inline SWIG method */
+#ifndef SWIGINTERNINLINE
+# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
+#endif
+
+/* exporting methods */
+#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#  ifndef GCC_HASCLASSVISIBILITY
+#    define GCC_HASCLASSVISIBILITY
+#  endif
+#endif
+
+#ifndef SWIGEXPORT
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   if defined(STATIC_LINKED)
+#     define SWIGEXPORT
+#   else
+#     define SWIGEXPORT __declspec(dllexport)
+#   endif
+# else
+#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
+#     define SWIGEXPORT __attribute__ ((visibility("default")))
+#   else
+#     define SWIGEXPORT
+#   endif
+# endif
+#endif
+
+/* calling conventions for Windows */
+#ifndef SWIGSTDCALL
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   define SWIGSTDCALL __stdcall
+# else
+#   define SWIGSTDCALL
+# endif 
+#endif
+
+/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
+#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
+# define _SCL_SECURE_NO_DEPRECATE
+#endif
+
+
+/* -----------------------------------------------------------------------------
+ * swigrun.swg
+ *
+ * This file contains generic CAPI SWIG runtime support for pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+/* This should only be incremented when either the layout of swig_type_info changes,
+   or for whatever reason, the runtime changes incompatibly */
+#define SWIG_RUNTIME_VERSION "4"
+
+/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
+#ifdef SWIG_TYPE_TABLE
+# define SWIG_QUOTE_STRING(x) #x
+# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
+# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
+#else
+# define SWIG_TYPE_TABLE_NAME
+#endif
+
+/*
+  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
+  creating a static or dynamic library from the swig runtime code.
+  In 99.9% of the cases, swig just needs to declare them as 'static'.
+  
+  But only do this if is strictly necessary, ie, if you have problems
+  with your compiler or so.
+*/
+
+#ifndef SWIGRUNTIME
+# define SWIGRUNTIME SWIGINTERN
+#endif
+
+#ifndef SWIGRUNTIMEINLINE
+# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
+#endif
+
+/*  Generic buffer size */
+#ifndef SWIG_BUFFER_SIZE
+# define SWIG_BUFFER_SIZE 1024
+#endif
+
+/* Flags for pointer conversions */
+#define SWIG_POINTER_DISOWN        0x1
+#define SWIG_CAST_NEW_MEMORY       0x2
+
+/* Flags for new pointer objects */
+#define SWIG_POINTER_OWN           0x1
+
+
+/* 
+   Flags/methods for returning states.
+   
+   The swig conversion methods, as ConvertPtr, return and integer 
+   that tells if the conversion was successful or not. And if not,
+   an error code can be returned (see swigerrors.swg for the codes).
+   
+   Use the following macros/flags to set or process the returning
+   states.
+   
+   In old swig versions, you usually write code as:
+
+     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
+       // success code
+     } else {
+       //fail code
+     }
+
+   Now you can be more explicit as:
+
+    int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+    } else {
+      // fail code
+    }
+
+   that seems to be the same, but now you can also do
+
+    Type *ptr;
+    int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+      if (SWIG_IsNewObj(res) {
+        ...
+       delete *ptr;
+      } else {
+        ...
+      }
+    } else {
+      // fail code
+    }
+    
+   I.e., now SWIG_ConvertPtr can return new objects and you can
+   identify the case and take care of the deallocation. Of course that
+   requires also to SWIG_ConvertPtr to return new result values, as
+
+      int SWIG_ConvertPtr(obj, ptr,...) {         
+        if (<obj is ok>) {                            
+          if (<need new object>) {                    
+            *ptr = <ptr to new allocated object>; 
+            return SWIG_NEWOBJ;                       
+          } else {                                    
+            *ptr = <ptr to old object>;               
+            return SWIG_OLDOBJ;                       
+          }                                   
+        } else {                                      
+          return SWIG_BADOBJ;                 
+        }                                             
+      }
+
+   Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
+   more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
+   swig errors code.
+
+   Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
+   allows to return the 'cast rank', for example, if you have this
+
+       int food(double)
+       int fooi(int);
+
+   and you call
+      food(1)   // cast rank '1'  (1 -> 1.0)
+      fooi(1)   // cast rank '0'
+
+   just use the SWIG_AddCast()/SWIG_CheckState()
+
+
+ */
+#define SWIG_OK                    (0) 
+#define SWIG_ERROR                 (-1)
+#define SWIG_IsOK(r)               (r >= 0)
+#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)  
+
+/* The CastRankLimit says how many bits are used for the cast rank */
+#define SWIG_CASTRANKLIMIT         (1 << 8)
+/* The NewMask denotes the object was created (using new/malloc) */
+#define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
+/* The TmpMask is for in/out typemaps that use temporal objects */
+#define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
+/* Simple returning values */
+#define SWIG_BADOBJ                (SWIG_ERROR)
+#define SWIG_OLDOBJ                (SWIG_OK)
+#define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
+#define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
+/* Check, add and del mask methods */
+#define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
+#define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
+#define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
+#define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
+#define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
+#define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
+
+
+/* Cast-Rank Mode */
+#if defined(SWIG_CASTRANK_MODE)
+#  ifndef SWIG_TypeRank
+#    define SWIG_TypeRank             unsigned long
+#  endif
+#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
+#    define SWIG_MAXCASTRANK          (2)
+#  endif
+#  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
+#  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
+SWIGINTERNINLINE int SWIG_AddCast(int r) { 
+  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
+}
+SWIGINTERNINLINE int SWIG_CheckState(int r) { 
+  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
+}
+#else /* no cast-rank mode */
+#  define SWIG_AddCast
+#  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
+#endif
+
+
+
+
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void *(*swig_converter_func)(void *, int *);
+typedef struct swig_type_info *(*swig_dycast_func)(void **);
+
+/* Structure to store information on one type */
+typedef struct swig_type_info {
+  const char             *name;                        /* mangled name of this type */
+  const char             *str;                 /* human readable name of this type */
+  swig_dycast_func        dcast;               /* dynamic cast function down a hierarchy */
+  struct swig_cast_info  *cast;                        /* linked list of types that can cast into this type */
+  void                   *clientdata;          /* language specific type data */
+  int                    owndata;              /* flag if the structure owns the clientdata */
+} swig_type_info;
+
+/* Structure to store a type and conversion function used for casting */
+typedef struct swig_cast_info {
+  swig_type_info         *type;                        /* pointer to type that is equivalent to this type */
+  swig_converter_func     converter;           /* function to cast the void pointers */
+  struct swig_cast_info  *next;                        /* pointer to next cast in linked list */
+  struct swig_cast_info  *prev;                        /* pointer to the previous cast */
+} swig_cast_info;
+
+/* Structure used to store module information
+ * Each module generates one structure like this, and the runtime collects
+ * all of these structures and stores them in a circularly linked list.*/
+typedef struct swig_module_info {
+  swig_type_info         **types;              /* Array of pointers to swig_type_info structures that are in this module */
+  size_t                 size;                 /* Number of types in this module */
+  struct swig_module_info *next;               /* Pointer to next element in circularly linked list */
+  swig_type_info         **type_initial;       /* Array of initially generated type structures */
+  swig_cast_info         **cast_initial;       /* Array of initially generated casting structures */
+  void                    *clientdata;         /* Language specific module data */
+} swig_module_info;
+
+/* 
+  Compare two type names skipping the space characters, therefore
+  "char*" == "char *" and "Class<int>" == "Class<int >", etc.
+
+  Return 0 when the two name types are equivalent, as in
+  strncmp, but skipping ' '.
+*/
+SWIGRUNTIME int
+SWIG_TypeNameComp(const char *f1, const char *l1,
+                 const char *f2, const char *l2) {
+  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
+    while ((*f1 == ' ') && (f1 != l1)) ++f1;
+    while ((*f2 == ' ') && (f2 != l2)) ++f2;
+    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
+  }
+  return (int)((l1 - f1) - (l2 - f2));
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if not equal, 1 if equal
+*/
+SWIGRUNTIME int
+SWIG_TypeEquiv(const char *nb, const char *tb) {
+  int equiv = 0;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (!equiv && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
+*/
+SWIGRUNTIME int
+SWIG_TypeCompare(const char *nb, const char *tb) {
+  int equiv = 0;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (!equiv && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
+
+
+/* think of this as a c++ template<> or a scheme macro */
+#define SWIG_TypeCheck_Template(comparison, ty)         \
+  if (ty) {                                             \
+    swig_cast_info *iter = ty->cast;                    \
+    while (iter) {                                      \
+      if (comparison) {                                 \
+        if (iter == ty->cast) return iter;              \
+        /* Move iter to the top of the linked list */   \
+        iter->prev->next = iter->next;                  \
+        if (iter->next)                                 \
+          iter->next->prev = iter->prev;                \
+        iter->next = ty->cast;                          \
+        iter->prev = 0;                                 \
+        if (ty->cast) ty->cast->prev = iter;            \
+        ty->cast = iter;                                \
+        return iter;                                    \
+      }                                                 \
+      iter = iter->next;                                \
+    }                                                   \
+  }                                                     \
+  return 0
+
+/*
+  Check the typename
+*/
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheck(const char *c, swig_type_info *ty) {
+  SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
+}
+
+/* Same as previous function, except strcmp is replaced with a pointer comparison */
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
+  SWIG_TypeCheck_Template(iter->type == from, into);
+}
+
+/*
+  Cast a pointer up an inheritance hierarchy
+*/
+SWIGRUNTIMEINLINE void *
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
+}
+
+/* 
+   Dynamic pointer casting. Down an inheritance hierarchy
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
+  swig_type_info *lastty = ty;
+  if (!ty || !ty->dcast) return ty;
+  while (ty && (ty->dcast)) {
+    ty = (*ty->dcast)(ptr);
+    if (ty) lastty = ty;
+  }
+  return lastty;
+}
+
+/*
+  Return the name associated with this type
+*/
+SWIGRUNTIMEINLINE const char *
+SWIG_TypeName(const swig_type_info *ty) {
+  return ty->name;
+}
+
+/*
+  Return the pretty name associated with this type,
+  that is an unmangled type name in a form presentable to the user.
+*/
+SWIGRUNTIME const char *
+SWIG_TypePrettyName(const swig_type_info *type) {
+  /* The "str" field contains the equivalent pretty names of the
+     type, separated by vertical-bar characters.  We choose
+     to print the last name, as it is often (?) the most
+     specific. */
+  if (!type) return NULL;
+  if (type->str != NULL) {
+    const char *last_name = type->str;
+    const char *s;
+    for (s = type->str; *s; s++)
+      if (*s == '|') last_name = s+1;
+    return last_name;
+  }
+  else
+    return type->name;
+}
+
+/* 
+   Set the clientdata field for a type
+*/
+SWIGRUNTIME void
+SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
+  swig_cast_info *cast = ti->cast;
+  /* if (ti->clientdata == clientdata) return; */
+  ti->clientdata = clientdata;
+  
+  while (cast) {
+    if (!cast->converter) {
+      swig_type_info *tc = cast->type;
+      if (!tc->clientdata) {
+       SWIG_TypeClientData(tc, clientdata);
+      }
+    }    
+    cast = cast->next;
+  }
+}
+SWIGRUNTIME void
+SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
+  SWIG_TypeClientData(ti, clientdata);
+  ti->owndata = 1;
+}
+  
+/*
+  Search for a swig_type_info structure only by mangled name
+  Search is a O(log #types)
+  
+  We start searching at module start, and finish searching when start == end.  
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_MangledTypeQueryModule(swig_module_info *start, 
+                            swig_module_info *end, 
+                           const char *name) {
+  swig_module_info *iter = start;
+  do {
+    if (iter->size) {
+      register size_t l = 0;
+      register size_t r = iter->size - 1;
+      do {
+       /* since l+r >= 0, we can (>> 1) instead (/ 2) */
+       register size_t i = (l + r) >> 1; 
+       const char *iname = iter->types[i]->name;
+       if (iname) {
+         register int compare = strcmp(name, iname);
+         if (compare == 0) {       
+           return iter->types[i];
+         } else if (compare < 0) {
+           if (i) {
+             r = i - 1;
+           } else {
+             break;
+           }
+         } else if (compare > 0) {
+           l = i + 1;
+         }
+       } else {
+         break; /* should never happen */
+       }
+      } while (l <= r);
+    }
+    iter = iter->next;
+  } while (iter != end);
+  return 0;
+}
+
+/*
+  Search for a swig_type_info structure for either a mangled name or a human readable name.
+  It first searches the mangled names of the types, which is a O(log #types)
+  If a type is not found it then searches the human readable names, which is O(#types).
+  
+  We start searching at module start, and finish searching when start == end.  
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeQueryModule(swig_module_info *start, 
+                     swig_module_info *end, 
+                    const char *name) {
+  /* STEP 1: Search the name field using binary search */
+  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
+  if (ret) {
+    return ret;
+  } else {
+    /* STEP 2: If the type hasn't been found, do a complete search
+       of the str field (the human readable name) */
+    swig_module_info *iter = start;
+    do {
+      register size_t i = 0;
+      for (; i < iter->size; ++i) {
+       if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
+         return iter->types[i];
+      }
+      iter = iter->next;
+    } while (iter != end);
+  }
+  
+  /* neither found a match */
+  return 0;
+}
+
+/* 
+   Pack binary data into a string
+*/
+SWIGRUNTIME char *
+SWIG_PackData(char *c, void *ptr, size_t sz) {
+  static const char hex[17] = "0123456789abcdef";
+  register const unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu =  u + sz;
+  for (; u != eu; ++u) {
+    register unsigned char uu = *u;
+    *(c++) = hex[(uu & 0xf0) >> 4];
+    *(c++) = hex[uu & 0xf];
+  }
+  return c;
+}
+
+/* 
+   Unpack binary data from a string
+*/
+SWIGRUNTIME const char *
+SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
+  register unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu = u + sz;
+  for (; u != eu; ++u) {
+    register char d = *(c++);
+    register unsigned char uu;
+    if ((d >= '0') && (d <= '9'))
+      uu = ((d - '0') << 4);
+    else if ((d >= 'a') && (d <= 'f'))
+      uu = ((d - ('a'-10)) << 4);
+    else 
+      return (char *) 0;
+    d = *(c++);
+    if ((d >= '0') && (d <= '9'))
+      uu |= (d - '0');
+    else if ((d >= 'a') && (d <= 'f'))
+      uu |= (d - ('a'-10));
+    else 
+      return (char *) 0;
+    *u = uu;
+  }
+  return c;
+}
+
+/* 
+   Pack 'void *' into a string buffer.
+*/
+SWIGRUNTIME char *
+SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
+  char *r = buff;
+  if ((2*sizeof(void *) + 2) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,&ptr,sizeof(void *));
+  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
+  strcpy(r,name);
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      *ptr = (void *) 0;
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sizeof(void *));
+}
+
+SWIGRUNTIME char *
+SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
+  char *r = buff;
+  size_t lname = (name ? strlen(name) : 0);
+  if ((2*sz + 2 + lname) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  if (lname) {
+    strncpy(r,name,lname+1);
+  } else {
+    *r = 0;
+  }
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      memset(ptr,0,sz);
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sz);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/*  Errors in SWIG */
+#define  SWIG_UnknownError        -1 
+#define  SWIG_IOError             -2 
+#define  SWIG_RuntimeError        -3 
+#define  SWIG_IndexError          -4 
+#define  SWIG_TypeError           -5 
+#define  SWIG_DivisionByZero      -6 
+#define  SWIG_OverflowError       -7 
+#define  SWIG_SyntaxError         -8 
+#define  SWIG_ValueError          -9 
+#define  SWIG_SystemError         -10
+#define  SWIG_AttributeError      -11
+#define  SWIG_MemoryError         -12 
+#define  SWIG_NullReferenceError   -13
+
+
+
+#ifdef __cplusplus
+/* Needed on some windows machines---since MS plays funny games with the header files under C++ */
+#include <math.h>
+#include <stdlib.h>
+extern "C" {
+#endif
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+/* Add in functionality missing in older versions of Perl. Much of this is based on Devel-PPPort on cpan. */
+
+/* Add PERL_REVISION, PERL_VERSION, PERL_SUBVERSION if missing */
+#ifndef PERL_REVISION
+#  if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION))
+#    define PERL_PATCHLEVEL_H_IMPLICIT
+#    include <patchlevel.h>
+#  endif
+#  if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL)))
+#    include <could_not_find_Perl_patchlevel.h>
+#  endif
+#  ifndef PERL_REVISION
+#    define PERL_REVISION       (5)
+#    define PERL_VERSION        PATCHLEVEL
+#    define PERL_SUBVERSION     SUBVERSION
+#  endif
+#endif
+
+#if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE)
+#define PerlIO_exportFILE(fh,fl) (FILE*)(fh)
+#endif
+
+#ifndef SvIOK_UV
+# define SvIOK_UV(sv)       (SvIOK(sv) && (SvUVX(sv) == SvIVX(sv)))
+#endif
+
+#ifndef SvUOK
+# define SvUOK(sv)           SvIOK_UV(sv)
+#endif
+
+#if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5)))
+#  define PL_sv_undef               sv_undef
+#  define PL_na                            na
+#  define PL_errgv                  errgv
+#  define PL_sv_no                  sv_no
+#  define PL_sv_yes                 sv_yes
+#  define PL_markstack_ptr          markstack_ptr
+#endif
+
+#ifndef IVSIZE
+#  ifdef LONGSIZE
+#    define IVSIZE LONGSIZE
+#  else
+#    define IVSIZE 4 /* A bold guess, but the best we can make. */
+#  endif
+#endif
+
+#ifndef INT2PTR
+#  if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)
+#    define PTRV                  UV
+#    define INT2PTR(any,d)        (any)(d)
+#  else
+#    if PTRSIZE == LONGSIZE
+#      define PTRV                unsigned long
+#    else
+#      define PTRV                unsigned
+#    endif
+#    define INT2PTR(any,d)        (any)(PTRV)(d)
+#  endif
+
+#  define NUM2PTR(any,d)  (any)(PTRV)(d)
+#  define PTR2IV(p)       INT2PTR(IV,p)
+#  define PTR2UV(p)       INT2PTR(UV,p)
+#  define PTR2NV(p)       NUM2PTR(NV,p)
+
+#  if PTRSIZE == LONGSIZE
+#    define PTR2ul(p)     (unsigned long)(p)
+#  else
+#    define PTR2ul(p)     INT2PTR(unsigned long,p)
+#  endif
+#endif /* !INT2PTR */
+
+#ifndef SvPV_nolen
+# define SvPV_nolen(x) SvPV(x,PL_na)
+#endif
+
+#ifndef get_sv
+#  define get_sv perl_get_sv
+#endif
+
+#ifndef ERRSV
+#  define ERRSV get_sv("@",FALSE)
+#endif
+
+#ifndef pTHX_
+#define pTHX_
+#endif   
+
+#include <string.h>
+#ifdef __cplusplus
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ * error manipulation
+ * ----------------------------------------------------------------------------- */
+
+SWIGINTERN const char*
+SWIG_Perl_ErrorType(int code) {
+  const char* type = 0;
+  switch(code) {
+  case SWIG_MemoryError:
+    type = "MemoryError";
+    break;
+  case SWIG_IOError:
+    type = "IOError";
+    break;
+  case SWIG_RuntimeError:
+    type = "RuntimeError";
+    break;
+  case SWIG_IndexError:
+    type = "IndexError";
+    break;
+  case SWIG_TypeError:
+    type = "TypeError";
+    break;
+  case SWIG_DivisionByZero:
+    type = "ZeroDivisionError";
+    break;
+  case SWIG_OverflowError:
+    type = "OverflowError";
+    break;
+  case SWIG_SyntaxError:
+    type = "SyntaxError";
+    break;
+  case SWIG_ValueError:
+    type = "ValueError";
+    break;
+  case SWIG_SystemError:
+    type = "SystemError";
+    break;
+  case SWIG_AttributeError:
+    type = "AttributeError";
+    break;
+  default:
+    type = "RuntimeError";
+  }
+  return type;
+}
+
+
+
+
+/* -----------------------------------------------------------------------------
+ * perlrun.swg
+ *
+ * This file contains the runtime support for Perl modules
+ * and includes code for managing global variables and pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef PERL_OBJECT
+#define SWIG_PERL_OBJECT_DECL CPerlObj *SWIGUNUSEDPARM(pPerl),
+#define SWIG_PERL_OBJECT_CALL pPerl,
+#else
+#define SWIG_PERL_OBJECT_DECL
+#define SWIG_PERL_OBJECT_CALL
+#endif
+
+/* Common SWIG API */
+
+/* for raw pointers */
+#define SWIG_ConvertPtr(obj, pp, type, flags)           SWIG_Perl_ConvertPtr(SWIG_PERL_OBJECT_CALL obj, pp, type, flags)
+#define SWIG_NewPointerObj(p, type, flags)              SWIG_Perl_NewPointerObj(SWIG_PERL_OBJECT_CALL p, type, flags)
+
+/* for raw packed data */
+#define SWIG_ConvertPacked(obj, p, s, type)             SWIG_Perl_ConvertPacked(SWIG_PERL_OBJECT_CALL obj, p, s, type)
+#define SWIG_NewPackedObj(p, s, type)                  SWIG_Perl_NewPackedObj(SWIG_PERL_OBJECT_CALL p, s, type)
+
+/* for class or struct pointers */
+#define SWIG_ConvertInstance(obj, pptr, type, flags)    SWIG_ConvertPtr(obj, pptr, type, flags)
+#define SWIG_NewInstanceObj(ptr, type, flags)           SWIG_NewPointerObj(ptr, type, flags)
+
+/* for C or C++ function pointers */
+#define SWIG_ConvertFunctionPtr(obj, pptr, type)        SWIG_ConvertPtr(obj, pptr, type, 0)
+#define SWIG_NewFunctionPtrObj(ptr, type)               SWIG_NewPointerObj(ptr, type, 0)
+
+/* for C++ member pointers, ie, member methods */
+#define SWIG_ConvertMember(obj, ptr, sz, ty)            SWIG_ConvertPacked(obj, ptr, sz, ty)
+#define SWIG_NewMemberObj(ptr, sz, type)                SWIG_NewPackedObj(ptr, sz, type)
+
+
+/* Runtime API */
+
+#define SWIG_GetModule(clientdata)                      SWIG_Perl_GetModule()
+#define SWIG_SetModule(clientdata, pointer)             SWIG_Perl_SetModule(pointer)
+
+
+/* Error manipulation */
+
+#define SWIG_ErrorType(code)                            SWIG_Perl_ErrorType(code)               
+#define SWIG_Error(code, msg)                          sv_setpvf(GvSV(PL_errgv),"%s %s\n", SWIG_ErrorType(code), msg)
+#define SWIG_fail                                      goto fail                                                   
+
+/* Perl-specific SWIG API */
+
+#define SWIG_MakePtr(sv, ptr, type, flags)              SWIG_Perl_MakePtr(SWIG_PERL_OBJECT_CALL sv, ptr, type, flags)
+#define SWIG_MakePackedObj(sv, p, s, type)             SWIG_Perl_MakePackedObj(SWIG_PERL_OBJECT_CALL sv, p, s, type)
+#define SWIG_SetError(str)                              SWIG_Error(SWIG_RuntimeError, str)
+
+
+#define SWIG_PERL_DECL_ARGS_1(arg1)                     (SWIG_PERL_OBJECT_DECL arg1)
+#define SWIG_PERL_CALL_ARGS_1(arg1)                     (SWIG_PERL_OBJECT_CALL arg1)
+#define SWIG_PERL_DECL_ARGS_2(arg1, arg2)               (SWIG_PERL_OBJECT_DECL arg1, arg2)
+#define SWIG_PERL_CALL_ARGS_2(arg1, arg2)               (SWIG_PERL_OBJECT_CALL arg1, arg2)
+
+/* -----------------------------------------------------------------------------
+ * pointers/data manipulation
+ * ----------------------------------------------------------------------------- */
+
+/* For backward compatibility only */
+#define SWIG_POINTER_EXCEPTION  0
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SWIG_OWNER   SWIG_POINTER_OWN
+#define SWIG_SHADOW  SWIG_OWNER << 1
+
+#define SWIG_MAYBE_PERL_OBJECT SWIG_PERL_OBJECT_DECL
+
+/* SWIG Perl macros */
+
+/* Macro to declare an XS function */
+#ifndef XSPROTO
+#   define XSPROTO(name) void name(pTHX_ CV* cv)
+#endif
+
+/* Macro to call an XS function */
+#ifdef PERL_OBJECT 
+#  define SWIG_CALLXS(_name) _name(cv,pPerl) 
+#else 
+#  ifndef MULTIPLICITY 
+#    define SWIG_CALLXS(_name) _name(cv) 
+#  else 
+#    define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv) 
+#  endif 
+#endif 
+
+#ifdef PERL_OBJECT
+#define MAGIC_PPERL  CPerlObj *pPerl = (CPerlObj *) this;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
+#define SWIGCLASS_STATIC
+
+#else /* PERL_OBJECT */
+
+#define MAGIC_PPERL
+#define SWIGCLASS_STATIC static SWIGUNUSED
+
+#ifndef MULTIPLICITY
+#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (*SwigMagicFunc)(SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#else /* MULTIPLICITY */
+
+#define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MULTIPLICITY */
+#endif /* PERL_OBJECT */
+
+/* Workaround for bug in perl 5.6.x croak and earlier */
+#if (PERL_VERSION < 8)
+#  ifdef PERL_OBJECT
+#    define SWIG_croak_null() SWIG_Perl_croak_null(pPerl)
+static void SWIG_Perl_croak_null(CPerlObj *pPerl)
+#  else
+static void SWIG_croak_null()
+#  endif
+{
+  SV *err=ERRSV;
+#  if (PERL_VERSION < 6)
+  croak("%_", err);
+#  else
+  if (SvOK(err) && !SvROK(err)) croak("%_", err);
+  croak(Nullch);
+#  endif
+}
+#else
+#  define SWIG_croak_null() croak(Nullch)
+#endif
+
+
+/* 
+   Define how strict is the cast between strings and integers/doubles
+   when overloading between these types occurs.
+   
+   The default is making it as strict as possible by using SWIG_AddCast
+   when needed.
+   
+   You can use -DSWIG_PERL_NO_STRICT_STR2NUM at compilation time to
+   disable the SWIG_AddCast, making the casting between string and
+   numbers less strict.
+
+   In the end, we try to solve the overloading between strings and
+   numerical types in the more natural way, but if you can avoid it,
+   well, avoid it using %rename, for example.
+*/
+#ifndef SWIG_PERL_NO_STRICT_STR2NUM
+# ifndef SWIG_PERL_STRICT_STR2NUM
+#  define SWIG_PERL_STRICT_STR2NUM
+# endif
+#endif
+#ifdef SWIG_PERL_STRICT_STR2NUM
+/* string takes precedence */
+#define SWIG_Str2NumCast(x) SWIG_AddCast(x)  
+#else
+/* number takes precedence */
+#define SWIG_Str2NumCast(x) x
+#endif
+
+
+
+#include <stdlib.h>
+
+SWIGRUNTIME const char *
+SWIG_Perl_TypeProxyName(const swig_type_info *type) {
+  if (!type) return NULL;
+  if (type->clientdata != NULL) {
+    return (const char*) type->clientdata;
+  } 
+  else {
+    return type->name;
+  }
+}
+
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
+  SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp(iter->type->name, c) == 0)) 
+                           || (iter->type->clientdata && (strcmp((char*)iter->type->clientdata, c) == 0))), ty);
+}
+
+
+/* Function for getting a pointer value */
+
+SWIGRUNTIME int
+SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags) {
+  swig_cast_info *tc;
+  void *voidptr = (void *)0;
+  SV *tsv = 0;
+  /* If magical, apply more magic */
+  if (SvGMAGICAL(sv))
+    mg_get(sv);
+
+  /* Check to see if this is an object */
+  if (sv_isobject(sv)) {
+    IV tmp = 0;
+    tsv = (SV*) SvRV(sv);
+    if ((SvTYPE(tsv) == SVt_PVHV)) {
+      MAGIC *mg;
+      if (SvMAGICAL(tsv)) {
+        mg = mg_find(tsv,'P');
+        if (mg) {
+          sv = mg->mg_obj;
+          if (sv_isobject(sv)) {
+           tsv = (SV*)SvRV(sv);
+            tmp = SvIV(tsv);
+          }
+        }
+      } else {
+        return SWIG_ERROR;
+      }
+    } else {
+      tmp = SvIV(tsv);
+    }
+    voidptr = INT2PTR(void *,tmp);
+  } else if (! SvOK(sv)) {            /* Check for undef */
+    *(ptr) = (void *) 0;
+    return SWIG_OK;
+  } else if (SvTYPE(sv) == SVt_RV) {  /* Check for NULL pointer */
+    if (!SvROK(sv)) {
+      *(ptr) = (void *) 0;
+      return SWIG_OK;
+    } else {
+      return SWIG_ERROR;
+    }
+  } else {                            /* Don't know what it is */
+    return SWIG_ERROR;
+  }
+  if (_t) {
+    /* Now see if the types match */
+    char *_c = HvNAME(SvSTASH(SvRV(sv)));
+    tc = SWIG_TypeProxyCheck(_c,_t);
+    if (!tc) {
+      return SWIG_ERROR;
+    }
+    {
+      int newmemory = 0;
+      *ptr = SWIG_TypeCast(tc,voidptr,&newmemory);
+      assert(!newmemory); /* newmemory handling not yet implemented */
+    }
+  } else {
+    *ptr = voidptr;
+  }
+
+  /* 
+   *  DISOWN implementation: we need a perl guru to check this one.
+   */
+  if (tsv && (flags & SWIG_POINTER_DISOWN)) {
+    /* 
+     *  almost copy paste code from below SWIG_POINTER_OWN setting
+     */
+    SV *obj = sv;
+    HV *stash = SvSTASH(SvRV(obj));
+    GV *gv = *(GV**) hv_fetch(stash, "OWNER", 5, TRUE);
+    if (isGV(gv)) {
+      HV *hv = GvHVn(gv);
+      /*
+       * To set ownership (see below), a newSViv(1) entry is added. 
+       * Hence, to remove ownership, we delete the entry.
+       */
+      if (hv_exists_ent(hv, obj, 0)) {
+       hv_delete_ent(hv, obj, 0, 0);
+      }
+    }
+  }
+  return SWIG_OK;
+}
+
+SWIGRUNTIME void
+SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, swig_type_info *t, int flags) {
+  if (ptr && (flags & SWIG_SHADOW)) {
+    SV *self;
+    SV *obj=newSV(0);
+    HV *hash=newHV();
+    HV *stash;
+    sv_setref_pv(obj, (char *) SWIG_Perl_TypeProxyName(t), ptr);
+    stash=SvSTASH(SvRV(obj));
+    if (flags & SWIG_POINTER_OWN) {
+      HV *hv;
+      GV *gv=*(GV**)hv_fetch(stash, "OWNER", 5, TRUE);
+      if (!isGV(gv))
+        gv_init(gv, stash, "OWNER", 5, FALSE);
+      hv=GvHVn(gv);
+      hv_store_ent(hv, obj, newSViv(1), 0);
+    }
+    sv_magic((SV *)hash, (SV *)obj, 'P', Nullch, 0);
+    SvREFCNT_dec(obj);
+    self=newRV_noinc((SV *)hash);
+    sv_setsv(sv, self);
+    SvREFCNT_dec((SV *)self);
+    sv_bless(sv, stash);
+  }
+  else {
+    sv_setref_pv(sv, (char *) SWIG_Perl_TypeProxyName(t), ptr);
+  }
+}
+
+SWIGRUNTIMEINLINE SV *
+SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info *t, int flags) {
+  SV *result = sv_newmortal();
+  SWIG_MakePtr(result, ptr, t, flags);
+  return result;
+}
+
+SWIGRUNTIME void
+SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, int sz, swig_type_info *type) {
+  char result[1024];
+  char *r = result;
+  if ((2*sz + 1 + strlen(SWIG_Perl_TypeProxyName(type))) > 1000) return;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  strcpy(r,SWIG_Perl_TypeProxyName(type));
+  sv_setpv(sv, result);
+}
+
+SWIGRUNTIME SV *
+SWIG_Perl_NewPackedObj(SWIG_MAYBE_PERL_OBJECT void *ptr, int sz, swig_type_info *type) {
+  SV *result = sv_newmortal();
+  SWIG_Perl_MakePackedObj(result, ptr, sz, type);
+  return result;
+}
+
+/* Convert a packed value value */
+SWIGRUNTIME int
+SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty) {
+  swig_cast_info *tc;
+  const char  *c = 0;
+
+  if ((!obj) || (!SvOK(obj))) return SWIG_ERROR;
+  c = SvPV_nolen(obj);
+  /* Pointer values must start with leading underscore */
+  if (*c != '_') return SWIG_ERROR;
+  c++;
+  c = SWIG_UnpackData(c,ptr,sz);
+  if (ty) {
+    tc = SWIG_TypeCheck(c,ty);
+    if (!tc) return SWIG_ERROR;
+  }
+  return SWIG_OK;
+}
+
+
+/* Macros for low-level exception handling */
+#define SWIG_croak(x)    { SWIG_Error(SWIG_RuntimeError, x); SWIG_fail; }
+
+
+typedef XSPROTO(SwigPerlWrapper);
+typedef SwigPerlWrapper *SwigPerlWrapperPtr;
+
+/* Structure for command table */
+typedef struct {
+  const char         *name;
+  SwigPerlWrapperPtr  wrapper;
+} swig_command_info;
+
+/* Information for constant table */
+
+#define SWIG_INT     1
+#define SWIG_FLOAT   2
+#define SWIG_STRING  3
+#define SWIG_POINTER 4
+#define SWIG_BINARY  5
+
+/* Constant information structure */
+typedef struct swig_constant_info {
+    int              type;
+    const char      *name;
+    long             lvalue;
+    double           dvalue;
+    void            *pvalue;
+    swig_type_info **ptype;
+} swig_constant_info;
+
+
+/* Structure for variable table */
+typedef struct {
+  const char   *name;
+  SwigMagicFunc   set;
+  SwigMagicFunc   get;
+  swig_type_info  **type;
+} swig_variable_info;
+
+/* Magic variable code */
+#ifndef PERL_OBJECT
+#define swig_create_magic(s,a,b,c) _swig_create_magic(s,a,b,c)
+  #ifndef MULTIPLICITY
+     SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) 
+  #else
+     SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) 
+  #endif
+#else
+#  define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c)
+SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) 
+#endif
+{
+  MAGIC *mg;
+  sv_magic(sv,sv,'U',(char *) name,strlen(name));
+  mg = mg_find(sv,'U');
+  mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
+  mg->mg_virtual->svt_get = (SwigMagicFunc) get;
+  mg->mg_virtual->svt_set = (SwigMagicFunc) set;
+  mg->mg_virtual->svt_len = 0;
+  mg->mg_virtual->svt_clear = 0;
+  mg->mg_virtual->svt_free = 0;
+}
+
+
+SWIGRUNTIME swig_module_info *
+SWIG_Perl_GetModule(void) {
+  static void *type_pointer = (void *)0;
+  SV *pointer;
+
+  /* first check if pointer already created */
+  if (!type_pointer) {
+    pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI);
+    if (pointer && SvOK(pointer)) {
+      type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
+    }
+  }
+
+  return (swig_module_info *) type_pointer;
+}
+
+SWIGRUNTIME void
+SWIG_Perl_SetModule(swig_module_info *module) {
+  SV *pointer;
+
+  /* create a new pointer */
+  pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI);
+  sv_setiv(pointer, PTR2IV(module));
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/* Workaround perl5 global namespace pollution. Note that undefining library
+ * functions like fopen will not solve the problem on all platforms as fopen
+ * might be a macro on Windows but not necessarily on other operating systems. */
+#ifdef do_open
+  #undef do_open
+#endif
+#ifdef do_close
+  #undef do_close
+#endif
+#ifdef scalar
+  #undef scalar
+#endif
+#ifdef list
+  #undef list
+#endif
+#ifdef apply
+  #undef apply
+#endif
+#ifdef convert
+  #undef convert
+#endif
+#ifdef Error
+  #undef Error
+#endif
+#ifdef form
+  #undef form
+#endif
+#ifdef vform
+  #undef vform
+#endif
+#ifdef LABEL
+  #undef LABEL
+#endif
+#ifdef METHOD
+  #undef METHOD
+#endif
+#ifdef Move
+  #undef Move
+#endif
+#ifdef yylex
+  #undef yylex
+#endif
+#ifdef yyparse
+  #undef yyparse
+#endif
+#ifdef yyerror
+  #undef yyerror
+#endif
+#ifdef invert
+  #undef invert
+#endif
+#ifdef ref
+  #undef ref
+#endif
+#ifdef read
+  #undef read
+#endif
+#ifdef write
+  #undef write
+#endif
+#ifdef eof
+  #undef eof
+#endif
+#ifdef bool
+  #undef bool
+#endif
+#ifdef close
+  #undef close
+#endif
+#ifdef rewind
+  #undef rewind
+#endif
+#ifdef free
+  #undef free
+#endif
+#ifdef malloc
+  #undef malloc
+#endif
+#ifdef calloc
+  #undef calloc
+#endif
+#ifdef Stat
+  #undef Stat
+#endif
+#ifdef check
+  #undef check
+#endif
+#ifdef seekdir
+  #undef seekdir
+#endif
+#ifdef open
+  #undef open
+#endif
+
+
+
+#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
+
+#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else 
+
+
+
+  #define SWIG_exception(code, msg) do { SWIG_Error(code, msg); SWIG_fail;; } while(0) 
+
+
+/* -------- TYPES TABLE (BEGIN) -------- */
+
+#define SWIGTYPE_p_amglue_Source swig_types[0]
+#define SWIGTYPE_p_char swig_types[1]
+#define SWIGTYPE_p_double swig_types[2]
+#define SWIGTYPE_p_float swig_types[3]
+#define SWIGTYPE_p_gint swig_types[4]
+#define SWIGTYPE_p_guint swig_types[5]
+#define SWIGTYPE_p_int swig_types[6]
+#define SWIGTYPE_p_unsigned_char swig_types[7]
+static swig_type_info *swig_types[9];
+static swig_module_info swig_module = {swig_types, 8, 0, 0, 0, 0};
+#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
+#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
+
+/* -------- TYPES TABLE (END) -------- */
+
+#define SWIG_init    boot_Amanda__MainLoop
+
+#define SWIG_name   "Amanda::MainLoopc::boot_Amanda__MainLoop"
+#define SWIG_prefix "Amanda::MainLoopc::"
+
+#define SWIGVERSION 0x010335 
+#define SWIG_VERSION SWIGVERSION
+
+
+#define SWIG_as_voidptr(a) (void *)((const void *)(a)) 
+#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) 
+
+
+#ifdef __cplusplus
+extern "C"
+#endif
+#ifndef PERL_OBJECT
+#ifndef MULTIPLICITY
+SWIGEXPORT void SWIG_init (CV* cv);
+#else
+SWIGEXPORT void SWIG_init (pTHXo_ CV* cv);
+#endif
+#else
+SWIGEXPORT void SWIG_init (CV *cv, CPerlObj *);
+#endif
+
+
+#include "amglue.h"
+
+
+#include "amglue.h"
+
+
+#include "amglue.h"
+
+
+#include "amanda.h"
+#include "event.h"
+
+
+void run_c(void) {
+    g_main_loop_run(default_main_loop());
+}
+
+void quit(void) {
+    g_main_loop_quit(default_main_loop());
+}
+
+ static void amglue_source_remove(amglue_Source *self); 
+SWIGINTERN amglue_Source *new_amglue_Source(){
+           die("Amanda::MainLoop::Source is an abstract base class");
+       }
+SWIGINTERN void delete_amglue_Source(amglue_Source *self){
+           amglue_source_unref(self);
+       }
+SWIGINTERN void amglue_Source_set_callback(amglue_Source *self,SV *callback_sub){
+           /* Attach the source to the default mainloop context, so
+            * that it will start generating events.  If it's already
+            * been destroyed, then bail with a fatal error.
+            */
+           if (self->state == AMGLUE_SOURCE_DESTROYED) {
+               die("This source has already been removed");
+           } else if (self->state == AMGLUE_SOURCE_NEW) {
+               self->state = AMGLUE_SOURCE_ATTACHED;
+
+               g_source_attach(self->src, NULL);
+
+               /* the link from the GSource to the amglue_Source is
+                * now in use, so we increment the amglue_Source's 
+                * refcount. */
+               amglue_source_ref(self);
+           }
+
+           /* whoever created this Source object conveniently left
+            * the proper C-side callback for us.  This function has
+            * the appropriate calling signature for this GSource, and
+            * knows how to reflect that into Perl.  It expects the SV to
+            * be provided as its 'data' argument.  'perlcall' suggests
+            * that we make a copy of this SV, in case the user later
+            * modifies it. */
+           if (self->callback_sv) {
+               SvSetSV(self->callback_sv, callback_sub);
+           } else {
+               self->callback_sv = newSVsv(callback_sub);
+               g_source_set_callback(self->src, self->callback,
+                   (gpointer)self, NULL);
+           }
+       }
+SWIGINTERN void amglue_Source_remove(amglue_Source *self){
+           amglue_source_remove(self);
+       }
+
+/* Detach a source from the mainloop and remove it from play.  This is broken
+ * out as a separate function because it's also used from some callbacks */
+static void
+amglue_source_remove(
+    amglue_Source *self)
+{
+    /* protect against self being freed out from under us */
+    amglue_source_ref(self);
+
+    if (self->state == AMGLUE_SOURCE_ATTACHED) {
+       /* unref any perl callback */
+       if (self->callback_sv) {
+           SvREFCNT_dec(self->callback_sv);
+           self->callback_sv = NULL;
+       }
+
+       /* undo the ref made in set_callback() */
+       amglue_source_unref(self);
+
+       g_source_destroy(self->src);
+    }
+
+    self->state = AMGLUE_SOURCE_DESTROYED;
+
+    /* reverse the "protection" increment used above */
+    amglue_source_unref(self);
+}
+
+
+static gboolean
+amglue_source_callback_simple(
+    gpointer *data)
+{
+    dSP;
+    amglue_Source *src = (amglue_Source *)data;
+    SV *src_sv = NULL;
+
+    g_assert(src->callback_sv != NULL);
+
+    ENTER;
+    SAVETMPS;
+
+    /* create a new SV pointing to 'src', and increase our refcount
+     * accordingly.  The SV is mortal, so FREETMPS will decrease the 
+     * refcount, unless the callee keeps a copy of it somewhere */
+    amglue_source_ref(src);
+    src_sv = SWIG_NewPointerObj(src, SWIGTYPE_p_amglue_Source,
+                                SWIG_OWNER | SWIG_SHADOW);
+
+    PUSHMARK(SP);
+    XPUSHs(src_sv);
+    PUTBACK;
+
+    call_sv(src->callback_sv, G_EVAL|G_DISCARD);
+
+    FREETMPS;
+    LEAVE;
+
+    /* these may have been freed, so don't use them after this point */
+    src_sv = NULL;
+    src = NULL;
+
+    /* check for an uncaught 'die'.  If we don't do this, then Perl will longjmp()
+     * over the GMainLoop mechanics, leaving GMainLoop in an inconsistent (locked)
+     * state. */
+    if (SvTRUE(ERRSV)) {
+       /* We handle this just the way the default 'die' handler in Amanda::Debug 
+        * does, but since Amanda's debug support may not yet be running, we back
+        * it up with an exit() */
+       g_critical("%s", SvPV_nolen(ERRSV));
+       exit(1);
+    }
+
+    return TRUE;
+}
+
+
+amglue_Source *
+timeout_source(
+    guint interval)
+{
+    return amglue_source_new(g_timeout_source_new(interval), 
+       (GSourceFunc)amglue_source_callback_simple);
+}
+
+
+amglue_Source *
+idle_source(
+    gint priority)
+{
+    GSource *idle_source = g_idle_source_new();
+    g_source_set_priority(idle_source, priority);
+    return amglue_source_new(idle_source,
+       (GSourceFunc)amglue_source_callback_simple);
+}
+
+
+static gboolean
+child_watch_source_callback(
+    pid_t pid,
+    gint status,
+    gpointer data)
+{
+    dSP;
+    amglue_Source *src = (amglue_Source *)data;
+    SV *src_sv;
+
+    g_assert(src->callback_sv != NULL);
+
+    ENTER;
+    SAVETMPS;
+
+    /* create a new SV pointing to 'src', and increase our refcount
+     * accordingly.  The SV is mortal, so FREETMPS will decrease the 
+     * refcount, unless the callee keeps a copy of it somewhere */
+    amglue_source_ref(src);
+    src_sv = SWIG_NewPointerObj(src, SWIGTYPE_p_amglue_Source,
+                                SWIG_OWNER | SWIG_SHADOW);
+
+    PUSHMARK(SP);
+    XPUSHs(src_sv);
+    XPUSHs(sv_2mortal(newSViv(pid)));
+    XPUSHs(sv_2mortal(newSViv(status)));
+    PUTBACK;
+
+    call_sv(src->callback_sv, G_EVAL|G_DISCARD);
+
+    /* child watch sources automatically destroy themselves after the
+     * child dies, so we mark the amglue_Source as destroyed, too. */
+    amglue_source_remove(src);
+
+    FREETMPS;
+    LEAVE;
+
+    /* these may have been freed, so don't use them after this point */
+    src_sv = NULL;
+    src = NULL;
+
+    /* check for an uncaught 'die'.  If we don't do this, then Perl will longjmp()
+     * over the GMainLoop mechanics, leaving GMainLoop in an inconsistent (locked)
+     * state. */
+    if (SvTRUE(ERRSV)) {
+       /* We handle this just the way the default 'die' handler in Amanda::Debug 
+        * does, but since Amanda's debug support may not yet be running, we back
+        * it up with an exit() */
+       g_critical("%s", SvPV_nolen(ERRSV));
+       exit(1);
+    }
+
+    return TRUE;
+}
+
+
+amglue_Source *
+child_watch_source(
+    gint pid)
+{
+    GSource *child_watch_source = new_child_watch_source(pid);
+    return amglue_source_new(child_watch_source,
+       (GSourceFunc)child_watch_source_callback);
+}
+
+
+SWIGINTERNINLINE SV *
+SWIG_From_long  SWIG_PERL_DECL_ARGS_1(long value)
+{    
+  SV *obj = sv_newmortal();
+  sv_setiv(obj, (IV) value);
+  return obj;
+}
+
+
+SWIGINTERNINLINE SV *
+SWIG_From_int  SWIG_PERL_DECL_ARGS_1(int value)
+{    
+  return SWIG_From_long  SWIG_PERL_CALL_ARGS_1(value);
+}
+
+
+amglue_Source *
+fd_source(
+    gint fd,
+    GIOCondition events)
+{
+    GSource *fdsource = new_fdsource(fd, events);
+    return amglue_source_new(fdsource,
+       (GSourceFunc)amglue_source_callback_simple);
+}
+
+
+#include <limits.h>
+#if !defined(SWIG_NO_LLONG_MAX)
+# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
+#   define LLONG_MAX __LONG_LONG_MAX__
+#   define LLONG_MIN (-LLONG_MAX - 1LL)
+#   define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
+# endif
+#endif
+
+
+SWIGINTERN int
+SWIG_AsVal_double SWIG_PERL_DECL_ARGS_2(SV *obj, double *val)
+{
+  if (SvNIOK(obj)) {
+    if (val) *val = SvNV(obj);
+    return SWIG_OK;
+  } else if (SvIOK(obj)) {
+    if (val) *val = (double) SvIV(obj);
+    return SWIG_AddCast(SWIG_OK);
+  } else {
+    const char *nptr = SvPV_nolen(obj);
+    if (nptr) {
+      char *endptr;
+      double v = strtod(nptr, &endptr);
+      if (errno == ERANGE) {
+       errno = 0;
+       return SWIG_OverflowError;
+      } else {
+       if (*endptr == '\0') {
+         if (val) *val = v;
+         return SWIG_Str2NumCast(SWIG_OK);
+       }
+      }
+    }
+  }
+  return SWIG_TypeError;
+}
+
+
+#include <float.h>
+
+
+#include <math.h>
+
+
+SWIGINTERNINLINE int
+SWIG_CanCastAsInteger(double *d, double min, double max) {
+  double x = *d;
+  if ((min <= x && x <= max)) {
+   double fx = floor(x);
+   double cx = ceil(x);
+   double rd =  ((x - fx) < 0.5) ? fx : cx; /* simple rint */
+   if ((errno == EDOM) || (errno == ERANGE)) {
+     errno = 0;
+   } else {
+     double summ, reps, diff;
+     if (rd < x) {
+       diff = x - rd;
+     } else if (rd > x) {
+       diff = rd - x;
+     } else {
+       return 1;
+     }
+     summ = rd + x;
+     reps = diff/summ;
+     if (reps < 8*DBL_EPSILON) {
+       *d = rd;
+       return 1;
+     }
+   }
+  }
+  return 0;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_long SWIG_PERL_DECL_ARGS_2(SV *obj, long* val)
+{
+  if (SvIOK(obj)) {
+    if (val) *val = SvIV(obj);
+    return SWIG_OK;
+  } else {
+    int dispatch = 0;
+    const char *nptr = SvPV_nolen(obj);
+    if (nptr) {
+      char *endptr;
+      long v;
+      errno = 0;
+      v = strtol(nptr, &endptr,0);
+      if (errno == ERANGE) {
+       errno = 0;
+       return SWIG_OverflowError;
+      } else {
+       if (*endptr == '\0') {
+         if (val) *val = v;
+         return SWIG_Str2NumCast(SWIG_OK);
+       }
+      }
+    }
+    if (!dispatch) {
+      double d;
+      int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj,&d));
+      if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
+       if (val) *val = (long)(d);
+       return res;
+      }
+    }
+  }
+  return SWIG_TypeError;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_int SWIG_PERL_DECL_ARGS_2(SV * obj, int *val)
+{
+  long v;
+  int res = SWIG_AsVal_long SWIG_PERL_CALL_ARGS_2(obj, &v);
+  if (SWIG_IsOK(res)) {
+    if ((v < INT_MIN || v > INT_MAX)) {
+      return SWIG_OverflowError;
+    } else {
+      if (val) *val = (int)(v);
+    }
+  }  
+  return res;
+}
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef PERL_OBJECT
+#define MAGIC_CLASS _wrap_Amanda::MainLoop_var::
+class _wrap_Amanda::MainLoop_var : public CPerlObj {
+public:
+#else
+#define MAGIC_CLASS
+#endif
+SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *SWIGUNUSEDPARM(sv), MAGIC *SWIGUNUSEDPARM(mg)) {
+    MAGIC_PPERL
+    croak("Value is read-only.");
+    return 0;
+}
+
+
+#ifdef PERL_OBJECT
+};
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+XS(_wrap_run_c) {
+  {
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: run_c();");
+    }
+    run_c();
+    
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_quit) {
+  {
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: quit();");
+    }
+    quit();
+    
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_new_Source) {
+  {
+    amglue_Source *result = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: new_Source();");
+    }
+    result = (amglue_Source *)new_amglue_Source();
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_amglue_Source, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_delete_Source) {
+  {
+    amglue_Source *arg1 = (amglue_Source *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_Source(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_amglue_Source, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Source" "', argument " "1"" of type '" "amglue_Source *""'"); 
+    }
+    arg1 = (amglue_Source *)(argp1);
+    delete_amglue_Source(arg1);
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Source_set_callback) {
+  {
+    amglue_Source *arg1 = (amglue_Source *) 0 ;
+    SV *arg2 = (SV *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Source_set_callback(self,callback_sub);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_amglue_Source, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Source_set_callback" "', argument " "1"" of type '" "amglue_Source *""'"); 
+    }
+    arg1 = (amglue_Source *)(argp1);
+    arg2 = ST(1);
+    amglue_Source_set_callback(arg1,arg2);
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Source_remove) {
+  {
+    amglue_Source *arg1 = (amglue_Source *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Source_remove(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_amglue_Source, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Source_remove" "', argument " "1"" of type '" "amglue_Source *""'"); 
+    }
+    arg1 = (amglue_Source *)(argp1);
+    amglue_Source_remove(arg1);
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_timeout_source) {
+  {
+    guint arg1 ;
+    amglue_Source *result = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: timeout_source(interval);");
+    }
+    {
+      if (sizeof(guint) == 1) {
+        arg1 = amglue_SvU8(ST(0));
+      } else if (sizeof(guint) == 2) {
+        arg1 = amglue_SvU16(ST(0));
+      } else if (sizeof(guint) == 4) {
+        arg1 = amglue_SvU32(ST(0));
+      } else if (sizeof(guint) == 8) {
+        arg1 = amglue_SvU64(ST(0));
+      } else {
+        croak("Unexpected guint >64 bits?"); /* should be optimized out unless sizeof(guint) > 8 */
+      }
+    }
+    result = (amglue_Source *)timeout_source(arg1);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_amglue_Source, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_idle_source) {
+  {
+    gint arg1 ;
+    amglue_Source *result = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: idle_source(priority);");
+    }
+    {
+      if (sizeof(gint) == 1) {
+        arg1 = amglue_SvI8(ST(0));
+      } else if (sizeof(gint) == 2) {
+        arg1 = amglue_SvI16(ST(0));
+      } else if (sizeof(gint) == 4) {
+        arg1 = amglue_SvI32(ST(0));
+      } else if (sizeof(gint) == 8) {
+        arg1 = amglue_SvI64(ST(0));
+      } else {
+        g_critical("Unexpected gint >64 bits?"); /* should be optimized out unless sizeof(gint) > 8 */
+      }
+    }
+    result = (amglue_Source *)idle_source(arg1);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_amglue_Source, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_child_watch_source) {
+  {
+    gint arg1 ;
+    amglue_Source *result = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: child_watch_source(pid);");
+    }
+    {
+      if (sizeof(gint) == 1) {
+        arg1 = amglue_SvI8(ST(0));
+      } else if (sizeof(gint) == 2) {
+        arg1 = amglue_SvI16(ST(0));
+      } else if (sizeof(gint) == 4) {
+        arg1 = amglue_SvI32(ST(0));
+      } else if (sizeof(gint) == 8) {
+        arg1 = amglue_SvI64(ST(0));
+      } else {
+        g_critical("Unexpected gint >64 bits?"); /* should be optimized out unless sizeof(gint) > 8 */
+      }
+    }
+    result = (amglue_Source *)child_watch_source(arg1);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_amglue_Source, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_fd_source) {
+  {
+    gint arg1 ;
+    GIOCondition arg2 ;
+    amglue_Source *result = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: fd_source(fd,events);");
+    }
+    {
+      if (sizeof(gint) == 1) {
+        arg1 = amglue_SvI8(ST(0));
+      } else if (sizeof(gint) == 2) {
+        arg1 = amglue_SvI16(ST(0));
+      } else if (sizeof(gint) == 4) {
+        arg1 = amglue_SvI32(ST(0));
+      } else if (sizeof(gint) == 8) {
+        arg1 = amglue_SvI64(ST(0));
+      } else {
+        g_critical("Unexpected gint >64 bits?"); /* should be optimized out unless sizeof(gint) > 8 */
+      }
+    }
+    {
+      if (sizeof(gint) == 1) {
+        arg2 = amglue_SvI8(ST(1));
+      } else if (sizeof(gint) == 2) {
+        arg2 = amglue_SvI16(ST(1));
+      } else if (sizeof(gint) == 4) {
+        arg2 = amglue_SvI32(ST(1));
+      } else if (sizeof(gint) == 8) {
+        arg2 = amglue_SvI64(ST(1));
+      } else {
+        g_critical("Unexpected gint >64 bits?"); /* should be optimized out unless sizeof(gint) > 8 */
+      }
+    }
+    result = (amglue_Source *)fd_source(arg1,arg2);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_amglue_Source, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
+
+static swig_type_info _swigt__p_amglue_Source = {"_p_amglue_Source", "struct amglue_Source *|amglue_Source *", 0, 0, (void*)"Amanda::MainLoop::Source", 0};
+static swig_type_info _swigt__p_char = {"_p_char", "gchar *|char *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_double = {"_p_double", "double *|gdouble *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_float = {"_p_float", "float *|gfloat *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_gint = {"_p_gint", "gint *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_guint = {"_p_guint", "guint *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_int = {"_p_int", "int *|GIOCondition *|gboolean *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "guchar *|unsigned char *", 0, 0, (void*)0, 0};
+
+static swig_type_info *swig_type_initial[] = {
+  &_swigt__p_amglue_Source,
+  &_swigt__p_char,
+  &_swigt__p_double,
+  &_swigt__p_float,
+  &_swigt__p_gint,
+  &_swigt__p_guint,
+  &_swigt__p_int,
+  &_swigt__p_unsigned_char,
+};
+
+static swig_cast_info _swigc__p_amglue_Source[] = {  {&_swigt__p_amglue_Source, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_double[] = {  {&_swigt__p_double, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_float[] = {  {&_swigt__p_float, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_gint[] = {  {&_swigt__p_gint, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_guint[] = {  {&_swigt__p_guint, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_int[] = {  {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_unsigned_char[] = {  {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
+
+static swig_cast_info *swig_cast_initial[] = {
+  _swigc__p_amglue_Source,
+  _swigc__p_char,
+  _swigc__p_double,
+  _swigc__p_float,
+  _swigc__p_gint,
+  _swigc__p_guint,
+  _swigc__p_int,
+  _swigc__p_unsigned_char,
+};
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
+
+static swig_constant_info swig_constants[] = {
+{0,0,0,0,0,0}
+};
+#ifdef __cplusplus
+}
+#endif
+static swig_variable_info swig_variables[] = {
+{0,0,0,0}
+};
+static swig_command_info swig_commands[] = {
+{"Amanda::MainLoopc::run_c", _wrap_run_c},
+{"Amanda::MainLoopc::quit", _wrap_quit},
+{"Amanda::MainLoopc::new_Source", _wrap_new_Source},
+{"Amanda::MainLoopc::delete_Source", _wrap_delete_Source},
+{"Amanda::MainLoopc::Source_set_callback", _wrap_Source_set_callback},
+{"Amanda::MainLoopc::Source_remove", _wrap_Source_remove},
+{"Amanda::MainLoopc::timeout_source", _wrap_timeout_source},
+{"Amanda::MainLoopc::idle_source", _wrap_idle_source},
+{"Amanda::MainLoopc::child_watch_source", _wrap_child_watch_source},
+{"Amanda::MainLoopc::fd_source", _wrap_fd_source},
+{0,0}
+};
+/* -----------------------------------------------------------------------------
+ * Type initialization:
+ * This problem is tough by the requirement that no dynamic 
+ * memory is used. Also, since swig_type_info structures store pointers to 
+ * swig_cast_info structures and swig_cast_info structures store pointers back
+ * to swig_type_info structures, we need some lookup code at initialization. 
+ * The idea is that swig generates all the structures that are needed. 
+ * The runtime then collects these partially filled structures. 
+ * The SWIG_InitializeModule function takes these initial arrays out of 
+ * swig_module, and does all the lookup, filling in the swig_module.types
+ * array with the correct data and linking the correct swig_cast_info
+ * structures together.
+ *
+ * The generated swig_type_info structures are assigned staticly to an initial 
+ * array. We just loop through that array, and handle each type individually.
+ * First we lookup if this type has been already loaded, and if so, use the
+ * loaded structure instead of the generated one. Then we have to fill in the
+ * cast linked list. The cast data is initially stored in something like a
+ * two-dimensional array. Each row corresponds to a type (there are the same
+ * number of rows as there are in the swig_type_initial array). Each entry in
+ * a column is one of the swig_cast_info structures for that type.
+ * The cast_initial array is actually an array of arrays, because each row has
+ * a variable number of columns. So to actually build the cast linked list,
+ * we find the array of casts associated with the type, and loop through it 
+ * adding the casts to the list. The one last trick we need to do is making
+ * sure the type pointer in the swig_cast_info struct is correct.
+ *
+ * First off, we lookup the cast->type name to see if it is already loaded. 
+ * There are three cases to handle:
+ *  1) If the cast->type has already been loaded AND the type we are adding
+ *     casting info to has not been loaded (it is in this module), THEN we
+ *     replace the cast->type pointer with the type pointer that has already
+ *     been loaded.
+ *  2) If BOTH types (the one we are adding casting info to, and the 
+ *     cast->type) are loaded, THEN the cast info has already been loaded by
+ *     the previous module so we just ignore it.
+ *  3) Finally, if cast->type has not already been loaded, then we add that
+ *     swig_cast_info to the linked list (because the cast->type) pointer will
+ *     be correct.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#if 0
+} /* c-mode */
+#endif
+#endif
+
+#if 0
+#define SWIGRUNTIME_DEBUG
+#endif
+
+
+SWIGRUNTIME void
+SWIG_InitializeModule(void *clientdata) {
+  size_t i;
+  swig_module_info *module_head, *iter;
+  int found, init;
+  
+  clientdata = clientdata;
+  
+  /* check to see if the circular list has been setup, if not, set it up */
+  if (swig_module.next==0) {
+    /* Initialize the swig_module */
+    swig_module.type_initial = swig_type_initial;
+    swig_module.cast_initial = swig_cast_initial;
+    swig_module.next = &swig_module;
+    init = 1;
+  } else {
+    init = 0;
+  }
+  
+  /* Try and load any already created modules */
+  module_head = SWIG_GetModule(clientdata);
+  if (!module_head) {
+    /* This is the first module loaded for this interpreter */
+    /* so set the swig module into the interpreter */
+    SWIG_SetModule(clientdata, &swig_module);
+    module_head = &swig_module;
+  } else {
+    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
+    found=0;
+    iter=module_head;
+    do {
+      if (iter==&swig_module) {
+        found=1;
+        break;
+      }
+      iter=iter->next;
+    } while (iter!= module_head);
+    
+    /* if the is found in the list, then all is done and we may leave */
+    if (found) return;
+    /* otherwise we must add out module into the list */
+    swig_module.next = module_head->next;
+    module_head->next = &swig_module;
+  }
+  
+  /* When multiple interpeters are used, a module could have already been initialized in
+       a different interpreter, but not yet have a pointer in this interpreter.
+       In this case, we do not want to continue adding types... everything should be
+       set up already */
+  if (init == 0) return;
+  
+  /* Now work on filling in swig_module.types */
+#ifdef SWIGRUNTIME_DEBUG
+  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
+#endif
+  for (i = 0; i < swig_module.size; ++i) {
+    swig_type_info *type = 0;
+    swig_type_info *ret;
+    swig_cast_info *cast;
+    
+#ifdef SWIGRUNTIME_DEBUG
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+#endif
+    
+    /* if there is another module already loaded */
+    if (swig_module.next != &swig_module) {
+      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
+    }
+    if (type) {
+      /* Overwrite clientdata field */
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: found type %s\n", type->name);
+#endif
+      if (swig_module.type_initial[i]->clientdata) {
+        type->clientdata = swig_module.type_initial[i]->clientdata;
+#ifdef SWIGRUNTIME_DEBUG
+        printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
+#endif
+      }
+    } else {
+      type = swig_module.type_initial[i];
+    }
+    
+    /* Insert casting types */
+    cast = swig_module.cast_initial[i];
+    while (cast->type) {
+      /* Don't need to add information already in the list */
+      ret = 0;
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
+#endif
+      if (swig_module.next != &swig_module) {
+        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
+#ifdef SWIGRUNTIME_DEBUG
+        if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
+#endif
+      }
+      if (ret) {
+        if (type == swig_module.type_initial[i]) {
+#ifdef SWIGRUNTIME_DEBUG
+          printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
+#endif
+          cast->type = ret;
+          ret = 0;
+        } else {
+          /* Check for casting already in the list */
+          swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
+#ifdef SWIGRUNTIME_DEBUG
+          if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
+#endif
+          if (!ocast) ret = 0;
+        }
+      }
+      
+      if (!ret) {
+#ifdef SWIGRUNTIME_DEBUG
+        printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
+#endif
+        if (type->cast) {
+          type->cast->prev = cast;
+          cast->next = type->cast;
+        }
+        type->cast = cast;
+      }
+      cast++;
+    }
+    /* Set entry in modules->types array equal to the type */
+    swig_module.types[i] = type;
+  }
+  swig_module.types[i] = 0;
+  
+#ifdef SWIGRUNTIME_DEBUG
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+  for (i = 0; i < swig_module.size; ++i) {
+    int j = 0;
+    swig_cast_info *cast = swig_module.cast_initial[i];
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+    while (cast->type) {
+      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
+      cast++;
+      ++j;
+    }
+    printf("---- Total casts: %d\n",j);
+  }
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+#endif
+}
+
+/* This function will propagate the clientdata field of type to
+* any new swig_type_info structures that have been added into the list
+* of equivalent types.  It is like calling
+* SWIG_TypeClientData(type, clientdata) a second time.
+*/
+SWIGRUNTIME void
+SWIG_PropagateClientData(void) {
+  size_t i;
+  swig_cast_info *equiv;
+  static int init_run = 0;
+  
+  if (init_run) return;
+  init_run = 1;
+  
+  for (i = 0; i < swig_module.size; i++) {
+    if (swig_module.types[i]->clientdata) {
+      equiv = swig_module.types[i]->cast;
+      while (equiv) {
+        if (!equiv->converter) {
+          if (equiv->type && !equiv->type->clientdata)
+          SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
+        }
+        equiv = equiv->next;
+      }
+    }
+  }
+}
+
+#ifdef __cplusplus
+#if 0
+{
+  /* c-mode */
+#endif
+}
+#endif
+
+
+
+#ifdef __cplusplus
+extern "C"
+#endif
+
+XS(SWIG_init) {
+  dXSARGS;
+  int i;
+  
+  SWIG_InitializeModule(0);
+  
+  /* Install commands */
+  for (i = 0; swig_commands[i].name; i++) {
+    newXS((char*) swig_commands[i].name,swig_commands[i].wrapper, (char*)__FILE__);
+  }
+  
+  /* Install variables */
+  for (i = 0; swig_variables[i].name; i++) {
+    SV *sv;
+    sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI);
+    if (swig_variables[i].type) {
+      SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0);
+    } else {
+      sv_setiv(sv,(IV) 0);
+    }
+    swig_create_magic(sv, (char *) swig_variables[i].name, swig_variables[i].set, swig_variables[i].get); 
+  }
+  
+  /* Install constant */
+  for (i = 0; swig_constants[i].type; i++) {
+    SV *sv;
+    sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI);
+    switch(swig_constants[i].type) {
+    case SWIG_INT:
+      sv_setiv(sv, (IV) swig_constants[i].lvalue);
+      break;
+    case SWIG_FLOAT:
+      sv_setnv(sv, (double) swig_constants[i].dvalue);
+      break;
+    case SWIG_STRING:
+      sv_setpv(sv, (char *) swig_constants[i].pvalue);
+      break;
+    case SWIG_POINTER:
+      SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype),0);
+      break;
+    case SWIG_BINARY:
+      SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype));
+      break;
+    default:
+      break;
+    }
+    SvREADONLY_on(sv);
+  }
+  
+  SWIG_TypeClientData(SWIGTYPE_p_amglue_Source, (void*) "Amanda::MainLoop::Source");
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "G_IO_IN", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(G_IO_IN)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "G_IO_OUT", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(G_IO_OUT)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "G_IO_PRI", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(G_IO_PRI)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "G_IO_ERR", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(G_IO_ERR)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "G_IO_HUP", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(G_IO_HUP)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "G_IO_NVAL", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(G_IO_NVAL)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  ST(0) = &PL_sv_yes;
+  XSRETURN(1);
+}
+
diff --git a/perl/Amanda/MainLoop.pm b/perl/Amanda/MainLoop.pm
new file mode 100644 (file)
index 0000000..da1d842
--- /dev/null
@@ -0,0 +1,425 @@
+# This file was automatically generated by SWIG (http://www.swig.org).
+# Version 1.3.35
+#
+# Don't modify this file, modify the SWIG interface instead.
+
+package Amanda::MainLoop;
+require Exporter;
+require DynaLoader;
+@ISA = qw(Exporter DynaLoader);
+package Amanda::MainLoopc;
+bootstrap Amanda::MainLoop;
+package Amanda::MainLoop;
+@EXPORT = qw( );
+
+# ---------- BASE METHODS -------------
+
+package Amanda::MainLoop;
+
+sub TIEHASH {
+    my ($classname,$obj) = @_;
+    return bless $obj, $classname;
+}
+
+sub CLEAR { }
+
+sub FIRSTKEY { }
+
+sub NEXTKEY { }
+
+sub FETCH {
+    my ($self,$field) = @_;
+    my $member_func = "swig_${field}_get";
+    $self->$member_func();
+}
+
+sub STORE {
+    my ($self,$field,$newval) = @_;
+    my $member_func = "swig_${field}_set";
+    $self->$member_func($newval);
+}
+
+sub this {
+    my $ptr = shift;
+    return tied(%$ptr);
+}
+
+
+# ------- FUNCTION WRAPPERS --------
+
+package Amanda::MainLoop;
+
+*run_c = *Amanda::MainLoopc::run_c;
+*quit = *Amanda::MainLoopc::quit;
+*timeout_source = *Amanda::MainLoopc::timeout_source;
+*idle_source = *Amanda::MainLoopc::idle_source;
+*child_watch_source = *Amanda::MainLoopc::child_watch_source;
+*fd_source = *Amanda::MainLoopc::fd_source;
+
+############# Class : Amanda::MainLoop::Source ##############
+
+package Amanda::MainLoop::Source;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+@ISA = qw( Amanda::MainLoop );
+%OWNER = ();
+%ITERATORS = ();
+sub new {
+    my $pkg = shift;
+    my $self = Amanda::MainLoopc::new_Source(@_);
+    bless $self, $pkg if defined($self);
+}
+
+sub DESTROY {
+    return unless $_[0]->isa('HASH');
+    my $self = tied(%{$_[0]});
+    return unless defined $self;
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        Amanda::MainLoopc::delete_Source($self);
+        delete $OWNER{$self};
+    }
+}
+
+*set_callback = *Amanda::MainLoopc::Source_set_callback;
+*remove = *Amanda::MainLoopc::Source_remove;
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+# ------- VARIABLE STUBS --------
+
+package Amanda::MainLoop;
+
+*G_IO_IN = *Amanda::MainLoopc::G_IO_IN;
+*G_IO_OUT = *Amanda::MainLoopc::G_IO_OUT;
+*G_IO_PRI = *Amanda::MainLoopc::G_IO_PRI;
+*G_IO_ERR = *Amanda::MainLoopc::G_IO_ERR;
+*G_IO_HUP = *Amanda::MainLoopc::G_IO_HUP;
+*G_IO_NVAL = *Amanda::MainLoopc::G_IO_NVAL;
+
+@EXPORT_OK = ();
+%EXPORT_TAGS = ();
+
+=head1 NAME
+
+Amanda::MainLoop - Perl interface to the Glib MainLoop
+
+=head1 SYNOPSIS
+
+    use Amanda::MainLoop;
+    
+    my $to = Amanda::MainLoop::timeout_source(2000);
+    $to->set_callback(sub { 
+       print "Time's Up!\n";
+       $to->remove();              # dont' re-queue this timeout
+       Amanda::MainLoop::quit();   # return from Amanda::MainLoop::run
+    });
+
+    Amanda::MainLoop::run();
+
+Note that all functions in this module are individually available for export,
+e.g.,
+
+    use Amanda::MainLoop qw(run quit);
+
+=head1 OVERVIEW
+
+The main event loop of an application is a tight loop which waits for events,
+and calls functions to respond to those events.  This design allows an IO-bound
+application to multitask within a single thread, by responding to IO events as
+they occur instead of blocking on particular IO operations.
+
+The Amanda security API, transfer API, and other components rely on the event
+loop to allow them to respond to their own events in a timely fashion.
+
+The overall structure of an application, then, is to initialize its state,
+register callbacks for some events, and begin looping.  When some
+application-defined state is reached, the loop is terminated and the
+application cleans up and exits.
+
+=head2 LOOPING
+
+The actual event loop takes place within a call to C<Amanda::MainLoop::run()>.
+This function executes until a call to C<Amanda::MainLoop::quit()> occurs, at
+which point C<run()> returns.  You can check whether the loop is running with
+C<Amanda::MainLoop::is_running()>.
+
+In some cases, a sub should only run after the loop has started.  The
+most common case is when a callback may call C<Amanda::MainLoop::quit>
+immediately.  In this circumstance, use C<call_later>, which takes a
+subref and an arbitrary number of arguments for that sub:
+
+    my $cb = sub {
+       my ($letters, $digits) = @_;
+       # ..
+       Amanda::MainLoop::quit();
+    };
+    Amanda::MainLoop::call_later($cb, "abc", 123);
+    # ..
+    Amanda::MainLoop::run();
+
+Similarly, a tight loop of callbacks with no blocking operations can
+lead to excessive stack consumption.  In this case, C<call_later()> is
+useful, too. It queues the callback to run at the next cycle of the
+MainLoop:
+
+    sub might_delay {
+        my ($cb) = @_;
+        if (can_do_it_now()) {
+            my $result = do_it();
+            Amanda::MainLoop::call_later($cb, $result)
+        } else {
+            # ..
+        }
+    }
+
+=head2 EVENT SOURCES
+
+An event source is responsible for producing events.  A source may produce
+multiple events over its lifetime.
+
+The method C<$src->set_callback(\&cb)> sets the function that will be called
+for a given source, and "attaches" the source to the main loop so that it will
+begin generating events.  The arguments to the callback depend on the event
+source, but the first argument is always the source itself.  Unless specified,
+no other arguments are provided.
+
+Event sources persist until they are removed with C<$src->remove()>, even if
+the source itself is no longer accessible from Perl.  Although Glib supports
+it, there is no provision for "automatically" removing an event source.  As an
+example:
+
+  sub start_timer { 
+    my ($loops) = @_;
+
+    Amanda::MainLoop::timeout_source(200)->set_callback(sub {
+      my ($src) = @_;
+      print "timer\n";
+      if (--$loops <= 0) {
+        $src->remove();
+        Amanda::MainLoop::quit();
+      }
+    });
+  }
+  start_timer(10);
+  Amanda::MainLoop::run();
+
+=head3 Timeout
+
+  my $src = Amanda::MainLoop::timeout_source(10000);
+
+A timeout source will create events at the specified interval, specified in
+milliseconds (thousandths of a second).  The events will continue until the
+source is destroyed.
+
+=head3 Idle
+
+  my $src = Amanda::MainLoop::idle_source(2);
+
+An idle source will create events continuously except when a higher-priority
+source is emitting events.  Priorities are generally small positive integers,
+with larger integers denoting lower priorities.  The events will continue until
+the source is destroyed.
+
+=head3 Child Watch
+
+  my $src = Amanda::MainLoop::child_watch_source($pid);
+
+A child watch source will issue an event when the process with the given PID
+dies.  To avoid race conditions, it will issue an event even if the process
+dies before the source is created.  The callback is called with three
+arguments: the event source, the PID, and the child's exit status.
+
+Note that this source is totally incompatible with any thing that would cause
+perl to change the SIGCHLD handler.  If SIGCHLD is changed, under some
+circumstances the module will recognize this circumstance, add a warning to the
+debug log, and continue operating.  However, it is impossible to catch all
+possible situations.
+
+=head3 File Descriptor
+
+  my $src = Amanda::MainLoop::fd_source($fd, G_IO_IN);
+
+This source will issuen an event whenever one of the given conditions is true
+for the given file descriptor.  The conditions are from Glib's GIOCondition,
+and are C<$G_IO_IN>, C<G_IO_OUT>, C<$G_IO_PRI>, C<$G_IO_ERR>, C<$G_IO_HUP>, and
+C<$G_IO_NVAL>.  These constants are available with the import tag
+C<:GIOCondition>.
+
+Generally, when reading from a file descriptor, use C<$G_IO_IN|$G_IO_HUP> to
+ensure that an EOF triggers an event as well.  Writing to a file descriptor can
+simply use C<$G_IO_OUT>.
+
+=head1 RELATION TO GLIB
+
+Glib's main event loop is described in the Glib manual:
+L<http://library.gnome.org/devel/glib/stable/glib-The-Main-Event-Loop.html>.
+Note that Amanda depends only on the functionality available in Glib-2.2.0, so
+many functions described in that document are not available in Amanda.  This
+module provides a much-simplified interface to the glib library, and is not
+intended as a generic wrapper for it.  Specifically:
+
+=over
+
+=item Amanda's perl-accessible main loop only runs a single C<GMainContext>, and
+always runs in the main thread.
+
+=item Besides idle sources, event priorities are not accessible from Perl.
+
+=back
+
+=head1 PROGRAMMING HINTS
+
+Most often, callbacks are short, and can be specified as anonymous subs:
+
+    $src->set_callback(sub {
+       my ($src) = @_;
+       # ...
+    });
+
+There is currently no means in place to specify extra arguments for a callback
+when it is set.  If the callback needs access to other data, it should use a
+Perl closure in the form of lexically scoped variables and a (possibly
+anonymous) sub:
+
+    {
+       my $total_results = 0;
+
+       $src->set_callback(sub {
+           my ($src, $result) = @_;
+           $total_results += $result;
+       });
+    }
+
+Event sources are often set up in groups, e.g., a long-term operation and a
+timeout.  When this is the case, be careful that all sources are removed when
+the operation is complete.  The easiest way to accomplish this is to include all
+sources in a lexical scope and remove them at the appropriate times:
+
+    {
+       my $op_src = long_operation_src();
+       my $timeout_src = Amanda::MainLoop::timeout_source($timeout);
+
+       sub finish {
+           $op_src->remove();
+           $timeout_src->remove();
+       }
+
+       $op_src->set_callback(sub {
+           print "Operation complete\n";
+           finish();
+       });
+
+       $timeout_src->set_callback(sub {
+           print "Operation timed out\n";
+           finish();
+       });
+    }
+
+Both of these limitations may be lifted in future revisions of
+L<Amanda::MainLoop>.
+
+=cut
+
+# glib's g_is_main_loop_running() seems inaccurate, so we just
+# track that information locally..
+my $mainloop_running = 0;
+
+my @waiting_to_call_later;
+sub call_later {
+    my ($sub, @args) = @_;
+
+    # add the callback if nothing is waiting right now
+    if (!@waiting_to_call_later) {
+        timeout_source(0)->set_callback(sub {
+            my ($src) = @_;
+            $src->remove();
+
+            while (@waiting_to_call_later) {
+                my ($sub, @args) = @{pop @waiting_to_call_later};
+                $sub->(@args);
+            }
+        });
+    }
+
+    push @waiting_to_call_later, [ $sub, @args ];
+}
+
+sub run {
+    $mainloop_running = 1;
+    run_c();
+    $mainloop_running = 0;
+}
+
+sub is_running {
+    return $mainloop_running;
+}
+
+push @EXPORT_OK, qw(GIOCondition_to_strings);
+push @{$EXPORT_TAGS{"GIOCondition"}}, qw(GIOCondition_to_strings);
+
+my %_GIOCondition_VALUES;
+#Convert a flag value to a list of names for flags that are set.
+sub GIOCondition_to_strings {
+    my ($flags) = @_;
+    my @result = ();
+
+    for my $k (keys %_GIOCondition_VALUES) {
+       my $v = $_GIOCondition_VALUES{$k};
+
+       #is this a matching flag?
+       if (($v == 0 && $flags == 0) || ($v != 0 && ($flags & $v) == $v)) {
+           push @result, $k;
+       }
+    }
+
+#by default, just return the number as a 1-element list
+    if (!@result) {
+       return ($flags);
+    }
+
+    return @result;
+}
+
+push @EXPORT_OK, qw($G_IO_IN);
+push @{$EXPORT_TAGS{"GIOCondition"}}, qw($G_IO_IN);
+
+$_GIOCondition_VALUES{"G_IO_IN"} = $G_IO_IN;
+
+push @EXPORT_OK, qw($G_IO_OUT);
+push @{$EXPORT_TAGS{"GIOCondition"}}, qw($G_IO_OUT);
+
+$_GIOCondition_VALUES{"G_IO_OUT"} = $G_IO_OUT;
+
+push @EXPORT_OK, qw($G_IO_PRI);
+push @{$EXPORT_TAGS{"GIOCondition"}}, qw($G_IO_PRI);
+
+$_GIOCondition_VALUES{"G_IO_PRI"} = $G_IO_PRI;
+
+push @EXPORT_OK, qw($G_IO_ERR);
+push @{$EXPORT_TAGS{"GIOCondition"}}, qw($G_IO_ERR);
+
+$_GIOCondition_VALUES{"G_IO_ERR"} = $G_IO_ERR;
+
+push @EXPORT_OK, qw($G_IO_HUP);
+push @{$EXPORT_TAGS{"GIOCondition"}}, qw($G_IO_HUP);
+
+$_GIOCondition_VALUES{"G_IO_HUP"} = $G_IO_HUP;
+
+push @EXPORT_OK, qw($G_IO_NVAL);
+push @{$EXPORT_TAGS{"GIOCondition"}}, qw($G_IO_NVAL);
+
+$_GIOCondition_VALUES{"G_IO_NVAL"} = $G_IO_NVAL;
+
+#copy symbols in GIOCondition to constants
+push @{$EXPORT_TAGS{"constants"}},  @{$EXPORT_TAGS{"GIOCondition"}};
+1;
diff --git a/perl/Amanda/MainLoop.swg b/perl/Amanda/MainLoop.swg
new file mode 100644 (file)
index 0000000..ebae792
--- /dev/null
@@ -0,0 +1,574 @@
+/*
+ * Copyright (c) 2008 Zmanda, Inc.  All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ *
+ * This 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 this library; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+ *
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+ */
+
+%module "Amanda::MainLoop"
+%include "amglue/amglue.swg"
+%include "exception.i"
+
+%{
+#include "amanda.h"
+#include "event.h"
+%}
+
+%perlcode %{
+=head1 NAME
+
+Amanda::MainLoop - Perl interface to the Glib MainLoop
+
+=head1 SYNOPSIS
+
+    use Amanda::MainLoop;
+    
+    my $to = Amanda::MainLoop::timeout_source(2000);
+    $to->set_callback(sub { 
+       print "Time's Up!\n";
+       $to->remove();              # dont' re-queue this timeout
+       Amanda::MainLoop::quit();   # return from Amanda::MainLoop::run
+    });
+
+    Amanda::MainLoop::run();
+
+Note that all functions in this module are individually available for export,
+e.g.,
+
+    use Amanda::MainLoop qw(run quit);
+
+=head1 OVERVIEW
+
+The main event loop of an application is a tight loop which waits for events,
+and calls functions to respond to those events.  This design allows an IO-bound
+application to multitask within a single thread, by responding to IO events as
+they occur instead of blocking on particular IO operations.
+
+The Amanda security API, transfer API, and other components rely on the event
+loop to allow them to respond to their own events in a timely fashion.
+
+The overall structure of an application, then, is to initialize its state,
+register callbacks for some events, and begin looping.  When some
+application-defined state is reached, the loop is terminated and the
+application cleans up and exits.
+
+=head2 LOOPING
+
+The actual event loop takes place within a call to C<Amanda::MainLoop::run()>.
+This function executes until a call to C<Amanda::MainLoop::quit()> occurs, at
+which point C<run()> returns.  You can check whether the loop is running with
+C<Amanda::MainLoop::is_running()>.
+
+In some cases, a sub should only run after the loop has started.  The
+most common case is when a callback may call C<Amanda::MainLoop::quit>
+immediately.  In this circumstance, use C<call_later>, which takes a
+subref and an arbitrary number of arguments for that sub:
+
+    my $cb = sub {
+       my ($letters, $digits) = @_;
+       # ..
+       Amanda::MainLoop::quit();
+    };
+    Amanda::MainLoop::call_later($cb, "abc", 123);
+    # ..
+    Amanda::MainLoop::run();
+
+Similarly, a tight loop of callbacks with no blocking operations can
+lead to excessive stack consumption.  In this case, C<call_later()> is
+useful, too. It queues the callback to run at the next cycle of the
+MainLoop:
+
+    sub might_delay {
+        my ($cb) = @_;
+        if (can_do_it_now()) {
+            my $result = do_it();
+            Amanda::MainLoop::call_later($cb, $result)
+        } else {
+            # ..
+        }
+    }
+
+=head2 EVENT SOURCES
+
+An event source is responsible for producing events.  A source may produce
+multiple events over its lifetime.
+
+The method C<$src->set_callback(\&cb)> sets the function that will be called
+for a given source, and "attaches" the source to the main loop so that it will
+begin generating events.  The arguments to the callback depend on the event
+source, but the first argument is always the source itself.  Unless specified,
+no other arguments are provided.
+
+Event sources persist until they are removed with C<$src->remove()>, even if
+the source itself is no longer accessible from Perl.  Although Glib supports
+it, there is no provision for "automatically" removing an event source.  As an
+example:
+
+  sub start_timer { 
+    my ($loops) = @_;
+
+    Amanda::MainLoop::timeout_source(200)->set_callback(sub {
+      my ($src) = @_;
+      print "timer\n";
+      if (--$loops <= 0) {
+        $src->remove();
+        Amanda::MainLoop::quit();
+      }
+    });
+  }
+  start_timer(10);
+  Amanda::MainLoop::run();
+
+=head3 Timeout
+
+  my $src = Amanda::MainLoop::timeout_source(10000);
+
+A timeout source will create events at the specified interval, specified in
+milliseconds (thousandths of a second).  The events will continue until the
+source is destroyed.
+
+=head3 Idle
+
+  my $src = Amanda::MainLoop::idle_source(2);
+
+An idle source will create events continuously except when a higher-priority
+source is emitting events.  Priorities are generally small positive integers,
+with larger integers denoting lower priorities.  The events will continue until
+the source is destroyed.
+
+=head3 Child Watch
+
+  my $src = Amanda::MainLoop::child_watch_source($pid);
+
+A child watch source will issue an event when the process with the given PID
+dies.  To avoid race conditions, it will issue an event even if the process
+dies before the source is created.  The callback is called with three
+arguments: the event source, the PID, and the child's exit status.
+
+Note that this source is totally incompatible with any thing that would cause
+perl to change the SIGCHLD handler.  If SIGCHLD is changed, under some
+circumstances the module will recognize this circumstance, add a warning to the
+debug log, and continue operating.  However, it is impossible to catch all
+possible situations.
+
+=head3 File Descriptor
+
+  my $src = Amanda::MainLoop::fd_source($fd, G_IO_IN);
+
+This source will issuen an event whenever one of the given conditions is true
+for the given file descriptor.  The conditions are from Glib's GIOCondition,
+and are C<$G_IO_IN>, C<G_IO_OUT>, C<$G_IO_PRI>, C<$G_IO_ERR>, C<$G_IO_HUP>, and
+C<$G_IO_NVAL>.  These constants are available with the import tag
+C<:GIOCondition>.
+
+Generally, when reading from a file descriptor, use C<$G_IO_IN|$G_IO_HUP> to
+ensure that an EOF triggers an event as well.  Writing to a file descriptor can
+simply use C<$G_IO_OUT>.
+
+=head1 RELATION TO GLIB
+
+Glib's main event loop is described in the Glib manual:
+L<http://library.gnome.org/devel/glib/stable/glib-The-Main-Event-Loop.html>.
+Note that Amanda depends only on the functionality available in Glib-2.2.0, so
+many functions described in that document are not available in Amanda.  This
+module provides a much-simplified interface to the glib library, and is not
+intended as a generic wrapper for it.  Specifically:
+
+=over
+
+=item Amanda's perl-accessible main loop only runs a single C<GMainContext>, and
+always runs in the main thread.
+
+=item Besides idle sources, event priorities are not accessible from Perl.
+
+=back
+
+=head1 PROGRAMMING HINTS
+
+Most often, callbacks are short, and can be specified as anonymous subs:
+
+    $src->set_callback(sub {
+       my ($src) = @_;
+       # ...
+    });
+
+There is currently no means in place to specify extra arguments for a callback
+when it is set.  If the callback needs access to other data, it should use a
+Perl closure in the form of lexically scoped variables and a (possibly
+anonymous) sub:
+
+    {
+       my $total_results = 0;
+
+       $src->set_callback(sub {
+           my ($src, $result) = @_;
+           $total_results += $result;
+       });
+    }
+
+Event sources are often set up in groups, e.g., a long-term operation and a
+timeout.  When this is the case, be careful that all sources are removed when
+the operation is complete.  The easiest way to accomplish this is to include all
+sources in a lexical scope and remove them at the appropriate times:
+
+    {
+       my $op_src = long_operation_src();
+       my $timeout_src = Amanda::MainLoop::timeout_source($timeout);
+
+       sub finish {
+           $op_src->remove();
+           $timeout_src->remove();
+       }
+
+       $op_src->set_callback(sub {
+           print "Operation complete\n";
+           finish();
+       });
+
+       $timeout_src->set_callback(sub {
+           print "Operation timed out\n";
+           finish();
+       });
+    }
+
+Both of these limitations may be lifted in future revisions of
+L<Amanda::MainLoop>.
+
+=cut
+%}
+
+/*
+ * Looping
+ */
+
+%perlcode %{
+# glib's g_is_main_loop_running() seems inaccurate, so we just
+# track that information locally..
+my $mainloop_running = 0;
+
+my @waiting_to_call_later;
+sub call_later {
+    my ($sub, @args) = @_;
+
+    # add the callback if nothing is waiting right now
+    if (!@waiting_to_call_later) {
+        timeout_source(0)->set_callback(sub {
+            my ($src) = @_;
+            $src->remove();
+
+            while (@waiting_to_call_later) {
+                my ($sub, @args) = @{pop @waiting_to_call_later};
+                $sub->(@args);
+            }
+        });
+    }
+
+    push @waiting_to_call_later, [ $sub, @args ];
+}
+
+sub run {
+    $mainloop_running = 1;
+    run_c();
+    $mainloop_running = 0;
+}
+
+sub is_running {
+    return $mainloop_running;
+}
+%}
+
+%inline %{
+void run_c(void) {
+    g_main_loop_run(default_main_loop());
+}
+
+void quit(void) {
+    g_main_loop_quit(default_main_loop());
+}
+%}
+
+/*
+ * Event Sources
+ */
+
+/* First we wrap the amglue_Source struct, defined in
+ * perl/amglue/mainloop.h, into a Perl object (named
+ * Amanda::MainLoop::Source).  After that appear several 
+ * constructors for various event sources.
+ */
+
+%{ static void amglue_source_remove(amglue_Source *self); %}
+
+%rename(Source) amglue_Source;
+typedef struct amglue_Source {
+    %extend {
+       /* Constructor: use one of the package-level functions, below */
+       amglue_Source() {
+           die("Amanda::MainLoop::Source is an abstract base class");
+       }
+
+       /* Destructor: just unref the object */
+       ~amglue_Source() {
+           amglue_source_unref(self);
+       }
+
+       /* a "cheater's typemap" to just pass the SV along */
+       %typemap(in) SV *callback_sub "$1 = $input;"
+       void set_callback(SV *callback_sub) {
+           /* Attach the source to the default mainloop context, so
+            * that it will start generating events.  If it's already
+            * been destroyed, then bail with a fatal error.
+            */
+           if (self->state == AMGLUE_SOURCE_DESTROYED) {
+               die("This source has already been removed");
+           } else if (self->state == AMGLUE_SOURCE_NEW) {
+               self->state = AMGLUE_SOURCE_ATTACHED;
+
+               g_source_attach(self->src, NULL);
+
+               /* the link from the GSource to the amglue_Source is
+                * now in use, so we increment the amglue_Source's 
+                * refcount. */
+               amglue_source_ref(self);
+           }
+
+           /* whoever created this Source object conveniently left
+            * the proper C-side callback for us.  This function has
+            * the appropriate calling signature for this GSource, and
+            * knows how to reflect that into Perl.  It expects the SV to
+            * be provided as its 'data' argument.  'perlcall' suggests
+            * that we make a copy of this SV, in case the user later
+            * modifies it. */
+           if (self->callback_sv) {
+               SvSetSV(self->callback_sv, callback_sub);
+           } else {
+               self->callback_sv = newSVsv(callback_sub);
+               g_source_set_callback(self->src, self->callback,
+                   (gpointer)self, NULL);
+           }
+       }
+       /* delete the cheater's typemap */
+       %typemap(in) SV *sv;
+
+       void remove(void) {
+           amglue_source_remove(self);
+       }
+    }
+} amglue_Source;
+
+%{
+/* Detach a source from the mainloop and remove it from play.  This is broken
+ * out as a separate function because it's also used from some callbacks */
+static void
+amglue_source_remove(
+    amglue_Source *self)
+{
+    /* protect against self being freed out from under us */
+    amglue_source_ref(self);
+
+    if (self->state == AMGLUE_SOURCE_ATTACHED) {
+       /* unref any perl callback */
+       if (self->callback_sv) {
+           SvREFCNT_dec(self->callback_sv);
+           self->callback_sv = NULL;
+       }
+
+       /* undo the ref made in set_callback() */
+       amglue_source_unref(self);
+
+       g_source_destroy(self->src);
+    }
+
+    self->state = AMGLUE_SOURCE_DESTROYED;
+
+    /* reverse the "protection" increment used above */
+    amglue_source_unref(self);
+}
+%}
+
+/* "Generic" callback function for a GSource that actually uses the GSourceFunc
+ * prototype.  The source of this function also serves as a prototype for other,
+ * more advanced callbacks.  Due to perl's heavy use of precompiler macros, it's
+ * not possible to break this down any further. */
+%{
+static gboolean
+amglue_source_callback_simple(
+    gpointer *data)
+{
+    dSP;
+    amglue_Source *src = (amglue_Source *)data;
+    SV *src_sv = NULL;
+
+    g_assert(src->callback_sv != NULL);
+
+    ENTER;
+    SAVETMPS;
+
+    /* create a new SV pointing to 'src', and increase our refcount
+     * accordingly.  The SV is mortal, so FREETMPS will decrease the 
+     * refcount, unless the callee keeps a copy of it somewhere */
+    amglue_source_ref(src);
+    src_sv = SWIG_NewPointerObj(src, SWIGTYPE_p_amglue_Source,
+                                SWIG_OWNER | SWIG_SHADOW);
+
+    PUSHMARK(SP);
+    XPUSHs(src_sv);
+    PUTBACK;
+
+    call_sv(src->callback_sv, G_EVAL|G_DISCARD);
+
+    FREETMPS;
+    LEAVE;
+
+    /* these may have been freed, so don't use them after this point */
+    src_sv = NULL;
+    src = NULL;
+
+    /* check for an uncaught 'die'.  If we don't do this, then Perl will longjmp()
+     * over the GMainLoop mechanics, leaving GMainLoop in an inconsistent (locked)
+     * state. */
+    if (SvTRUE(ERRSV)) {
+       /* We handle this just the way the default 'die' handler in Amanda::Debug 
+        * does, but since Amanda's debug support may not yet be running, we back
+        * it up with an exit() */
+       g_critical("%s", SvPV_nolen(ERRSV));
+       exit(1);
+    }
+
+    return TRUE;
+}
+%}
+
+/* Constructors for some general-purpose sources */
+
+/* timeout source */
+%newobject timeout_source;
+%inline %{
+amglue_Source *
+timeout_source(
+    guint interval)
+{
+    return amglue_source_new(g_timeout_source_new(interval), 
+       (GSourceFunc)amglue_source_callback_simple);
+}
+%}
+
+/* idle source */
+%newobject idle_source;
+%inline %{
+amglue_Source *
+idle_source(
+    gint priority)
+{
+    GSource *idle_source = g_idle_source_new();
+    g_source_set_priority(idle_source, priority);
+    return amglue_source_new(idle_source,
+       (GSourceFunc)amglue_source_callback_simple);
+}
+%}
+
+/* child watch source */
+%{
+static gboolean
+child_watch_source_callback(
+    pid_t pid,
+    gint status,
+    gpointer data)
+{
+    dSP;
+    amglue_Source *src = (amglue_Source *)data;
+    SV *src_sv;
+
+    g_assert(src->callback_sv != NULL);
+
+    ENTER;
+    SAVETMPS;
+
+    /* create a new SV pointing to 'src', and increase our refcount
+     * accordingly.  The SV is mortal, so FREETMPS will decrease the 
+     * refcount, unless the callee keeps a copy of it somewhere */
+    amglue_source_ref(src);
+    src_sv = SWIG_NewPointerObj(src, SWIGTYPE_p_amglue_Source,
+                                SWIG_OWNER | SWIG_SHADOW);
+
+    PUSHMARK(SP);
+    XPUSHs(src_sv);
+    XPUSHs(sv_2mortal(newSViv(pid)));
+    XPUSHs(sv_2mortal(newSViv(status)));
+    PUTBACK;
+
+    call_sv(src->callback_sv, G_EVAL|G_DISCARD);
+
+    /* child watch sources automatically destroy themselves after the
+     * child dies, so we mark the amglue_Source as destroyed, too. */
+    amglue_source_remove(src);
+
+    FREETMPS;
+    LEAVE;
+
+    /* these may have been freed, so don't use them after this point */
+    src_sv = NULL;
+    src = NULL;
+
+    /* check for an uncaught 'die'.  If we don't do this, then Perl will longjmp()
+     * over the GMainLoop mechanics, leaving GMainLoop in an inconsistent (locked)
+     * state. */
+    if (SvTRUE(ERRSV)) {
+       /* We handle this just the way the default 'die' handler in Amanda::Debug 
+        * does, but since Amanda's debug support may not yet be running, we back
+        * it up with an exit() */
+       g_critical("%s", SvPV_nolen(ERRSV));
+       exit(1);
+    }
+
+    return TRUE;
+}
+%}
+%newobject child_watch_source;
+%inline %{
+amglue_Source *
+child_watch_source(
+    gint pid)
+{
+    GSource *child_watch_source = new_child_watch_source(pid);
+    return amglue_source_new(child_watch_source,
+       (GSourceFunc)child_watch_source_callback);
+}
+%}
+
+/* fd source */
+%apply gint { GIOCondition };
+amglue_add_flag_tag_fns(GIOCondition);
+amglue_add_constant(G_IO_IN, GIOCondition);
+amglue_add_constant(G_IO_OUT, GIOCondition);
+amglue_add_constant(G_IO_PRI, GIOCondition);
+amglue_add_constant(G_IO_ERR, GIOCondition);
+amglue_add_constant(G_IO_HUP, GIOCondition);
+amglue_add_constant(G_IO_NVAL, GIOCondition);
+amglue_copy_to_tag(GIOCondition, constants);
+
+%newobject fd_source;
+%inline %{
+amglue_Source *
+fd_source(
+    gint fd,
+    GIOCondition events)
+{
+    GSource *fdsource = new_fdsource(fd, events);
+    return amglue_source_new(fdsource,
+       (GSourceFunc)amglue_source_callback_simple);
+}
+%}
index 501bffa7211f96295dd2525795554ad381fa599e..bddc5e92d594e9237a6f8c67f80b632b07f43ff7 100644 (file)
@@ -1,5 +1,5 @@
 # vim:ft=perl
-# Copyright (c) 2006 Zmanda Inc.  All Rights Reserved.
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License version 2 as published
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 #
-# Contact information: Zmanda Inc, 505 N Mathlida Ave, Suite 120
-# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 
 package Amanda::Paths;
 
 =head1 NAME
 
-Amanda::Paths - perl access to build-time configuration values
+Amanda::Paths - perl access to build-time configuration paths
 
 =head1 SYNOPSIS
 
@@ -51,10 +51,14 @@ use Exporter;
     $amlibexecdir
     $mandir
     $datarootdir
+    $sysconfdir
+    $amdatadir
 
     $AMANDA_TMPDIR
     $CONFIG_DIR
     $AMANDA_DBGDIR
+    $APPLICATION_DIR
+    $GNUTAR_LISTED_INCREMENTAL_DIR
 );
 
 # the 'warnings' pragma doesn't recognized exported variables as "used", and generates warnings
@@ -73,9 +77,15 @@ $amlibexecdir = "@amlibexecdir@";
 $mandir = "@mandir@";
 # (config.status worries if it doesn't see this:)
 $datarootdir = "@datarootdir@";
+$sysconfdir = "@sysconfdir@";
+$amdatadir = "@amdatadir@";
 
 ## amanda configuration directories
 
 $AMANDA_TMPDIR = "@AMANDA_TMPDIR@";
 $CONFIG_DIR = "@CONFIG_DIR@";
 $AMANDA_DBGDIR = "@AMANDA_DBGDIR@";
+$APPLICATION_DIR = "@APPLICATION_DIR@";
+$GNUTAR_LISTED_INCREMENTAL_DIR = "@GNUTAR_LISTED_INCREMENTAL_DIR@";
+
+1;
diff --git a/perl/Amanda/Process.pm b/perl/Amanda/Process.pm
new file mode 100644 (file)
index 0000000..fe72a08
--- /dev/null
@@ -0,0 +1,388 @@
+# Copyright (c) 2005-2008 Zmanda, Inc.  All Rights Reserved.
+# 
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License version 2.1 as 
+# published by the Free Software Foundation.
+# 
+# This 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 this library; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+# 
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+package Amanda::Process;
+
+use strict;
+use warnings;
+use Carp;
+use POSIX ();
+use Exporter;
+use vars qw( @ISA @EXPORT_OK );
+use File::Basename;
+use Amanda::Constants;
+@ISA = qw( Exporter );
+
+use Amanda::Paths;
+use Amanda::Util;
+use Amanda::MainLoop qw( :GIOCondition );
+use Amanda::Config;
+use Amanda::Device qw( :constants );
+
+=head1 NAME
+
+Amanda::Process -- interface to process
+
+=head1 SYNOPSIS
+
+  use Amanda::Process;
+
+  Amanda::Process::load_ps_table();
+
+  Amanda::Process::scan_log($logfile);
+
+  Amanda::Process::add_child();
+
+  Amanda::Process::set_master($pname, $pid);
+
+  Amanda::Process::kill_process($signal);
+
+  my $count = Amanda::Process::process_running();
+
+  my $count = Amanda::Process::count_process();
+
+  my $alive = Amanda::Process::process_alive($pid, $pname);
+
+=head1 API STATUS
+
+Stable
+
+=head1 INTERFACE
+
+This module provides an object-oriented interface to track process used by
+amanda.
+
+my $Amanda_process = Amanda::Process->new($verbose);
+
+=over
+
+=item load_ps_table
+
+  $Amanda_process->load_ps_table();
+
+Load a table of all processes in the system.
+
+=item scan_log
+
+  $Amanda_process->scan_log($logfile);
+
+Parse all 'pid' and 'pid-done' lines of the logfile.
+
+=item add_child
+
+  $Amanda_process->add_child();
+
+Add all children of already known amanda processes.
+
+=item set_master
+
+  $Amanda_process->set_master($pname, $pid);
+
+Set $Amanda_process->{master_pname} and $Amanda_process->{master_pid}.
+
+=item kill_process
+
+  $Amanda_process->kill_process($signal);
+
+Send the $signal to all amanda processes.
+
+=item process_running
+
+  my $count = $Amanda_process->process_running();
+
+Return the number of amanda process alive.
+
+=item count_process
+
+  my $count = $Amanda_process->count_process();
+
+Return the number of amanda process in the table.
+
+=item process_alive
+
+  my $alive = Amanda::Process::process_alive($pid, $pname);
+
+Return 0 if the process is not alive.
+Return 1 if the process is still alive.
+
+=back
+
+=cut
+
+sub new {
+    my $class = shift;
+    my ($verbose) = shift;
+
+    my $self = {
+       verbose => $verbose,
+       master_name => "",
+       master_pid => "",
+       pids => {},
+       pstable => {},
+       ppid => {},
+    };
+    bless ($self, $class);
+    return $self;
+}
+
+# Get information about the current set of processes, using ps -e
+# and ps -ef.
+#
+# Side effects:
+# - sets %pstable to a map (pid => process name) of all running
+#   processes
+# - sets %ppid to a map (pid -> parent pid) of all running
+#   processes' parent pids
+#
+sub load_ps_table() {
+    my $self = shift;
+    $self->{pstable} = {};
+    $self->{ppid} = ();
+    my $ps_argument = $Amanda::Constants::PS_ARGUMENT;
+    if ($ps_argument eq "CYGWIN") {
+       open(PSTABLE, "-|", "ps -ef") || die("ps -ef: $!");
+       my $psline = <PSTABLE>; #header line
+       while($psline = <PSTABLE>) {
+           chomp $psline;
+           my @psline = split " ", $psline;
+           my $pid = $psline[1];
+           my $ppid = $psline[2];
+           my $stime = $psline[4];
+           my $pname;
+           if ($stime =~ /:/) {  # 10:32:44
+               $pname = basename($psline[5])
+           } else {              # May 22
+               $pname = basename($psline[6])
+           }
+           $self->{pstable}->{$pid} = $pname;
+           $self->{ppid}->{$pid} = $ppid;
+       }
+       close(PSTABLE);
+    } else {
+       open(PSTABLE, "-|", "$Amanda::Constants::PS $ps_argument")
+           or die("$Amanda::Constants::PS $ps_argument: $!");
+       my $psline = <PSTABLE>; #header line
+       while($psline = <PSTABLE>) {
+           chomp $psline;
+           my ($pid, $ppid, $pname) = split " ", $psline;
+           $pname = basename($pname);
+           $self->{pstable}->{$pid} = $pname;
+           $self->{ppid}->{$pid} = $ppid;
+       }
+       close(PSTABLE);
+    }
+}
+
+# Scan a logfile for processes that should still be running: processes
+# having an "INFO foo bar pid 1234" line in the log, but no corresponding
+# "INFO pid-done 1234", and only if pid 1234 has the correct process
+# name.
+#
+# Prerequisites:
+#  %pstable must be set up (use load_ps_table)
+#
+# Side effects:
+# - sets %pids to a map (pid => process name) of all still-running
+#   Amanda processes
+# - sets $master_pname to the top-level process for this run (e.g.,
+#   amdump, amflush)
+# - sets $master_pid to the pid of $master_pname
+#
+# @param $logfile: the logfile to scan
+#
+sub scan_log($) {
+    my $self = shift;
+    my $logfile = shift;
+    my $first = 1;
+    my($line);
+
+    open(LOGFILE, "<", $logfile) || die("$logfile: $!");
+    while($line = <LOGFILE>) {
+       if ($line =~ /^INFO .* (.*) pid (\d*)$/) {
+           my ($pname, $pid) = ($1, $2);
+           if ($first == 1) {
+               $self->{master_pname} = $pname;
+               $self->{master_pid} = $pid;
+               $first = 0;
+           }
+           if (defined $self->{pstable}->{$pid} && $pname eq $self->{pstable}->{$pid}) {
+               $self->{pids}->{$pid} = $pname;
+           } elsif (defined $self->{pstable}->{$pid}) {
+               print "pid $pid doesn't match: ", $pname, " != ", $self->{pstable}->{$pid}, "\n" if $self->{verbose};
+           }
+       } elsif ($line =~ /^INFO .* pid-done (\d*)$/) {
+           my $pid = $1;
+           print "pid $pid is done\n" if $self->{verbose};
+           delete $self->{pids}->{$pid};
+       }
+    }
+    close(LOGFILE);
+
+    # log unexpected dead process
+    if ($self->{verbose}) {
+       for my $pid (keys %{$self->{pids}}) {
+           if (!defined $self->{pstable}->{$pid}) {
+               print "pid $pid is dead\n";
+           }
+       }
+    }
+}
+
+# Recursive function to add all child processes of $pid to %amprocess.
+#
+# Prerequisites:
+# - %ppid must be set (load_ps_table)
+#
+# Side-effects:
+# - adds all child processes of $pid to %amprocess
+#
+# @param $pid: the process to start at
+#
+sub add_child_pid($);
+sub add_child_pid($) {
+    my $self = shift;
+    my $pid = shift;
+    foreach my $cpid (keys %{$self->{ppid}}) {
+       my $ppid = $self->{ppid}->{$cpid};
+       if ($pid == $ppid) {
+           if (!defined $self->{amprocess}->{$cpid}) {
+               $self->{amprocess}->{$cpid} = $cpid;
+               $self->add_child_pid($cpid);
+           }
+       }
+    }
+}
+
+# Find all children of all amanda processes, as determined by traversing
+# the process graph (via %ppid).
+#
+# Prerequisites:
+# - %ppid must be set (load_ps_table)
+# - %pids must be set (scan_log)
+#
+# Side-effects:
+# - sets %amprocess to a map (pid => pid) of all amanda processes, including
+#   children
+#
+sub add_child() {
+    my $self = shift;
+    foreach my $pid (keys %{$self->{pids}}) {
+       if (defined $pid) {
+           $self->{amprocess}->{$pid} = $pid;
+       }
+    }
+
+    foreach my $pid (keys %{$self->{pids}}) {
+       $self->add_child_pid($pid);
+    }
+}
+
+# Set master_pname and master_pid.
+#
+# Side-effects:
+# - sets $master_pname and $master_pid.
+#
+sub set_master($$) {
+    my $self = shift;
+    my $pname = shift;
+    my $pid = shift;
+
+    $self->{master_pname} = $pname;
+    $self->{master_pid} = $pid;
+    $self->{pids}->{$pid} = $pname;
+}
+
+# Send a signal to all amanda process
+#
+# Side-effects:
+# - All amanda process receive the signal.
+#
+# Prerequisites:
+# - %amprocess must be set (add_child)
+#
+# @param $signal: the signal to send
+#
+sub kill_process($) {
+    my $self = shift;
+    my $signal = shift;
+
+    foreach my $pid (keys %{$self->{amprocess}}) {
+       print "Sendding $signal signal to pid $pid\n" if $self->{verbose};
+       kill $signal, $pid;
+    }
+}
+
+# Count the number of processes in %amprocess that are still running.  This
+# re-runs 'ps -e' every time, so calling it repeatedly may result in a
+# decreasing count.
+#
+# Prerequisites:
+# - %amprocess must be set (add_child)
+#
+# @returns: number of pids in %amprocess that are still alive
+sub process_running() {
+    my $self = shift;
+
+    $self->load_ps_table();
+    my $count = 0;
+    foreach my $pid (keys %{$self->{amprocess}}) {
+       if (defined $self->{pstable}->{$pid}) {
+           $count++;
+       }
+    }
+
+    return $count;
+}
+
+# Count the number of processes in %amprocess.
+#
+# Prerequisites:
+# - %amprocess must be set (add_child)
+#
+# @returns: number of pids in %amprocess.
+sub count_process() {
+    my $self = shift;
+
+    return scalar keys( %{$self->{amprocess}} );
+}
+
+# return if a process is alive.  If $pname is provided,
+# only returns 1 if the name matches.
+#
+# Prerequisites:
+# - %pstable must be set (load_ps_table)
+#
+# @param $pid: the pid of the process
+# @param $pname: the name of the process (optional)
+#
+# @returns: 1 if process is alive
+#           '' if process is dead
+
+sub process_alive() {
+    my $self = shift;
+    my $pid = shift;
+    my $pname = shift;
+
+    if (defined $pname && defined $self->{pstable}->{$pid}) {
+       return $self->{pstable}->{$pid} eq $pname;
+    } else {
+       return defined $self->{pstable}->{$pid};
+    }
+}
+
+1;
diff --git a/perl/Amanda/Script.pm b/perl/Amanda/Script.pm
new file mode 100644 (file)
index 0000000..3e96dfe
--- /dev/null
@@ -0,0 +1,90 @@
+# vim:ft=perl
+# Copyright (c) 2005-2008 Zmanda, Inc.  All Rights Reserved.
+#
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License version 2.1 as
+# published by the Free Software Foundation.
+#
+# This 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 this library; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+#
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+package Amanda::Script;
+use base qw(Amanda::Script_App);
+
+use strict;
+use warnings;
+
+=head1 NAME
+
+Amanda::Script - perl utility functions for Scripts.
+
+=head1 SYNOPSIS
+
+  package Amanda::Script::my_script;
+  use base qw(Amanda::Script);
+
+  sub new {
+    my $class = shift;
+    my ($execute_where, $foo, $bar) = @_;
+    my $self = $class->SUPER::new($execute_where);
+    $self->{'execute_where'} = $execute_where;
+    $self->{'foo'} = $foo;
+    $self->{'bar'} = $bar;
+
+    return $self;
+  }
+
+  # Define all command_* subs that you need, e.g.,
+  sub command_pre_dle_amcheck {
+    my $self = shift;
+    # ...
+  }
+
+  package main;
+
+  # .. parse arguments ..
+  my $script = Amanda::Script::my_script->new($opt_execute_where, $opt_foo, $opt_bar);
+  $script->do($cmd);
+
+=cut
+
+sub new {
+    my $class = shift;
+    my $execute_where = shift;
+
+    my $self = Amanda::Script_App::new($class, $execute_where, "script", @_);
+
+    $self->{known_commands} = {
+        support             => 1,
+        pre_dle_amcheck     => 1,
+        pre_host_amcheck    => 1,
+        post_dle_amcheck    => 1,
+        post_host_amcheck   => 1,
+        pre_dle_estimate    => 1,
+        pre_host_estimate   => 1,
+        post_dle_estimate   => 1,
+        post_host_estimate  => 1,
+        pre_dle_backup      => 1,
+        pre_host_backup     => 1,
+        post_dle_backup     => 1,
+        post_host_backup    => 1,
+        pre_recover         => 1,
+        post_recover        => 1,
+        pre_level_recover   => 1,
+        post_level_recover  => 1,
+        inter_level_recover => 1,
+    };
+    return $self;
+}
+
+
+1;
diff --git a/perl/Amanda/Script_App.pm b/perl/Amanda/Script_App.pm
new file mode 100644 (file)
index 0000000..33c5f8c
--- /dev/null
@@ -0,0 +1,172 @@
+# vim:ft=perl
+# Copyright (c) 2005-2008 Zmanda, Inc.  All Rights Reserved.
+#
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License version 2.1 as
+# published by the Free Software Foundation.
+#
+# This 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 this library; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+#
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+package Amanda::Script_App;
+
+no warnings;
+no strict;
+$GOOD  = 0;
+$ERROR = 1;
+
+use strict;
+use warnings;
+use Amanda::Constants;
+use Amanda::Config qw( :init :getconf  config_dir_relative );
+use Amanda::Debug qw( :logging );
+use Amanda::Paths;
+use Amanda::Util qw( :constants );
+
+=head1 NAME
+
+Amanda::Script - perl utility functions for Scripts.
+
+=head1 SYNOPSIS
+
+=cut
+
+sub new {
+    my $class = shift;
+    my $execute_where = shift;
+    my $type = shift;
+
+    my $self = {};
+    bless ($self, $class);
+
+    # extract the last component of the class name
+    my $name = $class;
+    $name =~ s/^.*:://;
+    $self->{'name'} = $name;
+
+    if(!defined $execute_where) {
+       $execute_where = "client";
+    }
+    Amanda::Util::setup_application($name, $execute_where, $CONTEXT_DAEMON);
+
+    #initialize config client to get values from amanda-client.conf
+    config_init($CONFIG_INIT_CLIENT, undef);
+    my ($cfgerr_level, @cfgerr_errors) = config_errors();
+    if ($cfgerr_level >= $CFGERR_WARNINGS) {
+        config_print_errors();
+        if ($cfgerr_level >= $CFGERR_ERRORS) {
+            die("errors processing config file");
+        }
+    }
+
+    Amanda::Util::finish_setup($RUNNING_AS_ANY);
+
+    $self->{'suf'} = '';
+    if ( $Amanda::Constants::USE_VERSION_SUFFIXES =~ /^yes$/i ) {
+        $self->{'suf'} = "-$Amanda::Constants::VERSION";
+    }
+
+    $self->{error_status} = $Amanda::Script_App::GOOD;
+    $self->{type} = $type;
+    $self->{known_commands} = {};
+
+    debug("$type: $name\n");
+
+    return $self;
+}
+
+
+#$_[0] action
+#$_[1] message
+#$_[2] status: GOOD or ERROR
+sub print_to_server {
+    my $self = shift;
+    my($action,$msg, $status) = @_;
+    if ($status != 0) {
+        $self->{error_status} = $status;
+    }
+    if ($action eq "check") {
+       if ($status == $Amanda::Script_App::GOOD) {
+            print STDOUT "OK $msg\n";
+       } else {
+            print STDOUT "ERROR $msg\n";
+       }
+    } elsif ($action eq "estimate") {
+       if ($status == $Amanda::Script_App::GOOD) {
+            #do nothing
+       } else {
+            print STDERR "ERROR $msg\n";
+       }
+    } elsif ($action eq "backup") {
+       if ($status == $Amanda::Script_App::GOOD) {
+            print {$self->{mesgout}} "| $msg\n";
+       } else {
+            print {$self->{mesgout}} "? $msg\n";
+       }
+    } elsif ($action eq "restore") {
+        print STDOUT "$msg\n";
+    } elsif ($action eq "validate") {
+        print STDERR "$msg\n";
+    } else {
+        print STDERR "$msg\n";
+    }
+}
+
+#$_[0] action
+#$_[1] message
+#$_[2] status: GOOD or ERROR
+sub print_to_server_and_die {
+    my $self = shift;
+
+    my $action = $_[0];
+    $self->print_to_server( @_ );
+    if (!defined $self->{die} && $self->can("check_for_backup_failure")) {
+       $self->{die} = 1;
+       $self->check_for_backup_failure($action);
+    }
+    exit 1;
+}
+
+
+sub do {
+    my $self = shift;
+    my $command  = shift;
+
+    if (!defined $command) {
+       $self->print_to_server_and_die("check", "no command",
+                                      $Amanda::Script_App::ERROR);
+       return;
+    }
+    $command =~ tr/A-Z-/a-z_/;
+    debug("command: $command");
+
+    # first make sure this is a valid command.
+    if (!exists($self->{known_commands}->{$command})) {
+       print STDERR "Unknown command `$command'.\n";
+       exit 1;
+    }
+
+    # now convert it to a function name and see if it's
+    # defined
+    my $function_name = "command_$command";
+
+    if (!$self->can($function_name)) {
+        print STDERR "command `$command' is not supported by the '" .
+                     $self->{name} . "' " . $self->{type} . ".\n";
+        exit 1;
+    }
+
+    # it exists -- call it
+    $self->$function_name();
+}
+
+1;
diff --git a/perl/Amanda/Tapefile.c b/perl/Amanda/Tapefile.c
deleted file mode 100644 (file)
index 9f5c2fb..0000000
+++ /dev/null
@@ -1,1922 +0,0 @@
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.33
- * 
- * This file is not intended to be easily readable and contains a number of 
- * coding conventions designed to improve portability and efficiency. Do not make
- * changes to this file unless you know what you are doing--modify the SWIG 
- * interface file instead. 
- * ----------------------------------------------------------------------------- */
-
-#define SWIGPERL
-#define SWIG_CASTRANK_MODE
-/* -----------------------------------------------------------------------------
- *  This section contains generic SWIG labels for method/variable
- *  declarations/attributes, and other compiler dependent labels.
- * ----------------------------------------------------------------------------- */
-
-/* template workaround for compilers that cannot correctly implement the C++ standard */
-#ifndef SWIGTEMPLATEDISAMBIGUATOR
-# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
-#  define SWIGTEMPLATEDISAMBIGUATOR template
-# elif defined(__HP_aCC)
-/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
-/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
-#  define SWIGTEMPLATEDISAMBIGUATOR template
-# else
-#  define SWIGTEMPLATEDISAMBIGUATOR
-# endif
-#endif
-
-/* inline attribute */
-#ifndef SWIGINLINE
-# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
-#   define SWIGINLINE inline
-# else
-#   define SWIGINLINE
-# endif
-#endif
-
-/* attribute recognised by some compilers to avoid 'unused' warnings */
-#ifndef SWIGUNUSED
-# if defined(__GNUC__)
-#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-#     define SWIGUNUSED __attribute__ ((__unused__)) 
-#   else
-#     define SWIGUNUSED
-#   endif
-# elif defined(__ICC)
-#   define SWIGUNUSED __attribute__ ((__unused__)) 
-# else
-#   define SWIGUNUSED 
-# endif
-#endif
-
-#ifndef SWIGUNUSEDPARM
-# ifdef __cplusplus
-#   define SWIGUNUSEDPARM(p)
-# else
-#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
-# endif
-#endif
-
-/* internal SWIG method */
-#ifndef SWIGINTERN
-# define SWIGINTERN static SWIGUNUSED
-#endif
-
-/* internal inline SWIG method */
-#ifndef SWIGINTERNINLINE
-# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
-#endif
-
-/* exporting methods */
-#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
-#  ifndef GCC_HASCLASSVISIBILITY
-#    define GCC_HASCLASSVISIBILITY
-#  endif
-#endif
-
-#ifndef SWIGEXPORT
-# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
-#   if defined(STATIC_LINKED)
-#     define SWIGEXPORT
-#   else
-#     define SWIGEXPORT __declspec(dllexport)
-#   endif
-# else
-#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
-#     define SWIGEXPORT __attribute__ ((visibility("default")))
-#   else
-#     define SWIGEXPORT
-#   endif
-# endif
-#endif
-
-/* calling conventions for Windows */
-#ifndef SWIGSTDCALL
-# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
-#   define SWIGSTDCALL __stdcall
-# else
-#   define SWIGSTDCALL
-# endif 
-#endif
-
-/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
-#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
-# define _CRT_SECURE_NO_DEPRECATE
-#endif
-
-/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
-#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
-# define _SCL_SECURE_NO_DEPRECATE
-#endif
-
-
-/* -----------------------------------------------------------------------------
- * swigrun.swg
- *
- * This file contains generic CAPI SWIG runtime support for pointer
- * type checking.
- * ----------------------------------------------------------------------------- */
-
-/* This should only be incremented when either the layout of swig_type_info changes,
-   or for whatever reason, the runtime changes incompatibly */
-#define SWIG_RUNTIME_VERSION "3"
-
-/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
-#ifdef SWIG_TYPE_TABLE
-# define SWIG_QUOTE_STRING(x) #x
-# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
-# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
-#else
-# define SWIG_TYPE_TABLE_NAME
-#endif
-
-/*
-  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
-  creating a static or dynamic library from the swig runtime code.
-  In 99.9% of the cases, swig just needs to declare them as 'static'.
-  
-  But only do this if is strictly necessary, ie, if you have problems
-  with your compiler or so.
-*/
-
-#ifndef SWIGRUNTIME
-# define SWIGRUNTIME SWIGINTERN
-#endif
-
-#ifndef SWIGRUNTIMEINLINE
-# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
-#endif
-
-/*  Generic buffer size */
-#ifndef SWIG_BUFFER_SIZE
-# define SWIG_BUFFER_SIZE 1024
-#endif
-
-/* Flags for pointer conversions */
-#define SWIG_POINTER_DISOWN        0x1
-
-/* Flags for new pointer objects */
-#define SWIG_POINTER_OWN           0x1
-
-
-/* 
-   Flags/methods for returning states.
-   
-   The swig conversion methods, as ConvertPtr, return and integer 
-   that tells if the conversion was successful or not. And if not,
-   an error code can be returned (see swigerrors.swg for the codes).
-   
-   Use the following macros/flags to set or process the returning
-   states.
-   
-   In old swig versions, you usually write code as:
-
-     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
-       // success code
-     } else {
-       //fail code
-     }
-
-   Now you can be more explicit as:
-
-    int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
-    if (SWIG_IsOK(res)) {
-      // success code
-    } else {
-      // fail code
-    }
-
-   that seems to be the same, but now you can also do
-
-    Type *ptr;
-    int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
-    if (SWIG_IsOK(res)) {
-      // success code
-      if (SWIG_IsNewObj(res) {
-        ...
-       delete *ptr;
-      } else {
-        ...
-      }
-    } else {
-      // fail code
-    }
-    
-   I.e., now SWIG_ConvertPtr can return new objects and you can
-   identify the case and take care of the deallocation. Of course that
-   requires also to SWIG_ConvertPtr to return new result values, as
-
-      int SWIG_ConvertPtr(obj, ptr,...) {         
-        if (<obj is ok>) {                            
-          if (<need new object>) {                    
-            *ptr = <ptr to new allocated object>; 
-            return SWIG_NEWOBJ;                       
-          } else {                                    
-            *ptr = <ptr to old object>;               
-            return SWIG_OLDOBJ;                       
-          }                                   
-        } else {                                      
-          return SWIG_BADOBJ;                 
-        }                                             
-      }
-
-   Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
-   more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
-   swig errors code.
-
-   Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
-   allows to return the 'cast rank', for example, if you have this
-
-       int food(double)
-       int fooi(int);
-
-   and you call
-      food(1)   // cast rank '1'  (1 -> 1.0)
-      fooi(1)   // cast rank '0'
-
-   just use the SWIG_AddCast()/SWIG_CheckState()
-
-
- */
-#define SWIG_OK                    (0) 
-#define SWIG_ERROR                 (-1)
-#define SWIG_IsOK(r)               (r >= 0)
-#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)  
-
-/* The CastRankLimit says how many bits are used for the cast rank */
-#define SWIG_CASTRANKLIMIT         (1 << 8)
-/* The NewMask denotes the object was created (using new/malloc) */
-#define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
-/* The TmpMask is for in/out typemaps that use temporal objects */
-#define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
-/* Simple returning values */
-#define SWIG_BADOBJ                (SWIG_ERROR)
-#define SWIG_OLDOBJ                (SWIG_OK)
-#define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
-#define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
-/* Check, add and del mask methods */
-#define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
-#define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
-#define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
-#define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
-#define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
-#define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
-
-
-/* Cast-Rank Mode */
-#if defined(SWIG_CASTRANK_MODE)
-#  ifndef SWIG_TypeRank
-#    define SWIG_TypeRank             unsigned long
-#  endif
-#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
-#    define SWIG_MAXCASTRANK          (2)
-#  endif
-#  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
-#  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
-SWIGINTERNINLINE int SWIG_AddCast(int r) { 
-  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
-}
-SWIGINTERNINLINE int SWIG_CheckState(int r) { 
-  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
-}
-#else /* no cast-rank mode */
-#  define SWIG_AddCast
-#  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
-#endif
-
-
-
-
-#include <string.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef void *(*swig_converter_func)(void *);
-typedef struct swig_type_info *(*swig_dycast_func)(void **);
-
-/* Structure to store inforomation on one type */
-typedef struct swig_type_info {
-  const char             *name;                        /* mangled name of this type */
-  const char             *str;                 /* human readable name of this type */
-  swig_dycast_func        dcast;               /* dynamic cast function down a hierarchy */
-  struct swig_cast_info  *cast;                        /* linked list of types that can cast into this type */
-  void                   *clientdata;          /* language specific type data */
-  int                    owndata;              /* flag if the structure owns the clientdata */
-} swig_type_info;
-
-/* Structure to store a type and conversion function used for casting */
-typedef struct swig_cast_info {
-  swig_type_info         *type;                        /* pointer to type that is equivalent to this type */
-  swig_converter_func     converter;           /* function to cast the void pointers */
-  struct swig_cast_info  *next;                        /* pointer to next cast in linked list */
-  struct swig_cast_info  *prev;                        /* pointer to the previous cast */
-} swig_cast_info;
-
-/* Structure used to store module information
- * Each module generates one structure like this, and the runtime collects
- * all of these structures and stores them in a circularly linked list.*/
-typedef struct swig_module_info {
-  swig_type_info         **types;              /* Array of pointers to swig_type_info structures that are in this module */
-  size_t                 size;                 /* Number of types in this module */
-  struct swig_module_info *next;               /* Pointer to next element in circularly linked list */
-  swig_type_info         **type_initial;       /* Array of initially generated type structures */
-  swig_cast_info         **cast_initial;       /* Array of initially generated casting structures */
-  void                    *clientdata;         /* Language specific module data */
-} swig_module_info;
-
-/* 
-  Compare two type names skipping the space characters, therefore
-  "char*" == "char *" and "Class<int>" == "Class<int >", etc.
-
-  Return 0 when the two name types are equivalent, as in
-  strncmp, but skipping ' '.
-*/
-SWIGRUNTIME int
-SWIG_TypeNameComp(const char *f1, const char *l1,
-                 const char *f2, const char *l2) {
-  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
-    while ((*f1 == ' ') && (f1 != l1)) ++f1;
-    while ((*f2 == ' ') && (f2 != l2)) ++f2;
-    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
-  }
-  return (int)((l1 - f1) - (l2 - f2));
-}
-
-/*
-  Check type equivalence in a name list like <name1>|<name2>|...
-  Return 0 if not equal, 1 if equal
-*/
-SWIGRUNTIME int
-SWIG_TypeEquiv(const char *nb, const char *tb) {
-  int equiv = 0;
-  const char* te = tb + strlen(tb);
-  const char* ne = nb;
-  while (!equiv && *ne) {
-    for (nb = ne; *ne; ++ne) {
-      if (*ne == '|') break;
-    }
-    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
-    if (*ne) ++ne;
-  }
-  return equiv;
-}
-
-/*
-  Check type equivalence in a name list like <name1>|<name2>|...
-  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
-*/
-SWIGRUNTIME int
-SWIG_TypeCompare(const char *nb, const char *tb) {
-  int equiv = 0;
-  const char* te = tb + strlen(tb);
-  const char* ne = nb;
-  while (!equiv && *ne) {
-    for (nb = ne; *ne; ++ne) {
-      if (*ne == '|') break;
-    }
-    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
-    if (*ne) ++ne;
-  }
-  return equiv;
-}
-
-
-/* think of this as a c++ template<> or a scheme macro */
-#define SWIG_TypeCheck_Template(comparison, ty)         \
-  if (ty) {                                             \
-    swig_cast_info *iter = ty->cast;                    \
-    while (iter) {                                      \
-      if (comparison) {                                 \
-        if (iter == ty->cast) return iter;              \
-        /* Move iter to the top of the linked list */   \
-        iter->prev->next = iter->next;                  \
-        if (iter->next)                                 \
-          iter->next->prev = iter->prev;                \
-        iter->next = ty->cast;                          \
-        iter->prev = 0;                                 \
-        if (ty->cast) ty->cast->prev = iter;            \
-        ty->cast = iter;                                \
-        return iter;                                    \
-      }                                                 \
-      iter = iter->next;                                \
-    }                                                   \
-  }                                                     \
-  return 0
-
-/*
-  Check the typename
-*/
-SWIGRUNTIME swig_cast_info *
-SWIG_TypeCheck(const char *c, swig_type_info *ty) {
-  SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
-}
-
-/* Same as previous function, except strcmp is replaced with a pointer comparison */
-SWIGRUNTIME swig_cast_info *
-SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
-  SWIG_TypeCheck_Template(iter->type == from, into);
-}
-
-/*
-  Cast a pointer up an inheritance hierarchy
-*/
-SWIGRUNTIMEINLINE void *
-SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
-  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
-}
-
-/* 
-   Dynamic pointer casting. Down an inheritance hierarchy
-*/
-SWIGRUNTIME swig_type_info *
-SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
-  swig_type_info *lastty = ty;
-  if (!ty || !ty->dcast) return ty;
-  while (ty && (ty->dcast)) {
-    ty = (*ty->dcast)(ptr);
-    if (ty) lastty = ty;
-  }
-  return lastty;
-}
-
-/*
-  Return the name associated with this type
-*/
-SWIGRUNTIMEINLINE const char *
-SWIG_TypeName(const swig_type_info *ty) {
-  return ty->name;
-}
-
-/*
-  Return the pretty name associated with this type,
-  that is an unmangled type name in a form presentable to the user.
-*/
-SWIGRUNTIME const char *
-SWIG_TypePrettyName(const swig_type_info *type) {
-  /* The "str" field contains the equivalent pretty names of the
-     type, separated by vertical-bar characters.  We choose
-     to print the last name, as it is often (?) the most
-     specific. */
-  if (!type) return NULL;
-  if (type->str != NULL) {
-    const char *last_name = type->str;
-    const char *s;
-    for (s = type->str; *s; s++)
-      if (*s == '|') last_name = s+1;
-    return last_name;
-  }
-  else
-    return type->name;
-}
-
-/* 
-   Set the clientdata field for a type
-*/
-SWIGRUNTIME void
-SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
-  swig_cast_info *cast = ti->cast;
-  /* if (ti->clientdata == clientdata) return; */
-  ti->clientdata = clientdata;
-  
-  while (cast) {
-    if (!cast->converter) {
-      swig_type_info *tc = cast->type;
-      if (!tc->clientdata) {
-       SWIG_TypeClientData(tc, clientdata);
-      }
-    }    
-    cast = cast->next;
-  }
-}
-SWIGRUNTIME void
-SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
-  SWIG_TypeClientData(ti, clientdata);
-  ti->owndata = 1;
-}
-  
-/*
-  Search for a swig_type_info structure only by mangled name
-  Search is a O(log #types)
-  
-  We start searching at module start, and finish searching when start == end.  
-  Note: if start == end at the beginning of the function, we go all the way around
-  the circular list.
-*/
-SWIGRUNTIME swig_type_info *
-SWIG_MangledTypeQueryModule(swig_module_info *start, 
-                            swig_module_info *end, 
-                           const char *name) {
-  swig_module_info *iter = start;
-  do {
-    if (iter->size) {
-      register size_t l = 0;
-      register size_t r = iter->size - 1;
-      do {
-       /* since l+r >= 0, we can (>> 1) instead (/ 2) */
-       register size_t i = (l + r) >> 1; 
-       const char *iname = iter->types[i]->name;
-       if (iname) {
-         register int compare = strcmp(name, iname);
-         if (compare == 0) {       
-           return iter->types[i];
-         } else if (compare < 0) {
-           if (i) {
-             r = i - 1;
-           } else {
-             break;
-           }
-         } else if (compare > 0) {
-           l = i + 1;
-         }
-       } else {
-         break; /* should never happen */
-       }
-      } while (l <= r);
-    }
-    iter = iter->next;
-  } while (iter != end);
-  return 0;
-}
-
-/*
-  Search for a swig_type_info structure for either a mangled name or a human readable name.
-  It first searches the mangled names of the types, which is a O(log #types)
-  If a type is not found it then searches the human readable names, which is O(#types).
-  
-  We start searching at module start, and finish searching when start == end.  
-  Note: if start == end at the beginning of the function, we go all the way around
-  the circular list.
-*/
-SWIGRUNTIME swig_type_info *
-SWIG_TypeQueryModule(swig_module_info *start, 
-                     swig_module_info *end, 
-                    const char *name) {
-  /* STEP 1: Search the name field using binary search */
-  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
-  if (ret) {
-    return ret;
-  } else {
-    /* STEP 2: If the type hasn't been found, do a complete search
-       of the str field (the human readable name) */
-    swig_module_info *iter = start;
-    do {
-      register size_t i = 0;
-      for (; i < iter->size; ++i) {
-       if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
-         return iter->types[i];
-      }
-      iter = iter->next;
-    } while (iter != end);
-  }
-  
-  /* neither found a match */
-  return 0;
-}
-
-/* 
-   Pack binary data into a string
-*/
-SWIGRUNTIME char *
-SWIG_PackData(char *c, void *ptr, size_t sz) {
-  static const char hex[17] = "0123456789abcdef";
-  register const unsigned char *u = (unsigned char *) ptr;
-  register const unsigned char *eu =  u + sz;
-  for (; u != eu; ++u) {
-    register unsigned char uu = *u;
-    *(c++) = hex[(uu & 0xf0) >> 4];
-    *(c++) = hex[uu & 0xf];
-  }
-  return c;
-}
-
-/* 
-   Unpack binary data from a string
-*/
-SWIGRUNTIME const char *
-SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
-  register unsigned char *u = (unsigned char *) ptr;
-  register const unsigned char *eu = u + sz;
-  for (; u != eu; ++u) {
-    register char d = *(c++);
-    register unsigned char uu;
-    if ((d >= '0') && (d <= '9'))
-      uu = ((d - '0') << 4);
-    else if ((d >= 'a') && (d <= 'f'))
-      uu = ((d - ('a'-10)) << 4);
-    else 
-      return (char *) 0;
-    d = *(c++);
-    if ((d >= '0') && (d <= '9'))
-      uu |= (d - '0');
-    else if ((d >= 'a') && (d <= 'f'))
-      uu |= (d - ('a'-10));
-    else 
-      return (char *) 0;
-    *u = uu;
-  }
-  return c;
-}
-
-/* 
-   Pack 'void *' into a string buffer.
-*/
-SWIGRUNTIME char *
-SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
-  char *r = buff;
-  if ((2*sizeof(void *) + 2) > bsz) return 0;
-  *(r++) = '_';
-  r = SWIG_PackData(r,&ptr,sizeof(void *));
-  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
-  strcpy(r,name);
-  return buff;
-}
-
-SWIGRUNTIME const char *
-SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
-  if (*c != '_') {
-    if (strcmp(c,"NULL") == 0) {
-      *ptr = (void *) 0;
-      return name;
-    } else {
-      return 0;
-    }
-  }
-  return SWIG_UnpackData(++c,ptr,sizeof(void *));
-}
-
-SWIGRUNTIME char *
-SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
-  char *r = buff;
-  size_t lname = (name ? strlen(name) : 0);
-  if ((2*sz + 2 + lname) > bsz) return 0;
-  *(r++) = '_';
-  r = SWIG_PackData(r,ptr,sz);
-  if (lname) {
-    strncpy(r,name,lname+1);
-  } else {
-    *r = 0;
-  }
-  return buff;
-}
-
-SWIGRUNTIME const char *
-SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
-  if (*c != '_') {
-    if (strcmp(c,"NULL") == 0) {
-      memset(ptr,0,sz);
-      return name;
-    } else {
-      return 0;
-    }
-  }
-  return SWIG_UnpackData(++c,ptr,sz);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-/*  Errors in SWIG */
-#define  SWIG_UnknownError        -1 
-#define  SWIG_IOError             -2 
-#define  SWIG_RuntimeError        -3 
-#define  SWIG_IndexError          -4 
-#define  SWIG_TypeError           -5 
-#define  SWIG_DivisionByZero      -6 
-#define  SWIG_OverflowError       -7 
-#define  SWIG_SyntaxError         -8 
-#define  SWIG_ValueError          -9 
-#define  SWIG_SystemError         -10
-#define  SWIG_AttributeError      -11
-#define  SWIG_MemoryError         -12 
-#define  SWIG_NullReferenceError   -13
-
-
-
-#ifdef __cplusplus
-/* Needed on some windows machines---since MS plays funny games with the header files under C++ */
-#include <math.h>
-#include <stdlib.h>
-extern "C" {
-#endif
-#include "EXTERN.h"
-#include "perl.h"
-#include "XSUB.h"
-
-/* Add in functionality missing in older versions of Perl. Much of this is based on Devel-PPPort on cpan. */
-
-/* Add PERL_REVISION, PERL_VERSION, PERL_SUBVERSION if missing */
-#ifndef PERL_REVISION
-#  if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION))
-#    define PERL_PATCHLEVEL_H_IMPLICIT
-#    include <patchlevel.h>
-#  endif
-#  if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL)))
-#    include <could_not_find_Perl_patchlevel.h>
-#  endif
-#  ifndef PERL_REVISION
-#    define PERL_REVISION       (5)
-#    define PERL_VERSION        PATCHLEVEL
-#    define PERL_SUBVERSION     SUBVERSION
-#  endif
-#endif
-
-#if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE)
-#define PerlIO_exportFILE(fh,fl) (FILE*)(fh)
-#endif
-
-#ifndef SvIOK_UV
-# define SvIOK_UV(sv)       (SvIOK(sv) && (SvUVX(sv) == SvIVX(sv)))
-#endif
-
-#ifndef SvUOK
-# define SvUOK(sv)           SvIOK_UV(sv)
-#endif
-
-#if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5)))
-#  define PL_sv_undef               sv_undef
-#  define PL_na                            na
-#  define PL_errgv                  errgv
-#  define PL_sv_no                  sv_no
-#  define PL_sv_yes                 sv_yes
-#  define PL_markstack_ptr          markstack_ptr
-#endif
-
-#ifndef IVSIZE
-#  ifdef LONGSIZE
-#    define IVSIZE LONGSIZE
-#  else
-#    define IVSIZE 4 /* A bold guess, but the best we can make. */
-#  endif
-#endif
-
-#ifndef INT2PTR
-#  if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)
-#    define PTRV                  UV
-#    define INT2PTR(any,d)        (any)(d)
-#  else
-#    if PTRSIZE == LONGSIZE
-#      define PTRV                unsigned long
-#    else
-#      define PTRV                unsigned
-#    endif
-#    define INT2PTR(any,d)        (any)(PTRV)(d)
-#  endif
-
-#  define NUM2PTR(any,d)  (any)(PTRV)(d)
-#  define PTR2IV(p)       INT2PTR(IV,p)
-#  define PTR2UV(p)       INT2PTR(UV,p)
-#  define PTR2NV(p)       NUM2PTR(NV,p)
-
-#  if PTRSIZE == LONGSIZE
-#    define PTR2ul(p)     (unsigned long)(p)
-#  else
-#    define PTR2ul(p)     INT2PTR(unsigned long,p)
-#  endif
-#endif /* !INT2PTR */
-
-#ifndef SvPV_nolen
-# define SvPV_nolen(x) SvPV(x,PL_na)
-#endif
-
-#ifndef get_sv
-#  define get_sv perl_get_sv
-#endif
-
-#ifndef ERRSV
-#  define ERRSV get_sv("@",FALSE)
-#endif
-
-#ifndef pTHX_
-#define pTHX_
-#endif   
-
-#include <string.h>
-#ifdef __cplusplus
-}
-#endif
-
-/* -----------------------------------------------------------------------------
- * error manipulation
- * ----------------------------------------------------------------------------- */
-
-SWIGINTERN const char*
-SWIG_Perl_ErrorType(int code) {
-  const char* type = 0;
-  switch(code) {
-  case SWIG_MemoryError:
-    type = "MemoryError";
-    break;
-  case SWIG_IOError:
-    type = "IOError";
-    break;
-  case SWIG_RuntimeError:
-    type = "RuntimeError";
-    break;
-  case SWIG_IndexError:
-    type = "IndexError";
-    break;
-  case SWIG_TypeError:
-    type = "TypeError";
-    break;
-  case SWIG_DivisionByZero:
-    type = "ZeroDivisionError";
-    break;
-  case SWIG_OverflowError:
-    type = "OverflowError";
-    break;
-  case SWIG_SyntaxError:
-    type = "SyntaxError";
-    break;
-  case SWIG_ValueError:
-    type = "ValueError";
-    break;
-  case SWIG_SystemError:
-    type = "SystemError";
-    break;
-  case SWIG_AttributeError:
-    type = "AttributeError";
-    break;
-  default:
-    type = "RuntimeError";
-  }
-  return type;
-}
-
-
-
-
-/* -----------------------------------------------------------------------------
- * perlrun.swg
- *
- * This file contains the runtime support for Perl modules
- * and includes code for managing global variables and pointer
- * type checking.
- * ----------------------------------------------------------------------------- */
-
-#ifdef PERL_OBJECT
-#define SWIG_PERL_OBJECT_DECL CPerlObj *SWIGUNUSEDPARM(pPerl),
-#define SWIG_PERL_OBJECT_CALL pPerl,
-#else
-#define SWIG_PERL_OBJECT_DECL
-#define SWIG_PERL_OBJECT_CALL
-#endif
-
-/* Common SWIG API */
-
-/* for raw pointers */
-#define SWIG_ConvertPtr(obj, pp, type, flags)           SWIG_Perl_ConvertPtr(SWIG_PERL_OBJECT_CALL obj, pp, type, flags)
-#define SWIG_NewPointerObj(p, type, flags)              SWIG_Perl_NewPointerObj(SWIG_PERL_OBJECT_CALL p, type, flags)
-
-/* for raw packed data */
-#define SWIG_ConvertPacked(obj, p, s, type)             SWIG_Perl_ConvertPacked(SWIG_PERL_OBJECT_CALL obj, p, s, type)
-#define SWIG_NewPackedObj(p, s, type)                  SWIG_Perl_NewPackedObj(SWIG_PERL_OBJECT_CALL p, s, type)
-
-/* for class or struct pointers */
-#define SWIG_ConvertInstance(obj, pptr, type, flags)    SWIG_ConvertPtr(obj, pptr, type, flags)
-#define SWIG_NewInstanceObj(ptr, type, flags)           SWIG_NewPointerObj(ptr, type, flags)
-
-/* for C or C++ function pointers */
-#define SWIG_ConvertFunctionPtr(obj, pptr, type)        SWIG_ConvertPtr(obj, pptr, type, 0)
-#define SWIG_NewFunctionPtrObj(ptr, type)               SWIG_NewPointerObj(ptr, type, 0)
-
-/* for C++ member pointers, ie, member methods */
-#define SWIG_ConvertMember(obj, ptr, sz, ty)            SWIG_ConvertPacked(obj, ptr, sz, ty)
-#define SWIG_NewMemberObj(ptr, sz, type)                SWIG_NewPackedObj(ptr, sz, type)
-
-
-/* Runtime API */
-
-#define SWIG_GetModule(clientdata)                      SWIG_Perl_GetModule()
-#define SWIG_SetModule(clientdata, pointer)             SWIG_Perl_SetModule(pointer)
-
-
-/* Error manipulation */
-
-#define SWIG_ErrorType(code)                            SWIG_Perl_ErrorType(code)               
-#define SWIG_Error(code, msg)                          sv_setpvf(GvSV(PL_errgv),"%s %s\n", SWIG_ErrorType(code), msg)
-#define SWIG_fail                                      goto fail                                                   
-
-/* Perl-specific SWIG API */
-
-#define SWIG_MakePtr(sv, ptr, type, flags)              SWIG_Perl_MakePtr(SWIG_PERL_OBJECT_CALL sv, ptr, type, flags)
-#define SWIG_MakePackedObj(sv, p, s, type)             SWIG_Perl_MakePackedObj(SWIG_PERL_OBJECT_CALL sv, p, s, type)
-#define SWIG_SetError(str)                              SWIG_Error(SWIG_RuntimeError, str)
-
-
-#define SWIG_PERL_DECL_ARGS_1(arg1)                     (SWIG_PERL_OBJECT_DECL arg1)
-#define SWIG_PERL_CALL_ARGS_1(arg1)                     (SWIG_PERL_OBJECT_CALL arg1)
-#define SWIG_PERL_DECL_ARGS_2(arg1, arg2)               (SWIG_PERL_OBJECT_DECL arg1, arg2)
-#define SWIG_PERL_CALL_ARGS_2(arg1, arg2)               (SWIG_PERL_OBJECT_CALL arg1, arg2)
-
-/* -----------------------------------------------------------------------------
- * pointers/data manipulation
- * ----------------------------------------------------------------------------- */
-
-/* For backward compatibility only */
-#define SWIG_POINTER_EXCEPTION  0
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define SWIG_OWNER   SWIG_POINTER_OWN
-#define SWIG_SHADOW  SWIG_OWNER << 1
-
-#define SWIG_MAYBE_PERL_OBJECT SWIG_PERL_OBJECT_DECL
-
-/* SWIG Perl macros */
-
-/* Macro to declare an XS function */
-#ifndef XSPROTO
-#   define XSPROTO(name) void name(pTHX_ CV* cv)
-#endif
-
-/* Macro to call an XS function */
-#ifdef PERL_OBJECT 
-#  define SWIG_CALLXS(_name) _name(cv,pPerl) 
-#else 
-#  ifndef MULTIPLICITY 
-#    define SWIG_CALLXS(_name) _name(cv) 
-#  else 
-#    define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv) 
-#  endif 
-#endif 
-
-#ifdef PERL_OBJECT
-#define MAGIC_PPERL  CPerlObj *pPerl = (CPerlObj *) this;
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *);
-#ifdef __cplusplus
-}
-#endif
-
-#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
-#define SWIGCLASS_STATIC
-
-#else /* PERL_OBJECT */
-
-#define MAGIC_PPERL
-#define SWIGCLASS_STATIC static SWIGUNUSED
-
-#ifndef MULTIPLICITY
-#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-typedef int (*SwigMagicFunc)(SV *, MAGIC *);
-#ifdef __cplusplus
-}
-#endif
-
-#else /* MULTIPLICITY */
-
-#define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *);
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* MULTIPLICITY */
-#endif /* PERL_OBJECT */
-
-/* Workaround for bug in perl 5.6.x croak and earlier */
-#if (PERL_VERSION < 8)
-#  ifdef PERL_OBJECT
-#    define SWIG_croak_null() SWIG_Perl_croak_null(pPerl)
-static void SWIG_Perl_croak_null(CPerlObj *pPerl)
-#  else
-static void SWIG_croak_null()
-#  endif
-{
-  SV *err=ERRSV;
-#  if (PERL_VERSION < 6)
-  croak("%_", err);
-#  else
-  if (SvOK(err) && !SvROK(err)) croak("%_", err);
-  croak(Nullch);
-#  endif
-}
-#else
-#  define SWIG_croak_null() croak(Nullch)
-#endif
-
-
-/* 
-   Define how strict is the cast between strings and integers/doubles
-   when overloading between these types occurs.
-   
-   The default is making it as strict as possible by using SWIG_AddCast
-   when needed.
-   
-   You can use -DSWIG_PERL_NO_STRICT_STR2NUM at compilation time to
-   disable the SWIG_AddCast, making the casting between string and
-   numbers less strict.
-
-   In the end, we try to solve the overloading between strings and
-   numerical types in the more natural way, but if you can avoid it,
-   well, avoid it using %rename, for example.
-*/
-#ifndef SWIG_PERL_NO_STRICT_STR2NUM
-# ifndef SWIG_PERL_STRICT_STR2NUM
-#  define SWIG_PERL_STRICT_STR2NUM
-# endif
-#endif
-#ifdef SWIG_PERL_STRICT_STR2NUM
-/* string takes precedence */
-#define SWIG_Str2NumCast(x) SWIG_AddCast(x)  
-#else
-/* number takes precedence */
-#define SWIG_Str2NumCast(x) x
-#endif
-
-
-
-#include <stdlib.h>
-
-SWIGRUNTIME const char *
-SWIG_Perl_TypeProxyName(const swig_type_info *type) {
-  if (!type) return NULL;
-  if (type->clientdata != NULL) {
-    return (const char*) type->clientdata;
-  } 
-  else {
-    return type->name;
-  }
-}
-
-SWIGRUNTIME swig_cast_info *
-SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
-  SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp((char*)iter->type->name, c) == 0)) 
-                           || (iter->type->clientdata && (strcmp((char*)iter->type->clientdata, c) == 0))), ty);
-}
-
-
-/* Function for getting a pointer value */
-
-SWIGRUNTIME int
-SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags) {
-  swig_cast_info *tc;
-  void *voidptr = (void *)0;
-  SV *tsv = 0;
-  /* If magical, apply more magic */
-  if (SvGMAGICAL(sv))
-    mg_get(sv);
-
-  /* Check to see if this is an object */
-  if (sv_isobject(sv)) {
-    IV tmp = 0;
-    tsv = (SV*) SvRV(sv);
-    if ((SvTYPE(tsv) == SVt_PVHV)) {
-      MAGIC *mg;
-      if (SvMAGICAL(tsv)) {
-        mg = mg_find(tsv,'P');
-        if (mg) {
-          sv = mg->mg_obj;
-          if (sv_isobject(sv)) {
-           tsv = (SV*)SvRV(sv);
-            tmp = SvIV(tsv);
-          }
-        }
-      } else {
-        return SWIG_ERROR;
-      }
-    } else {
-      tmp = SvIV(tsv);
-    }
-    voidptr = INT2PTR(void *,tmp);
-  } else if (! SvOK(sv)) {            /* Check for undef */
-    *(ptr) = (void *) 0;
-    return SWIG_OK;
-  } else if (SvTYPE(sv) == SVt_RV) {  /* Check for NULL pointer */
-    if (!SvROK(sv)) {
-      *(ptr) = (void *) 0;
-      return SWIG_OK;
-    } else {
-      return SWIG_ERROR;
-    }
-  } else {                            /* Don't know what it is */
-    return SWIG_ERROR;
-  }
-  if (_t) {
-    /* Now see if the types match */
-    char *_c = HvNAME(SvSTASH(SvRV(sv)));
-    tc = SWIG_TypeProxyCheck(_c,_t);
-    if (!tc) {
-      return SWIG_ERROR;
-    }
-    *ptr = SWIG_TypeCast(tc,voidptr);
-  } else {
-    *ptr = voidptr;
-  }
-
-  /* 
-   *  DISOWN implementation: we need a perl guru to check this one.
-   */
-  if (tsv && (flags & SWIG_POINTER_DISOWN)) {
-    /* 
-     *  almost copy paste code from below SWIG_POINTER_OWN setting
-     */
-    SV *obj = sv;
-    HV *stash = SvSTASH(SvRV(obj));
-    GV *gv = *(GV**) hv_fetch(stash, "OWNER", 5, TRUE);
-    if (isGV(gv)) {
-      HV *hv = GvHVn(gv);
-      /*
-       * To set ownership (see below), a newSViv(1) entry is added. 
-       * Hence, to remove ownership, we delete the entry.
-       */
-      if (hv_exists_ent(hv, obj, 0)) {
-       hv_delete_ent(hv, obj, 0, 0);
-      }
-    }
-  }
-  return SWIG_OK;
-}
-
-SWIGRUNTIME void
-SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, swig_type_info *t, int flags) {
-  if (ptr && (flags & SWIG_SHADOW)) {
-    SV *self;
-    SV *obj=newSV(0);
-    HV *hash=newHV();
-    HV *stash;
-    sv_setref_pv(obj, (char *) SWIG_Perl_TypeProxyName(t), ptr);
-    stash=SvSTASH(SvRV(obj));
-    if (flags & SWIG_POINTER_OWN) {
-      HV *hv;
-      GV *gv=*(GV**)hv_fetch(stash, "OWNER", 5, TRUE);
-      if (!isGV(gv))
-        gv_init(gv, stash, "OWNER", 5, FALSE);
-      hv=GvHVn(gv);
-      hv_store_ent(hv, obj, newSViv(1), 0);
-    }
-    sv_magic((SV *)hash, (SV *)obj, 'P', Nullch, 0);
-    SvREFCNT_dec(obj);
-    self=newRV_noinc((SV *)hash);
-    sv_setsv(sv, self);
-    SvREFCNT_dec((SV *)self);
-    sv_bless(sv, stash);
-  }
-  else {
-    sv_setref_pv(sv, (char *) SWIG_Perl_TypeProxyName(t), ptr);
-  }
-}
-
-SWIGRUNTIMEINLINE SV *
-SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info *t, int flags) {
-  SV *result = sv_newmortal();
-  SWIG_MakePtr(result, ptr, t, flags);
-  return result;
-}
-
-SWIGRUNTIME void
-SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, int sz, swig_type_info *type) {
-  char result[1024];
-  char *r = result;
-  if ((2*sz + 1 + strlen(SWIG_Perl_TypeProxyName(type))) > 1000) return;
-  *(r++) = '_';
-  r = SWIG_PackData(r,ptr,sz);
-  strcpy(r,SWIG_Perl_TypeProxyName(type));
-  sv_setpv(sv, result);
-}
-
-SWIGRUNTIME SV *
-SWIG_Perl_NewPackedObj(SWIG_MAYBE_PERL_OBJECT void *ptr, int sz, swig_type_info *type) {
-  SV *result = sv_newmortal();
-  SWIG_Perl_MakePackedObj(result, ptr, sz, type);
-  return result;
-}
-
-/* Convert a packed value value */
-SWIGRUNTIME int
-SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty) {
-  swig_cast_info *tc;
-  const char  *c = 0;
-
-  if ((!obj) || (!SvOK(obj))) return SWIG_ERROR;
-  c = SvPV_nolen(obj);
-  /* Pointer values must start with leading underscore */
-  if (*c != '_') return SWIG_ERROR;
-  c++;
-  c = SWIG_UnpackData(c,ptr,sz);
-  if (ty) {
-    tc = SWIG_TypeCheck(c,ty);
-    if (!tc) return SWIG_ERROR;
-  }
-  return SWIG_OK;
-}
-
-
-/* Macros for low-level exception handling */
-#define SWIG_croak(x)    { SWIG_Error(SWIG_RuntimeError, x); SWIG_fail; }
-
-
-typedef XSPROTO(SwigPerlWrapper);
-typedef SwigPerlWrapper *SwigPerlWrapperPtr;
-
-/* Structure for command table */
-typedef struct {
-  const char         *name;
-  SwigPerlWrapperPtr  wrapper;
-} swig_command_info;
-
-/* Information for constant table */
-
-#define SWIG_INT     1
-#define SWIG_FLOAT   2
-#define SWIG_STRING  3
-#define SWIG_POINTER 4
-#define SWIG_BINARY  5
-
-/* Constant information structure */
-typedef struct swig_constant_info {
-    int              type;
-    const char      *name;
-    long             lvalue;
-    double           dvalue;
-    void            *pvalue;
-    swig_type_info **ptype;
-} swig_constant_info;
-
-
-/* Structure for variable table */
-typedef struct {
-  const char   *name;
-  SwigMagicFunc   set;
-  SwigMagicFunc   get;
-  swig_type_info  **type;
-} swig_variable_info;
-
-/* Magic variable code */
-#ifndef PERL_OBJECT
-#define swig_create_magic(s,a,b,c) _swig_create_magic(s,a,b,c)
-  #ifndef MULTIPLICITY
-     SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) 
-  #else
-     SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) 
-  #endif
-#else
-#  define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c)
-SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) 
-#endif
-{
-  MAGIC *mg;
-  sv_magic(sv,sv,'U',(char *) name,strlen(name));
-  mg = mg_find(sv,'U');
-  mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
-  mg->mg_virtual->svt_get = (SwigMagicFunc) get;
-  mg->mg_virtual->svt_set = (SwigMagicFunc) set;
-  mg->mg_virtual->svt_len = 0;
-  mg->mg_virtual->svt_clear = 0;
-  mg->mg_virtual->svt_free = 0;
-}
-
-
-SWIGRUNTIME swig_module_info *
-SWIG_Perl_GetModule(void) {
-  static void *type_pointer = (void *)0;
-  SV *pointer;
-
-  /* first check if pointer already created */
-  if (!type_pointer) {
-    pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE);
-    if (pointer && SvOK(pointer)) {
-      type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
-    }
-  }
-
-  return (swig_module_info *) type_pointer;
-}
-
-SWIGRUNTIME void
-SWIG_Perl_SetModule(swig_module_info *module) {
-  SV *pointer;
-
-  /* create a new pointer */
-  pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE);
-  sv_setiv(pointer, PTR2IV(module));
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-/* Workaround perl5 global namespace pollution. Note that undefining library
- * functions like fopen will not solve the problem on all platforms as fopen
- * might be a macro on Windows but not necessarily on other operating systems. */
-#ifdef do_open
-  #undef do_open
-#endif
-#ifdef do_close
-  #undef do_close
-#endif
-#ifdef scalar
-  #undef scalar
-#endif
-#ifdef list
-  #undef list
-#endif
-#ifdef apply
-  #undef apply
-#endif
-#ifdef convert
-  #undef convert
-#endif
-#ifdef Error
-  #undef Error
-#endif
-#ifdef form
-  #undef form
-#endif
-#ifdef vform
-  #undef vform
-#endif
-#ifdef LABEL
-  #undef LABEL
-#endif
-#ifdef METHOD
-  #undef METHOD
-#endif
-#ifdef Move
-  #undef Move
-#endif
-#ifdef yylex
-  #undef yylex
-#endif
-#ifdef yyparse
-  #undef yyparse
-#endif
-#ifdef yyerror
-  #undef yyerror
-#endif
-#ifdef invert
-  #undef invert
-#endif
-#ifdef ref
-  #undef ref
-#endif
-#ifdef read
-  #undef read
-#endif
-#ifdef write
-  #undef write
-#endif
-#ifdef eof
-  #undef eof
-#endif
-#ifdef bool
-  #undef bool
-#endif
-#ifdef close
-  #undef close
-#endif
-#ifdef rewind
-  #undef rewind
-#endif
-#ifdef free
-  #undef free
-#endif
-#ifdef malloc
-  #undef malloc
-#endif
-#ifdef calloc
-  #undef calloc
-#endif
-#ifdef Stat
-  #undef Stat
-#endif
-#ifdef check
-  #undef check
-#endif
-#ifdef seekdir
-  #undef seekdir
-#endif
-#ifdef open
-  #undef open
-#endif
-
-
-
-#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
-
-#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else 
-
-
-
-  #define SWIG_exception(code, msg) do { SWIG_Error(code, msg); SWIG_fail;; } while(0) 
-
-
-/* -------- TYPES TABLE (BEGIN) -------- */
-
-#define SWIGTYPE_p_char swig_types[0]
-#define SWIGTYPE_p_double swig_types[1]
-#define SWIGTYPE_p_float swig_types[2]
-#define SWIGTYPE_p_int swig_types[3]
-#define SWIGTYPE_p_unsigned_char swig_types[4]
-static swig_type_info *swig_types[6];
-static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0};
-#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
-#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
-
-/* -------- TYPES TABLE (END) -------- */
-
-#define SWIG_init    boot_Amanda__Tapefile
-
-#define SWIG_name   "Amanda::Tapefilec::boot_Amanda__Tapefile"
-#define SWIG_prefix "Amanda::Tapefilec::"
-
-#define SWIGVERSION 0x010333 
-#define SWIG_VERSION SWIGVERSION
-
-
-#define SWIG_as_voidptr(a) (void *)((const void *)(a)) 
-#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) 
-
-
-#ifdef __cplusplus
-extern "C"
-#endif
-#ifndef PERL_OBJECT
-#ifndef MULTIPLICITY
-SWIGEXPORT void SWIG_init (CV* cv);
-#else
-SWIGEXPORT void SWIG_init (pTHXo_ CV* cv);
-#endif
-#else
-SWIGEXPORT void SWIG_init (CV *cv, CPerlObj *);
-#endif
-
-
-#include "amglue.h"
-
-
-#include "amglue.h"
-
-
-#include "amglue.h"
-
-
-#include <glib.h>
-#include "tapefile.h"
-
-
-SWIGINTERN swig_type_info*
-SWIG_pchar_descriptor(void)
-{
-  static int init = 0;
-  static swig_type_info* info = 0;
-  if (!init) {
-    info = SWIG_TypeQuery("_p_char");
-    init = 1;
-  }
-  return info;
-}
-
-
-SWIGINTERN int
-SWIG_AsCharPtrAndSize(SV *obj, char** cptr, size_t* psize, int *alloc)
-{
-  if (SvPOK(obj)) {
-    STRLEN len = 0;
-    char *cstr = SvPV(obj, len); 
-    size_t size = len + 1;
-    if (cptr)  {
-      if (alloc) {
-       if (*alloc == SWIG_NEWOBJ) {
-         *cptr = (char *)memcpy((char *)malloc((size)*sizeof(char)), cstr, sizeof(char)*(size));
-       } else {
-         *cptr = cstr;
-         *alloc = SWIG_OLDOBJ;
-       }
-      }
-    }
-    if (psize) *psize = size;
-    return SWIG_OK;
-  } else {
-    swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
-    if (pchar_descriptor) {
-      char* vptr = 0; 
-      if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_descriptor, 0) == SWIG_OK) {
-       if (cptr) *cptr = vptr;
-       if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0;
-       if (alloc) *alloc = SWIG_OLDOBJ;
-       return SWIG_OK;
-      }
-    }
-  }
-  return SWIG_TypeError;
-}
-
-
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef PERL_OBJECT
-#define MAGIC_CLASS _wrap_Amanda::Tapefile_var::
-class _wrap_Amanda::Tapefile_var : public CPerlObj {
-public:
-#else
-#define MAGIC_CLASS
-#endif
-SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *SWIGUNUSEDPARM(sv), MAGIC *SWIGUNUSEDPARM(mg)) {
-    MAGIC_PPERL
-    croak("Value is read-only.");
-    return 0;
-}
-
-
-#ifdef PERL_OBJECT
-};
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-XS(_wrap_read_tapelist) {
-  {
-    char *arg1 = (char *) 0 ;
-    int result;
-    int res1 ;
-    char *buf1 = 0 ;
-    int alloc1 = 0 ;
-    int argvi = 0;
-    dXSARGS;
-    
-    if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: read_tapelist(tapefile);");
-    }
-    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "read_tapelist" "', argument " "1"" of type '" "char *""'");
-    }
-    arg1 = (char *)(buf1);
-    result = (int)read_tapelist(arg1);
-    {
-      ST(argvi) = sv_2mortal(amglue_newSVi64(result));
-      argvi++;
-    }
-    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
-    XSRETURN(argvi);
-  fail:
-    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
-    SWIG_croak_null();
-  }
-}
-
-
-
-/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
-
-static swig_type_info _swigt__p_char = {"_p_char", "gchar *|char *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_double = {"_p_double", "double *|gdouble *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_float = {"_p_float", "float *|gfloat *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_int = {"_p_int", "int *|gboolean *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "guchar *|unsigned char *", 0, 0, (void*)0, 0};
-
-static swig_type_info *swig_type_initial[] = {
-  &_swigt__p_char,
-  &_swigt__p_double,
-  &_swigt__p_float,
-  &_swigt__p_int,
-  &_swigt__p_unsigned_char,
-};
-
-static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_double[] = {  {&_swigt__p_double, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_float[] = {  {&_swigt__p_float, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_int[] = {  {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_unsigned_char[] = {  {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
-
-static swig_cast_info *swig_cast_initial[] = {
-  _swigc__p_char,
-  _swigc__p_double,
-  _swigc__p_float,
-  _swigc__p_int,
-  _swigc__p_unsigned_char,
-};
-
-
-/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
-
-static swig_constant_info swig_constants[] = {
-{0,0,0,0,0,0}
-};
-#ifdef __cplusplus
-}
-#endif
-static swig_variable_info swig_variables[] = {
-{0,0,0,0}
-};
-static swig_command_info swig_commands[] = {
-{"Amanda::Tapefilec::read_tapelist", _wrap_read_tapelist},
-{0,0}
-};
-/* -----------------------------------------------------------------------------
- * Type initialization:
- * This problem is tough by the requirement that no dynamic 
- * memory is used. Also, since swig_type_info structures store pointers to 
- * swig_cast_info structures and swig_cast_info structures store pointers back
- * to swig_type_info structures, we need some lookup code at initialization. 
- * The idea is that swig generates all the structures that are needed. 
- * The runtime then collects these partially filled structures. 
- * The SWIG_InitializeModule function takes these initial arrays out of 
- * swig_module, and does all the lookup, filling in the swig_module.types
- * array with the correct data and linking the correct swig_cast_info
- * structures together.
- *
- * The generated swig_type_info structures are assigned staticly to an initial 
- * array. We just loop through that array, and handle each type individually.
- * First we lookup if this type has been already loaded, and if so, use the
- * loaded structure instead of the generated one. Then we have to fill in the
- * cast linked list. The cast data is initially stored in something like a
- * two-dimensional array. Each row corresponds to a type (there are the same
- * number of rows as there are in the swig_type_initial array). Each entry in
- * a column is one of the swig_cast_info structures for that type.
- * The cast_initial array is actually an array of arrays, because each row has
- * a variable number of columns. So to actually build the cast linked list,
- * we find the array of casts associated with the type, and loop through it 
- * adding the casts to the list. The one last trick we need to do is making
- * sure the type pointer in the swig_cast_info struct is correct.
- *
- * First off, we lookup the cast->type name to see if it is already loaded. 
- * There are three cases to handle:
- *  1) If the cast->type has already been loaded AND the type we are adding
- *     casting info to has not been loaded (it is in this module), THEN we
- *     replace the cast->type pointer with the type pointer that has already
- *     been loaded.
- *  2) If BOTH types (the one we are adding casting info to, and the 
- *     cast->type) are loaded, THEN the cast info has already been loaded by
- *     the previous module so we just ignore it.
- *  3) Finally, if cast->type has not already been loaded, then we add that
- *     swig_cast_info to the linked list (because the cast->type) pointer will
- *     be correct.
- * ----------------------------------------------------------------------------- */
-
-#ifdef __cplusplus
-extern "C" {
-#if 0
-} /* c-mode */
-#endif
-#endif
-
-#if 0
-#define SWIGRUNTIME_DEBUG
-#endif
-
-
-SWIGRUNTIME void
-SWIG_InitializeModule(void *clientdata) {
-  size_t i;
-  swig_module_info *module_head, *iter;
-  int found;
-  
-  clientdata = clientdata;
-  
-  /* check to see if the circular list has been setup, if not, set it up */
-  if (swig_module.next==0) {
-    /* Initialize the swig_module */
-    swig_module.type_initial = swig_type_initial;
-    swig_module.cast_initial = swig_cast_initial;
-    swig_module.next = &swig_module;
-  }
-  
-  /* Try and load any already created modules */
-  module_head = SWIG_GetModule(clientdata);
-  if (!module_head) {
-    /* This is the first module loaded for this interpreter */
-    /* so set the swig module into the interpreter */
-    SWIG_SetModule(clientdata, &swig_module);
-    module_head = &swig_module;
-  } else {
-    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
-    found=0;
-    iter=module_head;
-    do {
-      if (iter==&swig_module) {
-        found=1;
-        break;
-      }
-      iter=iter->next;
-    } while (iter!= module_head);
-    
-    /* if the is found in the list, then all is done and we may leave */
-    if (found) return;
-    /* otherwise we must add out module into the list */
-    swig_module.next = module_head->next;
-    module_head->next = &swig_module;
-  }
-  
-  /* Now work on filling in swig_module.types */
-#ifdef SWIGRUNTIME_DEBUG
-  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
-#endif
-  for (i = 0; i < swig_module.size; ++i) {
-    swig_type_info *type = 0;
-    swig_type_info *ret;
-    swig_cast_info *cast;
-    
-#ifdef SWIGRUNTIME_DEBUG
-    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
-#endif
-    
-    /* if there is another module already loaded */
-    if (swig_module.next != &swig_module) {
-      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
-    }
-    if (type) {
-      /* Overwrite clientdata field */
-#ifdef SWIGRUNTIME_DEBUG
-      printf("SWIG_InitializeModule: found type %s\n", type->name);
-#endif
-      if (swig_module.type_initial[i]->clientdata) {
-        type->clientdata = swig_module.type_initial[i]->clientdata;
-#ifdef SWIGRUNTIME_DEBUG
-        printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
-#endif
-      }
-    } else {
-      type = swig_module.type_initial[i];
-    }
-    
-    /* Insert casting types */
-    cast = swig_module.cast_initial[i];
-    while (cast->type) {
-      /* Don't need to add information already in the list */
-      ret = 0;
-#ifdef SWIGRUNTIME_DEBUG
-      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
-#endif
-      if (swig_module.next != &swig_module) {
-        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
-#ifdef SWIGRUNTIME_DEBUG
-        if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
-#endif
-      }
-      if (ret) {
-        if (type == swig_module.type_initial[i]) {
-#ifdef SWIGRUNTIME_DEBUG
-          printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
-#endif
-          cast->type = ret;
-          ret = 0;
-        } else {
-          /* Check for casting already in the list */
-          swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
-#ifdef SWIGRUNTIME_DEBUG
-          if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
-#endif
-          if (!ocast) ret = 0;
-        }
-      }
-      
-      if (!ret) {
-#ifdef SWIGRUNTIME_DEBUG
-        printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
-#endif
-        if (type->cast) {
-          type->cast->prev = cast;
-          cast->next = type->cast;
-        }
-        type->cast = cast;
-      }
-      cast++;
-    }
-    /* Set entry in modules->types array equal to the type */
-    swig_module.types[i] = type;
-  }
-  swig_module.types[i] = 0;
-  
-#ifdef SWIGRUNTIME_DEBUG
-  printf("**** SWIG_InitializeModule: Cast List ******\n");
-  for (i = 0; i < swig_module.size; ++i) {
-    int j = 0;
-    swig_cast_info *cast = swig_module.cast_initial[i];
-    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
-    while (cast->type) {
-      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
-      cast++;
-      ++j;
-    }
-    printf("---- Total casts: %d\n",j);
-  }
-  printf("**** SWIG_InitializeModule: Cast List ******\n");
-#endif
-}
-
-/* This function will propagate the clientdata field of type to
-* any new swig_type_info structures that have been added into the list
-* of equivalent types.  It is like calling
-* SWIG_TypeClientData(type, clientdata) a second time.
-*/
-SWIGRUNTIME void
-SWIG_PropagateClientData(void) {
-  size_t i;
-  swig_cast_info *equiv;
-  static int init_run = 0;
-  
-  if (init_run) return;
-  init_run = 1;
-  
-  for (i = 0; i < swig_module.size; i++) {
-    if (swig_module.types[i]->clientdata) {
-      equiv = swig_module.types[i]->cast;
-      while (equiv) {
-        if (!equiv->converter) {
-          if (equiv->type && !equiv->type->clientdata)
-          SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
-        }
-        equiv = equiv->next;
-      }
-    }
-  }
-}
-
-#ifdef __cplusplus
-#if 0
-{
-  /* c-mode */
-#endif
-}
-#endif
-
-
-
-#ifdef __cplusplus
-extern "C"
-#endif
-
-XS(SWIG_init) {
-  dXSARGS;
-  int i;
-  
-  SWIG_InitializeModule(0);
-  
-  /* Install commands */
-  for (i = 0; swig_commands[i].name; i++) {
-    newXS((char*) swig_commands[i].name,swig_commands[i].wrapper, (char*)__FILE__);
-  }
-  
-  /* Install variables */
-  for (i = 0; swig_variables[i].name; i++) {
-    SV *sv;
-    sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2);
-    if (swig_variables[i].type) {
-      SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0);
-    } else {
-      sv_setiv(sv,(IV) 0);
-    }
-    swig_create_magic(sv, (char *) swig_variables[i].name, swig_variables[i].set, swig_variables[i].get); 
-  }
-  
-  /* Install constant */
-  for (i = 0; swig_constants[i].type; i++) {
-    SV *sv;
-    sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2);
-    switch(swig_constants[i].type) {
-    case SWIG_INT:
-      sv_setiv(sv, (IV) swig_constants[i].lvalue);
-      break;
-    case SWIG_FLOAT:
-      sv_setnv(sv, (double) swig_constants[i].dvalue);
-      break;
-    case SWIG_STRING:
-      sv_setpv(sv, (char *) swig_constants[i].pvalue);
-      break;
-    case SWIG_POINTER:
-      SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype),0);
-      break;
-    case SWIG_BINARY:
-      SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype));
-      break;
-    default:
-      break;
-    }
-    SvREADONLY_on(sv);
-  }
-  
-  ST(0) = &PL_sv_yes;
-  XSRETURN(1);
-}
-
diff --git a/perl/Amanda/Tapefile.pm b/perl/Amanda/Tapefile.pm
deleted file mode 100644 (file)
index da8196b..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-# This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.33
-#
-# Don't modify this file, modify the SWIG interface instead.
-
-package Amanda::Tapefile;
-require Exporter;
-require DynaLoader;
-@ISA = qw(Exporter DynaLoader);
-package Amanda::Tapefilec;
-bootstrap Amanda::Tapefile;
-package Amanda::Tapefile;
-@EXPORT = qw( );
-
-# ---------- BASE METHODS -------------
-
-package Amanda::Tapefile;
-
-sub TIEHASH {
-    my ($classname,$obj) = @_;
-    return bless $obj, $classname;
-}
-
-sub CLEAR { }
-
-sub FIRSTKEY { }
-
-sub NEXTKEY { }
-
-sub FETCH {
-    my ($self,$field) = @_;
-    my $member_func = "swig_${field}_get";
-    $self->$member_func();
-}
-
-sub STORE {
-    my ($self,$field,$newval) = @_;
-    my $member_func = "swig_${field}_set";
-    $self->$member_func($newval);
-}
-
-sub this {
-    my $ptr = shift;
-    return tied(%$ptr);
-}
-
-
-# ------- FUNCTION WRAPPERS --------
-
-package Amanda::Tapefile;
-
-*read_tapelist = *Amanda::Tapefilec::read_tapelist;
-
-# ------- VARIABLE STUBS --------
-
-package Amanda::Tapefile;
-
-
-@EXPORT_OK = ();
-%EXPORT_TAGS = ();
-
-=head1 NAME
-
-Amanda::Tapefile - temporary hack
-
-=head1 HACK?
-
-Yeah, this is just here to make Amanda::Logfile usable.  This module
-wil become Amanda::Tapelist in the next release.
-
-=cut
-1;
diff --git a/perl/Amanda/Tapefile.swg b/perl/Amanda/Tapefile.swg
deleted file mode 100644 (file)
index 858e98e..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) Zmanda, Inc.  All Rights Reserved.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
- *
- * This 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 this library; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
- *
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
- */
-
-%module "Amanda::Tapefile"
-%include "amglue/amglue.swg"
-%include "exception.i"
-
-%{
-#include <glib.h>
-#include "tapefile.h"
-%}
-
-%perlcode %{
-=head1 NAME
-
-Amanda::Tapefile - temporary hack
-
-=head1 HACK?
-
-Yeah, this is just here to make Amanda::Logfile usable.  This module
-wil become Amanda::Tapelist in the next release.
-
-=cut
-%}
-/* This is just a hack to get Amanda::Logfile working! */
-
-int read_tapelist(char *tapefile);
diff --git a/perl/Amanda/Tapelist.c b/perl/Amanda/Tapelist.c
new file mode 100644 (file)
index 0000000..f94a4e3
--- /dev/null
@@ -0,0 +1,1953 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ * 
+ * This file is not intended to be easily readable and contains a number of 
+ * coding conventions designed to improve portability and efficiency. Do not make
+ * changes to this file unless you know what you are doing--modify the SWIG 
+ * interface file instead. 
+ * ----------------------------------------------------------------------------- */
+
+#define SWIGPERL
+#define SWIG_CASTRANK_MODE
+/* -----------------------------------------------------------------------------
+ *  This section contains generic SWIG labels for method/variable
+ *  declarations/attributes, and other compiler dependent labels.
+ * ----------------------------------------------------------------------------- */
+
+/* template workaround for compilers that cannot correctly implement the C++ standard */
+#ifndef SWIGTEMPLATEDISAMBIGUATOR
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# elif defined(__HP_aCC)
+/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
+/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# else
+#  define SWIGTEMPLATEDISAMBIGUATOR
+# endif
+#endif
+
+/* inline attribute */
+#ifndef SWIGINLINE
+# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
+#   define SWIGINLINE inline
+# else
+#   define SWIGINLINE
+# endif
+#endif
+
+/* attribute recognised by some compilers to avoid 'unused' warnings */
+#ifndef SWIGUNUSED
+# if defined(__GNUC__)
+#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#     define SWIGUNUSED __attribute__ ((__unused__)) 
+#   else
+#     define SWIGUNUSED
+#   endif
+# elif defined(__ICC)
+#   define SWIGUNUSED __attribute__ ((__unused__)) 
+# else
+#   define SWIGUNUSED 
+# endif
+#endif
+
+#ifndef SWIGUNUSEDPARM
+# ifdef __cplusplus
+#   define SWIGUNUSEDPARM(p)
+# else
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
+# endif
+#endif
+
+/* internal SWIG method */
+#ifndef SWIGINTERN
+# define SWIGINTERN static SWIGUNUSED
+#endif
+
+/* internal inline SWIG method */
+#ifndef SWIGINTERNINLINE
+# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
+#endif
+
+/* exporting methods */
+#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#  ifndef GCC_HASCLASSVISIBILITY
+#    define GCC_HASCLASSVISIBILITY
+#  endif
+#endif
+
+#ifndef SWIGEXPORT
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   if defined(STATIC_LINKED)
+#     define SWIGEXPORT
+#   else
+#     define SWIGEXPORT __declspec(dllexport)
+#   endif
+# else
+#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
+#     define SWIGEXPORT __attribute__ ((visibility("default")))
+#   else
+#     define SWIGEXPORT
+#   endif
+# endif
+#endif
+
+/* calling conventions for Windows */
+#ifndef SWIGSTDCALL
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   define SWIGSTDCALL __stdcall
+# else
+#   define SWIGSTDCALL
+# endif 
+#endif
+
+/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
+#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
+# define _SCL_SECURE_NO_DEPRECATE
+#endif
+
+
+/* -----------------------------------------------------------------------------
+ * swigrun.swg
+ *
+ * This file contains generic CAPI SWIG runtime support for pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+/* This should only be incremented when either the layout of swig_type_info changes,
+   or for whatever reason, the runtime changes incompatibly */
+#define SWIG_RUNTIME_VERSION "4"
+
+/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
+#ifdef SWIG_TYPE_TABLE
+# define SWIG_QUOTE_STRING(x) #x
+# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
+# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
+#else
+# define SWIG_TYPE_TABLE_NAME
+#endif
+
+/*
+  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
+  creating a static or dynamic library from the swig runtime code.
+  In 99.9% of the cases, swig just needs to declare them as 'static'.
+  
+  But only do this if is strictly necessary, ie, if you have problems
+  with your compiler or so.
+*/
+
+#ifndef SWIGRUNTIME
+# define SWIGRUNTIME SWIGINTERN
+#endif
+
+#ifndef SWIGRUNTIMEINLINE
+# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
+#endif
+
+/*  Generic buffer size */
+#ifndef SWIG_BUFFER_SIZE
+# define SWIG_BUFFER_SIZE 1024
+#endif
+
+/* Flags for pointer conversions */
+#define SWIG_POINTER_DISOWN        0x1
+#define SWIG_CAST_NEW_MEMORY       0x2
+
+/* Flags for new pointer objects */
+#define SWIG_POINTER_OWN           0x1
+
+
+/* 
+   Flags/methods for returning states.
+   
+   The swig conversion methods, as ConvertPtr, return and integer 
+   that tells if the conversion was successful or not. And if not,
+   an error code can be returned (see swigerrors.swg for the codes).
+   
+   Use the following macros/flags to set or process the returning
+   states.
+   
+   In old swig versions, you usually write code as:
+
+     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
+       // success code
+     } else {
+       //fail code
+     }
+
+   Now you can be more explicit as:
+
+    int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+    } else {
+      // fail code
+    }
+
+   that seems to be the same, but now you can also do
+
+    Type *ptr;
+    int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+      if (SWIG_IsNewObj(res) {
+        ...
+       delete *ptr;
+      } else {
+        ...
+      }
+    } else {
+      // fail code
+    }
+    
+   I.e., now SWIG_ConvertPtr can return new objects and you can
+   identify the case and take care of the deallocation. Of course that
+   requires also to SWIG_ConvertPtr to return new result values, as
+
+      int SWIG_ConvertPtr(obj, ptr,...) {         
+        if (<obj is ok>) {                            
+          if (<need new object>) {                    
+            *ptr = <ptr to new allocated object>; 
+            return SWIG_NEWOBJ;                       
+          } else {                                    
+            *ptr = <ptr to old object>;               
+            return SWIG_OLDOBJ;                       
+          }                                   
+        } else {                                      
+          return SWIG_BADOBJ;                 
+        }                                             
+      }
+
+   Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
+   more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
+   swig errors code.
+
+   Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
+   allows to return the 'cast rank', for example, if you have this
+
+       int food(double)
+       int fooi(int);
+
+   and you call
+      food(1)   // cast rank '1'  (1 -> 1.0)
+      fooi(1)   // cast rank '0'
+
+   just use the SWIG_AddCast()/SWIG_CheckState()
+
+
+ */
+#define SWIG_OK                    (0) 
+#define SWIG_ERROR                 (-1)
+#define SWIG_IsOK(r)               (r >= 0)
+#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)  
+
+/* The CastRankLimit says how many bits are used for the cast rank */
+#define SWIG_CASTRANKLIMIT         (1 << 8)
+/* The NewMask denotes the object was created (using new/malloc) */
+#define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
+/* The TmpMask is for in/out typemaps that use temporal objects */
+#define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
+/* Simple returning values */
+#define SWIG_BADOBJ                (SWIG_ERROR)
+#define SWIG_OLDOBJ                (SWIG_OK)
+#define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
+#define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
+/* Check, add and del mask methods */
+#define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
+#define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
+#define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
+#define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
+#define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
+#define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
+
+
+/* Cast-Rank Mode */
+#if defined(SWIG_CASTRANK_MODE)
+#  ifndef SWIG_TypeRank
+#    define SWIG_TypeRank             unsigned long
+#  endif
+#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
+#    define SWIG_MAXCASTRANK          (2)
+#  endif
+#  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
+#  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
+SWIGINTERNINLINE int SWIG_AddCast(int r) { 
+  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
+}
+SWIGINTERNINLINE int SWIG_CheckState(int r) { 
+  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
+}
+#else /* no cast-rank mode */
+#  define SWIG_AddCast
+#  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
+#endif
+
+
+
+
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void *(*swig_converter_func)(void *, int *);
+typedef struct swig_type_info *(*swig_dycast_func)(void **);
+
+/* Structure to store information on one type */
+typedef struct swig_type_info {
+  const char             *name;                        /* mangled name of this type */
+  const char             *str;                 /* human readable name of this type */
+  swig_dycast_func        dcast;               /* dynamic cast function down a hierarchy */
+  struct swig_cast_info  *cast;                        /* linked list of types that can cast into this type */
+  void                   *clientdata;          /* language specific type data */
+  int                    owndata;              /* flag if the structure owns the clientdata */
+} swig_type_info;
+
+/* Structure to store a type and conversion function used for casting */
+typedef struct swig_cast_info {
+  swig_type_info         *type;                        /* pointer to type that is equivalent to this type */
+  swig_converter_func     converter;           /* function to cast the void pointers */
+  struct swig_cast_info  *next;                        /* pointer to next cast in linked list */
+  struct swig_cast_info  *prev;                        /* pointer to the previous cast */
+} swig_cast_info;
+
+/* Structure used to store module information
+ * Each module generates one structure like this, and the runtime collects
+ * all of these structures and stores them in a circularly linked list.*/
+typedef struct swig_module_info {
+  swig_type_info         **types;              /* Array of pointers to swig_type_info structures that are in this module */
+  size_t                 size;                 /* Number of types in this module */
+  struct swig_module_info *next;               /* Pointer to next element in circularly linked list */
+  swig_type_info         **type_initial;       /* Array of initially generated type structures */
+  swig_cast_info         **cast_initial;       /* Array of initially generated casting structures */
+  void                    *clientdata;         /* Language specific module data */
+} swig_module_info;
+
+/* 
+  Compare two type names skipping the space characters, therefore
+  "char*" == "char *" and "Class<int>" == "Class<int >", etc.
+
+  Return 0 when the two name types are equivalent, as in
+  strncmp, but skipping ' '.
+*/
+SWIGRUNTIME int
+SWIG_TypeNameComp(const char *f1, const char *l1,
+                 const char *f2, const char *l2) {
+  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
+    while ((*f1 == ' ') && (f1 != l1)) ++f1;
+    while ((*f2 == ' ') && (f2 != l2)) ++f2;
+    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
+  }
+  return (int)((l1 - f1) - (l2 - f2));
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if not equal, 1 if equal
+*/
+SWIGRUNTIME int
+SWIG_TypeEquiv(const char *nb, const char *tb) {
+  int equiv = 0;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (!equiv && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
+*/
+SWIGRUNTIME int
+SWIG_TypeCompare(const char *nb, const char *tb) {
+  int equiv = 0;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (!equiv && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
+
+
+/* think of this as a c++ template<> or a scheme macro */
+#define SWIG_TypeCheck_Template(comparison, ty)         \
+  if (ty) {                                             \
+    swig_cast_info *iter = ty->cast;                    \
+    while (iter) {                                      \
+      if (comparison) {                                 \
+        if (iter == ty->cast) return iter;              \
+        /* Move iter to the top of the linked list */   \
+        iter->prev->next = iter->next;                  \
+        if (iter->next)                                 \
+          iter->next->prev = iter->prev;                \
+        iter->next = ty->cast;                          \
+        iter->prev = 0;                                 \
+        if (ty->cast) ty->cast->prev = iter;            \
+        ty->cast = iter;                                \
+        return iter;                                    \
+      }                                                 \
+      iter = iter->next;                                \
+    }                                                   \
+  }                                                     \
+  return 0
+
+/*
+  Check the typename
+*/
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheck(const char *c, swig_type_info *ty) {
+  SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
+}
+
+/* Same as previous function, except strcmp is replaced with a pointer comparison */
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
+  SWIG_TypeCheck_Template(iter->type == from, into);
+}
+
+/*
+  Cast a pointer up an inheritance hierarchy
+*/
+SWIGRUNTIMEINLINE void *
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
+}
+
+/* 
+   Dynamic pointer casting. Down an inheritance hierarchy
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
+  swig_type_info *lastty = ty;
+  if (!ty || !ty->dcast) return ty;
+  while (ty && (ty->dcast)) {
+    ty = (*ty->dcast)(ptr);
+    if (ty) lastty = ty;
+  }
+  return lastty;
+}
+
+/*
+  Return the name associated with this type
+*/
+SWIGRUNTIMEINLINE const char *
+SWIG_TypeName(const swig_type_info *ty) {
+  return ty->name;
+}
+
+/*
+  Return the pretty name associated with this type,
+  that is an unmangled type name in a form presentable to the user.
+*/
+SWIGRUNTIME const char *
+SWIG_TypePrettyName(const swig_type_info *type) {
+  /* The "str" field contains the equivalent pretty names of the
+     type, separated by vertical-bar characters.  We choose
+     to print the last name, as it is often (?) the most
+     specific. */
+  if (!type) return NULL;
+  if (type->str != NULL) {
+    const char *last_name = type->str;
+    const char *s;
+    for (s = type->str; *s; s++)
+      if (*s == '|') last_name = s+1;
+    return last_name;
+  }
+  else
+    return type->name;
+}
+
+/* 
+   Set the clientdata field for a type
+*/
+SWIGRUNTIME void
+SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
+  swig_cast_info *cast = ti->cast;
+  /* if (ti->clientdata == clientdata) return; */
+  ti->clientdata = clientdata;
+  
+  while (cast) {
+    if (!cast->converter) {
+      swig_type_info *tc = cast->type;
+      if (!tc->clientdata) {
+       SWIG_TypeClientData(tc, clientdata);
+      }
+    }    
+    cast = cast->next;
+  }
+}
+SWIGRUNTIME void
+SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
+  SWIG_TypeClientData(ti, clientdata);
+  ti->owndata = 1;
+}
+  
+/*
+  Search for a swig_type_info structure only by mangled name
+  Search is a O(log #types)
+  
+  We start searching at module start, and finish searching when start == end.  
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_MangledTypeQueryModule(swig_module_info *start, 
+                            swig_module_info *end, 
+                           const char *name) {
+  swig_module_info *iter = start;
+  do {
+    if (iter->size) {
+      register size_t l = 0;
+      register size_t r = iter->size - 1;
+      do {
+       /* since l+r >= 0, we can (>> 1) instead (/ 2) */
+       register size_t i = (l + r) >> 1; 
+       const char *iname = iter->types[i]->name;
+       if (iname) {
+         register int compare = strcmp(name, iname);
+         if (compare == 0) {       
+           return iter->types[i];
+         } else if (compare < 0) {
+           if (i) {
+             r = i - 1;
+           } else {
+             break;
+           }
+         } else if (compare > 0) {
+           l = i + 1;
+         }
+       } else {
+         break; /* should never happen */
+       }
+      } while (l <= r);
+    }
+    iter = iter->next;
+  } while (iter != end);
+  return 0;
+}
+
+/*
+  Search for a swig_type_info structure for either a mangled name or a human readable name.
+  It first searches the mangled names of the types, which is a O(log #types)
+  If a type is not found it then searches the human readable names, which is O(#types).
+  
+  We start searching at module start, and finish searching when start == end.  
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeQueryModule(swig_module_info *start, 
+                     swig_module_info *end, 
+                    const char *name) {
+  /* STEP 1: Search the name field using binary search */
+  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
+  if (ret) {
+    return ret;
+  } else {
+    /* STEP 2: If the type hasn't been found, do a complete search
+       of the str field (the human readable name) */
+    swig_module_info *iter = start;
+    do {
+      register size_t i = 0;
+      for (; i < iter->size; ++i) {
+       if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
+         return iter->types[i];
+      }
+      iter = iter->next;
+    } while (iter != end);
+  }
+  
+  /* neither found a match */
+  return 0;
+}
+
+/* 
+   Pack binary data into a string
+*/
+SWIGRUNTIME char *
+SWIG_PackData(char *c, void *ptr, size_t sz) {
+  static const char hex[17] = "0123456789abcdef";
+  register const unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu =  u + sz;
+  for (; u != eu; ++u) {
+    register unsigned char uu = *u;
+    *(c++) = hex[(uu & 0xf0) >> 4];
+    *(c++) = hex[uu & 0xf];
+  }
+  return c;
+}
+
+/* 
+   Unpack binary data from a string
+*/
+SWIGRUNTIME const char *
+SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
+  register unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu = u + sz;
+  for (; u != eu; ++u) {
+    register char d = *(c++);
+    register unsigned char uu;
+    if ((d >= '0') && (d <= '9'))
+      uu = ((d - '0') << 4);
+    else if ((d >= 'a') && (d <= 'f'))
+      uu = ((d - ('a'-10)) << 4);
+    else 
+      return (char *) 0;
+    d = *(c++);
+    if ((d >= '0') && (d <= '9'))
+      uu |= (d - '0');
+    else if ((d >= 'a') && (d <= 'f'))
+      uu |= (d - ('a'-10));
+    else 
+      return (char *) 0;
+    *u = uu;
+  }
+  return c;
+}
+
+/* 
+   Pack 'void *' into a string buffer.
+*/
+SWIGRUNTIME char *
+SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
+  char *r = buff;
+  if ((2*sizeof(void *) + 2) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,&ptr,sizeof(void *));
+  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
+  strcpy(r,name);
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      *ptr = (void *) 0;
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sizeof(void *));
+}
+
+SWIGRUNTIME char *
+SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
+  char *r = buff;
+  size_t lname = (name ? strlen(name) : 0);
+  if ((2*sz + 2 + lname) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  if (lname) {
+    strncpy(r,name,lname+1);
+  } else {
+    *r = 0;
+  }
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      memset(ptr,0,sz);
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sz);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/*  Errors in SWIG */
+#define  SWIG_UnknownError        -1 
+#define  SWIG_IOError             -2 
+#define  SWIG_RuntimeError        -3 
+#define  SWIG_IndexError          -4 
+#define  SWIG_TypeError           -5 
+#define  SWIG_DivisionByZero      -6 
+#define  SWIG_OverflowError       -7 
+#define  SWIG_SyntaxError         -8 
+#define  SWIG_ValueError          -9 
+#define  SWIG_SystemError         -10
+#define  SWIG_AttributeError      -11
+#define  SWIG_MemoryError         -12 
+#define  SWIG_NullReferenceError   -13
+
+
+
+#ifdef __cplusplus
+/* Needed on some windows machines---since MS plays funny games with the header files under C++ */
+#include <math.h>
+#include <stdlib.h>
+extern "C" {
+#endif
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+/* Add in functionality missing in older versions of Perl. Much of this is based on Devel-PPPort on cpan. */
+
+/* Add PERL_REVISION, PERL_VERSION, PERL_SUBVERSION if missing */
+#ifndef PERL_REVISION
+#  if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION))
+#    define PERL_PATCHLEVEL_H_IMPLICIT
+#    include <patchlevel.h>
+#  endif
+#  if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL)))
+#    include <could_not_find_Perl_patchlevel.h>
+#  endif
+#  ifndef PERL_REVISION
+#    define PERL_REVISION       (5)
+#    define PERL_VERSION        PATCHLEVEL
+#    define PERL_SUBVERSION     SUBVERSION
+#  endif
+#endif
+
+#if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE)
+#define PerlIO_exportFILE(fh,fl) (FILE*)(fh)
+#endif
+
+#ifndef SvIOK_UV
+# define SvIOK_UV(sv)       (SvIOK(sv) && (SvUVX(sv) == SvIVX(sv)))
+#endif
+
+#ifndef SvUOK
+# define SvUOK(sv)           SvIOK_UV(sv)
+#endif
+
+#if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5)))
+#  define PL_sv_undef               sv_undef
+#  define PL_na                            na
+#  define PL_errgv                  errgv
+#  define PL_sv_no                  sv_no
+#  define PL_sv_yes                 sv_yes
+#  define PL_markstack_ptr          markstack_ptr
+#endif
+
+#ifndef IVSIZE
+#  ifdef LONGSIZE
+#    define IVSIZE LONGSIZE
+#  else
+#    define IVSIZE 4 /* A bold guess, but the best we can make. */
+#  endif
+#endif
+
+#ifndef INT2PTR
+#  if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)
+#    define PTRV                  UV
+#    define INT2PTR(any,d)        (any)(d)
+#  else
+#    if PTRSIZE == LONGSIZE
+#      define PTRV                unsigned long
+#    else
+#      define PTRV                unsigned
+#    endif
+#    define INT2PTR(any,d)        (any)(PTRV)(d)
+#  endif
+
+#  define NUM2PTR(any,d)  (any)(PTRV)(d)
+#  define PTR2IV(p)       INT2PTR(IV,p)
+#  define PTR2UV(p)       INT2PTR(UV,p)
+#  define PTR2NV(p)       NUM2PTR(NV,p)
+
+#  if PTRSIZE == LONGSIZE
+#    define PTR2ul(p)     (unsigned long)(p)
+#  else
+#    define PTR2ul(p)     INT2PTR(unsigned long,p)
+#  endif
+#endif /* !INT2PTR */
+
+#ifndef SvPV_nolen
+# define SvPV_nolen(x) SvPV(x,PL_na)
+#endif
+
+#ifndef get_sv
+#  define get_sv perl_get_sv
+#endif
+
+#ifndef ERRSV
+#  define ERRSV get_sv("@",FALSE)
+#endif
+
+#ifndef pTHX_
+#define pTHX_
+#endif   
+
+#include <string.h>
+#ifdef __cplusplus
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ * error manipulation
+ * ----------------------------------------------------------------------------- */
+
+SWIGINTERN const char*
+SWIG_Perl_ErrorType(int code) {
+  const char* type = 0;
+  switch(code) {
+  case SWIG_MemoryError:
+    type = "MemoryError";
+    break;
+  case SWIG_IOError:
+    type = "IOError";
+    break;
+  case SWIG_RuntimeError:
+    type = "RuntimeError";
+    break;
+  case SWIG_IndexError:
+    type = "IndexError";
+    break;
+  case SWIG_TypeError:
+    type = "TypeError";
+    break;
+  case SWIG_DivisionByZero:
+    type = "ZeroDivisionError";
+    break;
+  case SWIG_OverflowError:
+    type = "OverflowError";
+    break;
+  case SWIG_SyntaxError:
+    type = "SyntaxError";
+    break;
+  case SWIG_ValueError:
+    type = "ValueError";
+    break;
+  case SWIG_SystemError:
+    type = "SystemError";
+    break;
+  case SWIG_AttributeError:
+    type = "AttributeError";
+    break;
+  default:
+    type = "RuntimeError";
+  }
+  return type;
+}
+
+
+
+
+/* -----------------------------------------------------------------------------
+ * perlrun.swg
+ *
+ * This file contains the runtime support for Perl modules
+ * and includes code for managing global variables and pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef PERL_OBJECT
+#define SWIG_PERL_OBJECT_DECL CPerlObj *SWIGUNUSEDPARM(pPerl),
+#define SWIG_PERL_OBJECT_CALL pPerl,
+#else
+#define SWIG_PERL_OBJECT_DECL
+#define SWIG_PERL_OBJECT_CALL
+#endif
+
+/* Common SWIG API */
+
+/* for raw pointers */
+#define SWIG_ConvertPtr(obj, pp, type, flags)           SWIG_Perl_ConvertPtr(SWIG_PERL_OBJECT_CALL obj, pp, type, flags)
+#define SWIG_NewPointerObj(p, type, flags)              SWIG_Perl_NewPointerObj(SWIG_PERL_OBJECT_CALL p, type, flags)
+
+/* for raw packed data */
+#define SWIG_ConvertPacked(obj, p, s, type)             SWIG_Perl_ConvertPacked(SWIG_PERL_OBJECT_CALL obj, p, s, type)
+#define SWIG_NewPackedObj(p, s, type)                  SWIG_Perl_NewPackedObj(SWIG_PERL_OBJECT_CALL p, s, type)
+
+/* for class or struct pointers */
+#define SWIG_ConvertInstance(obj, pptr, type, flags)    SWIG_ConvertPtr(obj, pptr, type, flags)
+#define SWIG_NewInstanceObj(ptr, type, flags)           SWIG_NewPointerObj(ptr, type, flags)
+
+/* for C or C++ function pointers */
+#define SWIG_ConvertFunctionPtr(obj, pptr, type)        SWIG_ConvertPtr(obj, pptr, type, 0)
+#define SWIG_NewFunctionPtrObj(ptr, type)               SWIG_NewPointerObj(ptr, type, 0)
+
+/* for C++ member pointers, ie, member methods */
+#define SWIG_ConvertMember(obj, ptr, sz, ty)            SWIG_ConvertPacked(obj, ptr, sz, ty)
+#define SWIG_NewMemberObj(ptr, sz, type)                SWIG_NewPackedObj(ptr, sz, type)
+
+
+/* Runtime API */
+
+#define SWIG_GetModule(clientdata)                      SWIG_Perl_GetModule()
+#define SWIG_SetModule(clientdata, pointer)             SWIG_Perl_SetModule(pointer)
+
+
+/* Error manipulation */
+
+#define SWIG_ErrorType(code)                            SWIG_Perl_ErrorType(code)               
+#define SWIG_Error(code, msg)                          sv_setpvf(GvSV(PL_errgv),"%s %s\n", SWIG_ErrorType(code), msg)
+#define SWIG_fail                                      goto fail                                                   
+
+/* Perl-specific SWIG API */
+
+#define SWIG_MakePtr(sv, ptr, type, flags)              SWIG_Perl_MakePtr(SWIG_PERL_OBJECT_CALL sv, ptr, type, flags)
+#define SWIG_MakePackedObj(sv, p, s, type)             SWIG_Perl_MakePackedObj(SWIG_PERL_OBJECT_CALL sv, p, s, type)
+#define SWIG_SetError(str)                              SWIG_Error(SWIG_RuntimeError, str)
+
+
+#define SWIG_PERL_DECL_ARGS_1(arg1)                     (SWIG_PERL_OBJECT_DECL arg1)
+#define SWIG_PERL_CALL_ARGS_1(arg1)                     (SWIG_PERL_OBJECT_CALL arg1)
+#define SWIG_PERL_DECL_ARGS_2(arg1, arg2)               (SWIG_PERL_OBJECT_DECL arg1, arg2)
+#define SWIG_PERL_CALL_ARGS_2(arg1, arg2)               (SWIG_PERL_OBJECT_CALL arg1, arg2)
+
+/* -----------------------------------------------------------------------------
+ * pointers/data manipulation
+ * ----------------------------------------------------------------------------- */
+
+/* For backward compatibility only */
+#define SWIG_POINTER_EXCEPTION  0
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SWIG_OWNER   SWIG_POINTER_OWN
+#define SWIG_SHADOW  SWIG_OWNER << 1
+
+#define SWIG_MAYBE_PERL_OBJECT SWIG_PERL_OBJECT_DECL
+
+/* SWIG Perl macros */
+
+/* Macro to declare an XS function */
+#ifndef XSPROTO
+#   define XSPROTO(name) void name(pTHX_ CV* cv)
+#endif
+
+/* Macro to call an XS function */
+#ifdef PERL_OBJECT 
+#  define SWIG_CALLXS(_name) _name(cv,pPerl) 
+#else 
+#  ifndef MULTIPLICITY 
+#    define SWIG_CALLXS(_name) _name(cv) 
+#  else 
+#    define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv) 
+#  endif 
+#endif 
+
+#ifdef PERL_OBJECT
+#define MAGIC_PPERL  CPerlObj *pPerl = (CPerlObj *) this;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
+#define SWIGCLASS_STATIC
+
+#else /* PERL_OBJECT */
+
+#define MAGIC_PPERL
+#define SWIGCLASS_STATIC static SWIGUNUSED
+
+#ifndef MULTIPLICITY
+#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (*SwigMagicFunc)(SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#else /* MULTIPLICITY */
+
+#define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MULTIPLICITY */
+#endif /* PERL_OBJECT */
+
+/* Workaround for bug in perl 5.6.x croak and earlier */
+#if (PERL_VERSION < 8)
+#  ifdef PERL_OBJECT
+#    define SWIG_croak_null() SWIG_Perl_croak_null(pPerl)
+static void SWIG_Perl_croak_null(CPerlObj *pPerl)
+#  else
+static void SWIG_croak_null()
+#  endif
+{
+  SV *err=ERRSV;
+#  if (PERL_VERSION < 6)
+  croak("%_", err);
+#  else
+  if (SvOK(err) && !SvROK(err)) croak("%_", err);
+  croak(Nullch);
+#  endif
+}
+#else
+#  define SWIG_croak_null() croak(Nullch)
+#endif
+
+
+/* 
+   Define how strict is the cast between strings and integers/doubles
+   when overloading between these types occurs.
+   
+   The default is making it as strict as possible by using SWIG_AddCast
+   when needed.
+   
+   You can use -DSWIG_PERL_NO_STRICT_STR2NUM at compilation time to
+   disable the SWIG_AddCast, making the casting between string and
+   numbers less strict.
+
+   In the end, we try to solve the overloading between strings and
+   numerical types in the more natural way, but if you can avoid it,
+   well, avoid it using %rename, for example.
+*/
+#ifndef SWIG_PERL_NO_STRICT_STR2NUM
+# ifndef SWIG_PERL_STRICT_STR2NUM
+#  define SWIG_PERL_STRICT_STR2NUM
+# endif
+#endif
+#ifdef SWIG_PERL_STRICT_STR2NUM
+/* string takes precedence */
+#define SWIG_Str2NumCast(x) SWIG_AddCast(x)  
+#else
+/* number takes precedence */
+#define SWIG_Str2NumCast(x) x
+#endif
+
+
+
+#include <stdlib.h>
+
+SWIGRUNTIME const char *
+SWIG_Perl_TypeProxyName(const swig_type_info *type) {
+  if (!type) return NULL;
+  if (type->clientdata != NULL) {
+    return (const char*) type->clientdata;
+  } 
+  else {
+    return type->name;
+  }
+}
+
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
+  SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp(iter->type->name, c) == 0)) 
+                           || (iter->type->clientdata && (strcmp((char*)iter->type->clientdata, c) == 0))), ty);
+}
+
+
+/* Function for getting a pointer value */
+
+SWIGRUNTIME int
+SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags) {
+  swig_cast_info *tc;
+  void *voidptr = (void *)0;
+  SV *tsv = 0;
+  /* If magical, apply more magic */
+  if (SvGMAGICAL(sv))
+    mg_get(sv);
+
+  /* Check to see if this is an object */
+  if (sv_isobject(sv)) {
+    IV tmp = 0;
+    tsv = (SV*) SvRV(sv);
+    if ((SvTYPE(tsv) == SVt_PVHV)) {
+      MAGIC *mg;
+      if (SvMAGICAL(tsv)) {
+        mg = mg_find(tsv,'P');
+        if (mg) {
+          sv = mg->mg_obj;
+          if (sv_isobject(sv)) {
+           tsv = (SV*)SvRV(sv);
+            tmp = SvIV(tsv);
+          }
+        }
+      } else {
+        return SWIG_ERROR;
+      }
+    } else {
+      tmp = SvIV(tsv);
+    }
+    voidptr = INT2PTR(void *,tmp);
+  } else if (! SvOK(sv)) {            /* Check for undef */
+    *(ptr) = (void *) 0;
+    return SWIG_OK;
+  } else if (SvTYPE(sv) == SVt_RV) {  /* Check for NULL pointer */
+    if (!SvROK(sv)) {
+      *(ptr) = (void *) 0;
+      return SWIG_OK;
+    } else {
+      return SWIG_ERROR;
+    }
+  } else {                            /* Don't know what it is */
+    return SWIG_ERROR;
+  }
+  if (_t) {
+    /* Now see if the types match */
+    char *_c = HvNAME(SvSTASH(SvRV(sv)));
+    tc = SWIG_TypeProxyCheck(_c,_t);
+    if (!tc) {
+      return SWIG_ERROR;
+    }
+    {
+      int newmemory = 0;
+      *ptr = SWIG_TypeCast(tc,voidptr,&newmemory);
+      assert(!newmemory); /* newmemory handling not yet implemented */
+    }
+  } else {
+    *ptr = voidptr;
+  }
+
+  /* 
+   *  DISOWN implementation: we need a perl guru to check this one.
+   */
+  if (tsv && (flags & SWIG_POINTER_DISOWN)) {
+    /* 
+     *  almost copy paste code from below SWIG_POINTER_OWN setting
+     */
+    SV *obj = sv;
+    HV *stash = SvSTASH(SvRV(obj));
+    GV *gv = *(GV**) hv_fetch(stash, "OWNER", 5, TRUE);
+    if (isGV(gv)) {
+      HV *hv = GvHVn(gv);
+      /*
+       * To set ownership (see below), a newSViv(1) entry is added. 
+       * Hence, to remove ownership, we delete the entry.
+       */
+      if (hv_exists_ent(hv, obj, 0)) {
+       hv_delete_ent(hv, obj, 0, 0);
+      }
+    }
+  }
+  return SWIG_OK;
+}
+
+SWIGRUNTIME void
+SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, swig_type_info *t, int flags) {
+  if (ptr && (flags & SWIG_SHADOW)) {
+    SV *self;
+    SV *obj=newSV(0);
+    HV *hash=newHV();
+    HV *stash;
+    sv_setref_pv(obj, (char *) SWIG_Perl_TypeProxyName(t), ptr);
+    stash=SvSTASH(SvRV(obj));
+    if (flags & SWIG_POINTER_OWN) {
+      HV *hv;
+      GV *gv=*(GV**)hv_fetch(stash, "OWNER", 5, TRUE);
+      if (!isGV(gv))
+        gv_init(gv, stash, "OWNER", 5, FALSE);
+      hv=GvHVn(gv);
+      hv_store_ent(hv, obj, newSViv(1), 0);
+    }
+    sv_magic((SV *)hash, (SV *)obj, 'P', Nullch, 0);
+    SvREFCNT_dec(obj);
+    self=newRV_noinc((SV *)hash);
+    sv_setsv(sv, self);
+    SvREFCNT_dec((SV *)self);
+    sv_bless(sv, stash);
+  }
+  else {
+    sv_setref_pv(sv, (char *) SWIG_Perl_TypeProxyName(t), ptr);
+  }
+}
+
+SWIGRUNTIMEINLINE SV *
+SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info *t, int flags) {
+  SV *result = sv_newmortal();
+  SWIG_MakePtr(result, ptr, t, flags);
+  return result;
+}
+
+SWIGRUNTIME void
+SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, int sz, swig_type_info *type) {
+  char result[1024];
+  char *r = result;
+  if ((2*sz + 1 + strlen(SWIG_Perl_TypeProxyName(type))) > 1000) return;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  strcpy(r,SWIG_Perl_TypeProxyName(type));
+  sv_setpv(sv, result);
+}
+
+SWIGRUNTIME SV *
+SWIG_Perl_NewPackedObj(SWIG_MAYBE_PERL_OBJECT void *ptr, int sz, swig_type_info *type) {
+  SV *result = sv_newmortal();
+  SWIG_Perl_MakePackedObj(result, ptr, sz, type);
+  return result;
+}
+
+/* Convert a packed value value */
+SWIGRUNTIME int
+SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty) {
+  swig_cast_info *tc;
+  const char  *c = 0;
+
+  if ((!obj) || (!SvOK(obj))) return SWIG_ERROR;
+  c = SvPV_nolen(obj);
+  /* Pointer values must start with leading underscore */
+  if (*c != '_') return SWIG_ERROR;
+  c++;
+  c = SWIG_UnpackData(c,ptr,sz);
+  if (ty) {
+    tc = SWIG_TypeCheck(c,ty);
+    if (!tc) return SWIG_ERROR;
+  }
+  return SWIG_OK;
+}
+
+
+/* Macros for low-level exception handling */
+#define SWIG_croak(x)    { SWIG_Error(SWIG_RuntimeError, x); SWIG_fail; }
+
+
+typedef XSPROTO(SwigPerlWrapper);
+typedef SwigPerlWrapper *SwigPerlWrapperPtr;
+
+/* Structure for command table */
+typedef struct {
+  const char         *name;
+  SwigPerlWrapperPtr  wrapper;
+} swig_command_info;
+
+/* Information for constant table */
+
+#define SWIG_INT     1
+#define SWIG_FLOAT   2
+#define SWIG_STRING  3
+#define SWIG_POINTER 4
+#define SWIG_BINARY  5
+
+/* Constant information structure */
+typedef struct swig_constant_info {
+    int              type;
+    const char      *name;
+    long             lvalue;
+    double           dvalue;
+    void            *pvalue;
+    swig_type_info **ptype;
+} swig_constant_info;
+
+
+/* Structure for variable table */
+typedef struct {
+  const char   *name;
+  SwigMagicFunc   set;
+  SwigMagicFunc   get;
+  swig_type_info  **type;
+} swig_variable_info;
+
+/* Magic variable code */
+#ifndef PERL_OBJECT
+#define swig_create_magic(s,a,b,c) _swig_create_magic(s,a,b,c)
+  #ifndef MULTIPLICITY
+     SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) 
+  #else
+     SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) 
+  #endif
+#else
+#  define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c)
+SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) 
+#endif
+{
+  MAGIC *mg;
+  sv_magic(sv,sv,'U',(char *) name,strlen(name));
+  mg = mg_find(sv,'U');
+  mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
+  mg->mg_virtual->svt_get = (SwigMagicFunc) get;
+  mg->mg_virtual->svt_set = (SwigMagicFunc) set;
+  mg->mg_virtual->svt_len = 0;
+  mg->mg_virtual->svt_clear = 0;
+  mg->mg_virtual->svt_free = 0;
+}
+
+
+SWIGRUNTIME swig_module_info *
+SWIG_Perl_GetModule(void) {
+  static void *type_pointer = (void *)0;
+  SV *pointer;
+
+  /* first check if pointer already created */
+  if (!type_pointer) {
+    pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI);
+    if (pointer && SvOK(pointer)) {
+      type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
+    }
+  }
+
+  return (swig_module_info *) type_pointer;
+}
+
+SWIGRUNTIME void
+SWIG_Perl_SetModule(swig_module_info *module) {
+  SV *pointer;
+
+  /* create a new pointer */
+  pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI);
+  sv_setiv(pointer, PTR2IV(module));
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/* Workaround perl5 global namespace pollution. Note that undefining library
+ * functions like fopen will not solve the problem on all platforms as fopen
+ * might be a macro on Windows but not necessarily on other operating systems. */
+#ifdef do_open
+  #undef do_open
+#endif
+#ifdef do_close
+  #undef do_close
+#endif
+#ifdef scalar
+  #undef scalar
+#endif
+#ifdef list
+  #undef list
+#endif
+#ifdef apply
+  #undef apply
+#endif
+#ifdef convert
+  #undef convert
+#endif
+#ifdef Error
+  #undef Error
+#endif
+#ifdef form
+  #undef form
+#endif
+#ifdef vform
+  #undef vform
+#endif
+#ifdef LABEL
+  #undef LABEL
+#endif
+#ifdef METHOD
+  #undef METHOD
+#endif
+#ifdef Move
+  #undef Move
+#endif
+#ifdef yylex
+  #undef yylex
+#endif
+#ifdef yyparse
+  #undef yyparse
+#endif
+#ifdef yyerror
+  #undef yyerror
+#endif
+#ifdef invert
+  #undef invert
+#endif
+#ifdef ref
+  #undef ref
+#endif
+#ifdef read
+  #undef read
+#endif
+#ifdef write
+  #undef write
+#endif
+#ifdef eof
+  #undef eof
+#endif
+#ifdef bool
+  #undef bool
+#endif
+#ifdef close
+  #undef close
+#endif
+#ifdef rewind
+  #undef rewind
+#endif
+#ifdef free
+  #undef free
+#endif
+#ifdef malloc
+  #undef malloc
+#endif
+#ifdef calloc
+  #undef calloc
+#endif
+#ifdef Stat
+  #undef Stat
+#endif
+#ifdef check
+  #undef check
+#endif
+#ifdef seekdir
+  #undef seekdir
+#endif
+#ifdef open
+  #undef open
+#endif
+
+
+
+#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
+
+#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else 
+
+
+
+  #define SWIG_exception(code, msg) do { SWIG_Error(code, msg); SWIG_fail;; } while(0) 
+
+
+/* -------- TYPES TABLE (BEGIN) -------- */
+
+#define SWIGTYPE_p_char swig_types[0]
+#define SWIGTYPE_p_double swig_types[1]
+#define SWIGTYPE_p_float swig_types[2]
+#define SWIGTYPE_p_int swig_types[3]
+#define SWIGTYPE_p_unsigned_char swig_types[4]
+static swig_type_info *swig_types[6];
+static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0};
+#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
+#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
+
+/* -------- TYPES TABLE (END) -------- */
+
+#define SWIG_init    boot_Amanda__Tapelist
+
+#define SWIG_name   "Amanda::Tapelistc::boot_Amanda__Tapelist"
+#define SWIG_prefix "Amanda::Tapelistc::"
+
+#define SWIGVERSION 0x010335 
+#define SWIG_VERSION SWIGVERSION
+
+
+#define SWIG_as_voidptr(a) (void *)((const void *)(a)) 
+#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) 
+
+
+#ifdef __cplusplus
+extern "C"
+#endif
+#ifndef PERL_OBJECT
+#ifndef MULTIPLICITY
+SWIGEXPORT void SWIG_init (CV* cv);
+#else
+SWIGEXPORT void SWIG_init (pTHXo_ CV* cv);
+#endif
+#else
+SWIGEXPORT void SWIG_init (CV *cv, CPerlObj *);
+#endif
+
+
+#include "amglue.h"
+
+
+#include "amglue.h"
+
+
+#include "amglue.h"
+
+
+#include "tapefile.h"
+
+
+SWIGINTERN swig_type_info*
+SWIG_pchar_descriptor(void)
+{
+  static int init = 0;
+  static swig_type_info* info = 0;
+  if (!init) {
+    info = SWIG_TypeQuery("_p_char");
+    init = 1;
+  }
+  return info;
+}
+
+
+SWIGINTERN int
+SWIG_AsCharPtrAndSize(SV *obj, char** cptr, size_t* psize, int *alloc)
+{
+  if (SvPOK(obj)) {
+    STRLEN len = 0;
+    char *cstr = SvPV(obj, len); 
+    size_t size = len + 1;
+    if (cptr)  {
+      if (alloc) {
+       if (*alloc == SWIG_NEWOBJ) {
+         *cptr = (char *)memcpy((char *)malloc((size)*sizeof(char)), cstr, sizeof(char)*(size));
+       } else {
+         *cptr = cstr;
+         *alloc = SWIG_OLDOBJ;
+       }
+      }
+    }
+    if (psize) *psize = size;
+    return SWIG_OK;
+  } else {
+    swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
+    if (pchar_descriptor) {
+      char* vptr = 0; 
+      if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_descriptor, 0) == SWIG_OK) {
+       if (cptr) *cptr = vptr;
+       if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0;
+       if (alloc) *alloc = SWIG_OLDOBJ;
+       return SWIG_OK;
+      }
+    }
+  }
+  return SWIG_TypeError;
+}
+
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef PERL_OBJECT
+#define MAGIC_CLASS _wrap_Amanda::Tapelist_var::
+class _wrap_Amanda::Tapelist_var : public CPerlObj {
+public:
+#else
+#define MAGIC_CLASS
+#endif
+SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *SWIGUNUSEDPARM(sv), MAGIC *SWIGUNUSEDPARM(mg)) {
+    MAGIC_PPERL
+    croak("Value is read-only.");
+    return 0;
+}
+
+
+#ifdef PERL_OBJECT
+};
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+XS(_wrap_C_read_tapelist) {
+  {
+    char *arg1 = (char *) 0 ;
+    int result;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: C_read_tapelist(tapefile);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "C_read_tapelist" "', argument " "1"" of type '" "char *""'");
+    }
+    arg1 = (char *)(buf1);
+    result = (int)read_tapelist(arg1);
+    {
+      ST(argvi) = sv_2mortal(amglue_newSVi64(result));
+      argvi++;
+    }
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_C_clear_tapelist) {
+  {
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: C_clear_tapelist();");
+    }
+    clear_tapelist();
+    
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
+
+static swig_type_info _swigt__p_char = {"_p_char", "gchar *|char *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_double = {"_p_double", "double *|gdouble *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_float = {"_p_float", "float *|gfloat *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_int = {"_p_int", "int *|gboolean *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "guchar *|unsigned char *", 0, 0, (void*)0, 0};
+
+static swig_type_info *swig_type_initial[] = {
+  &_swigt__p_char,
+  &_swigt__p_double,
+  &_swigt__p_float,
+  &_swigt__p_int,
+  &_swigt__p_unsigned_char,
+};
+
+static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_double[] = {  {&_swigt__p_double, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_float[] = {  {&_swigt__p_float, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_int[] = {  {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_unsigned_char[] = {  {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
+
+static swig_cast_info *swig_cast_initial[] = {
+  _swigc__p_char,
+  _swigc__p_double,
+  _swigc__p_float,
+  _swigc__p_int,
+  _swigc__p_unsigned_char,
+};
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
+
+static swig_constant_info swig_constants[] = {
+{0,0,0,0,0,0}
+};
+#ifdef __cplusplus
+}
+#endif
+static swig_variable_info swig_variables[] = {
+{0,0,0,0}
+};
+static swig_command_info swig_commands[] = {
+{"Amanda::Tapelistc::C_read_tapelist", _wrap_C_read_tapelist},
+{"Amanda::Tapelistc::C_clear_tapelist", _wrap_C_clear_tapelist},
+{0,0}
+};
+/* -----------------------------------------------------------------------------
+ * Type initialization:
+ * This problem is tough by the requirement that no dynamic 
+ * memory is used. Also, since swig_type_info structures store pointers to 
+ * swig_cast_info structures and swig_cast_info structures store pointers back
+ * to swig_type_info structures, we need some lookup code at initialization. 
+ * The idea is that swig generates all the structures that are needed. 
+ * The runtime then collects these partially filled structures. 
+ * The SWIG_InitializeModule function takes these initial arrays out of 
+ * swig_module, and does all the lookup, filling in the swig_module.types
+ * array with the correct data and linking the correct swig_cast_info
+ * structures together.
+ *
+ * The generated swig_type_info structures are assigned staticly to an initial 
+ * array. We just loop through that array, and handle each type individually.
+ * First we lookup if this type has been already loaded, and if so, use the
+ * loaded structure instead of the generated one. Then we have to fill in the
+ * cast linked list. The cast data is initially stored in something like a
+ * two-dimensional array. Each row corresponds to a type (there are the same
+ * number of rows as there are in the swig_type_initial array). Each entry in
+ * a column is one of the swig_cast_info structures for that type.
+ * The cast_initial array is actually an array of arrays, because each row has
+ * a variable number of columns. So to actually build the cast linked list,
+ * we find the array of casts associated with the type, and loop through it 
+ * adding the casts to the list. The one last trick we need to do is making
+ * sure the type pointer in the swig_cast_info struct is correct.
+ *
+ * First off, we lookup the cast->type name to see if it is already loaded. 
+ * There are three cases to handle:
+ *  1) If the cast->type has already been loaded AND the type we are adding
+ *     casting info to has not been loaded (it is in this module), THEN we
+ *     replace the cast->type pointer with the type pointer that has already
+ *     been loaded.
+ *  2) If BOTH types (the one we are adding casting info to, and the 
+ *     cast->type) are loaded, THEN the cast info has already been loaded by
+ *     the previous module so we just ignore it.
+ *  3) Finally, if cast->type has not already been loaded, then we add that
+ *     swig_cast_info to the linked list (because the cast->type) pointer will
+ *     be correct.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#if 0
+} /* c-mode */
+#endif
+#endif
+
+#if 0
+#define SWIGRUNTIME_DEBUG
+#endif
+
+
+SWIGRUNTIME void
+SWIG_InitializeModule(void *clientdata) {
+  size_t i;
+  swig_module_info *module_head, *iter;
+  int found, init;
+  
+  clientdata = clientdata;
+  
+  /* check to see if the circular list has been setup, if not, set it up */
+  if (swig_module.next==0) {
+    /* Initialize the swig_module */
+    swig_module.type_initial = swig_type_initial;
+    swig_module.cast_initial = swig_cast_initial;
+    swig_module.next = &swig_module;
+    init = 1;
+  } else {
+    init = 0;
+  }
+  
+  /* Try and load any already created modules */
+  module_head = SWIG_GetModule(clientdata);
+  if (!module_head) {
+    /* This is the first module loaded for this interpreter */
+    /* so set the swig module into the interpreter */
+    SWIG_SetModule(clientdata, &swig_module);
+    module_head = &swig_module;
+  } else {
+    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
+    found=0;
+    iter=module_head;
+    do {
+      if (iter==&swig_module) {
+        found=1;
+        break;
+      }
+      iter=iter->next;
+    } while (iter!= module_head);
+    
+    /* if the is found in the list, then all is done and we may leave */
+    if (found) return;
+    /* otherwise we must add out module into the list */
+    swig_module.next = module_head->next;
+    module_head->next = &swig_module;
+  }
+  
+  /* When multiple interpeters are used, a module could have already been initialized in
+       a different interpreter, but not yet have a pointer in this interpreter.
+       In this case, we do not want to continue adding types... everything should be
+       set up already */
+  if (init == 0) return;
+  
+  /* Now work on filling in swig_module.types */
+#ifdef SWIGRUNTIME_DEBUG
+  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
+#endif
+  for (i = 0; i < swig_module.size; ++i) {
+    swig_type_info *type = 0;
+    swig_type_info *ret;
+    swig_cast_info *cast;
+    
+#ifdef SWIGRUNTIME_DEBUG
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+#endif
+    
+    /* if there is another module already loaded */
+    if (swig_module.next != &swig_module) {
+      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
+    }
+    if (type) {
+      /* Overwrite clientdata field */
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: found type %s\n", type->name);
+#endif
+      if (swig_module.type_initial[i]->clientdata) {
+        type->clientdata = swig_module.type_initial[i]->clientdata;
+#ifdef SWIGRUNTIME_DEBUG
+        printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
+#endif
+      }
+    } else {
+      type = swig_module.type_initial[i];
+    }
+    
+    /* Insert casting types */
+    cast = swig_module.cast_initial[i];
+    while (cast->type) {
+      /* Don't need to add information already in the list */
+      ret = 0;
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
+#endif
+      if (swig_module.next != &swig_module) {
+        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
+#ifdef SWIGRUNTIME_DEBUG
+        if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
+#endif
+      }
+      if (ret) {
+        if (type == swig_module.type_initial[i]) {
+#ifdef SWIGRUNTIME_DEBUG
+          printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
+#endif
+          cast->type = ret;
+          ret = 0;
+        } else {
+          /* Check for casting already in the list */
+          swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
+#ifdef SWIGRUNTIME_DEBUG
+          if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
+#endif
+          if (!ocast) ret = 0;
+        }
+      }
+      
+      if (!ret) {
+#ifdef SWIGRUNTIME_DEBUG
+        printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
+#endif
+        if (type->cast) {
+          type->cast->prev = cast;
+          cast->next = type->cast;
+        }
+        type->cast = cast;
+      }
+      cast++;
+    }
+    /* Set entry in modules->types array equal to the type */
+    swig_module.types[i] = type;
+  }
+  swig_module.types[i] = 0;
+  
+#ifdef SWIGRUNTIME_DEBUG
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+  for (i = 0; i < swig_module.size; ++i) {
+    int j = 0;
+    swig_cast_info *cast = swig_module.cast_initial[i];
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+    while (cast->type) {
+      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
+      cast++;
+      ++j;
+    }
+    printf("---- Total casts: %d\n",j);
+  }
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+#endif
+}
+
+/* This function will propagate the clientdata field of type to
+* any new swig_type_info structures that have been added into the list
+* of equivalent types.  It is like calling
+* SWIG_TypeClientData(type, clientdata) a second time.
+*/
+SWIGRUNTIME void
+SWIG_PropagateClientData(void) {
+  size_t i;
+  swig_cast_info *equiv;
+  static int init_run = 0;
+  
+  if (init_run) return;
+  init_run = 1;
+  
+  for (i = 0; i < swig_module.size; i++) {
+    if (swig_module.types[i]->clientdata) {
+      equiv = swig_module.types[i]->cast;
+      while (equiv) {
+        if (!equiv->converter) {
+          if (equiv->type && !equiv->type->clientdata)
+          SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
+        }
+        equiv = equiv->next;
+      }
+    }
+  }
+}
+
+#ifdef __cplusplus
+#if 0
+{
+  /* c-mode */
+#endif
+}
+#endif
+
+
+
+#ifdef __cplusplus
+extern "C"
+#endif
+
+XS(SWIG_init) {
+  dXSARGS;
+  int i;
+  
+  SWIG_InitializeModule(0);
+  
+  /* Install commands */
+  for (i = 0; swig_commands[i].name; i++) {
+    newXS((char*) swig_commands[i].name,swig_commands[i].wrapper, (char*)__FILE__);
+  }
+  
+  /* Install variables */
+  for (i = 0; swig_variables[i].name; i++) {
+    SV *sv;
+    sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI);
+    if (swig_variables[i].type) {
+      SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0);
+    } else {
+      sv_setiv(sv,(IV) 0);
+    }
+    swig_create_magic(sv, (char *) swig_variables[i].name, swig_variables[i].set, swig_variables[i].get); 
+  }
+  
+  /* Install constant */
+  for (i = 0; swig_constants[i].type; i++) {
+    SV *sv;
+    sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI);
+    switch(swig_constants[i].type) {
+    case SWIG_INT:
+      sv_setiv(sv, (IV) swig_constants[i].lvalue);
+      break;
+    case SWIG_FLOAT:
+      sv_setnv(sv, (double) swig_constants[i].dvalue);
+      break;
+    case SWIG_STRING:
+      sv_setpv(sv, (char *) swig_constants[i].pvalue);
+      break;
+    case SWIG_POINTER:
+      SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype),0);
+      break;
+    case SWIG_BINARY:
+      SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype));
+      break;
+    default:
+      break;
+    }
+    SvREADONLY_on(sv);
+  }
+  
+  ST(0) = &PL_sv_yes;
+  XSRETURN(1);
+}
+
diff --git a/perl/Amanda/Tapelist.pm b/perl/Amanda/Tapelist.pm
new file mode 100644 (file)
index 0000000..ae86b7a
--- /dev/null
@@ -0,0 +1,272 @@
+# This file was automatically generated by SWIG (http://www.swig.org).
+# Version 1.3.35
+#
+# Don't modify this file, modify the SWIG interface instead.
+
+package Amanda::Tapelist;
+require Exporter;
+require DynaLoader;
+@ISA = qw(Exporter DynaLoader);
+package Amanda::Tapelistc;
+bootstrap Amanda::Tapelist;
+package Amanda::Tapelist;
+@EXPORT = qw( );
+
+# ---------- BASE METHODS -------------
+
+package Amanda::Tapelist;
+
+sub TIEHASH {
+    my ($classname,$obj) = @_;
+    return bless $obj, $classname;
+}
+
+sub CLEAR { }
+
+sub FIRSTKEY { }
+
+sub NEXTKEY { }
+
+sub FETCH {
+    my ($self,$field) = @_;
+    my $member_func = "swig_${field}_get";
+    $self->$member_func();
+}
+
+sub STORE {
+    my ($self,$field,$newval) = @_;
+    my $member_func = "swig_${field}_set";
+    $self->$member_func($newval);
+}
+
+sub this {
+    my $ptr = shift;
+    return tied(%$ptr);
+}
+
+
+# ------- FUNCTION WRAPPERS --------
+
+package Amanda::Tapelist;
+
+*C_read_tapelist = *Amanda::Tapelistc::C_read_tapelist;
+*C_clear_tapelist = *Amanda::Tapelistc::C_clear_tapelist;
+
+# ------- VARIABLE STUBS --------
+
+package Amanda::Tapelist;
+
+
+@EXPORT_OK = ();
+%EXPORT_TAGS = ();
+
+use Amanda::Debug qw(:logging);
+
+=head1 NAME
+
+Amanda::Tapelist - manipulate the Amanda tapelist
+
+=head1 SYNOPSIS
+
+    use Amanda::Tapelist;
+
+    my $tl = Amanda::Tapelist::read_tapelist("/path/to/tapefile");
+    $tl->add_tapelabel($datestamp, $label);
+    $tl->add_tapelabel($datestamp2, $label2, $comment);
+    $tl->write("/path/to/tapefile");
+
+=head1 API STATUS
+
+Stable
+
+=head1 OBJECT-ORIENTED INTERFACE
+
+The package-level functions C<read_tapelist($filename)> and C<clear_tapelist()>
+both return a new tapelist object.  C<read_tapelist> returns C<undef> if the
+tapelist does not exist.  Invalid entries are silently ignored.
+
+A tapelist object is a sequence of tapelist
+elements (referred to as TLEs in this document).  Each TLE is a hash with the
+following keys:
+
+=over
+
+=item C<position> -- the one-based position of the TLE in the tapelist
+
+=item C<datestamp> -- the datestamp on which this was written, or "0" for an
+unused tape
+
+=item C<reuse> -- true if this tape can be reused when it is no longer active
+
+=item C<label> -- tape label
+
+=item C<comment> -- the comment for this tape, or undef if no comment was given
+
+=back
+
+The following methods are available on a tapelist object C<$tl>:
+
+=over
+
+=item C<lookup_tapelabel($lbl)> -- look up and return a reference to the TLE
+with the given label
+
+=item C<lookup_tapepos($pos)> -- look up and return a reference to the TLE in
+the given position
+
+=item C<lookup_tapedate($date)> -- look up and return a reference to the TLE
+with the given datestamp
+
+=item C<remove_tapelabel($lbl)> -- remove the tape with the given label
+
+=item C<add_tapelabel($date, $lbl, $comment)> -- add a tape with the given date,
+label, and comment to the end of the tapelist, marking it reusable.
+
+=item C<write($filename)> -- write the tapelist out to C<$filename>.
+
+=back
+
+=head1 INTERACTION WITH C CODE
+
+The C portions of Amanda treat the tapelist as a global variable, while this
+package treats it as an object (and can thus handle more than one tapelist
+simultaneously).  Every call to C<read_tapelist> fills this global variable
+with a copy of the tapelist, and likewise C<clear_tapelist> clears the global.
+However, any changes made from Perl are not reflected in the C copy, nor are
+changes made by C modules reflected in the Perl copy.
+
+=cut
+
+## package functions
+
+sub read_tapelist {
+    my ($filename) = @_;
+
+    # let C read the file
+    C_read_tapelist($filename);
+
+    # and then read it ourselves
+    open(my $fh, "<", $filename) or return undef;
+    my @tles;
+    while (my $line = <$fh>) {
+       my ($datestamp, $label, $reuse, $comment)
+           = $line =~ m/^([0-9]*)\s([^\s]*)\s(reuse|no-reuse)\s*(?:\#(.*))?$/mx;
+       next if !defined $datestamp; # silently filter out bogus lines
+       push @tles, {
+           'datestamp' => $datestamp,
+           'label' => $label,
+           'reuse' => ($reuse eq 'reuse'),
+           'comment' => $comment,
+       };
+    }
+    close($fh);
+
+    my $self = bless \@tles, "Amanda::Tapelist";
+    $self->update_positions();
+
+    return $self;
+}
+
+sub clear_tapelist {
+    # clear the C version
+    C_clear_tapelist();
+
+    # and produce an empty object
+    my $self = bless [], "Amanda::Tapelist";
+    $self->update_positions();
+
+    return $self;
+}
+
+## methods
+
+sub lookup_tapelabel {
+    my $self = shift;
+    my ($label) = @_;
+
+    for my $tle (@$self) {
+       return $tle if ($tle->{'label'} eq $label);
+    }
+
+    return undef;
+}
+
+sub lookup_tapepos {
+    my $self = shift;
+    my ($position) = @_;
+
+    $self->update_positions();
+    return $self->[$position-1];
+}
+
+sub lookup_tapedate {
+    my $self = shift;
+    my ($datestamp) = @_;
+
+    for my $tle (@$self) {
+       return $tle if ($tle->{'datestamp'} eq $datestamp);
+    }
+
+    return undef;
+}
+
+sub remove_tapelabel {
+    my $self = shift;
+    my ($label) = @_;
+
+    for (my $i = 0; $i < @$self; $i++) {
+       if ($self->[$i]->{'label'} eq $label) {
+           splice @$self, $i, 1;
+           $self->update_positions();
+           return;
+       }
+    }
+}
+
+sub add_tapelabel {
+    my $self = shift;
+    my ($datestamp, $label, $comment) = @_;
+
+    push @$self, { 
+       'datestamp' => $datestamp,
+       'label' => $label,
+       'reuse' => 1,
+       'comment' => $comment,
+    };
+    $self->update_positions();
+}
+
+sub write {
+    my $self = shift;
+    my ($filename) = @_;
+
+    open(my $fh, ">", $filename) or die("Could not open '$filename' for writing: $!");
+    for my $tle (@$self) {
+       my $datestamp = $tle->{'datestamp'};
+       my $label = $tle->{'label'};
+       my $reuse = $tle->{'reuse'} ? 'reuse' : 'no-reuse';
+       my $comment = (defined $tle->{'comment'})? (" #" . $tle->{'comment'}) : '';
+       print $fh "$datestamp $label $reuse$comment\n";
+    }
+    close($fh);
+
+    # re-read from the C side to synchronize
+    C_read_tapelist($filename);
+}
+
+## TODO -- implement this when it's needed
+# =item C<lookup_last_reusable_tape($skip)> -- find the (C<$skip>+1)-th least recent
+# reusable tape.  For example, C<last_reusable_tape(1)> would return the
+# second-oldest reusable tape.
+
+## private methods
+
+# update the 'position' key for each TLE
+sub update_positions {
+    my $self = shift;
+    for (my $i = 0; $i < @$self; $i++) {
+       $self->[$i]->{'position'} = $i+1;
+    }
+}
+
+1;
diff --git a/perl/Amanda/Tapelist.swg b/perl/Amanda/Tapelist.swg
new file mode 100644 (file)
index 0000000..946a5f9
--- /dev/null
@@ -0,0 +1,247 @@
+/*
+ * Copyright (c) Zmanda, Inc.  All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ *
+ * This 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 this library; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+ *
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+ */
+
+%module "Amanda::Tapelist"
+%include "amglue/amglue.swg"
+%include "exception.i"
+
+%{
+#include "tapefile.h"
+%}
+
+%perlcode %{
+use Amanda::Debug qw(:logging);
+
+=head1 NAME
+
+Amanda::Tapelist - manipulate the Amanda tapelist
+
+=head1 SYNOPSIS
+
+    use Amanda::Tapelist;
+
+    my $tl = Amanda::Tapelist::read_tapelist("/path/to/tapefile");
+    $tl->add_tapelabel($datestamp, $label);
+    $tl->add_tapelabel($datestamp2, $label2, $comment);
+    $tl->write("/path/to/tapefile");
+
+=head1 API STATUS
+
+Stable
+
+=head1 OBJECT-ORIENTED INTERFACE
+
+The package-level functions C<read_tapelist($filename)> and C<clear_tapelist()>
+both return a new tapelist object.  C<read_tapelist> returns C<undef> if the
+tapelist does not exist.  Invalid entries are silently ignored.
+
+A tapelist object is a sequence of tapelist
+elements (referred to as TLEs in this document).  Each TLE is a hash with the
+following keys:
+
+=over
+
+=item C<position> -- the one-based position of the TLE in the tapelist
+
+=item C<datestamp> -- the datestamp on which this was written, or "0" for an
+unused tape
+
+=item C<reuse> -- true if this tape can be reused when it is no longer active
+
+=item C<label> -- tape label
+
+=item C<comment> -- the comment for this tape, or undef if no comment was given
+
+=back
+
+The following methods are available on a tapelist object C<$tl>:
+
+=over
+
+=item C<lookup_tapelabel($lbl)> -- look up and return a reference to the TLE
+with the given label
+
+=item C<lookup_tapepos($pos)> -- look up and return a reference to the TLE in
+the given position
+
+=item C<lookup_tapedate($date)> -- look up and return a reference to the TLE
+with the given datestamp
+
+=item C<remove_tapelabel($lbl)> -- remove the tape with the given label
+
+=item C<add_tapelabel($date, $lbl, $comment)> -- add a tape with the given date,
+label, and comment to the end of the tapelist, marking it reusable.
+
+=item C<write($filename)> -- write the tapelist out to C<$filename>.
+
+=back
+
+=head1 INTERACTION WITH C CODE
+
+The C portions of Amanda treat the tapelist as a global variable, while this
+package treats it as an object (and can thus handle more than one tapelist
+simultaneously).  Every call to C<read_tapelist> fills this global variable
+with a copy of the tapelist, and likewise C<clear_tapelist> clears the global.
+However, any changes made from Perl are not reflected in the C copy, nor are
+changes made by C modules reflected in the Perl copy.
+
+=cut
+
+## package functions
+
+sub read_tapelist {
+    my ($filename) = @_;
+
+    # let C read the file
+    C_read_tapelist($filename);
+
+    # and then read it ourselves
+    open(my $fh, "<", $filename) or return undef;
+    my @tles;
+    while (my $line = <$fh>) {
+       my ($datestamp, $label, $reuse, $comment)
+           = $line =~ m/^([0-9]*)\s([^\s]*)\s(reuse|no-reuse)\s*(?:\#(.*))?$/mx;
+       next if !defined $datestamp; # silently filter out bogus lines
+       push @tles, {
+           'datestamp' => $datestamp,
+           'label' => $label,
+           'reuse' => ($reuse eq 'reuse'),
+           'comment' => $comment,
+       };
+    }
+    close($fh);
+
+    my $self = bless \@tles, "Amanda::Tapelist";
+    $self->update_positions();
+
+    return $self;
+}
+
+sub clear_tapelist {
+    # clear the C version
+    C_clear_tapelist();
+
+    # and produce an empty object
+    my $self = bless [], "Amanda::Tapelist";
+    $self->update_positions();
+
+    return $self;
+}
+
+## methods
+
+sub lookup_tapelabel {
+    my $self = shift;
+    my ($label) = @_;
+
+    for my $tle (@$self) {
+       return $tle if ($tle->{'label'} eq $label);
+    }
+
+    return undef;
+}
+
+sub lookup_tapepos {
+    my $self = shift;
+    my ($position) = @_;
+
+    $self->update_positions();
+    return $self->[$position-1];
+}
+
+sub lookup_tapedate {
+    my $self = shift;
+    my ($datestamp) = @_;
+
+    for my $tle (@$self) {
+       return $tle if ($tle->{'datestamp'} eq $datestamp);
+    }
+
+    return undef;
+}
+
+sub remove_tapelabel {
+    my $self = shift;
+    my ($label) = @_;
+
+    for (my $i = 0; $i < @$self; $i++) {
+       if ($self->[$i]->{'label'} eq $label) {
+           splice @$self, $i, 1;
+           $self->update_positions();
+           return;
+       }
+    }
+}
+
+sub add_tapelabel {
+    my $self = shift;
+    my ($datestamp, $label, $comment) = @_;
+
+    push @$self, { 
+       'datestamp' => $datestamp,
+       'label' => $label,
+       'reuse' => 1,
+       'comment' => $comment,
+    };
+    $self->update_positions();
+}
+
+sub write {
+    my $self = shift;
+    my ($filename) = @_;
+
+    open(my $fh, ">", $filename) or die("Could not open '$filename' for writing: $!");
+    for my $tle (@$self) {
+       my $datestamp = $tle->{'datestamp'};
+       my $label = $tle->{'label'};
+       my $reuse = $tle->{'reuse'} ? 'reuse' : 'no-reuse';
+       my $comment = (defined $tle->{'comment'})? (" #" . $tle->{'comment'}) : '';
+       print $fh "$datestamp $label $reuse$comment\n";
+    }
+    close($fh);
+
+    # re-read from the C side to synchronize
+    C_read_tapelist($filename);
+}
+
+## TODO -- implement this when it's needed
+# =item C<lookup_last_reusable_tape($skip)> -- find the (C<$skip>+1)-th least recent
+# reusable tape.  For example, C<last_reusable_tape(1)> would return the
+# second-oldest reusable tape.
+
+## private methods
+
+# update the 'position' key for each TLE
+sub update_positions {
+    my $self = shift;
+    for (my $i = 0; $i < @$self; $i++) {
+       $self->[$i]->{'position'} = $i+1;
+    }
+}
+
+%}
+
+/* C functions -- should be called *only* from within this module */
+
+%rename(C_read_tapelist) read_tapelist;
+int read_tapelist(char *tapefile);
+
+%rename(C_clear_tapelist) clear_tapelist;
+void clear_tapelist(void);
diff --git a/perl/Amanda/Tests.c b/perl/Amanda/Tests.c
new file mode 100644 (file)
index 0000000..22ef0e1
--- /dev/null
@@ -0,0 +1,2935 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ * 
+ * This file is not intended to be easily readable and contains a number of 
+ * coding conventions designed to improve portability and efficiency. Do not make
+ * changes to this file unless you know what you are doing--modify the SWIG 
+ * interface file instead. 
+ * ----------------------------------------------------------------------------- */
+
+#define SWIGPERL
+#define SWIG_CASTRANK_MODE
+/* -----------------------------------------------------------------------------
+ *  This section contains generic SWIG labels for method/variable
+ *  declarations/attributes, and other compiler dependent labels.
+ * ----------------------------------------------------------------------------- */
+
+/* template workaround for compilers that cannot correctly implement the C++ standard */
+#ifndef SWIGTEMPLATEDISAMBIGUATOR
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# elif defined(__HP_aCC)
+/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
+/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# else
+#  define SWIGTEMPLATEDISAMBIGUATOR
+# endif
+#endif
+
+/* inline attribute */
+#ifndef SWIGINLINE
+# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
+#   define SWIGINLINE inline
+# else
+#   define SWIGINLINE
+# endif
+#endif
+
+/* attribute recognised by some compilers to avoid 'unused' warnings */
+#ifndef SWIGUNUSED
+# if defined(__GNUC__)
+#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#     define SWIGUNUSED __attribute__ ((__unused__)) 
+#   else
+#     define SWIGUNUSED
+#   endif
+# elif defined(__ICC)
+#   define SWIGUNUSED __attribute__ ((__unused__)) 
+# else
+#   define SWIGUNUSED 
+# endif
+#endif
+
+#ifndef SWIGUNUSEDPARM
+# ifdef __cplusplus
+#   define SWIGUNUSEDPARM(p)
+# else
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
+# endif
+#endif
+
+/* internal SWIG method */
+#ifndef SWIGINTERN
+# define SWIGINTERN static SWIGUNUSED
+#endif
+
+/* internal inline SWIG method */
+#ifndef SWIGINTERNINLINE
+# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
+#endif
+
+/* exporting methods */
+#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#  ifndef GCC_HASCLASSVISIBILITY
+#    define GCC_HASCLASSVISIBILITY
+#  endif
+#endif
+
+#ifndef SWIGEXPORT
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   if defined(STATIC_LINKED)
+#     define SWIGEXPORT
+#   else
+#     define SWIGEXPORT __declspec(dllexport)
+#   endif
+# else
+#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
+#     define SWIGEXPORT __attribute__ ((visibility("default")))
+#   else
+#     define SWIGEXPORT
+#   endif
+# endif
+#endif
+
+/* calling conventions for Windows */
+#ifndef SWIGSTDCALL
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   define SWIGSTDCALL __stdcall
+# else
+#   define SWIGSTDCALL
+# endif 
+#endif
+
+/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
+#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
+# define _SCL_SECURE_NO_DEPRECATE
+#endif
+
+
+/* -----------------------------------------------------------------------------
+ * swigrun.swg
+ *
+ * This file contains generic CAPI SWIG runtime support for pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+/* This should only be incremented when either the layout of swig_type_info changes,
+   or for whatever reason, the runtime changes incompatibly */
+#define SWIG_RUNTIME_VERSION "4"
+
+/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
+#ifdef SWIG_TYPE_TABLE
+# define SWIG_QUOTE_STRING(x) #x
+# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
+# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
+#else
+# define SWIG_TYPE_TABLE_NAME
+#endif
+
+/*
+  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
+  creating a static or dynamic library from the swig runtime code.
+  In 99.9% of the cases, swig just needs to declare them as 'static'.
+  
+  But only do this if is strictly necessary, ie, if you have problems
+  with your compiler or so.
+*/
+
+#ifndef SWIGRUNTIME
+# define SWIGRUNTIME SWIGINTERN
+#endif
+
+#ifndef SWIGRUNTIMEINLINE
+# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
+#endif
+
+/*  Generic buffer size */
+#ifndef SWIG_BUFFER_SIZE
+# define SWIG_BUFFER_SIZE 1024
+#endif
+
+/* Flags for pointer conversions */
+#define SWIG_POINTER_DISOWN        0x1
+#define SWIG_CAST_NEW_MEMORY       0x2
+
+/* Flags for new pointer objects */
+#define SWIG_POINTER_OWN           0x1
+
+
+/* 
+   Flags/methods for returning states.
+   
+   The swig conversion methods, as ConvertPtr, return and integer 
+   that tells if the conversion was successful or not. And if not,
+   an error code can be returned (see swigerrors.swg for the codes).
+   
+   Use the following macros/flags to set or process the returning
+   states.
+   
+   In old swig versions, you usually write code as:
+
+     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
+       // success code
+     } else {
+       //fail code
+     }
+
+   Now you can be more explicit as:
+
+    int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+    } else {
+      // fail code
+    }
+
+   that seems to be the same, but now you can also do
+
+    Type *ptr;
+    int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+      if (SWIG_IsNewObj(res) {
+        ...
+       delete *ptr;
+      } else {
+        ...
+      }
+    } else {
+      // fail code
+    }
+    
+   I.e., now SWIG_ConvertPtr can return new objects and you can
+   identify the case and take care of the deallocation. Of course that
+   requires also to SWIG_ConvertPtr to return new result values, as
+
+      int SWIG_ConvertPtr(obj, ptr,...) {         
+        if (<obj is ok>) {                            
+          if (<need new object>) {                    
+            *ptr = <ptr to new allocated object>; 
+            return SWIG_NEWOBJ;                       
+          } else {                                    
+            *ptr = <ptr to old object>;               
+            return SWIG_OLDOBJ;                       
+          }                                   
+        } else {                                      
+          return SWIG_BADOBJ;                 
+        }                                             
+      }
+
+   Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
+   more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
+   swig errors code.
+
+   Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
+   allows to return the 'cast rank', for example, if you have this
+
+       int food(double)
+       int fooi(int);
+
+   and you call
+      food(1)   // cast rank '1'  (1 -> 1.0)
+      fooi(1)   // cast rank '0'
+
+   just use the SWIG_AddCast()/SWIG_CheckState()
+
+
+ */
+#define SWIG_OK                    (0) 
+#define SWIG_ERROR                 (-1)
+#define SWIG_IsOK(r)               (r >= 0)
+#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)  
+
+/* The CastRankLimit says how many bits are used for the cast rank */
+#define SWIG_CASTRANKLIMIT         (1 << 8)
+/* The NewMask denotes the object was created (using new/malloc) */
+#define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
+/* The TmpMask is for in/out typemaps that use temporal objects */
+#define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
+/* Simple returning values */
+#define SWIG_BADOBJ                (SWIG_ERROR)
+#define SWIG_OLDOBJ                (SWIG_OK)
+#define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
+#define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
+/* Check, add and del mask methods */
+#define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
+#define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
+#define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
+#define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
+#define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
+#define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
+
+
+/* Cast-Rank Mode */
+#if defined(SWIG_CASTRANK_MODE)
+#  ifndef SWIG_TypeRank
+#    define SWIG_TypeRank             unsigned long
+#  endif
+#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
+#    define SWIG_MAXCASTRANK          (2)
+#  endif
+#  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
+#  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
+SWIGINTERNINLINE int SWIG_AddCast(int r) { 
+  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
+}
+SWIGINTERNINLINE int SWIG_CheckState(int r) { 
+  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
+}
+#else /* no cast-rank mode */
+#  define SWIG_AddCast
+#  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
+#endif
+
+
+
+
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void *(*swig_converter_func)(void *, int *);
+typedef struct swig_type_info *(*swig_dycast_func)(void **);
+
+/* Structure to store information on one type */
+typedef struct swig_type_info {
+  const char             *name;                        /* mangled name of this type */
+  const char             *str;                 /* human readable name of this type */
+  swig_dycast_func        dcast;               /* dynamic cast function down a hierarchy */
+  struct swig_cast_info  *cast;                        /* linked list of types that can cast into this type */
+  void                   *clientdata;          /* language specific type data */
+  int                    owndata;              /* flag if the structure owns the clientdata */
+} swig_type_info;
+
+/* Structure to store a type and conversion function used for casting */
+typedef struct swig_cast_info {
+  swig_type_info         *type;                        /* pointer to type that is equivalent to this type */
+  swig_converter_func     converter;           /* function to cast the void pointers */
+  struct swig_cast_info  *next;                        /* pointer to next cast in linked list */
+  struct swig_cast_info  *prev;                        /* pointer to the previous cast */
+} swig_cast_info;
+
+/* Structure used to store module information
+ * Each module generates one structure like this, and the runtime collects
+ * all of these structures and stores them in a circularly linked list.*/
+typedef struct swig_module_info {
+  swig_type_info         **types;              /* Array of pointers to swig_type_info structures that are in this module */
+  size_t                 size;                 /* Number of types in this module */
+  struct swig_module_info *next;               /* Pointer to next element in circularly linked list */
+  swig_type_info         **type_initial;       /* Array of initially generated type structures */
+  swig_cast_info         **cast_initial;       /* Array of initially generated casting structures */
+  void                    *clientdata;         /* Language specific module data */
+} swig_module_info;
+
+/* 
+  Compare two type names skipping the space characters, therefore
+  "char*" == "char *" and "Class<int>" == "Class<int >", etc.
+
+  Return 0 when the two name types are equivalent, as in
+  strncmp, but skipping ' '.
+*/
+SWIGRUNTIME int
+SWIG_TypeNameComp(const char *f1, const char *l1,
+                 const char *f2, const char *l2) {
+  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
+    while ((*f1 == ' ') && (f1 != l1)) ++f1;
+    while ((*f2 == ' ') && (f2 != l2)) ++f2;
+    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
+  }
+  return (int)((l1 - f1) - (l2 - f2));
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if not equal, 1 if equal
+*/
+SWIGRUNTIME int
+SWIG_TypeEquiv(const char *nb, const char *tb) {
+  int equiv = 0;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (!equiv && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
+*/
+SWIGRUNTIME int
+SWIG_TypeCompare(const char *nb, const char *tb) {
+  int equiv = 0;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (!equiv && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
+
+
+/* think of this as a c++ template<> or a scheme macro */
+#define SWIG_TypeCheck_Template(comparison, ty)         \
+  if (ty) {                                             \
+    swig_cast_info *iter = ty->cast;                    \
+    while (iter) {                                      \
+      if (comparison) {                                 \
+        if (iter == ty->cast) return iter;              \
+        /* Move iter to the top of the linked list */   \
+        iter->prev->next = iter->next;                  \
+        if (iter->next)                                 \
+          iter->next->prev = iter->prev;                \
+        iter->next = ty->cast;                          \
+        iter->prev = 0;                                 \
+        if (ty->cast) ty->cast->prev = iter;            \
+        ty->cast = iter;                                \
+        return iter;                                    \
+      }                                                 \
+      iter = iter->next;                                \
+    }                                                   \
+  }                                                     \
+  return 0
+
+/*
+  Check the typename
+*/
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheck(const char *c, swig_type_info *ty) {
+  SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
+}
+
+/* Same as previous function, except strcmp is replaced with a pointer comparison */
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
+  SWIG_TypeCheck_Template(iter->type == from, into);
+}
+
+/*
+  Cast a pointer up an inheritance hierarchy
+*/
+SWIGRUNTIMEINLINE void *
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
+}
+
+/* 
+   Dynamic pointer casting. Down an inheritance hierarchy
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
+  swig_type_info *lastty = ty;
+  if (!ty || !ty->dcast) return ty;
+  while (ty && (ty->dcast)) {
+    ty = (*ty->dcast)(ptr);
+    if (ty) lastty = ty;
+  }
+  return lastty;
+}
+
+/*
+  Return the name associated with this type
+*/
+SWIGRUNTIMEINLINE const char *
+SWIG_TypeName(const swig_type_info *ty) {
+  return ty->name;
+}
+
+/*
+  Return the pretty name associated with this type,
+  that is an unmangled type name in a form presentable to the user.
+*/
+SWIGRUNTIME const char *
+SWIG_TypePrettyName(const swig_type_info *type) {
+  /* The "str" field contains the equivalent pretty names of the
+     type, separated by vertical-bar characters.  We choose
+     to print the last name, as it is often (?) the most
+     specific. */
+  if (!type) return NULL;
+  if (type->str != NULL) {
+    const char *last_name = type->str;
+    const char *s;
+    for (s = type->str; *s; s++)
+      if (*s == '|') last_name = s+1;
+    return last_name;
+  }
+  else
+    return type->name;
+}
+
+/* 
+   Set the clientdata field for a type
+*/
+SWIGRUNTIME void
+SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
+  swig_cast_info *cast = ti->cast;
+  /* if (ti->clientdata == clientdata) return; */
+  ti->clientdata = clientdata;
+  
+  while (cast) {
+    if (!cast->converter) {
+      swig_type_info *tc = cast->type;
+      if (!tc->clientdata) {
+       SWIG_TypeClientData(tc, clientdata);
+      }
+    }    
+    cast = cast->next;
+  }
+}
+SWIGRUNTIME void
+SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
+  SWIG_TypeClientData(ti, clientdata);
+  ti->owndata = 1;
+}
+  
+/*
+  Search for a swig_type_info structure only by mangled name
+  Search is a O(log #types)
+  
+  We start searching at module start, and finish searching when start == end.  
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_MangledTypeQueryModule(swig_module_info *start, 
+                            swig_module_info *end, 
+                           const char *name) {
+  swig_module_info *iter = start;
+  do {
+    if (iter->size) {
+      register size_t l = 0;
+      register size_t r = iter->size - 1;
+      do {
+       /* since l+r >= 0, we can (>> 1) instead (/ 2) */
+       register size_t i = (l + r) >> 1; 
+       const char *iname = iter->types[i]->name;
+       if (iname) {
+         register int compare = strcmp(name, iname);
+         if (compare == 0) {       
+           return iter->types[i];
+         } else if (compare < 0) {
+           if (i) {
+             r = i - 1;
+           } else {
+             break;
+           }
+         } else if (compare > 0) {
+           l = i + 1;
+         }
+       } else {
+         break; /* should never happen */
+       }
+      } while (l <= r);
+    }
+    iter = iter->next;
+  } while (iter != end);
+  return 0;
+}
+
+/*
+  Search for a swig_type_info structure for either a mangled name or a human readable name.
+  It first searches the mangled names of the types, which is a O(log #types)
+  If a type is not found it then searches the human readable names, which is O(#types).
+  
+  We start searching at module start, and finish searching when start == end.  
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeQueryModule(swig_module_info *start, 
+                     swig_module_info *end, 
+                    const char *name) {
+  /* STEP 1: Search the name field using binary search */
+  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
+  if (ret) {
+    return ret;
+  } else {
+    /* STEP 2: If the type hasn't been found, do a complete search
+       of the str field (the human readable name) */
+    swig_module_info *iter = start;
+    do {
+      register size_t i = 0;
+      for (; i < iter->size; ++i) {
+       if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
+         return iter->types[i];
+      }
+      iter = iter->next;
+    } while (iter != end);
+  }
+  
+  /* neither found a match */
+  return 0;
+}
+
+/* 
+   Pack binary data into a string
+*/
+SWIGRUNTIME char *
+SWIG_PackData(char *c, void *ptr, size_t sz) {
+  static const char hex[17] = "0123456789abcdef";
+  register const unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu =  u + sz;
+  for (; u != eu; ++u) {
+    register unsigned char uu = *u;
+    *(c++) = hex[(uu & 0xf0) >> 4];
+    *(c++) = hex[uu & 0xf];
+  }
+  return c;
+}
+
+/* 
+   Unpack binary data from a string
+*/
+SWIGRUNTIME const char *
+SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
+  register unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu = u + sz;
+  for (; u != eu; ++u) {
+    register char d = *(c++);
+    register unsigned char uu;
+    if ((d >= '0') && (d <= '9'))
+      uu = ((d - '0') << 4);
+    else if ((d >= 'a') && (d <= 'f'))
+      uu = ((d - ('a'-10)) << 4);
+    else 
+      return (char *) 0;
+    d = *(c++);
+    if ((d >= '0') && (d <= '9'))
+      uu |= (d - '0');
+    else if ((d >= 'a') && (d <= 'f'))
+      uu |= (d - ('a'-10));
+    else 
+      return (char *) 0;
+    *u = uu;
+  }
+  return c;
+}
+
+/* 
+   Pack 'void *' into a string buffer.
+*/
+SWIGRUNTIME char *
+SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
+  char *r = buff;
+  if ((2*sizeof(void *) + 2) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,&ptr,sizeof(void *));
+  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
+  strcpy(r,name);
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      *ptr = (void *) 0;
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sizeof(void *));
+}
+
+SWIGRUNTIME char *
+SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
+  char *r = buff;
+  size_t lname = (name ? strlen(name) : 0);
+  if ((2*sz + 2 + lname) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  if (lname) {
+    strncpy(r,name,lname+1);
+  } else {
+    *r = 0;
+  }
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      memset(ptr,0,sz);
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sz);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/*  Errors in SWIG */
+#define  SWIG_UnknownError        -1 
+#define  SWIG_IOError             -2 
+#define  SWIG_RuntimeError        -3 
+#define  SWIG_IndexError          -4 
+#define  SWIG_TypeError           -5 
+#define  SWIG_DivisionByZero      -6 
+#define  SWIG_OverflowError       -7 
+#define  SWIG_SyntaxError         -8 
+#define  SWIG_ValueError          -9 
+#define  SWIG_SystemError         -10
+#define  SWIG_AttributeError      -11
+#define  SWIG_MemoryError         -12 
+#define  SWIG_NullReferenceError   -13
+
+
+
+#ifdef __cplusplus
+/* Needed on some windows machines---since MS plays funny games with the header files under C++ */
+#include <math.h>
+#include <stdlib.h>
+extern "C" {
+#endif
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+/* Add in functionality missing in older versions of Perl. Much of this is based on Devel-PPPort on cpan. */
+
+/* Add PERL_REVISION, PERL_VERSION, PERL_SUBVERSION if missing */
+#ifndef PERL_REVISION
+#  if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION))
+#    define PERL_PATCHLEVEL_H_IMPLICIT
+#    include <patchlevel.h>
+#  endif
+#  if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL)))
+#    include <could_not_find_Perl_patchlevel.h>
+#  endif
+#  ifndef PERL_REVISION
+#    define PERL_REVISION       (5)
+#    define PERL_VERSION        PATCHLEVEL
+#    define PERL_SUBVERSION     SUBVERSION
+#  endif
+#endif
+
+#if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE)
+#define PerlIO_exportFILE(fh,fl) (FILE*)(fh)
+#endif
+
+#ifndef SvIOK_UV
+# define SvIOK_UV(sv)       (SvIOK(sv) && (SvUVX(sv) == SvIVX(sv)))
+#endif
+
+#ifndef SvUOK
+# define SvUOK(sv)           SvIOK_UV(sv)
+#endif
+
+#if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5)))
+#  define PL_sv_undef               sv_undef
+#  define PL_na                            na
+#  define PL_errgv                  errgv
+#  define PL_sv_no                  sv_no
+#  define PL_sv_yes                 sv_yes
+#  define PL_markstack_ptr          markstack_ptr
+#endif
+
+#ifndef IVSIZE
+#  ifdef LONGSIZE
+#    define IVSIZE LONGSIZE
+#  else
+#    define IVSIZE 4 /* A bold guess, but the best we can make. */
+#  endif
+#endif
+
+#ifndef INT2PTR
+#  if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)
+#    define PTRV                  UV
+#    define INT2PTR(any,d)        (any)(d)
+#  else
+#    if PTRSIZE == LONGSIZE
+#      define PTRV                unsigned long
+#    else
+#      define PTRV                unsigned
+#    endif
+#    define INT2PTR(any,d)        (any)(PTRV)(d)
+#  endif
+
+#  define NUM2PTR(any,d)  (any)(PTRV)(d)
+#  define PTR2IV(p)       INT2PTR(IV,p)
+#  define PTR2UV(p)       INT2PTR(UV,p)
+#  define PTR2NV(p)       NUM2PTR(NV,p)
+
+#  if PTRSIZE == LONGSIZE
+#    define PTR2ul(p)     (unsigned long)(p)
+#  else
+#    define PTR2ul(p)     INT2PTR(unsigned long,p)
+#  endif
+#endif /* !INT2PTR */
+
+#ifndef SvPV_nolen
+# define SvPV_nolen(x) SvPV(x,PL_na)
+#endif
+
+#ifndef get_sv
+#  define get_sv perl_get_sv
+#endif
+
+#ifndef ERRSV
+#  define ERRSV get_sv("@",FALSE)
+#endif
+
+#ifndef pTHX_
+#define pTHX_
+#endif   
+
+#include <string.h>
+#ifdef __cplusplus
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ * error manipulation
+ * ----------------------------------------------------------------------------- */
+
+SWIGINTERN const char*
+SWIG_Perl_ErrorType(int code) {
+  const char* type = 0;
+  switch(code) {
+  case SWIG_MemoryError:
+    type = "MemoryError";
+    break;
+  case SWIG_IOError:
+    type = "IOError";
+    break;
+  case SWIG_RuntimeError:
+    type = "RuntimeError";
+    break;
+  case SWIG_IndexError:
+    type = "IndexError";
+    break;
+  case SWIG_TypeError:
+    type = "TypeError";
+    break;
+  case SWIG_DivisionByZero:
+    type = "ZeroDivisionError";
+    break;
+  case SWIG_OverflowError:
+    type = "OverflowError";
+    break;
+  case SWIG_SyntaxError:
+    type = "SyntaxError";
+    break;
+  case SWIG_ValueError:
+    type = "ValueError";
+    break;
+  case SWIG_SystemError:
+    type = "SystemError";
+    break;
+  case SWIG_AttributeError:
+    type = "AttributeError";
+    break;
+  default:
+    type = "RuntimeError";
+  }
+  return type;
+}
+
+
+
+
+/* -----------------------------------------------------------------------------
+ * perlrun.swg
+ *
+ * This file contains the runtime support for Perl modules
+ * and includes code for managing global variables and pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef PERL_OBJECT
+#define SWIG_PERL_OBJECT_DECL CPerlObj *SWIGUNUSEDPARM(pPerl),
+#define SWIG_PERL_OBJECT_CALL pPerl,
+#else
+#define SWIG_PERL_OBJECT_DECL
+#define SWIG_PERL_OBJECT_CALL
+#endif
+
+/* Common SWIG API */
+
+/* for raw pointers */
+#define SWIG_ConvertPtr(obj, pp, type, flags)           SWIG_Perl_ConvertPtr(SWIG_PERL_OBJECT_CALL obj, pp, type, flags)
+#define SWIG_NewPointerObj(p, type, flags)              SWIG_Perl_NewPointerObj(SWIG_PERL_OBJECT_CALL p, type, flags)
+
+/* for raw packed data */
+#define SWIG_ConvertPacked(obj, p, s, type)             SWIG_Perl_ConvertPacked(SWIG_PERL_OBJECT_CALL obj, p, s, type)
+#define SWIG_NewPackedObj(p, s, type)                  SWIG_Perl_NewPackedObj(SWIG_PERL_OBJECT_CALL p, s, type)
+
+/* for class or struct pointers */
+#define SWIG_ConvertInstance(obj, pptr, type, flags)    SWIG_ConvertPtr(obj, pptr, type, flags)
+#define SWIG_NewInstanceObj(ptr, type, flags)           SWIG_NewPointerObj(ptr, type, flags)
+
+/* for C or C++ function pointers */
+#define SWIG_ConvertFunctionPtr(obj, pptr, type)        SWIG_ConvertPtr(obj, pptr, type, 0)
+#define SWIG_NewFunctionPtrObj(ptr, type)               SWIG_NewPointerObj(ptr, type, 0)
+
+/* for C++ member pointers, ie, member methods */
+#define SWIG_ConvertMember(obj, ptr, sz, ty)            SWIG_ConvertPacked(obj, ptr, sz, ty)
+#define SWIG_NewMemberObj(ptr, sz, type)                SWIG_NewPackedObj(ptr, sz, type)
+
+
+/* Runtime API */
+
+#define SWIG_GetModule(clientdata)                      SWIG_Perl_GetModule()
+#define SWIG_SetModule(clientdata, pointer)             SWIG_Perl_SetModule(pointer)
+
+
+/* Error manipulation */
+
+#define SWIG_ErrorType(code)                            SWIG_Perl_ErrorType(code)               
+#define SWIG_Error(code, msg)                          sv_setpvf(GvSV(PL_errgv),"%s %s\n", SWIG_ErrorType(code), msg)
+#define SWIG_fail                                      goto fail                                                   
+
+/* Perl-specific SWIG API */
+
+#define SWIG_MakePtr(sv, ptr, type, flags)              SWIG_Perl_MakePtr(SWIG_PERL_OBJECT_CALL sv, ptr, type, flags)
+#define SWIG_MakePackedObj(sv, p, s, type)             SWIG_Perl_MakePackedObj(SWIG_PERL_OBJECT_CALL sv, p, s, type)
+#define SWIG_SetError(str)                              SWIG_Error(SWIG_RuntimeError, str)
+
+
+#define SWIG_PERL_DECL_ARGS_1(arg1)                     (SWIG_PERL_OBJECT_DECL arg1)
+#define SWIG_PERL_CALL_ARGS_1(arg1)                     (SWIG_PERL_OBJECT_CALL arg1)
+#define SWIG_PERL_DECL_ARGS_2(arg1, arg2)               (SWIG_PERL_OBJECT_DECL arg1, arg2)
+#define SWIG_PERL_CALL_ARGS_2(arg1, arg2)               (SWIG_PERL_OBJECT_CALL arg1, arg2)
+
+/* -----------------------------------------------------------------------------
+ * pointers/data manipulation
+ * ----------------------------------------------------------------------------- */
+
+/* For backward compatibility only */
+#define SWIG_POINTER_EXCEPTION  0
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SWIG_OWNER   SWIG_POINTER_OWN
+#define SWIG_SHADOW  SWIG_OWNER << 1
+
+#define SWIG_MAYBE_PERL_OBJECT SWIG_PERL_OBJECT_DECL
+
+/* SWIG Perl macros */
+
+/* Macro to declare an XS function */
+#ifndef XSPROTO
+#   define XSPROTO(name) void name(pTHX_ CV* cv)
+#endif
+
+/* Macro to call an XS function */
+#ifdef PERL_OBJECT 
+#  define SWIG_CALLXS(_name) _name(cv,pPerl) 
+#else 
+#  ifndef MULTIPLICITY 
+#    define SWIG_CALLXS(_name) _name(cv) 
+#  else 
+#    define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv) 
+#  endif 
+#endif 
+
+#ifdef PERL_OBJECT
+#define MAGIC_PPERL  CPerlObj *pPerl = (CPerlObj *) this;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
+#define SWIGCLASS_STATIC
+
+#else /* PERL_OBJECT */
+
+#define MAGIC_PPERL
+#define SWIGCLASS_STATIC static SWIGUNUSED
+
+#ifndef MULTIPLICITY
+#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (*SwigMagicFunc)(SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#else /* MULTIPLICITY */
+
+#define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MULTIPLICITY */
+#endif /* PERL_OBJECT */
+
+/* Workaround for bug in perl 5.6.x croak and earlier */
+#if (PERL_VERSION < 8)
+#  ifdef PERL_OBJECT
+#    define SWIG_croak_null() SWIG_Perl_croak_null(pPerl)
+static void SWIG_Perl_croak_null(CPerlObj *pPerl)
+#  else
+static void SWIG_croak_null()
+#  endif
+{
+  SV *err=ERRSV;
+#  if (PERL_VERSION < 6)
+  croak("%_", err);
+#  else
+  if (SvOK(err) && !SvROK(err)) croak("%_", err);
+  croak(Nullch);
+#  endif
+}
+#else
+#  define SWIG_croak_null() croak(Nullch)
+#endif
+
+
+/* 
+   Define how strict is the cast between strings and integers/doubles
+   when overloading between these types occurs.
+   
+   The default is making it as strict as possible by using SWIG_AddCast
+   when needed.
+   
+   You can use -DSWIG_PERL_NO_STRICT_STR2NUM at compilation time to
+   disable the SWIG_AddCast, making the casting between string and
+   numbers less strict.
+
+   In the end, we try to solve the overloading between strings and
+   numerical types in the more natural way, but if you can avoid it,
+   well, avoid it using %rename, for example.
+*/
+#ifndef SWIG_PERL_NO_STRICT_STR2NUM
+# ifndef SWIG_PERL_STRICT_STR2NUM
+#  define SWIG_PERL_STRICT_STR2NUM
+# endif
+#endif
+#ifdef SWIG_PERL_STRICT_STR2NUM
+/* string takes precedence */
+#define SWIG_Str2NumCast(x) SWIG_AddCast(x)  
+#else
+/* number takes precedence */
+#define SWIG_Str2NumCast(x) x
+#endif
+
+
+
+#include <stdlib.h>
+
+SWIGRUNTIME const char *
+SWIG_Perl_TypeProxyName(const swig_type_info *type) {
+  if (!type) return NULL;
+  if (type->clientdata != NULL) {
+    return (const char*) type->clientdata;
+  } 
+  else {
+    return type->name;
+  }
+}
+
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
+  SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp(iter->type->name, c) == 0)) 
+                           || (iter->type->clientdata && (strcmp((char*)iter->type->clientdata, c) == 0))), ty);
+}
+
+
+/* Function for getting a pointer value */
+
+SWIGRUNTIME int
+SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags) {
+  swig_cast_info *tc;
+  void *voidptr = (void *)0;
+  SV *tsv = 0;
+  /* If magical, apply more magic */
+  if (SvGMAGICAL(sv))
+    mg_get(sv);
+
+  /* Check to see if this is an object */
+  if (sv_isobject(sv)) {
+    IV tmp = 0;
+    tsv = (SV*) SvRV(sv);
+    if ((SvTYPE(tsv) == SVt_PVHV)) {
+      MAGIC *mg;
+      if (SvMAGICAL(tsv)) {
+        mg = mg_find(tsv,'P');
+        if (mg) {
+          sv = mg->mg_obj;
+          if (sv_isobject(sv)) {
+           tsv = (SV*)SvRV(sv);
+            tmp = SvIV(tsv);
+          }
+        }
+      } else {
+        return SWIG_ERROR;
+      }
+    } else {
+      tmp = SvIV(tsv);
+    }
+    voidptr = INT2PTR(void *,tmp);
+  } else if (! SvOK(sv)) {            /* Check for undef */
+    *(ptr) = (void *) 0;
+    return SWIG_OK;
+  } else if (SvTYPE(sv) == SVt_RV) {  /* Check for NULL pointer */
+    if (!SvROK(sv)) {
+      *(ptr) = (void *) 0;
+      return SWIG_OK;
+    } else {
+      return SWIG_ERROR;
+    }
+  } else {                            /* Don't know what it is */
+    return SWIG_ERROR;
+  }
+  if (_t) {
+    /* Now see if the types match */
+    char *_c = HvNAME(SvSTASH(SvRV(sv)));
+    tc = SWIG_TypeProxyCheck(_c,_t);
+    if (!tc) {
+      return SWIG_ERROR;
+    }
+    {
+      int newmemory = 0;
+      *ptr = SWIG_TypeCast(tc,voidptr,&newmemory);
+      assert(!newmemory); /* newmemory handling not yet implemented */
+    }
+  } else {
+    *ptr = voidptr;
+  }
+
+  /* 
+   *  DISOWN implementation: we need a perl guru to check this one.
+   */
+  if (tsv && (flags & SWIG_POINTER_DISOWN)) {
+    /* 
+     *  almost copy paste code from below SWIG_POINTER_OWN setting
+     */
+    SV *obj = sv;
+    HV *stash = SvSTASH(SvRV(obj));
+    GV *gv = *(GV**) hv_fetch(stash, "OWNER", 5, TRUE);
+    if (isGV(gv)) {
+      HV *hv = GvHVn(gv);
+      /*
+       * To set ownership (see below), a newSViv(1) entry is added. 
+       * Hence, to remove ownership, we delete the entry.
+       */
+      if (hv_exists_ent(hv, obj, 0)) {
+       hv_delete_ent(hv, obj, 0, 0);
+      }
+    }
+  }
+  return SWIG_OK;
+}
+
+SWIGRUNTIME void
+SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, swig_type_info *t, int flags) {
+  if (ptr && (flags & SWIG_SHADOW)) {
+    SV *self;
+    SV *obj=newSV(0);
+    HV *hash=newHV();
+    HV *stash;
+    sv_setref_pv(obj, (char *) SWIG_Perl_TypeProxyName(t), ptr);
+    stash=SvSTASH(SvRV(obj));
+    if (flags & SWIG_POINTER_OWN) {
+      HV *hv;
+      GV *gv=*(GV**)hv_fetch(stash, "OWNER", 5, TRUE);
+      if (!isGV(gv))
+        gv_init(gv, stash, "OWNER", 5, FALSE);
+      hv=GvHVn(gv);
+      hv_store_ent(hv, obj, newSViv(1), 0);
+    }
+    sv_magic((SV *)hash, (SV *)obj, 'P', Nullch, 0);
+    SvREFCNT_dec(obj);
+    self=newRV_noinc((SV *)hash);
+    sv_setsv(sv, self);
+    SvREFCNT_dec((SV *)self);
+    sv_bless(sv, stash);
+  }
+  else {
+    sv_setref_pv(sv, (char *) SWIG_Perl_TypeProxyName(t), ptr);
+  }
+}
+
+SWIGRUNTIMEINLINE SV *
+SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info *t, int flags) {
+  SV *result = sv_newmortal();
+  SWIG_MakePtr(result, ptr, t, flags);
+  return result;
+}
+
+SWIGRUNTIME void
+SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, int sz, swig_type_info *type) {
+  char result[1024];
+  char *r = result;
+  if ((2*sz + 1 + strlen(SWIG_Perl_TypeProxyName(type))) > 1000) return;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  strcpy(r,SWIG_Perl_TypeProxyName(type));
+  sv_setpv(sv, result);
+}
+
+SWIGRUNTIME SV *
+SWIG_Perl_NewPackedObj(SWIG_MAYBE_PERL_OBJECT void *ptr, int sz, swig_type_info *type) {
+  SV *result = sv_newmortal();
+  SWIG_Perl_MakePackedObj(result, ptr, sz, type);
+  return result;
+}
+
+/* Convert a packed value value */
+SWIGRUNTIME int
+SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty) {
+  swig_cast_info *tc;
+  const char  *c = 0;
+
+  if ((!obj) || (!SvOK(obj))) return SWIG_ERROR;
+  c = SvPV_nolen(obj);
+  /* Pointer values must start with leading underscore */
+  if (*c != '_') return SWIG_ERROR;
+  c++;
+  c = SWIG_UnpackData(c,ptr,sz);
+  if (ty) {
+    tc = SWIG_TypeCheck(c,ty);
+    if (!tc) return SWIG_ERROR;
+  }
+  return SWIG_OK;
+}
+
+
+/* Macros for low-level exception handling */
+#define SWIG_croak(x)    { SWIG_Error(SWIG_RuntimeError, x); SWIG_fail; }
+
+
+typedef XSPROTO(SwigPerlWrapper);
+typedef SwigPerlWrapper *SwigPerlWrapperPtr;
+
+/* Structure for command table */
+typedef struct {
+  const char         *name;
+  SwigPerlWrapperPtr  wrapper;
+} swig_command_info;
+
+/* Information for constant table */
+
+#define SWIG_INT     1
+#define SWIG_FLOAT   2
+#define SWIG_STRING  3
+#define SWIG_POINTER 4
+#define SWIG_BINARY  5
+
+/* Constant information structure */
+typedef struct swig_constant_info {
+    int              type;
+    const char      *name;
+    long             lvalue;
+    double           dvalue;
+    void            *pvalue;
+    swig_type_info **ptype;
+} swig_constant_info;
+
+
+/* Structure for variable table */
+typedef struct {
+  const char   *name;
+  SwigMagicFunc   set;
+  SwigMagicFunc   get;
+  swig_type_info  **type;
+} swig_variable_info;
+
+/* Magic variable code */
+#ifndef PERL_OBJECT
+#define swig_create_magic(s,a,b,c) _swig_create_magic(s,a,b,c)
+  #ifndef MULTIPLICITY
+     SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) 
+  #else
+     SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) 
+  #endif
+#else
+#  define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c)
+SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) 
+#endif
+{
+  MAGIC *mg;
+  sv_magic(sv,sv,'U',(char *) name,strlen(name));
+  mg = mg_find(sv,'U');
+  mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
+  mg->mg_virtual->svt_get = (SwigMagicFunc) get;
+  mg->mg_virtual->svt_set = (SwigMagicFunc) set;
+  mg->mg_virtual->svt_len = 0;
+  mg->mg_virtual->svt_clear = 0;
+  mg->mg_virtual->svt_free = 0;
+}
+
+
+SWIGRUNTIME swig_module_info *
+SWIG_Perl_GetModule(void) {
+  static void *type_pointer = (void *)0;
+  SV *pointer;
+
+  /* first check if pointer already created */
+  if (!type_pointer) {
+    pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI);
+    if (pointer && SvOK(pointer)) {
+      type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
+    }
+  }
+
+  return (swig_module_info *) type_pointer;
+}
+
+SWIGRUNTIME void
+SWIG_Perl_SetModule(swig_module_info *module) {
+  SV *pointer;
+
+  /* create a new pointer */
+  pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI);
+  sv_setiv(pointer, PTR2IV(module));
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/* Workaround perl5 global namespace pollution. Note that undefining library
+ * functions like fopen will not solve the problem on all platforms as fopen
+ * might be a macro on Windows but not necessarily on other operating systems. */
+#ifdef do_open
+  #undef do_open
+#endif
+#ifdef do_close
+  #undef do_close
+#endif
+#ifdef scalar
+  #undef scalar
+#endif
+#ifdef list
+  #undef list
+#endif
+#ifdef apply
+  #undef apply
+#endif
+#ifdef convert
+  #undef convert
+#endif
+#ifdef Error
+  #undef Error
+#endif
+#ifdef form
+  #undef form
+#endif
+#ifdef vform
+  #undef vform
+#endif
+#ifdef LABEL
+  #undef LABEL
+#endif
+#ifdef METHOD
+  #undef METHOD
+#endif
+#ifdef Move
+  #undef Move
+#endif
+#ifdef yylex
+  #undef yylex
+#endif
+#ifdef yyparse
+  #undef yyparse
+#endif
+#ifdef yyerror
+  #undef yyerror
+#endif
+#ifdef invert
+  #undef invert
+#endif
+#ifdef ref
+  #undef ref
+#endif
+#ifdef read
+  #undef read
+#endif
+#ifdef write
+  #undef write
+#endif
+#ifdef eof
+  #undef eof
+#endif
+#ifdef bool
+  #undef bool
+#endif
+#ifdef close
+  #undef close
+#endif
+#ifdef rewind
+  #undef rewind
+#endif
+#ifdef free
+  #undef free
+#endif
+#ifdef malloc
+  #undef malloc
+#endif
+#ifdef calloc
+  #undef calloc
+#endif
+#ifdef Stat
+  #undef Stat
+#endif
+#ifdef check
+  #undef check
+#endif
+#ifdef seekdir
+  #undef seekdir
+#endif
+#ifdef open
+  #undef open
+#endif
+
+
+
+#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
+
+#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else 
+
+
+
+  #define SWIG_exception(code, msg) do { SWIG_Error(code, msg); SWIG_fail;; } while(0) 
+
+
+/* -------- TYPES TABLE (BEGIN) -------- */
+
+#define SWIGTYPE_p_a_STRMAX__char swig_types[0]
+#define SWIGTYPE_p_char swig_types[1]
+#define SWIGTYPE_p_double swig_types[2]
+#define SWIGTYPE_p_float swig_types[3]
+#define SWIGTYPE_p_gint16 swig_types[4]
+#define SWIGTYPE_p_gint32 swig_types[5]
+#define SWIGTYPE_p_gint64 swig_types[6]
+#define SWIGTYPE_p_gint8 swig_types[7]
+#define SWIGTYPE_p_guint16 swig_types[8]
+#define SWIGTYPE_p_guint32 swig_types[9]
+#define SWIGTYPE_p_guint64 swig_types[10]
+#define SWIGTYPE_p_guint8 swig_types[11]
+#define SWIGTYPE_p_int swig_types[12]
+#define SWIGTYPE_p_unsigned_char swig_types[13]
+static swig_type_info *swig_types[15];
+static swig_module_info swig_module = {swig_types, 14, 0, 0, 0, 0};
+#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
+#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
+
+/* -------- TYPES TABLE (END) -------- */
+
+#define SWIG_init    boot_Amanda__Tests
+
+#define SWIG_name   "Amanda::Testsc::boot_Amanda__Tests"
+#define SWIG_prefix "Amanda::Testsc::"
+
+#define SWIGVERSION 0x010335 
+#define SWIG_VERSION SWIGVERSION
+
+
+#define SWIG_as_voidptr(a) (void *)((const void *)(a)) 
+#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) 
+
+
+#ifdef __cplusplus
+extern "C"
+#endif
+#ifndef PERL_OBJECT
+#ifndef MULTIPLICITY
+SWIGEXPORT void SWIG_init (CV* cv);
+#else
+SWIGEXPORT void SWIG_init (pTHXo_ CV* cv);
+#endif
+#else
+SWIGEXPORT void SWIG_init (CV *cv, CPerlObj *);
+#endif
+
+
+#include "amglue.h"
+
+
+#include "amglue.h"
+
+
+#include "amglue.h"
+
+
+#include "simpleprng.h"
+
+
+
+/*
+ * exercise bigint.c / integer.swg
+ */
+
+char *take_guint64(guint64 input) {
+    if (input == G_MAXUINT64) return "MAX";
+    if (input == 0) return "ZERO";
+    return "OTHER";
+}
+
+char *take_gint64(gint64 input) {
+    if (input == G_MAXINT64) return "MAX";
+    if (input == G_MININT64) return "MIN";
+    if (input == 0) return "ZERO";
+    return "OTHER";
+}
+
+char *take_guint32(guint32 input) {
+    if (input == G_MAXUINT32) return "MAX";
+    if (input == 0) return "ZERO";
+    return "OTHER";
+}
+
+char *take_gint32(gint32 input) {
+    if (input == G_MAXINT32) return "MAX";
+    if (input == G_MININT32) return "MIN";
+    if (input == 0) return "ZERO";
+    return "OTHER";
+}
+
+char *take_guint16(guint16 input) {
+    if (input == G_MAXUINT16) return "MAX";
+    if (input == 0) return "ZERO";
+    return "OTHER";
+}
+
+char *take_gint16(gint16 input) {
+    if (input == G_MAXINT16) return "MAX";
+    if (input == G_MININT16) return "MIN";
+    if (input == 0) return "ZERO";
+    return "OTHER";
+}
+
+char *take_guint8(guint8 input) {
+    if (input == G_MAXUINT8) return "MAX";
+    if (input == 0) return "ZERO";
+    return "OTHER";
+}
+
+char *take_gint8(gint8 input) {
+    if (input == G_MAXINT8) return "MAX";
+    if (input == G_MININT8) return "MIN";
+    if (input == 0) return "ZERO";
+    return "OTHER";
+}
+
+
+guint64 give_guint64(char *input) {
+    if (input[0] == '+') return G_MAXUINT64;
+    return 0;
+}
+
+gint64 give_gint64(char *input) {
+    if (input[0] == '-') return G_MININT64;
+    if (input[0] == '+') return G_MAXINT64;
+    return 0;
+}
+
+guint32 give_guint32(char *input) {
+    if (input[0] == '+') return G_MAXUINT32;
+    return 0;
+}
+
+gint32 give_gint32(char *input) {
+    if (input[0] == '-') return G_MININT32;
+    if (input[0] == '+') return G_MAXINT32;
+    return 0;
+}
+
+guint16 give_guint16(char *input) {
+    if (input[0] == '+') return G_MAXUINT16;
+    return 0;
+}
+
+gint16 give_gint16(char *input) {
+    if (input[0] == '-') return G_MININT16;
+    if (input[0] == '+') return G_MAXINT16;
+    return 0;
+}
+
+guint8 give_guint8(char *input) {
+    if (input[0] == '+') return G_MAXUINT8;
+    return 0;
+}
+
+gint8 give_gint8(char *input) {
+    if (input[0] == '-') return G_MININT8;
+    if (input[0] == '+') return G_MAXINT8;
+    return 0;
+}
+
+
+SWIGINTERNINLINE SV *
+SWIG_FromCharPtrAndSize(const char* carray, size_t size)
+{
+  SV *obj = sv_newmortal();
+  if (carray) {
+    sv_setpvn(obj, carray, size);
+  } else {
+    sv_setsv(obj, &PL_sv_undef);
+  }
+  return obj;
+}
+
+
+SWIGINTERNINLINE SV * 
+SWIG_FromCharPtr(const char *cptr)
+{ 
+  return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
+}
+
+
+SWIGINTERN swig_type_info*
+SWIG_pchar_descriptor(void)
+{
+  static int init = 0;
+  static swig_type_info* info = 0;
+  if (!init) {
+    info = SWIG_TypeQuery("_p_char");
+    init = 1;
+  }
+  return info;
+}
+
+
+SWIGINTERN int
+SWIG_AsCharPtrAndSize(SV *obj, char** cptr, size_t* psize, int *alloc)
+{
+  if (SvPOK(obj)) {
+    STRLEN len = 0;
+    char *cstr = SvPV(obj, len); 
+    size_t size = len + 1;
+    if (cptr)  {
+      if (alloc) {
+       if (*alloc == SWIG_NEWOBJ) {
+         *cptr = (char *)memcpy((char *)malloc((size)*sizeof(char)), cstr, sizeof(char)*(size));
+       } else {
+         *cptr = cstr;
+         *alloc = SWIG_OLDOBJ;
+       }
+      }
+    }
+    if (psize) *psize = size;
+    return SWIG_OK;
+  } else {
+    swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
+    if (pchar_descriptor) {
+      char* vptr = 0; 
+      if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_descriptor, 0) == SWIG_OK) {
+       if (cptr) *cptr = vptr;
+       if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0;
+       if (alloc) *alloc = SWIG_OLDOBJ;
+       return SWIG_OK;
+      }
+    }
+  }
+  return SWIG_TypeError;
+}
+
+
+
+
+
+
+int sizeof_size_t(void) {
+    return sizeof(size_t);
+}
+
+
+
+
+/* write LENGTH bytes of random data to FILENAME, seeded with SEED */
+void
+write_random_file(guint32 seed, size_t length, char *filename) {
+    simpleprng_state_t prng;
+    int fd;
+    char buf[10240];
+
+    simpleprng_seed(&prng, seed);
+
+    fd = open(filename, O_CREAT|O_WRONLY|O_TRUNC, 0666);
+    if (fd < 0)
+       g_critical(_("Could not open test file '%s': %s"), filename, strerror(errno));
+
+    while (length) {
+       size_t to_write = min(sizeof(buf), length);
+       size_t written;
+
+       simpleprng_fill_buffer(&prng, buf, to_write);
+
+       written = full_write(fd, buf, to_write);
+       if (written < to_write)
+           g_critical(_("Error writing test file: %s"), strerror(errno));
+
+       length -= written;
+    }
+
+    close(fd);
+}
+
+/* read LENGTH bytes of random data from FILENAME verifying it against
+ * a PRNG seeded with SEED.  Sends any error messages to stderr.
+ *
+ * If check_eof is true, then check that the file is exactly LENGTH bytes long;
+ * otherwise, trailing bytes (such as zero padding from a Device) are ignored.
+ */
+gboolean
+verify_random_file(guint32 seed, size_t length, char *filename, gboolean check_eof) {
+    simpleprng_state_t prng;
+    int fd;
+    char buf[10240];
+
+    simpleprng_seed(&prng, seed);
+
+    fd = open(filename, O_RDONLY, 0666);
+    if (fd < 0)
+       g_critical(_("Could not open test file '%s': %s"), filename, strerror(errno));
+
+    while (length) {
+       size_t to_read = min(sizeof(buf), length);
+       size_t bytes_read;
+
+       bytes_read = full_read(fd, buf, to_read);
+       if (bytes_read < to_read) {
+           if (errno) {
+               g_critical(_("Error reading test file: %s"), strerror(errno));
+           } else {
+               g_fprintf(stderr, _("Verify of '%s' failed: early EOF with %zd bytes left\n"),
+                       filename, length - bytes_read);
+               goto error;
+           }
+       }
+
+       if (!simpleprng_verify_buffer(&prng, buf, bytes_read))
+           goto error;
+
+       length -= bytes_read;
+    }
+
+    /* verify that the file contains no extra bytes */
+    if (check_eof) {
+       if (read(fd, buf, 1)) {
+           g_fprintf(stderr, _("Verify of '%s' failed: file is too long\n"), filename);
+           goto error;
+       }
+    }
+
+    close(fd);
+    return TRUE;
+
+error:
+    close(fd);
+    return FALSE;
+}
+
+
+
+SWIGINTERN int
+SWIG_AsVal_double SWIG_PERL_DECL_ARGS_2(SV *obj, double *val)
+{
+  if (SvNIOK(obj)) {
+    if (val) *val = SvNV(obj);
+    return SWIG_OK;
+  } else if (SvIOK(obj)) {
+    if (val) *val = (double) SvIV(obj);
+    return SWIG_AddCast(SWIG_OK);
+  } else {
+    const char *nptr = SvPV_nolen(obj);
+    if (nptr) {
+      char *endptr;
+      double v = strtod(nptr, &endptr);
+      if (errno == ERANGE) {
+       errno = 0;
+       return SWIG_OverflowError;
+      } else {
+       if (*endptr == '\0') {
+         if (val) *val = v;
+         return SWIG_Str2NumCast(SWIG_OK);
+       }
+      }
+    }
+  }
+  return SWIG_TypeError;
+}
+
+
+#include <float.h>
+
+
+#include <math.h>
+
+
+SWIGINTERNINLINE int
+SWIG_CanCastAsInteger(double *d, double min, double max) {
+  double x = *d;
+  if ((min <= x && x <= max)) {
+   double fx = floor(x);
+   double cx = ceil(x);
+   double rd =  ((x - fx) < 0.5) ? fx : cx; /* simple rint */
+   if ((errno == EDOM) || (errno == ERANGE)) {
+     errno = 0;
+   } else {
+     double summ, reps, diff;
+     if (rd < x) {
+       diff = x - rd;
+     } else if (rd > x) {
+       diff = rd - x;
+     } else {
+       return 1;
+     }
+     summ = rd + x;
+     reps = diff/summ;
+     if (reps < 8*DBL_EPSILON) {
+       *d = rd;
+       return 1;
+     }
+   }
+  }
+  return 0;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_unsigned_SS_long SWIG_PERL_DECL_ARGS_2(SV *obj, unsigned long *val) 
+{
+  if (SvUOK(obj)) {
+    if (val) *val = SvUV(obj);
+    return SWIG_OK;
+  } else  if (SvIOK(obj)) {
+    long v = SvIV(obj);
+    if (v >= 0) {
+      if (val) *val = v;
+      return SWIG_OK;
+    } else {
+      return SWIG_OverflowError;
+    }
+  } else {
+    int dispatch = 0;
+    const char *nptr = SvPV_nolen(obj);
+    if (nptr) {
+      char *endptr;
+      unsigned long v;
+      errno = 0;
+      v = strtoul(nptr, &endptr,0);
+      if (errno == ERANGE) {
+       errno = 0;
+       return SWIG_OverflowError;
+      } else {
+       if (*endptr == '\0') {
+         if (val) *val = v;
+         return SWIG_Str2NumCast(SWIG_OK);
+       }
+      }
+    }
+    if (!dispatch) {
+      double d;
+      int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj,&d));
+      if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) {
+       if (val) *val = (unsigned long)(d);
+       return res;
+      }
+    }
+  }
+  return SWIG_TypeError;
+}
+
+
+SWIGINTERNINLINE int
+SWIG_AsVal_size_t SWIG_PERL_DECL_ARGS_2(SV * obj, size_t *val)
+{
+  unsigned long v;
+  int res = SWIG_AsVal_unsigned_SS_long SWIG_PERL_CALL_ARGS_2(obj, val ? &v : 0);
+  if (SWIG_IsOK(res) && val) *val = (size_t)(v);
+  return res;
+}
+
+
+#include <limits.h>
+#if !defined(SWIG_NO_LLONG_MAX)
+# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
+#   define LLONG_MAX __LONG_LONG_MAX__
+#   define LLONG_MIN (-LLONG_MAX - 1LL)
+#   define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
+# endif
+#endif
+
+
+SWIGINTERN int
+SWIG_AsVal_long SWIG_PERL_DECL_ARGS_2(SV *obj, long* val)
+{
+  if (SvIOK(obj)) {
+    if (val) *val = SvIV(obj);
+    return SWIG_OK;
+  } else {
+    int dispatch = 0;
+    const char *nptr = SvPV_nolen(obj);
+    if (nptr) {
+      char *endptr;
+      long v;
+      errno = 0;
+      v = strtol(nptr, &endptr,0);
+      if (errno == ERANGE) {
+       errno = 0;
+       return SWIG_OverflowError;
+      } else {
+       if (*endptr == '\0') {
+         if (val) *val = v;
+         return SWIG_Str2NumCast(SWIG_OK);
+       }
+      }
+    }
+    if (!dispatch) {
+      double d;
+      int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj,&d));
+      if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
+       if (val) *val = (long)(d);
+       return res;
+      }
+    }
+  }
+  return SWIG_TypeError;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_int SWIG_PERL_DECL_ARGS_2(SV * obj, int *val)
+{
+  long v;
+  int res = SWIG_AsVal_long SWIG_PERL_CALL_ARGS_2(obj, &v);
+  if (SWIG_IsOK(res)) {
+    if ((v < INT_MIN || v > INT_MAX)) {
+      return SWIG_OverflowError;
+    } else {
+      if (val) *val = (int)(v);
+    }
+  }  
+  return res;
+}
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef PERL_OBJECT
+#define MAGIC_CLASS _wrap_Amanda::Tests_var::
+class _wrap_Amanda::Tests_var : public CPerlObj {
+public:
+#else
+#define MAGIC_CLASS
+#endif
+SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *SWIGUNUSEDPARM(sv), MAGIC *SWIGUNUSEDPARM(mg)) {
+    MAGIC_PPERL
+    croak("Value is read-only.");
+    return 0;
+}
+
+
+#ifdef PERL_OBJECT
+};
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+XS(_wrap_take_guint64) {
+  {
+    guint64 arg1 ;
+    char *result = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: take_guint64(input);");
+    }
+    {
+      arg1 = amglue_SvU64(ST(0));
+    }
+    result = (char *)take_guint64(arg1);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_take_gint64) {
+  {
+    gint64 arg1 ;
+    char *result = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: take_gint64(input);");
+    }
+    {
+      arg1 = amglue_SvI64(ST(0));
+    }
+    result = (char *)take_gint64(arg1);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_take_guint32) {
+  {
+    guint32 arg1 ;
+    char *result = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: take_guint32(input);");
+    }
+    {
+      arg1 = amglue_SvU32(ST(0));
+    }
+    result = (char *)take_guint32(arg1);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_take_gint32) {
+  {
+    gint32 arg1 ;
+    char *result = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: take_gint32(input);");
+    }
+    {
+      arg1 = amglue_SvI32(ST(0));
+    }
+    result = (char *)take_gint32(arg1);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_take_guint16) {
+  {
+    guint16 arg1 ;
+    char *result = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: take_guint16(input);");
+    }
+    {
+      arg1 = amglue_SvU16(ST(0));
+    }
+    result = (char *)take_guint16(arg1);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_take_gint16) {
+  {
+    gint16 arg1 ;
+    char *result = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: take_gint16(input);");
+    }
+    {
+      arg1 = amglue_SvI16(ST(0));
+    }
+    result = (char *)take_gint16(arg1);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_take_guint8) {
+  {
+    guint8 arg1 ;
+    char *result = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: take_guint8(input);");
+    }
+    {
+      arg1 = amglue_SvU8(ST(0));
+    }
+    result = (char *)take_guint8(arg1);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_take_gint8) {
+  {
+    gint8 arg1 ;
+    char *result = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: take_gint8(input);");
+    }
+    {
+      arg1 = amglue_SvI8(ST(0));
+    }
+    result = (char *)take_gint8(arg1);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_give_guint64) {
+  {
+    char *arg1 = (char *) 0 ;
+    guint64 result;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: give_guint64(input);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "give_guint64" "', argument " "1"" of type '" "char *""'");
+    }
+    arg1 = (char *)(buf1);
+    result = give_guint64(arg1);
+    {
+      ST(argvi) = sv_2mortal(amglue_newSVu64(result));
+      argvi++;
+    }
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_give_gint64) {
+  {
+    char *arg1 = (char *) 0 ;
+    gint64 result;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: give_gint64(input);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "give_gint64" "', argument " "1"" of type '" "char *""'");
+    }
+    arg1 = (char *)(buf1);
+    result = give_gint64(arg1);
+    {
+      ST(argvi) = sv_2mortal(amglue_newSVi64(result));
+      argvi++;
+    }
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_give_guint32) {
+  {
+    char *arg1 = (char *) 0 ;
+    guint32 result;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: give_guint32(input);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "give_guint32" "', argument " "1"" of type '" "char *""'");
+    }
+    arg1 = (char *)(buf1);
+    result = give_guint32(arg1);
+    {
+      ST(argvi) = sv_2mortal(amglue_newSVu64(result));
+      argvi++;
+    }
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_give_gint32) {
+  {
+    char *arg1 = (char *) 0 ;
+    gint32 result;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: give_gint32(input);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "give_gint32" "', argument " "1"" of type '" "char *""'");
+    }
+    arg1 = (char *)(buf1);
+    result = give_gint32(arg1);
+    {
+      ST(argvi) = sv_2mortal(amglue_newSVi64(result));
+      argvi++;
+    }
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_give_guint16) {
+  {
+    char *arg1 = (char *) 0 ;
+    guint16 result;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: give_guint16(input);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "give_guint16" "', argument " "1"" of type '" "char *""'");
+    }
+    arg1 = (char *)(buf1);
+    result = give_guint16(arg1);
+    {
+      ST(argvi) = sv_2mortal(amglue_newSVu64(result));
+      argvi++;
+    }
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_give_gint16) {
+  {
+    char *arg1 = (char *) 0 ;
+    gint16 result;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: give_gint16(input);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "give_gint16" "', argument " "1"" of type '" "char *""'");
+    }
+    arg1 = (char *)(buf1);
+    result = give_gint16(arg1);
+    {
+      ST(argvi) = sv_2mortal(amglue_newSVi64(result));
+      argvi++;
+    }
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_give_guint8) {
+  {
+    char *arg1 = (char *) 0 ;
+    guint8 result;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: give_guint8(input);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "give_guint8" "', argument " "1"" of type '" "char *""'");
+    }
+    arg1 = (char *)(buf1);
+    result = give_guint8(arg1);
+    {
+      ST(argvi) = sv_2mortal(amglue_newSVu64(result));
+      argvi++;
+    }
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_give_gint8) {
+  {
+    char *arg1 = (char *) 0 ;
+    gint8 result;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: give_gint8(input);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "give_gint8" "', argument " "1"" of type '" "char *""'");
+    }
+    arg1 = (char *)(buf1);
+    result = give_gint8(arg1);
+    {
+      ST(argvi) = sv_2mortal(amglue_newSVi64(result));
+      argvi++;
+    }
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_sizeof_size_t) {
+  {
+    int result;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: sizeof_size_t();");
+    }
+    result = (int)sizeof_size_t();
+    {
+      ST(argvi) = sv_2mortal(amglue_newSVi64(result));
+      argvi++;
+    }
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_write_random_file) {
+  {
+    guint32 arg1 ;
+    size_t arg2 ;
+    char *arg3 = (char *) 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: write_random_file(seed,length,filename);");
+    }
+    {
+      arg1 = amglue_SvU32(ST(0));
+    }
+    {
+      if (sizeof(size_t) == 1) {
+        arg2 = amglue_SvU8(ST(1));
+      } else if (sizeof(size_t) == 2) {
+        arg2 = amglue_SvU16(ST(1));
+      } else if (sizeof(size_t) == 4) {
+        arg2 = amglue_SvU32(ST(1));
+      } else if (sizeof(size_t) == 8) {
+        arg2 = amglue_SvU64(ST(1));
+      } else {
+        croak("Unexpected size_t >64 bits?"); /* should be optimized out unless sizeof(size_t) > 8 */
+      }
+    }
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "write_random_file" "', argument " "3"" of type '" "char *""'");
+    }
+    arg3 = (char *)(buf3);
+    write_random_file(arg1,arg2,arg3);
+    
+    
+    if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_verify_random_file) {
+  {
+    guint32 arg1 ;
+    size_t arg2 ;
+    char *arg3 = (char *) 0 ;
+    gboolean arg4 ;
+    gboolean result;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 4) || (items > 4)) {
+      SWIG_croak("Usage: verify_random_file(seed,length,filename,check_eof);");
+    }
+    {
+      arg1 = amglue_SvU32(ST(0));
+    }
+    {
+      if (sizeof(size_t) == 1) {
+        arg2 = amglue_SvU8(ST(1));
+      } else if (sizeof(size_t) == 2) {
+        arg2 = amglue_SvU16(ST(1));
+      } else if (sizeof(size_t) == 4) {
+        arg2 = amglue_SvU32(ST(1));
+      } else if (sizeof(size_t) == 8) {
+        arg2 = amglue_SvU64(ST(1));
+      } else {
+        croak("Unexpected size_t >64 bits?"); /* should be optimized out unless sizeof(size_t) > 8 */
+      }
+    }
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "verify_random_file" "', argument " "3"" of type '" "char *""'");
+    }
+    arg3 = (char *)(buf3);
+    {
+      if (sizeof(signed int) == 1) {
+        arg4 = amglue_SvI8(ST(3));
+      } else if (sizeof(signed int) == 2) {
+        arg4 = amglue_SvI16(ST(3));
+      } else if (sizeof(signed int) == 4) {
+        arg4 = amglue_SvI32(ST(3));
+      } else if (sizeof(signed int) == 8) {
+        arg4 = amglue_SvI64(ST(3));
+      } else {
+        g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
+      }
+    }
+    result = (gboolean)verify_random_file(arg1,arg2,arg3,arg4);
+    {
+      ST(argvi) = sv_2mortal(amglue_newSVi64(result));
+      argvi++;
+    }
+    
+    if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
+    
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
+    
+    SWIG_croak_null();
+  }
+}
+
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
+
+static swig_type_info _swigt__p_a_STRMAX__char = {"_p_a_STRMAX__char", "char (*)[STRMAX]|string_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_char = {"_p_char", "gchar *|char *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_double = {"_p_double", "double *|gdouble *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_float = {"_p_float", "float *|gfloat *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_gint16 = {"_p_gint16", "gint16 *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_gint32 = {"_p_gint32", "gint32 *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_gint64 = {"_p_gint64", "gint64 *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_gint8 = {"_p_gint8", "gint8 *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_guint16 = {"_p_guint16", "guint16 *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_guint32 = {"_p_guint32", "guint32 *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_guint64 = {"_p_guint64", "guint64 *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_guint8 = {"_p_guint8", "guint8 *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_int = {"_p_int", "int *|filetype_t *|gboolean *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "guchar *|unsigned char *", 0, 0, (void*)0, 0};
+
+static swig_type_info *swig_type_initial[] = {
+  &_swigt__p_a_STRMAX__char,
+  &_swigt__p_char,
+  &_swigt__p_double,
+  &_swigt__p_float,
+  &_swigt__p_gint16,
+  &_swigt__p_gint32,
+  &_swigt__p_gint64,
+  &_swigt__p_gint8,
+  &_swigt__p_guint16,
+  &_swigt__p_guint32,
+  &_swigt__p_guint64,
+  &_swigt__p_guint8,
+  &_swigt__p_int,
+  &_swigt__p_unsigned_char,
+};
+
+static swig_cast_info _swigc__p_a_STRMAX__char[] = {  {&_swigt__p_a_STRMAX__char, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_double[] = {  {&_swigt__p_double, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_float[] = {  {&_swigt__p_float, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_gint16[] = {  {&_swigt__p_gint16, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_gint32[] = {  {&_swigt__p_gint32, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_gint64[] = {  {&_swigt__p_gint64, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_gint8[] = {  {&_swigt__p_gint8, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_guint16[] = {  {&_swigt__p_guint16, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_guint32[] = {  {&_swigt__p_guint32, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_guint64[] = {  {&_swigt__p_guint64, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_guint8[] = {  {&_swigt__p_guint8, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_int[] = {  {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_unsigned_char[] = {  {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
+
+static swig_cast_info *swig_cast_initial[] = {
+  _swigc__p_a_STRMAX__char,
+  _swigc__p_char,
+  _swigc__p_double,
+  _swigc__p_float,
+  _swigc__p_gint16,
+  _swigc__p_gint32,
+  _swigc__p_gint64,
+  _swigc__p_gint8,
+  _swigc__p_guint16,
+  _swigc__p_guint32,
+  _swigc__p_guint64,
+  _swigc__p_guint8,
+  _swigc__p_int,
+  _swigc__p_unsigned_char,
+};
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
+
+static swig_constant_info swig_constants[] = {
+{0,0,0,0,0,0}
+};
+#ifdef __cplusplus
+}
+#endif
+static swig_variable_info swig_variables[] = {
+{0,0,0,0}
+};
+static swig_command_info swig_commands[] = {
+{"Amanda::Testsc::take_guint64", _wrap_take_guint64},
+{"Amanda::Testsc::take_gint64", _wrap_take_gint64},
+{"Amanda::Testsc::take_guint32", _wrap_take_guint32},
+{"Amanda::Testsc::take_gint32", _wrap_take_gint32},
+{"Amanda::Testsc::take_guint16", _wrap_take_guint16},
+{"Amanda::Testsc::take_gint16", _wrap_take_gint16},
+{"Amanda::Testsc::take_guint8", _wrap_take_guint8},
+{"Amanda::Testsc::take_gint8", _wrap_take_gint8},
+{"Amanda::Testsc::give_guint64", _wrap_give_guint64},
+{"Amanda::Testsc::give_gint64", _wrap_give_gint64},
+{"Amanda::Testsc::give_guint32", _wrap_give_guint32},
+{"Amanda::Testsc::give_gint32", _wrap_give_gint32},
+{"Amanda::Testsc::give_guint16", _wrap_give_guint16},
+{"Amanda::Testsc::give_gint16", _wrap_give_gint16},
+{"Amanda::Testsc::give_guint8", _wrap_give_guint8},
+{"Amanda::Testsc::give_gint8", _wrap_give_gint8},
+{"Amanda::Testsc::sizeof_size_t", _wrap_sizeof_size_t},
+{"Amanda::Testsc::write_random_file", _wrap_write_random_file},
+{"Amanda::Testsc::verify_random_file", _wrap_verify_random_file},
+{0,0}
+};
+/* -----------------------------------------------------------------------------
+ * Type initialization:
+ * This problem is tough by the requirement that no dynamic 
+ * memory is used. Also, since swig_type_info structures store pointers to 
+ * swig_cast_info structures and swig_cast_info structures store pointers back
+ * to swig_type_info structures, we need some lookup code at initialization. 
+ * The idea is that swig generates all the structures that are needed. 
+ * The runtime then collects these partially filled structures. 
+ * The SWIG_InitializeModule function takes these initial arrays out of 
+ * swig_module, and does all the lookup, filling in the swig_module.types
+ * array with the correct data and linking the correct swig_cast_info
+ * structures together.
+ *
+ * The generated swig_type_info structures are assigned staticly to an initial 
+ * array. We just loop through that array, and handle each type individually.
+ * First we lookup if this type has been already loaded, and if so, use the
+ * loaded structure instead of the generated one. Then we have to fill in the
+ * cast linked list. The cast data is initially stored in something like a
+ * two-dimensional array. Each row corresponds to a type (there are the same
+ * number of rows as there are in the swig_type_initial array). Each entry in
+ * a column is one of the swig_cast_info structures for that type.
+ * The cast_initial array is actually an array of arrays, because each row has
+ * a variable number of columns. So to actually build the cast linked list,
+ * we find the array of casts associated with the type, and loop through it 
+ * adding the casts to the list. The one last trick we need to do is making
+ * sure the type pointer in the swig_cast_info struct is correct.
+ *
+ * First off, we lookup the cast->type name to see if it is already loaded. 
+ * There are three cases to handle:
+ *  1) If the cast->type has already been loaded AND the type we are adding
+ *     casting info to has not been loaded (it is in this module), THEN we
+ *     replace the cast->type pointer with the type pointer that has already
+ *     been loaded.
+ *  2) If BOTH types (the one we are adding casting info to, and the 
+ *     cast->type) are loaded, THEN the cast info has already been loaded by
+ *     the previous module so we just ignore it.
+ *  3) Finally, if cast->type has not already been loaded, then we add that
+ *     swig_cast_info to the linked list (because the cast->type) pointer will
+ *     be correct.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#if 0
+} /* c-mode */
+#endif
+#endif
+
+#if 0
+#define SWIGRUNTIME_DEBUG
+#endif
+
+
+SWIGRUNTIME void
+SWIG_InitializeModule(void *clientdata) {
+  size_t i;
+  swig_module_info *module_head, *iter;
+  int found, init;
+  
+  clientdata = clientdata;
+  
+  /* check to see if the circular list has been setup, if not, set it up */
+  if (swig_module.next==0) {
+    /* Initialize the swig_module */
+    swig_module.type_initial = swig_type_initial;
+    swig_module.cast_initial = swig_cast_initial;
+    swig_module.next = &swig_module;
+    init = 1;
+  } else {
+    init = 0;
+  }
+  
+  /* Try and load any already created modules */
+  module_head = SWIG_GetModule(clientdata);
+  if (!module_head) {
+    /* This is the first module loaded for this interpreter */
+    /* so set the swig module into the interpreter */
+    SWIG_SetModule(clientdata, &swig_module);
+    module_head = &swig_module;
+  } else {
+    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
+    found=0;
+    iter=module_head;
+    do {
+      if (iter==&swig_module) {
+        found=1;
+        break;
+      }
+      iter=iter->next;
+    } while (iter!= module_head);
+    
+    /* if the is found in the list, then all is done and we may leave */
+    if (found) return;
+    /* otherwise we must add out module into the list */
+    swig_module.next = module_head->next;
+    module_head->next = &swig_module;
+  }
+  
+  /* When multiple interpeters are used, a module could have already been initialized in
+       a different interpreter, but not yet have a pointer in this interpreter.
+       In this case, we do not want to continue adding types... everything should be
+       set up already */
+  if (init == 0) return;
+  
+  /* Now work on filling in swig_module.types */
+#ifdef SWIGRUNTIME_DEBUG
+  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
+#endif
+  for (i = 0; i < swig_module.size; ++i) {
+    swig_type_info *type = 0;
+    swig_type_info *ret;
+    swig_cast_info *cast;
+    
+#ifdef SWIGRUNTIME_DEBUG
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+#endif
+    
+    /* if there is another module already loaded */
+    if (swig_module.next != &swig_module) {
+      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
+    }
+    if (type) {
+      /* Overwrite clientdata field */
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: found type %s\n", type->name);
+#endif
+      if (swig_module.type_initial[i]->clientdata) {
+        type->clientdata = swig_module.type_initial[i]->clientdata;
+#ifdef SWIGRUNTIME_DEBUG
+        printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
+#endif
+      }
+    } else {
+      type = swig_module.type_initial[i];
+    }
+    
+    /* Insert casting types */
+    cast = swig_module.cast_initial[i];
+    while (cast->type) {
+      /* Don't need to add information already in the list */
+      ret = 0;
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
+#endif
+      if (swig_module.next != &swig_module) {
+        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
+#ifdef SWIGRUNTIME_DEBUG
+        if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
+#endif
+      }
+      if (ret) {
+        if (type == swig_module.type_initial[i]) {
+#ifdef SWIGRUNTIME_DEBUG
+          printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
+#endif
+          cast->type = ret;
+          ret = 0;
+        } else {
+          /* Check for casting already in the list */
+          swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
+#ifdef SWIGRUNTIME_DEBUG
+          if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
+#endif
+          if (!ocast) ret = 0;
+        }
+      }
+      
+      if (!ret) {
+#ifdef SWIGRUNTIME_DEBUG
+        printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
+#endif
+        if (type->cast) {
+          type->cast->prev = cast;
+          cast->next = type->cast;
+        }
+        type->cast = cast;
+      }
+      cast++;
+    }
+    /* Set entry in modules->types array equal to the type */
+    swig_module.types[i] = type;
+  }
+  swig_module.types[i] = 0;
+  
+#ifdef SWIGRUNTIME_DEBUG
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+  for (i = 0; i < swig_module.size; ++i) {
+    int j = 0;
+    swig_cast_info *cast = swig_module.cast_initial[i];
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+    while (cast->type) {
+      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
+      cast++;
+      ++j;
+    }
+    printf("---- Total casts: %d\n",j);
+  }
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+#endif
+}
+
+/* This function will propagate the clientdata field of type to
+* any new swig_type_info structures that have been added into the list
+* of equivalent types.  It is like calling
+* SWIG_TypeClientData(type, clientdata) a second time.
+*/
+SWIGRUNTIME void
+SWIG_PropagateClientData(void) {
+  size_t i;
+  swig_cast_info *equiv;
+  static int init_run = 0;
+  
+  if (init_run) return;
+  init_run = 1;
+  
+  for (i = 0; i < swig_module.size; i++) {
+    if (swig_module.types[i]->clientdata) {
+      equiv = swig_module.types[i]->cast;
+      while (equiv) {
+        if (!equiv->converter) {
+          if (equiv->type && !equiv->type->clientdata)
+          SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
+        }
+        equiv = equiv->next;
+      }
+    }
+  }
+}
+
+#ifdef __cplusplus
+#if 0
+{
+  /* c-mode */
+#endif
+}
+#endif
+
+
+
+#ifdef __cplusplus
+extern "C"
+#endif
+
+XS(SWIG_init) {
+  dXSARGS;
+  int i;
+  
+  SWIG_InitializeModule(0);
+  
+  /* Install commands */
+  for (i = 0; swig_commands[i].name; i++) {
+    newXS((char*) swig_commands[i].name,swig_commands[i].wrapper, (char*)__FILE__);
+  }
+  
+  /* Install variables */
+  for (i = 0; swig_variables[i].name; i++) {
+    SV *sv;
+    sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI);
+    if (swig_variables[i].type) {
+      SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0);
+    } else {
+      sv_setiv(sv,(IV) 0);
+    }
+    swig_create_magic(sv, (char *) swig_variables[i].name, swig_variables[i].set, swig_variables[i].get); 
+  }
+  
+  /* Install constant */
+  for (i = 0; swig_constants[i].type; i++) {
+    SV *sv;
+    sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI);
+    switch(swig_constants[i].type) {
+    case SWIG_INT:
+      sv_setiv(sv, (IV) swig_constants[i].lvalue);
+      break;
+    case SWIG_FLOAT:
+      sv_setnv(sv, (double) swig_constants[i].dvalue);
+      break;
+    case SWIG_STRING:
+      sv_setpv(sv, (char *) swig_constants[i].pvalue);
+      break;
+    case SWIG_POINTER:
+      SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype),0);
+      break;
+    case SWIG_BINARY:
+      SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype));
+      break;
+    default:
+      break;
+    }
+    SvREADONLY_on(sv);
+  }
+  
+  ST(0) = &PL_sv_yes;
+  XSRETURN(1);
+}
+
diff --git a/perl/Amanda/Tests.pm b/perl/Amanda/Tests.pm
new file mode 100644 (file)
index 0000000..0d7566f
--- /dev/null
@@ -0,0 +1,91 @@
+# This file was automatically generated by SWIG (http://www.swig.org).
+# Version 1.3.35
+#
+# Don't modify this file, modify the SWIG interface instead.
+
+package Amanda::Tests;
+require Exporter;
+require DynaLoader;
+@ISA = qw(Exporter DynaLoader);
+require Amanda::Types;
+package Amanda::Testsc;
+bootstrap Amanda::Tests;
+package Amanda::Tests;
+@EXPORT = qw( );
+
+# ---------- BASE METHODS -------------
+
+package Amanda::Tests;
+
+sub TIEHASH {
+    my ($classname,$obj) = @_;
+    return bless $obj, $classname;
+}
+
+sub CLEAR { }
+
+sub FIRSTKEY { }
+
+sub NEXTKEY { }
+
+sub FETCH {
+    my ($self,$field) = @_;
+    my $member_func = "swig_${field}_get";
+    $self->$member_func();
+}
+
+sub STORE {
+    my ($self,$field,$newval) = @_;
+    my $member_func = "swig_${field}_set";
+    $self->$member_func($newval);
+}
+
+sub this {
+    my $ptr = shift;
+    return tied(%$ptr);
+}
+
+
+# ------- FUNCTION WRAPPERS --------
+
+package Amanda::Tests;
+
+*take_guint64 = *Amanda::Testsc::take_guint64;
+*take_gint64 = *Amanda::Testsc::take_gint64;
+*take_guint32 = *Amanda::Testsc::take_guint32;
+*take_gint32 = *Amanda::Testsc::take_gint32;
+*take_guint16 = *Amanda::Testsc::take_guint16;
+*take_gint16 = *Amanda::Testsc::take_gint16;
+*take_guint8 = *Amanda::Testsc::take_guint8;
+*take_gint8 = *Amanda::Testsc::take_gint8;
+*give_guint64 = *Amanda::Testsc::give_guint64;
+*give_gint64 = *Amanda::Testsc::give_gint64;
+*give_guint32 = *Amanda::Testsc::give_guint32;
+*give_gint32 = *Amanda::Testsc::give_gint32;
+*give_guint16 = *Amanda::Testsc::give_guint16;
+*give_gint16 = *Amanda::Testsc::give_gint16;
+*give_guint8 = *Amanda::Testsc::give_guint8;
+*give_gint8 = *Amanda::Testsc::give_gint8;
+*sizeof_size_t = *Amanda::Testsc::sizeof_size_t;
+*write_random_file = *Amanda::Testsc::write_random_file;
+*verify_random_file = *Amanda::Testsc::verify_random_file;
+
+# ------- VARIABLE STUBS --------
+
+package Amanda::Tests;
+
+
+@EXPORT_OK = ();
+%EXPORT_TAGS = ();
+
+=head1 NAME
+
+Amanda::Tests -- test functions for installchecks
+
+=head1 SYNOPSIS
+
+This module exists only to provide functions for installcheck scripts to call,
+mostly to test that various C-Perl interface techniques are working.
+
+=cut
+1;
diff --git a/perl/Amanda/Tests.swg b/perl/Amanda/Tests.swg
new file mode 100644 (file)
index 0000000..19c7238
--- /dev/null
@@ -0,0 +1,251 @@
+/*
+ * Copyright (c) Zmanda, Inc.  All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ *
+ * This 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 this library; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+ *
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+ */
+
+%module "Amanda::Tests"
+%include "amglue/amglue.swg"
+%include "exception.i"
+
+%{
+#include "simpleprng.h"
+%}
+
+/* import dumptype_t, among others */
+%import "Amanda/Types.swg";
+
+%perlcode %{
+=head1 NAME
+
+Amanda::Tests -- test functions for installchecks
+
+=head1 SYNOPSIS
+
+This module exists only to provide functions for installcheck scripts to call,
+mostly to test that various C-Perl interface techniques are working.
+
+=cut
+%}
+
+%inline %{
+
+/*
+ * exercise bigint.c / integer.swg
+ */
+
+char *take_guint64(guint64 input) {
+    if (input == G_MAXUINT64) return "MAX";
+    if (input == 0) return "ZERO";
+    return "OTHER";
+}
+
+char *take_gint64(gint64 input) {
+    if (input == G_MAXINT64) return "MAX";
+    if (input == G_MININT64) return "MIN";
+    if (input == 0) return "ZERO";
+    return "OTHER";
+}
+
+char *take_guint32(guint32 input) {
+    if (input == G_MAXUINT32) return "MAX";
+    if (input == 0) return "ZERO";
+    return "OTHER";
+}
+
+char *take_gint32(gint32 input) {
+    if (input == G_MAXINT32) return "MAX";
+    if (input == G_MININT32) return "MIN";
+    if (input == 0) return "ZERO";
+    return "OTHER";
+}
+
+char *take_guint16(guint16 input) {
+    if (input == G_MAXUINT16) return "MAX";
+    if (input == 0) return "ZERO";
+    return "OTHER";
+}
+
+char *take_gint16(gint16 input) {
+    if (input == G_MAXINT16) return "MAX";
+    if (input == G_MININT16) return "MIN";
+    if (input == 0) return "ZERO";
+    return "OTHER";
+}
+
+char *take_guint8(guint8 input) {
+    if (input == G_MAXUINT8) return "MAX";
+    if (input == 0) return "ZERO";
+    return "OTHER";
+}
+
+char *take_gint8(gint8 input) {
+    if (input == G_MAXINT8) return "MAX";
+    if (input == G_MININT8) return "MIN";
+    if (input == 0) return "ZERO";
+    return "OTHER";
+}
+
+
+guint64 give_guint64(char *input) {
+    if (input[0] == '+') return G_MAXUINT64;
+    return 0;
+}
+
+gint64 give_gint64(char *input) {
+    if (input[0] == '-') return G_MININT64;
+    if (input[0] == '+') return G_MAXINT64;
+    return 0;
+}
+
+guint32 give_guint32(char *input) {
+    if (input[0] == '+') return G_MAXUINT32;
+    return 0;
+}
+
+gint32 give_gint32(char *input) {
+    if (input[0] == '-') return G_MININT32;
+    if (input[0] == '+') return G_MAXINT32;
+    return 0;
+}
+
+guint16 give_guint16(char *input) {
+    if (input[0] == '+') return G_MAXUINT16;
+    return 0;
+}
+
+gint16 give_gint16(char *input) {
+    if (input[0] == '-') return G_MININT16;
+    if (input[0] == '+') return G_MAXINT16;
+    return 0;
+}
+
+guint8 give_guint8(char *input) {
+    if (input[0] == '+') return G_MAXUINT8;
+    return 0;
+}
+
+gint8 give_gint8(char *input) {
+    if (input[0] == '-') return G_MININT8;
+    if (input[0] == '+') return G_MAXINT8;
+    return 0;
+}
+%}
+
+/*
+ * Various compiler/system characteristics
+ */
+
+%inline %{
+
+int sizeof_size_t(void) {
+    return sizeof(size_t);
+}
+
+%}
+
+/*
+ * simpleprng interface
+ */
+
+%inline %{
+
+/* write LENGTH bytes of random data to FILENAME, seeded with SEED */
+void
+write_random_file(guint32 seed, size_t length, char *filename) {
+    simpleprng_state_t prng;
+    int fd;
+    char buf[10240];
+
+    simpleprng_seed(&prng, seed);
+
+    fd = open(filename, O_CREAT|O_WRONLY|O_TRUNC, 0666);
+    if (fd < 0)
+       g_critical(_("Could not open test file '%s': %s"), filename, strerror(errno));
+
+    while (length) {
+       size_t to_write = min(sizeof(buf), length);
+       size_t written;
+
+       simpleprng_fill_buffer(&prng, buf, to_write);
+
+       written = full_write(fd, buf, to_write);
+       if (written < to_write)
+           g_critical(_("Error writing test file: %s"), strerror(errno));
+
+       length -= written;
+    }
+
+    close(fd);
+}
+
+/* read LENGTH bytes of random data from FILENAME verifying it against
+ * a PRNG seeded with SEED.  Sends any error messages to stderr.
+ *
+ * If check_eof is true, then check that the file is exactly LENGTH bytes long;
+ * otherwise, trailing bytes (such as zero padding from a Device) are ignored.
+ */
+gboolean
+verify_random_file(guint32 seed, size_t length, char *filename, gboolean check_eof) {
+    simpleprng_state_t prng;
+    int fd;
+    char buf[10240];
+
+    simpleprng_seed(&prng, seed);
+
+    fd = open(filename, O_RDONLY, 0666);
+    if (fd < 0)
+       g_critical(_("Could not open test file '%s': %s"), filename, strerror(errno));
+
+    while (length) {
+       size_t to_read = min(sizeof(buf), length);
+       size_t bytes_read;
+
+       bytes_read = full_read(fd, buf, to_read);
+       if (bytes_read < to_read) {
+           if (errno) {
+               g_critical(_("Error reading test file: %s"), strerror(errno));
+           } else {
+               g_fprintf(stderr, _("Verify of '%s' failed: early EOF with %zd bytes left\n"),
+                       filename, length - bytes_read);
+               goto error;
+           }
+       }
+
+       if (!simpleprng_verify_buffer(&prng, buf, bytes_read))
+           goto error;
+
+       length -= bytes_read;
+    }
+
+    /* verify that the file contains no extra bytes */
+    if (check_eof) {
+       if (read(fd, buf, 1)) {
+           g_fprintf(stderr, _("Verify of '%s' failed: file is too long\n"), filename);
+           goto error;
+       }
+    }
+
+    close(fd);
+    return TRUE;
+
+error:
+    close(fd);
+    return FALSE;
+}
+
+%}
index 975e35025e323fa60cabc65720f7c646879b0f88..5659bf6bafe48adde6f9e2e5662de74de368f3da 100644 (file)
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.33
+ * Version 1.3.35
  * 
  * This file is not intended to be easily readable and contains a number of 
  * coding conventions designed to improve portability and efficiency. Do not make
 
 /* This should only be incremented when either the layout of swig_type_info changes,
    or for whatever reason, the runtime changes incompatibly */
-#define SWIG_RUNTIME_VERSION "3"
+#define SWIG_RUNTIME_VERSION "4"
 
 /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
 #ifdef SWIG_TYPE_TABLE
 
 /* Flags for pointer conversions */
 #define SWIG_POINTER_DISOWN        0x1
+#define SWIG_CAST_NEW_MEMORY       0x2
 
 /* Flags for new pointer objects */
 #define SWIG_POINTER_OWN           0x1
@@ -297,10 +298,10 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) {
 extern "C" {
 #endif
 
-typedef void *(*swig_converter_func)(void *);
+typedef void *(*swig_converter_func)(void *, int *);
 typedef struct swig_type_info *(*swig_dycast_func)(void **);
 
-/* Structure to store inforomation on one type */
+/* Structure to store information on one type */
 typedef struct swig_type_info {
   const char             *name;                        /* mangled name of this type */
   const char             *str;                 /* human readable name of this type */
@@ -427,8 +428,8 @@ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
   Cast a pointer up an inheritance hierarchy
 */
 SWIGRUNTIMEINLINE void *
-SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
-  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
 }
 
 /* 
@@ -1061,7 +1062,7 @@ SWIG_Perl_TypeProxyName(const swig_type_info *type) {
 
 SWIGRUNTIME swig_cast_info *
 SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
-  SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp((char*)iter->type->name, c) == 0)) 
+  SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp(iter->type->name, c) == 0)) 
                            || (iter->type->clientdata && (strcmp((char*)iter->type->clientdata, c) == 0))), ty);
 }
 
@@ -1119,7 +1120,11 @@ SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *
     if (!tc) {
       return SWIG_ERROR;
     }
-    *ptr = SWIG_TypeCast(tc,voidptr);
+    {
+      int newmemory = 0;
+      *ptr = SWIG_TypeCast(tc,voidptr,&newmemory);
+      assert(!newmemory); /* newmemory handling not yet implemented */
+    }
   } else {
     *ptr = voidptr;
   }
@@ -1294,7 +1299,7 @@ SWIG_Perl_GetModule(void) {
 
   /* first check if pointer already created */
   if (!type_pointer) {
-    pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE);
+    pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI);
     if (pointer && SvOK(pointer)) {
       type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
     }
@@ -1308,7 +1313,7 @@ SWIG_Perl_SetModule(swig_module_info *module) {
   SV *pointer;
 
   /* create a new pointer */
-  pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE);
+  pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI);
   sv_setiv(pointer, PTR2IV(module));
 }
 
@@ -1442,7 +1447,7 @@ static swig_module_info swig_module = {swig_types, 7, 0, 0, 0, 0};
 #define SWIG_name   "Amanda::Typesc::boot_Amanda__Types"
 #define SWIG_prefix "Amanda::Typesc::"
 
-#define SWIGVERSION 0x010333 
+#define SWIGVERSION 0x010335 
 #define SWIG_VERSION SWIGVERSION
 
 
@@ -1705,6 +1710,16 @@ SWIG_FromCharPtrAndSize(const char* carray, size_t size)
 }
 
 
+
+
+
+SWIGINTERNINLINE SV * 
+SWIG_FromCharPtr(const char *cptr)
+{ 
+  return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
+}
+
+
 SWIGINTERN int
 SWIG_AsVal_unsigned_SS_long SWIG_PERL_DECL_ARGS_2(SV *obj, unsigned long *val) 
 {
@@ -2543,7 +2558,7 @@ XS(_wrap_dumpfile_t_program_get) {
 }
 
 
-XS(_wrap_dumpfile_t_dumper_set) {
+XS(_wrap_dumpfile_t_application_set) {
   {
     dumpfile_t *arg1 = (dumpfile_t *) 0 ;
     char *arg2 ;
@@ -2555,21 +2570,21 @@ XS(_wrap_dumpfile_t_dumper_set) {
     dXSARGS;
     
     if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: dumpfile_t_dumper_set(self,dumper);");
+      SWIG_croak("Usage: dumpfile_t_application_set(self,application);");
     }
     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_dumpfile_t, 0 |  0 );
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dumpfile_t_dumper_set" "', argument " "1"" of type '" "dumpfile_t *""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dumpfile_t_application_set" "', argument " "1"" of type '" "dumpfile_t *""'"); 
     }
     arg1 = (dumpfile_t *)(argp1);
     res2 = SWIG_AsCharArray(ST(1), temp2, STRMAX);
     if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "dumpfile_t_dumper_set" "', argument " "2"" of type '" "char [STRMAX]""'");
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "dumpfile_t_application_set" "', argument " "2"" of type '" "char [STRMAX]""'");
     }
     arg2 = (char *)(temp2);
     {
-      strncpy(arg1->dumper, arg2, STRMAX);
-      if (arg1->dumper[STRMAX-1] != '\0')
+      strncpy(arg1->application, arg2, STRMAX);
+      if (arg1->application[STRMAX-1] != '\0')
       SWIG_exception(SWIG_ValueError, "String too large for dumpfile_t");
     }
     
@@ -2584,7 +2599,7 @@ XS(_wrap_dumpfile_t_dumper_set) {
 }
 
 
-XS(_wrap_dumpfile_t_dumper_get) {
+XS(_wrap_dumpfile_t_application_get) {
   {
     dumpfile_t *arg1 = (dumpfile_t *) 0 ;
     char *result = 0 ;
@@ -2594,14 +2609,14 @@ XS(_wrap_dumpfile_t_dumper_get) {
     dXSARGS;
     
     if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: dumpfile_t_dumper_get(self);");
+      SWIG_croak("Usage: dumpfile_t_application_get(self);");
     }
     res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_dumpfile_t, 0 |  0 );
     if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dumpfile_t_dumper_get" "', argument " "1"" of type '" "dumpfile_t *""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dumpfile_t_application_get" "', argument " "1"" of type '" "dumpfile_t *""'"); 
     }
     arg1 = (dumpfile_t *)(argp1);
-    result = (char *) ((arg1)->dumper);
+    result = (char *) ((arg1)->application);
     {
       size_t size = STRMAX;
       
@@ -3443,6 +3458,78 @@ XS(_wrap_dumpfile_t_cont_filename_get) {
 }
 
 
+XS(_wrap_dumpfile_t_dle_str_set) {
+  {
+    dumpfile_t *arg1 = (dumpfile_t *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: dumpfile_t_dle_str_set(self,dle_str);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_dumpfile_t, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dumpfile_t_dle_str_set" "', argument " "1"" of type '" "dumpfile_t *""'"); 
+    }
+    arg1 = (dumpfile_t *)(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "dumpfile_t_dle_str_set" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = (char *)(buf2);
+    if (arg1->dle_str) free((char*)arg1->dle_str);
+    if (arg2) {
+      size_t size = strlen((const char *)(arg2)) + 1;
+      arg1->dle_str = (char *)(char *)memcpy((char *)malloc((size)*sizeof(char)), (const char *)(arg2), sizeof(char)*(size));
+    } else {
+      arg1->dle_str = 0;
+    }
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_dumpfile_t_dle_str_get) {
+  {
+    dumpfile_t *arg1 = (dumpfile_t *) 0 ;
+    char *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: dumpfile_t_dle_str_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_dumpfile_t, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dumpfile_t_dle_str_get" "', argument " "1"" of type '" "dumpfile_t *""'"); 
+    }
+    arg1 = (dumpfile_t *)(argp1);
+    result = (char *) ((arg1)->dle_str);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
 XS(_wrap_dumpfile_t_is_partial_set) {
   {
     dumpfile_t *arg1 = (dumpfile_t *) 0 ;
@@ -3900,8 +3987,8 @@ static swig_command_info swig_commands[] = {
 {"Amanda::Typesc::dumpfile_t_disk_get", _wrap_dumpfile_t_disk_get},
 {"Amanda::Typesc::dumpfile_t_program_set", _wrap_dumpfile_t_program_set},
 {"Amanda::Typesc::dumpfile_t_program_get", _wrap_dumpfile_t_program_get},
-{"Amanda::Typesc::dumpfile_t_dumper_set", _wrap_dumpfile_t_dumper_set},
-{"Amanda::Typesc::dumpfile_t_dumper_get", _wrap_dumpfile_t_dumper_get},
+{"Amanda::Typesc::dumpfile_t_application_set", _wrap_dumpfile_t_application_set},
+{"Amanda::Typesc::dumpfile_t_application_get", _wrap_dumpfile_t_application_get},
 {"Amanda::Typesc::dumpfile_t_srvcompprog_set", _wrap_dumpfile_t_srvcompprog_set},
 {"Amanda::Typesc::dumpfile_t_srvcompprog_get", _wrap_dumpfile_t_srvcompprog_get},
 {"Amanda::Typesc::dumpfile_t_clntcompprog_set", _wrap_dumpfile_t_clntcompprog_set},
@@ -3924,6 +4011,8 @@ static swig_command_info swig_commands[] = {
 {"Amanda::Typesc::dumpfile_t_clnt_decrypt_opt_get", _wrap_dumpfile_t_clnt_decrypt_opt_get},
 {"Amanda::Typesc::dumpfile_t_cont_filename_set", _wrap_dumpfile_t_cont_filename_set},
 {"Amanda::Typesc::dumpfile_t_cont_filename_get", _wrap_dumpfile_t_cont_filename_get},
+{"Amanda::Typesc::dumpfile_t_dle_str_set", _wrap_dumpfile_t_dle_str_set},
+{"Amanda::Typesc::dumpfile_t_dle_str_get", _wrap_dumpfile_t_dle_str_get},
 {"Amanda::Typesc::dumpfile_t_is_partial_set", _wrap_dumpfile_t_is_partial_set},
 {"Amanda::Typesc::dumpfile_t_is_partial_get", _wrap_dumpfile_t_is_partial_get},
 {"Amanda::Typesc::dumpfile_t_partnum_set", _wrap_dumpfile_t_partnum_set},
@@ -3993,7 +4082,7 @@ SWIGRUNTIME void
 SWIG_InitializeModule(void *clientdata) {
   size_t i;
   swig_module_info *module_head, *iter;
-  int found;
+  int found, init;
   
   clientdata = clientdata;
   
@@ -4003,6 +4092,9 @@ SWIG_InitializeModule(void *clientdata) {
     swig_module.type_initial = swig_type_initial;
     swig_module.cast_initial = swig_cast_initial;
     swig_module.next = &swig_module;
+    init = 1;
+  } else {
+    init = 0;
   }
   
   /* Try and load any already created modules */
@@ -4031,6 +4123,12 @@ SWIG_InitializeModule(void *clientdata) {
     module_head->next = &swig_module;
   }
   
+  /* When multiple interpeters are used, a module could have already been initialized in
+       a different interpreter, but not yet have a pointer in this interpreter.
+       In this case, we do not want to continue adding types... everything should be
+       set up already */
+  if (init == 0) return;
+  
   /* Now work on filling in swig_module.types */
 #ifdef SWIGRUNTIME_DEBUG
   printf("SWIG_InitializeModule: size %d\n", swig_module.size);
@@ -4184,7 +4282,7 @@ XS(SWIG_init) {
   /* Install variables */
   for (i = 0; swig_variables[i].name; i++) {
     SV *sv;
-    sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2);
+    sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI);
     if (swig_variables[i].type) {
       SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0);
     } else {
@@ -4196,7 +4294,7 @@ XS(SWIG_init) {
   /* Install constant */
   for (i = 0; swig_constants[i].type; i++) {
     SV *sv;
-    sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2);
+    sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI);
     switch(swig_constants[i].type) {
     case SWIG_INT:
       sv_setiv(sv, (IV) swig_constants[i].lvalue);
@@ -4219,43 +4317,43 @@ XS(SWIG_init) {
     SvREADONLY_on(sv);
   }
   
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "F_UNKNOWN", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "F_UNKNOWN", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(F_UNKNOWN)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "F_WEIRD", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "F_WEIRD", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(F_WEIRD)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "F_TAPESTART", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "F_TAPESTART", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(F_TAPESTART)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "F_TAPEEND", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "F_TAPEEND", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(F_TAPEEND)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "F_DUMPFILE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "F_DUMPFILE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(F_DUMPFILE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "F_CONT_DUMPFILE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "F_CONT_DUMPFILE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(F_CONT_DUMPFILE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "F_SPLIT_DUMPFILE", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "F_SPLIT_DUMPFILE", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(F_SPLIT_DUMPFILE)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "F_EMPTY", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "F_EMPTY", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(F_EMPTY)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
index 02ed893d3acee3b81c8cfdf7cb051da21ccc6391..ca6f340fdf41033d4cce93ac4f389d3bc4d97c7f 100644 (file)
@@ -1,5 +1,5 @@
 # This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.33
+# Version 1.3.35
 #
 # Don't modify this file, modify the SWIG interface instead.
 
@@ -77,8 +77,8 @@ use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
 *swig_disk_set = *Amanda::Typesc::dumpfile_t_disk_set;
 *swig_program_get = *Amanda::Typesc::dumpfile_t_program_get;
 *swig_program_set = *Amanda::Typesc::dumpfile_t_program_set;
-*swig_dumper_get = *Amanda::Typesc::dumpfile_t_dumper_get;
-*swig_dumper_set = *Amanda::Typesc::dumpfile_t_dumper_set;
+*swig_application_get = *Amanda::Typesc::dumpfile_t_application_get;
+*swig_application_set = *Amanda::Typesc::dumpfile_t_application_set;
 *swig_srvcompprog_get = *Amanda::Typesc::dumpfile_t_srvcompprog_get;
 *swig_srvcompprog_set = *Amanda::Typesc::dumpfile_t_srvcompprog_set;
 *swig_clntcompprog_get = *Amanda::Typesc::dumpfile_t_clntcompprog_get;
@@ -101,6 +101,8 @@ use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
 *swig_clnt_decrypt_opt_set = *Amanda::Typesc::dumpfile_t_clnt_decrypt_opt_set;
 *swig_cont_filename_get = *Amanda::Typesc::dumpfile_t_cont_filename_get;
 *swig_cont_filename_set = *Amanda::Typesc::dumpfile_t_cont_filename_set;
+*swig_dle_str_get = *Amanda::Typesc::dumpfile_t_dle_str_get;
+*swig_dle_str_set = *Amanda::Typesc::dumpfile_t_dle_str_set;
 *swig_is_partial_get = *Amanda::Typesc::dumpfile_t_is_partial_get;
 *swig_is_partial_set = *Amanda::Typesc::dumpfile_t_is_partial_set;
 *swig_partnum_get = *Amanda::Typesc::dumpfile_t_partnum_get;
@@ -171,50 +173,92 @@ New structures may be added, but existing types are stable.
 =head1 dumpfile_t
 
 An in-memory representation of an Amanda header, with keys
+
 =over
+
 =item C<type>;
+
 =item C<datestamp>;
+
 =item C<dumplevel>;
+
 =item C<compressed>;
+
 =item C<encrypted>;
+
 =item C<comp_suffix>;
+
 =item C<encrypt_suffix>;
+
 =item C<name> -- hostname or label;
+
 =item C<disk>;
+
 =item C<program>;
-=item C<dumper>;
+
+=item C<application>;
+
 =item C<srvcompprog>;
+
 =item C<clntcompprog>;
+
 =item C<srv_encrypt>;
+
 =item C<clnt_encrypt>;
+
 =item C<recover_cmd>;
+
 =item C<uncompress_cmd>;
+
 =item C<encrypt_cmd>;
+
 =item C<decrypt_cmd>;
+
 =item C<srv_decrypt_opt>;
+
 =item C<clnt_decrypt_opt>;
+
 =item C<cont_filename>;
+
+=itme C<dle_str>;
+
 =item C<is_partial>;
+
 =item C<partnum>;
+
 =item C<totalparts> (-1 == UNKNOWN); and
-=item blocksize.
+
+=item C<blocksize>.
+
 =back
 
 where C<type> is one of the following constants, which are availble
 for import in the tag C<:filetype_t>:
+
 =over
+
 =item C<F_UNKNOWN>;
+
 =item C<F_WEIRD>;
+
 =item C<F_TAPESTART>;
+
 =item C<F_TAPEEND>;
+
 =item C<F_DUMPFILE>;
+
 =item C<F_CONT_DUMPFILE>;
+
 =item C<F_SPLIT_DUMPFILE>; or
+
 =item C<F_EMPTY>.
+
 =back
 
 NOTE: no methods are currently defined on C<dumpfile_t>; interfaces
-can be written as needed.
+can be written as needed.  A new dumpfile is created with
+
+    my $hdr = Amanda::Types::dumpfile_t->new();
 
 =cut
 
index ff235016ac4699231afbc37d451dc987c6856f6d..c8a675383a76a4ee5da48cc00e073f8cbc87aea7 100644 (file)
@@ -14,8 +14,8 @@
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  *
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 %module "Amanda::Types"
@@ -43,50 +43,92 @@ New structures may be added, but existing types are stable.
 =head1 dumpfile_t
 
 An in-memory representation of an Amanda header, with keys
+
 =over
+
 =item C<type>;
+
 =item C<datestamp>;
+
 =item C<dumplevel>;
+
 =item C<compressed>;
+
 =item C<encrypted>;
+
 =item C<comp_suffix>;
+
 =item C<encrypt_suffix>;
+
 =item C<name> -- hostname or label;
+
 =item C<disk>;
+
 =item C<program>;
-=item C<dumper>;
+
+=item C<application>;
+
 =item C<srvcompprog>;
+
 =item C<clntcompprog>;
+
 =item C<srv_encrypt>;
+
 =item C<clnt_encrypt>;
+
 =item C<recover_cmd>;
+
 =item C<uncompress_cmd>;
+
 =item C<encrypt_cmd>;
+
 =item C<decrypt_cmd>;
+
 =item C<srv_decrypt_opt>;
+
 =item C<clnt_decrypt_opt>;
+
 =item C<cont_filename>;
+
+=itme C<dle_str>;
+
 =item C<is_partial>;
+
 =item C<partnum>;
+
 =item C<totalparts> (-1 == UNKNOWN); and
-=item blocksize.
+
+=item C<blocksize>.
+
 =back
 
 where C<type> is one of the following constants, which are availble
 for import in the tag C<:filetype_t>:
+
 =over
+
 =item C<F_UNKNOWN>;
+
 =item C<F_WEIRD>;
+
 =item C<F_TAPESTART>;
+
 =item C<F_TAPEEND>;
+
 =item C<F_DUMPFILE>;
+
 =item C<F_CONT_DUMPFILE>;
+
 =item C<F_SPLIT_DUMPFILE>; or
+
 =item C<F_EMPTY>.
+
 =back
 
 NOTE: no methods are currently defined on C<dumpfile_t>; interfaces
-can be written as needed.
+can be written as needed.  A new dumpfile is created with
+
+    my $hdr = Amanda::Types::dumpfile_t->new();
 
 =cut
 %}
@@ -120,7 +162,7 @@ typedef struct {
     string_t name;     /* hostname or label */
     string_t disk;
     string_t program;
-    string_t dumper;
+    string_t application;
     string_t srvcompprog;
     string_t clntcompprog;
     string_t srv_encrypt;
@@ -132,6 +174,7 @@ typedef struct {
     string_t srv_decrypt_opt;
     string_t clnt_decrypt_opt;
     string_t cont_filename;
+    char *dle_str;
     int is_partial;
     int partnum;
     int totalparts; /* -1 == UNKNOWN */
index b4cc13ed47eb1bbe5abb4d21056af4c4a71871ca..d33b61dbebc2360a55ffe2e16f2a925cf79a48e8 100644 (file)
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.33
+ * Version 1.3.35
  * 
  * This file is not intended to be easily readable and contains a number of 
  * coding conventions designed to improve portability and efficiency. Do not make
 
 /* This should only be incremented when either the layout of swig_type_info changes,
    or for whatever reason, the runtime changes incompatibly */
-#define SWIG_RUNTIME_VERSION "3"
+#define SWIG_RUNTIME_VERSION "4"
 
 /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
 #ifdef SWIG_TYPE_TABLE
 
 /* Flags for pointer conversions */
 #define SWIG_POINTER_DISOWN        0x1
+#define SWIG_CAST_NEW_MEMORY       0x2
 
 /* Flags for new pointer objects */
 #define SWIG_POINTER_OWN           0x1
@@ -297,10 +298,10 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) {
 extern "C" {
 #endif
 
-typedef void *(*swig_converter_func)(void *);
+typedef void *(*swig_converter_func)(void *, int *);
 typedef struct swig_type_info *(*swig_dycast_func)(void **);
 
-/* Structure to store inforomation on one type */
+/* Structure to store information on one type */
 typedef struct swig_type_info {
   const char             *name;                        /* mangled name of this type */
   const char             *str;                 /* human readable name of this type */
@@ -427,8 +428,8 @@ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
   Cast a pointer up an inheritance hierarchy
 */
 SWIGRUNTIMEINLINE void *
-SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
-  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
 }
 
 /* 
@@ -1061,7 +1062,7 @@ SWIG_Perl_TypeProxyName(const swig_type_info *type) {
 
 SWIGRUNTIME swig_cast_info *
 SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
-  SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp((char*)iter->type->name, c) == 0)) 
+  SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp(iter->type->name, c) == 0)) 
                            || (iter->type->clientdata && (strcmp((char*)iter->type->clientdata, c) == 0))), ty);
 }
 
@@ -1119,7 +1120,11 @@ SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *
     if (!tc) {
       return SWIG_ERROR;
     }
-    *ptr = SWIG_TypeCast(tc,voidptr);
+    {
+      int newmemory = 0;
+      *ptr = SWIG_TypeCast(tc,voidptr,&newmemory);
+      assert(!newmemory); /* newmemory handling not yet implemented */
+    }
   } else {
     *ptr = voidptr;
   }
@@ -1294,7 +1299,7 @@ SWIG_Perl_GetModule(void) {
 
   /* first check if pointer already created */
   if (!type_pointer) {
-    pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE);
+    pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI);
     if (pointer && SvOK(pointer)) {
       type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
     }
@@ -1308,7 +1313,7 @@ SWIG_Perl_SetModule(swig_module_info *module) {
   SV *pointer;
 
   /* create a new pointer */
-  pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE);
+  pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI);
   sv_setiv(pointer, PTR2IV(module));
 }
 
@@ -1440,7 +1445,7 @@ static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0};
 #define SWIG_name   "Amanda::Utilc::boot_Amanda__Util"
 #define SWIG_prefix "Amanda::Utilc::"
 
-#define SWIGVERSION 0x010333 
+#define SWIGVERSION 0x010335 
 #define SWIG_VERSION SWIGVERSION
 
 
@@ -1477,6 +1482,26 @@ SWIGEXPORT void SWIG_init (CV *cv, CPerlObj *);
 #include "file.h"
 
 
+SWIGINTERNINLINE SV *
+SWIG_FromCharPtrAndSize(const char* carray, size_t size)
+{
+  SV *obj = sv_newmortal();
+  if (carray) {
+    sv_setpvn(obj, carray, size);
+  } else {
+    sv_setsv(obj, &PL_sv_undef);
+  }
+  return obj;
+}
+
+
+SWIGINTERNINLINE SV * 
+SWIG_FromCharPtr(const char *cptr)
+{ 
+  return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
+}
+
+
 SWIGINTERNINLINE SV *
 SWIG_From_long  SWIG_PERL_DECL_ARGS_1(long value)
 {    
@@ -1671,21 +1696,6 @@ SWIG_AsVal_int SWIG_PERL_DECL_ARGS_2(SV * obj, int *val)
   return res;
 }
 
-
-void
-set_erroutput_type(char *type, char *context)
-{
-    if (strcmp(context, "cmdline") == 0) {
-       erroutput_type = ERR_INTERACTIVE;
-    } else if (strcmp(context, "daemon") == 0) {
-       if (strcmp(type, "server") == 0) {
-           erroutput_type = ERR_INTERACTIVE|ERR_AMANDALOG;
-       } else if (strcmp(type, "client") == 0) {
-           erroutput_type = ERR_INTERACTIVE|ERR_SYSLOG;
-       }
-    }
-}
-
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -1715,6 +1725,111 @@ SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *SWIGUNUSEDPARM(sv), MAGIC *SW
 #ifdef __cplusplus
 extern "C" {
 #endif
+XS(_wrap_get_original_cwd) {
+  {
+    char *result = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: get_original_cwd();");
+    }
+    result = (char *)get_original_cwd();
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_sanitise_filename) {
+  {
+    char *arg1 = (char *) 0 ;
+    char *result = 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: sanitise_filename(inp);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "sanitise_filename" "', argument " "1"" of type '" "char *""'");
+    }
+    arg1 = (char *)(buf1);
+    result = (char *)sanitise_filename(arg1);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_quote_string) {
+  {
+    char *arg1 = (char *) 0 ;
+    char *result = 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: quote_string(char *);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "quote_string" "', argument " "1"" of type '" "char *""'");
+    }
+    arg1 = (char *)(buf1);
+    result = (char *)quote_string(arg1);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_unquote_string) {
+  {
+    char *arg1 = (char *) 0 ;
+    char *result = 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: unquote_string(char *);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "unquote_string" "', argument " "1"" of type '" "char *""'");
+    }
+    arg1 = (char *)(buf1);
+    result = (char *)unquote_string(arg1);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
+    SWIG_croak_null();
+  }
+}
+
+
 XS(_wrap_set_pname) {
   {
     char *arg1 = (char *) 0 ;
@@ -1743,31 +1858,42 @@ XS(_wrap_set_pname) {
 }
 
 
-XS(_wrap_safe_cd) {
+XS(_wrap_set_ptype) {
   {
+    char *arg1 = (char *) 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
     int argvi = 0;
     dXSARGS;
     
-    if ((items < 0) || (items > 0)) {
-      SWIG_croak("Usage: safe_cd();");
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: set_ptype(type);");
     }
-    safe_cd();
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "set_ptype" "', argument " "1"" of type '" "char *""'");
+    }
+    arg1 = (char *)(buf1);
+    set_ptype(arg1);
     
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
     XSRETURN(argvi);
   fail:
+    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
     SWIG_croak_null();
   }
 }
 
 
-XS(_wrap_check_running_as) {
+XS(_wrap_set_pcontext) {
   {
-    running_as_flags arg1 ;
+    pcontext_t arg1 ;
     int argvi = 0;
     dXSARGS;
     
     if ((items < 1) || (items > 1)) {
-      SWIG_croak("Usage: check_running_as(who);");
+      SWIG_croak("Usage: set_pcontext(context);");
     }
     {
       if (sizeof(signed int) == 1) {
@@ -1782,7 +1908,7 @@ XS(_wrap_check_running_as) {
         g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
       }
     }
-    check_running_as(arg1);
+    set_pcontext(arg1);
     
     
     XSRETURN(argvi);
@@ -1793,40 +1919,51 @@ XS(_wrap_check_running_as) {
 }
 
 
-XS(_wrap_set_erroutput_type) {
+XS(_wrap_safe_cd) {
   {
-    char *arg1 = (char *) 0 ;
-    char *arg2 = (char *) 0 ;
-    int res1 ;
-    char *buf1 = 0 ;
-    int alloc1 = 0 ;
-    int res2 ;
-    char *buf2 = 0 ;
-    int alloc2 = 0 ;
     int argvi = 0;
     dXSARGS;
     
-    if ((items < 2) || (items > 2)) {
-      SWIG_croak("Usage: set_erroutput_type(type,context);");
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: safe_cd();");
     }
-    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "set_erroutput_type" "', argument " "1"" of type '" "char *""'");
+    safe_cd();
+    
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_check_running_as) {
+  {
+    running_as_flags arg1 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: check_running_as(who);");
     }
-    arg1 = (char *)(buf1);
-    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "set_erroutput_type" "', argument " "2"" of type '" "char *""'");
+    {
+      if (sizeof(signed int) == 1) {
+        arg1 = amglue_SvI8(ST(0));
+      } else if (sizeof(signed int) == 2) {
+        arg1 = amglue_SvI16(ST(0));
+      } else if (sizeof(signed int) == 4) {
+        arg1 = amglue_SvI32(ST(0));
+      } else if (sizeof(signed int) == 8) {
+        arg1 = amglue_SvI64(ST(0));
+      } else {
+        g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
+      }
     }
-    arg2 = (char *)(buf2);
-    set_erroutput_type(arg1,arg2);
+    check_running_as(arg1);
+    
     
-    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
-    if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
     XSRETURN(argvi);
   fail:
-    if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
-    if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
+    
     SWIG_croak_null();
   }
 }
@@ -1838,7 +1975,7 @@ XS(_wrap_set_erroutput_type) {
 static swig_type_info _swigt__p_char = {"_p_char", "gchar *|char *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_double = {"_p_double", "double *|gdouble *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_float = {"_p_float", "float *|gfloat *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_int = {"_p_int", "int *|gboolean *|running_as_flags *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_int = {"_p_int", "int *|pcontext_t *|gboolean *|running_as_flags *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "guchar *|unsigned char *", 0, 0, (void*)0, 0};
 
 static swig_type_info *swig_type_initial[] = {
@@ -1876,10 +2013,15 @@ static swig_variable_info swig_variables[] = {
 {0,0,0,0}
 };
 static swig_command_info swig_commands[] = {
+{"Amanda::Utilc::get_original_cwd", _wrap_get_original_cwd},
+{"Amanda::Utilc::sanitise_filename", _wrap_sanitise_filename},
+{"Amanda::Utilc::quote_string", _wrap_quote_string},
+{"Amanda::Utilc::unquote_string", _wrap_unquote_string},
 {"Amanda::Utilc::set_pname", _wrap_set_pname},
+{"Amanda::Utilc::set_ptype", _wrap_set_ptype},
+{"Amanda::Utilc::set_pcontext", _wrap_set_pcontext},
 {"Amanda::Utilc::safe_cd", _wrap_safe_cd},
 {"Amanda::Utilc::check_running_as", _wrap_check_running_as},
-{"Amanda::Utilc::set_erroutput_type", _wrap_set_erroutput_type},
 {0,0}
 };
 /* -----------------------------------------------------------------------------
@@ -1939,7 +2081,7 @@ SWIGRUNTIME void
 SWIG_InitializeModule(void *clientdata) {
   size_t i;
   swig_module_info *module_head, *iter;
-  int found;
+  int found, init;
   
   clientdata = clientdata;
   
@@ -1949,6 +2091,9 @@ SWIG_InitializeModule(void *clientdata) {
     swig_module.type_initial = swig_type_initial;
     swig_module.cast_initial = swig_cast_initial;
     swig_module.next = &swig_module;
+    init = 1;
+  } else {
+    init = 0;
   }
   
   /* Try and load any already created modules */
@@ -1977,6 +2122,12 @@ SWIG_InitializeModule(void *clientdata) {
     module_head->next = &swig_module;
   }
   
+  /* When multiple interpeters are used, a module could have already been initialized in
+       a different interpreter, but not yet have a pointer in this interpreter.
+       In this case, we do not want to continue adding types... everything should be
+       set up already */
+  if (init == 0) return;
+  
   /* Now work on filling in swig_module.types */
 #ifdef SWIGRUNTIME_DEBUG
   printf("SWIG_InitializeModule: size %d\n", swig_module.size);
@@ -2130,7 +2281,7 @@ XS(SWIG_init) {
   /* Install variables */
   for (i = 0; swig_variables[i].name; i++) {
     SV *sv;
-    sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2);
+    sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI);
     if (swig_variables[i].type) {
       SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0);
     } else {
@@ -2142,7 +2293,7 @@ XS(SWIG_init) {
   /* Install constant */
   for (i = 0; swig_constants[i].type; i++) {
     SV *sv;
-    sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2);
+    sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI);
     switch(swig_constants[i].type) {
     case SWIG_INT:
       sv_setiv(sv, (IV) swig_constants[i].lvalue);
@@ -2165,31 +2316,56 @@ XS(SWIG_init) {
     SvREADONLY_on(sv);
   }
   
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "RUNNING_AS_ROOT", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "RUNNING_AS_ANY", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(RUNNING_AS_ANY)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "RUNNING_AS_ROOT", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(RUNNING_AS_ROOT)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "RUNNING_AS_DUMPUSER", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "RUNNING_AS_DUMPUSER", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(RUNNING_AS_DUMPUSER)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "RUNNING_AS_DUMPUSER_PREFERRED", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "RUNNING_AS_DUMPUSER_PREFERRED", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(RUNNING_AS_DUMPUSER_PREFERRED)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "RUNNING_AS_CLIENT_LOGIN", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "RUNNING_AS_CLIENT_LOGIN", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(RUNNING_AS_CLIENT_LOGIN)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig/1.3.33/perl5/perltypemaps.swg,64,%set_constant@*/ do {
-    SV *sv = get_sv((char*) SWIG_prefix "RUNNING_AS_UID_ONLY", TRUE | 0x2);
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "RUNNING_AS_UID_ONLY", TRUE | 0x2 | GV_ADDMULTI);
     sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(RUNNING_AS_UID_ONLY)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CONTEXT_DEFAULT", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CONTEXT_DEFAULT)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CONTEXT_CMDLINE", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CONTEXT_CMDLINE)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CONTEXT_DAEMON", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CONTEXT_DAEMON)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CONTEXT_SCRIPTUTIL", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CONTEXT_SCRIPTUTIL)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
   ST(0) = &PL_sv_yes;
   XSRETURN(1);
 }
index a40c05b0b54969614f3b13a01d2bcbff33e42ca7..3efa6a18b4de2b3b17436e66025b918a99ecc7a5 100644 (file)
@@ -1,5 +1,5 @@
 # This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.33
+# Version 1.3.35
 #
 # Don't modify this file, modify the SWIG interface instead.
 
@@ -49,27 +49,38 @@ sub this {
 
 package Amanda::Util;
 
+*get_original_cwd = *Amanda::Utilc::get_original_cwd;
+*sanitise_filename = *Amanda::Utilc::sanitise_filename;
+*quote_string = *Amanda::Utilc::quote_string;
+*unquote_string = *Amanda::Utilc::unquote_string;
 *set_pname = *Amanda::Utilc::set_pname;
+*set_ptype = *Amanda::Utilc::set_ptype;
+*set_pcontext = *Amanda::Utilc::set_pcontext;
 *safe_cd = *Amanda::Utilc::safe_cd;
 *check_running_as = *Amanda::Utilc::check_running_as;
-*set_erroutput_type = *Amanda::Utilc::set_erroutput_type;
 
 # ------- VARIABLE STUBS --------
 
 package Amanda::Util;
 
+*RUNNING_AS_ANY = *Amanda::Utilc::RUNNING_AS_ANY;
 *RUNNING_AS_ROOT = *Amanda::Utilc::RUNNING_AS_ROOT;
 *RUNNING_AS_DUMPUSER = *Amanda::Utilc::RUNNING_AS_DUMPUSER;
 *RUNNING_AS_DUMPUSER_PREFERRED = *Amanda::Utilc::RUNNING_AS_DUMPUSER_PREFERRED;
 *RUNNING_AS_CLIENT_LOGIN = *Amanda::Utilc::RUNNING_AS_CLIENT_LOGIN;
 *RUNNING_AS_UID_ONLY = *Amanda::Utilc::RUNNING_AS_UID_ONLY;
+*CONTEXT_DEFAULT = *Amanda::Utilc::CONTEXT_DEFAULT;
+*CONTEXT_CMDLINE = *Amanda::Utilc::CONTEXT_CMDLINE;
+*CONTEXT_DAEMON = *Amanda::Utilc::CONTEXT_DAEMON;
+*CONTEXT_SCRIPTUTIL = *Amanda::Utilc::CONTEXT_SCRIPTUTIL;
 
 @EXPORT_OK = ();
 %EXPORT_TAGS = ();
 
 use Amanda::Debug qw(:init);
+use Amanda::Config qw(:getconf);
 use Carp;
-use POSIX qw(:fcntl_h);
+use POSIX qw( :fcntl_h strftime );
 
 =head1 NAME
 
@@ -80,10 +91,10 @@ Amanda::Util - Runtime support for Amanda applications
 Application initialization generally looks like this:
 
   use Amanda::Config qw( :init );
-  use Amanda::Util qw( :check_running_as_flags );
+  use Amanda::Util qw( :constants );
   use Amanda::Debug;
 
-  Amanda::Util::setup_application("myapp", "server", "cmdline");
+  Amanda::Util::setup_application("myapp", "server", $CONTEXT_CMDLINE);
   # .. command-line processing ..
   Amanda::Config::config_init(...);
   Amanda::Util::finish_setup($RUNNING_AS_DUMPUSER);
@@ -98,11 +109,11 @@ configuration.
 C<$name> is the name of the application, used in log messages, etc.  C<$type>
 is usualy one of "server" or "client".  It specifies the subdirectory in which
 debug logfiles will be created.  C<$context> indicates the usual manner in
-which this application is invoked; one of C<"cmdline"> for a user-invoked
-command-line utility (e.g., C<amadmin>) which should send human-readable error
-messages to stderr; C<"daemon"> for a program started by C<amandad>, e.g.,
-C<sendbackup>; or C<"scriptutil"> for a small program used from shell scripts,
-e.g., C<amgetconf>
+which this application is invoked; one of C<$CONTEXT_CMDLINE> for a
+user-invoked command-line utility (e.g., C<amadmin>) which should send
+human-readable error messages to stderr; C<$CONTEXT_DAEMON> for a program
+started by C<amandad>, e.g., C<sendbackup>; or C<$CONTEXT_SCRIPTUTIL> for a
+small program used from shell scripts, e.g., C<amgetconf>
 
 Based on C<$type> and C<$context>, this function does the following:
 
@@ -158,19 +169,19 @@ sub setup_application {
     $_ptype = $type;
     $_pcontext = $context;
 
-    # and let the C side know about the pname
+    # and let the C side know about them too
     set_pname($name);
+    set_ptype($type);
+    set_pcontext($context);
 
     safe_cd(); # (also sets umask)
     check_std_fds();
 
-    # set up debugging for this application type
-    dbopen($type);
+    # set up debugging, now that we have a name, type, and context
+    debug_init();
 
     # ignore SIGPIPE
     $SIG{'PIPE'} = 'IGNORE';
-
-    set_erroutput_type($type, $context);
 }
 
 =item C<finish_setup($running_as_flags)>
@@ -183,6 +194,7 @@ this applciation.
 The user is specified by one of the following flags, which are
 available in export tag C<:check_running_as_flags>:
 
+  $RUNNING_AS_ANY                 # any user is OK
   $RUNNING_AS_ROOT                # root
   $RUNNING_AS_DUMPUSER            # dumpuser, from configuration
   $RUNNING_AS_DUMPUSER_PREFERRED  # dumpuser, but client_login is OK too
@@ -205,6 +217,17 @@ sub finish_setup {
     check_running_as($running_as);
 }
 
+=item C<get_original_cwd()>
+
+Return the original current directory with C<get_original_cwd>.
+
+=cut
+
+push @EXPORT_OK, qw(get_original_cwd);
+push @{$EXPORT_TAGS{"util"}}, qw(get_original_cwd);
+
+=head1 Miscellaneous Utilities
+
 =item C<safe_env()>
 
 Return a "safe" environment hash.  For non-setuid programs, this means filtering out any
@@ -252,6 +275,11 @@ sub running_as_flags_to_strings {
     return @result;
 }
 
+push @EXPORT_OK, qw($RUNNING_AS_ANY);
+push @{$EXPORT_TAGS{"running_as_flags"}}, qw($RUNNING_AS_ANY);
+
+$_running_as_flags_VALUES{"RUNNING_AS_ANY"} = $RUNNING_AS_ANY;
+
 push @EXPORT_OK, qw($RUNNING_AS_ROOT);
 push @{$EXPORT_TAGS{"running_as_flags"}}, qw($RUNNING_AS_ROOT);
 
@@ -277,6 +305,118 @@ push @{$EXPORT_TAGS{"running_as_flags"}}, qw($RUNNING_AS_UID_ONLY);
 
 $_running_as_flags_VALUES{"RUNNING_AS_UID_ONLY"} = $RUNNING_AS_UID_ONLY;
 
+#copy symbols in running_as_flags to constants
+push @{$EXPORT_TAGS{"constants"}},  @{$EXPORT_TAGS{"running_as_flags"}};
+
+push @EXPORT_OK, qw(pcontext_t_to_string);
+push @{$EXPORT_TAGS{"pcontext_t"}}, qw(pcontext_t_to_string);
+
+my %_pcontext_t_VALUES;
+#Convert an enum value to a single string
+sub pcontext_t_to_string {
+    my ($enumval) = @_;
+
+    for my $k (keys %_pcontext_t_VALUES) {
+       my $v = $_pcontext_t_VALUES{$k};
+
+       #is this a matching flag?
+       if ($enumval == $v) {
+           return $k;
+       }
+    }
+
+#default, just return the number
+    return $enumval;
+}
+
+push @EXPORT_OK, qw($CONTEXT_DEFAULT);
+push @{$EXPORT_TAGS{"pcontext_t"}}, qw($CONTEXT_DEFAULT);
+
+$_pcontext_t_VALUES{"CONTEXT_DEFAULT"} = $CONTEXT_DEFAULT;
+
+push @EXPORT_OK, qw($CONTEXT_CMDLINE);
+push @{$EXPORT_TAGS{"pcontext_t"}}, qw($CONTEXT_CMDLINE);
+
+$_pcontext_t_VALUES{"CONTEXT_CMDLINE"} = $CONTEXT_CMDLINE;
+
+push @EXPORT_OK, qw($CONTEXT_DAEMON);
+push @{$EXPORT_TAGS{"pcontext_t"}}, qw($CONTEXT_DAEMON);
+
+$_pcontext_t_VALUES{"CONTEXT_DAEMON"} = $CONTEXT_DAEMON;
+
+push @EXPORT_OK, qw($CONTEXT_SCRIPTUTIL);
+push @{$EXPORT_TAGS{"pcontext_t"}}, qw($CONTEXT_SCRIPTUTIL);
+
+$_pcontext_t_VALUES{"CONTEXT_SCRIPTUTIL"} = $CONTEXT_SCRIPTUTIL;
+
+#copy symbols in pcontext_t to constants
+push @{$EXPORT_TAGS{"constants"}},  @{$EXPORT_TAGS{"pcontext_t"}};
+
+=item C<quote_string($str)>
+
+Quote a string using Amanda's quoting algorithm.  Strings with no whitespace,
+control, or quote characters are returned unchanged.  An empty string is
+represented as the two-character string C<"">.  Otherwise, tab, newline,
+carriage return, form-feed, backslash, and double-quote (C<">) characters are
+escaped with a backslash and the string is surrounded by double quotes.
+
+=item C<unquote_string($str)>
+
+Unquote a string as quoted with C<quote_string>.
+
+=item C<skip_quoted_string($str)>
+
+my($q, $remaider) = skip_quoted_string($str)
+
+Return the first quoted string and the remainder of the string.
+
+Both C<quote_string>, C<unquote_string> and C<skip_quoted_string> are
+available under the export tag C<:quoting>.
+
+=cut
+
+sub skip_quoted_string {
+    my $str = shift;
+
+    chomp $str;
+    my $iq = 0;
+    my $i = 0;
+    my $c = substr $str, $i, 1;
+    while ($c ne "" && !($iq == 0 && $c =~ /\s/)) {
+       if ($c eq '"') {
+           $iq = !$iq;
+       } elsif ($c eq '\\') {
+           $i++;
+       }
+       $i++;
+       $c = substr $str, $i, 1;
+    }
+    my $quoted_string = substr $str, 0, $i;
+    my $remainder     = substr $str, $i+1;
+
+    return ($quoted_string, $remainder);
+}
+
+
+push @EXPORT_OK, qw(quote_string unquote_string skip_quoted_string sanitise_filename);
+push @{$EXPORT_TAGS{"quoting"}}, qw(quote_string unquote_string skip_quoted_string sanitise_filename);
+
+=item C<generate_timestamp()>
+
+Generate a timestamp from the current time, obeying the 'USETIMESTAMPS'
+config parameter.  The Amanda configuration must already be loaded.
+
+=cut
+
+sub generate_timestamp {
+    # this corresponds to common-src/timestamp.c's get_proper_stamp_from_time
+    if (getconf($CNF_USETIMESTAMPS)) {
+       return strftime "%Y%m%d%H%M%S", localtime;
+    } else {
+       return strftime "%Y%m%d", localtime;
+    }
+}
+
 sub check_std_fds {
     fcntl(STDIN, F_GETFD, 0) or critical("Standard input is not open");
     fcntl(STDOUT, F_GETFD, 0) or critical("Standard output is not open");
index e38a2e597957965ff95df69bbd97b5c145eb7a96..2d6627663ee7ab248f3896d59390ae5c01a63fae 100644 (file)
@@ -14,8 +14,8 @@
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  *
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 %module "Amanda::Util"
@@ -31,8 +31,9 @@
 
 %perlcode %{
 use Amanda::Debug qw(:init);
+use Amanda::Config qw(:getconf);
 use Carp;
-use POSIX qw(:fcntl_h);
+use POSIX qw( :fcntl_h strftime );
 
 =head1 NAME
 
@@ -43,10 +44,10 @@ Amanda::Util - Runtime support for Amanda applications
 Application initialization generally looks like this:
 
   use Amanda::Config qw( :init );
-  use Amanda::Util qw( :check_running_as_flags );
+  use Amanda::Util qw( :constants );
   use Amanda::Debug;
 
-  Amanda::Util::setup_application("myapp", "server", "cmdline");
+  Amanda::Util::setup_application("myapp", "server", $CONTEXT_CMDLINE);
   # .. command-line processing ..
   Amanda::Config::config_init(...);
   Amanda::Util::finish_setup($RUNNING_AS_DUMPUSER);
@@ -61,11 +62,11 @@ configuration.
 C<$name> is the name of the application, used in log messages, etc.  C<$type>
 is usualy one of "server" or "client".  It specifies the subdirectory in which
 debug logfiles will be created.  C<$context> indicates the usual manner in
-which this application is invoked; one of C<"cmdline"> for a user-invoked
-command-line utility (e.g., C<amadmin>) which should send human-readable error
-messages to stderr; C<"daemon"> for a program started by C<amandad>, e.g.,
-C<sendbackup>; or C<"scriptutil"> for a small program used from shell scripts,
-e.g., C<amgetconf>
+which this application is invoked; one of C<$CONTEXT_CMDLINE> for a
+user-invoked command-line utility (e.g., C<amadmin>) which should send
+human-readable error messages to stderr; C<$CONTEXT_DAEMON> for a program
+started by C<amandad>, e.g., C<sendbackup>; or C<$CONTEXT_SCRIPTUTIL> for a
+small program used from shell scripts, e.g., C<amgetconf>
 
 Based on C<$type> and C<$context>, this function does the following:
 
@@ -121,19 +122,19 @@ sub setup_application {
     $_ptype = $type;
     $_pcontext = $context;
 
-    # and let the C side know about the pname
+    # and let the C side know about them too
     set_pname($name);
+    set_ptype($type);
+    set_pcontext($context);
 
     safe_cd(); # (also sets umask)
     check_std_fds();
 
-    # set up debugging for this application type
-    dbopen($type);
+    # set up debugging, now that we have a name, type, and context
+    debug_init();
 
     # ignore SIGPIPE
     $SIG{'PIPE'} = 'IGNORE';
-
-    set_erroutput_type($type, $context);
 }
 
 =item C<finish_setup($running_as_flags)>
@@ -146,6 +147,7 @@ this applciation.
 The user is specified by one of the following flags, which are
 available in export tag C<:check_running_as_flags>:
 
+  $RUNNING_AS_ANY                 # any user is OK
   $RUNNING_AS_ROOT                # root
   $RUNNING_AS_DUMPUSER            # dumpuser, from configuration
   $RUNNING_AS_DUMPUSER_PREFERRED  # dumpuser, but client_login is OK too
@@ -168,6 +170,18 @@ sub finish_setup {
     check_running_as($running_as);
 }
 
+=item C<get_original_cwd()>
+
+Return the original current directory with C<get_original_cwd>.
+
+=cut
+%}
+char *get_original_cwd(void);
+amglue_export_tag(util, get_original_cwd);
+
+%perlcode %{
+=head1 Miscellaneous Utilities
+
 =item C<safe_env()>
 
 Return a "safe" environment hash.  For non-setuid programs, this means filtering out any
@@ -191,42 +205,103 @@ sub safe_env {
 %}
 
 amglue_add_flag_tag_fns(running_as_flags);
+amglue_add_constant(RUNNING_AS_ANY, running_as_flags);
 amglue_add_constant(RUNNING_AS_ROOT, running_as_flags);
 amglue_add_constant(RUNNING_AS_DUMPUSER, running_as_flags);
 amglue_add_constant(RUNNING_AS_DUMPUSER_PREFERRED, running_as_flags);
 amglue_add_constant(RUNNING_AS_CLIENT_LOGIN, running_as_flags);
 amglue_add_constant(RUNNING_AS_UID_ONLY, running_as_flags);
+amglue_copy_to_tag(running_as_flags, constants);
+
+amglue_add_enum_tag_fns(pcontext_t);
+amglue_add_constant(CONTEXT_DEFAULT, pcontext_t);
+amglue_add_constant(CONTEXT_CMDLINE, pcontext_t);
+amglue_add_constant(CONTEXT_DAEMON, pcontext_t);
+amglue_add_constant(CONTEXT_SCRIPTUTIL, pcontext_t);
+amglue_copy_to_tag(pcontext_t, constants);
+
+%perlcode %{
+=item C<quote_string($str)>
+
+Quote a string using Amanda's quoting algorithm.  Strings with no whitespace,
+control, or quote characters are returned unchanged.  An empty string is
+represented as the two-character string C<"">.  Otherwise, tab, newline,
+carriage return, form-feed, backslash, and double-quote (C<">) characters are
+escaped with a backslash and the string is surrounded by double quotes.
+
+=item C<unquote_string($str)>
+
+Unquote a string as quoted with C<quote_string>.
+
+=item C<skip_quoted_string($str)>
+
+my($q, $remaider) = skip_quoted_string($str)
+
+Return the first quoted string and the remainder of the string.
+
+Both C<quote_string>, C<unquote_string> and C<skip_quoted_string> are
+available under the export tag C<:quoting>.
+
+=cut
+
+sub skip_quoted_string {
+    my $str = shift;
+
+    chomp $str;
+    my $iq = 0;
+    my $i = 0;
+    my $c = substr $str, $i, 1;
+    while ($c ne "" && !($iq == 0 && $c =~ /\s/)) {
+       if ($c eq '"') {
+           $iq = !$iq;
+       } elsif ($c eq '\\') {
+           $i++;
+       }
+       $i++;
+       $c = substr $str, $i, 1;
+    }
+    my $quoted_string = substr $str, 0, $i;
+    my $remainder     = substr $str, $i+1;
+
+    return ($quoted_string, $remainder);
+}
+
+%}
+
+char *sanitise_filename(char *inp);
+char *quote_string(char *);
+char *unquote_string(char *);
+amglue_export_tag(quoting, quote_string unquote_string skip_quoted_string sanitise_filename);
+
+%perlcode %{
+=item C<generate_timestamp()>
+
+Generate a timestamp from the current time, obeying the 'USETIMESTAMPS'
+config parameter.  The Amanda configuration must already be loaded.
+
+=cut
+
+sub generate_timestamp {
+    # this corresponds to common-src/timestamp.c's get_proper_stamp_from_time
+    if (getconf($CNF_USETIMESTAMPS)) {
+       return strftime "%Y%m%d%H%M%S", localtime;
+    } else {
+       return strftime "%Y%m%d", localtime;
+    }
+}
+%}
 
 /* -------------------------------------------------------------------------
  * Functions below this line are only meant to be called within this module;
  * do not call them externally. */
 
 void set_pname(char *name);
+void set_ptype(char *type);
+void set_pcontext(pcontext_t context);
 void safe_cd(void);
 
 void check_running_as(running_as_flags who);
 
-/* Set erroutput_type as appropriate for this process type and context.
- *
- * @param type: process type
- * @param context: process context
- */
-%inline %{
-void
-set_erroutput_type(char *type, char *context)
-{
-    if (strcmp(context, "cmdline") == 0) {
-       erroutput_type = ERR_INTERACTIVE;
-    } else if (strcmp(context, "daemon") == 0) {
-       if (strcmp(type, "server") == 0) {
-           erroutput_type = ERR_INTERACTIVE|ERR_AMANDALOG;
-       } else if (strcmp(type, "client") == 0) {
-           erroutput_type = ERR_INTERACTIVE|ERR_SYSLOG;
-       }
-    }
-}
-%}
-
 /* Check that fd's 0, 1, and 2 are open, calling critical() if not.
  */
 %perlcode %{
diff --git a/perl/Amanda/Xfer.c b/perl/Amanda/Xfer.c
new file mode 100644 (file)
index 0000000..a37f24c
--- /dev/null
@@ -0,0 +1,2977 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ * 
+ * This file is not intended to be easily readable and contains a number of 
+ * coding conventions designed to improve portability and efficiency. Do not make
+ * changes to this file unless you know what you are doing--modify the SWIG 
+ * interface file instead. 
+ * ----------------------------------------------------------------------------- */
+
+#define SWIGPERL
+#define SWIG_CASTRANK_MODE
+/* -----------------------------------------------------------------------------
+ *  This section contains generic SWIG labels for method/variable
+ *  declarations/attributes, and other compiler dependent labels.
+ * ----------------------------------------------------------------------------- */
+
+/* template workaround for compilers that cannot correctly implement the C++ standard */
+#ifndef SWIGTEMPLATEDISAMBIGUATOR
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# elif defined(__HP_aCC)
+/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
+/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# else
+#  define SWIGTEMPLATEDISAMBIGUATOR
+# endif
+#endif
+
+/* inline attribute */
+#ifndef SWIGINLINE
+# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
+#   define SWIGINLINE inline
+# else
+#   define SWIGINLINE
+# endif
+#endif
+
+/* attribute recognised by some compilers to avoid 'unused' warnings */
+#ifndef SWIGUNUSED
+# if defined(__GNUC__)
+#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#     define SWIGUNUSED __attribute__ ((__unused__)) 
+#   else
+#     define SWIGUNUSED
+#   endif
+# elif defined(__ICC)
+#   define SWIGUNUSED __attribute__ ((__unused__)) 
+# else
+#   define SWIGUNUSED 
+# endif
+#endif
+
+#ifndef SWIGUNUSEDPARM
+# ifdef __cplusplus
+#   define SWIGUNUSEDPARM(p)
+# else
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
+# endif
+#endif
+
+/* internal SWIG method */
+#ifndef SWIGINTERN
+# define SWIGINTERN static SWIGUNUSED
+#endif
+
+/* internal inline SWIG method */
+#ifndef SWIGINTERNINLINE
+# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
+#endif
+
+/* exporting methods */
+#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#  ifndef GCC_HASCLASSVISIBILITY
+#    define GCC_HASCLASSVISIBILITY
+#  endif
+#endif
+
+#ifndef SWIGEXPORT
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   if defined(STATIC_LINKED)
+#     define SWIGEXPORT
+#   else
+#     define SWIGEXPORT __declspec(dllexport)
+#   endif
+# else
+#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
+#     define SWIGEXPORT __attribute__ ((visibility("default")))
+#   else
+#     define SWIGEXPORT
+#   endif
+# endif
+#endif
+
+/* calling conventions for Windows */
+#ifndef SWIGSTDCALL
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   define SWIGSTDCALL __stdcall
+# else
+#   define SWIGSTDCALL
+# endif 
+#endif
+
+/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
+#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
+# define _SCL_SECURE_NO_DEPRECATE
+#endif
+
+
+/* -----------------------------------------------------------------------------
+ * swigrun.swg
+ *
+ * This file contains generic CAPI SWIG runtime support for pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+/* This should only be incremented when either the layout of swig_type_info changes,
+   or for whatever reason, the runtime changes incompatibly */
+#define SWIG_RUNTIME_VERSION "4"
+
+/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
+#ifdef SWIG_TYPE_TABLE
+# define SWIG_QUOTE_STRING(x) #x
+# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
+# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
+#else
+# define SWIG_TYPE_TABLE_NAME
+#endif
+
+/*
+  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
+  creating a static or dynamic library from the swig runtime code.
+  In 99.9% of the cases, swig just needs to declare them as 'static'.
+  
+  But only do this if is strictly necessary, ie, if you have problems
+  with your compiler or so.
+*/
+
+#ifndef SWIGRUNTIME
+# define SWIGRUNTIME SWIGINTERN
+#endif
+
+#ifndef SWIGRUNTIMEINLINE
+# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
+#endif
+
+/*  Generic buffer size */
+#ifndef SWIG_BUFFER_SIZE
+# define SWIG_BUFFER_SIZE 1024
+#endif
+
+/* Flags for pointer conversions */
+#define SWIG_POINTER_DISOWN        0x1
+#define SWIG_CAST_NEW_MEMORY       0x2
+
+/* Flags for new pointer objects */
+#define SWIG_POINTER_OWN           0x1
+
+
+/* 
+   Flags/methods for returning states.
+   
+   The swig conversion methods, as ConvertPtr, return and integer 
+   that tells if the conversion was successful or not. And if not,
+   an error code can be returned (see swigerrors.swg for the codes).
+   
+   Use the following macros/flags to set or process the returning
+   states.
+   
+   In old swig versions, you usually write code as:
+
+     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
+       // success code
+     } else {
+       //fail code
+     }
+
+   Now you can be more explicit as:
+
+    int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+    } else {
+      // fail code
+    }
+
+   that seems to be the same, but now you can also do
+
+    Type *ptr;
+    int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+      if (SWIG_IsNewObj(res) {
+        ...
+       delete *ptr;
+      } else {
+        ...
+      }
+    } else {
+      // fail code
+    }
+    
+   I.e., now SWIG_ConvertPtr can return new objects and you can
+   identify the case and take care of the deallocation. Of course that
+   requires also to SWIG_ConvertPtr to return new result values, as
+
+      int SWIG_ConvertPtr(obj, ptr,...) {         
+        if (<obj is ok>) {                            
+          if (<need new object>) {                    
+            *ptr = <ptr to new allocated object>; 
+            return SWIG_NEWOBJ;                       
+          } else {                                    
+            *ptr = <ptr to old object>;               
+            return SWIG_OLDOBJ;                       
+          }                                   
+        } else {                                      
+          return SWIG_BADOBJ;                 
+        }                                             
+      }
+
+   Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
+   more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
+   swig errors code.
+
+   Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
+   allows to return the 'cast rank', for example, if you have this
+
+       int food(double)
+       int fooi(int);
+
+   and you call
+      food(1)   // cast rank '1'  (1 -> 1.0)
+      fooi(1)   // cast rank '0'
+
+   just use the SWIG_AddCast()/SWIG_CheckState()
+
+
+ */
+#define SWIG_OK                    (0) 
+#define SWIG_ERROR                 (-1)
+#define SWIG_IsOK(r)               (r >= 0)
+#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)  
+
+/* The CastRankLimit says how many bits are used for the cast rank */
+#define SWIG_CASTRANKLIMIT         (1 << 8)
+/* The NewMask denotes the object was created (using new/malloc) */
+#define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
+/* The TmpMask is for in/out typemaps that use temporal objects */
+#define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
+/* Simple returning values */
+#define SWIG_BADOBJ                (SWIG_ERROR)
+#define SWIG_OLDOBJ                (SWIG_OK)
+#define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
+#define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
+/* Check, add and del mask methods */
+#define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
+#define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
+#define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
+#define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
+#define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
+#define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
+
+
+/* Cast-Rank Mode */
+#if defined(SWIG_CASTRANK_MODE)
+#  ifndef SWIG_TypeRank
+#    define SWIG_TypeRank             unsigned long
+#  endif
+#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
+#    define SWIG_MAXCASTRANK          (2)
+#  endif
+#  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
+#  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
+SWIGINTERNINLINE int SWIG_AddCast(int r) { 
+  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
+}
+SWIGINTERNINLINE int SWIG_CheckState(int r) { 
+  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
+}
+#else /* no cast-rank mode */
+#  define SWIG_AddCast
+#  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
+#endif
+
+
+
+
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void *(*swig_converter_func)(void *, int *);
+typedef struct swig_type_info *(*swig_dycast_func)(void **);
+
+/* Structure to store information on one type */
+typedef struct swig_type_info {
+  const char             *name;                        /* mangled name of this type */
+  const char             *str;                 /* human readable name of this type */
+  swig_dycast_func        dcast;               /* dynamic cast function down a hierarchy */
+  struct swig_cast_info  *cast;                        /* linked list of types that can cast into this type */
+  void                   *clientdata;          /* language specific type data */
+  int                    owndata;              /* flag if the structure owns the clientdata */
+} swig_type_info;
+
+/* Structure to store a type and conversion function used for casting */
+typedef struct swig_cast_info {
+  swig_type_info         *type;                        /* pointer to type that is equivalent to this type */
+  swig_converter_func     converter;           /* function to cast the void pointers */
+  struct swig_cast_info  *next;                        /* pointer to next cast in linked list */
+  struct swig_cast_info  *prev;                        /* pointer to the previous cast */
+} swig_cast_info;
+
+/* Structure used to store module information
+ * Each module generates one structure like this, and the runtime collects
+ * all of these structures and stores them in a circularly linked list.*/
+typedef struct swig_module_info {
+  swig_type_info         **types;              /* Array of pointers to swig_type_info structures that are in this module */
+  size_t                 size;                 /* Number of types in this module */
+  struct swig_module_info *next;               /* Pointer to next element in circularly linked list */
+  swig_type_info         **type_initial;       /* Array of initially generated type structures */
+  swig_cast_info         **cast_initial;       /* Array of initially generated casting structures */
+  void                    *clientdata;         /* Language specific module data */
+} swig_module_info;
+
+/* 
+  Compare two type names skipping the space characters, therefore
+  "char*" == "char *" and "Class<int>" == "Class<int >", etc.
+
+  Return 0 when the two name types are equivalent, as in
+  strncmp, but skipping ' '.
+*/
+SWIGRUNTIME int
+SWIG_TypeNameComp(const char *f1, const char *l1,
+                 const char *f2, const char *l2) {
+  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
+    while ((*f1 == ' ') && (f1 != l1)) ++f1;
+    while ((*f2 == ' ') && (f2 != l2)) ++f2;
+    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
+  }
+  return (int)((l1 - f1) - (l2 - f2));
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if not equal, 1 if equal
+*/
+SWIGRUNTIME int
+SWIG_TypeEquiv(const char *nb, const char *tb) {
+  int equiv = 0;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (!equiv && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
+*/
+SWIGRUNTIME int
+SWIG_TypeCompare(const char *nb, const char *tb) {
+  int equiv = 0;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (!equiv && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
+
+
+/* think of this as a c++ template<> or a scheme macro */
+#define SWIG_TypeCheck_Template(comparison, ty)         \
+  if (ty) {                                             \
+    swig_cast_info *iter = ty->cast;                    \
+    while (iter) {                                      \
+      if (comparison) {                                 \
+        if (iter == ty->cast) return iter;              \
+        /* Move iter to the top of the linked list */   \
+        iter->prev->next = iter->next;                  \
+        if (iter->next)                                 \
+          iter->next->prev = iter->prev;                \
+        iter->next = ty->cast;                          \
+        iter->prev = 0;                                 \
+        if (ty->cast) ty->cast->prev = iter;            \
+        ty->cast = iter;                                \
+        return iter;                                    \
+      }                                                 \
+      iter = iter->next;                                \
+    }                                                   \
+  }                                                     \
+  return 0
+
+/*
+  Check the typename
+*/
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheck(const char *c, swig_type_info *ty) {
+  SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
+}
+
+/* Same as previous function, except strcmp is replaced with a pointer comparison */
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
+  SWIG_TypeCheck_Template(iter->type == from, into);
+}
+
+/*
+  Cast a pointer up an inheritance hierarchy
+*/
+SWIGRUNTIMEINLINE void *
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
+}
+
+/* 
+   Dynamic pointer casting. Down an inheritance hierarchy
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
+  swig_type_info *lastty = ty;
+  if (!ty || !ty->dcast) return ty;
+  while (ty && (ty->dcast)) {
+    ty = (*ty->dcast)(ptr);
+    if (ty) lastty = ty;
+  }
+  return lastty;
+}
+
+/*
+  Return the name associated with this type
+*/
+SWIGRUNTIMEINLINE const char *
+SWIG_TypeName(const swig_type_info *ty) {
+  return ty->name;
+}
+
+/*
+  Return the pretty name associated with this type,
+  that is an unmangled type name in a form presentable to the user.
+*/
+SWIGRUNTIME const char *
+SWIG_TypePrettyName(const swig_type_info *type) {
+  /* The "str" field contains the equivalent pretty names of the
+     type, separated by vertical-bar characters.  We choose
+     to print the last name, as it is often (?) the most
+     specific. */
+  if (!type) return NULL;
+  if (type->str != NULL) {
+    const char *last_name = type->str;
+    const char *s;
+    for (s = type->str; *s; s++)
+      if (*s == '|') last_name = s+1;
+    return last_name;
+  }
+  else
+    return type->name;
+}
+
+/* 
+   Set the clientdata field for a type
+*/
+SWIGRUNTIME void
+SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
+  swig_cast_info *cast = ti->cast;
+  /* if (ti->clientdata == clientdata) return; */
+  ti->clientdata = clientdata;
+  
+  while (cast) {
+    if (!cast->converter) {
+      swig_type_info *tc = cast->type;
+      if (!tc->clientdata) {
+       SWIG_TypeClientData(tc, clientdata);
+      }
+    }    
+    cast = cast->next;
+  }
+}
+SWIGRUNTIME void
+SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
+  SWIG_TypeClientData(ti, clientdata);
+  ti->owndata = 1;
+}
+  
+/*
+  Search for a swig_type_info structure only by mangled name
+  Search is a O(log #types)
+  
+  We start searching at module start, and finish searching when start == end.  
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_MangledTypeQueryModule(swig_module_info *start, 
+                            swig_module_info *end, 
+                           const char *name) {
+  swig_module_info *iter = start;
+  do {
+    if (iter->size) {
+      register size_t l = 0;
+      register size_t r = iter->size - 1;
+      do {
+       /* since l+r >= 0, we can (>> 1) instead (/ 2) */
+       register size_t i = (l + r) >> 1; 
+       const char *iname = iter->types[i]->name;
+       if (iname) {
+         register int compare = strcmp(name, iname);
+         if (compare == 0) {       
+           return iter->types[i];
+         } else if (compare < 0) {
+           if (i) {
+             r = i - 1;
+           } else {
+             break;
+           }
+         } else if (compare > 0) {
+           l = i + 1;
+         }
+       } else {
+         break; /* should never happen */
+       }
+      } while (l <= r);
+    }
+    iter = iter->next;
+  } while (iter != end);
+  return 0;
+}
+
+/*
+  Search for a swig_type_info structure for either a mangled name or a human readable name.
+  It first searches the mangled names of the types, which is a O(log #types)
+  If a type is not found it then searches the human readable names, which is O(#types).
+  
+  We start searching at module start, and finish searching when start == end.  
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeQueryModule(swig_module_info *start, 
+                     swig_module_info *end, 
+                    const char *name) {
+  /* STEP 1: Search the name field using binary search */
+  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
+  if (ret) {
+    return ret;
+  } else {
+    /* STEP 2: If the type hasn't been found, do a complete search
+       of the str field (the human readable name) */
+    swig_module_info *iter = start;
+    do {
+      register size_t i = 0;
+      for (; i < iter->size; ++i) {
+       if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
+         return iter->types[i];
+      }
+      iter = iter->next;
+    } while (iter != end);
+  }
+  
+  /* neither found a match */
+  return 0;
+}
+
+/* 
+   Pack binary data into a string
+*/
+SWIGRUNTIME char *
+SWIG_PackData(char *c, void *ptr, size_t sz) {
+  static const char hex[17] = "0123456789abcdef";
+  register const unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu =  u + sz;
+  for (; u != eu; ++u) {
+    register unsigned char uu = *u;
+    *(c++) = hex[(uu & 0xf0) >> 4];
+    *(c++) = hex[uu & 0xf];
+  }
+  return c;
+}
+
+/* 
+   Unpack binary data from a string
+*/
+SWIGRUNTIME const char *
+SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
+  register unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu = u + sz;
+  for (; u != eu; ++u) {
+    register char d = *(c++);
+    register unsigned char uu;
+    if ((d >= '0') && (d <= '9'))
+      uu = ((d - '0') << 4);
+    else if ((d >= 'a') && (d <= 'f'))
+      uu = ((d - ('a'-10)) << 4);
+    else 
+      return (char *) 0;
+    d = *(c++);
+    if ((d >= '0') && (d <= '9'))
+      uu |= (d - '0');
+    else if ((d >= 'a') && (d <= 'f'))
+      uu |= (d - ('a'-10));
+    else 
+      return (char *) 0;
+    *u = uu;
+  }
+  return c;
+}
+
+/* 
+   Pack 'void *' into a string buffer.
+*/
+SWIGRUNTIME char *
+SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
+  char *r = buff;
+  if ((2*sizeof(void *) + 2) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,&ptr,sizeof(void *));
+  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
+  strcpy(r,name);
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      *ptr = (void *) 0;
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sizeof(void *));
+}
+
+SWIGRUNTIME char *
+SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
+  char *r = buff;
+  size_t lname = (name ? strlen(name) : 0);
+  if ((2*sz + 2 + lname) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  if (lname) {
+    strncpy(r,name,lname+1);
+  } else {
+    *r = 0;
+  }
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      memset(ptr,0,sz);
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sz);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/*  Errors in SWIG */
+#define  SWIG_UnknownError        -1 
+#define  SWIG_IOError             -2 
+#define  SWIG_RuntimeError        -3 
+#define  SWIG_IndexError          -4 
+#define  SWIG_TypeError           -5 
+#define  SWIG_DivisionByZero      -6 
+#define  SWIG_OverflowError       -7 
+#define  SWIG_SyntaxError         -8 
+#define  SWIG_ValueError          -9 
+#define  SWIG_SystemError         -10
+#define  SWIG_AttributeError      -11
+#define  SWIG_MemoryError         -12 
+#define  SWIG_NullReferenceError   -13
+
+
+
+#ifdef __cplusplus
+/* Needed on some windows machines---since MS plays funny games with the header files under C++ */
+#include <math.h>
+#include <stdlib.h>
+extern "C" {
+#endif
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+/* Add in functionality missing in older versions of Perl. Much of this is based on Devel-PPPort on cpan. */
+
+/* Add PERL_REVISION, PERL_VERSION, PERL_SUBVERSION if missing */
+#ifndef PERL_REVISION
+#  if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION))
+#    define PERL_PATCHLEVEL_H_IMPLICIT
+#    include <patchlevel.h>
+#  endif
+#  if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL)))
+#    include <could_not_find_Perl_patchlevel.h>
+#  endif
+#  ifndef PERL_REVISION
+#    define PERL_REVISION       (5)
+#    define PERL_VERSION        PATCHLEVEL
+#    define PERL_SUBVERSION     SUBVERSION
+#  endif
+#endif
+
+#if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE)
+#define PerlIO_exportFILE(fh,fl) (FILE*)(fh)
+#endif
+
+#ifndef SvIOK_UV
+# define SvIOK_UV(sv)       (SvIOK(sv) && (SvUVX(sv) == SvIVX(sv)))
+#endif
+
+#ifndef SvUOK
+# define SvUOK(sv)           SvIOK_UV(sv)
+#endif
+
+#if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5)))
+#  define PL_sv_undef               sv_undef
+#  define PL_na                            na
+#  define PL_errgv                  errgv
+#  define PL_sv_no                  sv_no
+#  define PL_sv_yes                 sv_yes
+#  define PL_markstack_ptr          markstack_ptr
+#endif
+
+#ifndef IVSIZE
+#  ifdef LONGSIZE
+#    define IVSIZE LONGSIZE
+#  else
+#    define IVSIZE 4 /* A bold guess, but the best we can make. */
+#  endif
+#endif
+
+#ifndef INT2PTR
+#  if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)
+#    define PTRV                  UV
+#    define INT2PTR(any,d)        (any)(d)
+#  else
+#    if PTRSIZE == LONGSIZE
+#      define PTRV                unsigned long
+#    else
+#      define PTRV                unsigned
+#    endif
+#    define INT2PTR(any,d)        (any)(PTRV)(d)
+#  endif
+
+#  define NUM2PTR(any,d)  (any)(PTRV)(d)
+#  define PTR2IV(p)       INT2PTR(IV,p)
+#  define PTR2UV(p)       INT2PTR(UV,p)
+#  define PTR2NV(p)       NUM2PTR(NV,p)
+
+#  if PTRSIZE == LONGSIZE
+#    define PTR2ul(p)     (unsigned long)(p)
+#  else
+#    define PTR2ul(p)     INT2PTR(unsigned long,p)
+#  endif
+#endif /* !INT2PTR */
+
+#ifndef SvPV_nolen
+# define SvPV_nolen(x) SvPV(x,PL_na)
+#endif
+
+#ifndef get_sv
+#  define get_sv perl_get_sv
+#endif
+
+#ifndef ERRSV
+#  define ERRSV get_sv("@",FALSE)
+#endif
+
+#ifndef pTHX_
+#define pTHX_
+#endif   
+
+#include <string.h>
+#ifdef __cplusplus
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ * error manipulation
+ * ----------------------------------------------------------------------------- */
+
+SWIGINTERN const char*
+SWIG_Perl_ErrorType(int code) {
+  const char* type = 0;
+  switch(code) {
+  case SWIG_MemoryError:
+    type = "MemoryError";
+    break;
+  case SWIG_IOError:
+    type = "IOError";
+    break;
+  case SWIG_RuntimeError:
+    type = "RuntimeError";
+    break;
+  case SWIG_IndexError:
+    type = "IndexError";
+    break;
+  case SWIG_TypeError:
+    type = "TypeError";
+    break;
+  case SWIG_DivisionByZero:
+    type = "ZeroDivisionError";
+    break;
+  case SWIG_OverflowError:
+    type = "OverflowError";
+    break;
+  case SWIG_SyntaxError:
+    type = "SyntaxError";
+    break;
+  case SWIG_ValueError:
+    type = "ValueError";
+    break;
+  case SWIG_SystemError:
+    type = "SystemError";
+    break;
+  case SWIG_AttributeError:
+    type = "AttributeError";
+    break;
+  default:
+    type = "RuntimeError";
+  }
+  return type;
+}
+
+
+
+
+/* -----------------------------------------------------------------------------
+ * perlrun.swg
+ *
+ * This file contains the runtime support for Perl modules
+ * and includes code for managing global variables and pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef PERL_OBJECT
+#define SWIG_PERL_OBJECT_DECL CPerlObj *SWIGUNUSEDPARM(pPerl),
+#define SWIG_PERL_OBJECT_CALL pPerl,
+#else
+#define SWIG_PERL_OBJECT_DECL
+#define SWIG_PERL_OBJECT_CALL
+#endif
+
+/* Common SWIG API */
+
+/* for raw pointers */
+#define SWIG_ConvertPtr(obj, pp, type, flags)           SWIG_Perl_ConvertPtr(SWIG_PERL_OBJECT_CALL obj, pp, type, flags)
+#define SWIG_NewPointerObj(p, type, flags)              SWIG_Perl_NewPointerObj(SWIG_PERL_OBJECT_CALL p, type, flags)
+
+/* for raw packed data */
+#define SWIG_ConvertPacked(obj, p, s, type)             SWIG_Perl_ConvertPacked(SWIG_PERL_OBJECT_CALL obj, p, s, type)
+#define SWIG_NewPackedObj(p, s, type)                  SWIG_Perl_NewPackedObj(SWIG_PERL_OBJECT_CALL p, s, type)
+
+/* for class or struct pointers */
+#define SWIG_ConvertInstance(obj, pptr, type, flags)    SWIG_ConvertPtr(obj, pptr, type, flags)
+#define SWIG_NewInstanceObj(ptr, type, flags)           SWIG_NewPointerObj(ptr, type, flags)
+
+/* for C or C++ function pointers */
+#define SWIG_ConvertFunctionPtr(obj, pptr, type)        SWIG_ConvertPtr(obj, pptr, type, 0)
+#define SWIG_NewFunctionPtrObj(ptr, type)               SWIG_NewPointerObj(ptr, type, 0)
+
+/* for C++ member pointers, ie, member methods */
+#define SWIG_ConvertMember(obj, ptr, sz, ty)            SWIG_ConvertPacked(obj, ptr, sz, ty)
+#define SWIG_NewMemberObj(ptr, sz, type)                SWIG_NewPackedObj(ptr, sz, type)
+
+
+/* Runtime API */
+
+#define SWIG_GetModule(clientdata)                      SWIG_Perl_GetModule()
+#define SWIG_SetModule(clientdata, pointer)             SWIG_Perl_SetModule(pointer)
+
+
+/* Error manipulation */
+
+#define SWIG_ErrorType(code)                            SWIG_Perl_ErrorType(code)               
+#define SWIG_Error(code, msg)                          sv_setpvf(GvSV(PL_errgv),"%s %s\n", SWIG_ErrorType(code), msg)
+#define SWIG_fail                                      goto fail                                                   
+
+/* Perl-specific SWIG API */
+
+#define SWIG_MakePtr(sv, ptr, type, flags)              SWIG_Perl_MakePtr(SWIG_PERL_OBJECT_CALL sv, ptr, type, flags)
+#define SWIG_MakePackedObj(sv, p, s, type)             SWIG_Perl_MakePackedObj(SWIG_PERL_OBJECT_CALL sv, p, s, type)
+#define SWIG_SetError(str)                              SWIG_Error(SWIG_RuntimeError, str)
+
+
+#define SWIG_PERL_DECL_ARGS_1(arg1)                     (SWIG_PERL_OBJECT_DECL arg1)
+#define SWIG_PERL_CALL_ARGS_1(arg1)                     (SWIG_PERL_OBJECT_CALL arg1)
+#define SWIG_PERL_DECL_ARGS_2(arg1, arg2)               (SWIG_PERL_OBJECT_DECL arg1, arg2)
+#define SWIG_PERL_CALL_ARGS_2(arg1, arg2)               (SWIG_PERL_OBJECT_CALL arg1, arg2)
+
+/* -----------------------------------------------------------------------------
+ * pointers/data manipulation
+ * ----------------------------------------------------------------------------- */
+
+/* For backward compatibility only */
+#define SWIG_POINTER_EXCEPTION  0
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SWIG_OWNER   SWIG_POINTER_OWN
+#define SWIG_SHADOW  SWIG_OWNER << 1
+
+#define SWIG_MAYBE_PERL_OBJECT SWIG_PERL_OBJECT_DECL
+
+/* SWIG Perl macros */
+
+/* Macro to declare an XS function */
+#ifndef XSPROTO
+#   define XSPROTO(name) void name(pTHX_ CV* cv)
+#endif
+
+/* Macro to call an XS function */
+#ifdef PERL_OBJECT 
+#  define SWIG_CALLXS(_name) _name(cv,pPerl) 
+#else 
+#  ifndef MULTIPLICITY 
+#    define SWIG_CALLXS(_name) _name(cv) 
+#  else 
+#    define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv) 
+#  endif 
+#endif 
+
+#ifdef PERL_OBJECT
+#define MAGIC_PPERL  CPerlObj *pPerl = (CPerlObj *) this;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
+#define SWIGCLASS_STATIC
+
+#else /* PERL_OBJECT */
+
+#define MAGIC_PPERL
+#define SWIGCLASS_STATIC static SWIGUNUSED
+
+#ifndef MULTIPLICITY
+#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (*SwigMagicFunc)(SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#else /* MULTIPLICITY */
+
+#define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MULTIPLICITY */
+#endif /* PERL_OBJECT */
+
+/* Workaround for bug in perl 5.6.x croak and earlier */
+#if (PERL_VERSION < 8)
+#  ifdef PERL_OBJECT
+#    define SWIG_croak_null() SWIG_Perl_croak_null(pPerl)
+static void SWIG_Perl_croak_null(CPerlObj *pPerl)
+#  else
+static void SWIG_croak_null()
+#  endif
+{
+  SV *err=ERRSV;
+#  if (PERL_VERSION < 6)
+  croak("%_", err);
+#  else
+  if (SvOK(err) && !SvROK(err)) croak("%_", err);
+  croak(Nullch);
+#  endif
+}
+#else
+#  define SWIG_croak_null() croak(Nullch)
+#endif
+
+
+/* 
+   Define how strict is the cast between strings and integers/doubles
+   when overloading between these types occurs.
+   
+   The default is making it as strict as possible by using SWIG_AddCast
+   when needed.
+   
+   You can use -DSWIG_PERL_NO_STRICT_STR2NUM at compilation time to
+   disable the SWIG_AddCast, making the casting between string and
+   numbers less strict.
+
+   In the end, we try to solve the overloading between strings and
+   numerical types in the more natural way, but if you can avoid it,
+   well, avoid it using %rename, for example.
+*/
+#ifndef SWIG_PERL_NO_STRICT_STR2NUM
+# ifndef SWIG_PERL_STRICT_STR2NUM
+#  define SWIG_PERL_STRICT_STR2NUM
+# endif
+#endif
+#ifdef SWIG_PERL_STRICT_STR2NUM
+/* string takes precedence */
+#define SWIG_Str2NumCast(x) SWIG_AddCast(x)  
+#else
+/* number takes precedence */
+#define SWIG_Str2NumCast(x) x
+#endif
+
+
+
+#include <stdlib.h>
+
+SWIGRUNTIME const char *
+SWIG_Perl_TypeProxyName(const swig_type_info *type) {
+  if (!type) return NULL;
+  if (type->clientdata != NULL) {
+    return (const char*) type->clientdata;
+  } 
+  else {
+    return type->name;
+  }
+}
+
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
+  SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp(iter->type->name, c) == 0)) 
+                           || (iter->type->clientdata && (strcmp((char*)iter->type->clientdata, c) == 0))), ty);
+}
+
+
+/* Function for getting a pointer value */
+
+SWIGRUNTIME int
+SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags) {
+  swig_cast_info *tc;
+  void *voidptr = (void *)0;
+  SV *tsv = 0;
+  /* If magical, apply more magic */
+  if (SvGMAGICAL(sv))
+    mg_get(sv);
+
+  /* Check to see if this is an object */
+  if (sv_isobject(sv)) {
+    IV tmp = 0;
+    tsv = (SV*) SvRV(sv);
+    if ((SvTYPE(tsv) == SVt_PVHV)) {
+      MAGIC *mg;
+      if (SvMAGICAL(tsv)) {
+        mg = mg_find(tsv,'P');
+        if (mg) {
+          sv = mg->mg_obj;
+          if (sv_isobject(sv)) {
+           tsv = (SV*)SvRV(sv);
+            tmp = SvIV(tsv);
+          }
+        }
+      } else {
+        return SWIG_ERROR;
+      }
+    } else {
+      tmp = SvIV(tsv);
+    }
+    voidptr = INT2PTR(void *,tmp);
+  } else if (! SvOK(sv)) {            /* Check for undef */
+    *(ptr) = (void *) 0;
+    return SWIG_OK;
+  } else if (SvTYPE(sv) == SVt_RV) {  /* Check for NULL pointer */
+    if (!SvROK(sv)) {
+      *(ptr) = (void *) 0;
+      return SWIG_OK;
+    } else {
+      return SWIG_ERROR;
+    }
+  } else {                            /* Don't know what it is */
+    return SWIG_ERROR;
+  }
+  if (_t) {
+    /* Now see if the types match */
+    char *_c = HvNAME(SvSTASH(SvRV(sv)));
+    tc = SWIG_TypeProxyCheck(_c,_t);
+    if (!tc) {
+      return SWIG_ERROR;
+    }
+    {
+      int newmemory = 0;
+      *ptr = SWIG_TypeCast(tc,voidptr,&newmemory);
+      assert(!newmemory); /* newmemory handling not yet implemented */
+    }
+  } else {
+    *ptr = voidptr;
+  }
+
+  /* 
+   *  DISOWN implementation: we need a perl guru to check this one.
+   */
+  if (tsv && (flags & SWIG_POINTER_DISOWN)) {
+    /* 
+     *  almost copy paste code from below SWIG_POINTER_OWN setting
+     */
+    SV *obj = sv;
+    HV *stash = SvSTASH(SvRV(obj));
+    GV *gv = *(GV**) hv_fetch(stash, "OWNER", 5, TRUE);
+    if (isGV(gv)) {
+      HV *hv = GvHVn(gv);
+      /*
+       * To set ownership (see below), a newSViv(1) entry is added. 
+       * Hence, to remove ownership, we delete the entry.
+       */
+      if (hv_exists_ent(hv, obj, 0)) {
+       hv_delete_ent(hv, obj, 0, 0);
+      }
+    }
+  }
+  return SWIG_OK;
+}
+
+SWIGRUNTIME void
+SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, swig_type_info *t, int flags) {
+  if (ptr && (flags & SWIG_SHADOW)) {
+    SV *self;
+    SV *obj=newSV(0);
+    HV *hash=newHV();
+    HV *stash;
+    sv_setref_pv(obj, (char *) SWIG_Perl_TypeProxyName(t), ptr);
+    stash=SvSTASH(SvRV(obj));
+    if (flags & SWIG_POINTER_OWN) {
+      HV *hv;
+      GV *gv=*(GV**)hv_fetch(stash, "OWNER", 5, TRUE);
+      if (!isGV(gv))
+        gv_init(gv, stash, "OWNER", 5, FALSE);
+      hv=GvHVn(gv);
+      hv_store_ent(hv, obj, newSViv(1), 0);
+    }
+    sv_magic((SV *)hash, (SV *)obj, 'P', Nullch, 0);
+    SvREFCNT_dec(obj);
+    self=newRV_noinc((SV *)hash);
+    sv_setsv(sv, self);
+    SvREFCNT_dec((SV *)self);
+    sv_bless(sv, stash);
+  }
+  else {
+    sv_setref_pv(sv, (char *) SWIG_Perl_TypeProxyName(t), ptr);
+  }
+}
+
+SWIGRUNTIMEINLINE SV *
+SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info *t, int flags) {
+  SV *result = sv_newmortal();
+  SWIG_MakePtr(result, ptr, t, flags);
+  return result;
+}
+
+SWIGRUNTIME void
+SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, int sz, swig_type_info *type) {
+  char result[1024];
+  char *r = result;
+  if ((2*sz + 1 + strlen(SWIG_Perl_TypeProxyName(type))) > 1000) return;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  strcpy(r,SWIG_Perl_TypeProxyName(type));
+  sv_setpv(sv, result);
+}
+
+SWIGRUNTIME SV *
+SWIG_Perl_NewPackedObj(SWIG_MAYBE_PERL_OBJECT void *ptr, int sz, swig_type_info *type) {
+  SV *result = sv_newmortal();
+  SWIG_Perl_MakePackedObj(result, ptr, sz, type);
+  return result;
+}
+
+/* Convert a packed value value */
+SWIGRUNTIME int
+SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty) {
+  swig_cast_info *tc;
+  const char  *c = 0;
+
+  if ((!obj) || (!SvOK(obj))) return SWIG_ERROR;
+  c = SvPV_nolen(obj);
+  /* Pointer values must start with leading underscore */
+  if (*c != '_') return SWIG_ERROR;
+  c++;
+  c = SWIG_UnpackData(c,ptr,sz);
+  if (ty) {
+    tc = SWIG_TypeCheck(c,ty);
+    if (!tc) return SWIG_ERROR;
+  }
+  return SWIG_OK;
+}
+
+
+/* Macros for low-level exception handling */
+#define SWIG_croak(x)    { SWIG_Error(SWIG_RuntimeError, x); SWIG_fail; }
+
+
+typedef XSPROTO(SwigPerlWrapper);
+typedef SwigPerlWrapper *SwigPerlWrapperPtr;
+
+/* Structure for command table */
+typedef struct {
+  const char         *name;
+  SwigPerlWrapperPtr  wrapper;
+} swig_command_info;
+
+/* Information for constant table */
+
+#define SWIG_INT     1
+#define SWIG_FLOAT   2
+#define SWIG_STRING  3
+#define SWIG_POINTER 4
+#define SWIG_BINARY  5
+
+/* Constant information structure */
+typedef struct swig_constant_info {
+    int              type;
+    const char      *name;
+    long             lvalue;
+    double           dvalue;
+    void            *pvalue;
+    swig_type_info **ptype;
+} swig_constant_info;
+
+
+/* Structure for variable table */
+typedef struct {
+  const char   *name;
+  SwigMagicFunc   set;
+  SwigMagicFunc   get;
+  swig_type_info  **type;
+} swig_variable_info;
+
+/* Magic variable code */
+#ifndef PERL_OBJECT
+#define swig_create_magic(s,a,b,c) _swig_create_magic(s,a,b,c)
+  #ifndef MULTIPLICITY
+     SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) 
+  #else
+     SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) 
+  #endif
+#else
+#  define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c)
+SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) 
+#endif
+{
+  MAGIC *mg;
+  sv_magic(sv,sv,'U',(char *) name,strlen(name));
+  mg = mg_find(sv,'U');
+  mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
+  mg->mg_virtual->svt_get = (SwigMagicFunc) get;
+  mg->mg_virtual->svt_set = (SwigMagicFunc) set;
+  mg->mg_virtual->svt_len = 0;
+  mg->mg_virtual->svt_clear = 0;
+  mg->mg_virtual->svt_free = 0;
+}
+
+
+SWIGRUNTIME swig_module_info *
+SWIG_Perl_GetModule(void) {
+  static void *type_pointer = (void *)0;
+  SV *pointer;
+
+  /* first check if pointer already created */
+  if (!type_pointer) {
+    pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI);
+    if (pointer && SvOK(pointer)) {
+      type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
+    }
+  }
+
+  return (swig_module_info *) type_pointer;
+}
+
+SWIGRUNTIME void
+SWIG_Perl_SetModule(swig_module_info *module) {
+  SV *pointer;
+
+  /* create a new pointer */
+  pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI);
+  sv_setiv(pointer, PTR2IV(module));
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/* Workaround perl5 global namespace pollution. Note that undefining library
+ * functions like fopen will not solve the problem on all platforms as fopen
+ * might be a macro on Windows but not necessarily on other operating systems. */
+#ifdef do_open
+  #undef do_open
+#endif
+#ifdef do_close
+  #undef do_close
+#endif
+#ifdef scalar
+  #undef scalar
+#endif
+#ifdef list
+  #undef list
+#endif
+#ifdef apply
+  #undef apply
+#endif
+#ifdef convert
+  #undef convert
+#endif
+#ifdef Error
+  #undef Error
+#endif
+#ifdef form
+  #undef form
+#endif
+#ifdef vform
+  #undef vform
+#endif
+#ifdef LABEL
+  #undef LABEL
+#endif
+#ifdef METHOD
+  #undef METHOD
+#endif
+#ifdef Move
+  #undef Move
+#endif
+#ifdef yylex
+  #undef yylex
+#endif
+#ifdef yyparse
+  #undef yyparse
+#endif
+#ifdef yyerror
+  #undef yyerror
+#endif
+#ifdef invert
+  #undef invert
+#endif
+#ifdef ref
+  #undef ref
+#endif
+#ifdef read
+  #undef read
+#endif
+#ifdef write
+  #undef write
+#endif
+#ifdef eof
+  #undef eof
+#endif
+#ifdef bool
+  #undef bool
+#endif
+#ifdef close
+  #undef close
+#endif
+#ifdef rewind
+  #undef rewind
+#endif
+#ifdef free
+  #undef free
+#endif
+#ifdef malloc
+  #undef malloc
+#endif
+#ifdef calloc
+  #undef calloc
+#endif
+#ifdef Stat
+  #undef Stat
+#endif
+#ifdef check
+  #undef check
+#endif
+#ifdef seekdir
+  #undef seekdir
+#endif
+#ifdef open
+  #undef open
+#endif
+
+
+
+#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
+
+#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else 
+
+
+
+  #define SWIG_exception(code, msg) do { SWIG_Error(code, msg); SWIG_fail;; } while(0) 
+
+
+/* -------- TYPES TABLE (BEGIN) -------- */
+
+#define SWIGTYPE_p_Device swig_types[0]
+#define SWIGTYPE_p_Xfer swig_types[1]
+#define SWIGTYPE_p_XferElement swig_types[2]
+#define SWIGTYPE_p_a_STRMAX__char swig_types[3]
+#define SWIGTYPE_p_amglue_Source swig_types[4]
+#define SWIGTYPE_p_char swig_types[5]
+#define SWIGTYPE_p_double swig_types[6]
+#define SWIGTYPE_p_float swig_types[7]
+#define SWIGTYPE_p_guint32 swig_types[8]
+#define SWIGTYPE_p_guint64 swig_types[9]
+#define SWIGTYPE_p_int swig_types[10]
+#define SWIGTYPE_p_p_XferElement swig_types[11]
+#define SWIGTYPE_p_queue_fd_t swig_types[12]
+#define SWIGTYPE_p_unsigned_char swig_types[13]
+static swig_type_info *swig_types[15];
+static swig_module_info swig_module = {swig_types, 14, 0, 0, 0, 0};
+#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
+#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
+
+/* -------- TYPES TABLE (END) -------- */
+
+#define SWIG_init    boot_Amanda__Xfer
+
+#define SWIG_name   "Amanda::Xferc::boot_Amanda__Xfer"
+#define SWIG_prefix "Amanda::Xferc::"
+
+#define SWIGVERSION 0x010335 
+#define SWIG_VERSION SWIGVERSION
+
+
+#define SWIG_as_voidptr(a) (void *)((const void *)(a)) 
+#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) 
+
+
+#ifdef __cplusplus
+extern "C"
+#endif
+#ifndef PERL_OBJECT
+#ifndef MULTIPLICITY
+SWIGEXPORT void SWIG_init (CV* cv);
+#else
+SWIGEXPORT void SWIG_init (pTHXo_ CV* cv);
+#endif
+#else
+SWIGEXPORT void SWIG_init (CV *cv, CPerlObj *);
+#endif
+
+
+#include "amglue.h"
+
+
+#include "amglue.h"
+
+
+#include "amglue.h"
+
+
+#include "glib-util.h"
+#include "amxfer.h"
+
+
+SWIGINTERNINLINE SV *
+SWIG_From_long  SWIG_PERL_DECL_ARGS_1(long value)
+{    
+  SV *obj = sv_newmortal();
+  sv_setiv(obj, (IV) value);
+  return obj;
+}
+
+
+SWIGINTERNINLINE SV *
+SWIG_From_int  SWIG_PERL_DECL_ARGS_1(int value)
+{    
+  return SWIG_From_long  SWIG_PERL_CALL_ARGS_1(value);
+}
+
+
+/* Return a new SV with refcount 1 representing the given C object
+ * with the given class.
+ *
+ * @param c_obj: the object to represent
+ * @param perl_class: the perl with which to bless and tie the SV
+ */
+static SV *
+new_sv_for_c_obj(
+    gpointer c_obj,
+    const char *perl_class)
+{
+    SV *sv = newSV(0);
+
+    /* Make an SV that contains a pointer to the object, and bless it
+     * with the appropriate class. */
+    sv_setref_pv(sv, perl_class, c_obj);
+
+    return sv;
+}
+
+/* Return a new SV representing a transfer.
+ *
+ * @param xfer: the transfer to represent
+ */
+static SV *
+new_sv_for_xfer(
+    Xfer *xfer)
+{
+    if (!xfer) return &PL_sv_undef;
+
+    xfer_ref(xfer);
+    return new_sv_for_c_obj(xfer, "Amanda::Xfer::Xfer");
+}
+
+/* Return a new SV representing a transfer element.
+ *
+ * @param xe: the transfer element to represent
+ */
+static SV *
+new_sv_for_xfer_element(
+    XferElement *xe)
+{
+    const char *perl_class;
+
+    if (!xe) return &PL_sv_undef;
+
+    perl_class = XFER_ELEMENT_GET_CLASS(xe)->perl_class;
+    if (!perl_class) die("Attempt to wrap an XferElementClass with no perl class!");
+    g_object_ref(xe);
+    return new_sv_for_c_obj(xe, perl_class);
+}
+
+/* Return the C object buried in an SV, asserting that the perl SV is
+ * derived from derived_from.  Returns NULL for undefined perl values.
+ *
+ * This function is based on SWIG's SWIG_Perl_ConvertPtr.  The INT2PTR
+ * situation certainly looks strange, but is documented in perlxs.
+ *
+ * @param sv: the SV to convert
+ * @param derived_from: perl class from which the SV should be derived
+ * @return: underlying pointer
+ */
+static gpointer
+c_obj_from_sv(
+    SV *sv,
+    const char *derived_from)
+{
+    SV *referent;
+    IV tmp;
+
+    if (!sv) return NULL;
+    if (!SvOK(sv)) return NULL;
+
+    /* Peel back the layers.  The sv should be a blessed reference to a PV,
+     * and we check the class against derived_from to ensure we have the right
+     * stuff. */
+    if (!sv_isobject(sv) || !sv_derived_from(sv, derived_from)) {
+       croak("Value is not an object of type %s", derived_from);
+       return NULL;
+    }
+
+    referent = (SV *)SvRV(sv);
+    tmp = SvIV(referent);
+    return INT2PTR(gpointer, tmp);
+}
+
+/* Convert an SV to an Xfer.  The Xfer's reference count is not
+ * incremented -- this is a "borrowed" reference.
+ *
+ * @param sv: the perl value
+ * @returns: pointer to the corresponding transfer, or NULL
+ */
+static Xfer *
+xfer_from_sv(
+    SV *sv)
+{
+    return (Xfer *)c_obj_from_sv(sv, "Amanda::Xfer::Xfer");
+}
+
+/* Convert an SV to an XferElement.  The element's reference count is
+ * not incremented -- this is a "borrowed" reference.
+ *
+ * @param sv: the perl value
+ * @returns: pointer to the corresponding transfer element, or NULL.
+ */
+static XferElement *
+xfer_element_from_sv(
+    SV *sv)
+{
+    return (XferElement *)c_obj_from_sv(sv, "Amanda::Xfer::Element");
+}
+
+/* Given an XMsg, return a hashref representing the message as a pure-perl
+ * object.  The object is new, has refcount 1, and is totally independent of
+ * the underlying XMsg.
+ *
+ * Reflecting the XMsg directly into Perl avoids the need to reference-count
+ * the XMsg objects themselves, which can simply be freed after a callback
+ * completes.  The overhead of creating a hash is likely equivalent to or
+ * less than the overhead that would be consumed with SWIG's swig_$field_get
+ * accessors, assuming that perl code examines most of the fields in a message.
+ *
+ * @param msg: the message to represent
+ * @returns: a perl SV
+ */
+static SV *
+new_sv_for_xmsg(
+    XMsg *msg)
+{
+    static HV *amanda_xfer_msg_stash = NULL;
+    HV *hash = newHV();
+    SV *rv = newRV_noinc((SV *)hash);
+
+    /* bless the rv as an Amanda::Xfer::Msg object */
+    if (!amanda_xfer_msg_stash) {
+       amanda_xfer_msg_stash = gv_stashpv("Amanda::Xfer::Msg", GV_ADD);
+    }
+    sv_bless(rv, amanda_xfer_msg_stash);
+
+    /* TODO: consider optimizing by precomputing the hash values of
+     * the keys? */
+
+    /* elt */
+    hv_store(hash, "elt", 3, new_sv_for_xfer_element(msg->elt), 0);
+
+    /* type */
+    hv_store(hash, "type", 4, newSViv(msg->type), 0);
+
+    /* type */
+    hv_store(hash, "version", 7, newSViv(msg->version), 0);
+
+    /* message */
+    if (msg->message)
+       hv_store(hash, "message", 7, newSVpv(msg->message, 0), 0);
+
+    return rv;
+}
+
+
+#include <limits.h>
+#if !defined(SWIG_NO_LLONG_MAX)
+# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
+#   define LLONG_MAX __LONG_LONG_MAX__
+#   define LLONG_MIN (-LLONG_MAX - 1LL)
+#   define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
+# endif
+#endif
+
+
+SWIGINTERN int
+SWIG_AsVal_double SWIG_PERL_DECL_ARGS_2(SV *obj, double *val)
+{
+  if (SvNIOK(obj)) {
+    if (val) *val = SvNV(obj);
+    return SWIG_OK;
+  } else if (SvIOK(obj)) {
+    if (val) *val = (double) SvIV(obj);
+    return SWIG_AddCast(SWIG_OK);
+  } else {
+    const char *nptr = SvPV_nolen(obj);
+    if (nptr) {
+      char *endptr;
+      double v = strtod(nptr, &endptr);
+      if (errno == ERANGE) {
+       errno = 0;
+       return SWIG_OverflowError;
+      } else {
+       if (*endptr == '\0') {
+         if (val) *val = v;
+         return SWIG_Str2NumCast(SWIG_OK);
+       }
+      }
+    }
+  }
+  return SWIG_TypeError;
+}
+
+
+#include <float.h>
+
+
+#include <math.h>
+
+
+SWIGINTERNINLINE int
+SWIG_CanCastAsInteger(double *d, double min, double max) {
+  double x = *d;
+  if ((min <= x && x <= max)) {
+   double fx = floor(x);
+   double cx = ceil(x);
+   double rd =  ((x - fx) < 0.5) ? fx : cx; /* simple rint */
+   if ((errno == EDOM) || (errno == ERANGE)) {
+     errno = 0;
+   } else {
+     double summ, reps, diff;
+     if (rd < x) {
+       diff = x - rd;
+     } else if (rd > x) {
+       diff = rd - x;
+     } else {
+       return 1;
+     }
+     summ = rd + x;
+     reps = diff/summ;
+     if (reps < 8*DBL_EPSILON) {
+       *d = rd;
+       return 1;
+     }
+   }
+  }
+  return 0;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_unsigned_SS_long SWIG_PERL_DECL_ARGS_2(SV *obj, unsigned long *val) 
+{
+  if (SvUOK(obj)) {
+    if (val) *val = SvUV(obj);
+    return SWIG_OK;
+  } else  if (SvIOK(obj)) {
+    long v = SvIV(obj);
+    if (v >= 0) {
+      if (val) *val = v;
+      return SWIG_OK;
+    } else {
+      return SWIG_OverflowError;
+    }
+  } else {
+    int dispatch = 0;
+    const char *nptr = SvPV_nolen(obj);
+    if (nptr) {
+      char *endptr;
+      unsigned long v;
+      errno = 0;
+      v = strtoul(nptr, &endptr,0);
+      if (errno == ERANGE) {
+       errno = 0;
+       return SWIG_OverflowError;
+      } else {
+       if (*endptr == '\0') {
+         if (val) *val = v;
+         return SWIG_Str2NumCast(SWIG_OK);
+       }
+      }
+    }
+    if (!dispatch) {
+      double d;
+      int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj,&d));
+      if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) {
+       if (val) *val = (unsigned long)(d);
+       return res;
+      }
+    }
+  }
+  return SWIG_TypeError;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_unsigned_SS_int SWIG_PERL_DECL_ARGS_2(SV * obj, unsigned int *val)
+{
+  unsigned long v;
+  int res = SWIG_AsVal_unsigned_SS_long SWIG_PERL_CALL_ARGS_2(obj, &v);
+  if (SWIG_IsOK(res)) {
+    if ((v > UINT_MAX)) {
+      return SWIG_OverflowError;
+    } else {
+      if (val) *val = (unsigned int)(v);
+    }
+  }  
+  return res;
+}
+
+
+SWIGINTERNINLINE SV *
+SWIG_FromCharPtrAndSize(const char* carray, size_t size)
+{
+  SV *obj = sv_newmortal();
+  if (carray) {
+    sv_setpvn(obj, carray, size);
+  } else {
+    sv_setsv(obj, &PL_sv_undef);
+  }
+  return obj;
+}
+
+
+SWIGINTERNINLINE SV * 
+SWIG_FromCharPtr(const char *cptr)
+{ 
+  return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
+}
+
+
+/* SWIG wants to treat this as a function */
+#define xfer_get_status(xfer) ((xfer)->status)
+
+
+SWIGINTERNINLINE int
+SWIG_AsVal_size_t SWIG_PERL_DECL_ARGS_2(SV * obj, size_t *val)
+{
+  unsigned long v;
+  int res = SWIG_AsVal_unsigned_SS_long SWIG_PERL_CALL_ARGS_2(obj, val ? &v : 0);
+  if (SWIG_IsOK(res) && val) *val = (size_t)(v);
+  return res;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_long SWIG_PERL_DECL_ARGS_2(SV *obj, long* val)
+{
+  if (SvIOK(obj)) {
+    if (val) *val = SvIV(obj);
+    return SWIG_OK;
+  } else {
+    int dispatch = 0;
+    const char *nptr = SvPV_nolen(obj);
+    if (nptr) {
+      char *endptr;
+      long v;
+      errno = 0;
+      v = strtol(nptr, &endptr,0);
+      if (errno == ERANGE) {
+       errno = 0;
+       return SWIG_OverflowError;
+      } else {
+       if (*endptr == '\0') {
+         if (val) *val = v;
+         return SWIG_Str2NumCast(SWIG_OK);
+       }
+      }
+    }
+    if (!dispatch) {
+      double d;
+      int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj,&d));
+      if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
+       if (val) *val = (long)(d);
+       return res;
+      }
+    }
+  }
+  return SWIG_TypeError;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_int SWIG_PERL_DECL_ARGS_2(SV * obj, int *val)
+{
+  long v;
+  int res = SWIG_AsVal_long SWIG_PERL_CALL_ARGS_2(obj, &v);
+  if (SWIG_IsOK(res)) {
+    if ((v < INT_MIN || v > INT_MAX)) {
+      return SWIG_OverflowError;
+    } else {
+      if (val) *val = (int)(v);
+    }
+  }  
+  return res;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_unsigned_SS_char SWIG_PERL_DECL_ARGS_2(SV * obj, unsigned char *val)
+{
+  unsigned long v;
+  int res = SWIG_AsVal_unsigned_SS_long SWIG_PERL_CALL_ARGS_2(obj, &v);
+  if (SWIG_IsOK(res)) {
+    if ((v > UCHAR_MAX)) {
+      return SWIG_OverflowError;
+    } else {
+      if (val) *val = (unsigned char)(v);
+    }
+  }  
+  return res;
+}
+
+
+static gboolean
+xmsgsource_perl_callback(
+    gpointer data,
+    struct XMsg *msg,
+    Xfer *xfer)
+{
+    dSP;
+    amglue_Source *src = (amglue_Source *)data;
+    SV *src_sv = NULL;
+
+    g_assert(src->callback_sv != NULL);
+
+    ENTER;
+    SAVETMPS;
+
+    /* create a new SV pointing to 'src', and increase its refcount
+     * accordingly.  The SV is mortal, so FREETMPS will decrease the 
+     * refcount, unless the callee keeps a copy of it somewhere */
+    amglue_source_ref(src);
+    src_sv = SWIG_NewPointerObj(src, SWIGTYPE_p_amglue_Source,
+                                SWIG_OWNER | SWIG_SHADOW);
+
+    PUSHMARK(SP);
+    XPUSHs(src_sv);
+    XPUSHs(sv_2mortal(new_sv_for_xmsg(msg)));
+    XPUSHs(sv_2mortal(new_sv_for_xfer(xfer)));
+    PUTBACK;
+
+    call_sv(src->callback_sv, G_EVAL|G_DISCARD);
+
+    FREETMPS;
+    LEAVE;
+
+    /* these may have been freed, so don't use them after this point */
+    src_sv = NULL;
+    src = NULL;
+
+    /* check for an uncaught 'die'.  If we don't do this, then Perl will longjmp()
+     * over the GMainLoop mechanics, leaving GMainLoop in an inconsistent (locked)
+     * state. */
+    if (SvTRUE(ERRSV)) {
+       /* We handle this just the way the default 'die' handler in Amanda::Debug 
+        * does, but since Amanda's debug support may not yet be running, we back
+        * it up with an exit() */
+       g_critical("%s", SvPV_nolen(ERRSV));
+       exit(1);
+    }
+
+    return TRUE;
+}
+
+
+amglue_Source *
+xfer_get_amglue_source(
+    Xfer *xfer)
+{
+    return amglue_source_get(xfer_get_source(xfer),
+       (GSourceFunc)xmsgsource_perl_callback);
+}
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef PERL_OBJECT
+#define MAGIC_CLASS _wrap_Amanda::Xfer_var::
+class _wrap_Amanda::Xfer_var : public CPerlObj {
+public:
+#else
+#define MAGIC_CLASS
+#endif
+SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *SWIGUNUSEDPARM(sv), MAGIC *SWIGUNUSEDPARM(mg)) {
+    MAGIC_PPERL
+    croak("Value is read-only.");
+    return 0;
+}
+
+
+#ifdef PERL_OBJECT
+};
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+XS(_wrap_xfer_new) {
+  {
+    XferElement **arg1 = (XferElement **) 0 ;
+    unsigned int arg2 ;
+    Xfer *result = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: xfer_new(elementlist,nelements);");
+    }
+    {
+      AV *av;
+      unsigned int i;
+      
+      /* check that it's an arrayref */
+      if (!SvROK(ST(0)) || SvTYPE(SvRV(ST(0))) != SVt_PVAV) {
+        SWIG_exception(SWIG_TypeError, "Expected an arrayref");
+      }
+      av = (AV *)SvRV(ST(0));
+      
+      /* allocate memory for arg1 */
+      arg2 = av_len(av)+1; /* av_len(av) is like $#av */
+      arg1 = g_new(XferElement *, arg2);
+      
+      /* extract the underlying XferElement objects and add pointers to
+           * them, "borrowing" the caller's references for the moment. */
+      for (i = 0; i < arg2; i++) {
+        SV **sv = av_fetch(av, i, 0);
+        XferElement *elt = sv? xfer_element_from_sv(*sv):NULL;
+        
+        if (!elt) {
+          SWIG_exception(SWIG_TypeError, "Expected an arrayref of Amanda::Xfer::Element objects");
+        }
+        arg1[i] = elt;
+      }
+    }
+    result = (Xfer *)xfer_new(arg1,arg2);
+    {
+      ST(argvi) = sv_2mortal(new_sv_for_xfer(result));
+      argvi++;
+    }
+    {
+      /* free the element vector allocated in the (in) typemap */
+      g_free(arg1);
+    }
+    {
+      xfer_unref(result);
+    }
+    XSRETURN(argvi);
+  fail:
+    {
+      /* free the element vector allocated in the (in) typemap */
+      g_free(arg1);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_xfer_unref) {
+  {
+    Xfer *arg1 = (Xfer *) 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: xfer_unref(Xfer *);");
+    }
+    {
+      arg1 = xfer_from_sv(ST(0));
+    }
+    xfer_unref(arg1);
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_xfer_get_status) {
+  {
+    Xfer *arg1 = (Xfer *) 0 ;
+    xfer_status result;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: xfer_get_status(xfer);");
+    }
+    {
+      arg1 = xfer_from_sv(ST(0));
+    }
+    result = (xfer_status)xfer_get_status(arg1);
+    {
+      ST(argvi) = sv_2mortal(amglue_newSVi64(result));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_xfer_repr) {
+  {
+    Xfer *arg1 = (Xfer *) 0 ;
+    char *result = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: xfer_repr(xfer);");
+    }
+    {
+      arg1 = xfer_from_sv(ST(0));
+    }
+    result = (char *)xfer_repr(arg1);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_xfer_start) {
+  {
+    Xfer *arg1 = (Xfer *) 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: xfer_start(xfer);");
+    }
+    {
+      arg1 = xfer_from_sv(ST(0));
+    }
+    xfer_start(arg1);
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_xfer_cancel) {
+  {
+    Xfer *arg1 = (Xfer *) 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: xfer_cancel(xfer);");
+    }
+    {
+      arg1 = xfer_from_sv(ST(0));
+    }
+    xfer_cancel(arg1);
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_xfer_element_unref) {
+  {
+    XferElement *arg1 = (XferElement *) 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: xfer_element_unref(elt);");
+    }
+    {
+      arg1 = xfer_element_from_sv(ST(0));
+    }
+    xfer_element_unref(arg1);
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_xfer_element_repr) {
+  {
+    XferElement *arg1 = (XferElement *) 0 ;
+    char *result = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: xfer_element_repr(elt);");
+    }
+    {
+      arg1 = xfer_element_from_sv(ST(0));
+    }
+    result = (char *)xfer_element_repr(arg1);
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_xfer_source_device) {
+  {
+    Device *arg1 = (Device *) 0 ;
+    XferElement *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: xfer_source_device(device);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "xfer_source_device" "', argument " "1"" of type '" "Device *""'"); 
+    }
+    arg1 = (Device *)(argp1);
+    result = (XferElement *)xfer_source_device(arg1);
+    {
+      ST(argvi) = sv_2mortal(new_sv_for_xfer_element(result));
+      argvi++;
+    }
+    
+    {
+      xfer_element_unref(result);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_xfer_source_random) {
+  {
+    guint64 arg1 ;
+    guint32 arg2 ;
+    XferElement *result = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: xfer_source_random(length,seed);");
+    }
+    {
+      arg1 = amglue_SvU64(ST(0));
+    }
+    {
+      arg2 = amglue_SvU32(ST(1));
+    }
+    result = (XferElement *)xfer_source_random(arg1,arg2);
+    {
+      ST(argvi) = sv_2mortal(new_sv_for_xfer_element(result));
+      argvi++;
+    }
+    {
+      xfer_element_unref(result);
+    }
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_xfer_source_pattern) {
+  {
+    guint64 arg1 ;
+    void *arg2 = (void *) 0 ;
+    size_t arg3 ;
+    XferElement *result = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: xfer_source_pattern(length,pattern,pattern_length);");
+    }
+    {
+      arg1 = amglue_SvU64(ST(0));
+    }
+    {
+      size_t len;
+      char * pat;
+      
+      pat = SvPV(ST(1), len);
+      arg2 = g_memdup(pat, len);
+      arg3 = len;
+    }
+    result = (XferElement *)xfer_source_pattern(arg1,arg2,arg3);
+    {
+      ST(argvi) = sv_2mortal(new_sv_for_xfer_element(result));
+      argvi++;
+    }
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_xfer_source_fd) {
+  {
+    int arg1 ;
+    XferElement *result = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: xfer_source_fd(fd);");
+    }
+    {
+      if (sizeof(signed int) == 1) {
+        arg1 = amglue_SvI8(ST(0));
+      } else if (sizeof(signed int) == 2) {
+        arg1 = amglue_SvI16(ST(0));
+      } else if (sizeof(signed int) == 4) {
+        arg1 = amglue_SvI32(ST(0));
+      } else if (sizeof(signed int) == 8) {
+        arg1 = amglue_SvI64(ST(0));
+      } else {
+        g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
+      }
+    }
+    result = (XferElement *)xfer_source_fd(arg1);
+    {
+      ST(argvi) = sv_2mortal(new_sv_for_xfer_element(result));
+      argvi++;
+    }
+    
+    {
+      xfer_element_unref(result);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_xfer_filter_xor) {
+  {
+    unsigned char arg1 ;
+    XferElement *result = 0 ;
+    unsigned char val1 ;
+    int ecode1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: xfer_filter_xor(xor_key);");
+    }
+    ecode1 = SWIG_AsVal_unsigned_SS_char SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "xfer_filter_xor" "', argument " "1"" of type '" "unsigned char""'");
+    } 
+    arg1 = (unsigned char)(val1);
+    result = (XferElement *)xfer_filter_xor(arg1);
+    {
+      ST(argvi) = sv_2mortal(new_sv_for_xfer_element(result));
+      argvi++;
+    }
+    
+    {
+      xfer_element_unref(result);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_xfer_dest_device) {
+  {
+    Device *arg1 = (Device *) 0 ;
+    size_t arg2 ;
+    XferElement *result = 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: xfer_dest_device(device,max_memory);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Device, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "xfer_dest_device" "', argument " "1"" of type '" "Device *""'"); 
+    }
+    arg1 = (Device *)(argp1);
+    {
+      if (sizeof(size_t) == 1) {
+        arg2 = amglue_SvU8(ST(1));
+      } else if (sizeof(size_t) == 2) {
+        arg2 = amglue_SvU16(ST(1));
+      } else if (sizeof(size_t) == 4) {
+        arg2 = amglue_SvU32(ST(1));
+      } else if (sizeof(size_t) == 8) {
+        arg2 = amglue_SvU64(ST(1));
+      } else {
+        croak("Unexpected size_t >64 bits?"); /* should be optimized out unless sizeof(size_t) > 8 */
+      }
+    }
+    result = (XferElement *)xfer_dest_device(arg1,arg2);
+    {
+      ST(argvi) = sv_2mortal(new_sv_for_xfer_element(result));
+      argvi++;
+    }
+    
+    
+    {
+      xfer_element_unref(result);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_xfer_dest_null) {
+  {
+    guint32 arg1 ;
+    XferElement *result = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: xfer_dest_null(prng_seed);");
+    }
+    {
+      arg1 = amglue_SvU32(ST(0));
+    }
+    result = (XferElement *)xfer_dest_null(arg1);
+    {
+      ST(argvi) = sv_2mortal(new_sv_for_xfer_element(result));
+      argvi++;
+    }
+    {
+      xfer_element_unref(result);
+    }
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_xfer_dest_fd) {
+  {
+    int arg1 ;
+    XferElement *result = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: xfer_dest_fd(fd);");
+    }
+    {
+      if (sizeof(signed int) == 1) {
+        arg1 = amglue_SvI8(ST(0));
+      } else if (sizeof(signed int) == 2) {
+        arg1 = amglue_SvI16(ST(0));
+      } else if (sizeof(signed int) == 4) {
+        arg1 = amglue_SvI32(ST(0));
+      } else if (sizeof(signed int) == 8) {
+        arg1 = amglue_SvI64(ST(0));
+      } else {
+        g_critical("Unexpected signed int >64 bits?"); /* should be optimized out unless sizeof(signed int) > 8 */
+      }
+    }
+    result = (XferElement *)xfer_dest_fd(arg1);
+    {
+      ST(argvi) = sv_2mortal(new_sv_for_xfer_element(result));
+      argvi++;
+    }
+    
+    {
+      xfer_element_unref(result);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_xfer_get_amglue_source) {
+  {
+    Xfer *arg1 = (Xfer *) 0 ;
+    amglue_Source *result = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: xfer_get_amglue_source(xfer);");
+    }
+    {
+      arg1 = xfer_from_sv(ST(0));
+    }
+    result = (amglue_Source *)xfer_get_amglue_source(arg1);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_amglue_Source, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
+
+static swig_type_info _swigt__p_Device = {"_p_Device", "struct Device *|Device *", 0, 0, (void*)"Amanda::Device::Device", 0};
+static swig_type_info _swigt__p_Xfer = {"_p_Xfer", "Xfer *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_XferElement = {"_p_XferElement", "XferElement *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_a_STRMAX__char = {"_p_a_STRMAX__char", "char (*)[STRMAX]|string_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_amglue_Source = {"_p_amglue_Source", "struct amglue_Source *|amglue_Source *", 0, 0, (void*)"Amanda::MainLoop::Source", 0};
+static swig_type_info _swigt__p_char = {"_p_char", "gchar *|char *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_double = {"_p_double", "double *|gdouble *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_float = {"_p_float", "float *|gfloat *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_guint32 = {"_p_guint32", "guint32 *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_guint64 = {"_p_guint64", "guint64 *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_int = {"_p_int", "SizeAccuracy *|xmsg_type *|int *|DeviceAccessMode *|MediaAccessMode *|ConcurrencyParadigm *|filetype_t *|gboolean *|GIOCondition *|PropertySource *|DeviceStatusFlags *|PropertyAccessFlags *|PropertyPhaseFlags *|xfer_status *|PropertySurety *|StreamingRequirement *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_p_XferElement = {"_p_p_XferElement", "XferElement **", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_queue_fd_t = {"_p_queue_fd_t", "struct queue_fd_t *|queue_fd_t *", 0, 0, (void*)"Amanda::Device::queue_fd_t", 0};
+static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "guchar *|unsigned char *", 0, 0, (void*)0, 0};
+
+static swig_type_info *swig_type_initial[] = {
+  &_swigt__p_Device,
+  &_swigt__p_Xfer,
+  &_swigt__p_XferElement,
+  &_swigt__p_a_STRMAX__char,
+  &_swigt__p_amglue_Source,
+  &_swigt__p_char,
+  &_swigt__p_double,
+  &_swigt__p_float,
+  &_swigt__p_guint32,
+  &_swigt__p_guint64,
+  &_swigt__p_int,
+  &_swigt__p_p_XferElement,
+  &_swigt__p_queue_fd_t,
+  &_swigt__p_unsigned_char,
+};
+
+static swig_cast_info _swigc__p_Device[] = {  {&_swigt__p_Device, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_Xfer[] = {  {&_swigt__p_Xfer, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_XferElement[] = {  {&_swigt__p_XferElement, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_a_STRMAX__char[] = {  {&_swigt__p_a_STRMAX__char, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_amglue_Source[] = {  {&_swigt__p_amglue_Source, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_double[] = {  {&_swigt__p_double, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_float[] = {  {&_swigt__p_float, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_guint32[] = {  {&_swigt__p_guint32, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_guint64[] = {  {&_swigt__p_guint64, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_int[] = {  {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_p_XferElement[] = {  {&_swigt__p_p_XferElement, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_queue_fd_t[] = {  {&_swigt__p_queue_fd_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_unsigned_char[] = {  {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
+
+static swig_cast_info *swig_cast_initial[] = {
+  _swigc__p_Device,
+  _swigc__p_Xfer,
+  _swigc__p_XferElement,
+  _swigc__p_a_STRMAX__char,
+  _swigc__p_amglue_Source,
+  _swigc__p_char,
+  _swigc__p_double,
+  _swigc__p_float,
+  _swigc__p_guint32,
+  _swigc__p_guint64,
+  _swigc__p_int,
+  _swigc__p_p_XferElement,
+  _swigc__p_queue_fd_t,
+  _swigc__p_unsigned_char,
+};
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
+
+static swig_constant_info swig_constants[] = {
+{0,0,0,0,0,0}
+};
+#ifdef __cplusplus
+}
+#endif
+static swig_variable_info swig_variables[] = {
+{0,0,0,0}
+};
+static swig_command_info swig_commands[] = {
+{"Amanda::Xferc::xfer_new", _wrap_xfer_new},
+{"Amanda::Xferc::xfer_unref", _wrap_xfer_unref},
+{"Amanda::Xferc::xfer_get_status", _wrap_xfer_get_status},
+{"Amanda::Xferc::xfer_repr", _wrap_xfer_repr},
+{"Amanda::Xferc::xfer_start", _wrap_xfer_start},
+{"Amanda::Xferc::xfer_cancel", _wrap_xfer_cancel},
+{"Amanda::Xferc::xfer_element_unref", _wrap_xfer_element_unref},
+{"Amanda::Xferc::xfer_element_repr", _wrap_xfer_element_repr},
+{"Amanda::Xferc::xfer_source_device", _wrap_xfer_source_device},
+{"Amanda::Xferc::xfer_source_random", _wrap_xfer_source_random},
+{"Amanda::Xferc::xfer_source_pattern", _wrap_xfer_source_pattern},
+{"Amanda::Xferc::xfer_source_fd", _wrap_xfer_source_fd},
+{"Amanda::Xferc::xfer_filter_xor", _wrap_xfer_filter_xor},
+{"Amanda::Xferc::xfer_dest_device", _wrap_xfer_dest_device},
+{"Amanda::Xferc::xfer_dest_null", _wrap_xfer_dest_null},
+{"Amanda::Xferc::xfer_dest_fd", _wrap_xfer_dest_fd},
+{"Amanda::Xferc::xfer_get_amglue_source", _wrap_xfer_get_amglue_source},
+{0,0}
+};
+/* -----------------------------------------------------------------------------
+ * Type initialization:
+ * This problem is tough by the requirement that no dynamic 
+ * memory is used. Also, since swig_type_info structures store pointers to 
+ * swig_cast_info structures and swig_cast_info structures store pointers back
+ * to swig_type_info structures, we need some lookup code at initialization. 
+ * The idea is that swig generates all the structures that are needed. 
+ * The runtime then collects these partially filled structures. 
+ * The SWIG_InitializeModule function takes these initial arrays out of 
+ * swig_module, and does all the lookup, filling in the swig_module.types
+ * array with the correct data and linking the correct swig_cast_info
+ * structures together.
+ *
+ * The generated swig_type_info structures are assigned staticly to an initial 
+ * array. We just loop through that array, and handle each type individually.
+ * First we lookup if this type has been already loaded, and if so, use the
+ * loaded structure instead of the generated one. Then we have to fill in the
+ * cast linked list. The cast data is initially stored in something like a
+ * two-dimensional array. Each row corresponds to a type (there are the same
+ * number of rows as there are in the swig_type_initial array). Each entry in
+ * a column is one of the swig_cast_info structures for that type.
+ * The cast_initial array is actually an array of arrays, because each row has
+ * a variable number of columns. So to actually build the cast linked list,
+ * we find the array of casts associated with the type, and loop through it 
+ * adding the casts to the list. The one last trick we need to do is making
+ * sure the type pointer in the swig_cast_info struct is correct.
+ *
+ * First off, we lookup the cast->type name to see if it is already loaded. 
+ * There are three cases to handle:
+ *  1) If the cast->type has already been loaded AND the type we are adding
+ *     casting info to has not been loaded (it is in this module), THEN we
+ *     replace the cast->type pointer with the type pointer that has already
+ *     been loaded.
+ *  2) If BOTH types (the one we are adding casting info to, and the 
+ *     cast->type) are loaded, THEN the cast info has already been loaded by
+ *     the previous module so we just ignore it.
+ *  3) Finally, if cast->type has not already been loaded, then we add that
+ *     swig_cast_info to the linked list (because the cast->type) pointer will
+ *     be correct.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#if 0
+} /* c-mode */
+#endif
+#endif
+
+#if 0
+#define SWIGRUNTIME_DEBUG
+#endif
+
+
+SWIGRUNTIME void
+SWIG_InitializeModule(void *clientdata) {
+  size_t i;
+  swig_module_info *module_head, *iter;
+  int found, init;
+  
+  clientdata = clientdata;
+  
+  /* check to see if the circular list has been setup, if not, set it up */
+  if (swig_module.next==0) {
+    /* Initialize the swig_module */
+    swig_module.type_initial = swig_type_initial;
+    swig_module.cast_initial = swig_cast_initial;
+    swig_module.next = &swig_module;
+    init = 1;
+  } else {
+    init = 0;
+  }
+  
+  /* Try and load any already created modules */
+  module_head = SWIG_GetModule(clientdata);
+  if (!module_head) {
+    /* This is the first module loaded for this interpreter */
+    /* so set the swig module into the interpreter */
+    SWIG_SetModule(clientdata, &swig_module);
+    module_head = &swig_module;
+  } else {
+    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
+    found=0;
+    iter=module_head;
+    do {
+      if (iter==&swig_module) {
+        found=1;
+        break;
+      }
+      iter=iter->next;
+    } while (iter!= module_head);
+    
+    /* if the is found in the list, then all is done and we may leave */
+    if (found) return;
+    /* otherwise we must add out module into the list */
+    swig_module.next = module_head->next;
+    module_head->next = &swig_module;
+  }
+  
+  /* When multiple interpeters are used, a module could have already been initialized in
+       a different interpreter, but not yet have a pointer in this interpreter.
+       In this case, we do not want to continue adding types... everything should be
+       set up already */
+  if (init == 0) return;
+  
+  /* Now work on filling in swig_module.types */
+#ifdef SWIGRUNTIME_DEBUG
+  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
+#endif
+  for (i = 0; i < swig_module.size; ++i) {
+    swig_type_info *type = 0;
+    swig_type_info *ret;
+    swig_cast_info *cast;
+    
+#ifdef SWIGRUNTIME_DEBUG
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+#endif
+    
+    /* if there is another module already loaded */
+    if (swig_module.next != &swig_module) {
+      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
+    }
+    if (type) {
+      /* Overwrite clientdata field */
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: found type %s\n", type->name);
+#endif
+      if (swig_module.type_initial[i]->clientdata) {
+        type->clientdata = swig_module.type_initial[i]->clientdata;
+#ifdef SWIGRUNTIME_DEBUG
+        printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
+#endif
+      }
+    } else {
+      type = swig_module.type_initial[i];
+    }
+    
+    /* Insert casting types */
+    cast = swig_module.cast_initial[i];
+    while (cast->type) {
+      /* Don't need to add information already in the list */
+      ret = 0;
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
+#endif
+      if (swig_module.next != &swig_module) {
+        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
+#ifdef SWIGRUNTIME_DEBUG
+        if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
+#endif
+      }
+      if (ret) {
+        if (type == swig_module.type_initial[i]) {
+#ifdef SWIGRUNTIME_DEBUG
+          printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
+#endif
+          cast->type = ret;
+          ret = 0;
+        } else {
+          /* Check for casting already in the list */
+          swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
+#ifdef SWIGRUNTIME_DEBUG
+          if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
+#endif
+          if (!ocast) ret = 0;
+        }
+      }
+      
+      if (!ret) {
+#ifdef SWIGRUNTIME_DEBUG
+        printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
+#endif
+        if (type->cast) {
+          type->cast->prev = cast;
+          cast->next = type->cast;
+        }
+        type->cast = cast;
+      }
+      cast++;
+    }
+    /* Set entry in modules->types array equal to the type */
+    swig_module.types[i] = type;
+  }
+  swig_module.types[i] = 0;
+  
+#ifdef SWIGRUNTIME_DEBUG
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+  for (i = 0; i < swig_module.size; ++i) {
+    int j = 0;
+    swig_cast_info *cast = swig_module.cast_initial[i];
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+    while (cast->type) {
+      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
+      cast++;
+      ++j;
+    }
+    printf("---- Total casts: %d\n",j);
+  }
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+#endif
+}
+
+/* This function will propagate the clientdata field of type to
+* any new swig_type_info structures that have been added into the list
+* of equivalent types.  It is like calling
+* SWIG_TypeClientData(type, clientdata) a second time.
+*/
+SWIGRUNTIME void
+SWIG_PropagateClientData(void) {
+  size_t i;
+  swig_cast_info *equiv;
+  static int init_run = 0;
+  
+  if (init_run) return;
+  init_run = 1;
+  
+  for (i = 0; i < swig_module.size; i++) {
+    if (swig_module.types[i]->clientdata) {
+      equiv = swig_module.types[i]->cast;
+      while (equiv) {
+        if (!equiv->converter) {
+          if (equiv->type && !equiv->type->clientdata)
+          SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
+        }
+        equiv = equiv->next;
+      }
+    }
+  }
+}
+
+#ifdef __cplusplus
+#if 0
+{
+  /* c-mode */
+#endif
+}
+#endif
+
+
+
+#ifdef __cplusplus
+extern "C"
+#endif
+
+XS(SWIG_init) {
+  dXSARGS;
+  int i;
+  
+  SWIG_InitializeModule(0);
+  
+  /* Install commands */
+  for (i = 0; swig_commands[i].name; i++) {
+    newXS((char*) swig_commands[i].name,swig_commands[i].wrapper, (char*)__FILE__);
+  }
+  
+  /* Install variables */
+  for (i = 0; swig_variables[i].name; i++) {
+    SV *sv;
+    sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI);
+    if (swig_variables[i].type) {
+      SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0);
+    } else {
+      sv_setiv(sv,(IV) 0);
+    }
+    swig_create_magic(sv, (char *) swig_variables[i].name, swig_variables[i].set, swig_variables[i].get); 
+  }
+  
+  /* Install constant */
+  for (i = 0; swig_constants[i].type; i++) {
+    SV *sv;
+    sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI);
+    switch(swig_constants[i].type) {
+    case SWIG_INT:
+      sv_setiv(sv, (IV) swig_constants[i].lvalue);
+      break;
+    case SWIG_FLOAT:
+      sv_setnv(sv, (double) swig_constants[i].dvalue);
+      break;
+    case SWIG_STRING:
+      sv_setpv(sv, (char *) swig_constants[i].pvalue);
+      break;
+    case SWIG_POINTER:
+      SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype),0);
+      break;
+    case SWIG_BINARY:
+      SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype));
+      break;
+    default:
+      break;
+    }
+    SvREADONLY_on(sv);
+  }
+  
+  
+  /* We need GType and GThread initialized to use xfers */
+  glib_init();
+  
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "XFER_INIT", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(XFER_INIT)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "XFER_START", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(XFER_START)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "XFER_RUNNING", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(XFER_RUNNING)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "XFER_DONE", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(XFER_DONE)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "XMSG_INFO", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(XMSG_INFO)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "XMSG_ERROR", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(XMSG_ERROR)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "XMSG_DONE", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(XMSG_DONE)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "XMSG_CANCEL", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(XMSG_CANCEL)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  ST(0) = &PL_sv_yes;
+  XSRETURN(1);
+}
+
diff --git a/perl/Amanda/Xfer.pm b/perl/Amanda/Xfer.pm
new file mode 100644 (file)
index 0000000..46ce196
--- /dev/null
@@ -0,0 +1,521 @@
+# This file was automatically generated by SWIG (http://www.swig.org).
+# Version 1.3.35
+#
+# Don't modify this file, modify the SWIG interface instead.
+
+package Amanda::Xfer;
+require Exporter;
+require DynaLoader;
+@ISA = qw(Exporter DynaLoader);
+require Amanda::MainLoop;
+require Amanda::Device;
+require Amanda::Types;
+package Amanda::Xferc;
+bootstrap Amanda::Xfer;
+package Amanda::Xfer;
+@EXPORT = qw( );
+
+# ---------- BASE METHODS -------------
+
+package Amanda::Xfer;
+
+sub TIEHASH {
+    my ($classname,$obj) = @_;
+    return bless $obj, $classname;
+}
+
+sub CLEAR { }
+
+sub FIRSTKEY { }
+
+sub NEXTKEY { }
+
+sub FETCH {
+    my ($self,$field) = @_;
+    my $member_func = "swig_${field}_get";
+    $self->$member_func();
+}
+
+sub STORE {
+    my ($self,$field,$newval) = @_;
+    my $member_func = "swig_${field}_set";
+    $self->$member_func($newval);
+}
+
+sub this {
+    my $ptr = shift;
+    return tied(%$ptr);
+}
+
+
+# ------- FUNCTION WRAPPERS --------
+
+package Amanda::Xfer;
+
+*xfer_new = *Amanda::Xferc::xfer_new;
+*xfer_unref = *Amanda::Xferc::xfer_unref;
+*xfer_get_status = *Amanda::Xferc::xfer_get_status;
+*xfer_repr = *Amanda::Xferc::xfer_repr;
+*xfer_start = *Amanda::Xferc::xfer_start;
+*xfer_cancel = *Amanda::Xferc::xfer_cancel;
+*xfer_element_unref = *Amanda::Xferc::xfer_element_unref;
+*xfer_element_repr = *Amanda::Xferc::xfer_element_repr;
+*xfer_source_device = *Amanda::Xferc::xfer_source_device;
+*xfer_source_random = *Amanda::Xferc::xfer_source_random;
+*xfer_source_pattern = *Amanda::Xferc::xfer_source_pattern;
+*xfer_source_fd = *Amanda::Xferc::xfer_source_fd;
+*xfer_filter_xor = *Amanda::Xferc::xfer_filter_xor;
+*xfer_dest_device = *Amanda::Xferc::xfer_dest_device;
+*xfer_dest_null = *Amanda::Xferc::xfer_dest_null;
+*xfer_dest_fd = *Amanda::Xferc::xfer_dest_fd;
+*xfer_get_amglue_source = *Amanda::Xferc::xfer_get_amglue_source;
+
+# ------- VARIABLE STUBS --------
+
+package Amanda::Xfer;
+
+*XFER_INIT = *Amanda::Xferc::XFER_INIT;
+*XFER_START = *Amanda::Xferc::XFER_START;
+*XFER_RUNNING = *Amanda::Xferc::XFER_RUNNING;
+*XFER_DONE = *Amanda::Xferc::XFER_DONE;
+*XMSG_INFO = *Amanda::Xferc::XMSG_INFO;
+*XMSG_ERROR = *Amanda::Xferc::XMSG_ERROR;
+*XMSG_DONE = *Amanda::Xferc::XMSG_DONE;
+*XMSG_CANCEL = *Amanda::Xferc::XMSG_CANCEL;
+
+@EXPORT_OK = ();
+%EXPORT_TAGS = ();
+
+=head1 NAME
+
+Amanda::Xfer - the transfer architecture
+
+=head1 SYNOPSIS
+
+  use Amanda::MainLoop;
+  use Amanda::Xfer qw( :constants );
+  use POSIX;
+
+  my $infd = POSIX::open("input", POSIX::O_RDONLY, 0);
+  my $outfd = POSIX::open("output", POSIX::O_CREAT|POSIX::O_WRONLY, 0640);
+  my $xfer = Amanda::Xfer->new([
+    Amanda::Xfer::Source::Fd->new($infd),
+    Amanda::Xfer::Dest::Fd->new($outfd)
+  ]);
+  $xfer->get_source()->set_callback(sub {
+      my ($src, $xmsg, $xfer) = @_;
+      print "Message from $xfer: $xmsg\n"; # use stringify operations
+      if ($xfer->get_status() == $XFER_DONE) {
+         $src->remove();
+         Amanda::MainLoop::quit();
+      }
+  });
+  $xfer->start();
+  Amanda::MainLoop::run();
+  
+See L<http://wiki.zmanda.com/index.php/XFA> for background on the transfer
+architecture.
+
+=head1 API STATUS
+
+Fluid.
+
+=head1 Amanda::Xfer Objects
+
+A new transfer is created with C<< Amanda::Xfer->new() >>, which takes an arrayref
+giving the transfer elements which should compose the transfer.
+
+The resulting object has the following methods:
+
+=over
+
+=item get_source()
+
+Get the L<Amanda::MainLoop> event source through which messages will be
+delivered for this transfer.  Use its C<set_callback> method to connect a perl
+sub for processing events.  You I<must> C<release> the source when the
+transfer is complete!
+
+The callback from this event source receives three arguments: the event source,
+the message, and a reference to the controlling transfer.  See the description of
+C<Amanda::Xfer::Msg>, below, for details.
+
+=item start()
+
+Start this transfer.  Processing takes place asynchronously, and messages will
+begin queueing up immediately.
+
+=item cancel()
+
+Stop transferring data.  The transfer will send an C<XMSG_CANCEL>, "drain" any
+buffered data as best it can, and then complete normally with an C<XMSG_DONE>.
+
+=item get_status()
+
+Get the transfer's status.  The result will be one of C<$XFER_INIT>,
+C<$XFER_START>, C<$XFER_RUNNING>, or C<$XFER_DONE>.  These symbols are
+available for import with the tag C<:constants>.
+
+=item repr()
+
+Return a string representation of this transfer, suitable for use in debugging
+messages.  This method is automatically invoked when a transfer is interpolated
+into a string:
+  print "Starting $xfer\n";
+
+=back
+
+=head1 Amanda::Xfer::Element objects
+
+The individual transfer elements that compose a transfer are instances of
+subclasses of Amanda::Xfer::Element.  All such objects have a C<repr()> method,
+similar to that for transfers, and support a similar kind of string
+interpolation.
+
+Note that the names of these classes contain the words "Source", "Filter", and
+"Dest".  This is merely suggestive of their intended purpose -- there are no
+such abstract classes.
+
+=head2 Transfer Sources
+
+=head3 Amanda::Xfer::Source::Device
+
+  Amanda::Xfer::Source::Device->new($device);
+
+This source reads data from a device.  The device should already be queued up
+for reading (C<$device->seek_file(..)>).  The element will read until the end
+of the device file.
+
+=head3 Amanda::Xfer::Source::Fd
+
+  Amanda::Xfer::Source::Fd->new(fileno($fh));
+
+This source reads data from a file descriptor.  It reads until EOF, but does
+not close the descriptor.  Be careful not to let Perl close the file for you!
+
+=head3 Amanda::Xfer::Source::Random
+
+  Amanda::Xfer::Source::Random->new($length, $seed);
+
+This source provides I<length> bytes of random data (or an unlimited amount
+of data if I<length> is zero).  C<$seed> is the seed used
+to generate the random numbers; this seed can be used in a destination to
+check for correct output.
+
+=head3 Amanda::Xfer::Source::Pattern
+
+  Amanda::Xfer::Source::Pattern->new($length, $pattern);
+
+This source provides I<length> bytes containing copies of
+I<pattern>. If I<length> is zero, the source provides an unlimited
+number of bytes.
+
+=head2 Transfer Filters
+
+=head3 Amanda::Xfer::Filter:Xor
+
+  Amanda::Xfer::Filter::Xor->new($key);
+
+This filter applies a bytewise XOR operation to the data flowing through it.
+
+=head2 Transfer Destinations
+
+=head3 Amanda::Xfer::Dest::Device
+
+  Amanda::Xfer::Dest::Device->new($device, $max_memory);
+
+This source writes data to a device.  The device should already be queued up
+for writing (C<$device->start_file(..)>).  No more than C<$max_memory> will be
+used for buffers.  Use zero for the default buffer size.  On completion of the
+transfer, the file will be finished.
+
+=head3 Amanda::Xfer::Dest::Fd
+
+  Amanda::Xfer::Dest::Fd->new(fileno($fh));
+
+This destination writes data to a file descriptor.  The file is not closed
+after the transfer is completed.  Be careful not to let Perl close the file
+for you!
+
+=head3 Amanda::Xfer::Dest::Null
+
+  Amanda::Xfer::Dest::Null->new($seed);
+
+This destination discards the data it receives.  If C<$seed> is nonzero, then
+the element will validate that it receives the data that
+C<Amanda::Xfer::Source::Random> produced with the same seed.  No validation is
+performed if C<$seed> is zero.
+
+=head1 Amanda::Xfer::Msg objects
+
+Messages are simple hashrefs, with a few convenience methods.  Like transfers,
+they have a C<repr()> method that formats the message nicely, and is available
+through string interpolation:
+  print "Received message $msg\n";
+
+Every message has the following keys:
+
+=over
+
+=item type
+
+The message type -- one of the C<xmsg_type> constants available from the import
+tag C<:constants>.
+
+=item elt
+
+The transfer element that sent the message.
+
+=item version
+
+The version of the message.  This is used to support extensibility of the protocol.
+
+=back
+
+The canonical description of the message types and keys is in C<xfer-src/xmsg.h>, and is
+not duplicated here.
+
+=cut
+
+push @EXPORT_OK, qw(xfer_status_to_string);
+push @{$EXPORT_TAGS{"xfer_status"}}, qw(xfer_status_to_string);
+
+my %_xfer_status_VALUES;
+#Convert an enum value to a single string
+sub xfer_status_to_string {
+    my ($enumval) = @_;
+
+    for my $k (keys %_xfer_status_VALUES) {
+       my $v = $_xfer_status_VALUES{$k};
+
+       #is this a matching flag?
+       if ($enumval == $v) {
+           return $k;
+       }
+    }
+
+#default, just return the number
+    return $enumval;
+}
+
+push @EXPORT_OK, qw($XFER_INIT);
+push @{$EXPORT_TAGS{"xfer_status"}}, qw($XFER_INIT);
+
+$_xfer_status_VALUES{"XFER_INIT"} = $XFER_INIT;
+
+push @EXPORT_OK, qw($XFER_START);
+push @{$EXPORT_TAGS{"xfer_status"}}, qw($XFER_START);
+
+$_xfer_status_VALUES{"XFER_START"} = $XFER_START;
+
+push @EXPORT_OK, qw($XFER_RUNNING);
+push @{$EXPORT_TAGS{"xfer_status"}}, qw($XFER_RUNNING);
+
+$_xfer_status_VALUES{"XFER_RUNNING"} = $XFER_RUNNING;
+
+push @EXPORT_OK, qw($XFER_DONE);
+push @{$EXPORT_TAGS{"xfer_status"}}, qw($XFER_DONE);
+
+$_xfer_status_VALUES{"XFER_DONE"} = $XFER_DONE;
+
+#copy symbols in xfer_status to constants
+push @{$EXPORT_TAGS{"constants"}},  @{$EXPORT_TAGS{"xfer_status"}};
+
+push @EXPORT_OK, qw(xmsg_type_to_string);
+push @{$EXPORT_TAGS{"xmsg_type"}}, qw(xmsg_type_to_string);
+
+my %_xmsg_type_VALUES;
+#Convert an enum value to a single string
+sub xmsg_type_to_string {
+    my ($enumval) = @_;
+
+    for my $k (keys %_xmsg_type_VALUES) {
+       my $v = $_xmsg_type_VALUES{$k};
+
+       #is this a matching flag?
+       if ($enumval == $v) {
+           return $k;
+       }
+    }
+
+#default, just return the number
+    return $enumval;
+}
+
+push @EXPORT_OK, qw($XMSG_INFO);
+push @{$EXPORT_TAGS{"xmsg_type"}}, qw($XMSG_INFO);
+
+$_xmsg_type_VALUES{"XMSG_INFO"} = $XMSG_INFO;
+
+push @EXPORT_OK, qw($XMSG_ERROR);
+push @{$EXPORT_TAGS{"xmsg_type"}}, qw($XMSG_ERROR);
+
+$_xmsg_type_VALUES{"XMSG_ERROR"} = $XMSG_ERROR;
+
+push @EXPORT_OK, qw($XMSG_DONE);
+push @{$EXPORT_TAGS{"xmsg_type"}}, qw($XMSG_DONE);
+
+$_xmsg_type_VALUES{"XMSG_DONE"} = $XMSG_DONE;
+
+push @EXPORT_OK, qw($XMSG_CANCEL);
+push @{$EXPORT_TAGS{"xmsg_type"}}, qw($XMSG_CANCEL);
+
+$_xmsg_type_VALUES{"XMSG_CANCEL"} = $XMSG_CANCEL;
+
+#copy symbols in xmsg_type to constants
+push @{$EXPORT_TAGS{"constants"}},  @{$EXPORT_TAGS{"xmsg_type"}};
+
+package Amanda::Xfer::Xfer;
+
+sub new { 
+    my $pkg = shift;
+
+
+    Amanda::Xfer::xfer_new(@_);
+}
+*DESTROY = *Amanda::Xfer::xfer_unref;
+use overload '""' => sub { $_[0]->repr(); };
+*repr = *Amanda::Xfer::xfer_repr;
+*get_status = *Amanda::Xfer::xfer_get_status;
+*get_source = *Amanda::Xfer::xfer_get_amglue_source;
+*start = *Amanda::Xfer::xfer_start;
+*cancel = *Amanda::Xfer::xfer_cancel;
+
+package Amanda::Xfer::Element;
+*DESTROY = *Amanda::Xfer::xfer_element_unref;
+use overload '""' => sub { $_[0]->repr(); };
+*repr = *Amanda::Xfer::xfer_element_repr;
+
+package Amanda::Xfer::Element::Glue;
+
+use vars qw(@ISA);
+@ISA = qw( Amanda::Xfer::Element );
+
+package Amanda::Xfer::Source::Device;
+
+use vars qw(@ISA);
+@ISA = qw( Amanda::Xfer::Element );
+
+sub new { 
+    my $pkg = shift;
+
+
+    Amanda::Xfer::xfer_source_device(@_);
+}
+
+package Amanda::Xfer::Source::Fd;
+
+use vars qw(@ISA);
+@ISA = qw( Amanda::Xfer::Element );
+
+sub new { 
+    my $pkg = shift;
+
+
+    Amanda::Xfer::xfer_source_fd(@_);
+}
+
+package Amanda::Xfer::Source::Random;
+
+use vars qw(@ISA);
+@ISA = qw( Amanda::Xfer::Element );
+
+sub new { 
+    my $pkg = shift;
+
+
+    Amanda::Xfer::xfer_source_random(@_);
+}
+
+package Amanda::Xfer::Source::Pattern;
+
+use vars qw(@ISA);
+@ISA = qw( Amanda::Xfer::Element );
+
+sub new { 
+    my $pkg = shift;
+
+
+    Amanda::Xfer::xfer_source_pattern(@_);
+}
+
+package Amanda::Xfer::Filter::Xor;
+
+use vars qw(@ISA);
+@ISA = qw( Amanda::Xfer::Element );
+
+sub new { 
+    my $pkg = shift;
+
+
+    Amanda::Xfer::xfer_filter_xor(@_);
+}
+
+package Amanda::Xfer::Dest::Device;
+
+use vars qw(@ISA);
+@ISA = qw( Amanda::Xfer::Element );
+
+sub new { 
+    my $pkg = shift;
+
+
+    Amanda::Xfer::xfer_dest_device(@_);
+}
+
+package Amanda::Xfer::Dest::Fd;
+
+use vars qw(@ISA);
+@ISA = qw( Amanda::Xfer::Element );
+
+sub new { 
+    my $pkg = shift;
+
+
+    Amanda::Xfer::xfer_dest_fd(@_);
+}
+
+package Amanda::Xfer::Dest::Null;
+
+use vars qw(@ISA);
+@ISA = qw( Amanda::Xfer::Element );
+
+sub new { 
+    my $pkg = shift;
+
+
+    Amanda::Xfer::xfer_dest_null(@_);
+}
+
+package Amanda::Xfer::Msg;
+
+use Data::Dumper;
+use overload '""' => sub { $_[0]->repr(); };
+
+sub repr {
+    my ($self) = @_;
+    local $Data::Dumper::Indent = 0;
+    local $Data::Dumper::Terse = 1;
+    local $Data::Dumper::Useqq = 1;
+
+    my $typestr = Amanda::Xfer::xmsg_type_to_string($self->{'type'});
+    my $str = "{ type => \$$typestr, elt => $self->{'elt'}, version => $self->{'version'},";
+
+    my %skip = ( "type" => 1, "elt" => 1, "version" => 1 );
+    for my $k (keys %$self) {
+       next if $skip{$k};
+       $str .= " $k => " . Dumper($self->{$k}) . ",";
+    }
+
+    # strip the trailing comma and add a closing brace
+    $str =~ s/,$/ }/g;
+
+    return $str;
+}
+
+package Amanda::Xfer;
+
+# make Amanda::Xfer->new equivalent to Amanda::Xfer::Xfer->new (don't
+# worry, the blessings work out just fine)
+*new = *Amanda::Xfer::Xfer::new;
+1;
diff --git a/perl/Amanda/Xfer.swg b/perl/Amanda/Xfer.swg
new file mode 100644 (file)
index 0000000..6140571
--- /dev/null
@@ -0,0 +1,805 @@
+/*
+ * Copyright (c) Zmanda, Inc.  All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ *
+ * This 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 this library; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+ *
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+ */
+
+%module "Amanda::Xfer"
+%include "amglue/amglue.swg"
+%include "exception.i"
+%import "Amanda/MainLoop.swg"
+%import "Amanda/Device.swg"
+
+%{
+#include "glib-util.h"
+#include "amxfer.h"
+%}
+
+%perlcode %{
+=head1 NAME
+
+Amanda::Xfer - the transfer architecture
+
+=head1 SYNOPSIS
+
+  use Amanda::MainLoop;
+  use Amanda::Xfer qw( :constants );
+  use POSIX;
+
+  my $infd = POSIX::open("input", POSIX::O_RDONLY, 0);
+  my $outfd = POSIX::open("output", POSIX::O_CREAT|POSIX::O_WRONLY, 0640);
+  my $xfer = Amanda::Xfer->new([
+    Amanda::Xfer::Source::Fd->new($infd),
+    Amanda::Xfer::Dest::Fd->new($outfd)
+  ]);
+  $xfer->get_source()->set_callback(sub {
+      my ($src, $xmsg, $xfer) = @_;
+      print "Message from $xfer: $xmsg\n"; # use stringify operations
+      if ($xfer->get_status() == $XFER_DONE) {
+         $src->remove();
+         Amanda::MainLoop::quit();
+      }
+  });
+  $xfer->start();
+  Amanda::MainLoop::run();
+  
+See L<http://wiki.zmanda.com/index.php/XFA> for background on the transfer
+architecture.
+
+=head1 API STATUS
+
+Fluid.
+
+=head1 Amanda::Xfer Objects
+
+A new transfer is created with C<< Amanda::Xfer->new() >>, which takes an arrayref
+giving the transfer elements which should compose the transfer.
+
+The resulting object has the following methods:
+
+=over
+
+=item get_source()
+
+Get the L<Amanda::MainLoop> event source through which messages will be
+delivered for this transfer.  Use its C<set_callback> method to connect a perl
+sub for processing events.  You I<must> C<release> the source when the
+transfer is complete!
+
+The callback from this event source receives three arguments: the event source,
+the message, and a reference to the controlling transfer.  See the description of
+C<Amanda::Xfer::Msg>, below, for details.
+
+=item start()
+
+Start this transfer.  Processing takes place asynchronously, and messages will
+begin queueing up immediately.
+
+=item cancel()
+
+Stop transferring data.  The transfer will send an C<XMSG_CANCEL>, "drain" any
+buffered data as best it can, and then complete normally with an C<XMSG_DONE>.
+
+=item get_status()
+
+Get the transfer's status.  The result will be one of C<$XFER_INIT>,
+C<$XFER_START>, C<$XFER_RUNNING>, or C<$XFER_DONE>.  These symbols are
+available for import with the tag C<:constants>.
+
+=item repr()
+
+Return a string representation of this transfer, suitable for use in debugging
+messages.  This method is automatically invoked when a transfer is interpolated
+into a string:
+  print "Starting $xfer\n";
+
+=back
+
+=head1 Amanda::Xfer::Element objects
+
+The individual transfer elements that compose a transfer are instances of
+subclasses of Amanda::Xfer::Element.  All such objects have a C<repr()> method,
+similar to that for transfers, and support a similar kind of string
+interpolation.
+
+Note that the names of these classes contain the words "Source", "Filter", and
+"Dest".  This is merely suggestive of their intended purpose -- there are no
+such abstract classes.
+
+=head2 Transfer Sources
+
+=head3 Amanda::Xfer::Source::Device
+
+  Amanda::Xfer::Source::Device->new($device);
+
+This source reads data from a device.  The device should already be queued up
+for reading (C<$device->seek_file(..)>).  The element will read until the end
+of the device file.
+
+=head3 Amanda::Xfer::Source::Fd
+
+  Amanda::Xfer::Source::Fd->new(fileno($fh));
+
+This source reads data from a file descriptor.  It reads until EOF, but does
+not close the descriptor.  Be careful not to let Perl close the file for you!
+
+=head3 Amanda::Xfer::Source::Random
+
+  Amanda::Xfer::Source::Random->new($length, $seed);
+
+This source provides I<length> bytes of random data (or an unlimited amount
+of data if I<length> is zero).  C<$seed> is the seed used
+to generate the random numbers; this seed can be used in a destination to
+check for correct output.
+
+=head3 Amanda::Xfer::Source::Pattern
+
+  Amanda::Xfer::Source::Pattern->new($length, $pattern);
+
+This source provides I<length> bytes containing copies of
+I<pattern>. If I<length> is zero, the source provides an unlimited
+number of bytes.
+
+=head2 Transfer Filters
+
+=head3 Amanda::Xfer::Filter:Xor
+
+  Amanda::Xfer::Filter::Xor->new($key);
+
+This filter applies a bytewise XOR operation to the data flowing through it.
+
+=head2 Transfer Destinations
+
+=head3 Amanda::Xfer::Dest::Device
+
+  Amanda::Xfer::Dest::Device->new($device, $max_memory);
+
+This source writes data to a device.  The device should already be queued up
+for writing (C<$device->start_file(..)>).  No more than C<$max_memory> will be
+used for buffers.  Use zero for the default buffer size.  On completion of the
+transfer, the file will be finished.
+
+=head3 Amanda::Xfer::Dest::Fd
+
+  Amanda::Xfer::Dest::Fd->new(fileno($fh));
+
+This destination writes data to a file descriptor.  The file is not closed
+after the transfer is completed.  Be careful not to let Perl close the file
+for you!
+
+=head3 Amanda::Xfer::Dest::Null
+
+  Amanda::Xfer::Dest::Null->new($seed);
+
+This destination discards the data it receives.  If C<$seed> is nonzero, then
+the element will validate that it receives the data that
+C<Amanda::Xfer::Source::Random> produced with the same seed.  No validation is
+performed if C<$seed> is zero.
+
+=head1 Amanda::Xfer::Msg objects
+
+Messages are simple hashrefs, with a few convenience methods.  Like transfers,
+they have a C<repr()> method that formats the message nicely, and is available
+through string interpolation:
+  print "Received message $msg\n";
+
+Every message has the following keys:
+
+=over
+
+=item type
+
+The message type -- one of the C<xmsg_type> constants available from the import
+tag C<:constants>.
+
+=item elt
+
+The transfer element that sent the message.
+
+=item version
+
+The version of the message.  This is used to support extensibility of the protocol.
+
+=back
+
+The canonical description of the message types and keys is in C<xfer-src/xmsg.h>, and is
+not duplicated here.
+
+=cut
+%}
+
+/* The SWIGging of the transfer architecture.
+ *
+ * The C layer of the transfer architecture exposes some structs, which are
+ * arranged through GObject magic into a class hierarchy.  It also exposes
+ * regular C functions which are intended to act as methods on these structs.
+ * Furthermore, it exposes Perl callbacks (via Amanda::MainLoop) with
+ * parameters involving objects of these classes.
+ *
+ * SWIG doesn't support callbacks very well, and makes it particularly
+ * difficult to represent a GObject class hierarchy.  Rather than try to "make
+ * it fit" into SWIG, this module uses custom typemaps and perl/C conversions
+ * to get all of this stuff right in the first place.
+ *
+ * For Xfer objects, we define two functions, new_sv_for_xfer and xfer_from_sv,
+ * which create a new SV for an Xfer object, and subsequently extract a pointer
+ * to the object from the SV.  The SV is both blessed and tied to the
+ * Amanda::Xfer::Xfer class, in which all of the method calls are defined, and
+ * which defines a DESTROY method that calls xfer_unref.
+ *
+ * XferElements are similar, but we have the added challenge of representing
+ * subclasses with appropriate perl subclasses.  The solution is to tag each C
+ * class with a perl class name, and use that name when blessing a new SV.
+ *
+ * Finally, XMsgs are reflected entirely into perl hashrefs, in the interest of
+ * efficiency.
+ */
+
+/*
+ * Initialization
+ */
+
+%init %{
+    /* We need GType and GThread initialized to use xfers */
+    glib_init();
+%}
+
+/*
+ * Constants
+ */
+
+amglue_add_enum_tag_fns(xfer_status);
+amglue_add_constant(XFER_INIT, xfer_status);
+amglue_add_constant(XFER_START, xfer_status);
+amglue_add_constant(XFER_RUNNING, xfer_status);
+amglue_add_constant(XFER_DONE, xfer_status);
+amglue_copy_to_tag(xfer_status, constants);
+
+amglue_add_enum_tag_fns(xmsg_type);
+amglue_add_constant(XMSG_INFO, xmsg_type);
+amglue_add_constant(XMSG_ERROR, xmsg_type);
+amglue_add_constant(XMSG_DONE, xmsg_type);
+amglue_add_constant(XMSG_CANCEL, xmsg_type);
+amglue_copy_to_tag(xmsg_type, constants);
+
+/*
+ * Wrapping machinery
+ */
+
+%{
+/* Return a new SV with refcount 1 representing the given C object
+ * with the given class.
+ *
+ * @param c_obj: the object to represent
+ * @param perl_class: the perl with which to bless and tie the SV
+ */
+static SV *
+new_sv_for_c_obj(
+    gpointer c_obj,
+    const char *perl_class)
+{
+    SV *sv = newSV(0);
+
+    /* Make an SV that contains a pointer to the object, and bless it
+     * with the appropriate class. */
+    sv_setref_pv(sv, perl_class, c_obj);
+
+    return sv;
+}
+
+/* Return a new SV representing a transfer.
+ *
+ * @param xfer: the transfer to represent
+ */
+static SV *
+new_sv_for_xfer(
+    Xfer *xfer)
+{
+    if (!xfer) return &PL_sv_undef;
+
+    xfer_ref(xfer);
+    return new_sv_for_c_obj(xfer, "Amanda::Xfer::Xfer");
+}
+
+/* Return a new SV representing a transfer element.
+ *
+ * @param xe: the transfer element to represent
+ */
+static SV *
+new_sv_for_xfer_element(
+    XferElement *xe)
+{
+    const char *perl_class;
+
+    if (!xe) return &PL_sv_undef;
+
+    perl_class = XFER_ELEMENT_GET_CLASS(xe)->perl_class;
+    if (!perl_class) die("Attempt to wrap an XferElementClass with no perl class!");
+    g_object_ref(xe);
+    return new_sv_for_c_obj(xe, perl_class);
+}
+
+/* Return the C object buried in an SV, asserting that the perl SV is
+ * derived from derived_from.  Returns NULL for undefined perl values.
+ *
+ * This function is based on SWIG's SWIG_Perl_ConvertPtr.  The INT2PTR
+ * situation certainly looks strange, but is documented in perlxs.
+ *
+ * @param sv: the SV to convert
+ * @param derived_from: perl class from which the SV should be derived
+ * @return: underlying pointer
+ */
+static gpointer
+c_obj_from_sv(
+    SV *sv,
+    const char *derived_from)
+{
+    SV *referent;
+    IV tmp;
+
+    if (!sv) return NULL;
+    if (!SvOK(sv)) return NULL;
+
+    /* Peel back the layers.  The sv should be a blessed reference to a PV,
+     * and we check the class against derived_from to ensure we have the right
+     * stuff. */
+    if (!sv_isobject(sv) || !sv_derived_from(sv, derived_from)) {
+       croak("Value is not an object of type %s", derived_from);
+       return NULL;
+    }
+
+    referent = (SV *)SvRV(sv);
+    tmp = SvIV(referent);
+    return INT2PTR(gpointer, tmp);
+}
+
+/* Convert an SV to an Xfer.  The Xfer's reference count is not
+ * incremented -- this is a "borrowed" reference.
+ *
+ * @param sv: the perl value
+ * @returns: pointer to the corresponding transfer, or NULL
+ */
+static Xfer *
+xfer_from_sv(
+    SV *sv)
+{
+    return (Xfer *)c_obj_from_sv(sv, "Amanda::Xfer::Xfer");
+}
+
+/* Convert an SV to an XferElement.  The element's reference count is
+ * not incremented -- this is a "borrowed" reference.
+ *
+ * @param sv: the perl value
+ * @returns: pointer to the corresponding transfer element, or NULL.
+ */
+static XferElement *
+xfer_element_from_sv(
+    SV *sv)
+{
+    return (XferElement *)c_obj_from_sv(sv, "Amanda::Xfer::Element");
+}
+
+/* Given an XMsg, return a hashref representing the message as a pure-perl
+ * object.  The object is new, has refcount 1, and is totally independent of
+ * the underlying XMsg.
+ *
+ * Reflecting the XMsg directly into Perl avoids the need to reference-count
+ * the XMsg objects themselves, which can simply be freed after a callback
+ * completes.  The overhead of creating a hash is likely equivalent to or
+ * less than the overhead that would be consumed with SWIG's swig_$field_get
+ * accessors, assuming that perl code examines most of the fields in a message.
+ *
+ * @param msg: the message to represent
+ * @returns: a perl SV
+ */
+static SV *
+new_sv_for_xmsg(
+    XMsg *msg)
+{
+    static HV *amanda_xfer_msg_stash = NULL;
+    HV *hash = newHV();
+    SV *rv = newRV_noinc((SV *)hash);
+
+    /* bless the rv as an Amanda::Xfer::Msg object */
+    if (!amanda_xfer_msg_stash) {
+       amanda_xfer_msg_stash = gv_stashpv("Amanda::Xfer::Msg", GV_ADD);
+    }
+    sv_bless(rv, amanda_xfer_msg_stash);
+
+    /* TODO: consider optimizing by precomputing the hash values of
+     * the keys? */
+
+    /* elt */
+    hv_store(hash, "elt", 3, new_sv_for_xfer_element(msg->elt), 0);
+
+    /* type */
+    hv_store(hash, "type", 4, newSViv(msg->type), 0);
+
+    /* type */
+    hv_store(hash, "version", 7, newSViv(msg->version), 0);
+
+    /* message */
+    if (msg->message)
+       hv_store(hash, "message", 7, newSVpv(msg->message, 0), 0);
+
+    return rv;
+}
+%}
+
+%typemap(in) Xfer * {
+    $1 = xfer_from_sv($input);
+}
+
+%typemap(in) XferElement * {
+    $1 = xfer_element_from_sv($input);
+}
+
+%typemap(out) Xfer * {
+    $result = sv_2mortal(new_sv_for_xfer($1));
+    argvi++;
+}
+
+%typemap(out) XferElement * {
+    $result = sv_2mortal(new_sv_for_xfer_element($1));
+    argvi++;
+}
+
+%typemap(newfree) Xfer * {
+    xfer_unref($1);
+}
+
+%typemap(newfree) XferElement * {
+    xfer_element_unref($1);
+}
+
+/*
+ * Xfer functions
+ */
+
+/* A typemap for the input to the Xfer constructor, a.k.a. xfer_new */
+%typemap(in,numinputs=1) (XferElement **elementlist, unsigned int nelements) {
+    AV *av;
+    unsigned int i;
+
+    /* check that it's an arrayref */
+    if (!SvROK($input) || SvTYPE(SvRV($input)) != SVt_PVAV) {
+       SWIG_exception(SWIG_TypeError, "Expected an arrayref");
+    }
+    av = (AV *)SvRV($input);
+
+    /* allocate memory for $1 */
+    $2 = av_len(av)+1; /* av_len(av) is like $#av */
+    $1 = g_new(XferElement *, $2);
+
+    /* extract the underlying XferElement objects and add pointers to
+     * them, "borrowing" the caller's references for the moment. */
+    for (i = 0; i < $2; i++) {
+       SV **sv = av_fetch(av, i, 0);
+       XferElement *elt = sv? xfer_element_from_sv(*sv):NULL;
+
+       if (!elt) {
+           SWIG_exception(SWIG_TypeError, "Expected an arrayref of Amanda::Xfer::Element objects");
+       }
+       $1[i] = elt;
+    }
+}
+
+%typemap(freearg) (XferElement **elementlist, unsigned int nelements) {
+    /* free the element vector allocated in the (in) typemap */
+    g_free($1);
+}
+
+%newobject xfer_new;
+Xfer *xfer_new(XferElement **elementlist, unsigned int nelements);
+void xfer_unref(Xfer *);
+xfer_status xfer_get_status(Xfer *xfer);
+char *xfer_repr(Xfer *xfer);
+void xfer_start(Xfer *xfer);
+void xfer_cancel(Xfer *xfer);
+/* xfer_get_source is implemented below */
+
+%inline %{
+/* SWIG wants to treat this as a function */
+#define xfer_get_status(xfer) ((xfer)->status)
+%}
+
+/*
+ * XferElement functions
+ *
+ * Some of these methods are not intended to be used from Perl; they are annotated
+ * as "private".
+ */
+
+void xfer_element_unref(XferElement *elt); /* (wrap the macro, above) */
+/* xfer_element_link_to -- private */
+char *xfer_element_repr(XferElement *elt);
+/* xfer_element_start -- private */
+/* xfer_element_cancel -- private */
+
+/* subclass constructors */
+
+/* N.B. When adding new classes, ensure that the class_init function
+ * sets perl_class to the appropriate value. */
+
+%newobject xfer_source_device;
+XferElement *xfer_source_device(
+    Device *device);
+
+%newobject xfer_source_random;
+XferElement *xfer_source_random(
+    guint64 length,
+    guint32 seed);
+
+%typemap(in) (void * pattern, size_t pattern_length) {
+ size_t len;
+ char * pat;
+
+ pat = SvPV($input, len);
+ $1 = g_memdup(pat, len);
+ $2 = len;
+}
+
+%newobject xfer_source_random;
+XferElement *xfer_source_pattern(
+    guint64 length,
+    void * pattern,
+    size_t pattern_length);
+
+%newobject xfer_source_fd;
+XferElement *xfer_source_fd(
+    int fd);
+
+%newobject xfer_filter_xor;
+XferElement *xfer_filter_xor(
+    unsigned char xor_key);
+
+%newobject xfer_dest_device;
+XferElement *xfer_dest_device(
+    Device *device,
+    size_t max_memory);
+
+%newobject xfer_dest_null;
+XferElement *xfer_dest_null(
+    guint32 prng_seed);
+
+%newobject xfer_dest_fd;
+XferElement *xfer_dest_fd(
+    int fd);
+
+/*
+ * Callback handling
+ */
+
+%types(amglue_Source *);
+%{
+static gboolean
+xmsgsource_perl_callback(
+    gpointer data,
+    struct XMsg *msg,
+    Xfer *xfer)
+{
+    dSP;
+    amglue_Source *src = (amglue_Source *)data;
+    SV *src_sv = NULL;
+
+    g_assert(src->callback_sv != NULL);
+
+    ENTER;
+    SAVETMPS;
+
+    /* create a new SV pointing to 'src', and increase its refcount
+     * accordingly.  The SV is mortal, so FREETMPS will decrease the 
+     * refcount, unless the callee keeps a copy of it somewhere */
+    amglue_source_ref(src);
+    src_sv = SWIG_NewPointerObj(src, SWIGTYPE_p_amglue_Source,
+                                SWIG_OWNER | SWIG_SHADOW);
+
+    PUSHMARK(SP);
+    XPUSHs(src_sv);
+    XPUSHs(sv_2mortal(new_sv_for_xmsg(msg)));
+    XPUSHs(sv_2mortal(new_sv_for_xfer(xfer)));
+    PUTBACK;
+
+    call_sv(src->callback_sv, G_EVAL|G_DISCARD);
+
+    FREETMPS;
+    LEAVE;
+
+    /* these may have been freed, so don't use them after this point */
+    src_sv = NULL;
+    src = NULL;
+
+    /* check for an uncaught 'die'.  If we don't do this, then Perl will longjmp()
+     * over the GMainLoop mechanics, leaving GMainLoop in an inconsistent (locked)
+     * state. */
+    if (SvTRUE(ERRSV)) {
+       /* We handle this just the way the default 'die' handler in Amanda::Debug 
+        * does, but since Amanda's debug support may not yet be running, we back
+        * it up with an exit() */
+       g_critical("%s", SvPV_nolen(ERRSV));
+       exit(1);
+    }
+
+    return TRUE;
+}
+%}
+
+%newobject xfer_get_amglue_source;
+%inline %{
+amglue_Source *
+xfer_get_amglue_source(
+    Xfer *xfer)
+{
+    return amglue_source_get(xfer_get_source(xfer),
+       (GSourceFunc)xmsgsource_perl_callback);
+}
+%}
+
+/*
+ * XMsg and XMsgSource handling
+ */
+
+/*
+ * The perl side
+ */
+
+/* First, a few macros to generate decent Perl */
+
+%define PACKAGE(PKG)
+%perlcode {
+package PKG;
+}
+%enddef
+
+%define XFER_ELEMENT_SUBCLASS()
+%perlcode {
+use vars qw(@ISA);
+@ISA = qw( Amanda::Xfer::Element );
+}
+%enddef
+
+%define DECLARE_CONSTRUCTOR(C_CONSTRUCTOR)
+%perlcode {
+sub new { 
+    my $pkg = shift;
+    # The C function adds the proper blessing -- this function
+    # just gets $pkg out of the way.
+    Amanda::Xfer::C_CONSTRUCTOR(@_);
+}
+}
+%enddef
+
+%define OVERLOAD_REPR()
+%perlcode {use overload '""' => sub { $_[0]->repr(); };
+}
+%enddef
+
+%define DECLARE_METHOD(METHOD_NAME, C_FUNCTION)
+%perlcode {*METHOD_NAME = *Amanda::Xfer::C_FUNCTION;
+}
+%enddef
+
+/* And now define the required perl classes */
+
+PACKAGE(Amanda::Xfer::Xfer)
+DECLARE_CONSTRUCTOR(xfer_new);
+DECLARE_METHOD(DESTROY, xfer_unref);
+OVERLOAD_REPR()
+DECLARE_METHOD(repr, xfer_repr);
+DECLARE_METHOD(get_status, xfer_get_status);
+DECLARE_METHOD(get_source, xfer_get_amglue_source);
+DECLARE_METHOD(start, xfer_start);
+DECLARE_METHOD(cancel, xfer_cancel);
+
+/* ---- */
+
+PACKAGE(Amanda::Xfer::Element)
+DECLARE_METHOD(DESTROY, xfer_element_unref);
+OVERLOAD_REPR()
+DECLARE_METHOD(repr, xfer_element_repr);
+
+/* ---- */
+
+PACKAGE(Amanda::Xfer::Element::Glue)
+XFER_ELEMENT_SUBCLASS()
+/* no constructor -- internal use only */
+
+/* ---- */
+
+PACKAGE(Amanda::Xfer::Source::Device)
+XFER_ELEMENT_SUBCLASS()
+DECLARE_CONSTRUCTOR(xfer_source_device)
+
+/* ---- */
+
+PACKAGE(Amanda::Xfer::Source::Fd)
+XFER_ELEMENT_SUBCLASS()
+DECLARE_CONSTRUCTOR(xfer_source_fd)
+
+/* ---- */
+
+PACKAGE(Amanda::Xfer::Source::Random)
+XFER_ELEMENT_SUBCLASS()
+DECLARE_CONSTRUCTOR(xfer_source_random)
+
+/* ---- */
+
+PACKAGE(Amanda::Xfer::Source::Pattern)
+XFER_ELEMENT_SUBCLASS()
+DECLARE_CONSTRUCTOR(xfer_source_pattern)
+
+/* ---- */
+
+PACKAGE(Amanda::Xfer::Filter::Xor)
+XFER_ELEMENT_SUBCLASS()
+DECLARE_CONSTRUCTOR(xfer_filter_xor)
+
+/* ---- */
+
+PACKAGE(Amanda::Xfer::Dest::Device)
+XFER_ELEMENT_SUBCLASS()
+DECLARE_CONSTRUCTOR(xfer_dest_device)
+
+/* ---- */
+
+PACKAGE(Amanda::Xfer::Dest::Fd)
+XFER_ELEMENT_SUBCLASS()
+DECLARE_CONSTRUCTOR(xfer_dest_fd)
+
+/* ---- */
+
+PACKAGE(Amanda::Xfer::Dest::Null)
+XFER_ELEMENT_SUBCLASS()
+DECLARE_CONSTRUCTOR(xfer_dest_null)
+
+/* ---- */
+
+PACKAGE(Amanda::Xfer::Msg)
+%perlcode %{
+use Data::Dumper;
+use overload '""' => sub { $_[0]->repr(); };
+
+sub repr {
+    my ($self) = @_;
+    local $Data::Dumper::Indent = 0;
+    local $Data::Dumper::Terse = 1;
+    local $Data::Dumper::Useqq = 1;
+
+    my $typestr = Amanda::Xfer::xmsg_type_to_string($self->{'type'});
+    my $str = "{ type => \$$typestr, elt => $self->{'elt'}, version => $self->{'version'},";
+
+    my %skip = ( "type" => 1, "elt" => 1, "version" => 1 );
+    for my $k (keys %$self) {
+       next if $skip{$k};
+       $str .= " $k => " . Dumper($self->{$k}) . ",";
+    }
+
+    # strip the trailing comma and add a closing brace
+    $str =~ s/,$/ }/g;
+
+    return $str;
+}
+%}
+
+/* ---- */
+
+PACKAGE(Amanda::Xfer)
+%perlcode %{
+# make Amanda::Xfer->new equivalent to Amanda::Xfer::Xfer->new (don't
+# worry, the blessings work out just fine)
+*new = *Amanda::Xfer::Xfer::new;
+%}
index 026f067403cd14b4bfe04ce6a5540ca0a87c59eb..92fa55100cc2fe9dbc6021691eb91384827eb5c5 100644 (file)
@@ -15,6 +15,9 @@ AM_CFLAGS = -DSWIG
 INCLUDES =  \
             -I$(top_builddir)/common-src \
             -I$(top_srcdir)/common-src \
+            -I$(top_srcdir)/amandad-src \
+            -I$(top_srcdir)/amar-src \
+            -I$(top_srcdir)/xfer-src \
             -I$(top_srcdir)/perl/amglue \
             -I$(top_srcdir)/gnulib \
             $(PERL_INC)
@@ -46,6 +49,7 @@ amlib_LTLIBRARIES = libamglue.la
 libamglue_la_SOURCES = \
        amglue/ghashtable.c \
        amglue/bigint.c \
+       amglue/source.c \
        amglue/amglue.h
 libamglue_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
 EXTRA_DIST += $(libamglue_la_SOURCES)
@@ -115,6 +119,18 @@ Amandadir=$(amperldir)/Amanda
 Amanda_DATA =
 HTML_SOURCE_FILES += $(Amanda_DATA)
 
+# PACKAGE: Amanda::Archive
+libArchivedir = $(amperldir)/auto/Amanda/Archive
+libArchive_LTLIBRARIES = libArchive.la
+libArchive_la_SOURCES = Amanda/Archive.c $(AMGLUE_SWG)
+libArchive_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
+libArchive_la_LIBADD = libamglue.la \
+       $(top_builddir)/amar-src/libamar.la \
+       $(top_builddir)/common-src/libamanda.la
+Amanda_DATA += Amanda/Archive.pm
+EXTRA_DIST += Amanda/Archive.swg Amanda/Archive.pm
+MAINTAINERCLEANFILES += Amanda/Archive.c Amanda/Archive.pm
+
 if WANT_SERVER
 # PACKAGE: Amanda::Device
 libDevicedir = $(amperldir)/auto/Amanda/Device
@@ -125,9 +141,11 @@ libDevice_la_LIBADD = libamglue.la \
        $(top_builddir)/device-src/libamdevice.la \
        $(top_builddir)/common-src/libamanda.la
 Amanda_DATA += Amanda/Device.pm
-EXTRA_DIST += Amanda/Device.swg Amanda/Device.pm
 MAINTAINERCLEANFILES += Amanda/Device.c Amanda/Device.pm
+endif
+EXTRA_DIST += Amanda/Device.swg Amanda/Device.pm
 
+if WANT_SERVER
 # PACKAGE: Amanda::Logfile
 libLogfiledir = $(amperldir)/auto/Amanda/Logfile
 libLogfile_LTLIBRARIES = libLogfile.la
@@ -137,9 +155,11 @@ libLogfile_la_LIBADD = libamglue.la \
        $(top_builddir)/server-src/libamserver.la \
        $(top_builddir)/common-src/libamanda.la
 Amanda_DATA += Amanda/Logfile.pm
-EXTRA_DIST += Amanda/Logfile.swg Amanda/Logfile.pm
 MAINTAINERCLEANFILES += Amanda/Logfile.c Amanda/Logfile.pm
+endif
+EXTRA_DIST += Amanda/Logfile.swg Amanda/Logfile.pm
 
+if WANT_SERVER
 # PACKAGE: Amanda::Cmdline
 libCmdlinedir = $(amperldir)/auto/Amanda/Cmdline
 libCmdline_LTLIBRARIES = libCmdline.la
@@ -149,27 +169,78 @@ libCmdline_la_LIBADD = libamglue.la \
        $(top_builddir)/server-src/libamserver.la \
        $(top_builddir)/common-src/libamanda.la
 Amanda_DATA += Amanda/Cmdline.pm
-EXTRA_DIST += Amanda/Cmdline.swg Amanda/Cmdline.pm
 MAINTAINERCLEANFILES += Amanda/Cmdline.c Amanda/Cmdline.pm
+endif
+EXTRA_DIST += Amanda/Cmdline.swg Amanda/Cmdline.pm
 
-# PACKAGE: Amanda::Tapefile
-libTapefiledir = $(amperldir)/auto/Amanda/Tapefile
-libTapefile_LTLIBRARIES = libTapefile.la
-libTapefile_la_SOURCES = Amanda/Tapefile.c $(AMGLUE_SWG)
-libTapefile_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
-libTapefile_la_LIBADD = libamglue.la \
+if WANT_SERVER
+# PACKAGE: Amanda::Tapelist
+libTapelistdir = $(amperldir)/auto/Amanda/Tapelist
+libTapelist_LTLIBRARIES = libTapelist.la
+libTapelist_la_SOURCES = Amanda/Tapelist.c $(AMGLUE_SWG)
+libTapelist_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
+libTapelist_la_LIBADD = libamglue.la \
        $(top_builddir)/server-src/libamserver.la \
        $(top_builddir)/common-src/libamanda.la
-Amanda_DATA += Amanda/Tapefile.pm
-EXTRA_DIST += Amanda/Tapefile.swg Amanda/Tapefile.pm
-MAINTAINERCLEANFILES += Amanda/Tapefile.c Amanda/Tapefile.pm
+Amanda_DATA += Amanda/Tapelist.pm
+MAINTAINERCLEANFILES += Amanda/Tapelist.c Amanda/Tapelist.pm
+endif
+EXTRA_DIST += Amanda/Tapelist.swg Amanda/Tapelist.pm
 
+if WANT_SERVER
 # PACKAGE: Amanda::Changer
 Amanda_DATA += Amanda/Changer.pm
+endif
 EXTRA_DIST += Amanda/Changer.pm
 
+if WANT_SERVER
+# PACKAGE: Amanda::Changer::*
+AmandaChangerdir = $(amperldir)/Amanda/Changer
+AmandaChanger_DATA = \
+       Amanda/Changer/disk.pm \
+       Amanda/Changer/compat.pm \
+       Amanda/Changer/single.pm
+HTML_SOURCE_FILES += $(AmandaChanger_DATA)
+endif
+EXTRA_DIST += $(AmandaChanger_DATA)
+
+# PACKAGE: Amanda::Process
+if WANT_SERVER
+Amanda_DATA += Amanda/Process.pm
+endif
+EXTRA_DIST += Amanda/Process.pm
+
+if WANT_SERVER
+# PACKAGE: Amanda::DB::*
+Amanda_DBdir = $(Amandadir)/DB
+Amanda_DB_DATA =
+HTML_SOURCE_FILES += $(Amanda_DB_DATA)
 endif
 
+if WANT_SERVER
+# PACKAGE: Amanda::DB::Catalog
+Amanda_DB_DATA += Amanda/DB/Catalog.pm
+endif
+EXTRA_DIST += Amanda/DB/Catalog.pm
+
+if WANT_SERVER
+# PACKAGE: Amanda::Xfer
+libXferdir = $(amperldir)/auto/Amanda/Xfer
+libXfer_LTLIBRARIES = libXfer.la
+libXfer_la_SOURCES = Amanda/Xfer.c $(AMGLUE_SWG)
+libXfer_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
+libXfer_la_LIBADD = libamglue.la \
+       $(top_builddir)/xfer-src/libamxfer.la \
+       $(top_builddir)/common-src/libamanda.la
+Amanda_DATA += Amanda/Xfer.pm
+MAINTAINERCLEANFILES += Amanda/Xfer.c Amanda/Xfer.pm
+endif
+EXTRA_DIST += Amanda/Xfer.swg Amanda/Xfer.pm
+
+# PACKAGE: Amanda::BigIntCompat
+Amanda_DATA += Amanda/BigIntCompat.pm
+EXTRA_DIST += Amanda/BigIntCompat.pm
+
 # PACKAGE: Amanda::Debug
 libDebugdir = $(amperldir)/auto/Amanda/Debug
 libDebug_LTLIBRARIES = libDebug.la
@@ -214,11 +285,67 @@ Amanda_DATA += Amanda/Types.pm
 EXTRA_DIST += Amanda/Types.swg Amanda/Types.pm
 MAINTAINERCLEANFILES += Amanda/Types.c Amanda/Types.pm
 
+# PACKAGE: Amanda::Tests
+libTestsdir = $(amperldir)/auto/Amanda/Tests
+libTests_LTLIBRARIES = libTests.la
+libTests_la_SOURCES = Amanda/Tests.c $(AMGLUE_SWG)
+libTests_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
+libTests_la_LIBADD = libamglue.la \
+       $(top_builddir)/common-src/libamanda.la
+Amanda_DATA += Amanda/Tests.pm
+EXTRA_DIST += Amanda/Tests.swg Amanda/Tests.pm
+MAINTAINERCLEANFILES += Amanda/Tests.c Amanda/Tests.pm
+
+# PACKAGE: Amanda::MainLoop
+libMainLoopdir = $(amperldir)/auto/Amanda/MainLoop
+libMainLoop_LTLIBRARIES = libMainLoop.la
+libMainLoop_la_SOURCES = Amanda/MainLoop.c $(AMGLUE_SWG)
+libMainLoop_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
+libMainLoop_la_LIBADD = libamglue.la \
+       $(top_builddir)/common-src/libamanda.la
+Amanda_DATA += Amanda/MainLoop.pm
+EXTRA_DIST += Amanda/MainLoop.swg Amanda/MainLoop.pm
+MAINTAINERCLEANFILES += Amanda/MainLoop.c Amanda/MainLoop.pm
+
 # PACKAGE: Amanda::Paths
 Amanda_DATA += Amanda/Paths.pm
 EXTRA_DIST += Amanda/Paths.pm.in
 DISTCLEANFILES += Amanda/Paths.pm
 
+# PACKAGE: Amanda::Constants
+Amanda_DATA += Amanda/Constants.pm
+EXTRA_DIST += Amanda/Constants.pm.in
+DISTCLEANFILES += Amanda/Constants.pm
+
+# PACKAGE: Amanda::Script_App
+Amanda_DATA += Amanda/Script_App.pm
+EXTRA_DIST += Amanda/Script_App.pm
+
+if WANT_CLIENT
+# PACKAGE: Amanda::Application
+libApplicationdir = $(amperldir)/auto/Amanda/Application
+libApplication_LTLIBRARIES = libApplication.la
+libApplication_la_SOURCES = Amanda/Application.c $(AMGLUE_SWG)
+libApplication_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
+libApplication_la_LIBADD = libamglue.la \
+       $(top_builddir)/client-src/libamclient.la
+Amanda_DATA += Amanda/Application.pm
+MAINTAINERCLEANFILES += Amanda/Application.c Amanda/Application.pm
+endif
+EXTRA_DIST += Amanda/Application.swg Amanda/Application.pm
+
+# PACKAGE: Amanda::Script
+Amanda_DATA += Amanda/Script.pm
+EXTRA_DIST += Amanda/Script.pm
+
+if WANT_CLIENT
+# PACKAGE: Amanda::Application::*
+AmandaApplicationdir = $(amperldir)/Amanda/Application
+AmandaApplication_DATA = Amanda/Application/Zfs.pm
+HTML_SOURCE_FILES += $(AmandaApplication_DATA)
+endif
+EXTRA_DIST += Amanda/Application/Zfs.pm
+
 # perl doesn't use the cyg prefix and it doesn't search in the bin
 # directory, dll must be copied to their modules directories.
 if WANT_CYGWIN_COPY_PERL_DLL
@@ -226,6 +353,21 @@ amperldirauto="$(DESTDIR)$(amperldir)/auto/Amanda"
 install-data-hook:
        @for cygdll in $(amperldirauto)/bin/cyg*.dll; do \
            destfname=`echo $$cygdll|sed 's!/bin/cyg\([^.]*\).dll!/\1/\1.dll!'`; \
-           cp "$$cygdll" "$$destfname"; \
+          cp "$$cygdll" "$$destfname"; \
        done
 endif
+
+check-local:
+       @MODULES_TO_CHECK="$(Amanda_DATA) $(Amanda_DB_DATA) $(AmandaChanger_DATA) $(AmandaApplication_DATA)"; \
+       if test -f $(top_builddir)/perl/.libs/libConfig.so -o -f $(top_builddir)/perl/libConfig.so; then \
+               if test -n "$(PERL)"; then \
+                       for perlobj in $$MODULES_TO_CHECK; do \
+                               if test -f $$perlobj; then \
+                                       $(PERL) $(CHECK_PERL_FLAGS) -I$(top_builddir)/perl -I$(top_builddir)/perl/.libs -I$(top_srcdir)/perl -c -T $$perlobj || exit 1; \
+                               else \
+                                       $(PERL) $(CHECK_PERL_FLAGS) -I$(top_builddir)/perl -I$(top_builddir)/perl/.libs -I$(top_srcdir)/perl -c -T $(top_srcdir)/perl/$$perlobj || exit 1; \
+                               fi \
+                       done; \
+               fi \
+        fi
+
index a4fbb1672b65ff375478fedcab9b44bb74cb09ff..280ade2faf23d366fd8fad11ef6d55a5c9d44be0 100644 (file)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  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.
@@ -15,7 +15,7 @@
 @SET_MAKE@
 
 # vim:ft=automake
-# Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
 # 
 # This library is free software; you can redistribute it and/or modify it
 # under the terms of the GNU Lesser General Public License version 2.1 as 
 # along with this library; if not, write to the Free Software Foundation,
 # Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
 # 
-# Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
-# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 
 # simple include file to pre-define variables which are then +='d by other
 # scripts in this directory.
 
 # vim:ft=automake
-# Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
 # 
 # This library is free software; you can redistribute it and/or modify it
 # under the terms of the GNU Lesser General Public License version 2.1 as 
@@ -52,8 +52,8 @@
 # along with this library; if not, write to the Free Software Foundation,
 # Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
 # 
-# Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
-# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 
 # SYNOPSIS:
 #
 # Files which support it are syntax-checked when the user invokes 'make check'.
 #
 # All *target* filenames must be listed in SCRIPTS_SHELL, SCRIPTS_PERL, and 
-# SCRIPTS_AWK to support 'make check', 'make dist', and 'make distclean'.
+# SCRIPTS_AWK to support 'make check', 'make dist', and 'make distclean'. No
+# files which are not substituted by config.status should be included in
+# SCRIPTS_PERL, SCRIPTS_SHELL, or SCRIPTS_AWK.  If non-generated files are listed
+# for installation, then Automake will figure out that they should be distributed;
+# otherwise, include them in EXTRA_DIST.
 #
 # USAGE:
 #
 #   SCRIPTS_PERL = fooscript barscript perl-lib.pl perlmod.pm
 #   SCRIPTS_SHELL = shell1 shell2 sh-lib.sh
 #   SCRIPTS_AWK = talk balk chalk awk-lib.awk
+#   sbin_SCRIPTS = not-subbed
+#   EXTRA_DIST = util-script.pl
 #
 # with the corresponding files in the repository:
 #
 #   fooscript.pl barscript.pl perl-lib.pl.in perlmod.pm.in
 #   shell1.sh shell2.sh sh-lib.sh.in
 #   talk.awk balk.awk chalk.awk awk-lib.awk.in
+#   not-subbed util-script.pl
 #
 # by default, all shell and perl scripts are syntax checked.  If this is
 # a problem (for example, perl scripts depending on Amanda extension 
@@ -127,22 +134,27 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
 @WANT_RECOVER_TRUE@am__append_4 = -I$(top_srcdir)/recover-src
 
 # PACKAGE: Amanda::Changer
+
+# PACKAGE: Amanda::Process
 @WANT_SERVER_TRUE@am__append_5 = Amanda/Device.pm Amanda/Logfile.pm \
-@WANT_SERVER_TRUE@     Amanda/Cmdline.pm Amanda/Tapefile.pm \
-@WANT_SERVER_TRUE@     Amanda/Changer.pm
-@WANT_SERVER_TRUE@am__append_6 = Amanda/Device.swg Amanda/Device.pm \
-@WANT_SERVER_TRUE@     Amanda/Logfile.swg Amanda/Logfile.pm \
-@WANT_SERVER_TRUE@     Amanda/Cmdline.swg Amanda/Cmdline.pm \
-@WANT_SERVER_TRUE@     Amanda/Tapefile.swg Amanda/Tapefile.pm \
-@WANT_SERVER_TRUE@     Amanda/Changer.pm
-@WANT_SERVER_TRUE@am__append_7 = Amanda/Device.c Amanda/Device.pm \
+@WANT_SERVER_TRUE@     Amanda/Cmdline.pm Amanda/Tapelist.pm \
+@WANT_SERVER_TRUE@     Amanda/Changer.pm Amanda/Process.pm \
+@WANT_SERVER_TRUE@     Amanda/Xfer.pm
+@WANT_SERVER_TRUE@am__append_6 = Amanda/Device.c Amanda/Device.pm \
 @WANT_SERVER_TRUE@     Amanda/Logfile.c Amanda/Logfile.pm \
 @WANT_SERVER_TRUE@     Amanda/Cmdline.c Amanda/Cmdline.pm \
-@WANT_SERVER_TRUE@     Amanda/Tapefile.c Amanda/Tapefile.pm
+@WANT_SERVER_TRUE@     Amanda/Tapelist.c Amanda/Tapelist.pm \
+@WANT_SERVER_TRUE@     Amanda/Xfer.c Amanda/Xfer.pm
+@WANT_SERVER_TRUE@am__append_7 = $(AmandaChanger_DATA) \
+@WANT_SERVER_TRUE@     $(Amanda_DB_DATA)
+@WANT_CLIENT_TRUE@am__append_8 = Amanda/Application.pm
+@WANT_CLIENT_TRUE@am__append_9 = Amanda/Application.c Amanda/Application.pm
+@WANT_CLIENT_TRUE@am__append_10 = $(AmandaApplication_DATA)
 subdir = perl
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps =  \
        $(top_srcdir)/config/macro-archive/ac_define_dir.m4 \
+       $(top_srcdir)/config/macro-archive/ac_perl_module_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_perl_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_swig.m4 \
        $(top_srcdir)/config/macro-archive/ax_compare_version.m4 \
@@ -176,6 +188,7 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/amanda/libs.m4 \
        $(top_srcdir)/config/amanda/net.m4 \
        $(top_srcdir)/config/amanda/progs.m4 \
+       $(top_srcdir)/config/amanda/ps.m4 \
        $(top_srcdir)/config/amanda/readdir.m4 \
        $(top_srcdir)/config/amanda/readline.m4 \
        $(top_srcdir)/config/amanda/rsh-security.m4 \
@@ -198,7 +211,9 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/float_h.m4 \
        $(top_srcdir)/config/gnulib/fsusage.m4 \
        $(top_srcdir)/config/gnulib/getaddrinfo.m4 \
+       $(top_srcdir)/config/gnulib/getopt.m4 \
        $(top_srcdir)/config/gnulib/gettimeofday.m4 \
+       $(top_srcdir)/config/gnulib/gnulib-common.m4 \
        $(top_srcdir)/config/gnulib/gnulib-comp.m4 \
        $(top_srcdir)/config/gnulib/include_next.m4 \
        $(top_srcdir)/config/gnulib/inet_ntop.m4 \
@@ -226,7 +241,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/sys_stat_h.m4 \
        $(top_srcdir)/config/gnulib/sys_time_h.m4 \
        $(top_srcdir)/config/gnulib/tempname.m4 \
-       $(top_srcdir)/config/gnulib/ulonglong.m4 \
        $(top_srcdir)/config/gnulib/unistd_h.m4 \
        $(top_srcdir)/config/gnulib/vasnprintf.m4 \
        $(top_srcdir)/config/gnulib/visibility.m4 \
@@ -237,7 +251,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gettext-macros/lib-ld.m4 \
        $(top_srcdir)/config/gettext-macros/lib-link.m4 \
        $(top_srcdir)/config/gettext-macros/lib-prefix.m4 \
-       $(top_srcdir)/config/gettext-macros/longlong.m4 \
        $(top_srcdir)/config/gettext-macros/nls.m4 \
        $(top_srcdir)/config/gettext-macros/po.m4 \
        $(top_srcdir)/config/gettext-macros/progtest.m4 \
@@ -258,32 +271,65 @@ am__vpath_adj = case $$p in \
     *) f=$$p;; \
   esac;
 am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
-am__installdirs = "$(DESTDIR)$(amlibdir)" "$(DESTDIR)$(libCmdlinedir)" \
-       "$(DESTDIR)$(libConfigdir)" "$(DESTDIR)$(libDebugdir)" \
-       "$(DESTDIR)$(libDevicedir)" "$(DESTDIR)$(libLogfiledir)" \
-       "$(DESTDIR)$(libTapefiledir)" "$(DESTDIR)$(libTypesdir)" \
-       "$(DESTDIR)$(libUtildir)" "$(DESTDIR)$(Amandadir)"
+am__installdirs = "$(DESTDIR)$(amlibdir)" \
+       "$(DESTDIR)$(libApplicationdir)" "$(DESTDIR)$(libArchivedir)" \
+       "$(DESTDIR)$(libCmdlinedir)" "$(DESTDIR)$(libConfigdir)" \
+       "$(DESTDIR)$(libDebugdir)" "$(DESTDIR)$(libDevicedir)" \
+       "$(DESTDIR)$(libLogfiledir)" "$(DESTDIR)$(libMainLoopdir)" \
+       "$(DESTDIR)$(libTapelistdir)" "$(DESTDIR)$(libTestsdir)" \
+       "$(DESTDIR)$(libTypesdir)" "$(DESTDIR)$(libUtildir)" \
+       "$(DESTDIR)$(libXferdir)" "$(DESTDIR)$(Amandadir)" \
+       "$(DESTDIR)$(AmandaApplicationdir)" \
+       "$(DESTDIR)$(AmandaChangerdir)" "$(DESTDIR)$(Amanda_DBdir)"
 amlibLTLIBRARIES_INSTALL = $(INSTALL)
+libApplicationLTLIBRARIES_INSTALL = $(INSTALL)
+libArchiveLTLIBRARIES_INSTALL = $(INSTALL)
 libCmdlineLTLIBRARIES_INSTALL = $(INSTALL)
 libConfigLTLIBRARIES_INSTALL = $(INSTALL)
 libDebugLTLIBRARIES_INSTALL = $(INSTALL)
 libDeviceLTLIBRARIES_INSTALL = $(INSTALL)
 libLogfileLTLIBRARIES_INSTALL = $(INSTALL)
-libTapefileLTLIBRARIES_INSTALL = $(INSTALL)
+libMainLoopLTLIBRARIES_INSTALL = $(INSTALL)
+libTapelistLTLIBRARIES_INSTALL = $(INSTALL)
+libTestsLTLIBRARIES_INSTALL = $(INSTALL)
 libTypesLTLIBRARIES_INSTALL = $(INSTALL)
 libUtilLTLIBRARIES_INSTALL = $(INSTALL)
-LTLIBRARIES = $(amlib_LTLIBRARIES) $(libCmdline_LTLIBRARIES) \
+libXferLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(amlib_LTLIBRARIES) $(libApplication_LTLIBRARIES) \
+       $(libArchive_LTLIBRARIES) $(libCmdline_LTLIBRARIES) \
        $(libConfig_LTLIBRARIES) $(libDebug_LTLIBRARIES) \
        $(libDevice_LTLIBRARIES) $(libLogfile_LTLIBRARIES) \
-       $(libTapefile_LTLIBRARIES) $(libTypes_LTLIBRARIES) \
-       $(libUtil_LTLIBRARIES)
+       $(libMainLoop_LTLIBRARIES) $(libTapelist_LTLIBRARIES) \
+       $(libTests_LTLIBRARIES) $(libTypes_LTLIBRARIES) \
+       $(libUtil_LTLIBRARIES) $(libXfer_LTLIBRARIES)
+@WANT_CLIENT_TRUE@libApplication_la_DEPENDENCIES = libamglue.la \
+@WANT_CLIENT_TRUE@     $(top_builddir)/client-src/libamclient.la
+am__libApplication_la_SOURCES_DIST = Amanda/Application.c \
+       amglue/amglue.swg amglue/constants.swg amglue/dumpspecs.swg \
+       amglue/exports.swg amglue/glib.swg amglue/integers.swg
+am__objects_1 =
+@WANT_CLIENT_TRUE@am_libApplication_la_OBJECTS = Application.lo \
+@WANT_CLIENT_TRUE@     $(am__objects_1)
+libApplication_la_OBJECTS = $(am_libApplication_la_OBJECTS)
+libApplication_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+       $(libApplication_la_LDFLAGS) $(LDFLAGS) -o $@
+@WANT_CLIENT_TRUE@am_libApplication_la_rpath = -rpath \
+@WANT_CLIENT_TRUE@     $(libApplicationdir)
+libArchive_la_DEPENDENCIES = libamglue.la \
+       $(top_builddir)/amar-src/libamar.la \
+       $(top_builddir)/common-src/libamanda.la
+am_libArchive_la_OBJECTS = Archive.lo $(am__objects_1)
+libArchive_la_OBJECTS = $(am_libArchive_la_OBJECTS)
+libArchive_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+       $(libArchive_la_LDFLAGS) $(LDFLAGS) -o $@
 @WANT_SERVER_TRUE@libCmdline_la_DEPENDENCIES = libamglue.la \
 @WANT_SERVER_TRUE@     $(top_builddir)/server-src/libamserver.la \
 @WANT_SERVER_TRUE@     $(top_builddir)/common-src/libamanda.la
 am__libCmdline_la_SOURCES_DIST = Amanda/Cmdline.c amglue/amglue.swg \
        amglue/constants.swg amglue/dumpspecs.swg amglue/exports.swg \
        amglue/glib.swg amglue/integers.swg
-am__objects_1 =
 @WANT_SERVER_TRUE@am_libCmdline_la_OBJECTS = Cmdline.lo \
 @WANT_SERVER_TRUE@     $(am__objects_1)
 libCmdline_la_OBJECTS = $(am_libCmdline_la_OBJECTS)
@@ -330,19 +376,33 @@ libLogfile_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
        $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
        $(libLogfile_la_LDFLAGS) $(LDFLAGS) -o $@
 @WANT_SERVER_TRUE@am_libLogfile_la_rpath = -rpath $(libLogfiledir)
-@WANT_SERVER_TRUE@libTapefile_la_DEPENDENCIES = libamglue.la \
+libMainLoop_la_DEPENDENCIES = libamglue.la \
+       $(top_builddir)/common-src/libamanda.la
+am_libMainLoop_la_OBJECTS = MainLoop.lo $(am__objects_1)
+libMainLoop_la_OBJECTS = $(am_libMainLoop_la_OBJECTS)
+libMainLoop_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+       $(libMainLoop_la_LDFLAGS) $(LDFLAGS) -o $@
+@WANT_SERVER_TRUE@libTapelist_la_DEPENDENCIES = libamglue.la \
 @WANT_SERVER_TRUE@     $(top_builddir)/server-src/libamserver.la \
 @WANT_SERVER_TRUE@     $(top_builddir)/common-src/libamanda.la
-am__libTapefile_la_SOURCES_DIST = Amanda/Tapefile.c amglue/amglue.swg \
+am__libTapelist_la_SOURCES_DIST = Amanda/Tapelist.c amglue/amglue.swg \
        amglue/constants.swg amglue/dumpspecs.swg amglue/exports.swg \
        amglue/glib.swg amglue/integers.swg
-@WANT_SERVER_TRUE@am_libTapefile_la_OBJECTS = Tapefile.lo \
+@WANT_SERVER_TRUE@am_libTapelist_la_OBJECTS = Tapelist.lo \
 @WANT_SERVER_TRUE@     $(am__objects_1)
-libTapefile_la_OBJECTS = $(am_libTapefile_la_OBJECTS)
-libTapefile_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+libTapelist_la_OBJECTS = $(am_libTapelist_la_OBJECTS)
+libTapelist_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
        $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
-       $(libTapefile_la_LDFLAGS) $(LDFLAGS) -o $@
-@WANT_SERVER_TRUE@am_libTapefile_la_rpath = -rpath $(libTapefiledir)
+       $(libTapelist_la_LDFLAGS) $(LDFLAGS) -o $@
+@WANT_SERVER_TRUE@am_libTapelist_la_rpath = -rpath $(libTapelistdir)
+libTests_la_DEPENDENCIES = libamglue.la \
+       $(top_builddir)/common-src/libamanda.la
+am_libTests_la_OBJECTS = Tests.lo $(am__objects_1)
+libTests_la_OBJECTS = $(am_libTests_la_OBJECTS)
+libTests_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+       $(libTests_la_LDFLAGS) $(LDFLAGS) -o $@
 libTypes_la_DEPENDENCIES = libamglue.la \
        $(top_builddir)/common-src/libamanda.la
 am_libTypes_la_OBJECTS = Types.lo $(am__objects_1)
@@ -357,13 +417,25 @@ libUtil_la_OBJECTS = $(am_libUtil_la_OBJECTS)
 libUtil_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
        $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
        $(libUtil_la_LDFLAGS) $(LDFLAGS) -o $@
+@WANT_SERVER_TRUE@libXfer_la_DEPENDENCIES = libamglue.la \
+@WANT_SERVER_TRUE@     $(top_builddir)/xfer-src/libamxfer.la \
+@WANT_SERVER_TRUE@     $(top_builddir)/common-src/libamanda.la
+am__libXfer_la_SOURCES_DIST = Amanda/Xfer.c amglue/amglue.swg \
+       amglue/constants.swg amglue/dumpspecs.swg amglue/exports.swg \
+       amglue/glib.swg amglue/integers.swg
+@WANT_SERVER_TRUE@am_libXfer_la_OBJECTS = Xfer.lo $(am__objects_1)
+libXfer_la_OBJECTS = $(am_libXfer_la_OBJECTS)
+libXfer_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+       $(libXfer_la_LDFLAGS) $(LDFLAGS) -o $@
+@WANT_SERVER_TRUE@am_libXfer_la_rpath = -rpath $(libXferdir)
 libamglue_la_LIBADD =
-am_libamglue_la_OBJECTS = ghashtable.lo bigint.lo
+am_libamglue_la_OBJECTS = ghashtable.lo bigint.lo source.lo
 libamglue_la_OBJECTS = $(am_libamglue_la_OBJECTS)
 libamglue_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
        $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
        $(libamglue_la_LDFLAGS) $(LDFLAGS) -o $@
-DEFAULT_INCLUDES = -I. -I$(top_builddir)/config@am__isrc@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/config
 depcomp = $(SHELL) $(top_srcdir)/config/depcomp
 am__depfiles_maybe = depfiles
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
@@ -375,23 +447,32 @@ CCLD = $(CC)
 LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
        --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
        $(LDFLAGS) -o $@
-SOURCES = $(libCmdline_la_SOURCES) $(libConfig_la_SOURCES) \
+SOURCES = $(libApplication_la_SOURCES) $(libArchive_la_SOURCES) \
+       $(libCmdline_la_SOURCES) $(libConfig_la_SOURCES) \
        $(libDebug_la_SOURCES) $(libDevice_la_SOURCES) \
-       $(libLogfile_la_SOURCES) $(libTapefile_la_SOURCES) \
+       $(libLogfile_la_SOURCES) $(libMainLoop_la_SOURCES) \
+       $(libTapelist_la_SOURCES) $(libTests_la_SOURCES) \
        $(libTypes_la_SOURCES) $(libUtil_la_SOURCES) \
-       $(libamglue_la_SOURCES)
-DIST_SOURCES = $(am__libCmdline_la_SOURCES_DIST) \
+       $(libXfer_la_SOURCES) $(libamglue_la_SOURCES)
+DIST_SOURCES = $(am__libApplication_la_SOURCES_DIST) \
+       $(libArchive_la_SOURCES) $(am__libCmdline_la_SOURCES_DIST) \
        $(libConfig_la_SOURCES) $(libDebug_la_SOURCES) \
        $(am__libDevice_la_SOURCES_DIST) \
-       $(am__libLogfile_la_SOURCES_DIST) \
-       $(am__libTapefile_la_SOURCES_DIST) $(libTypes_la_SOURCES) \
-       $(libUtil_la_SOURCES) $(libamglue_la_SOURCES)
+       $(am__libLogfile_la_SOURCES_DIST) $(libMainLoop_la_SOURCES) \
+       $(am__libTapelist_la_SOURCES_DIST) $(libTests_la_SOURCES) \
+       $(libTypes_la_SOURCES) $(libUtil_la_SOURCES) \
+       $(am__libXfer_la_SOURCES_DIST) $(libamglue_la_SOURCES)
 AmandaDATA_INSTALL = $(INSTALL_DATA)
-DATA = $(Amanda_DATA)
+AmandaApplicationDATA_INSTALL = $(INSTALL_DATA)
+AmandaChangerDATA_INSTALL = $(INSTALL_DATA)
+Amanda_DBDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(Amanda_DATA) $(AmandaApplication_DATA) $(AmandaChanger_DATA) \
+       $(Amanda_DB_DATA)
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
+AIX_BACKUP = @AIX_BACKUP@
 ALLOCA = @ALLOCA@
 ALLOCA_H = @ALLOCA_H@
 AMANDA_DBGDIR = @AMANDA_DBGDIR@
@@ -406,8 +487,10 @@ AMPLOT_CAT_GZIP = @AMPLOT_CAT_GZIP@
 AMPLOT_CAT_PACK = @AMPLOT_CAT_PACK@
 AMPLOT_COMPRESS = @AMPLOT_COMPRESS@
 AMTAR = @AMTAR@
+APPLICATION_DIR = @APPLICATION_DIR@
 AR = @AR@
 ARPA_INET_H = @ARPA_INET_H@
+ASSERTIONS = @ASSERTIONS@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -419,16 +502,28 @@ BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@
 BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@
 BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@
 BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@
+BSDTCP_SECURITY = @BSDTCP_SECURITY@
+BSDUDP_SECURITY = @BSDUDP_SECURITY@
+BSD_SECURITY = @BSD_SECURITY@
 CAT = @CAT@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
+CHECK_USERID = @CHECK_USERID@
 CHIO = @CHIO@
 CHS = @CHS@
+CLIENT_HOST_INSTANCE = @CLIENT_HOST_INSTANCE@
+CLIENT_HOST_KEY_FILE = @CLIENT_HOST_KEY_FILE@
+CLIENT_HOST_PRINCIPAL = @CLIENT_HOST_PRINCIPAL@
 CLIENT_LOGIN = @CLIENT_LOGIN@
 CLIENT_SCRIPTS_OPT = @CLIENT_SCRIPTS_OPT@
 COMPRESS = @COMPRESS@
+COMPRESS_BEST_OPT = @COMPRESS_BEST_OPT@
+COMPRESS_FAST_OPT = @COMPRESS_FAST_OPT@
+COMPRESS_PATH = @COMPRESS_PATH@
+COMPRESS_SUFFIX = @COMPRESS_SUFFIX@
+CONFIG_CLOBBER_MY_CONFIG = @CONFIG_CLOBBER_MY_CONFIG@
 CONFIG_DIR = @CONFIG_DIR@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
@@ -442,6 +537,7 @@ DD = @DD@
 DEFAULT_AMANDATES_FILE = @DEFAULT_AMANDATES_FILE@
 DEFAULT_CHANGER_DEVICE = @DEFAULT_CHANGER_DEVICE@
 DEFAULT_CONFIG = @DEFAULT_CONFIG@
+DEFAULT_MAILER = @DEFAULT_MAILER@
 DEFAULT_SERVER = @DEFAULT_SERVER@
 DEFAULT_TAPE_DEVICE = @DEFAULT_TAPE_DEVICE@
 DEFAULT_TAPE_SERVER = @DEFAULT_TAPE_SERVER@
@@ -449,7 +545,7 @@ DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DOC_BUILD_DATE = @DOC_BUILD_DATE@
 DUMP = @DUMP@
-DUMPER_DIR = @DUMPER_DIR@
+DUMP_RETURNS_1 = @DUMP_RETURNS_1@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -462,6 +558,7 @@ F77 = @F77@
 FFLAGS = @FFLAGS@
 FLOAT_H = @FLOAT_H@
 GETCONF = @GETCONF@
+GETOPT_H = @GETOPT_H@
 GETTEXT = @GETTEXT@
 GLIB_CFLAGS = @GLIB_CFLAGS@
 GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
@@ -472,9 +569,12 @@ GMSGFMT_015 = @GMSGFMT_015@
 GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
 GNULIB_CHOWN = @GNULIB_CHOWN@
 GNULIB_DUP2 = @GNULIB_DUP2@
+GNULIB_ENVIRON = @GNULIB_ENVIRON@
 GNULIB_FCHDIR = @GNULIB_FCHDIR@
 GNULIB_FFLUSH = @GNULIB_FFLUSH@
+GNULIB_FOPEN = @GNULIB_FOPEN@
 GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
+GNULIB_FREOPEN = @GNULIB_FREOPEN@
 GNULIB_FSEEK = @GNULIB_FSEEK@
 GNULIB_FSEEKO = @GNULIB_FSEEKO@
 GNULIB_FTELL = @GNULIB_FTELL@
@@ -484,6 +584,7 @@ GNULIB_GETCWD = @GNULIB_GETCWD@
 GNULIB_GETDELIM = @GNULIB_GETDELIM@
 GNULIB_GETLINE = @GNULIB_GETLINE@
 GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
+GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@
 GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
 GNULIB_LCHOWN = @GNULIB_LCHOWN@
 GNULIB_LSEEK = @GNULIB_LSEEK@
@@ -508,8 +609,10 @@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
 GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
 GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
 GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
+GNULIB_PUTENV = @GNULIB_PUTENV@
 GNULIB_READLINK = @GNULIB_READLINK@
 GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@
+GNULIB_SETENV = @GNULIB_SETENV@
 GNULIB_SLEEP = @GNULIB_SLEEP@
 GNULIB_SNPRINTF = @GNULIB_SNPRINTF@
 GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@
@@ -518,11 +621,15 @@ GNULIB_STPNCPY = @GNULIB_STPNCPY@
 GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
 GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
 GNULIB_STRDUP = @GNULIB_STRDUP@
+GNULIB_STRERROR = @GNULIB_STRERROR@
 GNULIB_STRNDUP = @GNULIB_STRNDUP@
 GNULIB_STRNLEN = @GNULIB_STRNLEN@
 GNULIB_STRPBRK = @GNULIB_STRPBRK@
 GNULIB_STRSEP = @GNULIB_STRSEP@
+GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@
+GNULIB_STRSTR = @GNULIB_STRSTR@
 GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
+GNULIB_UNSETENV = @GNULIB_UNSETENV@
 GNULIB_VASPRINTF = @GNULIB_VASPRINTF@
 GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@
 GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
@@ -536,6 +643,7 @@ GOBJECT_QUERY = @GOBJECT_QUERY@
 GREP = @GREP@
 GZIP = @GZIP@
 HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@
+HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@
 HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@
 HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@
 HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
@@ -544,9 +652,10 @@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
 HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@
 HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
 HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
-HAVE_DECL_STRNCASECMP = @HAVE_DECL_STRNCASECMP@
+HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@
 HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
 HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
+HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@
 HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
 HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
 HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
@@ -554,7 +663,9 @@ HAVE_DUP2 = @HAVE_DUP2@
 HAVE_FSEEKO = @HAVE_FSEEKO@
 HAVE_FTELLO = @HAVE_FTELLO@
 HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
+HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
 HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
+HAVE_GZIP = @HAVE_GZIP@
 HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
 HAVE_IO_H = @HAVE_IO_H@
 HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
@@ -563,8 +674,10 @@ HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@
 HAVE_MEMPCPY = @HAVE_MEMPCPY@
 HAVE_MKDTEMP = @HAVE_MKDTEMP@
 HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@
+HAVE_OS_H = @HAVE_OS_H@
 HAVE_READLINK = @HAVE_READLINK@
 HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@
+HAVE_SETENV = @HAVE_SETENV@
 HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
 HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
 HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
@@ -572,7 +685,6 @@ HAVE_SLEEP = @HAVE_SLEEP@
 HAVE_STDINT_H = @HAVE_STDINT_H@
 HAVE_STPCPY = @HAVE_STPCPY@
 HAVE_STPNCPY = @HAVE_STPNCPY@
-HAVE_STRCASECMP = @HAVE_STRCASECMP@
 HAVE_STRCASESTR = @HAVE_STRCASESTR@
 HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
 HAVE_STRNDUP = @HAVE_STRNDUP@
@@ -581,10 +693,12 @@ HAVE_STRSEP = @HAVE_STRSEP@
 HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@
 HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
 HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
+HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
 HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
 HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
 HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
 HAVE_UNISTD_H = @HAVE_UNISTD_H@
+HAVE_UNSETENV = @HAVE_UNSETENV@
 HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
 HAVE_VASPRINTF = @HAVE_VASPRINTF@
 HAVE_VISIBILITY = @HAVE_VISIBILITY@
@@ -600,6 +714,8 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 INTLLIBS = @INTLLIBS@
 INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+KRB4_SECURITY = @KRB4_SECURITY@
+KRB5_SECURITY = @KRB5_SECURITY@
 LDFLAGS = @LDFLAGS@
 LEX = @LEX@
 LEXLIB = @LEXLIB@
@@ -616,6 +732,8 @@ LIBTHREAD = @LIBTHREAD@
 LIBTOOL = @LIBTOOL@
 LIBTOOL_DEPS = @LIBTOOL_DEPS@
 LN_S = @LN_S@
+LOCKING = @LOCKING@
+LOW_TCPPORTRANGE = @LOW_TCPPORTRANGE@
 LTLIBICONV = @LTLIBICONV@
 LTLIBINTL = @LTLIBINTL@
 LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
@@ -624,7 +742,6 @@ LTLIBPTH = @LTLIBPTH@
 LTLIBTHREAD = @LTLIBTHREAD@
 MAILER = @MAILER@
 MAKEINFO = @MAKEINFO@
-MAXTAPEBLOCKSIZE = @MAXTAPEBLOCKSIZE@
 MCUTIL = @MCUTIL@
 MKDIR_P = @MKDIR_P@
 MSGFMT = @MSGFMT@
@@ -660,26 +777,37 @@ PERL_INC = @PERL_INC@
 PKG_CONFIG = @PKG_CONFIG@
 POSUB = @POSUB@
 PRINT = @PRINT@
+PS = @PS@
+PS_ARGUMENT = @PS_ARGUMENT@
 PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
 RANLIB = @RANLIB@
 READLINE_LIBS = @READLINE_LIBS@
 REPLACE_CHOWN = @REPLACE_CHOWN@
 REPLACE_FCHDIR = @REPLACE_FCHDIR@
 REPLACE_FFLUSH = @REPLACE_FFLUSH@
+REPLACE_FOPEN = @REPLACE_FOPEN@
 REPLACE_FPRINTF = @REPLACE_FPRINTF@
+REPLACE_FREOPEN = @REPLACE_FREOPEN@
 REPLACE_FSEEK = @REPLACE_FSEEK@
 REPLACE_FSEEKO = @REPLACE_FSEEKO@
 REPLACE_FTELL = @REPLACE_FTELL@
 REPLACE_FTELLO = @REPLACE_FTELLO@
 REPLACE_GETCWD = @REPLACE_GETCWD@
 REPLACE_GETLINE = @REPLACE_GETLINE@
+REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
 REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
 REPLACE_LCHOWN = @REPLACE_LCHOWN@
 REPLACE_LSEEK = @REPLACE_LSEEK@
+REPLACE_MEMMEM = @REPLACE_MEMMEM@
 REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
 REPLACE_PRINTF = @REPLACE_PRINTF@
+REPLACE_PUTENV = @REPLACE_PUTENV@
 REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
 REPLACE_SPRINTF = @REPLACE_SPRINTF@
+REPLACE_STRCASESTR = @REPLACE_STRCASESTR@
+REPLACE_STRERROR = @REPLACE_STRERROR@
+REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@
+REPLACE_STRSTR = @REPLACE_STRSTR@
 REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
 REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
 REPLACE_VPRINTF = @REPLACE_VPRINTF@
@@ -687,7 +815,11 @@ REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
 REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
 REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
 RESTORE = @RESTORE@
+RSH_SECURITY = @RSH_SECURITY@
 SAMBA_CLIENT = @SAMBA_CLIENT@
+SERVER_HOST_INSTANCE = @SERVER_HOST_INSTANCE@
+SERVER_HOST_KEY_FILE = @SERVER_HOST_KEY_FILE@
+SERVER_HOST_PRINCIPAL = @SERVER_HOST_PRINCIPAL@
 SERVICE_SUFFIX = @SERVICE_SUFFIX@
 SETUID_GROUP = @SETUID_GROUP@
 SET_MAKE = @SET_MAKE@
@@ -697,6 +829,7 @@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
 SNAPSHOT_STAMP = @SNAPSHOT_STAMP@
 SORT = @SORT@
 SSH = @SSH@
+SSH_SECURITY = @SSH_SECURITY@
 STDBOOL_H = @STDBOOL_H@
 STDINT_H = @STDINT_H@
 STRIP = @STRIP@
@@ -706,7 +839,14 @@ SWIG_LIB = @SWIG_LIB@
 SYS_SOCKET_H = @SYS_SOCKET_H@
 SYS_STAT_H = @SYS_STAT_H@
 SYS_TIME_H = @SYS_TIME_H@
+TCPPORTRANGE = @TCPPORTRANGE@
+TICKET_LIFETIME = @TICKET_LIFETIME@
+UDPPORTRANGE = @UDPPORTRANGE@
+UNCOMPRESS_OPT = @UNCOMPRESS_OPT@
+UNCOMPRESS_PATH = @UNCOMPRESS_PATH@
+USE_AMANDAHOSTS = @USE_AMANDAHOSTS@
 USE_NLS = @USE_NLS@
+USE_RUNDUMP = @USE_RUNDUMP@
 USE_VERSION_SUFFIXES = @USE_VERSION_SUFFIXES@
 VDUMP = @VDUMP@
 VERSION = @VERSION@
@@ -715,6 +855,7 @@ VERSION_MAJOR = @VERSION_MAJOR@
 VERSION_MINOR = @VERSION_MINOR@
 VERSION_PATCH = @VERSION_PATCH@
 VERSION_SUFFIX = @VERSION_SUFFIX@
+VOID_UNSETENV = @VOID_UNSETENV@
 VRESTORE = @VRESTORE@
 VXDUMP = @VXDUMP@
 VXRESTORE = @VXRESTORE@
@@ -743,6 +884,7 @@ am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+amdatadir = @amdatadir@
 amincludedir = @amincludedir@
 amlibdir = @amlibdir@
 amlibexecdir = @amlibexecdir@
@@ -761,6 +903,8 @@ dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 gl_LIBOBJS = @gl_LIBOBJS@
 gl_LTLIBOBJS = @gl_LTLIBOBJS@
+gltests_LIBOBJS = @gltests_LIBOBJS@
+gltests_LTLIBOBJS = @gltests_LTLIBOBJS@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
@@ -790,13 +934,24 @@ target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 SUFFIXES = 
-EXTRA_DIST = $(libamglue_la_SOURCES) $(AMGLUE_SWG) $(am__append_6) \
-       Amanda/Debug.swg Amanda/Debug.pm Amanda/Config.swg \
-       Amanda/Config.pm Amanda/Util.swg Amanda/Util.pm \
-       Amanda/Types.swg Amanda/Types.pm Amanda/Paths.pm.in
+EXTRA_DIST = $(libamglue_la_SOURCES) $(AMGLUE_SWG) Amanda/Archive.swg \
+       Amanda/Archive.pm Amanda/Device.swg Amanda/Device.pm \
+       Amanda/Logfile.swg Amanda/Logfile.pm Amanda/Cmdline.swg \
+       Amanda/Cmdline.pm Amanda/Tapelist.swg Amanda/Tapelist.pm \
+       Amanda/Changer.pm $(AmandaChanger_DATA) Amanda/Process.pm \
+       Amanda/DB/Catalog.pm Amanda/Xfer.swg Amanda/Xfer.pm \
+       Amanda/BigIntCompat.pm Amanda/Debug.swg Amanda/Debug.pm \
+       Amanda/Config.swg Amanda/Config.pm Amanda/Util.swg \
+       Amanda/Util.pm Amanda/Types.swg Amanda/Types.pm \
+       Amanda/Tests.swg Amanda/Tests.pm Amanda/MainLoop.swg \
+       Amanda/MainLoop.pm Amanda/Paths.pm.in Amanda/Constants.pm.in \
+       Amanda/Script_App.pm Amanda/Application.swg \
+       Amanda/Application.pm Amanda/Script.pm \
+       Amanda/Application/Zfs.pm
 BUILT_SOURCES = 
 MOSTLYCLEANFILES = 
 
@@ -805,10 +960,12 @@ CLEANFILES = config.log
 
 # and we'll need to clean up our generated files for distclean
 DISTCLEANFILES = $(SCRIPTS_SHELL) $(SCRIPTS_PERL) $(SCRIPTS_AWK) \
-       Amanda/Paths.pm
-MAINTAINERCLEANFILES = $(am__append_7) Amanda/Debug.c Amanda/Debug.pm \
-       Amanda/Config.c Amanda/Config.pm Amanda/Util.c Amanda/Util.pm \
-       Amanda/Types.c Amanda/Types.pm
+       $(SCRIPTS_INCLUDE) Amanda/Paths.pm Amanda/Constants.pm
+MAINTAINERCLEANFILES = Amanda/Archive.c Amanda/Archive.pm \
+       $(am__append_6) Amanda/Debug.c Amanda/Debug.pm Amanda/Config.c \
+       Amanda/Config.pm Amanda/Util.c Amanda/Util.pm Amanda/Types.c \
+       Amanda/Types.pm Amanda/Tests.c Amanda/Tests.pm \
+       Amanda/MainLoop.c Amanda/MainLoop.pm $(am__append_9)
 
 # syntax-check shell scripts on 'make check'
 CHECK_SHELL = $(SCRIPTS_SHELL)
@@ -821,15 +978,17 @@ AM_CFLAGS = -DSWIG
 # Appropriate INCLUDES depends on which components (server or client) are 
 # being built
 INCLUDES = -I$(top_builddir)/common-src -I$(top_srcdir)/common-src \
-       -I$(top_srcdir)/perl/amglue -I$(top_srcdir)/gnulib $(PERL_INC) \
-       $(am__append_1) $(am__append_2) $(am__append_3) \
-       $(am__append_4)
+       -I$(top_srcdir)/amandad-src -I$(top_srcdir)/amar-src \
+       -I$(top_srcdir)/xfer-src -I$(top_srcdir)/perl/amglue \
+       -I$(top_srcdir)/gnulib $(PERL_INC) $(am__append_1) \
+       $(am__append_2) $(am__append_3) $(am__append_4)
 
 # (amplot has a conditional, but doesn't have any header files)
 amlib_LTLIBRARIES = libamglue.la
 libamglue_la_SOURCES = \
        amglue/ghashtable.c \
        amglue/bigint.c \
+       amglue/source.c \
        amglue/amglue.h
 
 libamglue_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
@@ -842,7 +1001,7 @@ libamglue_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
 # HTML_SOURCE_FILES should contain the .pm files from which the HTML should
 # be geneated.  This is just the concatenation of foo_DATA for all $(foodir)
 # into which perl modules are installed.
-HTML_SOURCE_FILES = $(Amanda_DATA)
+HTML_SOURCE_FILES = $(Amanda_DATA) $(am__append_7) $(am__append_10)
 
 # Tell libtool to not bother versioning the libs we build, since perl won't
 # pay attention to such things, anyway.
@@ -869,9 +1028,30 @@ AMGLUE_SWG = amglue/amglue.swg \
 SWIG_OPTIONS = -perl5 -proxy -DSWIG_TYPE_TABLE=SWIG_TYPES_Amanda -I$(srcdir)
 Amandadir = $(amperldir)/Amanda
 
+# PACKAGE: Amanda::BigIntCompat
+
 # PACKAGE: Amanda::Paths
-Amanda_DATA = $(am__append_5) Amanda/Debug.pm Amanda/Config.pm \
-       Amanda/Util.pm Amanda/Types.pm Amanda/Paths.pm
+
+# PACKAGE: Amanda::Constants
+
+# PACKAGE: Amanda::Script_App
+
+# PACKAGE: Amanda::Script
+Amanda_DATA = Amanda/Archive.pm $(am__append_5) Amanda/BigIntCompat.pm \
+       Amanda/Debug.pm Amanda/Config.pm Amanda/Util.pm \
+       Amanda/Types.pm Amanda/Tests.pm Amanda/MainLoop.pm \
+       Amanda/Paths.pm Amanda/Constants.pm Amanda/Script_App.pm \
+       $(am__append_8) Amanda/Script.pm
+
+# PACKAGE: Amanda::Archive
+libArchivedir = $(amperldir)/auto/Amanda/Archive
+libArchive_LTLIBRARIES = libArchive.la
+libArchive_la_SOURCES = Amanda/Archive.c $(AMGLUE_SWG)
+libArchive_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
+libArchive_la_LIBADD = libamglue.la \
+       $(top_builddir)/amar-src/libamar.la \
+       $(top_builddir)/common-src/libamanda.la
+
 
 # PACKAGE: Amanda::Device
 @WANT_SERVER_TRUE@libDevicedir = $(amperldir)/auto/Amanda/Device
@@ -903,16 +1083,40 @@ Amanda_DATA = $(am__append_5) Amanda/Debug.pm Amanda/Config.pm \
 @WANT_SERVER_TRUE@     $(top_builddir)/common-src/libamanda.la
 
 
-# PACKAGE: Amanda::Tapefile
-@WANT_SERVER_TRUE@libTapefiledir = $(amperldir)/auto/Amanda/Tapefile
-@WANT_SERVER_TRUE@libTapefile_LTLIBRARIES = libTapefile.la
-@WANT_SERVER_TRUE@libTapefile_la_SOURCES = Amanda/Tapefile.c $(AMGLUE_SWG)
-@WANT_SERVER_TRUE@libTapefile_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
-@WANT_SERVER_TRUE@libTapefile_la_LIBADD = libamglue.la \
+# PACKAGE: Amanda::Tapelist
+@WANT_SERVER_TRUE@libTapelistdir = $(amperldir)/auto/Amanda/Tapelist
+@WANT_SERVER_TRUE@libTapelist_LTLIBRARIES = libTapelist.la
+@WANT_SERVER_TRUE@libTapelist_la_SOURCES = Amanda/Tapelist.c $(AMGLUE_SWG)
+@WANT_SERVER_TRUE@libTapelist_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
+@WANT_SERVER_TRUE@libTapelist_la_LIBADD = libamglue.la \
 @WANT_SERVER_TRUE@     $(top_builddir)/server-src/libamserver.la \
 @WANT_SERVER_TRUE@     $(top_builddir)/common-src/libamanda.la
 
 
+# PACKAGE: Amanda::Changer::*
+@WANT_SERVER_TRUE@AmandaChangerdir = $(amperldir)/Amanda/Changer
+@WANT_SERVER_TRUE@AmandaChanger_DATA = \
+@WANT_SERVER_TRUE@     Amanda/Changer/disk.pm \
+@WANT_SERVER_TRUE@     Amanda/Changer/compat.pm \
+@WANT_SERVER_TRUE@     Amanda/Changer/single.pm
+
+
+# PACKAGE: Amanda::DB::*
+@WANT_SERVER_TRUE@Amanda_DBdir = $(Amandadir)/DB
+
+# PACKAGE: Amanda::DB::Catalog
+@WANT_SERVER_TRUE@Amanda_DB_DATA = Amanda/DB/Catalog.pm
+
+# PACKAGE: Amanda::Xfer
+@WANT_SERVER_TRUE@libXferdir = $(amperldir)/auto/Amanda/Xfer
+@WANT_SERVER_TRUE@libXfer_LTLIBRARIES = libXfer.la
+@WANT_SERVER_TRUE@libXfer_la_SOURCES = Amanda/Xfer.c $(AMGLUE_SWG)
+@WANT_SERVER_TRUE@libXfer_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
+@WANT_SERVER_TRUE@libXfer_la_LIBADD = libamglue.la \
+@WANT_SERVER_TRUE@     $(top_builddir)/xfer-src/libamxfer.la \
+@WANT_SERVER_TRUE@     $(top_builddir)/common-src/libamanda.la
+
+
 # PACKAGE: Amanda::Debug
 libDebugdir = $(amperldir)/auto/Amanda/Debug
 libDebug_LTLIBRARIES = libDebug.la
@@ -949,6 +1153,37 @@ libTypes_la_LIBADD = libamglue.la \
        $(top_builddir)/common-src/libamanda.la
 
 
+# PACKAGE: Amanda::Tests
+libTestsdir = $(amperldir)/auto/Amanda/Tests
+libTests_LTLIBRARIES = libTests.la
+libTests_la_SOURCES = Amanda/Tests.c $(AMGLUE_SWG)
+libTests_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
+libTests_la_LIBADD = libamglue.la \
+       $(top_builddir)/common-src/libamanda.la
+
+
+# PACKAGE: Amanda::MainLoop
+libMainLoopdir = $(amperldir)/auto/Amanda/MainLoop
+libMainLoop_LTLIBRARIES = libMainLoop.la
+libMainLoop_la_SOURCES = Amanda/MainLoop.c $(AMGLUE_SWG)
+libMainLoop_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
+libMainLoop_la_LIBADD = libamglue.la \
+       $(top_builddir)/common-src/libamanda.la
+
+
+# PACKAGE: Amanda::Application
+@WANT_CLIENT_TRUE@libApplicationdir = $(amperldir)/auto/Amanda/Application
+@WANT_CLIENT_TRUE@libApplication_LTLIBRARIES = libApplication.la
+@WANT_CLIENT_TRUE@libApplication_la_SOURCES = Amanda/Application.c $(AMGLUE_SWG)
+@WANT_CLIENT_TRUE@libApplication_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
+@WANT_CLIENT_TRUE@libApplication_la_LIBADD = libamglue.la \
+@WANT_CLIENT_TRUE@     $(top_builddir)/client-src/libamclient.la
+
+
+# PACKAGE: Amanda::Application::*
+@WANT_CLIENT_TRUE@AmandaApplicationdir = $(amperldir)/Amanda/Application
+@WANT_CLIENT_TRUE@AmandaApplication_DATA = Amanda/Application/Zfs.pm
+
 # perl doesn't use the cyg prefix and it doesn't search in the bin
 # directory, dll must be copied to their modules directories.
 @WANT_CYGWIN_COPY_PERL_DLL_TRUE@amperldirauto = "$(DESTDIR)$(amperldir)/auto/Amanda"
@@ -992,8 +1227,8 @@ install-amlibLTLIBRARIES: $(amlib_LTLIBRARIES)
        @list='$(amlib_LTLIBRARIES)'; for p in $$list; do \
          if test -f $$p; then \
            f=$(am__strip_dir) \
-           echo " $(LIBTOOL) --mode=install $(amlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(amlibdir)/$$f'"; \
-           $(LIBTOOL) --mode=install $(amlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(amlibdir)/$$f"; \
+           echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(amlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(amlibdir)/$$f'"; \
+           $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(amlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(amlibdir)/$$f"; \
          else :; fi; \
        done
 
@@ -1001,8 +1236,8 @@ uninstall-amlibLTLIBRARIES:
        @$(NORMAL_UNINSTALL)
        @list='$(amlib_LTLIBRARIES)'; for p in $$list; do \
          p=$(am__strip_dir) \
-         echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(amlibdir)/$$p'"; \
-         $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(amlibdir)/$$p"; \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(amlibdir)/$$p'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(amlibdir)/$$p"; \
        done
 
 clean-amlibLTLIBRARIES:
@@ -1013,14 +1248,68 @@ clean-amlibLTLIBRARIES:
          echo "rm -f \"$${dir}/so_locations\""; \
          rm -f "$${dir}/so_locations"; \
        done
+install-libApplicationLTLIBRARIES: $(libApplication_LTLIBRARIES)
+       @$(NORMAL_INSTALL)
+       test -z "$(libApplicationdir)" || $(MKDIR_P) "$(DESTDIR)$(libApplicationdir)"
+       @list='$(libApplication_LTLIBRARIES)'; for p in $$list; do \
+         if test -f $$p; then \
+           f=$(am__strip_dir) \
+           echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libApplicationLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libApplicationdir)/$$f'"; \
+           $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libApplicationLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libApplicationdir)/$$f"; \
+         else :; fi; \
+       done
+
+uninstall-libApplicationLTLIBRARIES:
+       @$(NORMAL_UNINSTALL)
+       @list='$(libApplication_LTLIBRARIES)'; for p in $$list; do \
+         p=$(am__strip_dir) \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libApplicationdir)/$$p'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libApplicationdir)/$$p"; \
+       done
+
+clean-libApplicationLTLIBRARIES:
+       -test -z "$(libApplication_LTLIBRARIES)" || rm -f $(libApplication_LTLIBRARIES)
+       @list='$(libApplication_LTLIBRARIES)'; for p in $$list; do \
+         dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+         test "$$dir" != "$$p" || dir=.; \
+         echo "rm -f \"$${dir}/so_locations\""; \
+         rm -f "$${dir}/so_locations"; \
+       done
+install-libArchiveLTLIBRARIES: $(libArchive_LTLIBRARIES)
+       @$(NORMAL_INSTALL)
+       test -z "$(libArchivedir)" || $(MKDIR_P) "$(DESTDIR)$(libArchivedir)"
+       @list='$(libArchive_LTLIBRARIES)'; for p in $$list; do \
+         if test -f $$p; then \
+           f=$(am__strip_dir) \
+           echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libArchiveLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libArchivedir)/$$f'"; \
+           $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libArchiveLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libArchivedir)/$$f"; \
+         else :; fi; \
+       done
+
+uninstall-libArchiveLTLIBRARIES:
+       @$(NORMAL_UNINSTALL)
+       @list='$(libArchive_LTLIBRARIES)'; for p in $$list; do \
+         p=$(am__strip_dir) \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libArchivedir)/$$p'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libArchivedir)/$$p"; \
+       done
+
+clean-libArchiveLTLIBRARIES:
+       -test -z "$(libArchive_LTLIBRARIES)" || rm -f $(libArchive_LTLIBRARIES)
+       @list='$(libArchive_LTLIBRARIES)'; for p in $$list; do \
+         dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+         test "$$dir" != "$$p" || dir=.; \
+         echo "rm -f \"$${dir}/so_locations\""; \
+         rm -f "$${dir}/so_locations"; \
+       done
 install-libCmdlineLTLIBRARIES: $(libCmdline_LTLIBRARIES)
        @$(NORMAL_INSTALL)
        test -z "$(libCmdlinedir)" || $(MKDIR_P) "$(DESTDIR)$(libCmdlinedir)"
        @list='$(libCmdline_LTLIBRARIES)'; for p in $$list; do \
          if test -f $$p; then \
            f=$(am__strip_dir) \
-           echo " $(LIBTOOL) --mode=install $(libCmdlineLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libCmdlinedir)/$$f'"; \
-           $(LIBTOOL) --mode=install $(libCmdlineLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libCmdlinedir)/$$f"; \
+           echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libCmdlineLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libCmdlinedir)/$$f'"; \
+           $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libCmdlineLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libCmdlinedir)/$$f"; \
          else :; fi; \
        done
 
@@ -1028,8 +1317,8 @@ uninstall-libCmdlineLTLIBRARIES:
        @$(NORMAL_UNINSTALL)
        @list='$(libCmdline_LTLIBRARIES)'; for p in $$list; do \
          p=$(am__strip_dir) \
-         echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libCmdlinedir)/$$p'"; \
-         $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libCmdlinedir)/$$p"; \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libCmdlinedir)/$$p'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libCmdlinedir)/$$p"; \
        done
 
 clean-libCmdlineLTLIBRARIES:
@@ -1046,8 +1335,8 @@ install-libConfigLTLIBRARIES: $(libConfig_LTLIBRARIES)
        @list='$(libConfig_LTLIBRARIES)'; for p in $$list; do \
          if test -f $$p; then \
            f=$(am__strip_dir) \
-           echo " $(LIBTOOL) --mode=install $(libConfigLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libConfigdir)/$$f'"; \
-           $(LIBTOOL) --mode=install $(libConfigLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libConfigdir)/$$f"; \
+           echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libConfigLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libConfigdir)/$$f'"; \
+           $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libConfigLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libConfigdir)/$$f"; \
          else :; fi; \
        done
 
@@ -1055,8 +1344,8 @@ uninstall-libConfigLTLIBRARIES:
        @$(NORMAL_UNINSTALL)
        @list='$(libConfig_LTLIBRARIES)'; for p in $$list; do \
          p=$(am__strip_dir) \
-         echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libConfigdir)/$$p'"; \
-         $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libConfigdir)/$$p"; \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libConfigdir)/$$p'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libConfigdir)/$$p"; \
        done
 
 clean-libConfigLTLIBRARIES:
@@ -1073,8 +1362,8 @@ install-libDebugLTLIBRARIES: $(libDebug_LTLIBRARIES)
        @list='$(libDebug_LTLIBRARIES)'; for p in $$list; do \
          if test -f $$p; then \
            f=$(am__strip_dir) \
-           echo " $(LIBTOOL) --mode=install $(libDebugLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libDebugdir)/$$f'"; \
-           $(LIBTOOL) --mode=install $(libDebugLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libDebugdir)/$$f"; \
+           echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libDebugLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libDebugdir)/$$f'"; \
+           $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libDebugLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libDebugdir)/$$f"; \
          else :; fi; \
        done
 
@@ -1082,8 +1371,8 @@ uninstall-libDebugLTLIBRARIES:
        @$(NORMAL_UNINSTALL)
        @list='$(libDebug_LTLIBRARIES)'; for p in $$list; do \
          p=$(am__strip_dir) \
-         echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libDebugdir)/$$p'"; \
-         $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libDebugdir)/$$p"; \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libDebugdir)/$$p'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libDebugdir)/$$p"; \
        done
 
 clean-libDebugLTLIBRARIES:
@@ -1100,8 +1389,8 @@ install-libDeviceLTLIBRARIES: $(libDevice_LTLIBRARIES)
        @list='$(libDevice_LTLIBRARIES)'; for p in $$list; do \
          if test -f $$p; then \
            f=$(am__strip_dir) \
-           echo " $(LIBTOOL) --mode=install $(libDeviceLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libDevicedir)/$$f'"; \
-           $(LIBTOOL) --mode=install $(libDeviceLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libDevicedir)/$$f"; \
+           echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libDeviceLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libDevicedir)/$$f'"; \
+           $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libDeviceLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libDevicedir)/$$f"; \
          else :; fi; \
        done
 
@@ -1109,8 +1398,8 @@ uninstall-libDeviceLTLIBRARIES:
        @$(NORMAL_UNINSTALL)
        @list='$(libDevice_LTLIBRARIES)'; for p in $$list; do \
          p=$(am__strip_dir) \
-         echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libDevicedir)/$$p'"; \
-         $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libDevicedir)/$$p"; \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libDevicedir)/$$p'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libDevicedir)/$$p"; \
        done
 
 clean-libDeviceLTLIBRARIES:
@@ -1127,8 +1416,8 @@ install-libLogfileLTLIBRARIES: $(libLogfile_LTLIBRARIES)
        @list='$(libLogfile_LTLIBRARIES)'; for p in $$list; do \
          if test -f $$p; then \
            f=$(am__strip_dir) \
-           echo " $(LIBTOOL) --mode=install $(libLogfileLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libLogfiledir)/$$f'"; \
-           $(LIBTOOL) --mode=install $(libLogfileLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libLogfiledir)/$$f"; \
+           echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLogfileLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libLogfiledir)/$$f'"; \
+           $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLogfileLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libLogfiledir)/$$f"; \
          else :; fi; \
        done
 
@@ -1136,8 +1425,8 @@ uninstall-libLogfileLTLIBRARIES:
        @$(NORMAL_UNINSTALL)
        @list='$(libLogfile_LTLIBRARIES)'; for p in $$list; do \
          p=$(am__strip_dir) \
-         echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libLogfiledir)/$$p'"; \
-         $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libLogfiledir)/$$p"; \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libLogfiledir)/$$p'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libLogfiledir)/$$p"; \
        done
 
 clean-libLogfileLTLIBRARIES:
@@ -1148,28 +1437,82 @@ clean-libLogfileLTLIBRARIES:
          echo "rm -f \"$${dir}/so_locations\""; \
          rm -f "$${dir}/so_locations"; \
        done
-install-libTapefileLTLIBRARIES: $(libTapefile_LTLIBRARIES)
+install-libMainLoopLTLIBRARIES: $(libMainLoop_LTLIBRARIES)
+       @$(NORMAL_INSTALL)
+       test -z "$(libMainLoopdir)" || $(MKDIR_P) "$(DESTDIR)$(libMainLoopdir)"
+       @list='$(libMainLoop_LTLIBRARIES)'; for p in $$list; do \
+         if test -f $$p; then \
+           f=$(am__strip_dir) \
+           echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libMainLoopLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libMainLoopdir)/$$f'"; \
+           $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libMainLoopLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libMainLoopdir)/$$f"; \
+         else :; fi; \
+       done
+
+uninstall-libMainLoopLTLIBRARIES:
+       @$(NORMAL_UNINSTALL)
+       @list='$(libMainLoop_LTLIBRARIES)'; for p in $$list; do \
+         p=$(am__strip_dir) \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libMainLoopdir)/$$p'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libMainLoopdir)/$$p"; \
+       done
+
+clean-libMainLoopLTLIBRARIES:
+       -test -z "$(libMainLoop_LTLIBRARIES)" || rm -f $(libMainLoop_LTLIBRARIES)
+       @list='$(libMainLoop_LTLIBRARIES)'; for p in $$list; do \
+         dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+         test "$$dir" != "$$p" || dir=.; \
+         echo "rm -f \"$${dir}/so_locations\""; \
+         rm -f "$${dir}/so_locations"; \
+       done
+install-libTapelistLTLIBRARIES: $(libTapelist_LTLIBRARIES)
        @$(NORMAL_INSTALL)
-       test -z "$(libTapefiledir)" || $(MKDIR_P) "$(DESTDIR)$(libTapefiledir)"
-       @list='$(libTapefile_LTLIBRARIES)'; for p in $$list; do \
+       test -z "$(libTapelistdir)" || $(MKDIR_P) "$(DESTDIR)$(libTapelistdir)"
+       @list='$(libTapelist_LTLIBRARIES)'; for p in $$list; do \
          if test -f $$p; then \
            f=$(am__strip_dir) \
-           echo " $(LIBTOOL) --mode=install $(libTapefileLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libTapefiledir)/$$f'"; \
-           $(LIBTOOL) --mode=install $(libTapefileLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libTapefiledir)/$$f"; \
+           echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libTapelistLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libTapelistdir)/$$f'"; \
+           $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libTapelistLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libTapelistdir)/$$f"; \
          else :; fi; \
        done
 
-uninstall-libTapefileLTLIBRARIES:
+uninstall-libTapelistLTLIBRARIES:
        @$(NORMAL_UNINSTALL)
-       @list='$(libTapefile_LTLIBRARIES)'; for p in $$list; do \
+       @list='$(libTapelist_LTLIBRARIES)'; for p in $$list; do \
          p=$(am__strip_dir) \
-         echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libTapefiledir)/$$p'"; \
-         $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libTapefiledir)/$$p"; \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libTapelistdir)/$$p'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libTapelistdir)/$$p"; \
        done
 
-clean-libTapefileLTLIBRARIES:
-       -test -z "$(libTapefile_LTLIBRARIES)" || rm -f $(libTapefile_LTLIBRARIES)
-       @list='$(libTapefile_LTLIBRARIES)'; for p in $$list; do \
+clean-libTapelistLTLIBRARIES:
+       -test -z "$(libTapelist_LTLIBRARIES)" || rm -f $(libTapelist_LTLIBRARIES)
+       @list='$(libTapelist_LTLIBRARIES)'; for p in $$list; do \
+         dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+         test "$$dir" != "$$p" || dir=.; \
+         echo "rm -f \"$${dir}/so_locations\""; \
+         rm -f "$${dir}/so_locations"; \
+       done
+install-libTestsLTLIBRARIES: $(libTests_LTLIBRARIES)
+       @$(NORMAL_INSTALL)
+       test -z "$(libTestsdir)" || $(MKDIR_P) "$(DESTDIR)$(libTestsdir)"
+       @list='$(libTests_LTLIBRARIES)'; for p in $$list; do \
+         if test -f $$p; then \
+           f=$(am__strip_dir) \
+           echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libTestsLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libTestsdir)/$$f'"; \
+           $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libTestsLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libTestsdir)/$$f"; \
+         else :; fi; \
+       done
+
+uninstall-libTestsLTLIBRARIES:
+       @$(NORMAL_UNINSTALL)
+       @list='$(libTests_LTLIBRARIES)'; for p in $$list; do \
+         p=$(am__strip_dir) \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libTestsdir)/$$p'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libTestsdir)/$$p"; \
+       done
+
+clean-libTestsLTLIBRARIES:
+       -test -z "$(libTests_LTLIBRARIES)" || rm -f $(libTests_LTLIBRARIES)
+       @list='$(libTests_LTLIBRARIES)'; for p in $$list; do \
          dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
          test "$$dir" != "$$p" || dir=.; \
          echo "rm -f \"$${dir}/so_locations\""; \
@@ -1181,8 +1524,8 @@ install-libTypesLTLIBRARIES: $(libTypes_LTLIBRARIES)
        @list='$(libTypes_LTLIBRARIES)'; for p in $$list; do \
          if test -f $$p; then \
            f=$(am__strip_dir) \
-           echo " $(LIBTOOL) --mode=install $(libTypesLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libTypesdir)/$$f'"; \
-           $(LIBTOOL) --mode=install $(libTypesLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libTypesdir)/$$f"; \
+           echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libTypesLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libTypesdir)/$$f'"; \
+           $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libTypesLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libTypesdir)/$$f"; \
          else :; fi; \
        done
 
@@ -1190,8 +1533,8 @@ uninstall-libTypesLTLIBRARIES:
        @$(NORMAL_UNINSTALL)
        @list='$(libTypes_LTLIBRARIES)'; for p in $$list; do \
          p=$(am__strip_dir) \
-         echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libTypesdir)/$$p'"; \
-         $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libTypesdir)/$$p"; \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libTypesdir)/$$p'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libTypesdir)/$$p"; \
        done
 
 clean-libTypesLTLIBRARIES:
@@ -1208,8 +1551,8 @@ install-libUtilLTLIBRARIES: $(libUtil_LTLIBRARIES)
        @list='$(libUtil_LTLIBRARIES)'; for p in $$list; do \
          if test -f $$p; then \
            f=$(am__strip_dir) \
-           echo " $(LIBTOOL) --mode=install $(libUtilLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libUtildir)/$$f'"; \
-           $(LIBTOOL) --mode=install $(libUtilLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libUtildir)/$$f"; \
+           echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libUtilLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libUtildir)/$$f'"; \
+           $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libUtilLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libUtildir)/$$f"; \
          else :; fi; \
        done
 
@@ -1217,8 +1560,8 @@ uninstall-libUtilLTLIBRARIES:
        @$(NORMAL_UNINSTALL)
        @list='$(libUtil_LTLIBRARIES)'; for p in $$list; do \
          p=$(am__strip_dir) \
-         echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libUtildir)/$$p'"; \
-         $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libUtildir)/$$p"; \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libUtildir)/$$p'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libUtildir)/$$p"; \
        done
 
 clean-libUtilLTLIBRARIES:
@@ -1229,6 +1572,37 @@ clean-libUtilLTLIBRARIES:
          echo "rm -f \"$${dir}/so_locations\""; \
          rm -f "$${dir}/so_locations"; \
        done
+install-libXferLTLIBRARIES: $(libXfer_LTLIBRARIES)
+       @$(NORMAL_INSTALL)
+       test -z "$(libXferdir)" || $(MKDIR_P) "$(DESTDIR)$(libXferdir)"
+       @list='$(libXfer_LTLIBRARIES)'; for p in $$list; do \
+         if test -f $$p; then \
+           f=$(am__strip_dir) \
+           echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libXferLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libXferdir)/$$f'"; \
+           $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libXferLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libXferdir)/$$f"; \
+         else :; fi; \
+       done
+
+uninstall-libXferLTLIBRARIES:
+       @$(NORMAL_UNINSTALL)
+       @list='$(libXfer_LTLIBRARIES)'; for p in $$list; do \
+         p=$(am__strip_dir) \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libXferdir)/$$p'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libXferdir)/$$p"; \
+       done
+
+clean-libXferLTLIBRARIES:
+       -test -z "$(libXfer_LTLIBRARIES)" || rm -f $(libXfer_LTLIBRARIES)
+       @list='$(libXfer_LTLIBRARIES)'; for p in $$list; do \
+         dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+         test "$$dir" != "$$p" || dir=.; \
+         echo "rm -f \"$${dir}/so_locations\""; \
+         rm -f "$${dir}/so_locations"; \
+       done
+libApplication.la: $(libApplication_la_OBJECTS) $(libApplication_la_DEPENDENCIES) 
+       $(libApplication_la_LINK) $(am_libApplication_la_rpath) $(libApplication_la_OBJECTS) $(libApplication_la_LIBADD) $(LIBS)
+libArchive.la: $(libArchive_la_OBJECTS) $(libArchive_la_DEPENDENCIES) 
+       $(libArchive_la_LINK) -rpath $(libArchivedir) $(libArchive_la_OBJECTS) $(libArchive_la_LIBADD) $(LIBS)
 libCmdline.la: $(libCmdline_la_OBJECTS) $(libCmdline_la_DEPENDENCIES) 
        $(libCmdline_la_LINK) $(am_libCmdline_la_rpath) $(libCmdline_la_OBJECTS) $(libCmdline_la_LIBADD) $(LIBS)
 libConfig.la: $(libConfig_la_OBJECTS) $(libConfig_la_DEPENDENCIES) 
@@ -1239,12 +1613,18 @@ libDevice.la: $(libDevice_la_OBJECTS) $(libDevice_la_DEPENDENCIES)
        $(libDevice_la_LINK) $(am_libDevice_la_rpath) $(libDevice_la_OBJECTS) $(libDevice_la_LIBADD) $(LIBS)
 libLogfile.la: $(libLogfile_la_OBJECTS) $(libLogfile_la_DEPENDENCIES) 
        $(libLogfile_la_LINK) $(am_libLogfile_la_rpath) $(libLogfile_la_OBJECTS) $(libLogfile_la_LIBADD) $(LIBS)
-libTapefile.la: $(libTapefile_la_OBJECTS) $(libTapefile_la_DEPENDENCIES) 
-       $(libTapefile_la_LINK) $(am_libTapefile_la_rpath) $(libTapefile_la_OBJECTS) $(libTapefile_la_LIBADD) $(LIBS)
+libMainLoop.la: $(libMainLoop_la_OBJECTS) $(libMainLoop_la_DEPENDENCIES) 
+       $(libMainLoop_la_LINK) -rpath $(libMainLoopdir) $(libMainLoop_la_OBJECTS) $(libMainLoop_la_LIBADD) $(LIBS)
+libTapelist.la: $(libTapelist_la_OBJECTS) $(libTapelist_la_DEPENDENCIES) 
+       $(libTapelist_la_LINK) $(am_libTapelist_la_rpath) $(libTapelist_la_OBJECTS) $(libTapelist_la_LIBADD) $(LIBS)
+libTests.la: $(libTests_la_OBJECTS) $(libTests_la_DEPENDENCIES) 
+       $(libTests_la_LINK) -rpath $(libTestsdir) $(libTests_la_OBJECTS) $(libTests_la_LIBADD) $(LIBS)
 libTypes.la: $(libTypes_la_OBJECTS) $(libTypes_la_DEPENDENCIES) 
        $(libTypes_la_LINK) -rpath $(libTypesdir) $(libTypes_la_OBJECTS) $(libTypes_la_LIBADD) $(LIBS)
 libUtil.la: $(libUtil_la_OBJECTS) $(libUtil_la_DEPENDENCIES) 
        $(libUtil_la_LINK) -rpath $(libUtildir) $(libUtil_la_OBJECTS) $(libUtil_la_LIBADD) $(LIBS)
+libXfer.la: $(libXfer_la_OBJECTS) $(libXfer_la_DEPENDENCIES) 
+       $(libXfer_la_LINK) $(am_libXfer_la_rpath) $(libXfer_la_OBJECTS) $(libXfer_la_LIBADD) $(LIBS)
 libamglue.la: $(libamglue_la_OBJECTS) $(libamglue_la_DEPENDENCIES) 
        $(libamglue_la_LINK) -rpath $(amlibdir) $(libamglue_la_OBJECTS) $(libamglue_la_LIBADD) $(LIBS)
 
@@ -1254,16 +1634,22 @@ mostlyclean-compile:
 distclean-compile:
        -rm -f *.tab.c
 
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Application.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Archive.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Cmdline.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Config.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Debug.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Device.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Logfile.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Tapefile.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MainLoop.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Tapelist.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Tests.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Types.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Util.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Xfer.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bigint.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ghashtable.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/source.Plo@am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@   $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -1286,6 +1672,20 @@ distclean-compile:
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(LTCOMPILE) -c -o $@ $<
 
+Application.lo: Amanda/Application.c
+@am__fastdepCC_TRUE@   $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT Application.lo -MD -MP -MF $(DEPDIR)/Application.Tpo -c -o Application.lo `test -f 'Amanda/Application.c' || echo '$(srcdir)/'`Amanda/Application.c
+@am__fastdepCC_TRUE@   mv -f $(DEPDIR)/Application.Tpo $(DEPDIR)/Application.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='Amanda/Application.c' object='Application.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o Application.lo `test -f 'Amanda/Application.c' || echo '$(srcdir)/'`Amanda/Application.c
+
+Archive.lo: Amanda/Archive.c
+@am__fastdepCC_TRUE@   $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT Archive.lo -MD -MP -MF $(DEPDIR)/Archive.Tpo -c -o Archive.lo `test -f 'Amanda/Archive.c' || echo '$(srcdir)/'`Amanda/Archive.c
+@am__fastdepCC_TRUE@   mv -f $(DEPDIR)/Archive.Tpo $(DEPDIR)/Archive.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='Amanda/Archive.c' object='Archive.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o Archive.lo `test -f 'Amanda/Archive.c' || echo '$(srcdir)/'`Amanda/Archive.c
+
 Cmdline.lo: Amanda/Cmdline.c
 @am__fastdepCC_TRUE@   $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT Cmdline.lo -MD -MP -MF $(DEPDIR)/Cmdline.Tpo -c -o Cmdline.lo `test -f 'Amanda/Cmdline.c' || echo '$(srcdir)/'`Amanda/Cmdline.c
 @am__fastdepCC_TRUE@   mv -f $(DEPDIR)/Cmdline.Tpo $(DEPDIR)/Cmdline.Plo
@@ -1321,12 +1721,26 @@ Logfile.lo: Amanda/Logfile.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o Logfile.lo `test -f 'Amanda/Logfile.c' || echo '$(srcdir)/'`Amanda/Logfile.c
 
-Tapefile.lo: Amanda/Tapefile.c
-@am__fastdepCC_TRUE@   $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT Tapefile.lo -MD -MP -MF $(DEPDIR)/Tapefile.Tpo -c -o Tapefile.lo `test -f 'Amanda/Tapefile.c' || echo '$(srcdir)/'`Amanda/Tapefile.c
-@am__fastdepCC_TRUE@   mv -f $(DEPDIR)/Tapefile.Tpo $(DEPDIR)/Tapefile.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='Amanda/Tapefile.c' object='Tapefile.lo' libtool=yes @AMDEPBACKSLASH@
+MainLoop.lo: Amanda/MainLoop.c
+@am__fastdepCC_TRUE@   $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT MainLoop.lo -MD -MP -MF $(DEPDIR)/MainLoop.Tpo -c -o MainLoop.lo `test -f 'Amanda/MainLoop.c' || echo '$(srcdir)/'`Amanda/MainLoop.c
+@am__fastdepCC_TRUE@   mv -f $(DEPDIR)/MainLoop.Tpo $(DEPDIR)/MainLoop.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='Amanda/MainLoop.c' object='MainLoop.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o MainLoop.lo `test -f 'Amanda/MainLoop.c' || echo '$(srcdir)/'`Amanda/MainLoop.c
+
+Tapelist.lo: Amanda/Tapelist.c
+@am__fastdepCC_TRUE@   $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT Tapelist.lo -MD -MP -MF $(DEPDIR)/Tapelist.Tpo -c -o Tapelist.lo `test -f 'Amanda/Tapelist.c' || echo '$(srcdir)/'`Amanda/Tapelist.c
+@am__fastdepCC_TRUE@   mv -f $(DEPDIR)/Tapelist.Tpo $(DEPDIR)/Tapelist.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='Amanda/Tapelist.c' object='Tapelist.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o Tapefile.lo `test -f 'Amanda/Tapefile.c' || echo '$(srcdir)/'`Amanda/Tapefile.c
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o Tapelist.lo `test -f 'Amanda/Tapelist.c' || echo '$(srcdir)/'`Amanda/Tapelist.c
+
+Tests.lo: Amanda/Tests.c
+@am__fastdepCC_TRUE@   $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT Tests.lo -MD -MP -MF $(DEPDIR)/Tests.Tpo -c -o Tests.lo `test -f 'Amanda/Tests.c' || echo '$(srcdir)/'`Amanda/Tests.c
+@am__fastdepCC_TRUE@   mv -f $(DEPDIR)/Tests.Tpo $(DEPDIR)/Tests.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='Amanda/Tests.c' object='Tests.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o Tests.lo `test -f 'Amanda/Tests.c' || echo '$(srcdir)/'`Amanda/Tests.c
 
 Types.lo: Amanda/Types.c
 @am__fastdepCC_TRUE@   $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT Types.lo -MD -MP -MF $(DEPDIR)/Types.Tpo -c -o Types.lo `test -f 'Amanda/Types.c' || echo '$(srcdir)/'`Amanda/Types.c
@@ -1342,6 +1756,13 @@ Util.lo: Amanda/Util.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o Util.lo `test -f 'Amanda/Util.c' || echo '$(srcdir)/'`Amanda/Util.c
 
+Xfer.lo: Amanda/Xfer.c
+@am__fastdepCC_TRUE@   $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT Xfer.lo -MD -MP -MF $(DEPDIR)/Xfer.Tpo -c -o Xfer.lo `test -f 'Amanda/Xfer.c' || echo '$(srcdir)/'`Amanda/Xfer.c
+@am__fastdepCC_TRUE@   mv -f $(DEPDIR)/Xfer.Tpo $(DEPDIR)/Xfer.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='Amanda/Xfer.c' object='Xfer.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o Xfer.lo `test -f 'Amanda/Xfer.c' || echo '$(srcdir)/'`Amanda/Xfer.c
+
 ghashtable.lo: amglue/ghashtable.c
 @am__fastdepCC_TRUE@   $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ghashtable.lo -MD -MP -MF $(DEPDIR)/ghashtable.Tpo -c -o ghashtable.lo `test -f 'amglue/ghashtable.c' || echo '$(srcdir)/'`amglue/ghashtable.c
 @am__fastdepCC_TRUE@   mv -f $(DEPDIR)/ghashtable.Tpo $(DEPDIR)/ghashtable.Plo
@@ -1356,6 +1777,13 @@ bigint.lo: amglue/bigint.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bigint.lo `test -f 'amglue/bigint.c' || echo '$(srcdir)/'`amglue/bigint.c
 
+source.lo: amglue/source.c
+@am__fastdepCC_TRUE@   $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT source.lo -MD -MP -MF $(DEPDIR)/source.Tpo -c -o source.lo `test -f 'amglue/source.c' || echo '$(srcdir)/'`amglue/source.c
+@am__fastdepCC_TRUE@   mv -f $(DEPDIR)/source.Tpo $(DEPDIR)/source.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='amglue/source.c' object='source.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o source.lo `test -f 'amglue/source.c' || echo '$(srcdir)/'`amglue/source.c
+
 mostlyclean-libtool:
        -rm -f *.lo
 
@@ -1378,14 +1806,65 @@ uninstall-AmandaDATA:
          echo " rm -f '$(DESTDIR)$(Amandadir)/$$f'"; \
          rm -f "$(DESTDIR)$(Amandadir)/$$f"; \
        done
+install-AmandaApplicationDATA: $(AmandaApplication_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(AmandaApplicationdir)" || $(MKDIR_P) "$(DESTDIR)$(AmandaApplicationdir)"
+       @list='$(AmandaApplication_DATA)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(AmandaApplicationDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(AmandaApplicationdir)/$$f'"; \
+         $(AmandaApplicationDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(AmandaApplicationdir)/$$f"; \
+       done
+
+uninstall-AmandaApplicationDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(AmandaApplication_DATA)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(AmandaApplicationdir)/$$f'"; \
+         rm -f "$(DESTDIR)$(AmandaApplicationdir)/$$f"; \
+       done
+install-AmandaChangerDATA: $(AmandaChanger_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(AmandaChangerdir)" || $(MKDIR_P) "$(DESTDIR)$(AmandaChangerdir)"
+       @list='$(AmandaChanger_DATA)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(AmandaChangerDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(AmandaChangerdir)/$$f'"; \
+         $(AmandaChangerDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(AmandaChangerdir)/$$f"; \
+       done
+
+uninstall-AmandaChangerDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(AmandaChanger_DATA)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(AmandaChangerdir)/$$f'"; \
+         rm -f "$(DESTDIR)$(AmandaChangerdir)/$$f"; \
+       done
+install-Amanda_DBDATA: $(Amanda_DB_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(Amanda_DBdir)" || $(MKDIR_P) "$(DESTDIR)$(Amanda_DBdir)"
+       @list='$(Amanda_DB_DATA)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(Amanda_DBDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(Amanda_DBdir)/$$f'"; \
+         $(Amanda_DBDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(Amanda_DBdir)/$$f"; \
+       done
+
+uninstall-Amanda_DBDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(Amanda_DB_DATA)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(Amanda_DBdir)/$$f'"; \
+         rm -f "$(DESTDIR)$(Amanda_DBdir)/$$f"; \
+       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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
        mkid -fID $$unique
 tags: TAGS
 
@@ -1397,8 +1876,8 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
        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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { 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) \
@@ -1408,13 +1887,12 @@ ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
                $(TAGS_FILES) $(LISP)
        tags=; \
-       here=`pwd`; \
        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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
        test -z "$(CTAGS_ARGS)$$tags$$unique" \
          || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
             $$tags $$unique
@@ -1462,7 +1940,7 @@ check: $(BUILT_SOURCES)
        $(MAKE) $(AM_MAKEFLAGS) check-am
 all-am: Makefile $(LTLIBRARIES) $(DATA)
 installdirs:
-       for dir in "$(DESTDIR)$(amlibdir)" "$(DESTDIR)$(libCmdlinedir)" "$(DESTDIR)$(libConfigdir)" "$(DESTDIR)$(libDebugdir)" "$(DESTDIR)$(libDevicedir)" "$(DESTDIR)$(libLogfiledir)" "$(DESTDIR)$(libTapefiledir)" "$(DESTDIR)$(libTypesdir)" "$(DESTDIR)$(libUtildir)" "$(DESTDIR)$(Amandadir)"; do \
+       for dir in "$(DESTDIR)$(amlibdir)" "$(DESTDIR)$(libApplicationdir)" "$(DESTDIR)$(libArchivedir)" "$(DESTDIR)$(libCmdlinedir)" "$(DESTDIR)$(libConfigdir)" "$(DESTDIR)$(libDebugdir)" "$(DESTDIR)$(libDevicedir)" "$(DESTDIR)$(libLogfiledir)" "$(DESTDIR)$(libMainLoopdir)" "$(DESTDIR)$(libTapelistdir)" "$(DESTDIR)$(libTestsdir)" "$(DESTDIR)$(libTypesdir)" "$(DESTDIR)$(libUtildir)" "$(DESTDIR)$(libXferdir)" "$(DESTDIR)$(Amandadir)" "$(DESTDIR)$(AmandaApplicationdir)" "$(DESTDIR)$(AmandaChangerdir)" "$(DESTDIR)$(Amanda_DBdir)"; do \
          test -z "$$dir" || $(MKDIR_P) "$$dir"; \
        done
 install: $(BUILT_SOURCES)
@@ -1499,11 +1977,13 @@ maintainer-clean-generic:
 clean: clean-am
 
 clean-am: clean-amlibLTLIBRARIES clean-generic \
+       clean-libApplicationLTLIBRARIES clean-libArchiveLTLIBRARIES \
        clean-libCmdlineLTLIBRARIES clean-libConfigLTLIBRARIES \
        clean-libDebugLTLIBRARIES clean-libDeviceLTLIBRARIES \
-       clean-libLogfileLTLIBRARIES clean-libTapefileLTLIBRARIES \
+       clean-libLogfileLTLIBRARIES clean-libMainLoopLTLIBRARIES \
+       clean-libTapelistLTLIBRARIES clean-libTestsLTLIBRARIES \
        clean-libTypesLTLIBRARIES clean-libUtilLTLIBRARIES \
-       clean-libtool mostlyclean-am
+       clean-libXferLTLIBRARIES clean-libtool mostlyclean-am
 
 distclean: distclean-am
        -rm -rf ./$(DEPDIR)
@@ -1519,11 +1999,16 @@ info: info-am
 
 info-am:
 
-install-data-am: install-AmandaDATA install-amlibLTLIBRARIES \
-       install-libCmdlineLTLIBRARIES install-libConfigLTLIBRARIES \
-       install-libDebugLTLIBRARIES install-libDeviceLTLIBRARIES \
-       install-libLogfileLTLIBRARIES install-libTapefileLTLIBRARIES \
-       install-libTypesLTLIBRARIES install-libUtilLTLIBRARIES
+install-data-am: install-AmandaApplicationDATA \
+       install-AmandaChangerDATA install-AmandaDATA \
+       install-Amanda_DBDATA install-amlibLTLIBRARIES \
+       install-libApplicationLTLIBRARIES \
+       install-libArchiveLTLIBRARIES install-libCmdlineLTLIBRARIES \
+       install-libConfigLTLIBRARIES install-libDebugLTLIBRARIES \
+       install-libDeviceLTLIBRARIES install-libLogfileLTLIBRARIES \
+       install-libMainLoopLTLIBRARIES install-libTapelistLTLIBRARIES \
+       install-libTestsLTLIBRARIES install-libTypesLTLIBRARIES \
+       install-libUtilLTLIBRARIES install-libXferLTLIBRARIES
        @$(NORMAL_INSTALL)
        $(MAKE) $(AM_MAKEFLAGS) install-data-hook
 
@@ -1541,7 +2026,7 @@ install-pdf: install-pdf-am
 
 install-ps: install-ps-am
 
-installcheck-am:
+installcheck-am: installcheck-local
 
 maintainer-clean: maintainer-clean-am
        -rm -rf ./$(DEPDIR)
@@ -1561,48 +2046,73 @@ ps: ps-am
 
 ps-am:
 
-uninstall-am: uninstall-AmandaDATA uninstall-amlibLTLIBRARIES \
+uninstall-am: uninstall-AmandaApplicationDATA \
+       uninstall-AmandaChangerDATA uninstall-AmandaDATA \
+       uninstall-Amanda_DBDATA uninstall-amlibLTLIBRARIES \
+       uninstall-libApplicationLTLIBRARIES \
+       uninstall-libArchiveLTLIBRARIES \
        uninstall-libCmdlineLTLIBRARIES uninstall-libConfigLTLIBRARIES \
        uninstall-libDebugLTLIBRARIES uninstall-libDeviceLTLIBRARIES \
        uninstall-libLogfileLTLIBRARIES \
-       uninstall-libTapefileLTLIBRARIES uninstall-libTypesLTLIBRARIES \
-       uninstall-libUtilLTLIBRARIES
+       uninstall-libMainLoopLTLIBRARIES \
+       uninstall-libTapelistLTLIBRARIES uninstall-libTestsLTLIBRARIES \
+       uninstall-libTypesLTLIBRARIES uninstall-libUtilLTLIBRARIES \
+       uninstall-libXferLTLIBRARIES
 
 .MAKE: install-am install-data-am install-strip
 
 .PHONY: CTAGS GTAGS all all-am check check-am check-local clean \
        clean-amlibLTLIBRARIES clean-generic \
+       clean-libApplicationLTLIBRARIES clean-libArchiveLTLIBRARIES \
        clean-libCmdlineLTLIBRARIES clean-libConfigLTLIBRARIES \
        clean-libDebugLTLIBRARIES clean-libDeviceLTLIBRARIES \
-       clean-libLogfileLTLIBRARIES clean-libTapefileLTLIBRARIES \
+       clean-libLogfileLTLIBRARIES clean-libMainLoopLTLIBRARIES \
+       clean-libTapelistLTLIBRARIES clean-libTestsLTLIBRARIES \
        clean-libTypesLTLIBRARIES clean-libUtilLTLIBRARIES \
-       clean-libtool ctags dist-hook distclean distclean-compile \
-       distclean-generic distclean-libtool distclean-tags distdir dvi \
-       dvi-am html html-am info info-am install install-AmandaDATA \
-       install-am install-amlibLTLIBRARIES install-data \
-       install-data-am install-data-hook install-dvi install-dvi-am \
-       install-exec install-exec-am install-html install-html-am \
-       install-info install-info-am install-libCmdlineLTLIBRARIES \
+       clean-libXferLTLIBRARIES clean-libtool ctags dist-hook \
+       distclean distclean-compile distclean-generic \
+       distclean-libtool distclean-tags distdir dvi dvi-am html \
+       html-am info info-am install install-AmandaApplicationDATA \
+       install-AmandaChangerDATA install-AmandaDATA \
+       install-Amanda_DBDATA install-am install-amlibLTLIBRARIES \
+       install-data install-data-am install-data-hook install-dvi \
+       install-dvi-am install-exec install-exec-am install-html \
+       install-html-am install-info install-info-am \
+       install-libApplicationLTLIBRARIES \
+       install-libArchiveLTLIBRARIES install-libCmdlineLTLIBRARIES \
        install-libConfigLTLIBRARIES install-libDebugLTLIBRARIES \
        install-libDeviceLTLIBRARIES install-libLogfileLTLIBRARIES \
-       install-libTapefileLTLIBRARIES install-libTypesLTLIBRARIES \
-       install-libUtilLTLIBRARIES install-man install-pdf \
-       install-pdf-am install-ps install-ps-am install-strip \
-       installcheck installcheck-am installdirs maintainer-clean \
+       install-libMainLoopLTLIBRARIES install-libTapelistLTLIBRARIES \
+       install-libTestsLTLIBRARIES install-libTypesLTLIBRARIES \
+       install-libUtilLTLIBRARIES install-libXferLTLIBRARIES \
+       install-man install-pdf install-pdf-am install-ps \
+       install-ps-am install-strip installcheck installcheck-am \
+       installcheck-local installdirs maintainer-clean \
        maintainer-clean-generic mostlyclean mostlyclean-compile \
        mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-       tags uninstall uninstall-AmandaDATA uninstall-am \
-       uninstall-amlibLTLIBRARIES uninstall-libCmdlineLTLIBRARIES \
-       uninstall-libConfigLTLIBRARIES uninstall-libDebugLTLIBRARIES \
-       uninstall-libDeviceLTLIBRARIES uninstall-libLogfileLTLIBRARIES \
-       uninstall-libTapefileLTLIBRARIES uninstall-libTypesLTLIBRARIES \
-       uninstall-libUtilLTLIBRARIES
+       tags uninstall uninstall-AmandaApplicationDATA \
+       uninstall-AmandaChangerDATA uninstall-AmandaDATA \
+       uninstall-Amanda_DBDATA uninstall-am \
+       uninstall-amlibLTLIBRARIES uninstall-libApplicationLTLIBRARIES \
+       uninstall-libArchiveLTLIBRARIES \
+       uninstall-libCmdlineLTLIBRARIES uninstall-libConfigLTLIBRARIES \
+       uninstall-libDebugLTLIBRARIES uninstall-libDeviceLTLIBRARIES \
+       uninstall-libLogfileLTLIBRARIES \
+       uninstall-libMainLoopLTLIBRARIES \
+       uninstall-libTapelistLTLIBRARIES uninstall-libTestsLTLIBRARIES \
+       uninstall-libTypesLTLIBRARIES uninstall-libUtilLTLIBRARIES \
+       uninstall-libXferLTLIBRARIES
 
 
 # Perl
 %: %.pl $(top_builddir)/config.status
        $(top_builddir)/config.status --file=$@:$<
        chmod a+x $@
+       @if test -f $(top_builddir)/perl/.libs/libCmdline.so -o -f $(top_builddir)/perl/libCmdline.so; then \
+               grep -v '^use lib' $@ > $@.nouselib; \
+               $(PERL) $(CHECK_PERL_FLAGS) -I$(top_builddir)/perl -I$(top_builddir)/perl/.libs -I$(top_srcdir)/perl -c -w -T $@.nouselib || exit 1; \
+               rm $@.nouselib; \
+       fi
 
 %.pl: %.pl.in $(top_builddir)/config.status
        $(top_builddir)/config.status --file=$@:$<
@@ -1628,13 +2138,27 @@ uninstall-am: uninstall-AmandaDATA uninstall-amlibLTLIBRARIES \
 
 # syntax-check perl scripts on 'make check'
 check-perl: $(CHECK_PERL)
+       @CHECK_PERL="$(CHECK_PERL)"; \
+       if test -f $(top_builddir)/perl/.libs/libCmdline.so -o -f $(top_builddir)/perl/libCmdline.so; then \
+               if test -n "$(PERL)"; then \
+                       for perlobj in $$CHECK_PERL; do \
+                               grep -v '^use lib' $$perlobj > $$perlobj.nouselib; \
+                               $(PERL) $(CHECK_PERL_FLAGS) -I$(top_builddir)/perl -I$(top_builddir)/perl/.libs -I$(top_srcdir)/perl -c -w -T $$perlobj.nouselib || exit 1; \
+                               rm $$perlobj.nouselib; \
+                       done; \
+               fi \
+       fi
+check-local: check-perl
+
+# syntax-check perl scripts on 'make installcheck'
+installcheck-perl: $(CHECK_PERL)
        @CHECK_PERL="$(CHECK_PERL)"; \
        if test -n "$(PERL)"; then \
                for perlobj in $$CHECK_PERL; do \
                        $(PERL) $(CHECK_PERL_FLAGS) -c -w -T $$perlobj || exit 1; \
                done; \
        fi
-check-local: check-perl
+installcheck-local: installcheck-perl
 check-shell: $(CHECK_SHELL)
        @CHECK_SHELL="$(CHECK_SHELL)"; \
        if test -n "$$CHECK_SHELL"; then \
@@ -1693,8 +2217,22 @@ html: make_html amperl.css $(HTML_SOURCE_FILES)
 @WANT_CYGWIN_COPY_PERL_DLL_TRUE@install-data-hook:
 @WANT_CYGWIN_COPY_PERL_DLL_TRUE@       @for cygdll in $(amperldirauto)/bin/cyg*.dll; do \
 @WANT_CYGWIN_COPY_PERL_DLL_TRUE@           destfname=`echo $$cygdll|sed 's!/bin/cyg\([^.]*\).dll!/\1/\1.dll!'`; \
-@WANT_CYGWIN_COPY_PERL_DLL_TRUE@           cp "$$cygdll" "$$destfname"; \
+@WANT_CYGWIN_COPY_PERL_DLL_TRUE@          cp "$$cygdll" "$$destfname"; \
 @WANT_CYGWIN_COPY_PERL_DLL_TRUE@       done
+
+check-local:
+       @MODULES_TO_CHECK="$(Amanda_DATA) $(Amanda_DB_DATA) $(AmandaChanger_DATA) $(AmandaApplication_DATA)"; \
+       if test -f $(top_builddir)/perl/.libs/libConfig.so -o -f $(top_builddir)/perl/libConfig.so; then \
+               if test -n "$(PERL)"; then \
+                       for perlobj in $$MODULES_TO_CHECK; do \
+                               if test -f $$perlobj; then \
+                                       $(PERL) $(CHECK_PERL_FLAGS) -I$(top_builddir)/perl -I$(top_builddir)/perl/.libs -I$(top_srcdir)/perl -c -T $$perlobj || exit 1; \
+                               else \
+                                       $(PERL) $(CHECK_PERL_FLAGS) -I$(top_builddir)/perl -I$(top_builddir)/perl/.libs -I$(top_srcdir)/perl -c -T $(top_srcdir)/perl/$$perlobj || exit 1; \
+                               fi \
+                       done; \
+               fi \
+        fi
 # 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:
index b9434cda1d4403fa48352162d673b0b139a66835..c0642f966eb639eb2ec850a24c561e740804d4d7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+ * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
  *
  * This library is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License version 2.1 as
@@ -14,8 +14,8 @@
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  *
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 #ifndef AMANDA_AMGLUE_H
  */
 SV *g_hash_table_to_hashref(GHashTable *hash);
 
+/* Turn a GLib hash table (mapping strings to GSList of strings) into a reference
+ * to a Perl hash table.
+ *
+ * @param hash: GLib hash table
+ * @returns: Perl hashref
+ */
+SV *g_hash_table_to_hashref_gslist(GHashTable *hash);
+
+/* Turn a GLib hash table (mapping strings to property_t) into a reference
+ * to a Perl hash table.
+ *
+ * @param hash: GLib hash table
+ * @returns: Perl hashref
+ */
+SV *g_hash_table_to_hashref_property(GHashTable *hash);
+
 /*
  * prototypes for bigint.c
  */
@@ -115,4 +131,64 @@ guint16 amglue_SvU16(SV *sv);
 gint8 amglue_SvI8(SV *sv);
 guint8 amglue_SvU8(SV *sv);
 
+/*
+ * prototypes for source.c
+ */
+
+typedef enum amglue_Source_state {
+    AMGLUE_SOURCE_NEW,
+    AMGLUE_SOURCE_ATTACHED,
+    AMGLUE_SOURCE_DESTROYED
+} amglue_Source_state;
+
+/* There is *one* amglue_Source object for each GSource; this
+ * allows us to attach amglue-related information to the 
+ * GSource.  See amglue/source.c for more detail. */
+
+typedef struct amglue_Source {
+    GSource *src;
+    GSourceFunc callback;
+    gint refcount;
+    amglue_Source_state state;
+    SV *callback_sv;
+} amglue_Source;
+
+/* Get the amglue_Source object associated with this GSource, creating a
+ * new one if necessary, and increment its refcount.
+ *
+ * The 'callback' parameter should be a C function with the
+ * appropriate signature for this GSource.  The callback will
+ * be given the amglue_Source as its 'data' argument, and should
+ * invoke its callback_sv as a Perl sub with the appropriate
+ * parameters.  Simple GSources can use amglue_source_callback_simple,
+ * below.
+ *
+ * This amglue_Source object can be returned directly to perl via a
+ * SWIG binding; it will be bound as an Amanda::MainLoop::Source
+ * object, and its memory management will be handled correctly.
+ *
+ * @param gsrc: the GSource object to wrap
+ * @param callback: function to trigger a perl callback
+ * @returns: an amglue_Source with appropriate refcount
+ */
+amglue_Source *amglue_source_get(GSource *gsrc, GSourceFunc callback);
+
+/* Create a new amglue_Source object for this GSource.  Use this when
+ * the GSource was just created and does not yet have a corresponding
+ * amglue_Source.
+ *
+ * @param gsrc: the GSource object to wrap
+ * @param callback: function to trigger a perl callback
+ * @returns: an amglue_Source with appropriate refcount
+ */
+amglue_Source *amglue_source_new(GSource *gsrc, GSourceFunc callback);
+
+/* Increment the refcount on an amglue_Source */
+#define amglue_source_ref(aS) aS->refcount++
+
+/* Unref an amglue_Source object, freeing it if its refcount reaches
+ * zero.  */
+#define amglue_source_unref(aS) if (!--(aS)->refcount) amglue_source_free((aS))
+void amglue_source_free(amglue_Source *);
+
 #endif /* AMANDA_AMGLUE_H */
index 9ff37f47ccef593b2d3511de98f5d393705fa74a..020178e25580db2ee3c3fc5ab9da811cdf219c01 100644 (file)
@@ -14,8 +14,8 @@
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  *
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 %{
index 73128e6a62519b0cc3c37e65539146a8513fccc8..090dc563bc41f71ef97a69c8fb2917576fec10d8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+ * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
  *
  * This library is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License version 2.1 as
@@ -14,8 +14,8 @@
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  *
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 #include "amglue.h"
@@ -35,7 +35,7 @@ load_Math_BigInt(void)
 
     if (loaded) return;
 
-    eval_pv("use Math::BigInt;", 1);
+    eval_pv("use Math::BigInt; use Amanda::BigIntCompat;", 1);
     loaded = 1;
 }
 
index 0fa198519d9715880d9ee5e7fd144e543884d055..d84b4b7bdfbfd06e70e82059d8a4ad021cf05992 100644 (file)
@@ -14,8 +14,8 @@
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  *
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 /*
index ea4f5cbe7ca433ad0df28f61184e1d579fb5fd1a..a49b8810180aedcd6df6b9d4a891ba68e890b49b 100644 (file)
@@ -14,8 +14,8 @@
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  *
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 /*
index 61a02891918caca2bff1ac942a1804f4f446c9a6..09dbfb79b292fdb244ba372aab255e75819a3fdd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+ * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
  *
  * This library is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License version 2.1 as
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  *
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 #include "amglue.h"
+#include "conffile.h"
 
 static void 
 foreach_fn(gpointer key_p, gpointer value_p, gpointer user_data_p)
@@ -38,3 +39,60 @@ g_hash_table_to_hashref(GHashTable *hash)
 
     return newRV((SV *)hv);
 }
+
+static void 
+foreach_fn_gslist(gpointer key_p, gpointer value_p, gpointer user_data_p)
+{
+    char   *key = key_p;
+    GSList *value_s = value_p;
+    GSList *value;
+    HV     *hv = user_data_p;
+    AV *list = newAV();
+
+    for(value=value_s; value != NULL; value = value->next) {
+       av_push(list, newSVpv(value->data, 0));
+    }
+
+    hv_store(hv, key, strlen(key), newRV_noinc((SV*)list), 0);
+}
+
+SV *
+g_hash_table_to_hashref_gslist(GHashTable *hash)
+{
+    HV *hv = (HV *)sv_2mortal((SV *)newHV());
+
+    g_hash_table_foreach(hash, foreach_fn_gslist, hv);
+
+    return newRV((SV *)hv);
+}
+
+static void 
+foreach_fn_property(gpointer key_p, gpointer value_p, gpointer user_data_p)
+{
+    char       *key = key_p;
+    property_t *property = value_p;
+    GSList     *value;
+    HV         *hv = user_data_p;
+    AV         *list = newAV();
+    HV         *property_hv = newHV();
+
+    hv_store(property_hv, "append", strlen("append"), newSViv(property->append), 0);
+    hv_store(property_hv, "priority", strlen("priority"), newSViv(property->priority), 0);
+    for(value=property->values; value != NULL; value = value->next) {
+       av_push(list, newSVpv(value->data, 0));
+    }
+    hv_store(property_hv, "values", strlen("values"), newRV_noinc((SV*)list), 0);
+
+    hv_store(hv, key, strlen(key), newRV_noinc((SV*)property_hv), 0);
+}
+
+SV *
+g_hash_table_to_hashref_property(GHashTable *hash)
+{
+    HV *hv = (HV *)sv_2mortal((SV *)newHV());
+
+    g_hash_table_foreach(hash, foreach_fn_property, hv);
+
+    return newRV((SV *)hv);
+}
+
index 4ed25c1947867623cdf8d5f3311c265cd0361e7d..5198e256a435bf5709d668fc5444e37005a442b8 100644 (file)
@@ -14,8 +14,8 @@
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  *
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 /* Typedefs for a few glib basic types that SWIG doesn't recognize
index 505e7b7baa51537804ee4a636d62ec92892506d8..64db72a5f4e4fb857ca4826113aef6b70d375b66 100644 (file)
@@ -14,8 +14,8 @@
  * along with this library; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
  *
- * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 %{
diff --git a/perl/amglue/source.c b/perl/amglue/source.c
new file mode 100644 (file)
index 0000000..d7b259a
--- /dev/null
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License version 2.1 as
+ * published by the Free Software Foundation.
+ *
+ * This 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 this library; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+ *
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+ */
+
+#include "amglue.h"
+
+/* GSources are tricky to bind to perl for a few reasons:
+ *  - they have a one-way state machine: once attached and detached, they
+ *    cannot be re-attached
+ *  - different "kinds" of GSources require C-level callbacks with
+ *    different signatures
+ *  - an attached GSource should continue running, even if not referenced
+ *    from perl, while a detached GSource should free all its resources
+ *    when no longer referenced.
+ *
+ * To accomplish all of this, this file implements a "glue object" called
+ * amglue_Source.  There are zero or one amglue_Source objects for each
+ * GSource object, so they serve as a place to store "extra" data about a
+ * GSource.  In particular, they store:
+ *  - a pointer to a C callback function that can trigger a Perl callback
+ *  - a pointer to an SV representing the perl callback to run
+ *  - a reference count
+ * Any number of Perl SV's may reference the amglue_Source -- it tracks this
+ * via its reference count.
+ *
+ * Let's look at this arrangement as it follows a typical usage scenario.  The
+ * numbers in brackets are reference counts.
+ *
+ * -- my $src = Amanda::MainLoop::new_foo_source();
+ * GSrc[1] <----) amSrc[1] <---- $src[1] <--- perl-stack
+ *
+ * The lexical $src contains a reference to the amglue_Source object, which is
+ * referencing the underlying GSource object.  Pretty simple.  The amglue_Source
+ * only counts one reference because the GSource isn't yet attached.  Think of
+ * the ')' in the diagram as a weak reference.  If the perl scope were to end
+ * now, all of these objects would be freed immediately.
+ *
+ * -- $src->set_callback(\&cb);
+ *                              ,--> &cb[1]
+ * GMainLoop --> GSrc[2] <---> amSrc[2]
+ *                              ^--- $src[1] <--- perl-stack
+ *
+ * The GSource has been attached, so GMainLoop holds a reference to it.  The
+ * amglue_Source incremented its own reference count, making the previous weak
+ * reference a full reference, because the link from the GSource will be used
+ * when a callback occurs.  The amglue_Source object also keeps a reference to
+ * the callback coderef.
+ *
+ * -- return;
+ *                              ,--> &cb[1]
+ * GMainLoop --> GSrc[2] <---> amSrc[1]
+ *
+ * When the perl scope ends, the lexical $src is freed, reducing the reference
+ * count on the amglue_Source to 1.  At this point, the object is not accessible
+ * from perl, but it is still accessible from the GSource via a callback.
+ *
+ * -- # in callback
+ *                              ,--> &cb[1]
+ * GMainLoop --> GSrc[2] <---> amSrc[2] <--- $self[1] <--- perl-stack
+ *
+ * When the callback is invoked, a reference to the amglue_Source is placed on
+ * the perl stack, so it is once again referenced twice.
+ *
+ * -- $self->remove();
+ *               GSrc[1] <---) amSrc[1] <--- $self[1] <--- perl-stack
+ *
+ * Now the callback itself has called remove().  The amglue_Source object removes
+ * the GSource from the MainLoop and drops its reference to the perl callback, and
+ * decrements its refcount to again weaken the reference from the GSource.  The
+ * amglue_Source is now useless, but since it is still in scope, it remains
+ * allocated and accessible.
+ *
+ * -- return;
+ *
+ * When the callback returns, the last reference to SV is destroyed, reducing
+ * the reference count to the amglue_Source to zero, reducing the reference to
+ * the GSource to zero.  Everything is gone.
+ */
+
+/* We use a glib 'dataset' to attach an amglue_Source to each GSource
+ * object.  This requires a Quark to describe the kind of data being
+ * attached.
+ *
+ * We define a macro and corresponding global to support access
+ * to our quark.  The compiler will optimize out all but the first
+ * conditional in each function, which is just as we want it. */
+static GQuark _quark = 0;
+#define AMGLUE_SOURCE_QUARK \
+    ( _quark?_quark:(_quark = g_quark_from_static_string("amglue_Source")) )
+
+amglue_Source *
+amglue_source_get(
+    GSource *gsrc,
+    GSourceFunc callback)
+{
+    amglue_Source *src;
+    g_assert(gsrc != NULL);
+
+    src = (amglue_Source *)g_dataset_id_get_data(gsrc, AMGLUE_SOURCE_QUARK);
+
+    if (!src)
+       src = amglue_source_new(gsrc, callback);
+    else
+       amglue_source_ref(src);
+
+    return src;
+}
+
+amglue_Source *
+amglue_source_new(
+    GSource *gsrc,
+    GSourceFunc callback)
+{
+    amglue_Source *src = g_new0(amglue_Source, 1);
+    src->src = gsrc;
+    src->callback = callback;
+    src->state = AMGLUE_SOURCE_NEW;
+    src->refcount = 1;
+    g_dataset_id_set_data(gsrc, AMGLUE_SOURCE_QUARK, (gpointer)src);
+
+    return src;
+}
+
+void
+amglue_source_free(
+    amglue_Source *self)
+{
+    /* if we're attached, we hold a circular reference to ourselves,
+     * so we shouldn't be at refcount=0 */
+    g_assert(self->state != AMGLUE_SOURCE_ATTACHED);
+    g_assert(self->callback_sv == NULL);
+
+    g_dataset_id_remove_data(self->src, AMGLUE_SOURCE_QUARK);
+    g_source_unref(self->src);
+    g_free(self);
+}
index 8409cec4080a20f482863c4a58c3c2b307afc57d..8579121652bcd7e127947325fb108d1bab0d8d11 100644 (file)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  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.
@@ -39,6 +39,7 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps =  \
        $(top_srcdir)/config/macro-archive/ac_define_dir.m4 \
+       $(top_srcdir)/config/macro-archive/ac_perl_module_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_perl_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_swig.m4 \
        $(top_srcdir)/config/macro-archive/ax_compare_version.m4 \
@@ -72,6 +73,7 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/amanda/libs.m4 \
        $(top_srcdir)/config/amanda/net.m4 \
        $(top_srcdir)/config/amanda/progs.m4 \
+       $(top_srcdir)/config/amanda/ps.m4 \
        $(top_srcdir)/config/amanda/readdir.m4 \
        $(top_srcdir)/config/amanda/readline.m4 \
        $(top_srcdir)/config/amanda/rsh-security.m4 \
@@ -94,7 +96,9 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/float_h.m4 \
        $(top_srcdir)/config/gnulib/fsusage.m4 \
        $(top_srcdir)/config/gnulib/getaddrinfo.m4 \
+       $(top_srcdir)/config/gnulib/getopt.m4 \
        $(top_srcdir)/config/gnulib/gettimeofday.m4 \
+       $(top_srcdir)/config/gnulib/gnulib-common.m4 \
        $(top_srcdir)/config/gnulib/gnulib-comp.m4 \
        $(top_srcdir)/config/gnulib/include_next.m4 \
        $(top_srcdir)/config/gnulib/inet_ntop.m4 \
@@ -122,7 +126,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/sys_stat_h.m4 \
        $(top_srcdir)/config/gnulib/sys_time_h.m4 \
        $(top_srcdir)/config/gnulib/tempname.m4 \
-       $(top_srcdir)/config/gnulib/ulonglong.m4 \
        $(top_srcdir)/config/gnulib/unistd_h.m4 \
        $(top_srcdir)/config/gnulib/vasnprintf.m4 \
        $(top_srcdir)/config/gnulib/visibility.m4 \
@@ -133,7 +136,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gettext-macros/lib-ld.m4 \
        $(top_srcdir)/config/gettext-macros/lib-link.m4 \
        $(top_srcdir)/config/gettext-macros/lib-prefix.m4 \
-       $(top_srcdir)/config/gettext-macros/longlong.m4 \
        $(top_srcdir)/config/gettext-macros/nls.m4 \
        $(top_srcdir)/config/gettext-macros/po.m4 \
        $(top_srcdir)/config/gettext-macros/progtest.m4 \
@@ -151,6 +153,7 @@ CONFIG_CLEAN_FILES =
 SOURCES =
 DIST_SOURCES =
 ACLOCAL = @ACLOCAL@
+AIX_BACKUP = @AIX_BACKUP@
 ALLOCA = @ALLOCA@
 ALLOCA_H = @ALLOCA_H@
 AMANDA_DBGDIR = @AMANDA_DBGDIR@
@@ -165,8 +168,10 @@ AMPLOT_CAT_GZIP = @AMPLOT_CAT_GZIP@
 AMPLOT_CAT_PACK = @AMPLOT_CAT_PACK@
 AMPLOT_COMPRESS = @AMPLOT_COMPRESS@
 AMTAR = @AMTAR@
+APPLICATION_DIR = @APPLICATION_DIR@
 AR = @AR@
 ARPA_INET_H = @ARPA_INET_H@
+ASSERTIONS = @ASSERTIONS@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -178,16 +183,28 @@ BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@
 BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@
 BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@
 BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@
+BSDTCP_SECURITY = @BSDTCP_SECURITY@
+BSDUDP_SECURITY = @BSDUDP_SECURITY@
+BSD_SECURITY = @BSD_SECURITY@
 CAT = @CAT@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
+CHECK_USERID = @CHECK_USERID@
 CHIO = @CHIO@
 CHS = @CHS@
+CLIENT_HOST_INSTANCE = @CLIENT_HOST_INSTANCE@
+CLIENT_HOST_KEY_FILE = @CLIENT_HOST_KEY_FILE@
+CLIENT_HOST_PRINCIPAL = @CLIENT_HOST_PRINCIPAL@
 CLIENT_LOGIN = @CLIENT_LOGIN@
 CLIENT_SCRIPTS_OPT = @CLIENT_SCRIPTS_OPT@
 COMPRESS = @COMPRESS@
+COMPRESS_BEST_OPT = @COMPRESS_BEST_OPT@
+COMPRESS_FAST_OPT = @COMPRESS_FAST_OPT@
+COMPRESS_PATH = @COMPRESS_PATH@
+COMPRESS_SUFFIX = @COMPRESS_SUFFIX@
+CONFIG_CLOBBER_MY_CONFIG = @CONFIG_CLOBBER_MY_CONFIG@
 CONFIG_DIR = @CONFIG_DIR@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
@@ -201,6 +218,7 @@ DD = @DD@
 DEFAULT_AMANDATES_FILE = @DEFAULT_AMANDATES_FILE@
 DEFAULT_CHANGER_DEVICE = @DEFAULT_CHANGER_DEVICE@
 DEFAULT_CONFIG = @DEFAULT_CONFIG@
+DEFAULT_MAILER = @DEFAULT_MAILER@
 DEFAULT_SERVER = @DEFAULT_SERVER@
 DEFAULT_TAPE_DEVICE = @DEFAULT_TAPE_DEVICE@
 DEFAULT_TAPE_SERVER = @DEFAULT_TAPE_SERVER@
@@ -208,7 +226,7 @@ DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DOC_BUILD_DATE = @DOC_BUILD_DATE@
 DUMP = @DUMP@
-DUMPER_DIR = @DUMPER_DIR@
+DUMP_RETURNS_1 = @DUMP_RETURNS_1@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -221,6 +239,7 @@ F77 = @F77@
 FFLAGS = @FFLAGS@
 FLOAT_H = @FLOAT_H@
 GETCONF = @GETCONF@
+GETOPT_H = @GETOPT_H@
 GETTEXT = @GETTEXT@
 GLIB_CFLAGS = @GLIB_CFLAGS@
 GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
@@ -231,9 +250,12 @@ GMSGFMT_015 = @GMSGFMT_015@
 GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
 GNULIB_CHOWN = @GNULIB_CHOWN@
 GNULIB_DUP2 = @GNULIB_DUP2@
+GNULIB_ENVIRON = @GNULIB_ENVIRON@
 GNULIB_FCHDIR = @GNULIB_FCHDIR@
 GNULIB_FFLUSH = @GNULIB_FFLUSH@
+GNULIB_FOPEN = @GNULIB_FOPEN@
 GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
+GNULIB_FREOPEN = @GNULIB_FREOPEN@
 GNULIB_FSEEK = @GNULIB_FSEEK@
 GNULIB_FSEEKO = @GNULIB_FSEEKO@
 GNULIB_FTELL = @GNULIB_FTELL@
@@ -243,6 +265,7 @@ GNULIB_GETCWD = @GNULIB_GETCWD@
 GNULIB_GETDELIM = @GNULIB_GETDELIM@
 GNULIB_GETLINE = @GNULIB_GETLINE@
 GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
+GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@
 GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
 GNULIB_LCHOWN = @GNULIB_LCHOWN@
 GNULIB_LSEEK = @GNULIB_LSEEK@
@@ -267,8 +290,10 @@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
 GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
 GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
 GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
+GNULIB_PUTENV = @GNULIB_PUTENV@
 GNULIB_READLINK = @GNULIB_READLINK@
 GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@
+GNULIB_SETENV = @GNULIB_SETENV@
 GNULIB_SLEEP = @GNULIB_SLEEP@
 GNULIB_SNPRINTF = @GNULIB_SNPRINTF@
 GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@
@@ -277,11 +302,15 @@ GNULIB_STPNCPY = @GNULIB_STPNCPY@
 GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
 GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
 GNULIB_STRDUP = @GNULIB_STRDUP@
+GNULIB_STRERROR = @GNULIB_STRERROR@
 GNULIB_STRNDUP = @GNULIB_STRNDUP@
 GNULIB_STRNLEN = @GNULIB_STRNLEN@
 GNULIB_STRPBRK = @GNULIB_STRPBRK@
 GNULIB_STRSEP = @GNULIB_STRSEP@
+GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@
+GNULIB_STRSTR = @GNULIB_STRSTR@
 GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
+GNULIB_UNSETENV = @GNULIB_UNSETENV@
 GNULIB_VASPRINTF = @GNULIB_VASPRINTF@
 GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@
 GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
@@ -295,6 +324,7 @@ GOBJECT_QUERY = @GOBJECT_QUERY@
 GREP = @GREP@
 GZIP = @GZIP@
 HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@
+HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@
 HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@
 HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@
 HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
@@ -303,9 +333,10 @@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
 HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@
 HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
 HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
-HAVE_DECL_STRNCASECMP = @HAVE_DECL_STRNCASECMP@
+HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@
 HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
 HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
+HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@
 HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
 HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
 HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
@@ -313,7 +344,9 @@ HAVE_DUP2 = @HAVE_DUP2@
 HAVE_FSEEKO = @HAVE_FSEEKO@
 HAVE_FTELLO = @HAVE_FTELLO@
 HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
+HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
 HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
+HAVE_GZIP = @HAVE_GZIP@
 HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
 HAVE_IO_H = @HAVE_IO_H@
 HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
@@ -322,8 +355,10 @@ HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@
 HAVE_MEMPCPY = @HAVE_MEMPCPY@
 HAVE_MKDTEMP = @HAVE_MKDTEMP@
 HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@
+HAVE_OS_H = @HAVE_OS_H@
 HAVE_READLINK = @HAVE_READLINK@
 HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@
+HAVE_SETENV = @HAVE_SETENV@
 HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
 HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
 HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
@@ -331,7 +366,6 @@ HAVE_SLEEP = @HAVE_SLEEP@
 HAVE_STDINT_H = @HAVE_STDINT_H@
 HAVE_STPCPY = @HAVE_STPCPY@
 HAVE_STPNCPY = @HAVE_STPNCPY@
-HAVE_STRCASECMP = @HAVE_STRCASECMP@
 HAVE_STRCASESTR = @HAVE_STRCASESTR@
 HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
 HAVE_STRNDUP = @HAVE_STRNDUP@
@@ -340,10 +374,12 @@ HAVE_STRSEP = @HAVE_STRSEP@
 HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@
 HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
 HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
+HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
 HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
 HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
 HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
 HAVE_UNISTD_H = @HAVE_UNISTD_H@
+HAVE_UNSETENV = @HAVE_UNSETENV@
 HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
 HAVE_VASPRINTF = @HAVE_VASPRINTF@
 HAVE_VISIBILITY = @HAVE_VISIBILITY@
@@ -359,6 +395,8 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 INTLLIBS = @INTLLIBS@
 INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+KRB4_SECURITY = @KRB4_SECURITY@
+KRB5_SECURITY = @KRB5_SECURITY@
 LDFLAGS = @LDFLAGS@
 LEX = @LEX@
 LEXLIB = @LEXLIB@
@@ -375,6 +413,8 @@ LIBTHREAD = @LIBTHREAD@
 LIBTOOL = @LIBTOOL@
 LIBTOOL_DEPS = @LIBTOOL_DEPS@
 LN_S = @LN_S@
+LOCKING = @LOCKING@
+LOW_TCPPORTRANGE = @LOW_TCPPORTRANGE@
 LTLIBICONV = @LTLIBICONV@
 LTLIBINTL = @LTLIBINTL@
 LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
@@ -383,7 +423,6 @@ LTLIBPTH = @LTLIBPTH@
 LTLIBTHREAD = @LTLIBTHREAD@
 MAILER = @MAILER@
 MAKEINFO = @MAKEINFO@
-MAXTAPEBLOCKSIZE = @MAXTAPEBLOCKSIZE@
 MCUTIL = @MCUTIL@
 MKDIR_P = @MKDIR_P@
 MSGFMT = msgfmt
@@ -421,26 +460,37 @@ PERL_INC = @PERL_INC@
 PKG_CONFIG = @PKG_CONFIG@
 POSUB = @POSUB@
 PRINT = @PRINT@
+PS = @PS@
+PS_ARGUMENT = @PS_ARGUMENT@
 PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
 RANLIB = @RANLIB@
 READLINE_LIBS = @READLINE_LIBS@
 REPLACE_CHOWN = @REPLACE_CHOWN@
 REPLACE_FCHDIR = @REPLACE_FCHDIR@
 REPLACE_FFLUSH = @REPLACE_FFLUSH@
+REPLACE_FOPEN = @REPLACE_FOPEN@
 REPLACE_FPRINTF = @REPLACE_FPRINTF@
+REPLACE_FREOPEN = @REPLACE_FREOPEN@
 REPLACE_FSEEK = @REPLACE_FSEEK@
 REPLACE_FSEEKO = @REPLACE_FSEEKO@
 REPLACE_FTELL = @REPLACE_FTELL@
 REPLACE_FTELLO = @REPLACE_FTELLO@
 REPLACE_GETCWD = @REPLACE_GETCWD@
 REPLACE_GETLINE = @REPLACE_GETLINE@
+REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
 REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
 REPLACE_LCHOWN = @REPLACE_LCHOWN@
 REPLACE_LSEEK = @REPLACE_LSEEK@
+REPLACE_MEMMEM = @REPLACE_MEMMEM@
 REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
 REPLACE_PRINTF = @REPLACE_PRINTF@
+REPLACE_PUTENV = @REPLACE_PUTENV@
 REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
 REPLACE_SPRINTF = @REPLACE_SPRINTF@
+REPLACE_STRCASESTR = @REPLACE_STRCASESTR@
+REPLACE_STRERROR = @REPLACE_STRERROR@
+REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@
+REPLACE_STRSTR = @REPLACE_STRSTR@
 REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
 REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
 REPLACE_VPRINTF = @REPLACE_VPRINTF@
@@ -448,7 +498,11 @@ REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
 REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
 REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
 RESTORE = @RESTORE@
+RSH_SECURITY = @RSH_SECURITY@
 SAMBA_CLIENT = @SAMBA_CLIENT@
+SERVER_HOST_INSTANCE = @SERVER_HOST_INSTANCE@
+SERVER_HOST_KEY_FILE = @SERVER_HOST_KEY_FILE@
+SERVER_HOST_PRINCIPAL = @SERVER_HOST_PRINCIPAL@
 SERVICE_SUFFIX = @SERVICE_SUFFIX@
 SETUID_GROUP = @SETUID_GROUP@
 SET_MAKE = @SET_MAKE@
@@ -458,6 +512,7 @@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
 SNAPSHOT_STAMP = @SNAPSHOT_STAMP@
 SORT = @SORT@
 SSH = @SSH@
+SSH_SECURITY = @SSH_SECURITY@
 STDBOOL_H = @STDBOOL_H@
 STDINT_H = @STDINT_H@
 STRIP = @STRIP@
@@ -467,7 +522,14 @@ SWIG_LIB = @SWIG_LIB@
 SYS_SOCKET_H = @SYS_SOCKET_H@
 SYS_STAT_H = @SYS_STAT_H@
 SYS_TIME_H = @SYS_TIME_H@
+TCPPORTRANGE = @TCPPORTRANGE@
+TICKET_LIFETIME = @TICKET_LIFETIME@
+UDPPORTRANGE = @UDPPORTRANGE@
+UNCOMPRESS_OPT = @UNCOMPRESS_OPT@
+UNCOMPRESS_PATH = @UNCOMPRESS_PATH@
+USE_AMANDAHOSTS = @USE_AMANDAHOSTS@
 USE_NLS = @USE_NLS@
+USE_RUNDUMP = @USE_RUNDUMP@
 USE_VERSION_SUFFIXES = @USE_VERSION_SUFFIXES@
 VDUMP = @VDUMP@
 VERSION = @VERSION@
@@ -476,6 +538,7 @@ VERSION_MAJOR = @VERSION_MAJOR@
 VERSION_MINOR = @VERSION_MINOR@
 VERSION_PATCH = @VERSION_PATCH@
 VERSION_SUFFIX = @VERSION_SUFFIX@
+VOID_UNSETENV = @VOID_UNSETENV@
 VRESTORE = @VRESTORE@
 VXDUMP = @VXDUMP@
 VXRESTORE = @VXRESTORE@
@@ -504,6 +567,7 @@ am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+amdatadir = @amdatadir@
 amincludedir = @amincludedir@
 amlibdir = @amlibdir@
 amlibexecdir = @amlibexecdir@
@@ -522,6 +586,8 @@ dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 gl_LIBOBJS = @gl_LIBOBJS@
 gl_LTLIBOBJS = @gl_LTLIBOBJS@
+gltests_LIBOBJS = @gltests_LIBOBJS@
+gltests_LTLIBOBJS = @gltests_LTLIBOBJS@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
@@ -551,6 +617,7 @@ target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
 
 # This variable depends on the location of this directory.
 top_builddir = ..
index 5face92160014e52cec0c9a4d63319b5b0c33f49..ec25b9e30be179e92d3a16b47ad04cce13e51500 100644 (file)
@@ -1,18 +1,20 @@
 # Makefile for Amanda file recovery programs.
 
+include $(top_srcdir)/config/automake/vars.am
 include $(top_srcdir)/config/automake/installperms.am
 include $(top_srcdir)/config/automake/precompile.am
 
 INCLUDES =     -I$(top_builddir)/common-src \
                -I$(top_srcdir)/common-src   \
                -I$(top_srcdir)/client-src   \
+               -I$(top_srcdir)/amandad-src   \
                -I$(top_srcdir)/gnulib
 
 AM_CFLAGS = $(AMANDA_WARNING_CFLAGS)
 AM_LDFLAGS = $(AMANDA_STATIC_LDFLAGS)
 
-LINT=@AMLINT@
-LINTFLAGS=@AMLINTFLAGS@
+LINT=$(AMLINT)
+LINTFLAGS=$(AMLINTFLAGS)
 
 LIB_EXTENSION = la
 
@@ -29,8 +31,7 @@ LDADD = ../common-src/libamanda.$(LIB_EXTENSION) \
        @LEXLIB@ \
        $(READLINE_LIBS) \
        ../client-src/libamclient.$(LIB_EXTENSION) \
-       ../common-src/libamanda.$(LIB_EXTENSION) \
-       ../gnulib/libgnu.$(LIB_EXTENSION) 
+       ../common-src/libamanda.$(LIB_EXTENSION)
 
 amrecover_CSRC =       amrecover.c                                     \
                        display_commands.c              extract_list.c  \
@@ -55,7 +56,7 @@ uparse.$(OBJEXT): uparse.c
        $(CC) $(CFLAGS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(CPPFLAGS) -c $<
 
 INSTALLPERMS_exec = \
-       dest=$(sbindir) chown=amanda chmod=o-rwx $(sbin_PROGRAMS)
+       dest=$(sbindir) chown=amanda chmod=0750 $(sbin_PROGRAMS)
 
 lint:
        @f="$(amrecover_CSRC)";                                                 \
index 1494a1a076bd3679a1c5743a03a78c1f8a84f70a..3ff62e566820bc38e27da0d8b2161069e7e84a6d 100644 (file)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  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.
 
 # Makefile for Amanda file recovery programs.
 
+# vim:ft=automake
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+# 
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License version 2.1 as 
+# published by the Free Software Foundation.
+# 
+# This 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 this library; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+# 
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+# simple include file to pre-define variables which are then +='d by other
+# scripts in this directory.
+
 # vim:ft=automake
 #
 # Adjust post-install permissions settings.  This rule works off two
@@ -43,7 +65,7 @@
 # INSTALLPERMS_exec = \
 #      dest=$(sbindir) chown=amanda chmod= \
 #              foo bar \
-#      chmod=u+s,o-rwx \
+#      chmod=07450 \
 #              bing
 #      dest=$(libexecdir) chmod= \
 #              $(libexec_PROGRAMS)
 #
 # This whole operation is not required when making builds for packaging,
 # and can be disabled with --disable-installperms, via the WANT_INSTALLPERMS
-# AM_CONDITIONAL.
+# AM_CONDITIONAL.  When disabled, the file 'installperms.sh' in the top-level
+# build directory is populated with a format suitable for shell interpretation,
+# with lines like this:
+#   installperm "amanda:disk" "04750" "/usr/local/sbin/bing"
+# the arguments being, respectively, owner:group, mode, and filename.  There will
+# be exactly one line for each file which has specific permissions.  The intention
+# is that this file be used by packaging scripts to set correct permissions at install
+# time.  Note that files which have no special permissions requirements do not appear 
+# in this file at all, due to limitations of Automake.
 
 # vim:ft=automake
 
@@ -80,13 +110,16 @@ target_triplet = @target@
 DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
        $(srcdir)/Makefile.in \
        $(top_srcdir)/config/automake/installperms.am \
-       $(top_srcdir)/config/automake/precompile.am uparse.c uparse.h \
+       $(top_srcdir)/config/automake/precompile.am \
+       $(top_srcdir)/config/automake/vars.am uparse.c uparse.h \
        uscan.c
+@WANT_INSTALLPERMS_FALSE@am__append_1 = $(installperms_sh)
 sbin_PROGRAMS = amrecover$(EXEEXT)
 subdir = recover-src
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps =  \
        $(top_srcdir)/config/macro-archive/ac_define_dir.m4 \
+       $(top_srcdir)/config/macro-archive/ac_perl_module_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_perl_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_swig.m4 \
        $(top_srcdir)/config/macro-archive/ax_compare_version.m4 \
@@ -120,6 +153,7 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/amanda/libs.m4 \
        $(top_srcdir)/config/amanda/net.m4 \
        $(top_srcdir)/config/amanda/progs.m4 \
+       $(top_srcdir)/config/amanda/ps.m4 \
        $(top_srcdir)/config/amanda/readdir.m4 \
        $(top_srcdir)/config/amanda/readline.m4 \
        $(top_srcdir)/config/amanda/rsh-security.m4 \
@@ -142,7 +176,9 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/float_h.m4 \
        $(top_srcdir)/config/gnulib/fsusage.m4 \
        $(top_srcdir)/config/gnulib/getaddrinfo.m4 \
+       $(top_srcdir)/config/gnulib/getopt.m4 \
        $(top_srcdir)/config/gnulib/gettimeofday.m4 \
+       $(top_srcdir)/config/gnulib/gnulib-common.m4 \
        $(top_srcdir)/config/gnulib/gnulib-comp.m4 \
        $(top_srcdir)/config/gnulib/include_next.m4 \
        $(top_srcdir)/config/gnulib/inet_ntop.m4 \
@@ -170,7 +206,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/sys_stat_h.m4 \
        $(top_srcdir)/config/gnulib/sys_time_h.m4 \
        $(top_srcdir)/config/gnulib/tempname.m4 \
-       $(top_srcdir)/config/gnulib/ulonglong.m4 \
        $(top_srcdir)/config/gnulib/unistd_h.m4 \
        $(top_srcdir)/config/gnulib/vasnprintf.m4 \
        $(top_srcdir)/config/gnulib/visibility.m4 \
@@ -181,7 +216,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gettext-macros/lib-ld.m4 \
        $(top_srcdir)/config/gettext-macros/lib-link.m4 \
        $(top_srcdir)/config/gettext-macros/lib-prefix.m4 \
-       $(top_srcdir)/config/gettext-macros/longlong.m4 \
        $(top_srcdir)/config/gettext-macros/nls.m4 \
        $(top_srcdir)/config/gettext-macros/po.m4 \
        $(top_srcdir)/config/gettext-macros/progtest.m4 \
@@ -209,9 +243,8 @@ am__DEPENDENCIES_1 =
 amrecover_DEPENDENCIES = ../common-src/libamanda.$(LIB_EXTENSION) \
        $(am__DEPENDENCIES_1) \
        ../client-src/libamclient.$(LIB_EXTENSION) \
-       ../common-src/libamanda.$(LIB_EXTENSION) \
-       ../gnulib/libgnu.$(LIB_EXTENSION)
-DEFAULT_INCLUDES = -I. -I$(top_builddir)/config@am__isrc@
+       ../common-src/libamanda.$(LIB_EXTENSION)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/config
 depcomp = $(SHELL) $(top_srcdir)/config/depcomp
 am__depfiles_maybe = depfiles
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
@@ -237,6 +270,7 @@ ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
+AIX_BACKUP = @AIX_BACKUP@
 ALLOCA = @ALLOCA@
 ALLOCA_H = @ALLOCA_H@
 AMANDA_DBGDIR = @AMANDA_DBGDIR@
@@ -251,8 +285,10 @@ AMPLOT_CAT_GZIP = @AMPLOT_CAT_GZIP@
 AMPLOT_CAT_PACK = @AMPLOT_CAT_PACK@
 AMPLOT_COMPRESS = @AMPLOT_COMPRESS@
 AMTAR = @AMTAR@
+APPLICATION_DIR = @APPLICATION_DIR@
 AR = @AR@
 ARPA_INET_H = @ARPA_INET_H@
+ASSERTIONS = @ASSERTIONS@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -264,16 +300,28 @@ BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@
 BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@
 BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@
 BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@
+BSDTCP_SECURITY = @BSDTCP_SECURITY@
+BSDUDP_SECURITY = @BSDUDP_SECURITY@
+BSD_SECURITY = @BSD_SECURITY@
 CAT = @CAT@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
+CHECK_USERID = @CHECK_USERID@
 CHIO = @CHIO@
 CHS = @CHS@
+CLIENT_HOST_INSTANCE = @CLIENT_HOST_INSTANCE@
+CLIENT_HOST_KEY_FILE = @CLIENT_HOST_KEY_FILE@
+CLIENT_HOST_PRINCIPAL = @CLIENT_HOST_PRINCIPAL@
 CLIENT_LOGIN = @CLIENT_LOGIN@
 CLIENT_SCRIPTS_OPT = @CLIENT_SCRIPTS_OPT@
 COMPRESS = @COMPRESS@
+COMPRESS_BEST_OPT = @COMPRESS_BEST_OPT@
+COMPRESS_FAST_OPT = @COMPRESS_FAST_OPT@
+COMPRESS_PATH = @COMPRESS_PATH@
+COMPRESS_SUFFIX = @COMPRESS_SUFFIX@
+CONFIG_CLOBBER_MY_CONFIG = @CONFIG_CLOBBER_MY_CONFIG@
 CONFIG_DIR = @CONFIG_DIR@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
@@ -287,6 +335,7 @@ DD = @DD@
 DEFAULT_AMANDATES_FILE = @DEFAULT_AMANDATES_FILE@
 DEFAULT_CHANGER_DEVICE = @DEFAULT_CHANGER_DEVICE@
 DEFAULT_CONFIG = @DEFAULT_CONFIG@
+DEFAULT_MAILER = @DEFAULT_MAILER@
 DEFAULT_SERVER = @DEFAULT_SERVER@
 DEFAULT_TAPE_DEVICE = @DEFAULT_TAPE_DEVICE@
 DEFAULT_TAPE_SERVER = @DEFAULT_TAPE_SERVER@
@@ -294,7 +343,7 @@ DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DOC_BUILD_DATE = @DOC_BUILD_DATE@
 DUMP = @DUMP@
-DUMPER_DIR = @DUMPER_DIR@
+DUMP_RETURNS_1 = @DUMP_RETURNS_1@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -307,6 +356,7 @@ F77 = @F77@
 FFLAGS = @FFLAGS@
 FLOAT_H = @FLOAT_H@
 GETCONF = @GETCONF@
+GETOPT_H = @GETOPT_H@
 GETTEXT = @GETTEXT@
 GLIB_CFLAGS = @GLIB_CFLAGS@
 GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
@@ -317,9 +367,12 @@ GMSGFMT_015 = @GMSGFMT_015@
 GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
 GNULIB_CHOWN = @GNULIB_CHOWN@
 GNULIB_DUP2 = @GNULIB_DUP2@
+GNULIB_ENVIRON = @GNULIB_ENVIRON@
 GNULIB_FCHDIR = @GNULIB_FCHDIR@
 GNULIB_FFLUSH = @GNULIB_FFLUSH@
+GNULIB_FOPEN = @GNULIB_FOPEN@
 GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
+GNULIB_FREOPEN = @GNULIB_FREOPEN@
 GNULIB_FSEEK = @GNULIB_FSEEK@
 GNULIB_FSEEKO = @GNULIB_FSEEKO@
 GNULIB_FTELL = @GNULIB_FTELL@
@@ -329,6 +382,7 @@ GNULIB_GETCWD = @GNULIB_GETCWD@
 GNULIB_GETDELIM = @GNULIB_GETDELIM@
 GNULIB_GETLINE = @GNULIB_GETLINE@
 GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
+GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@
 GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
 GNULIB_LCHOWN = @GNULIB_LCHOWN@
 GNULIB_LSEEK = @GNULIB_LSEEK@
@@ -353,8 +407,10 @@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
 GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
 GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
 GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
+GNULIB_PUTENV = @GNULIB_PUTENV@
 GNULIB_READLINK = @GNULIB_READLINK@
 GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@
+GNULIB_SETENV = @GNULIB_SETENV@
 GNULIB_SLEEP = @GNULIB_SLEEP@
 GNULIB_SNPRINTF = @GNULIB_SNPRINTF@
 GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@
@@ -363,11 +419,15 @@ GNULIB_STPNCPY = @GNULIB_STPNCPY@
 GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
 GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
 GNULIB_STRDUP = @GNULIB_STRDUP@
+GNULIB_STRERROR = @GNULIB_STRERROR@
 GNULIB_STRNDUP = @GNULIB_STRNDUP@
 GNULIB_STRNLEN = @GNULIB_STRNLEN@
 GNULIB_STRPBRK = @GNULIB_STRPBRK@
 GNULIB_STRSEP = @GNULIB_STRSEP@
+GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@
+GNULIB_STRSTR = @GNULIB_STRSTR@
 GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
+GNULIB_UNSETENV = @GNULIB_UNSETENV@
 GNULIB_VASPRINTF = @GNULIB_VASPRINTF@
 GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@
 GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
@@ -381,6 +441,7 @@ GOBJECT_QUERY = @GOBJECT_QUERY@
 GREP = @GREP@
 GZIP = @GZIP@
 HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@
+HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@
 HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@
 HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@
 HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
@@ -389,9 +450,10 @@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
 HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@
 HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
 HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
-HAVE_DECL_STRNCASECMP = @HAVE_DECL_STRNCASECMP@
+HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@
 HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
 HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
+HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@
 HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
 HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
 HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
@@ -399,7 +461,9 @@ HAVE_DUP2 = @HAVE_DUP2@
 HAVE_FSEEKO = @HAVE_FSEEKO@
 HAVE_FTELLO = @HAVE_FTELLO@
 HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
+HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
 HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
+HAVE_GZIP = @HAVE_GZIP@
 HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
 HAVE_IO_H = @HAVE_IO_H@
 HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
@@ -408,8 +472,10 @@ HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@
 HAVE_MEMPCPY = @HAVE_MEMPCPY@
 HAVE_MKDTEMP = @HAVE_MKDTEMP@
 HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@
+HAVE_OS_H = @HAVE_OS_H@
 HAVE_READLINK = @HAVE_READLINK@
 HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@
+HAVE_SETENV = @HAVE_SETENV@
 HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
 HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
 HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
@@ -417,7 +483,6 @@ HAVE_SLEEP = @HAVE_SLEEP@
 HAVE_STDINT_H = @HAVE_STDINT_H@
 HAVE_STPCPY = @HAVE_STPCPY@
 HAVE_STPNCPY = @HAVE_STPNCPY@
-HAVE_STRCASECMP = @HAVE_STRCASECMP@
 HAVE_STRCASESTR = @HAVE_STRCASESTR@
 HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
 HAVE_STRNDUP = @HAVE_STRNDUP@
@@ -426,10 +491,12 @@ HAVE_STRSEP = @HAVE_STRSEP@
 HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@
 HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
 HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
+HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
 HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
 HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
 HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
 HAVE_UNISTD_H = @HAVE_UNISTD_H@
+HAVE_UNSETENV = @HAVE_UNSETENV@
 HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
 HAVE_VASPRINTF = @HAVE_VASPRINTF@
 HAVE_VISIBILITY = @HAVE_VISIBILITY@
@@ -445,6 +512,8 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 INTLLIBS = @INTLLIBS@
 INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+KRB4_SECURITY = @KRB4_SECURITY@
+KRB5_SECURITY = @KRB5_SECURITY@
 LDFLAGS = @LDFLAGS@
 LEX = @LEX@
 LEXLIB = @LEXLIB@
@@ -461,6 +530,8 @@ LIBTHREAD = @LIBTHREAD@
 LIBTOOL = @LIBTOOL@
 LIBTOOL_DEPS = @LIBTOOL_DEPS@
 LN_S = @LN_S@
+LOCKING = @LOCKING@
+LOW_TCPPORTRANGE = @LOW_TCPPORTRANGE@
 LTLIBICONV = @LTLIBICONV@
 LTLIBINTL = @LTLIBINTL@
 LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
@@ -469,7 +540,6 @@ LTLIBPTH = @LTLIBPTH@
 LTLIBTHREAD = @LTLIBTHREAD@
 MAILER = @MAILER@
 MAKEINFO = @MAKEINFO@
-MAXTAPEBLOCKSIZE = @MAXTAPEBLOCKSIZE@
 MCUTIL = @MCUTIL@
 MKDIR_P = @MKDIR_P@
 MSGFMT = @MSGFMT@
@@ -505,26 +575,37 @@ PERL_INC = @PERL_INC@
 PKG_CONFIG = @PKG_CONFIG@
 POSUB = @POSUB@
 PRINT = @PRINT@
+PS = @PS@
+PS_ARGUMENT = @PS_ARGUMENT@
 PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
 RANLIB = @RANLIB@
 READLINE_LIBS = @READLINE_LIBS@
 REPLACE_CHOWN = @REPLACE_CHOWN@
 REPLACE_FCHDIR = @REPLACE_FCHDIR@
 REPLACE_FFLUSH = @REPLACE_FFLUSH@
+REPLACE_FOPEN = @REPLACE_FOPEN@
 REPLACE_FPRINTF = @REPLACE_FPRINTF@
+REPLACE_FREOPEN = @REPLACE_FREOPEN@
 REPLACE_FSEEK = @REPLACE_FSEEK@
 REPLACE_FSEEKO = @REPLACE_FSEEKO@
 REPLACE_FTELL = @REPLACE_FTELL@
 REPLACE_FTELLO = @REPLACE_FTELLO@
 REPLACE_GETCWD = @REPLACE_GETCWD@
 REPLACE_GETLINE = @REPLACE_GETLINE@
+REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
 REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
 REPLACE_LCHOWN = @REPLACE_LCHOWN@
 REPLACE_LSEEK = @REPLACE_LSEEK@
+REPLACE_MEMMEM = @REPLACE_MEMMEM@
 REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
 REPLACE_PRINTF = @REPLACE_PRINTF@
+REPLACE_PUTENV = @REPLACE_PUTENV@
 REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
 REPLACE_SPRINTF = @REPLACE_SPRINTF@
+REPLACE_STRCASESTR = @REPLACE_STRCASESTR@
+REPLACE_STRERROR = @REPLACE_STRERROR@
+REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@
+REPLACE_STRSTR = @REPLACE_STRSTR@
 REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
 REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
 REPLACE_VPRINTF = @REPLACE_VPRINTF@
@@ -532,7 +613,11 @@ REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
 REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
 REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
 RESTORE = @RESTORE@
+RSH_SECURITY = @RSH_SECURITY@
 SAMBA_CLIENT = @SAMBA_CLIENT@
+SERVER_HOST_INSTANCE = @SERVER_HOST_INSTANCE@
+SERVER_HOST_KEY_FILE = @SERVER_HOST_KEY_FILE@
+SERVER_HOST_PRINCIPAL = @SERVER_HOST_PRINCIPAL@
 SERVICE_SUFFIX = @SERVICE_SUFFIX@
 SETUID_GROUP = @SETUID_GROUP@
 SET_MAKE = @SET_MAKE@
@@ -542,6 +627,7 @@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
 SNAPSHOT_STAMP = @SNAPSHOT_STAMP@
 SORT = @SORT@
 SSH = @SSH@
+SSH_SECURITY = @SSH_SECURITY@
 STDBOOL_H = @STDBOOL_H@
 STDINT_H = @STDINT_H@
 STRIP = @STRIP@
@@ -551,7 +637,14 @@ SWIG_LIB = @SWIG_LIB@
 SYS_SOCKET_H = @SYS_SOCKET_H@
 SYS_STAT_H = @SYS_STAT_H@
 SYS_TIME_H = @SYS_TIME_H@
+TCPPORTRANGE = @TCPPORTRANGE@
+TICKET_LIFETIME = @TICKET_LIFETIME@
+UDPPORTRANGE = @UDPPORTRANGE@
+UNCOMPRESS_OPT = @UNCOMPRESS_OPT@
+UNCOMPRESS_PATH = @UNCOMPRESS_PATH@
+USE_AMANDAHOSTS = @USE_AMANDAHOSTS@
 USE_NLS = @USE_NLS@
+USE_RUNDUMP = @USE_RUNDUMP@
 USE_VERSION_SUFFIXES = @USE_VERSION_SUFFIXES@
 VDUMP = @VDUMP@
 VERSION = @VERSION@
@@ -560,6 +653,7 @@ VERSION_MAJOR = @VERSION_MAJOR@
 VERSION_MINOR = @VERSION_MINOR@
 VERSION_PATCH = @VERSION_PATCH@
 VERSION_SUFFIX = @VERSION_SUFFIX@
+VOID_UNSETENV = @VOID_UNSETENV@
 VRESTORE = @VRESTORE@
 VXDUMP = @VXDUMP@
 VXRESTORE = @VXRESTORE@
@@ -588,6 +682,7 @@ am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+amdatadir = @amdatadir@
 amincludedir = @amincludedir@
 amlibdir = @amlibdir@
 amlibexecdir = @amlibexecdir@
@@ -606,6 +701,8 @@ dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 gl_LIBOBJS = @gl_LIBOBJS@
 gl_LTLIBOBJS = @gl_LTLIBOBJS@
+gltests_LIBOBJS = @gltests_LIBOBJS@
+gltests_LTLIBOBJS = @gltests_LTLIBOBJS@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
@@ -635,21 +732,49 @@ target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
+SUFFIXES = 
+EXTRA_DIST = 
+BUILT_SOURCES = 
+MOSTLYCLEANFILES = 
+CLEANFILES = 
+DISTCLEANFILES = $(am__append_1)
+MAINTAINERCLEANFILES = 
 
 # sed expression to strip leading directories from a filename; this converts e.g.,
 # src/foo/bar.so to bar.so.
 strip_leading_dirs = s|^.*/||
+@WANT_INSTALLPERMS_FALSE@do_file = pa="$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
+@WANT_INSTALLPERMS_FALSE@    echo "installperm \"$$chown\" \"$$chmod\" \"$$pa\"" >> "$(installperms_sh)"
+
+
+# define a snippet of the scripts below to either perform a chown/chmod operation,
+# or record that operation in the logfile.  On entry to the snippet, $$dest is the
+# destination directory, $$cmd is the srcdir-relative pathname of the target file,
+# $$chown is the ownership, and $$chmod is the permission pattern.
+@WANT_INSTALLPERMS_TRUE@do_file = pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
+@WANT_INSTALLPERMS_TRUE@    if test -n "$$chown"; then \
+@WANT_INSTALLPERMS_TRUE@       echo chown "$$chown" "$$pa"; \
+@WANT_INSTALLPERMS_TRUE@       chown "$$chown" "$$pa" || exit 1; \
+@WANT_INSTALLPERMS_TRUE@    fi; \
+@WANT_INSTALLPERMS_TRUE@    if test -n "$$chmod"; then \
+@WANT_INSTALLPERMS_TRUE@       echo chmod "$$chmod" "$$pa"; \
+@WANT_INSTALLPERMS_TRUE@       chmod "$$chmod" "$$pa" || exit 1; \
+@WANT_INSTALLPERMS_TRUE@    fi 
+
+@WANT_INSTALLPERMS_FALSE@installperms_sh = "$(top_builddir)/installperms.sh"
 INCLUDES = -I$(top_builddir)/common-src \
                -I$(top_srcdir)/common-src   \
                -I$(top_srcdir)/client-src   \
+               -I$(top_srcdir)/amandad-src   \
                -I$(top_srcdir)/gnulib
 
 AM_CFLAGS = $(AMANDA_WARNING_CFLAGS)
 AM_LDFLAGS = $(AMANDA_STATIC_LDFLAGS)
-LINT = @AMLINT@
-LINTFLAGS = @AMLINTFLAGS@
+LINT = $(AMLINT)
+LINTFLAGS = $(AMLINTFLAGS)
 LIB_EXTENSION = la
 
 ###
@@ -662,8 +787,7 @@ LDADD = ../common-src/libamanda.$(LIB_EXTENSION) \
        @LEXLIB@ \
        $(READLINE_LIBS) \
        ../client-src/libamclient.$(LIB_EXTENSION) \
-       ../common-src/libamanda.$(LIB_EXTENSION) \
-       ../gnulib/libgnu.$(LIB_EXTENSION) 
+       ../common-src/libamanda.$(LIB_EXTENSION)
 
 amrecover_CSRC = amrecover.c                                   \
                        display_commands.c              extract_list.c  \
@@ -673,13 +797,14 @@ amrecover_SOURCES = $(amrecover_CSRC)     uparse.y        uscan.l
 noinst_HEADERS = amrecover.h uparse.h
 AM_YFLAGS = -d
 INSTALLPERMS_exec = \
-       dest=$(sbindir) chown=amanda chmod=o-rwx $(sbin_PROGRAMS)
+       dest=$(sbindir) chown=amanda chmod=0750 $(sbin_PROGRAMS)
 
-all: all-am
+all: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) all-am
 
 .SUFFIXES:
 .SUFFIXES: .c .l .lo .o .obj .y
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(top_srcdir)/config/automake/installperms.am $(top_srcdir)/config/automake/precompile.am $(am__configure_deps)
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(top_srcdir)/config/automake/vars.am $(top_srcdir)/config/automake/installperms.am $(top_srcdir)/config/automake/precompile.am $(am__configure_deps)
        @for dep in $?; do \
          case '$(am__configure_deps)' in \
            *$$dep*) \
@@ -717,8 +842,8 @@ install-sbinPROGRAMS: $(sbin_PROGRAMS)
             || test -f $$p1 \
          ; then \
            f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
-          echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \
-          $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(sbindir)/$$f" || exit 1; \
+          echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \
+          $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(sbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(sbindir)/$$f" || exit 1; \
          else :; fi; \
        done
 
@@ -797,8 +922,8 @@ ID: $(HEADERS) $(SOURCES) $(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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
        mkid -fID $$unique
 tags: TAGS
 
@@ -810,8 +935,8 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
        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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { 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) \
@@ -821,13 +946,12 @@ ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
                $(TAGS_FILES) $(LISP)
        tags=; \
-       here=`pwd`; \
        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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
        test -z "$(CTAGS_ARGS)$$tags$$unique" \
          || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
             $$tags $$unique
@@ -867,13 +991,15 @@ distdir: $(DISTFILES)
          fi; \
        done
 check-am: all-am
-check: check-am
+check: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) check-am
 all-am: Makefile $(PROGRAMS) $(HEADERS)
 installdirs:
        for dir in "$(DESTDIR)$(sbindir)"; do \
          test -z "$$dir" || $(MKDIR_P) "$$dir"; \
        done
-install: install-am
+install: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) install-am
 install-exec: install-exec-am
 install-data: install-data-am
 uninstall: uninstall-am
@@ -888,11 +1014,14 @@ install-strip:
          `test -z '$(STRIP)' || \
            echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
+       -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
 
 clean-generic:
+       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
        -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+       -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
 
 maintainer-clean-generic:
        @echo "This command is intended for maintainers to use"
@@ -900,8 +1029,8 @@ maintainer-clean-generic:
        -rm -f uparse.c
        -rm -f uparse.h
        -rm -f uscan.c
-@WANT_INSTALLPERMS_FALSE@install-exec-hook:
-@WANT_INSTALLPERMS_FALSE@install-data-hook:
+       -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+       -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
 clean: clean-am
 
 clean-am: clean-generic clean-libtool clean-sbinPROGRAMS \
@@ -983,52 +1112,40 @@ uninstall-am: uninstall-sbinPROGRAMS
        uninstall-sbinPROGRAMS
 
 
-@WANT_INSTALLPERMS_TRUE@installperms-exec:
-@WANT_INSTALLPERMS_TRUE@       @installperms="$(INSTALLPERMS_exec)"; \
-@WANT_INSTALLPERMS_TRUE@       test -n "$$installperms" && echo "Setting installation permissions on executables"; \
-@WANT_INSTALLPERMS_TRUE@       dest=; chown=; chmod=; \
-@WANT_INSTALLPERMS_TRUE@       for cmd in $$installperms; do \
-@WANT_INSTALLPERMS_TRUE@           case "$$cmd" in \
-@WANT_INSTALLPERMS_TRUE@               chown=amanda) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
-@WANT_INSTALLPERMS_TRUE@               dest=*|chown=*|chmod=*) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; eval $$cmd;; \
-@WANT_INSTALLPERMS_TRUE@               *)  pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chown"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chown "$$chown" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chown "$$chown" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chmod"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chmod "$$chmod" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chmod "$$chmod" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@           esac; \
-@WANT_INSTALLPERMS_TRUE@       done
-
-@WANT_INSTALLPERMS_TRUE@installperms-data:
-@WANT_INSTALLPERMS_TRUE@       @installperms="$(INSTALLPERMS_data)"; \
-@WANT_INSTALLPERMS_TRUE@       test -n "$$installperms" && echo "Setting installation permissions on data"; \
-@WANT_INSTALLPERMS_TRUE@       dest=; chown=; chmod=; \
-@WANT_INSTALLPERMS_TRUE@       for cmd in $$installperms; do \
-@WANT_INSTALLPERMS_TRUE@           case "$$cmd" in \
-@WANT_INSTALLPERMS_TRUE@               chown=amanda) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
-@WANT_INSTALLPERMS_TRUE@               dest=*|chown=*|chmod=*) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; eval $$cmd;; \
-@WANT_INSTALLPERMS_TRUE@               *)  pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chown"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chown "$$chown" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chown "$$chown" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chmod"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chmod "$$chmod" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chmod "$$chmod" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@           esac; \
-@WANT_INSTALLPERMS_TRUE@       done
-
-@WANT_INSTALLPERMS_TRUE@install-exec-hook: installperms-exec
-@WANT_INSTALLPERMS_TRUE@install-data-hook: installperms-data
+installperms-exec:
+       @installperms="$(INSTALLPERMS_exec)"; \
+       test -n "$$installperms" && echo "Setting installation permissions on executables"; \
+       dest=; chown=; chmod=; \
+       for cmd in $$installperms; do \
+           case "$$cmd" in \
+               chown=amanda) \
+                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
+               dest=*|chown=*|chmod=*) \
+                       echo "  ($$cmd)"; eval $$cmd;; \
+               *) $(do_file) ;; \
+           esac; \
+       done
+
+installperms-data:
+       @installperms="$(INSTALLPERMS_data)"; \
+       dest=; chown=; chmod=; \
+       for cmd in $$installperms; do \
+           case "$$cmd" in \
+               chown=amanda) \
+                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
+               dest=*|chown=*|chmod=*) \
+                       echo "  ($$cmd)"; eval $$cmd;; \
+               *)  $(do_file) ;; \
+           esac; \
+       done
+
+install-exec-hook: installperms-exec
+install-data-hook: installperms-data
+
+# define a rule to initialize the installperms manifest file
+@WANT_INSTALLPERMS_TRUE@installperms-init:
+@WANT_INSTALLPERMS_FALSE@installperms-init:
+@WANT_INSTALLPERMS_FALSE@      rm -f "$(installperms_sh)"
 
 # A rule to make precompiler output from C files.  This is not used during
 # ordinary builds, but but can very useful in debugging problems on strange
index 0f103dc87ca87cba193cc226ae2d62b22037b955..49dcd378a6bca358238df9b341f3a759004a6933 100644 (file)
@@ -62,6 +62,7 @@ char *server_line = NULL;
 char *dump_datestamp = NULL;           /* date we are restoring */
 char *dump_hostname;                   /* which machine we are restoring */
 char *disk_name = NULL;                        /* disk we are restoring */
+dle_t *dump_dle = NULL;
 char *mount_point = NULL;              /* where disk was mounted */
 char *disk_path = NULL;                        /* path relative to mount point */
 char dump_date[STR_SIZE];              /* date on which we are restoring */
@@ -135,6 +136,7 @@ get_line(void)
     server_line = newstralloc(server_line, mesg_buffer);
     amfree(mesg_buffer);
     mesg_buffer = newbuf;
+    amrecover_debug(1, "get: %s\n", mesg_buffer);
     return 0;
 }
 
@@ -346,6 +348,13 @@ main(
     /* load the base client configuration */
     config_init(CONFIG_INIT_CLIENT, NULL);
 
+    if (config_errors(NULL) >= CFGERR_WARNINGS) {
+       config_print_errors();
+       if (config_errors(NULL) >= CFGERR_ERRORS) {
+           g_critical(_("errors processing config file"));
+       }
+    }
+
     /* treat amrecover-specific command line options as the equivalent
      * -o command-line options to set configuration values */
     cfg_ovr = new_config_overwrites(argc/2);
@@ -402,7 +411,7 @@ main(
 
     check_running_as(RUNNING_AS_ROOT);
 
-    dbrename(config_name, DBG_SUBDIR_CLIENT);
+    dbrename(get_config_name(), DBG_SUBDIR_CLIENT);
 
     our_features = am_init_feature_set();
     our_features_string = am_feature_to_string(our_features);
@@ -553,7 +562,7 @@ main(
     }
     amfree(line);
 
-    line = vstrallocf("SCNF %s", config_name);
+    line = vstrallocf("SCNF %s", get_config_name());
     if (converse(line) == -1) {
         aclose(server_socket);
        exit(1);
index a1652e6f6e83beb54e93c9164ab0f910e6c3bfe5..6e03450f097a08bdcea7e0dc9bb21d418d14588c 100644 (file)
@@ -31,6 +31,7 @@
 
 #include "amanda.h"
 #include "amfeatures.h"
+#include "amxml.h"
 
 #define STARTUP_TIMEOUT 60
 
@@ -51,6 +52,7 @@ extern char *config;
 extern char *dump_datestamp;           /* date we are restoring */
 extern char *dump_hostname;            /* which machine we are restoring */
 extern char *disk_name;                        /* disk we are restoring */
+extern dle_t *dump_dle;
 extern char *mount_point;              /* where disk was mounted */
 extern char *disk_path;                        /* path relative to mount point */
 extern char dump_date[STR_SIZE];       /* date on which we are restoring */
@@ -112,10 +114,8 @@ extern void delete_file(char *path, char *regex);
 
 extern void extract_files(void);
 
-#ifdef SAMBA_CLIENT
 #define SAMBA_SMBCLIENT 0
 #define SAMBA_TAR       1
-#endif
 
 extern char *get_security(void);
 extern void stop_amindexd(void);
index afb6278a58e9cfa7badda94f21b3615512e11742..26a63048ff03580f15ef82459d20962b5d8cdccf 100644 (file)
@@ -43,6 +43,7 @@
 #include "conffile.h"
 #include "protocol.h"
 #include "event.h"
+#include "client_util.h"
 #include "security.h"
 
 typedef struct EXTRACT_LIST_ITEM {
@@ -83,7 +84,6 @@ char *amidxtaped_client_get_security_conf(char *, void *);
 static char *dump_device_name = NULL;
 static char *errstr;
 static char *amidxtaped_line = NULL;
-
 extern char *localhost;
 
 /* global pid storage for interrupt handler */
@@ -92,9 +92,7 @@ pid_t extract_restore_child_pid = -1;
 static EXTRACT_LIST *extract_list = NULL;
 static const security_driver_t *amidxtaped_secdrv;
 
-#ifdef SAMBA_CLIENT
 unsigned short samba_extract_method = SAMBA_TAR;
-#endif /* SAMBA_CLIENT */
 
 #define READ_TIMEOUT   240*60
 
@@ -1424,7 +1422,7 @@ okay_to_continue(
        dbprintf("User prompt: '%s'; response: '%s'\n", prompt, line);
 
        s = line;
-       while ((ch = *s++) != '\0' && isspace(ch)) {
+       while ((ch = *s++) != '\0' && g_ascii_isspace(ch)) {
            (void)ch;   /* Quiet empty loop compiler warning */
        }
        if (ch == '?') {
@@ -1613,7 +1611,7 @@ extract_files_setup(
        am_has_feature(indexsrv_features, fe_amidxtaped_datestamp)) {
 
        if(am_has_feature(indexsrv_features, fe_amidxtaped_config)) {
-           tt = newstralloc2(tt, "CONFIG=", config_name);
+           tt = newstralloc2(tt, "CONFIG=", get_config_name());
            send_to_tape_server(amidxtaped_streams[CTLFD].fd, tt);
        }
        if(am_has_feature(indexsrv_features, fe_amidxtaped_label) &&
@@ -1708,7 +1706,7 @@ enum dumptypes {
        IS_TAR,
        IS_SAMBA,
        IS_SAMBA_TAR,
-       IS_BACKUP_API
+       IS_APPLICATION_API
 };
 
 static void
@@ -1731,6 +1729,8 @@ extract_files_child(
 #ifdef SAMBA_CLIENT
     char *domain = NULL, *smbpass = NULL;
 #endif
+    backup_support_option_t *bsu;
+    GPtrArray              *errarray;
 
     /* code executed by child to do extraction */
     /* never returns */
@@ -1754,7 +1754,7 @@ extract_files_child(
 
     if (file.program != NULL) {
        if (strcmp(file.program, "BACKUP") == 0)
-           dumptype = IS_BACKUP_API;
+           dumptype = IS_APPLICATION_API;
 #ifdef GNUTAR
        if (strcmp(file.program, GNUTAR) == 0)
            dumptype = IS_GNUTAR;
@@ -1807,8 +1807,20 @@ extract_files_child(
        }
 #endif
        break;
-    case IS_BACKUP_API:
-       extra_params = 5;
+    case IS_APPLICATION_API:
+       extra_params = 12;
+       if (dump_dle) {
+           GSList   *scriptlist;
+           script_t *script;
+           extra_params += application_property_argv_size(dump_dle);
+           for (scriptlist = dump_dle->scriptlist; scriptlist != NULL;
+                scriptlist = scriptlist->next) {
+               script = (script_t *)scriptlist->data;
+               if (script->result && script->result->proplist) {
+                   extra_params += property_argv_size(script->result->proplist);
+               }
+           }
+       }
        break;
     }
     restore_args = (char **)alloc((size_t)((extra_params + files_off_tape + 1)
@@ -1872,20 +1884,57 @@ extract_files_child(
        }
 #endif
        break;
-    case IS_BACKUP_API:
-       restore_args[j++] = stralloc(file.dumper);
+    case IS_APPLICATION_API:
+       {
+           g_option_t g_options;
+           g_options.config = get_config_name();
+           g_options.hostname = dump_hostname;
+           if (dump_dle) {
+               bsu = backup_support_option(file.application, &g_options,
+                                           file.disk, dump_dle->device,
+                                           &errarray);
+           } else {
+               bsu = backup_support_option(file.application, &g_options,
+                                           file.disk, NULL,
+                                           &errarray);
+           }
+       }
+       restore_args[j++] = stralloc(file.application);
        restore_args[j++] = stralloc("restore");
        restore_args[j++] = stralloc("--config");
-       restore_args[j++] = stralloc(config_name);
+       restore_args[j++] = stralloc(get_config_name());
        restore_args[j++] = stralloc("--disk");
        restore_args[j++] = stralloc(file.disk);
+       if (dump_dle && dump_dle->device) {
+           restore_args[j++] = stralloc("--device");
+           restore_args[j++] = stralloc(dump_dle->device);
+       }
+       if (bsu->smb_recover_mode && samba_extract_method == SAMBA_SMBCLIENT){
+           restore_args[j++] = "--recover-mode";
+           restore_args[j++] = "smb";
+       }
+       if (dump_dle) {
+           GSList   *scriptlist;
+           script_t *script;
+
+           j += application_property_add_to_argv(&restore_args[j], dump_dle, NULL);
+           for (scriptlist = dump_dle->scriptlist; scriptlist != NULL;
+                scriptlist = scriptlist->next) {
+               script = (script_t *)scriptlist->data;
+               if (script->result && script->result->proplist) {
+                   j += property_add_to_argv(&restore_args[j],
+                                             script->result->proplist);
+               }
+           }
+
+       }
        break;
     }
   
     for (i = 0, fn = elist->files; i < files_off_tape; i++, fn = fn->next)
     {
        switch (dumptype) {
-       case IS_BACKUP_API:
+       case IS_APPLICATION_API:
        case IS_TAR:
        case IS_GNUTAR:
        case IS_SAMBA_TAR:
@@ -1968,8 +2017,8 @@ extract_files_child(
            cmd = stralloc("restore");
        }
        break;
-    case IS_BACKUP_API:
-       cmd = vstralloc(DUMPER_DIR, "/", file.dumper, NULL);
+    case IS_APPLICATION_API:
+       cmd = vstralloc(APPLICATION_DIR, "/", file.application, NULL);
        break;
     }
     if (cmd) {
@@ -1997,6 +2046,13 @@ extract_files_child(
     /*NOT REACHED */
 }
 
+typedef struct ctl_data_s {
+  int           header_done;
+  int           child_pipe[2];
+  int           pid;
+  EXTRACT_LIST *elist;
+} ctl_data_t;
+
 /*
  * Interpose something between the process writing out the dump (writing it to
  * some extraction program, really) and the socket from which we're reading, so
@@ -2006,35 +2062,17 @@ int
 writer_intermediary(
     EXTRACT_LIST *     elist)
 {
-    int child_pipe[2];
-    pid_t pid;
-    amwait_t extractor_status;
-
-    if(pipe(child_pipe) == -1) {
-       error(_("extract_list - error setting up pipe to extractor: %s\n"),
-             strerror(errno));
-       /*NOTREACHED*/
-    }
-
-    /* okay, ready to extract. fork a child to do the actual work */
-    if ((pid = fork()) == 0) {
-       /* this is the child process */
-       /* never gets out of this clause */
-       aclose(child_pipe[1]);
-        extract_files_child(child_pipe[0], elist);
-       /*NOTREACHED*/
-    }
-
-    /* This is the parent */
-    if (pid == -1) {
-       g_printf(_("writer_intermediary - error forking child"));
-       return -1;
-    }
+    ctl_data_t ctl_data;
+    amwait_t   extractor_status;
 
-    aclose(child_pipe[0]);
+    ctl_data.header_done   = 0;
+    ctl_data.child_pipe[0] = -1;
+    ctl_data.child_pipe[1] = -1;
+    ctl_data.pid           = -1;
+    ctl_data.elist         = elist;
 
     security_stream_read(amidxtaped_streams[DATAFD].fd,
-                        read_amidxtaped_data, &(child_pipe[1]));
+                        read_amidxtaped_data, &ctl_data);
 
     while(get_amidxtaped_line() >= 0) {
        char desired_tape[MAX_TAPE_LABEL_BUF];
@@ -2071,14 +2109,21 @@ writer_intermediary(
 
     /* CTL might be close before DATA */
     event_loop(0);
-    aclose(child_pipe[1]);
+    if (ctl_data.child_pipe[1] != -1)
+       aclose(ctl_data.child_pipe[1]);
 
-    waitpid(pid, &extractor_status, 0);
-    if(WEXITSTATUS(extractor_status) != 0){
-       int ret = WEXITSTATUS(extractor_status);
-        if(ret == 255) ret = -1;
-       g_printf(_("Extractor child exited with status %d\n"), ret);
-       return -1;
+    if (ctl_data.header_done == 0) {
+       g_printf(_("Got no header and data from server, check in amidxtaped.*.debug and amandad.*.debug files on server\n"));
+    }
+
+    if (ctl_data.pid != -1) {
+       waitpid(ctl_data.pid, &extractor_status, 0);
+       if(WEXITSTATUS(extractor_status) != 0){
+           int ret = WEXITSTATUS(extractor_status);
+            if(ret == 255) ret = -1;
+           g_printf(_("Extractor child exited with status %d\n"), ret);
+           return -1;
+       }
     }
     return(0);
 }
@@ -2111,6 +2156,9 @@ extract_files(void)
     int first;
     int otc;
     tapelist_t *tlist = NULL, *a_tlist;
+    g_option_t g_options;
+    GSList *all_level = NULL;
+    int last_level;
 
     if (!is_extract_list_nonempty())
     {
@@ -2192,10 +2240,8 @@ extract_files(void)
     g_printf(_("Restoring files into directory %s\n"), cwd);
     check_file_overwrite(cwd);
 
-#ifdef SAMBA_CLIENT
     if (samba_extract_method == SAMBA_SMBCLIENT)
       g_printf(_("(unless it is a Samba backup, that will go through to the SMB server)\n"));
-#endif
     dbprintf(_("Checking with user before restoring into directory %s\n"), cwd);
     if (!okay_to_continue(0,0,0)) {
         amfree(cwd);
@@ -2211,6 +2257,20 @@ extract_files(void)
     }
     free_unlink_list();
 
+    g_options.config = get_config_name();
+    g_options.hostname = dump_hostname;
+    for (elist = first_tape_list(); elist != NULL;
+        elist = next_tape_list(elist)) {
+       all_level = g_slist_append(all_level, GINT_TO_POINTER(elist->level));
+    }
+    if (dump_dle) {
+       g_slist_free(dump_dle->level);
+       dump_dle->level = all_level;
+       run_client_scripts(EXECUTE_ON_PRE_RECOVER, &g_options, dump_dle,
+                          stderr);
+       dump_dle->level = NULL;
+    }
+    last_level = -1;
     while ((elist = first_tape_list()) != NULL)
     {
        if(elist->tape[0]=='/') {
@@ -2240,6 +2300,17 @@ extract_files(void)
        }
        dump_datestamp = newstralloc(dump_datestamp, elist->date);
 
+       if (last_level != -1 && dump_dle) {
+           dump_dle->level = g_slist_append(dump_dle->level,
+                                            GINT_TO_POINTER(last_level));
+           dump_dle->level = g_slist_append(dump_dle->level,
+                                            GINT_TO_POINTER(elist->level));
+           run_client_scripts(EXECUTE_ON_INTER_LEVEL_RECOVER, &g_options,
+                              dump_dle, stderr);
+           g_slist_free(dump_dle->level);
+           dump_dle->level = NULL;
+       }
+
        /* connect to the tape handler daemon on the tape drive server */
        if ((extract_files_setup(elist->tape, elist->fileno)) == -1)
        {
@@ -2247,6 +2318,13 @@ extract_files(void)
                    errstr);
            return;
        }
+       if (dump_dle) {
+           dump_dle->level = g_slist_append(dump_dle->level,
+                                            GINT_TO_POINTER(elist->level));
+           run_client_scripts(EXECUTE_ON_PRE_LEVEL_RECOVER, &g_options,
+                              dump_dle, stderr);
+       }
+       last_level = elist->level;
 
        /* if the server have fe_amrecover_feedme_tape, it has asked for
         * the tape itself, even if the restore didn't succeed, we should
@@ -2257,6 +2335,21 @@ extract_files(void)
            delete_tape_list(elist);    /* tape done so delete from list */
 
        stop_amidxtaped();
+
+       if (dump_dle) {
+           run_client_scripts(EXECUTE_ON_POST_LEVEL_RECOVER, &g_options,
+                              dump_dle, stderr);
+           g_slist_free(dump_dle->level);
+           dump_dle->level = NULL;
+       }
+    }
+    if (dump_dle) {
+       dump_dle->level = all_level;
+       run_client_scripts(EXECUTE_ON_POST_RECOVER, &g_options, dump_dle,
+                          stderr);
+       g_slist_free(dump_dle->level);
+       all_level = NULL;
+       dump_dle->level = NULL;
     }
 }
 
@@ -2529,11 +2622,9 @@ read_amidxtaped_data(
     void *     buf,
     ssize_t    size)
 {
-    int fd;
-
+    ctl_data_t *ctl_data = (ctl_data_t *)cookie;
     assert(cookie != NULL);
 
-    fd = *(int *)cookie;
     if (size < 0) {
        errstr = newstralloc2(errstr, _("amidxtaped read: "),
                 security_stream_geterror(amidxtaped_streams[DATAFD].fd));
@@ -2554,10 +2645,34 @@ read_amidxtaped_data(
 
     assert(buf != NULL);
 
+    if (ctl_data->header_done == 0) {
+       ctl_data->header_done = 1;
+       if(pipe(ctl_data->child_pipe) == -1) {
+           error(_("extract_list - error setting up pipe to extractor: %s\n"),
+                 strerror(errno));
+           /*NOTREACHED*/
+       }
+
+       /* okay, ready to extract. fork a child to do the actual work */
+       if ((ctl_data->pid = fork()) == 0) {
+           /* this is the child process */
+           /* never gets out of this clause */
+           aclose(ctl_data->child_pipe[1]);
+           extract_files_child(ctl_data->child_pipe[0], ctl_data->elist);
+           /*NOTREACHED*/
+       }
+       
+       if (ctl_data->pid == -1) {
+           errstr = newstralloc(errstr, _("writer_intermediary - error forking child"));
+           g_printf(_("writer_intermediary - error forking child"));
+           return;
+       }
+       aclose(ctl_data->child_pipe[0]);
+    }
     /*
      * We ignore errors while writing to the index file.
      */
-    (void)fullwrite(fd, buf, (size_t)size);
+    (void)full_write(ctl_data->child_pipe[1], buf, (size_t)size);
     security_stream_read(amidxtaped_streams[DATAFD].fd, read_amidxtaped_data, cookie);
 }
 
index 2f659aec791bb9938c0a4489924554612a9522c7..383aae1e45354bb240b86eecf6a5edd6e4ab607e 100644 (file)
 #include "amanda.h"
 #include "util.h"
 #include "amrecover.h"
+#include "amxml.h"
 
-#ifdef SAMBA_CLIENT
 extern unsigned short samba_extract_method;
-#endif /* SAMBA_CLIENT */
 
 /* sets a date, mapping given date into standard form if needed */
 int
@@ -90,6 +89,7 @@ set_host(
     if (is_extract_list_nonempty())
     {
        g_printf(_("Must clear extract list before changing host\n"));
+       amfree(uqhost);
        return;
     }
 
@@ -216,8 +216,11 @@ set_disk(
        exit(1);
     amfree(cmd);
 
-    if (!server_happy())
+    if (!server_happy()) {
+       amfree(uqmtpt);
+       amfree(uqdsk);
        return;
+    }
 
     disk_name = newstralloc(disk_name, uqdsk);
     if (mtpt == NULL)
@@ -261,6 +264,27 @@ set_disk(
     }
     amfree(uqmtpt);
     amfree(uqdsk);
+
+    if (am_has_feature(indexsrv_features, fe_amindexd_DLE)) {
+       char *dle_str;
+       char *errmsg = NULL;
+
+       cmd = stralloc("DLE");
+       if (exchange(cmd) == -1)
+           exit(1);
+       amfree(cmd);
+
+       if (!server_happy())
+           return;
+
+       dle_str = reply_line();
+       if (BSTRNCMP(dle_str+4, "NODLE") == 0) {
+           dump_dle = NULL;
+       } else {
+           dle_str = unquote_string(dle_str+4);
+           dump_dle = amxml_parse_node_CHAR(dle_str, &errmsg);
+       }
+    }
 }
 
 void
@@ -322,6 +346,7 @@ cd_glob(
         g_printf(_("\"%s\" is not a valid shell wildcard pattern: "), glob);
         puts(s);
        amfree(regex);
+       amfree(uqglob);
         return;
     }
     /*
@@ -386,6 +411,7 @@ cd_regex(
     if ((s = validate_regexp(uqregex)) != NULL) {
        g_printf(_("\"%s\" is not a valid regular expression: "), uq_orig_regex);
        amfree(uqregex);
+       amfree(uq_orig_regex);
        puts(s);
        return;
     }
@@ -691,7 +717,6 @@ void
 set_mode(
     int                mode)
 {
-#ifdef SAMBA_CLIENT
   if (mode == SAMBA_SMBCLIENT) {
     g_printf (_("SAMBA dumps will be extracted using smbclient\n"));
     samba_extract_method = SAMBA_SMBCLIENT;
@@ -701,9 +726,6 @@ set_mode(
       samba_extract_method = SAMBA_TAR;
     }
   }
-#else
-  (void)mode;  /* Quiet unused parameter warning */
-#endif /* SAMBA_CLIENT */
 }
 
 void
index 49a3a3c07776685aafe0e55b302b209200bcd7bc..8825da79448fae556e903d89d3c8ce87ac00f8a3 100644 (file)
@@ -8,7 +8,7 @@
 #define FLEX_SCANNER
 #define YY_FLEX_MAJOR_VERSION 2
 #define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 33
+#define YY_FLEX_SUBMINOR_VERSION 35
 #if YY_FLEX_SUBMINOR_VERSION > 0
 #define FLEX_BETA
 #endif
@@ -30,7 +30,7 @@
 
 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
 
-#if __STDC_VERSION__ >= 199901L
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
 
 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
  * if you want the limit (max/min) macros for int types. 
@@ -93,11 +93,12 @@ typedef unsigned int flex_uint32_t;
 
 #else  /* ! __cplusplus */
 
-#if __STDC__
+/* C99 requires __STDC__ to be defined as 1. */
+#if defined (__STDC__)
 
 #define YY_USE_CONST
 
-#endif /* __STDC__ */
+#endif /* defined (__STDC__) */
 #endif /* ! __cplusplus */
 
 #ifdef YY_USE_CONST
@@ -177,14 +178,9 @@ extern FILE *yyin, *yyout;
 
 #define unput(c) yyunput( c, (yytext_ptr)  )
 
-/* The following is because we cannot portably get our hands on size_t
- * (without autoconf's help, which isn't available because we want
- * flex-generated scanners to compile on their own).
- */
-
 #ifndef YY_TYPEDEF_YY_SIZE_T
 #define YY_TYPEDEF_YY_SIZE_T
-typedef unsigned int yy_size_t;
+typedef size_t yy_size_t;
 #endif
 
 #ifndef YY_STRUCT_YY_BUFFER_STATE
@@ -594,7 +590,7 @@ int         process_line(char *line);
 
 #line 62 "uscan.l"
 static char *string_buf = NULL;
-#line 598 "uscan.c"
+#line 594 "uscan.c"
 
 #define INITIAL 0
 #define quotedpath 1
@@ -684,7 +680,7 @@ static int input (void );
 /* This used to be an fputs(), but since the string might contain NUL's,
  * we now use fwrite().
  */
-#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
+#define ECHO fwrite( yytext, yyleng, 1, yyout )
 #endif
 
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
@@ -695,7 +691,7 @@ static int input (void );
        if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
                { \
                int c = '*'; \
-               size_t n; \
+               unsigned n; \
                for ( n = 0; n < max_size && \
                             (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
                        buf[n] = (char) c; \
@@ -784,7 +780,7 @@ YY_DECL
     /* literal keyword tokens */
 
 
-#line 788 "uscan.c"
+#line 784 "uscan.c"
 
        if ( !(yy_init) )
                {
@@ -1120,7 +1116,7 @@ YY_RULE_SETUP
 #line 167 "uscan.l"
 ECHO;
        YY_BREAK
-#line 1124 "uscan.c"
+#line 1120 "uscan.c"
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(quotedpath):
        yyterminate();
@@ -1352,7 +1348,7 @@ static int yy_get_next_buffer (void)
 
                /* Read in more data. */
                YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
-                       (yy_n_chars), num_to_read );
+                       (yy_n_chars), (size_t) num_to_read );
 
                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
                }
@@ -1376,6 +1372,14 @@ static int yy_get_next_buffer (void)
        else
                ret_val = EOB_ACT_CONTINUE_SCAN;
 
+       if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+               /* Extend the array by 50%, plus the number we really need. */
+               yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
+               YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
+               if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+                       YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+       }
+
        (yy_n_chars) += number_to_move;
        YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
        YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
@@ -1791,7 +1795,9 @@ static void yyensure_buffer_stack (void)
                (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
                                                                (num_to_alloc * sizeof(struct yy_buffer_state*)
                                                                );
-               
+               if ( ! (yy_buffer_stack) )
+                       YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+                                                                 
                memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
                                
                (yy_buffer_stack_max) = num_to_alloc;
@@ -1809,6 +1815,8 @@ static void yyensure_buffer_stack (void)
                                                                ((yy_buffer_stack),
                                                                num_to_alloc * sizeof(struct yy_buffer_state*)
                                                                );
+               if ( ! (yy_buffer_stack) )
+                       YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
 
                /* zero only the new slots.*/
                memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
@@ -1853,7 +1861,7 @@ YY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size )
 
 /** Setup the input buffer state to scan a string. The next call to yylex() will
  * scan from a @e copy of @a str.
- * @param str a NUL-terminated string to scan
+ * @param yystr a NUL-terminated string to scan
  * 
  * @return the newly allocated buffer state object.
  * @note If you want to scan bytes that may contain NUL values, then use
index fa14e255f8c95bd6e662449e034079ae600b8c6c..26ee41521ac4cad9f372fd3f7475aa645ac501b7 100644 (file)
@@ -1,5 +1,6 @@
 # Makefile for Amanda restore programs.
 
+include $(top_srcdir)/config/automake/vars.am
 include $(top_srcdir)/config/automake/installperms.am
 include $(top_srcdir)/config/automake/precompile.am
 
@@ -13,8 +14,8 @@ INCLUDES =    -I$(top_builddir)/common-src \
 AM_CFLAGS = $(AMANDA_WARNING_CFLAGS)
 AM_LDFLAGS = $(AMANDA_STATIC_LDFLAGS)
 
-LINT=@AMLINT@
-LINTFLAGS=@AMLINTFLAGS@
+LINT=$(AMLINT)
+LINTFLAGS=$(AMLINTFLAGS)
 
 amlib_LTLIBRARIES =    librestore.la
 LIB_EXTENSION = la
@@ -32,7 +33,6 @@ amlibexec_PROGRAMS =  amidxtaped
 
 LDADD = librestore.$(LIB_EXTENSION)              \
       ../common-src/libamanda.$(LIB_EXTENSION) \
-      ../gnulib/libgnu.$(LIB_EXTENSION) \
       $(READLINE_LIBS)
 
 amidxtaped_LDADD = $(LDADD) \
@@ -57,13 +57,12 @@ INSTALLPERMS_exec = \
 
 lint:
        @ for p in $(amlibexec_PROGRAMS) $(sbin_PROGRAMS); do                   \
+               p=`basename $$p $(EXEEXT)`;                                     \
                f="$$p.c $(librestore_la_SOURCES)";                             \
                (cd ../common-src; make listlibsrc);                            \
                f="$$f "`cat ../common-src/listlibsrc.output`;                  \
                (cd ../server-src; make listlibsrc);                            \
                f="$$f "`cat ../server-src/listlibsrc.output`;                  \
-               (cd ../tape-src; make listlibsrc);                              \
-               f="$$f "`cat ../tape-src/listlibsrc.output`;                    \
                echo $(LINT) $$f;                                               \
                $(LINT) $(LINTFLAGS) $(CPPFLAGS) $(DEFS) -I. -I$(top_builddir)/config   \
                    $(INCLUDES) $$f;                                            \
index f092f9d6b7184089b76245f4f0f1e031384f94f0..cf4c35f146780fda2826281b665f3fdc8aac95af 100644 (file)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  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.
 
 # Makefile for Amanda restore programs.
 
+# vim:ft=automake
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+# 
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License version 2.1 as 
+# published by the Free Software Foundation.
+# 
+# This 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 this library; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+# 
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+# simple include file to pre-define variables which are then +='d by other
+# scripts in this directory.
+
 # vim:ft=automake
 #
 # Adjust post-install permissions settings.  This rule works off two
@@ -43,7 +65,7 @@
 # INSTALLPERMS_exec = \
 #      dest=$(sbindir) chown=amanda chmod= \
 #              foo bar \
-#      chmod=u+s,o-rwx \
+#      chmod=07450 \
 #              bing
 #      dest=$(libexecdir) chmod= \
 #              $(libexec_PROGRAMS)
 #
 # This whole operation is not required when making builds for packaging,
 # and can be disabled with --disable-installperms, via the WANT_INSTALLPERMS
-# AM_CONDITIONAL.
+# AM_CONDITIONAL.  When disabled, the file 'installperms.sh' in the top-level
+# build directory is populated with a format suitable for shell interpretation,
+# with lines like this:
+#   installperm "amanda:disk" "04750" "/usr/local/sbin/bing"
+# the arguments being, respectively, owner:group, mode, and filename.  There will
+# be exactly one line for each file which has specific permissions.  The intention
+# is that this file be used by packaging scripts to set correct permissions at install
+# time.  Note that files which have no special permissions requirements do not appear 
+# in this file at all, due to limitations of Automake.
 
 # vim:ft=automake
 
@@ -81,13 +111,16 @@ target_triplet = @target@
 DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
        $(srcdir)/Makefile.in \
        $(top_srcdir)/config/automake/installperms.am \
-       $(top_srcdir)/config/automake/precompile.am
+       $(top_srcdir)/config/automake/precompile.am \
+       $(top_srcdir)/config/automake/vars.am
+@WANT_INSTALLPERMS_FALSE@am__append_1 = $(installperms_sh)
 sbin_PROGRAMS = amrestore$(EXEEXT) amfetchdump$(EXEEXT)
 amlibexec_PROGRAMS = amidxtaped$(EXEEXT)
 subdir = restore-src
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps =  \
        $(top_srcdir)/config/macro-archive/ac_define_dir.m4 \
+       $(top_srcdir)/config/macro-archive/ac_perl_module_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_perl_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_swig.m4 \
        $(top_srcdir)/config/macro-archive/ax_compare_version.m4 \
@@ -121,6 +154,7 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/amanda/libs.m4 \
        $(top_srcdir)/config/amanda/net.m4 \
        $(top_srcdir)/config/amanda/progs.m4 \
+       $(top_srcdir)/config/amanda/ps.m4 \
        $(top_srcdir)/config/amanda/readdir.m4 \
        $(top_srcdir)/config/amanda/readline.m4 \
        $(top_srcdir)/config/amanda/rsh-security.m4 \
@@ -143,7 +177,9 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/float_h.m4 \
        $(top_srcdir)/config/gnulib/fsusage.m4 \
        $(top_srcdir)/config/gnulib/getaddrinfo.m4 \
+       $(top_srcdir)/config/gnulib/getopt.m4 \
        $(top_srcdir)/config/gnulib/gettimeofday.m4 \
+       $(top_srcdir)/config/gnulib/gnulib-common.m4 \
        $(top_srcdir)/config/gnulib/gnulib-comp.m4 \
        $(top_srcdir)/config/gnulib/include_next.m4 \
        $(top_srcdir)/config/gnulib/inet_ntop.m4 \
@@ -171,7 +207,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/sys_stat_h.m4 \
        $(top_srcdir)/config/gnulib/sys_time_h.m4 \
        $(top_srcdir)/config/gnulib/tempname.m4 \
-       $(top_srcdir)/config/gnulib/ulonglong.m4 \
        $(top_srcdir)/config/gnulib/unistd_h.m4 \
        $(top_srcdir)/config/gnulib/vasnprintf.m4 \
        $(top_srcdir)/config/gnulib/visibility.m4 \
@@ -182,7 +217,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gettext-macros/lib-ld.m4 \
        $(top_srcdir)/config/gettext-macros/lib-link.m4 \
        $(top_srcdir)/config/gettext-macros/lib-prefix.m4 \
-       $(top_srcdir)/config/gettext-macros/longlong.m4 \
        $(top_srcdir)/config/gettext-macros/nls.m4 \
        $(top_srcdir)/config/gettext-macros/po.m4 \
        $(top_srcdir)/config/gettext-macros/progtest.m4 \
@@ -223,13 +257,11 @@ amfetchdump_OBJECTS = $(am_amfetchdump_OBJECTS)
 amfetchdump_LDADD = $(LDADD)
 am__DEPENDENCIES_1 =
 amfetchdump_DEPENDENCIES = librestore.$(LIB_EXTENSION) \
-       ../common-src/libamanda.$(LIB_EXTENSION) \
-       ../gnulib/libgnu.$(LIB_EXTENSION) $(am__DEPENDENCIES_1)
+       ../common-src/libamanda.$(LIB_EXTENSION) $(am__DEPENDENCIES_1)
 am_amidxtaped_OBJECTS = amidxtaped.$(OBJEXT)
 amidxtaped_OBJECTS = $(am_amidxtaped_OBJECTS)
 am__DEPENDENCIES_2 = librestore.$(LIB_EXTENSION) \
-       ../common-src/libamanda.$(LIB_EXTENSION) \
-       ../gnulib/libgnu.$(LIB_EXTENSION) $(am__DEPENDENCIES_1)
+       ../common-src/libamanda.$(LIB_EXTENSION) $(am__DEPENDENCIES_1)
 amidxtaped_DEPENDENCIES = $(am__DEPENDENCIES_2) \
        ../gnulib/libgnu.$(LIB_EXTENSION) \
        ../amandad-src/libamandad.$(LIB_EXTENSION)
@@ -237,9 +269,8 @@ amrestore_SOURCES = amrestore.c
 amrestore_OBJECTS = amrestore.$(OBJEXT)
 amrestore_LDADD = $(LDADD)
 amrestore_DEPENDENCIES = librestore.$(LIB_EXTENSION) \
-       ../common-src/libamanda.$(LIB_EXTENSION) \
-       ../gnulib/libgnu.$(LIB_EXTENSION) $(am__DEPENDENCIES_1)
-DEFAULT_INCLUDES = -I. -I$(top_builddir)/config@am__isrc@
+       ../common-src/libamanda.$(LIB_EXTENSION) $(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/config
 depcomp = $(SHELL) $(top_srcdir)/config/depcomp
 am__depfiles_maybe = depfiles
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
@@ -260,6 +291,7 @@ ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
+AIX_BACKUP = @AIX_BACKUP@
 ALLOCA = @ALLOCA@
 ALLOCA_H = @ALLOCA_H@
 AMANDA_DBGDIR = @AMANDA_DBGDIR@
@@ -274,8 +306,10 @@ AMPLOT_CAT_GZIP = @AMPLOT_CAT_GZIP@
 AMPLOT_CAT_PACK = @AMPLOT_CAT_PACK@
 AMPLOT_COMPRESS = @AMPLOT_COMPRESS@
 AMTAR = @AMTAR@
+APPLICATION_DIR = @APPLICATION_DIR@
 AR = @AR@
 ARPA_INET_H = @ARPA_INET_H@
+ASSERTIONS = @ASSERTIONS@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -287,16 +321,28 @@ BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@
 BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@
 BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@
 BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@
+BSDTCP_SECURITY = @BSDTCP_SECURITY@
+BSDUDP_SECURITY = @BSDUDP_SECURITY@
+BSD_SECURITY = @BSD_SECURITY@
 CAT = @CAT@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
+CHECK_USERID = @CHECK_USERID@
 CHIO = @CHIO@
 CHS = @CHS@
+CLIENT_HOST_INSTANCE = @CLIENT_HOST_INSTANCE@
+CLIENT_HOST_KEY_FILE = @CLIENT_HOST_KEY_FILE@
+CLIENT_HOST_PRINCIPAL = @CLIENT_HOST_PRINCIPAL@
 CLIENT_LOGIN = @CLIENT_LOGIN@
 CLIENT_SCRIPTS_OPT = @CLIENT_SCRIPTS_OPT@
 COMPRESS = @COMPRESS@
+COMPRESS_BEST_OPT = @COMPRESS_BEST_OPT@
+COMPRESS_FAST_OPT = @COMPRESS_FAST_OPT@
+COMPRESS_PATH = @COMPRESS_PATH@
+COMPRESS_SUFFIX = @COMPRESS_SUFFIX@
+CONFIG_CLOBBER_MY_CONFIG = @CONFIG_CLOBBER_MY_CONFIG@
 CONFIG_DIR = @CONFIG_DIR@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
@@ -310,6 +356,7 @@ DD = @DD@
 DEFAULT_AMANDATES_FILE = @DEFAULT_AMANDATES_FILE@
 DEFAULT_CHANGER_DEVICE = @DEFAULT_CHANGER_DEVICE@
 DEFAULT_CONFIG = @DEFAULT_CONFIG@
+DEFAULT_MAILER = @DEFAULT_MAILER@
 DEFAULT_SERVER = @DEFAULT_SERVER@
 DEFAULT_TAPE_DEVICE = @DEFAULT_TAPE_DEVICE@
 DEFAULT_TAPE_SERVER = @DEFAULT_TAPE_SERVER@
@@ -317,7 +364,7 @@ DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DOC_BUILD_DATE = @DOC_BUILD_DATE@
 DUMP = @DUMP@
-DUMPER_DIR = @DUMPER_DIR@
+DUMP_RETURNS_1 = @DUMP_RETURNS_1@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -330,6 +377,7 @@ F77 = @F77@
 FFLAGS = @FFLAGS@
 FLOAT_H = @FLOAT_H@
 GETCONF = @GETCONF@
+GETOPT_H = @GETOPT_H@
 GETTEXT = @GETTEXT@
 GLIB_CFLAGS = @GLIB_CFLAGS@
 GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
@@ -340,9 +388,12 @@ GMSGFMT_015 = @GMSGFMT_015@
 GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
 GNULIB_CHOWN = @GNULIB_CHOWN@
 GNULIB_DUP2 = @GNULIB_DUP2@
+GNULIB_ENVIRON = @GNULIB_ENVIRON@
 GNULIB_FCHDIR = @GNULIB_FCHDIR@
 GNULIB_FFLUSH = @GNULIB_FFLUSH@
+GNULIB_FOPEN = @GNULIB_FOPEN@
 GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
+GNULIB_FREOPEN = @GNULIB_FREOPEN@
 GNULIB_FSEEK = @GNULIB_FSEEK@
 GNULIB_FSEEKO = @GNULIB_FSEEKO@
 GNULIB_FTELL = @GNULIB_FTELL@
@@ -352,6 +403,7 @@ GNULIB_GETCWD = @GNULIB_GETCWD@
 GNULIB_GETDELIM = @GNULIB_GETDELIM@
 GNULIB_GETLINE = @GNULIB_GETLINE@
 GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
+GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@
 GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
 GNULIB_LCHOWN = @GNULIB_LCHOWN@
 GNULIB_LSEEK = @GNULIB_LSEEK@
@@ -376,8 +428,10 @@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
 GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
 GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
 GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
+GNULIB_PUTENV = @GNULIB_PUTENV@
 GNULIB_READLINK = @GNULIB_READLINK@
 GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@
+GNULIB_SETENV = @GNULIB_SETENV@
 GNULIB_SLEEP = @GNULIB_SLEEP@
 GNULIB_SNPRINTF = @GNULIB_SNPRINTF@
 GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@
@@ -386,11 +440,15 @@ GNULIB_STPNCPY = @GNULIB_STPNCPY@
 GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
 GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
 GNULIB_STRDUP = @GNULIB_STRDUP@
+GNULIB_STRERROR = @GNULIB_STRERROR@
 GNULIB_STRNDUP = @GNULIB_STRNDUP@
 GNULIB_STRNLEN = @GNULIB_STRNLEN@
 GNULIB_STRPBRK = @GNULIB_STRPBRK@
 GNULIB_STRSEP = @GNULIB_STRSEP@
+GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@
+GNULIB_STRSTR = @GNULIB_STRSTR@
 GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
+GNULIB_UNSETENV = @GNULIB_UNSETENV@
 GNULIB_VASPRINTF = @GNULIB_VASPRINTF@
 GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@
 GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
@@ -404,6 +462,7 @@ GOBJECT_QUERY = @GOBJECT_QUERY@
 GREP = @GREP@
 GZIP = @GZIP@
 HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@
+HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@
 HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@
 HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@
 HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
@@ -412,9 +471,10 @@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
 HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@
 HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
 HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
-HAVE_DECL_STRNCASECMP = @HAVE_DECL_STRNCASECMP@
+HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@
 HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
 HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
+HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@
 HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
 HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
 HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
@@ -422,7 +482,9 @@ HAVE_DUP2 = @HAVE_DUP2@
 HAVE_FSEEKO = @HAVE_FSEEKO@
 HAVE_FTELLO = @HAVE_FTELLO@
 HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
+HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
 HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
+HAVE_GZIP = @HAVE_GZIP@
 HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
 HAVE_IO_H = @HAVE_IO_H@
 HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
@@ -431,8 +493,10 @@ HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@
 HAVE_MEMPCPY = @HAVE_MEMPCPY@
 HAVE_MKDTEMP = @HAVE_MKDTEMP@
 HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@
+HAVE_OS_H = @HAVE_OS_H@
 HAVE_READLINK = @HAVE_READLINK@
 HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@
+HAVE_SETENV = @HAVE_SETENV@
 HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
 HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
 HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
@@ -440,7 +504,6 @@ HAVE_SLEEP = @HAVE_SLEEP@
 HAVE_STDINT_H = @HAVE_STDINT_H@
 HAVE_STPCPY = @HAVE_STPCPY@
 HAVE_STPNCPY = @HAVE_STPNCPY@
-HAVE_STRCASECMP = @HAVE_STRCASECMP@
 HAVE_STRCASESTR = @HAVE_STRCASESTR@
 HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
 HAVE_STRNDUP = @HAVE_STRNDUP@
@@ -449,10 +512,12 @@ HAVE_STRSEP = @HAVE_STRSEP@
 HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@
 HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
 HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
+HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
 HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
 HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
 HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
 HAVE_UNISTD_H = @HAVE_UNISTD_H@
+HAVE_UNSETENV = @HAVE_UNSETENV@
 HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
 HAVE_VASPRINTF = @HAVE_VASPRINTF@
 HAVE_VISIBILITY = @HAVE_VISIBILITY@
@@ -468,6 +533,8 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 INTLLIBS = @INTLLIBS@
 INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+KRB4_SECURITY = @KRB4_SECURITY@
+KRB5_SECURITY = @KRB5_SECURITY@
 LDFLAGS = @LDFLAGS@
 LEX = @LEX@
 LEXLIB = @LEXLIB@
@@ -484,6 +551,8 @@ LIBTHREAD = @LIBTHREAD@
 LIBTOOL = @LIBTOOL@
 LIBTOOL_DEPS = @LIBTOOL_DEPS@
 LN_S = @LN_S@
+LOCKING = @LOCKING@
+LOW_TCPPORTRANGE = @LOW_TCPPORTRANGE@
 LTLIBICONV = @LTLIBICONV@
 LTLIBINTL = @LTLIBINTL@
 LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
@@ -492,7 +561,6 @@ LTLIBPTH = @LTLIBPTH@
 LTLIBTHREAD = @LTLIBTHREAD@
 MAILER = @MAILER@
 MAKEINFO = @MAKEINFO@
-MAXTAPEBLOCKSIZE = @MAXTAPEBLOCKSIZE@
 MCUTIL = @MCUTIL@
 MKDIR_P = @MKDIR_P@
 MSGFMT = @MSGFMT@
@@ -528,26 +596,37 @@ PERL_INC = @PERL_INC@
 PKG_CONFIG = @PKG_CONFIG@
 POSUB = @POSUB@
 PRINT = @PRINT@
+PS = @PS@
+PS_ARGUMENT = @PS_ARGUMENT@
 PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
 RANLIB = @RANLIB@
 READLINE_LIBS = @READLINE_LIBS@
 REPLACE_CHOWN = @REPLACE_CHOWN@
 REPLACE_FCHDIR = @REPLACE_FCHDIR@
 REPLACE_FFLUSH = @REPLACE_FFLUSH@
+REPLACE_FOPEN = @REPLACE_FOPEN@
 REPLACE_FPRINTF = @REPLACE_FPRINTF@
+REPLACE_FREOPEN = @REPLACE_FREOPEN@
 REPLACE_FSEEK = @REPLACE_FSEEK@
 REPLACE_FSEEKO = @REPLACE_FSEEKO@
 REPLACE_FTELL = @REPLACE_FTELL@
 REPLACE_FTELLO = @REPLACE_FTELLO@
 REPLACE_GETCWD = @REPLACE_GETCWD@
 REPLACE_GETLINE = @REPLACE_GETLINE@
+REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
 REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
 REPLACE_LCHOWN = @REPLACE_LCHOWN@
 REPLACE_LSEEK = @REPLACE_LSEEK@
+REPLACE_MEMMEM = @REPLACE_MEMMEM@
 REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
 REPLACE_PRINTF = @REPLACE_PRINTF@
+REPLACE_PUTENV = @REPLACE_PUTENV@
 REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
 REPLACE_SPRINTF = @REPLACE_SPRINTF@
+REPLACE_STRCASESTR = @REPLACE_STRCASESTR@
+REPLACE_STRERROR = @REPLACE_STRERROR@
+REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@
+REPLACE_STRSTR = @REPLACE_STRSTR@
 REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
 REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
 REPLACE_VPRINTF = @REPLACE_VPRINTF@
@@ -555,7 +634,11 @@ REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
 REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
 REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
 RESTORE = @RESTORE@
+RSH_SECURITY = @RSH_SECURITY@
 SAMBA_CLIENT = @SAMBA_CLIENT@
+SERVER_HOST_INSTANCE = @SERVER_HOST_INSTANCE@
+SERVER_HOST_KEY_FILE = @SERVER_HOST_KEY_FILE@
+SERVER_HOST_PRINCIPAL = @SERVER_HOST_PRINCIPAL@
 SERVICE_SUFFIX = @SERVICE_SUFFIX@
 SETUID_GROUP = @SETUID_GROUP@
 SET_MAKE = @SET_MAKE@
@@ -565,6 +648,7 @@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
 SNAPSHOT_STAMP = @SNAPSHOT_STAMP@
 SORT = @SORT@
 SSH = @SSH@
+SSH_SECURITY = @SSH_SECURITY@
 STDBOOL_H = @STDBOOL_H@
 STDINT_H = @STDINT_H@
 STRIP = @STRIP@
@@ -574,7 +658,14 @@ SWIG_LIB = @SWIG_LIB@
 SYS_SOCKET_H = @SYS_SOCKET_H@
 SYS_STAT_H = @SYS_STAT_H@
 SYS_TIME_H = @SYS_TIME_H@
+TCPPORTRANGE = @TCPPORTRANGE@
+TICKET_LIFETIME = @TICKET_LIFETIME@
+UDPPORTRANGE = @UDPPORTRANGE@
+UNCOMPRESS_OPT = @UNCOMPRESS_OPT@
+UNCOMPRESS_PATH = @UNCOMPRESS_PATH@
+USE_AMANDAHOSTS = @USE_AMANDAHOSTS@
 USE_NLS = @USE_NLS@
+USE_RUNDUMP = @USE_RUNDUMP@
 USE_VERSION_SUFFIXES = @USE_VERSION_SUFFIXES@
 VDUMP = @VDUMP@
 VERSION = @VERSION@
@@ -583,6 +674,7 @@ VERSION_MAJOR = @VERSION_MAJOR@
 VERSION_MINOR = @VERSION_MINOR@
 VERSION_PATCH = @VERSION_PATCH@
 VERSION_SUFFIX = @VERSION_SUFFIX@
+VOID_UNSETENV = @VOID_UNSETENV@
 VRESTORE = @VRESTORE@
 VXDUMP = @VXDUMP@
 VXRESTORE = @VXRESTORE@
@@ -611,6 +703,7 @@ am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+amdatadir = @amdatadir@
 amincludedir = @amincludedir@
 amlibdir = @amlibdir@
 amlibexecdir = @amlibexecdir@
@@ -629,6 +722,8 @@ dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 gl_LIBOBJS = @gl_LIBOBJS@
 gl_LTLIBOBJS = @gl_LTLIBOBJS@
+gltests_LIBOBJS = @gltests_LIBOBJS@
+gltests_LTLIBOBJS = @gltests_LTLIBOBJS@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
@@ -658,12 +753,39 @@ target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
+SUFFIXES = 
+EXTRA_DIST = 
+BUILT_SOURCES = 
+MOSTLYCLEANFILES = 
+CLEANFILES = 
+DISTCLEANFILES = $(am__append_1)
+MAINTAINERCLEANFILES = 
 
 # sed expression to strip leading directories from a filename; this converts e.g.,
 # src/foo/bar.so to bar.so.
 strip_leading_dirs = s|^.*/||
+@WANT_INSTALLPERMS_FALSE@do_file = pa="$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
+@WANT_INSTALLPERMS_FALSE@    echo "installperm \"$$chown\" \"$$chmod\" \"$$pa\"" >> "$(installperms_sh)"
+
+
+# define a snippet of the scripts below to either perform a chown/chmod operation,
+# or record that operation in the logfile.  On entry to the snippet, $$dest is the
+# destination directory, $$cmd is the srcdir-relative pathname of the target file,
+# $$chown is the ownership, and $$chmod is the permission pattern.
+@WANT_INSTALLPERMS_TRUE@do_file = pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
+@WANT_INSTALLPERMS_TRUE@    if test -n "$$chown"; then \
+@WANT_INSTALLPERMS_TRUE@       echo chown "$$chown" "$$pa"; \
+@WANT_INSTALLPERMS_TRUE@       chown "$$chown" "$$pa" || exit 1; \
+@WANT_INSTALLPERMS_TRUE@    fi; \
+@WANT_INSTALLPERMS_TRUE@    if test -n "$$chmod"; then \
+@WANT_INSTALLPERMS_TRUE@       echo chmod "$$chmod" "$$pa"; \
+@WANT_INSTALLPERMS_TRUE@       chmod "$$chmod" "$$pa" || exit 1; \
+@WANT_INSTALLPERMS_TRUE@    fi 
+
+@WANT_INSTALLPERMS_FALSE@installperms_sh = "$(top_builddir)/installperms.sh"
 INCLUDES = -I$(top_builddir)/common-src \
                -I$(top_srcdir)/common-src   \
                -I$(top_srcdir)/device-src   \
@@ -673,8 +795,8 @@ INCLUDES = -I$(top_builddir)/common-src \
 
 AM_CFLAGS = $(AMANDA_WARNING_CFLAGS)
 AM_LDFLAGS = $(AMANDA_STATIC_LDFLAGS)
-LINT = @AMLINT@
-LINTFLAGS = @AMLINTFLAGS@
+LINT = $(AMLINT)
+LINTFLAGS = $(AMLINTFLAGS)
 amlib_LTLIBRARIES = librestore.la
 LIB_EXTENSION = la
 
@@ -686,7 +808,6 @@ LIB_EXTENSION = la
 ###
 LDADD = librestore.$(LIB_EXTENSION)              \
       ../common-src/libamanda.$(LIB_EXTENSION) \
-      ../gnulib/libgnu.$(LIB_EXTENSION) \
       $(READLINE_LIBS)
 
 amidxtaped_LDADD = $(LDADD) \
@@ -706,11 +827,12 @@ INSTALLPERMS_exec = \
        dest=$(sbindir) chown=amanda $(sbin_PROGRAMS) \
        dest=$(amlibexecdir) chown=amanda $(amlibexec_PROGRAMS)
 
-all: all-am
+all: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) all-am
 
 .SUFFIXES:
 .SUFFIXES: .c .lo .o .obj
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(top_srcdir)/config/automake/installperms.am $(top_srcdir)/config/automake/precompile.am $(am__configure_deps)
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(top_srcdir)/config/automake/vars.am $(top_srcdir)/config/automake/installperms.am $(top_srcdir)/config/automake/precompile.am $(am__configure_deps)
        @for dep in $?; do \
          case '$(am__configure_deps)' in \
            *$$dep*) \
@@ -745,8 +867,8 @@ install-amlibLTLIBRARIES: $(amlib_LTLIBRARIES)
        @list='$(amlib_LTLIBRARIES)'; for p in $$list; do \
          if test -f $$p; then \
            f=$(am__strip_dir) \
-           echo " $(LIBTOOL) --mode=install $(amlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(amlibdir)/$$f'"; \
-           $(LIBTOOL) --mode=install $(amlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(amlibdir)/$$f"; \
+           echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(amlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(amlibdir)/$$f'"; \
+           $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(amlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(amlibdir)/$$f"; \
          else :; fi; \
        done
 
@@ -754,8 +876,8 @@ uninstall-amlibLTLIBRARIES:
        @$(NORMAL_UNINSTALL)
        @list='$(amlib_LTLIBRARIES)'; for p in $$list; do \
          p=$(am__strip_dir) \
-         echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(amlibdir)/$$p'"; \
-         $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(amlibdir)/$$p"; \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(amlibdir)/$$p'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(amlibdir)/$$p"; \
        done
 
 clean-amlibLTLIBRARIES:
@@ -777,8 +899,8 @@ install-amlibexecPROGRAMS: $(amlibexec_PROGRAMS)
             || test -f $$p1 \
          ; then \
            f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
-          echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(amlibexecPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(amlibexecdir)/$$f'"; \
-          $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(amlibexecPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(amlibexecdir)/$$f" || exit 1; \
+          echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(amlibexecPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(amlibexecdir)/$$f'"; \
+          $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(amlibexecPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(amlibexecdir)/$$f" || exit 1; \
          else :; fi; \
        done
 
@@ -805,8 +927,8 @@ install-sbinPROGRAMS: $(sbin_PROGRAMS)
             || test -f $$p1 \
          ; then \
            f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
-          echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \
-          $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(sbindir)/$$f" || exit 1; \
+          echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \
+          $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(sbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(sbindir)/$$f" || exit 1; \
          else :; fi; \
        done
 
@@ -877,8 +999,8 @@ ID: $(HEADERS) $(SOURCES) $(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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
        mkid -fID $$unique
 tags: TAGS
 
@@ -890,8 +1012,8 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
        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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { 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) \
@@ -901,13 +1023,12 @@ ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
                $(TAGS_FILES) $(LISP)
        tags=; \
-       here=`pwd`; \
        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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
        test -z "$(CTAGS_ARGS)$$tags$$unique" \
          || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
             $$tags $$unique
@@ -947,13 +1068,15 @@ distdir: $(DISTFILES)
          fi; \
        done
 check-am: all-am
-check: check-am
+check: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) check-am
 all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS)
 installdirs:
        for dir in "$(DESTDIR)$(amlibdir)" "$(DESTDIR)$(amlibexecdir)" "$(DESTDIR)$(sbindir)"; do \
          test -z "$$dir" || $(MKDIR_P) "$$dir"; \
        done
-install: install-am
+install: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) install-am
 install-exec: install-exec-am
 install-data: install-data-am
 uninstall: uninstall-am
@@ -968,17 +1091,20 @@ install-strip:
          `test -z '$(STRIP)' || \
            echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
+       -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
 
 clean-generic:
+       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
        -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+       -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
 
 maintainer-clean-generic:
        @echo "This command is intended for maintainers to use"
        @echo "it deletes files that may require special tools to rebuild."
-@WANT_INSTALLPERMS_FALSE@install-exec-hook:
-@WANT_INSTALLPERMS_FALSE@install-data-hook:
+       -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+       -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
 clean: clean-am
 
 clean-am: clean-amlibLTLIBRARIES clean-amlibexecPROGRAMS clean-generic \
@@ -1064,52 +1190,40 @@ uninstall-am: uninstall-amlibLTLIBRARIES uninstall-amlibexecPROGRAMS \
        uninstall-sbinPROGRAMS
 
 
-@WANT_INSTALLPERMS_TRUE@installperms-exec:
-@WANT_INSTALLPERMS_TRUE@       @installperms="$(INSTALLPERMS_exec)"; \
-@WANT_INSTALLPERMS_TRUE@       test -n "$$installperms" && echo "Setting installation permissions on executables"; \
-@WANT_INSTALLPERMS_TRUE@       dest=; chown=; chmod=; \
-@WANT_INSTALLPERMS_TRUE@       for cmd in $$installperms; do \
-@WANT_INSTALLPERMS_TRUE@           case "$$cmd" in \
-@WANT_INSTALLPERMS_TRUE@               chown=amanda) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
-@WANT_INSTALLPERMS_TRUE@               dest=*|chown=*|chmod=*) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; eval $$cmd;; \
-@WANT_INSTALLPERMS_TRUE@               *)  pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chown"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chown "$$chown" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chown "$$chown" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chmod"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chmod "$$chmod" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chmod "$$chmod" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@           esac; \
-@WANT_INSTALLPERMS_TRUE@       done
-
-@WANT_INSTALLPERMS_TRUE@installperms-data:
-@WANT_INSTALLPERMS_TRUE@       @installperms="$(INSTALLPERMS_data)"; \
-@WANT_INSTALLPERMS_TRUE@       test -n "$$installperms" && echo "Setting installation permissions on data"; \
-@WANT_INSTALLPERMS_TRUE@       dest=; chown=; chmod=; \
-@WANT_INSTALLPERMS_TRUE@       for cmd in $$installperms; do \
-@WANT_INSTALLPERMS_TRUE@           case "$$cmd" in \
-@WANT_INSTALLPERMS_TRUE@               chown=amanda) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
-@WANT_INSTALLPERMS_TRUE@               dest=*|chown=*|chmod=*) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; eval $$cmd;; \
-@WANT_INSTALLPERMS_TRUE@               *)  pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chown"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chown "$$chown" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chown "$$chown" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chmod"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chmod "$$chmod" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chmod "$$chmod" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@           esac; \
-@WANT_INSTALLPERMS_TRUE@       done
-
-@WANT_INSTALLPERMS_TRUE@install-exec-hook: installperms-exec
-@WANT_INSTALLPERMS_TRUE@install-data-hook: installperms-data
+installperms-exec:
+       @installperms="$(INSTALLPERMS_exec)"; \
+       test -n "$$installperms" && echo "Setting installation permissions on executables"; \
+       dest=; chown=; chmod=; \
+       for cmd in $$installperms; do \
+           case "$$cmd" in \
+               chown=amanda) \
+                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
+               dest=*|chown=*|chmod=*) \
+                       echo "  ($$cmd)"; eval $$cmd;; \
+               *) $(do_file) ;; \
+           esac; \
+       done
+
+installperms-data:
+       @installperms="$(INSTALLPERMS_data)"; \
+       dest=; chown=; chmod=; \
+       for cmd in $$installperms; do \
+           case "$$cmd" in \
+               chown=amanda) \
+                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
+               dest=*|chown=*|chmod=*) \
+                       echo "  ($$cmd)"; eval $$cmd;; \
+               *)  $(do_file) ;; \
+           esac; \
+       done
+
+install-exec-hook: installperms-exec
+install-data-hook: installperms-data
+
+# define a rule to initialize the installperms manifest file
+@WANT_INSTALLPERMS_TRUE@installperms-init:
+@WANT_INSTALLPERMS_FALSE@installperms-init:
+@WANT_INSTALLPERMS_FALSE@      rm -f "$(installperms_sh)"
 
 # A rule to make precompiler output from C files.  This is not used during
 # ordinary builds, but but can very useful in debugging problems on strange
@@ -1123,13 +1237,12 @@ uninstall-am: uninstall-amlibLTLIBRARIES uninstall-amlibexecPROGRAMS \
 
 lint:
        @ for p in $(amlibexec_PROGRAMS) $(sbin_PROGRAMS); do                   \
+               p=`basename $$p $(EXEEXT)`;                                     \
                f="$$p.c $(librestore_la_SOURCES)";                             \
                (cd ../common-src; make listlibsrc);                            \
                f="$$f "`cat ../common-src/listlibsrc.output`;                  \
                (cd ../server-src; make listlibsrc);                            \
                f="$$f "`cat ../server-src/listlibsrc.output`;                  \
-               (cd ../tape-src; make listlibsrc);                              \
-               f="$$f "`cat ../tape-src/listlibsrc.output`;                    \
                echo $(LINT) $$f;                                               \
                $(LINT) $(LINTFLAGS) $(CPPFLAGS) $(DEFS) -I. -I$(top_builddir)/config   \
                    $(INCLUDES) $$f;                                            \
index bdeb114c50fe28e21c3311d84a8babb9b9efeda6..927149da4e94b6f93adbfcbb88784147926a6f32 100644 (file)
@@ -39,6 +39,7 @@
 #include "changer.h"
 #include "logfile.h"
 #include "cmdline.h"
+#include "server_util.h"
 
 #define CREAT_MODE     0640
 
@@ -49,14 +50,12 @@ int get_lock = 0;
 typedef struct needed_tapes_s {
     char *label;
     int isafile;
-    find_result_t *files;
-    struct needed_tapes_s *next;
-    struct needed_tapes_s *prev;
+    GSList *files;
 } needed_tape_t;
 
 /* local functions */
 
-tapelist_t *list_needed_tapes(GSList *dumpspecs, int only_one);
+tapelist_t *list_needed_tapes(GSList *dumpspecs, int only_one, disklist_t *diskqp);
 void usage(void);
 int main(int argc, char **argv);
 
@@ -91,6 +90,21 @@ usage(void)
     exit(1);
 }
 
+static gint
+sort_needed_tapes_by_write_timestamp(
+       gconstpointer a,
+       gconstpointer b)
+{
+    needed_tape_t *a_nt = (needed_tape_t *)a;
+    needed_tape_t *b_nt = (needed_tape_t *)b;
+    tape_t *a_t = a_nt->isafile? NULL : lookup_tapelabel(a_nt->label);
+    tape_t *b_t = b_nt->isafile? NULL : lookup_tapelabel(b_nt->label);
+    char *a_ds = a_t? a_t->datestamp : "none";
+    char *b_ds = b_t? b_t->datestamp : "none";
+
+    return strcmp(a_ds, b_ds);
+}
+
 /*
  * Build the list of tapes we'll be wanting, and include data about the
  * files we want from said tapes while we're at it (the whole find_result
@@ -99,25 +113,19 @@ usage(void)
 tapelist_t *
 list_needed_tapes(
     GSList *   dumpspecs,
-    int                only_one)
+    int                only_one,
+    disklist_t *diskqp)
 {
-    needed_tape_t *needed_tapes = NULL, *curtape = NULL;
-    disklist_t diskqp;
+    GSList *needed_tapes = NULL;
+    GSList *seen_dumps = NULL;
+    GSList *iter, *iter2;
     find_result_t *alldumps = NULL;
     find_result_t *curmatch = NULL;
     find_result_t *matches = NULL;
     tapelist_t *tapes = NULL;
-    int numtapes = 0;
-    char *conf_diskfile, *conf_tapelist;
-
-    /* For disks and tape lists */
-    conf_diskfile = config_dir_relative(getconf_str(CNF_DISKFILE));
-    if(read_diskfile(conf_diskfile, &diskqp) != 0) {
-        error(_("could not load disklist \"%s\""), conf_diskfile);
-       /*NOTREACHED*/
-    }
-    amfree(conf_diskfile);
+    char *conf_tapelist;
 
+    /* Load the tape list */
     conf_tapelist = config_dir_relative(getconf_str(CNF_TAPELIST));
     if(read_tapelist(conf_tapelist)) {
         error(_("could not load tapelist \"%s\""), conf_tapelist);
@@ -126,20 +134,19 @@ list_needed_tapes(
     amfree(conf_tapelist);
 
     /* Grab a find_output_t of all logged dumps */
-    alldumps = find_dump(&diskqp);
-    free_disklist(&diskqp);
+    alldumps = find_dump(diskqp);
     if(alldumps == NULL){
         g_fprintf(stderr, _("No dump records found\n"));
         exit(1);
     }
-    
+
     /* Compare all known dumps to our match list, note what we'll need */
     matches = dumps_match_dumpspecs(alldumps, dumpspecs, 1);
-    sort_find_result("Dhklp", &matches);
+    sort_find_result("Dhklpw", &matches);
     for(curmatch = matches; curmatch; curmatch = curmatch->next) {
        int havetape = 0;
-       int have_part = 0;
 
+       g_fprintf(stderr, "Examining %s %s on %s\n", curmatch->hostname, curmatch->diskname, curmatch->label);
        /* keep only first dump if only_one */
        if (only_one &&
            curmatch != matches &&
@@ -147,6 +154,7 @@ list_needed_tapes(
             strcmp(curmatch->diskname, matches->diskname) ||
             strcmp(curmatch->timestamp, matches->timestamp) ||
             curmatch->level != matches->level)) {
+           g_fprintf(stderr, "only_one matched\n");
            continue;
        }
        if(strcmp("OK", curmatch->status)){
@@ -154,37 +162,19 @@ list_needed_tapes(
                             curmatch->timestamp, curmatch->hostname,
                             curmatch->diskname, curmatch->level,
                             curmatch->status);
+           g_fprintf(stderr, "!OK\n");
            continue;
        }
-       /* check if we already have that part */
-       for(curtape = needed_tapes; curtape; curtape = curtape->next) {
-           find_result_t *rsttemp = NULL;
-           for(rsttemp = curtape->files;
-               rsttemp;
-               rsttemp=rsttemp->next) {
-               if (!strcmp(rsttemp->partnum, curmatch->partnum) &&
-                   !strcmp(rsttemp->hostname, curmatch->hostname) &&
-                   !strcmp(rsttemp->diskname, curmatch->diskname) &&
-                   !strcmp(rsttemp->timestamp, curmatch->timestamp) &&
-                   rsttemp->level == curmatch->level) {
-                   have_part = 1;
-               }
-           }
-       }
-       if (have_part)
-           continue;
 
-       for(curtape = needed_tapes; curtape; curtape = curtape->next) {
+       for(iter = needed_tapes; iter; iter = iter->next) {
+           needed_tape_t *curtape = iter->data;
            if (!strcmp(curtape->label, curmatch->label)) {
-               find_result_t *rsttemp = NULL;
-               find_result_t *rstfile;
                int keep = 1;
 
                havetape = 1;
 
-               for(rsttemp = curtape->files;
-                           rsttemp;
-                           rsttemp=rsttemp->next){
+               for(iter2 = curtape->files; iter2; iter2 = iter2->next){
+                   find_result_t *rsttemp = iter2->data;
                    if(curmatch->filenum == rsttemp->filenum){
                        g_fprintf(stderr, _("Seeing multiple entries for tape "
                                   "%s file %lld, using most recent\n"),
@@ -197,56 +187,77 @@ list_needed_tapes(
                    break;
                }
 
-               rstfile = alloc(SIZEOF(find_result_t));
-               memcpy(rstfile, curmatch, SIZEOF(find_result_t));
-               rstfile->next = curtape->files;
-
-               if (curmatch->filenum < 1)
-                   curtape->isafile = 1;
-               else curtape->isafile = 0;
-               curtape->files = rstfile;
+               curtape->isafile = (curmatch->filenum < 1);
+               curtape->files = g_slist_prepend(curtape->files, curmatch);
                break;
            }
        }
        if (!havetape) {
-           find_result_t *rstfile = alloc(SIZEOF(find_result_t));
-           needed_tape_t *newtape = alloc(SIZEOF(needed_tape_t));
-           memcpy(rstfile, curmatch, SIZEOF(find_result_t));
-           rstfile->next = NULL;
-           newtape->files = rstfile;
-           if(curmatch->filenum < 1) newtape->isafile = 1;
-           else newtape->isafile = 0;
+           needed_tape_t *newtape = g_new0(needed_tape_t, 1);
+           newtape->files = g_slist_prepend(newtape->files, curmatch);
+           newtape->isafile = (curmatch->filenum < 1);
            newtape->label = curmatch->label;
-           if (needed_tapes){
-               needed_tapes->prev->next = newtape;
-               newtape->prev = needed_tapes->prev;
-               needed_tapes->prev = newtape;
-           } else {
-               needed_tapes = newtape;
-               needed_tapes->prev = needed_tapes;
-           }
-           newtape->next = NULL;
-           numtapes++;
+           needed_tapes = g_slist_prepend(needed_tapes, newtape);
        } /* if(!havetape) */
 
     } /* for(curmatch = matches ... */
 
-    if(numtapes == 0){
+    if(g_slist_length(needed_tapes) == 0){
       g_fprintf(stderr, _("No matching dumps found\n"));
       exit(1);
       /* NOTREACHED */
     }
 
-    /* stick that list in a structure that librestore will understand */
-    for(curtape = needed_tapes; curtape; curtape = curtape->next) {
-       find_result_t *curfind = NULL;
-       for(curfind = curtape->files; curfind; curfind = curfind->next) {
-           tapes = append_to_tapelist(tapes, curtape->label,
-                                      curfind->filenum, -1, curtape->isafile);
+    /* sort the tapelist by tape write_timestamp */
+    needed_tapes = g_slist_sort(needed_tapes, sort_needed_tapes_by_write_timestamp);
+
+    /* stick that list in a structure that librestore will understand, removing
+     * files we have already seen in the process; this prefers the earliest written
+     * copy of any dumps which are available on multiple tapes */
+    seen_dumps = NULL;
+    for(iter = needed_tapes; iter; iter = iter->next) {
+       needed_tape_t *curtape = iter->data;
+       for(iter2 = curtape->files; iter2; iter2 = iter2->next) {
+           find_result_t *curfind = iter2->data;
+           find_result_t *prev;
+           GSList *iter;
+           int have_part;
+
+           /* have we already seen this? */
+           have_part = 0;
+           for (iter = seen_dumps; iter; iter = iter->next) {
+               prev = iter->data;
+
+               if (!strcmp(prev->partnum, curfind->partnum) &&
+                   !strcmp(prev->hostname, curfind->hostname) &&
+                   !strcmp(prev->diskname, curfind->diskname) &&
+                   !strcmp(prev->timestamp, curfind->timestamp) &&
+                   prev->level == curfind->level) {
+                   have_part = 1;
+                   break;
+               }
+           }
+
+           if (!have_part) {
+               seen_dumps = g_slist_prepend(seen_dumps, curfind);
+               tapes = append_to_tapelist(tapes, curtape->label,
+                                          curfind->filenum, -1, curtape->isafile);
+           }
        }
     }
 
-    g_fprintf(stderr, _("%d tape(s) needed for restoration\n"), numtapes);
+    /* free our resources */
+    for (iter = needed_tapes; iter; iter = iter->next) {
+       needed_tape_t *curtape = iter->data;
+       g_slist_free(curtape->files);
+       g_free(curtape);
+    }
+    g_slist_free(seen_dumps);
+    g_slist_free(needed_tapes);
+    free_find_result(&matches);
+
+    /* and we're done */
+    g_fprintf(stderr, _("%d tape(s) needed for restoration\n"), num_entries(tapes));
     return(tapes);
 }
 
@@ -270,6 +281,8 @@ main(
     rst_flags_t *rst_flags;
     int minimum_arguments;
     config_overwrites_t *cfg_ovr = NULL;
+    disklist_t diskq;
+    char * conf_diskfile = NULL;
 
     /*
      * Configure program for internationalization:
@@ -378,12 +391,23 @@ main(
        /*NOTREACHED*/
     }
 
-    config_init(CONFIG_INIT_EXPLICIT_NAME | CONFIG_INIT_FATAL, argv[optind++]);
+    config_init(CONFIG_INIT_EXPLICIT_NAME, argv[optind++]);
     apply_config_overwrites(cfg_ovr);
 
+    conf_diskfile = config_dir_relative(getconf_str(CNF_DISKFILE));
+    read_diskfile(conf_diskfile, &diskq);
+    amfree(conf_diskfile);
+
+    if (config_errors(NULL) >= CFGERR_WARNINGS) {
+       config_print_errors();
+       if (config_errors(NULL) >= CFGERR_ERRORS) {
+           g_critical(_("errors processing config file"));
+       }
+    }
+
     check_running_as(RUNNING_AS_DUMPUSER);
 
-    dbrename(config_name, DBG_SUBDIR_SERVER);
+    dbrename(get_config_name(), DBG_SUBDIR_SERVER);
 
     dumpspecs = cmdline_parse_dumpspecs(argc - optind, argv + optind,
                                        CMDLINE_PARSE_DATESTAMP |
@@ -404,14 +428,17 @@ main(
 
     /* Decide what tapes we'll need */
     needed_tapes = list_needed_tapes(dumpspecs,
-                                    rst_flags->pipe_to_fd == STDOUT_FILENO);
+                                    rst_flags->pipe_to_fd == STDOUT_FILENO,
+                                    &diskq);
 
     parent_pid = getpid();
     atexit(cleanup);
     get_lock = lock_logfile(); /* config is loaded, should be ok here */
     if(get_lock == 0) {
-       error(_("%s exists: amdump or amflush is already running, or you must run amcleanup"), rst_conf_logfile);
+       char *process_name = get_master_process(rst_conf_logfile);
+       error(_("%s exists: %s is already running, or you must run amcleanup"), rst_conf_logfile, process_name);
     }
+    log_add(L_INFO, "%s pid %ld", get_pname(), (long)getpid());
     search_tapes(NULL, stdin, rst_flags->alt_tapedev == NULL,
                  needed_tapes, dumpspecs, rst_flags, NULL);
     cleanup();
@@ -422,6 +449,7 @@ main(
        flush_open_outputs(1, NULL);
     else flush_open_outputs(0, NULL);
 
+    free_disklist(&diskq);
     free_rst_flags(rst_flags);
 
     return(0);
@@ -430,7 +458,10 @@ main(
 static void
 cleanup(void)
 {
-    if(parent_pid == getpid()) {
-       if(get_lock) unlink(rst_conf_logfile);
+    if (parent_pid == getpid()) {
+       if (get_lock) {
+           log_add(L_INFO, "pid-done %ld\n", (long)getpid());
+           unlink(rst_conf_logfile);
+       }
     }
 }
index b83b8e0d0f248a8f6781d6e698ce2f1c1fc18ae0..78abffd899205913c3c9f093df66928b2c36e4bc 100644 (file)
@@ -44,6 +44,7 @@
 #include "amfeatures.h"
 #include "stream.h"
 #include "amandad.h"
+#include "server_util.h"
 
 #define amidxtaped_debug(i,x) do {     \
        if ((i) <= debug_amidxtaped) {  \
@@ -343,6 +344,8 @@ main(
        /* read the REQ packet */
        for(; (line = agets(stdin)) != NULL; free(line)) {
            if(strncmp_const(line, "OPTIONS ") == 0) {
+                if (g_options)
+                    error(_("ERROR recover program sent multiple OPTIONS"));
                g_options = parse_g_options(line+8, 1);
                if(!g_options->hostname) {
                    g_options->hostname = alloc(MAX_HOSTNAME_LENGTH+1);
@@ -413,12 +416,24 @@ main(
            rst_flags->alt_tapedev= stralloc(s);
        }
        else if(strncmp_const_skip(buf, "HOST=", s, ch) == 0) {
-           ds->host = stralloc(s);
+            if (ds->host) {
+                dbprintf(_("WARNING: HOST appeared twice in client request.\n"));
+                amfree(ds->host);
+            }
+            ds->host = stralloc(s);
        }
        else if(strncmp_const_skip(buf, "DISK=", s, ch) == 0) {
+            if (ds->disk) {
+                dbprintf(_("WARNING: DISK appeared twice in client request.\n"));
+                amfree(ds->disk);
+            }
            ds->disk = stralloc(s);
        }
        else if(strncmp_const_skip(buf, "DATESTAMP=", s, ch) == 0) {
+            if (ds->datestamp) {
+                dbprintf(_("WARNING: DATESTAMP appeared twice in client request.\n"));
+                amfree(ds->datestamp);
+            }
            ds->datestamp = stralloc(s);
        }
        else if(strncmp_const(buf, "END") == 0) {
@@ -436,12 +451,16 @@ main(
     amfree(buf);
 
     if(re_config) {
-       config_init(CONFIG_INIT_EXPLICIT_NAME | CONFIG_INIT_FATAL, re_config);
+       config_init(CONFIG_INIT_EXPLICIT_NAME, re_config);
        dbrename(re_config, DBG_SUBDIR_SERVER);
     } else {
        config_init(0, NULL);
     }
 
+    if (config_errors(NULL) >= CFGERR_ERRORS) {
+       g_critical(_("errors processing config file"));
+    }
+
     check_running_as(RUNNING_AS_DUMPUSER_PREFERRED);
 
     if(tapes &&
@@ -465,7 +484,6 @@ main(
     ds = NULL;
 
     if(!tapes && rst_flags->alt_tapedev){
-        sleep(10);
        dbprintf(_("Looks like we're restoring from a holding file...\n"));
         tapes = unmarshal_tapelist_str(rst_flags->alt_tapedev);
        tapes->isafile = 1;
@@ -484,6 +502,8 @@ main(
        atexit(cleanup);
        get_lock = lock_logfile();
     }
+    if (get_lock)
+       log_add(L_INFO, "%s pid %ld", get_pname(), (long)getpid());
 
     /* Init the tape changer */
     if(tapes && use_changer && changer_init() == 0) {
@@ -553,13 +573,14 @@ main(
        re_config && 
        (use_changer || (rst_flags->alt_tapedev && tapedev &&
                         strcmp(rst_flags->alt_tapedev, tapedev) == 0) ) ) {
+       char *process_name = get_master_process(rst_conf_logfile);
        send_message(cmdout, rst_flags, their_features,
-                    _("%s exists: amdump or amflush is already running, "
+                    _("%s exists: %s is already running, "
                     "or you must run amcleanup"), 
-                    rst_conf_logfile);
-       error(_("%s exists: amdump or amflush is already running, "
+                    rst_conf_logfile, process_name);
+       error(_("%s exists: %s is already running, "
              "or you must run amcleanup"),
-             rst_conf_logfile);
+             rst_conf_logfile, process_name);
     }
 
     /* make sure our restore flags aren't crazy */
@@ -593,7 +614,10 @@ main(
 static void
 cleanup(void)
 {
-    if(parent_pid == getpid()) {
-       if(get_lock) unlink(rst_conf_logfile);
+    if (parent_pid == getpid()) {
+       if (get_lock) {
+           log_add(L_INFO, "pid-done %ld\n", (long)getpid());
+           unlink(rst_conf_logfile);
+       }
     }
 }
index 0e1b4b6cb4a242939aac6658d8958a0fd2c9860e..aef4bafda198f8936f54f31ce99c05ec842394d5 100644 (file)
@@ -96,7 +96,7 @@ static void handle_holding_disk_restore(char * filename, rst_flags_t * flags,
 static void handle_tape_restore(char * device_name, rst_flags_t * flags,
                                 GSList * dumpspecs, char * check_label) {
     Device * device;
-    ReadLabelStatusFlags read_label_status;
+    DeviceStatusFlags device_status;
 
     dumpfile_t first_restored_file;
 
@@ -105,24 +105,24 @@ static void handle_tape_restore(char * device_name, rst_flags_t * flags,
     fh_init(&first_restored_file);
     
     device = device_open(device_name);
-    if (device == NULL) {
-        error("Could not open device.\n");
+    g_assert(device != NULL);
+    if (device->status != DEVICE_STATUS_SUCCESS) {
+        error("Could not open device %s: %s.\n", device_name, device_error(device));
     }
     
-    device_set_startup_properties_from_config(device);
-    read_label_status = device_read_label(device);
-    if (read_label_status != READ_LABEL_STATUS_SUCCESS) {
-        char * errstr =
-            g_english_strjoinv_and_free
-                (g_flags_nick_to_strv(read_label_status,
-                                      READ_LABEL_STATUS_FLAGS_TYPE), "or");
-        error("Error reading volume label: %s.\n", errstr);
+    if (!set_restore_device_read_buffer_size(device, flags)) {
+        error("Error setting read block size: %s.\n", device_error_or_status(device));
+    }
+    device_status = device_read_label(device);
+    if (device_status != DEVICE_STATUS_SUCCESS) {
+        error("Error reading volume label: %s.\n", device_error_or_status(device));
     }
 
     g_assert(device->volume_label != NULL);
 
     if (!device_start(device, ACCESS_READ, NULL, NULL)) {
-        error("Could not open device %s for reading.\n", device_name);
+        error("Could not open device %s for reading: %s.\n", device_name,
+             device_error(device));
     }
 
     if (check_label != NULL && strcmp(check_label,
@@ -195,10 +195,6 @@ main(
                error(_("invalid blocksize value \"%s\""), optarg);
                /*NOTREACHED*/
            }
-           if(rst_flags->blocksize < DISK_BLOCK_BYTES) {
-               error(_("minimum block size is %dk"), DISK_BLOCK_BYTES / 1024);
-               /*NOTREACHED*/
-           }
            break;
        case 'c': rst_flags->compress = 1; break;
        case 'o':
@@ -220,6 +216,9 @@ main(
            /*@end@*/
            break;
        case 'l':
+            if (label) {
+                error(_("Cannot specify multiple labels.\n"));
+            }
            label = stralloc(optarg);
            break;
        default:
@@ -228,9 +227,16 @@ main(
     }
 
     /* initialize a generic configuration without reading anything */
-    config_init(CONFIG_INIT_CLIENT, NULL);
+    config_init(0, NULL);
     apply_config_overwrites(cfg_ovr);
 
+    if (config_errors(NULL) >= CFGERR_WARNINGS) {
+       config_print_errors();
+       if (config_errors(NULL) >= CFGERR_ERRORS) {
+           g_critical(_("errors processing config file"));
+       }
+    }
+
     if(rst_flags->compress && rst_flags->raw) {
        g_fprintf(stderr,
                _("Cannot specify both -r (raw) and -c (compressed) output.\n"));
index 130d08ef844fa2cfad50a788a00ec613806cce07..828a41441cb17785e3d464937050125490e59dac 100644 (file)
@@ -38,6 +38,7 @@
 #include "fileheader.h"
 #include "arglist.h"
 #include "cmdline.h"
+#include "server_util.h"
 #include <signal.h>
 #include <timestamp.h>
 
@@ -125,7 +126,10 @@ handle_sigint(
     (void)sig; /* Quiet unused parameter warning */
 
     flush_open_outputs(exitassemble, NULL);
-    if(rst_conf_logfile) unlink(rst_conf_logfile);
+    if (rst_conf_logfile) {
+       unlink(rst_conf_logfile);
+       log_add(L_INFO, "pid-done %ld\n", (long)getpid());
+    }
     exit(0);
 }
 
@@ -135,11 +139,17 @@ lock_logfile(void)
     rst_conf_logdir = config_dir_relative(getconf_str(CNF_LOGDIR));
     rst_conf_logfile = vstralloc(rst_conf_logdir, "/log", NULL);
     if (access(rst_conf_logfile, F_OK) == 0) {
-       dbprintf(_("%s exists: amdump or amflush is already running, "
-                 "or you must run amcleanup\n"), rst_conf_logfile);
+       run_amcleanup(get_config_name());
+    }
+    if (access(rst_conf_logfile, F_OK) == 0) {
+       char *process_name = get_master_process(rst_conf_logfile);
+       dbprintf(_("%s exists: %s is already running, "
+                 "or you must run amcleanup\n"), rst_conf_logfile,
+                process_name);
+       amfree(process_name);
        return 0;
     }
-    log_add(L_INFO, get_pname());
+    log_add(L_INFO, "%s", get_pname());
     return 1;
 }
 
@@ -194,23 +204,36 @@ append_file_to_fd(
     char *     filename,
     int                write_fd)
 {
-    int read_fd;
+    queue_fd_t queue_fd_write = {write_fd, NULL};
+    queue_fd_t queue_fd_read = {0, NULL};
+    
 
-    read_fd = robust_open(filename, O_RDONLY, 0);
-    if (read_fd < 0) {
+    queue_fd_read.fd = robust_open(filename, O_RDONLY, 0);
+    if (queue_fd_read.fd < 0) {
        error(_("can't open %s: %s"), filename, strerror(errno));
        /*NOTREACHED*/
     }
 
-    if (!do_consumer_producer_queue(fd_read_producer, GINT_TO_POINTER(read_fd),
-                                    fd_write_consumer,
-                                    GINT_TO_POINTER(write_fd))) {
-        error("Error copying data from file \"%s\" to fd %d.\n",
-              filename, write_fd);
+    if (!do_consumer_producer_queue(fd_read_producer, &queue_fd_read,
+                                    fd_write_consumer, &queue_fd_write)) {
+       if (queue_fd_read.errmsg && queue_fd_write.errmsg) {
+           error("Error copying data from file \"%s\" to fd %d: %s: %s.\n",
+                 filename, queue_fd_write.fd, queue_fd_read.errmsg,
+                 queue_fd_write.errmsg);
+       } else if (queue_fd_read.errmsg) {
+           error("Error copying data from file \"%s\" to fd %d: %s.\n",
+                 filename, queue_fd_write.fd, queue_fd_read.errmsg);
+       } else if (queue_fd_write.errmsg) {
+           error("Error copying data from file \"%s\" to fd %d: %s.\n",
+                 filename, queue_fd_write.fd, queue_fd_write.errmsg);
+       } else {
+           error("Error copying data from file \"%s\" to fd %d.\n",
+                 filename, queue_fd_write.fd);
+       }
         g_assert_not_reached();
     }
 
-    aclose(read_fd);
+    aclose(queue_fd_read.fd);
 }
 
 /* A user_init function for changer_find(). See changer.h for
@@ -230,6 +253,7 @@ scan_init(G_GNUC_UNUSED void *      ud, int rc, G_GNUC_UNUSED int ns,
 typedef struct {
     char ** cur_tapedev;
     char * searchlabel;
+    rst_flags_t *flags;
 } loadlabel_data;
 
 /* DANGER WILL ROBINSON: This function references globals:
@@ -243,7 +267,7 @@ loadlabel_slot(void *       datap,
 {
     loadlabel_data * data = (loadlabel_data*)datap;
     Device * device;
-    ReadLabelStatusFlags label_status;
+    DeviceStatusFlags device_status;
 
     g_return_val_if_fail(rc > 1 || device_name != NULL, 0);
     g_return_val_if_fail(slotstr != NULL, 0);
@@ -262,22 +286,33 @@ loadlabel_slot(void *     datap,
     } 
     
     device = device_open(device_name);
-    if (device == NULL) {
-        g_fprintf(stderr, "%s: slot %s: Could not open device.\n",
-                get_pname(), slotstr);
+    g_assert(device != NULL);
+    if (device->status != DEVICE_STATUS_SUCCESS) {
+        g_fprintf(stderr, "%s: slot %s: Could not open device: %s.\n",
+                get_pname(), slotstr, device_error(device));
         return 0;
     }
 
-    device_set_startup_properties_from_config(device);
-    label_status = device_read_label(device);
-    if (label_status != READ_LABEL_STATUS_SUCCESS) {
-        char * errstr =
-            g_english_strjoinv_and_free
-                (g_flags_nick_to_strv(label_status,
-                                      READ_LABEL_STATUS_FLAGS_TYPE), "or");
+    if (!device_configure(device, TRUE)) {
+        g_fprintf(stderr, "%s: slot %s: Error configuring device:\n"
+                "%s: slot %s: %s\n",
+                get_pname(), slotstr, get_pname(), slotstr, device_error_or_status(device));
+        g_object_unref(device);
+        return 0;
+    }
+
+    if (!set_restore_device_read_buffer_size(device, data->flags)) {
+        g_fprintf(stderr, "%s: slot %s: Error setting read block size:\n"
+                "%s: slot %s: %s\n",
+                get_pname(), slotstr, get_pname(), slotstr, device_error_or_status(device));
+        g_object_unref(device);
+        return 0;
+    }
+    device_status = device_read_label(device);
+    if (device_status != DEVICE_STATUS_SUCCESS) {
         g_fprintf(stderr, "%s: slot %s: Error reading tape label:\n"
                 "%s: slot %s: %s\n",
-                get_pname(), slotstr, get_pname(), slotstr, errstr);
+                get_pname(), slotstr, get_pname(), slotstr, device_error_or_status(device));
         g_object_unref(device);
         return 0;
     }
@@ -291,8 +326,8 @@ loadlabel_slot(void *       datap,
     }
 
     if (!device_start(device, ACCESS_READ, NULL, NULL)) {
-        g_fprintf(stderr, "%s: slot %s: Could not open device for reading.\n",
-                get_pname(), slotstr);
+        g_fprintf(stderr, "%s: slot %s: Could not open device for reading: %s.\n",
+                get_pname(), slotstr, device_error(device));
         return 0;
     }
 
@@ -608,7 +643,7 @@ read_holding_disk_header(
     int                        tapefd,
     rst_flags_t *      flags)
 {
-    ssize_t bytes_read;
+    size_t bytes_read;
     char *buffer;
     size_t blocksize;
 
@@ -618,24 +653,27 @@ read_holding_disk_header(
         blocksize = DISK_BLOCK_BYTES;
     buffer = alloc(blocksize);
 
-    bytes_read = fullread(tapefd, buffer, blocksize);
-    if(bytes_read < 0) {
-       g_fprintf(stderr, _("%s: error reading file header: %s\n"),
-               get_pname(), strerror(errno));
-       file->type = F_UNKNOWN;
-    } else if((size_t)bytes_read < DISK_BLOCK_BYTES) {
-       if(bytes_read == 0) {
-           g_fprintf(stderr, _("%s: missing file header block\n"), get_pname());
+    bytes_read = full_read(tapefd, buffer, blocksize);
+    if(bytes_read < blocksize) {
+       const char *errtxt;
+       if(errno == 0)
+           errtxt = "Unexpected EOF";
+       else
+           errtxt = strerror(errno);
+
+       if (bytes_read == 0) {
+           g_fprintf(stderr, _("%s: missing file header block: %s\n"), 
+               get_pname(), errtxt);
        } else {
            g_fprintf(stderr,
-                   plural(_("%s: short file header block: %zd byte"),
-                          _("%s: short file header block: %zd bytes\n"),
+                   plural(_("%s: short file header block: %zd byte: %s"),
+                          _("%s: short file header block: %zd bytes: %s\n"),
                           bytes_read),
-                   get_pname(), (size_t)bytes_read);
+                   get_pname(), bytes_read, errtxt);
        }
        file->type = F_UNKNOWN;
     } else {
-        parse_file_header(buffer, file, (size_t)bytes_read);
+        parse_file_header(buffer, file, bytes_read);
     }
     amfree(buffer);
     return (file->type != F_UNKNOWN &&
@@ -663,7 +701,7 @@ void restore(RestoreSource * source,
     int check_for_aborted = 0;
     char *tmp_filename = NULL, *final_filename = NULL;
     struct stat statinfo;
-    open_output_t *myout = NULL, *oldout = NULL;
+    open_output_t *free_myout = NULL, *myout = NULL, *oldout = NULL;
     dumplist_t *tempdump = NULL, *fileentry = NULL;
     char *buffer;
     int need_compress=0, need_uncompress=0, need_decrypt=0;
@@ -713,12 +751,12 @@ void restore(RestoreSource * source,
            flags->leave_comp = 1;
        }
        if(myout == NULL){
-           myout = alloc(SIZEOF(open_output_t));
+           free_myout = myout = alloc(SIZEOF(open_output_t));
            memset(myout, 0, SIZEOF(open_output_t));
        }
     }
     else{
-      myout = alloc(SIZEOF(open_output_t));
+      free_myout = myout = alloc(SIZEOF(open_output_t));
       memset(myout, 0, SIZEOF(open_output_t));
     }
 
@@ -789,8 +827,9 @@ void restore(RestoreSource * source,
      * it has a fixed size.
      */
     if(flags->raw || (flags->headers && !is_continuation)) {
-       ssize_t w;
-       dumpfile_t tmp_hdr;
+       ssize_t     w;
+       dumpfile_t  tmp_hdr;
+       char       *dle_str;
 
        if(flags->compress && !file_is_compressed) {
            source->header->compressed = 1;
@@ -815,6 +854,8 @@ void restore(RestoreSource * source,
        /* remove CONT_FILENAME from header */
        memset(source->header->cont_filename, '\0',
                SIZEOF(source->header->cont_filename));
+       dle_str = clean_dle_str_for_client(source->header->dle_str);
+       source->header->dle_str = dle_str;
        source->header->blocksize = DISK_BLOCK_BYTES;
 
        /*
@@ -828,9 +869,9 @@ void restore(RestoreSource * source,
        buffer = alloc(DISK_BLOCK_BYTES);
        buffer = build_header(source->header, DISK_BLOCK_BYTES);
 
-       if((w = fullwrite(out, buffer,
+       if((w = full_write(out, buffer,
                           DISK_BLOCK_BYTES)) != DISK_BLOCK_BYTES) {
-           if(w < 0) {
+           if(errno != 0) {
                error(_("write error: %s"), strerror(errno));
                /*NOTREACHED*/
            } else {
@@ -1027,26 +1068,28 @@ void restore(RestoreSource * source,
     /* copy the rest of the file from tape to the output */
     if (source->restore_mode == HOLDING_MODE) {
         dumpfile_t file;
-        int fd = source->u.holding_fd;
+       queue_fd_t queue_read = {source->u.holding_fd, NULL};
+       queue_fd_t queue_write = {pipes[0].pipe[1], NULL};
         memcpy(& file, source->header, sizeof(file));
         for (;;) {
             do_consumer_producer_queue(fd_read_producer,
-                                       GINT_TO_POINTER(fd),
+                                       &queue_read,
                                        fd_write_consumer,
-                                       GINT_TO_POINTER(pipes[0].pipe[1]));
+                                       &queue_write);
+           /* TODO: Check error */
            /*
             * See if we need to switch to the next file in a holding restore
             */
            if(file.cont_filename[0] == '\0') {
                break;                          /* no more files */
            }
-           aclose(fd);
-           if((fd = open(file.cont_filename, O_RDONLY)) == -1) {
+           aclose(queue_read.fd);
+           if((queue_read.fd = open(file.cont_filename, O_RDONLY)) == -1) {
                char *cont_filename =
                     strrchr(file.cont_filename,'/');
                if(cont_filename) {
                    cont_filename++;
-                   if((fd = open(cont_filename,O_RDONLY)) == -1) {
+                   if((queue_read.fd = open(cont_filename,O_RDONLY)) == -1) {
                        error(_("can't open %s: %s"), file.cont_filename,
                              strerror(errno));
                        /*NOTREACHED*/
@@ -1064,7 +1107,7 @@ void restore(RestoreSource * source,
                    /*NOTREACHED*/
                }
            }
-           read_holding_disk_header(&file, fd, flags);
+           read_holding_disk_header(&file, queue_read.fd, flags);
            if(file.type != F_DUMPFILE && file.type != F_CONT_DUMPFILE
                    && file.type != F_SPLIT_DUMPFILE) {
                g_fprintf(stderr, _("unexpected header type: "));
@@ -1073,9 +1116,12 @@ void restore(RestoreSource * source,
            }
        }            
     } else {
-        device_read_to_fd(source->u.device, pipes[0].pipe[1]);
+       queue_fd_t queue_fd = {pipes[0].pipe[1], NULL};
+        device_read_to_fd(source->u.device, &queue_fd);
+       /* TODO: Check error */
     }
 
+    amfree(free_myout);
     if(!flags->inline_assemble) {
         if(out != dest)
            aclose(out);
@@ -1178,6 +1224,37 @@ void restore(RestoreSource * source,
     }
 }
 
+gboolean
+set_restore_device_read_buffer_size(
+    Device *device,
+    rst_flags_t *flags)
+{
+    /* if the user specified a blocksize, try to use it */
+    if (flags->blocksize) {
+       GValue val;
+       gboolean success;
+
+       bzero(&val, sizeof(GValue));
+
+       g_value_init(&val, G_TYPE_UINT);
+       g_value_set_uint(&val, flags->blocksize);
+       success = device_property_set(device, PROPERTY_READ_BUFFER_SIZE, &val);
+       g_value_unset(&val);
+       if (!success) {
+           if (device->status == DEVICE_STATUS_SUCCESS) {
+               /* device doesn't have this property, so quietly ignore it */
+               g_warning(_("Device %s does not support PROPERTY_READ_BUFFER_SIZE; ignoring block size %zd"),
+                       device->device_name, flags->blocksize);
+           } else {
+               /* it's a real error */
+               return FALSE;
+           }
+       }
+    }
+
+    return TRUE;
+}
+
 /* return NULL if the label is not the expected one                     */
 /* returns a Device handle if it is the expected one. */
 /* FIXME: Was label_of_current_slot */
@@ -1197,27 +1274,43 @@ conditional_device_open(char         *tapedev,
     }
 
     rval = device_open(tapedev);
-    if (rval == NULL) {
+    g_assert(rval != NULL);
+    if (rval->status != DEVICE_STATUS_SUCCESS) {
        send_message(prompt_out, flags, their_features, 
-                    "Error opening device '%s'.",
-                    tapedev);
+                    "Error opening device '%s': %s.",
+                    tapedev, device_error(rval));
+        g_object_unref(rval);
         return NULL;
     }
 
-    device_set_startup_properties_from_config(rval);
+    if (!device_configure(rval, TRUE)) {
+        g_fprintf(stderr, "Error configuring device: %s\n", device_error_or_status(rval));
+        g_object_unref(rval);
+        return NULL;
+    }
+
+    if (!set_restore_device_read_buffer_size(rval, flags)) {
+       send_message(prompt_out, flags, their_features,
+                    "Error setting read block size on '%s': %s.",
+                    tapedev, device_error(rval));
+        g_object_unref(rval);
+        return NULL;
+    }
     device_read_label(rval);
 
     if (rval->volume_label == NULL) {
-        send_message(prompt_out, flags, their_features,
-                     "Not an amanda tape");
+       char *errstr = stralloc2("Not an amanda tape: ",
+                                device_error(rval));
+        send_message(prompt_out, flags, their_features, "%s", errstr);
+       amfree(errstr);
         g_object_unref(rval);
         return NULL;
     }
 
     if (!device_start(rval, ACCESS_READ, NULL, NULL)) {
         send_message(prompt_out, flags, their_features,
-                     "Colud not open device %s for reading.\n",
-                     tapedev);
+                     "Colud not open device %s for reading: %s.\n",
+                     tapedev, device_error(rval));
         return NULL;
     }
 
@@ -1252,6 +1345,7 @@ load_next_tape(
             loadlabel_data data;
             data.cur_tapedev = cur_tapedev;
             data.searchlabel = desired_tape->label;
+           data.flags = flags;
            changer_find(&data, scan_init, loadlabel_slot,
                         desired_tape->label);
             return LOAD_CHANGER;
@@ -1481,8 +1575,9 @@ try_restore_single_file(Device * device, int file_num, int* next_file,
     if (source.header == NULL) {
         /* This definitely indicates an error. */
         send_message(prompt_out, flags, their_features,
-                     "Could not seek device %s to file %d.",
-                     device->device_name, file_num);
+                     "Could not seek device %s to file %d: %s.",
+                     device->device_name, file_num,
+                    device_error(device));
         return RESTORE_STATUS_NEXT_TAPE;
     } else if (source.header->type == F_TAPEEND) {
         amfree(source.header);
@@ -1500,6 +1595,9 @@ try_restore_single_file(Device * device, int file_num, int* next_file,
             file_num = device->file;
         }
     }
+    if (!am_has_feature(their_features, fe_amrecover_dle_in_header)) {
+       source.header->dle_str = NULL;
+    }
 
     if (next_file != NULL) {
         *next_file = file_num + 1;
@@ -1522,6 +1620,7 @@ try_restore_single_file(Device * device, int file_num, int* next_file,
 
     if (first_restored_file != NULL &&
         first_restored_file->type != F_UNKNOWN &&
+       first_restored_file->type != F_EMPTY &&
         !headers_equal(first_restored_file, source.header, 1) &&
         (flags->pipe_to_fd == fileno(stdout))) {
         return RESTORE_STATUS_STOP;
@@ -1566,6 +1665,10 @@ search_a_tape(Device      * device,
     int         i;
     RestoreFileStatus restore_status = RESTORE_STATUS_NEXT_TAPE;
 
+    /* if we're doing an inventory (logstream != NULL), then we need
+     * somewhere to keep track of our seen tapes */
+    g_assert(tape_seen != NULL || logstream == NULL);
+
     source.restore_mode = DEVICE_MODE;
     source.u.device = device;
 
@@ -1826,6 +1929,7 @@ restore_from_tapelist(FILE * prompt_out,
                 loadlabel_data data;
                 data.cur_tapedev = &tapedev;
                 data.searchlabel =  cur_volume->label;
+               data.flags = flags;
                 changer_find(&data, scan_init, loadlabel_slot,
                              cur_volume->label);
                 device = conditional_device_open(tapedev, prompt_out,
@@ -1901,16 +2005,16 @@ restore_without_tapelist(FILE * prompt_out,
             }
             if (cur_slot >= slot_count)
                 break;
-            
-            g_fprintf(stderr, "Scanning %s (slot %s)\n", device->volume_label,
-                    curslot);
         } else {
             device = manual_find_tape(&cur_tapedev, NULL, prompt_out,
                                       prompt_in, flags, features);
         }
         
         if (device == NULL)
-            break;;
+            break;
+
+       g_fprintf(stderr, "Scanning %s (slot %s)\n", device->volume_label,
+               curslot);
         
         if (!search_a_tape(device, prompt_out, flags, features,
                            NULL, dumpspecs, &seentapes, &first_restored_file,
index 02775774c43d9aee99f425316b25fe026ddff282..1844a4d0b13257ccd88d9040b1bdecb4e2076685 100644 (file)
@@ -103,6 +103,7 @@ int lock_logfile(void);
 void send_message(FILE *prompt_out, rst_flags_t *flags,
                  am_feature_t *their_features,
                  char * format, ...) G_GNUC_PRINTF(4,5);
+gboolean set_restore_device_read_buffer_size(Device *device, rst_flags_t *flags);
 
 #endif /* RESTORE_H */
 
index 0a03c66558948a7a4490fabdd0d227242dcedbab..57363aefea9b2917d0e62e69a83e830730ff7490 100644 (file)
@@ -21,8 +21,9 @@ LINTFLAGS=$(AMLINTFLAGS)
 amlib_LTLIBRARIES =    libamserver.la
 
 sbin_PROGRAMS =                amadmin         amcheck         \
-                       amflush         amgetconf       amlabel         \
-                       amtape          amreport
+                       amflush         amlabel         \
+                       amservice       amtape          \
+                       amreport
 
 noinst_PROGRAMS = taper_source_test
 
@@ -36,31 +37,28 @@ CHECK_PERL = \
            amaddclient \
            amoverview \
            amserverconfig \
-           amstatus \
-           amtoc
-SCRIPTS_PERL =  \
-           $(CHECK_PERL) \
+           amtoc \
            amdevcheck \
-           amcheckdump
-
+           amcheckdump \
+           amcleanup \
+           amvault \
+           amstatus
+SCRIPTS_PERL = $(CHECK_PERL)
 SCRIPTS_SHELL = \
            amcheckdb \
-           amcleanup \
            amdump \
-           amrmtape \
-           amverify \
-           amverifyrun
+           amrmtape
 
 sbin_SCRIPTS = $(SCRIPTS_PERL) $(SCRIPTS_SHELL)
 
 INSTALLPERMS_exec = \
        dest=$(sbindir) chown=amanda chmod= \
                $(sbin_PROGRAMS) \
-       chown=root chmod=u+s,o-rwx \
-               amcheck \
+       chown=root chmod=04750 \
+               amcheck amservice \
        dest=$(amlibexecdir) chown=amanda chmod= \
                $(amlibexec_PROGRAMS) \
-       chown=root chmod=u+s,o-rwx \
+       chown=root chmod=04750 \
                dumper planner
 
 INSTALLPERMS_data = \
@@ -80,7 +78,6 @@ LDADD = ../common-src/libamanda.la   \
        libamserver.la               \
        ../device-src/libamdevice.la     \
        ../common-src/libamanda.la   \
-       ../gnulib/libgnu.la          \
         $(READLINE_LIBS)
 
 libamserver_la_SOURCES=        amindex.c       changer.c                       \
@@ -128,8 +125,6 @@ amindexd_SOURCES =  disk_history.h  list_dir.h      $(amindexd_CSRC)
 
 amreport_SOURCES =     reporter.c
 
-amgetconf_SOURCES =    getconf.c
-
 noinst_HEADERS =       amindex.h       changer.h       cmdline.h       \
                        diskfile.h      driverio.h      \
                        holding.h       infofile.h      logfile.h       \
@@ -140,20 +135,17 @@ noinst_HEADERS =  amindex.h       changer.h       cmdline.h       \
 
 lint:
        @ for p in $(amlibexec_PROGRAMS) $(sbin_PROGRAMS); do                   \
+               p=`basename $$p $(EXEEXT)`;                                     \
                if [ $$p = "amindexd" ]; then                                   \
                        s="$(amindexd_CSRC)";                                   \
                elif [ $$p = "amreport" ]; then                                 \
                        s="$(amreport_SOURCES)";                                \
-               elif [ $$p = "amgetconf" ]; then                                \
-                       s="$(getconf_SOURCES)";                                 \
                else                                                            \
                        s=$$p.c;                                                \
                fi;                                                             \
                f="$$s $(libamserver_la_SOURCES)";                              \
                (cd ../common-src; make listlibsrc);                            \
                f="$$f "`cat ../common-src/listlibsrc.output`;                  \
-               (cd ../tape-src; make listlibsrc);                              \
-               f="$$f "`cat ../tape-src/listlibsrc.output`;                    \
                echo $(LINT) $$f;                                               \
                $(LINT) $(LINTFLAGS) $(CPPFLAGS) $(DEFS) -I. -I$(top_builddir)/config   \
                    $(INCLUDES) $$f;                                            \
index 4533c0b1dd727b6f3cba73e0115727a13f667670..7707954392de6793a93070eddb1c9821b3ca9871 100644 (file)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  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.
@@ -17,7 +17,7 @@
 # Makefile for Amanda server programs.
 
 # vim:ft=automake
-# Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
 # 
 # This library is free software; you can redistribute it and/or modify it
 # under the terms of the GNU Lesser General Public License version 2.1 as 
 # along with this library; if not, write to the Free Software Foundation,
 # Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
 # 
-# Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
-# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 
 # simple include file to pre-define variables which are then +='d by other
 # scripts in this directory.
 
 # vim:ft=automake
-# Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
 # 
 # This library is free software; you can redistribute it and/or modify it
 # under the terms of the GNU Lesser General Public License version 2.1 as 
@@ -54,8 +54,8 @@
 # along with this library; if not, write to the Free Software Foundation,
 # Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
 # 
-# Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
-# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 
 # SYNOPSIS:
 #
 # Files which support it are syntax-checked when the user invokes 'make check'.
 #
 # All *target* filenames must be listed in SCRIPTS_SHELL, SCRIPTS_PERL, and 
-# SCRIPTS_AWK to support 'make check', 'make dist', and 'make distclean'.
+# SCRIPTS_AWK to support 'make check', 'make dist', and 'make distclean'. No
+# files which are not substituted by config.status should be included in
+# SCRIPTS_PERL, SCRIPTS_SHELL, or SCRIPTS_AWK.  If non-generated files are listed
+# for installation, then Automake will figure out that they should be distributed;
+# otherwise, include them in EXTRA_DIST.
 #
 # USAGE:
 #
 #   SCRIPTS_PERL = fooscript barscript perl-lib.pl perlmod.pm
 #   SCRIPTS_SHELL = shell1 shell2 sh-lib.sh
 #   SCRIPTS_AWK = talk balk chalk awk-lib.awk
+#   sbin_SCRIPTS = not-subbed
+#   EXTRA_DIST = util-script.pl
 #
 # with the corresponding files in the repository:
 #
 #   fooscript.pl barscript.pl perl-lib.pl.in perlmod.pm.in
 #   shell1.sh shell2.sh sh-lib.sh.in
 #   talk.awk balk.awk chalk.awk awk-lib.awk.in
+#   not-subbed util-script.pl
 #
 # by default, all shell and perl scripts are syntax checked.  If this is
 # a problem (for example, perl scripts depending on Amanda extension 
 # INSTALLPERMS_exec = \
 #      dest=$(sbindir) chown=amanda chmod= \
 #              foo bar \
-#      chmod=u+s,o-rwx \
+#      chmod=07450 \
 #              bing
 #      dest=$(libexecdir) chmod= \
 #              $(libexec_PROGRAMS)
 #
 # This whole operation is not required when making builds for packaging,
 # and can be disabled with --disable-installperms, via the WANT_INSTALLPERMS
-# AM_CONDITIONAL.
+# AM_CONDITIONAL.  When disabled, the file 'installperms.sh' in the top-level
+# build directory is populated with a format suitable for shell interpretation,
+# with lines like this:
+#   installperm "amanda:disk" "04750" "/usr/local/sbin/bing"
+# the arguments being, respectively, owner:group, mode, and filename.  There will
+# be exactly one line for each file which has specific permissions.  The intention
+# is that this file be used by packaging scripts to set correct permissions at install
+# time.  Note that files which have no special permissions requirements do not appear 
+# in this file at all, due to limitations of Automake.
 
 # vim:ft=automake
 
@@ -167,8 +182,9 @@ DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
        $(top_srcdir)/config/automake/precompile.am \
        $(top_srcdir)/config/automake/scripts.am \
        $(top_srcdir)/config/automake/vars.am
+@WANT_INSTALLPERMS_FALSE@am__append_1 = $(installperms_sh)
 sbin_PROGRAMS = amadmin$(EXEEXT) amcheck$(EXEEXT) amflush$(EXEEXT) \
-       amgetconf$(EXEEXT) amlabel$(EXEEXT) amtape$(EXEEXT) \
+       amlabel$(EXEEXT) amservice$(EXEEXT) amtape$(EXEEXT) \
        amreport$(EXEEXT)
 noinst_PROGRAMS = taper_source_test$(EXEEXT)
 amlibexec_PROGRAMS = amindexd$(EXEEXT) amlogroll$(EXEEXT) \
@@ -180,6 +196,7 @@ subdir = server-src
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps =  \
        $(top_srcdir)/config/macro-archive/ac_define_dir.m4 \
+       $(top_srcdir)/config/macro-archive/ac_perl_module_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_perl_version.m4 \
        $(top_srcdir)/config/macro-archive/ac_prog_swig.m4 \
        $(top_srcdir)/config/macro-archive/ax_compare_version.m4 \
@@ -213,6 +230,7 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/amanda/libs.m4 \
        $(top_srcdir)/config/amanda/net.m4 \
        $(top_srcdir)/config/amanda/progs.m4 \
+       $(top_srcdir)/config/amanda/ps.m4 \
        $(top_srcdir)/config/amanda/readdir.m4 \
        $(top_srcdir)/config/amanda/readline.m4 \
        $(top_srcdir)/config/amanda/rsh-security.m4 \
@@ -235,7 +253,9 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/float_h.m4 \
        $(top_srcdir)/config/gnulib/fsusage.m4 \
        $(top_srcdir)/config/gnulib/getaddrinfo.m4 \
+       $(top_srcdir)/config/gnulib/getopt.m4 \
        $(top_srcdir)/config/gnulib/gettimeofday.m4 \
+       $(top_srcdir)/config/gnulib/gnulib-common.m4 \
        $(top_srcdir)/config/gnulib/gnulib-comp.m4 \
        $(top_srcdir)/config/gnulib/include_next.m4 \
        $(top_srcdir)/config/gnulib/inet_ntop.m4 \
@@ -263,7 +283,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gnulib/sys_stat_h.m4 \
        $(top_srcdir)/config/gnulib/sys_time_h.m4 \
        $(top_srcdir)/config/gnulib/tempname.m4 \
-       $(top_srcdir)/config/gnulib/ulonglong.m4 \
        $(top_srcdir)/config/gnulib/unistd_h.m4 \
        $(top_srcdir)/config/gnulib/vasnprintf.m4 \
        $(top_srcdir)/config/gnulib/visibility.m4 \
@@ -274,7 +293,6 @@ am__aclocal_m4_deps =  \
        $(top_srcdir)/config/gettext-macros/lib-ld.m4 \
        $(top_srcdir)/config/gettext-macros/lib-link.m4 \
        $(top_srcdir)/config/gettext-macros/lib-prefix.m4 \
-       $(top_srcdir)/config/gettext-macros/longlong.m4 \
        $(top_srcdir)/config/gettext-macros/nls.m4 \
        $(top_srcdir)/config/gettext-macros/po.m4 \
        $(top_srcdir)/config/gettext-macros/progtest.m4 \
@@ -318,38 +336,32 @@ amadmin_LDADD = $(LDADD)
 am__DEPENDENCIES_1 =
 amadmin_DEPENDENCIES = ../common-src/libamanda.la libamserver.la \
        ../device-src/libamdevice.la ../common-src/libamanda.la \
-       ../gnulib/libgnu.la $(am__DEPENDENCIES_1)
+       $(am__DEPENDENCIES_1)
 amcheck_SOURCES = amcheck.c
 amcheck_OBJECTS = amcheck.$(OBJEXT)
 amcheck_LDADD = $(LDADD)
 amcheck_DEPENDENCIES = ../common-src/libamanda.la libamserver.la \
        ../device-src/libamdevice.la ../common-src/libamanda.la \
-       ../gnulib/libgnu.la $(am__DEPENDENCIES_1)
+       $(am__DEPENDENCIES_1)
 amcleanupdisk_SOURCES = amcleanupdisk.c
 amcleanupdisk_OBJECTS = amcleanupdisk.$(OBJEXT)
 amcleanupdisk_LDADD = $(LDADD)
 amcleanupdisk_DEPENDENCIES = ../common-src/libamanda.la libamserver.la \
        ../device-src/libamdevice.la ../common-src/libamanda.la \
-       ../gnulib/libgnu.la $(am__DEPENDENCIES_1)
+       $(am__DEPENDENCIES_1)
 amflush_SOURCES = amflush.c
 amflush_OBJECTS = amflush.$(OBJEXT)
 amflush_LDADD = $(LDADD)
 amflush_DEPENDENCIES = ../common-src/libamanda.la libamserver.la \
        ../device-src/libamdevice.la ../common-src/libamanda.la \
-       ../gnulib/libgnu.la $(am__DEPENDENCIES_1)
-am_amgetconf_OBJECTS = getconf.$(OBJEXT)
-amgetconf_OBJECTS = $(am_amgetconf_OBJECTS)
-amgetconf_LDADD = $(LDADD)
-amgetconf_DEPENDENCIES = ../common-src/libamanda.la libamserver.la \
-       ../device-src/libamdevice.la ../common-src/libamanda.la \
-       ../gnulib/libgnu.la $(am__DEPENDENCIES_1)
+       $(am__DEPENDENCIES_1)
 am__objects_1 = amindexd.$(OBJEXT) disk_history.$(OBJEXT) \
        list_dir.$(OBJEXT)
 am_amindexd_OBJECTS = $(am__objects_1)
 amindexd_OBJECTS = $(am_amindexd_OBJECTS)
 am__DEPENDENCIES_2 = ../common-src/libamanda.la libamserver.la \
        ../device-src/libamdevice.la ../common-src/libamanda.la \
-       ../gnulib/libgnu.la $(am__DEPENDENCIES_1)
+       $(am__DEPENDENCIES_1)
 amindexd_DEPENDENCIES = $(am__DEPENDENCIES_2) \
        ../amandad-src/libamandad.la
 amlabel_SOURCES = amlabel.c
@@ -357,73 +369,79 @@ amlabel_OBJECTS = amlabel.$(OBJEXT)
 amlabel_LDADD = $(LDADD)
 amlabel_DEPENDENCIES = ../common-src/libamanda.la libamserver.la \
        ../device-src/libamdevice.la ../common-src/libamanda.la \
-       ../gnulib/libgnu.la $(am__DEPENDENCIES_1)
+       $(am__DEPENDENCIES_1)
 amlogroll_SOURCES = amlogroll.c
 amlogroll_OBJECTS = amlogroll.$(OBJEXT)
 amlogroll_LDADD = $(LDADD)
 amlogroll_DEPENDENCIES = ../common-src/libamanda.la libamserver.la \
        ../device-src/libamdevice.la ../common-src/libamanda.la \
-       ../gnulib/libgnu.la $(am__DEPENDENCIES_1)
+       $(am__DEPENDENCIES_1)
 am_amreport_OBJECTS = reporter.$(OBJEXT)
 amreport_OBJECTS = $(am_amreport_OBJECTS)
 amreport_LDADD = $(LDADD)
 amreport_DEPENDENCIES = ../common-src/libamanda.la libamserver.la \
        ../device-src/libamdevice.la ../common-src/libamanda.la \
-       ../gnulib/libgnu.la $(am__DEPENDENCIES_1)
+       $(am__DEPENDENCIES_1)
+amservice_SOURCES = amservice.c
+amservice_OBJECTS = amservice.$(OBJEXT)
+amservice_LDADD = $(LDADD)
+amservice_DEPENDENCIES = ../common-src/libamanda.la libamserver.la \
+       ../device-src/libamdevice.la ../common-src/libamanda.la \
+       $(am__DEPENDENCIES_1)
 amtape_SOURCES = amtape.c
 amtape_OBJECTS = amtape.$(OBJEXT)
 amtape_LDADD = $(LDADD)
 amtape_DEPENDENCIES = ../common-src/libamanda.la libamserver.la \
        ../device-src/libamdevice.la ../common-src/libamanda.la \
-       ../gnulib/libgnu.la $(am__DEPENDENCIES_1)
+       $(am__DEPENDENCIES_1)
 amtrmidx_SOURCES = amtrmidx.c
 amtrmidx_OBJECTS = amtrmidx.$(OBJEXT)
 amtrmidx_LDADD = $(LDADD)
 amtrmidx_DEPENDENCIES = ../common-src/libamanda.la libamserver.la \
        ../device-src/libamdevice.la ../common-src/libamanda.la \
-       ../gnulib/libgnu.la $(am__DEPENDENCIES_1)
+       $(am__DEPENDENCIES_1)
 amtrmlog_SOURCES = amtrmlog.c
 amtrmlog_OBJECTS = amtrmlog.$(OBJEXT)
 amtrmlog_LDADD = $(LDADD)
 amtrmlog_DEPENDENCIES = ../common-src/libamanda.la libamserver.la \
        ../device-src/libamdevice.la ../common-src/libamanda.la \
-       ../gnulib/libgnu.la $(am__DEPENDENCIES_1)
+       $(am__DEPENDENCIES_1)
 chunker_SOURCES = chunker.c
 chunker_OBJECTS = chunker.$(OBJEXT)
 chunker_LDADD = $(LDADD)
 chunker_DEPENDENCIES = ../common-src/libamanda.la libamserver.la \
        ../device-src/libamdevice.la ../common-src/libamanda.la \
-       ../gnulib/libgnu.la $(am__DEPENDENCIES_1)
+       $(am__DEPENDENCIES_1)
 am_diskfile_OBJECTS = diskfile.test.$(OBJEXT)
 diskfile_OBJECTS = $(am_diskfile_OBJECTS)
 diskfile_LDADD = $(LDADD)
 diskfile_DEPENDENCIES = ../common-src/libamanda.la libamserver.la \
        ../device-src/libamdevice.la ../common-src/libamanda.la \
-       ../gnulib/libgnu.la $(am__DEPENDENCIES_1)
+       $(am__DEPENDENCIES_1)
 driver_SOURCES = driver.c
 driver_OBJECTS = driver.$(OBJEXT)
 driver_LDADD = $(LDADD)
 driver_DEPENDENCIES = ../common-src/libamanda.la libamserver.la \
        ../device-src/libamdevice.la ../common-src/libamanda.la \
-       ../gnulib/libgnu.la $(am__DEPENDENCIES_1)
+       $(am__DEPENDENCIES_1)
 dumper_SOURCES = dumper.c
 dumper_OBJECTS = dumper.$(OBJEXT)
 dumper_LDADD = $(LDADD)
 dumper_DEPENDENCIES = ../common-src/libamanda.la libamserver.la \
        ../device-src/libamdevice.la ../common-src/libamanda.la \
-       ../gnulib/libgnu.la $(am__DEPENDENCIES_1)
+       $(am__DEPENDENCIES_1)
 am_infofile_OBJECTS = infofile.test.$(OBJEXT)
 infofile_OBJECTS = $(am_infofile_OBJECTS)
 infofile_LDADD = $(LDADD)
 infofile_DEPENDENCIES = ../common-src/libamanda.la libamserver.la \
        ../device-src/libamdevice.la ../common-src/libamanda.la \
-       ../gnulib/libgnu.la $(am__DEPENDENCIES_1)
+       $(am__DEPENDENCIES_1)
 planner_SOURCES = planner.c
 planner_OBJECTS = planner.$(OBJEXT)
 planner_LDADD = $(LDADD)
 planner_DEPENDENCIES = ../common-src/libamanda.la libamserver.la \
        ../device-src/libamdevice.la ../common-src/libamanda.la \
-       ../gnulib/libgnu.la $(am__DEPENDENCIES_1)
+       $(am__DEPENDENCIES_1)
 am_taper_OBJECTS = taper.$(OBJEXT) taper-source.$(OBJEXT) \
        taper-file-source.$(OBJEXT) taper-port-source.$(OBJEXT) \
        taper-disk-port-source.$(OBJEXT) \
@@ -440,7 +458,7 @@ taper_source_test_DEPENDENCIES = $(am__DEPENDENCIES_2) \
        ../amandad-src/libamandad.la
 sbinSCRIPT_INSTALL = $(INSTALL_SCRIPT)
 SCRIPTS = $(sbin_SCRIPTS)
-DEFAULT_INCLUDES = -I. -I$(top_builddir)/config@am__isrc@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/config
 depcomp = $(SHELL) $(top_srcdir)/config/depcomp
 am__depfiles_maybe = depfiles
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
@@ -453,22 +471,23 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
        --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
        $(LDFLAGS) -o $@
 SOURCES = $(libamserver_la_SOURCES) amadmin.c amcheck.c \
-       amcleanupdisk.c amflush.c $(amgetconf_SOURCES) \
-       $(amindexd_SOURCES) amlabel.c amlogroll.c $(amreport_SOURCES) \
-       amtape.c amtrmidx.c amtrmlog.c chunker.c $(diskfile_SOURCES) \
-       driver.c dumper.c $(infofile_SOURCES) planner.c \
-       $(taper_SOURCES) $(taper_source_test_SOURCES)
+       amcleanupdisk.c amflush.c $(amindexd_SOURCES) amlabel.c \
+       amlogroll.c $(amreport_SOURCES) amservice.c amtape.c \
+       amtrmidx.c amtrmlog.c chunker.c $(diskfile_SOURCES) driver.c \
+       dumper.c $(infofile_SOURCES) planner.c $(taper_SOURCES) \
+       $(taper_source_test_SOURCES)
 DIST_SOURCES = $(libamserver_la_SOURCES) amadmin.c amcheck.c \
-       amcleanupdisk.c amflush.c $(amgetconf_SOURCES) \
-       $(amindexd_SOURCES) amlabel.c amlogroll.c $(amreport_SOURCES) \
-       amtape.c amtrmidx.c amtrmlog.c chunker.c $(diskfile_SOURCES) \
-       driver.c dumper.c $(infofile_SOURCES) planner.c \
-       $(taper_SOURCES) $(taper_source_test_SOURCES)
+       amcleanupdisk.c amflush.c $(amindexd_SOURCES) amlabel.c \
+       amlogroll.c $(amreport_SOURCES) amservice.c amtape.c \
+       amtrmidx.c amtrmlog.c chunker.c $(diskfile_SOURCES) driver.c \
+       dumper.c $(infofile_SOURCES) planner.c $(taper_SOURCES) \
+       $(taper_source_test_SOURCES)
 HEADERS = $(noinst_HEADERS)
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
+AIX_BACKUP = @AIX_BACKUP@
 ALLOCA = @ALLOCA@
 ALLOCA_H = @ALLOCA_H@
 AMANDA_DBGDIR = @AMANDA_DBGDIR@
@@ -483,8 +502,10 @@ AMPLOT_CAT_GZIP = @AMPLOT_CAT_GZIP@
 AMPLOT_CAT_PACK = @AMPLOT_CAT_PACK@
 AMPLOT_COMPRESS = @AMPLOT_COMPRESS@
 AMTAR = @AMTAR@
+APPLICATION_DIR = @APPLICATION_DIR@
 AR = @AR@
 ARPA_INET_H = @ARPA_INET_H@
+ASSERTIONS = @ASSERTIONS@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
@@ -496,16 +517,28 @@ BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@
 BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@
 BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@
 BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@
+BSDTCP_SECURITY = @BSDTCP_SECURITY@
+BSDUDP_SECURITY = @BSDUDP_SECURITY@
+BSD_SECURITY = @BSD_SECURITY@
 CAT = @CAT@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
+CHECK_USERID = @CHECK_USERID@
 CHIO = @CHIO@
 CHS = @CHS@
+CLIENT_HOST_INSTANCE = @CLIENT_HOST_INSTANCE@
+CLIENT_HOST_KEY_FILE = @CLIENT_HOST_KEY_FILE@
+CLIENT_HOST_PRINCIPAL = @CLIENT_HOST_PRINCIPAL@
 CLIENT_LOGIN = @CLIENT_LOGIN@
 CLIENT_SCRIPTS_OPT = @CLIENT_SCRIPTS_OPT@
 COMPRESS = @COMPRESS@
+COMPRESS_BEST_OPT = @COMPRESS_BEST_OPT@
+COMPRESS_FAST_OPT = @COMPRESS_FAST_OPT@
+COMPRESS_PATH = @COMPRESS_PATH@
+COMPRESS_SUFFIX = @COMPRESS_SUFFIX@
+CONFIG_CLOBBER_MY_CONFIG = @CONFIG_CLOBBER_MY_CONFIG@
 CONFIG_DIR = @CONFIG_DIR@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
@@ -519,6 +552,7 @@ DD = @DD@
 DEFAULT_AMANDATES_FILE = @DEFAULT_AMANDATES_FILE@
 DEFAULT_CHANGER_DEVICE = @DEFAULT_CHANGER_DEVICE@
 DEFAULT_CONFIG = @DEFAULT_CONFIG@
+DEFAULT_MAILER = @DEFAULT_MAILER@
 DEFAULT_SERVER = @DEFAULT_SERVER@
 DEFAULT_TAPE_DEVICE = @DEFAULT_TAPE_DEVICE@
 DEFAULT_TAPE_SERVER = @DEFAULT_TAPE_SERVER@
@@ -526,7 +560,7 @@ DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DOC_BUILD_DATE = @DOC_BUILD_DATE@
 DUMP = @DUMP@
-DUMPER_DIR = @DUMPER_DIR@
+DUMP_RETURNS_1 = @DUMP_RETURNS_1@
 ECHO = @ECHO@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
@@ -539,6 +573,7 @@ F77 = @F77@
 FFLAGS = @FFLAGS@
 FLOAT_H = @FLOAT_H@
 GETCONF = @GETCONF@
+GETOPT_H = @GETOPT_H@
 GETTEXT = @GETTEXT@
 GLIB_CFLAGS = @GLIB_CFLAGS@
 GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
@@ -549,9 +584,12 @@ GMSGFMT_015 = @GMSGFMT_015@
 GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
 GNULIB_CHOWN = @GNULIB_CHOWN@
 GNULIB_DUP2 = @GNULIB_DUP2@
+GNULIB_ENVIRON = @GNULIB_ENVIRON@
 GNULIB_FCHDIR = @GNULIB_FCHDIR@
 GNULIB_FFLUSH = @GNULIB_FFLUSH@
+GNULIB_FOPEN = @GNULIB_FOPEN@
 GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
+GNULIB_FREOPEN = @GNULIB_FREOPEN@
 GNULIB_FSEEK = @GNULIB_FSEEK@
 GNULIB_FSEEKO = @GNULIB_FSEEKO@
 GNULIB_FTELL = @GNULIB_FTELL@
@@ -561,6 +599,7 @@ GNULIB_GETCWD = @GNULIB_GETCWD@
 GNULIB_GETDELIM = @GNULIB_GETDELIM@
 GNULIB_GETLINE = @GNULIB_GETLINE@
 GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
+GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@
 GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
 GNULIB_LCHOWN = @GNULIB_LCHOWN@
 GNULIB_LSEEK = @GNULIB_LSEEK@
@@ -585,8 +624,10 @@ GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
 GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
 GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
 GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
+GNULIB_PUTENV = @GNULIB_PUTENV@
 GNULIB_READLINK = @GNULIB_READLINK@
 GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@
+GNULIB_SETENV = @GNULIB_SETENV@
 GNULIB_SLEEP = @GNULIB_SLEEP@
 GNULIB_SNPRINTF = @GNULIB_SNPRINTF@
 GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@
@@ -595,11 +636,15 @@ GNULIB_STPNCPY = @GNULIB_STPNCPY@
 GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
 GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
 GNULIB_STRDUP = @GNULIB_STRDUP@
+GNULIB_STRERROR = @GNULIB_STRERROR@
 GNULIB_STRNDUP = @GNULIB_STRNDUP@
 GNULIB_STRNLEN = @GNULIB_STRNLEN@
 GNULIB_STRPBRK = @GNULIB_STRPBRK@
 GNULIB_STRSEP = @GNULIB_STRSEP@
+GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@
+GNULIB_STRSTR = @GNULIB_STRSTR@
 GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
+GNULIB_UNSETENV = @GNULIB_UNSETENV@
 GNULIB_VASPRINTF = @GNULIB_VASPRINTF@
 GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@
 GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
@@ -613,6 +658,7 @@ GOBJECT_QUERY = @GOBJECT_QUERY@
 GREP = @GREP@
 GZIP = @GZIP@
 HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@
+HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@
 HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@
 HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@
 HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
@@ -621,9 +667,10 @@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
 HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@
 HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
 HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
-HAVE_DECL_STRNCASECMP = @HAVE_DECL_STRNCASECMP@
+HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@
 HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
 HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
+HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@
 HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
 HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
 HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
@@ -631,7 +678,9 @@ HAVE_DUP2 = @HAVE_DUP2@
 HAVE_FSEEKO = @HAVE_FSEEKO@
 HAVE_FTELLO = @HAVE_FTELLO@
 HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
+HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
 HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
+HAVE_GZIP = @HAVE_GZIP@
 HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
 HAVE_IO_H = @HAVE_IO_H@
 HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
@@ -640,8 +689,10 @@ HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@
 HAVE_MEMPCPY = @HAVE_MEMPCPY@
 HAVE_MKDTEMP = @HAVE_MKDTEMP@
 HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@
+HAVE_OS_H = @HAVE_OS_H@
 HAVE_READLINK = @HAVE_READLINK@
 HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@
+HAVE_SETENV = @HAVE_SETENV@
 HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
 HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
 HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
@@ -649,7 +700,6 @@ HAVE_SLEEP = @HAVE_SLEEP@
 HAVE_STDINT_H = @HAVE_STDINT_H@
 HAVE_STPCPY = @HAVE_STPCPY@
 HAVE_STPNCPY = @HAVE_STPNCPY@
-HAVE_STRCASECMP = @HAVE_STRCASECMP@
 HAVE_STRCASESTR = @HAVE_STRCASESTR@
 HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
 HAVE_STRNDUP = @HAVE_STRNDUP@
@@ -658,10 +708,12 @@ HAVE_STRSEP = @HAVE_STRSEP@
 HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@
 HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
 HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
+HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
 HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
 HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
 HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
 HAVE_UNISTD_H = @HAVE_UNISTD_H@
+HAVE_UNSETENV = @HAVE_UNSETENV@
 HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
 HAVE_VASPRINTF = @HAVE_VASPRINTF@
 HAVE_VISIBILITY = @HAVE_VISIBILITY@
@@ -677,6 +729,8 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 INTLLIBS = @INTLLIBS@
 INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+KRB4_SECURITY = @KRB4_SECURITY@
+KRB5_SECURITY = @KRB5_SECURITY@
 LDFLAGS = @LDFLAGS@
 LEX = @LEX@
 LEXLIB = @LEXLIB@
@@ -693,6 +747,8 @@ LIBTHREAD = @LIBTHREAD@
 LIBTOOL = @LIBTOOL@
 LIBTOOL_DEPS = @LIBTOOL_DEPS@
 LN_S = @LN_S@
+LOCKING = @LOCKING@
+LOW_TCPPORTRANGE = @LOW_TCPPORTRANGE@
 LTLIBICONV = @LTLIBICONV@
 LTLIBINTL = @LTLIBINTL@
 LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
@@ -701,7 +757,6 @@ LTLIBPTH = @LTLIBPTH@
 LTLIBTHREAD = @LTLIBTHREAD@
 MAILER = @MAILER@
 MAKEINFO = @MAKEINFO@
-MAXTAPEBLOCKSIZE = @MAXTAPEBLOCKSIZE@
 MCUTIL = @MCUTIL@
 MKDIR_P = @MKDIR_P@
 MSGFMT = @MSGFMT@
@@ -737,26 +792,37 @@ PERL_INC = @PERL_INC@
 PKG_CONFIG = @PKG_CONFIG@
 POSUB = @POSUB@
 PRINT = @PRINT@
+PS = @PS@
+PS_ARGUMENT = @PS_ARGUMENT@
 PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
 RANLIB = @RANLIB@
 READLINE_LIBS = @READLINE_LIBS@
 REPLACE_CHOWN = @REPLACE_CHOWN@
 REPLACE_FCHDIR = @REPLACE_FCHDIR@
 REPLACE_FFLUSH = @REPLACE_FFLUSH@
+REPLACE_FOPEN = @REPLACE_FOPEN@
 REPLACE_FPRINTF = @REPLACE_FPRINTF@
+REPLACE_FREOPEN = @REPLACE_FREOPEN@
 REPLACE_FSEEK = @REPLACE_FSEEK@
 REPLACE_FSEEKO = @REPLACE_FSEEKO@
 REPLACE_FTELL = @REPLACE_FTELL@
 REPLACE_FTELLO = @REPLACE_FTELLO@
 REPLACE_GETCWD = @REPLACE_GETCWD@
 REPLACE_GETLINE = @REPLACE_GETLINE@
+REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
 REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
 REPLACE_LCHOWN = @REPLACE_LCHOWN@
 REPLACE_LSEEK = @REPLACE_LSEEK@
+REPLACE_MEMMEM = @REPLACE_MEMMEM@
 REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
 REPLACE_PRINTF = @REPLACE_PRINTF@
+REPLACE_PUTENV = @REPLACE_PUTENV@
 REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
 REPLACE_SPRINTF = @REPLACE_SPRINTF@
+REPLACE_STRCASESTR = @REPLACE_STRCASESTR@
+REPLACE_STRERROR = @REPLACE_STRERROR@
+REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@
+REPLACE_STRSTR = @REPLACE_STRSTR@
 REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
 REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
 REPLACE_VPRINTF = @REPLACE_VPRINTF@
@@ -764,7 +830,11 @@ REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
 REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
 REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
 RESTORE = @RESTORE@
+RSH_SECURITY = @RSH_SECURITY@
 SAMBA_CLIENT = @SAMBA_CLIENT@
+SERVER_HOST_INSTANCE = @SERVER_HOST_INSTANCE@
+SERVER_HOST_KEY_FILE = @SERVER_HOST_KEY_FILE@
+SERVER_HOST_PRINCIPAL = @SERVER_HOST_PRINCIPAL@
 SERVICE_SUFFIX = @SERVICE_SUFFIX@
 SETUID_GROUP = @SETUID_GROUP@
 SET_MAKE = @SET_MAKE@
@@ -774,6 +844,7 @@ SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
 SNAPSHOT_STAMP = @SNAPSHOT_STAMP@
 SORT = @SORT@
 SSH = @SSH@
+SSH_SECURITY = @SSH_SECURITY@
 STDBOOL_H = @STDBOOL_H@
 STDINT_H = @STDINT_H@
 STRIP = @STRIP@
@@ -783,7 +854,14 @@ SWIG_LIB = @SWIG_LIB@
 SYS_SOCKET_H = @SYS_SOCKET_H@
 SYS_STAT_H = @SYS_STAT_H@
 SYS_TIME_H = @SYS_TIME_H@
+TCPPORTRANGE = @TCPPORTRANGE@
+TICKET_LIFETIME = @TICKET_LIFETIME@
+UDPPORTRANGE = @UDPPORTRANGE@
+UNCOMPRESS_OPT = @UNCOMPRESS_OPT@
+UNCOMPRESS_PATH = @UNCOMPRESS_PATH@
+USE_AMANDAHOSTS = @USE_AMANDAHOSTS@
 USE_NLS = @USE_NLS@
+USE_RUNDUMP = @USE_RUNDUMP@
 USE_VERSION_SUFFIXES = @USE_VERSION_SUFFIXES@
 VDUMP = @VDUMP@
 VERSION = @VERSION@
@@ -792,6 +870,7 @@ VERSION_MAJOR = @VERSION_MAJOR@
 VERSION_MINOR = @VERSION_MINOR@
 VERSION_PATCH = @VERSION_PATCH@
 VERSION_SUFFIX = @VERSION_SUFFIX@
+VOID_UNSETENV = @VOID_UNSETENV@
 VRESTORE = @VRESTORE@
 VXDUMP = @VXDUMP@
 VXRESTORE = @VXRESTORE@
@@ -820,6 +899,7 @@ am__leading_dot = @am__leading_dot@
 am__quote = @am__quote@
 am__tar = @am__tar@
 am__untar = @am__untar@
+amdatadir = @amdatadir@
 amincludedir = @amincludedir@
 amlibdir = @amlibdir@
 amlibexecdir = @amlibexecdir@
@@ -838,6 +918,8 @@ dvidir = @dvidir@
 exec_prefix = @exec_prefix@
 gl_LIBOBJS = @gl_LIBOBJS@
 gl_LTLIBOBJS = @gl_LTLIBOBJS@
+gltests_LIBOBJS = @gltests_LIBOBJS@
+gltests_LTLIBOBJS = @gltests_LTLIBOBJS@
 host = @host@
 host_alias = @host_alias@
 host_cpu = @host_cpu@
@@ -867,6 +949,7 @@ target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 SUFFIXES = 
@@ -878,7 +961,8 @@ MOSTLYCLEANFILES =
 CLEANFILES = config.log *.test.c
 
 # and we'll need to clean up our generated files for distclean
-DISTCLEANFILES = $(SCRIPTS_SHELL) $(SCRIPTS_PERL) $(SCRIPTS_AWK)
+DISTCLEANFILES = $(SCRIPTS_SHELL) $(SCRIPTS_PERL) $(SCRIPTS_AWK) \
+       $(SCRIPTS_INCLUDE) $(am__append_1)
 MAINTAINERCLEANFILES = 
 
 # syntax-check shell scripts on 'make check'
@@ -887,6 +971,25 @@ CHECK_SHELL = $(SCRIPTS_SHELL)
 # sed expression to strip leading directories from a filename; this converts e.g.,
 # src/foo/bar.so to bar.so.
 strip_leading_dirs = s|^.*/||
+@WANT_INSTALLPERMS_FALSE@do_file = pa="$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
+@WANT_INSTALLPERMS_FALSE@    echo "installperm \"$$chown\" \"$$chmod\" \"$$pa\"" >> "$(installperms_sh)"
+
+
+# define a snippet of the scripts below to either perform a chown/chmod operation,
+# or record that operation in the logfile.  On entry to the snippet, $$dest is the
+# destination directory, $$cmd is the srcdir-relative pathname of the target file,
+# $$chown is the ownership, and $$chmod is the permission pattern.
+@WANT_INSTALLPERMS_TRUE@do_file = pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
+@WANT_INSTALLPERMS_TRUE@    if test -n "$$chown"; then \
+@WANT_INSTALLPERMS_TRUE@       echo chown "$$chown" "$$pa"; \
+@WANT_INSTALLPERMS_TRUE@       chown "$$chown" "$$pa" || exit 1; \
+@WANT_INSTALLPERMS_TRUE@    fi; \
+@WANT_INSTALLPERMS_TRUE@    if test -n "$$chmod"; then \
+@WANT_INSTALLPERMS_TRUE@       echo chmod "$$chmod" "$$pa"; \
+@WANT_INSTALLPERMS_TRUE@       chmod "$$chmod" "$$pa" || exit 1; \
+@WANT_INSTALLPERMS_TRUE@    fi 
+
+@WANT_INSTALLPERMS_FALSE@installperms_sh = "$(top_builddir)/installperms.sh"
 INCLUDES = -I$(top_builddir)/common-src \
                -I$(top_srcdir)/common-src   \
                -I$(top_srcdir)/restore-src  \
@@ -905,31 +1008,28 @@ CHECK_PERL = \
            amaddclient \
            amoverview \
            amserverconfig \
-           amstatus \
-           amtoc
-
-SCRIPTS_PERL = \
-           $(CHECK_PERL) \
+           amtoc \
            amdevcheck \
-           amcheckdump
+           amcheckdump \
+           amcleanup \
+           amvault \
+           amstatus
 
+SCRIPTS_PERL = $(CHECK_PERL)
 SCRIPTS_SHELL = \
            amcheckdb \
-           amcleanup \
            amdump \
-           amrmtape \
-           amverify \
-           amverifyrun
+           amrmtape
 
 sbin_SCRIPTS = $(SCRIPTS_PERL) $(SCRIPTS_SHELL)
 INSTALLPERMS_exec = \
        dest=$(sbindir) chown=amanda chmod= \
                $(sbin_PROGRAMS) \
-       chown=root chmod=u+s,o-rwx \
-               amcheck \
+       chown=root chmod=04750 \
+               amcheck amservice \
        dest=$(amlibexecdir) chown=amanda chmod= \
                $(amlibexec_PROGRAMS) \
-       chown=root chmod=u+s,o-rwx \
+       chown=root chmod=04750 \
                dumper planner
 
 INSTALLPERMS_data = \
@@ -949,7 +1049,6 @@ LDADD = ../common-src/libamanda.la   \
        libamserver.la               \
        ../device-src/libamdevice.la     \
        ../common-src/libamanda.la   \
-       ../gnulib/libgnu.la          \
         $(READLINE_LIBS)
 
 libamserver_la_SOURCES = amindex.c     changer.c                       \
@@ -991,7 +1090,6 @@ TEST_PROGS = diskfile infofile
 amindexd_CSRC = amindexd.c     disk_history.c  list_dir.c
 amindexd_SOURCES = disk_history.h      list_dir.h      $(amindexd_CSRC)
 amreport_SOURCES = reporter.c
-amgetconf_SOURCES = getconf.c
 noinst_HEADERS = amindex.h     changer.h       cmdline.h       \
                        diskfile.h      driverio.h      \
                        holding.h       infofile.h      logfile.h       \
@@ -1042,8 +1140,8 @@ install-amlibLTLIBRARIES: $(amlib_LTLIBRARIES)
        @list='$(amlib_LTLIBRARIES)'; for p in $$list; do \
          if test -f $$p; then \
            f=$(am__strip_dir) \
-           echo " $(LIBTOOL) --mode=install $(amlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(amlibdir)/$$f'"; \
-           $(LIBTOOL) --mode=install $(amlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(amlibdir)/$$f"; \
+           echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(amlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(amlibdir)/$$f'"; \
+           $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(amlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(amlibdir)/$$f"; \
          else :; fi; \
        done
 
@@ -1051,8 +1149,8 @@ uninstall-amlibLTLIBRARIES:
        @$(NORMAL_UNINSTALL)
        @list='$(amlib_LTLIBRARIES)'; for p in $$list; do \
          p=$(am__strip_dir) \
-         echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(amlibdir)/$$p'"; \
-         $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(amlibdir)/$$p"; \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(amlibdir)/$$p'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(amlibdir)/$$p"; \
        done
 
 clean-amlibLTLIBRARIES:
@@ -1074,8 +1172,8 @@ install-amlibexecPROGRAMS: $(amlibexec_PROGRAMS)
             || test -f $$p1 \
          ; then \
            f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
-          echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(amlibexecPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(amlibexecdir)/$$f'"; \
-          $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(amlibexecPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(amlibexecdir)/$$f" || exit 1; \
+          echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(amlibexecPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(amlibexecdir)/$$f'"; \
+          $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(amlibexecPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(amlibexecdir)/$$f" || exit 1; \
          else :; fi; \
        done
 
@@ -1109,8 +1207,8 @@ install-sbinPROGRAMS: $(sbin_PROGRAMS)
             || test -f $$p1 \
          ; then \
            f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
-          echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \
-          $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(sbindir)/$$f" || exit 1; \
+          echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \
+          $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(sbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(sbindir)/$$f" || exit 1; \
          else :; fi; \
        done
 
@@ -1140,9 +1238,6 @@ amcleanupdisk$(EXEEXT): $(amcleanupdisk_OBJECTS) $(amcleanupdisk_DEPENDENCIES)
 amflush$(EXEEXT): $(amflush_OBJECTS) $(amflush_DEPENDENCIES) 
        @rm -f amflush$(EXEEXT)
        $(LINK) $(amflush_OBJECTS) $(amflush_LDADD) $(LIBS)
-amgetconf$(EXEEXT): $(amgetconf_OBJECTS) $(amgetconf_DEPENDENCIES) 
-       @rm -f amgetconf$(EXEEXT)
-       $(LINK) $(amgetconf_OBJECTS) $(amgetconf_LDADD) $(LIBS)
 amindexd$(EXEEXT): $(amindexd_OBJECTS) $(amindexd_DEPENDENCIES) 
        @rm -f amindexd$(EXEEXT)
        $(LINK) $(amindexd_OBJECTS) $(amindexd_LDADD) $(LIBS)
@@ -1155,6 +1250,9 @@ amlogroll$(EXEEXT): $(amlogroll_OBJECTS) $(amlogroll_DEPENDENCIES)
 amreport$(EXEEXT): $(amreport_OBJECTS) $(amreport_DEPENDENCIES) 
        @rm -f amreport$(EXEEXT)
        $(LINK) $(amreport_OBJECTS) $(amreport_LDADD) $(LIBS)
+amservice$(EXEEXT): $(amservice_OBJECTS) $(amservice_DEPENDENCIES) 
+       @rm -f amservice$(EXEEXT)
+       $(LINK) $(amservice_OBJECTS) $(amservice_LDADD) $(LIBS)
 amtape$(EXEEXT): $(amtape_OBJECTS) $(amtape_DEPENDENCIES) 
        @rm -f amtape$(EXEEXT)
        $(LINK) $(amtape_OBJECTS) $(amtape_LDADD) $(LIBS)
@@ -1222,6 +1320,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amindexd.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amlabel.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amlogroll.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amservice.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amtape.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amtrmidx.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amtrmlog.Po@am__quote@
@@ -1235,7 +1334,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/driverio.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dumper.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/find.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getconf.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/holding.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/infofile.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/infofile.test.Po@am__quote@
@@ -1286,8 +1384,8 @@ ID: $(HEADERS) $(SOURCES) $(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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
        mkid -fID $$unique
 tags: TAGS
 
@@ -1299,8 +1397,8 @@ TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
        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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { 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) \
@@ -1310,13 +1408,12 @@ ctags: CTAGS
 CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
                $(TAGS_FILES) $(LISP)
        tags=; \
-       here=`pwd`; \
        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; }'`; \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
        test -z "$(CTAGS_ARGS)$$tags$$unique" \
          || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
             $$tags $$unique
@@ -1397,8 +1494,6 @@ maintainer-clean-generic:
        @echo "it deletes files that may require special tools to rebuild."
        -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
        -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-@WANT_INSTALLPERMS_FALSE@install-exec-hook:
-@WANT_INSTALLPERMS_FALSE@install-data-hook:
 clean: clean-am
 
 clean-am: clean-amlibLTLIBRARIES clean-amlibexecPROGRAMS clean-generic \
@@ -1442,7 +1537,7 @@ install-pdf: install-pdf-am
 
 install-ps: install-ps-am
 
-installcheck-am:
+installcheck-am: installcheck-local
 
 maintainer-clean: maintainer-clean-am
        -rm -rf ./$(DEPDIR)
@@ -1479,18 +1574,24 @@ uninstall-am: uninstall-amlibLTLIBRARIES uninstall-amlibexecPROGRAMS \
        install-html install-html-am install-info install-info-am \
        install-man install-pdf install-pdf-am install-ps \
        install-ps-am install-sbinPROGRAMS install-sbinSCRIPTS \
-       install-strip installcheck installcheck-am installdirs \
-       maintainer-clean maintainer-clean-generic mostlyclean \
-       mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
-       pdf pdf-am ps ps-am tags uninstall uninstall-am \
-       uninstall-amlibLTLIBRARIES uninstall-amlibexecPROGRAMS \
-       uninstall-sbinPROGRAMS uninstall-sbinSCRIPTS
+       install-strip installcheck installcheck-am installcheck-local \
+       installdirs maintainer-clean maintainer-clean-generic \
+       mostlyclean mostlyclean-compile mostlyclean-generic \
+       mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+       uninstall-am uninstall-amlibLTLIBRARIES \
+       uninstall-amlibexecPROGRAMS uninstall-sbinPROGRAMS \
+       uninstall-sbinSCRIPTS
 
 
 # Perl
 %: %.pl $(top_builddir)/config.status
        $(top_builddir)/config.status --file=$@:$<
        chmod a+x $@
+       @if test -f $(top_builddir)/perl/.libs/libCmdline.so -o -f $(top_builddir)/perl/libCmdline.so; then \
+               grep -v '^use lib' $@ > $@.nouselib; \
+               $(PERL) $(CHECK_PERL_FLAGS) -I$(top_builddir)/perl -I$(top_builddir)/perl/.libs -I$(top_srcdir)/perl -c -w -T $@.nouselib || exit 1; \
+               rm $@.nouselib; \
+       fi
 
 %.pl: %.pl.in $(top_builddir)/config.status
        $(top_builddir)/config.status --file=$@:$<
@@ -1516,13 +1617,27 @@ uninstall-am: uninstall-amlibLTLIBRARIES uninstall-amlibexecPROGRAMS \
 
 # syntax-check perl scripts on 'make check'
 check-perl: $(CHECK_PERL)
+       @CHECK_PERL="$(CHECK_PERL)"; \
+       if test -f $(top_builddir)/perl/.libs/libCmdline.so -o -f $(top_builddir)/perl/libCmdline.so; then \
+               if test -n "$(PERL)"; then \
+                       for perlobj in $$CHECK_PERL; do \
+                               grep -v '^use lib' $$perlobj > $$perlobj.nouselib; \
+                               $(PERL) $(CHECK_PERL_FLAGS) -I$(top_builddir)/perl -I$(top_builddir)/perl/.libs -I$(top_srcdir)/perl -c -w -T $$perlobj.nouselib || exit 1; \
+                               rm $$perlobj.nouselib; \
+                       done; \
+               fi \
+       fi
+check-local: check-perl
+
+# syntax-check perl scripts on 'make installcheck'
+installcheck-perl: $(CHECK_PERL)
        @CHECK_PERL="$(CHECK_PERL)"; \
        if test -n "$(PERL)"; then \
                for perlobj in $$CHECK_PERL; do \
                        $(PERL) $(CHECK_PERL_FLAGS) -c -w -T $$perlobj || exit 1; \
                done; \
        fi
-check-local: check-perl
+installcheck-local: installcheck-perl
 check-shell: $(CHECK_SHELL)
        @CHECK_SHELL="$(CHECK_SHELL)"; \
        if test -n "$$CHECK_SHELL"; then \
@@ -1560,52 +1675,40 @@ dist-scripts:
        true
 dist-hook: dist-scripts
 
-@WANT_INSTALLPERMS_TRUE@installperms-exec:
-@WANT_INSTALLPERMS_TRUE@       @installperms="$(INSTALLPERMS_exec)"; \
-@WANT_INSTALLPERMS_TRUE@       test -n "$$installperms" && echo "Setting installation permissions on executables"; \
-@WANT_INSTALLPERMS_TRUE@       dest=; chown=; chmod=; \
-@WANT_INSTALLPERMS_TRUE@       for cmd in $$installperms; do \
-@WANT_INSTALLPERMS_TRUE@           case "$$cmd" in \
-@WANT_INSTALLPERMS_TRUE@               chown=amanda) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
-@WANT_INSTALLPERMS_TRUE@               dest=*|chown=*|chmod=*) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; eval $$cmd;; \
-@WANT_INSTALLPERMS_TRUE@               *)  pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chown"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chown "$$chown" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chown "$$chown" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chmod"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chmod "$$chmod" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chmod "$$chmod" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@           esac; \
-@WANT_INSTALLPERMS_TRUE@       done
-
-@WANT_INSTALLPERMS_TRUE@installperms-data:
-@WANT_INSTALLPERMS_TRUE@       @installperms="$(INSTALLPERMS_data)"; \
-@WANT_INSTALLPERMS_TRUE@       test -n "$$installperms" && echo "Setting installation permissions on data"; \
-@WANT_INSTALLPERMS_TRUE@       dest=; chown=; chmod=; \
-@WANT_INSTALLPERMS_TRUE@       for cmd in $$installperms; do \
-@WANT_INSTALLPERMS_TRUE@           case "$$cmd" in \
-@WANT_INSTALLPERMS_TRUE@               chown=amanda) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
-@WANT_INSTALLPERMS_TRUE@               dest=*|chown=*|chmod=*) \
-@WANT_INSTALLPERMS_TRUE@                       echo "  ($$cmd)"; eval $$cmd;; \
-@WANT_INSTALLPERMS_TRUE@               *)  pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chown"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chown "$$chown" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chown "$$chown" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@                   if test -n "$$chmod"; then \
-@WANT_INSTALLPERMS_TRUE@                       echo chmod "$$chmod" "$$pa"; \
-@WANT_INSTALLPERMS_TRUE@                       chmod "$$chmod" "$$pa" || exit 1; \
-@WANT_INSTALLPERMS_TRUE@                   fi; \
-@WANT_INSTALLPERMS_TRUE@           esac; \
-@WANT_INSTALLPERMS_TRUE@       done
-
-@WANT_INSTALLPERMS_TRUE@install-exec-hook: installperms-exec
-@WANT_INSTALLPERMS_TRUE@install-data-hook: installperms-data
+installperms-exec:
+       @installperms="$(INSTALLPERMS_exec)"; \
+       test -n "$$installperms" && echo "Setting installation permissions on executables"; \
+       dest=; chown=; chmod=; \
+       for cmd in $$installperms; do \
+           case "$$cmd" in \
+               chown=amanda) \
+                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
+               dest=*|chown=*|chmod=*) \
+                       echo "  ($$cmd)"; eval $$cmd;; \
+               *) $(do_file) ;; \
+           esac; \
+       done
+
+installperms-data:
+       @installperms="$(INSTALLPERMS_data)"; \
+       dest=; chown=; chmod=; \
+       for cmd in $$installperms; do \
+           case "$$cmd" in \
+               chown=amanda) \
+                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
+               dest=*|chown=*|chmod=*) \
+                       echo "  ($$cmd)"; eval $$cmd;; \
+               *)  $(do_file) ;; \
+           esac; \
+       done
+
+install-exec-hook: installperms-exec
+install-data-hook: installperms-data
+
+# define a rule to initialize the installperms manifest file
+@WANT_INSTALLPERMS_TRUE@installperms-init:
+@WANT_INSTALLPERMS_FALSE@installperms-init:
+@WANT_INSTALLPERMS_FALSE@      rm -f "$(installperms_sh)"
 
 # A rule to make precompiler output from C files.  This is not used during
 # ordinary builds, but but can very useful in debugging problems on strange
@@ -1619,20 +1722,17 @@ dist-hook: dist-scripts
 
 lint:
        @ for p in $(amlibexec_PROGRAMS) $(sbin_PROGRAMS); do                   \
+               p=`basename $$p $(EXEEXT)`;                                     \
                if [ $$p = "amindexd" ]; then                                   \
                        s="$(amindexd_CSRC)";                                   \
                elif [ $$p = "amreport" ]; then                                 \
                        s="$(amreport_SOURCES)";                                \
-               elif [ $$p = "amgetconf" ]; then                                \
-                       s="$(getconf_SOURCES)";                                 \
                else                                                            \
                        s=$$p.c;                                                \
                fi;                                                             \
                f="$$s $(libamserver_la_SOURCES)";                              \
                (cd ../common-src; make listlibsrc);                            \
                f="$$f "`cat ../common-src/listlibsrc.output`;                  \
-               (cd ../tape-src; make listlibsrc);                              \
-               f="$$f "`cat ../tape-src/listlibsrc.output`;                    \
                echo $(LINT) $$f;                                               \
                $(LINT) $(LINTFLAGS) $(CPPFLAGS) $(DEFS) -I. -I$(top_builddir)/config   \
                    $(INCLUDES) $$f;                                            \
index 510b0e6246f2d2e138141bbfa0f91b64b4c884ac..3e52466ed779d1a8d4d6d937faba9634fda624fb 100755 (executable)
@@ -1,6 +1,6 @@
 #!@PERL@
 #
-# Copyright (c) 2006 Zmanda Inc.  All Rights Reserved.
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License version 2 as published
@@ -15,8 +15,8 @@
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 #
-# Contact information: Zmanda Inc, 505 N Mathlida Ave, Suite 120
-# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 #
 
 
@@ -476,7 +476,7 @@ if ( $exit_value !=0 ) {
 }
 
 #create gnutar_list_dir
-if ( defined $tarlist && !defined $no_update_client ) {
+if ( defined $tarlist && !defined $no_client_update ) {
  system "$ssh", "$ssh_opt", "$amanda_user\@$client", "$mkdir", "$gnutar_list_dir";
  $exit_value  = $? >> 8;
 if ( $exit_value !=0 ) {
index 9acacbc87238be1ea4347959a36025cb4b687be4..b7069b4c9b2cfacdc6988e606da832d0a8baac68 100644 (file)
@@ -172,20 +172,24 @@ main(
        goto done;
     }
 
-    config_init(CONFIG_INIT_EXPLICIT_NAME | CONFIG_INIT_FATAL, argv[1]);
+    config_init(CONFIG_INIT_EXPLICIT_NAME, argv[1]);
     apply_config_overwrites(cfg_ovr);
 
-    dbrename(config_name, DBG_SUBDIR_SERVER);
-
-    check_running_as(RUNNING_AS_DUMPUSER);
-
     conf_diskfile = config_dir_relative(getconf_str(CNF_DISKFILE));
-    if (read_diskfile(conf_diskfile, &diskq) < 0) {
-       error(_("could not load disklist \"%s\""), conf_diskfile);
-       /*NOTREACHED*/
-    }
+    read_diskfile(conf_diskfile, &diskq);
     amfree(conf_diskfile);
 
+    if (config_errors(NULL) >= CFGERR_WARNINGS) {
+       config_print_errors();
+       if (config_errors(NULL) >= CFGERR_ERRORS) {
+           g_critical(_("errors processing config file"));
+       }
+    }
+
+    dbrename(get_config_name(), DBG_SUBDIR_SERVER);
+
+    check_running_as(RUNNING_AS_DUMPUSER);
+
     conf_tapelist = config_dir_relative(getconf_str(CNF_TAPELIST));
     if(read_tapelist(conf_tapelist)) {
        error(_("could not load tapelist \"%s\""), conf_tapelist);
@@ -1036,7 +1040,7 @@ find(
 
     if(argc < 3) {
        g_fprintf(stderr,
-               _("%s: expecting \"find [--sort <hkdlpbf>] [hostname [<disk>]]*\"\n"),
+               _("%s: expecting \"find [--sort <hkdlpbfw>] [hostname [<disk>]]*\"\n"),
                get_pname());
        usage();
     }
@@ -1062,6 +1066,8 @@ find(
            case 'P':
            case 'b':
            case 'B':
+           case 'w':
+           case 'W':
                    break;
            default: valid_sort=0;
            }
@@ -1228,14 +1234,16 @@ remove_holding_file_from_catalog(
     }
 
     if (get_info(file.name, file.disk, &info) == -1) {
-           g_printf(_("WARNING: No curinfo record for %s:%s\n"), file.name, file.disk);
-           return 1; /* not an error */
+       g_printf(_("WARNING: No curinfo record for %s:%s\n"), file.name, file.disk);
+       dumpfile_free_data(&file);
+       return 1; /* not an error */
     }
 
     matching_hist_idx = holding_file_find_history(&info, &file);
 
     if (matching_hist_idx == -1) {
         g_printf(_("WARNING: No dump matching %s found in curinfo.\n"), filename);
+       dumpfile_free_data(&file);
        return 1; /* not an error */
     }
 
@@ -1243,7 +1251,7 @@ remove_holding_file_from_catalog(
     matching_hist = info.history[matching_hist_idx];
 
     /* Remove the history element itself before doing the stats */
-    for (i = matching_hist_idx; i <= NB_HISTORY; i++) {
+    for (i = matching_hist_idx; i < NB_HISTORY; i++) {
         info.history[i] = info.history[i+1];
     }
     info.history[NB_HISTORY].level = -1;
@@ -1317,10 +1325,12 @@ remove_holding_file_from_catalog(
 
     /* write out the changes */
     if (put_info(file.name, file.disk, &info) == -1) {
-           g_printf(_("Could not write curinfo record for %s:%s\n"), file.name, file.disk);
-           return 0;
+       g_printf(_("Could not write curinfo record for %s:%s\n"), file.name, file.disk);
+       dumpfile_free_data(&file);
+       return 0;
     }
 
+    dumpfile_free_data(&file);
     return 1;
 }
 
@@ -1402,6 +1412,7 @@ holding(
                    }
                }
                 amfree(dumpstr);
+               dumpfile_free_data(&file);
             }
             g_slist_free_full(file_list);
             break;
@@ -1978,6 +1989,7 @@ disklist_one(
     am_host_t *hp;
     netif_t *ip;
     sle_t *excl;
+    pp_scriptlist_t pp_scriptlist;
 
     hp = dp->host;
     ip = hp->netif;
@@ -1988,17 +2000,19 @@ disklist_one(
     g_printf("        interface %s\n",
           interface_name(ip->config)[0] ? interface_name(ip->config) : "default");
     g_printf("    disk %s:\n", dp->name);
-    if(dp->device) g_printf("        device %s\n", dp->device);
+    if (dp->device) g_printf("        device %s\n", dp->device);
 
     g_printf("        program \"%s\"\n", dp->program);
-    if(dp->exclude_file != NULL && dp->exclude_file->nb_element > 0) {
+    if (dp->application)
+       g_printf("        application \"%s\"\n", application_name(dp->application));
+    if (dp->exclude_file != NULL && dp->exclude_file->nb_element > 0) {
        g_printf("        exclude file");
        for(excl = dp->exclude_file->first; excl != NULL; excl = excl->next) {
            g_printf(" \"%s\"", excl->name);
        }
        g_printf("\n");
     }
-    if(dp->exclude_list != NULL && dp->exclude_list->nb_element > 0) {
+    if (dp->exclude_list != NULL && dp->exclude_list->nb_element > 0) {
        g_printf("        exclude list");
        if(dp->exclude_optional) g_printf(" optional");
        for(excl = dp->exclude_list->first; excl != NULL; excl = excl->next) {
@@ -2006,16 +2020,16 @@ disklist_one(
        }
        g_printf("\n");
     }
-    if(dp->include_file != NULL && dp->include_file->nb_element > 0) {
+    if (dp->include_file != NULL && dp->include_file->nb_element > 0) {
        g_printf("        include file");
        for(excl = dp->include_file->first; excl != NULL; excl = excl->next) {
            g_printf(" \"%s\"", excl->name);
        }
        g_printf("\n");
     }
-    if(dp->include_list != NULL && dp->include_list->nb_element > 0) {
+    if (dp->include_list != NULL && dp->include_list->nb_element > 0) {
        g_printf("        include list");
-       if(dp->include_optional) g_printf(" optional");
+       if (dp->include_optional) g_printf(" optional");
        for(excl = dp->include_list->first; excl != NULL; excl = excl->next) {
            g_printf(" \"%s\"", excl->name);
        }
@@ -2025,7 +2039,7 @@ disklist_one(
     g_printf("        dumpcycle %d\n", dp->dumpcycle);
     g_printf("        maxdumps %d\n", dp->maxdumps);
     g_printf("        maxpromoteday %d\n", dp->maxpromoteday);
-    if(dp->bumppercent > 0) {
+    if (dp->bumppercent > 0) {
        g_printf("        bumppercent %d\n", dp->bumppercent);
     }
     else {
@@ -2142,6 +2156,25 @@ disklist_one(
     g_printf("        skip-incr %s\n", (dp->skip_incr? "YES" : "NO"));
     g_printf("        skip-full %s\n", (dp->skip_full? "YES" : "NO"));
     g_printf("        spindle %d\n", dp->spindle);
+    pp_scriptlist = dp->pp_scriptlist;
+    while (pp_scriptlist != NULL) {
+       g_printf("        script \"%s\"\n", (pp_script_name(pp_scriptlist->data)));
+       pp_scriptlist = pp_scriptlist->next;
+    }
+
+    {
+       dumptype_t *dtype;
+       char **prop, **p1;;
+
+       dtype = lookup_dumptype(dp->dtype_name);
+       prop = val_t_display_strs(dumptype_getconf((dtype), DUMPTYPE_PROPERTY),
+                                 0);
+       for(p1 = prop; *p1 != NULL; p1++) {
+           g_printf("        property %s\n", *p1);
+           free(*p1);
+       }
+       amfree(prop);
+    }
 
     g_printf("\n");
 }
index fdbd8cfb74f3729e52106196edc1223b03c91fbd..533a044013a072eb6efaf47b12e34cd6d3a67c53 100644 (file)
@@ -42,7 +42,6 @@
 #include "clock.h"
 #include "version.h"
 #include "amindex.h"
-#include "token.h"
 #include "taperscan.h"
 #include "server_util.h"
 #include "pipespawn.h"
@@ -50,6 +49,8 @@
 #include "device.h"
 #include "property.h"
 #include "timestamp.h"
+#include "amxml.h"
+#include "physmem.h"
 
 #define BUFFER_SIZE    32768
 
@@ -94,7 +95,7 @@ main(
     int do_localchk, do_tapechk, server_probs;
     pid_t clientchk_pid, serverchk_pid;
     int opt, tempfd, mainfd;
-    ssize_t size;
+    size_t size;
     amwait_t retstat;
     pid_t pid;
     extern int optind;
@@ -109,6 +110,7 @@ main(
     uid_t uid_me;
     char *errstr;
     config_overwrites_t *cfg_ovr;
+    char *mailer;
 
     /*
      * Configure program for internationalization:
@@ -154,32 +156,22 @@ main(
     cfg_ovr = new_config_overwrites(argc/2);
     while((opt = getopt(argc, argv, "M:mawsclto:")) != EOF) {
        switch(opt) {
-       case 'M':       mailto=stralloc(optarg);
+       case 'M':       if (mailto) {
+                           g_printf(_("Multiple -M options\n"));
+                           exit(1);
+                       }
+                       mailto=stralloc(optarg);
                        if(!validate_mailto(mailto)){
                           g_printf(_("Invalid characters in mail address\n"));
                           exit(1);
                        }
                        /*FALLTHROUGH*/
        case 'm':       
-#ifdef MAILER
                        mailout = 1;
-#else
-                       g_printf(_("You can't use -%c because configure didn't "
-                                "find a mailer./usr/bin/mail not found\n"),
-                               opt);
-                       exit(1);
-#endif
                        break;
        case 'a':       
-#ifdef MAILER
                        mailout = 1;
                        alwaysmail = 1;
-#else
-                       g_printf(_("You can't use -%c because configure didn't "
-                                "find a mailer./usr/bin/mail not found\n"),
-                               opt);
-                       exit(1);
-#endif
                        break;
        case 's':       do_localchk = do_tapechk = 1;
                        break;
@@ -210,11 +202,30 @@ main(
     if(overwrite)
        do_tapechk = 1;
 
-    config_init(CONFIG_INIT_EXPLICIT_NAME|CONFIG_INIT_FATAL,
-               argv[0]);
+    config_init(CONFIG_INIT_EXPLICIT_NAME, argv[0]);
     apply_config_overwrites(cfg_ovr);
-    dbrename(config_name, DBG_SUBDIR_SERVER);
+    dbrename(get_config_name(), DBG_SUBDIR_SERVER);
 
+    conf_diskfile = config_dir_relative(getconf_str(CNF_DISKFILE));
+    read_diskfile(conf_diskfile, &origq);
+    amfree(conf_diskfile);
+
+    if (config_errors(NULL) >= CFGERR_WARNINGS) {
+       config_print_errors();
+       if (config_errors(NULL) >= CFGERR_ERRORS) {
+           g_critical(_("errors processing config file"));
+       }
+    }
+
+    mailer = getconf_str(CNF_MAILER);
+    if ((!mailer || *mailer == '\0') && mailout == 1) {
+       if (alwaysmail == 1) {
+           g_printf(_("You can't use -a because a mailer is not defined\n"));
+       } else {
+           g_printf(_("You can't use -m because a mailer is not defined\n"));
+       }
+       exit(1);
+    }
     if(mailout && !mailto && 
        (getconf_seen(CNF_MAILTO)==0 || strlen(getconf_str(CNF_MAILTO)) == 0)) {
        g_printf(_("\nWARNING:No mail address configured in  amanda.conf.\n"));
@@ -248,17 +259,11 @@ main(
 
     conf_ctimeout = (time_t)getconf_int(CNF_CTIMEOUT);
 
-    conf_diskfile = config_dir_relative(getconf_str(CNF_DISKFILE));
-    if(read_diskfile(conf_diskfile, &origq) < 0) {
-       error(_("could not load disklist %s. Make sure it exists and has correct permissions"), conf_diskfile);
-       /*NOTREACHED*/
-    }
     errstr = match_disklist(&origq, argc-1, argv+1);
     if (errstr) {
        g_printf(_("%s"),errstr);
        amfree(errstr);
     }
-    amfree(conf_diskfile);
 
     /*
      * Make sure we are running as the dump user.  Don't use
@@ -352,7 +357,7 @@ main(
            char *wait_msg = NULL;
 
            wait_msg = vstrallocf(_("parent: reaped bogus pid %ld\n"), (long)pid);
-           if (fullwrite(mainfd, wait_msg, strlen(wait_msg)) < 0) {
+           if (full_write(mainfd, wait_msg, strlen(wait_msg)) < strlen(wait_msg)) {
                error(_("write main file: %s"), strerror(errno));
                /*NOTREACHED*/
            }
@@ -368,13 +373,13 @@ main(
            /*NOTREACHED*/
        }
 
-       while((size = fullread(tempfd, buffer, SIZEOF(buffer))) > 0) {
-           if (fullwrite(mainfd, buffer, (size_t)size) < 0) {
+       while((size = full_read(tempfd, buffer, SIZEOF(buffer))) > 0) {
+           if (full_write(mainfd, buffer, size) < size) {
                error(_("write main file: %s"), strerror(errno));
                /*NOTREACHED*/
            }
        }
-       if(size < 0) {
+       if(errno != 0) {
            error(_("read temp file: %s"), strerror(errno));
            /*NOTREACHED*/
        }
@@ -382,7 +387,7 @@ main(
     }
 
     version_string = vstrallocf(_("\n(brought to you by Amanda %s)\n"), version());
-    if (fullwrite(mainfd, version_string, strlen(version_string)) < 0) {
+    if (full_write(mainfd, version_string, strlen(version_string)) < strlen(version_string)) {
        error(_("write main file: %s"), strerror(errno));
        /*NOTREACHED*/
     }
@@ -392,9 +397,6 @@ main(
     our_features = NULL;
 
     /* send mail if requested, but only if there were problems */
-#ifdef MAILER
-
-#define        MAILTO_LIMIT    10
 
     if((server_probs || client_probs || alwaysmail) && mailout) {
        int mailfd;
@@ -402,10 +404,11 @@ main(
        int errfd;
        FILE *ferr;
        char *subject;
-       char **a;
+       char **a, **b;
+       GPtrArray *pipeargs;
        amwait_t retstat;
-       ssize_t r;
-       ssize_t w;
+       size_t r;
+       size_t w;
        char *err = NULL;
        char *extra_info = NULL;
        char *line = NULL;
@@ -424,35 +427,38 @@ main(
                        _("%s AMANDA PROBLEM: FIX BEFORE RUN, IF POSSIBLE"),
                        getconf_str(CNF_ORG));
        }
-       /*
-        * Variable arg lists are hard to deal with when we do not know
-        * ourself how many args are involved.  Split the address list
-        * and hope there are not more than 9 entries.
-        *
-        * Remember that split() returns the original input string in
-        * argv[0], so we have to skip over that.
-        */
-       a = (char **) alloc((MAILTO_LIMIT + 1) * SIZEOF(char *));
-       memset(a, 0, (MAILTO_LIMIT + 1) * SIZEOF(char *));
        if(mailto) {
-           a[1] = mailto;
+           a = (char **) g_new0(char *, 2);
+           a[1] = stralloc(mailto);
            a[2] = NULL;
        } else {
-           r = (ssize_t)split(getconf_str(CNF_MAILTO), a, MAILTO_LIMIT, " ");
-           a[r + 1] = NULL;
+           /* (note that validate_mailto doesn't allow any quotes, so this
+            * is really just splitting regular old strings) */
+           a = split_quoted_strings(getconf_str(CNF_MAILTO));
        }
        if((nullfd = open("/dev/null", O_RDWR)) < 0) {
            error("nullfd: /dev/null: %s", strerror(errno));
            /*NOTREACHED*/
        }
-       pipespawn(MAILER, STDIN_PIPE | STDERR_PIPE,
-                           &mailfd, &nullfd, &errfd,
-                           MAILER,
-                           "-s", subject,
-                                 a[1], a[2], a[3], a[4],
-                           a[5], a[6], a[7], a[8], a[9],
-                           NULL);
+
+       /* assemble the command line for the mailer */
+       pipeargs = g_ptr_array_sized_new(4);
+       g_ptr_array_add(pipeargs, mailer);
+       g_ptr_array_add(pipeargs, "-s");
+       g_ptr_array_add(pipeargs, subject);
+       for (b = a; *b; b++)
+           g_ptr_array_add(pipeargs, *b);
+       g_ptr_array_add(pipeargs, NULL);
+
+       pipespawnv(mailer, STDIN_PIPE | STDERR_PIPE, 0,
+                  &mailfd, &nullfd, &errfd,
+                  (char **)pipeargs->pdata);
+
+       g_ptr_array_free(pipeargs, FALSE);
        amfree(subject);
+       amfree(mailto);
+       g_strfreev(a);
+
        /*
         * There is the potential for a deadlock here since we are writing
         * to the process and then reading stderr, but in the normal case,
@@ -460,12 +466,12 @@ main(
         * cases, the pipe will break and we will exit out of the loop.
         */
        signal(SIGPIPE, SIG_IGN);
-       while((r = fullread(mainfd, buffer, SIZEOF(buffer))) > 0) {
-           if((w = fullwrite(mailfd, buffer, (size_t)r)) != (ssize_t)r) {
-               if(w < 0 && errno == EPIPE) {
+       while((r = full_read(mainfd, buffer, SIZEOF(buffer))) > 0) {
+           if((w = full_write(mailfd, buffer, r)) != r) {
+               if(errno == EPIPE) {
                    strappend(extra_info, _("EPIPE writing to mail process\n"));
                    break;
-               } else if(w < 0) {
+               } else if(errno != 0) {
                    error(_("mailfd write: %s"), strerror(errno));
                    /*NOTREACHED*/
                } else {
@@ -503,11 +509,11 @@ main(
                fputs(extra_info, stderr);
                amfree(extra_info);
            }
-           error(_("error running mailer %s: %s"), MAILER, err?err:"(unknown)");
+           error(_("error running mailer %s: %s"), mailer, err?err:"(unknown)");
            /*NOTREACHED*/
        }
     }
-#endif
+
     dbclose();
     return (server_probs || client_probs);
 }
@@ -599,7 +605,7 @@ static gboolean test_tape_status(FILE * outf) {
     GValue property_value;
     char * label = NULL;
     char * tapename = NULL;
-    ReadLabelStatusFlags label_status;
+    DeviceStatusFlags device_status;
 
     bzero(&property_value, sizeof(property_value));
     
@@ -629,31 +635,34 @@ static gboolean test_tape_status(FILE * outf) {
     }
 
     device = device_open(tapename);
+    g_assert(device != NULL);
 
-    if (device == NULL) {
-        g_fprintf(outf, "ERROR: Could not open tape device.\n");
+    if (device->status != DEVICE_STATUS_SUCCESS) {
+        g_fprintf(outf, "ERROR: Could not open tape device: %s.\n",
+                 device_error(device));
+        amfree(label);
+        return FALSE;
+    }
+
+    if (!device_configure(device, TRUE)) {
+        g_fprintf(outf, "ERROR: Could not configure device: %s.\n",
+                 device_error_or_status(device));
         amfree(label);
         return FALSE;
     }
-    
-    device_set_startup_properties_from_config(device);
-    label_status = device_read_label(device);
+
+    device_status = device_read_label(device);
 
     if (tape_status == 3 && 
-        !(label_status & READ_LABEL_STATUS_VOLUME_UNLABELED)) {
-        if (label_status == READ_LABEL_STATUS_SUCCESS) {
+        !(device_status & DEVICE_STATUS_VOLUME_UNLABELED)) {
+        if (device_status == DEVICE_STATUS_SUCCESS) {
             g_fprintf(outf, "WARNING: Volume was unlabeled, but now "
                     "is labeled \"%s\".\n", device->volume_label);
         }
-    } else if (label_status != READ_LABEL_STATUS_SUCCESS && tape_status != 3) {
-        char * errstr = 
-            g_english_strjoinv_and_free
-                (g_flags_nick_to_strv(label_status &
-                                       (~READ_LABEL_STATUS_VOLUME_UNLABELED),
-                                       READ_LABEL_STATUS_FLAGS_TYPE), "or");
-        g_fprintf(outf, "WARNING: Reading label the second time failed: "
-                "One of %s.\n", errstr);
-        g_free(errstr);
+    } else if (device_status != DEVICE_STATUS_SUCCESS && tape_status != 3) {
+        g_fprintf(outf,
+                 _("WARNING: Reading label the second time failed: %s.\n"),
+                  device_error_or_status(device));
     } else if (tape_status != 3 &&
                (device->volume_label == NULL || label == NULL ||
                 strcmp(device->volume_label, label) != 0)) {
@@ -664,12 +673,12 @@ static gboolean test_tape_status(FILE * outf) {
     /* If we can't get this property, it's not an error. Maybe the device
      * doesn't support this property, or needs an actual volume to know
      * for sure. */
-    if (device_property_get(device, PROPERTY_MEDIUM_TYPE, &property_value)) {
+    if (device_property_get(device, PROPERTY_MEDIUM_ACCESS_TYPE, &property_value)) {
         g_assert(G_VALUE_TYPE(&property_value) == MEDIA_ACCESS_MODE_TYPE);
         if (g_value_get_enum(&property_value) ==
             MEDIA_ACCESS_MODE_WRITE_ONLY) {
-            g_fprintf(outf, "WARNING: Media access mode is WRITE_ONLY, "
-                    "dumps will be thrown away.\n");
+            g_fprintf(outf, "WARNING: Media access mode is WRITE_ONLY; "
+                    "dumps may not be recoverable.\n");
         }
     }
     
@@ -677,12 +686,13 @@ static gboolean test_tape_status(FILE * outf) {
        char *timestamp = get_undef_timestamp();
         if (!device_start(device, ACCESS_WRITE, label, timestamp)) {
             if (tape_status == 3) {
-                g_fprintf(outf, "ERROR: Could not label brand new tape.\n");
+                g_fprintf(outf, "ERROR: Could not label brand new tape");
             } else {
                 g_fprintf(outf,
-                        "ERROR: tape %s label ok, but is not writable.\n",
+                        "ERROR: tape %s label ok, but is not writable",
                         label);
             }
+           g_fprintf(outf, ": %s.\n", device_error(device));
            amfree(timestamp);
             amfree(label);
             g_object_unref(device);
@@ -727,6 +737,7 @@ start_server_check(
     char *quoted;
     int res;
     intmax_t kb_avail;
+    off_t tape_size;
 
     switch(pid = fork()) {
     case -1:
@@ -906,14 +917,17 @@ start_server_check(
            amfree(quoted);
        }
        else if(stat(tapefile, &statbuf) == -1) {
-           quoted = quote_string(tape_dir);
-           g_fprintf(outf, _("ERROR: tapelist %s (%s), "
-                   "you must create an empty file.\n"),
-                   quoted, strerror(errno));
-           tapebad = 1;
-           amfree(quoted);
-       }
-       else {
+           if (errno != ENOENT) {
+               quoted = quote_string(tape_dir);
+               g_fprintf(outf, _("ERROR: tapelist %s (%s), "
+                       "you must create an empty file.\n"),
+                       quoted, strerror(errno));
+               tapebad = 1;
+               amfree(quoted);
+           } else {
+               g_fprintf(outf, _("NOTE: tapelist will be created on the next run.\n"));
+           }
+       } else {
            tapebad |= check_tapefile(outf, tapefile);
            if (tapebad == 0 && read_tapelist(tapefile)) {
                quoted = quote_string(tapefile);
@@ -1403,6 +1417,26 @@ start_server_check(
                  }
                }
 
+               /* check tape_splitsize */
+               tape_size = tapetype_get_length(tp);
+               if (dp->tape_splitsize > tape_size) {
+                   g_fprintf(outf,
+                             _("ERROR: %s %s: tape_splitsize > tape size\n"),
+                             hostp->hostname, dp->name);
+                   pgmbad = 1;
+               }
+               if (dp->fallback_splitsize * 1024 > physmem_total()) {
+                   g_fprintf(outf,
+                             _("ERROR: %s %s: fallback_splitsize > total available memory\n"),
+                             hostp->hostname, dp->name);
+                   pgmbad = 1;
+               }
+               if (dp->fallback_splitsize > tape_size) {
+                   g_fprintf(outf,
+                             _("ERROR: %s %s: fallback_splitsize > tape size\n"),
+                             hostp->hostname, dp->name);
+                   pgmbad = 1;
+               }
                amfree(disk);
                remove_disk(&origq, dp);
            }
@@ -1543,7 +1577,7 @@ start_host(
                        has_hostname ? hostp->hostname : "",
                        has_hostname ? ";" : "",
                        has_config   ? "config=" : "",
-                       has_config   ? config_name : "",
+                       has_config   ? get_config_name() : "",
                        has_config   ? ";" : "",
                        "\n",
                        NULL);
@@ -1556,19 +1590,25 @@ start_host(
            size_t l_len;
            char *o;
            char *calcsize;
-           char *qname;
-           char *qdevice;
+           char *qname, *b64disk;
+           char *qdevice, *b64device = NULL;
 
            if(dp->up != DISK_READY || dp->todo != 1) {
                continue;
            }
-           o = optionstr(dp, hostp->features, outf);
+           if (am_has_feature(hostp->features, fe_req_xml))
+               o = xml_optionstr(dp, hostp->features, outf, 0);
+           else
+               o = optionstr(dp, hostp->features, outf);
            if (o == NULL) {
                remote_errors++;
                continue;
            }
-           qname = quote_string(dp->name); 
+           qname = quote_string(dp->name);
+           b64disk = amxml_format_tag("disk", dp->name);
            qdevice = quote_string(dp->device); 
+           if (dp->device)
+               b64device = amxml_format_tag("diskdevice", dp->device);
            if ((dp->name && qname[0] == '"') || 
                (dp->device && qdevice[0] == '"')) {
                if(!am_has_feature(hostp->features, fe_interface_quoted_text)) {
@@ -1607,8 +1647,9 @@ start_host(
                                    " or don't specify a diskdevice in the disklist.\n"));      
                }
            }
-           if(strcmp(dp->program,"DUMP") == 0 || 
-              strcmp(dp->program,"GNUTAR") == 0) {
+           if (dp->program &&
+               (strcmp(dp->program,"DUMP") == 0 || 
+                strcmp(dp->program,"GNUTAR") == 0)) {
                if(strcmp(dp->program, "DUMP") == 0 &&
                   !am_has_feature(hostp->features, fe_program_dump)) {
                    g_fprintf(outf, _("ERROR: %s:%s does not support DUMP.\n"),
@@ -1665,52 +1706,64 @@ start_host(
                    remote_errors++;
                  } 
                }
-               if(dp->device) {
-                   l = vstralloc(calcsize,
-                                 dp->program, " ",
-                                 qname, " ",
-                                 qdevice,
-                                 " 0 OPTIONS |",
-                                 o,
-                                 "\n",
-                                 NULL);
-               }
-               else {
-                   l = vstralloc(calcsize,
-                                 dp->program, " ",
-                                 qname,
-                                 " 0 OPTIONS |",
-                                 o,
-                                 "\n",
-                                 NULL);
+               if (am_has_feature(hostp->features, fe_req_xml)) {
+                   l = vstralloc("<dle>\n"
+                                 "  <program>",
+                                 dp->program,
+                                 "</program>\n", NULL);
+                    if (strlen(calcsize) > 0)
+                       vstrextend(&l, "  <calcsize>YES</calcsize>\n", NULL);
+                   vstrextend(&l, "  ", b64disk, "\n", NULL);
+                   if (dp->device)
+                       vstrextend(&l, "  ", b64device, "\n", NULL);
+                   vstrextend(&l, o, "</dle>\n", NULL);
+               } else {
+                   if (dp->device) {
+                       l = vstralloc(calcsize,
+                                     dp->program, " ",
+                                     qname, " ",
+                                     qdevice,
+                                     " 0 OPTIONS |",
+                                     o,
+                                     "\n",
+                                     NULL);
+                   } else {
+                       l = vstralloc(calcsize,
+                                     dp->program, " ",
+                                     qname,
+                                     " 0 OPTIONS |",
+                                     o,
+                                     "\n",
+                                     NULL);
+                   }
                }
            } else {
-               if(!am_has_feature(hostp->features, fe_program_backup_api)) {
-                   g_fprintf(outf, _("ERROR: %s:%s does not support BACKUP-API.\n"),
+               if (!am_has_feature(hostp->features, fe_program_application_api) ||
+                   !am_has_feature(hostp->features, fe_req_xml)) {
+                   g_fprintf(outf, _("ERROR: %s:%s does not support APPLICATION-API.\n"),
                            hostp->hostname, qname);
                    g_fprintf(outf, _("Dumptype configuration is not GNUTAR or DUMP."
                                    " It is case sensitive\n"));
-               }
-               if(dp->device) {
-                   l = vstralloc("BACKUP ",
-                                 dp->program, 
-                                 " ",
-                                 qname,
-                                 " ",
-                                 qdevice,
-                                 " 0 OPTIONS |",
-                                 o,
-                                 "\n",
-                                 NULL);
                } else {
-                   l = vstralloc("BACKUP ",
-                                 dp->program, 
-                                 " ",
-                                 qname,
-                                 " 0 OPTIONS |",
-                                 o,
-                                 "\n",
-                                 NULL);
+                   l = vstralloc("<dle>\n"
+                                 "  <program>APPLICATION</program>\n", NULL);
+                   if (dp->application) {
+                       char *xml_app = xml_application(dp->application,
+                                                       hostp->features);
+                       vstrextend(&l, xml_app, NULL);
+                       amfree(xml_app);
+                   }
+                   if (dp->pp_scriptlist) {
+                       if (!am_has_feature(hostp->features, fe_pp_script)) {
+                           g_fprintf(outf,
+                             _("ERROR: %s:%s does not support SCRIPT-API.\n"),
+                             hostp->hostname, qname);
+                       }
+                   }
+                   vstrextend(&l, "  ", b64disk, "\n", NULL);
+                   if (dp->device)
+                       vstrextend(&l, "  ", b64device, "\n", NULL);
+                   vstrextend(&l, o, "</dle>\n", NULL);
                }
            }
            amfree(qname);
@@ -1764,7 +1817,7 @@ start_client_checks(
     int                fd)
 {
     am_host_t *hostp;
-    disk_t *dp;
+    disk_t *dp, *dp1;
     int hostcount;
     pid_t pid;
     int userbad = 0;
@@ -1804,6 +1857,14 @@ start_client_checks(
     for(dp = origq.head; dp != NULL; dp = dp->next) {
        hostp = dp->host;
        if(hostp->up == HOST_READY && dp->todo == 1) {
+           for(dp1 = hostp->disks; dp1 != NULL; dp1 = dp1->hostnext) {
+               run_server_scripts(EXECUTE_ON_PRE_HOST_AMCHECK,
+                                  get_config_name(), dp1, -1);
+           }
+           for(dp1 = hostp->disks; dp1 != NULL; dp1 = dp1->hostnext) {
+               run_server_scripts(EXECUTE_ON_PRE_DLE_AMCHECK,
+                                  get_config_name(), dp1, -1);
+           }
            start_host(hostp);
            hostcount++;
            protocol_check();
@@ -1869,7 +1930,7 @@ handle_result(
        if(strncmp_const(line, "OPTIONS ") == 0) {
 
            t = strstr(line, "features=");
-           if(t != NULL && (isspace((int)t[-1]) || t[-1] == ';')) {
+           if(t != NULL && (g_ascii_isspace((int)t[-1]) || t[-1] == ';')) {
                t += SIZEOF("features=")-1;
                am_release_feature_set(hostp->features);
                if((hostp->features = am_string_to_feature(t)) == NULL) {
@@ -1926,8 +1987,17 @@ handle_result(
        }
     }
     start_host(hostp);
-    if(hostp->up == HOST_DONE)
+    if(hostp->up == HOST_DONE) {
        security_close_connection(sech, hostp->hostname);
+       for(dp = hostp->disks; dp != NULL; dp = dp->hostnext) {
+           run_server_scripts(EXECUTE_ON_POST_DLE_AMCHECK,
+                              get_config_name(), dp, -1);
+       }
+       for(dp = hostp->disks; dp != NULL; dp = dp->hostnext) {
+           run_server_scripts(EXECUTE_ON_POST_HOST_AMCHECK,
+                              get_config_name(), dp, -1);
+       }
+    }
     /* try to clean up any defunct processes, since Amanda doesn't wait() for
        them explicitly */
     while(waitpid(-1, NULL, WNOHANG)> 0);
index a7352decca53a74b3c26b228214b8c0d8b33d955..dfa6f0c7dc9ec267a2215e270ccda94595afc422 100644 (file)
@@ -1,4 +1,22 @@
 #! @PERL@
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+# 
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published 
+# by the Free Software Foundation.
+# 
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+# 
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
 use lib '@amperldir@';
 use strict;
 
@@ -9,9 +27,9 @@ use Amanda::Device qw( :constants );
 use Amanda::Debug qw( :logging );
 use Amanda::Config qw( :init :getconf config_dir_relative );
 use Amanda::Logfile;
-use Amanda::Util qw( :running_as_flags );
-use Amanda::Tapefile;
+use Amanda::Util qw( :constants );
 use Amanda::Changer;
+use Amanda::Constants;
 
 # Have all images been verified successfully so far?
 my $all_success = 1;
@@ -66,35 +84,47 @@ sub find_logfile_name($) {
 
 ## Device management
 
-my $changer_init_done = 0;
+my $changer;
+my $reservation;
 my $current_device;
 my $current_device_label;
 
 sub find_next_device {
     my $label = shift;
-    if (getconf_seen($CNF_TPCHANGER)) {
-       # We're using a changer script.
-       if (!$changer_init_done) {
-           my $error = (Amanda::Changer::reset())[0];
-           critical($error) if $error;
-           $changer_init_done = 1;
-       }
-       my ($error, $slot, $tapedev) = Amanda::Changer::find($label);
-       if ($error) {
-           critical("Error operating changer: $error.");
-       } elsif ($slot eq "<none>") {
-           critical("Could not find tape label $label in changer.");
-       } else {
-           return $tapedev;
-       }
+    my $reset_done_cb;
+    my $find_done_cb;
+    my ($slot, $tapedev);
+
+    # if the changer hasn't been created yet, set it up
+    if (!$changer) {
+       $changer = Amanda::Changer->new();
+    }
+
+    my $load_sub = sub {
+       my ($err) = @_;
+       die $err if $err;
+
+       $changer->load(
+           label => $label,
+           res_cb => sub {
+               (my $err, $reservation) = @_;
+               die $err if $err;
+               Amanda::MainLoop::quit();
+           },
+       );
+    };
+
+    if (defined $reservation) {
+       $reservation->release(finished_cb => $load_sub);
     } else {
-       # The user is changing tapes for us.
-       my $device_name = getconf($CNF_TAPEDEV);
-       printf("Insert volume with label %s in device %s and press ENTER: ",
-              $label, $device_name);
-       <>;
-       return $device_name;
+       $load_sub->(undef);
     }
+
+    # let the mainloop run until the find is done.  This is a temporary
+    # hack until all of amcheckdump is event-based.
+    Amanda::MainLoop::run();
+
+    return $reservation->{device_name};
 }
 
 # Try to open a device containing a volume with the given label.  Returns undef
@@ -117,34 +147,39 @@ sub try_open_device {
     }
 
     my $device = Amanda::Device->new($device_name);
-    if ( !$device ) {
-       print "Could not open '$device_name'.\n";
-        return undef;
+    if ($device->status() != $DEVICE_STATUS_SUCCESS) {
+       print "Could not open device $device_name: ",
+             $device->error(), ".\n";
+       return undef;
     }
 
-    $device->set_startup_properties_from_config();
-
     my $label_status = $device->read_label();
-    if ($label_status != $READ_LABEL_STATUS_SUCCESS) {
-       print "Could not read device $device_name: one of ",
-            join(", ", ReadLabelStatusFlags_to_strings($label_status)),
-            "\n";
+    if ($label_status != $DEVICE_STATUS_SUCCESS) {
+       if ($device->error() ) {
+           print "Could not read device $device_name: ",
+                 $device->error(), ".\n";
+       } else {
+           print "Could not read device $device_name: one of ",
+                join(", ", DevicestatusFlags_to_strings($label_status)),
+                "\n";
+       }
        return undef;
     }
 
-    if ($device->{volume_label} ne $label) {
+    if ($device->volume_label() ne $label) {
        printf("Labels do not match: Expected '%s', but the device contains '%s'.\n",
-                    $label, $device->{volume_label});
+                    $label, $device->volume_label());
        return undef;
     }
 
     if (!$device->start($ACCESS_READ, undef, undef)) {
-       printf("Error reading device %s.\n", $device_name);
+       printf("Error reading device %s: %s.\n", $device_name,
+              $device->error_message());
        return undef;
     }
 
     $current_device = $device;
-    $current_device_label = $device->{volume_label};
+    $current_device_label = $device->volume_label();
 
     return $device;
 }
@@ -220,23 +255,43 @@ sub find_validation_command {
     # We base the actual archiver on our own table, but just trust
     # whatever is listed as the decrypt/uncompress commands.
     my $program = uc(basename($header->{program}));
-    
+
     my $validation_program;
-    my %validation_programs = (
-        "DUMP" => "@RESTORE@ tbf 2 -",
-        "VDUMP" => "@VRESTORE@ tf -",
-        "VXDUMP" => "@VXRESTORE@ tbf 2 -",
-        "XFSDUMP" => "@XFSRESTORE@ -t -v silent -",
-        "TAR" => "@GNUTAR@ tf -",
-        "GTAR" => "@GNUTAR@ tf -",
-        "GNUTAR" => "@GNUTAR@ tf -",
-        "SMBCLIENT" => "@SAMBA_CLIENT@ tf -",
-    );
-
-    $validation_program = $validation_programs{$program};
+
+    if ($program ne "APPLICATION") {
+        my %validation_programs = (
+            "STAR" => "$Amanda::Constants::STAR -t -f -",
+            "DUMP" => "$Amanda::Constants::RESTORE tbf 2 -",
+            "VDUMP" => "$Amanda::Constants::VRESTORE tf -",
+            "VXDUMP" => "$Amanda::Constants::VXRESTORE tbf 2 -",
+            "XFSDUMP" => "$Amanda::Constants::XFSRESTORE -t -v silent -",
+            "TAR" => "$Amanda::Constants::GNUTAR tf -",
+            "GTAR" => "$Amanda::Constants::GNUTAR tf -",
+            "GNUTAR" => "$Amanda::Constants::GNUTAR tf -",
+            "SMBCLIENT" => "$Amanda::Constants::GNUTAR tf -",
+        );
+        $validation_program = $validation_programs{$program};
+    } else {
+       if (!defined $header->{application}) {
+            print STDERR "Application not set; ".
+                        "Will send dumps to /dev/null instead.";
+            $validation_program = "cat > /dev/null";
+       } else {
+           my $program_path = $Amanda::Paths::APPLICATION_DIR . "/" .
+                               $header->{application};
+            if (!-x $program_path) {
+                print STDERR "Application '" , $header->{application},
+                            "($program_path)' not available on the server; ".
+                            "Will send dumps to /dev/null instead.";
+                $validation_program = "cat > /dev/null";
+           } else {
+               $validation_program = $program_path . " validate";
+           }
+       }
+    }
     if (!defined $validation_program) {
-        warning("Could not determine validation for dumper $program; ".
-             "Will send dumps to /dev/null instead.");
+        print STDERR "Could not determine validation for dumper $program; ".
+                    "Will send dumps to /dev/null instead.";
         $validation_program = "cat > /dev/null";
     } else {
         # This is to clean up any extra output the program doesn't read.
@@ -259,7 +314,7 @@ sub find_validation_command {
 
 ## Application initialization
 
-Amanda::Util::setup_application("amcheckdump", "server", "cmdline");
+Amanda::Util::setup_application("amcheckdump", "server", $CONTEXT_CMDLINE);
 
 my $timestamp = undef;
 my $config_overwrites = new_config_overwrites($#ARGV+1);
@@ -273,19 +328,22 @@ GetOptions(
 
 usage() if (@ARGV < 1);
 
+my $timestamp_argument = 0;
+if (defined $timestamp) { $timestamp_argument = 1; }
+
 my $config_name = shift @ARGV;
-if (!config_init($CONFIG_INIT_EXPLICIT_NAME |
-                 $CONFIG_INIT_FATAL, $config_name)) {
-    critical('errors processing config file "' . 
-               Amanda::Config::get_config_filename() . '"');
-}
+config_init($CONFIG_INIT_EXPLICIT_NAME, $config_name);
 apply_config_overwrites($config_overwrites);
+my ($cfgerr_level, @cfgerr_errors) = config_errors();
+if ($cfgerr_level >= $CFGERR_WARNINGS) {
+    config_print_errors();
+    if ($cfgerr_level >= $CFGERR_ERRORS) {
+       die("errors processing config file");
+    }
+}
 
 Amanda::Util::finish_setup($RUNNING_AS_DUMPUSER);
 
-# Read the tape list.
-my $tl = Amanda::Tapefile::read_tapelist(config_dir_relative(getconf($CNF_TAPELIST)));
-
 # If we weren't given a timestamp, find the newer of
 # amdump.1 or amflush.1 and extract the datestamp from it.
 if (!defined $timestamp) {
@@ -300,12 +358,12 @@ if (!defined $timestamp) {
     } elsif (-f $amflush_log) {
          $logfile=$amflush_log;
     } else {
-       print "Could not find any dump log file.\n";
+       print "Could not find amdump.1 or amflush.1 files.\n";
        exit;
     }
 
     # extract the datestamp from the dump log
-    open (AMDUMP, "<$logfile") || critical();
+    open (AMDUMP, "<$logfile") || die();
     while(<AMDUMP>) {
        if (/^amdump: starttime (\d*)$/) {
            $timestamp = $1;
@@ -321,18 +379,32 @@ if (!defined $timestamp) {
 }
 
 # Find all logfiles matching our timestamp
+my $logfile_dir = config_dir_relative(getconf($CNF_LOGDIR));
 my @logfiles =
     grep { $_ =~ /^log\.$timestamp(?:\.[0-9]+|\.amflush)?$/ }
     Amanda::Logfile::find_log();
 
+# Check log file directory if find_log didn't find tape written
+# on that tapestamp
 if (!@logfiles) {
-    critical("Can't find any logfiles with timestamp $timestamp.");
+    opendir(DIR, $logfile_dir) || die "can't opendir $logfile_dir: $!";
+    @logfiles = grep { /^log.$timestamp\..*/ } readdir(DIR);
+    closedir DIR;
+
+    if (!@logfiles) {
+       if ($timestamp_argument) {
+           print STDERR "Can't find any logfiles with timestamp $timestamp.\n";
+       } else {
+           print STDERR "Can't find the logfile for last run.\n";
+       }
+       exit 1;
+    }
 }
 
 # compile a list of *all* dumps in those logfiles
-my $logfile_dir = config_dir_relative(getconf($CNF_LOGDIR));
 my @images;
 for my $logfile (@logfiles) {
+    chomp $logfile;
     push @images, Amanda::Logfile::search_logfile(undef, $timestamp,
                                                   "$logfile_dir/$logfile", 1);
 }
@@ -342,7 +414,12 @@ for my $logfile (@logfiles) {
        undef, undef, undef, undef, 1);
 
 if (!@images) {
-    critical("Could not find any matching dumps");
+    if ($timestamp_argument) {
+       print STDERR "No backup written on timestamp $timestamp.\n";
+    } else {
+       print STDERR "No backup written on latest run.\n";
+    }
+    exit 1;
 }
 
 # Find unique tapelist, using a hash to filter duplicate tapes
@@ -350,7 +427,8 @@ my %tapes = map { ($_->{label}, undef) } @images;
 my @tapes = sort { $a cmp $b } keys %tapes;
 
 if (!@tapes) {
-    critical("Could not find any matching dumps");
+    print STDERR "Could not find any matching dumps.\n";
+    exit 1;
 }
 
 printf("You will need the following tape%s: %s\n", (@tapes > 1) ? "s" : "",
@@ -414,13 +492,18 @@ for my $image (@images) {
     my $pipeline = open_validation_app($image, $header);
 
     # send the datastream from the device straight to the application
-    if (!$device->read_to_fd(fileno($pipeline))) {
+    my $queue_fd = Amanda::Device::queue_fd_t->new(fileno($pipeline));
+    if (!$device->read_to_fd($queue_fd)) {
         print "Error reading device or writing data to validation command.\n";
        $all_success = 0;
        next IMAGE;
     }
 }
 
+if (defined $reservation) {
+    $reservation->release();
+}
+
 # clean up
 close_validation_app();
 close_device();
diff --git a/server-src/amcleanup.pl b/server-src/amcleanup.pl
new file mode 100644 (file)
index 0000000..3bfdfe6
--- /dev/null
@@ -0,0 +1,182 @@
+#!@PERL@
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+# 
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published 
+# by the Free Software Foundation.
+# 
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+# 
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+use lib '@amperldir@';
+use strict;
+
+use Getopt::Long;
+use Amanda::Config qw( :init :getconf config_dir_relative );
+use Amanda::Util qw( :constants );
+use Amanda::Paths;
+use Amanda::Constants;
+use Amanda::Process;
+
+my $kill_enable=0;
+my $process_alive=0;
+my $verbose=0;
+
+my $suf = '';
+if ( $Amanda::Constants::USE_VERSION_SUFFIXES =~ /^yes$/i ) {
+        $suf="-$Amanda::Constants::VERSION";
+}
+
+sub usage() {
+    print "Usage: amcleanup [-k] [-v] [-p] conf\n";
+    exit 1;
+}
+
+Amanda::Util::setup_application("amcleanup", "server", $CONTEXT_SCRIPTUTIL);
+
+my $config_overwrites = new_config_overwrites($#ARGV+1);
+
+Getopt::Long::Configure(qw(bundling));
+GetOptions(
+    'k' => \$kill_enable,
+    'p' => \$process_alive,
+    'v' => \$verbose,
+    'help|usage' => \&usage,
+    'o=s' => sub { add_config_overwrite_opt($config_overwrites, $_[1]); },
+) or usage();
+
+my $config_name = shift @ARGV;
+
+if ($kill_enable && $process_alive) {
+    die "amcleanup: Can't use -k and -p simultaneously\n";
+}
+
+config_init($CONFIG_INIT_EXPLICIT_NAME, $config_name);
+apply_config_overwrites($config_overwrites);
+my ($cfgerr_level, @cfgerr_errors) = config_errors();
+if ($cfgerr_level >= $CFGERR_WARNINGS) {
+    config_print_errors();
+    if ($cfgerr_level >= $CFGERR_ERRORS) {
+       die("errors processing config file");
+    }
+}
+
+Amanda::Util::finish_setup($RUNNING_AS_DUMPUSER);
+
+my $logdir=config_dir_relative(getconf($CNF_LOGDIR));
+my $logfile = "$logdir/log";
+my $amreport="$sbindir/amreport$suf";
+my $amlogroll="$amlibexecdir/amlogroll$suf";
+my $amtrmidx="$amlibexecdir/amtrmidx$suf";
+my $amcleanupdisk="$amlibexecdir/amcleanupdisk$suf";
+
+if ( ! -e "$CONFIG_DIR/$config_name" ) {
+    die "Configuration directory '$CONFIG_DIR/$config_name' doesn't exist\n";
+}
+if ( ! -d "$CONFIG_DIR/$config_name" ) {
+    die "Configuration directory '$CONFIG_DIR/$config_name' is not a directory\n";
+}
+
+my $Amanda_process = Amanda::Process->new($verbose);
+$Amanda_process->load_ps_table();
+
+if (-f "$logfile") {
+    $Amanda_process->scan_log($logfile);
+} elsif (!$process_alive) {
+    #check amdump/amflush process
+    foreach my $pname ("amdump", "amflush") {
+       my $pid = `ps -ef|grep -w ${pname}|grep -w ${config_name}| grep -v grep | awk '{print \$2}'`;
+       chomp $pid;
+       if ($pid ne "") {
+           $Amanda_process->set_master($pname, $pid);
+       }
+    }
+}
+
+$Amanda_process->add_child();
+
+my $nb_amanda_process = $Amanda_process->count_process();
+#if amanda processes are running
+if ($nb_amanda_process > 0) {
+    if ($process_alive) {
+       exit 0;
+    } elsif (!$kill_enable) {
+       print "amcleanup: ", $Amanda_process->{master_pname}, " Process is running at PID ", $Amanda_process->{master_pid}, " for $config_name configuration.\n";
+       print "amcleanup: Use -k option to stop all the process...\n";
+       print "Usage: amcleanup [-k] conf\n";
+       exit 0;
+    } else { #kill the processes
+       $Amanda_process->kill_process("SIGTERM");
+       my $count = 5;
+       my $pp;
+       while ($count > 0) {
+          $pp = $Amanda_process->process_running();
+          if ($pp > 0) {
+               $count--;
+               sleep 1;
+          } else {
+               $count = 0;
+          }
+       }
+       if ($pp > 0) {
+           $Amanda_process->kill_process("SIGKILL");
+           sleep 2;
+           $pp = $Amanda_process->process_running();
+       }
+       print "amcleanup: ", $nb_amanda_process, " Amanda processes were found running.\n";
+       print "amcleanup: $pp processes failed to terminate.\n";
+    }
+}
+
+# rotate log
+if (-f $logfile) {
+    system $amreport, $config_name;
+    system $amlogroll, $config_name;
+    system $amtrmidx, $config_name;
+} else {
+    print "amcleanup: no unprocessed logfile to clean up.\n";
+}
+
+my $tapecycle = getconf($CNF_TAPECYCLE);
+
+# cleanup logfiles
+chdir "$CONFIG_DIR/$config_name";
+foreach my $pname ("amdump", "amflush") {
+    my $errfile = "$logdir/$pname";
+    if (-f $errfile) {
+       print "amcleanup: $errfile exists, renaming it.\n";
+
+       # Keep debug log through the tapecycle plus a couple days
+       my $maxdays=$tapecycle + 2;
+
+       my $days=1;
+       # First, find out the last existing errfile,
+       # to avoid ``infinite'' loops if tapecycle is infinite
+       while ($days < $maxdays  && -f "$errfile.$days") {
+           $days++;
+       }
+
+       # Now, renumber the existing log files
+       while ($days >= 2) {
+           my $ndays = $days - 1;
+           rename("$errfile.$ndays", "$errfile.$days");
+           $days=$ndays;
+       }
+       rename($errfile, "$errfile.1");
+    }
+}
+
+if ($verbose) {
+    system $amcleanupdisk, "-v", $config_name;
+} else {
+    system $amcleanupdisk, $config_name;
+}
diff --git a/server-src/amcleanup.sh b/server-src/amcleanup.sh
deleted file mode 100644 (file)
index 166dace..0000000
+++ /dev/null
@@ -1,289 +0,0 @@
-#!@SHELL@
-#
-# Amanda, The Advanced Maryland Automatic Network Disk Archiver
-# Copyright (c) 1991-1998 University of Maryland at College Park
-# All Rights Reserved.
-#
-# Permission to use, copy, modify, distribute, and sell this software and its
-# documentation for any purpose is hereby granted without fee, provided that
-# the above copyright notice appear in all copies and that both that
-# copyright notice and this permission notice appear in supporting
-# documentation, and that the name of U.M. not be used in advertising or
-# publicity pertaining to distribution of the software without specific,
-# written prior permission.  U.M. makes no representations about the
-# suitability of this software for any purpose.  It is provided "as is"
-# without express or implied warranty.
-#
-# U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M.
-# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
-# OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
-# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
-# Author: James da Silva, Systems Design and Analysis Group
-#                         Computer Science Department
-#                         University of Maryland at College Park
-#
-
-#
-# amcleanup.sh - clean up and generate a report after a crash.
-
-prefix="@prefix@"
-exec_prefix="@exec_prefix@"
-sbindir="@sbindir@"
-amlibexecdir="@amlibexecdir@"
-. "${amlibexecdir}/amanda-sh-lib.sh"
-
-confdir=@CONFIG_DIR@
-
-# add sbin and ucb dirs
-PATH="$PATH:/usr/sbin:/sbin:/usr/ucb"
-export PATH
-
-USE_VERSION_SUFFIXES="@USE_VERSION_SUFFIXES@"
-if test "$USE_VERSION_SUFFIXES" = yes; then
-        SUF=-@VERSION@
-else
-        SUF=
-fi
-
-#
-#Function to :
-#   parse process tree and get the children of a given process ID
-#
-
-
-find_children() {
-
-#sample ps -ef output
-#500      20810  4938  0 10:21 pts/2    00:00:00 /bin/sh /usr/sbin/amdump tapebackup
-
-       for pid in $(ps -ef | awk "{if ( \$3 == $1 ) { print \$2 }}")
-       do
-               process_name=`ps -e|grep -w ${pid}|awk '{print $4}'`
-               echo `_ '%s: Process %s found running at pid #%s.' "amcleanup" "${process_name}" "${pid}"`
-               pidname[$i]=$pid
-               i=`expr $i + 1`
-               find_children $pid
-       done
-}
-
-#
-#Function to :
-#   send SIGTERM signal to kill given process ID and check if process still alive 
-#   after receiving SIGTERM,  if yes send SIGKILL  
-#
-
-function killpid() {
-
-killPID=$1
-SIGTERM=15
-
-       echo `_ '%s: Sending process %s the %s signal.' "$0" "${killPID}" "SIGTERM"`
-       `kill -${SIGTERM} ${killPID} 2>/dev/null`
-       for second in 0 1 2 3 4 ; do
-               pid_status=`ps -e|grep -w ${killPID}|grep -v grep |wc -l`
-               if [ ${pid_status} -ne 0 ] ; then
-                       # process is still alive
-                       sleep 1
-               else
-                       return 0
-               fi
-       done
-       SIGKILL=9
-       echo `_ '%s: Sending process %s the %s signal.' "$0" "${killPID}" "SIGKILL"`
-       `kill -${SIGKILL} ${killPID} 2>/dev/null`
-       sleep 2
-       pid_status=`ps -e|grep -w ${killPID}|grep -v grep |wc -l`
-       if [ ${pid_status} -ne 0 ] ; then
-               return 1
-       else
-               return 0
-       fi
-}
-
-
-# process arguments
-KILL_ENABLE=0
-VERBOSE=0
-while test $# -ge 2; do
-    case "$1" in
-       -k) KILL_ENABLE=1;;
-       -v) VERBOSE=1;;
-       *)
-           echo `_ 'Usage: amcleanup [-k] [-v] conf'`
-           exit 1 ;;
-    esac
-    shift
-done
-conf="$1"
-shift
-
-if test ! -d $confdir/$conf ; then
-       echo `_ '%s: could not cd into %s' "amcleanup" "$confdir/$conf"`
-       exit 1
-fi
-
-#check if amdump/amflush is running for given config  
-if test ${KILL_ENABLE} -eq 0 ; then
-       for am_process in amdump amflush ; do
-               am_pid=`ps -ef|grep -w ${am_process}|grep -w ${conf}|awk '{print $2}'`
-               if test ! -z "${am_pid}" ; then
-                       echo `_ '%s: %s Process is running at PID %s for %s configuration.' "$0" "${am_process}" ${am_pid} ${conf}`
-                       echo `_ '%s: Use -k option to stop all the process...' "$0"`
-                       echo `_ 'Usage: amcleanup [-k] conf'`
-                       exit 0
-               fi
-       done
-fi
-
-cd $confdir/$conf
-
-logdir=`amgetconf$SUF $conf logdir "$@"`
-rc=$?
-if test $rc -ne 0 ; then
-       echo `_ '%s: "%s" exited with status: %s' "amcleanup" "amgetconf$SUF logdir" "$rc"` 1>&2
-       exit 1
-fi
-logfile=$logdir/log
-errfile=$logdir/amdump
-erramflush=$logdir/amflush
-tapecycle=`amgetconf$SUF $conf tapecycle "$@"`
-rc=$?
-if test $rc -ne 0 ; then
-       echo `_ '%s: "%s" exited with status: %s' "amcleanup" "amgetconf$SUF tapecycle" "$rc"` 1>&2
-       exit 1
-fi
-dumpuser=`amgetconf$SUF $conf dumpuser "$@"`
-rc=$?
-if test $rc -ne 0 ; then
-       echo `_ '%s: "%s" exited with status: %s' "amcleanup" "amgetconf$SUF $conf dumpuser" "$rc"` 1>&2
-       exit 1
-fi
-if test ${KILL_ENABLE} -eq 1 ; then
-
-       #check if any one of the dumps are runing, if yes get the process tree and kill them
-        for am_process in amdump amflush ; do
-                unset pidname
-                am_pid=`ps -ef|grep -w ${am_process}|grep -w ${conf}|awk '{print $2}'`
-                #echo "checking children for ${am_pid}"
-                if test ! -z "${am_pid}" ; then
-                        find_children ${am_pid}
-                fi
-
-                KILL_FAILURES=0
-               i=0
-
-                while test ${#pidname[@]} -gt $i ; do
-
-                        mypid=`ps -e|grep -w ${pidname[$i]}|grep -v grep|wc -l`
-                        if [ ${mypid} -ne 0 ] ; then
-                                killpid ${pidname[$i]}
-                                rc=$?
-                                if test $rc -ne 0 ; then
-                                        KILL_FAILURES=`expr ${KILL_FAILURES} + 1`
-                                fi
-                        else
-                                echo `_ '%s: Process %s no longer running.  Skipping...' "$0" "${pidname[$i]}"`
-                        fi
-                       i=`expr $i + 1`
-                done
-
-        if test ${#pidname[@]} -gt 0 ; then
-                echo `_ '%s: %s Amanda processes were found running.' "$0" "${#pidname[@]}"`
-                echo `_ '%s: %s processes failed to terminate.' "$0" "${KILL_FAILURES}"`
-        fi
-
-        done
-fi
-
-retstatus=0
-if test -f $logfile ; then
-       echo `_ '%s: processing outstanding log file.' "$0"`
-       exec </dev/null >/dev/null 2>&1
-       amreport$SUF $conf "$@"
-       rc=$?
-       if test $rc -ne 0 ; then
-               echo `_ '%s: "%s" exited with status: %s' "$0" "amreport" "$rc"` 1>&2
-               retstatus=`expr $retstatus + 1`
-       fi
-
-       # Roll the log file to its datestamped name.
-       amlogroll$SUF $conf "$@"
-       rc=$?
-       if test $rc -ne 0 ; then
-               echo `_ '%s: "%s" exited with status: %s' "$0" "amlogroll" "$rc"` 1>&2
-               retstatus=`expr $retstatus + 2`
-       fi
-
-       # Trim the index file to those for dumps that still exist.
-       amtrmidx$SUF $conf "$@"
-       rc=$?
-       if test $rc -ne 0 ; then
-               echo `_ '%s: "%s" exited with status: %s' "$0" "amtrmidx" "$rc"` 1>&2
-               retstatus=`expr $retstatus + 4`
-       fi
-
-else
-       echo `_ '%s: no unprocessed logfile to clean up.' "$0"`
-fi
-
-if test -f $errfile ; then
-    # if log was found, this will have been directed to /dev/null,
-    # which is fine.
-    echo `_ '%s: %s exists, renaming it.' "$0" "$errfile"`
-
-    # Keep debug log through the tapecycle plus a couple days
-    maxdays=`expr $tapecycle + 2`
-
-    days=1
-    # First, find out the last existing errfile,
-    # to avoid ``infinite'' loops if tapecycle is infinite
-    while test $days -lt $maxdays  && test -f $errfile.$days ; do
-       days=`expr $days + 1`
-    done
-    # Now, renumber the existing log files
-    while test $days -ge 2 ; do
-       ndays=`expr $days - 1`
-       mv $errfile.$ndays $errfile.$days
-       days=$ndays
-    done
-    mv $errfile $errfile.1
-fi
-
-if test -f $erramflush ; then
-    # if log was found, this will have been directed to /dev/null,
-    # which is fine.
-    echo `_ '%s: %s exists, renaming it.' "$0" "$erramflush"`
-
-    # Keep debug log through the tapecycle plus a couple days
-    maxdays=`expr $tapecycle + 2`
-
-    days=1
-    # First, find out the last existing erramflush,
-    # to avoid ``infinite'' loops if tapecycle is infinite
-    while test $days -lt $maxdays  && test -f $erramflush.$days ; do
-       days=`expr $days + 1`
-    done
-    # Now, renumber the existing log files
-    while test $days -ge 2 ; do
-       ndays=`expr $days - 1`
-       mv $erramflush.$ndays $erramflush.$days
-       days=$ndays
-    done
-    mv $erramflush $erramflush.1
-fi
-
-v=''
-if test $VERBOSE -eq 1; then
-    v='-v'
-fi
-$amlibexecdir/amcleanupdisk $v $conf "$@"
-rc=$?
-if test $rc -ne 0 ; then
-       echo `_ '%s: "%s" exited with status: %s' "$0" "amcleanupdisk" "$rc"` 1>&2
-       retstatus=`expr $retstatus + 8`
-fi
-
-exit $retstatus
index a67154cbbf5657db027e1334de3f62e2558b2e15..95dd3d377659714614137fbcbdc74770b83b5c4e 100644 (file)
 
 /* Utility funcitons */
 
-/* Call open_diskfile() with the diskfile from the configuration
- */
-static void
-init_diskfile(void)
-{
-    char *conf_diskfile = config_dir_relative(getconf_str(CNF_DISKFILE));
-    disklist_t diskq; /* never used, but required by read_diskfile */
-
-    if (read_diskfile(conf_diskfile, &diskq) < 0) {
-       error(_("could not load disklist %s"), conf_diskfile);
-       /*NOTREACHED*/
-    }
-    amfree(conf_diskfile);
-}
-
 /* Call open_infofile() with the infofile from the configuration
  */
 static void
@@ -98,6 +83,8 @@ main(
 {
     FILE *verbose_output = NULL;
     char *cfg_opt = NULL;
+    char *conf_diskfile;
+    disklist_t diskq;
 
     /*
      * Configure program for internationalization:
@@ -128,14 +115,25 @@ main(
        cfg_opt = argv[1];
     }
 
-    config_init(CONFIG_INIT_EXPLICIT_NAME | CONFIG_INIT_FATAL,
+    config_init(CONFIG_INIT_EXPLICIT_NAME,
                cfg_opt);
 
+    conf_diskfile = config_dir_relative(getconf_str(CNF_DISKFILE));
+    read_diskfile(conf_diskfile, &diskq);
+    /* diskq also ends up in a global, used by holding_cleanup */
+    amfree(conf_diskfile);
+
+    if (config_errors(NULL) >= CFGERR_WARNINGS) {
+       config_print_errors();
+       if (config_errors(NULL) >= CFGERR_ERRORS) {
+           g_critical(_("errors processing config file"));
+       }
+    }
+
     check_running_as(RUNNING_AS_DUMPUSER);
 
-    dbrename(config_name, DBG_SUBDIR_SERVER);
+    dbrename(get_config_name(), DBG_SUBDIR_SERVER);
 
-    init_diskfile();
     init_infofile();
 
     /* actually perform the cleanup */
index 1e6d8b4c12ae3816ed1e44fc7d49fef68c8f6320..e96c3b0788bf387f6dae75baced9940c10416143 100644 (file)
@@ -1,10 +1,30 @@
 #! @PERL@
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+# 
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published 
+# by the Free Software Foundation.
+# 
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+# 
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
 use lib '@amperldir@';
+use Getopt::Long;
+
 use strict;
 use Amanda::Device qw( :constants );
 use Amanda::Config qw( :getconf :init );
 use Amanda::Debug qw( :logging );
-use Amanda::Util qw( :running_as_flags );
+use Amanda::Util qw( :constants );
 
 # try to open the device and read its label, returning the device_read_label
 # result (one or more of ReadLabelStatusFlags)
@@ -12,25 +32,34 @@ sub try_read_label {
     my ($device_name) = @_;
 
     if ( !$device_name ) {
-        return $READ_LABEL_STATUS_DEVICE_MISSING;
+       die("No device name specified.\n");
     }
 
+    my $result;
+
     my $device = Amanda::Device->new($device_name);
     if ( !$device ) {
-        return $READ_LABEL_STATUS_DEVICE_MISSING
-             | $READ_LABEL_STATUS_DEVICE_ERROR;
+       die("Error creating $device_name");
     }
 
-    $device->set_startup_properties_from_config();
+    if ($device->status() == $DEVICE_STATUS_SUCCESS) {
+       $result = $device->read_label();
+    } else {
+       $result = $device->status();
+    }
 
-    return $device->read_label();
+    print_result( $result, $device->error() );
+    return $result;
 }
 
 # print the results, one flag per line
 sub print_result {
-    my ($flags) = @_;
+    my ($flags, $errmsg) = @_;
 
-    print join( "\n", ReadLabelStatusFlags_to_strings($flags) ), "\n";
+    if ($flags != $DEVICE_STATUS_SUCCESS) {
+       print "MESSAGE $errmsg\n";
+    }
+    print join( "\n", DeviceStatusFlags_to_strings($flags) ), "\n";
 }
 
 sub usage {
@@ -42,13 +71,27 @@ EOF
 
 ## Application initialization
 
-Amanda::Util::setup_application("amdevcheck", "server", "cmdline");
+Amanda::Util::setup_application("amdevcheck", "server", $CONTEXT_SCRIPTUTIL);
+
+my $config_overwrites = new_config_overwrites($#ARGV+1);
+
+Getopt::Long::Configure(qw(bundling));
+GetOptions(
+    'help|usage|?' => \&usage,
+    'o=s' => sub { add_config_overwrite_opt($config_overwrites, $_[1]); },
+) or usage();
 
 usage() if ( @ARGV < 1 || @ARGV > 2 );
 my $config_name = $ARGV[0];
-if (!config_init($CONFIG_INIT_EXPLICIT_NAME, $config_name)) {
-    critical('errors processing config file "' .
-              Amanda::Config::get_config_filename() . '"');
+
+config_init($CONFIG_INIT_EXPLICIT_NAME, $config_name);
+apply_config_overwrites($config_overwrites);
+my ($cfgerr_level, @cfgerr_errors) = config_errors();
+if ($cfgerr_level >= $CFGERR_WARNINGS) {
+    config_print_errors();
+    if ($cfgerr_level >= $CFGERR_ERRORS) {
+       die("errors processing config file");
+    }
 }
 
 Amanda::Util::finish_setup($RUNNING_AS_DUMPUSER);
@@ -62,4 +105,5 @@ if ( $#ARGV == 1 ) {
     $device_name = getconf($CNF_TAPEDEV);
 }
 
-print_result( try_read_label($device_name) );
+try_read_label($device_name);
+exit 0;
index 803adcc6934be0972b5bdabfc0d1d9ffc87537f2..b9b105f744146579d36a06ddff480c735057ea11 100644 (file)
@@ -97,22 +97,9 @@ if test -f hold; then
 fi
 
 if test -f $errfile || test -f $logdir/log; then
-       echo `_ '%s: amdump or amflush is already running, or you must run amcleanup' "$0"` 1>&2
-       exit 1
+       amcleanup$SUF -p $conf
 fi
 
-umask 077
-
-exit_code=0
-# Plan and drive the dumps.
-#exec </dev/null >$errfile 2>&1
-touch $errfile
-exit_code=$?
-[ $exit_code -ne 0 ] && exit_status=$exit_code
-exec </dev/null 2>>$errfile 1>&2
-exit_code=$?
-[ $exit_code -ne 0 ] && exit_status=$exit_code
-
 gdate=`date +'%a %b %e %H:%M:%S %Z %YAAAAA%Y%m%dBBBBB%Y%m%d%H%M%SCCCCC%Y-%m-%d %H:%M:%S %Z'`
 
 #date=%a %b %e %H:%M:%S %Z %Y
@@ -127,12 +114,57 @@ date_starttime=`echo $gdate |sed -e "s/^.*BBBBB//;s/CCCCC.*$//"`
 #date_locale_independent=%Y-%m-%d %H:%M:%S %Z
 date_locale_independent=`echo $gdate |sed -e "s/^.*CCCCC//"`
 
+if test -f $errfile || test -f $logdir/log; then
+       process_name=`grep "^INFO .* .* pid " $logdir/log | head -n 1 | awk '{print $2}'`
+       echo `_ '%s: %s is already running, or you must run amcleanup' "$0" "${process_name}"` 1>&2
+       echo "INFO amdump amdump pid $$" > $logdir/log.$$
+       echo "START driver date $date_starttime" >> $logdir/log.$$
+       echo "ERROR amdump " `_ '%s is already running, or you must run amcleanup' "${process_name}"` >> $logdir/log.$$
+       $sbindir/amreport$SUF $conf -l $logdir/log.$$ "$@"
+       rm -f $logdir/log.$$
+       exit 1;
+fi
+
+umask 077
+
+echo "INFO amdump amdump pid $$" > $logdir/log
+exit_code=0
+# Plan and drive the dumps.
+#exec </dev/null >$errfile 2>&1
+touch $errfile
+exit_code=$?
+[ $exit_code -ne 0 ] && exit_status=$exit_code
+exec </dev/null 2>>$errfile 1>&2
+exit_code=$?
+[ $exit_code -ne 0 ] && exit_status=$exit_code
+
 printf '%s: start at %s\n' "amdump" "$date"
 printf '%s: datestamp %s\n' "amdump" "$date_datestamp"
 printf '%s: starttime %s\n' "amdump" "$date_starttime"
 printf '%s: starttime-locale-independent %s\n' "amdump" "$date_locale_independent"
 
-$amlibexecdir/planner$SUF $conf --starttime $date_starttime "$@" | $amlibexecdir/driver$SUF $conf "$@"
+# shells don't do well with handling exit values from pipelines, so we emulate
+# a pipeline in perl, in such a way that we can combine both exit statuses in a
+# kind of logical "OR".
+@PERL@ - $amlibexecdir/planner$SUF $amlibexecdir/driver$SUF $conf $date_starttime "$@" <<'EOPERL'
+use IPC::Open3;
+use POSIX qw(WIFEXITED WEXITSTATUS);
+my ($planner, $driver, $conf, $date_starttime, @args) = @ARGV;
+
+open3("</dev/null", \*PIPE, ">&STDERR", $planner, $conf, '--starttime', $date_starttime, @args)
+    or die "Could not exec $planner: $!";
+open3("<&PIPE", ">&STDOUT", ">&STDERR", $driver, $conf, @args)
+    or die "Could not exec $driver: $!";
+
+my $first_bad_exit = 0;
+for (my $i = 0; $i < 2; $i++) {
+    my $dead = wait();
+    die("Error waiting: $!") if ($dead <= 0);
+    my $exit = WIFEXITED($?)? WEXITSTATUS($?) : 1;
+    $first_bad_exit = $exit if ($exit && !$first_bad_exit)
+}
+exit $first_bad_exit;
+EOPERL
 exit_code=$?
 [ $exit_code -ne 0 ] && exit_status=$exit_code
 printf '%s: end at %s\n' "amdump" "`date`"
@@ -170,7 +202,6 @@ while [ $days -ge 2 ]; do
        ndays=`expr $days - 1`
        mv $errfile.$ndays $errfile.$days
        exit_code=$?
-       echo $exit_code
        [ $exit_code -ne 0 ] && exit_status=$exit_code
        days=$ndays
 done
index 4515e67298480a93325060f7dfb1795e7145f86d..e2a9d10b3680445cd7ad3d542f65637e87a95bb1 100644 (file)
@@ -79,7 +79,6 @@ main(
     pid_t driver_pid, reporter_pid;
     amwait_t exitcode;
     int opt;
-    dumpfile_t file;
     GSList *holding_list=NULL, *holding_file;
     int driver_pipe[2];
     char date_string[100];
@@ -154,24 +153,30 @@ main(
        /*NOTREACHED*/
     }
 
-    config_init(CONFIG_INIT_EXPLICIT_NAME | CONFIG_INIT_FATAL,
+    config_init(CONFIG_INIT_EXPLICIT_NAME,
                argv[0]);
     apply_config_overwrites(cfg_ovr);
-    check_running_as(RUNNING_AS_DUMPUSER);
-
-    dbrename(config_name, DBG_SUBDIR_SERVER);
 
     conf_diskfile = config_dir_relative(getconf_str(CNF_DISKFILE));
-    if (read_diskfile(conf_diskfile, &diskq) < 0) {
-       error(_("could not read disklist file \"%s\""), conf_diskfile);
-       /*NOTREACHED*/
+    read_diskfile(conf_diskfile, &diskq);
+    amfree(conf_diskfile);
+
+    if (config_errors(NULL) >= CFGERR_WARNINGS) {
+       config_print_errors();
+       if (config_errors(NULL) >= CFGERR_ERRORS) {
+           g_critical(_("errors processing config file"));
+       }
     }
+
+    check_running_as(RUNNING_AS_DUMPUSER);
+
+    dbrename(get_config_name(), DBG_SUBDIR_SERVER);
+
     errstr = match_disklist(&diskq, argc-1, argv+1);
     if (errstr) {
        g_printf(_("%s"),errstr);
        amfree(errstr);
     }
-    amfree(conf_diskfile);
 
     conf_tapelist = config_dir_relative(getconf_str(CNF_TAPELIST));
     if(read_tapelist(conf_tapelist)) {
@@ -193,11 +198,16 @@ main(
     conf_logdir = config_dir_relative(getconf_str(CNF_LOGDIR));
     conf_logfile = vstralloc(conf_logdir, "/log", NULL);
     if (access(conf_logfile, F_OK) == 0) {
-       error(_("%s exists: amdump or amflush is already running, or you must run amcleanup"), conf_logfile);
+       run_amcleanup(get_config_name());
+    }
+    if (access(conf_logfile, F_OK) == 0) {
+       char *process_name = get_master_process(conf_logfile);
+       error(_("%s exists: %s is already running, or you must run amcleanup"), conf_logfile, process_name);
        /*NOTREACHED*/
     }
     amfree(conf_logfile);
 
+    log_add(L_INFO, "%s pid %ld", get_pname(), (long)getpid());
     driver_program = vstralloc(amlibexecdir, "/", "driver", versionsuffix(),
                               NULL);
     reporter_program = vstralloc(sbindir, "/", "amreport", versionsuffix(),
@@ -305,7 +315,7 @@ main(
        close(driver_pipe[1]);
        config_options = get_config_options(3);
        config_options[0] = "driver";
-       config_options[1] = config_name;
+       config_options[1] = get_config_name();
        config_options[2] = "nodump";
        safe_fd(-1, 0);
        execve(driver_program, config_options, safe_env());
@@ -324,12 +334,14 @@ main(
     g_fprintf(driver_stream, "DATE %s\n", amflush_timestamp);
     for(holding_file=holding_list; holding_file != NULL;
                                   holding_file = holding_file->next) {
+       dumpfile_t file;
        holding_file_get_dumpfile((char *)holding_file->data, &file);
 
        if (holding_file_size((char *)holding_file->data, 1) <= 0) {
            log_add(L_INFO, "%s: removing file with no data.",
                    (char *)holding_file->data);
            holding_file_unlink((char *)holding_file->data);
+           dumpfile_free_data(&file);
            continue;
        }
 
@@ -358,6 +370,7 @@ main(
                qhname);
        amfree(qdisk);
        amfree(qhname);
+       dumpfile_free_data(&file);
     }
     g_fprintf(stderr, "ENDFLUSH\n"); fflush(stderr);
     g_fprintf(driver_stream, "ENDFLUSH\n"); fflush(driver_stream);
@@ -443,7 +456,7 @@ main(
         */
        config_options = get_config_options(2);
        config_options[0] = "amreport";
-       config_options[1] = config_name;
+       config_options[1] = get_config_name();
        safe_fd(-1, 0);
        execve(reporter_program, config_options, safe_env());
        error(_("cannot exec %s: %s"), reporter_program, strerror(errno));
@@ -465,13 +478,15 @@ main(
        }
     }
 
+    log_add(L_INFO, "pid-done %ld", (long)getpid());
+
     /*
      * Call amlogroll to rename the log file to its datestamped version.
      * Since we exec at this point, our exit code will be that of amlogroll.
      */
     config_options = get_config_options(2);
     config_options[0] = "amlogroll";
-    config_options[1] = config_name;
+    config_options[1] = get_config_name();
     safe_fd(-1, 0);
     execve(logroll_program, config_options, safe_env());
     error(_("cannot exec %s: %s"), logroll_program, strerror(errno));
@@ -486,7 +501,7 @@ get_letter_from_user(void)
     int r, ch;
 
     fflush(stdout); fflush(stderr);
-    while((ch = getchar()) != EOF && ch != '\n' && isspace(ch)) {
+    while((ch = getchar()) != EOF && ch != '\n' && g_ascii_isspace(ch)) {
        (void)ch; /* Quite lint */
     }
     if(ch == '\n') {
@@ -556,14 +571,14 @@ pick_datestamp(void)
 
            a = answer;
            while ((ch = *a++) != '\0') {
-               if (!isspace(ch))
+               if (!g_ascii_isspace(ch))
                    break;
            }
 
            /* rewrite the selected list into r_datestamp_list, then copy it over
             * to datestamp_list */
            do {
-               if (isspace(ch) || ch == ',') {
+               if (g_ascii_isspace(ch) || ch == ',') {
                    continue;
                }
                chupper = (char)toupper(ch);
index 920da30290a0ef15417bd307b0d48c5f108e0440..708d1535fd9c806f03947a6d1adcb5832d363538 100644 (file)
 #include "disk_history.h"
 #include "list_dir.h"
 #include "logfile.h"
-#include "token.h"
 #include "find.h"
 #include "tapefile.h"
 #include "util.h"
 #include "amandad.h"
 #include "pipespawn.h"
 #include "sockaddr-util.h"
+#include "amxml.h"
 
 #include <grp.h>
 
@@ -203,6 +203,7 @@ uncompress_file(
                                 filename, strerror(errno));
            dbprintf("%s\n",*emsg);
            amfree(filename);
+           aclose(nullfd);
            return NULL;
        }
 
@@ -213,7 +214,7 @@ uncompress_file(
 
        /* start the uncompress process */
        putenv(stralloc("LC_ALL=C"));
-       pid_gzip = pipespawn(UNCOMPRESS_PATH, STDOUT_PIPE,
+       pid_gzip = pipespawn(UNCOMPRESS_PATH, STDOUT_PIPE, 0,
                             &nullfd, &pipe_from_gzip, &debugfd,
                             UNCOMPRESS_PATH, PARAM_UNCOMPRESS_OPT,
                             filename_gz, NULL);
@@ -225,12 +226,13 @@ uncompress_file(
                                 strerror(errno));
            dbprintf("%s\n",*emsg);
            amfree(filename);
+           aclose(indexfd);
            return NULL;
        }
 
        /* start the sort process */
        putenv(stralloc("LC_ALL=C"));
-       pid_sort = pipespawn(SORT_PATH, STDIN_PIPE,
+       pid_sort = pipespawn(SORT_PATH, STDIN_PIPE, 0,
                             &pipe_to_sort, &indexfd, &debugfd,
                             SORT_PATH, NULL);
        aclose(indexfd);
@@ -241,7 +243,7 @@ uncompress_file(
            if (line[0] != '\0') {
                if (index(line,'/')) {
                    clean_backslash(line);
-                   fullwrite(pipe_to_sort,line,strlen(line));
+                   full_write(pipe_to_sort,line,strlen(line));
                }
            }
        }
@@ -299,8 +301,7 @@ process_ls_dump(
     int                recursive,
     char **    emsg)
 {
-    char line[STR_SIZE];
-    char *old_line = NULL;
+    char line[STR_SIZE], old_line[STR_SIZE];
     char *filename = NULL;
     char *filename_gz;
     char *dir_slash = NULL;
@@ -309,6 +310,7 @@ process_ls_dump(
     int ch;
     size_t len_dir_slash;
 
+    old_line[0] = '\0';
     if (strcmp(dir, "/") == 0) {
        dir_slash = stralloc(dir);
     } else {
@@ -322,7 +324,8 @@ process_ls_dump(
        amfree(filename_gz);
        return -1;
     }
-    if((filename = uncompress_file(filename_gz, emsg)) == NULL) {
+    filename = uncompress_file(filename_gz, emsg);
+    if(filename == NULL) {
        amfree(filename_gz);
        amfree(dir_slash);
        return -1;
@@ -333,6 +336,7 @@ process_ls_dump(
        amfree(*emsg);
        *emsg = vstrallocf("%s", strerror(errno));
        amfree(dir_slash);
+        amfree(filename);
        return -1;
     }
 
@@ -353,16 +357,14 @@ process_ls_dump(
                    }
                    s[-1] = '\0';
                }
-               if(old_line == NULL || strcmp(line, old_line) != 0) {
+               if(strcmp(line, old_line) != 0) {
                    add_dir_list_item(dump_item, line);
-                   amfree(old_line);
-                   old_line = stralloc(line);
+                   strcpy(old_line, line);
                }
            }
        }
     }
     afclose(fp);
-    /*@i@*/ amfree(old_line);
     amfree(filename);
     amfree(dir_slash);
     return 0;
@@ -491,7 +493,7 @@ is_dump_host_valid(
     am_host_t   *ihost;
     disk_t      *diskp;
 
-    if (config_name == NULL) {
+    if (get_config_name() == NULL) {
        reply(501, _("Must set config before setting host."));
        return NULL;
     }
@@ -528,7 +530,7 @@ is_disk_valid(
     disk_t *idisk;
     char *qdisk;
 
-    if (config_name == NULL) {
+    if (get_config_name() == NULL) {
        reply(501, _("Must set config,host before setting disk."));
        return -1;
     }
@@ -574,7 +576,8 @@ check_and_load_config(
     }
 
     /* (re-)initialize configuration with the new config name */
-    if (!config_init(CONFIG_INIT_EXPLICIT_NAME, config)) {
+    config_init(CONFIG_INIT_EXPLICIT_NAME, config);
+    if (config_errors(NULL) >= CFGERR_ERRORS) {
        reply(501, _("Could not read config file for %s!"), config);
        return -1;
     }
@@ -582,12 +585,12 @@ check_and_load_config(
     check_running_as(RUNNING_AS_DUMPUSER_PREFERRED);
 
     conf_diskfile = config_dir_relative(getconf_str(CNF_DISKFILE));
-    if (read_diskfile(conf_diskfile, &disk_list) < 0) {
+    read_diskfile(conf_diskfile, &disk_list);
+    amfree(conf_diskfile);
+    if (config_errors(NULL) >= CFGERR_ERRORS) {
        reply(501, _("Could not read disk file %s!"), conf_diskfile);
-       amfree(conf_diskfile);
        return -1;
     }
-    amfree(conf_diskfile);
 
     conf_tapelist = config_dir_relative(getconf_str(CNF_TAPELIST));
     if(read_tapelist(conf_tapelist)) {
@@ -597,10 +600,13 @@ check_and_load_config(
     }
     amfree(conf_tapelist);
 
-    dbrename(config_name, DBG_SUBDIR_SERVER);
+    dbrename(get_config_name(), DBG_SUBDIR_SERVER);
 
     output_find = find_dump(&disk_list);
-    sort_find_result("DLKHpB", &output_find);
+    /* the 'w' here sorts by write timestamp, so that the first instance of
+     * any particular datestamp/host/disk/level/part that we see is the one
+     * written earlier */
+    sort_find_result("DLKHpwB", &output_find);
 
     conf_indexdir = config_dir_relative(getconf_str(CNF_INDEXDIR));
     if (stat (conf_indexdir, &dir_stat) != 0 || !S_ISDIR(dir_stat.st_mode)) {
@@ -624,7 +630,7 @@ build_disk_table(void)
     int last_partnum;
     find_result_t *find_output;
 
-    if (config_name == NULL) {
+    if (get_config_name() == NULL) {
        reply(590, _("Must set config,host,disk before building disk table"));
        return -1;
     }
@@ -721,7 +727,7 @@ disk_history_list(void)
     DUMP_ITEM *item;
     char date[20];
 
-    if (config_name == NULL) {
+    if (get_config_name() == NULL) {
        reply(502, _("Must set config,host,disk before listing history"));
        return -1;
     }
@@ -735,7 +741,7 @@ disk_history_list(void)
     }
 
     lreply(200, _(" Dump history for config \"%s\" host \"%s\" disk %s"),
-         config_name, dump_hostname, qdisk_name);
+         get_config_name(), dump_hostname, qdisk_name);
 
     for (item=first_dump(); item!=NULL; item=next_dump(item)){
         char *tapelist_str = marshal_tapelist(item->tapes, 1);
@@ -756,7 +762,7 @@ disk_history_list(void)
     }
 
     reply(200, _("Dump history for config \"%s\" host \"%s\" disk %s"),
-         config_name, dump_hostname, qdisk_name);
+         get_config_name(), dump_hostname, qdisk_name);
 
     return 0;
 }
@@ -781,7 +787,7 @@ is_dir_valid_opaque(
     size_t ldir_len;
     static char *emsg = NULL;
 
-    if (config_name == NULL || dump_hostname == NULL || disk_name == NULL) {
+    if (get_config_name() == NULL || dump_hostname == NULL || disk_name == NULL) {
        reply(502, _("Must set config,host,disk before asking about directories"));
        return -1;
     }
@@ -889,7 +895,7 @@ opaque_ls(
 
     clear_dir_list();
 
-    if (config_name == NULL) {
+    if (get_config_name() == NULL) {
        reply(502, _("Must set config,host,disk before listing a directory"));
        return -1;
     }
@@ -1021,7 +1027,7 @@ tapedev_is(void)
     char *result;
 
     /* check state okay to do this */
-    if (config_name == NULL) {
+    if (get_config_name() == NULL) {
        reply(501, _("Must set config before asking about tapedev."));
        return -1;
     }
@@ -1030,21 +1036,21 @@ tapedev_is(void)
     if ((result = getconf_str(CNF_AMRECOVER_CHANGER)) != NULL  &&
         *result != '\0') {
        dbprintf(_("tapedev_is amrecover_changer: %s\n"), result);
-       reply(200, result);
+       reply(200, "%s", result);
        return 0;
     }
 
     /* use changer if possible */
     if ((result = getconf_str(CNF_TPCHANGER)) != NULL  &&  *result != '\0') {
        dbprintf(_("tapedev_is tpchanger: %s\n"), result);
-       reply(200, result);
+       reply(200, "%s", result);
        return 0;
     }
 
     /* get tapedev value */
     if ((result = getconf_str(CNF_TAPEDEV)) != NULL  &&  *result != '\0') {
        dbprintf(_("tapedev_is tapedev: %s\n"), result);
-       reply(200, result);
+       reply(200, "%s", result);
        return 0;
     }
 
@@ -1062,7 +1068,7 @@ are_dumps_compressed(void)
     disk_t *diskp;
 
     /* check state okay to do this */
-    if (config_name == NULL) {
+    if (get_config_name() == NULL) {
        reply(501, _("Must set config,host,disk name before asking about dumps."));
        return -1;
     }
@@ -1233,6 +1239,10 @@ main(
        /* read the REQ packet */
        for(; (line = agets(stdin)) != NULL; free(line)) {
            if(strncmp_const(line, "OPTIONS ") == 0) {
+                if (g_options != NULL) {
+                   dbprintf(_("REQ packet specified multiple OPTIONS.\n"));
+                    free_g_options(g_options);
+                }
                g_options = parse_g_options(line+8, 1);
                if(!g_options->hostname) {
                    g_options->hostname = alloc(MAX_HOSTNAME_LENGTH+1);
@@ -1401,11 +1411,11 @@ main(
            int nbhost = 0,
                 found = 0;
            s[-1] = '\0';
-           if (config_name == NULL) {
+           if (get_config_name() == NULL) {
                reply(501, _("Must set config before listhost"));
            }
            else {
-               lreply(200, _(" List hosts for config %s"), config_name);
+               lreply(200, _(" List hosts for config %s"), get_config_name());
                for (disk = disk_list.head; disk!=NULL; disk = disk->next) {
                     found = 0;
                    for (diskdup = disk_list.head; diskdup!=disk; diskdup = diskdup->next) {
@@ -1420,10 +1430,10 @@ main(
                     }
                }
                if(nbhost > 0) {
-                   reply(200, _(" List hosts for config %s"), config_name);
+                   reply(200, _(" List hosts for config %s"), get_config_name());
                }
                else {
-                   reply(200, _("No hosts for config %s"), config_name);
+                   reply(200, _("No hosts for config %s"), get_config_name());
                }
            }
            s[-1] = (char)ch;
@@ -1437,12 +1447,46 @@ main(
                }
            }
            s[-1] = (char)ch;
+       } else if (strcmp(cmd, "DLE") == 0) {
+           disk_t *dp;
+           char *optionstr;
+           char *b64disk;
+           char *l, *ql;
+
+           dp = lookup_disk(dump_hostname, disk_name);
+           if (dp->line == 0) {
+               reply(200, "NODLE");
+           } else {
+               b64disk = amxml_format_tag("disk", dp->name);
+               optionstr = xml_optionstr(dp, their_features, NULL, 0);
+               l = vstralloc("<dle>\n",
+                             "  <program>", dp->program, "</program>\n", NULL);
+               if (dp->application) {
+                   char *xml_app = xml_application(dp->application,
+                                                   their_features);
+                   vstrextend(&l, xml_app, NULL);
+                   amfree(xml_app);
+               }
+               vstrextend(&l, "  ", b64disk, "\n", NULL);
+               if (dp->device) {
+                   char *b64device = amxml_format_tag("diskdevice", dp->device);
+                   vstrextend(&l, "  ", b64device, "\n", NULL);
+                   amfree(b64device);
+               }
+               vstrextend(&l, optionstr, "</dle>\n", NULL);
+               ql = quote_string(l);
+               reply(200, "%s", ql);
+               amfree(optionstr);
+               amfree(l);
+               amfree(ql);
+               amfree(b64disk);
+           }
        } else if (strcmp(cmd, "LISTDISK") == 0) {
            char *qname;
            disk_t *disk;
            int nbdisk = 0;
            s[-1] = '\0';
-           if (config_name == NULL) {
+           if (get_config_name() == NULL) {
                reply(501, _("Must set config, host before listdisk"));
            }
            else if (dump_hostname == NULL) {
@@ -1495,7 +1539,7 @@ main(
                amfree(dump_hostname);          /* invalidate any value */
                amfree(qdisk_name);             /* invalidate any value */
                amfree(disk_name);              /* invalidate any value */
-               reply(200, _("Config set to %s."), config_name);
+               reply(200, _("Config set to %s."), get_config_name());
            } /* check_and_load_config replies with any failure messages */
            s[-1] = (char)ch;
        } else if (strcmp(cmd, "FEATURES") == 0 && arg) {
index 0eda70b62afdc5bd3f45c7f7b6a2424be322ae78..d733b29321fe712ec3ce8811a7976cc0cc06c73d 100644 (file)
@@ -46,25 +46,6 @@ static void usage(void) {
     exit(1);
 }
 
-static void print_read_label_status_error(ReadLabelStatusFlags status) {
-    char ** status_strv;
-
-    if (status == READ_LABEL_STATUS_SUCCESS)
-        return;
-
-    status_strv = g_flags_nick_to_strv(status,
-                                       READ_LABEL_STATUS_FLAGS_TYPE);
-    g_assert(g_strv_length(status_strv) > 0);
-    if (g_strv_length(status_strv) == 1) {
-        g_printf("Error was %s.\n", *status_strv);
-    } else {
-        char * status_list = g_english_strjoinv(status_strv, "or");
-        g_printf("Error was one of %s.\n", status_list);
-        amfree(status_list);
-    }
-    g_strfreev(status_strv);
-}
-
 int
 main(
     int                argc,
@@ -81,7 +62,7 @@ main(
     size_t tt_blocksize_kb;
     int slotcommand;
     Device * device;
-    ReadLabelStatusFlags label_status;
+    DeviceStatusFlags device_status;
     char *cfg_opt = NULL;
     config_overwrites_t *cfg_ovr = NULL;
 
@@ -129,13 +110,19 @@ main(
        slotcommand = 0;
     }
 
-    config_init(CONFIG_INIT_EXPLICIT_NAME | CONFIG_INIT_FATAL,
-               cfg_opt);
+    config_init(CONFIG_INIT_EXPLICIT_NAME, cfg_opt);
     apply_config_overwrites(cfg_ovr);
 
+    if (config_errors(NULL) >= CFGERR_WARNINGS) {
+       config_print_errors();
+       if (config_errors(NULL) >= CFGERR_ERRORS) {
+           g_critical(_("errors processing config file"));
+       }
+    }
+
     check_running_as(RUNNING_AS_DUMPUSER);
 
-    dbrename(config_name, DBG_SUBDIR_SERVER);
+    dbrename(get_config_name(), DBG_SUBDIR_SERVER);
 
     conf_tapelist = config_dir_relative(getconf_str(CNF_TAPELIST));
     if (read_tapelist(conf_tapelist)) {
@@ -163,7 +150,7 @@ main(
        if(slotcommand) {
            g_fprintf(stderr,
             _("%s: no tpchanger specified in \"%s\", so slot command invalid\n"),
-                   argv[0], config_filename);
+                   argv[0], get_config_filename());
            usage();
        }
        tapename = getconf_str(CNF_TAPEDEV);
@@ -185,24 +172,39 @@ main(
     tape_ok=1;
     g_printf("Reading label...\n");fflush(stdout);
     device = device_open(tapename);
-    if (device == NULL) {
-        error("Could not open device %s.\n", tapename);
+    g_assert(device != NULL);
+    if (device->status != DEVICE_STATUS_SUCCESS) {
+        error("Could not open device %s: %s.\n", tapename,
+             device_error(device));
     }
-    
-    device_set_startup_properties_from_config(device);
-    label_status = device_read_label(device);
-
-    if (label_status & READ_LABEL_STATUS_VOLUME_UNLABELED) {
-        g_printf("Found an unlabeled tape.\n");
-    } else if (label_status != READ_LABEL_STATUS_SUCCESS) {
-        g_printf("Reading the tape label failed: \n  ");
-        print_read_label_status_error(label_status);
+
+    if (!device_configure(device, TRUE)) {
+        error("Could not configure device %s: %s.\n", tapename,
+             device_error(device));
+    }
+
+    device_status = device_read_label(device);
+
+    if (device_status & DEVICE_STATUS_VOLUME_UNLABELED) {
+       /* if there's no header, then the tape was truly empty; otherwise, there
+        * was *something* on the tape, so let's be careful and require a force */
+       if (!device->volume_header || device->volume_header->type == F_EMPTY) {
+           g_printf("Found an empty tape.\n");
+       } else {
+           g_printf("Found a non-Amanda tape.\n");
+           if(!force)
+               tape_ok=0;
+       }
+    } else if (device_status != DEVICE_STATUS_SUCCESS) {
+        g_printf("Reading the tape label failed: %s.\n",
+                device_error_or_status(device));
         tape_ok = 0;
     } else {
        /* got an amanda tape */
        g_printf(_("Found Amanda tape %s"),device->volume_label);
        if(match(labelstr, device->volume_label) == 0) {
-           g_printf(_(", but it is not from configuration %s."), config_name);
+           g_printf(_(", but it is not from configuration %s."),
+                    get_config_name());
            if(!force)
                tape_ok=0;
        } else {
@@ -222,20 +224,22 @@ main(
         
        timestamp = get_undef_timestamp();
         if (!device_start(device, ACCESS_WRITE, label, timestamp)) {
-           error(_("Error writing label.\n"));
+           error(_("Error writing label: %s.\n"),
+                 device_error(device));
             g_assert_not_reached();
        } else if (!device_finish(device)) {
-            error(_("Error closing device.\n"));
+            error(_("Error closing device: %s.\n"),
+                 device_error(device));
             g_assert_not_reached();
         }
        amfree(timestamp);
 
         g_printf(_("Checking label...\n")); fflush(stdout);
 
-        label_status = device_read_label(device);
-        if (label_status != READ_LABEL_STATUS_SUCCESS) {
-            g_printf("Checking the tape label failed: \n  ");
-            print_read_label_status_error(label_status);
+        device_status = device_read_label(device);
+        if (device_status != DEVICE_STATUS_SUCCESS) {
+           g_printf(_("Checking the tape label failed: %s.\n"),
+                    device_error_or_status(device));
             exit(EXIT_FAILURE);
         } else if (device->volume_label == NULL) {
             error(_("no label found.\n"));
@@ -263,12 +267,17 @@ main(
         
         /* XXX add cur_tape number to tape list structure */
         remove_tapelabel(label);
-        add_tapelabel("0", label);
+        add_tapelabel("0", label, NULL);
         if(write_tapelist(conf_tapelist)) {
             error(_("couldn't write tapelist: %s"), strerror(errno));
             /*NOTREACHED*/
         }
-        
+
+        if (have_changer && changer_label(outslot, label) != 0) {
+           error(_("couldn't update barcode database for slot %s, label %s\n"), outslot, label);
+           /*NOTREACHED*/
+       }
+
         g_printf(_("Success!\n"));
     } else {
        g_printf(_("\ntape not labeled\n"));
@@ -280,7 +289,6 @@ main(
     clear_tapelist();
     amfree(outslot);
     amfree(conf_tapelist);
-    config_name=NULL;
     dbclose();
 
     return 0;
index 7875815975622c4bf9539c0076ce9fd259baf4f2..a20ef36266364f1fbc17ce4a6ff0100a09f258cd 100644 (file)
@@ -77,15 +77,21 @@ main(
 
     /* read configuration files */
 
-    config_init(CONFIG_INIT_EXPLICIT_NAME | CONFIG_INIT_USE_CWD | CONFIG_INIT_FATAL,
-               cfg_opt);
+    config_init(CONFIG_INIT_EXPLICIT_NAME | CONFIG_INIT_USE_CWD, cfg_opt);
     apply_config_overwrites(cfg_ovr);
 
+    if (config_errors(NULL) >= CFGERR_WARNINGS) {
+       config_print_errors();
+       if (config_errors(NULL) >= CFGERR_ERRORS) {
+           g_critical(_("errors processing config file"));
+       }
+    }
+
     safe_cd(); /* must happen after config_init */
 
     check_running_as(RUNNING_AS_DUMPUSER);
 
-    dbrename(config_name, DBG_SUBDIR_SERVER);
+    dbrename(get_config_name(), DBG_SUBDIR_SERVER);
 
     conf_logdir = config_dir_relative(getconf_str(CNF_LOGDIR));
     logfname = vstralloc(conf_logdir, "/", "log", NULL);
index 35594e4eaf85b4ed033239cffb13e5ee40320547..0dc5fc1ef98841073401f97e4a31df0497deaefc 100644 (file)
@@ -104,7 +104,7 @@ my $dlfh = new FileHandle "$amadmin $opt_config disklist|" or
     die "$0: error in opening `$amadmin $opt_config disklist' pipe: $!\n";
 $/ = "";
 while (<$dlfh>) {
-    ($host, $disk) = m/    host (.*?):.*    disk (.*?):.*strategy (STANDARD|NOFULL|NOINC|HANOI|INCRONLY).*ignore NO/s;
+    ($host, $disk) = m/    host (.*?):\n.*    disk (.*?):\n.*strategy (STANDARD|NOFULL|NOINC|HANOI|INCRONLY).*ignore NO/ms;
     next unless $host;
     $disks{$host}{$disk}++;
 }
index 3e5a88e04cae137fab1472b534336cb18bb407c5..5a91a7bd4dfde357b34e0b448dbf22401f48413f 100644 (file)
@@ -143,18 +143,7 @@ CleanTapelist () {
 }
 
 
-CleanCurinfo () {
-  [ "xyes" = "x${DebugMode}" ] && set -x
-  (cd ${VarDir} >/dev/null 2>&1) || return $?
-  cd ${VarDir}
-  InfoFileBase=`echo $InfoFile | sed -e 's%.*/%%g'`
-
-  TmpSrc=$InfoFileBase.orig.$$
-  TmpDest=$InfoFileBase.new.$$
-  rm -f ${TmpSrc} ${TmpDest}
-  amadmin${SUF} ${Config} export > ${TmpSrc} || return $?
-  log `_ '%s: preserving original database in %s (exported).' "$0" "${TmpSrc}"`
-  exec < ${TmpSrc} > ${TmpDest} || return $?
+CleanCurinfo_internal() {
   DeadLevel=10
   while read Line; do
     case ${Line} in
@@ -202,7 +191,20 @@ CleanCurinfo () {
        return 1
     esac
   done
-  exec < /dev/tty > /dev/tty
+}
+
+CleanCurinfo () {
+  [ "xyes" = "x${DebugMode}" ] && set -x
+  (cd ${VarDir} >/dev/null 2>&1) || return $?
+  cd ${VarDir}
+  InfoFileBase=`echo $InfoFile | sed -e 's%.*/%%g'`
+
+  TmpSrc=$InfoFileBase.orig.$$
+  TmpDest=$InfoFileBase.new.$$
+  rm -f ${TmpSrc} ${TmpDest}
+  amadmin${SUF} ${Config} export > ${TmpSrc} || return $?
+  log `_ '%s: preserving original database in %s (exported).' "$0" "${TmpSrc}"`
+  CleanCurinfo_internal < ${TmpSrc} > ${TmpDest} || return $?
 
   if [ "xno" = "x${DoNothing}" ]; then
     [ -s ${TmpDest} ] && 
index 09557cb3d8a27caabd0aa333c3df980649e0bdf0..f176f312379cea158c21b042d2633fb4ae8f2222 100755 (executable)
@@ -1,6 +1,6 @@
 #!@PERL@
 #
-# Copyright (c) 2006 Zmanda Inc.  All Rights Reserved.
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License version 2 as published
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 #
-# Contact information: Zmanda Inc, 505 N Mathlida Ave, Suite 120
-# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+# Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
 #
 
+use lib '@amperldir@';
 use Getopt::Long;
 use Time::Local;
 use File::Copy;
 use Socket;   # for gethostbyname
+use Amanda::Paths;
 
-my $confdir="@CONFIG_DIR@";
-my $prefix="@prefix@";
-my $tmpdir="@AMANDA_DBGDIR@";
-$prefix=$prefix;                # avoid warnings about possible typo
-my $exec_prefix="@exec_prefix@";
-$exec_prefix=$exec_prefix;      # ditto
-my $sbindir="@sbindir@";
-my $localstatedir="@localstatedir@";
+my $confdir="$CONFIG_DIR";
+my $tmpdir="$AMANDA_DBGDIR";
 my $amandahomedir="$localstatedir/lib/amanda";
-my $datadir="$amandahomedir/template.d"; #rpm install template files here
+my $templatedir="$amdatadir/template.d"; #rpm install template files here
 my $def_tapedev="file:/$amandahomedir/vtapes";
 
 my $amanda_user="@CLIENT_LOGIN@";
@@ -156,8 +152,8 @@ sub copy_template_file {
        &log_and_die ("ERROR: template is missing\n", 1);
     }
     # create and update amanda.conf
-    open(CONF, "$datadir/amanda-$tplate.conf")
-       || &log_and_die ("ERROR: Cannot open $datadir/amanda-$tplate.conf: $!\n", 1);
+    open(CONF, "$templatedir/amanda-$tplate.conf")
+       || &log_and_die ("ERROR: Cannot open $templatedir/amanda-$tplate.conf: $!\n", 1);
     open(NEWCONF, ">$confdir/$config/amanda.conf") ||
        &log_and_die ("ERROR: Cannot create $confdir/$config/amanda.conf: $!\n", 1);
     chmod ($amanda_conf_perm, "$confdir/$config/amanda.conf") ||
@@ -433,8 +429,8 @@ sub copy_chg_manual_conf {
   if ( $template eq "single-tape" && !defined $changerfile && !defined $tpchanger)
     {
       my $my_changerfile="$confdir/$config/chg-manual.conf";
-      copy("$datadir/chg-manual.conf", $my_changerfile) ||
-       &mprint ("copy $datadir/chg-manual.conf to $my_changerfile failed: $!\n");
+      copy("$templatedir/chg-manual.conf", $my_changerfile) ||
+       &mprint ("copy $templatedir/chg-manual.conf to $my_changerfile failed: $!\n");
     }
 }
 
@@ -508,50 +504,62 @@ unless ( $host ) {
 }
 
 
-&create_conf_dir;
-
+my $need_changer = 0;
 if ( defined $template ) {
-# validate user input to template
+
+    # validate user input to template
     chomp($template);
     my $found = 0;
-    @valid_templates = ( "harddisk", "single-tape", "tape-changer", "s3");
+    @valid_templates = ( "harddisk", "single-tape", "tape-changer", "s3" );
     foreach $elt (@valid_templates) {
-       if ($elt eq lc($template)) {
-           $found = 1;
-           last;
-       }
+        if ( $elt eq lc($template) ) {
+            $found = 1;
+            last;
+        }
+    }
+    unless ($found) {
+        print STDERR
+            "valid inputs to --templates are harddisk, single-tape, tape-changer or S3\n";
+        &usage;
+        exit 1;
     }
-    unless ( $found ) {
-       print STDERR "valid inputs to --templates are harddisk, single-tape, tape-changer or S3\n";
-       &usage;
-       exit 1;
-}
-# if tape-changer is chosen, check if mtx is installed
-    if ($template eq "tape-changer") {
-      my $ok = 0;
-      for $dir ("/usr/sbin", "/usr/local/sbin", "/usr/local/bin", "/usr/bin", "/bin","/opt/csw/sbin",split(":",$oldPATH)) {
-       if ( -e "$dir/mtx" ) {
-         $ok = 1;
-         last;
-       }
-      }
-      unless ($ok) {
-       &mprint      ("ERROR: mtx binary not found, tape-changer template will not work and is not installed.\n");
-       &log_and_die ("ERROR: Please install mtx and rerun the same command.\n", 0);
-      }
-      unless ($changerfile) {$changerfile="$confdir/$config/changer.conf";}
-      open (CCONF, ">$changerfile")
-       || &log_and_die ("ERROR: Cannot create $changerfile: $!\n", 1);
-      close (CCONF);
-  } elsif ($template eq "S3" ) {
 
-      unless ($changerfile) {$changerfile="$confdir/$config/changer.conf";}
-      open (CCONF, ">$changerfile")
-    || &log_and_die ("ERROR: Cannot create $changerfile: $!\n", 1);
-      close (CCONF);
+    # if tape-changer is chosen, check if mtx is installed
+    if ( $template eq "tape-changer" ) {
+        my $ok = 0;
+        for $dir ( "/usr/sbin", "/usr/local/sbin", "/usr/local/bin",
+            "/usr/bin", "/bin", "/opt/csw/sbin", split( ":", $oldPATH ) )
+        {
+            if ( -e "$dir/mtx" ) {
+                $ok = 1;
+                last;
+            }
+        }
+        unless ($ok) {
+            &mprint(
+                "ERROR: mtx binary not found, tape-changer template will not work and is not installed.\n"
+            );
+            &log_and_die(
+                "ERROR: Please install mtx and rerun the same command.\n",
+                0 );
+        }
+       $need_changer = 1;
+    }
+    elsif ( $template eq "S3" ) {
+       $need_changer = 1;
+    }
 
-  }
+}
+
+&create_conf_dir;
 
+if ($need_changer) {
+    unless ($changerfile) {
+       $changerfile = "$confdir/$config/changer.conf";
+    }
+    open( CCONF, ">$changerfile" )
+       || &log_and_die( "ERROR: Cannot create $changerfile: $!\n", 1 );
+    close(CCONF);
 }
 
 &check_gnutarlist_dir;
@@ -561,20 +569,20 @@ my $dtype="$confdir/template.d/dumptypes";
 my $ttype="$confdir/template.d/tapetypes";
 
 unless ( -e $dtype ) {
-    copy("$datadir/dumptypes", $dtype ) ||
+    copy("$templatedir/dumptypes", $dtype ) ||
     &log_and_die ("ERROR: copy dumptypes failed: $!\n", 1);
 }
 
 
 unless ( -e $ttype ) {
-    copy("$datadir/tapetypes", $ttype ) ||
+    copy("$templatedir/tapetypes", $ttype ) ||
     &log_and_die ("ERROR: copy tapetypes file to $ttype failed: $!\n", 1);
 }
 
 
 
 # update $def_config value to the specified config value in advanced.conf
-    open(ADV, "$datadir/advanced.conf") || &log_and_die ("ERROR: Cannot open advanced.conf file: $!\n", 1);
+    open(ADV, "$templatedir/advanced.conf") || &log_and_die ("ERROR: Cannot open advanced.conf file: $!\n", 1);
     open(NEWADV, ">$confdir/$config/advanced.conf") || 
        &log_and_die ("ERROR: Cannot create advanced.conf file: $!\n", 1);
     while (<ADV>) {
diff --git a/server-src/amservice.c b/server-src/amservice.c
new file mode 100644 (file)
index 0000000..22c98c7
--- /dev/null
@@ -0,0 +1,236 @@
+/*
+ * Amanda, The Advanced Maryland Automatic Network Disk Archiver
+ * Copyright (c) 1991-2000 University of Maryland at College Park
+ * All Rights Reserved.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of U.M. not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  U.M. makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as is"
+ * without express or implied warranty.
+ *
+ * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M.
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors: the Amanda Development Team.  Its members are listed in a
+ * file named AUTHORS, in the root directory of this distribution.
+ */
+/*
+ * $Id: amservice.c 11167 2008-05-06 11:53:54Z martineau $
+ *
+ * Take the REQ packet in stdin and output the REP packet in stdout
+ */
+#include "amanda.h"
+#include "util.h"
+#include "conffile.h"
+#include "packet.h"
+#include "protocol.h"
+#include "version.h"
+#include "server_util.h"
+#include "amfeatures.h"
+
+static time_t conf_ctimeout;
+static am_feature_t *our_features = NULL;
+static char *our_feature_string = NULL;
+static int remote_errors = 0;
+
+/* local functions */
+
+void usage(void);
+void client_protocol(char *hostname, char *auth, char *service, FILE *input_file);
+int main(int argc, char **argv);
+
+void
+usage(void)
+{
+    error(_("Usage: amservice%s [-o configoption]* [-f input_file] host auth service"),
+         versionsuffix());
+    /*NOTREACHED*/
+}
+
+int
+main(
+    int                argc,
+    char **    argv)
+{
+    config_overwrites_t *cfg_ovr;
+    char *hostname;
+    char *auth;
+    char *service;
+    int opt;
+    extern int optind;
+    extern char *optarg;
+    FILE *input_file;
+
+    /*
+     * Configure program for internationalization:
+     *   1) Only set the message locale for now.
+     *   2) Set textdomain for all amanda related programs to "amanda"
+     *      We don't want to be forced to support dozens of message catalogs.
+     */  
+    setlocale(LC_MESSAGES, "C");
+    textdomain("amanda"); 
+
+    safe_fd(-1, 0);
+    safe_cd();
+
+    set_pname("amservice");
+    /* drop root privileges */
+    if (!set_root_privs(0)) {
+       error(_("amservice must be run setuid root"));
+    }
+
+    /* Don't die when child closes pipe */
+    signal(SIGPIPE, SIG_IGN);
+
+    dbopen(DBG_SUBDIR_SERVER);
+
+    erroutput_type = ERR_INTERACTIVE;
+
+    our_features = am_init_feature_set();
+    our_feature_string = am_feature_to_string(our_features);
+
+    /* process arguments */
+
+    cfg_ovr = new_config_overwrites(argc/2);
+    input_file = stdin;
+    while((opt = getopt(argc, argv, "o:f:")) != EOF) {
+       switch(opt) {
+       case 'o':       add_config_overwrite_opt(cfg_ovr, optarg);
+                       break;
+       case 'f':       if (*optarg == '/') {
+                           input_file = fopen(optarg, "r");
+                       } else {
+                           char *name = vstralloc(get_original_cwd(), "/",
+                                                  optarg, NULL);
+                           input_file = fopen(name, "r");
+                           amfree(name);
+                       }
+                       if (!input_file)
+                           g_critical("Cannot open output file '%s': %s",
+                               optarg, strerror(errno));
+                       break;
+       }
+    }
+
+    argc -= optind, argv += optind;
+    if(argc < 3) usage();
+
+    /* set a default config */
+    config_init(CONFIG_INIT_CLIENT, NULL);
+    apply_config_overwrites(cfg_ovr);
+    dbrename(get_config_name(), DBG_SUBDIR_SERVER);
+
+    if (config_errors(NULL) >= CFGERR_WARNINGS) {
+       config_print_errors();
+       if (config_errors(NULL) >= CFGERR_ERRORS) {
+           g_critical(_("errors processing config file"));
+       }
+    }
+
+    conf_ctimeout = (time_t)getconf_int(CNF_CTIMEOUT);
+
+    hostname = argv[0];
+    auth = argv[1];
+    service = argv[2];
+
+    /* start client side checks */
+
+    client_protocol(hostname, auth, service, input_file);
+
+    amfree(our_feature_string);
+    am_release_feature_set(our_features);
+    our_features = NULL;
+
+    dbclose();
+    return(remote_errors != 0);
+}
+
+/* --------------------------------------------------- */
+
+static void handle_result(void *, pkt_t *, security_handle_t *);
+void start_host(char *hostname, char *auth, char *req);
+
+void
+start_host(
+    char *hostname,
+    char *auth,
+    char *req)
+{
+    const security_driver_t *secdrv;
+    secdrv = security_getdriver(auth);
+    if (secdrv == NULL) {
+       fprintf(stderr, _("Could not find security driver \"%s\".\n"), auth);
+    } else {
+       protocol_sendreq(hostname, secdrv, amhost_get_security_conf, 
+                        req, conf_ctimeout, handle_result, NULL);
+    }
+
+}
+
+void
+client_protocol(
+    char *hostname,
+    char *auth,
+    char *service,
+    FILE *input_file)
+{
+    char *req, *req1;
+
+    req = g_strdup_printf("SERVICE %s\nOPTIONS features=%s\n",
+                         service, our_feature_string);
+    req1 = malloc(1024);
+    while(fgets(req1, 1024, input_file) != NULL) {
+       vstrextend(&req, req1, NULL);
+    }
+    protocol_init();
+
+    start_host(hostname, auth, req);
+
+    protocol_run();
+
+    fflush(stdout);
+
+    amfree(our_feature_string);
+
+    return;
+}
+
+static void
+handle_result(
+    G_GNUC_UNUSED void *datap,
+    pkt_t *            pkt,
+    security_handle_t *        sech)
+{
+    char *line;
+    char *s;
+    int ch;
+
+    if (pkt == NULL) {
+       g_fprintf(stdout,
+                 _("Request failed: %s\n"), security_geterror(sech));
+       remote_errors++;
+       return;
+    }
+
+    s = pkt->body;
+    ch = *s++;
+    while(ch) {
+       line = s - 1;
+       skip_quoted_line(s, ch);
+       if (s[-2] == '\n') {
+           s[-2] = '\0';
+       }
+
+       fprintf(stdout, "%s\n", line);
+    }
+    fprintf(stdout, "\n");
+}
index 2c32d1b34c3ce9d1fc33a5843e8ac8914b5583dc..538e56545c975eb6c92a7f3b78aba6e51a081065 100644 (file)
@@ -1,4 +1,4 @@
-#!@PERL@ -Tw
+#!@PERL@
 #
 
 # Run perl.
@@ -7,8 +7,12 @@ eval '(exit $?0)' && eval 'exec @PERL@ -S $0 ${1+"$@"}'
                if 0;
 
 require "newgetopt.pl";
+use warnings;
+use lib '@amperldir@';
 use Time::Local;
 use Text::ParseWords;
+use Amanda::Util;
+use Amanda::Process;
 
 delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV', 'PATH'};
 $ENV{'PATH'} = "/bin:/usr/bin:/usr/sbin:/sbin";       # force known path
@@ -20,6 +24,9 @@ $exec_prefix="@exec_prefix@";
 $exec_prefix=$exec_prefix;     # ditto
 $sbindir="@sbindir@";
 
+my $Amanda_process = Amanda::Process->new(0);
+$Amanda_process->load_ps_table();
+
 #$STATUS_STRANGE =  2;
 $STATUS_FAILED  =  4;
 $STATUS_MISSING =  8;
@@ -73,11 +80,11 @@ if ($conf =~ /^([\w.-]+)$/) {          # $1 is untainted
 }
 
 if ( ! -e "$confdir/$conf" ) {
-    print "Configuration directory '" . $confdir/$conf . "' doesn't exist\n";
+    print "Configuration directory '$confdir/$conf' doesn't exist\n";
     exit 1;
 }
 if ( ! -d "$confdir/$conf" ) {
-    print "Configuration directory '" . $confdir/$conf . "' is not a directory\n";
+    print "Configuration directory '$confdir/$conf' is not a directory\n";
     exit 1;
  }
 
@@ -139,6 +146,7 @@ else {
 }
 
 
+my $dead_run = 0;
 if( defined $opt_file) {
        if( $opt_file =~ m,^/, ) {
                $errfile = $opt_file;
@@ -156,6 +164,7 @@ else {
                } else {
                        $errfile="$logdir/amdump.1";
                }
+               $dead_run = 1;
        }
 }
 
@@ -312,10 +321,10 @@ while($lineX = <AMDUMP>) {
                        $esize=$line[14];       #compressed size
                        $esize=32 if $esize<32;
                        $esize{$hostpart}=$esize / $unitdivisor;
-                       if(!defined($line[22])) {
+                       if(!defined($line[25])) {
                                $degr_level{$hostpart}=-1;
                        } else {
-                               $degr_level{$hostpart}=$line[18];
+                               $degr_level{$hostpart}=$line[17];
                                $esize=$line[25];       #compressed size
                                $esize=32 if $esize<32;
                                $degr_size{$hostpart}=$esize / $unitdivisor;
@@ -332,7 +341,13 @@ while($lineX = <AMDUMP>) {
                $holding_file{$hostpart}=$holding_file;
                $level{$hostpart}=$level;
        } elsif($line[0] eq "driver") {
-               if($line[1] eq "start" && $line[2] eq "time") {
+               if($line[1] eq "pid") {
+                       $pid = $line[2];
+                       if (! $Amanda_process->process_alive($pid, "driver")) {
+                               $dead_run = 1;
+                       }
+               }
+               elsif($line[1] eq "start" && $line[2] eq "time") {
                        $start_time=$line[3];
                        $current_time=$line[3];
                        $dumpers_active[0]=0;
@@ -707,6 +722,16 @@ while($lineX = <AMDUMP>) {
                        $ntsize{$nb_tape} = 0;
                        $ntesize{$nb_tape} = 0;
                }
+               elsif($line[1] eq "using") {
+                       #1:"using" #2:"label" #3:`label' #4:date #5 `timestamp'
+                       $nb_tape++;
+                       $lineX =~ /using label `(\S*)'/;
+                       $label = $1;
+                       $ntlabel{$nb_tape} = $label;
+                       $ntpartition{$nb_tape} = 0;
+                       $ntsize{$nb_tape} = 0;
+                       $ntesize{$nb_tape} = 0;
+               }
        }
    elsif($line[0] eq "splitting" &&
                         $line[1] eq "chunk" &&
@@ -791,6 +816,7 @@ foreach $host (sort @hosts) {
 
 foreach $host (sort @hosts) {
        foreach $partition (sort @$host) {
+          $qpartition = Amanda::Util::quote_string($partition);
           foreach $datestamp (sort @datestamp) {
                        $hostpart=&make_hostpart($host,$partition,$datestamp);
                        next if(!defined $estimate{$hostpart} && !defined $flush{$hostpart});
@@ -803,20 +829,31 @@ foreach $host (sort @hosts) {
                        if($estimate_done != 1 && !defined $flush{$hostpart}) {
                                if(defined $estimate{$hostpart}) {
                                        if($estimate{$hostpart} != 1) {
-                                               if( defined $opt_gestimate) {
+                                               if( defined $opt_gestimate ||
+                                                        defined $opt_failed && $dead_run != 0) {
                                                        printf "%8s ", $datestamp if defined $opt_date;
-                                                       printf "%-${maxnamelength}s", "$host:$partition";
-                                                       print "              getting estimate\n";
+                                                       printf "%-${maxnamelength}s", "$host:$qpartition";
+                                                       print "             ";
+                                                       if ($dead_run) {
+                                                               print " failed: killed while";
+                                                               $exit_status |= $STATUS_FAILED;
+                                                       }
+                                                       print " getting estimate\n";
                                                }
                                        }
                                        else {
                                                if(defined $opt_estimate ||
-                                                       (defined $opt_gestimate && $partialestimate{$hostpart} == 1)) {
+                                                       (defined $opt_gestimate && $partialestimate{$hostpart} == 1) ||
+                                                       (defined $opt_failed && $dead_run != 0 && $partialestimate{$hostpart} == 1)) {
                                                        printf "%8s ", $datestamp if defined $opt_date;
-                                                       printf "%-${maxnamelength}s", "$host:$partition";
+                                                       printf "%-${maxnamelength}s", "$host:$qpartition";
                                                        printf "%2d ",  $level{$hostpart};
                                                        printf "%9d$unit", $esize{$hostpart};
                                                        if($partialestimate{$hostpart} == 1) {
+                                                               if ($dead_run) {
+                                                                       print " failed: killed while";
+                                                                       $exit_status |= $STATUS_FAILED;
+                                                               }
                                                                print " partial";
                                                        }
                                                        print " estimate done\n";
@@ -835,7 +872,7 @@ foreach $host (sort @hosts) {
                                        elsif (!defined $dump_started{$hostpart} || $dump_started{$hostpart} == 0) {
                                                if( defined $opt_failed) {
                                                        printf "%8s ", $datestamp if defined $opt_date;
-                                                       printf "%-${maxnamelength}s%2d ", "$host:$partition", $level{$hostpart};
+                                                       printf "%-${maxnamelength}s%2d ", "$host:$qpartition", $level{$hostpart};
                                                        printf "           no estimate\n";
                                                }
                                                $exit_status |= $STATUS_FAILED;
@@ -850,22 +887,12 @@ foreach $host (sort @hosts) {
                                }
                                if(defined $taper_started{$hostpart} &&
                                                $taper_started{$hostpart}==1) {
-                                       if(defined $dump_started{$hostpart}) {
-                                               $dpartition++;
-                                               if(defined($size{$hostpart})) {
-                                                       $dsize += $size{$hostpart};
-                                               }
-                                               else {
-                                                       $dsize += $esize{$hostpart};
-                                               }
-                                               $desize += $esize{$hostpart};
-                                       }
                                        if(defined $dump_started{$hostpart} &&
                                                $dump_started{$hostpart} == 1 &&
                                                        $dump_finished{$hostpart} == -1) {
                                                if(defined $opt_failed) {
                                                        printf "%8s ", $datestamp if defined $opt_date;
-                                                       printf "%-${maxnamelength}s%2d ", "$host:$partition", $level{$hostpart};
+                                                       printf "%-${maxnamelength}s%2d ", "$host:$qpartition", $level{$hostpart};
                                                        printf "%9d$unit", $esize{$hostpart};
                                                        print " dump to tape failed: " . $error{$hostpart};
                                                        print "\n";
@@ -877,11 +904,20 @@ foreach $host (sort @hosts) {
                                                $dump_started{$hostpart} == 1 &&
                                                        $dump_finished{$hostpart} == 0 &&
                                                        $taper_started{$hostpart} == 1) {
-                                               if( defined $opt_dumpingtape ) {
+                                               if( defined $opt_dumpingtape ||
+                                                        defined $opt_failed && $dead_run != 0) {
                                                        printf "%8s ", $datestamp if defined $opt_date;
-                                                       printf "%-${maxnamelength}s%2d ", "$host:$partition", $level{$hostpart};
+                                                       printf "%-${maxnamelength}s%2d ", "$host:$qpartition", $level{$hostpart};
                                                        printf "%9d$unit", $esize{$hostpart};
+                                                       if ($dead_run) {
+                                                               print " failed: killed while";
+                                                               $exit_status |= $STATUS_FAILED;
+                                                       }
                                                        print " dumping to tape";
+                                                       if(defined($tapedsize{$hostpart})) {
+                                                               printf " (%d$unit done)", $tapedsize{$hostpart};
+                                                               $dtsize += $tapedsize{$hostpart};
+                                                       }
                                                        if( defined $starttime ) {
                                                                print " (", &showtime($taper_time{$hostpart}), ")";
                                                        }
@@ -891,10 +927,15 @@ foreach $host (sort @hosts) {
                                                $dtesize += $esize{$hostpart};
                                        }
                                        elsif($taper_finished{$hostpart} == 0) {
-                                               if( defined $opt_writingtape ) {
+                                               if( defined $opt_writingtape ||
+                                                        defined $opt_failed && $dead_run != 0) {
                                                        printf "%8s ", $datestamp if defined $opt_date;
-                                                       printf "%-${maxnamelength}s%2d ", "$host:$partition", $level{$hostpart};
+                                                       printf "%-${maxnamelength}s%2d ", "$host:$qpartition", $level{$hostpart};
                                                        printf "%9d$unit", $size{$hostpart};
+                                                       if ($dead_run) {
+                                                               print " failed: killed while";
+                                                               $exit_status |= $STATUS_FAILED;
+                                                       }
                                                        if($in_flush == 0) {
                                                                print " writing to tape";
                                                        }
@@ -942,7 +983,7 @@ foreach $host (sort @hosts) {
                                                if( defined $opt_failed  ||
                                                         (defined $opt_waittaper && ($taper_finished{$hostpart} == -1))) {
                                                        printf "%8s ", $datestamp if defined $opt_date;
-                                                       printf "%-${maxnamelength}s%2d ", "$host:$partition", $level{$hostpart};
+                                                       printf "%-${maxnamelength}s%2d ", "$host:$qpartition", $level{$hostpart};
                                                        printf "%9d$unit", $xsize;
                                                        if($in_flush == 0) {
                                                                print " failed to tape";
@@ -977,7 +1018,7 @@ foreach $host (sort @hosts) {
                                        elsif($taper_finished{$hostpart} == 1) {
                                                if( defined $opt_finished ) {
                                                        printf "%8s ", $datestamp if defined $opt_date;
-                                                       printf "%-${maxnamelength}s%2d ", "$host:$partition", $level{$hostpart};
+                                                       printf "%-${maxnamelength}s%2d ", "$host:$qpartition", $level{$hostpart};
                                                        printf "%9d$unit", $size{$hostpart};
                                                        if($in_flush == 0) {
                                                                print " finished";
@@ -994,18 +1035,23 @@ foreach $host (sort @hosts) {
                                                        }
                                                        print "\n";
                                                }
+                                               $dpartition++;
                                                $tpartition++;
+                                               $dsize += $size{$hostpart};
                                                $tsize += $size{$hostpart};
+                                               $desize += $esize{$hostpart};
                                                if(defined $esize{$hostpart} && $esize{$hostpart} > 1) {
+                                                       $desize += $esize{$hostpart};
                                                        $tesize += $esize{$hostpart};
                                                }
                                                else {
+                                                       $desize += $size{$hostpart};
                                                        $tesize += $size{$hostpart};
                                                }
                                        }
                                        else {
                                                printf "%8s ", $datestamp if defined $opt_date;
-                                               printf "%-${maxnamelength}s%2d ", "$host:$partition", $level{$hostpart};
+                                               printf "%-${maxnamelength}s%2d ", "$host:$qpartition", $level{$hostpart};
                                                print " unknown state TAPER\n";
                                        }
                                }
@@ -1013,7 +1059,7 @@ foreach $host (sort @hosts) {
                                        if($dump_started{$hostpart} == -1) {
                                                if( defined $opt_failed ) {
                                                        printf "%8s ", $datestamp if defined $opt_date;
-                                                       printf "%-${maxnamelength}s%2d ", "$host:$partition", $level{$hostpart};
+                                                       printf "%-${maxnamelength}s%2d ", "$host:$qpartition", $level{$hostpart};
                                                        printf " " . $error{$hostpart} . "\n";
                                                }
                                                $exit_status |= $STATUS_FAILED;
@@ -1025,7 +1071,7 @@ foreach $host (sort @hosts) {
                                                if($estimate{$hostpart} == 1) {
                                                        if( defined $opt_waitdumping ) {
                                                                printf "%8s ", $datestamp if defined $opt_date;
-                                                               printf "%-${maxnamelength}s%2d ", "$host:$partition", $level{$hostpart};
+                                                               printf "%-${maxnamelength}s%2d ", "$host:$qpartition", $level{$hostpart};
                                                                printf "%9d$unit", $esize{$hostpart};
                                                                print " wait for dumping $error{$hostpart}\n";
                                                        }
@@ -1040,7 +1086,7 @@ foreach $host (sort @hosts) {
                                                        $dump_finished{$hostpart} == -1) {
                                                if( defined $opt_failed ) {
                                                        printf "%8s ", $datestamp if defined $opt_date;
-                                                       printf "%-${maxnamelength}s%2d ", "$host:$partition", $level{$hostpart};
+                                                       printf "%-${maxnamelength}s%2d ", "$host:$qpartition", $level{$hostpart};
                                                        print " ", $error{$hostpart};
                                                        if( defined $starttime ) {
                                                                print " (", &showtime($dump_time{$hostpart}), ")";
@@ -1053,10 +1099,15 @@ foreach $host (sort @hosts) {
                                        }
                                        elsif($dump_started{$hostpart} == 1 &&
                                                        $dump_finished{$hostpart} != 1) {
-                                               if( defined $opt_dumping ) {
+                                               if( defined $opt_dumping ||
+                                                        defined $opt_failed && $dead_run != 0) {
                                                        printf "%8s ", $datestamp if defined $opt_date;
-                                                       printf "%-${maxnamelength}s%2d ", "$host:$partition", $level{$hostpart};
+                                                       printf "%-${maxnamelength}s%2d ", "$host:$qpartition", $level{$hostpart};
                                                        printf "%9d$unit", $esize{$hostpart};
+                                                       if ($dead_run) {
+                                                               print " failed: killed while";
+                                                               $exit_status |= $STATUS_FAILED;
+                                                       }
                                                        printf " dumping %8d$unit", $size{$hostpart};
                                                        if($size{$hostpart} != 0) {
                                                                printf " (%6.2f%%)", (100.0*$size{$hostpart})/$esize{$hostpart};
@@ -1077,7 +1128,7 @@ foreach $host (sort @hosts) {
                                                        $taper_started{$hostpart} != 1) {
                                                if( defined $opt_waittaper ) {
                                                        printf "%8s ", $datestamp if defined $opt_date;
-                                                       printf "%-${maxnamelength}s%2d ", "$host:$partition", $level{$hostpart};
+                                                       printf "%-${maxnamelength}s%2d ", "$host:$qpartition", $level{$hostpart};
                                                        printf "%9d$unit", $size{$hostpart};
                                                        print " dump done";
                                                        if( defined $starttime ) {
@@ -1099,14 +1150,14 @@ foreach $host (sort @hosts) {
                                        }
                                        else {
                                                printf "%8s ", $datestamp if defined $opt_date;
-                                               printf "%-${maxnamelength}s%2d ", "$host:$partition", $level{$hostpart};
+                                               printf "%-${maxnamelength}s%2d ", "$host:$qpartition", $level{$hostpart};
                                                print " unknown state DUMPER\n";
                                        }
                                }
                                elsif(defined $flush{$hostpart}) {
                                        if( defined $opt_waittaper ) {
                                                printf "%8s ", $datestamp if defined $opt_date;
-                                               printf "%-${maxnamelength}s%2d ", "$host:$partition", $level{$hostpart};
+                                               printf "%-${maxnamelength}s%2d ", "$host:$qpartition", $level{$hostpart};
                                                printf "%9d$unit", $size{$hostpart};
                                                print " waiting to flush";
                                                if(defined $partial{$hostpart} && $partial{$hostpart} == 1) {
@@ -1120,7 +1171,7 @@ foreach $host (sort @hosts) {
                                }
                                elsif(defined $level{$hostpart}) {
                                        printf "%8s ", $datestamp if defined $opt_date;
-                                       printf "%-${maxnamelength}s%2d ", "$host:$partition", $level{$hostpart};
+                                       printf "%-${maxnamelength}s%2d ", "$host:$qpartition", $level{$hostpart};
                                        print " unknown state\n";
                                }
                        }
@@ -1141,9 +1192,16 @@ if (defined $opt_summary) {
        printf "wait for dumping: %3d %20d$unit           (%6.2f%%)\n",
                $wpartition , $wsize,
                $estsize ? ($wsize * 1.0 / $estsize) * 100 : 0.0;
-       printf "dumping to tape : %3d %20d$unit           (%6.2f%%)\n",
-               $dtpartition, $dtesize,
-               $estsize ? ($dtesize * 1.0 / $estsize) * 100 : 0.0;
+       if(defined($dtsize)) {
+               printf "dumping to tape : %3d %9d$unit %9d$unit (%6.2f%%) (%6.2f%%)\n",
+                       $dtpartition, $dtsize, $dtesize,
+                       $dtsize ? ($dtsize * 1.0 / $dtesize) * 100 : 0.0,
+                       $estsize ? ($dtesize * 1.0 / $estsize) * 100 : 0.0;
+       } else {
+               printf "dumping to tape : %3d %20d$unit           (%6.2f%%)\n",
+                       $dtpartition, $dtesize,
+                       $estsize ? ($dtesize * 1.0 / $estsize) * 100 : 0.0;
+       }
        printf "dumping         : %3d %9d$unit %9d$unit (%6.2f%%) (%6.2f%%)\n",
                $dupartition, $dusize, $duesize,
                $duesize ? ($dusize * 1.0 / $duesize) * 100 : 0.0,
@@ -1195,22 +1253,22 @@ if (defined $opt_summary) {
                $c3 = ($idle_dumpers == 1) ? " " : "";
                printf "%d dumper%s idle%s %s: %s\n", $idle_dumpers, $c1, $c2, $c3, $status_driver;
        }
-       if($status_taper eq "writing" && defined($qlen{"tapeq:"})) {
-               printf "taper writing, tapeq: %d\n", $qlen{"tapeq:"};
+       if($status_taper eq "writing" && defined($qlen{"tapeq"})) {
+               printf "taper writing, tapeq: %d\n", $qlen{"tapeq"};
        }
        else {
                printf "taper idle\n";
        }
-       if (defined ($free{"kps:"})) {
-               printf "network free kps: %9d\n", $free{"kps:"};
+       if (defined ($free{"kps"})) {
+               printf "network free kps: %9d\n", $free{"kps"};
        }
-       if (defined ($free{"space:"})) {
+       if (defined ($free{"space"})) {
                if ($holding_space) {
-                       $hs = ($free{"space:"} * 1.0 / $holding_space) * 100;
+                       $hs = ($free{"space"} * 1.0 / $holding_space) * 100;
                } else {
                        $hs = 0.0;
                }
-               printf "holding space   : %9d$unit (%6.2f%%)\n", ($free{"space:"}/$unitdivisor), $hs;
+               printf "holding space   : %9d$unit (%6.2f%%)\n", ($free{"space"}/$unitdivisor), $hs;
        }
 }
 
index fed07efd571fb00e5307920f16b84c8143671845..365c1af73bd0c04b9c21e205ec8ab05a4b10cae9 100644 (file)
@@ -73,16 +73,12 @@ static const struct {
        T_("slot <slot #>        load tape from slot <slot #>") },
     { "slot" , load_slot,
        T_("slot current         load tape from current slot") },
-    { "slot" , load_slot,
-       T_("slot prev            load tape from previous slot") },
     { "slot" , load_slot,
        T_("slot next            load tape from next slot") },
     { "slot" , load_slot,
        T_("slot advance         advance to next slot but do not load") },
     { "slot" , load_slot,
        T_("slot first           load tape from first slot") },
-    { "slot" , load_slot,
-       T_("slot last            load tape from last slot") },
     { "label", load_label,
        T_("label <label>        find and load labeled tape") },
     { "taper", amtape_taper_scan,
@@ -140,13 +136,19 @@ main(
     cfg_ovr = extract_commandline_config_overwrites(&argc, &argv);
     if(argc < 3) usage();
 
-    config_init(CONFIG_INIT_EXPLICIT_NAME | CONFIG_INIT_FATAL,
-               argv[1]);
+    config_init(CONFIG_INIT_EXPLICIT_NAME, argv[1]);
     apply_config_overwrites(cfg_ovr);
 
+    if (config_errors(NULL) >= CFGERR_WARNINGS) {
+       config_print_errors();
+       if (config_errors(NULL) >= CFGERR_ERRORS) {
+           g_critical(_("errors processing config file"));
+       }
+    }
+
     check_running_as(RUNNING_AS_DUMPUSER);
 
-    dbrename(config_name, DBG_SUBDIR_SERVER);
+    dbrename(get_config_name(), DBG_SUBDIR_SERVER);
 
     conf_tapelist = config_dir_relative(getconf_str(CNF_TAPELIST));
     if (read_tapelist(conf_tapelist)) {
@@ -156,7 +158,7 @@ main(
     amfree(conf_tapelist);
 
     if((have_changer = changer_init()) == 0) {
-       error(_("no tpchanger specified in \"%s\""), config_filename);
+       error(_("no tpchanger specified in \"%s\""), get_config_filename());
        /*NOTREACHED*/
     } else if (have_changer != 1) {
        error(_("changer initialization failed: %s"), strerror(errno));
@@ -246,7 +248,6 @@ load_slot(
     char **    argv)
 {
     char *slotstr = NULL, *devicename = NULL;
-    int is_advance;
     Device * device;
 
     if(argc != 2)
@@ -254,28 +255,25 @@ load_slot(
 
     device_api_init();
 
-    is_advance = (strcmp(argv[1], "advance") == 0);
+    if (strcmp(argv[1], "advance") == 0) {
+       argv[1] = "next";
+    }
+
     if(changer_loadslot(argv[1], &slotstr, &devicename)) {
        error(_("could not load slot %s: %s"), slotstr, changer_resultstr);
        /*NOTREACHED*/
     }
-    
-    if (!is_advance) {
-        device = device_open(devicename);
-        if (device == NULL) {
-            g_fprintf(stderr,
-                    _("%s: could not open device %s"), get_pname(),
-                    devicename);
-        } else {
-            g_object_unref(device);
-        }
-    }
 
-    g_fprintf(stderr, _("%s: changed to slot %s"), get_pname(), slotstr);
-    if(! is_advance) {
-       g_fprintf(stderr, _(" on %s"), devicename);
+    device = device_open(devicename);
+    g_assert(device != NULL);
+    if (device->status != DEVICE_STATUS_SUCCESS) {
+       g_fprintf(stderr,
+               _("%s: could not open device %s: %s"), get_pname(),
+               devicename, device_error(device));
     }
-    fputc('\n', stderr);
+    g_object_unref(device);
+
+    g_fprintf(stderr, _("%s: changed to slot %s on %s\n"), get_pname(), slotstr, devicename);
     amfree(slotstr);
     amfree(devicename);
 }
@@ -321,7 +319,7 @@ loadlabel_slot(
 {
     LabelChangerStatus * status = ud;
     Device * device;
-    ReadLabelStatusFlags label_status;
+    DeviceStatusFlags device_status;
 
     if (rc > 1) {
        error(_("could not load slot %s: %s"), slotstr, changer_resultstr);
@@ -333,22 +331,23 @@ loadlabel_slot(
     }
 
     device = device_open(device_name);
-    if (device == NULL) {
-        g_fprintf(stderr, _("%s: slot %3s: Could not open device.\n"),
-                get_pname(), slotstr);
+    g_assert(device != NULL);
+    if (device->status != DEVICE_STATUS_SUCCESS) {
+        g_fprintf(stderr, _("%s: slot %3s: Could not open device: %s.\n"),
+                  get_pname(), slotstr, device_error(device));
         return 0;
     }
-    
-    device_set_startup_properties_from_config(device);
-
-    label_status = device_read_label(device);
-    if (label_status != READ_LABEL_STATUS_SUCCESS) {
-        char * errstr = 
-            g_english_strjoinv_and_free
-                (g_flags_nick_to_strv(label_status,
-                                      READ_LABEL_STATUS_FLAGS_TYPE), "or");
+
+    if (!device_configure(device, TRUE)) {
+        g_fprintf(stderr, _("%s: slot %3s: Could not configure device: %s.\n"),
+                  get_pname(), slotstr, device_error(device));
+        return 0;
+    }
+
+    device_status = device_read_label(device);
+    if (device_status != DEVICE_STATUS_SUCCESS) {
         g_fprintf(stderr, _("%s: slot %3s: %s\n"),
-                get_pname(), slotstr, errstr);
+                  get_pname(), slotstr, device_error_or_status(device));
         g_object_unref(device);
         return 0;
     }
@@ -421,21 +420,23 @@ show_slots_slot(G_GNUC_UNUSED void * data, int rc, char * slotstr,
     }
 
     device = device_open(device_name);
-    if (device == NULL) {
-        g_fprintf(stderr, _("%s: slot %3s: Could not open device.\n"),
-                get_pname(), slotstr);
+    g_assert(device != NULL);
+    if (device->status != DEVICE_STATUS_SUCCESS) {
+        g_fprintf(stderr, _("%s: slot %3s: Could not open device: %s.\n"),
+                  get_pname(), slotstr, device_error(device));
     } else {
-        ReadLabelStatusFlags label_status;
-        device_set_startup_properties_from_config(device);
-        label_status = device_read_label(device);
-
-        if (label_status != READ_LABEL_STATUS_SUCCESS) {
-            char * errstr = 
-                g_english_strjoinv_and_free
-                (g_flags_nick_to_strv(label_status,
-                                      READ_LABEL_STATUS_FLAGS_TYPE), "or");
+        DeviceStatusFlags device_status;
+
+       if (!device_configure(device, TRUE)) {
+            g_fprintf(stderr, _("%s: slot %3s: %s\n"),
+                      get_pname(), slotstr, device_error_or_status(device));
+       }
+
+       device_status = device_read_label(device);
+
+        if (device_status != DEVICE_STATUS_SUCCESS) {
             g_fprintf(stderr, _("%s: slot %3s: %s\n"),
-                    get_pname(), slotstr, errstr);
+                      get_pname(), slotstr, device_error_or_status(device));
         } else {
             g_fprintf(stderr, _("slot %3s: time %-14s label %s\n"),
                     slotstr, device->volume_time, device->volume_label);
@@ -526,7 +527,7 @@ show_device(G_GNUC_UNUSED int       argc,
     char *slot = NULL, *device = NULL;
     
     if(changer_loadslot(_("current"), &slot, &device)) {
-       error(_("Could not load current slot.\n"));
+       error(_("could not load current slot: %s\n"), changer_resultstr);
        /*NOTREACHED*/
     }
 
index 79d0757a4f20bac862f6cbcad055430e66c56982..f62dcef8b598b8f102606d5c11d8e70fd04f8a26 100644 (file)
@@ -162,11 +162,26 @@ while ( <$IF> ) {
   }
   if ( ! /^([A-Z]+) taper (\S+) (\S+) (\S+) (\S+) (\S+)/) { next;}
   # $_ = $1;
-  $host = $2;
-  $disk = $3;
-  $date = $4;
-  $chunk = $5;
-  $level = $6;
+  if (/PART taper/) {
+    /^([A-Z]+) taper (\S+) (\S+) (\S+) (\S+) (\S+) (\S+) (\S+)/;
+    $filenum = $3;
+    $host = $4;
+    $disk = $5;
+    $date = $6;
+    $chunk = $7;
+    $level = $8;
+    if ($filenum != $filenumber) {
+      # This should not be possible */
+      $filenumber = $filenum;
+    }
+  } else {
+    /^([A-Z]+) taper (\S+) (\S+) (\S+) (\S+) (\S+)/;
+    $host = $2;
+    $disk = $3;
+    $date = $4;
+    $chunk = $5;
+    $level = $6;
+  }
   switch: {
     /START taper/ && do {
       $tocfilename=&tfn($chunk) if ($#subs >= 0);
@@ -191,31 +206,37 @@ while ( <$IF> ) {
       &pr("#","Server","/partition","date", "level","size[Kb]","part");
       &pr("$filenumber","$chunk","","$disk","-","-","-");
       last switch; };
-    /^(?:SUCCESS|CHUNK) taper/ && do {
+    /^(?:SUCCESS|CHUNK|PART|DONE) taper/ && do {
       if(/SUCCESS/){
        $level = $chunk;
        $chunk = "-";
       }
+      $filenum = $filenumber;
+      if (/DONE/) {
+       $chunk = "-";
+       $filenumber--;
+       $filenum = " ";
+      }
       $mysize = 0;
       if(/ kb (\d+) /){
        $mysize = $1;
       }
       if ( $fail{$host}{$disk} ) {
-        &pr("$filenumber","${host}","${disk}","${date}","${level}","FAIL","${chunk}");
+        &pr("$filenum","${host}","${disk}","${date}","${level}","FAIL","${chunk}");
       } else {
        if (defined($flash_mode)) {
-          &pr("$filenumber","${host}","${disk}","${date}","${level}","$mysize","${chunk}");
+          &pr("$filenum","${host}","${disk}","${date}","${level}","$mysize","${chunk}");
        } else {
-         if (defined($osize{$host}{$disk}) && !/^CHUNK/) {
-            &pr("$filenumber","${host}","${disk}","${date}","${level}","$osize{$host}{$disk}","${chunk}");
+         if (defined($osize{$host}{$disk}) && !/^CHUNK/ && !/^PART/) {
+            &pr("$filenum","${host}","${disk}","${date}","${level}","$osize{$host}{$disk}","${chunk}");
          } else {
            $note = "";
-           if(!/^CHUNK/){
+           if(!/^CHUNK/ && !/^PART/){
                # this case should never happend: 
-           $strange=1;
+           } else {
              $note = "*";
            }
-            &pr("$filenumber","${host}","${disk}","${date}","${level}","$note$mysize","${chunk}");
+            &pr("$filenum","${host}","${disk}","${date}","${level}","$note$mysize","${chunk}");
          }
        }
       }
@@ -229,29 +250,26 @@ while ( <$IF> ) {
       $line =~ / fm (\d+) /;
       print "\n\n" if ($vwspace);
       &pr("$1","total","on_tape","-","-","$size","-");
-      if (defined($flash_mode)) {
-       &pr("$1","total","origin","-","not","available","-");
-      } else {
-       &pr("$1","total","origin","-","-","$tot_or_size","-");
-      }
-      if (defined($strange)) {
-       &pr("*","size","on_tape","-","-","-","-");
-      }
       last switch; };
     /FAIL taper/ && do { next; };
   }
   $filenumber += 1;
 }
+if (defined($flash_mode)) {
+  &pr("-","total","origin","-","not","available","-");
+} else {
+  &pr("-","total","origin","-","-","$tot_or_size","-");
+}
 close $IF;
 close OF;
 
 
 format OF =
-@>>  @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<< @>> @>>>>>>>>
+@>>  @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<< @>> @>>>>>>>>
 $fnbr,$hstprt,$dt,$lvl,$sz
 .
 
 format STDOUT =
-@>>  @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<< @>> @>>>>>>>> @>>>
+@>>  @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<< @>> @>>>>>>>> @>>>
 $fnbr,$hstprt,$dt,$lvl,$sz,$ch
 .
index 76c17c7ab22dfe5b33f7ca41e39e054b6aa3f16b..9f9176bbbb568c1fc177325fc44f43fc5ea65d37 100644 (file)
@@ -104,21 +104,24 @@ main(
        return 1;
     }
 
-    config_init(CONFIG_INIT_EXPLICIT_NAME | CONFIG_INIT_FATAL | CONFIG_INIT_USE_CWD,
-       argv[1]);
+    config_init(CONFIG_INIT_EXPLICIT_NAME | CONFIG_INIT_USE_CWD, argv[1]);
     apply_config_overwrites(cfg_ovr);
 
-    check_running_as(RUNNING_AS_DUMPUSER);
-
-    dbrename(config_name, DBG_SUBDIR_SERVER);
-
     conf_diskfile = config_dir_relative(getconf_str(CNF_DISKFILE));
-    if (read_diskfile(conf_diskfile, &diskl) < 0) {
-       error(_("could not load disklist \"%s\""), conf_diskfile);
-       /*NOTREACHED*/
-    }
+    read_diskfile(conf_diskfile, &diskl);
     amfree(conf_diskfile);
 
+    if (config_errors(NULL) >= CFGERR_WARNINGS) {
+       config_print_errors();
+       if (config_errors(NULL) >= CFGERR_ERRORS) {
+           g_critical(_("errors processing config file"));
+       }
+    }
+
+    check_running_as(RUNNING_AS_DUMPUSER);
+
+    dbrename(get_config_name(), DBG_SUBDIR_SERVER);
+
     conf_tapelist = config_dir_relative(getconf_str(CNF_TAPELIST));
     if(read_tapelist(conf_tapelist)) {
        error(_("could not load tapelist \"%s\""), conf_tapelist);
index 460a354fcb25ee0ce415e2a968d186bd67b3289b..530fcf5b8af5aeab92f7db1d8a7fbcdce369c83c 100644 (file)
@@ -100,21 +100,24 @@ main(
     dbopen(DBG_SUBDIR_SERVER);
     dbprintf(_("%s: version %s\n"), argv[0], version());
 
-    config_init(CONFIG_INIT_EXPLICIT_NAME | CONFIG_INIT_FATAL,
-               argv[1]);
+    config_init(CONFIG_INIT_EXPLICIT_NAME, argv[1]);
     apply_config_overwrites(cfg_ovr);
 
-    check_running_as(RUNNING_AS_DUMPUSER);
-
-    dbrename(config_name, DBG_SUBDIR_SERVER);
-
     conf_diskfile = config_dir_relative(getconf_str(CNF_DISKFILE));
-    if (read_diskfile(conf_diskfile, &diskl) < 0) {
-       error(_("could not load disklist \"%s\""), conf_diskfile);
-       /*NOTREACHED*/
-    }
+    read_diskfile(conf_diskfile, &diskl);
     amfree(conf_diskfile);
 
+    if (config_errors(NULL) >= CFGERR_WARNINGS) {
+       config_print_errors();
+       if (config_errors(NULL) >= CFGERR_ERRORS) {
+           g_critical(_("errors processing config file"));
+       }
+    }
+
+    check_running_as(RUNNING_AS_DUMPUSER);
+
+    dbrename(get_config_name(), DBG_SUBDIR_SERVER);
+
     conf_tapelist = config_dir_relative(getconf_str(CNF_TAPELIST));
     if (read_tapelist(conf_tapelist)) {
        error(_("could not load tapelist \"%s\""), conf_tapelist);
diff --git a/server-src/amvault.pl b/server-src/amvault.pl
new file mode 100644 (file)
index 0000000..32c3a36
--- /dev/null
@@ -0,0 +1,459 @@
+#! @PERL@
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 as published
+# by the Free Software Foundation.
+#
+# 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.,
+# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+use lib '@amperldir@';
+use strict;
+
+package Amvault;
+
+use Amanda::Config qw( :getconf config_dir_relative );
+use Amanda::Debug qw( :logging );
+use Amanda::Device qw( :constants );
+use Amanda::Xfer qw( :constants );
+use Amanda::Types qw( :filetype_t );
+use Amanda::MainLoop;
+use Amanda::DB::Catalog;
+use Amanda::Changer;
+
+my $quiet = 0;
+
+sub fail($) {
+    print STDERR @_, "\n";
+    exit 1;
+}
+
+sub vlog($) {
+    if (!$quiet) {
+       print @_, "\n";
+    }
+}
+
+sub new {
+    my ($class, $src_write_timestamp, $dst_changer, $dst_label_template) = @_;
+
+    # check that the label template is valid
+    fail "Invalid label template '$dst_label_template'"
+       if ($dst_label_template =~ /%[^%]+%/
+           or $dst_label_template =~ /^[^%]+$/);
+
+    # translate "latest" into the most recent timestamp
+    if ($src_write_timestamp eq "latest") {
+       $src_write_timestamp = Amanda::DB::Catalog::get_latest_write_timestamp();
+    }
+
+    fail "No dumps found"
+       unless (defined $src_write_timestamp);
+
+    bless {
+       'src_write_timestamp' => $src_write_timestamp,
+       'dst_changer' => $dst_changer,
+       'dst_label_template' => $dst_label_template,
+       'first_dst_slot' => undef,
+    }, $class;
+}
+
+# Start a copy of a single file from src_dev to dest_dev.  If there are
+# no more files, call the callback.
+sub run {
+    my $self = shift;
+
+    $self->{'remaining_files'} = [
+       Amanda::DB::Catalog::sort_dumps([ "label", "filenum" ],
+           Amanda::DB::Catalog::get_dumps(
+               write_timestamp => $self->{'src_write_timestamp'},
+               ok => 1,
+       )) ];
+
+    $self->{'src_chg'} = Amanda::Changer->new();
+    $self->{'src_res'} = undef;
+    $self->{'src_dev'} = undef;
+    $self->{'src_label'} = undef;
+
+    $self->{'dst_chg'} = Amanda::Changer->new($self->{'dst_changer'});
+    $self->{'dst_res'} = undef;
+    $self->{'dst_next'} = undef;
+    $self->{'dst_dev'} = undef;
+    $self->{'dst_label'} = undef;
+
+    $self->{'dst_timestamp'} = Amanda::Util::generate_timestamp();
+
+    Amanda::MainLoop::call_later(sub { $self->start_next_file(); });
+    Amanda::MainLoop::run();
+}
+
+sub generate_new_dst_label {
+    my $self = shift;
+
+    # count the number of percents in there
+    (my $npercents =
+       $self->{'dst_label_template'}) =~ s/[^%]*(%+)[^%]*/length($1)/e;
+    my $nlabels = 10 ** $npercents;
+
+    # make up a sprintf pattern
+    (my $sprintf_pat =
+       $self->{'dst_label_template'}) =~ s/(%+)/"%0" . length($1) . "d"/e;
+
+    my $tl = Amanda::Tapelist::read_tapelist(
+       config_dir_relative(getconf($CNF_TAPELIST)));
+    my %existing_labels =
+       map { $_->{'label'} => 1 } @$tl;
+
+    for (my $i = 0; $i < $nlabels; $i++) {
+       my $label = sprintf($sprintf_pat, $i);
+       next if (exists $existing_labels{$label});
+       return $label;
+    }
+
+    fail "No unused labels matching '$self->{dst_label_template}' are available";
+}
+
+# add $next_file to the catalog db.  This assumes that the corresponding label
+# is already in the DB.
+
+sub add_dump_to_db {
+    my $self = shift;
+    my ($next_file) = @_;
+
+    my $dump = {
+       'label' => $self->{'dst_label'},
+       'filenum' => $next_file->{'filenum'},
+       'dump_timestamp' => $next_file->{'dump_timestamp'},
+       'write_timestamp' => $self->{'dst_timestamp'},
+       'hostname' => $next_file->{'hostname'},
+       'diskname' => $next_file->{'diskname'},
+       'level' => $next_file->{'level'},
+       'status' => 'OK',
+       'partnum' => $next_file->{'partnum'},
+       'nparts' => $next_file->{'nparts'},
+       'kb' => 0, # unknown
+       'sec' => 0, # unknown
+    };
+
+    Amanda::DB::Catalog::add_dump($dump);
+}
+
+# This function is called to copy the next file in $self->{remaining_files}
+sub start_next_file {
+    my $self = shift;
+    my $next_file = shift @{$self->{'remaining_files'}};
+
+    # bail if we're finished
+    if (!defined $next_file) {
+       Amanda::MainLoop::quit();
+       vlog("all files copied");
+       return;
+    }
+
+    # make sure we're on the right device.  Note that we always change
+    # both volumes at the same time.
+    if (defined $self->{'src_label'} &&
+               $self->{'src_label'} eq $next_file->{'label'}) {
+       $self->seek_and_copy($next_file);
+    } else {
+       $self->load_next_volumes($next_file);
+    }
+}
+
+# Start both the source and destination changers seeking to the next volume
+sub load_next_volumes {
+    my $self = shift;
+    my ($next_file) = @_;
+    my ($src_loaded, $dst_loaded) = (0,0);
+    my ($release_src, $load_src, $open_src,
+        $release_dst, $load_dst, $open_dst,
+       $maybe_done);
+
+    # For the source changer, we release the previous device, load the next
+    # volume by its label, and open the device.
+
+    $release_src = sub {
+       if ($self->{'src_dev'}) {
+           $self->{'src_dev'}->finish()
+               or fail $self->{'src_dev'}->error_or_status();
+           $self->{'src_dev'} = undef;
+           $self->{'src_label'} = undef;
+
+           $self->{'src_res'}->release(
+               finished_cb => $load_src);
+       } else {
+           $load_src->(undef);
+       }
+    };
+
+    $load_src = sub {
+       my ($err) = @_;
+       fail $err if $err;
+       vlog("Loading source volume $next_file->{label}");
+
+       $self->{'src_chg'}->load(
+           label => $next_file->{'label'},
+           res_cb => $open_src);
+    };
+
+    $open_src = sub {
+       my ($err, $res) = @_;
+       fail $err if $err;
+       debug("Opening source device $res->{device_name}");
+
+       $self->{'src_res'} = $res;
+       my $dev = $self->{'src_dev'} =
+           Amanda::Device->new($res->{'device_name'});
+       if ($dev->status() != $DEVICE_STATUS_SUCCESS) {
+           fail ("Could not open device $res->{device_name}: " .
+                $dev->error_or_status());
+       }
+
+       if ($dev->read_label() != $DEVICE_STATUS_SUCCESS) {
+           fail ("Could not read label from $res->{device_name}: " .
+                $dev->error_or_status());
+       }
+
+       if ($dev->volume_label ne $next_file->{'label'}) {
+           fail ("Volume in $res->{device_name} has unexpected label " .
+                $dev->volume_label);
+       }
+
+       $dev->start($ACCESS_READ, undef, undef)
+           or fail ("Could not start device $res->{device_name}: " .
+               $dev->error_or_status());
+
+       # OK, it all matches up now..
+       $self->{'src_label'} = $next_file->{'label'};
+       $src_loaded = 1;
+
+       $maybe_done->();
+    };
+
+    # For the destination, we release the reservation after noting the 'next'
+    # slot, and either load that slot or "current".  When the slot is loaded,
+    # check that there is no label, invent a label, and write it to the volume.
+
+    $release_dst = sub {
+       if ($self->{'dst_dev'}) {
+           $self->{'dst_dev'}->finish()
+               or fail $self->{'dst_dev'}->error_or_status();
+           $self->{'dst_dev'} = undef;
+           $self->{'dst_next'} = $self->{'dst_res'}->{'next_slot'};
+
+           $self->{'dst_res'}->release(
+               finished_cb => $load_dst);
+       } else {
+           $self->{'dst_next'} = "current";
+           $load_dst->(undef);
+       }
+    };
+
+    $load_dst = sub {
+       my ($err) = @_;
+       fail $err if $err;
+       vlog("Loading destination slot $self->{dst_next}");
+
+       $self->{'dst_chg'}->load(
+           slot => $self->{'dst_next'},
+           set_current => 1,
+           res_cb => $open_dst);
+    };
+
+    $open_dst = sub {
+       my ($err, $res) = @_;
+       fail $err if $err;
+       debug("Opening destination device $res->{device_name}");
+
+       # if we've tried this slot before, we're out of destination slots
+       if (defined $self->{'first_dst_slot'}) {
+           if ($res->{'this_slot'} eq $self->{'first_dst_slot'}) {
+               fail("No more unused destination slots");
+           }
+       } else {
+           $self->{'first_dst_slot'} = $res->{'this_slot'};
+       }
+
+       $self->{'dst_res'} = $res;
+       my $dev = $self->{'dst_dev'} =
+           Amanda::Device->new($res->{'device_name'});
+       if ($dev->status() != $DEVICE_STATUS_SUCCESS) {
+           fail ("Could not open device $res->{device_name}: " .
+                $dev->error_or_status());
+       }
+
+       # for now, we only overwrite absolutely empty volumes.  This will need
+       # to change when we introduce use of a taperscan algorithm.
+
+       my $status = $dev->read_label();
+       if (!($status & $DEVICE_STATUS_VOLUME_UNLABELED)) {
+           # if UNLABELED is only one possibility, give a device error msg
+           if ($status & ~$DEVICE_STATUS_VOLUME_UNLABELED) {
+               fail ("Could not read label from $res->{device_name}: " .
+                    $dev->error_or_status());
+           } else {
+               vlog("Volume in destination slot $res->{this_slot} is already labeled; going to next slot");
+               $release_dst->();
+               return;
+           }
+       }
+
+       if (defined($dev->volume_header)) {
+           vlog("Volume in destination slot $res->{this_slot} is not empty; going to next slot");
+           $release_dst->();
+           return;
+       }
+
+       my $new_label = $self->generate_new_dst_label();
+
+       $dev->start($ACCESS_WRITE, $new_label, $self->{'dst_timestamp'})
+           or fail ("Could not start device $res->{device_name}: " .
+               $dev->error_or_status());
+
+       # OK, it all matches up now..
+       $self->{'dst_label'} = $new_label;
+       $dst_loaded = 1;
+
+       $maybe_done->();
+    };
+
+    # and finally, when both src and dst are finished, we move on to
+    # the next step.
+    $maybe_done = sub {
+       return if (!$src_loaded or !$dst_loaded);
+
+       vlog("Volumes loaded; starting copy");
+       $self->seek_and_copy($next_file);
+    };
+
+    # kick it off
+    $release_src->();
+    $release_dst->();
+}
+
+sub seek_and_copy {
+    my $self = shift;
+    my ($next_file) = @_;
+
+    vlog("Copying file #$next_file->{filenum}");
+
+    # seek the source device
+    my $hdr = $self->{'src_dev'}->seek_file($next_file->{'filenum'});
+    if (!defined $hdr) {
+       fail "Error seeking to read next file: " .
+                   $self->{'src_dev'}->error_or_status()
+    }
+    if ($hdr->{'type'} == $F_TAPEEND
+           or $self->{'src_dev'}->file() != $next_file->{'filenum'}) {
+       fail "Attempt to seek to a non-existent file.";
+    }
+
+    if ($hdr->{'type'} != $F_DUMPFILE && $hdr->{'type'} != $F_SPLIT_DUMPFILE) {
+       fail "Unexpected header type $hdr->{type}";
+    }
+
+    # start the destination device with the same header
+    if (!$self->{'dst_dev'}->start_file($hdr)) {
+       fail "Error starting new file: " . $self->{'dst_dev'}->error_or_status();
+    }
+
+    # now put together a transfer to copy that data.
+    my $xfer;
+    my $xfer_cb = sub {
+       my ($src, $msg, $elt) = @_;
+       if ($msg->{type} == $XMSG_INFO) {
+           vlog("while transferring: $msg->{message}\n");
+       }
+       if ($msg->{type} == $XMSG_ERROR) {
+           fail $msg->{elt} . " failed: " . $msg->{message};
+       }
+       if ($xfer->get_status() == $Amanda::Xfer::XFER_DONE) {
+           $xfer->get_source()->remove();
+           debug("transfer completed");
+
+           # add this dump to the logfile
+           $self->add_dump_to_db($next_file);
+
+           # start up the next copy
+           $self->start_next_file();
+       }
+    };
+
+    $xfer = Amanda::Xfer->new([
+       Amanda::Xfer::Source::Device->new($self->{'src_dev'}),
+       Amanda::Xfer::Dest::Device->new($self->{'dst_dev'},
+                                       getconf($CNF_DEVICE_OUTPUT_BUFFER_SIZE)),
+    ]);
+    $xfer->get_source()->set_callback($xfer_cb);
+    debug("starting transfer");
+    $xfer->start();
+}
+
+## Application initialization
+package Main;
+use Amanda::Config qw( :init :getconf );
+use Amanda::Debug qw( :logging );
+use Amanda::Util qw( :constants );
+use Getopt::Long;
+
+sub usage {
+    print <<EOF;
+**NOTE** this interface is under development and will change in future releases!
+
+Usage: amvault [-o configoption]* [-q|--quiet]
+       <conf> <src-run-timestamp> <dst-changer> <label-template>
+
+    -o: configuration overwrite (see amanda(8))
+    -q: quiet progress messages
+
+Copies data from the run with timestamp <src-run-timestamp> onto volumes using
+the changer <dst-changer>, labeling new volumes with <label-template>.  If
+<src-run-timestamp> is "latest", then the most recent amdump or amflush run
+will be used.
+
+Each source volume will be copied to a new destination volume; no re-assembly
+or splitting will be performed.  Destination volumes must be at least as large
+as the source volumes.
+
+EOF
+    exit(1);
+}
+
+Amanda::Util::setup_application("amvault", "server", $CONTEXT_CMDLINE);
+
+my $config_overwrites = new_config_overwrites($#ARGV+1);
+Getopt::Long::Configure(qw{ bundling });
+GetOptions(
+    'o=s' => sub { add_config_overwrite_opt($config_overwrites, $_[1]); },
+    'q|quiet' => \$quiet,
+) or usage();
+
+usage unless (@ARGV == 4);
+
+my ($config_name, $src_write_timestamp, $dst_changer, $label_template) = @ARGV;
+
+config_init($CONFIG_INIT_EXPLICIT_NAME, $config_name);
+apply_config_overwrites($config_overwrites);
+my ($cfgerr_level, @cfgerr_errors) = config_errors();
+if ($cfgerr_level >= $CFGERR_WARNINGS) {
+    config_print_errors();
+    if ($cfgerr_level >= $CFGERR_ERRORS) {
+       fail("errors processing config file");
+    }
+}
+
+Amanda::Util::finish_setup($RUNNING_AS_ANY);
+
+# start the copy
+my $vault = Amvault->new($src_write_timestamp, $dst_changer, $label_template);
+$vault->run();
diff --git a/server-src/amverify.sh b/server-src/amverify.sh
deleted file mode 100644 (file)
index 7ed64cc..0000000
+++ /dev/null
@@ -1,501 +0,0 @@
-#! @SHELL@
-#
-#      $Id: amverify.sh.in,v 1.38 2006/07/25 19:00:56 martinea Exp $
-#
-# (C) 1996 by ICEM Systems GmbH
-# Author: Axel Zinser (fifi@icem.de)
-#
-# amverify: check amanda tapes and report errors
-#
-
-echo "amverify is deprecated -- use amcheckdump" >& 2
-
-prefix="@prefix@"
-exec_prefix="@exec_prefix@"
-sbindir="@sbindir@"
-amlibexecdir="@amlibexecdir@"
-. "${amlibexecdir}/amanda-sh-lib.sh"
-
-# add sbin and ucb dirs
-PATH="$PATH:/usr/sbin:/sbin:/usr/ucb"
-export PATH
-
-USE_VERSION_SUFFIXES="@USE_VERSION_SUFFIXES@"
-if [ "$USE_VERSION_SUFFIXES" = "yes" ]; then
-       SUF="-@VERSION@"
-else
-       SUF=
-fi
-
-# If the shell/system echo support \r and \c, use them to write some
-# status messages over the top of each other as things progress, otherwise
-# use a normal echo and let them go on new lines.  Define $Echoe to be
-# an echo that goes to stderr.  In the code, $Echoe is used and it may
-# be either echoe or echone, the latter being code that knows about echon.
-
-t=`echo "abc\r\c" | wc -c`
-if [ $t -eq 4 ]; then
-       Echon=echon
-else
-       Echon=echo
-fi
-Echoe=echoe
-elen=0
-echoe() {
-       echo "$@" >&2
-       Echoe=echoe
-}
-echon() {
-        newelen=`expr "$1" : '.*'`
-       blanks=
-        while [ $newelen -lt $elen ]; do
-               blanks="$blanks "
-                elen=`expr $elen - 1`
-        done
-        echo "$1""$blanks\r\c"
-        elen=$newelen
-       Echoe=echone
-}
-echone() {
-       echon
-       echoe "$@"
-       Echoe=echoe
-}
-
-report() {
-       $Echoe "$@"
-       echo "$@" >> $REPORT
-}
-
-getparm() {
-       $AMGETCONF $CONFIG $1 2>/dev/null
-}
-
-sendreport() {
-       if [ -f $REPORT -a X"$REPORTTO" != X"" ]; then
-               (
-               echo `_ 'Tapes: %s' "$TAPELIST"`
-               if [ -s $DEFECTS ]; then
-                       echo `_ 'Errors found:'`
-                       cat $DEFECTS
-               else
-                       echo `_ 'No errors found!'`
-               fi
-               echo
-
-               [ -s $REPORT ] \
-                       && cat $REPORT
-               ) | (
-                   if test -n "$MAIL"; then
-                       $MAIL -s "$ORG AMANDA VERIFY REPORT FOR$TAPELIST" $REPORTTO
-                   else
-                       cat >&2
-                   fi
-               )
-       fi
-}
-
-###
-# This function is called to process one dump image.  Standard input is
-# the dump image.  We parse the header and decide if it is a GNU tar
-# dump or a system dump.  Then we do a catalog operation to /dev/null
-# and finally a "cat" to /dev/null to soak up whatever data is still in
-# the pipeline.
-#
-# In the case of a system restore catalogue, this does not fully check
-# the integrity of the dump image because system restore programs stop
-# as soon as they are done with the directories, which are all at the
-# beginning.  But the trailing cat will at least make sure the whole
-# image is readable.
-###
-
-doonefile() {
-
-       ###
-       # The goal here is to collect the first 32 KBytes and save the
-       # first line.  But the pipe size coming in to us from amrestore
-       # is highly system dependent and "dd" does not do reblocking.
-       # So we pick a block size that is likely to always be available in
-       # the pipe and a count to take it up to 32 KBytes.  Worst case,
-       # this could be changed to "bs=1 count=32k".  We also have to
-       # soak up the rest of the output after the "head" so an EPIPE
-       # does not go back and terminate the "dd" early.
-       ###
-
-        HEADER=`$DD bs=512 count=64 2>/dev/null | ( sed 1q ; cat > /dev/null )`
-       CMD=
-       result=1
-       if [ X"$HEADER" = X"" ]; then
-               echo `_ '** No header'` > $TEMP/errors
-       else
-               set X $HEADER
-               # XXX meh, while[] is dangerous, what about a bad header?
-               while [ X"$1" != X"program" ]; do shift; done
-               if [ X"$1" = X"program" -a X"$2" != X"" ]; then
-                       if [ X"$TAR" != X"" \
-                            -a \( X"`basename $2`" = X"`basename $TAR`" \
-                                  -o X"`basename $2`" = X"gtar" \
-                                  -o X"`basename $2`" = X"gnutar" \
-                                  -o X"`basename $2`" = X"tar" \) ]; then
-                               CMD=$TAR
-                               ARGS="tf -"
-                       elif [ X"$TAR" != X"" \
-                              -a X"$SAMBA_CLIENT" != X"" \
-                              -a X"$2" = X"$SAMBA_CLIENT" ]; then
-                               CMD=$TAR
-                               ARGS="tf -"
-                       elif [ X"$DUMP" != X"" -a X"$2" = X"$DUMP" ]; then
-                               CMD=$RESTORE
-                               if [ $IS_AIX -eq 1 ]; then
-                                       ARGS=-tB
-                               else
-                                       ARGS="tbf 2 -"
-                               fi
-                       elif [ X"$VDUMP" != X"" -a X"$2" = X"$VDUMP" ]; then
-                               CMD=$VRESTORE
-                               ARGS="tf -"
-                       elif [ X"$VXDUMP" != X"" -a X"$2" = X"$VXDUMP" ]; then
-                               CMD=$VXRESTORE
-                               ARGS="tbf 2 -"
-                       elif [ X"$XFSDUMP" != X"" -a X"$2" = X"$XFSDUMP" ]; then
-                               CMD=$XFSRESTORE
-                               ARGS="-t -v silent -"
-                       else
-                               echo `_ '** Cannot do %s dumps' "$2"` > $TEMP/errors
-                               result=999      # flag as not really an error
-                       fi
-               else
-                       echo `_ '** Cannot find dump type'` > $TEMP/errors
-               fi
-       fi
-       echo $CMD > $TEMP/onefile.cmd
-       if [ X"`echo $HEADER | grep '^AMANDA: SPLIT_FILE'`" != X"" ]; then
-           result=500
-           set X $HEADER
-           shift 7
-           echo $1 | cut -f7 -d' ' > $TEMP/onefile.partnum
-       elif [ X"$CMD" != X"" ]; then
-               if [ -x $CMD ]; then
-                       $CMD $ARGS > /dev/null 2> $TEMP/errors
-                       result=$?
-               else
-                       echo `_ '** Cannot execute %s' "$CMD"` > $TEMP/errors
-               fi
-       fi
-       cat >/dev/null                          # soak up the rest of the image
-       echo $result
-}
-
-#
-# some paths
-#
-#      CONFIG_DIR      directory in which the config file resides
-#      AMRESTORE       full path name of amrestore
-#      AMGETCONF       full path name of amgetconf
-#      AMTAPE          full path name of amtape
-#      TAR             ditto for GNU-tar
-#      SAMBA_CLIENT    ditto for smbclient
-#      DUMP            ditto for the system dump program
-#      RESTORE         ditto for the system restore program
-#      VDUMP           ditto for the system dump program
-#      VRESTORE        ditto for the system restore program
-#      VXDUMP          ditto for the system dump program
-#      VXRESTORE       ditto for the system restore program
-#      XFSDUMP         ditto for the system dump program
-#      XFSRESTORE      ditto for the system restore program
-#      DD              ditto for dd
-#      MT              ditto for mt
-#      MTF             flag given to MT to specify tape device: -f or -t
-#      MAIL            mail program
-#      IS_AIX          true if this is an AIX system
-
-CONFIG_DIR=@CONFIG_DIR@
-amlibexecdir=$amlibexecdir
-sbindir=$sbindir
-AMRESTORE=$sbindir/amrestore$SUF
-AMGETCONF=$sbindir/amgetconf$SUF
-AMTAPE=$sbindir/amtape$SUF
-TAR=@GNUTAR@
-SAMBA_CLIENT=@SAMBA_CLIENT@
-DUMP=@DUMP@
-RESTORE=@RESTORE@
-VDUMP=@VDUMP@
-VRESTORE=@VRESTORE@
-VXDUMP=@VXDUMP@
-VXRESTORE=@VXRESTORE@
-XFSDUMP=@XFSDUMP@
-XFSRESTORE=@XFSRESTORE@
-MAIL=@MAILER@
-DD=@DD@
-
-. ${amlibexecdir}/chg-lib.sh
-
-#
-# config file
-#
-SLOT=0
-CONFIG=$1
-[ X"$CONFIG" = X"" ] \
-       && $Echoe "usage: amverify$SUF <config> [slot [ runtapes ] ]" \
-       && exit 1
-
-AMCONFIG=$CONFIG_DIR/$CONFIG/amanda.conf
-[ ! -f $AMCONFIG ] \
-       && $Echoe "Cannot find config file $AMCONFIG" \
-       && exit 1
-
-TPCHANGER=`getparm tpchanger`
-if [ X"$TPCHANGER" = X"" ]; then
-       $Echoe "No tape changer..."
-       DEVICE=`getparm tapedev`
-       [ X"$DEVICE" = X"" ] \
-               && $Echoe "No tape device..." \
-               && exit 1
-       $Echoe "Tape device is $DEVICE..."
-       SLOTS=1
-else
-       CHANGER_SLOT=${2:-current}
-       $Echoe "Tape changer is $TPCHANGER..."
-       SLOTS=${3:-`getparm runtapes`}
-       [ X"$SLOTS" = X"" ] && SLOTS=1
-       if [ $SLOTS -eq 1 ]; then
-               p=""
-       else
-               p=s
-       fi
-       $Echoe "$SLOTS slot${p}..."
-       MAXRETRIES=2
-fi
-
-#
-# check the accessability
-#
-[ X"$TAR" != X"" -a ! -x "$TAR" ] \
-       && $Echoe "GNU tar not found: $TAR"
-[ X"$DUMP" != X"" -a \( X"$RESTORE" = X"" -o ! -x "$RESTORE" \) ] \
-       && $Echoe "System restore program not found: $RESTORE"
-[ X"$VDUMP" != X"" -a \( X"$VRESTORE" = X"" -o ! -x "$VRESTORE" \) ] \
-       && $Echoe "System restore program not found: $VRESTORE"
-[ X"$VXDUMP" != X"" -a \( X"$VXRESTORE" = X"" -o ! -x "$VXRESTORE" \) ] \
-       && $Echoe "System restore program not found: $VXRESTORE"
-[ X"$XFSDUMP" != X"" -a \( X"$XFSRESTORE" = X"" -o ! -x "$XFSRESTORE" \) ] \
-       && $Echoe "System restore program not found: $XFSRESTORE"
-[ ! -x $AMRESTORE ] \
-       && $Echoe "amrestore not found: $AMRESTORE" \
-       && exit 1
-
-REPORTTO=`getparm mailto`
-if [ X"$REPORTTO" = X"" ]; then
-       $Echoe "No notification by mail!"
-else
-       $Echoe "Verify summary to $REPORTTO"
-fi
-
-ORG=`getparm org`
-if [ X"$ORG" = X"" ]; then
-       $Echoe "No org in amanda.conf -- using $CONFIG"
-       ORG=$CONFIG
-fi
-
-#
-# ok, let's do it
-#
-#      TEMP            directory for temporary tar archives and stderr
-#      DEFECTS         defect list
-#      REPORT          report for mail
-
-if [ ! -d @AMANDA_TMPDIR@ ]; then
-  $Echoe "amverify: directory @AMANDA_TMPDIR@ does not exist."
-  exit 1
-fi
-
-cd @AMANDA_TMPDIR@ || exit 1
-
-TEMP=@AMANDA_TMPDIR@/amverify.$$
-trap 'rm -fr $TEMP' 0
-if ( umask 077 ; mkdir $TEMP ) ; then
-       :
-else
-       $Echoe "Cannot create $TEMP"
-       exit 1
-fi
-DEFECTS=$TEMP/defects; rm -f $DEFECTS
-REPORT=$TEMP/report; rm -f $REPORT
-TAPELIST=
-EXITSTAT=$TEMP/amrecover.exit; rm -rf $EXITSTAT
-
-trap 'report "aborted!"; echo `_ 'aborted!'` >> $DEFECTS; sendreport; rm -fr $TEMP; exit 1' 1 2 3 4 5 6 7 8 10 12 13 14 15
-
-$Echoe "Defects file is $DEFECTS"
-report "amverify $CONFIG"
-report "`date`"
-report ""
-
-# ----------------------------------------------------------------------------
-
-SPLIT_DUMPS= # this will keep track of split dumps that we'll tally later
-while [ $SLOT -lt $SLOTS ]; do
-       SLOT=`expr $SLOT + 1`
-       #
-       # Tape Changer: dial slot
-       #
-       if [ X"$TPCHANGER" != X"" ]; then
-               report "Loading ${CHANGER_SLOT} slot..."
-               $AMTAPE $CONFIG slot $CHANGER_SLOT > $TEMP/amtape.out 2>&1
-               THIS_SLOT=$CHANGER_SLOT
-               CHANGER_SLOT=next
-               RESULT=`grep "changed to slot" $TEMP/amtape.out`
-               [ X"$RESULT" = X"" ] \
-                       && report "** Error loading slot $THIS_SLOT" \
-                       && report "`cat $TEMP/amtape.out`" \
-                       && cat $TEMP/amtape.out >> $DEFECTS \
-                       && continue
-               DEVICE=`$AMTAPE $CONFIG device`
-       fi
-       report "Using device $DEVICE"
-       $Echon "Waiting for device to go ready..."
-       count=1800
-        while true; do
-            amdevcheck_output="`amdevcheck $CONFIG $DEVICE`"
-            amdevcheck_status=$?
-            if [ $amdevcheck_status -eq 0 ]; then
-                break;
-            else
-                if echo $amdevcheck_output | grep UNLABELED > /dev/null; then
-                   if [ count -lt 0 ]; then
-                       report "Device not ready"
-                        break;
-                   fi
-                    sleep 3
-                   count=`expr $count - 3`
-                else
-                    report "Volume in $DEVICE unlabeled."
-                    break;
-                fi
-            fi
-       done
-       $Echon "Processing label..."
-        amtape_output="`amtape $CONFIG current 2>&1`";
-        if echo "$amtape_output" | \
-            egrep "^slot +[0-9]+: time [^ ]+ +label [^ ]+" > /dev/null; then
-           : # everything is fine
-       else
-            report "Error reading tape label using amtape."
-            continue
-        fi
-        
-        set X $amtape_output
-        until [ "$1" = "time" ]; do
-            shift
-        done
-        
-       VOLUME=$4
-       DWRITTEN=$2
-       report "Volume $VOLUME, Date $DWRITTEN"
-       [ X"$DWRITTEN" = X"0" -o X"$DWRITTEN" = X"X" ] \
-               && report "Fresh tape. Skipping..." \
-               && continue
-       TAPELIST="$TAPELIST $VOLUME"
-
-        FILENO=0
-       ERG=0
-       ERRORS=0
-       while [ $ERG = 0 ]; do
-               FILENO=`expr $FILENO + 1`
-#            { cat <<EOF; dd if=/dev/zero bs=32k count=1; } | doonefile
-#AMANDA: FILE 20070925205916 localhost /boot  lev 0 comp N program /bin/tar
-#To restore, position tape at start of file and run:
-#        dd if=<tape> bs=32k skip=1 |      /bin/tar -xpGf - ...
-#EOF
-               RESULT=`$AMRESTORE -h -p -f $FILENO $DEVICE \
-                            2> $TEMP/amrestore.out \
-                       | doonefile 2> $TEMP/onefile.errors`
-               FILE=`grep restoring $TEMP/amrestore.out \
-                       | sed 's/^.*restoring //'`
-               if [ X"$FILE" != X"" -a X"$RESULT" = X"0" ]; then
-                       report "Checked $FILE"
-               elif [ X"$FILE" != X"" -a X"$RESULT" = X"500" ]; then
-                       report "Skipped `cat $TEMP/onefile.cmd` check on partial dump $FILE"
-                       dump="`echo $FILE | cut -d'.' -f'1,2,3,4'`"
-                       cat $TEMP/onefile.partnum >> $TEMP/$dump.parts
-                       if [ X"`echo $SPLIT_DUMPS | grep $dump`" = X"" ]; then
-                           SPLIT_DUMPS="$dump $SPLIT_DUMPS"
-                       fi
-               elif [ X"$FILE" != X"" -a X"$RESULT" = X"999" ]; then
-                       report "Skipped $FILE (`cat $TEMP/errors`)"
-               elif [ -z "$FILE" ]; then
-                        # Unless we went over, there is no extra output.
-                       report "End-of-Tape detected."
-                       break
-               else
-                       report "** Error detected ($FILE)"
-                       echo "$VOLUME ($FILE):" >>$DEFECTS
-                       [ -s $TEMP/amrestore.out ] \
-                               && report "`cat $TEMP/amrestore.out`" \
-                               && cat $TEMP/amrestore.out >>$DEFECTS
-                       [ -s $TEMP/errors ] \
-                               && report "`cat $TEMP/errors`" \
-                               && cat $TEMP/errors >>$DEFECTS
-                       [ -s $TEMP/onefile.errors ] \
-                               && report "`cat $TEMP/onefile.errors`" \
-                               && cat $TEMP/onefile.errors >>$DEFECTS
-                       ERRORS=`expr $ERRORS + 1`
-                       [ $ERRORS -gt 5 ] \
-                               && report "Too many errors." \
-                               && break
-               fi
-       done
-       rm -f $TEMP/header \
-             $TEMP/amtape.out \
-             $TEMP/amrestore.out \
-             $TEMP/errors \
-             $TEMP/onefile.cmd \
-             $TEMP/onefile.partnum \
-             $TEMP/onefile.errors
-done
-
-[ -s $DEFECTS ] \
-       && $Echoe "Errors found: " \
-       && cat $DEFECTS
-
-# Work out whether any split dumps we saw had all their parts
-for dump in $SPLIT_DUMPS;do
-    report ""
-    numparts=0
-    max=0
-    max_known=0
-    missing=0
-    # figure out 
-    for part in `cat $TEMP/$dump.parts`;do
-       cur="`echo $part | cut -d/ -f1`"
-       max="`echo $part | cut -d/ -f2`"
-       if [ $max != "UNKNOWN" ]; then
-           numparts=$max
-           max_known=1
-           break;
-       fi
-       if [ $cur -gt $numparts ]; then
-           numparts=$cur
-       fi
-    done
-    report "Split dump $dump should have $numparts total pieces"
-    if [ $max_known != 1 ]; then
-       report "NOTE: Header field for total pieces was UNKNOWN, $numparts is best guess"
-    fi
-    part=1
-    while [ $part -lt $numparts ];do
-       part=`expr $part + 1`
-       if [ X"`grep \"^$part/\" $TEMP/$dump.parts`" = X"" ];then
-           report "Spanning chunk part $part is missing!"
-           missing=`expr $missing + 1`
-       fi
-    done
-    if [ $missing = 0 ];then
-       report "All parts found"        
-    fi
-    rm -f $TEMP/$dump.parts
-done
-
-sendreport
-
-exit 0
diff --git a/server-src/amverifyrun.sh b/server-src/amverifyrun.sh
deleted file mode 100644 (file)
index d35826e..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-#!@SHELL@
-#
-
-echo "amverifyrun is deprecated -- use amcheckdump" >& 2
-
-prefix="@prefix@"
-exec_prefix="@exec_prefix@"
-sbindir="@sbindir@"
-amlibexecdir="@amlibexecdir@"
-. "${amlibexecdir}/amanda-sh-lib.sh"
-
-# add sbin and ucb dirs
-PATH="$PATH:/usr/sbin:/sbin:/usr/ucb"
-export PATH
-
-USE_VERSION_SUFFIXES="@USE_VERSION_SUFFIXES@"
-if [ "$USE_VERSION_SUFFIXES" = "yes" ]; then
-        SUF="-@VERSION@"
-else
-        SUF=
-fi
-
-getparm() {
-        $AMGETCONF $CONFIG $1 2>/dev/null
-}
-
-CONFIG=$1
-amlibexecdir=$amlibexecdir  
-sbindir=$sbindir
-AMGETCONF=$sbindir/amgetconf$SUF
-AMVERIFY=$sbindir/amverify$SUF
-LOGDIR=`getparm logdir`
-AMDUMPLOG=${LOGDIR}/amdump.1
-AMFLUSHLOG=${LOGDIR}/amflush.1
-if [ -f $AMDUMPLOG ]; then
-  if [ -f $AMFLUSHLOG ]; then
-    if [ $AMDUMPLOG -nt $AMFLUSHLOG ]; then
-      AMLOG=$AMDUMPLOG
-    else
-      AMLOG=$AMFLUSHLOG
-    fi
-  else
-    AMLOG=$AMDUMPLOG
-  fi
-else
-  if [ -f $AMFLUSHLOG ]; then
-    AMLOG=$AMFLUSHLOG
-  else
-    echo `_ 'Nothing to verify'`
-    exit 1;
-  fi
-fi
-
-
-FIRST_SLOT=`grep "taper: slot" $AMLOG | fgrep 'exact label match
-new tape
-first labelstr match' | sed 1q | sed 's/://g' | awk '{print $3}'`
-if [ X"$FIRST_SLOT" = X"" ]; then
-  FIRST_SLOT=`grep "taper: slot: .* wrote label" $AMLOG | sed 1q | sed 's/://g' | awk '{print $3}'`
-  if [ X"$FIRST_SLOT" = X"" ]; then
-    FIRST_SLOT='-1'
-  fi
-fi
-
-NBTAPES=`grep -c "taper: .*wrote label " $AMLOG`
-
-if [ X"$NBTAPES" != X"0" ]; then
-  if ln -s $AMLOG $LOGDIR/log ; then
-    $AMVERIFY $CONFIG $FIRST_SLOT $NBTAPES
-    if [ -L $LOGDIR/log ] ; then rm $LOGDIR/log ; fi
-  else
-    echo "amdump or amflush is already running, or you must run amcleanup"
-  fi
-else
-  echo `_ 'Nothing to verify'`
-fi
index c49319a2ec507abcb45c346424c7af37af6be92c..ad9a83224f9c08ab3c357e1eeb1f6dd6a2675a91 100644 (file)
@@ -53,7 +53,9 @@
 int changer_debug = 0;
 char *changer_resultstr = NULL;
 
-static char *tapechanger = NULL;
+static pid_t tpchanger_pid = -1;
+static int tpchanger_stdout = -1;
+static int tpchanger_stdin = -1;
 
 /* local functions */
 static int changer_command(char *cmd, char *arg);
@@ -63,13 +65,7 @@ static int run_changer_command(char *cmd, char *arg, char **slotstr, char **rest
 int
 changer_init(void)
 {
-    if (tapechanger == NULL)
-       tapechanger = getconf_str(CNF_TPCHANGER);
-    if (*tapechanger != '\0' && *tapechanger != '/') {
-       tapechanger = vstralloc(amlibexecdir, "/", tapechanger, versionsuffix(),
-                               NULL);
-    }
-    return strcmp(tapechanger, "") != 0;
+    return strcmp(getconf_str(CNF_TPCHANGER), "") != 0;
 }
 
 
@@ -78,7 +74,7 @@ report_bad_resultstr(char *cmd)
 {
     char *s;
 
-    s = vstrallocf(_("badly formed result from changer command %s: \"%s\""),
+    s = vstrallocf(_("<error> badly formed result from changer command %s: \"%s\""),
                  cmd, changer_resultstr);
     amfree(changer_resultstr);
     changer_resultstr = s;
@@ -258,6 +254,7 @@ changer_find(
     if (rc != 0) {
         /* Problem with the changer script. Bail. */
         g_fprintf(stderr, _("Changer problem: %s\n"), changer_resultstr);
+        amfree(curslotstr);
         return;
     }
 
@@ -324,162 +321,131 @@ changer_current(
 /* ---------------------------- */
 
 static int
-changer_command(
-     char *cmd,
-     char *arg)
+start_chg_glue(void)
 {
-    int fd[2];
-    amwait_t wait_exitcode = 1;
-    int exitcode;
-    char *cmdstr;
-    pid_t pid, changer_pid = 0;
-    int fd_to_close[4], *pfd_to_close = fd_to_close;
+    int stdin_pipe[2] = { -1, -1 };
+    int stdout_pipe[2] = { -1, -1 };
+    char *chg_glue;
 
-    cmdstr = vstralloc(tapechanger, " ",
-                      cmd, arg ? " " : "", 
-                      arg ? arg : "",
-                      NULL);
-
-    if(changer_debug) {
-       g_fprintf(stderr, _("changer: opening pipe to: %s\n"), cmdstr);
-       fflush(stderr);
-    }
+    /* is it already running? */
+    if (tpchanger_pid != -1)
+       return 1;
 
-    amfree(changer_resultstr);
-
-    if(socketpair(AF_UNIX, SOCK_STREAM, 0, fd) == -1) {
+    if (pipe(stdin_pipe) == -1 || pipe(stdout_pipe) == -1) {
        changer_resultstr = vstrallocf(
-                               _("<error> could not create pipe for \"%s\": %s"),
-                               cmdstr, strerror(errno));
-       exitcode = 2;
-       goto failed;
-    }
-
-    /* make sure fd[0] > 2  && fd[1] > 2 */
-    pfd_to_close = fd_to_close;
-    while(fd[0] <= 2) {
-       int a = dup(fd[0]);
-       *pfd_to_close++ = fd[0];
-       fd[0] = a;
-    }
-    while(fd[1] <= 2) {
-       int a = dup(fd[1]);
-       *pfd_to_close++ = fd[1];
-       fd[1] = a;
-    }
-    while (pfd_to_close > fd_to_close) {
-       close(*--pfd_to_close);
+                       _("<error> could not make pipe: %s"), strerror(errno));
+       goto error;
     }
 
-    if(fd[0] < 0 || fd[0] >= (int)FD_SETSIZE) {
-       changer_resultstr = vstrallocf(
-                       _("<error> could not create pipe for \"%s\":"
-                       "socketpair 0: descriptor %d out of range ( 0 .. %d)"),
-                       cmdstr, fd[0], (int)FD_SETSIZE-1);
-       exitcode = 2;
-       goto done;
-    }
-    if(fd[1] < 0 || fd[1] >= (int)FD_SETSIZE) {
-       changer_resultstr = vstrallocf(
-                       _("<error> could not create pipe for \"%s\":"
-                       "socketpair 1: descriptor %d out of range ( 0 .. %d)"),
-                       cmdstr, fd[1], (int)FD_SETSIZE-1);
-       exitcode = 2;
-       goto done;
-    }
-
-    switch(changer_pid = fork()) {
+    switch(tpchanger_pid = fork()) {
     case -1:
        changer_resultstr = vstrallocf(
-                       _("<error> could not fork for \"%s\": %s"),
-                       cmdstr, strerror(errno));
-       exitcode = 2;
-       goto done;
+                       _("<error> could not fork: %s"), strerror(errno));
+       goto error;
+
     case 0:
        debug_dup_stderr_to_debug();
-       if(dup2(fd[1], 1) == -1) {
+       if(dup2(stdin_pipe[0], 0) == -1) {
            changer_resultstr = vstrallocf(
-                       _("<error> could not open pipe to \"%s\": %s"),
-                       cmdstr, strerror(errno));
-           (void)fullwrite(fd[1], changer_resultstr, strlen(changer_resultstr));
-           exit(1);
+                       _("<error> could not dup2: %s"), strerror(errno));
+           goto child_err;
        }
-       aclose(fd[0]);
-       aclose(fd[1]);
-       if(config_dir && chdir(config_dir) == -1) {
+
+       if(dup2(stdout_pipe[1], 1) == -1) {
            changer_resultstr = vstrallocf(
-                       _("<error> could not cd to \"%s\": %s"),
-                       config_dir, strerror(errno));
-           (void)fullwrite(STDOUT_FILENO, changer_resultstr, strlen(changer_resultstr));
-           exit(1);
+                       _("<error> could not dup2: %s"), strerror(errno));
+           goto child_err;
        }
        safe_fd(-1, 0);
-       if(arg) {
-           execle(tapechanger, tapechanger, cmd, arg, (char *)NULL,
-                  safe_env());
-       } else {
-           execle(tapechanger, tapechanger, cmd, (char *)NULL, safe_env());
-       }
+
+       chg_glue = g_strdup_printf("%s/chg-glue", amlibexecdir);
+
+       execl(chg_glue, chg_glue, get_config_name(), NULL);
        changer_resultstr = vstrallocf(
-                       _("<error> could not exec \"%s\": %s"),
-                       tapechanger, strerror(errno));
-       (void)fullwrite(STDOUT_FILENO, changer_resultstr, strlen(changer_resultstr));
+                       _("<error> could not exec \"chg-glue\": %s"), strerror(errno));
+       goto child_err;
+
+child_err:
+       (void)full_write(stdout_pipe[1], changer_resultstr, strlen(changer_resultstr));
        exit(1);
+
     default:
-       aclose(fd[1]);
-    }
+       aclose(stdin_pipe[0]);
+       aclose(stdout_pipe[1]);
 
-    if((changer_resultstr = areads(fd[0])) == NULL) {
-       if (errno == 0) {
-           changer_resultstr = vstrallocf(
-                       _("<error> could not read result from \"%s\": Premature end of file, see %s"),
-                       tapechanger, dbfn());
-       } else {
-           changer_resultstr = vstrallocf(
-                       _("<error> could not read result from \"%s\": %s"),
-                       tapechanger, strerror(errno));
-       }
+       tpchanger_stdout = stdout_pipe[0];
+       tpchanger_stdin = stdin_pipe[1];
+
+       return 1;
     }
 
-    while(1) {
-       if ((pid = wait(&wait_exitcode)) == -1) {
-           if(errno == EINTR) {
-               continue;
-           } else {
-               changer_resultstr = vstrallocf(
-                       _("<error> wait for \"%s\" failed: %s"),
-                       tapechanger, strerror(errno));
-               exitcode = 2;
-               goto done;
-           }
-       } else if (pid != changer_pid) {
-           changer_resultstr = vstrallocf(
-                       _("<error> wait for \"%s\" returned unexpected pid %ld"),
-                       tapechanger, (long)pid);
-           exitcode = 2;
-           goto done;
-       } else {
-           break;
-       }
+error:
+    aclose(stdin_pipe[0]);
+    aclose(stdin_pipe[1]);
+    aclose(stdout_pipe[0]);
+    aclose(stdout_pipe[1]);
+
+    return 0;
+}
+
+static int
+changer_command(
+     char *cmd,
+     char *arg)
+{
+    int exitcode = 0;
+    char *cmdstr = NULL;
+
+    amfree(changer_resultstr);
+
+    if (!start_chg_glue()) {
+       exitcode = 2;
+       goto failed;
     }
 
-    /* mark out-of-control changers as fatal error */
-    if(WIFSIGNALED(wait_exitcode)) {
-       changer_resultstr = newvstrallocf(changer_resultstr,
-                       _("<error> %s (got signal %d)"),
-                       changer_resultstr, WTERMSIG(wait_exitcode));
+    cmdstr = vstralloc(cmd,
+                      arg ? " " : "",
+                      arg ? arg : "",
+                      "\n",
+                      NULL);
+
+    g_debug("changer: >> %s %s", cmd, arg? arg : "");
+
+    /* write the command to chg_glue */
+    if (full_write(tpchanger_stdin, cmdstr, strlen(cmdstr)) != strlen(cmdstr)) {
+        changer_resultstr = g_strdup("<error> chg-glue exited unexpectedly");
        exitcode = 2;
-    } else {
-       exitcode = WEXITSTATUS(wait_exitcode);
+       goto failed;
+    }
+
+    /* read the first line of the response */
+    changer_resultstr = areads(tpchanger_stdout);
+    if (!changer_resultstr || !*changer_resultstr) {
+        changer_resultstr = g_strdup("<error> unexpected EOF");
+        exitcode = 2;
+        goto failed;
     }
+    g_debug("changer: << %s", changer_resultstr);
 
-done:
-    aclose(fd[0]);
-    aclose(fd[1]);
+    if (strncmp_const(changer_resultstr, "EXITSTATUS ") != 0) {
+       report_bad_resultstr(cmd);
+       exitcode = 2;
+       goto failed;
+    }
+    exitcode = atoi(changer_resultstr + strlen("EXITSTATUS "));
+
+    /* and the second */
+    changer_resultstr = areads(tpchanger_stdout);
+    if (!changer_resultstr) {
+        changer_resultstr = g_strdup("<error> unexpected EOF");
+        exitcode = 2;
+        goto failed;
+    }
+    g_debug("changer: << %s", changer_resultstr);
 
 failed:
     if (exitcode != 0) {
-        dbprintf(_("changer: got exit: %d str: %s\n"), exitcode, changer_resultstr); 
+       g_debug("changer: ERROR %s", changer_resultstr);
     }
 
     amfree(cmdstr);
index 5e6c1ef45c7619ec9bb761fe871494d8714a5e5f..caaf0bfb02b6f4955fcb50cc667f94cd73224427 100644 (file)
@@ -37,7 +37,6 @@
 #include "protocol.h"
 #include "security.h"
 #include "stream.h"
-#include "token.h"
 #include "version.h"
 #include "fileheader.h"
 #include "amfeatures.h"
@@ -93,7 +92,7 @@ static char *options = NULL;
 static char *progname = NULL;
 static int level;
 static char *dumpdate = NULL;
-static int command_in_transit;
+static struct cmdargs *command_in_transit = NULL;
 static char *chunker_timestamp = NULL;
 
 static dumpfile_t file;
@@ -114,18 +113,17 @@ main(
     char **    argv)
 {
     static struct databuf db;
-    struct cmdargs cmdargs;
-    cmd_t cmd;
+    struct cmdargs *cmdargs;
     int infd;
     char *q = NULL;
     char *filename = NULL;
-    char *qfilename = NULL;
     off_t chunksize, use;
     times_t runtime;
     am_feature_t *their_features = NULL;
     int a;
     config_overwrites_t *cfg_ovr = NULL;
     char *cfg_opt = NULL;
+    char *m;
 
     /*
      * Configure program for internationalization:
@@ -153,16 +151,23 @@ main(
     if (argc > 1) 
        cfg_opt = argv[1];
 
-    config_init(CONFIG_INIT_EXPLICIT_NAME | CONFIG_INIT_USE_CWD | CONFIG_INIT_FATAL,
-               cfg_opt);
+    config_init(CONFIG_INIT_EXPLICIT_NAME | CONFIG_INIT_USE_CWD, cfg_opt);
     apply_config_overwrites(cfg_ovr);
 
+    if (config_errors(NULL) >= CFGERR_WARNINGS) {
+       config_print_errors();
+       if (config_errors(NULL) >= CFGERR_ERRORS) {
+           g_critical(_("errors processing config file"));
+       }
+    }
+
     safe_cd(); /* do this *after* config_init() */
 
     check_running_as(RUNNING_AS_DUMPUSER);
 
-    dbrename(config_name, DBG_SUBDIR_SERVER);
+    dbrename(get_config_name(), DBG_SUBDIR_SERVER);
 
+    log_add(L_INFO, "%s pid %ld", get_pname(), (long)getpid());
     g_fprintf(stderr,
            _("%s: pid %ld executable %s version %s\n"),
            get_pname(), (long) getpid(),
@@ -174,20 +179,21 @@ main(
     signal(SIGPIPE, SIG_IGN);
     signal(SIGCHLD, SIG_IGN);
 
-    cmd = getcmd(&cmdargs);
-    if(cmd == START) {
-       if(cmdargs.argc <= 1)
+    cmdargs = getcmd();
+    if(cmdargs->cmd == START) {
+       if(cmdargs->argc <= 1)
            error(_("error [dumper START: not enough args: timestamp]"));
-       chunker_timestamp = newstralloc(chunker_timestamp, cmdargs.argv[2]);
+       chunker_timestamp = newstralloc(chunker_timestamp, cmdargs->argv[1]);
     }
     else {
+       log_add(L_INFO, "%s pid %ld", get_pname(), (long)getpid());
        error(_("Didn't get START command"));
     }
 
 /*    do {*/
-       cmd = getcmd(&cmdargs);
+       cmdargs = getcmd();
 
-       switch(cmd) {
+       switch(cmdargs->cmd) {
        case QUIT:
            break;
 
@@ -206,96 +212,91 @@ main(
             *   use
             *   options
             */
-           cmdargs.argc++;                     /* true count of args */
-           a = 2;
+           a = 1;
 
-           if(a >= cmdargs.argc) {
+           if(a >= cmdargs->argc) {
                error(_("error [chunker PORT-WRITE: not enough args: handle]"));
                /*NOTREACHED*/
            }
-           handle = newstralloc(handle, cmdargs.argv[a++]);
+           handle = newstralloc(handle, cmdargs->argv[a++]);
 
-           if(a >= cmdargs.argc) {
+           if(a >= cmdargs->argc) {
                error(_("error [chunker PORT-WRITE: not enough args: filename]"));
                /*NOTREACHED*/
            }
-           qfilename = newstralloc(qfilename, cmdargs.argv[a++]);
-           if (filename != NULL)
-               amfree(filename);
-           filename = unquote_string(qfilename);
-           amfree(qfilename);
+           filename = newstralloc(filename, cmdargs->argv[a++]);
 
-           if(a >= cmdargs.argc) {
+           if(a >= cmdargs->argc) {
                error(_("error [chunker PORT-WRITE: not enough args: hostname]"));
                /*NOTREACHED*/
            }
-           hostname = newstralloc(hostname, cmdargs.argv[a++]);
+           hostname = newstralloc(hostname, cmdargs->argv[a++]);
 
-           if(a >= cmdargs.argc) {
+           if(a >= cmdargs->argc) {
                error(_("error [chunker PORT-WRITE: not enough args: features]"));
                /*NOTREACHED*/
            }
            am_release_feature_set(their_features);
-           their_features = am_string_to_feature(cmdargs.argv[a++]);
+           their_features = am_string_to_feature(cmdargs->argv[a++]);
 
-           if(a >= cmdargs.argc) {
+           if(a >= cmdargs->argc) {
                error(_("error [chunker PORT-WRITE: not enough args: diskname]"));
                /*NOTREACHED*/
            }
-           qdiskname = newstralloc(qdiskname, cmdargs.argv[a++]);
-           if (diskname != NULL)
-               amfree(diskname);
-           diskname = unquote_string(qdiskname);
+           diskname = newstralloc(diskname, cmdargs->argv[a++]);
+           if (qdiskname)
+               amfree(qdiskname);
+           qdiskname = quote_string(diskname); /* qdiskname is a global */
 
-           if(a >= cmdargs.argc) {
+           if(a >= cmdargs->argc) {
                error(_("error [chunker PORT-WRITE: not enough args: level]"));
                /*NOTREACHED*/
            }
-           level = atoi(cmdargs.argv[a++]);
+           level = atoi(cmdargs->argv[a++]);
 
-           if(a >= cmdargs.argc) {
+           if(a >= cmdargs->argc) {
                error(_("error [chunker PORT-WRITE: not enough args: dumpdate]"));
                /*NOTREACHED*/
            }
-           dumpdate = newstralloc(dumpdate, cmdargs.argv[a++]);
+           dumpdate = newstralloc(dumpdate, cmdargs->argv[a++]);
 
-           if(a >= cmdargs.argc) {
+           if(a >= cmdargs->argc) {
                error(_("error [chunker PORT-WRITE: not enough args: chunksize]"));
                /*NOTREACHED*/
            }
-           chunksize = OFF_T_ATOI(cmdargs.argv[a++]);
+           chunksize = OFF_T_ATOI(cmdargs->argv[a++]);
            chunksize = am_floor(chunksize, (off_t)DISK_BLOCK_KB);
 
-           if(a >= cmdargs.argc) {
+           if(a >= cmdargs->argc) {
                error(_("error [chunker PORT-WRITE: not enough args: progname]"));
                /*NOTREACHED*/
            }
-           progname = newstralloc(progname, cmdargs.argv[a++]);
+           progname = newstralloc(progname, cmdargs->argv[a++]);
 
-           if(a >= cmdargs.argc) {
+           if(a >= cmdargs->argc) {
                error(_("error [chunker PORT-WRITE: not enough args: use]"));
                /*NOTREACHED*/
            }
-           use = am_floor(OFF_T_ATOI(cmdargs.argv[a++]), DISK_BLOCK_KB);
+           use = am_floor(OFF_T_ATOI(cmdargs->argv[a++]), DISK_BLOCK_KB);
 
-           if(a >= cmdargs.argc) {
+           if(a >= cmdargs->argc) {
                error(_("error [chunker PORT-WRITE: not enough args: options]"));
                /*NOTREACHED*/
            }
-           options = newstralloc(options, cmdargs.argv[a++]);
+           options = newstralloc(options, cmdargs->argv[a++]);
 
-           if(a != cmdargs.argc) {
+           if(a != cmdargs->argc) {
                error(_("error [chunker PORT-WRITE: too many args: %d != %d]"),
-                     cmdargs.argc, a);
+                     cmdargs->argc, a);
                /*NOTREACHED*/
            }
 
            if((infd = startup_chunker(filename, use, chunksize, &db)) < 0) {
-               q = squotef(_("[chunker startup failed: %s]"), errstr);
+               q = quote_string(vstrallocf(_("[chunker startup failed: %s]"), errstr));
                putresult(TRYAGAIN, "%s %s\n", handle, q);
-               error("startup_chunker failed");
+               error("startup_chunker failed: %s", errstr);
            }
-           command_in_transit = -1;
+           command_in_transit = NULL;
            if(infd >= 0 && do_chunk(infd, &db)) {
                char kb_str[NUM_STR_SIZE];
                char kps_str[NUM_STR_SIZE];
@@ -309,12 +310,16 @@ main(
                                isnormal(rt) ? (double)dumpsize / rt : 0.0);
                errstr = newvstrallocf(errstr, "sec %s kb %s kps %s",
                                walltime_str(runtime), kb_str, kps_str);
-               q = squotef("[%s]", errstr);
-               if(command_in_transit != -1)
-                   cmd = command_in_transit;
-               else
-                   cmd = getcmd(&cmdargs);
-               switch(cmd) {
+               m = vstrallocf("[%s]", errstr);
+               q = quote_string(m);
+               amfree(m);
+               if(command_in_transit != NULL) {
+                   cmdargs = command_in_transit;
+                   command_in_transit = NULL;
+               } else {
+                   cmdargs = getcmd();
+               }
+               switch(cmdargs->cmd) {
                case DONE:
                    putresult(DONE, "%s %lld %s\n", handle,
                             (long long)(dumpsize - (off_t)headersize), q);
@@ -334,9 +339,11 @@ main(
                    }
                    else {
                        errstr = newvstrallocf(errstr,
-                                       _("dumper returned %s"), cmdstr[cmd]);
+                                       _("dumper returned %s"), cmdstr[cmdargs->cmd]);
                        amfree(q);
-                       q = squotef("[%s]",errstr);
+                       m = vstrallocf("[%s]",errstr);
+                       q = quote_string(m);
+                       amfree(m);
                        putresult(FAILED, "%s %s\n", handle, q);
                        log_add(L_FAIL, "%s %s %s %d [%s]",
                                hostname, qdiskname, chunker_timestamp, level, errstr);
@@ -345,25 +352,25 @@ main(
                }
                amfree(q);
            } else if(infd != -2) {
+               if(q == NULL) {
+                   m = vstrallocf("[%s]", errstr);
+                   q = quote_string(m);
+                   amfree(m);
+               }
                if(!abort_pending) {
-                   if(q == NULL) {
-                       q = squotef("[%s]", errstr);
-                   }
                    putresult(FAILED, "%s %s\n", handle, q);
-                   log_add(L_FAIL, "%s %s %s %d [%s]",
-                           hostname, qdiskname, chunker_timestamp, level, errstr);
-                   amfree(q);
                }
+               log_add(L_FAIL, "%s %s %s %d [%s]",
+                       hostname, qdiskname, chunker_timestamp, level, errstr);
+               amfree(q);
            }
            amfree(filename);
            amfree(db.filename);
            break;
 
        default:
-           if(cmdargs.argc >= 1) {
-               q = squote(cmdargs.argv[1]);
-           } else if(cmdargs.argc >= 0) {
-               q = squote(cmdargs.argv[0]);
+           if(cmdargs->argc >= 1) {
+               q = quote_string(cmdargs->argv[0]);
            } else {
                q = stralloc(_("(no input?)"));
            }
@@ -372,7 +379,9 @@ main(
            break;
        }
 
-/*    } while(cmd != QUIT); */
+/*    } while(cmdargs->cmd != QUIT); */
+
+    log_add(L_INFO, "pid-done %ld", (long)getpid());
 
     amfree(errstr);
     amfree(chunker_timestamp);
@@ -383,6 +392,9 @@ main(
     amfree(dumpdate);
     amfree(progname);
     amfree(options);
+    free_cmdargs(cmdargs);
+    if (command_in_transit)
+       free_cmdargs(command_in_transit);
     am_release_feature_set(their_features);
     their_features = NULL;
 
@@ -417,6 +429,7 @@ startup_chunker(
     }
     data_socket = stream_server(res->ai_family, &data_port, 0,
                                STREAM_BUFSIZE, 0);
+    if (res) freeaddrinfo(res);
 
     if(data_socket < 0) {
        errstr = vstrallocf(_("error creating stream server: %s"), strerror(errno));
@@ -426,6 +439,7 @@ startup_chunker(
     putresult(PORT, "%d\n", data_port);
 
     infd = stream_accept(data_socket, CONNECT_TIMEOUT, 0, STREAM_BUFSIZE);
+    aclose(data_socket);
     if(infd == -1) {
        errstr = vstrallocf(_("error accepting stream: %s"), strerror(errno));
        return -1;
@@ -433,15 +447,18 @@ startup_chunker(
 
     tmp_filename = vstralloc(filename, ".tmp", NULL);
     pc = strrchr(tmp_filename, '/');
+    g_assert(pc != NULL);
     *pc = '\0';
     mkholdingdir(tmp_filename);
     *pc = '/';
     if ((outfd = open(tmp_filename, O_RDWR|O_CREAT|O_TRUNC, 0600)) < 0) {
        int save_errno = errno;
-
-       errstr = squotef(_("holding file \"%s\": %s"),
+       char *m = vstrallocf(_("holding file \"%s\": %s"),
                         tmp_filename,
                         strerror(errno));
+
+       errstr = quote_string(m);
+       amfree(m);
        amfree(tmp_filename);
        aclose(infd);
        if(save_errno == ENOSPC) {
@@ -463,7 +480,7 @@ do_chunk(
     int                        infd,
     struct databuf *   db)
 {
-    ssize_t nread;
+    size_t nread;
     char header_buf[DISK_BLOCK_BYTES];
 
     startclock();
@@ -477,23 +494,23 @@ do_chunk(
      * need to save into "file", as well as write out.  Later, the
      * chunk code will rewrite it.
      */
-    nread = fullread(infd, header_buf, SIZEOF(header_buf));
-    if (nread != DISK_BLOCK_BYTES) {
-       if(nread < 0) {
+    nread = full_read(infd, header_buf, SIZEOF(header_buf));
+    if (nread != sizeof(header_buf)) {
+       if(errno != 0) {
            errstr = vstrallocf(_("cannot read header: %s"), strerror(errno));
        } else {
-           errstr = vstrallocf(_("cannot read header: got %zd bytes instead of %d"),
-                               nread,
-                               DISK_BLOCK_BYTES);
+           errstr = vstrallocf(_("cannot read header: got %zd bytes instead of %zd"),
+                               nread, sizeof(header_buf));
        }
        return 0;
     }
     parse_file_header(header_buf, &file, (size_t)nread);
     if(write_tapeheader(db->fd, &file)) {
        int save_errno = errno;
-
-       errstr = squotef(_("write_tapeheader file %s: %s"),
+       char *m = vstrallocf(_("write_tapeheader file %s: %s"),
                         db->filename, strerror(errno));
+       errstr = quote_string(m);
+       amfree(m);
        if(save_errno == ENOSPC) {
            putresult(NO_ROOM, "%s %lld\n", handle, 
                      (long long)(db->use+db->split_size-dumpsize));
@@ -508,7 +525,7 @@ do_chunk(
      * We've written the file header.  Now, just write data until the
      * end.
      */
-    while ((nread = fullread(infd, db->buf,
+    while ((nread = full_read(infd, db->buf,
                             (size_t)(db->datalimit - db->datain))) > 0) {
        db->datain += nread;
        while(db->dataout < db->datain) {
@@ -558,12 +575,11 @@ static int
 databuf_flush(
     struct databuf *   db)
 {
-    struct cmdargs cmdargs;
+    struct cmdargs *cmdargs = NULL;
     int rc = 1;
-    ssize_t written;
+    size_t written;
     off_t left_in_chunk;
     char *arg_filename = NULL;
-    char *qarg_filename = NULL;
     char *new_filename = NULL;
     char *tmp_filename = NULL;
     char sequence[NUM_STR_SIZE];
@@ -588,16 +604,14 @@ databuf_flush(
            /*
             * Probably no more space on this disk.  Request some more.
             */
-           cmd_t cmd;
-
            putresult(RQ_MORE_DISK, "%s\n", handle);
-           cmd = getcmd(&cmdargs);
-           if(command_in_transit == -1 &&
-              (cmd == DONE || cmd == TRYAGAIN || cmd == FAILED)) {
-               command_in_transit = cmd;
-               cmd = getcmd(&cmdargs);
+           cmdargs = getcmd();
+           if(command_in_transit == NULL &&
+              (cmdargs->cmd == DONE || cmdargs->cmd == TRYAGAIN || cmdargs->cmd == FAILED)) {
+               command_in_transit = cmdargs;
+               cmdargs = getcmd();
            }
-           if(cmd == CONTINUE) {
+           if(cmdargs->cmd == CONTINUE) {
                /*
                 * CONTINUE
                 *   serial
@@ -605,34 +619,30 @@ databuf_flush(
                 *   chunksize
                 *   use
                 */
-               cmdargs.argc++;                 /* true count of args */
-               a = 3;
+               a = 2; /* skip CONTINUE and serial */
 
-               if(a >= cmdargs.argc) {
+               if(a >= cmdargs->argc) {
                    error(_("error [chunker CONTINUE: not enough args: filename]"));
                    /*NOTREACHED*/
                }
-               qarg_filename = newstralloc(qarg_filename, cmdargs.argv[a++]);
-               if (arg_filename != NULL)
-                   amfree(arg_filename);
-               arg_filename = unquote_string(qarg_filename);
+               arg_filename = newstralloc(arg_filename, cmdargs->argv[a++]);
 
-               if(a >= cmdargs.argc) {
+               if(a >= cmdargs->argc) {
                    error(_("error [chunker CONTINUE: not enough args: chunksize]"));
                    /*NOTREACHED*/
                }
-               db->chunk_size = OFF_T_ATOI(cmdargs.argv[a++]);
+               db->chunk_size = OFF_T_ATOI(cmdargs->argv[a++]);
                db->chunk_size = am_floor(db->chunk_size, (off_t)DISK_BLOCK_KB);
 
-               if(a >= cmdargs.argc) {
+               if(a >= cmdargs->argc) {
                    error(_("error [chunker CONTINUE: not enough args: use]"));
                    /*NOTREACHED*/
                }
-               db->use = OFF_T_ATOI(cmdargs.argv[a++]);
+               db->use = OFF_T_ATOI(cmdargs->argv[a++]);
 
-               if(a != cmdargs.argc) {
+               if(a != cmdargs->argc) {
                    error(_("error [chunker CONTINUE: too many args: %d != %d]"),
-                         cmdargs.argc, a);
+                         cmdargs->argc, a);
                    /*NOTREACHED*/
                }
 
@@ -662,17 +672,15 @@ databuf_flush(
                     */
                    db->filename = newstralloc(db->filename, arg_filename);
                }
-           } else if(cmd == ABORT) {
+           } else if(cmdargs->cmd == ABORT) {
                abort_pending = 1;
-               errstr = newstralloc(errstr, "ERROR");
+               errstr = newstralloc(errstr, cmdargs->argv[1]);
                putresult(ABORT_FINISHED, "%s\n", handle);
                rc = 0;
                goto common_exit;
            } else {
-               if(cmdargs.argc >= 1) {
-                   q = squote(cmdargs.argv[1]);
-               } else if(cmdargs.argc >= 0) {
-                   q = squote(cmdargs.argv[0]);
+               if(cmdargs->argc >= 1) {
+                   q = quote_string(cmdargs->argv[0]);
                } else {
                    q = stralloc(_("(no input?)"));
                }
@@ -700,12 +708,14 @@ databuf_flush(
                                    ".tmp",
                                    NULL);
        pc = strrchr(tmp_filename, '/');
+        g_assert(pc != NULL); /* Only a problem if db->filename has no /. */
        *pc = '\0';
        mkholdingdir(tmp_filename);
        *pc = '/';
        newfd = open(tmp_filename, O_RDWR|O_CREAT|O_TRUNC, 0600);
        if (newfd == -1) {
            int save_errno = errno;
+           char *m;
 
            if(save_errno == ENOSPC) {
                putresult(NO_ROOM, "%s %lld\n", handle, 
@@ -714,9 +724,11 @@ databuf_flush(
                db->split_size = dumpsize;
                continue;
            }
-           errstr = squotef(_("creating chunk holding file \"%s\": %s"),
+           m = vstrallocf(_("creating chunk holding file \"%s\": %s"),
                             tmp_filename,
                             strerror(errno));
+           errstr = quote_string(m);
+           amfree(m);
            aclose(db->fd);
            rc = 0;
            goto common_exit;
@@ -726,6 +738,7 @@ databuf_flush(
        file.cont_filename[0] = '\0';
        if(write_tapeheader(newfd, &file)) {
            int save_errno = errno;
+           char *m;
 
            aclose(newfd);
            if(save_errno == ENOSPC) {
@@ -735,9 +748,11 @@ databuf_flush(
                db->split_size = dumpsize;
                continue;
            }
-           errstr = squotef(_("write_tapeheader file %s: %s"),
+           m = vstrallocf(_("write_tapeheader file %s: %s"),
                             tmp_filename,
                             strerror(errno));
+           errstr = quote_string(m);
+           amfree(m);
            rc = 0;
            goto common_exit;
        }
@@ -747,9 +762,11 @@ databuf_flush(
         * to the next chunk, and then close it.
         */
        if (lseek(db->fd, (off_t)0, SEEK_SET) < (off_t)0) {
-           errstr = squotef(_("lseek holding file %s: %s"),
+           char *m = vstrallocf(_("lseek holding file %s: %s"),
                             db->filename,
                             strerror(errno));
+           errstr = quote_string(m);
+           amfree(m);
            aclose(newfd);
            rc = 0;
            goto common_exit;
@@ -759,9 +776,11 @@ databuf_flush(
        strncpy(file.cont_filename, new_filename, SIZEOF(file.cont_filename));
        file.cont_filename[SIZEOF(file.cont_filename)-1] = '\0';
        if(write_tapeheader(db->fd, &file)) {
-           errstr = squotef(_("write_tapeheader file \"%s\": %s"),
+           char * m = vstrallocf(_("write_tapeheader file \"%s\": %s"),
                             db->filename,
                             strerror(errno));
+           errstr = quote_string(m);
+           amfree(m);
            aclose(newfd);
            unlink(tmp_filename);
            rc = 0;
@@ -806,7 +825,7 @@ databuf_flush(
     /*
      * Write out the buffer
      */
-    written = fullwrite(db->fd, db->dataout,
+    written = full_write(db->fd, db->dataout,
                        (size_t)(db->datain - db->dataout));
     if (written > 0) {
        db->dataout += written;
@@ -815,9 +834,11 @@ databuf_flush(
     dumpsize += (dumpbytes / (off_t)1024);
     filesize += (dumpbytes / (off_t)1024);
     dumpbytes %= 1024;
-    if (written < 0) {
+    if (written == 0) {
        if (errno != ENOSPC) {
-           errstr = squotef(_("data write: %s"), strerror(errno));
+           char *m = vstrallocf(_("data write: %s"), strerror(errno));
+           errstr = quote_string(m);
+           amfree(m);
            rc = 0;
            goto common_exit;
        }
@@ -841,10 +862,11 @@ databuf_flush(
 
 common_exit:
 
+    if (cmdargs)
+       free_cmdargs(cmdargs);
     amfree(new_filename);
     /*@i@*/ amfree(tmp_filename);
     amfree(arg_filename);
-    amfree(qarg_filename);
     return rc;
 }
 
@@ -858,15 +880,18 @@ write_tapeheader(
     dumpfile_t *file)
 {
     char *buffer;
-    ssize_t written;
+    size_t written;
 
     file->blocksize = DISK_BLOCK_BYTES;
     buffer = build_header(file, DISK_BLOCK_BYTES);
 
-    written = fullwrite(outfd, buffer, DISK_BLOCK_BYTES);
+    written = full_write(outfd, buffer, DISK_BLOCK_BYTES);
     amfree(buffer);
     if(written == DISK_BLOCK_BYTES) return 0;
-    if(written < 0) return written;
-    errno = ENOSPC;
+
+    /* fake ENOSPC when we get a short write without errno set */
+    if(errno == 0)
+       errno = ENOSPC;
+
     return (ssize_t)-1;
 }
index 816c19488a71260fffe5cb8db56826ced6f5e731..892b6a3c6b600120081ff99388febf2426ebfccf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005 Zmanda Inc.  All Rights Reserved.
+ * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
  * 
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 as published
@@ -14,8 +14,8 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  * 
- * Contact information: Zmanda Inc, 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  *
  * Author: Dustin J. Mitchell <dustin@zmanda.com>
  */
@@ -39,8 +39,7 @@ dumpspec_new(
 {
     dumpspec_t *rv;
 
-    rv = calloc(1, sizeof(*rv));
-    if (!rv) return NULL;
+    rv = g_new0(dumpspec_t, 1);
     if (host) rv->host = stralloc(host);
     if (disk) rv->disk = stralloc(disk);
     if (datestamp) rv->datestamp = stralloc(datestamp);
@@ -241,7 +240,10 @@ cmdline_match_holding(
     for (hi = holding_files; hi != NULL; hi = hi->next) {
        /* TODO add level */
        if (!holding_file_get_dumpfile((char *)hi->data, &file)) continue;
-        if (file.type != F_DUMPFILE) continue;
+        if (file.type != F_DUMPFILE) {
+           dumpfile_free_data(&file);
+           continue;
+       }
         for (li = dumpspec_list; li != NULL; li = li->next) {
            de = (dumpspec_t *)(li->data);
             if (de->host && de->host[0] && !match_host(de->host, file.name)) continue;
@@ -250,6 +252,7 @@ cmdline_match_holding(
             matching_files = g_slist_append(matching_files, g_strdup((char *)hi->data));
             break;
         }
+       dumpfile_free_data(&file);
     }
 
     g_slist_free_full(holding_files);
index 9d0489f634ac56eecce59660b674939a008288a2..4fa6c53f871689693e2c0e4f7d9d6d484439f617 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005 Zmanda Inc.  All Rights Reserved.
+ * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
  * 
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 as published
@@ -14,8 +14,8 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  * 
- * Contact information: Zmanda Inc, 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  *
  * Author: Dustin J. Mitchell <dustin@zmanda.com>
  */
index b909b0dcc97ba032920b6fbb2f3c87246dd21960..5c3662ef558227b7546fa778c6d21c9ddc67f5e1 100644 (file)
@@ -34,6 +34,7 @@
 #include "conffile.h"
 #include "diskfile.h"
 #include "util.h"
+#include "amxml.h"
 
 static am_host_t *hostlist;
 static netif_t *all_netifs;
@@ -45,22 +46,29 @@ static void disk_parserror(const char *, int, const char *, ...)
                            G_GNUC_PRINTF(3, 4);
 
 
-int
+cfgerr_level_t
 read_diskfile(
     const char *filename,
     disklist_t *lst)
 {
     FILE *diskf;
     int line_num;
-    char *line;
+    char *line = NULL;
 
     /* initialize */
     hostlist = NULL;
     lst->head = lst->tail = NULL;
     line_num = 0;
 
+    /* if we already have config errors, then don't bother */
+    if (config_errors(NULL) >= CFGERR_ERRORS) {
+       return config_errors(NULL);
+    }
+
     if ((diskf = fopen(filename, "r")) == NULL) {
-       return -1;
+       config_add_error(CFGERR_ERRORS,
+           vstrallocf(_("Could not open '%s': %s"), filename, strerror(errno)));
+       goto end;
         /*NOTREACHED*/
     }
 
@@ -68,16 +76,16 @@ read_diskfile(
        line_num++;
        if (line[0] != '\0') {
            if (parse_diskline(lst, filename, diskf, &line_num, &line) < 0) {
-               amfree(line);
-               afclose(diskf);
-               return (-1);
+               goto end;
            }
        }
        amfree(line);
     }
 
+end:
+    amfree(line);
     afclose(diskf);
-    return (0);
+    return config_errors(NULL);
 }
 
 am_host_t *
@@ -187,6 +195,7 @@ add_disk(
     am_host_t *host;
 
     disk = alloc(SIZEOF(disk_t));
+    bzero(disk, SIZEOF(disk_t));
     disk->line = 0;
     disk->tape_splitsize = (off_t)0;
     disk->split_diskbuffer = NULL;
@@ -205,6 +214,8 @@ add_disk(
     disk->exclude_file = NULL;
     disk->include_list = NULL;
     disk->include_file = NULL;
+    disk->application = NULL;
+    disk->pp_scriptlist = NULL;
 
     host = lookup_host(hostname);
     if(host == NULL) {
@@ -220,6 +231,8 @@ add_disk(
        host->start_t = 0;
        host->up = NULL;
        host->features = NULL;
+       host->pre_script = 0;
+       host->post_script = 0;
     }
     enqueue_disk(list, disk);
 
@@ -433,7 +446,11 @@ parse_diskline(
     skip_quoted_string(s, ch);
     s[-1] = '\0';
     diskname = unquote_string(fp);
-
+    if (strlen(diskname) == 0) {
+       disk_parserror(filename, line_num, _("invalid empty diskname"));
+       amfree(hostname);
+       return (-1);
+    }
     skip_whitespace(s, ch);
     if(ch == '\0' || ch == '#') {
        disk_parserror(filename, line_num, _("disk dumptype expected"));
@@ -450,6 +467,11 @@ parse_diskline(
     diskdevice = NULL;
     if(fp[0] != '{') {
        dumptype = unquote_string(fp);
+       if (strlen(dumptype) == 0) {
+           disk_parserror(filename, line_num, _("invalid empty diskdevice"));
+           amfree(hostname);
+           return (-1);
+       }
        if ((dtype = lookup_dumptype(dumptype)) == NULL) {
            diskdevice = dumptype;
            skip_whitespace(s, ch);
@@ -479,12 +501,17 @@ parse_diskline(
        } else {
            disk = host->disks;
            do {
-               if (match_disk(diskname, disk->name) &&
-                   match_disk(disk->name, diskname)) {
+               char *a1, *a2;
+               a1 = clean_regex(diskname);
+               a2 = clean_regex(disk->name);
+
+               if (match_disk(a1, disk->name) && match_disk(a2, diskname)) {
                    dup = 1;
                } else {
                    disk = disk->hostnext;
                }
+               amfree(a1);
+               amfree(a2);
            }
            while (dup == 0 && disk != NULL);
        }
@@ -503,11 +530,13 @@ parse_diskline(
        disk->spindle = -1;
        disk->up = NULL;
        disk->inprogress = 0;
+       disk->application = NULL;
+       disk->pp_scriptlist = NULL;
     }
 
     if (host) {
        sdisk = sanitise_filename(diskname);
-       for (dp = host->disks; dp != NULL; dp = dp->next) {
+       for (dp = host->disks; dp != NULL; dp = dp->hostnext) {
            char *sdiskp = sanitise_filename(dp->name);
            if (strcmp(diskname, dp->name) != 0 &&
                 strcmp(sdisk, sdiskp) == 0) {
@@ -546,7 +575,8 @@ parse_diskline(
            return (-1);
        }
        dtype = read_dumptype(vstralloc("custom(", hostname,
-                                       ":", disk->name, ")", NULL),
+                                       ":", disk->name, ")",
+                                       ".", anonymous_value(), NULL),
                              diskf, (char*)filename, line_num_p);
        if (dtype == NULL || dup) {
            disk_parserror(filename, line_num,
@@ -592,6 +622,8 @@ parse_diskline(
     }
 
     if (dup) {
+       /* disk_parserror already called, above */
+       g_assert(config_errors(NULL) != CFGERR_OK);
        amfree(hostname);
        amfree(diskdevice);
        amfree(diskname);
@@ -620,6 +652,8 @@ parse_diskline(
     disk->bumpdays          = dumptype_get_bumpdays(dtype);
     disk->bumpmult          = dumptype_get_bumpmult(dtype);
     disk->starttime          = dumptype_get_starttime(dtype);
+    disk->application        = dumptype_get_application(dtype);
+    disk->pp_scriptlist      = dumptype_get_pp_scriptlist(dtype);
     disk->start_t = 0;
     if (disk->starttime > 0) {
        st = time(NULL);
@@ -724,6 +758,18 @@ parse_diskline(
        disk_parserror(filename, line_num, _("end of line expected"));
     }
 
+    if (disk->program && disk->application &&
+       strcmp(disk->program,"APPLICATION")) {
+       disk_parserror(filename, line_num,
+                      _("Both program and application set"));
+    }
+
+    if (disk->program && strcmp(disk->program,"APPLICATION")==0 &&
+       !disk->application) {
+       disk_parserror(filename, line_num,
+                      _("program set to APPLICATION but no application set"));
+    }
+
     if(dumptype_get_ignore(dtype) || dumptype_get_strategy(dtype) == DS_SKIP) {
        disk->todo = 0;
     }
@@ -744,6 +790,8 @@ parse_diskline(
        host->start_t = 0;
        host->up = NULL;
        host->features = NULL;
+       host->pre_script = 0;
+       host->post_script = 0;
     } else {
        amfree(hostname);
     }
@@ -765,15 +813,18 @@ printf_arglist_function2(void disk_parserror, const char *, filename,
     int, line_num, const char *, format)
 {
     va_list argp;
-    const char *xlated_fmt = gettext(format);
+    char * msg;
+    char * errstr;
 
-    /* print error message */
+    /* format the error message and hand it off to conffile */
 
-    g_fprintf(stderr, "\"%s\", line %d: ", filename, line_num);
     arglist_start(argp, format);
-    g_vfprintf(stderr, xlated_fmt, argp);
+    msg = g_strdup_vprintf(format, argp);
+    errstr = g_strdup_printf("\"%s\", line %d: %s", filename, line_num, msg);
+    amfree(msg);
     arglist_end(argp);
-    fputc('\n', stderr);
+
+    config_add_error(CFGERR_ERRORS, errstr);
 }
 
 
@@ -993,7 +1044,7 @@ optionstr(
                      _("ERROR: %s:%s No encryption program specified in dumptypes\n"),
                      dp->host->hostname, qdpname);
              g_fprintf(fdout, _("Change the dumptype in the disklist or mention "
-                              "the ecnryption program to use in the dumptypes file"));
+                              "the ecnryption program to use in the dumptypes file\n"));
 
            }
            err++;
@@ -1005,14 +1056,14 @@ optionstr(
           }
           else if(fdout) {
            g_fprintf(fdout,
-                   _("WARNING: %s:%s does not support server decrypt option\n"),
+                   _("WARNING: %s:%s client version does not support server data decryption\n"),
                    dp->host->hostname, qdpname);
           }
         }
       }
       else if(fdout) {
            g_fprintf(fdout,
-                   _("WARNING: %s:%s does not support server data encryption\n"),
+                   _("WARNING: %s:%s client version does not support server data encryption\n"),
                    dp->host->hostname, qdpname);
       }
         break;
@@ -1215,6 +1266,630 @@ optionstr(
 }
 
  
+char *
+xml_optionstr(
+    disk_t *           dp,
+    am_feature_t *     their_features,
+    FILE *             fdout,
+    int                 to_server)
+{
+    char *auth_opt = stralloc("");
+    char *kencrypt_opt = stralloc("");
+    char *compress_opt = stralloc("");
+    char *encrypt_opt = stralloc("");
+    char *decrypt_opt = stralloc("");
+    char *record_opt = stralloc("");
+    char *index_opt = stralloc("");
+    char *exclude = stralloc("");
+    char *exclude_file = NULL;
+    char *exclude_list = NULL;
+    char *include = stralloc("");
+    char *include_file = NULL;
+    char *include_list = NULL;
+    char *excl_opt = "";
+    char *incl_opt = "";
+    char *exc = NULL;
+    char *script_opt;
+    char *result = NULL;
+    sle_t *excl;
+    int nb_exclude_file;
+    int nb_include_file;
+    char *qdpname;
+    char *q64name;
+    int err=0;
+
+    assert(dp != NULL);
+    assert(dp->host != NULL);
+
+    qdpname = quote_string(dp->name);
+    if(am_has_feature(dp->host->features, fe_options_auth)) {
+       auth_opt = vstralloc("  <auth>", dp->security_driver, "</auth>\n", NULL);
+    } else if(fdout) {
+       fprintf(fdout,
+               _("WARNING: %s:%s does not support auth\n"),
+               dp->host->hostname, qdpname);
+    }
+
+    switch(dp->compress) {
+    case COMP_FAST:
+       if(am_has_feature(their_features, fe_options_compress_fast)) {
+           compress_opt = "  <compress>FAST</compress>\n";
+       }
+       else if(fdout) {
+           fprintf(fdout,
+                   _("WARNING: %s:%s does not support fast compression\n"),
+                   dp->host->hostname, qdpname);
+       }
+       break;
+    case COMP_BEST:
+       if(am_has_feature(their_features, fe_options_compress_best)) {
+           compress_opt = "  <compress>BEST</compress>\n";
+       }
+       else if(fdout) {
+           fprintf(fdout,
+                   _("WARNING: %s:%s does not support best compression\n"),
+                   dp->host->hostname, qdpname);
+       }
+       break;
+    case COMP_CUST:
+        if(am_has_feature(their_features, fe_options_compress_cust)) {
+           if (dp->clntcompprog == NULL) {
+               if(fdout) {
+                   fprintf(fdout,
+                           _("ERROR: %s:%s client custom compression with no compression program specified\n"),
+                           dp->host->hostname, qdpname);
+                   }
+               err++;
+           } else {
+
+               compress_opt = vstralloc("  <compress>CUSTOM"
+                                        "<custom-compress-program>",
+                                        dp->clntcompprog,
+                                        "</custom-compress-program>\n"
+                                        "  </compress>\n", NULL);
+           }
+       }
+       else if(fdout) {
+           fprintf(fdout,
+                   _("WARNING: %s:%s does not support client custom compression\n"),
+                   dp->host->hostname, qdpname);
+       }
+       break;
+    case COMP_SERVER_FAST:
+       compress_opt = "  <compress>SERVER-FAST</compress>\n";
+       break;
+    case COMP_SERVER_BEST:
+       compress_opt = "  <compress>SERVER-BEST</compress>\n";
+       break;
+    case COMP_SERVER_CUST:
+       compress_opt = "  <compress>SERVER-CUSTOM</compress>\n";
+       if (dp->srvcompprog == NULL) {
+           if(fdout) {
+               fprintf(fdout,
+                       _("ERROR: %s:%s server custom compression with no compression program specified\n"),
+                       dp->host->hostname, qdpname);
+           }
+           err++;
+       } else {
+           compress_opt = vstralloc("  <compress>SERVER-CUSTOM"
+                                    "<custom-compress-program>",
+                                    dp->srvcompprog,
+                                    "</custom-compress-program>\n"
+                                    "  </compress>\n", NULL);
+       }
+       break;
+    }
+
+    switch(dp->encrypt) {
+    case ENCRYPT_CUST:
+       if(am_has_feature(their_features, fe_options_encrypt_cust)) {
+           if(dp->clnt_decrypt_opt) {
+               if(am_has_feature(their_features, fe_options_client_decrypt_option)) {
+                   decrypt_opt = newvstralloc(decrypt_opt,
+                                              "    <decrypt-option>",
+                                              dp->clnt_decrypt_opt,
+                                              "</decrypt-option>\n", NULL);
+               } else if(fdout) {
+                   fprintf(fdout,
+                           _("WARNING: %s:%s does not support client decrypt option\n"),
+                           dp->host->hostname, qdpname);
+               }
+           }
+           if (dp->clnt_encrypt == NULL) {
+               if(fdout) {
+                   fprintf(fdout,
+                           _("ERROR: %s:%s encrypt client with no encryption program specified\n"),
+                           dp->host->hostname, qdpname);
+               }
+               err++;
+           } else if (decrypt_opt) {
+                encrypt_opt = newvstralloc(encrypt_opt,
+                                           "  <encrypt>CUSTOM"
+                                           "<custom-encrypt-program>",
+                                           dp->clnt_encrypt,
+                                           "</custom-encrypt-program>\n",
+                                           decrypt_opt,
+                                           "  </encrypt>\n", NULL);
+           }
+           if (dp->compress == COMP_SERVER_FAST || 
+               dp->compress == COMP_SERVER_BEST ||
+               dp->compress == COMP_SERVER_CUST ) {
+               if(fdout) {
+                   fprintf(fdout,
+                           _("ERROR: %s:Client encryption with server compression is "
+                           "not supported. See amanda.conf(5) for detail.\n"),
+                           dp->host->hostname);
+               }
+               err++;
+           }
+       } else if(fdout) {
+           fprintf(fdout,
+                   _("WARNING: %s:%s does not support client data encryption\n"),
+                   dp->host->hostname, qdpname);
+       }
+       break;
+    case ENCRYPT_SERV_CUST:
+       if (dp->srv_encrypt != NULL && to_server) {
+           decrypt_opt =  newvstralloc(decrypt_opt,
+                                       "    <decrypt-option>",
+                                       dp->srv_decrypt_opt, 
+                                       "</decrypt-option>\n", NULL);
+           encrypt_opt = newvstralloc(encrypt_opt,
+                                      "  <encrypt>SERVER-CUSTOM"
+                                      "<custom-encrypt-program>",
+                                      dp->srv_encrypt,
+                                      "</custom-encrypt-program>\n",
+                                      decrypt_opt,
+                                      "  </encrypt>\n", NULL);
+       } else if (dp->srv_encrypt == NULL) {
+           if(fdout) {
+               fprintf(fdout,
+                       _("ERROR: %s:%s No encryption program specified in dumptypes\n"),
+                       dp->host->hostname, qdpname);
+               fprintf(fdout,
+                        _("Change the dumptype in the disklist or mention "
+                       "the encryption program to use in the dumptypes file\n"));
+           }
+           err++;
+       }
+       break;
+    }
+    
+    if(!dp->record) {
+       if(am_has_feature(their_features, fe_options_no_record)) {
+           record_opt = "  <record>NO</record>\n";
+       }
+       else if(fdout) {
+           fprintf(fdout, _("WARNING: %s:%s does not support no record\n"),
+                   dp->host->hostname, qdpname);
+       }
+    } else {
+       record_opt = "  <record>YES</record>\n";
+    }
+
+    if(dp->index) {
+       if(am_has_feature(their_features, fe_options_index)) {
+           index_opt = "  <index>YES</index>\n";
+       }
+       else if(fdout) {
+           fprintf(fdout, _("WARNING: %s:%s does not support index\n"),
+                   dp->host->hostname, qdpname);
+       }
+    }
+
+    if(dp->kencrypt) {
+       if(am_has_feature(their_features, fe_options_kencrypt)) {
+           kencrypt_opt = "  <kencrypt>YES</kencrypt>\n";
+       }
+       else if(fdout) {
+           fprintf(fdout, _("WARNING: %s:%s does not support kencrypt\n"),
+                   dp->host->hostname, qdpname);
+       }
+    }
+
+    exclude_file = stralloc("");
+    nb_exclude_file = 0;
+    if(dp->exclude_file != NULL && dp->exclude_file->nb_element > 0) {
+       nb_exclude_file = dp->exclude_file->nb_element;
+       if(am_has_feature(their_features, fe_options_exclude_file)) {
+           if(am_has_feature(their_features, fe_options_multiple_exclude) ||
+              dp->exclude_file->nb_element == 1) {
+               for(excl = dp->exclude_file->first; excl != NULL;
+                                                   excl = excl->next) {
+                   q64name = amxml_format_tag("file", excl->name);
+                   exc = newvstralloc( exc, "    ", q64name, "\n", NULL);
+                   strappend(exclude_file, exc);
+                   amfree(q64name);
+               }
+           } else {
+               q64name = amxml_format_tag("file", dp->exclude_file->last->name);
+               exc = newvstralloc(exc, "    ", q64name, "\n", NULL);
+               strappend(exclude_file, exc);
+               if(fdout) {
+                   fprintf(fdout,
+                      _("WARNING: %s:%s does not support multiple exclude\n"),
+                      dp->host->hostname, qdpname);
+               }
+               amfree(q64name);
+           }
+       } else if(fdout) {
+           fprintf(fdout, _("WARNING: %s:%s does not support exclude file\n"),
+                   dp->host->hostname, qdpname);
+       }
+    }
+    exclude_list = stralloc("");
+    if(dp->exclude_list != NULL && dp->exclude_list->nb_element > 0) {
+       if(am_has_feature(their_features, fe_options_exclude_list)) {
+           if(am_has_feature(their_features, fe_options_multiple_exclude) ||
+              (dp->exclude_list->nb_element == 1 && nb_exclude_file == 0)) {
+               for(excl = dp->exclude_list->first; excl != NULL;
+                                                   excl = excl->next) {
+                   q64name = amxml_format_tag("list", excl->name);
+                   exc = newvstralloc(exc, "    ", q64name, "\n", NULL);
+                   strappend(exclude_list, exc);
+                   amfree(q64name);
+               }
+           } else {
+               q64name = amxml_format_tag("list", dp->exclude_list->last->name);
+               exc = newvstralloc(exc, "    ", q64name, "\n", NULL);
+               strappend(exclude_list, exc);
+               if(fdout) {
+                       fprintf(fdout,
+                        _("WARNING: %s:%s does not support multiple exclude\n"),
+                        dp->host->hostname, qdpname);
+               }
+               amfree(q64name);
+           }
+       } else if(fdout) {
+           fprintf(fdout, _("WARNING: %s:%s does not support exclude list\n"),
+                   dp->host->hostname, qdpname);
+       }
+    }
+
+    include_file = stralloc("");
+    nb_include_file = 0;
+    if(dp->include_file != NULL && dp->include_file->nb_element > 0) {
+       nb_include_file = dp->include_file->nb_element;
+       if(am_has_feature(their_features, fe_options_include_file)) {
+           if(am_has_feature(their_features, fe_options_multiple_include) ||
+              dp->include_file->nb_element == 1) {
+               for(excl = dp->include_file->first; excl != NULL;
+                                                   excl = excl->next) {
+                   q64name = amxml_format_tag("file", excl->name);
+                   exc = newvstralloc( exc, "    ", q64name, "\n", NULL);
+                   strappend(include_file, exc);
+                   amfree(q64name);
+               }
+           } else {
+               q64name = amxml_format_tag("file", dp->include_file->last->name);
+               exc = newvstralloc(exc, "    ", q64name, "\n", NULL);
+               strappend(include_file, exc);
+               if(fdout) {
+                   fprintf(fdout,
+                        _("WARNING: %s:%s does not support multiple include\n"),
+                        dp->host->hostname, qdpname);
+               }
+               amfree(q64name);
+           }
+       } else if(fdout) {
+           fprintf(fdout, _("WARNING: %s:%s does not support include file\n"),
+                   dp->host->hostname, qdpname);
+       }
+    }
+    include_list = stralloc("");
+    if(dp->include_list != NULL && dp->include_list->nb_element > 0) {
+       if(am_has_feature(their_features, fe_options_include_list)) {
+           if(am_has_feature(their_features, fe_options_multiple_include) ||
+              (dp->include_list->nb_element == 1 && nb_include_file == 0)) {
+               for(excl = dp->include_list->first; excl != NULL;
+                                                   excl = excl->next) {
+                   q64name = amxml_format_tag("list", excl->name);
+                   exc = newvstralloc( exc, "    ", q64name, "\n", NULL);
+                   strappend(include_list, exc);
+                   amfree(q64name);
+               }
+           } else {
+               q64name = amxml_format_tag("list", dp->include_list->last->name);
+               exc = newvstralloc(exc, "    ", q64name, "\n", NULL);
+               strappend(include_list, exc);
+               if(fdout) {
+                       fprintf(fdout,
+                        _("WARNING: %s:%s does not support multiple include\n"),
+                        dp->host->hostname, qdpname);
+               }
+               amfree(q64name);
+           }
+       } else if(fdout) {
+           fprintf(fdout, _("WARNING: %s:%s does not support include list\n"),
+                   dp->host->hostname, qdpname);
+       }
+    }
+
+    if(dp->exclude_optional) {
+       if(am_has_feature(their_features, fe_options_optional_exclude)) {
+           excl_opt = "    <optional>YES</optional>\n";
+       }
+       else if(fdout) {
+           fprintf(fdout,
+                   _("WARNING: %s:%s does not support optional exclude\n"),
+                   dp->host->hostname, qdpname);
+       }
+    }
+    if(dp->include_optional) {
+       if(am_has_feature(their_features, fe_options_optional_include)) {
+           incl_opt = "    <optional>YES</optional>\n";
+       }
+       else if(fdout) {
+           fprintf(fdout,
+                   _("WARNING: %s:%s does not support optional include\n"),
+                   dp->host->hostname, qdpname);
+       }
+    }
+
+    if (dp->exclude_file || dp->exclude_list)
+       exclude = newvstralloc(exclude,
+                              "  <exclude>\n",
+                              exclude_file,
+                              exclude_list,
+                              excl_opt,
+                              "  </exclude>\n", NULL);
+    if (dp->include_file || dp->include_list)
+       include = newvstralloc(include,
+                              "  <include>\n",
+                              include_file,
+                              include_list,
+                              incl_opt,
+                              "  </include>\n", NULL);
+    script_opt = xml_scripts(dp->pp_scriptlist, their_features);
+    result = vstralloc(auth_opt,
+                      kencrypt_opt,
+                      compress_opt,
+                      encrypt_opt,
+                      record_opt,
+                      index_opt,
+                      exclude,
+                      include,
+                      script_opt,
+                      NULL);
+
+    amfree(qdpname);
+    amfree(auth_opt);
+    amfree(exclude);
+    amfree(exclude_list);
+    amfree(exclude_file);
+    amfree(include);
+    amfree(include_file);
+    amfree(include_list);
+    amfree(exc);
+    amfree(decrypt_opt);
+    amfree(encrypt_opt);
+
+    /* result contains at least 'auth=...' */
+    if ( err ) {
+       amfree(result);
+       return NULL;
+    } else {
+       return result;
+    }
+}
+
+char *
+clean_dle_str_for_client(
+    char *dle_str)
+{
+    char *rval_dle_str;
+    char *hack1, *hack2;
+
+    if (!dle_str)
+       return NULL;
+
+    rval_dle_str = stralloc(dle_str);
+
+    /* Remove everything between "  <encrypt>SERVER-CUSTOM" and "</encrypt>\n"
+     */
+#define SC "</encrypt>\n"
+#define SC_LEN strlen(SC)
+    hack1 = strstr(rval_dle_str, "  <encrypt>SERVER-CUSTOM");
+    if (hack1) {
+       hack2 = strstr(hack1, SC);
+       /* +1 is to also move the trailing '\0' */
+       memmove(hack1, hack2 + SC_LEN, strlen(hack2 + SC_LEN) + 1);
+    }
+#undef SC
+#undef SC_LEN
+
+    return rval_dle_str;
+}
+
+typedef struct {
+    am_feature_t  *features;
+    char          *result;
+} xml_app_t;
+
+/* A GHFunc (callback for g_hash_table_foreach) */
+static void xml_property(
+    gpointer key_p,
+    gpointer value_p,
+    gpointer user_data_p)
+{
+    char       *property_s = key_p;
+    char       *b64property;
+    property_t *property = value_p;
+    char       *b64value_data;
+    xml_app_t  *xml_app = user_data_p;
+    GSList     *value;
+
+    b64property = amxml_format_tag("name", property_s);
+    vstrextend(&xml_app->result, "    <property>\n",
+                               "      ", b64property, "\n", NULL);
+    // TODO if client have fe_xml_property_priority
+    if (property->priority &&
+       am_has_feature(xml_app->features, fe_xml_property_priority)) {
+       vstrextend(&xml_app->result, "      <priority>yes</priority>\n", NULL);
+    }
+    for(value = property->values; value != NULL; value = value->next) {
+       b64value_data = amxml_format_tag("value", value->data);
+       vstrextend(&xml_app->result, "      ", b64value_data, "\n", NULL);
+       amfree(b64value_data);
+    }
+    vstrextend(&xml_app->result, "    </property>\n", NULL);
+
+    amfree(b64property);
+}
+
+char *
+xml_application(
+    application_t *application,
+    am_feature_t  *their_features)
+{
+    char       *plugin;
+    char       *b64plugin;
+    xml_app_t   xml_app;
+    proplist_t  proplist;
+
+    xml_app.features = their_features;
+    xml_app.result   = NULL;
+    plugin = application_get_plugin(application);
+    b64plugin = amxml_format_tag("plugin", plugin);
+    xml_app.result = vstralloc("  <backup-program>\n",
+                       "    ", b64plugin, "\n",
+                       NULL);
+    proplist = application_get_property(application);
+    g_hash_table_foreach(proplist, xml_property, &xml_app);
+    vstrextend(&xml_app.result, "  </backup-program>\n", NULL);
+
+    amfree(b64plugin);
+
+    return xml_app.result;
+}
+
+char *
+xml_scripts(
+    pp_scriptlist_t pp_scriptlist,
+    am_feature_t  *their_features)
+{
+    char       *plugin;
+    char       *b64plugin;
+    char       *xml_scr;
+    char       *xml_scr1;
+    char       *str = "";
+    char       *sep;
+    char       *eo_str;
+    execute_on_t execute_on;
+    int          execute_where;
+    proplist_t  proplist;
+    pp_scriptlist_t pp_scriptlist1;
+    pp_script_t *pp_script;
+    xml_app_t   xml_app;
+
+    xml_app.features = their_features;
+    xml_app.result   = stralloc("");
+
+    xml_scr = stralloc("");
+    for (pp_scriptlist1=pp_scriptlist; pp_scriptlist1 != NULL;
+        pp_scriptlist1 = pp_scriptlist1->next) {
+       pp_script = pp_scriptlist1->data;
+       plugin = pp_script_get_plugin(pp_script);
+       b64plugin = amxml_format_tag("plugin", plugin);
+       xml_scr1 = vstralloc("  <script>\n",
+                             "    ", b64plugin, "\n",
+                            NULL);
+
+       execute_where = pp_script_get_execute_where(pp_script);
+       switch (execute_where) {
+           case ES_CLIENT: str = "CLIENT"; break;
+           case ES_SERVER: str = "SERVER"; break;
+       }
+       xml_scr1 = vstrextend(&xml_scr1, "    <execute_where>",
+                             str, "</execute_where>\n", NULL);
+
+       execute_on = pp_script_get_execute_on(pp_script);
+       sep = "";
+       eo_str = NULL;
+       if (execute_on & EXECUTE_ON_PRE_DLE_AMCHECK) {
+           eo_str = vstrextend(&eo_str, sep, "PRE-DLE-AMCHECK", NULL);
+           sep = ",";
+       }
+       if (execute_on & EXECUTE_ON_PRE_HOST_AMCHECK) {
+           eo_str = vstrextend(&eo_str, sep, "PRE-HOST-AMCHECK", NULL);
+           sep = ",";
+       }
+       if (execute_on & EXECUTE_ON_POST_DLE_AMCHECK) {
+           eo_str = vstrextend(&eo_str, sep, "POST-DLE-AMCHECK", NULL);
+           sep = ",";
+       }
+       if (execute_on & EXECUTE_ON_POST_HOST_AMCHECK) {
+           eo_str = vstrextend(&eo_str, sep, "POST-HOST-AMCHECK", NULL);
+           sep = ",";
+       }
+       if (execute_on & EXECUTE_ON_PRE_DLE_ESTIMATE) {
+           eo_str = vstrextend(&eo_str, sep, "PRE-DLE-ESTIMATE", NULL);
+           sep = ",";
+       }
+       if (execute_on & EXECUTE_ON_PRE_HOST_ESTIMATE) {
+           eo_str = vstrextend(&eo_str, sep, "PRE-HOST-ESTIMATE", NULL);
+           sep = ",";
+       }
+       if (execute_on & EXECUTE_ON_POST_DLE_ESTIMATE) {
+           eo_str = vstrextend(&eo_str, sep, "POST-DLE-ESTIMATE", NULL);
+           sep = ",";
+       }
+       if (execute_on & EXECUTE_ON_POST_HOST_ESTIMATE) {
+           eo_str = vstrextend(&eo_str, sep, "POST-HOST-ESTIMATE", NULL);
+           sep = ",";
+       }
+       if (execute_on & EXECUTE_ON_PRE_DLE_BACKUP) {
+           eo_str = vstrextend(&eo_str, sep, "PRE-DLE-BACKUP", NULL);
+           sep = ",";
+       }
+       if (execute_on & EXECUTE_ON_PRE_HOST_BACKUP) {
+           eo_str = vstrextend(&eo_str, sep, "PRE-HOST-BACKUP", NULL);
+           sep = ",";
+       }
+       if (execute_on & EXECUTE_ON_POST_DLE_BACKUP) {
+           eo_str = vstrextend(&eo_str, sep, "POST-DLE-BACKUP", NULL);
+           sep = ",";
+       }
+       if (execute_on & EXECUTE_ON_POST_HOST_BACKUP) {
+           eo_str = vstrextend(&eo_str, sep, "POST-HOST-BACKUP", NULL);
+           sep = ",";
+       }
+       if (execute_on & EXECUTE_ON_PRE_RECOVER) {
+           eo_str = vstrextend(&eo_str, sep, "PRE-RECOVER", NULL);
+           sep = ",";
+       }
+       if (execute_on & EXECUTE_ON_POST_RECOVER) {
+           eo_str = vstrextend(&eo_str, sep, "POST-RECOVER", NULL);
+           sep = ",";
+       }
+       if (execute_on & EXECUTE_ON_PRE_LEVEL_RECOVER) {
+           eo_str = vstrextend(&eo_str, sep, "PRE-LEVEL-RECOVER", NULL);
+           sep = ",";
+       }
+       if (execute_on & EXECUTE_ON_POST_LEVEL_RECOVER) {
+           eo_str = vstrextend(&eo_str, sep, "POST-LEVEL-RECOVER", NULL);
+           sep = ",";
+       }
+       if (execute_on & EXECUTE_ON_INTER_LEVEL_RECOVER) {
+           eo_str = vstrextend(&eo_str, sep, "INTER-LEVEL-RECOVER", NULL);
+           sep = ",";
+       }
+       if (execute_on != 0)
+           xml_scr1 = vstrextend(&xml_scr1,
+                                 "    <execute_on>", eo_str,
+                                 "</execute_on>\n", NULL);
+       amfree(eo_str);
+       proplist = pp_script_get_property(pp_script);
+       g_hash_table_foreach(proplist, xml_property, &xml_app);
+       xml_scr = vstrextend(&xml_scr, xml_scr1, xml_app.result, "  </script>\n", NULL);
+       amfree(b64plugin);
+       amfree(xml_app.result);
+    }
+    return xml_scr;
+}
+
 char *
 match_disklist(
     disklist_t *origqp,
@@ -1389,25 +2064,26 @@ main(
   signal(SIGPIPE, SIG_IGN);
 
   if (argc>1) {
-    config_name = argv[1];
-    if (strchr(config_name, '/') != NULL) {
-      config_dir = stralloc2(argv[1], "/");
-      config_name = strrchr(config_name, '/') + 1;
-    } else {
-      config_dir = vstralloc(CONFIG_DIR, "/", config_name, "/", NULL);
-    }
+    config_init(CONFIG_INIT_EXPLICIT_NAME, argv[1]);
   } else {
-    config_dir = stralloc("");
+    config_init(CONFIG_INIT_USE_CWD, NULL)
   }
-  conffile = stralloc2(config_dir, CONFFILE_NAME);
-  if((result = read_conffile(conffile)) == 0) {
-    conf_diskfile = config_dir_relative(getconf_str(CNF_DISKFILE));
-    result = read_diskfile(conf_diskfile, &lst);
-    if(result == 0) {
-      dump_disklist(&lst);
-    }
-    amfree(conf_diskfile);
+
+  if (config_errors(NULL) >= CFGERR_WARNINGS) {
+    config_print_errors();
+    if (config_errors(NULL) >= CFGERR_ERRORS) {
+      g_critical(_("errors processing config file"));
+    }
+  }
+
+  conf_diskfile = config_dir_relative(getconf_str(CNF_DISKFILE));
+  result = read_diskfile(conf_diskfile, &lst);
+  if(result == CFGERR_OK) {
+    dump_disklist(&lst);
+  } else {
+    config_print_errors();
   }
+  amfree(conf_diskfile);
   amfree(conffile);
   amfree(config_dir);
 
index a7f13b60c233cf70d4eb3436d720154a17ee3707..ea6274f80d2c70b3e8b083f7e40eb667e2618092 100644 (file)
@@ -52,6 +52,8 @@ typedef struct amhost_s {
     time_t start_t;                    /* start dump after this time */
     char *up;                          /* generic user pointer */
     am_feature_t *features;            /* feature set */
+    int         pre_script;
+    int  post_script;
 } am_host_t;
 
 typedef struct disk_s {
@@ -112,6 +114,8 @@ typedef struct disk_s {
     int                spindle;                /* spindle # - for parallel dumps */
     int                inprogress;             /* being dumped now? */
     int                todo;
+    application_t *application;
+    pp_scriptlist_t pp_scriptlist;
     void       *up;                    /* generic user pointer */
 } disk_t;
 
@@ -121,8 +125,9 @@ typedef struct disklist_s {
 
 #define empty(dlist)   ((dlist).head == NULL)
 
-
-int read_diskfile(const char *, disklist_t *);
+/* This function is integrated with the conffile.c error-handling; handle its return
+ * value just as you would the return of config_init() */
+cfgerr_level_t read_diskfile(const char *, disklist_t *);
 
 am_host_t *lookup_host(const char *hostname);
 disk_t *lookup_disk(const char *hostname, const char *diskname);
@@ -141,6 +146,18 @@ void dump_queue(char *str, disklist_t q, int npr, FILE *f);
 
 char *optionstr(disk_t *dp, am_feature_t *their_features, FILE *fdout);
 
+/* xml_optionstr()
+ * to_server must be set to 1 if the result is sent to another server
+ *           application, eg. driver to dumper.
+ *           It must be set to 0 if the result is sent to the client.
+ */
+char *xml_optionstr(disk_t *dp, am_feature_t *their_features, FILE *fdout,
+                   int to_server);
+char *clean_dle_str_for_client(char *dle_str);
+char *xml_application(application_t *application,
+                     am_feature_t *their_features);
+char *xml_scripts(pp_scriptlist_t pp_scriptlist, am_feature_t *their_features);
+
 char *match_disklist(disklist_t *origqp, int sargc, char **sargv);
 void free_disklist(disklist_t *dl);
 
index e9504edceb4597029173eafb477fcf734914603a..d7a6fea7a83d9e10bfca84e25697e55ad18daa22 100644 (file)
@@ -144,7 +144,7 @@ typedef enum {
     TAPE_ACTION_START_A_FLUSH = (1 << 2)
 } TapeAction;
 
-static TapeAction tape_action(void);
+static TapeAction tape_action(char **why_no_new_tape);
 
 static const char *idle_strings[] = {
 #define NOT_IDLE               0
@@ -179,7 +179,7 @@ main(
     char *conf_diskfile;
     cmd_t cmd;
     int result_argc;
-    char *result_argv[MAX_ARGS+1];
+    char **result_argv = NULL;
     char *taper_program;
     char *conf_tapetype;
     tapetype_t *tape;
@@ -222,10 +222,21 @@ main(
 
     if (argc > 1)
        cfg_opt = argv[1];
-    config_init(CONFIG_INIT_EXPLICIT_NAME | CONFIG_INIT_USE_CWD | CONFIG_INIT_FATAL,
-               cfg_opt);
+    config_init(CONFIG_INIT_EXPLICIT_NAME | CONFIG_INIT_USE_CWD, cfg_opt);
     apply_config_overwrites(cfg_ovr);
 
+    conf_diskfile = config_dir_relative(getconf_str(CNF_DISKFILE));
+    read_diskfile(conf_diskfile, &origq);
+    amfree(conf_diskfile);
+
+    if (config_errors(NULL) >= CFGERR_WARNINGS) {
+       config_print_errors();
+       if (config_errors(NULL) >= CFGERR_ERRORS) {
+           g_critical(_("errors processing config file"));
+       }
+    }
+
+    log_add(L_INFO, "%s pid %ld", get_pname(), (long)getpid());
     g_printf(_("%s: pid %ld executable %s version %s\n"),
           get_pname(), (long) getpid(), argv[0], version());
 
@@ -239,7 +250,7 @@ main(
 
     check_running_as(RUNNING_AS_DUMPUSER);
 
-    dbrename(config_name, DBG_SUBDIR_SERVER);
+    dbrename(get_config_name(), DBG_SUBDIR_SERVER);
 
     amfree(driver_timestamp);
     /* read timestamp from stdin */
@@ -292,6 +303,7 @@ main(
     conf_runtapes = getconf_int(CNF_RUNTAPES);
     tape = lookup_tapetype(conf_tapetype);
     tape_length = tapetype_get_length(tape);
+    g_printf("driver: tape size %lld\n", (long long)tape_length);
     conf_flush_threshold_dumped = getconf_int(CNF_FLUSH_THRESHOLD_DUMPED);
     conf_flush_threshold_scheduled = getconf_int(CNF_FLUSH_THRESHOLD_SCHEDULED);
     conf_taperflush = getconf_int(CNF_TAPERFLUSH);
@@ -304,15 +316,6 @@ main(
     driver_debug(1, _("flush_threshold_scheduled: %lld\n"), (long long)flush_threshold_scheduled);
     driver_debug(1, _("taperflush: %lld\n"), (long long)taperflush);
 
-    /* start initializing: read in databases */
-
-    conf_diskfile = config_dir_relative(getconf_str(CNF_DISKFILE));
-    if (read_diskfile(conf_diskfile, &origq) < 0) {
-       error(_("could not load disklist \"%s\""), conf_diskfile);
-       /*NOTREACHED*/
-    }
-    amfree(conf_diskfile);
-
     /* set up any configuration-dependent variables */
 
     inparallel = getconf_int(CNF_INPARALLEL);
@@ -441,7 +444,7 @@ main(
     /* ok, planner is done, now lets see if the tape is ready */
 
     if (conf_runtapes > 0) {
-       cmd = getresult(taper, 1, &result_argc, result_argv, MAX_ARGS+1);
+       cmd = getresult(taper, 1, &result_argc, &result_argv);
        if (cmd != TAPER_OK) {
            /* no tape, go into degraded mode: dump to holding disk */
            need_degraded = 1;
@@ -452,8 +455,8 @@ main(
 
     tape_left = tape_length;
     taper_busy = 0;
-    taper_input_error = NULL;
-    taper_tape_error = NULL;
+    amfree(taper_input_error);
+    amfree(taper_tape_error);
     taper_disk = NULL;
     taper_ev_read = NULL;
 
@@ -478,10 +481,33 @@ main(
 
     /* handle any remaining dumps by dumping directly to tape, if possible */
     while(!empty(directq) && taper > 0) {
-       diskp = dequeue_disk(&directq);
+       time_t  sleep_time  = 100000000;
+       disk_t *sleep_diskp = NULL;
+       time_t  now         = time(0);
+
+       /* Find one we can do immediately or the sonner */
+       for (diskp = directq.head; diskp != NULL; diskp = diskp->next) {
+           if (diskp->to_holdingdisk == HOLD_REQUIRED ||
+               degraded_mode) {
+               sleep_time = 0;
+               sleep_diskp = diskp;
+           } else if (diskp->host->start_t - now < sleep_time &&
+                      diskp->start_t -now < sleep_time) {
+               if (diskp->host->start_t > diskp->start_t)
+                   sleep_time = diskp->host->start_t - now;
+               else
+                   sleep_time = diskp->start_t - now;
+               sleep_diskp = diskp;
+           }
+       }
+       diskp = sleep_diskp;
+       if (sleep_time > 0)
+           sleep(sleep_time);
+       remove_disk(&directq, diskp);
+
        if (diskp->to_holdingdisk == HOLD_REQUIRED) {
            char *qname = quote_string(diskp->name);
-           log_add(L_FAIL, _("%s %s %s %d [%s]"),
+           log_add(L_FAIL, "%s %s %s %d [%s]",
                diskp->host->hostname, qname, sched(diskp)->datestamp,
                sched(diskp)->level,
                _("can't dump required holdingdisk"));
@@ -491,16 +517,18 @@ main(
            taper_state |= TAPER_STATE_DUMP_TO_TAPE;
            dump_to_tape(diskp);
            event_loop(0);
-           taper_state &= !TAPER_STATE_DUMP_TO_TAPE;
+           taper_state &= ~TAPER_STATE_DUMP_TO_TAPE;
        }
        else {
            char *qname = quote_string(diskp->name);
-           log_add(L_FAIL, _("%s %s %s %d [%s]"),
+           log_add(L_FAIL, "%s %s %s %d [%s]",
                diskp->host->hostname, qname, sched(diskp)->datestamp,
                sched(diskp)->level,
-               diskp->to_holdingdisk == HOLD_AUTO ?
-                   _("no more holding disk space") :
-                   _("can't dump no-hold disk in degraded mode"));
+               num_holdalloc == 0 ?
+                   _("can't do degraded dump without holding disk") :
+               diskp->to_holdingdisk != HOLD_NEVER ?
+                   _("out of holding space in degraded mode") :
+                   _("can't dump 'holdingdisk never' dle in degraded mode"));
            amfree(qname);
        }
     }
@@ -518,7 +546,7 @@ main(
     if(!nodump) {
        for(dumper = dmptable; dumper < dmptable + inparallel; dumper++) {
            if(dumper->fd >= 0)
-               dumper_cmd(dumper, QUIT, NULL);
+               dumper_cmd(dumper, QUIT, NULL, NULL);
        }
     }
 
@@ -538,10 +566,13 @@ main(
     g_printf(_("driver: FINISHED time %s\n"), walltime_str(curclock()));
     fflush(stdout);
     log_add(L_FINISH,_("date %s time %s"), driver_timestamp, walltime_str(curclock()));
+    log_add(L_INFO, "pid-done %ld", (long)getpid());
     amfree(driver_timestamp);
 
     amfree(dumper_program);
     amfree(taper_program);
+    if (result_argv)
+       g_strfreev(result_argv);
 
     dbclose();
 
@@ -641,11 +672,12 @@ kill_children(int signal)
         }
     }
 
-    if(taper_pid > 1)
+    if(taper_pid > 1) {
        g_printf(_("driver: sending signal %d to %s pid %u\n"), signal,
               "taper", (unsigned)taper_pid);
        if (kill(taper_pid, signal) == -1 && errno == ESRCH)
            taper_pid = 0;
+    }
 }
 
 static void
@@ -656,10 +688,10 @@ wait_for_children(void)
     if(!nodump) {
        for(dumper = dmptable; dumper < dmptable + inparallel; dumper++) {
            if (dumper->pid > 1 && dumper->fd >= 0) {
-               dumper_cmd(dumper, QUIT, NULL);
+               dumper_cmd(dumper, QUIT, NULL, NULL);
                if (dumper->chunker && dumper->chunker->pid > 1 &&
                    dumper->chunker->fd >= 0)
-                   chunker_cmd(dumper->chunker, QUIT, NULL);
+                   chunker_cmd(dumper->chunker, QUIT, NULL, NULL);
            }
        }
     }
@@ -690,15 +722,17 @@ startaflush(void)
     int extra_tapes = 0;
     char *qname;
     TapeAction result_tape_action;
+    char *why_no_new_tape;
 
-    result_tape_action = tape_action();
+    result_tape_action = tape_action(&why_no_new_tape);
 
     if (result_tape_action & TAPE_ACTION_NEW_TAPE) {
-       taper_state &= !TAPER_STATE_WAIT_FOR_TAPE;
+       taper_state &= ~TAPER_STATE_WAIT_FOR_TAPE;
        taper_cmd(NEW_TAPE, NULL, NULL, 0, NULL);
     } else if (result_tape_action & TAPE_ACTION_NO_NEW_TAPE) {
-       taper_state &= !TAPER_STATE_WAIT_FOR_TAPE;
-       taper_cmd(NO_NEW_TAPE, NULL, NULL, 0, NULL);
+       taper_state &= ~TAPER_STATE_WAIT_FOR_TAPE;
+       taper_cmd(NO_NEW_TAPE, why_no_new_tape, NULL, 0, NULL);
+       start_degraded_mode(&runq);
     }
 
     if (!degraded_mode && !taper_busy && !empty(tapeq) &&
@@ -781,13 +815,13 @@ startaflush(void)
        if (dp) {
            taper_disk = dp;
            taper_busy = 1;
-           taper_input_error = NULL;
-           taper_tape_error = NULL;
+           amfree(taper_input_error);
+           amfree(taper_tape_error);
            taper_result = LAST_TOK;
            taper_sendresult = 0;
            taper_first_label = NULL;
            taper_written = 0;
-           taper_state &= !TAPER_STATE_DUMP_TO_TAPE;
+           taper_state &= ~TAPER_STATE_DUMP_TO_TAPE;
            taper_dumper = NULL;
            qname = quote_string(dp->name);
            taper_cmd(FILE_WRITE, dp, sched(dp)->destname, sched(dp)->level,
@@ -805,6 +839,7 @@ startaflush(void)
            error(_("FATAL: Taper marked busy and no work found."));
            /*NOTREACHED*/
        }
+       short_dump_state();
     } else if(!taper_busy && taper_ev_read != NULL) {
        event_release(taper_ev_read);
        taper_ev_read = NULL;
@@ -843,11 +878,12 @@ start_some_dumps(
 {
     int cur_idle;
     disk_t *diskp, *delayed_diskp, *diskp_accept;
+    disk_t *dp;
     assignedhd_t **holdp=NULL, **holdp_accept;
     const time_t now = time(NULL);
     cmd_t cmd;
     int result_argc;
-    char *result_argv[MAX_ARGS+1];
+    char **result_argv;
     chunker_t *chunker;
     dumper_t *dumper;
     char dumptype;
@@ -1027,10 +1063,10 @@ start_some_dumps(
            chunker->result = LAST_TOK;
            dumper->result = LAST_TOK;
            startup_chunk_process(chunker,chunker_program);
-           chunker_cmd(chunker, START, (void *)driver_timestamp);
+           chunker_cmd(chunker, START, NULL, driver_timestamp);
            chunker->dumper = dumper;
-           chunker_cmd(chunker, PORT_WRITE, diskp);
-           cmd = getresult(chunker->fd, 1, &result_argc, result_argv, MAX_ARGS+1);
+           chunker_cmd(chunker, PORT_WRITE, diskp, NULL);
+           cmd = getresult(chunker->fd, 1, &result_argc, &result_argv);
            if(cmd != PORT) {
                assignedhd_t **h=NULL;
                int activehd;
@@ -1063,11 +1099,25 @@ start_some_dumps(
                                                 handle_dumper_result, dumper);
                chunker->ev_read = event_register((event_id_t)chunker->fd, EV_READFD,
                                                   handle_chunker_result, chunker);
-               dumper->output_port = atoi(result_argv[2]);
+               dumper->output_port = atoi(result_argv[1]);
 
-               dumper_cmd(dumper, PORT_DUMP, diskp);
+               if (diskp->host->pre_script == 0) {
+                   for (dp=diskp->host->disks; dp != NULL; dp = dp->hostnext) {
+                       run_server_scripts(EXECUTE_ON_PRE_HOST_BACKUP,
+                                          get_config_name(), dp, -1);
+                   }
+                   diskp->host->pre_script = 1;
+               }
+               run_server_scripts(EXECUTE_ON_PRE_DLE_BACKUP,
+                                  get_config_name(), diskp,
+                                  sched(diskp)->level);
+               dumper_cmd(dumper, PORT_DUMP, diskp, NULL);
            }
            diskp->host->start_t = now + 15;
+
+           if (result_argv)
+               g_strfreev(result_argv);
+           short_dump_state();
        }
     }
 }
@@ -1146,9 +1196,9 @@ start_degraded_mode(
                enqueue_disk(&newq, dp);
            }
            else {
-               log_add(L_FAIL,_("%s %s %s %d [can't switch to incremental dump]"),
+               log_add(L_FAIL, "%s %s %s %d [%s]",
                        dp->host->hostname, qname, sched(dp)->datestamp,
-                       sched(dp)->level);
+                       sched(dp)->level, sched(dp)->degr_mesg);
            }
        }
         amfree(qname);
@@ -1186,7 +1236,7 @@ continue_port_dumps(void)
            }
            assert( dumper < dmptable + inparallel );
            sched(dp)->activehd = assign_holdingdisk( h, dp );
-           chunker_cmd( dumper->chunker, CONTINUE, dp );
+           chunker_cmd( dumper->chunker, CONTINUE, dp, NULL );
            amfree(h);
            remove_disk( &roomq, dp );
        }
@@ -1229,8 +1279,8 @@ continue_port_dumps(void)
         * We abort that dump, hopefully not wasting too much time retrying it.
         */
        remove_disk( &roomq, dp );
-       chunker_cmd( sched(dp)->dumper->chunker, ABORT, NULL);
-       dumper_cmd( sched(dp)->dumper, ABORT, NULL );
+       chunker_cmd(sched(dp)->dumper->chunker, ABORT, NULL, _("Not enough holding disk space"));
+       dumper_cmd( sched(dp)->dumper, ABORT, NULL, _("Not enough holding disk space"));
        pending_aborts++;
     }
 }
@@ -1238,23 +1288,24 @@ continue_port_dumps(void)
 
 static void
 handle_taper_result(
-    void *cookie)
+       void *cookie G_GNUC_UNUSED)
 {
     disk_t *dp;
     cmd_t cmd;
     int result_argc;
-    char *result_argv[MAX_ARGS+1];
-    char *qname;
-
-    (void)cookie;      /* Quiet unused parameter warning */
+    char **result_argv;
+    char *qname, *q;
+    char *s;
 
     assert(cookie == NULL);
+    amfree(taper_input_error);
+    amfree(taper_tape_error);
     
     do {
         
        short_dump_state();
         
-       cmd = getresult(taper, 1, &result_argc, result_argv, MAX_ARGS+1);
+       cmd = getresult(taper, 1, &result_argc, &result_argv);
         
        switch(cmd) {
             
@@ -1264,24 +1315,42 @@ handle_taper_result(
                /*NOTREACHED*/
            }
             
-           dp = serial2disk(result_argv[2]);
+           dp = serial2disk(result_argv[1]);
            assert(dp == taper_disk);
            if (!taper_dumper)
-               free_serial(result_argv[2]);
+               free_serial(result_argv[1]);
             
            qname = quote_string(dp->name);
            g_printf(_("driver: finished-cmd time %s taper wrote %s:%s\n"),
                   walltime_str(curclock()), dp->host->hostname, qname);
            fflush(stdout);
-            amfree(qname);
 
-           if (strcmp(result_argv[3], "INPUT-ERROR") == 0) {
-               taper_input_error = stralloc(result_argv[5]);
+           if (strcmp(result_argv[2], "INPUT-ERROR") == 0) {
+               taper_input_error = newstralloc(taper_input_error, result_argv[4]);
+           } else if (strcmp(result_argv[2], "INPUT-GOOD") != 0) {
+               taper_tape_error = newstralloc(taper_tape_error,
+                                              _("Taper protocol error"));
+               taper_result = FAILED;
+               log_add(L_FAIL, _("%s %s %s %d [%s]"),
+                       dp->host->hostname, qname, sched(dp)->datestamp,
+                       sched(dp)->level, taper_tape_error);
+               amfree(qname);
+               break;
            }
-           if (strcmp(result_argv[4], "TAPE-ERROR") == 0) {
-               taper_tape_error = stralloc(result_argv[6]);
+           if (strcmp(result_argv[3], "TAPE-ERROR") == 0) {
+               taper_tape_error = newstralloc(taper_tape_error, result_argv[5]);
+           } else if (strcmp(result_argv[3], "TAPE-GOOD") != 0) {
+               taper_tape_error = newstralloc(taper_tape_error,
+                                              _("Taper protocol error"));
+               taper_result = FAILED;
+               log_add(L_FAIL, _("%s %s %s %d [%s]"),
+                       dp->host->hostname, qname, sched(dp)->datestamp,
+                       sched(dp)->level, taper_tape_error);
+               amfree(qname);
+               break;
            }
 
+           amfree(qname);
            taper_result = cmd;
 
            break;
@@ -1293,70 +1362,96 @@ handle_taper_result(
                /*NOTREACHED*/
            }
             
-           dp = serial2disk(result_argv[2]);
+           dp = serial2disk(result_argv[1]);
            assert(dp == taper_disk);
             if (!taper_dumper)
-                free_serial(result_argv[2]);
+                free_serial(result_argv[1]);
 
            qname = quote_string(dp->name);
            g_printf(_("driver: finished-cmd time %s taper wrote %s:%s\n"),
                   walltime_str(curclock()), dp->host->hostname, qname);
-           amfree(qname);
            fflush(stdout);
 
-           if (strcmp(result_argv[3], "INPUT-ERROR") == 0) {
-               taper_input_error = stralloc(result_argv[5]);
+           if (strcmp(result_argv[2], "INPUT-ERROR") == 0) {
+               taper_input_error = newstralloc(taper_input_error, result_argv[5]);
+           } else if (strcmp(result_argv[2], "INPUT-GOOD") != 0) {
+               taper_tape_error = newstralloc(taper_tape_error,
+                                              _("Taper protocol error"));
+               taper_result = FAILED;
+               log_add(L_FAIL, _("%s %s %s %d [%s]"),
+                       dp->host->hostname, qname, sched(dp)->datestamp,
+                       sched(dp)->level, taper_tape_error);
+               amfree(qname);
+               break;
+           }
+           if (strcmp(result_argv[3], "TAPE-ERROR") == 0) {
+               taper_tape_error = newstralloc(taper_tape_error, result_argv[6]);
+           } else if (strcmp(result_argv[3], "TAPE-GOOD") != 0) {
+               taper_tape_error = newstralloc(taper_tape_error,
+                                              _("Taper protocol error"));
+               taper_result = FAILED;
+               log_add(L_FAIL, _("%s %s %s %d [%s]"),
+                       dp->host->hostname, qname, sched(dp)->datestamp,
+                       sched(dp)->level, taper_tape_error);
+               amfree(qname);
+               break;
            }
-           if (strcmp(result_argv[4], "TAPE-ERROR") == 0) {
-               taper_tape_error = stralloc(result_argv[6]);
+
+           s = strstr(result_argv[4], " kb ");
+           if (s) {
+               s += 4;
+               sched(dp)->dumpsize = atol(s);
            }
 
            taper_result = cmd;
+           amfree(qname);
 
            break;
             
-        case PARTDONE:  /* PARTDONE <handle> <label> <fileno> <stat> */
-           dp = serial2disk(result_argv[2]);
+        case PARTDONE:  /* PARTDONE <handle> <label> <fileno> <kbytes> <stat> */
+           dp = serial2disk(result_argv[1]);
            assert(dp == taper_disk);
             if (result_argc != 6) {
-                error(_("error [taper PARTDONE result_argc != 5: %d]"),
+                error(_("error [taper PARTDONE result_argc != 6: %d]"),
                       result_argc);
                /*NOTREACHED*/
             }
            if (!taper_first_label) {
-               taper_first_label = stralloc(result_argv[3]);
-               taper_first_fileno = OFF_T_ATOI(result_argv[4]);
+               taper_first_label = stralloc(result_argv[2]);
+               taper_first_fileno = OFF_T_ATOI(result_argv[3]);
            }
-           taper_written = OFF_T_ATOI(result_argv[5]);
+           taper_written = OFF_T_ATOI(result_argv[4]);
            if (taper_written > sched(taper_disk)->act_size)
                sched(taper_disk)->act_size = taper_written;
             
             break;
 
-        case REQUEST_NEW_TAPE:  /* REQUEST-NEW-TAPE */
+        case REQUEST_NEW_TAPE:  /* REQUEST-NEW-TAPE <handle> */
             if (result_argc != 2) {
                 error(_("error [taper REQUEST_NEW_TAPE result_argc != 2: %d]"),
                       result_argc);
                /*NOTREACHED*/
             }
-           taper_state &= !TAPER_STATE_TAPE_STARTED;
+           taper_state &= ~TAPER_STATE_TAPE_STARTED;
 
            if (current_tape >= conf_runtapes) {
-               taper_cmd(NO_NEW_TAPE, NULL, NULL, 0, NULL);
+               taper_cmd(NO_NEW_TAPE, "runtapes volumes already written", NULL, 0, NULL);
                log_add(L_WARNING,
                        _("Out of tapes; going into degraded mode."));
                start_degraded_mode(&runq);
            } else {
                TapeAction result_tape_action;
+               char *why_no_new_tape;
 
                taper_state |= TAPER_STATE_WAIT_FOR_TAPE;
-               result_tape_action = tape_action();
+               result_tape_action = tape_action(&why_no_new_tape);
                if (result_tape_action & TAPE_ACTION_NEW_TAPE) {
                    taper_cmd(NEW_TAPE, NULL, NULL, 0, NULL);
-                   taper_state &= !TAPER_STATE_WAIT_FOR_TAPE;
+                   taper_state &= ~TAPER_STATE_WAIT_FOR_TAPE;
                } else if (result_tape_action & TAPE_ACTION_NO_NEW_TAPE) {
-                   taper_cmd(NO_NEW_TAPE, NULL, NULL, 0, NULL);
-                   taper_state &= !TAPER_STATE_WAIT_FOR_TAPE;
+                   taper_cmd(NO_NEW_TAPE, why_no_new_tape, NULL, 0, NULL);
+                   taper_state &= ~TAPER_STATE_WAIT_FOR_TAPE;
+                   start_degraded_mode(&runq);
                }
            }
            break;
@@ -1380,6 +1475,7 @@ handle_taper_result(
                       result_argc);
                /*NOTREACHED*/
             }
+           start_degraded_mode(&runq);
            break;
 
        case DUMPER_STATUS:  /* DUMPER-STATUS <handle> */
@@ -1400,22 +1496,24 @@ handle_taper_result(
            break;
 
         case TAPE_ERROR: /* TAPE-ERROR <handle> <err mess> */
-            dp = serial2disk(result_argv[2]);
+            dp = serial2disk(result_argv[1]);
            if (!taper_dumper)
-               free_serial(result_argv[2]);
+               free_serial(result_argv[1]);
            qname = quote_string(dp->name);
             g_printf(_("driver: finished-cmd time %s taper wrote %s:%s\n"),
                    walltime_str(curclock()), dp->host->hostname, qname);
            amfree(qname);
             fflush(stdout);
-            log_add(L_WARNING, _("Taper  error: %s"), result_argv[3]);
-           taper_tape_error = stralloc(result_argv[3]);
+           q = quote_string(result_argv[2]);
+            log_add(L_WARNING, _("Taper error: %s"), q);
+           amfree(q);
+           taper_tape_error = newstralloc(taper_tape_error, result_argv[2]);
             /*FALLTHROUGH*/
 
         case BOGUS:
             if (cmd == BOGUS) {
                log_add(L_WARNING, _("Taper protocol error"));
-               taper_tape_error = stralloc("BOGUS");
+               taper_tape_error = newstralloc(taper_tape_error, "BOGUS");
             }
             /*
              * Since we received a taper error, we can't send anything more
@@ -1447,6 +1545,8 @@ handle_taper_result(
            /*NOTREACHED*/
        }
 
+       g_strfreev(result_argv);
+
        if (taper_result != LAST_TOK) {
            if(taper_dumper) {
                if (taper_dumper->result != LAST_TOK) {
@@ -1488,6 +1588,7 @@ file_taper_result(
                amfree(sched(dp)->destname);
                amfree(sched(dp)->dumpdate);
                amfree(sched(dp)->degr_dumpdate);
+               amfree(sched(dp)->degr_mesg);
                amfree(sched(dp)->datestamp);
                amfree(dp->up);
            } else {
@@ -1504,6 +1605,7 @@ file_taper_result(
                    amfree(sched(dp)->destname);
                    amfree(sched(dp)->dumpdate);
                    amfree(sched(dp)->degr_dumpdate);
+                   amfree(sched(dp)->degr_mesg);
                    amfree(sched(dp)->datestamp);
                    amfree(dp->up);
                }
@@ -1512,10 +1614,13 @@ file_taper_result(
            amfree(sched(dp)->destname);
            amfree(sched(dp)->dumpdate);
            amfree(sched(dp)->degr_dumpdate);
+           amfree(sched(dp)->degr_mesg);
            amfree(sched(dp)->datestamp);
            amfree(dp->up);
        }
     } else if (taper_tape_error) {
+       g_printf("driver: taper failed %s %s with tape error: %s\n",
+                  dp->host->hostname, qname, taper_tape_error);
        if(sched(dp)->taper_attempted >= 2) {
            log_add(L_FAIL, _("%s %s %s %d [too many taper retries]"),
                    dp->host->hostname, qname, sched(dp)->datestamp,
@@ -1525,6 +1630,7 @@ file_taper_result(
            amfree(sched(dp)->destname);
            amfree(sched(dp)->dumpdate);
            amfree(sched(dp)->degr_dumpdate);
+           amfree(sched(dp)->degr_mesg);
            amfree(sched(dp)->datestamp);
            amfree(dp->up);
        } else {
@@ -1533,11 +1639,15 @@ file_taper_result(
            /* Re-insert into taper queue. */
            headqueue_disk(&tapeq, dp);
        }
+    } else if (taper_result != DONE) {
+       g_printf("driver: taper failed %s %s without error\n",
+                  dp->host->hostname, qname);
     } else {
        delete_diskspace(dp);
        amfree(sched(dp)->destname);
        amfree(sched(dp)->dumpdate);
        amfree(sched(dp)->degr_dumpdate);
+       amfree(sched(dp)->degr_mesg);
        amfree(sched(dp)->datestamp);
        amfree(dp->up);
     }
@@ -1545,8 +1655,8 @@ file_taper_result(
     amfree(qname);
 
     taper_busy = 0;
-    taper_input_error = NULL;
-    taper_tape_error = NULL;
+    amfree(taper_input_error);
+    amfree(taper_tape_error);
     taper_disk = NULL;
             
     /* continue with those dumps waiting for diskspace */
@@ -1604,8 +1714,8 @@ dumper_taper_result(
        taper_ev_read = NULL;
     }
     taper_busy = 0;
-    taper_input_error = NULL;
-    taper_tape_error = NULL;
+    amfree(taper_input_error);
+    amfree(taper_tape_error);
     dumper->busy = 0;
     dp->host->inprogress -= 1;
     dp->inprogress = 0;
@@ -1716,15 +1826,15 @@ dumper_chunker_result(
 
 static void
 handle_dumper_result(
-    void *     cookie)
+       void * cookie)
 {
-    /*static int pending_aborts = 0;*/
+    /* uses global pending_aborts */
     dumper_t *dumper = cookie;
-    disk_t *dp, *sdp;
+    disk_t *dp, *sdp, *dp1;
     cmd_t cmd;
     int result_argc;
     char *qname;
-    char *result_argv[MAX_ARGS+1];
+    char **result_argv;
 
     assert(dumper != NULL);
     dp = dumper->dp;
@@ -1734,13 +1844,13 @@ handle_dumper_result(
 
        short_dump_state();
 
-       cmd = getresult(dumper->fd, 1, &result_argc, result_argv, MAX_ARGS+1);
+       cmd = getresult(dumper->fd, 1, &result_argc, &result_argv);
 
        if(cmd != BOGUS) {
-           /* result_argv[2] always contains the serial number */
-           sdp = serial2disk(result_argv[2]);
+           /* result_argv[1] always contains the serial number */
+           sdp = serial2disk(result_argv[1]);
            if (sdp != dp) {
-               error(_("Invalid serial number %s"), result_argv[2]);
+               error(_("Invalid serial number %s"), result_argv[1]);
                 g_assert_not_reached();
            }
        }
@@ -1754,8 +1864,8 @@ handle_dumper_result(
                /*NOTREACHED*/
            }
 
-           sched(dp)->origsize = OFF_T_ATOI(result_argv[3]);
-           sched(dp)->dumptime = TIME_T_ATOI(result_argv[5]);
+           sched(dp)->origsize = OFF_T_ATOI(result_argv[2]);
+           sched(dp)->dumptime = TIME_T_ATOI(result_argv[4]);
 
            g_printf(_("driver: finished-cmd time %s %s dumped %s:%s\n"),
                   walltime_str(curclock()), dumper->name,
@@ -1773,17 +1883,18 @@ handle_dumper_result(
             */
            if(sched(dp)->dump_attempted) {
                char *qname = quote_string(dp->name);
+               char *qerr = quote_string(result_argv[2]);
                log_add(L_FAIL, _("%s %s %s %d [too many dumper retry: %s]"),
                    dp->host->hostname, qname, sched(dp)->datestamp,
-                   sched(dp)->level, result_argv[3]);
+                   sched(dp)->level, qerr);
                g_printf(_("driver: dump failed %s %s %s, too many dumper retry: %s\n"),
-                       result_argv[2], dp->host->hostname, qname,
-                       result_argv[3]);
+                       result_argv[1], dp->host->hostname, qname, qerr);
                amfree(qname);
+               amfree(qerr);
            }
            /* FALLTHROUGH */
        case FAILED: /* FAILED <handle> <errstr> */
-           /*free_serial(result_argv[2]);*/
+           /*free_serial(result_argv[1]);*/
            dumper->result = cmd;
            break;
 
@@ -1795,7 +1906,7 @@ handle_dumper_result(
             * other dumps that are waiting on disk space.
             */
            assert(pending_aborts);
-           /*free_serial(result_argv[2]);*/
+           /*free_serial(result_argv[1]);*/
            dumper->result = cmd;
            break;
 
@@ -1810,19 +1921,17 @@ handle_dumper_result(
            aclose(dumper->fd);
            dumper->busy = 0;
            dumper->down = 1;   /* mark it down so it isn't used again */
-           if(dp) {
-               /* if it was dumping something, zap it and try again */
-               if(sched(dp)->dump_attempted) {
+
+            /* if it was dumping something, zap it and try again */
+            if(sched(dp)->dump_attempted) {
                log_add(L_FAIL, _("%s %s %s %d [%s died]"),
                        dp->host->hostname, qname, sched(dp)->datestamp,
                        sched(dp)->level, dumper->name);
-               }
-               else {
+            } else {
                log_add(L_WARNING, _("%s died while dumping %s:%s lev %d."),
                        dumper->name, dp->host->hostname, qname,
                        sched(dp)->level);
-               }
-           }
+            }
            dumper->result = cmd;
            break;
 
@@ -1830,16 +1939,35 @@ handle_dumper_result(
            assert(0);
        }
         amfree(qname);
+       g_strfreev(result_argv);
+
+       if (cmd != BOGUS) {
+           int last_dump = 1;
+           run_server_scripts(EXECUTE_ON_POST_DLE_BACKUP,
+                              get_config_name(), dp, sched(dp)->level);
+           for (dp1=runq.head; dp1 != NULL; dp1 = dp1->next) {
+               if (dp1 != dp) last_dump = 0;
+           }
+           if (last_dump && dp->host->post_script == 0) {
+               if (dp->host->post_script == 0) {
+                   for (dp1=dp->host->disks; dp1 != NULL; dp1 = dp1->hostnext) {
+                       run_server_scripts(EXECUTE_ON_POST_HOST_BACKUP,
+                                          get_config_name(), dp1, -1);
+                   }
+                   dp->host->post_script = 1;
+               }
+           }
+       }
 
        /* send the dumper result to the chunker */
        if (dumper->chunker) {
            if (dumper->chunker->down == 0 && dumper->chunker->fd != -1 &&
                dumper->chunker->result == LAST_TOK) {
                if (cmd == DONE) {
-                   chunker_cmd(dumper->chunker, DONE, dp);
+                   chunker_cmd(dumper->chunker, DONE, dp, NULL);
                }
                else {
-                   chunker_cmd(dumper->chunker, FAILED, dp);
+                   chunker_cmd(dumper->chunker, FAILED, dp, NULL);
                }
            }
            if( dumper->result != LAST_TOK &&
@@ -1866,14 +1994,13 @@ static void
 handle_chunker_result(
     void *     cookie)
 {
-    /*static int pending_aborts = 0;*/
     chunker_t *chunker = cookie;
     assignedhd_t **h=NULL;
     dumper_t *dumper;
     disk_t *dp, *sdp;
     cmd_t cmd;
     int result_argc;
-    char *result_argv[MAX_ARGS+1];
+    char **result_argv;
     int dummy;
     int activehd = -1;
     char *qname;
@@ -1887,22 +2014,21 @@ handle_chunker_result(
     assert(sched(dp)->destname != NULL);
     assert(dp != NULL && sched(dp) != NULL && sched(dp)->destname);
 
-    if(dp && sched(dp) && sched(dp)->holdp) {
+    if(sched(dp)->holdp) {
        h = sched(dp)->holdp;
        activehd = sched(dp)->activehd;
     }
 
     do {
-
        short_dump_state();
 
-       cmd = getresult(chunker->fd, 1, &result_argc, result_argv, MAX_ARGS+1);
+       cmd = getresult(chunker->fd, 1, &result_argc, &result_argv);
 
        if(cmd != BOGUS) {
-           /* result_argv[2] always contains the serial number */
-           sdp = serial2disk(result_argv[2]);
+           /* result_argv[1] always contains the serial number */
+           sdp = serial2disk(result_argv[1]);
            if (sdp != dp) {
-               error(_("Invalid serial number %s"), result_argv[2]);
+               error(_("Invalid serial number %s"), result_argv[1]);
                 g_assert_not_reached();
            }
        }
@@ -1916,9 +2042,9 @@ handle_chunker_result(
                      result_argc);
                /*NOTREACHED*/
            }
-           /*free_serial(result_argv[2]);*/
+           /*free_serial(result_argv[1]);*/
 
-           sched(dp)->dumpsize = (off_t)atof(result_argv[3]);
+           sched(dp)->dumpsize = (off_t)atof(result_argv[2]);
 
            qname = quote_string(dp->name);
            g_printf(_("driver: finished-cmd time %s %s chunked %s:%s\n"),
@@ -1940,7 +2066,7 @@ handle_chunker_result(
 
            break;
        case FAILED: /* FAILED <handle> <errstr> */
-           /*free_serial(result_argv[2]);*/
+           /*free_serial(result_argv[1]);*/
 
            event_release(chunker->ev_read);
 
@@ -1953,10 +2079,10 @@ handle_chunker_result(
                error(_("!h || activehd < 0"));
                /*NOTREACHED*/
            }
-           h[activehd]->used -= OFF_T_ATOI(result_argv[3]);
-           h[activehd]->reserved -= OFF_T_ATOI(result_argv[3]);
-           h[activehd]->disk->allocated_space -= OFF_T_ATOI(result_argv[3]);
-           h[activehd]->disk->disksize -= OFF_T_ATOI(result_argv[3]);
+           h[activehd]->used -= OFF_T_ATOI(result_argv[2]);
+           h[activehd]->reserved -= OFF_T_ATOI(result_argv[2]);
+           h[activehd]->disk->allocated_space -= OFF_T_ATOI(result_argv[2]);
+           h[activehd]->disk->disksize -= OFF_T_ATOI(result_argv[2]);
            break;
 
        case RQ_MORE_DISK: /* RQ-MORE-DISK <handle> */
@@ -1969,7 +2095,7 @@ handle_chunker_result(
            if( h[++activehd] ) { /* There's still some allocated space left.
                                   * Tell the dumper about it. */
                sched(dp)->activehd++;
-               chunker_cmd( chunker, CONTINUE, dp );
+               chunker_cmd( chunker, CONTINUE, dp, NULL );
            } else { /* !h[++activehd] - must allocate more space */
                sched(dp)->act_size = sched(dp)->est_size; /* not quite true */
                sched(dp)->est_size = (sched(dp)->act_size/(off_t)20) * (off_t)21; /* +5% */
@@ -1987,7 +2113,7 @@ handle_chunker_result(
                } else {
                    /* OK, allocate space for disk and have chunker continue */
                    sched(dp)->activehd = assign_holdingdisk( h, dp );
-                   chunker_cmd( chunker, CONTINUE, dp );
+                   chunker_cmd( chunker, CONTINUE, dp, NULL );
                    amfree(h);
                }
            }
@@ -2002,7 +2128,7 @@ handle_chunker_result(
             */
            /*assert(pending_aborts);*/
 
-           /*free_serial(result_argv[2]);*/
+           /*free_serial(result_argv[1]);*/
 
            event_release(chunker->ev_read);
 
@@ -2015,26 +2141,20 @@ handle_chunker_result(
            log_add(L_WARNING, _("%s pid %ld is messed up, ignoring it.\n"),
                    chunker->name, (long)chunker->pid);
 
-           if(dp) {
-               /* if it was dumping something, zap it and try again */
-               if (!h || activehd < 0) { /* should never happen */
-                   error(_("!h || activehd < 0"));
-                   /*NOTREACHED*/
-               }
-               qname = quote_string(dp->name);
-               if(sched(dp)->dump_attempted) {
-                   log_add(L_FAIL, _("%s %s %s %d [%s died]"),
-                           dp->host->hostname, qname, sched(dp)->datestamp,
-                           sched(dp)->level, chunker->name);
-               }
-               else {
-                   log_add(L_WARNING, _("%s died while dumping %s:%s lev %d."),
-                           chunker->name, dp->host->hostname, qname,
-                           sched(dp)->level);
-               }
-               amfree(qname);
-               dp = NULL;
-           }
+            /* if it was dumping something, zap it and try again */
+            g_assert(h && activehd >= 0);
+            qname = quote_string(dp->name);
+            if(sched(dp)->dump_attempted) {
+                log_add(L_FAIL, _("%s %s %s %d [%s died]"),
+                        dp->host->hostname, qname, sched(dp)->datestamp,
+                        sched(dp)->level, chunker->name);
+            } else {
+                log_add(L_WARNING, _("%s died while dumping %s:%s lev %d."),
+                        chunker->name, dp->host->hostname, qname,
+                        sched(dp)->level);
+            }
+            amfree(qname);
+            dp = NULL;
 
            event_release(chunker->ev_read);
 
@@ -2045,6 +2165,7 @@ handle_chunker_result(
        default:
            assert(0);
        }
+       g_strfreev(result_argv);
 
        if(chunker->result != LAST_TOK && chunker->dumper->result != LAST_TOK)
            dumper_chunker_result(dp);
@@ -2059,7 +2180,6 @@ read_flush(void)
     sched_t *sp;
     disk_t *dp;
     int line;
-    dumpfile_t file;
     char *hostname, *diskname, *datestamp;
     int level;
     char *destname;
@@ -2075,6 +2195,8 @@ read_flush(void)
     tq.head = tq.tail = NULL;
 
     for(line = 0; (inpline = agets(stdin)) != NULL; free(inpline)) {
+       dumpfile_t file;
+
        line++;
        if (inpline[0] == '\0')
            continue;
@@ -2151,6 +2273,7 @@ read_flush(void)
                log_add(L_INFO, _("%s: ignoring cruft file."), destname);
            amfree(diskname);
            amfree(destname);
+           dumpfile_free_data(&file);
            continue;
        }
 
@@ -2161,6 +2284,7 @@ read_flush(void)
                    hostname, diskname, destname);
            amfree(diskname);
            amfree(destname);
+           dumpfile_free_data(&file);
            continue;
        }
        amfree(diskname);
@@ -2171,6 +2295,7 @@ read_flush(void)
            log_add(L_INFO, _("%s: disk %s:%s not in database, skipping it."),
                    destname, file.name, file.disk);
            amfree(destname);
+           dumpfile_free_data(&file);
            continue;
        }
 
@@ -2178,6 +2303,7 @@ read_flush(void)
            log_add(L_INFO, _("%s: ignoring file with bogus dump level %d."),
                    destname, file.dumplevel);
            amfree(destname);
+           dumpfile_free_data(&file);
            continue;
        }
 
@@ -2185,6 +2311,7 @@ read_flush(void)
            log_add(L_INFO, "%s: removing file with no data.", destname);
            holding_file_unlink(destname);
            amfree(destname);
+           dumpfile_free_data(&file);
            continue;
        }
 
@@ -2208,6 +2335,7 @@ read_flush(void)
        sp->level = file.dumplevel;
        sp->dumpdate = NULL;
        sp->degr_dumpdate = NULL;
+       sp->degr_mesg = NULL;
        sp->datestamp = stralloc(file.datestamp);
        sp->est_nsize = (off_t)0;
        sp->est_csize = (off_t)0;
@@ -2226,6 +2354,7 @@ read_flush(void)
        dp1->up = (char *)sp;
 
        enqueue_disk(&tq, dp1);
+       dumpfile_free_data(&file);
     }
     amfree(inpline);
 
@@ -2239,7 +2368,7 @@ read_schedule(
     sched_t *sp;
     disk_t *dp;
     int level, line, priority;
-    char *dumpdate, *degr_dumpdate;
+    char *dumpdate, *degr_dumpdate, *degr_mesg;
     int degr_level;
     time_t time, degr_time;
     time_t *time_p = &time;
@@ -2381,7 +2510,18 @@ read_schedule(
 
        degr_dumpdate = NULL;                   /* flag if degr fields found */
        skip_whitespace(s, ch);                 /* find the degr level number */
-       if(ch != '\0') {
+       degr_mesg = NULL;
+       if (ch == '"') {
+           qname = s - 1;
+           skip_quoted_string(s, ch);
+           s[-1] = '\0';                       /* terminate degr mesg */
+           degr_mesg = unquote_string(qname);
+           degr_level = -1;
+           degr_nsize = (off_t)0;
+           degr_csize = (off_t)0;
+           degr_time = (time_t)0;
+           degr_kps = 0;
+       } else if (ch != '\0') {
            if(sscanf(s - 1, "%d", &degr_level) != 1) {
                error(_("schedule line %d: syntax error (bad degr level)"), line);
                /*NOTREACHED*/
@@ -2430,11 +2570,7 @@ read_schedule(
            }
            skip_integer(s, ch);
        } else {
-           degr_level = -1;
-           degr_nsize = (off_t)0;
-           degr_csize = (off_t)0;
-           degr_time = (time_t)0;
-           degr_kps = 0;
+           error(_("schedule line %d: no degraded estimate or message"), line);
        }
 
        dp = lookup_disk(hostname, diskname);
@@ -2469,9 +2605,11 @@ read_schedule(
            sp->degr_csize = am_round(sp->degr_csize, DISK_BLOCK_KB);
            sp->degr_time = degr_time;
            sp->degr_kps = degr_kps;
+           sp->degr_mesg = NULL;
        } else {
            sp->degr_level = -1;
            sp->degr_dumpdate = NULL;
+           sp->degr_mesg = degr_mesg;
        }
        /*@end@*/
 
@@ -2860,7 +2998,7 @@ build_diskspace(
 {
     int i, j;
     int fd;
-    ssize_t buflen;
+    size_t buflen;
     char buffer[DISK_BLOCK_BYTES];
     dumpfile_t file;
     assignedhd_t **result;
@@ -2880,9 +3018,20 @@ build_diskspace(
        strncpy(dirname, filename, 999);
        dirname[999]='\0';
        ch = strrchr(dirname,'/');
-        *ch = '\0';
-       ch = strrchr(dirname,'/');
-        *ch = '\0';
+       if (ch) {
+           *ch = '\0';
+           ch = strrchr(dirname,'/');
+           if (ch) {
+               *ch = '\0';
+           }
+       }
+
+       if (!ch) {
+           g_fprintf(stderr,_("build_diskspace: bogus filename '%s'\n"), filename);
+           amfree(used);
+           amfree(result);
+           return NULL;
+       }
 
        for(j = 0, ha = holdalloc; ha != NULL; ha = ha->next, j++ ) {
            if(strcmp(dirname, holdingdisk_get_diskdir(ha->hdisk))==0) {
@@ -2898,10 +3047,12 @@ build_diskspace(
        if((fd = open(filename,O_RDONLY)) == -1) {
            g_fprintf(stderr,_("build_diskspace: open of %s failed: %s\n"),
                    filename, strerror(errno));
+           amfree(used);
+           amfree(result);
            return NULL;
        }
-       if ((buflen = fullread(fd, buffer, SIZEOF(buffer))) > 0) {;
-               parse_file_header(buffer, &file, (size_t)buflen);
+       if ((buflen = full_read(fd, buffer, SIZEOF(buffer))) > 0) {;
+               parse_file_header(buffer, &file, buflen);
        }
        close(fd);
        filename = file.cont_filename;
@@ -2968,8 +3119,9 @@ dump_to_tape(
     dumper_t *dumper;
     cmd_t cmd;
     int result_argc;
-    char *result_argv[MAX_ARGS+1];
+    char **result_argv;
     char *qname;
+    disk_t *dp1;
 
     qname = quote_string(dp->name);
     g_printf(_("driver: dumping %s:%s directly to tape\n"),
@@ -2992,7 +3144,7 @@ dump_to_tape(
     /* tell the taper to read from a port number of its choice */
 
     taper_cmd(PORT_WRITE, dp, NULL, sched(dp)->level, sched(dp)->datestamp);
-    cmd = getresult(taper, 1, &result_argc, result_argv, MAX_ARGS+1);
+    cmd = getresult(taper, 1, &result_argc, &result_argv);
     if(cmd != PORT) {
        g_printf(_("driver: did not get PORT from taper for %s:%s\n"),
                dp->host->hostname, qname);
@@ -3005,7 +3157,7 @@ dump_to_tape(
     amfree(qname);
 
     /* copy port number */
-    dumper->output_port = atoi(result_argv[2]);
+    dumper->output_port = atoi(result_argv[1]);
 
     dumper->dp = dp;
     dumper->chunker = NULL;
@@ -3013,8 +3165,18 @@ dump_to_tape(
     taper_result = LAST_TOK;
     sched(dp)->dumper = dumper;
 
+    if (dp->host->pre_script == 0) {
+       for (dp1=dp->host->disks; dp1 != NULL; dp1 = dp1->hostnext) {
+           run_server_scripts(EXECUTE_ON_PRE_HOST_BACKUP,
+                              get_config_name(), dp1, -1);
+       }
+       dp->host->pre_script = 1;
+    }
+    run_server_scripts(EXECUTE_ON_PRE_DLE_BACKUP, get_config_name(), dp,
+                      sched(dp)->level);
+
     /* tell the dumper to dump to a port */
-    dumper_cmd(dumper, PORT_DUMP, dp);
+    dumper_cmd(dumper, PORT_DUMP, dp, NULL);
     dp->host->start_t = time(NULL) + 15;
 
     /* update statistics & print state */
@@ -3024,8 +3186,6 @@ dump_to_tape(
     taper_tape_error = NULL;
     taper_dumper = dumper;
     taper_disk = dp;
-    taper_input_error = NULL;
-    taper_tape_error = NULL;
     taper_first_label = NULL;
     taper_written = 0;
     taper_state |= TAPER_STATE_DUMP_TO_TAPE;
@@ -3042,6 +3202,8 @@ dump_to_tape(
                                     handle_dumper_result, dumper);
     taper_ev_read = event_register(taper, EV_READFD,
                                   handle_taper_result, NULL);
+
+    g_strfreev(result_argv);
 }
 
 static int
@@ -3084,7 +3246,7 @@ short_dump_state(void)
     fflush(stdout);
 }
 
-static TapeAction tape_action(void)
+static TapeAction tape_action(char **why_no_new_tape)
 {
     TapeAction result = TAPE_ACTION_NO_ACTION;
     dumper_t *dumper;
@@ -3155,6 +3317,13 @@ static TapeAction tape_action(void)
                 dump_to_disk_terminated))              //  or all dump to disk terminated
              ) {
        result |= TAPE_ACTION_NO_NEW_TAPE;
+       if (flush_threshold_dumped >= tapeq_size) {
+           *why_no_new_tape = _("flush-threshold-dumped criteria not met");
+       } else if (flush_threshold_scheduled >= sched_size) {
+           *why_no_new_tape = _("flush-threshold-scheduled criteria not met");
+       } else {
+           *why_no_new_tape = _("taperflush criteria not met");
+       }
     }
 
     // when to start a flush
index 326c1be40845d29908bec2f08554a50a6f0e02dd..6b2cd1e32582c988e8c98e94c17199caef0b4174 100644 (file)
@@ -37,7 +37,6 @@
 #include "diskfile.h"
 #include "infofile.h"
 #include "logfile.h"
-#include "token.h"
 
 #define GLOBAL         /* the global variables defined here */
 #include "driverio.h"
@@ -113,7 +112,7 @@ startup_tape_process(
            error(_("taper dup2: %s"), strerror(errno));
        config_options = get_config_options(2);
        config_options[0] = "taper";
-       config_options[1] = config_name;
+       config_options[1] = get_config_name();
        safe_fd(-1, 0);
        execve(taper_program, config_options, safe_env());
        error("exec %s: %s", taper_program, strerror(errno));
@@ -150,7 +149,7 @@ startup_dump_process(
            error(_("%s dup2: %s"), dumper->name, strerror(errno));
        config_options = get_config_options(2);
        config_options[0] = dumper->name ? dumper->name : "dumper",
-       config_options[1] = config_name;
+       config_options[1] = get_config_name();
        safe_fd(-1, 0);
        execve(dumper_program, config_options, safe_env());
        error(_("exec %s (%s): %s"), dumper_program,
@@ -188,7 +187,7 @@ startup_dump_processes(
        chktable[i].fd = -1;
 
        startup_dump_process(dumper, dumper_program);
-       dumper_cmd(dumper, START, (void *)timestamp);
+       dumper_cmd(dumper, START, NULL, (void *)timestamp);
     }
 }
 
@@ -218,7 +217,7 @@ startup_chunk_process(
        }
        config_options = get_config_options(2);
        config_options[0] = chunker->name ? chunker->name : "chunker",
-       config_options[1] = config_name;
+       config_options[1] = get_config_name();
        safe_fd(-1, 0);
        execve(chunker_program, config_options, safe_env());
        error(_("exec %s (%s): %s"), chunker_program,
@@ -241,10 +240,8 @@ getresult(
     int fd,
     int show,
     int *result_argc,
-    char **result_argv,
-    int max_arg)
+    char ***result_argv)
 {
-    int arg;
     cmd_t t;
     char *line;
 
@@ -253,9 +250,11 @@ getresult(
            error(_("reading result from %s: %s"), childstr(fd), strerror(errno));
            /*NOTREACHED*/
        }
+       *result_argv = NULL;
        *result_argc = 0;                               /* EOF */
     } else {
-       *result_argc = split(line, result_argv, max_arg, " ");
+       *result_argv = split_quoted_strings(line);
+       *result_argc = g_strv_length(*result_argv);
     }
 
     if(show) {
@@ -263,9 +262,7 @@ getresult(
               walltime_str(curclock()),
               childstr(fd));
        if(line) {
-           for(arg = 1; arg <= *result_argc; arg++) {
-               g_printf(" %s", result_argv[arg]);
-           }
+           g_printf(" %s", line);
            putchar('\n');
        } else {
            g_printf(" (eof)\n");
@@ -274,16 +271,10 @@ getresult(
     }
     amfree(line);
 
-#ifdef DEBUG
-    g_printf("argc = %d\n", *result_argc);
-    for(arg = 0; arg < *result_argc; arg++)
-       g_printf("argv[%d] = \"%s\"\n", arg, result_argv[arg]);
-#endif
-
     if(*result_argc < 1) return BOGUS;
 
     for(t = (cmd_t)(BOGUS+1); t < LAST_TOK; t++)
-       if(strcmp(result_argv[1], cmdstr[t]) == 0) return t;
+       if(strcmp((*result_argv)[0], cmdstr[t]) == 0) return t;
 
     return BOGUS;
 }
@@ -305,6 +296,7 @@ taper_cmd(
     disk_t *dp;
     char *qname;
     char *qdest;
+    char *q;
 
     switch(cmd) {
     case START_TAPER:
@@ -367,8 +359,14 @@ taper_cmd(
                            " ", disk2serial(dp),
                            "\n", NULL);
        break;
-    case NEW_TAPE:
     case NO_NEW_TAPE:
+       q = quote_string((char *)ptr);
+       cmdline = vstralloc(cmdstr[cmd],
+                           " ", q,
+                           "\n", NULL);
+       amfree(q);
+       break;
+    case NEW_TAPE:
     case QUIT:
        cmdline = stralloc2(cmdstr[cmd], "\n");
        break;
@@ -383,7 +381,7 @@ taper_cmd(
     g_printf(_("driver: send-cmd time %s to taper: %s"),
           walltime_str(curclock()), cmdline);
     fflush(stdout);
-    if ((fullwrite(taper, cmdline, strlen(cmdline))) < 0) {
+    if ((full_write(taper, cmdline, strlen(cmdline))) < strlen(cmdline)) {
        g_printf(_("writing taper command '%s' failed: %s\n"),
                cmdline, strerror(errno));
        fflush(stdout);
@@ -399,7 +397,8 @@ int
 dumper_cmd(
     dumper_t *dumper,
     cmd_t cmd,
-    disk_t *dp)
+    disk_t *dp,
+    char   *mesg)
 {
     char *cmdline = NULL;
     char number[NUM_STR_SIZE];
@@ -408,11 +407,11 @@ dumper_cmd(
     char *device;
     char *features;
     char *qname;
-    char *qdest;
+    char *qmesg;
 
     switch(cmd) {
     case START:
-       cmdline = vstralloc(cmdstr[cmd], " ", (char *)dp, "\n", NULL);
+       cmdline = vstralloc(cmdstr[cmd], " ", mesg, "\n", NULL);
        break;
     case PORT_DUMP:
        if(dp && dp->device) {
@@ -428,11 +427,23 @@ dumper_cmd(
            g_snprintf(number, SIZEOF(number), "%d", sched(dp)->level);
            g_snprintf(numberport, SIZEOF(numberport), "%d", dumper->output_port);
            features = am_feature_to_string(dp->host->features);
-           o = optionstr(dp, dp->host->features, NULL);
+           if (am_has_feature(dp->host->features, fe_req_xml)) {
+               o = xml_optionstr(dp, dp->host->features, NULL, 1);
+               if (dp->application) {
+                   char *app = xml_application(dp->application,
+                                               dp->host->features);
+                   vstrextend(&o, app, NULL);
+                   amfree(app);
+               }
+               o = quote_string(o);
+           } else {
+               o = optionstr(dp, dp->host->features, NULL);
+           }
            if ( o == NULL ) {
              error(_("problem with option string, check the dumptype definition.\n"));
            }
-             
+
+           dbprintf("security_driver %s\n", dp->security_driver);
            cmdline = vstralloc(cmdstr[cmd],
                            " ", disk2serial(dp),
                            " ", numberport,
@@ -442,10 +453,11 @@ dumper_cmd(
                            " ", device,
                            " ", number,
                            " ", sched(dp)->dumpdate,
-                           " ", dp->program,
+                           " ", dp->program && strcmp(dp->program,"APPLICATION")!=0 ? dp->program: application_get_plugin(dp->application),
                            " ", dp->amandad_path,
                            " ", dp->client_username,
                            " ", dp->ssh_keys,
+                           " ", dp->security_driver,
                            " |", o,
                            "\n", NULL);
            amfree(features);
@@ -459,15 +471,9 @@ dumper_cmd(
        break;
     case QUIT:
     case ABORT:
-       if( dp ) {
-           qdest = quote_string(sched(dp)->destname);
-           cmdline = vstralloc(cmdstr[cmd],
-                               " ", qdest,
-                               "\n", NULL );
-           amfree(qdest);
-       } else {
-           cmdline = stralloc2(cmdstr[cmd], "\n");
-       }
+       qmesg = quote_string(mesg);
+       cmdline = vstralloc(cmdstr[cmd], " ", qmesg, "\n", NULL );
+       amfree(qmesg);
        break;
     default:
        error(_("Don't know how to send %s command to dumper"), cmdstr[cmd]);
@@ -484,7 +490,7 @@ dumper_cmd(
        g_printf(_("driver: send-cmd time %s to %s: %s"),
               walltime_str(curclock()), dumper->name, cmdline);
        fflush(stdout);
-       if (fullwrite(dumper->fd, cmdline, strlen(cmdline)) < 0) {
+       if (full_write(dumper->fd, cmdline, strlen(cmdline)) < strlen(cmdline)) {
            g_printf(_("writing %s command: %s\n"), dumper->name, strerror(errno));
            fflush(stdout);
            amfree(cmdline);
@@ -500,7 +506,8 @@ int
 chunker_cmd(
     chunker_t *chunker,
     cmd_t cmd,
-    disk_t *dp)
+    disk_t *dp,
+    char   *mesg)
 {
     char *cmdline = NULL;
     char number[NUM_STR_SIZE];
@@ -515,7 +522,7 @@ chunker_cmd(
 
     switch(cmd) {
     case START:
-       cmdline = vstralloc(cmdstr[cmd], " ", (char *)dp, "\n", NULL);
+       cmdline = vstralloc(cmdstr[cmd], " ", mesg, "\n", NULL);
        break;
     case PORT_WRITE:
        if(dp && sched(dp) && sched(dp)->holdp) {
@@ -588,7 +595,11 @@ chunker_cmd(
        break;
     case QUIT:
     case ABORT:
-       cmdline = stralloc2(cmdstr[cmd], "\n");
+       {
+           char *q = quote_string(mesg);
+           cmdline = vstralloc(cmdstr[cmd], " ", q, "\n", NULL);
+           amfree(q);
+       }
        break;
     case DONE:
     case FAILED:
@@ -611,7 +622,7 @@ chunker_cmd(
     g_printf(_("driver: send-cmd time %s to %s: %s"),
           walltime_str(curclock()), chunker->name, cmdline);
     fflush(stdout);
-    if (fullwrite(chunker->fd, cmdline, strlen(cmdline)) < 0) {
+    if (full_write(chunker->fd, cmdline, strlen(cmdline)) < strlen(cmdline)) {
        g_printf(_("writing %s command: %s\n"), chunker->name, strerror(errno));
        fflush(stdout);
        amfree(cmdline);
index b965550df474d75a134eb649e6a888bc352678e8..c16d04186a3c8dd1c95a510c958ef63828209102 100644 (file)
@@ -32,9 +32,8 @@
 #ifndef DRIVERIO_H
 #define DRIVERIO_H
 
-#include "event.h"
-
 #include "amanda.h"
+#include "event.h"
 #include "holding.h"
 #include "server_util.h"
 
@@ -108,6 +107,7 @@ typedef struct sched_s {
     char *datestamp;
     int activehd;
     int no_space;
+    char *degr_mesg;
 } sched_t;
 
 #define sched(dp)      ((sched_t *) (dp)->up)
@@ -147,6 +147,7 @@ void startup_dump_process(dumper_t *dumper, char *dumper_program);
 void startup_dump_processes(char *dumper_program, int inparallel, char *timestamp);
 void startup_chunk_process(chunker_t *chunker, char *chunker_program);
 
+cmd_t getresult(int fd, int show, int *result_argc, char ***result_argv);
 disk_t *serial2disk(char *str);
 void free_serial(char *str);
 void free_serial_dp(disk_t *dp);
index 18384c738394b4f117b9b4381fb5efe1b915b918..af14723c5dca9a547aba0c046edfc0f05e39dcc2 100644 (file)
 #include "protocol.h"
 #include "security.h"
 #include "stream.h"
-#include "token.h"
 #include "version.h"
 #include "fileheader.h"
 #include "amfeatures.h"
 #include "server_util.h"
 #include "util.h"
 #include "timestamp.h"
+#include "amxml.h"
 
 #define dumper_debug(i,x) do {         \
        if ((i) <= debug_dumper) {      \
@@ -95,19 +95,21 @@ static FILE *errf = NULL;
 static char *hostname = NULL;
 am_feature_t *their_features = NULL;
 static char *diskname = NULL;
-static char *qdiskname = NULL;
-static char *device = NULL;
+static char *qdiskname = NULL, *b64disk;
+static char *device = NULL, *b64device;
 static char *options = NULL;
 static char *progname = NULL;
 static char *amandad_path=NULL;
 static char *client_username=NULL;
 static char *ssh_keys=NULL;
+static char *auth=NULL;
 static int level;
 static char *dumpdate = NULL;
 static char *dumper_timestamp = NULL;
 static time_t conf_dtimeout;
 static int indexfderror;
 static int set_datafd;
+static char *dle_str = NULL;
 
 static dumpfile_t file;
 
@@ -127,10 +129,18 @@ static struct {
 static am_feature_t *our_features = NULL;
 static char *our_feature_string = NULL;
 
+/* buffer to keep partial line from the MESG stream */
+static struct {
+    char *buf;         /* buffer holding msg data */
+    size_t size;       /* size of alloced buffer */
+} msg = { NULL, 0 };
+
+
 /* local functions */
 int            main(int, char **);
 static int     do_dump(struct databuf *);
 static void    check_options(char *);
+static void     xml_check_options(char *optionstr);
 static void    finish_tapeheader(dumpfile_t *);
 static ssize_t write_tapeheader(int, dumpfile_t *);
 static void    databuf_init(struct databuf *, int);
@@ -149,7 +159,8 @@ static int  runencrypt(int, pid_t *,  encrypt_t);
 static void    sendbackup_response(void *, pkt_t *, security_handle_t *);
 static int     startup_dump(const char *, const char *, const char *, int,
                        const char *, const char *, const char *,
-                       const char *, const char *, const char *);
+                       const char *, const char *, const char *,
+                       const char *);
 static void    stop_dump(void);
 
 static void    read_indexfd(void *, void *, ssize_t);
@@ -170,7 +181,7 @@ check_options(
   char *decryptend = NULL;
 
     /* parse the compression option */
-  if (strstr(options, "srvcomp-best;") != NULL) 
+    if (strstr(options, "srvcomp-best;") != NULL) 
       srvcompress = COMP_BEST;
     else if (strstr(options, "srvcomp-fast;") != NULL)
       srvcompress = COMP_FAST;
@@ -241,14 +252,57 @@ check_options(
 }
 
 
+static void
+xml_check_options(
+    char *optionstr)
+{
+    char *o, *oo;
+    char *errmsg = NULL;
+    dle_t *dle;
+
+    char *uoptionstr = unquote_string(optionstr);
+    o = oo = vstralloc("<dle>", strchr(uoptionstr,'<'), "</dle>", NULL);
+  
+    dle = amxml_parse_node_CHAR(o, &errmsg);
+    if (dle == NULL) {
+       error("amxml_parse_node_CHAR failed: %s\n", errmsg);
+    }
+
+    if (dle->compress == COMP_SERVER_FAST) {
+       srvcompress = COMP_FAST;
+    } else if (dle->compress == COMP_SERVER_BEST) {
+       srvcompress = COMP_BEST;
+    } else if (dle->compress == COMP_SERVER_CUST) {
+       srvcompress = COMP_SERVER_CUST;
+       srvcompprog = dle->compprog;
+    } else if (dle->compress == COMP_CUST) {
+       srvcompress = COMP_CUST;
+       clntcompprog = dle->compprog;
+    } else {
+       srvcompress = COMP_NONE;
+    }
+
+    if (dle->encrypt == ENCRYPT_CUST) {
+       srvencrypt = ENCRYPT_CUST;
+       clnt_encrypt = dle->clnt_encrypt;
+       clnt_decrypt_opt = dle->clnt_decrypt_opt;
+    } else if (dle->encrypt == ENCRYPT_SERV_CUST) {
+       srvencrypt = ENCRYPT_SERV_CUST;
+       srv_encrypt = dle->clnt_encrypt;
+       srv_decrypt_opt = dle->clnt_decrypt_opt;
+    } else {
+       srvencrypt = ENCRYPT_NONE;
+    }
+}
+
+
 int
 main(
     int                argc,
     char **    argv)
 {
     static struct databuf db;
-    struct cmdargs cmdargs;
-    cmd_t cmd;
+    struct cmdargs *cmdargs = NULL;
     int outfd = -1;
     int rc;
     in_port_t taper_port;
@@ -257,6 +311,7 @@ main(
     int res;
     config_overwrites_t *cfg_ovr = NULL;
     char *cfg_opt = NULL;
+    int dumper_setuid;
 
     /*
      * Configure program for internationalization:
@@ -268,9 +323,7 @@ main(
     textdomain("amanda"); 
 
     /* drop root privileges */
-    if (!set_root_privs(0)) {
-       error(_("dumper must be run setuid root"));
-    }
+    dumper_setuid = set_root_privs(0);
 
     safe_fd(-1, 0);
 
@@ -287,19 +340,27 @@ main(
     cfg_ovr = extract_commandline_config_overwrites(&argc, &argv);
     if (argc > 1)
        cfg_opt = argv[1];
-    config_init(CONFIG_INIT_EXPLICIT_NAME | CONFIG_INIT_USE_CWD | CONFIG_INIT_FATAL,
-               cfg_opt);
+    config_init(CONFIG_INIT_EXPLICIT_NAME | CONFIG_INIT_USE_CWD, cfg_opt);
     apply_config_overwrites(cfg_ovr);
 
+    if (!dumper_setuid) {
+       error(_("dumper must be run setuid root"));
+    }
+
+    if (config_errors(NULL) >= CFGERR_ERRORS) {
+       g_critical(_("errors processing config file"));
+    }
+
     safe_cd(); /* do this *after* config_init() */
 
     check_running_as(RUNNING_AS_DUMPUSER);
 
-    dbrename(config_name, DBG_SUBDIR_SERVER);
+    dbrename(get_config_name(), DBG_SUBDIR_SERVER);
 
     our_features = am_init_feature_set();
     our_feature_string = am_feature_to_string(our_features);
 
+    log_add(L_INFO, "%s pid %ld", get_pname(), (long)getpid());
     g_fprintf(stderr,
            _("%s: pid %ld executable %s version %s\n"),
            get_pname(), (long) getpid(),
@@ -315,13 +376,16 @@ main(
     protocol_init();
 
     do {
-       cmd = getcmd(&cmdargs);
+       if (cmdargs)
+           free_cmdargs(cmdargs);
+       cmdargs = getcmd();
 
-       switch(cmd) {
+       amfree(errstr);
+       switch(cmdargs->cmd) {
        case START:
-           if(cmdargs.argc <  2)
+           if(cmdargs->argc <  2)
                error(_("error [dumper START: not enough args: timestamp]"));
-           dumper_timestamp = newstralloc(dumper_timestamp, cmdargs.argv[2]);
+           dumper_timestamp = newstralloc(dumper_timestamp, cmdargs->argv[1]);
            break;
 
        case ABORT:
@@ -345,95 +409,102 @@ main(
             *   amandad_path
             *   client_username
             *   ssh_keys
+            *   security_driver
             *   options
             */
-           cmdargs.argc++;                     /* true count of args */
-           a = 2;
+           a = 1; /* skip "PORT-DUMP" */
 
-           if(a >= cmdargs.argc) {
+           if(a >= cmdargs->argc) {
                error(_("error [dumper PORT-DUMP: not enough args: handle]"));
                /*NOTREACHED*/
            }
-           handle = newstralloc(handle, cmdargs.argv[a++]);
+           handle = newstralloc(handle, cmdargs->argv[a++]);
 
-           if(a >= cmdargs.argc) {
+           if(a >= cmdargs->argc) {
                error(_("error [dumper PORT-DUMP: not enough args: port]"));
                /*NOTREACHED*/
            }
-           taper_port = (in_port_t)atoi(cmdargs.argv[a++]);
+           taper_port = (in_port_t)atoi(cmdargs->argv[a++]);
 
-           if(a >= cmdargs.argc) {
+           if(a >= cmdargs->argc) {
                error(_("error [dumper PORT-DUMP: not enough args: hostname]"));
                /*NOTREACHED*/
            }
-           hostname = newstralloc(hostname, cmdargs.argv[a++]);
+           hostname = newstralloc(hostname, cmdargs->argv[a++]);
 
-           if(a >= cmdargs.argc) {
+           if(a >= cmdargs->argc) {
                error(_("error [dumper PORT-DUMP: not enough args: features]"));
                /*NOTREACHED*/
            }
            am_release_feature_set(their_features);
-           their_features = am_string_to_feature(cmdargs.argv[a++]);
+           their_features = am_string_to_feature(cmdargs->argv[a++]);
 
-           if(a >= cmdargs.argc) {
+           if(a >= cmdargs->argc) {
                error(_("error [dumper PORT-DUMP: not enough args: diskname]"));
                /*NOTREACHED*/
            }
-           qdiskname = newstralloc(qdiskname, cmdargs.argv[a++]);
-           if (diskname != NULL)
-               amfree(diskname);
-           diskname = unquote_string(qdiskname);
+           diskname = newstralloc(diskname, cmdargs->argv[a++]);
+           if (qdiskname != NULL)
+               amfree(qdiskname);
+           qdiskname = quote_string(diskname);
+           b64disk = amxml_format_tag("disk", diskname);
 
-           if(a >= cmdargs.argc) {
+           if(a >= cmdargs->argc) {
                error(_("error [dumper PORT-DUMP: not enough args: device]"));
                /*NOTREACHED*/
            }
-           device = newstralloc(device, cmdargs.argv[a++]);
+           device = newstralloc(device, cmdargs->argv[a++]);
+           b64device = amxml_format_tag("diskdevice", device);
            if(strcmp(device,"NODEVICE") == 0)
                amfree(device);
 
-           if(a >= cmdargs.argc) {
+           if(a >= cmdargs->argc) {
                error(_("error [dumper PORT-DUMP: not enough args: level]"));
                /*NOTREACHED*/
            }
-           level = atoi(cmdargs.argv[a++]);
+           level = atoi(cmdargs->argv[a++]);
 
-           if(a >= cmdargs.argc) {
+           if(a >= cmdargs->argc) {
                error(_("error [dumper PORT-DUMP: not enough args: dumpdate]"));
                /*NOTREACHED*/
            }
-           dumpdate = newstralloc(dumpdate, cmdargs.argv[a++]);
+           dumpdate = newstralloc(dumpdate, cmdargs->argv[a++]);
 
-           if(a >= cmdargs.argc) {
+           if(a >= cmdargs->argc) {
                error(_("error [dumper PORT-DUMP: not enough args: program]"));
                /*NOTREACHED*/
            }
-           progname = newstralloc(progname, cmdargs.argv[a++]);
+           progname = newstralloc(progname, cmdargs->argv[a++]);
 
-           if(a >= cmdargs.argc) {
+           if(a >= cmdargs->argc) {
                error(_("error [dumper PORT-DUMP: not enough args: amandad_path]"));
                /*NOTREACHED*/
            }
-           amandad_path = newstralloc(amandad_path, cmdargs.argv[a++]);
+           amandad_path = newstralloc(amandad_path, cmdargs->argv[a++]);
 
-           if(a >= cmdargs.argc) {
+           if(a >= cmdargs->argc) {
                error(_("error [dumper PORT-DUMP: not enough args: client_username]"));
            }
-           client_username = newstralloc(client_username, cmdargs.argv[a++]);
+           client_username = newstralloc(client_username, cmdargs->argv[a++]);
 
-           if(a >= cmdargs.argc) {
+           if(a >= cmdargs->argc) {
                error(_("error [dumper PORT-DUMP: not enough args: ssh_keys]"));
            }
-           ssh_keys = newstralloc(ssh_keys, cmdargs.argv[a++]);
+           ssh_keys = newstralloc(ssh_keys, cmdargs->argv[a++]);
 
-           if(a >= cmdargs.argc) {
+           if(a >= cmdargs->argc) {
+               error(_("error [dumper PORT-DUMP: not enough args: auth]"));
+           }
+           auth = newstralloc(auth, cmdargs->argv[a++]);
+
+           if(a >= cmdargs->argc) {
                error(_("error [dumper PORT-DUMP: not enough args: options]"));
            }
-           options = newstralloc(options, cmdargs.argv[a++]);
+           options = newstralloc(options, cmdargs->argv[a++]);
 
-           if(a != cmdargs.argc) {
+           if(a != cmdargs->argc) {
                error(_("error [dumper PORT-DUMP: too many args: %d != %d]"),
-                     cmdargs.argc, a);
+                     cmdargs->argc, a);
                /*NOTREACHED*/
            }
 
@@ -442,7 +513,7 @@ main(
                errstr = newvstrallocf(errstr,
                                     _("could not resolve localhost: %s"),
                                     gai_strerror(res));
-               q = squotef(errstr);
+               q = quote_string(errstr);
                putresult(FAILED, "%s %s\n", handle, q);
                log_add(L_FAIL, "%s %s %s %d [%s]", hostname, qdiskname,
                        dumper_timestamp, level, errstr);
@@ -458,7 +529,7 @@ main(
                
                errstr = newvstrallocf(errstr, _("port open: %s"),
                                      strerror(errno));
-               q = squotef(errstr);
+               q = quote_string(errstr);
                putresult(FAILED, "%s %s\n", handle, q);
                log_add(L_FAIL, "%s %s %s %d [%s]", hostname, qdiskname,
                        dumper_timestamp, level, errstr);
@@ -467,7 +538,10 @@ main(
            }
            databuf_init(&db, outfd);
 
-           check_options(options);
+           if (am_has_feature(their_features, fe_req_xml))
+               xml_check_options(options);
+           else
+               check_options(options);
 
            rc = startup_dump(hostname,
                              diskname,
@@ -478,9 +552,10 @@ main(
                              amandad_path,
                              client_username,
                              ssh_keys,
+                             auth,
                              options);
            if (rc != 0) {
-               q = squote(errstr);
+               q = quote_string(errstr);
                putresult(rc == 2? FAILED : TRYAGAIN, "%s %s\n",
                    handle, q);
                if (rc == 2)
@@ -500,10 +575,8 @@ main(
            break;
 
        default:
-           if(cmdargs.argc >= 1) {
-               q = squote(cmdargs.argv[1]);
-           } else if(cmdargs.argc >= 0) {
-               q = squote(cmdargs.argv[0]);
+           if(cmdargs->argc >= 1) {
+               q = quote_string(cmdargs->argv[0]);
            } else {
                q = stralloc(_("(no input?)"));
            }
@@ -514,7 +587,10 @@ main(
 
        if (outfd != -1)
            aclose(outfd);
-    } while(cmd != QUIT);
+    } while(cmdargs->cmd != QUIT);
+    free_cmdargs(cmdargs);
+
+    log_add(L_INFO, "pid-done %ld", (long)getpid());
 
     am_release_feature_set(our_features);
     amfree(our_feature_string);
@@ -581,7 +657,8 @@ static int
 databuf_flush(
     struct databuf *   db)
 {
-    ssize_t written;
+    size_t written;
+    char *m;
 
     /*
      * If there's no data, do nothing.
@@ -593,7 +670,7 @@ databuf_flush(
     /*
      * Write out the buffer
      */
-    written = fullwrite(db->fd, db->dataout,
+    written = full_write(db->fd, db->dataout,
                        (size_t)(db->datain - db->dataout));
     if (written > 0) {
        db->dataout += written;
@@ -603,8 +680,10 @@ databuf_flush(
        dumpsize += (dumpbytes / (off_t)1024);
        dumpbytes %= (off_t)1024;
     }
-    if (written < 0) {
-       errstr = squotef(_("data write: %s"), strerror(errno));
+    if (written == 0) {
+       m = vstrallocf(_("data write: %s"), strerror(errno));
+       errstr = quote_string(m);
+       amfree(m);
        return -1;
     }
     db->datain = db->dataout = db->buf;
@@ -661,7 +740,7 @@ parse_info_line(
        size_t len;
     } fields[] = {
        { "BACKUP", file.program, SIZEOF(file.program) },
-       { "DUMPER", file.dumper, SIZEOF(file.dumper) },
+       { "APPLICATION", file.application, SIZEOF(file.application) },
        { "RECOVER_CMD", file.recover_cmd, SIZEOF(file.recover_cmd) },
        { "COMPRESS_SUFFIX", file.comp_suffix, SIZEOF(file.comp_suffix) },
        { "SERVER_CUSTOM_COMPRESS", file.srvcompprog, SIZEOF(file.srvcompprog) },
@@ -749,15 +828,18 @@ process_dumpline(
            dump_result = max(dump_result, 2);
 
            tok = strtok(NULL, "");
-           if (tok == NULL || *tok != '[') {
-               errstr = newvstrallocf(errstr, _("bad remote error: %s"), str);
-           } else {
-               char *enderr;
-
-               tok++;  /* skip over '[' */
-               if ((enderr = strchr(tok, ']')) != NULL)
-                   *enderr = '\0';
-               errstr = newstralloc(errstr, tok);
+           if (!errstr) { /* report first error line */
+               if (tok == NULL || *tok != '[') {
+                   errstr = newvstrallocf(errstr, _("bad remote error: %s"),
+                                          str);
+               } else {
+                   char *enderr;
+
+                   tok++;      /* skip over '[' */
+                   if ((enderr = strchr(tok, ']')) != NULL)
+                       *enderr = '\0';
+                   errstr = newstralloc(errstr, tok);
+               }
            }
            break;
        }
@@ -785,10 +867,6 @@ add_msg_data(
     const char *       str,
     size_t             len)
 {
-    static struct {
-       char *buf;      /* buffer holding msg data */
-       size_t size;    /* size of alloced buffer */
-    } msg = { NULL, 0 };
     char *line, *ch;
     size_t buflen;
 
@@ -905,6 +983,7 @@ finish_tapeheader(
     strncpy(file->name, hostname, SIZEOF(file->name) - 1);
     strncpy(file->disk, diskname, SIZEOF(file->disk) - 1);
     file->dumplevel = level;
+    file->blocksize = DISK_BLOCK_BYTES;
 
     /*
      * If we're doing the compression here, we need to override what
@@ -977,6 +1056,10 @@ finish_tapeheader(
        file->encrypted= 1;
       }
     }
+    if (dle_str)
+       file->dle_str = stralloc(dle_str);
+    else
+       file->dle_str = NULL;
 }
 
 /*
@@ -988,16 +1071,14 @@ write_tapeheader(
     dumpfile_t *file)
 {
     char * buffer;
-    ssize_t written;
+    size_t written;
 
     buffer = build_header(file, DISK_BLOCK_BYTES);
 
-    written = fullwrite(outfd, buffer, DISK_BLOCK_BYTES);
+    written = full_write(outfd, buffer, DISK_BLOCK_BYTES);
     amfree(buffer);
     if(written == DISK_BLOCK_BYTES)
         return 0;
-    if(written < 0)
-        return written;
 
     return -1;
 }
@@ -1016,9 +1097,11 @@ do_dump(
     char *errfname = NULL;
     int indexout;
     pid_t indexpid = -1;
+    char *m;
 
     startclock();
 
+    if (msg.buf) msg.buf[0] = '\0';    /* reset msg buffer */
     status = 0;
     dump_result = 0;
     dumpbytes = dumpsize = headersize = origsize = (off_t)0;
@@ -1104,6 +1187,16 @@ do_dump(
        if (!errstr) errstr = stralloc(_("got no data"));
     }
 
+    if (!ISSET(status, HEADER_DONE)) {
+       dump_result = max(dump_result, 2);
+       if (!errstr) errstr = stralloc(_("got no header information"));
+    }
+
+    if (dumpsize == 0) {
+       dump_result = max(dump_result, 2);
+       if (!errstr) errstr = stralloc(_("got no data"));
+    }
+
     if (dump_result > 1)
        goto failed;
 
@@ -1117,7 +1210,9 @@ do_dump(
        (long long)dumpsize,
        (isnormal(dumptime) ? ((double)dumpsize / (double)dumptime) : 0.0),
        (long long)origsize);
-    q = squotef("[%s]", errstr);
+    m = vstrallocf("[%s]", errstr);
+    q = quote_string(m);
+    amfree(m);
     putresult(DONE, _("%s %lld %lld %lu %s\n"), handle,
                (long long)origsize,
                (long long)dumpsize,
@@ -1147,6 +1242,7 @@ do_dump(
 
        /*@i@*/ aclose(indexout);
        waitpid(indexpid,&index_status,0);
+       log_add(L_INFO, "pid-done %ld", (long)indexpid);
        if (rename(indexfile_tmp, indexfile_real) != 0) {
            log_add(L_WARNING, _("could not rename \"%s\" to \"%s\": %s"),
                    indexfile_tmp, indexfile_real, strerror(errno));
@@ -1157,55 +1253,72 @@ do_dump(
 
     if(db->compresspid != -1) {
        waitpid(db->compresspid,NULL,0);
+       log_add(L_INFO, "pid-done %ld", (long)db->compresspid);
     }
     if(db->encryptpid != -1) {
        waitpid(db->encryptpid,NULL,0);
+       log_add(L_INFO, "pid-done %ld", (long)db->encryptpid);
     }
 
     amfree(errstr);
+    dumpfile_free_data(&file);
 
     return 1;
 
 failed:
-    q = squotef("[%s]", errstr);
+    m = vstrallocf("[%s]", errstr);
+    q = quote_string(m);
     putresult(FAILED, "%s %s\n", handle, q);
     amfree(q);
+    amfree(m);
 
     aclose(db->fd);
     /* kill all child process */
     if (db->compresspid != -1) {
        g_fprintf(stderr,_("%s: kill compress command\n"),get_pname());
        if (kill(db->compresspid, SIGTERM) < 0) {
-           if (errno != ESRCH)
+           if (errno != ESRCH) {
                g_fprintf(stderr,_("%s: can't kill compress command: %s\n"), 
                    get_pname(), strerror(errno));
+           } else {
+               log_add(L_INFO, "pid-done %ld", (long)db->compresspid);
+           }
        }
        else {
            waitpid(db->compresspid,NULL,0);
+           log_add(L_INFO, "pid-done %ld", (long)db->compresspid);
        }
     }
 
     if (db->encryptpid != -1) {
        g_fprintf(stderr,_("%s: kill encrypt command\n"),get_pname());
        if (kill(db->encryptpid, SIGTERM) < 0) {
-           if (errno != ESRCH)
+           if (errno != ESRCH) {
                g_fprintf(stderr,_("%s: can't kill encrypt command: %s\n"), 
                    get_pname(), strerror(errno));
+           } else {
+               log_add(L_INFO, "pid-done %ld", (long)db->encryptpid);
+           }
        }
        else {
            waitpid(db->encryptpid,NULL,0);
+           log_add(L_INFO, "pid-done %ld", (long)db->encryptpid);
        }
     }
 
     if (indexpid != -1) {
        g_fprintf(stderr,_("%s: kill index command\n"),get_pname());
        if (kill(indexpid, SIGTERM) < 0) {
-           if (errno != ESRCH)
+           if (errno != ESRCH) {
                g_fprintf(stderr,_("%s: can't kill index command: %s\n"), 
                    get_pname(),strerror(errno));
+           } else {
+               log_add(L_INFO, "pid-done %ld", (long)indexpid);
+           }
        }
        else {
            waitpid(indexpid,NULL,0);
+           log_add(L_INFO, "pid-done %ld", (long)indexpid);
        }
     }
 
@@ -1420,7 +1533,7 @@ read_indexfd(
     /*
      * We ignore error while writing to the index file.
      */
-    if (fullwrite(fd, buf, (size_t)size) < 0) {
+    if (full_write(fd, buf, (size_t)size) < (size_t)size) {
        /* Ignore error, but schedule another read. */
        if(indexfderror == 0) {
            indexfderror = 1;
@@ -1478,7 +1591,18 @@ timeout_callback(
 static void
 stop_dump(void)
 {
-    int i;
+    int             i;
+    struct cmdargs *cmdargs = NULL;
+
+    /* Check if I have a pending ABORT command */
+    cmdargs = get_pending_cmd();
+    if (cmdargs) {
+       if (cmdargs->cmd != ABORT) {
+           error(_("beurk"));
+       }
+       errstr = stralloc(cmdargs->argv[1]);
+       free_cmdargs(cmdargs);
+    }
 
     for (i = 0; i < NSTREAMS; i++) {
        if (streams[i].fd != NULL) {
@@ -1535,13 +1659,20 @@ runcompress(
            error(_("err dup2 out: %s"), strerror(errno));
            /*NOTREACHED*/
        }
-       safe_fd(-1, 0);
        if (comptype != COMP_SERVER_CUST) {
+           char *base = stralloc(COMPRESS_PATH);
+           log_add(L_INFO, "%s pid %ld", basename(base), (long)getpid());
+           amfree(base);
+           safe_fd(-1, 0);
            execlp(COMPRESS_PATH, COMPRESS_PATH, (  comptype == COMP_BEST ?
                COMPRESS_BEST_OPT : COMPRESS_FAST_OPT), (char *)NULL);
            error(_("error: couldn't exec %s: %s"), COMPRESS_PATH, strerror(errno));
            /*NOTREACHED*/
        } else if (*srvcompprog) {
+           char *base = stralloc(srvcompprog);
+           log_add(L_INFO, "%s pid %ld", basename(base), (long)getpid());
+           amfree(base);
+           safe_fd(-1, 0);
            execlp(srvcompprog, srvcompprog, (char *)0);
            error(_("error: couldn't exec server custom filter%s.\n"), srvcompprog);
            /*NOTREACHED*/
@@ -1587,7 +1718,8 @@ runencrypt(
        aclose(outpipe[1]);
        aclose(outpipe[0]);
        return (rval);
-    case 0:
+    case 0: {
+       char *base;
        if (dup2(outpipe[0], 0) < 0) {
            error(_("err dup2 in: %s"), strerror(errno));
            /*NOTREACHED*/
@@ -1596,12 +1728,16 @@ runencrypt(
            error(_("err dup2 out: %s"), strerror(errno));
            /*NOTREACHED*/
        }
+       base = stralloc(srv_encrypt);
+       log_add(L_INFO, "%s pid %ld", basename(base), (long)getpid());
+       amfree(base);
        safe_fd(-1, 0);
        if ((encrypttype == ENCRYPT_SERV_CUST) && *srv_encrypt) {
            execlp(srv_encrypt, srv_encrypt, (char *)0);
            error(_("error: couldn't exec server encryption%s.\n"), srv_encrypt);
            /*NOTREACHED*/
        }
+       }
     }
     /*NOTREACHED*/
     return (-1);
@@ -1624,6 +1760,8 @@ sendbackup_response(
     assert(response_error != NULL);
     assert(sech != NULL);
 
+    security_close_connection(sech, hostname);
+
     if (pkt == NULL) {
        errstr = newvstrallocf(errstr, _("[request failed: %s]"),
            security_geterror(sech));
@@ -1631,8 +1769,6 @@ sendbackup_response(
        return;
     }
 
-    security_close_connection(sech, hostname);
-
     extra = NULL;
     memset(ports, 0, SIZEOF(ports));
     if (pkt->type == P_NAK) {
@@ -1857,14 +1993,15 @@ startup_dump(
     const char *amandad_path,
     const char *client_username,
     const char *ssh_keys,
+    const char *auth,
     const char *options)
 {
     char level_string[NUM_STR_SIZE];
     char *req = NULL;
-    char *authopt, *endauthopt, authoptbuf[80];
+    char *authopt;
     int response_error;
     const security_driver_t *secdrv;
-    char *backup_api;
+    char *application_api;
     int has_features;
     int has_hostname;
     int has_device;
@@ -1874,6 +2011,7 @@ startup_dump(
     (void)amandad_path;                /* Quiet unused parameter warning */
     (void)client_username;     /* Quiet unused parameter warning */
     (void)ssh_keys;            /* Quiet unused parameter warning */
+    (void)auth;                        /* Quiet unused parameter warning */
 
     has_features = am_has_feature(their_features, fe_req_options_features);
     has_hostname = am_has_feature(their_features, fe_req_options_hostname);
@@ -1886,28 +2024,13 @@ startup_dump(
      * Options really need to be pre-parsed into some sort of structure
      * much earlier, and then flattened out again before transmission.
      */
-    authopt = strstr(options, "auth=");
-    if (authopt == NULL) {
-       authopt = "BSD";
-    } else {
-       endauthopt = strchr(authopt, ';');
-       if ((endauthopt == NULL) ||
-         ((sizeof(authoptbuf) - 1) < (size_t)(endauthopt - authopt))) {
-           authopt = "BSD";
-       } else {
-           authopt += strlen("auth=");
-           strncpy(authoptbuf, authopt, (size_t)(endauthopt - authopt));
-           authoptbuf[endauthopt - authopt] = '\0';
-           authopt = authoptbuf;
-       }
-    }
 
     g_snprintf(level_string, SIZEOF(level_string), "%d", level);
     if(strcmp(progname, "DUMP") == 0
        || strcmp(progname, "GNUTAR") == 0) {
-       backup_api = "";
+       application_api = "";
     } else {
-       backup_api = "BACKUP ";
+       application_api = "BACKUP ";
     }
     req = vstralloc("SERVICE sendbackup\n",
                    "OPTIONS ",
@@ -1918,25 +2041,62 @@ startup_dump(
                    has_hostname ? hostname : "",
                    has_hostname ? ";" : "",
                    has_config   ? "config=" : "",
-                   has_config   ? config_name : "",
+                   has_config   ? get_config_name() : "",
                    has_config   ? ";" : "",
                    "\n",
-                   backup_api, progname,
-                   " ", qdiskname,
-                   " ", device && has_device ? device : "",
-                   " ", level_string,
-                   " ", dumpdate,
-                   " OPTIONS ", options,
-                   /* compat: if auth=krb4, send krb4-auth */
-                   (strcasecmp(authopt, "krb4") ? "" : "krb4-auth"),
-                   "\n",
                    NULL);
 
+    amfree(dle_str);
+    if (am_has_feature(their_features, fe_req_xml)) {
+       char *o, *p = NULL;
+       char *pclean;
+       o = unquote_string(options+1);
+       vstrextend(&p, "<dle>\n", NULL);
+       if (*application_api != '\0') {
+           vstrextend(&p, "  <program>APPLICATION</program>\n", NULL);
+       } else {
+           vstrextend(&p, "  <program>", progname, "</program>\n", NULL);
+       }
+       vstrextend(&p, "  ", b64disk, "\n", NULL);
+       if (device && has_device) {
+           vstrextend(&p, "  ", b64device, "\n",
+                      NULL);
+       }
+       vstrextend(&p, "  <level>", level_string, "</level>\n", NULL);
+       vstrextend(&p, o, "</dle>\n", NULL);
+       amfree(o);
+       pclean = clean_dle_str_for_client(p);
+       vstrextend(&req, pclean, NULL);
+       amfree(pclean);
+       dle_str = p;
+    } else if (*application_api != '\0') {
+       errstr = newvstrallocf(errstr,
+               _("[does not support application-api]"));
+       amfree(req);
+       return 2;
+    } else {
+       authopt = strstr(options, "auth=");
+       if (auth == NULL) {
+           auth = "BSD";
+       }
+       vstrextend(&req,
+                  progname,
+                  " ", qdiskname,
+                  " ", device && has_device ? device : "",
+                  " ", level_string,
+                  " ", dumpdate,
+                  " OPTIONS ", options,
+                  /* compat: if authopt=krb4, send krb4-auth */
+                  (strcasecmp(authopt, "krb4") ? "" : "krb4-auth"),
+                  "\n",
+                  NULL);
+    }
+
     dbprintf(_("send request:\n----\n%s\n----\n\n"), req);
-    secdrv = security_getdriver(authopt);
+    secdrv = security_getdriver(auth);
     if (secdrv == NULL) {
        errstr = newvstrallocf(errstr,
-               _("[could not find security driver '%s']"), authopt);
+               _("[could not find security driver '%s']"), auth);
        amfree(req);
        return 2;
     }
index 3ff744e69c16a93cc954036e6556e9e309d92e6b..ccf878d368889dcf6fb625bab8a820fd20a012f4 100644 (file)
@@ -35,6 +35,7 @@
 #include "logfile.h"
 #include "holding.h"
 #include "find.h"
+#include <regex.h>
 #include "cmdline.h"
 
 int find_match(char *host, char *disk);
@@ -207,18 +208,21 @@ search_holding_disk(
     GSList *e;
     char *holding_file;
     disk_t *dp;
-    dumpfile_t file;
 
     holding_file_list = holding_get_files(NULL, 1);
 
     for(e = holding_file_list; e != NULL; e = e->next) {
+       dumpfile_t file;
+
        holding_file = (char *)e->data;
 
        if (!holding_file_get_dumpfile(holding_file, &file))
            continue;
 
-       if (file.dumplevel < 0 || file.dumplevel > 9)
+       if (file.dumplevel < 0 || file.dumplevel > 9) {
+           dumpfile_free_data(&file);
            continue;
+       }
 
        dp = NULL;
        for(;;) {
@@ -230,12 +234,12 @@ search_holding_disk(
            *s = '\0';
        }
        if ( dp == NULL ) {
+           dumpfile_free_data(&file);
            continue;
        }
 
        if(find_match(file.name,file.disk)) {
-           find_result_t *new_output_find =
-               alloc(SIZEOF(find_result_t));
+           find_result_t *new_output_find = g_new0(find_result_t, 1);
            new_output_find->next=*output_find;
            new_output_find->timestamp = stralloc(file.datestamp);
            new_output_find->hostname = stralloc(file.name);
@@ -247,11 +251,23 @@ search_holding_disk(
            new_output_find->status=stralloc("OK");
            *output_find=new_output_find;
        }
+       dumpfile_free_data(&file);
     }
 
     g_slist_free_full(holding_file_list);
 }
 
+static char *
+get_write_timestamp(char *tapelabel)
+{
+    tape_t *tp;
+
+    if (!tapelabel || !(tp = lookup_tapelabel(tapelabel)))
+       return "0";
+
+    return tp->datestamp;
+}
+
 static int
 find_compare(
     const void *i1,
@@ -290,6 +306,9 @@ find_compare(
        case 'b' : compare=compare_possibly_null_strings(i->label,
                                                          j->label);
                    break;
+       case 'w': compare=strcmp(get_write_timestamp(i->label),
+                                get_write_timestamp(j->label));
+                  break;
        case 'p' :
                   if(strcmp(i->partnum, "--") != 0 &&
                      strcmp(j->partnum, "--") != 0){
@@ -426,7 +445,10 @@ print_find_result(
             formatted_label = output_find_result->label;
             if (formatted_label == NULL)
                 formatted_label = "";
+
            /*@ignore@*/
+           /* sec and kb are omitted here, for compatibility with the existing
+            * output from 'amadmin' */
            g_printf("%-*s %-*s %-*s %*d %-*s %*lld %*s %-*s\n",
                      max_len_datestamp, 
                      find_nicedate(output_find_result->timestamp),
@@ -622,6 +644,11 @@ search_logfile(
     find_result_t *a_part_find;
     gboolean right_label = FALSE;
     gboolean found_something = FALSE;
+    regex_t regex;
+    int reg_result;
+    regmatch_t pmatch[3];
+    double sec;
+    size_t kb;
 
     g_return_val_if_fail(output_find != NULL, 0);
     g_return_val_if_fail(logfile != NULL, 0);
@@ -774,6 +801,34 @@ search_logfile(
                *s = '\0';
            }
 
+           /* extract sec, kb, kps from 'rest', if present.  This isn't the stone age
+            * anymore, so we'll just do it the easy way (a regex) */
+           bzero(&regex, sizeof(regex));
+           reg_result = regcomp(&regex,
+                   "\\[sec ([0-9.]+) kb ([0-9]+) kps [0-9.]+\\]", REG_EXTENDED);
+           if (reg_result != 0) {
+               error("Error compiling regular expression for parsing log lines");
+               /* NOTREACHED */
+           }
+
+           /* an error here just means the line wasn't found -- not fatal. */
+           reg_result = regexec(&regex, rest, sizeof(pmatch)/sizeof(*pmatch), pmatch, 0);
+           if (reg_result == 0) {
+               char *str;
+
+               str = find_regex_substring(rest, pmatch[1]);
+               sec = atof(str);
+               amfree(str);
+
+               str = find_regex_substring(rest, pmatch[2]);
+               kb = OFF_T_ATOI(str);
+               amfree(str);
+           } else {
+               sec = 0;
+               kb = 0;
+           }
+           regfree(&regex);
+
            dp = lookup_disk(host,disk);
            if ( dp == NULL ) {
                if (dynamic_disklist == NULL) {
@@ -784,8 +839,7 @@ search_logfile(
            }
             if (find_match(host, disk)) {
                if(curprog == P_TAPER) {
-                   find_result_t *new_output_find =
-                       (find_result_t *)alloc(SIZEOF(find_result_t));
+                   find_result_t *new_output_find = g_new0(find_result_t, 1);
                    new_output_find->timestamp = stralloc(date);
                    new_output_find->hostname=stralloc(host);
                    new_output_find->diskname=stralloc(disk);
@@ -794,6 +848,8 @@ search_logfile(
                     new_output_find->label=stralloc(current_label);
                    new_output_find->status=NULL;
                    new_output_find->filenum=filenum;
+                   new_output_find->sec=sec;
+                   new_output_find->kb=kb;
                    new_output_find->next=NULL;
                    if (curlog == L_SUCCESS) {
                        new_output_find->status = stralloc("OK");
@@ -836,9 +892,12 @@ search_logfile(
                        found_something = TRUE;
                    }
                }
-               else if(curlog == L_FAIL) {     /* print other failures too */
-                   find_result_t *new_output_find =
-                       (find_result_t *)alloc(SIZEOF(find_result_t));
+               else if(curlog == L_FAIL) {
+                   /* print other failures too -- this is a hack to ensure that failures which
+                    * did not make it to tape are also listed in the output of 'amadmin x find';
+                    * users that do not want this information (e.g., Amanda::DB::Catalog) should
+                    * filter dumps with a NULL label. */
+                   find_result_t *new_output_find = g_new0(find_result_t, 1);
                    new_output_find->next=*output_find;
                    new_output_find->timestamp = stralloc(date);
                    new_output_find->hostname=stralloc(host);
@@ -847,6 +906,8 @@ search_logfile(
                    new_output_find->label=NULL;
                    new_output_find->partnum=stralloc(partnum);
                    new_output_find->filenum=0;
+                   new_output_find->sec=sec;
+                   new_output_find->kb=kb;
                    new_output_find->status=vstralloc(
                         "FAILED (",
                         program_str[(int)curprog],
@@ -928,15 +989,17 @@ dumps_match(
           (!level || *level== '\0' || match_level(level, level_str)) &&
           (!ok || !strcmp(cur_result->status, "OK"))){
 
-           find_result_t *curmatch = alloc(SIZEOF(find_result_t));
+           find_result_t *curmatch = g_new0(find_result_t, 1);
            memcpy(curmatch, cur_result, SIZEOF(find_result_t));
 
            curmatch->timestamp = stralloc(cur_result->timestamp);
            curmatch->hostname = stralloc(cur_result->hostname);
            curmatch->diskname = stralloc(cur_result->diskname);
            curmatch->level = cur_result->level;
-           curmatch->label = stralloc(cur_result->label);
+           curmatch->label = cur_result->label? stralloc(cur_result->label) : NULL;
            curmatch->filenum = cur_result->filenum;
+           curmatch->sec = cur_result->sec;
+           curmatch->kb = cur_result->kb;
            curmatch->status = stralloc(cur_result->status);
            curmatch->partnum = stralloc(cur_result->partnum);
 
@@ -986,7 +1049,7 @@ dumps_match_dumpspecs(
                curmatch->hostname = stralloc(cur_result->hostname);
                curmatch->diskname = stralloc(cur_result->diskname);
                curmatch->level = cur_result->level;
-               curmatch->label = stralloc(cur_result->label);
+               curmatch->label = cur_result->label? stralloc(cur_result->label) : NULL;
                curmatch->filenum = cur_result->filenum;
                curmatch->status = stralloc(cur_result->status);
                curmatch->partnum = stralloc(cur_result->partnum);
index bcd8469ca3b1733da0d0449ed001db250c86bc7a..6bb76d50d3a4c1c4e0902811e1b1f8fd34d6aa25 100644 (file)
@@ -3,7 +3,7 @@
 
 #include "diskfile.h"
 
-#define DEFAULT_SORT_ORDER      "hkdlpbf"
+#define DEFAULT_SORT_ORDER      "hkdlpbfw"
 
 typedef struct find_result_s {
     struct find_result_s *next;
@@ -15,6 +15,8 @@ typedef struct find_result_s {
     off_t filenum;
     char *status;
     char *partnum;
+    double sec;                /* may be 0.0 for older log files or holding files */
+    size_t kb;         /* may be 0 for older log files or holding files */
     void *user_ptr;
 } find_result_t;
 
diff --git a/server-src/getconf.c b/server-src/getconf.c
deleted file mode 100644 (file)
index fb90b37..0000000
+++ /dev/null
@@ -1,632 +0,0 @@
-/*
- * Amanda, The Advanced Maryland Automatic Network Disk Archiver
- * Copyright (c) 1991-1998 University of Maryland at College Park
- * All Rights Reserved.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of U.M. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission.  U.M. makes no representations about the
- * suitability of this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- *
- * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M.
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: James da Silva, Systems Design and Analysis Group
- *                        Computer Science Department
- *                        University of Maryland at College Park
- */
-/*
- * $Id: getconf.c,v 1.26 2006/07/25 19:00:56 martinea Exp $
- *
- * a little wrapper to extract config variables for shell scripts
- */
-#include "amanda.h"
-#include "version.h"
-#include "genversion.h"
-#include "conffile.h"
-
-int main(int argc, char **argv);
-
-/*
- * HOSTNAME_INSTANCE may not be defined at this point.
- * We define it locally if it is needed...
- *
- * If CLIENT_HOST_PRINCIPAL is defined as HOSTNAME_INSTANCE
- * then local host is the client host principal.
- */
-#ifndef HOSTNAME_INSTANCE
-#  define HOSTNAME_INSTANCE "localhost"
-#endif
-
-#ifndef KEYFILE
-#  define KEYFILE "id_rsa"
-#endif
-
-static struct build_info {
-    char *symbol;
-    char *value;
-} build_info[] = {
-    { "VERSION",                       "" },   /* must be [0] */
-    { "AMANDA_DEBUG_DAYS",             "" },   /* must be [1] */
-    { "TICKET_LIFETIME",               "" },   /* must be [2] */
-
-    { "bindir",                                bindir },
-    { "sbindir",                       sbindir },
-    { "libexecdir",                    libexecdir },
-    { "amlibexecdir",                  amlibexecdir },
-    { "mandir",                                mandir },
-    { "AMANDA_TMPDIR",                 AMANDA_TMPDIR },
-    { "CONFIG_DIR",                    CONFIG_DIR },
-#ifdef MAILER
-    { "MAILER",                                MAILER },
-#endif
-    { "DEFAULT_SERVER",                        DEFAULT_SERVER },
-    { "DEFAULT_CONFIG",                        DEFAULT_CONFIG },
-    { "DEFAULT_TAPE_SERVER",           DEFAULT_TAPE_SERVER },
-#ifdef DEFAULT_TAPE_DEVICE
-    { "DEFAULT_TAPE_DEVICE",           DEFAULT_TAPE_DEVICE },
-#endif
-    { "CLIENT_LOGIN",                  CLIENT_LOGIN },
-
-    { "BUILT_DATE",
-#if defined(BUILT_DATE)
-       BUILT_DATE
-#else
-       NULL
-#endif
-    },
-    { "BUILT_MACH",
-#if defined(BUILT_MACH)
-       BUILT_MACH
-#else
-       NULL
-#endif
-    },
-    { "CC",
-#if defined(CC)
-       CC
-#else
-       NULL
-#endif
-    },
-
-    { "AMANDA_DBGDIR",
-#if defined(AMANDA_DBGDIR)
-       AMANDA_DBGDIR
-#else
-       NULL
-#endif
-    },
-    { "DEV_PREFIX",
-#if defined(DEV_PREFIX)
-       DEV_PREFIX
-#else
-       NULL
-#endif
-    },
-    { "RDEV_PREFIX",
-#if defined(RDEV_PREFIX)
-       RDEV_PREFIX
-#else
-       NULL
-#endif
-    },
-    { "DUMP",
-#if defined(DUMP)
-       DUMP
-#else
-       NULL
-#endif
-    },
-    { "RESTORE",
-#if defined(DUMP)
-       RESTORE
-#else
-       NULL
-#endif
-    },
-    { "VDUMP",
-#if defined(VDUMP)
-       VDUMP
-#else
-       NULL
-#endif
-    },
-    { "VRESTORE",
-#if defined(VDUMP)
-       VRESTORE
-#else
-       NULL
-#endif
-    },
-    { "XFSDUMP",
-#if defined(XFSDUMP)
-       XFSDUMP
-#else
-       NULL
-#endif
-    },
-    { "XFSRESTORE",
-#if defined(XFSDUMP)
-       XFSRESTORE
-#else
-       NULL
-#endif
-    },
-    { "VXDUMP",
-#if defined(VXDUMP)
-       VXDUMP
-#else
-       NULL
-#endif
-    },
-    { "VXRESTORE",
-#if defined(VXDUMP)
-       VXRESTORE
-#else
-       NULL
-#endif
-    },
-    { "SAMBA_CLIENT",
-#if defined(SAMBA_CLIENT)
-       SAMBA_CLIENT
-#else
-       NULL
-#endif
-    },
-    { "GNUTAR",
-#if defined(GNUTAR)
-       GNUTAR
-#else
-       NULL
-#endif
-    },
-    { "COMPRESS_PATH",
-#if defined(COMPRESS_PATH)
-       COMPRESS_PATH
-#else
-       NULL
-#endif
-    },
-    { "UNCOMPRESS_PATH",
-#if defined(UNCOMPRESS_PATH)
-       UNCOMPRESS_PATH
-#else
-       NULL
-#endif
-    },
-    { "listed_incr_dir",
-#if defined(GNUTAR_LISTED_INCREMENTAL_DIR)
-       GNUTAR_LISTED_INCREMENTAL_DIR
-#else
-       NULL
-#endif
-    },
-    { "GNUTAR_LISTED_INCREMENTAL_DIR",
-#if defined(GNUTAR_LISTED_INCREMENTAL_DIR)
-       GNUTAR_LISTED_INCREMENTAL_DIR
-#else
-       NULL
-#endif
-    },
-
-    { "AIX_BACKUP",
-#if defined(AIX_BACKUP)
-       "1"
-#else
-       NULL
-#endif
-    },
-    { "DUMP_RETURNS_1",
-#if defined(DUMP_RETURNS_1)
-       "1"
-#else
-       NULL
-#endif
-    },
-
-    { "LOCKING",
-#if defined(USE_POSIX_FCNTL)
-       "POSIX_FCNTL"
-#elif defined(USE_FLOCK)
-       "FLOCK"
-#elif defined(USE_LOCKF)
-       "LOCKF"
-#elif defined(USE_LNLOCK)
-       "LNLOCK"
-#else
-       "NONE"
-#endif
-    },
-
-    { "STATFS_BSD",
-#if defined(STATFS_BSD)
-       "1"
-#else
-       NULL
-#endif
-    },
-    { "STATFS_OSF1",
-#if defined(STATFS_OSF1)
-       "1"
-#else
-       NULL
-#endif
-    },
-    { "STATFS_ULTRIX",
-#if defined(STATFS_ULTRIX)
-       "1"
-#else
-       NULL
-#endif
-    },
-    { "ASSERTIONS",
-#if defined(ASSERTIONS)
-       "1"
-#else
-       NULL
-#endif
-    },
-    { "BSD_SECURITY",
-#if defined(BSD_SECURITY)
-       "1"
-#else
-       NULL
-#endif
-    },
-    { "USE_AMANDAHOSTS",
-#if defined(USE_AMANDAHOSTS)
-       "1"
-#else
-       NULL
-#endif
-    },
-    { "USE_RUNDUMP",
-#if defined(USE_RUNDUMP)
-       "1"
-#else
-       NULL
-#endif
-    },
-    { "CHECK_USERID",
-#if defined(CHECK_USERID)
-       "1"
-#else
-       NULL
-#endif
-    },
-    { "USE_VERSION_SUFFIXES",
-#if defined(USE_VERSION_SUFFIXES)
-       "1"
-#else
-       NULL
-#endif
-    },
-    { "HAVE_GZIP",
-#if defined(HAVE_GZIP)
-       "1"
-#else
-       NULL
-#endif
-    },
-
-    { "KRB4_SECURITY",
-#if defined(KRB4_SECURITY)
-       "1"
-#else
-       NULL
-#endif
-    },
-    { "SERVER_HOST_PRINCIPAL",
-#if defined(KRB4_SECURITY)
-       SERVER_HOST_PRINCIPAL
-#else
-       NULL
-#endif
-    },
-    { "SERVER_HOST_PRINCIPLE", /* backward-compatibility (spelling error) */
-#if defined(KRB4_SECURITY)
-       SERVER_HOST_PRINCIPAL
-#else
-       NULL
-#endif
-    },
-    { "SERVER_HOST_INSTANCE",
-#if defined(KRB4_SECURITY)
-       SERVER_HOST_INSTANCE
-#else
-       NULL
-#endif
-    },
-    { "SERVER_HOST_KEY_FILE",
-#if defined(KRB4_SECURITY)
-       SERVER_HOST_KEY_FILE
-#else
-       NULL
-#endif
-    },
-    { "CLIENT_HOST_PRINCIPAL",
-#if defined(KRB4_SECURITY)
-       CLIENT_HOST_PRINCIPAL
-#else
-       NULL
-#endif
-    },
-    { "CLIENT_HOST_PRINCIPLE", /* backward-compatibility (spelling error) */
-#if defined(KRB4_SECURITY)
-       CLIENT_HOST_PRINCIPAL
-#else
-       NULL
-#endif
-    },
-    { "CLIENT_HOST_INSTANCE",
-#if defined(KRB4_SECURITY)
-       CLIENT_HOST_INSTANCE
-#else
-       NULL
-#endif
-    },
-    { "CLIENT_HOST_KEY_FILE",
-#if defined(KRB4_SECURITY)
-       CLIENT_HOST_KEY_FILE
-#else
-       NULL
-#endif
-    },
-
-    { "COMPRESS_SUFFIX",
-#if defined(COMPRESS_SUFFIX)
-       COMPRESS_SUFFIX
-#else
-       NULL
-#endif
-    },
-    { "COMPRESS_FAST_OPT",
-#if defined(COMPRESS_FAST_OPT)
-       COMPRESS_FAST_OPT
-#else
-       NULL
-#endif
-    },
-    { "COMPRESS_BEST_OPT",
-#if defined(COMPRESS_BEST_OPT)
-       COMPRESS_BEST_OPT
-#else
-       NULL
-#endif
-    },
-    { "UNCOMPRESS_OPT",
-#if defined(UNCOMPRESS_OPT)
-       UNCOMPRESS_OPT
-#else
-       NULL
-#endif
-    },
-
-    { NULL,                    NULL }
-};
-
-int
-main(
-    int                argc,
-    char **    argv)
-{
-    char *result = NULL;
-    char *pgm = NULL;
-    char *parmname = NULL;
-    int i;
-    int asklist;
-    char number[NUM_STR_SIZE];
-    int myarg;
-    config_overwrites_t *cfg_ovr = NULL;
-    char *cfg_opt = NULL;
-    gboolean cfg_ok;
-
-    /*
-     * Configure program for internationalization:
-     *   1) Only set the message locale for now.
-     *   2) Set textdomain for all amanda related programs to "amanda"
-     *      We don't want to be forced to support dozens of message catalogs.
-     */  
-    setlocale(LC_MESSAGES, "C");
-    textdomain("amanda"); 
-
-    safe_fd(-1, 0);
-
-    cfg_ovr = extract_commandline_config_overwrites(&argc, &argv);
-
-    if((pgm = strrchr(argv[0], '/')) == NULL) {
-       pgm = argv[0];
-    } else {
-       pgm++;
-    }
-    set_pname(pgm);
-
-    /* Don't die when child closes pipe */
-    signal(SIGPIPE, SIG_IGN);
-
-    if(argc < 2) {
-       g_fprintf(stderr, _("Usage: %s [config] [--list] <parmname> [-o configoption]*\n"), pgm);
-       exit(1);
-    }
-
-    asklist = 0;
-    myarg = 1;
-    if (strcmp(argv[1],"--list") == 0) {
-       asklist = 1;
-       myarg = 2;
-    } else if (argc > 2 && strcmp(argv[2],"--list") == 0) {
-       asklist = 1;
-       myarg = 3;
-    } else if (argc > 2) {
-       myarg = 2;
-    }
-
-    if (myarg > asklist + 1)
-       cfg_opt = argv[1];
-
-    if (myarg >= argc) {
-       error(_("Must specify a parameter"));
-    }
-    parmname = argv[myarg];
-
-    /* do the config_init() now, although the result isn't checked until the end,
-     * when we try to look up config parameters */
-    cfg_ok = config_init(CONFIG_INIT_EXPLICIT_NAME | CONFIG_INIT_USE_CWD, cfg_opt);
-    if (cfg_ok) apply_config_overwrites(cfg_ovr);
-
-    safe_cd(); /* call this *after* config_init() */
-
-    /* Note that we dont use check_running_as(..) here, because we may not have a configuration
-     * (e.g., when we're examining build parameters).  If folks run this as the wrong user, that's
-     * their own problem. */
-
-    /*
-     * Fill in the build values that need runtime help.
-     */
-    build_info[0].value = stralloc(version());
-#if defined(AMANDA_DEBUG_DAYS)
-    i = AMANDA_DEBUG_DAYS;
-#else
-    i = -1;
-#endif
-    g_snprintf(number, SIZEOF(number), "%ld", (long)i);
-    build_info[1].value = stralloc(number);
-#if defined(KRB4_SECURITY)
-    i = TICKET_LIFETIME;
-#else
-    i = -1;
-#endif
-    g_snprintf(number, SIZEOF(number), "%ld", (long)i);
-    build_info[2].value = stralloc(number);
-
-#undef p
-#define        p       "build."
-
-    if(strncmp(parmname, p, SIZEOF(p) - 1) == 0) {
-       char *s;
-       char *t;
-
-       t = stralloc(parmname + SIZEOF(p) - 1);
-       for(i = 0; (s = build_info[i].symbol) != NULL; i++) {
-           if(strcasecmp(s, t) == 0) {
-               break;
-           }
-       }
-       if(s == NULL) {
-           result = NULL;
-       } else {
-           result = build_info[i].value;
-           result = stralloc(result ? result : "");
-       }
-
-#undef p
-#define        p       "dbopen."
-
-    } else if(strncmp(parmname, p, SIZEOF(p) - 1) == 0) {
-       char *pname;
-       char *dbname;
-
-       if((pname = strrchr(parmname + SIZEOF(p) - 1, '/')) == NULL) {
-           pname = parmname + SIZEOF(p) - 1;
-       } else {
-           pname++;
-       }
-       set_pname(pname);
-       dbopen(DBG_SUBDIR_SERVER);
-       if((dbname = dbfn()) == NULL) {
-           result = stralloc("/dev/null");
-       } else {
-           result = stralloc(dbname);
-       }
-       /*
-        * Note that we deliberately do *not* call dbclose to prevent
-        * the end line from being added to the file.
-        */
-
-#undef p
-#define        p       "dbclose."
-
-    } else if(strncmp(parmname, p, SIZEOF(p) - 1) == 0) {
-       char *t;
-       char *pname;
-       char *dbname;
-
-       t = stralloc(parmname + SIZEOF(p) - 1);
-       if((dbname = strchr(t, ':')) == NULL) {
-           error(_("cannot parse %s"), parmname);
-           /*NOTREACHED*/
-       }
-       *dbname++ = '\0';
-       if((pname = strrchr(t, '/')) == NULL) {
-           pname = t;
-       } else {
-           pname++;
-       }
-       fflush(stderr);
-       set_pname(pname);
-       dbreopen(dbname, NULL);
-       dbclose();
-       result = stralloc(dbname);
-       amfree(t);
-
-    } else {
-       /* *now* we check the result of config_init */
-       if (!cfg_ok) {
-           if (cfg_opt) {
-               error(_("errors processing conf file \"%s\""), cfg_opt);
-               /*NOTREACHED*/
-           } else {
-               error(_("errors processing conf file in current directory."));
-               /*NOTREACHED*/
-           }
-       }
-
-       dbrename(config_name, DBG_SUBDIR_SERVER);
-       if (asklist) {
-           GSList *list = getconf_list(parmname);
-           GSList *iter;
-           result = stralloc("");
-
-           for (iter = list; iter != NULL; iter = iter->next) {
-               result = newvstralloc(result, result, iter->data, "\n", NULL);
-           }
-
-           g_slist_free(list);
-       } else {
-           val_t *val = getconf_byname(parmname);
-           if (val) {
-               char **dispstrs = val_t_display_strs(val, FALSE);
-               result = g_strjoinv("\n", dispstrs);
-               g_strfreev(dispstrs);
-           }
-       }
-    }
-
-    if (result == NULL) {
-       g_fprintf(stderr, _("%s: no such parameter \"%s\"\n"),
-               get_pname(), parmname);
-       fflush(stderr);
-    } else {
-       if (asklist)
-           fputs(result, stdout); /* don't add a '\n' */
-       else
-           puts(result); /* add a '\n' */
-    }
-
-    amfree(result);
-    for(i = 0; i < 3; i++) {
-       amfree(build_info[i].value);
-    }
-
-    return 0;
-}
index e6a5f6626f840c98fa58729c8be134eeb2fba503..c0e1ff8af62455466ff58f9c09a4f0b7a2c5e813 100644 (file)
@@ -208,6 +208,7 @@ static void holding_walk_file(
         /* and go on to the next chunk if this wasn't cruft */
        if (!is_cruft)
            filename = stralloc(file.cont_filename);
+       dumpfile_free_data(&file);
     }
 
     amfree(filename);
@@ -287,6 +288,7 @@ static void holding_walk_dir(
            holding_walk_file(hfile,
                    datap,
                    per_chunk_fn);
+       dumpfile_free_data(&dumpf);
     }
 
     closedir(dir);
@@ -497,6 +499,7 @@ holding_get_file_chunks(char *hfile)
 {
     holding_get_datap_t data;
     data.result = NULL;
+    data.fullpaths = 1;
 
     holding_walk_file(hfile, (gpointer)&data,
        holding_get_walk_fn);
@@ -523,8 +526,10 @@ holding_get_files_for_flush(
        if (!holding_file_get_dumpfile((char *)file_elt->data, &file))
            continue;
 
-        if (file.type != F_DUMPFILE)
+        if (file.type != F_DUMPFILE) {
+           dumpfile_free_data(&file);
             continue;
+       }
 
        if (dateargs) {
            date_matches = 0;
@@ -539,14 +544,17 @@ holding_get_files_for_flush(
            /* if no date list was provided, then all dates match */
            date_matches = 1;
        }
-        if (!date_matches)
+        if (!date_matches) {
+           dumpfile_free_data(&file);
             continue;
+       }
 
         /* check that the hostname and disk are in the disklist */
         dp = lookup_disk(file.name, file.disk);
         if (dp == NULL) {
            dbprintf(_("%s: disk %s:%s not in database, skipping it."),
                         (char *)file_elt->data, file.name, file.disk);
+           dumpfile_free_data(&file);
             continue;
         }
 
@@ -554,6 +562,7 @@ holding_get_files_for_flush(
         result_list = g_slist_insert_sorted(result_list, 
            stralloc(file_elt->data), 
            g_compare_strings);
+       dumpfile_free_data(&file);
     }
 
     if (file_list) g_slist_free_full(file_list);
@@ -579,6 +588,7 @@ holding_get_all_datestamps(void)
                                               stralloc(dfile.datestamp), 
                                               g_compare_strings);
        }
+       dumpfile_free_data(&dfile);
     }
 
     g_slist_free_full(all_files);
@@ -605,7 +615,8 @@ holding_file_size(
         /* stat the file for its size */
         if (stat(filename, &finfo) == -1) {
            dbprintf(_("stat %s: %s\n"), filename, strerror(errno));
-            return (off_t)-1;
+            size = -1;
+           break;
         }
         size += (finfo.st_size+(off_t)1023)/(off_t)1024;
         if (strip_headers)
@@ -614,12 +625,13 @@ holding_file_size(
         /* get the header to look for cont_filename */
         if (!holding_file_get_dumpfile(filename, &file)) {
            dbprintf(_("holding_file_size: open of %s failed.\n"), filename);
-            amfree(filename);
-            return (off_t)-1;
+            size = -1;
+           break;
         }
 
         /* on to the next chunk */
         filename = newstralloc(filename, file.cont_filename);
+       dumpfile_free_data(&file);
     }
     amfree(filename);
     return size;
@@ -662,7 +674,7 @@ holding_file_get_dumpfile(
     if((fd = robust_open(fname, O_RDONLY, 0)) == -1)
         return 0;
 
-    if(fullread(fd, buffer, SIZEOF(buffer)) != (ssize_t)sizeof(buffer)) {
+    if(full_read(fd, buffer, SIZEOF(buffer)) != sizeof(buffer)) {
         aclose(fd);
         return 0;
     }
@@ -764,6 +776,7 @@ holding_cleanup_file(
        if (data->verbose_output)
            g_fprintf(data->verbose_output, 
                _("Could not read read header from '%s'\n"), element);
+       dumpfile_free_data(&file);
        return 0;
     }
 
@@ -771,6 +784,7 @@ holding_cleanup_file(
        if (data->verbose_output)
            g_fprintf(data->verbose_output, 
                _("File '%s' is not a dump file\n"), element);
+       dumpfile_free_data(&file);
        return 0;
     }
 
@@ -778,6 +792,7 @@ holding_cleanup_file(
        if (data->verbose_output)
            g_fprintf(data->verbose_output, 
                _("File '%s' has invalid level %d\n"), element, file.dumplevel);
+       dumpfile_free_data(&file);
        return 0;
     }
 
@@ -788,6 +803,7 @@ holding_cleanup_file(
            g_fprintf(data->verbose_output, 
                _("File '%s' is for '%s:%s', which is not in the disklist\n"), 
                    element, file.name, file.disk);
+       dumpfile_free_data(&file);
        return 0;
     }
 
@@ -817,6 +833,7 @@ holding_cleanup_file(
        amfree(destname);
     }
 
+    dumpfile_free_data(&file);
     return 1;
 }
 
@@ -847,7 +864,7 @@ rename_tmp_holding(
     int                complete)
 {
     int fd;
-    ssize_t buflen;
+    size_t buflen;
     char buffer[DISK_BLOCK_BYTES];
     dumpfile_t file;
     char *filename;
@@ -863,7 +880,7 @@ rename_tmp_holding(
            amfree(filename_tmp);
            return 0;
        }
-       buflen = fullread(fd, buffer, SIZEOF(buffer));
+       buflen = full_read(fd, buffer, SIZEOF(buffer));
        close(fd);
 
        if(rename(filename_tmp, filename) != 0) {
@@ -883,6 +900,7 @@ rename_tmp_holding(
            if((fd = robust_open(filename, O_RDWR, 0)) == -1) {
                dbprintf(_("rename_tmp_holdingX: open of %s failed: %s\n"),
                        filename, strerror(errno));
+               dumpfile_free_data(&file);
                amfree(filename);
                amfree(filename_tmp);
                return 0;
@@ -890,10 +908,19 @@ rename_tmp_holding(
            }
            file.is_partial = 1;
             header = build_header(&file, DISK_BLOCK_BYTES);
-           fullwrite(fd, header, DISK_BLOCK_BYTES);
+           if (full_write(fd, header, DISK_BLOCK_BYTES) != DISK_BLOCK_BYTES) {
+               dbprintf(_("rename_tmp_holding: writing new header failed: %s"),
+                       strerror(errno));
+               dumpfile_free_data(&file);
+               amfree(filename);
+               amfree(filename_tmp);
+               close(fd);
+               return 0;
+           }
            close(fd);
        }
        filename = newstralloc(filename, file.cont_filename);
+       dumpfile_free_data(&file);
     }
     amfree(filename);
     amfree(filename_tmp);
index acebfd048aef6121c9b1a22d2e0e6ada61487ed4..8c465ac83fefd58e216884e49e7b66bec4426fbb 100644 (file)
@@ -110,7 +110,7 @@ holding_get_all_datestamps(void);
  * @param holding_file: full pathname of holding file
  * @param strip_headers: if true, don't count the headers in the
  * total size
- * @returns: total size of the holding file, or -1 in an error
+ * @returns: total size in kbytes of the holding file, or -1 in an error
  */
 off_t
 holding_file_size(char *holding_file,
index b7db7a89472eea3f835281c00c305fd9027906de..0c4d834d2e5105f7a275a848f9a1b28994d23306 100644 (file)
@@ -32,7 +32,7 @@
 #include "amanda.h"
 #include "conffile.h"
 #include "infofile.h"
-#include "token.h"
+#include "util.h"
 
 static void zero_info(info_t *);
 
index 03cc5f65858078c4d107ccfa10df48de2395eeac..488bdca5c3e05835f2a384d5f9ead82a45ffdfae 100644 (file)
@@ -52,7 +52,7 @@ char *logtype_str[] = {
 
 char *program_str[] = {
     "UNKNOWN", "planner", "driver", "amreport", "dumper", "chunker",
-    "taper", "amflush"
+    "taper", "amflush", "amdump", "amidxtaped", "amfetchdump", "amcheckdump"
 };
 
 int curlinenum;
@@ -129,7 +129,8 @@ printf_arglist_function1(void log_add, logtype_t, typ, char *, format)
     }
 
     arglist_start(argp, format);
-    g_vsnprintf(linebuf, SIZEOF(linebuf)-1, xlated_fmt, argp);
+    /* use sizeof(linebuf)-2 to save space for a trailing newline */
+    g_vsnprintf(linebuf, SIZEOF(linebuf)-2, xlated_fmt, argp);
                                                /* -1 to allow for '\n' */
     arglist_end(argp);
 
@@ -142,18 +143,19 @@ printf_arglist_function1(void log_add, logtype_t, typ, char *, format)
 
     if(multiline == -1) open_log();
 
-    if (fullwrite(logfd, leader, strlen(leader)) < 0) {
+    if (full_write(logfd, leader, strlen(leader)) < strlen(leader)) {
        error(_("log file write error: %s"), strerror(errno));
        /*NOTREACHED*/
     }
 
     amfree(leader);
 
+    /* add a newline if necessary */
     n = strlen(linebuf);
     if(n == 0 || linebuf[n-1] != '\n') linebuf[n++] = '\n';
     linebuf[n] = '\0';
 
-    if (fullwrite(logfd, linebuf, n) < 0) {
+    if (full_write(logfd, linebuf, n) < n) {
        error(_("log file write error: %s"), strerror(errno));
        /*NOTREACHED*/
     }
index 22fb5f6fe9c00e18674d8021c7747cb8f21c42c6..4a74583d765e1ed0ef6d0b948d505484bfd0753c 100644 (file)
@@ -56,9 +56,9 @@ typedef enum logtype_e {
 
 typedef enum program_e {
     P_UNKNOWN, P_PLANNER, P_DRIVER, P_REPORTER, P_DUMPER, P_CHUNKER,
-    P_TAPER, P_AMFLUSH
+    P_TAPER, P_AMFLUSH, P_AMDUMP, P_AMIDXTAPED, P_AMFETCHDUMP, P_AMCHECKDUMP,
 } program_t;
-#define P_LAST P_AMFLUSH
+#define P_LAST P_AMCHECKDUMP
 
 extern char *logtype_str[];
 
index 1c612e4f53e73146d587991403f5aa30aa74efe5..118d54e8b232956f3682661acedf6bf0a4e6c211 100644 (file)
@@ -24,7 +24,7 @@
  * file named AUTHORS, in the root directory of this distribution.
  */
 /*
- * $Id: planner.c,v 1.206 2006/08/10 23:57:27 paddy_s Exp $
+ * $Id: planner.c 10421 2008-03-06 18:48:30Z martineau $
  *
  * backup schedule planner for the Amanda backup system.
  */
@@ -44,6 +44,7 @@
 #include "server_util.h"
 #include "holding.h"
 #include "timestamp.h"
+#include "amxml.h"
 
 #define planner_debug(i,x) do {                \
        if ((i) <= debug_planner) {     \
@@ -61,7 +62,7 @@
 /* configuration file stuff */
 
 char * conf_tapetype;
-off_t  conf_maxdumpsize;
+gint64         conf_maxdumpsize;
 int    conf_runtapes;
 int    conf_dumpcycle;
 int    conf_runspercycle;
@@ -85,31 +86,33 @@ typedef struct est_s {
     int got_estimate;
     int dump_priority;
     int dump_level;
-    off_t dump_nsize;  /* native size */
-    off_t dump_csize;  /* compressed size */
+    gint64 dump_nsize; /* native size */
+    gint64 dump_csize; /* compressed size */
     int degr_level;    /* if dump_level == 0, what would be the inc level */
-    off_t degr_nsize;  /* native degraded size */
-    off_t degr_csize;  /* compressed degraded size */
+    gint64 degr_nsize; /* native degraded size */
+    gint64 degr_csize; /* compressed degraded size */
     int last_level;
-    off_t last_lev0size;
+    gint64 last_lev0size;
     int next_level0;
     int level_days;
     int promote;
+    int post_dle;
     double fullrate, incrrate;
     double fullcomp, incrcomp;
     char *errstr;
     int level[MAX_LEVELS];
     char *dumpdate[MAX_LEVELS];
-    off_t est_size[MAX_LEVELS];
+    gint64 est_size[MAX_LEVELS];
+    char *degr_mesg;
 } est_t;
 
 #define est(dp)        ((est_t *)(dp)->up)
 
 /* pestq = partial estimate */
 disklist_t startq, waitq, pestq, estq, failq, schedq;
-off_t total_size;
+gint64 total_size;
 double total_lev0, balanced_size, balance_threshold;
-off_t tape_length;
+gint64 tape_length;
 size_t tape_mark;
 
 tapetype_t *tape;
@@ -133,8 +136,8 @@ typedef struct bi_s {
     int deleted;               /* 0=modified, 1=deleted */
     disk_t *dp;                        /* The disk that was changed */
     int level;                 /* The original level */
-    off_t nsize;               /* The original native size */
-    off_t csize;               /* The original compressed size */
+    gint64 nsize;              /* The original native size */
+    gint64 csize;              /* The original compressed size */
     char *errstr;              /* A message describing why this disk is here */
 } bi_t;
 
@@ -169,7 +172,7 @@ main(
     disk_t *dp;
     int moved_one;
     int diskarg_offset;
-    off_t initial_size;
+    gint64 initial_size;
     int i;
     char *conf_diskfile;
     char *conf_tapelist;
@@ -180,6 +183,8 @@ main(
     char  *errstr = NULL;
     config_overwrites_t *cfg_ovr = NULL;
     char *cfg_opt = NULL;
+    int    planner_setuid;
+    int exit_status = EXIT_SUCCESS;
 
     /*
      * Configure program for internationalization:
@@ -191,9 +196,7 @@ main(
     textdomain("amanda"); 
 
     /* drop root privileges */
-    if (!set_root_privs(0)) {
-       error(_("planner must be run setuid root"));
-    }
+    planner_setuid = set_root_privs(0);
 
     safe_fd(-1, 0);
 
@@ -202,19 +205,15 @@ main(
     dbopen(DBG_SUBDIR_SERVER);
 
     cfg_ovr = extract_commandline_config_overwrites(&argc, &argv);
-
     if (argc > 1) 
        cfg_opt = argv[1];
 
-    config_init(CONFIG_INIT_EXPLICIT_NAME | CONFIG_INIT_USE_CWD | CONFIG_INIT_FATAL,
-               cfg_opt);
+    config_init(CONFIG_INIT_EXPLICIT_NAME | CONFIG_INIT_USE_CWD, cfg_opt);
     apply_config_overwrites(cfg_ovr);
 
-    safe_cd();
-
-    check_running_as(RUNNING_AS_DUMPUSER);
-
-    dbrename(config_name, DBG_SUBDIR_SERVER);
+    /* conf_diskfile is freed later, as it may be used in an error message */
+    conf_diskfile = config_dir_relative(getconf_str(CNF_DISKFILE));
+    read_diskfile(conf_diskfile, &origq);
 
     /* Don't die when child closes pipe */
     signal(SIGPIPE, SIG_IGN);
@@ -223,12 +222,28 @@ main(
 
     erroutput_type = (ERR_AMANDALOG|ERR_INTERACTIVE);
     set_logerror(logerror);
+
+    if (!planner_setuid) {
+       error(_("planner must be run setuid root"));
+    }
+
+    if (config_errors(NULL) >= CFGERR_ERRORS) {
+       g_critical(_("errors processing config file"));
+    }
+
+    safe_cd();
+
+    check_running_as(RUNNING_AS_DUMPUSER);
+
+    dbrename(get_config_name(), DBG_SUBDIR_SERVER);
+
     startclock();
     section_start = curclock();
 
     our_features = am_init_feature_set();
     our_feature_string = am_feature_to_string(our_features);
 
+    log_add(L_INFO, "%s pid %ld", get_pname(), (long)getpid());
     g_fprintf(stderr, _("%s: pid %ld executable %s version %s\n"),
            get_pname(), (long) getpid(), argv[0], version());
     for (i = 0; version_info[i] != NULL; i++)
@@ -256,11 +271,6 @@ main(
 
     g_fprintf(stderr,_("READING CONF INFO...\n"));
 
-    conf_diskfile = config_dir_relative(getconf_str(CNF_DISKFILE));
-    if (read_diskfile(conf_diskfile, &origq) < 0) {
-       error(_("could not load disklist \"%s\""), conf_diskfile);
-       /*NOTREACHED*/
-    }
     if(origq.head == NULL) {
        error(_("empty disklist \"%s\""), conf_diskfile);
        /*NOTREACHED*/
@@ -271,6 +281,7 @@ main(
     if (errstr) {
        g_fprintf(stderr,"%s",errstr);
        amfree(errstr);
+        exit_status = EXIT_FAILURE;
     }
     nb_disk = 0;
     for(dp = origq.head; dp != NULL; dp = dp->next) {
@@ -307,7 +318,7 @@ main(
     amfree(conf_infofile);
 
     conf_tapetype = getconf_str(CNF_TAPETYPE);
-    conf_maxdumpsize = getconf_am64(CNF_MAXDUMPSIZE);
+    conf_maxdumpsize = getconf_int64(CNF_MAXDUMPSIZE);
     conf_runtapes = getconf_int(CNF_RUNTAPES);
     conf_dumpcycle = getconf_int(CNF_DUMPCYCLE);
     conf_runspercycle = getconf_int(CNF_RUNSPERCYCLE);
@@ -356,11 +367,11 @@ main(
      }
     
     tape = lookup_tapetype(conf_tapetype);
-    if(conf_maxdumpsize > (off_t)0) {
-       tape_length = (off_t)conf_maxdumpsize;
+    if(conf_maxdumpsize > (gint64)0) {
+       tape_length = conf_maxdumpsize;
     }
     else {
-       tape_length = tapetype_get_length(tape) * (off_t)conf_runtapes;
+       tape_length = tapetype_get_length(tape) * (gint64)conf_runtapes;
     }
     tape_mark = (size_t)tapetype_get_filemark(tape);
     tt_blocksize_kb = (size_t)tapetype_get_blocksize(tape);
@@ -395,6 +406,7 @@ main(
                log_add(L_INFO, "%s: removing file with no data.",
                        (char *)holding_file->data);
                holding_file_unlink((char *)holding_file->data);
+               dumpfile_free_data(&file);
                continue;
            }
 
@@ -417,6 +429,7 @@ main(
                    qhname);
            amfree(qdisk);
            amfree(qhname);
+           dumpfile_free_data(&file);
        }
        g_slist_free_full(holding_list);
        holding_list = NULL;
@@ -483,6 +496,9 @@ main(
     dump_queue("FAILED", failq, 15, stderr);
     dump_queue("DONE", estq, 15, stderr);
 
+    if (!empty(failq)) {
+        exit_status = EXIT_FAILURE;
+    }
 
     /*
      * 6. Analyze Dump Estimates
@@ -497,7 +513,7 @@ main(
     section_start = curclock();
 
                        /* an empty tape still has a label and an endmark */
-    total_size = ((off_t)tt_blocksize_kb + (off_t)tape_mark) * (off_t)2;
+    total_size = ((gint64)tt_blocksize_kb + (gint64)tape_mark) * (gint64)2;
     total_lev0 = 0.0;
     balanced_size = 0.0;
 
@@ -598,12 +614,17 @@ main(
      */
 
     g_fprintf(stderr,_("\nGENERATING SCHEDULE:\n--------\n"));
-
-    while(!empty(schedq)) output_scheduleline(dequeue_disk(&schedq));
+    if (empty(schedq)) {
+        exit_status = EXIT_FAILURE;
+        g_fprintf(stderr, _("--> Generated empty schedule! <--\n"));
+    } else {
+        while(!empty(schedq)) output_scheduleline(dequeue_disk(&schedq));
+    }
     g_fprintf(stderr, _("--------\n"));
 
     close_infofile();
     log_add(L_FINISH, _("date %s time %s"), planner_timestamp, walltime_str(curclock()));
+    log_add(L_INFO, "pid-done %ld", (long)getpid());
 
     clear_tapelist();
     amfree(planner_timestamp);
@@ -613,7 +634,7 @@ main(
 
     dbclose();
 
-    return 0;
+    return exit_status;
 }
 
 
@@ -626,11 +647,11 @@ main(
 
 static void askfor(est_t *, int, int, info_t *);
 static int last_level(info_t *info);             /* subroutines */
-static off_t est_size(disk_t *dp, int level);
-static off_t est_tape_size(disk_t *dp, int level);
+static gint64 est_size(disk_t *dp, int level);
+static gint64 est_tape_size(disk_t *dp, int level);
 static int next_level0(disk_t *dp, info_t *info);
 static int runs_at(info_t *info, int lev);
-static off_t bump_thresh(int level, off_t size_level_0, int bumppercent, off_t bumpsize, double bumpmult);
+static gint64 bump_thresh(int level, gint64 size_level_0, int bumppercent, gint64 bumpsize, double bumpmult);
 static int when_overwrite(char *label);
 
 static void askfor(
@@ -653,7 +674,7 @@ static void askfor(
     if (lev == -1) {
        ep->level[seq] = -1;
        ep->dumpdate[seq] = (char *)0;
-       ep->est_size[seq] = (off_t)-2;
+       ep->est_size[seq] = (gint64)-2;
        return;
     }
 
@@ -661,7 +682,7 @@ static void askfor(
 
     ep->dumpdate[seq] = stralloc(get_dumpdate(info,lev));
 
-    ep->est_size[seq] = (off_t)-2;
+    ep->est_size[seq] = (gint64)-2;
 
     return;
 }
@@ -695,11 +716,13 @@ setup_estimate(
     ep = alloc(SIZEOF(est_t));
     dp->up = (void *) ep;
     ep->state = DISK_READY;
-    ep->dump_nsize = (off_t)-1;
-    ep->dump_csize = (off_t)-1;
+    ep->dump_nsize = (gint64)-1;
+    ep->dump_csize = (gint64)-1;
     ep->dump_priority = dp->priority;
     ep->errstr = 0;
     ep->promote = 0;
+    ep->post_dle = 0;
+    ep->degr_mesg = NULL;
 
     /* calculated fields */
 
@@ -732,6 +755,7 @@ setup_estimate(
            ep->next_level0 = next_level0(dp, &info);
        }
        else {
+           ep->degr_mesg = _("Can't switch to degraded mode when using a force-full disk");
            ep->last_level = -1;
            ep->next_level0 = -conf_dumpcycle;
            log_add(L_INFO, _("Forcing full dump of %s:%s as directed."),
@@ -929,6 +953,8 @@ setup_estimate(
 
     if(!dp->skip_incr && !(dp->strategy == DS_NOINC)) {
        if(ep->last_level == -1) {              /* a new disk */
+           if (ep->degr_mesg == NULL)
+               ep->degr_mesg = _("Can't switch to degraded mode when using a new disk");
            if(dp->strategy == DS_NOFULL || dp->strategy == DS_INCRONLY) {
                askfor(ep, i++, 1, &info);
            } else {
@@ -945,11 +971,13 @@ setup_estimate(
                }
                log_add(L_INFO,_("Preventing bump of %s:%s as directed."),
                        dp->host->hostname, qname);
+               ep->degr_mesg = _("Can't switch to degraded mode when using a force-no-bump disk");
            } else if (ISSET(info.command, FORCE_BUMP)
                       && curr_level + 1 < DUMP_LEVELS) {
                askfor(ep, i++, curr_level+1, &info);
                log_add(L_INFO,_("Bumping of %s:%s at level %d as directed."),
                        dp->host->hostname, qname, curr_level+1);
+               ep->degr_mesg = _("Can't switch to degraded mode when using a force-bump disk");
            } else if (curr_level == 0) {
                askfor(ep, i++, 1, &info);
            } else {
@@ -961,7 +989,7 @@ setup_estimate(
                 * if we haven't been at this level 2 days, or the dump failed
                 * last night, we can't bump.
                 */
-               if((info.inf[curr_level].size == (off_t)0 || /* no data, try it anyway */
+               if((info.inf[curr_level].size == (gint64)0 || /* no data, try it anyway */
                    (((info.inf[curr_level].size > bump_thresh(curr_level, info.inf[0].size,dp->bumppercent, dp->bumpsize, dp->bumpmult)))
                     && ep->level_days >= dp->bumpdays))
                   && curr_level + 1 < DUMP_LEVELS) {
@@ -1014,7 +1042,7 @@ static int when_overwrite(
 }
 
 /* Return the estimated size for a particular dump */
-static off_t est_size(
+static gint64 est_size(
     disk_t *dp,
     int level)
 {
@@ -1024,20 +1052,20 @@ static off_t est_size(
        if(level == est(dp)->level[i])
            return est(dp)->est_size[i];
     }
-    return (off_t)-1;
+    return (gint64)-1;
 }
 
 /* Return the estimated on-tape size of a particular dump */
-static off_t est_tape_size(
+static gint64 est_tape_size(
     disk_t *dp,
     int level)
 {
-    off_t size;
+    gint64 size;
     double ratio;
 
     size = est_size(dp, level);
 
-    if(size == (off_t)-1) return size;
+    if(size == (gint64)-1) return size;
 
     if(dp->compress == COMP_NONE)
        return size;
@@ -1056,15 +1084,15 @@ static off_t est_tape_size(
 
     if(ratio > 1.1) ratio = 1.1;
 
-    size = (off_t)((double)size * ratio);
+    size = (gint64)((double)size * ratio);
 
     /*
      * Ratio can be very small in some error situations, so make sure
      * size goes back greater than zero.  It may not be right, but
      * indicates we did get an estimate.
      */
-    if(size <= (off_t)0) {
-       size = (off_t)1;
+    if(size <= (gint64)0) {
+       size = (gint64)1;
     }
 
     return size;
@@ -1158,16 +1186,16 @@ static int runs_at(
 }
 
 
-static off_t bump_thresh(
+static gint64 bump_thresh(
     int level,
-    off_t size_level_0,
+    gint64 size_level_0,
     int bumppercent,
-    off_t bumpsize,
+    gint64 bumpsize,
     double bumpmult)
 {
     double bump;
 
-    if ((bumppercent != 0) && (size_level_0 > (off_t)1024)) {
+    if ((bumppercent != 0) && (size_level_0 > (gint64)1024)) {
        bump = ((double)size_level_0 * (double)bumppercent) / 100.0;
     }
     else {
@@ -1175,7 +1203,7 @@ static off_t bump_thresh(
     }
     while(--level) bump = bump * bumpmult;
 
-    return (off_t)bump;
+    return (gint64)bump;
 }
 
 
@@ -1194,7 +1222,7 @@ static void handle_result(void *datap, pkt_t *pkt, security_handle_t *sech);
 static void get_estimates(void)
 {
     am_host_t *hostp;
-    disk_t *dp;
+    disk_t *dp, *dp1;
     int something_started;
 
     something_started = 1;
@@ -1204,6 +1232,18 @@ static void get_estimates(void)
            hostp = dp->host;
            if(hostp->up == HOST_READY) {
                something_started = 1;
+               for(dp1 = hostp->disks; dp1 != NULL; dp1 = dp1->hostnext) {
+                   if (dp1->todo)
+                       run_server_scripts(EXECUTE_ON_PRE_HOST_ESTIMATE,
+                                          get_config_name(), dp1,
+                                          est(dp1)->level[0]);
+               }
+               for(dp1 = hostp->disks; dp1 != NULL; dp1 = dp1->hostnext) {
+                   if (dp1->todo)
+                       run_server_scripts(EXECUTE_ON_PRE_DLE_ESTIMATE,
+                                          get_config_name(), dp1,
+                                          est(dp1)->level[0]);
+               }
                getsize(hostp);
                protocol_check();
                /*
@@ -1226,8 +1266,8 @@ static void get_estimates(void)
        disk_t *dp = dequeue_disk(&pestq);
        char *  qname = quote_string(dp->name);
        
-       if(est(dp)->level[0] != -1 && est(dp)->est_size[0] < (off_t)0) {
-           if(est(dp)->est_size[0] == (off_t)-1) {
+       if(est(dp)->level[0] != -1 && est(dp)->est_size[0] < (gint64)0) {
+           if(est(dp)->est_size[0] == (gint64)-1) {
                log_add(L_WARNING, _("disk %s:%s, estimate of level %d failed."),
                        dp->host->hostname, qname, est(dp)->level[0]);
            }
@@ -1239,8 +1279,8 @@ static void get_estimates(void)
            est(dp)->level[0] = -1;
        }
 
-       if(est(dp)->level[1] != -1 && est(dp)->est_size[1] < (off_t)0) {
-           if(est(dp)->est_size[1] == (off_t)-1) {
+       if(est(dp)->level[1] != -1 && est(dp)->est_size[1] < (gint64)0) {
+           if(est(dp)->est_size[1] == (gint64)-1) {
                log_add(L_WARNING,
                        _("disk %s:%s, estimate of level %d failed."),
                        dp->host->hostname, qname, est(dp)->level[1]);
@@ -1253,8 +1293,8 @@ static void get_estimates(void)
            est(dp)->level[1] = -1;
        }
 
-       if(est(dp)->level[2] != -1 && est(dp)->est_size[2] < (off_t)0) {
-           if(est(dp)->est_size[2] == (off_t)-1) {
+       if(est(dp)->level[2] != -1 && est(dp)->est_size[2] < (gint64)0) {
+           if(est(dp)->est_size[2] == (gint64)-1) {
                log_add(L_WARNING,
                        _("disk %s:%s, estimate of level %d failed."),
                        dp->host->hostname, qname, est(dp)->level[2]);
@@ -1267,9 +1307,9 @@ static void get_estimates(void)
            est(dp)->level[2] = -1;
        }
 
-       if((est(dp)->level[0] != -1 && est(dp)->est_size[0] > (off_t)0) ||
-          (est(dp)->level[1] != -1 && est(dp)->est_size[1] > (off_t)0) ||
-          (est(dp)->level[2] != -1 && est(dp)->est_size[2] > (off_t)0)) {
+       if((est(dp)->level[0] != -1 && est(dp)->est_size[0] > (gint64)0) ||
+          (est(dp)->level[1] != -1 && est(dp)->est_size[1] > (gint64)0) ||
+          (est(dp)->level[2] != -1 && est(dp)->est_size[2] > (gint64)0)) {
            enqueue_disk(&estq, dp);
        }
        else {
@@ -1290,10 +1330,9 @@ static void getsize(
     time_t     estimates, timeout;
     size_t     req_len;
     const      security_driver_t *secdrv;
-    char *     backup_api;
     char *     calcsize;
-    char *     qname;
-    char *     qdevice;
+    char *     qname, *b64disk = NULL;
+    char *     qdevice, *b64device = NULL;
 
     assert(hostp->disks != NULL);
 
@@ -1334,7 +1373,7 @@ static void getsize(
                        has_hostname ? hostp->hostname : "",
                        has_hostname ? ";" : "",
                        has_config   ? "config=" : "",
-                       has_config   ? config_name : "",
+                       has_config   ? get_config_name() : "",
                        has_config   ? ";" : "",
                        "\n",
                        NULL);
@@ -1356,113 +1395,201 @@ static void getsize(
            }
 
            qname = quote_string(dp->name);
+           b64disk = amxml_format_tag("disk", dp->name);
            qdevice = quote_string(dp->device);
-           if(dp->estimate == ES_CLIENT ||
-              dp->estimate == ES_CALCSIZE) {
+           if (dp->device)
+               b64device = amxml_format_tag("diskdevice", dp->device);
+           if (dp->estimate == ES_CLIENT ||
+               dp->estimate == ES_CALCSIZE ||
+               (am_has_feature(hostp->features, fe_req_xml) &&
+                am_has_feature(hostp->features, fe_xml_estimate))) {
                nb_client++;
+               i = 0;
 
-               for(i = 0; i < MAX_LEVELS; i++) {
-                   char *l;
-                   char *exclude1 = "";
-                   char *exclude2 = "";
-                   char *excludefree = NULL;
-                   char *include1 = "";
-                   char *include2 = "";
-                   char *includefree = NULL;
-                   char spindle[NUM_STR_SIZE];
+               if (am_has_feature(hostp->features, fe_req_xml)) {
+                   char *levelstr = NULL;
+                   char *spindlestr = NULL;
                    char level[NUM_STR_SIZE];
-                   int lev = est(dp)->level[i];
-
-                   if(lev == -1) break;
+                   char spindle[NUM_STR_SIZE];
+                   char *o;
+                   char *l;
 
-                   g_snprintf(level, SIZEOF(level), "%d", lev);
+                   for(i = 0; i < MAX_LEVELS; i++) {
+                       int lev = est(dp)->level[i];
+                       if (lev == -1) break;
+                       g_snprintf(level, SIZEOF(level), "%d", lev);
+                       vstrextend(&levelstr, "  <level>",
+                                  level,
+                                  "</level>\n", NULL);
+                   }
                    g_snprintf(spindle, SIZEOF(spindle), "%d", dp->spindle);
-                   if(am_has_feature(hostp->features,fe_sendsize_req_options)){
-                       exclude1 = " OPTIONS |";
-                       exclude2 = optionstr(dp, hostp->features, NULL);
-                       if ( exclude2 == NULL ) {
-                         error(_("problem with option string, check the dumptype definition.\n"));
-                       }
-                       excludefree = exclude2;
-                       includefree = NULL;
+                   spindlestr = vstralloc("  <spindle>",
+                                          spindle,
+                                          "</spindle>\n", NULL);
+                   o = xml_optionstr(dp, hostp->features, NULL, 0);
+                   if (o == NULL) {
+                       error(_("problem with option string, check the dumptype definition.\n"));
                    }
-                   else {
-                       if(dp->exclude_file &&
-                          dp->exclude_file->nb_element == 1) {
-                           exclude1 = " exclude-file=";
-                           exclude2 =
-                               quote_string(dp->exclude_file->first->name);
-                           excludefree = exclude2;
-                       }
-                       else if(dp->exclude_list &&
-                               dp->exclude_list->nb_element == 1) {
-                           exclude1 = " exclude-list=";
-                           exclude2 =
-                               quote_string(dp->exclude_list->first->name);
-                           excludefree = exclude2;
-                       }
-                       if(dp->include_file &&
-                          dp->include_file->nb_element == 1) {
-                           include1 = " include-file=";
-                           include2 =
-                               quote_string(dp->include_file->first->name);
-                           includefree = include2;
-                       }
-                       else if(dp->include_list &&
-                               dp->include_list->nb_element == 1) {
-                           include1 = " include-list=";
-                           include2 =
-                               quote_string(dp->include_list->first->name);
-                           includefree = include2;
+                   
+                   if (strcmp(dp->program,"DUMP") == 0 ||
+                       strcmp(dp->program,"GNUTAR") == 0) {
+                       l = vstralloc("<dle>\n",
+                                     "  <program>",
+                                     dp->program,
+                                     "</program>\n", NULL);
+                   } else {
+                       l = vstralloc("<dle>\n",
+                                     "  <program>APPLICATION</program>\n",
+                                     NULL);
+                       if (dp->application) {
+                           char *xml_app = xml_application(dp->application,
+                                                           hostp->features);
+                           vstrextend(&l, xml_app, NULL);
+                           amfree(xml_app);
                        }
                    }
 
-                   if(dp->estimate == ES_CALCSIZE &&
-                      !am_has_feature(hostp->features, fe_calcsize_estimate)) {
-                       log_add(L_WARNING,_("%s:%s does not support CALCSIZE for estimate, using CLIENT.\n"),
-                               hostp->hostname, qname);
-                       dp->estimate = ES_CLIENT;
+                   if (am_has_feature(hostp->features, fe_xml_estimate)) {
+                       if (dp->estimate == ES_CLIENT) {
+                           vstrextend(&l, "  <estimate>CLIENT</estimate>\n",
+                                      NULL);
+                       } else if (dp->estimate == ES_SERVER) {
+                           vstrextend(&l, "  <estimate>SERVER</estimate>\n",
+                                      NULL);
+                       } else if (dp->estimate == ES_CALCSIZE) {
+                           vstrextend(&l, "  <estimate>CALCSIZE</estimate>\n",
+                                      NULL);
+                       }
                    }
-                   if(dp->estimate == ES_CLIENT)
-                       calcsize = "";
-                   else
-                       calcsize = "CALCSIZE ";
-
-                   if(strcmp(dp->program,"DUMP") == 0 || 
-                      strcmp(dp->program,"GNUTAR") == 0) {
-                       backup_api = "";
-                   } else {
-                       backup_api = "BACKUP ";
+                   if (dp->estimate == ES_CALCSIZE) {
+                       if (!am_has_feature(hostp->features,
+                                           fe_calcsize_estimate)) {
+                           log_add(L_WARNING,
+                                   _("%s:%s does not support CALCSIZE for estimate, using CLIENT.\n"),
+                                   hostp->hostname, qname);
+                           dp->estimate = ES_CLIENT;
+                       } else {
+                           vstrextend(&l, "  <calcsize>YES</calcsize>\n",
+                                      NULL);
+                       }
                    }
-                   l = vstralloc(calcsize,
-                                 backup_api,
-                                 dp->program,
-                                 " ", qname,
-                                 " ", dp->device ? qdevice : "",
-                                 " ", level,
-                                 " ", est(dp)->dumpdate[i],
-                                 " ", spindle,
-                                 " ", exclude1, exclude2,
-                                 ((includefree != NULL) ? " " : ""),
-                                   include1, include2,
-                                 "\n",
-                                 NULL);
+                   vstrextend(&l, "  ", b64disk, "\n", NULL);
+                   if (dp->device)
+                       vstrextend(&l, "  ", b64device, "\n", NULL);
+                   vstrextend(&l, levelstr, spindlestr, o, "</dle>\n", NULL);
                    strappend(s, l);
                    s_len += strlen(l);
                    amfree(l);
-                   amfree(includefree);
-                   amfree(excludefree);
+               } else if (strcmp(dp->program,"DUMP") != 0 &&
+                          strcmp(dp->program,"GNUTAR") != 0) {
+                   est(dp)->errstr = newvstrallocf(est(dp)->errstr,
+                                       _("does not support application-api"));
+               } else {
+                   for(i = 0; i < MAX_LEVELS; i++) {
+                       char *l;
+                       char *exclude1 = "";
+                       char *exclude2 = "";
+                       char *excludefree = NULL;
+                       char *include1 = "";
+                       char *include2 = "";
+                       char *includefree = NULL;
+                       char spindle[NUM_STR_SIZE];
+                       char level[NUM_STR_SIZE];
+                       int lev = est(dp)->level[i];
+
+                       if(lev == -1) break;
+
+                       g_snprintf(level, SIZEOF(level), "%d", lev);
+                       g_snprintf(spindle, SIZEOF(spindle), "%d", dp->spindle);
+                       if (am_has_feature(hostp->features,
+                                          fe_sendsize_req_options)){
+                           exclude1 = " OPTIONS |";
+                           exclude2 = optionstr(dp, hostp->features, NULL);
+                           if ( exclude2 == NULL ) {
+                               error(_("problem with option string, check the dumptype definition.\n"));
+                           }
+                           excludefree = exclude2;
+                           includefree = NULL;
+                       } else {
+                           if (dp->exclude_file &&
+                               dp->exclude_file->nb_element == 1) {
+                               exclude1 = " exclude-file=";
+                               exclude2 = quote_string(
+                                               dp->exclude_file->first->name);
+                               excludefree = exclude2;
+                           }
+                           else if (dp->exclude_list &&
+                                    dp->exclude_list->nb_element == 1) {
+                               exclude1 = " exclude-list=";
+                               exclude2 = quote_string(
+                                               dp->exclude_list->first->name);
+                               excludefree = exclude2;
+                           }
+                           if (dp->include_file &&
+                               dp->include_file->nb_element == 1) {
+                               include1 = " include-file=";
+                               include2 = quote_string(
+                                               dp->include_file->first->name);
+                               includefree = include2;
+                           }
+                           else if (dp->include_list &&
+                                    dp->include_list->nb_element == 1) {
+                               include1 = " include-list=";
+                               include2 = quote_string(
+                                               dp->include_list->first->name);
+                               includefree = include2;
+                           }
+                       }
+
+                       if (dp->estimate == ES_CALCSIZE &&
+                           !am_has_feature(hostp->features,
+                                           fe_calcsize_estimate)) {
+                           log_add(L_WARNING,
+                                   _("%s:%s does not support CALCSIZE for estimate, using CLIENT.\n"),
+                                   hostp->hostname, qname);
+                           dp->estimate = ES_CLIENT;
+                       }
+                       if(dp->estimate == ES_CLIENT)
+                           calcsize = "";
+                       else
+                           calcsize = "CALCSIZE ";
+
+                       l = vstralloc(calcsize,
+                                     dp->program,
+                                     " ", qname,
+                                     " ", dp->device ? qdevice : "",
+                                     " ", level,
+                                     " ", est(dp)->dumpdate[i],
+                                     " ", spindle,
+                                     " ", exclude1, exclude2,
+                                     ((includefree != NULL) ? " " : ""),
+                                       include1, include2,
+                                     "\n",
+                                     NULL);
+                       strappend(s, l);
+                       s_len += strlen(l);
+                       amfree(l);
+                       amfree(includefree);
+                       amfree(excludefree);
+                   }
                }
+               remove_disk(&startq, dp);
                if (s != NULL) {
                    estimates += i;
                    strappend(req, s);
                    req_len += s_len;
                    amfree(s);
+                   est(dp)->state = DISK_ACTIVE;
+               } else {
+                   est(dp)->state = DISK_DONE;
+                   if (est(dp)->errstr == NULL) {
+                       est(dp)->errstr = vstrallocf(
+                                               _("Can't request estimate"));
+                   }
+                   enqueue_disk(&failq, dp);
                }
-               est(dp)->state = DISK_ACTIVE;
-               remove_disk(&startq, dp);
            }
-           else if (dp->estimate == ES_SERVER) {
+           if (dp->estimate == ES_SERVER) {
                info_t info;
                nb_server++;
                get_info(dp->host->hostname, dp->name, &info);
@@ -1472,12 +1599,12 @@ static void getsize(
 
                    if(lev == -1) break;
                    if(lev == 0) { /* use latest level 0, should do extrapolation */
-                       off_t est_size = (off_t)0;
+                       gint64 est_size = (gint64)0;
                        int nb_est = 0;
 
                        for(j=NB_HISTORY-2;j>=0;j--) {
                            if(info.history[j].level == 0) {
-                               if(info.history[j].size < (off_t)0) continue;
+                               if(info.history[j].size < (gint64)0) continue;
                                est_size = info.history[j].size;
                                nb_est++;
                            }
@@ -1485,27 +1612,27 @@ static void getsize(
                        if(nb_est > 0) {
                            est(dp)->est_size[i] = est_size;
                        }
-                       else if(info.inf[lev].size > (off_t)1000) { /* stats */
+                       else if(info.inf[lev].size > (gint64)1000) { /* stats */
                            est(dp)->est_size[i] = info.inf[lev].size;
                        }
                        else {
-                           est(dp)->est_size[i] = (off_t)1000000;
+                           est(dp)->est_size[i] = (gint64)1000000;
                        }
                    }
                    else if(lev == est(dp)->last_level) {
                        /* means of all X day at the same level */
                        #define NB_DAY 30
                        int nb_day = 0;
-                       off_t est_size_day[NB_DAY];
+                       gint64 est_size_day[NB_DAY];
                        int nb_est_day[NB_DAY];
                        for(j=0;j<NB_DAY;j++) {
-                           est_size_day[j]=(off_t)0;
+                           est_size_day[j]=(gint64)0;
                            nb_est_day[j]=0;
                        }
 
                        for(j=NB_HISTORY-2;j>=0;j--) {
                            if(info.history[j].level <= 0) continue;
-                           if(info.history[j].size < (off_t)0) continue;
+                           if(info.history[j].size < (gint64)0) continue;
                            if(info.history[j].level==info.history[j+1].level) {
                                if(nb_day <NB_DAY-1) nb_day++;
                                est_size_day[nb_day] += info.history[j].size;
@@ -1522,36 +1649,36 @@ static void getsize(
 
                        if(nb_est_day[nb_day] > 0) {
                            est(dp)->est_size[i] = est_size_day[nb_day] /
-                                       (off_t)nb_est_day[nb_day];
+                                       (gint64)nb_est_day[nb_day];
                        }
-                       else if(info.inf[lev].size > (off_t)1000) { /* stats */
+                       else if(info.inf[lev].size > (gint64)1000) { /* stats */
                            est(dp)->est_size[i] = info.inf[lev].size;
                        }
                        else {
-                           est(dp)->est_size[i] = (off_t)10000;
+                           est(dp)->est_size[i] = (gint64)10000;
                        }
                    }
                    else if(lev == est(dp)->last_level + 1) {
                        /* means of all first day at a new level */
-                       off_t est_size = (off_t)0;
+                       gint64 est_size = (gint64)0;
                        int nb_est = 0;
 
                        for(j=NB_HISTORY-2;j>=0;j--) {
                            if(info.history[j].level <= 0) continue;
-                           if(info.history[j].size < (off_t)0) continue;
+                           if(info.history[j].size < (gint64)0) continue;
                            if(info.history[j].level == info.history[j+1].level + 1 ) {
                                est_size += info.history[j].size;
                                nb_est++;
                            }
                        }
                        if(nb_est > 0) {
-                           est(dp)->est_size[i] = est_size / (off_t)nb_est;
+                           est(dp)->est_size[i] = est_size / (gint64)nb_est;
                        }
-                       else if(info.inf[lev].size > (off_t)1000) { /* stats */
+                       else if(info.inf[lev].size > (gint64)1000) { /* stats */
                            est(dp)->est_size[i] = info.inf[lev].size;
                        }
                        else {
-                           est(dp)->est_size[i] = (off_t)100000;
+                           est(dp)->est_size[i] = (gint64)100000;
                        }
                    }
                }
@@ -1562,9 +1689,11 @@ static void getsize(
                        est(dp)->level[0], (long long)est(dp)->est_size[0],
                        est(dp)->level[1], (long long)est(dp)->est_size[1],
                        est(dp)->level[2], (long long)est(dp)->est_size[2]);
-               est(dp)->state = DISK_DONE;
-               remove_disk(&startq, dp);
-               enqueue_disk(&estq, dp);
+               if (!am_has_feature(hostp->features, fe_xml_estimate)) {
+                   est(dp)->state = DISK_DONE;
+                   remove_disk(&startq, dp);
+                   enqueue_disk(&estq, dp);
+               }
            }
            amfree(qname);
            amfree(qdevice);
@@ -1640,7 +1769,7 @@ static void handle_result(
     security_handle_t *sech)
 {
     int level, i;
-    off_t size;
+    gint64 size;
     disk_t *dp;
     am_host_t *hostp;
     char *msg, msg_undo;
@@ -1692,7 +1821,7 @@ static void handle_result(
 
        if(strncmp_const(line, "OPTIONS ") == 0) {
            t = strstr(line, "features=");
-           if(t != NULL && (isspace((int)t[-1]) || t[-1] == ';')) {
+           if(t != NULL && (g_ascii_isspace((int)t[-1]) || t[-1] == ';')) {
                t += SIZEOF("features=")-1;
                am_release_feature_set(hostp->features);
                if((hostp->features = am_string_to_feature(t)) == NULL) {
@@ -1706,7 +1835,8 @@ static void handle_result(
        }
 
        t = line;
-       if(strncmp_const_skip(t, "ERROR ", t, tch) == 0) {
+       if ((strncmp_const_skip(t, "ERROR ", t, tch) == 0) ||
+           (strncmp_const_skip(t, "WARNING ", t, tch) == 0)) { 
            fp = t - 1;
            skip_whitespace(t, tch);
            if (tch == '\n') {
@@ -1725,6 +1855,9 @@ static void handle_result(
                skip_quoted_line(s, ch);
                continue;
            }
+           t = index(t,'\n');
+           if (t) /* truncate after the first line */
+                *t = '\0';
            errbuf = vstralloc(hostp->hostname,
                                   (pkt->type == P_NAK) ? "NAK " : "",
                                   ": ",
@@ -1756,20 +1889,21 @@ static void handle_result(
            goto bad_msg;
        }
 
-       size = (off_t)-1;
+       size = (gint64)-1;
        if (strncmp_const(t-1,"SIZE ") == 0) {
            if (sscanf(t - 1, "SIZE %lld", &size_) != 1) {
                goto bad_msg;
            }
-           size = (off_t)size_;
-       } else if (strncmp_const(t-1,"ERROR ") == 0) {
+           size = (gint64)size_;
+       } else if ((strncmp_const(t-1,"ERROR ") == 0) ||
+                  (strncmp_const(t-1,"WARNING ") == 0)) {
            skip_non_whitespace(t, tch);
            skip_whitespace(t, tch);
            msg = t-1;
            skip_quoted_string(t,tch);
            msg_undo = t[-1];
            t[-1] = '\0';
-           if (pkt->type == P_REP) {
+           if (pkt->type == P_REP && !est(dp)->errstr) {
                est(dp)->errstr = unquote_string(msg);
            }
            t[-1] = msg_undo;
@@ -1779,7 +1913,21 @@ static void handle_result(
 
        amfree(disk);
 
-       if (size > (off_t)-1) {
+       if (dp->estimate == ES_SERVER) {
+           if (size == (gint64)-2) {
+               for(i = 0; i < MAX_LEVELS; i++) {
+                   if (est(dp)->level[i] == level) {
+                       est(dp)->est_size[i] = -1; /* remove estimate */
+                       break;
+                   }
+               }
+               if(i == MAX_LEVELS) {
+                   goto bad_msg;               /* this est wasn't requested */
+               }
+
+           }
+           est(dp)->got_estimate++;
+       } else if (size > (gint64)-1) {
            for(i = 0; i < MAX_LEVELS; i++) {
                if(est(dp)->level[i] == level) {
                    est(dp)->est_size[i] = size;
@@ -1851,24 +1999,24 @@ static void handle_result(
                        est(dp)->level[0], (long long)est(dp)->est_size[0],
                        est(dp)->level[1], (long long)est(dp)->est_size[1],
                        est(dp)->level[2], (long long)est(dp)->est_size[2]);
-               if((est(dp)->level[0] != -1 && est(dp)->est_size[0] > (off_t)0) ||
-                  (est(dp)->level[1] != -1 && est(dp)->est_size[1] > (off_t)0) ||
-                  (est(dp)->level[2] != -1 && est(dp)->est_size[2] > (off_t)0)) {
+               if((est(dp)->level[0] != -1 && est(dp)->est_size[0] > (gint64)0) ||
+                  (est(dp)->level[1] != -1 && est(dp)->est_size[1] > (gint64)0) ||
+                  (est(dp)->level[2] != -1 && est(dp)->est_size[2] > (gint64)0)) {
 
-                   if(est(dp)->level[2] != -1 && est(dp)->est_size[2] < (off_t)0) {
+                   if(est(dp)->level[2] != -1 && est(dp)->est_size[2] < (gint64)0) {
                        log_add(L_WARNING,
                                _("disk %s:%s, estimate of level %d failed."),
                                dp->host->hostname, qname, est(dp)->level[2]);
                        est(dp)->level[2] = -1;
                    }
-                   if(est(dp)->level[1] != -1 && est(dp)->est_size[1] < (off_t)0) {
+                   if(est(dp)->level[1] != -1 && est(dp)->est_size[1] < (gint64)0) {
                        log_add(L_WARNING,
                                _("disk %s:%s, estimate of level %d failed."),
                                dp->host->hostname, qname,
                                est(dp)->level[1]);
                        est(dp)->level[1] = -1;
                    }
-                   if(est(dp)->level[0] != -1 && est(dp)->est_size[0] < (off_t)0) {
+                   if(est(dp)->level[0] != -1 && est(dp)->est_size[0] < (gint64)0) {
                        log_add(L_WARNING,
                                _("disk %s:%s, estimate of level %d failed."),
                                dp->host->hostname, qname, est(dp)->level[0]);
@@ -1892,9 +2040,30 @@ static void handle_result(
                    }
                }
            }
+           hostp->up = HOST_DONE;
+       }
+       if (est(dp)->post_dle == 0 &&
+           (pkt->type == P_REP ||
+            ((est(dp)->level[0] == -1 || est(dp)->est_size[0] > (gint64)0) &&
+             (est(dp)->level[1] == -1 || est(dp)->est_size[1] > (gint64)0) &&
+             (est(dp)->level[2] == -1 || est(dp)->est_size[2] > (gint64)0)))) {
+           run_server_scripts(EXECUTE_ON_POST_DLE_ESTIMATE,
+                              get_config_name(), dp, est(dp)->level[0]);
+           est(dp)->post_dle = 1;
        }
        amfree(qname);
     }
+
+    if(hostp->up == HOST_DONE) {
+       for(dp = hostp->disks; dp != NULL; dp = dp->hostnext) {
+           if (dp->todo)
+               if (pkt->type == P_REP) {
+                   run_server_scripts(EXECUTE_ON_POST_HOST_ESTIMATE,
+                                      get_config_name(), dp, est(dp)->level[0]);
+           }
+       }
+    }
+
     getsize(hostp);
     /* try to clean up any defunct processes, since Amanda doesn't wait() for
        them explicitly */
@@ -1979,8 +2148,8 @@ static void analyze_estimate(
     }
 
     ep->degr_level = -1;
-    ep->degr_nsize = (off_t)-1;
-    ep->degr_csize = (off_t)-1;
+    ep->degr_nsize = (gint64)-1;
+    ep->degr_csize = (gint64)-1;
 
     if(ep->next_level0 <= 0 || (have_info && ep->last_level == 0
        && (info.command & FORCE_NO_BUMP))) {
@@ -1990,14 +2159,14 @@ static void analyze_estimate(
        ep->dump_level = 0;
        ep->dump_nsize = est_size(dp, 0);
        ep->dump_csize = est_tape_size(dp, 0);
-       if(ep->dump_csize <= (off_t)0) {
+       if(ep->dump_csize <= (gint64)0) {
            g_fprintf(stderr,
                    _("(no estimate for level 0, picking an incr level)\n"));
            ep->dump_level = pick_inclevel(dp);
            ep->dump_nsize = est_size(dp, ep->dump_level);
            ep->dump_csize = est_tape_size(dp, ep->dump_level);
 
-           if(ep->dump_nsize == (off_t)-1) {
+           if(ep->dump_nsize == (gint64)-1) {
                ep->dump_level = ep->dump_level + 1;
                ep->dump_nsize = est_size(dp, ep->dump_level);
                ep->dump_csize = est_tape_size(dp, ep->dump_level);
@@ -2008,9 +2177,12 @@ static void analyze_estimate(
            if(ep->last_level == -1 || dp->skip_incr) {
                g_fprintf(stderr,_("(%s disk, can't switch to degraded mode)\n"),
                        dp->skip_incr? "skip-incr":_("new"));
+               if (dp->skip_incr  && ep->degr_mesg == NULL) {
+                   ep->degr_mesg = _("Can't switch to degraded mode when using a skip-incr disk");
+               }
                ep->degr_level = -1;
-               ep->degr_nsize = (off_t)-1;
-               ep->degr_csize = (off_t)-1;
+               ep->degr_nsize = (gint64)-1;
+               ep->degr_csize = (gint64)-1;
            }
            else {
                /* fill in degraded mode info */
@@ -2018,13 +2190,15 @@ static void analyze_estimate(
                ep->degr_level = pick_inclevel(dp);
                ep->degr_nsize = est_size(dp, ep->degr_level);
                ep->degr_csize = est_tape_size(dp, ep->degr_level);
-               if(ep->degr_csize == (off_t)-1) {
+               if(ep->degr_csize == (gint64)-1) {
                    ep->degr_level = ep->degr_level + 1;
                    ep->degr_nsize = est_size(dp, ep->degr_level);
                    ep->degr_csize = est_tape_size(dp, ep->degr_level);
                }
-               if(ep->degr_csize == (off_t)-1) {
+               if(ep->degr_csize == (gint64)-1) {
                    g_fprintf(stderr,_("(no inc estimate)"));
+                   if (ep->degr_mesg == NULL)
+                       ep->degr_mesg = _("Can't switch to degraded mode because an incremental estimate could not be performed");
                    ep->degr_level = -1;
                }
                g_fprintf(stderr,"\n");
@@ -2038,21 +2212,24 @@ static void analyze_estimate(
        ep->dump_nsize = est_size(dp, ep->dump_level);
        ep->dump_csize = est_tape_size(dp, ep->dump_level);
 
-       if(ep->dump_csize == (off_t)-1) {
+       if(ep->dump_csize == (gint64)-1) {
            ep->dump_level = ep->last_level;
            ep->dump_nsize = est_size(dp, ep->dump_level);
            ep->dump_csize = est_tape_size(dp, ep->dump_level);
        }
-       if(ep->dump_csize == (off_t)-1) {
+       if(ep->dump_csize == (gint64)-1) {
            ep->dump_level = ep->last_level + 1;
            ep->dump_nsize = est_size(dp, ep->dump_level);
            ep->dump_csize = est_tape_size(dp, ep->dump_level);
        }
-       if(ep->dump_csize == (off_t)-1) {
+       if(ep->dump_csize == (gint64)-1) {
            ep->dump_level = 0;
            ep->dump_nsize = est_size(dp, ep->dump_level);
            ep->dump_csize = est_tape_size(dp, ep->dump_level);
        }
+       if (ep->degr_mesg == NULL) {
+           ep->degr_mesg = _("Can't switch to degraded mode because a full is not planned");
+       }
     }
 
     g_fprintf(stderr,_("  curr level %d nsize %lld csize %lld "),
@@ -2061,21 +2238,31 @@ static void analyze_estimate(
 
     insert_disk(&schedq, dp, schedule_order);
 
-    total_size += (off_t)tt_blocksize_kb + ep->dump_csize + tape_mark;
+    total_size += (gint64)tt_blocksize_kb + ep->dump_csize + tape_mark;
 
     /* update the balanced size */
     if(!(dp->skip_full || dp->strategy == DS_NOFULL || 
         dp->strategy == DS_INCRONLY)) {
-       off_t lev0size;
+       gint64 lev0size;
 
        lev0size = est_tape_size(dp, 0);
-       if(lev0size == (off_t)-1) lev0size = ep->last_lev0size;
+       if(lev0size == (gint64)-1) lev0size = ep->last_lev0size;
 
-       balanced_size += (double)(lev0size / (off_t)runs_per_cycle);
+       balanced_size += (double)(lev0size / (gint64)runs_per_cycle);
     }
 
     g_fprintf(stderr,_("total size %lld total_lev0 %1.0lf balanced-lev0size %1.0lf\n"),
            (long long)total_size, total_lev0, balanced_size);
+
+    /* Log errstr even if the estimate succeeded */
+    /* It can be an error from a script          */
+    if (est(dp)->errstr) {
+       char *qerrstr = quote_string(est(dp)->errstr);
+       log_add(L_FAIL, _("%s %s %s 0 %s"), dp->host->hostname, qname, 
+               planner_timestamp, qerrstr);
+       amfree(qerrstr);
+    }
+
     amfree(qname);
 }
 
@@ -2112,14 +2299,14 @@ static int schedule_order(
     disk_t *b)
 {
     int diff;
-    off_t ldiff;
+    gint64 ldiff;
 
     diff = est(b)->dump_priority - est(a)->dump_priority;
     if(diff != 0) return diff;
 
     ldiff = est(b)->dump_csize - est(a)->dump_csize;
-    if(ldiff < (off_t)0) return -1; /* XXX - there has to be a better way to dothis */
-    if(ldiff > (off_t)0) return 1;
+    if(ldiff < (gint64)0) return -1; /* XXX - there has to be a better way to dothis */
+    if(ldiff > (gint64)0) return 1;
     return 0;
 }
 
@@ -2128,8 +2315,8 @@ static int pick_inclevel(
     disk_t *dp)
 {
     int base_level, bump_level;
-    off_t base_size, bump_size;
-    off_t thresh;
+    gint64 base_size, bump_size;
+    gint64 thresh;
     char *qname;
 
     base_level = est(dp)->last_level;
@@ -2149,9 +2336,9 @@ static int pick_inclevel(
     base_size = est_size(dp, base_level);
 
     /* if we didn't get an estimate, we can't do an inc */
-    if(base_size == (off_t)-1) {
+    if(base_size == (gint64)-1) {
        base_size = est_size(dp, base_level+1);
-       if(base_size > (off_t)0) /* FORCE_BUMP */
+       if(base_size > (gint64)0) /* FORCE_BUMP */
            return base_level+1;
        g_fprintf(stderr,_("   picklev: no estimate for level %d, so no incs\n"), base_level);
        return base_level;
@@ -2172,7 +2359,7 @@ static int pick_inclevel(
     bump_level = base_level + 1;
     bump_size = est_size(dp, bump_level);
 
-    if(bump_size == (off_t)-1) return base_level;
+    if(bump_size == (gint64)-1) return base_level;
 
     g_fprintf(stderr, _("   pick: next size %lld... "),
            (long long)bump_size);
@@ -2230,13 +2417,13 @@ static void delay_dumps(void)
     disk_t *   preserve;
     bi_t *     bi;
     bi_t  *    nbi;
-    off_t      new_total;              /* New total_size */
+    gint64     new_total;              /* New total_size */
     char       est_kb[20];             /* Text formatted dump size */
     int                nb_forced_level_0;
     info_t     info;
     int                delete;
     char *     message;
-    off_t      full_size;
+    gint64     full_size;
 
     biq.head = biq.tail = NULL;
 
@@ -2253,15 +2440,15 @@ static void delay_dumps(void)
 
     for(dp = schedq.head; dp != NULL; dp = ndp) {
        int avail_tapes = 1;
-       if (dp->tape_splitsize > (off_t)0)
+       if (dp->tape_splitsize > (gint64)0)
            avail_tapes = conf_runtapes;
 
        ndp = dp->next; /* remove_disk zaps this */
 
        full_size = est_tape_size(dp, 0);
-       if (full_size > tapetype_get_length(tape) * (off_t)avail_tapes) {
+       if (full_size > tapetype_get_length(tape) * (gint64)avail_tapes) {
            char *qname = quote_string(dp->name);
-           if (conf_runtapes > 1 && dp->tape_splitsize == (off_t)0) {
+           if (conf_runtapes > 1 && dp->tape_splitsize == (gint64)0) {
                log_add(L_WARNING, _("disk %s:%s, full dump (%lldKB) will be larger than available tape space"
                        ", you could define a splitsize"),
                        dp->host->hostname, qname,
@@ -2274,8 +2461,8 @@ static void delay_dumps(void)
            amfree(qname);
        }
 
-       if (est(dp)->dump_csize == (off_t)-1 ||
-           est(dp)->dump_csize <= tapetype_get_length(tape) * (off_t)avail_tapes) {
+       if (est(dp)->dump_csize == (gint64)-1 ||
+           est(dp)->dump_csize <= tapetype_get_length(tape) * (gint64)avail_tapes) {
            continue;
        }
 
@@ -2449,17 +2636,17 @@ static void delay_dumps(void)
        int avail_tapes = 1;
        nbi = bi->prev;
        dp = bi->dp;
-       if(dp->tape_splitsize > (off_t)0)
+       if(dp->tape_splitsize > (gint64)0)
            avail_tapes = conf_runtapes;
 
        if(bi->deleted) {
-           new_total = total_size + (off_t)tt_blocksize_kb +
-                       bi->csize + (off_t)tape_mark;
+           new_total = total_size + (gint64)tt_blocksize_kb +
+                       bi->csize + (gint64)tape_mark;
        } else {
            new_total = total_size - est(dp)->dump_csize + bi->csize;
        }
        if((new_total <= tape_length) &&
-         (bi->csize < (tapetype_get_length(tape) * (off_t)avail_tapes))) {
+         (bi->csize < (tapetype_get_length(tape) * (gint64)avail_tapes))) {
            /* reinstate it */
            total_size = new_total;
            if(bi->deleted) {
@@ -2541,7 +2728,7 @@ arglist_function1(
 
     arglist_start(argp, delete);
 
-    total_size -= (off_t)tt_blocksize_kb + est(dp)->dump_csize + (off_t)tape_mark;
+    total_size -= (gint64)tt_blocksize_kb + est(dp)->dump_csize + (gint64)tape_mark;
     if(est(dp)->dump_level == 0) {
        total_lev0 -= (double) est(dp)->dump_csize;
     }
@@ -2586,7 +2773,7 @@ arglist_function1(
        est(dp)->dump_level = est(dp)->degr_level;
        est(dp)->dump_nsize = est(dp)->degr_nsize;
        est(dp)->dump_csize = est(dp)->degr_csize;
-       total_size += (off_t)tt_blocksize_kb + est(dp)->dump_csize + (off_t)tape_mark;
+       total_size += (gint64)tt_blocksize_kb + est(dp)->dump_csize + (gint64)tape_mark;
     }
     amfree(qname);
     return;
@@ -2596,7 +2783,7 @@ arglist_function1(
 static int promote_highest_priority_incremental(void)
 {
     disk_t *dp, *dp1, *dp_promote;
-    off_t new_size, new_total, new_lev0;
+    gint64 new_size, new_total, new_lev0;
     int check_days;
     int nb_today, nb_same_day, nb_today2;
     int nb_disk_today, nb_disk_same_day;
@@ -2612,7 +2799,7 @@ static int promote_highest_priority_incremental(void)
 
        est(dp)->promote = -1000;
 
-       if(est_size(dp,0) <= (off_t)0)
+       if(est_size(dp,0) <= (gint64)0)
            continue;
 
        if(est(dp)->next_level0 <= 0)
@@ -2623,7 +2810,7 @@ static int promote_highest_priority_incremental(void)
 
        new_size = est_tape_size(dp, 0);
        new_total = total_size - est(dp)->dump_csize + new_size;
-       new_lev0 = (off_t)total_lev0 + new_size;
+       new_lev0 = (gint64)total_lev0 + new_size;
 
        nb_today = 0;
        nb_same_day = 0;
@@ -2648,7 +2835,7 @@ static int promote_highest_priority_incremental(void)
 
        /* do not promote if overflow balanced size and something today */
        /* promote if nothing today */
-       if((new_lev0 > (off_t)(balanced_size + balance_threshold)) &&
+       if((new_lev0 > (gint64)(balanced_size + balance_threshold)) &&
                (nb_disk_today > 0))
            continue;
 
@@ -2688,7 +2875,7 @@ static int promote_highest_priority_incremental(void)
        qname = quote_string(dp->name);
        new_size = est_tape_size(dp, 0);
        new_total = total_size - est(dp)->dump_csize + new_size;
-       new_lev0 = (off_t)total_lev0 + new_size;
+       new_lev0 = (gint64)total_lev0 + new_size;
 
        total_size = new_total;
        total_lev0 = (double)new_lev0;
@@ -2723,13 +2910,13 @@ static int promote_hills(void)
     disk_t *dp;
     struct balance_stats {
        int disks;
-       off_t size;
+       gint64 size;
     } *sp = NULL;
     int days;
     int hill_days = 0;
-    off_t hill_size;
-    off_t new_size;
-    off_t new_total;
+    gint64 hill_size;
+    gint64 new_size;
+    gint64 new_total;
     int my_dumpcycle;
     char *qname;
 
@@ -2746,7 +2933,7 @@ static int promote_hills(void)
 
     for(days = 0; days < my_dumpcycle; days++) {
        sp[days].disks = 0;
-       sp[days].size = (off_t)0;
+       sp[days].size = (gint64)0;
     }
 
     for(dp = schedq.head; dp != NULL; dp = dp->next) {
@@ -2761,7 +2948,7 @@ static int promote_hills(void)
     /* Search for a suitable big hill and cut it down */
     while(1) {
        /* Find the tallest hill */
-       hill_size = (off_t)0;
+       hill_size = (gint64)0;
        for(days = 0; days < my_dumpcycle; days++) {
            if(sp[days].disks > 1 && sp[days].size > hill_size) {
                hill_size = sp[days].size;
@@ -2769,7 +2956,7 @@ static int promote_hills(void)
            }
        }
 
-       if(hill_size <= (off_t)0) break;        /* no suitable hills */
+       if(hill_size <= (gint64)0) break;       /* no suitable hills */
 
        /* Find all the dumps in that hill and try and remove one */
        for(dp = schedq.head; dp != NULL; dp = dp->next) {
@@ -2849,7 +3036,7 @@ static void output_scheduleline(
 
     ep = est(dp);
 
-    if(ep->dump_csize == (off_t)-1) {
+    if(ep->dump_csize == (gint64)-1) {
        /* no estimate, fail the disk */
        g_fprintf(stderr,
                _("%s: FAILED %s %s %s %d \"[no estimate]\"\n"),
@@ -2875,7 +3062,7 @@ static void output_scheduleline(
        dump_kps = fix_rate(ep->fullrate);
        dump_time = (time_t)((double)ep->dump_csize / dump_kps);
 
-       if(ep->degr_csize != (off_t)-1) {
+       if(ep->degr_csize != (gint64)-1) {
            degr_kps = fix_rate(ep->incrrate);
            degr_time = (time_t)((double)ep->degr_csize / degr_kps);
        }
@@ -2885,7 +3072,7 @@ static void output_scheduleline(
        dump_time = (time_t)((double)ep->dump_csize / dump_kps);
     }
 
-    if(ep->dump_level == 0 && ep->degr_csize != (off_t)-1) {
+    if(ep->dump_level == 0 && ep->degr_csize != (gint64)-1) {
        g_snprintf(degr_level_str, sizeof(degr_level_str),
                    "%d", ep->degr_level);
        g_snprintf(degr_nsize_str, sizeof(degr_nsize_str),
@@ -2903,6 +3090,15 @@ static void output_scheduleline(
                             " ", degr_time_str,
                             " ", degr_kps_str,
                             NULL);
+    } else {
+       char *degr_mesg;
+       if (ep->degr_mesg) {
+           degr_mesg = quote_string(ep->degr_mesg);
+       } else {
+           degr_mesg = quote_string(_("Can't switch to degraded mode for unknown reason"));
+       }
+       degr_str = vstralloc(" ", degr_mesg, NULL);
+       amfree(degr_mesg);
     }
     g_snprintf(dump_priority_str, SIZEOF(dump_priority_str),
                "%d", ep->dump_priority);
index 6f0e248678157a65224dff3e8d92f3fdd760acf1..f9fabea9535f5ed26d7096d5e198bd1219454e6d 100644 (file)
@@ -63,7 +63,7 @@
 #define STATUS_TAPE     16
 
 typedef struct line_s {
-    struct line_s *next;
+    struct line_s *next, *last;
     char *str;
 } line_t;
 
@@ -84,6 +84,7 @@ typedef struct repdata_s {
     timedata_t taper;
     timedata_t dumper;
     timedata_t chunker;
+    timedata_t planner;
     int level;
     struct repdata_s *next;
 } repdata_t;
@@ -302,6 +303,7 @@ addline(
     /* allocate new line node */
     new = (line_t *) alloc(SIZEOF(line_t));
     new->next = NULL;
+    new->last = NULL;
     new->str = stralloc(str);
 
     /* add to end of list */
@@ -309,9 +311,12 @@ addline(
     if (p == NULL) {
        *lp = new;
     } else {
-       while (p->next != NULL)
-           p = p->next;
-       p->next = new;  
+       if (p->last) {
+           p->last->next = new;
+       } else {
+           p->next = new;
+       }
+       p->last = new;
     }
 }
 
@@ -344,6 +349,7 @@ main(
     char *lbl_templ = NULL;
     config_overwrites_t *cfg_ovr = NULL;
     char *cfg_opt = NULL;
+    char *mailer;
 
     /*
      * Configure program for internationalization:
@@ -460,26 +466,30 @@ main(
 
     amfree(cwd);
 
-#if !defined MAILER
-    if(!outfname) {
-       g_printf(_("You must run amreport with '-f <output file>' because configure\n"));
-       g_printf(_("didn't find a mailer.\n"));
-       exit (1);
-    }
-#endif
-
     /* read configuration files */
 
     /* ignore any errors reading the config file (amreport can run without a config) */
     config_init(CONFIG_INIT_EXPLICIT_NAME | CONFIG_INIT_USE_CWD, cfg_opt);
-    if (cfg_ovr) apply_config_overwrites(cfg_ovr);
+    apply_config_overwrites(cfg_ovr);
+
+    if (config_errors(NULL) >= CFGERR_WARNINGS) {
+       config_print_errors();
+    }
 
     check_running_as(RUNNING_AS_DUMPUSER);
 
-    dbrename(config_name, DBG_SUBDIR_SERVER);
+    dbrename(get_config_name(), DBG_SUBDIR_SERVER);
 
     safe_cd(); /* must be called *after* config_init() */
 
+    mailer = getconf_str(CNF_MAILER);
+    if (mailer && *mailer == '\0')
+       mailer = NULL;
+    if (!mailer && !outfname) {
+       g_printf(_("You must run amreport with '-f <output file>' because a mailer is not defined\n"));
+       exit (1);
+    }
+
     conf_diskfile = config_dir_relative(getconf_str(CNF_DISKFILE));
     /* Ignore error from read_diskfile */
     read_diskfile(conf_diskfile, &diskq);
@@ -605,41 +615,6 @@ main(
     /* ignore SIGPIPE so if a child process dies we do not also go away */
     signal(SIGPIPE, SIG_IGN);
 
-    /* open pipe to mailer */
-
-    if(outfname) {
-       /* output to a file */
-       if((mailf = fopen(outfname,"w")) == NULL) {
-           error(_("could not open output file: %s %s"), outfname, strerror(errno));
-           /*NOTREACHED*/
-       }
-        if (mailto != NULL) {
-               g_fprintf(mailf, "To: %s\n", mailto);
-               g_fprintf(mailf, "Subject: %s\n\n", subj_str);
-       }
-
-    } else {
-#ifdef MAILER
-       if(mailto) {
-               mail_cmd = vstralloc(MAILER,
-                            " -s", " \"", subj_str, "\"",
-                            " ", mailto, NULL);
-               if((mailf = popen(mail_cmd, "w")) == NULL) {
-               error(_("could not open pipe to \"%s\": %s"),
-                       mail_cmd, strerror(errno));
-               /*NOTREACHED*/
-               }
-       }
-       else {
-               if(mailout) {
-                   g_printf(_("No mail sent! "));
-                  g_printf(_("No valid mail address has been specified in amanda.conf or on the commmand line\n"));
-               }
-               mailf = NULL;
-       }
-#endif
-    }
-
     /* open pipe to print spooler if necessary) */
 
     if(psfname) {
@@ -694,10 +669,55 @@ main(
        }
     }
 
-    amfree(subj_str);
-
     sort_disks();
 
+    /* open pipe to mailer */
+
+    if(outfname) {
+       /* output to a file */
+       if((mailf = fopen(outfname,"w")) == NULL) {
+           error(_("could not open output file: %s %s"), outfname, strerror(errno));
+           /*NOTREACHED*/
+       }
+        if (mailto != NULL) {
+               g_fprintf(mailf, "To: %s\n", mailto);
+               g_fprintf(mailf, "Subject: %s\n\n", subj_str);
+       }
+
+    } else if (mailer) {
+       if(mailto) {
+           send_amreport_t send_amreport;
+           int             do_mail;
+
+           send_amreport = getconf_send_amreport(CNF_SEND_AMREPORT_ON);
+           do_mail = send_amreport == SEND_AMREPORT_ALL ||
+                     (send_amreport == SEND_AMREPORT_STRANGE &&
+                      (!got_finish || first_failed || errsum ||
+                       first_strange || errdet || strangedet)) ||
+                     (send_amreport == SEND_AMREPORT_ERROR &&
+                      (!got_finish || first_failed || errsum || errdet));
+           if (do_mail) {
+               mail_cmd = vstralloc(mailer,
+                            " -s", " \"", subj_str, "\"",
+                            " ", mailto, NULL);
+               if((mailf = popen(mail_cmd, "w")) == NULL) {
+                   error(_("could not open pipe to \"%s\": %s"),
+                         mail_cmd, strerror(errno));
+                   /*NOTREACHED*/
+               }
+           }
+       }
+       else {
+           if (mailout) {
+                g_printf(_("No mail sent! "));
+               g_printf(_("No valid mail address has been specified in amanda.conf or on the commmand line\n"));
+           }
+           mailf = NULL;
+       }
+    }
+
+    amfree(subj_str);
+
     if(mailf) {
 
        if(!got_finish) fputs(_("*** THE DUMPS DID NOT FINISH PROPERLY!\n\n"), mailf);
@@ -705,7 +725,7 @@ main(
        if (ghostname) {
            g_fprintf(mailf, _("Hostname: %s\n"), ghostname);
            g_fprintf(mailf, _("Org     : %s\n"), getconf_str(CNF_ORG));
-           g_fprintf(mailf, _("Config  : %s\n"), config_name);
+           g_fprintf(mailf, _("Config  : %s\n"), get_config_name());
            g_fprintf(mailf, _("Date    : %s\n"),
                    nicedate(run_datestamp ? run_datestamp : "0"));
            g_fprintf(mailf,"\n");
@@ -776,7 +796,7 @@ main(
        int exitcode;
         if((exitcode = pclose(mailf)) != 0) {
            char *exitstr = str_exit_status("mail command", exitcode);
-            error(exitstr);
+            error("%s", exitstr);
            /*NOTREACHED*/
        }
         mailf = NULL;
@@ -807,20 +827,24 @@ main(
        double q = (b);                     \
        if (!isnormal(q))                   \
            g_fprintf((fp),"  -- ");        \
-       else if ((q = (a)/q) >= 999.95)     \
-           g_fprintf((fp), "###.#");       \
+       else if ((q = (a)/q) >= 99999.95)   \
+           g_fprintf((fp), "#####");       \
+       else if (q >= 999.95)               \
+           g_fprintf((fp), "%5.0lf",q);    \
        else                                \
-           g_fprintf((fp), "%5.1lf",q);            \
+           g_fprintf((fp), "%5.1lf",q);    \
     } while(0)
 #define divzero_wide(fp,a,b)               \
     do {                                           \
        double q = (b);                     \
        if (!isnormal(q))                   \
            g_fprintf((fp),"    -- ");      \
-       else if ((q = (a)/q) >= 99999.95)   \
-           g_fprintf((fp), "#####.#");     \
+       else if ((q = (a)/q) >= 9999999.95) \
+           g_fprintf((fp), "#######");     \
+       else if (q >= 99999.95)             \
+           g_fprintf((fp), "%7.0lf",q);    \
        else                                \
-           g_fprintf((fp), "%7.1lf",q);            \
+           g_fprintf((fp), "%7.1lf",q);    \
     } while(0)
 
 static void
@@ -1047,7 +1071,7 @@ output_tapeinfo(void)
        if (h_size > 0) {
            g_fprintf(mailf,
                    _("There are %lld%s of dumps left in the holding disk.\n"),
-                   (long long)h_size, displayunit);
+                   (long long)du(h_size), displayunit);
            if (getconf_boolean(CNF_AUTOFLUSH)) {
                g_fprintf(mailf, _("They will be flushed on the next run.\n"));
            } else {
@@ -1282,7 +1306,7 @@ CalcMaxWidth(void)
                                "%3d:%02d", mnsc(repdata->dumper.sec));
                else
                    g_snprintf(TimeRateBuffer, SIZEOF(TimeRateBuffer),
-                               "N/A ");
+                               " ");
                CheckStringMax(&ColumnData[DumpTime], TimeRateBuffer);
 
                CheckFloatMax(&ColumnData[DumpRate], repdata->dumper.kps); 
@@ -1298,14 +1322,14 @@ CalcMaxWidth(void)
                  "%3d:%02d", mnsc(repdata->taper.sec));
            else
                g_snprintf(TimeRateBuffer, SIZEOF(TimeRateBuffer),
-                 "N/A ");
+                 " ");
            CheckStringMax(&ColumnData[TapeTime], TimeRateBuffer);
 
            if(repdata->taper.result == L_SUCCESS ||
                    repdata->taper.result == L_CHUNKSUCCESS)
                CheckFloatMax(&ColumnData[TapeRate], repdata->taper.kps);
            else
-               CheckStringMax(&ColumnData[TapeRate], "N/A ");
+               CheckStringMax(&ColumnData[TapeRate], " ");
        }
       }
     }
@@ -1323,6 +1347,7 @@ output_summary(void)
     int i, h, w1, wDump, wTape;
     double outsize, origsize;
     double f;
+    int cdWidth;
 
     HostName = StringToColumn("HostName");
     Disk = StringToColumn("Disk");
@@ -1411,9 +1436,14 @@ output_summary(void)
            qdevname = quote_string(devname);
            devlen = strlen(qdevname);
            if (devlen > (size_t)cd->Width) {
-               fputc('-', mailf); 
-               g_fprintf(mailf, cd->Format, cd->Width-1, cd->Precision-1,
-                       qdevname+devlen - (cd->Width-1) );
+               int nb = 1;
+               if (strcmp(devname, qdevname)) {
+                   nb = 2;
+                   fputc('"', mailf); 
+               }
+               fputc('-', mailf); 
+               g_fprintf(mailf, cd->Format, cd->Width-nb, cd->Precision-nb,
+                       qdevname+devlen - (cd->Width-nb) );
            }
            else
                g_fprintf(mailf, cd->Format, cd->Width, cd->Width, qdevname);
@@ -1476,7 +1506,7 @@ output_summary(void)
            if(isnormal(origsize))
                g_fprintf(mailf, cd->Format, cd->Width, cd->Precision, du(origsize));
            else
-               g_fprintf(mailf, "%*.*s", cd->Width, cd->Width, "N/A");
+               g_fprintf(mailf, "%*.*s", cd->Width, cd->Width, "");
 
            cd= &ColumnData[OutKB];
            g_fprintf(mailf, "%*s", cd->PrefixSpace, "");
@@ -1496,23 +1526,46 @@ output_summary(void)
            fputs(sDivZero(pct(outsize), f, Compress), mailf);
 
            cd= &ColumnData[DumpTime];
+           cdWidth = 0;
            g_fprintf(mailf, "%*s", cd->PrefixSpace, "");
            if(repdata->dumper.result == L_SUCCESS ||
-              repdata->dumper.result == L_CHUNKSUCCESS)
+              repdata->dumper.result == L_CHUNKSUCCESS) {
                g_snprintf(TimeRateBuffer, SIZEOF(TimeRateBuffer),
-                 "%3d:%02d", mnsc(repdata->dumper.sec));
-           else
-               g_snprintf(TimeRateBuffer, SIZEOF(TimeRateBuffer),
-                 "N/A ");
-           g_fprintf(mailf, cd->Format, cd->Width, cd->Width, TimeRateBuffer);
+                 "%3d:%02d", mnsc(repdata->dumper.sec)); 
+               g_fprintf(mailf, cd->Format, cd->Width, cd->Width,
+                         TimeRateBuffer);
+           } else {
+               cdWidth = cd->Width;
+           }
 
            cd= &ColumnData[DumpRate];
            g_fprintf(mailf, "%*s", cd->PrefixSpace, "");
-           if(repdata->dumper.result == L_SUCCESS ||
-                   repdata->dumper.result == L_CHUNKSUCCESS)
-               g_fprintf(mailf, cd->Format, cd->Width, cd->Precision, repdata->dumper.kps);
-           else
-               g_fprintf(mailf, "%*s", cd->Width, "N/A ");
+           if (repdata->dumper.result == L_SUCCESS ||
+               repdata->dumper.result == L_CHUNKSUCCESS) {
+               g_fprintf(mailf, cd->Format, cd->Width, cd->Precision,
+                         repdata->dumper.kps);
+           } else if (repdata->dumper.result == L_FAIL) {
+               if (repdata->chunker.result == L_PARTIAL ||
+                   repdata->taper.result == L_PARTIAL) {
+                   int i;
+                   cdWidth += cd->Width;
+                   i = (cdWidth - strlen("PARTIAL")) / 2;
+                   g_fprintf(mailf, "%*s%*s", cdWidth-i, "PARTIAL", i, "");
+               } else {
+                   int i;
+                   cdWidth += cd->Width;
+                   i = (cdWidth - strlen("FAILED")) / 2;
+                   g_fprintf(mailf, "%*s%*s", cdWidth-i, "FAILED", i, "");
+               }
+           } else if (repdata->dumper.result == L_BOGUS) {
+               int i;
+               cdWidth += cd->Width;
+               i = (cdWidth - strlen("FLUSH")) / 2;
+               g_fprintf(mailf, "%*s%*s", cdWidth-i, "FLUSH", i, "");
+           } else {
+               cdWidth += cd->Width;
+               g_fprintf(mailf, "%*s", cdWidth, "");
+           }
 
            cd= &ColumnData[TapeTime];
            g_fprintf(mailf, "%*s", cd->PrefixSpace, "");
@@ -1530,7 +1583,7 @@ output_summary(void)
                  "%3d:%02d", mnsc(repdata->taper.sec));
            else
                g_snprintf(TimeRateBuffer, SIZEOF(TimeRateBuffer),
-                 "N/A ");
+                 " ");
            g_fprintf(mailf, cd->Format, cd->Width, cd->Width, TimeRateBuffer);
 
            cd= &ColumnData[TapeRate];
@@ -1540,7 +1593,7 @@ output_summary(void)
               repdata->taper.result == L_CHUNKSUCCESS)
                g_fprintf(mailf, cd->Format, cd->Width, cd->Precision, repdata->taper.kps);
            else
-               g_fprintf(mailf, "%*s", cd->Width, "N/A ");
+               g_fprintf(mailf, "%*s", cd->Width, " ");
 
            if (repdata->chunker.result == L_PARTIAL)
                g_fprintf(mailf, " PARTIAL");
@@ -1916,10 +1969,23 @@ static void
 handle_note(void)
 {
     char *str = NULL;
+    char *pidstr;
 
-    str = vstrallocf("  %s: %s", program_str[curprog], curstr);
-    addline(&notes, str);
-    amfree(str);
+    if (curprog == P_DRIVER &&
+       BSTRNCMP(curstr, "Taper protocol error") == 0) {
+       exit_status |= STATUS_TAPE;
+    }
+    pidstr = index(curstr,' ');
+    if (pidstr) {
+       pidstr++;
+    }
+    /* Don't report the pid lines */
+    if ((!pidstr || BSTRNCMP(pidstr, "pid ") != 0) &&
+       BSTRNCMP(curstr, "pid-done ") != 0) {
+       str = vstrallocf("  %s: %s", program_str[curprog], curstr);
+       addline(&notes, str);
+       amfree(str);
+    }
 }
 
 
@@ -2338,6 +2404,17 @@ handle_success(
            if(!isnormal(origkb))
                origkb = 0.1;
        }
+       if (curprog == P_TAPER && logtype == L_PARTIAL) {
+           char *t = index(s-1,']');
+           if (t) {
+               char *errmsg, *u;
+               errmsg = unquote_string(t+1);
+               u = vstrallocf("  %s: partial %s: %s",
+                              prefix(hostname, diskname, level),
+                              program_str[curprog], errmsg);
+               addline(&errsum, u);
+           }
+       }
     }
 
 
@@ -2613,6 +2690,8 @@ handle_failed(void)
 
        if(curprog == P_TAPER)
            sp = &(repdata->taper);
+       else if (curprog == P_PLANNER)
+           sp = &(repdata->planner);
        else sp = &(repdata->dumper);
 
        if(sp->result != L_SUCCESS)
@@ -2620,10 +2699,17 @@ handle_failed(void)
     }
     amfree(datestamp);
 
-    str = vstrallocf(_("FAILED %s"), errstr);
-    addtoX_summary(&first_failed, &last_failed, hostname, qdiskname, level,
-                  str);
-    amfree(str);
+    if (!((curprog == P_CHUNKER &&
+          strcmp(errstr, "[dumper returned FAILED]") == 0) ||
+         (curprog == P_CHUNKER &&
+          strcmp(errstr, "[Not enough holding disk space]") == 0) ||
+         (curprog == P_CHUNKER &&
+          strcmp(errstr, "[cannot read header: got 0 bytes instead of 32768]") == 0))) {
+       str = vstrallocf(_("FAILED %s"), errstr);
+       addtoX_summary(&first_failed, &last_failed, hostname, qdiskname, level,
+                      str);
+       amfree(str);
+    }
 
     if(curprog == P_DUMPER) {
        addline(&errdet,"");
@@ -2684,7 +2770,7 @@ generate_bad_estimate(void)
                    else
                        outsize  = repdata->dumper.outsize;
 
-                   if(repdata->est_csize * 0.9 > outsize) {
+                   if( (repdata->est_csize * 0.9 > outsize) && ( repdata->est_csize - outsize > 1.0e5 ) ) {
                        g_snprintf(s, 1000,
                                _("  big estimate: %s %s %d"),
                                 repdata->disk->host->hostname,
@@ -2699,7 +2785,7 @@ generate_bad_estimate(void)
                        s[999] = '\0';
                        addline(&notes, s);
                    }
-                   else if(repdata->est_csize * 1.1 < outsize) {
+                   else if( (repdata->est_csize * 1.1 < outsize) && (outsize - repdata->est_csize > 1.0e5 ) ) {
                        g_snprintf(s, 1000,
                                _("  small estimate: %s %s %d"),
                                 repdata->disk->host->hostname,
@@ -2978,7 +3064,7 @@ do_postscript_output(void)
                    else {
                        g_fprintf(postscript,"(%s) (%s) (%d) (%3.0d) (%8s) (%8.0lf) DrawHost\n",
                            dp->host->hostname, dp->name, repdata->level,
-                           repdata->taper.filenum, "N/A", 
+                           repdata->taper.filenum, "", 
                            outsize);
                    }
                }
index dc58d8daa2a767985d8829cf6f8356a16c79f587..f03eed309e76d84871d81eb4baa71c5ce31e9b72 100644 (file)
 #include "amanda.h"
 #include "server_util.h"
 #include "arglist.h"
-#include "token.h"
 #include "logfile.h"
 #include "util.h"
 #include "conffile.h"
 #include "diskfile.h"
+#include "pipespawn.h"
+#include "version.h"
+#include "conffile.h"
+#include "sys/wait.h"
 
 const char *cmdstr[] = {
     "BOGUS", "QUIT", "QUITTING", "DONE", "PARTIAL", 
@@ -52,14 +55,12 @@ const char *cmdstr[] = {
 };
 
 
-cmd_t
-getcmd(
-    struct cmdargs *   cmdargs)
+struct cmdargs *
+getcmd(void)
 {
     char *line;
     cmd_t cmd_i;
-
-    assert(cmdargs != NULL);
+    struct cmdargs *cmdargs = g_new0(struct cmdargs, 1);
 
     if (isatty(0)) {
        g_printf("%s> ", get_pname());
@@ -72,29 +73,56 @@ getcmd(
        line = stralloc("QUIT");
     }
 
-    cmdargs->argc = split(line, cmdargs->argv,
-       (int)(sizeof(cmdargs->argv) / sizeof(cmdargs->argv[0])), " ");
     dbprintf(_("getcmd: %s\n"), line);
+
+    cmdargs->argv = split_quoted_strings(line);
+    cmdargs->argc = g_strv_length(cmdargs->argv);
+    cmdargs->cmd = BOGUS;
+
     amfree(line);
 
-#if DEBUG
-    {
-       int i;
-       g_fprintf(stderr,_("argc = %d\n"), cmdargs->argc);
-       for (i = 0; i < cmdargs->argc+1; i++)
-           g_fprintf(stderr,_("argv[%d] = \"%s\"\n"), i, cmdargs->argv[i]);
+    if (cmdargs->argc < 1) {
+       return cmdargs;
     }
-#endif
-
-    if (cmdargs->argc < 1)
-       return (BOGUS);
 
     for(cmd_i=BOGUS; cmdstr[cmd_i] != NULL; cmd_i++)
-       if(strcmp(cmdargs->argv[1], cmdstr[cmd_i]) == 0)
-           return (cmd_i);
-    return (BOGUS);
+       if(strcmp(cmdargs->argv[0], cmdstr[cmd_i]) == 0) {
+           cmdargs->cmd = cmd_i;
+           return cmdargs;
+       }
+    return cmdargs;
+}
+
+struct cmdargs *
+get_pending_cmd(void)
+{
+    SELECT_ARG_TYPE ready;
+    struct timeval  to;
+    int             nfound;
+
+    FD_ZERO(&ready);
+    FD_SET(0, &ready);
+    to.tv_sec = 0;
+    to.tv_usec = 0;
+
+    nfound = select(1, &ready, NULL, NULL, &to);
+    if (nfound && FD_ISSET(0, &ready)) {
+        return getcmd();
+    } else {
+       return NULL;
+    }
 }
 
+void
+free_cmdargs(
+    struct cmdargs *cmdargs)
+{
+    if (!cmdargs)
+       return;
+    if (cmdargs->argv)
+       g_strfreev(cmdargs->argv);
+    g_free(cmdargs);
+}
 
 printf_arglist_function1(void putresult, cmd_t, result, const char *, format)
 {
@@ -177,7 +205,7 @@ int check_infofile(
                }
                if (other_dle_match == 0) {
                    if(mkpdir(infofile, (mode_t)0755, (uid_t)-1,
-                             (gid_t)-1) == -1)  {
+                             (gid_t)-1) == -1) {
                        *errmsg = vstralloc("Can't create directory for ",
                                            infofile, NULL);
                        return -1;
@@ -193,3 +221,190 @@ int check_infofile(
     }
     return 0;
 }
+
+void
+run_server_script(
+    pp_script_t  *pp_script,
+    execute_on_t  execute_on,
+    char         *config,
+    disk_t      *dp,
+    int           level)
+{
+    pid_t   scriptpid;
+    int     scriptin, scriptout, scripterr;
+    char   *cmd;
+    char  **argvchild;
+    int     i, k;
+    FILE   *streamout;
+    char   *line;
+    char   *plugin;
+    char    level_number[NUM_STR_SIZE];
+
+    if ((pp_script_get_execute_on(pp_script) & execute_on) == 0)
+       return;
+    if (pp_script_get_execute_where(pp_script) != ES_SERVER)
+       return;
+
+    plugin = pp_script_get_plugin(pp_script);
+    k = property_argv_size(pp_script_get_property(pp_script));
+    argvchild = g_new0(char *, 16+k);
+    cmd = vstralloc(APPLICATION_DIR, "/", plugin, NULL);
+    i = 0;
+    argvchild[i++] = plugin;
+
+    switch (execute_on) {
+    case EXECUTE_ON_PRE_DLE_AMCHECK:
+       argvchild[i++] = "PRE-DLE-AMCHECK"; break;
+    case EXECUTE_ON_PRE_HOST_AMCHECK:
+       argvchild[i++] = "PRE-HOST-AMCHECK"; break;
+    case EXECUTE_ON_POST_DLE_AMCHECK:
+       argvchild[i++] = "POST-DLE-AMCHECK"; break;
+    case EXECUTE_ON_POST_HOST_AMCHECK:
+       argvchild[i++] = "POST-HOST-AMCHECK"; break;
+    case EXECUTE_ON_PRE_DLE_ESTIMATE:
+       argvchild[i++] = "PRE-DLE-ESTIMATE"; break;
+    case EXECUTE_ON_PRE_HOST_ESTIMATE:
+       argvchild[i++] = "PRE-HOST-ESTIMATE"; break;
+    case EXECUTE_ON_POST_DLE_ESTIMATE:
+       argvchild[i++] = "POST-DLE-ESTIMATE"; break;
+    case EXECUTE_ON_POST_HOST_ESTIMATE:
+       argvchild[i++] = "POST-HOST-ESTIMATE"; break;
+    case EXECUTE_ON_PRE_DLE_BACKUP:
+       argvchild[i++] = "PRE-DLE-BACKUP"; break;
+    case EXECUTE_ON_PRE_HOST_BACKUP:
+       argvchild[i++] = "PRE-HOST-BACKUP"; break;
+    case EXECUTE_ON_POST_DLE_BACKUP:
+       argvchild[i++] = "POST-DLE-BACKUP"; break;
+    case EXECUTE_ON_POST_HOST_BACKUP:
+       argvchild[i++] = "POST-HOST-BACKUP"; break;
+    case EXECUTE_ON_PRE_RECOVER:
+    case EXECUTE_ON_POST_RECOVER:
+    case EXECUTE_ON_PRE_LEVEL_RECOVER:
+    case EXECUTE_ON_POST_LEVEL_RECOVER:
+    case EXECUTE_ON_INTER_LEVEL_RECOVER:
+       {
+            // ERROR these script can't be executed on server.
+            return;
+       }
+    }
+
+    argvchild[i++] = "--execute-where";
+    argvchild[i++] = "server";
+
+    if (config) {
+       argvchild[i++] = "--config";
+       argvchild[i++] = config;
+    }
+    if (dp->host->hostname) {
+       argvchild[i++] = "--host";
+       argvchild[i++] = dp->host->hostname;
+    }
+    if (dp->name) {
+       argvchild[i++] = "--disk";
+       argvchild[i++] = dp->name;
+    }
+    if (dp->device) {
+       argvchild[i++] = "--device";
+       argvchild[i++] = dp->device;
+    }
+    if (level >= 0) {
+       g_snprintf(level_number, SIZEOF(level_number), "%d", level);
+       argvchild[i++] = "--level";
+       argvchild[i++] = level_number;
+    }
+
+    i += property_add_to_argv(&argvchild[i], pp_script_get_property(pp_script));
+    argvchild[i++] = NULL;
+
+    scripterr = fileno(stderr);
+    scriptpid = pipespawnv(cmd, STDIN_PIPE|STDOUT_PIPE, 0, &scriptin,
+                          &scriptout, &scripterr, argvchild);
+    close(scriptin);
+
+    streamout = fdopen(scriptout, "r");
+    if (streamout) {
+       while((line = agets(streamout)) != NULL) {
+           dbprintf("script: %s\n", line);
+       }
+    }
+    fclose(streamout);
+    waitpid(scriptpid, NULL, 0);
+}
+
+
+void
+run_server_scripts(
+    execute_on_t  execute_on,
+    char         *config,
+    disk_t      *dp,
+    int           level)
+{
+    GSList   *pp_scriptlist;
+
+    for (pp_scriptlist = dp->pp_scriptlist; pp_scriptlist != NULL;
+        pp_scriptlist = pp_scriptlist->next) {
+       run_server_script(pp_scriptlist->data, execute_on, config, dp, level);
+    }
+}
+
+void
+run_amcleanup(
+    char *config_name)
+{
+    pid_t amcleanup_pid;
+    char *amcleanup_program;
+    char *amcleanup_options[4];
+
+    switch(amcleanup_pid = fork()) {
+       case -1:
+           return;
+           break;
+       case  0: /* child process */
+           amcleanup_program = vstralloc(sbindir, "/", "amcleanup", versionsuffix(), NULL);
+           amcleanup_options[0] = amcleanup_program;
+           amcleanup_options[1] = "-p";
+           amcleanup_options[2] = config_name;
+           amcleanup_options[3] = NULL;
+           execve(amcleanup_program, amcleanup_options, safe_env());
+           error("exec %s: %s", amcleanup_program, strerror(errno));
+           /*NOTREACHED*/
+       default:
+           break;
+    }
+    waitpid(amcleanup_pid, NULL, 0);
+}
+
+char *
+get_master_process(
+    char *logfile)
+{
+    FILE *log;
+    char line[1024];
+    char *s, ch;
+    char *process_name;
+
+    log = fopen(logfile, "r");
+    if (!log)
+       return stralloc("UNKNOWN");
+
+    while(fgets(line, 1024, log)) {
+       if (strncmp_const(line, "INFO ") == 0) {
+           s = line+5;
+           ch = *s++;
+           process_name = s-1;
+           skip_non_whitespace(s, ch);
+           s[-1] = '\0';
+           skip_whitespace(s, ch);
+           skip_non_whitespace(s, ch);
+           s[-1] = '\0';
+           skip_whitespace(s, ch);
+           if (strncmp_const(s-1, "pid ") == 0) {
+               process_name = stralloc(process_name);
+               fclose(log);
+               return process_name;
+           }
+       }
+    }
+    fclose(log);
+    return stralloc("UNKNOWN");
+}
index a758ad1b477745965e37821c8bc68a90f01b0da5..ffab5eab294eacd2f1301128a58986eb2aa24a62 100644 (file)
@@ -54,23 +54,40 @@ enum {
 extern const char *cmdstr[];
 
 struct cmdargs {
+    cmd_t cmd;
     int argc;
-    char *argv[MAX_ARGS + 1];
+    char **argv;
 };
 
-cmd_t getcmd(struct cmdargs *cmdargs);
-cmd_t getresult(int fd, int show, int *result_argc, char **result_argv, int max_arg);
+struct cmdargs *getcmd(void);
+struct cmdargs *get_pending_cmd(void);
+void free_cmdargs(struct cmdargs *cmdargs);
 void putresult(cmd_t result, const char *, ...) G_GNUC_PRINTF(2, 3);
 int taper_cmd(cmd_t cmd, void *ptr, char *destname, int level, char *datestamp);
 
 struct disk_s;
 struct chunker_s;
-int chunker_cmd(struct chunker_s *chunker, cmd_t cmd, struct disk_s *dp);
+int chunker_cmd(struct chunker_s *chunker, cmd_t cmd, struct disk_s *dp,
+               char *mesg);
 
 struct dumper_s;
-int dumper_cmd(struct dumper_s *dumper, cmd_t cmd, struct disk_s *dp);
+int dumper_cmd(struct dumper_s *dumper, cmd_t cmd, struct disk_s *dp,
+              char *mesg);
 
 char *amhost_get_security_conf(char *string, void *arg);
 int check_infofile(char *infodir, disklist_t *dl, char **errmsg);
 
+void run_server_script(pp_script_t  *pp_script,
+                      execute_on_t  execute_on,
+                      char         *config,
+                      disk_t       *dp,
+                      int           level);
+void run_server_scripts(execute_on_t  execute_on,
+                       char         *config,
+                       disk_t       *dp,
+                       int           level);
+
+void run_amcleanup(char *config_name);
+char *get_master_process(char *logfile);
+
 #endif /* SERVER_UTIL_H */
index 9a9cf3d5f4498b9ec0f0d53c5ebee516d680e1e5..52ece52ee4fba44a0f21f616dc28af4d512cbe42 100644 (file)
@@ -51,7 +51,13 @@ read_tapelist(
 
     tape_list = NULL;
     if((tapef = fopen(tapefile,"r")) == NULL) {
-       return 1;
+       if (errno == ENOENT) {
+           /* no tapelist is equivalent to an empty tapelist */
+           return 0;
+       } else {
+           g_debug("Error opening '%s': %s", tapefile, strerror(errno));
+           return 1;
+       }
     }
 
     while((line = agets(tapef)) != NULL) {
@@ -95,6 +101,8 @@ write_tapelist(
        g_fprintf(tapef, "%s %s", tp->datestamp, tp->label);
        if(tp->reuse) g_fprintf(tapef, " reuse");
        else g_fprintf(tapef, " no-reuse");
+       if (tp->comment)
+           g_fprintf(tapef, " #%s", tp->comment);
        g_fprintf(tapef, "\n");
     }
 
@@ -258,7 +266,8 @@ remove_tapelabel(
 tape_t *
 add_tapelabel(
     char *datestamp,
-    char *label)
+    char *label,
+    char *comment)
 {
     tape_t *cur, *new;
 
@@ -270,6 +279,7 @@ add_tapelabel(
     new->position = 0;
     new->reuse = 1;
     new->label = stralloc(label);
+    new->comment = comment? stralloc(comment) : NULL;
 
     new->prev  = NULL;
     if(tape_list != NULL) tape_list->prev = new;
@@ -362,10 +372,26 @@ parse_tapeline(
 
     skip_whitespace(s, ch);
     tp->reuse = 1;
-    if(strncmp_const(s - 1, "reuse") == 0)
+    if(strncmp_const(s - 1, "reuse") == 0) {
        tp->reuse = 1;
-    if(strncmp_const(s - 1, "no-reuse") == 0)
+       s1 = s - 1;
+       skip_non_whitespace(s, ch);
+       s[-1] = '\0';
+       skip_whitespace(s, ch);
+    }
+    if(strncmp_const(s - 1, "no-reuse") == 0) {
        tp->reuse = 0;
+       s1 = s - 1;
+       skip_non_whitespace(s, ch);
+       s[-1] = '\0';
+       skip_whitespace(s, ch);
+    }
+
+    if (*(s - 1) == '#') {
+       tp->comment = stralloc(s); /* skip leading '#' */
+    } else {
+       tp->comment = NULL;
+    }
 
     return tp;
 }
index a90da570fe15da8cbd501ac5bab109440b7c4ec6..eac09e9a366894f8f55155ebc191e27b2675c660 100644 (file)
@@ -40,6 +40,7 @@ typedef struct tape_s {
     char * datestamp;
     int reuse;
     char *label;
+    char *comment;
 } tape_t;
 
 int read_tapelist(char *tapefile);
@@ -51,7 +52,7 @@ tape_t *lookup_tapedate(char *datestamp);
 int lookup_nb_tape(void);
 tape_t *lookup_last_reusable_tape(int skip);
 void remove_tapelabel(char *label);
-tape_t *add_tapelabel(char *datestamp, char *label);
+tape_t *add_tapelabel(char *datestamp, char *label, char *comment);
 int reusable_tape(tape_t *tp);
 
 int guess_runs_from_tapelist(void);
index 58f13d324774a66dc29133df7801bbc00243f560..c3ae3859b626be08286b3f6ad96353e3d97d28da 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Amanda, The Advanced Maryland Automatic Network Disk Archiver
- * Copyright (c) 2006 Zmanda Inc.
+ * Copyright (c) 2005-2008 Zmanda Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -186,6 +186,7 @@ static gboolean open_buffer_file(TaperDiskPortSource * self) {
     int fd;
     char * filename;
     mode_t old_umask;
+    TaperSource * pself = (TaperSource *)self;
 
     g_return_val_if_fail(self != NULL, FALSE);
     g_return_val_if_fail(self->buffer_dir_name != NULL, FALSE);
@@ -197,7 +198,8 @@ static gboolean open_buffer_file(TaperDiskPortSource * self) {
     fd = g_mkstemp(filename);
     umask(old_umask);
     if (fd < 0) {
-        g_fprintf(stderr, "Couldn't open temporary file with template %s: %s\n",
+       pself->errmsg = newvstrallocf(pself->errmsg,
+               "Couldn't open temporary file with template %s: %s",
                 filename, strerror(errno));
         return FALSE;
     }
@@ -387,9 +389,11 @@ taper_disk_port_source_read (TaperSource * pself, void * buf, size_t count) {
    as having a disk problem. Returns FALSE in that case. */
 static gboolean try_rewind(TaperDiskPortSource * self) {
     gint64 result;
+    TaperSource * pself = (TaperSource *)self;
     result = lseek(selfp->buffer_fd, 0, SEEK_SET);
     if (result != 0) {
-        g_fprintf(stderr, "Couldn't seek split buffer: %s\n", strerror(errno));
+       pself->errmsg = newvstrallocf(pself->errmsg,
+               "Couldn't seek split buffer: %s", strerror(errno));
         selfp->disk_problem = TRUE;
         return FALSE;
     } else {
index ba83385aef79f0cdcd2bc7aeab78739bf403d215..9ef4ac71ac4419c13fc140b60e2802d302977081 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Amanda, The Advanced Maryland Automatic Network Disk Archiver
- * Copyright (c) 2006 Zmanda Inc.
+ * Copyright (c) 2005-2008 Zmanda Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
index 65a75a9b48e35b93f81694f5389254c29bbec7a3..8fe4233303dacb9d9f8d5b9fabcdb95a82cba60c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Amanda, The Advanced Maryland Automatic Network Disk Archiver
- * Copyright (c) 2006 Zmanda Inc.
+ * Copyright (c) 2005-2008 Zmanda Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -74,7 +74,7 @@ GType taper_file_source_get_type (void) {
             NULL
         };
         
-        type = g_type_register_static (TAPER_TYPE_SOURCE, "TaperFileSource",
+        type = g_type_register_static (TAPER_SOURCE_TYPE, "TaperFileSource",
                                        &info, (GTypeFlags)0);
     }
     
@@ -94,6 +94,9 @@ taper_file_source_finalize(GObject *obj_self)
     if(self->_priv->current_chunk_fd >= 0) {
         close (self->_priv->current_chunk_fd);
     }
+    dumpfile_free_data(&(self->_priv->part_start_chunk_header));
+    dumpfile_free_data(&(self->_priv->current_chunk_header));
+    amfree(self->_priv);
 }
 
 static void 
@@ -103,6 +106,8 @@ taper_file_source_init (TaperFileSource * o G_GNUC_UNUSED)
     o->_priv->part_start_chunk_fd = -1;
     o->_priv->current_chunk_fd = -1;
     o->_priv->predicted_splits = -1;
+    fh_init(&o->_priv->part_start_chunk_header);
+    fh_init(&o->_priv->current_chunk_header);
     o->holding_disk_file = NULL;
 }
 
@@ -110,7 +115,7 @@ static void  taper_file_source_class_init (TaperFileSourceClass * c) {
     GObjectClass *g_object_class = (GObjectClass*) c;
     TaperSourceClass *taper_source_class = (TaperSourceClass *)c;
 
-    parent_class = g_type_class_ref (TAPER_TYPE_SOURCE);
+    parent_class = g_type_class_ref (TAPER_SOURCE_TYPE);
 
     taper_source_class->read = taper_file_source_read;
     taper_source_class->seek_to_part_start =
@@ -182,9 +187,9 @@ static dumpfile_t * taper_file_source_get_first_header(TaperSource * pself) {
    everything went OK. Writes the fd into fd_pointer and the header
    into header_pointer. Both must be non-NULL. */
 static gboolean open_holding_file(char * filename, int * fd_pointer,
-                                  dumpfile_t * header_pointer) {
+                                  dumpfile_t * header_pointer, char **errmsg) {
     int fd;
-    int read_result;
+    size_t read_result;
     char * header_buffer;
 
     g_return_val_if_fail(filename != NULL, FALSE);
@@ -193,27 +198,37 @@ static gboolean open_holding_file(char * filename, int * fd_pointer,
 
     fd = robust_open(filename, O_NOCTTY | O_RDONLY, 0);
     if (fd < 0) {
-        g_fprintf(stderr, "Could not open holding disk file %s: %s\n",
+       *errmsg = newvstrallocf(*errmsg,
+               "Could not open holding disk file \"%s\": %s",
                 filename, strerror(errno));
         return FALSE;
     }
 
     header_buffer = malloc(DISK_BLOCK_BYTES);
-    read_result = fullread(fd, header_buffer, DISK_BLOCK_BYTES);
+    read_result = full_read(fd, header_buffer, DISK_BLOCK_BYTES);
     if (read_result < DISK_BLOCK_BYTES) {
-        g_fprintf(stderr,
-                "Could not read header from holding disk file %s: %s\n",
-                filename, strerror(errno));
+       if (errno != 0) {
+           *errmsg = newvstrallocf(*errmsg,
+                   "Could not read header from holding disk file %s: %s",
+                   filename, strerror(errno));
+       } else {
+           *errmsg = newvstrallocf(*errmsg,
+                   "Could not read header from holding disk file %s: got EOF",
+                   filename);
+       }
         aclose(fd);
+       amfree(header_buffer);
         return FALSE;
     }
-    
+
+    dumpfile_free_data(header_pointer);
     parse_file_header(header_buffer, header_pointer, DISK_BLOCK_BYTES);
     amfree(header_buffer);
     
     if (!(header_pointer->type == F_DUMPFILE ||
           header_pointer->type == F_CONT_DUMPFILE)) {
-        g_fprintf(stderr, "Got strange header from file %s.\n",
+       *errmsg = newvstrallocf(*errmsg,
+               "Got strange header from file %s",
                 filename);
         aclose(fd);
         return FALSE;
@@ -227,7 +242,8 @@ static gboolean open_holding_file(char * filename, int * fd_pointer,
    chunk. Returns FALSE if an error occurs (unlikely). */
 static gboolean copy_chunk_data(int * from_fd, int* to_fd,
                                 dumpfile_t * from_header,
-                                dumpfile_t * to_header) {
+                                dumpfile_t * to_header,
+                               char **errmsg) {
     g_return_val_if_fail(from_fd != NULL, FALSE);
     g_return_val_if_fail(to_fd != NULL, FALSE);
     g_return_val_if_fail(from_header != NULL, FALSE);
@@ -236,11 +252,12 @@ static gboolean copy_chunk_data(int * from_fd, int* to_fd,
     
     *to_fd = dup(*from_fd);
     if (*to_fd < 0) {
-        g_fprintf(stderr, "dup(%d) failed!\n", *from_fd);
+       *errmsg = newvstrallocf(*errmsg, "dup(%d) failed!", *from_fd);
         return FALSE;
     }
 
-    memcpy(to_header, from_header, sizeof(*to_header));
+    dumpfile_free_data(to_header);
+    dumpfile_copy_in_place(to_header, from_header);
 
     return TRUE;
 }
@@ -257,7 +274,8 @@ static gboolean first_time_setup(TaperFileSource * self) {
 
     if (!open_holding_file(self->holding_disk_file, 
                            &(selfp->part_start_chunk_fd),
-                           &(selfp->part_start_chunk_header))) {
+                           &(selfp->part_start_chunk_header),
+                          &(pself->errmsg))) {
         return FALSE;
     }
 
@@ -266,13 +284,14 @@ static gboolean first_time_setup(TaperFileSource * self) {
     if (!copy_chunk_data(&(selfp->part_start_chunk_fd),
                          &(selfp->current_chunk_fd),
                          &(selfp->part_start_chunk_header),
-                         &(selfp->current_chunk_header))) {
+                         &(selfp->current_chunk_header),
+                        &(pself->errmsg))) {
         aclose(selfp->part_start_chunk_fd);
         return FALSE;
     }
 
-    pself->first_header = g_memdup(&(selfp->part_start_chunk_header),
-                                   sizeof(dumpfile_t));
+    dumpfile_free(pself->first_header);
+    pself->first_header = dumpfile_copy(&(selfp->part_start_chunk_header));
 
     /* Should not be necessary. You never know! */
     selfp->current_part_pos = selfp->part_start_chunk_offset =
@@ -312,6 +331,7 @@ static int retry_read(int fd, void * buf, size_t count) {
    occurs. */
 static gboolean get_next_chunk(TaperFileSource * self) {
     char * cont_filename = NULL;
+    TaperSource * pself = (TaperSource*)self;
 
     if (selfp->current_chunk_header.cont_filename[0] != '\0') {
         cont_filename =
@@ -319,6 +339,7 @@ static gboolean get_next_chunk(TaperFileSource * self) {
     } else {
         /* No more data. */
         aclose(selfp->current_chunk_fd);
+       dumpfile_free_data(&(selfp->current_chunk_header));
         bzero(&(selfp->current_chunk_header),
               sizeof(selfp->current_chunk_header));
         return TRUE;
@@ -330,8 +351,10 @@ static gboolean get_next_chunk(TaperFileSource * self) {
 
     if (!open_holding_file(cont_filename,
                            &(selfp->current_chunk_fd),
-                           &(selfp->current_chunk_header))) {
+                           &(selfp->current_chunk_header),
+                          &(pself->errmsg))) {
         amfree(cont_filename);
+       dumpfile_free_data(&(selfp->current_chunk_header));
         bzero(&(selfp->current_chunk_header),
               sizeof(selfp->current_chunk_header));
         aclose(selfp->current_chunk_fd);
@@ -366,11 +389,14 @@ taper_file_source_read (TaperSource * pself, void * buf, size_t count) {
         return 0;
     }
 
-    /* We don't use fullread, because we would rather return a partial
+    /* We don't use full_read, because we would rather return a partial
      * read ASAP. */
     read_result = retry_read(selfp->current_chunk_fd, buf, count);
     if (read_result < 0) {
         /* Nothing we can do. */
+       pself->errmsg = newvstrallocf(pself->errmsg,
+               "Error reading holding disk '%s': %s'",
+                self->holding_disk_file, strerror(errno));
         return read_result;
     } else if (read_result == 0) {
         if (!get_next_chunk(self)) {
@@ -403,7 +429,8 @@ static gboolean taper_file_source_seek_to_part_start (TaperSource * pself) {
     if (!copy_chunk_data(&(selfp->part_start_chunk_fd),
                          &(selfp->current_chunk_fd),
                          &(selfp->part_start_chunk_header),
-                         &(selfp->current_chunk_header))) {
+                         &(selfp->current_chunk_header),
+                        &(pself->errmsg))) {
         return FALSE;
     }
 
@@ -413,7 +440,8 @@ static gboolean taper_file_source_seek_to_part_start (TaperSource * pself) {
                          DISK_BLOCK_BYTES + selfp->current_chunk_position,
                          SEEK_SET);
     if (lseek_result < 0) {
-        g_fprintf(stderr, "Could not seek holding disk file: %s\n",
+       pself->errmsg = newvstrallocf(pself->errmsg,
+               "Could not seek holding disk file: %s\n",
                 strerror(errno));
         return FALSE;
     }
@@ -435,7 +463,8 @@ static void taper_file_source_start_new_part (TaperSource * pself) {
     if (!copy_chunk_data(&(selfp->current_chunk_fd),
                          &(selfp->part_start_chunk_fd),
                          &(selfp->current_chunk_header),
-                         &(selfp->part_start_chunk_header))) {
+                         &(selfp->part_start_chunk_header),
+                        &(pself->errmsg))) {
         /* We can't return FALSE. :-( Instead, we set things up so
            they will fail on the next read(). */
         aclose(selfp->current_chunk_fd);
index 8d2830bdab4008dcace275e10977714df10c38e3..d24e99ef6a93b5c7cf94152d383683458f7c6f42 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Amanda, The Advanced Maryland Automatic Network Disk Archiver
- * Copyright (c) 2006 Zmanda Inc.
+ * Copyright (c) 2005-2008 Zmanda Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
index 0540845bb03275f594a7e31c661ff5d33383144a..d201e45a03757b1a3b16c7b15acd020822fe9819 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Amanda, The Advanced Maryland Automatic Network Disk Archiver
- * Copyright (c) 2006 Zmanda Inc.
+ * Copyright (c) 2005-2008 Zmanda Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -21,8 +21,6 @@
 
 #include "taper-mem-port-source.h"
 
-#include "physmem.h"
-
 struct _TaperMemPortSourcePrivate {
     /* Actual size of this buffer is given by max_part_size in TaperSource. */
     char * retry_buffer;
@@ -112,33 +110,36 @@ static int taper_mem_port_source_predict_parts(TaperSource * pself) {
 }
 
 /* Allocate buffer space, if it hasn't been done yet. */
-static void setup_retry_buffer(TaperMemPortSource * self) {
+static gboolean
+setup_retry_buffer(TaperMemPortSource * self) {
+    TaperSource *pself = TAPER_SOURCE(self);
     guint64 alloc_size;
-    guint64 max_usage;
     if (selfp->retry_buffer != NULL)
-        return;
+        return TRUE;
 
-    alloc_size = TAPER_SOURCE(self)->max_part_size;
+    alloc_size = pself->max_part_size;
     if (alloc_size > SIZE_MAX) {
         g_fprintf(stderr, "Fallback split size of %lld is greater that system maximum of %lld.\n",
                 (long long)alloc_size, (long long)SIZE_MAX);
         alloc_size = SIZE_MAX;
     }
     
-    max_usage = physmem_available() * .95;
-    if (alloc_size > max_usage) {
-        g_fprintf(stderr, "Fallback split size of %lld is greater than 95%% of available memory (%lld bytes).\n", (long long)alloc_size, (long long)max_usage);
-        alloc_size = max_usage;
-    }
-    
     if (alloc_size < DISK_BLOCK_BYTES * 10) {
         g_fprintf(stderr, "Fallback split size of %ju is smaller than 10 blocks (%u bytes).\n",
                  (uintmax_t)alloc_size, DISK_BLOCK_BYTES * 10);
         alloc_size = DISK_BLOCK_BYTES * 10;
     }
     
-    TAPER_SOURCE(self)->max_part_size = alloc_size;
+    pself->max_part_size = alloc_size;
     selfp->retry_buffer = malloc(alloc_size);
+
+    if (selfp->retry_buffer == NULL) {
+       pself->errmsg = g_strdup_printf(_("Can't allocate %ju bytes of memory for split buffer"),
+                                       (uintmax_t)pself->max_part_size);
+       return FALSE;
+    }
+
+    return TRUE;
 }
 
 static ssize_t 
@@ -165,7 +166,8 @@ taper_mem_port_source_read (TaperSource * pself, void * buf, size_t count) {
     } else {
         int read_result;
         if (selfp->retry_buffer == NULL) {
-            setup_retry_buffer(self);
+            if (!setup_retry_buffer(self))
+               return -1;
         }
 
         count = MIN(count, pself->max_part_size - selfp->buffer_len);
index 5aa02f56db2f67126253df0c0e87b77048be411d..7dc062e1bc609a5688840edbbc4ad0843dc1671d 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Amanda, The Advanced Maryland Automatic Network Disk Archiver
- * Copyright (c) 2006 Zmanda Inc.
+ * Copyright (c) 2005-2008 Zmanda Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
index e4666d4da053fd45dc1899883416e80a949c1a7e..e0d11735879295110c970232ad9782c0302eb1cc 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Amanda, The Advanced Maryland Automatic Network Disk Archiver
- * Copyright (c) 2006 Zmanda Inc.
+ * Copyright (c) 2005-2008 Zmanda Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -53,7 +53,7 @@ taper_port_source_get_type (void)
             NULL
         };
         
-        type = g_type_register_static (TAPER_TYPE_SOURCE, "TaperPortSource",
+        type = g_type_register_static (TAPER_SOURCE_TYPE, "TaperPortSource",
                                        &info, (GTypeFlags)0);
     }
     
@@ -73,7 +73,7 @@ static void taper_port_source_class_init (TaperPortSourceClass * c) {
     TaperSourceClass *taper_source_class = (TaperSourceClass *)c;
     GObjectClass *g_object_class = (GObjectClass*)c;
     
-    parent_class = g_type_class_ref (TAPER_TYPE_SOURCE);
+    parent_class = g_type_class_ref (TAPER_SOURCE_TYPE);
 
     taper_source_class->read = taper_port_source_read;
     taper_source_class->is_partial = taper_port_source_is_partial;
@@ -87,14 +87,14 @@ static void taper_port_source_class_init (TaperPortSourceClass * c) {
 static void check_first_header(TaperPortSource * self) {
     TaperSource * pself = (TaperSource*)self;
     char buf[DISK_BLOCK_BYTES];
-    int result;
+    size_t result;
     dumpfile_t * rval;
     
     if (G_LIKELY(pself->first_header != NULL)) {
         return;
     }
     
-    result = fullread(self->socket_fd, buf, DISK_BLOCK_BYTES);
+    result = full_read(self->socket_fd, buf, DISK_BLOCK_BYTES);
     if (result != DISK_BLOCK_BYTES) {
         return;
     }
@@ -175,22 +175,25 @@ static ssize_t taper_port_source_read (TaperSource * pself, void * buf,
 
 static gboolean
 taper_port_source_is_partial(TaperSource * pself) {
-    cmd_t cmd;
-    struct cmdargs cmdargs;
+    struct cmdargs *cmdargs;
+    gboolean result;
     TaperPortSource * self = (TaperPortSource*)pself;
 
     g_return_val_if_fail(self->socket_fd < 0, FALSE);
 
     /* Query DRIVER about partial dump. */
     putresult(DUMPER_STATUS, "%s\n", pself->driver_handle);
-    cmd = getcmd(&cmdargs);
-    if (cmd == FAILED) {
-        return TRUE;
-    } else if (cmd == DONE) {
-        return FALSE;
+    cmdargs = getcmd();
+    if (cmdargs->cmd == FAILED) {
+        result = TRUE;
+    } else if (cmdargs->cmd == DONE) {
+        result = FALSE;
     } else {
         error("Driver gave invalid response "
               "to query DUMPER-STATUS.\n");
         g_assert_not_reached();
     }
+
+    free_cmdargs(cmdargs);
+    return result;
 }
index 155fbf1f6e76d46d9a69219f19a71576312da750..b424d7eeafa87e70cca59ed25bf82742ad020649 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Amanda, The Advanced Maryland Automatic Network Disk Archiver
- * Copyright (c) 2006 Zmanda Inc.
+ * Copyright (c) 2005-2008 Zmanda Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
index ff731a6f4d52231d31bb62e9075c5ceda7f0af1c..1a39269e7c4adc48dad5e2690c6078bbba61327c 100644 (file)
@@ -8,9 +8,9 @@ typedef struct {
 } tape_info_t;
 
 /* A ConsumerFunctor. */
-static int size_limited_consumer(gpointer user_data, queue_buffer_t * buffer) {
+static ssize_t size_limited_consumer(gpointer user_data, queue_buffer_t * buffer) {
     tape_info_t * info = user_data;
-    int result;
+    ssize_t result;
     
     result = info->consumer(info->consumer_data, buffer);
 
@@ -25,7 +25,7 @@ int main(int argc, char ** argv) {
     TaperSource * source;
     tape_info_t info;
     
-    g_type_init();
+    glib_init();
 
     switch (argc) {
     default:
index f0d3205a9a9b54f7f1f4216ddf2ab90044682b63..20e7f0c976fb3709b2cd6f55fa0921b3dd71a4c3 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Amanda, The Advanced Maryland Automatic Network Disk Archiver
- * Copyright (c) 2006 Zmanda Inc.
+ * Copyright (c) 2005-2008 Zmanda Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -34,6 +34,7 @@ static gboolean default_taper_source_seek_to_part_start(TaperSource * self);
 static gboolean default_taper_source_get_end_of_data(TaperSource * self);
 static gboolean default_taper_source_get_end_of_part(TaperSource * self);
 static dumpfile_t * default_taper_source_get_first_header(TaperSource * self);
+static char* default_taper_source_get_errmsg(TaperSource * self);
 
 /* pointer to the class of our parent */
 static GObjectClass *parent_class = NULL;
@@ -70,11 +71,9 @@ static void taper_source_finalize(GObject * obj_self) {
     if (G_OBJECT_CLASS(parent_class)->finalize)
         G_OBJECT_CLASS(parent_class)->finalize(obj_self);
 
-    if (self->first_header)
-        amfree(self->first_header);
-
-    if (self->driver_handle)
-        amfree(self->driver_handle);
+    dumpfile_free(self->first_header);
+    amfree(self->driver_handle);
+    amfree(self->errmsg);
 }
 
 static void 
@@ -83,6 +82,7 @@ taper_source_init (TaperSource * o) {
     o->end_of_part = FALSE;
     o->max_part_size = G_MAXUINT64;
     o->first_header = NULL;
+    o->errmsg = NULL;
 }
 
 static void 
@@ -98,6 +98,7 @@ taper_source_class_init (TaperSourceClass * c) {
     c->get_end_of_data = default_taper_source_get_end_of_data;
     c->get_end_of_part = default_taper_source_get_end_of_part;
     c->get_first_header = default_taper_source_get_first_header;
+    c->get_errmsg = default_taper_source_get_errmsg;
     c->predict_parts = NULL;
 
     g_object_class->finalize = taper_source_finalize;
@@ -212,6 +213,10 @@ static dumpfile_t* default_taper_source_get_first_header(TaperSource * self) {
     return dumpfile_copy(self->first_header);
 }
 
+static char* default_taper_source_get_errmsg(TaperSource * self) {
+    return self->errmsg;
+}
+
 /* The rest of these functions are vtable dispatch stubs. */
 
 ssize_t 
@@ -219,7 +224,7 @@ taper_source_read (TaperSource * self, void * buf, size_t count)
 {
     TaperSourceClass *klass;
     g_return_val_if_fail (self != NULL, (ssize_t )-1);
-    g_return_val_if_fail (TAPER_IS_SOURCE (self), (ssize_t )-1);
+    g_return_val_if_fail (IS_TAPER_SOURCE (self), (ssize_t )-1);
     g_return_val_if_fail (buf != NULL, (ssize_t )-1);
     g_return_val_if_fail (count > 0, (ssize_t )-1);
 
@@ -240,7 +245,7 @@ taper_source_get_end_of_data (TaperSource * self)
 {
     TaperSourceClass *klass;
     g_return_val_if_fail (self != NULL, TRUE);
-    g_return_val_if_fail (TAPER_IS_SOURCE (self), TRUE);
+    g_return_val_if_fail (IS_TAPER_SOURCE (self), TRUE);
 
     klass = TAPER_SOURCE_GET_CLASS(self);
     
@@ -254,7 +259,7 @@ taper_source_get_end_of_part (TaperSource * self)
 {
     TaperSourceClass *klass;
     g_return_val_if_fail (self != NULL, TRUE);
-    g_return_val_if_fail (TAPER_IS_SOURCE (self), TRUE);
+    g_return_val_if_fail (IS_TAPER_SOURCE (self), TRUE);
 
     klass = TAPER_SOURCE_GET_CLASS(self);
     
@@ -268,7 +273,7 @@ taper_source_get_first_header (TaperSource * self)
 {
     TaperSourceClass *klass;
     g_return_val_if_fail (self != NULL, NULL);
-    g_return_val_if_fail (TAPER_IS_SOURCE (self), NULL);
+    g_return_val_if_fail (IS_TAPER_SOURCE (self), NULL);
 
     klass = TAPER_SOURCE_GET_CLASS(self);
     
@@ -277,10 +282,24 @@ taper_source_get_first_header (TaperSource * self)
     return (*klass->get_first_header)(self);
 }
 
+char *
+taper_source_get_errmsg (TaperSource * self)
+{
+    TaperSourceClass *klass;
+    g_return_val_if_fail (self != NULL, NULL);
+    g_return_val_if_fail (IS_TAPER_SOURCE (self), NULL);
+
+    klass = TAPER_SOURCE_GET_CLASS(self);
+    
+    g_return_val_if_fail(klass->get_errmsg != NULL, NULL);
+
+    return (*klass->get_errmsg)(self);
+}
+
 int taper_source_predict_parts(TaperSource * self) {
     TaperSourceClass *klass;
     g_return_val_if_fail (self != NULL, -1);
-    g_return_val_if_fail (TAPER_IS_SOURCE (self), -1);
+    g_return_val_if_fail (IS_TAPER_SOURCE (self), -1);
 
     klass = TAPER_SOURCE_GET_CLASS(self);
     
@@ -296,7 +315,7 @@ taper_source_seek_to_part_start (TaperSource * self)
 {
     TaperSourceClass *klass;
     g_return_val_if_fail (self != NULL, (gboolean )0);
-    g_return_val_if_fail (TAPER_IS_SOURCE (self), (gboolean )0);
+    g_return_val_if_fail (IS_TAPER_SOURCE (self), (gboolean )0);
     klass = TAPER_SOURCE_GET_CLASS(self);
     
     if(klass->seek_to_part_start)
@@ -310,7 +329,7 @@ taper_source_start_new_part (TaperSource * self)
 {
     TaperSourceClass *klass;
     g_return_if_fail (self != NULL);
-    g_return_if_fail (TAPER_IS_SOURCE (self));
+    g_return_if_fail (IS_TAPER_SOURCE (self));
     klass = TAPER_SOURCE_GET_CLASS(self);
     
     if(klass->start_new_part)
@@ -322,7 +341,7 @@ taper_source_is_partial (TaperSource * self)
 {
     TaperSourceClass *klass;
     g_return_val_if_fail (self != NULL, FALSE);
-    g_return_val_if_fail (TAPER_IS_SOURCE (self), FALSE);
+    g_return_val_if_fail (IS_TAPER_SOURCE (self), FALSE);
     g_return_val_if_fail (taper_source_get_end_of_data(self), FALSE);
     klass = TAPER_SOURCE_GET_CLASS(self);
     
@@ -334,12 +353,12 @@ taper_source_is_partial (TaperSource * self)
 
 producer_result_t taper_source_producer(gpointer data,
                                         queue_buffer_t * buffer,
-                                        int hint_size) {
+                                        size_t hint_size) {
     TaperSource * source;
-    int result;
+    ssize_t result;
 
     source = data;
-    g_assert(TAPER_IS_SOURCE(source));
+    g_assert(IS_TAPER_SOURCE(source));
 
     buffer->offset = 0;
     if (buffer->data == NULL) {
index 37d0f7a3147c0aa939177727fb4412147759c690..5bcee151e32bbf41733e7eb5b30ffbb94e8ef2d8 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Amanda, The Advanced Maryland Automatic Network Disk Archiver
- * Copyright (c) 2006 Zmanda Inc.
+ * Copyright (c) 2005-2008 Zmanda Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
 /*
  * Type checking and casting macros
  */
-#define TAPER_TYPE_SOURCE      (taper_source_get_type())
+#define TAPER_SOURCE_TYPE      (taper_source_get_type())
 #define TAPER_SOURCE(obj)      G_TYPE_CHECK_INSTANCE_CAST((obj), taper_source_get_type(), TaperSource)
 #define TAPER_SOURCE_CONST(obj)        G_TYPE_CHECK_INSTANCE_CAST((obj), taper_source_get_type(), TaperSource const)
 #define TAPER_SOURCE_CLASS(klass)      G_TYPE_CHECK_CLASS_CAST((klass), taper_source_get_type(), TaperSourceClass)
-#define TAPER_IS_SOURCE(obj)   G_TYPE_CHECK_INSTANCE_TYPE((obj), taper_source_get_type ())
+#define IS_TAPER_SOURCE(obj)   G_TYPE_CHECK_INSTANCE_TYPE((obj), taper_source_get_type ())
 
 #define TAPER_SOURCE_GET_CLASS(obj)    G_TYPE_INSTANCE_GET_CLASS((obj), taper_source_get_type(), TaperSourceClass)
 
@@ -60,6 +60,7 @@ struct _TaperSource {
     guint64 max_part_size; /* protected */
     dumpfile_t * first_header;
     char * driver_handle;
+    char * errmsg;
 };
 
 /*
@@ -75,6 +76,7 @@ struct _TaperSourceClass {
     gboolean (* get_end_of_data)(TaperSource * self);
     gboolean (* get_end_of_part)(TaperSource * self);
     dumpfile_t * (* get_first_header)(TaperSource * self);
+    char * (* get_errmsg)(TaperSource * self);
     int (* predict_parts)(TaperSource * self);
 };
 
@@ -89,6 +91,7 @@ ssize_t       taper_source_read       (TaperSource * self,
 gboolean       taper_source_get_end_of_data    (TaperSource * self);
 gboolean       taper_source_get_end_of_part    (TaperSource * self);
 dumpfile_t *    taper_source_get_first_header   (TaperSource * self);
+char *          taper_source_get_errmsg         (TaperSource * self);
 /* Returns -1 for an unknown number of splits, or a positive integer if the
  * number of splits is exactly known. Should never return zero. */
 int             taper_source_predict_parts      (TaperSource * self);
@@ -117,6 +120,6 @@ TaperSource * taper_source_new(char * handle,
    device-src/queueing.h. */
 producer_result_t taper_source_producer(gpointer taper_source,
                                         queue_buffer_t * buffer,
-                                        int hint_size);
+                                        size_t hint_size);
 
 #endif
index d5b72af25578559da2f06619a78911551d6060ce..fed6a33a114669e298fc29f75b2d5664e385c3a6 100644 (file)
 #include "taperscan.h"
 #include "taper-source.h"
 #include "timestamp.h"
-#include "token.h"
+#include "util.h"
 #include "version.h"
+#include "queueing.h"
+#include "device-queueing.h"
 
 /* FIXME: This should not be here. */
 #define CONNECT_TIMEOUT (2*60)
@@ -58,6 +60,9 @@ typedef struct {
     char * next_tape_label;
     char * next_tape_device;
     taper_scan_tracker_t * taper_scan_tracker;
+    char * last_errmsg;
+    off_t  total_bytes;
+    int have_changer;
 } taper_state_t;
 
 typedef struct {
@@ -79,12 +84,15 @@ static void init_taper_state(taper_state_t* state) {
     state->device = NULL;
     state->driver_start_time = NULL;
     state->taper_scan_tracker = taper_scan_tracker_new();
+    state->last_errmsg = NULL;
+    state->total_bytes = 0;
 }
 
 static void cleanup(taper_state_t * state) {
     amfree(state->driver_start_time);
     amfree(state->next_tape_label);
     amfree(state->next_tape_device);
+    amfree(state->last_errmsg);
     taper_scan_tracker_free(state->taper_scan_tracker);
     if (state->device != NULL) {
         g_object_unref(state->device);
@@ -107,19 +115,18 @@ static void free_dump_info(dump_info_t * info) {
 /* Validate that a command has the proper number of arguments, and
    print a meaningful error message if not. It returns only if the
    check is successful. */
-static void validate_args(cmd_t cmd, struct cmdargs * args,
+static void validate_args(struct cmdargs * cmdargs,
                           char ** argnames) {
-    int i;
-    
-    for (i = 0; argnames[i] != NULL; i ++) {
-        if (i > args->argc) {
-            error("error [taper %s: not enough args: %s]",
-                  cmdstr[cmd], argnames[i]);
-        }
+    int len = g_strv_length(argnames);
+
+    if (len > cmdargs->argc) {
+       error("error [taper %s: not enough args; first missing arg is %s]",
+             cmdstr[cmdargs->cmd], argnames[cmdargs->argc]);
     }
-    if (i < args->argc) {
+
+    if (len < cmdargs->argc) {
         error("error [taper %s: Too many args: Got %d, expected %d.]",
-              cmdstr[cmd], args->argc, i);
+              cmdstr[cmdargs->cmd], cmdargs->argc, len);
     }
 }
 
@@ -143,7 +150,7 @@ static gboolean open_read_socket(dump_info_t * info, char * split_diskbuffer,
                       strerror(save_errno),
                       "]",
                       NULL);
-        q = squote(m);
+        q = quote_string(m);
         putresult(TAPE_ERROR, "%s %s\n", info->handle, q);
         log_add(L_FAIL, "%s %s %s %d %s",
                 info->hostname, qdiskname, info->timestamp,
@@ -167,7 +174,7 @@ static gboolean open_read_socket(dump_info_t * info, char * split_diskbuffer,
                       strerror(save_errno),
                       "]",
                       NULL);
-        q = squote(m);
+        q = quote_string(m);
         putresult(TAPE_ERROR, "%s %s\n", info->handle, q);
         log_add(L_FAIL, "%s %s %s %d %s",
                 info->hostname, qdiskname, info->timestamp,
@@ -190,7 +197,7 @@ static gboolean open_read_socket(dump_info_t * info, char * split_diskbuffer,
                       strerror(save_errno),
                       "]",
                       NULL);
-        q = squote(m);
+        q = quote_string(m);
         putresult(TAPE_ERROR, "%s %s\n", info->handle, q);
         log_add(L_FAIL, "%s %s %s %d %s",
                 info->hostname, qdiskname, info->timestamp,
@@ -221,8 +228,8 @@ typedef struct {
 /* A ConsumerFunctor. This consumer just passes its arguments on to a
    second consumer, but counts the number of bytes successfully
    written. */
-static int counting_consumer(gpointer user_data, queue_buffer_t * buffer) {
-    int result;
+static ssize_t counting_consumer(gpointer user_data, queue_buffer_t * buffer) {
+    ssize_t result;
     CountingConsumerData * data = user_data;
 
     result = data->next_consumer(data->next_consumer_data, buffer);
@@ -265,7 +272,7 @@ static gboolean simple_taper_scan(taper_state_t * state,
                 state->driver_start_time);
         if (result == 3) {
             log_add(L_INFO,
-            _("Will write new label `%s' to new (previously non-amanda) tape"),
+            _("Will write new label `%s' to new tape"),
                     *label);
         }
 
@@ -324,8 +331,8 @@ static gboolean find_new_tape(taper_state_t * state, dump_info_t * dump) {
     GThread * tape_search = NULL;
     tape_search_request_t search_request;
     gboolean use_threads;
+    struct cmdargs *cmdargs;
     cmd_t cmd;
-    struct cmdargs args;
 
     if (state->device != NULL) {
         return TRUE;
@@ -343,7 +350,9 @@ static gboolean find_new_tape(taper_state_t * state, dump_info_t * dump) {
     }
     
     putresult(REQUEST_NEW_TAPE, "%s\n", dump->handle);
-    cmd = getcmd(&args);
+    cmdargs = getcmd();
+    cmd = cmdargs->cmd;
+
     switch (cmd) {
     default:
         g_fprintf(stderr, "taper: Got odd message from driver, expected NEW-TAPE or NO-NEW-TAPE.\n");
@@ -359,10 +368,13 @@ static gboolean find_new_tape(taper_state_t * state, dump_info_t * dump) {
         if (search_result) {
             /* We don't say NEW_TAPE until we actually write the label. */
            amfree(search_request.errmsg);
+           free_cmdargs(cmdargs);
             return TRUE;
         } else {
             putresult(NO_NEW_TAPE, "%s\n", dump->handle);
             log_taper_scan_errmsg(search_request.errmsg);
+           log_add(L_ERROR, "no-tape [%s]", "No more writable valid tape found");
+           free_cmdargs(cmdargs);
             return FALSE;
         }
     }
@@ -371,8 +383,12 @@ static gboolean find_new_tape(taper_state_t * state, dump_info_t * dump) {
         if (use_threads) {
             g_thread_join(tape_search);
         }
+       log_add(L_ERROR, "no-tape [%s]", cmdargs->argv[1]);
+       state->last_errmsg = stralloc(cmdargs->argv[1]);
+       free_cmdargs(cmdargs);
         return FALSE;
     }
+    /* NOTREACHED */
 }
 
 /* Returns TRUE if the old volume details are not the same as the new ones. */
@@ -400,6 +416,8 @@ update_tapelist(
 {
     char *tapelist_name = NULL;
     char *tapelist_name_old = NULL;
+    tape_t *tp;
+    char *comment = NULL;
 
     tapelist_name = config_dir_relative(getconf_str(CNF_TAPELIST));
     if (state->cur_tape == 0) {
@@ -411,20 +429,36 @@ update_tapelist(
                                      ".today.", cur_str, NULL);
     }
 
+   if (read_tapelist(tapelist_name) != 0) {
+        log_add(L_INFO, "pid-done %ld", (long)getpid());
+        error("could not load tapelist \"%s\"", tapelist_name);
+        /*NOTREACHED*/
+    }
+
+    /* make a copy of the tapelist file */
     if (write_tapelist(tapelist_name_old)) {
+        log_add(L_INFO, "pid-done %ld", (long)getpid());
        error("could not write tapelist: %s", strerror(errno));
        /*NOTREACHED*/
     }
     amfree(tapelist_name_old);
 
+    /* get a copy of the comment, before freeing the old record */
+    tp = lookup_tapelabel(state->device->volume_label);
+    if (tp && tp->comment)
+       comment = stralloc(tp->comment);
+
+    /* edit the tapelist and rewrite it */
     remove_tapelabel(state->device->volume_label);
     add_tapelabel(state->driver_start_time,
-                  state->device->volume_label);
+                  state->device->volume_label,
+                 comment);
     if (write_tapelist(tapelist_name)) {
        error("could not write tapelist: %s", strerror(errno));
        /*NOTREACHED*/
     }
     amfree(tapelist_name);
+    amfree(comment);
 }
 
 /* Find and label a new tape, if one is not already open. Returns TRUE
@@ -434,7 +468,8 @@ static gboolean find_and_label_new_tape(taper_state_t * state,
     if (state->device != NULL) {
         return TRUE;
     }
-    
+    state->total_bytes = 0;
     if (!find_new_tape(state, dump_info)) {
         return FALSE;
     }
@@ -447,25 +482,29 @@ static gboolean label_new_tape(taper_state_t * state, dump_info_t * dump_info) {
     char *old_volume_time = NULL;
     tape_search_request_t request;
     gboolean search_result;
-    ReadLabelStatusFlags status;
+    DeviceStatusFlags status;
 
     /* If we got here, it means that we have found a tape to label and
      * have gotten permission from the driver to write it. But we
      * still can say NO-NEW-TAPE if a problem shows up, and must still
      * say NEW-TAPE if one doesn't. */
 
+    amfree(state->last_errmsg);
     state->device = device_open(state->next_tape_device);
+    g_assert(state->device != NULL);
     amfree(state->next_tape_device);
-    if (state->device == NULL)
+
+    if (state->device->status != DEVICE_STATUS_SUCCESS)
        goto skip_volume;
 
-    device_set_startup_properties_from_config(state->device);
+    if (!device_configure(state->device, TRUE))
+       goto skip_volume;
 
     /* if we have an error, and are sure it isn't just an unlabeled volume,
      * then skip this volume */
     status = device_read_label(state->device);
-    if ((status & ~READ_LABEL_STATUS_VOLUME_UNLABELED) &&
-       !(status & READ_LABEL_STATUS_VOLUME_UNLABELED))
+    if ((status & ~DEVICE_STATUS_VOLUME_UNLABELED) &&
+       !(status & DEVICE_STATUS_VOLUME_UNLABELED))
        goto skip_volume;
 
     old_volume_name = g_strdup(state->device->volume_label);
@@ -477,8 +516,9 @@ static gboolean label_new_tape(taper_state_t * state, dump_info_t * dump_info) {
 
         /* Something broke, see if we can tell if the volume was erased or
          * not. */
-        g_fprintf(stderr, "taper: Error writing label %s to device %s.\n",
-                state->next_tape_label, state->device->device_name);
+        g_fprintf(stderr, "taper: Error writing label %s to device %s: %s.\n",
+                state->next_tape_label, state->device->device_name,
+               device_error_or_status(state->device));
 
         if (!device_finish(state->device))
            goto request_new_volume;
@@ -486,17 +526,17 @@ static gboolean label_new_tape(taper_state_t * state, dump_info_t * dump_info) {
        /* This time, if we can't read the label, assume we've overwritten
         * the volume or otherwise corrupted it */
        status = device_read_label(state->device);
-       if ((status & ~READ_LABEL_STATUS_VOLUME_UNLABELED) &&
-           !(status & READ_LABEL_STATUS_VOLUME_UNLABELED))
+       if ((status & ~DEVICE_STATUS_VOLUME_UNLABELED) &&
+           !(status & DEVICE_STATUS_VOLUME_UNLABELED))
            goto request_new_volume;
 
         tape_used = check_volume_changed(state->device, old_volume_name, 
                                          old_volume_time);
-        if (tape_used) {
+
+        if (tape_used)
            goto request_new_volume;
-        } else {
+        else
            goto skip_volume;
-        }
     }
 
     amfree(old_volume_name);
@@ -506,6 +546,12 @@ static gboolean label_new_tape(taper_state_t * state, dump_info_t * dump_info) {
     update_tapelist(state);
     state->cur_tape++;
 
+    if (state->have_changer &&
+       changer_label("UNKNOWN", state->device->volume_label) != 0) {
+       error(_("couldn't update barcode database"));
+       /*NOTREACHED*/
+    }
+
     log_add(L_START, "datestamp %s label %s tape %d",
             state->driver_start_time, state->device->volume_label,
             state->cur_tape);
@@ -517,20 +563,27 @@ static gboolean label_new_tape(taper_state_t * state, dump_info_t * dump_info) {
 request_new_volume:
     /* Tell the driver we overwrote this volume, even if it was empty, and request
      * a new volume. */
-    if (state->device) {
-        g_object_unref(state->device);
-        state->device = NULL;
-    }
+    if (state->device)
+       state->last_errmsg = newstralloc(state->last_errmsg, device_error_or_status(state->device));
+    else
+       state->last_errmsg = newstralloc(state->last_errmsg, "(unknown)");
 
     putresult(NEW_TAPE, "%s %s\n", dump_info->handle,
              state->next_tape_label);
     if (old_volume_name) {
-       log_add(L_WARNING, "Problem writing label '%s' to volume %s, "
-               "volume may be erased.\n",
-               state->next_tape_label, old_volume_name);
+       log_add(L_WARNING, "Problem writing label '%s' to volume %s "
+               "(volume may be erased): %s\n",
+               state->next_tape_label, old_volume_name,
+               state->last_errmsg);
     } else {
-       log_add(L_WARNING, "Problem writing label '%s' to new volume, "
-               "volume may be erased.\n", state->next_tape_label);
+       log_add(L_WARNING, "Problem writing label '%s' to new volume "
+               "(volume may be erased): %s\n", state->next_tape_label,
+               state->last_errmsg);
+    }
+
+    if (state->device) {
+        g_object_unref(state->device);
+        state->device = NULL;
     }
 
     amfree(state->next_tape_label);
@@ -542,18 +595,24 @@ request_new_volume:
 skip_volume:
     /* grab a new volume without talking to the driver again -- we do this if we're
      * confident we didn't overwrite the last tape we got. */
-    if (state->device) {
-        g_object_unref(state->device);
-        state->device = NULL;
-    }
+    if (state->device)
+       state->last_errmsg = newstralloc(state->last_errmsg, device_error_or_status(state->device));
+    else
+       state->last_errmsg = newstralloc(state->last_errmsg, "(unknown)");
 
     if (old_volume_name) {
-       log_add(L_WARNING, "Problem writing label '%s' to volume '%s', "
-               "old volume data intact\n",
-               state->next_tape_label, old_volume_name);
+       log_add(L_WARNING, "Problem writing label '%s' to volume '%s' "
+               "(old volume data intact): %s\n",
+               state->next_tape_label, old_volume_name, state->last_errmsg);
     } else {
-       log_add(L_WARNING, "Problem writing label '%s' to new volume, "
-               "old volume data intact\n", state->next_tape_label);
+       log_add(L_WARNING, "Problem writing label '%s' to new volume "
+               "(old volume data intact): %s\n", state->next_tape_label,
+               state->last_errmsg);
+    }
+
+    if (state->device) {
+        g_object_unref(state->device);
+        state->device = NULL;
     }
 
     amfree(state->next_tape_label);
@@ -591,13 +650,14 @@ static void find_completion_tags(dump_info_t * dump_info, /* IN */
 
 /* Put an L_PARTIAL message to the logfile. */
 static void put_partial_log(dump_info_t * dump_info, double dump_time,
-                            guint64 dump_kbytes) {
+                            guint64 dump_kbytes, char *errstr) {
     char * qdiskname = quote_string(dump_info->diskname);
 
-    log_add(L_PARTIAL, "%s %s %s %d %d [sec %f kb %ju kps %f] \"\"",
+    log_add(L_PARTIAL, "%s %s %s %d %d [sec %f kb %ju kps %f] %s",
             dump_info->hostname, qdiskname, dump_info->timestamp,
             dump_info->current_part, dump_info->level, dump_time,
-            (uintmax_t)dump_kbytes, dump_kbytes / dump_time);
+            (uintmax_t)dump_kbytes, dump_kbytes / dump_time,
+           errstr);
     amfree(qdiskname);
 }
 
@@ -627,6 +687,7 @@ static gboolean finish_part_attempt(taper_state_t * taper_state,
                   dump_info->handle, taper_state->device->volume_label,
                   taper_state->device->file, (uintmax_t)part_kbytes, part_time,
                  (uintmax_t)part_kbytes, part_kbps);
+       taper_state->total_bytes += run_bytes;
         
         if (taper_source_get_end_of_data(dump_info->source)) {
             cmd_t result_cmd;
@@ -666,21 +727,36 @@ static gboolean finish_part_attempt(taper_state_t * taper_state,
         int file_number = taper_state->device->file;
         double dump_time, dump_kbps;
         guint64 dump_kbytes;
+       char *producer_errstr = quote_string(
+                                  taper_source_get_errmsg(dump_info->source));
+       char *consumer_errstr = quote_string(
+                                  device_error(taper_state->device));
+
+        log_add(L_PARTPARTIAL,
+                "%s %d %s %s %s %d/%d %d [sec %f kb %ju kps %f] %s",
+                volume_label, file_number, dump_info->hostname, qdiskname,
+                dump_info->timestamp, dump_info->current_part,
+                taper_source_predict_parts(dump_info->source),
+                dump_info->level, part_time, (uintmax_t)part_kbytes, part_kbps,
+               consumer_errstr);
+       log_add(L_INFO, "tape %s kb %lld fm %d [OK]\n",
+               volume_label,
+               (long long)((taper_state->total_bytes+(off_t)1023) / (off_t)1024),
+               taper_state->device->file);
 
         /* A problem occured. */
         if (queue_result & QUEUE_CONSUMER_ERROR) {
+           /* Make a note if this was EOM (we treat EOM the same as any other error,
+            * so it's just for debugging purposes */
+           if (taper_state->device->is_eof)
+               g_debug("device %s ran out of space", taper_state->device->device_name);
+
             /* Close the device. */
             device_finish(taper_state->device);
             g_object_unref(taper_state->device);
             taper_state->device = NULL;
         }
         
-        log_add(L_PARTPARTIAL,
-                "%s %d %s %s %s %d/%d %d [sec %f kb %ju kps %f] \"\"",
-                volume_label, file_number, dump_info->hostname, qdiskname,
-                dump_info->timestamp, dump_info->current_part,
-                taper_source_predict_parts(dump_info->source),
-                dump_info->level, part_time, (uintmax_t)part_kbytes, part_kbps);
         amfree(volume_label);
         
         if ((queue_result & QUEUE_CONSUMER_ERROR) &&
@@ -703,12 +779,21 @@ static gboolean finish_part_attempt(taper_state_t * taper_state,
         
         putresult(PARTIAL,
                   "%s INPUT-%s TAPE-%s "
-                  "\"[sec %f kb %ju kps %f]\" \"\" \"\"\n",
+                  "\"[sec %f kb %ju kps %f]\" %s %s\n",
                   dump_info->handle,
                   (queue_result & QUEUE_PRODUCER_ERROR) ? "ERROR" : "GOOD",
                   (queue_result & QUEUE_CONSUMER_ERROR) ? "ERROR" : "GOOD",
-                  dump_time, (uintmax_t)dump_kbytes, dump_kbps);
-        put_partial_log(dump_info, dump_time, dump_kbytes);
+                  dump_time, (uintmax_t)dump_kbytes, dump_kbps,
+                 producer_errstr, consumer_errstr);
+       if (queue_result & QUEUE_CONSUMER_ERROR) {
+            put_partial_log(dump_info, dump_time, dump_kbytes,
+                           consumer_errstr);
+       } else {
+            put_partial_log(dump_info, dump_time, dump_kbytes,
+                           producer_errstr);
+       }
+       amfree(producer_errstr);
+       amfree(consumer_errstr);
     }
 
     amfree(qdiskname);
@@ -744,7 +829,15 @@ static dumpfile_t * munge_headers(dump_info_t * dump_info) {
    happen with the first (or only) part of a file, but it could also
    happen with an intermediate part of a split dump. dump_bytes
    is 0 if this is the first part of a dump. */
-static void bail_no_volume(dump_info_t * dump_info) {
+static void bail_no_volume(
+    dump_info_t *dump_info,
+    char *errmsg)
+{
+    char *errstr;
+    if (errmsg)
+       errstr = quote_string(errmsg);
+    else
+       errstr = quote_string("no new tape");
     if (dump_info->total_bytes > 0) {
         /* Second or later part of a split dump, so PARTIAL message. */
         double dump_time = g_timeval_to_double(dump_info->total_time);
@@ -752,20 +845,21 @@ static void bail_no_volume(dump_info_t * dump_info) {
         double dump_kbps = dump_kbytes / dump_time;
         putresult(PARTIAL,
                   "%s INPUT-GOOD TAPE-ERROR "
-                  "\"[sec %f kb %ju kps %f]\" \"\" \"no new tape\"\n",
+                  "\"[sec %f kb %ju kps %f]\" \"\" %s\n",
                   dump_info->handle, 
-                  dump_time, (uintmax_t)dump_kbytes, dump_kbps);
-        put_partial_log(dump_info, dump_time, dump_kbytes);
+                  dump_time, (uintmax_t)dump_kbytes, dump_kbps, errstr);
+        put_partial_log(dump_info, dump_time, dump_kbytes, errstr);
     } else {
         char * qdiskname = quote_string(dump_info->diskname);
         putresult(FAILED,
-                  "%s INPUT-GOOD TAPE-ERROR \"\" \"No new tape.\"\n",
-                  dump_info->handle);
-        log_add(L_FAIL, "%s %s %s %d \"No new tape.\"",
+                  "%s INPUT-GOOD TAPE-ERROR \"\" %s\n",
+                  dump_info->handle, errstr);
+        log_add(L_FAIL, "%s %s %s %d %s",
                 dump_info->hostname, qdiskname, dump_info->timestamp,
-                dump_info->level);
+                dump_info->level, errstr);
        amfree(qdiskname);
     }
+    amfree(errstr);
 }
 
 /* Link up the TaperSource with the Device, including retries etc. */
@@ -789,28 +883,40 @@ static void run_device_output(taper_state_t * taper_state,
         this_header = munge_headers(dump_info);
         if (this_header == NULL) {
             char * qdiskname = quote_string(dump_info->diskname);
+           char * errstr = taper_source_get_errmsg(dump_info->source);
+           if (!errstr)
+               errstr = "Failed reading dump header.";
+           errstr = quote_string(errstr);
             putresult(FAILED,
-             "%s INPUT-ERROR TAPE-GOOD \"Failed reading dump header.\" \"\"\n",
-                      dump_info->handle);
-            log_add(L_FAIL, "%s %s %s %d \"Failed reading dump header.\"",
+             "%s INPUT-ERROR TAPE-GOOD %s \"\"\n",
+                      dump_info->handle, errstr);
+            log_add(L_FAIL, "%s %s %s %d %s",
                     dump_info->hostname, qdiskname, dump_info->timestamp,
-                    dump_info->level);
+                    dump_info->level, errstr);
             amfree(qdiskname);
+           amfree(errstr);
             return;
         }            
 
         if (!find_and_label_new_tape(taper_state, dump_info)) {
-            bail_no_volume(dump_info);
-           amfree(this_header);
+            bail_no_volume(dump_info, taper_state->last_errmsg);
+           dumpfile_free(this_header);
             return;
         }
 
-        if (!device_start_file(taper_state->device, this_header)) {
-            bail_no_volume(dump_info);
-           amfree(this_header);
-            return;
+       while (!device_start_file(taper_state->device, this_header)) {
+            /* Close the device. */
+            device_finish(taper_state->device);
+            g_object_unref(taper_state->device);
+            taper_state->device = NULL;
+
+            if (!find_and_label_new_tape(taper_state, dump_info)) {
+               bail_no_volume(dump_info, taper_state->last_errmsg);
+               dumpfile_free(this_header);
+               return;
+            }
         }
-       amfree(this_header);
+       dumpfile_free(this_header);
 
         bzero(&val, sizeof(val));
         if (!device_property_get(taper_state->device, PROPERTY_STREAMING, &val)
@@ -839,7 +945,7 @@ static void run_device_output(taper_state_t * taper_state,
             }
         } else if (getconf_seen(CNF_TAPEBUFS)) {
             max_memory = getconf_int(CNF_TAPEBUFS) *
-                device_write_max_size(taper_state->device);
+                taper_state->device->block_size;
         } else {
             /* Use default. */
             max_memory = getconf_size(CNF_DEVICE_OUTPUT_BUFFER_SIZE);
@@ -850,16 +956,14 @@ static void run_device_output(taper_state_t * taper_state,
              dump_info->source,
              counting_consumer,
              &consumer_data,
-             device_write_max_size(taper_state->device), max_memory,
+             taper_state->device->block_size, max_memory,
              streaming_mode);
 
         g_get_current_time(&end_time);
         run_time = timesub(end_time, start_time);
 
-        /* The device_write_consumer may have closed the file with a short
-         * write, so we only finish here if it needs it. */
-        if (taper_state->device->in_file &&
-            !device_finish_file(taper_state->device)) {
+        /* The device_write_consumer leaves the file open, so close it now. */
+        if (!device_finish_file(taper_state->device)) {
             queue_result = queue_result | QUEUE_CONSUMER_ERROR;
         }
 
@@ -877,52 +981,52 @@ static void process_port_write(taper_state_t * state,
     guint64 splitsize;
     guint64 fallback_splitsize;
     char * split_diskbuffer;
-    char * argnames[] = {"command",               /* 1 */
-                        "handle",                /* 2 */
-                         "hostname",              /* 3 */
-                         "diskname",              /* 4 */
-                         "level",                 /* 5 */
-                         "datestamp",             /* 6 */
-                         "splitsize",             /* 7 */
-                         "split_diskbuffer",      /* 8 */
-                         "fallback_splitsize",    /* 9 */
+    char * argnames[] = {"command",               /* 0 */
+                        "handle",                /* 1 */
+                         "hostname",              /* 2 */
+                         "diskname",              /* 3 */
+                         "level",                 /* 4 */
+                         "datestamp",             /* 5 */
+                         "splitsize",             /* 6 */
+                         "split_diskbuffer",      /* 7 */
+                         "fallback_splitsize",    /* 8 */
                           NULL };
 
-    validate_args(PORT_WRITE, cmdargs, argnames);
+    validate_args(cmdargs, argnames);
 
-    dump_state.handle = g_strdup(cmdargs->argv[2]);
-    dump_state.hostname = g_strdup(cmdargs->argv[3]);
-    dump_state.diskname = unquote_string(cmdargs->argv[4]);
+    dump_state.handle = g_strdup(cmdargs->argv[1]);
+    dump_state.hostname = g_strdup(cmdargs->argv[2]);
+    dump_state.diskname = g_strdup(cmdargs->argv[3]);
     
     errno = 0;
-    dump_state.level = strtol(cmdargs->argv[5], NULL, 10);
+    dump_state.level = strtol(cmdargs->argv[4], NULL, 10);
     if (errno != 0) {
         error("error [taper PORT-WRITE: Invalid dump level %s]",
-              cmdargs->argv[5]);
+              cmdargs->argv[4]);
         g_assert_not_reached();
     }
     
-    dump_state.timestamp = strdup(cmdargs->argv[6]);
+    dump_state.timestamp = strdup(cmdargs->argv[5]);
 
     errno = 0;
-    splitsize = g_ascii_strtoull(cmdargs->argv[7], NULL, 10);
+    splitsize = g_ascii_strtoull(cmdargs->argv[6], NULL, 10);
     if (errno != 0) {
         error("error [taper PORT-WRITE: Invalid splitsize %s]",
-              cmdargs->argv[7]);
+              cmdargs->argv[6]);
         g_assert_not_reached();
     }
     
-    if (strcmp(cmdargs->argv[8], "NULL") == 0) {
+    if (strcmp(cmdargs->argv[7], "NULL") == 0) {
         split_diskbuffer = NULL;
     } else {
-        split_diskbuffer = g_strdup(cmdargs->argv[8]);
+        split_diskbuffer = g_strdup(cmdargs->argv[7]);
     }
     
     errno = 0;
-    fallback_splitsize = g_ascii_strtoull(cmdargs->argv[9], NULL, 10);
+    fallback_splitsize = g_ascii_strtoull(cmdargs->argv[8], NULL, 10);
     if (errno != 0) {
         error("error [taper PORT-WRITE: Invalid fallback_splitsize %s]",
-              cmdargs->argv[9]);
+              cmdargs->argv[8]);
         g_assert_not_reached();
     }
 
@@ -948,38 +1052,38 @@ static void process_file_write(taper_state_t * state,
     dump_info_t dump_state;
     char * holding_disk_file;
     guint64 splitsize;
-    char * argnames[] = {"command",               /* 1 */
-                        "handle",                /* 2 */
-                         "filename",              /* 3 */
-                         "hostname",              /* 4 */
-                         "diskname",              /* 5 */
-                         "level",                 /* 6 */
-                         "datestamp",             /* 7 */
-                         "splitsize",             /* 8 */
+    char * argnames[] = {"command",               /* 0 */
+                        "handle",                /* 1 */
+                         "filename",              /* 2 */
+                         "hostname",              /* 3 */
+                         "diskname",              /* 4 */
+                         "level",                 /* 5 */
+                         "datestamp",             /* 6 */
+                         "splitsize",             /* 7 */
                           NULL };
 
-    validate_args(FILE_WRITE, cmdargs, argnames);
+    validate_args(cmdargs, argnames);
 
-    dump_state.handle = g_strdup(cmdargs->argv[2]);
-    holding_disk_file = unquote_string(cmdargs->argv[3]);
-    dump_state.hostname = g_strdup(cmdargs->argv[4]);
-    dump_state.diskname = unquote_string(cmdargs->argv[5]);
+    dump_state.handle = g_strdup(cmdargs->argv[1]);
+    holding_disk_file = g_strdup(cmdargs->argv[2]);
+    dump_state.hostname = g_strdup(cmdargs->argv[3]);
+    dump_state.diskname = g_strdup(cmdargs->argv[4]);
     
     errno = 0;
-    dump_state.level = strtol(cmdargs->argv[6], NULL, 10);
+    dump_state.level = strtol(cmdargs->argv[5], NULL, 10);
     if (errno != 0) {
         error("error [taper FILE-WRITE: Invalid dump level %s]",
               cmdargs->argv[5]);
         g_assert_not_reached();
     }
     
-    dump_state.timestamp = strdup(cmdargs->argv[7]);
+    dump_state.timestamp = strdup(cmdargs->argv[6]);
 
     errno = 0;
-    splitsize = g_ascii_strtoull(cmdargs->argv[8], NULL, 10);
+    splitsize = g_ascii_strtoull(cmdargs->argv[7], NULL, 10);
     if (errno != 0) {
         error("error [taper FILE-WRITE: Invalid splitsize %s]",
-              cmdargs->argv[8]);
+              cmdargs->argv[7]);
         g_assert_not_reached();
     }
 
@@ -1011,9 +1115,7 @@ static gboolean send_quitting(taper_state_t * state) {
 /* This function recieves the START_TAPER command from driver, and
    returns the attached timestamp. */
 static gboolean find_first_tape(taper_state_t * state) {
-    cmd_t cmd;
-    /* Note: cmdargs.argv is never freed. In the entire Amanda codebase. */
-    struct cmdargs cmdargs;
+    struct cmdargs *cmdargs;
     tape_search_request_t search_request;
     GThread * tape_search = NULL;
     gboolean use_threads;
@@ -1030,12 +1132,12 @@ static gboolean find_first_tape(taper_state_t * state) {
                                       &search_request, TRUE, NULL);
     }
 
-    cmd = getcmd(&cmdargs);
+    cmdargs = getcmd();
 
-    switch (cmd) {
+    switch (cmdargs->cmd) {
     case START_TAPER: {
         gboolean search_result;
-        state->driver_start_time = strdup(cmdargs.argv[2]);
+        state->driver_start_time = strdup(cmdargs->argv[1]);
         if (use_threads) {
             search_result = GPOINTER_TO_INT(g_thread_join(tape_search));
         } else {
@@ -1063,6 +1165,7 @@ static gboolean find_first_tape(taper_state_t * state) {
            }
         }
        amfree(search_request.errmsg);
+       free_cmdargs(cmdargs);
         return TRUE;
     }
     case QUIT:
@@ -1070,9 +1173,10 @@ static gboolean find_first_tape(taper_state_t * state) {
         if (use_threads) {
             g_thread_join(tape_search);
         }
+       free_cmdargs(cmdargs);
         return send_quitting(state);
     default:
-        error("error [file_reader_side cmd %d argc %d]", cmd, cmdargs.argc);
+        error("error [file_reader_side cmd %d argc %d]", cmdargs->cmd, cmdargs->argc);
     }
 
     g_assert_not_reached();
@@ -1081,13 +1185,12 @@ static gboolean find_first_tape(taper_state_t * state) {
 /* In running mode (not startup mode), get a command from driver and
    deal with it. */
 static gboolean process_driver_command(taper_state_t * state) {
-    cmd_t cmd;
-    struct cmdargs cmdargs;
+    struct cmdargs *cmdargs;
     char * q;
 
     /* This will return QUIT if driver has died. */
-    cmd = getcmd(&cmdargs);
-    switch (cmd) {
+    cmdargs = getcmd();
+    switch (cmdargs->cmd) {
     case PORT_WRITE:
         /*
          * PORT-WRITE
@@ -1100,7 +1203,7 @@ static gboolean process_driver_command(taper_state_t * state) {
          *   splitsize
          *   split_diskbuffer
          */
-        process_port_write(state, &cmdargs);
+        process_port_write(state, cmdargs);
         break;
         
     case FILE_WRITE:
@@ -1115,16 +1218,21 @@ static gboolean process_driver_command(taper_state_t * state) {
          *   datestamp
          *   splitsize
          */
-        process_file_write(state, &cmdargs);
+        process_file_write(state, cmdargs);
         break;
         
     case QUIT:
+       free_cmdargs(cmdargs);
+       if (state->device && state->device->volume_label) {
+           log_add(L_INFO, "tape %s kb %lld fm %d [OK]\n",
+                   state->device->volume_label,
+                   (long long)((state->total_bytes+(off_t)1023) / (off_t)1024),
+                   state->device->file);
+       }
         return send_quitting(state);
     default:
-        if (cmdargs.argc >= 1) {
-            q = squote(cmdargs.argv[1]);
-        } else if (cmdargs.argc >= 0) {
-            q = squote(cmdargs.argv[0]);
+        if (cmdargs->argc >= 1) {
+            q = quote_string(cmdargs->argv[0]);
         } else {
             q = stralloc("(no input?)");
         }
@@ -1132,13 +1240,13 @@ static gboolean process_driver_command(taper_state_t * state) {
         amfree(q);
         break;
     }
+    free_cmdargs(cmdargs);
 
     return TRUE;
 }
 
 int main(int argc, char ** argv) {
     char * tapelist_name;
-    int have_changer;
     taper_state_t state;
     config_overwrites_t *cfg_ovr = NULL;
     char *cfg_opt = NULL;
@@ -1178,28 +1286,35 @@ int main(int argc, char ** argv) {
     }
     if (argc > 1)
        cfg_opt = argv[1];
-    config_init(CONFIG_INIT_EXPLICIT_NAME | CONFIG_INIT_USE_CWD | CONFIG_INIT_FATAL,
-               cfg_opt);
+    config_init(CONFIG_INIT_EXPLICIT_NAME | CONFIG_INIT_USE_CWD, cfg_opt);
     apply_config_overwrites(cfg_ovr);
 
+    if (config_errors(NULL) >= CFGERR_ERRORS) {
+       g_critical(_("errors processing config file"));
+    }
+
     safe_cd();
 
     set_logerror(logerror);
 
     check_running_as(RUNNING_AS_DUMPUSER);
 
-    dbrename(config_name, DBG_SUBDIR_SERVER);
+    dbrename(get_config_name(), DBG_SUBDIR_SERVER);
+
+    log_add(L_INFO, "%s pid %ld", get_pname(), (long)getpid());
 
     tapelist_name = config_dir_relative(getconf_str(CNF_TAPELIST));
 
     if (read_tapelist(tapelist_name) != 0) {
+       log_add(L_INFO, "pid-done %ld", (long)getpid());
         error("could not load tapelist \"%s\"", tapelist_name);
         g_assert_not_reached();
     }
     amfree(tapelist_name);
 
-    have_changer = changer_init();
-    if (have_changer < 0) {
+    state.have_changer = changer_init();
+    if (state.have_changer < 0) {
+       log_add(L_INFO, "pid-done %ld", (long)getpid());
         error("changer initialization failed: %s", strerror(errno));
         g_assert_not_reached();
     }
@@ -1209,9 +1324,11 @@ int main(int argc, char ** argv) {
     state.cur_tape = 0;
     
     if (!find_first_tape(&state)) {
+       log_add(L_INFO, "pid-done %ld", (long)getpid());
         return EXIT_SUCCESS;
     }
 
     while (process_driver_command(&state));
+    log_add(L_INFO, "pid-done %ld", (long)getpid());
     return EXIT_SUCCESS;
 }
index 8e7ae41ec14c369fc28295450fe39b1548aff9da..8e513736bcd4bb3409f38b56df7eecf01e8344c6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005 Zmanda Inc.  All Rights Reserved.
+ * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
  * 
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 as published
@@ -14,8 +14,8 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  * 
- * Contact information: Zmanda Inc, 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 /*
@@ -80,7 +80,7 @@ int scan_read_label(
 {
     Device * device;
     char *labelstr;
-    ReadLabelStatusFlags label_status;
+    DeviceStatusFlags device_status;
 
     g_return_val_if_fail(dev != NULL, -1);
 
@@ -88,77 +88,74 @@ int scan_read_label(
        *error_message = stralloc("");
 
     *label = *timestamp = NULL;
-
     device = device_open(dev);
-    if (device == NULL ) {
+    g_assert(device != NULL);
+
+    if (device->status != DEVICE_STATUS_SUCCESS ) {
         *error_message = newvstrallocf(*error_message,
-                                       _("%sError opening device %s.\n"),
-                                       *error_message, dev);
+                                       _("%sError opening device %s: %s.\n"),
+                                       *error_message, dev,
+                                      device_error_or_status(device));
+       g_object_unref(device);
         amfree(*timestamp);
         amfree(*label);
         return -1;
     }
 
-    device_set_startup_properties_from_config(device);
+    if (!device_configure(device, TRUE)) {
+        *error_message = newvstrallocf(*error_message,
+                                       _("%sError configuring device %s: %s.\n"),
+                                       *error_message, dev,
+                                      device_error_or_status(device));
+       g_object_unref(device);
+        amfree(*timestamp);
+        amfree(*label);
+        return -1;
+    }
 
-    label_status = device_read_label(device);
-    g_assert((device->volume_label != NULL) ==
-             (label_status == READ_LABEL_STATUS_SUCCESS));
+    device_status = device_read_label(device);
     
-    if (device->volume_label != NULL) { 
+    if (device_status == DEVICE_STATUS_SUCCESS && device->volume_label != NULL) {
         *label = g_strdup(device->volume_label);
         *timestamp = strdup(device->volume_time);
-    } else if (label_status & READ_LABEL_STATUS_VOLUME_UNLABELED) {
-        g_object_unref(device);
+    } else if (device_status & DEVICE_STATUS_VOLUME_UNLABELED) {
         if (!getconf_seen(CNF_LABEL_NEW_TAPES)) {
             *error_message = newvstrallocf(*error_message,
-                                           _("%sFound a non-amanda tape.\n"),
+                                           _("%sFound an empty or non-amanda tape.\n"),
                                            *error_message);
-
+           g_object_unref(device);
             return -1;
         }
+
+       /* If we got a header, but the Device doesn't think it's labeled, then this
+        * tape probably has some data on it, so refuse to automatically label it */
+       if (device->volume_header && device->volume_header->type != F_EMPTY) {
+            *error_message = newvstrallocf(*error_message,
+                      _("%sFound a non-amanda tape; check and relabel it with 'amlabel -f'\n"),
+                      *error_message);
+           g_object_unref(device);
+            return -1;
+       }
+       g_object_unref(device);
+
         *label = find_brand_new_tape_label();
         if (*label != NULL) {
             *timestamp = stralloc("X");
             *error_message = newvstrallocf(*error_message,
-                     _("%sFound a non-amanda tape, will label it `%s'.\n"),
+                     _("%sFound an empty tape, will label it `%s'.\n"),
                                            *error_message, *label);
 
             return 3;
         }
         *error_message = newvstrallocf(*error_message,
-                 _("%sFound a non-amanda tape, but have no labels left.\n"),
+                 _("%sFound an empty tape, but have no labels left.\n"),
                                        *error_message);
 
         return -1;
     } else {
         char * label_errstr;
-        char ** label_strv =
-            g_flags_nick_to_strv(label_status, READ_LABEL_STATUS_FLAGS_TYPE);
-        
-        switch (g_strv_length(label_strv)) {
-        case 0:
-            label_errstr = g_strdup(_("Unknown error reading volume label.\n"));
-            break;
-
-        case 1:
-            label_errstr =
-                g_strdup_printf(_("Error reading volume label: %s\n"),
-                                *label_strv);
-           break;
-
-        default:
-            {
-                char * tmp_str = g_english_strjoinv(label_strv, "or");
-                label_errstr =
-                    g_strdup_printf(_("Error reading label: One of %s\n"),
-                                    tmp_str);
-                g_free(tmp_str);
-            }
-        }
-        
-        g_strfreev(label_strv);
-
+       label_errstr = g_strdup_printf(_("Error reading label: %s.\n"),
+                                      device_error_or_status(device));
         *error_message = newvstralloc(*error_message, *error_message,
                                       label_errstr, NULL);
         g_free(label_errstr);
@@ -210,7 +207,7 @@ int scan_read_label(
             *error_message = 
                 newvstrallocf(*error_message,
                               _("%sTape with label %s is still active" 
-                                " and cannot be overwriten.\n"),
+                                " and cannot be overwritten.\n"),
                               *error_message, *label);
             return -1;
         }
index 301401815873a1d2d6cb5b66ff0f1cf9de510d0f..b57ec9a5eccb03a1eb4e540e57e9aa70527e652c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005 Zmanda Inc.  All Rights Reserved.
+ * Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
  * 
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 as published
@@ -14,8 +14,8 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  * 
- * Contact information: Zmanda Inc, 505 N Mathlida Ave, Suite 120
- * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ * Contact information: Zmanda Inc, 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
  */
 
 /*
diff --git a/tape-src/Makefile.am b/tape-src/Makefile.am
deleted file mode 100644 (file)
index e12918b..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-# Makefile for Amanda tape library.
-
-include $(top_srcdir)/config/automake/precompile.am
-
-INCLUDES =     -I$(top_builddir)/common-src \
-               -I$(top_srcdir)/common-src   \
-               -I$(top_srcdir)/gnulib
-
-AM_CFLAGS = $(AMANDA_WARNING_CFLAGS)
-AM_LDFLAGS = $(AMANDA_STATIC_LDFLAGS)
-
-LINT=@AMLINT@
-LINTFLAGS=@AMLINTFLAGS@
-
-amlib_LTLIBRARIES =    libamtape.la
-LIB_EXTENSION = la
-
-sbin_PROGRAMS=          ammt amdd amtapetype
-
-libamtape_la_SOURCES =         output-file.c \
-                       output-null.c \
-                       output-rait.c \
-                       output-tape.c \
-                       tapeio.c
-
-libamtape_la_LDFLAGS =  -release $(VERSION)
-libamtape_la_LIBADD = ../common-src/libamanda.$(LIB_EXTENSION)
-
-###
-# Because libamanda includes routines (e.g. regex) provided by some system
-# libraries, and because of the way libtool sets up the command line, we
-# need to list libamanda twice here, first to override the system library
-# routines, and second to pick up any references in the other libraries.
-###
-
-LDADD =        ../common-src/libamanda.$(LIB_EXTENSION) \
-       libamtape.$(LIB_EXTENSION) \
-       ../common-src/libamanda.$(LIB_EXTENSION)
-
-# used for testing only
-
-TEST_PROGS =           amtapeio
-
-EXTRA_PROGRAMS =       $(TEST_PROGS)
-
-CLEANFILES = *.test.c
-
-amtapetype_SOURCES = tapetype.c
-
-noinst_HEADERS =       \
-                       output-file.h \
-                       output-null.h \
-                       output-rait.h \
-                       output-tape.h \
-                       tapeio.h
-
-INSTALLPERMS_exec = \
-       dest=$(sbindir) chown=amanda $(sbin_PROGRAMS) $(sbin_SCRIPTS) \
-       dest=$(amlibexecdir) chown=amanda $(amlibexec_PROGRAMS) $(amlibexec_SCRIPTS)
-
-amtapeio_SOURCES = amtapeio.test.c
-amtapeio_LDADD =       ../common-src/libamanda.$(LIB_EXTENSION) \
-                       libamtape.$(LIB_EXTENSION) \
-                       ../common-src/libamanda.$(LIB_EXTENSION)
-
-amtapeio.test.c: $(srcdir)/tapeio.c
-       echo '#define TEST' >$@
-       echo '#include "$<"' >>$@
-
-%.test.c: $(srcdir)/%.c
-       echo '#define TEST' >$@
-       echo '#include "$<"' >>$@
-
-tapetype:
-       @echo "Use amtapetype instead"
-
-lint:
-       @ for p in $(sbin_PROGRAMS); do                                         \
-               if [ $$p = "amtapetype" ]; then                                 \
-                       s="$(amtapetype_SOURCES)";                              \
-               else                                                            \
-                       s=$$p.c;                                                \
-               fi;                                                             \
-               f="$$s $(libamandad_la_SOURCES)";                               \
-               f="$$f "`(cd ../common-src; make listlibsrc 2>&1 > /dev/null)`; \
-               (cd ../common-src; make listlibsrc);                            \
-               f="$$f "`cat ../common-src/listlibsrc.output`;                  \
-               echo $(LINT) $$f;                                               \
-               $(LINT) $(LINTFLAGS) $(CPPFLAGS) $(DEFS) -I. -I$(top_builddir)/config   \
-                   $(INCLUDES) $$f;                                            \
-               if [ $$? -ne 0 ]; then                                          \
-                   exit 1;                                                     \
-               fi;                                                             \
-       done;                                                                   \
-        exit 0
-
-listlibsrc:
-       @ for p in $(libamtape_la_SOURCES); do  \
-               listlibsrcs="$$listlibsrcs `pwd`/$$p";          \
-       done;                                                   \
-       echo $$listlibsrcs > listlibsrc.output
diff --git a/tape-src/Makefile.in b/tape-src/Makefile.in
deleted file mode 100644 (file)
index 4a0c8ac..0000000
+++ /dev/null
@@ -1,1051 +0,0 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  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@
-
-# Makefile for Amanda tape library.
-
-# vim:ft=automake
-
-
-
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-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@
-target_triplet = @target@
-DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
-       $(srcdir)/Makefile.in \
-       $(top_srcdir)/config/automake/precompile.am
-sbin_PROGRAMS = ammt$(EXEEXT) amdd$(EXEEXT) amtapetype$(EXEEXT)
-EXTRA_PROGRAMS = $(am__EXEEXT_1)
-subdir = tape-src
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps =  \
-       $(top_srcdir)/config/macro-archive/ac_define_dir.m4 \
-       $(top_srcdir)/config/macro-archive/ac_prog_perl_version.m4 \
-       $(top_srcdir)/config/macro-archive/ac_prog_swig.m4 \
-       $(top_srcdir)/config/macro-archive/ax_compare_version.m4 \
-       $(top_srcdir)/config/macro-archive/docbook-dtd.m4 \
-       $(top_srcdir)/config/macro-archive/docbook-xslt-min.m4 \
-       $(top_srcdir)/config/macro-archive/docbook-xslt.m4 \
-       $(top_srcdir)/config/macro-archive/xsltproc.m4 \
-       $(top_srcdir)/config/amanda/amplot.m4 \
-       $(top_srcdir)/config/amanda/bsd-security.m4 \
-       $(top_srcdir)/config/amanda/bsdtcp-security.m4 \
-       $(top_srcdir)/config/amanda/bsdudp-security.m4 \
-       $(top_srcdir)/config/amanda/changer.m4 \
-       $(top_srcdir)/config/amanda/components.m4 \
-       $(top_srcdir)/config/amanda/compress.m4 \
-       $(top_srcdir)/config/amanda/config.m4 \
-       $(top_srcdir)/config/amanda/debugging.m4 \
-       $(top_srcdir)/config/amanda/defaults.m4 \
-       $(top_srcdir)/config/amanda/devprefix.m4 \
-       $(top_srcdir)/config/amanda/dirs.m4 \
-       $(top_srcdir)/config/amanda/documentation.m4 \
-       $(top_srcdir)/config/amanda/dumpers.m4 \
-       $(top_srcdir)/config/amanda/flags.m4 \
-       $(top_srcdir)/config/amanda/flock.m4 \
-       $(top_srcdir)/config/amanda/funcs.m4 \
-       $(top_srcdir)/config/amanda/getfsent.m4 \
-       $(top_srcdir)/config/amanda/i18n.m4 \
-       $(top_srcdir)/config/amanda/ipv6.m4 \
-       $(top_srcdir)/config/amanda/krb4-security.m4 \
-       $(top_srcdir)/config/amanda/krb5-security.m4 \
-       $(top_srcdir)/config/amanda/lfs.m4 \
-       $(top_srcdir)/config/amanda/libs.m4 \
-       $(top_srcdir)/config/amanda/net.m4 \
-       $(top_srcdir)/config/amanda/progs.m4 \
-       $(top_srcdir)/config/amanda/readdir.m4 \
-       $(top_srcdir)/config/amanda/readline.m4 \
-       $(top_srcdir)/config/amanda/rsh-security.m4 \
-       $(top_srcdir)/config/amanda/s3-device.m4 \
-       $(top_srcdir)/config/amanda/shmem.m4 \
-       $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \
-       $(top_srcdir)/config/amanda/ssh-security.m4 \
-       $(top_srcdir)/config/amanda/summary.m4 \
-       $(top_srcdir)/config/amanda/swig.m4 \
-       $(top_srcdir)/config/amanda/syshacks.m4 \
-       $(top_srcdir)/config/amanda/tape.m4 \
-       $(top_srcdir)/config/amanda/types.m4 \
-       $(top_srcdir)/config/amanda/userid.m4 \
-       $(top_srcdir)/config/amanda/version.m4 \
-       $(top_srcdir)/config/gnulib/alloca.m4 \
-       $(top_srcdir)/config/gnulib/arpa_inet_h.m4 \
-       $(top_srcdir)/config/gnulib/base64.m4 \
-       $(top_srcdir)/config/gnulib/eoverflow.m4 \
-       $(top_srcdir)/config/gnulib/extensions.m4 \
-       $(top_srcdir)/config/gnulib/float_h.m4 \
-       $(top_srcdir)/config/gnulib/fsusage.m4 \
-       $(top_srcdir)/config/gnulib/getaddrinfo.m4 \
-       $(top_srcdir)/config/gnulib/gettimeofday.m4 \
-       $(top_srcdir)/config/gnulib/gnulib-comp.m4 \
-       $(top_srcdir)/config/gnulib/include_next.m4 \
-       $(top_srcdir)/config/gnulib/inet_ntop.m4 \
-       $(top_srcdir)/config/gnulib/intmax_t.m4 \
-       $(top_srcdir)/config/gnulib/lock.m4 \
-       $(top_srcdir)/config/gnulib/longlong.m4 \
-       $(top_srcdir)/config/gnulib/malloc.m4 \
-       $(top_srcdir)/config/gnulib/mkdtemp.m4 \
-       $(top_srcdir)/config/gnulib/netinet_in_h.m4 \
-       $(top_srcdir)/config/gnulib/onceonly_2_57.m4 \
-       $(top_srcdir)/config/gnulib/physmem.m4 \
-       $(top_srcdir)/config/gnulib/safe-read.m4 \
-       $(top_srcdir)/config/gnulib/safe-write.m4 \
-       $(top_srcdir)/config/gnulib/snprintf.m4 \
-       $(top_srcdir)/config/gnulib/socklen.m4 \
-       $(top_srcdir)/config/gnulib/sockpfaf.m4 \
-       $(top_srcdir)/config/gnulib/ssize_t.m4 \
-       $(top_srcdir)/config/gnulib/stdbool.m4 \
-       $(top_srcdir)/config/gnulib/stdint.m4 \
-       $(top_srcdir)/config/gnulib/stdio_h.m4 \
-       $(top_srcdir)/config/gnulib/stdlib_h.m4 \
-       $(top_srcdir)/config/gnulib/strdup.m4 \
-       $(top_srcdir)/config/gnulib/string_h.m4 \
-       $(top_srcdir)/config/gnulib/sys_socket_h.m4 \
-       $(top_srcdir)/config/gnulib/sys_stat_h.m4 \
-       $(top_srcdir)/config/gnulib/sys_time_h.m4 \
-       $(top_srcdir)/config/gnulib/tempname.m4 \
-       $(top_srcdir)/config/gnulib/ulonglong.m4 \
-       $(top_srcdir)/config/gnulib/unistd_h.m4 \
-       $(top_srcdir)/config/gnulib/vasnprintf.m4 \
-       $(top_srcdir)/config/gnulib/visibility.m4 \
-       $(top_srcdir)/config/gnulib/wchar.m4 \
-       $(top_srcdir)/config/gettext-macros/gettext.m4 \
-       $(top_srcdir)/config/gettext-macros/iconv.m4 \
-       $(top_srcdir)/config/gettext-macros/inttypes_h.m4 \
-       $(top_srcdir)/config/gettext-macros/lib-ld.m4 \
-       $(top_srcdir)/config/gettext-macros/lib-link.m4 \
-       $(top_srcdir)/config/gettext-macros/lib-prefix.m4 \
-       $(top_srcdir)/config/gettext-macros/longlong.m4 \
-       $(top_srcdir)/config/gettext-macros/nls.m4 \
-       $(top_srcdir)/config/gettext-macros/po.m4 \
-       $(top_srcdir)/config/gettext-macros/progtest.m4 \
-       $(top_srcdir)/config/gettext-macros/size_max.m4 \
-       $(top_srcdir)/config/gettext-macros/stdint_h.m4 \
-       $(top_srcdir)/config/gettext-macros/wchar_t.m4 \
-       $(top_srcdir)/config/gettext-macros/wint_t.m4 \
-       $(top_srcdir)/config/gettext-macros/xsize.m4 \
-       $(top_srcdir)/config/libtool.m4 $(top_srcdir)/configure.in
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-       $(ACLOCAL_M4)
-mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
-CONFIG_HEADER = $(top_builddir)/config/config.h
-CONFIG_CLEAN_FILES =
-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|^.*/||'`;
-am__installdirs = "$(DESTDIR)$(amlibdir)" "$(DESTDIR)$(sbindir)"
-amlibLTLIBRARIES_INSTALL = $(INSTALL)
-LTLIBRARIES = $(amlib_LTLIBRARIES)
-libamtape_la_DEPENDENCIES = ../common-src/libamanda.$(LIB_EXTENSION)
-am_libamtape_la_OBJECTS = output-file.lo output-null.lo output-rait.lo \
-       output-tape.lo tapeio.lo
-libamtape_la_OBJECTS = $(am_libamtape_la_OBJECTS)
-libamtape_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
-       $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
-       $(libamtape_la_LDFLAGS) $(LDFLAGS) -o $@
-am__EXEEXT_1 = amtapeio$(EXEEXT)
-sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
-PROGRAMS = $(sbin_PROGRAMS)
-amdd_SOURCES = amdd.c
-amdd_OBJECTS = amdd.$(OBJEXT)
-amdd_LDADD = $(LDADD)
-amdd_DEPENDENCIES = ../common-src/libamanda.$(LIB_EXTENSION) \
-       libamtape.$(LIB_EXTENSION) \
-       ../common-src/libamanda.$(LIB_EXTENSION)
-ammt_SOURCES = ammt.c
-ammt_OBJECTS = ammt.$(OBJEXT)
-ammt_LDADD = $(LDADD)
-ammt_DEPENDENCIES = ../common-src/libamanda.$(LIB_EXTENSION) \
-       libamtape.$(LIB_EXTENSION) \
-       ../common-src/libamanda.$(LIB_EXTENSION)
-am_amtapeio_OBJECTS = amtapeio.test.$(OBJEXT)
-amtapeio_OBJECTS = $(am_amtapeio_OBJECTS)
-amtapeio_DEPENDENCIES = ../common-src/libamanda.$(LIB_EXTENSION) \
-       libamtape.$(LIB_EXTENSION) \
-       ../common-src/libamanda.$(LIB_EXTENSION)
-am_amtapetype_OBJECTS = tapetype.$(OBJEXT)
-amtapetype_OBJECTS = $(am_amtapetype_OBJECTS)
-amtapetype_LDADD = $(LDADD)
-amtapetype_DEPENDENCIES = ../common-src/libamanda.$(LIB_EXTENSION) \
-       libamtape.$(LIB_EXTENSION) \
-       ../common-src/libamanda.$(LIB_EXTENSION)
-DEFAULT_INCLUDES = -I. -I$(top_builddir)/config@am__isrc@
-depcomp = $(SHELL) $(top_srcdir)/config/depcomp
-am__depfiles_maybe = depfiles
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-       --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
-       $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-       --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
-       $(LDFLAGS) -o $@
-SOURCES = $(libamtape_la_SOURCES) amdd.c ammt.c $(amtapeio_SOURCES) \
-       $(amtapetype_SOURCES)
-DIST_SOURCES = $(libamtape_la_SOURCES) amdd.c ammt.c \
-       $(amtapeio_SOURCES) $(amtapetype_SOURCES)
-HEADERS = $(noinst_HEADERS)
-ETAGS = etags
-CTAGS = ctags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-ALLOCA = @ALLOCA@
-ALLOCA_H = @ALLOCA_H@
-AMANDA_DBGDIR = @AMANDA_DBGDIR@
-AMANDA_DEBUG_DAYS = @AMANDA_DEBUG_DAYS@
-AMANDA_STATIC_LDFLAGS = @AMANDA_STATIC_LDFLAGS@
-AMANDA_TMPDIR = @AMANDA_TMPDIR@
-AMANDA_WARNING_CFLAGS = @AMANDA_WARNING_CFLAGS@
-AMLINT = @AMLINT@
-AMLINTFLAGS = @AMLINTFLAGS@
-AMPLOT_CAT_COMPRESS = @AMPLOT_CAT_COMPRESS@
-AMPLOT_CAT_GZIP = @AMPLOT_CAT_GZIP@
-AMPLOT_CAT_PACK = @AMPLOT_CAT_PACK@
-AMPLOT_COMPRESS = @AMPLOT_COMPRESS@
-AMTAR = @AMTAR@
-AR = @AR@
-ARPA_INET_H = @ARPA_INET_H@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-BASH = @BASH@
-BINARY_OWNER = @BINARY_OWNER@
-BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@
-BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@
-BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@
-BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@
-BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@
-CAT = @CAT@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
-CHIO = @CHIO@
-CHS = @CHS@
-CLIENT_LOGIN = @CLIENT_LOGIN@
-CLIENT_SCRIPTS_OPT = @CLIENT_SCRIPTS_OPT@
-COMPRESS = @COMPRESS@
-CONFIG_DIR = @CONFIG_DIR@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CURL_CONFIG = @CURL_CONFIG@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DD = @DD@
-DEFAULT_AMANDATES_FILE = @DEFAULT_AMANDATES_FILE@
-DEFAULT_CHANGER_DEVICE = @DEFAULT_CHANGER_DEVICE@
-DEFAULT_CONFIG = @DEFAULT_CONFIG@
-DEFAULT_SERVER = @DEFAULT_SERVER@
-DEFAULT_TAPE_DEVICE = @DEFAULT_TAPE_DEVICE@
-DEFAULT_TAPE_SERVER = @DEFAULT_TAPE_SERVER@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DOC_BUILD_DATE = @DOC_BUILD_DATE@
-DUMP = @DUMP@
-DUMPER_DIR = @DUMPER_DIR@
-ECHO = @ECHO@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EOVERFLOW = @EOVERFLOW@
-EXAMPLE_TAPEDEV = @EXAMPLE_TAPEDEV@
-EXEEXT = @EXEEXT@
-F77 = @F77@
-FFLAGS = @FFLAGS@
-FLOAT_H = @FLOAT_H@
-GETCONF = @GETCONF@
-GETTEXT = @GETTEXT@
-GLIB_CFLAGS = @GLIB_CFLAGS@
-GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
-GLIB_LIBS = @GLIB_LIBS@
-GLIB_MKENUMS = @GLIB_MKENUMS@
-GMSGFMT = @GMSGFMT@
-GMSGFMT_015 = @GMSGFMT_015@
-GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
-GNULIB_CHOWN = @GNULIB_CHOWN@
-GNULIB_DUP2 = @GNULIB_DUP2@
-GNULIB_FCHDIR = @GNULIB_FCHDIR@
-GNULIB_FFLUSH = @GNULIB_FFLUSH@
-GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
-GNULIB_FSEEK = @GNULIB_FSEEK@
-GNULIB_FSEEKO = @GNULIB_FSEEKO@
-GNULIB_FTELL = @GNULIB_FTELL@
-GNULIB_FTELLO = @GNULIB_FTELLO@
-GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@
-GNULIB_GETCWD = @GNULIB_GETCWD@
-GNULIB_GETDELIM = @GNULIB_GETDELIM@
-GNULIB_GETLINE = @GNULIB_GETLINE@
-GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
-GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
-GNULIB_LCHOWN = @GNULIB_LCHOWN@
-GNULIB_LSEEK = @GNULIB_LSEEK@
-GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@
-GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@
-GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@
-GNULIB_MBSCHR = @GNULIB_MBSCHR@
-GNULIB_MBSCSPN = @GNULIB_MBSCSPN@
-GNULIB_MBSLEN = @GNULIB_MBSLEN@
-GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@
-GNULIB_MBSNLEN = @GNULIB_MBSNLEN@
-GNULIB_MBSPBRK = @GNULIB_MBSPBRK@
-GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@
-GNULIB_MBSRCHR = @GNULIB_MBSRCHR@
-GNULIB_MBSSEP = @GNULIB_MBSSEP@
-GNULIB_MBSSPN = @GNULIB_MBSSPN@
-GNULIB_MBSSTR = @GNULIB_MBSSTR@
-GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@
-GNULIB_MEMMEM = @GNULIB_MEMMEM@
-GNULIB_MEMPCPY = @GNULIB_MEMPCPY@
-GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
-GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
-GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
-GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
-GNULIB_READLINK = @GNULIB_READLINK@
-GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@
-GNULIB_SLEEP = @GNULIB_SLEEP@
-GNULIB_SNPRINTF = @GNULIB_SNPRINTF@
-GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@
-GNULIB_STPCPY = @GNULIB_STPCPY@
-GNULIB_STPNCPY = @GNULIB_STPNCPY@
-GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
-GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
-GNULIB_STRDUP = @GNULIB_STRDUP@
-GNULIB_STRNDUP = @GNULIB_STRNDUP@
-GNULIB_STRNLEN = @GNULIB_STRNLEN@
-GNULIB_STRPBRK = @GNULIB_STRPBRK@
-GNULIB_STRSEP = @GNULIB_STRSEP@
-GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
-GNULIB_VASPRINTF = @GNULIB_VASPRINTF@
-GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@
-GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
-GNULIB_VSNPRINTF = @GNULIB_VSNPRINTF@
-GNULIB_VSPRINTF_POSIX = @GNULIB_VSPRINTF_POSIX@
-GNULIB_WCWIDTH = @GNULIB_WCWIDTH@
-GNUPLOT = @GNUPLOT@
-GNUTAR = @GNUTAR@
-GNUTAR_LISTED_INCREMENTAL_DIR = @GNUTAR_LISTED_INCREMENTAL_DIR@
-GOBJECT_QUERY = @GOBJECT_QUERY@
-GREP = @GREP@
-GZIP = @GZIP@
-HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@
-HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@
-HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@
-HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
-HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@
-HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
-HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@
-HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
-HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
-HAVE_DECL_STRNCASECMP = @HAVE_DECL_STRNCASECMP@
-HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
-HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
-HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
-HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
-HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
-HAVE_DUP2 = @HAVE_DUP2@
-HAVE_FSEEKO = @HAVE_FSEEKO@
-HAVE_FTELLO = @HAVE_FTELLO@
-HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
-HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
-HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
-HAVE_IO_H = @HAVE_IO_H@
-HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
-HAVE_LSTAT = @HAVE_LSTAT@
-HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@
-HAVE_MEMPCPY = @HAVE_MEMPCPY@
-HAVE_MKDTEMP = @HAVE_MKDTEMP@
-HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@
-HAVE_READLINK = @HAVE_READLINK@
-HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@
-HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
-HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
-HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
-HAVE_SLEEP = @HAVE_SLEEP@
-HAVE_STDINT_H = @HAVE_STDINT_H@
-HAVE_STPCPY = @HAVE_STPCPY@
-HAVE_STPNCPY = @HAVE_STPNCPY@
-HAVE_STRCASECMP = @HAVE_STRCASECMP@
-HAVE_STRCASESTR = @HAVE_STRCASESTR@
-HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
-HAVE_STRNDUP = @HAVE_STRNDUP@
-HAVE_STRPBRK = @HAVE_STRPBRK@
-HAVE_STRSEP = @HAVE_STRSEP@
-HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@
-HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
-HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
-HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
-HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
-HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
-HAVE_UNISTD_H = @HAVE_UNISTD_H@
-HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
-HAVE_VASPRINTF = @HAVE_VASPRINTF@
-HAVE_VISIBILITY = @HAVE_VISIBILITY@
-HAVE_WCHAR_H = @HAVE_WCHAR_H@
-HAVE_WINSOCK2_H = @HAVE_WINSOCK2_H@
-HAVE_WS2TCPIP_H = @HAVE_WS2TCPIP_H@
-HAVE__BOOL = @HAVE__BOOL@
-INCLUDE_NEXT = @INCLUDE_NEXT@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-INTLLIBS = @INTLLIBS@
-INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
-LDFLAGS = @LDFLAGS@
-LEX = @LEX@
-LEXLIB = @LEXLIB@
-LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
-LIBCURL = @LIBCURL@
-LIBCURL_CPPFLAGS = @LIBCURL_CPPFLAGS@
-LIBICONV = @LIBICONV@
-LIBINTL = @LIBINTL@
-LIBMULTITHREAD = @LIBMULTITHREAD@
-LIBOBJS = @LIBOBJS@
-LIBPTH = @LIBPTH@
-LIBS = @LIBS@
-LIBTHREAD = @LIBTHREAD@
-LIBTOOL = @LIBTOOL@
-LIBTOOL_DEPS = @LIBTOOL_DEPS@
-LN_S = @LN_S@
-LTLIBICONV = @LTLIBICONV@
-LTLIBINTL = @LTLIBINTL@
-LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
-LTLIBOBJS = @LTLIBOBJS@
-LTLIBPTH = @LTLIBPTH@
-LTLIBTHREAD = @LTLIBTHREAD@
-MAILER = @MAILER@
-MAKEINFO = @MAKEINFO@
-MAXTAPEBLOCKSIZE = @MAXTAPEBLOCKSIZE@
-MCUTIL = @MCUTIL@
-MKDIR_P = @MKDIR_P@
-MSGFMT = @MSGFMT@
-MSGFMT_015 = @MSGFMT_015@
-MSGMERGE = @MSGMERGE@
-MT = @MT@
-MTX = @MTX@
-MT_FILE_FLAG = @MT_FILE_FLAG@
-NETINET_IN_H = @NETINET_IN_H@
-NEXT_FLOAT_H = @NEXT_FLOAT_H@
-NEXT_NETINET_IN_H = @NEXT_NETINET_IN_H@
-NEXT_STDINT_H = @NEXT_STDINT_H@
-NEXT_STDIO_H = @NEXT_STDIO_H@
-NEXT_STDLIB_H = @NEXT_STDLIB_H@
-NEXT_STRING_H = @NEXT_STRING_H@
-NEXT_SYS_SOCKET_H = @NEXT_SYS_SOCKET_H@
-NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@
-NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@
-NEXT_UNISTD_H = @NEXT_UNISTD_H@
-NEXT_WCHAR_H = @NEXT_WCHAR_H@
-OBJEXT = @OBJEXT@
-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@
-PCAT = @PCAT@
-PERL = @PERL@
-PERLEXTLIBS = @PERLEXTLIBS@
-PERL_INC = @PERL_INC@
-PKG_CONFIG = @PKG_CONFIG@
-POSUB = @POSUB@
-PRINT = @PRINT@
-PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
-RANLIB = @RANLIB@
-READLINE_LIBS = @READLINE_LIBS@
-REPLACE_CHOWN = @REPLACE_CHOWN@
-REPLACE_FCHDIR = @REPLACE_FCHDIR@
-REPLACE_FFLUSH = @REPLACE_FFLUSH@
-REPLACE_FPRINTF = @REPLACE_FPRINTF@
-REPLACE_FSEEK = @REPLACE_FSEEK@
-REPLACE_FSEEKO = @REPLACE_FSEEKO@
-REPLACE_FTELL = @REPLACE_FTELL@
-REPLACE_FTELLO = @REPLACE_FTELLO@
-REPLACE_GETCWD = @REPLACE_GETCWD@
-REPLACE_GETLINE = @REPLACE_GETLINE@
-REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
-REPLACE_LCHOWN = @REPLACE_LCHOWN@
-REPLACE_LSEEK = @REPLACE_LSEEK@
-REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
-REPLACE_PRINTF = @REPLACE_PRINTF@
-REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
-REPLACE_SPRINTF = @REPLACE_SPRINTF@
-REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
-REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
-REPLACE_VPRINTF = @REPLACE_VPRINTF@
-REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
-REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
-REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
-RESTORE = @RESTORE@
-SAMBA_CLIENT = @SAMBA_CLIENT@
-SERVICE_SUFFIX = @SERVICE_SUFFIX@
-SETUID_GROUP = @SETUID_GROUP@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@
-SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
-SNAPSHOT_STAMP = @SNAPSHOT_STAMP@
-SORT = @SORT@
-SSH = @SSH@
-STDBOOL_H = @STDBOOL_H@
-STDINT_H = @STDINT_H@
-STRIP = @STRIP@
-SVN = @SVN@
-SWIG = @SWIG@
-SWIG_LIB = @SWIG_LIB@
-SYS_SOCKET_H = @SYS_SOCKET_H@
-SYS_STAT_H = @SYS_STAT_H@
-SYS_TIME_H = @SYS_TIME_H@
-USE_NLS = @USE_NLS@
-USE_VERSION_SUFFIXES = @USE_VERSION_SUFFIXES@
-VDUMP = @VDUMP@
-VERSION = @VERSION@
-VERSION_COMMENT = @VERSION_COMMENT@
-VERSION_MAJOR = @VERSION_MAJOR@
-VERSION_MINOR = @VERSION_MINOR@
-VERSION_PATCH = @VERSION_PATCH@
-VERSION_SUFFIX = @VERSION_SUFFIX@
-VRESTORE = @VRESTORE@
-VXDUMP = @VXDUMP@
-VXRESTORE = @VXRESTORE@
-WCHAR_H = @WCHAR_H@
-WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@
-WINT_T_SUFFIX = @WINT_T_SUFFIX@
-XFSDUMP = @XFSDUMP@
-XFSRESTORE = @XFSRESTORE@
-XGETTEXT = @XGETTEXT@
-XGETTEXT_015 = @XGETTEXT_015@
-XSLREL = @XSLREL@
-XSLTPROC = @XSLTPROC@
-XSLTPROC_FLAGS = @XSLTPROC_FLAGS@
-YACC = @YACC@
-YFLAGS = @YFLAGS@
-_libcurl_config = @_libcurl_config@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-amincludedir = @amincludedir@
-amlibdir = @amlibdir@
-amlibexecdir = @amlibexecdir@
-amperldir = @amperldir@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-gl_LIBOBJS = @gl_LIBOBJS@
-gl_LTLIBOBJS = @gl_LTLIBOBJS@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target = @target@
-target_alias = @target_alias@
-target_cpu = @target_cpu@
-target_os = @target_os@
-target_vendor = @target_vendor@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-INCLUDES = -I$(top_builddir)/common-src \
-               -I$(top_srcdir)/common-src   \
-               -I$(top_srcdir)/gnulib
-
-AM_CFLAGS = $(AMANDA_WARNING_CFLAGS)
-AM_LDFLAGS = $(AMANDA_STATIC_LDFLAGS)
-LINT = @AMLINT@
-LINTFLAGS = @AMLINTFLAGS@
-amlib_LTLIBRARIES = libamtape.la
-LIB_EXTENSION = la
-libamtape_la_SOURCES = output-file.c \
-                       output-null.c \
-                       output-rait.c \
-                       output-tape.c \
-                       tapeio.c
-
-libamtape_la_LDFLAGS = -release $(VERSION)
-libamtape_la_LIBADD = ../common-src/libamanda.$(LIB_EXTENSION)
-
-###
-# Because libamanda includes routines (e.g. regex) provided by some system
-# libraries, and because of the way libtool sets up the command line, we
-# need to list libamanda twice here, first to override the system library
-# routines, and second to pick up any references in the other libraries.
-###
-LDADD = ../common-src/libamanda.$(LIB_EXTENSION) \
-       libamtape.$(LIB_EXTENSION) \
-       ../common-src/libamanda.$(LIB_EXTENSION)
-
-
-# used for testing only
-TEST_PROGS = amtapeio
-CLEANFILES = *.test.c
-amtapetype_SOURCES = tapetype.c
-noinst_HEADERS = \
-                       output-file.h \
-                       output-null.h \
-                       output-rait.h \
-                       output-tape.h \
-                       tapeio.h
-
-INSTALLPERMS_exec = \
-       dest=$(sbindir) chown=amanda $(sbin_PROGRAMS) $(sbin_SCRIPTS) \
-       dest=$(amlibexecdir) chown=amanda $(amlibexec_PROGRAMS) $(amlibexec_SCRIPTS)
-
-amtapeio_SOURCES = amtapeio.test.c
-amtapeio_LDADD = ../common-src/libamanda.$(LIB_EXTENSION) \
-                       libamtape.$(LIB_EXTENSION) \
-                       ../common-src/libamanda.$(LIB_EXTENSION)
-
-all: all-am
-
-.SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(top_srcdir)/config/automake/precompile.am $(am__configure_deps)
-       @for dep in $?; do \
-         case '$(am__configure_deps)' in \
-           *$$dep*) \
-             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-               && exit 0; \
-             exit 1;; \
-         esac; \
-       done; \
-       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  tape-src/Makefile'; \
-       cd $(top_srcdir) && \
-         $(AUTOMAKE) --gnu  tape-src/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-       @case '$?' in \
-         *config.status*) \
-           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
-         *) \
-           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
-       esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure:  $(am__configure_deps)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-install-amlibLTLIBRARIES: $(amlib_LTLIBRARIES)
-       @$(NORMAL_INSTALL)
-       test -z "$(amlibdir)" || $(MKDIR_P) "$(DESTDIR)$(amlibdir)"
-       @list='$(amlib_LTLIBRARIES)'; for p in $$list; do \
-         if test -f $$p; then \
-           f=$(am__strip_dir) \
-           echo " $(LIBTOOL) --mode=install $(amlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(amlibdir)/$$f'"; \
-           $(LIBTOOL) --mode=install $(amlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(amlibdir)/$$f"; \
-         else :; fi; \
-       done
-
-uninstall-amlibLTLIBRARIES:
-       @$(NORMAL_UNINSTALL)
-       @list='$(amlib_LTLIBRARIES)'; for p in $$list; do \
-         p=$(am__strip_dir) \
-         echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(amlibdir)/$$p'"; \
-         $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(amlibdir)/$$p"; \
-       done
-
-clean-amlibLTLIBRARIES:
-       -test -z "$(amlib_LTLIBRARIES)" || rm -f $(amlib_LTLIBRARIES)
-       @list='$(amlib_LTLIBRARIES)'; for p in $$list; do \
-         dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
-         test "$$dir" != "$$p" || dir=.; \
-         echo "rm -f \"$${dir}/so_locations\""; \
-         rm -f "$${dir}/so_locations"; \
-       done
-libamtape.la: $(libamtape_la_OBJECTS) $(libamtape_la_DEPENDENCIES) 
-       $(libamtape_la_LINK) -rpath $(amlibdir) $(libamtape_la_OBJECTS) $(libamtape_la_LIBADD) $(LIBS)
-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 \
-            || test -f $$p1 \
-         ; then \
-           f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
-          echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \
-          $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(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:
-       @list='$(sbin_PROGRAMS)'; for p in $$list; do \
-         f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
-         echo " rm -f $$p $$f"; \
-         rm -f $$p $$f ; \
-       done
-amdd$(EXEEXT): $(amdd_OBJECTS) $(amdd_DEPENDENCIES) 
-       @rm -f amdd$(EXEEXT)
-       $(LINK) $(amdd_OBJECTS) $(amdd_LDADD) $(LIBS)
-ammt$(EXEEXT): $(ammt_OBJECTS) $(ammt_DEPENDENCIES) 
-       @rm -f ammt$(EXEEXT)
-       $(LINK) $(ammt_OBJECTS) $(ammt_LDADD) $(LIBS)
-amtapeio$(EXEEXT): $(amtapeio_OBJECTS) $(amtapeio_DEPENDENCIES) 
-       @rm -f amtapeio$(EXEEXT)
-       $(LINK) $(amtapeio_OBJECTS) $(amtapeio_LDADD) $(LIBS)
-amtapetype$(EXEEXT): $(amtapetype_OBJECTS) $(amtapetype_DEPENDENCIES) 
-       @rm -f amtapetype$(EXEEXT)
-       $(LINK) $(amtapetype_OBJECTS) $(amtapetype_LDADD) $(LIBS)
-
-mostlyclean-compile:
-       -rm -f *.$(OBJEXT)
-
-distclean-compile:
-       -rm -f *.tab.c
-
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amdd.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ammt.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/amtapeio.test.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/output-file.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/output-null.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/output-rait.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/output-tape.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tapeio.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tapetype.Po@am__quote@
-
-.c.o:
-@am__fastdepCC_TRUE@   $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@   mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@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@   $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@   mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@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) '$<'`
-
-.c.lo:
-@am__fastdepCC_TRUE@   $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@   mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(LTCOMPILE) -c -o $@ $<
-
-mostlyclean-libtool:
-       -rm -f *.lo
-
-clean-libtool:
-       -rm -rf .libs _libs
-
-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:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-               $(TAGS_FILES) $(LISP)
-       tags=; \
-       here=`pwd`; \
-       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; }'`; \
-       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:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-               $(TAGS_FILES) $(LISP)
-       tags=; \
-       here=`pwd`; \
-       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; }'`; \
-       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)
-       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-       list='$(DISTFILES)'; \
-         dist_files=`for file in $$list; do echo $$file; done | \
-         sed -e "s|^$$srcdirstrip/||;t" \
-             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
-       case $$dist_files in \
-         */*) $(MKDIR_P) `echo "$$dist_files" | \
-                          sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
-                          sort -u` ;; \
-       esac; \
-       for file in $$dist_files; do \
-         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-         if test -d $$d/$$file; then \
-           dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
-           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
-check-am: all-am
-check: check-am
-all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS)
-installdirs:
-       for dir in "$(DESTDIR)$(amlibdir)" "$(DESTDIR)$(sbindir)"; do \
-         test -z "$$dir" || $(MKDIR_P) "$$dir"; \
-       done
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
-       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-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-am
-
-clean-am: clean-amlibLTLIBRARIES clean-generic clean-libtool \
-       clean-sbinPROGRAMS mostlyclean-am
-
-distclean: distclean-am
-       -rm -rf ./$(DEPDIR)
-       -rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
-       distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-info: info-am
-
-info-am:
-
-install-data-am: install-amlibLTLIBRARIES
-
-install-dvi: install-dvi-am
-
-install-exec-am: install-sbinPROGRAMS
-
-install-html: install-html-am
-
-install-info: install-info-am
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-ps: install-ps-am
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
-       -rm -rf ./$(DEPDIR)
-       -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
-       mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am: uninstall-amlibLTLIBRARIES uninstall-sbinPROGRAMS
-
-.MAKE: install-am install-strip
-
-.PHONY: CTAGS GTAGS all all-am check check-am clean \
-       clean-amlibLTLIBRARIES clean-generic clean-libtool \
-       clean-sbinPROGRAMS ctags distclean distclean-compile \
-       distclean-generic distclean-libtool distclean-tags distdir dvi \
-       dvi-am html html-am info info-am install install-am \
-       install-amlibLTLIBRARIES install-data install-data-am \
-       install-dvi install-dvi-am install-exec install-exec-am \
-       install-html install-html-am install-info install-info-am \
-       install-man install-pdf install-pdf-am install-ps \
-       install-ps-am install-sbinPROGRAMS install-strip installcheck \
-       installcheck-am installdirs maintainer-clean \
-       maintainer-clean-generic mostlyclean mostlyclean-compile \
-       mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-       tags uninstall uninstall-am uninstall-amlibLTLIBRARIES \
-       uninstall-sbinPROGRAMS
-
-
-# A rule to make precompiler output from C files.  This is not used during
-# ordinary builds, but but can very useful in debugging problems on strange
-# architectures.  With this rule, we can ask users to 'make foo.i' and send
-# the result to us.
-#
-# It touches some automake internals ($COMPILE), but since it's not
-# build-critical, that's OK.
-%.i : %.c
-       $(COMPILE) -E -o $@ $<
-
-amtapeio.test.c: $(srcdir)/tapeio.c
-       echo '#define TEST' >$@
-       echo '#include "$<"' >>$@
-
-%.test.c: $(srcdir)/%.c
-       echo '#define TEST' >$@
-       echo '#include "$<"' >>$@
-
-tapetype:
-       @echo "Use amtapetype instead"
-
-lint:
-       @ for p in $(sbin_PROGRAMS); do                                         \
-               if [ $$p = "amtapetype" ]; then                                 \
-                       s="$(amtapetype_SOURCES)";                              \
-               else                                                            \
-                       s=$$p.c;                                                \
-               fi;                                                             \
-               f="$$s $(libamandad_la_SOURCES)";                               \
-               f="$$f "`(cd ../common-src; make listlibsrc 2>&1 > /dev/null)`; \
-               (cd ../common-src; make listlibsrc);                            \
-               f="$$f "`cat ../common-src/listlibsrc.output`;                  \
-               echo $(LINT) $$f;                                               \
-               $(LINT) $(LINTFLAGS) $(CPPFLAGS) $(DEFS) -I. -I$(top_builddir)/config   \
-                   $(INCLUDES) $$f;                                            \
-               if [ $$? -ne 0 ]; then                                          \
-                   exit 1;                                                     \
-               fi;                                                             \
-       done;                                                                   \
-        exit 0
-
-listlibsrc:
-       @ for p in $(libamtape_la_SOURCES); do  \
-               listlibsrcs="$$listlibsrcs `pwd`/$$p";          \
-       done;                                                   \
-       echo $$listlibsrcs > listlibsrc.output
-# 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/tape-src/amdd.c b/tape-src/amdd.c
deleted file mode 100644 (file)
index 8a9e391..0000000
+++ /dev/null
@@ -1,251 +0,0 @@
-#ifdef NO_AMANDA
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-
-#include "output-rait.h"
-
-#define        tape_open       rait_open
-#define        tapefd_read     rait_read
-#define        tapefd_write    rait_write
-#define tapefd_setinfo_length(outfd, length)
-#define        tapefd_close    rait_close
-
-#else
-#include "amanda.h"
-#include "tapeio.h"
-#endif
-
-extern int optind;
-
-static int debug_amdd = 0;
-static char *pgm = NULL;
-
-static void usage(void);
-
-static void
-usage(void)
-{
-    g_fprintf(stderr, _("usage: %s "), pgm);
-    g_fprintf(stderr, _(" [-d]"));
-    g_fprintf(stderr, _(" [-l length]"));
-    g_fprintf(stderr, _(" [if=input]"));
-    g_fprintf(stderr, _(" [of=output]"));
-    g_fprintf(stderr, _(" [bs=blocksize]"));
-    g_fprintf(stderr, _(" [count=count]"));
-    g_fprintf(stderr, _(" [skip=count]"));
-    g_fprintf(stderr, _("\n"));
-    exit(1);
-}
-
-static ssize_t (*read_func)(int, void *, size_t);
-static ssize_t (*write_func)(int, const void *, size_t);
-
-int
-main(
-    int                argc,
-    char **    argv)
-{
-    int infd = 0;                              /* stdin */
-    int outfd = 1;                             /* stdout */
-    size_t blocksize = 512;
-    off_t skip = (off_t)0;
-    ssize_t len;
-    int pread, fread, pwrite, fwrite;
-    int res = 0;
-    char *buf;
-    off_t count = (off_t)0;
-    int have_count = 0;
-    int save_errno;
-    int ch;
-    char *eq;
-    off_t length = (off_t)0;
-    int have_length = 0;
-
-    /*
-     * Configure program for internationalization:
-     *   1) Only set the message locale for now.
-     *   2) Set textdomain for all amanda related programs to "amanda"
-     *      We don't want to be forced to support dozens of message catalogs.
-     */  
-    setlocale(LC_MESSAGES, "C");
-    textdomain("amanda"); 
-
-    fprintf(stderr, _("amdd is deprecated\n"));
-
-    if((pgm = strrchr(argv[0], '/')) != NULL) {
-       pgm++;
-    } else {
-       pgm = argv[0];
-    }
-    while(-1 != (ch = getopt(argc, argv, "hdl:"))) {
-       switch(ch) {
-       case 'd':
-           debug_amdd = 1;
-           g_fprintf(stderr, _("debug mode!\n"));
-           break;
-
-#ifndef __lint
-       case 'l':
-           have_length = 1;
-           length = OFF_T_ATOI(optarg);
-           len = (ssize_t)strlen(optarg);
-           if(len > 0) {
-               switch(optarg[len-1] ) {
-               case 'k':                               break;
-               case 'b': length /= (off_t)2;           break;
-               case 'M': length *= (off_t)1024;        break;
-               default:  length /= (off_t)1024;        break;
-               }
-           } else {
-               length /= (off_t)1024;
-           }
-           break;
-#endif
-       case 'h':
-       default:
-           usage();
-           /*NOTREACHED*/
-       }
-    }
-
-    /*@ignore@*/
-    read_func = read;
-    write_func = write;
-    /*@end@*/
-    for( ; optind < argc; optind++) {
-       if(0 == (eq = strchr(argv[optind], '='))) {
-           usage();
-           /*NOTREACHED*/
-       }
-       len = (ssize_t)(eq - argv[optind]);
-       if(0 == strncmp("if", argv[optind], (size_t)len)) {
-           if((infd = tape_open(eq + 1, O_RDONLY, 0)) < 0) {
-               save_errno = errno;
-               g_fprintf(stderr, "%s: %s: ", pgm, eq + 1);
-               errno = save_errno;
-               perror("open");
-               return 1;
-           }
-           read_func = tapefd_read;
-            if(debug_amdd) {
-               g_fprintf(stderr, _("input opened \"%s\", got fd %d\n"),
-                               eq + 1, infd);
-           }
-       } else if(0 == strncmp("of", argv[optind], (size_t)len)) {
-           if((outfd = tape_open(eq + 1, O_RDWR|O_CREAT|O_TRUNC, 0644)) < 0) {
-               save_errno = errno;
-               g_fprintf(stderr, "%s: %s: ", pgm, eq + 1);
-               errno = save_errno;
-               perror("open");
-               return 1;
-           }
-           write_func = tapefd_write;
-            if(debug_amdd) {
-               g_fprintf(stderr, _("output opened \"%s\", got fd %d\n"),
-                               eq + 1, outfd);
-           }
-           if(have_length) {
-               if(debug_amdd) {
-                   g_fprintf(stderr, _("length set to %lld\n"),
-                       (long long)length);
-               }
-               tapefd_setinfo_length(outfd, length);
-           }
-       } else if(0 == strncmp("bs", argv[optind], (size_t)len)) {
-           blocksize = SIZE_T_ATOI(eq + 1);
-           len = (ssize_t)strlen(argv[optind]);
-           if(len > 0) {
-               switch(argv[optind][len-1] ) {
-               case 'k': blocksize *= 1024;            break;
-               case 'b': blocksize *= 512;             break;
-               case 'M': blocksize *= 1024 * 1024;     break;
-               }
-           }
-           if(debug_amdd) {
-               g_fprintf(stderr, _("blocksize set to %zu\n"), blocksize);
-           }
-       } else if(0 == strncmp("count", argv[optind], (size_t)len)) {
-           count = OFF_T_ATOI(eq + 1);
-           have_count = 1;
-           if(debug_amdd) {
-               g_fprintf(stderr, _("count set to %lld\n"), (long long)count);
-           }
-       } else if(0 == strncmp("skip", argv[optind], (size_t)len)) {
-           skip = OFF_T_ATOI(eq + 1);
-           if(debug_amdd) {
-               g_fprintf(stderr, _("skip set to %lld\n"), (long long)skip);
-           }
-       } else {
-           g_fprintf(stderr, _("%s: bad argument: \"%s\"\n"), pgm, argv[optind]);
-           return 1;
-       }
-    }
-
-    if(0 == (buf = malloc(blocksize))) {
-       save_errno = errno;
-       g_fprintf(stderr, "%s: ", pgm);
-       errno = save_errno;
-       perror(_("malloc error"));
-       return 1;
-    }
-
-    eq = _("read error");
-    pread = fread = pwrite = fwrite = 0;
-    while(0 < (len = (*read_func)(infd, buf, blocksize))) {
-       if((skip -= (off_t)1) > (off_t)0) {
-           continue;
-       }
-       if((size_t)len == blocksize) {
-           fread++;
-       } else if(len > 0) {
-           pread++;
-       }
-       len = (*write_func)(outfd, buf, (size_t)len);
-       if(len < 0) {
-           eq = _("write error");
-           break;
-       } else if((size_t)len == blocksize) {
-           fwrite++;
-       } else if(len > 0) {
-           pwrite++;
-       }
-       if(have_count) {
-           if((count -= (off_t)1) <= (off_t)0) {
-               len = 0;
-               break;
-           }
-       }
-    }
-    if(len < 0) {
-       save_errno = errno;
-       g_fprintf(stderr, "%s: ", pgm);
-       errno = save_errno;
-       perror(eq);
-       res = 1;
-    }
-    g_fprintf(stderr, _("%d+%d in\n%d+%d out\n"), fread, pread, fwrite, pwrite);
-    if(read_func == tapefd_read) {
-       if(0 != tapefd_close(infd)) {
-           save_errno = errno;
-           g_fprintf(stderr, "%s: ", pgm);
-           errno = save_errno;
-           perror(_("input close"));
-           res = 1;
-       }
-    }
-    if(write_func == tapefd_write) {
-       if(0 != tapefd_close(outfd)) {
-           save_errno = errno;
-           g_fprintf(stderr, "%s: ", pgm);
-           errno = save_errno;
-           perror(_("output close"));
-           res = 1;
-       }
-    }
-    return res;
-}
diff --git a/tape-src/ammt.c b/tape-src/ammt.c
deleted file mode 100644 (file)
index 6e73aa6..0000000
+++ /dev/null
@@ -1,297 +0,0 @@
-#ifdef NO_AMANDA
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-
-#include "output-rait.h"
-
-extern char *getenv();
-
-#define        tape_open       rait_open
-#define        tapefd_read     rait_read
-#define        tapefd_write    rait_write
-#define        tapefd_fsf      rait_tapefd_fsf
-#define        tapefd_rewind   rait_tapefd_rewind
-#define        tapefd_status   rait_tapefd_status
-#define        tapefd_unload   rait_tapefd_unload
-#define        tapefd_weof     rait_tapefd_weof
-#define tapefd_setinfo_length(outfd, length)
-#define        tapefd_close    rait_close
-
-#else
-#include "amanda.h"
-#include "tapeio.h"
-#endif
-
-extern int optind;
-
-static int do_asf(int fd, off_t count);
-static int do_bsf(int fd, off_t count);
-static int do_status(int fd, off_t count);
-static void usage(void);
-
-struct cmd {
-    char *name;
-    size_t min_chars;
-    int count;
-    int (*func)(int, off_t);
-    int flags;
-} cmd[] = {
-    { "eof",           0,      1,      tapefd_weof,    O_RDWR },
-    { "weof",          0,      1,      tapefd_weof,    O_RDWR },
-    { "fsf",           0,      1,      tapefd_fsf,     O_RDONLY },
-    { "asf",           0,      0,      do_asf,         O_RDONLY },
-    { "bsf",           0,      1,      do_bsf,         O_RDONLY },
-    { "rewind",                0,      0,      (int (*)(int, off_t))tapefd_rewind,
-                                                       O_RDONLY },
-    { "offline",       0,      0,      (int (*)(int, off_t))tapefd_unload,
-                                                       O_RDONLY },
-    { "rewoffl",       0,      0,      (int (*)(int, off_t))tapefd_unload,
-                                                       O_RDONLY },
-    { "status",                0,      0,      do_status,      O_RDONLY },
-    { NULL,            0,      0,      NULL,           0 }
-};
-
-static char *pgm;
-static int debug_ammt = 0;
-
-static char *tapename;
-
-static int
-do_asf(
-    int                fd,
-    off_t      count)
-{
-    int r;
-
-    if(debug_ammt) {
-       g_fprintf(stderr, _("calling tapefd_rewind()\n"));
-    }
-    if(0 != (r = tapefd_rewind(fd))) {
-       return r;
-    }
-    if(debug_ammt) {
-       g_fprintf(stderr, _("calling tapefd_fsf(%lld)\n"), (long long)count);
-    }
-    return tapefd_fsf(fd, count);
-}
-
-static int
-do_bsf(
-    int                fd,
-    off_t      count)
-{
-    if(debug_ammt) {
-       g_fprintf(stderr, _("calling tapefd_fsf(%lld)\n"), (long long)-count);
-    }
-    return tapefd_fsf(fd, -count);
-}
-
-static int
-do_status(
-    int                fd,
-    off_t      count)
-{
-    int ret;
-    struct am_mt_status stat;
-
-    (void)count;       /* Quiet unused parameter warning */
-
-    if(debug_ammt) {
-       g_fprintf(stderr, _("calling tapefd_status()\n"));
-    }
-    if((ret = tapefd_status(fd, &stat)) != 0) {
-       return ret;
-    }
-    g_printf(_("%s status:"), tapename);
-    if(stat.online_valid) {
-       if(stat.online) {
-           fputs(_(" ONLINE"), stdout);
-       } else {
-           fputs(_(" OFFLINE"), stdout);
-       }
-    }
-    if(stat.bot_valid && stat.bot) {
-       fputs(_(" BOT"), stdout);
-    }
-    if(stat.eot_valid && stat.eot) {
-       fputs(_(" EOT"), stdout);
-    }
-    if(stat.protected_valid && stat.protected) {
-       fputs(_(" PROTECTED"), stdout);
-    }
-    if(stat.device_status_valid) {
-       g_printf(_(" ds == 0x%0*lx"),
-              stat.device_status_size * 2,
-              (unsigned long)stat.device_status);
-    }
-    if(stat.error_status_valid) {
-       g_printf(_(" er == 0x%0*lx"),
-              stat.error_status_size * 2,
-              (unsigned long)stat.error_status);
-    }
-    if(stat.fileno_valid) {
-       g_printf(_(" fileno == %ld"), stat.fileno);
-    }
-    if(stat.blkno_valid) {
-       g_printf(_(" blkno == %ld"), stat.blkno);
-    }
-
-    putchar('\n');
-    return 0;
-}
-
-static void
-usage(void)
-{
-    g_fprintf(stderr, _("usage: %s [-d] [-f|-t device] command [count]\n"), pgm);
-    exit(1);
-}
-
-int
-main(
-    int                argc,
-    char **    argv)
-{
-    int ch;
-    off_t count;
-    size_t i;
-    size_t j;
-    int fd;
-    int save_errno;
-    char *s;
-
-    /*
-     * Configure program for internationalization:
-     *   1) Only set the message locale for now.
-     *   2) Set textdomain for all amanda related programs to "amanda"
-     *      We don't want to be forced to support dozens of message catalogs.
-     */  
-    setlocale(LC_MESSAGES, "C");
-    textdomain("amanda"); 
-
-    fprintf(stderr, _("ammt is deprecated\n"));
-
-    /* Don't die when child closes pipe */
-    signal(SIGPIPE, SIG_IGN);
-
-    if((pgm = strrchr(argv[0], '/')) != NULL) {
-       pgm++;
-    } else {
-       pgm = argv[0];
-    }
-    tapename = getenv("TAPE");
-    while(-1 != (ch = getopt(argc, argv, "df:t:"))) {
-       switch(ch) {
-       case 'd':
-           debug_ammt = 1;
-           g_fprintf(stderr, _("debug mode!\n"));
-           break;
-       case 'f':
-       case 't':
-           tapename = stralloc(optarg);
-           break;
-       default:
-           usage();
-           /*NOTREACHED*/
-       }
-    }
-    if(optind >= argc) {
-       usage();
-       /*NOTREACHED*/
-    }
-
-    /*
-     * Compute the minimum abbreviation for each command.
-     */
-    for(i = 0; cmd[i].name; i++) {
-       cmd[i].min_chars = (size_t)1;
-       while (1) {
-           for(j = 0; cmd[j].name; j++) {
-               if(i == j) {
-                   continue;
-               }
-               if(0 == strncmp(cmd[i].name, cmd[j].name,
-                               cmd[i].min_chars)) {
-                   break;
-               }
-           }
-           if(0 == cmd[j].name) {
-               break;
-           }
-           cmd[i].min_chars++;
-       }
-       if(debug_ammt) {
-           g_fprintf(stderr, _("syntax: %-20s -> %*.*s\n"),
-                           cmd[i].name,
-                           (int)cmd[i].min_chars,
-                           (int)cmd[i].min_chars,
-                           cmd[i].name);
-       }
-    }
-
-    /*
-     * Process the command.
-     */
-    s = _("unknown");
-    j = strlen(argv[optind]);
-    for(i = 0; cmd[i].name; i++) {
-       if(0 == strncmp(cmd[i].name, argv[optind], j)) {
-           if(j >= cmd[i].min_chars) {
-               break;
-           }
-           s = _("ambiguous");
-       }
-    }
-    if(0 == cmd[i].name) {
-       g_fprintf(stderr, _("%s: %s command: %s\n"), pgm, s, argv[optind]);
-       exit(1);
-    }
-    optind++;
-    if(0 == tapename) {
-       g_fprintf(stderr, _("%s: -f device or -t device is required\n"), pgm);
-       exit(1);
-    }
-    if(debug_ammt) {
-       g_fprintf(stderr, _("tapename is \"%s\"\n"), tapename);
-    }
-
-    count = (off_t)1;
-    if(optind < argc && cmd[i].count) {
-       count = OFF_T_ATOI(argv[optind]);
-    }
-
-    if(debug_ammt) {
-       g_fprintf(stderr, _("calling tape_open(\"%s\",%d)\n"), tapename, cmd[i].flags);
-    }
-    if((fd = tape_open(tapename, cmd[i].flags, 0)) < 0) {
-       goto report_error;
-    }
-
-    if(debug_ammt) {
-       g_fprintf(stderr, _("processing %s(%lld)\n"),
-               cmd[i].name, (long long)count);
-    }
-    if(0 != (*cmd[i].func)(fd, count)) {
-       goto report_error;
-    }
-
-    (void)tapefd_close(fd);
-
-    exit(0);
-
-report_error:
-
-    save_errno = errno;
-    g_fprintf(stderr, _("%s %s"), tapename, cmd[i].name);
-    if(cmd[i].count) {
-       g_fprintf(stderr, " %lld", (long long)count);
-    }
-    errno = save_errno;
-    perror(_(" failed"));
-    return (1); /* exit */
-}
diff --git a/tape-src/output-file.c b/tape-src/output-file.c
deleted file mode 100644 (file)
index e99431c..0000000
+++ /dev/null
@@ -1,1302 +0,0 @@
-/*
- * Amanda, The Advanced Maryland Automatic Network Disk Archiver
- * Copyright (c) 1991-1998 University of Maryland at College Park
- * All Rights Reserved.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of U.M. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission.  U.M. makes no representations about the
- * suitability of this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- *
- * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M.
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: James da Silva, Systems Design and Analysis Group
- *                        Computer Science Department
- *                        University of Maryland at College Park
- */
-
-/* NOTE: this driver is *deprecated* and should not be used.  See the Device API
- * in device-src/ for the new implementation.
- */
-
-/*
- * $Id: output-file.c,v 1.14 2006/07/06 15:04:18 martinea Exp $
- *
- * tapeio.c virtual tape interface for a file device.
- *
- * The following was based on testing with real tapes on Solaris 2.6.
- * It is possible other OS drivers behave somewhat different in end
- * cases, usually involving errors.
- */
-
-#include "amanda.h"
-
-#include "token.h"
-#include "tapeio.h"
-#include "output-file.h"
-#include "fileheader.h"
-
-#ifndef SEEK_SET
-#define SEEK_SET 0
-#endif
-#ifndef SEEK_CUR
-#define SEEK_CUR 1
-#endif
-#ifndef SEEK_END
-#define SEEK_END 2
-#endif
-
-#define        MAX_TOKENS              10
-
-#define        DATA_INDICATOR          "."
-#define        RECORD_INDICATOR        "-"
-
-static
-struct volume_info {
-    char *basename;                    /* filename from open */
-    struct file_info *fi;              /* file info array */
-    size_t fi_limit;                   /* length of file info array */
-    int flags;                         /* open flags */
-    mode_t mask;                       /* open mask */
-    off_t file_count;                  /* number of files */
-    off_t file_current;                        /* current file position */
-    off_t record_current;              /* current record position */
-    int fd;                            /* data file descriptor */
-    int is_online;                     /* true if "tape" is "online" */
-    int at_bof;                                /* true if at begining of file */
-    int at_eof;                                /* true if at end of file */
-    int at_eom;                                /* true if at end of medium */
-    int last_operation_write;          /* true if last op was a write */
-    off_t amount_written;              /* KBytes written since open/rewind */
-} *volume_info = NULL;
-
-struct file_info {
-    char *name;                                /* file name (tapefd_getinfo_...) */
-    struct record_info *ri;            /* record info array */
-    size_t ri_count;                   /* number of record info entries */
-    size_t ri_limit;                   /* length of record info array */
-    int ri_altered;                    /* true if record info altered */
-};
-
-struct record_info {
-    size_t record_size;                        /* record size */
-    off_t start_record;                        /* first record in range */ 
-    off_t end_record;                  /* last record in range */ 
-};
-
-static size_t open_count = 0;
-
-static int check_online(int fd);
-static int file_open(int fd);
-static void file_close(int fd);
-static void file_release(int fd);
-static size_t get_record_size(struct file_info *fi, off_t record);
-static void put_record_size(struct file_info *fi, off_t record, size_t size);
-
-/*
- * "Open" the tape by scanning the "data" directory.  "Tape files"
- * have five leading digits indicating the position (counting from zero)
- * followed by a '.' and optional other information (e.g. host/disk/level
- * image name).
- *
- * We allow for the following situations:
- *
- *   + If we see the same "file" (position number) more than once, the
- *     last one seen wins.  This should not normally happen.
- *
- *   + We allow gaps in the positions.  This should not normally happen.
- *
- * Anything in the directory that does not match a "tape file" name
- * pattern is ignored.
- *
- * If the data directory does not exist, the "tape" is considered offline.
- * It is allowed to "appear" later.
- */
-
-static int
-check_online(
-    int        fd)
-{
-    char *token[MAX_TOKENS];
-    DIR *tapedir;
-    struct dirent *entry;
-    struct file_info *fi;
-    struct file_info **fi_p;
-    char *line;
-    int f;
-    off_t pos;
-    int rc = 0;
-    char *qname = quote_string(volume_info[fd].basename);
-
-    /*
-     * If we are already online, there is nothing else to do.
-     */
-    if (volume_info[fd].is_online) {
-       goto common_exit;
-    }
-
-    if ((tapedir = opendir(volume_info[fd].basename)) == NULL) {
-       /*
-        * We have already opened the info file which is in the same
-        * directory as the data directory, so ENOENT has to mean the data
-        * directory is not there, which we treat as being "offline".
-        * We're already offline at this point (see the above test)
-        * and this is not an error, so just return success (no error).
-        */
-
-       rc = (errno != ENOENT);
-       g_fprintf(stderr,_("ERROR: %s (%s)\n"), qname, strerror(errno));
-       goto common_exit;
-    }
-    while ((entry = readdir(tapedir)) != NULL) {
-       if (is_dot_or_dotdot(entry->d_name)) {
-           continue;
-       }
-       if (isdigit((int)entry->d_name[0])
-           && isdigit((int)entry->d_name[1])
-           && isdigit((int)entry->d_name[2])
-           && isdigit((int)entry->d_name[3])
-           && isdigit((int)entry->d_name[4])
-           && entry->d_name[5] == '.') {
-
-           /*
-            * This is a "tape file".
-            */
-           pos = OFF_T_ATOI(entry->d_name);
-           assert((pos + 1) <= (off_t)SSIZE_MAX);
-            fi_p = &volume_info[fd].fi;
-           amtable_alloc((void **)fi_p,
-                         &volume_info[fd].fi_limit,
-                         SIZEOF(*volume_info[fd].fi),
-                         (size_t)(pos + 1),
-                         10,
-                         NULL);
-           fi = &volume_info[fd].fi[pos];
-           if (fi->name != NULL) {
-               /*
-                * Two files with the same position???
-                */
-               amfree(fi->name);
-               fi->ri_count = 0;
-           }
-           fi->name = stralloc(&entry->d_name[6]);
-           if ((pos + 1) > volume_info[fd].file_count) {
-               volume_info[fd].file_count = (pos + 1);
-           }
-       }
-    }
-    closedir(tapedir);
-
-    /*
-     * Parse the info file.  We know we are at beginning of file because
-     * the only thing that can happen to it prior to here is it being
-     * opened.
-     */
-    for (; (line = areads(fd)) != NULL; free(line)) {
-       f = split(line, token, (int)(sizeof(token) / sizeof(token[0])), " ");
-       if (f == 2 && strcmp(token[1], "position") == 0) {
-           volume_info[fd].file_current = OFF_T_ATOI(token[2]);
-           volume_info[fd].record_current = (off_t)0;
-       }
-    }
-
-    /*
-     * Set EOM and make sure we are not pre-BOI.
-     */
-    if (volume_info[fd].file_current >= volume_info[fd].file_count) {
-       volume_info[fd].at_eom = 1;
-    }
-    if (volume_info[fd].file_current < 0) {
-       volume_info[fd].file_current = 0;
-       volume_info[fd].record_current = (off_t)0;
-    }
-
-    volume_info[fd].is_online = 1;
-
-common_exit:
-
-    amfree(qname);
-    return rc;
-}
-
-/*
- * Open the tape file if not already.  If we are beyond the file count
- * (end of tape) or the file is missing and we are only reading, set
- * up to read /dev/null which will look like EOF.  If we are writing,
- * create the file.
- */
-
-static int
-file_open(
-    int fd)
-{
-    struct file_info *fi;
-    struct file_info **fi_p;
-    char *datafilename = NULL;
-    char *recordfilename = NULL;
-    char *f = NULL;
-    off_t pos;
-    char *host;
-    char *disk;
-    int level;
-    char number[NUM_STR_SIZE];
-    int flags;
-    int rfd;
-    int n;
-    char *line;
-    struct record_info *ri;
-    struct record_info **ri_p;
-    off_t start_record;
-    off_t end_record;
-    size_t record_size = 0;
-
-    if (volume_info[fd].fd < 0) {
-       flags = volume_info[fd].flags;
-       pos = volume_info[fd].file_current;
-       assert((pos + 1) < (off_t)SSIZE_MAX);
-       fi_p = &volume_info[fd].fi;
-       amtable_alloc((void **)fi_p,
-                     &volume_info[fd].fi_limit,
-                     SIZEOF(*volume_info[fd].fi),
-                     (size_t)(pos + 1),
-                     10,
-                     NULL);
-       fi = &volume_info[fd].fi[pos];
-
-       /*
-        * See if we are creating a new file.
-        */
-       if (pos >= volume_info[fd].file_count) {
-           volume_info[fd].file_count = pos + 1;
-       }
-
-       /*
-        * Generate the file name to open.
-        */
-       if (fi->name == NULL) {
-           if ((volume_info[fd].flags & 3) != O_RDONLY) {
-
-               /*
-                * This is a new file, so make sure we create/truncate
-                * it.  Generate the name based on the host/disk/level
-                * information from the caller, if available, else
-                * a constant.
-                */
-               flags |= (O_CREAT | O_TRUNC);
-               host = tapefd_getinfo_host(fd);
-               disk = tapefd_getinfo_disk(fd);
-               level = tapefd_getinfo_level(fd);
-               g_snprintf(number, SIZEOF(number), "%d", level);
-               if (host != NULL) {
-                   f = stralloc(host);
-               }
-               if (disk != NULL) {
-                   disk = sanitise_filename(disk);
-                   if (f == NULL) {
-                       f = stralloc(disk);
-                   } else {
-                       vstrextend(&f, ".", disk, NULL);
-                   }
-                   amfree(disk);
-               }
-               if (level >= 0) {
-                   if (f == NULL) {
-                       f = stralloc(number);
-                   } else {
-                       vstrextend(&f, ".", number, NULL);
-                   }
-               }
-               if (f == NULL) {
-                   f = stralloc("unknown");
-               }
-               amfree(fi->name);
-               fi->name = stralloc(f);
-               fi->ri_count = 0;
-               amfree(f);
-           } else {
-
-               /*
-                * This is a missing file, so set up to read nothing.
-                */
-               datafilename = stralloc("/dev/null");
-               recordfilename = stralloc("/dev/null");
-           }
-       }
-       if (datafilename == NULL) {
-           g_snprintf(number, SIZEOF(number),
-                   "%05lld", (long long)pos);
-           datafilename = vstralloc(volume_info[fd].basename,
-                                    number,
-                                    DATA_INDICATOR,
-                                    volume_info[fd].fi[pos].name,
-                                    NULL);
-           recordfilename = vstralloc(volume_info[fd].basename,
-                                      number,
-                                      RECORD_INDICATOR,
-                                      volume_info[fd].fi[pos].name,
-                                      NULL);
-       }
-
-       /*
-        * Do the data file open.
-        */
-       volume_info[fd].fd = open(datafilename, flags, volume_info[fd].mask);
-       amfree(datafilename);
-
-       /*
-        * Load the record information.
-        */
-       if (volume_info[fd].fd >= 0 && fi->ri_count == 0 &&
-               (rfd = open(recordfilename, O_RDONLY)) >= 0) {
-           for (; (line = areads(rfd)) != NULL; free(line)) {
-                /* We play this game because long long is not
-                   necessarily the same as off_t, and we need to cast the
-                   actual value (not just the pointer. */
-                long long start_record_ = (long long)0;
-                long long end_record_ = (long long)0;
-               long record_size_ = (long)0;
-               n = sscanf(line, "%lld %lld %ld",
-                           &start_record_, &end_record_, &record_size_);
-                start_record = (off_t)start_record_;
-                end_record = (off_t)end_record_;
-                record_size = (size_t)record_size_;
-
-               if (n == 3) {
-                    ri_p = &fi->ri;
-                   amtable_alloc((void **)ri_p,
-                                 &fi->ri_limit,
-                                 SIZEOF(*fi->ri),
-                                 (size_t)fi->ri_count + 1,
-                                 10,
-                                 NULL);
-                   ri = &fi->ri[fi->ri_count];
-                   ri->start_record = start_record;
-                   ri->end_record = end_record;
-                   ri->record_size = record_size;
-                   fi->ri_count++;
-               }
-           }
-           aclose(rfd);
-       }
-       amfree(recordfilename);
-    }
-    return volume_info[fd].fd;
-}
-
-/*
- * Close the current data file, if open.  Dump the record information
- * if it has been altered.
- */
-
-static void
-file_close(
-    int fd)
-{
-    struct file_info *fi;
-    struct file_info **fi_p;
-    off_t pos;
-    char number[NUM_STR_SIZE];
-    char *filename = NULL;
-    size_t r;
-    FILE *f;
-
-    aclose(volume_info[fd].fd);
-    pos = volume_info[fd].file_current;
-    assert((pos + 1) < (off_t)SSIZE_MAX);
-    fi_p = &volume_info[fd].fi;
-    amtable_alloc((void **)fi_p,
-                 &volume_info[fd].fi_limit,
-                 SIZEOF(*volume_info[fd].fi),
-                 (size_t)(pos + 1),
-                 10,
-                 NULL);
-    fi = &volume_info[fd].fi[pos];
-    if (fi->ri_altered) {
-       g_snprintf(number, SIZEOF(number),
-                "%05lld", (long long)pos);
-       filename = vstralloc(volume_info[fd].basename,
-                            number,
-                            RECORD_INDICATOR,
-                            fi->name,
-                            NULL);
-       if ((f = fopen(filename, "w")) == NULL) {
-           goto common_exit;
-       }
-       for (r = 0; r < fi->ri_count; r++) {
-           g_fprintf(f, "%lld %lld %zu\n",
-                   (long long)fi->ri[r].start_record,
-                   (long long)fi->ri[r].end_record,
-                   fi->ri[r].record_size);
-       }
-       afclose(f);
-       fi->ri_altered = 0;
-    }
-
-common_exit:
-
-    amfree(filename);
-}
-
-/*
- * Release any files beyond a given position current position and reset
- * file_count to file_current to indicate EOM.
- */
-
-static void
-file_release(
-    int fd)
-{
-    off_t position;
-    char *filename;
-    off_t pos;
-    char number[NUM_STR_SIZE];
-    struct file_info **fi_p;
-
-    /*
-     * If the current file is open, release everything beyond it.
-     * If it is not open, release everything from current.
-     */
-    if (volume_info[fd].fd >= 0) {
-       position = volume_info[fd].file_current + 1;
-    } else {
-       position = volume_info[fd].file_current;
-    }
-    for (pos = position; pos < volume_info[fd].file_count; pos++) {
-       assert(pos < (off_t)SSIZE_MAX);
-        fi_p = &volume_info[fd].fi;
-       amtable_alloc((void **)fi_p,
-                     &volume_info[fd].fi_limit,
-                     SIZEOF(*volume_info[fd].fi),
-                     (size_t)(pos + 1),
-                     10,
-                     NULL);
-       if (volume_info[fd].fi[pos].name != NULL) {
-           g_snprintf(number, SIZEOF(number),
-                    "%05lld", (long long)pos);
-           filename = vstralloc(volume_info[fd].basename,
-                                number,
-                                DATA_INDICATOR,
-                                volume_info[fd].fi[pos].name,
-                                NULL);
-           unlink(filename);
-           amfree(filename);
-           filename = vstralloc(volume_info[fd].basename,
-                                number,
-                                RECORD_INDICATOR,
-                                volume_info[fd].fi[pos].name,
-                                NULL);
-           unlink(filename);
-           amfree(filename);
-           amfree(volume_info[fd].fi[pos].name);
-           volume_info[fd].fi[pos].ri_count = 0;
-       }
-    }
-    volume_info[fd].file_count = position;
-}
-
-/*
- * Get the size of a particular record.  We assume the record information is
- * sorted, does not overlap and does not have gaps.
- */
-
-static size_t
-get_record_size(
-    struct file_info * fi,
-    off_t              record)
-{
-    size_t r;
-    struct record_info *ri;
-
-    for(r = 0; r < fi->ri_count; r++) {
-       ri = &fi->ri[r];
-       if (record <= ri->end_record) {
-           return ri->record_size;
-       }
-    }
-
-    /*
-     * For historical reasons, the default record size is 32 KBytes.
-     * This allows us to read files written by Amanda with that block
-     * size before the record information was being kept.
-     */
-    return 32 * 1024;
-}
-
-/*
- * Update the record information.  We assume the record information is
- * sorted, does not overlap and does not have gaps.
- */
-
-static void
-put_record_size(
-    struct file_info * fi,
-    off_t              record,
-    size_t             size)
-{
-    size_t r;
-    struct record_info *ri;
-    struct record_info **ri_p;
-
-    fi->ri_altered = 1;
-    if (record == (off_t)0) {
-       fi->ri_count = 0;                       /* start over */
-    }
-    for(r = 0; r < fi->ri_count; r++) {
-       ri = &fi->ri[r];
-       if ((record - (off_t)1) <= ri->end_record) {
-           /*
-            * If this record is the same size as the rest of the records
-            * in this entry, or it would replace the entire entry,
-            * reset the end record number and size, then zap the chain
-            * beyond this point.
-            */
-           if (record == ri->start_record || ri->record_size == size) {
-               ri->end_record = record;
-               ri->record_size = size;
-               fi->ri_count = r + 1;
-               return;
-           }
-           /*
-            * This record needs a new entry right after the current one.
-            */
-           ri->end_record = record - (off_t)1;
-           fi->ri_count = r + 1;
-           break;
-       }
-    }
-    /*
-     * Add a new entry.
-     */
-    ri_p = &fi->ri;
-    amtable_alloc((void **)ri_p,
-                 &fi->ri_limit,
-                 SIZEOF(*fi->ri),
-                 (size_t)fi->ri_count + 1,
-                 10,
-                 NULL);
-    ri = &fi->ri[fi->ri_count];
-    ri->start_record = record;
-    ri->end_record = record;
-    ri->record_size = size;
-    fi->ri_count++;
-}
-
-/*
- * The normal interface routines ...
- */
-
-int
-file_tape_open(
-    char *     filename,
-    int                flags,
-    mode_t     mask)
-{
-    int fd;
-    int save_errno;
-    char *info_file;
-    struct volume_info **volume_info_p =  &volume_info;
-
-    /*
-     * Use only O_RDONLY and O_RDWR.
-     */
-    if ((flags & 3) != O_RDONLY) {
-       flags &= ~3;
-       flags |= O_RDWR;
-    }
-
-    /*
-     * If the caller did not set O_CREAT (and thus, pass a mask
-     * parameter), we may still end up creating data files and need a
-     * "reasonable" value.  Pick a "tight" value on the "better safe
-     * than sorry" theory.
-     */
-    if ((flags & O_CREAT) == 0) {
-       mask = 0600;
-    }
-
-    /*
-     * Open/create the info file for this "tape".
-     */
-    info_file = stralloc2(filename, "/info");
-    if ((fd = open(info_file, O_RDWR|O_CREAT, 0600)) < 0) {
-       goto common_exit;
-    }
-
-    /*
-     * Create the internal info structure for this "tape".
-     */
-    amtable_alloc((void **)volume_info_p,
-                 &open_count,
-                 SIZEOF(*volume_info),
-                 (size_t)fd + 1,
-                 10,
-                 NULL);
-    volume_info[fd].flags = flags;
-    volume_info[fd].mask = mask;
-    volume_info[fd].file_count = 0;
-    volume_info[fd].file_current = 0;
-    volume_info[fd].record_current = (off_t)0;
-    volume_info[fd].fd = -1;
-    volume_info[fd].is_online = 0;             /* true when .../data found */
-    volume_info[fd].at_bof = 1;                        /* by definition */
-    volume_info[fd].at_eof = 0;                        /* do not know yet */
-    volume_info[fd].at_eom = 0;                        /* may get reset below */
-    volume_info[fd].last_operation_write = 0;
-    volume_info[fd].amount_written = (off_t)0;
-
-    /*
-     * Save the base directory name and see if we are "online".
-     */
-    volume_info[fd].basename = stralloc2(filename, "/data/");
-    if (check_online(fd)) {
-       save_errno = errno;
-       aclose(fd);
-       fd = -1;
-       amfree(volume_info[fd].basename);
-       errno = save_errno;
-       goto common_exit;
-    }
-
-common_exit:
-
-    amfree(info_file);
-
-    /*
-     * Return the info file descriptor as the unique descriptor for
-     * this open.
-     */
-    return fd;
-}
-
-ssize_t
-file_tapefd_read(
-    int                fd,
-    void *     buffer,
-    size_t     count)
-{
-    ssize_t result;
-    int file_fd;
-    off_t pos;
-    size_t record_size;
-    size_t read_size;
-
-    /*
-     * Make sure we are online.
-     */
-    if (check_online(fd) != 0) {
-       return -1;
-    }
-    if (! volume_info[fd].is_online) {
-       errno = EIO;
-       return -1;
-    }
-
-    /*
-     * Do not allow any more reads after we find EOF.
-     */
-    if (volume_info[fd].at_eof) {
-       errno = EIO;
-       return -1;
-    }
-
-    /*
-     * If we are at EOM, set EOF and return a zero length result.
-     */
-    if (volume_info[fd].at_eom) {
-       volume_info[fd].at_eof = 1;
-       return 0;
-    }
-
-    /*
-     * Open the file, if needed.
-     */
-    if ((file_fd = file_open(fd)) < 0) {
-       return -1;
-    }
-
-    /*
-     * Make sure we do not read too much.
-     */
-    pos = volume_info[fd].file_current;
-    record_size = get_record_size(&volume_info[fd].fi[pos],
-                                 volume_info[fd].record_current);
-    if (record_size <= count) {
-       read_size = record_size;
-    } else {
-       read_size = count;
-    }
-
-    /*
-     * Read the data.  If we ask for less than the record size, skip to
-     * the next record boundary.
-     */
-    result = read(file_fd, buffer, read_size);
-    if (result > 0) {
-       volume_info[fd].at_bof = 0;
-       if ((size_t)result < record_size) {
-           if (lseek(file_fd, (off_t)(record_size-result), SEEK_CUR) == (off_t)-1) {
-               dbprintf(_("file_tapefd_read: lseek failed: <%s>\n"),
-                         strerror(errno));
-           }
-       }
-       volume_info[fd].record_current += (off_t)1;
-    } else if (result == 0) {
-       volume_info[fd].at_eof = 1;
-    }
-    return result;
-}
-
-ssize_t
-file_tapefd_write(
-    int                fd,
-    const void *buffer,
-    size_t     count)
-{
-    int file_fd;
-    ssize_t write_count = (ssize_t)count;
-    off_t length;
-    off_t kbytes_left;
-    ssize_t result;
-    off_t pos;
-
-    /*
-     * Make sure we are online.
-     */
-    if (check_online(fd) != 0) {
-       return -1;
-    }
-    if (! volume_info[fd].is_online) {
-       errno = EIO;
-       return -1;
-    }
-
-    /*
-     * Check for write access first.
-     */
-    if ((volume_info[fd].flags & 3) == O_RDONLY) {
-       errno = EBADF;
-       return -1;
-    }
-
-    /*
-     * Special case: allow negative buffer size.
-     */
-    if (write_count <= 0) {
-       return 0;                               /* special case */
-    }
-
-    /*
-     * If we are at EOM, it takes precedence over EOF.
-     */
-    if (volume_info[fd].at_eom) {
-       volume_info[fd].at_eof = 0;
-    }
-
-#if 0 /*JJ*/
-    /*
-     * Writes are only allowed at BOF and EOM.
-     */
-    if (! (volume_info[fd].at_bof || volume_info[fd].at_eom)) {
-       errno = EIO;
-       return -1;
-    }
-#endif /*JJ*/
-
-    /*
-     * Writes are only allowed if we are not at EOF.
-     */
-    if (volume_info[fd].at_eof) {
-       errno = EIO;
-       return -1;
-    }
-
-    /*
-     * Open the file, if needed.
-     */
-    if((file_fd = volume_info[fd].fd) < 0) {
-       file_release(fd);
-       if ((file_fd = file_open(fd)) < 0) {
-           return -1;
-       }
-    }
-
-    /*
-     * Truncate the write if requested and return a simulated ENOSPC.
-     */
-    if ((length = tapefd_getinfo_length(fd)) > (off_t)0) {
-       kbytes_left = length - volume_info[fd].amount_written;
-       if ((off_t)(write_count / 1024) > kbytes_left) {
-           write_count = (ssize_t)kbytes_left * 1024;
-       }
-    }
-    volume_info[fd].amount_written += (off_t)((write_count + 1023) / 1024);
-    if (write_count <= 0) {
-       volume_info[fd].at_bof = 0;
-       volume_info[fd].at_eom = 1;
-       errno = ENOSPC;
-       return -1;
-    }
-
-    /*
-     * Do the write and truncate the file, if needed.  Checking for
-     * last_operation_write is an optimization so we only truncate
-     * once.
-     */
-    if (! volume_info[fd].last_operation_write) {
-       off_t curpos;
-
-       if ((curpos = lseek(file_fd, (off_t)0, SEEK_CUR)) < 0) {
-           dbprintf(_(": Can not determine current file position <%s>"),
-               strerror(errno));
-           return -1;
-       }
-       if (ftruncate(file_fd, curpos) != 0) {
-           dbprintf(_("ftruncate failed; Can not trim output file <%s>"),
-               strerror(errno));
-           return -1;
-       }
-       volume_info[fd].at_bof = 0;
-       volume_info[fd].at_eom = 1;
-    }
-    result = fullwrite(file_fd, buffer, (size_t)write_count);
-    if (result >= 0) {
-       volume_info[fd].last_operation_write = 1;
-       pos = volume_info[fd].file_current;
-       put_record_size(&volume_info[fd].fi[pos],
-                       volume_info[fd].record_current,
-                       (size_t)result);
-       volume_info[fd].record_current += (off_t)1;
-    }
-
-    return result;
-}
-
-int
-file_tapefd_close(
-    int        fd)
-{
-    off_t pos;
-    int save_errno;
-    char *line;
-    size_t len;
-    ssize_t result;
-    struct file_info **fi_p;
-    struct record_info **ri_p;
-
-    /*
-     * If our last operation was a write, write a tapemark.
-     */
-    if (volume_info[fd].last_operation_write) {
-       if ((result = (ssize_t)file_tapefd_weof(fd, (off_t)1)) != 0) {
-           return (int)result;
-       }
-    }
-
-    /*
-     * If we are not at BOF, fsf to the next file unless we
-     * are already at end of tape.
-     */
-    if (! volume_info[fd].at_bof && ! volume_info[fd].at_eom) {
-       if ((result = (ssize_t)file_tapefd_fsf(fd, (off_t)1)) != 0) {
-           return (int)result;
-       }
-    }
-
-    /*
-     * Close the file if it is still open.
-     */
-    file_close(fd);
-
-    /*
-     * Release the info structure areas.
-     */
-    for (pos = 0; pos < (off_t)volume_info[fd].fi_limit; pos++) {
-       amfree(volume_info[fd].fi[pos].name);
-        ri_p = &volume_info[fd].fi[pos].ri;
-       amtable_free((void **)ri_p,
-                    &volume_info[fd].fi[pos].ri_limit);
-       volume_info[fd].fi[pos].ri_count = 0;
-    }
-    fi_p = &volume_info[fd].fi;
-    amtable_free((void **)fi_p, &volume_info[fd].fi_limit);
-    volume_info[fd].file_count = 0;
-    amfree(volume_info[fd].basename);
-
-    /*
-     * Update the status file if we were online.
-     */
-    if (volume_info[fd].is_online) {
-       if (lseek(fd, (off_t)0, SEEK_SET) != (off_t)0) {
-           save_errno = errno;
-           aclose(fd);
-           errno = save_errno;
-           return -1;
-       }
-       if (ftruncate(fd, (off_t)0) != 0) {
-           save_errno = errno;
-           aclose(fd);
-           errno = save_errno;
-           return -1;
-       }
-       line = vstrallocf("position %05lld\n",
-                (long long)volume_info[fd].file_current);
-       len = strlen(line);
-       result = write(fd, line, len);
-       amfree(line);
-       if (result != (ssize_t)len) {
-           if (result >= 0) {
-               errno = ENOSPC;
-           }
-           save_errno = errno;
-           aclose(fd);
-           errno = save_errno;
-           return -1;
-       }
-    }
-
-    areads_relbuf(fd);
-    return close(fd);
-}
-
-void
-file_tapefd_resetofs(
-    int        fd)
-{
-    (void)fd;  /* Quiet unused parameter warning */
-}
-
-int
-file_tapefd_status(
-    int                         fd,
-    struct am_mt_status *stat)
-{
-    int result;
-
-    /*
-     * See if we are online.
-     */
-    if ((result = check_online(fd)) != 0) {
-       return result;
-    }
-    memset((void *)stat, 0, SIZEOF(*stat));
-    stat->online_valid = 1;
-    stat->online = (char)volume_info[fd].is_online;
-    return 0;
-}
-
-int
-file_tape_stat(
-     char *            filename,
-     struct stat *     buf)
-{
-     return stat(filename, buf);
-}
-
-int
-file_tape_access(
-     char *    filename,
-     int       mode)
-{
-     return access(filename, mode);
-}
-
-int
-file_tapefd_rewind(
-    int fd)
-{
-    int result;
-
-    /*
-     * Make sure we are online.
-     */
-    if ((result = check_online(fd)) != 0) {
-       return result;
-    }
-    if (! volume_info[fd].is_online) {
-       errno = EIO;
-       return -1;
-    }
-
-    /*
-     * If our last operation was a write, write a tapemark.
-     */
-    if (volume_info[fd].last_operation_write) {
-       if ((result = file_tapefd_weof(fd, (off_t)1)) != 0) {
-           return result;
-       }
-    }
-
-    /*
-     * Close the file if it is still open.
-     */
-    file_close(fd);
-
-    /*
-     * Adjust the position and reset the flags.
-     */
-    volume_info[fd].file_current = 0;
-    volume_info[fd].record_current = (off_t)0;
-
-    volume_info[fd].at_bof = 1;
-    volume_info[fd].at_eof = 0;
-    volume_info[fd].at_eom
-      = (volume_info[fd].file_current >= volume_info[fd].file_count);
-    volume_info[fd].last_operation_write = 0;
-    volume_info[fd].amount_written = (off_t)0;
-
-    return result;
-}
-
-int
-file_tapefd_unload(
-    int        fd)
-{
-    int result;
-
-    /*
-     * Make sure we are online.
-     */
-    if ((result = check_online(fd)) != 0) {
-       return result;
-    }
-    if (! volume_info[fd].is_online) {
-       errno = EIO;
-       return -1;
-    }
-
-    (void)file_tapefd_rewind(fd);
-    return 0;
-}
-
-int
-file_tapefd_fsf(
-    int                fd,
-    off_t      count)
-{
-    int result;
-
-    /*
-     * Make sure we are online.
-     */
-    if ((result = check_online(fd)) != 0) {
-       return result;
-    }
-    if (! volume_info[fd].is_online) {
-       errno = EIO;
-       return -1;
-    }
-
-    /*
-     * If our last operation was a write and we are going to move
-     * backward, write a tapemark.
-     */
-    if (volume_info[fd].last_operation_write && count < 0) {
-       if ((result = file_tapefd_weof(fd, (off_t)1)) != 0) {
-           errno = EIO;
-           return -1;
-       }
-    }
-
-    /*
-     * Close the file if it is still open.
-     */
-    file_close(fd);
-
-    /*
-     * If we are at EOM and moving backward, adjust the count to go
-     * one more file.
-     */
-    if (volume_info[fd].at_eom && count < 0) {
-       count--;
-    }
-
-    /*
-     * Adjust the position and return an error if we go beyond either
-     * end of the tape.
-     */
-    volume_info[fd].file_current += count;
-    if (volume_info[fd].file_current > volume_info[fd].file_count) {
-        volume_info[fd].file_current = volume_info[fd].file_count;
-       errno = EIO;
-       result = -1;
-    } else if (volume_info[fd].file_current < 0) {
-        volume_info[fd].file_current = 0;
-       errno = EIO;
-       result = -1;
-    }
-    volume_info[fd].record_current = (off_t)0;
-
-    /*
-     * Set BOF to true so we can write.  Set to EOF to false if the
-     * fsf succeeded or if it failed but we were moving backward (and
-     * thus we are at beginning of tape), otherwise set it to true so
-     * a subsequent read will fail.  Set EOM to whatever is right.
-     * Reset amount_written if we ended up back at BOM.
-     */
-    volume_info[fd].at_bof = 1;
-    if (result == 0 || count < 0) {
-       volume_info[fd].at_eof = 0;
-    } else {
-       volume_info[fd].at_eof = 1;
-    }
-    volume_info[fd].at_eom
-      = (volume_info[fd].file_current >= volume_info[fd].file_count);
-    volume_info[fd].last_operation_write = 0;
-    if (volume_info[fd].file_current == 0) {
-       volume_info[fd].amount_written = (off_t)0;
-    }
-
-    return result;
-}
-
-int
-file_tapefd_weof(
-    int                fd,
-    off_t      count)
-{
-    int file_fd;
-    int result;
-    char *save_host;
-    char *save_disk;
-    int save_level;
-    int save_errno;
-
-    /*
-     * Make sure we are online.
-     */
-    if ((result = check_online(fd)) != 0) {
-       return result;
-    }
-    if (! volume_info[fd].is_online) {
-       errno = EIO;
-       return -1;
-    }
-
-    /*
-     * Check for write access first.
-     */
-    if ((volume_info[fd].flags & 3) == O_RDONLY) {
-       errno = EACCES;
-       return -1;
-    }
-
-    /*
-     * Special case: allow a zero count.
-     */
-    if (count == 0) {
-       return 0;                               /* special case */
-    }
-
-    /*
-     * Disallow negative count.
-     */
-    if (count < 0) {
-       errno = EINVAL;
-       return -1;
-    }
-
-    /*
-     * Close out the current file if open.
-     */
-    if ((file_fd = volume_info[fd].fd) >= 0) {
-       off_t curpos;
-
-       if ((curpos = lseek(file_fd, (off_t)0, SEEK_CUR)) < 0) {
-           save_errno = errno;
-           dbprintf(_(": Can not determine current file position <%s>"),
-               strerror(errno));
-           file_close(fd);
-           errno = save_errno;
-           return -1;
-       }
-       if (ftruncate(file_fd, curpos) != 0) {
-           save_errno = errno;
-           dbprintf(_("ftruncate failed; Can not trim output file <%s>"),
-               strerror(errno));
-           file_close(fd);
-           errno = save_errno;
-           return -1;
-       }
-       
-       file_close(fd);
-       volume_info[fd].file_current++;
-       volume_info[fd].record_current = (off_t)0;
-       volume_info[fd].at_bof = 1;
-       volume_info[fd].at_eof = 0;
-       volume_info[fd].at_eom = 1;
-       volume_info[fd].last_operation_write = 0;
-       count--;
-    }
-
-    /*
-     * Release any data files from current through the end.
-     */
-    file_release(fd);
-
-    /*
-     * Save any labelling information in case we clobber it.
-     */
-    if ((save_host = tapefd_getinfo_host(fd)) != NULL) {
-       save_host = stralloc(save_host);
-    }
-    if ((save_disk = tapefd_getinfo_disk(fd)) != NULL) {
-       save_disk = stralloc(save_disk);
-    }
-    save_level = tapefd_getinfo_level(fd);
-
-    /*
-     * Add more tapemarks.
-     */
-    while (--count >= 0) {
-       if (file_open(fd) < 0) {
-           break;
-       }
-       file_close(fd);
-       volume_info[fd].file_current++;
-       volume_info[fd].file_count = volume_info[fd].file_current;
-       volume_info[fd].record_current = (off_t)0;
-       volume_info[fd].at_bof = 1;
-       volume_info[fd].at_eof = 0;
-       volume_info[fd].at_eom = 1;
-       volume_info[fd].last_operation_write = 0;
-
-       /*
-        * Only the first "file" terminated by an EOF gets the naming
-        * information from the caller.
-        */
-       tapefd_setinfo_host(fd, NULL);
-       tapefd_setinfo_disk(fd, NULL);
-       tapefd_setinfo_level(fd, -1);
-    }
-
-    /*
-     * Restore the labelling information.
-     */
-    save_errno = errno;
-    tapefd_setinfo_host(fd, save_host);
-    amfree(save_host);
-    tapefd_setinfo_disk(fd, save_disk);
-    amfree(save_disk);
-    tapefd_setinfo_level(fd, save_level);
-    errno = save_errno;
-
-    return result;
-}
-
-int
-file_tapefd_can_fork(
-    int        fd)
-{
-    (void)fd;  /* Quiet unused parameter warning */
-    return 0;
-}
diff --git a/tape-src/output-file.h b/tape-src/output-file.h
deleted file mode 100644 (file)
index f406cd8..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Amanda, The Advanced Maryland Automatic Network Disk Archiver
- * Copyright (c) 1991-1998 University of Maryland at College Park
- * All Rights Reserved.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of U.M. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission.  U.M. makes no representations about the
- * suitability of this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- *
- * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M.
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: James da Silva, Systems Design and Analysis Group
- *                        Computer Science Department
- *                        University of Maryland at College Park
- */
-
-/* NOTE: this driver is *deprecated* and should not be used.  See the Device API
- * in device-src/ for the new implementation.
- */
-
-/*
- * $Id: output-file.h,v 1.6 2006/05/25 01:47:27 johnfranks Exp $
- *
- * tapeio.c virtual tape interface for a file device.
- */
-
-#ifndef OUTPUT_FILE_H
-#define OUTPUT_FILE_H
-
-#include "amanda.h"
-
-int file_tape_access(char *, int);
-int file_tape_open(char *, int, mode_t);
-int file_tape_stat(char *, struct stat *);
-int file_tapefd_close(int);
-int file_tapefd_fsf(int, off_t);
-ssize_t file_tapefd_read(int, void *, size_t);
-int file_tapefd_rewind(int);
-void file_tapefd_resetofs(int);
-int file_tapefd_unload(int);
-int file_tapefd_status(int, struct am_mt_status *);
-int file_tapefd_weof(int, off_t);
-ssize_t file_tapefd_write(int, const void *, size_t);
-int file_tapefd_can_fork(int);
-
-#endif /* OUTPUT_FILE_H */
diff --git a/tape-src/output-null.c b/tape-src/output-null.c
deleted file mode 100644 (file)
index 1c361f4..0000000
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * Amanda, The Advanced Maryland Automatic Network Disk Archiver
- * Copyright (c) 1991-1998 University of Maryland at College Park
- * All Rights Reserved.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of U.M. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission.  U.M. makes no representations about the
- * suitability of this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- *
- * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M.
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: James da Silva, Systems Design and Analysis Group
- *                        Computer Science Department
- *                        University of Maryland at College Park
- */
-
-/* NOTE: this driver is *deprecated* and should not be used.  See the Device API
- * in device-src/ for the new implementation.
- */
-
-/*
- * $Id: output-null.c,v 1.9 2006/06/02 00:56:06 paddy_s Exp $
- *
- * tapeio.c virtual tape interface for a null device.
- */
-
-#include "amanda.h"
-
-#include "tapeio.h"
-#include "output-null.h"
-#include "fileheader.h"
-#ifndef R_OK
-#define R_OK 4
-#define W_OK 2
-#endif
-
-static off_t *amount_written = NULL;
-static size_t open_count = 0;
-
-int
-null_tape_open(
-    char *     filename,
-    int                flags,
-    mode_t     mask)
-{
-    int fd;
-    off_t **amount_written_p = &amount_written;
-
-    (void)filename;    /* Quiet unused parameter warning */
-
-    if ((flags & 3) != O_RDONLY) {
-       flags &= ~3;
-       flags |= O_RDWR;
-    }
-    if ((fd = open("/dev/null", flags, mask)) >= 0) {
-       tapefd_setinfo_fake_label(fd, 1);
-       amtable_alloc((void **)amount_written_p,
-                     &open_count,
-                     SIZEOF(*amount_written),
-                     (size_t)(fd + 1),
-                     10,
-                     NULL);
-       amount_written[fd] = (off_t)0;
-    }
-    return fd;
-}
-
-ssize_t
-null_tapefd_read(
-    int                fd,
-    void *     buffer,
-    size_t     count)
-{
-    return read(fd, buffer, count);
-}
-
-ssize_t
-null_tapefd_write(
-    int                fd,
-    const void *buffer,
-    size_t     count)
-{
-    ssize_t write_count = (ssize_t)count;
-    off_t length;
-    off_t kbytes_left;
-    ssize_t r;
-
-    if (write_count <= 0) {
-       return 0;                               /* special case */
-    }
-
-    if ((length = tapefd_getinfo_length(fd)) > (off_t)0) {
-       kbytes_left = length - amount_written[fd];
-       if ((off_t)(write_count / 1024) > kbytes_left) {
-           write_count = (ssize_t)kbytes_left * 1024;
-       }
-    }
-    amount_written[fd] += (off_t)((write_count + 1023) / 1024);
-    if (write_count <= 0) {
-       errno = ENOSPC;
-       r = -1;
-    } else {
-       r = write(fd, buffer, (size_t)write_count);
-    }
-    return r;
-}
-
-int
-null_tapefd_close(
-    int        fd)
-{
-    return close(fd);
-}
-
-void
-null_tapefd_resetofs(
-    int        fd)
-{
-    (void)fd;  /* Quiet unused parameter warning */
-}
-
-int
-null_tapefd_status(
-    int                         fd,
-    struct am_mt_status *stat)
-{
-    (void)fd;  /* Quiet unused parameter warning */
-
-    memset((void *)stat, 0, SIZEOF(*stat));
-    stat->online_valid = 1;
-    stat->online = 1;
-    return 0;
-}
-
-int
-null_tape_stat(
-     char *      filename,
-     struct stat *buf)
-{
-    (void)filename;    /* Quiet unused parameter warning */
-
-     return stat("/dev/null", buf);
-}
-
-int
-null_tape_access(
-     char *    filename,
-     int       mode)
-{
-    (void)filename;    /* Quiet unused parameter warning */
-
-     return access("/dev/null", mode);
-}
-
-int
-null_tapefd_rewind(
-    int        fd)
-{
-    amount_written[fd] = (off_t)0;
-    return 0;
-}
-
-int
-null_tapefd_unload(
-    int        fd)
-{
-    amount_written[fd] = (off_t)0;
-    return 0;
-}
-
-int
-null_tapefd_fsf(
-    int                fd,
-    off_t      count)
-{
-    (void)fd;          /* Quiet unused parameter warning */
-    (void)count;       /* Quiet unused parameter warning */
-
-    return 0;
-}
-
-int
-null_tapefd_weof(
-    int                fd,
-    off_t      count)
-{
-    (void)fd;          /* Quiet unused parameter warning */
-    (void)count;       /* Quiet unused parameter warning */
-
-    return 0;
-}
-
-int 
-null_tapefd_can_fork(
-    int        fd)
-{
-    (void)fd;          /* Quiet unused parameter warning */
-
-    return 0;
-}
-
diff --git a/tape-src/output-null.h b/tape-src/output-null.h
deleted file mode 100644 (file)
index d3b74b0..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Amanda, The Advanced Maryland Automatic Network Disk Archiver
- * Copyright (c) 1991-1998 University of Maryland at College Park
- * All Rights Reserved.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of U.M. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission.  U.M. makes no representations about the
- * suitability of this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- *
- * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M.
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: James da Silva, Systems Design and Analysis Group
- *                        Computer Science Department
- *                        University of Maryland at College Park
- */
-
-/* NOTE: this driver is *deprecated* and should not be used.  See the Device API
- * in device-src/ for the new implementation.
- */
-
-/*
- * $Id: output-null.h,v 1.6 2006/05/25 01:47:27 johnfranks Exp $
- *
- * tapeio.c virtual tape interface for a null device.
- */
-
-#ifndef OUTPUT_NULL_H
-#define OUTPUT_NULL_H
-
-#include "amanda.h"
-
-int null_tape_access(char *, int);
-int null_tape_open(char *, int, mode_t);
-int null_tape_stat(char *, struct stat *);
-int null_tapefd_close(int);
-int null_tapefd_fsf(int, off_t);
-ssize_t null_tapefd_read(int, void *, size_t);
-int null_tapefd_rewind(int);
-void null_tapefd_resetofs(int);
-int null_tapefd_unload(int);
-int null_tapefd_status(int, struct am_mt_status *);
-int null_tapefd_weof(int, off_t);
-ssize_t null_tapefd_write(int, const void *, size_t);
-int null_tapefd_can_fork(int);
-
-#endif /* OUTPUT_NULL_H */
diff --git a/tape-src/output-rait.c b/tape-src/output-rait.c
deleted file mode 100644 (file)
index b36e264..0000000
+++ /dev/null
@@ -1,1262 +0,0 @@
-/* NOTE: this driver is *deprecated* and should not be used.  See the Device API
- * in device-src/ for the new implementation.
- */
-
-#ifdef NO_AMANDA
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <sys/ioctl.h>
-#else
-#include "amanda.h"
-#include "tapeio.h"
-#endif
-
-#include "output-rait.h"
-#include "output-tape.h"
-
-#ifdef NO_AMANDA
-#define        amfree(x)       do {                                            \
-       if (x) {                                                        \
-           int save_errno = errno;                                     \
-           free(x);                                                    \
-           (x) = NULL;                                                 \
-           errno = save_errno;                                         \
-       }
-} while(0)
-#define        tape_open       open
-#define tapefd_read    read
-#define tapefd_write   write
-#define tapefd_close   close
-#define tape_access    access
-#define tape_stat      stat
-#define tapefd_fsf     tape_tapefd_fsf
-#define tapefd_rewind  tape_tapefd_rewind
-#define tapefd_status  tape_tapefd_status
-#define tapefd_unload  tape_tapefd_unload
-#define tapefd_weof    tape_tapefd_weof
-
-int tapeio_init_devname (char * dev,
-                        char **dev_left,
-                        char **dev_right,
-                        char **dev_next);
-char *tapeio_next_devname (char * dev_left,
-                          char * dev_right,
-                          char **dev_next);
-#endif
-
-/*
-** RAIT -- redundant array of (inexpensive?) tapes
-**
-** Author: Marc Mengel <mengel@fnal.gov>
-**
-** This package provides for striping input/output across
-** multiple tape drives.
-**
-                Table of Contents
-
-  rait.c..................................................1
-       MAX_RAITS.........................................2
-        rait_table........................................2
-       rait_open(char *dev, int flags, mode_t mode)......2
-       rait_close(int fd)................................3
-       rait_lseek(int fd, long pos, int whence)..........4
-       rait_write(int fd, const char *buf, size_t len) ..5
-       rait_read(int fd, char *buf, size_t len)..........6
-       rait_ioctl(int fd, int op, void *p)...............8
-       rait_access(devname, R_OK|W_OK)...................8
-       rait_stat(devname, struct statbuf*)...............8
-       rait_copy(char *f1, char *f2).....................9
-       ifndef NO_AMANDA
-           rait_tapefd_fsf(rait_tapefd, count)..........10
-           rait_tapefd_rewind(rait_tapefd)..............10
-           rait_tapefd_resetofs(rait_tapefd)............10
-           rait_tapefd_unload(rait_tapefd)..............10
-           rait_tapefd_status(rait_tapefd, stat)........10
-           rait_tapefd_weof(rait_tapefd, count).........10
-
-   rait.h.................................................1
-        typedef RAIT......................................1
-        ifdef RAIT_REDIRECT...............................1
-             open.........................................1
-            close........................................1
-             ioctl........................................1
-            read.........................................1
-             write........................................1
-*/
-
-/*\f*/
-
-/*
-** rait_open takes a string like:
-** "/dev/rmt/tps0d{3,5,7,19}nrnsv"
-** and opens
-** "/dev/rmt/tps0d3nrnsv"
-** "/dev/rmt/tps0d5nrnsv"
-** "/dev/rmt/tps0d7nrnsv"
-** "/dev/rmt/tps0d19nrnsv"
-** as a RAIT.
-**
-** If it has no curly brace, we treat it as a plain device,
-** and do a normal open, and do normal operations on it.
-*/
-
-#ifdef RAIT_DEBUG
-#define rait_debug(...) do {                                           \
-  int save_errno = errno;                                              \
-                                                                       \
-  if (0 != getenv("RAIT_DEBUG")) {                                     \
-    dbprintf(__VA_ARGS__);                                             \
-  }                                                                    \
-  errno = save_errno;                                                  \
-} while (0)
-#else
-#define rait_debug(...)
-#endif
-
-static RAIT *rait_table = 0;           /* table to keep track of RAITS */
-static size_t rait_table_count;
-
-#ifdef NO_AMANDA
-/*
- * amtable_alloc -- (re)allocate enough space for some number of elements.
- *
- * input:      table -- pointer to pointer to table
- *             current -- pointer to current number of elements
- *             elsize -- size of a table element
- *             count -- desired number of elements
- *             bump -- round up factor
- * output:     table -- possibly adjusted to point to new table area
- *             current -- possibly adjusted to new number of elements
- */
-
-static int
-amtable_alloc(
-    void **    table,
-    int *      current,
-    size_t     elsize,
-    int                count,
-    int                bump,
-    void *     dummy)
-{
-    void *table_new;
-    int table_count_new;
-
-    if (count >= *current) {
-       table_count_new = ((count + bump) / bump) * bump;
-       table_new = alloc(table_count_new * elsize);
-       if (0 != *table) {
-           memcpy(table_new, *table, *current * elsize);
-           amfree(*table);
-       }
-       *table = table_new;
-       memset(((char *)*table) + *current * elsize,
-              0,
-              (table_count_new - *current) * elsize);
-       *current = table_count_new;
-    }
-    return 0;
-}
-
-/*
- * amtable_free -- release a table.
- *
- * input:      table -- pointer to pointer to table
- *             current -- pointer to current number of elements
- * output:     table -- possibly adjusted to point to new table area
- *             current -- possibly adjusted to new number of elements
- */
-
-void
-amtable_free(
-    void **    table,
-    int *      current)
-{
-    amfree(*table);
-    *current = 0;
-}
-#endif
-
-#define rait_table_alloc(fd)   amtable_alloc((void **)rait_table_p,         \
-                                             &rait_table_count,             \
-                                             SIZEOF(*rait_table),   \
-                                             (size_t)(fd),                  \
-                                             10,                            \
-                                             NULL)
-
-int
-rait_open(
-    char *     dev,
-    int                flags,
-    mode_t     mask)
-{
-    int fd;                    /* the file descriptor number to return */
-    RAIT *res;                 /* resulting RAIT structure */
-    char *dev_left;            /* string before { */
-    char *dev_right;           /* string after } */
-    char *dev_next;            /* string inside {} */
-    char *dev_real;            /* parsed device name */
-    int rait_flag;             /* true if RAIT syntax in dev */
-    int save_errno;
-    int r;
-    RAIT **rait_table_p = &rait_table;
-    int **fds_p;
-
-    rait_debug(stderr,_("rait_open( %s, %d, %d )\n"), dev, flags, mask);
-
-    rait_flag = (0 != strchr(dev, '{'));
-
-    if (rait_flag) {
-
-       /*
-       ** we have to return a valid file descriptor, so use
-       ** a dummy one to /dev/null
-       */
-       fd = open("/dev/null",flags,mask);
-    } else {
-
-       /*
-       ** call the normal tape_open function if we are not
-       ** going to do RAIT
-       */
-       fd = tape_open(dev,flags,mask);
-    }
-    if(-1 == fd) {
-       rait_debug(stderr, _("rait_open:returning %d: %s\n"),
-                           fd,
-                           strerror(errno));
-       return fd;
-    }
-
-    if(0 != rait_table_alloc(fd + 1)) {
-       save_errno = errno;
-       (void)tapefd_close(fd);
-       errno = save_errno;
-       rait_debug(stderr, _("rait_open:returning %d: %s\n"),
-                           -1,
-                           strerror(errno));
-       return -1;
-    }
-
-    res = &rait_table[fd];
-
-    memset(res, 0, SIZEOF(*res));
-    res->nopen = 1;
-
-    res->fd_count = 0;
-    if (rait_flag) {
-
-       /* copy and parse the dev string so we can scribble on it */
-       dev = stralloc(dev);
-       if (0 == dev) {
-           rait_debug(stderr, _("rait_open:returning %d: %s\n"),
-                               -1,
-                               _("out of stralloc memory"));
-           return -1;
-        }
-        if (0 != tapeio_init_devname(dev, &dev_left, &dev_right, &dev_next)) {
-           rait_debug(stderr, _("rait_open:returning %d: %s\n"),
-                               -1,
-                               strerror(errno));
-           return -1;
-        }
-
-       while (0 != (dev_real = tapeio_next_devname(dev_left, dev_right, &dev_next))) {
-            fds_p = &(res->fds);
-           r = amtable_alloc((void **)fds_p,
-                           &res->fd_count,
-                           SIZEOF(*res->fds),
-                           (size_t)res->nfds + 1,
-                           10,
-                           NULL);
-           if (0 != r) {
-               (void)rait_close(fd);
-               fd = -1;
-               amfree(dev_real);
-               break;
-           }
-           res->fds[ res->nfds ] = tape_open(dev_real,flags,mask);
-           rait_debug(stderr,_("rait_open:opening %s yields %d\n"),
-                       dev_real, res->fds[res->nfds] );
-           if ( res->fds[res->nfds] < 0 ) {
-               save_errno = errno;
-               (void)rait_close(fd);
-               amfree(dev_real);
-               errno = save_errno;
-               fd = -1;
-               break;
-           }
-           tapefd_set_master_fd(res->fds[res->nfds], fd);
-           amfree(dev_real);
-           res->nfds++;
-       }
-
-       /* clean up our copied string */
-       amfree(dev);
-
-    } else {
-
-       /*
-       ** set things up to treat this as a normal tape if we ever
-       ** come in here again
-       */
-
-       res->nfds = 0;
-        fds_p = &(res->fds);
-       r = amtable_alloc((void **)fds_p,
-                         &res->fd_count,
-                         SIZEOF(*res->fds),
-                         (size_t)res->nfds + 1,
-                         1,
-                         NULL);
-       if (0 != r) {
-           (void)tapefd_close(fd);
-           memset(res, 0, SIZEOF(*res));
-           errno = ENOMEM;
-           fd = -1;
-       } else {
-           res->fds[res->nfds] = fd;
-           res->nfds++;
-       }
-    }
-
-    if (fd >= 0 && res->nfds > 0) {
-       res->readres = alloc(res->nfds * SIZEOF(*res->readres));
-       memset(res->readres, 0, res->nfds * SIZEOF(*res->readres));
-    }
-
-    rait_debug(stderr, _("rait_open:returning %d%s%s\n"),
-                       fd,
-                       (fd < 0) ? ": " : "",
-                       (fd < 0) ? strerror(errno) : "");
-
-    return fd;
-}
-
-#ifdef NO_AMANDA
-int
-tapeio_init_devname(
-    char *     dev,
-    char **    dev_left,
-    char **    dev_right,
-    char **    dev_next)
-{
-    /*
-    ** find the first { and then the first } that follows it
-    */
-    if ( 0 == (*dev_next = strchr(dev, '{'))
-        || 0 == (*dev_right = strchr(*dev_next + 1, '}')) ) {
-       /* we dont have a {} pair */
-       amfree(dev);
-       errno = EINVAL;
-       return -1;
-    }
-
-    *dev_left = dev;                           /* before the { */
-    **dev_next = 0;                            /* zap the { */
-    (*dev_next)++;
-    (*dev_right)++;                            /* after the } */
-    return 0;
-}
-
-char *
-tapeio_next_devname(
-    char *     dev_left,
-    char *     dev_right,
-    char **    dev_next)
-{
-    char *dev_real = 0;
-    char *next;
-    int len;
-
-    next = *dev_next;
-    if (0 != (*dev_next = strchr(next, ','))
-       || 0 != (*dev_next = strchr(next, '}'))){
-
-       **dev_next = 0;                         /* zap the terminator */
-       (*dev_next)++;
-
-       /*
-       ** we have one string picked out, build it into the buffer
-       */
-       len = strlen(dev_left) + strlen(next) + strlen(dev_right) + 1;
-       dev_real = alloc(len);
-       strcpy(dev_real, dev_left);             /* safe */
-       strcat(dev_real, next);         /* safe */
-       strcat(dev_real, dev_right);    /* safe */
-    }
-    return dev_real;
-}
-#endif
-
-/*
-** close everything we opened and free our memory.
-*/
-int
-rait_close(
-    int fd)
-{
-    int i;                     /* index into RAIT drives */
-    int j;                     /* individual tapefd_close result */
-    int res;                   /* result from close */
-    RAIT *pr;                  /* RAIT entry from table */
-    int save_errno = errno;
-    pid_t kid;
-    int **fds_p;
-
-    rait_debug(stderr,_("rait_close( %d )\n"), fd);
-
-    if ((fd < 0) || ((size_t)fd >= rait_table_count)) {
-       errno = EBADF;
-       rait_debug(stderr, _("rait_close:returning %d: %s\n"),
-                           -1,
-                           strerror(errno));
-       return -1;
-    }
-
-    pr = &rait_table[fd];
-    if (0 == pr->nopen) {
-       errno = EBADF;
-       rait_debug(stderr, _("rait_close:returning %d: %s\n"),
-                           -1,
-                           strerror(errno));
-       return -1;
-    }
-
-    if (0 == pr->readres && 0 < pr->nfds) {
-       pr->readres = alloc(pr->nfds * SIZEOF(*pr->readres));
-       memset(pr->readres, 0, pr->nfds * SIZEOF(*pr->readres));
-    }
-
-    res = 0;
-    /*
-    ** this looks strange, but we start kids who are going to close the
-    ** drives in parallel just after the parent has closed their copy of
-    ** the descriptor. ('cause closing tape devices usually causes slow
-    ** activities like filemark writes, etc.)
-    */
-    for( i = 0; i < pr->nfds; i++ ) {
-       if(tapefd_can_fork(pr->fds[i])) {
-           if ((kid = fork()) == 0) {
-               /* we are the child process */
-               sleep(0);
-               j = tapefd_close(pr->fds[i]);
-               exit(j);
-            } else {
-               /* remember who the child is or that an error happened */
-               pr->readres[i] = (ssize_t)kid;
-            }
-       }
-       else {
-           j = tapefd_close(pr->fds[i]);
-           if ( j != 0 )
-               res = j;
-           pr->readres[i] = -1;
-       }
-    }
-
-    for( i = 0; i < pr->nfds; i++ ) {
-       j = tapefd_close(pr->fds[i]);
-       if ( j != 0 )
-           res = j;
-    }
-
-    for( i = 0; i < pr->nfds; i++ ) {
-        int stat;
-       if(pr->readres[i] != -1) {
-           waitpid((pid_t)pr->readres[i], &stat, 0);
-           if( WEXITSTATUS(stat) != 0 ) {
-               res = WEXITSTATUS(stat);
-               if( res == 255 )
-                   res = -1;
-           }
-        }
-    }
-    if (pr->nfds > 1) {
-       (void)close(fd);        /* close the dummy /dev/null descriptor */
-    }
-    if (0 != pr->fds) {
-        fds_p = &pr->fds;
-       amtable_free((void **)fds_p, &pr->fd_count);
-    }
-    if (0 != pr->readres) {
-       amfree(pr->readres);
-    }
-    if (0 != pr->xorbuf) {
-       amfree(pr->xorbuf);
-    }
-    pr->nopen = 0;
-    errno = save_errno;
-    rait_debug(stderr, _("rait_close:returning %d%s%s\n"),
-                       res,
-                       (res < 0) ? ": " : "",
-                       (res < 0) ? strerror(errno) : "");
-    return res;
-}
-
-/*\f*/
-
-/*
-** seek out to the nth byte on the RAIT set.
-** this is assumed to be evenly divided across all the stripes
-*/
-off_t
-rait_lseek(
-    int                fd,
-    off_t      pos,
-    int                whence)
-{
-    int i;                     /* drive number in RAIT */
-    off_t res,                         /* result of lseeks */
-        total;                 /* total of results */
-    RAIT *pr;                  /* RAIT slot in table */
-
-    rait_debug(stderr, _("rait_lseek(%d, %lld, %d)\n"),
-               fd, (long long)pos, whence);
-
-    if ((fd < 0) || ((size_t)fd >= rait_table_count)) {
-       errno = EBADF;
-       rait_debug(stderr, _("rait_lseek:returning %d: %s\n"),
-                           -1,
-                           strerror(errno));
-       return (off_t)-1;
-    }
-
-    pr = &rait_table[fd];
-    if (0 == pr->nopen) {
-       errno = EBADF;
-       rait_debug(stderr, _("rait_lseek:returning %d: %s\n"),
-                           -1,
-                           strerror(errno));
-       return (off_t)-1;
-    }
-
-    if ((pr->nfds > 1) && ((pos % (off_t)(pr->nfds-1)) != (off_t)0)) {
-       errno = EDOM;
-       total = (off_t)-1;
-    } else {
-       total = (off_t)0;
-       pos = pos / (off_t)pr->nfds;
-       for( i = 0; i < pr->nfds; i++ ) {
-           if ((off_t)0 >= (res = lseek(pr->fds[i], pos, whence))) {
-               total = res;
-               break;
-           }
-           total += res;
-       }
-    }
-    rait_debug(stderr, _("rait_lseek:returning %ld%s%s\n"),
-                       total,
-                       (total < 0) ? ": " : "",
-                       (total < 0) ? strerror(errno) : "");
-    return total;
-}
-
-/*\f*/
-
-/*
-** if we only have one stream, just do a write,
-** otherwise compute an xor sum, and do several
-** writes...
-*/
-ssize_t
-rait_write(
-    int                fd,
-    const void *bufptr,
-    size_t     len)
-{
-    const char *buf = bufptr;
-    int i;     /* drive number */
-    size_t j;  /* byte offset */
-    RAIT *pr;  /* RAIT structure for this RAIT */
-    ssize_t res;
-    ssize_t total = 0;
-    int data_fds;      /* number of data stream file descriptors */
-
-    rait_debug(stderr, _("rait_write(%d,%lx,%d)\n"),fd,(unsigned long)buf,len);
-
-    if ((fd < 0) || ((size_t)fd >= rait_table_count)) {
-       errno = EBADF;
-       rait_debug(stderr, _("rait_write:returning %d: %s\n"),
-                           -1,
-                           strerror(errno));
-       return -1;
-    }
-
-    pr = &rait_table[fd];
-    if (0 == pr->nopen) {
-       errno = EBADF;
-       rait_debug(stderr, _("rait_write:returning %d: %s\n"),
-                           -1,
-                           strerror(errno));
-       return -1;
-    }
-
-    /* need to be able to slice it up evenly... */
-    if (pr->nfds > 1) {
-       data_fds = pr->nfds - 1;
-       if (0 != len % data_fds) {
-           errno = EDOM;
-           rait_debug(stderr, _("rait_write:returning %d: %s\n"),
-                               -1,
-                               strerror(errno));
-           return -1;
-       }
-       /* each slice gets an even portion */
-       len = len / data_fds;
-
-       /* make sure we have enough buffer space */
-       if (len > (size_t)pr->xorbuflen) {
-           if (0 != pr->xorbuf) {
-               amfree(pr->xorbuf);
-           }
-           pr->xorbuf = alloc(len);
-           pr->xorbuflen = len;
-       }
-
-       /* compute the sum */
-       memcpy(pr->xorbuf, buf, len);
-       for( i = 1; i < data_fds; i++ ) {
-           for( j = 0; j < len; j++ ) {
-               pr->xorbuf[j] ^= buf[len * i + j];
-           }
-       }
-    } else {
-       data_fds = pr->nfds;
-    }
-
-    /* write the chunks in the main buffer */
-    for( i = 0; i < data_fds; i++ ) {
-       res = tapefd_write(pr->fds[i], buf + len*i , len);
-       rait_debug(stderr, _("rait_write: write(%d,%lx,%d) returns %d%s%s\n"),
-                       pr->fds[i],
-                       (unsigned long)(buf + len*i),
-                       len,
-                       res,
-                       (res < 0) ? ": " : "",
-                       (res < 0) ? strerror(errno) : "");
-       if (res < 0) {
-           total = res;
-           break;
-       }
-       total += res;
-    }
-    if (total >= 0 && pr->nfds > 1) {
-        /* write the sum, don't include it in the total bytes written */
-       res = tapefd_write(pr->fds[i], pr->xorbuf, len);
-       rait_debug(stderr, _("rait_write: write(%d,%lx,%d) returns %d%s%s\n"),
-                   pr->fds[i],
-                   (unsigned long)pr->xorbuf,
-                   len,
-                   res,
-                   (res < 0) ? ": " : "",
-                   (res < 0) ? strerror(errno) : "");
-       if (res < 0) {
-           total = res;
-       }
-    }
-
-    rait_debug(stderr, _("rait_write:returning %d%s%s\n"),
-                       total,
-                       (total < 0) ? ": " : "",
-                       (total < 0) ? strerror(errno) : "");
-
-    return total;
-}
-
-/*\f*/
-
-/*
-** once again, if there is one data stream do a read, otherwise
-** do all n reads, and if any of the first n - 1 fail, compute
-** the missing block from the other three, then return the data.
-** there's some silliness here for reading tape with bigger buffers
-** than we wrote with, (thus the extra bcopys down below).  On disk if
-** you read with a bigger buffer size than you wrote with, you just
-** garble the data...
-*/
-ssize_t
-rait_read(
-    int                fd,
-    void *     bufptr,
-    size_t     len)
-{
-    char *buf = bufptr;
-    int nerrors, neofs, errorblock;
-    ssize_t    total;
-    int i;
-    size_t j;
-    RAIT *pr;
-    int data_fds;
-    int save_errno = errno;
-    ssize_t maxreadres = 0;
-    int sum_mismatch = 0;
-
-    rait_debug(stderr, _("rait_read(%d,%lx,%d)\n"),fd,(unsigned long)buf,len);
-
-    if ((fd < 0) || ((size_t)fd >= rait_table_count)) {
-       errno = EBADF;
-       rait_debug(stderr, _("rait_read:returning %d: %s\n"),
-                           -1,
-                           strerror(errno));
-       return -1;
-    }
-
-    pr = &rait_table[fd];
-    if (0 == pr->nopen) {
-       errno = EBADF;
-       rait_debug(stderr, _("rait_read:returning %d: %s\n"),
-                           -1,
-                           strerror(errno));
-       return -1;
-    }
-
-    nerrors = 0;
-    neofs = 0;
-    errorblock = -1;
-    /* once again , we slice it evenly... */
-    if (pr->nfds > 1) {
-       data_fds = pr->nfds - 1;
-       if (0 != len % data_fds) {
-           errno = EDOM;
-           rait_debug(stderr, _("rait_read:returning %d: %s\n"),
-                               -1,
-                               strerror(errno));
-           return -1;
-       }
-       len = len / data_fds;
-    } else {
-       data_fds = 1;
-    }
-
-    /* try all the reads, save the result codes */
-    /* count the eof/errors */
-    for( i = 0; i < data_fds; i++ ) {
-       pr->readres[i] = tapefd_read(pr->fds[i], buf + len*i , len);
-       rait_debug(stderr, _("rait_read: read on fd %d returns %d%s%s\n"),
-                   pr->fds[i],
-                   pr->readres[i],
-                   (pr->readres[i] < 0) ? ": " : "",
-                   (pr->readres[i] < 0) ? strerror(errno) : "");
-       if ( pr->readres[i] <= 0 ) {
-           if ( pr->readres[i] == 0 ) {
-               neofs++;
-           } else {
-               if (0 == nerrors) {
-                   save_errno = errno;
-               }
-               nerrors++;
-           }
-           errorblock = i;
-       } else if (pr->readres[i] > maxreadres) {
-           maxreadres = pr->readres[i];
-       }
-    }
-    if (pr->nfds > 1) {
-       /* make sure we have enough buffer space */
-       if (len > (size_t)pr->xorbuflen) {
-           if (0 != pr->xorbuf) {
-               amfree(pr->xorbuf);
-           }
-           pr->xorbuf = alloc(len);
-           pr->xorbuflen = len;
-       }
-       pr->readres[i] = tapefd_read(pr->fds[i], pr->xorbuf , len);
-       rait_debug(stderr, _("rait_read: read on fd %d returns %d%s%s\n"),
-                   pr->fds[i],
-                   pr->readres[i],
-                   (pr->readres[i] < 0) ? ": " : "",
-                   (pr->readres[i] < 0) ? strerror(errno) : "");
-    }
-
-    /*
-     * Make sure all the reads were the same length
-     */
-    for (j = 0; j < (size_t)pr->nfds; j++) {
-       if (pr->readres[j] != maxreadres) {
-           nerrors++;
-           errorblock = (int)j;
-       }
-    }
-
-    /*
-     * If no errors, check that the xor sum matches
-     */
-    if ( nerrors == 0 && pr->nfds > 1  ) {
-       for(i = 0; i < (int)maxreadres; i++ ) {
-          int sum = 0;
-          for(j = 0; (j + 1) < (size_t)pr->nfds; j++) {
-              sum ^= (buf + len * j)[i];
-           }
-          if (sum != pr->xorbuf[i]) {
-             sum_mismatch = 1;
-          }
-       }
-    }
-
-    /*
-    ** now decide what "really" happened --
-    ** all n getting eof is a "real" eof
-    ** just one getting an error/eof is recoverable if we are doing RAIT
-    ** anything else fails
-    */
-
-    if (neofs == pr->nfds) {
-       rait_debug(stderr, _("rait_read:returning 0\n"));
-       return 0;
-    }
-
-    if (sum_mismatch) {
-       errno = EDOM;
-       rait_debug(stderr, _("rait_read:returning %d: %s\n"),
-                           -1,
-                           _("XOR block mismatch"));
-       return -1;
-    }
-
-    if (nerrors > 1 || (pr->nfds <= 1 && nerrors > 0)) {
-       errno = save_errno;
-       rait_debug(stderr, _("rait_read:returning %d: %s\n"),
-                           -1,
-                           strerror(errno));
-       return -1;
-    }
-
-    /*
-    ** so now if we failed on a data block, we need to do a recovery
-    ** if we failed on the xor block -- who cares?
-    */
-    if (nerrors == 1 && pr->nfds > 1 && errorblock != pr->nfds-1) {
-
-       rait_debug(stderr, _("rait_read: fixing data from fd %d\n"),
-                           pr->fds[errorblock]);
-
-       /* the reads were all *supposed* to be the same size, so... */
-       pr->readres[errorblock] = maxreadres;
-
-       /* fill it in first with the xor sum */
-       memcpy(buf + len * errorblock, pr->xorbuf, len);
-
-       /* xor back out the other blocks */
-       for( i = 0; i < data_fds; i++ ) {
-           if( i != errorblock ) {
-               for( j = 0; j < len ; j++ ) {
-                   buf[j + len * errorblock] ^= buf[j + len * i];
-               }
-           }
-       }
-       /* there, now the block is back as if it never failed... */
-    }
-
-    /* pack together partial reads... */
-    total = pr->readres[0];
-    for( i = 1; i < data_fds; i++ ) {
-       if (total != (ssize_t)(len * i)) {
-           memmove(buf + total, buf + len*i, (size_t)pr->readres[i]);
-        }
-       total += pr->readres[i];
-    }
-
-    rait_debug(stderr, _("rait_read:returning %d%s%s\n"),
-                       total,
-                       (total < 0) ? ": " : "",
-                       (total < 0) ? strerror(errno) : "");
-
-    return total;
-}
-
-/*\f*/
-
-int
-rait_ioctl(
-    int                fd,
-    int                op,
-    void *     p)
-{
-    int i, res = 0;
-    RAIT *pr;
-    int errors = 0;
-
-    rait_debug(stderr, _("rait_ioctl(%d,%d)\n"),fd,op);
-
-    if ((fd < 0) || ((size_t)fd >= rait_table_count)) {
-       errno = EBADF;
-       rait_debug(stderr, _("rait_ioctl:returning %d: %s\n"),
-                           -1,
-                           strerror(errno));
-       return -1;
-    }
-
-    pr = &rait_table[fd];
-    if (0 == pr->nopen) {
-       errno = EBADF;
-       rait_debug(stderr, _("rait_ioctl:returning %d: %s\n"),
-                           -1,
-                           strerror(errno));
-       return -1;
-    }
-
-    for( i = 0; i < pr->nfds ; i++ ) {
-       /*@ignore@*/
-       res = ioctl(pr->fds[i], op, p);
-       /*@end@*/
-       if ( res != 0 ) {
-           errors++;
-           if (errors > 1) {
-               break;
-           }
-           res = 0;
-       }
-    }
-
-    rait_debug(stderr, _("rait_ioctl: returning %d%s%s\n"),
-                       res,
-                       (res < 0) ? ": " : "",
-                       (res < 0) ? strerror(errno) : "");
-
-    return res;
-}
-
-/*
-** access() all the devices, returning if any fail
-*/
-int
-rait_access(
-    char *     devname,
-    int                flags)
-{
-    int res = 0;
-    char *dev_left;            /* string before { */
-    char *dev_right;           /* string after } */
-    char *dev_next;            /* string inside {} */
-    char *dev_real;            /* parsed device name */
-
-    /* copy and parse the dev string so we can scribble on it */
-    devname = stralloc(devname);
-    if (0 == devname) {
-       rait_debug(stderr, _("rait_access:returning %d: %s\n"),
-                           -1,
-                           _("out of stralloc memory"));
-       return -1;
-    }
-    if ( 0 != tapeio_init_devname(devname, &dev_left, &dev_right, &dev_next)) {
-       rait_debug(stderr, _("rait_access:returning %d: %s\n"),
-                           -1,
-                           strerror(errno));
-       return -1;
-    }
-
-    while( 0 != (dev_real = tapeio_next_devname(dev_left, dev_right, &dev_next))) {
-       res = tape_access(dev_real, flags);
-       rait_debug(stderr,_("rait_access:access( %s, %d ) yields %d\n"),
-               dev_real, flags, res );
-       amfree(dev_real);
-       if (res < 0) {
-           break;
-        }
-    }
-    amfree(devname);
-
-    rait_debug(stderr, _("rait_access: returning %d%s%s\n"),
-                       res,
-                       (res < 0) ? ": " : "",
-                       (res < 0) ? strerror(errno) : "");
-
-    return res;
-}
-
-/*
-** stat all the devices, returning the last one unless one fails
-*/
-int
-rait_stat(
-    char *      devname,
-    struct stat *buf)
-{
-    int res = 0;
-    char *dev_left;            /* string before { */
-    char *dev_right;           /* string after } */
-    char *dev_next;            /* string inside {} */
-    char *dev_real;            /* parsed device name */
-
-    /* copy and parse the dev string so we can scribble on it */
-    devname = stralloc(devname);
-    if (0 == devname) {
-       rait_debug(stderr, _("rait_access:returning %d: %s\n"),
-                           -1,
-                           _("out of stralloc memory"));
-       return -1;
-    }
-    if ( 0 != tapeio_init_devname(devname, &dev_left, &dev_right, &dev_next)) {
-       rait_debug(stderr, _("rait_access:returning %d: %s\n"),
-                           -1,
-                           strerror(errno));
-       return -1;
-    }
-
-    while( 0 != (dev_real = tapeio_next_devname(dev_left, dev_right, &dev_next))) {
-       res = tape_stat(dev_real, buf);
-       rait_debug(stderr,_("rait_stat:stat( %s ) yields %d (%s)\n"),
-               dev_real, res, (res != 0) ? strerror(errno) : _("no error") );
-       amfree(dev_real);
-       if (res != 0) {
-           break;
-        }
-    }
-    amfree(devname);
-
-    rait_debug(stderr, _("rait_access: returning %d%s%s\n"),
-                       res,
-                       (res < 0) ? ": " : "",
-                       (res < 0) ? strerror(errno) : "");
-
-    return res;
-}
-
-/*\f*/
-
-int
-rait_copy(
-    char *     f1,
-    char *     f2,
-    size_t     buflen)
-{
-    int t1, t2;
-    ssize_t len;
-    ssize_t wres;
-    char *buf;
-    int save_errno;
-
-    t1 = rait_open(f1,O_RDONLY,0644);
-    if (t1 < 0) {
-       return t1;
-    }
-    t2 = rait_open(f2,O_CREAT|O_RDWR,0644);
-    if (t2 < 0) {
-       save_errno = errno;
-       (void)rait_close(t1);
-       errno = save_errno;
-       return -1;
-    }
-    buf = alloc(buflen);
-    do {
-       len = rait_read(t1,buf,buflen);
-       if (len > 0 ) {
-           wres = rait_write(t2, buf, (size_t)len);
-           if (wres < 0) {
-               len = -1;
-               break;
-           }
-       }
-    } while( len > 0 );
-    save_errno = errno;
-    amfree(buf);
-    (void)rait_close(t1);
-    (void)rait_close(t2);
-    errno = save_errno;
-    return (len < 0) ? -1 : 0;
-}
-
-/*\f*/
-
-/*
-** Amanda Tape API routines:
-*/
-
-static int
-rait_tapefd_ioctl(
-    int                (*func0)(int),
-    int                (*func1)(int, off_t),
-    int                fd,
-    off_t      count)
-{
-    int i, j, res = 0;
-    RAIT *pr;
-    int errors = 0;
-    pid_t kid;
-    int status = 0;
-
-    rait_debug(stderr, _("rait_tapefd_ioctl(%d,%d)\n"),fd,count);
-
-    if ((fd < 0) || ((size_t)fd >= rait_table_count)) {
-       errno = EBADF;
-       rait_debug(stderr, _("rait_tapefd_ioctl:returning %d: %s\n"),
-                           -1,
-                           strerror(errno));
-       return -1;
-    }
-
-    pr = &rait_table[fd];
-    if (0 == pr->nopen) {
-       errno = EBADF;
-       rait_debug(stderr, _("rait_tapefd_ioctl:returning %d: %s\n"),
-                           -1,
-                           strerror(errno));
-       return -1;
-    }
-
-    if (0 == pr->readres && 0 < pr->nfds) {
-       pr->readres = alloc(pr->nfds * SIZEOF(*pr->readres));
-       memset(pr->readres, 0, pr->nfds * SIZEOF(*pr->readres));
-    }
-
-    for( i = 0; i < pr->nfds ; i++ ) {
-       if(tapefd_can_fork(pr->fds[i])) {
-            if ((kid = fork()) < 1) {
-               rait_debug(stderr, _("in kid, fork returned %d\n"), kid);
-               /* if we are the kid, or fork failed do the action */
-               if (func0 != NULL) {
-                   res = (*func0)(pr->fds[i]);
-               } else {
-                   res = (*func1)(pr->fds[i], count);
-               }
-               rait_debug(stderr, _("in kid, func (%d) returned %d errno %s\n"),
-                               pr->fds[i], res, strerror(errno));
-               if (kid == 0)
-                   exit(res);
-            } else {
-               rait_debug(stderr, _("in parent, fork returned %d\n"), kid);
-               pr->readres[i] = (ssize_t)kid;
-            }
-       }
-       else {
-           if(func0 != NULL) {
-               j = (*func0)(pr->fds[i]);
-           } else {
-               j = (*func1)(pr->fds[i], count);
-           }
-           if( j != 0) {
-               errors++;
-           }
-           pr->readres[i] = -1;
-       }
-    }
-    for( i = 0; i < pr->nfds ; i++ ) {
-       if(tapefd_can_fork(pr->fds[i])) {
-            rait_debug(stderr, _("in parent, waiting for %d\n"), pr->readres[i]);
-           waitpid((pid_t)pr->readres[i], &status, 0);
-           if( WEXITSTATUS(status) != 0 ) {
-               res = WEXITSTATUS(status);
-               if( res == 255 )
-                   res = -1;
-            }
-            rait_debug(stderr, _("in parent, return code was %d\n"), res);
-           if ( res != 0 ) {
-               errors++;
-               res = 0;
-           }
-       }
-    }
-    if (errors > 0) {
-       res = -1;
-    }
-
-    rait_debug(stderr, _("rait_tapefd_ioctl: returning %d%s%s\n"),
-                       res,
-                       (res < 0) ? ": " : "",
-                       (res < 0) ? strerror(errno) : "");
-
-    return res;
-}
-
-int
-rait_tapefd_fsf(
-    int                fd,
-    off_t      count)
-{
-    return rait_tapefd_ioctl(NULL, tapefd_fsf, fd, count);
-}
-
-int
-rait_tapefd_rewind(
-    int                fd)
-{
-    return rait_tapefd_ioctl(tapefd_rewind, NULL, fd, (off_t)-1);
-}
-
-int
-rait_tapefd_unload(
-    int                fd)
-{
-    return rait_tapefd_ioctl(tapefd_unload, NULL, fd, (off_t)-1);
-}
-
-int
-rait_tapefd_weof(
-    int                fd,
-    off_t      count)
-{
-    return rait_tapefd_ioctl(NULL, tapefd_weof, fd, count);
-}
-
-int
-rait_tape_open(
-    char *     name,
-    int                flags,
-    mode_t     mask)
-{
-    return rait_open(name, flags, mask);
-}
-
-int
-rait_tapefd_status(
-    int                         fd,
-    struct am_mt_status *stat)
-{
-    int i;
-    RAIT *pr;
-    int res = 0;
-    int errors = 0;
-
-    rait_debug(stderr, _("rait_tapefd_status(%d)\n"),fd);
-
-    if ((fd < 0) || ((size_t)fd >= rait_table_count)) {
-       errno = EBADF;
-       rait_debug(stderr, _("rait_tapefd_status:returning %d: %s\n"),
-                           -1,
-                           strerror(errno));
-       return -1;
-    }
-
-    pr = &rait_table[fd];
-    if (0 == pr->nopen) {
-       errno = EBADF;
-       rait_debug(stderr, _("rait_tapefd_status:returning %d: %s\n"),
-                           -1,
-                           strerror(errno));
-       return -1;
-    }
-
-    for( i = 0; i < pr->nfds ; i++ ) {
-       res = tapefd_status(pr->fds[i], stat);
-       if(res != 0) {
-           errors++;
-       }
-    }
-    if (errors > 0) {
-       res = -1;
-    }
-    return res;
-}
-
-void
-rait_tapefd_resetofs(
-    int                fd)
-{
-    (void)rait_lseek(fd, (off_t)0, SEEK_SET);
-}
-
-int
-rait_tapefd_can_fork(
-    int                fd)
-{
-    (void)fd;  /* Quiet unused parameter warning */
-
-    return 0;
-}
-
diff --git a/tape-src/output-rait.h b/tape-src/output-rait.h
deleted file mode 100644 (file)
index a9ad743..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-/* NOTE: this driver is *deprecated* and should not be used.  See the Device API
- * in device-src/ for the new implementation.
- */
-
-#ifndef RAIT_H
-
-#define RAIT_H
-
-typedef struct {
-    int nopen;
-    int nfds;
-    size_t fd_count;
-    int *fds;
-    ssize_t *readres;
-    size_t xorbuflen;
-    char *xorbuf;
-} RAIT;
-
-#ifdef NO_AMANDA
-
-#define stralloc strdup
-
-/*
- * Tape drive status structure.  This abstracts the things we are
- * interested in from the free-for-all of what the various drivers
- * supply.
- */
-
-struct am_mt_status {
-    char online_valid;                 /* is the online flag valid? */
-    char bot_valid;                    /* is the BOT flag valid? */
-    char eot_valid;                    /* is the EOT flag valid? */
-    char protected_valid;              /* is the protected flag valid? */
-    char flags_valid;                  /* is the flags field valid? */
-    char fileno_valid;                 /* is the fileno field valid? */
-    char blkno_valid;                  /* is the blkno field valid? */
-    char device_status_valid;          /* is the device status field valid? */
-    char error_status_valid;           /* is the device status field valid? */
-
-    char online;                       /* true if device is online/ready */
-    char bot;                          /* true if tape is at the beginning */
-    char eot;                          /* true if tape is at end of medium */
-    char protected;                    /* true if tape is write protected */
-    long flags;                                /* device flags, whatever that is */
-    off_t fileno;                      /* tape file number */
-    off_t blkno;                       /* block within file */
-    int device_status_size;            /* size of orig device status field */
-    unsigned long device_status;       /* "device status", whatever that is */
-    int error_status_size;             /* size of orig error status field */
-    unsigned long error_status;                /* "error status", whatever that is */
-};
-#endif
-
-int rait_open(char *dev, int flags, mode_t mask);
-int rait_access(char *, int);
-int rait_stat(char *, struct stat *);
-int rait_close(int);
-off_t rait_lseek(int, off_t, int);
-ssize_t rait_write(int, const void *, size_t);
-ssize_t rait_read(int, void *, size_t);
-int rait_ioctl(int, int, void *);
-int rait_copy(char *f1, char *f2, size_t buflen);
-char *rait_init_namelist(char * dev, char **dev_left, char **dev_right, char **dev_next);
-int rait_next_name(char * dev_left, char * dev_right, char **dev_next, char * dev_real);
-int  rait_tape_open(char *, int, mode_t);
-int  rait_tapefd_fsf(int rait_tapefd, off_t count);
-int  rait_tapefd_rewind(int rait_tapefd);
-void rait_tapefd_resetofs(int rait_tapefd);
-int  rait_tapefd_unload(int rait_tapefd);
-int  rait_tapefd_status(int rait_tapefd, struct am_mt_status *stat);
-int  rait_tapefd_weof(int rait_tapefd, off_t count);
-int  rait_tapefd_can_fork(int);
-
-#ifdef RAIT_REDIRECT
-
-/* handle ugly Solaris stat mess */
-
-#ifdef _FILE_OFFSET_BITS
-#include <sys/stat.h>
-#undef stat
-#undef open
-#if _FILE_OFFSET_BITS == 64
-struct stat {
-       dev_t   st_dev;
-       long    st_pad1[3];     /* reserved for network id */
-       ino_t   st_ino;
-       mode_t  st_mode;
-       nlink_t st_nlink;
-       uid_t   st_uid;
-       gid_t   st_gid;
-       dev_t   st_rdev;
-       long    st_pad2[2];
-       off_t   st_size;
-       timestruc_t st_atim;
-       timestruc_t st_mtim;
-       timestruc_t st_ctim;
-       long    st_blksize;
-       blkcnt_t st_blocks;
-       char    st_fstype[_ST_FSTYPSZ];
-       long    st_pad4[8];     /* expansion area */
-};
-#endif
-
-#endif
-
-#define access(p,f)    rait_access(p,f)
-#define stat(a,b)      rait_stat(a,b)
-#define open           rait_open
-#define        close(a)        rait_close(a)
-#define read(f,b,l)    rait_read(f,b,l)
-#define write(f,b,l)   rait_write(f,b,l)
-#define        ioctl(f,n,x)    rait_ioctl(f,n,x)
-#endif
-
-#endif
diff --git a/tape-src/output-tape.c b/tape-src/output-tape.c
deleted file mode 100644 (file)
index aad2bce..0000000
+++ /dev/null
@@ -1,739 +0,0 @@
-/*
- * Amanda, The Advanced Maryland Automatic Network Disk Archiver
- * Copyright (c) 1991-1998 University of Maryland at College Park
- * All Rights Reserved.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of U.M. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission.  U.M. makes no representations about the
- * suitability of this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- *
- * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M.
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: James da Silva, Systems Design and Analysis Group
- *                        Computer Science Department
- *                        University of Maryland at College Park
- */
-
-/* NOTE: this driver is *deprecated* and should not be used.  See the Device API
- * in device-src/ for the new implementation.
- */
-
-/*
- * $Id: output-tape.c,v 1.18 2006/08/22 14:19:39 martinea Exp $
- *
- * tapeio.c virtual tape interface for normal tape drives.
- */
-
-#ifdef NO_AMANDA
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#else
-#include "amanda.h"
-#include "tapeio.h"
-#endif
-
-#include "output-tape.h"
-
-#ifndef NO_AMANDA
-#include "fileheader.h"
-#endif
-
-#ifndef R_OK
-#define R_OK 4
-#define W_OK 2
-#endif
-
-/*
-=======================================================================
-** Here are the ioctl() interface routines, which are #ifdef-ed
-** heavily by platform.
-=======================================================================
-*/
-
-#if defined(HAVE_BROKEN_FSF)                                           /* { */
-/*
- * tape_tapefd_fsf -- handle systems that have a broken fsf operation
- * and cannot do an fsf operation unless they are positioned at a tape
- * mark (or BOT).  Sheesh!  This shows up in amrestore as I/O errors
- * when skipping.
- */
-
-int
-tape_tapefd_fsf(
-    int fd,
-    off_t count)
-{
-    size_t buflen;
-    char *buffer = NULL;
-    int len = 0;
-
-    buflen = getconf_readblocksize() * 1024;
-    buffer = alloc(buflen);
-
-    while(--count >= 0) {
-       while((len = tapefd_read(fd, buffer, buflen)) > 0) {}
-       if(len < 0) {
-           break;
-       }
-    }
-    amfree(buffer);
-    return len;
-}
-#endif                                                                 /* } */
-
-#ifdef WANT_TAPE_UWARE                                                 /* { */
-
-#include <sys/tape.h>
-
-/*
- * Rewind a tape to the beginning.
- */
-int
-tape_tapefd_rewind(
-    int fd)
-{
-    int st;
-
-    return ioctl(fd, T_RWD, &st);
-}
-
-/*
- * Rewind and unload a tape.
- */
-int
-tape_tapefd_unload(
-    int fd)
-{
-    int st;
-
-    return ioctl(fd, T_OFFL, &st);
-}
-
-#if !defined(HAVE_BROKEN_FSF)
-/*
- * Forward space the tape device count files.
- */
-int
-tape_tapefd_fsf(
-    int fd,
-    off_t count)
-{
-    int st;
-    int status;
-
-    while (--count >= 0) {
-        if ((status = ioctl(fd, T_SFF, &st)) != 0) {
-            break;
-       }
-    }
-
-    return status;
-}
-#endif
-
-/*
- * Write some number of end of file marks (a.k.a. tape marks).
- */
-int
-tape_tapefd_weof(
-    int fd,
-    off_t count)
-{
-    int st;
-    int status;
-
-    while (--count >= (off_t)0) {
-        if ((status = ioctl(fd, T_WRFILEM, &st)) != 0) {
-            break;
-       }
-    }
-
-    return status;
-}
-
-#else                                                                  /* }{ */
-#ifdef WANT_TAPE_AIX                                                   /* { */
-
-#include <sys/tape.h>
-
-/*
- * Rewind a tape to the beginning.
- */
-int
-tape_tapefd_rewind(
-    int fd)
-{
-    struct stop st;
-
-    st.st_op = STREW;
-    st.st_count = 1;
-
-    return ioctl(fd, STIOCTOP, &st);
-}
-
-/*
- * Rewind and unload a tape.
- */
-int
-tape_tapefd_unload(
-    int fd)
-{
-    struct stop st;
-
-    st.st_op = STOFFL;
-    st.st_count = 1;
-
-    return ioctl(fd, STIOCTOP, &st);
-}
-
-#if !defined(HAVE_BROKEN_FSF)
-/*
- * Forward space the tape device count files.
- */
-int
-tape_tapefd_fsf(
-    int fd,
-    off_t count)
-{
-    struct stop st;
-
-    if ((count > (off_t)INT_MAX) || (count < (off_t)INT_MIN)) {
-#ifdef EOVERFLOW
-           errno = EOVERFLOW;
-#else
-           errno = EINVAL;
-#endif
-       return -1;
-    }
-
-    st.st_op = STFSF;
-    st.st_count = (int)count;
-
-    return ioctl(fd, STIOCTOP, &st);
-}
-#endif
-
-/*
- * Write some number of end of file marks (a.k.a. tape marks).
- */
-int
-tape_tapefd_weof(
-    int fd,
-    off_t count)
-{
-    struct stop st;
-
-    if ((count > (off_t)INT_MAX) || (count < (off_t)INT_MIN)) {
-#ifdef EOVERFLOW
-           errno = EOVERFLOW;
-#else
-           errno = EINVAL;
-#endif
-       return -1;
-    }
-
-    st.st_op = STWEOF;
-    st.st_count = (int)count;
-
-    return ioctl(fd, STIOCTOP, &st);
-}
-
-#else /* WANT_TAPE_AIX */                                                      /* }{ */
-#ifdef WANT_TAPE_XENIX                                                 /* { */
-
-#include <sys/tape.h>
-
-/*
- * Rewind a tape to the beginning.
- */
-int
-tape_tapefd_rewind(
-    int fd)
-{
-    int st;
-
-    return ioctl(fd, MT_REWIND, &st);
-}
-
-/*
- * Rewind and unload a tape.
- */
-int
-tape_tapefd_unload(
-    int fd)
-{
-    int st;
-    int f;
-
-#ifdef MT_OFFLINE
-    f = MT_OFFLINE;
-#else
-#ifdef MT_UNLOAD
-    f = MT_UNLOAD;
-#else
-    f = syntax error;
-#endif
-#endif
-    return ioctl(fd, f, &st);
-}
-
-#if !defined(HAVE_BROKEN_FSF)
-/*
- * Forward space the tape device count files.
- */
-int
-tape_tapefd_fsf(
-    int fd,
-    off_t count)
-{
-    int st;
-    int status;
-
-    while (--count >= 0) {
-       if ((status = ioctl(fd, MT_RFM, &st)) != 0) {
-           break;
-       }
-    }
-
-    return status;
-}
-#endif
-
-/*
- * Write some number of end of file marks (a.k.a. tape marks).
- */
-int
-tape_tapefd_weof(
-    int fd,
-    off_t count)
-{
-    int st;
-    int c;
-    int status;
-
-    while (--count >= 0) {
-       if ((status = ioctl(fd, MT_WFM, &st)) != 0) {
-           break;
-       }
-    }
-
-    return status;
-}
-
-#else  /* ! WANT_TAPE_AIX && !WANT_TAPE_XENIX */                               /* }{ */
-
-#include <sys/mtio.h>
-
-/*
- * Rewind a tape to the beginning.
- */
-int
-tape_tapefd_rewind(
-    int fd)
-{
-    struct mtop mt;
-    int rc=-1, cnt;
-
-    mt.mt_op = MTREW;
-    mt.mt_count = 1;
-
-    /*
-     * EXB-8200 drive on FreeBSD can fail to rewind, but retrying won't
-     * hurt, and it will usually even work!
-     */
-    for(cnt = 10; cnt >= 0; --cnt) {
-       if ((rc = ioctl(fd, MTIOCTOP, &mt)) == 0) {
-           break;
-       }
-       if (cnt) {
-           sleep(3);
-       }
-    }
-    return rc;
-}
-
-/*
- * Rewind and unload a tape.
- */
-int
-tape_tapefd_unload(
-    int fd)
-{
-    struct mtop mt;
-    int rc=-1, cnt;
-
-#ifdef MTUNLOAD
-    mt.mt_op = MTUNLOAD;
-#else
-#ifdef MTOFFL
-    mt.mt_op = MTOFFL;
-#else
-    mt.mt_op = syntax error;
-#endif
-#endif
-    mt.mt_count = 1;
-
-    /*
-     * EXB-8200 drive on FreeBSD can fail to unload, but retrying won't
-     * hurt, and it will usually even work!
-     */
-    for(cnt = 10; cnt >= 0; --cnt) {
-       if ((rc = ioctl(fd, MTIOCTOP, &mt)) == 0) {
-           break;
-       }
-       if (cnt) {
-           sleep(3);
-       }
-    }
-    return rc;
-}
-
-#if !defined(HAVE_BROKEN_FSF)
-/*
- * Forward space the tape device count files.
- */
-int
-tape_tapefd_fsf(
-    int fd,
-    off_t count)
-{
-    struct mtop mt;
-
-    if ((count > (off_t)INT_MAX) || (count < (off_t)INT_MIN)) {
-#ifdef EOVERFLOW
-           errno = EOVERFLOW;
-#else
-           errno = EINVAL;
-#endif
-       return -1;
-    }
-
-    mt.mt_op = MTFSF;
-    mt.mt_count = (int)count;
-
-    return ioctl(fd, MTIOCTOP, &mt);
-}
-#endif
-
-/*
- * Write some number of end of file marks (a.k.a. tape marks).
- *
- * write <count> filemarks on the tape.
- */
-int
-tape_tapefd_weof(
-    int fd,
-    off_t count)
-{
-    struct mtop mt;
-
-    if ((count > (off_t)INT_MAX) || (count < (off_t)INT_MIN)) {
-#ifdef EOVERFLOW
-           errno = EOVERFLOW;
-#else
-           errno = EINVAL;
-#endif
-       return -1;
-    }
-
-    mt.mt_op = MTWEOF;
-    mt.mt_count = (int)count;
-
-    return ioctl(fd, MTIOCTOP, &mt);
-}
-
-#endif /* !WANT_TAPE_XENIX */                                          /* } */
-#endif /* !WANT_TAPE_AIX */                                            /* } */
-#endif /* !WANT_TAPE_UWARE */                                          /* } */
-
-/*
- * At this point we have pulled in every conceivable #include file :-),
- * so now come the more general routines with minimal #ifdef-ing.
- */
-
-#ifdef HAVE_LINUX_ZFTAPE_H
-/*
- * is_zftape(filename) checks if filename is a valid ftape device name.
- */
-int
-is_zftape(
-    const char *filename)
-{
-    if (strncmp(filename, "/dev/nftape", 11) == 0) return(1);
-    if (strncmp(filename, "/dev/nqft",    9) == 0) return(1);
-    if (strncmp(filename, "/dev/nrft",    9) == 0) return(1);
-    return(0);
-}
-#endif /* HAVE_LINUX_ZFTAPE_H */
-
-int
-tape_tape_open(
-    char *filename,
-    int flags,
-    mode_t mask)
-{
-    int ret;
-    time_t timeout = 200;
-    unsigned delay = 2;
-
-    if ((flags & 3) != O_RDONLY) {
-       flags &= ~3;
-       flags |= O_RDWR;
-    }
-    ret = open(filename, flags, mask);
-    while (ret < 0) {
-       if ((errno != EAGAIN) && (errno != EBUSY) && (errno != EINTR)) {
-           /*
-            * Open failed completely: just return
-            */
-           g_fprintf(stderr, _("Opening tapedev %s: got error %s.\n"),
-                       filename, strerror(errno));
-           return -1;
-       }
-
-       /*
-        * if tape open fails with errno==EAGAIN, EBUSY or EINTR, it
-        * may be worth retrying a few seconds later.
-        */
-       timeout -= delay;
-       if (timeout <= 0) {
-           /* Open failed: just return */
-           g_fprintf(stderr, _("Opening tapedev %s: not ready.\n"), filename);
-           return -1;
-       }
-
-       if (delay < 16)
-           delay *= 2;
-
-       sleep(delay);
-       ret = open(filename, flags, mask);
-    }
-
-#ifdef MTIOCGET
-    /* Now check that we opened a tape device. */
-    {
-       struct mtget mt;
-
-       memset(&mt, 0, SIZEOF(mt));
-       if (ioctl(ret, MTIOCGET, &mt) < 0) {
-           close(ret);
-           g_fprintf(stderr, _("tapedev %s is not a tape device!\n"), filename);
-           return -1;
-       }
-
-#ifdef GMT_ONLINE
-       if (!GMT_ONLINE(mt.mt_gstat)) {
-           close(ret);
-           g_fprintf(stderr, _("tapedev %s is offline or has no loaded tape.\n"),
-                   filename);
-           return -1;
-       }
-#endif /* GMT_ONLINE */
-    }
-#endif /* MTIOCGET */
-
-
-#ifdef HAVE_LINUX_ZFTAPE_H
-    /*
-     * switch the block size for the zftape driver (3.04d)
-     * (its default is 10kb and not 32kb)
-     *        A. Gebhardt <albrecht.gebhardt@uni-klu.ac.at>
-     */
-    if (is_zftape(filename) == 1) {
-       struct mtop mt;
-
-       mt.mt_op = MTSETBLK;
-       mt.mt_count = 32 * 1024;                /* should be blocksize ??? */
-       ioctl(ret, MTIOCTOP, &mt);
-    }
-#endif /* HAVE_LINUX_ZFTAPE_H */
-    return ret;
-}
-
-ssize_t
-tape_tapefd_read(
-    int fd,
-    void *buffer,
-    size_t count)
-{
-    return read(fd, buffer, count);
-}
-
-ssize_t
-tape_tapefd_write(
-    int fd,
-    const void *buffer,
-    size_t count)
-{
-    return write(fd, buffer, count);
-}
-
-int
-tape_tapefd_close(
-    int fd)
-{
-    return close(fd);
-} 
-
-void
-tape_tapefd_resetofs(
-    int fd)
-{
-    /*
-     * this *should* be a no-op on the tape, but resets the kernel's view
-     * of the file offset, preventing it from barfing should we pass the
-     * filesize limit (eg OSes with 2 GB filesize limits) on a long tape.
-     */
-    if (lseek(fd, (off_t)0, SEEK_SET) < 0) {
-       dbprintf(_("tape_tapefd_resetofs: lseek failed: <%s>\n"),
-                 strerror(errno));
-    }
-}
-
-int
-tape_tapefd_status(
-    int fd,
-    struct am_mt_status *stat)
-{
-    int res;
-    int anything_valid = 0;
-#if defined(MTIOCGET)
-    struct mtget buf;
-#endif
-
-    memset((void *)stat, 0, SIZEOF(*stat));
-
-#if defined(MTIOCGET)                                                  /* { */
-    res = ioctl(fd,MTIOCGET,&buf);
-    if (res >= 0) {
-       /*@ignore@*/
-#ifdef MT_ONL                                                          /* { */
-        /* IRIX-ish system */
-       anything_valid = 1;
-       stat->online_valid = 1;
-       stat->online = (0 != (buf.mt_dposn & MT_ONL));
-       stat->bot_valid = 1;
-       stat->bot = (0 != (buf.mt_dposn & MT_BOT));
-       stat->eot_valid = 1;
-       stat->eot = (0 != (buf.mt_dposn & MT_EOT));
-       stat->protected_valid = 1;
-       stat->protected = (0 != (buf.mt_dposn & MT_WPROT));
-#else                                                                  /* }{ */
-#ifdef GMT_ONLINE                                                      /* { */
-        /* Linux-ish system */
-       anything_valid = 1;
-       stat->online_valid = 1;
-       stat->online = (0 != GMT_ONLINE(buf.mt_gstat));
-       stat->bot_valid = 1;
-       stat->bot = (0 != GMT_BOT(buf.mt_gstat));
-       stat->eot_valid = 1;
-       stat->eot = (0 != GMT_EOT(buf.mt_gstat));
-       stat->protected_valid = 1;
-       stat->protected = (0 != GMT_WR_PROT(buf.mt_gstat));
-#else                                                                  /* }{ */
-#ifdef DEV_BOM                                                         /* { */
-        /* OSF1-ish system */
-       anything_valid = 1;
-       stat->online_valid = 1;
-       stat->online = (0 == (DEV_OFFLINE & buf.mt_dsreg));
-       stat->bot_valid = 1;
-       stat->bot = (0 != (DEV_BOM & buf.mt_dsreg));
-       stat->protected_valid = 1;
-       stat->protected = (0 != (DEV_WRTLCK & buf.mt_dsreg));
-#else                                                                  /* }{ */
-        /* Solaris, minix, etc. */
-       anything_valid = 1;
-       stat->online_valid = 1;
-       stat->online = 1;                       /* ioctl fails otherwise */
-#ifdef HAVE_MT_DSREG
-       stat->device_status_valid = 1;
-       stat->device_status_size = SIZEOF(buf.mt_dsreg);
-       stat->device_status = (unsigned long)buf.mt_dsreg;
-#endif
-#ifdef HAVE_MT_ERREG
-       stat->error_status_valid = 1;
-       stat->error_status_size = SIZEOF(buf.mt_erreg);
-       stat->error_status = (unsigned long)buf.mt_erreg;
-#endif
-#if defined(HAVE_MT_FLAGS) && defined(MTF_SCSI)                        /* { */
-       /* 
-        * On Solaris, the file/block number fields are only valid if
-        * the driver is SCSI.  And in that case, the dsreg value is
-        * not useful (it is a retry count).
-        */
-       if(buf.mt_flags & MTF_SCSI) {
-           stat->device_status_valid = 0;
-#ifdef HAVE_MT_FILENO
-           stat->fileno_valid = 1;
-           stat->fileno = (long)buf.mt_fileno;
-#endif
-#ifdef HAVE_MT_BLKNO
-           stat->blkno_valid = 1;
-           stat->blkno = (long)buf.mt_blkno;
-#endif
-       }
-#endif                                                                 /* } */
-#endif                                                                 /* } */
-#endif                                                                 /* } */
-#endif                                                                 /* } */
-       /*@end@*/
-    }
-#endif                                                                 /* } */
-
-    /*
-     * If we did not find any valid information, do a stat on the device
-     * and if that returns successfully, assume it is at least online.
-     */
-    if(!anything_valid) {
-       struct stat sbuf;
-
-       res = fstat(fd, &sbuf);
-       stat->online_valid = 1;
-       stat->online = (char)(res == 0);
-    }
-
-    return res;
-}
-
-int
-tape_tape_stat(
-     char *filename,
-     struct stat *buf)
-{
-     return stat(filename, buf);
-}
-
-int
-tape_tape_access(
-     char *filename,
-     int mode)
-{
-     return access(filename, mode);
-}
-
-int 
-tape_tapefd_can_fork(
-    int fd)
-{
-    (void)fd;  /* Quiet unused parameter warning */
-
-    return 1;
-}
-
diff --git a/tape-src/output-tape.h b/tape-src/output-tape.h
deleted file mode 100644 (file)
index a0f5843..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Amanda, The Advanced Maryland Automatic Network Disk Archiver
- * Copyright (c) 1991-1998 University of Maryland at College Park
- * All Rights Reserved.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of U.M. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission.  U.M. makes no representations about the
- * suitability of this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- *
- * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M.
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: James da Silva, Systems Design and Analysis Group
- *                        Computer Science Department
- *                        University of Maryland at College Park
- */
-
-/* NOTE: this driver is *deprecated* and should not be used.  See the Device API
- * in device-src/ for the new implementation.
- */
-
-/*
- * $Id: output-tape.h,v 1.6 2006/05/25 01:47:27 johnfranks Exp $
- *
- * tapeio.c virtual tape interface for normal tape drives.
- */
-
-#ifndef OUTPUT_TAPE_H
-#define OUTPUT_TAPE_H
-
-#ifdef NO_AMANDA
-#include "output-rait.h"
-#else
-#include "amanda.h"
-#endif
-
-int tape_tape_access(char *, int);
-int tape_tape_open(char *, int, mode_t);
-int tape_tape_stat(char *, struct stat *);
-int tape_tapefd_close(int);
-int tape_tapefd_fsf(int, off_t);
-ssize_t tape_tapefd_read(int, void *, size_t);
-int tape_tapefd_rewind(int);
-void tape_tapefd_resetofs(int);
-int tape_tapefd_unload(int);
-int tape_tapefd_status(int, struct am_mt_status *);
-int tape_tapefd_weof(int, off_t);
-ssize_t tape_tapefd_write(int, const void *, size_t);
-int tape_tapefd_can_fork(int);
-
-#endif /* OUTPUT_TAPE_H */
diff --git a/tape-src/tapeio.c b/tape-src/tapeio.c
deleted file mode 100644 (file)
index 69fdb5c..0000000
+++ /dev/null
@@ -1,1587 +0,0 @@
-/*
- * Amanda, The Advanced Maryland Automatic Network Disk Archiver
- * Copyright (c) 1991-1998 University of Maryland at College Park
- * All Rights Reserved.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of U.M. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission.  U.M. makes no representations about the
- * suitability of this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- *
- * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M.
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: James da Silva, Systems Design and Analysis Group
- *                        Computer Science Department
- *                        University of Maryland at College Park
- */
-
-/*
- * $Id: tapeio.c,v 1.57 2006/07/06 15:04:18 martinea Exp $
- *
- * implements generic tape I/O functions
- */
-
-#include "amanda.h"
-#include "conffile.h"
-#include "tapeio.h"
-#include "fileheader.h"
-
-#ifndef R_OK
-#define R_OK 4
-#define W_OK 2
-#endif
-
-#include "output-tape.h"
-#include "output-null.h"
-#include "output-rait.h"
-#include "output-file.h"
-
-static struct virtualtape {
-    char *prefix;
-    int (*xxx_tape_access)(char *, int);
-    int (*xxx_tape_open)(char *, int, mode_t);
-    int (*xxx_tape_stat)(char *, struct stat *);
-    int (*xxx_tapefd_close)(int);
-    int (*xxx_tapefd_fsf)(int, off_t);
-    ssize_t (*xxx_tapefd_read)(int, void *, size_t);
-    int (*xxx_tapefd_rewind)(int);
-    void (*xxx_tapefd_resetofs)(int);
-    int (*xxx_tapefd_unload)(int);
-    int (*xxx_tapefd_status)(int, struct am_mt_status *);
-    int (*xxx_tapefd_weof)(int, off_t);
-    ssize_t (*xxx_tapefd_write)(int, const void *, size_t);
-    int (*xxx_tapefd_can_fork)(int);
-} vtable[] = {
-  /* note: "tape" has to be the first entry because it is the
-  **        default if no prefix match is found.
-  */
-  {"tape", tape_tape_access, tape_tape_open, tape_tape_stat,
-       tape_tapefd_close, tape_tapefd_fsf,
-       tape_tapefd_read, tape_tapefd_rewind, tape_tapefd_resetofs,
-       tape_tapefd_unload, tape_tapefd_status, tape_tapefd_weof,
-        tape_tapefd_write, tape_tapefd_can_fork },
-  {"null", null_tape_access, null_tape_open, null_tape_stat,
-       null_tapefd_close, null_tapefd_fsf,
-       null_tapefd_read, null_tapefd_rewind, null_tapefd_resetofs,
-       null_tapefd_unload, null_tapefd_status, null_tapefd_weof,
-        null_tapefd_write, null_tapefd_can_fork },
-  {"rait", rait_access, rait_tape_open, rait_stat,
-       rait_close, rait_tapefd_fsf,
-       rait_read, rait_tapefd_rewind, rait_tapefd_resetofs,
-       rait_tapefd_unload, rait_tapefd_status, rait_tapefd_weof,
-        rait_write, rait_tapefd_can_fork },
-  {"file", file_tape_access, file_tape_open, file_tape_stat,
-       file_tapefd_close, file_tapefd_fsf,
-       file_tapefd_read, file_tapefd_rewind, file_tapefd_resetofs,
-       file_tapefd_unload, file_tapefd_status, file_tapefd_weof,
-        file_tapefd_write, file_tapefd_can_fork },
-  {NULL, NULL, NULL, NULL,
-        NULL, NULL,
-       NULL, NULL, NULL,
-       NULL, NULL, NULL,
-       NULL, NULL}
-};
-
-static struct tape_info {
-    int vtape_index;
-    char *host;
-    char *disk;
-    int level;
-    char *datestamp;
-    off_t length;
-    char *tapetype;
-    int fake_label;
-    int ioctl_fork;
-    int master_fd;
-} *tape_info = NULL;
-static struct tape_info **tape_info_p = &tape_info;
-
-static size_t tape_info_count = 0;
-
-static char *errstr = NULL;
-
-static void tape_info_init(void *ptr);
-static int name2slot(char *name, char **ntrans);
-
-/*
- * Additional initialization function for tape_info table.
- */
-
-static void
-tape_info_init(
-    void *ptr)
-{
-    struct tape_info *t = ptr;
-
-    t->level = -1;
-    t->vtape_index = -1;
-    t->ioctl_fork = 1;
-    t->master_fd = -1;
-}
-
-/*
- * Convert the "name" part of a device to a vtape slot.
- */
-
-static int
-name2slot(
-    char *name,
-    char **ntrans)
-{
-    char *pc;
-    size_t len;
-    int i;
-
-    if(0 != (pc = strchr(name, ':'))) {
-        len = (size_t)(pc - name);
-       for( i = 0 ; vtable[i].prefix && vtable[i].prefix[0]; i++ ) {
-           if(0 == strncmp(vtable[i].prefix, name , len)
-               && '\0' == vtable[i].prefix[len]) {
-               *ntrans = pc + 1;
-               return i;
-            }
-        }
-    }
-    *ntrans = name;
-    return 0;
-}
-
-/*
- * Routines for parsing a device name.
- */
-
-/*
- * Initialize parsing.  The text in the "dev" parameter will be altered,
- * so a copy should be passed to us.
- */
-
-int
-tapeio_init_devname(
-    char * dev,
-    char **dev_left,
-    char **dev_right,
-    char **dev_next)
-{
-    int ch;
-    char *p;
-    int depth;
-
-    *dev_left = *dev_right = *dev_next = NULL; /* defensive coding */
-
-    /*
-     * See if there is a '{' and find the matching '}'.
-     */
-    if((*dev_next = p = strchr(dev, '{')) != NULL) {
-       depth = 1;
-       p++;
-       while(depth > 0) {
-           ch = *p++;
-           while((ch != '\0') && (ch != '{') && (ch != '}'))
-               ch = *p++;
-           if(ch == '\0') {
-               /*
-                * Did not find a matching '}'.
-                */
-               amfree(dev);
-               errno = EINVAL;
-               return -1;
-           } else if(ch == '{') {
-               depth++;
-           } else if(ch == '}') {
-               depth--;
-           }
-       }
-       if(strchr(p, '{') != NULL || strchr(p, '}') != NULL) {
-           amfree(dev);
-           errno = EINVAL;
-           return -1;                          /* only one list allowed */
-       }
-       *dev_left = dev;                        /* text before the '{' */
-       **dev_next = '\0';                      /* zap the '{' */
-       (*dev_next)++;                          /* point to the first name */
-       p[-1] = '\0';                           /* zap the '}' */
-       *dev_right = p;                         /* text after the '}' */
-    } else {
-       /*
-        * Arrange to return just one name.
-        */
-       *dev_next = dev;
-       *dev_left = *dev_right = "";
-    }
-    return 0;
-}
-
-/*
- * Return the next device name.  A dynamic area is returned that the
- * caller is responsible for freeing.
- */
-
-char *
-tapeio_next_devname(
-    char * dev_left,
-    char * dev_right,
-    char **dev_next)
-{
-    int ch;
-    char *next;
-    char *p;
-    int depth;
-
-    p = next = *dev_next;                      /* remember the start point */
-    depth = 0;
-    do {
-       ch = *p++;
-       while((ch != '\0') && (ch != '{') && (ch != '}') && (ch != ','))
-           ch = *p++;
-       if(ch == '\0') {
-           /*
-            * Found the end of a name.
-            */
-           assert(depth == 0);
-           if(*next == '\0') {
-               return NULL;                    /* end of the list */
-           }
-           p--;                                /* point to the null byte */
-           break;
-       } else if(ch == '{') {
-           depth++;
-       } else if(ch == '}') {
-           assert(depth > 0);
-           depth--;
-       }
-    } while(depth != 0 || ch != ',');
-    if(ch == ',') {
-       p[-1] = '\0';                           /* zap the ',' */
-    }
-    *dev_next = p;                             /* set up for the next call */
-    return vstralloc(dev_left, next, dev_right, NULL);
-}
-
-/*
- * The following functions get/set fields in the tape_info structure.
- * To allow them to be called (e.g. set) from lower level open functions
- * started by tape_open, we check and allocate the tape_info structure
- * here as well as in tape_open.
- */
-
-char *
-tapefd_getinfo_host(
-    int fd)
-{
-    amtable_alloc((void **)tape_info_p,
-                 &tape_info_count,
-                 SIZEOF(*tape_info),
-                 (size_t)fd + 1,
-                 10,
-                 tape_info_init);
-    if(tape_info[fd].master_fd != -1)
-       return tapefd_getinfo_host(tape_info[fd].master_fd);
-    return tape_info[fd].host;
-}
-
-void
-tapefd_setinfo_host(
-    int fd,
-    char *v)
-{
-    amtable_alloc((void **)tape_info_p,
-                 &tape_info_count,
-                 SIZEOF(*tape_info),
-                 (size_t)fd + 1,
-                 10,
-                 tape_info_init);
-    amfree(tape_info[fd].host);
-    if(v) {
-       tape_info[fd].host = stralloc(v);
-    }
-}
-
-char *
-tapefd_getinfo_disk(
-    int fd)
-{
-    amtable_alloc((void **)tape_info_p,
-                 &tape_info_count,
-                 SIZEOF(*tape_info),
-                 (size_t)fd + 1,
-                 10,
-                 tape_info_init);
-    if(tape_info[fd].master_fd != -1)
-       return tapefd_getinfo_disk(tape_info[fd].master_fd);
-    return tape_info[fd].disk;
-}
-
-void
-tapefd_setinfo_disk(
-    int fd,
-    char *v)
-{
-    amtable_alloc((void **)tape_info_p,
-                 &tape_info_count,
-                 SIZEOF(*tape_info),
-                 (size_t)fd + 1,
-                 10,
-                 tape_info_init);
-    amfree(tape_info[fd].disk);
-    if(v) {
-       tape_info[fd].disk = stralloc(v);
-    }
-}
-
-int
-tapefd_getinfo_level(
-    int fd)
-{
-    amtable_alloc((void **)tape_info_p,
-                 &tape_info_count,
-                 SIZEOF(*tape_info),
-                 (size_t)fd + 1,
-                 10,
-                 tape_info_init);
-    if(tape_info[fd].master_fd != -1)
-       return tapefd_getinfo_level(tape_info[fd].master_fd);
-    return tape_info[fd].level;
-}
-
-void
-tapefd_setinfo_level(
-    int fd,
-    int v)
-{
-    amtable_alloc((void **)tape_info_p,
-                 &tape_info_count,
-                 SIZEOF(*tape_info),
-                 (size_t)fd + 1,
-                 10,
-                 tape_info_init);
-    tape_info[fd].level = v;
-}
-
-char *
-tapefd_getinfo_datestamp(
-    int fd)
-{
-    amtable_alloc((void **)tape_info_p,
-                 &tape_info_count,
-                 SIZEOF(*tape_info),
-                 (size_t)fd + 1,
-                 10,
-                 tape_info_init);
-    return tape_info[fd].datestamp;
-}
-
-void
-tapefd_setinfo_datestamp(
-    int fd,
-    char *v)
-{
-    amtable_alloc((void **)tape_info_p,
-                 &tape_info_count,
-                 SIZEOF(*tape_info),
-                 (size_t)fd + 1,
-                 10,
-                 tape_info_init);
-    tape_info[fd].datestamp = newstralloc(tape_info[fd].datestamp, v);
-}
-
-off_t
-tapefd_getinfo_length(
-    int fd)
-{
-    amtable_alloc((void **)tape_info_p,
-                 &tape_info_count,
-                 SIZEOF(*tape_info),
-                 (size_t)fd + 1,
-                 10,
-                 tape_info_init);
-    return tape_info[fd].length;
-}
-
-void
-tapefd_setinfo_length(
-    int fd,
-    off_t v)
-{
-    amtable_alloc((void **)tape_info_p,
-                 &tape_info_count,
-                 SIZEOF(*tape_info),
-                 (size_t)fd + 1,
-                 10,
-                 tape_info_init);
-    tape_info[fd].length = v;
-}
-
-char *
-tapefd_getinfo_tapetype(
-    int fd)
-{
-    amtable_alloc((void **)tape_info_p,
-                 &tape_info_count,
-                 SIZEOF(*tape_info),
-                 (size_t)fd + 1,
-                 10,
-                 tape_info_init);
-    return tape_info[fd].tapetype;
-}
-
-void
-tapefd_setinfo_tapetype(
-    int fd,
-    char *v)
-{
-    amtable_alloc((void **)tape_info_p,
-                 &tape_info_count,
-                 SIZEOF(*tape_info),
-                 (size_t)fd + 1,
-                 10,
-                 tape_info_init);
-    tape_info[fd].tapetype = newstralloc(tape_info[fd].tapetype, v);
-}
-
-int
-tapefd_getinfo_fake_label(
-    int fd)
-{
-    amtable_alloc((void **)tape_info_p,
-                 &tape_info_count,
-                 SIZEOF(*tape_info),
-                 (size_t)fd + 1,
-                 10,
-                 tape_info_init);
-    return tape_info[fd].fake_label;
-}
-
-void
-tapefd_setinfo_fake_label(
-    int fd,
-    int v)
-{
-    amtable_alloc((void **)tape_info_p,
-                 &tape_info_count,
-                 SIZEOF(*tape_info),
-                 (size_t)fd + 1,
-                 10,
-                 tape_info_init);
-    tape_info[fd].fake_label = v;
-}
-
-int
-tapefd_getinfo_ioctl_fork(
-    int fd)
-{
-    amtable_alloc((void **)tape_info_p,
-                 &tape_info_count,
-                 SIZEOF(*tape_info),
-                 (size_t)fd + 1,
-                 10,
-                 tape_info_init);
-    return tape_info[fd].ioctl_fork;
-}
-
-void
-tapefd_setinfo_ioctl_fork(
-    int fd,
-    int v)
-{
-    amtable_alloc((void **)tape_info_p,
-                 &tape_info_count,
-                 SIZEOF(*tape_info),
-                 (size_t)fd + 1,
-                 10,
-                 tape_info_init);
-    tape_info[fd].ioctl_fork = v;
-}
-
-void
-tapefd_set_master_fd(
-    int fd,
-    int master_fd)
-{
-    amtable_alloc((void **)tape_info_p,
-                 &tape_info_count,
-                 SIZEOF(*tape_info),
-                 (size_t)fd + 1,
-                 10,
-                 tape_info_init);
-    tape_info[fd].master_fd = master_fd;
-}
-
-
-/*
- * The normal tape operation functions.
- */
-
-int
-tape_access(
-    char *filename,
-    int mode)
-{
-    char *tname;
-    int vslot;
-
-    vslot = name2slot(filename, &tname);
-    return vtable[vslot].xxx_tape_access(tname, mode);
-}
-
-int
-tape_stat(
-    char *filename,
-    struct stat *buf)
-{
-    char *tname;
-    int vslot;
-
-    vslot = name2slot(filename, &tname);
-    return vtable[vslot].xxx_tape_stat(tname, buf);
-}
-
-int
-tape_open(
-    char *filename,
-    int mode, ...)
-{
-    char *tname;
-    int vslot;
-    int fd;
-    mode_t mask;
-    va_list ap;
-
-    va_start(ap, mode);
-    mask = (mode_t)va_arg(ap, int);
-    va_end(ap);
-
-    vslot = name2slot(filename, &tname);
-    if((fd = vtable[vslot].xxx_tape_open(tname, mode, mask)) >= 0) {
-       amtable_alloc((void **)tape_info_p,
-                     &tape_info_count,
-                     SIZEOF(*tape_info),
-                     (size_t)(fd + 1),
-                     10,
-                     tape_info_init);
-       /*
-        * It is possible to recurse in the above open call and come
-        * back here twice for the same file descriptor.  Set the vtape
-        * index only if it is not already set, i.e. the first call wins.
-        */
-       if(tape_info[fd].vtape_index < 0) {
-           tape_info[fd].vtape_index = vslot;
-       }
-    }
-    return fd;
-}
-
-int
-tapefd_close(
-    int fd)
-{
-    int        res;
-    int vslot;
-
-    if ((fd < 0) || ((size_t)fd >= tape_info_count)
-       || ((vslot = tape_info[fd].vtape_index) < 0)) {
-       errno = EBADF;
-       return -1;
-    }
-
-    vslot = tape_info[fd].vtape_index;
-    if((res = vtable[vslot].xxx_tapefd_close(fd)) == 0) {
-       amfree(tape_info[fd].host);
-       amfree(tape_info[fd].disk);
-       amfree(tape_info[fd].datestamp);
-       amfree(tape_info[fd].tapetype);
-       memset(tape_info + fd, 0, SIZEOF(*tape_info));
-        tape_info_init((void *)(tape_info + fd));
-    }
-    return res;
-}
-
-int
-tapefd_can_fork(
-    int fd)
-{
-    int        vslot;
-
-    if ((fd < 0) || ((size_t)fd >= tape_info_count)
-       || (tape_info[fd].vtape_index < 0)) {
-       errno = EBADF;
-       return -1;
-    }
-
-    vslot = tape_info[fd].vtape_index;
-    return vtable[vslot].xxx_tapefd_can_fork(fd);
-}
-
-int
-tapefd_fsf(
-    int fd,
-    off_t count)
-{
-    int vslot;
-
-    if ((fd < 0) || ((size_t)fd >= tape_info_count)
-       || (tape_info[fd].vtape_index < 0)) {
-       errno = EBADF;
-       return -1;
-    }
-
-    vslot = tape_info[fd].vtape_index;
-    return vtable[vslot].xxx_tapefd_fsf(fd, count);
-}
-
-int
-tapefd_rewind(
-    int fd)
-{
-    int vslot;
-
-    if ((fd < 0) || ((size_t)fd >= tape_info_count)
-       || (tape_info[fd].vtape_index < 0)) {
-       errno = EBADF;
-       return -1;
-    }
-
-    vslot = tape_info[fd].vtape_index;
-    return vtable[vslot].xxx_tapefd_rewind(fd);
-}
-
-void
-tapefd_resetofs(
-    int fd)
-{
-    int vslot;
-
-    if ((fd < 0) || ((size_t)fd >= tape_info_count)
-       || (tape_info[fd].vtape_index < 0)) {
-       errno = EBADF;                          /* not that it matters */
-       return;
-    }
-
-    vslot = tape_info[fd].vtape_index;
-    vtable[vslot].xxx_tapefd_resetofs(fd);
-}
-
-int
-tapefd_unload(
-    int fd)
-{
-    int vslot;
-
-    if ((fd < 0) || ((size_t)fd >= tape_info_count)
-       || (tape_info[fd].vtape_index < 0)) {
-       errno = EBADF;
-       return -1;
-    }
-
-    vslot = tape_info[fd].vtape_index;
-    return vtable[vslot].xxx_tapefd_unload(fd);
-}
-
-int
-tapefd_status(
-    int fd,
-    struct am_mt_status *stat)
-{
-    int vslot;
-
-    if ((fd < 0) || ((size_t)fd >= tape_info_count)
-       || (tape_info[fd].vtape_index < 0)) {
-       errno = EBADF;
-       return -1;
-    }
-
-    vslot = tape_info[fd].vtape_index;
-    return vtable[vslot].xxx_tapefd_status(fd, stat);
-}
-
-int
-tapefd_weof(
-    int fd,
-    off_t count)
-{
-    int vslot;
-
-    if ((fd < 0) || ((size_t)fd >= tape_info_count)
-       || (tape_info[fd].vtape_index < 0)) {
-       errno = EBADF;
-       return -1;
-    }
-
-    vslot = tape_info[fd].vtape_index;
-    return vtable[vslot].xxx_tapefd_weof(fd, count);
-} 
-
-
-ssize_t
-tapefd_read(
-    int fd,
-    void *buffer,
-    size_t count)
-{
-    int vslot;
-
-    if ((fd < 0) || ((size_t)fd >= tape_info_count)
-       || (tape_info[fd].vtape_index < 0)) {
-       errno = EBADF;
-       return -1;
-    }
-
-    vslot = tape_info[fd].vtape_index;
-    return vtable[vslot].xxx_tapefd_read(fd, buffer, count);
-}
-
-ssize_t
-tapefd_write(
-    int fd,
-    const void *buffer,
-    size_t count)
-{
-    int vslot;
-
-    if ((fd < 0) || ((size_t)fd >= tape_info_count)
-       || (tape_info[fd].vtape_index < 0)) {
-       errno = EBADF;
-       return -1;
-    }
-
-    vslot = tape_info[fd].vtape_index;
-    return vtable[vslot].xxx_tapefd_write(fd, buffer, count);
-}
-
-char *
-tape_rewind(
-    char *devname)
-{
-    int fd;
-    char *r = NULL;
-
-    if((fd = tape_open(devname, O_RDONLY)) < 0) {
-       r = errstr = newvstrallocf(errstr,
-                                 _("tape_rewind: tape open: %s: %s"),
-                                 devname, strerror(errno));
-    } else if(tapefd_rewind(fd) == -1) {
-       r = errstr = newvstrallocf(errstr,
-                                 _("tape_rewind: rewinding tape: %s: %s"),
-                                 devname,
-                                 strerror(errno));
-    }
-    if(fd >= 0) {
-       tapefd_close(fd);
-    }
-    return r;
-}
-
-char *
-tape_unload(
-    char *devname)
-{
-    int fd;
-    char *r = NULL;
-
-    if((fd = tape_open(devname, O_RDONLY)) < 0) {
-       r = errstr = newvstrallocf(errstr,
-                                 _("tape_unload: tape open: %s: %s"),
-                                 devname,
-                                 strerror(errno));
-    } else if(tapefd_unload(fd) == -1) {
-       r = errstr = newvstrallocf(errstr,
-                                 _("tape_unload: unloading tape: %s: %s"),
-                                 devname,
-                                 strerror(errno));
-    }
-    if(fd >= 0) {
-       tapefd_close(fd);
-    }
-    return r;
-}
-
-char *
-tape_fsf(
-    char *devname,
-    off_t count)
-{
-    int fd;
-    char *r = NULL;
-
-    if((fd = tape_open(devname, O_RDONLY)) < 0) {
-       r = errstr = newvstrallocf(errstr,
-                                 _("tape_fsf: tape open: %s: %s"),
-                                 devname,
-                                 strerror(errno));
-    } else if(tapefd_fsf(fd, count) == -1) {
-       r = errstr = newvstrallocf(errstr,
-                                 plural(_("tape_fsf: fsf %lld file: %s"),
-                                        _("tape_fsf: fsf %lld files: %s"),
-                                        count),
-                                 (long long)count, strerror(errno));
-    }
-    if(fd >= 0) {
-       tapefd_close(fd);
-    }
-    return r;
-}
-
-/* Reads the tape label, like you expect. If failure, returns an error
-   string. If the tape might not be an Amanda tape, the returned
-   string will start with NOT_AMANDA_TAPE_MSG. */
-
-char *
-tapefd_rdlabel(
-    int fd,
-    char **datestamp,
-    char **label)
-{
-    ssize_t rc;
-    size_t buflen;
-    char *buffer = NULL;
-    dumpfile_t file;
-    char *r = NULL;
-
-    amfree(*datestamp);
-    amfree(*label);
-    buflen = getconf_readblocksize() * 1024;
-    buffer = alloc(buflen + 1);
-
-    if(tapefd_getinfo_fake_label(fd)) {
-       *datestamp = stralloc("X");
-       *label = stralloc(FAKE_LABEL);
-    } else if(tapefd_rewind(fd) == -1) {
-       r = vstrallocf(_("rewinding tape: %s"), strerror(errno));
-    } else if((rc = tapefd_read(fd, buffer, buflen)) == -1) {
-       r = vstrallocf(_(NOT_AMANDA_TAPE_MSG "(%s)"), strerror(errno));
-    } else if (rc == 0) {
-        r = vstrallocf(_(NOT_AMANDA_TAPE_MSG " (Read 0 bytes)"));
-    } else {
-       /* make sure buffer is null-terminated */
-       buffer[rc] = '\0';
-
-       parse_file_header(buffer, &file, (size_t)rc);
-       if(file.type != F_TAPESTART) {
-           r = vstrallocf(NOT_AMANDA_TAPE_MSG);
-       } else {
-           *datestamp = stralloc(file.datestamp);
-           *label = stralloc(file.name);
-       }
-    }
-    amfree(buffer);
-    if (r)
-       errstr = newvstrallocf(errstr, "%s", r);
-    return r;
-}
-
-char *
-tape_rdlabel(
-    char *devname,
-    char **datestamp,
-    char **label)
-{
-    int fd;
-    char *r = NULL;
-
-    if((fd = tape_open(devname, O_RDONLY)) < 0) {
-       r = vstrallocf(_("tape_rdlabel: tape open: %s: %s"),
-                      devname,
-                      strerror(errno));
-    } else
-        r = tapefd_rdlabel(fd, datestamp, label);
-
-    if(fd >= 0) {
-        tapefd_close(fd);
-    }
-    if (r)
-       errstr = newvstrallocf(errstr, "%s", r);
-    return r;
-}
-
-char *
-tapefd_wrlabel(
-    int fd,
-    char *datestamp,
-    char *label,
-    size_t size)
-{
-    ssize_t rc;
-    char *buffer = NULL;
-    dumpfile_t file;
-    char *r = NULL;
-
-    if(tapefd_rewind(fd) == -1) {
-       r = errstr = newvstrallocf(errstr, _("rewinding tape: %s"),
-                       strerror(errno));
-    } else {
-       fh_init(&file);
-       file.type = F_TAPESTART;
-       strncpy(file.datestamp, datestamp, SIZEOF(file.datestamp) - 1);
-       file.datestamp[SIZEOF(file.datestamp) - 1] = '\0';
-       strncpy(file.name, label, SIZEOF(file.name) - 1);
-       file.name[SIZEOF(file.name) - 1] = '\0';
-       file.blocksize = size;
-        buffer = build_header(&file, size);
-       tapefd_setinfo_host(fd, NULL);
-       tapefd_setinfo_disk(fd, label);
-       tapefd_setinfo_level(fd, -1);
-       if((rc = tapefd_write(fd, buffer, size)) != (ssize_t)size) {
-           if (rc != 1) {
-               r = errstr = newvstrallocf(errstr,
-                               _("writing label: short write"));
-           } else {
-               r = errstr = newvstrallocf(errstr,
-                               _("writing label: %s"), strerror(errno));
-           }
-       }
-       amfree(buffer);
-    }
-    return r;
-}
-
-char *
-tape_wrlabel(
-    char *devname,
-    char *datestamp,
-    char *label,
-    size_t size)
-{
-    int fd;
-    char *r = NULL;
-
-    if((fd = tape_open(devname, O_WRONLY)) < 0) {
-       if (errno == EACCES) {
-           r = errstr = newvstrallocf(errstr,
-                                 _("writing label: tape is write-protected"));
-       } else {
-           r = errstr = newvstrallocf(errstr,
-                                 _("writing label: %s"), strerror(errno));
-       }
-    } else if(tapefd_wrlabel(fd, datestamp, label, size) != NULL) {
-       r = errstr;
-    }
-    if(fd >= 0) {
-       tapefd_close(fd);
-    }
-    return r;
-}
-
-char *
-tapefd_wrendmark(
-    int fd,
-    char *datestamp,
-    size_t size)
-{
-    ssize_t rc;
-    char *buffer = NULL;
-    dumpfile_t file;
-    char *r = NULL;
-
-    fh_init(&file);
-    file.type = F_TAPEEND;
-    strncpy(file.datestamp, datestamp, SIZEOF(file.datestamp) - 1);
-    file.datestamp[SIZEOF(file.datestamp) - 1] = '\0';
-    file.blocksize = size;
-    buffer = build_header(&file, size);
-    tapefd_setinfo_host(fd, NULL);
-    tapefd_setinfo_disk(fd, "TAPEEND");
-    tapefd_setinfo_level(fd, -1);
-
-    if((rc = tapefd_write(fd, buffer, size)) != (ssize_t)size) {
-       if (rc != 1) {
-           r = errstr = newvstrallocf(errstr,
-                               _("writing endmark: short write"));
-       } else {
-           r = errstr = newvstrallocf(errstr,
-                               _("writing endmark: %s"), strerror(errno));
-       }
-    }
-    amfree(buffer);
-
-    return r;
-}
-
-char *
-tape_wrendmark(
-    char *devname,
-    char *datestamp,
-    size_t size)
-{
-    int fd;
-    char *r = NULL;
-
-    if((fd = tape_open(devname, O_WRONLY)) < 0) {
-       if (errno == EACCES) {
-           r = errstr = newvstrallocf(errstr,
-                                 _("writing endmark: tape is write-protected"));
-       } else {
-           r = errstr = newvstrallocf(errstr,
-                                 _("writing endmark: %s"), strerror(errno));
-       }
-    } else if(tapefd_wrendmark(fd, datestamp, size) != NULL) {
-       r = errstr;
-    }
-    if(fd >= 0) {
-       tapefd_close(fd);
-    }
-    return r;
-}
-
-char *
-tape_writable(
-    char *devname)
-{
-    int fd = -1;
-    char *r = NULL;
-
-    /* first, make sure the file exists and the permissions are right */
-
-    if(tape_access(devname, R_OK|W_OK) == -1) {
-       r = errstr = newvstrallocf(errstr, "%s", strerror(errno));
-    } else if((fd = tape_open(devname, O_WRONLY)) < 0) {
-       if (errno == EACCES) {
-           r = errstr = newvstrallocf(errstr, _("tape is write-protected"));
-       } else {
-           r = errstr = newvstrallocf(errstr, "%s", strerror(errno));
-       }
-    }
-    if(fd >= 0) {
-       tapefd_close(fd);
-    }
-    return r;
-}
-
-ssize_t
-getconf_readblocksize(void)
-{
-    tapetype_t *tape;
-    char       *conf_tapetype;
-
-    conf_tapetype = getconf_str(CNF_TAPETYPE);
-
-    if (!conf_tapetype || strlen(conf_tapetype) == 0)
-       return MAX_TAPE_BLOCK_KB;
-
-    tape = lookup_tapetype(conf_tapetype);
-    if (!tape)
-       return MAX_TAPE_BLOCK_KB;
-
-    return tapetype_get_readblocksize(tape);
-}
-
-#ifdef TEST
-
-/*
- * The following test program may be used to exercise I/O patterns through
- * the tapeio interface.  Commands may either be on the command line or
- * read from stdin (e.g. for a test suite).
- */
-
-#include "token.h"
-
-#if USE_RAND
-/* If the C library does not define random(), try to use rand() by
-   defining USE_RAND, but then make sure you are not using hardware
-   compression, because the low-order bits of rand() may not be that
-   random... :-( */
-#define random() rand()
-#define srandom(seed) srand(seed)
-#endif
-
-static char *pgm;
-
-static void
-do_help(void)
-{
-    g_fprintf(stderr, _("  ?|help\n"));
-    g_fprintf(stderr, _("  open [\"file\"|$TAPE [\"mode\":O_RDONLY]]\n"));
-    g_fprintf(stderr, _("  read [\"records\":\"all\"]\n"));
-    g_fprintf(stderr, _("  write [\"records\":1] [\"file#\":\"+\"] [\"record#\":\"+\"] [\"host\"] [\"disk\"] [\"level\"]\n"));
-    g_fprintf(stderr, _("  eof|weof [\"count\":1]\n"));
-    g_fprintf(stderr, _("  fsf [\"count\":1]\n"));
-    g_fprintf(stderr, _("  rewind\n"));
-    g_fprintf(stderr, _("  unload\n"));
-}
-
-static void
-usage(void)
-{
-    g_fprintf(stderr, _("usage: %s [-c cmd [args] [%% cmd [args] ...]]\n"), pgm);
-    do_help();
-}
-
-#define TEST_BLOCKSIZE (32 * 1024)
-
-#define MAX_TOKENS     10
-
-extern int optind;
-
-static char *token_area[MAX_TOKENS + 1];
-static char **token;
-static int token_count;
-
-static int fd = -1;
-static off_t current_file = (off_t)0;
-static off_t current_record = (off_t)0;
-
-static int have_length = 0;
-static int length = (off_t)0;
-
-static int show_timestamp = 0;
-
-char write_buf[TEST_BLOCKSIZE];
-
-static void
-do_open(void)
-{
-    mode_t mode;
-    char *file;
-
-    if(token_count < 2
-       || (token_count >= 2 && strcmp(token[1], "$TAPE") == 0)) {
-       if((file = getenv("TAPE")) == NULL) {
-           g_fprintf(stderr, _("tape_open: no file name and $TAPE not set\n"));
-           return;
-       }
-    } else {
-       file = token[1];
-    }
-    if(token_count > 2) {
-       mode = atoi(token[2]);
-    } else {
-       mode = O_RDONLY;
-    }
-
-    g_fprintf(stderr, _("tapefd_open(\"%s\", %d): "), file, mode);
-    if((fd = tape_open(file, mode, 0644)) < 0) {
-       perror("");
-    } else {
-       g_fprintf(stderr, _("%d (OK)\n"), fd);
-       if(have_length) {
-           tapefd_setinfo_length(fd, length);
-       }
-    }
-}
-
-static void
-do_close(void)
-{
-    int        result;
-
-    g_fprintf(stderr, _("tapefd_close(): "));
-    if((result = tapefd_close(fd)) < 0) {
-       perror("");
-    } else {
-       g_fprintf(stderr, _("%d (OK)\n"), result);
-    }
-}
-
-static void
-do_read(void)
-{
-    ssize_t    result;
-    off_t count = (off_t)0;
-    int have_count = 0;
-    char buf[SIZEOF(write_buf)];
-    int *p;
-    off_t i;
-    char *s;
-    time_t then;
-    struct tm *tm;
-
-    if(token_count > 1 && strcmp(token[1], "all") != 0) {
-       count = OFF_T_ATOI(token[1]);
-       have_count = 1;
-    }
-
-    p = (int *)buf;
-    for(i = 0; (! have_count) || (i < count); i++) {
-       g_fprintf(stderr, _("tapefd_read(%lld): "), (long long)i);
-       if((result = tapefd_read(fd, buf, SIZEOF(buf))) < 0) {
-           perror("");
-           break;
-       } else if(result == 0) {
-           g_fprintf(stderr,  _("%zd (EOF)\n"), result);
-           /*
-            * If we were not given a count, EOF breaks the loop, otherwise
-            * we keep trying (to test read after EOF handling).
-            */
-           if(! have_count) {
-               break;
-           }
-       } else {
-           if(result == (ssize_t)sizeof(buf)) {
-               s = _("OK");
-           } else {
-               s = _("short read");
-           }
-
-           /*
-            * If the amount read is really short, we may refer to junk
-            * when displaying the record data, but things are pretty
-            * well screwed up at this point anyway so it is not worth
-            * the effort to deal with.
-            */
-           g_fprintf(stderr,
-                   _("%zd (%s): file %d: record %d"),
-                   result,
-                   s,
-                   p[0],
-                   p[1]);
-           if(show_timestamp) {
-               then = p[2];
-               tm = localtime(&then);
-               g_fprintf(stderr,
-                       ": %04d/%02d/%02d %02d:%02d:%02d\n",
-                       tm->tm_year + 1900,
-                       tm->tm_mon + 1,
-                       tm->tm_mday,
-                       tm->tm_hour,
-                       tm->tm_min,
-                       tm->tm_sec);
-           }
-           fputc('\n', stderr);
-       }
-    }
-}
-
-static void
-do_write(void)
-{
-    int        result;
-    off_t count;
-    off_t *p;
-    off_t i;
-    char *s;
-    time_t now;
-    struct tm *tm;
-
-    if(token_count > 1) {
-       count = OFF_T_ATOI(token[1]);
-    } else {
-       count = (off_t)1;
-    }
-
-    if(token_count > 2 && strcmp(token[2], "+") != 0) {
-       current_file = OFF_T_ATOI(token[2]);
-    }
-
-    if(token_count > 3 && strcmp(token[3], "+") != 0) {
-       current_record = OFF_T_ATOI(token[3]);
-    }
-
-    if(token_count > 4 && token[4][0] != '\0') {
-       tapefd_setinfo_host(fd, token[4]);
-    }
-
-    if(token_count > 5 && token[5][0] != '\0') {
-       tapefd_setinfo_disk(fd, token[5]);
-    }
-
-    if(token_count > 6 && token[6][0] != '\0') {
-       tapefd_setinfo_level(fd, atoi(token[6]));
-    }
-
-    p = (off_t *)write_buf;
-    time(&now);
-    p[2] = now;
-    tm = localtime(&now);
-    for(i = 0; i < count; i++, (current_record += (off_t)1)) {
-       p[0] = current_file;
-       p[1] = current_record;
-       g_fprintf(stderr, _("tapefd_write(%lld): "), i);
-       if((result = tapefd_write(fd, write_buf, SIZEOF(write_buf))) < 0) {
-           perror("");
-           break;
-       } else {
-           if(result == (ssize_t)sizeof(write_buf)) {
-               s = _("OK");
-           } else {
-               s = _("short write");
-           }
-           g_fprintf(stderr,
-                   _("%d (%s): file %lld: record %lld"),
-                   result,
-                   s,
-                   p[0],
-                   p[1]);
-           if(show_timestamp) {
-               g_fprintf(stderr,
-                       ": %04d/%02d/%02d %02d:%02d:%02d\n",
-                       tm->tm_year + 1900,
-                       tm->tm_mon + 1,
-                       tm->tm_mday,
-                       tm->tm_hour,
-                       tm->tm_min,
-                       tm->tm_sec);
-           }
-           fputc('\n', stderr);
-       }
-    }
-}
-
-static void
-do_fsf(void)
-{
-    int        result;
-    off_t count;
-
-    if(token_count > 1) {
-       count = OFF_T_ATOI(token[1]);
-    } else {
-       count = (off_t)1;
-    }
-
-    g_fprintf(stderr, _("tapefd_fsf(%lld): "), (long long)count);
-    if((result = tapefd_fsf(fd, count)) < 0) {
-       perror("");
-    } else {
-       g_fprintf(stderr, _("%d (OK)\n"), result);
-       current_file += count;
-       current_record = (off_t)0;
-    }
-}
-
-static void
-do_weof(void)
-{
-    int        result;
-    off_t count;
-
-    if(token_count > 1) {
-       count = OFF_T_ATOI(token[1]);
-    } else {
-       count = (off_t)1;
-    }
-
-    g_fprintf(stderr, _("tapefd_weof(%lld): "), count);
-    if((result = tapefd_weof(fd, count)) < 0) {
-       perror("");
-    } else {
-       g_fprintf(stderr, _("%d (OK)\n"), result);
-       current_file += count;
-       current_record = (off_t)0;
-    }
-}
-
-static void
-do_rewind(void)
-{
-    int        result;
-
-    g_fprintf(stderr, _("tapefd_rewind(): "));
-    if((result = tapefd_rewind(fd)) < 0) {
-       perror("");
-    } else {
-       g_fprintf(stderr, _("%d (OK)\n"), result);
-       current_file = (off_t)0;
-       current_record = (off_t)0;
-    }
-}
-
-static void
-do_unload(void)
-{
-    int        result;
-
-    g_fprintf(stderr, _("tapefd_unload(): "));
-    if((result = tapefd_unload(fd)) < 0) {
-       perror("");
-    } else {
-       g_fprintf(stderr, _("%d (OK)\n"), result);
-       current_file = (off_t)-1;
-       current_record = (off_t)-1;
-    }
-}
-
-struct cmd {
-    char *name;
-    int min_chars;
-    void (*func)(void);
-} cmd[] = {
-    { "?",             0,      do_help },
-    { "help",          0,      do_help },
-    { "eof",           0,      do_weof },
-    { "weof",          0,      do_weof },
-    { "fsf",           0,      do_fsf },
-    { "rewind",                0,      do_rewind },
-    { "offline",       0,      do_unload },
-    { "open",          0,      do_open },
-    { "close",         0,      do_close },
-    { "read",          0,      do_read },
-    { "write",         0,      do_write },
-    { NULL,            0,      NULL }
-};
-
-int
-main(
-    int                argc,
-    char **    argv)
-{
-    int ch;
-    int cmdline = 0;
-    char *line = NULL;
-    char *s;
-    int i;
-    int j;
-    time_t now;
-
-    /*
-     * Configure program for internationalization:
-     *   1) Only set the message locale for now.
-     *   2) Set textdomain for all amanda related programs to "amanda"
-     *      We don't want to be forced to support dozens of message catalogs.
-     */  
-    setlocale(LC_MESSAGES, "C");
-    textdomain("amanda"); 
-
-    /* Don't die when child closes pipe */
-    signal(SIGPIPE, SIG_IGN);
-
-    if((pgm = strrchr(argv[0], '/')) != NULL) {
-       pgm++;
-    } else {
-       pgm = argv[0];
-    }
-
-    /*
-     * Compute the minimum abbreviation for each command.
-     */
-    for(i = 0; cmd[i].name; i++) {
-       cmd[i].min_chars = 1;
-       while(1) {
-           for(j = 0; cmd[j].name; j++) {
-               if(i == j) {
-                   continue;
-               }
-               if(0 == strncmp(cmd[i].name, cmd[j].name, cmd[i].min_chars)) {
-                   break;
-               }
-           }
-           if(0 == cmd[j].name) {
-               break;
-           }
-           cmd[i].min_chars++;
-       }
-    }
-
-    /*
-     * Process the command line flags.
-     */
-    while((ch = getopt(argc, argv, "hcl:t")) != EOF) {
-       switch (ch) {
-       case 'c':
-           cmdline = 1;
-           break;
-       case 'l':
-           have_length = 1;
-           length = OFF_T_ATOI(optarg);
-           j = strlen(optarg);
-           if(j > 0) {
-               switch(optarg[j-1] ) {
-               case 'k':                               break;
-               case 'b': length /= (off_t)2;           break;
-               case 'M': length *= (off_t)1024;        break;
-               default:  length /= (off_t)1024;        break;
-               }
-           } else {
-               length /= (off_t)1024;
-           }
-           break;
-       case 't':
-           show_timestamp = 1;
-           break;
-       case 'h':
-       default:
-           usage();
-           return 1;
-       }
-    }
-
-    /*
-     * Initialize the write buffer.
-     */
-    time(&now);
-    srandom(now);
-    for(j = 0; j < (int)SIZEOF(write_buf); j++) {
-       write_buf[j] = (char)random();
-    }
-
-    /*
-     * Do the tests.
-     */
-    token = token_area + 1;
-    token_area[0] = "";                                /* if cmdline */
-    while(1) {
-       if(cmdline) {
-           for(token_count = 1;
-               token_count < (int)(SIZEOF(token_area) / SIZEOF(token_area[0]))
-               && optind < argc;
-               token_count++, optind++) {
-               if(strcmp(argv[optind], "%") == 0) {
-                   optind++;
-                   break;
-               }
-               token_area[token_count] = argv[optind];
-           }
-           token_count--;
-           if(token_count == 0 && optind >= argc) {
-               break;
-           }
-       } else {
-           if((line = areads(0)) == NULL) {
-               break;
-           }
-           if((s = strchr(line, '#')) != NULL) {
-               *s = '\0';
-           }
-           s = line + strlen(line) - 1;
-           while(s >= line && isspace(*s)) {
-               *s-- = '\0';
-           }
-           token_count = split(line,
-                               token_area,
-                               SIZEOF(token_area) / SIZEOF(token_area[0]),
-                               " ");
-       }
-       amfree(line);
-
-       /*
-        * Truncate tokens at first comment indicator, then test for
-        * empty command.
-        */
-       for(i = 0; i < token_count; i++) {
-           if(token[i][0] == '#') {
-               token_count = i;
-               break;
-           }
-       }
-       if(token_count <= 0) {
-           continue;                           /* blank/comment input line */
-       }
-
-       /*
-        * Find the command to run, the do it.
-        */
-       j = strlen(token[0]);
-       for(i = 0; cmd[i].name; i++) {
-           if(strncmp(cmd[i].name, token[0], j) == 0
-              && j >= cmd[i].min_chars) {
-               break;
-           }
-       }
-       if(cmd[i].name == NULL) {
-           g_fprintf(stderr, _("%s: unknown command: %s\n"), pgm, token[0]);
-           exit(1);
-       }
-       (*cmd[i].func)();
-    }
-
-    return 0;
-}
-
-#endif /* TEST */
diff --git a/tape-src/tapeio.h b/tape-src/tapeio.h
deleted file mode 100644 (file)
index 53db45a..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Amanda, The Advanced Maryland Automatic Network Disk Archiver
- * Copyright (c) 1991-1998 University of Maryland at College Park
- * All Rights Reserved.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of U.M. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission.  U.M. makes no representations about the
- * suitability of this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- *
- * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M.
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: James da Silva, Systems Design and Analysis Group
- *                        Computer Science Department
- *                        University of Maryland at College Park
- */
-/*
- * $Id: tapeio.h,v 1.21 2006/05/25 01:47:27 johnfranks Exp $
- *
- * interface for tapeio.c
- */
-#ifndef TAPEIO_H
-#define TAPEIO_H
-
-#include "amanda.h"
-#include "util.h" /* For BSTRNCMP */
-
-/*
- * Tape drive status structure.  This abstracts the things we are
- * interested in from the free-for-all of what the various drivers
- * supply.
- */
-
-struct am_mt_status {
-    char online_valid;                 /* is the online flag valid? */
-    char bot_valid;                    /* is the BOT flag valid? */
-    char eot_valid;                    /* is the EOT flag valid? */
-    char protected_valid;              /* is the protected flag valid? */
-    char flags_valid;                  /* is the flags field valid? */
-    char fileno_valid;                 /* is the fileno field valid? */
-    char blkno_valid;                  /* is the blkno field valid? */
-    char device_status_valid;          /* is the device status field valid? */
-    char error_status_valid;           /* is the device status field valid? */
-
-    char online;                       /* true if device is online/ready */
-    char bot;                          /* true if tape is at the beginning */
-    char eot;                          /* true if tape is at end of medium */
-    char protected;                    /* true if tape is write protected */
-    long flags;                                /* device flags, whatever that is */
-    long fileno;                       /* tape file number */
-    long blkno;                                /* block within file */
-    int device_status_size;            /* size of orig device status field */
-    unsigned long device_status;       /* "device status", whatever that is */
-    int error_status_size;             /* size of orig error status field */
-    unsigned long error_status;                /* "error status", whatever that is */
-};
-
-#define        FAKE_LABEL      "[fake-label]"
-#define NO_LABEL        "[no-label-yet]"
-
-int tape_open(char *, int, ...);
-
-int tapefd_rewind(int tapefd);
-int tapefd_unload(int tapefd);
-int tapefd_fsf(int tapefd, off_t count);
-int tapefd_weof(int tapefd, off_t count);
-
-int tapefd_status(int tapefd, struct am_mt_status *);
-
-void tapefd_resetofs(int tapefd);
-
-ssize_t tapefd_read(int, void *, size_t);
-ssize_t tapefd_write(int tapefd, const void *buffer, size_t count);
-
-char *tapefd_rdlabel(int tapefd, char **datestamp, char **label);
-char *tapefd_wrlabel(int tapefd,
-                       char  *datestamp,
-                       char  *label,
-                       size_t s);
-
-char *auto_tapefd_label(int tapefd, char **datestamp, char **label);
-char *auto_tape_label(char *dev, char **datestamp, char **label);
-
-char *tapefd_wrendmark(int tapefd, char *datestamp, size_t s);
-
-int tapefd_eof(int tapefd);            /* just used in tapeio-test */
-int tapefd_close(int tapefd);
-int tapefd_can_fork(int tapefd);
-
-char *tape_unload(char *dev);
-char *tape_rewind(char *dev);
-char *tape_fsf(char *dev, off_t count);
-char *tape_rdlabel(char *dev, char **datestamp, char **label);
-char *tape_wrlabel(char *dev,
-                     char  *datestamp,
-                     char  *label,
-                     size_t size);
-char *tape_wrendmark(char *dev,
-                       char *datestamp,
-                       size_t size);
-char *tape_writable(char *dev);
-
-int tape_access(char *dev, int mode);
-int tape_stat(char *filename, struct stat *buf);
-
-char *tapefd_getinfo_label(int fd);
-void tapefd_setinfo_label(int fd, char *v);
-char *tapefd_getinfo_host(int fd);
-void tapefd_setinfo_host(int fd, char *v);
-char *tapefd_getinfo_disk(int fd);
-void tapefd_setinfo_disk(int fd, char *v);
-int tapefd_getinfo_level(int fd);
-void tapefd_setinfo_level(int fd, int v);
-char *tapefd_getinfo_datestamp(int fd);
-void tapefd_setinfo_datestamp(int fd, char *v);
-off_t tapefd_getinfo_length(int fd);
-void tapefd_setinfo_length(int fd, off_t v);
-char *tapefd_getinfo_tapetype(int fd);
-void tapefd_setinfo_tapetype(int fd, char *v);
-int tapefd_getinfo_fake_label(int fd);
-void tapefd_setinfo_fake_label(int fd, int v);
-int tapefd_getinfo_ioctl_fork(int fd);
-void tapefd_setinfo_ioctl_fork(int fd, int v);
-void tapefd_set_master_fd(int tapefd, int master_fd);
-
-#ifdef HAVE_LINUX_ZFTAPE_H
-int is_zftape(const char *filename);
-#endif
-
-int tapeio_init_devname(char * dev,
-                          char **dev_left,
-                          char **dev_right,
-                          char **dev_next);
-char *tapeio_next_devname(char * dev_left,
-                            char * dev_right,
-                            char **dev_next);
-
-#define NOT_AMANDA_TAPE_MSG "not an amanda tape"
-#define CHECK_NOT_AMANDA_TAPE_MSG(x) (!BSTRNCMP(x, NOT_AMANDA_TAPE_MSG))
-
-ssize_t getconf_readblocksize(void);
-
-#endif /* ! TAPEIO_H */
diff --git a/tape-src/tapetype.c b/tape-src/tapetype.c
deleted file mode 100644 (file)
index 0128401..0000000
+++ /dev/null
@@ -1,725 +0,0 @@
-/*
- * Amanda, The Advanced Maryland Automatic Network Disk Archiver
- * Copyright (c) 1991-1998 University of Maryland at College Park
- * All Rights Reserved.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of U.M. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission.  U.M. makes no representations about the
- * suitability of this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- *
- * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M.
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: James da Silva, Systems Design and Analysis Group
- *                        Computer Science Department
- *                        University of Maryland at College Park
- */
-/*
- * $Id: tapetype.c,v 1.27 2006/08/24 01:57:16 paddy_s Exp $
- *
- * tests a tape in a given tape unit and prints a tapetype entry for
- * it.  */
-#include "amanda.h"
-#include "conffile.h"
-
-#include "tapeio.h"
-
-#define NBLOCKS 32                     /* number of random blocks */
-
-extern int optind;
-
-static char *sProgName;
-static char *tapedev;
-static int fd;
-
-static size_t blockkb = 32;
-static size_t blocksize;
-
-static char *randombytes = (char *) NULL;
-
-#if USE_RAND
-/* If the C library does not define random(), try to use rand() by
-   defining USE_RAND, but then make sure you are not using hardware
-   compression, because the low-order bits of rand() may not be that
-   random... :-( */
-#define random() rand()
-#define srandom(seed) srand(seed)
-#endif
-
-static char *getrandombytes(void);
-static int writeblock(int fd);
-static off_t writeblocks(int fd, off_t nblks);
-static void allocrandombytes(void);
-static void do_pass0(off_t size, time_t *seconds, int dorewind);
-static void do_pass(off_t size, off_t *blocks, off_t *files, time_t *seconds);
-static void help(void);
-static void initnotrandombytes(void);
-static void initrandombytes(void);
-static void show_progress(off_t *blocks, off_t *files);
-static void usage(void);
-
-int main(int argc, char **argv);
-
-static void
-allocrandombytes(void)
-{
-  size_t i;
-  size_t j;
-  size_t page_size;
-  char   *p;
-
-  if (randombytes == (char *)NULL) {
-#if defined(HAVE_GETPAGESIZE)
-    page_size = (size_t)getpagesize();
-#else
-    page_size = (size_t)1024;
-#endif
-    j = (NBLOCKS * blocksize) + page_size;     /* buffer space plus one page */
-    j = am_round(j, page_size);                        /* even number of pages */
-    p = (char *)alloc(j);
-    i = (size_t)(p - (char *)0) & (page_size - 1);/* page boundary offset */
-    if(i != 0) {
-      randombytes = p + (page_size - i);       /* round up to page boundary */
-    } else {
-      randombytes = p;                         /* alloc already on boundary */
-    }
-  }
-}
-
-static void
-initnotrandombytes(void)
-{
-  unsigned long i;
-  unsigned long j;
-  char *p;
-
-  allocrandombytes();
-  j = NBLOCKS * blocksize;
-  p = randombytes;
-  for(i=0; i < j; ++i) {
-    *p++ = (char) (i % 256);
-  }
-}
-
-static void
-initrandombytes(void)
-{
-  unsigned long i, j;
-  char *p;
-
-  allocrandombytes();
-  j = NBLOCKS * blocksize;
-  p = randombytes;
-  for(i=0; i < j; ++i) {
-    *p++ = (char)random();
-  }
-}
-
-static char *
-getrandombytes(void)
-{
-  static unsigned long counter = 0;
-
-  return randombytes + ((counter++ % NBLOCKS) * blocksize);
-}
-
-static int short_write;
-
-static int
-writeblock(
-    int                fd)
-{
-  ssize_t w;
-
-  if ((w = tapefd_write(fd, getrandombytes(), blocksize)) == (ssize_t)blocksize) {
-    return 1;
-  }
-  if (w >= 0) {
-    short_write = 1;
-  } else {
-    short_write = 0;
-  }
-  return 0;
-}
-
-
-/* returns number of blocks actually written */
-static off_t
-writeblocks(
-    int                fd,
-    off_t      nblks)
-{
-  off_t blks = (off_t)0;
-
-  while (blks < nblks) {
-    if (! writeblock(fd)) {
-      return (off_t)0;
-    }
-    blks += (off_t)1;
-  }
-
-  return blks;
-}
-
-
-static void
-usage(void)
-{
-  fputs(_("usage: "), stderr);
-  fputs(sProgName, stderr);
-  fputs(_(" [-h]"), stderr);
-  fputs(_(" [-c]"), stderr);
-  fputs(_(" [-o]"), stderr);
-  fputs(_(" [-b blocksize]"), stderr);
-  fputs(_(" -e estsize"), stderr);
-  fputs(_(" [-f tapedev]"), stderr);
-  fputs(_(" [-t typename]"), stderr);
-  fputc('\n', stderr);
-}
-
-static void
-help(void)
-{
-  usage();
-  fputs(_("-h                  display this message\n"
-         "-c                   run hardware compression detection test only\n"
-         "-o                   overwrite amanda tape\n"
-         "-b blocksize         record block size (default: 32k)\n"
-         "-e estsize           estimated tape size (No default!)\n"
-         "-f tapedev           tape device name (default: $TAPE)\n"
-         "-t typename          tapetype name (default: unknown-tapetype)\n"
-         "\n"
-         "Note: disable hardware compression when running this program.\n"),
-       stderr);
-}
-
-
-int do_tty;
-
-static void
-show_progress(
-    off_t *    blocks,
-    off_t *    files)
-{
-    g_fprintf(stderr,
-           plural(_("wrote %lld %zu Kb block"),
-                  _("wrote %lld %zu Kb blocks"),
-                  *blocks),
-           (long long)*blocks,
-           blockkb);
-    g_fprintf(stderr,
-           plural(_(" in %lld file"),
-                  _(" in %lld files"),
-                  *files),
-           (long long)*files);
-}
-
-
-static void
-do_pass(
-    off_t      size,
-    off_t *    blocks,
-    off_t *    files,
-    time_t *   seconds)
-{
-  off_t blks;
-  time_t start, end;
-  int save_errno;
-
-  if (tapefd_rewind(fd) == -1) {
-    g_fprintf(stderr, _("%s: could not rewind %s: %s\n"),
-           sProgName, tapedev, strerror(errno));
-    exit(1);
-  }
-  if (((-1 == tapefd_close(fd)) ||
-       (-1 == (fd = tape_open(tapedev, O_RDWR))))) {
-    g_fprintf(stderr, "%s: could not re-open %s: %s\n",
-           sProgName, tapedev, strerror(errno));
-    exit(1);
-  }
-
-  time(&start);
-
-  while(1) {
-
-    if ((blks = writeblocks(fd, size)) <= (off_t)0 || tapefd_weof(fd, (off_t)1) != 0)
-      break;
-    *blocks += blks;
-    *files += (off_t)1;
-    if(do_tty) {
-      putc('\r', stderr);
-      show_progress(blocks, files);
-    }
-  }
-  save_errno = errno;
-
-  time(&end);
-
-  if (*blocks == (off_t)0) {
-    g_fprintf(stderr, _("%s: could not write any data in this pass: %s\n"),
-           sProgName, short_write ? _("short write") : strerror(save_errno));
-    exit(1);
-  }
-
-  if(end <= start) {
-    /*
-     * Just in case time warped backward or the device is really, really
-     * fast (e.g. /dev/null testing).
-     */
-    *seconds = 1;
-  } else {
-    *seconds = end - start;
-  }
-  if(do_tty) {
-    putc('\r', stderr);
-  }
-  show_progress(blocks, files);
-  g_fprintf(stderr,
-         plural(_(" in %jd second (%s)\n"),
-                _(" in %jd seconds (%s)\n"),
-                *seconds),
-         (intmax_t)*seconds,
-         short_write ? _("short write") : strerror(save_errno));
-}
-
-
-static void
-do_pass0(
-    off_t      size,
-    time_t *   seconds,
-    int                dorewind)
-{
-  off_t blks;
-  time_t start, end;
-  int save_errno;
-
-  if (dorewind  &&  tapefd_rewind(fd) == -1) {
-    g_fprintf(stderr, _("%s: could not rewind %s: %s\n"),
-           sProgName, tapedev, strerror(errno));
-    exit(1);
-  }
-
-  if (dorewind &&
-      ((-1 == tapefd_close(fd)) ||
-       (-1 == (fd = tape_open(tapedev, O_RDWR))))) {
-    g_fprintf(stderr, "%s: could not re-open %s: %s\n",
-           sProgName, tapedev, strerror(errno));
-    exit(1);
-  }
-
-
-  time(&start);
-
-  blks = writeblocks(fd, size);
-  tapefd_weof(fd, (off_t)1);
-
-  save_errno = errno;
-
-  time(&end);
-
-  if (blks <= (off_t)0) {
-    g_fprintf(stderr, _("%s: could not write any data in this pass: %s\n"),
-           sProgName, short_write ? _("short write") : strerror(save_errno));
-    exit(1);
-  }
-
-  if(end <= start) {
-    /*
-     * Just in case time warped backward or the device is really, really
-     * fast (e.g. /dev/null testing).
-     */
-    *seconds = 1;
-  } else {
-    *seconds = end - start;
-  }
-}
-
-
-int
-main(
-    int                argc,
-    char **    argv)
-{
-  off_t pass1blocks = (off_t)0;
-  off_t pass2blocks = (off_t)0;
-  time_t pass1time;
-  time_t pass2time;
-  time_t timediff;
-  off_t pass1files = (off_t)0;
-  off_t pass2files = (off_t)0;
-  off_t estsize;
-  off_t pass0size;
-  off_t pass1size;
-  off_t pass2size;
-  off_t blockdiff;
-  off_t filediff;
-  size_t filemark;
-  unsigned long speed;
-  off_t size;
-  char *sizeunits;
-  int ch;
-  char *suffix = NULL;
-  char *typename;
-  time_t now;
-  int hwcompr = 0;
-  int comprtstonly = 0;
-  int overwrite_label = 0;
-  int is_labeled = 0;
-  char *result;
-  char *datestamp = NULL;
-  char *label = NULL;
-
-  /*
-   * Configure program for internationalization:
-   *   1) Only set the message locale for now.
-   *   2) Set textdomain for all amanda related programs to "amanda"
-   *      We don't want to be forced to support dozens of message catalogs.
-   */  
-  setlocale(LC_MESSAGES, "C");
-  textdomain("amanda"); 
-
-  config_init(0, NULL);
-
-  if ((sProgName = strrchr(*argv, '/')) == NULL) {
-    sProgName = *argv;
-  } else {
-    sProgName++;
-  }
-
-  /* Don't die when child closes pipe */
-  signal(SIGPIPE, SIG_IGN);
-
-  estsize = (off_t)0;
-  tapedev = getenv("TAPE");
-  typename = "unknown-tapetype";
-
-  while ((ch = getopt(argc, argv, "b:e:f:t:hco")) != EOF) {
-    switch (ch) {
-    case 'b':
-      blockkb = (size_t)strtol(optarg, &suffix, 0);
-      if (!(*suffix == '\0' || *suffix == 'k' || *suffix == 'K')) {
-       if (*suffix == 'm' || *suffix == 'M') {
-         blockkb *= 1024;
-       } else if (*suffix == 'g' || *suffix == 'G') {
-         blockkb *= (1024 * 1024);
-       } else {
-         g_fprintf(stderr, _("%s: unknown size suffix \'%c\'\n"),
-                 sProgName, *suffix);
-         return 1;
-       }
-      }
-      break;
-    case 'e':
-      estsize = OFF_T_STRTOL(optarg, &suffix, 0);
-      if (!(*suffix == '\0' || *suffix == 'k' || *suffix == 'K')) {
-       if (*suffix == 'm' || *suffix == 'M') {
-         estsize *= (off_t)1024;
-       } else if (*suffix == 'g' || *suffix == 'G') {
-         estsize *= (off_t)(1024 * 1024);
-       } else {
-         g_fprintf(stderr, _("%s: unknown size suffix \'%c\'\n"),
-                 sProgName, *suffix);
-         return 1;
-       }
-      }
-      break;
-
-    case 'f':
-      tapedev = stralloc(optarg);
-      break;
-
-    case 't':
-      typename = stralloc(optarg);
-      break;
-
-    case 'c':
-      comprtstonly = 1;
-      break;
-
-    case 'h':
-      help();
-      return 1;
-
-    case 'o':
-      overwrite_label=1;
-      break;
-
-    default:
-      g_fprintf(stderr, _("%s: unknown option \'%c\'\n"), sProgName, ch);
-      /*FALLTHROUGH*/
-
-    case '?':
-      usage();
-      return 1;
-    }
-  }
-  blocksize = blockkb * 1024;
-
-  if (tapedev == NULL) {
-    g_fprintf(stderr, _("%s: No tapedev specified\n"), sProgName);
-    usage();
-    return 1;
-  }
-  if (optind < argc) {
-    usage();
-    return 1;
-  }
-
-  if (estsize == 0) {
-    if (comprtstonly) {
-      estsize = (off_t)(1024 * 1024);          /* assume 1 GByte for now */
-    } else {
-      g_fprintf(stderr, _("%s: please specify estimated tape capacity (e.g. '-e 4g')\n"), sProgName);
-      usage();
-      return 1;
-    }
-  }
-
-
-/* verifier tape */
-
-
-  fd = tape_open(tapedev, O_RDONLY, 0);
-  if (fd == -1) {
-    g_fprintf(stderr, _("%s: could not open %s: %s\n"),
-           sProgName, tapedev, strerror(errno));
-    return 1;
-  }
-
-  if((result = tapefd_rdlabel(fd, &datestamp, &label)) == NULL) {
-    is_labeled = 1;
-  }
-  else if (strcmp(result,_("not an amanda tape")) == 0) {
-    is_labeled = 2;
-  }
-
-  if(tapefd_rewind(fd) == -1) {
-    g_fprintf(stderr, _("%s: could not rewind %s: %s\n"),
-           sProgName, tapedev, strerror(errno));
-    tapefd_close(fd);
-    return 1;
-  }
-
-  tapefd_close(fd);
-
-  if(is_labeled == 1 && overwrite_label == 0) {
-    g_fprintf(stderr, _("%s: The tape is an amanda tape, use -o to overwrite the tape\n"),
-           sProgName);
-    return 1;
-  }
-  else if(is_labeled == 2 && overwrite_label == 0) {
-    g_fprintf(stderr, _("%s: The tape is already used, use -o to overwrite the tape\n"),
-           sProgName);
-    return 1;
-  }
-
-  fd = tape_open(tapedev, O_RDWR, 0);
-  if (fd == -1) {
-    g_fprintf(stderr, _("%s: could not open %s: %s\n"),
-           sProgName, tapedev, strerror(errno));
-    return 1;
-  }
-
-  do_tty = isatty(fileno(stderr));
-
-  /*
-   * Estimate pass: write twice a small file, once with compressable
-   * data and once with uncompressable data.
-   * The theory is that if the drive is in hardware compression mode
-   * we notice a significant difference in writing speed between the two
-   * (at least if we can provide data as fast the tape streams).
-   */
-
-  initnotrandombytes();
-
-  g_fprintf(stderr, _("Estimate phase 1..."));
-  pass0size = (off_t)(8 * 1024 / blockkb);
-  pass1time = 0;
-  pass2time = 0;
-  /*
-   * To get accurate results, we should write enough data
-   * so that rewind/start/stop time is small compared to
-   * the total time; let's take 10%.
-   * The timer has a 1 sec granularity, so the test
-   * should take at least 10 seconds to measure a
-   * difference with 10% accuracy; let's take 25 seconds.
-   */ 
-  while (pass1time < 25 || ((100*(pass2time-pass1time)/pass2time) >= 10) ) {
-    if (pass1time != 0) {
-      time_t t = pass1time;
-      do {
-         pass0size *= (off_t)2;
-         t *= 2;
-      } while (t < 25);
-    }
-    /*
-     * first a dummy pass to rewind, stop, start and
-     * get drive streaming, then do the real timing
-     */
-    do_pass0(pass0size, &pass2time, 1);
-    do_pass0(pass0size, &pass1time, 0);
-    if (pass0size >= (off_t)(10 * 1024 * 1024)) {
-      g_fprintf(stderr, "\r");
-      g_fprintf(stderr,
-       _("Tape device is too fast to detect hardware compression...\n"));
-      break;   /* avoid loops if tape is superfast or broken */
-    }
-  }
-  g_fprintf(stderr, "\r");
-  g_fprintf(stderr,
-       _("Writing %lld Mbyte   compresseable data:  %jd sec\n"),
-       (long long)((off_t)blockkb * pass0size / (off_t)1024),
-       (intmax_t)pass1time);
-
-  /*
-   * now generate uncompressable data and try again
-   */
-  time(&now);
-  srandom((unsigned)now);
-  initrandombytes();
-
-  g_fprintf(stderr, _("Estimate phase 2..."));
-  do_pass0(pass0size, &pass2time, 1);  /* rewind and get drive streaming */
-  do_pass0(pass0size, &pass2time, 0);
-  g_fprintf(stderr, "\r");
-  g_fprintf(stderr, _("Writing %lld Mbyte uncompresseable data: %jd sec\n"),
-       (long long)((off_t)blockkb * pass0size / (off_t)1024),
-       (intmax_t)pass2time);
-
-  /*
-   * Compute the time difference between writing the compressable and
-   * uncompressable data.  If it differs more than 20%, then warn
-   * user that the tape drive has probably hardware compression enabled.
-   */
-  if (pass1time > pass2time) {
-    /*
-     * Strange!  I would expect writing compresseable data to be
-     * much faster (or about equal, if hardware compression is disabled)
-     */
-    timediff = 0;
-  } else {
-    timediff = pass2time - pass1time;
-  }
-  if (((100 * timediff) / pass2time) >= 20) {  /* 20% faster? */
-    g_fprintf(stderr, _("WARNING: Tape drive has hardware compression enabled\n"));
-    hwcompr = 1;
-  }
-
-  /*
-   * Inform about estimated time needed to run the remaining of this program
-   */
-  g_fprintf(stderr, _("Estimated time to write 2 * %lu Mbyte: "), (unsigned long) (estsize / (off_t)1024));
-  pass1time = (time_t)(2.0 * (double)pass2time * (double)estsize /
-               (1.0 * (double)pass0size * (double)blockkb));
-       /* avoid overflow and underflow by doing math in floating point */
-  g_fprintf(stderr, _("%jd sec = %jd h %jd min\n"),
-         (intmax_t)pass1time,
-         (intmax_t)(pass1time/(time_t)3600),
-         (intmax_t)((pass1time%(time_t)3600) / (time_t)60));
-
-  if (comprtstonly) {
-       exit(hwcompr);
-  }
-
-
-  /*
-   * Do pass 1 -- write files that are 1% of the estimated size until error.
-   */
-  pass1size = (off_t)(((double)estsize * 0.01) / (double)blockkb); /* 1% of estimate */
-  if(pass1size <= (off_t)0) {
-    pass1size = (off_t)2;                              /* strange end case */
-  }
-  do_pass(pass1size, &pass1blocks, &pass1files, &pass1time);
-
-  /*
-   * Do pass 2 -- write smaller files until error.
-   */
-  pass2size = pass1size / (off_t)2;
-  do_pass(pass2size, &pass2blocks, &pass2files, &pass2time);
-
-  /*
-   * Compute the size of a filemark as the difference in data written
-   * between pass 1 and pass 2 divided by the difference in number of
-   * file marks written between pass 1 and pass 2.  Note that we have
-   * to be careful in case size_t is unsigned (i.e. do not subtract
-   * things and then check for less than zero).
-   */
-  if (pass1blocks <= pass2blocks) {
-    /*
-     * If tape marks take up space, there should be fewer blocks in pass
-     * 2 than in pass 1 since we wrote twice as many tape marks.  But
-     * odd things happen, so make sure the result does not go negative.
-     */
-    blockdiff = (off_t)0;
-  } else {
-    blockdiff = pass1blocks - pass2blocks;
-  }
-  if (pass2files <= pass1files) {
-    /*
-     * This should not happen, but just in case ...
-     */
-    filediff = (off_t)1;
-  } else {
-    filediff = pass2files - pass1files;
-  }
-  filemark = (size_t)((blockdiff * (off_t)blockkb) / filediff);
-
-  /*
-   * Compute the length as the average of the two pass sizes including
-   * tape marks.
-   */
-  size = ((pass1blocks * (off_t)blockkb + (off_t)filemark * pass1files)
-           + (pass2blocks * (off_t)blockkb + (off_t)filemark * pass2files))
-          / (off_t)2;
-  if (size >= (off_t)(1024 * 1024 * 1000)) {
-    size /= (off_t)(1024 * 1024);
-    sizeunits = "gbytes";
-  } else if (size >= (off_t)(1024 * 1000)) {
-    size /= (off_t)1024;
-    sizeunits = "mbytes";
-  } else {
-    sizeunits = "kbytes";
-  }
-
-  /*
-   * Compute the speed as the average of the two passes.
-   */
-  speed = (unsigned long)((((double)pass1blocks
-          * (double)blockkb / (double)pass1time)
-           + ((double)pass2blocks * (double)blockkb / (double)pass2time)) / 2.0);
-
-  /*
-   * Dump the tapetype.
-   */
-  g_printf("define tapetype %s {\n", typename);
-  g_printf(_("    comment \"just produced by tapetype prog (hardware compression %s)\"\n"),
-       hwcompr ? _("on") : _("off"));
-  g_printf("    length %lld %s\n", (long long)size, sizeunits);
-  g_printf("    filemark %zu kbytes\n", filemark);
-  g_printf("    speed %lu kps\n", speed);
-  g_printf("}\n");
-
-  if (tapefd_rewind(fd) == -1) {
-    g_fprintf(stderr, _("%s: could not rewind %s: %s\n"),
-           sProgName, tapedev, strerror(errno));
-    return 1;
-  }
-
-  if (tapefd_close(fd) == -1) {
-    g_fprintf(stderr, _("%s: could not close %s: %s\n"),
-           sProgName, tapedev, strerror(errno));
-    return 1;
-  }
-
-  return 0;
-}
diff --git a/xfer-src/Makefile.am b/xfer-src/Makefile.am
new file mode 100644 (file)
index 0000000..b7d77f6
--- /dev/null
@@ -0,0 +1,67 @@
+# Makefile for Amanda library.
+
+include $(top_srcdir)/config/automake/vars.am
+include $(top_srcdir)/config/automake/scripts.am
+include $(top_srcdir)/config/automake/installperms.am
+include $(top_srcdir)/config/automake/precompile.am
+
+INCLUDES =      -I$(top_srcdir)/gnulib \
+               -I$(top_srcdir)/device-src \
+               -I$(top_srcdir)/common-src
+
+AM_CFLAGS = $(AMANDA_WARNING_CFLAGS)
+AM_LDFLAGS = $(AMANDA_STATIC_LDFLAGS)
+
+amlib_LTLIBRARIES =    libamxfer.la
+
+LINT=$(AMLINT)
+LINTFLAGS=$(AMLINTFLAGS)
+
+libamxfer_la_SOURCES = \
+       dest-device.c \
+       dest-fd.c \
+       dest-null.c \
+       element-glue.c \
+       filter-xor.c \
+       source-device.c \
+       source-random.c \
+       source-fd.c \
+       source-pattern.c \
+       xfer-element.c \
+       xfer.c \
+       xmsg.c
+
+libamxfer_la_LIBADD = \
+       ../device-src/libamdevice.la \
+       ../common-src/libamanda.la
+
+noinst_HEADERS = \
+       amxfer.h \
+       element-glue.h \
+       xfer-element.h \
+       xfer.h \
+       xmsg.h
+
+# automake-style tests
+
+TESTS = xfer-test
+noinst_PROGRAMS = $(TESTS)
+
+xfer_test_SOURCES = xfer-test.c
+xfer_test_LDADD = \
+       ../common-src/libtestutils.la \
+       libamxfer.la
+
+# lint support
+
+lint:
+       @echo $(LINT) $(libamxfer_la_SOURCES)
+       @$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(DEFS) -I. -I$(top_builddir)/config $(INCLUDES) $(libamxfer_la_SOURCES)
+       @echo $(LINT) $(genversion_SOURCES)
+       @$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(DEFS) -I. -I$(top_builddir)/config $(INCLUDES) $(genversion_SOURCES)
+
+listlibsrc:
+       @ for p in $(libamxfer_la_SOURCES); do  \
+               listlibsrcs="$$listlibsrcs `pwd`/$$p";          \
+       done;                                                   \
+       echo $$listlibsrcs >listlibsrc.output
diff --git a/xfer-src/Makefile.in b/xfer-src/Makefile.in
new file mode 100644 (file)
index 0000000..6a96e89
--- /dev/null
@@ -0,0 +1,1427 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008  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@
+
+# Makefile for Amanda library.
+
+# vim:ft=automake
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+# 
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License version 2.1 as 
+# published by the Free Software Foundation.
+# 
+# This 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 this library; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+# 
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+# simple include file to pre-define variables which are then +='d by other
+# scripts in this directory.
+
+# vim:ft=automake
+# Copyright (c) 2005-2008 Zmanda Inc.  All Rights Reserved.
+# 
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License version 2.1 as 
+# published by the Free Software Foundation.
+# 
+# This 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 this library; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+# 
+# Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+
+# SYNOPSIS:
+#
+# Automake magic to handle the various tasks of building scripts.  Scripts can
+# be built down to extensionless executables (e.g., foo.pl -> foo), or to 
+# files with the usual extension (foo-lib.sh.in -> foo.sh).
+#
+# Files which support it are syntax-checked when the user invokes 'make check'.
+#
+# All *target* filenames must be listed in SCRIPTS_SHELL, SCRIPTS_PERL, and 
+# SCRIPTS_AWK to support 'make check', 'make dist', and 'make distclean'. No
+# files which are not substituted by config.status should be included in
+# SCRIPTS_PERL, SCRIPTS_SHELL, or SCRIPTS_AWK.  If non-generated files are listed
+# for installation, then Automake will figure out that they should be distributed;
+# otherwise, include them in EXTRA_DIST.
+#
+# USAGE:
+#
+#   include $(top_srcdir)/config/automake/vars.am
+#   include $(top_srcdir)/config/automake/scripts.am
+#   ...
+#   SCRIPTS_PERL = fooscript barscript perl-lib.pl perlmod.pm
+#   SCRIPTS_SHELL = shell1 shell2 sh-lib.sh
+#   SCRIPTS_AWK = talk balk chalk awk-lib.awk
+#   sbin_SCRIPTS = not-subbed
+#   EXTRA_DIST = util-script.pl
+#
+# with the corresponding files in the repository:
+#
+#   fooscript.pl barscript.pl perl-lib.pl.in perlmod.pm.in
+#   shell1.sh shell2.sh sh-lib.sh.in
+#   talk.awk balk.awk chalk.awk awk-lib.awk.in
+#   not-subbed util-script.pl
+#
+# by default, all shell and perl scripts are syntax checked.  If this is
+# a problem (for example, perl scripts depending on Amanda extension 
+# modules), then assign to CHECK_{PERL,SHELL} the list of files you wish
+# to be checked (which can be empty).
+#
+# To add extra flags to the perl checks (e.g., to add new -I flags), set
+# CHECK_PERL_FLAGS.
+
+# Implementation note:
+#
+# This file uses config.status to substitute @foo@ in those scripts while
+# converting them. It also adds the executable bits (a+x) to extensionless
+# files.  The substitution works even though the files are not listed in 
+# configure.in
+
+# vim:ft=automake
+#
+# Adjust post-install permissions settings.  This rule works off two
+# specially-formatted variables, INSTALLPERMS_exec and INSTALLPERMS_data. 
+# Each is a whitespace-separated list of commands, all of which are either
+# a variable assignment or a filename.  Three variables are available:
+#
+#  - dest= sets the destination directory to e.g., $(sbindir)
+#  - chown= controls changes in ownership; value is first argument to chown
+#  - chmod= controls changes in permissions; value is first argument to chmod
+#
+# As a special case, chown=amanda is taken as equivalent to 
+# chown=$(BINARY_OWNER):$(SETUID_GROUP), which may otherwise have problems with
+# whitespace in the user/group names.
+# 
+# when a filename is seen, the currently active variables are applied.
+#
+# Note that scripts are data, not executables!
+#
+# EXAMPLE
+#
+# sbin_PROGRAMS = foo bar bing
+# libexec_PROGRAMS = pro gram
+# sbin_SCRIPTS = sk ript
+# INSTALLPERMS_exec = \
+#      dest=$(sbindir) chown=amanda chmod= \
+#              foo bar \
+#      chmod=07450 \
+#              bing
+#      dest=$(libexecdir) chmod= \
+#              $(libexec_PROGRAMS)
+# INSTALLPERMS_data = \
+#      dest=$(sbindir) chown=amanda chmod= \
+#              $(sbin_SCRIPTS)
+#
+# This whole operation is not required when making builds for packaging,
+# and can be disabled with --disable-installperms, via the WANT_INSTALLPERMS
+# AM_CONDITIONAL.  When disabled, the file 'installperms.sh' in the top-level
+# build directory is populated with a format suitable for shell interpretation,
+# with lines like this:
+#   installperm "amanda:disk" "04750" "/usr/local/sbin/bing"
+# the arguments being, respectively, owner:group, mode, and filename.  There will
+# be exactly one line for each file which has specific permissions.  The intention
+# is that this file be used by packaging scripts to set correct permissions at install
+# time.  Note that files which have no special permissions requirements do not appear 
+# in this file at all, due to limitations of Automake.
+
+# vim:ft=automake
+
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+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@
+target_triplet = @target@
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+       $(srcdir)/Makefile.in \
+       $(top_srcdir)/config/automake/installperms.am \
+       $(top_srcdir)/config/automake/precompile.am \
+       $(top_srcdir)/config/automake/scripts.am \
+       $(top_srcdir)/config/automake/vars.am
+@WANT_INSTALLPERMS_FALSE@am__append_1 = $(installperms_sh)
+TESTS = xfer-test$(EXEEXT)
+noinst_PROGRAMS = $(am__EXEEXT_1)
+subdir = xfer-src
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps =  \
+       $(top_srcdir)/config/macro-archive/ac_define_dir.m4 \
+       $(top_srcdir)/config/macro-archive/ac_perl_module_version.m4 \
+       $(top_srcdir)/config/macro-archive/ac_prog_perl_version.m4 \
+       $(top_srcdir)/config/macro-archive/ac_prog_swig.m4 \
+       $(top_srcdir)/config/macro-archive/ax_compare_version.m4 \
+       $(top_srcdir)/config/macro-archive/docbook-dtd.m4 \
+       $(top_srcdir)/config/macro-archive/docbook-xslt-min.m4 \
+       $(top_srcdir)/config/macro-archive/docbook-xslt.m4 \
+       $(top_srcdir)/config/macro-archive/xsltproc.m4 \
+       $(top_srcdir)/config/amanda/amplot.m4 \
+       $(top_srcdir)/config/amanda/bsd-security.m4 \
+       $(top_srcdir)/config/amanda/bsdtcp-security.m4 \
+       $(top_srcdir)/config/amanda/bsdudp-security.m4 \
+       $(top_srcdir)/config/amanda/changer.m4 \
+       $(top_srcdir)/config/amanda/components.m4 \
+       $(top_srcdir)/config/amanda/compress.m4 \
+       $(top_srcdir)/config/amanda/config.m4 \
+       $(top_srcdir)/config/amanda/debugging.m4 \
+       $(top_srcdir)/config/amanda/defaults.m4 \
+       $(top_srcdir)/config/amanda/devprefix.m4 \
+       $(top_srcdir)/config/amanda/dirs.m4 \
+       $(top_srcdir)/config/amanda/documentation.m4 \
+       $(top_srcdir)/config/amanda/dumpers.m4 \
+       $(top_srcdir)/config/amanda/flags.m4 \
+       $(top_srcdir)/config/amanda/flock.m4 \
+       $(top_srcdir)/config/amanda/funcs.m4 \
+       $(top_srcdir)/config/amanda/getfsent.m4 \
+       $(top_srcdir)/config/amanda/i18n.m4 \
+       $(top_srcdir)/config/amanda/ipv6.m4 \
+       $(top_srcdir)/config/amanda/krb4-security.m4 \
+       $(top_srcdir)/config/amanda/krb5-security.m4 \
+       $(top_srcdir)/config/amanda/lfs.m4 \
+       $(top_srcdir)/config/amanda/libs.m4 \
+       $(top_srcdir)/config/amanda/net.m4 \
+       $(top_srcdir)/config/amanda/progs.m4 \
+       $(top_srcdir)/config/amanda/ps.m4 \
+       $(top_srcdir)/config/amanda/readdir.m4 \
+       $(top_srcdir)/config/amanda/readline.m4 \
+       $(top_srcdir)/config/amanda/rsh-security.m4 \
+       $(top_srcdir)/config/amanda/s3-device.m4 \
+       $(top_srcdir)/config/amanda/shmem.m4 \
+       $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \
+       $(top_srcdir)/config/amanda/ssh-security.m4 \
+       $(top_srcdir)/config/amanda/summary.m4 \
+       $(top_srcdir)/config/amanda/swig.m4 \
+       $(top_srcdir)/config/amanda/syshacks.m4 \
+       $(top_srcdir)/config/amanda/tape.m4 \
+       $(top_srcdir)/config/amanda/types.m4 \
+       $(top_srcdir)/config/amanda/userid.m4 \
+       $(top_srcdir)/config/amanda/version.m4 \
+       $(top_srcdir)/config/gnulib/alloca.m4 \
+       $(top_srcdir)/config/gnulib/arpa_inet_h.m4 \
+       $(top_srcdir)/config/gnulib/base64.m4 \
+       $(top_srcdir)/config/gnulib/eoverflow.m4 \
+       $(top_srcdir)/config/gnulib/extensions.m4 \
+       $(top_srcdir)/config/gnulib/float_h.m4 \
+       $(top_srcdir)/config/gnulib/fsusage.m4 \
+       $(top_srcdir)/config/gnulib/getaddrinfo.m4 \
+       $(top_srcdir)/config/gnulib/getopt.m4 \
+       $(top_srcdir)/config/gnulib/gettimeofday.m4 \
+       $(top_srcdir)/config/gnulib/gnulib-common.m4 \
+       $(top_srcdir)/config/gnulib/gnulib-comp.m4 \
+       $(top_srcdir)/config/gnulib/include_next.m4 \
+       $(top_srcdir)/config/gnulib/inet_ntop.m4 \
+       $(top_srcdir)/config/gnulib/intmax_t.m4 \
+       $(top_srcdir)/config/gnulib/lock.m4 \
+       $(top_srcdir)/config/gnulib/longlong.m4 \
+       $(top_srcdir)/config/gnulib/malloc.m4 \
+       $(top_srcdir)/config/gnulib/mkdtemp.m4 \
+       $(top_srcdir)/config/gnulib/netinet_in_h.m4 \
+       $(top_srcdir)/config/gnulib/onceonly_2_57.m4 \
+       $(top_srcdir)/config/gnulib/physmem.m4 \
+       $(top_srcdir)/config/gnulib/safe-read.m4 \
+       $(top_srcdir)/config/gnulib/safe-write.m4 \
+       $(top_srcdir)/config/gnulib/snprintf.m4 \
+       $(top_srcdir)/config/gnulib/socklen.m4 \
+       $(top_srcdir)/config/gnulib/sockpfaf.m4 \
+       $(top_srcdir)/config/gnulib/ssize_t.m4 \
+       $(top_srcdir)/config/gnulib/stdbool.m4 \
+       $(top_srcdir)/config/gnulib/stdint.m4 \
+       $(top_srcdir)/config/gnulib/stdio_h.m4 \
+       $(top_srcdir)/config/gnulib/stdlib_h.m4 \
+       $(top_srcdir)/config/gnulib/strdup.m4 \
+       $(top_srcdir)/config/gnulib/string_h.m4 \
+       $(top_srcdir)/config/gnulib/sys_socket_h.m4 \
+       $(top_srcdir)/config/gnulib/sys_stat_h.m4 \
+       $(top_srcdir)/config/gnulib/sys_time_h.m4 \
+       $(top_srcdir)/config/gnulib/tempname.m4 \
+       $(top_srcdir)/config/gnulib/unistd_h.m4 \
+       $(top_srcdir)/config/gnulib/vasnprintf.m4 \
+       $(top_srcdir)/config/gnulib/visibility.m4 \
+       $(top_srcdir)/config/gnulib/wchar.m4 \
+       $(top_srcdir)/config/gettext-macros/gettext.m4 \
+       $(top_srcdir)/config/gettext-macros/iconv.m4 \
+       $(top_srcdir)/config/gettext-macros/inttypes_h.m4 \
+       $(top_srcdir)/config/gettext-macros/lib-ld.m4 \
+       $(top_srcdir)/config/gettext-macros/lib-link.m4 \
+       $(top_srcdir)/config/gettext-macros/lib-prefix.m4 \
+       $(top_srcdir)/config/gettext-macros/nls.m4 \
+       $(top_srcdir)/config/gettext-macros/po.m4 \
+       $(top_srcdir)/config/gettext-macros/progtest.m4 \
+       $(top_srcdir)/config/gettext-macros/size_max.m4 \
+       $(top_srcdir)/config/gettext-macros/stdint_h.m4 \
+       $(top_srcdir)/config/gettext-macros/wchar_t.m4 \
+       $(top_srcdir)/config/gettext-macros/wint_t.m4 \
+       $(top_srcdir)/config/gettext-macros/xsize.m4 \
+       $(top_srcdir)/config/libtool.m4 $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config/config.h
+CONFIG_CLEAN_FILES =
+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|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(amlibdir)"
+amlibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(amlib_LTLIBRARIES)
+libamxfer_la_DEPENDENCIES = ../device-src/libamdevice.la \
+       ../common-src/libamanda.la
+am_libamxfer_la_OBJECTS = dest-device.lo dest-fd.lo dest-null.lo \
+       element-glue.lo filter-xor.lo source-device.lo \
+       source-random.lo source-fd.lo source-pattern.lo \
+       xfer-element.lo xfer.lo xmsg.lo
+libamxfer_la_OBJECTS = $(am_libamxfer_la_OBJECTS)
+am__EXEEXT_1 = xfer-test$(EXEEXT)
+PROGRAMS = $(noinst_PROGRAMS)
+am_xfer_test_OBJECTS = xfer-test.$(OBJEXT)
+xfer_test_OBJECTS = $(am_xfer_test_OBJECTS)
+xfer_test_DEPENDENCIES = ../common-src/libtestutils.la libamxfer.la
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/config
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+       --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+       $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+       --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+       $(LDFLAGS) -o $@
+SOURCES = $(libamxfer_la_SOURCES) $(xfer_test_SOURCES)
+DIST_SOURCES = $(libamxfer_la_SOURCES) $(xfer_test_SOURCES)
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AIX_BACKUP = @AIX_BACKUP@
+ALLOCA = @ALLOCA@
+ALLOCA_H = @ALLOCA_H@
+AMANDA_DBGDIR = @AMANDA_DBGDIR@
+AMANDA_DEBUG_DAYS = @AMANDA_DEBUG_DAYS@
+AMANDA_STATIC_LDFLAGS = @AMANDA_STATIC_LDFLAGS@
+AMANDA_TMPDIR = @AMANDA_TMPDIR@
+AMANDA_WARNING_CFLAGS = @AMANDA_WARNING_CFLAGS@
+AMLINT = @AMLINT@
+AMLINTFLAGS = @AMLINTFLAGS@
+AMPLOT_CAT_COMPRESS = @AMPLOT_CAT_COMPRESS@
+AMPLOT_CAT_GZIP = @AMPLOT_CAT_GZIP@
+AMPLOT_CAT_PACK = @AMPLOT_CAT_PACK@
+AMPLOT_COMPRESS = @AMPLOT_COMPRESS@
+AMTAR = @AMTAR@
+APPLICATION_DIR = @APPLICATION_DIR@
+AR = @AR@
+ARPA_INET_H = @ARPA_INET_H@
+ASSERTIONS = @ASSERTIONS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASH = @BASH@
+BINARY_OWNER = @BINARY_OWNER@
+BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@
+BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@
+BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@
+BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@
+BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@
+BSDTCP_SECURITY = @BSDTCP_SECURITY@
+BSDUDP_SECURITY = @BSDUDP_SECURITY@
+BSD_SECURITY = @BSD_SECURITY@
+CAT = @CAT@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CFLAG_VISIBILITY = @CFLAG_VISIBILITY@
+CHECK_USERID = @CHECK_USERID@
+CHIO = @CHIO@
+CHS = @CHS@
+CLIENT_HOST_INSTANCE = @CLIENT_HOST_INSTANCE@
+CLIENT_HOST_KEY_FILE = @CLIENT_HOST_KEY_FILE@
+CLIENT_HOST_PRINCIPAL = @CLIENT_HOST_PRINCIPAL@
+CLIENT_LOGIN = @CLIENT_LOGIN@
+CLIENT_SCRIPTS_OPT = @CLIENT_SCRIPTS_OPT@
+COMPRESS = @COMPRESS@
+COMPRESS_BEST_OPT = @COMPRESS_BEST_OPT@
+COMPRESS_FAST_OPT = @COMPRESS_FAST_OPT@
+COMPRESS_PATH = @COMPRESS_PATH@
+COMPRESS_SUFFIX = @COMPRESS_SUFFIX@
+CONFIG_CLOBBER_MY_CONFIG = @CONFIG_CLOBBER_MY_CONFIG@
+CONFIG_DIR = @CONFIG_DIR@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CURL_CONFIG = @CURL_CONFIG@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DD = @DD@
+DEFAULT_AMANDATES_FILE = @DEFAULT_AMANDATES_FILE@
+DEFAULT_CHANGER_DEVICE = @DEFAULT_CHANGER_DEVICE@
+DEFAULT_CONFIG = @DEFAULT_CONFIG@
+DEFAULT_MAILER = @DEFAULT_MAILER@
+DEFAULT_SERVER = @DEFAULT_SERVER@
+DEFAULT_TAPE_DEVICE = @DEFAULT_TAPE_DEVICE@
+DEFAULT_TAPE_SERVER = @DEFAULT_TAPE_SERVER@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DOC_BUILD_DATE = @DOC_BUILD_DATE@
+DUMP = @DUMP@
+DUMP_RETURNS_1 = @DUMP_RETURNS_1@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EOVERFLOW = @EOVERFLOW@
+EXAMPLE_TAPEDEV = @EXAMPLE_TAPEDEV@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FLOAT_H = @FLOAT_H@
+GETCONF = @GETCONF@
+GETOPT_H = @GETOPT_H@
+GETTEXT = @GETTEXT@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+GLIB_LIBS = @GLIB_LIBS@
+GLIB_MKENUMS = @GLIB_MKENUMS@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
+GNULIB_CHOWN = @GNULIB_CHOWN@
+GNULIB_DUP2 = @GNULIB_DUP2@
+GNULIB_ENVIRON = @GNULIB_ENVIRON@
+GNULIB_FCHDIR = @GNULIB_FCHDIR@
+GNULIB_FFLUSH = @GNULIB_FFLUSH@
+GNULIB_FOPEN = @GNULIB_FOPEN@
+GNULIB_FPRINTF_POSIX = @GNULIB_FPRINTF_POSIX@
+GNULIB_FREOPEN = @GNULIB_FREOPEN@
+GNULIB_FSEEK = @GNULIB_FSEEK@
+GNULIB_FSEEKO = @GNULIB_FSEEKO@
+GNULIB_FTELL = @GNULIB_FTELL@
+GNULIB_FTELLO = @GNULIB_FTELLO@
+GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@
+GNULIB_GETCWD = @GNULIB_GETCWD@
+GNULIB_GETDELIM = @GNULIB_GETDELIM@
+GNULIB_GETLINE = @GNULIB_GETLINE@
+GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
+GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@
+GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
+GNULIB_LCHOWN = @GNULIB_LCHOWN@
+GNULIB_LSEEK = @GNULIB_LSEEK@
+GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@
+GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@
+GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@
+GNULIB_MBSCHR = @GNULIB_MBSCHR@
+GNULIB_MBSCSPN = @GNULIB_MBSCSPN@
+GNULIB_MBSLEN = @GNULIB_MBSLEN@
+GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@
+GNULIB_MBSNLEN = @GNULIB_MBSNLEN@
+GNULIB_MBSPBRK = @GNULIB_MBSPBRK@
+GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@
+GNULIB_MBSRCHR = @GNULIB_MBSRCHR@
+GNULIB_MBSSEP = @GNULIB_MBSSEP@
+GNULIB_MBSSPN = @GNULIB_MBSSPN@
+GNULIB_MBSSTR = @GNULIB_MBSSTR@
+GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@
+GNULIB_MEMMEM = @GNULIB_MEMMEM@
+GNULIB_MEMPCPY = @GNULIB_MEMPCPY@
+GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
+GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
+GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
+GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
+GNULIB_PUTENV = @GNULIB_PUTENV@
+GNULIB_READLINK = @GNULIB_READLINK@
+GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@
+GNULIB_SETENV = @GNULIB_SETENV@
+GNULIB_SLEEP = @GNULIB_SLEEP@
+GNULIB_SNPRINTF = @GNULIB_SNPRINTF@
+GNULIB_SPRINTF_POSIX = @GNULIB_SPRINTF_POSIX@
+GNULIB_STPCPY = @GNULIB_STPCPY@
+GNULIB_STPNCPY = @GNULIB_STPNCPY@
+GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
+GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
+GNULIB_STRDUP = @GNULIB_STRDUP@
+GNULIB_STRERROR = @GNULIB_STRERROR@
+GNULIB_STRNDUP = @GNULIB_STRNDUP@
+GNULIB_STRNLEN = @GNULIB_STRNLEN@
+GNULIB_STRPBRK = @GNULIB_STRPBRK@
+GNULIB_STRSEP = @GNULIB_STRSEP@
+GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@
+GNULIB_STRSTR = @GNULIB_STRSTR@
+GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
+GNULIB_UNSETENV = @GNULIB_UNSETENV@
+GNULIB_VASPRINTF = @GNULIB_VASPRINTF@
+GNULIB_VFPRINTF_POSIX = @GNULIB_VFPRINTF_POSIX@
+GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
+GNULIB_VSNPRINTF = @GNULIB_VSNPRINTF@
+GNULIB_VSPRINTF_POSIX = @GNULIB_VSPRINTF_POSIX@
+GNULIB_WCWIDTH = @GNULIB_WCWIDTH@
+GNUPLOT = @GNUPLOT@
+GNUTAR = @GNUTAR@
+GNUTAR_LISTED_INCREMENTAL_DIR = @GNUTAR_LISTED_INCREMENTAL_DIR@
+GOBJECT_QUERY = @GOBJECT_QUERY@
+GREP = @GREP@
+GZIP = @GZIP@
+HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@
+HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@
+HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@
+HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@
+HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
+HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@
+HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
+HAVE_DECL_MKDIR = @HAVE_DECL_MKDIR@
+HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
+HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
+HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@
+HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
+HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
+HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@
+HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
+HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@
+HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
+HAVE_DUP2 = @HAVE_DUP2@
+HAVE_FSEEKO = @HAVE_FSEEKO@
+HAVE_FTELLO = @HAVE_FTELLO@
+HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
+HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
+HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
+HAVE_GZIP = @HAVE_GZIP@
+HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
+HAVE_IO_H = @HAVE_IO_H@
+HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
+HAVE_LSTAT = @HAVE_LSTAT@
+HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@
+HAVE_MEMPCPY = @HAVE_MEMPCPY@
+HAVE_MKDTEMP = @HAVE_MKDTEMP@
+HAVE_NETINET_IN_H = @HAVE_NETINET_IN_H@
+HAVE_OS_H = @HAVE_OS_H@
+HAVE_READLINK = @HAVE_READLINK@
+HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@
+HAVE_SETENV = @HAVE_SETENV@
+HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
+HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
+HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
+HAVE_SLEEP = @HAVE_SLEEP@
+HAVE_STDINT_H = @HAVE_STDINT_H@
+HAVE_STPCPY = @HAVE_STPCPY@
+HAVE_STPNCPY = @HAVE_STPNCPY@
+HAVE_STRCASESTR = @HAVE_STRCASESTR@
+HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
+HAVE_STRNDUP = @HAVE_STRNDUP@
+HAVE_STRPBRK = @HAVE_STRPBRK@
+HAVE_STRSEP = @HAVE_STRSEP@
+HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@
+HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
+HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
+HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
+HAVE_SYS_SOCKET_H = @HAVE_SYS_SOCKET_H@
+HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
+HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
+HAVE_UNISTD_H = @HAVE_UNISTD_H@
+HAVE_UNSETENV = @HAVE_UNSETENV@
+HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
+HAVE_VASPRINTF = @HAVE_VASPRINTF@
+HAVE_VISIBILITY = @HAVE_VISIBILITY@
+HAVE_WCHAR_H = @HAVE_WCHAR_H@
+HAVE_WINSOCK2_H = @HAVE_WINSOCK2_H@
+HAVE_WS2TCPIP_H = @HAVE_WS2TCPIP_H@
+HAVE__BOOL = @HAVE__BOOL@
+INCLUDE_NEXT = @INCLUDE_NEXT@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+KRB4_SECURITY = @KRB4_SECURITY@
+KRB5_SECURITY = @KRB5_SECURITY@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBCURL = @LIBCURL@
+LIBCURL_CPPFLAGS = @LIBCURL_CPPFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBMULTITHREAD = @LIBMULTITHREAD@
+LIBOBJS = @LIBOBJS@
+LIBPTH = @LIBPTH@
+LIBS = @LIBS@
+LIBTHREAD = @LIBTHREAD@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LN_S = @LN_S@
+LOCKING = @LOCKING@
+LOW_TCPPORTRANGE = @LOW_TCPPORTRANGE@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
+LTLIBOBJS = @LTLIBOBJS@
+LTLIBPTH = @LTLIBPTH@
+LTLIBTHREAD = @LTLIBTHREAD@
+MAILER = @MAILER@
+MAKEINFO = @MAKEINFO@
+MCUTIL = @MCUTIL@
+MKDIR_P = @MKDIR_P@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+MT = @MT@
+MTX = @MTX@
+MT_FILE_FLAG = @MT_FILE_FLAG@
+NETINET_IN_H = @NETINET_IN_H@
+NEXT_FLOAT_H = @NEXT_FLOAT_H@
+NEXT_NETINET_IN_H = @NEXT_NETINET_IN_H@
+NEXT_STDINT_H = @NEXT_STDINT_H@
+NEXT_STDIO_H = @NEXT_STDIO_H@
+NEXT_STDLIB_H = @NEXT_STDLIB_H@
+NEXT_STRING_H = @NEXT_STRING_H@
+NEXT_SYS_SOCKET_H = @NEXT_SYS_SOCKET_H@
+NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@
+NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@
+NEXT_UNISTD_H = @NEXT_UNISTD_H@
+NEXT_WCHAR_H = @NEXT_WCHAR_H@
+OBJEXT = @OBJEXT@
+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@
+PCAT = @PCAT@
+PERL = @PERL@
+PERLEXTLIBS = @PERLEXTLIBS@
+PERL_INC = @PERL_INC@
+PKG_CONFIG = @PKG_CONFIG@
+POSUB = @POSUB@
+PRINT = @PRINT@
+PS = @PS@
+PS_ARGUMENT = @PS_ARGUMENT@
+PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
+RANLIB = @RANLIB@
+READLINE_LIBS = @READLINE_LIBS@
+REPLACE_CHOWN = @REPLACE_CHOWN@
+REPLACE_FCHDIR = @REPLACE_FCHDIR@
+REPLACE_FFLUSH = @REPLACE_FFLUSH@
+REPLACE_FOPEN = @REPLACE_FOPEN@
+REPLACE_FPRINTF = @REPLACE_FPRINTF@
+REPLACE_FREOPEN = @REPLACE_FREOPEN@
+REPLACE_FSEEK = @REPLACE_FSEEK@
+REPLACE_FSEEKO = @REPLACE_FSEEKO@
+REPLACE_FTELL = @REPLACE_FTELL@
+REPLACE_FTELLO = @REPLACE_FTELLO@
+REPLACE_GETCWD = @REPLACE_GETCWD@
+REPLACE_GETLINE = @REPLACE_GETLINE@
+REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
+REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
+REPLACE_LCHOWN = @REPLACE_LCHOWN@
+REPLACE_LSEEK = @REPLACE_LSEEK@
+REPLACE_MEMMEM = @REPLACE_MEMMEM@
+REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
+REPLACE_PRINTF = @REPLACE_PRINTF@
+REPLACE_PUTENV = @REPLACE_PUTENV@
+REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
+REPLACE_SPRINTF = @REPLACE_SPRINTF@
+REPLACE_STRCASESTR = @REPLACE_STRCASESTR@
+REPLACE_STRERROR = @REPLACE_STRERROR@
+REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@
+REPLACE_STRSTR = @REPLACE_STRSTR@
+REPLACE_VASPRINTF = @REPLACE_VASPRINTF@
+REPLACE_VFPRINTF = @REPLACE_VFPRINTF@
+REPLACE_VPRINTF = @REPLACE_VPRINTF@
+REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@
+REPLACE_VSPRINTF = @REPLACE_VSPRINTF@
+REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
+RESTORE = @RESTORE@
+RSH_SECURITY = @RSH_SECURITY@
+SAMBA_CLIENT = @SAMBA_CLIENT@
+SERVER_HOST_INSTANCE = @SERVER_HOST_INSTANCE@
+SERVER_HOST_KEY_FILE = @SERVER_HOST_KEY_FILE@
+SERVER_HOST_PRINCIPAL = @SERVER_HOST_PRINCIPAL@
+SERVICE_SUFFIX = @SERVICE_SUFFIX@
+SETUID_GROUP = @SETUID_GROUP@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@
+SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
+SNAPSHOT_STAMP = @SNAPSHOT_STAMP@
+SORT = @SORT@
+SSH = @SSH@
+SSH_SECURITY = @SSH_SECURITY@
+STDBOOL_H = @STDBOOL_H@
+STDINT_H = @STDINT_H@
+STRIP = @STRIP@
+SVN = @SVN@
+SWIG = @SWIG@
+SWIG_LIB = @SWIG_LIB@
+SYS_SOCKET_H = @SYS_SOCKET_H@
+SYS_STAT_H = @SYS_STAT_H@
+SYS_TIME_H = @SYS_TIME_H@
+TCPPORTRANGE = @TCPPORTRANGE@
+TICKET_LIFETIME = @TICKET_LIFETIME@
+UDPPORTRANGE = @UDPPORTRANGE@
+UNCOMPRESS_OPT = @UNCOMPRESS_OPT@
+UNCOMPRESS_PATH = @UNCOMPRESS_PATH@
+USE_AMANDAHOSTS = @USE_AMANDAHOSTS@
+USE_NLS = @USE_NLS@
+USE_RUNDUMP = @USE_RUNDUMP@
+USE_VERSION_SUFFIXES = @USE_VERSION_SUFFIXES@
+VDUMP = @VDUMP@
+VERSION = @VERSION@
+VERSION_COMMENT = @VERSION_COMMENT@
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MINOR = @VERSION_MINOR@
+VERSION_PATCH = @VERSION_PATCH@
+VERSION_SUFFIX = @VERSION_SUFFIX@
+VOID_UNSETENV = @VOID_UNSETENV@
+VRESTORE = @VRESTORE@
+VXDUMP = @VXDUMP@
+VXRESTORE = @VXRESTORE@
+WCHAR_H = @WCHAR_H@
+WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@
+WINT_T_SUFFIX = @WINT_T_SUFFIX@
+XFSDUMP = @XFSDUMP@
+XFSRESTORE = @XFSRESTORE@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+XSLREL = @XSLREL@
+XSLTPROC = @XSLTPROC@
+XSLTPROC_FLAGS = @XSLTPROC_FLAGS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+_libcurl_config = @_libcurl_config@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+amdatadir = @amdatadir@
+amincludedir = @amincludedir@
+amlibdir = @amlibdir@
+amlibexecdir = @amlibexecdir@
+amperldir = @amperldir@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+gl_LIBOBJS = @gl_LIBOBJS@
+gl_LTLIBOBJS = @gl_LTLIBOBJS@
+gltests_LIBOBJS = @gltests_LIBOBJS@
+gltests_LTLIBOBJS = @gltests_LTLIBOBJS@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+SUFFIXES = 
+EXTRA_DIST = 
+BUILT_SOURCES = 
+MOSTLYCLEANFILES = 
+
+# config.status leaves config.log files around
+CLEANFILES = config.log
+
+# and we'll need to clean up our generated files for distclean
+DISTCLEANFILES = $(SCRIPTS_SHELL) $(SCRIPTS_PERL) $(SCRIPTS_AWK) \
+       $(SCRIPTS_INCLUDE) $(am__append_1)
+MAINTAINERCLEANFILES = 
+
+# syntax-check shell scripts on 'make check'
+CHECK_SHELL = $(SCRIPTS_SHELL)
+
+# sed expression to strip leading directories from a filename; this converts e.g.,
+# src/foo/bar.so to bar.so.
+strip_leading_dirs = s|^.*/||
+@WANT_INSTALLPERMS_FALSE@do_file = pa="$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
+@WANT_INSTALLPERMS_FALSE@    echo "installperm \"$$chown\" \"$$chmod\" \"$$pa\"" >> "$(installperms_sh)"
+
+
+# define a snippet of the scripts below to either perform a chown/chmod operation,
+# or record that operation in the logfile.  On entry to the snippet, $$dest is the
+# destination directory, $$cmd is the srcdir-relative pathname of the target file,
+# $$chown is the ownership, and $$chmod is the permission pattern.
+@WANT_INSTALLPERMS_TRUE@do_file = pa="$(DESTDIR)$$dest"/`echo "$$cmd"|sed '$(strip_leading_dirs)'|sed '$(transform)'`; \
+@WANT_INSTALLPERMS_TRUE@    if test -n "$$chown"; then \
+@WANT_INSTALLPERMS_TRUE@       echo chown "$$chown" "$$pa"; \
+@WANT_INSTALLPERMS_TRUE@       chown "$$chown" "$$pa" || exit 1; \
+@WANT_INSTALLPERMS_TRUE@    fi; \
+@WANT_INSTALLPERMS_TRUE@    if test -n "$$chmod"; then \
+@WANT_INSTALLPERMS_TRUE@       echo chmod "$$chmod" "$$pa"; \
+@WANT_INSTALLPERMS_TRUE@       chmod "$$chmod" "$$pa" || exit 1; \
+@WANT_INSTALLPERMS_TRUE@    fi 
+
+@WANT_INSTALLPERMS_FALSE@installperms_sh = "$(top_builddir)/installperms.sh"
+INCLUDES = -I$(top_srcdir)/gnulib \
+               -I$(top_srcdir)/device-src \
+               -I$(top_srcdir)/common-src
+
+AM_CFLAGS = $(AMANDA_WARNING_CFLAGS)
+AM_LDFLAGS = $(AMANDA_STATIC_LDFLAGS)
+amlib_LTLIBRARIES = libamxfer.la
+LINT = $(AMLINT)
+LINTFLAGS = $(AMLINTFLAGS)
+libamxfer_la_SOURCES = \
+       dest-device.c \
+       dest-fd.c \
+       dest-null.c \
+       element-glue.c \
+       filter-xor.c \
+       source-device.c \
+       source-random.c \
+       source-fd.c \
+       source-pattern.c \
+       xfer-element.c \
+       xfer.c \
+       xmsg.c
+
+libamxfer_la_LIBADD = \
+       ../device-src/libamdevice.la \
+       ../common-src/libamanda.la
+
+noinst_HEADERS = \
+       amxfer.h \
+       element-glue.h \
+       xfer-element.h \
+       xfer.h \
+       xmsg.h
+
+xfer_test_SOURCES = xfer-test.c
+xfer_test_LDADD = \
+       ../common-src/libtestutils.la \
+       libamxfer.la
+
+all: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(top_srcdir)/config/automake/vars.am $(top_srcdir)/config/automake/scripts.am $(top_srcdir)/config/automake/installperms.am $(top_srcdir)/config/automake/precompile.am $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  xfer-src/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  xfer-src/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-amlibLTLIBRARIES: $(amlib_LTLIBRARIES)
+       @$(NORMAL_INSTALL)
+       test -z "$(amlibdir)" || $(MKDIR_P) "$(DESTDIR)$(amlibdir)"
+       @list='$(amlib_LTLIBRARIES)'; for p in $$list; do \
+         if test -f $$p; then \
+           f=$(am__strip_dir) \
+           echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(amlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(amlibdir)/$$f'"; \
+           $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(amlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(amlibdir)/$$f"; \
+         else :; fi; \
+       done
+
+uninstall-amlibLTLIBRARIES:
+       @$(NORMAL_UNINSTALL)
+       @list='$(amlib_LTLIBRARIES)'; for p in $$list; do \
+         p=$(am__strip_dir) \
+         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(amlibdir)/$$p'"; \
+         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(amlibdir)/$$p"; \
+       done
+
+clean-amlibLTLIBRARIES:
+       -test -z "$(amlib_LTLIBRARIES)" || rm -f $(amlib_LTLIBRARIES)
+       @list='$(amlib_LTLIBRARIES)'; for p in $$list; do \
+         dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+         test "$$dir" != "$$p" || dir=.; \
+         echo "rm -f \"$${dir}/so_locations\""; \
+         rm -f "$${dir}/so_locations"; \
+       done
+libamxfer.la: $(libamxfer_la_OBJECTS) $(libamxfer_la_DEPENDENCIES) 
+       $(LINK) -rpath $(amlibdir) $(libamxfer_la_OBJECTS) $(libamxfer_la_LIBADD) $(LIBS)
+
+clean-noinstPROGRAMS:
+       @list='$(noinst_PROGRAMS)'; for p in $$list; do \
+         f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+         echo " rm -f $$p $$f"; \
+         rm -f $$p $$f ; \
+       done
+xfer-test$(EXEEXT): $(xfer_test_OBJECTS) $(xfer_test_DEPENDENCIES) 
+       @rm -f xfer-test$(EXEEXT)
+       $(LINK) $(xfer_test_OBJECTS) $(xfer_test_LDADD) $(LIBS)
+
+mostlyclean-compile:
+       -rm -f *.$(OBJEXT)
+
+distclean-compile:
+       -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dest-device.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dest-fd.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dest-null.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/element-glue.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter-xor.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/source-device.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/source-fd.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/source-pattern.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/source-random.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfer-element.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfer-test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xfer.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmsg.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@   $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@   mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@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@   $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@   mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@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) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@   $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@   mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+       -rm -f *.lo
+
+clean-libtool:
+       -rm -rf .libs _libs
+
+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; nonemtpy = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       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; nonempty = 1; } \
+             END { if (nonempty) { 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:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       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; nonempty = 1; } \
+             END { if (nonempty) { 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
+
+check-TESTS: $(TESTS)
+       @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[        ]'; \
+       srcdir=$(srcdir); export srcdir; \
+       list=' $(TESTS) '; \
+       if test -n "$$list"; then \
+         for tst in $$list; do \
+           if test -f ./$$tst; then dir=./; \
+           elif test -f $$tst; then dir=; \
+           else dir="$(srcdir)/"; fi; \
+           if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+             all=`expr $$all + 1`; \
+             case " $(XFAIL_TESTS) " in \
+             *$$ws$$tst$$ws*) \
+               xpass=`expr $$xpass + 1`; \
+               failed=`expr $$failed + 1`; \
+               echo "XPASS: $$tst"; \
+             ;; \
+             *) \
+               echo "PASS: $$tst"; \
+             ;; \
+             esac; \
+           elif test $$? -ne 77; then \
+             all=`expr $$all + 1`; \
+             case " $(XFAIL_TESTS) " in \
+             *$$ws$$tst$$ws*) \
+               xfail=`expr $$xfail + 1`; \
+               echo "XFAIL: $$tst"; \
+             ;; \
+             *) \
+               failed=`expr $$failed + 1`; \
+               echo "FAIL: $$tst"; \
+             ;; \
+             esac; \
+           else \
+             skip=`expr $$skip + 1`; \
+             echo "SKIP: $$tst"; \
+           fi; \
+         done; \
+         if test "$$failed" -eq 0; then \
+           if test "$$xfail" -eq 0; then \
+             banner="All $$all tests passed"; \
+           else \
+             banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
+           fi; \
+         else \
+           if test "$$xpass" -eq 0; then \
+             banner="$$failed of $$all tests failed"; \
+           else \
+             banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
+           fi; \
+         fi; \
+         dashes="$$banner"; \
+         skipped=""; \
+         if test "$$skip" -ne 0; then \
+           skipped="($$skip tests were not run)"; \
+           test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+             dashes="$$skipped"; \
+         fi; \
+         report=""; \
+         if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+           report="Please report to $(PACKAGE_BUGREPORT)"; \
+           test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+             dashes="$$report"; \
+         fi; \
+         dashes=`echo "$$dashes" | sed s/./=/g`; \
+         echo "$$dashes"; \
+         echo "$$banner"; \
+         test -z "$$skipped" || echo "$$skipped"; \
+         test -z "$$report" || echo "$$report"; \
+         echo "$$dashes"; \
+         test "$$failed" -eq 0; \
+       else :; fi
+
+distdir: $(DISTFILES)
+       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       list='$(DISTFILES)'; \
+         dist_files=`for file in $$list; do echo $$file; done | \
+         sed -e "s|^$$srcdirstrip/||;t" \
+             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+       case $$dist_files in \
+         */*) $(MKDIR_P) `echo "$$dist_files" | \
+                          sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+                          sort -u` ;; \
+       esac; \
+       for file in $$dist_files; do \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         if test -d $$d/$$file; then \
+           dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+           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
+       $(MAKE) $(AM_MAKEFLAGS) \
+         top_distdir="$(top_distdir)" distdir="$(distdir)" \
+         dist-hook
+check-am: all-am
+       $(MAKE) $(AM_MAKEFLAGS) check-TESTS check-local
+check: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS)
+installdirs:
+       for dir in "$(DESTDIR)$(amlibdir)"; do \
+         test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+       done
+install: $(BUILT_SOURCES)
+       $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+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:
+       -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+
+clean-generic:
+       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+       -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+       -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+       -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+clean: clean-am
+
+clean-am: clean-amlibLTLIBRARIES clean-generic clean-libtool \
+       clean-noinstPROGRAMS mostlyclean-am
+
+distclean: distclean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+       distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-amlibLTLIBRARIES
+       @$(NORMAL_INSTALL)
+       $(MAKE) $(AM_MAKEFLAGS) install-data-hook
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+       @$(NORMAL_INSTALL)
+       $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am: installcheck-local
+
+maintainer-clean: maintainer-clean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+       mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-amlibLTLIBRARIES
+
+.MAKE: install-am install-data-am install-exec-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am check-local \
+       clean clean-amlibLTLIBRARIES clean-generic clean-libtool \
+       clean-noinstPROGRAMS ctags dist-hook distclean \
+       distclean-compile distclean-generic distclean-libtool \
+       distclean-tags distdir dvi dvi-am html html-am info info-am \
+       install install-am install-amlibLTLIBRARIES install-data \
+       install-data-am install-data-hook install-dvi install-dvi-am \
+       install-exec install-exec-am install-exec-hook install-html \
+       install-html-am install-info install-info-am install-man \
+       install-pdf install-pdf-am install-ps install-ps-am \
+       install-strip installcheck installcheck-am installcheck-local \
+       installdirs maintainer-clean maintainer-clean-generic \
+       mostlyclean mostlyclean-compile mostlyclean-generic \
+       mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+       uninstall-am uninstall-amlibLTLIBRARIES
+
+
+# Perl
+%: %.pl $(top_builddir)/config.status
+       $(top_builddir)/config.status --file=$@:$<
+       chmod a+x $@
+       @if test -f $(top_builddir)/perl/.libs/libCmdline.so -o -f $(top_builddir)/perl/libCmdline.so; then \
+               grep -v '^use lib' $@ > $@.nouselib; \
+               $(PERL) $(CHECK_PERL_FLAGS) -I$(top_builddir)/perl -I$(top_builddir)/perl/.libs -I$(top_srcdir)/perl -c -w -T $@.nouselib || exit 1; \
+               rm $@.nouselib; \
+       fi
+
+%.pl: %.pl.in $(top_builddir)/config.status
+       $(top_builddir)/config.status --file=$@:$<
+
+%.pm: %.pm.in $(top_builddir)/config.status
+       $(top_builddir)/config.status --file=$@:$<
+
+# Shell
+%: %.sh $(top_builddir)/config.status
+       $(top_builddir)/config.status --file=$@:$<
+       chmod a+x $@
+
+%.sh: %.sh.in $(top_builddir)/config.status
+       $(top_builddir)/config.status --file=$@:$<
+
+# Awk
+%: %.awk $(top_builddir)/config.status
+       $(top_builddir)/config.status --file=$@:$<
+       chmod a+x $@
+
+%.awk: %.awk.in $(top_builddir)/config.status
+       $(top_builddir)/config.status --file=$@:$<
+
+# syntax-check perl scripts on 'make check'
+check-perl: $(CHECK_PERL)
+       @CHECK_PERL="$(CHECK_PERL)"; \
+       if test -f $(top_builddir)/perl/.libs/libCmdline.so -o -f $(top_builddir)/perl/libCmdline.so; then \
+               if test -n "$(PERL)"; then \
+                       for perlobj in $$CHECK_PERL; do \
+                               grep -v '^use lib' $$perlobj > $$perlobj.nouselib; \
+                               $(PERL) $(CHECK_PERL_FLAGS) -I$(top_builddir)/perl -I$(top_builddir)/perl/.libs -I$(top_srcdir)/perl -c -w -T $$perlobj.nouselib || exit 1; \
+                               rm $$perlobj.nouselib; \
+                       done; \
+               fi \
+       fi
+check-local: check-perl
+
+# syntax-check perl scripts on 'make installcheck'
+installcheck-perl: $(CHECK_PERL)
+       @CHECK_PERL="$(CHECK_PERL)"; \
+       if test -n "$(PERL)"; then \
+               for perlobj in $$CHECK_PERL; do \
+                       $(PERL) $(CHECK_PERL_FLAGS) -c -w -T $$perlobj || exit 1; \
+               done; \
+       fi
+installcheck-local: installcheck-perl
+check-shell: $(CHECK_SHELL)
+       @CHECK_SHELL="$(CHECK_SHELL)"; \
+       if test -n "$$CHECK_SHELL"; then \
+               if test -n "$(BASH)"; then \
+                       for shobj in $$CHECK_SHELL; do \
+                               if $(BASH) -n $$shobj; then \
+                                       echo "$$shobj syntax OK"; \
+                               else \
+                                       echo "$$shobj syntax error"; \
+                                       exit 1; \
+                               fi; \
+                       done; \
+               else \
+                       echo "No 'bash' available -- cannot syntax-check shell scripts"; \
+               fi; \
+       fi
+check-local: check-shell
+
+# make sure that the sources for all shell and perl scripts get included
+# in the distribution
+dist-scripts:
+       SCRIPTS_PERL="$(SCRIPTS_PERL)"; SCRIPTS_SHELL="$(SCRIPTS_SHELL)"; SCRIPTS_AWK="$(SCRIPTS_AWK)"; \
+       for script in $$SCRIPTS_PERL; do \
+               test -f $(srcdir)/$${script}.pl && { cp -p $(srcdir)/$${script}.pl $(distdir)/ || exit 1; } \
+       done; \
+       for script in $$SCRIPTS_SHELL; do \
+               test -f $(srcdir)/$${script}.sh && { cp -p $(srcdir)/$${script}.sh $(distdir)/ || exit 1; } \
+       done; \
+       for script in $$SCRIPTS_AWK; do \
+               test -f $(srcdir)/$${script}.awk && { cp -p $(srcdir)/$${script}.awk $(distdir)/ || exit 1; } \
+       done; \
+       for script in $$SCRIPTS_SHELL $$SCRIPTS_PERL $$SCRIPTS_AWK; do \
+               test -f $(srcdir)/$${script}.in && { cp -p $(srcdir)/$${script}.in $(distdir)/ || exit 1; } \
+       done; \
+       true
+dist-hook: dist-scripts
+
+installperms-exec:
+       @installperms="$(INSTALLPERMS_exec)"; \
+       test -n "$$installperms" && echo "Setting installation permissions on executables"; \
+       dest=; chown=; chmod=; \
+       for cmd in $$installperms; do \
+           case "$$cmd" in \
+               chown=amanda) \
+                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
+               dest=*|chown=*|chmod=*) \
+                       echo "  ($$cmd)"; eval $$cmd;; \
+               *) $(do_file) ;; \
+           esac; \
+       done
+
+installperms-data:
+       @installperms="$(INSTALLPERMS_data)"; \
+       dest=; chown=; chmod=; \
+       for cmd in $$installperms; do \
+           case "$$cmd" in \
+               chown=amanda) \
+                       echo "  ($$cmd)"; chown="$(BINARY_OWNER):$(SETUID_GROUP)";; \
+               dest=*|chown=*|chmod=*) \
+                       echo "  ($$cmd)"; eval $$cmd;; \
+               *)  $(do_file) ;; \
+           esac; \
+       done
+
+install-exec-hook: installperms-exec
+install-data-hook: installperms-data
+
+# define a rule to initialize the installperms manifest file
+@WANT_INSTALLPERMS_TRUE@installperms-init:
+@WANT_INSTALLPERMS_FALSE@installperms-init:
+@WANT_INSTALLPERMS_FALSE@      rm -f "$(installperms_sh)"
+
+# A rule to make precompiler output from C files.  This is not used during
+# ordinary builds, but but can very useful in debugging problems on strange
+# architectures.  With this rule, we can ask users to 'make foo.i' and send
+# the result to us.
+#
+# It touches some automake internals ($COMPILE), but since it's not
+# build-critical, that's OK.
+%.i : %.c
+       $(COMPILE) -E -o $@ $<
+
+# lint support
+
+lint:
+       @echo $(LINT) $(libamxfer_la_SOURCES)
+       @$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(DEFS) -I. -I$(top_builddir)/config $(INCLUDES) $(libamxfer_la_SOURCES)
+       @echo $(LINT) $(genversion_SOURCES)
+       @$(LINT) $(LINTFLAGS) $(CPPFLAGS) $(DEFS) -I. -I$(top_builddir)/config $(INCLUDES) $(genversion_SOURCES)
+
+listlibsrc:
+       @ for p in $(libamxfer_la_SOURCES); do  \
+               listlibsrcs="$$listlibsrcs `pwd`/$$p";          \
+       done;                                                   \
+       echo $$listlibsrcs >listlibsrc.output
+# 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/xfer-src/amxfer.h b/xfer-src/amxfer.h
new file mode 100644 (file)
index 0000000..6f829c7
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2008 Zmanda, Inc.  All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License version 2.1 as
+ * published by the Free Software Foundation.
+ *
+ * This 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 this library; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+ *
+ * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
+ * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ */
+
+/* Public header file for libamxfer */
+
+#ifndef AMXFER_H
+#define AMXFER_H
+
+#include "xfer.h"
+#include "xfer-element.h"
+#include "xmsg.h"
+
+#endif /* AMXFER_H */
diff --git a/xfer-src/dest-device.c b/xfer-src/dest-device.c
new file mode 100644 (file)
index 0000000..385fb76
--- /dev/null
@@ -0,0 +1,235 @@
+/*
+ * Amanda, The Advanced Maryland Automatic Network Disk Archiver
+ * Copyright (c) 2008 Zmanda Inc.
+ *
+ * This 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.
+ *
+ * This 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 this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "amxfer.h"
+#include "amanda.h"
+#include "queueing.h"
+#include "device-queueing.h"
+
+/*
+ * Class declaration
+ *
+ * This declaration is entirely private; nothing but xfer_dest_device() references
+ * it directly.
+ */
+
+GType xfer_dest_device_get_type(void);
+#define XFER_DEST_DEVICE_TYPE (xfer_dest_device_get_type())
+#define XFER_DEST_DEVICE(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_dest_device_get_type(), XferDestDevice)
+#define XFER_DEST_DEVICE_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_dest_device_get_type(), XferDestDevice const)
+#define XFER_DEST_DEVICE_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), xfer_dest_device_get_type(), XferDestDeviceClass)
+#define IS_XFER_DEST_DEVICE(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), xfer_dest_device_get_type ())
+#define XFER_DEST_DEVICE_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS((obj), xfer_dest_device_get_type(), XferDestDeviceClass)
+
+static GObjectClass *parent_class = NULL;
+
+/*
+ * Main object structure
+ */
+
+typedef struct XferDestDevice {
+    XferElement __parent__;
+
+    Device *device;
+    size_t max_memory;
+
+    GThread *thread;
+} XferDestDevice;
+
+/*
+ * Class definition
+ */
+
+typedef struct {
+    XferElementClass __parent__;
+} XferDestDeviceClass;
+
+/*
+ * Implementation
+ */
+
+static producer_result_t
+pull_buffer_producer(gpointer data,
+    queue_buffer_t *buffer,
+    size_t hint_size G_GNUC_UNUSED)
+{
+    XferDestDevice *self = (XferDestDevice *)data;
+    XferElement *elt = XFER_ELEMENT(self);
+    gpointer buf;
+    size_t size;
+
+    if (elt->cancelled) {
+       /* drain our upstream only if we're expecting an EOF */
+       if (elt->expect_eof) {
+           xfer_element_drain_by_pulling(XFER_ELEMENT(self)->upstream);
+       }
+
+       return PRODUCER_FINISHED;
+    }
+
+    buf = xfer_element_pull_buffer(XFER_ELEMENT(self)->upstream, &size);
+    if (!buf) {
+       return PRODUCER_FINISHED;
+    }
+
+    /* queueing recycles allocated buffers back to us, but we don't need them.. */
+    amfree(buffer->data);
+    buffer->data = buf;
+    buffer->alloc_size = buffer->data_size = size;
+    buffer->offset = 0;
+
+    return PRODUCER_MORE;
+}
+
+static gpointer
+queueing_thread(
+    gpointer data)
+{
+    XferDestDevice *self = (XferDestDevice *)data;
+    XferElement *elt = (XferElement *)self;
+    queue_result_flags result;
+    GValue val;
+    StreamingRequirement streaming_mode;
+    size_t block_size;
+    size_t max_memory;
+
+    /* Get the device's parameters */
+    bzero(&val, sizeof(val));
+    if (!device_property_get(self->device, PROPERTY_STREAMING, &val)
+       || !G_VALUE_HOLDS(&val, STREAMING_REQUIREMENT_TYPE)) {
+       g_warning("XferDestDevice Couldn't get streaming type for %s", self->device->device_name);
+       streaming_mode = STREAMING_REQUIREMENT_REQUIRED;
+    } else {
+       streaming_mode = g_value_get_enum(&val);
+    }
+
+    block_size = self->device->block_size;
+
+    max_memory = self->max_memory || DEFAULT_MAX_BUFFER_MEMORY;
+
+    /* this thread creates two other threads (consumer and producer) and
+     * blocks waiting for them to finish.  TODO: when taper no longer uses
+     * queueing, merge the queueing functionality here */
+    result =
+        do_consumer_producer_queue_full(pull_buffer_producer, data,
+                                        device_write_consumer, self->device,
+                                        block_size, max_memory,
+                                        streaming_mode);
+
+    /* finish the file explicitly */
+    if (!(self->device->status & DEVICE_STATUS_DEVICE_ERROR))
+       device_finish_file(self->device);
+
+    if (result != QUEUE_SUCCESS) {
+       /* note that our producer never returns an error */
+
+       if ((result & QUEUE_CONSUMER_ERROR)
+               && (self->device->status != DEVICE_STATUS_SUCCESS)) {
+           xfer_element_handle_error(elt, "%s: %s",
+                   self->device->device_name, device_error_or_status(self->device));
+       } else {
+           xfer_element_handle_error(elt, _("%s: internal error"),
+                   xfer_element_repr(elt));
+       }
+
+       /* and drain our upstream, since the queueing loop is done */
+       if (elt->expect_eof)
+           xfer_element_drain_by_pulling(elt->upstream);
+    }
+
+    xfer_queue_message(XFER_ELEMENT(self)->xfer, xmsg_new(XFER_ELEMENT(self), XMSG_DONE, 0));
+
+    return NULL;
+}
+
+static gboolean
+start_impl(
+    XferElement *elt)
+{
+    XferDestDevice *self = (XferDestDevice *)elt;
+    self->thread = g_thread_create(queueing_thread, (gpointer)self, FALSE, NULL);
+    return TRUE;
+}
+
+static void
+instance_init(
+    XferElement *elt)
+{
+    elt->can_generate_eof = TRUE;
+}
+
+static void
+class_init(
+    XferDestDeviceClass * selfc)
+{
+    XferElementClass *klass = XFER_ELEMENT_CLASS(selfc);
+    static xfer_element_mech_pair_t mech_pairs[] = {
+       { XFER_MECH_PULL_BUFFER, XFER_MECH_NONE, 0, 0},
+       { XFER_MECH_NONE, XFER_MECH_NONE, 0, 0},
+    };
+
+    klass->start = start_impl;
+
+    klass->perl_class = "Amanda::Xfer::Dest::Device";
+    klass->mech_pairs = mech_pairs;
+
+    parent_class = g_type_class_peek_parent(selfc);
+}
+
+GType
+xfer_dest_device_get_type (void)
+{
+    static GType type = 0;
+
+    if G_UNLIKELY(type == 0) {
+        static const GTypeInfo info = {
+            sizeof (XferDestDeviceClass),
+            (GBaseInitFunc) NULL,
+            (GBaseFinalizeFunc) NULL,
+            (GClassInitFunc) class_init,
+            (GClassFinalizeFunc) NULL,
+            NULL /* class_data */,
+            sizeof (XferDestDevice),
+            0 /* n_preallocs */,
+            (GInstanceInitFunc) instance_init,
+            NULL
+        };
+
+        type = g_type_register_static (XFER_ELEMENT_TYPE, "XferDestDevice", &info, 0);
+    }
+
+    return type;
+}
+
+/* create an element of this class; prototype is in xfer-element.h */
+XferElement *
+xfer_dest_device(
+    Device *device,
+    size_t max_memory)
+{
+    XferDestDevice *self = (XferDestDevice *)g_object_new(XFER_DEST_DEVICE_TYPE, NULL);
+    XferElement *elt = XFER_ELEMENT(self);
+
+    g_assert(device != NULL);
+
+    self->device = device;
+    self->max_memory = max_memory;
+
+    return elt;
+}
diff --git a/xfer-src/dest-fd.c b/xfer-src/dest-fd.c
new file mode 100644 (file)
index 0000000..797e0d4
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+ * Amanda, The Advanced Maryland Automatic Network Disk Archiver
+ * Copyright (c) 2008 Zmanda Inc.
+ *
+ * This 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.
+ *
+ * This 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 this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "amxfer.h"
+#include "amanda.h"
+
+/*
+ * Class declaration
+ *
+ * This declaration is entirely private; nothing but xfer_dest_fd() references
+ * it directly.
+ */
+
+GType xfer_dest_fd_get_type(void);
+#define XFER_DEST_FD_TYPE (xfer_dest_fd_get_type())
+#define XFER_DEST_FD(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_dest_fd_get_type(), XferDestFd)
+#define XFER_DEST_FD_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_dest_fd_get_type(), XferDestFd const)
+#define XFER_DEST_FD_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), xfer_dest_fd_get_type(), XferDestFdClass)
+#define IS_XFER_DEST_FD(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), xfer_dest_fd_get_type ())
+#define XFER_DEST_FD_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS((obj), xfer_dest_fd_get_type(), XferDestFdClass)
+
+static GObjectClass *parent_class = NULL;
+
+/*
+ * Main object structure
+ */
+
+typedef struct XferDestFd {
+    XferElement __parent__;
+} XferDestFd;
+
+/*
+ * Class definition
+ */
+
+typedef struct {
+    XferElementClass __parent__;
+} XferDestFdClass;
+
+/*
+ * Implementation
+ */
+
+static void
+class_init(
+    XferDestFdClass * selfc)
+{
+    XferElementClass *klass = XFER_ELEMENT_CLASS(selfc);
+    static xfer_element_mech_pair_t mech_pairs[] = {
+       { XFER_MECH_WRITEFD, XFER_MECH_NONE, 0, 0},
+       { XFER_MECH_NONE, XFER_MECH_NONE, 0, 0},
+    };
+
+    klass->perl_class = "Amanda::Xfer::Dest::Fd";
+    klass->mech_pairs = mech_pairs;
+
+    parent_class = g_type_class_peek_parent(selfc);
+}
+
+GType
+xfer_dest_fd_get_type (void)
+{
+    static GType type = 0;
+
+    if G_UNLIKELY(type == 0) {
+        static const GTypeInfo info = {
+            sizeof (XferDestFdClass),
+            (GBaseInitFunc) NULL,
+            (GBaseFinalizeFunc) NULL,
+            (GClassInitFunc) class_init,
+            (GClassFinalizeFunc) NULL,
+            NULL /* class_data */,
+            sizeof (XferDestFd),
+            0 /* n_preallocs */,
+            (GInstanceInitFunc) NULL,
+            NULL
+        };
+
+        type = g_type_register_static (XFER_ELEMENT_TYPE, "XferDestFd", &info, 0);
+    }
+
+    return type;
+}
+
+/* create an element of this class; prototype is in xfer-element.h */
+XferElement *
+xfer_dest_fd(
+    int fd)
+{
+    XferDestFd *self = (XferDestFd *)g_object_new(XFER_DEST_FD_TYPE, NULL);
+    XferElement *elt = XFER_ELEMENT(self);
+
+    g_assert(fd >= 0);
+
+    /* We keep a *copy* of this fd, because our caller will close it to indicate
+     * EOF */
+    elt->input_fd = dup(fd);
+
+    return elt;
+}
diff --git a/xfer-src/dest-null.c b/xfer-src/dest-null.c
new file mode 100644 (file)
index 0000000..5167ceb
--- /dev/null
@@ -0,0 +1,158 @@
+/*
+ * Amanda, The Advanced Maryland Automatic Network Disk Archiver
+ * Copyright (c) 2008 Zmanda Inc.
+ *
+ * This 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.
+ *
+ * This 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 this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "amxfer.h"
+#include "amanda.h"
+#include "simpleprng.h"
+
+/*
+ * Class declaration
+ *
+ * This declaration is entirely private; nothing but xfer_dest_null() references
+ * it directly.
+ */
+
+GType xfer_dest_null_get_type(void);
+#define XFER_DEST_NULL_TYPE (xfer_dest_null_get_type())
+#define XFER_DEST_NULL(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_dest_null_get_type(), XferDestNull)
+#define XFER_DEST_NULL_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_dest_null_get_type(), XferDestNull const)
+#define XFER_DEST_NULL_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), xfer_dest_null_get_type(), XferDestNullClass)
+#define IS_XFER_DEST_NULL(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), xfer_dest_null_get_type ())
+#define XFER_DEST_NULL_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS((obj), xfer_dest_null_get_type(), XferDestNullClass)
+
+static GObjectClass *parent_class = NULL;
+
+/*
+ * Main object structure
+ */
+
+typedef struct XferDestNull {
+    XferElement __parent__;
+
+    gboolean sent_info;
+
+    gboolean do_verify;
+    simpleprng_state_t prng;
+} XferDestNull;
+
+/*
+ * Class definition
+ */
+
+typedef struct {
+    XferElementClass __parent__;
+} XferDestNullClass;
+
+/*
+ * Implementation
+ */
+
+static void
+push_buffer_impl(
+    XferElement *elt,
+    gpointer buf,
+    size_t len)
+{
+    XferDestNull *self = (XferDestNull *)elt;
+
+    if (!buf)
+       return;
+
+    if (self->do_verify && !elt->cancelled) {
+       if (!simpleprng_verify_buffer(&self->prng, buf, len)) {
+           xfer_element_handle_error(elt,
+               _("verification of incoming bytestream failed"));
+           amfree(buf);
+           return;
+       }
+    }
+
+    if (!self->sent_info) {
+       /* send a superfluous message (this is a testing XferElement,
+        * after all) */
+       XMsg *msg = xmsg_new((XferElement *)self, XMSG_INFO, 0);
+       msg->message = stralloc("Is this thing on?");
+       xfer_queue_message(XFER_ELEMENT(self)->xfer, msg);
+       self->sent_info = TRUE;
+    }
+
+    amfree(buf);
+}
+
+static void
+class_init(
+    XferDestNullClass * selfc)
+{
+    XferElementClass *klass = XFER_ELEMENT_CLASS(selfc);
+    static xfer_element_mech_pair_t mech_pairs[] = {
+       { XFER_MECH_PUSH_BUFFER, XFER_MECH_NONE, 0, 0},
+       { XFER_MECH_NONE, XFER_MECH_NONE, 0, 0},
+    };
+
+    klass->push_buffer = push_buffer_impl;
+
+    klass->perl_class = "Amanda::Xfer::Dest::Null";
+    klass->mech_pairs = mech_pairs;
+
+    parent_class = g_type_class_peek_parent(selfc);
+}
+
+GType
+xfer_dest_null_get_type (void)
+{
+    static GType type = 0;
+
+    if G_UNLIKELY(type == 0) {
+        static const GTypeInfo info = {
+            sizeof (XferDestNullClass),
+            (GBaseInitFunc) NULL,
+            (GBaseFinalizeFunc) NULL,
+            (GClassInitFunc) class_init,
+            (GClassFinalizeFunc) NULL,
+            NULL /* class_data */,
+            sizeof (XferDestNull),
+            0 /* n_preallocs */,
+            (GInstanceInitFunc) NULL,
+            NULL
+        };
+
+        type = g_type_register_static (XFER_ELEMENT_TYPE, "XferDestNull", &info, 0);
+    }
+
+    return type;
+}
+
+/* create an element of this class; prototype is in xfer-element.h */
+XferElement *
+xfer_dest_null(
+    guint32 prng_seed)
+{
+    XferDestNull *self = (XferDestNull *)g_object_new(XFER_DEST_NULL_TYPE, NULL);
+    XferElement *elt = XFER_ELEMENT(self);
+
+    if (prng_seed) {
+       self->do_verify = TRUE;
+       simpleprng_seed(&self->prng, prng_seed);
+    } else {
+       g_assert(0);
+       self->do_verify = FALSE;
+    }
+
+    return elt;
+}
diff --git a/xfer-src/element-glue.c b/xfer-src/element-glue.c
new file mode 100644 (file)
index 0000000..75c7177
--- /dev/null
@@ -0,0 +1,626 @@
+/*
+ * Amanda, The Advanced Maryland Automatic Network Disk Archiver
+ * Copyright (c) 2008 Zmanda Inc.
+ *
+ * This 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.
+ *
+ * This 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 this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "amxfer.h"
+#include "element-glue.h"
+#include "amanda.h"
+
+static GObjectClass *parent_class = NULL;
+
+/*
+ * Utility functions, etc.
+ */
+
+static void
+make_pipe(
+    XferElementGlue *self)
+{
+    if (pipe(self->pipe) < 0)
+       g_critical(_("Could not create pipe: %s"), strerror(errno));
+}
+
+static void
+send_xfer_done(
+    XferElementGlue *self)
+{
+    xfer_queue_message(XFER_ELEMENT(self)->xfer,
+           xmsg_new((XferElement *)self, XMSG_DONE, 0));
+}
+
+#define GLUE_BUFFER_SIZE 32768
+#define GLUE_RING_BUFFER_SIZE 32
+
+/*
+ * Worker threads
+ *
+ * At most one of these runs in a given instance, as selected in setup_impl
+ */
+
+static gpointer
+call_and_write_thread(
+    gpointer data)
+{
+    XferElement *elt = XFER_ELEMENT(data);
+    XferElementGlue *self = XFER_ELEMENT_GLUE(data);
+    int *fdp = (self->pipe[1] == -1)? &elt->downstream->input_fd : &self->pipe[1];
+    int fd = *fdp;
+
+    while (!elt->cancelled) {
+       size_t len;
+       char *buf;
+
+       /* get a buffer from upstream */
+       buf = xfer_element_pull_buffer(elt->upstream, &len);
+       if (!buf)
+           break;
+
+       /* write it */
+       if (full_write(fd, buf, len) < len) {
+           xfer_element_handle_error(elt,
+               _("Error writing to fd %d: %s"), fd, strerror(errno));
+           amfree(buf);
+           break;
+       }
+
+       amfree(buf);
+    }
+
+    if (elt->cancelled && elt->expect_eof)
+       xfer_element_drain_by_pulling(elt->upstream);
+
+    /* close the fd we've been writing, as an EOF signal to downstream, and
+     * set it to -1 to avoid accidental re-use */
+    close(fd);
+    *fdp = -1;
+
+    send_xfer_done(self);
+
+    return NULL;
+}
+
+static gpointer
+read_and_write_thread(
+    gpointer data)
+{
+    XferElement *elt = XFER_ELEMENT(data);
+    XferElementGlue *self = XFER_ELEMENT_GLUE(data);
+    int rfd = elt->upstream->output_fd;
+    int wfd = elt->downstream->input_fd;
+
+    /* dynamically allocate a buffer, in case this thread has
+     * a limited amount of stack allocated */
+    char *buf = g_malloc(GLUE_BUFFER_SIZE);
+
+    while (!elt->cancelled) {
+       size_t len;
+
+       /* read from upstream */
+       len = full_read(rfd, buf, GLUE_BUFFER_SIZE);
+       if (len < GLUE_BUFFER_SIZE) {
+           if (errno) {
+               xfer_element_handle_error(elt,
+                   _("Error reading from fd %d: %s"), rfd, strerror(errno));
+               break;
+           } else if (len == 0) { /* we only count a zero-length read as EOF */
+               break;
+           }
+       }
+
+       /* write the buffer fully */
+       if (full_write(wfd, buf, len) < len) {
+           xfer_element_handle_error(elt,
+               _("Could not write to fd %d: %s"), wfd, strerror(errno));
+           break;
+       }
+    }
+
+    if (elt->cancelled && elt->expect_eof)
+       xfer_element_drain_by_pulling(elt->upstream);
+
+    /* close the read fd, if it's at EOF, and set it to -1 to avoid accidental
+     * re-use */
+    if (!elt->cancelled || elt->expect_eof) {
+       close(rfd);
+       elt->upstream->output_fd = -1;
+    }
+
+    /* close the fd we've been writing, as an EOF signal to downstream, and
+     * set it to -1 to avoid accidental re-use */
+    close(wfd);
+    elt->downstream->input_fd = -1;
+
+    send_xfer_done(self);
+
+    amfree(buf);
+    return NULL;
+}
+
+static gpointer
+read_and_call_thread(
+    gpointer data)
+{
+    XferElement *elt = XFER_ELEMENT(data);
+    XferElementGlue *self = XFER_ELEMENT_GLUE(data);
+    int *fdp = (self->pipe[0] == -1)? &elt->upstream->output_fd : &self->pipe[0];
+    int fd = *fdp;
+
+    while (!elt->cancelled) {
+       char *buf = g_malloc(GLUE_BUFFER_SIZE);
+       size_t len;
+
+       /* read a buffer from upstream */
+       len = full_read(fd, buf, GLUE_BUFFER_SIZE);
+       if (len < GLUE_BUFFER_SIZE) {
+           if (errno) {
+               xfer_element_handle_error(elt,
+                   _("Error reading from fd %d: %s"), fd, strerror(errno));
+               break;
+           } else if (len == 0) { /* we only count a zero-length read as EOF */
+               amfree(buf);
+               break;
+           }
+       }
+
+       xfer_element_push_buffer(elt->downstream, buf, len);
+    }
+
+    if (elt->cancelled && elt->expect_eof)
+       xfer_element_drain_by_reading(fd);
+
+    /* send an EOF indication downstream */
+    xfer_element_push_buffer(elt->downstream, NULL, 0);
+
+    /* close the read fd, since it's at EOF, and set it to -1 to avoid accidental
+     * re-use */
+    close(fd);
+    *fdp = -1;
+
+    send_xfer_done(self);
+
+    return NULL;
+}
+
+static gpointer
+call_and_call_thread(
+    gpointer data)
+{
+    XferElement *elt = XFER_ELEMENT(data);
+    XferElementGlue *self = XFER_ELEMENT_GLUE(data);
+    gboolean eof_sent = FALSE;
+
+    /* TODO: consider breaking this into two cooperating threads: one to pull
+     * buffers from upstream and one to push them downstream.  This would gain
+     * parallelism at the cost of a lot of synchronization operations. */
+
+    while (!elt->cancelled) {
+       char *buf;
+       size_t len;
+
+       /* get a buffer from upstream */
+       buf = xfer_element_pull_buffer(elt->upstream, &len);
+
+       /* and push it downstream */
+       xfer_element_push_buffer(elt->downstream, buf, len);
+
+       if (!buf) {
+           eof_sent = TRUE;
+           break;
+       }
+    }
+
+    if (elt->cancelled && elt->expect_eof)
+       xfer_element_drain_by_pulling(elt->upstream);
+
+    if (!eof_sent)
+       xfer_element_push_buffer(elt->downstream, NULL, 0);
+
+    send_xfer_done(self);
+
+    return NULL;
+}
+
+/*
+ * Implementation
+ */
+
+static void
+setup_impl(
+    XferElement *elt)
+{
+    XferElementGlue *self = (XferElementGlue *)elt;
+
+    switch (elt->input_mech) {
+    case XFER_MECH_READFD:
+       switch (elt->output_mech) {
+       case XFER_MECH_READFD:
+           g_assert_not_reached(); /* no glue needed */
+           break;
+
+       case XFER_MECH_WRITEFD:
+           self->threadfunc = read_and_write_thread;
+           break;
+
+       case XFER_MECH_PUSH_BUFFER:
+           self->threadfunc = read_and_call_thread;
+           break;
+
+       case XFER_MECH_PULL_BUFFER:
+           break;
+
+       case XFER_MECH_NONE:
+           g_assert_not_reached();
+           break;
+       }
+       break;
+
+    case XFER_MECH_WRITEFD:
+       make_pipe(self);
+       elt->input_fd = self->pipe[1];
+       self->pipe[1] = -1; /* upstream will close this for us */
+
+       switch (elt->output_mech) {
+       case XFER_MECH_READFD:
+           elt->output_fd = self->pipe[0];
+           self->pipe[0] = -1; /* downstream will close this for us */
+           break;
+
+       case XFER_MECH_WRITEFD:
+           g_assert_not_reached(); /* no glue needed */
+           break;
+
+       case XFER_MECH_PUSH_BUFFER:
+           self->threadfunc = read_and_call_thread;
+           break;
+
+       case XFER_MECH_PULL_BUFFER:
+           break;
+
+       case XFER_MECH_NONE:
+           g_assert_not_reached();
+           break;
+       }
+       break;
+
+    case XFER_MECH_PUSH_BUFFER:
+       switch (elt->output_mech) {
+       case XFER_MECH_READFD:
+           make_pipe(self);
+           elt->output_fd = self->pipe[0];
+           self->pipe[0] = -1; /* downstream will close this for us */
+           break;
+
+       case XFER_MECH_WRITEFD:
+           break;
+
+       case XFER_MECH_PUSH_BUFFER:
+           g_assert_not_reached(); /* no glue needed */
+           break;
+
+       case XFER_MECH_PULL_BUFFER:
+           self->ring = g_malloc(sizeof(*self->ring) * GLUE_RING_BUFFER_SIZE);
+           self->ring_used_sem = semaphore_new_with_value(0);
+           self->ring_free_sem = semaphore_new_with_value(GLUE_RING_BUFFER_SIZE);
+           break;
+
+       case XFER_MECH_NONE:
+           g_assert_not_reached();
+           break;
+       }
+       break;
+
+    case XFER_MECH_PULL_BUFFER:
+       switch (elt->output_mech) {
+       case XFER_MECH_READFD:
+           make_pipe(self);
+           elt->output_fd = self->pipe[0];
+           self->pipe[0] = -1; /* downstream will close this for us */
+           self->threadfunc = call_and_write_thread;
+           break;
+
+       case XFER_MECH_WRITEFD:
+           self->threadfunc = call_and_write_thread;
+           break;
+
+       case XFER_MECH_PUSH_BUFFER:
+           self->threadfunc = call_and_call_thread;
+           break;
+
+       case XFER_MECH_PULL_BUFFER:
+           g_assert_not_reached(); /* no glue needed */
+           break;
+
+       case XFER_MECH_NONE:
+           g_assert_not_reached();
+           break;
+       }
+       break;
+
+    case XFER_MECH_NONE:
+       g_assert_not_reached();
+       break;
+    }
+}
+
+static gboolean
+start_impl(
+    XferElement *elt)
+{
+    XferElementGlue *self = (XferElementGlue *)elt;
+
+    if (self->threadfunc) {
+       self->thread = g_thread_create(self->threadfunc, (gpointer)self, FALSE, NULL);
+    }
+
+    /* we're active if we have a thread that will eventually die */
+    return self->threadfunc? TRUE : FALSE;
+}
+
+static gpointer
+pull_buffer_impl(
+    XferElement *elt,
+    size_t *size)
+{
+    XferElementGlue *self = XFER_ELEMENT_GLUE(elt);
+
+    if (self->ring) {
+       gpointer buf;
+
+       if (elt->cancelled) {
+           /* The finalize method will empty the ring buffer */
+           *size = 0;
+           return NULL;
+       }
+
+       /* make sure there's at least one element available */
+       semaphore_down(self->ring_used_sem);
+
+       /* get it */
+       buf = self->ring[self->ring_tail].buf;
+       *size = self->ring[self->ring_tail].size;
+       self->ring_tail = (self->ring_tail + 1) % GLUE_RING_BUFFER_SIZE;
+
+       /* and mark this element as free to be overwritten */
+       semaphore_up(self->ring_free_sem);
+
+       return buf;
+    } else {
+       int *fdp = (self->pipe[0] == -1)? &elt->upstream->output_fd : &self->pipe[0];
+       int fd = *fdp;
+       char *buf = g_malloc(GLUE_BUFFER_SIZE);
+       ssize_t len;
+
+       if (elt->cancelled) {
+           if (elt->expect_eof)
+               xfer_element_drain_by_reading(fd);
+
+           close(fd);
+           *fdp = -1;
+
+           *size = 0;
+           return NULL;
+       }
+
+       /* read from upstream */
+       len = full_read(fd, buf, GLUE_BUFFER_SIZE);
+       if (len < GLUE_BUFFER_SIZE) {
+           if (errno) {
+               xfer_element_handle_error(elt,
+                   _("Error reading from fd %d: %s"), fd, strerror(errno));
+
+               /* return an EOF */
+               amfree(buf);
+               len = 0;
+
+               /* and finish off the upstream */
+               if (elt->expect_eof) {
+                   xfer_element_drain_by_reading(fd);
+               }
+               close(fd);
+               *fdp = -1;
+           } else if (len == 0) {
+               /* EOF */
+               g_free(buf);
+               buf = NULL;
+               *size = 0;
+
+               /* signal EOF to downstream */
+               close(fd);
+               *fdp = -1;
+           }
+       }
+
+       *size = (size_t)len;
+       return buf;
+    }
+}
+
+static void
+push_buffer_impl(
+    XferElement *elt,
+    gpointer buf,
+    size_t len)
+{
+    XferElementGlue *self = (XferElementGlue *)elt;
+
+    if (self->ring) {
+       /* just drop packets if the transfer has been cancelled */
+       if (elt->cancelled) {
+           amfree(buf);
+           return;
+       }
+
+       /* make sure there's at least one element free */
+       semaphore_down(self->ring_free_sem);
+
+       /* set it */
+       self->ring[self->ring_head].buf = buf;
+       self->ring[self->ring_head].size = len;
+       self->ring_head = (self->ring_head + 1) % GLUE_RING_BUFFER_SIZE;
+
+       /* and mark this element as available for reading */
+       semaphore_up(self->ring_used_sem);
+
+       return;
+    } else {
+       int *fdp = (self->pipe[1] == -1)? &elt->downstream->input_fd : &self->pipe[1];
+       int fd = *fdp;
+
+       if (elt->cancelled) {
+           if (!elt->expect_eof || !buf) {
+               close(fd);
+               *fdp = -1;
+
+               /* hack to ensure we won't close the fd again, if we get another push */
+               elt->expect_eof = TRUE;
+           }
+
+           amfree(buf);
+
+           return;
+       }
+
+       /* write the full buffer to the fd, or close on EOF */
+       if (buf) {
+           if (full_write(fd, buf, len) < len) {
+               xfer_element_handle_error(elt,
+                   _("Error writing to fd %d: %s"), fd, strerror(errno));
+               /* nothing special to do to handle the cancellation */
+           }
+           amfree(buf);
+       } else {
+           close(fd);
+           *fdp = -1;
+       }
+
+       return;
+    }
+}
+
+static void
+instance_init(
+    XferElementGlue *self)
+{
+    XferElement *elt = (XferElement *)self;
+    elt->can_generate_eof = TRUE;
+    self->pipe[0] = self->pipe[1] = -1;
+}
+
+static void
+finalize_impl(
+    GObject * obj_self)
+{
+    XferElementGlue *self = XFER_ELEMENT_GLUE(obj_self);
+
+    /* close our pipes if they're still open (they shouldn't be!) */
+    if (self->pipe[0] != -1) close(self->pipe[0]);
+    if (self->pipe[1] != -1) close(self->pipe[1]);
+
+    if (self->ring) {
+       /* empty the ring buffer, ignoring syncronization issues */
+       while (self->ring_used_sem->value) {
+           if (self->ring[self->ring_tail].buf)
+               amfree(self->ring[self->ring_tail].buf);
+           self->ring_tail = (self->ring_tail + 1) % GLUE_RING_BUFFER_SIZE;
+       }
+
+       amfree(self->ring);
+       semaphore_free(self->ring_used_sem);
+       semaphore_free(self->ring_free_sem);
+    }
+
+    /* chain up */
+    G_OBJECT_CLASS(parent_class)->finalize(obj_self);
+}
+
+static xfer_element_mech_pair_t _pairs[] = {
+    { XFER_MECH_READFD, XFER_MECH_WRITEFD, 2, 1 }, /* splice or copy */
+    { XFER_MECH_READFD, XFER_MECH_PUSH_BUFFER, 1, 1 }, /* read and call */
+    { XFER_MECH_READFD, XFER_MECH_PULL_BUFFER, 1, 0 }, /* read on demand */
+
+    { XFER_MECH_WRITEFD, XFER_MECH_READFD, 0, 0 }, /* pipe */
+    { XFER_MECH_WRITEFD, XFER_MECH_PUSH_BUFFER, 1, 1 }, /* pipe + read and call*/
+    { XFER_MECH_WRITEFD, XFER_MECH_PULL_BUFFER, 1, 0 }, /* pipe + read on demand */
+
+    { XFER_MECH_PUSH_BUFFER, XFER_MECH_READFD, 1, 0 }, /* write on demand + pipe */
+    { XFER_MECH_PUSH_BUFFER, XFER_MECH_WRITEFD, 1, 0 }, /* write on demand */
+    { XFER_MECH_PUSH_BUFFER, XFER_MECH_PULL_BUFFER, 0, 0 }, /* async queue */
+
+    { XFER_MECH_PULL_BUFFER, XFER_MECH_READFD, 1, 1 }, /* call and write + pipe */
+    { XFER_MECH_PULL_BUFFER, XFER_MECH_WRITEFD, 1, 1 }, /* call and write */
+    { XFER_MECH_PULL_BUFFER, XFER_MECH_PUSH_BUFFER, 0, 1 }, /* call and call */
+
+    /* terminator */
+    { XFER_MECH_NONE, XFER_MECH_NONE, 0, 0},
+};
+xfer_element_mech_pair_t *xfer_element_glue_mech_pairs = _pairs;
+
+static void
+class_init(
+    XferElementGlueClass * selfc)
+{
+    XferElementClass *klass = XFER_ELEMENT_CLASS(selfc);
+    GObjectClass *goc = G_OBJECT_CLASS(selfc);
+
+    klass->setup = setup_impl;
+    klass->start = start_impl;
+    klass->push_buffer = push_buffer_impl;
+    klass->pull_buffer = pull_buffer_impl;
+
+    klass->perl_class = "Amanda::Xfer::Element::Glue";
+    klass->mech_pairs = xfer_element_glue_mech_pairs;
+
+    goc->finalize = finalize_impl;
+
+    parent_class = g_type_class_peek_parent(selfc);
+}
+
+GType
+xfer_element_glue_get_type (void)
+{
+    static GType type = 0;
+
+    if G_UNLIKELY(type == 0) {
+        static const GTypeInfo info = {
+            sizeof (XferElementGlueClass),
+            (GBaseInitFunc) NULL,
+            (GBaseFinalizeFunc) NULL,
+            (GClassInitFunc) class_init,
+            (GClassFinalizeFunc) NULL,
+            NULL /* class_data */,
+            sizeof (XferElementGlue),
+            0 /* n_preallocs */,
+            (GInstanceInitFunc) instance_init,
+            NULL
+        };
+
+        type = g_type_register_static (XFER_ELEMENT_TYPE, "XferElementGlue", &info, 0);
+    }
+
+    return type;
+}
+
+/* create an element of this class; prototype is in xfer-element.h */
+XferElement *
+xfer_element_glue(void)
+{
+    XferElementGlue *self = (XferElementGlue *)g_object_new(XFER_ELEMENT_GLUE_TYPE, NULL);
+    XferElement *elt = XFER_ELEMENT(self);
+
+    return elt;
+}
diff --git a/xfer-src/element-glue.h b/xfer-src/element-glue.h
new file mode 100644 (file)
index 0000000..fcd5479
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Amanda, The Advanced Maryland Automatic Network Disk Archiver
+ * Copyright (c) 2008 Zmanda Inc.
+ *
+ * This 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.
+ *
+ * This 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 this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef ELEMENT_GLUE_H
+#define ELEMENT_GLUE_H
+
+#include <glib.h>
+#include <glib-object.h>
+#include "xfer-element.h"
+#include "semaphore.h"
+
+/*
+ * Class declaration
+ */
+
+GType xfer_element_glue_get_type(void);
+#define XFER_ELEMENT_GLUE_TYPE (xfer_element_glue_get_type())
+#define XFER_ELEMENT_GLUE(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_element_glue_get_type(), XferElementGlue)
+#define XFER_ELEMENT_GLUE_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_element_glue_get_type(), XferElementGlue const)
+#define XFER_ELEMENT_GLUE_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), xfer_element_glue_get_type(), XferElementGlueClass)
+#define IS_XFER_ELEMENT_GLUE(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), xfer_element_glue_get_type ())
+#define XFER_ELEMENT_GLUE_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS((obj), xfer_element_glue_get_type(), XferElementGlueClass)
+
+/*
+ * Main object structure
+ */
+
+typedef struct XferElementGlue {
+    XferElement __parent__;
+
+    /* the stuff we might use, depending on what flavor of glue we're
+     * providing.. */
+    int pipe[2];
+
+    /* for push/pull, a ring buffer of ptr/size pairs */
+    struct { gpointer buf; size_t size; } *ring;
+    semaphore_t *ring_used_sem, *ring_free_sem;
+    gint ring_head, ring_tail;
+
+    GThread *thread;
+    GThreadFunc threadfunc;
+} XferElementGlue;
+
+/*
+ * Class definition
+ */
+
+typedef struct {
+    XferElementClass __parent__;
+} XferElementGlueClass;
+
+/* Constructor */
+
+XferElement * xfer_element_glue(void);
+
+/* the mech pairs supported by this object */
+
+extern xfer_element_mech_pair_t *xfer_element_glue_mech_pairs;
+
+#endif
diff --git a/xfer-src/filter-xor.c b/xfer-src/filter-xor.c
new file mode 100644 (file)
index 0000000..613b972
--- /dev/null
@@ -0,0 +1,191 @@
+/*
+ * Amanda, The Advanced Maryland Automatic Network Disk Archiver
+ * Copyright (c) 2008 Zmanda Inc.
+ *
+ * This 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.
+ *
+ * This 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 this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "amxfer.h"
+#include "amanda.h"
+
+/*
+ * Class declaration
+ *
+ * This declaration is entirely private; nothing but xfer_filter_xor() references
+ * it directly.
+ */
+
+GType xfer_filter_xor_get_type(void);
+#define XFER_FILTER_XOR_TYPE (xfer_filter_xor_get_type())
+#define XFER_FILTER_XOR(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_filter_xor_get_type(), XferFilterXor)
+#define XFER_FILTER_XOR_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_filter_xor_get_type(), XferFilterXor const)
+#define XFER_FILTER_XOR_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), xfer_filter_xor_get_type(), XferFilterXorClass)
+#define IS_XFER_FILTER_XOR(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), xfer_filter_xor_get_type ())
+#define XFER_FILTER_XOR_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS((obj), xfer_filter_xor_get_type(), XferFilterXorClass)
+
+static GObjectClass *parent_class = NULL;
+
+/*
+ * Main object structure
+ */
+
+typedef struct XferFilterXor {
+    XferElement __parent__;
+
+    char xor_key;
+} XferFilterXor;
+
+/*
+ * Class definition
+ */
+
+typedef struct {
+    XferElementClass __parent__;
+} XferFilterXorClass;
+
+
+/*
+ * Utilities
+ */
+
+static void
+apply_xor(
+    char *buf,
+    size_t len,
+    char xor_key)
+{
+    size_t i;
+
+    /* Apply XOR.  This is a pretty sophisticated encryption algorithm! */
+    for (i = 0; i < len; i++) {
+       buf[i] ^= xor_key;
+    }
+}
+
+/*
+ * Implementation
+ */
+
+static gpointer
+pull_buffer_impl(
+    XferElement *elt,
+    size_t *size)
+{
+    XferFilterXor *self = (XferFilterXor *)elt;
+    char *buf;
+
+    if (elt->cancelled) {
+       /* drain our upstream only if we're expecting an EOF */
+       if (elt->expect_eof) {
+           xfer_element_drain_by_pulling(XFER_ELEMENT(self)->upstream);
+       }
+
+       /* return an EOF */
+       *size = 0;
+       return NULL;
+    }
+
+    /* get a buffer from upstream, xor it, and hand it back */
+    buf = xfer_element_pull_buffer(XFER_ELEMENT(self)->upstream, size);
+    if (buf)
+       apply_xor(buf, *size, self->xor_key);
+    return buf;
+}
+
+static void
+push_buffer_impl(
+    XferElement *elt,
+    gpointer buf,
+    size_t len)
+{
+    XferFilterXor *self = (XferFilterXor *)elt;
+
+    /* drop the buffer if we've been cancelled */
+    if (elt->cancelled) {
+       amfree(buf);
+       return;
+    }
+
+    /* xor the given buffer and pass it downstream */
+    if (buf)
+       apply_xor(buf, len, self->xor_key);
+
+    xfer_element_push_buffer(XFER_ELEMENT(self)->downstream, buf, len);
+}
+
+static void
+instance_init(
+    XferElement *elt)
+{
+    elt->can_generate_eof = TRUE;
+}
+
+static void
+class_init(
+    XferFilterXorClass * selfc)
+{
+    XferElementClass *klass = XFER_ELEMENT_CLASS(selfc);
+    static xfer_element_mech_pair_t mech_pairs[] = {
+       { XFER_MECH_PULL_BUFFER, XFER_MECH_PULL_BUFFER, 1, 0},
+       { XFER_MECH_PUSH_BUFFER, XFER_MECH_PUSH_BUFFER, 1, 0},
+       { XFER_MECH_NONE, XFER_MECH_NONE, 0, 0},
+    };
+
+    klass->push_buffer = push_buffer_impl;
+    klass->pull_buffer = pull_buffer_impl;
+
+    klass->perl_class = "Amanda::Xfer::Filter::Xor";
+    klass->mech_pairs = mech_pairs;
+
+    parent_class = g_type_class_peek_parent(selfc);
+}
+
+GType
+xfer_filter_xor_get_type (void)
+{
+    static GType type = 0;
+
+    if G_UNLIKELY(type == 0) {
+        static const GTypeInfo info = {
+            sizeof (XferFilterXorClass),
+            (GBaseInitFunc) NULL,
+            (GBaseFinalizeFunc) NULL,
+            (GClassInitFunc) class_init,
+            (GClassFinalizeFunc) NULL,
+            NULL /* class_data */,
+            sizeof (XferFilterXor),
+            0 /* n_preallocs */,
+            (GInstanceInitFunc) instance_init,
+            NULL
+        };
+
+        type = g_type_register_static (XFER_ELEMENT_TYPE, "XferFilterXor", &info, 0);
+    }
+
+    return type;
+}
+
+/* create an element of this class; prototype is in xfer-element.h */
+XferElement *
+xfer_filter_xor(
+    unsigned char xor_key)
+{
+    XferFilterXor *xfx = (XferFilterXor *)g_object_new(XFER_FILTER_XOR_TYPE, NULL);
+    XferElement *elt = XFER_ELEMENT(xfx);
+
+    xfx->xor_key = xor_key;
+
+    return elt;
+}
diff --git a/xfer-src/source-device.c b/xfer-src/source-device.c
new file mode 100644 (file)
index 0000000..da73d97
--- /dev/null
@@ -0,0 +1,179 @@
+/*
+ * Amanda, The Advanced Maryland Automatic Network Disk Archiver
+ * Copyright (c) 2008 Zmanda Inc.
+ *
+ * This 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.
+ *
+ * This 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 this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "amxfer.h"
+#include "amanda.h"
+#include "device.h"
+
+/*
+ * Class declaration
+ *
+ * This declaration is entirely private; nothing but xfer_source_device() references
+ * it directly.
+ */
+
+GType xfer_source_device_get_type(void);
+#define XFER_SOURCE_DEVICE_TYPE (xfer_source_device_get_type())
+#define XFER_SOURCE_DEVICE(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_source_device_get_type(), XferSourceDevice)
+#define XFER_SOURCE_DEVICE_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_source_device_get_type(), XferSourceDevice const)
+#define XFER_SOURCE_DEVICE_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), xfer_source_device_get_type(), XferSourceDeviceClass)
+#define IS_XFER_SOURCE_DEVICE(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), xfer_source_device_get_type ())
+#define XFER_SOURCE_DEVICE_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS((obj), xfer_source_device_get_type(), XferSourceDeviceClass)
+
+static GObjectClass *parent_class = NULL;
+
+/*
+ * Main object structure
+ */
+
+typedef struct XferSourceDevice {
+    XferElement __parent__;
+
+    Device *device;
+    size_t block_size;
+    gboolean cancelled;
+} XferSourceDevice;
+
+/*
+ * Class definition
+ */
+
+typedef struct {
+    XferElementClass __parent__;
+} XferSourceDeviceClass;
+
+/*
+ * Implementation
+ */
+
+static gpointer
+pull_buffer_impl(
+    XferElement *elt,
+    size_t *size)
+{
+    XferSourceDevice *self = (XferSourceDevice *)elt;
+    gpointer buf;
+    int result;
+    int devsize;
+
+    /* indicate EOF on an cancel */
+    if (elt->cancelled) {
+       *size = 0;
+       return NULL;
+    }
+
+    /* get the device block size */
+    if (self->block_size == 0) {
+       self->block_size = self->device->block_size;
+    }
+
+    do {
+       buf = g_malloc(self->block_size);
+       devsize = (int)self->block_size;
+       result = device_read_block(self->device, buf, &devsize);
+       *size = devsize;
+
+       /* if the buffer was too small, loop around again */
+       if (result == 0) {
+           g_assert(*size > self->block_size);
+           self->block_size = devsize;
+           amfree(buf);
+       }
+    } while (result == 0);
+
+    if (result < 0) {
+       /* if we're not at EOF, it's an error */
+       if (!self->device->is_eof) {
+           xfer_element_handle_error(elt,
+               _("error reading from %s: %s"),
+               self->device->device_name,
+               device_error_or_status(self->device));
+       }
+
+       *size = 0;
+       return NULL;
+    }
+
+    return buf;
+}
+
+static void
+instance_init(
+    XferElement *elt)
+{
+    elt->can_generate_eof = TRUE;
+}
+
+static void
+class_init(
+    XferSourceDeviceClass * selfc)
+{
+    XferElementClass *klass = XFER_ELEMENT_CLASS(selfc);
+    static xfer_element_mech_pair_t mech_pairs[] = {
+       { XFER_MECH_NONE, XFER_MECH_PULL_BUFFER, 0, 1},
+       { XFER_MECH_NONE, XFER_MECH_NONE, 0, 0},
+    };
+
+    klass->pull_buffer = pull_buffer_impl;
+
+    klass->perl_class = "Amanda::Xfer::Source::Device";
+    klass->mech_pairs = mech_pairs;
+
+    parent_class = g_type_class_peek_parent(selfc);
+}
+
+GType
+xfer_source_device_get_type (void)
+{
+    static GType type = 0;
+
+    if G_UNLIKELY(type == 0) {
+        static const GTypeInfo info = {
+            sizeof (XferSourceDeviceClass),
+            (GBaseInitFunc) NULL,
+            (GBaseFinalizeFunc) NULL,
+            (GClassInitFunc) class_init,
+            (GClassFinalizeFunc) NULL,
+            NULL /* class_data */,
+            sizeof (XferSourceDevice),
+            0 /* n_preallocs */,
+            (GInstanceInitFunc) instance_init,
+            NULL
+        };
+
+        type = g_type_register_static (XFER_ELEMENT_TYPE, "XferSourceDevice", &info, 0);
+    }
+
+    return type;
+}
+
+/* create an element of this class; prototype is in xfer-element.h */
+XferElement *
+xfer_source_device(
+    Device *device)
+{
+    XferSourceDevice *self = (XferSourceDevice *)g_object_new(XFER_SOURCE_DEVICE_TYPE, NULL);
+    XferElement *elt = XFER_ELEMENT(self);
+
+    g_assert(device != NULL);
+
+    self->device = device;
+
+    return elt;
+}
diff --git a/xfer-src/source-fd.c b/xfer-src/source-fd.c
new file mode 100644 (file)
index 0000000..b1f9562
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+ * Amanda, The Advanced Maryland Automatic Network Disk Archiver
+ * Copyright (c) 2008 Zmanda Inc.
+ *
+ * This 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.
+ *
+ * This 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 this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "amxfer.h"
+#include "amanda.h"
+
+/*
+ * Class declaration
+ *
+ * This declaration is entirely private; nothing but xfer_source_fd() references
+ * it directly.
+ */
+
+GType xfer_source_fd_get_type(void);
+#define XFER_SOURCE_FD_TYPE (xfer_source_fd_get_type())
+#define XFER_SOURCE_FD(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_source_fd_get_type(), XferSourceFd)
+#define XFER_SOURCE_FD_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_source_fd_get_type(), XferSourceFd const)
+#define XFER_SOURCE_FD_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), xfer_source_fd_get_type(), XferSourceFdClass)
+#define IS_XFER_SOURCE_FD(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), xfer_source_fd_get_type ())
+#define XFER_SOURCE_FD_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS((obj), xfer_source_fd_get_type(), XferSourceFdClass)
+
+static GObjectClass *parent_class = NULL;
+
+/*
+ * Main object structure
+ */
+
+typedef struct XferSourceFd {
+    XferElement __parent__;
+} XferSourceFd;
+
+/*
+ * Class definition
+ */
+
+typedef struct {
+    XferElementClass __parent__;
+} XferSourceFdClass;
+
+/*
+ * Implementation
+ */
+
+static void
+class_init(
+    XferSourceFdClass * selfc)
+{
+    XferElementClass *klass = XFER_ELEMENT_CLASS(selfc);
+    static xfer_element_mech_pair_t mech_pairs[] = {
+       { XFER_MECH_NONE, XFER_MECH_READFD, 0, 0},
+       { XFER_MECH_NONE, XFER_MECH_NONE, 0, 0},
+    };
+
+    klass->perl_class = "Amanda::Xfer::Source::Fd";
+    klass->mech_pairs = mech_pairs;
+
+    parent_class = g_type_class_peek_parent(selfc);
+}
+
+GType
+xfer_source_fd_get_type (void)
+{
+    static GType type = 0;
+
+    if G_UNLIKELY(type == 0) {
+        static const GTypeInfo info = {
+            sizeof (XferSourceFdClass),
+            (GBaseInitFunc) NULL,
+            (GBaseFinalizeFunc) NULL,
+            (GClassInitFunc) class_init,
+            (GClassFinalizeFunc) NULL,
+            NULL /* class_data */,
+            sizeof (XferSourceFd),
+            0 /* n_preallocs */,
+            (GInstanceInitFunc) NULL,
+            NULL
+        };
+
+        type = g_type_register_static (XFER_ELEMENT_TYPE, "XferSourceFd", &info, 0);
+    }
+
+    return type;
+}
+
+/* create an element of this class; prototype is in xfer-element.h */
+XferElement *
+xfer_source_fd(
+    int fd)
+{
+    XferSourceFd *self = (XferSourceFd *)g_object_new(XFER_SOURCE_FD_TYPE, NULL);
+    XferElement *elt = XFER_ELEMENT(self);
+
+    g_assert(fd >= 0);
+
+    /* we read from a *copy* of this file descriptor, as the downstream element
+     * will close output_fd on EOF */
+    elt->output_fd = dup(fd);
+
+    return elt;
+}
diff --git a/xfer-src/source-pattern.c b/xfer-src/source-pattern.c
new file mode 100644 (file)
index 0000000..dccf087
--- /dev/null
@@ -0,0 +1,177 @@
+/*
+ * Amanda, The Advanced Maryland Automatic Network Disk Archiver
+ * Copyright (c) 2008 Zmanda Inc.
+ *
+ * This 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.
+ *
+ * This 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 this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "amxfer.h"
+#include "amanda.h"
+#include "simpleprng.h"
+
+/*
+ * Class declaration
+ *
+ * This declaration is entirely private; nothing but xfer_source_pattern() references
+ * it directly.
+ */
+
+GType xfer_source_pattern_get_type(void);
+#define XFER_SOURCE_PATTERN_TYPE (xfer_source_pattern_get_type())
+#define XFER_SOURCE_PATTERN(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_source_pattern_get_type(), XferSourcePattern)
+#define XFER_SOURCE_PATTERN_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_source_pattern_get_type(), XferSourcePattern const)
+#define XFER_SOURCE_PATTERN_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), xfer_source_pattern_get_type(), XferSourcePatternClass)
+#define IS_XFER_SOURCE_PATTERN(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), xfer_source_pattern_get_type ())
+#define XFER_SOURCE_PATTERN_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS((obj), xfer_source_pattern_get_type(), XferSourcePatternClass)
+
+static GObjectClass *parent_class = NULL;
+
+/*
+ * Main object structure
+ */
+
+typedef struct XferSourcePattern {
+    XferElement __parent__;
+
+    gboolean limited_length;
+    guint64 length;
+    size_t pattern_buffer_length;
+    size_t current_offset;
+    char * pattern;
+} XferSourcePattern;
+
+/*
+ * Class definition
+ */
+
+typedef struct {
+    XferElementClass __parent__;
+} XferSourcePatternClass;
+
+/*
+ * Implementation
+ */
+
+static gpointer
+pull_buffer_impl(
+    XferElement *elt,
+    size_t *size)
+{
+    XferSourcePattern *self = (XferSourcePattern *)elt;
+    char *rval;
+    char *s, *d;
+    size_t l;
+    size_t offset;
+
+    /* indicate EOF on an cancel */
+    if (elt->cancelled || (self->limited_length && self->length == 0)) {
+       *size = 0;
+       return NULL;
+    }
+
+    if (self->limited_length) {
+        if (self->length == 0) {
+            *size = 0;
+            return NULL;
+        }
+
+        *size = MIN(10240, self->length);
+        self->length -= *size;
+    } else {
+       *size = 10240;
+    }
+
+    rval = malloc(*size);
+
+    /* fill the buffer "manually", instead of using fancy memcpy techniques, so
+     * that this runs at about the same speed as the random source */
+    l = *size;
+    s = self->pattern;
+    offset = self->current_offset;
+    d = rval;
+    while (l--) {
+       *(d++) = *(s + offset++);
+       if (offset > self->pattern_buffer_length) offset = 0;
+    }
+    self->current_offset = offset;
+
+    return rval;
+}
+
+static void
+instance_init(
+    XferElement *elt)
+{
+    elt->can_generate_eof = TRUE;
+}
+
+static void
+class_init(
+    XferSourcePatternClass * selfc)
+{
+    XferElementClass *klass = XFER_ELEMENT_CLASS(selfc);
+    static xfer_element_mech_pair_t mech_pairs[] = {
+       { XFER_MECH_NONE, XFER_MECH_PULL_BUFFER, 1, 0},
+       { XFER_MECH_NONE, XFER_MECH_NONE, 0, 0},
+    };
+
+    klass->pull_buffer = pull_buffer_impl;
+
+    klass->perl_class = "Amanda::Xfer::Source::Pattern";
+    klass->mech_pairs = mech_pairs;
+
+    parent_class = g_type_class_peek_parent(selfc);
+}
+
+GType
+xfer_source_pattern_get_type (void)
+{
+    static GType type = 0;
+
+    if G_UNLIKELY(type == 0) {
+        static const GTypeInfo info = {
+            sizeof (XferSourcePatternClass),
+            (GBaseInitFunc) NULL,
+            (GBaseFinalizeFunc) NULL,
+            (GClassInitFunc) class_init,
+            (GClassFinalizeFunc) NULL,
+            NULL /* class_data */,
+            sizeof (XferSourcePattern),
+            0 /* n_preallocs */,
+            (GInstanceInitFunc) instance_init,
+            NULL
+        };
+
+        type = g_type_register_static (XFER_ELEMENT_TYPE, "XferSourcePattern", &info, 0);
+    }
+
+    return type;
+}
+
+/* create an element of this class; prototype is in xfer-element.h */
+XferElement * xfer_source_pattern(guint64 length, void * pattern,
+                                  size_t pattern_length) {
+    XferSourcePattern *xsp =
+        (XferSourcePattern *)g_object_new(XFER_SOURCE_PATTERN_TYPE, NULL);
+    XferElement *elt = XFER_ELEMENT(xsp);
+
+    xsp->length = length;
+    xsp->limited_length = (length > 0);
+    xsp->pattern = g_memdup(pattern, pattern_length);
+    xsp->pattern_buffer_length = pattern_length;
+    xsp->current_offset = 0;
+
+    return elt;
+}
diff --git a/xfer-src/source-random.c b/xfer-src/source-random.c
new file mode 100644 (file)
index 0000000..d15b721
--- /dev/null
@@ -0,0 +1,155 @@
+/*
+ * Amanda, The Advanced Maryland Automatic Network Disk Archiver
+ * Copyright (c) 2008 Zmanda Inc.
+ *
+ * This 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.
+ *
+ * This 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 this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "amxfer.h"
+#include "amanda.h"
+#include "simpleprng.h"
+
+/*
+ * Class declaration
+ *
+ * This declaration is entirely private; nothing but xfer_source_random() references
+ * it directly.
+ */
+
+GType xfer_source_random_get_type(void);
+#define XFER_SOURCE_RANDOM_TYPE (xfer_source_random_get_type())
+#define XFER_SOURCE_RANDOM(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_source_random_get_type(), XferSourceRandom)
+#define XFER_SOURCE_RANDOM_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_source_random_get_type(), XferSourceRandom const)
+#define XFER_SOURCE_RANDOM_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), xfer_source_random_get_type(), XferSourceRandomClass)
+#define IS_XFER_SOURCE_RANDOM(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), xfer_source_random_get_type ())
+#define XFER_SOURCE_RANDOM_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS((obj), xfer_source_random_get_type(), XferSourceRandomClass)
+
+static GObjectClass *parent_class = NULL;
+
+/*
+ * Main object structure
+ */
+
+typedef struct XferSourceRandom {
+    XferElement __parent__;
+
+    gboolean limited_length;
+    guint64 length;
+    simpleprng_state_t prng;
+} XferSourceRandom;
+
+/*
+ * Class definition
+ */
+
+typedef struct {
+    XferElementClass __parent__;
+} XferSourceRandomClass;
+
+/*
+ * Implementation
+ */
+
+static gpointer
+pull_buffer_impl(
+    XferElement *elt,
+    size_t *size)
+{
+    XferSourceRandom *self = (XferSourceRandom *)elt;
+    char *buf;
+
+    if (elt->cancelled || (self->limited_length && self->length == 0)) {
+       *size = 0;
+       return NULL;
+    }
+
+    if (self->limited_length) {
+        *size = MIN(10240, self->length);
+        self->length -= *size;
+    } else {
+       *size = 10240;
+    }
+
+    buf = g_malloc(*size);
+    simpleprng_fill_buffer(&self->prng, buf, *size);
+
+    return buf;
+}
+
+static void
+instance_init(
+    XferElement *elt)
+{
+    elt->can_generate_eof = TRUE;
+}
+
+static void
+class_init(
+    XferSourceRandomClass * selfc)
+{
+    XferElementClass *klass = XFER_ELEMENT_CLASS(selfc);
+    static xfer_element_mech_pair_t mech_pairs[] = {
+       { XFER_MECH_NONE, XFER_MECH_PULL_BUFFER, 1, 0},
+       { XFER_MECH_NONE, XFER_MECH_NONE, 0, 0},
+    };
+
+    klass->pull_buffer = pull_buffer_impl;
+
+    klass->perl_class = "Amanda::Xfer::Source::Random";
+    klass->mech_pairs = mech_pairs;
+
+    parent_class = g_type_class_peek_parent(selfc);
+}
+
+GType
+xfer_source_random_get_type (void)
+{
+    static GType type = 0;
+
+    if G_UNLIKELY(type == 0) {
+        static const GTypeInfo info = {
+            sizeof (XferSourceRandomClass),
+            (GBaseInitFunc) NULL,
+            (GBaseFinalizeFunc) NULL,
+            (GClassInitFunc) class_init,
+            (GClassFinalizeFunc) NULL,
+            NULL /* class_data */,
+            sizeof (XferSourceRandom),
+            0 /* n_preallocs */,
+            (GInstanceInitFunc) instance_init,
+            NULL
+        };
+
+        type = g_type_register_static (XFER_ELEMENT_TYPE, "XferSourceRandom", &info, 0);
+    }
+
+    return type;
+}
+
+/* create an element of this class; prototype is in xfer-element.h */
+XferElement *
+xfer_source_random(
+    guint64 length,
+    guint32 prng_seed)
+{
+    XferSourceRandom *xsr = (XferSourceRandom *)g_object_new(XFER_SOURCE_RANDOM_TYPE, NULL);
+    XferElement *elt = XFER_ELEMENT(xsr);
+
+    xsr->length = length;
+    xsr->limited_length = (length != 0);
+    simpleprng_seed(&xsr->prng, prng_seed);
+
+    return elt;
+}
diff --git a/xfer-src/xfer-element.c b/xfer-src/xfer-element.c
new file mode 100644 (file)
index 0000000..678be84
--- /dev/null
@@ -0,0 +1,286 @@
+/*
+ * Amanda, The Advanced Maryland Automatic Network Disk Archiver
+ * Copyright (c) 2008 Zmanda Inc.
+ *
+ * This 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.
+ *
+ * This 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 this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "amxfer.h"
+#include "amanda.h"
+#include "arglist.h"
+
+/* parent class for XferElement */
+static GObjectClass *parent_class = NULL;
+
+/* parent class for XferDest, XferFilter, and XferSource */
+static XferElementClass *xfer_element_class = NULL;
+
+/***********************
+ * XferElement */
+
+static void
+xfer_element_init(
+    XferElement *xe)
+{
+    xe->xfer = NULL;
+    xe->output_mech = XFER_MECH_NONE;
+    xe->input_mech = XFER_MECH_NONE;
+    xe->upstream = xe->downstream = NULL;
+    xe->input_fd = xe->output_fd = -1;
+    xe->repr = NULL;
+}
+
+static void
+xfer_element_setup_impl(
+    XferElement *elt G_GNUC_UNUSED)
+{
+}
+
+static gboolean
+xfer_element_start_impl(
+    XferElement *elt G_GNUC_UNUSED)
+{
+    return FALSE;
+}
+
+static gboolean
+xfer_element_cancel_impl(
+    XferElement *elt,
+    gboolean expect_eof)
+{
+    elt->cancelled = TRUE;
+    elt->expect_eof = expect_eof;
+    return elt->can_generate_eof;
+}
+
+static gpointer
+xfer_element_pull_buffer_impl(
+    XferElement *elt G_GNUC_UNUSED,
+    size_t *size G_GNUC_UNUSED)
+{
+    return NULL;
+}
+
+static void
+xfer_element_push_buffer_impl(
+    XferElement *elt G_GNUC_UNUSED,
+    gpointer buf G_GNUC_UNUSED,
+    size_t size G_GNUC_UNUSED)
+{
+}
+
+static char *
+xfer_element_repr_impl(
+    XferElement *elt)
+{
+    if (!elt->repr) {
+       elt->repr = newvstrallocf(elt->repr, "<%s@%p>", 
+               G_OBJECT_TYPE_NAME(G_OBJECT(elt)),
+               elt);
+    }
+
+    return elt->repr;
+}
+
+static void
+xfer_element_finalize(
+    GObject * obj_self)
+{
+    XferElement *elt = XFER_ELEMENT(obj_self);
+
+    /* free the repr cache */
+    if (elt->repr) g_free(elt->repr);
+
+    /* chain up */
+    G_OBJECT_CLASS(parent_class)->finalize(obj_self);
+}
+
+static void
+xfer_element_class_init(
+    XferElementClass * klass)
+{
+    GObjectClass *goc = (GObjectClass*) klass;
+
+    klass->repr = xfer_element_repr_impl;
+    klass->setup = xfer_element_setup_impl;
+    klass->start = xfer_element_start_impl;
+    klass->cancel = xfer_element_cancel_impl;
+    klass->pull_buffer = xfer_element_pull_buffer_impl;
+    klass->push_buffer = xfer_element_push_buffer_impl;
+
+    goc->finalize = xfer_element_finalize;
+
+    klass->perl_class = NULL;
+
+    parent_class = g_type_class_peek_parent(klass);
+    xfer_element_class = klass;
+}
+
+GType
+xfer_element_get_type(void)
+{
+    static GType type = 0;
+
+    if G_UNLIKELY(type == 0) {
+        static const GTypeInfo info = {
+            sizeof (XferElementClass),
+            (GBaseInitFunc) NULL,
+            (GBaseFinalizeFunc) NULL,
+            (GClassInitFunc) xfer_element_class_init,
+            (GClassFinalizeFunc) NULL,
+            NULL /* class_data */,
+            sizeof (XferElement),
+            0 /* n_preallocs */,
+            (GInstanceInitFunc) xfer_element_init,
+            NULL
+        };
+
+        type = g_type_register_static (G_TYPE_OBJECT, "XferElement", &info,
+                                       (GTypeFlags)G_TYPE_FLAG_ABSTRACT);
+    }
+
+    return type;
+}
+
+/*
+ * Method stubs
+ */
+
+void
+xfer_element_unref(
+    XferElement *elt)
+{
+    if (elt) g_object_unref(elt);
+}
+
+char *
+xfer_element_repr(
+    XferElement *elt)
+{
+    return XFER_ELEMENT_GET_CLASS(elt)->repr(elt);
+}
+
+void
+xfer_element_setup(
+    XferElement *elt)
+{
+    XFER_ELEMENT_GET_CLASS(elt)->setup(elt);
+}
+
+gboolean
+xfer_element_start(
+    XferElement *elt)
+{
+    return XFER_ELEMENT_GET_CLASS(elt)->start(elt);
+}
+
+gboolean
+xfer_element_cancel(
+    XferElement *elt,
+    gboolean expect_eof)
+{
+    return XFER_ELEMENT_GET_CLASS(elt)->cancel(elt, expect_eof);
+}
+
+gpointer
+xfer_element_pull_buffer(
+    XferElement *elt,
+    size_t *size)
+{
+    return XFER_ELEMENT_GET_CLASS(elt)->pull_buffer(elt, size);
+}
+
+void
+xfer_element_push_buffer(
+    XferElement *elt,
+    gpointer buf,
+    size_t size)
+{
+    XFER_ELEMENT_GET_CLASS(elt)->push_buffer(elt, buf, size);
+}
+
+/****
+ * Utilities
+ */
+
+void
+xfer_element_drain_by_pulling(
+    XferElement *upstream)
+{
+    gpointer buf;
+    size_t size;
+
+    while ((buf =xfer_element_pull_buffer(upstream, &size))) {
+       amfree(buf);
+    }
+}
+
+void
+xfer_element_drain_by_reading(
+    int fd)
+{
+    size_t len;
+    char buf[1024];
+
+    while (1) {
+       len = full_read(fd, buf, sizeof(buf));
+       if (len < sizeof(buf))
+           return;
+    }
+}
+
+xfer_status
+wait_until_xfer_cancelled(
+    Xfer *xfer)
+{
+    xfer_status seen_status;
+    g_assert(xfer != NULL);
+
+    g_mutex_lock(xfer->status_mutex);
+    while (xfer->status != XFER_CANCELLED && xfer->status != XFER_DONE)
+       g_cond_wait(xfer->status_cond, xfer->status_mutex);
+    seen_status = xfer->status;
+    g_mutex_unlock(xfer->status_mutex);
+
+    return seen_status;
+}
+
+void
+xfer_element_handle_error(
+    XferElement *elt,
+    const char *fmt,
+    ...)
+{
+    va_list argp;
+    XMsg *msg;
+
+    g_assert(elt != NULL);
+    g_assert(elt->xfer != NULL);
+
+    msg = xmsg_new(elt, XMSG_ERROR, 0);
+
+    arglist_start(argp, fmt);
+    msg->message = g_strdup_vprintf(fmt, argp);
+    arglist_end(argp);
+
+    /* send the XMSG_ERROR */
+    xfer_queue_message(elt->xfer, msg);
+
+    /* cancel the transfer */
+    xfer_cancel(elt->xfer);
+
+    /* and wait for the cancellation to take effect */
+    wait_until_xfer_cancelled(elt->xfer);
+}
diff --git a/xfer-src/xfer-element.h b/xfer-src/xfer-element.h
new file mode 100644 (file)
index 0000000..43a9323
--- /dev/null
@@ -0,0 +1,391 @@
+/*
+ * Amanda, The Advanced Maryland Automatic Network Disk Archiver
+ * Copyright (c) 2008 Zmanda Inc.
+ *
+ * This 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.
+ *
+ * This 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 this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/* Base classes and interfaces for transfer elements.  There are two interfaces
+ * defined here: IXferProducer and IXferConsumer.  The former is for elements
+ * which produce data, and the latter is for those which consume it.  There is
+ * a top-level XferElement base class, which all implementations subclass.
+ *
+ * Unless you're well-acquainted with GType and GObject, this file will be a
+ * difficult read.  It is really only of use to those implementing new subclasses.
+ */
+
+#ifndef XFER_ELEMENT_H
+#define XFER_ELEMENT_H
+
+#include <glib.h>
+#include <glib-object.h>
+#include "xfer.h"
+#include "device.h"
+#include "queueing.h"
+
+typedef enum {
+    /* sources have no input mechanisms and destinations have no output
+     * mechansisms. */
+    XFER_MECH_NONE,
+
+    /* downstream element will read() from elt->upstream->output_fd; EOF
+     * is indicated by the usual OS mechanism resulting in a zero-length
+     * read, in response to which the downstream element must close
+     * the fd. */
+    XFER_MECH_READFD,
+
+    /* upstream element will write() to elt->downstream->input_fd.  EOF
+     * is indicated by closing the file descriptor. */
+    XFER_MECH_WRITEFD,
+
+    /* downstream element will call elt->upstream->pull_buffer() to
+     * pull a buffer.  EOF is indicated by returning a NULL buffer */
+    XFER_MECH_PULL_BUFFER,
+
+    /* upstream element will call elt->downstream->push_buffer(buf) to push
+     * a buffer.  EOF is indicated by passing a NULL buffer. */
+    XFER_MECH_PUSH_BUFFER,
+} xfer_mech;
+
+/* Description of a pair (input, output) of xfer mechanisms that an
+ * element can support, along with the associated costs.  An array of these
+ * pairs is stored in the class-level variable 'mech_pairs', describing
+ * all of the mechanisms that an element supports.
+ */
+typedef struct {
+    xfer_mech input_mech;
+    xfer_mech output_mech;
+    guint8 ops_per_byte;       /* number of byte copies or other operations */
+    guint8 nthreads;           /* number of additional threads created */
+} xfer_element_mech_pair_t;
+
+/***********************
+ * XferElement
+ *
+ * The virtual base class for all transfer elements
+ */
+
+GType xfer_element_get_type(void);
+#define XFER_ELEMENT_TYPE (xfer_element_get_type())
+#define XFER_ELEMENT(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_element_get_type(), XferElement)
+#define XFER_ELEMENT_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_element_get_type(), XferElement const)
+#define XFER_ELEMENT_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), xfer_element_get_type(), XferElementClass)
+#define IS_XFER_ELEMENT(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), xfer_element_get_type ())
+#define XFER_ELEMENT_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS((obj), xfer_element_get_type(), XferElementClass)
+
+/*
+ * Main object structure
+ */
+
+typedef struct XferElement {
+    GObject __parent__;
+
+    /* The transfer to which this element is attached */
+    Xfer *xfer; /* set by xfer_new */
+
+    /* assigned input and output mechanisms */
+    xfer_mech input_mech;
+    xfer_mech output_mech;
+
+    /* neighboring xfer elements */
+    struct XferElement *upstream;
+    struct XferElement *downstream;
+
+    /* Information regarding cancellation.  Cancelled and expect_eof are set by
+     * the default cancel() method.  Can_generate_eof should be set during
+     * initialization, and is returned by the default cancel implementation */
+    gboolean cancelled;
+    gboolean expect_eof;
+    gboolean can_generate_eof;
+
+    /* file descriptors for XFER_MECH_READFD and XFER_MECH_WRITEFD.  These should be set
+     * during setup(), and can be accessed by neighboring elements during start(). It is
+     * up to subclasses to handle closing these file descriptors, if required. */
+    gint input_fd;
+    gint output_fd;
+
+    /* cache for repr() */
+    char *repr;
+} XferElement;
+
+/*
+ * Class definition
+ */
+
+typedef struct {
+    GObjectClass __parent__;
+
+    /* Get a string representation of this element.  The returned string will be freed
+     * when the element is finalized, and is static until that time.  This method is
+     * implemented by XferElement, but can be overridden by classes that can provide
+     * additional useful information about themselves.  Overriding methods can use
+     * the 'repr' instance variable as a cache -- it will be freed on finalize().
+     *
+     * @param elt: the XferElement
+     * @return: statically allocated string
+     */
+    char *(*repr)(XferElement *elt);
+
+    /* Set up this element.  This function is called for all elements in a transfer
+     * before start() is called for any elements.  For mechanisms where this element
+     * supplies a file descriptor, it should set its input_fd and/or output_fd
+     * appropriately; neighboring elements will use that value in start().
+     *
+     * elt->input_mech and elt->output_mech are already set when this function
+     * is called, but upstream and downstream are not.
+     *
+     * @param elt: the XferElement
+     */
+    void (*setup)(XferElement *elt);
+
+    /* Start transferring data.  The element downstream of this one will already be
+     * started, while the upstream element will not, so data will not begin flowing
+     * immediately.
+     *
+     * @param elt: the XferElement
+     * @return: TRUE if this element will send XMSG_DONE
+     */
+    gboolean (*start)(XferElement *elt);
+
+    /* Stop transferring data.  The upstream element's cancel method will
+     * already have been called, but due to buffering and synchronization
+     * issues, data may yet arrive.  The element may discard any such data, but
+     * must not fail.  This method is only called for abnormal terminations;
+     * elements should normally stop processing on receiving an EOF indication
+     * from upstream.
+     *
+     * If expect_eof is TRUE, then this element should expect an EOF from its
+     * upstream element, and should drain any remaining data until that EOF
+     * arrives and generate an EOF to the downstream element.  The utility
+     * functions xfer_element_drain_by_reading and xfer_element_drain_by_pulling may be useful for this
+     * purpose. This draining is important in order to avoid hung threads or
+     * unexpected SIGPIPEs.
+     *
+     * If expect_eof is FALSE, then the upstream elements are unable to
+     * generate an early EOF, so this element should *not* attempt to drain any
+     * remaining data.  As an example, an FdSource is not active and thus
+     * cannot generate an EOF on request.
+     *
+     * If this element can generate an EOF, it should return TRUE, otherwise
+     * FALSE.
+     *
+     * The default implementation sets self->expect_eof and self->cancelled
+     * appropriately and returns self->can_generate_eof.
+     *
+     * This method is always called from the main thread.  It must not block.
+     *
+     * @param elt: the XferElement
+     */
+    gboolean (*cancel)(XferElement *elt, gboolean generate_eof);
+
+    /* Get a buffer full of data from this element.  This function is called by
+     * the downstream element under XFER_MECH_PULL_CALL.  It can block indefinitely,
+     * and must only return NULL on EOF.  Responsibility to free the buffer transfers
+     * to the caller.
+     *
+     * @param elt: the XferElement
+     * @param size (output): size of resulting buffer
+     */
+    gpointer (*pull_buffer)(XferElement *elt, size_t *size);
+
+    /* A buffer full of data is being sent to this element for processing; this
+     * function is called by the upstream element under XFER_MECH_PUSH_CALL.
+     * It can block indefinitely if the data cannot be processed immediately.
+     * An EOF condition is signaled by call with a NULL buffer.  Responsibility to
+     * free the buffer transfers to the callee.
+     *
+     * @param elt: the XferElement
+     * @param buf: buffer
+     * @param size: size of buffer
+     */
+    void (*push_buffer)(XferElement *elt, gpointer buf, size_t size);
+
+    /* class variables */
+
+    /* This is used by the perl bindings -- it is a class variable giving the
+     * appropriate perl class to wrap this XferElement.  It should be set by
+     * each class's class_init.
+     */
+    const char *perl_class;
+
+    /* Statically allocated array of input/output mechanisms supported by this
+     * class (terminated by <XFER_MECH_NONE,XFER_MECH_NONE>) */
+    xfer_element_mech_pair_t *mech_pairs;
+} XferElementClass;
+
+/*
+ * Method stubs
+ */
+
+void xfer_element_unref(XferElement *elt);
+gboolean xfer_element_link_to(XferElement *elt, XferElement *successor);
+char *xfer_element_repr(XferElement *elt);
+void xfer_element_setup(XferElement *elt);
+gboolean xfer_element_start(XferElement *elt);
+void xfer_element_push_buffer(XferElement *elt, gpointer buf, size_t size);
+gpointer xfer_element_pull_buffer(XferElement *elt, size_t *size);
+gboolean xfer_element_cancel(XferElement *elt, gboolean expect_eof);
+
+/****
+ * Subclass utilities
+ *
+ * These are utilities for subclasses
+ */
+
+/* Drain UPSTREAM by pulling buffers until EOF
+ *
+ * @param upstream: the element to drain
+ */
+void xfer_element_drain_by_pulling(XferElement *upstream);
+
+/* Drain UPSTREAM by reading until EOF.  This does not close
+ * the file descriptor.
+ *
+ * @param fd: the file descriptor to drain
+ */
+void xfer_element_drain_by_reading(int fd);
+
+/* Wait for the xfer's state to become CANCELLED or DONE; this is useful to
+ * wait until a cancelletion is in progress before returning an EOF or
+ * otherwise handling a failure.  If you call this in the main thread, you'll
+ * be waiting for a while.
+ *
+ * @param xfer: the transfer object
+ * @returns: the new status (XFER_CANCELLED or XFER_DONE)
+ */
+xfer_status wait_until_xfer_cancelled(Xfer *xfer);
+
+/* Send an XMSG_ERROR constructed with the given format and arguments, then
+ * cancel the transfer, then wait until the transfer is completely cancelled.
+ * This is the most common error-handling process for transfer elements.  All
+ * that remains to be done on return is to branch to the appropriate point in
+ * the cancellation-handling portion of the transfer.
+ *
+ * @param elt: the transfer element producing the error
+ * @param fmt: the format for the error message
+ * @param ...: arguments corresponding to the format
+ */
+void xfer_element_handle_error(XferElement *elt, const char *fmt, ...)
+       G_GNUC_PRINTF(2,3);
+
+/***********************
+ * XferElement subclasses
+ *
+ * These simple subclasses do not introduce any additional public members or
+ * methods, so they do not have their own header file.  The functions here
+ * provide their only public interface.  The implementation of these elements
+ * can also provide a good prototype for new elements.
+ */
+
+/* A transfer source that reads from a Device. The device must be positioned
+ * at the start of a file before the transfer is started.  The transfer will
+ * continue until the end of the file.
+ *
+ * Implemented in source-device.c
+ *
+ * @param device: Device object to read from
+ * @return: new element
+ */
+XferElement *xfer_source_device(
+    Device *device);
+
+/* A transfer source that produces LENGTH bytes of random data, for testing
+ * purposes.
+ *
+ * Implemented in source-random.c
+ *
+ * @param length: bytes to produce, or zero for no limit
+ * @param prng_seed: initial value for random number generator
+ * @return: new element
+ */
+XferElement *xfer_source_random(guint64 length, guint32 prng_seed);
+
+/* A transfer source that produces LENGTH bytes containing repeated
+ * copies of the provided pattern, for testing purposes.
+ *
+ * Implemented in source-pattern.c
+ *
+ * @param length: bytes to produce, or zero for no limit
+ * @param pattern: Pointer to memory containing the desired byte pattern.
+ * @param pattern_length: Size of pattern to repeat.
+ * @return: new element
+ */
+XferElement *xfer_source_pattern(guint64 length, void * pattern,
+                                 size_t pattern_length);
+
+/* A transfer source that provides bytes read from a file descriptor.
+ * Reading continues until EOF, but the file descriptor is not closed.
+ *
+ * Implemented in source-fd.c
+ *
+ * @param fd: the file descriptor from which to read
+ * @return: new element
+ */
+XferElement * xfer_source_fd(
+    int fd);
+
+/* A transfer filter that just applies a bytewise XOR transformation to the data
+ * that passes through it.
+ *
+ * Implemented in filter-xor.c
+ *
+ * @param xor_key: key for xor operations
+ * @return: new element
+ */
+XferElement *xfer_filter_xor(
+    unsigned char xor_key);
+
+/* A transfer destination that writes bytes to a Device.  The device should have a
+ * file started, ready for a device_write_block call.  On completion of the transfer,
+ * the file will be finished.
+ *
+ * Implemented in dest-device.c
+ *
+ * @param device: the Device to write to, with a file started
+ * @param max_memory: total amount of memory to use for buffers, or zero
+ *                    for a reasonable default.
+ * @return: new element
+ */
+XferElement *
+xfer_dest_device(
+    Device *device,
+    size_t max_memory);
+
+
+/* A transfer destination that consumes all bytes it is given, optionally
+ * validating that they match those produced by source_random
+ *
+ * Implemented in dest-null.c
+ *
+ * @param prng_seed: if nonzero, validate that the datastream matches
+ *     that produced by a random source with this random seed.  If zero,
+ *     no validation is performed.
+ * @return: new element
+ */
+XferElement *xfer_dest_null(
+    guint32 prng_seed);
+
+/* A transfer destination that writes bytes to a file descriptor.  The file
+ * descriptor is not closed when the transfer is complete.
+ *
+ * Implemented in dest-fd.c
+ *
+ * @param fd: file descriptor to which to write
+ * @return: new element
+ */
+XferElement *xfer_dest_fd(
+    int fd);
+
+#endif
diff --git a/xfer-src/xfer-test.c b/xfer-src/xfer-test.c
new file mode 100644 (file)
index 0000000..f50cf13
--- /dev/null
@@ -0,0 +1,1094 @@
+/*
+ * Copyright (c) 2008 Zmanda Inc.  All Rights Reserved.
+ * 
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ * 
+ * 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.,
+ * 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ * 
+ * Contact information: Zmanda Inc, 465 N Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ *
+ * Author: Dustin J. Mitchell <dustin@zmanda.com>
+ */
+
+#include "amxfer.h"
+#include "glib-util.h"
+#include "testutils.h"
+#include "amanda.h"
+#include "event.h"
+#include "simpleprng.h"
+
+/* Having tests repeat exactly is an advantage, so we use a hard-coded
+ * random seed. */
+#define RANDOM_SEED 0xf00d
+
+/*
+ * XferElement subclasses
+ *
+ * This file defines a few "private" element classes that each have only one
+ * mechanism pair.  These classes are then used to test all of the possible
+ * combinations of glue.
+ */
+
+/* constants to determine the total amount of data to be transfered; EXTRA is
+ * to test out partial-block handling; it should be prime. */
+#define TEST_BLOCK_SIZE 1024
+#define TEST_BLOCK_COUNT 10
+#define TEST_BLOCK_EXTRA 97
+#define TEST_XFER_SIZE ((TEST_BLOCK_SIZE*TEST_BLOCK_COUNT)+TEST_BLOCK_EXTRA)
+
+/* READFD */
+
+static GType xfer_source_readfd_get_type(void);
+#define XFER_SOURCE_READFD_TYPE (xfer_source_readfd_get_type())
+#define XFER_SOURCE_READFD(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_source_readfd_get_type(), XferSourceReadfd)
+#define XFER_SOURCE_READFD_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_source_readfd_get_type(), XferSourceReadfd const)
+#define XFER_SOURCE_READFD_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), xfer_source_readfd_get_type(), XferSourceReadfdClass)
+#define IS_XFER_SOURCE_READFD(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), xfer_source_readfd_get_type ())
+#define XFER_SOURCE_READFD_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS((obj), xfer_source_readfd_get_type(), XferSourceReadfdClass)
+
+typedef struct XferSourceReadfd {
+    XferElement __parent__;
+
+    int write_fd;
+    GThread *thread;
+    simpleprng_state_t prng;
+} XferSourceReadfd;
+
+typedef struct {
+    XferElementClass __parent__;
+} XferSourceReadfdClass;
+
+static gpointer
+source_readfd_thread(
+    gpointer data)
+{
+    XferSourceReadfd *self = (XferSourceReadfd *)data;
+    char buf[TEST_XFER_SIZE];
+    int fd = self->write_fd;
+
+    simpleprng_fill_buffer(&self->prng, buf, sizeof(buf));
+
+    if (full_write(fd, buf, sizeof(buf)) < sizeof(buf)) {
+       error("error in full_write(): %s", strerror(errno));
+    }
+
+    close(fd);
+
+    xfer_queue_message(XFER_ELEMENT(self)->xfer, xmsg_new(XFER_ELEMENT(self), XMSG_DONE, 0));
+
+    return NULL;
+}
+
+static void
+source_readfd_setup_impl(
+    XferElement *elt)
+{
+    XferSourceReadfd *self = (XferSourceReadfd *)elt;
+    int p[2];
+
+    simpleprng_seed(&self->prng, RANDOM_SEED);
+
+    if (pipe(p) < 0)
+       g_critical("Error from pipe(): %s", strerror(errno));
+
+    self->write_fd = p[1];
+    XFER_ELEMENT(self)->output_fd = p[0];
+}
+
+static gboolean
+source_readfd_start_impl(
+    XferElement *elt)
+{
+    XferSourceReadfd *self = (XferSourceReadfd *)elt;
+    self->thread = g_thread_create(source_readfd_thread, (gpointer)self, FALSE, NULL);
+
+    return TRUE;
+}
+
+static void
+source_readfd_class_init(
+    XferSourceReadfdClass * klass)
+{
+    XferElementClass *xec = XFER_ELEMENT_CLASS(klass);
+    static xfer_element_mech_pair_t mech_pairs[] = {
+       { XFER_MECH_NONE, XFER_MECH_READFD, 1, 1},
+       { XFER_MECH_NONE, XFER_MECH_NONE, 0, 0},
+    };
+
+    xec->setup = source_readfd_setup_impl;
+    xec->start = source_readfd_start_impl;
+    xec->mech_pairs = mech_pairs;
+}
+
+GType
+xfer_source_readfd_get_type (void)
+{
+    static GType type = 0;
+
+    if G_UNLIKELY(type == 0) {
+        static const GTypeInfo info = {
+            sizeof (XferSourceReadfdClass),
+            (GBaseInitFunc) NULL,
+            (GBaseFinalizeFunc) NULL,
+            (GClassInitFunc) source_readfd_class_init,
+            (GClassFinalizeFunc) NULL,
+            NULL /* class_data */,
+            sizeof (XferSourceReadfd),
+            0 /* n_preallocs */,
+            (GInstanceInitFunc) NULL,
+            NULL
+        };
+
+        type = g_type_register_static (XFER_ELEMENT_TYPE, "XferSourceReadfd", &info, 0);
+    }
+
+    return type;
+}
+
+/* WRITEFD */
+
+static GType xfer_source_writefd_get_type(void);
+#define XFER_SOURCE_WRITEFD_TYPE (xfer_source_writefd_get_type())
+#define XFER_SOURCE_WRITEFD(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_source_writefd_get_type(), XferSourceWritefd)
+#define XFER_SOURCE_WRITEFD_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_source_writefd_get_type(), XferSourceWritefd const)
+#define XFER_SOURCE_WRITEFD_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), xfer_source_writefd_get_type(), XferSourceWritefdClass)
+#define IS_XFER_SOURCE_WRITEFD(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), xfer_source_writefd_get_type ())
+#define XFER_SOURCE_WRITEFD_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS((obj), xfer_source_writefd_get_type(), XferSourceWritefdClass)
+
+typedef struct XferSourceWritefd {
+    XferElement __parent__;
+
+    GThread *thread;
+    simpleprng_state_t prng;
+} XferSourceWritefd;
+
+typedef struct {
+    XferElementClass __parent__;
+} XferSourceWritefdClass;
+
+static gpointer
+source_writefd_thread(
+    gpointer data)
+{
+    XferSourceWritefd *self = (XferSourceWritefd *)data;
+    char buf[TEST_XFER_SIZE];
+    int fd = XFER_ELEMENT(self)->downstream->input_fd;
+
+    simpleprng_fill_buffer(&self->prng, buf, sizeof(buf));
+
+    if (full_write(fd, buf, sizeof(buf)) < sizeof(buf)) {
+       error("error in full_write(): %s", strerror(errno));
+    }
+
+    close(fd);
+    XFER_ELEMENT(self)->downstream->input_fd = -1;
+
+    xfer_queue_message(XFER_ELEMENT(self)->xfer, xmsg_new(XFER_ELEMENT(self), XMSG_DONE, 0));
+
+    return NULL;
+}
+
+static gboolean
+source_writefd_start_impl(
+    XferElement *elt)
+{
+    XferSourceWritefd *self = (XferSourceWritefd *)elt;
+
+    simpleprng_seed(&self->prng, RANDOM_SEED);
+
+    self->thread = g_thread_create(source_writefd_thread, (gpointer)self, FALSE, NULL);
+
+    return TRUE;
+}
+
+static void
+source_writefd_class_init(
+    XferSourceWritefdClass * klass)
+{
+    XferElementClass *xec = XFER_ELEMENT_CLASS(klass);
+    static xfer_element_mech_pair_t mech_pairs[] = {
+       { XFER_MECH_NONE, XFER_MECH_WRITEFD, 1, 1},
+       { XFER_MECH_NONE, XFER_MECH_NONE, 0, 0},
+    };
+
+    xec->start = source_writefd_start_impl;
+    xec->mech_pairs = mech_pairs;
+}
+
+GType
+xfer_source_writefd_get_type (void)
+{
+    static GType type = 0;
+
+    if G_UNLIKELY(type == 0) {
+        static const GTypeInfo info = {
+            sizeof (XferSourceWritefdClass),
+            (GBaseInitFunc) NULL,
+            (GBaseFinalizeFunc) NULL,
+            (GClassInitFunc) source_writefd_class_init,
+            (GClassFinalizeFunc) NULL,
+            NULL /* class_data */,
+            sizeof (XferSourceWritefd),
+            0 /* n_preallocs */,
+            (GInstanceInitFunc) NULL,
+            NULL
+        };
+
+        type = g_type_register_static (XFER_ELEMENT_TYPE, "XferSourceWritefd", &info, 0);
+    }
+
+    return type;
+}
+
+/* PUSH_BUFFER */
+
+static GType xfer_source_push_get_type(void);
+#define XFER_SOURCE_PUSH_TYPE (xfer_source_push_get_type())
+#define XFER_SOURCE_PUSH(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_source_push_get_type(), XferSourcePush)
+#define XFER_SOURCE_PUSH_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_source_push_get_type(), XferSourcePush const)
+#define XFER_SOURCE_PUSH_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), xfer_source_push_get_type(), XferSourcePushClass)
+#define IS_XFER_SOURCE_PUSH(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), xfer_source_push_get_type ())
+#define XFER_SOURCE_PUSH_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS((obj), xfer_source_push_get_type(), XferSourcePushClass)
+
+typedef struct XferSourcePush {
+    XferElement __parent__;
+
+    GThread *thread;
+    simpleprng_state_t prng;
+} XferSourcePush;
+
+typedef struct {
+    XferElementClass __parent__;
+} XferSourcePushClass;
+
+static gpointer
+source_push_thread(
+    gpointer data)
+{
+    XferSourcePush *self = (XferSourcePush *)data;
+    char *buf;
+    int i;
+
+    for (i = 0; i < TEST_BLOCK_COUNT; i++) {
+       buf = g_malloc(TEST_BLOCK_SIZE);
+       simpleprng_fill_buffer(&self->prng, buf, TEST_BLOCK_SIZE);
+       xfer_element_push_buffer(XFER_ELEMENT(self)->downstream, buf, TEST_BLOCK_SIZE);
+       buf = NULL;
+    }
+
+    /* send a smaller block */
+    buf = g_malloc(TEST_BLOCK_EXTRA);
+    simpleprng_fill_buffer(&self->prng, buf, TEST_BLOCK_EXTRA);
+    xfer_element_push_buffer(XFER_ELEMENT(self)->downstream, buf, TEST_BLOCK_EXTRA);
+    buf = NULL;
+
+    /* send EOF */
+    xfer_element_push_buffer(XFER_ELEMENT(self)->downstream, NULL, 0);
+
+    xfer_queue_message(XFER_ELEMENT(self)->xfer, xmsg_new(XFER_ELEMENT(self), XMSG_DONE, 0));
+
+    return NULL;
+}
+
+static gboolean
+source_push_start_impl(
+    XferElement *elt)
+{
+    XferSourcePush *self = (XferSourcePush *)elt;
+
+    simpleprng_seed(&self->prng, RANDOM_SEED);
+
+    self->thread = g_thread_create(source_push_thread, (gpointer)self, FALSE, NULL);
+
+    return TRUE;
+}
+
+static void
+source_push_class_init(
+    XferSourcePushClass * klass)
+{
+    XferElementClass *xec = XFER_ELEMENT_CLASS(klass);
+    static xfer_element_mech_pair_t mech_pairs[] = {
+       { XFER_MECH_NONE, XFER_MECH_PUSH_BUFFER, 1, 1},
+       { XFER_MECH_NONE, XFER_MECH_NONE, 0, 0},
+    };
+
+    xec->start = source_push_start_impl;
+    xec->mech_pairs = mech_pairs;
+}
+
+GType
+xfer_source_push_get_type (void)
+{
+    static GType type = 0;
+
+    if G_UNLIKELY(type == 0) {
+        static const GTypeInfo info = {
+            sizeof (XferSourcePushClass),
+            (GBaseInitFunc) NULL,
+            (GBaseFinalizeFunc) NULL,
+            (GClassInitFunc) source_push_class_init,
+            (GClassFinalizeFunc) NULL,
+            NULL /* class_data */,
+            sizeof (XferSourcePush),
+            0 /* n_preallocs */,
+            (GInstanceInitFunc) NULL,
+            NULL
+        };
+
+        type = g_type_register_static (XFER_ELEMENT_TYPE, "XferSourcePush", &info, 0);
+    }
+
+    return type;
+}
+
+/* PULL_BUFFER */
+
+static GType xfer_source_pull_get_type(void);
+#define XFER_SOURCE_PULL_TYPE (xfer_source_pull_get_type())
+#define XFER_SOURCE_PULL(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_source_pull_get_type(), XferSourcePull)
+#define XFER_SOURCE_PULL_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_source_pull_get_type(), XferSourcePull const)
+#define XFER_SOURCE_PULL_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), xfer_source_pull_get_type(), XferSourcePullClass)
+#define IS_XFER_SOURCE_PULL(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), xfer_source_pull_get_type ())
+#define XFER_SOURCE_PULL_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS((obj), xfer_source_pull_get_type(), XferSourcePullClass)
+
+typedef struct XferSourcePull {
+    XferElement __parent__;
+
+    gint nbuffers;
+    GThread *thread;
+    simpleprng_state_t prng;
+} XferSourcePull;
+
+typedef struct {
+    XferElementClass __parent__;
+} XferSourcePullClass;
+
+static gpointer
+source_pull_pull_buffer_impl(
+    XferElement *elt,
+    size_t *size)
+{
+    XferSourcePull *self = (XferSourcePull *)elt;
+    char *buf;
+    size_t bufsiz;
+
+    if (self->nbuffers > TEST_BLOCK_COUNT) {
+       *size = 0;
+       return NULL;
+    }
+    bufsiz = (self->nbuffers != TEST_BLOCK_COUNT)? TEST_BLOCK_SIZE : TEST_BLOCK_EXTRA;
+
+    self->nbuffers++;
+
+    buf = g_malloc(bufsiz);
+    simpleprng_fill_buffer(&self->prng, buf, bufsiz);
+    *size = bufsiz;
+    return buf;
+}
+
+static void
+source_pull_setup_impl(
+    XferElement *elt)
+{
+    XferSourcePull *self = (XferSourcePull *)elt;
+
+    simpleprng_seed(&self->prng, RANDOM_SEED);
+}
+
+static void
+source_pull_class_init(
+    XferSourcePullClass * klass)
+{
+    XferElementClass *xec = XFER_ELEMENT_CLASS(klass);
+    static xfer_element_mech_pair_t mech_pairs[] = {
+       { XFER_MECH_NONE, XFER_MECH_PULL_BUFFER, 1, 0},
+       { XFER_MECH_NONE, XFER_MECH_NONE, 0, 0},
+    };
+
+    xec->pull_buffer = source_pull_pull_buffer_impl;
+    xec->setup = source_pull_setup_impl;
+    xec->mech_pairs = mech_pairs;
+}
+
+GType
+xfer_source_pull_get_type (void)
+{
+    static GType type = 0;
+
+    if G_UNLIKELY(type == 0) {
+        static const GTypeInfo info = {
+            sizeof (XferSourcePullClass),
+            (GBaseInitFunc) NULL,
+            (GBaseFinalizeFunc) NULL,
+            (GClassInitFunc) source_pull_class_init,
+            (GClassFinalizeFunc) NULL,
+            NULL /* class_data */,
+            sizeof (XferSourcePull),
+            0 /* n_preallocs */,
+            (GInstanceInitFunc) NULL,
+            NULL
+        };
+
+        type = g_type_register_static (XFER_ELEMENT_TYPE, "XferSourcePull", &info, 0);
+    }
+
+    return type;
+}
+
+/* READFD */
+
+static GType xfer_dest_readfd_get_type(void);
+#define XFER_DEST_READFD_TYPE (xfer_dest_readfd_get_type())
+#define XFER_DEST_READFD(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_dest_readfd_get_type(), XferDestReadfd)
+#define XFER_DEST_READFD_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_dest_readfd_get_type(), XferDestReadfd const)
+#define XFER_DEST_READFD_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), xfer_dest_readfd_get_type(), XferDestReadfdClass)
+#define IS_XFER_DEST_READFD(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), xfer_dest_readfd_get_type ())
+#define XFER_DEST_READFD_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS((obj), xfer_dest_readfd_get_type(), XferDestReadfdClass)
+
+typedef struct XferDestReadfd {
+    XferElement __parent__;
+
+    GThread *thread;
+    simpleprng_state_t prng;
+} XferDestReadfd;
+
+typedef struct {
+    XferElementClass __parent__;
+} XferDestReadfdClass;
+
+static gpointer
+dest_readfd_thread(
+    gpointer data)
+{
+    XferDestReadfd *self = (XferDestReadfd *)data;
+    char buf[TEST_XFER_SIZE];
+    size_t remaining;
+    int fd = XFER_ELEMENT(self)->upstream->output_fd;
+
+    remaining = sizeof(buf);
+    while (remaining) {
+       ssize_t nread;
+       if ((nread = read(fd, buf+sizeof(buf)-remaining, remaining)) <= 0) {
+           error("error in read(): %s", strerror(errno));
+       }
+       remaining -= nread;
+    }
+
+    /* we should be at EOF here */
+    if (read(fd, buf, 10) != 0)
+       g_critical("too much data entering XferDestReadfd");
+
+    if (!simpleprng_verify_buffer(&self->prng, buf, TEST_XFER_SIZE))
+       g_critical("data entering XferDestReadfd does not match");
+
+    close(fd);
+    XFER_ELEMENT(self)->upstream->output_fd = -1;
+
+    xfer_queue_message(XFER_ELEMENT(self)->xfer, xmsg_new(XFER_ELEMENT(self), XMSG_DONE, 0));
+
+    return NULL;
+}
+
+static gboolean
+dest_readfd_start_impl(
+    XferElement *elt)
+{
+    XferDestReadfd *self = (XferDestReadfd *)elt;
+
+    simpleprng_seed(&self->prng, RANDOM_SEED);
+
+    self->thread = g_thread_create(dest_readfd_thread, (gpointer)self, FALSE, NULL);
+
+    return TRUE;
+}
+
+static void
+dest_readfd_class_init(
+    XferDestReadfdClass * klass)
+{
+    XferElementClass *xec = XFER_ELEMENT_CLASS(klass);
+    static xfer_element_mech_pair_t mech_pairs[] = {
+       { XFER_MECH_READFD, XFER_MECH_NONE, 1, 1},
+       { XFER_MECH_NONE, XFER_MECH_NONE, 0, 0},
+    };
+
+    xec->start = dest_readfd_start_impl;
+    xec->mech_pairs = mech_pairs;
+}
+
+GType
+xfer_dest_readfd_get_type (void)
+{
+    static GType type = 0;
+
+    if G_UNLIKELY(type == 0) {
+        static const GTypeInfo info = {
+            sizeof (XferDestReadfdClass),
+            (GBaseInitFunc) NULL,
+            (GBaseFinalizeFunc) NULL,
+            (GClassInitFunc) dest_readfd_class_init,
+            (GClassFinalizeFunc) NULL,
+            NULL /* class_data */,
+            sizeof (XferDestReadfd),
+            0 /* n_preallocs */,
+            (GInstanceInitFunc) NULL,
+            NULL
+        };
+
+        type = g_type_register_static (XFER_ELEMENT_TYPE, "XferDestReadfd", &info, 0);
+    }
+
+    return type;
+}
+
+/* WRITEFD */
+
+static GType xfer_dest_writefd_get_type(void);
+#define XFER_DEST_WRITEFD_TYPE (xfer_dest_writefd_get_type())
+#define XFER_DEST_WRITEFD(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_dest_writefd_get_type(), XferDestWritefd)
+#define XFER_DEST_WRITEFD_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_dest_writefd_get_type(), XferDestWritefd const)
+#define XFER_DEST_WRITEFD_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), xfer_dest_writefd_get_type(), XferDestWritefdClass)
+#define IS_XFER_DEST_WRITEFD(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), xfer_dest_writefd_get_type ())
+#define XFER_DEST_WRITEFD_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS((obj), xfer_dest_writefd_get_type(), XferDestWritefdClass)
+
+typedef struct XferDestWritefd {
+    XferElement __parent__;
+
+    int read_fd;
+    GThread *thread;
+    simpleprng_state_t prng;
+} XferDestWritefd;
+
+typedef struct {
+    XferElementClass __parent__;
+} XferDestWritefdClass;
+
+static gpointer
+dest_writefd_thread(
+    gpointer data)
+{
+    XferDestWritefd *self = (XferDestWritefd *)data;
+    char buf[TEST_XFER_SIZE];
+    size_t remaining;
+    int fd = self->read_fd;
+
+    remaining = sizeof(buf);
+    while (remaining) {
+       ssize_t nwrite;
+       if ((nwrite = read(fd, buf+sizeof(buf)-remaining, remaining)) <= 0) {
+           error("error in read(): %s", strerror(errno));
+       }
+       remaining -= nwrite;
+    }
+
+    /* we should be at EOF here */
+    if (read(fd, buf, 10) != 0)
+       g_critical("too much data entering XferDestWritefd");
+
+    if (!simpleprng_verify_buffer(&self->prng, buf, TEST_XFER_SIZE))
+       g_critical("data entering XferDestWritefd does not match");
+
+    close(fd);
+    XFER_ELEMENT(self)->upstream->output_fd = -1;
+
+    xfer_queue_message(XFER_ELEMENT(self)->xfer, xmsg_new(XFER_ELEMENT(self), XMSG_DONE, 0));
+
+    return NULL;
+}
+
+static void
+dest_writefd_setup_impl(
+    XferElement *elt)
+{
+    XferDestWritefd *self = (XferDestWritefd *)elt;
+    int p[2];
+
+    simpleprng_seed(&self->prng, RANDOM_SEED);
+
+    if (pipe(p) < 0)
+       g_critical("Error from pipe(): %s", strerror(errno));
+
+    self->read_fd = p[0];
+    XFER_ELEMENT(self)->input_fd = p[1];
+}
+
+static gboolean
+dest_writefd_start_impl(
+    XferElement *elt)
+{
+    XferDestWritefd *self = (XferDestWritefd *)elt;
+    self->thread = g_thread_create(dest_writefd_thread, (gpointer)self, FALSE, NULL);
+
+    return TRUE;
+}
+
+static void
+dest_writefd_class_init(
+    XferDestWritefdClass * klass)
+{
+    XferElementClass *xec = XFER_ELEMENT_CLASS(klass);
+    static xfer_element_mech_pair_t mech_pairs[] = {
+       { XFER_MECH_WRITEFD, XFER_MECH_NONE, 1, 1},
+       { XFER_MECH_NONE, XFER_MECH_NONE, 0, 0},
+    };
+
+    xec->setup = dest_writefd_setup_impl;
+    xec->start = dest_writefd_start_impl;
+    xec->mech_pairs = mech_pairs;
+}
+
+GType
+xfer_dest_writefd_get_type (void)
+{
+    static GType type = 0;
+
+    if G_UNLIKELY(type == 0) {
+        static const GTypeInfo info = {
+            sizeof (XferDestWritefdClass),
+            (GBaseInitFunc) NULL,
+            (GBaseFinalizeFunc) NULL,
+            (GClassInitFunc) dest_writefd_class_init,
+            (GClassFinalizeFunc) NULL,
+            NULL /* class_data */,
+            sizeof (XferDestWritefd),
+            0 /* n_preallocs */,
+            (GInstanceInitFunc) NULL,
+            NULL
+        };
+
+        type = g_type_register_static (XFER_ELEMENT_TYPE, "XferDestWritefd", &info, 0);
+    }
+
+    return type;
+}
+
+/* PUSH_BUFFER */
+
+static GType xfer_dest_push_get_type(void);
+#define XFER_DEST_PUSH_TYPE (xfer_dest_push_get_type())
+#define XFER_DEST_PUSH(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_dest_push_get_type(), XferDestPush)
+#define XFER_DEST_PUSH_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_dest_push_get_type(), XferDestPush const)
+#define XFER_DEST_PUSH_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), xfer_dest_push_get_type(), XferDestPushClass)
+#define IS_XFER_DEST_PUSH(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), xfer_dest_push_get_type ())
+#define XFER_DEST_PUSH_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS((obj), xfer_dest_push_get_type(), XferDestPushClass)
+
+typedef struct XferDestPush {
+    XferElement __parent__;
+
+    char buf[TEST_XFER_SIZE];
+    size_t bufpos;
+
+    GThread *thread;
+    simpleprng_state_t prng;
+} XferDestPush;
+
+typedef struct {
+    XferElementClass __parent__;
+} XferDestPushClass;
+
+static void
+dest_push_push_buffer_impl(
+    XferElement *elt,
+    gpointer buf,
+    size_t size)
+{
+    XferDestPush *self = (XferDestPush *)elt;
+
+    if (buf == NULL) {
+       /* if we're at EOF, verify we got the right bytes */
+       g_assert(self->bufpos == TEST_XFER_SIZE);
+       if (!simpleprng_verify_buffer(&self->prng, self->buf, TEST_XFER_SIZE))
+           g_critical("data entering XferDestPush does not match");
+       return;
+    }
+
+    g_assert(self->bufpos + size <= TEST_XFER_SIZE);
+    memcpy(self->buf + self->bufpos, buf, size);
+    self->bufpos += size;
+}
+
+static void
+dest_push_setup_impl(
+    XferElement *elt)
+{
+    XferDestPush *self = (XferDestPush *)elt;
+
+    simpleprng_seed(&self->prng, RANDOM_SEED);
+}
+
+static void
+dest_push_class_init(
+    XferDestPushClass * klass)
+{
+    XferElementClass *xec = XFER_ELEMENT_CLASS(klass);
+    static xfer_element_mech_pair_t mech_pairs[] = {
+       { XFER_MECH_PUSH_BUFFER, XFER_MECH_NONE, 1, 0},
+       { XFER_MECH_NONE, XFER_MECH_NONE, 0, 0},
+    };
+
+    xec->push_buffer = dest_push_push_buffer_impl;
+    xec->setup = dest_push_setup_impl;
+    xec->mech_pairs = mech_pairs;
+}
+
+GType
+xfer_dest_push_get_type (void)
+{
+    static GType type = 0;
+
+    if G_UNLIKELY(type == 0) {
+        static const GTypeInfo info = {
+            sizeof (XferDestPushClass),
+            (GBaseInitFunc) NULL,
+            (GBaseFinalizeFunc) NULL,
+            (GClassInitFunc) dest_push_class_init,
+            (GClassFinalizeFunc) NULL,
+            NULL /* class_data */,
+            sizeof (XferDestPush),
+            0 /* n_preallocs */,
+            (GInstanceInitFunc) NULL,
+            NULL
+        };
+
+        type = g_type_register_static (XFER_ELEMENT_TYPE, "XferDestPush", &info, 0);
+    }
+
+    return type;
+}
+
+/* PULL_BUFFER */
+
+static GType xfer_dest_pull_get_type(void);
+#define XFER_DEST_PULL_TYPE (xfer_dest_pull_get_type())
+#define XFER_DEST_PULL(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_dest_pull_get_type(), XferDestPull)
+#define XFER_DEST_PULL_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), xfer_dest_pull_get_type(), XferDestPull const)
+#define XFER_DEST_PULL_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), xfer_dest_pull_get_type(), XferDestPullClass)
+#define IS_XFER_DEST_PULL(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), xfer_dest_pull_get_type ())
+#define XFER_DEST_PULL_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS((obj), xfer_dest_pull_get_type(), XferDestPullClass)
+
+typedef struct XferDestPull {
+    XferElement __parent__;
+
+    GThread *thread;
+    simpleprng_state_t prng;
+} XferDestPull;
+
+typedef struct {
+    XferElementClass __parent__;
+} XferDestPullClass;
+
+static gpointer
+dest_pull_thread(
+    gpointer data)
+{
+    XferDestPull *self = (XferDestPull *)data;
+    char fullbuf[TEST_XFER_SIZE];
+    char *buf;
+    size_t bufpos = 0;
+    size_t size;
+
+    while ((buf = xfer_element_pull_buffer(XFER_ELEMENT(self)->upstream, &size))) {
+       g_assert(bufpos + size <= TEST_XFER_SIZE);
+       memcpy(fullbuf + bufpos, buf, size);
+       bufpos += size;
+    }
+
+    /* we're at EOF, so verify we got the right bytes */
+    g_assert(bufpos == TEST_XFER_SIZE);
+    if (!simpleprng_verify_buffer(&self->prng, fullbuf, TEST_XFER_SIZE))
+       g_critical("data entering XferDestPull does not match");
+
+    xfer_queue_message(XFER_ELEMENT(self)->xfer, xmsg_new(XFER_ELEMENT(self), XMSG_DONE, 0));
+
+    return NULL;
+}
+
+static gboolean
+dest_pull_start_impl(
+    XferElement *elt)
+{
+    XferDestPull *self = (XferDestPull *)elt;
+
+    simpleprng_seed(&self->prng, RANDOM_SEED);
+
+    self->thread = g_thread_create(dest_pull_thread, (gpointer)self, FALSE, NULL);
+
+    return TRUE;
+}
+
+static void
+dest_pull_class_init(
+    XferDestPullClass * klass)
+{
+    XferElementClass *xec = XFER_ELEMENT_CLASS(klass);
+    static xfer_element_mech_pair_t mech_pairs[] = {
+       { XFER_MECH_PULL_BUFFER, XFER_MECH_NONE, 1, 1},
+       { XFER_MECH_NONE, XFER_MECH_NONE, 0, 0},
+    };
+
+    xec->start = dest_pull_start_impl;
+    xec->mech_pairs = mech_pairs;
+}
+
+GType
+xfer_dest_pull_get_type (void)
+{
+    static GType type = 0;
+
+    if G_UNLIKELY(type == 0) {
+        static const GTypeInfo info = {
+            sizeof (XferDestPullClass),
+            (GBaseInitFunc) NULL,
+            (GBaseFinalizeFunc) NULL,
+            (GClassInitFunc) dest_pull_class_init,
+            (GClassFinalizeFunc) NULL,
+            NULL /* class_data */,
+            sizeof (XferDestPull),
+            0 /* n_preallocs */,
+            (GInstanceInitFunc) NULL,
+            NULL
+        };
+
+        type = g_type_register_static (XFER_ELEMENT_TYPE, "XferDestPull", &info, 0);
+    }
+
+    return type;
+}
+
+
+/*
+ * Tests
+ */
+
+static void
+test_xfer_generic_callback(
+    gpointer data G_GNUC_UNUSED,
+    XMsg *msg,
+    Xfer *xfer)
+{
+    tu_dbg("Received message %s\n", xmsg_repr(msg));
+
+    switch (msg->type) {
+       case XMSG_DONE:
+           /* are we done? */
+           if (xfer->status == XFER_DONE) {
+               tu_dbg("all elements are done!\n");
+               g_main_loop_quit(default_main_loop());
+           }
+           break;
+
+       default:
+           break;
+    }
+}
+
+/****
+ * Run a simple transfer with some xor filters
+ */
+
+static int
+test_xfer_simple(void)
+{
+    unsigned int i;
+    GSource *src;
+    XferElement *elements[] = {
+       xfer_source_random(100*1024, RANDOM_SEED),
+       xfer_filter_xor('d'),
+       xfer_filter_xor('d'),
+       xfer_dest_null(RANDOM_SEED),
+    };
+
+    Xfer *xfer = xfer_new(elements, sizeof(elements)/sizeof(*elements));
+    src = xfer_get_source(xfer);
+    g_source_set_callback(src, (GSourceFunc)test_xfer_generic_callback, NULL, NULL);
+    g_source_attach(src, NULL);
+    tu_dbg("Transfer: %s\n", xfer_repr(xfer));
+
+    /* unreference the elements */
+    for (i = 0; i < sizeof(elements)/sizeof(*elements); i++) {
+       g_object_unref(elements[i]);
+       g_assert(G_OBJECT(elements[i])->ref_count == 1);
+       elements[i] = NULL;
+    }
+
+    xfer_start(xfer);
+
+    g_main_loop_run(default_main_loop());
+    g_assert(xfer->status == XFER_DONE);
+
+    xfer_unref(xfer);
+
+    return 1;
+}
+
+/****
+ * Run a transfer between two files, with or without filters
+ */
+
+static int
+test_xfer_files(gboolean add_filters)
+{
+    unsigned int i;
+    unsigned int elts;
+    GSource *src;
+    char *in_filename = __FILE__;
+    char *out_filename = "xfer-test.tmp"; /* current directory is writeable */
+    int rfd, wfd;
+    Xfer *xfer;
+    XferElement *elements[4];
+
+    rfd = open(in_filename, O_RDONLY, 0);
+    if (rfd < 0)
+       g_critical("Could not open '%s': %s", in_filename, strerror(errno));
+
+    wfd = open(out_filename, O_WRONLY|O_CREAT, 0777);
+    if (wfd < 0)
+       g_critical("Could not open '%s': %s", out_filename, strerror(errno));
+
+    elts = 0;
+    elements[elts++] = xfer_source_fd(rfd);
+    if (add_filters) {
+       elements[elts++] = xfer_filter_xor(0xab);
+       elements[elts++] = xfer_filter_xor(0xab);
+    }
+    elements[elts++] = xfer_dest_fd(wfd);
+
+    xfer = xfer_new(elements, elts);
+    src = xfer_get_source(xfer);
+    g_source_set_callback(src, (GSourceFunc)test_xfer_generic_callback, NULL, NULL);
+    g_source_attach(src, NULL);
+    tu_dbg("Transfer: %s\n", xfer_repr(xfer));
+
+    /* unreference the elements */
+    for (i = 0; i < elts; i++) {
+       g_object_unref(elements[i]);
+       g_assert(G_OBJECT(elements[i])->ref_count == 1);
+       elements[i] = NULL;
+    }
+
+    xfer_start(xfer);
+
+    g_main_loop_run(default_main_loop());
+    g_assert(xfer->status == XFER_DONE);
+
+    xfer_unref(xfer);
+
+    unlink(out_filename); /* ignore any errors */
+
+    return 1;
+}
+
+static int
+test_xfer_files_simple(void)
+{
+    return test_xfer_files(FALSE);
+}
+
+static int
+test_xfer_files_filter(void)
+{
+    return test_xfer_files(TRUE);
+}
+
+/*****
+ * test each possible combination of source and destination mechansim
+ */
+
+static int
+test_glue_combo(
+    XferElement *source,
+    XferElement *dest)
+{
+    unsigned int i;
+    GSource *src;
+    XferElement *elements[] = { source, dest };
+
+    Xfer *xfer = xfer_new(elements, sizeof(elements)/sizeof(*elements));
+    src = xfer_get_source(xfer);
+    g_source_set_callback(src, (GSourceFunc)test_xfer_generic_callback, NULL, NULL);
+    g_source_attach(src, NULL);
+
+    /* unreference the elements */
+    for (i = 0; i < sizeof(elements)/sizeof(*elements); i++) {
+       g_object_unref(elements[i]);
+       g_assert(G_OBJECT(elements[i])->ref_count == 1);
+       elements[i] = NULL;
+    }
+
+    xfer_start(xfer);
+
+    g_main_loop_run(default_main_loop());
+    g_assert(xfer->status == XFER_DONE);
+
+    xfer_unref(xfer);
+
+    return 1;
+}
+
+#define make_test_glue(n, s, d) static int n(void) \
+{\
+    return test_glue_combo((XferElement *)g_object_new(s, NULL), \
+                          (XferElement *)g_object_new(d, NULL)); \
+}
+make_test_glue(test_glue_READFD_READFD, XFER_SOURCE_READFD_TYPE, XFER_DEST_READFD_TYPE)
+make_test_glue(test_glue_READFD_WRITE, XFER_SOURCE_READFD_TYPE, XFER_DEST_WRITEFD_TYPE)
+make_test_glue(test_glue_READFD_PUSH, XFER_SOURCE_READFD_TYPE, XFER_DEST_PUSH_TYPE)
+make_test_glue(test_glue_READFD_PULL, XFER_SOURCE_READFD_TYPE, XFER_DEST_PULL_TYPE)
+make_test_glue(test_glue_WRITEFD_READFD, XFER_SOURCE_WRITEFD_TYPE, XFER_DEST_READFD_TYPE)
+make_test_glue(test_glue_WRITEFD_WRITE, XFER_SOURCE_WRITEFD_TYPE, XFER_DEST_WRITEFD_TYPE)
+make_test_glue(test_glue_WRITEFD_PUSH, XFER_SOURCE_WRITEFD_TYPE, XFER_DEST_PUSH_TYPE)
+make_test_glue(test_glue_WRITEFD_PULL, XFER_SOURCE_WRITEFD_TYPE, XFER_DEST_PULL_TYPE)
+make_test_glue(test_glue_PUSH_READFD, XFER_SOURCE_PUSH_TYPE, XFER_DEST_READFD_TYPE)
+make_test_glue(test_glue_PUSH_WRITE, XFER_SOURCE_PUSH_TYPE, XFER_DEST_WRITEFD_TYPE)
+make_test_glue(test_glue_PUSH_PUSH, XFER_SOURCE_PUSH_TYPE, XFER_DEST_PUSH_TYPE)
+make_test_glue(test_glue_PUSH_PULL, XFER_SOURCE_PUSH_TYPE, XFER_DEST_PULL_TYPE)
+make_test_glue(test_glue_PULL_READFD, XFER_SOURCE_PULL_TYPE, XFER_DEST_READFD_TYPE)
+make_test_glue(test_glue_PULL_WRITE, XFER_SOURCE_PULL_TYPE, XFER_DEST_WRITEFD_TYPE)
+make_test_glue(test_glue_PULL_PUSH, XFER_SOURCE_PULL_TYPE, XFER_DEST_PUSH_TYPE)
+make_test_glue(test_glue_PULL_PULL, XFER_SOURCE_PULL_TYPE, XFER_DEST_PULL_TYPE)
+
+/*
+ * Main driver
+ */
+
+int
+main(int argc, char **argv)
+{
+    static TestUtilsTest tests[] = {
+       TU_TEST(test_xfer_simple, 10),
+       TU_TEST(test_xfer_files_simple, 10),
+       TU_TEST(test_xfer_files_filter, 10),
+        TU_TEST(test_glue_READFD_READFD, 5),
+        TU_TEST(test_glue_READFD_WRITE, 5),
+        TU_TEST(test_glue_READFD_PUSH, 5),
+        TU_TEST(test_glue_READFD_PULL, 5),
+        TU_TEST(test_glue_WRITEFD_READFD, 5),
+        TU_TEST(test_glue_WRITEFD_WRITE, 5),
+        TU_TEST(test_glue_WRITEFD_PUSH, 5),
+        TU_TEST(test_glue_WRITEFD_PULL, 5),
+        TU_TEST(test_glue_PUSH_READFD, 5),
+        TU_TEST(test_glue_PUSH_WRITE, 5),
+        TU_TEST(test_glue_PUSH_PUSH, 5),
+        TU_TEST(test_glue_PUSH_PULL, 5),
+        TU_TEST(test_glue_PULL_READFD, 5),
+        TU_TEST(test_glue_PULL_WRITE, 5),
+        TU_TEST(test_glue_PULL_PUSH, 5),
+        TU_TEST(test_glue_PULL_PULL, 5),
+       TU_END()
+    };
+
+    glib_init();
+
+    return testutils_run_tests(argc, argv, tests);
+}
diff --git a/xfer-src/xfer.c b/xfer-src/xfer.c
new file mode 100644 (file)
index 0000000..b9b1800
--- /dev/null
@@ -0,0 +1,628 @@
+/*
+ * Copyright (c) 2008 Zmanda, Inc.  All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License version 2.1 as
+ * published by the Free Software Foundation.
+ *
+ * This 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 this library; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+ *
+ * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
+ * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ */
+
+#include "amxfer.h"
+#include "element-glue.h"
+#include "amanda.h"
+
+/* XMsgSource objects are GSource "subclasses" which manage
+ * a queue of messages, delivering those messages via callback
+ * in the mainloop.  Messages can be *sent* from any thread without
+ * any concern for locking, but must only be received in the main
+ * thread, in the default GMainContext.
+ *
+ * An XMsgSource pointer can be cast to a GSource pointer as
+ * necessary.
+ */
+typedef struct XMsgSource {
+    GSource source; /* must be the first element of the struct */
+    Xfer *xfer;
+} XMsgSource;
+
+/* forward prototypes */
+static void xfer_set_status(Xfer *xfer, xfer_status status);
+static XMsgSource *xmsgsource_new(Xfer *xfer);
+static void link_elements(Xfer *xfer);
+
+Xfer *
+xfer_new(
+    XferElement **elements,
+    unsigned int nelements)
+{
+    Xfer *xfer = g_new0(Xfer, 1);
+    unsigned int i;
+
+    g_assert(elements);
+    g_assert(nelements >= 2);
+
+    xfer->status = XFER_INIT;
+    xfer->status_mutex = g_mutex_new();
+    xfer->status_cond = g_cond_new();
+
+    xfer->refcount = 1;
+    xfer->repr = NULL;
+
+    /* Create our message source and corresponding queue */
+    xfer->msg_source = xmsgsource_new(xfer);
+    g_source_ref((GSource *)xfer->msg_source);
+    xfer->queue = g_async_queue_new();
+
+    /* copy the elements in, verifying that they're all XferElement objects */
+    xfer->elements = g_ptr_array_sized_new(nelements);
+    for (i = 0; i < nelements; i++) {
+       g_assert(elements[i] != NULL);
+       g_assert(IS_XFER_ELEMENT(elements[i]));
+       g_assert(elements[i]->xfer == NULL);
+
+       g_ptr_array_add(xfer->elements, (gpointer)elements[i]);
+
+       g_object_ref(elements[i]);
+       elements[i]->xfer = xfer;
+    }
+
+    return xfer;
+}
+
+void
+xfer_ref(
+    Xfer *xfer)
+{
+    ++xfer->refcount;
+}
+
+void
+xfer_unref(
+    Xfer *xfer)
+{
+    unsigned int i;
+    XMsg *msg;
+
+    if (!xfer) return; /* be friendly to NULLs */
+
+    if (--xfer->refcount > 0) return;
+
+    g_assert(xfer != NULL);
+    g_assert(xfer->status == XFER_INIT || xfer->status == XFER_DONE);
+
+    /* Divorce ourselves from the message source */
+    xfer->msg_source->xfer = NULL;
+    g_source_unref((GSource *)xfer->msg_source);
+    xfer->msg_source = NULL;
+
+    /* Try to empty the message queue */
+    while ((msg = (XMsg *)g_async_queue_try_pop(xfer->queue))) {
+       g_warning("Dropping XMsg from %s because the XMsgSource is being destroyed", 
+           xfer_element_repr(msg->elt));
+       xmsg_free(msg);
+    }
+    g_async_queue_unref(xfer->queue);
+
+    g_mutex_free(xfer->status_mutex);
+    g_cond_free(xfer->status_cond);
+
+    /* Free our references to the elements, and also set the 'xfer'
+     * attribute of each to NULL, making them "unattached" (although 
+     * subsequent reuse of elements is untested). */
+    for (i = 0; i < xfer->elements->len; i++) {
+       XferElement *elt = (XferElement *)g_ptr_array_index(xfer->elements, i);
+
+       elt->xfer = NULL;
+       g_object_unref(elt);
+    }
+
+    g_free(xfer);
+}
+
+GSource *
+xfer_get_source(
+    Xfer *xfer)
+{
+    return (GSource *)xfer->msg_source;
+}
+
+void
+xfer_queue_message(
+    Xfer *xfer,
+    XMsg *msg)
+{
+    g_assert(xfer != NULL);
+    g_assert(msg != NULL);
+
+    g_async_queue_push(xfer->queue, (gpointer)msg);
+
+    /* TODO: don't do this if we're in the main thread */
+    g_main_context_wakeup(NULL);
+}
+
+char *
+xfer_repr(
+    Xfer *xfer)
+{
+    unsigned int i;
+
+    if (!xfer->repr) {
+       xfer->repr = newvstrallocf(xfer->repr, "<Xfer@%p (", xfer);
+       for (i = 0; i < xfer->elements->len; i++) {
+           XferElement *elt = (XferElement *)g_ptr_array_index(xfer->elements, i);
+           xfer->repr = newvstralloc(xfer->repr,
+               xfer->repr, (i==0)?"":" -> ", xfer_element_repr(elt), NULL);
+       }
+       xfer->repr = newvstralloc(xfer->repr, xfer->repr, ")>", NULL);
+    }
+
+    return xfer->repr;
+}
+
+void
+xfer_start(
+    Xfer *xfer)
+{
+    unsigned int len;
+    unsigned int i;
+    XferElement *xe;
+
+    g_assert(xfer != NULL);
+    g_assert(xfer->status == XFER_INIT);
+    g_assert(xfer->elements->len >= 2);
+
+    g_debug("Starting %s", xfer_repr(xfer));
+    /* set the status to XFER_START and add a reference to our count, so that
+     * we are not freed while still in operation.  We'll drop this reference
+     * when the status becomes XFER_DONE. */
+    xfer_ref(xfer);
+    xfer->num_active_elements = 0;
+    xfer_set_status(xfer, XFER_START);
+
+    /* check that the first element is an XferSource and the last is an XferDest.
+     * A source is identified by having no input mechanisms. */
+    xe = (XferElement *)g_ptr_array_index(xfer->elements, 0);
+    if (XFER_ELEMENT_GET_CLASS(xe)->mech_pairs[0].input_mech != XFER_MECH_NONE)
+       error("Transfer element 0 is not a transfer source");
+
+    /* Similarly, a destination has no output mechanisms. */
+    xe = (XferElement *)g_ptr_array_index(xfer->elements, xfer->elements->len-1);
+    if (XFER_ELEMENT_GET_CLASS(xe)->mech_pairs[0].output_mech != XFER_MECH_NONE)
+       error("Last transfer element is not a transfer destination");
+
+    /* Link the elements.  This calls error() on failure, and rewrites
+     * xfer->elements */
+    link_elements(xfer);
+
+    /* Tell all elements to set up.  This is done before upstream and downstream
+     * are set so that elements cannot interfere with one another before setup()
+     * is completed. */
+    for (i = 0; i < xfer->elements->len; i++) {
+       XferElement *xe = (XferElement *)g_ptr_array_index(xfer->elements, i);
+       xfer_element_setup(xe);
+    }
+
+    /* Set the upstream and downstream links between elements */
+    len = xfer->elements->len;
+    for (i = 0; i < len; i++) {
+       XferElement *elt = g_ptr_array_index(xfer->elements, i);
+
+       if (i > 0)
+           elt->upstream = g_ptr_array_index(xfer->elements, i-1);
+       if (i < len-1)
+           elt->downstream = g_ptr_array_index(xfer->elements, i+1);
+    }
+
+    /* now tell them all to start, in order from destination to source */
+    for (i = xfer->elements->len; i >= 1; i--) {
+       XferElement *xe = (XferElement *)g_ptr_array_index(xfer->elements, i-1);
+       if (xfer_element_start(xe))
+           xfer->num_active_elements++;
+    }
+
+    /* (note that status can only change in the main thread, so we can be
+     * certain that the status is still XFER_START and we have not yet been
+     * cancelled.  We may have an XMSG_CANCEL already queued up for us, though) */
+    xfer_set_status(xfer, XFER_RUNNING);
+
+    /* If this transfer involves no active processing, then we consider it to
+     * be done already.  We send a "fake" XMSG_DONE from the destination element,
+     * so that all of the usual processing will take place. */
+    if (xfer->num_active_elements == 0) {
+       g_debug("%s has no active elements; generating fake XMSG_DONE", xfer_repr(xfer));
+       xfer->num_active_elements++;
+       xfer_queue_message(xfer,
+           xmsg_new((XferElement *)g_ptr_array_index(xfer->elements, xfer->elements->len-1),
+                    XMSG_DONE, 0));
+    }
+}
+
+void
+xfer_cancel(
+    Xfer *xfer)
+{
+    /* Since xfer_cancel can be called from any thread, we just send a message.
+     * The action takes place when the message is received. */
+    XferElement *src = g_ptr_array_index(xfer->elements, 0);
+    xfer_queue_message(xfer, xmsg_new(src, XMSG_CANCEL, 0));
+}
+
+static void
+xfer_set_status(
+    Xfer *xfer,
+    xfer_status status)
+{
+    if (xfer->status == status) return;
+
+    g_mutex_lock(xfer->status_mutex);
+
+    /* check that this state transition is valid */
+    switch (status) {
+    case XFER_START:
+        g_assert(xfer->status == XFER_INIT);
+        break;
+    case XFER_RUNNING:
+        g_assert(xfer->status == XFER_START);
+        break;
+    case XFER_CANCELLING:
+        g_assert(xfer->status == XFER_RUNNING);
+        break;
+    case XFER_CANCELLED:
+        g_assert(xfer->status == XFER_CANCELLING);
+        break;
+    case XFER_DONE:
+        g_assert(xfer->status == XFER_CANCELLED || xfer->status == XFER_RUNNING);
+        break;
+    case XFER_INIT:
+    default:
+        g_assert_not_reached();
+    }
+
+    xfer->status = status;
+    g_cond_broadcast(xfer->status_cond);
+    g_mutex_unlock(xfer->status_mutex);
+}
+
+/*
+ * Element linking
+ */
+
+/* How is ELT linked? link_recurse uses an array of these to track its progress
+ * and find the optimal overall linkage. */
+typedef struct linkage {
+    XferElement *elt;
+    int elt_idx; /* index into elt's mech_pairs */
+    int glue_idx; /* index into glue pairs for elt's output; -1 = no glue */
+} linkage;
+
+/* Overall state of the recursive linking process */
+typedef struct linking_state {
+    int nlinks; /* number of linkage objects in each array */
+    linkage *cur; /* "current" linkage */
+
+    linkage *best; /* best linkage so far */
+    gint32 best_cost; /* cost for best */
+} linking_state;
+
+/* used for debugging messages */
+static char *
+xfer_mech_name(
+    xfer_mech mech)
+{
+    switch (mech) {
+       case XFER_MECH_NONE: return "NONE";
+       case XFER_MECH_READFD: return "READFD";
+       case XFER_MECH_WRITEFD: return "WRITEFD";
+       case XFER_MECH_PULL_BUFFER: return "PULL_BUFFER";
+       case XFER_MECH_PUSH_BUFFER: return "PUSH_BUFFER";
+       default: return "UNKNOWN";
+    }
+}
+
+/* calculate an integer representing the cost of a mech pair as a
+ * single integer.  OPS_PER_BYTE is the most important metric,
+ * followed by NTHREADS.
+ *
+ * PAIR will be evaluated multiple times.
+ */
+#define PAIR_COST(pair) (((pair).ops_per_byte << 8) + (pair).nthreads)
+
+/* maximum cost */
+#define MAX_COST 0xffffff
+
+/* Generate all possible linkages of elements [idx:nlinks], where
+ * elements [0:idx-1] have cost 'cost' and end with mechanism
+ * 'input_mech'. */
+static void
+link_recurse(
+    linking_state *st,
+    int idx,
+    xfer_mech input_mech,
+    gint32 cost)
+{
+    xfer_element_mech_pair_t *elt_pairs, *glue_pairs;
+    linkage *my;
+
+    /* if we've overrun the previous best cost already, then bail out */
+    if (cost >= st->best_cost)
+       return;
+
+    /* have we linked everything? */
+    if (idx == st->nlinks) {
+       /* if we ended on other than XFER_MECH_NONE, then this is not a
+        * valid transfer */
+       if (input_mech != XFER_MECH_NONE) return;
+
+       /* we already know this has lower cost than the previous best */
+       memcpy(st->best, st->cur, st->nlinks * sizeof(linkage));
+       st->best_cost = cost;
+
+       return;
+    }
+
+    /* recurse for each linkage we can make that starts with input_mech */
+    my = &st->cur[idx];
+    elt_pairs = XFER_ELEMENT_GET_CLASS(my->elt)->mech_pairs;
+    glue_pairs = xfer_element_glue_mech_pairs;
+
+    for (my->elt_idx = 0;
+        elt_pairs[my->elt_idx].input_mech != XFER_MECH_NONE
+        || elt_pairs[my->elt_idx].output_mech != XFER_MECH_NONE;
+        my->elt_idx++) {
+        /* reject this pair if the input mech does not match */
+        if (elt_pairs[my->elt_idx].input_mech != input_mech)
+           continue;
+
+        /* recurse with no glue */
+        my->glue_idx = -1;
+        link_recurse(st, idx+1,
+                     elt_pairs[my->elt_idx].output_mech,
+                     cost + PAIR_COST(elt_pairs[my->elt_idx]));
+
+       /* and recurse with glue */
+       for (my->glue_idx = 0;
+            glue_pairs[my->glue_idx].input_mech != XFER_MECH_NONE
+            || glue_pairs[my->glue_idx].output_mech != XFER_MECH_NONE;
+            my->glue_idx++) {
+           /* reject this glue pair if it doesn't match with the element output */
+           if (glue_pairs[my->glue_idx].input_mech != elt_pairs[my->elt_idx].output_mech)
+               continue;
+
+            /* and recurse with the glue */
+            link_recurse(st, idx+1,
+                         glue_pairs[my->glue_idx].output_mech,
+                         cost + PAIR_COST(elt_pairs[my->elt_idx])
+                              + PAIR_COST(glue_pairs[my->glue_idx]));
+       }
+    }
+}
+
+static void
+link_elements(
+    Xfer *xfer)
+{
+    GPtrArray *new_elements;
+    XferElement *elt;
+    XferElementClass *eltc;
+    char *linkage_str;
+    linking_state st;
+    gint i, len;
+
+    /* Note that this algorithm's running time is polynomial in the length of
+     * the transfer, with a fairly high order.  If Amanda is regularly assembling
+     * transfers with more than, say, 6 elements, then the algorithm should be
+     * redesigned. */
+
+    /* set up the state for recursion */
+    st.nlinks = xfer->elements->len;
+    st.cur = g_new0(linkage, st.nlinks);
+    st.best = g_new0(linkage, st.nlinks);
+    st.best_cost = MAX_COST;
+    for (i = 0; i < st.nlinks; i++) {
+       st.cur[i].elt = (XferElement *)g_ptr_array_index(xfer->elements, i);
+    }
+
+    /* start recursing with the first element, asserting that its input mech is NONE */
+    link_recurse(&st, 0, XFER_MECH_NONE, 0);
+
+    /* check that we got *some* solution */
+    if (st.best_cost == MAX_COST) {
+       error(_("Xfer %s cannot be linked."), xfer_repr(xfer));
+    }
+
+    /* Now create a new list of elements, containing any glue elements
+     * that we need to add, and set their input_mech and output_mech fields */
+    new_elements = g_ptr_array_sized_new(xfer->elements->len);
+    for (i = 0; i < st.nlinks; i++) {
+       elt = st.best[i].elt;
+       eltc = XFER_ELEMENT_GET_CLASS(elt);
+       elt->input_mech = eltc->mech_pairs[st.best[i].elt_idx].input_mech;
+       elt->output_mech = eltc->mech_pairs[st.best[i].elt_idx].output_mech;
+       g_ptr_array_add(new_elements, elt);
+
+       if (st.best[i].glue_idx != -1) {
+           elt = xfer_element_glue();
+           eltc = XFER_ELEMENT_GET_CLASS(elt);
+           elt->xfer = xfer;
+           elt->input_mech = eltc->mech_pairs[st.best[i].glue_idx].input_mech;
+           elt->output_mech = eltc->mech_pairs[st.best[i].glue_idx].output_mech;
+           g_ptr_array_add(new_elements, elt);
+       }
+    }
+
+    /* install the new list of elements */
+    g_ptr_array_free(xfer->elements, FALSE);
+    xfer->elements = new_elements;
+    new_elements = NULL;
+
+    /* debug-log the xfer's linkage */
+    len = xfer->elements->len;
+    linkage_str = stralloc("Final linkage: ");
+    for (i = 0; i < len; i++) {
+       XferElement *elt = g_ptr_array_index(xfer->elements, i);
+
+       if (i == 0)
+           linkage_str = newvstralloc(linkage_str, linkage_str, xfer_element_repr(elt), NULL);
+       else
+           linkage_str = newvstrallocf(linkage_str, "%s -(%s)-> %s",
+               linkage_str, xfer_mech_name(elt->input_mech), xfer_element_repr(elt));
+    }
+    g_debug("%s", linkage_str);
+    amfree(linkage_str);
+
+    amfree(st.cur);
+    amfree(st.best);
+}
+
+/*
+ * XMsgSource
+ */
+
+static gboolean
+xmsgsource_prepare(
+    GSource *source,
+    gint *timeout_)
+{
+    XMsgSource *xms = (XMsgSource *)source;
+
+    *timeout_ = -1;
+    return xms->xfer && g_async_queue_length(xms->xfer->queue) > 0;
+}
+
+static gboolean
+xmsgsource_check(
+    GSource *source)
+{
+    XMsgSource *xms = (XMsgSource *)source;
+
+    return xms->xfer && g_async_queue_length(xms->xfer->queue) > 0;
+}
+
+static gboolean
+xmsgsource_dispatch(
+    GSource *source G_GNUC_UNUSED,
+    GSourceFunc callback,
+    gpointer user_data)
+{
+    XMsgSource *xms = (XMsgSource *)source;
+    Xfer *xfer = xms->xfer;
+    XMsgCallback my_cb = (XMsgCallback)callback;
+    XMsg *msg;
+    gboolean deliver_to_caller;
+    guint i;
+    gboolean xfer_done = FALSE;
+
+    /* we're potentially calling Perl code within this loop, so we have to
+     * check that everything is ok on each iteration of the loop. */
+    while (xfer
+        && xfer->status != XFER_DONE
+        && (msg = (XMsg *)g_async_queue_try_pop(xfer->queue))) {
+
+       /* We get first crack at interpreting messages, before calling the
+        * designated callback. */
+       deliver_to_caller = TRUE;
+       switch (msg->type) {
+           /* Intercept and count DONE messages so that we can determine when
+            * the entire transfer is finished. */
+           case XMSG_DONE:
+               if (--xfer->num_active_elements <= 0) {
+                   /* mark the transfer as done, and take a note to break out
+                    * of this loop after delivering the message to the user */
+                   xfer_set_status(xfer, XFER_DONE);
+                   xfer_done = TRUE;
+               } else {
+                   /* eat this XMSG_DONE, since we expect more */
+                   deliver_to_caller = FALSE;
+               }
+               break;
+
+           case XMSG_CANCEL:
+               if (xfer->status == XFER_CANCELLING || xfer->status == XFER_CANCELLED) {
+                   /* ignore duplicate cancel messages */
+                   deliver_to_caller = FALSE;
+               } else {
+                   /* call cancel() on each child element */
+                   gboolean expect_eof;
+
+                   g_debug("Cancelling %s", xfer_repr(xfer));
+                   xfer_set_status(xfer, XFER_CANCELLING);
+
+                   expect_eof = FALSE;
+                   for (i = 0; i < xfer->elements->len; i++) {
+                       XferElement *elt = (XferElement *)
+                               g_ptr_array_index(xfer->elements, i);
+                       expect_eof = xfer_element_cancel(elt, expect_eof) || expect_eof;
+                   }
+
+                   /* if nothing in the transfer can generate an EOF, then we
+                    * can't cancel this transfer, and we'll just have to wait
+                    * until it's finished.  This may happen, for example, if
+                    * the operating system is copying data for us
+                    * asynchronously */
+                   if (!expect_eof)
+                       g_warning("Transfer %s cannot be cancelled.", xfer_repr(xfer));
+
+                   /* and now we're done cancelling */
+                   xfer_set_status(xfer, XFER_CANCELLED);
+               }
+               break;
+
+           default:
+               break;  /* nothing interesting to do */
+       }
+
+       if (deliver_to_caller) {
+           if (my_cb) {
+               my_cb(user_data, msg, xfer);
+           } else {
+               g_warning("Dropping %s because no callback is set", xmsg_repr(msg));
+           }
+       }
+
+       xmsg_free(msg);
+
+       /* This transfer is done, so kill it and exit the loop */
+       if (xfer_done) {
+           xfer_unref(xfer);
+           xfer = NULL;
+           break;
+       }
+    }
+
+    /* Never automatically un-queue the event source */
+    return TRUE;
+}
+
+XMsgSource *
+xmsgsource_new(
+    Xfer *xfer)
+{
+    static GSourceFuncs *xmsgsource_funcs = NULL;
+    GSource *src;
+    XMsgSource *xms;
+
+    /* initialize these here to avoid a compiler warning */
+    if (!xmsgsource_funcs) {
+       xmsgsource_funcs = g_new0(GSourceFuncs, 1);
+       xmsgsource_funcs->prepare = xmsgsource_prepare;
+       xmsgsource_funcs->check = xmsgsource_check;
+       xmsgsource_funcs->dispatch = xmsgsource_dispatch;
+    }
+
+    src = g_source_new(xmsgsource_funcs, sizeof(XMsgSource));
+    xms = (XMsgSource *)src;
+    xms->xfer = xfer;
+
+    return xms;
+}
diff --git a/xfer-src/xfer.h b/xfer-src/xfer.h
new file mode 100644 (file)
index 0000000..ca265a5
--- /dev/null
@@ -0,0 +1,181 @@
+/*
+ * Copyright (c) 2008 Zmanda, Inc.  All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License version 2.1 as
+ * published by the Free Software Foundation.
+ *
+ * This 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 this library; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+ *
+ * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
+ * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
+ */
+
+/* An Xfer abstracts an active data transfer through the Amanda core.
+ */
+
+#ifndef XFER_H
+#define XFER_H
+
+#include <glib.h>
+
+/* An Xfer represents a flow of data from a source, via zero or more filters,
+ * to a destination.  Sources, filters, and destinations are "transfer elements".
+ * The job of the Xfer is glue together a sequence of elements, and provide a
+ * dispatch point for messages from those elements to the caller.
+ *
+ * Xfers are not implemented as GObjects because there is no reason to subclass an
+ * Xfer or apply any of the other features that come with GObject.
+ */
+
+/* The moment-to-moment state of a transfer */
+typedef enum {
+    XFER_INIT = 1,     /* initializing */
+    XFER_START = 2,    /* starting */
+    XFER_RUNNING = 3,  /* data flowing */
+    XFER_CANCELLING = 4,/* cancellation begun */
+    XFER_CANCELLED = 5, /* all elements cancelled; draining data */
+    XFER_DONE = 6,     /* data no longer flowing */
+} xfer_status;
+
+/* forward declarations */
+struct XferElement;
+struct XMsgSource;
+struct XMsg;
+
+/*
+ * "Class" declaration
+ */
+
+struct Xfer {
+    /* The current status of this transfer.  This is read-only, and 
+     * must only be accessed from the main thread or with status_mutex
+     * held. */
+    xfer_status status;
+
+    /* lock this while checking status in a thread
+     * other than the main thread */
+    GMutex *status_mutex;
+
+    /* and wait on this for status changes */
+    GCond *status_cond;
+
+    /* -- remaining fields are private -- */
+
+    gint refcount;
+
+    /* All transfer elements for this transfer, in order from
+     * source to destination.  This is initialized when the Xfer is
+     * created. */
+    GPtrArray *elements;
+
+    /* temporary string for a representation of this transfer */
+    char *repr;
+
+    /* GSource and queue for incoming messages */
+    struct XMsgSource *msg_source;
+    GAsyncQueue *queue;
+
+    /* Number of active elements remaining (a.k.a. the number of
+     * XMSG_DONE messages to expect) */
+    gint num_active_elements;
+};
+
+typedef struct Xfer Xfer;
+
+/* Note that all functions must be called from the main thread unless
+ * otherwise noted */
+
+/* Create a new Xfer object, which should later be freed with xfref_free.
+ *
+ * This function adds a reference to each element.  The caller should
+ * unreference the elements if it does not intend to use them directly.
+ * The Xfer returned has a refcount of one.
+ *
+ * @param elements: array of pointers to transfer elements, in order from source
+ *     to destination
+ * @param nelements: length of 'elements'
+ * @returns: new Xfer object
+ */
+Xfer *xfer_new(struct XferElement **elements, unsigned int nelements);
+
+/* Increase the reference count of a transfer.
+ *
+ * @param xfer: the transfer
+ */
+void xfer_ref(Xfer *xfer);
+
+/* Decrease the reference count of a transfer, possibly freeing it.  A running
+ * transfer (state neither XFER_INIT nor XFER_DONE) will not be freed.
+ *
+ * @param xfer: the transfer
+ */
+void xfer_unref(Xfer *xfer);
+
+/* Get a GSource which will produce events corresponding to messages from
+ * this transfer.  This is a "peek" operation, so the reference count for the
+ * GSource is not affected.  Note that the same GSource is returned on every
+ * call for a particular transfer.
+ *
+ * @returns: GSource object
+ */
+GSource *xfer_get_source(Xfer *xfer);
+
+/* Typedef for the callback to be set on the GSource returned from
+ * xfer_get_source.
+ */
+typedef void (*XMsgCallback)(gpointer data, struct XMsg *msg, Xfer *xfer);
+
+/* Queue a message for delivery via this transfer's GSource.  This can
+ * be called in any thread.
+ *
+ * @param xfer: the transfer
+ * @param msg: the message to queue
+ */
+void xfer_queue_message(Xfer *xfer, struct XMsg *msg);
+
+/* Get a representation of this transfer.  The string belongs to the transfer, and
+ * will be freed when the transfer is freed.
+ *
+ * @param xfer: the Xfer object
+ * @returns: statically allocated string
+ */
+char *xfer_repr(Xfer *xfer);
+
+/* Start a transfer.  This function will fail with an error message if it is
+ * unable to set up the transfer (e.g., if the elements cannot be connected
+ * correctly).
+ *
+ * @param xfer: the Xfer object
+ */
+void xfer_start(Xfer *xfer);
+
+/* Abort a running transfer.  This essentially tells the source to stop
+ * producing data and allows the remainder of the transfer to "drain".  Thus
+ * the transfer will signal its completion "normally" some time after
+ * xfer_cancel returns.  In particular, the state transitions will occur
+ * as follows:
+ *
+ * - XFER_RUNNING
+ * - xfer_cancel()  (note state may still be XFER_RUNNING on return)
+ * - XFER_CANCELLING
+ * - (individual elements' cancel() methods are invoked)
+ * - XFER_CANCELLED
+ * - (data drains from the transfer)
+ * - XFER_DONE
+ *
+ * This function can be called from any thread at any time.  It will return
+ * without blocking.
+ *
+ * @param xfer: the Xfer object
+ */
+void xfer_cancel(Xfer *xfer);
+
+#endif /* XFER_H */
diff --git a/xfer-src/xmsg.c b/xfer-src/xmsg.c
new file mode 100644 (file)
index 0000000..695041f
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2008 Zmanda, Inc.  All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License version 2.1 as
+ * published by the Free Software Foundation.
+ *
+ * This 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 this library; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+ *
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+ */
+
+#include "amxfer.h"
+#include "amanda.h"
+
+/* TODO: use glib chunk allocator */
+
+/* NOTE TO IMPLEMENTERS:
+ *
+ * When adding a new attribute, make changes in the following places:
+ *  - add the attribute to the XMsg struct in xmsg.h
+ *  - add the attribute to the comments for the appropriate xmsg_types
+ *  - free the attribute in xmsg_free.
+ */
+
+/*
+ * Methods
+ */
+
+XMsg *
+xmsg_new(
+    XferElement *elt,
+    xmsg_type type,
+    int version)
+{
+    XMsg *msg = g_new0(XMsg, 1);
+    msg->elt = elt;
+    msg->type = type;
+    msg->version = version;
+
+    /* messages hold a reference to the XferElement, to avoid dangling
+     * pointers. */
+    g_object_ref((GObject *)elt);
+
+    return msg;
+}
+
+void
+xmsg_free(
+    XMsg *msg)
+{
+    /* unreference the source */
+    g_object_unref((GObject *)msg->elt);
+
+    /* and free any allocated attributes */
+    if (msg->repr) g_free(msg->repr);
+    if (msg->message) g_free(msg->message);
+
+    /* then free the XMsg itself */
+    g_free(msg);
+}
+
+char *
+xmsg_repr(
+    XMsg *msg)
+{
+    if (!msg) return "(nil)"; /* better safe than sorry */
+
+    /* this just shows the "header" fields for now */
+    if (!msg->repr) {
+       char *typ = NULL;
+       switch (msg->type) {
+           case XMSG_INFO: typ = "INFO"; break;
+           case XMSG_ERROR: typ = "ERROR"; break;
+           case XMSG_DONE: typ = "DONE"; break;
+           case XMSG_CANCEL: typ = "CANCEL"; break;
+           default: typ = "**UNKNOWN**"; break;
+       }
+
+       msg->repr = vstrallocf("<XMsg@%p type=XMSG_%s elt=%s version=%d>",
+           msg, typ, xfer_element_repr(msg->elt), msg->version);
+    }
+
+    return msg->repr;
+}
diff --git a/xfer-src/xmsg.h b/xfer-src/xmsg.h
new file mode 100644 (file)
index 0000000..e558e29
--- /dev/null
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2008 Zmanda, Inc.  All Rights Reserved.
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License version 2.1 as
+ * published by the Free Software Foundation.
+ *
+ * This 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 this library; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
+ *
+ * Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
+ * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
+ */
+
+#ifndef XMSG_H
+#define XMSG_H
+
+#include <glib.h>
+#include "xfer-element.h"
+
+/* This module handles transmission of discrete messages from transfer
+ * elements to the transfer master.  Messages have:
+ *   an overall type (xmsg_msg_type)
+ *   a version number
+ *   a source (an XferElement)
+ *   a number of attributes containing the message data
+ *
+ * Extensions to the protocol may add key/value pairs at any time without
+ * affecting old implementations (that is, it is never an error to ignore
+ * an unrecognized key).  Changes to the meaning of, or removal of,
+ * existing keys from a message requires a version increment, which will
+ * preclude older implementations from processing the message.  External
+ * measures (such as amfeatures) should be employed in this case to ensure
+ * backward compatibility.
+ *
+ * The implementation of messages is intended to sacrifice memory consumption
+ * for speed and serializability.  Relatively few messages will exist at any
+ * one time, but over the course of a dump, many messages will be created,
+ * serialized, unserialized, and processed.
+ */
+
+/*
+ * Message types
+ */
+
+/* N.B. -- when adding new message types, add the corresponding case label
+ * to xfer-src/xmsg.c:xmsg_repr() and perl/Amanda/Xfer.swg */
+typedef enum {
+    /* XMSG_INFO: informational messages suitable for display to user. Attributes:
+     *  - message
+     */
+    XMSG_INFO = 1,
+
+    /* XMSG_ERROR: error message from an element.  Attributes:
+     *  - message
+     */
+    XMSG_ERROR = 2,
+
+    /* XMSG_DONE: the transfer is done.  Only one XMSG_DONE message will be
+     * delivered, when all elements are finished.
+     * Attributes:
+     *  (none)
+     */
+    XMSG_DONE = 3,
+
+    /* XMSG_CANCEL: this transfer is being cancelled, but data may still be
+     * "draining" from buffers.  A subsequent XMSG_DONE indicates that the
+     * transfer has actually completed.
+     */
+    XMSG_CANCEL = 4,
+
+} xmsg_type;
+
+/*
+ * Class Declaration
+ */
+
+typedef struct XMsg {
+    /* General header information */
+
+    /* the origin of the message */
+    struct XferElement *elt;
+
+    /* the message's overall type */
+    xmsg_type type;
+
+    /* the message's version number */
+    int version;
+
+    /* internal use only; use xmsg_repr() to get the representation */
+    char *repr;
+
+    /* Attributes. Many of these will be zero or null.  See the xmsg_type
+     * enumeration for a description of the attributes that are set for each
+     * message type.
+     *
+     * Note that any pointer-based attributes (strings, etc.) become owned
+     * by the XMsg object, and will be freed in xmsg_free.  The use of stralloc()
+     * is advised for strings.
+     *
+     * N.B. When adding new attributes, also edit perl/Amanda/Xfer.swg:xmsg_to_sv
+     * so that they will be accessible from Perl. */
+
+    /* free-form string message for display to the users
+     *
+     * This string is always valid UTF-8.  If it contains pathnames from a
+     * bytestring-based filesystem, then non-ASCII bytes will be encoded using
+     * quoted-printable.
+     */
+    char *message;
+} XMsg;
+
+/*
+ * Methods
+ */
+
+/* Create a new XMsg.
+ *
+ * @param elt: element originating this message
+ * @param type: message type
+ * @param version: message version
+ * @return: a new XMsg.
+ */
+XMsg *xmsg_new(
+    XferElement *elt,
+    xmsg_type type,
+    int version);
+
+/* Free all memory associated with an XMsg.
+ *
+ * @param msg: the XMsg
+ */
+void xmsg_free(XMsg *msg);
+
+/* Return a printable representation of an XMsg.  This representation
+ * is stored with the message, and will be freed when the message is
+ * freed.
+ *
+ * @param msg: the XMsg
+ * @return: string representation
+ */
+char *xmsg_repr(XMsg *msg);
+
+#endif