1 /* Copyright (C) 2001-2019 Artifex Software, Inc.
2    All Rights Reserved.
3 
4    This software is provided AS-IS with no warranty, either express or
5    implied.
6 
7    This software is distributed under license and may not be copied,
8    modified or distributed except as expressly authorized under the terms
9    of the license contained in the file LICENSE in this distribution.
10 
11    Refer to licensing information at http://www.artifex.com or contact
12    Artifex Software, Inc.,  1305 Grant Avenue - Suite 200, Novato,
13    CA 94945, U.S.A., +1(415)492-9861, for further information.
14 */
15 
16 
17 /* Generic substitute for Unix unistd.h */
18 
19 #ifndef unistd__INCLUDED
20 #  define unistd__INCLUDED
21 
22 /* We must include std.h before any file that includes sys/types.h. */
23 #include "std.h"
24 
25 /*
26  * It's likely that you will have to edit the next lines on some Unix
27  * and most non-Unix platforms, since there is no standard (ANSI or
28  * otherwise) for where to find these definitions.
29  */
30 
31 #ifdef __OS2__
32 #  include <io.h>
33 #endif
34 #ifdef __WIN32__
35 #  include <io.h>
36 #endif
37 
38 #if defined(_MSC_VER)
39 #  define fsync(handle) _commit(handle)
40 #  define read(fd, buf, len) _read(fd, buf, len)
41 #  define isatty(fd) _isatty(fd)
42 #  define setmode(fd, mode) _setmode(fd, mode)
43 #  define dup(fd) _dup(fd)
44 #  define open(fname, flags, mode) _open(fname, flags, mode)
45 #  define close(fd) _close(fd)
46 #elif defined(__BORLANDC__) && defined(__WIN32__)
47 #  define fsync(handle) _commit(handle)
48 #  define read(fd, buf, len) _read(fd, buf, len)
49 #  define isatty(fd) _isatty(fd)
50 #  define setmode(fd, mode) _setmode(fd, mode)
51 #else
52    /* _XOPEN_SOURCE 500 define is needed to get
53     * access to pread and pwrite */
54 #  define _XOPEN_SOURCE 500
55 #  define __USE_UNIX98
56 #  include <unistd.h>
57 #endif
58 
59 #endif   /* unistd__INCLUDED */
60