]>
git.zerfleddert.de Git - proxmark3-svn/blob - client/whereami.h
1 // (‑●‑●)> released under the WTFPL v2 license, by Gregory Pakosz (@gpakosz)
2 // https://github.com/gpakosz/whereami
15 #define WAI_PREFIX(function) wai_##function
19 * Returns the path to the current executable.
22 * - first call `int length = wai_getExecutablePath(NULL, 0, NULL);` to
23 * retrieve the length of the path
24 * - allocate the destination buffer with `path = (char*)malloc(length + 1);`
25 * - call `wai_getExecutablePath(path, length, NULL)` again to retrieve the
27 * - add a terminal NUL character with `path[length] = '\0';`
29 * @param out destination buffer, optional
30 * @param capacity destination buffer capacity
31 * @param dirname_length optional recipient for the length of the dirname part
34 * @return the length of the executable path on success (without a terminal NUL
35 * character), otherwise `-1`
38 int WAI_PREFIX(getExecutablePath
)(char* out
, int capacity
, int* dirname_length
);
41 * Returns the path to the current module
44 * - first call `int length = wai_getModulePath(NULL, 0, NULL);` to retrieve
45 * the length of the path
46 * - allocate the destination buffer with `path = (char*)malloc(length + 1);`
47 * - call `wai_getModulePath(path, length, NULL)` again to retrieve the path
48 * - add a terminal NUL character with `path[length] = '\0';`
50 * @param out destination buffer, optional
51 * @param capacity destination buffer capacity
52 * @param dirname_length optional recipient for the length of the dirname part
55 * @return the length of the module path on success (without a terminal NUL
56 * character), otherwise `-1`
59 int WAI_PREFIX(getModulePath
)(char* out
, int capacity
, int* dirname_length
);
65 #endif // #ifndef WHEREAMI_H