diff options
Diffstat (limited to 'listamsb.c')
-rw-r--r-- | listamsb.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -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; |