summaryrefslogtreecommitdiff
path: root/uristart
diff options
context:
space:
mode:
authorepoch <epoch@thebackupbox.net>2020-04-20 03:15:36 -0500
committerepoch <epoch@thebackupbox.net>2020-04-20 03:15:36 -0500
commit3e23d5631b7664de5a78aaaac211bff357152c00 (patch)
tree8c3c80760e0f122a56c8835923cba739f8674a81 /uristart
parentba14e2682f947c2dff57a3d8aaf754a9a00e246b (diff)
downloaduritools-3e23d5631b7664de5a78aaaac211bff357152c00.tar.gz
uritools-3e23d5631b7664de5a78aaaac211bff357152c00.zip
uristart.conf-breaking changes by using urimatch instead of matching only on scheme
Diffstat (limited to 'uristart')
-rwxr-xr-xuristart24
1 files changed, 23 insertions, 1 deletions
diff --git a/uristart b/uristart
index 4e97633..d36764f 100755
--- a/uristart
+++ b/uristart
@@ -17,7 +17,29 @@ fi
uri="${1}"
scheme="$(printf "%s\n" "$uri" | uricut -s)"
-line="$(grep "^${scheme}:" ~/.config/uristart.conf | cut -d: -f2- | sed 's/^[ \t]*//g' | sed 's/\\/\\\\/g')"
+#line="$(grep "^${scheme}:" ~/.config/uristart.conf | cut -d: -f2- | sed 's/^[ \t]*//g' | sed 's/\\/\\\\/g')"
+
+line="$(
+cat ~/.config/uristart.conf \
+ | while read -r l;do
+ uritmp="$uri"
+ uritmp="$(printf "%s\n" "$l" \
+ | cut -d: -f1 \
+ | tr ' ' '\n' \
+ | paste '-d ' - - \
+ | while read -r a b;do
+ uritmp="$(printf "%s\n" "${uritmp}" | urimatch "$a" "$b")"
+ printf "%s\n" "$uritmp"
+ done | tail -n1)"
+ if [ "$uritmp" ];then
+ printf '%s\n' "$l"
+ break
+ fi
+ done \
+ | cut -d: -f2- \
+ | sed 's/^[ \t]*//g' \
+ | sed 's/\\/\\\\/g'
+)"
### if we do not have a port, we are going to try to get it from their srv records.
if printf "%s\n" "$uri" | urimatch nP >/dev/null;then