remove crude_grep in favor of a simple =~ substring match.

The crude_grep function served only to perform a simple substring check
against the output of openssl -help. So, instead of running the command
each time, iterating its output line by line, and checking for the
substring within it, this simply caches the -help output at startup and
uses $help =~ substring to produce the same result in a single pass.
This commit is contained in:
Richard Soderberg 2015-09-03 06:58:05 -07:00
parent f0142c323a
commit 9a0e055628
1 changed files with 2 additions and 11 deletions

View File

@ -19,6 +19,7 @@ if [[ "$(uname -s)" == "Darwin" ]]; then
else
OPENSSLBIN="${REALPATH}/openssl"
fi
OPENSSLBINHELP="$($OPENSSLBIN s_client -help 2>&1)"
# cipherscan requires bash4, which doesn't come by default in OSX
if [[ ${BASH_VERSINFO[0]} -lt 4 ]]; then
@ -295,18 +296,8 @@ c_hash() {
done
}
crude_grep() {
while read line; do
if [[ $line =~ $1 ]]; then
return 0
fi
done
return 1
}
check_option_support() {
$OPENSSLBIN s_client -help 2>&1 | crude_grep "$1"
return $?
[[ $OPENSSLBINHELP =~ "$1" ]]
}
parse_openssl_output() {