[Go to CFHT Home Page] Man Pages
Back to Software Index  BORDER=0Manpage Top Level
    gmatch(3G) manual page Table of Contents

Name

gmatch - shell global pattern matching

Synopsis

cc [ flag ... ] file ... -lgen [ library ... ]

#include <libgen.h>

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

MT-Level

MT-Safe

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 (\) 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.

Example

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

char *s;

gmatch (s, "*[a\-]" )

See Also

sh(1)

Notes

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


Table of Contents