Add predicates for letters and digits.
git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@666 185d5e19-27fe-0310-9dcf-9bff6b9f3609
This commit is contained in:
parent
2dd5f46e84
commit
3353ad06ce
|
@ -32,6 +32,30 @@
|
|||
#ifndef OPENPAM_CTYPE_H_INCLUDED
|
||||
#define OPENPAM_CTYPE_H_INCLUDED
|
||||
|
||||
/*
|
||||
* Evaluates to non-zero if the argument is a digit.
|
||||
*/
|
||||
#define is_digit(ch) \
|
||||
(ch >= '0' && ch <= '9')
|
||||
|
||||
/*
|
||||
* Evaluates to non-zero if the argument is an uppercase letter.
|
||||
*/
|
||||
#define is_upper(ch) \
|
||||
(ch >= 'A' && ch <= 'A')
|
||||
|
||||
/*
|
||||
* Evaluates to non-zero if the argument is a lowercase letter.
|
||||
*/
|
||||
#define is_lower(ch) \
|
||||
(ch >= 'a' && ch <= 'z')
|
||||
|
||||
/*
|
||||
* Evaluates to non-zero if the argument is a letter.
|
||||
*/
|
||||
#define is_letter(ch) \
|
||||
(is_upper(ch) || is_lower(ch))
|
||||
|
||||
/*
|
||||
* Evaluates to non-zero if the argument is a linear whitespace character.
|
||||
* For the purposes of this macro, the definition of linear whitespace is
|
||||
|
@ -59,9 +83,7 @@
|
|||
* of ASCII.
|
||||
*/
|
||||
#define is_pfcs(ch) \
|
||||
((ch >= '0' && ch <= '9') || \
|
||||
(ch >= 'A' && ch <= 'Z') || \
|
||||
(ch >= 'a' && ch <= 'z') || \
|
||||
(is_digit(ch) || is_letter(ch) || \
|
||||
ch == '.' || ch == '_' || ch == '-')
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue