]> git.lizzy.rs Git - plan9front.git/commitdiff
newt: improve input filtering
authorstanley lieber <stanley.lieber@gmail.com>
Wed, 9 Apr 2014 05:57:03 +0000 (01:57 -0400)
committerstanley lieber <stanley.lieber@gmail.com>
Wed, 9 Apr 2014 05:57:03 +0000 (01:57 -0400)
rc/bin/newt

index 32e0b51b729a50da88adce0ce87e1193f8f2ee3a..7d6e8ab8e6017d640a6b9f1134e09bb3e0e79044 100755 (executable)
@@ -154,8 +154,10 @@ while(){
        cmd=`{read}
        switch($cmd){
        case [0-9]*
-               post=$cmd(1)
-               printp $post
+               if(grep -s -e '^[0-9]+$' <{echo $cmd(1)}){
+                       post=$cmd(1)
+                       printp $post
+               }
        case b
                if(! ~ $post $posts(1)){
                        post=`{echo $post^-1 | bc}