]> git.pond.sub.org Git - empserver/commitdiff
(getopt.h) move to src/lib/gen directory to prevent conflicts with
authorRon Koenderink <rkoenderink@yahoo.ca>
Wed, 15 Dec 2004 14:02:07 +0000 (14:02 +0000)
committerRon Koenderink <rkoenderink@yahoo.ca>
Wed, 15 Dec 2004 14:02:07 +0000 (14:02 +0000)
/usr/include/getopt.h.

include/getopt.h [deleted file]
src/lib/gen/getopt.h [new file with mode: 0644]
src/server/main.c
src/util/files.c

diff --git a/include/getopt.h b/include/getopt.h
deleted file mode 100644 (file)
index 2857e14..0000000
+++ /dev/null
@@ -1,182 +0,0 @@
-#if defined(_WIN32)\r
-/* Declarations for getopt.\r
-   Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc.\r
-   This file is part of the GNU C Library.\r
-\r
-   The GNU C Library is free software; you can redistribute it and/or\r
-   modify it under the terms of the GNU Lesser General Public\r
-   License as published by the Free Software Foundation; either\r
-   version 2.1 of the License, or (at your option) any later version.\r
-\r
-   The GNU C Library is distributed in the hope that it will be useful,\r
-   but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
-   Lesser General Public License for more details.\r
-\r
-   You should have received a copy of the GNU Lesser General Public\r
-   License along with the GNU C Library; if not, write to the Free\r
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA\r
-   02111-1307 USA.  */\r
-\r
-#ifndef _GETOPT_H\r
-\r
-#ifndef __need_getopt\r
-# define _GETOPT_H 1\r
-#endif\r
-\r
-/* If __GNU_LIBRARY__ is not already defined, either we are being used\r
-   standalone, or this is the first header included in the source file.\r
-   If we are being used with glibc, we need to include <features.h>, but\r
-   that does not exist if we are standalone.  So: if __GNU_LIBRARY__ is\r
-   not defined, include <ctype.h>, which will pull in <features.h> for us\r
-   if it's from glibc.  (Why ctype.h?  It's guaranteed to exist and it\r
-   doesn't flood the namespace with stuff the way some other headers do.)  */\r
-#if !defined __GNU_LIBRARY__\r
-# include <ctype.h>\r
-#endif\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-/* For communication from `getopt' to the caller.\r
-   When `getopt' finds an option that takes an argument,\r
-   the argument value is returned here.\r
-   Also, when `ordering' is RETURN_IN_ORDER,\r
-   each non-option ARGV-element is returned here.  */\r
-\r
-extern char *optarg;\r
-\r
-/* Index in ARGV of the next element to be scanned.\r
-   This is used for communication to and from the caller\r
-   and for communication between successive calls to `getopt'.\r
-\r
-   On entry to `getopt', zero means this is the first call; initialize.\r
-\r
-   When `getopt' returns -1, this is the index of the first of the\r
-   non-option elements that the caller should itself scan.\r
-\r
-   Otherwise, `optind' communicates from one call to the next\r
-   how much of ARGV has been scanned so far.  */\r
-\r
-extern int optind;\r
-\r
-/* Callers store zero here to inhibit the error message `getopt' prints\r
-   for unrecognized options.  */\r
-\r
-extern int opterr;\r
-\r
-/* Set to an option character which was unrecognized.  */\r
-\r
-extern int optopt;\r
-\r
-#ifndef __need_getopt\r
-/* Describe the long-named options requested by the application.\r
-   The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector\r
-   of `struct option' terminated by an element containing a name which is\r
-   zero.\r
-\r
-   The field `has_arg' is:\r
-   no_argument         (or 0) if the option does not take an argument,\r
-   required_argument   (or 1) if the option requires an argument,\r
-   optional_argument   (or 2) if the option takes an optional argument.\r
-\r
-   If the field `flag' is not NULL, it points to a variable that is set\r
-   to the value given in the field `val' when the option is found, but\r
-   left unchanged if the option is not found.\r
-\r
-   To have a long-named option do something other than set an `int' to\r
-   a compiled-in constant, such as set a value from `optarg', set the\r
-   option's `flag' field to zero and its `val' field to a nonzero\r
-   value (the equivalent single-letter option character, if there is\r
-   one).  For long options that have a zero `flag' field, `getopt'\r
-   returns the contents of the `val' field.  */\r
-\r
-struct option\r
-{\r
-# if (defined __STDC__ && __STDC__) || defined __cplusplus\r
-  const char *name;\r
-# else\r
-  char *name;\r
-# endif\r
-  /* has_arg can't be an enum because some compilers complain about\r
-     type mismatches in all the code that assumes it is an int.  */\r
-  int has_arg;\r
-  int *flag;\r
-  int val;\r
-};\r
-\r
-/* Names for the values of the `has_arg' field of `struct option'.  */\r
-\r
-# define no_argument           0\r
-# define required_argument     1\r
-# define optional_argument     2\r
-#endif /* need getopt */\r
-\r
-\r
-/* Get definitions and prototypes for functions to process the\r
-   arguments in ARGV (ARGC of them, minus the program name) for\r
-   options given in OPTS.\r
-\r
-   Return the option character from OPTS just read.  Return -1 when\r
-   there are no more options.  For unrecognized options, or options\r
-   missing arguments, `optopt' is set to the option letter, and '?' is\r
-   returned.\r
-\r
-   The OPTS string is a list of characters which are recognized option\r
-   letters, optionally followed by colons, specifying that that letter\r
-   takes an argument, to be placed in `optarg'.\r
-\r
-   If a letter in OPTS is followed by two colons, its argument is\r
-   optional.  This behavior is specific to the GNU `getopt'.\r
-\r
-   The argument `--' causes premature termination of argument\r
-   scanning, explicitly telling `getopt' that there are no more\r
-   options.\r
-\r
-   If OPTS begins with `--', then non-option arguments are treated as\r
-   arguments to the option '\0'.  This behavior is specific to the GNU\r
-   `getopt'.  */\r
-\r
-#if (defined __STDC__ && __STDC__) || defined __cplusplus\r
-# ifdef __GNU_LIBRARY__\r
-/* Many other libraries have conflicting prototypes for getopt, with\r
-   differences in the consts, in stdlib.h.  To avoid compilation\r
-   errors, only prototype getopt for the GNU C library.  */\r
-extern int getopt (int __argc, char *const *__argv, const char *__shortopts);\r
-# else /* not __GNU_LIBRARY__ */\r
-extern int getopt ();\r
-# endif /* __GNU_LIBRARY__ */\r
-\r
-# ifndef __need_getopt\r
-extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts,\r
-                       const struct option *__longopts, int *__longind);\r
-extern int getopt_long_only (int __argc, char *const *__argv,\r
-                            const char *__shortopts,\r
-                            const struct option *__longopts, int *__longind);\r
-\r
-/* Internal only.  Users should not call this directly.  */\r
-extern int _getopt_internal (int __argc, char *const *__argv,\r
-                            const char *__shortopts,\r
-                            const struct option *__longopts, int *__longind,\r
-                            int __long_only);\r
-# endif\r
-#else /* not __STDC__ */\r
-extern int getopt ();\r
-# ifndef __need_getopt\r
-extern int getopt_long ();\r
-extern int getopt_long_only ();\r
-\r
-extern int _getopt_internal ();\r
-# endif\r
-#endif /* __STDC__ */\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-/* Make sure we later can get all the definitions and declarations.  */\r
-#undef __need_getopt\r
-\r
-#endif /* getopt.h */\r
-#endif
diff --git a/src/lib/gen/getopt.h b/src/lib/gen/getopt.h
new file mode 100644 (file)
index 0000000..a1b8dd6
--- /dev/null
@@ -0,0 +1,180 @@
+/* Declarations for getopt.
+   Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library 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
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _GETOPT_H
+
+#ifndef __need_getopt
+# define _GETOPT_H 1
+#endif
+
+/* If __GNU_LIBRARY__ is not already defined, either we are being used
+   standalone, or this is the first header included in the source file.
+   If we are being used with glibc, we need to include <features.h>, but
+   that does not exist if we are standalone.  So: if __GNU_LIBRARY__ is
+   not defined, include <ctype.h>, which will pull in <features.h> for us
+   if it's from glibc.  (Why ctype.h?  It's guaranteed to exist and it
+   doesn't flood the namespace with stuff the way some other headers do.)  */
+#if !defined __GNU_LIBRARY__
+# include <ctype.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* For communication from `getopt' to the caller.
+   When `getopt' finds an option that takes an argument,
+   the argument value is returned here.
+   Also, when `ordering' is RETURN_IN_ORDER,
+   each non-option ARGV-element is returned here.  */
+
+extern char *optarg;
+
+/* Index in ARGV of the next element to be scanned.
+   This is used for communication to and from the caller
+   and for communication between successive calls to `getopt'.
+
+   On entry to `getopt', zero means this is the first call; initialize.
+
+   When `getopt' returns -1, this is the index of the first of the
+   non-option elements that the caller should itself scan.
+
+   Otherwise, `optind' communicates from one call to the next
+   how much of ARGV has been scanned so far.  */
+
+extern int optind;
+
+/* Callers store zero here to inhibit the error message `getopt' prints
+   for unrecognized options.  */
+
+extern int opterr;
+
+/* Set to an option character which was unrecognized.  */
+
+extern int optopt;
+
+#ifndef __need_getopt
+/* Describe the long-named options requested by the application.
+   The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
+   of `struct option' terminated by an element containing a name which is
+   zero.
+
+   The field `has_arg' is:
+   no_argument         (or 0) if the option does not take an argument,
+   required_argument   (or 1) if the option requires an argument,
+   optional_argument   (or 2) if the option takes an optional argument.
+
+   If the field `flag' is not NULL, it points to a variable that is set
+   to the value given in the field `val' when the option is found, but
+   left unchanged if the option is not found.
+
+   To have a long-named option do something other than set an `int' to
+   a compiled-in constant, such as set a value from `optarg', set the
+   option's `flag' field to zero and its `val' field to a nonzero
+   value (the equivalent single-letter option character, if there is
+   one).  For long options that have a zero `flag' field, `getopt'
+   returns the contents of the `val' field.  */
+
+struct option
+{
+# if (defined __STDC__ && __STDC__) || defined __cplusplus
+  const char *name;
+# else
+  char *name;
+# endif
+  /* has_arg can't be an enum because some compilers complain about
+     type mismatches in all the code that assumes it is an int.  */
+  int has_arg;
+  int *flag;
+  int val;
+};
+
+/* Names for the values of the `has_arg' field of `struct option'.  */
+
+# define no_argument           0
+# define required_argument     1
+# define optional_argument     2
+#endif /* need getopt */
+
+
+/* Get definitions and prototypes for functions to process the
+   arguments in ARGV (ARGC of them, minus the program name) for
+   options given in OPTS.
+
+   Return the option character from OPTS just read.  Return -1 when
+   there are no more options.  For unrecognized options, or options
+   missing arguments, `optopt' is set to the option letter, and '?' is
+   returned.
+
+   The OPTS string is a list of characters which are recognized option
+   letters, optionally followed by colons, specifying that that letter
+   takes an argument, to be placed in `optarg'.
+
+   If a letter in OPTS is followed by two colons, its argument is
+   optional.  This behavior is specific to the GNU `getopt'.
+
+   The argument `--' causes premature termination of argument
+   scanning, explicitly telling `getopt' that there are no more
+   options.
+
+   If OPTS begins with `--', then non-option arguments are treated as
+   arguments to the option '\0'.  This behavior is specific to the GNU
+   `getopt'.  */
+
+#if (defined __STDC__ && __STDC__) || defined __cplusplus
+# ifdef __GNU_LIBRARY__
+/* Many other libraries have conflicting prototypes for getopt, with
+   differences in the consts, in stdlib.h.  To avoid compilation
+   errors, only prototype getopt for the GNU C library.  */
+extern int getopt (int __argc, char *const *__argv, const char *__shortopts);
+# else /* not __GNU_LIBRARY__ */
+extern int getopt ();
+# endif /* __GNU_LIBRARY__ */
+
+# ifndef __need_getopt
+extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts,
+                       const struct option *__longopts, int *__longind);
+extern int getopt_long_only (int __argc, char *const *__argv,
+                            const char *__shortopts,
+                            const struct option *__longopts, int *__longind);
+
+/* Internal only.  Users should not call this directly.  */
+extern int _getopt_internal (int __argc, char *const *__argv,
+                            const char *__shortopts,
+                            const struct option *__longopts, int *__longind,
+                            int __long_only);
+# endif
+#else /* not __STDC__ */
+extern int getopt ();
+# ifndef __need_getopt
+extern int getopt_long ();
+extern int getopt_long_only ();
+
+extern int _getopt_internal ();
+# endif
+#endif /* __STDC__ */
+
+#ifdef __cplusplus
+}
+#endif
+
+/* Make sure we later can get all the definitions and declarations.  */
+#undef __need_getopt
+
+#endif /* getopt.h */
index 3cd46e0a542a901d473959bb4ca1dee0c9851400..f9d859ea431b1b8dd0d9c0b351b69b4a19aaffbb 100644 (file)
@@ -48,7 +48,7 @@
 #if defined(_WIN32)
 #include <winsock.h>
 #include <process.h>
-#include "getopt.h"
+#include "../lib/gen/getopt.h"
 #endif
 
 #include "misc.h"
index b5d22ee0be4c444fa4c8dc1845420a83f004341f..6acee2fba9eacfcf6d89c04d4001b1e3d79cf4a9 100644 (file)
@@ -44,7 +44,7 @@
 #include <sys/file.h>
 #else
 #include <direct.h>
-#include "getopt.h"
+#include "../lib/gen/getopt.h"
 #endif
 #include <stdarg.h>
 #include <stdio.h>