summaryrefslogtreecommitdiff
path: root/man/2/filepat
diff options
context:
space:
mode:
authorCharles.Forsyth <devnull@localhost>2006-12-22 20:52:35 +0000
committerCharles.Forsyth <devnull@localhost>2006-12-22 20:52:35 +0000
commit46439007cf417cbd9ac8049bb4122c890097a0fa (patch)
tree6fdb25e5f3a2b6d5657eb23b35774b631d4d97e4 /man/2/filepat
parent37da2899f40661e3e9631e497da8dc59b971cbd0 (diff)
20060303-partial
Diffstat (limited to 'man/2/filepat')
-rw-r--r--man/2/filepat80
1 files changed, 80 insertions, 0 deletions
diff --git a/man/2/filepat b/man/2/filepat
new file mode 100644
index 00000000..0f8eff5b
--- /dev/null
+++ b/man/2/filepat
@@ -0,0 +1,80 @@
+.TH FILEPAT 2
+.SH NAME
+filepat: expand, match \- file pattern matching
+.SH SYNOPSIS
+.EX
+include "filepat.m";
+filepat := load Filepat Filepat->PATH;
+
+expand: fn(pat: string): list of string;
+match: fn(pat, name: string): int;
+.EE
+.SH DESCRIPTION
+.B Expand
+builds a list of file names in alphabetical order that match
+the pattern
+.IR pat .
+The pattern is tokenised using
+.B /
+as a delimiter.
+.PP
+.B Match
+returns 1 if
+.I name
+matches the pattern
+.IR pat ,
+and 0 otherwise.
+.PP
+The
+.I pat
+passed to
+.B match
+and
+.B expand
+may include combinations of the special characters
+.BR * ,
+.BR ? ,
+.BR [ ,
+and
+.BR ] .
+.PP
+The asterisk
+.B *
+matches a string of zero or more characters.
+.PP
+The query
+.B ?
+matches any single character.
+.PP
+The notation
+.BI [ s ]\f1,
+where
+.I s
+is a nonempty string, matches any
+single character in
+.IR s .
+The notation
+.BI [^ s ]\f1,
+where
+.IR s
+is a nonempty string, matches any
+single character not in
+.IR s .
+The characters
+.BR * ,
+.BR ? ,
+and
+.BR [
+have no special meaning within s.
+.PP
+If any character
+is preceded by the character
+.BR \e ,
+that character loses any special meaning
+and is interpreted literally.
+.SH SOURCE
+.B /appl/lib/filepat.b
+.SH SEE ALSO
+.IR sys-tokenize (2),
+.IR readdir (2)
+.IR regex (2)