From owner-dev-commits-ports-all@freebsd.org Wed Sep 8 19:07:16 2021 Return-Path: Delivered-To: dev-commits-ports-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9E89467FF28; Wed, 8 Sep 2021 19:07:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4H4Wpr31Crz3Qtk; Wed, 8 Sep 2021 19:07:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1349E3472; Wed, 8 Sep 2021 19:07:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 188J7F4i075798; Wed, 8 Sep 2021 19:07:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 188J7Fxf075797; Wed, 8 Sep 2021 19:07:15 GMT (envelope-from git) Date: Wed, 8 Sep 2021 19:07:15 GMT Message-Id: <202109081907.188J7Fxf075797@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Tobias Kortkamp Subject: git: efeac961a763 - main - Scripts/split-url.awk: Add reverse function to stitch the URL back together MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tobik X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: efeac961a76331d32a6a0bca7344a99f43d7af67 Auto-Submitted: auto-generated X-BeenThere: dev-commits-ports-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the ports repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 19:07:16 -0000 The branch main has been updated by tobik: URL: https://cgit.FreeBSD.org/ports/commit/?id=efeac961a76331d32a6a0bca7344a99f43d7af67 commit efeac961a76331d32a6a0bca7344a99f43d7af67 Author: Tobias Kortkamp AuthorDate: 2021-09-08 10:11:28 +0000 Commit: Tobias Kortkamp 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]