040-wrap-descriptions-only-on-ttys.patch 896 B

12345678910111213141516171819202122232425262728293031
  1. --- a/libopkg/pkg_parse.c
  2. +++ b/libopkg/pkg_parse.c
  3. @@ -20,6 +20,7 @@
  4. #include <stdio.h>
  5. #include <ctype.h>
  6. +#include <unistd.h>
  7. #include "pkg.h"
  8. #include "opkg_utils.h"
  9. @@ -239,10 +240,16 @@ pkg_parse_line(void *ptr, const char *li
  10. case ' ':
  11. if ((mask & PFM_DESCRIPTION) && reading_description) {
  12. - pkg->description = xrealloc(pkg->description,
  13. - strlen(pkg->description)
  14. - + 1 + strlen(line) + 1);
  15. - strcat(pkg->description, "\n");
  16. + if (isatty(1)) {
  17. + pkg->description = xrealloc(pkg->description,
  18. + strlen(pkg->description)
  19. + + 1 + strlen(line) + 1);
  20. + strcat(pkg->description, "\n");
  21. + } else {
  22. + pkg->description = xrealloc(pkg->description,
  23. + strlen(pkg->description)
  24. + + 1 + strlen(line));
  25. + }
  26. strcat(pkg->description, (line));
  27. goto dont_reset_flags;
  28. } else if ((mask & PFM_CONFFILES) && reading_conffiles) {