REM file: Copyit.inc - Public Domain DOS Utility. v4.3a include file.

REM Version 1.0a created 11/28/1996
REM Version 1.1a created 02/19/1997
REM Version 1.2a created 07/14/1997
REM Version 1.3a created 07/19/1997
REM Version 1.4a created 08/22/1997
REM Version 1.5a created 09/29/1997
REM Version 1.6a created 12/20/1997
REM Version 1.7a created 02/20/1998
REM Version 1.7b created 06/07/1998
REM Version 1.8a created 12/05/1998
REM Version 1.8b created 01/15/1999
REM Version 1.9a created 01/22/1999
REM Version 1.9b created 03/24/1999
REM Version 1.9c created 10/26/1999
REM Version 2.0a created 02/24/2001
REM Version 2.1a created 08/03/2004
REM Version 2.2a created 10/20/2004
REM Version 2.3a created 11/17/2004
REM Version 2.4a created 11/24/2004
REM Version 2.5a created 12/24/2004
REM Version 2.6a created 12/28/2004
REM Version 2.7a created 12/31/2004
REM Version 2.8a created 01/05/2005
REM Version 2.9a created 01/10/2005
REM Version 3.0a created 03/03/2005
REM Version 3.1a created 03/10/2005
REM Version 3.2a created 03/20/2005
REM Version 3.3a created 04/20/2005
REM Version 3.4a created 04/28/2005
REM Version 3.5a created 11/04/2005
REM Version 3.6a created 12/10/2005
REM Version 3.7a created 12/31/2005
REM Version 3.8a created 01/31/2006
REM Version 3.9a created 02/28/2006
REM Version 4.0a created 08/31/2006
REM Version 4.1a created 06/01/2007
REM Version 4.2a created 07/10/2007
REM Version 4.3a created 08/24/2007

' default integer variables
DEFINT A-Z

' dimension variables at runtime
REM $DYNAMIC

' define boolean values
CONST True = -1
CONST False = 0
CONST SFalse = 0!
CONST DFalse = 0#
CONST Nul = ""

' define color values
CONST Black = 0
CONST Green = 10
CONST Plain = 7
CONST Red = 12
CONST White = 15
CONST Yellow = 14

' define filelist constant
CONST RecurseLevel = 8

' define version value
CONST Version$="v4.3a"
CONST Release$="r1.0a"

' read include files
REM $INCLUDE: 'qbx.bi'
REM $INCLUDE: 'dta.bi'
REM $INCLUDE: 'fcb.bi'
REM $INCLUDE: 'wdta.bi'

' declare filename buffer
COMMON SHARED Buffer AS STRING * 4096

' declare filename strings
COMMON SHARED ASCIIZ3 AS STRING * 260, ASCIIZ4 AS STRING * 261
COMMON SHARED ASCIIZfile AS STRING * 260, ASCIIZ.Command AS STRING * 260
COMMON SHARED ASCIIZ.Copy AS STRING * 260, ASCIIZ.Dir AS STRING * 260
COMMON SHARED ASCIIZ.File AS STRING * 260, ASCIIZ.Sub AS STRING * 260
COMMON SHARED DefaultASCIIZ AS STRING * 260, Directory.ASCIIZ AS STRING * 260
COMMON SHARED Next.Search AS STRING, Write.ASCIIZ AS STRING * 260

' declare drive variables
COMMON SHARED Current.Drive AS STRING * 1, Drive.Search AS STRING * 1

' declare filename variables
COMMON SHARED File.Create AS INTEGER, Filename.Search AS STRING * 260
COMMON SHARED Number.Excluded AS INTEGER, Max.Excluded AS INTEGER

' declare filename arrays
COMMON SHARED Excluded.Files() AS STRING * 128
COMMON SHARED Parameters() AS STRING * 348
COMMON SHARED Skip.Filenames() AS STRING * 12

' declare ascii arrays
COMMON SHARED Convert.Ascii() AS INTEGER, Strip.Ascii() AS INTEGER

' declare program dta
COMMON SHARED BASIC.DTA.SEG AS INTEGER, BASIC.DTA.OFF AS INTEGER
COMMON SHARED TempDTA AS DTAtype, CopyWDTA AS WDTAtype
COMMON SHARED TreeWDTA AS WDTAtype, FDTAfile AS WDTAtype
COMMON SHARED PWDTA AS WDTAtype, ProWDTA AS WDTAtype
COMMON SHARED SDTAfile AS WDTAtype, WDTAfile AS WDTAtype

' declare registers
COMMON SHARED InregsX AS RegTypeX, OutregsX AS RegTypeX
COMMON SHARED InregsX2 AS RegTypeX, InregsX3 AS RegTypeX

' declare command line work variables
COMMON SHARED Command.Line AS STRING, Command.Line.Redirect AS STRING
COMMON SHARED Command.Work AS STRING, Control.Break AS INTEGER
COMMON SHARED Disk.Full AS INTEGER, Error.Level AS INTEGER
COMMON SHARED Imbedded AS INTEGER, Last.Switch AS INTEGER
COMMON SHARED Standard.Input AS STRING, Quote AS STRING * 1
COMMON SHARED Pipe.Buffer AS STRING * 1

' declare work variables
COMMON SHARED Quit.Searching AS INTEGER
COMMON SHARED Continue.Searching AS INTEGER, Continuous.Display AS INTEGER
COMMON SHARED Double.Line AS INTEGER, Dot.Count AS INTEGER
COMMON SHARED Files.Counted AS DOUBLE, More.Display AS INTEGER
COMMON SHARED Dirs.Counted AS DOUBLE, Total.Deleted AS DOUBLE
COMMON SHARED Windows.Detected AS INTEGER, Windows.Dos AS INTEGER
COMMON SHARED Load.Windows AS INTEGER, Load.DOS AS INTEGER

' declare file synchronize work variables
COMMON SHARED Synch.Files AS INTEGER
COMMON SHARED Synch.Files1 AS INTEGER, Synch.Files2 AS INTEGER
COMMON SHARED Synch.Files3 AS INTEGER, Synch.Files4 AS INTEGER
COMMON SHARED Synch.Files5 AS INTEGER, Synch.Files6 AS INTEGER
COMMON SHARED Synch.Files7 AS INTEGER, Synch.Files8 AS INTEGER
COMMON SHARED Synch.Files9 AS INTEGER, Synch.FilesA AS INTEGER
COMMON SHARED Synch.FilesB AS INTEGER, Synch.FilesC AS INTEGER
COMMON SHARED Synch.Type1 AS INTEGER, Synch.Type2 AS INTEGER
COMMON SHARED Synch.Type3 AS INTEGER

' declare search work variables
COMMON SHARED Search.Date AS INTEGER, Search.Time AS INTEGER
COMMON SHARED Search.From.Date AS SINGLE, Search.To.Date AS SINGLE
COMMON SHARED Search.From.Time AS SINGLE, Search.To.Time AS SINGLE
COMMON SHARED File.Size AS DOUBLE, Recurse.Directories AS INTEGER

' declare pattern search work variables
COMMON SHARED Pattern.Filename AS STRING
COMMON SHARED Pattern.Match AS INTEGER
COMMON SHARED Pattern.Search.Date AS INTEGER
COMMON SHARED Pattern.Search.From.Date AS STRING
COMMON SHARED Pattern.Search.To.Date AS STRING
COMMON SHARED Pattern.Search AS INTEGER

' declare attribute search variables
COMMON SHARED Display.Attribute AS INTEGER, Display.Hidden AS INTEGER
COMMON SHARED Display.System AS INTEGER, Display.Readonly AS INTEGER
COMMON SHARED Display.Archive AS INTEGER, Display.Any AS INTEGER
COMMON SHARED No.Display.Archive AS INTEGER, No.Display.Readonly AS INTEGER
COMMON SHARED No.Display.System AS INTEGER, No.Display.Hidden AS INTEGER
COMMON SHARED No.Display.Any AS INTEGER, File.Attribute AS INTEGER

' declare destination attribute work variables
COMMON SHARED Dir.Attribute AS INTEGER, Set.Dest.Archive AS INTEGER
COMMON SHARED Set.Dest.Readonly AS INTEGER, Set.Dest.System AS INTEGER
COMMON SHARED Set.Dest.Hidden AS INTEGER, Set.Dest.Any AS INTEGER
COMMON SHARED Clear.Dest.Archive AS INTEGER, Clear.Dest.Readonly AS INTEGER
COMMON SHARED Clear.Dest.System AS INTEGER, Clear.Dest.Hidden AS INTEGER
COMMON SHARED Clear.Dest.Any AS INTEGER

' declare source attribute work variables
COMMON SHARED Source.Attribute AS INTEGER, Set.Source.Archive AS INTEGER
COMMON SHARED Set.Source.Readonly AS INTEGER, Set.Source.System AS INTEGER
COMMON SHARED Set.Source.Hidden AS INTEGER, Set.Source.Any AS INTEGER
COMMON SHARED Clear.Source.Archive AS INTEGER, Clear.Source.Readonly AS INTEGER
COMMON SHARED Clear.Source.System AS INTEGER, Clear.Source.Hidden AS INTEGER
COMMON SHARED Clear.Source.Any AS INTEGER, Set.Source.Attribute AS INTEGER

' declare work variables
COMMON SHARED Redirected.Input AS INTEGER, Overwrite.Prompt AS INTEGER
COMMON SHARED Dont.Overwrite AS INTEGER, Debug.Mode AS INTEGER
COMMON SHARED Dot.Mode AS INTEGER, Rate.Mode AS INTEGER
COMMON SHARED Start.Time AS SINGLE, Stop.Time AS SINGLE
COMMON SHARED Time.Elapsed AS SINGLE, Percent.Display AS INTEGER
COMMON SHARED Percent AS SINGLE, Percent.Flag AS INTEGER
COMMON SHARED Progress.Bar AS INTEGER, Current.Progress AS INTEGER
COMMON SHARED Display.Errors AS INTEGER, Last.Percent AS SINGLE

' declare copy work variables
COMMON SHARED Display.Lowercase AS INTEGER, Copy.Ascii AS INTEGER
COMMON SHARED Ascii.Strips AS INTEGER, Ascii.Filters AS INTEGER
COMMON SHARED Max.Filters AS INTEGER, Max.Strips AS INTEGER
COMMON SHARED Directory.Exists AS INTEGER, Filename.Exists AS INTEGER
COMMON SHARED Dir.Copy.Name AS STRING * 260, Dir.Copy.Target AS STRING * 260
COMMON SHARED Force.LowerCase AS INTEGER

' declare file date/time work variables
COMMON SHARED Millisecond AS INTEGER, New.Date.Month AS INTEGER
COMMON SHARED New.Date.Day AS INTEGER, New.Date.Year AS INTEGER
COMMON SHARED New.Time.Hour AS INTEGER, New.Time.Minute AS INTEGER
COMMON SHARED New.Time.Second AS INTEGER

' declare file date\time override work varibles
COMMON SHARED Override.Access.Date AS INTEGER, Override.Creation.Date AS INTEGER
COMMON SHARED Override.Modified.Date AS INTEGER, Override.Date AS INTEGER
COMMON SHARED Override.Time AS INTEGER, Source.File.Time AS INTEGER
COMMON SHARED Source.File.Date AS INTEGER, Total.Bytes AS DOUBLE

' declare copy date\time range work variables
COMMON SHARED Compare.Creation.Date AS INTEGER
COMMON SHARED Compare.Access.Date AS INTEGER
COMMON SHARED Compare.Modified.Date AS INTEGER

' declare copy source file/dest. milliseconds
COMMON SHARED Half.Second1 AS SINGLE, Half.Second2 AS SINGLE

' declare synchronize date\time work variables
COMMON SHARED Synch.File.Creation.Date AS SINGLE
COMMON SHARED Synch.File.Creation.Time AS SINGLE
COMMON SHARED Synch.File.Access.Date AS SINGLE
COMMON SHARED Synch.File.Modified.Date AS SINGLE
COMMON SHARED Synch.File.Modified.Time AS SINGLE

' declare synchronize date\time work variables
COMMON SHARED Synch.Work.Creation.Date AS SINGLE
COMMON SHARED Synch.Work.Creation.Time AS SINGLE
COMMON SHARED Synch.Work.Access.Date AS SINGLE
COMMON SHARED Synch.Work.Modified.Date AS SINGLE
COMMON SHARED Synch.Work.Modified.Time AS SINGLE

' declare extended file date/time work variables
COMMON SHARED Windows.Creation.Date AS INTEGER
COMMON SHARED Windows.Creation.Time AS INTEGER
COMMON SHARED Windows.Creation.Milli AS INTEGER
COMMON SHARED Windows.LastAccess.Date AS INTEGER
COMMON SHARED Windows.LastWrite.Date AS INTEGER
COMMON SHARED Windows.LastWrite.Time AS INTEGER

' declare extended directory date/time work variables
COMMON SHARED Directory.LastWrite.Date AS INTEGER
COMMON SHARED Directory.LastWrite.Time AS INTEGER

' declare filesize work variables
COMMON SHARED Copy.Zero AS INTEGER, Dest.File.Size AS DOUBLE
COMMON SHARED Search.File.Size, Search.Size.From AS DOUBLE
COMMON SHARED Search.Size.To AS DOUBLE

' declare destination work variables
COMMON SHARED Ambiguate.Display AS INTEGER, Append.Handle AS INTEGER
COMMON SHARED Copy.Directory AS INTEGER, Copy.Target AS STRING
COMMON SHARED Default.Dest AS STRING, Default.Dir AS STRING
COMMON SHARED Dest.Dir AS STRING, Dest.File AS STRING
COMMON SHARED Display.Path AS INTEGER, Display.Wide AS INTEGER
COMMON SHARED Drive.Letter AS INTEGER, Short.Display AS INTEGER
COMMON SHARED Short.Display2 AS INTEGER, Start.Dir AS STRING
COMMON SHARED Wide.List AS INTEGER

' declare append variables
COMMON SHARED Append.Dest AS INTEGER, Append.Files AS INTEGER
COMMON SHARED Byte.Switch AS INTEGER, Byte.Override AS DOUBLE
COMMON SHARED Resume.File AS INTEGER

' declare destination work arrays
COMMON SHARED Destinate.Directory() AS STRING * 260
COMMON SHARED Destinate.Filename() AS STRING * 260
COMMON SHARED Destinate.Netpaths() AS STRING * 260

' declare destination work variables
COMMON SHARED Max.Dest.Dirs AS INTEGER, Max.Dest.Files AS INTEGER
COMMON SHARED Max.Dest.Nets AS INTEGER, Number.Dest.Dirs AS INTEGER
COMMON SHARED Number.Dest.Files AS INTEGER, Number.Dest.Nets AS INTEGER
COMMON SHARED Default.Net AS STRING * 64, Source.Net AS STRING * 64
COMMON SHARED Zero.Dirs AS INTEGER, Zero.Nets AS INTEGER

' declare nest recursion variables
COMMON SHARED Nested.Recurse AS INTEGER, Nested.Levels AS INTEGER
COMMON SHARED Recursion AS INTEGER, Zero.Nest AS INTEGER
COMMON SHARED Recurse.Error AS INTEGER, Max.Recurse AS INTEGER

' declare delete copied files variables
COMMON SHARED Continue.Deleting AS INTEGER, Continue.Subdelete AS INTEGER
COMMON SHARED Delete.Copied AS INTEGER, Delete.Directory AS INTEGER
COMMON SHARED Prompt.Delete1 AS INTEGER, Prompt.Delete2 AS INTEGER

' declare DOS command work variables
COMMON SHARED DOS.Command() AS STRING * 128, Ignore.Config AS INTEGER
COMMON SHARED Max.Commands AS INTEGER, Number.Commands AS INTEGER

' declare filelist variables
COMMON SHARED Enable.Redirect AS INTEGER, Disable.Prompts AS INTEGER

' declare error variables
COMMON SHARED Data.Error AS INTEGER, Error.Flag AS INTEGER

' declare floppy copy variables (unused).
COMMON SHARED Force.Copy AS INTEGER, Prompt.Insert AS INTEGER
COMMON SHARED Temp.Drive.Dir AS STRING * 260

' declare subroutines
DECLARE SUB BootUsage()
DECLARE SUB CheckDateRange(V%)
DECLARE SUB CheckExcluded(F$,G$,T%)
DECLARE SUB CheckFile(F$,V%,W%)
DECLARE SUB CheckPattern(F$,M%)
DECLARE SUB CheckSizeRange(V%)
DECLARE SUB CheckSynched(T%)
DECLARE SUB CloseFile(S$)
DECLARE SUB CopyDirectory(N$)
DECLARE SUB CopyFiles(N$,D$,F$)
DECLARE SUB CreateDirectory(N$,D$)
DECLARE SUB DeleteFiles(D$)
DECLARE SUB DeleteDirectory(D$)
DECLARE SUB DeleteSourceFile(D$,F$)
DECLARE SUB DeleteDestFile(C%,N$,F$)
DECLARE SUB DeleteSubdirectory(D$)
DECLARE SUB DisplayError(D$)
DECLARE SUB DosDirectories(N$,D$,T$)
DECLARE SUB DirectoryCopying(N$)
DECLARE SUB ExecuteCommand(C$,F$)
DECLARE SUB ExtendedFile(T%)
DECLARE SUB Filenames(N$,D$)
DECLARE SUB FilenameCopying(N$,S$,D$)
DECLARE SUB GetNumeric(V#)
DECLARE SUB MakeFile(N$,F$,T$)
DECLARE SUB MakeFile2(F$)
DECLARE SUB MakeFilename()
DECLARE SUB MorePrompt(I$,M$,O$,X$)
DECLARE SUB OpenFile(V%)
DECLARE SUB ProcessFilename(V%)
DECLARE SUB ProcessCommand(V%)
DECLARE SUB PromptOverwrite(N$,S$,F$,R%)
DECLARE SUB ReadFileSynch()
DECLARE SUB ReadSwitches()
DECLARE SUB TreeDirectories(D$)
DECLARE SUB WinDirectories(N$,D$,T$)

' declare functions
DECLARE FUNCTION BreakIS()
DECLARE FUNCTION ClearBreak()
DECLARE FUNCTION KeyIS()
DECLARE FUNCTION Ambiguate$(V$)
DECLARE FUNCTION MakeDate$(V1!,V2!,V3%)
DECLARE FUNCTION ParseLine(T$)
