]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
reset key mappings, when the user specifies no argument to setkey.
authorokuji <okuji@localhost>
Sat, 14 Oct 2000 08:09:43 +0000 (08:09 +0000)
committerokuji <okuji@localhost>
Sat, 14 Oct 2000 08:09:43 +0000 (08:09 +0000)
ChangeLog
stage2/builtins.c

index f31774639702b5cdc52bc21679231cc26ad94b7f..aad64adb6ef70a5c9223f990a4e8d9aea7f2724f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2000-10-14  OKUJI Yoshinori  <okuji@gnu.org>
+
+       * stage2/builtins.c (setkey_func): If TO_KEY is NULL (i.e. the
+       user specifies no argument), clear BIOS_KEY_MAP and
+       ASCII_KEY_MAP.
+       If TO_KEY is non-NULL but FROM_KEY is NULL, set ERRNUM to
+       ERR_BAD_ARGUMENT and return one.
+       
 2000-10-13  OKUJI Yoshinori  <okuji@gnu.org>
 
        * docs/grub.texi: Added an entry for the new chapter "Security",
index 5eee56dfa94e4f15d69de5f7b107bf4cf8156577..5bfa2db93851be76f4d58933588cbaf6efa818d8 100644 (file)
@@ -3212,6 +3212,21 @@ setkey_func (char *arg, int flags)
   
   to_key = arg;
   from_key = skip_to (0, to_key);
+
+  if (! to_key)
+    {
+      /* If the user specifies no argument, reset the key mappings.  */
+      bios_key_map[0] = 0;
+      ascii_key_map[0] = 0;
+
+      return 0;
+    }
+  else if (! from_key)
+    {
+      /* The user must specify two arguments or zero argument.  */
+      errnum = ERR_BAD_ARGUMENT;
+      return 1;
+    }
   
   nul_terminate (to_key);
   nul_terminate (from_key);
@@ -3301,7 +3316,7 @@ static struct builtin builtin_setkey =
   "setkey",
   setkey_func,
   BUILTIN_CMDLINE | BUILTIN_MENU,
-  "setkey TO_KEY FROM_KEY",
+  "setkey [TO_KEY FROM_KEY]",
   "Change the keyboard map. The key FROM_KEY is mapped to the key TO_KEY."
   " A key must be an alphabet, a digit, or one of these: escape, exclam,"
   " at, numbersign, dollar, percent, caret, ampersand, asterisk, parenleft,"
@@ -3309,7 +3324,8 @@ static struct builtin builtin_setkey =
   " braceleft, bracketright, braceright, enter, control, semicolon, colon,"
   " quote, doublequote, backquote, tilde, shift, backslash, bar, comma,"
   " less, period, greater, slash, question, alt, space, capslock, FX (X"
-  " is a digit), and delete."
+  " is a digit), and delete. If no argument is specified, reset key"
+  " mappings."
 };
 
 \f