cmdline.in 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  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.. */
  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. int opengl_flag; /**< @brief Enable hardware acceleration. Only works with modern systems that are also running a compositor. (default=off). */
  65. const char *opengl_help; /**< @brief Enable hardware acceleration. Only works with modern systems that are also running a compositor. help description. */
  66. int magnify_flag; /**< @brief Display a magnifying glass when --opengl is also enabled. (default=off). */
  67. const char *magnify_help; /**< @brief Display a magnifying glass when --opengl is also enabled. help description. */
  68. float magstrength_arg; /**< @brief Sets how many times the magnification window size is multiplied. (default='4'). */
  69. char * magstrength_orig; /**< @brief Sets how many times the magnification window size is multiplied. original value given at command line. */
  70. const char *magstrength_help; /**< @brief Sets how many times the magnification window size is multiplied. help description. */
  71. int magpixels_arg; /**< @brief Sets how many pixels are displayed in the magnification. The less pixels the bigger the magnification. (default='64'). */
  72. char * magpixels_orig; /**< @brief Sets how many pixels are displayed in the magnification. The less pixels the bigger the magnification. original value given at command line. */
  73. const char *magpixels_help; /**< @brief Sets how many pixels are displayed in the magnification. The less pixels the bigger the magnification. help description. */
  74. char * theme_arg; /**< @brief Sets the theme of the selection, using textures from ~/.config/slop/ or /usr/share/. (default='none'). */
  75. char * theme_orig; /**< @brief Sets the theme of the selection, using textures from ~/.config/slop/ or /usr/share/. original value given at command line. */
  76. const char *theme_help; /**< @brief Sets the theme of the selection, using textures from ~/.config/slop/ or /usr/share/. help description. */
  77. char * shader_arg; /**< @brief Sets the shader to load and use from ~/.config/slop/ or /usr/share/. (default='simple'). */
  78. char * shader_orig; /**< @brief Sets the shader to load and use from ~/.config/slop/ or /usr/share/. original value given at command line. */
  79. const char *shader_help; /**< @brief Sets the shader to load and use from ~/.config/slop/ or /usr/share/. help description. */
  80. char * format_arg; /**< @brief Set the output format string. Format specifiers are %x, %y, %w, %h, %i, %g, and %c. (default='REPLACEME'). */
  81. 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. */
  82. const char *format_help; /**< @brief Set the output format string. Format specifiers are %x, %y, %w, %h, %i, %g, and %c. help description. */
  83. unsigned int help_given ; /**< @brief Whether help was given. */
  84. unsigned int version_given ; /**< @brief Whether version was given. */
  85. unsigned int xdisplay_given ; /**< @brief Whether xdisplay was given. */
  86. unsigned int nokeyboard_given ; /**< @brief Whether nokeyboard was given. */
  87. unsigned int bordersize_given ; /**< @brief Whether bordersize was given. */
  88. unsigned int padding_given ; /**< @brief Whether padding was given. */
  89. unsigned int tolerance_given ; /**< @brief Whether tolerance was given. */
  90. unsigned int gracetime_given ; /**< @brief Whether gracetime was given. */
  91. unsigned int color_given ; /**< @brief Whether color was given. */
  92. unsigned int nodecorations_given ; /**< @brief Whether nodecorations was given. */
  93. unsigned int min_given ; /**< @brief Whether min was given. */
  94. unsigned int max_given ; /**< @brief Whether max was given. */
  95. unsigned int highlight_given ; /**< @brief Whether highlight was given. */
  96. unsigned int opengl_given ; /**< @brief Whether opengl was given. */
  97. unsigned int magnify_given ; /**< @brief Whether magnify was given. */
  98. unsigned int magstrength_given ; /**< @brief Whether magstrength was given. */
  99. unsigned int magpixels_given ; /**< @brief Whether magpixels was given. */
  100. unsigned int theme_given ; /**< @brief Whether theme was given. */
  101. unsigned int shader_given ; /**< @brief Whether shader was given. */
  102. unsigned int format_given ; /**< @brief Whether format was given. */
  103. } ;
  104. /** @brief The additional parameters to pass to parser functions */
  105. struct cmdline_parser_params
  106. {
  107. int override; /**< @brief whether to override possibly already present options (default 0) */
  108. int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 1) */
  109. int check_required; /**< @brief whether to check that all required options were provided (default 1) */
  110. int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */
  111. int print_errors; /**< @brief whether getopt_long should print an error message for a bad option (default 1) */
  112. } ;
  113. /** @brief the purpose string of the program */
  114. extern const char *gengetopt_args_info_purpose;
  115. /** @brief the usage string of the program */
  116. extern const char *gengetopt_args_info_usage;
  117. /** @brief the description string of the program */
  118. extern const char *gengetopt_args_info_description;
  119. /** @brief all the lines making the help output */
  120. extern const char *gengetopt_args_info_help[];
  121. /**
  122. * The command line parser
  123. * @param argc the number of command line options
  124. * @param argv the command line options
  125. * @param args_info the structure where option information will be stored
  126. * @return 0 if everything went fine, NON 0 if an error took place
  127. */
  128. int cmdline_parser (int argc, char **argv,
  129. struct gengetopt_args_info *args_info);
  130. /**
  131. * The command line parser (version with additional parameters - deprecated)
  132. * @param argc the number of command line options
  133. * @param argv the command line options
  134. * @param args_info the structure where option information will be stored
  135. * @param override whether to override possibly already present options
  136. * @param initialize whether to initialize the option structure my_args_info
  137. * @param check_required whether to check that all required options were provided
  138. * @return 0 if everything went fine, NON 0 if an error took place
  139. * @deprecated use cmdline_parser_ext() instead
  140. */
  141. int cmdline_parser2 (int argc, char **argv,
  142. struct gengetopt_args_info *args_info,
  143. int override, int initialize, int check_required);
  144. /**
  145. * The command line parser (version with additional parameters)
  146. * @param argc the number of command line options
  147. * @param argv the command line options
  148. * @param args_info the structure where option information will be stored
  149. * @param params additional parameters for the parser
  150. * @return 0 if everything went fine, NON 0 if an error took place
  151. */
  152. int cmdline_parser_ext (int argc, char **argv,
  153. struct gengetopt_args_info *args_info,
  154. struct cmdline_parser_params *params);
  155. /**
  156. * Save the contents of the option struct into an already open FILE stream.
  157. * @param outfile the stream where to dump options
  158. * @param args_info the option struct to dump
  159. * @return 0 if everything went fine, NON 0 if an error took place
  160. */
  161. int cmdline_parser_dump(FILE *outfile,
  162. struct gengetopt_args_info *args_info);
  163. /**
  164. * Save the contents of the option struct into a (text) file.
  165. * This file can be read by the config file parser (if generated by gengetopt)
  166. * @param filename the file where to save
  167. * @param args_info the option struct to save
  168. * @return 0 if everything went fine, NON 0 if an error took place
  169. */
  170. int cmdline_parser_file_save(const char *filename,
  171. struct gengetopt_args_info *args_info);
  172. /**
  173. * Print the help
  174. */
  175. void cmdline_parser_print_help(void);
  176. /**
  177. * Print the version
  178. */
  179. void cmdline_parser_print_version(void);
  180. /**
  181. * Initializes all the fields a cmdline_parser_params structure
  182. * to their default values
  183. * @param params the structure to initialize
  184. */
  185. void cmdline_parser_params_init(struct cmdline_parser_params *params);
  186. /**
  187. * Allocates dynamically a cmdline_parser_params structure and initializes
  188. * all its fields to their default values
  189. * @return the created and initialized cmdline_parser_params structure
  190. */
  191. struct cmdline_parser_params *cmdline_parser_params_create(void);
  192. /**
  193. * Initializes the passed gengetopt_args_info structure's fields
  194. * (also set default values for options that have a default)
  195. * @param args_info the structure to initialize
  196. */
  197. void cmdline_parser_init (struct gengetopt_args_info *args_info);
  198. /**
  199. * Deallocates the string fields of the gengetopt_args_info structure
  200. * (but does not deallocate the structure itself)
  201. * @param args_info the structure to deallocate
  202. */
  203. void cmdline_parser_free (struct gengetopt_args_info *args_info);
  204. /**
  205. * Checks that all the required options were specified
  206. * @param args_info the structure to check
  207. * @param prog_name the name of the program that will be used to print
  208. * possible errors
  209. * @return
  210. */
  211. int cmdline_parser_required (struct gengetopt_args_info *args_info,
  212. const char *prog_name);
  213. #ifdef __cplusplus
  214. }
  215. #endif /* __cplusplus */
  216. #endif /* CMDLINE_H */