1 /* Copyright (C) 2001-2012 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.,  7 Mt. Lassen Drive - Suite A-134, San Rafael,
13    CA  94903, 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 fstat(fd, buf) _fstat(fd, buf)
44 #  define dup(fd) _dup(fd)
45 #  define open(fname, flags, mode) _open(fname, flags, mode)
46 #  define close(fd) _close(fd)
47 #elif defined(__BORLANDC__) && defined(__WIN32__)
48 #  define fsync(handle) _commit(handle)
49 #  define read(fd, buf, len) _read(fd, buf, len)
50 #  define isatty(fd) _isatty(fd)
51 #  define setmode(fd, mode) _setmode(fd, mode)
52 #else
53 #  include <unistd.h>
54 #endif
55 
56 #endif   /* unistd__INCLUDED */
57