C******************** START FILE UwrMsg.FOR ; GROUP URDUTS ******************
C-----------------------------------------------------------
C&  UwrMsg UREAD WRITE  MESSAGE, FLUSH TYPEAHEAD, ... tbt 1/21/94
C
C  WRITE OUT  MESSAGE
C
      SUBROUTINE UwrMsg(TEXT,ITEM,ICOD)
 
      USE USERIO
C
      CHARACTER*(*) TEXT
      CHARACTER*(*) ITEM
C
      CHARACTER*72 ZBUFF
C
C  TEXT - TEXT OF MESSAGE
C  ITEM - ITEM CAUSING MESAGE (IF NONBLANK)
C
C  ICOD:  =-1: CLEAR PAGE BEFORE WRITING MESSAGE
C         =0: NO PAGE CLEAR, NO UPAUST CALL
C         =1: CALL UPAUST(0)
C         =2: CALL UPAUST(1)
 
 
 
 
 
C	IF(ICOD.LT.0) CALL NEUPAG
C
      ILT=ILNURD(ITEM)
C
      IF(ITEM(1:ILT).EQ.' ') THEN
        WRITE(LUNTRM,1001) TEXT
 1001 FORMAT(1X,A)
      ELSE
C
        ILTOT=LEN(TEXT)+ILT
        IF(ILTOT.LT.72) THEN
          WRITE(LUNTRM,1002) TEXT,ITEM(1:ILT)
        ELSE
          WRITE(LUNTRM,1004) TEXT,ITEM(1:ILT)
        ENDIF
 1002 FORMAT(1X,A,':  ',A)
 1004 FORMAT(1X,A,':'/1X,A)
      ENDIF
C--------------
C	CALL URDBUF(ZBUFF,ILBUF,1)
C	IF(NLINDI.AND.(NCHARA.GT.0)) WRITE(LUNTRM,1005) ABUFF(1:NCHARA)
C	IF(ILBUF.GT.0) WRITE(LUNTRM,1003) ZBUFF(1:ILBUF)
C1003	FORMAT(' USER TYPEAHEAD BUFFER CONTENTS:'/1X,A)
C1005	FORMAT(' PROGRAM PROMPT WAS:'/1X,A)
C--------------
      IF(ICOD.LE.0) GO TO 100
      IPAUSE=ICOD-1
C	CALL UPAUST(IPAUSE)
C  FLUSH BUFFER
 100  CONTINUE
C	CALL UCLEAR
      RETURN
      END
C******************** END FILE UwrMsg.FOR ; GROUP URDUTS ******************
