1 /* prototypes for borrowed "compatibility" code */
16 #if defined(NEED_BASENAME) && !defined(HAVE_BASENAME)
19 # undef basename /* fix glibc brokenness */
22 char *openbsd_basename(const char *);
23 # define basename openbsd_basename
25 #endif /* NEED_BASENAME && ! HAVE_BASENAME */
28 #if defined(NEED_DIRNAME) && !defined(HAVE_DIRNAME)
30 char *openbsd_dirname(const char *);
31 # define dirname openbsd_dirname
33 #endif /* NEED_DIRNAME && ! HAVE_DIRNAME */
39 # define FNM_NOMATCH 1 /* Match failed. */
41 # define FNM_NOESCAPE 0x01 /* Disable backslash escaping. */
42 # define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */
43 # define FNM_PERIOD 0x04 /* Period must be matched by period. */
45 # define FNM_LEADING_DIR 0x08 /* Ignore /<tail> after Imatch. */
46 # define FNM_CASEFOLD 0x10 /* Case insensitive search. */
47 # define FNM_IGNORECASE FNM_CASEFOLD
48 # define FNM_FILE_NAME FNM_PATHNAME
50 int openbsd_fnmatch(const char *, const char *, int);
51 # define fnmatch openbsd_fnmatch
53 # else /* HAVE_FNMATCH */
55 # ifdef HAVE_FNMATCH_H
59 # endif /* ! HAVE_FNMATCH */
60 #endif /* NEED_FNMATCH */
63 #ifdef NEED_GETHOSTBYNAME_R
67 # if GETHOSTBYNAME_R_NUM_ARGS != 6
69 int compat_gethostbyname_r(const char *, struct hostent
*,
70 char *, size_t, struct hostent
**, int *);
72 # define gethostbyname_r compat_gethostbyname_r
74 # endif /* GETHOSTBYNAME_R_NUM_ARGS != 6 */
76 #endif /* NEED_GETHOSTBYNAME_R */
79 #if defined(NEED_GETHOSTNAME) && !defined(HAVE_GETHOSTNAME)
81 int gethostname(char *, size_t);
83 #endif /* NEED_GETHOSTNAME && ! HAVE_GETHOSTNAME */
86 #ifdef NEED_GETSERVBYNAME_R
90 # if GETSERVBYNAME_R_NUM_ARGS != 6
92 int compat_getservbyname_r(const char *, const char *, struct servent
*,
93 char *, size_t, struct servent
**);
95 # define getservbyname_r compat_getservbyname_r
97 # endif /* GETSERVBYNAME_R_NUM_ARGS != 6 */
99 #endif /* NEED_GETSERVBYNAME_R */
107 int gl_pathc
; /* Count of total paths so far. */
108 int gl_matchc
; /* Count of paths matching pattern. */
109 int gl_offs
; /* Reserved at beginning of gl_pathv. */
110 int gl_flags
; /* Copy of flags parameter to glob. */
111 char **gl_pathv
; /* List of paths matching pattern. */
112 /* Copy of errfunc parameter to glob. */
113 int (*gl_errfunc
)(const char *, int);
116 * Alternate filesystem access methods for glob; replacement
117 * versions of closedir(3), readdir(3), opendir(3), stat(2)
120 void (*gl_closedir
)(void *);
121 struct dirent
*(*gl_readdir
)(void *);
122 void *(*gl_opendir
)(const char *);
123 int (*gl_lstat
)(const char *, struct stat
*);
124 int (*gl_stat
)(const char *, struct stat
*);
128 # define GLOB_APPEND 0x0001 /* Append to output from previous call. */
129 # define GLOB_DOOFFS 0x0002 /* Use gl_offs. */
130 # define GLOB_ERR 0x0004 /* Return on error. */
131 # define GLOB_MARK 0x0008 /* Append / to matching directories. */
132 # define GLOB_NOCHECK 0x0010 /* Return pattern itself if nothing matches. */
133 # define GLOB_NOSORT 0x0020 /* Don't sort. */
135 # define GLOB_ALTDIRFUNC 0x0040 /* Use alternately specified directory funcs. */
136 # define GLOB_BRACE 0x0080 /* Expand braces ala csh. */
137 # define GLOB_MAGCHAR 0x0100 /* Pattern had globbing characters. */
138 # define GLOB_NOMAGIC 0x0200 /* GLOB_NOCHECK without magic chars (csh). */
139 # define GLOB_QUOTE 0x0400 /* Quote special chars with \. */
140 # define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */
141 # define GLOB_NOESCAPE 0x1000 /* Disable backslash escaping. */
143 /* Error values returned by glob(3) */
144 # define GLOB_NOSPACE (-1) /* Malloc call failed. */
145 # define GLOB_ABORTED (-2) /* Unignored error. */
146 # define GLOB_NOMATCH (-3) /* No match and GLOB_NOCHECK not set. */
147 # define GLOB_NOSYS (-4) /* Function not supported. */
148 # define GLOB_ABEND GLOB_ABORTED
150 int openbsd_glob(const char *, int, int (*)(const char *, int), glob_t
*);
151 void openbsd_globfree(glob_t
*);
152 # define glob openbsd_glob
153 # define globfree openbsd_globfree
155 # else /* HAVE_GLOB */
161 # endif /* ! HAVE_GLOB */
162 #endif /* NEED_GLOB */
165 #if defined(NEED_INET_ATON) && !defined(HAVE_INET_ATON)
167 int inet_aton(const char *, struct in_addr
*);
169 #endif /* NEED_INET_ATON && ! HAVE_INET_ATON */
174 # ifdef MAJOR_IN_MKDEV
175 # include <sys/mkdev.h>
177 # ifdef MAJOR_IN_SYSMACROS
178 # include <sys/sysmacros.h>
183 ** On most systems makedev() has two args.
184 ** Some weird systems, like QNX6, have makedev() functions that expect
185 ** an extra first argument for "node", which can be 0 for a local
189 # ifdef MAKEDEV_THREE_ARGS
190 # define compat_makedev(maj, min) makedev(0, maj, min)
192 # define compat_makedev makedev
195 #endif /* NEED_MAKEDEV */
198 #if defined(NEED_SNPRINTF) && !defined(HAVE_SNPRINTF)
200 int mutt_snprintf(char *, size_t, const char *, ...);
201 int mutt_vsnprintf(char *, size_t, const char *, va_list);
202 #define snprintf mutt_snprintf
203 #define vsnprintf mutt_vsnprintf
205 #endif /* NEED_SNPRINTF && ! HAVE_SNPRINTF */
208 #if defined(NEED_STRLCAT) && !defined(HAVE_STRLCAT)
210 size_t strlcat(char *, const char *, size_t);
212 #endif /* NEED_STRLCAT && ! HAVE_STRLCAT */
215 #if defined(NEED_STRLCPY) && !defined(HAVE_STRLCPY)
217 size_t strlcpy(char *, const char *, size_t);
219 #endif /* NEED_STRLCPY && ! HAVE_STRLCPY */
222 #if defined(NEED_STRDUP) && !defined(HAVE_STRDUP)
224 char *openbsd_strdup(const char *);
225 # define strdup openbsd_strdup
227 #endif /* NEED_STRDUP && ! HAVE_STRDUP */
230 #if defined(NEED_STRMODE) && !defined(HAVE_STRMODE)
232 void strmode(register mode_t
, register char *);
234 #endif /* NEED_STRMODE && ! HAVE_STRMODE */
237 #if defined(NEED_STRRSTR) && !defined(HAVE_STRRSTR)
239 char *strrstr(char *, char *);
241 #endif /* NEED_STRRSTR && ! HAVE_STRRSTR */
247 # define _LINUX_SOURCE_COMPAT /* needed on AIX 4.3.3 */
250 char *strsep(register char **, register const char *);
254 #endif /* NEED_STRSEP */