ftwalk.h revision da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/***********************************************************************
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* This software is part of the ast package *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* Copyright (c) 1985-2007 AT&T Knowledge Ventures *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* and is licensed under the *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* Common Public License, Version 1.0 *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* by AT&T Knowledge Ventures *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* A copy of the License is available at *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* http://www.opensource.org/licenses/cpl1.0.txt *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* Information and Software Systems Research *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* AT&T Research *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* Florham Park NJ *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* Glenn Fowler <gsf@research.att.com> *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* David Korn <dgk@research.att.com> *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* Phong Vo <kpv@research.att.com> *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin***********************************************************************/
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#pragma prototyped
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/*
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Phong Vo
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Glenn Fowler
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * AT&T Research
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * ast ftwalk interface definitions
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * ftwalk was the initial improvement on ftw and nftw
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * which formed the basis for the POSIX fts proposal
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * NOTE: this file is in cahoots with the fts implementation
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#ifndef _FTWALK_H
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define _FTWALK_H
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define fts_info info
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define fts_level level
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define fts_link link
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define fts_name name
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define fts_namelen namelen
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define fts_parent parent
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define fts_path path
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define fts_pathlen pathlen
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTSENT Ftw_t /* <fts.h> internal */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define Ftsent FTW /* <fts.h> internal */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define _FTSENT_LOCAL_PRIVATE_ /* <fts.h> internal */ \
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin union \
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin { \
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin long number; /* local numeric value */ \
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin void* pointer; /* local pointer value */ \
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin } local;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define _FTSENT_PRIVATE_ /* fts internal */ \
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin short status; /* internal status */ \
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin struct stat statb; /* fts_statp data */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#include <fts.h>
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/*
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * ftwalk() argument flags
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTW_CANON FTS_CANON
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTW_CHILDREN (FTS_USER<<0)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTW_DELAY FTS_NOSTAT
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTW_DOT FTS_NOCHDIR
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTW_META FTS_META
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTW_MOUNT FTS_XDEV
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTW_MULTIPLE FTS_ONEPATH
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTW_NOSEEDOTDIR FTS_NOSEEDOTDIR
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTW_PHYSICAL FTS_PHYSICAL
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTW_POST (FTS_USER<<1)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTW_SEEDOTDIR FTS_SEEDOTDIR
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTW_TOP FTS_TOP
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTW_TWICE (FTS_USER<<2)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTW_USER (FTS_USER<<3)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/*
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Ftw_t.info type bits
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTW_C FTS_C
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTW_D FTS_D
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTW_DC FTS_DC
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTW_DNR FTS_DNR
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTW_DNX FTS_DNX
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTW_DP FTS_DP
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTW_F FTS_F
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTW_NR FTS_NR
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTW_NS FTS_NS
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTW_NSOK FTS_NSOK
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTW_NX FTS_NX
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTW_P FTS_P
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTW_SL FTS_SL
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/*
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Ftw_t.status entry values
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTW_NAME FTS_DOT /* access by Ftw_t.name */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTW_PATH FTS_NOCHDIR /* access by Ftw_t.path */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/*
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Ftw_t.status return values
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTW_AGAIN FTS_AGAIN
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTW_FOLLOW FTS_FOLLOW
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTW_NOPOST FTS_NOPOSTORDER
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTW_SKIP FTS_SKIP
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define FTW_STAT FTS_STAT
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#if _BLD_ast && defined(__EXPORT__)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define extern __EXPORT__
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#endif
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern int ftwalk(const char*, int(*)(Ftw_t*), int, int(*)(Ftw_t*, Ftw_t*));
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinextern int ftwflags(void);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#undef extern
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#endif