Do not pass-through the tailing newline character from the ctime(3)
output to setproctitle(3) in order to get rid of the ugly two-character escape sequence "\n" in the ps(1) output of a dump(8) process: << [...] finished in 0:00 at Sat Aug 5 14:44:39 2006\n (dump) >> [...] finished in 0:00 at Sat Aug 5 14:44:39 2006 (dump)
This commit is contained in:
parent
392cb477c3
commit
452329ad11
@ -190,6 +190,7 @@ timeest(void)
|
|||||||
{
|
{
|
||||||
double percent;
|
double percent;
|
||||||
time_t tnow, tdone;
|
time_t tnow, tdone;
|
||||||
|
char *tdone_str;
|
||||||
int deltat, hours, mins;
|
int deltat, hours, mins;
|
||||||
|
|
||||||
(void)time(&tnow);
|
(void)time(&tnow);
|
||||||
@ -207,15 +208,16 @@ timeest(void)
|
|||||||
hours = deltat / 3600;
|
hours = deltat / 3600;
|
||||||
mins = (deltat % 3600) / 60;
|
mins = (deltat % 3600) / 60;
|
||||||
|
|
||||||
|
tdone_str = ctime(&tdone);
|
||||||
setproctitle(
|
setproctitle(
|
||||||
"%s: pass %d: %3.2f%% done, finished in %d:%02d at %s",
|
"%s: pass %d: %3.2f%% done, finished in %d:%02d at %.*s",
|
||||||
disk, passno, percent, hours, mins, ctime(&tdone));
|
disk, passno, percent, hours, mins, strlen(tdone_str) - 1, tdone_str);
|
||||||
if (tnow >= tschedule) {
|
if (tnow >= tschedule) {
|
||||||
tschedule = tnow + 300;
|
tschedule = tnow + 300;
|
||||||
if (blockswritten < 500)
|
if (blockswritten < 500)
|
||||||
return;
|
return;
|
||||||
msg("%3.2f%% done, finished in %d:%02d at %s", percent,
|
msg("%3.2f%% done, finished in %d:%02d at %s", percent,
|
||||||
hours, mins, ctime(&tdone));
|
hours, mins, tdone_str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user