COHERENT manpages

This page displays the COHERENT manpage for pnmatch() [Match string pattern].

List of available manpages
Index


pnmatch() -- String Function (libc)

Match string pattern
int pnmatch(string, pattern, flag)
char *string, *pattern; int flag;

pnmatch() matches string with  pattern, which is a regular expression.  The
shell  sh  uses  patterns  for  file  name  expansion  and  case  statement
expressions.

pnmatch() returns one  if pattern matches string, and zero  if it does not.
Each  character  in  pattern must  exactly  match  a  character in  string;
however, the wildcards `*', `?', `['  and `]', and `[!' and `]' can be used
in pattern to expand the range of matching.

flag must be either zero or  one: zero means that pattern must match string
exactly, whereas  one means that pattern  can match any part  of string. In
the latter case, the wildcards `' and `$' can also be used in pattern.

Example

For an example of this function, see the entry for fgets().

See Also

egrep,
grep,
libc,
sh,
string.h,
wildcards

Notes

flag must be zero or one for pnmatch() to yield predictable results.

pnmatch() is  a more  powerful version of  the ANSI functions  strstr() and
strcmp().

For an  egrep-style version of pnmatch(), see the  function regexp(). It is
described in the Lexicon article libmisc.