RESOLVEPATH(3)
πΈ RESOLVEPATH(3) β SchilyΒ΄s LIBRARY FUNCTIONS πΈ
okay bestie, listen up π this page is all about three little functions that take your messy path name and un-mess it β resolvepath(), resolvenpath(), and resolvefpath(). their whole entire job? resolve all symbolic links of a path name. no cap. β¨
β¨ NAME β¨
resolvepath(), resolvenpath(), resolvefpath() β resolve all symbolic links of a path name π«Ά
π SYNOPSIS π
first, the glow-up ritual (aka the include):
#include <schily/schily.h>
then the three icons themselves, exactly as they live in the header:
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 π
resolvepath() β the main character
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. π«
pathβ the relative path name used as the inputbufβ the buffer used for the result of the conversionbufsizβ the size of the result buffer
and the glow-up rules, lowkey iconic:
- all
"."components are eliminated - every non-leading
".."component is eliminated together with its preceding directory component - if leading
".."components reach the root directory, they're replaced by"/"π
resolvenpath() β same vibes, less commitment
resolvenpath() behaves like resolvepath() except that the file does not need to exist. that's it. that's the tweet. π
resolvefpath() β the one with extra flags
resolvefpath() takes an additional flags parameter, pulled from this set of flags:
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. slay. β¨
otherwise, -1 is returned and errno is set to indicate the error. and heads up: in case of an error, the contents of the result buffer is left in an intermediate state β so like, don't trust it, it's mid. π
π ERRORS π
ERANGEβ the path does not fit into the supplied buffer. too big for the bag, honestly. πEFAULTβ a null pointer was supplied aspathname. bestie. why. πEINVALβ an empty relative path was supplied. nothing to work with! π«- other β any other value that may be a result of an underlying filesystem operation. mystery box energy. π
π USAGE π
applications should not assume that the returned contents of the buffer are null-terminated. π¨
why, you ask? because the function resolvepath(3) may be the Solaris version if the program is compiled on Solaris. plot twist fr fr. π³
π SEE ALSO π
π§ NOTES π§
none. literally none. that's the whole note. π
okay that's the whole page bestie, you ate that π mwah π β this masterpiece of a man page is brought to you by Joerg Schilling, dated 2022/09/09, living its best life as RESOLVEPATH(3) in SchilyΒ΄s LIBRARY FUNCTIONS. periodt. π
π¦ 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