diff options
author | epoch <epoch@thebackupbox.net> | 2020-04-20 03:33:21 -0500 |
---|---|---|
committer | epoch <epoch@thebackupbox.net> | 2020-04-20 03:33:21 -0500 |
commit | 8ec0b3da94b3bbc18140bdea22488d51676d2634 (patch) | |
tree | 1aeb045d712767b117bea412e65348897eefa0e5 /uristart | |
parent | 3e23d5631b7664de5a78aaaac211bff357152c00 (diff) | |
download | uritools-8ec0b3da94b3bbc18140bdea22488d51676d2634.tar.gz uritools-8ec0b3da94b3bbc18140bdea22488d51676d2634.zip |
more of the breaking-change. code to get the line moved to external program so it can be rewritten easier. copy_start_nevermind.sh uses it now. cleaned up Makefile styling.
Diffstat (limited to 'uristart')
-rwxr-xr-x | uristart | 27 |
1 files changed, 3 insertions, 24 deletions
@@ -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 |