@@ -165,69 +165,15 @@ int handle_options(int *argc, char ***argv,
165
165
option_is_loose = 0 ;
166
166
167
167
cur_arg ++ ; /* skip '-' */
168
- if (* cur_arg == '-' || * cur_arg == 'O' ) /* check for long option, */
169
- { /* --set-variable, or -O */
170
- if (* cur_arg == 'O' )
171
- {
172
- must_be_var = 1 ;
173
-
174
- if (!(* ++ cur_arg )) /* If not -Ovar=# */
175
- {
176
- /* the argument must be in next argv */
177
- if (!* ++ pos )
178
- {
179
- if (my_getopt_print_errors )
180
- my_getopt_error_reporter (ERROR_LEVEL ,
181
- "%s: Option '-O' requires an argument" ,
182
- my_progname );
183
- return EXIT_ARGUMENT_REQUIRED ;
184
- }
185
- cur_arg = * pos ;
186
- (* argc )-- ;
187
- }
188
- }
189
- else if (!getopt_compare_strings (cur_arg , "-set-variable" , 13 ))
190
- {
191
- must_be_var = 1 ;
192
- if (cur_arg [13 ] == '=' )
193
- {
194
- cur_arg += 14 ;
195
- if (!* cur_arg )
196
- {
197
- if (my_getopt_print_errors )
198
- my_getopt_error_reporter (ERROR_LEVEL ,
199
- "%s: Option '--set-variable' requires an argument" ,
200
- my_progname );
201
- return EXIT_ARGUMENT_REQUIRED ;
202
- }
203
- }
204
- else if (cur_arg [14 ]) /* garbage, or another option. break out */
205
- must_be_var = 0 ;
206
- else
207
- {
208
- /* the argument must be in next argv */
209
- if (!* ++ pos )
210
- {
211
- if (my_getopt_print_errors )
212
- my_getopt_error_reporter (ERROR_LEVEL ,
213
- "%s: Option '--set-variable' requires an argument" ,
214
- my_progname );
215
- return EXIT_ARGUMENT_REQUIRED ;
216
- }
217
- cur_arg = * pos ;
218
- (* argc )-- ;
219
- }
220
- }
221
- else if (!must_be_var )
222
- {
223
- if (!* ++ cur_arg ) /* skip the double dash */
224
- {
225
- /* '--' means end of options, look no further */
226
- end_of_options = 1 ;
227
- (* argc )-- ;
228
- continue ;
229
- }
230
- }
168
+ if (* cur_arg == '-' ) /* check for long option, */
169
+ {
170
+ if (!* ++ cur_arg ) /* skip the double dash */
171
+ {
172
+ /* '--' means end of options, look no further */
173
+ end_of_options = 1 ;
174
+ (* argc )-- ;
175
+ continue ;
176
+ }
231
177
opt_str = check_struct_option (cur_arg , key_name );
232
178
optend = strcend (opt_str , '=' );
233
179
length = (uint ) (optend - opt_str );
@@ -307,12 +253,7 @@ int handle_options(int *argc, char ***argv,
307
253
{
308
254
if (my_getopt_skip_unknown )
309
255
{
310
- /*
311
- preserve all the components of this unknown option, this may
312
- occurr when the user provides options like: "-O foo" or
313
- "--set-variable foo" (note that theres a space in there)
314
- Generally, these kind of options are to be avoided
315
- */
256
+ /* Preserve all the components of this unknown option. */
316
257
do {
317
258
(* argv )[argvpos ++ ]= * first ++ ;
318
259
} while (first <= pos );
0 commit comments