git.annexia.org
/
libguestfs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
appliance: udev-174 moves udevd to /lib/udev/udevd (instead of /sbin/udevd)
[libguestfs.git]
/
cat
/
virt-cat.c
diff --git
a/cat/virt-cat.c
b/cat/virt-cat.c
index
3510a94
..
06bd8b1
100644
(file)
--- a/
cat/virt-cat.c
+++ b/
cat/virt-cat.c
@@
-1,5
+1,5
@@
/* virt-cat
/* virt-cat
- * Copyright (C) 2010 Red Hat Inc.
+ * Copyright (C) 2010
-2011
Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@
-20,10
+20,13
@@
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <inttypes.h>
#include <unistd.h>
#include <getopt.h>
#include <inttypes.h>
#include <unistd.h>
#include <getopt.h>
+#include <locale.h>
#include <assert.h>
#include <assert.h>
+#include <libintl.h>
#include "progname.h"
#include "progname.h"
@@
-34,6
+37,7
@@
guestfs_h *g;
int read_only = 1;
guestfs_h *g;
int read_only = 1;
+int live = 0;
int verbose = 0;
int keys_from_stdin = 0;
int echo_keys = 0;
int verbose = 0;
int keys_from_stdin = 0;
int echo_keys = 0;
@@
-69,7
+73,7
@@
usage (int status)
" --keys-from-stdin Read passphrases from stdin\n"
" -v|--verbose Verbose messages\n"
" -V|--version Display version and exit\n"
" --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);
"For more information, see the manpage %s(1).\n"),
program_name, program_name, program_name,
program_name);
@@
-104,11
+108,9
@@
main (int argc, char *argv[])
};
struct drv *drvs = NULL;
struct drv *drv;
};
struct drv *drvs = NULL;
struct drv *drv;
- char *p, *file = NULL;
const char *format = NULL;
int c;
int option_index;
const char *format = NULL;
int c;
int option_index;
- int next_prepared_drive = 1;
g = guestfs_create ();
if (g == NULL) {
g = guestfs_create ();
if (g == NULL) {
@@
-215,6
+217,7
@@
main (int argc, char *argv[])
*/
assert (read_only == 1);
assert (inspector == 1);
*/
assert (read_only == 1);
assert (inspector == 1);
+ assert (live == 0);
/* User must specify at least one filename on the command line. */
if (optind >= argc || argc - optind < 1)
/* User must specify at least one filename on the command line. */
if (optind >= argc || argc - optind < 1)
@@
-237,13
+240,15
@@
main (int argc, char *argv[])
/* Free up data structures, no longer needed after this point. */
free_drives (drvs);
/* 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)
while (optind < argc) {
if (guestfs_download (g, argv[optind], "/dev/stdout") == -1)
- e
xit (EXIT_FAILURE)
;
+ e
rrors++
;
optind++;
}
guestfs_close (g);
optind++;
}
guestfs_close (g);
- exit (
EXIT_SUCCESS
);
+ exit (
errors == 0 ? EXIT_SUCCESS : EXIT_FAILURE
);
}
}