security/nss/lib/util/portreg.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 /*
michael@0 6 * shexp.h: Defines and prototypes for shell exp. match routines
michael@0 7 *
michael@0 8 * This routine will match a string with a shell expression. The expressions
michael@0 9 * accepted are based loosely on the expressions accepted by zsh.
michael@0 10 *
michael@0 11 * o * matches anything
michael@0 12 * o ? matches one character
michael@0 13 * o \ will escape a special character
michael@0 14 * o $ matches the end of the string
michael@0 15 * Bracketed expressions:
michael@0 16 * o [abc] matches one occurence of a, b, or c.
michael@0 17 * o [^abc] matches any character except a, b, or c.
michael@0 18 * To be matched between [ and ], these characters must be escaped: \ ]
michael@0 19 * No other characters need be escaped between brackets.
michael@0 20 * Unnecessary escaping is permitted.
michael@0 21 * o [a-z] matches any character between a and z, inclusive.
michael@0 22 * The two range-definition characters must be alphanumeric ASCII.
michael@0 23 * If one is upper case and the other is lower case, then the ASCII
michael@0 24 * non-alphanumeric characters between Z and a will also be in range.
michael@0 25 * o [^a-z] matches any character except those between a and z, inclusive.
michael@0 26 * These forms cannot be combined, e.g [a-gp-z] does not work.
michael@0 27 * o Exclusions:
michael@0 28 * As a top level, outter-most expression only, the expression
michael@0 29 * foo~bar will match the expression foo, provided it does not also
michael@0 30 * match the expression bar. Either expression or both may be a union.
michael@0 31 * Except between brackets, any unescaped ~ is an exclusion.
michael@0 32 * At most one exclusion is permitted.
michael@0 33 * Exclusions cannot be nested (contain other exclusions).
michael@0 34 * example: *~abc will match any string except abc
michael@0 35 * o Unions:
michael@0 36 * (foo|bar) will match either the expression foo, or the expression bar.
michael@0 37 * At least one '|' separator is required. More are permitted.
michael@0 38 * Expressions inside unions may not include unions or exclusions.
michael@0 39 * Inside a union, to be matched and not treated as a special character,
michael@0 40 * these characters must be escaped: \ ( | ) [ ~ except when they occur
michael@0 41 * inside a bracketed expression, where only \ and ] require escaping.
michael@0 42 *
michael@0 43 * The public interface to these routines is documented below.
michael@0 44 *
michael@0 45 */
michael@0 46
michael@0 47 #ifndef SHEXP_H
michael@0 48 #define SHEXP_H
michael@0 49
michael@0 50 #include "utilrename.h"
michael@0 51 /*
michael@0 52 * Requires that the macro MALLOC be set to a "safe" malloc that will
michael@0 53 * exit if no memory is available.
michael@0 54 */
michael@0 55
michael@0 56
michael@0 57 /* --------------------------- Public routines ---------------------------- */
michael@0 58
michael@0 59
michael@0 60 /*
michael@0 61 * shexp_valid takes a shell expression exp as input. It returns:
michael@0 62 *
michael@0 63 * NON_SXP if exp is a standard string
michael@0 64 * INVALID_SXP if exp is a shell expression, but invalid
michael@0 65 * VALID_SXP if exp is a valid shell expression
michael@0 66 */
michael@0 67
michael@0 68 #define NON_SXP -1
michael@0 69 #define INVALID_SXP -2
michael@0 70 #define VALID_SXP 1
michael@0 71
michael@0 72 SEC_BEGIN_PROTOS
michael@0 73
michael@0 74 extern int PORT_RegExpValid(const char *exp);
michael@0 75
michael@0 76 extern int PORT_RegExpSearch(const char *str, const char *exp);
michael@0 77
michael@0 78 /* same as above but uses case insensitive search */
michael@0 79 extern int PORT_RegExpCaseSearch(const char *str, const char *exp);
michael@0 80
michael@0 81 SEC_END_PROTOS
michael@0 82
michael@0 83 #endif

mercurial