From: Richard W.M. Jones Date: Sun, 7 Aug 2011 20:04:00 +0000 (+0100) Subject: fish: Declare run_* functions in a generated header file. X-Git-Tag: 1.13.3~3 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=3064277680ad11f887691646d0fa17bb35f38c19;p=libguestfs.git fish: Declare run_* functions in a generated header file. Calls to these functions are generated, so there is no need to declare the functions by hand. --- diff --git a/.gitignore b/.gitignore index 18b99b9..ab12867 100644 --- a/.gitignore +++ b/.gitignore @@ -84,6 +84,7 @@ fish/cmds.c fish/cmds_gperf.c fish/cmds_gperf.gperf fish/completion.c +fish/fish-cmds.h fish/guestfish fish/guestfish.1 fish/guestfish-actions.pod diff --git a/fish/fish.h b/fish/fish.h index 6bcdb96..8cf14a8 100644 --- a/fish/fish.h +++ b/fish/fish.h @@ -21,6 +21,8 @@ #include +#include "fish-cmds.h" + #ifdef HAVE_GETTEXT #include "gettext.h" #define _(str) dgettext(PACKAGE, (str)) @@ -94,43 +96,13 @@ extern int complete_dest_paths; extern char *complete_dest_paths_generator (const char *text, int state); /* in alloc.c */ -extern int run_alloc (const char *cmd, size_t argc, char *argv[]); -extern int run_sparse (const char *cmd, size_t argc, char *argv[]); extern int alloc_disk (const char *filename, const char *size, int add, int sparse); extern int parse_size (const char *str, off_t *size_rtn); -/* in copy.c */ -extern int run_copy_in (const char *cmd, size_t argc, char *argv[]); -extern int run_copy_out (const char *cmd, size_t argc, char *argv[]); - -/* in display.c */ -extern int run_display (const char *cmd, size_t argc, char *argv[]); - -/* in echo.c */ -extern int run_echo (const char *cmd, size_t argc, char *argv[]); - -/* in edit.c */ -extern int run_edit (const char *cmd, size_t argc, char *argv[]); - /* in help.c */ extern void display_help (void); -/* in hexedit.c */ -extern int run_hexedit (const char *cmd, size_t argc, char *argv[]); - -/* in lcd.c */ -extern int run_lcd (const char *cmd, size_t argc, char *argv[]); - -/* in glob.c */ -extern int run_glob (const char *cmd, size_t argc, char *argv[]); - -/* in man.c */ -extern int run_man (const char *cmd, size_t argc, char *argv[]); - -/* in more.c */ -extern int run_more (const char *cmd, size_t argc, char *argv[]); - /* in prep.c */ struct prep_data { const struct prep *prep; @@ -158,15 +130,6 @@ extern void rc_listen (void) __attribute__((noreturn)); extern int rc_remote (int pid, const char *cmd, size_t argc, char *argv[], int exit_on_error); -/* in reopen.c */ -extern int run_reopen (const char *cmd, size_t argc, char *argv[]); - -/* in supported.c */ -extern int run_supported (const char *cmd, size_t argc, char *argv[]); - -/* in time.c */ -extern int run_time (const char *cmd, size_t argc, char *argv[]); - /* in tilde.c */ extern char *try_tilde_expansion (char *path); diff --git a/generator/generator_fish.ml b/generator/generator_fish.ml index c5def5c..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"; @@ -621,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; diff --git a/generator/generator_main.ml b/generator/generator_main.ml index f3d3340..f6e99a5 100644 --- a/generator/generator_main.ml +++ b/generator/generator_main.ml @@ -1,5 +1,5 @@ (* libguestfs - * Copyright (C) 2009-2010 Red Hat Inc. + * Copyright (C) 2009-2011 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 @@ -98,6 +98,7 @@ Run it from the top source directory using the command output_to "fish/cmds_gperf.gperf" generate_fish_cmds_gperf; output_to "fish/cmds.c" generate_fish_cmds; output_to "fish/completion.c" generate_fish_completion; + output_to "fish/fish-cmds.h" generate_fish_cmds_h; output_to "fish/guestfish-commands.pod" generate_fish_commands_pod; output_to "fish/guestfish-actions.pod" generate_fish_actions_pod; output_to "fish/prepopts.c" generate_fish_prep_options_c;