[libvirt] [PATCH] implement --version for libvirtd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The daemon-conf script, when run in verbose mode, tries to execute libvirtd --version. The attached patch implements --version.

Dave
diff --git a/qemud/qemud.c b/qemud/qemud.c
index f35d0fd..b10d680 100644
--- a/qemud/qemud.c
+++ b/qemud/qemud.c
@@ -2272,6 +2272,13 @@ remoteReadConfigFile (struct qemud_server *server, const char *filename)
     return -1;
 }
 
+/* Display version information. */
+static void
+version (const char *argv0)
+{
+    printf ("%s (%s) %s\n", argv0, PACKAGE_NAME, PACKAGE_VERSION);
+}
+
 /* Print command-line usage. */
 static void
 usage (const char *argv0)
@@ -2287,6 +2294,7 @@ Options:\n\
   -l | --listen          Listen for TCP/IP connections.\n\
   -t | --timeout <secs>  Exit after timeout period.\n\
   -f | --config <file>   Configuration file.\n\
+     | --version         Display version information.\n\
   -p | --pid-file <file> Change name of PID file.\n\
 \n\
 libvirt management daemon:\n\
@@ -2317,6 +2325,10 @@ libvirt management daemon:\n\
                : "(disabled in ./configure)");
 }
 
+enum {
+    OPT_VERSION = 129
+};
+
 #define MAX_LISTEN 5
 int main(int argc, char **argv) {
     struct qemud_server *server = NULL;
@@ -2333,6 +2345,7 @@ int main(int argc, char **argv) {
         { "config", required_argument, NULL, 'f'},
         { "timeout", required_argument, NULL, 't'},
         { "pid-file", required_argument, NULL, 'p'},
+        { "version", no_argument, NULL, OPT_VERSION },
         { "help", no_argument, NULL, '?' },
         {0, 0, 0, 0}
     };
@@ -2378,6 +2391,10 @@ int main(int argc, char **argv) {
             remote_config_file = optarg;
             break;
 
+        case OPT_VERSION:
+            version (argv[0]);
+            return 0;
+
         case '?':
             usage (argv[0]);
             return 2;
--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]