xref: /plan9/sys/src/cmd/gs/src/unistd_.h (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1 /* Copyright (C) 2000, 2001 Artifex Software, Inc. All rights reserved.
2 
3   This software is provided AS-IS with no warranty, either express or
4   implied.
5 
6   This software is distributed under license and may not be copied,
7   modified or distributed except as expressly authorized under the terms
8   of the license contained in the file LICENSE in this distribution.
9 
10   For more information about licensing, please refer to
11   http://www.ghostscript.com/licensing/. For information on
12   commercial licensing, go to http://www.artifex.com/licensing/ or
13   contact Artifex Software, Inc., 101 Lucas Valley Road #110,
14   San Rafael, CA  94903, U.S.A., +1(415)492-9861.
15 */
16 
17 /* $Id: unistd_.h,v 1.12 2004/09/15 19:41:01 ray Exp $ */
18 /* Generic substitute for Unix unistd.h */
19 
20 #ifndef unistd__INCLUDED
21 #  define unistd__INCLUDED
22 
23 /* We must include std.h before any file that includes sys/types.h. */
24 #include "std.h"
25 
26 /*
27  * It's likely that you will have to edit the next lines on some Unix
28  * and most non-Unix platforms, since there is no standard (ANSI or
29  * otherwise) for where to find these definitions.
30  */
31 
32 #ifdef __OS2__
33 #  include <io.h>
34 #endif
35 #ifdef __WIN32__
36 #  include <io.h>
37 #endif
38 
39 #if defined(_MSC_VER)
40 #  define fsync(handle) _commit(handle)
41 #  define read(fd, buf, len) _read(fd, buf, len)
42 #  define isatty(fd) _isatty(fd)
43 #  define setmode(fd, mode) _setmode(fd, mode)
44 #  define fstat(fd, buf) _fstat(fd, buf)
45 #  define dup(fd) _dup(fd)
46 #  define open(fname, flags, mode) _open(fname, flags, mode)
47 #  define close(fd) _close(fd)
48 #elif defined(__BORLANDC__) && defined(__WIN32__)
49 #  define fsync(handle) _commit(handle)
50 #  define read(fd, buf, len) _read(fd, buf, len)
51 #  define isatty(fd) _isatty(fd)
52 #  define setmode(fd, mode) _setmode(fd, mode)
53 #else
54 #  include <unistd.h>
55 #endif
56 
57 #endif   /* unistd__INCLUDED */
58 
59