'\" t .\" Title: glob_match .\" Author: .\" Generator: DocBook XSL Stylesheets v1.78.1 .\" Date: May 2018 .\" Manual: libata Core Internals .\" Source: Kernel Hackers Manual 3.16.56 .\" Language: English .\" .TH "GLOB_MATCH" "9" "May 2018" "Kernel Hackers Manual 3\&.16\&" "libata Core Internals" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" glob_match \- match a text string against a glob\-style pattern .SH "SYNOPSIS" .HP \w'int\ glob_match('u .BI "int glob_match(const\ char\ *\ " "text" ", const\ char\ *\ " "pattern" ");" .SH "ARGUMENTS" .PP \fItext\fR .RS 4 the string to be examined .RE .PP \fIpattern\fR .RS 4 the glob\-style pattern to be matched against .RE .SH "DESCRIPTION" .PP Either/both of text and pattern can be empty strings\&. .PP Match text against a glob\-style pattern, with wildcards and simple sets: .PP ? matches any single character\&. * matches any run of characters\&. [xyz] matches a single character from the set: x, y, or z\&. [a\-d] matches a single character from the range: a, b, c, or d\&. [a\-d0\-9] matches a single character from either range\&. .PP The special characters ?, [, \-, or *, can be matched using a set, eg\&. [*] Behaviour with malformed patterns is undefined, though generally reasonable\&. .SH "SAMPLE PATTERNS" .PP "SD1?\(lq, \(rqSD1[0\-5]\(lq, \(rq*R0\(lq, \(rqSD*1?[012]*xx" .PP This function uses one level of recursion per \*(Aq*\*(Aq in pattern\&. Since it calls _nothing_ else, and has _no_ explicit local variables, this will not cause stack problems for any reasonable use here\&. .SH "RETURNS" .PP 0 on match, 1 otherwise\&. .SH "AUTHOR" .PP \fBJeff Garzik\fR .RS 4 Author. .RE .SH "COPYRIGHT" .br