Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
.TH CLEANNAME 2
2
.SH NAME
3
cleanname \- clean a path name
4
.SH SYNOPSIS
5
.B #include <u.h>
6
.br
7
.B #include <libc.h>
8
.sp
9
.B
10
char*	cleanname(char *filename)
11
.SH DESCRIPTION
12
.I Cleanname
13
takes a
14
.I filename
15
and by lexical processing only returns the shortest string that names the same (possibly
16
hypothetical) file.
17
It eliminates multiple and trailing slashes, and it lexically interprets
18
.B .
19
and
20
.B ..
21
directory components in the name.
22
The string is overwritten in place.
23
.PP
24
The shortest string
25
.I cleanname
26
can return is two bytes: the null-terminated string
27
\f(CW"."\f1.
28
Therefore
29
.I filename
30
must contain room for at least two bytes.
31
.SH SOURCE
32
.B /sys/src/libc/port/cleanname.c
33
.SH SEE ALSO
34
.IR cleanname (1)