`pcscd --debug' prints dark blue lines on my terminal with dark
background, rendering them unreadable.  The daemon has `-T' to enforce
colored output, but no switch to disable colors on TTYs.

Diff below simply removes the detection code, leaving only `-T' in place;
both tested.

Feedback? OK?

If that seems worth it, I can contact upstream in order to fix these
color semantics.


Index: Makefile
===================================================================
RCS file: /cvs/ports/security/pcsc-lite/Makefile,v
retrieving revision 1.47
diff -u -p -r1.47 Makefile
--- Makefile    17 Nov 2019 13:13:15 -0000      1.47
+++ Makefile    24 Jan 2020 23:35:51 -0000
@@ -3,6 +3,7 @@
 COMMENT=       resource manager for PC/SC
 
 V=             1.8.25
+REVISION=      1
 DISTNAME=      pcsc-lite-${V}
 CATEGORIES=    security
 
Index: patches/patch-src_debug_c
===================================================================
RCS file: patches/patch-src_debug_c
diff -N patches/patch-src_debug_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_debug_c   24 Jan 2020 23:34:37 -0000
@@ -0,0 +1,38 @@
+$OpenBSD$
+
+Disable colors by default.
+
+Index: src/debug.c
+--- src/debug.c.orig
++++ src/debug.c
+@@ -75,30 +75,6 @@ static void log_init(void)
+ #endif
+       if (e)
+               LogLevel = atoi(e);
+-
+-      /* log to stderr and stderr is a tty? */
+-      if (isatty(fileno(stderr)))
+-      {
+-              char *term;
+-
+-              term = getenv("TERM");
+-              if (term)
+-              {
+-                      const char *terms[] = { "linux", "xterm", 
"xterm-color", "Eterm", "rxvt", "rxvt-unicode" };
+-                      unsigned int i;
+-
+-                      /* for each known color terminal */
+-                      for (i = 0; i < COUNT_OF(terms); i++)
+-                      {
+-                              /* we found a supported term? */
+-                              if (0 == strcmp(terms[i], term))
+-                              {
+-                                      LogDoColor = 1;
+-                                      break;
+-                              }
+-                      }
+-              }
+-      }
+ } /* log_init */
+ 
+ void log_msg(const int priority, const char *fmt, ...)
Index: patches/patch-src_debuglog_c
===================================================================
RCS file: patches/patch-src_debuglog_c
diff -N patches/patch-src_debuglog_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_debuglog_c        24 Jan 2020 23:34:48 -0000
@@ -0,0 +1,40 @@
+$OpenBSD$
+
+Disable colors by default.
+
+Index: src/debuglog.c
+--- src/debuglog.c.orig
++++ src/debuglog.c
+@@ -255,30 +255,8 @@ void DebugLogSetLogType(const int dbgtype)
+                       LogMsgType = DEBUGLOG_STDOUT_DEBUG;
+       }
+ 
+-      /* log to stdout and stdout is a tty? */
+-      if ((DEBUGLOG_STDOUT_DEBUG == LogMsgType && isatty(fileno(stdout)))
+-              || (DEBUGLOG_STDOUT_COLOR_DEBUG == LogMsgType))
+-      {
+-              char *term;
+-
+-              term = getenv("TERM");
+-              if (term)
+-              {
+-                      const char *terms[] = { "linux", "xterm", 
"xterm-color", "Eterm", "rxvt", "rxvt-unicode", "xterm-256color" };
+-                      unsigned int i;
+-
+-                      /* for each known color terminal */
+-                      for (i = 0; i < COUNT_OF(terms); i++)
+-                      {
+-                              /* we found a supported term? */
+-                              if (0 == strcmp(terms[i], term))
+-                              {
+-                                      LogDoColor = 1;
+-                                      break;
+-                              }
+-                      }
+-              }
+-      }
++      if (DEBUGLOG_STDOUT_COLOR_DEBUG == LogMsgType)
++              LogDoColor = 1;
+ }
+ 
+ void DebugLogSetLevel(const int level)

Reply via email to