Fix a bunch of compiler warnings (mainly MinGW).
[platform/upstream/flac.git] / src / share / getopt / getopt.c
index 18c2e84..968bf2f 100644 (file)
@@ -8,7 +8,7 @@
        GNU/Linux, Darwin, AND Solaris please submit it on the project page:
                http://sourceforge.net/projects/flac
 
-       In the meantime I have munged the global symbols and remove gates
+       In the meantime I have munged the global symbols and removed gates
        around code, while at the same time trying to touch the original as
        little as possible.
 */
@@ -32,8 +32,8 @@
 
    You should have received a copy of the GNU Library General Public
    License along with the GNU C Library; see the file COPYING.LIB.  If not,
-   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
 \f
 /* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
    Ditto for AIX 3.2 and <stdlib.h>.  */
@@ -41,8 +41,8 @@
 # define _NO_PROTO
 #endif
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
+#if HAVE_CONFIG_H
+#  include <config.h>
 #endif
 
 #if !defined __STDC__ || !__STDC__
    Also, when `ordering' is RETURN_IN_ORDER,
    each non-option ARGV-element is returned here.  */
 
-GETOPT_API char *share__optarg;
+char *share__optarg = 0; /*[JEC] initialize to avoid being a 'Common' symbol */
 
 /* Index in ARGV of the next element to be scanned.
    This is used for communication to and from the caller
@@ -140,13 +140,13 @@ GETOPT_API char *share__optarg;
    how much of ARGV has been scanned so far.  */
 
 /* 1003.2 says this must be 1 before any call.  */
-GETOPT_API int share__optind = 1;
+int share__optind = 1;
 
 /* Formerly, initialization of getopt depended on share__optind==0, which
    causes problems with re-calling getopt as programs generally don't
    know that. */
 
-int share____getopt_initialized;
+static int share____getopt_initialized = 0;
 
 /* The next char to be scanned in the option-element
    in which the last option character we returned was found.
@@ -160,13 +160,13 @@ static char *nextchar;
 /* Callers store zero here to inhibit the error message
    for unrecognized options.  */
 
-GETOPT_API int share__opterr = 1;
+int share__opterr = 1;
 
 /* Set to an option character which was unrecognized.
    This must be initialized on some systems to avoid linking in the
    system's own getopt implementation.  */
 
-GETOPT_API int share__optopt = '?';
+int share__optopt = '?';
 
 /* Describe how to deal with options that follow non-option ARGV-elements.
 
@@ -220,13 +220,11 @@ static char *posixly_correct;
    whose names are inconsistent.  */
 
 #ifndef getenv
-extern char *getenv ();
+extern char *getenv (const char * name);
 #endif
 
 static char *
-my_index (str, chr)
-     const char *str;
-     int chr;
+my_index (const char *str, int chr)
 {
   while (*str)
     {
@@ -447,7 +445,7 @@ share___getopt_initialize (argc, argv, optstring)
              if (nonoption_flags_max_len < argc)
                nonoption_flags_max_len = argc;
              __getopt_nonoption_flags =
-               (char *) malloc (nonoption_flags_max_len);
+               malloc (nonoption_flags_max_len);
              if (__getopt_nonoption_flags == NULL)
                nonoption_flags_max_len = -1;
              else
@@ -522,7 +520,7 @@ share___getopt_initialize (argc, argv, optstring)
    If LONG_ONLY is nonzero, '-' as well as '--' can introduce
    long-named options.  */
 
-GETOPT_API int
+int
 share___getopt_internal (argc, argv, optstring, longopts, longind, long_only)
      int argc;
      char *const *argv;
@@ -978,7 +976,7 @@ share___getopt_internal (argc, argv, optstring, longopts, longind, long_only)
   }
 }
 
-GETOPT_API int
+int
 share__getopt (argc, argv, optstring)
      int argc;
      char *const *argv;