From d3cefcc3e547041767bab40f7c462a8368636746 Mon Sep 17 00:00:00 2001 From: Enno Boland Date: Mon, 21 Aug 2023 08:45:49 +0200 Subject: [PATCH] README.md: add explanation to examples. This commit adds an explanation to the example in the README.md file what it does. Also it links to further examples now. --- README.md | 23 +++++------------------ examples/readme_example.c | 3 +-- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 34517a8b0..4f88cb5f5 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,9 @@ provides zero-copy interfaces to the squashfs archives. ## Example +This is a simple example that a) prints the content of a file and b) lists the +content of a directory. + ```c struct SqshArchive *archive = sqsh_archive_open("/path/to/archive.squashfs", NULL, NULL); @@ -25,8 +28,7 @@ const size_t size = sqsh_easy_file_size(archive, "/path/to/file", NULL); fwrite(contents, 1, size, stdout); free(contents); -char **files = - sqsh_easy_directory_list(archive, "/path/to/directory", NULL); +char **files = sqsh_easy_directory_list(archive, "/path/to/dir", NULL); assert(files != NULL); for (int i = 0; files[i] != NULL; i++) { printf("%s\n", files[i]); @@ -36,22 +38,7 @@ free(files); sqsh_archive_close(archive); ``` -## Roadmap to 1.0 - -* [x] directory listing -* [x] file content reading -* [x] inode metadata -* [x] path traversal -* [x] xattr support -* [x] symlink resolution for path traversal -* [x] LRU cache for metadata -* [x] LRU cache for file content -* [x] thread safety -* [x] fuse file system -* [x] OpenBSD support -* [x] FreeBSD support -* [ ] refine the high-level API -* [x] refine the low-level API +Find further examples in the [examples](examples) directory. ## Building diff --git a/examples/readme_example.c b/examples/readme_example.c index 0f1b83c97..600d1d1b6 100644 --- a/examples/readme_example.c +++ b/examples/readme_example.c @@ -22,8 +22,7 @@ main(int argc, char *argv[]) { fwrite(contents, 1, size, stdout); free(contents); - char **files = - sqsh_easy_directory_list(archive, "/path/to/directory", NULL); + char **files = sqsh_easy_directory_list(archive, "/path/to/dir", NULL); assert(files != NULL); for (int i = 0; files[i] != NULL; i++) { printf("%s\n", files[i]);