Module Name: src
Committed By: joerg
Date: Tue Apr 16 11:29:13 UTC 2013
Modified Files:
src/include: ctype.h
src/lib/libc/gen: isctype.c
Log Message:
Add isalpha_l and friends.
To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/include/ctype.h
cvs rdiff -u -r1.22 -r1.23 src/lib/libc/gen/isctype.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/include/ctype.h
diff -u src/include/ctype.h:1.31 src/include/ctype.h:1.32
--- src/include/ctype.h:1.31 Tue Jun 1 13:52:08 2010
+++ src/include/ctype.h Tue Apr 16 11:29:12 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: ctype.h,v 1.31 2010/06/01 13:52:08 tnozaki Exp $ */
+/* $NetBSD: ctype.h,v 1.32 2013/04/16 11:29:12 joerg Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
@@ -57,6 +57,28 @@ int isxdigit(int);
int tolower(int);
int toupper(int);
+#if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE)
+# ifndef __LOCALE_T_DECLARED
+typedef struct _locale *locale_t;
+# define __LOCALE_T_DECLARED
+# endif
+
+int isalnum_l(int, locale_t);
+int isalpha_l(int, locale_t);
+int isblank_l(int, locale_t);
+int iscntrl_l(int, locale_t);
+int isdigit_l(int, locale_t);
+int isgraph_l(int, locale_t);
+int islower_l(int, locale_t);
+int isprint_l(int, locale_t);
+int ispunct_l(int, locale_t);
+int isspace_l(int, locale_t);
+int isupper_l(int, locale_t);
+int isxdigit_l(int, locale_t);
+int tolower_l(int, locale_t);
+int toupper_l(int, locale_t);
+#endif
+
#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
int isascii(int);
int toascii(int);
Index: src/lib/libc/gen/isctype.c
diff -u src/lib/libc/gen/isctype.c:1.22 src/lib/libc/gen/isctype.c:1.23
--- src/lib/libc/gen/isctype.c:1.22 Sat Apr 13 10:21:20 2013
+++ src/lib/libc/gen/isctype.c Tue Apr 16 11:29:13 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: isctype.c,v 1.22 2013/04/13 10:21:20 joerg Exp $ */
+/* $NetBSD: isctype.c,v 1.23 2013/04/16 11:29:13 joerg Exp $ */
/*-
* Copyright (c)2008 Citrus Project,
@@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: isctype.c,v 1.22 2013/04/13 10:21:20 joerg Exp $");
+__RCSID("$NetBSD: isctype.c,v 1.23 2013/04/16 11:29:13 joerg Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@@ -53,6 +53,13 @@ int \
is##name(int c) \
{ \
return (int)(_CTYPE_TAB(ctype_tab, c) & (bit)); \
+} \
+int \
+is##name ## _l(int c, locale_t loc) \
+{ \
+ if (loc == NULL) \
+ loc = _C_locale; \
+ return (int)(((loc->cache->ctype_tab + 1)[c]) & (bit)); \
}
_ISCTYPE_FUNC(alnum, (_CTYPE_A|_CTYPE_D))
@@ -75,12 +82,28 @@ toupper(int c)
}
int
+toupper_l(int c, locale_t loc)
+{
+ if (loc == NULL)
+ loc = _C_locale;
+ return (int)(((loc->cache->toupper_tab + 1)[c]));
+}
+
+int
tolower(int c)
{
return (int)_CTYPE_TAB(tolower_tab, c);
}
int
+tolower_l(int c, locale_t loc)
+{
+ if (loc == NULL)
+ loc = _C_locale;
+ return (int)(((loc->cache->tolower_tab + 1)[c]));
+}
+
+int
_toupper(int c)
{
return (c - 'a' + 'A');