xref: /csrg-svn/lib/libc/locale/isctype.c (revision 66250)
138140Sbostic /*
261136Sbostic  * Copyright (c) 1989, 1993
361136Sbostic  *	The Regents of the University of California.  All rights reserved.
465765Sbostic  * (c) UNIX System Laboratories, Inc.
565765Sbostic  * All or some portions of this file are derived from material licensed
665765Sbostic  * to the University of California by American Telephone and Telegraph
765765Sbostic  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
865765Sbostic  * the permission of UNIX System Laboratories, Inc.
938140Sbostic  *
1060469Sbostic  * This code is derived from software contributed to Berkeley by
1160469Sbostic  * Paul Borman at Krystal Technologies.
1260469Sbostic  *
1342625Sbostic  * %sccs.include.redist.c%
1438140Sbostic  */
1538140Sbostic 
1638140Sbostic #if defined(LIBC_SCCS) && !defined(lint)
17*66250Sbostic static char sccsid[] = "@(#)isctype.c	8.3 (Berkeley) 02/24/94";
1838140Sbostic #endif /* LIBC_SCCS and not lint */
1938140Sbostic 
2038140Sbostic #define _ANSI_LIBRARY
2138140Sbostic #include <ctype.h>
2238140Sbostic 
2338140Sbostic #undef isalnum
2460469Sbostic int
isalnum(c)2538140Sbostic isalnum(c)
2638140Sbostic 	int c;
2738140Sbostic {
2860469Sbostic 	return(__istype((c), (_A|_D)));
2938140Sbostic }
3038140Sbostic 
3138140Sbostic #undef isalpha
3260469Sbostic int
isalpha(c)3338140Sbostic isalpha(c)
3438140Sbostic 	int c;
3538140Sbostic {
3660469Sbostic 	return (__istype((c), _A));
3738140Sbostic }
3838140Sbostic 
3951608Sbostic #undef isascii
4060469Sbostic int
isascii(c)4151608Sbostic isascii(c)
4251608Sbostic 	int c;
4351608Sbostic {
4460469Sbostic 	return((c & ~0x7F) == 0);
4551608Sbostic }
4651608Sbostic 
4751386Sbostic #undef isblank
4860469Sbostic int
isblank(c)4951386Sbostic isblank(c)
5051386Sbostic 	int c;
5151386Sbostic {
5260469Sbostic 	return (__istype((c), _B));
5351386Sbostic }
5451386Sbostic 
5538140Sbostic #undef iscntrl
5660469Sbostic int
iscntrl(c)5738140Sbostic iscntrl(c)
5838140Sbostic 	int c;
5938140Sbostic {
6060469Sbostic 	return (__istype((c), _C));
6138140Sbostic }
6238140Sbostic 
6338140Sbostic #undef isdigit
6460469Sbostic int
isdigit(c)6538140Sbostic isdigit(c)
6638140Sbostic 	int c;
6738140Sbostic {
6860469Sbostic 	return (__isctype((c), _D));
6938140Sbostic }
7038140Sbostic 
7138140Sbostic #undef isgraph
7260469Sbostic int
isgraph(c)7338140Sbostic isgraph(c)
7438140Sbostic 	int c;
7538140Sbostic {
7660469Sbostic 	return (__istype((c), _G));
7738140Sbostic }
7838140Sbostic 
7938140Sbostic #undef islower
8060469Sbostic int
islower(c)8138140Sbostic islower(c)
8238140Sbostic 	int c;
8338140Sbostic {
8460469Sbostic 	return (__istype((c), _L));
8538140Sbostic }
8638140Sbostic 
8738140Sbostic #undef isprint
8860469Sbostic int
isprint(c)8938140Sbostic isprint(c)
9038140Sbostic 	int c;
9138140Sbostic {
9260469Sbostic 	return (__istype((c), _R));
9338140Sbostic }
9438140Sbostic 
9538140Sbostic #undef ispunct
9660469Sbostic int
ispunct(c)9738140Sbostic ispunct(c)
9838140Sbostic 	int c;
9938140Sbostic {
10060469Sbostic 	return (__istype((c), _P));
10138140Sbostic }
10238140Sbostic 
10338140Sbostic #undef isspace
10460469Sbostic int
isspace(c)10538140Sbostic isspace(c)
10638140Sbostic 	int c;
10738140Sbostic {
10860469Sbostic 	return (__istype((c), _S));
10938140Sbostic }
11038140Sbostic 
11138140Sbostic #undef isupper
11260469Sbostic int
isupper(c)11338140Sbostic isupper(c)
11438140Sbostic 	int c;
11538140Sbostic {
11660469Sbostic 	return (__istype((c), _U));
11738140Sbostic }
11838140Sbostic 
11938140Sbostic #undef isxdigit
12060469Sbostic int
isxdigit(c)12138140Sbostic isxdigit(c)
12238140Sbostic 	int c;
12338140Sbostic {
12460469Sbostic 	return (__isctype((c), _X));
12538140Sbostic }
12638140Sbostic 
12751608Sbostic #undef toascii
12860469Sbostic int
toascii(c)12951608Sbostic toascii(c)
13051608Sbostic 	int c;
13151608Sbostic {
13251608Sbostic 	return (c & 0177);
13351608Sbostic }
13451608Sbostic 
13538140Sbostic #undef tolower
13660469Sbostic int
tolower(c)13738140Sbostic tolower(c)
13838140Sbostic 	int c;
13938140Sbostic {
140*66250Sbostic         return((c & _CRMASK) ? ___tolower(c) : _CurrentRuneLocale->maplower[c]);
14138140Sbostic }
14238140Sbostic 
14338140Sbostic #undef toupper
14460469Sbostic int
toupper(c)14538140Sbostic toupper(c)
14638140Sbostic 	int c;
14738140Sbostic {
148*66250Sbostic         return((c & _CRMASK) ? ___toupper(c) : _CurrentRuneLocale->mapupper[c]);
14938140Sbostic }
150