# HG changeset patch # User Richard M. Stallman # Date 830993133 0 # Node ID 4dc406e38d6861087e23535ababafe2da46e76c7 # Parent b2c682fcd3efad8fac01e7470c390293443a71e3 (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 -r b2c682fcd3ef -r 4dc406e38d68 src/msdos.c --- a/src/msdos.c Wed May 01 23:24:44 1996 +0000 +++ b/src/msdos.c Wed May 01 23:25:33 1996 +0000 @@ -32,8 +32,11 @@ #include #include #include +#include +#include /* for _fixpath */ #if __DJGPP__ >= 2 #include +#include /* for _USE_LFN */ #endif #include "dosfns.h" @@ -51,6 +54,10 @@ /* 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 @@ } } - 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 @@ int drive; char *dst; { - union REGS regs; - - *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; + char in_path[4], *p = in_path; + int e = errno; + + /* 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 @@ 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);