52 #define __USE_XOPEN_EXTENDED // for realpath() 55 #define __USE_XOPEN_EXTENDED // for strdup() 77 static char rootdir[FILENAME_MAX];
78 char *bindir, *rootdir_rel;
79 char *cmd1 =
NULL, *bindir_tmp =
NULL;
82 if (!cmd || !base_cmd) {
87 if (strcmp(cmd, base_cmd) == 0) {
88 cmd1 =
pathfind(getenv(
"PATH"), cmd,
"rx");
97 if (strcmp(bindir,
".") == 0) {
101 bindir_tmp = strdup(bindir);
102 rootdir_rel =
dirname(bindir_tmp);
107 if (realpath(rootdir_rel, rootdir) ==
NULL) {
void MONITOR_EXT_WRAP_NAME() free(void *ptr)
string dirname(const char *fName)
char * pathfind(const char *pathList, const char *name, const char *mode)
char * findinstall(const char *cmd, const char *base_cmd)