From f7cc8108d0c063e73ed9e9812008c68fa35a7545 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 16 Sep 2026 09:02:59 -0700 Subject: [PATCH] Remove remaining color functions This commit removes definitions for "yellow," "brown," and "off," which are no longer used now that emphasize_stuff_in_headers() has been rewritten. --- testssl.sh | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/testssl.sh b/testssl.sh index a967aa3..dbfecad 100755 --- a/testssl.sh +++ b/testssl.sh @@ -770,47 +770,13 @@ prln_fixme() { prln_warning "Fixme: $1"; } pr_url() { tm_out "$1"; html_out "$(html_reserved "$1")"; } pr_boldurl() { tm_bold "$1"; html_out "$(html_reserved "$1")"; } -### color switcher (see e.g. https://linuxtidbits.wordpress.com/2008/08/11/output-color-on-bash-scripts/ -### https://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x405.html -### no output support for HTML! -### NOTE: These color functions (brown, yellow, off) are used in emphasize_stuff_in_headers(), but should -### generally be avoided, Functions such as pr_svrty_low() and pr_svrty_medium() should be used instead, as -### they handle both terminal and HTML output. set_color_functions() { - local ncurses_tput=true - if [[ $SYSTEM == OpenBSD ]] && [[ "$TERM" =~ xterm-256 ]]; then export TERM=xterm # OpenBSD can't handle 256 colors (yet) in xterm which might lead to ugly errors # like "tput: not enough arguments (3) for capability `AF'". Not our fault but # before we get blamed we fix it here. fi - - # Empty all vars if we have COLOR=0 equals no escape code -- these are globals: - brown="" - yellow="" - off="" - - type -p tput &>/dev/null || return 0 # Hey wait, do we actually have tput / ncurses ? - tput cols &>/dev/null || return 0 # tput under BSDs and GNUs doesn't work either (TERM undefined?) - tput sgr0 &>/dev/null || ncurses_tput=false - if [[ "$COLOR" -ge 2 ]]; then - if $ncurses_tput; then - brown=$(tput setaf 3) - yellow=$(tput setaf 3; tput bold) - else # this is a try for old BSD, see terminfo(5) - brown=$(tput AF 3) - yellow=$(tput AF 3; tput md) - fi - fi - if [[ "$COLOR" -ge 1 ]]; then - if $ncurses_tput; then - off=$(tput sgr0) - else # this is a try for old BSD, see terminfo(5) - off=$(tput me) - fi - fi - # FreeBSD 10 understands ESC codes like 'echo -e "\e[3mfoobar\e[23m"', but also no tput for italics } ###### START universal helper function definitions ######