ascii-chat 0.11.33
Video chat in your terminal
Loading...
Searching...
No Matches
unistd.h
Go to the documentation of this file.
1/* Windows compatibility stub for unistd.h
2 *
3 * Provides POSIX-like definitions for Windows builds.
4 * Only included on Windows (POSIX systems use the real unistd.h).
5 */
6#ifndef _UNISTD_H_COMPAT
7#define _UNISTD_H_COMPAT
8
9#ifdef _WIN32
10
11#include <io.h>
12#include <process.h>
13#include <direct.h>
14#include <basetsd.h>
15
16/* Standard file descriptors */
17#ifndef STDIN_FILENO
18#define STDIN_FILENO 0
19#endif
20#ifndef STDOUT_FILENO
21#define STDOUT_FILENO 1
22#endif
23#ifndef STDERR_FILENO
24#define STDERR_FILENO 2
25#endif
26
27/* ssize_t */
28#ifndef _SSIZE_T_DEFINED
29typedef SSIZE_T ssize_t;
30#define _SSIZE_T_DEFINED
31#endif
32
33/* Map POSIX functions to Windows equivalents */
34#ifndef access
35#define access _access
36#endif
37#ifndef dup
38#define dup _dup
39#endif
40#ifndef dup2
41#define dup2 _dup2
42#endif
43#ifndef close
44#define close _close
45#endif
46#ifndef read
47#define read _read
48#endif
49#ifndef write
50#define write _write
51#endif
52#ifndef getcwd
53#define getcwd _getcwd
54#endif
55#ifndef chdir
56#define chdir _chdir
57#endif
58#ifndef isatty
59#define isatty _isatty
60#endif
61#ifndef fileno
62#define fileno _fileno
63#endif
64#ifndef unlink
65#define unlink _unlink
66#endif
67#ifndef rmdir
68#define rmdir _rmdir
69#endif
70#ifndef getpid
71#define getpid _getpid
72#endif
73
74/* access() mode flags */
75#ifndef F_OK
76#define F_OK 0
77#endif
78#ifndef R_OK
79#define R_OK 4
80#endif
81#ifndef W_OK
82#define W_OK 2
83#endif
84#ifndef X_OK
85#define X_OK 0 /* Windows doesn't have execute permission, map to existence check */
86#endif
87
88/* sleep/usleep are handled by ascii-chat/platform/system.h macros */
89
90#endif /* _WIN32 */
91#endif /* _UNISTD_H_COMPAT */
Capture stdout/stderr and redirect to logging system.
Cross-platform process types and execution utilities.