blob: 5568880e28dc8baab7d9a8480b8c785700170309 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
.TH CLEANNAME 3
.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 /usr/local/plan9/src/lib9/cleanname.c
.SH SEE ALSO
.IR cleanname (1)
|