{ "dyninst", 0, NULL, LONG_OPT_RUNTIME_DYNINST },
{ "benchmark-sdt-loops", 1, NULL, LONG_OPT_BENCHMARK_SDT_LOOPS },
{ "benchmark-sdt-threads", 1, NULL, LONG_OPT_BENCHMARK_SDT_THREADS },
+ { "color", 2, NULL, LONG_OPT_COLOR_ERRS },
+ { "colour", 2, NULL, LONG_OPT_COLOR_ERRS },
{ NULL, 0, NULL, 0 }
};
LONG_OPT_RUNTIME_DYNINST,
LONG_OPT_BENCHMARK_SDT_LOOPS,
LONG_OPT_BENCHMARK_SDT_THREADS,
+ LONG_OPT_COLOR_ERRS,
};
// NB: when adding new options, consider very carefully whether they
cleanup manually and then exit. See the CACHING section for more details about
cache limits.
+.TP
+\fB\-\-color\fR[=\fIWHEN\fR], \fB\-\-colour\fR[=\fIWHEN\fR]
+This option enables colored error messages, which is turned off by default.
+WHEN can be either 'never', 'always', or 'auto' (i.e. enable only if at a
+terminal). Defaults to 'auto' if not specified.
+
.TP
.BI \-\-disable\-cache
This option disables all use of the cache directory. No files will be either
sysroot = "";
update_release_sysroot = false;
suppress_time_limits = false;
+ color_errors = false;
// PR12443: put compiled-in / -I paths in front, to be preferred during
// tapset duplicate-file elimination
update_release_sysroot = other.update_release_sysroot;
sysenv = other.sysenv;
suppress_time_limits = other.suppress_time_limits;
+ color_errors = other.color_errors;
include_path = other.include_path;
runtime_path = other.runtime_path;
benchmark_sdt_threads = strtoul(optarg, NULL, 10);
break;
+ case LONG_OPT_COLOR_ERRS:
+ if (optarg && strcmp(optarg, "auto")
+ && strcmp(optarg, "never")
+ && strcmp(optarg, "always")) {
+ cerr << _F("Invalid argument '%s' for --color.", optarg) << endl;
+ return 1;
+ }
+ // --color without arg is equivalent to auto
+ color_errors = ((optarg && !strcmp(optarg, "always"))
+ || ((!optarg || !strcmp(optarg, "auto")) && isatty(STDERR_FILENO)));
+ break;
+
case '?':
// Invalid/unrecognized option given or argument required, but
// not given. In both cases getopt_long() will have printed the
int download_dbinfo;
bool suppress_handler_errors;
bool suppress_time_limits;
+ bool color_errors;
enum { kernel_runtime, dyninst_runtime } runtime_mode;
bool runtime_usermode_p() const { return runtime_mode == dyninst_runtime; }