I have a different patch with the BUILTIN_HIDDEN flag set that looks slightly
better and follows the grub (and GNU) coding style a little better.


I think that doing any kind of a countdown would be too much of a hack for a 
bootloader.  I would rather keep it simple rather than full of toys.

Thanks,
Matthias

Index: grub/stage2/builtins.c
===================================================================
RCS file: /cvs/grub/stage2/builtins.c,v
retrieving revision 1.102
diff -u -r1.102 builtins.c
--- grub/stage2/builtins.c	2001/01/06 22:14:59	1.102
+++ grub/stage2/builtins.c	2001/01/07 03:45:38
@@ -779,6 +779,41 @@
 };
 
 
+/* delay */
+static int
+delay_func (char *arg, int flags)
+{
+  int delay_timeout, time1, time2 = -1;
+  if (! safe_parse_maxint (&arg, &delay_timeout))
+    return 1;
+
+  while ((time1 = getrtsecs()) == 0xFF);
+  while (1)
+    {
+      if (delay_timeout >= 0 && (time1 = getrtsecs()) != time2 && time1 != 0xFF)
+	{
+	  if (delay_timeout <= 0)
+	    {
+	      delay_timeout = -1;
+	      break;
+	    }
+	  delay_timeout--;
+	  time2  = time1;
+	}
+    }
+  return 0;
+}
+
+static struct builtin builtin_delay =
+{
+  "delay",
+  delay_func,
+  BUILTIN_MENU | BUILTIN_CMDLINE | BUILTIN_HIDDEN,
+  "delay SEC",
+  "Pause for a timeout, in SEC seconds, before continuing."
+};
+
+
 #ifdef GRUB_UTIL
 /* device */
 static int
@@ -937,6 +972,24 @@
 };
 
 
+/* echo */
+static int
+echo_func (char *arg, int flags)
+{
+  grub_printf ("%s\n", arg);
+  return 0;
+}
+
+static struct builtin builtin_echo =
+{
+  "echo",
+  echo_func,
+  BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HIDDEN,
+  "echo [MESSAGE]",
+  "Print MESSAGE"
+};
+
+
 static char embed_info[32];
 /* embed */
 /* Embed a Stage 1.5 in the first cylinder after MBR or in the
@@ -4096,6 +4149,7 @@
 #endif /* SUPPORT_NETBOOT */
 
 
+
 /* timeout */
 static int
 timeout_func (char *arg, int flags)
@@ -4320,6 +4374,7 @@
   &builtin_configfile,
   &builtin_debug,
   &builtin_default,
+  &builtin_delay,
 #ifdef GRUB_UTIL
   &builtin_device,
 #endif /* GRUB_UTIL */
@@ -4328,6 +4383,7 @@
 #endif /* SUPPORT_NETBOOT */
   &builtin_displayapm,
   &builtin_displaymem,
+	&builtin_echo,
   &builtin_embed,
   &builtin_fallback,
   &builtin_find,


Reply via email to