KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
libgen.h
Go to the documentation of this file.
1/* KallistiOS ##version##
2
3 libgen.h
4 Copyright (C) 2020 Lawrence Sebald
5*/
6
7/** \file libgen.h
8 \brief Definitions for pattern matching functions.
9 \ingroup vfs_posix
10
11 This file contains the definitions for the functions basename() and
12 dirname() as specified by the POSIX standard. How the POSIX people came
13 up with this filename for this stuff, I don't know.
14
15 The GNU C library defines a slightly different version of these functions in
16 <string.h> instead of here. Please note that these functions, unlike the
17 GNU versions that are in <string.h> on Linux do modify their input values,
18 as POSIX allows.
19
20 \author Lawrence Sebald
21*/
22
23#ifndef __LIBGEN_H
24#define __LIBGEN_H
25
26#include <sys/cdefs.h>
27__BEGIN_DECLS
28
29/** \addtogroup vfs_posix
30 @{
31*/
32
33/** \brief Get the last component of a pathname.
34
35 This function retrieves the basename from a given path. The basename of a
36 path is the non-directory component thereof, minus any trailing '/'
37 characters. This function does not attempt to perform any sort of path
38 resolution.
39
40 \note This function may modify its input and the returned value may be a
41 pointer to part of its input.
42
43 \param path The path to extract the basename from.
44 \return A pointer to the basename of the given path.
45*/
46char *basename(char *path);
47
48/** \brief Get the parent directory of a file pathname.
49
50 This function retrieves the name of the parent directory of the file
51 pathname specified. This function does not attempt to perform any sort of
52 path resolution to check for the existence of the specified directory or to
53 resolve any symbolic links.
54
55 \note This function may modify its input and the returned value may be a
56 pointer to part of its input.
57
58 \param path The path to extract the parent directory from.
59 \return A pointer to the parent directory of the given path.
60*/
61char *dirname(char *path);
62
63/** @} */
64
65__END_DECLS
66
67#endif /* !__LIBGEN_H */
char * basename(char *path)
Get the last component of a pathname.
char * dirname(char *path)
Get the parent directory of a file pathname.