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