On 13/12/2023 5:32 pm, Sebastian Huber wrote: > On 13.12.23 03:47, chr...@rtems.org wrote: >> + /* >> + *https://github.com/tmux/tmux/issues/3457 >> + * >> + * Tmux has a bug where the lines and cols are swapped. There is a >> lag >> + * in the time it takes to get the fix into code so see if tmux is >> + * running and which version and work around the bug. >> + * >> + * CSI > Ps q >> + * Ps = 0 => DCS > | text ST >> + */ >> + fputs("\033[>0q", stdout); >> + fflush(stdout); >> + if (rtems_shell_term_wait_for(fd, "\033P>|", timeout)) { >> + int len = rtems_shell_term_buffer_until(fd, buf, sizeof(buf), >> "\033\\", timeout); >> + if (len > 0) { >> + if (memcmp(buf, "tmux ", 5) == 0) { >> + static const char* bad_versions[] = { > > static const char* const bad_versions > >> + "3.2", "3.2a", "3.3", "3.3a" >> + }; >> + #define bad_versions_num (sizeof(bad_versions) / >> sizeof(bad_versions[0])) >> + size_t i; >> + for (i = 0; i < bad_versions_num; ++i) { > > Maybe use RTEMS_ARRAY_SIZE(bad_versions_num).
Sure >> + if (strcmp(bad_versions[i], buf + 5) == 0) { >> + row_cols_swapped = true; >> + break; >> + } >> + } >> + } >> + } >> + } > > Maybe this should be placed in a helper function which returns > row_cols_swapped? > Sorry, I am not sure I understand. Are you suggesting the version detection against the string in the buffer is in a helper function? Chris _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel