[Add] You can now use pack to list files in packfile.
This commit is contained in:
parent
856ea04d8d
commit
5c75686736
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user