	program fdmp
	implicit integer (a-z)
	character*1 zero
	data zero /0/
	external lib$_syntaxerr,forget_command

	character*255 string,macro_names(20),macro_defs(20)
	common /macros/ macro_defs,macro_names,no_defined
	character*5 prompt
	data prompt /'fdmp>'/
	real*8 array

	logical attention_flag,display_message
	common /control_c/ attention_flag,display_message

	include 'flags.inc'

	attention_flag=.false.
	display_message=.false.
!
! enable control c handling
!
	call enable_ctrl_c(forget_command,array)

	no_defined=0
 10	if (.not. readin) then
		call lib$get_input(string,prompt,length)
	 else
		read(2,15,end=9000) length,string
 15		format(q,a)
		if (echo_on) type 17,string
 17		format(' Read in:  ',a<length>)
	 end if
 400	if (length.le.0) goto 10
	call up_string(%ref(string),length)
	if (length.le.0) goto 10
	istat=comscan(string(1:length),ilength)
	if (istat.eq.%loc(lib$_syntaxerr)) then
		type 20,string(1:length)
 20		format(' Error with command line:',/,x,a,/,
     1			<length-ilength+1>x,'^')

	 endif
	if (logging) then
		if (.not. log_open) then
			open(unit=22,name='FDMP.LOG',
     1				type='new',err=9900,recl=255,
     2				carriagecontrol='list')
			log_open=.true.
		 endif
		write(22,23) string(1:length)
 23		format(a)
	 endif
	goto 10
 9000	readin=.false.
	close(unit=2)
	goto 10
 9900	type 9110
 9110	format(/' Error in opening log file '/)
	logging=.false.
	goto 10
	end
