From 9e9207fd5d20f3ac4b365d10f394566cdf7c9199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Fri, 24 Jan 2014 13:44:34 +0000 Subject: [PATCH] Add is_xdigit() predicate. git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@759 185d5e19-27fe-0310-9dcf-9bff6b9f3609 --- lib/libpam/openpam_ctype.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/libpam/openpam_ctype.h b/lib/libpam/openpam_ctype.h index f78574d..96389f8 100644 --- a/lib/libpam/openpam_ctype.h +++ b/lib/libpam/openpam_ctype.h @@ -38,6 +38,14 @@ #define is_digit(ch) \ (ch >= '0' && ch <= '9') +/* + * Evaluates to non-zero if the argument is a hex digit. + */ +#define is_xdigit(ch) \ + ((ch >= '0' && ch <= '9') || \ + (ch >= 'a' && ch <= 'f') || \ + (ch >= 'A' && ch <= 'F')) + /* * Evaluates to non-zero if the argument is an uppercase letter. */