Hook up fnmatch for platforms that don't have it.

This commit is contained in:
Darren Tucker 2019-11-01 18:24:29 +11:00
parent b56dbfd9d9
commit 0e3c5bc509
6 changed files with 21 additions and 2 deletions

View File

@ -382,6 +382,7 @@ AC_CHECK_HEADERS([ \
features.h \ features.h \
fcntl.h \ fcntl.h \
floatingpoint.h \ floatingpoint.h \
fnmatch.h \
getopt.h \ getopt.h \
glob.h \ glob.h \
ia.h \ ia.h \
@ -1738,6 +1739,7 @@ AC_CHECK_FUNCS([ \
fchown \ fchown \
fchownat \ fchownat \
flock \ flock \
fnmatch \
freeaddrinfo \ freeaddrinfo \
freezero \ freezero \
fstatfs \ fstatfs \

View File

@ -25,6 +25,7 @@ OPENBSD=base64.o \
explicit_bzero.o \ explicit_bzero.o \
fmt_scaled.o \ fmt_scaled.o \
freezero.o \ freezero.o \
fnmatch.o \
getcwd.o \ getcwd.o \
getgrouplist.o \ getgrouplist.o \
getopt_long.o \ getopt_long.o \

View File

@ -85,6 +85,11 @@
* path delimiter must be aware that 0x5C is NOT unique within SHIFT-JIS. * path delimiter must be aware that 0x5C is NOT unique within SHIFT-JIS.
*/ */
/* OPENBSD ORIGINAL: lib/libc/gen/fnmatch.c */
#include "includes.h"
#ifndef HAVE_FNMATCH
#include <fnmatch.h> #include <fnmatch.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
@ -487,3 +492,4 @@ firstsegment:
/* Pattern didn't match to the end of string. */ /* Pattern didn't match to the end of string. */
return FNM_NOMATCH; return FNM_NOMATCH;
} }
#endif /* HAVE_FNMATCH */

View File

@ -32,10 +32,16 @@
* @(#)fnmatch.h 8.1 (Berkeley) 6/2/93 * @(#)fnmatch.h 8.1 (Berkeley) 6/2/93
*/ */
/* OPENBSD ORIGINAL: include/fnmatch.h */
#ifndef HAVE_FNMATCH_H
#ifndef _FNMATCH_H_ #ifndef _FNMATCH_H_
#define _FNMATCH_H_ #define _FNMATCH_H_
#ifdef HAVE_SYS_CDEFS_H
#include <sys/cdefs.h> #include <sys/cdefs.h>
#endif
#define FNM_NOMATCH 1 /* Match failed. */ #define FNM_NOMATCH 1 /* Match failed. */
#define FNM_NOSYS 2 /* Function not supported (unused). */ #define FNM_NOSYS 2 /* Function not supported (unused). */
@ -50,8 +56,9 @@
#define FNM_FILE_NAME FNM_PATHNAME #define FNM_FILE_NAME FNM_PATHNAME
#endif #endif
__BEGIN_DECLS /* __BEGIN_DECLS */
int fnmatch(const char *, const char *, int); int fnmatch(const char *, const char *, int);
__END_DECLS /* __END_DECLS */
#endif /* !_FNMATCH_H_ */ #endif /* !_FNMATCH_H_ */
#endif /* ! HAVE_FNMATCH_H */

View File

@ -47,6 +47,7 @@
#include "rmd160.h" #include "rmd160.h"
#include "md5.h" #include "md5.h"
#include "blf.h" #include "blf.h"
#include "fnmatch.h"
#ifndef HAVE_BASENAME #ifndef HAVE_BASENAME
char *basename(const char *path); char *basename(const char *path);

2
scp.c
View File

@ -94,7 +94,9 @@
#include <dirent.h> #include <dirent.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#ifdef HAVE_FNMATCH_H
#include <fnmatch.h> #include <fnmatch.h>
#endif
#include <limits.h> #include <limits.h>
#include <locale.h> #include <locale.h>
#include <pwd.h> #include <pwd.h>