tldm-universe/Ardent/UV/BP/MKFILELIST.B

215 lines
4.7 KiB
Plaintext
Raw Normal View History

2024-09-09 21:51:08 +00:00
*******************************************************************************
*
* Select local files within a specific account
*
* 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 18438 JC Change message for NT compatabilty.
* 03/25/96 18212 LAG Windows NT port
* 03/13/96 17797 AGM Replace 'SH -c' with OS.EXEC
* 01/18/93 10886 CSM Initial Creation
*
*******************************************************************************
$OPTIONS DEFAULT
$INCLUDE UNIVERSE.INCLUDE FILENAMES.H
$INCLUDE UNIVERSE.INCLUDE MACHINE.NAME
******************
** Windows NT port
**
DEFFUN IS.EQPATHS(FILESPEC.A, FILESPEC.B) CALLING "*IS.EQPATHS"
DEFFUN IS.FULLPATH(FILESPEC) CALLING "*IS.FULLPATH"
**
******************
!
* Check that we are within uniVerse home directory
!
******************
** Windows NT port
**
if not(IS.EQPATHS(@PATH, UV.ROOT)) then
print "You must be within the uniVerse home account to run this program!"
stop
END
**
******************
$IFDEF UV.MSWIN
if SYSTEM(27) # 0 then stop "You must be an administrator to run this program!"
$ELSE
if SYSTEM(27) # 0 then stop "You must be root to run this program!"
$ENDIF
!
* Get command line
!
CommandLine = convert(" ",@fm,@sentence)
locate "MKFILELIST" in CommandLine setting POS then
* Get rid of everything up to and including program name
for i = 1 to POS
del CommandLine<1>
next i
end
!
* Make certain enough arguments
!
NumArgs = dcount(CommandLine,@fm)
if NumArgs # 2 then
print "Incorrect Number of arguments"
print
print "Syntax: MKFILELIST accountname outputlistname"
print
stop
end
AccountName = CommandLine<1>
OutputName = CommandLine<2>
!
* Make certain outputlist name does NOT exist
!
getlist OutputName to 1 then
print
print "Output list '":OutputName:"' exists! Overwrite (Y/n)":
input answer
if upcase(answer[1,1]) # "Y" then stop
clearselect 1
deletelist OutputName
end
!
* Open VOC file for uvhome account
!
open "VOC" to UVVOCfile else
print "Unable to open uniVerse home account VOC file."
stop
end
!
* Open UV.ACCOUNT file
!
open "UV.ACCOUNT" to UVACCOUNTfile else
print "Unable to open UV.ACCOUNT file."
stop
end
!
* Read account record from UV.ACCOUNT file
!
read AccountRec from UVACCOUNTfile,AccountName else
print "'":AccountName:"' cannot be read from UV.ACCOUNT file!"
stop
end
!
* Verify field 11 (path) exists
!
AccountPath = AccountRec<11>
if AccountPath = "" then
print "Path for account '":AccountName:"' not defined in field 11!"
stop
end
!
* Create temp VOC record
!
TempRec = ""
TempRec = "QFile Pointer to ":AccountName:" account"
TempRec := @fm:AccountName
TempRec := @fm:"VOC"
write TempRec on UVVOCfile,AccountName:".VOC" else
print "Unable to write '":AccountName:".VOC' to VOC file."
stop
end
******************
** Windows NT port
**
!
* Open remote VOC file
!
open AccountName:".VOC" to QFile else
print "Unable to open VOC in account ":AccountName
stop
end
!
* Select remote VOC for local files
!
SelectStmt = 'SSELECT ':AccountName:'.VOC'
SelectStmt:= ' WITH TYPE = "F" AND WITH F2 # "." AND WITH F2 # ""'
print "Selecting Files..."
execute SelectStmt rtnlist FileList setting NumSelected capturing screen
if NumSelected <= 0 then
print "No files selected."
stop
end
!
* Massage list
!
eof = 0
KeyCount = 0
CorrectList = ""
loop
readnext filename from FileList else eof = 1
until eof do
* Skip files that begin with ampersand &
if filename[1,1] = "&" or filename = "VOC" or filename = "VOCLIB" then
continue
end
* Skip files that are not local
read rec from QFile,filename else continue
if IS.FULLPATH(rec<2>) then
continue
end
* add to list
if CorrectList # "" then
CorrectList := @fm:AccountName:":":filename
end else
CorrectList = AccountName:":":filename
end
KeyCount += 1
repeat
!
* Get rid of Temp VOC pointer
!
close QFile
delete UVVOCfile,AccountName:".VOC"
**
******************
!
* Saving list to &SAVEDLISTS& file
!
writelist CorrectList on OutputName
!
* Display number written
!
print KeyCount:" files saved"
!
* end of code
!
stop
end