--- /dev/null
+@ECHO off
+REM
+REM Script to create Bacula SQLite tables
+
+ECHO .databases | "@bin_dir_cmd@\sqlite3" %* @working_dir_cmd@\bacula.db
+EXIT /b 0
--- /dev/null
+@ECHO off
+REM
+REM Script to drop Bacula SQLite tables
+
+DEL @working_dir_cmd@\bacula.db
+ECHO SQLite database dropped.
+EXIT /b 0
--- /dev/null
+@ECHO off
+REM
+REM Script to delete the SQLite Bacula database (same as deleting
+REM the tables)
+REM
+
+DEL "@working_dir_cmd@\bacula.db"
+EXIT /b 0
--- /dev/null
+@ECHO off
+REM
+REM Script to grant privileges to the bacula database
+REM
+
+REM nothing to do here
+EXIT /b 0
--- /dev/null
+@ECHO off
+REM
+REM This script dumps your Bacula catalog in ASCII format
+REM It works for MySQL, SQLite, and PostgreSQL
+REM
+REM %1 is the name of the database to be backed up and the name
+REM of the output file (default = bacula
+REM %2 is the user name with which to access the database
+REM (default = bacula).
+REM %3 is the password with which to access the database or "" if no password
+REM (default "")
+REM
+REM
+@ECHO on
+
+DEL /f "@working_dir_cmd@\%1.sql" 2>nul
+
+set MYSQLPASSWORD=
+
+IF NOT "%3"=="" SET MYSQLPASSWORD=--password=%3
+"@SQL_BINDIR@\mysqldump" -u %2 %MYSQLPASSWORD% -f --opt %1 > "@working_dir_cmd@\%1.sql"
+
+@ECHO off
+REM
+REM To read back a MySQL database use:
+REM cd @working_dir_cmd@
+REM rd /s /q @SQL_BINDIR@\..\data\bacula
+REM mysql < bacula.sql
+REM
+REM To read back a SQLite database use:
+REM cd @working_dir_cmd@
+REM del /f bacula.db
+REM sqlite bacula.db < bacula.sql
+REM
+REM To read back a PostgreSQL database use:
+REM cd @working_dir_cmd@
+REM dropdb bacula
+REM createdb bacula
+REM psql bacula < bacula.sql
+REM
+EXIT /b 0
--- /dev/null
+@ECHO off
+REM
+REM This script dumps your Bacula catalog in ASCII format
+REM It works for MySQL, SQLite, and PostgreSQL
+REM
+REM %1 is the name of the database to be backed up and the name
+REM of the output file (default = bacula
+REM %2 is the user name with which to access the database
+REM (default = bacula).
+REM %3 is the password with which to access the database or "" if no password
+REM (default "")
+REM
+REM
+@ECHO on
+
+DEL /f "@working_dir_cmd@\%1.sql" 2>nul
+
+SET PGPASSWORD=
+
+IF NOT "%3"=="" SET PGPASSWORD=--password=%3
+"@SQL_BINDIR@\pg_dump" -c -U %2 %1 >"@working_dir_cmd@\%1.sql"
+
+@ECHO off
+REM
+REM To read back a MySQL database use:
+REM cd @working_dir_cmd@
+REM rd /s /q @SQL_BINDIR@\..\data\bacula
+REM mysql < bacula.sql
+REM
+REM To read back a SQLite database use:
+REM cd @working_dir_cmd@
+REM del /f bacula.db
+REM sqlite bacula.db < bacula.sql
+REM
+REM To read back a PostgreSQL database use:
+REM cd @working_dir_cmd@
+REM dropdb bacula
+REM createdb bacula
+REM psql bacula < bacula.sql
+REM
+EXIT /b 0
--- /dev/null
+@ECHO off
+REM
+REM This script dumps your Bacula catalog in ASCII format
+REM It works for MySQL, SQLite, and PostgreSQL
+REM
+REM %1 is the name of the database to be backed up and the name
+REM of the output file (default = bacula
+REM %2 is the user name with which to access the database
+REM (default = bacula).
+REM %3 is the password with which to access the database or "" if no password
+REM (default "")
+REM
+REM
+@ECHO on
+
+DEL /f "@working_dir_cmd@\%1.sql" 2>nul
+
+ECHO .dump | "@bin_dir_cmd@\sqlite3" %1.db > "@working_dir_cmd@\%1.sql"
+
+@ECHO off
+REM
+REM To read back a MySQL database use:
+REM cd @working_dir_cmd@
+REM rd /s /q @SQL_BINDIR@\..\data\bacula
+REM mysql < bacula.sql
+REM
+REM To read back a SQLite database use:
+REM cd @working_dir_cmd@
+REM del /f bacula.db
+REM sqlite bacula.db < bacula.sql
+REM
+REM To read back a PostgreSQL database use:
+REM cd @working_dir_cmd@
+REM dropdb bacula
+REM createdb bacula
+REM psql bacula < bacula.sql
+REM
+EXIT /b 0
--- /dev/null
+@ECHO off
+REM
+REM Script to create Bacula SQLite tables
+
+"@bin_dir_cmd@\sqlite3" %* "@working_dir_cmd@\bacula.db" < "@bin_dir_cmd@\make_sqlite3_tables.sql"
+
+EXIT /b 0
--- /dev/null
+CREATE TABLE Filename (
+ FilenameId INTEGER,
+ Name TEXT DEFAULT "",
+ PRIMARY KEY(FilenameId)
+ );
+
+CREATE INDEX inx1 ON Filename (Name);
+
+CREATE TABLE Path (
+ PathId INTEGER,
+ Path TEXT DEFAULT "",
+ PRIMARY KEY(PathId)
+ );
+
+CREATE INDEX inx2 ON Path (Path);
+
+
+CREATE TABLE File (
+ FileId INTEGER,
+ FileIndex INTEGER UNSIGNED NOT NULL,
+ JobId INTEGER UNSIGNED REFERENCES Job NOT NULL,
+ PathId INTEGER UNSIGNED REFERENCES Path NOT NULL,
+ FilenameId INTEGER UNSIGNED REFERENCES Filename NOT NULL,
+ MarkId INTEGER UNSIGNED DEFAULT 0,
+ LStat VARCHAR(255) NOT NULL,
+ MD5 VARCHAR(255) NOT NULL,
+ PRIMARY KEY(FileId)
+ );
+
+CREATE INDEX inx3 ON File (JobId);
+CREATE INDEX inx4 ON File (FilenameId, PathId);
+--
+-- Possibly add one or more of the following indexes
+-- if your Verifies are too slow.
+--
+-- CREATE INDEX inx4 ON File (PathId);
+-- CREATE INDEX inx5 ON File (FileNameId);
+-- CREATE INDEX inx9 ON File (JobId, PathId, FilenameId);
+
+CREATE TABLE Job (
+ JobId INTEGER,
+ Job VARCHAR(128) NOT NULL,
+ Name VARCHAR(128) NOT NULL,
+ Type CHAR NOT NULL,
+ Level CHAR NOT NULL,
+ ClientId INTEGER REFERENCES Client DEFAULT 0,
+ JobStatus CHAR NOT NULL,
+ SchedTime DATETIME NOT NULL,
+ StartTime DATETIME DEFAULT 0,
+ EndTime DATETIME DEFAULT 0,
+ RealEndTime DATETIME DEFAULT 0,
+ JobTDate BIGINT UNSIGNED DEFAULT 0,
+ VolSessionId INTEGER UNSIGNED DEFAULT 0,
+ VolSessionTime INTEGER UNSIGNED DEFAULT 0,
+ JobFiles INTEGER UNSIGNED DEFAULT 0,
+ JobBytes BIGINT UNSIGNED DEFAULT 0,
+ JobErrors INTEGER UNSIGNED DEFAULT 0,
+ JobMissingFiles INTEGER UNSIGNED DEFAULT 0,
+ PoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+ FileSetId INTEGER UNSIGNED REFERENCES FileSet DEFAULT 0,
+ PriorJobId INTEGER UNSIGNED REFERENCES Job DEFAULT 0,
+ PurgedFiles TINYINT DEFAULT 0,
+ HasBase TINYINT DEFAULT 0,
+ PRIMARY KEY(JobId)
+ );
+CREATE INDEX inx6 ON Job (Name);
+
+CREATE TABLE Location (
+ LocationId INTEGER,
+ Location TEXT NOT NULL,
+ Cost INTEGER DEFAULT 0,
+ Enabled TINYINT,
+ PRIMARY KEY(LocationId)
+ );
+
+CREATE TABLE LocationLog (
+ LocLogId INTEGER,
+ Date DATETIME NOT NULL,
+ Comment TEXT NOT NULL,
+ MediaId INTEGER UNSIGNED REFERENCES Media DEFAULT 0,
+ LocationId INTEGER UNSIGNED REFERENCES LocationId DEFAULT 0,
+ NewVolStatus VARCHAR(20) NOT NULL,
+ NewEnabled TINYINT NOT NULL,
+ PRIMARY KEY(LocLogId)
+);
+
+
+CREATE TABLE Log (
+ LogId INTEGER,
+ JobId INTEGER UNSIGNED REFERENCES Job NOT NULL,
+ Time DATETIME NOT NULL,
+ LogText TEXT NOT NULL,
+ PRIMARY KEY(LogId)
+ );
+CREATE INDEX LogInx1 ON File (JobId);
+
+
+CREATE TABLE FileSet (
+ FileSetId INTEGER,
+ FileSet VARCHAR(128) NOT NULL,
+ MD5 VARCHAR(25) NOT NULL,
+ CreateTime DATETIME DEFAULT 0,
+ PRIMARY KEY(FileSetId)
+ );
+
+CREATE TABLE JobMedia (
+ JobMediaId INTEGER,
+ JobId INTEGER UNSIGNED REFERENCES Job NOT NULL,
+ MediaId INTEGER UNSIGNED REFERENCES Media NOT NULL,
+ FirstIndex INTEGER UNSIGNED NOT NULL,
+ LastIndex INTEGER UNSIGNED NOT NULL,
+ StartFile INTEGER UNSIGNED DEFAULT 0,
+ EndFile INTEGER UNSIGNED DEFAULT 0,
+ StartBlock INTEGER UNSIGNED DEFAULT 0,
+ EndBlock INTEGER UNSIGNED DEFAULT 0,
+ VolIndex INTEGER UNSIGNED DEFAULT 0,
+ Copy INTEGER UNSIGNED DEFAULT 0,
+ PRIMARY KEY(JobMediaId)
+ );
+
+CREATE INDEX inx7 ON JobMedia (JobId, MediaId);
+
+
+CREATE TABLE Media (
+ MediaId INTEGER,
+ VolumeName VARCHAR(128) NOT NULL,
+ Slot INTEGER DEFAULT 0,
+ PoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+ MediaType VARCHAR(128) NOT NULL,
+ MediaTypeId INTEGER UNSIGNED REFERENCES MediaType DEFAULT 0,
+ LabelType TINYINT DEFAULT 0,
+ FirstWritten DATETIME DEFAULT 0,
+ LastWritten DATETIME DEFAULT 0,
+ LabelDate DATETIME DEFAULT 0,
+ VolJobs INTEGER UNSIGNED DEFAULT 0,
+ VolFiles INTEGER UNSIGNED DEFAULT 0,
+ VolBlocks INTEGER UNSIGNED DEFAULT 0,
+ VolMounts INTEGER UNSIGNED DEFAULT 0,
+ VolBytes BIGINT UNSIGNED DEFAULT 0,
+ VolParts INTEGER UNSIGNED DEFAULT 0,
+ VolErrors INTEGER UNSIGNED DEFAULT 0,
+ VolWrites INTEGER UNSIGNED DEFAULT 0,
+ VolCapacityBytes BIGINT UNSIGNED DEFAULT 0,
+ VolStatus VARCHAR(20) NOT NULL,
+ Enabled TINYINT DEFAULT 1,
+ Recycle TINYINT DEFAULT 0,
+ VolRetention BIGINT UNSIGNED DEFAULT 0,
+ VolUseDuration BIGINT UNSIGNED DEFAULT 0,
+ MaxVolJobs INTEGER UNSIGNED DEFAULT 0,
+ MaxVolFiles INTEGER UNSIGNED DEFAULT 0,
+ MaxVolBytes BIGINT UNSIGNED DEFAULT 0,
+ InChanger TINYINT DEFAULT 0,
+ StorageId INTEGER UNSIGNED REFERENCES Storage DEFAULT 0,
+ DeviceId INTEGER UNSIGNED REFERENCES Device DEFAULT 0,
+ MediaAddressing TINYINT DEFAULT 0,
+ VolReadTime BIGINT UNSIGNED DEFAULT 0,
+ VolWriteTime BIGINT UNSIGNED DEFAULT 0,
+ EndFile INTEGER UNSIGNED DEFAULT 0,
+ EndBlock INTEGER UNSIGNED DEFAULT 0,
+ LocationId INTEGER UNSIGNED REFERENCES Location DEFAULT 0,
+ RecycleCount INTEGER UNSIGNED DEFAULT 0,
+ InitialWrite DATETIME DEFAULT 0,
+ ScratchPoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+ RecyclePoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+ Comment TEXT,
+ PRIMARY KEY(MediaId)
+ );
+
+CREATE INDEX inx8 ON Media (PoolId);
+
+CREATE TABLE MediaType (
+ MediaTypeId INTEGER,
+ MediaType VARCHAR(128) NOT NULL,
+ ReadOnly TINYINT DEFAULT 0,
+ PRIMARY KEY(MediaTypeId)
+ );
+
+CREATE TABLE Storage (
+ StorageId INTEGER,
+ Name VARCHAR(128) NOT NULL,
+ AutoChanger TINYINT DEFAULT 0,
+ PRIMARY KEY(StorageId)
+ );
+
+CREATE TABLE Device (
+ DeviceId INTEGER,
+ Name VARCHAR(128) NOT NULL,
+ MediaTypeId INTEGER UNSIGNED REFERENCES MediaType NOT NULL,
+ StorageId INTEGER UNSIGNED REFERENCES Storage,
+ DevMounts INTEGER UNSIGNED DEFAULT 0,
+ DevReadBytes BIGINT UNSIGNED DEFAULT 0,
+ DevWriteBytes BIGINT UNSIGNED DEFAULT 0,
+ DevReadBytesSinceCleaning BIGINT UNSIGNED DEFAULT 0,
+ DevWriteBytesSinceCleaning BIGINT UNSIGNED DEFAULT 0,
+ DevReadTime BIGINT UNSIGNED DEFAULT 0,
+ DevWriteTime BIGINT UNSIGNED DEFAULT 0,
+ DevReadTimeSinceCleaning BIGINT UNSIGNED DEFAULT 0,
+ DevWriteTimeSinceCleaning BIGINT UNSIGNED DEFAULT 0,
+ CleaningDate DATETIME DEFAULT 0,
+ CleaningPeriod BIGINT UNSIGNED DEFAULT 0,
+ PRIMARY KEY(DeviceId)
+ );
+
+
+CREATE TABLE Pool (
+ PoolId INTEGER,
+ Name VARCHAR(128) NOT NULL,
+ NumVols INTEGER UNSIGNED DEFAULT 0,
+ MaxVols INTEGER UNSIGNED DEFAULT 0,
+ UseOnce TINYINT DEFAULT 0,
+ UseCatalog TINYINT DEFAULT 1,
+ AcceptAnyVolume TINYINT DEFAULT 0,
+ VolRetention BIGINT UNSIGNED DEFAULT 0,
+ VolUseDuration BIGINT UNSIGNED DEFAULT 0,
+ MaxVolJobs INTEGER UNSIGNED DEFAULT 0,
+ MaxVolFiles INTEGER UNSIGNED DEFAULT 0,
+ MaxVolBytes BIGINT UNSIGNED DEFAULT 0,
+ AutoPrune TINYINT DEFAULT 0,
+ Recycle TINYINT DEFAULT 0,
+ PoolType VARCHAR(20) NOT NULL,
+ LabelType TINYINT DEFAULT 0,
+ LabelFormat VARCHAR(128) NOT NULL,
+ Enabled TINYINT DEFAULT 1,
+ ScratchPoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+ RecyclePoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+ NextPoolId INTEGER UNSIGNED REFERENCES Pool DEFAULT 0,
+ MigrationHighBytes BIGINT UNSIGNED DEFAULT 0,
+ MigrationLowBytes BIGINT UNSIGNED DEFAULT 0,
+ MigrationTime BIGINT UNSIGNED DEFAULT 0,
+ UNIQUE (Name),
+ PRIMARY KEY (PoolId)
+ );
+
+
+CREATE TABLE Client (
+ ClientId INTEGER,
+ Name VARCHAR(128) NOT NULL,
+ Uname VARCHAR(255) NOT NULL, -- uname -a field
+ AutoPrune TINYINT DEFAULT 0,
+ FileRetention BIGINT UNSIGNED DEFAULT 0,
+ JobRetention BIGINT UNSIGNED DEFAULT 0,
+ UNIQUE (Name),
+ PRIMARY KEY(ClientId)
+ );
+
+CREATE TABLE BaseFiles (
+ BaseId INTEGER,
+ BaseJobId INTEGER UNSIGNED REFERENCES Job NOT NULL,
+ JobId INTEGER UNSIGNED REFERENCES Job NOT NULL,
+ FileId INTEGER UNSIGNED REFERENCES File NOT NULL,
+ FileIndex INTEGER UNSIGNED,
+ PRIMARY KEY(BaseId)
+ );
+
+CREATE TABLE UnsavedFiles (
+ UnsavedId INTEGER,
+ JobId INTEGER UNSIGNED REFERENCES Job NOT NULL,
+ PathId INTEGER UNSIGNED REFERENCES Path NOT NULL,
+ FilenameId INTEGER UNSIGNED REFERENCES Filename NOT NULL,
+ PRIMARY KEY (UnsavedId)
+ );
+
+
+CREATE TABLE NextId (
+ id INTEGER UNSIGNED DEFAULT 0,
+ TableName TEXT NOT NULL,
+ PRIMARY KEY (TableName)
+ );
+
+
+
+-- Initialize JobId to start at 1
+INSERT INTO NextId (id, TableName) VALUES (1, "Job");
+
+CREATE TABLE Version (
+ VersionId INTEGER UNSIGNED NOT NULL
+ );
+
+
+CREATE TABLE Counters (
+ Counter TEXT NOT NULL,
+ MinValue INTEGER DEFAULT 0,
+ MaxValue INTEGER DEFAULT 0,
+ CurrentValue INTEGER DEFAULT 0,
+ WrapCounter TEXT NOT NULL,
+ PRIMARY KEY (Counter)
+ );
+
+CREATE TABLE CDImages (
+ MediaId INTEGER UNSIGNED NOT NULL,
+ LastBurn DATETIME NOT NULL,
+ PRIMARY KEY (MediaId)
+ );
+
+
+CREATE TABLE Status (
+ JobStatus CHAR(1) NOT NULL,
+ JobStatusLong BLOB,
+ PRIMARY KEY (JobStatus)
+ );
+
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('C', 'Created, not yet running');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('R', 'Running');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('B', 'Blocked');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('T', 'Completed successfully');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('E', 'Terminated with errors');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('e', 'Non-fatal error');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('f', 'Fatal error');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('D', 'Verify found differences');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('A', 'Canceled by user');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('F', 'Waiting for Client');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('S', 'Waiting for Storage daemon');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('m', 'Waiting for new media');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('M', 'Waiting for media mount');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('s', 'Waiting for storage resource');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('j', 'Waiting for job resource');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('c', 'Waiting for client resource');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('d', 'Waiting on maximum jobs');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('t', 'Waiting on start time');
+INSERT INTO Status (JobStatus,JobStatusLong) VALUES
+ ('p', 'Waiting on higher priority jobs');
+
+
+-- Initialize Version
+INSERT INTO Version (VersionId) VALUES (10);
+
+
+PRAGMA default_synchronous = OFF;
+PRAGMA default_cache_size = 10000;
--- /dev/null
+--- /dev/null 1969-12-31 16:00:00.000000000 -0800
++++ Makefile.msvc 2006-11-23 12:38:22.724805900 -0800
+@@ -0,0 +1,136 @@
++#!/usr/make
++#
++# Makefile for SQLITE
++#
++# This is a template makefile for SQLite. Most people prefer to
++# use the autoconf generated "configure" script to generate the
++# makefile automatically. But that does not work for everybody
++# and in every situation. If you are having problems with the
++# "configure" script, you might want to try this makefile as an
++# alternative. Create a copy of this file, edit the parameters
++# below and type "make".
++#
++
++#### The toplevel directory of the source tree. This is the directory
++# that contains this "Makefile.in" and the "configure.in" script.
++#
++TOP = ..
++
++#### C Compiler and options for use in building executables that
++# will run on the platform that is doing the build.
++#
++BCC = cl /Zi /Ox /Gy /MD
++#BCC = /opt/ancic/bin/c89 -0
++
++#### If the target operating system supports the "usleep()" system
++# call, then define the HAVE_USLEEP macro for all C modules.
++#
++USLEEP =
++#USLEEP = -DHAVE_USLEEP=1
++
++#### If you want the SQLite library to be safe for use within a
++# multi-threaded program, then define the following macro
++# appropriately:
++#
++THREADSAFE = -DTHREADSAFE=1
++#THREADSAFE = -DTHREADSAFE=0
++
++#### Specify any extra linker options needed to make the library
++# thread safe
++#
++#THREADLIB = -lpthread
++THREADLIB =
++
++#### Specify any extra libraries needed to access required functions.
++#
++#TLIBS = -lrt # fdatasync on Solaris 8
++TLIBS =
++
++#### Leave SQLITE_DEBUG undefined for maximum speed. Use SQLITE_DEBUG=1
++# to check for memory leaks. Use SQLITE_DEBUG=2 to print a log of all
++# malloc()s and free()s in order to track down memory leaks.
++#
++# SQLite uses some expensive assert() statements in the inner loop.
++# You can make the library go almost twice as fast if you compile
++# with -DNDEBUG=1
++#
++#OPTS = -DSQLITE_DEBUG=2
++#OPTS = -DSQLITE_DEBUG=1
++#OPTS =
++OPTS = -DNDEBUG=1 -D_CRT_SECURE_NO_DEPRECATE
++#OPTS += -DHAVE_FDATASYNC=1
++
++#### The suffix to add to executable files. ".exe" for windows.
++# Nothing for unix.
++#
++EXE = .exe
++#EXE =
++
++#### C Compile and options for use in building executables that
++# will run on the target platform. This is usually the same
++# as BCC, unless you are cross-compiling.
++#
++#TCC = gcc -O6
++#TCC = gcc -g -O0 -Wall
++#TCC = gcc -g -O0 -Wall -fprofile-arcs -ftest-coverage
++#TCC = /opt/mingw/bin/i386-mingw32-gcc -O6
++#TCC = /opt/ansic/bin/c89 -O +z -Wl,-a,archive
++TCC = cl /Zi /Ox /Gy /MD
++
++#### Tools used to build a static library.
++#
++AR = lib
++#AR = /opt/mingw/bin/i386-mingw32-ar cr
++#RANLIB = ranlib
++#RANLIB = /opt/mingw/bin/i386-mingw32-ranlib
++
++#MKSHLIB = gcc -shared
++#SO = so
++#SHPREFIX = lib
++SO = dll
++SHPREFIX =
++
++#### Extra compiler options needed for programs that use the TCL library.
++#
++#TCL_FLAGS =
++#TCL_FLAGS = -DSTATIC_BUILD=1
++#TCL_FLAGS = -I/home/drh/tcltk/8.4linux
++#TCL_FLAGS = -I/home/drh/tcltk/8.4win -DSTATIC_BUILD=1
++#TCL_FLAGS = -I/home/drh/tcltk/8.3hpux
++
++#### Linker options needed to link against the TCL library.
++#
++#LIBTCL = -ltcl -lm -ldl
++#LIBTCL = /home/drh/tcltk/8.4linux/libtcl8.4g.a -lm -ldl
++#LIBTCL = /home/drh/tcltk/8.4win/libtcl84s.a -lmsvcrt
++#LIBTCL = /home/drh/tcltk/8.3hpux/libtcl8.3.a -ldld -lm -lc
++
++#### Compiler options needed for programs that use the readline() library.
++#
++READLINE_FLAGS =
++#READLINE_FLAGS = -DHAVE_READLINE=1 -I/usr/include/readline
++
++#### Linker options needed by programs using readline() must link against.
++#
++LIBREADLINE =
++#LIBREADLINE = -static -lreadline -ltermcap
++
++#### Should the database engine assume text is coded as UTF-8 or iso8859?
++#
++ENCODING = UTF8
++#ENCODING = ISO8859
++
++
++#### Which "awk" program provides nawk compatibilty
++#
++NAWK = nawk
++# NAWK = awk
++
++#### Where to install
++BINDIR = /usr/bin
++LIBDIR = /usr/lib
++INCDIR = /usr/include
++
++# You should not have to change anything below this line
++###############################################################################
++include ../main.mk.msvc
+--- /dev/null 1969-12-31 16:00:00.000000000 -0800
++++ main.mk.msvc 2006-11-23 12:38:22.709180800 -0800
+@@ -0,0 +1,619 @@
++###############################################################################
++# The following macros should be defined before this script is
++# invoked:
++#
++# TOP The toplevel directory of the source tree. This is the
++# directory that contains this "Makefile.in" and the
++# "configure.in" script.
++#
++# BCC C Compiler and options for use in building executables that
++# will run on the platform that is doing the build.
++#
++# USLEEP If the target operating system supports the "usleep()" system
++# call, then define the HAVE_USLEEP macro for all C modules.
++#
++# THREADSAFE If you want the SQLite library to be safe for use within a
++# multi-threaded program, then define the following macro
++# appropriately:
++#
++# THREADLIB Specify any extra linker options needed to make the library
++# thread safe
++#
++# OPTS Extra compiler command-line options.
++#
++# EXE The suffix to add to executable files. ".exe" for windows
++# and "" for Unix.
++#
++# TCC C Compiler and options for use in building executables that
++# will run on the target platform. This is usually the same
++# as BCC, unless you are cross-compiling.
++#
++# AR Tools used to build a static library.
++# RANLIB
++#
++# TCL_FLAGS Extra compiler options needed for programs that use the
++# TCL library.
++#
++# LIBTCL Linker options needed to link against the TCL library.
++#
++# READLINE_FLAGS Compiler options needed for programs that use the
++# readline() library.
++#
++# LIBREADLINE Linker options needed by programs using readline() must
++# link against.
++#
++# NAWK Nawk compatible awk program. Older (obsolete?) solaris
++# systems need this to avoid using the original AT&T AWK.
++#
++# Once the macros above are defined, the rest of this make script will
++# build the SQLite library and testing tools.
++################################################################################
++
++# This is how we compile
++#
++TCCX = $(TCC) $(OPTS) $(THREADSAFE) $(USLEEP) -I. -I$(TOP)/src
++
++# Object files for the SQLite library.
++#
++LIBOBJ = alter.obj analyze.obj attach.obj auth.obj btree.obj build.obj \
++ callback.obj complete.obj date.obj delete.obj \
++ expr.obj func.obj hash.obj insert.obj loadext.obj \
++ main.obj opcodes.obj os.obj os_os2.obj os_unix.obj os_win.obj \
++ pager.obj parse.obj pragma.obj prepare.obj printf.obj random.obj \
++ select.obj table.obj tokenize.obj trigger.obj \
++ update.obj util.obj vacuum.obj \
++ vdbe.obj vdbeapi.obj vdbeaux.obj vdbefifo.obj vdbemem.obj \
++ where.obj utf.obj legacy.obj vtab.obj
++# tclsqlite.obj
++
++#
++# All of the source code files.
++#
++SRC = \
++ $(TOP)/src/alter.c \
++ $(TOP)/src/analyze.c \
++ $(TOP)/src/attach.c \
++ $(TOP)/src/auth.c \
++ $(TOP)/src/btree.c \
++ $(TOP)/src/btree.h \
++ $(TOP)/src/build.c \
++ $(TOP)/src/callback.c \
++ $(TOP)/src/complete.c \
++ $(TOP)/src/date.c \
++ $(TOP)/src/delete.c \
++ $(TOP)/src/expr.c \
++ $(TOP)/src/func.c \
++ $(TOP)/src/hash.c \
++ $(TOP)/src/hash.h \
++ $(TOP)/src/insert.c \
++ $(TOP)/src/legacy.c \
++ $(TOP)/src/loadext.c \
++ $(TOP)/src/main.c \
++ $(TOP)/src/os.c \
++ $(TOP)/src/os_os2.c \
++ $(TOP)/src/os_unix.c \
++ $(TOP)/src/os_win.c \
++ $(TOP)/src/pager.c \
++ $(TOP)/src/pager.h \
++ $(TOP)/src/parse.y \
++ $(TOP)/src/pragma.c \
++ $(TOP)/src/prepare.c \
++ $(TOP)/src/printf.c \
++ $(TOP)/src/random.c \
++ $(TOP)/src/select.c \
++ $(TOP)/src/shell.c \
++ $(TOP)/src/sqlite.h.in \
++ $(TOP)/src/sqliteInt.h \
++ $(TOP)/src/table.c \
++ $(TOP)/src/tclsqlite.c \
++ $(TOP)/src/tokenize.c \
++ $(TOP)/src/trigger.c \
++ $(TOP)/src/utf.c \
++ $(TOP)/src/update.c \
++ $(TOP)/src/util.c \
++ $(TOP)/src/vacuum.c \
++ $(TOP)/src/vdbe.c \
++ $(TOP)/src/vdbe.h \
++ $(TOP)/src/vdbeapi.c \
++ $(TOP)/src/vdbeaux.c \
++ $(TOP)/src/vdbefifo.c \
++ $(TOP)/src/vdbemem.c \
++ $(TOP)/src/vdbeInt.h \
++ $(TOP)/src/vtab.c \
++ $(TOP)/src/where.c
++
++# Source code for extensions
++#
++SRC = \
++ $(TOP)/ext/fts1/fts1.c \
++ $(TOP)/ext/fts1/fts1.h \
++ $(TOP)/ext/fts1/fts1_hash.c \
++ $(TOP)/ext/fts1/fts1_hash.h \
++ $(TOP)/ext/fts1/fts1_porter.c \
++ $(TOP)/ext/fts1/fts1_tokenizer.h \
++ $(TOP)/ext/fts1/fts1_tokenizer1.c
++
++
++# Source code to the test files.
++#
++TESTSRC = \
++ $(TOP)/src/btree.c \
++ $(TOP)/src/date.c \
++ $(TOP)/src/func.c \
++ $(TOP)/src/main.c \
++ $(TOP)/src/os.c \
++ $(TOP)/src/os_os2.c \
++ $(TOP)/src/os_unix.c \
++ $(TOP)/src/os_win.c \
++ $(TOP)/src/pager.c \
++ $(TOP)/src/pragma.c \
++ $(TOP)/src/printf.c \
++ $(TOP)/src/test1.c \
++ $(TOP)/src/test2.c \
++ $(TOP)/src/test3.c \
++ $(TOP)/src/test4.c \
++ $(TOP)/src/test5.c \
++ $(TOP)/src/test6.c \
++ $(TOP)/src/test7.c \
++ $(TOP)/src/test8.c \
++ $(TOP)/src/test_autoext.c \
++ $(TOP)/src/test_async.c \
++ $(TOP)/src/test_md5.c \
++ $(TOP)/src/test_schema.c \
++ $(TOP)/src/test_server.c \
++ $(TOP)/src/test_tclvar.c \
++ $(TOP)/src/utf.c \
++ $(TOP)/src/util.c \
++ $(TOP)/src/vdbe.c \
++ $(TOP)/src/vdbeaux.c \
++ $(TOP)/src/where.c
++
++# Header files used by all library source files.
++#
++HDR = \
++ sqlite3.h \
++ $(TOP)/src/btree.h \
++ $(TOP)/src/hash.h \
++ opcodes.h \
++ $(TOP)/src/os.h \
++ $(TOP)/src/os_common.h \
++ $(TOP)/src/sqlite3ext.h \
++ $(TOP)/src/sqliteInt.h \
++ $(TOP)/src/vdbe.h \
++ parse.h
++
++# Header files used by extensions
++#
++HDR = \
++ $(TOP)/ext/fts1/fts1.h \
++ $(TOP)/ext/fts1/fts1_hash.h \
++ $(TOP)/ext/fts1/fts1_tokenizer.h
++
++
++# Header files used by the VDBE submodule
++#
++VDBEHDR = \
++ $(HDR) \
++ $(TOP)/src/vdbeInt.h
++
++# This is the default Makefile target. The objects listed here
++# are what get build when you type just "make" with no arguments.
++#
++all: sqlite3.h parse.h opcodes.h sqlite3.lib sqlite3$(EXE)
++
++# Generate the file "last_change" which contains the date of change
++# of the most recently modified source code file
++#
++last_change: $(SRC)
++ cat $(SRC) | grep '$Id: ' | sort -k 5 | tail -1 \
++ | $(NAWK) '{print $5,$6}' >last_change
++
++sqlite3.lib: $(LIBOBJ)
++ $(AR) /out:sqlite3.lib $(LIBOBJ)
++
++sqlite3$(EXE): $(TOP)/src/shell.c sqlite3.lib sqlite3.h
++ $(TCCX) $(READLINE_FLAGS) /Fesqlite3$(EXE) $(TOP)/src/shell.c \
++ sqlite3.lib $(LIBREADLINE) $(TLIBS) $(THREADLIB)
++
++objects: $(LIBOBJ_ORIG)
++
++# This target creates a directory named "tsrc" and fills it with
++# copies of all of the C source code and header files needed to
++# build on the target system. Some of the C source code and header
++# files are automatically generated. This target takes care of
++# all that automatic generation.
++#
++target_source: $(SRC) $(VDBEHDR) opcodes.c keywordhash.h
++ rd /s /q tsrc
++ mkdir tsrc
++ copy $(SRC) $(VDBEHDR) tsrc
++ del tsrc\sqlite.h.in tsrc\parse.y
++ copy parse.c opcodes.c keywordhash.h tsrc
++
++# Rules to build the LEMON compiler generator
++#
++lemon: $(TOP)/tool/lemon.c $(TOP)/tool/lempar.c
++ $(BCC) /Felemon $(OPTS) $(TOP)/tool/lemon.c
++ copy $(TOP)\tool\lempar.c .
++
++# Rules to build individual files
++#
++alter.obj: $(TOP)/src/alter.c $(HDR)
++ $(TCCX) -c $(TOP)/src/alter.c
++
++analyze.obj: $(TOP)/src/analyze.c $(HDR)
++ $(TCCX) -c $(TOP)/src/analyze.c
++
++attach.obj: $(TOP)/src/attach.c $(HDR)
++ $(TCCX) -c $(TOP)/src/attach.c
++
++auth.obj: $(TOP)/src/auth.c $(HDR)
++ $(TCCX) -c $(TOP)/src/auth.c
++
++btree.obj: $(TOP)/src/btree.c $(HDR) $(TOP)/src/pager.h
++ $(TCCX) -c $(TOP)/src/btree.c
++
++build.obj: $(TOP)/src/build.c $(HDR)
++ $(TCCX) -c $(TOP)/src/build.c
++
++callback.obj: $(TOP)/src/callback.c $(HDR)
++ $(TCCX) -c $(TOP)/src/callback.c
++
++complete.obj: $(TOP)/src/complete.c $(HDR)
++ $(TCCX) -c $(TOP)/src/complete.c
++
++date.obj: $(TOP)/src/date.c $(HDR)
++ $(TCCX) -c $(TOP)/src/date.c
++
++delete.obj: $(TOP)/src/delete.c $(HDR)
++ $(TCCX) -c $(TOP)/src/delete.c
++
++expr.obj: $(TOP)/src/expr.c $(HDR)
++ $(TCCX) -c $(TOP)/src/expr.c
++
++func.obj: $(TOP)/src/func.c $(HDR)
++ $(TCCX) -c $(TOP)/src/func.c
++
++hash.obj: $(TOP)/src/hash.c $(HDR)
++ $(TCCX) -c $(TOP)/src/hash.c
++
++insert.obj: $(TOP)/src/insert.c $(HDR)
++ $(TCCX) -c $(TOP)/src/insert.c
++
++legacy.obj: $(TOP)/src/legacy.c $(HDR)
++ $(TCCX) -c $(TOP)/src/legacy.c
++
++loadext.obj: $(TOP)/src/loadext.c $(HDR)
++ $(TCCX) -c $(TOP)/src/loadext.c
++
++main.obj: $(TOP)/src/main.c $(HDR)
++ $(TCCX) -c $(TOP)/src/main.c
++
++pager.obj: $(TOP)/src/pager.c $(HDR) $(TOP)/src/pager.h
++ $(TCCX) -c $(TOP)/src/pager.c
++
++opcodes.obj: opcodes.c
++ $(TCCX) -c opcodes.c
++
++opcodes.c: opcodes.h $(TOP)/mkopcodec.awk
++ sort -n -b -k 3 opcodes.h | $(NAWK) -f $(TOP)/mkopcodec.awk >opcodes.c
++
++opcodes.h: parse.h $(TOP)/src/vdbe.c $(TOP)/mkopcodeh.awk
++ copy parse.h+$(TOP)\src\vdbe.c input.tmp
++ $(NAWK) -f $(TOP)/mkopcodeh.awk <input.tmp >opcodes.h
++ del input.tmp
++
++os.obj: $(TOP)/src/os.c $(HDR)
++ $(TCCX) -c $(TOP)/src/os.c
++
++os_os2.obj: $(TOP)/src/os_os2.c $(HDR)
++ $(TCCX) -c $(TOP)/src/os_os2.c
++
++os_unix.obj: $(TOP)/src/os_unix.c $(HDR)
++ $(TCCX) -c $(TOP)/src/os_unix.c
++
++os_win.obj: $(TOP)/src/os_win.c $(HDR)
++ $(TCCX) -c $(TOP)/src/os_win.c
++
++parse.obj: parse.c $(HDR)
++ $(TCCX) -c parse.c
++
++#parse.h: parse.c
++
++parse.c parse.h: $(TOP)/src/parse.y lemon $(TOP)/addopcodes.awk
++ copy $(TOP)\src\parse.y .
++ lemon $(OPTS) parse.y
++ ren parse.h parse.h.temp
++ nawk -f $(TOP)/addopcodes.awk parse.h.temp >parse.h
++ del parse.h.temp
++
++pragma.obj: $(TOP)/src/pragma.c $(HDR)
++ $(TCCX) $(TCL_FLAGS) -c $(TOP)/src/pragma.c
++
++prepare.obj: $(TOP)/src/prepare.c $(HDR)
++ $(TCCX) $(TCL_FLAGS) -c $(TOP)/src/prepare.c
++
++printf.obj: $(TOP)/src/printf.c $(HDR)
++ $(TCCX) $(TCL_FLAGS) -c $(TOP)/src/printf.c
++
++random.obj: $(TOP)/src/random.c $(HDR)
++ $(TCCX) -c $(TOP)/src/random.c
++
++select.obj: $(TOP)/src/select.c $(HDR)
++ $(TCCX) -c $(TOP)/src/select.c
++
++sqlite3.h: $(TOP)/src/sqlite.h.in
++ ..\update_ver $(TOP)\src\sqlite.h.in >sqlite3.h
++
++table.obj: $(TOP)/src/table.c $(HDR)
++ $(TCCX) -c $(TOP)/src/table.c
++
++tclsqlite.obj: $(TOP)/src/tclsqlite.c $(HDR)
++ $(TCCX) $(TCL_FLAGS) -c $(TOP)/src/tclsqlite.c
++
++tokenize.obj: $(TOP)/src/tokenize.c keywordhash.h $(HDR)
++ $(TCCX) -c $(TOP)/src/tokenize.c
++
++keywordhash.h: $(TOP)/tool/mkkeywordhash.c
++ $(BCC) /Femkkeywordhash $(OPTS) $(TOP)/tool/mkkeywordhash.c
++ mkkeywordhash >keywordhash.h
++
++trigger.obj: $(TOP)/src/trigger.c $(HDR)
++ $(TCCX) -c $(TOP)/src/trigger.c
++
++update.obj: $(TOP)/src/update.c $(HDR)
++ $(TCCX) -c $(TOP)/src/update.c
++
++utf.obj: $(TOP)/src/utf.c $(HDR)
++ $(TCCX) -c $(TOP)/src/utf.c
++
++util.obj: $(TOP)/src/util.c $(HDR)
++ $(TCCX) -c $(TOP)/src/util.c
++
++vacuum.obj: $(TOP)/src/vacuum.c $(HDR)
++ $(TCCX) -c $(TOP)/src/vacuum.c
++
++vdbe.obj: $(TOP)/src/vdbe.c $(VDBEHDR)
++ $(TCCX) -c $(TOP)/src/vdbe.c
++
++vdbeapi.obj: $(TOP)/src/vdbeapi.c $(VDBEHDR)
++ $(TCCX) -c $(TOP)/src/vdbeapi.c
++
++vdbeaux.obj: $(TOP)/src/vdbeaux.c $(VDBEHDR)
++ $(TCCX) -c $(TOP)/src/vdbeaux.c
++
++vdbefifo.obj: $(TOP)/src/vdbefifo.c $(VDBEHDR)
++ $(TCCX) -c $(TOP)/src/vdbefifo.c
++
++vdbemem.obj: $(TOP)/src/vdbemem.c $(VDBEHDR)
++ $(TCCX) -c $(TOP)/src/vdbemem.c
++
++vtab.obj: $(TOP)/src/vtab.c $(VDBEHDR)
++ $(TCCX) -c $(TOP)/src/vtab.c
++
++where.obj: $(TOP)/src/where.c $(HDR)
++ $(TCCX) -c $(TOP)/src/where.c
++
++# Rules for building test programs and for running tests
++#
++tclsqlite3: $(TOP)/src/tclsqlite.c sqlite3.lib
++ $(TCCX) $(TCL_FLAGS) -DTCLSH=1 /Fetclsqlite3 \
++ $(TOP)/src/tclsqlite.c sqlite3.lib $(LIBTCL) $(THREADLIB)
++
++testfixture$(EXE): $(TOP)/src/tclsqlite.c sqlite3.lib $(TESTSRC)
++ $(TCCX) $(TCL_FLAGS) -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_CRASH_TEST=1 \
++ -DSQLITE_SERVER=1 /Fetestfixture$(EXE) \
++ $(TESTSRC) $(TOP)/src/tclsqlite.c \
++ sqlite3.lib $(LIBTCL) $(THREADLIB)
++
++fulltest: testfixture$(EXE) sqlite3$(EXE)
++ testfixture$(EXE) $(TOP)/test/all.test
++
++test: testfixture$(EXE) sqlite3$(EXE)
++ testfixture$(EXE) $(TOP)/test/quick.test
++
++sqlite3_analyzer$(EXE): $(TOP)/src/tclsqlite.c sqlite3.lib $(TESTSRC) \
++ $(TOP)/tool/spaceanal.tcl
++ sed \
++ -e '/^#/d' \
++ -e 's,\\,\\\\,g' \
++ -e 's,",\\",g' \
++ -e 's,^,",' \
++ -e 's,$$,\\n",' \
++ $(TOP)/tool/spaceanal.tcl >spaceanal_tcl.h
++ $(TCCX) $(TCL_FLAGS) -DTCLSH=2 -DSQLITE_TEST=1 -DSQLITE_DEBUG=1 \
++ /Fesqlite3_analyzer$(EXE) $(TESTSRC) $(TOP)/src/tclsqlite.c \
++ sqlite3.lib $(LIBTCL) $(THREADLIB)
++
++TEST_EXTENSION = $(SHPREFIX)testloadext.$(SO)
++$(TEST_EXTENSION): $(TOP)/src/test_loadext.c
++ $(MKSHLIB) $(TOP)/src/test_loadext.c /Fe$(TEST_EXTENSION)
++
++extensiontest: testfixture$(EXE) $(TEST_EXTENSION)
++ testfixture$(EXE) $(TOP)/test/loadext.test
++
++# Rules used to build documentation
++#
++arch.html: $(TOP)/www/arch.tcl
++ tclsh $(TOP)/www/arch.tcl >arch.html
++
++autoinc.html: $(TOP)/www/autoinc.tcl
++ tclsh $(TOP)/www/autoinc.tcl >autoinc.html
++
++c_interface.html: $(TOP)/www/c_interface.tcl
++ tclsh $(TOP)/www/c_interface.tcl >c_interface.html
++
++capi3.html: $(TOP)/www/capi3.tcl
++ tclsh $(TOP)/www/capi3.tcl >capi3.html
++
++capi3ref.html: $(TOP)/www/capi3ref.tcl
++ tclsh $(TOP)/www/capi3ref.tcl >capi3ref.html
++
++changes.html: $(TOP)/www/changes.tcl
++ tclsh $(TOP)/www/changes.tcl >changes.html
++
++compile.html: $(TOP)/www/compile.tcl
++ tclsh $(TOP)/www/compile.tcl >compile.html
++
++copyright.html: $(TOP)/www/copyright.tcl
++ tclsh $(TOP)/www/copyright.tcl >copyright.html
++
++copyright-release.html: $(TOP)/www/copyright-release.html
++ copy $(TOP)/www/copyright-release.html .
++
++copyright-release.pdf: $(TOP)/www/copyright-release.pdf
++ copy $(TOP)/www/copyright-release.pdf .
++
++common.tcl: $(TOP)/www/common.tcl
++ copy $(TOP)/www/common.tcl .
++
++conflict.html: $(TOP)/www/conflict.tcl
++ tclsh $(TOP)/www/conflict.tcl >conflict.html
++
++datatypes.html: $(TOP)/www/datatypes.tcl
++ tclsh $(TOP)/www/datatypes.tcl >datatypes.html
++
++datatype3.html: $(TOP)/www/datatype3.tcl
++ tclsh $(TOP)/www/datatype3.tcl >datatype3.html
++
++different.html: $(TOP)/www/different.tcl
++ tclsh $(TOP)/www/different.tcl >different.html
++
++docs.html: $(TOP)/www/docs.tcl
++ tclsh $(TOP)/www/docs.tcl >docs.html
++
++download.html: $(TOP)/www/download.tcl
++ mkdir -p doc
++ tclsh $(TOP)/www/download.tcl >download.html
++
++faq.html: $(TOP)/www/faq.tcl
++ tclsh $(TOP)/www/faq.tcl >faq.html
++
++fileformat.html: $(TOP)/www/fileformat.tcl
++ tclsh $(TOP)/www/fileformat.tcl >fileformat.html
++
++formatchng.html: $(TOP)/www/formatchng.tcl
++ tclsh $(TOP)/www/formatchng.tcl >formatchng.html
++
++index.html: $(TOP)/www/index.tcl last_change
++ tclsh $(TOP)/www/index.tcl >index.html
++
++lang.html: $(TOP)/www/lang.tcl
++ tclsh $(TOP)/www/lang.tcl doc >lang.html
++
++pragma.html: $(TOP)/www/pragma.tcl
++ tclsh $(TOP)/www/pragma.tcl >pragma.html
++
++lockingv3.html: $(TOP)/www/lockingv3.tcl
++ tclsh $(TOP)/www/lockingv3.tcl >lockingv3.html
++
++sharedcache.html: $(TOP)/www/sharedcache.tcl
++ tclsh $(TOP)/www/sharedcache.tcl >sharedcache.html
++
++mingw.html: $(TOP)/www/mingw.tcl
++ tclsh $(TOP)/www/mingw.tcl >mingw.html
++
++nulls.html: $(TOP)/www/nulls.tcl
++ tclsh $(TOP)/www/nulls.tcl >nulls.html
++
++oldnews.html: $(TOP)/www/oldnews.tcl
++ tclsh $(TOP)/www/oldnews.tcl >oldnews.html
++
++omitted.html: $(TOP)/www/omitted.tcl
++ tclsh $(TOP)/www/omitted.tcl >omitted.html
++
++opcode.html: $(TOP)/www/opcode.tcl $(TOP)/src/vdbe.c
++ tclsh $(TOP)/www/opcode.tcl $(TOP)/src/vdbe.c >opcode.html
++
++optimizer.html: $(TOP)/www/optimizer.tcl
++ tclsh $(TOP)/www/optimizer.tcl >optimizer.html
++
++optoverview.html: $(TOP)/www/optoverview.tcl
++ tclsh $(TOP)/www/optoverview.tcl >optoverview.html
++
++quickstart.html: $(TOP)/www/quickstart.tcl
++ tclsh $(TOP)/www/quickstart.tcl >quickstart.html
++
++speed.html: $(TOP)/www/speed.tcl
++ tclsh $(TOP)/www/speed.tcl >speed.html
++
++sqlite.html: $(TOP)/www/sqlite.tcl
++ tclsh $(TOP)/www/sqlite.tcl >sqlite.html
++
++support.html: $(TOP)/www/support.tcl
++ tclsh $(TOP)/www/support.tcl >support.html
++
++tclsqlite.html: $(TOP)/www/tclsqlite.tcl
++ tclsh $(TOP)/www/tclsqlite.tcl >tclsqlite.html
++
++vdbe.html: $(TOP)/www/vdbe.tcl
++ tclsh $(TOP)/www/vdbe.tcl >vdbe.html
++
++version3.html: $(TOP)/www/version3.tcl
++ tclsh $(TOP)/www/version3.tcl >version3.html
++
++whentouse.html: $(TOP)/www/whentouse.tcl
++ tclsh $(TOP)/www/whentouse.tcl >whentouse.html
++
++
++# Files to be published on the website.
++#
++DOC = \
++ arch.html \
++ autoinc.html \
++ c_interface.html \
++ capi3.html \
++ capi3ref.html \
++ changes.html \
++ compile.html \
++ copyright.html \
++ copyright-release.html \
++ copyright-release.pdf \
++ conflict.html \
++ datatypes.html \
++ datatype3.html \
++ different.html \
++ docs.html \
++ download.html \
++ faq.html \
++ fileformat.html \
++ formatchng.html \
++ index.html \
++ lang.html \
++ lockingv3.html \
++ mingw.html \
++ nulls.html \
++ oldnews.html \
++ omitted.html \
++ opcode.html \
++ optimizer.html \
++ optoverview.html \
++ pragma.html \
++ quickstart.html \
++ sharedcache.html \
++ speed.html \
++ sqlite.html \
++ support.html \
++ tclsqlite.html \
++ vdbe.html \
++ version3.html \
++ whentouse.html
++
++doc: common.tcl $(DOC)
++ mkdir -p doc
++ ren $(DOC) doc
++ copy $(TOP)/www/*.gif $(TOP)/art/*.gif doc
++
++# Standard install and cleanup targets
++#
++install: sqlite3 sqlite3.lib sqlite3.h
++ copy sqlite3 $(BINDIR)
++ copy sqlite3.lib $(LIBDIR)
++ copy sqlite3.h $(INCDIR)
++
++clean:
++ -del *~ *.obj *.ilk *.pdb sqlite3.exe sqlite3.lib sqlite3.h opcodes.* 2>nul
++ -del lemon.exe lempar.c parse.* sqlite*.tar.gz mkkeywordhash.exe keywordhash.h 2>nul
++ -del *.da *.bb *.bbg gmon.out 2>nul
++ -rd /s /q tsrc 2>nul
++ -del testloadext.dll 2>nul
+--- /dev/null 1969-12-31 16:00:00.000000000 -0800
++++ update_ver.cmd 2006-11-23 07:09:03.334906700 -0800
+@@ -0,0 +1,4 @@
++@echo off
++for /f %%i in ( ..\VERSION ) do set VERSION=%%i
++for /f "usebackq" %%i in ( `cmd /c sed "s/[^0-9]/ /g" ^< ..\VERSION ^| nawk "{printf \"%%d%%03d%%03d\",$1,$2,$3}"` ) do set VERS_NUM=%%i
++sed -e s/--VERS--/%VERSION%/ -e s/--VERSION-NUMBER--/%VERS_NUM%/ %1
--- /dev/null
+@ECHO off\r
+setlocal ENABLEDELAYEDEXPANSION\r
+REM\r
+REM\r
+REM Bacula interface to virtual autoloader using disk storage\r
+REM\r
+REM $Id: disk-changer.in,v 1.3 2006/07/30 16:00:32 kerns Exp $\r
+REM\r
+REM If you set in your Device resource\r
+REM\r
+REM Changer Command = "disk-changer %c %o %S %a %d"\r
+REM you will have the following input to this script:\r
+REM\r
+REM So Bacula will always call with all the following arguments, even though\r
+REM in some cases, not all are used.\r
+REM\r
+REM disk-changer "changer-device" "command" "slot" "archive-device" "drive-index"\r
+REM %1 %2 %3 %4 %5\r
+REM\r
+REM By default the autochanger has 10 Volumes and 1 Drive.\r
+REM\r
+REM Note: For this script to work, you *must" specify\r
+REM Device Type = File \r
+REM in each of the Devices associated with your AutoChanger resource.\r
+REM\r
+REM changer-device is the name of a file that overrides the default\r
+REM volumes and drives. It may have:\r
+REM maxslot=n where n is one based (default 10)\r
+REM maxdrive=m where m is zero based (default 1 -- i.e. 2 drives)\r
+REM \r
+REM This code can also simulate barcodes. You simply put\r
+REM a list of the slots and barcodes in the "base" directory/barcodes.\r
+REM See below for the base directory definition. Example of a \r
+REM barcodes file:\r
+REM C:\TEMP\bacula\barcodes\r
+REM 1:Vol001\r
+REM 2:Vol002\r
+REM ...\r
+REM \r
+REM archive-device is the name of the base directory where you want the\r
+REM Volumes stored appended with \drive0 for the first drive; \drive1\r
+REM for the second drive, ... For example, you might use\r
+REM C:\Temp\bacula\drive0 Note: you must not have a trailing slash, and\r
+REM the string (e.g. \drive0) must be unique, and it must not match\r
+REM any other part of the directory name. These restrictions could be\r
+REM easily removed by any clever script jockey.\r
+REM\r
+REM Full example: disk-changer C:\Temp\bacula\conf load 1 C:\Temp\bacula\drive0 0\r
+REM\r
+REM The Volumes will be created with names slot1, slot2, slot3, ... maxslot in the\r
+REM base directory. In the above example the base directory is C:\Temp\bacula.\r
+REM However, as with tapes, their Bacula Volume names will be stored inside the\r
+REM Volume label. In addition to the Volumes (e.g. C:\Temp\bacula\slot1, \r
+REM C:\Temp\bacula\slot3, ...) this script will create a C:\Temp\bacula\loadedn\r
+REM file to keep track of what Slot is loaded. You should not change this file.\r
+REM\r
+\r
+SET dbgfile=%CD%\disk-changer.log\r
+\r
+REM to turn on logging, uncomment the following line\r
+IF NOT EXIST %dbgfile% COPY nul %dbgfile% >nul\r
+\r
+REM\r
+REM check parameter count on commandline\r
+REM\r
+REM Check for special cases where only 2 arguments are needed, \r
+REM all others are a minimum of 5\r
+REM\r
+IF "%1" EQU "" goto :param_count_invalid\r
+IF "%2" EQU "" goto :param_count_invalid\r
+IF "%2" EQU "list" goto :param_count_valid\r
+IF "%2" EQU "slots" goto :param_count_valid\r
+IF "%3" EQU "" goto :param_count_invalid\r
+IF "%4" EQU "" goto :param_count_invalid\r
+IF "%5" EQU "" goto :param_count_invalid\r
+GOTO :param_count_valid\r
+\r
+:param_count_invalid\r
+ echo Insufficient number of arguments given.\r
+ IF "%2" EQU "" (\r
+ echo At least two arguments must be specified.\r
+ ) else echo Command expected 5 arguments.\r
+:usage\r
+ ECHO.\r
+ ECHO usage: disk-changer ctl-device command [slot archive-device drive-index]\r
+ ECHO Valid commands are: unload, load, list, loaded, and slots.\r
+ EXIT /B 1\r
+\r
+:param_count_valid\r
+\r
+REM Setup arguments\r
+SET ctl=%1\r
+SET cmd=%2\r
+SET slot=%3\r
+SET device=%4\r
+SET drive=%5\r
+\r
+REM set defaults\r
+SET maxdrive=1\r
+SET maxslot=10\r
+\r
+SET ctl=%ctl:/=\%\r
+SET ctl=%ctl:\\=\%\r
+\r
+SET device=%device:/=\%\r
+SET device=%device:\\=\%\r
+\r
+REM Pull in conf file\r
+IF EXIST %ctl% CALL %ctl%\r
+\r
+FOR %%i IN ( %ctl% ) DO SET dirname=%%~dpi\r
+IF NOT EXIST %dirname%nul (\r
+ ECHO ERROR: Autochanger directory "%dirname%" does not exist.\r
+ ECHO You must create it.\r
+ EXIT /b 1\r
+)\r
+\r
+CALL :debug "Parms: %ctl% %cmd% %slot% %device% %drive%"\r
+IF "%cmd%" EQU "unload" GOTO :cmdUnload\r
+IF "%cmd%" EQU "load" GOTO :cmdLoad\r
+IF "%cmd%" EQU "list" GOTO :cmdList\r
+IF "%cmd%" EQU "loaded" GOTO :cmdLoaded\r
+IF "%cmd%" EQU "slots" GOTO :cmdSlots\r
+GOTO :cmdUnknown\r
+\r
+:cmdUnload\r
+ CALL :debug "Doing disk -f %ctl% unload %slot% %device% %drive%"\r
+ IF NOT EXIST %dirname%loaded%drive% ECHO 0 >%dirname%loaded%drive%\r
+ FOR /f %%i IN ( %dirname%loaded%drive% ) DO SET ld=%%i\r
+\r
+ IF "%slot%" EQU "%ld%" ( \r
+ CALL :debug "Unloaded slot %ld% from drive %drive%"\r
+ ECHO 0 >%dirname%loaded%drive%\r
+ DEL %dirname%%device% >nul 2>nul\r
+ SET rtn=0\r
+ ) ELSE (\r
+ ECHO Storage Element %slot% is Already Full\r
+ CALL :debug "Storage Element %slot% is Already Full"\r
+ SET rtn=1\r
+ )\r
+ GOTO :cmdExit\r
+\r
+:cmdLoad\r
+ CALL :debug "Doing disk -f %ctl% load %slot% %device% %drive%"\r
+ SET ld=0\r
+ IF NOT EXIST %dirname%loaded%drive% ECHO 0 >%dirname%loaded%drive%\r
+ FOR /f %%i IN ( %dirname%loaded%drive% ) DO SET ld=%%i\r
+ IF %ld% EQU 0 (\r
+ IF NOT EXIST %dirname%slot%slot% COPY nul %dirname%slot%slot% >nul\r
+ DEL %device%\r
+ fsutil hardlink create %device% %dirname%slot%slot% >nul 2>&1\r
+ SET rtn=%ERRORLEVEL%\r
+ IF !rtn! EQU 0 (\r
+ ECHO %slot% >%dirname%loaded%drive%\r
+ CALL :debug "Loaded slot %slot% into drive %drive%"\r
+ ) ELSE (\r
+ CALL :debug "Create hardlink failed, return = !rtn!"\r
+ )\r
+ ) ELSE (\r
+ ECHO Drive %drive% Full - Storage element %ld% loaded\r
+ CALL :debug "Drive %drive% Full - Storage element %ld% loaded"\r
+ )\r
+ GOTO :cmdExit\r
+\r
+:cmdList\r
+ CALL :debug "Doing disk -f %ctl% -- to list volumes"\r
+ IF EXIST %dirname%barcodes (\r
+ TYPE %dirname%barcodes \r
+ ) ELSE (\r
+ FOR /l %%i IN ( 1, 1, %maxslot% ) DO ECHO %%i:\r
+ )\r
+ SET rtn=0\r
+ GOTO :cmdExit\r
+\r
+:cmdLoaded\r
+ CALL :debug "Doing disk -f %ctl% %drive% -- to find what is loaded"\r
+ IF EXIST %dirname%loaded%drive% ( TYPE %dirname%loaded%drive% ) ELSE ECHO 0\r
+ SET rtn=0\r
+ GOTO :cmdExit\r
+\r
+:cmdSlots\r
+ CALL :debug "Doing disk -f %ctl% -- to get count of slots"\r
+ ECHO %maxslot%\r
+ SET rtn=0\r
+ GOTO :cmdExit\r
+\r
+:cmdExit\r
+ EXIT /b %rtn%\r
+\r
+:cmdUnknown\r
+ ECHO '%cmd%' is an invalid command.\r
+ GOTO :usage\r
+\r
+REM\r
+REM log whats done\r
+REM\r
+:debug\r
+ IF NOT EXIST %dbgfile% GOTO :EOF\r
+ FOR /f "usebackq tokens=2-4,5-7 delims=/:. " %%i IN ( '%DATE% %TIME%' ) do SET TIMESTAMP=%%k%%i%%j-%%l:%%m:%%n\r
+ ECHO %TIMESTAMP% %* >> %dbgfile%\r
+ GOTO :EOF\r
--- /dev/null
+@ECHO off\r
+REM !@PYTHON@\r
+REM \r
+REM Check the free space available on a writable DVD\r
+REM Should always exit with 0 status, otherwise it indicates a serious error.\r
+REM (wrong number of arguments, Python exception...)\r
+REM \r
+REM called: dvd-handler <dvd-device-name> operation args\r
+REM \r
+REM operations used by Bacula:\r
+REM \r
+REM free (no arguments)\r
+REM Scan the device and report the available space. It returns:\r
+REM Prints on the first output line the free space available in bytes.\r
+REM If an error occurs, prints a negative number (-errno), followed,\r
+REM on the second line, by an error message.\r
+REM \r
+REM write op filename\r
+REM Write a part file to disk.\r
+REM This operation needs two additional arguments.\r
+REM The first (op) indicates to\r
+REM 0 -- append\r
+REM 1 -- first write to a blank disk\r
+REM 2 -- blank or truncate a disk\r
+REM \r
+REM The second is the filename to write\r
+REM \r
+REM operations available but not used by Bacula:\r
+REM \r
+REM test Scan the device and report the information found.\r
+REM This operation needs no further arguments.\r
+REM prepare Prepare a DVD+/-RW for being used by Bacula.\r
+REM Note: This is only useful if you already have some\r
+REM non-Bacula data on a medium, and you want to use\r
+REM it with Bacula. Don't run this on blank media, it\r
+REM is useless.\r
+REM \r
+REM \r
+REM $Id: dvd-handler.in,v 1.11 2006/08/30 16:19:30 kerns Exp $\r
+REM \r
+\r
+setlocal ENABLEDELAYEDEXPANSION\r
+\r
+REM Configurable values:\r
+ \r
+SET self_dvdrwmediainfo=dvd+rw-mediainfo.exe\r
+SET self_growcmd=growisofs.exe\r
+SET self_dvdrwformat=dvd+rw-format.exe\r
+SET self_dd=dd.exe\r
+SET self_margin=5120\r
+\r
+REM Comment the following line if you want the tray to be reloaded\r
+REM when writing ends.\r
+SET self_growcmd=%self_growcmd% -use-the-force-luke^^^^^=notray\r
+\r
+REM end of configurable values\r
+\r
+IF "%1" == "" GOTO :usage\r
+IF "%2" == "" GOTO :usage\r
+\r
+CALL :init %1\r
+\r
+IF "%2" == "free" (\r
+ CALL :free\r
+ ECHO !ERRORLEVEL!\r
+ ECHO No Error reported.\r
+) ELSE IF "%2" == "prepare" (\r
+ CALL :prepare\r
+ ECHO Medium prepared successfully.\r
+) ELSE IF "%2" == "test" (\r
+ IF %self_freespace_collected% EQU 0 CALL :collect_freespace\r
+ IF %self_mediumtype_collected% EQU 0 CALL :collect_mediumtype\r
+ ECHO Class disk, initialized with device %self_device%\r
+ ECHO type = '!self_disktype!' mode='!self_diskmode!' status = '!self_diskstatus!'\r
+ ECHO next_session = !self_next_session! capacity = !self_capacity!\r
+ ECHO Hardware device is '!self_hardwaredevice!'\r
+ ECHO growcmd = '!self_growcmd!'\r
+ ECHO growparams = '!self_growparams!'\r
+ ECHO.\r
+ SET empty_disk=false\r
+ CALL :is_blank\r
+ IF !ERRORLEVEL! EQU 1 SET empty_disk=true\r
+ SET rewritable=false\r
+ CALL :is_RW\r
+ IF !ERRORLEVEL! EQU 1 SET rewritable=true\r
+ SET plus_RW_disk=false\r
+ CALL :is_plus_RW\r
+ IF !ERRORLEVEL! EQU 1 SET plus_RW_disk=true\r
+ SET minus_RW_disk=false\r
+ CALL :is_minus_RW\r
+ IF !ERRORLEVEL! EQU 1 SET minus_RW_disk=true\r
+ SET restricted_overwrite_disk=false\r
+ CALL :is_restricted_overwrite\r
+ IF !ERRORLEVEL! EQU 1 SET restricted_overwrite_disk=true\r
+ SET blank_disk=false\r
+ CALL :is_blank\r
+ IF !ERRORLEVEL! EQU 1 SET blank_disk=true\r
+ ECHO Empty disk: !empty_disk! Blank Disk: !blank_disk! ReWritable disk: !rewritable!\r
+ ECHO Plus RW: !plus_RW_disk! Minus RW: !minus_RW_disk! Restricted Overwrite: !restricted_overwrite_disk!\r
+ CALL :free\r
+ ECHO Free space: !ERRORLEVEL!\r
+) ELSE IF "%2" == "write" (\r
+ IF "%3" == "" GOTO :usage\r
+ IF "%4" == "" GOTO :usage\r
+ CALL :write %3 %4\r
+ ECHO Part file %4 successfully written to disk.\r
+) ELSE (\r
+ ECHO No operation - use test, free, prepare or write.\r
+ ECHO THIS MIGHT BE A CASE OF DEBUGGING BACULA OR AN ERROR!\r
+)\r
+EXIT /b 0\r
+\r
+REM ##############################################################################\r
+REM \r
+REM This class represents DVD disk informations.\r
+REM When instantiated, it needs a device name.\r
+REM Status information about the device and the disk loaded is collected only when\r
+REM asked for (for example dvd-freespace doesn't need to know the media type, and\r
+REM dvd-writepart doesn't not always need to know the free space).\r
+REM \r
+REM The following methods are implemented:\r
+REM __init__ we need that...\r
+REM __repr__ this seems to be a good idea to have.\r
+REM Quite minimalistic implementation, though.\r
+REM __str__ For casts to string. Return the current disk information\r
+REM is_empty Returns TRUE if the disk is empty, blank... this needs more\r
+REM work, especially concerning non-RW media and blank vs. no\r
+REM filesystem considerations. Here, we should also look for\r
+REM other filesystems - probably we don't want to silently\r
+REM overwrite UDF or ext2 or anything not mentioned in fstab...\r
+REM (NB: I don't think it is a problem)\r
+REM free Returns the available free space.\r
+REM write Writes one part file to disk, either starting a new file\r
+REM system on disk, or appending to it.\r
+REM This method should also prepare a blank disk so that a\r
+REM certain part of the disk is used to allow detection of a\r
+REM used disk by all / more disk drives.\r
+REM blank Blank the device\r
+REM \r
+REM ##############################################################################\r
+:init\r
+SET self_device=%1\r
+SET self_disktype=none\r
+SET self_diskmode=none\r
+SET self_diskstatus=none\r
+SET self_hardwaredevice=none\r
+SET self_pid=0\r
+SET self_next_session=-1\r
+SET self_capacity=-1\r
+\r
+SET self_freespace_collected=0\r
+SET self_mediumtype_collected=0\r
+\r
+SET self_growcmd=%self_growcmd% -quiet -use-the-force-luke^^^=4gms\r
+\r
+SET self_growparams=-A "Bacula Data" -input-charset=default -iso-level 3 -pad\r
+SET self_growparams=%self_growparams% -p "dvd-handler / growisofs" -sysid "BACULADATA" -R\r
+GOTO :EOF\r
+\r
+:collect_freespace\r
+SET self_next_session=0\r
+SET self_capacity=0\r
+FOR /f "delims== tokens=1*" %%i in ( '%self_growcmd% -F %self_device%' ) DO (\r
+ IF "%%i" == "next_session" ( \r
+ SET self_next_session=%%j\r
+ ) ELSE IF "%%i" == "capacity" (\r
+ SET self_capacity=%%j\r
+ ) ELSE IF "%%j" == "" (\r
+ SET result=!result! %%i\r
+ ) ELSE (\r
+ SET RESULT=!result! %%i=%%j\r
+ )\r
+)\r
+SET status=%ERRORLEVEL%\r
+IF %STATUS% NEQ 0 (\r
+ SET /a STATUS=STATUS ^& 0x7F\r
+ IF !STATUS! EQU 112 (\r
+ REM Kludge to force dvd-handler to return a free space of 0\r
+ self_next_session = 1\r
+ self_capacity = 1\r
+ self_freespace_collected = 1\r
+ GOTO :EOF\r
+ ) ELSE (\r
+ ECHO growisofs returned with an error !STATUS!. Please check your are using a patched version of dvd+rw-tools.\r
+ EXIT !STATUS!\r
+ )\r
+)\r
+\r
+IF %self_next_session% EQU 0 IF %self_capacity% EQU 0 (\r
+ ECHO Cannot get next_session and capacity from growisofs.\r
+ ECHO Returned: %result:|=^|%\r
+ EXIT 1\r
+)\r
+SET self_freespace_collected=1\r
+GOTO :EOF\r
+\r
+:collect_mediumtype\r
+SET self_hardwaredevice=\r
+SET self_disktype=\r
+SET self_diskmode=\r
+SET self_diskstatus=\r
+SET self_lasterror=\r
+FOR /f "delims=: tokens=1,2 usebackq" %%i in ( `"%self_dvdrwmediainfo%" %self_device%` ) DO (\r
+ IF "%%i" == "INQUIRY" FOR /f "tokens=*" %%k in ( "%%j" ) DO SET self_hardwaredevice=%%k\r
+ IF "%%i" == " Mounted Media" FOR /f "tokens=1,2* delims=, " %%k in ( "%%j" ) DO (\r
+ SET self_disktype=%%l\r
+ SET self_diskmode=%%m\r
+ )\r
+ IF "%%i" == " Disc status" FOR /f "tokens=*" %%k in ( "%%j" ) DO SET self_diskstatus=%%k\r
+)\r
+\r
+IF NOT DEFINED self_disktype (\r
+ ECHO Media type not found in %self_dvdrwmediainfo% output\r
+ EXIT 1\r
+)\r
+\r
+IF "%self_disktype%" == "DVD-RW" IF NOT DEFINED self_diskmode (\r
+ ECHO Media mode not found for DVD-RW in %self_dvdrwmediainfo% output\r
+ EXIT 1\r
+)\r
+ \r
+IF NOT DEFINED self_diskstatus (\r
+ ECHO Disc status not found in %self_dvdrwmediainfo% output\r
+ EXIT 1\r
+)\r
+\r
+SET self_mediumtype_collected=1\r
+GOTO :EOF\r
+\r
+:is_empty\r
+IF %self_freespace_collected% EQU 0 CALL :collect_freespace\r
+IF %self_next_session% EQU 0 ( EXIT /b 1 ) ELSE EXIT /b 0\r
+\r
+:is_RW\r
+IF %self_mediumtype_collected% EQU 0 CALL :collect_mediumtype\r
+IF %self_disktype% == "DVD-RW" EXIT /b 1\r
+IF %self_disktype% == "DVD+RW" EXIT /b 1\r
+IF %self_disktype% == "DVD-RAM" EXIT /b 1\r
+EXIT /b 0\r
+\r
+:is_plus_RW\r
+IF %self_mediumtype_collected% EQU 0 CALL :collect_mediumtype\r
+IF "%self_disktype%" == "DVD+RW" EXIT /b 1\r
+EXIT /b 0\r
+\r
+:is_minus_RW\r
+IF %self_mediumtype_collected% EQU 0 CALL :collect_mediumtype\r
+IF "%self_disktype%" == "DVD-RW" EXIT /b 1\r
+EXIT /b 0\r
+ \r
+:is_restricted_overwrite\r
+IF %self_mediumtype_collected% EQU 0 CALL :collect_mediumtype\r
+IF "%self_diskmode%" == "Restricted Overwrite" EXIT /b 1\r
+EXIT /b 0\r
+\r
+:is_blank\r
+IF %self_mediumtype_collected% EQU 0 CALL :collect_mediumtype\r
+IF "%self_diskstatus%" == "blank" EXIT /b 1\r
+EXIT /b 0\r
+\r
+:free\r
+IF %self_freespace_collected% EQU 0 CALL :collect_freespace\r
+SET /a fr=self_capacity - self_next_session - self_margin\r
+IF %fr% LSS 0 ( EXIT /b 0 ) ELSE EXIT /b %fr%\r
+\r
+REM %1 - newvol, %2 - partfile\r
+:write\r
+REM Blank DVD+RW when there is no data on it\r
+CALL :is_plus_RW\r
+SET tmpvar=%ERRORLEVEL%\r
+CALL :is_blank\r
+SET /a tmpvar=tmpvar + ERRORLEVEL\r
+IF %1 EQU 1 IF %tmpvar% EQU 2 (\r
+ ECHO DVD+RW looks brand-new, blank it to fix some DVD-writers bugs.\r
+ CALL :blank\r
+ ECHO Done, now writing the part file.\r
+)\r
+CALL :is_minus_RW\r
+IF %ERRORLEVEL% NEQ 0 IF %1 NEQ 0 (\r
+ CALL :is_restricted_overwrite\r
+ IF !ERRORLEVEL! EQU 0 (\r
+ ECHO DVD-RW is in %self_diskmode% mode, reformating it to Restricted Overwrite\r
+ CALL :reformat_minus_RW\r
+ ECHO Done, now writing the part file.\r
+ )\r
+)\r
+if %1 NEQ 0 (\r
+ REM Ignore any existing iso9660 filesystem - used for truncate\r
+ if %1 EQU 2 (\r
+ SET cmd_opts= -use-the-force-luke^^^=tty -Z\r
+ ) ELSE (\r
+ SET cmd_opts= -Z\r
+ )\r
+) ELSE (\r
+ SET cmd_opts= -M\r
+)\r
+ECHO Running %self_growcmd% %self_growparams% %cmd_opts% %self_device% %2\r
+%self_growcmd% %self_growparams% %cmd_opts% %self_device% %2\r
+IF %ERRORLEVEL% NEQ 0 (\r
+ ECHO Exited with status !ERRORLEVEL!\r
+ EXIT !ERRORLEVEL!\r
+)\r
+GOTO :EOF\r
+\r
+:prepare\r
+CALL :is_RW\r
+IF %ERRORLEVEL% EQU 0 (\r
+ ECHO I won't prepare a non-rewritable medium\r
+ EXIT /b 1\r
+)\r
+\r
+REM Blank DVD+RW when there is no data on it\r
+CALL :is_plus_RW\r
+SET result=%ERRORLEVEL%\r
+CALL :is_blank\r
+SET /a result=result + ERRORLEVEL\r
+IF %result% EQU 2 (\r
+ ECHO DVD+RW looks brand-new, blank it to fix some DVD-writers bugs.\r
+ CALL :blank\r
+ GOTO :EOF\r
+)\r
+\r
+CALL :is_minus_RW\r
+IF %ERRORLEVEL% EQU 1 (\r
+ CALL :is_restricted_overwrite\r
+ IF !ERRORLEVEL! EQU 0 (\r
+ ECHO DVD-RW is in %self_diskmode% mode, reformating it to Restricted Overwrite\r
+ CALL :reformat_minus_RW\r
+ GOTO :EOF\r
+ )\r
+)\r
+\r
+CALL :blank\r
+GOTO :EOF\r
+\r
+:blank\r
+ECHO Running %self_growcmd% -Z %self_device% =/dev/zero\r
+%self_growcmd% -Z %self_device% =/dev/zero\r
+IF %ERRORLEVEL% NEQ 0 (\r
+ ECHO Exited with status !ERRORLEVEL!\r
+ EXIT !ERRORLEVEL!\r
+)\r
+GOTO :EOF\r
+\r
+:reformat_minus_RW\r
+ECHO Running %self_dvdrwformat% -force %self_device%\r
+%self_dvdrwformat% -force %self_device%\r
+IF %ERRORLEVEL% NEQ 0 (\r
+ ECHO Exited with status !ERRORLEVEL!\r
+ EXIT !ERRORLEVEL!\r
+)\r
+GOTO :EOF\r
+\r
+REM class disk ends here.\r
+\r
+:usage\r
+ECHO Wrong number of arguments.\r
+ECHO.\r
+ECHO Usage:\r
+ECHO.\r
+ECHO dvd-handler DVD-DRIVE test\r
+ECHO dvd-handler DVD-DRIVE free\r
+ECHO dvd-handler DVD-DRIVE write APPEND FILE\r
+ECHO dvd-handler DVD-DRIVE blank\r
+ECHO.\r
+ECHO where DVD-DRIVE is the drive letter of the DVD burner like D:\r
+ECHO.\r
+ECHO Operations:\r
+ECHO test Scan the device and report the information found.\r
+ECHO This operation needs no further arguments.\r
+ECHO free Scan the device and report the available space.\r
+ECHO write Write a part file to disk.\r
+ECHO This operation needs two additional arguments.\r
+ECHO The first indicates to append (0), restart the\r
+ECHO disk (1) or restart existing disk (2). The second\r
+ECHO is the file to write.\r
+ECHO prepare Prepare a DVD+/-RW for being used by Bacula.\r
+ECHO Note: This is only useful if you already have some\r
+ECHO non-Bacula data on a medium, and you want to use\r
+ECHO it with Bacula. Don't run this on blank media, it\r
+ECHO is useless.\r
+\r
+EXIT /b 1\r