[Toybox] [PATCH] the shell says LINES, not ROWS

enh enh at google.com
Wed Apr 15 16:59:11 PDT 2015


terminal_size should use LINES, not ROWS.

The shell's pseudo-variable is called LINES. This is true of at least
bash and mksh.

diff --git a/lib/lib.c b/lib/lib.c
index 9664bec..99d2ea6 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -627,7 +627,7 @@ int terminal_size(unsigned *xx, unsigned *yy)
   }
   s = getenv("COLUMNS");
   if (s) sscanf(s, "%u", &x);
-  s = getenv("ROWS");
+  s = getenv("LINES");
   if (s) sscanf(s, "%u", &y);

   // Never return 0 for either value, leave it at default instead.

 1429142351.0


More information about the Toybox mailing list