Date: Wed, 8 Sep 2021 19:07:15 GMT From: Tobias Kortkamp <tobik@FreeBSD.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org Subject: git: efeac961a763 - main - Scripts/split-url.awk: Add reverse function to stitch the URL back together Message-ID: <202109081907.188J7Fxf075797@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by tobik: URL: https://cgit.FreeBSD.org/ports/commit/?id=efeac961a76331d32a6a0bca7344a99f43d7af67 commit efeac961a76331d32a6a0bca7344a99f43d7af67 Author: Tobias Kortkamp <tobik@FreeBSD.org> AuthorDate: 2021-09-08 10:11:28 +0000 Commit: Tobias Kortkamp <tobik@FreeBSD.org> CommitDate: 2021-09-08 19:05:18 +0000 Scripts/split-url.awk: Add reverse function to stitch the URL back together --- Mk/Scripts/split-url.awk | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/Mk/Scripts/split-url.awk b/Mk/Scripts/split-url.awk index f62af4219ad6..8efc1b9c002a 100644 --- a/Mk/Scripts/split-url.awk +++ b/Mk/Scripts/split-url.awk @@ -1,3 +1,35 @@ +function join_url( s, query_keys, i) { + s = url["scheme"] "://" + if (url["user"]) { + s = s url["user"] + if (url["password"]) { + s = s ":" url["password"] + } + s = s "@" + } + s = s url["host"] + if (url["port"]) { + s = s ":" url["port"] + } + if (url["path"]) { + s = s url["path"] + } + if (url["query"]) { + split(url["query"], query_keys) + s = s "?" + for (i = 1; i <= length(query_keys); i++) { + s = s query_keys[i] "=" url["query", query_keys[i]] + if (i != length(query_keys)) { + s = s ";" + } + } + } + if (url["fragment"]) { + s = s "#" url["fragment"] + } + return s +} + function split_url(s, url_scheme, url_fragment, url_query, url_query_parts, i, url_query_part, url_authority, url_auth, url_user, url_host) { delete url # scheme:[//[user[:password]@]host[:port]][/path][?query][#fragment]
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109081907.188J7Fxf075797>