2 # Copyright 2016,2020 Ian Jackson
3 # SPDX-License-Identifier: GPL-3.0-or-later
4 # There is NO WARRANTY.
9 puts stderr "bad usage: $msg"
15 badusage "unknown option $lastarg"
21 if {![llength $argv]} { badusage "$lastarg needs a value" }
22 set arg [lindex $argv 0]
23 set argv [lrange $argv 1 end]
30 if {[catch { eval {$arg + 0} } emsg]} {
31 badusage "$lastargv value must be a number ($emsg)"
35 proc generalarg {arg} {
36 switch -exact -- $arg {
37 -width { set applet::w [next_num] }
38 -height { set applet::h [next_num] }
39 -horizontal - -vertical { set applet::deforient $arg }
40 -borderColour - -borderColor { set applet::border_colour [next] }
41 -borderWidth { set applet::border_width [next_num] }
42 -debug { debug::setup puts }
50 if {![llength $argv]} { return 0 }
51 if {![regexp {^-} [lindex $argv 0]]} { return 0 }
55 proc next_special {va} {
60 if {[generalarg $arg]} continue