This will output the QEMU_PKGVERSION which is set by configure's
--with-pkgversion=

Signed-off-by: Don Slutz <dsl...@verizon.com>
---
 qemu-img.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/qemu-img.c b/qemu-img.c
index 7876258..f73bea6 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -3064,6 +3064,17 @@ int main(int argc, char **argv)
     }
     cmdname = argv[1];
 
+    /* Report pkgversion */
+    if (!strcmp(cmdname, "--pkgversion")) {
+        argc--; argv++; /* Drop special arg. */
+        printf("qemu-img version " QEMU_VERSION
+               " pkgversion " QEMU_PKGVERSION "\n");
+        if (argc < 2) {
+            return 0;
+        }
+        cmdname = argv[1]; /* Update */
+    }
+
     /* find the command */
     for (cmd = img_cmds; cmd->name != NULL; cmd++) {
         if (!strcmp(cmdname, cmd->name)) {
-- 
1.8.4


Reply via email to