#include <guestconv.h>

int
main(int argc, char *argv[])
{
    guestconv_err *err = NULL;

    guestconv_h *h = guestconv_create(&err);
    if (h == NULL) goto error;

    if (guestconv_add_drive(h, "test.img", "sda", &err) != 0)
        goto error;

    guestconv_root **roots = guestconv_inspect(h, "rhev-3.1", &err);
    if (roots == NULL) goto error;
    if (roots[0] == NULL) {
        fprintf(stderr, "Didn't find an OS\n");
        return 1;
    }

    if (guestconv_convert(h, roots[0], &err) != 0)
        goto error;

    printf("Success\n");

    return 0;

error:
    fprintf(stderr, "%s\n", err->message);
    return 1;
}
