From:	MERC::"uunet!CRVAX.SRI.COM!RELAY-INFO-VAX" 27-APR-1992 13:51:02.72
To:	INFO-VAX@SRI.COM
CC:	
Subj:	LOG_PORT  1/1

$! ------------------ CUT HERE -----------------------
$ v='f$verify(f$trnlnm("SHARE_VERIFY"))'
$!
$! This archive created by VMS_SHARE Version 7.2-007  22-FEB-1990
$!   On  8-JAN-1992 10:40:48.74   By user ACCESS 
$!
$! This VMS_SHARE Written by:
$!    Andy Harper, Kings College London UK
$!
$! Acknowledgements to:
$!    James Gray       - Original VMS_SHARE
$!    Michael Bednarek - Original Concept and implementation
$!
$! TO UNPACK THIS SHARE FILE, CONCATENATE ALL PARTS IN ORDER
$! AND EXECUTE AS A COMMAND PROCEDURE  (  @name  )
$!
$! THE FOLLOWING FILE(S) WILL BE CREATED AFTER UNPACKING:
$!       1. INSTALL_LOG_PORT.COM;1
$!       2. LOG_PORT.MAR;1
$!       3. RUN_LOG_PORT.COM;1
$!
$set="set"
$set symbol/scope=(nolocal,noglobal)
$f=f$parse("SHARE_TEMP","SYS$SCRATCH:.TMP_"+f$getjpi("","PID"))
$e="write sys$error  ""%UNPACK"", "
$w="write sys$output ""%UNPACK"", "
$ if f$trnlnm("SHARE_LOG") then $ w = "!"
$ ve=f$getsyi("version")
$ if ve-f$extract(0,1,ve) .ges. "4.4" then $ goto START
$ e "-E-OLDVER, Must run at least VMS 4.4"
$ v=f$verify(v)
$ exit 44
$UNPACK: SUBROUTINE ! P1=filename, P2=checksum
$ if f$search(P1) .eqs. "" then $ goto file_absent
$ e "-W-EXISTS, File ''P1' exists. Skipped."
$ delete 'f'*
$ exit
$file_absent:
$ if f$parse(P1) .nes. "" then $ goto dirok
$ dn=f$parse(P1,,,"DIRECTORY")
$ w "-I-CREDIR, Creating directory ''dn'."
$ create/dir 'dn'
$ if $status then $ goto dirok
$ e "-E-CREDIRFAIL, Unable to create ''dn'. File skipped."
$ delete 'f'*
$ exit
$dirok:
$ w "-I-PROCESS, Processing file ''P1'."
$ if .not. f$verify() then $ define/user sys$output nl:
$ EDIT/TPU/NOSEC/NODIS/COM=SYS$INPUT 'f'/OUT='P1'
PROCEDURE Unpacker ON_ERROR ENDON_ERROR;SET(FACILITY_NAME,"UNPACK");SET(
SUCCESS,OFF);SET(INFORMATIONAL,OFF);f:=GET_INFO(COMMAND_LINE,"file_name");b:=
CREATE_BUFFER(f,f);p:=SPAN(" ")@r&LINE_END;POSITION(BEGINNING_OF(b));
LOOP EXITIF SEARCH(p,FORWARD)=0;POSITION(r);ERASE(r);ENDLOOP;POSITION(
BEGINNING_OF(b));g:=0;LOOP EXITIF MARK(NONE)=END_OF(b);x:=ERASE_CHARACTER(1);
IF g=0 THEN IF x="X" THEN MOVE_VERTICAL(1);ENDIF;IF x="V" THEN APPEND_LINE;
MOVE_HORIZONTAL(-CURRENT_OFFSET);MOVE_VERTICAL(1);ENDIF;IF x="+" THEN g:=1;
ERASE_LINE;ENDIF;ELSE IF x="-" THEN IF INDEX(CURRENT_LINE,"+-+-+-+-+-+-+-+")=
1 THEN g:=0;ENDIF;ENDIF;ERASE_LINE;ENDIF;ENDLOOP;t:="0123456789ABCDEF";
POSITION(BEGINNING_OF(b));LOOP r:=SEARCH("`",FORWARD);EXITIF r=0;POSITION(r);
ERASE(r);x1:=INDEX(t,ERASE_CHARACTER(1))-1;x2:=INDEX(t,ERASE_CHARACTER(1))-1;
COPY_TEXT(ASCII(16*x1+x2));ENDLOOP;WRITE_FILE(b,GET_INFO(COMMAND_LINE,
"output_file"));ENDPROCEDURE;Unpacker;QUIT;
$ delete/nolog 'f'*
$ CHECKSUM 'P1'
$ IF CHECKSUM$CHECKSUM .eqs. P2 THEN $ EXIT
$ e "-E-CHKSMFAIL, Checksum of ''P1' failed."
$ ENDSUBROUTINE
$START:
$ create 'f'
X$! INSTALL_LOG_PORT.COM`20
X$! Procedure to install LOG_PORT program with CMKRNL
X$!
X$   install :== $sys$system:install/command
X$   install create/open/head/share SYS$SYSTEM:LOG_PORT.EXE/priv=(CMKRNL)
X$   exit
$ CALL UNPACK INSTALL_LOG_PORT.COM;1 825381295
$ create 'f'
X`09.Title log_port
X`09.ident`09/V01.00/
X;+
X;
X; ----`09LOG_PORT:`09Process' terminal server and port logging`20
X;
X;
X; Facility:
X;
X;`09VAX/VMS system management
X;
X; Environment:
X;
X;`09VAX/VMS V5.2 or later, kernel mode
X;
X;`09This routine will extract the current process' terminal server
X;`09name and port id, if it is a lat process.   This information will
X;`09then be stored in the remote node name and remote node id fields of`20
X;`09the process' P1 space.  These fields are normally only used by
X;`09RTTDRIVER and REMACP for remote process'.  These fields are
X;`09however written by the system accounting facility and will provide
X;`09a convenient means for storing and tracking this information.
X;
X; Version:     `09V01.000
X; Date:`09`0907-FEB-1990
X;                        `20
X; Kevin`09F. Homan
X; Science Applications, Inc.`09
X; 800 Oak Ridge Turnpike
X; Oak Ridge, TN  37830
X; (615) 482-9031
X;
X;
X; Modifications:
X;
X;                                                    `20
X;-                                                   `20
X `09.page `20
X        .library "SYS$LIBRARY:LIB"                      ;Get special macros
V from here
X        .link    "sys$system:sys.stb"/selective_Search  ;Ease the link proce
Vss a bit
X`09.Psect`09DATA`09noexe,rd,wrt,nopic,noshr,page
Xdvi_list:`09.word`0930
X`09`09.word`09DVI$_TT_ACCPORNAM
X`09`09.address port_buffer
X`09`09.address port_descr
X`09`09.long`090
Xttname_desc:`09.ascid /TT/
Xttchan:`09.blkw`091
Xarglst:`09`09.LONG`092
X`09`09.address port_descr
X`09`09.address port_buffer
Xport_descr:`09.long 64
X`09`09.address`09port_buffer
Xport_buffer:`09.blkb`0964
X
X`09.Psect`09`09CODE`09EXE,RD,NOWRT,NOPIC,SHR,PAGE
X`09.Entry`09Start,`5Em<>
X
X`09$Assign_s -
X`09`09Devnam`09= ttname_desc, -
X`09`09Chan`09= ttchan`09; assign tt
X `09Blbc`09r0,10$`09`09`09; can't, die
X`09$Getdvi_s Chan`09= ttchan,-`09; Get the real
X`09`09Itmlst`09= Dvi_list`09; device name
X `09blbs`09r0,20$`09`09`09; did all of it work?
X10$:`09ret`09`09`09`09; by
X20$:`09cmpb`09#0,port_buffer`09`09; check port
X`09beql`0950$`09`09`09; null?
X`09$cmkrnl_s -`09`09`09; no, continue
X`09`09arglst = arglst,-`09; arglst
X`09`09routin = move_info`09; get info in kernel mode
X`09blbs`09r0,40$                  ; err?
X`09Ret
X40$:`09$dassgn_s chan=ttchan`09`09; free chan
X50$:`09$exit_s
X `09.page `20
X`09.entry`09move_info,`5Em<r2,r3,r4,r5>
X`09nop
X`09movl`094(ap),r3`09`09; get port length
X`09movl`09(r3),r2`09`09`09; length of server/port name
X`09movl`098(ap),r3`09`09; address of server name
X`09locc  `09#`5EA"/",r2,(r3)`09`09; locate position of server
X`09subl`09r0,r2`09`09`09; calculate actual server length
X `09pushr`09#`5Em<r0,r2,r3>`09`09; save server length
X`09cmpb   `09#6,r2`09`09`09; have room for 6 characters
X`09bgeq`095$`09`09`09; is there room
X`09movb`09#6,r2 `09       `09       `09; no, just give first 6
X5$:`09movb`09r2,ctl$t_nodename      `09; store length of server
X`09movc5  `09r2,(r3),#`5EA/ /,#6,ctl$t_nodename+1; store the server name
X                                        ; in remote node field
X `09popr`09#`5Em<r0,r2,r3>`09`09; restore port length
X`09addl`09r2,r3`09`09`09; offset to the portname
X`09decl`09r0`09`09`09; exclude delimiter
X`09incl`09r3`09`09`09; ditto
X`09cmpb   `09#16,r0`09`09`09; have room for 16 characters
X`09bgeq   `0910$`09`09`09; is there room
X`09movb`09#16,r0`09`09`09; no, just give first 16
X10$:`09movb   `09r0,ctl$t_remoteid`09; store length of port name
X`09movc5  `09r0,(r3),#`5EA/ /,#16,ctl$t_remoteid+1; store port name
X                                        ; in remote id field
X`09movl`09#ss$_normal,r0
X`09ret
X`09.end`09start
$ CALL UNPACK LOG_PORT.MAR;1 1745162996
$ create 'f'
X$! RUN_LOG_PORT.COM`20
X$ If F$MODE() .eqs. "INTERACTIVE" then run sys$system:log_port
X$ exit
$ CALL UNPACK RUN_LOG_PORT.COM;1 1393915153
$ v=f$verify(v)
$ EXIT

