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

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

 



On Thu, Dec 11, 2008 at 02:39:18PM -0500, Dave Allan wrote:
> The daemon-conf script, when run in verbose mode, tries to execute 
> libvirtd --version.  The attached patch implements --version.

ACK, this looks good to me.

> 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


-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

--
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]