Re: [libvirt-designer][PATCH 3/4] examples: Create an example of usage program

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

 



Hey,

I haven't looked at the patch in depth, just a few comments:

On Wed, Sep 05, 2012 at 11:27:46AM +0200, Michal Privoznik wrote:
> +
> +    /* Standard (non-command) options. The leading + ensures that no
> +     * argument reordering takes place, so that command options are
> +     * not confused with top-level virsh options. */
> +    while ((arg = getopt_long(argc, argv, "+hc:o:p:a:d:", opt, NULL)) != -1) {

glib has its own commandline parser
http://developer.gnome.org/glib/stable/glib-Commandline-option-parser.html
I'm not saying you have to use it, I'm merely mentioning it in case you
prefer something different from getopt.


> +        char *progname;
> +        switch (arg) {
> +        case 'h':
> +            if (!(progname = strrchr(argv[0], '/')))
> +                progname = argv[0];
> +            else
> +                progname++;

You can also use g_path_get_basename

> +
> +    conn = virConnectOpenAuth(connect_uri, virConnectAuthPtrDefault, VIR_CONNECT_RO);
> +    if (!conn) {
> +        print_error("Unable to connect to libvirt");
> +        return EXIT_FAILURE;
> +    }
> +
> +    if ((caps_str = virConnectGetCapabilities(conn)) == NULL) {
> +        print_error("failed to get capabilities");
> +        goto cleanup;
> +    }

libvirt-glib has gvir_connection_get_capabilities, I'm not sure about
virConnectOpenAuth. With that said, I guess not using libvirt-gobject is
done on purpose as libvirt-designer is not depending on it, right?

Christophe

Attachment: pgpgG2jleUoAI.pgp
Description: PGP signature

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