2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2010,2012,2013 Free Software Foundation, Inc.
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.
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.
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/>.
22 #include <grub/util/misc.h>
23 #include <grub/i18n.h>
24 #include <grub/term.h>
25 #include <grub/font.h>
26 #include <grub/gfxmenu_view.h>
27 #include <grub/color.h>
28 #include <grub/util/install.h>
29 #include <grub/command.h>
42 void grub_file_init (void);
43 void grub_host_init (void);
44 void grub_hostfs_init (void);
47 main (int argc
, char *argv
[])
51 int had_file
= 0, had_separator
= 0;
55 grub_util_host_init (&argc
, &argv
);
57 argv2
= xmalloc (argc
* sizeof (argv2
[0]));
59 if (argc
== 2 && strcmp (argv
[1], "--version") == 0)
61 printf ("%s (%s) %s\n", program_name
, PACKAGE_NAME
, PACKAGE_VERSION
);
64 for (i
= 1; i
< argc
; i
++)
66 if (argv
[i
][0] == '-' && argv
[i
][1] == '-'
67 && argv
[i
][2] == '\0' && !had_separator
)
70 argv2
[i
- 1] = xstrdup (argv
[i
]);
73 if (argv
[i
][0] == '-' && !had_separator
)
75 argv2
[i
- 1] = xstrdup (argv
[i
]);
79 grub_util_error ("one argument expected");
80 argv2
[i
- 1] = canonicalize_file_name (argv
[i
]);
83 grub_util_error (_("cannot open `%s': %s"), argv
[i
],
90 /* Initialize all modules. */
96 grub_env_set ("root", "host");
98 cmd
= grub_command_find ("file");
100 grub_util_error (_("can't find command `%s'"), "file");
102 err
= (cmd
->func
) (cmd
, argc
- 1, argv2
);
103 if (err
&& err
!= GRUB_ERR_TEST_FAILURE
)