=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ftp/util.c,v retrieving revision 1.56 retrieving revision 1.57 diff -c -r1.56 -r1.57 *** src/usr.bin/ftp/util.c 2009/01/27 22:04:36 1.56 --- src/usr.bin/ftp/util.c 2009/04/13 01:47:04 1.57 *************** *** 1,4 **** ! /* $OpenBSD: util.c,v 1.56 2009/01/27 22:04:36 martynas Exp $ */ /* $NetBSD: util.c,v 1.12 1997/08/18 10:20:27 lukem Exp $ */ /*- --- 1,4 ---- ! /* $OpenBSD: util.c,v 1.57 2009/04/13 01:47:04 deraadt Exp $ */ /* $NetBSD: util.c,v 1.12 1997/08/18 10:20:27 lukem Exp $ */ /*- *************** *** 64,70 **** */ #if !defined(lint) && !defined(SMALL) ! static const char rcsid[] = "$OpenBSD: util.c,v 1.56 2009/01/27 22:04:36 martynas Exp $"; #endif /* not lint and not SMALL */ /* --- 64,70 ---- */ #if !defined(lint) && !defined(SMALL) ! static const char rcsid[] = "$OpenBSD: util.c,v 1.57 2009/04/13 01:47:04 deraadt Exp $"; #endif /* not lint and not SMALL */ /* *************** *** 749,754 **** --- 749,756 ---- */ static struct timeval start; + char *title; + void progressmeter(int flag) { *************** *** 763,769 **** struct timeval now, td, wait; off_t cursize, abbrevsize; double elapsed; ! int ratio, barlength, i, remaining; char buf[512]; if (flag == -1) { --- 765,771 ---- struct timeval now, td, wait; off_t cursize, abbrevsize; double elapsed; ! int ratio, barlength, i, remaining, overhead = 30; char buf[512]; if (flag == -1) { *************** *** 782,790 **** ratio = 100; ratio = MAX(ratio, 0); ratio = MIN(ratio, 100); ! snprintf(buf, sizeof(buf), "\r%3d%% ", ratio); ! barlength = ttywidth - 30; if (barlength > 0) { i = barlength * ratio / 100; snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), --- 784,807 ---- ratio = 100; ratio = MAX(ratio, 0); ratio = MIN(ratio, 100); ! if (title) { ! int l = strlen(title); ! char *dotdot = ""; ! if (l < 12) ! l = 12; ! else if (l > 25) { ! l = 22; ! dotdot = "..."; ! overhead += 3; ! } ! snprintf(buf, sizeof(buf), "\r%-*.*s%s %3d%% ", l, l, title, ! dotdot, ratio); ! overhead += l + 1; ! } else ! snprintf(buf, sizeof(buf), "\r%3d%% ", ratio); ! ! barlength = ttywidth - overhead; if (barlength > 0) { i = barlength * ratio / 100; snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),