      SUBROUTINE MAIN
      LOGICAL*1 ARG1(400), ARG2(400) , STDIN(2)
      LOGICAL*1 LINE1(400), LINE2(400)
      INTEGER EQUAL, GETARG, GETLIN, OPEN
      INTEGER INFIL1, INFIL2, LINENO, M1, M2
      DATA STDIN/45, 0/
      IF(.NOT.(GETARG(1, ARG1, 400) .EQ. -1 .OR. (ARG1(1) .EQ. 63 .AND. 
     *ARG1(2) .EQ. 0)))GOTO 23000
      CALL ERROR (26Husage:  cmp file1 [file2].)
23000 CONTINUE
      IF(.NOT.(GETARG(2, ARG2, 400) .EQ. -1))GOTO 23002
      CALL SCOPY(STDIN, 1, ARGS, 1)
23002 CONTINUE
      INFIL1 = OPEN(ARG1, 1)
      IF(.NOT.(INFIL1 .EQ. -3))GOTO 23004
      CALL CANT(ARG1)
23004 CONTINUE
      IF(.NOT.(EQUAL(ARGS, STDIN) .EQ. 1))GOTO 23006
      INFIL2 = 1
      GOTO 23007
23006 CONTINUE
      INFIL2 = OPEN(ARG2, 1)
      IF(.NOT.(INFIL2 .EQ. -3))GOTO 23008
      CALL CANT(ARG2)
23008 CONTINUE
23007 CONTINUE
      LINENO = 0
23010 CONTINUE
      M1 = GETLIN(LINE1, INFIL1)
      M2 = GETLIN(LINE2, INFIL2)
      IF(.NOT.(M1 .EQ. -1 .OR. M2 .EQ. -1))GOTO 23013
      GOTO 23012
23013 CONTINUE
      LINENO = LINENO + 1
      IF(.NOT.(EQUAL(LINE1, LINE2) .EQ. 0))GOTO 23015
      CALL DIFMSG(LINENO, LINE1, LINE2)
23015 CONTINUE
23011 GOTO 23010
23012 CONTINUE
      IF(.NOT.(M1 .EQ. -1 .AND. M2 .NE. -1))GOTO 23017
      CALL REMARK(14Heof on file 1.)
      GOTO 23018
23017 CONTINUE
      IF(.NOT.(M2 .EQ. -1 .AND. M1 .NE. -1))GOTO 23019
      CALL REMARK(14Heof on file 2.)
23019 CONTINUE
23018 CONTINUE
      RETURN
      END
      SUBROUTINE DIFMSG(LINENO, LINE1, LINE2)
      LOGICAL*1 LINE1(400), LINE2(400)
      INTEGER LINENO
      CALL PUTDEC(LINENO, 5)
      CALL PUTC(10)
      CALL PUTLIN(LINE1, 2)
      CALL PUTLIN(LINE2, 2)
      RETURN
      END
