summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYaakov Selkowitz <yselkowitz@users.sourceforge.net>2009-10-21 00:18:26 -0500
committerJamey Sharp <jamey@minilop.net>2009-10-21 12:19:42 -0700
commit7720fa29dfe664c363c27c0038a269bc8aeea74f (patch)
tree1c995ea47b8ecd365fedf18fc2351c849acaac4d
parent2793689cc2eda675ec11a3a0cfed5e470fa83ee3 (diff)
Use inttypes.h for correct printf formats
xcb_atom_t and xcb_window_t are both typedef'd as uint32_t. Since PRI*32 are a C99 feature that may not be available, fallbacks are provided based on the assumption of a 32-bit int. Signed-off-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net> Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com> Signed-off-by: Jamey Sharp <jamey@minilop.net>
-rw-r--r--xlsclients.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/xlsclients.c b/xlsclients.c
index 2452352..2fd0c2b 100644
--- a/xlsclients.c
+++ b/xlsclients.c
@@ -34,6 +34,7 @@ in this Software without prior written authorization from The Open Group.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
+#include <inttypes.h>
#include <xcb/xcb.h>
#include <xcb/xproto.h>
#include <xcb/xcb_atom.h>
@@ -41,6 +42,13 @@ in this Software without prior written authorization from The Open Group.
#include "strnlen.h"
#endif
+#ifndef PRIx32
+#define PRIx32 "x"
+#endif
+#ifndef PRIu32
+#define PRIu32 "u"
+#endif
+
static char *ProgramName;
static xcb_atom_t WM_STATE;
@@ -442,7 +450,7 @@ show_client_properties(void *closure)
* do header information
*/
if (cs->verbose) {
- printf ("Window 0x%lx:\n", cs->w);
+ printf ("Window 0x%" PRIx32 ":\n", cs->w);
print_text_field (cs->c, " Machine: ", client_machine);
if (name && name->type)
print_text_field (cs->c, " Name: ", name);
@@ -645,5 +653,5 @@ unknown(xcb_connection_t *dpy, xcb_atom_t actual_type, int actual_format)
} else
fputs (Nil, stdout);
}
- printf (" (%ld) or format %d>", actual_type, actual_format);
+ printf (" (%" PRIu32 ") or format %d>", actual_type, actual_format);
}