summaryrefslogtreecommitdiff
path: root/openbsd-compat
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@dtucker.net>2019-11-01 18:24:29 +1100
committerDarren Tucker <dtucker@dtucker.net>2019-11-01 18:27:37 +1100
commit0e3c5bc50907d2058407641b5a3581b7eda91b7e (patch)
treec7dda5c4d05debff27635a088bd6193c8d67f25a /openbsd-compat
parentb56dbfd9d967e5b6ce7be9f81f206112e19e1030 (diff)
Hook up fnmatch for platforms that don't have it.
Diffstat (limited to 'openbsd-compat')
-rw-r--r--openbsd-compat/Makefile.in1
-rw-r--r--openbsd-compat/fnmatch.c6
-rw-r--r--openbsd-compat/fnmatch.h11
-rw-r--r--openbsd-compat/openbsd-compat.h1
4 files changed, 17 insertions, 2 deletions
diff --git a/openbsd-compat/Makefile.in b/openbsd-compat/Makefile.in
index 1162dc550..94fb0a55e 100644
--- a/openbsd-compat/Makefile.in
+++ b/openbsd-compat/Makefile.in
@@ -25,6 +25,7 @@ OPENBSD=base64.o \
25 explicit_bzero.o \ 25 explicit_bzero.o \
26 fmt_scaled.o \ 26 fmt_scaled.o \
27 freezero.o \ 27 freezero.o \
28 fnmatch.o \
28 getcwd.o \ 29 getcwd.o \
29 getgrouplist.o \ 30 getgrouplist.o \
30 getopt_long.o \ 31 getopt_long.o \
diff --git a/openbsd-compat/fnmatch.c b/openbsd-compat/fnmatch.c
index 88d5dbc3c..da841d203 100644
--- a/openbsd-compat/fnmatch.c
+++ b/openbsd-compat/fnmatch.c
@@ -85,6 +85,11 @@
85 * path delimiter must be aware that 0x5C is NOT unique within SHIFT-JIS. 85 * path delimiter must be aware that 0x5C is NOT unique within SHIFT-JIS.
86 */ 86 */
87 87
88/* OPENBSD ORIGINAL: lib/libc/gen/fnmatch.c */
89
90#include "includes.h"
91#ifndef HAVE_FNMATCH
92
88#include <fnmatch.h> 93#include <fnmatch.h>
89#include <string.h> 94#include <string.h>
90#include <ctype.h> 95#include <ctype.h>
@@ -487,3 +492,4 @@ firstsegment:
487 /* Pattern didn't match to the end of string. */ 492 /* Pattern didn't match to the end of string. */
488 return FNM_NOMATCH; 493 return FNM_NOMATCH;
489} 494}
495#endif /* HAVE_FNMATCH */
diff --git a/openbsd-compat/fnmatch.h b/openbsd-compat/fnmatch.h
index 4b27d06c3..b54de01ff 100644
--- a/openbsd-compat/fnmatch.h
+++ b/openbsd-compat/fnmatch.h
@@ -32,10 +32,16 @@
32 * @(#)fnmatch.h 8.1 (Berkeley) 6/2/93 32 * @(#)fnmatch.h 8.1 (Berkeley) 6/2/93
33 */ 33 */
34 34
35/* OPENBSD ORIGINAL: include/fnmatch.h */
36
37#ifndef HAVE_FNMATCH_H
38
35#ifndef _FNMATCH_H_ 39#ifndef _FNMATCH_H_
36#define _FNMATCH_H_ 40#define _FNMATCH_H_
37 41
42#ifdef HAVE_SYS_CDEFS_H
38#include <sys/cdefs.h> 43#include <sys/cdefs.h>
44#endif
39 45
40#define FNM_NOMATCH 1 /* Match failed. */ 46#define FNM_NOMATCH 1 /* Match failed. */
41#define FNM_NOSYS 2 /* Function not supported (unused). */ 47#define FNM_NOSYS 2 /* Function not supported (unused). */
@@ -50,8 +56,9 @@
50#define FNM_FILE_NAME FNM_PATHNAME 56#define FNM_FILE_NAME FNM_PATHNAME
51#endif 57#endif
52 58
53__BEGIN_DECLS 59/* __BEGIN_DECLS */
54int fnmatch(const char *, const char *, int); 60int fnmatch(const char *, const char *, int);
55__END_DECLS 61/* __END_DECLS */
56 62
57#endif /* !_FNMATCH_H_ */ 63#endif /* !_FNMATCH_H_ */
64#endif /* ! HAVE_FNMATCH_H */
diff --git a/openbsd-compat/openbsd-compat.h b/openbsd-compat/openbsd-compat.h
index 97b344b65..afe882f92 100644
--- a/openbsd-compat/openbsd-compat.h
+++ b/openbsd-compat/openbsd-compat.h
@@ -47,6 +47,7 @@
47#include "rmd160.h" 47#include "rmd160.h"
48#include "md5.h" 48#include "md5.h"
49#include "blf.h" 49#include "blf.h"
50#include "fnmatch.h"
50 51
51#ifndef HAVE_BASENAME 52#ifndef HAVE_BASENAME
52char *basename(const char *path); 53char *basename(const char *path);