Various programs call opkg and extract information from its list and info
commands. To simplify parsing the output, do not line-wrap long description
lines if opkg is not talking to a tty.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
#include <stdio.h>
#include <ctype.h>
#include <stdio.h>
#include <ctype.h>
#include "pkg.h"
#include "opkg_utils.h"
#include "pkg.h"
#include "opkg_utils.h"
case ' ':
if ((mask & PFM_DESCRIPTION) && reading_description) {
case ' ':
if ((mask & PFM_DESCRIPTION) && reading_description) {
- pkg->description = xrealloc(pkg->description,
- strlen(pkg->description)
- + 1 + strlen(line) + 1);
- strcat(pkg->description, "\n");
+ if (isatty(1)) {
+ pkg->description = xrealloc(pkg->description,
+ strlen(pkg->description)
+ + 1 + strlen(line) + 1);
+ strcat(pkg->description, "\n");
+ } else {
+ pkg->description = xrealloc(pkg->description,
+ strlen(pkg->description)
+ + 1 + strlen(line));
+ }
strcat(pkg->description, (line));
goto dont_reset_flags;
} else if ((mask & PFM_CONFFILES) && reading_conffiles) {
strcat(pkg->description, (line));
goto dont_reset_flags;
} else if ((mask & PFM_CONFFILES) && reading_conffiles) {