version 1.1, 2012/02/21 22:57:48
|
version 1.1.1.2, 2012/05/29 09:29:43
|
Line 1
|
Line 1
|
/* Provide relocatable packages. |
/* Provide relocatable packages. |
Copyright (C) 2003, 2005 Free Software Foundation, Inc. | Copyright (C) 2003, 2005, 2008-2011 Free Software Foundation, Inc. |
Written by Bruno Haible <bruno@clisp.org>, 2003. |
Written by Bruno Haible <bruno@clisp.org>, 2003. |
|
|
This program is free software; you can redistribute it and/or modify it |
This program is free software; you can redistribute it and/or modify it |
Line 46 extern "C" {
|
Line 46 extern "C" {
|
instead of "/"). */ |
instead of "/"). */ |
extern RELOCATABLE_DLL_EXPORTED void |
extern RELOCATABLE_DLL_EXPORTED void |
set_relocation_prefix (const char *orig_prefix, |
set_relocation_prefix (const char *orig_prefix, |
const char *curr_prefix); | const char *curr_prefix); |
|
|
/* Returns the pathname, relocated according to the current installation |
/* Returns the pathname, relocated according to the current installation |
directory. */ | directory. |
| The returned string is either PATHNAME unmodified or a freshly allocated |
| string that you can free with free() after casting it to 'char *'. */ |
extern const char * relocate (const char *pathname); |
extern const char * relocate (const char *pathname); |
|
|
/* Memory management: relocate() leaks memory, because it has to construct | /* Memory management: relocate() potentially allocates memory, because it has |
a fresh pathname. If this is a problem because your program calls | to construct a fresh pathname. If this is a problem because your program |
relocate() frequently, think about caching the result. */ | calls relocate() frequently, think about caching the result. Or free the |
| return value if it was different from the argument pathname. */ |
|
|
/* Convenience function: |
/* Convenience function: |
Computes the current installation prefix, based on the original |
Computes the current installation prefix, based on the original |
installation prefix, the original installation directory of a particular |
installation prefix, the original installation directory of a particular |
file, and the current pathname of this file. Returns NULL upon failure. */ | file, and the current pathname of this file. |
extern const char * compute_curr_prefix (const char *orig_installprefix, | Returns it, freshly allocated. Returns NULL upon failure. */ |
const char *orig_installdir, | extern char * compute_curr_prefix (const char *orig_installprefix, |
const char *curr_pathname); | const char *orig_installdir, |
| const char *curr_pathname); |
|
|
#else |
#else |
|
|