Assume 80 columns if TIOCGWINSZ ws.col is bogus (0).

This commit is contained in:
Juan RP 2013-08-10 12:59:59 +02:00
parent 2f9bd4f9a2
commit 9c9d5b58dd
2 changed files with 5 additions and 2 deletions

3
NEWS
View File

@ -1,5 +1,8 @@
xbps-0.26 (???):
* On terminals with 0 columns, assume 80. Xen's PV guest running Linux and its
hvc console does report 0 columns/rows.
* libxbps: introduce xbps_array_foreach_cb() which is a multithreaded implementation,
to process N items of an array spawning 1 thread per core. This makes XBPS use
threads when possible on multi-core CPUs.

View File

@ -1,5 +1,5 @@
/*-
* Copyright (c) 2008-2012 Juan Romero Pardines.
* Copyright (c) 2008-2013 Juan Romero Pardines.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -41,7 +41,7 @@ get_maxcols(void)
struct winsize ws;
if (ioctl(fileno(stdin), TIOCGWINSZ, &ws) == 0)
return ws.ws_col;
return ws.ws_col ? ws.ws_col : 80;
return 80;
}