Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / man / man3 / File::Basename.3
.\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sh \" Subsection heading
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. | will give a
.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
.\" expand to `' in nroff, nothing in troff, for use with C<>.
.tr \(*W-|\(bv\*(Tr
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
'br\}
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.\"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.hy 0
.if n .na
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "File::Basename 3"
.TH File::Basename 3 "2002-06-01" "perl v5.8.0" "Perl Programmers Reference Guide"
.SH "NAME"
fileparse \- split a pathname into pieces
.PP
basename \- extract just the filename from a path
.PP
dirname \- extract just the directory from a path
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 1
\& use File::Basename;
.Ve
.PP
.Vb 4
\& ($name,$path,$suffix) = fileparse($fullname,@suffixlist)
\& fileparse_set_fstype($os_string);
\& $basename = basename($fullname,@suffixlist);
\& $dirname = dirname($fullname);
.Ve
.PP
.Vb 4
\& ($name,$path,$suffix) = fileparse("lib/File/Basename.pm",qr{\e.pm});
\& fileparse_set_fstype("VMS");
\& $basename = basename("lib/File/Basename.pm",qr{\e.pm});
\& $dirname = dirname("lib/File/Basename.pm");
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
These routines allow you to parse file specifications into useful
pieces using the syntax of different operating systems.
.IP "fileparse_set_fstype" 4
.IX Item "fileparse_set_fstype"
You select the syntax via the routine \fIfileparse_set_fstype()\fR.
.Sp
If the argument passed to it contains one of the substrings
\&\*(L"\s-1VMS\s0\*(R", \*(L"\s-1MSDOS\s0\*(R", \*(L"MacOS\*(R", \*(L"AmigaOS\*(R" or \*(L"MSWin32\*(R", the file specification
syntax of that operating system is used in future calls to
\&\fIfileparse()\fR, \fIbasename()\fR, and \fIdirname()\fR. If it contains none of
these substrings, Unix syntax is used. This pattern matching is
case\-insensitive. If you've selected \s-1VMS\s0 syntax, and the file
specification you pass to one of these routines contains a \*(L"/\*(R",
they assume you are using Unix emulation and apply the Unix syntax
rules instead, for that function call only.
.Sp
If the argument passed to it contains one of the substrings \*(L"\s-1VMS\s0\*(R",
\&\*(L"\s-1MSDOS\s0\*(R", \*(L"MacOS\*(R", \*(L"AmigaOS\*(R", \*(L"os2\*(R", \*(L"MSWin32\*(R" or \*(L"\s-1RISCOS\s0\*(R", then the pattern
matching for suffix removal is performed without regard for case,
since those systems are not case-sensitive when opening existing files
(though some of them preserve case on file creation).
.Sp
If you haven't called \fIfileparse_set_fstype()\fR, the syntax is chosen
by examining the builtin variable \f(CW$^O\fR according to these rules.
.IP "fileparse" 4
.IX Item "fileparse"
The \fIfileparse()\fR routine divides a file specification into three
parts: a leading \fBpath\fR, a file \fBname\fR, and a \fBsuffix\fR. The
\&\fBpath\fR contains everything up to and including the last directory
separator in the input file specification. The remainder of the input
file specification is then divided into \fBname\fR and \fBsuffix\fR based on
the optional patterns you specify in \f(CW@suffixlist\fR. Each element of
this list can be a qr-quoted pattern (or a string which is interpreted
as a regular expression), and is matched
against the end of \fBname\fR. If this succeeds, the matching portion of
\&\fBname\fR is removed and prepended to \fBsuffix\fR. By proper use of
\&\f(CW@suffixlist\fR, you can remove file types or versions for examination.
.Sp
You are guaranteed that if you concatenate \fBpath\fR, \fBname\fR, and
\&\fBsuffix\fR together in that order, the result will denote the same
file as the input file specification.
.SH "EXAMPLES"
.IX Header "EXAMPLES"
Using Unix file syntax:
.PP
.Vb 2
\& ($base,$path,$type) = fileparse('/virgil/aeneid/draft.book7',
\& qr{\e.book\ed+});
.Ve
.PP
would yield
.PP
.Vb 3
\& $base eq 'draft'
\& $path eq '/virgil/aeneid/',
\& $type eq '.book7'
.Ve
.PP
Similarly, using \s-1VMS\s0 syntax:
.PP
.Vb 2
\& ($name,$dir,$type) = fileparse('Doc_Root:[Help]Rhetoric.Rnh',
\& qr{\e..*});
.Ve
.PP
would yield
.PP
.Vb 3
\& $name eq 'Rhetoric'
\& $dir eq 'Doc_Root:[Help]'
\& $type eq '.Rnh'
.Ve
.ie n .IP """basename""" 4
.el .IP "\f(CWbasename\fR" 4
.IX Item "basename"
The \fIbasename()\fR routine returns the first element of the list produced
by calling \fIfileparse()\fR with the same arguments, except that it always
quotes metacharacters in the given suffixes. It is provided for
programmer compatibility with the Unix shell command \fIbasename\fR\|(1).
.ie n .IP """dirname""" 4
.el .IP "\f(CWdirname\fR" 4
.IX Item "dirname"
The \fIdirname()\fR routine returns the directory portion of the input file
specification. When using \s-1VMS\s0 or MacOS syntax, this is identical to the
second element of the list produced by calling \fIfileparse()\fR with the same
input file specification. (Under \s-1VMS\s0, if there is no directory information
in the input file specification, then the current default device and
directory are returned.) When using Unix or \s-1MSDOS\s0 syntax, the return
value conforms to the behavior of the Unix shell command \fIdirname\fR\|(1). This
is usually the same as the behavior of \fIfileparse()\fR, but differs in some
cases. For example, for the input file specification \fIlib/\fR, \fIfileparse()\fR
considers the directory name to be \fIlib/\fR, while \fIdirname()\fR considers the
directory name to be \fI.\fR).