🧵 Painfully common string utilities for C
https://rubiefawn.codeberg.page/str
- C 93.8%
- CSS 4.4%
- Makefile 1.8%
|
Fawn
c5dd31d7fc
- Use POSIX suffix inference rules rather than GNU pattern rules - Add `make dist` to make a tarball of headers and the static library - Add `make install` & `make uninstall`, though vendoring is preferred - Add support for GNU's ##__VA_ARGS__ extension for cases when C23's __VA_OPT__() is not available, and a warning when neither are available - Update email addresses in file headers |
||
|---|---|---|
| .forgejo/workflows | Add test workflow on local forgejo runner | |
| .clangd | Add clangd config, improve makefile & gitignore | |
| .gitignore | Make Makefile OpenBSD compatible | |
| .mailmap | Add todo.txt & mailmap | |
| cstr.c | Make Makefile OpenBSD compatible | |
| cstr.h | Make Makefile OpenBSD compatible | |
| Doxyfile | Tweak documentation deployment Forgejo action | |
| doxygen-extra.css | Tweak documentation deployment Forgejo action | |
| libstr.c | Make Makefile OpenBSD compatible | |
| LICENSE | Make Makefile OpenBSD compatible | |
| Makefile | Make Makefile OpenBSD compatible | |
| predicate.c | Make Makefile OpenBSD compatible | |
| predicate.h | Make Makefile OpenBSD compatible | |
| README.md | Add string comparison and predicate functions | |
| str.c | Make Makefile OpenBSD compatible | |
| str.h | Make Makefile OpenBSD compatible | |
| test.c | Make Makefile OpenBSD compatible | |
| todo.txt | Make Makefile OpenBSD compatible | |
🧵 str
Common string utilities for C I'm sick of rewriting:
- Utilities for string "slices" (also known as "views" or "spans"), which are a pointer + length. Useful for substring references.
- Polyfill implementations for
strdup(),strndup(), andmemccpy() strzcpy(), a sane alternative tostrncpy()
Building
The recommended way to use str is to compile the source files directly into your project. If your project uses git, you can add str as a git submodule.
If you prefer to link against a static library instead, make release will produce one.
# Compile static library with optimizations
make release
# Compile static library with debug information
make debug
# Generate Doxygen documentation (html & man pages)
make docs
# Run tests
make test