1 #ifndef _system_dir_h
2 #define _system_dir_h
3 /*
4    Unix SMB/CIFS implementation.
5 
6    directory system include wrappers
7 
8    Copyright (C) Andrew Tridgell 2004
9 
10      ** NOTE! The following LGPL license applies to the replace
11      ** library. This does NOT imply that all of Samba is released
12      ** under the LGPL
13 
14    This library is free software; you can redistribute it and/or
15    modify it under the terms of the GNU Lesser General Public
16    License as published by the Free Software Foundation; either
17    version 3 of the License, or (at your option) any later version.
18 
19    This library is distributed in the hope that it will be useful,
20    but WITHOUT ANY WARRANTY; without even the implied warranty of
21    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22    Lesser General Public License for more details.
23 
24    You should have received a copy of the GNU Lesser General Public
25    License along with this library; if not, see <http://www.gnu.org/licenses/>.
26 */
27 
28 #ifdef HAVE_DIRENT_H
29 # include <dirent.h>
30 # define NAMLEN(dirent) strlen((dirent)->d_name)
31 #else
32 # define dirent direct
33 # define NAMLEN(dirent) (dirent)->d_namlen
34 # if HAVE_SYS_NDIR_H
35 #  include <sys/ndir.h>
36 # endif
37 # if HAVE_SYS_DIR_H
38 #  include <sys/dir.h>
39 # endif
40 # if HAVE_NDIR_H
41 #  include <ndir.h>
42 # endif
43 #endif
44 
45 #ifndef HAVE_MKDIR_MODE
46 #define mkdir(dir, mode) mkdir(dir)
47 #endif
48 
49 #ifdef HAVE_LIBGEN_H
50 # include <libgen.h>
51 #endif
52 
53 /* Test whether a file name is the "." or ".." directory entries.
54  * These really should be inline functions.
55  */
56 #ifndef ISDOT
57 #define ISDOT(path) ( \
58 			*((const char *)(path)) == '.' && \
59 			*(((const char *)(path)) + 1) == '\0' \
60 		    )
61 #endif
62 
63 #ifndef ISDOTDOT
64 #define ISDOTDOT(path)	( \
65 			    *((const char *)(path)) == '.' && \
66 			    *(((const char *)(path)) + 1) == '.' && \
67 			    *(((const char *)(path)) + 2) == '\0' \
68 			)
69 #endif
70 
71 #endif
72