1
1
/* Provide relocatable packages.
2
Copyright (C) 2003, 2005 Free Software Foundation, Inc.
2
Copyright (C) 2003, 2005, 2008 Free Software Foundation, Inc.
3
3
Written by Bruno Haible <bruno@clisp.org>, 2003.
5
5
This program is free software; you can redistribute it and/or modify it
46
46
instead of "/"). */
47
47
extern RELOCATABLE_DLL_EXPORTED void
48
48
set_relocation_prefix (const char *orig_prefix,
49
const char *curr_prefix);
49
const char *curr_prefix);
51
51
/* Returns the pathname, relocated according to the current installation
53
The returned string is either PATHNAME unmodified or a freshly allocated
54
string that you can free with free() after casting it to 'char *'. */
53
55
extern const char * relocate (const char *pathname);
55
/* Memory management: relocate() leaks memory, because it has to construct
56
a fresh pathname. If this is a problem because your program calls
57
relocate() frequently, think about caching the result. */
57
/* Memory management: relocate() potentially allocates memory, because it has
58
to construct a fresh pathname. If this is a problem because your program
59
calls relocate() frequently, think about caching the result. Or free the
60
return value if it was different from the argument pathname. */
59
62
/* Convenience function:
60
63
Computes the current installation prefix, based on the original
61
64
installation prefix, the original installation directory of a particular
62
file, and the current pathname of this file. Returns NULL upon failure. */
63
extern const char * compute_curr_prefix (const char *orig_installprefix,
64
const char *orig_installdir,
65
const char *curr_pathname);
65
file, and the current pathname of this file.
66
Returns it, freshly allocated. Returns NULL upon failure. */
67
extern char * compute_curr_prefix (const char *orig_installprefix,
68
const char *orig_installdir,
69
const char *curr_pathname);