libc/newlib/libc/ctype/isascii.c

51 lines
1.1 KiB
C
Raw Normal View History

2000-02-17 20:39:52 +01:00
/*
FUNCTION
<<isascii>>, <<isascii_l>>---ASCII character predicate
2000-02-17 20:39:52 +01:00
INDEX
isascii
INDEX
isascii_l
SYNOPSIS
2000-02-17 20:39:52 +01:00
#include <ctype.h>
int isascii(int <[c]>);
#include <ctype.h>
int isascii_l(int <[c]>, locale_t <[locale]>);
2000-02-17 20:39:52 +01:00
DESCRIPTION
<<isascii>> is a macro which returns non-zero when <[c]> is an ASCII
character, and 0 otherwise. It is defined for all integer values.
<<isascii_l>> is like <<isascii>> but performs the check based on the
locale specified by the locale object locale. If <[locale]> is
LC_GLOBAL_LOCALE or not a valid locale object, the behaviour is undefined.
2000-02-17 20:39:52 +01:00
You can use a compiled subroutine instead of the macro definition by
undefining the macro using `<<#undef isascii>>' or `<<#undef isascii_l>>'.
2000-02-17 20:39:52 +01:00
RETURNS
<<isascii>>, <<isascii_l>> return non-zero if the low order byte of <[c]>
is in the range 0 to 127 (<<0x00>>--<<0x7F>>).
2000-02-17 20:39:52 +01:00
PORTABILITY
<<isascii>> is ANSI C.
<<isascii_l>> is a GNU extension.
2000-02-17 20:39:52 +01:00
No supporting OS subroutines are required.
*/
#include <_ansi.h>
#include <ctype.h>
#undef isascii
int
isascii (int c)
2000-02-17 20:39:52 +01:00
{
return c >= 0 && c< 128;
}