From 3e23d5631b7664de5a78aaaac211bff357152c00 Mon Sep 17 00:00:00 2001 From: epoch Date: Mon, 20 Apr 2020 03:15:36 -0500 Subject: uristart.conf-breaking changes by using urimatch instead of matching only on scheme --- uristart | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'uristart') 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 -- cgit v1.2.3