1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-12-22 23:26:47 +02:00

dsv/dsv: add support for PDF embedded in ZIP

Syntax:

D: url-to-zip-file path-of-pdf-in-zip

Example:

D: http://www.usb.org/developers/docs/usb_20_071012.zip usb_20_071012/usb_20.pdf
This commit is contained in:
Werner Almesberger 2012-07-19 11:29:49 -03:00
parent d67e8ec823
commit e5e67dd597

12
dsv/dsv
View File

@ -61,8 +61,16 @@ flush()
ds=$nm-`basename "$url"`
mkdir -p $DSV_DIR
if [ ! -r "$DSV_DIR/$ds" ]; then
wget -nv -O "$DSV_DIR/$ds" "$url"
# @@@ should handle error
inside=${url#*.[Zz][Ii][Pp] }
if [ "$inside" = "$url" ]; then
wget -nv -O "$DSV_DIR/$ds" "$url"
# @@@ should handle error
else
url=${url%`echo x"$inside" | sed 's/./?/g'`}
wget -nv -O "$DSV_DIR/_tmp" "$url"
unzip -p "$DSV_DIR/_tmp" "$inside" >"$DSV_DIR/$ds" ||
{ rm -f "$DSV_DIR/$ds"; exit 1; }
fi
fi
eval for n in $name $alias\; do \
'nm=`echo "$n" | sed "s/%/%25/g;s|/|%2F|g"`;' \