From ca10f33858adef0c20f8bcbf65b49f920e3274e9 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 7 Nov 2003 23:00:00 +0000 Subject: Update. 2003-11-07 Jakub Jelinek * io/ftw.c (NFTW_OLD_NAME, NFTW_NEW_NAME): Define. (ftw_dir, ftw_startup): Add __attribute ((noinline)). (NFTW_OLD_NAME, NFTW_NEW_NAME): New functions. (NFTW_NAME): Only define if !_LIBC, add versioned_symbol and compat_symbol. * io/ftw64.c (NFTW_OLD_NAME, NFTW_NEW_NAME): Define. * io/Versions (libc): Export nftw@@GLIBC_2.3.3 and nftw64@@GLIBC_2.3.3. * io/ftw.h (FTW_ACTIONRETVAL): New flag. (FTW_CONTINUE, FTW_STOP, FTW_SKIP_SUBTREE, FTW_SKIP_SIBLINGS): New. * io/ftw.c (ftw_dir): Add old_dir argument. Clear result if it was FTW_SKIP_SIBLINGS after processing all dir entries. Change cwd back if old_dir != NULL. (process_entry): Adjust caller. Don't change cwd back here. Change FTW_SKIP_SUBTREE result to 0. (ftw_startup): Adjust ftw_dir caller. Clear result if it was FTW_SKIP_SUBTREE or FTW_SKIP_SIBLINGS. * io/ftwtest.c (skip_subtree, skip_siblings): New variables. (options, main): Add --skip-subtree and --skip-siblings options. (cb): Use return FTW_CONTINUE instead of return 0. Handle --skip-subtree and --skip-siblings. * io/ftwtest-sh: Add tests for FTW_ACTIONRETVAL. * manual/filesys.texi: Document FTW_ACTIONRETVAL. --- manual/filesys.texi | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'manual') diff --git a/manual/filesys.texi b/manual/filesys.texi index c858e2b..70889c2 100644 --- a/manual/filesys.texi +++ b/manual/filesys.texi @@ -918,6 +918,17 @@ If this option is specified then all subdirectories and files within them are processed before processing the top directory itself (depth-first processing). This also means the type flag given to the callback function is @code{FTW_DP} and not @code{FTW_D}. +@item FTW_ACTIONRETVAL +If this option is specified then return values from callbacks +are handled differently. If the callback returns @code{FTW_CONTINUE}, +walking continues normally. @code{FTW_STOP} means walking stops +and @code{FTW_STOP} is returned to the caller. If @code{FTW_SKIP_SUBTREE} +is returned by the callback with @code{FTW_D} argument, the subtree +is skipped and walking continues with next sibling of the directory. +If @code{FTW_SKIP_SIBLINGS} is returned by the callback, all siblings +of the current entry are skipped and walking continues in its parent. +No other return values should be returned from the callbacks if +this option is set. This option is a GNU extension. @end vtable The return value is computed in the same way as for @code{ftw}. -- cgit v1.1