]> The Tcpdump Group git mirrors - libpcap/commitdiff
Added 'TRACE_COLOR_GREEN' define for 'bright green'.
authorGisle Vanem <[email protected]>
Wed, 20 Sep 2017 08:50:01 +0000 (08:50 +0000)
committerGuy Harris <[email protected]>
Sat, 23 Sep 2017 07:19:22 +0000 (00:19 -0700)
Added 'TRACE_COLOR_WHITE' define for 'bright white'.
Use a fixed filename "grammar.c" in 'YYFPRINTF()'. Otherwise "y.tab.c" gets printed.

pcap-trace.h

index ff309def4605c16c590256d0339541e1c451d9a3..4a2a0c2bbb323a8a1d1e3ca7ef4063a6419e1d5b 100644 (file)
 /* \todo: Use 'g_cfg.color.file' and 'g_cfg.color.text'
  *        set from %HOME%/wpcap.cfg.
  */
 /* \todo: Use 'g_cfg.color.file' and 'g_cfg.color.text'
  *        set from %HOME%/wpcap.cfg.
  */
+#define TRACE_COLOUR_GREEN (FOREGROUND_INTENSITY | 2)
+#define TRACE_COLOUR_WHITE (FOREGROUND_INTENSITY | 7)
 
 #ifndef TRACE_COLOR_START
 
 #ifndef TRACE_COLOR_START
-#define TRACE_COLOR_START  (FOREGROUND_INTENSITY | 2)  /* bright green */
+#define TRACE_COLOR_START  TRACE_COLOUR_GREEN
 #endif
 
 #ifndef TRACE_COLOR_ARGS
 #endif
 
 #ifndef TRACE_COLOR_ARGS
-#define TRACE_COLOR_ARGS   (FOREGROUND_INTENSITY | 7)  /* bright white */
+#define TRACE_COLOR_ARGS   TRACE_COLOUR_WHITE
 #endif
 
 #ifndef __FILE
 #endif
 
 #ifndef __FILE
    * All in shining colours.
    */
   #undef  YYFPRINTF
    * All in shining colours.
    */
   #undef  YYFPRINTF
-  #define YYFPRINTF(s, fmt, ...)                               \
-          do {                                                 \
-            if (_pcap_trace_level() >= 1) {                    \
-              int add_prefix = !last_fmt ||                    \
-                   (last_fmt[strlen(last_fmt)-1] == '\n');     \
-                                                               \
-              last_fmt = fmt;                                  \
-              if (add_prefix) {                                \
-                _pcap_trace_color (8 | 2);  /* bright green */ \
-                printf ("%s%s(%u): ", TRACE_PREFIX,            \
-                  _pcap_trace_basename(__FILE()), __LINE__);   \
-                _pcap_trace_color (8 | 7);  /* bright white */ \
-                printf (fmt, ## __VA_ARGS__);                  \
-              }                                                \
-              else                                             \
-                printf (fmt, ## __VA_ARGS__);                  \
-              fflush (stdout);                                 \
-              _pcap_trace_color (0);                           \
-            }                                                  \
+  #define YYFPRINTF(stream_ignore, fmt, ...)               \
+          do {                                             \
+            if (_pcap_trace_level() >= 1) {                \
+              int add_prefix = !last_fmt ||                \
+                   (last_fmt[strlen(last_fmt)-1] == '\n'); \
+                                                           \
+              last_fmt = fmt;                              \
+              if (add_prefix) {                            \
+                _pcap_trace_color (TRACE_COLOUR_GREEN);    \
+                printf ("grammar.c(%u): ", __LINE__);      \
+                _pcap_trace_color (TRACE_COLOUR_WHITE);    \
+                printf (fmt, ## __VA_ARGS__);              \
+              }                                            \
+              else                                         \
+                printf (fmt, ## __VA_ARGS__);              \
+              fflush (stdout);                             \
+              _pcap_trace_color (0);                       \
+            }                                              \
           } while (0)
 
 #else
           } while (0)
 
 #else