From e3b9acea231b0022f1be761747a2b7d12bc8fa13 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Wed, 12 Jan 2005 13:44:43 +0000 Subject: [PATCH] Parameterize the LaTeX Makefile a bit and add all files git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1801 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/lib/fnmatch.c | 83 ++++++++++++++++++---------------------- bacula/src/lib/fnmatch.h | 30 +++++++-------- 2 files changed, 53 insertions(+), 60 deletions(-) diff --git a/bacula/src/lib/fnmatch.c b/bacula/src/lib/fnmatch.c index 729373ced3..7b11a9a196 100644 --- a/bacula/src/lib/fnmatch.c +++ b/bacula/src/lib/fnmatch.c @@ -15,13 +15,6 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bacula.h" - - -/* Enable GNU extensions in fnmatch.h. */ -#ifndef _GNU_SOURCE -# define _GNU_SOURCE 1 -#endif - #include "fnmatch.h" @@ -68,22 +61,22 @@ fnmatch (const char *pattern, const char *string, int flags) switch (c) { - case '?': - if (*n == '\0') + case '?': + if (*n == '\0') return FNM_NOMATCH; - else if ((flags & FNM_FILE_NAME) && *n == '/') + else if ((flags & FNM_FILE_NAME) && *n == '/') return FNM_NOMATCH; - else if ((flags & FNM_PERIOD) && *n == '.' && - (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/'))) + else if ((flags & FNM_PERIOD) && *n == '.' && + (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/'))) return FNM_NOMATCH; break; - case '\\': + case '\\': if (!(flags & FNM_NOESCAPE)) { c = *p++; - if (c == '\0') - /* Trailing \ loses. */ + if (c == '\0') + /* Trailing \ loses. */ return FNM_NOMATCH; c = FOLD (c); } @@ -91,56 +84,56 @@ fnmatch (const char *pattern, const char *string, int flags) return FNM_NOMATCH; break; - case '*': - if ((flags & FNM_PERIOD) && *n == '.' && - (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/'))) + case '*': + if ((flags & FNM_PERIOD) && *n == '.' && + (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/'))) return FNM_NOMATCH; - for (c = *p++; c == '?' || c == '*'; c = *p++) + for (c = *p++; c == '?' || c == '*'; c = *p++) { - if ((flags & FNM_FILE_NAME) && *n == '/') + if ((flags & FNM_FILE_NAME) && *n == '/') /* A slash does not match a wildcard under FNM_FILE_NAME. */ return FNM_NOMATCH; - else if (c == '?') + else if (c == '?') { /* A ? needs to match one character. */ - if (*n == '\0') - /* There isn't another character; no match. */ + if (*n == '\0') + /* There isn't another character; no match. */ return FNM_NOMATCH; else /* One character of the string is consumed in matching - this ? wildcard, so *??? won't match if there are + this ? wildcard, so *??? won't match if there are less than three characters. */ ++n; } } - if (c == '\0') + if (c == '\0') return 0; { - char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c; + char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c; c1 = FOLD (c1); - for (--p; *n != '\0'; ++n) - if ((c == '[' || FOLD (*n) == c1) && + for (--p; *n != '\0'; ++n) + if ((c == '[' || FOLD (*n) == c1) && fnmatch (p, n, flags & ~FNM_PERIOD) == 0) return 0; return FNM_NOMATCH; } - case '[': + case '[': { /* Nonzero if the sense of the character class is inverted. */ register int nnot; - if (*n == '\0') + if (*n == '\0') return FNM_NOMATCH; - if ((flags & FNM_PERIOD) && *n == '.' && - (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/'))) + if ((flags & FNM_PERIOD) && *n == '.' && + (n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/'))) return FNM_NOMATCH; - nnot = (*p == '!' || *p == '^'); + nnot = (*p == '!' || *p == '^'); if (nnot) ++p; @@ -149,32 +142,32 @@ fnmatch (const char *pattern, const char *string, int flags) { register char cstart = c, cend = c; - if (!(flags & FNM_NOESCAPE) && c == '\\') + if (!(flags & FNM_NOESCAPE) && c == '\\') { - if (*p == '\0') + if (*p == '\0') return FNM_NOMATCH; cstart = cend = *p++; } cstart = cend = FOLD (cstart); - if (c == '\0') + if (c == '\0') /* [ (unterminated) loses. */ return FNM_NOMATCH; c = *p++; c = FOLD (c); - if ((flags & FNM_FILE_NAME) && c == '/') + if ((flags & FNM_FILE_NAME) && c == '/') /* [/] can never match. */ return FNM_NOMATCH; - if (c == '-' && *p != ']') + if (c == '-' && *p != ']') { cend = *p++; - if (!(flags & FNM_NOESCAPE) && cend == '\\') + if (!(flags & FNM_NOESCAPE) && cend == '\\') cend = *p++; - if (cend == '\0') + if (cend == '\0') return FNM_NOMATCH; cend = FOLD (cend); @@ -184,7 +177,7 @@ fnmatch (const char *pattern, const char *string, int flags) if (FOLD (*n) >= cstart && FOLD (*n) <= cend) goto matched; - if (c == ']') + if (c == ']') break; } if (!nnot) @@ -193,16 +186,16 @@ fnmatch (const char *pattern, const char *string, int flags) matched:; /* Skip the rest of the [...] that already matched. */ - while (c != ']') + while (c != ']') { - if (c == '\0') + if (c == '\0') /* [... (unterminated) loses. */ return FNM_NOMATCH; c = *p++; - if (!(flags & FNM_NOESCAPE) && c == '\\') + if (!(flags & FNM_NOESCAPE) && c == '\\') { - if (*p == '\0') + if (*p == '\0') return FNM_NOMATCH; /* XXX 1003.2d11 is unclear if this is right. */ ++p; diff --git a/bacula/src/lib/fnmatch.h b/bacula/src/lib/fnmatch.h index af1dcf523b..07a5d44ffe 100644 --- a/bacula/src/lib/fnmatch.h +++ b/bacula/src/lib/fnmatch.h @@ -15,11 +15,11 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, -Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef _FNMATCH_H +#ifndef _FNMATCH_H -#define _FNMATCH_H 1 +#define _FNMATCH_H 1 #ifdef __cplusplus extern "C" { @@ -27,10 +27,10 @@ extern "C" { #if defined (__cplusplus) || (defined (__STDC__) && __STDC__) #undef __P -#define __P(protos) protos +#define __P(protos) protos #else /* Not C++ or ANSI C. */ #undef __P -#define __P(protos) () +#define __P(protos) () /* We can get away without defining `const' here only because in this file it is used only inside the prototype for `fnmatch', which is elided in non-ANSI C where `const' is problematical. */ @@ -44,18 +44,18 @@ extern "C" { #undef FNM_PERIOD /* Bits set in the FLAGS argument to `fnmatch'. */ -#define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */ -#define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */ -#define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */ - -#if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_GNU_SOURCE) -#define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */ -#define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */ -#define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */ -#endif +#define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */ +#define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */ +#define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */ + +/* #if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_GNU_SOURCE) */ +#define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */ +#define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */ +#define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */ +/* #endif -- kes 12Jan05 */ /* Value returned by `fnmatch' if STRING does not match PATTERN. */ -#define FNM_NOMATCH 1 +#define FNM_NOMATCH 1 /* Match STRING against the filename pattern PATTERN, returning zero if it matches, FNM_NOMATCH if not. */ -- 2.39.5