Wireshark-commits: [Wireshark-commits] master 505c318: Clean up color handling.

From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Wed, 03 Apr 2019 05:59:57 +0000
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=505c3187a4fd33803edc55e345ec65a5ebff3754
Submitter: "Guy Harris <guy@xxxxxxxxxxxx>"
Changed: branch: master
Repository: wireshark

Commits:

505c318 by Guy Harris (guy@xxxxxxxxxxxx):

    Clean up color handling.
    
    For Windows:
    
    Don't use ws_isatty() - which is a wrapper around _isatty() - to
    determine whether the output is to a Windows console or not; it returns
    a non-zero value for *any* character device, not just a console.
    Instead, use a console API; if it succeeds, it's a console, otherwise it
    isn't.
    
    If we're writing to a console, and the
    ENABLE_VIRTUAL_TERMINAL_PROCESSING flag is set, or it isn't set but we
    can set it, assume the console supports the escape sequences that
    request 24-bit color, and use them.
    
    For UN*X:
    
    We can isatty() to determine if the output is to a terminal, as it
    doesn't check for character special files, it specifically checks for
    terminals (which, in practice, means "device that supports one of the
    ioctls to get terminal modes" in most if not all cases; that covers
    serial lines, pseudo-ttys, and perhaps some other devices).
    
    Only use the 24-bit color escape sequences if the COLORTERM environment
    variable is set to "truecolor" or "24bit".
    
    Bug: 15659
    Change-Id: I673667b86bd6b2ab48c06e00ed16b537d6723453
    Reviewed-on: https://code.wireshark.org/review/32689
    Petri-Dish: Guy Harris <guy@xxxxxxxxxxxx>
    Tested-by: Petri Dish Buildbot
    Reviewed-by: Guy Harris <guy@xxxxxxxxxxxx>
    

Actions performed:

    from  c1e404a   Test: Disable compilation warnings.
     add  505c318   Clean up color handling.


Summary of changes:
 epan/print_stream.c | 369 +++++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 276 insertions(+), 93 deletions(-)