2 ms·
100% POSIX and glibc compatible globbing library for C, Zig, and Rust that is faster and supports all the modern globbing formats (more than libc and rust glob
by neogoose 8mo ago
100% POSIX and glibc compatible globbing library for C, Zig, and Rust that is faster and supports all the modern globbing formats (more than libc and rust glob crate)
It supports all the formats like * and {a,b} expansion as long as have a very efficient syscall and SIMD optimization for faster processing
- gary_0 8mo agoThanks for sharing. Just curious, is there any way to perform globbing over a list of path-like strings instead of only directly on the filesystem?
- jzwinck 8mo agoIn case someone doesn't know, the standard function for that is called fnmatch: https://man7.org/linux/man-pages/man3/fnmatch.3.html https://man7.org/linux/man-pages/man3/fnmatch.3.html
- neogoose 8mo agoThat's one of the reasons I built zlob. It literally has an endpoint to do this but if you are talking about glibc there are 2 options 1. fnmatch function which is not ideal because it doesn't take into account all the path specific optimizations and does not support BRACE 2. ALTDIRFUNC flag for globbing let you simulate file system which absolutely sucks in zlob you can simply call zlob_match_paths(<pattern>, <list>, flags, ptr) where list would be either c string or rust/zig like slices