[PATCH] xrandr: fix newline wrapping for 8-bit output property values
Andy Ritger
aritger at nvidia.com
Wed Aug 29 14:15:12 PDT 2012
When printing 8-bit XA_INTEGER output property values, inject newlines
every 16 bytes by printing the newline before the 17th byte, not after
the 16th byte. The original scheme failed to print a final newline
when the data were not a multiple of 16 bytes (such as the single byte
"BorderDimensions" property).
Signed-off-by: Andy Ritger <aritger at nvidia.com>
---
xrandr.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/xrandr.c b/xrandr.c
index d05737e..c394958 100644
--- a/xrandr.c
+++ b/xrandr.c
@@ -3169,14 +3169,14 @@ main (int argc, char **argv)
if (actual_type == XA_INTEGER && actual_format == 8) {
int k;
- printf("\t%s:\n", XGetAtomName (dpy, props[j]));
+ printf("\t%s:", XGetAtomName (dpy, props[j]));
for (k = 0; k < nitems; k++) {
- if (k % 16 == 0)
- printf ("\t\t");
+ if (k % 16 == 0) {
+ printf("\n\t\t");
+ }
printf("%02x", (unsigned char)prop[k]);
- if (k % 16 == 15)
- printf("\n");
}
+ printf("\n");
} else if (actual_type == XA_INTEGER &&
actual_format == 32)
{
--
1.7.2.5
More information about the xorg-devel
mailing list