File indexing completed on 2024-12-22 04:04:14
0001 /* Copyright (C) 2001-2019 Peter Selinger. 0002 This file is part of Potrace. It is free software and it is covered 0003 by the GNU General Public License. See the file COPYING for details. */ 0004 0005 /* this header file contains some platform dependent stuff */ 0006 0007 #ifndef PLATFORM_H 0008 #define PLATFORM_H 0009 0010 #ifdef HAVE_CONFIG_H 0011 #include <config.h> 0012 #endif 0013 0014 /* in Windows and OS/2, set all file i/o to binary */ 0015 #ifdef __MINGW32__ 0016 #include <fcntl.h> 0017 unsigned int _CRT_fmode = _O_BINARY; 0018 static inline void platform_init(void) { 0019 _setmode(_fileno(stdin), _O_BINARY); 0020 _setmode(_fileno(stdout), _O_BINARY); 0021 } 0022 #else 0023 0024 #ifdef __CYGWIN__ 0025 #include <fcntl.h> 0026 #include <io.h> 0027 static inline void platform_init(void) { 0028 setmode(0, O_BINARY); 0029 setmode(1, O_BINARY); 0030 } 0031 #else 0032 0033 #ifdef __OS2__ 0034 #include <fcntl.h> 0035 static inline void platform_init(void) { 0036 setmode(fileno(stdin), O_BINARY); 0037 setmode(fileno(stdout), O_BINARY); 0038 } 0039 #else 0040 0041 static inline void platform_init(void) { 0042 /* NOP */ 0043 } 0044 #endif 0045 #endif 0046 #endif 0047 0048 #endif /* PLATFORM_H */