Source-Changes-HG archive

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

[src/netbsd-1-6]: src/usr.sbin/pkg_install/lib Pull up revision 1.4 (requeste...



details:   https://anonhg.NetBSD.org/src/rev/8a762714d375
branches:  netbsd-1-6
changeset: 529508:8a762714d375
user:      tron <tron%NetBSD.org@localhost>
date:      Sun Nov 24 22:23:49 2002 +0000

description:
Pull up revision 1.4 (requested by jschauma in ticket #1011):
Do not prepend '.' to path when looking for dependencies for a package
specified without any path components. (Pointed out by Takashi Yamamoto)
Rename path_remove_first() to path_prepend_clear().

diffstat:

 usr.sbin/pkg_install/lib/path.c |  27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)

diffs (66 lines):

diff -r 2184763636f6 -r 8a762714d375 usr.sbin/pkg_install/lib/path.c
--- a/usr.sbin/pkg_install/lib/path.c   Sun Nov 24 22:23:41 2002 +0000
+++ b/usr.sbin/pkg_install/lib/path.c   Sun Nov 24 22:23:49 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: path.c,v 1.1.2.4 2002/11/24 22:22:57 tron Exp $        */
+/*     $NetBSD: path.c,v 1.1.2.5 2002/11/24 22:23:49 tron Exp $        */
 
 /*-
  * Copyright (c)2002 YAMAMOTO Takashi,
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: path.c,v 1.1.2.4 2002/11/24 22:22:57 tron Exp $");
+__RCSID("$NetBSD: path.c,v 1.1.2.5 2002/11/24 22:23:49 tron Exp $");
 #endif
 
 #include <err.h>
@@ -36,6 +36,7 @@
 #include "lib.h"
 
 struct pathhead PkgPath = TAILQ_HEAD_INITIALIZER(PkgPath);
+static struct path *prepend = 0;
 
 static struct path *path_new_entry(const char *cp, size_t len);
 
@@ -134,28 +135,28 @@
 }
 
 /*
- * Given a package name, push its path onto the start of 'PkgPath'
+ * path_prepend_from_pkgname: prepend the path for a package onto 'PkgPath'
  */
 void
 path_prepend_from_pkgname(const char *pkgname)
 {
-       struct path *new;
        char *ptr;
-       if ((ptr = strrchr(pkgname , '/')))
-               new = path_new_entry(pkgname, ptr - pkgname);
-       else
-               new = path_new_entry(".", 1);
-
-       TAILQ_INSERT_HEAD(&PkgPath, new, pl_entry);
+       if ((ptr = strrchr(pkgname , '/'))) {
+               prepend = path_new_entry(pkgname, ptr - pkgname);
+               TAILQ_INSERT_HEAD(&PkgPath, prepend, pl_entry);
+       }
 }
 
 /*
- * Remove the first entry of 'PkgPath' - used after path_prepend_from_pkgname()
+ * path_prepend_clear: Remove any prepended entry from 'PkgPath'
  */
 void
-path_remove_first()
+path_prepend_clear()
 {
-       TAILQ_REMOVE(&PkgPath, TAILQ_FIRST(&PkgPath), pl_entry);
+       if (prepend) {
+               TAILQ_REMOVE(&PkgPath, prepend, pl_entry);
+               prepend = 0;
+       }
 }
 
 /*



Home | Main Index | Thread Index | Old Index