1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-26 07:13:08 +02:00

dsv: make "dsv setup" accept spaces in names and aliases

- dsv (set_value): store name and alias with double quotes, to protect
  spaces
- dsv (flush): access name and alias via "eval"
This commit is contained in:
Werner Almesberger 2010-11-30 18:49:16 -03:00
parent 3b3c4bf056
commit 92cb58023d

15
dsv/dsv
View File

@ -49,19 +49,20 @@ up()
flush()
{
[ -z "$name" ] && return
eval nm=$name
[ -z "$nm" ] && return
if [ -z "$url" ]; then
echo "$name: no URL" 2>&1
echo "$nm: no URL" 2>&1
exit 1
fi
ds=$name-`basename "$url"`
ds=$nm-`basename "$url"`
mkdir -p $DSV_DIR
if [ ! -r "$DSV_DIR/$ds" ]; then
wget -nv -O "$DSV_DIR/$ds" "$url"
# @@@ should handle error
fi
for n in $name $alias; do
echo "$ds" >$DSV_DIR/dsv-$n
eval for n in $name $alias\; do \
echo '"$ds"' '>$DSV_DIR/dsv-$n'\; \
done
name=
alias=
@ -73,8 +74,8 @@ set_value()
{
case "$tag" in
N:|n:) flush
name=$value;;
A:|a:) alias="$alias $value";;
name="\"$value\"";;
A:|a:) alias="$alias \"$value\"";;
D:|d:) url=$value;;
"")
;; # first iteration