tcleanname.3 - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
       tcleanname.3 (703B)
       ---
            1 .TH CLEANNAME 3
            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 \*9/src/lib9/cleanname.c
           33 .SH SEE ALSO
           34 .MR cleanname (1)