Lines Matching refs:path
36 #include "path-util.h"
48 int path_get_parent(const char *path, char **_r) {
53 assert(path);
56 if (!*path)
59 for (e = path; *e; e++) {
77 if (p == path)
80 r = strndup(path, p-path);
92 /* Makes every item in the list an absolute path by prepending
128 * the path. This works in place and won't rollback any
185 /* canonicalized path goes outside of
186 * prefix, keep the original path instead */
216 char *path_kill_slashes(char *path) {
226 for (f = path, t = path; *f; f++) {
244 if (t == path && slash)
248 return path;
251 char* path_startswith(const char *path, const char *prefix) {
252 assert(path);
255 if ((path[0] == '/') != (prefix[0] == '/'))
261 path += strspn(path, "/");
265 return (char*) path;
267 if (*path == 0)
270 a = strcspn(path, "/");
276 if (memcmp(path, prefix, a) != 0)
279 path += a;
290 /* A relative path and an abolute path must not compare as equal.
292 * Here a relative path is ordered before an absolute path. */
335 char path[strlen("/proc/self/fdinfo/") + DECIMAL_STR_MAX(int)];
342 xsprintf(path, "/proc/self/fdinfo/%i", fd);
348 xsprintf(path, "/proc/self/fdinfo/%i", subfd);
351 r = read_full_file(path, &fdinfo, NULL);
543 char *prefix_root(const char *root, const char *path) {
547 /* If root is passed, prefixes path with it. Otherwise returns
550 assert(path);
552 /* First, drop duplicate prefixing slashes from the path */
553 while (path[0] == '/' && path[1] == '/')
554 path++;
557 return strdup(path);
559 l = strlen(root) + 1 + strlen(path) + 1;
570 if (path[0] != '/')
573 strcpy(p, path);