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