From c2642b2c3f21fc5f358cf3bc6806b8094a2b9017 Mon Sep 17 00:00:00 2001 From: ocean Date: Mon, 19 Apr 2004 09:31:39 +0000 Subject: * dir.c: Updated RDocs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ dir.c | 56 +++++++++++++++++++++++++++++++------------------------- 2 files changed, 35 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7a5a8381f7..bee688567d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Mon Apr 19 18:27:26 Hirokazu Yamamoto + + * dir.c: Updated RDocs. + Mon Apr 19 08:19:11 2004 Doug Kearns * dln.c, io.c, pack.c, lib/benchmark.rb, lib/cgi.rb, lib/csv.rb, diff --git a/dir.c b/dir.c index 17c8ff61d6..59b17ef3d8 100644 --- a/dir.c +++ b/dir.c @@ -1503,7 +1503,8 @@ dir_s_aref(obj, str) * block. Note that this pattern is not a regexp (it's closer to a * shell glob). See File::fnmatch for * details of file name matching and the meaning of the flags - * parameter. + * parameter. Note that case sensitivity depends on your system. (so + * File::FNM_CASEFOLD is ignored) * * Dir["config.?"] #=> ["config.h"] * Dir.glob("config.?") #=> ["config.h"] @@ -1593,33 +1594,38 @@ dir_entries(io, dirname) * flags is a bitwise OR of the FNM_xxx parameters. * The same glob pattern and flags are used by Dir::glob. * - * File.fnmatch('cat', 'cat') #=> true - * File.fnmatch('cat', 'category') #=> false - * File.fnmatch('c{at,ub}s', 'cats') #=> false - * File.fnmatch('c{at,ub}s', 'cubs') #=> false - * File.fnmatch('c{at,ub}s', 'cat') #=> false + * File.fnmatch('cat', 'cat') #=> true : match entire string + * File.fnmatch('cat', 'category') #=> false : only match partial string + * File.fnmatch('c{at,ub}s', 'cats') #=> false : { } isn't supported + * + * File.fnmatch('c?t', 'cat') #=> true : '?' match only 1 character + * File.fnmatch('c??t', 'cat') #=> false : ditto + * File.fnmatch('c*', 'cats') #=> true : '*' match 0 or more characters + * File.fnmatch('ca[a-z]', 'cat') #=> true : inclusive bracket expression + * File.fnmatch('ca[^t]', 'cat') #=> false : exclusive bracket expression ('^' or '!') + * + * File.fnmatch('?', '/', File::FNM_PATHNAME) #=> false : wildcard doesn't match '/' on FNM_PATHNAME + * File.fnmatch('*', '/', File::FNM_PATHNAME) #=> false : ditto + * File.fnmatch('[/]', '/', File::FNM_PATHNAME) #=> false : ditto + * + * File.fnmatch('\?', '?') #=> true : escaped wildcard becomes ordinary + * File.fnmatch('\a', 'a') #=> true : escaped ordinary remains ordinary + * File.fnmatch('\a', '\a', File::FNM_NOESCAPE) #=> true : FNM_NOESACPE makes '\' ordinary + * File.fnmatch('[\?]', '?') #=> true : can escape inside bracket expression * - * File.fnmatch('c?t', 'cat') #=> true - * File.fnmatch('c\?t', 'cat') #=> false - * File.fnmatch('c??t', 'cat') #=> false - * File.fnmatch('c*', 'cats') #=> true - * File.fnmatch('c/ * FIXME * /t', 'c/a/b/c/t') #=> true - * File.fnmatch('c*t', 'cat') #=> true - * File.fnmatch('c\at', 'cat') #=> true - * File.fnmatch('c\at', 'cat', File::FNM_NOESCAPE) #=> false - * File.fnmatch('a?b', 'a/b') #=> true - * File.fnmatch('a?b', 'a/b', File::FNM_PATHNAME) #=> false + * File.fnmatch('*', '.profile') #=> false : wildcard doesn't match leading + * File.fnmatch('*', '.profile', File::FNM_DOTMATCH) #=> true period by default. + * File.fnmatch('.*' '.profile') #=> true * - * File.fnmatch('*', '.profile') #=> false - * File.fnmatch('*', '.profile', File::FNM_DOTMATCH) #=> true - * File.fnmatch('*', 'dave/.profile') #=> true - * File.fnmatch('*', 'dave/.profile', File::FNM_DOTMATCH) #=> true - * File.fnmatch('*', 'dave/.profile', File::FNM_PATHNAME) #=> false - * File.fnmatch('* / FIXME *', 'dave/.profile', File::FNM_PATHNAME) #=> false - * STRICT = File::FNM_PATHNAME | File::FNM_DOTMATCH - * File.fnmatch('* / FIXME *', 'dave/.profile', STRICT) #=> true + * File.fnmatch('*', 'dave/.profile') #=> true + * File.fnmatch('* IGNORE /*', 'dave/.profile', File::FNM_PATHNAME) #=> false + * File.fnmatch('* IGNORE /*', 'dave/.profile', File::FNM_PATHNAME | File::FNM_DOTMATCH) #=> true * - * File.fnmatch('** ERASEME /t', 'c/a/b/c/t', File::FNM_PATHNAME) #=> true + * File.fnmatch('** IGNORE /foo', 'a/b/c/foo', File::FNM_PATHNAME) #=> true + * File.fnmatch('** IGNORE /foo', '/a/b/c/foo', File::FNM_PATHNAME) #=> true + * File.fnmatch('** IGNORE /foo', 'c:/a/b/c/foo', File::FNM_PATHNAME) #=> true + * File.fnmatch('** IGNORE /foo', 'a/.b/c/foo', File::FNM_PATHNAME) #=> false + * File.fnmatch('** IGNORE /foo', 'a/.b/c/foo', File::FNM_PATHNAME | File::FNM_DOTMATCH) #=> true */ static VALUE file_s_fnmatch(argc, argv, obj) -- cgit v1.2.3