[Add] You can now use pack to list files in packfile.

This commit is contained in:
Allanis 2013-05-16 15:32:38 +01:00
parent 856ea04d8d
commit 5c75686736

View File

@ -1,5 +1,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include "pack.h"
@ -9,17 +10,29 @@ int main(int argc, char** argv) {
switch(argc) {
case 1:
fprintf(stderr, "Missing output file\n");
case 2:
fprintf(stderr, "Missing input file/s\n");
goto usage;
break;
}
char* outfile = argv[1];
char** list;
uint32_t nlist;
int i;
uint32_t nfiles = (uint32_t)argc - 2;
argv += 2;
if(nfiles == 0) {
// No files, list what it has.
fprintf(stdout, "Packfile '%s' contains:\n", outfile);
for(i = 0; i < nlist; i++) {
fprintf(stdout, " %03d) %s\n", i, list[i]);
free(list[i]);
}
free(list);
} else {
pack_files(outfile, (const char**)argv, nfiles);
}
exit(EXIT_SUCCESS);