pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/pkg_install-renovation]: pkgsrc/pkgtools/pkg_install/files/lib Pass t...
details: https://anonhg.NetBSD.org/pkgsrc/rev/994da94280ca
branches: pkg_install-renovation
changeset: 541546:994da94280ca
user: joerg <joerg%pkgsrc.org@localhost>
date: Wed May 21 20:29:24 2008 +0000
description:
Pass the simple part of the pattern as glob hint.
diffstat:
pkgtools/pkg_install/files/lib/pkg_io.c | 21 +++++++++++++++++----
1 files changed, 17 insertions(+), 4 deletions(-)
diffs (53 lines):
diff -r 825e44b10e54 -r 994da94280ca pkgtools/pkg_install/files/lib/pkg_io.c
--- a/pkgtools/pkg_install/files/lib/pkg_io.c Wed May 21 13:08:47 2008 +0000
+++ b/pkgtools/pkg_install/files/lib/pkg_io.c Wed May 21 20:29:24 2008 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pkg_io.c,v 1.1.2.1 2008/04/26 17:44:23 joerg Exp $ */
+/* $NetBSD: pkg_io.c,v 1.1.2.2 2008/05/21 20:29:24 joerg Exp $ */
/*-
* Copyright (c) 2008 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
* All rights reserved.
@@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#endif
-__RCSID("$NetBSD: pkg_io.c,v 1.1.2.1 2008/04/26 17:44:23 joerg Exp $");
+__RCSID("$NetBSD: pkg_io.c,v 1.1.2.2 2008/05/21 20:29:24 joerg Exp $");
#include <archive.h>
#include <archive_entry.h>
@@ -165,7 +165,7 @@
static int
find_best_package(struct url *url, const char *pattern, struct url **best_url)
{
- char *cur_match, *best_match = NULL;
+ char *cur_match, *url_pattern, *best_match = NULL;
struct url_list ue;
size_t i;
@@ -180,11 +180,24 @@
return -1;
}
+ for (i = 0; pattern[i] != '\0'; ++i) {
+ if (!isalnum((unsigned char)(pattern[i])) &&
+ (pattern[i]) != '-')
+ break;
+ }
+ if (asprintf(&url_pattern, "%*.*s*", (int)i, (int)i, pattern) == -1) {
+ free(best_match);
+ return -1;
+ }
+
fetchInitURLList(&ue);
- if (fetchList(&ue, url, NULL, "")) {
+ if (fetchList(&ue, url, url_pattern, "")) {
+ free(url_pattern);
fetchFreeURLList(&ue);
return -1;
}
+ free(url_pattern);
+
for (i = 0; i < ue.length; ++i) {
cur_match = fetchUnquoteFilename(ue.urls + i);
Home |
Main Index |
Thread Index |
Old Index