Commit Diff


commit - dfc66788b4af44513e7e29c713d5a185e5799ea0
commit + c38046f2c8825d2f3be5229c7feb37a505e96fd6
blob - a5cdbff16e68b449d8c11b771dfe328c5dfcc649
blob + 2b1bf087080c157f7c417e0c8ca9f9b2814b5df5
--- exercise
+++ exercise
@@ -445,6 +445,12 @@ proc main {argc argv} {
             puts stderr "usage: $prog $u"
             exit 1
         }
+        if {$opt eq "j"} {
+            if {![string is integer -strict $arg] || $arg < 1} {
+                puts stderr "$prog: -j expects positive integer argument"
+                exit 1
+            }
+        }
         if {$opt eq "p"} {
             # handle key-value options -pd=, -ps=, -pt=
             if {[set i [string first "=" $arg]] == -1} {
@@ -460,12 +466,6 @@ proc main {argc argv} {
             set opt p$k
             set arg $v
         }
-        if {$opt eq "j"} {
-            if {![string is integer -strict $arg] || $arg < 1} {
-                puts stderr "$prog: -j expects positive integer argument"
-                exit 1
-            }
-        }
         if {$opt eq "v"} {
             set arg [expr $opts(-v) + 1]        ;# increment
         }