X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=cat%2Fvirt-cat.c;h=3913c4605943b97e066959d92af66d204d2c6df4;hb=f6c8665a72c3ecadf0b24029f7c6840aafd33c81;hp=3510a94861809eafbee9a830b4991d78c9dafdb3;hpb=3bd883f344a5d6f155f7252e8a478d5b7935d7c6;p=libguestfs.git diff --git a/cat/virt-cat.c b/cat/virt-cat.c index 3510a94..3913c46 100644 --- a/cat/virt-cat.c +++ b/cat/virt-cat.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include "progname.h" @@ -69,7 +70,7 @@ usage (int status) " --keys-from-stdin Read passphrases from stdin\n" " -v|--verbose Verbose messages\n" " -V|--version Display version and exit\n" - " -x Echo each command before executing it\n" + " -x Trace libguestfs API calls\n" "For more information, see the manpage %s(1).\n"), program_name, program_name, program_name, program_name); @@ -104,11 +105,9 @@ main (int argc, char *argv[]) }; struct drv *drvs = NULL; struct drv *drv; - char *p, *file = NULL; const char *format = NULL; int c; int option_index; - int next_prepared_drive = 1; g = guestfs_create (); if (g == NULL) { @@ -237,13 +236,15 @@ main (int argc, char *argv[]) /* Free up data structures, no longer needed after this point. */ free_drives (drvs); + unsigned errors = 0; + while (optind < argc) { if (guestfs_download (g, argv[optind], "/dev/stdout") == -1) - exit (EXIT_FAILURE); + errors++; optind++; } guestfs_close (g); - exit (EXIT_SUCCESS); + exit (errors == 0 ? EXIT_SUCCESS : EXIT_FAILURE); }