1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-04 23:05:21 +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()
{
eval nm=$name
nm=`echo "$nm" | sed 's/%/%25/g;s|/|%2F|g'`
[ -z "$nm" ] && return
if [ -z "$url" ]; then
echo "$nm: no URL" 2>&1
@ -62,7 +63,8 @@ flush()
# @@@ should handle error
fi
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
name=
alias=
@ -122,7 +124,7 @@ list()
{
while true; do
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
up || break
done | sort | uniq | column
@ -133,8 +135,9 @@ search()
{
while true; do
if [ -d $DSV_DIR ]; then
if [ -r "$DSV_DIR/dsv-$1" ]; then
file=`cat "$DSV_DIR/dsv-$1"`
name=`echo "$1" | sed 's/%/%25/g;s|/|%2F|g'`
if [ -r "$DSV_DIR/dsv-$name" ]; then
file=`cat "$DSV_DIR/dsv-$name"`
if [ ! -r "$DSV_DIR/$file" ]; then
echo "$1 -> $file: does not exist" 2>&1
exit 1