[pacman-dev] CVS update of pacman-lib/src/pacman (log.c pacman.c trans.c)
Date: Friday, February 9, 2007 @ 11:02:01 Author: aaron Path: /home/cvs-pacman/pacman-lib/src/pacman Modified: log.c (1.27 -> 1.28) pacman.c (1.89 -> 1.90) trans.c (1.32 -> 1.33) * Cleaned up direct pm_fprintf usage (move to MSG/ERR macros for now) * Moved some stderr output to stdout * Remove "RETRIEVE_LOCAL" trans event as libdownload handles local files ----------+ log.c | 4 +++- pacman.c | 7 ++++--- trans.c | 29 +++++------------------------ 3 files changed, 12 insertions(+), 28 deletions(-) Index: pacman-lib/src/pacman/log.c diff -u pacman-lib/src/pacman/log.c:1.27 pacman-lib/src/pacman/log.c:1.28 --- pacman-lib/src/pacman/log.c:1.27 Sat Feb 3 22:24:32 2007 +++ pacman-lib/src/pacman/log.c Fri Feb 9 11:02:01 2007 @@ -173,7 +173,9 @@ va_start(args, fmt); vsnprintf(str, LOG_STR_LEN, fmt, args); va_end(args); - pm_fprintf(stderr, NL, str); + + /* Use stderr so questions are always displayed when redirecting output */ + ERR(NL, str); if(fgets(response, 32, stdin)) { /* trim whitespace and newlines */ Index: pacman-lib/src/pacman/pacman.c diff -u pacman-lib/src/pacman/pacman.c:1.89 pacman-lib/src/pacman/pacman.c:1.90 --- pacman-lib/src/pacman/pacman.c:1.89 Thu Feb 8 00:24:18 2007 +++ pacman-lib/src/pacman/pacman.c Fri Feb 9 11:02:01 2007 @@ -184,6 +184,7 @@ return; } if(signum != 0 && config->op_d_vertest == 0) { + /* TODO why is this here? */ fprintf(stderr, "\n"); } @@ -295,7 +296,7 @@ case 2: logmask |= PM_LOG_DOWNLOAD; /*fall through */ case 1: logmask |= PM_LOG_DEBUG; break; default: - pm_fprintf(stderr, NL, _("error: '%s' is not a valid debug level"), optarg); + ERR(NL, _("error: '%s' is not a valid debug level"), optarg); return(1); } printf("logmask = %d\n", logmask); @@ -331,7 +332,7 @@ break; case 'b': if(stat(optarg, &st) == -1 || !S_ISDIR(st.st_mode)) { - pm_fprintf(stderr, NL, _("error: '%s' is not a valid db path\n"), optarg); + ERR(NL, _("error: '%s' is not a valid db path\n"), optarg); return(1); } alpm_option_set_dbpath(optarg); @@ -361,7 +362,7 @@ break; case 'r': if(realpath(optarg, root) == NULL) { - pm_fprintf(stderr, NL, _("error: '%s' is not a valid root path\n"), optarg); + ERR(NL, _("error: '%s' is not a valid root path\n"), optarg); return(1); } alpm_option_set_root(strdup(root)); Index: pacman-lib/src/pacman/trans.c diff -u pacman-lib/src/pacman/trans.c:1.32 pacman-lib/src/pacman/trans.c:1.33 --- pacman-lib/src/pacman/trans.c:1.32 Thu Feb 8 15:44:47 2007 +++ pacman-lib/src/pacman/trans.c Fri Feb 9 11:02:01 2007 @@ -41,22 +41,6 @@ static int prevpercent=0; /* for less progressbar output */ -/* refactored function from cb_trans_evt */ -static void retrieve_local(void *data1, void *data2) -{ - const unsigned int maxcols = getcols(); - char out[PATH_MAX]; - unsigned int i; - - MSG(NL, " %s [", (char*)data1); - STRNCPY(out, (char*)data2, maxcols-42); - MSG(CL, "%s", out); - for(i = strlen(out); i < maxcols-43; i++) { - MSG(CL, " "); - } - fputs(_("] 100% LOCAL "), stdout); -} - /* Callback to handle transaction events */ void cb_trans_evt(pmtransevt_t event, void *data1, void *data2) @@ -65,7 +49,7 @@ switch(event) { case PM_TRANS_EVT_CHECKDEPS_START: - pm_fprintf(stderr, NL, _("checking dependencies... ")); + MSG(NL, _("checking dependencies... ")); break; case PM_TRANS_EVT_FILECONFLICTS_START: if(config->noprogressbar) { @@ -73,13 +57,13 @@ } break; case PM_TRANS_EVT_CLEANUP_START: - pm_fprintf(stderr, NL, _("cleaning up... ")); + MSG(NL, _("cleaning up... ")); break; case PM_TRANS_EVT_RESOLVEDEPS_START: - pm_fprintf(stderr, NL, _("resolving dependencies... ")); + MSG(NL, _("resolving dependencies... ")); break; case PM_TRANS_EVT_INTERCONFLICTS_START: - pm_fprintf(stderr, NL, _("looking for inter-conflicts... ")); + MSG(NL, _("looking for inter-conflicts... ")); break; case PM_TRANS_EVT_FILECONFLICTS_DONE: if(config->noprogressbar) { @@ -90,7 +74,7 @@ case PM_TRANS_EVT_CLEANUP_DONE: case PM_TRANS_EVT_RESOLVEDEPS_DONE: case PM_TRANS_EVT_INTERCONFLICTS_DONE: - pm_fprintf(stderr, CL, _("done.\n")); + MSG(CL, _("done.\n")); break; case PM_TRANS_EVT_EXTRACT_DONE: if(config->noprogressbar) { @@ -167,9 +151,6 @@ MSG(NL, _(":: Retrieving packages from %s...\n"), (char*)data1); fflush(stdout); break; - case PM_TRANS_EVT_RETRIEVE_LOCAL: - retrieve_local(data1, data2); - break; } }
participants (1)
-
Aaron Griffin