+ /* Inspector mode invalidates most of the other arguments. */
+ if (inspector) {
+ char cmd[1024];
+ int r;
+
+ if (drvs || mps) {
+ fprintf (stderr, _("guestfish: cannot use -i option with -a or -m\n"));
+ exit (1);
+ }
+ if (optind >= argc) {
+ fprintf (stderr, _("guestfish -i requires a libvirt domain or path(s) to disk image(s)\n"));
+ exit (1);
+ }
+
+ strcpy (cmd, "a=`virt-inspector");
+ while (optind < argc) {
+ if (strlen (cmd) + strlen (argv[optind]) + strlen (argv[0]) + 60
+ >= sizeof cmd) {
+ fprintf (stderr, _("guestfish: virt-inspector command too long for fixed-size buffer\n"));
+ exit (1);
+ }
+ strcat (cmd, " '");
+ strcat (cmd, argv[optind]);
+ strcat (cmd, "'");
+ optind++;
+ }
+
+ if (read_only)
+ strcat (cmd, " --ro-fish");
+ else
+ strcat (cmd, " --fish");
+
+ sprintf (&cmd[strlen(cmd)], "` && %s $a", argv[0]);
+
+ if (guestfs_get_verbose (g))
+ strcat (cmd, " -v");
+ if (!guestfs_get_autosync (g))
+ strcat (cmd, " -n");
+
+ /*printf ("%s\n", cmd);*/
+
+ r = system (cmd);
+ if (r == -1) {
+ perror ("system");
+ exit (1);
+ }
+ exit (WEXITSTATUS (r));
+ }
+