Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] command line parsing

Since no one cares, I did windows parsing in "cmd" (windows xp) style and unix parsing in "shell" (sh) style.

Examples:
args         win          unix

/a/b/c d    [/a/b/c][d]   [/a/b/c][d]
\a\b\c d    [\a\b\c][d]   [abc][d]
\a\b\c d    [\a\b\c][d]   [abc][d]
"\a\b\c"    [\a\b\c]      [\a\b\c]
"a b"       [a b]         [a b]
'"q"'       ['q']         ["q"]
\"a\"       ["a"]         ["a"]  Note: even quotes are passed to spawner - windows spawner removes them, maybe need double escape in this case

Due to API restrictions variable substitution happens _before_ arg splitting, so if project location has spaces it has to be double quoted, i.e.

${project_loc}/path  [C:/workspace/project][a/path]
"${project_loc}/path"  [C:/worskapce/project a/path]


Elena Laskavaia wrote:
In CDT we have couple places where we have to parse command line arguments,
make commands args and launch command args.
Pre-5.0 it was very inconsistent and broken (the way quotes, spaces and other non-trivial case were parsed). I fixed it 5.0.2 and now it consistent and work as unix "shell" command line parsing works. With one problem. Windows. On windows "\" can be used in path names and therefore cannot be used as escape character. I forgot about that. So we have a dilemma - do we use 2 different way of escaping command line on windows and linux, or use linux one - but with complications on windows (i.e user would have to use \\ to escape \ or unquote this) or come up with some 3rd schema which would cover both (which I am not aware of now).

original bug
https://bugs.eclipse.org/bugs/show_bug.cgi?id=241072

windows \ expansions bug
https://bugs.eclipse.org/bugs/show_bug.cgi?id=263924
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev


Back to the top