Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README.md: add explanation to examples. #49

Merged
merged 1 commit into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 5 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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]);
Expand All @@ -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

Expand Down
3 changes: 1 addition & 2 deletions examples/readme_example.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down