getopt.h 670 B

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