A screen width of 1 is possible (in some weird setups), and gives ls -C a division...
authorRob Landley <rob@landley.net>
Thu, 27 Dec 2012 01:39:51 +0000 (19:39 -0600)
committerRob Landley <rob@landley.net>
Thu, 27 Dec 2012 01:39:51 +0000 (19:39 -0600)
toys/posix/ls.c

index cd881b0..5982adf 100644 (file)
@@ -425,6 +425,7 @@ void ls_main(void)
   else {
     TT.screen_width = 80;
     terminal_size(&TT.screen_width, NULL);
+    if (TT.screen_width<2) TT.screen_width = 2;
     if (!(toys.optflags&(FLAG_1|FLAG_x|FLAG_m))) toys.optflags |= FLAG_C;
   }
   // The optflags parsing infrastructure should really do this for us,