2005-07-17 Yoshinori Okuji <okuji@enbug.org>
* commands/cat.c (GRUB_MOD_INIT): Use better documentation. (grub_cat_init): Likewise. * loader/i386/pc/chainloader_normal.c (GRUB_MOD_INIT): Likewise. (options): Likewise. * commands/configfile.c (GRUB_MOD_INIT): Likewise. (grub_configfile_init): Likewise. * font/manager.c (GRUB_MOD_INIT): Likewise. * commands/help.c (GRUB_MOD_INIT): Likewise. (grub_help_init): Likewise. * normal/command.c (grub_command_init): Likewise. * loader/i386/pc/linux_normal.c (GRUB_MOD_INIT): Likewise. * disk/loopback.c (grub_loop_init): Likewise. (GRUB_MOD_INIT): Likewise. * commands/ls.c (grub_ls_init): Likewise. (GRUB_MOD_INIT): Likewise. (options): Likewise. * commands/boot.c (grub_boot_init): Likewise. (GRUB_MOD_INIT): Likewise. * loader/i386/pc/multiboot_normal.c (GRUB_MOD_INIT): Likewise. * commands/i386/pc/reboot.c (grub_reboot_init): Likewise. (GRUB_MOD_INIT): Likewise. * commands/cmp.c (grub_cmp_init): Likewise. (GRUB_MOD_INIT): Likewise. * normal/arg.c: Use <> instead of "" to include header files. (SHORT_ARG_HELP): New macro. (SHORT_ARG_USAGE): Likewise. (help_options): Specify SHORT_ARG_HELP and SHORT_ARG_USAGE instead of 'h' and 'u' for help and usage, respectively. Use more GNU-like descriptions. (find_short): Check if C is 'h' or 'u' explicitly. (grub_arg_show_help): Use space characters instead of tabs. Treat SHORT_ARG_HELP and SHORT_ARG_USAGE exceptionally so that -h and -u are shown with --help and --usage only if they are not used for the command itself. (parse_option): Use SHORT_ARG_HELP and SHORT_ARG_USAGE instead of 'h' and 'u'. * include/grub/arg.h (struct grub_arg_option): Add the qualifier const into "longarg". Change the type of "shortarg" to int.
This commit is contained in:
parent
f806d18efd
commit
502c87e80e
17 changed files with 174 additions and 72 deletions
43
ChangeLog
43
ChangeLog
|
@ -1,3 +1,46 @@
|
||||||
|
2005-07-17 Yoshinori Okuji <okuji@enbug.org>
|
||||||
|
|
||||||
|
* commands/cat.c (GRUB_MOD_INIT): Use better documentation.
|
||||||
|
(grub_cat_init): Likewise.
|
||||||
|
* loader/i386/pc/chainloader_normal.c (GRUB_MOD_INIT): Likewise.
|
||||||
|
(options): Likewise.
|
||||||
|
* commands/configfile.c (GRUB_MOD_INIT): Likewise.
|
||||||
|
(grub_configfile_init): Likewise.
|
||||||
|
* font/manager.c (GRUB_MOD_INIT): Likewise.
|
||||||
|
* commands/help.c (GRUB_MOD_INIT): Likewise.
|
||||||
|
(grub_help_init): Likewise.
|
||||||
|
* normal/command.c (grub_command_init): Likewise.
|
||||||
|
* loader/i386/pc/linux_normal.c (GRUB_MOD_INIT): Likewise.
|
||||||
|
* disk/loopback.c (grub_loop_init): Likewise.
|
||||||
|
(GRUB_MOD_INIT): Likewise.
|
||||||
|
* commands/ls.c (grub_ls_init): Likewise.
|
||||||
|
(GRUB_MOD_INIT): Likewise.
|
||||||
|
(options): Likewise.
|
||||||
|
* commands/boot.c (grub_boot_init): Likewise.
|
||||||
|
(GRUB_MOD_INIT): Likewise.
|
||||||
|
* loader/i386/pc/multiboot_normal.c (GRUB_MOD_INIT): Likewise.
|
||||||
|
* commands/i386/pc/reboot.c (grub_reboot_init): Likewise.
|
||||||
|
(GRUB_MOD_INIT): Likewise.
|
||||||
|
* commands/cmp.c (grub_cmp_init): Likewise.
|
||||||
|
(GRUB_MOD_INIT): Likewise.
|
||||||
|
|
||||||
|
* normal/arg.c: Use <> instead of "" to include header files.
|
||||||
|
(SHORT_ARG_HELP): New macro.
|
||||||
|
(SHORT_ARG_USAGE): Likewise.
|
||||||
|
(help_options): Specify SHORT_ARG_HELP and SHORT_ARG_USAGE instead
|
||||||
|
of 'h' and 'u' for help and usage, respectively. Use more GNU-like
|
||||||
|
descriptions.
|
||||||
|
(find_short): Check if C is 'h' or 'u' explicitly.
|
||||||
|
(grub_arg_show_help): Use space characters instead of tabs. Treat
|
||||||
|
SHORT_ARG_HELP and SHORT_ARG_USAGE exceptionally so that -h and -u
|
||||||
|
are shown with --help and --usage only if they are not used for
|
||||||
|
the command itself.
|
||||||
|
(parse_option): Use SHORT_ARG_HELP and SHORT_ARG_USAGE instead of
|
||||||
|
'h' and 'u'.
|
||||||
|
|
||||||
|
* include/grub/arg.h (struct grub_arg_option): Add the qualifier
|
||||||
|
const into "longarg". Change the type of "shortarg" to int.
|
||||||
|
|
||||||
2005-07-17 Yoshinori Okuji <okuji@enbug.org>
|
2005-07-17 Yoshinori Okuji <okuji@enbug.org>
|
||||||
|
|
||||||
* boot/i386/pc/boot.S (boot_drive_check): New label.
|
* boot/i386/pc/boot.S (boot_drive_check): New label.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* boot.c - command to boot an operating system */
|
/* boot.c - command to boot an operating system */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2003 Free Software Foundation, Inc.
|
* Copyright (C) 2003,2005 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software; you can redistribute it and/or modify
|
* GRUB is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -43,7 +43,7 @@ void
|
||||||
grub_boot_init (void)
|
grub_boot_init (void)
|
||||||
{
|
{
|
||||||
grub_register_command ("boot", grub_cmd_boot, GRUB_COMMAND_FLAG_BOTH,
|
grub_register_command ("boot", grub_cmd_boot, GRUB_COMMAND_FLAG_BOTH,
|
||||||
"boot", "Boot an operating system", 0);
|
"boot", "Boot an operating system.", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -54,9 +54,9 @@ grub_boot_fini (void)
|
||||||
#else /* ! GRUB_UTIL */
|
#else /* ! GRUB_UTIL */
|
||||||
GRUB_MOD_INIT
|
GRUB_MOD_INIT
|
||||||
{
|
{
|
||||||
(void)mod; /* To stop warning. */
|
(void) mod; /* To stop warning. */
|
||||||
grub_register_command ("boot", grub_cmd_boot, GRUB_COMMAND_FLAG_BOTH,
|
grub_register_command ("boot", grub_cmd_boot, GRUB_COMMAND_FLAG_BOTH,
|
||||||
"boot", "Boot an operating system", 0);
|
"boot", "Boot an operating system.", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI
|
GRUB_MOD_FINI
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* cat.c - command to show the contents of a file */
|
/* cat.c - command to show the contents of a file */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2003 Free Software Foundation, Inc.
|
* Copyright (C) 2003,2005 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software; you can redistribute it and/or modify
|
* GRUB is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -74,7 +74,7 @@ void
|
||||||
grub_cat_init (void)
|
grub_cat_init (void)
|
||||||
{
|
{
|
||||||
grub_register_command ("cat", grub_cmd_cat, GRUB_COMMAND_FLAG_BOTH,
|
grub_register_command ("cat", grub_cmd_cat, GRUB_COMMAND_FLAG_BOTH,
|
||||||
"cat FILE", "Show the contents of a file", 0);
|
"cat FILE", "Show the contents of a file.", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -85,9 +85,9 @@ grub_cat_fini (void)
|
||||||
#else /* ! GRUB_UTIL */
|
#else /* ! GRUB_UTIL */
|
||||||
GRUB_MOD_INIT
|
GRUB_MOD_INIT
|
||||||
{
|
{
|
||||||
(void)mod; /* To stop warning. */
|
(void) mod; /* To stop warning. */
|
||||||
grub_register_command ("cat", grub_cmd_cat, GRUB_COMMAND_FLAG_BOTH,
|
grub_register_command ("cat", grub_cmd_cat, GRUB_COMMAND_FLAG_BOTH,
|
||||||
"cat FILE", "Show the contents of a file", 0);
|
"cat FILE", "Show the contents of a file.", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI
|
GRUB_MOD_FINI
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* cmd.c - command to cmp an operating system */
|
/* cmd.c - command to cmp an operating system */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2003 Free Software Foundation, Inc.
|
* Copyright (C) 2003,2005 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software; you can redistribute it and/or modify
|
* GRUB is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -106,7 +106,7 @@ void
|
||||||
grub_cmp_init (void)
|
grub_cmp_init (void)
|
||||||
{
|
{
|
||||||
grub_register_command ("cmp", grub_cmd_cmp, GRUB_COMMAND_FLAG_BOTH,
|
grub_register_command ("cmp", grub_cmd_cmp, GRUB_COMMAND_FLAG_BOTH,
|
||||||
"cmp FILE1 FILE2", "Compare two files", 0);
|
"cmp FILE1 FILE2", "Compare two files.", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -117,9 +117,9 @@ grub_cmp_fini (void)
|
||||||
#else /* ! GRUB_UTIL */
|
#else /* ! GRUB_UTIL */
|
||||||
GRUB_MOD_INIT
|
GRUB_MOD_INIT
|
||||||
{
|
{
|
||||||
(void)mod; /* To stop warning. */
|
(void) mod; /* To stop warning. */
|
||||||
grub_register_command ("cmp", grub_cmd_cmp, GRUB_COMMAND_FLAG_BOTH,
|
grub_register_command ("cmp", grub_cmd_cmp, GRUB_COMMAND_FLAG_BOTH,
|
||||||
"cmp FILE1 FILE2", "Compare two files", 0);
|
"cmp FILE1 FILE2", "Compare two files.", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI
|
GRUB_MOD_FINI
|
||||||
|
|
|
@ -45,7 +45,7 @@ grub_configfile_init (void)
|
||||||
{
|
{
|
||||||
grub_register_command ("configfile", grub_cmd_configfile,
|
grub_register_command ("configfile", grub_cmd_configfile,
|
||||||
GRUB_COMMAND_FLAG_BOTH, "configfile FILE",
|
GRUB_COMMAND_FLAG_BOTH, "configfile FILE",
|
||||||
"Load config file", 0);
|
"Load another config file.", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -56,10 +56,10 @@ grub_configfile_fini (void)
|
||||||
#else /* ! GRUB_UTIL */
|
#else /* ! GRUB_UTIL */
|
||||||
GRUB_MOD_INIT
|
GRUB_MOD_INIT
|
||||||
{
|
{
|
||||||
(void)mod; /* To stop warning. */
|
(void) mod; /* To stop warning. */
|
||||||
grub_register_command ("configfile", grub_cmd_configfile,
|
grub_register_command ("configfile", grub_cmd_configfile,
|
||||||
GRUB_COMMAND_FLAG_BOTH, "configfile FILE",
|
GRUB_COMMAND_FLAG_BOTH, "configfile FILE",
|
||||||
"Load config file", 0);
|
"Load another config file.", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI
|
GRUB_MOD_FINI
|
||||||
|
|
|
@ -99,7 +99,7 @@ void
|
||||||
grub_help_init (void)
|
grub_help_init (void)
|
||||||
{
|
{
|
||||||
grub_register_command ("help", grub_cmd_help, GRUB_COMMAND_FLAG_CMDLINE,
|
grub_register_command ("help", grub_cmd_help, GRUB_COMMAND_FLAG_CMDLINE,
|
||||||
"help [PATTERN ...]", "Shows a help message", 0);
|
"help [PATTERN ...]", "Show a help message.", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -112,7 +112,7 @@ GRUB_MOD_INIT
|
||||||
{
|
{
|
||||||
(void)mod; /* To stop warning. */
|
(void)mod; /* To stop warning. */
|
||||||
grub_register_command ("help", grub_cmd_help, GRUB_COMMAND_FLAG_CMDLINE,
|
grub_register_command ("help", grub_cmd_help, GRUB_COMMAND_FLAG_CMDLINE,
|
||||||
"help [PATTERN ...]", "Shows a help message", 0);
|
"help [PATTERN ...]", "Show a help message.", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI
|
GRUB_MOD_FINI
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
static const struct grub_arg_option options[] =
|
||||||
{
|
{
|
||||||
{"no-apm", 'n', 0, "Don't use APM to halt the computer", 0, 0},
|
{"no-apm", 'n', 0, "do not use APM to halt the computer", 0, 0},
|
||||||
{0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ GRUB_MOD_INIT
|
||||||
{
|
{
|
||||||
(void)mod; /* To stop warning. */
|
(void)mod; /* To stop warning. */
|
||||||
grub_register_command ("halt", grub_cmd_halt, GRUB_COMMAND_FLAG_BOTH,
|
grub_register_command ("halt", grub_cmd_halt, GRUB_COMMAND_FLAG_BOTH,
|
||||||
"halt [OPTIONS...]",
|
"halt [-n]",
|
||||||
"Halt the system, if possible using APM", options);
|
"Halt the system, if possible using APM", options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ void
|
||||||
grub_reboot_init (void)
|
grub_reboot_init (void)
|
||||||
{
|
{
|
||||||
grub_register_command ("reboot", grub_cmd_reboot, GRUB_COMMAND_FLAG_BOTH,
|
grub_register_command ("reboot", grub_cmd_reboot, GRUB_COMMAND_FLAG_BOTH,
|
||||||
"reboot", "Reboot the computer", 0);
|
"reboot", "Reboot the computer.", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -33,9 +33,9 @@
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
static const struct grub_arg_option options[] =
|
||||||
{
|
{
|
||||||
{"long", 'l', 0, "Show a long list with more detailed information", 0, 0},
|
{"long", 'l', 0, "show a long list with more detailed information", 0, 0},
|
||||||
{"human-readable", 'h', 0, "Print sizes in a human readable format", 0, 0},
|
{"human-readable", 'h', 0, "print sizes in a human readable format", 0, 0},
|
||||||
{"all", 'a', 0, "List all files", 0, 0},
|
{"all", 'a', 0, "list all files", 0, 0},
|
||||||
{0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -241,8 +241,8 @@ void
|
||||||
grub_ls_init (void)
|
grub_ls_init (void)
|
||||||
{
|
{
|
||||||
grub_register_command ("ls", grub_cmd_ls, GRUB_COMMAND_FLAG_BOTH,
|
grub_register_command ("ls", grub_cmd_ls, GRUB_COMMAND_FLAG_BOTH,
|
||||||
"ls [OPTIONS...] [DIR]",
|
"ls [-l|-h|-a] [FILE]",
|
||||||
"List devices and files", options);
|
"List devices and files.", options);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -255,8 +255,8 @@ GRUB_MOD_INIT
|
||||||
{
|
{
|
||||||
(void)mod; /* To stop warning. */
|
(void)mod; /* To stop warning. */
|
||||||
grub_register_command ("ls", grub_cmd_ls, GRUB_COMMAND_FLAG_BOTH,
|
grub_register_command ("ls", grub_cmd_ls, GRUB_COMMAND_FLAG_BOTH,
|
||||||
"ls [OPTIONS...] [DIR]",
|
"ls [-l|-h|-a] [FILE]",
|
||||||
"List devices and files", options);
|
"List devices and files.", options);
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI
|
GRUB_MOD_FINI
|
||||||
|
|
|
@ -38,8 +38,8 @@ static struct grub_loopback *loopback_list;
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
static const struct grub_arg_option options[] =
|
||||||
{
|
{
|
||||||
{"delete", 'd', 0, "Delete the loopback device entry", 0, 0},
|
{"delete", 'd', 0, "delete the loopback device entry", 0, 0},
|
||||||
{"partitions", 'p', 0, "Set that the drive has partitions to"
|
{"partitions", 'p', 0, "set that the drive has partitions to"
|
||||||
" simulate a harddrive", 0, 0},
|
" simulate a harddrive", 0, 0},
|
||||||
{0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
@ -245,7 +245,8 @@ void
|
||||||
grub_loop_init (void)
|
grub_loop_init (void)
|
||||||
{
|
{
|
||||||
grub_register_command ("loopback", grub_cmd_loopback, GRUB_COMMAND_FLAG_BOTH,
|
grub_register_command ("loopback", grub_cmd_loopback, GRUB_COMMAND_FLAG_BOTH,
|
||||||
"loopback [OPTIONS] DEVICENAME FILE", "Makes a device of a file", options);
|
"loopback [-d|-p] DEVICENAME FILE",
|
||||||
|
"Make a device of a file.", options);
|
||||||
grub_disk_dev_register (&grub_loopback_dev);
|
grub_disk_dev_register (&grub_loopback_dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,7 +261,8 @@ GRUB_MOD_INIT
|
||||||
{
|
{
|
||||||
(void)mod; /* To stop warning. */
|
(void)mod; /* To stop warning. */
|
||||||
grub_register_command ("loopback", grub_cmd_loopback, GRUB_COMMAND_FLAG_BOTH,
|
grub_register_command ("loopback", grub_cmd_loopback, GRUB_COMMAND_FLAG_BOTH,
|
||||||
"loopback [OPTIONS] DEVICENAME FILE", "Makes a device of a file", options);
|
"loopback [-d|-p] DEVICENAME FILE",
|
||||||
|
"Make a device of a file.", options);
|
||||||
grub_disk_dev_register (&grub_loopback_dev);
|
grub_disk_dev_register (&grub_loopback_dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2003 Free Software Foundation, Inc.
|
* Copyright (C) 2003,2005 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -236,7 +236,8 @@ GRUB_MOD_INIT
|
||||||
{
|
{
|
||||||
(void) mod; /* Stop warning. */
|
(void) mod; /* Stop warning. */
|
||||||
grub_register_command ("font", font_command, GRUB_COMMAND_FLAG_BOTH,
|
grub_register_command ("font", font_command, GRUB_COMMAND_FLAG_BOTH,
|
||||||
"font FILE...", "Specify a font file to display.", 0);
|
"font FILE...",
|
||||||
|
"Specify one or more font files to display.", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI
|
GRUB_MOD_FINI
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2003 Free Software Foundation, Inc.
|
* Copyright (C) 2003,2005 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software; you can redistribute it and/or modify
|
* GRUB is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -49,8 +49,8 @@ typedef enum grub_key_type grub_arg_key_type_t;
|
||||||
|
|
||||||
struct grub_arg_option
|
struct grub_arg_option
|
||||||
{
|
{
|
||||||
char *longarg;
|
const char *longarg;
|
||||||
char shortarg;
|
int shortarg;
|
||||||
int flags;
|
int flags;
|
||||||
char *doc;
|
char *doc;
|
||||||
char *arg;
|
char *arg;
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
static const struct grub_arg_option options[] =
|
||||||
{
|
{
|
||||||
{"force", 'f', 0, "Skip bootsector magic number test.", 0, 0},
|
{"force", 'f', 0, "skip bootsector magic number test", 0, 0},
|
||||||
{0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -47,8 +47,8 @@ GRUB_MOD_INIT
|
||||||
(void) mod; /* To stop warning. */
|
(void) mod; /* To stop warning. */
|
||||||
grub_register_command ("chainloader", chainloader_command,
|
grub_register_command ("chainloader", chainloader_command,
|
||||||
GRUB_COMMAND_FLAG_BOTH,
|
GRUB_COMMAND_FLAG_BOTH,
|
||||||
"chainloader [options] FILE",
|
"chainloader [-f] FILE",
|
||||||
"Prepare to boot another boot loader", options);
|
"Prepare to boot another boot loader.", options);
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI
|
GRUB_MOD_FINI
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* linux_normal.c - boot another boot loader */
|
/* linux_normal.c - boot another boot loader */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2004 Free Software Foundation, Inc.
|
* Copyright (C) 2004,2005 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -46,12 +46,12 @@ GRUB_MOD_INIT
|
||||||
grub_register_command ("linux", grub_normal_linux_command,
|
grub_register_command ("linux", grub_normal_linux_command,
|
||||||
GRUB_COMMAND_FLAG_BOTH,
|
GRUB_COMMAND_FLAG_BOTH,
|
||||||
"linux FILE [ARGS...]",
|
"linux FILE [ARGS...]",
|
||||||
"Load linux", 0);
|
"Load a linux kernel.", 0);
|
||||||
|
|
||||||
grub_register_command ("initrd", grub_normal_initrd_command,
|
grub_register_command ("initrd", grub_normal_initrd_command,
|
||||||
GRUB_COMMAND_FLAG_BOTH,
|
GRUB_COMMAND_FLAG_BOTH,
|
||||||
"initrd FILE",
|
"initrd FILE",
|
||||||
"Load initrd", 0);
|
"Load an initrd.", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI
|
GRUB_MOD_FINI
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* multiboot_normal.c - boot another boot loader */
|
/* multiboot_normal.c - boot another boot loader */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2004 Free Software Foundation, Inc.
|
* Copyright (C) 2004,2005 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -46,12 +46,12 @@ GRUB_MOD_INIT
|
||||||
grub_register_command ("multiboot", grub_normal_cmd_multiboot,
|
grub_register_command ("multiboot", grub_normal_cmd_multiboot,
|
||||||
GRUB_COMMAND_FLAG_BOTH | GRUB_COMMAND_FLAG_NO_ARG_PARSE,
|
GRUB_COMMAND_FLAG_BOTH | GRUB_COMMAND_FLAG_NO_ARG_PARSE,
|
||||||
"multiboot FILE [ARGS...]",
|
"multiboot FILE [ARGS...]",
|
||||||
"Load a multiboot kernel", 0);
|
"Load a Multiboot kernel.", 0);
|
||||||
|
|
||||||
grub_register_command ("module", grub_normal_cmd_module,
|
grub_register_command ("module", grub_normal_cmd_module,
|
||||||
GRUB_COMMAND_FLAG_BOTH | GRUB_COMMAND_FLAG_NO_ARG_PARSE,
|
GRUB_COMMAND_FLAG_BOTH | GRUB_COMMAND_FLAG_NO_ARG_PARSE,
|
||||||
"module FILE [ARGS...]",
|
"module FILE [ARGS...]",
|
||||||
"Load a multiboot module", 0);
|
"Load a Multiboot module.", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI
|
GRUB_MOD_FINI
|
||||||
|
|
103
normal/arg.c
103
normal/arg.c
|
@ -1,7 +1,7 @@
|
||||||
/* arg.c - argument parser */
|
/* arg.c - argument parser */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
|
* Copyright (C) 2003,2004,2005 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software; you can redistribute it and/or modify
|
* GRUB is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -18,17 +18,23 @@
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "grub/arg.h"
|
#include <grub/arg.h>
|
||||||
#include "grub/misc.h"
|
#include <grub/misc.h>
|
||||||
#include "grub/mm.h"
|
#include <grub/mm.h>
|
||||||
#include "grub/err.h"
|
#include <grub/err.h>
|
||||||
#include "grub/normal.h"
|
#include <grub/normal.h>
|
||||||
|
#include <grub/term.h>
|
||||||
|
|
||||||
|
/* Built-in parser for default options. */
|
||||||
|
#define SHORT_ARG_HELP -100
|
||||||
|
#define SHORT_ARG_USAGE -101
|
||||||
|
|
||||||
/* Build in parser for default options. */
|
|
||||||
static const struct grub_arg_option help_options[] =
|
static const struct grub_arg_option help_options[] =
|
||||||
{
|
{
|
||||||
{"help", 'h', 0, "Display help", 0, ARG_TYPE_NONE},
|
{"help", SHORT_ARG_HELP, 0,
|
||||||
{"usage", 'u', 0, "Show how to use this command", 0, ARG_TYPE_NONE},
|
"display this help and exit", 0, ARG_TYPE_NONE},
|
||||||
|
{"usage", SHORT_ARG_USAGE, 0,
|
||||||
|
"display the usage of this command and exit", 0, ARG_TYPE_NONE},
|
||||||
{0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -51,8 +57,23 @@ find_short (const struct grub_arg_option *options, char c)
|
||||||
|
|
||||||
if (options)
|
if (options)
|
||||||
found = fnd_short (options);
|
found = fnd_short (options);
|
||||||
|
|
||||||
if (! found)
|
if (! found)
|
||||||
found = fnd_short (help_options);
|
{
|
||||||
|
switch (c)
|
||||||
|
{
|
||||||
|
case 'h':
|
||||||
|
found = (struct grub_arg_option *) help_options;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'u':
|
||||||
|
found = (struct grub_arg_option *) (help_options + 1);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
@ -80,7 +101,7 @@ find_long (const struct grub_arg_option *options, char *s)
|
||||||
{
|
{
|
||||||
while (opt->doc)
|
while (opt->doc)
|
||||||
{
|
{
|
||||||
if (opt->longarg && !grub_strcmp (opt->longarg, s))
|
if (opt->longarg && ! grub_strcmp (opt->longarg, s))
|
||||||
return (struct grub_arg_option *) opt;
|
return (struct grub_arg_option *) opt;
|
||||||
opt++;
|
opt++;
|
||||||
}
|
}
|
||||||
|
@ -89,7 +110,8 @@ find_long (const struct grub_arg_option *options, char *s)
|
||||||
|
|
||||||
if (options)
|
if (options)
|
||||||
found = fnd_long (options);
|
found = fnd_long (options);
|
||||||
if (!found)
|
|
||||||
|
if (! found)
|
||||||
found = fnd_long (help_options);
|
found = fnd_long (help_options);
|
||||||
|
|
||||||
return found;
|
return found;
|
||||||
|
@ -104,24 +126,55 @@ show_usage (grub_command_t cmd)
|
||||||
void
|
void
|
||||||
grub_arg_show_help (grub_command_t cmd)
|
grub_arg_show_help (grub_command_t cmd)
|
||||||
{
|
{
|
||||||
static void showargs (const struct grub_arg_option *opt)
|
auto void showargs (const struct grub_arg_option *opt);
|
||||||
|
int h_is_used = 0;
|
||||||
|
int u_is_used = 0;
|
||||||
|
|
||||||
|
auto void showargs (const struct grub_arg_option *opt)
|
||||||
{
|
{
|
||||||
for (; opt->doc; opt++)
|
for (; opt->doc; opt++)
|
||||||
{
|
{
|
||||||
|
int spacing = 20;
|
||||||
|
|
||||||
if (opt->shortarg && grub_isgraph (opt->shortarg))
|
if (opt->shortarg && grub_isgraph (opt->shortarg))
|
||||||
grub_printf ("-%c%c ", opt->shortarg, opt->longarg ? ',':' ');
|
grub_printf ("-%c%c ", opt->shortarg, opt->longarg ? ',':' ');
|
||||||
|
else if (opt->shortarg == SHORT_ARG_HELP && ! h_is_used)
|
||||||
|
grub_printf ("-h, ");
|
||||||
|
else if (opt->shortarg == SHORT_ARG_USAGE && ! u_is_used)
|
||||||
|
grub_printf ("-u, ");
|
||||||
else
|
else
|
||||||
grub_printf (" ");
|
grub_printf (" ");
|
||||||
|
|
||||||
if (opt->longarg)
|
if (opt->longarg)
|
||||||
{
|
{
|
||||||
grub_printf ("--%s", opt->longarg);
|
grub_printf ("--%s", opt->longarg);
|
||||||
if (opt->arg)
|
spacing -= grub_strlen (opt->longarg);
|
||||||
grub_printf ("=%s", opt->arg);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
grub_printf ("\t");
|
|
||||||
|
|
||||||
grub_printf ("\t\t%s\n", opt->doc);
|
if (opt->arg)
|
||||||
|
{
|
||||||
|
grub_printf ("=%s", opt->arg);
|
||||||
|
spacing -= grub_strlen (opt->arg) + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (spacing-- > 0)
|
||||||
|
grub_putchar (' ');
|
||||||
|
|
||||||
|
grub_printf ("%s\n", opt->doc);
|
||||||
|
|
||||||
|
switch (opt->shortarg)
|
||||||
|
{
|
||||||
|
case 'h':
|
||||||
|
h_is_used = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'u':
|
||||||
|
u_is_used = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,11 +194,11 @@ parse_option (grub_command_t cmd, int key, char *arg, struct grub_arg_list *usr)
|
||||||
{
|
{
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
case 'h':
|
case SHORT_ARG_HELP:
|
||||||
grub_arg_show_help (cmd);
|
grub_arg_show_help (cmd);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
case 'u':
|
case SHORT_ARG_USAGE:
|
||||||
show_usage (cmd);
|
show_usage (cmd);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -221,7 +274,7 @@ grub_arg_parse (grub_command_t cmd, int argc, char **argv,
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
opt = find_short (cmd->options, *curshort);
|
opt = find_short (cmd->options, *curshort);
|
||||||
if (!opt)
|
if (! opt)
|
||||||
{
|
{
|
||||||
grub_error (GRUB_ERR_BAD_ARGUMENT,
|
grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||||
"Unknown argument `-%c'\n", *curshort);
|
"Unknown argument `-%c'\n", *curshort);
|
||||||
|
@ -274,7 +327,7 @@ grub_arg_parse (grub_command_t cmd, int argc, char **argv,
|
||||||
arg = longarg;
|
arg = longarg;
|
||||||
|
|
||||||
opt = find_long (cmd->options, arg + 2);
|
opt = find_long (cmd->options, arg + 2);
|
||||||
if (!opt)
|
if (! opt)
|
||||||
{
|
{
|
||||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "Unknown argument `%s'\n", arg);
|
grub_error (GRUB_ERR_BAD_ARGUMENT, "Unknown argument `%s'\n", arg);
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -282,9 +335,9 @@ grub_arg_parse (grub_command_t cmd, int argc, char **argv,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! (opt->type == ARG_TYPE_NONE
|
if (! (opt->type == ARG_TYPE_NONE
|
||||||
|| (!option && (opt->flags & GRUB_ARG_OPTION_OPTIONAL))))
|
|| (! option && (opt->flags & GRUB_ARG_OPTION_OPTIONAL))))
|
||||||
{
|
{
|
||||||
if (!option)
|
if (! option)
|
||||||
{
|
{
|
||||||
grub_error (GRUB_ERR_BAD_ARGUMENT,
|
grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||||
"Missing mandatory option for `%s'\n", opt->longarg);
|
"Missing mandatory option for `%s'\n", opt->longarg);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2003, 2005 Free Software Foundation, Inc.
|
* Copyright (C) 2003,2005 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -382,16 +382,19 @@ grub_command_init (void)
|
||||||
grub_register_command ("title", 0, GRUB_COMMAND_FLAG_TITLE, 0, 0, 0);
|
grub_register_command ("title", 0, GRUB_COMMAND_FLAG_TITLE, 0, 0, 0);
|
||||||
|
|
||||||
grub_register_command ("rescue", rescue_command, GRUB_COMMAND_FLAG_BOTH,
|
grub_register_command ("rescue", rescue_command, GRUB_COMMAND_FLAG_BOTH,
|
||||||
"rescue", "Enter into the rescue mode.", 0);
|
"rescue", "Go back to the rescue mode.", 0);
|
||||||
|
|
||||||
grub_register_command ("set", set_command, GRUB_COMMAND_FLAG_BOTH,
|
grub_register_command ("set", set_command, GRUB_COMMAND_FLAG_BOTH,
|
||||||
"set [ENVVAR=VALUE]", "Set an environment variable.", 0);
|
"set [ENVVAR=VALUE]",
|
||||||
|
"Set an environment variable.", 0);
|
||||||
|
|
||||||
grub_register_command ("unset", unset_command, GRUB_COMMAND_FLAG_BOTH,
|
grub_register_command ("unset", unset_command, GRUB_COMMAND_FLAG_BOTH,
|
||||||
"unset ENVVAR", "Remove an environment variable.", 0);
|
"unset ENVVAR", "Remove an environment variable.", 0);
|
||||||
|
|
||||||
grub_register_command ("insmod", insmod_command, GRUB_COMMAND_FLAG_BOTH,
|
grub_register_command ("insmod", insmod_command, GRUB_COMMAND_FLAG_BOTH,
|
||||||
"insmod MODULE|FILE", "Insert a module.", 0);
|
"insmod MODULE",
|
||||||
|
"Insert a module. The argument can be a file or a module name.",
|
||||||
|
0);
|
||||||
|
|
||||||
grub_register_command ("rmmod", rmmod_command, GRUB_COMMAND_FLAG_BOTH,
|
grub_register_command ("rmmod", rmmod_command, GRUB_COMMAND_FLAG_BOTH,
|
||||||
"rmmod MODULE", "Remove a module.", 0);
|
"rmmod MODULE", "Remove a module.", 0);
|
||||||
|
|
Loading…
Reference in a new issue