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.39 (request...



details:   https://anonhg.NetBSD.org/src/rev/9124df185f3f
branches:  netbsd-1-6
changeset: 528515:9124df185f3f
user:      lukem <lukem%NetBSD.org@localhost>
date:      Sun Jul 21 04:43:19 2002 +0000

description:
Pull up revision 1.39 (requested by yamt in ticket #530):
- remove handling of PKG_ADD_BASE.
- don't search current directory if PKG_PATH is set.
- don't prefer local directories.
- constify and cleanup.
discussed on tech-pkg.

diffstat:

 usr.sbin/pkg_install/lib/str.c |  25 ++++++++++++++++++-------
 1 files changed, 18 insertions(+), 7 deletions(-)

diffs (54 lines):

diff -r b872d2183c6d -r 9124df185f3f usr.sbin/pkg_install/lib/str.c
--- a/usr.sbin/pkg_install/lib/str.c    Sun Jul 21 04:43:11 2002 +0000
+++ b/usr.sbin/pkg_install/lib/str.c    Sun Jul 21 04:43:19 2002 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: str.c,v 1.33.2.1 2002/06/28 12:42:40 lukem Exp $       */
+/*     $NetBSD: str.c,v 1.33.2.2 2002/07/21 04:43:19 lukem 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.33.2.1 2002/06/28 12:42:40 lukem Exp $");
+__RCSID("$NetBSD: str.c,v 1.33.2.2 2002/07/21 04:43:19 lukem Exp $");
 #endif
 #endif
 
@@ -35,20 +35,31 @@
 #include "lib.h"
 
 /*
+ * Return the suffix portion of a path
+ */
+const char *
+suffix_of(const char *str)
+{
+       const char *dot;
+
+       return ((dot = strrchr(basename_of(str), '.')) == NULL) ? "" : dot + 1;
+}
+
+/*
  * Return the filename portion of a path
  */
-char   *
-basename_of(char *str)
+const char *
+basename_of(const char *str)
 {
-       char   *slash;
+       const char *slash;
 
-       return ((slash = strrchr(str, '/')) == (char *) NULL) ? str : slash + 1;
+       return ((slash = strrchr(str, '/')) == NULL) ? str : slash + 1;
 }
 
 /*
  * Return the dirname portion of a path
  */
-char   *
+const char *
 dirname_of(const char *path)
 {
        size_t  cc;



Home | Main Index | Thread Index | Old Index