tldm-universe/Ardent/UV/APP.PROGS/GCI.NTADDL.B

115 lines
3.7 KiB
Plaintext
Raw Permalink Normal View History

2024-09-09 21:51:08 +00:00
*****************************************************************************
*
* GCI.NTADDL.B - add a new entry to the standard GCI library list
*
* 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.
*
*******************************************************************************
*
* Maintenance log - insert most recent change descriptions at top
*
* Date.... GTAR# WHO Description.........................................
* 10/14/98 23801 SAP Change copyrights.
* 04/04/96 18026 PGW Module created.
*
*******************************************************************************
*
* This program adds a new entry to the standard list of GCI libraries held
* in the Windows NT Registry. It is invoked like this:
*
* RUN APP.PROGS GCI.NTADDL.B dll.path
*
* where 'dll.path' is the name of a GCI library.
*
* GCI.NTADDL.B can be run whether or not the GCI is installed, so that a
* software vendor whose software uses GCI routines can build a GCI library
* on his own system, and then install his software on an end-user's system
* without needing to install the GCI there.
*
* This program does not print any output unless an error occurs. It sets
* @SYSTEM.RETURN.CODE as follows:
*
* 0 the DLL path was added successfully.
*
* 1 the DLL path supplied already exists in the standard library list.
* The list is not updated, and no message is generated.
*
* -1 some other error has occured, and an error message is printed.
*
*******************************************************************************
*
$OPTIONS DEFAULT
PROGRAM GCI.NTADDL.B
ID = "@(#)%M% %I%"
DECLARE GCI UVREGgetstring
DECLARE GCI UVREGputstring
DECLARE GCI NTerrtext
EQUATE system.lib.list TO "UvGCILibraries"
* Win32 error code
EQUATE error.file.not.found TO 2
* Get the library name from the command line
cmd = CONVERT(" ", @FM, TRIM(@SENTENCE))
dll.path = cmd<4>
IF dll.path = "" THEN
PRINT "You must specify a GCI library pathname."
@SYSTEM.SET = -1
STOP
END
* Get the system library list from the registry, to be updated
lib.list = ""
lib.type = 0
rslt = UVREGgetstring(system.lib.list, lib.list, lib.type)
IF rslt # 0 THEN
IF rslt = error.file.not.found THEN
lib.list = ""
END ELSE
PRINT "Error ":rslt:" reading the system registry:"
dummy = NTerrtext(rslt, err.text)
IF LEN(err.text) > 0 THEN
PRINT err.text
END
@SYSTEM.SET = -1
STOP
END
END
* Add the new path to the list, first checking that it is not
* already there
CONVERT ";" TO @FM IN lib.list
LOCATE dll.path IN lib.list<1> SETTING lib.pos THEN
* The DLL path given is already in the list
@SYSTEM.SET = 1
END ELSE
* Not there, so go ahead and update
INS dll.path BEFORE lib.list<1>
CONVERT @FM TO ";" IN lib.list
rslt = UVREGputstring(system.lib.list, lib.list)
IF rslt # 0 THEN
PRINT "Error ":rslt:" updating the system registry:"
dummy = NTerrtext(rslt, err.text)
IF LEN(err.text) > 0 THEN
PRINT err.text
END
@SYSTEM.SET = -1
STOP
END
@SYSTEM.SET = 0
END
* Done
STOP
END