/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 1985-2011 AT&T Intellectual Property *4* and is licensed under the *5* Eclipse Public License, Version 1.0 *6* by AT&T Intellectual Property *7* *8* A copy of the License is available at *9* http://www.eclipse.org/org/documents/epl-v10.html *10* (with md5 checksum b35adb5213ca9657e911e9befb180842) *11* *12* Information and Software Systems Research *13* AT&T Research *14* Florham Park NJ *15* *16* Glenn Fowler <[email protected]> *17* David Korn <[email protected]> *18* Phong Vo <[email protected]> *19* *20***********************************************************************/21#pragma prototyped2223/*24* AT&T Research25*26* common dirent maintenance interface27*/2829#ifndef _AST_DIR_H30#define _AST_DIR_H3132#include <ast_lib.h>3334#if _mem_d_fileno_dirent || _mem_d_ino_dirent35#if !_mem_d_fileno_dirent36#undef _mem_d_fileno_dirent37#define _mem_d_fileno_dirent 138#define d_fileno d_ino39#endif40#endif4142#if _BLD_ast43#include "dirlib.h"44#else45#include <dirent.h>46#endif4748#if _mem_d_fileno_dirent49#define D_FILENO(d) ((d)->d_fileno)50#endif5152#if _mem_d_namlen_dirent53#define D_NAMLEN(d) ((d)->d_namlen)54#else55#define D_NAMLEN(d) (strlen((d)->d_name))56#endif5758#if _mem_d_reclen_dirent59#define D_RECLEN(d) ((d)->d_reclen)60#else61#define D_RECLEN(d) D_RECSIZ(d,D_NAMLEN(d))62#endif6364#define D_RECSIZ(d,n) (sizeof(*(d))-sizeof((d)->d_name)+((n)+sizeof(char*))&~(sizeof(char*)-1))6566/*67* NOTE: 2003-03-27 mac osx bug symlink==DT_REG bug discovered;68* the kernel *and* all directories must be fixed, so d_type69* is summarily disabled until we see that happen70*/7172#if _mem_d_type_dirent && defined(DT_UNKNOWN) && defined(DT_REG) && defined(DT_DIR) && defined(DT_LNK) && ! ( __APPLE__ || __MACH__ )73#define D_TYPE(d) ((d)->d_type)74#endif7576#endif777879