source: filezilla/trunk/fuentes/src/interface/prefix.h @ 130

Last change on this file since 130 was 130, checked in by jrpelegrina, 3 years ago

First release to xenial

File size: 4.2 KB
Line 
1/*
2 * BinReloc - a library for creating relocatable executables
3 * Written by: Mike Hearn <mike@theoretic.com>
4 *             Hongli Lai <h.lai@chello.nl>
5 * http://autopackage.org/
6 *
7 * This source code is public domain. You can relicense this code
8 * under whatever license you want.
9 *
10 * See http://autopackage.org/docs/binreloc/ for
11 * more information and how to use this.
12 *
13 * NOTE: if you're using C++ and are getting "undefined reference
14 * to br_*", try renaming prefix.c to prefix.cpp
15 */
16
17#ifndef _PREFIX_H_
18#define _PREFIX_H_
19
20#ifdef ENABLE_BINRELOC
21
22/* WARNING, BEFORE YOU MODIFY PREFIX.C:
23 *
24 * If you make changes to any of the functions in prefix.c, you MUST
25 * change the BR_NAMESPACE macro.
26 * This way you can avoid symbol table conflicts with other libraries
27 * that also happen to use BinReloc.
28 *
29 * Example:
30 * #define BR_NAMESPACE(funcName) foobar_ ## funcName
31 * --> expands br_locate to foobar_br_locate
32 */
33#undef BR_NAMESPACE
34#define BR_NAMESPACE(funcName) funcName
35
36
37#define br_thread_local_store BR_NAMESPACE(br_thread_local_store)
38#define br_locate BR_NAMESPACE(br_locate)
39#define br_locate_prefix BR_NAMESPACE(br_locate_prefix)
40#define br_prepend_prefix BR_NAMESPACE(br_prepend_prefix)
41
42#ifndef BR_NO_MACROS
43        /* These are convience macros that replace the ones usually used
44           in Autoconf/Automake projects */
45        #undef SELFPATH
46        #undef PREFIX
47        #undef PREFIXDIR
48        #undef BINDIR
49        #undef SBINDIR
50        #undef DATADIR
51        #undef LIBDIR
52        #undef LIBEXECDIR
53        #undef ETCDIR
54        #undef SYSCONFDIR
55        #undef CONFDIR
56        #undef LOCALEDIR
57
58        #define SELFPATH        (br_thread_local_store (br_locate ((void *) "")))
59        #define PREFIX          (br_thread_local_store (br_locate_prefix ((void *) "")))
60        #define PREFIXDIR       (br_thread_local_store (br_locate_prefix ((void *) "")))
61        #define BINDIR          (br_thread_local_store (br_prepend_prefix ((void *) "", "/bin")))
62        #define SBINDIR         (br_thread_local_store (br_prepend_prefix ((void *) "", "/sbin")))
63        #define DATADIR         (br_thread_local_store (br_prepend_prefix ((void *) "", "/share")))
64        #define LIBDIR          (br_thread_local_store (br_prepend_prefix ((void *) "", "/lib")))
65        #define LIBEXECDIR      (br_thread_local_store (br_prepend_prefix ((void *) "", "/libexec")))
66        #define ETCDIR          (br_thread_local_store (br_prepend_prefix ((void *) "", "/etc")))
67        #define SYSCONFDIR      (br_thread_local_store (br_prepend_prefix ((void *) "", "/etc")))
68        #define CONFDIR         (br_thread_local_store (br_prepend_prefix ((void *) "", "/etc")))
69        #define LOCALEDIR       (br_thread_local_store (br_prepend_prefix ((void *) "", "/share/locale")))
70#endif /* BR_NO_MACROS */
71
72
73/* The following functions are used internally by BinReloc
74   and shouldn't be used directly in applications. */
75
76const char *br_thread_local_store (char *str);
77char *br_locate         (void *symbol);
78char *br_locate_prefix  (void *symbol);
79char *br_prepend_prefix (void *symbol, const char *path);
80
81
82#define br_strcat BR_NAMESPACE(br_strcat)
83#define br_extract_dir BR_NAMESPACE(br_extract_dir)
84#define br_extract_prefix BR_NAMESPACE(br_extract_prefix)
85
86#ifndef BR_NO_MACROS
87        /* Convenience functions for concatenating paths */
88        #define BR_SELFPATH(suffix)     (br_thread_local_store (br_strcat (SELFPATH, suffix)))
89        #define BR_PREFIX(suffix)       (br_thread_local_store (br_strcat (PREFIX, suffix)))
90        #define BR_PREFIXDIR(suffix)    (br_thread_local_store (br_strcat (BR_PREFIX, suffix)))
91        #define BR_BINDIR(suffix)       (br_thread_local_store (br_strcat (BINDIR, suffix)))
92        #define BR_SBINDIR(suffix)      (br_thread_local_store (br_strcat (SBINDIR, suffix)))
93        #define BR_DATADIR(suffix)      (br_thread_local_store (br_strcat (DATADIR, suffix)))
94        #define BR_LIBDIR(suffix)       (br_thread_local_store (br_strcat (LIBDIR, suffix)))
95        #define BR_LIBEXECDIR(suffix)   (br_thread_local_store (br_strcat (LIBEXECDIR, suffix)))
96        #define BR_ETCDIR(suffix)       (br_thread_local_store (br_strcat (ETCDIR, suffix)))
97        #define BR_SYSCONFDIR(suffix)   (br_thread_local_store (br_strcat (SYSCONFDIR, suffix)))
98        #define BR_CONFDIR(suffix)      (br_thread_local_store (br_strcat (CONFDIR, suffix)))
99        #define BR_LOCALEDIR(suffix)    (br_thread_local_store (br_strcat (LOCALEDIR, suffix)))
100#endif
101
102char *br_strcat (const char *str1, const char *str2);
103char *br_extract_dir    (const char *path);
104char *br_extract_prefix(const char *path);
105
106#endif /* ENABLE_BINRELOC */
107
108#endif /* _PREFIX_H_ */
Note: See TracBrowser for help on using the repository browser.