Mail Archives: djgpp-workers/1999/09/09/03:50:45
On Wed, 8 Sep 1999, Mark E. wrote:
> This is the second version of the patch that enables use of long command
> lines with Win32 and 4DOS. This version detects PE-COFF Win32 executables,
> and the 4DOS shell and it tries to detect a long cmdline capable of
> command.com.
Again, just from looking at the sources.
> ! else
> ! {
> ! /* Command line is in the environment variable CMDLINE. */
> ! char stop_token;
> !
> ! /* Skip over the name of the program. */
> ! if ((*cmdline == '\"') || (*cmdline == '\''))
> ! stop_token = *cmdline;
> ! else
> ! stop_token = ' ';
> !
> ! while (*cmdline != stop_token)
> ! ++cmdline;
What about a program name that includes an (escaped) apostrophe, like
'foo\'bar.exe'? We don't need to worry about the double quote, since
Windows doesn't allow it in file names, but the apostrophe is a valid
file-name character.
Also, the program name can be given as "foo""bar", which Windows groks
(correctly) as simply foobar.
So perhaps it is safer to call `parse_arg' to skip the command name,
since it should already handle all these cases (and if not, it can be
fixed).
> + while (*p)
> + {
> + if (*p == '"' && (quoted || need_quote))
> + *argp++ = '\\';
I have seen in the latest sources of GNU Make a comment and a code
fragment which indicate that the Cygwin port of Bash quotes `"' with
another `"', not with a backslash. Can someone confirm that? If it's
true, then the above will need some changes (but I don't know how to
fix that unless we assume that any PE executable whose name is a Unixy
shell, is a Cygwin-compiled program).
> + /* Most non-DJGPP programs don't treat `\'' specially,
> + but our `system' requires we always escape it, so
> + we should undo the quoting here. */
> + else if (*p == '\\' && p[1] == '\'' && unescape_quote)
> + p++;
Is the above true for Cygwin startup code?
> ! if ((stricmp (base, "command.com") == 0) && (_osmajor >= 7))
I think _osmajor >= 7 is too dangerous; OS/2 returns 10 (decimal) and
20.x, and I don't know what does it return as the _os_flavor. Maybe
make that _osmajor >= 7 && _osmajor < 10 or something.
> ! if ((stricmp(base, "command.com") == 0) && (_osmajor >= 7)
> ! && (stricmp(_os_flavor, "ms-dos") == 0))
> ! cmd_tail_limit = (unsigned int)(-1); /* No limit for MSDOS 7. */
Same here.
- Raw text -