summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2005-08-08 05:53:02 +0000
committerMarc Espie <espie@cvs.openbsd.org>2005-08-08 05:53:02 +0000
commitb83058fd179b6de492fa3ed6292d2821ca253806 (patch)
tree2baae503ebb022ad1d8ff55383cedcf18b319815 /lib/libc
parent9912e93b5b9dbc80863c5b26ff459f0587f40cbe (diff)
activate LC_CTYPE for 8 bits locale.
Make sure tolower/toupper use the whole 8 bits. okay deraadt@ thanks to everyone who tested
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/gen/ctype_.c14
-rw-r--r--lib/libc/gen/tolower_.c7
-rw-r--r--lib/libc/gen/toupper_.c6
-rw-r--r--lib/libc/include/ctype_private.h7
-rw-r--r--lib/libc/locale/Makefile.inc8
-rw-r--r--lib/libc/locale/runetype.h183
-rw-r--r--lib/libc/locale/setlocale.c102
-rw-r--r--lib/libc/shlib_version2
-rw-r--r--lib/libc/string/wcscmp.c6
-rw-r--r--lib/libc/string/wcsncmp.c8
-rw-r--r--lib/libc/string/wmemcmp.c8
11 files changed, 284 insertions, 67 deletions
diff --git a/lib/libc/gen/ctype_.c b/lib/libc/gen/ctype_.c
index 269725af513..7f7c0adb3c8 100644
--- a/lib/libc/gen/ctype_.c
+++ b/lib/libc/gen/ctype_.c
@@ -33,12 +33,13 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: ctype_.c,v 1.7 2005/07/13 19:15:07 otto Exp $";
+static char rcsid[] = "$OpenBSD: ctype_.c,v 1.8 2005/08/08 05:53:00 espie Exp $";
#endif /* LIBC_SCCS and not lint */
#include <ctype.h>
+#include "ctype_private.h"
-const char _C_ctype_[1 + 256] = {
+const char _C_ctype_[1 + CTYPE_NUM_CHARS] = {
0,
_C, _C, _C, _C, _C, _C, _C, _C,
_C, _C|_S, _C|_S, _C|_S, _C|_S, _C|_S, _C, _C,
@@ -55,13 +56,7 @@ const char _C_ctype_[1 + 256] = {
_P, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L,
_L, _L, _L, _L, _L, _L, _L, _L,
_L, _L, _L, _L, _L, _L, _L, _L,
-/*
- * define USE7BIT to force 7-bit ANSI behavior, otherwise the routine
- * will determine printability based on the IS0 8859 8-bit standard
- */
-#ifdef USE7BIT
- _L, _L, _L, _P, _P, _P, _P, _C
-#else
+/* determine printability based on the IS0 8859 8-bit standard */
_L, _L, _L, _P, _P, _P, _P, _C,
_C, _C, _C, _C, _C, _C, _C, _C, /* 80 */
@@ -80,7 +75,6 @@ const char _C_ctype_[1 + 256] = {
_P, _P, _P, _P, _P, _P, _P, _P, /* E8 */
_P, _P, _P, _P, _P, _P, _P, _P, /* F0 */
_P, _P, _P, _P, _P, _P, _P, _P /* F8 */
-#endif /*USE7BIT*/
};
const char *_ctype_ = _C_ctype_;
diff --git a/lib/libc/gen/tolower_.c b/lib/libc/gen/tolower_.c
index 160c4be3c0c..cd98f88af73 100644
--- a/lib/libc/gen/tolower_.c
+++ b/lib/libc/gen/tolower_.c
@@ -4,14 +4,15 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: tolower_.c,v 1.7 2004/05/18 02:05:52 jfb Exp $";
+static char rcsid[] = "$OpenBSD: tolower_.c,v 1.8 2005/08/08 05:53:00 espie Exp $";
#endif /* LIBC_SCCS and not lint */
#define _ANSI_LIBRARY
#include <ctype.h>
#include <stdio.h>
+#include "ctype_private.h"
-const short _C_tolower_[1 + 256] = {
+const short _C_tolower_[1 + CTYPE_NUM_CHARS] = {
EOF,
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
@@ -53,7 +54,7 @@ const short *_tolower_tab_ = _C_tolower_;
int
tolower(int c)
{
- if ((unsigned int)c > 0177)
+ if ((unsigned int)c > 255)
return(c);
return((_tolower_tab_ + 1)[c]);
}
diff --git a/lib/libc/gen/toupper_.c b/lib/libc/gen/toupper_.c
index 65b6cfab977..fdb87bc3a29 100644
--- a/lib/libc/gen/toupper_.c
+++ b/lib/libc/gen/toupper_.c
@@ -4,13 +4,15 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: toupper_.c,v 1.7 2004/05/18 02:05:52 jfb Exp $";
+static char rcsid[] = "$OpenBSD: toupper_.c,v 1.8 2005/08/08 05:53:00 espie Exp $";
#endif /* LIBC_SCCS and not lint */
#define _ANSI_LIBRARY
#include <ctype.h>
#include <stdio.h>
+#include "ctype_private.h"
+
const short _C_toupper_[1 + 256] = {
EOF,
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
@@ -53,7 +55,7 @@ const short *_toupper_tab_ = _C_toupper_;
int
toupper(int c)
{
- if ((unsigned int)c > 0177)
+ if ((unsigned int)c > 255)
return(c);
return((_toupper_tab_ + 1)[c]);
}
diff --git a/lib/libc/include/ctype_private.h b/lib/libc/include/ctype_private.h
new file mode 100644
index 00000000000..39cc792ea44
--- /dev/null
+++ b/lib/libc/include/ctype_private.h
@@ -0,0 +1,7 @@
+/* $OpenBSD: ctype_private.h,v 1.1 2005/08/08 05:53:00 espie Exp $ */
+/* Written by Marc Espie, public domain */
+#define CTYPE_NUM_CHARS 256
+extern const char _C_ctype_[];
+extern const short _C_toupper_[];
+extern const short _C_tolower_[];
+
diff --git a/lib/libc/locale/Makefile.inc b/lib/libc/locale/Makefile.inc
index c494df24fad..70f1b5a1535 100644
--- a/lib/libc/locale/Makefile.inc
+++ b/lib/libc/locale/Makefile.inc
@@ -1,12 +1,14 @@
-# $OpenBSD: Makefile.inc,v 1.9 2005/07/24 09:50:49 espie Exp $
+# $OpenBSD: Makefile.inc,v 1.10 2005/08/08 05:53:01 espie Exp $
# locale sources
.PATH: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/locale ${LIBCSRCDIR}/locale
SRCS+= _def_messages.c _def_monetary.c _def_numeric.c _def_time.c \
- localeconv.c nl_langinfo.c setlocale.c iswctype_sb.c mbrtowc_sb.c \
+ localeconv.c nl_langinfo.c setlocale.c iswctype.c mbrtowc_sb.c \
multibyte_sb.c \
- __mb_cur_max.c wcstod.c wcstol.c wcstoul.c wcstoll.c wcstoull.c
+ __mb_cur_max.c wcstod.c wcstol.c wcstoul.c wcstoll.c wcstoull.c \
+ setrunelocale.c runeglue.c rune.c runetable.c ___runetype_mb.c \
+ _wctrans.c
MAN+= nl_langinfo.3 setlocale.3 iswalnum.3 towlower.3 \
btowc.3 mblen.3 mbrlen.3 mbrtowc.3 mbsinit.3 mbsrtowcs.3 \
diff --git a/lib/libc/locale/runetype.h b/lib/libc/locale/runetype.h
index b65b76273e1..a1635652682 100644
--- a/lib/libc/locale/runetype.h
+++ b/lib/libc/locale/runetype.h
@@ -1,22 +1,146 @@
-/* $OpenBSD: runetype.h,v 1.3 2005/07/01 08:59:27 espie Exp $ */
-
#ifndef _NB_RUNETYPE_H_
#define _NB_RUNETYPE_H_
+/* $OpenBSD: runetype.h,v 1.4 2005/08/08 05:53:01 espie Exp $ */
+/* $NetBSD: runetype.h,v 1.18 2003/08/07 16:43:04 agc Exp $ */
+/*-
+ * Copyright (c) 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Paul Borman at Krystal Technologies.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)runetype.h 8.1 (Berkeley) 6/2/93
+ */
+
#include <sys/cdefs.h>
#include <sys/types.h>
+#include "ctype_private.h"
+
+typedef uint32_t rune_t;
+typedef uint64_t __runepad_t;
+
+
+#define _CACHED_RUNES (1 << 8) /* Must be a power of 2 */
+#define _RUNE_ISCACHED(c) ((c)>=0 && (c)<_CACHED_RUNES)
-typedef uint32_t __nbrune_t;
+#define _DEFAULT_INVALID_RUNE ((rune_t)-3)
+/*
+ * The lower 8 bits of runetype[] contain the digit value of the rune.
+ */
typedef uint32_t _RuneType;
+#define _RUNETYPE_A 0x00000100U /* Alpha */
+#define _RUNETYPE_C 0x00000200U /* Control */
+#define _RUNETYPE_D 0x00000400U /* Digit */
+#define _RUNETYPE_G 0x00000800U /* Graph */
+#define _RUNETYPE_L 0x00001000U /* Lower */
+#define _RUNETYPE_P 0x00002000U /* Punct */
+#define _RUNETYPE_S 0x00004000U /* Space */
+#define _RUNETYPE_U 0x00008000U /* Upper */
+#define _RUNETYPE_X 0x00010000U /* X digit */
+#define _RUNETYPE_B 0x00020000U /* Blank */
+#define _RUNETYPE_R 0x00040000U /* Print */
+#define _RUNETYPE_I 0x00080000U /* Ideogram */
+#define _RUNETYPE_T 0x00100000U /* Special */
+#define _RUNETYPE_Q 0x00200000U /* Phonogram */
+#define _RUNETYPE_SWM 0xc0000000U/* Mask to get screen width data */
+#define _RUNETYPE_SWS 30 /* Bits to shift to get width */
+#define _RUNETYPE_SW0 0x00000000U /* 0 width character */
+#define _RUNETYPE_SW1 0x40000000U /* 1 width character */
+#define _RUNETYPE_SW2 0x80000000U /* 2 width character */
+#define _RUNETYPE_SW3 0xc0000000U /* 3 width character */
+
+
+/*
+ * rune file format. network endian.
+ */
+typedef struct {
+ int32_t fre_min; /* First rune of the range */
+ int32_t fre_max; /* Last rune (inclusive) of the range */
+ int32_t fre_map; /* What first maps to in maps */
+} __attribute__((__packed__)) _FileRuneEntry;
+
+
+typedef struct {
+ uint32_t frr_nranges; /* Number of ranges stored */
+} __attribute__((__packed__)) _FileRuneRange;
+
+
+typedef struct {
+ char frl_magic[8]; /* Magic saying what version we are */
+ char frl_encoding[32];/* ASCII name of this encoding */
+
+ int32_t frl_invalid_rune;
+
+ _RuneType frl_runetype[_CACHED_RUNES];
+ int32_t frl_maplower[_CACHED_RUNES];
+ int32_t frl_mapupper[_CACHED_RUNES];
+
+ /*
+ * The following are to deal with Runes larger than _CACHED_RUNES - 1.
+ * Their data is actually contiguous with this structure so as to make
+ * it easier to read/write from/to disk.
+ */
+ _FileRuneRange frl_runetype_ext;
+ _FileRuneRange frl_maplower_ext;
+ _FileRuneRange frl_mapupper_ext;
+
+ int32_t frl_variable_len;/* how long that data is */
+
+ /* variable size data follows */
+} __attribute__((__packed__)) _FileRuneLocale;
+
+
+/*
+ * expanded rune locale declaration. local to the host. host endian.
+ */
+typedef struct {
+ rune_t re_min; /* First rune of the range */
+ rune_t re_max; /* Last rune (inclusive) of the range */
+ rune_t re_map; /* What first maps to in maps */
+ _RuneType *re_rune_types; /* Array of types in range */
+} _RuneEntry;
+
+
+typedef struct {
+ uint32_t rr_nranges; /* Number of ranges stored */
+ _RuneEntry *rr_rune_ranges;
+} _RuneRange;
+
+
/*
* wctrans stuffs.
*/
typedef struct _WCTransEntry {
char *te_name;
- __nbrune_t *te_cached;
- void *te_extmap;
+ rune_t *te_cached;
+ _RuneRange *te_extmap;
} _WCTransEntry;
#define _WCTRANS_INDEX_LOWER 0
@@ -44,4 +168,53 @@ typedef struct _WCTypeEntry {
#define _WCTYPE_INDEX_XDIGIT 11
#define _WCTYPE_NINDEXES 12
+/*
+ * ctype stuffs
+ */
+
+struct old_tabs {
+ /* compatibility with `old' ctype */
+ char ctype_tab[CTYPE_NUM_CHARS + 1];
+ short tolower_tab[256 + 1];
+ short toupper_tab[256 + 1];
+};
+
+typedef struct {
+ /*
+ * copied from _FileRuneLocale
+ */
+ char rl_magic[8]; /* Magic saying what version we are */
+ char rl_encoding[32];/* ASCII name of this encoding */
+ rune_t rl_invalid_rune;
+ _RuneType rl_runetype[_CACHED_RUNES];
+ rune_t rl_maplower[_CACHED_RUNES];
+ rune_t rl_mapupper[_CACHED_RUNES];
+ _RuneRange rl_runetype_ext;
+ _RuneRange rl_maplower_ext;
+ _RuneRange rl_mapupper_ext;
+
+ void *rl_variable;
+ size_t rl_variable_len;
+
+ /*
+ * the following portion is generated on the fly
+ */
+ char *rl_codeset;
+ struct _citrus_ctype_rec *rl_citrus_ctype;
+ _WCTransEntry rl_wctrans[_WCTRANS_NINDEXES];
+ _WCTypeEntry rl_wctype[_WCTYPE_NINDEXES];
+
+ struct old_tabs * rl_tabs;
+
+} _RuneLocale;
+
+/* magic number for LC_CTYPE (rune)locale declaration */
+#define _RUNE_MAGIC_1 "RuneCT10" /* Indicates version 0 of RuneLocale */
+
+/* magic string for dynamic link module - type should be like "LC_CTYPE" */
+#define _RUNE_MODULE_1(type) "RuneModule10." type
+
+/* codeset tag */
+#define _RUNE_CODESET "CODESET="
+
#endif
diff --git a/lib/libc/locale/setlocale.c b/lib/libc/locale/setlocale.c
index 87ae45c081e..7453e777764 100644
--- a/lib/libc/locale/setlocale.c
+++ b/lib/libc/locale/setlocale.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: setlocale.c,v 1.12 2005/03/23 21:13:28 otto Exp $ */
+/* $OpenBSD: setlocale.c,v 1.13 2005/08/08 05:53:01 espie Exp $ */
/*
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
@@ -32,7 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: setlocale.c,v 1.12 2005/03/23 21:13:28 otto Exp $";
+static char rcsid[] = "$OpenBSD: setlocale.c,v 1.13 2005/08/08 05:53:01 espie Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/localedef.h>
@@ -44,6 +44,8 @@ static char rcsid[] = "$OpenBSD: setlocale.c,v 1.12 2005/03/23 21:13:28 otto Exp
#include <string.h>
#include <unistd.h>
+#include "rune.h"
+#include "rune_local.h"
/*
* Category names for getenv()
*/
@@ -76,11 +78,13 @@ static char current_categories[_LC_LAST][32] = {
static char new_categories[_LC_LAST][32];
static char current_locale_string[_LC_LAST * 33];
-static char *PathLocale;
static char *currentlocale(void);
+static void revert_to_default(int);
+static int force_locale_enable(int);
+static int load_locale_sub(int, const char *, int);
static char *loadlocale(int);
-static const char *__get_locale_env __P((int));
+static const char *__get_locale_env(int);
char *
setlocale(int category, const char *locale)
@@ -90,9 +94,9 @@ setlocale(int category, const char *locale)
const char *env, *r;
if (issetugid() != 0 ||
- ((!PathLocale && !(PathLocale = getenv("PATH_LOCALE"))) ||
- !*PathLocale))
- PathLocale = _PATH_LOCALE;
+ ((!_PathLocale && !(_PathLocale = getenv("PATH_LOCALE"))) ||
+ !*_PathLocale))
+ _PathLocale = _PATH_LOCALE;
if (category < 0 || category >= _LC_LAST)
return (NULL);
@@ -197,48 +201,82 @@ currentlocale(void)
return (current_locale_string);
}
-static char *
-loadlocale(int category)
+static void
+revert_to_default(int category)
{
- char name[PATH_MAX];
+ switch (category) {
+ case LC_CTYPE:
+ (void)_xpg4_setrunelocale("C");
+ __install_currentrunelocale_ctype();
+ break;
+ case LC_MESSAGES:
+ case LC_COLLATE:
+ case LC_MONETARY:
+ case LC_NUMERIC:
+ case LC_TIME:
+ break;
+ }
+}
- if (strcmp(new_categories[category],
- current_categories[category]) == 0)
- return (current_categories[category]);
+static int
+force_locale_enable(int category)
+{
+ revert_to_default(category);
+ return 0;
+}
+
+static int
+load_locale_sub(int category, const char *locname, int isspecial)
+{
+ char name[PATH_MAX];
+
+ /* check for the default locales */
if (!strcmp(new_categories[category], "C") ||
!strcmp(new_categories[category], "POSIX")) {
-
- /*
- * Some day this will need to reset the locale to the default
- * C locale. Since we have no way to change them as of yet,
- * there is no need to reset them.
- */
- (void)strlcpy(current_categories[category],
- new_categories[category],
- sizeof(current_categories[category]));
- return (current_categories[category]);
+ revert_to_default(category);
+ return 0;
}
- /*
- * Some day we will actually look at this file.
- */
+ /* sanity check */
+ if (strchr(locname, '/') != NULL)
+ return -1;
+
(void)snprintf(name, sizeof(name), "%s/%s/%s",
- PathLocale, new_categories[category], categories[category]);
+ _PathLocale, locname, categories[category]);
switch (category) {
case LC_CTYPE:
- case LC_COLLATE:
+ if (_xpg4_setrunelocale(locname) == -1)
+ return -1;
+ __install_currentrunelocale_ctype();
+ break;
+
case LC_MESSAGES:
+ case LC_COLLATE:
case LC_MONETARY:
case LC_NUMERIC:
case LC_TIME:
- return (NULL);
+ return -1;
}
- (void)strlcpy(current_categories[category],
- new_categories[category], sizeof(current_categories[category]));
- return current_categories[category];
+ return 0;
+}
+
+static char *
+loadlocale(int category)
+{
+ if (strcmp(new_categories[category],
+ current_categories[category]) == 0)
+ return (current_categories[category]);
+
+ if (!load_locale_sub(category, new_categories[category], 0)) {
+ (void)strlcpy(current_categories[category],
+ new_categories[category], sizeof(current_categories[category]));
+ return current_categories[category];
+ } else {
+ return NULL;
+ }
}
static const char *
diff --git a/lib/libc/shlib_version b/lib/libc/shlib_version
index 956f9e938e4..600acda78f3 100644
--- a/lib/libc/shlib_version
+++ b/lib/libc/shlib_version
@@ -1,4 +1,4 @@
major=38
-minor=1
+minor=2
# note: If changes were made to include/thread_private.h or if system
# calls were added/changed then libpthread must also be updated.
diff --git a/lib/libc/string/wcscmp.c b/lib/libc/string/wcscmp.c
index d8a9aa73fb1..ebbb87ca4d7 100644
--- a/lib/libc/string/wcscmp.c
+++ b/lib/libc/string/wcscmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wcscmp.c,v 1.2 2005/06/19 22:12:07 espie Exp $ */
+/* $OpenBSD: wcscmp.c,v 1.3 2005/08/08 05:53:01 espie Exp $ */
/* $NetBSD: wcscmp.c,v 1.5 2003/08/07 16:43:54 agc Exp $ */
/*-
@@ -34,7 +34,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: wcscmp.c,v 1.2 2005/06/19 22:12:07 espie Exp $";
+static char *rcsid = "$OpenBSD: wcscmp.c,v 1.3 2005/08/08 05:53:01 espie Exp $";
#endif /* LIBC_SCCS and not lint */
#include <wchar.h>
@@ -51,5 +51,5 @@ wcscmp(const wchar_t *s1, const wchar_t *s2)
if (*s1++ == 0)
return (0);
/* XXX assumes wchar_t = int */
- return (*(const __nbrune_t *)s1 - *(const __nbrune_t *)--s2);
+ return (*(const rune_t *)s1 - *(const rune_t *)--s2);
}
diff --git a/lib/libc/string/wcsncmp.c b/lib/libc/string/wcsncmp.c
index aaa96b97a6c..30d37f66579 100644
--- a/lib/libc/string/wcsncmp.c
+++ b/lib/libc/string/wcsncmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wcsncmp.c,v 1.2 2005/06/19 22:12:07 espie Exp $ */
+/* $OpenBSD: wcsncmp.c,v 1.3 2005/08/08 05:53:01 espie Exp $ */
/* $NetBSD: wcsncmp.c,v 1.5 2003/08/07 16:43:54 agc Exp $ */
/*
@@ -31,7 +31,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: wcsncmp.c,v 1.2 2005/06/19 22:12:07 espie Exp $";
+static char *rcsid = "$OpenBSD: wcsncmp.c,v 1.3 2005/08/08 05:53:01 espie Exp $";
#endif /* LIBC_SCCS and not lint */
#include <wchar.h>
@@ -46,8 +46,8 @@ wcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n)
do {
if (*s1 != *s2++) {
/* XXX assumes wchar_t = int */
- return (*(const __nbrune_t *)s1 -
- *(const __nbrune_t *)--s2);
+ return (*(const rune_t *)s1 -
+ *(const rune_t *)--s2);
}
if (*s1++ == 0)
break;
diff --git a/lib/libc/string/wmemcmp.c b/lib/libc/string/wmemcmp.c
index fc021c11d12..e35c6207ff6 100644
--- a/lib/libc/string/wmemcmp.c
+++ b/lib/libc/string/wmemcmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wmemcmp.c,v 1.2 2005/06/19 22:12:07 espie Exp $ */
+/* $OpenBSD: wmemcmp.c,v 1.3 2005/08/08 05:53:01 espie Exp $ */
/* $NetBSD: wmemcmp.c,v 1.3 2003/04/06 18:33:23 tshiozak Exp $ */
/*-
@@ -30,7 +30,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: wmemcmp.c,v 1.2 2005/06/19 22:12:07 espie Exp $";
+static char *rcsid = "$OpenBSD: wmemcmp.c,v 1.3 2005/08/08 05:53:01 espie Exp $";
#endif /* LIBC_SCCS and not lint */
#include <wchar.h>
@@ -44,8 +44,8 @@ wmemcmp(const wchar_t *s1, const wchar_t *s2, size_t n)
for (i = 0; i < n; i++) {
if (*s1 != *s2) {
/* wchar might be unsigned */
- return *(const __nbrune_t *)s1 >
- *(const __nbrune_t *)s2 ? 1 : -1;
+ return *(const rune_t *)s1 >
+ *(const rune_t *)s2 ? 1 : -1;
}
s1++;
s2++;