Re: command_line() bug in ex.exe 2.4
- Posted by Robert Craig <rds at RapidEuphoria.com> Nov 03, 2004
- 460 views
Juergen Luethje wrote: > I ran the following small test program on Windows 98: > }}} <eucode> > -- program 'cmd.ex' > constant CMD = command_line() > for i = 3 to length(CMD) do > puts(1, "-" & CMD[i] & "-\n") > end for > if getc(0) then end if > </eucode> {{{ > > a) When calling it like this: > exw.exe cmd.ex "c:\long dirname\" > it displays, as I expected: > -c:\long dirname\- > > b) But when calling it like this: > ex.exe cmd.ex "c:\long dirname\" > it displays: > -c:\long dirname"- > > It might look as if the backslash acts as an escape character here. > But I think this isn't true, because in that case the first backslash > should cause an error. Also, this should be consistent on all > supported platforms IMHO. > Calling > ex.exe cmd.ex "c:\long dirname\\" > displays > -c:\long dirname\"- > > In order to achieve the desired result, I have to omit the second > double quote character: > ex.exe cmd.ex "c:\long dirname\ > displays > -c:\long dirname\- > > Calling > ex.exe cmd.ex "c:\long dirname\" "d:\long dirname\" > displays > -c:\long dirname" - > -d:\long- > -dirname"- The DOS command line is not handled the way you would like, but I don't have control over that. I just take the command line arguments as the system provides them to me. (Same on Linux and FreeBSD). For Windows, I get the command line as one long string, and I have to break it up into separate arguments, taking quotes into account. If there was something wrong, I might be able to correct it. But apparently you like the way exw does things. I don't necessarily agree that Euphoria's command line arguments must be completely consistent across all platforms. The O/S and the command shell can process the command line before the program sees it. Even between DOS and Windows, I think there may be subtle differences beyond what you've observed. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com