blob: c80af6a7b454908eba243e076e7f1081d4eadcd8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#!/bin/rc
rfork e
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 ''
|