Blame SOURCES/fribidi-drop-bundled-gnulib.patch

238c37
diff -pruN fribidi-1.0.10.orig/bin/Makefile.am fribidi-1.0.10/bin/Makefile.am
238c37
--- fribidi-1.0.10.orig/bin/Makefile.am	2020-07-06 04:17:23.000000000 +0900
238c37
+++ fribidi-1.0.10/bin/Makefile.am	2020-07-07 21:09:49.076237457 +0900
238c37
@@ -2,11 +2,9 @@ bin_PROGRAMS = fribidi
238c37
 
238c37
 noinst_PROGRAMS = fribidi-benchmark fribidi-bidi-types fribidi-caprtl2utf8
238c37
 
238c37
-getopt_SOURCES = getopt.c getopt1.c getopt_int.h getopt.h gettext.h
238c37
+fribidi_SOURCES = fribidi-main.c
238c37
 
238c37
-fribidi_SOURCES = fribidi-main.c $(getopt_SOURCES)
238c37
-
238c37
-fribidi_benchmark_SOURCES = fribidi-benchmark.c $(getopt_SOURCES)
238c37
+fribidi_benchmark_SOURCES = fribidi-benchmark.c
238c37
 
238c37
 AM_CPPFLAGS = \
238c37
 		@FRIBIDI_CPPFLAGS@ \
238c37
diff -pruN fribidi-1.0.10.orig/bin/getopt.c fribidi-1.0.10/bin/getopt.c
238c37
--- fribidi-1.0.10.orig/bin/getopt.c	2015-08-05 03:49:07.000000000 +0900
238c37
+++ fribidi-1.0.10/bin/getopt.c	1970-01-01 09:00:00.000000000 +0900
238c37
@@ -1,1268 +0,0 @@
238c37
-/* Getopt for GNU.
238c37
-   NOTE: getopt is now part of the C library, so if you don't know what
238c37
-   "Keep this file name-space clean" means, talk to drepper@gnu.org
238c37
-   before changing it!
238c37
-   Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004
238c37
-   	Free Software Foundation, Inc.
238c37
-   This file is part of the GNU C Library.
238c37
-
238c37
-   This program is free software; you can redistribute it and/or modify
238c37
-   it under the terms of the GNU General Public License as published by
238c37
-   the Free Software Foundation; either version 2, or (at your option)
238c37
-   any later version.
238c37
-
238c37
-   This program is distributed in the hope that it will be useful,
238c37
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
238c37
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
238c37
-   GNU General Public License for more details.
238c37
-
238c37
-   You should have received a copy of the GNU General Public License along
238c37
-   with this program; if not, write to the Free Software Foundation,
238c37
-   Inc., 59 Temple Place - Suite 330, Boston, MA 02110-1301, USA.  */
238c37
-
238c37
-/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
238c37
-   Ditto for AIX 3.2 and <stdlib.h>.  */
238c37
-#ifndef _NO_PROTO
238c37
-# define _NO_PROTO
238c37
-#endif
238c37
-
238c37
-#ifdef HAVE_CONFIG_H
238c37
-# include <config.h>
238c37
-#endif
238c37
-
238c37
-#include <stdio.h>
238c37
-
238c37
-/* Comment out all this code if we are using the GNU C Library, and are not
238c37
-   actually compiling the library itself.  This code is part of the GNU C
238c37
-   Library, but also included in many other GNU distributions.  Compiling
238c37
-   and linking in this code is a waste when using the GNU C library
238c37
-   (especially if it is a shared library).  Rather than having every GNU
238c37
-   program understand `configure --with-gnu-libc' and omit the object files,
238c37
-   it is simpler to just do this in the source for each such file.  */
238c37
-
238c37
-#define GETOPT_INTERFACE_VERSION 2
238c37
-#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
238c37
-# include <gnu-versions.h>
238c37
-# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
238c37
-#  define ELIDE_CODE
238c37
-# endif
238c37
-#endif
238c37
-
238c37
-#ifndef ELIDE_CODE
238c37
-
238c37
-
238c37
-/* This needs to come after some library #include
238c37
-   to get __GNU_LIBRARY__ defined.  */
238c37
-#ifdef	__GNU_LIBRARY__
238c37
-/* Don't include stdlib.h for non-GNU C libraries because some of them
238c37
-   contain conflicting prototypes for getopt.  */
238c37
-# include <stdlib.h>
238c37
-# include <unistd.h>
238c37
-#endif /* GNU C library.  */
238c37
-
238c37
-#include <string.h>
238c37
-
238c37
-#ifdef VMS
238c37
-# include <unixlib.h>
238c37
-#endif
238c37
-
238c37
-#ifdef _LIBC
238c37
-# include <libintl.h>
238c37
-#else
238c37
-# include "gettext.h"
238c37
-# define _(msgid) gettext (msgid)
238c37
-#endif
238c37
-
238c37
-#if defined _LIBC && defined USE_IN_LIBIO
238c37
-# include <wchar.h>
238c37
-#endif
238c37
-
238c37
-#ifndef attribute_hidden
238c37
-# define attribute_hidden
238c37
-#endif
238c37
-
238c37
-/* This version of `getopt' appears to the caller like standard Unix `getopt'
238c37
-   but it behaves differently for the user, since it allows the user
238c37
-   to intersperse the options with the other arguments.
238c37
-
238c37
-   As `getopt' works, it permutes the elements of ARGV so that,
238c37
-   when it is done, all the options precede everything else.  Thus
238c37
-   all application programs are extended to handle flexible argument order.
238c37
-
238c37
-   Setting the environment variable POSIXLY_CORRECT disables permutation.
238c37
-   Then the behavior is completely standard.
238c37
-
238c37
-   GNU application programs can use a third alternative mode in which
238c37
-   they can distinguish the relative order of options and other arguments.  */
238c37
-
238c37
-#include "getopt.h"
238c37
-#include "getopt_int.h"
238c37
-
238c37
-/* For communication from `getopt' to the caller.
238c37
-   When `getopt' finds an option that takes an argument,
238c37
-   the argument value is returned here.
238c37
-   Also, when `ordering' is RETURN_IN_ORDER,
238c37
-   each non-option ARGV-element is returned here.  */
238c37
-
238c37
-char *optarg;
238c37
-
238c37
-/* Index in ARGV of the next element to be scanned.
238c37
-   This is used for communication to and from the caller
238c37
-   and for communication between successive calls to `getopt'.
238c37
-
238c37
-   On entry to `getopt', zero means this is the first call; initialize.
238c37
-
238c37
-   When `getopt' returns -1, this is the index of the first of the
238c37
-   non-option elements that the caller should itself scan.
238c37
-
238c37
-   Otherwise, `optind' communicates from one call to the next
238c37
-   how much of ARGV has been scanned so far.  */
238c37
-
238c37
-/* 1003.2 says this must be 1 before any call.  */
238c37
-int optind = 1;
238c37
-
238c37
-/* Callers store zero here to inhibit the error message
238c37
-   for unrecognized options.  */
238c37
-
238c37
-int opterr = 1;
238c37
-
238c37
-/* Set to an option character which was unrecognized.
238c37
-   This must be initialized on some systems to avoid linking in the
238c37
-   system's own getopt implementation.  */
238c37
-
238c37
-int optopt = '?';
238c37
-
238c37
-/* Keep a global copy of all internal members of getopt_data.  */
238c37
-
238c37
-static struct _getopt_data getopt_data;
238c37
-
238c37
-
238c37
-#ifndef __GNU_LIBRARY__
238c37
-
238c37
-/* Avoid depending on library functions or files
238c37
-   whose names are inconsistent.  */
238c37
-
238c37
-#ifndef getenv
238c37
-extern char *getenv (
238c37
-);
238c37
-#endif
238c37
-
238c37
-#endif /* not __GNU_LIBRARY__ */
238c37
-
238c37
-#ifdef _LIBC
238c37
-/* Stored original parameters.
238c37
-   XXX This is no good solution.  We should rather copy the args so
238c37
-   that we can compare them later.  But we must not use malloc(3).  */
238c37
-extern int __libc_argc;
238c37
-extern char **__libc_argv;
238c37
-
238c37
-/* Bash 2.0 gives us an environment variable containing flags
238c37
-   indicating ARGV elements that should not be considered arguments.  */
238c37
-
238c37
-# ifdef USE_NONOPTION_FLAGS
238c37
-/* Defined in getopt_init.c  */
238c37
-extern char *__getopt_nonoption_flags;
238c37
-# endif
238c37
-
238c37
-# ifdef USE_NONOPTION_FLAGS
238c37
-#  define SWAP_FLAGS(ch1, ch2) \
238c37
-  if (d->__nonoption_flags_len > 0)					      \
238c37
-    {									      \
238c37
-      char __tmp = __getopt_nonoption_flags[ch1];			      \
238c37
-      __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2];	      \
238c37
-      __getopt_nonoption_flags[ch2] = __tmp;				      \
238c37
-    }
238c37
-# else
238c37
-#  define SWAP_FLAGS(ch1, ch2)
238c37
-# endif
238c37
-#else /* !_LIBC */
238c37
-# define SWAP_FLAGS(ch1, ch2)
238c37
-#endif /* _LIBC */
238c37
-
238c37
-/* Exchange two adjacent subsequences of ARGV.
238c37
-   One subsequence is elements [first_nonopt,last_nonopt)
238c37
-   which contains all the non-options that have been skipped so far.
238c37
-   The other is elements [last_nonopt,optind), which contains all
238c37
-   the options processed since those non-options were skipped.
238c37
-
238c37
-   `first_nonopt' and `last_nonopt' are relocated so that they describe
238c37
-   the new indices of the non-options in ARGV after they are moved.  */
238c37
-
238c37
-static void
238c37
-exchange (
238c37
-  char **argv,
238c37
-  struct _getopt_data *d
238c37
-)
238c37
-{
238c37
-  int bottom = d->__first_nonopt;
238c37
-  int middle = d->__last_nonopt;
238c37
-  int top = d->optind;
238c37
-  char *tem;
238c37
-
238c37
-  /* Exchange the shorter segment with the far end of the longer segment.
238c37
-     That puts the shorter segment into the right place.
238c37
-     It leaves the longer segment in the right place overall,
238c37
-     but it consists of two parts that need to be swapped next.  */
238c37
-
238c37
-#if defined _LIBC && defined USE_NONOPTION_FLAGS
238c37
-  /* First make sure the handling of the `__getopt_nonoption_flags'
238c37
-     string can work normally.  Our top argument must be in the range
238c37
-     of the string.  */
238c37
-  if (d->__nonoption_flags_len > 0 && top >= d->__nonoption_flags_max_len)
238c37
-    {
238c37
-      /* We must extend the array.  The user plays games with us and
238c37
-         presents new arguments.  */
238c37
-      char *new_str = malloc (top + 1);
238c37
-      if (new_str == NULL)
238c37
-	d->__nonoption_flags_len = d->__nonoption_flags_max_len = 0;
238c37
-      else
238c37
-	{
238c37
-	  memset (__mempcpy (new_str, __getopt_nonoption_flags,
238c37
-			     d->__nonoption_flags_max_len),
238c37
-		  '\0', top + 1 - d->__nonoption_flags_max_len);
238c37
-	  d->__nonoption_flags_max_len = top + 1;
238c37
-	  __getopt_nonoption_flags = new_str;
238c37
-	}
238c37
-    }
238c37
-#endif
238c37
-
238c37
-  while (top > middle && middle > bottom)
238c37
-    {
238c37
-      if (top - middle > middle - bottom)
238c37
-	{
238c37
-	  /* Bottom segment is the short one.  */
238c37
-	  int len = middle - bottom;
238c37
-	  register int i;
238c37
-
238c37
-	  /* Swap it with the top part of the top segment.  */
238c37
-	  for (i = 0; i < len; i++)
238c37
-	    {
238c37
-	      tem = argv[bottom + i];
238c37
-	      argv[bottom + i] = argv[top - (middle - bottom) + i];
238c37
-	      argv[top - (middle - bottom) + i] = tem;
238c37
-	      SWAP_FLAGS (bottom + i, top - (middle - bottom) + i);
238c37
-	    }
238c37
-	  /* Exclude the moved bottom segment from further swapping.  */
238c37
-	  top -= len;
238c37
-	}
238c37
-      else
238c37
-	{
238c37
-	  /* Top segment is the short one.  */
238c37
-	  int len = top - middle;
238c37
-	  register int i;
238c37
-
238c37
-	  /* Swap it with the bottom part of the bottom segment.  */
238c37
-	  for (i = 0; i < len; i++)
238c37
-	    {
238c37
-	      tem = argv[bottom + i];
238c37
-	      argv[bottom + i] = argv[middle + i];
238c37
-	      argv[middle + i] = tem;
238c37
-	      SWAP_FLAGS (bottom + i, middle + i);
238c37
-	    }
238c37
-	  /* Exclude the moved top segment from further swapping.  */
238c37
-	  bottom += len;
238c37
-	}
238c37
-    }
238c37
-
238c37
-  /* Update records for the slots the non-options now occupy.  */
238c37
-
238c37
-  d->__first_nonopt += (d->optind - d->__last_nonopt);
238c37
-  d->__last_nonopt = d->optind;
238c37
-}
238c37
-
238c37
-/* Initialize the internal data when the first call is made.  */
238c37
-
238c37
-static const char *
238c37
-_getopt_initialize (
238c37
-  int argc,
238c37
-  char *const *argv,
238c37
-  const char *optstring,
238c37
-  struct _getopt_data *d
238c37
-)
238c37
-{
238c37
-  /* Start processing options with ARGV-element 1 (since ARGV-element 0
238c37
-     is the program name); the sequence of previously skipped
238c37
-     non-option ARGV-elements is empty.  */
238c37
-
238c37
-  d->__first_nonopt = d->__last_nonopt = d->optind;
238c37
-
238c37
-  d->__nextchar = NULL;
238c37
-
238c37
-  d->__posixly_correct = !!getenv ("POSIXLY_CORRECT");
238c37
-
238c37
-  /* Determine how to handle the ordering of options and nonoptions.  */
238c37
-
238c37
-  if (optstring[0] == '-')
238c37
-    {
238c37
-      d->__ordering = RETURN_IN_ORDER;
238c37
-      ++optstring;
238c37
-    }
238c37
-  else if (optstring[0] == '+')
238c37
-    {
238c37
-      d->__ordering = REQUIRE_ORDER;
238c37
-      ++optstring;
238c37
-    }
238c37
-  else if (d->__posixly_correct)
238c37
-    d->__ordering = REQUIRE_ORDER;
238c37
-  else
238c37
-    d->__ordering = PERMUTE;
238c37
-
238c37
-#if defined _LIBC && defined USE_NONOPTION_FLAGS
238c37
-  if (!d->__posixly_correct && argc == __libc_argc && argv == __libc_argv)
238c37
-    {
238c37
-      if (d->__nonoption_flags_max_len == 0)
238c37
-	{
238c37
-	  if (__getopt_nonoption_flags == NULL
238c37
-	      || __getopt_nonoption_flags[0] == '\0')
238c37
-	    d->__nonoption_flags_max_len = -1;
238c37
-	  else
238c37
-	    {
238c37
-	      const char *orig_str = __getopt_nonoption_flags;
238c37
-	      int len = d->__nonoption_flags_max_len = strlen (orig_str);
238c37
-	      if (d->__nonoption_flags_max_len < argc)
238c37
-		d->__nonoption_flags_max_len = argc;
238c37
-	      __getopt_nonoption_flags =
238c37
-		(char *) malloc (d->__nonoption_flags_max_len);
238c37
-	      if (__getopt_nonoption_flags == NULL)
238c37
-		d->__nonoption_flags_max_len = -1;
238c37
-	      else
238c37
-		memset (__mempcpy (__getopt_nonoption_flags, orig_str, len),
238c37
-			'\0', d->__nonoption_flags_max_len - len);
238c37
-	    }
238c37
-	}
238c37
-      d->__nonoption_flags_len = d->__nonoption_flags_max_len;
238c37
-    }
238c37
-  else
238c37
-    d->__nonoption_flags_len = 0;
238c37
-#endif
238c37
-
238c37
-  return optstring;
238c37
-}
238c37
-
238c37
-/* Scan elements of ARGV (whose length is ARGC) for option characters
238c37
-   given in OPTSTRING.
238c37
-
238c37
-   If an element of ARGV starts with '-', and is not exactly "-" or "--",
238c37
-   then it is an option element.  The characters of this element
238c37
-   (aside from the initial '-') are option characters.  If `getopt'
238c37
-   is called repeatedly, it returns successively each of the option characters
238c37
-   from each of the option elements.
238c37
-
238c37
-   If `getopt' finds another option character, it returns that character,
238c37
-   updating `optind' and `nextchar' so that the next call to `getopt' can
238c37
-   resume the scan with the following option character or ARGV-element.
238c37
-
238c37
-   If there are no more option characters, `getopt' returns -1.
238c37
-   Then `optind' is the index in ARGV of the first ARGV-element
238c37
-   that is not an option.  (The ARGV-elements have been permuted
238c37
-   so that those that are not options now come last.)
238c37
-
238c37
-   OPTSTRING is a string containing the legitimate option characters.
238c37
-   If an option character is seen that is not listed in OPTSTRING,
238c37
-   return '?' after printing an error message.  If you set `opterr' to
238c37
-   zero, the error message is suppressed but we still return '?'.
238c37
-
238c37
-   If a char in OPTSTRING is followed by a colon, that means it wants an arg,
238c37
-   so the following text in the same ARGV-element, or the text of the following
238c37
-   ARGV-element, is returned in `optarg'.  Two colons mean an option that
238c37
-   wants an optional arg; if there is text in the current ARGV-element,
238c37
-   it is returned in `optarg', otherwise `optarg' is set to zero.
238c37
-
238c37
-   If OPTSTRING starts with `-' or `+', it requests different methods of
238c37
-   handling the non-option ARGV-elements.
238c37
-   See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
238c37
-
238c37
-   Long-named options begin with `--' instead of `-'.
238c37
-   Their names may be abbreviated as long as the abbreviation is unique
238c37
-   or is an exact match for some defined option.  If they have an
238c37
-   argument, it follows the option name in the same ARGV-element, separated
238c37
-   from the option name by a `=', or else the in next ARGV-element.
238c37
-   When `getopt' finds a long-named option, it returns 0 if that option's
238c37
-   `flag' field is nonzero, the value of the option's `val' field
238c37
-   if the `flag' field is zero.
238c37
-
238c37
-   The elements of ARGV aren't really const, because we permute them.
238c37
-   But we pretend they're const in the prototype to be compatible
238c37
-   with other systems.
238c37
-
238c37
-   LONGOPTS is a vector of `struct option' terminated by an
238c37
-   element containing a name which is zero.
238c37
-
238c37
-   LONGIND returns the index in LONGOPT of the long-named option found.
238c37
-   It is only valid when a long-named option has been found by the most
238c37
-   recent call.
238c37
-
238c37
-   If LONG_ONLY is nonzero, '-' as well as '--' can introduce
238c37
-   long-named options.  */
238c37
-
238c37
-int
238c37
-_getopt_internal_r (
238c37
-  int argc,
238c37
-  char *const *argv,
238c37
-  const char *optstring,
238c37
-  const struct option *longopts,
238c37
-  int *longind,
238c37
-  int long_only,
238c37
-  struct _getopt_data *d
238c37
-)
238c37
-{
238c37
-  int print_errors = d->opterr;
238c37
-  if (optstring[0] == ':')
238c37
-    print_errors = 0;
238c37
-
238c37
-  if (argc < 1)
238c37
-    return -1;
238c37
-
238c37
-  d->optarg = NULL;
238c37
-
238c37
-  if (d->optind == 0 || !d->__initialized)
238c37
-    {
238c37
-      if (d->optind == 0)
238c37
-	d->optind = 1;		/* Don't scan ARGV[0], the program name.  */
238c37
-      optstring = _getopt_initialize (argc, argv, optstring, d);
238c37
-      d->__initialized = 1;
238c37
-    }
238c37
-
238c37
-  /* Test whether ARGV[optind] points to a non-option argument.
238c37
-     Either it does not have option syntax, or there is an environment flag
238c37
-     from the shell indicating it is not an option.  The later information
238c37
-     is only used when the used in the GNU libc.  */
238c37
-#if defined _LIBC && defined USE_NONOPTION_FLAGS
238c37
-# define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0' \
238c37
-		      || (d->optind < d->__nonoption_flags_len		      \
238c37
-			  && __getopt_nonoption_flags[d->optind] == '1'))
238c37
-#else
238c37
-# define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0')
238c37
-#endif
238c37
-
238c37
-  if (d->__nextchar == NULL || *d->__nextchar == '\0')
238c37
-    {
238c37
-      /* Advance to the next ARGV-element.  */
238c37
-
238c37
-      /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been
238c37
-         moved back by the user (who may also have changed the arguments).  */
238c37
-      if (d->__last_nonopt > d->optind)
238c37
-	d->__last_nonopt = d->optind;
238c37
-      if (d->__first_nonopt > d->optind)
238c37
-	d->__first_nonopt = d->optind;
238c37
-
238c37
-      if (d->__ordering == PERMUTE)
238c37
-	{
238c37
-	  /* If we have just processed some options following some non-options,
238c37
-	     exchange them so that the options come first.  */
238c37
-
238c37
-	  if (d->__first_nonopt != d->__last_nonopt
238c37
-	      && d->__last_nonopt != d->optind)
238c37
-	    exchange ((char **) argv, d);
238c37
-	  else if (d->__last_nonopt != d->optind)
238c37
-	    d->__first_nonopt = d->optind;
238c37
-
238c37
-	  /* Skip any additional non-options
238c37
-	     and extend the range of non-options previously skipped.  */
238c37
-
238c37
-	  while (d->optind < argc && NONOPTION_P)
238c37
-	    d->optind++;
238c37
-	  d->__last_nonopt = d->optind;
238c37
-	}
238c37
-
238c37
-      /* The special ARGV-element `--' means premature end of options.
238c37
-         Skip it like a null option,
238c37
-         then exchange with previous non-options as if it were an option,
238c37
-         then skip everything else like a non-option.  */
238c37
-
238c37
-      if (d->optind != argc && !strcmp (argv[d->optind], "--"))
238c37
-	{
238c37
-	  d->optind++;
238c37
-
238c37
-	  if (d->__first_nonopt != d->__last_nonopt
238c37
-	      && d->__last_nonopt != d->optind)
238c37
-	    exchange ((char **) argv, d);
238c37
-	  else if (d->__first_nonopt == d->__last_nonopt)
238c37
-	    d->__first_nonopt = d->optind;
238c37
-	  d->__last_nonopt = argc;
238c37
-
238c37
-	  d->optind = argc;
238c37
-	}
238c37
-
238c37
-      /* If we have done all the ARGV-elements, stop the scan
238c37
-         and back over any non-options that we skipped and permuted.  */
238c37
-
238c37
-      if (d->optind == argc)
238c37
-	{
238c37
-	  /* Set the next-arg-index to point at the non-options
238c37
-	     that we previously skipped, so the caller will digest them.  */
238c37
-	  if (d->__first_nonopt != d->__last_nonopt)
238c37
-	    d->optind = d->__first_nonopt;
238c37
-	  return -1;
238c37
-	}
238c37
-
238c37
-      /* If we have come to a non-option and did not permute it,
238c37
-         either stop the scan or describe it to the caller and pass it by.  */
238c37
-
238c37
-      if (NONOPTION_P)
238c37
-	{
238c37
-	  if (d->__ordering == REQUIRE_ORDER)
238c37
-	    return -1;
238c37
-	  d->optarg = argv[d->optind++];
238c37
-	  return 1;
238c37
-	}
238c37
-
238c37
-      /* We have found another option-ARGV-element.
238c37
-         Skip the initial punctuation.  */
238c37
-
238c37
-      d->__nextchar = (argv[d->optind] + 1
238c37
-		       + (longopts != NULL && argv[d->optind][1] == '-'));
238c37
-    }
238c37
-
238c37
-  /* Decode the current option-ARGV-element.  */
238c37
-
238c37
-  /* Check whether the ARGV-element is a long option.
238c37
-
238c37
-     If long_only and the ARGV-element has the form "-f", where f is
238c37
-     a valid short option, don't consider it an abbreviated form of
238c37
-     a long option that starts with f.  Otherwise there would be no
238c37
-     way to give the -f short option.
238c37
-
238c37
-     On the other hand, if there's a long option "fubar" and
238c37
-     the ARGV-element is "-fu", do consider that an abbreviation of
238c37
-     the long option, just like "--fu", and not "-f" with arg "u".
238c37
-
238c37
-     This distinction seems to be the most useful approach.  */
238c37
-
238c37
-  if (longopts != NULL
238c37
-      && (argv[d->optind][1] == '-'
238c37
-	  || (long_only && (argv[d->optind][2]
238c37
-			    || !strchr (optstring, argv[d->optind][1])))))
238c37
-    {
238c37
-      char *nameend;
238c37
-      const struct option *p;
238c37
-      const struct option *pfound = NULL;
238c37
-      int exact = 0;
238c37
-      int ambig = 0;
238c37
-      int indfound = -1;
238c37
-      int option_index;
238c37
-
238c37
-      for (nameend = d->__nextchar; *nameend && *nameend != '='; nameend++)
238c37
-	/* Do nothing.  */ ;
238c37
-
238c37
-      /* Test all long options for either exact match
238c37
-         or abbreviated matches.  */
238c37
-      for (p = longopts, option_index = 0; p->name; p++, option_index++)
238c37
-	if (!strncmp (p->name, d->__nextchar, nameend - d->__nextchar))
238c37
-	  {
238c37
-	    if ((unsigned int) (nameend - d->__nextchar)
238c37
-		== (unsigned int) strlen (p->name))
238c37
-	      {
238c37
-		/* Exact match found.  */
238c37
-		pfound = p;
238c37
-		indfound = option_index;
238c37
-		exact = 1;
238c37
-		break;
238c37
-	      }
238c37
-	    else if (pfound == NULL)
238c37
-	      {
238c37
-		/* First nonexact match found.  */
238c37
-		pfound = p;
238c37
-		indfound = option_index;
238c37
-	      }
238c37
-	    else if (long_only
238c37
-		     || pfound->has_arg != p->has_arg
238c37
-		     || pfound->flag != p->flag || pfound->val != p->val)
238c37
-	      /* Second or later nonexact match found.  */
238c37
-	      ambig = 1;
238c37
-	  }
238c37
-
238c37
-      if (ambig && !exact)
238c37
-	{
238c37
-	  if (print_errors)
238c37
-	    {
238c37
-#if defined _LIBC && defined USE_IN_LIBIO
238c37
-	      char *buf;
238c37
-
238c37
-	      if (__asprintf (&buf, _("%s: option `%s' is ambiguous\n"),
238c37
-			      argv[0], argv[d->optind]) >= 0)
238c37
-		{
238c37
-		  _IO_flockfile (stderr);
238c37
-
238c37
-		  int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
238c37
-		  ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
238c37
-
238c37
-		  if (_IO_fwide (stderr, 0) > 0)
238c37
-		    __fwprintf (stderr, L"%s", buf);
238c37
-		  else
238c37
-		    fputs (buf, stderr);
238c37
-
238c37
-		  ((_IO_FILE *) stderr)->_flags2 = old_flags2;
238c37
-		  _IO_funlockfile (stderr);
238c37
-
238c37
-		  free (buf);
238c37
-		}
238c37
-#else
238c37
-	      fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
238c37
-		       argv[0], argv[d->optind]);
238c37
-#endif
238c37
-	    }
238c37
-	  d->__nextchar += strlen (d->__nextchar);
238c37
-	  d->optind++;
238c37
-	  d->optopt = 0;
238c37
-	  return '?';
238c37
-	}
238c37
-
238c37
-      if (pfound != NULL)
238c37
-	{
238c37
-	  option_index = indfound;
238c37
-	  d->optind++;
238c37
-	  if (*nameend)
238c37
-	    {
238c37
-	      /* Don't test has_arg with >, because some C compilers don't
238c37
-	         allow it to be used on enums.  */
238c37
-	      if (pfound->has_arg)
238c37
-		d->optarg = nameend + 1;
238c37
-	      else
238c37
-		{
238c37
-		  if (print_errors)
238c37
-		    {
238c37
-#if defined _LIBC && defined USE_IN_LIBIO
238c37
-		      char *buf;
238c37
-		      int n;
238c37
-#endif
238c37
-
238c37
-		      if (argv[d->optind - 1][1] == '-')
238c37
-			{
238c37
-			  /* --option */
238c37
-#if defined _LIBC && defined USE_IN_LIBIO
238c37
-			  n = __asprintf (&buf, _("\
238c37
-%s: option `--%s' doesn't allow an argument\n"), argv[0], pfound->name);
238c37
-#else
238c37
-			  fprintf (stderr, _("\
238c37
-%s: option `--%s' doesn't allow an argument\n"), argv[0], pfound->name);
238c37
-#endif
238c37
-			}
238c37
-		      else
238c37
-			{
238c37
-			  /* +option or -option */
238c37
-#if defined _LIBC && defined USE_IN_LIBIO
238c37
-			  n = __asprintf (&buf, _("\
238c37
-%s: option `%c%s' doesn't allow an argument\n"), argv[0], argv[d->optind - 1][0], pfound->name);
238c37
-#else
238c37
-			  fprintf (stderr, _("\
238c37
-%s: option `%c%s' doesn't allow an argument\n"), argv[0], argv[d->optind - 1][0], pfound->name);
238c37
-#endif
238c37
-			}
238c37
-
238c37
-#if defined _LIBC && defined USE_IN_LIBIO
238c37
-		      if (n >= 0)
238c37
-			{
238c37
-			  _IO_flockfile (stderr);
238c37
-
238c37
-			  int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
238c37
-			  ((_IO_FILE *) stderr)->_flags2
238c37
-			    |= _IO_FLAGS2_NOTCANCEL;
238c37
-
238c37
-			  if (_IO_fwide (stderr, 0) > 0)
238c37
-			    __fwprintf (stderr, L"%s", buf);
238c37
-			  else
238c37
-			    fputs (buf, stderr);
238c37
-
238c37
-			  ((_IO_FILE *) stderr)->_flags2 = old_flags2;
238c37
-			  _IO_funlockfile (stderr);
238c37
-
238c37
-			  free (buf);
238c37
-			}
238c37
-#endif
238c37
-		    }
238c37
-
238c37
-		  d->__nextchar += strlen (d->__nextchar);
238c37
-
238c37
-		  d->optopt = pfound->val;
238c37
-		  return '?';
238c37
-		}
238c37
-	    }
238c37
-	  else if (pfound->has_arg == 1)
238c37
-	    {
238c37
-	      if (d->optind < argc)
238c37
-		d->optarg = argv[d->optind++];
238c37
-	      else
238c37
-		{
238c37
-		  if (print_errors)
238c37
-		    {
238c37
-#if defined _LIBC && defined USE_IN_LIBIO
238c37
-		      char *buf;
238c37
-
238c37
-		      if (__asprintf (&buf, _("\
238c37
-%s: option `%s' requires an argument\n"), argv[0], argv[d->optind - 1]) >= 0)
238c37
-			{
238c37
-			  _IO_flockfile (stderr);
238c37
-
238c37
-			  int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
238c37
-			  ((_IO_FILE *) stderr)->_flags2
238c37
-			    |= _IO_FLAGS2_NOTCANCEL;
238c37
-
238c37
-			  if (_IO_fwide (stderr, 0) > 0)
238c37
-			    __fwprintf (stderr, L"%s", buf);
238c37
-			  else
238c37
-			    fputs (buf, stderr);
238c37
-
238c37
-			  ((_IO_FILE *) stderr)->_flags2 = old_flags2;
238c37
-			  _IO_funlockfile (stderr);
238c37
-
238c37
-			  free (buf);
238c37
-			}
238c37
-#else
238c37
-		      fprintf (stderr,
238c37
-			       _("%s: option `%s' requires an argument\n"),
238c37
-			       argv[0], argv[d->optind - 1]);
238c37
-#endif
238c37
-		    }
238c37
-		  d->__nextchar += strlen (d->__nextchar);
238c37
-		  d->optopt = pfound->val;
238c37
-		  return optstring[0] == ':' ? ':' : '?';
238c37
-		}
238c37
-	    }
238c37
-	  d->__nextchar += strlen (d->__nextchar);
238c37
-	  if (longind != NULL)
238c37
-	    *longind = option_index;
238c37
-	  if (pfound->flag)
238c37
-	    {
238c37
-	      *(pfound->flag) = pfound->val;
238c37
-	      return 0;
238c37
-	    }
238c37
-	  return pfound->val;
238c37
-	}
238c37
-
238c37
-      /* Can't find it as a long option.  If this is not getopt_long_only,
238c37
-         or the option starts with '--' or is not a valid short
238c37
-         option, then it's an error.
238c37
-         Otherwise interpret it as a short option.  */
238c37
-      if (!long_only || argv[d->optind][1] == '-'
238c37
-	  || strchr (optstring, *d->__nextchar) == NULL)
238c37
-	{
238c37
-	  if (print_errors)
238c37
-	    {
238c37
-#if defined _LIBC && defined USE_IN_LIBIO
238c37
-	      char *buf;
238c37
-	      int n;
238c37
-#endif
238c37
-
238c37
-	      if (argv[d->optind][1] == '-')
238c37
-		{
238c37
-		  /* --option */
238c37
-#if defined _LIBC && defined USE_IN_LIBIO
238c37
-		  n = __asprintf (&buf, _("%s: unrecognized option `--%s'\n"),
238c37
-				  argv[0], d->__nextchar);
238c37
-#else
238c37
-		  fprintf (stderr, _("%s: unrecognized option `--%s'\n"),
238c37
-			   argv[0], d->__nextchar);
238c37
-#endif
238c37
-		}
238c37
-	      else
238c37
-		{
238c37
-		  /* +option or -option */
238c37
-#if defined _LIBC && defined USE_IN_LIBIO
238c37
-		  n = __asprintf (&buf, _("%s: unrecognized option `%c%s'\n"),
238c37
-				  argv[0], argv[d->optind][0], d->__nextchar);
238c37
-#else
238c37
-		  fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),
238c37
-			   argv[0], argv[d->optind][0], d->__nextchar);
238c37
-#endif
238c37
-		}
238c37
-
238c37
-#if defined _LIBC && defined USE_IN_LIBIO
238c37
-	      if (n >= 0)
238c37
-		{
238c37
-		  _IO_flockfile (stderr);
238c37
-
238c37
-		  int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
238c37
-		  ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
238c37
-
238c37
-		  if (_IO_fwide (stderr, 0) > 0)
238c37
-		    __fwprintf (stderr, L"%s", buf);
238c37
-		  else
238c37
-		    fputs (buf, stderr);
238c37
-
238c37
-		  ((_IO_FILE *) stderr)->_flags2 = old_flags2;
238c37
-		  _IO_funlockfile (stderr);
238c37
-
238c37
-		  free (buf);
238c37
-		}
238c37
-#endif
238c37
-	    }
238c37
-	  d->__nextchar = (char *) "";
238c37
-	  d->optind++;
238c37
-	  d->optopt = 0;
238c37
-	  return '?';
238c37
-	}
238c37
-    }
238c37
-
238c37
-  /* Look at and handle the next short option-character.  */
238c37
-
238c37
-  {
238c37
-    char c = *d->__nextchar++;
238c37
-    char *temp = strchr (optstring, c);
238c37
-
238c37
-    /* Increment `optind' when we start to process its last character.  */
238c37
-    if (*d->__nextchar == '\0')
238c37
-      ++d->optind;
238c37
-
238c37
-    if (temp == NULL || c == ':')
238c37
-      {
238c37
-	if (print_errors)
238c37
-	  {
238c37
-#if defined _LIBC && defined USE_IN_LIBIO
238c37
-	    char *buf;
238c37
-	    int n;
238c37
-#endif
238c37
-
238c37
-	    if (d->__posixly_correct)
238c37
-	      {
238c37
-		/* 1003.2 specifies the format of this message.  */
238c37
-#if defined _LIBC && defined USE_IN_LIBIO
238c37
-		n = __asprintf (&buf, _("%s: illegal option -- %c\n"),
238c37
-				argv[0], c);
238c37
-#else
238c37
-		fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c);
238c37
-#endif
238c37
-	      }
238c37
-	    else
238c37
-	      {
238c37
-#if defined _LIBC && defined USE_IN_LIBIO
238c37
-		n = __asprintf (&buf, _("%s: invalid option -- %c\n"),
238c37
-				argv[0], c);
238c37
-#else
238c37
-		fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c);
238c37
-#endif
238c37
-	      }
238c37
-
238c37
-#if defined _LIBC && defined USE_IN_LIBIO
238c37
-	    if (n >= 0)
238c37
-	      {
238c37
-		_IO_flockfile (stderr);
238c37
-
238c37
-		int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
238c37
-		((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
238c37
-
238c37
-		if (_IO_fwide (stderr, 0) > 0)
238c37
-		  __fwprintf (stderr, L"%s", buf);
238c37
-		else
238c37
-		  fputs (buf, stderr);
238c37
-
238c37
-		((_IO_FILE *) stderr)->_flags2 = old_flags2;
238c37
-		_IO_funlockfile (stderr);
238c37
-
238c37
-		free (buf);
238c37
-	      }
238c37
-#endif
238c37
-	  }
238c37
-	d->optopt = c;
238c37
-	return '?';
238c37
-      }
238c37
-    /* Convenience. Treat POSIX -W foo same as long option --foo */
238c37
-    if (temp[0] == 'W' && temp[1] == ';')
238c37
-      {
238c37
-	char *nameend;
238c37
-	const struct option *p;
238c37
-	const struct option *pfound = NULL;
238c37
-	int exact = 0;
238c37
-	int ambig = 0;
238c37
-	int indfound = 0;
238c37
-	int option_index;
238c37
-
238c37
-	/* This is an option that requires an argument.  */
238c37
-	if (*d->__nextchar != '\0')
238c37
-	  {
238c37
-	    d->optarg = d->__nextchar;
238c37
-	    /* If we end this ARGV-element by taking the rest as an arg,
238c37
-	       we must advance to the next element now.  */
238c37
-	    d->optind++;
238c37
-	  }
238c37
-	else if (d->optind == argc)
238c37
-	  {
238c37
-	    if (print_errors)
238c37
-	      {
238c37
-		/* 1003.2 specifies the format of this message.  */
238c37
-#if defined _LIBC && defined USE_IN_LIBIO
238c37
-		char *buf;
238c37
-
238c37
-		if (__asprintf (&buf,
238c37
-				_("%s: option requires an argument -- %c\n"),
238c37
-				argv[0], c) >= 0)
238c37
-		  {
238c37
-		    _IO_flockfile (stderr);
238c37
-
238c37
-		    int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
238c37
-		    ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
238c37
-
238c37
-		    if (_IO_fwide (stderr, 0) > 0)
238c37
-		      __fwprintf (stderr, L"%s", buf);
238c37
-		    else
238c37
-		      fputs (buf, stderr);
238c37
-
238c37
-		    ((_IO_FILE *) stderr)->_flags2 = old_flags2;
238c37
-		    _IO_funlockfile (stderr);
238c37
-
238c37
-		    free (buf);
238c37
-		  }
238c37
-#else
238c37
-		fprintf (stderr, _("%s: option requires an argument -- %c\n"),
238c37
-			 argv[0], c);
238c37
-#endif
238c37
-	      }
238c37
-	    d->optopt = c;
238c37
-	    if (optstring[0] == ':')
238c37
-	      c = ':';
238c37
-	    else
238c37
-	      c = '?';
238c37
-	    return c;
238c37
-	  }
238c37
-	else
238c37
-	  /* We already incremented `d->optind' once;
238c37
-	     increment it again when taking next ARGV-elt as argument.  */
238c37
-	  d->optarg = argv[d->optind++];
238c37
-
238c37
-	/* optarg is now the argument, see if it's in the
238c37
-	   table of longopts.  */
238c37
-
238c37
-	for (d->__nextchar = nameend = d->optarg; *nameend && *nameend != '=';
238c37
-	     nameend++)
238c37
-	  /* Do nothing.  */ ;
238c37
-
238c37
-	/* Test all long options for either exact match
238c37
-	   or abbreviated matches.  */
238c37
-	for (p = longopts, option_index = 0; p->name; p++, option_index++)
238c37
-	  if (!strncmp (p->name, d->__nextchar, nameend - d->__nextchar))
238c37
-	    {
238c37
-	      if ((unsigned int) (nameend - d->__nextchar) ==
238c37
-		  strlen (p->name))
238c37
-		{
238c37
-		  /* Exact match found.  */
238c37
-		  pfound = p;
238c37
-		  indfound = option_index;
238c37
-		  exact = 1;
238c37
-		  break;
238c37
-		}
238c37
-	      else if (pfound == NULL)
238c37
-		{
238c37
-		  /* First nonexact match found.  */
238c37
-		  pfound = p;
238c37
-		  indfound = option_index;
238c37
-		}
238c37
-	      else
238c37
-		/* Second or later nonexact match found.  */
238c37
-		ambig = 1;
238c37
-	    }
238c37
-	if (ambig && !exact)
238c37
-	  {
238c37
-	    if (print_errors)
238c37
-	      {
238c37
-#if defined _LIBC && defined USE_IN_LIBIO
238c37
-		char *buf;
238c37
-
238c37
-		if (__asprintf (&buf, _("%s: option `-W %s' is ambiguous\n"),
238c37
-				argv[0], argv[d->optind]) >= 0)
238c37
-		  {
238c37
-		    _IO_flockfile (stderr);
238c37
-
238c37
-		    int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
238c37
-		    ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
238c37
-
238c37
-		    if (_IO_fwide (stderr, 0) > 0)
238c37
-		      __fwprintf (stderr, L"%s", buf);
238c37
-		    else
238c37
-		      fputs (buf, stderr);
238c37
-
238c37
-		    ((_IO_FILE *) stderr)->_flags2 = old_flags2;
238c37
-		    _IO_funlockfile (stderr);
238c37
-
238c37
-		    free (buf);
238c37
-		  }
238c37
-#else
238c37
-		fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"),
238c37
-			 argv[0], argv[d->optind]);
238c37
-#endif
238c37
-	      }
238c37
-	    d->__nextchar += strlen (d->__nextchar);
238c37
-	    d->optind++;
238c37
-	    return '?';
238c37
-	  }
238c37
-	if (pfound != NULL)
238c37
-	  {
238c37
-	    option_index = indfound;
238c37
-	    if (*nameend)
238c37
-	      {
238c37
-		/* Don't test has_arg with >, because some C compilers don't
238c37
-		   allow it to be used on enums.  */
238c37
-		if (pfound->has_arg)
238c37
-		  d->optarg = nameend + 1;
238c37
-		else
238c37
-		  {
238c37
-		    if (print_errors)
238c37
-		      {
238c37
-#if defined _LIBC && defined USE_IN_LIBIO
238c37
-			char *buf;
238c37
-
238c37
-			if (__asprintf (&buf, _("\
238c37
-%s: option `-W %s' doesn't allow an argument\n"), argv[0], pfound->name) >= 0)
238c37
-			  {
238c37
-			    _IO_flockfile (stderr);
238c37
-
238c37
-			    int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
238c37
-			    ((_IO_FILE *) stderr)->_flags2
238c37
-			      |= _IO_FLAGS2_NOTCANCEL;
238c37
-
238c37
-			    if (_IO_fwide (stderr, 0) > 0)
238c37
-			      __fwprintf (stderr, L"%s", buf);
238c37
-			    else
238c37
-			      fputs (buf, stderr);
238c37
-
238c37
-			    ((_IO_FILE *) stderr)->_flags2 = old_flags2;
238c37
-			    _IO_funlockfile (stderr);
238c37
-
238c37
-			    free (buf);
238c37
-			  }
238c37
-#else
238c37
-			fprintf (stderr, _("\
238c37
-%s: option `-W %s' doesn't allow an argument\n"), argv[0], pfound->name);
238c37
-#endif
238c37
-		      }
238c37
-
238c37
-		    d->__nextchar += strlen (d->__nextchar);
238c37
-		    return '?';
238c37
-		  }
238c37
-	      }
238c37
-	    else if (pfound->has_arg == 1)
238c37
-	      {
238c37
-		if (d->optind < argc)
238c37
-		  d->optarg = argv[d->optind++];
238c37
-		else
238c37
-		  {
238c37
-		    if (print_errors)
238c37
-		      {
238c37
-#if defined _LIBC && defined USE_IN_LIBIO
238c37
-			char *buf;
238c37
-
238c37
-			if (__asprintf (&buf, _("\
238c37
-%s: option `%s' requires an argument\n"), argv[0], argv[d->optind - 1]) >= 0)
238c37
-			  {
238c37
-			    _IO_flockfile (stderr);
238c37
-
238c37
-			    int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
238c37
-			    ((_IO_FILE *) stderr)->_flags2
238c37
-			      |= _IO_FLAGS2_NOTCANCEL;
238c37
-
238c37
-			    if (_IO_fwide (stderr, 0) > 0)
238c37
-			      __fwprintf (stderr, L"%s", buf);
238c37
-			    else
238c37
-			      fputs (buf, stderr);
238c37
-
238c37
-			    ((_IO_FILE *) stderr)->_flags2 = old_flags2;
238c37
-			    _IO_funlockfile (stderr);
238c37
-
238c37
-			    free (buf);
238c37
-			  }
238c37
-#else
238c37
-			fprintf (stderr,
238c37
-				 _("%s: option `%s' requires an argument\n"),
238c37
-				 argv[0], argv[d->optind - 1]);
238c37
-#endif
238c37
-		      }
238c37
-		    d->__nextchar += strlen (d->__nextchar);
238c37
-		    return optstring[0] == ':' ? ':' : '?';
238c37
-		  }
238c37
-	      }
238c37
-	    d->__nextchar += strlen (d->__nextchar);
238c37
-	    if (longind != NULL)
238c37
-	      *longind = option_index;
238c37
-	    if (pfound->flag)
238c37
-	      {
238c37
-		*(pfound->flag) = pfound->val;
238c37
-		return 0;
238c37
-	      }
238c37
-	    return pfound->val;
238c37
-	  }
238c37
-	d->__nextchar = NULL;
238c37
-	return 'W';		/* Let the application handle it.   */
238c37
-      }
238c37
-    if (temp[1] == ':')
238c37
-      {
238c37
-	if (temp[2] == ':')
238c37
-	  {
238c37
-	    /* This is an option that accepts an argument optionally.  */
238c37
-	    if (*d->__nextchar != '\0')
238c37
-	      {
238c37
-		d->optarg = d->__nextchar;
238c37
-		d->optind++;
238c37
-	      }
238c37
-	    else
238c37
-	      d->optarg = NULL;
238c37
-	    d->__nextchar = NULL;
238c37
-	  }
238c37
-	else
238c37
-	  {
238c37
-	    /* This is an option that requires an argument.  */
238c37
-	    if (*d->__nextchar != '\0')
238c37
-	      {
238c37
-		d->optarg = d->__nextchar;
238c37
-		/* If we end this ARGV-element by taking the rest as an arg,
238c37
-		   we must advance to the next element now.  */
238c37
-		d->optind++;
238c37
-	      }
238c37
-	    else if (d->optind == argc)
238c37
-	      {
238c37
-		if (print_errors)
238c37
-		  {
238c37
-		    /* 1003.2 specifies the format of this message.  */
238c37
-#if defined _LIBC && defined USE_IN_LIBIO
238c37
-		    char *buf;
238c37
-
238c37
-		    if (__asprintf (&buf, _("\
238c37
-%s: option requires an argument -- %c\n"), argv[0], c) >= 0)
238c37
-		      {
238c37
-			_IO_flockfile (stderr);
238c37
-
238c37
-			int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
238c37
-			((_IO_FILE *) stderr)->_flags2 |=
238c37
-			  _IO_FLAGS2_NOTCANCEL;
238c37
-
238c37
-			if (_IO_fwide (stderr, 0) > 0)
238c37
-			  __fwprintf (stderr, L"%s", buf);
238c37
-			else
238c37
-			  fputs (buf, stderr);
238c37
-
238c37
-			((_IO_FILE *) stderr)->_flags2 = old_flags2;
238c37
-			_IO_funlockfile (stderr);
238c37
-
238c37
-			free (buf);
238c37
-		      }
238c37
-#else
238c37
-		    fprintf (stderr,
238c37
-			     _("%s: option requires an argument -- %c\n"),
238c37
-			     argv[0], c);
238c37
-#endif
238c37
-		  }
238c37
-		d->optopt = c;
238c37
-		if (optstring[0] == ':')
238c37
-		  c = ':';
238c37
-		else
238c37
-		  c = '?';
238c37
-	      }
238c37
-	    else
238c37
-	      /* We already incremented `optind' once;
238c37
-	         increment it again when taking next ARGV-elt as argument.  */
238c37
-	      d->optarg = argv[d->optind++];
238c37
-	    d->__nextchar = NULL;
238c37
-	  }
238c37
-      }
238c37
-    return c;
238c37
-  }
238c37
-}
238c37
-
238c37
-int
238c37
-_getopt_internal (
238c37
-  int argc,
238c37
-  char *const *argv,
238c37
-  const char *optstring,
238c37
-  const struct option *longopts,
238c37
-  int *longind,
238c37
-  int long_only
238c37
-)
238c37
-{
238c37
-  int result;
238c37
-
238c37
-  getopt_data.optind = optind;
238c37
-  getopt_data.opterr = opterr;
238c37
-
238c37
-  result = _getopt_internal_r (argc, argv, optstring, longopts,
238c37
-			       longind, long_only, &getopt_data);
238c37
-
238c37
-  optind = getopt_data.optind;
238c37
-  optarg = getopt_data.optarg;
238c37
-  optopt = getopt_data.optopt;
238c37
-
238c37
-  return result;
238c37
-}
238c37
-
238c37
-int
238c37
-getopt (
238c37
-  int argc,
238c37
-  char *const *argv,
238c37
-  const char *optstring
238c37
-)
238c37
-{
238c37
-  return _getopt_internal (argc, argv, optstring,
238c37
-			   (const struct option *) 0, (int *) 0, 0);
238c37
-}
238c37
-
238c37
-#endif /* Not ELIDE_CODE.  */
238c37
-
238c37
-#ifdef TEST
238c37
-
238c37
-/* Compile with -DTEST to make an executable for use in testing
238c37
-   the above definition of `getopt'.  */
238c37
-
238c37
-int
238c37
-main (
238c37
-  int argc,
238c37
-  char **argv
238c37
-)
238c37
-{
238c37
-  int c;
238c37
-  int digit_optind = 0;
238c37
-
238c37
-  while (1)
238c37
-    {
238c37
-      int this_option_optind = optind ? optind : 1;
238c37
-
238c37
-      c = getopt (argc, argv, "abc:d:0123456789");
238c37
-      if (c == -1)
238c37
-	break;
238c37
-
238c37
-      switch (c)
238c37
-	{
238c37
-	case '0':
238c37
-	case '1':
238c37
-	case '2':
238c37
-	case '3':
238c37
-	case '4':
238c37
-	case '5':
238c37
-	case '6':
238c37
-	case '7':
238c37
-	case '8':
238c37
-	case '9':
238c37
-	  if (digit_optind != 0 && digit_optind != this_option_optind)
238c37
-	    printf ("digits occur in two different argv-elements.\n");
238c37
-	  digit_optind = this_option_optind;
238c37
-	  printf ("option %c\n", c);
238c37
-	  break;
238c37
-
238c37
-	case 'a':
238c37
-	  printf ("option a\n");
238c37
-	  break;
238c37
-
238c37
-	case 'b':
238c37
-	  printf ("option b\n");
238c37
-	  break;
238c37
-
238c37
-	case 'c':
238c37
-	  printf ("option c with value `%s'\n", optarg);
238c37
-	  break;
238c37
-
238c37
-	case '?':
238c37
-	  break;
238c37
-
238c37
-	default:
238c37
-	  printf ("?? getopt returned character code 0%o ??\n", c);
238c37
-	}
238c37
-    }
238c37
-
238c37
-  if (optind < argc)
238c37
-    {
238c37
-      printf ("non-option ARGV-elements: ");
238c37
-      while (optind < argc)
238c37
-	printf ("%s ", argv[optind++]);
238c37
-      printf ("\n");
238c37
-    }
238c37
-
238c37
-  exit (0);
238c37
-}
238c37
-
238c37
-#endif /* TEST */
238c37
diff -pruN fribidi-1.0.10.orig/bin/getopt.h fribidi-1.0.10/bin/getopt.h
238c37
--- fribidi-1.0.10.orig/bin/getopt.h	2015-08-05 03:49:07.000000000 +0900
238c37
+++ fribidi-1.0.10/bin/getopt.h	1970-01-01 09:00:00.000000000 +0900
238c37
@@ -1,187 +0,0 @@
238c37
-/* Declarations for getopt.
238c37
-   Copyright (C) 1989-1994,1996-1999,2001,2003,2004
238c37
-   Free Software Foundation, Inc.
238c37
-   This file is part of the GNU C Library.
238c37
-
238c37
-   This program is free software; you can redistribute it and/or modify
238c37
-   it under the terms of the GNU General Public License as published by
238c37
-   the Free Software Foundation; either version 2, or (at your option)
238c37
-   any later version.
238c37
-
238c37
-   This program is distributed in the hope that it will be useful,
238c37
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
238c37
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
238c37
-   GNU General Public License for more details.
238c37
-
238c37
-   You should have received a copy of the GNU General Public License along
238c37
-   with this program; if not, write to the Free Software Foundation,
238c37
-   Inc., 59 Temple Place - Suite 330, Boston, MA 02110-1301, USA.  */
238c37
-
238c37
-#ifndef _GETOPT_H
238c37
-
238c37
-#ifndef __need_getopt
238c37
-# define _GETOPT_H 1
238c37
-#endif
238c37
-
238c37
-/* If __GNU_LIBRARY__ is not already defined, either we are being used
238c37
-   standalone, or this is the first header included in the source file.
238c37
-   If we are being used with glibc, we need to include <features.h>, but
238c37
-   that does not exist if we are standalone.  So: if __GNU_LIBRARY__ is
238c37
-   not defined, include <ctype.h>, which will pull in <features.h> for us
238c37
-   if it's from glibc.  (Why ctype.h?  It's guaranteed to exist and it
238c37
-   doesn't flood the namespace with stuff the way some other headers do.)  */
238c37
-#if !defined __GNU_LIBRARY__
238c37
-# include <ctype.h>
238c37
-#endif
238c37
-
238c37
-#ifndef __THROW
238c37
-# ifndef __GNUC_PREREQ
238c37
-#  define __GNUC_PREREQ(maj, min) (0)
238c37
-# endif
238c37
-# if defined __cplusplus && __GNUC_PREREQ (2,8)
238c37
-#  define __THROW	throw ()
238c37
-# else
238c37
-#  define __THROW
238c37
-# endif
238c37
-#endif
238c37
-
238c37
-#ifdef	__cplusplus
238c37
-extern "C"
238c37
-{
238c37
-#endif
238c37
-
238c37
-/* For communication from `getopt' to the caller.
238c37
-   When `getopt' finds an option that takes an argument,
238c37
-   the argument value is returned here.
238c37
-   Also, when `ordering' is RETURN_IN_ORDER,
238c37
-   each non-option ARGV-element is returned here.  */
238c37
-
238c37
-  extern char *optarg;
238c37
-
238c37
-/* Index in ARGV of the next element to be scanned.
238c37
-   This is used for communication to and from the caller
238c37
-   and for communication between successive calls to `getopt'.
238c37
-
238c37
-   On entry to `getopt', zero means this is the first call; initialize.
238c37
-
238c37
-   When `getopt' returns -1, this is the index of the first of the
238c37
-   non-option elements that the caller should itself scan.
238c37
-
238c37
-   Otherwise, `optind' communicates from one call to the next
238c37
-   how much of ARGV has been scanned so far.  */
238c37
-
238c37
-  extern int optind;
238c37
-
238c37
-/* Callers store zero here to inhibit the error message `getopt' prints
238c37
-   for unrecognized options.  */
238c37
-
238c37
-  extern int opterr;
238c37
-
238c37
-/* Set to an option character which was unrecognized.  */
238c37
-
238c37
-  extern int optopt;
238c37
-
238c37
-#ifndef __need_getopt
238c37
-/* Describe the long-named options requested by the application.
238c37
-   The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
238c37
-   of `struct option' terminated by an element containing a name which is
238c37
-   zero.
238c37
-
238c37
-   The field `has_arg' is:
238c37
-   no_argument		(or 0) if the option does not take an argument,
238c37
-   required_argument	(or 1) if the option requires an argument,
238c37
-   optional_argument 	(or 2) if the option takes an optional argument.
238c37
-
238c37
-   If the field `flag' is not NULL, it points to a variable that is set
238c37
-   to the value given in the field `val' when the option is found, but
238c37
-   left unchanged if the option is not found.
238c37
-
238c37
-   To have a long-named option do something other than set an `int' to
238c37
-   a compiled-in constant, such as set a value from `optarg', set the
238c37
-   option's `flag' field to zero and its `val' field to a nonzero
238c37
-   value (the equivalent single-letter option character, if there is
238c37
-   one).  For long options that have a zero `flag' field, `getopt'
238c37
-   returns the contents of the `val' field.  */
238c37
-
238c37
-  struct option
238c37
-  {
238c37
-    const char *name;
238c37
-    /* has_arg can't be an enum because some compilers complain about
238c37
-       type mismatches in all the code that assumes it is an int.  */
238c37
-    int has_arg;
238c37
-    int *flag;
238c37
-    int val;
238c37
-  };
238c37
-
238c37
-/* Names for the values of the `has_arg' field of `struct option'.  */
238c37
-
238c37
-# define no_argument		0
238c37
-# define required_argument	1
238c37
-# define optional_argument	2
238c37
-#endif				/* need getopt */
238c37
-
238c37
-
238c37
-/* Get definitions and prototypes for functions to process the
238c37
-   arguments in ARGV (ARGC of them, minus the program name) for
238c37
-   options given in OPTS.
238c37
-
238c37
-   Return the option character from OPTS just read.  Return -1 when
238c37
-   there are no more options.  For unrecognized options, or options
238c37
-   missing arguments, `optopt' is set to the option letter, and '?' is
238c37
-   returned.
238c37
-
238c37
-   The OPTS string is a list of characters which are recognized option
238c37
-   letters, optionally followed by colons, specifying that that letter
238c37
-   takes an argument, to be placed in `optarg'.
238c37
-
238c37
-   If a letter in OPTS is followed by two colons, its argument is
238c37
-   optional.  This behavior is specific to the GNU `getopt'.
238c37
-
238c37
-   The argument `--' causes premature termination of argument
238c37
-   scanning, explicitly telling `getopt' that there are no more
238c37
-   options.
238c37
-
238c37
-   If OPTS begins with `--', then non-option arguments are treated as
238c37
-   arguments to the option '\0'.  This behavior is specific to the GNU
238c37
-   `getopt'.  */
238c37
-
238c37
-#ifdef __GNU_LIBRARY__
238c37
-/* Many other libraries have conflicting prototypes for getopt, with
238c37
-   differences in the consts, in stdlib.h.  To avoid compilation
238c37
-   errors, only prototype getopt for the GNU C library.  */
238c37
-  extern int getopt (
238c37
-  int ___argc,
238c37
-  char *const *___argv,
238c37
-  const char *__shortopts
238c37
-  ) __THROW;
238c37
-#else				/* not __GNU_LIBRARY__ */
238c37
-  extern int getopt (
238c37
-  );
238c37
-#endif				/* __GNU_LIBRARY__ */
238c37
-
238c37
-#ifndef __need_getopt
238c37
-  extern int getopt_long (
238c37
-  int ___argc,
238c37
-  char *const *___argv,
238c37
-  const char *__shortopts,
238c37
-  const struct option *__longopts,
238c37
-  int *__longind
238c37
-  ) __THROW;
238c37
-  extern int getopt_long_only (
238c37
-  int ___argc,
238c37
-  char *const *___argv,
238c37
-  const char *__shortopts,
238c37
-  const struct option *__longopts,
238c37
-  int *__longind
238c37
-  ) __THROW;
238c37
-
238c37
-#endif
238c37
-
238c37
-#ifdef	__cplusplus
238c37
-}
238c37
-#endif
238c37
-
238c37
-/* Make sure we later can get all the definitions and declarations.  */
238c37
-#undef __need_getopt
238c37
-
238c37
-#endif				/* getopt.h */
238c37
diff -pruN fribidi-1.0.10.orig/bin/getopt1.c fribidi-1.0.10/bin/getopt1.c
238c37
--- fribidi-1.0.10.orig/bin/getopt1.c	2015-08-05 03:49:07.000000000 +0900
238c37
+++ fribidi-1.0.10/bin/getopt1.c	1970-01-01 09:00:00.000000000 +0900
238c37
@@ -1,213 +0,0 @@
238c37
-/* getopt_long and getopt_long_only entry points for GNU getopt.
238c37
-   Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98,2004
238c37
-     Free Software Foundation, Inc.
238c37
-   This file is part of the GNU C Library.
238c37
-
238c37
-   This program is free software; you can redistribute it and/or modify
238c37
-   it under the terms of the GNU General Public License as published by
238c37
-   the Free Software Foundation; either version 2, or (at your option)
238c37
-   any later version.
238c37
-
238c37
-   This program is distributed in the hope that it will be useful,
238c37
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
238c37
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
238c37
-   GNU General Public License for more details.
238c37
-
238c37
-   You should have received a copy of the GNU General Public License along
238c37
-   with this program; if not, write to the Free Software Foundation,
238c37
-   Inc., 59 Temple Place - Suite 330, Boston, MA 02110-1301, USA.  */
238c37
-
238c37
-#ifdef HAVE_CONFIG_H
238c37
-#include <config.h>
238c37
-#endif
238c37
-
238c37
-#ifdef _LIBC
238c37
-# include <getopt.h>
238c37
-#else
238c37
-# include "getopt.h"
238c37
-#endif
238c37
-#include "getopt_int.h"
238c37
-
238c37
-#include <stdio.h>
238c37
-
238c37
-/* Comment out all this code if we are using the GNU C Library, and are not
238c37
-   actually compiling the library itself.  This code is part of the GNU C
238c37
-   Library, but also included in many other GNU distributions.  Compiling
238c37
-   and linking in this code is a waste when using the GNU C library
238c37
-   (especially if it is a shared library).  Rather than having every GNU
238c37
-   program understand `configure --with-gnu-libc' and omit the object files,
238c37
-   it is simpler to just do this in the source for each such file.  */
238c37
-
238c37
-#define GETOPT_INTERFACE_VERSION 2
238c37
-#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
238c37
-#include <gnu-versions.h>
238c37
-#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
238c37
-#define ELIDE_CODE
238c37
-#endif
238c37
-#endif
238c37
-
238c37
-#ifndef ELIDE_CODE
238c37
-
238c37
-
238c37
-/* This needs to come after some library #include
238c37
-   to get __GNU_LIBRARY__ defined.  */
238c37
-#ifdef __GNU_LIBRARY__
238c37
-#include <stdlib.h>
238c37
-#endif
238c37
-
238c37
-#ifndef	NULL
238c37
-#define NULL 0
238c37
-#endif
238c37
-
238c37
-int
238c37
-getopt_long (
238c37
-  int argc,
238c37
-  char *const *argv,
238c37
-  const char *options,
238c37
-  const struct option *long_options,
238c37
-  int *opt_index
238c37
-)
238c37
-{
238c37
-  return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
238c37
-}
238c37
-
238c37
-int
238c37
-_getopt_long_r (
238c37
-  int argc,
238c37
-  char *const *argv,
238c37
-  const char *options,
238c37
-  const struct option *long_options,
238c37
-  int *opt_index,
238c37
-  struct _getopt_data *d
238c37
-)
238c37
-{
238c37
-  return _getopt_internal_r (argc, argv, options, long_options, opt_index,
238c37
-			     0, d);
238c37
-}
238c37
-
238c37
-/* Like getopt_long, but '-' as well as '--' can indicate a long option.
238c37
-   If an option that starts with '-' (not '--') doesn't match a long option,
238c37
-   but does match a short option, it is parsed as a short option
238c37
-   instead.  */
238c37
-
238c37
-int
238c37
-getopt_long_only (
238c37
-  int argc,
238c37
-  char *const *argv,
238c37
-  const char *options,
238c37
-  const struct option *long_options,
238c37
-  int *opt_index
238c37
-)
238c37
-{
238c37
-  return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
238c37
-}
238c37
-
238c37
-int
238c37
-_getopt_long_only_r (
238c37
-  int argc,
238c37
-  char *const *argv,
238c37
-  const char *options,
238c37
-  const struct option *long_options,
238c37
-  int *opt_index,
238c37
-  struct _getopt_data *d
238c37
-)
238c37
-{
238c37
-  return _getopt_internal_r (argc, argv, options, long_options, opt_index,
238c37
-			     1, d);
238c37
-}
238c37
-
238c37
-#endif /* Not ELIDE_CODE.  */
238c37
-
238c37
-#ifdef TEST
238c37
-
238c37
-#include <stdio.h>
238c37
-
238c37
-int
238c37
-main (
238c37
-  int argc,
238c37
-  char **argv
238c37
-)
238c37
-{
238c37
-  int c;
238c37
-  int digit_optind = 0;
238c37
-
238c37
-  while (1)
238c37
-    {
238c37
-      int this_option_optind = optind ? optind : 1;
238c37
-      int option_index = 0;
238c37
-      static struct option long_options[] = {
238c37
-	{"add", 1, 0, 0},
238c37
-	{"append", 0, 0, 0},
238c37
-	{"delete", 1, 0, 0},
238c37
-	{"verbose", 0, 0, 0},
238c37
-	{"create", 0, 0, 0},
238c37
-	{"file", 1, 0, 0},
238c37
-	{0, 0, 0, 0}
238c37
-      };
238c37
-
238c37
-      c = getopt_long (argc, argv, "abc:d:0123456789",
238c37
-		       long_options, &option_index);
238c37
-      if (c == -1)
238c37
-	break;
238c37
-
238c37
-      switch (c)
238c37
-	{
238c37
-	case 0:
238c37
-	  printf ("option %s", long_options[option_index].name);
238c37
-	  if (optarg)
238c37
-	    printf (" with arg %s", optarg);
238c37
-	  printf ("\n");
238c37
-	  break;
238c37
-
238c37
-	case '0':
238c37
-	case '1':
238c37
-	case '2':
238c37
-	case '3':
238c37
-	case '4':
238c37
-	case '5':
238c37
-	case '6':
238c37
-	case '7':
238c37
-	case '8':
238c37
-	case '9':
238c37
-	  if (digit_optind != 0 && digit_optind != this_option_optind)
238c37
-	    printf ("digits occur in two different argv-elements.\n");
238c37
-	  digit_optind = this_option_optind;
238c37
-	  printf ("option %c\n", c);
238c37
-	  break;
238c37
-
238c37
-	case 'a':
238c37
-	  printf ("option a\n");
238c37
-	  break;
238c37
-
238c37
-	case 'b':
238c37
-	  printf ("option b\n");
238c37
-	  break;
238c37
-
238c37
-	case 'c':
238c37
-	  printf ("option c with value `%s'\n", optarg);
238c37
-	  break;
238c37
-
238c37
-	case 'd':
238c37
-	  printf ("option d with value `%s'\n", optarg);
238c37
-	  break;
238c37
-
238c37
-	case '?':
238c37
-	  break;
238c37
-
238c37
-	default:
238c37
-	  printf ("?? getopt returned character code 0%o ??\n", c);
238c37
-	}
238c37
-    }
238c37
-
238c37
-  if (optind < argc)
238c37
-    {
238c37
-      printf ("non-option ARGV-elements: ");
238c37
-      while (optind < argc)
238c37
-	printf ("%s ", argv[optind++]);
238c37
-      printf ("\n");
238c37
-    }
238c37
-
238c37
-  exit (0);
238c37
-}
238c37
-
238c37
-#endif /* TEST */
238c37
diff -pruN fribidi-1.0.10.orig/bin/getopt_int.h fribidi-1.0.10/bin/getopt_int.h
238c37
--- fribidi-1.0.10.orig/bin/getopt_int.h	2015-08-05 03:49:07.000000000 +0900
238c37
+++ fribidi-1.0.10/bin/getopt_int.h	1970-01-01 09:00:00.000000000 +0900
238c37
@@ -1,145 +0,0 @@
238c37
-/* Internal declarations for getopt.
238c37
-   Copyright (C) 1989-1994,1996-1999,2001,2003,2004
238c37
-   Free Software Foundation, Inc.
238c37
-   This file is part of the GNU C Library.
238c37
-
238c37
-   This program is free software; you can redistribute it and/or modify
238c37
-   it under the terms of the GNU General Public License as published by
238c37
-   the Free Software Foundation; either version 2, or (at your option)
238c37
-   any later version.
238c37
-
238c37
-   This program is distributed in the hope that it will be useful,
238c37
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
238c37
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
238c37
-   GNU General Public License for more details.
238c37
-
238c37
-   You should have received a copy of the GNU General Public License along
238c37
-   with this program; if not, write to the Free Software Foundation,
238c37
-   Inc., 59 Temple Place - Suite 330, Boston, MA 02110-1301, USA.  */
238c37
-
238c37
-#ifndef _GETOPT_INT_H
238c37
-#define _GETOPT_INT_H	1
238c37
-
238c37
-extern int _getopt_internal (
238c37
-  int ___argc,
238c37
-  char *const *___argv,
238c37
-  const char *__shortopts,
238c37
-  const struct option *__longopts,
238c37
-  int *__longind,
238c37
-  int __long_only
238c37
-);
238c37
-
238c37
-
238c37
-/* Reentrant versions which can handle parsing multiple argument
238c37
-   vectors at the same time.  */
238c37
-
238c37
-/* Data type for reentrant functions.  */
238c37
-struct _getopt_data
238c37
-{
238c37
-  /* These have exactly the same meaning as the corresponding global
238c37
-     variables, except that they are used for the reentrant
238c37
-     versions of getopt.  */
238c37
-  int optind;
238c37
-  int opterr;
238c37
-  int optopt;
238c37
-  char *optarg;
238c37
-
238c37
-  /* Internal members.  */
238c37
-
238c37
-  /* True if the internal members have been initialized.  */
238c37
-  int __initialized;
238c37
-
238c37
-  /* The next char to be scanned in the option-element
238c37
-     in which the last option character we returned was found.
238c37
-     This allows us to pick up the scan where we left off.
238c37
-
238c37
-     If this is zero, or a null string, it means resume the scan
238c37
-     by advancing to the next ARGV-element.  */
238c37
-  char *__nextchar;
238c37
-
238c37
-  /* Describe how to deal with options that follow non-option ARGV-elements.
238c37
-
238c37
-     If the caller did not specify anything,
238c37
-     the default is REQUIRE_ORDER if the environment variable
238c37
-     POSIXLY_CORRECT is defined, PERMUTE otherwise.
238c37
-
238c37
-     REQUIRE_ORDER means don't recognize them as options;
238c37
-     stop option processing when the first non-option is seen.
238c37
-     This is what Unix does.
238c37
-     This mode of operation is selected by either setting the environment
238c37
-     variable POSIXLY_CORRECT, or using `+' as the first character
238c37
-     of the list of option characters.
238c37
-
238c37
-     PERMUTE is the default.  We permute the contents of ARGV as we
238c37
-     scan, so that eventually all the non-options are at the end.
238c37
-     This allows options to be given in any order, even with programs
238c37
-     that were not written to expect this.
238c37
-
238c37
-     RETURN_IN_ORDER is an option available to programs that were
238c37
-     written to expect options and other ARGV-elements in any order
238c37
-     and that care about the ordering of the two.  We describe each
238c37
-     non-option ARGV-element as if it were the argument of an option
238c37
-     with character code 1.  Using `-' as the first character of the
238c37
-     list of option characters selects this mode of operation.
238c37
-
238c37
-     The special argument `--' forces an end of option-scanning regardless
238c37
-     of the value of `ordering'.  In the case of RETURN_IN_ORDER, only
238c37
-     `--' can cause `getopt' to return -1 with `optind' != ARGC.  */
238c37
-
238c37
-  enum
238c37
-  {
238c37
-    REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
238c37
-  } __ordering;
238c37
-
238c37
-  /* If the POSIXLY_CORRECT environment variable is set.  */
238c37
-  int __posixly_correct;
238c37
-
238c37
-
238c37
-  /* Handle permutation of arguments.  */
238c37
-
238c37
-  /* Describe the part of ARGV that contains non-options that have
238c37
-     been skipped.  `first_nonopt' is the index in ARGV of the first
238c37
-     of them; `last_nonopt' is the index after the last of them.  */
238c37
-
238c37
-  int __first_nonopt;
238c37
-  int __last_nonopt;
238c37
-
238c37
-#if defined _LIBC && defined USE_NONOPTION_FLAGS
238c37
-  int __nonoption_flags_max_len;
238c37
-  int __nonoption_flags_len;
238c37
-# endif
238c37
-};
238c37
-
238c37
-/* The initializer is necessary to set OPTIND and OPTERR to their
238c37
-   default values and to clear the initialization flag.  */
238c37
-#define _GETOPT_DATA_INITIALIZER	{ 1, 1 }
238c37
-
238c37
-extern int _getopt_internal_r (
238c37
-  int ___argc,
238c37
-  char *const *___argv,
238c37
-  const char *__shortopts,
238c37
-  const struct option *__longopts,
238c37
-  int *__longind,
238c37
-  int __long_only,
238c37
-  struct _getopt_data *__data
238c37
-);
238c37
-
238c37
-extern int _getopt_long_r (
238c37
-  int ___argc,
238c37
-  char *const *___argv,
238c37
-  const char *__shortopts,
238c37
-  const struct option *__longopts,
238c37
-  int *__longind,
238c37
-  struct _getopt_data *__data
238c37
-);
238c37
-
238c37
-extern int _getopt_long_only_r (
238c37
-  int ___argc,
238c37
-  char *const *___argv,
238c37
-  const char *__shortopts,
238c37
-  const struct option *__longopts,
238c37
-  int *__longind,
238c37
-  struct _getopt_data *__data
238c37
-);
238c37
-
238c37
-#endif /* getopt_int.h */
238c37
diff -pruN fribidi-1.0.10.orig/bin/gettext.h fribidi-1.0.10/bin/gettext.h
238c37
--- fribidi-1.0.10.orig/bin/gettext.h	2015-08-05 03:49:07.000000000 +0900
238c37
+++ fribidi-1.0.10/bin/gettext.h	1970-01-01 09:00:00.000000000 +0900
238c37
@@ -1,2 +0,0 @@
238c37
-#undef gettext
238c37
-#define gettext
238c37
diff -pruN fribidi-1.0.10.orig/bin/meson.build fribidi-1.0.10/bin/meson.build
238c37
--- fribidi-1.0.10.orig/bin/meson.build	2020-07-06 04:17:23.000000000 +0900
238c37
+++ fribidi-1.0.10/bin/meson.build	2020-07-07 21:10:30.931408884 +0900
238c37
@@ -1,12 +1,12 @@
238c37
 fribidi = executable('fribidi',
238c37
-  'fribidi-main.c', 'getopt.c', 'getopt1.c', fribidi_unicode_version_h,
238c37
+  'fribidi-main.c', fribidi_unicode_version_h,
238c37
   c_args: ['-DHAVE_CONFIG_H'] + fribidi_static_cargs + visibility_args,
238c37
   include_directories: incs,
238c37
   link_with: libfribidi,
238c37
   install: true)
238c37
 
238c37
 executable('fribidi-benchmark',
238c37
-  'fribidi-benchmark.c', 'getopt.c', 'getopt1.c', fribidi_unicode_version_h,
238c37
+  'fribidi-benchmark.c', fribidi_unicode_version_h,
238c37
   c_args: ['-DHAVE_CONFIG_H'] + fribidi_static_cargs + visibility_args,
238c37
   include_directories: incs,
238c37
   link_with: libfribidi,