summaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2023-04-18 16:41:42 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2023-04-18 19:47:12 (EDT)
commitb65c075d13990383f30b27aeafacdd4575fafdee (patch)
treec338c3db137405b98bf74091d9c9965d5c92d7cf /src/main.c
parent25ce512c39f578def257f81e10e22b06123a069d (diff)
ustar: Use linked list instead of varargs in seek
Also indicate when all sought member files are found.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c19
1 files changed, 17 insertions, 2 deletions
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 <stdlib.h>
#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;
}