From 5c581ecaf63091451ef6572ef70041f661d09d19 Mon Sep 17 00:00:00 2001
From: Christopher Faylor <me@cgf.cx>
Date: Sat, 28 Dec 2002 23:20:47 +0000
Subject: [PATCH] * libc/include/sys/unistd.h: Under cygwin, just include
 getopt.h rather than defining getopt directly.

---
 newlib/ChangeLog                 | 5 +++++
 newlib/libc/include/sys/unistd.h | 4 ++++
 2 files changed, 9 insertions(+)

diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index 64213292d..1d7d2ccdd 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -1,3 +1,8 @@
+2002-12-28  Christopher Faylor  <cgf@redhat.com>
+
+	* libc/include/sys/unistd.h: Under cygwin, just include getopt.h rather
+	than defining getopt directly.
+
 2002-12-20  Jeff Johnston  <jjohnstn@redhat.com>
 
 	* NEWS: Update with 1.11.0 info.
diff --git a/newlib/libc/include/sys/unistd.h b/newlib/libc/include/sys/unistd.h
index 06773ccfd..b5ed650ed 100644
--- a/newlib/libc/include/sys/unistd.h
+++ b/newlib/libc/include/sys/unistd.h
@@ -120,10 +120,14 @@ int     _EXFUN(unlink, (const char *__path ));
 int     _EXFUN(vhangup, (void ));
 _READ_WRITE_RETURN_TYPE _EXFUN(write, (int __fd, const void *__buf, size_t __nbyte ));
 
+#ifdef __CYGWIN__
+# include <getopt.h>
+#else
 extern char *optarg;			/* getopt(3) external variables */
 extern int optind, opterr, optopt;
 int	 getopt(int, char * const [], const char *);
 extern int optreset;			/* getopt(3) external variable */
+#endif
 
 #ifndef        _POSIX_SOURCE
 pid_t   _EXFUN(vfork, (void ));