MANAGER%UMDHEP.BITNET@WISCVM.ARPA (09/04/85)
DAMN, I'm embarrassed! Wrong file went out because my editor keeps track of names funny. Here is the correct posting. Send me many flames, please! I'm a baaaaaad boy. --tsa $! TERMCHECK.COM -- 1) identifies the physical device name if $! TT: is a virtual device. $! 2) fixes the process name to be both unique $! and informative. $! 3) keeps ordinary users off of OPA0: (or any $! other terminal you choose. $! $! This should be called from SYLOGIN first thing. Batch jobs will $! have their process names changed to the username with "_B" and $! the job number appended. If the string is too long, the tail of $! the username is chopped to get a 15 character string. $! I have taken moderate care to keep the code efficient so that $! logins aren't slowed down too much. $! $! Todd Aven (MANAGER%UMDHEP.BITNET@WISCVM.ARPA) $! Softwear Sweatshop $! High Energy Physics $! University of Maryland $! $ mode= f$mode() $ if mode.eqs."OTHER".or.mode.eqs."NETWORK" then exit $ prcnam = f$process() $ user = f$getjpi("","username") $ blank = f$locate(" ",user) $ user = f$extract(0,blank,user) $ if user.eqs.prcnam then goto okname $! icky process name (terminal name) so we take the terminal number $! and stick it onto the end of the username. If the username is long, $! we will shorten it so that the total name is not more than 15 chars. $ if f$mode().nes."BATCH" then goto interactive $ lprcnam=f$length(prcnam) $ tail = "_B"+f$extract(6,lprcnam-6,prcnam) $ goto no_more_specific $interactive: $ lprcnam = f$length(prcnam) $ tail = "_" + f$extract(1,2,prcnam)+f$extract(4,lprcnam-5,prcnam) $no_more_specific: $ ltail = f$length(tail) $ luser = f$length(user) $ if (luser+ltail).le.15 then goto setname $ luser=15-ltail $setname: $ prcnam = f$extract(0,luser,user)+tail $ set proc/name='prcnam' $okname: $ virt = f$getdvi("TT:","TT_PHYDEVNAM") $ if (virt.eqs."")then goto novirt $ term == virt $ goto check $novirt: $ term == f$logical("TT") $check: $ if term .eqs. "_OPA0:" then goto opconsole $ exit $opconsole: $ uic = f$user() $ group = f$extract(1,f$locate(",",uic)-1,uic) $! Some accounts like SHUTDOWN are single-member groups, so the $! UIC identifier is [SHUTDOWN], which doesn't have commas in it. $ if group .eqs. "SHUTDOWN]" then exit $ if group .eqs. "GOWNER]" then exit $ if group .eqs. "SYS" then exit $ if group .eqs. "SUPPORT" then exit $ write sys$output "" $ write sys$Output "Use of this equipment is restricted to systems staff." $ logout