From b65c075d13990383f30b27aeafacdd4575fafdee Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Tue, 18 Apr 2023 16:41:42 -0400 Subject: ustar: Use linked list instead of varargs in seek Also indicate when all sought member files are found. --- (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index d9ccb64..b24a2fd 100644 --- a/src/main.c +++ b/src/main.c @@ -20,11 +20,21 @@ #include #include "defs.h" #include "opk.h" +#include "ustar.h" int main(int argc, char *argv[]) { - struct opkg_opk_opk *opk; + struct opkg_opk_ustar_seek_name *control_files_head; + struct opkg_opk_ustar_seek_name *control_files_tail; + struct opkg_opk_opk *opk; + + control_files_head = control_files_tail = NULL; + if (opkg_opk_ustar_add_seek_name( + &control_files_head, &control_files_tail, + "control") != OPKG_OPK_OK) { + goto error0; + } /* Initialize outer archive. */ opk = opkg_opk_opk_init_outer(argv[1]); @@ -36,7 +46,7 @@ main(int argc, char *argv[]) if (opkg_opk_opk_init_inner(opk, "control.tar.gz") != OPKG_OPK_OK) { goto error1; } - if (opkg_opk_opk_read_control(opk) != OPKG_OPK_OK) { + if (opkg_opk_opk_read_control(opk, control_files_head) != OPKG_OPK_OK) { goto error2; } opkg_opk_opk_free_inner(opk); @@ -58,5 +68,10 @@ main(int argc, char *argv[]) error1: opkg_opk_opk_free_outer(opk); error0: + for (control_files_tail = control_files_head; + control_files_tail != NULL; ) { + control_files_tail = control_files_head->next; + free(control_files_head); + } return EXIT_FAILURE; } -- cgit v0.9.1