1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-26 14:51:53 +02:00

dsv: in names, convert / to %2F and % to %25

- dsv (flush): convert / and % in cache file name
- dsv (flush): convert / and % in name and alias file name
- dsv (list): convert %2F and %25 back to / and %
- dsv (search): convert / and %
This commit is contained in:
Werner Almesberger 2010-11-30 19:16:22 -03:00
parent e928d82b79
commit be269982f3

11
dsv/dsv
View File

@ -50,6 +50,7 @@ up()
flush() flush()
{ {
eval nm=$name eval nm=$name
nm=`echo "$nm" | sed 's/%/%25/g;s|/|%2F|g'`
[ -z "$nm" ] && return [ -z "$nm" ] && return
if [ -z "$url" ]; then if [ -z "$url" ]; then
echo "$nm: no URL" 2>&1 echo "$nm: no URL" 2>&1
@ -62,7 +63,8 @@ flush()
# @@@ should handle error # @@@ should handle error
fi fi
eval for n in $name $alias\; do \ eval for n in $name $alias\; do \
echo '"$ds"' '>$DSV_DIR/dsv-$n'\; \ 'nm=`echo "$n" | sed "s/%/%25/g;s|/|%2F|g"`;' \
echo '"$ds"' '>$DSV_DIR/dsv-$nm'\; \
done done
name= name=
alias= alias=
@ -122,7 +124,7 @@ list()
{ {
while true; do while true; do
if [ -d $DSV_DIR ]; then if [ -d $DSV_DIR ]; then
ls -1 $DSV_DIR | sed 's/^dsv-//p;d' ls -1 $DSV_DIR | sed 's/^dsv-//p;d' | sed 's|%2F|/|g;s/%25/%/g'
fi fi
up || break up || break
done | sort | uniq | column done | sort | uniq | column
@ -133,8 +135,9 @@ search()
{ {
while true; do while true; do
if [ -d $DSV_DIR ]; then if [ -d $DSV_DIR ]; then
if [ -r "$DSV_DIR/dsv-$1" ]; then name=`echo "$1" | sed 's/%/%25/g;s|/|%2F|g'`
file=`cat "$DSV_DIR/dsv-$1"` if [ -r "$DSV_DIR/dsv-$name" ]; then
file=`cat "$DSV_DIR/dsv-$name"`
if [ ! -r "$DSV_DIR/$file" ]; then if [ ! -r "$DSV_DIR/$file" ]; then
echo "$1 -> $file: does not exist" 2>&1 echo "$1 -> $file: does not exist" 2>&1
exit 1 exit 1