aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2010-12-08 01:16:01 +0000
committerMike Frysinger <vapier@gentoo.org>2010-12-08 01:16:01 +0000
commit4f205d1636b75df36cd24e8d85a51c0254d0df42 (patch)
tree9671658237e4ecb39f83880bfca28c10732af82e /pspax.c
parentchange to simpler const argv0 string (diff)
downloadpax-utils-4f205d1636b75df36cd24e8d85a51c0254d0df42.tar.gz
pax-utils-4f205d1636b75df36cd24e8d85a51c0254d0df42.tar.bz2
pax-utils-4f205d1636b75df36cd24e8d85a51c0254d0df42.zip
add a -C/--nocolor option and respect env $NOCOLOR #332289
Diffstat (limited to 'pspax.c')
-rw-r--r--pspax.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/pspax.c b/pspax.c
index 8aad5d0..a6839f7 100644
--- a/pspax.c
+++ b/pspax.c
@@ -12,7 +12,7 @@
* cc -o pspax pspax.c -DWANT_SYSCAP -lcap
*/
-static const char *rcsid = "$Id: pspax.c,v 1.47 2010/12/08 00:54:40 vapier Exp $";
+static const char *rcsid = "$Id: pspax.c,v 1.48 2010/12/08 01:16:01 vapier Exp $";
const char argv0[] = "pspax";
#include "paxinc.h"
@@ -416,7 +416,7 @@ static void pspax(const char *find_name)
}
/* usage / invocation handling functions */
-#define PARSE_FLAGS "aeip:u:g:nwWvBhV"
+#define PARSE_FLAGS "aeip:u:g:nwWvCBhV"
#define a_argument required_argument
static struct option const long_opts[] = {
{"all", no_argument, NULL, 'a'},
@@ -429,6 +429,7 @@ static struct option const long_opts[] = {
{"wx", no_argument, NULL, 'w'},
{"wide", no_argument, NULL, 'W'},
{"verbose", no_argument, NULL, 'v'},
+ {"nocolor", no_argument, NULL, 'C'},
{"nobanner", no_argument, NULL, 'B'},
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'V'},
@@ -446,6 +447,7 @@ static const char *opts_help[] = {
"Only display w|x processes",
"Wide output display of cmdline",
"Be verbose about executable mappings",
+ "Don't emit color in output",
"Don't display the header",
"Print this help and exit",
"Print version and exit",
@@ -489,6 +491,7 @@ static void parseargs(int argc, char *argv[])
break;
case 'h': usage(EXIT_SUCCESS); break;
+ case 'C': color_init(true); break;
case 'B': show_banner = 0; break;
case 'a': show_all = 1; break;
case 'e': show_phdr = 1; break;
@@ -534,6 +537,7 @@ int main(int argc, char *argv[])
{
char *name = NULL;
+ color_init(false);
parseargs(argc, argv);
if ((optind < argc) && (show_pid == 0))