From e1ef01f656fbc9e6d45450bbc8519688c51cc661 Mon Sep 17 00:00:00 2001 From: oy Date: Thu, 9 Jun 2011 23:28:20 +0200 Subject: made tab completion for names in chat start with the ones that match on the beginning --- src/base/system.c | 9 +++++++++ src/base/system.h | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+) (limited to 'src/base') 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 -- cgit 1.4.1