]> git.ipfire.org Git - thirdparty/glibc.git/blame - wcsmbs/wcscmp.c
support: Fix typo in xgetsockname error message
[thirdparty/glibc.git] / wcsmbs / wcscmp.c
CommitLineData
dff8da6b 1/* Copyright (C) 1995-2024 Free Software Foundation, Inc.
33a934a3 2 This file is part of the GNU C Library.
33a934a3
UD
3
4 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
33a934a3
UD
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41bdb6e2 12 Lesser General Public License for more details.
33a934a3 13
41bdb6e2 14 You should have received a copy of the GNU Lesser General Public
59ba27a6 15 License along with the GNU C Library; if not, see
5a82c748 16 <https://www.gnu.org/licenses/>. */
a482b5a5 17
299a95b9 18#include <wchar.h>
a482b5a5 19
1b48c537 20#ifndef WCSCMP
2f44ee08 21# define WCSCMP __wcscmp
1b48c537 22#endif
a482b5a5
RM
23
24/* Compare S1 and S2, returning less than, equal to or
299a95b9 25 greater than zero if S1 is lexicographically less than,
a482b5a5
RM
26 equal to or greater than S2. */
27int
9d46370c 28WCSCMP (const wchar_t *s1, const wchar_t *s2)
a482b5a5 29{
1f1e1947 30 wchar_t c1, c2;
a482b5a5
RM
31
32 do
33 {
1f1e1947
AS
34 c1 = *s1++;
35 c2 = *s2++;
95584d3b 36 if (c2 == L'\0')
a482b5a5
RM
37 return c1 - c2;
38 }
39 while (c1 == c2);
40
95584d3b 41 return c1 < c2 ? -1 : 1;
a482b5a5 42}
1b48c537 43libc_hidden_def (WCSCMP)
2f44ee08 44weak_alias (WCSCMP, wcscmp)