Lines Matching refs:p
28 int path_split_and_make_absolute(const char *p, char ***ret) { in path_split_and_make_absolute() argument
32 assert(p); in path_split_and_make_absolute()
35 l = strv_split(p, ":"); in path_split_and_make_absolute()
49 char *path_make_absolute(const char *p, const char *prefix) { in path_make_absolute() argument
50 assert(p); in path_make_absolute()
55 if (path_is_absolute(p) || isempty(prefix)) in path_make_absolute()
56 return strdup(p); in path_make_absolute()
58 return path_join(prefix, p); in path_make_absolute()
79 int path_make_absolute_cwd(const char *p, char **ret) { in path_make_absolute_cwd() argument
83 assert(p); in path_make_absolute_cwd()
89 if (path_is_absolute(p)) in path_make_absolute_cwd()
90 c = strdup(p); in path_make_absolute_cwd()
98 c = path_join(cwd, p); in path_make_absolute_cwd()
112 char *p; in path_make_relative() local
179 for (p = result; n_parents > 0; n_parents--) in path_make_relative()
180 p = mempcpy(p, "../", 3); in path_make_relative()
184 *(--p) = '\0'; in path_make_relative()
189 strcpy(p, t); in path_make_relative()
200 char* path_startswith_strv(const char *p, char **set) { in path_startswith_strv() argument
204 t = path_startswith(p, *s); in path_startswith_strv()
345 for (const char *p = f;;) { in path_simplify() local
348 r = path_find_first_component(&p, true, &e); in path_simplify()
357 memmove(f, p, strlen(p) + 1); in path_simplify()
393 const char *p, *q; in path_startswith_full() local
396 r = path_find_first_component(&path, accept_dot_dot, &p); in path_startswith_full()
405 return (char*) (p ?: path); in path_startswith_full()
410 if (!strneq(p, q, r)) in path_startswith_full()
496 const char *p; in path_extend_internal() local
520 while ((p = va_arg(ap, char*)) != POINTER_MAX) { in path_extend_internal()
523 if (isempty(p)) in path_extend_internal()
526 add = 1 + strlen(p); in path_extend_internal()
552 while ((p = va_arg(ap, char*)) != POINTER_MAX) { in path_extend_internal()
553 if (isempty(p)) in path_extend_internal()
556 if (!slash && p[0] != '/') in path_extend_internal()
559 q = stpcpy(q, p); in path_extend_internal()
560 slash = endswith(p, "/"); in path_extend_internal()
636 const char *p = NULL; in find_executable_full() local
646 p = getenv("PATH"); in find_executable_full()
647 if (!p) in find_executable_full()
648 p = DEFAULT_PATH; in find_executable_full()
676 … r = extract_first_word(&p, &element, ":", EXTRACT_RELAX|EXTRACT_DONT_COALESCE_SEPARATORS); in find_executable_full()
740 _cleanup_free_ char *p = NULL, *d = NULL; in executable_is_good() local
743 r = find_executable(executable, &p); in executable_is_good()
751 r = readlink_malloc(p, &d); in executable_is_good()
796 static const char *skip_slash_or_dot(const char *p) { in skip_slash_or_dot() argument
797 for (; !isempty(p); p++) { in skip_slash_or_dot()
798 if (*p == '/') in skip_slash_or_dot()
800 if (startswith(p, "./")) { in skip_slash_or_dot()
801 p++; in skip_slash_or_dot()
806 return p; in skip_slash_or_dot()
809 int path_find_first_component(const char **p, bool accept_dot_dot, const char **ret) { in path_find_first_component() argument
813 assert(p); in path_find_first_component()
848 q = *p; in path_find_first_component()
852 *p = first; in path_find_first_component()
858 *p = first + 1; in path_find_first_component()
874 *p = next + streq(next, "."); in path_find_first_component()
1106 bool filename_is_valid(const char *p) { in filename_is_valid() argument
1109 if (isempty(p)) in filename_is_valid()
1112 if (dot_or_dot_dot(p)) in filename_is_valid()
1115 e = strchrnul(p, '/'); in filename_is_valid()
1119 if (e - p > NAME_MAX) /* NAME_MAX is counted *without* the trailing NUL byte */ in filename_is_valid()
1125 bool path_is_valid_full(const char *p, bool accept_dot_dot) { in path_is_valid_full() argument
1126 if (isempty(p)) in path_is_valid_full()
1129 for (const char *e = p;;) { in path_is_valid_full()
1136 … if (e - p >= PATH_MAX) /* Already reached the maximum length for a path? (PATH_MAX is counted in path_is_valid_full()
1144 bool path_is_normalized(const char *p) { in path_is_normalized() argument
1145 if (!path_is_safe(p)) in path_is_normalized()
1148 if (streq(p, ".") || startswith(p, "./") || endswith(p, "/.") || strstr(p, "/./")) in path_is_normalized()
1151 if (strstr(p, "//")) in path_is_normalized()