Add and change modules to make it easier for coreutils to use
[gnulib.git] / lib / stat_.h
1 /* Provide a complete sys/stat header file.
2    Copyright (C) 2006 Free Software Foundation, Inc.
3    Written by Eric Blake.
4
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 2, or (at your option)
8    any later version.
9
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with this program; if not, write to the Free Software Foundation,
17    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
18
19 #ifndef _gl_SYS_STAT_H
20 #define _gl_SYS_STAT_H
21
22 /* This file is supposed to be used on platforms where <sys/stat.h> is
23    incomplete.  It is intended to provide definitions and prototypes
24    needed by an application.  Start with what the system provides.  */
25 #include @ABSOLUTE_SYS_STAT_H@
26
27 /* mingw does not support symlinks, therefore it does not have lstat.  But
28    without links, stat does just fine.  */
29 #if ! HAVE_LSTAT
30 # define lstat stat
31 #endif
32
33 /* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
34    Additionally, it declares _mkdir (and depending on compile flags, an
35    alias mkdir), only in the nonstandard io.h.  */
36 #if ! HAVE_DECL_MKDIR && HAVE_IO_H
37 # include <io.h>
38
39 static inline int
40 rpl_mkdir (char const *name, mode_t mode)
41 {
42   return _mkdir (name);
43 }
44
45 # define mkdir rpl_mkdir
46 #endif
47
48 #endif /* _gl_SYS_STAT_H */