Changeset 642

Show
Ignore:
Timestamp:
09/14/06 00:20:40 (2 years ago)
Author:
dp
Message:

prevent colored output if stdout is not attached to a terminal(-emulator)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • tools/bdiffm/bdiffm.c

    r641 r642  
    3838void pcolor(uint32_t c) 
    3939{ 
    40         if( c == CL_RESET ) 
    41                 printf("\033[0m"); 
    42         else 
    43                 printf("\033[%d;1m", c); 
     40        if( isatty(STDOUT_FILENO) ) 
     41        { 
     42                if( c == CL_RESET ) 
     43                        printf("\033[0m"); 
     44                else 
     45                        printf("\033[%d;1m", c); 
     46        } 
    4447} 
    4548