diff --git a/src/atest.c b/src/atest.c index c5f4ec5..ae24e8b 100644 --- a/src/atest.c +++ b/src/atest.c @@ -217,7 +217,7 @@ int main (int argc, char *argv[]) } #endif - text_color_init(1); + text_color_init(1, 0); text_color_set(DW_COLOR_INFO); /* diff --git a/src/cm108.c b/src/cm108.c index ff3ff79..7ea1626 100644 --- a/src/cm108.c +++ b/src/cm108.c @@ -113,7 +113,7 @@ int main (void) { - text_color_init (0); // Turn off text color. + text_color_init (0, 0); // Turn off text color. #if defined(__OpenBSD__) || defined(__FreeBSD__) dw_printf ("CM108 PTT support is not available for this operating system.\n"); #else @@ -340,7 +340,7 @@ int main (int argc, char **argv) int num_things; int i; - text_color_init (0); // Turn off text color. + text_color_init (0, 0); // Turn off text color. text_color_set(DW_COLOR_INFO); if (argc >=2) { diff --git a/src/decode_aprs.c b/src/decode_aprs.c index d96274b..5e32896 100644 --- a/src/decode_aprs.c +++ b/src/decode_aprs.c @@ -5330,7 +5330,7 @@ int main (int argc, char *argv[]) } // If you don't like the text colors, use 0 instead of 1 here. - text_color_init(1); + text_color_init(1, 0); text_color_set(DW_COLOR_INFO); while (fgets(stuff, sizeof(stuff), stdin) != NULL) diff --git a/src/direwolf.c b/src/direwolf.c index 4f3c303..b3868db 100644 --- a/src/direwolf.c +++ b/src/direwolf.c @@ -242,6 +242,8 @@ int main (int argc, char *argv[]) char x_opt_mode = ' '; /* "-x N" option for transmitting calibration tones. */ int x_opt_chan = 0; /* Split into 2 parts. Mode e.g. m, a, and optional channel. */ + int O_opt = 0; /* Redirect text io to stderr for use with stdout audio */ + strlcpy(l_opt_logdir, "", sizeof(l_opt_logdir)); strlcpy(L_opt_logfile, "", sizeof(L_opt_logfile)); strlcpy(P_opt, "", sizeof(P_opt)); @@ -270,8 +272,8 @@ int main (int argc, char *argv[]) #endif /* - * Pre-scan the command line options for the text color option. - * We need to set this before any text output. + * Pre-scan the command line options for the text color and stdout redirect options. + * We need to set these 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. */ @@ -286,10 +288,12 @@ int main (int argc, char *argv[]) // FIXME: consider case of no space between t and number. - for (j=1; j MAX_T) { int t; for (t = 0; t <= MAX_T; t++) { - text_color_init (t); + text_color_init (t, redirect_output); printf ("-t %d", t); if (t) printf (" [white background] "); printf ("\n"); @@ -377,7 +383,7 @@ int dw_printf (const char *fmt, ...) // TODO: other possible destinations... - fputs (buffer, stdout); + fputs (buffer, g_dw_printf_dest); return (len); } @@ -387,7 +393,7 @@ int dw_printf (const char *fmt, ...) main () { printf ("Initial condition\n"); - text_color_init (1); + text_color_init (1, 0); printf ("After text_color_init\n"); text_color_set(DW_COLOR_INFO); printf ("Info\n"); text_color_set(DW_COLOR_ERROR); printf ("Error\n"); diff --git a/src/textcolor.h b/src/textcolor.h index 4e38c83..93dfc6b 100644 --- a/src/textcolor.h +++ b/src/textcolor.h @@ -22,7 +22,7 @@ enum dw_color_e { DW_COLOR_INFO, /* black */ typedef enum dw_color_e dw_color_t; -void text_color_init (int enable_color); +void text_color_init (int enable_color, int redirect_output); void text_color_set (dw_color_t c); void text_color_term (void);