aGrUM  0.13.2
unistd.h
Go to the documentation of this file.
1 #ifndef _UNISTD_H
2 #define _UNISTD_H 1
3 
4 #ifndef DOXYGEN_SHOULD_SKIP_THIS
5 
6 /* This file intended to serve as a drop-in replacement for
7  * unistd.h on Windows
8  * Please add functionality as neeeded
9  */
10 
11 # include <io.h>
12 # include <stdlib.h>
13 //#include <getopt.h> /* getopt at: https://gist.github.com/ashelly/7776712 */
14 # include <direct.h> /* for _getcwd() and _chdir() */
15 # include <process.h> /* for getpid() and the exec..() family */
16 
17 # define srandom srand
18 # define random rand
19 
20 /* Values for the second argument to access.
21  These may be OR'd together. */
22 # define R_OK 4 /* Test for read permission. */
23 # define W_OK 2 /* Test for write permission. */
24 //#define X_OK 1 /* execute permission - unsupported in windows*/
25 # define F_OK 0 /* Test for existence. */
26 
27 # define access _access
28 # define dup2 _dup2
29 # define execve _execve
30 # define ftruncate _chsize
31 # define unlink _unlink
32 # define fileno _fileno
33 # define getcwd _getcwd
34 # define chdir _chdir
35 # define isatty _isatty
36 # define lseek _lseek
37 /* read, write, and close are NOT being #defined here, because while there are
38  * file handle specific versions for Windows, they probably don't work for
39  * sockets. You need to look at your app and consider whether to call e.g.
40  * closesocket(). */
41 
42 # define ssize_t int
43 
44 # define STDIN_FILENO 0
45 # define STDOUT_FILENO 1
46 # define STDERR_FILENO 2
47 /* should be in some equivalent to <sys/types.h> */
48 // typedef __int8 int8_t;
49 typedef __int16 int16_t;
50 typedef __int32 int32_t;
51 typedef __int64 int64_t;
52 typedef unsigned __int8 uint8_t;
53 typedef unsigned __int16 uint16_t;
54 typedef unsigned __int32 uint32_t;
55 typedef unsigned __int64 uint64_t;
56 
57 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
58 
59 #endif /* unistd.h */