Mail Archives: djgpp/1997/06/12/01:45:16
Kappas Ioannis wrote:
>
> I think I've found a bug in DJGPP. When an argument in the command line is
> the character * the argc is 108 instead of 2.
> consider this program:
> main(int argc, char *argv[])
> {
> printf("%d\n", argc);
> return 0;
> }
>
> when we call the program with the asterisk, e.g. "a *" the argc is returning
> 109 instead of 2. Is this normal or is this a bug??
You undoubtedly have 107 files in the directory from which you run your
program. '*' on the command line is automatically wildcard-expanded to
the names of all files in the directory. (This is also true in DOS, btw
- "dir *" gives all files; "dir *." gives all files w/o extensions.)
DJGPP programs use the Unix (POSIX) style of command line globbing, and
the function responsible for this is part of the startup code. The FAQ
has instructions on disabling it in chapter 8.15; also look up
__crt0_glob_function() in the libc documentation.
A workaround would be to enclose the * in quotes; i.e., foo "*".
hth
--
---------------------------------------------------------------------
| John M. Aldrich | "Be wary of strong drink. It can |
| aka Fighteer I | make you shoot at tax collectors-- |
| mailto:fighteer AT cs DOT com | and miss." |
| http://www.cs.com/fighteer | - Lazarus Long |
---------------------------------------------------------------------
- Raw text -