NeoMutt  2022-04-29-81-g9c5a59
Teaching an old dog new tricks
wcscasecmp.c File Reference

For systems lacking wcscasecmp() More...

#include "config.h"
#include <wchar.h>
#include <wctype.h>
+ Include dependency graph for wcscasecmp.c:

Go to the source code of this file.


int wcscasecmp (const wchar_t *a, const wchar_t *b)
 Compare two wide-character strings, ignoring case. More...

Detailed Description

For systems lacking wcscasecmp()

  • Rocco Rutte

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see

Definition in file wcscasecmp.c.

Function Documentation

◆ wcscasecmp()

int wcscasecmp ( const wchar_t *  a,
const wchar_t *  b 

Compare two wide-character strings, ignoring case.

aFirst string
bSecond string
Return values
-1a precedes b
0a and b are identical
1b precedes a

Definition at line 41 of file wcscasecmp.c.

42 {
43  if (!a && !b)
44  return 0;
45  if (!a && b)
46  return -1;
47  if (a && !b)
48  return 1;
50  for (; *a || *b; a++, b++)
51  {
52  int i = towlower(*a);
53  if ((i - towlower(*b)) != 0)
54  return i;
55  }
56  return 0;
57 }
+ Here is the caller graph for this function: