Thread overview
[Issue 9344] New: A program takes a console comand as an argument.
Jan 18, 2013
yolkati@gmail.com
Jan 18, 2013
Kenji Hara
Jan 18, 2013
Iain Buclaw
Jan 18, 2013
Andrej Mitrovic
January 18, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9344

           Summary: A program takes a console comand as an argument.
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: yolkati@gmail.com


--- Comment #0 from yolkati@gmail.com 2013-01-17 22:50:53 PST ---
import std.stdio;

int main(char[][] p_Args)
{
 foreach(char[] l_Arg; p_Args)
 {
   writefln("Argument '%s'", l_Arg);
 }
 return 0;
}

/+
Input and output example:

$ ./a.out MY NAME HERE
Argument './a.out'
Argument 'MY'
Argument 'NAME'
Argument 'HERE'

On Ubuntu 12.10 compiled with gdc,the version that can be found on its
repositories.
+/

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 18, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9344



--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2013-01-17 23:28:16 PST ---
(In reply to comment #0)
> import std.stdio;
> 
> int main(char[][] p_Args)
> {
>  foreach(char[] l_Arg; p_Args)
>  {
>    writefln("Argument '%s'", l_Arg);
>  }
>  return 0;
> }
> 
> /+
> Input and output example:
> 
> $ ./a.out MY NAME HERE
> Argument './a.out'
> Argument 'MY'
> Argument 'NAME'
> Argument 'HERE'
> 
> On Ubuntu 12.10 compiled with gdc,the version that can be found on its
> repositories.
> +/

Sorry, what is the problem? As far as I see, the input/output example works as expected.

The `main` function always receive the command string by p_Args[0]. It is same as C/C++ behavior.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 18, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9344


Iain Buclaw <ibuclaw@ubuntu.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw@ubuntu.com


--- Comment #2 from Iain Buclaw <ibuclaw@ubuntu.com> 2013-01-18 02:36:22 PST ---
(In reply to comment #1)
> (In reply to comment #0)
> > import std.stdio;
> > 
> > int main(char[][] p_Args)
> > {
> >  foreach(char[] l_Arg; p_Args)
> >  {
> >    writefln("Argument '%s'", l_Arg);
> >  }
> >  return 0;
> > }
> > 
> > /+
> > Input and output example:
> > 
> > $ ./a.out MY NAME HERE
> > Argument './a.out'
> > Argument 'MY'
> > Argument 'NAME'
> > Argument 'HERE'
> > 
> > On Ubuntu 12.10 compiled with gdc,the version that can be found on its
> > repositories.
> > +/
> 
> Sorry, what is the problem? As far as I see, the input/output example works as expected.
> 
> The `main` function always receive the command string by p_Args[0]. It is same as C/C++ behavior.


Yep, not a bug, not even a feature request.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 18, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9344


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich@gmail.com
         Resolution|                            |INVALID


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------