2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2009 Free Software Foundation, Inc.
5 * GRUB is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * GRUB is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef GRUB_EXTCMD_HEADER
20 #define GRUB_EXTCMD_HEADER 1
22 #include <grub/lib/arg.h>
23 #include <grub/command.h>
24 #include <grub/script_sh.h>
27 struct grub_extcmd_context
;
29 typedef grub_err_t (*grub_extcmd_func_t
) (struct grub_extcmd_context
*ctxt
,
30 int argc
, char **args
);
32 /* The argcmd description. */
37 grub_extcmd_func_t func
;
39 /* The argument parser optionlist. */
40 const struct grub_arg_option
*options
;
44 typedef struct grub_extcmd
*grub_extcmd_t
;
46 /* Command context for each instance of execution. */
47 struct grub_extcmd_context
49 struct grub_extcmd
*extcmd
;
51 struct grub_arg_list
*state
;
53 /* Script parameter, if any. */
54 struct grub_script
*script
;
56 typedef struct grub_extcmd_context
*grub_extcmd_context_t
;
58 grub_extcmd_t
EXPORT_FUNC(grub_register_extcmd
) (const char *name
,
59 grub_extcmd_func_t func
,
60 grub_command_flags_t flags
,
62 const char *description
,
63 const struct grub_arg_option
*parser
);
65 grub_extcmd_t
EXPORT_FUNC(grub_register_extcmd_prio
) (const char *name
,
66 grub_extcmd_func_t func
,
67 grub_command_flags_t flags
,
69 const char *description
,
70 const struct grub_arg_option
*parser
,
73 void EXPORT_FUNC(grub_unregister_extcmd
) (grub_extcmd_t cmd
);
75 grub_err_t
EXPORT_FUNC(grub_extcmd_dispatcher
) (struct grub_command
*cmd
,
76 int argc
, char **args
,
77 struct grub_script
*script
);
79 #endif /* ! GRUB_EXTCMD_HEADER */