Fix non-srcdir builds: further fixes to OCaml build rules.
[libguestfs.git] / daemon / command.c
index 46a265c..3f21807 100644 (file)
@@ -1,5 +1,5 @@
 /* libguestfs - the guestfsd daemon
- * Copyright (C) 2009 Red Hat Inc. 
+ * Copyright (C) 2009 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
@@ -27,7 +27,7 @@
 #include "actions.h"
 
 char *
-do_command (char * const * const argv)
+do_command (char **argv)
 {
   char *out, *err;
   int r;
@@ -84,7 +84,7 @@ do_command (char * const * const argv)
 }
 
 char **
-do_command_lines (char * const * const argv)
+do_command_lines (char **argv)
 {
   char *out;
   char **lines;
@@ -101,3 +101,19 @@ do_command_lines (char * const * const argv)
 
   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);
+}