summaryrefslogtreecommitdiff
path: root/man/2/names
diff options
context:
space:
mode:
authorCharles.Forsyth <devnull@localhost>2006-12-22 20:52:35 +0000
committerCharles.Forsyth <devnull@localhost>2006-12-22 20:52:35 +0000
commit46439007cf417cbd9ac8049bb4122c890097a0fa (patch)
tree6fdb25e5f3a2b6d5657eb23b35774b631d4d97e4 /man/2/names
parent37da2899f40661e3e9631e497da8dc59b971cbd0 (diff)
20060303-partial
Diffstat (limited to 'man/2/names')
-rw-r--r--man/2/names113
1 files changed, 113 insertions, 0 deletions
diff --git a/man/2/names b/man/2/names
new file mode 100644
index 00000000..e28abf08
--- /dev/null
+++ b/man/2/names
@@ -0,0 +1,113 @@
+.TH NAMES 2
+.SH NAME
+Names: basename, cleanname, dirname, elements, isprefix, pathname, relative, rooted \- file name manipulation
+.SH SYNOPSIS
+.EX
+include "names.m";
+names := load Names Names->PATH;
+
+basename: fn(name: string, suffix: string): string;
+cleanname: fn(name: string): string;
+dirname: fn(name: string): string;
+elements: fn(name: string): list of string;
+isprefix: fn(a: string, b: string): int;
+pathname: fn(els: list of string): string;
+relative: fn(name: string, root: string): string;
+rooted: fn(root: string, name: string): string;
+.EE
+.SH DESCRIPTION
+.B Names
+provides operations on file names (path names):
+.TF cleanname
+.PD
+.TP
+.B basename
+Return the trailing component of
+.I name
+(the text after the final
+.LR / ),
+shorn of
+.I suffix
+(which may be null).
+.TP
+.B cleanname
+Return a `cleaner' version of
+.IR name :
+there are no redundant and trailing slashes,
+and directory names
+.L .
+and
+.L ..
+have been interpreted lexically.
+If the result would otherwise be the empty string,
+the name
+.L .
+is returned instead.
+.TP
+.B dirname
+Return the directory component of
+.IR name :
+the string up to but not including the final slash(es).
+.TP
+.B elements
+Return a list of the path elements of
+.IR name :
+the words between slashes.
+If
+.I name
+starts with a
+.LR / ,
+the head of the list will be the string
+\&\f5"/"\fP
+but otherwise slashes do not appear.
+.TP
+.B pathname
+Return a path name formed from a list of elements as produced by
+.BR elements .
+.TP
+.B isprefix
+Return true iff path name
+.I a
+is a prefix of path name
+.IR b .
+.TP
+.B relative
+If
+.I name
+is
+.IB root / X
+for some
+.IR X ,
+return
+.IR X ;
+otherwise return
+.I name
+unchanged.
+.TP
+.B rooted
+Return the path name for
+.I name
+relative to a given
+.I root
+directory (either name may be nil).
+If
+.I name
+itself starts with
+.L /
+or
+.LR # ,
+the result is
+.IR name ;
+otherwise it is
+.IB root / name.
+.PP
+See
+.IR sys-intro (2)
+for details of file name syntax and its interpretation.
+.SH SOURCE
+.B /appl/lib/names.b
+.SH SEE ALSO
+.IR sys-intro (2),
+.IR sys-fd2path (2),
+.IR workdir (2)
+