cmdutils.h 990 B

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef _CMD_UTILS_H
  2. #define _CMD_UTILS_H
  3. typedef struct {
  4. const char *name;
  5. int flags;
  6. #define HAS_ARG 0x0001
  7. #define OPT_BOOL 0x0002
  8. #define OPT_EXPERT 0x0004
  9. #define OPT_STRING 0x0008
  10. #define OPT_VIDEO 0x0010
  11. #define OPT_AUDIO 0x0020
  12. #define OPT_GRAB 0x0040
  13. #define OPT_INT 0x0080
  14. #define OPT_FLOAT 0x0100
  15. #define OPT_SUBTITLE 0x0200
  16. #define OPT_FUNC2 0x0400
  17. union {
  18. void (*func_arg)(const char *); //FIXME passing error code as int return would be nicer then exit() in the func
  19. int *int_arg;
  20. char **str_arg;
  21. float *float_arg;
  22. int (*func2_arg)(const char *, const char *);
  23. } u;
  24. const char *help;
  25. const char *argname;
  26. } OptionDef;
  27. void show_help_options(const OptionDef *options, const char *msg, int mask, int value);
  28. void parse_options(int argc, char **argv, const OptionDef *options);
  29. void parse_arg_file(const char *filename);
  30. void print_error(const char *filename, int err);
  31. #endif /* _CMD_UTILS_H */