Lines Matching defs:path

60 static int	ask_basedir(char *path, int nointeract);
61 static char *expand_path(char *path);
63 static char *fixpath_dup(char *path);
70 static int base_sepr = 1; /* separator length btwn basedir & path */
85 #define ERR_RELINABS "Relative path <%s> found in absolute package."
91 #define ERR_AMBDIRS "Cannot evaluate path due to ambiguous " \
108 #define MSG_PROMPT "Enter path to package base directory"
123 set_inst_root(char *path)
134 if (strcmp(install_root, path))
137 ptext(stderr, gettext(ERR_IRSET), path);
140 ptext(stderr, gettext(MSG_IR_REPL), path);
145 if (path && *path) {
146 if (*path != '/') {
147 ptext(stderr, gettext(ERR_IRNOTABS), path);
151 (void) strlcpy(tmp_path, path, sizeof (tmp_path));
173 * This routine returns a path with the correct install_root prepended.
178 fixpath(char *path)
183 if (path && *path) {
186 calloc(1, strlen(path) + install_root_len +
207 if (strcmp(path, "/"))
208 (void) strcpy(npath_ptr, path);
212 * then return the path
214 npath = strdup(path);
217 * If there's no path specified, return the install root
219 * path will have to start.
235 fixpath_dup(char *path)
240 if (path && *path) {
242 npath = pathalloc(strlen(path) + install_root_len + 1);
259 if (strcmp(path, "/"))
260 (void) strcpy(npath_ptr, path);
264 * then return the path
266 npath = pathdup(path);
269 * If there's no path specified, return the install root
271 * path will have to start.
291 * This routine takes path and removes install_root from the path
293 * path or install_root is '/' or path == NULL then path is returned
294 * as is. If the resulting path is somehow relative, a corrupt
296 * function usually returns a pointer into the original path
298 * of course, because the path being returned is guaranteed to
305 orig_path_ptr(char *path)
309 if (path && *path) { /* as long as we got an argument */
311 retv = path; /* path unchanged */
314 * Otherwise, if install_root is really prepended to the path
317 else if (strncmp(path, install_root, install_root_len) == 0) {
318 retv = path + install_root_len;
324 * If the basedir path was built legally, then moving
326 * absolute. If that fails then the path we got was
337 retv = path; /* All else failing, return path. */
347 * new space and provides a new copy of the original basedir path which
351 orig_path(char *path)
355 retv = orig_path_ptr(path);
379 ask_basedir(char *path, int nointeract)
387 path[0] = '\0';
388 if (n = ckpath(path, P_ABSOLUTE|P_DIR|P_WRITE,
393 expand_path(path);
406 char path[PATH_MAX];
445 if (n = ask_basedir(path, nointeract))
488 else if (n = ask_basedir(path, nointeract))
526 * it and the rest of the path.
542 * Make a directory from a path and all necessary directories above it as
550 /* if entire path exists, return o.k. */
556 /* entire path not there - check components and create */
678 expand_path(char *path)
682 if (!path || !*path)
683 return (path);
685 (void) strlcpy(path_buf, path, sizeof (path_buf));
763 * possible path (with install_root and basedir prepended. The pointers
766 * repeated calls and string scans. For example, given a path of
774 * We construct the new path based upon the established environment
775 * and the type of path that was passed. Here are the possibilities:
777 * | | relative path | absolute path |
784 * 1. Prepend the basedir to the path (the basedir is guaranteed to exist
787 * 2. Prepend the install_root (not the basedir) to the path
789 * 3. Return the path as unchanged.
794 eval_path(char **server_ptr, char **client_ptr, char **map_ptr, char *path)
803 * path to the start of the relative path. Note that we
805 * basedir and the path with the '+ 1'. If there is a
806 * relative path, then there is always a basedir. The
814 * This is the position of the client-relative path
816 * directory or the absolute path. Once the basedir has
817 * been afixed, the path is absolute. For that reason,
818 * the client path is the same thing as the original path
832 if (RELATIVE(path)) {
838 path_size = orig_offset_rel + strlen(path);
850 rel_fmt[base_sepr], basedir, path);
852 ptext(stderr, gettext(ERR_RELINABS), path);
856 *server_ptr = fixpath_dup(path);