Re: command_line() bug in ex.exe 2.4

new topic     » goto parent     » topic index » view thread      » older message » newer message

Bernie Ryan wrote:

<snip>

> Here are the rules that microsoft uses to parse the command.
>  
>   http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccelng/htm/progs_12.asp

That's interesting, thanks.

I would not like that those rules apply to the command line parsing of
ex.exe though ...

a) because it's different from standard Euphoria rules:
   In Euphoria, a backslash in a literal string is always an escape
   character, not only when it preceds a double quotation mark or other
   backslashes which preced a double quotation mark.
   It doesn't make much sense to have C rules in Euphoria.

b) because Euphoria should behave as similar as possible on all
   supported platforms.


However, the rules at the web page mentioned above make sense to me,
e.g.:
"If an even number of backslashes is followed by a double quotation mark,
then one backslash (\) is placed in the argv array for every pair of
backslashes (\\), and the double quotation mark (") is interpreted as a
string delimiter."

Unfortunately, this is *not* the way ex.exe parses the command line.
Trying the examples from the above MS page with ex.exe, we'll already
see some differences:

-- program 'args.ex'
constant CMD = command_line()
for i = 3 to length(CMD) do
   puts(1, "\t" & CMD[i])
end for
puts(1, "\n")


------------------------------
@echo off
rem -- program 'args_test.bat'
ex args.ex "a b c" d e
ex args.ex "ab\"c" "\\" d
ex args.ex a\\\b d"e f"g h
ex args.ex a\\\"b c d
ex args.ex a\\\\"b c" d e
------------------------------

Regards,
   Juergen

-- 
 /"\  ASCII ribbon campain  |    |\      _,,,---,,_
 \ /  against HTML in       |    /,`.-'`'    -.  ;-;;,_
  X   e-mail and news,      |   |,4-  ) )-,_..;\ (  `'-'
 / \  and unneeded MIME     |  '---''(_/--'  `-'\_)

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu