diff options
| author | jakob <jakob@memeware.net> | 2017-05-11 16:21:27 -0400 |
|---|---|---|
| committer | jakob <jakob@memeware.net> | 2017-05-11 16:21:27 -0400 |
| commit | 93919335b1cff88127cb1d6e2ad1762dd7bf353e (patch) | |
| tree | 442f9b1733bfde3acc4263252ae4a971850be096 /src/main.c | |
| parent | 1885dd37171b1cf95210e7a4850c2179f21a9e08 (diff) | |
Finished basic table dumping functionality
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -200,7 +200,7 @@ static void map_entries(char *path, struct params p) { /* Creates a new XP3 archive at the first path specified by `paths`, and flattens files specified by any following paths into the archive. */ -static void create_archive(char **paths, struct params p) { +static void create_archive(char **paths, int argc, struct params p) { FILE *fp = fopen(paths[0], "wb+"); if (fp == NULL) { perror(paths[0]); @@ -208,8 +208,12 @@ static void create_archive(char **paths, struct params p) { } struct header *h = create_header(); - struct table_entry *root = calloc(sizeof(struct table_entry), 1); + struct table_entry *root = calloc(sizeof(struct table_entry), 1), *cur; dump_header(fp, h); + for (int i = 1; i < argc - p.vararg_index; i++) { + cur = add_file(root, paths[i]); + } + dump_table(fp, root); } @@ -232,7 +236,7 @@ int main(int argc, char **argv) { map_entries(argv[i], p); break; case CREATE: - create_archive(argv + p.vararg_index, p); + create_archive(argv + p.vararg_index, argc, p); } params_free(p); return EXIT_SUCCESS; |