      SUBROUTINE MAIN
      INTEGER*4 OLDADR, ADDR
      INTEGER N, STATUS, I, JUNK
      INTEGER GETLIN, GETWRD, DOLINE, PTREQ, NOTE
      LOGICAL*1 OLDWRD(512), BUF(512), WORD(512)
      COMMON / CISAM / DIF, WIDTH, JUSTFY
      INTEGER DIF
      INTEGER WIDTH
      INTEGER JUSTFY
      CALL QUERY(45Husage:  isam [-d<dif>] [-w<width>] [-j<l/r>].)
      CALL GETCMD
      OLDWRD(1) = 0
      CALL PTRCPY(0, OLDADR)
      N = 0
23000 CONTINUE
      JUNK = NOTE(ADDR, 1)
      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 STRCPY(WORD, OLDWRD)
      CALL PTRCPY(ADDR, OLDADR)
23003 CONTINUE
23001 IF (.NOT.(STATUS .EQ. -1))GOTO 23000
23002 CONTINUE
      IF (.NOT.(DOLINE(N) .EQ. 0 .AND. PTREQ(OLDADR, 0) .EQ. 0))GOTO 230
     *07
      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 GETCMD
      LOGICAL*1 ARG(40)
      INTEGER GETARG, CTOI
      INTEGER I, J
      COMMON / CISAM / DIF, WIDTH, JUSTFY
      INTEGER DIF
      INTEGER WIDTH
      INTEGER JUSTFY
      DIF = 1
      WIDTH = 25
      JUSTFY = 0
      I=1
23013 IF (.NOT.(GETARG(I, ARG, 40) .NE. -1))GOTO 23015
      CALL FOLD(ARG)
      IF (.NOT.(ARG(1) .EQ. 45))GOTO 23016
      IF (.NOT.(ARG(2) .EQ. 100))GOTO 23018
      J = 3
      DIF = CTOI(ARG, J)
      IF (.NOT.(DIF .LE. 0))GOTO 23020
      DIF = 1
23020 CONTINUE
      GOTO 23019
23018 CONTINUE
      IF (.NOT.(ARG(2) .EQ. 119))GOTO 23022
      J = 3
      WIDTH = CTOI(ARG, J)
      IF (.NOT.(WIDTH .LE. 0))GOTO 23024
      WIDTH = 25
23024 CONTINUE
      GOTO 23023
23022 CONTINUE
      IF (.NOT.(ARG(2) .EQ. 106))GOTO 23026
      IF (.NOT.(ARG(3) .EQ. 108))GOTO 23028
      JUSTFY = 0
      GOTO 23029
23028 CONTINUE
      IF (.NOT.(ARG(3) .EQ. 114))GOTO 23030
      JUSTFY = 1
23030 CONTINUE
23029 CONTINUE
      GOTO 23027
23026 CONTINUE
      CALL BADARG(ARG)
23027 CONTINUE
23023 CONTINUE
23019 CONTINUE
      GOTO 23017
23016 CONTINUE
      CALL BADARG(ARG)
23017 CONTINUE
23014 I=I+1
      GOTO 23013
23015 CONTINUE
      RETURN
      END
      SUBROUTINE OUTLIN(WORD, ADDR)
      LOGICAL*1 WORD(100)
      INTEGER*4 ADDR
      COMMON / CISAM / DIF, WIDTH, JUSTFY
      INTEGER DIF
      INTEGER WIDTH
      INTEGER JUSTFY
      IF (.NOT.(JUSTFY .EQ. 1))GOTO 23032
      CALL PUTSTR(WORD, WIDTH, 2)
      GOTO 23033
23032 CONTINUE
      CALL PUTSTR(WORD, -WIDTH, 2)
23033 CONTINUE
      CALL PUTCH(32,2)
      CALL PUTPTR(ADDR, 2)
      CALL PUTCH(10,2)
      RETURN
      END
