2 * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to
6 * deal in the Software without restriction, including without limitation the
7 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 * sell copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies of the Software, its documentation and marketing & publicity
13 * materials, and acknowledgment shall be given in the documentation, materials
14 * and software packages that this Software was used.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 isafter(int p, const char *s1, const char *s2)
36 for (i = p; i < len; i++)
41 for (j = 0; j < len2; j++)
45 if (s1[i + j] != s2[j])
56 matchregexp(const char *rx, const char *s)
72 if ((strcmp(rx, "*") || rx[0] == 0) && s[0] == 0)
78 while ((rx[l] != '*') && (rx[l]) && (m < 1023))
84 for (i = 0; i < lenr; i++)
90 if ((!rx[l]) && (s[lenr]))
92 for (i = lenr; i < len; i++)
99 while ((rx[l] != '*') && (rx[l]) && (m < 1023))
102 i = isafter(i, s, rx2);