diff options
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | eval.c | 2 | ||||
-rw-r--r-- | expr.h | 2 | ||||
-rw-r--r-- | parse.c | 2 | ||||
-rw-r--r-- | regexp.h | 27 | ||||
-rw-r--r-- | util.c | 2 | ||||
-rw-r--r-- | util.h | 3 |
7 files changed, 37 insertions, 6 deletions
@@ -111,6 +111,11 @@ ifneq ($(filter release,$(MAKECMDGOALS)),) CFLAGS := $(DEFAULT_CFLAGS) -O3 -flto -DNDEBUG endif +ifeq ($(USE_ONIGURUMA),1) +LOCAL_LDLIBS += -lonig +LOCAL_CFLAGS += -DBFS_USE_ONIGURUMA=1 +endif + ALL_CPPFLAGS = $(LOCAL_CPPFLAGS) $(CPPFLAGS) ALL_CFLAGS = $(ALL_CPPFLAGS) $(LOCAL_CFLAGS) $(CFLAGS) $(DEPFLAGS) ALL_LDFLAGS = $(ALL_CFLAGS) $(LOCAL_LDFLAGS) $(LDFLAGS) @@ -37,13 +37,13 @@ #include "time.h" #include "trie.h" #include "util.h" +#include "regexp.h" #include <assert.h> #include <errno.h> #include <fcntl.h> #include <fnmatch.h> #include <grp.h> #include <pwd.h> -#include <regex.h> #include <stdarg.h> #include <stdint.h> #include <stdio.h> @@ -25,8 +25,8 @@ #include "eval.h" #include "exec.h" #include "printf.h" +#include "regexp.h" #include "stat.h" -#include <regex.h> #include <stdbool.h> #include <stddef.h> #include <sys/types.h> @@ -41,6 +41,7 @@ #include "time.h" #include "typo.h" #include "util.h" +#include "regexp.h" #include <assert.h> #include <errno.h> #include <fcntl.h> @@ -48,7 +49,6 @@ #include <grp.h> #include <limits.h> #include <pwd.h> -#include <regex.h> #include <stdarg.h> #include <stdbool.h> #include <stdio.h> diff --git a/regexp.h b/regexp.h new file mode 100644 index 0000000..8654b58 --- /dev/null +++ b/regexp.h @@ -0,0 +1,27 @@ +/**************************************************************************** + * bfs * + * Copyright (C) 2022 Tavian Barnes <tavianator@tavianator.com> and * + * BFS contributors * + * * + * Permission to use, copy, modify, and/or distribute this software for any * + * purpose with or without fee is hereby granted. * + * * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * + ****************************************************************************/ + +#ifndef BFS_REGEXP_H +#define BFS_REGEXP_H + +#if BFS_USE_ONIGURUMA == 1 + #include <onigposix.h> +#else + #include <regex.h> +#endif + +#endif // BFS_REGEXP_H @@ -16,12 +16,12 @@ #include "util.h" #include "dstring.h" +#include "regexp.h" #include <assert.h> #include <errno.h> #include <fcntl.h> #include <langinfo.h> #include <nl_types.h> -#include <regex.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> @@ -20,10 +20,9 @@ #ifndef BFS_UTIL_H #define BFS_UTIL_H - +#include "regexp.h" #include <fcntl.h> #include <fnmatch.h> -#include <regex.h> #include <stdbool.h> #include <stddef.h> #include <stdio.h> |