From cebac30a7b93ef8251029041533e571b5eb36a21 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Wed, 5 Sep 2007 08:47:33 +0000 Subject: [PATCH] Remove enh_fnmatch.c. Make code that references it use fnmatch.c git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5459 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/findlib/find.c | 3 +- bacula/src/findlib/find.h | 2 +- bacula/src/lib/enh_fnmatch.c | 285 ----------------------------------- bacula/src/lib/enh_fnmatch.h | 51 ------- bacula/src/version.h | 6 +- bacula/technotes-2.3 | 6 + 6 files changed, 12 insertions(+), 341 deletions(-) delete mode 100644 bacula/src/lib/enh_fnmatch.c delete mode 100644 bacula/src/lib/enh_fnmatch.h diff --git a/bacula/src/findlib/find.c b/bacula/src/findlib/find.c index 0bffa6abe4..d12fcf48ff 100644 --- a/bacula/src/findlib/find.c +++ b/bacula/src/findlib/find.c @@ -216,7 +216,8 @@ static bool accept_file(FF_PKT *ff) int (*match_func)(const char *pattern, const char *string, int flags); if (ff->flags & FO_ENHANCEDWILD) { - match_func = enh_fnmatch; +// match_func = enh_fnmatch; + match_func = fnmatch; if ((basename = last_path_separator(ff->fname)) != NULL) basename++; else diff --git a/bacula/src/findlib/find.h b/bacula/src/findlib/find.h index cd6d8c543e..b646d16834 100644 --- a/bacula/src/findlib/find.h +++ b/bacula/src/findlib/find.h @@ -55,7 +55,7 @@ struct utimbuf { #define MODE_RALL (S_IRUSR|S_IRGRP|S_IROTH) #include "lib/fnmatch.h" -#include "lib/enh_fnmatch.h" +// #include "lib/enh_fnmatch.h" #ifndef HAVE_REGEX_H #include "lib/bregex.h" diff --git a/bacula/src/lib/enh_fnmatch.c b/bacula/src/lib/enh_fnmatch.c deleted file mode 100644 index b3e79b47ee..0000000000 --- a/bacula/src/lib/enh_fnmatch.c +++ /dev/null @@ -1,285 +0,0 @@ -/* Copyright (C) 1991, 1992, 1993, 1996, 1997 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - 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. */ - -/* Modified version of fnmatch.c - Robert Nelson */ - -#include "bacula.h" -#include "enh_fnmatch.h" - -# ifndef errno -extern int errno; -# endif - -int -enh_fnmatch_sub(const char *pattern, const char *string, int patternlen, int flags) -{ - register const char *p = pattern, *n = string; - register char c; - -/* Note that this evaluates C many times. */ -# define FOLD(c) ((flags & FNM_CASEFOLD) && B_ISUPPER (c) ? tolower (c) : (c)) - - while ((p - pattern) < patternlen) - { - c = *p++; - c = FOLD (c); - - switch (c) - { - case '?': - if (*n == '\0') - return 0; - else if ((flags & FNM_FILE_NAME) && IsPathSeparator(*n)) - return 0; - else if ((flags & FNM_PERIOD) && *n == '.' && - (n == string || ((flags & FNM_FILE_NAME) && IsPathSeparator(n[-1])))) - return 0; - break; - - case '\\': - if (!(flags & FNM_NOESCAPE)) - { - if ((p - pattern) >= patternlen) - /* Trailing \ loses. */ - return 0; - - c = *p++; - c = FOLD(c); - } - if (FOLD (*n) != c) - return 0; - break; - - case '*': - if ((flags & FNM_PERIOD) && *n == '.' && - (n == string || ((flags & FNM_FILE_NAME) && IsPathSeparator(n[-1])))) - return FNM_NOMATCH; - - if ((p - pattern) >= patternlen) - return patternlen; - - for (c = *p++; ((p - pattern) <= patternlen) && (c == '?' || c == '*'); c = *p++) - { - if ((flags & FNM_FILE_NAME) && IsPathSeparator(*n)) - /* A slash does not match a wildcard under FNM_FILE_NAME. */ - return 0; - else if (c == '?') - { - /* A ? needs to match one character. */ - if (*n == '\0') - /* There isn't another character; no match. */ - return 0; - else - /* One character of the string is consumed in matching - this ? wildcard, so *??? won't match if there are - less than three characters. */ - ++n; - } - } - - if ((p - pattern) >= patternlen) - return patternlen; - - { - char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c; - c1 = FOLD (c1); - for (--p; *n != '\0'; ++n) - { - if (c == '[' || c == '{' || FOLD((unsigned char)*n) == c1) - { - int len; - - len = enh_fnmatch_sub(p, n, (int)(patternlen - (p - pattern)), flags & ~FNM_PERIOD); - - if (len > 0 && n[len] == '\0') - return (int)(n - string + len); - } - else - { - if ((flags & FNM_FILE_NAME) && IsPathSeparator(*n)) - return 0; /* A slash does not match a wildcard under FNM_FILE_NAME. */ - } - - } - return 0; - } - - case '{': - { - const char *pstart = p; - - while ((p - pattern) < patternlen) - { - c = *p++; - - if (!(flags & FNM_NOESCAPE) && c == '\\') - { - if ((p - pattern) >= patternlen) - return 0; - - ++p; - continue; - } - - if (c == ',' || c == '}') - { - int matchlen; - - matchlen = enh_fnmatch_sub(pstart, n, (int)(p - pstart - 1), flags & ~FNM_PERIOD); - - if (matchlen > 0) - { - n += matchlen - 1; - while (c != '}') - { - if (!(flags & FNM_NOESCAPE) && c == '\\') - { - if ((p - pattern) >= patternlen) - return 0; - - ++p; - } - - if ((p - pattern) >= patternlen) - return 0; - - c = *p++; - } - break; - } - - if (c == '}') - return 0; - - pstart = p; - } - } - break; - } - - case '[': - { - /* Nonzero if the sense of the character class is inverted. */ - register int nnot; - - if (*n == '\0') - return 0; - - if ((flags & FNM_PERIOD) && *n == '.' && - (n == string || ((flags & FNM_FILE_NAME) && IsPathSeparator(n[-1])))) - return 0; - - nnot = (*p == '!' || *p == '^'); - if (nnot) - ++p; - - if ((p - pattern) >= patternlen) - /* [ (unterminated) loses. */ - return 0; - - c = *p++; - - for (;;) - { - register char cstart, cend; - - cstart = cend = FOLD (c); - - if ((p - pattern) >= patternlen) - /* [ (unterminated) loses. */ - return 0; - - c = *p++; - c = FOLD (c); - - if ((flags & FNM_FILE_NAME) && IsPathSeparator(c)) - /* [/] can never match. */ - return 0; - - if (c == '-' && *p != ']') - { - if ((p - pattern) >= patternlen) - return 0; - - cend = *p++; - - cend = FOLD (cend); - - if ((p - pattern) >= patternlen) - return 0; - - c = *p++; - } - - if (FOLD (*n) >= cstart && FOLD (*n) <= cend) - goto matched; - - if (c == ']') - break; - } - if (!nnot) - return 0; - break; - - matched:; - /* Skip the rest of the [...] that already matched. */ - while (c != ']') - { - if ((p - pattern) >= patternlen) - return 0; - - c = *p++; - } - if (nnot) - return 0; - } - break; - - default: - if (c != FOLD (*n)) - return 0; - break; - } - - ++n; - } - - return (int)(n - string); - -# undef FOLD -} - -/* Match STRING against the filename pattern PATTERN, returning number of characters - in STRING that were matched if all of PATTERN matches, nonzero if not. */ -int -enh_fnmatch(const char *pattern, const char *string, int flags) -{ - int matchlen; - - matchlen = enh_fnmatch_sub(pattern, string, (int)strlen(pattern), flags); - - if (matchlen == 0) - return FNM_NOMATCH; - - if (string[matchlen] == '\0') - return 0; - - if ((flags & FNM_LEADING_DIR) && IsPathSeparator(string[matchlen])) - /* The FNM_LEADING_DIR flag says that "foo*" matches "foobar/frobozz". */ - return 0; - - return FNM_NOMATCH; -} diff --git a/bacula/src/lib/enh_fnmatch.h b/bacula/src/lib/enh_fnmatch.h deleted file mode 100644 index 0a530163cc..0000000000 --- a/bacula/src/lib/enh_fnmatch.h +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc. - -NOTE: The canonical source of this file is maintained with the GNU C Library. -Bugs can be reported to bug-glibc@prep.ai.mit.edu. - -This program is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) any -later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -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. */ - -/* Modified version of fnmatch.h - Robert Nelson */ - -#ifndef _ENH_FNMATCH_H - -#define _ENH_FNMATCH_H 1 - -#ifdef __cplusplus -extern "C" { -#endif - -#if defined (__cplusplus) || (defined (__STDC__) && __STDC__) -#undef __P -#define __P(protos) protos -#else /* Not C++ or ANSI C. */ -#undef __P -#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. */ -#endif /* C++ or ANSI C. */ - - -/* Match STRING against the filename pattern PATTERN, - returning zero if it matches, FNM_NOMATCH if not. */ -extern int enh_fnmatch __P ((const char *__pattern, const char *__string, - int __flags)); - -#ifdef __cplusplus -} -#endif - -#endif /* fnmatch.h */ diff --git a/bacula/src/version.h b/bacula/src/version.h index 5e787abba5..a5f317487c 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -3,9 +3,9 @@ */ #undef VERSION -#define VERSION "2.3.2" -#define BDATE "02 September 2007" -#define LSMDATE "02Sep07" +#define VERSION "2.3.3" +#define BDATE "05 September 2007" +#define LSMDATE "05Sep07" #define PROG_COPYRIGHT "Copyright (C) %d-2007 Free Software Foundation Europe e.V.\n" #define BYEAR "2007" /* year for copyright messages in progs */ diff --git a/bacula/technotes-2.3 b/bacula/technotes-2.3 index e2b9008a2e..008575c414 100644 --- a/bacula/technotes-2.3 +++ b/bacula/technotes-2.3 @@ -1,6 +1,12 @@ Technical notes on version 2.3 General: +05Sep07 +kes Remove enh_fnmatch.c. Make code that references it use fnmatch.c +04Sep07 +ebl Detect if new PosgreSQL batch insert API is present. +kes Correct incorrect mempool call causing Director crash. +sb Update spec files for 2.2.1 release 03Sep07 kes Fix memory pool call in ua_output.c. bug #934. kes Replace fnmatch.c and fnmatch.h by modified BSD versions. -- 2.39.5