Re: ftw and CTree



On Sat, Feb 24, 2001 at 05:32:12PM -0500, Paul Davis wrote:
> Note that the pointers to the GtkCTree or whatever have to be globals
> or similar, because the designers of ftw(3) had not heard of the idea
> of a passed-in user-pointer :(

The "fts" routines don't have that problem - the model they use is one
of a stream of files:

	"fts_open()" opens the stream;

	"fts_read()" reads from the stream the entry for the next file;

	"fts_close()" closes the stream;

rather than one of callbacks for each entry.

Sufficiently recent versions of the free UNIXes (4.4-Lite-based BSDs,
and glibc2 Linuxes) should have the "fts" routines (the current "fts"
routines were in 4.4-Lite-2, according to the "fts" page in the
4.4-Lite-2 man pages at

	http://www.FreeBSD.org/cgi/man.cgi?manpath=4.4BSD+Lite2

and they have been available in Linux since glibc2, according to the
"fts" man page in the Red Hat Linux 7.0 man pages at

	http://www.FreeBSD.org/cgi/man.cgi?manpath=linux

); I don't know whether any of the commercial UNIXes have them.

Note, BTW, that "ftw()" might follow symbolic links and show you
information about the files to which they refer rather than showing you
information about the link itself; "nftw()" and the "fts" routines can
be told whether to follow symbolic links or not.  ("ftw()" dates back to
System V Release 3, which didn't *have* symbolic links.)




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]