diff options
author | wiz <wiz> | 2005-11-13 19:51:14 +0000 |
---|---|---|
committer | wiz <wiz> | 2005-11-13 19:51:14 +0000 |
commit | 8565644144fbd4788d1ac24b7299caa8014b55d1 (patch) | |
tree | f62d189725221ccc579c2d638767aaf92c3b2403 /pkgtools/pkg_install | |
parent | fa917acfc68e4e7588c6a37d7233ea8e7c927ebc (diff) | |
download | pkgsrc-8565644144fbd4788d1ac24b7299caa8014b55d1.tar.gz |
Sync with basesrc: do not use errx in dewey.c; handle -1 return value
from dewey_match in pmatch.
Diffstat (limited to 'pkgtools/pkg_install')
-rw-r--r-- | pkgtools/pkg_install/files/lib/dewey.c | 6 | ||||
-rw-r--r-- | pkgtools/pkg_install/files/lib/str.c | 11 |
2 files changed, 11 insertions, 6 deletions
diff --git a/pkgtools/pkg_install/files/lib/dewey.c b/pkgtools/pkg_install/files/lib/dewey.c index 2160355e26d..ac8da696c8d 100644 --- a/pkgtools/pkg_install/files/lib/dewey.c +++ b/pkgtools/pkg_install/files/lib/dewey.c @@ -1,4 +1,4 @@ -/* $NetBSD: dewey.c,v 1.3 2005/11/08 20:17:56 wiz Exp $ */ +/* $NetBSD: dewey.c,v 1.4 2005/11/13 19:51:14 wiz Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -227,7 +227,7 @@ dewey_cmp(const char *lhs, int op, const char *rhs) /* * Perform dewey match on "pkg" against "pattern". - * Return 1 on match, 0 otherwise + * Return 1 on match, 0 on non-match, -1 on error. */ int dewey_match(const char *pattern, const char *pkg) @@ -242,7 +242,7 @@ dewey_match(const char *pattern, const char *pkg) return 0; } if ((sep = strpbrk(pattern, "<>")) == NULL) - errx(EXIT_FAILURE, "dewey_match: '<' or '>' expected in `%s'", pattern); + return -1; /* compare name lengths */ if ((sep-pattern != version-pkg) || strncmp(pkg, pattern, (size_t)(version-pkg)) != 0) diff --git a/pkgtools/pkg_install/files/lib/str.c b/pkgtools/pkg_install/files/lib/str.c index f2b77bb5b61..eaa57995035 100644 --- a/pkgtools/pkg_install/files/lib/str.c +++ b/pkgtools/pkg_install/files/lib/str.c @@ -1,4 +1,4 @@ -/* $NetBSD: str.c,v 1.14 2005/11/05 13:20:09 wiz Exp $ */ +/* $NetBSD: str.c,v 1.15 2005/11/13 19:51:14 wiz Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -11,7 +11,7 @@ #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.14 2005/11/05 13:20:09 wiz Exp $"); +__RCSID("$NetBSD: str.c,v 1.15 2005/11/13 19:51:14 wiz Exp $"); #endif #endif @@ -196,8 +196,13 @@ pmatch(const char *pattern, const char *pkg) return alternate_match(pattern, pkg); } if (strpbrk(pattern, "<>") != (char *) NULL) { + int ret; + /* perform relational dewey match on version number */ - return dewey_match(pattern, pkg); + ret = dewey_match(pattern, pkg); + if (ret < 0) + errx(EXIT_FAILURE, "dewey_match returned error"); + return ret; } if (strpbrk(pattern, "*?[]") != (char *) NULL) { /* glob match */ |