REM file: Copyit.inc - Public Domain DOS Utility.
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

' default integer variables
DEFINT A-Z
REM $DYNAMIC

' define boolean values
CONST True = -1
CONST False = 0
CONST NUL = ""

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

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

' initialize filename buffer
COMMON SHARED Buffer AS STRING * 32767

' initialize filename strings
COMMON SHARED ASCIZfile AS STRING * 260, ASCIZ.Dir AS STRING * 260
COMMON SHARED ASCIZ.Command AS STRING * 260, ASCIZ.Copy AS STRING * 260
COMMON SHARED ASCIZ.File AS STRING * 260, ASCIZ.Sub AS STRING * 260
COMMON SHARED DefaultASCIZ AS STRING * 260, Directory.ASCIZ AS STRING * 260
COMMON SHARED Write.ASCIZ AS STRING * 260, Next.Search AS STRING

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

' initialize filename variables
COMMON SHARED File.Create AS INTEGER, Filename.Search AS STRING * 260
COMMON SHARED Number.Excluded AS INTEGER, Max.Excluded AS INTEGER
COMMON SHARED Excluded.Files() AS STRING * 12, Parameters() AS STRING * 260
COMMON SHARED Skip.Filenames() AS STRING * 12

' declare some 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

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

' declare command line work variables
COMMON SHARED Command.Line AS STRING, Command.Work AS STRING
COMMON SHARED Command.Line.Redirect AS STRING, Imbedded AS INTEGER
COMMON SHARED Standard.Input AS STRING, Error.Level AS INTEGER
COMMON SHARED Disk.Full AS INTEGER

' 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 INTEGER, More.Display AS INTEGER
COMMON SHARED Dirs.Counted AS INTEGER, Total.Deleted AS INTEGER
COMMON SHARED Windows.Detected AS INTEGER, Windows.Dos AS INTEGER

' declare file synch 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

' 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 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

' 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

' declare file date/time work variables
COMMON SHARED File.Work.Date AS SINGLE, File.Work.Time AS SINGLE
COMMON SHARED Total.Bytes AS DOUBLE, Create.Time AS INTEGER
COMMON SHARED Access.Time AS INTEGER, Modify.Time AS INTEGER
COMMON SHARED Dest.File.Date AS SINGLE, Dest.File.Time AS SINGLE
COMMON SHARED Source.File.Time AS INTEGER, Source.File.Date AS INTEGER
COMMON SHARED New.Date.Month AS INTEGER, New.Date.Day AS INTEGER
COMMON SHARED New.Date.Year AS INTEGER, New.Time.Hour AS INTEGER
COMMON SHARED New.Time.Minute AS INTEGER, New.Time.Second AS INTEGER
COMMON SHARED Override.Date AS INTEGER, Override.Time AS INTEGER
COMMON SHARED Millisecond AS INTEGER

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

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

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

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

' declare destination array work variables
COMMON SHARED Destinate.Directory() AS STRING * 260
COMMON SHARED Destinate.Filename() AS STRING * 260
COMMON SHARED Max.Dest.Dirs AS INTEGER, Max.Dest.Files AS INTEGER
COMMON SHARED Number.Dest.Dirs AS INTEGER, Number.Dest.Files 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

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

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

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

' declare subroutines, functions
DECLARE SUB BootUsage()
DECLARE SUB CheckExcluded(F$, G$, T%)
DECLARE SUB CheckSynched(T%)
DECLARE SUB CloseFile()
DECLARE SUB CopyDirectory()
DECLARE SUB CopyFiles(D$, F$)
DECLARE SUB Create.Directory (D$)
DECLARE SUB DeleteFiles(D$)
DECLARE SUB DeleteDirectory(D$)
DECLARE SUB DeleteSourceFile(D$, F$)
DECLARE SUB DeleteDestFile(C%, F$)
DECLARE SUB DeleteSubdirectory(D$)
DECLARE SUB DisplayError(D$)
DECLARE SUB WinDirectories(D$, T$)
DECLARE SUB DosDirectories(D$, T$)
DECLARE SUB DirectoryCopying()
DECLARE SUB ExecuteCommand(C$, F$)
DECLARE SUB ExtendedFile(T%)
DECLARE SUB Filenames(D$)
DECLARE SUB FilenameCopying(S$, D$)
DECLARE SUB GetNumeric(V#)
DECLARE SUB MakeFile(F$, T$)
DECLARE SUB MakeFilename()
DECLARE SUB MorePrompt(I$, M$, O$)
DECLARE SUB OpenFile(V%)
DECLARE SUB ProcessCommand(V%)
DECLARE SUB PromptOverwrite(S$, F$, R%)
DECLARE SUB ReadFileSynch()
DECLARE SUB ReadSwitches()
DECLARE SUB TreeDirectories(D$)
DECLARE FUNCTION ParseLine(T$)
