libsqsh v1.5.1
Loading...
Searching...
No Matches
traverse_dir.c
Go to the documentation of this file.
1
8#include <assert.h>
9#include <sqsh.h>
10#include <stdio.h>
11#include <stdlib.h>
12
13int
14main(int argc, char *argv[]) {
15 if (argc != 2) {
16 printf("Usage: %s <sqsh-file>\n", argv[0]);
17 return 1;
18 }
19 struct SqshArchive *archive = sqsh_archive_open(argv[1], NULL, NULL);
20 assert(archive != NULL);
21
22 char **dir_list = sqsh_easy_tree_traversal(archive, "/xfce-extra", NULL);
23 assert(dir_list != NULL);
24
25 for (int i = 0; dir_list[i] != NULL; i++) {
26 puts(dir_list[i]);
27 }
28
29 free(dir_list);
30 sqsh_archive_close(archive);
31 return 0;
32}
char ** sqsh_easy_tree_traversal(struct SqshArchive *archive, const char *path, int *err)
SQSH_NO_UNUSED struct SqshArchive * sqsh_archive_open(const void *source, const struct SqshConfig *config, int *err)
initializes a archive context in heap.
int sqsh_archive_close(struct SqshArchive *archive)
Frees the resources used by a Sqsh instance.
int main(int argc, char *argv[])