www.delorie.com/djgpp/bugs/show.cgi   search  
Bug 000163

When Created: 06/21/1997 23:49:39
Against DJGPP version: 2.01
By whom: graeme@interlink.or.jp
Abstract: Can't pass a command line argument starting with '@'
Consider the following program, test.c, which just prints all its command
line arguments.


#include <stdio.h>

int main(int argc, char *argv[])
{
   int argno;

   for (argno = 1; argno < argc; argno++)
   {
      puts(argv[argno]);
   }

   return 0;
}


Invoking 'test @blah' treats the file 'blah', if it exists, as a response
file and results in the contents of 'blah' being printed. Globbing at work!
The problem is there's no way to stop this behavior (short of turning
off globbing altogether).

The FAQ states in Section 16.3 that if you want to pass an argument
whose first character is '@', it should be surrounded with single or
double quotes. This used to work in version 2.00, but appears to have
been broken in version 2.01.

When 'test.c' is compiled with version 2.01, none of the following
commands stop the argument from being expanded to the contents
of file 'blah'.

test '@blah'
test "@blah"
test '@'blah
test "@"blah

I can't see any workaround for this bug. Anyone?

Incidentally, another possibly related issue is that the command
'test \\foo' seems to cause a 1 or 2 second delay. I guess this
is related to networking? Anyway, surrounding the argument with
single or double quotes, which ought to force '\\foo' to be treated
as a literal, does not eliminate the delay.

Solution added: 04/12/1999 11:00:13
By whom: eliz@is.elta.co.il
I cannot reproduce this.  Quoting the @foo arguments works for me,
and always did.

As for \\foo: yes, the delay is because Windows goes looking for the
machine named "foo" on the network.  Quoting doesn't stop that because
Windows doesn't care about quoted names.

Fixed in version on 04/12/1999 11:00:50
By whom: eliz@is.elta.co.il



  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2010   by DJ Delorie     Updated Jul 2010