ABSPATH(3)

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

πŸ’… ABSPATH(3) Β· SchilyΒ΄s LIBRARY FUNCTIONS πŸ’…

πŸŽ€ NAME πŸŽ€

okay bestie, so abspath(), absnpath(), and absfpath() are the trio that expands a relative pathname to a full (absolute) pathname ✨. They take your little relative-path gremlin and turn it into the full absolute-path main character. πŸ‘‘


πŸ¦‹ 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 ✨

So abspath() takes a relative path name and converts it into an absolute path name πŸ’«. Here’s the cast:

  • relp is the relative path name used as the input.
  • absp is the buffer used for the result of the conversion.
  • asize is the size of the result buffer.

absnpath() behaves like abspath() except that the file does not need to exist 🫢. It’s giving β€œpath math doesn’t need a vibe check from the filesystem,” iykyk.

absfpath() takes an additional flags parameter from the set of flags from resolvefpath() to control the behavior πŸ”₯. Very β€œextra parameter, extra power,” no cap.


🌈 RETURN VALUE 🌈

On successful completion, abspath(), absnpath(), and absfpath() return a pointer to the resolved name absp πŸŽ€. Slay.

Otherwise, a null pointer is returned and errno is set to indicate the error 😭.

⚠️ Important, bestie: when that happens, the contents of the buffer pointed to by absp is left in an indeterminate state. Like, do not trust it, do not read it like it’s cute β€” it is not giving stable data. πŸ’€

🚨 ERRORS 🚨

  • ERANGE β€” The path does not fit into the supplied buffer. 😬
  • EFAULT β€” A null pointer was supplied as pathname. πŸ™ˆ
  • EINVAL β€” An empty relative path was supplied. πŸ’…

πŸ‘€ SEE ALSO πŸ‘€

resolvepath(3), resolvenpath(3), resolvefpath(3) πŸ¦‹


πŸ’Œ cute little sign-off: Joerg Schilling Β· 2022/09/09 Β· ABSPATH(3) πŸ’Œ

πŸ“¦ where this page comes from