1 /* guestfish - the filesystem interactive shell
2 * Copyright (C) 2009 Red Hat Inc.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 do_reopen (const char *cmd, int argc, char *argv[])
36 fprintf (stderr, _("'reopen' command takes no parameters\n"));
40 /* Open the new handle first, so we can copy the settings from the
41 * old one to the new one, and also so if it fails we still have an
44 g2 = guestfs_create ();
46 fprintf (stderr, _("reopen: guestfs_create: failed to create handle\n"));
50 /* Now copy some of the settings from the old handle. The settings
51 * we copy are those which are set by guestfish itself.
53 r = guestfs_get_verbose (g);
55 guestfs_set_verbose (g2, r);
57 r = guestfs_get_trace (g);
59 guestfs_set_trace (g2, r);
61 r = guestfs_get_autosync (g);
63 guestfs_set_autosync (g2, r);
65 p = guestfs_get_path (g);
67 guestfs_set_path (g2, p);
69 /* Close the original handle. */