- for (i = 0; i <= path_len; i++) {
- char *this_i = &path_list[i];
- if (*this_i == ':') {
- /* ^::[^:] == \.: */
- if (!i && (*(this_i + 1) == ':')) {
- *this_i = '.';
- continue;
- }
- *this_i = 0;
- count++;
- /* ^:[^:] == \.0 and [^:]::[^:] == 0\.0 and [^:]:$ == 0\.0 */
- if (!i || (*(this_i + 1) == ':') || (i == path_len-1)) {
- new_list = xrealloc(new_list, path_len += 1);
- if (i) {
- memmove(&new_list[i+2], &path_list[i+1], path_len-i);
- new_list[i+1] = '.';
- memmove(new_list, path_list, i);
- } else {
- memmove(&new_list[i+1], &path_list[i], path_len-i);
- new_list[i] = '.';
+ p = find_execable(*argv, &tmp);
+ if (!p)
+ status = EXIT_FAILURE;
+ else {
+ print:
+ puts(p);
+ free(p);
+ if (opt) {
+ /* -a: show matches in all PATH components */
+ if (tmp) {
+ p = find_execable(*argv, &tmp);
+ if (p)
+ goto print;