diff options
| author | Richard M. Stallman | 1996-05-01 23:25:33 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-05-01 23:25:33 +0000 |
| commit | d21e67b565e6e54926856933ebf925aa7e476265 (patch) | |
| tree | b73930a03ad841c262a7bce5b4e9a464098528df /src | |
| parent | 34097368e87b3cd365c63771c72ff833333161c4 (diff) | |
| download | emacs-d21e67b565e6e54926856933ebf925aa7e476265.tar.gz emacs-d21e67b565e6e54926856933ebf925aa7e476265.zip | |
(dos_get_modifiers): Restore missing comment terminator.
(getdefdir): Rewrite to call `_fixpath' instead of `intdos'.
(run_msdos_command) [DJGPP > 1]: Work around some MSDOS
command-line restrictions by running shell commands via `system'
instead of `spawnve'.
Diffstat (limited to 'src')
| -rw-r--r-- | src/msdos.c | 68 |
1 files changed, 51 insertions, 17 deletions
diff --git a/src/msdos.c b/src/msdos.c index e7df9b13f1f..60cd73ae0ca 100644 --- a/src/msdos.c +++ b/src/msdos.c | |||
| @@ -32,8 +32,11 @@ Boston, MA 02111-1307, USA. */ | |||
| 32 | #include <sys/param.h> | 32 | #include <sys/param.h> |
| 33 | #include <sys/time.h> | 33 | #include <sys/time.h> |
| 34 | #include <dos.h> | 34 | #include <dos.h> |
| 35 | #include <errno.h> | ||
| 36 | #include <sys/stat.h> /* for _fixpath */ | ||
| 35 | #if __DJGPP__ >= 2 | 37 | #if __DJGPP__ >= 2 |
| 36 | #include <fcntl.h> | 38 | #include <fcntl.h> |
| 39 | #include <libc/dosio.h> /* for _USE_LFN */ | ||
| 37 | #endif | 40 | #endif |
| 38 | 41 | ||
| 39 | #include "dosfns.h" | 42 | #include "dosfns.h" |
| @@ -51,6 +54,10 @@ Boston, MA 02111-1307, USA. */ | |||
| 51 | /* Damn that local process.h! Instead we can define P_WAIT ourselves. */ | 54 | /* Damn that local process.h! Instead we can define P_WAIT ourselves. */ |
| 52 | #define P_WAIT 1 | 55 | #define P_WAIT 1 |
| 53 | 56 | ||
| 57 | #ifndef _USE_LFN | ||
| 58 | #define _USE_LFN 0 | ||
| 59 | #endif | ||
| 60 | |||
| 54 | #if __DJGPP__ > 1 | 61 | #if __DJGPP__ > 1 |
| 55 | 62 | ||
| 56 | #include <signal.h> | 63 | #include <signal.h> |
| @@ -1316,7 +1323,7 @@ dos_get_modifiers (keymask) | |||
| 1316 | } | 1323 | } |
| 1317 | } | 1324 | } |
| 1318 | 1325 | ||
| 1319 | if (regs.h.ah & 1) /* Left CTRL pressed | 1326 | if (regs.h.ah & 1) /* Left CTRL pressed ? */ |
| 1320 | mask |= CTRL_P; | 1327 | mask |= CTRL_P; |
| 1321 | 1328 | ||
| 1322 | if (regs.h.ah & 4) /* Right CTRL pressed ? */ | 1329 | if (regs.h.ah & 4) /* Right CTRL pressed ? */ |
| @@ -2089,23 +2096,31 @@ getdefdir (drive, dst) | |||
| 2089 | int drive; | 2096 | int drive; |
| 2090 | char *dst; | 2097 | char *dst; |
| 2091 | { | 2098 | { |
| 2092 | union REGS regs; | 2099 | char in_path[4], *p = in_path; |
| 2100 | int e = errno; | ||
| 2093 | 2101 | ||
| 2094 | *dst++ = (drive) ? drive + 'A' - 1 : getdisk () + 'A'; | 2102 | /* Generate "X:." (when drive is X) or "." (when drive is 0). */ |
| 2095 | *dst++ = ':' | 2103 | if (drive != 0) |
| 2096 | *dst++ = '/'; | 2104 | { |
| 2097 | regs.h.dl = drive; | 2105 | *p++ = drive + 'A' - 1; |
| 2098 | #if __DJGPP__ > 1 | 2106 | *p++ = ':'; |
| 2099 | /* regs.x.si can be 16 or 32 bits, depending on whether _NAIVE_DOS_REGS | 2107 | } |
| 2100 | or _BORLAND_DOS_REGS have or haven't been defined. We should work | 2108 | |
| 2101 | with either, so use regs.d.esi which is always 32 bit-wide. */ | 2109 | *p++ = '.'; |
| 2102 | regs.d.esi = (int) dst; | 2110 | *p = '\0'; |
| 2103 | #else | 2111 | errno = 0; |
| 2104 | regs.x.si = (int) dst; | 2112 | _fixpath (in_path, dst); |
| 2105 | #endif | 2113 | if (errno) |
| 2106 | regs.h.ah = 0x47; | 2114 | return 0; |
| 2107 | intdos (®s, ®s); | 2115 | |
| 2108 | return !regs.x.cflag; | 2116 | /* Under LFN we expect to get pathnames in their true case. */ |
| 2117 | if (! (_USE_LFN)) | ||
| 2118 | for (p = dst; *p; p++) | ||
| 2119 | if (*p >= 'A' && *p <= 'Z') | ||
| 2120 | *p += 'a' - 'A'; | ||
| 2121 | |||
| 2122 | errno = e; | ||
| 2123 | return 1; | ||
| 2109 | } | 2124 | } |
| 2110 | 2125 | ||
| 2111 | /* Remove all CR's that are followed by a LF. */ | 2126 | /* Remove all CR's that are followed by a LF. */ |
| @@ -2586,6 +2601,25 @@ run_msdos_command (argv, dir, tempin, tempout, temperr) | |||
| 2586 | dup2 (tempout, 1); | 2601 | dup2 (tempout, 1); |
| 2587 | dup2 (temperr, 2); | 2602 | dup2 (temperr, 2); |
| 2588 | 2603 | ||
| 2604 | #if __DJGPP__ > 1 | ||
| 2605 | |||
| 2606 | if (msshell && !argv[3]) | ||
| 2607 | { | ||
| 2608 | /* MS-DOS native shells are too restrictive. For starters, they | ||
| 2609 | cannot grok commands longer than 126 characters. In DJGPP v2 | ||
| 2610 | and later, `system' is much smarter, so we'll call it instead. */ | ||
| 2611 | |||
| 2612 | extern char **environ; | ||
| 2613 | environ = envv; | ||
| 2614 | |||
| 2615 | /* A shell gets a single argument--its full command | ||
| 2616 | line--whose original was saved in `saveargv2'. */ | ||
| 2617 | result = system (saveargv2); | ||
| 2618 | } | ||
| 2619 | else | ||
| 2620 | |||
| 2621 | #endif /* __DJGPP__ > 1 */ | ||
| 2622 | |||
| 2589 | result = spawnve (P_WAIT, argv[0], argv, envv); | 2623 | result = spawnve (P_WAIT, argv[0], argv, envv); |
| 2590 | 2624 | ||
| 2591 | dup2 (inbak, 0); | 2625 | dup2 (inbak, 0); |