# HG changeset patch # User Rob Landley # Date 1356572391 21600 # Node ID 017b8fd3c9ac5a86dd849831622c4878fddebe5d # Parent 979d038c168849546b99dbe8b90ad8fd0752c9d8 A screen width of 1 is possible (in some weird setups), and gives ls -C a division by zero error. diff -r 979d038c1688 -r 017b8fd3c9ac toys/posix/ls.c --- a/toys/posix/ls.c Sun Dec 23 15:07:28 2012 -0600 +++ b/toys/posix/ls.c Wed Dec 26 19:39:51 2012 -0600 @@ -425,6 +425,7 @@ 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,