xbps-{bin,repo}: wrap long lines for list, pkg-list and search targets.

Fixes issue #26
This commit is contained in:
Juan RP
2012-07-31 17:50:50 +02:00
parent eb75041b25
commit 1be90e57d7
8 changed files with 89 additions and 49 deletions

View File

@@ -216,18 +216,22 @@ list_strings_sep_in_array(struct xbps_handle *xhp,
return 0;
}
size_t
get_maxcols(void)
{
struct winsize ws;
if (ioctl(1, TIOCGWINSZ, &ws) == 0)
return ws.ws_col;
return 80;
}
void
print_package_line(const char *str, bool reset)
print_package_line(const char *str, size_t maxcols, bool reset)
{
static size_t cols;
static bool first;
struct winsize ws;
size_t maxcols;
if (ioctl(1, TIOCGWINSZ, &ws) == 0)
maxcols = ws.ws_col;
else
maxcols = 80;
if (reset) {
cols = 0;