      SUBROUTINE MAIN
      INTEGER OLDADR(2), ADDR(2), N, STATUS, I, JUNK
      INTEGER GETLIN, GETWRD, DOLINE
      LOGICAL*1 OLDWRD(400), BUF(400), WORD(400)
      COMMON / CISAM / DIF, WIDTH, JUSTFY
      INTEGER DIF
      INTEGER WIDTH
      INTEGER JUSTFY
      CALL GETCMD
      OLDWRD(1) = 0
      OLDADR(1) = 0
      OLDADR(2) = 0
      N = 0
23000 CONTINUE
      CALL MARKL(1, ADDR)
      STATUS = GETLIN(BUF, 1)
      IF(.NOT.(STATUS .NE. -1))GOTO 23003
      N = N + 1
      I = 1
      JUNK = GETWRD(BUF, I, WORD)
      IF(.NOT.(DOLINE(N) .EQ. 1))GOTO 23005
      CALL OUTLIN(WORD, ADDR)
23005 CONTINUE
      CALL SCOPY(WORD, 1, OLDWRD, 1)
      OLDADR(1) = ADDR(1)
      OLDADR(2) = ADDR(2)
23003 CONTINUE
23001 IF(.NOT.(STATUS .EQ. -1))GOTO 23000
23002 CONTINUE
      IF(.NOT.(DOLINE(N) .EQ. 0))GOTO 23007
      CALL OUTLIN(OLDWRD, OLDADR)
23007 CONTINUE
      RETURN
      END
      INTEGER FUNCTION DOLINE(N)
      INTEGER N
      COMMON / CISAM / DIF, WIDTH, JUSTFY
      INTEGER DIF
      INTEGER WIDTH
      INTEGER JUSTFY
      IF(.NOT.(DIF .EQ. 1))GOTO 23009
      DOLINE=(1)
      RETURN
23009 CONTINUE
      IF(.NOT.(MOD(N, DIF) .EQ. 1))GOTO 23011
      DOLINE=(1)
      RETURN
23011 CONTINUE
      DOLINE=(0)
      RETURN
23012 CONTINUE
23010 CONTINUE
      END
      SUBROUTINE OUTLIN(WORD, ADDR)
      LOGICAL*1 WORD(100)
      INTEGER ADDR(2), J
      INTEGER LENGTH
      COMMON / CISAM / DIF, WIDTH, JUSTFY
      INTEGER DIF
      INTEGER WIDTH
      INTEGER JUSTFY
      IF(.NOT.(JUSTFY .EQ. 1))GOTO 23013
      J=LENGTH(WORD) + 1
23015 IF(.NOT.(J .LE. WIDTH))GOTO 23017
      CALL PUTC(32)
23016 J=J+1
      GOTO 23015
23017 CONTINUE
23013 CONTINUE
      CALL PUTLIN(WORD, 2)
      IF(.NOT.(JUSTFY .EQ. 0))GOTO 23018
      J=LENGTH(WORD) + 1
23020 IF(.NOT.(J .LE. WIDTH))GOTO 23022
      CALL PUTC(32)
23021 J=J+1
      GOTO 23020
23022 CONTINUE
23018 CONTINUE
      CALL PUTC(32)
      CALL PUTDEC(ADDR(1), 1)
      CALL PUTC(32)
      CALL PUTDEC(ADDR(2), 1)
      CALL PUTC(10)
      RETURN
      END
      SUBROUTINE GETCMD
      LOGICAL*1 ARG(40)
      INTEGER GETARG, EQUAL, CTOI
      INTEGER I, J
      COMMON / CISAM / DIF, WIDTH, JUSTFY
      INTEGER DIF
      INTEGER WIDTH
      INTEGER JUSTFY
      LOGICAL*1 QUEST(2)
      DATA QUEST(1)/63/,QUEST(2)/0/
      DIF = 1
      WIDTH = 25
      JUSTFY = 0
      I=1
23023 IF(.NOT.(GETARG(I, ARG, 40) .NE. -1))GOTO 23025
      CALL FOLD(ARG)
      IF(.NOT.(EQUAL(ARG,QUEST) .EQ. 1))GOTO 23026
      CALL ERROR(45Husage:  isam [-d<dif>] [-w<width>] [-j<l/r>].)
23026 CONTINUE
      IF(.NOT.(ARG(1) .EQ. 45))GOTO 23028
      I23030=(ARG(2))
      GOTO 23030
23032 CONTINUE
      J = 3
      DIF = CTOI(ARG, J)
      IF(.NOT.(DIF .LE. 0))GOTO 23033
      DIF = 1
23033 CONTINUE
      GOTO 23031
23035 CONTINUE
      J = 3
      WIDTH = CTOI(ARG, J)
      IF(.NOT.(WIDTH .LE. 0))GOTO 23036
      WIDTH = 25
23036 CONTINUE
      GOTO 23031
23038 CONTINUE
      IF(.NOT.(ARG(3) .EQ. 108))GOTO 23039
      JUSTFY = 0
      GOTO 23040
23039 CONTINUE
      IF(.NOT.(ARG(3) .EQ. 114))GOTO 23041
      JUSTFY = 1
23041 CONTINUE
23040 CONTINUE
      GOTO 23031
23043 CONTINUE
      CALL BADARG(ARG)
      GOTO 23031
23030 CONTINUE
      IF(I23030.EQ.100)GOTO 23032
      IF(I23030.EQ.106)GOTO 23038
      IF(I23030.EQ.119)GOTO 23035
      GOTO 23043
23031 CONTINUE
      GOTO 23029
23028 CONTINUE
      CALL BADARG(ARG)
23029 CONTINUE
23024 I=I+1
      GOTO 23023
23025 CONTINUE
      RETURN
      END
