[FFmpeg-devel] [PATCH] add colours to warnings and errors

Michael Niedermayer michaelni
Thu Apr 22 09:32:03 CEST 2010


On Thu, Apr 22, 2010 at 02:31:12AM +0200, James Darnley wrote:
> On 22 April 2010 01:12, Michael Niedermayer <michaelni at gmx.at> wrote:
> > the idea is good, your implementation is not
> >
> > it should be looking something like
> >
> > ff_set_console_color(int fd, int color){
> > #if HAVE_ISATTY
> > ? ?if (isatty(fd))
> > ? ? ? ?fprintf( fd, "\033[...
> > #endif
> > }
> 
> That doesn't sound very easy to use on Windows because you need a
> console handle and then you need to store the the original colours so
> you can restore them.

colored_fprintf(FILE *f, int color,  const char *fmt, ...){
#if HAVE_ISATTY
    int fn= fileno(f);
    if (isatty(fn))
        fprintf( f, "\033[...
    fprintf(f, fmt, ...
    if (isatty(fn))
        fprintf( f, "\033[reset
#elif HAVE_?
    ...
#else
    fprintf(f, fmt, ...
#endif
}

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I hate to see young programmers poisoned by the kind of thinking
Ulrich Drepper puts forward since it is simply too narrow -- Roman Shaposhnik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100422/929e6053/attachment.pgp>



More information about the ffmpeg-devel mailing list