Mail Archives: djgpp/1998/02/03/18:46:43
From: | "John M. Aldrich" <fighteer AT cs DOT com>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: why isn't "glob" working here?
|
Date: | Tue, 03 Feb 1998 18:43:44 -0500
|
Organization: | Two pounds of chaos and a pinch of salt.
|
Lines: | 31
|
Message-ID: | <34D7ABB0.6928@cs.com>
|
References: | <6aulbc$l77$1 AT hecate DOT umd DOT edu>
|
NNTP-Posting-Host: | ppp204.cs.com
|
Mime-Version: | 1.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Jason Stratos Papadopoulos wrote:
>
> Hello. To be more specific, glob does work, but only returns
> one filename rather than all the names matching the wildcard.
Unless you disable the built-in DJGPP command-line globbing in your
program (which you don't appear to have done), the command line will
already be globbed by the time you begin using arguments to main().
Therefore, glob() is passed the name of the first file instead of the
wildcard, and obviously returns just that one filename.
To disable automatic command-line globbing, you should #include <crt0.h>
and write a version of char ** __crt0_glob_function( char * ) (q.v.)
that does nothing except return NULL. You can also get the same effect
by enclosing the wildcard argument to your program in double quotes:
program "*.*"
However, the former is probably more intuitive.
BTW, if all you want to do is retrieve wildcards from the command line,
then you are better off letting the automatic globbing code do it for
you.
--
---------------------------------------------------------------------
| John M. Aldrich | "Animals can be driven crazy by pla- |
| aka Fighteer I | cing too many in too small a pen. |
| mailto:fighteer AT cs DOT com | Homo sapiens is the only animal that |
| http://www.cs.com/fighteer | voluntarily does this to himself." |
---------------------------------------------------------------------
- Raw text -