      SUBROUTINE MAIN
      LOGICAL*1 BUF(512)
      INTEGER OPEN, GETARG, LENGTH, ALLDIG
      INTEGER TABS(512), INT, I, K, L
      CALL QUERY(41Husage:  detab [<t1>...] [+<n>] [file] ...)
      CALL ARGTAB(BUF)
      CALL SETTAB(BUF, TABS)
      INT = -3
      I=1
23000 IF (.NOT.(GETARG(I, BUF, 512) .NE. -1))GOTO 23002
      IF (.NOT.(BUF(1) .EQ. 43 .OR. ALLDIG(BUF) .EQ. 1))GOTO 23003
      GOTO 23001
23003 CONTINUE
      IF (.NOT.(BUF(1) .EQ. 45 .AND. BUF(2) .EQ. 0))GOTO 23005
      INT = 1
      GOTO 23006
23005 CONTINUE
      INT = OPEN(BUF, 1)
23006 CONTINUE
      IF (.NOT.(INT .EQ. -3))GOTO 23007
      CALL CANT(BUF)
23007 CONTINUE
      CALL DETAB (TABS, INT)
      IF (.NOT.(INT .NE. 1))GOTO 23009
      CALL CLOSE(INT)
23009 CONTINUE
23001 I=I+1
      GOTO 23000
23002 CONTINUE
      IF (.NOT.(INT .EQ. -3))GOTO 23011
      CALL DETAB(TABS, 1)
23011 CONTINUE
      RETURN
      END
      SUBROUTINE DETAB (TABS, INT)
      INTEGER INT
      LOGICAL*1 GETCH
      LOGICAL*1 C
      INTEGER TABS(100)
      INTEGER TABPOS
      INTEGER COL
      COL = 1
23013 IF (.NOT.(GETCH(C, INT) .NE. -1))GOTO 23014
      IF (.NOT.(C .EQ. 9))GOTO 23015
23017 CONTINUE
      CALL PUTCH(32,2)
      COL = COL + 1
      IF (.NOT.(TABPOS(COL, TABS) .EQ. 1))GOTO 23020
      GOTO 23019
23020 CONTINUE
23018 GOTO 23017
23019 CONTINUE
      GOTO 23016
23015 CONTINUE
      IF (.NOT.(C .EQ. 10))GOTO 23022
      CALL PUTCH(10,2)
      COL = 1
      GOTO 23023
23022 CONTINUE
      CALL PUTCH(C,2)
      COL = COL + 1
23023 CONTINUE
23016 CONTINUE
      GOTO 23013
23014 CONTINUE
      RETURN
      END
