Allow Ctrl-C to be used to abort a "sleep" command.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
#include <ipxe/command.h>
#include <ipxe/parseopt.h>
#include <ipxe/settings.h>
+#include <ipxe/console.h>
+#include <ipxe/keys.h>
+#include <ipxe/process.h>
#include <ipxe/nap.h>
#include <ipxe/shell.h>
/* Delay for specified number of seconds */
start = currticks();
delay = ( seconds * TICKS_PER_SEC );
- while ( ( currticks() - start ) <= delay )
+ while ( ( currticks() - start ) <= delay ) {
+ step();
+ if ( iskey() && ( getchar() == CTRL_C ) )
+ return -ECANCELED;
cpu_nap();
+ }
return 0;
}