Lines Matching defs:path
105 * Dir_Expand Given a pattern and a path, return a Lst of names
106 * which match the pattern on the search path.
108 * Dir_FindFile Searches for a file on a given search path.
109 * If it exists, the entire path is returned.
112 * Dir_FindHereOrAbove Search for a path in the current directory and
114 * the path is found or we reach the root ("/").
117 * is searched for along the default search path.
118 * The path and mtime fields of the node are filled
121 * Dir_AddDir Add a directory to a search path.
123 * Dir_MakeFlags Given a search path and a command flag, create
124 * a string with each of the directories in the path
128 * Dir_Destroy Destroy an element of a search path. Frees up all
131 * search path.
132 * Dir_ClearPath Resets a search path to the empty list.
151 * A search path consists of a Lst of Path structures. A Path structure
206 * directory for a file is provided in the search path.
220 Lst dirSearchPath; /* main search path */
230 nearmisses, /* Found under search path */
235 static Path *dotLast; /* a fake path entry indicating we need to
393 * (re)initialize "dot" (current/object directory) path hash
651 * path Search path to use
663 DirExpandCurly(const char *word, const char *brace, Lst path, Lst expansions)
735 Dir_Expand(file, path, expansions);
758 * path one by one, calling DirMatchFiles for each. NOTE: This still
763 * path Path on which to look
775 DirExpandInt(const char *word, Lst path, Lst expansions)
780 if (Lst_Open(path) == SUCCESS) {
781 while ((ln = Lst_Next(path)) != NULL) {
785 Lst_Close(path);
815 * in the directories on the given search path.
819 * path the list of directories in which to find the
825 * path matching the given pattern.
832 Dir_Expand(const char *word, Lst path, Lst expansions)
842 DirExpandCurly(word, cp, path, expansions);
859 DirExpandCurly(word, cp, path, expansions);
878 dirpath = Dir_FindFile(word, path);
883 * i.e. if the path contains ../Etc/Object and we're
891 path = Lst_Init(FALSE);
892 (void)Dir_AddDir(path, dirpath);
893 DirExpandInt(cp+1, path, expansions);
894 Lst_Destroy(path, NULL);
900 DirExpandInt(word, path, expansions);
906 DirExpandInt(word, path, expansions);
915 * Then the files in every other directory on the path.
917 DirExpandInt(word, path, expansions);
929 * Find if the file with the given name exists in the given path.
932 * The path to the file or NULL. This path is guaranteed to be in a
965 * Find if the file with the given name exists in the given path.
968 * The path to the file or NULL. This path is guaranteed to be in a
1014 * Find if the file with the given name exists in the given path.
1017 * The path to the file, the empty string or NULL. If the file is
1019 * This path is guaranteed to be in a different part of memory
1037 * If the file has a leading path component and that component
1071 * The path to the file or NULL. This path is guaranteed to be in a
1106 * Find the file with the given name along the given search path.
1110 * path the Lst of directories to search
1113 * The path to the file or NULL. This path is guaranteed to be in a
1117 * If the file is found in a directory which is not on the path
1118 * already (either 'name' is absolute or it is a relative path
1120 * already on the search path), its directory is added to the end
1121 * of the path on the assumption that there will be more files in
1126 Dir_FindFile(const char *name, Lst path)
1130 Path *p; /* current path member */
1155 if (Lst_Open(path) == FAILURE) {
1157 fprintf(debug_file, "couldn't open path, file not found\n");
1163 if ((ln = Lst_First(path)) != NULL) {
1178 * of each of the directories on the search path.
1182 * We look through all the directories on the path seeking one which
1190 * DOTLAST path, in which case we search it last) and we *do not*
1197 Lst_Close(path);
1201 while ((ln = Lst_Next(path)) != NULL) {
1206 Lst_Close(path);
1213 Lst_Close(path);
1217 Lst_Close(path);
1220 * We didn't find the file on any directory in the search path.
1224 * path. (eg. /usr/include and sys/types.h. The above search would
1229 * component of the resulting name onto the search path (at the
1263 (void)Lst_Open(path);
1264 while ((ln = Lst_Next(path)) != NULL) {
1274 Lst_Close(path);
1278 Lst_Close(path);
1292 * Already checked by the given name, since . was in the path,
1304 * For absolute names, compare directory path prefix against the
1305 * the directory path of each member on the search path for an exact
1306 * match. If we have an exact match on any member of the search path,
1313 fprintf(debug_file, " Trying exact path matches...\n");
1319 (void)Lst_Open(path);
1320 while ((ln = Lst_Next(path)) != NULL) {
1325 Lst_Close(path);
1329 Lst_Close(path);
1337 * onto the search path in any case, just in case, then look for the
1341 * do an extra search of the final directory on the path. Unless something
1344 * Sigh. We cannot add the directory onto the search path because
1358 (void)Dir_AddDir(path, name);
1362 ln = Lst_Last(path);
1405 * search for a path starting at a given directory and then working
1410 * search_path the path we are looking for
1416 * 0 on failure, 1 on success [in which case the found path is put
1484 * search path dirSearchPath.
1494 * If the node didn't have a path entry before, and Dir_FindFile
1495 * found one for it, the full name is placed in the path slot.
1510 } else if (gn->path == NULL) {
1530 * Put the found file in gn->path
1533 gn->path = bmake_strdup(fullName);
1547 fullName = gn->path;
1566 if (fullName != gn->path)
1574 if (fullName && gn->path == NULL) {
1575 gn->path = fullName;
1585 * Add the given name to the end of the given path. The order of
1590 * path the path to which the directory should be
1603 Dir_AddDir(Lst path, const char *name)
1611 ln = Lst_Find(path, name, DirFindName);
1616 (void)Lst_AtFront(path, dotLast);
1620 if (path)
1624 if (path && Lst_Member(path, p) == NULL) {
1626 (void)Lst_AtEnd(path, p);
1655 if (path != NULL)
1656 (void)Lst_AtEnd(path, p);
1668 * Callback function for duplicating a search path via Lst_Duplicate.
1675 * The refCount of the path is incremented.
1691 * path and preceding them by the given flag. Used by the suffix
1697 * path list of directories
1709 Dir_MakeFlags(const char *flag, Lst path)
1718 if (Lst_Open(path) == SUCCESS) {
1719 while ((ln = Lst_Next(path)) != NULL) {
1726 Lst_Close(path);
1736 * for the suffixes module when destroying a search path.
1745 * If no other path references this directory (refCount == 0),
1771 * Clear out all elements of the given search path. This is different
1775 * path Path to clear
1781 * The path is set to the empty list.
1786 Dir_ClearPath(Lst path)
1789 while (!Lst_IsEmpty(path)) {
1790 p = (Path *)Lst_DeQueue(path);
1859 Dir_PrintPath(Lst path)
1861 Lst_ForEach(path, DirPrintDir, NULL);