[Libguestfs] [PATCH 3/3] guestfish: Fix printing of buffers in structs.

Richard W.M. Jones rjones at redhat.com
Sat Oct 31 13:46:42 UTC 2009


-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/
-------------- next part --------------
>From 84a81da28811fda1363c6400ab5ce17e08e631ba Mon Sep 17 00:00:00 2001
From: Richard Jones <rjones at redhat.com>
Date: Sat, 31 Oct 2009 13:40:12 +0000
Subject: [PATCH 3/3] guestfish: Fix printing of buffers in structs.

Somehow an 'indent' string crept in there, so it was printing:

  <char><indent><char><indent><char>...

instead of:

  <char><char><char>...
---
 src/generator.ml |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/generator.ml b/src/generator.ml
index 2cabd4a..b17ee65 100755
--- a/src/generator.ml
+++ b/src/generator.ml
@@ -6289,9 +6289,9 @@ and generate_fish_cmds () =
             pr "  printf (\"%%s%s: \", indent);\n" name;
             pr "  for (i = 0; i < %s->%s_len; ++i)\n" typ name;
             pr "    if (c_isprint (%s->%s[i]))\n" typ name;
-            pr "      printf (\"%%s%%c\", indent, %s->%s[i]);\n" typ name;
+            pr "      printf (\"%%c\", %s->%s[i]);\n" typ name;
             pr "    else\n";
-            pr "      printf (\"%%s\\\\x%%02x\", indent, %s->%s[i]);\n" typ name;
+            pr "      printf (\"\\\\x%%02x\", %s->%s[i]);\n" typ name;
             pr "  printf (\"\\n\");\n"
         | name, (FUInt64|FBytes) ->
             pr "  printf (\"%%s%s: %%\" PRIu64 \"\\n\", indent, %s->%s);\n"
-- 
1.6.5.rc2



More information about the Libguestfs mailing list