aboutsummaryrefslogtreecommitdiffstats
path: root/parsehdlist.c
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2002-02-08 16:55:16 +0000
committerFrancois Pons <fpons@mandriva.com>2002-02-08 16:55:16 +0000
commitbccfb5c229917023a3aef6cd7a4451e0366c77a1 (patch)
tree82089a0fed2dc2ece471e8cd2e62bc1e1f0a1d4f /parsehdlist.c
parent0513eea6b87a4ca73092bbd6a086a8b5cb6562b8 (diff)
downloadrpmtools-bccfb5c229917023a3aef6cd7a4451e0366c77a1.tar
rpmtools-bccfb5c229917023a3aef6cd7a4451e0366c77a1.tar.gz
rpmtools-bccfb5c229917023a3aef6cd7a4451e0366c77a1.tar.bz2
rpmtools-bccfb5c229917023a3aef6cd7a4451e0366c77a1.tar.xz
rpmtools-bccfb5c229917023a3aef6cd7a4451e0366c77a1.zip
4.2-1mdk
Diffstat (limited to 'parsehdlist.c')
-rw-r--r--parsehdlist.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/parsehdlist.c b/parsehdlist.c
index 88c9235..86ea778 100644
--- a/parsehdlist.c
+++ b/parsehdlist.c
@@ -164,7 +164,7 @@ void print_list_name(Header header, char *format, char print_sep, int extension)
char *name = get_name(header, RPMTAG_NAME);
char *version = get_name(header, RPMTAG_VERSION);
char *release = get_name(header, RPMTAG_RELEASE);
- char *arch = get_name(header, RPMTAG_ARCH);
+ char *arch = headerIsEntry(header, RPMTAG_SOURCEPACKAGE) ? "src" : get_name(header, RPMTAG_ARCH);
char *buff = alloca(strlen(name) + strlen(version) + strlen(release) + strlen(arch) + 1+1+1 + 5);
printf(format, name, "");
@@ -192,6 +192,21 @@ void print_list_name(Header header, char *format, char print_sep, int extension)
}
static
+void print_multiline(char *format, char *name, char *multiline_str) {
+ char *s, *e;
+ if ((e = strchr(multiline_str, '\n'))) {
+ char buf[4096];
+ for (s = multiline_str;(e = strchr(s, '\n')); s = e+1) {
+ if (e-s >= sizeof(buf)-1) continue; /* else it will fails */
+ memcpy(buf, s, e-s); buf[e-s] = 0;
+ printf(format, name, buf);
+ }
+ } else {
+ printf(format, name, multiline_str);
+ }
+}
+
+static
void print_help(void) {
fprintf(stderr,
"parsehdlist version " VERSION_STRING "\n"
@@ -423,10 +438,10 @@ int main(int argc, char **argv)
if (print_size) printf(printable_header(print_quiet, "size", print_sep, "\n"), name, get_int(header, RPMTAG_SIZE));
if (print_serial) printf(printable_header(print_quiet, "serial", print_sep, "\n"),
name, get_int(header, RPMTAG_EPOCH));
- if (print_summary) printf(printable_header(print_quiet, "summary", print_sep, "\n"),
- name, get_name(header, RPMTAG_SUMMARY));
- if (print_description) printf(printable_header(print_quiet, "description", print_sep, "\n"),
- name, get_name(header, RPMTAG_DESCRIPTION));
+ if (print_summary) print_multiline(printable_header(print_quiet, "summary", print_sep, "\n"),
+ name, get_name(header, RPMTAG_SUMMARY));
+ if (print_description) print_multiline(printable_header(print_quiet, "description", print_sep, "\n"),
+ name, get_name(header, RPMTAG_DESCRIPTION));
if (print_name) print_list_name(header, printable_header(print_quiet, "name", print_sep, 0), print_sep, 0);
if (print_info) print_list_name(header, printable_header(print_quiet, "info", print_sep, 0), print_sep, 1);
if ((print_name | print_info | print_group | print_size | print_serial | print_summary | print_description |