1 /*
2  * Copyright (c) 2003, 2011 Tama Communications Corporation
3  *
4  * This file is part of GNU GLOBAL.
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef _CHAR_H_
21 #define _CHAR_H_
22 
23 extern const unsigned char chartype[256];
24 
25 #define REGEXCHAR		1
26 #define URLCHAR			2
27 #define BINARYCHAR		4
28 #define test_chartype(c, t)	(chartype[(unsigned char)(c)] & (t))
29 
30 /** test whether or not regular expression char. */
31 #define isregexchar(c)		test_chartype(c, REGEXCHAR)
32 
33 /** test whether can be included in URL without escaping. */
34 #define isurlchar(c)		test_chartype(c, URLCHAR)
35 
36 /** test whether or not cahr included in binary file. */
37 #define isbinarychar(c)		test_chartype(c, BINARYCHAR)
38 
39 int isregex(const char *);
40 const char *quote_string(const char *);
41 const char *quote_chars(const char *, unsigned int);
42 const char *quote_shell(const char *);
43 
44 #endif /* ! _CHAR_H_ */
45