From:	CSBVAX::MRGATE!RELAY-INFO-VAX@CRVAX.SRI.COM@SMTP 15-AUG-1988 07:15
To:	ARISIA::EVERHART
Subj:	SUM (Show Users More) Part 2 of 4


Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Fri, 12 AUG 88 21:53:54 PDT
Received: from hac2arpa.hac.com by KL.SRI.COM with TCP; Fri, 12 Aug 88 21:53:16 PDT
Received: from draco.HAC.COM by hac2arpa.hac.com (3.2/SMI-DDN)
	id AA13269; Fri, 12 Aug 88 21:58:33 PDT
Received: by draco id <24C20638023@draco.HAC.COM> ;
       Fri, 12 Aug 88 21:54:11 PDT
Date: Fri, 12 Aug 88 21:54:09 PDT
From: Michael N. Kimura <MNK@draco.hac.com>
Subject: SUM (Show Users More) Part 2 of 4
To: info-vax%kl.sri.com@hac2arpa.hac.com
X-Vms-Mail-To: EXOS%"<info-vax%kl.sri.com@hac2arpa.hac.com>",MNK
Message-Id: <880812215409.24C20638023@draco.HAC.COM>

+-+-+-+ Beginning of part 2 +-+-+-+
X
X!---------------------------------------------------------------------------
X!* Load the GETDVI Item List
X
X`009!-------------------------------------------------------------------
X`009!* Physical Device Name
X
X`009GetDvi_ItmLst(1).BufLen = len(TT_PhyDevNam)
X`009GetDvi_ItmLst(1).ItmCod = DVI$_TT_PHYDEVNAM
X`009GetDvi_ItmLst(1).BufAdr = %loc(TT_PhyDevNam)
X`009GetDvi_ItmLst(1).RetLen = %loc(TT_PhyDevNam_Len)
X
X`009!-------------------------------------------------------------------
X`009!* Name of local port on remote system
X
X`009GetDvi_ItmLst(2).BufLen = len(TT_AccPorNam)
X`009GetDvi_ItmLst(2).ItmCod = DVI$_TT_ACCPORNAM
X`009GetDvi_ItmLst(2).BufAdr = %loc(TT_AccPorNam)
X`009GetDvi_ItmLst(2).RetLen = %loc(TT_AccPorNam_Len)
X
X`009return
X`009end
$ GOSUB UNPACK_FILE
$ FILE_IS = "MAKEFILE.V4"
$ CHECKSUM_IS = 941783953
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
XCLDFlags= /List
XFFlags`009= /List
X
XObjects`009= Sum.Obj, Parse_Cmd_Line.Obj, Load_ItmLst.Obj, Get_IJobCnt.Obj,-
X`009`009Sort.Obj, SumTable.Obj, ShwMsgPtr.Obj
X
XSources`009= Sum_V4.For, ItmLst.For, Parse_Cmd_Line.For, Load_ItmLst_V4.For,-
X`009`009Get_IJobCnt.For, Sort.For, SumTable.Cld, ShwMsg.Msg
X
XLists`009= Sum_V4.Lis, Parse_Cmd_Line.Lis, Load_ItmLst_V4.Lis,-
X`009`009Get_IJobCnt.Lis, Sort.Lis, SumTable.Lis, ShwMsg.Lis
X
XSum.Exe : $(Objects), Sys$System:Sys.Stb
X`009Link/NoTraceBack $(Objects),Sys$System:Sys.Stb/Selective_Search
X`009@ Copy Nla0: ShowNew.
X
XSum.Obj : Sum_V4.For, ItmLst.For
X`009$(FORTRAN) Sum_V4/Object=Sum.Obj
X
XLoad_ItmLst.Obj : Load_ItmLst_V4.For, ItmLst.For
X`009$(FORTRAN) Load_ItmLst_V4/Object=Load_ItmLst.Obj
X
XSort.Obj : Sort.For, Sort_Inc.For
X
XShwMsgPtr.Obj : ShwMsg.Msg, Sys$Message:CliUtlMsg.Exe
X`009Message/Object=ShwMsgPtr/File_Name=CliUtlMsg/List ShwMsg
X
X! Cleanup
XCleanup :
X`009Delete/Log *.Obj;*
X
X! Directory of the source files
XDir :
X`009Dir $(Sources)
X
X! Print the source files
XPrint :
X`009Print/Notify/NoFeed $(Sources)
X
X! Print the list files
XPrintLists :
X`009Print/Notify/NoFeed $(Lists)
X
X! Show New files
XShowNew. : $(Sources)
X`009write sys$output "$(MMS$Changed_List)"
$ GOSUB UNPACK_FILE
$ FILE_IS = "MAKEFILE.V5"
$ CHECKSUM_IS = 941783953
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
XCLDFlags= /List
XFFlags`009= /List
X
XObjects`009= Sum.Obj, Parse_Cmd_Line.Obj, Load_ItmLst.Obj, Get_IJobCnt.Obj,-
X`009`009Sort.Obj, SumTable.Obj, ShwMsgPtr.Obj
X
XSources`009= Sum_V5.For, ItmLst.For, Parse_Cmd_Line.For, Load_ItmLst_V5.For,-
X`009`009Get_IJobCnt.For, Sort.For, SumTable.Cld, ShwMsg.Msg
X
XLists`009= Sum_V5.Lis, Parse_Cmd_Line.Lis, Load_ItmLst_V5.Lis,-
X`009`009Get_IJobCnt.Lis, Sort.Lis, SumTable.Lis, ShwMsg.Lis
X
XSum.Exe : $(Objects), Sys$System:Sys.Stb
X`009Link/NoTraceBack $(Objects),Sys$System:Sys.Stb/Selective_Search
X`009@ Copy Nla0: ShowNew.
X
XSum.Obj : Sum_V5.For, ItmLst.For
X`009$(FORTRAN) Sum_V5/Object=Sum.Obj
X
XLoad_ItmLst.Obj : Load_ItmLst_V5.For, ItmLst.For
X`009$(FORTRAN) Load_ItmLst_V5/Object=Load_ItmLst.Obj
X
XSort.Obj : Sort.For, Sort_Inc.For
X
XShwMsgPtr.Obj : ShwMsg.Msg, Sys$Message:CliUtlMsg.Exe
X`009Message/Object=ShwMsgPtr/File_Name=CliUtlMsg/List ShwMsg
X
X! Cleanup
XCleanup :
X`009Delete/Log *.Obj;*
X
X! Directory of the source files
XDir :
X`009Dir $(Sources)
X
X! Print the source files
XPrint :
X`009Print/Notify/NoFeed $(Sources)
X
X! Print the list files
XPrintLists :
X`009Print/Notify/NoFeed $(Lists)
X
X! Show New files
XShowNew. : $(Sources)
X`009write sys$output "$(MMS$Changed_List)"
$ GOSUB UNPACK_FILE
$ FILE_IS = "MAKE_SUM.COM"
$ CHECKSUM_IS = 506530664
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X$`009verify = f$verify(1)
X$!"===========================================================================
X$!" MAKE_SUM.COM - Command file to compile/link SUM (for those lacking MMS)
X$!"===========================================================================
X$!
X$`009on error then goto end
X$!
X$!" Get VAX/VMS Version number
X$`009version = f$extract(0,2,f$getsyi("version"))
X$`009if version .gts. "V5" then version = "V5"
X$!
X$`009if f$search("SYS$SYSTEM:MMS.EXE") .nes. "" then goto MMS
X$!
X$!"---------------------------------------------------------------------------
X$!" Build SUM
X$!
X$!" Compile the FORTRAN source files
X$`009FORTRAN Sum_'version', Parse_Cmd_Line, Load_ItmLst_'version', -
X`009`009Get_IJobCnt, Sort
X$!
X$!" Compile the CLD (Command Language Definition)
X$`009Set Command/Object SumTable
X$!
X$!" Compile the message pointer file (gives access to SHOW$_NOSUCHUSER)
X$`009Message/Object=ShwMsgPtr/File_Name=CliUtlMsg ShwMsg
X$!
X$!" Link (NoTraceBack because CLI routines cause traceback dumps)
X$`009Link/NoTraceBack/Executable=SUM -
X`009`009Sum_'version', Parse_Cmd_Line, Load_ItmLst_'version', -
X`009`009Get_IJobCnt, Sort, SumTable, ShwMsgPtr, -
X`009`009Sys$System:Sys.Stb/Selective_Search
X$!
X$`009goto end
X$!
X$!"---------------------------------------------------------------------------
X$!" Build SUM using MMS
X$!
X$MMS:
X$`009MMS/Description=MakeFile.'version'
X$!
X$`009goto end
X$!
X$!"---------------------------------------------------------------------------
X$!" Restore verification and exit
X$!
X$end:`009exit ($status .or. %x10000000)+0*'f$verify(verify)'
$ GOSUB UNPACK_FILE
$ FILE_IS = "PARSE_CMD_LINE.FOR"
$ CHECKSUM_IS = 1078413258
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X!*===========================================================================
X!* Parse_Cmd_Line -- Parse the command line using SUMTABLE
X!*`009P1`009`009: Username (optional)
X!*`009/OUTPUT=file`009: Output File name (default SYS$OUTPUT)
X!*`009/[NO]FULL`009: Full Display (default /NOFULL)
X!*===========================================================================
X
X`009options/extend_source`009`009!* Allow lines longer than 72 chars
X
X`009subroutine Parse_Cmd_Line(
X`0091`009P1_Username,
X`0091`009P1_Username_Len,
X`0091`009Output_Filename,
X`0091`009Output_Filename_len,
X`0091`009Full_Display)
X
X`009implicit none`009`009`009!* Declare Everything!
X
X`009parameter
X`0091`009NLA0 = '_NLA0:'`009`009!* Null Device
X
X`009integer*2
X`0091`009P1_Username_Len,`009!* Username (Parameter P1) length
X`0091`009Output_Filename_len`009!* /OUTPUT=filename length
X
X`009character*(*)
X`0091`009P1_Username,`009`009!* Username (Parameter P1) length
X`0091`009Output_Filename`009`009!* /OUTPUT=filename length
X
X`009logical*1
X`0091`009Full_Display`009`009!* /FULL specified?
X
X`009integer*4
X`0091`009Succ,`009`009`009!* VMS Success Codes
X`0091`009CLI$DCL_PARSE,`009`009!* Parse DCL Command
X`0091`009CLI$PRESENT,`009`009!* Check presence of qualfier
X`0091`009CLI$GET_VALUE,`009`009!* Get a value from command line
X`0091`009LIB$GET_FOREIGN`009`009!* Get the command line
X
X`009integer*2
X`0091`009Cmd_Line_Len`009`009!* Command line length
X
X`009character
X`0091`009Cmd_Line*1024`009`009!* Command line buffer
X
X`009external
X`0091`009Sum_Table,`009`009!* Our DCL Table
X`0091`009CLI$_PRESENT`009`009!* Qualifier was present
X
X!---------------------------------------------------------------------------
X!* Call LIB$GET_FOREIGN to get the command line
X
X`009Succ = LIB$GET_FOREIGN(Cmd_Line,,Cmd_Line_Len)
X`009if (.not. Succ) call exit(Succ)
X
X!---------------------------------------------------------------------------
X!* Call CLI$DCL_PARSE to parse the command line
X
X`009Succ = CLI$DCL_PARSE('SUM '//Cmd_Line(1:Cmd_Line_Len),
X`0091`009Sum_Table)
X`009if (.not. Succ) call exit(Succ .or. '10000000'x)
X
X!---------------------------------------------------------------------------
X!* Get Username (P1) if specified (default all usernames)
X
X`009Succ = CLI$GET_VALUE('USERNAME',P1_Username,P1_Username_Len)
X
X!---------------------------------------------------------------------------
X!* Get /OUTPUT=filename if specified (default /OUTPUT=SYS$OUTPUT)
X
X`009Succ = CLI$GET_VALUE('OUTPUT',Output_Filename,Output_Filename_len)
X`009if (.not. Succ) then
X`009    Output_Filename = NLA0
X`009    Output_Filename_len = len(NLA0)
X`009endif
X
X!---------------------------------------------------------------------------
X!* Determine if /FULL was specified (default /NOFULL)
X
X`009Full_Display = (CLI$PRESENT('FULL') .eq. %loc(CLI$_PRESENT))
X
X`009return
X`009end
$ GOSUB UNPACK_FILE
$ FILE_IS = "SHWMSG.MSG"
$ CHECKSUM_IS = 57945847
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X! ShwMsg.Msg -- Defines SHOW$_NOSUCHUSER symbol ('0078802B'x)
X!`009Create a pointer file via:
X!
X!`009$ MESSAGE/OBJECT=ShwMsgPtr/FILE_NAME=CLIUTLMSG ShwMsg
X
X.facility`009show,120/sys`009! Facility is %SHOW
X.severity`009informational`009! Severity is -I-
X.base`009`0095`009`009! Error Message 5
Xnosuchuser`009<>`009`009! Get text from SYS$MESSAGE:CLIUTLMSG.EXE
X.end
$ GOSUB UNPACK_FILE
$ FILE_IS = "SORT.FOR"
$ CHECKSUM_IS = 206790027
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X!*===========================================================================
X!* Insert_Sort -- Insert a record into a sorted linked list
X!*===========================================================================
X
X`009options/extend_source`009`009!* Allow lines longer than 72 chars
X
X`009subroutine Insert_Sort(Rec)
X
X`009implicit none`009`009`009!* Declare Everything!
X
X`009include 'Sort_Inc'`009`009!* Sorted List Data Structures
X
X`009character*(*)
X`0091`009Rec`009`009`009!* Record to insert
X
X`009integer*2
X`0091`009This,`009`009`009!* Pointer to current node
X`0091`009Last`009`009`009!* Pointer to last node
X
X`009logical*1
X`0091`009Done`009`009`009!* Insertion completion flag
X
X!*---------------------------------------------------------------------------
X!* Record this record's information
X
X`009NRec = NRec + 1`009`009`009!* Allocate space for record
X`009List(NRec).Record = Rec`009`009!* Insert the record
X`009List(NRec).Length = len(Rec)`009!* Insert the length of the record
X
X!*---------------------------------------------------------------------------
X!* Insert this record into the sorted list
X
X`009if (Root .eq. NULL) then
X
X`009    !*---------------------------------------------------------------
X`009    !* No root node so make this node the root
X
X`009    Root = NRec`009`009`009!* Update root pointer
X`009    List(Root).Next = NULL`009!* Point root to NULL
X
X`009else
X
X`009    !*---------------------------------------------------------------
X`009    !* Initialize for searching list
X
X`009    Last = NULL`009`009!* Last pointer starts at NULL
X`009    This = Root`009`009!* This pointer starts at root
X`009    Done = .FALSE.`009!* Set Done to FALSE
X
X`009    do while (.not. Done)`009!* Repeat until done
X
X`009`009if (This .eq. NULL) then
X
X`009`009    !*-------------------------------------------------------
X`009`009    !* Ran out of nodes, append to end
X
X`009`009    List(Last).Next = NRec`009!* Last node points to new
X`009`009    List(NRec).Next = NULL`009!* Point new node to NULL
X`009`009    Done = .TRUE.`009`009!* We're done!
X
X`009`009elseif (Rec(1:12) .ge. List(This).Record(1:12)) then
X
X`009`009    !*-------------------------------------------------------
X`009`009    !* New node goes further down in list, adjust pointers
X
X`009`009    Last = This`009`009`009!* Last points to this
X`009`009    This = List(This).Next`009!* This points to next
X
X`009`009else
X
X`009`009    !*-------------------------------------------------------
X`009`009    !* New node goes here, insert it
X
X`009`009    List(NRec).Next = This`009!* New node points to this
X
X`009`009    if (This .eq. Root) then
X
X`009`009`009!*---------------------------------------------------
X`009`009`009!* This is the front so point root to new node
X
X`009`009`009Root = NRec
X
X`009`009    else
X
X`009`009`009!*---------------------------------------------------
X`009`009`009!* Point previous node to new node
X
X`009`009`009List(Last).Next = NRec
X
X`009`009    endif
X
X`009`009    Done = .TRUE.`009!* We're done!
X
X`009`009endif
X`009    enddo
X`009endif
X
X`009return
X`009end
X`012
X!*===========================================================================
X!* Get_Record -- Function to return the next record from the sorted list
X!*===========================================================================
X
X`009options/extend_source`009`009!* Allow lines longer than 72 chars
X
X`009logical*1 function Get_Record(Rec,Rec_Len)
X
X`009implicit none`009`009`009!* Declare Everything!
X
X`009include 'Sort_Inc'`009`009!* Sorted List Data Structures
X
X`009character*(*)
X`0091`009Rec`009`009`009!* Record buffer
X
X`009integer*2
X`0091`009Rec_Len`009`009`009!* Length of record
X
X!*---------------------------------------------------------------------------
X!* Return next record from sorted list if one exists
X
X`009if (Root .eq. NULL) then
X
X`009    !*---------------------------------------------------------------
X`009    !* Return FALSE, the sorted list is now empty
X
X`009    Get_Record = .FALSE.
X
X`009else
X
X`009    !*---------------------------------------------------------------
X`009    !* Return the root node and move root to next node
X
X`009    Rec`009    = List(Root).Record`009`009!* Record to return
X`009    Rec_Len = List(Root).Length`009`009!* Length of record to return
X`009    Root    = List(Root).Next`009`009!* Move root to next node
X`009    Get_Record = .TRUE.`009`009`009!* Return success
X
X`009endif
X
X`009return
X`009end
$ GOSUB UNPACK_FILE
$ FILE_IS = "SORT_INC.FOR"
$ CHECKSUM_IS = 1631537690
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X!*---------------------------------------------------------------------------
X!* Data structures for Sorted List
X
X`009parameter
X`0091`009MAX_REC_LEN = 90,`009`009!* Length of the longest Record
X`0091`009NULL = 0,`009`009`009!* NULL pointer
X`0091`009LIST_SIZE = 1024`009`009!* IJOBLIM maximum is 1024
X
X`009structure`009/Sorted_List/`009`009!* Sorted List structure
X`009`009character*(MAX_REC_LEN)`009Record`009!* Record
X`009`009integer*2`009`009Length`009!* Length of record
X`009`009integer*2`009`009Next`009!* Pointer to next record
X`009end structure
X
X`009Record`009`009/Sorted_List/
X`0091`009List(LIST_SIZE)`009`009`009!* Sorted List
X
X`009integer*2
X`0091`009NRec`009/0/,`009`009`009!* Number of records in list
X`0091`009Root`009/NULL/`009`009`009!* Root pointer
X
X`009common`009/List_Block/`009`009`009!* Sorted List Common Block
X`0091`009List, NRec, Root
$ GOSUB UNPACK_FILE
$ FILE_IS = "SUM.COM"
$ CHECKSUM_IS = 1594041402
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X$`009verify = 'f$verify(0)'
X$`009if "''dcl_debug'" then set verify
X$!
X$!"===========================================================================
X$!" SUM.COM - Execute SUM with WORLD privilege
X$!"
X$!" Parameter:
X$!"`009p1:`009"SUM" + qualifiers and/or paramaters
X$!"
X$!" Usage:
X$!"`009SUM = "$directory:SUM SUM"
X$!"
X$!"`009SUM/FULL`009SUM/OUTPUT=SUM.LIS`009SUM <username>
X$!"
X$!"===========================================================================
X$!" Initializations
X$!
X$`009sum_dir = "SYS$SYSTEM:"`009`009!"***** Enter your directory *****
X$!
X$`009sum = "$''sum_dir'sum"
X$!
X$`009version = f$extract(0,2,f$getsyi("version"))
X$`009priv_need = "WORLD"
X$`009if version .eqs. "V4" then priv_need = "SHARE,SYSPRV,WORLD"
X$!
X$`009priv_list = f$setprv(priv_need)
X$!
X$`009on control_y then goto l_exit
X$`009on error then goto l_exit
X$!
X$!"===========================================================================
X$!" get qualifiers and/or parameter
X$!
X$`009p1 = p1 - "SUM"
X$!
-+-+-+-+-+ End of part 2 +-+-+-+-+-

