;*************************** AMUS Program Label ****************************** ; Filename: USRNAM.M68 Date: 05/17/89 ; Category: UTIL Hash Code: 473-741-140-010 Version: 1.1(2) ; Initials: Name: IRV BROMBERG ; Company: MEDIC/OS CONSULTANTS Telephone #: ; Related Files: ; Min. Op. Sys.: AMOSL 1.3(123) Expertise Level: BEG ; Special: ; Description: Displays, clears, or sets job user name. ; ; ;***************************************************************************** objnam USRNAM.LIT ; Created 10-Jul-87, Last modified 11-July-87 ; by Irv Bromberg, Medic/OS Consultants, Toronto, CANADA ; requires AMOS/L 1.3(123) or later radix 10 vedit=2 vminor=1 vmajor=1 vsub=0 if eq,1 Syntax: USRNAM {{=}user name} Sets or displays current job user name. Examples: USRNAM = JOHN SMITH ; sets user name = "JOHN SMITH" USRNAM JOHN SMITH ; same effect USRNAM = ; clears user name USRNAM ; displays current user name USRNAM A234567890123456789012345 ; sets user name = A234567890123456789 Truncates specified name to maximum of 19 bytes. The first character of the name must be an alpha letter A-Z otherwise an error message is displayed (?Invalid user name, must start with a letter A-Z). Comments and trailing whitespace are not included in the name that is set. Normally AMOS/L folds input command lines to uppercase so the name set will thus appear in uppercase. endc search SYS search SYSSYM JCB=A0 Buffer=A2 Name=A3 Count=D3 Dtemp=D6 SPACE=32 phdr -1,0,PH$REE!PH$REU ; re-entrant & re-usable jobidx JCB ; get user's Job Control Block lea Name,JOBUSN(JCB) ; point at his name field trm ; no parameters -> show name beq ShwName cmpb @Buffer,#'= ; are we setting the name? bne ChkALF ; yes but without "=" br SetName ; yes, with "=" (could be NULL name) ShwName:ttyl @Name ; show current name crlf exit SetName:incw Buffer ; skip "=" byp ; (could be whitespace after "=" trm ; clear name? beq Done ; yes, just terminate right there ChkALF: alf ; 1st char must be alphabetic beq SetCnt typecr exit SetCnt: mov #JOBRTP-JOBUSN-2,Count ; set truncation limit ; -1 for DBF, -1 to allow for NULL Loop: movb (Buffer)+,(Name)+ lin ; terminate on any line terminator dbeq Count,Loop ; or when count limit consumed Strip: cmpb -(Name),#SPACE ; strip trailing whitespace blos Strip incw Name ; undo last pre-decrement Done: clrb @Name ; terminate with NULL exit end .