resolvepath - resolve all symbolic links of a path name
#include <unistd.h> int resolvepath(const char *path, char *buf, size_t bufsiz);
The resolvepath() function fully resolves all symbolic links in the path name path into a resulting path name free of symbolic links and places the resulting path name in the buffer buf which has size bufsiz. The resulting path name names the same file or directory as the original path name. All ``.'' components are eliminated and every non-leading ``..'' component is eliminated together with its preceding directory component. If leading ``..'' components reach to the root directory, they are replaced by ``/''. If the number of bytes in the resulting path name is less than bufsiz, the contents of the remainder of buf are unspecified.
Upon successful completion, resolvepath() returns the count of bytes placed in the buffer. Otherwise, it returns -1, leaves the buffer unchanged, and sets errno to indicate the error.
The resolvepath() function will fail if:
No more than PATH_MAX bytes will be placed in the buffer. Applications should not assume that the returned contents of the buffer are null-terminated.
Закладки на сайте
Проследить за страницей
Created 1996-2021 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру