Adding tests
[mozilla-central.git] / modules / libjar / nsWildCard.h
blob1267c826004751ee6e3cab3decb1b03bdaaab94b
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s):
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
39 * nsWildCard.h: Defines and prototypes for shell exp. match routines
41 * See nsIZipReader.findEntries docs in nsIZipReader.idl for a description of
42 * the supported expression syntax.
44 * Note that the syntax documentation explicitly says the results of certain
45 * expressions are undefined. This is intentional to require less robustness
46 * in the code. Regular expression parsing is hard; the smaller the set of
47 * features and interactions this code must support, the easier it is to
48 * ensure it works.
52 #ifndef nsWildCard_h__
53 #define nsWildCard_h__
55 #include "prtypes.h"
56 #include <ctype.h> /* isalnum */
57 #include <string.h> /* strlen */
59 /* --------------------------- Public routines ---------------------------- */
63 * NS_WildCardValid takes a shell expression exp as input. It returns:
65 * NON_SXP if exp is a standard string
66 * INVALID_SXP if exp is a shell expression, but invalid
67 * VALID_SXP if exp is a valid shell expression
70 #define NON_SXP -1
71 #define INVALID_SXP -2
72 #define VALID_SXP 1
74 extern int NS_WildCardValid(char *expr);
77 /* return values for the search routines */
78 #define MATCH 0
79 #define NOMATCH 1
80 #define ABORTED -1
83 * NS_WildCardMatch
85 * Takes a prevalidated shell expression exp, and a string str.
87 * Returns 0 on match and 1 on non-match.
90 extern int NS_WildCardMatch(char *str, char *expr, PRBool case_insensitive);
92 #endif /* nsWildCard_h__ */