Plan 9 from Bell Labs’s /usr/web/sources/plan9/sys/man/2/cleanname

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


.TH CLEANNAME 2
.SH NAME
cleanname \- clean a path name
.SH SYNOPSIS
.B #include <u.h>
.br
.B #include <libc.h>
.sp
.B
char*	cleanname(char *filename)
.SH DESCRIPTION
.I Cleanname
takes a
.I filename
and by lexical processing only returns the shortest string that names the same (possibly
hypothetical) file.
It eliminates multiple and trailing slashes, and it lexically interprets
.B .
and
.B ..
directory components in the name.
The string is overwritten in place.
.PP
The shortest string
.I cleanname
can return is two bytes: the null-terminated string
\f(CW"."\f1.
Therefore
.I filename
must contain room for at least two bytes.
.SH SOURCE
.B /sys/src/libc/port/cleanname.c
.SH SEE ALSO
.IR cleanname (1)

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].