This source file includes following definitions.
- _sir_readlink
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 #ifndef _SIR_FILESYSTEM_H_INCLUDED
34 # define _SIR_FILESYSTEM_H_INCLUDED
35
36 # include "sir/platform.h"
37
38 # if defined(__cplusplus)
39 extern "C" {
40 # endif
41
42
43
44 # define SIR_PATH_BUFFER_GROW_BY 32
45
46
47
48 # define SIR_STAT_NONEXISTENT ((off_t)0xffffff02)
49
50
51
52 typedef enum {
53 SIR_PATH_REL_TO_CWD = 0x0001,
54 SIR_PATH_REL_TO_APP = 0x0002
55 } sir_rel_to;
56
57 bool _sir_pathgetstat(const char* restrict path, struct stat* restrict st, sir_rel_to rel_to);
58 bool _sir_pathexists(const char* restrict path, bool* restrict exists, sir_rel_to rel_to);
59 bool _sir_openfile(FILE* restrict* restrict f, const char* restrict path,
60 const char* restrict mode, sir_rel_to rel_to);
61
62 char* _sir_getcwd(void);
63
64 char* _sir_getappfilename(void);
65 char* _sir_getappbasename(void);
66 char* _sir_getappdir(void);
67
68 char* _sir_getbasename(char* restrict path);
69 char* _sir_getdirname(char* restrict path);
70
71 bool _sir_ispathrelative(const char* restrict path, bool* restrict relative);
72 bool _sir_getrelbasepath(const char* restrict path, bool* restrict relative,
73 const char* restrict* restrict base_path, sir_rel_to rel_to);
74
75 bool _sir_deletefile(const char* restrict path);
76
77 # if !defined(__WIN__)
78
79
80 static inline
81 ssize_t _sir_readlink(const char* restrict path, char* restrict buf, size_t bufsize)
82 {
83 return readlink(path, buf, bufsize);
84 }
85 # endif
86
87 # if defined(_AIX)
88 int _sir_aixself(char* buffer, size_t* size);
89 # endif
90
91 # if defined(__OpenBSD__)
92 int _sir_openbsdself(char* buffer, int size);
93 # endif
94
95 # if defined(__OpenBSD__) || (defined(_AIX) && defined(__PASE__))
96 int _sir_resolvepath(const char* restrict path, char* restrict buffer, size_t size);
97 # endif
98
99 # if defined(__cplusplus)
100 }
101 # endif
102
103 #endif