1CANONICALIZE_FILE_NAME(3)  Linux Programmer's Manual CANONICALIZE_FILE_NAME(3)
2
3
4

NAME

6       canonicalize_file_name - return the canonicalized absolute pathname
7

SYNOPSIS

9       #define _GNU_SOURCE         /* See feature_test_macros(7) */
10       #include <stdlib.h>
11
12       char *canonicalize_file_name(const char *path);
13

DESCRIPTION

15       The  canonicalize_file_name() function returns a null-terminated string
16       containing the canonicalized absolute pathname corresponding  to  path.
17       In  the  returned string, symbolic links are resolved, as are .  and ..
18       pathname components.  Consecutive slash (/) characters are replaced  by
19       a single slash.
20
21       The   returned   string   is   dynamically   allocated   by  canonicalā€
22       ize_file_name() and the caller should deallocate it with  free(3)  when
23       it is no longer required.
24
25       The call canonicalize_file_name(path) is equivalent to the call:
26
27           realpath(path, NULL);
28

RETURN VALUE

30       On  success, canonicalize_file_name() returns a null-terminated string.
31       On error (e.g., a pathname component is unreadable or does not  exist),
32       canonicalize_file_name()  returns  NULL  and sets errno to indicate the
33       error.
34

ERRORS

36       See realpath(3).
37

CONFORMING TO

39       This function is a GNU extension.
40

SEE ALSO

42       readlink(2), realpath(3)
43

COLOPHON

45       This page is part of release 3.53 of the Linux  man-pages  project.   A
46       description  of  the project, and information about reporting bugs, can
47       be found at http://www.kernel.org/doc/man-pages/.
48
49
50
51GNU                               2013-05-11         CANONICALIZE_FILE_NAME(3)
Impressum