13main(
int argc,
char *argv[]) {
16 printf(
"Usage: %s <sqsh-file> <path>\n", argv[0]);
24 .mapper_block_size = 0,
26 .metablock_lru_size = 0,
29 .max_symlink_depth = 0,
33 if (error_code != 0) {
38 if (error_code != 0) {
45 if (error_code != 0) {
53 fwrite(data, size, 1, stdout);
62 sqsh_archive_close(archive);
int main(int argc, char *argv[])
void sqsh_perror(int error_code, const char *msg)
Print the error message for the given error code.
const struct SqshMemoryMapperImpl *const sqsh_mapper_impl_mmap
a mapper that uses mmap to map the file into memory.
SQSH_NO_UNUSED struct SqshArchive * sqsh_archive_open(const void *source, const struct SqshConfig *config, int *err)
initializes a archive context in heap.
The SqshConfig struct contains all the configuration options for a sqsh session.
const struct SqshMemoryMapperImpl * source_mapper
source_mapper is the memory mapper implementation that will be used to map the archive.
An iterator over the contents of a file.
SQSH_NO_UNUSED size_t sqsh_file_iterator_size(const struct SqshFileIterator *iterator)
Gets the size of the data currently in the file iterator.
SQSH_NO_UNUSED struct SqshFileIterator * sqsh_file_iterator_new(const struct SqshFile *file, int *err)
Creates a new SqshFileIterator struct and initializes it.
SQSH_NO_UNUSED bool sqsh_file_iterator_next(struct SqshFileIterator *iterator, size_t desired_size, int *err)
Reads a certain amount of data from the file iterator.
int sqsh_file_iterator_free(struct SqshFileIterator *iterator)
Frees the resources used by a SqshFileIterator struct.
SQSH_NO_UNUSED const uint8_t * sqsh_file_iterator_data(const struct SqshFileIterator *iterator)
Gets a pointer to the current data in the file iterator.
SQSH_NO_UNUSED struct SqshFile * sqsh_open(struct SqshArchive *archive, const char *path, int *err)
Initialize the file context from a path.