about summary refs log tree commit diff
path: root/src/base
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2011-06-09 23:28:20 +0200
committeroy <Tom_Adams@web.de>2011-06-09 23:28:20 +0200
commite1ef01f656fbc9e6d45450bbc8519688c51cc661 (patch)
tree79f45de77bd38c3cdd7cdcad0f74f57b0a448133 /src/base
parent69cb197f592be2cc00dfe79603d076fe2779ea55 (diff)
downloadzcatch-e1ef01f656fbc9e6d45450bbc8519688c51cc661.tar.gz
zcatch-e1ef01f656fbc9e6d45450bbc8519688c51cc661.zip
made tab completion for names in chat start with the ones that match on the beginning
Diffstat (limited to 'src/base')
-rw-r--r--src/base/system.c9
-rw-r--r--src/base/system.h19
2 files changed, 28 insertions, 0 deletions
diff --git a/src/base/system.c b/src/base/system.c
index 89771929..790cfef4 100644
--- a/src/base/system.c
+++ b/src/base/system.c
@@ -1546,6 +1546,15 @@ int str_comp_nocase(const char *a, const char *b)
 #endif
 }
 
+int str_comp_nocase_num(const char *a, const char *b, const int num)
+{
+#if defined(CONF_FAMILY_WINDOWS)
+	return _strnicmp(a, b, num);
+#else
+	return strncasecmp(a, b, num);
+#endif
+}
+
 int str_comp(const char *a, const char *b)
 {
 	return strcmp(a, b);
diff --git a/src/base/system.h b/src/base/system.h
index aab71bff..de579076 100644
--- a/src/base/system.h
+++ b/src/base/system.h
@@ -825,6 +825,25 @@ char *str_skip_whitespaces(char *str);
 */
 int str_comp_nocase(const char *a, const char *b);
 
+/*
+	Function: str_comp_nocase_num
+		Compares up to num characters of two strings case insensitive.
+
+	Parameters:
+		a - String to compare.
+		b - String to compare.
+		num - Maximum characters to compare
+
+	Returns:
+		<0 - String a is lesser than string b
+		0 - String a is equal to string b
+		>0 - String a is greater than string b
+
+	Remarks:
+		- Only garanted to work with a-z/A-Z.
+		- The strings are treated as zero-termineted strings.
+*/
+int str_comp_nocase_num(const char *a, const char *b, const int num);
 
 /*
 	Function: str_comp