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