summaryrefslogtreecommitdiffstats
path: root/src/core/monojob.c
diff options
context:
space:
mode:
authorMichael Brown2008-07-24 21:08:31 +0200
committerMichael Brown2008-07-24 21:08:31 +0200
commit702e0be44ed44a7625ceae96827878b41859e3f6 (patch)
treeb0ce92a684a2275755ed2819ad0395e9e85d6499 /src/core/monojob.c
parent[cmdline] Minor tidy-ups to shell_banner.c (diff)
downloadipxe-702e0be44ed44a7625ceae96827878b41859e3f6.tar.gz
ipxe-702e0be44ed44a7625ceae96827878b41859e3f6.tar.xz
ipxe-702e0be44ed44a7625ceae96827878b41859e3f6.zip
[ui] Add progress dots while waiting on any foreground job
Print one dot per second while waiting in monojob.c (e.g. for DHCP, for file downloads, etc.), to inform user that the system has not locked up. Patch contributed by Andrew Schran <aschran@google.com>, minor modification by me.
Diffstat (limited to 'src/core/monojob.c')
-rw-r--r--src/core/monojob.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/core/monojob.c b/src/core/monojob.c
index ea9bc834..2c91e132 100644
--- a/src/core/monojob.c
+++ b/src/core/monojob.c
@@ -24,6 +24,7 @@
#include <gpxe/keys.h>
#include <gpxe/job.h>
#include <gpxe/monojob.h>
+#include <gpxe/timer.h>
/** @file
*
@@ -62,9 +63,11 @@ struct job_interface monojob = {
int monojob_wait ( const char *string ) {
int key;
int rc;
+ tick_t last_progress_dot;
- printf ( "%s... ", string );
+ printf ( "%s.", string );
monojob_rc = -EINPROGRESS;
+ last_progress_dot = currticks();
while ( monojob_rc == -EINPROGRESS ) {
step();
if ( iskey() ) {
@@ -78,14 +81,18 @@ int monojob_wait ( const char *string ) {
break;
}
}
+ if ( ( currticks() - last_progress_dot ) > TICKS_PER_SEC ) {
+ printf ( "." );
+ last_progress_dot = currticks();
+ }
}
rc = monojob_rc;
done:
if ( rc ) {
- printf ( "%s\n", strerror ( rc ) );
+ printf ( " %s\n", strerror ( rc ) );
} else {
- printf ( "ok\n" );
+ printf ( " ok\n" );
}
return rc;
}