From: BVK Chaitanya Date: Sun, 18 Jul 2010 16:33:28 +0000 (+0530) Subject: merge with mainline X-Git-Tag: 1.99~596^2~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3e96a6a1087fa1518fc77937e294b04b3c596706;p=thirdparty%2Fgrub.git merge with mainline --- 3e96a6a1087fa1518fc77937e294b04b3c596706 diff --cc commands/cat.c index 3bdafc4c6,77a4cc793..a70118517 --- a/commands/cat.c +++ b/commands/cat.c @@@ -23,14 -23,20 +23,20 @@@ #include #include #include - #include + #include #include - 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} + }; + static grub_err_t -grub_cmd_cat (grub_extcmd_t cmd, int argc, char **args) ++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; diff --cc conf/common.rmk index b9a973f76,f92e5bc4c..25122a389 --- a/conf/common.rmk +++ b/conf/common.rmk @@@ -637,19 -628,18 +628,18 @@@ keystatus_mod_CFLAGS = $(COMMON_CFLAGS 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 diff --cc include/grub/script_sh.h index b70f65df1,7d6129243..f27f27064 --- a/include/grub/script_sh.h +++ b/include/grub/script_sh.h @@@ -328,27 -344,13 +333,29 @@@ grub_script_function_t grub_script_func 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 */ diff --cc script/function.c index 82c753bcd,810c65233..47b236652 --- a/script/function.c +++ b/script/function.c @@@ -103,15 -103,12 +103,3 @@@ grub_script_function_find (char *functi 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); --} diff --cc script/parser.y index 6bc4ece0b,e85ba624d..ee2c0374f --- a/script/parser.y +++ b/script/parser.y @@@ -20,6 -20,6 +20,7 @@@ %{ #include #include ++#include #define YYFREE grub_free #define YYMALLOC grub_malloc @@@ -126,7 -126,9 +128,8 @@@ word: GRUB_PARSER_TOKEN_NAME { $$ = gru 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); }