diff options
author | Patrick 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) |
commit | b65c075d13990383f30b27aeafacdd4575fafdee (patch) | |
tree | c338c3db137405b98bf74091d9c9965d5c92d7cf /src/main.c | |
parent | 25ce512c39f578def257f81e10e22b06123a069d (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.c | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -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; } |