+string_matches_glob() {
+ local string=$1
+ local glob=$2
+ case "$string" in
+ $glob) return 0;;
+ esac
+ return 1
+}
+
get_downloadclient() {
# $1 = URL with valid protocol prefix
local url=$1
local proto="${url%%://*}"
- # loop through DOWNLOAD_AGENTS variable looking for protocol
+ # loop through DLAGENTS (download agents) variable looking for protocol
local i
for i in "${DLAGENTS[@]}"; do
local handler="${i%%::*}"
- if [[ $proto = "$handler" ]]; then
+ if string_matches_glob "$proto" "$handler"; then
local agent="${i##*::}"
break
fi
--
1.7.12
+string_matches_glob() {
+ local string=$1
+ local glob=$2
+ case "$string" in
+ $glob) return 0;;
+ esac
+ return 1
+}
+
get_downloadclient() {
# $1 = URL with valid protocol prefix
local url=$1
local proto="${url%%://*}"
- # loop through DOWNLOAD_AGENTS variable looking for protocol
+ # loop through DLAGENTS (download agents) variable looking for protocol
local i
for i in "${DLAGENTS[@]}"; do
local handler="${i%%::*}"
- if [[ $proto = "$handler" ]]; then
+ if string_matches_glob "$proto" "$handler"; then
local agent="${i##*::}"
break
fi
--
1.7.12