.MCALL .MODULE .MODULE SETCMD,VERSION=04,COMMENT=,IDENT=NO,LIB=YES ; Copyright (c) 1998 by Mentec, Inc., Nashua, NH. ; All rights reserved ; ; This software is furnished under a license for use only on a ; single computer system and may be copied only with the ; inclusion of the above copyright notice. This software, or ; any other copies thereof, may not be provided or otherwise ; made available to any other person except for use on such ; system and to one who agrees to these license terms. Title ; to and ownership of the software shall at all times remain ; in Mentec, Inc. ; ; The information in this document is subject to change without ; notice and should not be construed as a commitment by Digital ; Equipment Corporation, or Mentec, Inc. ; ; Digital and Mentec assume no responsibility for the use or ; reliability of its software on equipment which is not supplied ; by Digital or Mentec, and listed in the Software Product ; Description. .SBTTL Module Declarations .NLIST .ENABL LC .DSABL GBL .NLIST CND .LIST ; ++ ; FACILITY: ; ; RT-11 System Subroutine Library ; ; ENVIRONMENT: ; ; This routine can be used by any background job running in a ; single-job or multi-job environment. It uses "TRAP" to ; provide error processing. ; ; INCLUDE FILES: ; ; SYSMAC.SML ; RT-11 system macro library. .MCALL .ASSUME ; Check assumptions macro. ; ; EQUATED SYMBOLS: ; CH.PGM = 510 ; Length of passed command-string in chain area CH.STR = 512 ; Start of passed command-string in chain area $JSW = 44 ; Offset to Job Status Word. CHNIF$ = 4000 ; JSW's pass "cmd-string" to KMON bit-mask. ; ; EXTERNAL REFERENCES: ; .GLOBL $NXADR ; Entry point to next address routine. .GLOBL $SYSLB ; Include system library work area. .WEAK $MSARG ; Trap code for missing argument .SBTTL SETCMD - Fortran-callable Routine ; ++ ; FUNCTIONAL DESCRIPTION: ; ; The SETCMD subroutine allows a user program to pass a command-string ; to the keyboard monitor (KMON) to be executed after the program exits. ; Command-strings are passed in the chain information area (500-777) ; and stored beginning at location 512. No check is made to determine ; if the string extends into the job's stack. ; ; CALLING SEQUENCE: ; ; CALL SETCMD( string ) ; ; INPUT PARAMETERS: ; ; R5 - address of SETCMD's argument block ; ; 0(R5) - argument count of SETCMD call ; 2(R5) - address of command-string (ASCIZ format) to pass to KMON ; ; IMPLICIT OUTPUTS: ; ; JSW - Job Status Word ("Pass cmd-string" bit) ; ; Chain parameter - asciz command-string to pass to KMON to execute ; ; -- .PSECT SYS$I SETCMD:: MOV (R5)+,R4 ; R4 <- argument count CALL $NXADR ; Get -> 'string' argument BCS ERR ; If CS, error - 'string' wasn't supplied MOV #CH.STR,R3 ; R3 <- start of command-string in chain area MOV R3,R2 ; R2 <- copy of start of user's command-string 10$: MOVB (R0)+,(R2)+ ; Move character of cmd-string to chain area BNE 10$ ; Repeat until all characters have been moved SUB R3,R2 ; Determine length of cmd-string - including ; its terminating nul character too .assume EQ CH.PGM MOV R2,-(R3) ; Store command-string length in chain area BIS #CHNIF$,@#$JSW ; Indicate that a command-string is being ; passed to KMON to execute on program exit RETURN ; Return to caller ERR: TRAP $MSARG ; Handle any missing arguments in call RETURN .END