1
2
Fork
You've already forked str
1
🧵 Painfully common string utilities for C https://rubiefawn.codeberg.page/str
  • C 93.8%
  • CSS 4.4%
  • Makefile 1.8%
Fawn c5dd31d7fc
All checks were successful
Build, test, & publish docs / build (push) Successful in 14s
Build, test, & publish docs / docs (push) Successful in 36s
Make Makefile OpenBSD compatible
- 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
2026年07月06日 00:58:04 -06:00
.forgejo/workflows Add test workflow on local forgejo runner 2026年06月13日 19:35:16 -06:00
.clangd Add clangd config, improve makefile & gitignore 2026年05月14日 22:34:48 -06:00
.gitignore Make Makefile OpenBSD compatible 2026年07月06日 00:58:04 -06:00
.mailmap Add todo.txt & mailmap 2026年07月01日 14:52:06 -06:00
cstr.c Make Makefile OpenBSD compatible 2026年07月06日 00:58:04 -06:00
cstr.h Make Makefile OpenBSD compatible 2026年07月06日 00:58:04 -06:00
Doxyfile Tweak documentation deployment Forgejo action 2026年05月27日 17:30:36 -06:00
doxygen-extra.css Tweak documentation deployment Forgejo action 2026年05月27日 17:30:36 -06:00
libstr.c Make Makefile OpenBSD compatible 2026年07月06日 00:58:04 -06:00
LICENSE Make Makefile OpenBSD compatible 2026年07月06日 00:58:04 -06:00
Makefile Make Makefile OpenBSD compatible 2026年07月06日 00:58:04 -06:00
predicate.c Make Makefile OpenBSD compatible 2026年07月06日 00:58:04 -06:00
predicate.h Make Makefile OpenBSD compatible 2026年07月06日 00:58:04 -06:00
README.md Add string comparison and predicate functions 2026年06月14日 18:07:43 -06:00
str.c Make Makefile OpenBSD compatible 2026年07月06日 00:58:04 -06:00
str.h Make Makefile OpenBSD compatible 2026年07月06日 00:58:04 -06:00
test.c Make Makefile OpenBSD compatible 2026年07月06日 00:58:04 -06:00
todo.txt Make Makefile OpenBSD compatible 2026年07月06日 00:58:04 -06:00

🧵 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(), and memccpy()
  • strzcpy(), a sane alternative to strncpy()

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