      SUBROUTINE MAIN
      LOGICAL*1 BUF(400)
      INTEGER GETARG, OPEN
      INTEGER I
      I=1
23000 CONTINUE
      IF(.NOT.(GETARG(I,BUF,400) .EQ. -1))GOTO 23003
      IF(.NOT.(I .NE. 1))GOTO 23005
      GOTO 23002
23005 CONTINUE
      INT = 1
      GOTO 23004
23003 CONTINUE
      IF(.NOT.(BUF(1) .EQ. 63 .AND. BUF(2) .EQ. 0))GOTO 23007
      CALL ERROR (26Husage:  cpress [file ...].)
      GOTO 23008
23007 CONTINUE
      IF(.NOT.(BUF(1) .EQ. 45 .AND. BUF(2) .EQ. 0))GOTO 23009
      INT = 1
      GOTO 23010
23009 CONTINUE
      INT = OPEN(BUF,1)
      IF(.NOT.(INT .EQ. -3))GOTO 23011
      CALL CANT(BUF)
23011 CONTINUE
23010 CONTINUE
23008 CONTINUE
23004 CONTINUE
      CALL PRESS (INT)
      IF(.NOT.(INT .NE. 1))GOTO 23013
      CALL CLOSE(INT)
23013 CONTINUE
23001 I=I+1
      GOTO 23000
23002 CONTINUE
      RETURN
      END
      SUBROUTINE PRESS (INT)
      LOGICAL*1 GETCH
      LOGICAL*1 BUF(124), C, LASTC
      INTEGER INT, NREP, NSAVE
      NSAVE = 0
      LASTC=GETCH(LASTC,INT)
23015 IF(.NOT.(LASTC .NE. -1))GOTO 23017
      NREP=1
23018 IF(.NOT.(GETCH(C,INT) .EQ. LASTC))GOTO 23020
      IF(.NOT.(NREP .GE. 124))GOTO 23021
      GOTO 23020
23021 CONTINUE
23019 NREP = NREP + 1
      GOTO 23018
23020 CONTINUE
      IF(.NOT.(NREP .LT. 4))GOTO 23023
23025 IF(.NOT.(NREP .GT. 0))GOTO 23027
      NSAVE = NSAVE + 1
      BUF(NSAVE) = LASTC
      IF(.NOT.(NSAVE .GE. 124))GOTO 23028
      CALL PUTBUF(BUF, NSAVE)
23028 CONTINUE
23026 NREP = NREP - 1
      GOTO 23025
23027 CONTINUE
      GOTO 23024
23023 CONTINUE
      CALL PUTBUF(BUF, NSAVE)
      CALL PUTC (125)
      CALL PUTC(LASTC)
      CALL PUTC(NREP)
23024 CONTINUE
23016 LASTC = C
      GOTO 23015
23017 CONTINUE
      CALL PUTBUF(BUF, NSAVE)
      RETURN
      END
      SUBROUTINE PUTBUF(BUF, NSAVE)
      LOGICAL*1 BUF(124)
      INTEGER I, NSAVE
      IF(.NOT.(NSAVE .GT. 0))GOTO 23030
      CALL PUTC (NSAVE)
      I=1
23032 IF(.NOT.(I.LE.NSAVE))GOTO 23034
      CALL PUTC(BUF(I))
23033 I=I+1
      GOTO 23032
23034 CONTINUE
23030 CONTINUE
      NSAVE = 0
      RETURN
      END
