Explorar o código

* main/processarc.c: fixes calculation of package filename display (the
".../foo.deb" one) where it was showing the full path if the basename
was longer than 30 chars. Now shows just the basename if it can't
squeez the full path to < 30 chars (even if the basename is > than 30
chars)

Ben Collins %!s(int64=27) %!d(string=hai) anos
pai
achega
e46197af04
Modificáronse 2 ficheiros con 12 adicións e 6 borrados
  1. 8 0
      ChangeLog
  2. 4 6
      main/processarc.c

+ 8 - 0
ChangeLog

@@ -1,3 +1,11 @@
+Mon Oct 25 06:50:17 EDT 1999 Ben Collins <bcollins.debian.org>
+
+  * main/processarc.c: fixes calculation of package filename display (the
+    ".../foo.deb" one) where it was showing the full path if the basename
+    was longer than 30 chars. Now shows just the basename if it can't
+    squeez the full path to < 30 chars (even if the basename is > than 30
+    chars)
+
 Sun Oct 24 20:46:44 EDT 1999 Ben Collins <bcollins.debian.org>
 
   * scripts/dpkg-source.pl: we want to 'delete' the POSIXLY_CORRECT env

+ 4 - 6
main/processarc.c

@@ -68,7 +68,7 @@ void process_archive(const char *filename) {
   struct pkginfo *pkg, *otherpkg, *divpkg;
   struct conflict *conflictor, *cflict;
   char *cidir, *cidirrest, *p;
-  char pfilenamebuf[35], conffilenamebuf[MAXCONFFILENAME];
+  char *pfilenamebuf, conffilenamebuf[MAXCONFFILENAME];
   const char *pfilename, *newinfofilename;
   struct fileinlist *newconff, **newconffileslastp;
   struct fileinlist *cfile;
@@ -88,13 +88,11 @@ void process_archive(const char *filename) {
   cleanup_pkg_failed= cleanup_conflictor_failed= 0;
   admindirlen= strlen(admindir);
 
-  pfilename= filename;
-  while (strlen(pfilename) > sizeof(pfilenamebuf)-5) {
+  for (pfilename= filename ; pfilename && strlen(pfilename) > 30 &&
+      strchr(pfilename,'/') != NULL ; pfilename++ )
     pfilename= strchr(pfilename,'/');
-    if (!pfilename) break;
-    pfilename++;
-  }
   if (pfilename && pfilename != filename) {
+    pfilenamebuf= (char *)nfmalloc(strlen(pfilename)+5);
     strcpy(pfilenamebuf,".../");
     strcat(pfilenamebuf,pfilename);
     pfilename= pfilenamebuf;