From 4f1606d87cd6aa7913ccb95ce99d3936f33b3a84 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Tue, 1 Jul 2008 09:27:56 +0300 Subject: [PATCH] dpkg: Use the debug function instead of reimplementing its logic --- ChangeLog | 6 ++++++ src/depcon.c | 13 ++++++++++--- src/help.c | 12 +++++++++--- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 99f2f217..1098a094 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-07-01 Guillem Jover + + * src/depcon.c (findbreakcyclerecursive): Use the debug function + instead of reimplementing its logic. + * src/help.c (preexecscript): Likewise. + 2008-07-01 Egmont Koblinger * src/processarc.c (process_archive): Properly lstat the correct diff --git a/src/depcon.c b/src/depcon.c index 2930c5c6..c145501a 100644 --- a/src/depcon.c +++ b/src/depcon.c @@ -102,9 +102,16 @@ static int findbreakcyclerecursive(struct pkginfo *pkg, struct cyclesofarlink *s pkg->color = gray; if (f_debug & dbg_depcondetail) { - fprintf(stderr,"D0%05o: findbreakcyclerecursive %s ",dbg_depcondetail,pkg->name); - for (sol=sofar; sol; sol=sol->back) fprintf(stderr," <- %s",sol->pkg->name); - fprintf(stderr,"\n"); + struct varbuf str_pkgs = VARBUF_INIT; + + for (sol = sofar; sol; sol = sol->back) { + varbufaddstr(&str_pkgs, " <- "); + varbufaddstr(&str_pkgs, sol->pkg->name); + } + varbufaddc(&str_pkgs, '\0'); + debug(dbg_depcondetail, "findbreakcyclerecursive %s %s", pkg->name, + str_pkgs.buf); + varbuffree(&str_pkgs); } thislink.pkg= pkg; thislink.back= sofar; diff --git a/src/help.c b/src/help.c index 0e6f2292..26385cb5 100644 --- a/src/help.c +++ b/src/help.c @@ -155,9 +155,15 @@ static const char* preexecscript(const char *path, char *const *argv) { if (chroot(instdir)) ohshite(_("failed to chroot to `%.250s'"),instdir); } if (f_debug & dbg_scripts) { - fprintf(stderr,"D0%05o: fork/exec %s (",dbg_scripts,path); - while (*++argv) fprintf(stderr," %s",*argv); - fputs(" )\n",stderr); + struct varbuf args = VARBUF_INIT; + + while (*++argv) { + varbufaddc(&args, ' '); + varbufaddstr(&args, *argv); + } + varbufaddc(&args, '\0'); + debug(dbg_scripts, "fork/exec %s (%s )", path, args.buf); + varbuffree(&args); } instdirl= strlen(instdir); if (!instdirl) return path; -- 2.39.5