Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Add a CASE_INSENSITIVE_MATCH pkg.conf variable (boolean) defaulting to false.
Matthew Seaman committed 12 years ago
commit f8b130e6a3fb8f28cef411fd9ef65f47e631b6a6
parent 277c2b5
2 files changed +16 -2
modified libpkg/pkg_config.c
@@ -288,6 +288,12 @@ static struct config_entry c[] = {
		"YES",
		"Run post/pre actions scripts",
	},
+
	{
+
		PKG_BOOL,
+
		"CASE_SENSITIVE_MATCHING"
+
		"NO",
+
		"Match package names case sensitively",
+
	},
};

static bool parsed = false;
@@ -896,6 +902,11 @@ pkg_init(const char *path, const char *reposdir)
	if (nsname != NULL)
		set_nameserver(ucl_object_tostring_forced(o));

+
	/* Set default case sensitivity for searching */
+
	pkgdb_set_case_sensitivity(
+
		pkg_object_bool(pkg_config_get("CASE_SENSITIVE_MATCH"))
+
		);
+

	return (EPKG_OK);
}

modified libpkg/pkgdb.c
@@ -1444,9 +1444,12 @@ pkgdb_it_free(struct pkgdb_it *it)
	free(it);
}

-
/* By default, MATCH_EXACT and MATCH_REGEX are case sensitive. */
+
/* By default, MATCH_EXACT and MATCH_REGEX are case insensitive.  This
+
 * is modified in pkg_init() according to the value of
+
 * CASE_SENSITIVE_MATCH in pkg.conf and then possbily reset again in
+
 * pkg search et al according to command line flags */

-
static bool _case_sensitive_flag = true;
+
static bool _case_sensitive_flag = false;

void
pkgdb_set_case_sensitivity(bool case_sensitive)