KVC@engvax.UUCP (09/09/85)
Here's a handy little command procedure that lets you keep TPU running
all the time in a background process similar to kept EMACS.
/Kevin Carosso engvax!kvc @ CIT-VAX.ARPA
Hughes Aircraft Co.
-------------------------- KEPT_TPU.COM ---------------------------------
$ veri = F$VERIFY(0)
$ !
$ ! KEPT_TPU.COM
$ !
$ ! Written by Kevin Carosso at Hughes Aircraft Co., S&CG/CTC 8/8/85
$ ! Modelled after KEPTEMACS.
$ !
$ ! This procedure performs the kept TPU function.
$ !
$ ! If there is a process called "TPU terminal-name" then ATTACH to it
$ ! because it's the waiting TPU. If not just SPAWN a TPU with the
$ ! P1 ... P8 parameters. This means that any qualifiers you want to
$ ! pass to TPU need be separated from the "@KEPT_TPU" by the file, so they
$ ! will appear as Pn, rather than qualifiers to the "@" itself. For
$ ! example:
$ ! $ @KEPT_TPU zeep.txt/section=edtsecini
$ ! $ @KEPT_TPU zeep.txt /section=edtsecini
$ ! $ @KEPT_TPU "/section=edtsecini" zeep.txt
$ !
$ ! should all work.
$ !
$ ! To get back to your parent, just issue the "ATTACH" command with
$ ! no arguments. Note that this procedure will work with LSE if you
$ ! change the EDIT command in the spawn.
$ !
$ TPU_name = "TPU " + f$log("TT")
$ priv_list = f$setprv ("NOWORLD, NOGROUP")
$ pid = 0
$ 10$:
$ proc = f$getjpi( f$pid( pid ), "PRCNAM" )
$ if proc .eqs. TPU_name then $ goto attach
$ if pid .ne. 0 then $ goto 10$
$ spawn:
$ priv_list = f$setprv( priv_list )
$
$ write sys$error -
"[Spawning a new Kept TPU]"
$
$ args = P1 + " " + P2 + " " + P3 + " " + P4 + " " + -
P5 + " " + P6 + " " + P7 + " " + P8
$ define/user sys$input sys$command
$ spawn /process="''TPU_name'" -
/nolog -
EDIT/TPU 'args
$ write sys$error -
"[Attached to DCL in directory ''f$logical("SYS$DISK")'''f$directory()']"
$
$ GOTO quit
$ attach:
$ priv_list = f$setprv( priv_list )
$
$ write sys$error -
"[Attaching to Kept TPU]"
$ assign/user sys$command sys$input
$ attach "''TPU_name'"
$ write sys$error -
"[Attached to DCL in directory ''f$logical("SYS$DISK")'''f$directory()']"
$QUIT:
$ if veri then set verify
$ exitAWalker@RED.RUTGERS.EDU (*Hobbit*) (09/10/85)
I came up with a similar hack a while back for EDT. Since EDT doesn't attach back to its parent process, the top-level invocation had to wait around for a ^Y, and suspend the EDT process. An interesting feature is that if you ^Y while in change mode, EDT wants to accept another character before the suspend takes effect. If you type a ^L there, you'll get back to your top level process, and when you resume EDT, it redraws the screen for you. While working on this, I found that *one* set process/suspend was *not enough* to really hang the EDT fork! It needs two of them! Any reason? The comfile in question lives at RU-AIM in dua0:<usr.hobbit>kedt.com, and can be FTPed using GUEST [no passwd] if you want to look at it. _H* -------