(argv)
| 219 | the new indices of the non-options in ARGV after they are moved. */ |
| 220 | |
| 221 | static void |
| 222 | exchange(argv) |
| 223 | char **argv; |
| 224 | { |
| 225 | int nonopts_size = (last_nonopt - first_nonopt) * sizeof(char *); |
| 226 | char **temp = (char **) calloc(1, nonopts_size); |
| 227 | |
| 228 | /* Interchange the two blocks of data in ARGV. */ |
| 229 | |
| 230 | my_bcopy((char *) &argv[first_nonopt], (char *) temp, nonopts_size); |
| 231 | my_bcopy((char *) &argv[last_nonopt], (char *) &argv[first_nonopt], |
| 232 | (optind - last_nonopt) * sizeof(char *)); |
| 233 | my_bcopy((char *) temp, |
| 234 | (char *) &argv[first_nonopt + optind - last_nonopt], |
| 235 | nonopts_size); |
| 236 | |
| 237 | /* Update records for the slots the non-options now occupy. */ |
| 238 | |
| 239 | first_nonopt += (optind - last_nonopt); |
| 240 | last_nonopt = optind; |
| 241 | free(temp); |
| 242 | } |
| 243 | |
| 244 | /* Scan elements of ARGV (whose length is ARGC) for option characters |
| 245 | given in OPTSTRING. |
no test coverage detected