This patch makes the completion code adding a '/' to a valid drive,
allowing further <TAB>ing.
KR
--
Klaus Reichl @ HOME email: [EMAIL PROTECTED]
ChangeLog:
* stage2/disk_io.c (check_and_complete_partition): Try to open the
partition and if successful add a '/', to allow further <TAB>ing.
(print_completions): Use it for floppies and disks.
* stage2/char_io.c (get_cmdline): Reset ERRNUM if
PRINT_COMPLETIONS fail.
Patch:
diff -ru --exclude-from=exclude.grub grub-99-11-06/stage2/char_io.c
grub/stage2/char_io.c
--- grub-99-11-06/stage2/char_io.c Sat Nov 6 17:11:46 1999
+++ grub/stage2/char_io.c Sat Nov 6 21:03:00 1999
@@ -419,6 +419,10 @@
print_completions (is_filename, 0);
}
}
+ else
+ /* if print_completions signals an error make sure we
+ don't leave this hanging */
+ errnum = ERR_NONE;
/* Restore the command-line. */
if (equal_pos >= 0)
diff -ru --exclude-from=exclude.grub grub-99-11-06/stage2/disk_io.c
grub/stage2/disk_io.c
--- grub-99-11-06/stage2/disk_io.c Sat Nov 6 17:11:46 1999
+++ grub/stage2/disk_io.c Sat Nov 6 21:12:54 1999
@@ -1005,6 +1005,28 @@
* any sane combination of the two.
*/
+static int
+check_and_complete_partition (char * ptr)
+{
+ if (open_partition ())
+ {
+ /* OK add the '/' */
+ if (*(ptr - 1) != ')')
+ {
+ *ptr++ = ')';
+ *ptr = 0;
+ }
+ if (*(ptr - 1) != '/')
+ {
+ *ptr++ = '/';
+ *ptr = 0;
+ }
+ return 1;
+ }
+ else
+ return 0;
+}
+
int
print_completions (int is_filename, int is_completion)
{
@@ -1104,8 +1126,7 @@
}
else
{
- *ptr++ = ')';
- *ptr = 0;
+ check_and_complete_partition (ptr);
}
}
}
@@ -1131,18 +1152,7 @@
}
}
else
- {
- if (open_partition ())
- {
- unique = 1;
- ptr = buf + grub_strlen (buf);
- if (*(ptr - 1) != ')')
- {
- *ptr++ = ')';
- *ptr = 0;
- }
- }
- }
+ unique = check_and_complete_partition (buf + grub_strlen (buf));
}
}
else if (ptr && *ptr == '/')