1 2 /* : : generated by proto : : */ 3 /*********************************************************************** 4 * * 5 * This software is part of the ast package * 6 * Copyright (c) 1985-2010 AT&T Intellectual Property * 7 * and is licensed under the * 8 * Common Public License, Version 1.0 * 9 * by AT&T Intellectual Property * 10 * * 11 * A copy of the License is available at * 12 * http://www.opensource.org/licenses/cpl1.0.txt * 13 * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) * 14 * * 15 * Information and Software Systems Research * 16 * AT&T Research * 17 * Florham Park NJ * 18 * * 19 * Glenn Fowler <gsf@research.att.com> * 20 * David Korn <dgk@research.att.com> * 21 * Phong Vo <kpv@research.att.com> * 22 * * 23 ***********************************************************************/ 24 25 26 /* 27 * AT&T Research 28 * 29 * common dirent maintenance interface 30 */ 31 32 #ifndef _AST_DIR_H 33 #if !defined(__PROTO__) 34 #include <prototyped.h> 35 #endif 36 #if !defined(__LINKAGE__) 37 #define __LINKAGE__ /* 2004-08-11 transition */ 38 #endif 39 40 #define _AST_DIR_H 41 42 #include <ast_lib.h> 43 44 #if _mem_d_fileno_dirent || _mem_d_ino_dirent 45 #if !_mem_d_fileno_dirent 46 #undef _mem_d_fileno_dirent 47 #define _mem_d_fileno_dirent 1 48 #define d_fileno d_ino 49 #endif 50 #endif 51 52 #if _BLD_ast 53 #include "dirlib.h" 54 #else 55 #include <dirent.h> 56 #endif 57 58 #if _mem_d_fileno_dirent 59 #define D_FILENO(d) ((d)->d_fileno) 60 #endif 61 62 #if _mem_d_namlen_dirent 63 #define D_NAMLEN(d) ((d)->d_namlen) 64 #else 65 #define D_NAMLEN(d) (strlen((d)->d_name)) 66 #endif 67 68 #if _mem_d_reclen_dirent 69 #define D_RECLEN(d) ((d)->d_reclen) 70 #else 71 #define D_RECLEN(d) D_RECSIZ(d,D_NAMLEN(d)) 72 #endif 73 74 #define D_RECSIZ(d,n) (sizeof(*(d))-sizeof((d)->d_name)+((n)+sizeof(char*))&~(sizeof(char*)-1)) 75 76 /* 77 * NOTE: 2003-03-27 mac osx bug symlink==DT_REG bug discovered; 78 * the kernel *and* all directories must be fixed, so d_type 79 * is summarily disabled until we see that happen 80 */ 81 82 #if _mem_d_type_dirent && defined(DT_UNKNOWN) && defined(DT_REG) && defined(DT_DIR) && defined(DT_LNK) && ! ( __APPLE__ || __MACH__ ) 83 #define D_TYPE(d) ((d)->d_type) 84 #endif 85 86 #endif 87