1 /*
2  * This file was written by Julien Jorge <julien.jorge@gamned.org>
3  * It is hereby in the public domain.
4  *
5  * In jurisdictions that do not recognise grants of copyright to the
6  * public domain: I, the author and (presumably, in those jurisdictions)
7  * copyright holder, hereby permit anyone to distribute and use this code,
8  * in source code or binary form, with or without modifications. This
9  * permission is world-wide and irrevocable.
10  *
11  * Of course, I will not be liable for any errors or shortcomings in the
12  * code, since I give it away without asking any compenstations.
13  *
14  * If you use or distribute this code, I would appreciate receiving
15  * credit for writing it, in whichever way you find proper and customary.
16  */
17 #ifndef OPTIONS_H
18 #define OPTIONS_H
19 
20 #include "flatten.h"
21 #include "process.h"
22 
23 #include <getopt.h>
24 
25 /*----------------------------------------------------------------------------*/
26 #define short_options_prefix "-"
27 
28 /*----------------------------------------------------------------------------*/
29 #define option_help_value 'h'
30 #define short_option_help "h"
31 #define option_help { "help", 0, NULL, option_help_value }
32 
33 /*----------------------------------------------------------------------------*/
34 #define option_version_value 'V'
35 #define short_option_version "V"
36 #define option_version { "version", 0, NULL, option_version_value }
37 
38 /*----------------------------------------------------------------------------*/
39 #define option_verbose_value 'v'
40 #define short_option_verbose "v"
41 #define option_verbose { "verbose", 0, NULL, option_verbose_value }
42 
43 /*----------------------------------------------------------------------------*/
44 #define option_bzip_value 'j'
45 #define short_option_bzip "j"
46 #define option_bzip { "bzip", 0, NULL, option_bzip_value }
47 
48 /*----------------------------------------------------------------------------*/
49 #define option_gzip_value 'z'
50 #define short_option_gzip "z"
51 #define option_gzip { "gzip", 0, NULL, option_gzip_value }
52 
53 /*----------------------------------------------------------------------------*/
54 #define option_unpack_value 'Z'
55 #define short_option_unpack "Z:"
56 #define option_unpack { "unpack", 1, NULL, option_unpack_value }
57 
58 /*----------------------------------------------------------------------------*/
59 #define option_path_separator_value 'p'
60 #define short_option_path_separator "p:"
61 #define option_path_separator                                   \
62   { "path-separator", 1, NULL, option_path_separator_value }
63 
64 /*----------------------------------------------------------------------------*/
65 #define option_output_value 'o'
66 #define short_option_output "o:"
67 #define option_output { "output", 1, NULL, option_output_value }
68 
69 /*----------------------------------------------------------------------------*/
70 #define option_alpha_value 'a'
71 #define short_option_alpha "a:"
72 #define option_alpha { "alpha", 1, NULL, option_alpha_value }
73 
74 /*----------------------------------------------------------------------------*/
75 #define option_background_value 'b'
76 #define short_option_background "b:"
77 #define option_background { "background", 1, NULL, option_background_value }
78 
79 /*----------------------------------------------------------------------------*/
80 #define option_checkered_background_value '#'
81 #define short_option_checkered_background "#"
82 #define option_checkered_background \
83   { "checkered-background", 0, NULL, option_checkered_background }
84 
85 /*----------------------------------------------------------------------------*/
86 #define option_force_alpha_value 'A'
87 #define short_option_force_alpha "A"
88 #define option_force_alpha { "force-alpha", 0, NULL, option_force_alpha_value }
89 
90 /*----------------------------------------------------------------------------*/
91 #define option_color_value 'c'
92 #define short_option_color "c"
93 #define option_color { "color", 0, NULL, option_color_value }
94 #define option_colour { "colour", 0, NULL, option_color_value }
95 
96 /*----------------------------------------------------------------------------*/
97 #define option_gray_value 'g'
98 #define short_option_gray "g"
99 #define option_gray { "gray", 0, NULL, option_gray_value }
100 #define option_grey { "grey", 0, NULL, option_gray_value }
101 
102 /*----------------------------------------------------------------------------*/
103 #define option_mono_value 'm'
104 #define short_option_mono "m"
105 #define option_mono { "mono", 0, NULL, option_mono_value }
106 
107 /*----------------------------------------------------------------------------*/
108 #define option_pnm_value 'n'
109 #define short_option_pnm "n"
110 #define option_pnm { "pnm", 0, NULL, option_pnm_value }
111 
112 /*----------------------------------------------------------------------------*/
113 #define option_truecolor_value 'T'
114 #define short_option_truecolor "T"
115 #define option_truecolor { "truecolor", 0, NULL, option_truecolor_value }
116 
117 /*----------------------------------------------------------------------------*/
118 #define option_for_gif_value 'G'
119 #define short_option_for_gif "G"
120 #define option_for_gif { "for-gif", 0, NULL, option_for_gif_value }
121 
122 /*----------------------------------------------------------------------------*/
123 #define option_dissolve_value 'D'
124 #define short_option_dissolve "D"
125 #define option_dissolve { "dissolve", 0, NULL, option_dissolve_value }
126 
127 /*----------------------------------------------------------------------------*/
128 #define option_full_image_value 'f'
129 #define short_option_full_image "f"
130 #define option_full_image { "full-image", 0, NULL, option_full_image_value }
131 
132 /*----------------------------------------------------------------------------*/
133 #define option_size_value 'S'
134 #define short_option_size "S:"
135 #define option_size { "size", 1, NULL, option_size_value }
136 
137 /*----------------------------------------------------------------------------*/
138 #define option_offset_value 'O'
139 #define short_option_offset "O:"
140 #define option_offset { "offset", 1, NULL, option_offset_value }
141 
142 /*----------------------------------------------------------------------------*/
143 #define option_autocrop_value 'C'
144 #define short_option_autocrop "C"
145 #define option_autocrop { "autocrop", 0, NULL, option_autocrop_value }
146 
147 /*----------------------------------------------------------------------------*/
148 #define option_mode_value 300
149 #define option_mode { "mode", 1, NULL, option_mode_value }
150 
151 /*----------------------------------------------------------------------------*/
152 #define option_percent_value 301
153 #define option_percent { "percent", 1, NULL, option_percent_value }
154 
155 /*----------------------------------------------------------------------------*/
156 #define option_opacity_value 302
157 #define option_opacity { "opacity", 1, NULL, option_opacity_value }
158 
159 /*----------------------------------------------------------------------------*/
160 #define option_mask_value 303
161 #define option_mask { "mask", 0, NULL, option_mask_value }
162 
163 /*----------------------------------------------------------------------------*/
164 #define option_nomask_value 304
165 #define option_nomask { "nomask", 0, NULL, option_nomask_value }
166 
167 /*----------------------------------------------------------------------------*/
168 #define option_utf8_value 'u'
169 #define short_option_utf8 "u"
170 #define option_utf8 { "utf8", 0, NULL, option_utf8_value }
171 
172 int option_parse
173 ( int argc, char** argv, const char* short_options,
174   const struct option* long_options,
175   struct ProcessControl* p, struct FlattenSpec* flatspec );
176 
177 #endif /* OPTIONS_H */
178