diff options
author | aiju <devnull@localhost> | 2015-10-30 22:18:09 +0100 |
---|---|---|
committer | aiju <devnull@localhost> | 2015-10-30 22:18:09 +0100 |
commit | 5c5c074f12f4f59c1ec51661aabc9a9ebea32dbe (patch) | |
tree | 49a606d15949cf23dc08d68e584e198127d8a4f0 | |
parent | cd3053a3cc2e1dd751efc17a0e23b4d5a2b62341 (diff) | |
download | plan9front-5c5c074f12f4f59c1ec51661aabc9a9ebea32dbe.tar.xz |
delkey: don't be stupid
-rwxr-xr-x | rc/bin/delkey | 42 |
1 files changed, 1 insertions, 41 deletions
diff --git a/rc/bin/delkey b/rc/bin/delkey index c80af6a7b..4a0b4e6bc 100755 --- a/rc/bin/delkey +++ b/rc/bin/delkey @@ -6,47 +6,7 @@ ctl = /mnt/factotum/ctl if(test -r /mnt/term/mnt/factotum/ctl) ctl = /mnt/term/mnt/factotum/ctl -fn forceit { - switch($force){ - case no - echo -n $* '? [y/n]' > /dev/cons - ok = `{read} - switch($ok){ - case y* Y* - echo yes - case q* Q* - exit '' - case * - echo no - } - case * - echo yes - } -} - -fn deleteit { - key = `{echo $* | sed 's/ ![0-9a-zA-Z_]+\??/ /g' | sed 's/ +$//'} - if(~ `{forceit del$key} yes) - if(! echo del$key > $ctl) - exit bad -} - -force = no - -if(~ $1 '-f'){ - force = yes - shift -} - ifs=' ' -if(~ $#* 0){ - for(i in `{cat $ctl}) - deleteit $i - exit '' -} - -for(i in `{grep $"* $ctl}) - deleteit $i -exit '' +sed 's/ ![0-9a-zA-Z_]+\??/ /g; s/''/''''/g; s/ +$//' $ctl | awk -v 'ctl='^$ctl ' { printf "echo ''del%s'' > %s\n", $0, ctl } ' |