ABSPATH(3)

πŸ“¦
version 2022.10.16 Β· 2 versions
, in opensuse-leap 16.0

πŸ’… ABSPATH(3) β€” from SchilyΒ΄s LIBRARY FUNCTIONS (yes bestie, that apostrophe is an acute accent, that's just how Joerg rolls) πŸŽ€


✨ NAME ✨

abspath(), absnpath(), absfpath() β€” the trio that takes your lil relative pathname and glows it up into a full (absolute) pathname πŸ¦‹


🌸 SYNOPSIS 🌸

#include <schily/schily.h>

char *
abspath(relp, absp, asize)
                const   char    *relp;
                        char    *absp;
                        size_t  asize;

char *
absnpath(relp, absp, asize)
                const   char    *relp;
                        char    *absp;
                        size_t  asize;

char *
absfpath(relp, absp, asize, flags)
                const   char    *relp;
                        char    *absp;
                        size_t  asize;
                        int     flags;

πŸ’– DESCRIPTION πŸ’–

okay so picture this: abspath() takes a relative path name and converts it into an absolute path name. fr fr, that's the whole gig. Let's break down the cast πŸ‘‘

  • relp β€” the relative path name, aka the input. she's the main character of the input side πŸ’…
  • absp β€” the buffer where the result of the conversion lands. her job is to hold the glow-up ✨
  • asize β€” the size of the result buffer. lowkey important, don't forget her πŸ™ˆ

absnpath() behaves like abspath() exept that the file does not need to exist. (that typo is in the original and I'm keeping it, it's iconic, we don't fix, we stan 🫢) so like... absnpath() is the chill one that doesn't need your file to actually be there. no vibe check required.

absfpath() takes an additional flags parameter from the set of flags from resolvefpath() to control the behavior. she's the customizable one, the one with ✨options✨


πŸ¦‹ RETURN VALUE πŸ¦‹

On successful completion, abspath(), absnpath() and absfpath() return a pointer to the resolved name absp. slay. mission accomplished πŸ’–

Otherwise? a null pointer is returned and errno is set to indicate the error β€” and the contents of the buffer pointed to by absp is left in an indeterminate state 😭 like, do NOT trust what's in there, she's going through something. it's giving chaos, it's giving undefined vibes. bestie, check errno and move on.


πŸ’€ ERRORS πŸ’€

  • ERANGE β€” the path does not fit into the suplied buffer. too big, too fabulous, the buffer said no 🚫 (again: "suplied" is verbatim, we respect the ancestors πŸ™)
  • EFAULT β€” a null pointer was suplied as pathname. like... you handed her nothing. emptiness. void energy πŸ•³οΈ
  • EINVAL β€” an empty relative path was supplied. the audacity of an empty string, honestly πŸ’€

πŸ”₯ SEE ALSO πŸ”₯

the whole friend group, go say hi 🫢


and that's the page bestie!! written by Joerg Schilling, dated 2022/09/09 β€” the man, the myth, the legend who brought us these absolute-path icons πŸ‘‘πŸ’œ mwah, go forth and resolve ur paths βœ¨πŸŽ€

πŸ“¦ where this page comes from