#!/bin/sh
: ; exec klone $0 "$@"
; The above line finds the klone executable in the $PATH
;;Skeleton of a typical klone script

(setq args (getopts "USAGE: %0 [options] start end digits
Prints consecutive numbers, from start (default to 1) to end (default to 99),
both inclusive.
If digits is specified, numbers are left-padded with 0 to fill at least digits.
(defaults to 0)
"
    ("-l" () oneline "prints all numbers blank-separated on one line,
instead of the default of one per line")
))

(setq digits (if (<= (length args) 2) 0 (Int (getn args 2))))
(setq end (if (<= (length args) 1) 99 (Int (getn args 1))))
(setq start (if (<= (length args) 0) 1 (Int (getn args 0))))
(setq separator (if oneline " " "\n"))

(defun main (&aux
  )
  (dotimes (i (+ (- end start) 1))
    (print-format "%0%1" (expand-num (+ start i) digits :overflow 's)
    separator)
))

(main)

;;; EMACS MODES
;;; Local Variables: ***
;;; mode:lisp ***
;;; End: ***

