Walter's version said too much

This commit is contained in:
Michael Kerrisk 2005-07-14 14:55:50 +00:00
parent bc69fad6f8
commit 4ff2a3ba99
1 changed files with 13 additions and 66 deletions

View File

@ -1,76 +1,23 @@
.\" Copyright 2002 walter harms (walter.harms@informatik.uni-oldenburg.de)
.\" Distributed under GPL
.\" based on glibc.info page
.TH CANONICALIZE_FILE_NAME 3 2002-10-03 "GNU" ""
.\" Copyright 2005 walter harms (walter.harms@informatik.uni-oldenburg.de)
.\" and Michael Kerrisk (mtk-manpages@gmx.net).
.\" Distributed under the GNU General Public License.
.\"
.TH CANONICALIZE_FILE_NAME 3 2005-07-14 "GNU" ""
.SH NAME
canonicalize_file_name,
program_invocation_name,
program_invocation_short_name
\- return the canonicalized absolute filename
canonicalize_file_name \- return the canonicalized filename
.SH SYNOPSIS
.sp
.B #define __USE_GNU
.B #define _GNU_SOURCE
.br
.B #include <stdlib.h>
.sp
.BI "char *canonicalize_file_name (const char *" NAME " );"
.br
.BI "char *" program_invocation_name ;
.br
.BI "char *" program_invocation_short_name ;
.BI "char *canonicalize_file_name (const char *" path ");"
.SH DESCRIPTION
The
.B canonicalize_file_name()
function returns the absolute name of
the file named by NAME which contains no `.', `..' components nor
any repeated path separators (`/') or symlinks. The result is
passed back as the return value of the function in a block of
memory allocated with `malloc'. If the result is not used anymore
the memory should be freed with a call to `free'.
.sp
In any of the path components except the last one is missing the
function returns a NULL pointer. This is also what is returned if
the length of the path reaches or exceeds
.I PATH_MAX
characters.
In any case `errno' is set accordingly.
.sp
If
.I PATH_MAX
cant be determinated it is set to 1024.
.sp
There are two additional variables that let the programmer get access
to the programmname.
.br
.B program_invocation_name
is the name running in the current process. It is the same as `argv[0]'.
.br
.B program_invocation_short_name
is the same minus everything up to the last slash.
.SH ERRORS
.TP
.B EINVA
The
.I name
is NULL.
.TP
.B ENAMETOOLONG
The resulting path is too long. This error only occurs on
systems which have a limit on the file name length.
.TP
.B EACCES
At least one of the path components is not readable.
.TP
.B ENOENT
The input file name is empty.
.TP
.B ENOENT
At least one of the path components does not exist.
.TP
.B ELOOP
More than
.I MAXSYMLINKS
many symlinks have been followed.
The call
.I canonicalize_file_name(path)
is equivalent to the call
.IR "realpath(path,\ NULL)" .
.SH "CONFORMING TO"
The function is a GNU extension.
.SH "SEE ALSO"