1GLOB_MATCH(9) libata Core Internals GLOB_MATCH(9)
2
3
4
6 glob_match - match a text string against a glob-style pattern
7
9 int glob_match(const char * text, const char * pattern);
10
12 text
13 the string to be examined
14
15 pattern
16 the glob-style pattern to be matched against
17
19 Either/both of text and pattern can be empty strings.
20
21 Match text against a glob-style pattern, with wildcards and simple
22 sets:
23
24 ? matches any single character. * matches any run of characters. [xyz]
25 matches a single character from the set: x, y, or z. [a-d] matches a
26 single character from the range: a, b, c, or d. [a-d0-9] matches a
27 single character from either range.
28
29 The special characters ?, [, -, or *, can be matched using a set, eg.
30 [*] Behaviour with malformed patterns is undefined, though generally
31 reasonable.
32
34 "SD1?“, ”SD1[0-5]“, ”*R0“, ”SD*1?[012]*xx"
35
36 This function uses one level of recursion per '*' in pattern. Since it
37 calls _nothing_ else, and has _no_ explicit local variables, this will
38 not cause stack problems for any reasonable use here.
39
41 0 on match, 1 otherwise.
42
44 Jeff Garzik
45 Author.
46
48Kernel Hackers Manual 3.10 June 2019 GLOB_MATCH(9)