os_defs.h
Go to the documentation of this file.
1 #ifndef NVIM_OS_OS_DEFS_H
2 #define NVIM_OS_OS_DEFS_H
3 
4 #include <ctype.h>
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <sys/stat.h>
8 #include <sys/types.h>
9 
10 #ifdef WIN32
11 # include "nvim/os/win_defs.h"
12 #else
13 # include "nvim/os/unix_defs.h"
14 #endif
15 
16 #define BASENAMELEN (NAME_MAX - 5)
17 
18 // Use the system path length if it makes sense.
19 #define DEFAULT_MAXPATHL 4096
20 #if defined(PATH_MAX) && (PATH_MAX > DEFAULT_MAXPATHL)
21 # define MAXPATHL PATH_MAX
22 #else
23 # define MAXPATHL DEFAULT_MAXPATHL
24 #endif
25 
26 // Command-processing buffer. Use large buffers for all platforms.
27 #define CMDBUFFSIZE 1024
28 
29 // Note: Some systems need both string.h and strings.h (Savage). However,
30 // some systems can't handle both, only use string.h in that case.
31 #include <string.h>
32 #if defined(HAVE_STRINGS_H) && !defined(NO_STRINGS_WITH_STRING_H)
33 # include <strings.h>
34 #endif
35 
37 #define os_strerror uv_strerror
38 
40 #define os_translate_sys_error uv_translate_sys_error
41 
42 #ifdef WIN32
43 # define os_strtok strtok_s
44 #else
45 # define os_strtok strtok_r
46 #endif
47 
48 // stat macros
49 #ifndef S_ISDIR
50 # ifdef S_IFDIR
51 # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
52 # else
53 # define S_ISDIR(m) 0
54 # endif
55 #endif
56 #ifndef S_ISREG
57 # ifdef S_IFREG
58 # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
59 # else
60 # define S_ISREG(m) 0
61 # endif
62 #endif
63 #ifndef S_ISBLK
64 # ifdef S_IFBLK
65 # define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
66 # else
67 # define S_ISBLK(m) 0
68 # endif
69 #endif
70 #ifndef S_ISSOCK
71 # ifdef S_IFSOCK
72 # define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
73 # else
74 # define S_ISSOCK(m) 0
75 # endif
76 #endif
77 #ifndef S_ISFIFO
78 # ifdef S_IFIFO
79 # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
80 # else
81 # define S_ISFIFO(m) 0
82 # endif
83 #endif
84 #ifndef S_ISCHR
85 # ifdef S_IFCHR
86 # define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
87 # else
88 # define S_ISCHR(m) 0
89 # endif
90 #endif
91 #ifndef S_ISLNK
92 # ifdef S_IFLNK
93 # define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
94 # else
95 # define S_ISLNK(m) 0
96 # endif
97 #endif
98 
99 #endif // NVIM_OS_OS_DEFS_H
unix_defs.h
strings.h
win_defs.h
stdlib.h