J
James Kuyper
Suppose a program expects two parameters, both of which contain wildcards.
The result will be a single list of files; how to tell where the first set
of files ends, and the next begins? Or the second parameter should be a
single file; how to tell whether that parameter was present? Etc.
Typically, that kind of situation is handled with options: command line
arguments that, by convention, start with a single '-' followed by one
or more single letter option identifiers, or by a "--" followed by an
option name. So, for example, you could write
myprogram -i *.in -o *.out
or
myprogram --input *.in --output *.out
This leads to potential problems: it's perfectly feasible to create a
file with a name that looks like a command line option. Some malware
creates files with such names, hoping to cause certain commands to
produce confusing or malignant consequences. However, in practice,
that's generally not a problem.
I've have a look later. If that works, that's good. But I can see problems:
it'll work on my system, but someone else running my program will also have
to do that set command. And it might stop other programs working properly
that expect the expansion.
It's not so much the C programs, as the users, that will have problems.
Instead of typing
wc *.c
the user will have to perform the expansion by hand, replacing *.c with
the complete list of file that *.c would have expanded to. That person
will NOT thank you for choosing noglob.