#ifndef HAVE_GETOPT_LONG
#include "getopt.h"
#include <stdio.h>
+#include <stdlib.h>
+#include <strings.h>
/* Getopt for GNU.
NOTE: getopt is now part of the C library, so if you don't know what
/* Avoid depending on library functions or files
whose names are inconsistent. */
-char *getenv();
-
-static char *my_index(str, chr)
- const char *str;
- int chr;
+static const char *my_index(const char *str, int chr)
{
while (*str)
{
if (*str == chr)
- return (char *)str;
+ return (const char *)str;
str++;
}
return 0;
`first_nonopt' and `last_nonopt' are relocated so that they describe
the new indices of the non-options in ARGV after they are moved. */
-static void exchange(argv)
- char **argv;
+static void exchange( char **argv)
{
int bottom = first_nonopt;
int middle = last_nonopt;
/* Initialize the internal data when the first call is made. */
-static const char *_getopt_initialize(optstring)
- const char *optstring;
+static const char *_getopt_initialize( const char *optstring)
{
/* Start processing options with ARGV-element 1 (since ARGV-element 0
is the program name); the sequence of previously skipped
If LONG_ONLY is nonzero, '-' as well as '--' can introduce
long-named options. */
-static int _getopt_internal(argc, argv, optstring, longopts, longind, long_only)
- int argc;
- char *const *argv;
- const char *optstring;
- const struct option *longopts;
- int *longind;
- int long_only;
+static int _getopt_internal( int argc, char *const *argv,
+ const char *optstring,
+ const struct option *longopts,
+ int *longind,
+ int long_only)
{
optarg = NULL;