Lines Matching refs:path

106   PathName *path;         /* The pathname being matched */
112 /* expanding a path. */
123 static char *ef_expand_special(ExpandFile *ef, const char *path, int pathlen);
184 ef->path = NULL;
211 ef->path = _new_PathName();
212 if(!ef->path)
263 ef->path = _del_PathName(ef->path);
322 * path char * The path name to be expanded.
323 * pathlen int The length of the suffix of path[] that
326 * path string should be used. Note that
328 * path[] must contain a '\0' terminated
348 FileExpansion *ef_expand_file(ExpandFile *ef, const char *path, int pathlen)
352 const char *pptr; /* A pointer into path[] */
353 int wild; /* True if the path contains any wildcards */
357 if(!ef || !path) {
359 _err_record_msg(ef->err, "ef_expand_file: NULL path argument",
366 * If the caller specified that the whole of path[] be matched,
369 if(pathlen < 0 || pathlen > strlen(path))
370 pathlen = strlen(path);
376 * Preprocess the path, expanding ~/, ~user/ and $envvar references,
377 * using ef->path as a work directory and returning a pointer to
380 path = ef_expand_special(ef, path, pathlen);
381 if(!path)
386 _pn_clear_path(ef->path);
390 for(wild=0,pptr=path; !wild && *pptr; pptr++) {
403 * path into the output array, removing backslash escapes while doing so.
406 if(ef_record_pathname(ef, path, 1))
425 if(strcmp(path, FS_ROOT_DIR) == 0) {
432 if(strncmp(path, FS_ROOT_DIR, FS_ROOT_DIR_LEN) == 0) {
434 if(!_pn_append_to_path(ef->path, FS_ROOT_DIR, -1, 0)) {
435 _err_record_msg(ef->err, "Insufficient memory to record path",
439 path += FS_ROOT_DIR_LEN;
450 * Recursively match successive directory components of the path.
452 if(ef_match_relative_pathname(ef, dnode->dr, path, 0)) {
511 pathlen = strlen(ef->path->name);
533 if((separate && _pn_append_to_path(ef->path, FS_DIR_SEP, -1, 0)==NULL) ||
534 _pn_append_to_path(ef->path, file, -1, 0)==NULL) {
535 _err_record_msg(ef->err, "Insufficient memory to record path",
544 if(ef_record_pathname(ef, ef->path->name, 0))
552 } else if(_pu_path_is_dir(ef->path->name) &&
559 if(ef_record_pathname(ef, ef->path->name, 0))
565 DirNode *subdnode = ef_open_dir(ef, ef->path->name);
580 ef->path->name[pathlen] = '\0';
667 _pn_clear_path(ef->path);
1031 * Preprocess a path, expanding ~/, ~user/ and $envvar references, using
1032 * ef->path as a work buffer, then copy the result into a cache entry,
1037 * pathlen int The length of the prefix of path[] to be expanded.
1039 * return char * A pointer to a copy of the output path in the
1043 static char *ef_expand_special(ExpandFile *ef, const char *path, int pathlen)
1045 int spos; /* The index of the start of the path segment that needs */
1046 /* to be copied from path[] to the output pathname. */
1047 int ppos; /* The index of a character in path[] */
1048 char *pptr; /* A pointer into the output path */
1054 _pn_clear_path(ef->path);
1062 int c = path[ppos];
1073 if(spos < ppos && _pn_append_to_path(ef->path, path + spos, ppos-spos, 0)
1075 _err_record_msg(ef->err, "Insufficient memory to expand path",
1089 strncmp(path + ppos, FS_DIR_SEP, FS_DIR_SEP_LEN); envlen++)
1090 ef->envnam[envlen] = path[ppos++];
1117 if(_pn_append_to_path(ef->path, value, -1, 0) == NULL) {
1118 _err_record_msg(ef->err, "Insufficient memory to expand path",
1131 if(spos < ppos && _pn_append_to_path(ef->path, path + spos, ppos-spos, 0)
1133 _err_record_msg(ef->err, "Insufficient memory to expand path", END_ERR_MSG);
1140 pptr = ef->path->name;
1141 if(*pptr == '~' && path[0] != '\\') {
1145 int plen; /* The current length of the path */
1148 * Get the current length of the output path.
1150 plen = strlen(ef->path->name);
1199 if(_pn_resize_path(ef->path, plen - usrlen - 1 - skip + homelen)==NULL) {
1208 memmove(ef->path->name + homelen,
1209 ef->path->name + 1 + usrlen + skip, plen - usrlen - 1 - skip+1);
1214 ef->path->name[i] = homedir[i];
1219 return ef_cache_pathname(ef, ef->path->name, 0);
1223 * Return a description of the last path-expansion error that occurred.
1226 * ef ExpandFile * The path-expansion resource object.