1 /* command.c - support basic command */
3 * GRUB -- GRand Unified Bootloader
4 * Copyright (C) 2009 Free Software Foundation, Inc.
6 * GRUB 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 3 of the License, or
9 * (at your option) any later version.
11 * GRUB 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.
16 * You should have received a copy of the GNU General Public License
17 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
21 #include <grub/command.h>
23 grub_command_t grub_command_list
;
26 grub_register_command_prio (const char *name
,
27 grub_command_func_t func
,
29 const char *description
,
34 cmd
= (grub_command_t
) grub_malloc (sizeof (*cmd
));
40 cmd
->summary
= (summary
) ? summary
: name
;
41 cmd
->description
= description
;
43 cmd
->flags
= GRUB_COMMAND_FLAG_BOTH
;
47 grub_prio_list_insert (GRUB_AS_PRIO_LIST_P (&grub_command_list
),
48 GRUB_AS_PRIO_LIST (cmd
));
54 grub_unregister_command (grub_command_t cmd
)
56 grub_prio_list_remove (GRUB_AS_PRIO_LIST_P (&grub_command_list
),
57 GRUB_AS_PRIO_LIST (cmd
));