mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-29 11:56:15 +02:00
dsv/dsv: add Z tag to select files in ZIP archive not ending in .zip
The D: url file format only works if the URL ends in .zip, .ZIP, etc. Some URLs leading to a ZIP don't use this extension. The Z tag introduces the following alternative use: D: url Z: file where the URL is always treated as ZIP archive, no matter what it looks like.
This commit is contained in:
parent
65f93a2684
commit
7067c00a90
19
dsv/dsv
19
dsv/dsv
@ -2,8 +2,8 @@
|
|||||||
#
|
#
|
||||||
# dsv - Improved data sheet viewer
|
# dsv - Improved data sheet viewer
|
||||||
#
|
#
|
||||||
# Written 2010-2013 by Werner Almesberger
|
# Written 2010-2014 by Werner Almesberger
|
||||||
# Copyright 2010-2013 Werner Almesberger
|
# Copyright 2010-2014 Werner Almesberger
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -68,13 +68,20 @@ flush()
|
|||||||
ds=$nm-`basename "$url"`
|
ds=$nm-`basename "$url"`
|
||||||
mkdir -p $DSV_DIR
|
mkdir -p $DSV_DIR
|
||||||
if [ ! -r "$DSV_DIR/$ds" ]; then
|
if [ ! -r "$DSV_DIR/$ds" ]; then
|
||||||
inside=${url#*.[Zz][Ii][Pp] }
|
if [ "$zip" ]; then
|
||||||
|
inside=$zip
|
||||||
|
zip=$ds.zip
|
||||||
|
else
|
||||||
|
inside=${url#*.[Zz][Ii][Pp] }
|
||||||
|
fi
|
||||||
if [ "$inside" = "$url" ]; then
|
if [ "$inside" = "$url" ]; then
|
||||||
do_wget -O "$DSV_DIR/$ds" "$url"
|
do_wget -O "$DSV_DIR/$ds" "$url"
|
||||||
# @@@ should handle error
|
# @@@ should handle error
|
||||||
else
|
else
|
||||||
url=${url%`echo x"$inside" | sed 's/./?/g'`}
|
if [ -z "$zip" ]; then
|
||||||
zip=$nm-`basename "$url"`
|
url=${url%`echo x"$inside" | sed 's/./?/g'`}
|
||||||
|
zip=$nm-`basename "$url"`
|
||||||
|
fi
|
||||||
if [ ! -r "$DSV_DIR/$zip" ]; then
|
if [ ! -r "$DSV_DIR/$zip" ]; then
|
||||||
do_wget -O "$DSV_DIR/$zip" "$url"
|
do_wget -O "$DSV_DIR/$zip" "$url"
|
||||||
# @@@ should handle error
|
# @@@ should handle error
|
||||||
@ -90,6 +97,7 @@ flush()
|
|||||||
name=
|
name=
|
||||||
alias=
|
alias=
|
||||||
url=
|
url=
|
||||||
|
zip=
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -100,6 +108,7 @@ set_value()
|
|||||||
name="\"$value\"";;
|
name="\"$value\"";;
|
||||||
A:|a:) alias="$alias \"$value\"";;
|
A:|a:) alias="$alias \"$value\"";;
|
||||||
D:|d:) url=$value;;
|
D:|d:) url=$value;;
|
||||||
|
Z:|z:) zip=$value;;
|
||||||
"")
|
"")
|
||||||
;; # first iteration
|
;; # first iteration
|
||||||
*) echo "unrecognized tag \"$tag\"" 2>&1
|
*) echo "unrecognized tag \"$tag\"" 2>&1
|
||||||
|
Loading…
Reference in New Issue
Block a user