/* Fixes.h - Fixes for missing functions and definitions */

#define _ARISA_FIXES_H

#ifndef O_LARGEFILE
/* Assume the system doesn't need it, if it doesn't have it. */
#define O_LARGEFILE 0
#endif /* !O_LARGEFILE */

#ifndef HAVE_STPCPY
static inline char *stpcpy(char *dest, const char *src) {
	strcpy(dest,src);
	return strchr(dest,'\0');
}
#endif /* !HAVE_STPCPY */

#ifndef HAVE_STRTOF
static inline float strtof(const char *nptr, char **endptr) {
	return (float) strtod(nptr,endptr);
}
#endif /* !HAVE_STRTOF */

#ifdef WANT_POLL
#ifdef HAVE_SYS_POLL_H
#include <sys/poll.h>
#else
/* kludge */
struct pollfd {
	int fd;
	short events;
	short revents;
};
int poll(struct pollfd *ufds, unsigned int fds, int timeout);
#define POLLIN          0x0001
#define POLLPRI         0x0002
#define POLLOUT         0x0004
#define POLLERR         0x0008
#define POLLHUP         0x0010
#define POLLNVAL        0x0020
#endif /* ! HAVE_SYS_POLL_H */
#endif /* WANT_POLL */

#ifdef WANT_STATFS
#if defined(HAVE_STATFS) && (defined(HAVE_LINUX) || defined(HAVE_FREEBSD))

#if defined(HAVE_LINUX)
#include <sys/vfs.h>
#elif defined(HAVE_FREEBSD)
#include <sys/param.h>
#include <sys/mount.h>
#endif /* defined(HAVE_LINUX) */

#else /* defined(HAVE_STATFS) && ... */

#undef HAVE_STATFS

#endif /* defined(HAVE_STATFS) && ... */
#endif /* WANT_STATFS */
