Date: Tue, 9 Feb 2010 17:08:06 -0800 From: Garrett Cooper <yanefbsd@gmail.com> To: Andrew Brampton <brampton+freebsd@gmail.com> Cc: freebsd-hackers@freebsd.org Subject: Re: sysctl with regex? Message-ID: <6267ADA5-1E7A-492C-8ED2-3A1EDA4CF92C@gmail.com> In-Reply-To: <d41814901002091658l1e48848bn66a331690fc63608@mail.gmail.com> References: <d41814901002091308s7e894b55p880bde165bbbe703@mail.gmail.com> <86tytqvwky.fsf@ds4.des.no> <d41814901002091528i4884987cmb7347dfe4d50bdc5@mail.gmail.com> <26049703-8844-4476-B277-776A4EFC0A53@gmail.com> <d41814901002091645w289aa894q4a06cbaed59eea05@mail.gmail.com> <7BE25339-9614-4E64-BA14-85291B5DE356@gmail.com> <d41814901002091658l1e48848bn66a331690fc63608@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Feb 9, 2010, at 4:58 PM, Andrew Brampton wrote: > On Wed, Feb 10, 2010 at 12:51 AM, Garrett Cooper <yanefbsd@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...). >>=20 >=20 > 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=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6267ADA5-1E7A-492C-8ED2-3A1EDA4CF92C>