diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2008-11-16 17:21:38 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2008-11-16 17:21:38 +0000 |
commit | 0128518fafdd994a8cb405ee966bac3366c0bb99 (patch) | |
tree | 83500e8283764b21709f21d43f996ba42991e7de /mfd | |
parent | 049c2acd31ceead3cb2a28466b6a0085f14e2bf9 (diff) | |
download | mailfromd-0128518fafdd994a8cb405ee966bac3366c0bb99.tar.gz mailfromd-0128518fafdd994a8cb405ee966bac3366c0bb99.tar.bz2 |
Implement ctype functions.
* mfd/bi_ctype.m4: New function.
* mfd/Makefile.am (inc_DATA): Add bi_ctype.m4.
* doc/Makefile.am (check-builtins): Update source sed expression.
* doc/mailfromd.texi, NEWS: Document ctype functions.
git-svn-id: file:///svnroot/mailfromd/trunk@1752 7a8a7f39-df28-0410-adc6-e0d955640f24
Diffstat (limited to 'mfd')
-rw-r--r-- | mfd/Makefile.am | 1 | ||||
-rw-r--r-- | mfd/bi_ctype.m4 | 47 |
2 files changed, 48 insertions, 0 deletions
diff --git a/mfd/Makefile.am b/mfd/Makefile.am index f1b35113..71517a97 100644 --- a/mfd/Makefile.am +++ b/mfd/Makefile.am @@ -21,6 +21,7 @@ inc_DATA = status.mfh M4_FILES=\ bi_body.m4\ + bi_ctype.m4\ bi_db.m4\ bi_dns.m4\ bi_getopt.m4\ diff --git a/mfd/bi_ctype.m4 b/mfd/bi_ctype.m4 new file mode 100644 index 00000000..1a0bfdb1 --- /dev/null +++ b/mfd/bi_ctype.m4 @@ -0,0 +1,47 @@ +/* This file is part of Mailfromd. -*- c -*- + Copyright (C) 2006, 2007, 2008 Sergey Poznyakoff + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +MF_VAR(ctype_mismatch, NUMBER); + +m4_define([<MF_DEFUN_CTYPE>],[< +MF_DEFUN($1, NUMBER, STRING str) +{ + int i; + for (i = 0; str[i]; i++) + if (!c_$1(str[i])) { + MF_VAR_REF(ctype_mismatch, i); + MF_RETURN(0); + } + MF_RETURN(1); +} +END +>]) + +MF_DEFUN_CTYPE(isalnum) +MF_DEFUN_CTYPE(isalpha) +MF_DEFUN_CTYPE(isascii) +MF_DEFUN_CTYPE(isblank) +MF_DEFUN_CTYPE(iscntrl) +MF_DEFUN_CTYPE(isdigit) +MF_DEFUN_CTYPE(isgraph) +MF_DEFUN_CTYPE(islower) +MF_DEFUN_CTYPE(isprint) +MF_DEFUN_CTYPE(ispunct) +MF_DEFUN_CTYPE(isspace) +MF_DEFUN_CTYPE(isupper) +MF_DEFUN_CTYPE(isxdigit) + +MF_INIT |