Mercurial > vim
annotate src/os_unix.h @ 9820:6882920b42da v7.4.2185
commit https://github.com/vim/vim/commit/71dd9744cf3842cd45295010d2e5692da1651537
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Aug 8 22:42:04 2016 +0200
patch 7.4.2185
Problem: Test glob2regpat does not test much.
Solution: Add a few more test cases. (Dominique Pelle)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Mon, 08 Aug 2016 22:45:06 +0200 |
parents | 284b4eb307fc |
children | 4aead6a9b7a9 |
rev | line source |
---|---|
7 | 1 /* vi:set ts=8 sts=4 sw=4: |
2 * | |
3 * VIM - Vi IMproved by Bram Moolenaar | |
4 * | |
5 * Do ":help uganda" in Vim to read copying and usage conditions. | |
6 * Do ":help credits" in Vim to see a list of people who contributed. | |
7 */ | |
8 | |
9 /* | |
10 * NextStep has a problem with configure, undefine a few things: | |
11 */ | |
12 #ifdef NeXT | |
13 # ifdef HAVE_UTIME | |
14 # undef HAVE_UTIME | |
15 # endif | |
16 # ifdef HAVE_SYS_UTSNAME_H | |
17 # undef HAVE_SYS_UTSNAME_H | |
18 # endif | |
19 #endif | |
20 | |
21 #include <stdio.h> | |
22 #include <ctype.h> | |
23 | |
24 #ifdef VAXC | |
25 # include <types.h> | |
26 # include <stat.h> | |
27 #else | |
28 # include <sys/types.h> | |
29 # include <sys/stat.h> | |
30 #endif | |
31 | |
32 #ifdef HAVE_STDLIB_H | |
33 # include <stdlib.h> | |
34 #endif | |
35 | |
36 #if defined(__CYGWIN__) || defined(__CYGWIN32__) | |
37 # define WIN32UNIX /* Compiling for Win32 using Unix files. */ | |
38 # define BINARY_FILE_IO | |
585 | 39 |
40 # define CASE_INSENSITIVE_FILENAME | |
41 # define USE_FNAME_CASE /* Fix filename case differences. */ | |
7 | 42 #endif |
43 | |
44 /* On AIX 4.2 there is a conflicting prototype for ioctl() in stropts.h and | |
45 * unistd.h. This hack should fix that (suggested by Jeff George). | |
46 * But on AIX 4.3 it's alright (suggested by Jake Hamby). */ | |
47 #if defined(FEAT_GUI) && defined(_AIX) && !defined(_AIX43) && !defined(_NO_PROTO) | |
48 # define _NO_PROTO | |
49 #endif | |
50 | |
51 #ifdef HAVE_UNISTD_H | |
1879 | 52 # include <unistd.h> |
7 | 53 #endif |
54 | |
55 #ifdef HAVE_LIBC_H | |
56 # include <libc.h> /* for NeXT */ | |
57 #endif | |
58 | |
59 #ifdef HAVE_SYS_PARAM_H | |
60 # include <sys/param.h> /* defines BSD, if it's a BSD system */ | |
61 #endif | |
62 | |
63 /* | |
64 * Using getcwd() is preferred, because it checks for a buffer overflow. | |
65 * Don't use getcwd() on systems do use system("sh -c pwd"). There is an | |
66 * autoconf check for this. | |
67 * Use getcwd() anyway if getwd() isn't present. | |
68 */ | |
69 #if defined(HAVE_GETCWD) && !(defined(BAD_GETCWD) && defined(HAVE_GETWD)) | |
70 # define USE_GETCWD | |
71 #endif | |
72 | |
73 /* always use unlink() to remove files */ | |
74 #ifndef PROTO | |
75 # ifdef VMS | |
76 # define mch_remove(x) delete((char *)(x)) | |
77 # define vim_mkdir(x, y) mkdir((char *)(x), y) | |
78 # ifdef VAX | |
79 # else | |
80 # define mch_rmdir(x) rmdir((char *)(x)) | |
81 # endif | |
82 # else | |
83 # define vim_mkdir(x, y) mkdir((char *)(x), y) | |
84 # define mch_rmdir(x) rmdir((char *)(x)) | |
85 # define mch_remove(x) unlink((char *)(x)) | |
86 # endif | |
87 #endif | |
88 | |
89 /* The number of arguments to a signal handler is configured here. */ | |
90 /* It used to be a long list of almost all systems. Any system that doesn't | |
91 * have an argument??? */ | |
92 #define SIGHASARG | |
93 | |
94 /* List 3 arg systems here. I guess __sgi, please test and correct me. jw. */ | |
95 #if defined(__sgi) && defined(HAVE_SIGCONTEXT) | |
96 # define SIGHAS3ARGS | |
97 #endif | |
98 | |
99 #ifdef SIGHASARG | |
100 # ifdef SIGHAS3ARGS | |
101 # define SIGPROTOARG (int, int, struct sigcontext *) | |
102 # define SIGDEFARG(s) (s, sig2, scont) int s, sig2; struct sigcontext *scont; | |
103 # define SIGDUMMYARG 0, 0, (struct sigcontext *)0 | |
104 # else | |
105 # define SIGPROTOARG (int) | |
1877 | 106 # define SIGDEFARG(s) (s) int s UNUSED; |
7 | 107 # define SIGDUMMYARG 0 |
108 # endif | |
109 #else | |
110 # define SIGPROTOARG (void) | |
111 # define SIGDEFARG(s) () | |
112 # define SIGDUMMYARG | |
113 #endif | |
114 | |
115 #ifdef HAVE_DIRENT_H | |
116 # include <dirent.h> | |
117 # ifndef NAMLEN | |
118 # define NAMLEN(dirent) strlen((dirent)->d_name) | |
119 # endif | |
120 #else | |
121 # define dirent direct | |
122 # define NAMLEN(dirent) (dirent)->d_namlen | |
123 # if HAVE_SYS_NDIR_H | |
124 # include <sys/ndir.h> | |
125 # endif | |
126 # if HAVE_SYS_DIR_H | |
127 # include <sys/dir.h> | |
128 # endif | |
129 # if HAVE_NDIR_H | |
130 # include <ndir.h> | |
131 # endif | |
132 #endif | |
133 | |
134 #if !defined(HAVE_SYS_TIME_H) || defined(TIME_WITH_SYS_TIME) | |
135 # include <time.h> /* on some systems time.h should not be | |
136 included together with sys/time.h */ | |
137 #endif | |
138 #ifdef HAVE_SYS_TIME_H | |
139 # include <sys/time.h> | |
140 #endif | |
141 | |
142 #include <signal.h> | |
143 | |
144 #if defined(DIRSIZ) && !defined(MAXNAMLEN) | |
145 # define MAXNAMLEN DIRSIZ | |
146 #endif | |
147 | |
148 #if defined(UFS_MAXNAMLEN) && !defined(MAXNAMLEN) | |
149 # define MAXNAMLEN UFS_MAXNAMLEN /* for dynix/ptx */ | |
150 #endif | |
151 | |
152 #if defined(NAME_MAX) && !defined(MAXNAMLEN) | |
153 # define MAXNAMLEN NAME_MAX /* for Linux before .99p3 */ | |
154 #endif | |
155 | |
156 /* | |
157 * Note: if MAXNAMLEN has the wrong value, you will get error messages | |
158 * for not being able to open the swap file. | |
159 */ | |
160 #if !defined(MAXNAMLEN) | |
161 # define MAXNAMLEN 512 /* for all other Unix */ | |
162 #endif | |
163 | |
164 #define BASENAMELEN (MAXNAMLEN - 5) | |
165 | |
166 #ifdef HAVE_PWD_H | |
167 # include <pwd.h> | |
168 #endif | |
169 | |
170 #if (defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_GETRLIMIT)) \ | |
171 || (defined(HAVE_SYS_SYSINFO_H) && defined(HAVE_SYSINFO)) \ | |
172 || defined(HAVE_SYSCTL) || defined(HAVE_SYSCONF) | |
173 # define HAVE_TOTAL_MEM | |
174 #endif | |
175 | |
3927 | 176 |
177 #ifndef PROTO | |
178 | |
7 | 179 #ifdef VMS |
819 | 180 # include <unixio.h> |
181 # include <unixlib.h> | |
182 # include <signal.h> | |
183 # include <file.h> | |
184 # include <ssdef.h> | |
185 # include <descrip.h> | |
186 # include <libclidef.h> | |
187 # include <lnmdef.h> | |
188 # include <psldef.h> | |
189 # include <prvdef.h> | |
190 # include <dvidef.h> | |
191 # include <dcdef.h> | |
192 # include <stsdef.h> | |
193 # include <iodef.h> | |
194 # include <ttdef.h> | |
195 # include <tt2def.h> | |
196 # include <jpidef.h> | |
197 # include <rms.h> | |
198 # include <trmdef.h> | |
199 # include <string.h> | |
200 # include <starlet.h> | |
201 # include <socket.h> | |
202 # include <lib$routines.h> | |
5541 | 203 # include <libdef.h> |
204 # include <libdtdef.h> | |
819 | 205 |
206 # ifdef FEAT_GUI_GTK | |
207 # include "gui_gtk_vms.h" | |
208 # endif | |
3927 | 209 #endif |
7 | 210 |
3927 | 211 #endif /* PROTO */ |
212 | |
213 #ifdef VMS | |
7 | 214 typedef struct dsc$descriptor DESC; |
215 #endif | |
216 | |
217 /* | |
218 * Unix system-dependent file names | |
219 */ | |
220 #ifndef SYS_VIMRC_FILE | |
221 # define SYS_VIMRC_FILE "$VIM/vimrc" | |
222 #endif | |
223 #ifndef SYS_GVIMRC_FILE | |
224 # define SYS_GVIMRC_FILE "$VIM/gvimrc" | |
225 #endif | |
226 #ifndef DFLT_HELPFILE | |
227 # define DFLT_HELPFILE "$VIMRUNTIME/doc/help.txt" | |
228 #endif | |
229 #ifndef FILETYPE_FILE | |
230 # define FILETYPE_FILE "filetype.vim" | |
231 #endif | |
232 #ifndef FTPLUGIN_FILE | |
233 # define FTPLUGIN_FILE "ftplugin.vim" | |
234 #endif | |
235 #ifndef INDENT_FILE | |
236 # define INDENT_FILE "indent.vim" | |
237 #endif | |
238 #ifndef FTOFF_FILE | |
239 # define FTOFF_FILE "ftoff.vim" | |
240 #endif | |
241 #ifndef FTPLUGOF_FILE | |
242 # define FTPLUGOF_FILE "ftplugof.vim" | |
243 #endif | |
244 #ifndef INDOFF_FILE | |
245 # define INDOFF_FILE "indoff.vim" | |
246 #endif | |
247 #ifndef SYS_MENU_FILE | |
248 # define SYS_MENU_FILE "$VIMRUNTIME/menu.vim" | |
249 #endif | |
250 | |
251 #ifndef USR_EXRC_FILE | |
252 # ifdef VMS | |
253 # define USR_EXRC_FILE "sys$login:.exrc" | |
254 # else | |
255 # define USR_EXRC_FILE "$HOME/.exrc" | |
256 # endif | |
257 #endif | |
258 | |
259 #if !defined(USR_EXRC_FILE2) && defined(VMS) | |
260 # define USR_EXRC_FILE2 "sys$login:_exrc" | |
261 #endif | |
262 | |
263 #ifndef USR_VIMRC_FILE | |
264 # ifdef VMS | |
265 # define USR_VIMRC_FILE "sys$login:.vimrc" | |
266 # else | |
267 # define USR_VIMRC_FILE "$HOME/.vimrc" | |
268 # endif | |
269 #endif | |
270 | |
4863
c4d4f0fc12b9
updated for version 7.3.1178
Bram Moolenaar <bram@vim.org>
parents:
3927
diff
changeset
|
271 |
6783 | 272 #if !defined(USR_VIMRC_FILE2) |
7408
1886f2863437
commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents:
6783
diff
changeset
|
273 # ifdef VMS |
1886f2863437
commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents:
6783
diff
changeset
|
274 # define USR_VIMRC_FILE2 "sys$login:vimfiles/vimrc" |
4863
c4d4f0fc12b9
updated for version 7.3.1178
Bram Moolenaar <bram@vim.org>
parents:
3927
diff
changeset
|
275 # else |
7408
1886f2863437
commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents:
6783
diff
changeset
|
276 # define USR_VIMRC_FILE2 "~/.vim/vimrc" |
4863
c4d4f0fc12b9
updated for version 7.3.1178
Bram Moolenaar <bram@vim.org>
parents:
3927
diff
changeset
|
277 # endif |
7 | 278 #endif |
4863
c4d4f0fc12b9
updated for version 7.3.1178
Bram Moolenaar <bram@vim.org>
parents:
3927
diff
changeset
|
279 |
c4d4f0fc12b9
updated for version 7.3.1178
Bram Moolenaar <bram@vim.org>
parents:
3927
diff
changeset
|
280 #if !defined(USR_VIMRC_FILE3) && defined(VMS) |
c4d4f0fc12b9
updated for version 7.3.1178
Bram Moolenaar <bram@vim.org>
parents:
3927
diff
changeset
|
281 # define USR_VIMRC_FILE3 "sys$login:_vimrc" |
7 | 282 #endif |
283 | |
284 #ifndef USR_GVIMRC_FILE | |
285 # ifdef VMS | |
286 # define USR_GVIMRC_FILE "sys$login:.gvimrc" | |
287 # else | |
288 # define USR_GVIMRC_FILE "$HOME/.gvimrc" | |
289 # endif | |
290 #endif | |
291 | |
4863
c4d4f0fc12b9
updated for version 7.3.1178
Bram Moolenaar <bram@vim.org>
parents:
3927
diff
changeset
|
292 #ifndef USR_GVIMRC_FILE2 |
7408
1886f2863437
commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents:
6783
diff
changeset
|
293 # ifdef VMS |
1886f2863437
commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents:
6783
diff
changeset
|
294 # define USR_GVIMRC_FILE2 "sys$login:vimfiles/gvimrc" |
4863
c4d4f0fc12b9
updated for version 7.3.1178
Bram Moolenaar <bram@vim.org>
parents:
3927
diff
changeset
|
295 # else |
7408
1886f2863437
commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents:
6783
diff
changeset
|
296 # define USR_GVIMRC_FILE2 "~/.vim/gvimrc" |
4863
c4d4f0fc12b9
updated for version 7.3.1178
Bram Moolenaar <bram@vim.org>
parents:
3927
diff
changeset
|
297 # endif |
c4d4f0fc12b9
updated for version 7.3.1178
Bram Moolenaar <bram@vim.org>
parents:
3927
diff
changeset
|
298 #endif |
c4d4f0fc12b9
updated for version 7.3.1178
Bram Moolenaar <bram@vim.org>
parents:
3927
diff
changeset
|
299 |
7 | 300 #ifdef VMS |
4863
c4d4f0fc12b9
updated for version 7.3.1178
Bram Moolenaar <bram@vim.org>
parents:
3927
diff
changeset
|
301 # ifndef USR_GVIMRC_FILE3 |
c4d4f0fc12b9
updated for version 7.3.1178
Bram Moolenaar <bram@vim.org>
parents:
3927
diff
changeset
|
302 # define USR_GVIMRC_FILE3 "sys$login:_gvimrc" |
7 | 303 # endif |
304 #endif | |
305 | |
9669
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
9536
diff
changeset
|
306 #ifndef VIM_DEFAULTS_FILE |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
9536
diff
changeset
|
307 # define VIM_DEFAULTS_FILE "$VIMRUNTIME/defaults.vim" |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
9536
diff
changeset
|
308 #endif |
284b4eb307fc
commit https://github.com/vim/vim/commit/8c08b5b569e2a9e9f63dea514591ecfa2d3bb392
Christian Brabandt <cb@256bit.org>
parents:
9536
diff
changeset
|
309 |
7 | 310 #ifndef EVIM_FILE |
311 # define EVIM_FILE "$VIMRUNTIME/evim.vim" | |
312 #endif | |
313 | |
314 #ifdef FEAT_VIMINFO | |
315 # ifndef VIMINFO_FILE | |
316 # ifdef VMS | |
317 # define VIMINFO_FILE "sys$login:.viminfo" | |
318 # else | |
319 # define VIMINFO_FILE "$HOME/.viminfo" | |
320 # endif | |
321 # endif | |
322 # if !defined(VIMINFO_FILE2) && defined(VMS) | |
323 # define VIMINFO_FILE2 "sys$login:_viminfo" | |
324 # endif | |
325 #endif | |
326 | |
327 #ifndef EXRC_FILE | |
328 # define EXRC_FILE ".exrc" | |
329 #endif | |
330 | |
331 #ifndef VIMRC_FILE | |
332 # define VIMRC_FILE ".vimrc" | |
333 #endif | |
334 | |
335 #ifdef FEAT_GUI | |
336 # ifndef GVIMRC_FILE | |
337 # define GVIMRC_FILE ".gvimrc" | |
338 # endif | |
339 #endif | |
340 | |
341 #ifndef SYNTAX_FNAME | |
342 # define SYNTAX_FNAME "$VIMRUNTIME/syntax/%s.vim" | |
343 #endif | |
344 | |
345 #ifndef DFLT_BDIR | |
7408
1886f2863437
commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents:
6783
diff
changeset
|
346 # ifdef VMS |
1886f2863437
commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents:
6783
diff
changeset
|
347 # define DFLT_BDIR "./,sys$login:,tmp:" |
7 | 348 # else |
7408
1886f2863437
commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents:
6783
diff
changeset
|
349 # define DFLT_BDIR ".,~/tmp,~/" /* default for 'backupdir' */ |
7 | 350 # endif |
351 #endif | |
352 | |
353 #ifndef DFLT_DIR | |
7408
1886f2863437
commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents:
6783
diff
changeset
|
354 # ifdef VMS |
1886f2863437
commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents:
6783
diff
changeset
|
355 # define DFLT_DIR "./,sys$login:,tmp:" |
7 | 356 # else |
7408
1886f2863437
commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents:
6783
diff
changeset
|
357 # define DFLT_DIR ".,~/tmp,/var/tmp,/tmp" /* default for 'directory' */ |
7 | 358 # endif |
359 #endif | |
360 | |
361 #ifndef DFLT_VDIR | |
7408
1886f2863437
commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents:
6783
diff
changeset
|
362 # ifdef VMS |
1886f2863437
commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents:
6783
diff
changeset
|
363 # define DFLT_VDIR "sys$login:vimfiles/view" |
7 | 364 # else |
7408
1886f2863437
commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents:
6783
diff
changeset
|
365 # define DFLT_VDIR "$HOME/.vim/view" /* default for 'viewdir' */ |
7 | 366 # endif |
367 #endif | |
368 | |
369 #define DFLT_ERRORFILE "errors.err" | |
370 | |
7408
1886f2863437
commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents:
6783
diff
changeset
|
371 #ifdef VMS |
1886f2863437
commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents:
6783
diff
changeset
|
372 # define DFLT_RUNTIMEPATH "sys$login:vimfiles,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,sys$login:vimfiles/after" |
7 | 373 #else |
7408
1886f2863437
commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents:
6783
diff
changeset
|
374 # ifdef RUNTIME_GLOBAL |
1886f2863437
commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents:
6783
diff
changeset
|
375 # define DFLT_RUNTIMEPATH "~/.vim," RUNTIME_GLOBAL ",$VIMRUNTIME," RUNTIME_GLOBAL "/after,~/.vim/after" |
7 | 376 # else |
7408
1886f2863437
commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents:
6783
diff
changeset
|
377 # define DFLT_RUNTIMEPATH "~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.vim/after" |
7 | 378 # endif |
379 #endif | |
380 | |
7408
1886f2863437
commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents:
6783
diff
changeset
|
381 #ifdef VMS |
1886f2863437
commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents:
6783
diff
changeset
|
382 # ifndef VAX |
1886f2863437
commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents:
6783
diff
changeset
|
383 # define VMS_TEMPNAM /* to fix default .LIS extension */ |
1886f2863437
commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents:
6783
diff
changeset
|
384 # endif |
1886f2863437
commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents:
6783
diff
changeset
|
385 # define TEMPNAME "TMP:v?XXXXXX.txt" |
1886f2863437
commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents:
6783
diff
changeset
|
386 # define TEMPNAMELEN 28 |
7 | 387 #else |
7408
1886f2863437
commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents:
6783
diff
changeset
|
388 /* Try several directories to put the temp files. */ |
1886f2863437
commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents:
6783
diff
changeset
|
389 # define TEMPDIRNAMES "$TMPDIR", "/tmp", ".", "$HOME" |
1886f2863437
commit https://github.com/vim/vim/commit/e7fedb6ebe72d9a475aa65109b77d5ed4667067a
Christian Brabandt <cb@256bit.org>
parents:
6783
diff
changeset
|
390 # define TEMPNAMELEN 256 |
7 | 391 #endif |
392 | |
393 /* Special wildcards that need to be handled by the shell */ | |
394 #define SPECIAL_WILDCHAR "`'{" | |
395 | |
396 #ifndef HAVE_OPENDIR | |
397 # define NO_EXPANDPATH | |
398 #endif | |
399 | |
400 /* | |
401 * Unix has plenty of memory, use large buffers | |
402 */ | |
403 #define CMDBUFFSIZE 1024 /* size of the command processing buffer */ | |
1611 | 404 |
405 /* Use the system path length if it makes sense. */ | |
406 #if defined(PATH_MAX) && (PATH_MAX > 1000) | |
407 # define MAXPATHL PATH_MAX | |
408 #else | |
409 # define MAXPATHL 1024 | |
410 #endif | |
7 | 411 |
412 #define CHECK_INODE /* used when checking if a swap file already | |
413 exists for a file */ | |
414 #ifdef VMS /* Use less memory because of older systems */ | |
415 # ifndef DFLT_MAXMEM | |
416 # define DFLT_MAXMEM (2*1024) | |
417 # endif | |
418 # ifndef DFLT_MAXMEMTOT | |
419 # define DFLT_MAXMEMTOT (5*1024) | |
420 # endif | |
421 #else | |
422 # ifndef DFLT_MAXMEM | |
423 # define DFLT_MAXMEM (5*1024) /* use up to 5 Mbyte for a buffer */ | |
424 # endif | |
425 # ifndef DFLT_MAXMEMTOT | |
426 # define DFLT_MAXMEMTOT (10*1024) /* use up to 10 Mbyte for Vim */ | |
427 # endif | |
428 #endif | |
429 | |
430 /* memmove is not present on all systems, use memmove, bcopy, memcpy or our | |
431 * own version */ | |
432 /* Some systems have (void *) arguments, some (char *). If we use (char *) it | |
433 * works for all */ | |
434 #ifdef USEMEMMOVE | |
435 # define mch_memmove(to, from, len) memmove((char *)(to), (char *)(from), len) | |
436 #else | |
437 # ifdef USEBCOPY | |
438 # define mch_memmove(to, from, len) bcopy((char *)(from), (char *)(to), len) | |
439 # else | |
440 # ifdef USEMEMCPY | |
441 # define mch_memmove(to, from, len) memcpy((char *)(to), (char *)(from), len) | |
442 # else | |
443 # define VIM_MEMMOVE /* found in misc2.c */ | |
444 # endif | |
445 # endif | |
446 #endif | |
447 | |
448 #ifndef PROTO | |
449 # ifdef HAVE_RENAME | |
450 # define mch_rename(src, dst) rename(src, dst) | |
451 # else | |
7807
1a5d34492798
commit https://github.com/vim/vim/commit/d99df423c559d85c17779b3685426c489554908c
Christian Brabandt <cb@256bit.org>
parents:
7598
diff
changeset
|
452 int mch_rename(const char *src, const char *dest); |
7 | 453 # endif |
454 # ifndef VMS | |
455 # ifdef __MVS__ | |
1204 | 456 /* on OS390 Unix getenv() doesn't return a pointer to persistent |
7 | 457 * storage -> use __getenv() */ |
458 # define mch_getenv(x) (char_u *)__getenv((char *)(x)) | |
459 # else | |
460 # define mch_getenv(x) (char_u *)getenv((char *)(x)) | |
461 # endif | |
462 # define mch_setenv(name, val, x) setenv(name, val, x) | |
463 # endif | |
464 #endif | |
465 | |
466 #if !defined(S_ISDIR) && defined(S_IFDIR) | |
467 # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) | |
468 #endif | |
469 #if !defined(S_ISREG) && defined(S_IFREG) | |
470 # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) | |
471 #endif | |
472 #if !defined(S_ISBLK) && defined(S_IFBLK) | |
473 # define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) | |
474 #endif | |
475 #if !defined(S_ISSOCK) && defined(S_IFSOCK) | |
476 # define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) | |
477 #endif | |
478 #if !defined(S_ISFIFO) && defined(S_IFIFO) | |
479 # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) | |
480 #endif | |
1313 | 481 #if !defined(S_ISCHR) && defined(S_IFCHR) |
482 # define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) | |
483 #endif | |
7 | 484 |
485 /* Note: Some systems need both string.h and strings.h (Savage). However, | |
486 * some systems can't handle both, only use string.h in that case. */ | |
487 #ifdef HAVE_STRING_H | |
488 # include <string.h> | |
489 #endif | |
490 #if defined(HAVE_STRINGS_H) && !defined(NO_STRINGS_WITH_STRING_H) | |
491 # include <strings.h> | |
492 #endif | |
493 | |
494 #if defined(HAVE_SETJMP_H) | |
495 # include <setjmp.h> | |
496 # ifdef HAVE_SIGSETJMP | |
497 # define JMP_BUF sigjmp_buf | |
498 # define SETJMP(x) sigsetjmp((x), 1) | |
499 # define LONGJMP siglongjmp | |
500 # else | |
501 # define JMP_BUF jmp_buf | |
502 # define SETJMP(x) setjmp(x) | |
503 # define LONGJMP longjmp | |
504 # endif | |
505 #endif | |
506 | |
5743 | 507 #ifndef HAVE_DUP |
508 # define HAVE_DUP /* have dup() */ | |
509 #endif | |
7 | 510 #define HAVE_ST_MODE /* have stat.st_mode */ |
511 | |
512 /* We have three kinds of ACL support. */ | |
513 #define HAVE_ACL (HAVE_POSIX_ACL || HAVE_SOLARIS_ACL || HAVE_AIX_ACL) |