Lines Matching refs:data

161 read_globals (struct getopt_data *data)  in read_globals()  argument
163 data->optarg = optarg; in read_globals()
164 data->optind = optind; in read_globals()
165 data->opterr = opterr; in read_globals()
166 data->optopt = optopt; in read_globals()
167 data->optwhere = optwhere; in read_globals()
168 data->permute_from = permute_from; in read_globals()
169 data->num_nonopts = num_nonopts; in read_globals()
175 write_globals (struct getopt_data *data) in write_globals() argument
177 optarg = data->optarg; in write_globals()
178 optind = data->optind; in write_globals()
179 opterr = data->opterr; in write_globals()
180 optopt = data->optopt; in write_globals()
181 optwhere = data->optwhere; in write_globals()
182 permute_from = data->permute_from; in write_globals()
183 num_nonopts = data->num_nonopts; in write_globals()
192 struct getopt_data *data) in getopt_internal() argument
205 if (data->optind <= 0) in getopt_internal()
207 data->optind = 1; in getopt_internal()
208 data->optwhere = 1; in getopt_internal()
209 data->permute_from = 0; in getopt_internal()
210 data->num_nonopts = 0; in getopt_internal()
215 || data->optind >= argc || argv[data->optind] == 0) in getopt_internal()
218 if (strcmp (argv[data->optind], "--") == 0) in getopt_internal()
220 data->optind++; in getopt_internal()
244 if (data->optwhere == 1) in getopt_internal()
250 data->permute_from = data->optind; in getopt_internal()
251 data->num_nonopts = 0; in getopt_internal()
252 while (!is_option (argv[data->optind], only)) in getopt_internal()
254 data->optind++; in getopt_internal()
255 data->num_nonopts++; in getopt_internal()
257 if (argv[data->optind] == 0) in getopt_internal()
260 data->optind = data->permute_from; in getopt_internal()
263 else if (strcmp (argv[data->optind], "--") == 0) in getopt_internal()
266 permute (argv + data->permute_from, data->num_nonopts, 1); in getopt_internal()
267 data->optind = data->permute_from + 1; in getopt_internal()
272 if (!is_option (argv[data->optind], only)) in getopt_internal()
274 data->optarg = argv[data->optind++]; in getopt_internal()
275 return (data->optopt = 1); in getopt_internal()
279 if (!is_option (argv[data->optind], only)) in getopt_internal()
285 if (argv[data->optind] == 0) in getopt_internal()
292 && (memcmp (argv[data->optind], "--", 2) == 0 in getopt_internal()
293 || (only && argv[data->optind][0] == '+')) && data->optwhere == 1) in getopt_internal()
296 if (memcmp (argv[data->optind], "--", 2) == 0) in getopt_internal()
297 data->optwhere = 2; in getopt_internal()
299 possible_arg = strchr (argv[data->optind] + data->optwhere, '='); in getopt_internal()
303 match_chars = strlen (argv[data->optind]); in getopt_internal()
304 possible_arg = argv[data->optind] + match_chars; in getopt_internal()
305 match_chars = match_chars - data->optwhere; in getopt_internal()
308 match_chars = (possible_arg - argv[data->optind]) - data->optwhere; in getopt_internal()
312 (argv[data->optind] + data->optwhere, longopts[optindex].name, in getopt_internal()
329 if (data->opterr) in getopt_internal()
333 fputs (argv[data->optind], stderr); in getopt_internal()
340 return (data->optopt = '?'); in getopt_internal()
352 cp = strchr (shortopts, argv[data->optind][data->optwhere]); in getopt_internal()
356 if (data->opterr) in getopt_internal()
360 fputc (argv[data->optind][data->optwhere], stderr); in getopt_internal()
363 data->optwhere++; in getopt_internal()
364 if (argv[data->optind][data->optwhere] == '\0') in getopt_internal()
366 data->optind++; in getopt_internal()
367 data->optwhere = 1; in getopt_internal()
369 return (data->optopt = '?'); in getopt_internal()
373 possible_arg = argv[data->optind] + data->optwhere + 1; in getopt_internal()
374 data->optopt = *cp; in getopt_internal()
384 data->optarg = (*possible_arg != '\0') ? possible_arg : 0; in getopt_internal()
385 data->optwhere = 1; in getopt_internal()
392 data->optarg = possible_arg; in getopt_internal()
393 data->optwhere = 1; in getopt_internal()
395 else if (data->optind + 1 >= argc) in getopt_internal()
397 if (data->opterr) in getopt_internal()
405 data->optopt = initial_colon ? ':' : '\?'; in getopt_internal()
410 data->optopt = *cp; in getopt_internal()
414 data->optind++; in getopt_internal()
419 data->optarg = argv[data->optind + 1]; in getopt_internal()
421 data->optwhere = 1; in getopt_internal()
428 data->optwhere++; in getopt_internal()
429 if (argv[data->optind][data->optwhere] == '\0') in getopt_internal()
430 data->optwhere = 1; in getopt_internal()
433 data->optwhere = 1; in getopt_internal()
434 data->optarg = 0; in getopt_internal()
439 if (ordering == PERMUTE && data->optwhere == 1 && data->num_nonopts != 0) in getopt_internal()
441 permute (argv + data->permute_from, data->num_nonopts, 1 + arg_next); in getopt_internal()
442 data->optind = data->permute_from + 1 + arg_next; in getopt_internal()
444 else if (data->optwhere == 1) in getopt_internal()
445 data->optind = data->optind + 1 + arg_next; in getopt_internal()
461 return data->optopt; in getopt_internal()
467 struct getopt_data data; in getopt() local
470 read_globals (&data); in getopt()
471 r = getopt_internal (argc, argv, optstring, 0, 0, 0, &data); in getopt()
472 write_globals (&data); in getopt()
480 struct getopt_data data; in getopt_long() local
483 read_globals (&data); in getopt_long()
484 r = getopt_internal (argc, argv, shortopts, longopts, longind, 0, &data); in getopt_long()
485 write_globals (&data); in getopt_long()
493 struct getopt_data data; in getopt_long_only() local
496 read_globals (&data); in getopt_long_only()
497 r = getopt_internal (argc, argv, shortopts, longopts, longind, 1, &data); in getopt_long_only()
498 write_globals (&data); in getopt_long_only()
504 struct getopt_data *data) in __getopt_r() argument
506 return getopt_internal (argc, argv, optstring, 0, 0, 0, data); in __getopt_r()
512 struct getopt_data *data) in __getopt_long_r() argument
514 return getopt_internal (argc, argv, shortopts, longopts, longind, 0, data); in __getopt_long_r()
520 struct getopt_data *data) in __getopt_long_only_r() argument
522 return getopt_internal (argc, argv, shortopts, longopts, longind, 1, data); in __getopt_long_only_r()