Minor compat.sh clean-up

This commit is contained in:
Manuel Pégourié-Gonnard 2014-02-26 18:21:02 +01:00
parent d701c9aec9
commit 9dea8bd658
2 changed files with 51 additions and 49 deletions

View File

@ -14,55 +14,47 @@ OPENSSL=openssl
FILTER="" FILTER=""
VERBOSE="" VERBOSE=""
# Parse arguments print_usage() {
# echo "Usage: $0"
until [ -z "$1" ] echo -e " -f|--filter\tFilter ciphersuites to test (Default: all)"
do echo -e " -h|--help\t\tPrint this help."
case "$1" in echo -e " -m|--modes\tWhich modes to perform (Default: \"ssl3 tls1 tls1_1 tls1_2\")"
-f|--filter) echo -e " -t|--types\tWhich key exchange type to perform (Default: \"ECDSA RSA PSK\")"
# Filter ciphersuites echo -e " -V|--verify\tWhich verification modes to perform (Default: \"NO YES\")"
shift echo -e " -v|--verbose\t\tSet verbose output."
FILTER=$1 }
;;
-m|--modes) get_options() {
# Perform modes while [ $# -gt 0 ]; do
shift case "$1" in
MODES=$1 -f|--filter)
;; shift; FILTER=$1
-t|--types) ;;
# Key exchange types -m|--modes)
shift shift; MODES=$1
TYPES=$1 ;;
;; -t|--types)
-V|--verify) shift; TYPES=$1
# Verifiction modes ;;
shift -V|--verify)
VERIFIES=$1 shift; VERIFIES=$1
;; ;;
-v|--verbose) -v|--verbose)
# Set verbosity VERBOSE=1
shift ;;
VERBOSE=1 -h|--help)
;; print_usage
-h|--help) exit 0
# print help ;;
echo "Usage: $0" *)
echo -e " -f|--filter\tFilter ciphersuites to test (Default: all)" echo "Unknown argument: '$1'"
echo -e " -h|--help\t\tPrint this help." print_usage
echo -e " -m|--modes\tWhich modes to perform (Default: \"ssl3 tls1 tls1_1 tls1_2\")" exit 1
echo -e " -t|--types\tWhich key exchange type to perform (Default: \"ECDSA RSA PSK\")" ;;
echo -e " -V|--verify\tWhich verification modes to perform (Default: \"NO YES\")" esac
echo -e " -v|--verbose\t\tSet verbose output." shift
exit 1 done
;; }
*)
# print error
echo "Unknown argument: '$1'"
exit 1
;;
esac
shift
done
log() { log() {
if [ "X" != "X$VERBOSE" ]; then if [ "X" != "X$VERBOSE" ]; then
@ -553,6 +545,12 @@ run_client() {
esac esac
} }
#
# MAIN
#
get_options "$@"
killall -q openssl ssl_server ssl_server2 killall -q openssl ssl_server ssl_server2
trap cleanup INT TERM HUP trap cleanup INT TERM HUP

View File

@ -221,6 +221,10 @@ cleanup() {
exit 1 exit 1
} }
#
# MAIN
#
get_options "$@" get_options "$@"
killall -q openssl ssl_server ssl_server2 killall -q openssl ssl_server ssl_server2