Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / man / man3 / File::Glob.3
CommitLineData
86530b38
AT
1.\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13
2.\"
3.\" Standard preamble:
4.\" ========================================================================
5.de Sh \" Subsection heading
6.br
7.if t .Sp
8.ne 5
9.PP
10\fB\\$1\fR
11.PP
12..
13.de Sp \" Vertical space (when we can't use .PP)
14.if t .sp .5v
15.if n .sp
16..
17.de Vb \" Begin verbatim text
18.ft CW
19.nf
20.ne \\$1
21..
22.de Ve \" End verbatim text
23.ft R
24.fi
25..
26.\" Set up some character translations and predefined strings. \*(-- will
27.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
28.\" double quote, and \*(R" will give a right double quote. | will give a
29.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
30.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
31.\" expand to `' in nroff, nothing in troff, for use with C<>.
32.tr \(*W-|\(bv\*(Tr
33.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
34.ie n \{\
35. ds -- \(*W-
36. ds PI pi
37. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
39. ds L" ""
40. ds R" ""
41. ds C` ""
42. ds C' ""
43'br\}
44.el\{\
45. ds -- \|\(em\|
46. ds PI \(*p
47. ds L" ``
48. ds R" ''
49'br\}
50.\"
51.\" If the F register is turned on, we'll generate index entries on stderr for
52.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
53.\" entries marked with X<> in POD. Of course, you'll have to process the
54.\" output yourself in some meaningful fashion.
55.if \nF \{\
56. de IX
57. tm Index:\\$1\t\\n%\t"\\$2"
58..
59. nr % 0
60. rr F
61.\}
62.\"
63.\" For nroff, turn off justification. Always turn off hyphenation; it makes
64.\" way too many mistakes in technical documents.
65.hy 0
66.if n .na
67.\"
68.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
69.\" Fear. Run. Save yourself. No user-serviceable parts.
70. \" fudge factors for nroff and troff
71.if n \{\
72. ds #H 0
73. ds #V .8m
74. ds #F .3m
75. ds #[ \f1
76. ds #] \fP
77.\}
78.if t \{\
79. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
80. ds #V .6m
81. ds #F 0
82. ds #[ \&
83. ds #] \&
84.\}
85. \" simple accents for nroff and troff
86.if n \{\
87. ds ' \&
88. ds ` \&
89. ds ^ \&
90. ds , \&
91. ds ~ ~
92. ds /
93.\}
94.if t \{\
95. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
96. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
97. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
98. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
99. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
100. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
101.\}
102. \" troff and (daisy-wheel) nroff accents
103.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
104.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
105.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
106.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
107.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
108.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
109.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
110.ds ae a\h'-(\w'a'u*4/10)'e
111.ds Ae A\h'-(\w'A'u*4/10)'E
112. \" corrections for vroff
113.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
114.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
115. \" for low resolution devices (crt and lpr)
116.if \n(.H>23 .if \n(.V>19 \
117\{\
118. ds : e
119. ds 8 ss
120. ds o a
121. ds d- d\h'-1'\(ga
122. ds D- D\h'-1'\(hy
123. ds th \o'bp'
124. ds Th \o'LP'
125. ds ae ae
126. ds Ae AE
127.\}
128.rm #[ #] #H #V #F C
129.\" ========================================================================
130.\"
131.IX Title "File::Glob 3"
132.TH File::Glob 3 "2002-06-01" "perl v5.8.0" "Perl Programmers Reference Guide"
133.SH "NAME"
134File::Glob \- Perl extension for BSD glob routine
135.SH "SYNOPSIS"
136.IX Header "SYNOPSIS"
137.Vb 6
138\& use File::Glob ':glob';
139\& @list = bsd_glob('*.[ch]');
140\& $homedir = bsd_glob('~gnat', GLOB_TILDE | GLOB_ERR);
141\& if (GLOB_ERROR) {
142\& # an error occurred reading $homedir
143\& }
144.Ve
145.PP
146.Vb 4
147\& ## override the core glob (CORE::glob() does this automatically
148\& ## by default anyway, since v5.6.0)
149\& use File::Glob ':globally';
150\& my @sources = <*.{c,h,y}>
151.Ve
152.PP
153.Vb 3
154\& ## override the core glob, forcing case sensitivity
155\& use File::Glob qw(:globally :case);
156\& my @sources = <*.{c,h,y}>
157.Ve
158.PP
159.Vb 3
160\& ## override the core glob forcing case insensitivity
161\& use File::Glob qw(:globally :nocase);
162\& my @sources = <*.{c,h,y}>
163.Ve
164.SH "DESCRIPTION"
165.IX Header "DESCRIPTION"
166\&\fIFile::Glob::bsd_glob()\fR implements the FreeBSD \fIglob\fR\|(3) routine, which is
167a superset of the \s-1POSIX\s0 \fIglob()\fR (described in \s-1IEEE\s0 Std 1003.2 \*(L"\s-1POSIX\s0.2\*(R").
168\&\fIbsd_glob()\fR takes a mandatory \f(CW\*(C`pattern\*(C'\fR argument, and an optional
169\&\f(CW\*(C`flags\*(C'\fR argument, and returns a list of filenames matching the
170pattern, with interpretation of the pattern modified by the \f(CW\*(C`flags\*(C'\fR
171variable.
172.PP
173Since v5.6.0, Perl's \fICORE::glob()\fR is implemented in terms of \fIbsd_glob()\fR.
174Note that they don't share the same prototype\*(--\fICORE::glob()\fR only accepts
175a single argument. Due to historical reasons, \fICORE::glob()\fR will also
176split its argument on whitespace, treating it as multiple patterns,
177whereas \fIbsd_glob()\fR considers them as one pattern.
178.PP
179The \s-1POSIX\s0 defined flags for \fIbsd_glob()\fR are:
180.ie n .IP """GLOB_ERR""" 4
181.el .IP "\f(CWGLOB_ERR\fR" 4
182.IX Item "GLOB_ERR"
183Force \fIbsd_glob()\fR to return an error when it encounters a directory it
184cannot open or read. Ordinarily \fIbsd_glob()\fR continues to find matches.
185.ie n .IP """GLOB_LIMIT""" 4
186.el .IP "\f(CWGLOB_LIMIT\fR" 4
187.IX Item "GLOB_LIMIT"
188Make \fIbsd_glob()\fR return an error (\s-1GLOB_NOSPACE\s0) when the pattern expands
189to a size bigger than the system constant \f(CW\*(C`ARG_MAX\*(C'\fR (usually found in
190limits.h). If your system does not define this constant, \fIbsd_glob()\fR uses
191\&\f(CW\*(C`sysconf(_SC_ARG_MAX)\*(C'\fR or \f(CW\*(C`_POSIX_ARG_MAX\*(C'\fR where available (in that
192order). You can inspect these values using the standard \f(CW\*(C`POSIX\*(C'\fR
193extension.
194.ie n .IP """GLOB_MARK""" 4
195.el .IP "\f(CWGLOB_MARK\fR" 4
196.IX Item "GLOB_MARK"
197Each pathname that is a directory that matches the pattern has a slash
198appended.
199.ie n .IP """GLOB_NOCASE""" 4
200.el .IP "\f(CWGLOB_NOCASE\fR" 4
201.IX Item "GLOB_NOCASE"
202By default, file names are assumed to be case sensitive; this flag
203makes \fIbsd_glob()\fR treat case differences as not significant.
204.ie n .IP """GLOB_NOCHECK""" 4
205.el .IP "\f(CWGLOB_NOCHECK\fR" 4
206.IX Item "GLOB_NOCHECK"
207If the pattern does not match any pathname, then \fIbsd_glob()\fR returns a list
208consisting of only the pattern. If \f(CW\*(C`GLOB_QUOTE\*(C'\fR is set, its effect
209is present in the pattern returned.
210.ie n .IP """GLOB_NOSORT""" 4
211.el .IP "\f(CWGLOB_NOSORT\fR" 4
212.IX Item "GLOB_NOSORT"
213By default, the pathnames are sorted in ascending \s-1ASCII\s0 order; this
214flag prevents that sorting (speeding up \fIbsd_glob()\fR).
215.PP
216The FreeBSD extensions to the \s-1POSIX\s0 standard are the following flags:
217.ie n .IP """GLOB_BRACE""" 4
218.el .IP "\f(CWGLOB_BRACE\fR" 4
219.IX Item "GLOB_BRACE"
220Pre-process the string to expand \f(CW\*(C`{pat,pat,...}\*(C'\fR strings like \fIcsh\fR\|(1).
221The pattern '{}' is left unexpanded for historical reasons (and \fIcsh\fR\|(1)
222does the same thing to ease typing of \fIfind\fR\|(1) patterns).
223.ie n .IP """GLOB_NOMAGIC""" 4
224.el .IP "\f(CWGLOB_NOMAGIC\fR" 4
225.IX Item "GLOB_NOMAGIC"
226Same as \f(CW\*(C`GLOB_NOCHECK\*(C'\fR but it only returns the pattern if it does not
227contain any of the special characters \*(L"*\*(R", \*(L"?\*(R" or \*(L"[\*(R". \f(CW\*(C`NOMAGIC\*(C'\fR is
228provided to simplify implementing the historic \fIcsh\fR\|(1) globbing
229behaviour and should probably not be used anywhere else.
230.ie n .IP """GLOB_QUOTE""" 4
231.el .IP "\f(CWGLOB_QUOTE\fR" 4
232.IX Item "GLOB_QUOTE"
233Use the backslash ('\e') character for quoting: every occurrence of a
234backslash followed by a character in the pattern is replaced by that
235character, avoiding any special interpretation of the character.
236(But see below for exceptions on \s-1DOSISH\s0 systems).
237.ie n .IP """GLOB_TILDE""" 4
238.el .IP "\f(CWGLOB_TILDE\fR" 4
239.IX Item "GLOB_TILDE"
240Expand patterns that start with '~' to user name home directories.
241.ie n .IP """GLOB_CSH""" 4
242.el .IP "\f(CWGLOB_CSH\fR" 4
243.IX Item "GLOB_CSH"
244For convenience, \f(CW\*(C`GLOB_CSH\*(C'\fR is a synonym for
245\&\f(CW\*(C`GLOB_BRACE | GLOB_NOMAGIC | GLOB_QUOTE | GLOB_TILDE | GLOB_ALPHASORT\*(C'\fR.
246.PP
247The \s-1POSIX\s0 provided \f(CW\*(C`GLOB_APPEND\*(C'\fR, \f(CW\*(C`GLOB_DOOFFS\*(C'\fR, and the FreeBSD
248extensions \f(CW\*(C`GLOB_ALTDIRFUNC\*(C'\fR, and \f(CW\*(C`GLOB_MAGCHAR\*(C'\fR flags have not been
249implemented in the Perl version because they involve more complex
250interaction with the underlying C structures.
251.PP
252The following flag has been added in the Perl implementation for
253csh compatibility:
254.ie n .IP """GLOB_ALPHASORT""" 4
255.el .IP "\f(CWGLOB_ALPHASORT\fR" 4
256.IX Item "GLOB_ALPHASORT"
257If \f(CW\*(C`GLOB_NOSORT\*(C'\fR is not in effect, sort filenames is alphabetical
258order (case does not matter) rather than in \s-1ASCII\s0 order.
259.SH "DIAGNOSTICS"
260.IX Header "DIAGNOSTICS"
261\&\fIbsd_glob()\fR returns a list of matching paths, possibly zero length. If an
262error occurred, &File::Glob::GLOB_ERROR will be non-zero and \f(CW$!\fR will be
263set. &File::Glob::GLOB_ERROR is guaranteed to be zero if no error occurred,
264or one of the following values otherwise:
265.ie n .IP """GLOB_NOSPACE""" 4
266.el .IP "\f(CWGLOB_NOSPACE\fR" 4
267.IX Item "GLOB_NOSPACE"
268An attempt to allocate memory failed.
269.ie n .IP """GLOB_ABEND""" 4
270.el .IP "\f(CWGLOB_ABEND\fR" 4
271.IX Item "GLOB_ABEND"
272The glob was stopped because an error was encountered.
273.PP
274In the case where \fIbsd_glob()\fR has found some matching paths, but is
275interrupted by an error, it will return a list of filenames \fBand\fR
276set &File::Glob::ERROR.
277.PP
278Note that \fIbsd_glob()\fR deviates from \s-1POSIX\s0 and FreeBSD \fIglob\fR\|(3) behaviour
279by not considering \f(CW\*(C`ENOENT\*(C'\fR and \f(CW\*(C`ENOTDIR\*(C'\fR as errors \- \fIbsd_glob()\fR will
280continue processing despite those errors, unless the \f(CW\*(C`GLOB_ERR\*(C'\fR flag is
281set.
282.PP
283Be aware that all filenames returned from File::Glob are tainted.
284.SH "NOTES"
285.IX Header "NOTES"
286.IP "\(bu" 4
287If you want to use multiple patterns, e.g. \f(CW\*(C`bsd_glob "a* b*"\*(C'\fR, you should
288probably throw them in a set as in \f(CW\*(C`bsd_glob "{a*,b*}"\*(C'\fR. This is because
289the argument to \fIbsd_glob()\fR isn't subjected to parsing by the C shell.
290Remember that you can use a backslash to escape things.
291.IP "\(bu" 4
292On \s-1DOSISH\s0 systems, backslash is a valid directory separator character.
293In this case, use of backslash as a quoting character (via \s-1GLOB_QUOTE\s0)
294interferes with the use of backslash as a directory separator. The
295best (simplest, most portable) solution is to use forward slashes for
296directory separators, and backslashes for quoting. However, this does
297not match \*(L"normal practice\*(R" on these systems. As a concession to user
298expectation, therefore, backslashes (under \s-1GLOB_QUOTE\s0) only quote the
299glob metacharacters '[', ']', '{', '}', '\-', '~', and backslash itself.
300All other backslashes are passed through unchanged.
301.IP "\(bu" 4
302Win32 users should use the real slash. If you really want to use
303backslashes, consider using Sarathy's File::DosGlob, which comes with
304the standard Perl distribution.
305.IP "\(bu" 4
306Mac \s-1OS\s0 (Classic) users should note a few differences. Since
307Mac \s-1OS\s0 is not Unix, when the glob code encounters a tilde glob (e.g.
308~user) and the \f(CW\*(C`GLOB_TILDE\*(C'\fR flag is used, it simply returns that
309pattern without doing any expansion.
310.Sp
311Glob on Mac \s-1OS\s0 is case-insensitive by default (if you don't use any
312flags). If you specify any flags at all and still want glob
313to be case\-insensitive, you must include \f(CW\*(C`GLOB_NOCASE\*(C'\fR in the flags.
314.Sp
315The path separator is ':' (aka colon), not '/' (aka slash). Mac \s-1OS\s0 users
316should be careful about specifying relative pathnames. While a full path
317always begins with a volume name, a relative pathname should always
318begin with a ':'. If specifying a volume name only, a trailing ':' is
319required.
320.Sp
321The specification of pathnames in glob patterns adheres to the usual Mac
322\&\s-1OS\s0 conventions: The path separator is a colon ':', not a slash '/'. A
323full path always begins with a volume name. A relative pathname on Mac
324\&\s-1OS\s0 must always begin with a ':', except when specifying a file or
325directory name in the current working directory, where the leading colon
326is optional. If specifying a volume name only, a trailing ':' is
327required. Due to these rules, a glob like <*:> will find all
328mounted volumes, while a glob like <*> or <:*> will find
329all files and directories in the current directory.
330.Sp
331Note that updirs in the glob pattern are resolved before the matching begins,
332i.e. a pattern like \*(L"*HD:t?p::a*\*(R" will be matched as \*(L"*HD:a*\*(R". Note also,
333that a single trailing ':' in the pattern is ignored (unless it's a volume
334name pattern like \*(L"*HD:\*(R"), i.e. a glob like <:*:> will find both
335directories \fIand\fR files (and not, as one might expect, only directories).
336You can, however, use the \f(CW\*(C`GLOB_MARK\*(C'\fR flag to distinguish (without a file
337test) directory names from file names.
338.Sp
339If the \f(CW\*(C`GLOB_MARK\*(C'\fR flag is set, all directory paths will have a ':' appended.
340Since a directory like 'lib:' is \fInot\fR a valid \fIrelative\fR path on Mac \s-1OS\s0,
341both a leading and a trailing colon will be added, when the directory name in
342question doesn't contain any colons (e.g. 'lib' becomes ':lib:').
343.SH "AUTHOR"
344.IX Header "AUTHOR"
345The Perl interface was written by Nathan Torkington <gnat@frii.com>,
346and is released under the artistic license. Further modifications were
347made by Greg Bacon <gbacon@cs.uah.edu>, Gurusamy Sarathy
348<gsar@activestate.com>, and Thomas Wegner
349<wegner_thomas@yahoo.com>. The C glob code has the
350following copyright:
351.PP
352.Vb 2
353\& Copyright (c) 1989, 1993 The Regents of the University of California.
354\& All rights reserved.
355.Ve
356.PP
357.Vb 2
358\& This code is derived from software contributed to Berkeley by
359\& Guido van Rossum.
360.Ve
361.PP
362.Vb 3
363\& Redistribution and use in source and binary forms, with or without
364\& modification, are permitted provided that the following conditions
365\& are met:
366.Ve
367.PP
368.Vb 8
369\& 1. Redistributions of source code must retain the above copyright
370\& notice, this list of conditions and the following disclaimer.
371\& 2. Redistributions in binary form must reproduce the above copyright
372\& notice, this list of conditions and the following disclaimer in the
373\& documentation and/or other materials provided with the distribution.
374\& 3. Neither the name of the University nor the names of its contributors
375\& may be used to endorse or promote products derived from this software
376\& without specific prior written permission.
377.Ve
378.PP
379.Vb 11
380\& THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
381\& ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
382\& IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
383\& ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
384\& FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
385\& DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
386\& OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
387\& HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
388\& LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
389\& OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
390\& SUCH DAMAGE.
391.Ve