From 452329ad118138b8736d30d53cfd36faed36ae51 Mon Sep 17 00:00:00 2001 From: "Ralf S. Engelschall" Date: Sat, 5 Aug 2006 12:50:38 +0000 Subject: [PATCH] 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) --- sbin/dump/optr.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sbin/dump/optr.c b/sbin/dump/optr.c index 3dc17b67db67..0d70b9e7be05 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); } } }