Charles.Forsyth20060303-partialeea662d19 years agoHistory
113 lines · 2.0 KB · Text
RawDownload
.TH NAMES 2.SH NAMENames: basename, cleanname, dirname, elements, isprefix, pathname, relative, rooted \- file name manipulation.SH SYNOPSIS.EXinclude "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 Namesprovides operations on file names (path names):.TF cleanname.PD.TP.B basenameReturn the trailing component of.I name(the text after the final.LR / ),shorn of.I suffix(which may be null)..TP.B cleannameReturn 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 dirnameReturn the directory component of.IR name :the string up to but not including the final slash(es)..TP.B elementsReturn a list of the path elements of.IR name :the words between slashes.If.I namestarts with a.LR / ,the head of the list will be the string\&\f5"/"\fPbut otherwise slashes do not appear..TP.B pathnameReturn a path name formed from a list of elements as produced by.BR elements ..TP.B isprefixReturn true iff path name.I ais a prefix of path name.IR b ..TP.B relativeIf.I nameis.IB root / Xfor some.IR X ,return.IR X ;otherwise return.I nameunchanged..TP.B rootedReturn the path name for.I namerelative to a given.I rootdirectory (either name may be nil).If.I nameitself starts with.L /or.LR # ,the result is.IR name ;otherwise it is.IB root / name..PPSee.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)