.TITLE HSCCMD .IDENT /V1.0-2/ ; ;**************************************************************************** ;* * ;* COPYRIGHT (c) 1991 BY * ;* DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASSACHUSETTS. * ;* ALL RIGHTS RESERVED. * ;* * ;* THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED * ;* ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND 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. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY * ;* TRANSFERRED. * ;* * ;* THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE * ;* AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT * ;* CORPORATION. * ;* * ;* DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS * ;* SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL. * ;* * ;* * ;**************************************************************************** ; ; HSCCMD ; ; ; OVERVIEW: ; ; This program will issue one command to an HSC via a DUP connection. The ; command to be sent is read via the DCL foreign command line interface. This ; allows "one-liners" to be issued from command procedures (and batch jobs). ; ; To use it, assign a symbol to point to the image that starts with a $ ; (foreign command interface) i.e. "HSCCMD :== $HSCCMD". ; ; Issue the command "HSCCMD hsc command_string" where "hsc" is name of the HSC ; to send the command to, and command_string (the rest of the line) is the ; command to send. e.g. ; $HSCCMD HSC014 SET SERVER DISK /NOCACHE ; will turn cache off on HSC014. ; ; PROGRAM NOTES: ; ; The following DCL command procedure will compile, link, and assign an ; appropriate symbol. ; ; $ if f$search("hsccmd.mar") .nes. "" then - ; macro/list/cross'P1' hsccmd ; $ if f$search("hsccmd.obj") .nes. "" then - ; link/map/cross'P1' hsccmd ; $ purge/log ; $ hsccmd :== $'f$logical("sys$disk")''f$directory()'hsccmd ; $ exit ; $ ; ; RESTRICTIONS: ; ; The FY driver must be loaded and the current process must have DIAG ; privilege in order for this program to work. ; ; ; MACRO LIBRARY CALLS ; .LIBRARY /SYS$LIBRARY:LIB/ $SSDEF $ASSIGNDEF $QIODEF $IODEF $EXITDEF $STSDEF ; STS FIELD DEFS $TTYSYMDEF ; CTRL_S,Q, DEFS ETC. .IIF NDF IO$_EXECUTE, IO$_EXECUTE = 56 .PSECT RDDATA,NOWRT,NOEXE,QUAD DUPDEV: .ASCID "_FYA0:" PRGDSC: .ASCII "PSEUDO" .BLKB 36 -<.-PRGDSC> SERVER: .ASCID "MSCP$DUP" CTRL_C: .BYTE TTY$C_CTRLC .PSECT RWDATA,WRT,NOEXE,QUAD CHAN: .WORD 0 IOSB: .QUAD 0 IPBUF: .BLKB 512 CMD_DESC: .WORD 80 ; Fixed length string descriptor .BYTE DSC$K_DTYPE_T .BYTE DSC$K_CLASS_S .ADDRESS CMD_LINE CMD_LINE: .BLKB 80 ; Device to change the path on CMD_LEN: .LONG 0 ; Returned actual length CMD_ADDR: .LONG 0 ; Address of the rest of the command DEV_DESC: .WORD 80 ; Fixed length string descriptor .BYTE DSC$K_DTYPE_T .BYTE DSC$K_CLASS_S .ADDRESS CMD_LINE .PAGE .PSECT CODE,NOWRT,EXE,LONG .ENTRY HSCCMD,^M<> PUSHAL CMD_LEN ; Address to return length PUSHL #0 ; No prompt string PUSHAL CMD_DESC ; Address of string descriptor CALLS #3,G^LIB$GET_FOREIGN ; Get device name from command line BLBS R0,1$ ; Success BRW EXIT 1$: MOVW CMD_LEN,CMD_DESC ; Store returned length in descriptors MOVW CMD_LEN,DEV_DESC LOCC #^x20,CMD_LEN,CMD_LINE BNEQ 2$ BRW EXIT ; Can't find a space! 2$: SUBW R0,DEV_DESC ; Store length of HSC name MOVW R0,CMD_LEN INCL R1 ; Remove space from command MOVL R1,CMD_ADDR ADDL R0,R1 MOVB #TTY$C_CR,-(R1) ; Add a to the end $ASSIGN_S - ; Assign a channel to the FY driver CHAN = CHAN,- DEVNAM = DUPDEV JSB ERROR ; Check for errors $QIOW_S CHAN = CHAN,- ; Tell FY which HSC to use FUNC = #IO$_ACCESS,- IOSB = IOSB,- P1 = SERVER,- P3 = #DEV_DESC JSB IOERR ; Check for errors (both R0 and IOSB) $QIO_S CHAN = CHAN,- ; Request program load FUNC = #IO$_EXECUTE,- P1 = PRGDSC,- ; Program descriptor P2 = #36,- ; PRGDSC blk size P3 = #3,- ; EFN for load completion P4 = #IOSB ; IOSB for load completion JSB ERROR $SYNCH_S - ; Wait for load completion EFN = #3,- IOSB = IOSB JSB IOERR $QIOW_S CHAN = CHAN,- ; Send a ^C to the HSC FUNC = #IO$_WRITEVBLK,- IOSB = IOSB,- P1 = CTRL_C,- P2 = #1 JSB IOERR $QIOW_S CHAN = CHAN,- ; Read the response FUNC = #IO$_READLBLK,- IOSB = IOSB,- P1 = IPBUF,- P2 = #512 JSB IOERR $QIOW_S CHAN = CHAN,- ; Send the command FUNC = #IO$_WRITEVBLK,- IOSB = IOSB,- P1 = @CMD_ADDR,- P2 = CMD_LEN JSB IOERR $QIOW_S CHAN = CHAN,- ; Read the response FUNC = #IO$_READLBLK,- IOSB = IOSB,- P1 = IPBUF,- P2 = #512 JSB IOERR $DASSGN_S - ; Deassign the channel CHAN = CHAN JSB ERROR EXIT: $EXIT_S R0 ERROR: BLBC R0,EXIT ; Branch if an error occured RSB ; Success, return IOERR: BLBC R0,EXIT ; Branch if an error occured MOVZWL IOSB,R0 ; Check the IOSB BLBC R0,EXIT ; Branch on error RSB ; Success, return .END HSCCMD