summaryrefslogtreecommitdiffstats
path: root/package/opkg/patches/040-wrap-descriptions-only-on-ttys.patch
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2012-11-15 20:17:49 +0000
committerJo-Philipp Wich <jow@openwrt.org>2012-11-15 20:17:49 +0000
commitede4e23677a2a05ac9b87c4db1a4d35920c3e607 (patch)
treef2e4a621817d9080ab0e8f50b37c435d40e290e8 /package/opkg/patches/040-wrap-descriptions-only-on-ttys.patch
parent485f9573f8ee85fbc1878901550d9887c0e18627 (diff)
downloadmaster-31e0f0ae-ede4e23677a2a05ac9b87c4db1a4d35920c3e607.tar.gz
master-31e0f0ae-ede4e23677a2a05ac9b87c4db1a4d35920c3e607.tar.bz2
master-31e0f0ae-ede4e23677a2a05ac9b87c4db1a4d35920c3e607.zip
opkg: various additions - only wrap package descriptions when outputting to a tty, simplifies parsing descriptions with external utils - introduce -i (--nocase) flag which makes all matching operations case insensitive - introduce "find" command which searches package names and descriptions (e.g. opkg -i find "*autoconfig*")
SVN-Revision: 34202
Diffstat (limited to 'package/opkg/patches/040-wrap-descriptions-only-on-ttys.patch')
-rw-r--r--package/opkg/patches/040-wrap-descriptions-only-on-ttys.patch31
1 files changed, 31 insertions, 0 deletions
diff --git a/package/opkg/patches/040-wrap-descriptions-only-on-ttys.patch b/package/opkg/patches/040-wrap-descriptions-only-on-ttys.patch
new file mode 100644
index 0000000000..95406687b6
--- /dev/null
+++ b/package/opkg/patches/040-wrap-descriptions-only-on-ttys.patch
@@ -0,0 +1,31 @@
+--- a/libopkg/pkg_parse.c
++++ b/libopkg/pkg_parse.c
+@@ -20,6 +20,7 @@
+
+ #include <stdio.h>
+ #include <ctype.h>
++#include <unistd.h>
+
+ #include "pkg.h"
+ #include "opkg_utils.h"
+@@ -239,10 +240,16 @@ pkg_parse_line(void *ptr, const char *li
+
+ 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) {