aboutsummaryrefslogtreecommitdiff
path: root/listamsb.c
diff options
context:
space:
mode:
Diffstat (limited to 'listamsb.c')
-rw-r--r--listamsb.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/listamsb.c b/listamsb.c
index a14c336..3815db2 100644
--- a/listamsb.c
+++ b/listamsb.c
@@ -79,6 +79,8 @@
from this (except the 3-byte header) */
#define UNLOCK_KEY 0x54
+#define ENV_VAR "COLORIZE_AMSB"
+
const char *self;
atascii_ctx actx;
@@ -965,13 +967,15 @@ void open_output() {
verbose(1, "using stdout for output");
} else {
if(color) {
- verbose(1, "using pipe for output: %s", "colorize-amsb");
- outfile = popen("colorize-amsb", "w"); /* "wb" not allowed! */
+ char *exe = getenv(ENV_VAR);
+ if(!exe) exe = "colorize-amsb";
+ verbose(1, "using pipe for output: %s", exe);
+ outfile = popen(exe, "w"); /* "wb" not allowed! */
/* we probably never see this error. popen() fails only if
we feed it an invalid mode, or if fork() or pipe() fails,
or I suppose if some idjit has done a "rm -f /bin/sh"...
all other errors are caught at pclose(). */
- if(!outfile) os_err("|%s: %s", "colorize-amsb", strerror(errno));
+ if(!outfile) os_err("|%s: %s", exe, strerror(errno));
need_pclose = 1;
} else {
outfile = stdout;