1 /* vi:set ts=8 sts=4 sw=4:
3 * VIM - Vi IMproved by Bram Moolenaar
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.
10 * NextStep has a problem with configure, undefine a few things:
16 # ifdef HAVE_SYS_UTSNAME_H
17 # undef HAVE_SYS_UTSNAME_H
28 # include <sys/types.h>
29 # include <sys/stat.h>
37 # define HAVE_TOTAL_MEM
40 #if defined(__CYGWIN__) || defined(__CYGWIN32__)
41 # define WIN32UNIX /* Compiling for Win32 using Unix files. */
42 # define BINARY_FILE_IO
44 # define CASE_INSENSITIVE_FILENAME
45 # define USE_FNAME_CASE /* Fix filename case differences. */
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)
56 # ifndef S_SPLINT_S /* splint crashes on bits/confname.h */
62 # include <libc.h> /* for NeXT */
65 #ifdef HAVE_SYS_PARAM_H
66 # include <sys/param.h> /* defines BSD, if it's a BSD system */
70 * Sun defines FILE on SunOS 4.x.x, Solaris has a typedef for FILE
72 #if defined(sun) && !defined(FILE)
77 * Using getcwd() is preferred, because it checks for a buffer overflow.
78 * Don't use getcwd() on systems do use system("sh -c pwd"). There is an
79 * autoconf check for this.
80 * Use getcwd() anyway if getwd() isn't present.
82 #if defined(HAVE_GETCWD) && !(defined(BAD_GETCWD) && defined(HAVE_GETWD))
87 /* The AIX VisualAge cc compiler defines __EXTENDED__ instead of __STDC__
88 * because it includes pre-ansi features. */
89 # if defined(__STDC__) || defined(__GNUC__) || defined(__EXTENDED__)
96 /* always use unlink() to remove files */
99 # define mch_remove(x) delete((char *)(x))
100 # define vim_mkdir(x, y) mkdir((char *)(x), y)
103 # define mch_rmdir(x) rmdir((char *)(x))
106 # define vim_mkdir(x, y) mkdir((char *)(x), y)
107 # define mch_rmdir(x) rmdir((char *)(x))
108 # define mch_remove(x) unlink((char *)(x))
112 /* The number of arguments to a signal handler is configured here. */
113 /* It used to be a long list of almost all systems. Any system that doesn't
114 * have an argument??? */
117 /* List 3 arg systems here. I guess __sgi, please test and correct me. jw. */
118 #if defined(__sgi) && defined(HAVE_SIGCONTEXT)
124 # define SIGPROTOARG (int, int, struct sigcontext *)
125 # define SIGDEFARG(s) (s, sig2, scont) int s, sig2; struct sigcontext *scont;
126 # define SIGDUMMYARG 0, 0, (struct sigcontext *)0
128 # define SIGPROTOARG (int)
129 # define SIGDEFARG(s) (s) int s;
130 # define SIGDUMMYARG 0
133 # define SIGPROTOARG (void)
134 # define SIGDEFARG(s) ()
141 # define NAMLEN(dirent) strlen((dirent)->d_name)
144 # define dirent direct
145 # define NAMLEN(dirent) (dirent)->d_namlen
147 # include <sys/ndir.h>
150 # include <sys/dir.h>
157 #if !defined(HAVE_SYS_TIME_H) || defined(TIME_WITH_SYS_TIME)
158 # include <time.h> /* on some systems time.h should not be
159 included together with sys/time.h */
161 #ifdef HAVE_SYS_TIME_H
162 # include <sys/time.h>
167 #if defined(DIRSIZ) && !defined(MAXNAMLEN)
168 # define MAXNAMLEN DIRSIZ
171 #if defined(UFS_MAXNAMLEN) && !defined(MAXNAMLEN)
172 # define MAXNAMLEN UFS_MAXNAMLEN /* for dynix/ptx */
175 #if defined(NAME_MAX) && !defined(MAXNAMLEN)
176 # define MAXNAMLEN NAME_MAX /* for Linux before .99p3 */
180 * Note: if MAXNAMLEN has the wrong value, you will get error messages
181 * for not being able to open the swap file.
183 #if !defined(MAXNAMLEN)
184 # define MAXNAMLEN 512 /* for all other Unix */
187 #define BASENAMELEN (MAXNAMLEN - 5)
201 #if (defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_GETRLIMIT)) \
202 || (defined(HAVE_SYS_SYSINFO_H) && defined(HAVE_SYSINFO)) \
203 || defined(HAVE_SYSCTL) || defined(HAVE_SYSCONF)
204 # define HAVE_TOTAL_MEM
209 # include <unixlib.h>
213 # include <descrip.h>
214 # include <libclidef.h>
228 # include <starlet.h>
230 # include <lib$routines.h>
233 # include "gui_gtk_vms.h"
236 typedef struct dsc$descriptor DESC
;
240 * Unix system-dependent file names
242 #ifndef SYS_VIMRC_FILE
243 # define SYS_VIMRC_FILE "$VIM/vimrc"
245 #ifndef SYS_GVIMRC_FILE
246 # define SYS_GVIMRC_FILE "$VIM/gvimrc"
248 #ifndef DFLT_HELPFILE
249 # define DFLT_HELPFILE "$VIMRUNTIME/doc/help.txt"
251 #ifndef FILETYPE_FILE
252 # define FILETYPE_FILE "filetype.vim"
254 #ifndef FTPLUGIN_FILE
255 # define FTPLUGIN_FILE "ftplugin.vim"
258 # define INDENT_FILE "indent.vim"
261 # define FTOFF_FILE "ftoff.vim"
263 #ifndef FTPLUGOF_FILE
264 # define FTPLUGOF_FILE "ftplugof.vim"
267 # define INDOFF_FILE "indoff.vim"
269 #ifndef SYS_MENU_FILE
270 # define SYS_MENU_FILE "$VIMRUNTIME/menu.vim"
273 #ifndef USR_EXRC_FILE
275 # define USR_EXRC_FILE "sys$login:.exrc"
277 # define USR_EXRC_FILE "$HOME/.exrc"
281 #if !defined(USR_EXRC_FILE2) && defined(OS2)
282 # define USR_EXRC_FILE2 "$VIM/.exrc"
284 #if !defined(USR_EXRC_FILE2) && defined(VMS)
285 # define USR_EXRC_FILE2 "sys$login:_exrc"
288 #ifndef USR_VIMRC_FILE
290 # define USR_VIMRC_FILE "sys$login:.vimrc"
292 # define USR_VIMRC_FILE "$HOME/.vimrc"
296 #if !defined(USR_VIMRC_FILE2) && defined(OS2)
297 # define USR_VIMRC_FILE2 "$VIM/.vimrc"
299 #if !defined(USR_VIMRC_FILE2) && defined(VMS)
300 # define USR_VIMRC_FILE2 "sys$login:_vimrc"
303 #ifndef USR_GVIMRC_FILE
305 # define USR_GVIMRC_FILE "sys$login:.gvimrc"
307 # define USR_GVIMRC_FILE "$HOME/.gvimrc"
312 # ifndef USR_GVIMRC_FILE2
313 # define USR_GVIMRC_FILE2 "sys$login:_gvimrc"
318 # define EVIM_FILE "$VIMRUNTIME/evim.vim"
322 # ifndef VIMINFO_FILE
324 # define VIMINFO_FILE "sys$login:.viminfo"
326 # define VIMINFO_FILE "$HOME/.viminfo"
329 # if !defined(VIMINFO_FILE2) && defined(OS2)
330 # define VIMINFO_FILE2 "$VIM/.viminfo"
332 # if !defined(VIMINFO_FILE2) && defined(VMS)
333 # define VIMINFO_FILE2 "sys$login:_viminfo"
338 # define EXRC_FILE ".exrc"
342 # define VIMRC_FILE ".vimrc"
347 # define GVIMRC_FILE ".gvimrc"
352 # define SYNTAX_FNAME "$VIMRUNTIME/syntax/%s.vim"
357 # define DFLT_BDIR ".,c:/tmp,~/tmp,~/"
360 # define DFLT_BDIR "./,sys$login:,tmp:"
362 # define DFLT_BDIR ".,~/tmp,~/" /* default for 'backupdir' */
369 # define DFLT_DIR ".,~/tmp,c:/tmp,/tmp"
372 # define DFLT_DIR "./,sys$login:,tmp:"
374 # define DFLT_DIR ".,~/tmp,/var/tmp,/tmp" /* default for 'directory' */
381 # define DFLT_VDIR "$VIM/vimfiles/view"
384 # define DFLT_VDIR "sys$login:vimfiles/view"
386 # define DFLT_VDIR "$HOME/.vim/view" /* default for 'viewdir' */
391 #define DFLT_ERRORFILE "errors.err"
394 # define DFLT_RUNTIMEPATH "$HOME/vimfiles,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/vimfiles/after"
397 # define DFLT_RUNTIMEPATH "sys$login:vimfiles,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,sys$login:vimfiles/after"
399 # ifdef RUNTIME_GLOBAL
400 # define DFLT_RUNTIMEPATH "~/.vim," RUNTIME_GLOBAL ",$VIMRUNTIME," RUNTIME_GLOBAL "/after,~/.vim/after"
402 # define DFLT_RUNTIMEPATH "~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.vim/after"
409 * Try several directories to put the temp files.
411 # define TEMPDIRNAMES "$TMP", "$TEMP", "c:\\TMP", "c:\\TEMP", ""
412 # define TEMPNAMELEN 128
416 # define VMS_TEMPNAM /* to fix default .LIS extension */
418 # define TEMPNAME "TMP:v?XXXXXX.txt"
419 # define TEMPNAMELEN 28
421 # define TEMPDIRNAMES "$TMPDIR", "/tmp", ".", "$HOME"
422 # define TEMPNAMELEN 256
426 /* Special wildcards that need to be handled by the shell */
427 #define SPECIAL_WILDCHAR "`'{"
430 # define NO_EXPANDPATH
434 * Unix has plenty of memory, use large buffers
436 #define CMDBUFFSIZE 1024 /* size of the command processing buffer */
438 /* Use the system path length if it makes sense. */
439 #if defined(PATH_MAX) && (PATH_MAX > 1000)
440 # define MAXPATHL PATH_MAX
442 # define MAXPATHL 1024
445 #define CHECK_INODE /* used when checking if a swap file already
447 #ifdef VMS /* Use less memory because of older systems */
449 # define DFLT_MAXMEM (2*1024)
451 # ifndef DFLT_MAXMEMTOT
452 # define DFLT_MAXMEMTOT (5*1024)
456 # define DFLT_MAXMEM (5*1024) /* use up to 5 Mbyte for a buffer */
458 # ifndef DFLT_MAXMEMTOT
459 # define DFLT_MAXMEMTOT (10*1024) /* use up to 10 Mbyte for Vim */
463 /* memmove is not present on all systems, use memmove, bcopy, memcpy or our
465 /* Some systems have (void *) arguments, some (char *). If we use (char *) it
468 # define mch_memmove(to, from, len) memmove((char *)(to), (char *)(from), len)
471 # define mch_memmove(to, from, len) bcopy((char *)(from), (char *)(to), len)
474 # define mch_memmove(to, from, len) memcpy((char *)(to), (char *)(from), len)
476 # define VIM_MEMMOVE /* found in misc2.c */
483 # define mch_rename(src, dst) rename(src, dst)
485 int mch_rename
__ARGS((const char *src
, const char *dest
));
488 # define mch_chdir(s) chdir(vms_fixfilename(s))
490 # define mch_chdir(s) chdir(s)
494 /* on OS390 Unix getenv() doesn't return a pointer to persistent
495 * storage -> use __getenv() */
496 # define mch_getenv(x) (char_u *)__getenv((char *)(x))
498 # define mch_getenv(x) (char_u *)getenv((char *)(x))
500 # define mch_setenv(name, val, x) setenv(name, val, x)
504 #if !defined(S_ISDIR) && defined(S_IFDIR)
505 # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
507 #if !defined(S_ISREG) && defined(S_IFREG)
508 # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
510 #if !defined(S_ISBLK) && defined(S_IFBLK)
511 # define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
513 #if !defined(S_ISSOCK) && defined(S_IFSOCK)
514 # define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
516 #if !defined(S_ISFIFO) && defined(S_IFIFO)
517 # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
519 #if !defined(S_ISCHR) && defined(S_IFCHR)
520 # define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
523 /* Note: Some systems need both string.h and strings.h (Savage). However,
524 * some systems can't handle both, only use string.h in that case. */
528 #if defined(HAVE_STRINGS_H) && !defined(NO_STRINGS_WITH_STRING_H)
529 # include <strings.h>
532 #if defined(HAVE_SETJMP_H)
534 # ifdef HAVE_SIGSETJMP
535 # define JMP_BUF sigjmp_buf
536 # define SETJMP(x) sigsetjmp((x), 1)
537 # define LONGJMP siglongjmp
539 # define JMP_BUF jmp_buf
540 # define SETJMP(x) setjmp(x)
541 # define LONGJMP longjmp
545 #define HAVE_DUP /* have dup() */
546 #define HAVE_ST_MODE /* have stat.st_mode */
548 /* We have three kinds of ACL support. */
549 #define HAVE_ACL (HAVE_POSIX_ACL || HAVE_SOLARIS_ACL || HAVE_AIX_ACL)