ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/ermyth/include/match.h
Revision: 1.2
Committed: Sat Jul 21 01:29:07 2007 UTC (16 years, 10 months ago) by pippijn
Content type: text/plain
Branch: MAIN
Changes since 1.1: +2 -2 lines
Log Message:
- moved to new documentation system
- fixed small build error

File Contents

# User Rev Content
1 pippijn 1.1 /*
2     * Copyright © 2003-2004 E. Will et al.
3     * Copyright © 2005-2006 Atheme Development Group
4 pippijn 1.2 * Rights to this code are as defined in doc/pod/license.pod.
5 pippijn 1.1 *
6     * String matching
7     *
8 pippijn 1.2 * $Id: match.h,v 1.1 2007-07-19 08:24:50 pippijn Exp $
9 pippijn 1.1 */
10    
11     #ifndef _MATCH_H
12     #define _MATCH_H
13    
14     /* cidr.c */
15     E int match_ips (const char *mask, const char *address);
16     E int match_cidr (const char *mask, const char *address);
17    
18     /* match.c */
19     #define MATCH_RFC1459 0
20     #define MATCH_ASCII 1
21    
22     E int match_mapping;
23    
24     #define IsLower(c) ((unsigned char)(c) > 0x5f)
25     #define IsUpper(c) ((unsigned char)(c) < 0x60)
26    
27     #define C_ALPHA 0x00000001
28     #define C_DIGIT 0x00000002
29    
30     E const unsigned int charattrs[];
31    
32     #define IsAlpha(c) (charattrs[(unsigned char) (c)] & C_ALPHA)
33     #define IsDigit(c) (charattrs[(unsigned char) (c)] & C_DIGIT)
34     #define IsAlphaNum(c) (IsAlpha((c)) || IsDigit((c)))
35     #define IsNon(c) (!IsAlphaNum((c)))
36    
37     E const unsigned char ToLowerTab[];
38     E const unsigned char ToUpperTab[];
39    
40     void set_match_mapping (int);
41    
42     E int ToLower (int);
43     E int ToUpper (int);
44    
45     E int irccasecmp (const char *, const char *);
46     E int ircncasecmp (const char *, const char *, int);
47    
48     E int match (const char *, const char *);
49     E char *collapse (char *);
50    
51     /* regex_create() flags */
52     #define AREGEX_ICASE 1 /* case insensitive */
53    
54     E regex_t *regex_create (char *pattern, int flags);
55     E char *regex_extract (char *pattern, char **pend, int *pflags);
56     E bool regex_match (regex_t * preg, char *string);
57     E bool regex_destroy (regex_t * preg);
58    
59     #endif