]> sjero.net Git - wget/blobdiff - src/getopt.c
[svn] Remove K&R support.
[wget] / src / getopt.c
index d176d3e7e720a406de82663db4740418355998de..8bc292fb9e0354a7b454e5482681c9f5e5480993 100644 (file)
@@ -196,11 +196,7 @@ static char *posixly_correct;
 # define my_index      strchr
 #else
 
-# if HAVE_STRING_H
-#  include <string.h>
-# else
-#  include <strings.h>
-# endif
+#include <string.h>
 
 /* Avoid depending on library functions or files
    whose names are inconsistent.  */
@@ -974,6 +970,33 @@ getopt (argc, argv, optstring)
                           0);
 }
 
+int
+getopt_long (argc, argv, options, long_options, opt_index)
+     int argc;
+     char *const *argv;
+     const char *options;
+     const struct option *long_options;
+     int *opt_index;
+{
+  return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
+}
+
+/* Like getopt_long, but '-' as well as '--' can indicate a long option.
+   If an option that starts with '-' (not '--') doesn't match a long option,
+   but does match a short option, it is parsed as a short option
+   instead.  */
+
+int
+getopt_long_only (argc, argv, options, long_options, opt_index)
+     int argc;
+     char *const *argv;
+     const char *options;
+     const struct option *long_options;
+     int *opt_index;
+{
+  return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
+}
+
 #endif /* Not ELIDE_CODE.  */
 \f
 #ifdef TEST