Move our own getopt() implementation to _PyOS_GetOpt(), and use it
regardless of whether the system getopt() does what we want. This avoids the
hassle with prototypes and externs, and the check to see if the system
getopt() does what we want. Prefix optind, optarg and opterr with _PyOS_ to
avoid name clashes. Add new include file to define the right symbols. Fix
Demo/pyserv/pyserv.c to include getopt.h itself, instead of relying on
Python to provide it.
diff --git a/Demo/pysvr/pysvr.c b/Demo/pysvr/pysvr.c
index d7d755c..99d7b07 100644
--- a/Demo/pysvr/pysvr.c
+++ b/Demo/pysvr/pysvr.c
@@ -19,6 +19,7 @@
#include <netinet/in.h>
#include <pthread.h>
+#include <getopt.h>
/* XXX Umpfh.
Python.h defines a typedef destructor, which conflicts with pthread.h.
@@ -32,10 +33,6 @@
#define PORT 4000
#endif
-extern int optind;
-extern char *optarg;
-extern int getopt(int, char **, char *);
-
struct workorder {
int conn;
struct sockaddr_in addr;