From 9f93d9d578a8a34c695d983f1d0a9d7d140cdf5c Mon Sep 17 00:00:00 2001 From: David Cooper Date: Thu, 30 Mar 2017 12:48:25 -0400 Subject: [PATCH] Move insertion of commas to a separate file Create a separate function to insert the comma separators between findings for different tests within mass testing. --- testssl.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/testssl.sh b/testssl.sh index d009372..4697baa 100755 --- a/testssl.sh +++ b/testssl.sh @@ -956,6 +956,13 @@ fileout_banner() { #fi } +fileout_separator() { + if "$JSONHEADER"; then + "$do_pretty_json" && echo " ," >> "$JSONFILE" + "$do_json" && echo -n "," >> "$JSONFILE" + fi +} + fileout_footer() { if "$JSONHEADER"; then fileout_json_footer @@ -11847,10 +11854,7 @@ run_mass_testing() { cmdline="$0 $global_cmdline --warnings=batch $cmdline" draw_line "=" $((TERM_WIDTH / 2)); outln; outln "$cmdline" - if ! "$first" && "$JSONHEADER"; then - "$do_pretty_json" && echo " ," >> "$JSONFILE" - "$do_json" && echo -n "," >> "$JSONFILE" - fi + "$first" || fileout_separator CHILD_MASS_TESTING=true $cmdline first=false done < "${FNAME}"