tldm-universe/Ardent/UV/BP/SET.TERM.TYP

168 lines
4.0 KiB
Plaintext
Raw Normal View History

2024-09-09 21:51:08 +00:00
*******************************************************************************
*
* Change the current Terminal Type
*
* 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.
* 07/09/97 20481 PEJ Reject map changes when NLS disabled
* Retain map setting when terminal type changed
* 05/22/97 20678 PEJ Fix map name for case invert code
* 12/15/94 15740 JC Addition of NLS support
* 08/09/93 12302 ALC Added PI/open options FUNDAMENTAL and VERIFY.SUP.
* 07/21/92 8767 PVW make the ? option work
* 08/29/89 5014 JWT make terminal name optional
* 07/25/88 - - Maintenence log purged at 5.2.1, see release 5.1.10.
*
*******************************************************************************
$include UNIVERSE.INCLUDE TERMINFO
$include UNIVERSE.INCLUDE FILENAMES.H
$include UNIVERSE.INCLUDE UVNLS.H
equ HT to char(9)
dim argv(20)
matparse argv from trim(@sentence)," "
* Set pointer to first real argument
argp = if downcase( argv( 1 ) ) = "run" then 4 else 2
width = ""
length = ""
* Pick up the current terminal type and NLS map names
orig.type = @TERM.TYPE
term.type = ""
NLS.on = SYSTEM( NLS$ON)
if NLS.on then
orig.map = SYSTEM( NLS$TERMMAP )
orig.auxmap = SYSTEM( NLS$AUXMAP )
end else
orig.map = ""
orig.auxmap = ""
end
* Use current settings for omitted arguments
map = orig.map
auxmap = orig.auxmap
hush = 0
verify = 1
if argv(argp) = "" then
ask:
crt
crt
crt "Enter Terminal name (or '?' to list possible choices)":
input term.type
heading ""
printer reset
begin case
case term.type = "?"
openseq UV.ROOT:"/terminfo/index" to f.index then
heading "Available Terminal Types'CLL'Name.......... Description...................................................'L'"
loop
readseq l from f.index else exit
crt field(l,HT,1)"l#14 ":field(l,HT,2,99)
repeat
goto ask
end
case term.type = ""
stop
end case
end
loop
key = upcase(argv(argp))
argp += 1
begin case
case key = ""
exit
case key = "WIDTH"
width = argv(argp)
argp += 1
case key = "LENGTH"
length = argv(argp)
argp += 1
case key = "MAP"
if NLS.on then
map = argv(argp)
argp += 1
end else
stop "Cannot change maps when NLS disabled"
end
case key = "AUXMAP"
if NLS.on then
auxmap = argv(argp)
argp += 1
end else
stop "Cannot change maps when NLS disabled"
end
case key = "AUTONL"
NULL
case key = "NEEDNL"
NULL
case key = "HUSH"
hush = 1
case key = "FUNDAMENTAL"
NULL
case key = "VERIFY.SUP"
verify = 0
case 1
if term.type = "" then
term.type = argv( argp - 1 )
end else
crt "Unidentified word: " : key
end
end case
repeat
* Attempt to apply the requested change
if term.type = "" then
term.type = orig.type
end
perform "TERM ":width:",":length:",0,,,,,,":map:",":auxmap:",":term.type
terminfo$ = terminfo(0); * Get the current terminfo data
if TERMINAL.NAME = "" then
* Change didn't work, try again with lowercase terminal type
perform "TERM ,,,,,,,,":map:",":auxmap:",":downcase(term.type)
terminfo$ = terminfo(0); * Get the current terminfo data
if TERMINAL.NAME = "" then
* Still didn't work, re-instate original
perform "TERM ,,,,,,,,":orig.map:",":orig.auxmap:",":orig.type
print quote(term.type):" is not a valid terminal type."
if verify then
goto ask
end
end
end
if hush
else crt field(TERMINAL.NAME, "|", dcount(TERMINAL.NAME,"|")):" (":@TERM.TYPE:")"