From e3c127d846eb2febbdb86bcf6c0c92622ab98eea Mon Sep 17 00:00:00 2001 From: Chris Rees Date: Mon, 24 Jan 2011 17:03:36 +0100 Subject: FreeBSD compat Signed-off-by: Chris Rees Signed-off-by: Denys Vlasenko --- include/libbb.h | 6 ++++++ include/platform.h | 6 ++++++ libbb/getpty.c | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/libbb.h b/include/libbb.h index 6e37b8d04..aa7944a5d 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -38,6 +38,12 @@ #include #include #include +#ifndef HAVE_CLEARENV +# define clearenv() do { if (environ) environ[0] = NULL; } while (0) +#endif +#ifndef HAVE_FDATASYNC +# define fdatasync fsync +#endif #ifdef HAVE_MNTENT_H # include #endif diff --git a/include/platform.h b/include/platform.h index bbbc0a9b6..2bc88c391 100644 --- a/include/platform.h +++ b/include/platform.h @@ -10,9 +10,12 @@ /* Assume all these functions exist by default. Platforms where it is not * true will #undef them below. */ +#define HAVE_CLEARENV 1 +#define HAVE_FDATASYNC 1 #define HAVE_FDPRINTF 1 #define HAVE_MEMRCHR 1 #define HAVE_MKDTEMP 1 +#define HAVE_PTSNAME_R 1 #define HAVE_SETBIT 1 #define HAVE_SIGHANDLER_T 1 #define HAVE_STRCASESTR 1 @@ -253,7 +256,10 @@ typedef uint32_t bb__aliased_uint32_t FIX_ALIASING; #if (defined __digital__ && defined __unix__) \ || defined __APPLE__ \ || defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__ +# undef HAVE_CLEARENV +# undef HAVE_FDATASYNC # undef HAVE_MNTENT_H +# undef HAVE_PTSNAME_R # undef HAVE_SYS_STATFS_H # undef HAVE_SIGHANDLER_T #else diff --git a/libbb/getpty.c b/libbb/getpty.c index ea653b0b6..6a15cff2f 100644 --- a/libbb/getpty.c +++ b/libbb/getpty.c @@ -19,7 +19,7 @@ int FAST_FUNC xgetpty(char *line) if (p > 0) { grantpt(p); /* chmod+chown corresponding slave pty */ unlockpt(p); /* (what does this do?) */ -#if 0 /* if ptsname_r is not available... */ +#ifndef HAVE_PTSNAME_R const char *name; name = ptsname(p); /* find out the name of slave pty */ if (!name) { -- cgit v1.2.3