1FNMATCH(3am)               GNU Awk Extension Modules              FNMATCH(3am)
2
3
4

NAME

6       fnmatch - compare a string against a filename wildcard
7

SYNOPSIS

9       @load "fnmatch"
10
11       result = fnmatch(pattern, string, flags)
12

DESCRIPTION

14       The  fnmatch extension provides an AWK interface to the fnmatch(3) rou‐
15       tine.  It adds a single function named fnmatch(), one predefined  vari‐
16       able (FNM_NOMATCH), and an array of flag values named FNM.
17
18       The first argument is the filename wildcard to match, the second is the
19       filename string, and the third is either zero, or the bitwise OR of one
20       or more of the flags in the FNM array.
21
22       The  return value is zero on success, FNM_NOMATCH if the string did not
23       match the pattern, or a different non-zero value if an error occurred.
24
25       The flags are follows:
26
27       FNM["CASEFOLD"]
28              Corresponds to the FNM_CASEFOLD flag as defined in fnmatch(3).
29
30       FNM["FILE_NAME"]
31              Corresponds to the FNM_FILE_NAME flag as defined in fnmatch(3).
32
33       FNM["LEADING_DIR"]
34              Corresponds  to  the  FNM_LEADING_DIR   flag   as   defined   in
35              fnmatch(3).
36
37       FNM["NOESCAPE"]
38              Corresponds to the FNM_NOESCAPE flag as defined in fnmatch(3).
39
40       FNM["PATHNAME"]
41              Corresponds to the FNM_PATHNAME flag as defined in fnmatch(3).
42
43       FNM["PERIOD"]
44              Corresponds to the FNM_PERIOD flag as defined in fnmatch(3).
45

NOTES

47       Nothing  prevents  AWK  code  from  changing  the  predefined  variable
48       FNM_NOMATCH, but doing so may cause strange results.
49

EXAMPLE

51       @load "fnmatch"
52       ...
53       flags = or(FNM["PERIOD"], FNM["NOESCAPE"])
54       if (fnmatch("*.a", "foo.c", flags) == FNM_NOMATCH)
55            print "no match"
56

SEE ALSO

58       GAWK:   Effective   AWK   Programming,    filefuncs(3am),    fork(3am),
59       inplace(3am), ordchr(3am), readdir(3am), readfile(3am), revoutput(3am),
60       rwarray(3am), time(3am).
61
62       fnmatch(3).
63

AUTHOR

65       Arnold Robbins, arnold@skeeve.com.
66

COPYING PERMISSIONS

68       Copyright © 2012, 2013, 2018, Free Software Foundation, Inc.
69
70       Permission is granted to make and distribute verbatim  copies  of  this
71       manual  page  provided  the copyright notice and this permission notice
72       are preserved on all copies.
73
74       Permission is granted to copy and distribute modified versions of  this
75       manual  page  under  the conditions for verbatim copying, provided that
76       the entire resulting derived work is distributed under the terms  of  a
77       permission notice identical to this one.
78
79       Permission  is granted to copy and distribute translations of this man‐
80       ual page into another language, under the above conditions for modified
81       versions,  except that this permission notice may be stated in a trans‐
82       lation approved by the Foundation.
83
84
85
86Free Software Foundation          Feb 21 2018                     FNMATCH(3am)
Impressum