diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2001-06-06 20:56:36 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2001-06-06 20:56:36 +0000 |
commit | 67b795c9e48a0ba0646a798ea9db01c1f691b93c (patch) | |
tree | 5579d132e9fcc5dbee9e19f1c47c4d463d7799db /usr.sbin | |
parent | 3359f75ea0f3d38de844edaeca21c3c0a9c0c924 (diff) |
Let set_pkg kill trailing / in pkgname.
Saves poor angelos from getting his dependencies screwed when he does
pkg_delete pkg_name/
Ok angelos@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_install/lib/lib.h | 4 | ||||
-rw-r--r-- | usr.sbin/pkg_install/lib/pwarnx.c | 10 |
2 files changed, 10 insertions, 4 deletions
diff --git a/usr.sbin/pkg_install/lib/lib.h b/usr.sbin/pkg_install/lib/lib.h index 1b66ad12da4..9a803f22f9c 100644 --- a/usr.sbin/pkg_install/lib/lib.h +++ b/usr.sbin/pkg_install/lib/lib.h @@ -1,4 +1,4 @@ -/* $OpenBSD: lib.h,v 1.8 2001/04/08 16:45:47 espie Exp $ */ +/* $OpenBSD: lib.h,v 1.9 2001/06/06 20:56:35 espie Exp $ */ /* * FreeBSD install - a package for the installation and maintainance @@ -206,7 +206,7 @@ int delete_package(Boolean, Boolean, package_t *); int pkg_perform(char **); -void set_pkg(const char *); +void set_pkg(char *); void pwarnx(const char *, ...); /* Externs */ diff --git a/usr.sbin/pkg_install/lib/pwarnx.c b/usr.sbin/pkg_install/lib/pwarnx.c index 982cf27aa4f..8bcfa540e0a 100644 --- a/usr.sbin/pkg_install/lib/pwarnx.c +++ b/usr.sbin/pkg_install/lib/pwarnx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pwarnx.c,v 1.1 2001/04/08 16:45:48 espie Exp $ */ +/* $OpenBSD: pwarnx.c,v 1.2 2001/06/06 20:56:35 espie Exp $ */ /*- * Copyright (c) 1993 @@ -42,12 +42,18 @@ static char pkgname[60]; void set_pkg(name) - const char *name; + char *name; { char *name2; if (name != NULL) { + size_t len; + + len = strlen(name); + while (len != 0 && name[len-1] == '/') + name[--len] = '\0'; + name2 = strrchr(name, '/'); if (name2 != NULL) name = name2+1; |