sysctl with regex?

Garrett Cooper yanefbsd at gmail.com
Wed Feb 10 01:08:10 UTC 2010


On Feb 9, 2010, at 4:58 PM, Andrew Brampton wrote:

> 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 ;)

Ok.. is it the preferred bicycle wheel to equip our motorcycle with then :]? If so I'll whip up the change in a few hours after $JOB is done.
Thanks!
-Garrett


More information about the freebsd-hackers mailing list