Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/freebsd/poudriere.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBryan Drewery <bryan@shatow.net>2019-12-09 22:19:33 +0300
committerBryan Drewery <bryan@shatow.net>2019-12-09 22:20:58 +0300
commitad8623e34bb641664f8748092d31c0473f217e4f (patch)
treeb495dab0ea3dd8ad1283c86446c5ac87ad848821 /src
parent2dd8df705356267b07ffb438b5b91e0a58037693 (diff)
relpath: Adopt dteske's API
Diffstat (limited to 'src')
-rw-r--r--src/share/poudriere/include/util.sh13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/share/poudriere/include/util.sh b/src/share/poudriere/include/util.sh
index de33e358..9db1cc34 100644
--- a/src/share/poudriere/include/util.sh
+++ b/src/share/poudriere/include/util.sh
@@ -162,9 +162,10 @@ relpath_common() {
# Given 2 paths, return the relative path from the 2nd to the first
_relpath() {
local -; set +x -f
- [ $# -eq 2 ] || eargs _relpath dir1 dir2
+ [ $# -eq 2 -o $# -eq 3 ] || eargs _relpath dir1 dir2 [var_return]
local dir1="$1"
local dir2="$2"
+ local var_return="${3:-_relpath}"
local _relpath_common _relpath_common_dir1 _relpath_common_dir2
local newpath IFS
@@ -189,19 +190,21 @@ _relpath() {
done
fi
- _relpath="${newpath}"
+ setvar "${var_return}" "${newpath}"
}
# See _relpath
relpath() {
local -; set +x
- [ $# -eq 2 ] || eargs relpath dir1 dir2
+ [ $# -eq 2 -o $# -eq 3 ] || eargs relpath dir1 dir2 [var_return]
local dir1="$1"
local dir2="$2"
local _relpath
- _relpath "${dir1}" "${dir2}"
- echo "${_relpath}"
+ _relpath "$@"
+ if [ $# -ne 3 ]; then
+ echo "${_relpath}"
+ fi
}
if [ "$(type trap_push 2>/dev/null)" != "trap_push is a shell builtin" ]; then