virt-rescue: Refresh documentation.
[libguestfs.git] / fish / fish.c
index a36ec09..461f55b 100644 (file)
@@ -58,6 +58,7 @@ struct mp {
 static void add_drives (struct drv *drv);
 static void prepare_drives (struct drv *drv);
 static void mount_mps (struct mp *mp);
+static int launch (void);
 static void interactive (void);
 static void shell_script (void);
 static void script (int prompt);
@@ -72,24 +73,11 @@ guestfs_h *g;
 int read_only = 0;
 int quit = 0;
 int verbose = 0;
-int echo_commands = 0;
 int remote_control_listen = 0;
 int remote_control = 0;
 int exit_on_error = 1;
 int command_num = 0;
 
-int
-launch (guestfs_h *_g)
-{
-  assert (_g == g);
-
-  if (guestfs_is_config (g)) {
-    if (guestfs_launch (g) == -1)
-      return -1;
-  }
-  return 0;
-}
-
 static void __attribute__((noreturn))
 usage (int status)
 {
@@ -361,7 +349,7 @@ main (int argc, char *argv[])
       exit (EXIT_SUCCESS);
 
     case 'x':
-      echo_commands = 1;
+      guestfs_set_trace (g, 1);
       break;
 
     case HELP_OPTION:
@@ -437,7 +425,7 @@ main (int argc, char *argv[])
    * guest and mount them.
    */
   if (next_prepared_drive > 1 || mps != NULL) {
-    if (launch (g) == -1) exit (EXIT_FAILURE);
+    if (launch () == -1) exit (EXIT_FAILURE);
     prepare_drives (drvs);
     mount_mps (mps);
   }
@@ -555,6 +543,16 @@ prepare_drives (struct drv *drv)
   }
 }
 
+static int
+launch (void)
+{
+  if (guestfs_is_config (g)) {
+    if (guestfs_launch (g) == -1)
+      return -1;
+  }
+  return 0;
+}
+
 static void
 interactive (void)
 {
@@ -857,13 +855,6 @@ issue_command (const char *cmd, char *argv[], const char *pipecmd)
   /* This counts the commands issued, starting at 1. */
   command_num++;
 
-  if (echo_commands) {
-    printf ("%s", cmd);
-    for (i = 0; argv[i] != NULL; ++i)
-      printf (" %s", argv[i]);
-    printf ("\n");
-  }
-
   /* For | ... commands.  Annoyingly we can't use popen(3) here. */
   if (pipecmd) {
     int fd[2];