X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=generator%2Fgenerator_fish.ml;h=dc2dc3eae0ae29d53009bf320bf04677f8bb3ee8;hb=635af5be04265f845186b40e9a9fe7b102ad6909;hp=cdf91718fc96cf2435b94a6bae697016eb341c53;hpb=34acb80a28d1b48e734883a32f7f3344dc216ec0;p=libguestfs.git diff --git a/generator/generator_fish.ml b/generator/generator_fish.ml index cdf9171..dc2dc3e 100644 --- a/generator/generator_fish.ml +++ b/generator/generator_fish.ml @@ -56,11 +56,13 @@ let generate_fish_cmds () = pr "#include \n"; pr "#include \n"; pr "\n"; - pr "#include \n"; pr "#include \"c-ctype.h\"\n"; pr "#include \"full-write.h\"\n"; pr "#include \"xstrtol.h\"\n"; + pr "\n"; + pr "#include \n"; pr "#include \"fish.h\"\n"; + pr "#include \"fish-cmds.h\"\n"; pr "#include \"options.h\"\n"; pr "#include \"cmds_gperf.h\"\n"; pr "\n"; @@ -416,6 +418,8 @@ Guestfish will prompt for these separately." pr " if (%s == NULL) return -1;\n" name | Key name -> pr " %s = read_key (\"%s\");\n" name name; + pr " if (keys_from_stdin)\n"; + pr " input_lineno++;\n"; pr " if (%s == NULL) return -1;\n" name | Bool name -> pr " %s = is_true (argv[i++]) ? 1 : 0;\n" name @@ -619,6 +623,22 @@ Guestfish will prompt for these separately." pr " }\n"; pr "}\n" +and generate_fish_cmds_h () = + generate_header CStyle GPLv2plus; + + pr "#ifndef FISH_CMDS_H\n"; + pr "#define FISH_CMDS_H\n"; + pr "\n"; + + List.iter ( + fun (shortname, _, _, _, _, _, _) -> + pr "extern int run_%s (const char *cmd, size_t argc, char *argv[]);\n" + shortname + ) fish_commands; + + pr "\n"; + pr "#endif /* FISH_CMDS_H */\n" + (* gperf code to do fast lookups of commands. *) and generate_fish_cmds_gperf () = generate_header CStyle GPLv2plus;