From c3fbec73fb45997918bef927cea519866e1e1c9d Mon Sep 17 00:00:00 2001 From: Glenn L McGrath Date: Wed, 18 Jul 2001 15:47:21 +0000 Subject: Change read_package_field interface, and rewrite using low level functions Fixes for a few bugs that have crept into dpkg in the last few days --- archival/dpkg_deb.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'archival/dpkg_deb.c') diff --git a/archival/dpkg_deb.c b/archival/dpkg_deb.c index 7f4dcbf01..a933c6948 100644 --- a/archival/dpkg_deb.c +++ b/archival/dpkg_deb.c @@ -110,12 +110,17 @@ extern int dpkg_deb_main(int argc, char **argv) } else if (arg_type == arg_type_field) { char *field = NULL; + char *name; + char *value; int field_start = 0; - while ((field = read_package_field(&output_buffer[field_start])) != NULL) { - field_start += (strlen(field) + 1); - if (strstr(field, argv[optind + 1]) == field) { - puts(field + strlen(argv[optind + 1]) + 2); + while (1) { + field_start += read_package_field(&output_buffer[field_start], &name, &value); + if (name == NULL) { + break; + } + if (strcmp(name, argv[optind + 1]) == 0) { + puts(value); } free(field); } -- cgit v1.2.3