|
@@ -53,7 +53,7 @@ struct interface monojob = INTF_INIT ( monojob_intf_desc );
|
53
|
53
|
/**
|
54
|
54
|
* Wait for single foreground job to complete
|
55
|
55
|
*
|
56
|
|
- * @v string Job description to display
|
|
56
|
+ * @v string Job description to display, or NULL to be silent
|
57
|
57
|
* @ret rc Job final status code
|
58
|
58
|
*/
|
59
|
59
|
int monojob_wait ( const char *string ) {
|
|
@@ -67,7 +67,8 @@ int monojob_wait ( const char *string ) {
|
67
|
67
|
unsigned int percentage;
|
68
|
68
|
int shown_percentage = 0;
|
69
|
69
|
|
70
|
|
- printf ( "%s...", string );
|
|
70
|
+ if ( string )
|
|
71
|
+ printf ( "%s...", string );
|
71
|
72
|
monojob_rc = -EINPROGRESS;
|
72
|
73
|
last_progress = currticks();
|
73
|
74
|
while ( monojob_rc == -EINPROGRESS ) {
|
|
@@ -83,7 +84,7 @@ int monojob_wait ( const char *string ) {
|
83
|
84
|
}
|
84
|
85
|
}
|
85
|
86
|
elapsed = ( currticks() - last_progress );
|
86
|
|
- if ( elapsed >= TICKS_PER_SEC ) {
|
|
87
|
+ if ( string && ( elapsed >= TICKS_PER_SEC ) ) {
|
87
|
88
|
if ( shown_percentage )
|
88
|
89
|
printf ( "\b\b\b\b \b\b\b\b" );
|
89
|
90
|
job_progress ( &monojob, &progress );
|
|
@@ -106,10 +107,13 @@ int monojob_wait ( const char *string ) {
|
106
|
107
|
if ( shown_percentage )
|
107
|
108
|
printf ( "\b\b\b\b \b\b\b\b" );
|
108
|
109
|
|
109
|
|
- if ( rc ) {
|
110
|
|
- printf ( " %s\n", strerror ( rc ) );
|
111
|
|
- } else {
|
112
|
|
- printf ( " ok\n" );
|
|
110
|
+ if ( string ) {
|
|
111
|
+ if ( rc ) {
|
|
112
|
+ printf ( " %s\n", strerror ( rc ) );
|
|
113
|
+ } else {
|
|
114
|
+ printf ( " ok\n" );
|
|
115
|
+ }
|
113
|
116
|
}
|
|
117
|
+
|
114
|
118
|
return rc;
|
115
|
119
|
}
|