sysctl with regex?
brampton+freebsd at gmail.com
Wed Feb 10 00:58:50 UTC 2010
On Wed, Feb 10, 2010 at 12:51 AM, Garrett Cooper <yanefbsd at 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 ;)
More information about the freebsd-hackers