Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 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 | * MSDOS Machine-dependent things. |
| 11 | */ |
| 12 | |
| 13 | #include "os_dos.h" /* common MS-DOS and Win32 stuff */ |
| 14 | |
| 15 | #define BINARY_FILE_IO |
| 16 | #define USE_EXE_NAME /* use argv[0] for $VIM */ |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 17 | #define SYNC_DUP_CLOSE /* sync() a file with dup() and close() */ |
| 18 | #define USE_TERM_CONSOLE |
| 19 | #ifdef DJGPP |
| 20 | # include <fcntl.h> /* defines _USE_LFN */ |
| 21 | # define USE_LONG_FNAME _USE_LFN /* decide at run time */ |
| 22 | # define USE_FNAME_CASE |
| 23 | # define HAVE_PUTENV |
Bram Moolenaar | c01140a | 2006-03-24 22:21:52 +0000 | [diff] [blame] | 24 | # define HAVE_STDARG_H |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 25 | #else |
| 26 | # define SHORT_FNAME /* always 8.3 file name */ |
| 27 | #endif |
| 28 | #define HAVE_STDLIB_H |
| 29 | #define HAVE_STRING_H |
| 30 | #define HAVE_FCNTL_H |
| 31 | #define HAVE_STRCSPN |
| 32 | #define HAVE_STRICMP |
| 33 | #define HAVE_STRFTIME /* guessed */ |
| 34 | #define HAVE_STRNICMP |
| 35 | #define HAVE_MEMSET |
| 36 | #define HAVE_QSORT |
| 37 | #define HAVE_ST_MODE /* have stat.st_mode */ |
Bram Moolenaar | 446cb83 | 2008-06-24 21:56:24 +0000 | [diff] [blame] | 38 | #define HAVE_MATH_H |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 39 | #if defined(__DATE__) && defined(__TIME__) |
| 40 | # define HAVE_DATE_TIME |
| 41 | #endif |
| 42 | #define BREAKCHECK_SKIP 1 /* call mch_breakcheck() each time, it's fast */ |
| 43 | #define HAVE_AVAIL_MEM |
| 44 | |
| 45 | /* |
| 46 | * Borland C++ 3.1 doesn't have _RTLENTRYF |
| 47 | */ |
| 48 | #ifdef __BORLANDC__ |
| 49 | # if __BORLANDC__ < 0x450 |
| 50 | # define _RTLENTRYF |
| 51 | # endif |
| 52 | #endif |
| 53 | |
| 54 | #define FNAME_ILLEGAL "\"*?><|" /* illegal characters in a file name */ |
| 55 | |
Bram Moolenaar | 8288149 | 2012-11-20 16:53:39 +0100 | [diff] [blame] | 56 | /* cproto fails on missing include files */ |
| 57 | #ifndef PROTO |
| 58 | # include <dos.h> |
| 59 | # include <dir.h> |
| 60 | # include <time.h> |
| 61 | #endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 62 | |
| 63 | #ifdef DJGPP |
| 64 | # include <unistd.h> |
| 65 | # define HAVE_LOCALE_H |
| 66 | # define setlocale(c, p) djgpp_setlocale() |
| 67 | #endif |
| 68 | |
| 69 | #ifndef DJGPP |
| 70 | typedef long off_t; |
| 71 | #endif |
| 72 | |
| 73 | /* |
| 74 | * Try several directories to put the temp files. |
| 75 | */ |
| 76 | #define TEMPDIRNAMES "$TMP", "$TEMP", "c:\\TMP", "c:\\TEMP", "" |
| 77 | #define TEMPNAMELEN 128 |
| 78 | |
| 79 | #ifndef DFLT_MAXMEM |
| 80 | # define DFLT_MAXMEM 256 /* use up to 256Kbyte for buffer */ |
| 81 | #endif |
| 82 | #ifndef DFLT_MAXMEMTOT |
| 83 | # define DFLT_MAXMEMTOT 0 /* decide in set_init */ |
| 84 | #endif |
| 85 | |
| 86 | #ifdef DJGPP |
| 87 | # define BASENAMELEN (_USE_LFN?250:8) /* length of base of file name */ |
| 88 | #else |
| 89 | # define BASENAMELEN 8 /* length of base of file name */ |
| 90 | #endif |
| 91 | |
| 92 | /* codes for msdos mouse event */ |
| 93 | #define MSDOS_MOUSE_LEFT 0x01 |
| 94 | #define MSDOS_MOUSE_RIGHT 0x02 |
| 95 | #define MSDOS_MOUSE_MIDDLE 0x04 |
| 96 | |
| 97 | #ifdef DJGPP |
| 98 | int mch_rename(const char *OldFile, const char *NewFile); |
| 99 | #else |
| 100 | # define mch_rename(src, dst) rename(src, dst) |
| 101 | #endif |
| 102 | |
| 103 | #ifdef DJGPP |
| 104 | # define vim_mkdir(x, y) mkdir((char *)(x), y) |
| 105 | #else |
| 106 | # define vim_mkdir(x, y) mkdir((char *)(x)) |
| 107 | #endif |
| 108 | #define mch_rmdir(x) rmdir((char *)(x)) |
| 109 | |
| 110 | #define mch_setenv(name, val, x) setenv(name, val, x) |