aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2021-02-23 13:35:43 +0000
committermerakor <cem@ckyln.com>2021-02-23 13:35:43 +0000
commitae36bb5fa6bc346bf7c39b73648ac689bf2cfdb4 (patch)
tree9915b9ea9f28b3a25e1fbc47aa5f73c4013b2993
parent4ad8a8fe29a21f2d417e5046d3ebe50757eedeb4 (diff)
downloadcpt-ae36bb5fa6bc346bf7c39b73648ac689bf2cfdb4.tar.gz
pkg_get_base(): use for loop instead of while loop
FossilOrigin-Name: 3b5c37511a3cc0e5164844a08e64af2b8e39f578e8d31e23f3d5c183ecefa40d
-rw-r--r--src/cpt-lib.in10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/cpt-lib.in b/src/cpt-lib.in
index 692b9b5..a978ebd 100644
--- a/src/cpt-lib.in
+++ b/src/cpt-lib.in
@@ -1868,12 +1868,10 @@ pkg_get_base() (
while read -r pkgname _; do
[ "${pkgname##\#*}" ] || continue
set -- "$@" "$pkgname"
- while read -r dep; do
- contains "$*" "$dep" && continue
- set -- "$@" "$dep"
- done <<EOF
-$(pkg_gentree "$pkgname" x)
-EOF
+ deps=$(pkg_gentree "$pkgname" xn)
+ for dep in $deps; do
+ contains "$*" "$dep" || set -- "$@" "$dep"
+ done
done < "$CPT_ROOT/etc/cpt-base"
if [ "$nonl" ]; then printf '%s ' "$@"; else printf '%s\n' "$@"; fi
)