Mail Archives: djgpp/1998/04/09/06:22:20
On Wed, 8 Apr 1998, Koehler wrote:
> Could some kind person please provide me with a djgpp code example where the
> names of multiple ("globbed") files are sequentially processed..... Or
> could someone point me to a (simple!!!!) dos version of grep.
There is, of course, a DJGPP port of GNU Grep (v2gnu/grep21b.zip from
the usual DJGPP ftp sites). I wouldn't call it ``simple'', though.
If you need to glob file names that are passed to a program as its
command-line arguments, then that is already done for you by the DJGPP
startup code. You say "progname *.c" and the program gets the list of
all the .c files expanded.
If you need to glob a wildcard inside a program, use the library
function `glob'. Alternatively, you could read the directory with
`readdir' or `findfirst' and `findnext', and test every file with
`fnmatch'.
> I looked at the faq entry about name globbing, but
> didn't see anything about how to actually deal with the resulting
> multiple files; i.e. how to get the file names, opened files, etc..
You need to browse the DJGPP library reference ("info libc" from the
DOS prompt).
- Raw text -