/*-1* SPDX-License-Identifier: BSD-3-Clause2*3* Copyright (c) 1989, 19934* The Regents of the University of California. All rights reserved.5* (c) UNIX System Laboratories, Inc.6* All or some portions of this file are derived from material licensed7* to the University of California by American Telephone and Telegraph8* Co. or Unix System Laboratories, Inc. and are reproduced herein with9* the permission of UNIX System Laboratories, Inc.10*11* This code is derived from software contributed to Berkeley by12* Paul Borman at Krystal Technologies.13*14* Redistribution and use in source and binary forms, with or without15* modification, are permitted provided that the following conditions16* are met:17* 1. Redistributions of source code must retain the above copyright18* notice, this list of conditions and the following disclaimer.19* 2. Redistributions in binary form must reproduce the above copyright20* notice, this list of conditions and the following disclaimer in the21* documentation and/or other materials provided with the distribution.22* 3. Neither the name of the University nor the names of its contributors23* may be used to endorse or promote products derived from this software24* without specific prior written permission.25*26* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND27* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE28* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE29* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE30* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL31* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS32* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)33* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT34* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY35* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF36* SUCH DAMAGE.37*/3839#ifndef _CTYPE_H_40#define _CTYPE_H_4142#include <sys/cdefs.h>43#include <sys/_types.h>44#include <_ctype.h>4546__BEGIN_DECLS47int isalnum(int);48int isalpha(int);49int iscntrl(int);50int isdigit(int);51int isgraph(int);52int islower(int);53int isprint(int);54int ispunct(int);55int isspace(int);56int isupper(int);57int isxdigit(int);58int tolower(int);59int toupper(int);6061#if __XSI_VISIBLE62int isascii(int);63int toascii(int);64#endif6566#if __ISO_C_VISIBLE >= 199967int isblank(int);68#endif6970#if __BSD_VISIBLE71int digittoint(int);72int ishexnumber(int);73int isideogram(int);74int isnumber(int);75int isphonogram(int);76int isrune(int);77int isspecial(int);78#endif7980#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)81#include <xlocale/_ctype.h>82#endif83__END_DECLS8485#ifndef __cplusplus86#define isalnum(c) __sbistype((c), _CTYPE_A|_CTYPE_D|_CTYPE_N)87#define isalpha(c) __sbistype((c), _CTYPE_A)88#define iscntrl(c) __sbistype((c), _CTYPE_C)89#define isdigit(c) __sbistype((c), _CTYPE_D)90#define isgraph(c) __sbistype((c), _CTYPE_G)91#define islower(c) __sbistype((c), _CTYPE_L)92#define isprint(c) __sbistype((c), _CTYPE_R)93#define ispunct(c) __sbistype((c), _CTYPE_P)94#define isspace(c) __sbistype((c), _CTYPE_S)95#define isupper(c) __sbistype((c), _CTYPE_U)96#define isxdigit(c) __sbistype((c), _CTYPE_X)97#define tolower(c) __sbtolower(c)98#define toupper(c) __sbtoupper(c)99#endif /* !__cplusplus */100101#if __XSI_VISIBLE102/*103* POSIX.1-2001 specifies _tolower() and _toupper() to be macros equivalent to104* tolower() and toupper() respectively, minus extra checking to ensure that105* the argument is a lower or uppercase letter respectively. We've chosen to106* implement these macros with the same error checking as tolower() and107* toupper() since this doesn't violate the specification itself, only its108* intent. We purposely leave _tolower() and _toupper() undocumented to109* discourage their use.110*111* XXX isascii() and toascii() should similarly be undocumented.112*/113#define _tolower(c) __sbtolower(c)114#define _toupper(c) __sbtoupper(c)115#define isascii(c) (((c) & ~0x7F) == 0)116#define toascii(c) ((c) & 0x7F)117#endif118119#if __ISO_C_VISIBLE >= 1999 && !defined(__cplusplus)120#define isblank(c) __sbistype((c), _CTYPE_B)121#endif122123#if __BSD_VISIBLE124#define digittoint(c) __sbmaskrune((c), 0xFF)125#define ishexnumber(c) __sbistype((c), _CTYPE_X)126#define isideogram(c) __sbistype((c), _CTYPE_I)127#define isnumber(c) __sbistype((c), _CTYPE_D|_CTYPE_N)128#define isphonogram(c) __sbistype((c), _CTYPE_Q)129#define isrune(c) __sbistype((c), 0xFFFFFF00L)130#define isspecial(c) __sbistype((c), _CTYPE_T)131#endif132133#endif /* !_CTYPE_H_ */134135136