- if (strcasecmp(output_str, "left") == 0) {
- output = get_output_next(D_LEFT, current_output, CLOSEST_OUTPUT);
- if (!output)
- output = get_output_most(D_RIGHT, current_output);
- } else if (strcasecmp(output_str, "right") == 0) {
- output = get_output_next(D_RIGHT, current_output, CLOSEST_OUTPUT);
- if (!output)
- output = get_output_most(D_LEFT, current_output);
- } else if (strcasecmp(output_str, "up") == 0) {
- output = get_output_next(D_UP, current_output, CLOSEST_OUTPUT);
- if (!output)
- output = get_output_most(D_DOWN, current_output);
- } else if (strcasecmp(output_str, "down") == 0) {
- output = get_output_next(D_DOWN, current_output, CLOSEST_OUTPUT);
- if (!output)
- output = get_output_most(D_UP, current_output);
- } else output = get_output_by_name(output_str);
+ if (strcasecmp(output_str, "left") == 0)
+ output = get_output_next_wrap(D_LEFT, current_output);
+ else if (strcasecmp(output_str, "right") == 0)
+ output = get_output_next_wrap(D_RIGHT, current_output);
+ else if (strcasecmp(output_str, "up") == 0)
+ output = get_output_next_wrap(D_UP, current_output);
+ else if (strcasecmp(output_str, "down") == 0)
+ output = get_output_next_wrap(D_DOWN, current_output);
+ else output = get_output_by_name(output_str);