[Linux manuál]
Návod, kniha: Linux Programmer's Manual
int ftw(const char *dir, int (*fn)(const
char *file, const struct stat *sb, int
flag), int nopenfd);
int nftw(const char *dir, int (*fn)(const
char *file, const struct stat *sb, int
flag, struct FTW *s), int
nopenfd, int flags);
The function nftw() does precisely the same as ftw(), except that
it has one additional argument flags (and calls the supplied function
with one more argument). This flags argument is an OR of zero or more
of the following flags:
ftw, nftw: soubor strom chůze
Originální popis anglicky: ftw, nftw - file tree walkNávod, kniha: Linux Programmer's Manual
STRUČNĚ
#include <ftw.h>POPIS / INSTRUKCE
ftw() walks through the directory tree starting from the indicated directory dir. For each found entry in the tree, it calls fn() with the full pathname of the entry, a pointer to the stat(2) structure for the entry and an int flag, which value will be one of the following:- FTW_F
- Item is a normal file
- FTW_D
- Item is a directory
- FTW_DNR
- Item is a directory which can't be read
- FTW_SL
- Item is a symbolic link
- FTW_NS
- The stat failed on the item which is not a symbolic link
- FTW_CHDIR
- If set, do a chdir() to each directory before handling its contents.
- FTW_DEPTH
- If set, do a depth-first search, that is, call the function for the directory itself only after handling the contents of the directory and its subdirectories.
- FTW_MOUNT
- If set, stay within the same file system.
- FTW_PHYS
- If set, do not follow symbolic links. (This is what you want.) If not set, symbolic links are followed, but no file is reported twice.
- FTW_DP
- Item is a directory and all its descendants have been handled already. (This occurs only with FTW_DEPTH set.)
- FTW_SLN
- Item is a symbolic link pointing to a nonexisting file. (This occurs only with FTW_PHYS unset.)
NOTES
The function nftw() and the use of FTW_SL with ftw() were introduced in XPG4v2. On some systems ftw() will never use FTW_SL, on other systems FTW_SL occurs only for symbolic links that do not point to an existing file, and again on other systems ftw() will use FTW_SL for each symbolic link. For predictable control, use nftw(). Under Linux, libc4 and libc5 and glibc 2.0.6 will use FTW_F for all objects (files, symbolic links, fifos, etc) that can be stat'ed but are not a directory. The function nftw() is available since glibc 2.1.ODPOVÍDAJÍCÍ
AES, SVID2, SVID3, XPG2, XPG3, XPG4, XPG4v2.SOUVISEJÍCÍ
stat(2)| 1999-06-25 | Linux |