www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 845] New: dmd -run does not correctly pass command line arguments


           Summary: dmd -run does not correctly pass command line arguments
           Product: D
           Version: 1.00
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: lio lunesu.com

The following test cases:
%1 "2nd\" 3rd
%1 2nd\" 3rd
%1 "2nd\"" 3rd
%1 2nd\"" 3rd
%1 "2nd\""" 3rd

result in different arguments passed to main:
import std.stdio;
void main(char[]args[]) {
  foreach(a;args[1..$]) writefln(a); }

Results, commas used as new-line:

dmd -run:
2 args: 2nd,3rd
1 arg: 2nd 3rd
1 arg: 2nd 3rd
2 args: 2nd,3rd
2 args: 2nd,3rd
(notice how all quotes are gone)

First dmd, then run:
1 arg: 2nd" 3rd
2 args: 2nd",3rd
2 args: 2nd",3rd
1 arg: 2nd" 3rd
1 arg: 2nd" 3rd

For the record, the last test case
%1 "2nd\""" 3rd
results in different arguments for dmd(dmc) and msvc7 and msvc8.
dmd/dmc, 1 arg: 2nd" 3rd
msvc7, 2 args: 2nd"",3rd
msvc8, 1 arg: 2nd"" 3rd

Jan 13 2007