getopt.h 833 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* SPDX-License-Identifier: LGPL-2.1 OR BSD-3-Clause */
  2. #ifndef __GETOPT_H__
  3. #define __GETOPT_H__
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. extern int opterr; /* if error message should be printed */
  8. extern int optind; /* index into parent argv vector */
  9. extern int optopt; /* character checked for validity */
  10. extern int optreset; /* reset getopt */
  11. extern char *optarg; /* argument associated with option */
  12. struct option
  13. {
  14. const char *name;
  15. int has_arg;
  16. int *flag;
  17. int val;
  18. };
  19. #define no_argument 0
  20. #define required_argument 1
  21. #define optional_argument 2
  22. int getopt(int, char**, char*);
  23. #if defined(PLATFORM_QNX)
  24. #else
  25. int getopt_long(int, char**, char*, struct option*, int*);
  26. #endif
  27. #ifdef __cplusplus
  28. }
  29. #endif
  30. #endif /* __GETOPT_H__ */