;*************************** AMUS Program Label ******************************
; Filename: WHERIZ.M68 Date: 10/10/91
; Category: UTIL Hash Code: 034-256-616-337 Version: 1.0(103)
; Initials: GR/AM Name: James A. Jarboe IV
; Company: Educational Video Network, Inc. Telephone #: 4092955767
; Related Files:
; Min. Op. Sys.: 1.3 Expertise Level: BEG
; Special:
; Description: Will find and display all the jobs and terminals a user is
; attached to by a partial or full user name argument on the command line.
;
;*****************************************************************************
;*; Updated on 10-Oct-91 at 12:25 AM by James A. Jarboe I V; edit time: 2:00:28
;***************************************************************************
;* *
;* WHERIZ.M68 *
;* *
;* Written By: James A. Jarboe IV *
;* 1401 19th Street *
;* Huntsville, TX 77340 *
;* 409-295-5767 *
;* *
;* 10-Jul-90 *
;* GR/AM *
;***************************************************************************
;
; Description:
; Locates the JOB and TERMINAL a user is associated with
; by a partial or full argument of a users name.
;
; Edit History:
;
;[103] 10-Oct-91 General cleanup and off to AMUS.
;[102] 05-Jun-91 Allow input of partial user name to find many occurances
; of different name types.
;[101] 28-Mar-91 Allowed finding more than one occurance.
;[100] 10-Jul-90 Written by James A. Jarboe IV.
;
;
LINK = 1 ; Set linker on.
;;;; LINK = 0 ; Set linker off.
ASMMSG " "
ASMMSG "+------------------------------------+"
ASMMSG "| |"
ASMMSG "| WHERIZ |"
ASMMSG "| |"
ASMMSG "| By: James A. Jarboe IV |"
ASMMSG "| |"
ASMMSG "+------------------------------------+"
; Alert if autmatic linker active.
;
IF NE, LINK
ASMMSG "| * LINKER is Active. * |"
ASMMSG "+------------------------------------+"
;
LINKER WHERIZ,JAJLIB
;
ENDC
ASMMSG " "
PAGE
;***************************************************************************
; *
; S Y M B O L I C S *
; *
;***************************************************************************
;
SEARCH SYS ; Amos Standard symbolic.
SEARCH SYSSYM ; Amos Standard symbolic.
SEARCH JAJUNV ; My Standard symbolics.
AUTOEXTERN ; Externally defined label.
PAGE
;***************************************************************************
; *
; C U R R E N T V E R S I O N *
; *
;***************************************************************************
;
VMAJOR = 1 ; Major version number.
VMINOR = 0 ; Minor version number.
VEDIT = 103. ; Edit level.
VWHO = 0 ;
PAGE
;***************************************************************************
; *
; P R O G R A M C O N S T A N T V A L U E S *
; *
;***************************************************************************
;
S..USN = 20. ; Size of user name field.
PAGE
;***************************************************************************
; *
; I M P U R E A R E A O F F S E T S *
; *
;***************************************************************************
;
OFINI ; Start of impure area.
OFDEF WH.JOB, 6 ; Unpacked job name.
OFDEF WH.FL1, 2 ; Nulls for end of job name.
OFDEF WH.TRM, 6 ; Unpacked terminal name.
OFDEF WH.FL2, 2 ; Nulls for end of terminal name.
OFDEF WH.NAM, S..USN ; Name buffer.
OFSIZ S..IMP ; Size of the impure area.
PAGE
;***************************************************************************
; *
; S T A R T O F P R O G R A M C O D E *
; *
;***************************************************************************
;
;**************
; WHERIZ *
;**************
BYP ; Skip leading white space.
LIN ; End of line?
JEQ HELPEM ; Yes, display how to use.
LEA A1, WH.NAM(A5) ; Index the name buffer.
CLR D0 ; Clear the count.
10$: LIN ; End of line?
BEQ 20$ ; Yes, all done.
MOVB (A2)+, (A1)+ ; No, save character.
INC D0 ; Bump count.
CMP D0, #S..USN ; Done?
BLO 10$ ; No, loop for more.
; Set up for repetitive calls to FINUSN.
;
20$: CLR D0 ; Preclear count of logins.
MOV JOBTBL, A0 ; Index start of job table.
; Find a JCB for the given user name.
;
30$: LEA A2, WH.NAM(A5) ; Index user name to find.
CALL FINUSN ; Find the user name.
JNE 90$ ; Search failed.
; Found a matching name.
;
TST D0 ; Is this the first?
BNE 40$ ; No.
CRLF ; Yes, start new line.
40$: ADD #1, D0 ; Bump the count of incidents.
MOV JOBTRM(A1), A3 ; Save TCB index.
PUSH A1 ; Save JCB index.
LEA A1, JOBNAM(A1) ; Index the job name.
LEA A2, WH.JOB(A5) ; Index name unpacking buffer.
UNPACK ; Convert name to ASCII.
UNPACK ;
LEA A1, -4(A3) ; Index the TCB TRMDEF name.
LEA A2, WH.TRM(A5) ; Index the unpacking buffer.
UNPACK ; Convert to ASCII.
UNPACK ;
POP A1 ; Restore JCB index.
; Display user name.
;
HTYPE < _> ; Leading spaces.
CALL PRTUSN ; Display the user name found.
HTYPE < is on job _> ; Job leadin text.
TTYL WH.JOB(A5) ; Output job name.
HTYPE < using terminal _> ; Terminal leadin text.
TTYL WH.TRM(A5) ; Output terminal name.
CRLF ; Bump a line.
JMP 30$ ; Try for another.
; All done.
;
90$: MOV D0, D1 ; Any occurances?
BNE 95$ ; Yes..tell how many.
HTYPE <_No> ; No..tell em so.
BR 99$ ;
95$: CRLF ; Start a new line.
HTYPE <Total of _> ; Leadin text.
DCVT 0, OT$TRM ; Display count.
99$: HTYPE < job> ; More text.
100$: CMP D0, #1 ; Just one?
BEQ 101$ ; Yes.
TYPE <s> ; No, make "job" become "jobs".
TST D0 ; Any occurances?
BNE 101$ ; Yes..bypass negative message.
HTYPE < associated with _>
TTYL WH.NAM(A5) ; Output name we looked for.
HTYPE < were>
101$: HTYPCR < located.> ; More text.
CRLF ; New line.
PAGE
;***********
; HELPEM *
;***********
; Display's some helpful user information for the uninformed.
;
; Passed:
;
; Nothing
;
; Returns:
;
; No explicit values or flags returned.
; Exits to AMOS
;
HELPEM:
; Get the program name.
;
JOBIDX A6 ; Index the JCB.
LEA A1, JOBPRG(A6) ; Index the program name.
LEA A2, WH.JOB(A5) ; Index someplace to unpack it.
UNPACK ; Convert to ASCII.
UNPACK ;
; Strip trailing spaces from program name.
;
10$: CMPB -(A2), #$SPACE ; Is there a trailing space?
BNE 20$ ; No.
CLRB @A2 ; Yes, strip it.
BR 10$ ; Check for another.
; Tellem how to use it.
;
20$: HTYPCR <_>
TTYL WH.JOB(A5) ; Display the program name.
HTYPCR <_ - Locates users by user name.>
CRLF ; Bump line.
HTYPCR <Usage:>
HTYPCR < _> ;
TTYL WH.JOB(A5) ; Output program name.
HTYPCR <_ user-name_ {full or partial user-name is allowed}>
CRLF ; Bump line.
HTYPCR <Example:>
CRLF ; Bump line.
HTYPE < _> ;
TTYL WH.JOB(A5) ; Output program name.
HTYPCR <_ FRANK>
CRLF ; Bump line.
HTYPCR < May yield:>
CRLF ; Bump line.
HTYPCR < _Frank A. User_ is on job _JOB4 _using terminal_ TERM4>
HTYPCR < _Al Franken_ is on job _JOB20 _using terminal_ TERM20>
HTYPCR < _Frank A. User_ is on job _%TSKAC _using terminal_ %TSKAC>
CRLF ; Bump line.
HTYPCR <Total of _3_ jobs located.>
CRLF ; Bump lines
CRLF ; to display
CRLF ; just our help
CRLF ; and not any other
CRLF ; junk on the terminal.
JMP ALLDUN ; OK. All done.
PAGE
;***********
; PRTUSN *
;***********
; Print user name in the JCB @A1. Insure name displayed in 20 col field.
;
; Passed:
;
; A1 => JCB for which user name is to be displayed.
;
; Returns:
;
; No explicit values or flags returned.
;
PRTUSN: SAVE D0, D1, A1 ; Save registers.
LEA A1, JOBUSN(A1) ; Index the name.
MOV #<S..USN-1>, D0 ; Size of name (DBF adjusted).
; Display the name, one character at a time.
;
10$: MOVB (A1)+, D1 ; Get a byte of the name.
BNE 20$ ; Not a null, print it.
MOVB #$SPACE, D1 ; Was a null, make it a SPACE.
TSTB -(A1) ; Backup to the null again.
20$: TTY ; Output to terminal.
DBF D0, 10$ ; Repeat until done.
PAGE
;*************
; FINUSN *
;*************
; Find user names containing passed string.
;
; Passed:
;
; A0 => Starting point in JOBTBL from which to search.
; A2 => Target string to search for.
;
; Returned:
;
; A0 Updated to next entry to search (for multiple calls).
; A1 => JCB of found job.
; Z bit := Set if found.
; Reset if search failed.
;
FINUSN:
SAVE A3, D4, D5 ; Save registers.
; Find next valid entry in the job table.
;
10$: MOV (A0)+, D7 ; Get next JCB index.
BEQ 10$ ; This one empty, go for next.
CMP D7, #-1 ; End of table?
BNE 20$ ; No, perform comparision.
LCC #0 ; Yes, search failed.
BR 99$ ; All done.
; Look for target string in the user name field of the JCB.
;
20$: MOV D7, A3 ; Index the JCB.
LEA A1, JOBUSN(A3) ; Index the name.
MOV #S..USN, D4 ; Set string compare size.
MOV #0, D5 ; No special flags.
CALL FNDTXT ; Compare the user names.
BNE 10$ ; No match, try again.
; Target was found.
;
30$: MOV A3, A1 ; Return JCB index in A1.
; Addr reg. move has no CC effect.
; All done. Condition codes are set for return.
;
99$: REST A3, D4, D5 ; Restore caller's registers.
RTN ; Return to caller.