152843Sphk/*- 252843Sphk * Copyright (c) 1982, 1988, 1991, 1993 352843Sphk * The Regents of the University of California. All rights reserved. 452843Sphk * (c) UNIX System Laboratories, Inc. 552843Sphk * All or some portions of this file are derived from material licensed 652843Sphk * to the University of California by American Telephone and Telegraph 752843Sphk * Co. or Unix System Laboratories, Inc. and are reproduced herein with 852843Sphk * the permission of UNIX System Laboratories, Inc. 952843Sphk * 1052843Sphk * Redistribution and use in source and binary forms, with or without 1152843Sphk * modification, are permitted provided that the following conditions 1252843Sphk * are met: 1352843Sphk * 1. Redistributions of source code must retain the above copyright 1452843Sphk * notice, this list of conditions and the following disclaimer. 1552843Sphk * 2. Redistributions in binary form must reproduce the above copyright 1652843Sphk * notice, this list of conditions and the following disclaimer in the 1752843Sphk * documentation and/or other materials provided with the distribution. 1852843Sphk * 4. Neither the name of the University nor the names of its contributors 1952843Sphk * may be used to endorse or promote products derived from this software 2052843Sphk * without specific prior written permission. 2152843Sphk * 2252843Sphk * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2352843Sphk * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2452843Sphk * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2552843Sphk * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2652843Sphk * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2752843Sphk * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2852843Sphk * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2952843Sphk * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3052843Sphk * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3152843Sphk * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3252843Sphk * SUCH DAMAGE. 3352843Sphk * 3452843Sphk * $FreeBSD: stable/11/sys/sys/ctype.h 345941 2019-04-05 11:34:13Z hselasky $ 3552843Sphk */ 3652843Sphk 3752843Sphk#ifndef _SYS_CTYPE_H_ 3852843Sphk#define _SYS_CTYPE_H_ 3952843Sphk 4055205Speter#ifdef _KERNEL 4152843Sphk 42345941Shselaskystatic __inline int 43345941Shselaskyisspace(int c) 44345941Shselasky{ 45345941Shselasky return (c == ' ' || (c >= '\t' && c <= '\r')); 46345941Shselasky} 4752843Sphk 48345941Shselaskystatic __inline int 49345941Shselaskyisascii(int c) 50345941Shselasky{ 51345941Shselasky return ((c & ~0x7f) == 0); 52345941Shselasky} 5352843Sphk 54345941Shselaskystatic __inline int 55345941Shselaskyisupper(int c) 56345941Shselasky{ 57345941Shselasky return (c >= 'A' && c <= 'Z'); 58345941Shselasky} 59345941Shselasky 60345941Shselaskystatic __inline int 61345941Shselaskyislower(int c) 62345941Shselasky{ 63345941Shselasky return (c >= 'a' && c <= 'z'); 64345941Shselasky} 65345941Shselasky 66345941Shselaskystatic __inline int 67345941Shselaskyisalpha(int c) 68345941Shselasky{ 69345941Shselasky return (isupper(c) || islower(c)); 70345941Shselasky} 71345941Shselasky 72345941Shselaskystatic __inline int 73345941Shselaskyisdigit(int c) 74345941Shselasky{ 75345941Shselasky return (c >= '0' && c <= '9'); 76345941Shselasky} 77345941Shselasky 78345941Shselaskystatic __inline int 79345941Shselaskyisxdigit(int c) 80345941Shselasky{ 81345941Shselasky return (isdigit(c) || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f')); 82345941Shselasky} 83345941Shselasky 84345941Shselaskystatic __inline int 85345941Shselaskyisprint(int c) 86345941Shselasky{ 87345941Shselasky return (c >= ' ' && c <= '~'); 88345941Shselasky} 89345941Shselasky 90345941Shselaskystatic __inline int 91345941Shselaskytoupper(int c) 92345941Shselasky{ 93345941Shselasky return (c - 0x20 * ((c >= 'a') && (c <= 'z'))); 94345941Shselasky} 95345941Shselasky 96345941Shselaskystatic __inline int 97345941Shselaskytolower(int c) 98345941Shselasky{ 99345941Shselasky return (c + 0x20 * ((c >= 'A') && (c <= 'Z'))); 100345941Shselasky} 101345941Shselasky 10255205Speter#endif 10352843Sphk#endif /* !_SYS_CTYPE_H_ */ 104