From 4a1d09ae22b0781a9b2f4790eff0683a79faa736 Mon Sep 17 00:00:00 2001 From: Wichert Akkerman Date: Wed, 13 Oct 1999 18:37:47 +0000 Subject: [PATCH] Add an option to show the diff between old and new conffile --- ChangeLog | 5 +++++ include/dpkg.h.in | 2 ++ main/configure.c | 15 +++++++++++++++ split/info.c | 3 ++- 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e25e02d8..60349b5b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,11 @@ Wed Oct 13 17:51:17 CEST 1999 Wichert Akkerman wrong package + fix findbreakcycle to remove cycles even for packages we are not changing +Mon Oct 11 22:19:01 CEST 1999 Wichert Akkerman + + * Add the option to show a diff of the old and new conffile when + configuring a package + Tue Oct 12 17:15:08 CEST 1999 Wichert Akkerman * don't die if we can't open a package in dpkg-scanpackages, just print diff --git a/include/dpkg.h.in b/include/dpkg.h.in index 4c91940c..cef8dfb1 100644 --- a/include/dpkg.h.in +++ b/include/dpkg.h.in @@ -91,6 +91,8 @@ #define NOJOBCTRLSTOPENV "DPKG_NO_TSTP" #define SHELLENV "SHELL" #define DEFAULTSHELL "sh" +#define PAGERENV "PAGER" +#define DEFAULTPAGER "pager" #define IMETHODMAXLEN 50 #define IOPTIONMAXLEN IMETHODMAXLEN diff --git a/main/configure.c b/main/configure.c index 6565fde6..c5b4fbae 100644 --- a/main/configure.c +++ b/main/configure.c @@ -236,6 +236,7 @@ void deferred_configure(struct pkginfo *pkg) { _(" What would you like to do about it ? Your options are:\n" " Y or I : install the package maintainer's version\n" " N or O : keep your currently-installed version\n" + " D : show the differences between the versions\n" " Z : background this process to examine the situation\n")); if (what & cfof_keep) @@ -269,6 +270,20 @@ void deferred_configure(struct pkginfo *pkg) { /* fixme: say something if silently not install */ + if (cc == 'd') { + if (!(c1= m_fork())) { + const char* p; + char cmdbuf[1024]; + p= getenv(PAGERENV); + if (!p || !*p) p= DEFAULTPAGER; + sprintf(cmdbuf, "diff -u %.250s %.250s | %.250s", cdr.buf, cdr2.buf, p); + execlp(s,s,"-c", cmdbuf); + ohshite(_("failed to run diff (%.250s)"), cmdbuf); + } + while ((r= waitpid(c1,&status,0)) == -1 && errno == EINTR); + if (r != c1) { onerr_abort++; ohshite(_("wait for shell failed")); } + } + if (cc == 'z') { strcpy(cdr2rest, DPKGNEWEXT); diff --git a/split/info.c b/split/info.c index 8491cddb..50197d7a 100644 --- a/split/info.c +++ b/split/info.c @@ -82,8 +82,9 @@ struct partinfo *read_info(FILE *partfile, const char *fn, struct partinfo *ir) int c; struct stat stab; - if (fread(magicbuf,1,sizeof(PARTMAGIC)-1,partfile) != sizeof(PARTMAGIC)-1) + if (fread(magicbuf,1,sizeof(PARTMAGIC)-1,partfile) != sizeof(PARTMAGIC)-1) { if (ferror(partfile)) rerr(fn); else return 0; + } if (memcmp(magicbuf,PARTMAGIC,sizeof(magicbuf))) return 0; if (fseek(partfile,-sizeof(arh.ar_name),SEEK_CUR)) ohshite(_("unable to seek back")); -- 2.39.5