summaryrefslogtreecommitdiff
path: root/lib/unistd.in.h
diff options
context:
space:
mode:
authorAndreas Rottmann <a.rottmann@gmx.at>2009-09-14 12:34:37 +0200
committerAndreas Rottmann <a.rottmann@gmx.at>2009-09-14 12:34:37 +0200
commit3bebb94360f1c2333feb8d504a9fa4f96984d8b7 (patch)
treea8aaac2174791365ed3e9975ae81106a47902f2a /lib/unistd.in.h
parentfa095a4504cbe668e4244547e2c141597bea4ecf (diff)
Imported Upstream version 0.9.1.1upstream/0.9.1.1
Diffstat (limited to 'lib/unistd.in.h')
-rw-r--r--lib/unistd.in.h25
1 files changed, 19 insertions, 6 deletions
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index 2e42c0b8..19bf5be8 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -29,6 +29,9 @@
#ifndef _GL_UNISTD_H
#define _GL_UNISTD_H
+/* NetBSD 5.0 mis-defines NULL. Also get size_t. */
+#include <stddef.h>
+
/* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>. */
#if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET)
# include <stdio.h>
@@ -43,6 +46,11 @@
# include <sys/types.h>
#endif
+/* Get getopt(), optarg, optind, opterr, optopt. */
+#if @GNULIB_UNISTD_H_GETOPT@
+# include <getopt.h>
+#endif
+
#if @GNULIB_GETHOSTNAME@
/* Get all possible declarations of gethostname(). */
# if @UNISTD_H_HAVE_WINSOCK2_H@
@@ -137,7 +145,7 @@ extern int chown (const char *file, uid_t uid, gid_t gid);
# define close rpl_close
extern int close (int);
# endif
-#elif @UNISTD_H_HAVE_WINSOCK2_H@
+#elif @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
# undef close
# define close close_used_without_requesting_gnulib_module_close
#elif defined GNULIB_POSIXCHECK
@@ -150,10 +158,13 @@ extern int close (int);
#if @GNULIB_DUP2@
-# if !@HAVE_DUP2@
+# if @REPLACE_DUP2@
+# define dup2 rpl_dup2
+# endif
+# if !@HAVE_DUP2@ || @REPLACE_DUP2@
/* Copy the file descriptor OLDFD into file descriptor NEWFD. Do nothing if
NEWFD = OLDFD, otherwise close NEWFD first if it is open.
- Return 0 if successful, otherwise -1 and errno set.
+ Return newfd if successful, otherwise -1 and errno set.
See the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/dup2.html>. */
extern int dup2 (int oldfd, int newfd);
@@ -214,7 +225,11 @@ extern int fchdir (int /*fd*/);
# define dup rpl_dup
extern int dup (int);
-# define dup2 rpl_dup2
+
+# if @REPLACE_DUP2@
+# undef dup2
+# endif
+# define dup2 rpl_dup2_fchdir
extern int dup2 (int, int);
# endif
@@ -363,7 +378,6 @@ extern int gethostname(char *name, size_t len);
See <http://www.opengroup.org/susv3xsh/getlogin.html>.
*/
# if !@HAVE_DECL_GETLOGIN_R@
-# include <stddef.h>
extern int getlogin_r (char *name, size_t size);
# endif
#elif defined GNULIB_POSIXCHECK
@@ -524,7 +538,6 @@ extern int link (const char *path1, const char *path2);
See the POSIX:2001 specification
<http://www.opengroup.org/susv3xsh/readlink.html>. */
# if !@HAVE_READLINK@
-# include <stddef.h>
extern int readlink (const char *file, char *buf, size_t bufsize);
# endif
#elif defined GNULIB_POSIXCHECK