	SUBROUTINE INPFIL(ICHAR,ITRANS,ITIME)
	COMMON/INPFIL/IPTR,IEND,INPSUM,INYBBL,IDELAY,IPRMPT,ISENT
     C			,LINE,ICHECK,LEN,IFLAG,NIREC
	COMMON/DOTCNT/ ICNT
	LOGICAL*1 LINE(512),IMSG(26)
	DATA IPTR/0/,LEN/0/
	DATA ICNT/0/
	DATA IFLAG/0/
	DATA IEND/0/
	DATA IMSG/"15,"12,'T','r','a','n','s','m','i','s','s','i','o',
     C		  'n',' ','c','o','m','p','l','e','t','e',"15,"12,0/
C
	IF(ITIME.EQ.3) GOTO 200
	IF((ITRANS.AND."200).NE.0) GOTO 100
C
C	  READ AN ASCII FILE
C
	IF(ITIME.NE.2) GOTO 1
C
C	  CHECK FOR A PROMPT CHARACTER
	IF(ICHAR.LT.0) RETURN
C	  IF NO FILE BEING RECEIVED AND IN ECHO MODE SEND REMOTE'S REPLY
C	  TO CONSOLE
	IF((ITRANS.AND.1).EQ.0.AND.(ITRANS.AND.4).NE.0)
     1		CALL ENQUE(ICHAR.AND."177)
	IF(ICHECK.EQ.0) RETURN
	IF((ICHAR.AND."177).NE.IPRMPT) RETURN
	CALL WAIT(IDELAY,1)
	ICHECK=0
	RETURN
C
C	  GET A CHARACTER FROM FILE IF WE ARE NOT WAITING FOR A PROMPT
C
  1	IF(ICHECK.EQ.1) RETURN
	IF(IPTR.EQ.0) GOTO 5
	IF(IPTR.GT.LEN) GOTO 5
	ICHAR=(LINE(IPTR).AND."377)
	IPTR=IPTR+1
C	  QUEUE THIS CHAR IF IN ECHO MODE AND DUPLEXED
	IF((ITRANS.AND."14).EQ."14) CALL ENQUE(ICHAR.AND."177)
C	  IGNORE RUBOUTS AND LINE-FEEDS IN FILE WHEN IN 7-BIT MODE
	IF((ITRANS.AND."40).EQ.0.AND.((ICHAR.AND."177).EQ."12.OR.
     C	   (ICHAR.AND."177).EQ."177))  GOTO 1
	RETURN
C
C	  WE HAVE TO READ A LINE OF TEXT
C
  5	IF(IEND.NE.0) GOTO 30
	IF((ITRANS.AND."40).EQ.0) GOTO 9
C	  USE A DIRECT-ACCESS READ WHEN IN 8-BIT MODE
	LEN=512
	READ(4'NIREC,END=20) LINE
	IF(IPTR.NE.0) GOTO 110
	IPTR=1
	GOTO 1
C	  USE FORMATTED READ IN 7-BIT MODE
  9	READ(4,10,END=20) LEN,(LINE(I),I=1,LEN)
 10	FORMAT(Q,4(128A1))
C
C	  CHECK TO SEE IF THIS IS THE FIRST TIME THRU
C
	IF(IPTR.NE.0) GOTO 11
C
C	  FIRST TIME THRU - IMMEDIATELY SEND THE FIRST CHARACTER
C
	IPTR=1
	GOTO 1
C
 11	ICHAR="15
 110	IPTR=1
C
C	  IF IN PROMPTLESS MODE THEN SKIP WAITING FOR A PROMPT
C
	IF((ITRANS.AND."400).EQ.0) ICHECK=1
C
C	  IF IN ECHO MODE SKIP PRINTING OF '-'
C
	IF((ITRANS.AND."4).NE.0) RETURN
	IFLAG=IFLAG+1
	IF(IFLAG.NE.2) RETURN
	ICNT=ICNT+1
	IF(ICNT.LE.50) GOTO 12
	CALL ENQUE("15)
	CALL ENQUE("12)
	ICNT=1
 12	CALL ENQUE('-')
	IFLAG=0
	RETURN
C
C	  PUT OUT A FINAL CARRIAGE-RETURN AT END OF FILE
C
 20	IEND=1
	IF((ITRANS.AND."40).NE.0) GOTO 30
	ICHAR="15
	RETURN
C
C	  WE ARE AT END OF FILE - NOTIFY USER
C
 30	DO 31 I=1,25
	IDUMMY=IMSG(I)
 31	CALL ENQUE(IDUMMY)
	CALL CLSFIL(2,ITRANS)
	ICHAR=-1
	IEND=0
	LEN=0
	IPTR=0
	RETURN
C
C	  BINARY FORMAT FILE TRANSFER
C
 100	RETURN
C
C	  TERMINATE INPUT FILE TRANSFER
C
 200	IF((ITRANS.AND.2).EQ.0) RETURN
	GOTO 30
	END
 12	CALL ENQUE('-')H	IFLAG=0	RETURNECR2C
