#include <config.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef STDC_HEADERS
# include <stdarg.h>
# include <stddef.h>
#else
# include <varargs.h>
#endif
#ifdef HAVE_LIBGEN_H
# include <libgen.h>
#endif
#if defined(NEED_BASENAME) && !defined(HAVE_BASENAME)
# ifdef basename
# undef basename
# endif
char *openbsd_basename(const char *);
# define basename openbsd_basename
#endif
#if defined(NEED_DIRNAME) && !defined(HAVE_DIRNAME)
char *openbsd_dirname(const char *);
# define dirname openbsd_dirname
#endif
#ifdef NEED_FNMATCH
# ifndef HAVE_FNMATCH
# define FNM_NOMATCH 1
# define FNM_NOESCAPE 0x01
# define FNM_PATHNAME 0x02
# define FNM_PERIOD 0x04
# define FNM_LEADING_DIR 0x08
# define FNM_CASEFOLD 0x10
# define FNM_IGNORECASE FNM_CASEFOLD
# define FNM_FILE_NAME FNM_PATHNAME
int openbsd_fnmatch(const char *, const char *, int);
# define fnmatch openbsd_fnmatch
# else
# ifdef HAVE_FNMATCH_H
# include <fnmatch.h>
# endif
# endif
#endif
#ifdef NEED_GETHOSTBYNAME_R
# include <netdb.h>
# if GETHOSTBYNAME_R_NUM_ARGS != 6
int compat_gethostbyname_r(const char *, struct hostent *,
char *, size_t, struct hostent **, int *);
# define gethostbyname_r compat_gethostbyname_r
# endif
#endif
#if defined(NEED_GETHOSTNAME) && !defined(HAVE_GETHOSTNAME)
int gethostname(char *, size_t);
#endif
#ifdef NEED_GETSERVBYNAME_R
# include <netdb.h>
# if GETSERVBYNAME_R_NUM_ARGS != 6
int compat_getservbyname_r(const char *, const char *, struct servent *,
char *, size_t, struct servent **);
# define getservbyname_r compat_getservbyname_r
# endif
#endif
#ifdef NEED_GLOB
# ifndef HAVE_GLOB
typedef struct {
int gl_pathc;
int gl_matchc;
int gl_offs;
int gl_flags;
char **gl_pathv;
int (*gl_errfunc)(const char *, int);
void (*gl_closedir)(void *);
struct dirent *(*gl_readdir)(void *);
void *(*gl_opendir)(const char *);
int (*gl_lstat)(const char *, struct stat *);
int (*gl_stat)(const char *, struct stat *);
} glob_t;
# define GLOB_APPEND 0x0001
# define GLOB_DOOFFS 0x0002
# define GLOB_ERR 0x0004
# define GLOB_MARK 0x0008
# define GLOB_NOCHECK 0x0010
# define GLOB_NOSORT 0x0020
# define GLOB_ALTDIRFUNC 0x0040
# define GLOB_BRACE 0x0080
# define GLOB_MAGCHAR 0x0100
# define GLOB_NOMAGIC 0x0200
# define GLOB_QUOTE 0x0400
# define GLOB_TILDE 0x0800
# define GLOB_NOESCAPE 0x1000
# define GLOB_NOSPACE (-1)
# define GLOB_ABORTED (-2)
# define GLOB_NOMATCH (-3)
# define GLOB_NOSYS (-4)
# define GLOB_ABEND GLOB_ABORTED
int openbsd_glob(const char *, int, int (*)(const char *, int), glob_t *);
void openbsd_globfree(glob_t *);
# define glob openbsd_glob
# define globfree openbsd_globfree
# else
# ifdef HAVE_GLOB_H
# include <glob.h>
# endif
# endif
#endif
#if defined(NEED_INET_ATON) && !defined(HAVE_INET_ATON)
int inet_aton(const char *, struct in_addr *);
#endif
#ifdef NEED_MAKEDEV
# ifdef MAJOR_IN_MKDEV
# include <sys/mkdev.h>
# else
# ifdef MAJOR_IN_SYSMACROS
# include <sys/sysmacros.h>
# endif
# endif
# ifdef MAKEDEV_THREE_ARGS
# define compat_makedev(maj, min) makedev(0, maj, min)
# else
# define compat_makedev makedev
# endif
#endif
#if defined(NEED_SNPRINTF) && !defined(HAVE_SNPRINTF)
int mutt_snprintf(char *, size_t, const char *, ...);
int mutt_vsnprintf(char *, size_t, const char *, va_list);
#define snprintf mutt_snprintf
#define vsnprintf mutt_vsnprintf
#endif
#if defined(NEED_STRLCAT) && !defined(HAVE_STRLCAT)
size_t strlcat(char *, const char *, size_t);
#endif
#if defined(NEED_STRLCPY) && !defined(HAVE_STRLCPY)
size_t strlcpy(char *, const char *, size_t);
#endif
#if defined(NEED_STRDUP) && !defined(HAVE_STRDUP)
char *openbsd_strdup(const char *);
# define strdup openbsd_strdup
#endif
#if defined(NEED_STRMODE) && !defined(HAVE_STRMODE)
void strmode(register mode_t, register char *);
#endif
#if defined(NEED_STRRSTR) && !defined(HAVE_STRRSTR)
char *strrstr(char *, char *);
#endif
#ifdef NEED_STRSEP
# ifdef HAVE_STRSEP
# define _LINUX_SOURCE_COMPAT
# else
char *strsep(register char **, register const char *);
# endif
#endif