diff --git a/NEWS b/NEWS index bff500f5..cbd3f199 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,7 @@ User visible changes for UPX Changes in 4.2.0 (XX XXX 2023): * bug fixes - see https://github.com/upx/upx/milestone/13 + * add support for NO_COLOR env var; see https://no-color.org/ Changes in 4.1.0 (08 Aug 2023): * ELF: handle shared libraries with more than 2 PT_LOAD segments diff --git a/src/options.cpp b/src/options.cpp index f29bb170..41ea2579 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -53,6 +53,7 @@ void Options::reset() noexcept { o->preserve_mode = true; o->preserve_ownership = true; o->preserve_timestamp = true; + o->verbose = 2; o->console = CON_FILE; #if (ACC_OS_DOS32) && defined(__DJGPP__) @@ -62,7 +63,11 @@ void Options::reset() noexcept { #elif 1 && defined(__linux__) o->console = CON_INIT; #endif - o->verbose = 2; + // support NO_COLOR, see https://no-color.org/ + // "... when present and not an empty string (regardless of its value)" + const char *e = getenv("NO_COLOR"); + if (e && e[0]) + o->console = CON_FILE; o->o_unix.osabi0 = 3; // 3 == ELFOSABI_LINUX