add example usage to hello command

This commit is contained in:
BVK Chaitanya 2010-06-10 12:12:03 +05:30
parent 3db1c9eee4
commit 28be0e94db
34 changed files with 220 additions and 102 deletions

View file

@ -37,6 +37,8 @@
#define GRUB_COMMAND_FLAG_EXTCMD 0x10
/* This is an dynamic command. */
#define GRUB_COMMAND_FLAG_DYNCMD 0x20
/* This command accepts block arguments. */
#define GRUB_COMMAND_FLAG_BLOCKS 0x40
struct grub_command;

View file

@ -21,10 +21,12 @@
#include <grub/lib/arg.h>
#include <grub/command.h>
#include <grub/script_sh.h>
struct grub_extcmd;
struct grub_extcmd_context;
typedef grub_err_t (*grub_extcmd_func_t) (struct grub_extcmd *cmd,
typedef grub_err_t (*grub_extcmd_func_t) (struct grub_extcmd_context *ctxt,
int argc, char **args);
/* The argcmd description. */
@ -38,11 +40,21 @@ struct grub_extcmd
const struct grub_arg_option *options;
void *data;
struct grub_arg_list *state;
};
typedef struct grub_extcmd *grub_extcmd_t;
/* Command context for each instance of execution. */
struct grub_extcmd_context
{
struct grub_extcmd *extcmd;
struct grub_arg_list *state;
/* Script parameters, if any. */
struct grub_script **script_params;
};
typedef struct grub_extcmd_context *grub_extcmd_context_t;
grub_extcmd_t grub_register_extcmd (const char *name,
grub_extcmd_func_t func,
unsigned flags,
@ -52,4 +64,8 @@ grub_extcmd_t grub_register_extcmd (const char *name,
void grub_unregister_extcmd (grub_extcmd_t cmd);
grub_err_t
grub_extcmd_dispatcher (struct grub_command *cmd, int argc, char **args,
struct grub_script **scripts);
#endif /* ! GRUB_EXTCMD_HEADER */

View file

@ -72,6 +72,7 @@ struct grub_script_argv
{
unsigned argc;
char **args;
struct grub_script **scripts;
};
/* A complete argument. It consists of a list of one or more `struct
@ -230,6 +231,8 @@ void grub_script_argv_free (struct grub_script_argv *argv);
int grub_script_argv_next (struct grub_script_argv *argv);
int grub_script_argv_append (struct grub_script_argv *argv, const char *s);
int grub_script_argv_split_append (struct grub_script_argv *argv, char *s);
int grub_script_argv_script_append (struct grub_script_argv *argv,
struct grub_script *s);
struct grub_script_arglist *
grub_script_create_arglist (struct grub_parser_param *state);