~jonathank89/burg/burg-percise

« back to all changes in this revision

Viewing changes to kern/rescue_reader.c

merge mainline into mips

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
#include <grub/types.h>
21
21
#include <grub/reader.h>
 
22
#include <grub/parser.h>
22
23
#include <grub/misc.h>
23
24
#include <grub/term.h>
 
25
#include <grub/mm.h>
24
26
 
25
27
#define GRUB_RESCUE_BUF_SIZE    256
26
28
 
27
29
static char linebuf[GRUB_RESCUE_BUF_SIZE];
28
30
 
29
 
static grub_err_t
30
 
grub_rescue_init (void)
31
 
{
32
 
  grub_printf ("Entering rescue mode...\n");
33
 
  return 0;
34
 
}
35
 
 
36
31
/* Prompt to input a command and read the line.  */
37
32
static grub_err_t
38
33
grub_rescue_read_line (char **line, int cont)
74
69
  return 0;
75
70
}
76
71
 
77
 
static struct grub_reader grub_rescue_reader =
78
 
  {
79
 
    .name = "rescue",
80
 
    .init = grub_rescue_init,
81
 
    .read_line = grub_rescue_read_line
82
 
  };
83
 
 
84
72
void
85
 
grub_register_rescue_reader (void)
 
73
grub_rescue_run (void)
86
74
{
87
 
  grub_reader_register ("rescue", &grub_rescue_reader);
 
75
  grub_printf ("Entering rescue mode...\n");
 
76
 
 
77
  while (1)
 
78
    {
 
79
      char *line;
 
80
 
 
81
      /* Print an error, if any.  */
 
82
      grub_print_error ();
 
83
      grub_errno = GRUB_ERR_NONE;
 
84
 
 
85
      grub_rescue_read_line (&line, 0);
 
86
      if (! line)
 
87
        continue;
 
88
 
 
89
      grub_parser_get_current ()->parse_line (line, grub_rescue_read_line);
 
90
      grub_free (line);
 
91
    }
88
92
}