Print this page
2964 need POSIX 2008 locale object support
Reviewed by: Robert Mustacchi <rm@joyent.com>
@@ -1,6 +1,7 @@
/*
+ * Copyright 2013 Garrett D'Amore <garrett@damore.org>
* Copyright 2010 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2002 Tim J. Robbins.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -27,14 +28,21 @@
#include "lint.h"
#include <ctype.h>
#include <string.h>
#include <wctype.h>
+#include <note.h>
+#include <locale.h>
#include "_ctype.h"
+/*
+ * For now, we don't support locale specific character classes. This is
+ * a capability that needs to be added (locales should be able to define
+ * their own character classes.)
+ */
wctype_t
-wctype(const char *property)
+wctype_l(const char *property, locale_t loc)
{
static const struct {
const char *name;
wctype_t mask;
} props[] = {
@@ -55,12 +63,19 @@
{ "phonogram", _CTYPE_Q }, /* BSD extension */
{ "rune", -1 }, /* BSD extension */
{ NULL, 0 }, /* Default */
};
int i;
+ _NOTE(ARGUNUSED(loc));
i = 0;
while (props[i].name != NULL && strcmp(props[i].name, property) != 0)
i++;
return (props[i].mask);
+}
+
+wctype_t
+wctype(const char *property)
+{
+ return (wctype_l(property, uselocale(NULL)));
}