diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2000-04-16 22:02:27 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2000-04-16 22:02:27 +0000 |
commit | a89bdb7a99e1f0007e704e3e25fd53e7a399d33e (patch) | |
tree | 730d1a58ff104ce0e1db11366994a3832dadc617 /usr.sbin | |
parent | 4de08373c7748112fa2f5a1d807230f4ca0e3942 (diff) |
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
Diffstat (limited to 'usr.sbin')
-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'; |