On Wed, Feb 10, 2010 at 12:51 AM, Garrett Cooper <yanef...@gmail.com> wrote:
>        fnmatch is for matching filenames... I think there's a better way to 
> do it with globs, but I'll have to take a quick peek at python's glob module 
> so I don't reinvent the wheel (using fnmatch(3) // glob(3) to string match 
> seems kind of stupid to do...).
>

I think fnmatch() is used to match filenames but reading its
documentation I don't see why it has to be used only for filenames. It
takes a pattern and a string and returns true if they match. Having a
quick look in the FreeBSD source it is used in a few non-filesystem
places, for example, contrib/binutils/ld/ldlang.c to match section
names, sys/netinet/ipfw/ip_fw2.c to match interface names. I'm sure
there are other examples. However, if you can find a better suited
function then sure, I just don't like reinventing the wheel, even if
this wheel is the wrong colour ;)

Andrew
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

Reply via email to