summaryrefslogtreecommitdiffstats
path: root/src/ustar.c
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2023-04-17 10:44:37 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2023-04-17 10:44:37 (EDT)
commit0f96542e7c0f0555b2b2ef7ac52c574a616fa7b2 (patch)
tree577b7a677c577c77c0264108fd43e32c990f943e /src/ustar.c
parent9c0b496a54aa4aa4506c803538d79457e1abd162 (diff)
ustar: Search for multiple member names
Diffstat (limited to 'src/ustar.c')
-rw-r--r--src/ustar.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/ustar.c b/src/ustar.c
index 21d41eb..d728cf5 100644
--- a/src/ustar.c
+++ b/src/ustar.c
@@ -17,6 +17,7 @@
* along with opkg-opk. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@@ -128,10 +129,13 @@ opkg_opk_ustar_list(struct opkg_opk_ustar *ustar,
}
int
-opkg_opk_ustar_seek(struct opkg_opk_ustar *ustar, const char *member)
+opkg_opk_ustar_seek(struct opkg_opk_ustar *ustar, int num_keys, ...)
{
static struct _opkg_opk_ustar_header header;
static unsigned char name[OPKG_OPK_USTAR_NAME_MAX_LEN];
+ va_list ap;
+ int key;
+ const char *member;
for (;;) {
if (_opkg_opk_ustar_next(ustar, &header) != OPKG_OPK_OK) {
@@ -146,9 +150,14 @@ opkg_opk_ustar_seek(struct opkg_opk_ustar *ustar, const char *member)
name[sizeof(header.name)] = '\0';
}
- if (strcmp((char *) name, member) == 0) {
- return OPKG_OPK_OK; /* Member found */
+ va_start(ap, num_keys);
+ for (key = 0; key < num_keys; ++key) {
+ member = va_arg(ap, const char *);
+ if (strcmp((char *) name, member) == 0) {
+ return OPKG_OPK_OK; /* Member found */
+ }
}
+ va_end(ap);
while (ustar->data_size_remaining > 0) {
if (opkg_opk_ustar_read(ustar, NULL, NULL) ==