Date: Saturday, February 10, 2007 @ 04:34:59 Author: aaron Path: /home/cvs-pacman/pacman-lib/src/pacman Modified: Makefile.am (1.13 -> 1.14) downloadprog.c (1.13 -> 1.14) log.c (1.28 -> 1.29) util.c (1.28 -> 1.29) Cleaned up some more output * Questions no longer start with "error:" * downloaded size is output as a float now ----------------+ Makefile.am | 8 ++++---- downloadprog.c | 20 +++++++++++--------- log.c | 2 +- util.c | 4 +++- 4 files changed, 19 insertions(+), 15 deletions(-) Index: pacman-lib/src/pacman/Makefile.am diff -u pacman-lib/src/pacman/Makefile.am:1.13 pacman-lib/src/pacman/Makefile.am:1.14 --- pacman-lib/src/pacman/Makefile.am:1.13 Mon Jan 29 17:18:32 2007 +++ pacman-lib/src/pacman/Makefile.am Sat Feb 10 04:34:59 2007 @@ -16,10 +16,10 @@ pacman_static_SOURCES = $(pacman_SOURCES) -pacman_LDADD = -L$(top_builddir)/lib/libalpm/.libs \ - -ldownload -lalpm +pacman_LDADD = $(top_builddir)/lib/libalpm/.libs/libalpm.so \ + -ldownload -pacman_static_LDADD = -L$(top_builddir)/lib/libalpm/.libs/ \ - -ldownload -lalpm +pacman_static_LDADD = $(top_builddir)/lib/libalpm/.libs/libalpm.la \ + -ldownload pacman_static_LDFLAGS = $(LDFLAGS) -all-static Index: pacman-lib/src/pacman/downloadprog.c diff -u pacman-lib/src/pacman/downloadprog.c:1.13 pacman-lib/src/pacman/downloadprog.c:1.14 --- pacman-lib/src/pacman/downloadprog.c:1.13 Thu Feb 8 15:44:47 2007 +++ pacman-lib/src/pacman/downloadprog.c Sat Feb 10 04:34:59 2007 @@ -53,7 +53,7 @@ const int infolen = 50; char *fname, *p; - float rate = 0.0, timediff = 0.0; + float rate = 0.0, timediff = 0.0, f_xfered = 0.0; unsigned int eta_h = 0, eta_m = 0, eta_s = 0; int percent; char rate_size = 'K', xfered_size = 'K'; @@ -112,11 +112,13 @@ eta_s -= eta_m * 60; fname = strdup(filename); + /* strip extension if it's there + * NOTE: in the case of package files, only the pkgname is sent now */ if((p = strstr(fname, PM_EXT_PKG)) || (p = strstr(fname, PM_EXT_DB))) { *p = '\0'; } if(strlen(fname) > FILENAME_TRIM_LEN) { - fname[FILENAME_TRIM_LEN] = '\0'; + strcpy(fname + FILENAME_TRIM_LEN -3,"..."); } /* Awesome formatting for progress bar. We need a mess of Kb->Mb->Gb stuff @@ -132,13 +134,13 @@ } } - xfered /= 1024; /* convert to K by default */ + f_xfered = (float) xfered / 1024.0; /* convert to K by default */ /* xfered_size = 'K'; was set above */ - if(xfered > 2048) { - xfered /= 1024; + if(f_xfered > 2048.0) { + f_xfered /= 1024.0; xfered_size = 'M'; - if(xfered > 2048) { - xfered /= 1024; + if(f_xfered > 2048.0) { + f_xfered /= 1024.0; xfered_size = 'G'; /* I should seriously hope that archlinux packages never break * the 9999.9GB mark... we'd have more serious problems than the progress @@ -146,8 +148,8 @@ } } - printf(" %-*s %6d%c %#6.1f%c/s %02u:%02u:%02u", FILENAME_TRIM_LEN, fname, - xfered, xfered_size, rate, rate_size, eta_h, eta_m, eta_s); + printf(" %-*s %6.1f%c %#6.1f%c/s %02u:%02u:%02u", FILENAME_TRIM_LEN, fname, + f_xfered, xfered_size, rate, rate_size, eta_h, eta_m, eta_s); free(fname); Index: pacman-lib/src/pacman/log.c diff -u pacman-lib/src/pacman/log.c:1.28 pacman-lib/src/pacman/log.c:1.29 --- pacman-lib/src/pacman/log.c:1.28 Fri Feb 9 11:02:01 2007 +++ pacman-lib/src/pacman/log.c Sat Feb 10 04:34:59 2007 @@ -175,7 +175,7 @@ va_end(args); /* Use stderr so questions are always displayed when redirecting output */ - ERR(NL, str); + pm_fprintf(stderr, NL, str); \ if(fgets(response, 32, stdin)) { /* trim whitespace and newlines */ Index: pacman-lib/src/pacman/util.c diff -u pacman-lib/src/pacman/util.c:1.28 pacman-lib/src/pacman/util.c:1.29 --- pacman-lib/src/pacman/util.c:1.28 Thu Feb 8 15:44:48 2007 +++ pacman-lib/src/pacman/util.c Sat Feb 10 04:34:59 2007 @@ -418,10 +418,12 @@ printf("-"); } } - printf("] %3d%%\r", percent); + printf("] %3d%%", percent); if(percent == 100) { printf("\n"); + } else { + printf("\r"); } fflush(stdout); }