]> granicus.if.org Git - procps-ng/commitdiff
Improve trace().
authorRafael Kitover <rkitover@gmail.com>
Fri, 15 Oct 2021 04:40:03 +0000 (04:40 +0000)
committerCraig Small <csmall@dropbear.xyz>
Thu, 1 Sep 2022 22:44:05 +0000 (22:44 +0000)
Turn on trace() with the TRACE macro and remove the ## token paste
preprocessor operator which is unnecessary here and causes these errors:

ps/common.h:176:26: error: pasting "(" and ""ps_argv[thisarg] is %s\n""
does no t give a valid preprocessing token
.

Send trace output to STDERR.

Tracing can be enabled by adding TRACE to CPPFLAGS as follows:

./configure CPPFLAGS="-DTRACE"

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
src/ps/common.h

index ee08cdc943d75385362b315e8f806716d31ae8d8..26bd38c01a5141a1c6088e64d3f5496cc3998bec 100644 (file)
@@ -181,8 +181,8 @@ makEXT(noop)
 // --- <pids> interface end ||||||||||||||||||||||||||||||||||||||||||||||
 
 
-#if 0
-#define trace(...) printf(## __VA_ARGS__)
+#if TRACE
+#define trace(...) fprintf(stderr, __VA_ARGS__)
 #else
 #define trace(...)
 #endif