How matthewplemmons/hls works
This repository is a small C implementation of ls. Its main workflow parses options and directory arguments, enumerates entries according to hidden-file rules, then prints names or long metadata. The README documents -l, -1, -a, and -A; long output formats permissions, ownership, size, and timestamps. Shared allocation, string, and error helpers support those stages. Sorting is declared but commented out in the sampled runtime. Relationships below are limited to calls visible in the excerpts; the filesystem is an external dependency.
Main entry points: hls.c Program entry and directory traversal · hls-arg-parse.c Option and path parsing · hls-print.c Name and long output · hls-calloc.c Zeroed allocation and cleanup
Components 11
CLI and traversal
- Program entry and directory traversal
hls.c - Option and path parsing
hls-arg-parse.c
Directory listing
- Visible entry counting
hls.c - Filename collection
collect-filenames.c
Formatting and output
- Name and long output
hls-print.c - Timestamp formatting
hls-dateformat.c
Runtime support
- Directory error reporting
hls-error.c - Zeroed allocation and cleanup
hls-calloc.c - String operations
hls-strings.c
Other components
- CLI user
- Filesystem
Connections 22
- CLI user → Program entry and directory traversal: runs
README.md - Program entry and directory traversal → Option and path parsing: parses options
hls.c - Program entry and directory traversal → Option and path parsing: extracts paths
hls.c - Option and path parsing → Filesystem: validates directories
hls-arg-parse.c - Option and path parsing → Directory error reporting: reports failures
hls-arg-parse.c - Program entry and directory traversal → Visible entry counting: counts entries
hls.c - Visible entry counting → Filesystem: reads directory
hls.c - Program entry and directory traversal → Filename collection: collects names
hls.c - Filename collection → Filesystem: reads directory
collect-filenames.c - Program entry and directory traversal → Name and long output: prints listing
hls.c - Name and long output → Filesystem: reads metadata
hls-print.c - Name and long output → Timestamp formatting: formats timestamp
hls-print.c - Option and path parsing → Zeroed allocation and cleanup: allocates paths
hls-arg-parse.c - Option and path parsing → String operations: builds paths
hls-arg-parse.c - Filename collection → Zeroed allocation and cleanup: allocates names
collect-filenames.c - Filename collection → String operations: copies names
collect-filenames.c - Name and long output → Zeroed allocation and cleanup: allocates full path
hls-print.c - Name and long output → String operations: builds full path
hls-print.c - Timestamp formatting → Zeroed allocation and cleanup: allocates result
hls-dateformat.c - Timestamp formatting → String operations: rewrites timestamp
hls-dateformat.c - Directory error reporting → Zeroed allocation and cleanup: allocates message
hls-error.c - Directory error reporting → String operations: builds message
hls-error.c