Unix Programming - FTS

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > July 2004 > FTS





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author FTS
brian

2004-07-20, 5:58 pm

I have migrated from linux to openBSD, and I have started to review the
source code. For the command ls, the source code is using FTS to
traverse the directory structure. The man page suggests that this (FTS)
might be added to the IEEE standard.

Can anyone here give me some history on FTS, and why I do not find it
even mentioned of it in the glibc documentation?

thanks,

brian
Lev Walkin

2004-07-20, 5:58 pm

brian wrote:
> I have migrated from linux to openBSD, and I have started to review the
> source code. For the command ls, the source code is using FTS to
> traverse the directory structure. The man page suggests that this (FTS)
> might be added to the IEEE standard.
>
> Can anyone here give me some history on FTS, and why I do not find it
> even mentioned of it in the glibc documentation?


http://lists.progeny.com/archive/pr...1/msg00024.html

"The fts() family of functions is a relatively recent innovation
in Unix, appearing first in 4.4BSD and later ported to the GNU C
library."



--
Lev Walkin
vlm@lionet.info
James Antill

2004-07-21, 2:48 am

On Tue, 20 Jul 2004 14:35:28 -0600, brian wrote:

> I have migrated from linux to openBSD, and I have started to review the
> source code. For the command ls, the source code is using FTS to
> traverse the directory structure. The man page suggests that this (FTS)
> might be added to the IEEE standard.
>
> Can anyone here give me some history on FTS, and why I do not find it
> even mentioned of it in the glibc documentation?


It's old, the "std" now is to use nftw (it's in SuS -- as is the older
version ftw). However due to security/portability problems with all the
path walking libc code it tends to still be done by hand.

--
James Antill -- james@and.org
Need an efficient and powerful string library for C?
http://www.and.org/vstr/

brian

2004-07-21, 5:58 pm

James Antill wrote:
> On Tue, 20 Jul 2004 14:35:28 -0600, brian wrote:
>
>
>
>
> It's old, the "std" now is to use nftw (it's in SuS -- as is the older
> version ftw). However due to security/portability problems with all the
> path walking libc code it tends to still be done by hand.
>

Thanks. I am walking through the source code of all the basic commands
in openBSD, and I was curious since I had never seen FTS before. The
man page gave me pretty sufficient information as to it FTS's use, and
the source code for fts (fts.c) helped out a lot to.

So I should be looking at nftw to traverse paths now? There are always
the system calls to, I guess. I'm sure I will run into more old and odd
functions when I start to dig into the kernel and the IP stack.

thanks,

brian
William Ahern

2004-07-21, 5:58 pm

James Antill <james-netnews@and.org> wrote:
> On Tue, 20 Jul 2004 14:35:28 -0600, brian wrote:


>
> It's old, the "std" now is to use nftw (it's in SuS -- as is the older
> version ftw). However due to security/portability problems with all the
> path walking libc code it tends to still be done by hand.


I thought fts was newer. From my OpenBSD man page for ftw(3):

These functions are provided for compatibility with legacy code.
New code should use the fts(3) functions.

Or is the chronology ftw(3) -> fts(3) -> nftw(3)?

Personally, I like the fts interface much better.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com