diff options
author | 2000-04-16 22:02:26 +0000 | |
---|---|---|
committer | 2000-04-16 22:02:26 +0000 | |
commit | f0e569bb86952ac3468f6f9690e9cbc70c40ff36 (patch) | |
tree | 35bf629602578c9a9ac390ce13994b533fe4e546 | |
parent | Fix randfile so it doesn't attempt to chmod and write entropy back to (diff) | |
download | wireguard-openbsd-f0e569bb86952ac3468f6f9690e9cbc70c40ff36.tar.xz wireguard-openbsd-f0e569bb86952ac3468f6f9690e9cbc70c40ff36.zip |
Fix package conflict for flavors:
try to find the last dash followed by a digit in word.
If not applicable, then still use the last dash.
e.g., kterm-6.2.0-xaw3d -> kterm- as a stem, not kterm-6.2.0
-rw-r--r-- | usr.sbin/pkg_install/add/perform.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/usr.sbin/pkg_install/add/perform.c b/usr.sbin/pkg_install/add/perform.c index c3fd94a9caf..4937a676afb 100644 --- a/usr.sbin/pkg_install/add/perform.c +++ b/usr.sbin/pkg_install/add/perform.c @@ -1,7 +1,7 @@ -/* $OpenBSD: perform.c,v 1.12 2000/03/27 17:14:59 espie Exp $ */ +/* $OpenBSD: perform.c,v 1.13 2000/04/16 22:02:26 espie Exp $ */ #ifndef lint -static const char *rcsid = "$OpenBSD: perform.c,v 1.12 2000/03/27 17:14:59 espie Exp $"; +static const char *rcsid = "$OpenBSD: perform.c,v 1.13 2000/04/16 22:02:26 espie Exp $"; #endif /* @@ -28,6 +28,7 @@ static const char *rcsid = "$OpenBSD: perform.c,v 1.12 2000/03/27 17:14:59 espie #include "lib.h" #include "add.h" +#include <ctype.h> #include <signal.h> #include <sys/wait.h> @@ -263,6 +264,15 @@ pkg_do(char *pkg) if ((s=strrchr(PkgName, '-')) != NULL){ strcpy(buf, PkgName); + /* try to find a better version number */ + if (!isdigit(s[1])) { + char *t; + for (t = s-1; t >= PkgName; t--) + if (*t == '-' && isdigit(t[1])) { + s = t; + break; + } + } buf[s-PkgName+1]='*'; buf[s-PkgName+2]='\0'; |