Debian Codegraph @

include/base/shexp.h

raw
1 /** BEGIN COPYRIGHT BLOCK
2 * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
3 * Copyright (C) 2005 Red Hat, Inc.
4 * All rights reserved.
5 *
6 * License: GPL (version 3 or any later version).
7 * See LICENSE for details.
8 * END COPYRIGHT BLOCK **/
9
10 #ifdef HAVE_CONFIG_H
11 #include <config.h>
12 #endif
13
14 #ifndef BASE_SHEXP_H
15 #define BASE_SHEXP_H
16
17 #ifndef NOINTNSAPI
18 #define INTNSAPI
19 #endif /* !NOINTNSAPI */
20
21 /*
22 * shexp.h: Defines and prototypes for shell exp. match routines
23 *
24 *
25 * This routine will match a string with a shell expression. The expressions
26 * accepted are based loosely on the expressions accepted by zsh.
27 *
28 * o * matches anything
29 * o ? matches one character
30 * o \ will escape a special character
31 * o $ matches the end of the string
32 * o [abc] matches one occurence of a, b, or c. The only character that needs
33 * to be escaped in this is ], all others are not special.
34 * o [a-z] matches any character between a and z
35 * o [^az] matches any character except a or z
36 * o ~ followed by another shell expression will remove any pattern
37 * matching the shell expression from the match list
38 * o (foo|bar) will match either the substring foo, or the substring bar.
39 * These can be shell expressions as well.
40 *
41 * The public interface to these routines is documented in
42 * public/base/shexp.h.
43 *
44 * Rob McCool
45 *
46 */
47
48 /*
49 * Requires that the macro MALLOC be set to a "safe" malloc that will
50 * exit if no memory is available. If not under MCC httpd, define MALLOC
51 * to be the real malloc and play with fire, or make your own function.
52 */
53
54 #ifndef NETSITE_H
55 #include "../netsite.h"
56 #endif /* !NETSITE_H */
57
58 #ifndef OS_CTYPE_H
59 #include <ctype.h> /* isalnum */
60 #define OS_CTYPE_H
61 #endif /* !OS_CTYPE_H */
62
63 #ifndef OS_STRING_H
64 #include <string.h> /* strlen */
65 #define OS_STRING_H
66 #endif /* !OS_STRING_H */
67
68 /* See public/base/shexp.h or public/base/regexp.h concerning USE_REGEX */
69
70 /*
71 * This little bit of nonsense is because USE_REGEX is currently
72 * supposed to be recognized only by the proxy. If that's the
73 * case, only the proxy should define USE_REGEX, but I'm playing
74 * it safe. XXXHEP 12/96
75 */
76 #ifndef MCC_PROXY
77 #ifdef USE_REGEX
78 #define SAVED_USE_REGEX USE_REGEX
79 #undef USE_REGEX
80 #endif /* USE_REGEX */
81 #endif /* !MCC_PROXY */
82
83 /* --- Begin function prototypes --- */
84
85 #ifdef INTNSAPI
86
87 NSPR_BEGIN_EXTERN_C
88
89 NSAPI_PUBLIC int INTshexp_valid(char *exp);
90
91 NSAPI_PUBLIC int INTshexp_match(char *str, char *exp);
92
93 NSAPI_PUBLIC int INTshexp_cmp(char *str, char *exp);
94
95 NSAPI_PUBLIC int INTshexp_casecmp(char *str, char *exp);
96
97 NSPR_END_EXTERN_C
98
99 /* --- End function prototypes --- */
100
101 #define shexp_valid INTshexp_valid
102 #define shexp_match INTshexp_match
103 #define shexp_cmp INTshexp_cmp
104 #define shexp_casecmp INTshexp_casecmp
105
106 #endif /* INTNSAPI */
107
108 /* Restore USE_REGEX definition for non-proxy. See above. */
109 #ifdef SAVED_USE_REGEX
110 #define USE_REGEX SAVED_USE_REGEX
111 #undef SAVED_USE_REGEX
112 #endif /* SAVED_USE_REGEX */
113
114 #ifdef USE_REGEX
115 #include "base/regexp.h"
116 #endif /* USE_REGEX */
117
118 #endif /* !BASE_SHEXP_H */