generator: Don't die if an API call isn't listed in API versions file.
[libguestfs.git] / generator / generator_c.ml
index 13040f0..4480200 100644 (file)
@@ -24,6 +24,7 @@ open Generator_types
 open Generator_utils
 open Generator_pr
 open Generator_docstrings
+open Generator_api_versions
 open Generator_optgroups
 open Generator_actions
 open Generator_structs
@@ -254,6 +255,10 @@ L</KEYS AND PASSPHRASES> for more information.\n\n";
          | None -> ()
          | Some txt -> pr "%s\n\n" txt
         );
+        (match lookup_api_version name with
+         | Some version -> pr "(Added in %s)\n\n" version
+         | None -> ()
+        );
 
         (* Handling of optional argument variants. *)
         if optargs <> [] then (
@@ -607,10 +612,12 @@ check_state (guestfs_h *g, const char *caller)
       | Pathname n
       | Dev_or_Path n
       | FileIn n
-      | FileOut n
-      | Key n ->
+      | FileOut n ->
           (* guestfish doesn't support string escaping, so neither do we *)
           pr "    fprintf (stderr, \" \\\"%%s\\\"\", %s);\n" n
+      | Key n ->
+          (* don't print keys *)
+          pr "    fprintf (stderr, \" \\\"***\\\"\");\n"
       | OptString n ->                 (* string option *)
           pr "    if (%s) fprintf (stderr, \" \\\"%%s\\\"\", %s);\n" n n;
           pr "    else fprintf (stderr, \" null\");\n"