C-----------------------------------------------------------------------
C  URDSTR -- READ A STRING IN FROM THE VIRTUAL KEYBOARD
C
C    USE SMG ROUTINES -- INPUT FROM INTERACTIVE USER.  THIS ROUTINE
C  SHOULD ONLY BE CALLED FROM AN INTERACTIVE PROCESS -- IT IS THE
C  CALLER'S RESPONSIBILITY TO DECIDE THIS.
C
C    NB DON'T USE SMG ON UNIX SYSTEMS WHERE IT DOES NOT EXIST!
C  DMC OCT 1991
C
      SUBROUTINE URDSTR(ZSTR,IEOF,IERR)
C
      CHARACTER*(*) ZSTR    ! STRING TO BE READ IN
      INTEGER IEOF	      ! INTEGER END OF FILE = 1
      INTEGER IERR	      ! COMPLETION CODE NORMAL = 0
      CHARACTER*1 EOT
C
#ifdef __VMS
      INCLUDE '($SMGDEF)'
#endif
C
      INCLUDE 'USERIO'
C
      CHARACTER*1 ZNULL
C
#ifdef __VMS
      INTEGER SMG$READ_COMPOSED_LINE
#endif
C
C--------------------------------------
C
      ZSTR=' '
      ZNULL=CHAR(0)
      IERR=0
      IEOF=0
      EOT = char(3)
C
#ifdef __VMS
      IF(LUNTIN(1).NE.5) THEN
         IERR=1
         ISTAT=SMG$READ_COMPOSED_LINE(	
     >      LUNTIN(1),,ZSTR,ZNULL,ILENR,,,,,,,ITERM)	
         IF(ITERM.EQ.SMG$K_TRM_CTRLZ) THEN	
	    IEOF=1	
	    ISTAT=1
         ELSE	
	    IEOF=0	
         ENDIF	
         IF(ISTAT.NE.1) THEN
	    CALL LIB$SIGNAL(%VAL(ISTAT))
         ELSE
	    IERR=0
         ENDIF
C	
      ELSE
        IERR=0
        IEOF=0
C
        READ(LUNTIN(1),'(A)',ERR=9998,END=9994) ZSTR
        GO TO 9999
C
 9994   IEOF=1
        GO TO 9999
 9998   IERR=1
        GO TO 9999
 9999   CONTINUE
C
	ENDIF
#else
c
c  unix
c
	if (NLJAVA) then
		write(*,*) EOT
	endif

        call fgetline(' ',zstr,ichars)
        if(ichars.eq.-1) ieof=1
c
#endif
C
      RETURN
      END
