summaryrefslogtreecommitdiff
path: root/src/lib/evil/evil_libgen.h
blob: b832d620ed8e7a9344e202603218a889e2e5b112 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#ifndef __EVIL_LIBGEN_H__
#define __EVIL_LIBGEN_H__


/**
 * @file evil_libgen.h
 * @brief The file that provides functions ported from Unix in libgen.h.
 * @defgroup Evil_Libgen_Group Libgen.h functions.
 * @ingroup Evil
 *
 * This header provides functions ported from Unix in libgen.h.
 *
 * @{
 */

/**
 * @brief Parse the base name component of a path.
 *
 * @param path The path to parse.
 * @return The component following the final '/'.
 *
 * This function parses @p path and returns its component following
 * the final '\'. Trailing '\' are not taken into account. On Windows
 * XP, @p path must beginning by a drive letter followed by ':/' or
 * ':\', otherwise "C:\" is returned. All characters '/' are replaced by '\'. On
 * error (memory allocation failure), "C:\" is returned, otherwise the
 * component following the final '\' is returned as a statically
 * allocated memory. Hence the returns value must not be freed.
 *
 * Concatenating the string returned by dirname(), a "\", and the
 * string returned by basename() yields a complete pathname.
 *
 * @see evil_dirname()
 * @see dirname()
 *
 * Conformity: Non applicable.
 *
 * Supported OS: Windows XP.
 */
EAPI char *evil_basename(char *path);

/**
 * @def basename(p)
 *
 * Wrapper around evil_basename().
 */
#define basename(p) evil_basename(p)

/**
 * @brief Parse the dir name component of a path.
 *
 * @param path The path to parse.
 * @return The component up to, but not including, the final '/'.
 *
 * This function parses @p path and returns its component up to, but
 * not including, the final '/'. Trailing '\' are not taken into
 * account. On Windows XP, @p path must beginning by a drive letter
 * followed by ':/' or ':\', otherwise "C:\" is returned. All
 * characters '/' are replaced by '\'. On error (memory allocation
 * failure), "C:\" is returned, otherwise,  the component up to, but
 * not including, the final '/' is returned as a statically allocated
 * memory. Hence the returns value must not be freed.
 *
 * Concatenating the string returned by dirname(), a "\", and the
 * string returned by basename() yields a complete pathname.
 *
 * @see evil_basename()
 * @see basename()
 *
 * Conformity: Non applicable.
 *
 * Supported OS: Windows XP.
 */
EAPI char *evil_dirname(char *path);

/**
 * @def dirname(p)
 *
 * Wrapper around evil_dirname().
 */
#define dirname(p) evil_dirname(p)


/**
 * @}
 */


#endif /* __EVIL_LIBGEN_H__ */