Remove advertising header from man pages.
[dragonfly.git] / usr.bin / basename / basename.1
1 .\" Copyright (c) 1990, 1993, 1994
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" This code is derived from software contributed to Berkeley by
5 .\" the Institute of Electrical and Electronics Engineers, Inc.
6 .\"
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
9 .\" are met:
10 .\" 1. Redistributions of source code must retain the above copyright
11 .\"    notice, this list of conditions and the following disclaimer.
12 .\" 2. Redistributions in binary form must reproduce the above copyright
13 .\"    notice, this list of conditions and the following disclaimer in the
14 .\"    documentation and/or other materials provided with the distribution.
15 .\" 4. Neither the name of the University nor the names of its contributors
16 .\"    may be used to endorse or promote products derived from this software
17 .\"    without specific prior written permission.
18 .\"
19 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 .\" SUCH DAMAGE.
30 .\"
31 .\"     @(#)basename.1  8.2 (Berkeley) 4/18/94
32 .\" $FreeBSD: src/usr.bin/basename/basename.1,v 1.17 2006/03/16 17:21:52 jkoshy Exp $
33 .\" $DragonFly: src/usr.bin/basename/basename.1,v 1.7 2007/08/28 15:36:44 pavalos Exp $
34 .\"
35 .Dd April 18, 1994
36 .Dt BASENAME 1
37 .Os
38 .Sh NAME
39 .Nm basename ,
40 .Nm dirname
41 .Nd return filename or directory portion of pathname
42 .Sh SYNOPSIS
43 .Nm
44 .Ar string
45 .Op Ar suffix
46 .Nm
47 .Op Fl a
48 .Op Fl s Ar suffix
49 .Ar string
50 .Op Ar ...
51 .Nm dirname
52 .Ar string
53 .Sh DESCRIPTION
54 The
55 .Nm
56 utility deletes any prefix ending with the last slash
57 .Ql \&/
58 character present in
59 .Ar string
60 (after first stripping trailing slashes),
61 and a
62 .Ar suffix ,
63 if given.
64 The
65 .Ar suffix
66 is not stripped if it is identical to the remaining characters in
67 .Ar string .
68 The resulting filename is written to the standard output.
69 A non-existent suffix is ignored.
70 If
71 .Fl a
72 is specified, then every argument is treated as a
73 .Ar string
74 as if
75 .Nm
76 were invoked with just one argument.
77 If
78 .Fl s
79 is specified, then the
80 .Ar suffix
81 is taken as its argument, and all other arguments are treated as a
82 .Ar string .
83 .Pp
84 The
85 .Nm dirname
86 utility deletes the filename portion, beginning
87 with the last slash
88 .Ql \&/
89 character to the end of
90 .Ar string
91 (after first stripping trailing slashes),
92 and writes the result to the standard output.
93 .Sh EXIT STATUS
94 .Ex -std basename dirname
95 .Sh EXAMPLES
96 The following line sets the shell variable
97 .Ev FOO
98 to
99 .Pa /usr/bin .
100 .Pp
101 .Dl FOO=`dirname /usr/bin/trail`
102 .Sh SEE ALSO
103 .Xr csh 1 ,
104 .Xr sh 1 ,
105 .Xr basename 3 ,
106 .Xr dirname 3
107 .Sh STANDARDS
108 The
109 .Nm
110 and
111 .Nm dirname
112 utilities are expected to be
113 .St -p1003.2
114 compatible.
115 The
116 .Nm
117 utility does not conform to
118 .St -p1003.1-2004 .
119 The
120 .Nm dirname
121 utility conforms to
122 .St -p1003.1-2004 .