      SUBROUTINE MAIN
      LOGICAL*1 BUF(512), MSG(512, 20), BLNKLN(2)
      INTEGER STATUS, I, WIDTH, HEAD, TAIL, LIMIT
      INTEGER GETLIN, EQUAL, GETARG, CTOI
      DATA BLNKLN/10, 0/
      CALL QUERY(36Husage:  prlabl [-width] <label_file.)
      LIMIT = 7
      IF (.NOT.(GETARG(1, BUF, 512) .NE. -1))GOTO 23000
      IF (.NOT.(BUF(1) .EQ. 45))GOTO 23002
      I = 2
      LIMIT = CTOI(BUF, I) - 2
      IF (.NOT.(LIMIT .LE. 0))GOTO 23004
      LIMIT = 7
      GOTO 23005
23004 CONTINUE
      IF (.NOT.(LIMIT .GT. 20))GOTO 23006
      LIMIT = 20
23006 CONTINUE
23005 CONTINUE
23002 CONTINUE
23000 CONTINUE
23008 CONTINUE
23011 CONTINUE
      STATUS = GETLIN(BUF, 1)
      IF (.NOT.(STATUS .EQ. -1))GOTO 23014
      GOTO 23013
23014 CONTINUE
      IF (.NOT.(EQUAL(BUF, BLNKLN) .EQ. 0))GOTO 23016
      GOTO 23013
23016 CONTINUE
23012 GOTO 23011
23013 CONTINUE
      IF (.NOT.(STATUS .EQ. -1))GOTO 23018
      GOTO 23010
23018 CONTINUE
      I = 1
23020 IF (.NOT.(STATUS .NE. -1))GOTO 23022
      IF (.NOT.(BUF(1) .EQ. 35))GOTO 23023
      GOTO 23021
23023 CONTINUE
      IF (.NOT.(EQUAL(BUF, BLNKLN) .EQ. 1))GOTO 23025
      GOTO 23022
23025 CONTINUE
      IF (.NOT.(I .GT. LIMIT))GOTO 23027
      GOTO 23021
23027 CONTINUE
      CALL SCOPY(BUF, 1, MSG(1, I), 1)
      I = I + 1
23028 CONTINUE
23026 CONTINUE
23024 CONTINUE
23021 STATUS=GETLIN(BUF,1)
      GOTO 23020
23022 CONTINUE
      WIDTH = I - 1
      IF (.NOT.(WIDTH .LE. 0))GOTO 23029
      GOTO 23009
23029 CONTINUE
      HEAD = 1 + (LIMIT - WIDTH) / 2
      TAIL = LIMIT + 1 + 1 - HEAD - WIDTH
      I=1
23031 IF (.NOT.(I .LE. HEAD))GOTO 23033
      CALL PUTCH(10, 2)
23032 I=I+1
      GOTO 23031
23033 CONTINUE
      I=1
23034 IF (.NOT.(I .LE. WIDTH))GOTO 23036
      CALL PUTLIN(MSG(1, I), 2)
23035 I=I+1
      GOTO 23034
23036 CONTINUE
      I=1
23037 IF (.NOT.(I .LE. TAIL))GOTO 23039
      CALL PUTCH(10, 2)
23038 I=I+1
      GOTO 23037
23039 CONTINUE
23009 IF (.NOT.(STATUS .EQ. -1))GOTO 23008
23010 CONTINUE
      RETURN
      END
