[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [rfc] Colorized output for GNU make?
From: |
Sebastian Pipping |
Subject: |
Re: [rfc] Colorized output for GNU make? |
Date: |
Thu, 05 Jan 2012 22:35:15 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111118 Thunderbird/8.0 |
On 01/05/2012 09:20 PM, Paul Smith wrote:
> What I mean is, instead of voutputf() invoking multiple calls to
> fprintf(), we'd need to compute all the strings we needed then invoke a
> single fprintf() for each output style where the format string was
> translated, something like this:
>
> if (flocp && flocp->filenm)
> fprintf (target, _("%s:%lu: %s%s"), flocp->filenm, flocp->lineno,
> catchy, output);
> else if (makelevel == 0)
> fprintf (target, _("%s: %s%s"), program, catchy, output);
>
> etc. Of course we'd need to use vsprintf() or something to turn the
> va_list into the "output" string. Now a translator can take that format
> string and convert it so that things are generated in a different order
> if necessary.
Function vsnprintf could be used to fill variable "output".
Quoting the local printf(3) man page:
[..]
int vsnprintf(char *str, size_t size, const char *format, va_list ap);
[..]
Feature Test Macro Requirements for glibc
(see feature_test_macros(7)):
snprintf(), vsnprintf():
_BSD_SOURCE || _XOPEN_SOURCE >= 500 || _ISOC99_SOURCE \
|| _POSIX_C_SOURCE >= 200112L;
or cc -std=c99
Is use of that function acceptable?
> The other thing I wonder about is the hardcoding of ASCII colorized
> strings
There have to be defaults somewhere in there. Or not?
> and the start/stop character strings (\033[...). Are there
> other methods of colorizing?
As of now I don't know any other.
> Should we try to support them? Maybe it's
> not worthwhile to try to support generic methods when we have no idea if
> they're useful. We can always make changes needed to support them
> later.
Thanks.
Best,
Sebastian
- Re: [rfc] Colorized output for GNU make?, (continued)
- Re: [rfc] Colorized output for GNU make?,
Sebastian Pipping <=
- Re: [rfc] Colorized output for GNU make?, Paul Smith, 2012/01/05
- Re: [rfc] Colorized output for GNU make?, Sebastian Pipping, 2012/01/05
- Re: [rfc] Colorized output for GNU make?, Sebastian Pipping, 2012/01/13
- Re: [rfc] Colorized output for GNU make?, Paul Smith, 2012/01/14