| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | --- HISTORICAL COMMENTS FOLLOW --- |
| 19 | |
| 20 | * $Logfile: /DescentIII/main/Lib/psglob.h $ |
| 21 | * $Revision: 2 $ |
| 22 | * $Date: 1/07/99 10:51p $ |
| 23 | * $Author: Jeff $ |
| 24 | * |
| 25 | * string globbing function header |
| 26 | * |
| 27 | * $Log: /DescentIII/main/Lib/psglob.h $ |
| 28 | * |
| 29 | * 2 1/07/99 10:51p Jeff |
| 30 | * added psglob and support to do find in files for hog files |
| 31 | * |
| 32 | * 1 1/07/99 7:28p Jeff |
| 33 | * |
| 34 | * $NoKeywords: $ |
| 35 | */ |
| 36 | |
| 37 | #ifndef __PSGLOB_H_ |
| 38 | #define __PSGLOB_H_ |
| 39 | |
| 40 | // Returns 1 if string contains globbing characters in it |
| 41 | int PSGlobHasPattern(char *string); |
| 42 | |
| 43 | // PSGlobMatch |
| 44 | // Matches the pattern passed in to the string in text. If the pattern matches |
| 45 | // it returns 1, if not, it returns 0. In order to have a match, the following |
| 46 | // conditions must be met: |
| 47 | // 1) The entire string (text) is used for matching. |
| 48 | // 2) '*' matches any sequence of characters. |
| 49 | // 3) '?' matches any character |
| 50 | // 4) [SET] matches any character in the specified set. |
| 51 | // 5) [!SET] matches any character _not_ in the specified set. |
| 52 | // A set is composed of characters or ranges. A range looks like |
| 53 | // character hyphen character (as in 0-9 or A-Z). [0-9a-zA-Z_] is the set |
| 54 | // of all characters allowed in C identifiers. |
| 55 | // 6) Any other character in the pattern must be matched exactly.(see 9) |
| 56 | // 7) Because of the syntactic significance of []*?!- and \ to match |
| 57 | // these characters exactly, preced it with a '\'. |
| 58 | // 8) If dot_special is not zero, '*' and '?' do not match '.' at the beginning of text |
| 59 | // 9) If case_sensitive is 0, than case does not matter for the non-pattern characters |
| 60 | int PSGlobMatch(char *pattern, char *text, int case_sensitive, int dot_special); |
| 61 | |
| 62 | // Like PSGlobMatch, but match pattern against any final segment of text |
| 63 | int PSGlobMatchAfterStar(char *pattern, int case_sensitive, char *text); |
| 64 | |
| 65 | #endif |