Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / amd64 / man / man3 / File::Glob.3
CommitLineData
920dae64
AT
1.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
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 "2001-09-21" "perl v5.8.8" "Perl Programmers Reference Guide"
133.SH "NAME"
134File::Glob \- Perl extension for BSD glob routine
135.SH "SYNOPSIS"
136.IX Header "SYNOPSIS"
137.Vb 1
138\& use File::Glob ':glob';
139.Ve
140.PP
141.Vb 2
142\& @list = bsd_glob('*.[ch]');
143\& $homedir = bsd_glob('~gnat', GLOB_TILDE | GLOB_ERR);
144.Ve
145.PP
146.Vb 3
147\& if (GLOB_ERROR) {
148\& # an error occurred reading $homedir
149\& }
150.Ve
151.PP
152.Vb 4
153\& ## override the core glob (CORE::glob() does this automatically
154\& ## by default anyway, since v5.6.0)
155\& use File::Glob ':globally';
156\& my @sources = <*.{c,h,y}>;
157.Ve
158.PP
159.Vb 3
160\& ## override the core glob, forcing case sensitivity
161\& use File::Glob qw(:globally :case);
162\& my @sources = <*.{c,h,y}>;
163.Ve
164.PP
165.Vb 3
166\& ## override the core glob forcing case insensitivity
167\& use File::Glob qw(:globally :nocase);
168\& my @sources = <*.{c,h,y}>;
169.Ve
170.PP
171.Vb 3
172\& ## glob on all files in home directory
173\& use File::Glob ':globally';
174\& my @sources = <~gnat/*>;
175.Ve
176.SH "DESCRIPTION"
177.IX Header "DESCRIPTION"
178The glob angle-bracket operator \f(CW\*(C`<>\*(C'\fR is a pathname generator that
179implements the rules for file name pattern matching used by Unix-like shells
180such as the Bourne shell or C shell.
181.PP
182\&\fIFile::Glob::bsd_glob()\fR implements the FreeBSD \fIglob\fR\|(3) routine, which is
183a superset of the \s-1POSIX\s0 \fIglob()\fR (described in \s-1IEEE\s0 Std 1003.2 \*(L"\s-1POSIX\s0.2\*(R").
184\&\fIbsd_glob()\fR takes a mandatory \f(CW\*(C`pattern\*(C'\fR argument, and an optional
185\&\f(CW\*(C`flags\*(C'\fR argument, and returns a list of filenames matching the
186pattern, with interpretation of the pattern modified by the \f(CW\*(C`flags\*(C'\fR
187variable.
188.PP
189Since v5.6.0, Perl's \fICORE::glob()\fR is implemented in terms of \fIbsd_glob()\fR.
190Note that they don't share the same prototype\*(--\fICORE::glob()\fR only accepts
191a single argument. Due to historical reasons, \fICORE::glob()\fR will also
192split its argument on whitespace, treating it as multiple patterns,
193whereas \fIbsd_glob()\fR considers them as one pattern.
194.Sh "\s-1META\s0 \s-1CHARACTERS\s0"
195.IX Subsection "META CHARACTERS"
196.Vb 6
197\& \e Quote the next metacharacter
198\& [] Character class
199\& {} Multiple pattern
200\& * Match any string of characters
201\& ? Match any single character
202\& ~ User name home directory
203.Ve
204.PP
205The metanotation \f(CW\*(C`a{b,c,d}e\*(C'\fR is a shorthand for \f(CW\*(C`abe ace ade\*(C'\fR. Left to
206right order is preserved, with results of matches being sorted separately
207at a low level to preserve this order. As a special case \f(CW\*(C`{\*(C'\fR, \f(CW\*(C`}\*(C'\fR, and
208\&\f(CW\*(C`{}\*(C'\fR are passed undisturbed.
209.Sh "\s-1POSIX\s0 \s-1FLAGS\s0"
210.IX Subsection "POSIX FLAGS"
211The \s-1POSIX\s0 defined flags for \fIbsd_glob()\fR are:
212.ie n .IP """GLOB_ERR""" 4
213.el .IP "\f(CWGLOB_ERR\fR" 4
214.IX Item "GLOB_ERR"
215Force \fIbsd_glob()\fR to return an error when it encounters a directory it
216cannot open or read. Ordinarily \fIbsd_glob()\fR continues to find matches.
217.ie n .IP """GLOB_LIMIT""" 4
218.el .IP "\f(CWGLOB_LIMIT\fR" 4
219.IX Item "GLOB_LIMIT"
220Make \fIbsd_glob()\fR return an error (\s-1GLOB_NOSPACE\s0) when the pattern expands
221to a size bigger than the system constant \f(CW\*(C`ARG_MAX\*(C'\fR (usually found in
222limits.h). If your system does not define this constant, \fIbsd_glob()\fR uses
223\&\f(CW\*(C`sysconf(_SC_ARG_MAX)\*(C'\fR or \f(CW\*(C`_POSIX_ARG_MAX\*(C'\fR where available (in that
224order). You can inspect these values using the standard \f(CW\*(C`POSIX\*(C'\fR
225extension.
226.ie n .IP """GLOB_MARK""" 4
227.el .IP "\f(CWGLOB_MARK\fR" 4
228.IX Item "GLOB_MARK"
229Each pathname that is a directory that matches the pattern has a slash
230appended.
231.ie n .IP """GLOB_NOCASE""" 4
232.el .IP "\f(CWGLOB_NOCASE\fR" 4
233.IX Item "GLOB_NOCASE"
234By default, file names are assumed to be case sensitive; this flag
235makes \fIbsd_glob()\fR treat case differences as not significant.
236.ie n .IP """GLOB_NOCHECK""" 4
237.el .IP "\f(CWGLOB_NOCHECK\fR" 4
238.IX Item "GLOB_NOCHECK"
239If the pattern does not match any pathname, then \fIbsd_glob()\fR returns a list
240consisting of only the pattern. If \f(CW\*(C`GLOB_QUOTE\*(C'\fR is set, its effect
241is present in the pattern returned.
242.ie n .IP """GLOB_NOSORT""" 4
243.el .IP "\f(CWGLOB_NOSORT\fR" 4
244.IX Item "GLOB_NOSORT"
245By default, the pathnames are sorted in ascending \s-1ASCII\s0 order; this
246flag prevents that sorting (speeding up \fIbsd_glob()\fR).
247.PP
248The FreeBSD extensions to the \s-1POSIX\s0 standard are the following flags:
249.ie n .IP """GLOB_BRACE""" 4
250.el .IP "\f(CWGLOB_BRACE\fR" 4
251.IX Item "GLOB_BRACE"
252Pre-process the string to expand \f(CW\*(C`{pat,pat,...}\*(C'\fR strings like \fIcsh\fR\|(1).
253The pattern '{}' is left unexpanded for historical reasons (and \fIcsh\fR\|(1)
254does the same thing to ease typing of \fIfind\fR\|(1) patterns).
255.ie n .IP """GLOB_NOMAGIC""" 4
256.el .IP "\f(CWGLOB_NOMAGIC\fR" 4
257.IX Item "GLOB_NOMAGIC"
258Same as \f(CW\*(C`GLOB_NOCHECK\*(C'\fR but it only returns the pattern if it does not
259contain any of the special characters \*(L"*\*(R", \*(L"?\*(R" or \*(L"[\*(R". \f(CW\*(C`NOMAGIC\*(C'\fR is
260provided to simplify implementing the historic \fIcsh\fR\|(1) globbing
261behaviour and should probably not be used anywhere else.
262.ie n .IP """GLOB_QUOTE""" 4
263.el .IP "\f(CWGLOB_QUOTE\fR" 4
264.IX Item "GLOB_QUOTE"
265Use the backslash ('\e') character for quoting: every occurrence of a
266backslash followed by a character in the pattern is replaced by that
267character, avoiding any special interpretation of the character.
268(But see below for exceptions on \s-1DOSISH\s0 systems).
269.ie n .IP """GLOB_TILDE""" 4
270.el .IP "\f(CWGLOB_TILDE\fR" 4
271.IX Item "GLOB_TILDE"
272Expand patterns that start with '~' to user name home directories.
273.ie n .IP """GLOB_CSH""" 4
274.el .IP "\f(CWGLOB_CSH\fR" 4
275.IX Item "GLOB_CSH"
276For convenience, \f(CW\*(C`GLOB_CSH\*(C'\fR is a synonym for
277\&\f(CW\*(C`GLOB_BRACE | GLOB_NOMAGIC | GLOB_QUOTE | GLOB_TILDE | GLOB_ALPHASORT\*(C'\fR.
278.PP
279The \s-1POSIX\s0 provided \f(CW\*(C`GLOB_APPEND\*(C'\fR, \f(CW\*(C`GLOB_DOOFFS\*(C'\fR, and the FreeBSD
280extensions \f(CW\*(C`GLOB_ALTDIRFUNC\*(C'\fR, and \f(CW\*(C`GLOB_MAGCHAR\*(C'\fR flags have not been
281implemented in the Perl version because they involve more complex
282interaction with the underlying C structures.
283.PP
284The following flag has been added in the Perl implementation for
285csh compatibility:
286.ie n .IP """GLOB_ALPHASORT""" 4
287.el .IP "\f(CWGLOB_ALPHASORT\fR" 4
288.IX Item "GLOB_ALPHASORT"
289If \f(CW\*(C`GLOB_NOSORT\*(C'\fR is not in effect, sort filenames is alphabetical
290order (case does not matter) rather than in \s-1ASCII\s0 order.
291.SH "DIAGNOSTICS"
292.IX Header "DIAGNOSTICS"
293\&\fIbsd_glob()\fR returns a list of matching paths, possibly zero length. If an
294error occurred, &File::Glob::GLOB_ERROR will be non-zero and \f(CW$!\fR will be
295set. &File::Glob::GLOB_ERROR is guaranteed to be zero if no error occurred,
296or one of the following values otherwise:
297.ie n .IP """GLOB_NOSPACE""" 4
298.el .IP "\f(CWGLOB_NOSPACE\fR" 4
299.IX Item "GLOB_NOSPACE"
300An attempt to allocate memory failed.
301.ie n .IP """GLOB_ABEND""" 4
302.el .IP "\f(CWGLOB_ABEND\fR" 4
303.IX Item "GLOB_ABEND"
304The glob was stopped because an error was encountered.
305.PP
306In the case where \fIbsd_glob()\fR has found some matching paths, but is
307interrupted by an error, it will return a list of filenames \fBand\fR
308set &File::Glob::ERROR.
309.PP
310Note that \fIbsd_glob()\fR deviates from \s-1POSIX\s0 and FreeBSD \fIglob\fR\|(3) behaviour
311by not considering \f(CW\*(C`ENOENT\*(C'\fR and \f(CW\*(C`ENOTDIR\*(C'\fR as errors \- \fIbsd_glob()\fR will
312continue processing despite those errors, unless the \f(CW\*(C`GLOB_ERR\*(C'\fR flag is
313set.
314.PP
315Be aware that all filenames returned from File::Glob are tainted.
316.SH "NOTES"
317.IX Header "NOTES"
318.IP "\(bu" 4
319If you want to use multiple patterns, e.g. \f(CW\*(C`bsd_glob("a* b*")\*(C'\fR, you should
320probably throw them in a set as in \f(CW\*(C`bsd_glob("{a*,b*}")\*(C'\fR. This is because
321the argument to \fIbsd_glob()\fR isn't subjected to parsing by the C shell.
322Remember that you can use a backslash to escape things.
323.IP "\(bu" 4
324On \s-1DOSISH\s0 systems, backslash is a valid directory separator character.
325In this case, use of backslash as a quoting character (via \s-1GLOB_QUOTE\s0)
326interferes with the use of backslash as a directory separator. The
327best (simplest, most portable) solution is to use forward slashes for
328directory separators, and backslashes for quoting. However, this does
329not match \*(L"normal practice\*(R" on these systems. As a concession to user
330expectation, therefore, backslashes (under \s-1GLOB_QUOTE\s0) only quote the
331glob metacharacters '[', ']', '{', '}', '\-', '~', and backslash itself.
332All other backslashes are passed through unchanged.
333.IP "\(bu" 4
334Win32 users should use the real slash. If you really want to use
335backslashes, consider using Sarathy's File::DosGlob, which comes with
336the standard Perl distribution.
337.IP "\(bu" 4
338Mac \s-1OS\s0 (Classic) users should note a few differences. Since
339Mac \s-1OS\s0 is not Unix, when the glob code encounters a tilde glob (e.g.
340~user) and the \f(CW\*(C`GLOB_TILDE\*(C'\fR flag is used, it simply returns that
341pattern without doing any expansion.
342.Sp
343Glob on Mac \s-1OS\s0 is case-insensitive by default (if you don't use any
344flags). If you specify any flags at all and still want glob
345to be case\-insensitive, you must include \f(CW\*(C`GLOB_NOCASE\*(C'\fR in the flags.
346.Sp
347The path separator is ':' (aka colon), not '/' (aka slash). Mac \s-1OS\s0 users
348should be careful about specifying relative pathnames. While a full path
349always begins with a volume name, a relative pathname should always
350begin with a ':'. If specifying a volume name only, a trailing ':' is
351required.
352.Sp
353The specification of pathnames in glob patterns adheres to the usual Mac
354\&\s-1OS\s0 conventions: The path separator is a colon ':', not a slash '/'. A
355full path always begins with a volume name. A relative pathname on Mac
356\&\s-1OS\s0 must always begin with a ':', except when specifying a file or
357directory name in the current working directory, where the leading colon
358is optional. If specifying a volume name only, a trailing ':' is
359required. Due to these rules, a glob like <*:> will find all
360mounted volumes, while a glob like <*> or <:*> will find
361all files and directories in the current directory.
362.Sp
363Note that updirs in the glob pattern are resolved before the matching begins,
364i.e. a pattern like \*(L"*HD:t?p::a*\*(R" will be matched as \*(L"*HD:a*\*(R". Note also,
365that a single trailing ':' in the pattern is ignored (unless it's a volume
366name pattern like \*(L"*HD:\*(R"), i.e. a glob like <:*:> will find both
367directories \fIand\fR files (and not, as one might expect, only directories).
368You can, however, use the \f(CW\*(C`GLOB_MARK\*(C'\fR flag to distinguish (without a file
369test) directory names from file names.
370.Sp
371If the \f(CW\*(C`GLOB_MARK\*(C'\fR flag is set, all directory paths will have a ':' appended.
372Since a directory like 'lib:' is \fInot\fR a valid \fIrelative\fR path on Mac \s-1OS\s0,
373both a leading and a trailing colon will be added, when the directory name in
374question doesn't contain any colons (e.g. 'lib' becomes ':lib:').
375.SH "SEE ALSO"
376.IX Header "SEE ALSO"
377\&\*(L"glob\*(R" in perlfunc, \fIglob\fR\|(3)
378.SH "AUTHOR"
379.IX Header "AUTHOR"
380The Perl interface was written by Nathan Torkington <gnat@frii.com>,
381and is released under the artistic license. Further modifications were
382made by Greg Bacon <gbacon@cs.uah.edu>, Gurusamy Sarathy
383<gsar@activestate.com>, and Thomas Wegner
384<wegner_thomas@yahoo.com>. The C glob code has the
385following copyright:
386.PP
387.Vb 2
388\& Copyright (c) 1989, 1993 The Regents of the University of California.
389\& All rights reserved.
390.Ve
391.PP
392.Vb 2
393\& This code is derived from software contributed to Berkeley by
394\& Guido van Rossum.
395.Ve
396.PP
397.Vb 3
398\& Redistribution and use in source and binary forms, with or without
399\& modification, are permitted provided that the following conditions
400\& are met:
401.Ve
402.PP
403.Vb 8
404\& 1. Redistributions of source code must retain the above copyright
405\& notice, this list of conditions and the following disclaimer.
406\& 2. Redistributions in binary form must reproduce the above copyright
407\& notice, this list of conditions and the following disclaimer in the
408\& documentation and/or other materials provided with the distribution.
409\& 3. Neither the name of the University nor the names of its contributors
410\& may be used to endorse or promote products derived from this software
411\& without specific prior written permission.
412.Ve
413.PP
414.Vb 11
415\& THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
416\& ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
417\& IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
418\& ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
419\& FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
420\& DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
421\& OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
422\& HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
423\& LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
424\& OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
425\& SUCH DAMAGE.
426.Ve