#include <grub/term.h>
#include <grub/misc.h>
#include <grub/gzio.h>
- #include <grub/command.h>
+ #include <grub/extcmd.h>
#include <grub/i18n.h>
- static grub_err_t
- grub_cmd_cat (grub_command_t cmd __attribute__ ((unused)),
- int argc, char **args)
+ static const struct grub_arg_option options[] =
+ {
+ {"dos", -1, 0, N_("Accept DOS-style CR/NL line endings."), 0, 0},
+ {0, 0, 0, 0, 0, 0}
+ };
-grub_cmd_cat (grub_extcmd_t cmd, int argc, char **args)
+ static grub_err_t
++grub_cmd_cat (grub_extcmd_context_t ctxt, int argc, char **args)
{
- struct grub_arg_list *state = cmd->state;
++ struct grub_arg_list *state = ctxt->state;
+ int dos = 0;
grub_file_t file;
char buf[GRUB_DISK_SECTOR_SIZE];
grub_ssize_t size;
keystatus_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For normal.mod.
+ ifneq (, $(FONT_SOURCE))
+ normal/charset.c_DEPENDENCIES = widthspec.h
+ endif
normal_mod_SOURCES = normal/main.c normal/cmdline.c normal/dyncmd.c \
- normal/auth.c normal/autofs.c normal/handler.c \
+ normal/auth.c normal/autofs.c \
normal/color.c normal/completion.c normal/datetime.c normal/menu.c \
- normal/menu_entry.c normal/menu_text.c \
- normal/misc.c normal/crypto.c normal/term.c normal/context.c
- normal_mod_CFLAGS = $(COMMON_CFLAGS)
- normal_mod_LDFLAGS = $(COMMON_LDFLAGS)
-
- # For sh.mod.
- sh_mod_SOURCES = script/main.c script/script.c script/argv.c script/execute.c \
+ normal/menu_entry.c normal/menu_text.c normal/charset.c \
+ normal/misc.c normal/crypto.c normal/term.c normal/context.c \
- script/main.c script/script.c script/execute.c unidata.c \
++ script/main.c script/script.c script/execute.c script/argv.c unidata.c \
script/function.c script/lexer.c grub_script.tab.c grub_script.yy.c
- sh_mod_CFLAGS = $(COMMON_CFLAGS) $(POSIX_CFLAGS) -Wno-error
- sh_mod_LDFLAGS = $(COMMON_LDFLAGS)
+ normal_mod_CFLAGS = $(COMMON_CFLAGS) $(POSIX_CFLAGS) -Wno-error
+ normal_mod_LDFLAGS = $(COMMON_LDFLAGS)
ifneq (, $(FONT_SOURCE))
font/font.c_DEPENDENCIES = ascii.h
struct grub_script *cmd);
void grub_script_function_remove (const char *name);
grub_script_function_t grub_script_function_find (char *functionname);
- int grub_script_function_iterate (int (*iterate) (grub_script_function_t));
-int grub_script_function_call (grub_script_function_t func,
- int argc, char **args);
+grub_err_t grub_script_function_call (grub_script_function_t func,
+ int argc, char **args);
char **
grub_script_execute_arglist_to_argv (struct grub_script_arglist *arglist, int *count);
+static inline struct grub_script *
+grub_script_get (struct grub_script *script)
+{
+ script->refcnt++;
+ return script;
+}
+
+static inline void
+grub_script_put (struct grub_script *script)
+{
+ if (script->refcnt == 0)
+ grub_script_free (script);
+ else
+ script->refcnt--;
+}
+
+ grub_err_t
+ grub_normal_parse_line (char *line, grub_reader_getline_t getline);
+
#endif /* ! GRUB_NORMAL_PARSER_HEADER */
return func;
}
--
--int
- grub_script_function_iterate (int (*iterate) (grub_script_function_t))
-grub_script_function_call (grub_script_function_t func,
- int argc __attribute__((unused)),
- char **args __attribute__((unused)))
--{
- grub_script_function_t func;
-
- for (func = grub_script_function_list; func; func = func->next)
- if (iterate (func))
- return 1;
-
- return 0;
- /* XXX: Arguments are not supported yet. */
- return grub_script_execute (func->func);
--}
%{
#include <grub/script_sh.h>
#include <grub/mm.h>
++#include <grub/misc.h>
#define YYFREE grub_free
#define YYMALLOC grub_malloc
statement: command { $$ = $1; }
| function { $$ = 0; }
- | menuentry { $$ = $1; }
;
+
argument : "case" { $$ = grub_script_add_arglist (state, 0, $1); }
| "do" { $$ = grub_script_add_arglist (state, 0, $1); }
| "done" { $$ = grub_script_add_arglist (state, 0, $1); }