~ubuntu-branches/ubuntu/trusty/grub2/trusty-updates

« back to all changes in this revision

Viewing changes to script/main.c

Tags: upstream-1.99~20101122
ImportĀ upstreamĀ versionĀ 1.99~20101122

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *  GRUB  --  GRand Unified Bootloader
3
 
 *  Copyright (C) 2009  Free Software Foundation, Inc.
4
 
 *
5
 
 *  GRUB is free software: you can redistribute it and/or modify
6
 
 *  it under the terms of the GNU General Public License as published by
7
 
 *  the Free Software Foundation, either version 3 of the License, or
8
 
 *  (at your option) any later version.
9
 
 *
10
 
 *  GRUB is distributed in the hope that it will be useful,
11
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
 *  GNU General Public License for more details.
14
 
 *
15
 
 *  You should have received a copy of the GNU General Public License
16
 
 *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
17
 
 */
18
 
 
19
 
#include <grub/dl.h>
20
 
#include <grub/parser.h>
21
 
#include <grub/script_sh.h>
22
 
 
23
 
static grub_err_t
24
 
grub_normal_parse_line (char *line, grub_reader_getline_t getline)
25
 
{
26
 
  struct grub_script *parsed_script;
27
 
 
28
 
  /* Parse the script.  */
29
 
  parsed_script = grub_script_parse (line, getline);
30
 
 
31
 
  if (parsed_script)
32
 
    {
33
 
      /* Execute the command(s).  */
34
 
      grub_script_execute (parsed_script);
35
 
 
36
 
      /* The parsed script was executed, throw it away.  */
37
 
      grub_script_free (parsed_script);
38
 
    }
39
 
 
40
 
  return grub_errno;
41
 
}
42
 
 
43
 
static struct grub_parser grub_sh_parser =
44
 
  {
45
 
    .name = "grub",
46
 
    .parse_line = grub_normal_parse_line
47
 
  };
48
 
 
49
 
GRUB_MOD_INIT(sh)
50
 
{
51
 
  grub_parser_register ("grub", &grub_sh_parser);
52
 
}
53
 
 
54
 
GRUB_MOD_FINI(sh)
55
 
{
56
 
  grub_parser_unregister (&grub_sh_parser);
57
 
}