diff options
author | B. Watson <urchlay@slackware.uk> | 2025-04-02 03:26:42 -0400 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2025-04-02 03:26:42 -0400 |
commit | 459efec37dd964944b7df6bf74f07652ba136343 (patch) | |
tree | 0e4c5d388578ec32318ad4304cb1134357a7096f /listamsb.c | |
parent | 8749c05485753ae501b5617012bba4ab94c5a0c2 (diff) | |
download | bw-atari8-tools-459efec37dd964944b7df6bf74f07652ba136343.tar.gz |
listamsb: support COLORIZE_AMSB environment var.
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; |