return lines; /* Caller frees. */
}
+
+char *
+do_sh (char *command)
+{
+ char *argv[] = { "/bin/sh", "-c", command, NULL };
+
+ return do_command (argv);
+}
+
+char **
+do_sh_lines (char *command)
+{
+ char *argv[] = { "/bin/sh", "-c", command, NULL };
+
+ return do_command_lines (argv);
+}
The single parameter is an argv-style list of arguments.
The first element is the name of the program to run.
Subsequent elements are parameters. The list must be
-non-empty (ie. must contain a program name).
+non-empty (ie. must contain a program name). Note that
+the command runs directly, and is I<not> invoked via
+the shell (see C<guestfs_sh>).
The return value is anything printed to I<stdout> by
the command.
"run a command, returning lines",
"\
This is the same as C<guestfs_command>, but splits the
-result into a list of lines.");
+result into a list of lines.
+
+See also: C<guestfs_sh_lines>");
("stat", (RStat "statbuf", [String "path"]), 52, [],
[InitBasicFS, Always, TestOutputStruct (
would succeed, or some non-zero value documented in the
L<ntfs-3g.probe(8)> manual page.");
+ ("sh", (RString "output", [String "command"]), 111, [],
+ [], (* XXX needs tests *)
+ "run a command via the shell",
+ "\
+This call runs a command from the guest filesystem via the
+guest's C</bin/sh>.
+
+This is like C<guestfs_command>, but passes the command to:
+
+ /bin/sh -c \"command\"
+
+Depending on the guest's shell, this usually results in
+wildcards being expanded, shell expressions being interpolated
+and so on.
+
+All the provisos about C<guestfs_command> apply to this call.");
+
+ ("sh_lines", (RStringList "lines", [String "command"]), 112, [],
+ [], (* XXX needs tests *)
+ "run a command via the shell returning lines",
+ "\
+This is the same as C<guestfs_sh>, but splits the result
+into a list of lines.
+
+See also: C<guestfs_command_lines>");
+
+
]
let all_functions = non_daemon_functions @ daemon_functions