Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-4]: src/usr.sbin/pkg_install/lib Pull up revisions 1.22-1.23 (r...



details:   https://anonhg.NetBSD.org/src/rev/d473bd2cc116
branches:  netbsd-1-4
changeset: 470836:d473bd2cc116
user:      he <he%NetBSD.org@localhost>
date:      Mon Jul 31 18:19:17 2000 +0000

description:
Pull up revisions 1.22-1.23 (requested by hubertf):
  Update pkg_install tools by bringing in bug fixes and feature
  additions since the last release.  Fixes PR#10083 and PR#10687
  and a number of problems not formally reported.

diffstat:

 usr.sbin/pkg_install/lib/str.c |  40 ++++++++++++++++++++++++++++++++--------
 1 files changed, 32 insertions(+), 8 deletions(-)

diffs (64 lines):

diff -r bb734fc88e8b -r d473bd2cc116 usr.sbin/pkg_install/lib/str.c
--- a/usr.sbin/pkg_install/lib/str.c    Mon Jul 31 18:19:14 2000 +0000
+++ b/usr.sbin/pkg_install/lib/str.c    Mon Jul 31 18:19:17 2000 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: str.c,v 1.14.2.6 2000/02/10 21:23:49 he Exp $  */
+/*     $NetBSD: str.c,v 1.14.2.7 2000/07/31 18:19:17 he Exp $  */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static const char *rcsid = "Id: str.c,v 1.5 1997/10/08 07:48:21 charnier Exp";
 #else
-__RCSID("$NetBSD: str.c,v 1.14.2.6 2000/02/10 21:23:49 he Exp $");
+__RCSID("$NetBSD: str.c,v 1.14.2.7 2000/07/31 18:19:17 he Exp $");
 #endif
 #endif
 
@@ -330,16 +330,40 @@
  * Also called for FTP matching
  */
 int
-findbestmatchingname_fn(const char *pkg, char *data)
+findbestmatchingname_fn(const char *found, char *best)
 {
-       char   *s1, *s2;
+       char *found_version, *best_version;
+       char *found_tgz, *best_tgz;
+       char found_no_tgz[255];
+       char best_no_tgz[255];
+
+       found_version = strrchr(found, '-') + 1;
+       found_tgz = strstr(found, ".tgz");
+       if (found_tgz) {
+               /* strip off any ".tgz" */
+               strncpy(found_no_tgz, found_version, found_tgz-found_version);
+               found_no_tgz[found_tgz-found_version] = '\0';
+               found_version = found_no_tgz;
+       }
 
-       s1 = strrchr(pkg, '-') + 1;
-       s2 = strrchr(data, '-') + 1;
+       best_version=NULL;
+       if (best && best[0] != '\0') {
+               best_version = strrchr(best, '-') + 1;
+               best_tgz = strstr(best, ".tgz");
+               if (best_tgz) {
+                       /* strip off any ".tgz" */
+                       strncpy(best_no_tgz, best_version, best_tgz-best_version);
+                       best_no_tgz[best_tgz-best_version] = '\0';
+                       best_version = best_no_tgz;
+               }
+       }
 
-       if (data[0] == '\0' || deweycmp(s1, GT, s2)) {
-               strcpy(data, pkg);
+       if (best == NULL || best[0] == '\0' || deweycmp(found_version, GT, best_version)) {
+               /* found pkg(version) is bigger than current "best"
+                * version - remember! */
+               strcpy(best, found);
        }
+
        return 0;
 }
 



Home | Main Index | Thread Index | Old Index