[haiku-commits] Re: haiku: hrev48939 - src/bin/pkgman

  • From: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 27 Mar 2015 21:57:27 +0100

Am 27/03/2015 um 21:51 schrieb waddlesplash@xxxxxxxxx:
-       struct winsize w;
-       ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
-       const int width = (w.ws_col > 77)
-               ? 70 : (w.ws_col - 7); // we need 70 chars for the bar + 7 for 
%.
+       int width = 70;
+
+       struct winsize winSize;
+       if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &winSize) == 0
+               && winSize.ws_col < 77) {
+               // We need 7 characters for the percent display
+               width = windowSize.ws_col - 7;
                        ^^^^^^^^^^
This wasn't a good model for copy&paste...
Please always build before you commit -- even with tiny changes like this one.

Bye,
   Axel.

Other related posts: