diff options
author | Andres Mejia <amejia004@gmail.com> | 2013-01-31 18:39:39 -0500 |
---|---|---|
committer | Andres Mejia <amejia004@gmail.com> | 2013-01-31 18:39:39 -0500 |
commit | b708276ac543fb1c3d48fbd57f5592334a0dea28 (patch) | |
tree | 70958d75d3c94dc4412670e4378c4d61eba79c11 /tar | |
parent | 1148d8d933c6f82033ce19e1d67c8fa1dea50c44 (diff) | |
download | libarchive-b708276ac543fb1c3d48fbd57f5592334a0dea28.tar.gz |
Support POSIX regular expression support using PCRE in CMake builds.
This change is mainly meant for Windows regex support, where PCRE Windows development is much
more active than development of the regex library found in the GNUWin32 packages. I found that
the latest release of PCRE built right out of the box, unlike the GNUWin32 regex library released
6 years ago which failed to build from source for me using the mingw toolchain.
Diffstat (limited to 'tar')
-rw-r--r-- | tar/bsdtar.c | 4 | ||||
-rw-r--r-- | tar/bsdtar.h | 2 | ||||
-rw-r--r-- | tar/subst.c | 8 | ||||
-rw-r--r-- | tar/util.c | 2 |
4 files changed, 10 insertions, 6 deletions
diff --git a/tar/bsdtar.c b/tar/bsdtar.c index 4d421dfb..47267579 100644 --- a/tar/bsdtar.c +++ b/tar/bsdtar.c @@ -570,7 +570,7 @@ main(int argc, char **argv) bsdtar->extract_flags |= ARCHIVE_EXTRACT_SPARSE; break; case 's': /* NetBSD pax-as-tar */ -#if HAVE_REGEX_H +#if defined(HAVE_REGEX_H) || defined(HAVE_PCREPOSIX_H) add_substitution(bsdtar, bsdtar->argument); #else lafe_warnc(0, @@ -806,7 +806,7 @@ main(int argc, char **argv) } archive_match_free(bsdtar->matching); -#if HAVE_REGEX_H +#if defined(HAVE_REGEX_H) || defined(HAVE_PCREPOSIX_H) cleanup_substitution(bsdtar); #endif cset_free(bsdtar->cset); diff --git a/tar/bsdtar.h b/tar/bsdtar.h index a03d05ad..637e1b9d 100644 --- a/tar/bsdtar.h +++ b/tar/bsdtar.h @@ -173,7 +173,7 @@ void tar_mode_x(struct bsdtar *bsdtar); void usage(void); int yes(const char *fmt, ...); -#if HAVE_REGEX_H +#if defined(HAVE_REGEX_H) || defined(HAVE_PCREPOSIX_H) void add_substitution(struct bsdtar *, const char *); int apply_substitution(struct bsdtar *, const char *, char **, int, int); void cleanup_substitution(struct bsdtar *); diff --git a/tar/subst.c b/tar/subst.c index 0ef95b91..fd6f8e22 100644 --- a/tar/subst.c +++ b/tar/subst.c @@ -26,11 +26,15 @@ #include "bsdtar_platform.h" __FBSDID("$FreeBSD: src/usr.bin/tar/subst.c,v 1.4 2008/06/15 10:08:16 kientzle Exp $"); -#if HAVE_REGEX_H +#if defined(HAVE_REGEX_H) || defined(HAVE_PCREPOSIX_H) #include "bsdtar.h" #include <errno.h> +#ifdef HAVE_PCREPOSIX_H +#include <pcreposix.h> +#else #include <regex.h> +#endif #include <stdlib.h> #include <string.h> @@ -317,4 +321,4 @@ cleanup_substitution(struct bsdtar *bsdtar) } free(subst); } -#endif /* HAVE_REGEX_H */ +#endif /* defined(HAVE_REGEX_H) || defined(HAVE_PCREPOSIX_H) */ @@ -382,7 +382,7 @@ int edit_pathname(struct bsdtar *bsdtar, struct archive_entry *entry) { const char *name = archive_entry_pathname(entry); -#if HAVE_REGEX_H +#if defined(HAVE_REGEX_H) || defined(HAVE_PCREPOSIX_H) char *subst_name; int r; |