diff options
author | rse <rse@FreeBSD.org> | 2006-08-05 12:50:38 +0000 |
---|---|---|
committer | rse <rse@FreeBSD.org> | 2006-08-05 12:50:38 +0000 |
commit | 16e908679a7976ba0bdda9f7c61a40fdf5924f4a (patch) | |
tree | 80e796539a757f61593c1a2f4017cf9eaee700e8 /sbin/dump | |
parent | 960ae2041b787cb60b901fe959953227d93b8988 (diff) | |
download | FreeBSD-src-16e908679a7976ba0bdda9f7c61a40fdf5924f4a.zip FreeBSD-src-16e908679a7976ba0bdda9f7c61a40fdf5924f4a.tar.gz |
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)
Diffstat (limited to 'sbin/dump')
-rw-r--r-- | sbin/dump/optr.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sbin/dump/optr.c b/sbin/dump/optr.c index 3dc17b6..0d70b9e 100644 --- a/sbin/dump/optr.c +++ b/sbin/dump/optr.c @@ -190,6 +190,7 @@ timeest(void) { double percent; time_t tnow, tdone; + char *tdone_str; int deltat, hours, mins; (void)time(&tnow); @@ -207,15 +208,16 @@ timeest(void) hours = deltat / 3600; mins = (deltat % 3600) / 60; + tdone_str = ctime(&tdone); setproctitle( - "%s: pass %d: %3.2f%% done, finished in %d:%02d at %s", - disk, passno, percent, hours, mins, ctime(&tdone)); + "%s: pass %d: %3.2f%% done, finished in %d:%02d at %.*s", + disk, passno, percent, hours, mins, strlen(tdone_str) - 1, tdone_str); if (tnow >= tschedule) { tschedule = tnow + 300; if (blockswritten < 500) return; msg("%3.2f%% done, finished in %d:%02d at %s", percent, - hours, mins, ctime(&tdone)); + hours, mins, tdone_str); } } } |