1canonicalize_file_name(3)  Library Functions Manual  canonicalize_file_name(3)
2
3
4

NAME

6       canonicalize_file_name - return the canonicalized absolute pathname
7

LIBRARY

9       Standard C library (libc, -lc)
10

SYNOPSIS

12       #define _GNU_SOURCE         /* See feature_test_macros(7) */
13       #include <stdlib.h>
14
15       char *canonicalize_file_name(const char *path);
16

DESCRIPTION

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

RETURN VALUE

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

ERRORS

39       See realpath(3).
40

ATTRIBUTES

42       For an  explanation  of  the  terms  used  in  this  section,  see  at‐
43       tributes(7).
44
45       ┌────────────────────────────────────────────┬───────────────┬─────────┐
46Interface                                   Attribute     Value   
47       ├────────────────────────────────────────────┼───────────────┼─────────┤
48canonicalize_file_name()                    │ Thread safety │ MT-Safe │
49       └────────────────────────────────────────────┴───────────────┴─────────┘
50

STANDARDS

52       GNU.
53

SEE ALSO

55       readlink(2), realpath(3)
56
57
58
59Linux man-pages 6.05              2023-07-20         canonicalize_file_name(3)
Impressum