aboutsummaryrefslogtreecommitdiffstats
path: root/parsehdlist.c
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2001-07-02 12:39:42 +0000
committerFrancois Pons <fpons@mandriva.com>2001-07-02 12:39:42 +0000
commit7ae2c69a2fef5f617f68c5f203e71fa4538de27a (patch)
tree4c7bd4bd07a91fdb19b7fad32e245195c658e116 /parsehdlist.c
parentd8d949cd037f50fe93e78211675a63bfe002d3e3 (diff)
downloadrpmtools-7ae2c69a2fef5f617f68c5f203e71fa4538de27a.tar
rpmtools-7ae2c69a2fef5f617f68c5f203e71fa4538de27a.tar.gz
rpmtools-7ae2c69a2fef5f617f68c5f203e71fa4538de27a.tar.bz2
rpmtools-7ae2c69a2fef5f617f68c5f203e71fa4538de27a.tar.xz
rpmtools-7ae2c69a2fef5f617f68c5f203e71fa4538de27a.zip
added arch support for parsehdlist.
Diffstat (limited to 'parsehdlist.c')
-rw-r--r--parsehdlist.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/parsehdlist.c b/parsehdlist.c
index c8ab948..af8b904 100644
--- a/parsehdlist.c
+++ b/parsehdlist.c
@@ -388,7 +388,7 @@ int main(int argc, char **argv)
/* interactive mode */
while (interactive_mode) {
char in_name[4096];
- char *in_tag, *in_version, *in_release;
+ char *in_tag, *in_version, *in_release, *in_arch;
unsigned long hash_in_name;
int i, count = 0;
@@ -398,6 +398,7 @@ int main(int argc, char **argv)
break;
}
*in_tag++ = 0;
+ if ((in_arch = strrchr(in_name, '.')) != NULL && !strchr(in_arch, '-')) *in_arch++ = 0; else in_arch = 0;
if ((in_release = strrchr(in_name, '-')) != NULL) {
*in_release++ = 0;
if ((in_version = strrchr(in_name, '-')) != NULL) {
@@ -406,15 +407,22 @@ int main(int argc, char **argv)
for (i = 0; i < count_headers; ++i) {
if (headers[i].hash_name == hash_in_name && !strcmp(headers[i].name, in_name)) {
if (strcmp(get_name(headers[i].header, RPMTAG_VERSION), in_version)) continue;
- if (strcmp(get_name(headers[i].header, RPMTAG_RELEASE), in_release)) continue;
+ if (strcmp(get_name(headers[i].header, RPMTAG_RELEASE), in_release)) {
+ if (in_arch) in_arch[-1] = '.';
+ if (strcmp(get_name(headers[i].header, RPMTAG_RELEASE), in_release)) {
+ if (in_arch) in_arch[-1] = 0;
+ continue;
+ }
+ } else if (in_arch && strcmp(get_name(headers[i].header, RPMTAG_ARCH), in_arch)) continue;
print_header_flag_interactive(in_tag, headers[i].header);
++count;
break; /* special case to avoid multiple output for multiply defined same package */
}
}
- if (!count) in_version[-1] = '-';
+ in_version[-1] = '-';
}
if (!count) {
+ if (in_arch) in_arch[-1] = '.';
in_version = in_release;
hash_in_name = hash(in_name);
for (i = 0; i < count_headers; ++i) {
@@ -424,15 +432,16 @@ int main(int argc, char **argv)
++count;
}
}
- if (!count) in_version[-1] = '-';
+ in_version[-1] = '-';
}
}
if (!count) {
+ if (in_arch) in_arch[-1] = '.';
hash_in_name = hash(in_name);
for (i = 0; i < count_headers; ++i) {
if (headers[i].hash_name == hash_in_name && !strcmp(headers[i].name, in_name)) {
print_header_flag_interactive(in_tag, headers[i].header);
- ++count;
+ ++count;
}
}
}