Subject: pmatch(9)
To: None <tech-kern@netbsd.org>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: tech-kern
Date: 10/12/2003 17:43:39
--UugvWAfsgieZRqgk
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

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

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 24 ans d'experience feront toujours la difference
--

--UugvWAfsgieZRqgk
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 REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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 Oct 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 delay "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
.Nm
uses the following metacharacters:
.Bl -tag -width Ds
.It Li ?
match any character exactly one time.
.It Li *
match any character 0 or more time.
.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
.Nm
will return 2 on exact match, 1 on substring match, 0 on no match and -1 on
error.

--UugvWAfsgieZRqgk--