From ca7db91da21e2f4e3fcf7e4ac65b37fa7cfe276b Mon Sep 17 00:00:00 2001 From: wb2osz Date: Sat, 6 Jul 2019 20:34:51 -0400 Subject: [PATCH] Text color improvements. --- CHANGES.md | 4 ++++ direwolf.c | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index d1ff7b3..23ead58 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -13,6 +13,10 @@ ### New Features: ### + +- "-t" option now accepts more values to accommodate inconsistent handling of text color control codes by different terminal emulators. The default, 1, should work with most modern terminal types. If the colors are not right, try "-t 9" to see the result of the different choices and pick the best one. If none of them look right, file a bug report and specify: operating system version (e.g. Raspbian Buster), terminal emulator type and version (e.g. LXTerminal 0.3.2). Include a screen capture. + + - "-g" option to force G3RUH mode for lower speeds where a different modem type may be the default. - 2400 bps compatibility with MFJ-2400. See ***2400-4800-PSK-for-APRS-Packet-Radio.pdf*** for details diff --git a/direwolf.c b/direwolf.c index b696baa..a29bd18 100644 --- a/direwolf.c +++ b/direwolf.c @@ -248,10 +248,14 @@ int main (int argc, char *argv[]) /* * Pre-scan the command line options for the text color option. * We need to set this before any text output. + * Default will be no colors if stdout is not a terminal (i.e. piped into + * something else such as "tee") but command line can override this. */ - t_opt = 1; /* 1 = normal, 0 = no text colors. */ + t_opt = isatty(fileno(stdout)); + /* 1 = normal, 0 = no text colors. */ /* 2, 3, ... alternate escape sequences for different terminals. */ + for (j=1; j