diff options
author | Francois Pons <fpons@mandriva.com> | 2001-11-14 20:11:22 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 2001-11-14 20:11:22 +0000 |
commit | b77b685158a65dd67b1e15aff5fc974d035edba8 (patch) | |
tree | 525e9cd1f15d647f3f92aac5947d63863e9b26e7 | |
parent | 13c7d4539487b5b6e7346a82b2e06ab55b2612ac (diff) | |
download | rpmtools-b77b685158a65dd67b1e15aff5fc974d035edba8.tar rpmtools-b77b685158a65dd67b1e15aff5fc974d035edba8.tar.gz rpmtools-b77b685158a65dd67b1e15aff5fc974d035edba8.tar.bz2 rpmtools-b77b685158a65dd67b1e15aff5fc974d035edba8.tar.xz rpmtools-b77b685158a65dd67b1e15aff5fc974d035edba8.zip |
fixed core dump when name is given with other argument on some case.
changed --name behaviour to give filename along with fullname.
-rw-r--r-- | parsehdlist.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/parsehdlist.c b/parsehdlist.c index af8b904..c80308e 100644 --- a/parsehdlist.c +++ b/parsehdlist.c @@ -13,6 +13,9 @@ #define VERSION_STRING "0.0" #endif +/* see rpm2header.c */ +#define FILENAME_TAG 1000000 + /* static data for very simple list */ static struct { char *name; @@ -362,14 +365,25 @@ int main(int argc, char **argv) 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_name || (print_provides | print_requires | print_files | print_conflicts | print_obsoletes | print_prereqs | - print_group | print_size | print_serial | print_summary | print_description) == 0) { - if (print_name) printf(printable_header(print_quiet, "name", print_sep, 0), name); - printf("%s-%s-%s.%s.rpm\n", - name, - get_name(header, RPMTAG_VERSION), - get_name(header, RPMTAG_RELEASE), - get_name(header, RPMTAG_ARCH)); + if (print_name) { + char *version = get_name(header, RPMTAG_VERSION); + char *release = get_name(header, RPMTAG_RELEASE); + char *arch = get_name(header, RPMTAG_ARCH); + char *buff = alloca(strlen(version) + strlen(release) + strlen(arch) + 1+1+1 + 4); + + printf(printable_header(print_quiet, "name", print_sep, 0), name, ""); + + sprintf(buff, "%s-%s-%s.%s.rpm", name, version, release, arch); + if (!strcmp(buff, get_name(header, FILENAME_TAG))) { + printf("%s-%s-%s.%s\n", name, version, release, arch); + } else { + printf("%s-%s-%s.%s%c%s\n", name, version, release, arch, + print_sep ? print_sep : ':', get_name(header, FILENAME_TAG)); + } + } + if ((print_name | print_provides | print_requires | print_files | print_conflicts | print_obsoletes | print_prereqs | + print_group | print_size | print_serial | print_summary | print_description) == 0) { + printf("%s\n", get_name(header, FILENAME_TAG)); } headerFree(header); } |