maint: use spaces, not TABs for indentation
[libguestfs.git] / src / generator.ml
index e5e2681..6f77e4b 100755 (executable)
@@ -808,6 +808,31 @@ C<LIBGUESTFS_TRACE> is defined and set to C<1>.");
    "\
 Return the command trace flag.");
 
    "\
 Return the command trace flag.");
 
+  ("set_direct", (RErr, [Bool "direct"]), -1, [FishAlias "direct"],
+   [InitNone, Always, TestOutputFalse (
+      [["set_direct"; "false"];
+       ["get_direct"]])],
+   "enable or disable direct appliance mode",
+   "\
+If the direct appliance mode flag is enabled, then stdin and
+stdout are passed directly through to the appliance once it
+is launched.
+
+One consequence of this is that log messages aren't caught
+by the library and handled by C<guestfs_set_log_message_callback>,
+but go straight to stdout.
+
+You probably don't want to use this unless you know what you
+are doing.
+
+The default is disabled.");
+
+  ("get_direct", (RBool "direct", []), -1, [],
+   [],
+   "get direct appliance mode flag",
+   "\
+Return the direct appliance mode flag.");
+
 ]
 
 (* daemon_functions are any functions which cause some action
 ]
 
 (* daemon_functions are any functions which cause some action
@@ -4649,8 +4674,8 @@ check_state (guestfs_h *g, const char *caller)
 
     let needs_i =
       List.exists (function
 
     let needs_i =
       List.exists (function
-                  | StringList _ | DeviceList _ -> true
-                  | _ -> false) (snd style) in
+                   | StringList _ | DeviceList _ -> true
+                   | _ -> false) (snd style) in
     if needs_i then (
       pr "    int i;\n";
       pr "\n"
     if needs_i then (
       pr "    int i;\n";
       pr "\n"
@@ -4665,24 +4690,24 @@ check_state (guestfs_h *g, const char *caller)
       | Dev_or_Path n
       | FileIn n
       | FileOut n ->
       | Dev_or_Path n
       | FileIn n
       | FileOut n ->
-         (* guestfish doesn't support string escaping, so neither do we *)
-         pr "    printf (\" \\\"%%s\\\"\", %s);\n" n
+          (* guestfish doesn't support string escaping, so neither do we *)
+          pr "    printf (\" \\\"%%s\\\"\", %s);\n" n
       | OptString n ->                 (* string option *)
       | OptString n ->                 (* string option *)
-         pr "    if (%s) printf (\" \\\"%%s\\\"\", %s);\n" n n;
-         pr "    else printf (\" null\");\n"
+          pr "    if (%s) printf (\" \\\"%%s\\\"\", %s);\n" n n;
+          pr "    else printf (\" null\");\n"
       | StringList n
       | DeviceList n ->                        (* string list *)
       | StringList n
       | DeviceList n ->                        (* string list *)
-         pr "    putchar (' ');\n";
-         pr "    putchar ('\"');\n";
-         pr "    for (i = 0; %s[i]; ++i) {\n" n;
-         pr "      if (i > 0) putchar (' ');\n";
-         pr "      fputs (%s[i], stdout);\n" n;
-         pr "    }\n";
-         pr "    putchar ('\"');\n";
+          pr "    putchar (' ');\n";
+          pr "    putchar ('\"');\n";
+          pr "    for (i = 0; %s[i]; ++i) {\n" n;
+          pr "      if (i > 0) putchar (' ');\n";
+          pr "      fputs (%s[i], stdout);\n" n;
+          pr "    }\n";
+          pr "    putchar ('\"');\n";
       | Bool n ->                      (* boolean *)
       | Bool n ->                      (* boolean *)
-         pr "    fputs (%s ? \" true\" : \" false\", stdout);\n" n
+          pr "    fputs (%s ? \" true\" : \" false\", stdout);\n" n
       | Int n ->                       (* int *)
       | Int n ->                       (* int *)
-         pr "    printf (\" %%d\", %s);\n" n
+          pr "    printf (\" %%d\", %s);\n" n
     ) (snd style);
     pr "    putchar ('\\n');\n";
     pr "  }\n";
     ) (snd style);
     pr "    putchar ('\\n');\n";
     pr "  }\n";
@@ -4734,16 +4759,16 @@ check_state (guestfs_h *g, const char *caller)
       pr "  guestfs_message_header hdr;\n";
       pr "  guestfs_message_error err;\n";
       let has_ret =
       pr "  guestfs_message_header hdr;\n";
       pr "  guestfs_message_error err;\n";
       let has_ret =
-       match fst style with
-       | RErr -> false
-       | RConstString _ | RConstOptString _ ->
+        match fst style with
+        | RErr -> false
+        | RConstString _ | RConstOptString _ ->
             failwithf "RConstString|RConstOptString cannot be used by daemon functions"
             failwithf "RConstString|RConstOptString cannot be used by daemon functions"
-       | RInt _ | RInt64 _
-       | RBool _ | RString _ | RStringList _
-       | RStruct _ | RStructList _
-       | RHashtable _ | RBufferOut _ ->
+        | RInt _ | RInt64 _
+        | RBool _ | RString _ | RStringList _
+        | RStruct _ | RStructList _
+        | RHashtable _ | RBufferOut _ ->
             pr "  struct %s_ret ret;\n" name;
             pr "  struct %s_ret ret;\n" name;
-           true in
+            true in
 
       pr "  int serial;\n";
       pr "  int r;\n";
 
       pr "  int serial;\n";
       pr "  int r;\n";
@@ -4810,7 +4835,7 @@ check_state (guestfs_h *g, const char *caller)
       pr "\n";
       pr "  r = guestfs___recv (g, \"%s\", &hdr, &err,\n        " shortname;
       if not has_ret then
       pr "\n";
       pr "  r = guestfs___recv (g, \"%s\", &hdr, &err,\n        " shortname;
       if not has_ret then
-       pr "NULL, NULL"
+        pr "NULL, NULL"
       else
         pr "(xdrproc_t) xdr_guestfs_%s_ret, (char *) &ret" shortname;
       pr ");\n";
       else
         pr "(xdrproc_t) xdr_guestfs_%s_ret, (char *) &ret" shortname;
       pr ");\n";