From: Richard M. Stallman Date: Wed, 1 May 1996 23:25:33 +0000 (+0000) Subject: (dos_get_modifiers): Restore missing comment terminator. X-Git-Tag: emacs-19.34~737 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d21e67b565e6e54926856933ebf925aa7e476265;p=emacs.git (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'. --- 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. */ #include #include #include +#include +#include /* for _fixpath */ #if __DJGPP__ >= 2 #include +#include /* for _USE_LFN */ #endif #include "dosfns.h" @@ -51,6 +54,10 @@ Boston, MA 02111-1307, USA. */ /* Damn that local process.h! Instead we can define P_WAIT ourselves. */ #define P_WAIT 1 +#ifndef _USE_LFN +#define _USE_LFN 0 +#endif + #if __DJGPP__ > 1 #include @@ -1316,7 +1323,7 @@ dos_get_modifiers (keymask) } } - if (regs.h.ah & 1) /* Left CTRL pressed + if (regs.h.ah & 1) /* Left CTRL pressed ? */ mask |= CTRL_P; if (regs.h.ah & 4) /* Right CTRL pressed ? */ @@ -2089,23 +2096,31 @@ getdefdir (drive, dst) int drive; char *dst; { - union REGS regs; + char in_path[4], *p = in_path; + int e = errno; - *dst++ = (drive) ? drive + 'A' - 1 : getdisk () + 'A'; - *dst++ = ':' - *dst++ = '/'; - regs.h.dl = drive; -#if __DJGPP__ > 1 - /* regs.x.si can be 16 or 32 bits, depending on whether _NAIVE_DOS_REGS - or _BORLAND_DOS_REGS have or haven't been defined. We should work - with either, so use regs.d.esi which is always 32 bit-wide. */ - regs.d.esi = (int) dst; -#else - regs.x.si = (int) dst; -#endif - regs.h.ah = 0x47; - intdos (®s, ®s); - return !regs.x.cflag; + /* Generate "X:." (when drive is X) or "." (when drive is 0). */ + if (drive != 0) + { + *p++ = drive + 'A' - 1; + *p++ = ':'; + } + + *p++ = '.'; + *p = '\0'; + errno = 0; + _fixpath (in_path, dst); + if (errno) + return 0; + + /* Under LFN we expect to get pathnames in their true case. */ + if (! (_USE_LFN)) + for (p = dst; *p; p++) + if (*p >= 'A' && *p <= 'Z') + *p += 'a' - 'A'; + + errno = e; + return 1; } /* Remove all CR's that are followed by a LF. */ @@ -2586,6 +2601,25 @@ run_msdos_command (argv, dir, tempin, tempout, temperr) dup2 (tempout, 1); dup2 (temperr, 2); +#if __DJGPP__ > 1 + + if (msshell && !argv[3]) + { + /* MS-DOS native shells are too restrictive. For starters, they + cannot grok commands longer than 126 characters. In DJGPP v2 + and later, `system' is much smarter, so we'll call it instead. */ + + extern char **environ; + environ = envv; + + /* A shell gets a single argument--its full command + line--whose original was saved in `saveargv2'. */ + result = system (saveargv2); + } + else + +#endif /* __DJGPP__ > 1 */ + result = spawnve (P_WAIT, argv[0], argv, envv); dup2 (inbak, 0);