delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/09/06:22:20

Date: Thu, 9 Apr 1998 13:20:36 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Koehler <koehler AT netcom DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: How to get file-globbed names?
In-Reply-To: <koehlerEr4BDM.Csw@netcom.com>
Message-ID: <Pine.SUN.3.91.980409132006.24173I-100000@is>
MIME-Version: 1.0

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019