about summary refs log tree commit diff
path: root/io/ftw.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-11-07 23:00:00 +0000
committerUlrich Drepper <drepper@redhat.com>2003-11-07 23:00:00 +0000
commitca10f33858adef0c20f8bcbf65b49f920e3274e9 (patch)
treedff8ac42acd1b9e8e289058bc3a0cab2f907ae3b /io/ftw.h
parentc685b2b0b4e86f488ead098816292684362e55f7 (diff)
downloadglibc-ca10f33858adef0c20f8bcbf65b49f920e3274e9.tar.gz
glibc-ca10f33858adef0c20f8bcbf65b49f920e3274e9.tar.xz
glibc-ca10f33858adef0c20f8bcbf65b49f920e3274e9.zip
Update.
2003-11-07  Jakub Jelinek  <jakub@redhat.com>

	* 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.
Diffstat (limited to 'io/ftw.h')
-rw-r--r--io/ftw.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/io/ftw.h b/io/ftw.h
index 4939297b34..03973ccbbf 100644
--- a/io/ftw.h
+++ b/io/ftw.h
@@ -74,7 +74,33 @@ enum
 # define FTW_CHDIR	FTW_CHDIR
   FTW_DEPTH = 8		/* Report files in directory before directory itself.*/
 # define FTW_DEPTH	FTW_DEPTH
+# ifdef __USE_GNU
+  ,
+  FTW_ACTIONRETVAL = 16	/* Assume callback to return FTW_* values instead of
+			   zero to continue and non-zero to terminate.  */
+#  define FTW_ACTIONRETVAL FTW_ACTIONRETVAL
+# endif
+};
+
+#ifdef __USE_GNU
+/* Return values from callback functions.  */
+enum
+{
+  FTW_CONTINUE = 0,	/* Continue with next sibling or for FTW_D with the
+			   first child.  */
+# define FTW_CONTINUE	FTW_CONTINUE
+  FTW_STOP = 1,		/* Return from `ftw' or `nftw' with FTW_STOP as return
+			   value.  */
+# define FTW_STOP	FTW_STOP
+  FTW_SKIP_SUBTREE = 2,	/* Only meaningful for FTW_D: Don't walk through the
+			   subtree, instead just continue with its next
+			   sibling. */
+# define FTW_SKIP_SUBTREE FTW_SKIP_SUBTREE
+  FTW_SKIP_SIBLINGS = 3,/* Continue with FTW_DP callback for current directory
+			    (if FTW_DEPTH) and then its siblings.  */
+# define FTW_SKIP_SIBLINGS FTW_SKIP_SIBLINGS
 };
+#endif
 
 /* Structure used for fourth argument to callback function for `nftw'.  */
 struct FTW