#ifndef INCLUDED_SYSDEP_H
#define INCLUDED_SYSDEP_H

#ifdef WIN32 
/* This is only for opening readonly, but good 'nuff */
#define open_rw(path) open((path), (_O_RDWR | _O_BINARY))
#define open_wr_app(path) open((path), (_O_WRONLY | _O_APPEND | _O_BINARY)) 
#define open_ro(path) _open(path, _O_RDONLY | _O_BINARY)
#define OFF_T __int64
#define lseek(a,b,c) _lseeki64(a,b,c)
#define read(a,b,c) _read(a,b,c)
#define tell(a) _telli64(a)

#else
#define _FILE_OFFSET_BITS 64 
#define _LARGEFILE_SOURCE 1
#include <sys/mman.h>
#define open_rw(path) open((path), (O_RDWR)) // O_LARGEFILE
#define open_wr_app(path) open((path), (O_WRONLY|O_APPEND)) // O_LARGEFILE
#define open_ro(path) open((path), (O_RDONLY)) // O_LARGEFILE
#define OFF_T off_t
#define lseek(a,b,c) lseek(a,b,c)
#define read(a,b,c) read(a,b,c)
#define tell(a) lseek(a,0,SEEK_CUR)
#endif

#endif
