1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-22 20:53:44 +02:00

dsv/dsv: sent User-Agent to "dsv/1.0" (instead of Wget/...)

Digi-Key now blocks wget from accessing their document cache.
Seems to be a rather silly move ...
This commit is contained in:
Werner Almesberger 2013-09-10 11:55:49 -03:00
parent bbb6513b42
commit 3256b03294

14
dsv/dsv
View File

@ -2,8 +2,8 @@
# #
# dsv - Improved data sheet viewer # dsv - Improved data sheet viewer
# #
# Written 2010-2012 by Werner Almesberger # Written 2010-2013 by Werner Almesberger
# Copyright 2010-2012 Werner Almesberger # Copyright 2010-2013 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
@ -41,6 +41,12 @@ usage()
} }
do_wget()
{
wget -nv -U "dsv/1.0" "$@"
}
up() up()
{ {
old=`pwd` old=`pwd`
@ -64,13 +70,13 @@ flush()
if [ ! -r "$DSV_DIR/$ds" ]; then if [ ! -r "$DSV_DIR/$ds" ]; then
inside=${url#*.[Zz][Ii][Pp] } inside=${url#*.[Zz][Ii][Pp] }
if [ "$inside" = "$url" ]; then if [ "$inside" = "$url" ]; then
wget -nv -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'`} url=${url%`echo x"$inside" | sed 's/./?/g'`}
zip=$nm-`basename "$url"` zip=$nm-`basename "$url"`
if [ ! -r "$DSV_DIR/$zip" ]; then if [ ! -r "$DSV_DIR/$zip" ]; then
wget -nv -O "$DSV_DIR/$zip" "$url" do_wget -O "$DSV_DIR/$zip" "$url"
# @@@ should handle error # @@@ should handle error
fi fi
unzip -p "$DSV_DIR/$zip" "$inside" >"$DSV_DIR/$ds" || unzip -p "$DSV_DIR/$zip" "$inside" >"$DSV_DIR/$ds" ||