static void init_search_path() { char *carmen_home; char buf[128]; int i; sp_num = 0; search_path_add("."); for (i = 0; i < rsp_num; i++) { sprintf(buf, "../%s", relative_search_path[i]); search_path_add(buf); } carmen_home = getenv("CARMEN_HOME"); if (carmen_home) { for (i = 0; i < rsp_num; i++) { sprintf(buf, "%s/%s", carmen_home, relative_search_path[i]); search_path_add(buf); } } for (i = 0; i < rsp_num; i++) { sprintf(buf, "/usr/local/%s", relative_search_path[i]); search_path_add(buf); } }
void m4_add_include_directory (m4 *context, const char *dir, bool prepend) { if (m4_get_posixly_correct_opt (context)) return; search_path_add (m4__get_search_path (context), dir, prepend); #ifdef DEBUG_INCL xfprintf (stderr, "add_include_directory (%s) %s;\n", dir, prepend ? "prepend" : "append"); #endif }
void m4__include_init (m4 *context) { include_env_init (context); { m4__search_path_info *info = m4__get_search_path (context); /* If M4PATH was not set, then search just the current directory by default. */ assert (info); if (info->list_end == NULL) search_path_add (info, "", false); /* Non-core modules installation directory. */ search_path_add (info, PKGLIBDIR, false); } #ifdef DEBUG_INCL fputs ("initial include search path...\n", stderr); include_dump (context); #endif }
static void search_path_env_init (m4__search_path_info *info, char *path, bool isabs) { char *path_end; if (info == NULL || path == NULL) return; do { path_end = strchr (path, PATH_SEPARATOR); if (path_end) *path_end = '\0'; if (!isabs || *path == '/') search_path_add (info, path, false); path = path_end + 1; } while (path_end); }