123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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 "v3.1.3"
  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. unsigned int help_given ; /**< @brief Whether help was given. */
  65. unsigned int version_given ; /**< @brief Whether version was given. */
  66. unsigned int xdisplay_given ; /**< @brief Whether xdisplay was given. */
  67. unsigned int nokeyboard_given ; /**< @brief Whether nokeyboard was given. */
  68. unsigned int bordersize_given ; /**< @brief Whether bordersize was given. */
  69. unsigned int padding_given ; /**< @brief Whether padding was given. */
  70. unsigned int tolerance_given ; /**< @brief Whether tolerance was given. */
  71. unsigned int gracetime_given ; /**< @brief Whether gracetime was given. */
  72. unsigned int color_given ; /**< @brief Whether color was given. */
  73. unsigned int nodecorations_given ; /**< @brief Whether nodecorations was given. */
  74. unsigned int min_given ; /**< @brief Whether min was given. */
  75. unsigned int max_given ; /**< @brief Whether max was given. */
  76. unsigned int highlight_given ; /**< @brief Whether highlight was given. */
  77. } ;
  78. /** @brief The additional parameters to pass to parser functions */
  79. struct cmdline_parser_params
  80. {
  81. int override; /**< @brief whether to override possibly already present options (default 0) */
  82. int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */
  83. int check_required; /**< @brief whether to check that all required options were provided (default 1) */
  84. int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */
  85. int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */
  86. } ;
  87. /** @brief the purpose string of the program */
  88. extern const char *gengetopt_args_info_purpose;
  89. /** @brief the usage string of the program */
  90. extern const char *gengetopt_args_info_usage;
  91. /** @brief the description string of the program */
  92. extern const char *gengetopt_args_info_description;
  93. /** @brief all the lines making the help output */
  94. extern const char *gengetopt_args_info_help[];
  95. /**
  96. * The command line parser
  97. * @param argc the number of command line options
  98. * @param argv the command line options
  99. * @param args_info the structure where option information will be stored
  100. * @return 0 if everything went fine, NON 0 if an error took place
  101. */
  102. int cmdline_parser (int argc, char **argv,
  103. struct gengetopt_args_info *args_info);
  104. /**
  105. * The command line parser (version with additional parameters - deprecated)
  106. * @param argc the number of command line options
  107. * @param argv the command line options
  108. * @param args_info the structure where option information will be stored
  109. * @param override whether to override possibly already present options
  110. * @param initialize whether to initialize the option structure my_args_info
  111. * @param check_required whether to check that all required options were provided
  112. * @return 0 if everything went fine, NON 0 if an error took place
  113. * @deprecated use cmdline_parser_ext() instead
  114. */
  115. int cmdline_parser2 (int argc, char **argv,
  116. struct gengetopt_args_info *args_info,
  117. int override, int initialize, int check_required);
  118. /**
  119. * The command line parser (version with additional parameters)
  120. * @param argc the number of command line options
  121. * @param argv the command line options
  122. * @param args_info the structure where option information will be stored
  123. * @param params additional parameters for the parser
  124. * @return 0 if everything went fine, NON 0 if an error took place
  125. */
  126. int cmdline_parser_ext (int argc, char **argv,
  127. struct gengetopt_args_info *args_info,
  128. struct cmdline_parser_params *params);
  129. /**
  130. * Save the contents of the option struct into an already open FILE stream.
  131. * @param outfile the stream where to dump options
  132. * @param args_info the option struct to dump
  133. * @return 0 if everything went fine, NON 0 if an error took place
  134. */
  135. int cmdline_parser_dump(FILE *outfile,
  136. struct gengetopt_args_info *args_info);
  137. /**
  138. * Save the contents of the option struct into a (text) file.
  139. * This file can be read by the config file parser (if generated by gengetopt)
  140. * @param filename the file where to save
  141. * @param args_info the option struct to save
  142. * @return 0 if everything went fine, NON 0 if an error took place
  143. */
  144. int cmdline_parser_file_save(const char *filename,
  145. struct gengetopt_args_info *args_info);
  146. /**
  147. * Print the help
  148. */
  149. void cmdline_parser_print_help(void);
  150. /**
  151. * Print the version
  152. */
  153. void cmdline_parser_print_version(void);
  154. /**
  155. * Initializes all the fields a cmdline_parser_params structure
  156. * to their default values
  157. * @param params the structure to initialize
  158. */
  159. void cmdline_parser_params_init(struct cmdline_parser_params *params);
  160. /**
  161. * Allocates dynamically a cmdline_parser_params structure and initializes
  162. * all its fields to their default values
  163. * @return the created and initialized cmdline_parser_params structure
  164. */
  165. struct cmdline_parser_params *cmdline_parser_params_create(void);
  166. /**
  167. * Initializes the passed gengetopt_args_info structure's fields
  168. * (also set default values for options that have a default)
  169. * @param args_info the structure to initialize
  170. */
  171. void cmdline_parser_init (struct gengetopt_args_info *args_info);
  172. /**
  173. * Deallocates the string fields of the gengetopt_args_info structure
  174. * (but does not deallocate the structure itself)
  175. * @param args_info the structure to deallocate
  176. */
  177. void cmdline_parser_free (struct gengetopt_args_info *args_info);
  178. /**
  179. * Checks that all the required options were specified
  180. * @param args_info the structure to check
  181. * @param prog_name the name of the program that will be used to print
  182. * possible errors
  183. * @return
  184. */
  185. int cmdline_parser_required (struct gengetopt_args_info *args_info,
  186. const char *prog_name);
  187. #ifdef __cplusplus
  188. }
  189. #endif /* __cplusplus */
  190. #endif /* CMDLINE_H */