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).

+                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?

--
embedded brains GmbH & Co. KG
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to