xref: /titanic_51/usr/src/man/man3gen/gmatch.3gen (revision c10c16dec587a0662068f6e2991c29ed3a9db943)
te
Copyright 1989 AT&T Copyright (c) 1997, Sun Microsystems, Inc. All Rights Reserved
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
gmatch 3GEN "29 Dec 1996" "SunOS 5.11" "String Pattern-Matching Library Functions"
NAME
gmatch - shell global pattern matching
SYNOPSIS

cc [ flag ... ] file ... -lgen [ library ... ]
#include <libgen.h>

int gmatch(const char *str, const char *pattern);
DESCRIPTION

gmatch() checks whether the null-terminated string str matches the null-terminated pattern string pattern. See the sh(1), section File Name Generation, for a discussion of pattern matching. A backslash (\e) is used as an escape character in pattern strings.

RETURN VALUES

gmatch() returns non-zero if the pattern matches the string, zero if the pattern does not.

EXAMPLES

Example 1 Examples of gmatch() function.

In the following example, gmatch() returns non-zero (true) for all strings with "a" or "-" as their last character.

char *s;
gmatch (s, "*[a\e-]" )
ATTRIBUTES

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPEATTRIBUTE VALUE
MT-LevelMT-Safe
SEE ALSO

sh(1), attributes(5)

NOTES

When compiling multithreaded applications, the _REENTRANT flag must be defined on the compile line. This flag should only be used in multithreaded applications.