diff options
author | Garrett D'Amore <garrett@damore.org> | 2014-05-18 20:08:38 -0700 |
---|---|---|
committer | Garrett D'Amore <garrett@damore.org> | 2014-07-11 20:35:28 -0700 |
commit | 2d08521bd15501c8370ba2153b9cca4f094979d0 (patch) | |
tree | cd843bc37fe795bc7bbdd04b5b13b0310a2d6be1 /usr/src/cmd | |
parent | 961519c5bffd5ec670890fc3596d6c4ff1cefea0 (diff) | |
download | illumos-joyent-2d08521bd15501c8370ba2153b9cca4f094979d0.tar.gz |
2964 need POSIX 2008 locale object support
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Diffstat (limited to 'usr/src/cmd')
-rw-r--r-- | usr/src/cmd/localedef/messages.c | 3 | ||||
-rw-r--r-- | usr/src/cmd/localedef/monetary.c | 3 | ||||
-rw-r--r-- | usr/src/cmd/localedef/numeric.c | 3 | ||||
-rw-r--r-- | usr/src/cmd/localedef/time.c | 3 | ||||
-rw-r--r-- | usr/src/cmd/mdb/common/kmdb/mapfile_skel | 14 | ||||
-rw-r--r-- | usr/src/cmd/mdb/common/libstand/ctype.c | 135 | ||||
-rw-r--r-- | usr/src/cmd/sgs/rtld/common/external.c | 50 |
7 files changed, 161 insertions, 50 deletions
diff --git a/usr/src/cmd/localedef/messages.c b/usr/src/cmd/localedef/messages.c index 18f8ef0bd7..3c7cc0201c 100644 --- a/usr/src/cmd/localedef/messages.c +++ b/usr/src/cmd/localedef/messages.c @@ -10,6 +10,7 @@ */ /* + * Copyright 2013 Garrett D'Amore <garrett@damore.org> * Copyright 2010 Nexenta Systems, Inc. All rights reserved. */ @@ -28,7 +29,7 @@ #include "parser.tab.h" #include "lmessages.h" -static struct lc_messages_T msgs; +static struct lc_messages msgs; void init_messages(void) diff --git a/usr/src/cmd/localedef/monetary.c b/usr/src/cmd/localedef/monetary.c index c6f4780c2a..126ae6bf3f 100644 --- a/usr/src/cmd/localedef/monetary.c +++ b/usr/src/cmd/localedef/monetary.c @@ -10,6 +10,7 @@ */ /* + * Copyright 2013 Garrett D'Amore <garrett@damore.org> * Copyright 2010 Nexenta Systems, Inc. All rights reserved. */ @@ -27,7 +28,7 @@ #include "parser.tab.h" #include "lmonetary.h" -static struct lc_monetary_T mon; +static struct lc_monetary mon; void init_monetary(void) diff --git a/usr/src/cmd/localedef/numeric.c b/usr/src/cmd/localedef/numeric.c index 2a0892bb63..b6935bd21c 100644 --- a/usr/src/cmd/localedef/numeric.c +++ b/usr/src/cmd/localedef/numeric.c @@ -10,6 +10,7 @@ */ /* + * Copyright 2013 Garrett D'Amore <garrett@damore.org> * Copyright 2010 Nexenta Systems, Inc. All rights reserved. */ @@ -27,7 +28,7 @@ #include "parser.tab.h" #include "lnumeric.h" -static struct lc_numeric_T numeric; +static struct lc_numeric numeric; void init_numeric(void) diff --git a/usr/src/cmd/localedef/time.c b/usr/src/cmd/localedef/time.c index d4cb9d65cd..8347f0ecb7 100644 --- a/usr/src/cmd/localedef/time.c +++ b/usr/src/cmd/localedef/time.c @@ -10,6 +10,7 @@ */ /* + * Copyright 2013 Garrett D'Amore <garrett@damore.org> * Copyright 2010 Nexenta Systems, Inc. All rights reserved. */ @@ -27,7 +28,7 @@ #include "parser.tab.h" #include "timelocal.h" -struct lc_time_T tm; +struct lc_time tm; void init_time(void) diff --git a/usr/src/cmd/mdb/common/kmdb/mapfile_skel b/usr/src/cmd/mdb/common/kmdb/mapfile_skel index bbf6767bf3..2d55703c7d 100644 --- a/usr/src/cmd/mdb/common/kmdb/mapfile_skel +++ b/usr/src/cmd/mdb/common/kmdb/mapfile_skel @@ -21,6 +21,7 @@ /* BEGIN PROLOGUE */ /* * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2014 Garrett D'Amore <garrett@damore.org> */ /* @@ -44,10 +45,19 @@ SYMBOL_SCOPE { * Secret additions to the module API */ - /* Implementation detail of the ctype macros */ - __ctype; /* variable */ /* There should be only one - ours */ errno; /* variable */ + isprint; + isalnum; + isalpha; + isgraph; + iscntrl; + isdigit; + isxdigit; + isupper; + islower; + ispunct; + isspace; mdb_tgt_aread; mdb_dis_create; diff --git a/usr/src/cmd/mdb/common/libstand/ctype.c b/usr/src/cmd/mdb/common/libstand/ctype.c index 4037d0f0db..49200afac0 100644 --- a/usr/src/cmd/mdb/common/libstand/ctype.c +++ b/usr/src/cmd/mdb/common/libstand/ctype.c @@ -1,50 +1,97 @@ /* - * CDDL HEADER START + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2014 Garrett D'Amore <garrett@damore.org> */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * ASCII versions of ctype character classification functions. This avoids + * pulling in the entire locale framework that is in libc. */ -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <ctype.h> - -unsigned char __ctype[129] = -{ - 0, /* EOF */ - _C, _C, _C, _C, _C, _C, _C, _C, - _C, _S|_C, _S|_C, _S|_C, _S|_C, _S|_C, _C, _C, - _C, _C, _C, _C, _C, _C, _C, _C, - _C, _C, _C, _C, _C, _C, _C, _C, - _S|_B, _P, _P, _P, _P, _P, _P, _P, - _P, _P, _P, _P, _P, _P, _P, _P, - _N|_X, _N|_X, _N|_X, _N|_X, _N|_X, _N|_X, _N|_X, _N|_X, - _N|_X, _N|_X, _P, _P, _P, _P, _P, _P, - _P, _U|_X, _U|_X, _U|_X, _U|_X, _U|_X, _U|_X, _U, - _U, _U, _U, _U, _U, _U, _U, _U, - _U, _U, _U, _U, _U, _U, _U, _U, - _U, _U, _U, _P, _P, _P, _P, _P, - _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, - _L, _L, _L, _P, _P, _P, _P, _C, -}; +int +isdigit(int c) +{ + return ((c >= '0' && c <= '9') ? 1 : 0); +} + +int +isupper(int c) +{ + return ((c >= 'A' && c <= 'Z') ? 1 : 0); +} + + +int +islower(int c) +{ + return ((c >= 'a' && c <= 'z') ? 1 : 0); +} + +int +isspace(int c) +{ + return (((c == ' ') || (c == '\t') || (c == '\r') || (c == '\n') || + (c == '\v') || (c == '\f')) ? 1 : 0); +} + +int +isxdigit(int c) +{ + return ((isdigit(c) || (c >= 'A' && c <= 'F') || + (c >= 'a' && c <= 'f')) ? 1 : 0); +} + +int +isalpha(int c) +{ + return ((isupper(c) || islower(c)) ? 1 : 0); +} + + +int +isalnum(int c) +{ + return ((isalpha(c) || isdigit(c)) ? 1 : 0); +} + +int +ispunct(int c) +{ + return (((c >= '!') && (c <= '/')) || + ((c >= ':') && (c <= '@')) || + ((c >= '[') && (c <= '`')) || + ((c >= '{') && (c <= '~'))); +} + +int +iscntrl(int c) +{ + return ((c < 0x20) || (c == 0x7f)); +} + +int +isprint(int c) +{ + /* + * Almost the inverse of iscntrl, but be careful that c > 0x7f + * returns false for everything. + */ + return ((c >= ' ') && (c <= '~')); +} + +int +isgraph(int c) +{ + /* isgraph is like is print, but excludes <space> */ + return ((c >= '!') && (c <= '~')); +} diff --git a/usr/src/cmd/sgs/rtld/common/external.c b/usr/src/cmd/sgs/rtld/common/external.c index 82766906b5..e2ebd89145 100644 --- a/usr/src/cmd/sgs/rtld/common/external.c +++ b/usr/src/cmd/sgs/rtld/common/external.c @@ -21,6 +21,7 @@ /* * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2014 Garrett D'Amore <garrett@damore.org> */ /* @@ -668,3 +669,52 @@ write(int fd, const void *buf, size_t size) extern ssize_t __write(int, const void *, size_t); return (__write(fd, buf, size)); } + +/* + * ASCII versions of ctype character classification functions. This avoids + * pulling in the entire locale framework that is in libc. + */ + +int +isdigit(int c) +{ + return ((c >= '0' && c <= '9') ? 1 : 0); +} + +int +isupper(int c) +{ + return ((c >= 'A' && c <= 'Z') ? 1 : 0); +} + +int +islower(int c) +{ + return ((c >= 'a' && c <= 'z') ? 1 : 0); +} + +int +isspace(int c) +{ + return (((c == ' ') || (c == '\t') || (c == '\r') || (c == '\n') || + (c == '\v') || (c == '\f')) ? 1 : 0); +} + +int +isxdigit(int c) +{ + return ((isdigit(c) || (c >= 'A' && c <= 'F') || + (c >= 'a' && c <= 'f')) ? 1 : 0); +} + +int +isalpha(int c) +{ + return ((isupper(c) || islower(c)) ? 1 : 0); +} + +int +isalnum(int c) +{ + return ((isalpha(c) || isdigit(c)) ? 1 : 0); +} |