Lines Matching full:path
2 * path.c
3 * filesystem path management
47 if (!strcmp(text, pn->path)) in path_list_contains_entry()
57 * libpkgconf `path` module
60 …* The `path` module provides functions for manipulating lists of paths in a cross-platform manner.…
69 char path[PKGCONF_ITEM_SIZE]; in prepare_path_node() local
71 pkgconf_strlcpy(path, text, sizeof path); in prepare_path_node()
72 pkgconf_path_relocate(path, sizeof path); in prepare_path_node()
79 if (lstat(path, &st) == -1) in prepare_path_node()
84 char *linkdest = realpath(path, pathbuf); in prepare_path_node()
89 if (path_list_contains_entry(path, dirlist, &st)) in prepare_path_node()
93 if (filter && path_list_contains_entry(path, dirlist)) in prepare_path_node()
101 node->path = strdup(path); in prepare_path_node()
118 * Adds a path node to a path list. If the path is already in the list, do nothing.
120 * :param char* text: The path text to add as a path node.
121 * :param pkgconf_list_t* dirlist: The path list to add the path node to.
140 * Prepends a path node to a path list. If the path is already in the list, do nothing.
142 * :param char* text: The path text to add as a path node.
143 * :param pkgconf_list_t* dirlist: The path list to add the path node to.
162 * Splits a given text input and inserts paths into a path list.
164 * :param char* text: The path text to split and add as path nodes.
165 * :param pkgconf_list_t* dirlist: The path list to have the path nodes added to.
167 * :return: number of path nodes added to the path list
196 …* Adds the paths specified in an environment variable to a path list. If the environment varia…
201 * :param pkgconf_list_t* dirlist: The path list to add the path nodes to.
203 * :return: number of path nodes added to the path list
225 * .. c:function:: bool pkgconf_path_match_list(const char *path, const pkgconf_list_t *dirlist)
227 * Checks whether a path has a matching prefix in a path list.
229 * :param char* path: The path to check against a path list.
230 * :param pkgconf_list_t* dirlist: The path list to check the path against.
231 * :return: true if the path list has a matching prefix, otherwise false
235 pkgconf_path_match_list(const char *path, const pkgconf_list_t *dirlist) in pkgconf_path_match_list() argument
239 const char *cpath = path; in pkgconf_path_match_list()
241 pkgconf_strlcpy(relocated, path, sizeof relocated); in pkgconf_path_match_list()
249 if (!strcmp(pnode->path, cpath)) in pkgconf_path_match_list()
261 * Copies a path list to another path list.
263 * :param pkgconf_list_t* dst: The path list to copy to.
264 * :param pkgconf_list_t* src: The path list to copy from.
274 pkgconf_path_t *srcpath = n->data, *path; in pkgconf_path_copy_list() local
276 path = calloc(1, sizeof(pkgconf_path_t)); in pkgconf_path_copy_list()
277 if (path == NULL) in pkgconf_path_copy_list()
280 path->path = strdup(srcpath->path); in pkgconf_path_copy_list()
283 path->handle_path = srcpath->handle_path; in pkgconf_path_copy_list()
284 path->handle_device = srcpath->handle_device; in pkgconf_path_copy_list()
287 pkgconf_node_insert_tail(&path->lnode, path, dst); in pkgconf_path_copy_list()
296 * Copies a path list to another path list.
298 * :param pkgconf_list_t* dst: The path list to copy to.
299 * :param pkgconf_list_t* src: The path list to copy from.
309 pkgconf_path_t *srcpath = n->data, *path; in pkgconf_path_prepend_list() local
311 path = calloc(1, sizeof(pkgconf_path_t)); in pkgconf_path_prepend_list()
312 if (path == NULL) in pkgconf_path_prepend_list()
315 path->path = strdup(srcpath->path); in pkgconf_path_prepend_list()
318 path->handle_path = srcpath->handle_path; in pkgconf_path_prepend_list()
319 path->handle_device = srcpath->handle_device; in pkgconf_path_prepend_list()
322 pkgconf_node_insert(&path->lnode, path, dst); in pkgconf_path_prepend_list()
331 * Releases any path nodes attached to the given path list.
333 * :param pkgconf_list_t* dirlist: The path list to clean up.
345 free(pnode->path); in pkgconf_path_free()
353 normpath(const char *path) in normpath() argument
355 if (!path) in normpath()
358 char *copy = strdup(path); in normpath()
365 *ptr++ = path[ii]; in normpath()
366 if ('/' == path[ii]) in normpath()
369 while ('/' == path[ii]) in normpath()
384 * Relocates a path, possibly calling normpath() on it.
386 * :param char* buf: The path to relocate.
387 * :param size_t buflen: The buffer length the path is contained in.
423 * :return: number of path nodes added to the list