Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libc / ctype / isprint.c
blobe34fbe28a2acf9088d5221de30adfefbfa644259
1 /*
2 FUNCTION
3 <<isprint>>, <<isgraph>>, <<isprint_l>>, <<isgraph_l>>---printable character predicates
5 INDEX
6 isprint
8 INDEX
9 isgraph
11 INDEX
12 isprint_l
14 INDEX
15 isgraph_l
17 SYNOPSIS
18 #include <ctype.h>
19 int isprint(int <[c]>);
20 int isgraph(int <[c]>);
22 #include <ctype.h>
23 int isprint_l(int <[c]>, locale_t <[locale]>);
24 int isgraph_l(int <[c]>, locale_t <[locale]>);
26 DESCRIPTION
27 <<isprint>> is a macro which classifies singlebyte charset values by table
28 lookup. It is a predicate returning non-zero for printable characters,
29 and 0 for other character arguments. It is defined only if <[c]> is
30 representable as an unsigned char or if <[c]> is EOF.
32 <<isgraph>> behaves identically to <<isprint>>, except that space characters
33 are excluded.
35 <<isprint_l>>, <<isgraph_l>> are like <<isprint>>, <<isgraph>> but perform
36 the check based on the locale specified by the locale object locale. If
37 <[locale]> is LC_GLOBAL_LOCALE or not a valid locale object, the behaviour
38 is undefined.
40 You can use a compiled subroutine instead of the macro definition by
41 undefining either macro using `<<#undef isprint>>' or `<<#undef isgraph>>',
42 or `<<#undef isprint_l>>' or `<<#undef isgraph_l>>'.
44 RETURNS
45 <<isprint>>, <<isprint_l>> return non-zero if <[c]> is a printing character.
46 <<isgraph>>, <<isgraph_l>> return non-zero if <[c]> is a printing character
47 except spaces.
49 PORTABILITY
50 <<isprint>> and <<isgraph>> are ANSI C.
52 No supporting OS subroutines are required.
55 #include <_ansi.h>
56 #include <ctype.h>
58 #undef isgraph
59 int
60 isgraph (int c)
62 return(__CTYPE_PTR[c+1] & (_P|_U|_L|_N));
66 #undef isprint
67 int
68 isprint (int c)
70 return(__CTYPE_PTR[c+1] & (_P|_U|_L|_N|_B));