comparison log.c @ 934:252d7a7ee7d5 libavutil

Rename use_ansi_color to use_color so it is not ANSI-specific.
author ramiro
date Wed, 09 Jun 2010 18:07:44 +0000
parents d45ace227adf
children 096294624d52
comparison
equal deleted inserted replaced
933:93bd29f34e99 934:252d7a7ee7d5
32 #if LIBAVUTIL_VERSION_MAJOR > 50 32 #if LIBAVUTIL_VERSION_MAJOR > 50
33 static 33 static
34 #endif 34 #endif
35 int av_log_level = AV_LOG_INFO; 35 int av_log_level = AV_LOG_INFO;
36 36
37 static int use_ansi_color=-1; 37 static int use_color=-1;
38 38
39 #undef fprintf 39 #undef fprintf
40 static void colored_fputs(int color, const char *str){ 40 static void colored_fputs(int color, const char *str){
41 if(use_ansi_color<0){ 41 if(use_color<0){
42 #if HAVE_ISATTY && !defined(_WIN32) 42 #if HAVE_ISATTY && !defined(_WIN32)
43 use_ansi_color= getenv("TERM") && !getenv("NO_COLOR") && isatty(2); 43 use_color= getenv("TERM") && !getenv("NO_COLOR") && isatty(2);
44 #else 44 #else
45 use_ansi_color= 0; 45 use_color= 0;
46 #endif 46 #endif
47 } 47 }
48 48
49 if(use_ansi_color){ 49 if(use_color){
50 fprintf(stderr, "\033[%d;3%dm", color>>4, color&15); 50 fprintf(stderr, "\033[%d;3%dm", color>>4, color&15);
51 } 51 }
52 fputs(str, stderr); 52 fputs(str, stderr);
53 if(use_ansi_color){ 53 if(use_color){
54 fprintf(stderr, "\033[0m"); 54 fprintf(stderr, "\033[0m");
55 } 55 }
56 } 56 }
57 57
58 const char* av_default_item_name(void* ptr){ 58 const char* av_default_item_name(void* ptr){