+2010-06-28 Vladimir Serbinenko <phcoder@gmail.com>
+
+ Use normal parser for menu entries.
+ Reported by: Thomas Frauendorfer
+
+ * include/grub/parser.h (grub_parser_execute): Don't export.
+ * normal/menu.c (grub_menu_execute_entry_real): New function.
+ (grub_menu_execute_entry): Use grub_menu_execute_entry_real.
+
2010-06-28 Colin Watson <cjwatson@ubuntu.com>
* docs/grub.texi (Embedded configuration): New section (replacing
};
typedef struct grub_parser *grub_parser_t;
-grub_err_t EXPORT_FUNC(grub_parser_execute) (char *source);
+grub_err_t grub_parser_execute (char *source);
grub_err_t
grub_rescue_parse_line (char *line, grub_reader_getline_t getline);
#include <grub/auth.h>
#include <grub/i18n.h>
#include <grub/term.h>
+#include <grub/script_sh.h>
/* Time to delay after displaying an error message about a default/fallback
entry failing to boot. */
return entry;
}
+static void
+grub_menu_execute_entry_real (grub_menu_entry_t entry)
+{
+ const char *source;
+
+ auto grub_err_t getline (char **line, int cont);
+ grub_err_t getline (char **line, int cont __attribute__ ((unused)))
+ {
+ const char *p;
+
+ if (!source)
+ {
+ *line = 0;
+ return 0;
+ }
+
+ p = grub_strchr (source, '\n');
+
+ if (p)
+ *line = grub_strndup (source, p - source);
+ else
+ *line = grub_strdup (source);
+ source = p ? p + 1 : 0;
+ return 0;
+ }
+
+ source = entry->sourcecode;
+
+ while (source)
+ {
+ char *line;
+
+ getline (&line, 0);
+ grub_normal_parse_line (line, getline);
+ grub_free (line);
+ }
+}
+
/* Run a menu entry. */
void
grub_menu_execute_entry(grub_menu_entry_t entry)
grub_env_set ("chosen", entry->title);
- grub_parser_execute ((char *) entry->sourcecode);
+ grub_menu_execute_entry_real (entry);
if (grub_errno == GRUB_ERR_NONE && grub_loader_is_loaded ())
/* Implicit execution of boot, only if something is loaded. */