MCPcopy Create free account
hub / github.com/Singular/Singular / exchange

Function exchange

resources/fegetopt.c:243–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

241#endif
242
243static void exchange (char **argv)
244{
245 char *temp, **first, **last;
246
247 /* Reverse all the elements [first_nonopt, fe_optind) */
248 first = &argv[first_nonopt];
249 last = &argv[fe_optind-1];
250 while (first < last) {
251 temp = *first; *first = *last; *last = temp; first++; last--;
252 }
253 /* Put back the options in order */
254 first = &argv[first_nonopt];
255 first_nonopt += (fe_optind - last_nonopt);
256 last = &argv[first_nonopt - 1];
257 while (first < last) {
258 temp = *first; *first = *last; *last = temp; first++; last--;
259 }
260
261 /* Put back the non options in order */
262 first = &argv[first_nonopt];
263 last_nonopt = fe_optind;
264 last = &argv[last_nonopt-1];
265 while (first < last) {
266 temp = *first; *first = *last; *last = temp; first++; last--;
267 }
268}
269
270/* Scan elements of ARGV (whose length is ARGC) for option characters
271 given in OPTSTRING.

Callers 1

_fe_getopt_internalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected