	.TITLE	GMCR	Get MCR Command Line
	.IDENT	"V1.1a"
	.ENABL	LC
	.PSECT	C$CODE
;+
; Index		GMCR	Get MCR Command Line
;
; Usage
;
;	char	buf[82];	/* must be on word boundary */
;	int	dsw;		/* if you want to receive status here */
;
;	dsw = gmcr(buf);
;
;
; Description
;
;	This is a new version of GMCR.MAC. It IS re-entrant, but at
;	great pain to common sense because GMCR is a disgrace to the
;	RSX exec. As for exec call, +ve dsw means OK. Command lives
;	in buf[2:2+dsw]. If you are lucky command terminator is
;	at buf[3+dsw]. Buf[0:1] are clobbered. See exec ref manual.
;	
;	If you want to do it right, see [11,10]DRGIN.MAC and the many
;	DECUS user-written CLIs! The macro is psychotoxic.
;
; Author
;	Dean Elsner, (Australia) (9) 322-6048. 26 Queen Street, Perth
;	Western Australia, 6000. I will wait for RSX 3.x before cleaning
;	this up some more.
;
; [end]
;-
; Edits:
; V1.0 12-Jun-80 RBD	Initial Edit
; V1.1 20-Oct-82 RBD	Change P-Sections. Fix documentation.
; V1.1a 9-Jun-85 DLE	Actually make it work. Poor RSTS hackers actually
;			read RSX manuals, then DID WHAT MANUALS SAID!
;			Curiously, they survived to do it again in other
;			modules.
;			It is true that GMCR is not re-entrant (among
;			other shocking bugs!). Since this code could NEVER
;			have worked, I took the liberty of changing how it
;			works. Total rewrite!

	.mcall	dir$

	.psect	c$code
gmcr::
	mov	2(sp),r0	; make user give us a re-entrant buffer
	mov	(pc)+,@r0	; stuff DIC into it
	.byte	127.,41.	; works for I/D
	mov	r0,-(sp)	; say where to rape user's buffer
	dir$			; exec magic here
	mov	$dsw,r0		; tell user what happened
	return			; THERE SHOULD BE A COMMON RETURN FOR
				; mov $dsw,r0; return

	.end
