/*
   gop_fixup:  Fixes timestamp of MPEG2 GOP headers.

   (c) 2001-2004 Mark Rages <markrages@mlug.missouri.edu>
   
   Released under the terms of the GNU GPL.  You know what they are. 
*/

#ifndef INCLUDED_SYSDEP_H
#define INCLUDED_SYSDEP_H

#ifdef WIN32 
/* This is only valid 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 /* assume linux. */
#define _FILE_OFFSET_BITS 64
#define _LARGEFILE64_SOURCE 
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
#define open_rw(path) open((path), (O_RDWR|O_LARGEFILE))
#define open_wr_app(path) open((path), (O_WRONLY))
#define open_ro(path) open((path), (O_RDONLY))
#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
