[openssh-commits] [openssh] 02/02: Convert "have_prog" function into "which".
git+noreply at mindrot.org
git+noreply at mindrot.org
Sat Jul 23 21:17:08 AEST 2022
This is an automated email from the git hooks/post-receive script.
dtucker pushed a commit to branch master
in repository openssh.
commit f69319ad8ad1dd50f90bbcf5912e11cc8ed3e037
Author: Darren Tucker <dtucker at dtucker.net>
Date: Sat Jul 23 14:38:22 2022 +1000
Convert "have_prog" function into "which".
"which" and its behaviour is not standardized, so convert the existing
have_prog function into "which" so we can rely on it being available
and what its semantics are. Add a have_prog wrapper that maintains the
existing behaviour.
---
regress/test-exec.sh | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/regress/test-exec.sh b/regress/test-exec.sh
index 45b11734..d25c330b 100644
--- a/regress/test-exec.sh
+++ b/regress/test-exec.sh
@@ -320,7 +320,7 @@ export SSH_PKCS11_HELPER SSH_SK_HELPER
#echo $SSH $SSHD $SSHAGENT $SSHADD $SSHKEYGEN $SSHKEYSCAN $SFTP $SFTPSERVER $SCP
# Portable specific functions
-have_prog()
+which()
{
saved_IFS="$IFS"
IFS=":"
@@ -328,13 +328,21 @@ have_prog()
do
if [ -x $i/$1 ]; then
IFS="$saved_IFS"
+ echo "$i/$1"
return 0
fi
done
IFS="$saved_IFS"
+ echo "$i/$1"
return 1
}
+have_prog()
+{
+ which "$1" >/dev/null 2>&1
+ return $?
+}
+
jot() {
awk "BEGIN { for (i = $2; i < $2 + $1; i++) { printf \"%d\n\", i } exit }"
}
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list