
	.TITLE	SHOW "DCL SHOW extensions"
	.IDENT /v1.0/

;+
; Facility:
;	SHOW.MAR - Display system information
;
; Abstract:
;
; Author:
;	Bruce R. Miller, MILLER@TGV.COM
;	TGV, Inc.
;	603 Mission St.
;	Santa Cruz, CA 95060
;	(408) 427-4366
;
; Date:
;	23-JUL-1991
;
; Functional Description:
;
; Copyright (c) 1991 Bruce R. Miller
; All rights reserved.
;
;	Redistribution and use in source and binary forms are permitted
;	provided that the above copyright notice and this paragraph are
;	duplicated in all such forms and that any documentation,
;	advertising materials, and other materials related to such
;	distribution and use acknowledge that the software was developed
;	by Bruce R. Miller.
;	THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR
;	IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
;	WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
;
; Modifications:
;
;-

	.link		'sys$system:sys.stb'/SELECTIVE_SEARCH
	.library	'sys$Library:lib.mlb'
        .link		'sys$system:dcldef.stb'/SELECTIVE_SEARCH

;	$PSLDEF

.EXTERNAL	CALL_REMOTE_G



.ENTRY SET_PROMPT_AST,^M<R2,R3,R4,R5>
	RET



.ENTRY SET_PROMPT,^M<R2,R3,R4,R5>
	MOVAB	G^CTL$AG_CLIDATA, R3		; CLI data
	MOVL	PPD$Q_CLIREG+4(R3), R3		; Get address of proc work area
	MOVZBL	8(AP),R0			; Get new prompt length
	ADDB3	#3,R0,PRC_B_PROMPTLEN(R3)	; Store new prompt length
	MOVC5	R0,@4(AP),#32,#32,PRC_G_PROMPT(R3) ; Store new prompt
	MOVL	#^A/abcd/,@4(AP)		; Leave our mark
	MOVL	#SS$_NORMAL,R0			; Return sucess
	RET
set_prompt_len = . - SET_PROMPT



BUF_B_LENGTH	= 0
BUF_A_DATA	= 1

.ENTRY SHOW_DEFAULT_CODE,^M<R2,R3,R4,R5>
	MOVL	#PIO$GT_DDSTRING,R0		; Find Default Directory
	MOVZBL	(R0)+,R1			; get length
	MOVL	4(AP),R2			; Get buffer address
	MOVL	8(AP),R3			; Get buffer length
	CLRB	BUF_B_LENGTH(R2)		; clear length
	DECL	R3				; get data length
	BLEQ	100$				; No buffer
	CMPL	R3,R1				; data buffer too smaller?
	BGEQ	10$				; br if big enough
	MOVL	R3,R1				; use what we have
10$:	PUSHR	#^m<r1,r2,r3,r4,r5>
	MOVC3	R1,(R0),BUF_A_DATA(R2)		; copy data
	POPR	#^m<r1,r2,r3,r4,r5>		
	MOVB	R1,BUF_B_LENGTH(R2)
100$:	MOVL	#SS$_NORMAL,R0			
	RET
show_default_len = . - SHOW_DEFAULT_CODE



PID  =  4
BUFF =  8
SIZE = 12

;++
;	Show_Default -- 
;
;
;--
.ENTRY	Show_Default,^M<R2,R3,R4,R5>

	; Clear out the buffer (to insure a zero after directory string)
;	MOVC5	#0,#0,#0,SIZE(AP),@BUFF(AP)

	; Clear the event flag
	$CLREF_S	EFN=#0

	; Call SHOW_DEFAULT() in the context of process PID ()
	PUSHL	#0				; EFN
	CLRQ	-(SP)				; ASTADR and ASTPRM
	PUSHL	SIZE(AP)			; Data size
	PUSHL	BUFF(AP)			; Data ptr
	PUSHL	#show_default_len		; Size of code
	PUSHAB	SHOW_DEFAULT_CODE		; Code to execute
	PUSHL	PID(AP)				; Our PID
	CALLS	#8,CALL_REMOTE_G
	BLBC	R0,100$

	$WAITFR_S	EFN=#0				; wait for event flag.
	
100$:	RET

.END
