top | item 46921491

Zlob.h 100% POSIX and glibc compatible globbing lib that is faste and better

36 points| neogoose | 23 days ago |github.com

20 comments

order

neogoose|23 days 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|22 days ago

Thanks 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?

xiphias2|22 days ago

,, Why? Because glob() implemented by glibc sucks. It is very outdated and slow.''

Isn't this a great opportuninty to improve glibc itself instead? Have you tried contributing back and make all programs that use glibc work faster now that you have a lot of knowledge about the problem space?

Anyways congrats to your project!

kvuj|22 days ago

There is probably greater joy in quickly making a tool to solve a problem you face than spending months if not years trying to convince glibc maintainers that your redesign will help a majority of users all the while conforming to their demands.

neogoose|21 days ago

I agree though the main problem for me is not the API it's missing functionality of patterns like ./*/*.c. There is a very long running thread in the gnu mailing list where authors do not like this idea.

While I need this because everyone expects it to be available. Another reason is the API for thing like someone else asked here already (match in memory over a list of paths)

oguz-ismail2|22 days ago

Since when `{...}' syntax is a glob pattern? What does `{a,b}/c' produce when there is no directory named `a'?

Spivak|22 days ago

Globbing is a matching library. It just means match a/c or b/c if they exist. You should get an iterator of somewhere between zero and two elements.

hidroto|22 days ago

would it not just produce 'b/c'? assuming 'b/c' is an existent file path

what else could you justify it doing?

commandersaki|22 days ago

Nice licence, I would've probably used this a few years ago on a project had I known it existed.

kreetx|22 days ago

Was this vibe coded? Readme has typos and somehow reads "fast and loose".

kryptiskt|22 days ago

I thought typos was a signifier for human-created these days, because an LLM is unlikely to land on something that is not a word.