Go to the source code of this file.
Defines | |
#define | br_init SlLp57100427862049_br_init |
#define | br_init_lib SlLp57100427862049_br_init_lib |
#define | br_find_exe SlLp57100427862049_br_find_exe |
#define | br_find_exe_dir SlLp57100427862049_br_find_exe_dir |
#define | br_find_prefix SlLp57100427862049_br_find_prefix |
#define | br_find_bin_dir SlLp57100427862049_br_find_bin_dir |
#define | br_find_sbin_dir SlLp57100427862049_br_find_sbin_dir |
#define | br_find_data_dir SlLp57100427862049_br_find_data_dir |
#define | br_find_locale_dir SlLp57100427862049_br_find_locale_dir |
#define | br_find_lib_dir SlLp57100427862049_br_find_lib_dir |
#define | br_find_libexec_dir SlLp57100427862049_br_find_libexec_dir |
#define | br_find_etc_dir SlLp57100427862049_br_find_etc_dir |
#define | br_strcat SlLp57100427862049_br_strcat |
#define | br_build_path SlLp57100427862049_br_build_path |
#define | br_dirname SlLp57100427862049_br_dirname |
Enumerations | |
enum | BrInitError { BR_INIT_ERROR_NOMEM, BR_INIT_ERROR_OPEN_MAPS, BR_INIT_ERROR_READ_MAPS, BR_INIT_ERROR_INVALID_MAPS, BR_INIT_ERROR_DISABLED } |
Functions | |
int | SlLp57100427862049_br_init (BrInitError *error) |
int | SlLp57100427862049_br_init_lib (BrInitError *error) |
char * | SlLp57100427862049_br_find_exe (const char *default_exe) |
char * | SlLp57100427862049_br_find_exe_dir (const char *default_dir) |
char * | SlLp57100427862049_br_find_prefix (const char *default_prefix) |
char * | SlLp57100427862049_br_find_bin_dir (const char *default_bin_dir) |
char * | SlLp57100427862049_br_find_sbin_dir (const char *default_sbin_dir) |
char * | SlLp57100427862049_br_find_data_dir (const char *default_data_dir) |
char * | SlLp57100427862049_br_find_locale_dir (const char *default_locale_dir) |
char * | SlLp57100427862049_br_find_lib_dir (const char *default_lib_dir) |
char * | SlLp57100427862049_br_find_libexec_dir (const char *default_libexec_dir) |
char * | SlLp57100427862049_br_find_etc_dir (const char *default_etc_dir) |
char * | SlLp57100427862049_br_strcat (const char *str1, const char *str2) |
char * | SlLp57100427862049_br_build_path (const char *dir, const char *file) |
char * | SlLp57100427862049_br_dirname (const char *path) |
|
Definition at line 150 of file binreloc.h. |
|
Definition at line 151 of file binreloc.h. |
|
Definition at line 142 of file binreloc.h. |
|
Definition at line 144 of file binreloc.h. |
|
Definition at line 148 of file binreloc.h. |
|
Definition at line 139 of file binreloc.h. |
|
Definition at line 140 of file binreloc.h. |
|
Definition at line 146 of file binreloc.h. |
|
Definition at line 147 of file binreloc.h. |
|
Definition at line 145 of file binreloc.h. |
|
Definition at line 141 of file binreloc.h. |
|
Definition at line 143 of file binreloc.h. |
|
Definition at line 137 of file binreloc.h. |
|
Definition at line 138 of file binreloc.h. |
|
Definition at line 149 of file binreloc.h. |
|
These error codes can be returned by br_init(), br_init_lib(), gbr_init() or gbr_init_lib().
Definition at line 121 of file binreloc.h. 00121 { 00123 BR_INIT_ERROR_NOMEM, 00125 BR_INIT_ERROR_OPEN_MAPS, 00127 BR_INIT_ERROR_READ_MAPS, 00129 BR_INIT_ERROR_INVALID_MAPS, 00131 BR_INIT_ERROR_DISABLED 00132 } BrInitError;
|
|
Definition at line 784 of file binreloc.c. 00785 { 00786 char *dir2, *result; 00787 size_t len; 00788 int must_free = 0; 00789 00790 len = strlen (dir); 00791 if (len > 0 && dir[len - 1] != '/') { 00792 dir2 = br_strcat (dir, "/"); 00793 must_free = 1; 00794 } else 00795 dir2 = (char *) dir; 00796 00797 result = br_strcat (dir2, file); 00798 if (must_free) 00799 free (dir2); 00800 return result; 00801 }
|
|
Extracts the directory component of a path. Similar to g_dirname() or the dirname commandline application. Example: br_dirname ("/usr/local/foobar"); --> Returns: "/usr/local"
Definition at line 840 of file binreloc.c. 00841 { 00842 char *end, *result; 00843 00844 if (path == (const char *) NULL) 00845 return (char *) NULL; 00846 00847 end = strrchr (path, '/'); 00848 if (end == (const char *) NULL) 00849 return strdup ("."); 00850 00851 while (end > path && *end == '/') 00852 end--; 00853 result = br_strndup (path, end - path + 1); 00854 if (result[0] == 0) { 00855 free (result); 00856 return strdup ("/"); 00857 } else 00858 return result; 00859 }
|
|
Locate the application's binary folder. The path is generated by the following pseudo-code evaluation: prefix + "/bin"
Definition at line 532 of file binreloc.c. 00533 { 00534 char *prefix, *dir; 00535 00536 prefix = br_find_prefix ((const char *) NULL); 00537 if (prefix == (char *) NULL) { 00538 /* BinReloc not initialized. */ 00539 if (default_bin_dir != (const char *) NULL) 00540 return strdup (default_bin_dir); 00541 else 00542 return (char *) NULL; 00543 } 00544 00545 dir = br_build_path (prefix, "bin"); 00546 free (prefix); 00547 return dir; 00548 }
|
|
Locate the application's data folder. The path is generated by the following pseudo-code evaluation: prefix + "/share"
Definition at line 599 of file binreloc.c. 00600 { 00601 char *prefix, *dir; 00602 00603 prefix = br_find_prefix ((const char *) NULL); 00604 if (prefix == (char *) NULL) { 00605 /* BinReloc not initialized. */ 00606 if (default_data_dir != (const char *) NULL) 00607 return strdup (default_data_dir); 00608 else 00609 return (char *) NULL; 00610 } 00611 00612 dir = br_build_path (prefix, "share"); 00613 free (prefix); 00614 return dir; 00615 }
|
|
Locate the application's configuration files folder. The path is generated by the following pseudo-code evaluation: prefix + "/etc"
Definition at line 731 of file binreloc.c. 00732 { 00733 char *prefix, *dir; 00734 00735 prefix = br_find_prefix ((const char *) NULL); 00736 if (prefix == (char *) NULL) { 00737 /* BinReloc not initialized. */ 00738 if (default_etc_dir != (const char *) NULL) 00739 return strdup (default_etc_dir); 00740 else 00741 return (char *) NULL; 00742 } 00743 00744 dir = br_build_path (prefix, "etc"); 00745 free (prefix); 00746 return dir; 00747 }
|
|
Find the canonical filename of the current application.
Definition at line 443 of file binreloc.c. 00444 { 00445 if (exe == (char *) NULL) { 00446 /* BinReloc is not initialized. */ 00447 if (default_exe != (const char *) NULL) 00448 return strdup (default_exe); 00449 else 00450 return (char *) NULL; 00451 } 00452 return strdup (exe); 00453 }
|
|
Locate the directory in which the current application is installed. The prefix is generated by the following pseudo-code evaluation: dirname(exename)
Definition at line 471 of file binreloc.c. 00472 { 00473 if (exe == NULL) { 00474 /* BinReloc not initialized. */ 00475 if (default_dir != NULL) 00476 return strdup (default_dir); 00477 else 00478 return NULL; 00479 } 00480 00481 return br_dirname (exe); 00482 }
|
|
Locate the application's library folder. The path is generated by the following pseudo-code evaluation: prefix + "/lib"
Definition at line 665 of file binreloc.c. 00666 { 00667 char *prefix, *dir; 00668 00669 prefix = br_find_prefix ((const char *) NULL); 00670 if (prefix == (char *) NULL) { 00671 /* BinReloc not initialized. */ 00672 if (default_lib_dir != (const char *) NULL) 00673 return strdup (default_lib_dir); 00674 else 00675 return (char *) NULL; 00676 } 00677 00678 dir = br_build_path (prefix, "lib"); 00679 free (prefix); 00680 return dir; 00681 }
|
|
Locate the application's libexec folder. The path is generated by the following pseudo-code evaluation: prefix + "/libexec"
Definition at line 698 of file binreloc.c. 00699 { 00700 char *prefix, *dir; 00701 00702 prefix = br_find_prefix ((const char *) NULL); 00703 if (prefix == (char *) NULL) { 00704 /* BinReloc not initialized. */ 00705 if (default_libexec_dir != (const char *) NULL) 00706 return strdup (default_libexec_dir); 00707 else 00708 return (char *) NULL; 00709 } 00710 00711 dir = br_build_path (prefix, "libexec"); 00712 free (prefix); 00713 return dir; 00714 }
|
|
Locate the application's localization folder. The path is generated by the following pseudo-code evaluation: prefix + "/share/locale"
Definition at line 632 of file binreloc.c. 00633 { 00634 char *data_dir, *dir; 00635 00636 data_dir = br_find_data_dir ((const char *) NULL); 00637 if (data_dir == (char *) NULL) { 00638 /* BinReloc not initialized. */ 00639 if (default_locale_dir != (const char *) NULL) 00640 return strdup (default_locale_dir); 00641 else 00642 return (char *) NULL; 00643 } 00644 00645 dir = br_build_path (data_dir, "locale"); 00646 free (data_dir); 00647 return dir; 00648 }
|
|
Locate the prefix in which the current application is installed. The prefix is generated by the following pseudo-code evaluation: dirname(dirname(exename))
Definition at line 499 of file binreloc.c. 00500 { 00501 char *dir1, *dir2; 00502 00503 if (exe == (char *) NULL) { 00504 /* BinReloc not initialized. */ 00505 if (default_prefix != (const char *) NULL) 00506 return strdup (default_prefix); 00507 else 00508 return (char *) NULL; 00509 } 00510 00511 dir1 = br_dirname (exe); 00512 dir2 = br_dirname (dir1); 00513 free (dir1); 00514 return dir2; 00515 }
|
|
Locate the application's superuser binary folder. The path is generated by the following pseudo-code evaluation: prefix + "/sbin"
Definition at line 565 of file binreloc.c. 00566 { 00567 char *prefix, *dir; 00568 00569 prefix = br_find_prefix ((const char *) NULL); 00570 if (prefix == (char *) NULL) { 00571 /* BinReloc not initialized. */ 00572 if (default_sbin_dir != (const char *) NULL) 00573 return strdup (default_sbin_dir); 00574 else 00575 return (char *) NULL; 00576 } 00577 00578 dir = br_build_path (prefix, "sbin"); 00579 free (prefix); 00580 return dir; 00581 }
|
|
Initialize the BinReloc library (for applications). This function must be called before using any other BinReloc functions. It attempts to locate the application's canonical filename.
Definition at line 404 of file binreloc.c. 00405 { 00406 exe = _br_find_exe (error); 00407 return exe != NULL; 00408 }
|
|
Initialize the BinReloc library (for libraries). This function must be called before using any other BinReloc functions. It attempts to locate the calling library's canonical filename.
Definition at line 426 of file binreloc.c. 00427 { 00428 exe = _br_find_exe_for_symbol ((const void *) "", error); 00429 return exe != NULL; 00430 }
|
|
Concatenate str1 and str2 to a newly allocated string.
Definition at line 761 of file binreloc.c. 00762 { 00763 char *result; 00764 size_t len1, len2; 00765 00766 if (str1 == NULL) 00767 str1 = ""; 00768 if (str2 == NULL) 00769 str2 = ""; 00770 00771 len1 = strlen (str1); 00772 len2 = strlen (str2); 00773 00774 result = (char *) malloc (len1 + len2 + 1); 00775 memcpy (result, str1, len1); 00776 memcpy (result + len1, str2, len2); 00777 result[len1 + len2] = '\0'; 00778 00779 return result; 00780 }
|