From e2161aef5ef85af4f57e52e26feefd22add28b85 Mon Sep 17 00:00:00 2001 From: David Cooper Date: Tue, 14 Feb 2017 10:04:42 -0500 Subject: [PATCH] Rearrange code Just a slight rearrangement of the code in order to remove some redundancy. --- testssl.sh | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/testssl.sh b/testssl.sh index 8eaafa0..5d92727 100755 --- a/testssl.sh +++ b/testssl.sh @@ -5013,24 +5013,15 @@ run_server_preference() { for i in 1 2 3 4 5 6; do if [[ -n "${cipher[i]}" ]]; then # cipher not empty - if [[ -z "$prev_cipher" ]]; then # previous one empty - #outln + if [[ -z "$prev_cipher" ]] || [[ "$prev_cipher" != "${cipher[i]}" ]]; then + [[ -n "$prev_cipher" ]] && outln if [[ -z "$SHOW_RFC" ]]; then printf -- " %-30s %s" "${cipher[i]}:" "${proto[i]}" # print out both else printf -- " %-51s %s" "${cipher[i]}:" "${proto[i]}" # print out both fi - else # previous NOT empty - if [[ "$prev_cipher" == "${cipher[i]}" ]]; then # and previous protocol same cipher - out ", ${proto[i]}" # same cipher --> only print out protocol behind it - else - outln - if [[ -z "$SHOW_RFC" ]]; then - printf -- " %-30s %s" "${cipher[i]}:" "${proto[i]}" # print out both - else - printf -- " %-51s %s" "${cipher[i]}:" "${proto[i]}" # print out both - fi - fi + else + out ", ${proto[i]}" # same cipher --> only print out protocol behind it fi prev_cipher="${cipher[i]}" fi