summaryrefslogtreecommitdiff
path: root/uristart
diff options
context:
space:
mode:
Diffstat (limited to 'uristart')
-rwxr-xr-xuristart27
1 files changed, 3 insertions, 24 deletions
diff --git a/uristart b/uristart
index d36764f..17a5af9 100755
--- a/uristart
+++ b/uristart
@@ -17,29 +17,8 @@ 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="$(
-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'
-)"
+line="$(urigetline "$uri")"
### 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
@@ -49,7 +28,7 @@ if printf "%s\n" "$uri" | urimatch nP >/dev/null;then
fi
uri="$(cat <(printf "%s\n" "$uri" | uricut) \
<(getsrv $(printf "%s\n" "$uri" | uriprintf '%s '"$proto"' %d' | cut -d+ -f2-) 2>&- | tr ':' ' ' | sed 's/ /_port: /' | sed 's/^/domain: /' | tr _ '\n') \
- | urijoin)"
+ | urijoin 2>/dev/null)"
printf "srv (%s) modified uri: %s\n" "$proto" "$uri" >&2
fi
@@ -57,7 +36,7 @@ fi
if printf "%s\n" "$uri" | urimatch nP >/dev/null;then #if we *still* don't have a port
uri="$(cat <(printf "%s\n" "$uri" | uricut) \
<(grep ^"$scheme"'[\t ]' /etc/services | tr -s '\t ' | cut -f2 | cut -d/ -f1 | head -n1 | sed 's/^/port: /') \
- | urijoin)"
+ | urijoin 2>/dev/null)"
printf "getent modified uri: %s\n" "$uri" >&2
fi