Declare and define strnlen if necessary.diff -r1.70 -r1.71 src/tools/compat/Makefile
(apb)
--- src/tools/compat/Makefile 2013/12/11 01:24:08 1.70
+++ src/tools/compat/Makefile 2014/01/09 11:31:12 1.71
@@ -1,33 +1,34 @@ | @@ -1,33 +1,34 @@ | |||
1 | # $NetBSD: Makefile,v 1.70 2013/12/11 01:24:08 joerg Exp $ | 1 | # $NetBSD: Makefile,v 1.71 2014/01/09 11:31:12 apb Exp $ | |
2 | 2 | |||
3 | HOSTLIB= nbcompat | 3 | HOSTLIB= nbcompat | |
4 | 4 | |||
5 | .include <bsd.own.mk> | 5 | .include <bsd.own.mk> | |
6 | 6 | |||
7 | SRCS= atoll.c basename.c cdbr.c cdbw.c dirname.c \ | 7 | SRCS= atoll.c basename.c cdbr.c cdbw.c dirname.c \ | |
8 | dprintf.c fgetln.c flock.c fparseln.c fpurge.c \ | 8 | dprintf.c fgetln.c flock.c fparseln.c fpurge.c \ | |
9 | getcap.c getline.c getmode.c getopt_long.c gettemp.c \ | 9 | getcap.c getline.c getmode.c getopt_long.c gettemp.c \ | |
10 | heapsort.c \ | 10 | heapsort.c \ | |
11 | issetugid.c lchflags.c lchmod.c lchown.c libyywrap.c \ | 11 | issetugid.c lchflags.c lchmod.c lchown.c libyywrap.c \ | |
12 | md2.c md2hl.c md4c.c md4hl.c md5c.c md5hl.c \ | 12 | md2.c md2hl.c md4c.c md4hl.c md5c.c md5hl.c \ | |
13 | mi_vector_hash.c mkdtemp.c \ | 13 | mi_vector_hash.c mkdtemp.c \ | |
14 | mkstemp.c pread.c putc_unlocked.c pwcache.c pwrite.c \ | 14 | mkstemp.c pread.c putc_unlocked.c pwcache.c pwrite.c \ | |
15 | pw_scan.c \ | 15 | pw_scan.c \ | |
16 | raise_default_signal.c rmd160.c rmd160hl.c \ | 16 | raise_default_signal.c rmd160.c rmd160hl.c \ | |
17 | setenv.c setgroupent.c \ | 17 | setenv.c setgroupent.c \ | |
18 | setpassent.c setprogname.c sha1.c sha1hl.c sha2.c \ | 18 | setpassent.c setprogname.c sha1.c sha1hl.c sha2.c \ | |
19 | sha256hl.c sha384hl.c sha512hl.c snprintb.c snprintf.c \ | 19 | sha256hl.c sha384hl.c sha512hl.c snprintb.c snprintf.c \ | |
20 | stat_flags.c strlcat.c strlcpy.c strmode.c strndup.c \ | 20 | stat_flags.c strlcat.c strlcpy.c strmode.c \ | |
21 | strndup.c strnlen.c \ | |||
21 | strsep.c strsuftoll.c strtoll.c \ | 22 | strsep.c strsuftoll.c strtoll.c \ | |
22 | unvis.c vis.c err.c errx.c verr.c verrx.c \ | 23 | unvis.c vis.c err.c errx.c verr.c verrx.c \ | |
23 | vwarn.c vwarnx.c warn.c warnx.c fts.c glob.c efun.c | 24 | vwarn.c vwarnx.c warn.c warnx.c fts.c glob.c efun.c | |
24 | 25 | |||
25 | BUILD_OSTYPE!= uname -s | 26 | BUILD_OSTYPE!= uname -s | |
26 | 27 | |||
27 | # Disable use of pre-compiled headers on Darwin. | 28 | # Disable use of pre-compiled headers on Darwin. | |
28 | .if ${BUILD_OSTYPE} == "Darwin" | 29 | .if ${BUILD_OSTYPE} == "Darwin" | |
29 | CPPFLAGS+= -no-cpp-precomp | 30 | CPPFLAGS+= -no-cpp-precomp | |
30 | .endif | 31 | .endif | |
31 | 32 | |||
32 | # -D_FILE_OFFSET_BITS=64 produces a much more amenable `struct stat', and | 33 | # -D_FILE_OFFSET_BITS=64 produces a much more amenable `struct stat', and | |
33 | # other file ops, on many systems, without changing function names. | 34 | # other file ops, on many systems, without changing function names. |
--- src/tools/compat/compat_defs.h 2013/10/24 13:59:47 1.93
+++ src/tools/compat/compat_defs.h 2014/01/09 11:31:12 1.94
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: compat_defs.h,v 1.93 2013/10/24 13:59:47 apb Exp $ */ | 1 | /* $NetBSD: compat_defs.h,v 1.94 2014/01/09 11:31:12 apb Exp $ */ | |
2 | 2 | |||
3 | #ifndef __NETBSD_COMPAT_DEFS_H__ | 3 | #ifndef __NETBSD_COMPAT_DEFS_H__ | |
4 | #define __NETBSD_COMPAT_DEFS_H__ | 4 | #define __NETBSD_COMPAT_DEFS_H__ | |
5 | 5 | |||
6 | 6 | |||
7 | /* Work around some complete brain damage. */ | 7 | /* Work around some complete brain damage. */ | |
8 | /* | 8 | /* | |
9 | * Linux: <features.h> turns on _POSIX_SOURCE by default, even though the | 9 | * Linux: <features.h> turns on _POSIX_SOURCE by default, even though the | |
10 | * program (not the OS) should do that. Preload <features.h> to keep any | 10 | * program (not the OS) should do that. Preload <features.h> to keep any | |
11 | * of this crap from being pulled in, and undefine _POSIX_SOURCE. | 11 | * of this crap from being pulled in, and undefine _POSIX_SOURCE. | |
12 | */ | 12 | */ | |
13 | 13 | |||
14 | #if defined(__linux__) && HAVE_FEATURES_H | 14 | #if defined(__linux__) && HAVE_FEATURES_H | |
@@ -405,26 +405,29 @@ int gid_from_group(const char *, gid_t * | @@ -405,26 +405,29 @@ int gid_from_group(const char *, gid_t * | |||
405 | 405 | |||
406 | #if !HAVE_DECL_GROUP_FROM_GID | 406 | #if !HAVE_DECL_GROUP_FROM_GID | |
407 | const char *group_from_gid(gid_t, int); | 407 | const char *group_from_gid(gid_t, int); | |
408 | #endif | 408 | #endif | |
409 | 409 | |||
410 | #if !HAVE_DECL_PWCACHE_GROUPDB | 410 | #if !HAVE_DECL_PWCACHE_GROUPDB | |
411 | int pwcache_groupdb(int (*)(int), void (*)(void), | 411 | int pwcache_groupdb(int (*)(int), void (*)(void), | |
412 | struct group * (*)(const char *), struct group * (*)(gid_t)); | 412 | struct group * (*)(const char *), struct group * (*)(gid_t)); | |
413 | #endif | 413 | #endif | |
414 | 414 | |||
415 | #if !HAVE_DECL_STRNDUP | 415 | #if !HAVE_DECL_STRNDUP | |
416 | char *strndup(const char *, size_t); | 416 | char *strndup(const char *, size_t); | |
417 | #endif | 417 | #endif | |
418 | #if !HAVE_DECL_STRNLEN | |||
419 | char *strnlen(const char *, size_t); | |||
420 | #endif | |||
418 | #if !HAVE_DECL_LCHFLAGS | 421 | #if !HAVE_DECL_LCHFLAGS | |
419 | int lchflags(const char *, unsigned long); | 422 | int lchflags(const char *, unsigned long); | |
420 | #endif | 423 | #endif | |
421 | #if !HAVE_DECL_LCHMOD | 424 | #if !HAVE_DECL_LCHMOD | |
422 | int lchmod(const char *, mode_t); | 425 | int lchmod(const char *, mode_t); | |
423 | #endif | 426 | #endif | |
424 | #if !HAVE_DECL_LCHOWN | 427 | #if !HAVE_DECL_LCHOWN | |
425 | int lchown(const char *, uid_t, gid_t); | 428 | int lchown(const char *, uid_t, gid_t); | |
426 | #endif | 429 | #endif | |
427 | 430 | |||
428 | #if !HAVE_PWRITE | 431 | #if !HAVE_PWRITE | |
429 | ssize_t pwrite(int, const void *, size_t, off_t); | 432 | ssize_t pwrite(int, const void *, size_t, off_t); | |
430 | #endif | 433 | #endif |