#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <stdio.h>
 
{
    unsigned int mask, level;
    int i;
 
        level = 0;
        mask = 0;
 
                mask |= 1 << level;
            ++level;
        }
 
        for (i = level - 1; i >= 0; --i)
            fputs(mask & (1 << i) ? "│  " : "   ", stdout);
 
        fputs(n->
next == NULL ? 
"└─ " : 
"├─ ", stdout);
 
        fputs((
const char *)n->
name, stdout);
 
 
            printf(" ⭢ %.*s",
            printf(" ⭢ %.*s",
        }
 
        fputc('\n', stdout);
        write_tree_dfs(n);
    }
}
 
int main(int argc, char **argv)
{
    int ret, status = EXIT_FAILURE;
 
    
    if (argc != 2) {
        fputs("Usage: list_files <squashfs-file>\n", stderr);
        return EXIT_FAILURE;
    }
 
    if (file == NULL) {
        perror(argv[1]);
        return EXIT_FAILURE;
    }
 
    
    if (sqfs_super_read(&super, file)) {
        fprintf(stderr, "%s: error reading super block.\n", argv[1]);
        goto out_fd;
    }
 
 
    if (ret != 0) {
        fprintf(stderr, "%s: error creating compressor: %d.\n",
            argv[1], ret);
        goto out_fd;
    }
 
    
    idtbl = sqfs_id_table_create(0);
    if (idtbl == NULL) {
        fputs("Error creating ID table.\n", stderr);
        goto out_cmp;
    }
 
    if (sqfs_id_table_read(idtbl, file, &super, cmp)) {
        fprintf(stderr, "%s: error loading ID table.\n", argv[1]);
        goto out_id;
    }
 
    
    dr = sqfs_dir_reader_create(&super, cmp, file, 0);
    if (dr == NULL) {
        fprintf(stderr, "%s: error creating directory reader.\n",
            argv[1]);
        goto out_id;
    }
 
    if (sqfs_dir_reader_get_full_hierarchy(dr, idtbl, NULL, 0, &root)) {
        fprintf(stderr, "%s: error loading directory tree.\n",
            argv[1]);
        goto out;
    }
 
    
    printf("/\n");
    write_tree_dfs(root);
 
    
    status = EXIT_SUCCESS;
out:
    if (root != NULL)
    sqfs_destroy(dr);
out_id:
    sqfs_destroy(idtbl);
out_cmp:
    sqfs_destroy(cmp);
out_fd:
    sqfs_destroy(file);
    return status;
}
Contains declarations to everything related to data compression.
 
@ SQFS_COMP_FLAG_UNCOMPRESS
Set this if the compressor should actually extract instead of compress data.
 
SQFS_API int sqfs_compressor_config_init(sqfs_compressor_config_t *cfg, SQFS_COMPRESSOR id, size_t block_size, sqfs_u16 flags)
Initialize a compressor configuration.
 
SQFS_API int sqfs_compressor_create(const sqfs_compressor_config_t *cfg, sqfs_compressor_t **out)
Create an instance of a compressor implementation.
 
Contains declarations for the sqfs_dir_reader_t.
 
SQFS_API void sqfs_dir_tree_destroy(sqfs_tree_node_t *root)
Recursively destroy a tree of sqfs_tree_node_t nodes.
 
Contains declarations for the sqfs_id_table_t data structure.
 
Contains on-disk data structures used for inodes.
 
Contains the sqfs_file_t interface for abstracting file I/O.
 
@ SQFS_FILE_OPEN_READ_ONLY
If set, access the file for reading only.
 
SQFS_API sqfs_file_t * sqfs_open_file(const char *filename, sqfs_u32 flags)
Open a file through the operating systems filesystem API.
 
Configuration parameters for instantiating a compressor backend.
 
Encapsultes a compressor with a simple interface to compress or extract chunks of data.
 
Abstracts reading of directory entries.
 
Abstracts file I/O to make it easy to embedd SquashFS.
 
A simple data structure that encapsulates ID to index mapping for user and group IDs.
 
union sqfs_inode_generic_t::@4 data
Type specific inode data.
 
sqfs_inode_t base
The common fields for all inodes.
 
sqfs_u32 extra[]
Holds type specific extra data, such as symlink target.
 
sqfs_u32 target_size
Size of the symlink target in bytes.
 
sqfs_u32 target_size
Size of the symlink target in bytes.
 
sqfs_u16 type
An SQFS_INODE_TYPE value.
 
The SquashFS super block, located at the beginning of the file system to describe the layout of the f...
 
sqfs_u16 compression_id
Identifies the compressor that has been used.
 
sqfs_u32 block_size
The data block size in bytes.
 
Encapsulates a node in the filesystem tree read by sqfs_dir_reader_get_full_hierarchy.
 
sqfs_tree_node_t * parent
Pointer to parent, NULL for the root node.
 
sqfs_tree_node_t * children
For directories, a linked list of children.
 
sqfs_inode_generic_t * inode
Inode representing this element in the tree.
 
sqfs_u8 name[]
null-terminated entry name.
 
sqfs_tree_node_t * next
Linked list next pointer for children list.
 
Contains on-disk data structures, identifiers and functions for the SquashFS super block.