Disable wildcards for AppArgs

BlitzMax Forums/BlitzMax Programming/Disable wildcards for AppArgs

Ferminho(Posted 2005) [#1]
Hi, I'm making a command-line app and it accepts "/?" as a parameter to show the help
I've been fighting with my code til I realized that when using '?' or '*' as parameters to call the application, they are interpreted as filesystem wildcards... an example:

Print ("AppArgs ("+AppArgs.Length+" elements):")
For I:Int = 0 To (AppArgs.Length - 1)
	Print (AppArgs[I])
Next

(If you call this app with "app *" AppArgs includes the full list of files in the folder as parameters)

I don't know if this is a bug or a feature, but is there a way to disable it? I want to read ? and * as normal characters...

Any help appreciated... and sorry for my English x)


Dreamora(Posted 2005) [#2]
you need to have a command indicator. Normally this is / or - (ie -help or /help)


Ferminho(Posted 2005) [#3]
Thanks for the quick reply, the fact is, I do that; I read /help too, but I'd like to use ? and * without Bmax interpreting them as wildcards.


Koriolis(Posted 2005) [#4]
I don't think it's BlitzMax, it's the system. I bet you're under Linux, right? It's your shell that substitute '?' with the list of the files in the current folder. Look up the documentation for your shell and you'll find how to disable the substitution.


skidracer(Posted 2005) [#5]
Under XP

dir /?

gives you help

and

dir ?

lists all files that are a single character in length


Testing a BlitzMax app /? is correctly forwarded directly to AppArgs and a single ? correctly expands to all files with a single character filename so it all looks correct to me.


Ferminho(Posted 2005) [#6]
I tried under W2K Pro and WXP Pro, and still get the same:
(app.exe is a bmax simple non-gui application)

app ?
-> app ? (no files with 1 char in this folder, OK)

app /?
-> app /a (??? no idea where that a comes from)

app *
-> app file1 file2 file3 ... (as expected)

app /*
-> app /file1 /file2 ... (not sure if I expected this!)

However I found out that using '-' before cancels the wildcard expansion. So I guess I'll use -option instead of /option.

Not such a big issue, I guess. Thanks for the help guys!