Subject: Re: pmatch(9)
To: None <tech-kern@NetBSD.org>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: tech-kern
Date: 10/12/2003 23:23:19
--cWoXeonUoKmBZSoM
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
On Sun, Oct 12, 2003 at 05:43:39PM +0200, Manuel Bouyer wrote:
> Hi,
> here is a man page for pmatch(9). I'd like to have someone check the
> description, maybe I misread pmatch.c.
> Also, any improvements to wording or mdoc code is welcome :)
Here is a second version, including fixes I got from various peoples.
Thanks to all who looked at this !
--
Manuel Bouyer <bouyer@antioche.eu.org>
NetBSD: 24 ans d'experience feront toujours la difference
--
--cWoXeonUoKmBZSoM
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="pmatch.9"
.\" $NetBSD: $
.\"
.\" Copyright (c) 2003 Manuel Bouyer.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by Manuel Bouyer.
.\" 4. The name of the author may not be used to endorse or promote products
.\" derived from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\"
.Dd October 12, 2003
.Dt PMATCH 9
.Os
.Sh NAME
.Nm pmatch
.Nd performs pattern matching on strings
.Sh SYNOPSIS
.In sys/systm.h
.Ft int
.Fn pmatch "const char *string" "const char *pattern" "const char **estr"
.Sh DESCRIPTION
Extract substring matching
.Fa pattern
from
.Fa string .
If not NULL,
.Fa estr
points to the end of the longest exact or substring match.
.Pp
.Fn pmatch
uses the following metacharacters:
.Bl -tag -width Ds
.It Li ?
match any single character.
.It Li *
match any character 0 or more times.
.It Li [
define a range of characters that will match. The range is defined by 2
characters separated by a
.Li - .
The range definition has to end with a
.Li ] .
A
.Li ^
following the
.Li [
will negate the range.
.El
.Sh RETURN VALUES
.Fn pmatch
will return 2 for an exact match, 1 for a substring match, 0 for no match and
\-1 if an error occurs.
--cWoXeonUoKmBZSoM--