home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-04-11 | 29.2 KB | 1,064 lines |
- ; Reflection backup/restore command file for the PC 4/14/89
- ; Modified from Mac version
- ; v0 - startup value of literal escape
- ; v1 - PC disk name
- ; v2 - PC subdirectory path
- ; v3 - include subdirectories option
- ; v4 - PC filespec or pattern
- ; v5 - change option
- ; v6 - Host container name
- ; v7 - user inputs
- ; v8 - command string to host
- ; v9 - backup or restore command on error, or wait value
- ; quiet command on
- ;set alphgraf mode
- ;if mid($serial,3,3) = '4'
- display "^[[>99l"
- ;endif
- let v0 = value(literal-escape)
- set literal-escape "~~"
- :restart
- display '^m^j^j^j'
- if mid($serial,3,3) = '2' or mid(value(terminal-type),1,2)="VT"
- display ")0^Nlqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk^m^j"
- display "x^O ^[[7m ^[[m"
- display "^[[7m P C t o H O S T D i s k B a c k u p ^[[m ^Nx^m^j"
- display "mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj^O^m^j^j"
- else
- display '^[h^[J'
- display "^nq;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;w^m^j"
- display '^n:^o ^[&dF P C t o H O S T D i s k B a c k u p ^[&d@ ^n:^m^j'
- display "^na;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;s^m^j^j"
- endif
- display ' Log onto your host system prior to executing this command file.^m^j'
- display ' The Reflection host file transfer program which supports PLUS ^m^j'
- display ' is assumed to be on your host computer. For information on how^m^j'
- display ' to upload the file transfer program, please refer to your^m^j'
- display ' Reflection manual. For additional information on Backup and Restore,^m^j'
- display ' bring up the Reflection Command Line and enter "HELP BACKUP" or^m^j'
- display ' "HELP RESTORE".^m^j^j'
- display ' Enter: /h <return> for HELP^m^j'
- display ' /e <return> to EXIT^m^j'
- display ' /r <return> to RESTART^m^j'
- display ' <return> to accept the value displayed in angle brackets^m^j'
- ; ***
- ; Do they want to backup or restore?
- ; ***
- :option
- display '^m^jChoose an operation:'
- display '^m^j Full backup <f>'
- display '^m^j Incremental backup (requires a full backup first) <i>'
- display '^m^j Partial backup <p>'
- display '^m^j Restore <r>'
- display '^m^j Default is <f>: '
- accept v7
- display '^m^j'
- let v7 = pack(upper(v7))
- if length(v7) = 0
- goto backall
- endif
- if mid(v7,1,2) = '/R'
- goto restart
- endif
- if mid(v7,1,2) = '/E'
- let v9 = 'Backup/Restore'
- let v8 = -1
- goto abort
- endif
- if mid(v7,1,1) = 'P'
- goto backup
- endif
- if mid(v7,1,1) = 'F'
- goto backall
- endif
- if mid(v7,1,1) = 'I'
- goto incrmntl
- endif
- if mid(v7,1,1) = 'R'
- goto restore
- endif
- if mid(v7,1,2) <> '/H'
- display '^m^jError - invalid response "$7"^m^j'
- endif
- display '^m^j Enter a "f" to do a complete backup of all files on your PC^m^j'
- display ' to a host container named FULL. Enter a "i" to do an incremental backup^m^j'
- display ' of all files that have changed or were added since your last full backup.^m^j'
- display ' Enter a "p" if you want to select files based upon their name and parent^m^j'
- display ' directory. Select "r" to do a restore.^m^j'
- goto option
-
- ; ***
- ; Build RESTORE command
- ; ***
- :RESTORE
- ; ***
- ; Get container file name - borrow v7 so case isn't changed
- ; ***
- :contfile
- display '^j Name of backup container file on host <backup>? '
- accept v6
- display '^m^j'
- let v7 = pack(upper(v6))
- let v6 = pack(v6)
- if mid(v7,1,2) = '/H'
- display '^m^j Reflection stores all of the PC files backed up in a^m^j'
- display ' single container file on the host. Enter the name of the^m^j'
- display ' container file which contains the PC files you wish to^m^j'
- display ' restore. If you used the default container filename when you^m^j'
- display ' performed your backup, accept the default filename here.^m^j'
- goto contfile
- endif
- if mid(v7,1,2) = '/R'
- goto restart
- endif
- if mid(v7,1,2) = '/E'
- goto restabort
- endif
- if length(v7)=0
- let v6 = "backup"
- endif
-
- ; ***
- ; Get disk drive name - place in V1
- ; ***
- :output
- ;let v2 = mid($dir,1,2)
- let v2 = $dir
- if find(":",mid(v2,1,80)) <> 0
- let v2 = mid(v2,1,find(":",mid(v2,1,80))-1)
- endif
- display '^j Disk to which PC files are to be restored <$2>? '
- accept v1
- display '^m^j'
- let v1 = pack(upper(v1))
- if length(v1) = 0
- let v1 = v2
- goto rfiles
- endif
- if mid(v1,1,2) = '/R'
- goto restart
- endif
- if mid(v1,1,2) = '/E'
- goto restabort
- endif
- if mid(v1,1,2) = '/H'
- display '^m^j Enter the name of the disk to which the PC files will^m^j'
- display ' be restored. This must be the name of a disk which has already been backed^m^j'
- display ' up into your host container file. Files will be restored to the same ^m^j'
- display ' subdirectories that they were backed up from. ^m^j'
- goto output
- endif
- if mid(v1,length(v1),length(v1)) = ':'
- let v1 = mid(v1,1,length(v1)-1)
- endif
-
- ; ***
- ; Get file name filter - place in V4
- ; ***
- :rfiles
- display '^j File(s) to be restored <All files>? '
- accept v4
- display '^m^j'
- let v4 = pack(upper(v4))
- if mid(v4,1,1) = ''
- let v4 = '*.*'
- endif
- if mid(v4,1,2) = '/R'
- goto restart
- endif
- if mid(v4,1,2) = '/E'
- goto restabort
- endif
- if mid(v4,1,2) <> '/H'
- goto direct
- endif
- display '^m^j Enter the specification for the file(s) to be restored ^m^j'
- display ' from the host. If no name is given, all files are restored. ^m^j'
- display ' The filename may include wildcard characters, such as "*" ^m^j'
- display ' to designate any character or string of characters and "?" ^m^j'
- display ' to designate any character.^m^j'
- display ' Some examples: ^m^j^j'
- display ' *.* specifies all files^m^j'
- display ' *.dat specifies files with an extension of "dat"^m^j'
- display ' r*.* specifies files that begin with "r"^m^j'
- display ' x?.* specifies files which begin with "x" and ^m^j'
- display ' are two characters in length. "x"^m^j'
- goto rfiles
-
- ; ***
- ; Get subdirectory name - place in V2 - Use V3 and V5 as working storage
- ; ***
- :direct
- if find("\",$dir) <> 0
- let v3 = mid($dir,find("\",$dir),length($dir))
- else
- let v3 = ''
- endif
- display '^j Enter the directory to begin search for file(s) "$4"^m^j'
- display ' on disk "$1" <$3>? '
- accept v2
- display '^m^j'
- let v5 = pack(upper(v2))
- let v2 = pack(v2)
- if length(v2) = 0
- let v2 = v3
- endif
- if mid(v5,1,2) = '/R'
- goto restart
- endif
- if mid(v5,1,2) = '/E'
- goto restabort
- endif
- if mid(v5,1,2) = '/H'
- display ' ^m^j Enter the name of the directory that you want to search for^m^j'
- display ' the PC file(s) "$4" (e.g. "\BIN" or "\BIN\R2") in.^m^j'
- display ' PC files are always restored to the same directory ^m^j'
- display ' they occupied when they were backed up. If the directory that they^m^j'
- display ' occupied no longer exists, it will be recreated by the restore ^m^j'
- display ' program. ^m^j'
- goto direct
- endif
- if mid(v2,1,1) <> '\'
- let v2 = '\' & v2
- endif
- if mid(v2,length(v2),length(v2)) <> '\'
- let v2 = v2 & '\'
- endif
-
- ; ***
- ; Get /s (include subdirectories) option - place in V3
- ; ***
- :subdirect
- let v7 = v1 & ':' & v2
- if length(v2) > 1
- let v7 = mid(v7,1,length(v7)-1)
- endif
- display '^j Should the subdirectories below "$7"^m^j'
- display ' be restored <yes>? '
- accept v3
- display '^m^j'
- let v3 = pack(upper(v3))
- if mid(v3,1,2) = '/R'
- goto restart
- endif
- if mid(v3,1,2) = '/E'
- goto restabort
- endif
- if length(v3) = 0 or mid(v3,1,1) = 'Y'
- let v3 = '/s'
- goto modified
- endif
- if mid(v3,1,1) = 'N'
- let v3 = ''
- goto modified
- endif
- if mid(v3,1,2) <> '/H'
- display '^m^jError - invalid response! ^m^j'
- endif
- display '^m^j Should all of the files contained in all subdirectories of^m^j'
- display ' "$7" be searched by the restore program.^m^j'
- display ' For example, in the directory structure,^m^j^j'
- display mid(' ',1,(6-(length(v2)/2)))
- display ' $7^m^j'
- display ' / | \^m^j'
- display ' / | \^m^j'
- display ' file1 file2 DIR1^m^j'
- display ' / | \^m^j'
- display ' / | \^m^j'
- display ' file3 DIR2 file4^m^j'
- display ' / \^m^j'
- display ' / \^m^j'
- display ' file5 file6^m^j^j'
- display ' If you specify that subdirectories be restored, the directories $7,^m^j'
- display ' DIR1 and DIR2 will be searched for files matching the filename "$4",^m^j'
- display ' otherwise only the files in directory "$7" will be searched.^m^j'
- goto subdirect
-
- ; ***
- ; Get /k (keep modified - a good idea!) option
- ; ***
- :modified
- display '^j Overwrite files that have CHANGED since backup <no>? '
- accept v5
- display '^m^j'
- let v5 = pack(upper(v5))
- if mid(v5,1,2) = '/R'
- goto restart
- endif
- if mid(v5,1,2) = '/E'
- goto restabort
- endif
- if mid(v5,1,1) = 'N' or length(v5) = 0
- let v5 = '/k'
- goto rest
- endif
- if mid(v5,1,1) = 'Y'
- let v5 = ''
- goto rest
- endif
- if mid(v5,1,2) <> '/H'
- display '^m^jError - invalid response! ^m^j'
- endif
- display '^m^j If you enter "YES," the restore program overwrites any^m^j'
- display ' file on the PC that has the same name as a file being restored^m^j'
- display ' from the host. If you respond "NO," the restore program only ^m^j'
- display ' overwrites files on the PC that have not changed since ^m^j'
- display ' they were backed up.^m^j'
- goto modified
-
- ; ***
- ; Display and execute command
- ; ***
- :rest
- let v8 = 'restore $6 $1:$2$4 $3$5'
- display '^j Proceed with the restore command:^m^j'
- display ' "$8" <yes>? '
- accept v7
- display '^m^j'
- let v7 = pack(upper(v7))
- if mid(v7,1,2) = '/E'
- goto restabort
- endif
- if mid(v7,1,2) = '/R'
- goto restart
- endif
- if mid(v7,1,1) <> '' AND mid(v7,1,1) <> 'Y'
- goto restart
- endif
- display '^m^j' & v8 & '^m^j^j'
- continue
- $8
- let v8 = error-code
- let v9 = 'Restore'
- if v8 > 0
- goto abort
- endif
- goto exit
-
- :restabort
- let v9 = 'Restore'
- let v8 = -1
- goto abort
-
- ;----------------------------------------------------------------------------------------
-
- ; ***
- ; Build full BACKUP command
- ; ***
- :BACKALL
- ; ***
- ; Get disk name - place in V1
- ; ***
- :fulldevice
- let v2 = $dir
- if find(":",mid(v2,1,80)) <> 0
- let v2 = mid(v2,1,find(":",mid(v2,1,80))-1)
- endif
- display '^j Drive to be backed up <$2>? '
- accept v1
- display '^m^j'
- let v1 = pack(upper(v1))
- if length(v1) = 0
- let v1 = v2
- goto fullfile
- endif
- if mid(v1,1,2) = '/E'
- goto fullabort
- endif
- if mid(v1,1,2) = '/R'
- goto restart
- endif
- if mid(v1,1,2) = '/H'
- display '^m^j Enter the drive letter of the disk containing the files to be ^m^j'
- display ' backed up. Some examples: "C", "D", or "E".^m^j'
- goto fulldevice
- endif
- if mid(v1,length(v1),length(v1)) = ':'
- let v1 = mid(v1,1,length(v1)-1)
- endif
-
- ; ***
- ; Get container file name - Borrow V7 so case isn't changed
- ; ***
- :fullfile
- display '^j Name of host file to store backed up PC files in <full>? '
- accept v6
- display '^m^j'
- let v7 = pack(upper(v6))
- let v6 = pack(v6)
- if mid(v7,1,2) = '/H'
- display '^m^j Reflection stores all of the PC files backed up in a^m^j'
- display ' single container file on the host. If the host file specified does^m^j'
- display ' not exist, a file with that name is created. If the host file^m^j'
- display ' exists and it is a valid container file, then new PC^m^j'
- display ' files will be added to it. PC files that already ^m^j'
- display ' exist in the container file will be overwritten.^m^j'
- goto hostfile
- endif
- if mid(v7,1,2) = '/E'
- goto fullabort
- endif
- if mid(v7,1,2) = '/R'
- goto restart
- endif
- if length(v6)=0
- let v6 = "full"
- endif
-
- ; ***
- ; Get delay
- ; ***
- gosub getdelay
-
- ; ***
- ; Execute full backup
- ; ***
- :backcmd
- let v4 = '*.*'
- let v8 = 'backup $1:\$4 $6 /s/c'
- display '^j Proceed with the backup command:^m^j'
- if length(v9) <> 0
- display ' "$9"^m^j'
- endif
- display ' "$8" <yes>? '
- accept v7
- display '^m^j'
- let v7 = pack(upper(v7))
- if mid(v7,1,2) = '/E'
- goto fullabort
- endif
- if mid(v7,1,2) = '/R'
- goto restart
- endif
- if mid(v7,1,1) <> '' AND mid(v7,1,1) <> 'Y'
- goto restart
- endif
-
- close 1
- open incrment.rcl delete as 1
- let v5 = $date
- let v6 = $time
- let v6 = mid(v6,1,8)
- write 1 "; Command file for incremental backup of disk $1^m^j"
- write 1 "; Last full backup was done on $5 at $6.^m^j"
- write 1 'continue^m^j'
- write 1 'backup $1:\$4 INCRMNTL /s /d:$5 /t:$6^m^j'
- write 1 'let v8 = error-code^m^j'
- close 1
-
- ; ***
- ; Go execute command
- ; ***
- :fullbackcmd
- goto doback
- :fullabort
- let v9 = 'Full Backup'
- let v8 = -1
- goto abort
-
-
- ;----------------------------------------------------------------------------------------
-
- ; ***
- ; Execute incremental BACKUP command
- ; ***
- :INCRMNTL
-
- ; ***
- ; Get delay in v9
- ; ***
- gosub getdelay
-
- display "^m^j"
- continue
- type incrment.rcl
- if error
- display "The command file INCRMENT.RCL was not found. This command file is created^m^j"
- display "when you run WRQBACK.RCL and select the full backup option. If you haven't^m^j"
- display "done a full backup then do one first. If you have then remember that you must^m^j"
- display "run the command file WRQBACK.RCL from the same subdirectory as INCRMENT.RCL.^m^j^m^j"
- display "Strike return to continue."
- accept v7
- goto incrabort
- endif
- display "^m^j"
-
- :incrmntlcmd
- display '^m^j Execute command <yes>? '
- accept v6
- display '^m^j'
- let v6 = pack(upper(v6))
- if mid(v6,1,2) = '/H'
- display '^m^j If you select yes then the above command will be executed. This command^m^j'
- display ' does an incremental backup, backing up all files that have changed or^m^j'
- display ' were added since your last full backup. Files will be put in a container^m^j'
- display ' file named "INCRMNTL".^m^j'
- goto incrmntlcmd
- endif
- if mid(v6,1,2) = '/E'
- goto incrabort
- endif
- if mid(v6,1,2) = '/R'
- goto restart
- endif
- if mid(v6,1,1) <> '' AND mid(v6,1,1) <> 'Y'
- goto restart
- endif
-
- if length(v9) <> 0
- $9
- endif
- ; incrment will set v8 to error-code
- invoke incrment.rcl
- if v8 > 0
- let v9 = 'Backup'
- goto abort
- endif
- goto exit
-
- :incrabort
- let v9 = 'Backup'
- let v8 = -1
- goto abort
-
- ;----------------------------------------------------------------------------------------
-
- ; ***
- ; Build partial BACKUP command
- ; ***
- :BACKUP
- ; ***
- ; Get disk name - borrow v3 so we don't change case
- ; ***
- :device
- ;let v2 = mid($dir,1,2)
- let v2 = $dir
- if find(":",mid(v2,1,80)) <> 0
- let v2 = mid(v2,1,find(":",mid(v2,1,80))-1)
- endif
- display '^j Disk to be backed up <$2>? '
- accept v1
- display '^m^j'
- let v3 = pack(upper(v1))
- let v1 = pack(v1)
- if length(v3) = 0
- let v1 = v2
- goto dir
- endif
- if mid(v3,1,2) = '/E'
- goto backabort
- endif
- if mid(v3,1,2) = '/R'
- goto restart
- endif
- if mid(v3,1,2) = '/H'
- display '^m^j Enter the name of the disk which contains the files to be ^m^j'
- display ' backed up.^m^j'
- goto device
- endif
-
- ; ***
- ; Get root directory - borrow v3 so we don't change case
- ; ***
- :dir
- display '^j The subdirectory to be backed up <all subdirectories>? '
- accept v2
- display '^m^j'
- let v3 = pack(upper(v2))
- let v2 = pack(v2)
- if length(v2) = 0
- let v2 = '\'
- endif
- if mid(v3,1,2) = '/R'
- goto restart
- endif
- if mid(v3,1,2) = '/E'
- goto backabort
- endif
- if mid(v3,1,2) = '/H'
- display '^m^j Enter the name of the directory which contains the files^m^j'
- display ' to be backed up (e.g.,"\", "\BIN", "\BIN\REFLECT", etc...).^m^j'
- display ' Accept the default value if you want all files on the disk^m^j'
- display ' to be backed up. If you would like to back up ALL files on^m^j'
- display ' the selected disk, then you must include all subdirectories.^m^j'
- goto dir
- endif
- if mid(v2,1,1) <> '\'
- let v2 = '\' & v2
- endif
- if mid(v2,length(v2),length(v2)) <> '\'
- let v2 = v2 & '\'
- endif
-
- ; ***
- ; Get /s (include subdirectories) option
- ; ***
- :subdir
- let v7 = v1 & ':' & v2
- if length(v2) > 1
- let v7 = mid(v7,1,length(v7)-1)
- endif
- display '^j Should all included subdirectories of "$7"^m^j'
- display ' be backed up <yes>? '
- accept v3
- display '^m^j'
- let v3 = pack(upper(v3))
- if mid(v3,1,2) = '/R'
- goto restart
- endif
- if mid(v3,1,2) = '/E'
- goto backabort
- endif
- if length(v3) = 0 or mid(v3,1,1) = 'Y'
- let v3 = '/s'
- goto files
- endif
- if mid(v3,1,1) = 'N'
- let v3 = ''
- goto files
- endif
- if mid(v3,1,2) <> '/H'
- display '^m^jError - invalid response! ^m^j'
- goto subdir
- endif
- display '^m^j Should all of the files contained in all subdirectories of "$7" be^m^j'
- display ' searched by the backup program? For example, in the directory^m^j'
- display ' structure^m^j^j'
- display mid(' ',1,(6-(length(v2)/2)))
- display ' $7^m^j'
- display ' / | \^m^j'
- display ' / | \^m^j'
- display ' file1 file2 DIR1^m^j'
- display ' / | \^m^j'
- display ' / | \^m^j'
- display ' file3 DIR2 file4^m^j'
- display ' / \^m^j'
- display ' / \^m^j'
- display ' file5 file6^m^j^j'
- display ' If you specify that files within the subdirectories be backed up, then^m^j'
- display ' the directories "$7", DIR1, and DIR2 will be searched for files^m^j'
- display ' matching the filename supplied below, otherwise only the files in^m^j'
- display ' the directory "$7" will be searched. ^m^j'
- goto subdir
-
- ; ***
- ; Get file name filter - borrow v5 so we don't change case
- ; ***
- :files
- display '^j Files to back up <all files>? '
- accept v4
- display '^m^j'
- let v5 = pack(upper(v4))
- let v4 = pack(v4)
- if length(v5) = 0
- let v4 = '*.*'
- goto archive
- endif
- if mid(v5,1,2) = '/R'
- goto restart
- endif
- if mid(v5,1,2) = '/E'
- goto backabort
- endif
- if mid(v5,1,2) <> '/H'
- if (find('\',v5) <> 0 or find(':',v5)<> 0)
- display '^m^jError - invalid filename! ^m^j'
- else
- goto archive
- endif
- endif
- display '^m^j Enter the specification for the file(s) to be backed up to ^m^j'
- display ' the host. The filename may include wildcard characters, such as "*" ^m^j'
- display ' and "?", where "*" designates any character or string of characters.^m^j'
- display ' "?" designates any character.^m^j'
- display ' Some examples:^m^j^j'
- display ' *.* specifies all files^m^j'
- display ' *.dat specifies files with an extension of "dat"^m^j'
- display ' r*.* specifies files that begin with "r"^m^j'
- display ' x?.* specifies files which begin with "x" and ^m^j'
- display ' are two characters in length. "x"^m^j'
- goto files
-
- ; ***
- ; Get /c (backup all - poor choice!) option
- ; ***
- :archive
- display '^j Back up only files that have changed since the last backup <yes>? '
- accept v5
- display '^m^j'
- let v5 = pack(upper(v5))
- if mid(v5,1,2) = '/R'
- goto restart
- endif
- if mid(v5,1,2) = '/E'
- goto backabort
- endif
- if mid(v5,1,1) = 'Y' or length(v5) = 0
- let v5 = ''
- goto hostfile
- endif
- if mid(v5,1,1) = 'N'
- let v5 = '/c'
- goto hostfile
- endif
- if mid(v5,1,2) <> '/H'
- display '^m^jError - invalid response!^m^j'
- endif
- display '^m^j MS-DOS marks a file as "changed" whenever a file is written^m^j'
- display ' or updated. When Reflection or ANY PC backup program backs up^m^j'
- display ' a file, it clears the "changed" mark. If you answer "YES", ^m^j'
- display ' Reflection will check each file you selected for backup to ^m^j'
- display ' see if it is marked as "changed". If it is, it will be backed ^m^j'
- display ' up; otherwise, it will be skipped. If you answer "NO", the file(s)^m^j'
- display ' selected for backup will be backed up regardless of the state of ^m^j'
- display ' the "changed" flag.^m^j'
- goto archive
-
- ; ***
- ; Get container file name - Borrow V7 so case isn't changed
- ; ***
- :hostfile
- display '^j Name of host file to store backed up PC files in <backup>? '
- accept v6
- display '^m^j'
- let v7 = pack(upper(v6))
- let v6 = pack(v6)
- if mid(v7,1,2) = '/H'
- display '^m^j Reflection stores all of the PC files backed up in a^m^j'
- display ' single container file on the host. If the host file specified does^m^j'
- display ' not exist, a file with that name is created. If the host file^m^j'
- display ' exists and it is a valid container file, then new PC^m^j'
- display ' files will be added to it. PC files that already ^m^j'
- display ' exist in the container file will be overwritten.^m^j'
- goto hostfile
- endif
- if mid(v7,1,2) = '/E'
- goto backabort
- endif
- if mid(v7,1,2) = '/R'
- goto restart
- endif
- if length(v6)=0
- let v6 = "backup"
- endif
-
- ; ***
- ; Do file equation for container file size
- ; ***
- if mid($serial,3,3) <> '2' and mid(value(terminal-type),1,2)<>"VT"
- :hp
- display '^m^j Are you connected to an HP 3000 host <yes>? '
- accept v7
- display '^m^j'
- let v7=pack(upper(v7))
- if mid(v7,1,2) = '/R'
- goto restart
- endif
- if mid(v7,1,2) = '/E'
- goto backabort
- endif
- if mid(v7,1,1) = 'N'
- goto backtime
- endif
- if mid(v7,1,1) = 'Y' or length(v7) = 0
- display '^m^j'
- ; Comment out this line if you have already issued a file equation
- transmit 'FILE $6;DISC=160800,32,1^M'
- wait 0:0:10 for "^J:"
- display '^m^j'
- goto backtime
- endif
- if mid(v7,1,2) <> '/H'
- display '^m^jError - invalid response!^m^j'
- endif
- display '^m^j^j If you answer yes to this prompt, the command file will^m^j'
- display ' transmit an HP 3000 file equation to the host to allocate^m^j'
- display ' space for the backup container file. The file equation^m^j'
- display ' will create a file with 160,800 records and 32 extents, with^m^j'
- display ' one extent initially allocated. This will be large enough to^m^j'
- display ' backup a disk with up to 40 megabytes of data. If a file ^m^j'
- display ' has more data than this, see the Reflection manual for more^m^j'
- display ' information. If a file equation has already been issued, ^m^j'
- display ' you may receive an error. Edit WRQBACK.RCL to comment out ^m^j'
- display ' the file equation to avoid getting this error.^m^j'
- goto hp
- endif
-
- :backtime
- ; ***
- ; Get delay in v9
- ; ***
- gosub getdelay
-
- ; ***
- ; Execute backup command
- ; ***
- let v8 = 'backup $1:$2$4 $6 $3$5'
- display '^j Proceed with the backup command:^m^j'
- if length(v9) <> 0
- display ' "$9"^m^j'
- endif
- display ' "$8" <yes>? '
- accept v7
- display '^m^j'
- let v7 = pack(upper(v7))
- if mid(v7,1,2) = '/E'
- goto backabort
- endif
- if mid(v7,1,2) = '/R'
- goto restart
- endif
- if mid(v7,1,1) <> '' AND mid(v7,1,1) <> 'Y'
- goto restart
- endif
- :doback
- if length(v9) <> 0
- $9
- endif
- continue
- $8
- let v8 = error-code
- let v9 = 'Backup'
- if v8 > 0
- goto abort
- endif
- goto exit
-
- ; ***
- ; Error exit
- ; ***
- :backabort
- let v9 = 'Backup'
- let v8 = -1
- goto abort
-
- ; ***
- ; Normal exit
- ; ***
- :exit
- continue
- set literal-escape "$0"
- if error
- set literal-escape $0
- endif
- quiet command off
- stop
-
- ; ***
- ; Error exit
- ; ***
- :abort
- display "^m^j"
- let v1 = mid(' ',1, (8 - length(v9)/2))
- let v2 = 17 - (length(v1) + length(v9))
- let v3 = mid(' ',1, v2)
- display '^m^j^j'
- if v8 = -1
- if mid($serial,3,3) = '2' or mid(value(terminal-type),1,2)="VT"
- display ")0^Nlqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk^m^j"
- display "x^O ^[[7m ^[[m"
- display "^[[7m $1 User aborted command file - NO $9 done! $3 ^[[m ^Nx^m^j"
- display "mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj^O^m^j^j"
- else
- display '^m^j^j'
- display "^nq;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;w^m^j"
- display '^n:^o ^[&dG $1 User aborted command file - NO $9 done! $3^[&d@ ^n:^m^j'
- display "^na;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;s^m^j^j"
- endif
- goto exit
- endif
- if v8 = 103 or v8 = 17 or v8 = 5
- if mid($serial,3,3) = '2' or mid(value(terminal-type),1,2)="VT"
- display ")0^Nlqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk^m^j"
- display "x^O ^[[7m ^[[m"
- display "^[[7m $1User aborted transfer - $9 not completed!$3 ^[[m ^Nx^m^j"
- display "mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj^O^m^j^j"
- else
- display '^m^j^j'
- display "^nq;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;w^m^j"
- display '^n:^o ^[&dG $1User aborted transfer - $9 not completed! $3^[&d@ ^n:^m^j'
- display "^na;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;s^m^j^j"
- endif
- goto exit
- endif
- if v8 = 101
- if mid($serial,3,3) = '2' or mid(value(terminal-type),1,2)="VT"
- display ")0^Nlqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk^m^j"
- display "x^O ^[[7m ^[[m"
- display "^[[7m $1 No files found that met $9 criteria. $3 ^[[m ^Nx^m^j"
- display "mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj^O^m^j^j"
- else
- display '^m^j^j'
- display "^nq;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;w^m^j"
- display '^n:^o ^[&dG $1 No files found that met $9 criteria. $3^[&d@ ^n:^m^j'
- display "^na;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;s^m^j^j"
- endif
- goto exit
- endif
- if length(v8) = 1
- let v1 = v1 & ' '
- let v3 = v3 & ' '
- endif
- if length(v8) = 2
- let v3 = v3 & ' '
- endif
- if mid($serial,3,3) = '2' or mid(value(terminal-type),1,2)="VT"
- display ")0^Nlqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk^m^j"
- display "x^O ^[[7m ^[[m"
- display "^[[7m $1 $9 failed! - Error $8 $3 ^[[m ^Nx^m^j"
- display "mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj^O^m^j^j"
- gosub describe_error
- else
- display '^m^j^j'
- display "^nq;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;w^m^j"
- display '^n:^o ^[&dG $1 $9 failed! - Error $8 $3^[&d@ ^n:^m^j'
- display "^na;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;s^m^j^j"
- gosub describe_error
- endif
- display '^m^j^j'
- goto exit
-
- ; ***
- ; put delay into v9
- ; ***
- :getdelay
- display '^j Delay execution of BACKUP command <yes>? '
- accept v8
- display '^m^j'
- let v8 = pack(upper(v8))
- if mid(v8,1,2) = '/H'
- display '^m^j If you select yes then your backup will not be started until the hour^m^j'
- display ' specified. In general, large backups should not be done during peak hours^m^j'
- display ' since response of the host will be slowed for other applications. Times are^m^j'
- display ' entered in hh:mm:ss format using a 24 hour clock, e.g. 11:25:00 or 17:30:00.^m^j'
- goto getdelay
- endif
- if mid(v8,1,2) = '/E'
- goto incrabort
- endif
- if mid(v8,1,2) = '/R'
- goto restart
- endif
- if mid(v8,1,1) <> '' AND mid(v8,1,1) <> 'Y'
- let v9 = ""
- goto enddelay
- endif
-
- :getdelay2
- let v9 = "17:30:00"
- display '^j Delay execution until <$9>? '
- accept v8
- display '^m^j'
- let v8 = pack(upper(v8))
- if mid(v8,1,2) = '/H'
- display '^m^j If you enter RETURN then your backup will be delayed until 5:30 P.M.^m^j'
- display ' Otherwise the time you enter will be when your backup starts.^m^j'
- goto getdelay2
- endif
- if mid(v8,1,2) = '/E'
- goto incrabort
- endif
- if mid(v8,1,2) = '/R'
- goto restart
- endif
- if mid(v8,1,1) <> '' AND mid(v8,1,1) <> 'Y'
- let v9 = "wait until $8"
- goto enddelay
- endif
- let v9 = "wait until $9"
- :enddelay
- return
-
- ; ***
- ; Describe error, given error-code in V8
- ; ***
- :describe_error
- continue
- goto error$8
- :error0
- return
- :error1
- display 'CTS or DSR required, or change connection configuration back to DIRECT'
- return
- :error2
- display 'EOF on file read
- return
- :error3
- display 'Timeout while waiting for expected or specified data
- return
- :error4
- display 'Received unexpected data from host
- return
- :error5
- display 'File transfer aborted by user
- return
- :error6
- display 'Fatal block number sequence error on a file transfer
- return
- :error7
- display 'Received a nonprocessable message during file transfer
- return
- :error8
- display 'Data message received during file transfer was not correct packet type
- return
- :error9
- display 'File transfer aborted by host program
- return
- :error10
- display 'Local file does not exist
- return
- :error12
- display "PC file transfer software is incompatible with host file transfer software^m^j
- display " Was the host file transfer software that accompanied this copy of Reflection^m^j
- display " uploaded? It's likely that you need to upload a newer version of the host^m^j
- display " file transfer software. Please see your Reflection 'Getting Started' guide^m^j
- display " for instructions on how to upload the host file transfer software.
- return
- :error13
- display 'DOS disk error detected
- return
- :error14
- display 'Too many consecutive naks received or sent during file transfer
- return
- :error15
- display 'Could not create local file
- return
- :error16
- display 'Could not execute host file transfer program
- return
- :error17
- display 'User requested termination of file transfer with STOP key (not ABORT)
- return
- :error18
- display 'Local filename already exists
- return
- :error19
- display 'Unexpected error detected
- return
- :error97
- display 'Encryption version mismatch
- return
- :error101
- display 'No files were found to back up
- return
- :error103
- display 'Backup terminated by user
- return
- :error104
- display "Backup terminated due to error^m^j
- display " Are you signed onto the host and at a system prompt?^m^j
- display " Is Reflection's host file transfer software accessible?
- return
- :error160
- display 'Bad command
- return
- :error161
- display 'Bad syntax
- return
- :error162
- display 'Error detected while executing command
- return
- :error163
- display 'Encryption version mismatch
- return