      SUBROUTINE MAIN
      LOGICAL*1 NSTR(12)
      INTEGER I, N
      INTEGER ALLDIG, CTOI, GETARG
      LOGICAL*1 DIGSTR(11)
      DATA DIGSTR(1)/48/,DIGSTR(2)/49/,DIGSTR(3)/50/,DIGSTR(4)/51/,DIGST
     *R(5)/52/,DIGSTR(6)/53/,DIGSTR(7)/54/,DIGSTR(8)/55/,DIGSTR(9)/56/,D
     *IGSTR(10)/57/,DIGSTR(11)/0/
      IF(.NOT.( GETARG( 1, NSTR, 12) .EQ. -1 ))GOTO 23000
      N = 80
      GOTO 23001
23000 CONTINUE
      IF(.NOT.( ALLDIG( NSTR) .EQ. 0 ))GOTO 23002
      CALL ERROR(60H? Usage:  ruler [n]       (1 <= n <= MAXLINE ; Defau
     *lt = 80))
      GOTO 23003
23002 CONTINUE
      I = 1
      N = CTOI( NSTR, I)
      N = MIN0( N, 400)
      N = MAX0( N, 1)
23003 CONTINUE
23001 CONTINUE
      I = 1 
23004 IF(.NOT.(I .LE. N ))GOTO 23006
      IF(.NOT.( MOD( I, 10) .EQ. 0 ))GOTO 23007
      CALL PUTC( 43)
      GOTO 23008
23007 CONTINUE
      CALL PUTC( 45)
23008 CONTINUE
23005 I = I + 1 
      GOTO 23004
23006 CONTINUE
      CALL PUTC( 10)
      I = 1 
23009 IF(.NOT.(I .LE. N ))GOTO 23011
      IF(.NOT.( MOD( I, 10) .EQ. 0 ))GOTO 23012
      CALL PUTC( DIGSTR( MOD( MOD( I, 100)/10, 10) + 1 ))
      GOTO 23013
23012 CONTINUE
      CALL PUTC( 32)
23013 CONTINUE
23010 I = I + 1 
      GOTO 23009
23011 CONTINUE
      CALL PUTC( 10)
      I = 1 
23014 IF(.NOT.(I .LE. N ))GOTO 23016
      CALL PUTC( DIGSTR( MOD( I, 10) + 1 ))
23015 I = I + 1 
      GOTO 23014
23016 CONTINUE
      CALL PUTC( 10)
      I = 1 
23017 IF(.NOT.(I .LE. N ))GOTO 23019
      IF(.NOT.( MOD( I, 10) .EQ. 0 ))GOTO 23020
      CALL PUTC( 43)
      GOTO 23021
23020 CONTINUE
      CALL PUTC( 45)
23021 CONTINUE
23018 I = I + 1 
      GOTO 23017
23019 CONTINUE
      CALL PUTC( 10)
      RETURN
      END
