diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-07-04 08:52:36 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-07-04 08:52:36 +0000 |
commit | 953a57b2e223c8401c3ed8056c022fe89c3a59bc (patch) | |
tree | ac86a6b58014be746ca44321a7c2cf3da55af3f8 | |
parent | 905475ddd17c01fc1fbcd4e2d95076d436e128c1 (diff) |
split dirname and basename man pages
-rw-r--r-- | lib/libc/gen/Makefile.inc | 6 | ||||
-rw-r--r-- | lib/libc/gen/basename.3 | 50 | ||||
-rw-r--r-- | usr.bin/basename/Makefile | 4 | ||||
-rw-r--r-- | usr.bin/basename/basename.1 | 30 |
4 files changed, 25 insertions, 65 deletions
diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc index 24bd548766a..de17321af12 100644 --- a/lib/libc/gen/Makefile.inc +++ b/lib/libc/gen/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.16 1997/12/22 10:13:55 deraadt Exp $ +# $OpenBSD: Makefile.inc,v 1.17 1998/07/04 08:52:34 deraadt Exp $ # gen sources .PATH: ${.CURDIR}/arch/${MACHINE_ARCH}/gen ${.CURDIR}/gen @@ -43,7 +43,8 @@ errlst.o errlst.po: .endif # _NOTDEF_XXX_ MAN+= alarm.3 basename.3 clock.3 confstr.3 ctermid.3 ctype.3 daemon.3 \ - devname.3 directory.3 err.3 exec.3 fnmatch.3 frexp.3 ftok.3 fts.3 \ + devname.3 directory.3 dirname.3 err.3 exec.3 fnmatch.3 frexp.3 \ + ftok.3 fts.3 \ getbsize.3 getcap.3 getcwd.3 getdomainname.3 getdiskbyname.3 \ getfsent.3 getgrent.3 getgrouplist.3 gethostname.3 getloadavg.3 \ getmntinfo.3 getnetgrent.3 getpagesize.3 getpass.3 getpwent.3 \ @@ -99,4 +100,3 @@ MLINKS+=syslog.3 closelog.3 syslog.3 openlog.3 syslog.3 setlogmask.3 \ syslog.3 vsyslog.3 MLINKS+=ttyname.3 isatty.3 ttyname.3 ttyslot.3 MLINKS+=vis.3 strvis.3 vis.3 strvisx.3 unvis.3 strunvis.3 -MLINKS+=basename.3 dirname.3 diff --git a/lib/libc/gen/basename.3 b/lib/libc/gen/basename.3 index a6e063ac876..29779573643 100644 --- a/lib/libc/gen/basename.3 +++ b/lib/libc/gen/basename.3 @@ -24,21 +24,18 @@ .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF .\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $OpenBSD: basename.3,v 1.3 1998/06/21 22:13:38 millert Exp $ +.\" $OpenBSD: basename.3,v 1.4 1998/07/04 08:52:35 deraadt Exp $ .\" .Dd August 17, 1997 .Dt BASENAME 3 .Os .Sh NAME -.Nm basename , -.Nm dirname -.Nd extract the base or directory portition of a pathname +.Nm basename +.Nd extract the base portition of a pathname .Sh SYNOPSIS .Fd #include <libgen.h> .Ft char * .Fn basename "char *path" -.Ft char * -.Fn dirname "char *path" .Sh DESCRIPTION The .Fn basename @@ -52,36 +49,16 @@ is returned. If .Ar path is a NULL pointer or the empty string, a pointer to the string "." is returned. -.Pp -The -.Fn dirname -function -is the converse of -.Fn basename ; -it returns a pointer to the parent directory of the pathname pointed to by -.Ar path . -Any trailing '/' characters are not counted as part of the directory -name. If -.Ar path -is a NULL pointer, the empty string, or contains no '/' characters, -.Fn dirname -returns a pointer to the string ".", signifying the current directory. .Sh RETURN VALUES On successful completion, .Fn basename returns a pointer to the last component of .Ar path. .Pp -On successful completion, -.Fn dirname -returns a pointer to the parent directory of -.Ar path. .Pp If .Fn basename -or -.Fn dirname -fail, a NULL pointer is returned and the global variable +fails, a NULL pointer is returned and the global variable .Va errno is set to indicate the error. .Sh ERRORS @@ -92,28 +69,23 @@ The following error codes may be set in the path component to be returned was larger than .Va MANPATHLEN . .Sh WARNINGS -Both .Fn basename -and -.Fn dirname -return pointers to internal static storage space that will be overwritten -by subsequent calls (each function has its own separate storage). +returns a pointer to internal static storage space that will be overwritten +by subsequent calls. .Sh SEE ALSO .Xr basename 1 , +.Xr dirname 1 , +.Xr dirname 3 , .Xr dirname 1 .Sh STANDARDS The -.Fn basename -and -.Fn dirname -functions conform to +.Fn basename +function conforms to .St -xpg4.2 . .Sh HISTORY The .Fn basename -and -.Fn dirname -functions first appeared in +function first appeared in .Ox 2.2 . .Sh AUTHOR .nf diff --git a/usr.bin/basename/Makefile b/usr.bin/basename/Makefile index b74cfe54c2c..93ab1c4d7f1 100644 --- a/usr.bin/basename/Makefile +++ b/usr.bin/basename/Makefile @@ -1,6 +1,6 @@ -# $OpenBSD: Makefile,v 1.3 1997/09/21 11:48:25 deraadt Exp $ +# $OpenBSD: Makefile,v 1.4 1998/07/04 08:52:31 deraadt Exp $ PROG= basename -MLINKS= basename.1 dirname.1 +MAN= basename.1 dirname.1 .include <bsd.prog.mk> diff --git a/usr.bin/basename/basename.1 b/usr.bin/basename/basename.1 index a79ea5b1ae9..1ff9fcc06dd 100644 --- a/usr.bin/basename/basename.1 +++ b/usr.bin/basename/basename.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: basename.1,v 1.3 1997/11/15 20:23:52 deraadt Exp $ +.\" $OpenBSD: basename.1,v 1.4 1998/07/04 08:52:32 deraadt Exp $ .\" $NetBSD: basename.1,v 1.9 1995/03/25 18:17:45 glass Exp $ .\" .\" Copyright (c) 1990, 1993, 1994 @@ -41,14 +41,12 @@ .Dt BASENAME 1 .Os .Sh NAME -.Nm basename , dirname -.Nd return filename or directory portion of pathname +.Nm basename +.Nd return filename portion of pathname .Sh SYNOPSIS .Nm basename .Ar string .Op Ar suffix -.Nm dirname -.Ar string .Sh DESCRIPTION .Nm Basename deletes any prefix ending with the last slash @@ -61,35 +59,25 @@ if given. The resulting filename is written to the standard output. A non-existent suffix is ignored. .Pp -.Nm Dirname -deletes the filename portion, beginning -with the last slash -.Ql \&/ -character to the end of -.Ar string , -and writes the result to the standard output. .Sh EXAMPLES The following line sets the shell variable .Ev FOO to -.Pa /usr/bin . +.Pa ls . .Pp -.Dl FOO=`dirname /usr/bin/trail` +.Dl FOO=`basename /usr/bin/trail` .Pp .Sh DIAGNOSTICS -Both the +The .Nm basename -and -.Nm dirname -utilities +utility exit 0 on success, and >0 if an error occurs. .Sh SEE ALSO +.Xr dirname 1 , .Xr csh 1 , .Xr sh 1 .Sh STANDARDS The .Nm basename -and -.Nm dirname -utilities conform to +utility conform to .St -p1003.2-92 . |