[FFmpeg-devel] [PATCHv2] configure: colorize warning messages

Ganesh Ajjanagadde gajjanag at mit.edu
Fri Aug 28 16:40:20 CEST 2015


On Fri, Aug 28, 2015 at 8:36 AM, Clément Bœsch <u at pkh.me> wrote:
> On Thu, Aug 27, 2015 at 11:33:52PM -0400, Ganesh Ajjanagadde wrote:
>> This patch introduces color warning messages (yellow).
>> They are enabled whenever available.
>> Tested with zsh, bash, and sh (bash under --posix).
>>
>> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
>> ---
>>  configure | 9 ++++++++-
>>  1 file changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/configure b/configure
>> index 5913090..4f712c1 100755
>> --- a/configure
>> +++ b/configure
>> @@ -416,6 +416,13 @@ EOF
>>  }
>>
>>  quotes='""'
>> +if test -t 1; then
>> +    ncolors=$(tput colors)
>> +    if test -n "$ncolors" && test $ncolors -ge 8; then
>> +        warn_color=$'\033[33;1m'
>> +        reset_color=$'\033[0m'
>> +    fi
>> +fi
>>
>>  log(){
>>      echo "$@" >> $logfile
>> @@ -6201,7 +6208,7 @@ echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
>>  cp_if_changed $TMPH libavutil/avconfig.h
>>
>>  if test -n "$WARNINGS"; then
>> -    printf "\n$WARNINGS"
>> +    printf "\n%s$WARNINGS%s" "$warn_color" "$reset_color"
>>      enabled fatal_warnings && exit 1
>>  fi
>>
>
> Aren't you supposed to use tput(1) for maximum compatibility?

Ah, you mean for the color definitions I guess.
I thought the color escape codes were an ASCII standard.
Anyway, I have created a new patch doing this.

>
> --
> Clément B.
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


More information about the ffmpeg-devel mailing list