getopt1.c 782 B

12345678910111213141516171819202122232425
  1. /* getopt_long and getopt_long_only entry points for GNU getopt. */
  2. #include <config.h>
  3. #include "sys-defines.h"
  4. #include "getopt.h"
  5. int
  6. getopt_long (int argc, char *const *argv, const char *options,
  7. const struct option *long_options, int *opt_index)
  8. {
  9. return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
  10. }
  11. /* Like getopt_long, but '-' as well as '--' can indicate a long option.
  12. If an option that starts with '-' (not '--') doesn't match a long option,
  13. but does match a short option, it is parsed as a short option
  14. instead. */
  15. int
  16. getopt_long_only (int argc, char *const *argv, const char *options,
  17. const struct option *long_options, int *opt_index)
  18. {
  19. return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
  20. }