C MUNG CMD LINES TO ALLOW AUTO-ENTRY OF NUMBERS BUT
C FORMULAS TO START WITH / CHARACTER.
C TRY AND KEEP CURSOR CTLS AS IS.
C // SWITCHES TO OLD MODE COMMANDS
C /+ SWITCHES TO NEW MODE COMMANDS (INITIAL DEFAULT)
C NUMERICS (0-9 IN COL 1) TREATED AS EV
C ALPHAS (" IN COL 1) TREATED AS E"
C /<ANYTHING> CHANGED TO JUST <ANYTHING> FOR COMMAND ENTRY
	SUBROUTINE GTMUNG(LINE)
	LOGICAL*1 LINE(132)
	INTEGER*2 IMODE,LIMODE
	LOGICAL*1 C2
	INTEGER*2 MODPUB
	COMMON/MODPUB/MODPUB,LIMODE
	DATA IMODE/0/
C HANDLE EXTRA MODE PARSING...DEFAULT,TO AVOID ENTER CMD IF NOT NEEDED.
C SKIP HANDLING ESC SEQUENCES AND THE LIKE
	IF(LINE(1).LT.34.OR.LINE(1).GT.122)GOTO 6000
C SKIP OTHER COMMAND INITIATING SPECIAL CHARS AS APPROPRIATE
	IF(LINE(1).GT.34.AND.LINE(1).LT.40)GOTO 6000
	IF(LINE(1).EQ.42)GOTO 6000
	IF(LINE(1).GE.58.AND.LINE(1).LE.64)GOTO 6000
	IF(LINE(1).EQ.95)GOTO 6000
	IF(LINE(1).NE.'/')GOTO 100
	IF(LINE(2).NE.'/')GOTO 110
C SETUP OLD MODE WITH //
	IMODE=0
	GOTO 900
110	CONTINUE
	IF(LINE(2).NE.';')GOTO 120
C SETUP NEW MODE WITH /;
	IMODE=1
	GOTO 900
120	CONTINUE
	IF(LINE(2).NE.'#')GOTO 124
	I=LIMODE
	LIMODE=IMODE
C /# SWAPS LAST AND NEW MODES
C THUS /# CAN BE USED IN CMD FILE FOLLOWED BY // TO SET OLD
C CMD MODE AND A TERMINAL /# GETS BACK ORIGINAL USER CMD MODE
	IMODE=I
	GOTO 900
124	CONTINUE
C IF WE JUST SAW /COMMAND, MUNGE OUT THE INITIAL /
	IF(IMODE.EQ.0)GOTO 6000
	DO 130 I=1,131
130	LINE(I)=LINE(I+1)
	IF(LINE(1).EQ.'?')LINE(1)='H'
C MUNGE ? INTO HELP COMMAND ALSO.
	GOTO 6000
100	CONTINUE
	IF(IMODE.EQ.0)GOTO 6000
C INPUT DIDN'T START WITH / SO TRY AND MAKE UP AN ENTER
	IF(LINE(2).EQ.'&')GOTO 6000
C 1& 2& ETC WORK STILL AS CURSOR CONTROLS
	C2='N'
	IF(LINE(1).EQ.'"')C2='"'
C	IF(LINE(1).GE.'0'.AND.LINE(1).LE.'9')C2='V'
	IF(LINE(1).LT.'0'.OR.LINE(1).GT.'9')GOTO 170
C INITIAL CHAR IS A DIGIT. IF 2ND CHAR IS ALSO A DIGIT OR
C SOMETHING REASONABLE THEN TREAT AS "EV" CMD. OTHERWISE
C JUST PASS AS A COMMAND SO CURSOR CTLS WORK STILL.
	IF(LINE(2).LE.' ')GOTO 6000
C ALLOW DIGIT FOLLOWED BY SPACE OR C.R. TO BE JUST CURSOR MOVE
	C2='V'
170	CONTINUE
C MOVE DOWN PAST 'EV'
	II=3
C MOVE THE " DOWN AND BASH IT OUT.
	IF(C2.EQ.'"')II=2
	DO 150 I=1,129
	M=133-I
	MM=M-II
150	LINE(M)=LINE(MM)
	LINE(1)='E'
	LINE(2)=C2
	LINE(3)=' '
	GOTO 6000
900	LINE(1)='*'
C MAKE COMMENT, THEN GO
6000	CONTINUE
C LET OTHER MODULES SEE MODE IN USE
	MODPUB=IMODE
	RETURN
	END
