http://www.riscos.info/bugzilla3/show_bug.cgi?id=237

           Summary: Ampersands in command line arguments.
           Product: GCC/GCCSDK
           Version: other
          Platform: Other
        OS/Version: RISC OS
            Status: NEW
          Severity: normal
          Priority: P1
         Component: C compiler
        AssignedTo: john.tyt...@aaug.net
        ReportedBy: duncan_mo...@ntlworld.com
   Estimated Hours: 0.0


GCCSDK GCC 4.1.2 Release 2 Development 2012-05-05
VRPC RISC OS 4.39

#include <stdio.h>
int main(int argc,char** argv) {
  while  (*++argv) printf("%s\n",*argv);
  return 0;
}

I've had trouble passing command line arguments with ampersands in them.
For example, I would expect:

*test &0 &0,&1 &9,&1 &-,&1 "&0,&1" &a,&b
&0
&0,&1
&9,&1
&-,&1
&0,&1
&a,&b
*

but get:

*test &0 &0,&1 &9,&1 &-,&1 "&0,&1" &a,&b
&0
&0
&9
&-
&a,&b
*

(The argument in double quotes is missing completely.) The arguments seem to be
confused with redirection file descriptors, 2>&1 2>&- etc.

With just small changes to an argument, it can be quite unpredictable as to
what's going to be passed through. The only way I've found to get what I
originally wanted was to protect the first ampersand with both "" and \

*test "\&0,&1"
&0,&1
*

-- 
Configure bugmail: http://www.riscos.info/bugzilla3/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.

_______________________________________________
GCCSDK mailing list gcc@gccsdk.riscos.info
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK

Reply via email to