tldm-universe/Ardent/UV/APP.PROGS/LOG.RESTORE.B

122 lines
3.1 KiB
Plaintext
Raw Normal View History

2024-09-09 21:51:08 +00:00
******************************************************************************
*
* System Admin Transaction Logging - Restore Files
*
* Module %M% Version %I% Date %H%
*
* (c) Copyright 1998 Ardent Software Inc. - All Rights Reserved
* This is unpublished proprietary source code of Ardent Software Inc.
* The copyright notice above does not evidence any actual or intended
* publication of such source code.
*
*******************************************************************************
*
* Maintenence log - insert most recent change descriptions at top
*
* Date.... GTAR# WHO Description........................................
* 10/14/98 23801 SAP Change copyrights.
* 06/10/96 18591 EAP No longer uses tlrestore shell script
* 03/25/96 18212 LAG Windows NT port
* 10/14/94 15104 DTM Fixed to verify number of prompts
* 05/15/94 13286 DTM Initial programming
*
*******************************************************************************
$OPTIONS INFORMATION
id = "%W%"
*******************************************************************************
$INCLUDE UNIVERSE.INCLUDE TLOG.H
$INCLUDE UNIVERSE.INCLUDE FILENAMES.H
$INCLUDE UNIVERSE.INCLUDE MACHINE.NAME
$IFDEF UV.MSWIN
$DEFINE COMMAND.SEPARATOR "&&"
$ELSE
$DEFINE COMMAND.SEPARATOR ";"
$ENDIF
TMP = TRIM( @SENTENCE )
@SYSTEM.RETURN.CODE = 0
CNT = COUNT( TMP, " " )
IF ( CNT < 2 OR CNT > 4 ) THEN
PRINT "Error: Incorrect number of arguments"
@SYSTEM.RETURN.CODE = -1
END
FirstLog = FIELD( TMP, " ", 2 )
LastLog = FIELD( TMP, " ", 3 )
PATH = FIELD( TMP, " ", 4 )
IF PATH = "" THEN
RECIO( PATH, RECIO$PATH )
END
* Check that the specified directory exists
OPENPATH PATH TO FVAR THEN
IF STATUS() <> 19 AND STATUS() <> 1 THEN
PRINT "Error: ":PATH:" is not a directory."
@SYSTEM.RETURN.CODE = -1
END
END
ELSE
PRINT "Error: Unable to open ":PATH
@SYSTEM.RETURN.CODE = -1
END
CLOSE FVAR
Device = FIELD( TMP, " ", 5 )
IF Device = "" THEN
* use MT0
Device = "MT0"
END
* If Device is the id of a record in the &DEVICE& file then it is a
* Universe device name otherwise its is an OS file name which on UNIX
* could be an OS tape device name.
OPEN "","&DEVICE&" TO FVAR ELSE
PRINT "Error: Unable to open &DEVICE& file."
@SYSTEM.RETURN.CODE = -1
END
READV REC FROM FVAR,Device,0 ELSE
Filename = Device
Device = ""
END
CLOSE FVAR
* Generate a list of log file names to restore.
list = ""
FOR i = FirstLog TO LastLog
list := " -F lg":i
NEXT i
IF @SYSTEM.RETURN.CODE = 0 AND list <> "" THEN
* Get settings for terminal so that we can restore them after
* uvrestore has completed.
TTYGET tty.settings ELSE NULL
* cd to specified directory and restore using file name list.
* Blocksize of 512 is temporary workaround for Gtar 18540
Exec.Sentence = OS.EXEC: " 'cd ":PATH:COMMAND.SEPARATOR:UV.ROOT:"/bin/uvrestore -v -l -b 512":list
IF Device <> "" THEN
Exec.Sentence := " -t ":Device
END
ELSE
Exec.Sentence := " ":Filename
END
Exec.Sentence := "'"
EXECUTE Exec.Sentence
TTYSET tty.settings ELSE NULL
END
RETURN
END