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
|
||||
#
|
||||
# Written 2010-2013 by Werner Almesberger
|
||||
# Copyright 2010-2013 Werner Almesberger
|
||||
# Written 2010-2014 by Werner Almesberger
|
||||
# Copyright 2010-2014 Werner Almesberger
|
||||
#
|
||||
# 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
|
||||
@ -68,13 +68,20 @@ flush()
|
||||
ds=$nm-`basename "$url"`
|
||||
mkdir -p $DSV_DIR
|
||||
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
|
||||
do_wget -O "$DSV_DIR/$ds" "$url"
|
||||
# @@@ should handle error
|
||||
else
|
||||
url=${url%`echo x"$inside" | sed 's/./?/g'`}
|
||||
zip=$nm-`basename "$url"`
|
||||
if [ -z "$zip" ]; then
|
||||
url=${url%`echo x"$inside" | sed 's/./?/g'`}
|
||||
zip=$nm-`basename "$url"`
|
||||
fi
|
||||
if [ ! -r "$DSV_DIR/$zip" ]; then
|
||||
do_wget -O "$DSV_DIR/$zip" "$url"
|
||||
# @@@ should handle error
|
||||
@ -90,6 +97,7 @@ flush()
|
||||
name=
|
||||
alias=
|
||||
url=
|
||||
zip=
|
||||
}
|
||||
|
||||
|
||||
@ -100,6 +108,7 @@ set_value()
|
||||
name="\"$value\"";;
|
||||
A:|a:) alias="$alias \"$value\"";;
|
||||
D:|d:) url=$value;;
|
||||
Z:|z:) zip=$value;;
|
||||
"")
|
||||
;; # first iteration
|
||||
*) echo "unrecognized tag \"$tag\"" 2>&1
|
||||
|
Loading…
Reference in New Issue
Block a user