Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\glob.c Create Date:2022-07-28 07:18:00
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:glob_match - Shell-style pattern matching, like !fnmatch(pat, str, 0)*@pat: Shell-style pattern to match, e.g. "*.[ch]".*@str: String to match. The pattern must match the entire string.* Perform shell-style glob matching, returning true (1) if the match

Proto:bool __pure glob_match(char const *pat, char const *str)

Type:bool

Parameter:

TypeParameterName
char const *pat
char const *str
48  back_pat = NULL , back_str = back_str
55  cycle
56  c = str++
57  d = pat++
60  Case d == '?'
61  If c == '\0' Then Return false
63  Break
64  Case d == '*'
65  If pat == '\0' Then Return true
67  back_pat = pat
68  back_str = --str
69  Break
70  Case d == '['
71  match = false , inverted = pat == '!'
72  class = pat + inverted
73  a = class++
80  Do
81  b = a
83  If a == '\0' Then Go to literal
86  If class[0] == '-' && class[1] != ']' Then
87  b = class[1]
89  If b == '\0' Then Go to literal
92  class += 2
95  match |= a <= c && c <= b
96  When (a = class++) != ']' cycle
98  If match == inverted Then Go to backtrack
100  pat = class
102  Break
103  Case d == '\\'
104  d = pat++
106  Default
107  literal :
108  If c == d Then
109  If d == '\0' Then Return true
111  Break
113  backtrack :
114  If c == '\0' || Not back_pat Then Return false
117  pat = back_pat
118  str = ++back_str
119  Break
Caller
NameDescribe
test