RESOLVEPATH(3)
okay bestie, welcome to RESOLVEPATH(3) from SchilyΒ΄s LIBRARY FUNCTIONS π
this is the group chat where symbolic links get fully resolved, no crumbs left behind. Weβre talking resolvepath(), resolvenpath(), and resolvefpath() β the path-resolving girlies. Letβs go β¨
πΈ NAME πΈ
resolvepath(), resolvenpath(), resolvefpath() β resolve all symbolic links of a path name. Thatβs the assignment, bestie: take a path name and resolve all symbolic links in it. Slay π
β¨ SYNOPSIS β¨
#include <schily/schily.h>
int
resolvepath(path, buf, bufsiz)
const char *path;
char *buf;
size_t bufsiz;
int
resolvenpath(path, buf, bufsiz)
const char *path;
char *buf;
size_t bufsiz;
int
resolvefpath(path, buf, bufsiz, flags)
const char *path;
char *buf;
size_t bufsiz;
int flags;
π DESCRIPTION π
Okay so resolvepath() takes a relative path name and resolves all symbolic links in the path name. The result is a path name that is free of symbolic links, periodt. path is relative path name that is used as the input. buf is the buffer used for the result of the conversion. bufsiz is the size of the result buffer.
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 "/" β iconic root behavior, no cap.
resolvenpath() behaves like resolvepath() except that the file does not need to exist. Lowkey convenient, fr fr.
resolvefpath() takes an additional flags parameter from the set of flags from the following set:
RSPF_EXISTβ All path components must exist.RSPF_NOFOLLOW_LASTβ Don't follow symbolic links in the last path component.
π«Ά RETURN VALUE π«Ά
Upon successful completion, resolvepath(), resolvenpath() and resolvefpath() return the number of bytes placed in the buffer. Otherwise, -1 is returned and errno is set to indicate the error. In case of an error, the contents of result buffer is left in an intermediate state. Yes bestie, intermediate state β not fully cooked π.
π ERRORS π
ERANGEβ The path does not fit into the suplied buffer.EFAULTβ A null pointer was suplied as pathname.EINVALβ An empty relative path was supplied.otherβ Any other value that may be a result of an underlying filesystem operation.
π¦ USAGE π¦
Applications should not assume that the returned contents of the buffer are null-terminated. This is because the function resolvepath(3) may be the Solaris version if the program is compiled on Solaris.
Read that again, bestie β null-termination is not guaranteed here π.
π₯ SEE ALSO π₯
π NOTES π
none. Literally none. Not a single note, bestie π«Ά
Cute sign-off: this page is by Joerg Schilling, dated 2022/09/09, and itβs the RESOLVEPATH(3) page. Mwah ππ«Ά
π¦ where this page comes from
- opensuse-leap 16.0: libschily-devel-doc 2022.10.16-160000.2.2 Β· CDDL-1.0
- Copyright 2015-2020 J. Schilling
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms