From:	CSBVAX::MRGATE!graham@drcvax.arpa@SMTP 26-AUG-1988 08:57
To:	ARISIA::EVERHART
Subj:	Snap coming, tapes - sure, I'd love 'em


Date: 26 Aug 88 08:10:00 EST
From: <graham@drcvax.arpa>
Subject: Snap coming, tapes - sure, I'd love 'em
To: "everhart%arisia.decnet" <everhart%arisia.decnet@ge-crd.arpa>
Reply-To: <graham@drcvax.arpa>

Glen,

Your kind offer prompted me to place you at the top of the list, (who says 
I can't be bribed).  I would really like those SIG tapes, I don't have a 
company who will spend five cents for them, and the LUG is 150 miles away, 
and I am partially blind and don't drive, so...I'll take 'em.  If you wish, 
I can send some blank tapes, or just return yours asap.

Included after this message is part one of Snap's 7 parts.

Dan Graham
Dynamics Research Corporation
60 Frontage Road
Andover, Ma  01810
(800) 522-4321 x 2352

graham@drcvax.arpa

....................... Cut between dotted lines and save. .....................
$!.............................................................................
$! VAX/VMS archive file created by VMS_SHARE V06.00 26-May-1988.
$!
$! VMS_SHARE was written by James Gray (Gray:OSBUSouth@Xerox.COM) from
$! VMS_SHAR by Michael Bednarek (U3369429@ucsvc.dn.mu.oz.au).
$!
$! To unpack, simply save, concatinate all parts into one file and
$! execute (@) that file.
$!
$! This archive was created by user GRAHAM
$! on  6-APR-1866 20:07:23.77.
$!
$! ATTENTION: To keep each article below 31 blocks (15872 bytes), this
$!            program has been transmitted in 7 parts.  You should
$!            concatenate ALL parts to ONE file and execute (@) that file.
$!
$! It contains the following 7 files:
$!        AAAREADME.TXT
$!        BUILD.COM
$!        CONTINUOUS.COM
$!        LIB_DEFAULT_DIR.MAR
$!        SNAP.FOR
$!        TERM.COM
$!        VIEW.COM
$!
$!==============================================================================
$ SET SYMBOL/SCOPE=( NOLOCAL, NOGLOBAL )
$ VERSION = F$GETSYI( "VERSION" )
$ IF VERSION .GES "V4.4" THEN GOTO VERSION_OK
$ WRITE SYS$OUTPUT "You are running VMS ''VERSION'; ", -
    "VMS_SHARE V06.00 26-May-1988 requires VMS V4.4 or higher."
$ EXIT 44 
$VERSION_OK:
$ GOTO START
$
$UNPACK_FILE:
$ WRITE SYS$OUTPUT "Creating ''FILE_IS'"
$ DEFINE/USER_MODE SYS$OUTPUT NL:
$ EDIT/TPU/COMMAND=SYS$INPUT/NODISPLAY/OUTPUT='FILE_IS'/NOSECTION -
    VMS_SHARE_DUMMY.DUMMY
b_part := CREATE_BUFFER( "{Part}", GET_INFO( COMMAND_LINE, "file_name" ) )
; s_file_spec := GET_INFO( COMMAND_LINE, "output_file" ); SET( OUTPUT_FILE
, b_part, s_file_spec ); b_errors := CREATE_BUFFER( "{Errors}" ); i_errors 
:= 0; pat_beg_1 := ANCHOR & "-+-+-+ Beginning"; pat_beg_2 := LINE_BEGIN 
& "+-+-+-+ Beginning"; pat_end := ANCHOR & "+-+-+-+-+ End"; POSITION
( BEGINNING_OF( b_part ) ); i_append_line := 0; LOOP EXITIF MARK( NONE 
) = END_OF( b_part ); s_x := ERASE_CHARACTER( 1 ); IF s_x = "+" THEN r_skip 
:= SEARCH( pat_beg_1, FORWARD, EXACT ); IF r_skip <> 0 THEN s_x := ""
; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ERASE_LINE; ENDIF; ENDIF
; IF s_x = "-" THEN r_skip := SEARCH( pat_end, FORWARD, EXACT ); IF r_skip <
> 0 THEN s_x := ""; MOVE_HORIZONTAL( -CURRENT_OFFSET ); m_skip := MARK( NONE )
; r_skip := SEARCH( pat_beg_2, FORWARD, EXACT ); IF r_skip <> 0 THEN POSITION
( END_OF( r_skip ) ); MOVE_HORIZONTAL( -CURRENT_OFFSET ); MOVE_VERTICAL( 1 )
; MOVE_HORIZONTAL( -1 ); ELSE POSITION( END_OF( b_part ) ); ENDIF; ERASE
( CREATE_RANGE( m_skip, MARK( NONE ), NONE ) ); ENDIF; ENDIF
; IF s_x = "V" THEN s_x := ""; IF i_append_line <> 0 THEN APPEND_LINE
; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ENDIF; i_append_line := 1; MOVE_VERTICAL
( 1 ); ENDIF; IF s_x = "X" THEN s_x := ""; IF i_append_line <
> 0 THEN APPEND_LINE; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ENDIF
; i_append_line := 0; MOVE_VERTICAL( 1 ); ENDIF; IF s_x <> "" THEN i_errors 
:= i_errors + 1; s_text := CURRENT_LINE; POSITION( b_errors ); COPY_TEXT
( "The following line could not be unpacked properly:" ); SPLIT_LINE
; COPY_TEXT( s_x ); COPY_TEXT( s_text ); POSITION( b_part ); MOVE_VERTICAL( 1 
); ENDIF; ENDLOOP; POSITION( BEGINNING_OF( b_part ) ); LOOP r_x := SEARCH( "`"
, FORWARD, EXACT ); EXITIF r_x = 0; POSITION( r_x ); ERASE_CHARACTER( 1 )
; IF CURRENT_CHARACTER = "`" THEN MOVE_HORIZONTAL( 1 ); ELSE COPY_TEXT( ASCII
( INT( ERASE_CHARACTER( 3 ) ) ) ); ENDIF; ENDLOOP; IF i_errors = 0 THEN SET
( NO_WRITE, b_errors, ON ); ELSE POSITION( BEGINNING_OF( b_errors ) )
; COPY_TEXT( FAO( "The following !UL errors were detected while unpacking !AS"
, i_errors, s_file_spec ) ); SPLIT_LINE; SET( OUTPUT_FILE, b_errors
, "SYS$COMMAND" ); ENDIF; EXIT; 
$ DELETE VMS_SHARE_DUMMY.DUMMY;*
$ CHECKSUM 'FILE_IS
$ WRITE SYS$OUTPUT " CHECKSUM ", -
  F$ELEMENT( CHECKSUM_IS .EQ. CHECKSUM$CHECKSUM, ",", "failed!,passed." )
$ RETURN
$
$START:
$ FILE_IS = "AAAREADME.TXT"
$ CHECKSUM_IS = 1212287074
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
XDocumentation for SNAP, by Dan Graham GRAHAM@DRCVAx.ARPA
X
XThis version of SNAP uses smg$ routines to enhance it's performance, and 
Xincludes a program that allows you to actually view and insert text on 
Xanother's terminal.  (This feature is not recommended for some sites, 
Xgovernment types get very paranoid if they think you can see what they are 
Xdoing.)
X
XExecute the BUILD.COM file to make everything happen correctly.  Define a 
Xforeign symbol like so:
X
X$ SNAP := $DISK:[DIRECTORY]SNAP.EXE
X
XThen to run SNAP, just enter the command, or SNAP S if you want to see all 
Xsystem processes too.
X
X
XWhat SNAP is:
X
XSNAP is a very fancy SHOW USERS.  it gives a useful screen of information 
Xabout each user process on the system.  (Optionally, it also gives the same 
Xstuff about system processes.)  You can get a bunch of statistics on the 
Xp/rocess, you can view what is going on on a terminal or write to that 
Xterminal's buffer, you can delete a process, force an image exit on a 
Xprocess, change priority, suspend or resume a porcess.
X
XWARNING:  Do not install this pogram with privs.  It is very dangerous and 
Xcould seriously compromise your system's security if used by someone with 
Xintent to do damage.  Do not make it available to any but trusted systems 
Xpeople.
X
X
XUsing SNAP:
X
XSNAP uses SMG$ screens and key capture commands to make operation easy.  
XFirst, a screen is painted with one line for each process and the commands 
Xat the bottom.  If there are more than 18 processes, they scroll off the 
Xtop.  Using the up and down arrows can scroll the window so you can see the 
Xdesired processes.
X
XIf you wish to act upon a process, that process's one line description must 
Xbe in the window.  Use either the right and left arrows or the first letter 
Xof the word describing the action you wish to take then press RETURN. 
XEntering "A" will simply update the basic infomation again.  Entering an "E"
Xwill cause an exit, as will a "Q" or a control Z.  A Control W will refresh
Xthe screen in case of broascast message foul-ups. 
X
XIf you select an action and press RETURN, you will be placed into the 
Xprocess window.  The top line will be underlined.  Use the up and down 
Xarrows to select the process to be acted upon and press RETURN again.
X
XThere is also a keypad mode, that is always active.  Use the PF2 key for 
Xhelp.  A ll options are available from the keypad, including refresh 
Xscreen.
X
XActions:
X
XAgain - This does not act upon a process, but regathers the process 
Xinformation and displays it.
X
XDelete - This will Delete the selected process.
X
XForce - This will force an image exit on the selected process, using the 
XFORCEX system service.
X
XStats - This will gather some statistics about the processes, including 
Xtheir current directory and their LAT server and port if you are using 
Xthose items.
X
XCont - This does a SHOW PROCESS/CONTINUOUS on a process.  It does this by 
Xrunning an external command file and rerunning the program, kludgy but the 
Xonly way I could find to do it.
X
XView - This executes the WATCH program which allows you to view a terminal 
Xand, optionally, force input to it.  This is the really dangerous one and 
Xshould be given out carefully.  DO NOT ATTEMPT TO view an RTA device, it 
Xwill crash the system.
X
XModify - This presents a small menu with three choices, modify a process's 
Xpriority, suspend a process or resume one.
X
XExit - This exits the program.  At almost every point in the program an E, 
XQ or CTRL/Z will cause an exit.
X
XRefresh Screen - In case of broadcasts screwing up the screen, the standard 
XCTRL/W screen refresh is implemented.
X
XNOTES:
X
XSNAP will see up to 100 processes.  If you anticipate viewing more, modify 
Xthe MAX_PROCESS parameter at the top of the program SNAP.FOR.
X
XThe usernames that are skipped in a non-system view [what normally happens] 
Xare SYSTEM, DECNET, MRMANAGER, MRTIDY and ORACLE.  The last one is because 
Xwe run that product.  If you wish to alter that list, simply modify the 
Xappropriate if statement a few linew beyone label 10 in SNAP.FOR.
X
XBoth the CONT and VIEW functions depend on the LIB$DO_COMMAND call.  In 
Xeach case, a small command file is executed to run the program that can't 
Xbe a part of the SMAP image, then SNAP is rerun.  In both of these 
Xinstances, you must edit SNAP.FOR to tell the porgram where the CONT.COM 
Xand VIEW.COM files are located.  Do a search within your editor for the 
Xstring DCLCMD.  You will find the two places.  Note that the string is 
Xdefined as a CHARACTER*49.  If your string is longer, extend that 
Xdefinition.
X
XThe CONT function just uses the SHOW PROCESS/CONTINUOUS DCL command, so 
Xthere is no consideration there except that SNAP knows where CONTINUOUS.COM 
Xis located.  However, for the VIEW function, the program WATCH.EXE must be 
Xrun.  Thus, you need to edit VIEW.COM to indicate where WATCH.EXE is, as 
Xwell as editing SNAP to tell it where VIEW.COM is.
X
XI didn't write and can't comment on either the LIB_DEFAULT_DIR or the 
XWATCH.MAR programs.
X
XSNAP should work under 5.0, but WATCH.MAR will probably not.  If you get
Xit to work, please let me know. 
X---
X
XI am happy to answer questions and entertain all suggestions for better 
Xperformance or additional features.
X
X-----------
XDan Graham
XDynamics Research Corporation, Andover, Ma
X(508) 432-1661 x2352
Xgraham@drcvax.arpa
$ GOSUB UNPACK_FILE
$ FILE_IS = "BUILD.COM"
$ CHECKSUM_IS = 1428692108
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X$! This procedure will build the SNAP product.
X$!
X$ @TERM
X$ MAC LIB_DEFAULT_DIR
X$ FOR/EXT SNAP
X$ LINK/NOTRACE SNAP,LIB_DEFAULT_DIR,SYS$SYSTEM:SYS.STB/SEL
X$ EXIT
$ GOSUB UNPACK_FILE
$ FILE_IS = "CONTINUOUS.COM"
$ CHECKSUM_IS = 2121410243
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X$! This command procedure does the SHOW PROCESS/CONTINUOUS for the SNAP 
X$! program.  SNAP must be defined as a symbol.
X$!
X$ SHOW PROC/CONT/ID='P1
X$ DEFINE/USER_MODE SYS$INPUT 'F$LOGICAL("TT")
X$ SNAP
$ GOSUB UNPACK_FILE
$ FILE_IS = "LIB_DEFAULT_DIR.MAR"
$ CHECKSUM_IS = 1985540965
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X        .title  lib_default_dir - obtain default directory of a process
X
X;++
X; FACILITY:     JCF SYSTEM PROGRAMS
X;
X; ABSTRACT:     This routine obtains the default directory of a given
X;               process specified by process ID. It uses a special kernel
X;               mode AST to get the translation of SYS$DISK and the directory
X;               string in PIO$GT_DDSTRING of the processes virtual address
X;               space.
X;
X; ENVIRONMENT:  Native, User and Kernel mode, privileged code
X;               Not reentrant -- do not call from AST level.
X;
X; AUTHOR:       Michael R. Gretzinger
X; DATE:         26-OCT-1982
X;
X;       Copyright (C) 1982  MIT Joint Computer Facility
X;
X; MODIFIED BY:  Ned Freed (MATHLIB) converted program to routine.
X;               Extensive rewrite for VMS 4.0.
X;
X;               Ned Freed (MATHLIB) converted to use LNM$SEARCH_ONE;
X;               LNM$SEARCHLOG isn't available in VMS 5.0.
X;
X; Call:
X;   ret-status.wlc.v = LIB_DEFAULT_DIR (pid.rl.r, dirstring.wt.ds)
X;--
X
X        .library "SYS$LIBRARY:LIB"
X
X        $STATEDEF
X        $PCBDEF
X        $PHDDEF
X        $ACBDEF
X        $IPLDEF
X        $PRIDEF
X        $PSLDEF
X        $LNMDEF
X        $LNMSTRDEF
X
Xlnm_size = LNM$C_NAMLENGTH + LNMX$T_XLATION
Xdd_size  = 256
X
X        .psect  $LOCAL, PIC,USR,CON,REL,LCL,NOSHR,NOEXE,RD,WRT,NOVEC,LONG
X
Xpid:     .long  0
Xdevice:  .blkb  lnm_size
Xddstring:.blkb  dd_size
X
X        .psect  $CODE, PIC,USR,CON,REL,LCL,SHR,EXE,RD,NOWRT,NOVEC,LONG
X
X        .entry  lib_default_dir,^m<r2,r3,r4,r5,r6,r7,r8>
X
X        clrb    device+lnmx$t_xlation   ;default to zero length strings
X        clrb    ddstring
X        movl    @4(ap),r0               ;prepare the pid
X        jsb     G^exe$epid_to_ipid      ;convert to internal form
X        movl    r0,pid
X        bneq    5$                      ;check for
X        pushl   #ss$_nonexpr            ;non-existent process
X        brb     10$                     ;blank strings and return
X
X5$:     $cmkrnl_s routin=get_defdir     ;get into kernel mode for the
X                                        ;real work
X        pushl   r0                      ;save return status
X
X10$:    movl    8(ap),r6                ;get address of destination descr
X        movw    (r6),r7                 ;grab length of destination string
X        cvtbw   device+lnmx$t_xlation,r8 ;grab length of device string
X        movab   @4(r6),r6               ;get address of destination string
X        movc5   r8,device+lnmx$t_xlation+1,#^A/ /,-
X                r7,(r6)                 ;install device string
X        tstl    r0                      ;see if any room left
X        bneq    20$
X        subw2   r8,r7                   ;compute the remaining length
X        bleq    20$                     ;if none left just punt
X        addw2   r8,r6                   ;compute new address
X        cvtbw   ddstring,r8             ;get length of dd string
X        movc5   r8,ddstring+1,#^A/ /,-
X                r7,(r6)                 ;install dd string
X
X20$:    movl    (sp)+,r0                ;retrieve status
X        ret
X
Xacb_l_origpid   =       acb$l_ast                 ;pid of requestor
Xacb_l_imgcnt    =       acb$l_astprm              ;image count in PHD
Xacb_l_retloc    =       acb$l_kast+4              ;address to return data
Xacb_s_retloc    =       4                         ;size of that address
X;adjacency of next two items required
Xacb_t_device    =       acb_l_retloc+acb_s_retloc ;SYS$DISK translation
Xacb_s_device    =       lnm_size                  ;maximum size of it
Xacb_t_ddstring  =       acb_t_device+acb_s_device ;default directory string
Xacb_s_ddstring  =       dd_size                   ;directory string size
Xacb_k_size      =       acb_t_ddstring+acb_s_ddstring ;total size of acb
X                                                  ;ast code follows data
X
X; Routine to return device and directory data from the other process
X
X; Note that code to execute in other process' context follows data
X; in ast control block.
X
X        .enable lsb
X
X        .entry  get_defdir,^m<r2,r3,r4,r5,r6,r7,r8,r9,r10,r11>
X
X        movl    #<acb_k_size+codelen>,r1 ;size of non-paged buffer
X        jsb     G^exe$allocbuf          ;allocate buffer for code and data
X        blbs    r0,1$                   ;skip if no error
X        ret                             ;return
X
X1$:     movl    r2,r5                   ;save address of packet
X        movl    pid,acb$l_pid(r5)       ;set target pid
X        movb    #<1@acb$v_kast>,acb$b_rmod(r5)    ;set special kernel ast
X        movab   acb_k_size(r5),acb$l_kast(r5)     ;set address for ast
X        movab   device,acb_l_retloc(r5) ;set address of return location
X        movl    G^ctl$gl_pcb,r4         ;get address of current pcb
X        movl    pcb$l_pid(r4),acb_l_origpid(r5)   ;set pid for return
X        movl    pcb$l_phd(r4),r4        ;get PHD address
-+-+-+-+-+ End of part 1 +-+-+-+-+-

------
