123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. /** @file cmdline.h
  2. * @brief The header file for the command line option parser
  3. * generated by GNU Gengetopt version 2.22.6
  4. * http://www.gnu.org/software/gengetopt.
  5. * DO NOT modify this file, since it can be overwritten
  6. * @author GNU Gengetopt by Lorenzo Bettini */
  7. #ifndef CMDLINE_H
  8. #define CMDLINE_H
  9. /* If we use autoconf. */
  10. #ifdef HAVE_CONFIG_H
  11. #include "config.h"
  12. #endif
  13. #include <stdio.h> /* for FILE */
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif /* __cplusplus */
  17. #ifndef CMDLINE_PARSER_PACKAGE
  18. /** @brief the program name (used for printing errors) */
  19. #define CMDLINE_PARSER_PACKAGE "slop"
  20. #endif
  21. #ifndef CMDLINE_PARSER_PACKAGE_NAME
  22. /** @brief the complete program name (used for help and version) */
  23. #define CMDLINE_PARSER_PACKAGE_NAME "slop"
  24. #endif
  25. #ifndef CMDLINE_PARSER_VERSION
  26. /** @brief the program version */
  27. #define CMDLINE_PARSER_VERSION "v@slop_VERSION_MAJOR@.@slop_VERSION_MINOR@.@slop_VERSION_PATCH@"
  28. #endif
  29. /** @brief Where the command line options are stored */
  30. struct gengetopt_args_info
  31. {
  32. const char *help_help; /**< @brief Print help and exit help description. */
  33. const char *version_help; /**< @brief Print version and exit help description. */
  34. char * xdisplay_arg; /**< @brief Sets the x display. (default=':0'). */
  35. char * xdisplay_orig; /**< @brief Sets the x display. original value given at command line. */
  36. const char *xdisplay_help; /**< @brief Sets the x display. help description. */
  37. int nokeyboard_flag; /**< @brief Disables the ability to cancel selections with the keyboard. (default=off). */
  38. const char *nokeyboard_help; /**< @brief Disables the ability to cancel selections with the keyboard. help description. */
  39. int bordersize_arg; /**< @brief Set the selection rectangle's thickness. Does nothing when --highlight is enabled. (default='5'). */
  40. char * bordersize_orig; /**< @brief Set the selection rectangle's thickness. Does nothing when --highlight is enabled. original value given at command line. */
  41. const char *bordersize_help; /**< @brief Set the selection rectangle's thickness. Does nothing when --highlight is enabled. help description. */
  42. int padding_arg; /**< @brief Set the padding size of the selection. Can be negative. (default='0'). */
  43. char * padding_orig; /**< @brief Set the padding size of the selection. Can be negative. original value given at command line. */
  44. const char *padding_help; /**< @brief Set the padding size of the selection. Can be negative. help description. */
  45. int tolerance_arg; /**< @brief How far in pixels the mouse can move after clicking and still be detected as a normal click instead of a click and drag. Setting this to 0 will disable window selections. (default='2'). */
  46. char * tolerance_orig; /**< @brief How far in pixels the mouse can move after clicking and still be detected as a normal click instead of a click and drag. Setting this to 0 will disable window selections. original value given at command line. */
  47. const char *tolerance_help; /**< @brief How far in pixels the mouse can move after clicking and still be detected as a normal click instead of a click and drag. Setting this to 0 will disable window selections. help description. */
  48. char * gracetime_arg; /**< @brief Set the amount of time before slop will check for keyboard cancellations in seconds. (default='0.4'). */
  49. char * gracetime_orig; /**< @brief Set the amount of time before slop will check for keyboard cancellations in seconds. original value given at command line. */
  50. const char *gracetime_help; /**< @brief Set the amount of time before slop will check for keyboard cancellations in seconds. help description. */
  51. char * color_arg; /**< @brief Set the selection rectangle's color. Supports RGB or RGBA values. (default='0.5,0.5,0.5,1'). */
  52. char * color_orig; /**< @brief Set the selection rectangle's color. Supports RGB or RGBA values. original value given at command line. */
  53. const char *color_help; /**< @brief Set the selection rectangle's color. Supports RGB or RGBA values. help description. */
  54. int nodecorations_flag; /**< @brief Attempt to select child windows in order to avoid window decorations. (default=off). */
  55. const char *nodecorations_help; /**< @brief Attempt to select child windows in order to avoid window decorations. help description. */
  56. int min_arg; /**< @brief Set the minimum output of width or height values. This is useful to avoid outputting 0. Setting min and max to the same value disables drag selections. (default='0'). */
  57. char * min_orig; /**< @brief Set the minimum output of width or height values. This is useful to avoid outputting 0. Setting min and max to the same value disables drag selections. original value given at command line. */
  58. const char *min_help; /**< @brief Set the minimum output of width or height values. This is useful to avoid outputting 0. Setting min and max to the same value disables drag selections. help description. */
  59. int max_arg; /**< @brief Set the maximum output of width or height values. Setting min and max to the same value disables drag selections. (default='0'). */
  60. char * max_orig; /**< @brief Set the maximum output of width or height values. Setting min and max to the same value disables drag selections. original value given at command line. */
  61. const char *max_help; /**< @brief Set the maximum output of width or height values. Setting min and max to the same value disables drag selections. help description. */
  62. int highlight_flag; /**< @brief Instead of outlining selections, slop highlights it. This is only useful when --color is set to a transparent color. (default=off). */
  63. const char *highlight_help; /**< @brief Instead of outlining selections, slop highlights it. This is only useful when --color is set to a transparent color. help description. */
  64. char * format_arg; /**< @brief Set the output format string. Format specifiers are %x, %y, %w, %h, %i, %g, and %c. (default='REPLACEME'). */
  65. char * format_orig; /**< @brief Set the output format string. Format specifiers are %x, %y, %w, %h, %i, %g, and %c. original value given at command line. */
  66. const char *format_help; /**< @brief Set the output format string. Format specifiers are %x, %y, %w, %h, %i, %g, and %c. help description. */
  67. unsigned int help_given ; /**< @brief Whether help was given. */
  68. unsigned int version_given ; /**< @brief Whether version was given. */
  69. unsigned int xdisplay_given ; /**< @brief Whether xdisplay was given. */
  70. unsigned int nokeyboard_given ; /**< @brief Whether nokeyboard was given. */
  71. unsigned int bordersize_given ; /**< @brief Whether bordersize was given. */
  72. unsigned int padding_given ; /**< @brief Whether padding was given. */
  73. unsigned int tolerance_given ; /**< @brief Whether tolerance was given. */
  74. unsigned int gracetime_given ; /**< @brief Whether gracetime was given. */
  75. unsigned int color_given ; /**< @brief Whether color was given. */
  76. unsigned int nodecorations_given ; /**< @brief Whether nodecorations was given. */
  77. unsigned int min_given ; /**< @brief Whether min was given. */
  78. unsigned int max_given ; /**< @brief Whether max was given. */
  79. unsigned int highlight_given ; /**< @brief Whether highlight was given. */
  80. unsigned int format_given ; /**< @brief Whether format was given. */
  81. } ;
  82. /** @brief The additional parameters to pass to parser functions */
  83. struct cmdline_parser_params
  84. {
  85. int override; /**< @brief whether to override possibly already present options (default 0) */
  86. int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */
  87. int check_required; /**< @brief whether to check that all required options were provided (default 1) */
  88. int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */
  89. int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */
  90. } ;
  91. /** @brief the purpose string of the program */
  92. extern const char *gengetopt_args_info_purpose;
  93. /** @brief the usage string of the program */
  94. extern const char *gengetopt_args_info_usage;
  95. /** @brief the description string of the program */
  96. extern const char *gengetopt_args_info_description;
  97. /** @brief all the lines making the help output */
  98. extern const char *gengetopt_args_info_help[];
  99. /**
  100. * The command line parser
  101. * @param argc the number of command line options
  102. * @param argv the command line options
  103. * @param args_info the structure where option information will be stored
  104. * @return 0 if everything went fine, NON 0 if an error took place
  105. */
  106. int cmdline_parser (int argc, char **argv,
  107. struct gengetopt_args_info *args_info);
  108. /**
  109. * The command line parser (version with additional parameters - deprecated)
  110. * @param argc the number of command line options
  111. * @param argv the command line options
  112. * @param args_info the structure where option information will be stored
  113. * @param override whether to override possibly already present options
  114. * @param initialize whether to initialize the option structure my_args_info
  115. * @param check_required whether to check that all required options were provided
  116. * @return 0 if everything went fine, NON 0 if an error took place
  117. * @deprecated use cmdline_parser_ext() instead
  118. */
  119. int cmdline_parser2 (int argc, char **argv,
  120. struct gengetopt_args_info *args_info,
  121. int override, int initialize, int check_required);
  122. /**
  123. * The command line parser (version with additional parameters)
  124. * @param argc the number of command line options
  125. * @param argv the command line options
  126. * @param args_info the structure where option information will be stored
  127. * @param params additional parameters for the parser
  128. * @return 0 if everything went fine, NON 0 if an error took place
  129. */
  130. int cmdline_parser_ext (int argc, char **argv,
  131. struct gengetopt_args_info *args_info,
  132. struct cmdline_parser_params *params);
  133. /**
  134. * Save the contents of the option struct into an already open FILE stream.
  135. * @param outfile the stream where to dump options
  136. * @param args_info the option struct to dump
  137. * @return 0 if everything went fine, NON 0 if an error took place
  138. */
  139. int cmdline_parser_dump(FILE *outfile,
  140. struct gengetopt_args_info *args_info);
  141. /**
  142. * Save the contents of the option struct into a (text) file.
  143. * This file can be read by the config file parser (if generated by gengetopt)
  144. * @param filename the file where to save
  145. * @param args_info the option struct to save
  146. * @return 0 if everything went fine, NON 0 if an error took place
  147. */
  148. int cmdline_parser_file_save(const char *filename,
  149. struct gengetopt_args_info *args_info);
  150. /**
  151. * Print the help
  152. */
  153. void cmdline_parser_print_help(void);
  154. /**
  155. * Print the version
  156. */
  157. void cmdline_parser_print_version(void);
  158. /**
  159. * Initializes all the fields a cmdline_parser_params structure
  160. * to their default values
  161. * @param params the structure to initialize
  162. */
  163. void cmdline_parser_params_init(struct cmdline_parser_params *params);
  164. /**
  165. * Allocates dynamically a cmdline_parser_params structure and initializes
  166. * all its fields to their default values
  167. * @return the created and initialized cmdline_parser_params structure
  168. */
  169. struct cmdline_parser_params *cmdline_parser_params_create(void);
  170. /**
  171. * Initializes the passed gengetopt_args_info structure's fields
  172. * (also set default values for options that have a default)
  173. * @param args_info the structure to initialize
  174. */
  175. void cmdline_parser_init (struct gengetopt_args_info *args_info);
  176. /**
  177. * Deallocates the string fields of the gengetopt_args_info structure
  178. * (but does not deallocate the structure itself)
  179. * @param args_info the structure to deallocate
  180. */
  181. void cmdline_parser_free (struct gengetopt_args_info *args_info);
  182. /**
  183. * Checks that all the required options were specified
  184. * @param args_info the structure to check
  185. * @param prog_name the name of the program that will be used to print
  186. * possible errors
  187. * @return
  188. */
  189. int cmdline_parser_required (struct gengetopt_args_info *args_info,
  190. const char *prog_name);
  191. #ifdef __cplusplus
  192. }
  193. #endif /* __cplusplus */
  194. #endif /* CMDLINE_H */