Author Topic: A minor suggestion  (Read 5526 times)

Poobah

  • Guest
A minor suggestion
« on: August 08, 2006, 09:47:17 am »
I think it would be best if the arguments set in "set program's arguments" were surrounded by quotation marks when passed to the console runner. Otherwise they may be modified before they reach the program! For example, if I use the asterisk (*) character as an argument, it is automatically expanded by the console runner, because it didn't receive that argument with quotation marks around it. The program I was passing it to, however, normally receives it as an un-quoted asterisk.

So, if in the arguments section I use an un-quoted asterisk, Code::Blocks says this:
Quote
Executing: C:\Program Files\CodeBlocks/cb_console_runner.exe "C:\MinGW\Projects\Search\Search.exe" * (in C:\MinGW\Projects\Search\.)
But it should say (and do) this:
Quote
Executing: C:\Program Files\CodeBlocks/cb_console_runner.exe "C:\MinGW\Projects\Search\Search.exe" "*" (in C:\MinGW\Projects\Search\.)
« Last Edit: August 08, 2006, 09:49:51 am by Poobah »

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: A minor suggestion
« Reply #1 on: August 08, 2006, 04:34:06 pm »
I think it would probably be better to link console runner with noglob.

Automatic globbing done by the application is ideologically wrong, it's a shell's business or nobody's. By default, MinGW does globbing on all commandline parameters to simulate what the shell should do in the first place (but does not do, under Windows). It can be turned off by linking to noglob, which will make console runner behave "correctly".
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Poobah

  • Guest
Re: A minor suggestion
« Reply #2 on: August 10, 2006, 05:39:17 am »
Could Code::Blocks do this by default? If you put:
Code
int _CRT_glob = 0;
before the main function, globbing can be disabled this way aswell. This could be implemented with ifdefs for MinGW only.
« Last Edit: August 10, 2006, 05:41:10 am by Poobah »

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: A minor suggestion
« Reply #3 on: August 10, 2006, 10:01:48 am »
For Code::Blocks, globbing still makes sense, though.

Otherwise, you cannot use wildcards on all Windows systems. I don't know why anyone would want to do that anyway, but if someone wants to, it won't work.

It's different with console runner, you don't launch console runner on its own, there is no reason for that. And if somebody does, then it's his own fault ;)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Poobah

  • Guest
Re: A minor suggestion
« Reply #4 on: August 10, 2006, 10:13:38 am »
Yes, but the program should choose whether or not to glob itself, in Windows. If I create an "echo" program on Windows, then I would like to be able to use asterisks and question marks in the "set program's arguments" dialog, because I would allow the program to use them as they are. But I wouldn't be able to test this accurately with Code::Blocks, because console_runner would automatically expand the wildcards, despite the fact that the program shouldn't be having them processed. This sort of situation could lead to confusion, because it would create the illusion that disabling globbing for the program wasn't working. Isn't console_runner supposed to simulate running programs with a "press any key to continue" prompt afterwards? If so, it should just pass the arguments to the program exactly as the user typed them, rather than expanding them first, because that's the program's job in Windows.

The reason I like to have my file-based programs receive the wildcards is because I like to do the globbing myself, since the in-built globbing doesn't work too well. Running any of my programs with Code::Blocks creates the impression that I've made a mistake, when the real problem is that console_runner is expanding the wildcards beforehand rather than sending all the arguments as I typed them in.
« Last Edit: August 10, 2006, 10:26:00 am by Poobah »

Poobah

  • Guest
Re: A minor suggestion
« Reply #5 on: August 19, 2006, 04:23:24 am »
(Bump)