]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
include/c.h: add macro to print definitions as string
authorSami Kerola <kerolasa@iki.fi>
Fri, 25 Apr 2014 20:36:58 +0000 (21:36 +0100)
committerSami Kerola <kerolasa@iki.fi>
Sun, 4 May 2014 10:42:03 +0000 (11:42 +0100)
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
include/c.h

index a192fb1dd6fd052eb77e12c78d7d8bdc142184c2..6b8793a66fb0ff28a776abcc1376cc10d3ca80ea 100644 (file)
@@ -307,4 +307,13 @@ static inline int xusleep(useconds_t usec)
 # define SEEK_HOLE     4
 #endif
 
+
+/*
+ * Macros to convert #define'itions to strings, for example
+ * #define XYXXY 42
+ * printf ("%s=%s\n", stringify(XYXXY), stringify_value(XYXXY));
+ */
+#define stringify_value(s) stringify(s)
+#define stringify(s) #s
+
 #endif /* UTIL_LINUX_C_H */