From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 11989 invoked from network); 25 Nov 2020 18:01:15 -0000 Received: from minnie.tuhs.org (45.79.103.53) by inbox.vuxu.org with ESMTPUTF8; 25 Nov 2020 18:01:15 -0000 Received: by minnie.tuhs.org (Postfix, from userid 112) id 00262950A6; Thu, 26 Nov 2020 04:01:11 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id 742ED94858; Thu, 26 Nov 2020 04:00:55 +1000 (AEST) Received: by minnie.tuhs.org (Postfix, from userid 112) id 7819D94858; Thu, 26 Nov 2020 04:00:51 +1000 (AEST) Received: from sdaoden.eu (sdaoden.eu [217.144.132.164]) by minnie.tuhs.org (Postfix) with ESMTPS id 9F292944AE for ; Thu, 26 Nov 2020 04:00:50 +1000 (AEST) Received: by sdaoden.eu (Postfix, from userid 1000) id 7749816057; Wed, 25 Nov 2020 19:00:48 +0100 (CET) Date: Wed, 25 Nov 2020 19:00:48 +0100 From: Steffen Nurpmeso To: Grant Taylor Message-ID: <20201125180048.IvtOI%steffen@sdaoden.eu> In-Reply-To: <9c1595cc-54a1-8af9-0c2d-083cb04dd97c@spamtrap.tnetconsulting.net> References: <9c1595cc-54a1-8af9-0c2d-083cb04dd97c@spamtrap.tnetconsulting.net> Mail-Followup-To: Grant Taylor , cctalk , tuhs@minnie.tuhs.org User-Agent: s-nail v14.9.19-163-g944e9e7a OpenPGP: id=EE19E1C1F2F7054F8D3954D8308964B51883A0DD; url=https://ftp.sdaoden.eu/steffen.asc; preference=signencrypt BlahBlahBlah: Any stupid boy can crush a beetle. But all the professors in the world can make no bugs. Subject: Re: [TUHS] Seeking wisdom from Unix Greybeards X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: cctalk , tuhs@minnie.tuhs.org Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" Grant Taylor wrote in <9c1595cc-54a1-8af9-0c2d-083cb04dd97c@spamtrap.tnetconsulting.net>: |Hi, | |As I find myself starting yet another project that that wants to use |ANSI control sequences for colorization of text, I find myself -- yet |again -- wondering if there is a better way to generate the output from |the code in a way that respects TERMinal capabilites. | |Is there a better / different control sequence that I can ~> should use |for colorizing / stylizing output that will account for the differences |in capabilities between a VT100 and XTerm? | |Can I wrap things that I output so that I don't send color control |sequences to a TERMinal that doesn't support them? color_init() { [ -n "${NOCOLOUR}" ] && return [ -n "${MAILX_CC_TEST_NO_COLOUR}" ] && return # We do not want color for "make test > .LOG"! if (command -v stty && command -v tput) >/dev/null 2>&1 && (<&1 >/dev/null stty -a) 2>/dev/null; then { sgr0=`tput sgr0`; } 2>/dev/null [ $? -eq 0 ] || return { saf1=`tput setaf 1`; } 2>/dev/null [ $? -eq 0 ] || return { saf2=`tput setaf 2`; } 2>/dev/null [ $? -eq 0 ] || return { saf3=`tput setaf 3`; } 2>/dev/null [ $? -eq 0 ] || return { b=`tput bold`; } 2>/dev/null [ $? -eq 0 ] || return COLOR_ERR_ON=${saf1}${b} COLOR_ERR_OFF=${sgr0} COLOR_WARN_ON=${saf3}${b} COLOR_WARN_OFF=${sgr0} COLOR_OK_ON=${saf2} COLOR_OK_OFF=${sgr0} unset saf1 saf2 saf3 b fi } Is what i use for a make system. --steffen | |Der Kragenbaer, The moon bear, |der holt sich munter he cheerfully and one by one |einen nach dem anderen runter wa.ks himself off |(By Robert Gernhardt)