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