opkg: various additions
[openwrt/svn-archive/archive.git] / package / opkg / patches / 040-wrap-descriptions-only-on-ttys.patch
1 --- a/libopkg/pkg_parse.c
2 +++ b/libopkg/pkg_parse.c
3 @@ -20,6 +20,7 @@
4
5 #include <stdio.h>
6 #include <ctype.h>
7 +#include <unistd.h>
8
9 #include "pkg.h"
10 #include "opkg_utils.h"
11 @@ -239,10 +240,16 @@ pkg_parse_line(void *ptr, const char *li
12
13 case ' ':
14 if ((mask & PFM_DESCRIPTION) && reading_description) {
15 - pkg->description = xrealloc(pkg->description,
16 - strlen(pkg->description)
17 - + 1 + strlen(line) + 1);
18 - strcat(pkg->description, "\n");
19 + if (isatty(1)) {
20 + pkg->description = xrealloc(pkg->description,
21 + strlen(pkg->description)
22 + + 1 + strlen(line) + 1);
23 + strcat(pkg->description, "\n");
24 + } else {
25 + pkg->description = xrealloc(pkg->description,
26 + strlen(pkg->description)
27 + + 1 + strlen(line));
28 + }
29 strcat(pkg->description, (line));
30 goto dont_reset_flags;
31 } else if ((mask & PFM_CONFFILES) && reading_conffiles) {