]> git.proxmox.com Git - grub2.git/blob - commands/boot.c
2004-03-14 Marco Gerards <metgerards@student.han.nl>
[grub2.git] / commands / boot.c
1 /* boot.c - command to boot an operating system */
2 /*
3 * PUPA -- Preliminary Universal Programming Architecture for GRUB
4 * Copyright (C) 2003 Free Software Foundation, Inc.
5 *
6 * PUPA is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with PUPA; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21 #include <pupa/normal.h>
22 #include <pupa/dl.h>
23 #include <pupa/arg.h>
24 #include <pupa/misc.h>
25 #include <pupa/loader.h>
26
27 static pupa_err_t
28 pupa_cmd_boot (struct pupa_arg_list *state __attribute__ ((unused)),
29 int argc, char **args __attribute__ ((unused)))
30 {
31 if (argc)
32 return pupa_error (PUPA_ERR_BAD_ARGUMENT, "too many arguments");
33
34 pupa_loader_boot ();
35
36 return 0;
37 }
38
39 \f
40 #ifdef PUPA_UTIL
41 void
42 pupa_boot_init (void)
43 {
44 pupa_register_command ("boot", pupa_cmd_boot, PUPA_COMMAND_FLAG_BOTH,
45 "boot", "Boot an operating system", 0);
46 }
47
48 void
49 pupa_boot_fini (void)
50 {
51 pupa_unregister_command ("boot");
52 }
53 #else /* ! PUPA_UTIL */
54 PUPA_MOD_INIT
55 {
56 (void)mod; /* To stop warning. */
57 pupa_register_command ("boot", pupa_cmd_boot, PUPA_COMMAND_FLAG_BOTH,
58 "boot", "Boot an operating system", 0);
59 }
60
61 PUPA_MOD_FINI
62 {
63 pupa_unregister_command ("boot");
64 }
65 #endif /* ! PUPA_UTIL */