$ cd ~/products/mew
standalone · 2/3
Mew
A cat clone, built the right way
POSIX cat rebuilt in strict C11 with zero dependencies — sanitizers in debug, careful error handling, and no surprises.
- +Strict C11 — Compiled under strict flags
- +Zero dependencies — Nothing beyond POSIX
- +ASAN + UBSAN — Sanitized in debug builds
view source ↗free
What it is
cat, rebuilt from scratch in C11. No printf, no stdio buffering: the core is four syscalls and a write loop that handles partial writes, so every byte reaches the output or the error is reported.
Beyond cat
-r / --line-range prints part of a file and answers the sed -n '10,40p' question natively:
mew -r 2:4 notes.md # lines 2 to 4
mew -n -r 30:32 main.c # numbered 30, 31, 32
mew -r :2 -r 10: CHANGELOG.md # head and tail in one passLine numbers keep each line's position in the file, overlapping ranges merge, and reading stops after the last wanted line, so mew -r 1:5 on a multi-gigabyte log reads five lines.
Correctness
- The GNU
catflag set with long options, including-vnotation across the full byte range - Errors on stderr as
mew: <file>: <reason>, including write failures and directory arguments --color[=auto|always|never]for mew's own output, never the file contents, andNO_COLORalways wins- Debug builds run under AddressSanitizer and UndefinedBehaviorSanitizer
- The test suite compares output byte for byte against system
cat, and CI fails if a flag ships without documentation
Install
$ git clone https://github.com/NoamFav/Mew.git && cd Mew$ make release$ make install # binary + man page, PREFIX=/usr/localStatus
- [x]Full cat flag set with long options
- [x]Line ranges
- [x]Colour output with NO_COLOR support
- [x]Man page and CI on two OSes and two compilers