* stat_.h: New file.
authorEric Blake <ebb9@byu.net>
Thu, 29 Jun 2006 22:17:41 +0000 (22:17 +0000)
committerEric Blake <ebb9@byu.net>
Thu, 29 Jun 2006 22:17:41 +0000 (22:17 +0000)
lib/ChangeLog
lib/stat_.h [new file with mode: 0644]

index 9a346a716485a89092030584490488236b593907..64b977e5ee087b2f89ddec11651e25dd9b26e830 100644 (file)
@@ -1,3 +1,7 @@
+2006-06-29  Eric Blake  <ebb9@byu.net>
+
+       * stat_.h: New file.
+
 2006-06-29  Derek R. Price  <derek@ximbiot.com>
 
        * strftime.c: Assume strftime() exists.
diff --git a/lib/stat_.h b/lib/stat_.h
new file mode 100644 (file)
index 0000000..7f290ce
--- /dev/null
@@ -0,0 +1,42 @@
+/* Provide a complete sys/stat header file.
+   Copyright (C) 2006 Free Software Foundation, Inc.
+   Written by Eric Blake.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+#ifndef _gl_SYS_STAT_H
+#define _gl_SYS_STAT_H
+
+/* This file is supposed to be used on platforms where <sys/stat.h> is
+   incomplete.  It is intended to provide definitions and prototypes
+   needed by an application.  Start with what the system provides.  */
+#include @FULL_PATH_SYS_STAT_H@
+
+/* mingw does not support symlinks, therefore it does not have lstat.  But
+   without links, stat does just fine.  */
+#if ! HAVE_FUNC_LSTAT
+# define lstat stat
+#endif
+
+/* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
+   Additionally, it declares _mkdir (and depending on compile flags, an
+   alias mkdir), only in the nonstandard io.h.  */
+#if ! HAVE_DECL_MKDIR && HAVE_IO_H
+# include <io.h>
+static int rpl_mkdir (char const *name, mode_t mode) { return _mkdir (name); }
+# define mkdir rpl_mkdir
+#endif
+
+#endif /* _gl_SYS_STAT_H */