From f0e569bb86952ac3468f6f9690e9cbc70c40ff36 Mon Sep 17 00:00:00 2001 From: espie Date: Sun, 16 Apr 2000 22:02:26 +0000 Subject: [PATCH] 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 --- usr.sbin/pkg_install/add/perform.c | 14 ++++++++++++-- 1 file 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 #include #include @@ -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'; -- 2.20.1