Lines Matching defs:path

67  * the builtin path-completion callback function to modify its behavior.
71 PathCache *pc; /* The path-list cache in which to look up the executables */
93 * whenever the path is scanned and whenever the check_fn() callback
123 PathNode *next; /* The next directory in the path */
136 * Append a new node to the list of directories in the path.
156 /* path, or NULL if no path has been scanned yet. */
158 /* path, or NULL if no path has been scanned yet. */
159 PathName *path; /* The fully qualified name of a file */
186 static int pca_extract_dir(PathCache *pc, const char *path,
234 * If there is a tilde expression at the beginning of the specified path,
235 * place the corresponding home directory into pc->path. Otherwise
236 * just clear pc->path.
238 static int pca_expand_tilde(PathCache *pc, const char *path, int pathlen,
289 pc->path = NULL;
323 pc->path = _new_PathName();
324 if(!pc->path)
372 * Delete the memory of the list of path nodes.
389 pc->path = _del_PathName(pc->path);
457 * Return a description of the last path-caching error that occurred.
479 * Return all path-nodes to the freelist.
500 * path const char * A colon-separated list of directory
510 int pca_scan_path(PathCache *pc, const char *path)
512 const char *pptr; /* A pointer to the next unprocessed character in path[] */
525 * If no path list was provided, there is nothing to be added to the
528 if(!path)
531 * Extract directories from the path list, expanding tilde expressions
532 * on the fly into pc->pathname, then add them to the list of path
536 pptr = path;
539 * Extract the next pathname component into pc->path->name.
548 if(add_PathNode(pc, pc->path->name))
568 * Extract the next directory path from a colon-separated list of
573 * path const char * A pointer to the start of the next component
574 * in the path list.
577 * in path[] will be assigned to *nextp.
579 * return int 0 - OK. The extracted path is in pc->path->name.
583 static int pca_extract_dir(PathCache *pc, const char *path, const char **nextp)
585 const char *pptr; /* A pointer into path[] */
586 const char *sptr; /* The path following tilde expansion */
589 * If there is a tilde expression at the beginning of the specified path,
590 * place the corresponding home directory into pc->path. Otherwise
591 * just clear pc->path.
593 if(pca_expand_tilde(pc, path, strlen(path), 0, &pptr))
596 * Keep a record of the current location in the path.
607 * Append the rest of the directory path to the pathname buffer.
609 if(_pn_append_to_path(pc->path, sptr, pptr - sptr, 1) == NULL) {
616 * path name, make sure that the recorded directory name ends in a
620 int dirlen = strlen(pc->path->name);
622 strncmp(pc->path->name + dirlen - FS_DIR_SEP_LEN, FS_DIR_SEP,
624 if(_pn_append_to_path(pc->path, FS_DIR_SEP, FS_DIR_SEP_LEN, 0) == NULL) {
632 * Skip the separator unless we have reached the end of the path.
637 * Return the unprocessed tail of the path-list string.
799 * path.
906 _pn_clear_path(pc->path);
907 if(_pn_append_to_path(pc->path, " ", 1, 0) == NULL ||
908 _pn_append_to_path(pc->path, filename, -1, 1) == NULL) {
916 copy = _sg_store_string(mem->sg, pc->path->name, 0);
1015 PathNode *node; /* A node in the list of directories in the path */
1039 _pn_append_to_path(pc->path, nptr, name_len - (nptr-name),
1042 return pc->path->name;
1045 * Look up the specified filename in each of the directories of the path,
1046 * in the same order that they were listed in the path, and stop as soon
1065 _pn_clear_path(pc->path);
1066 if(_pn_append_to_path(pc->path, name, name_len, !literal) == NULL)
1071 match = (char **)bsearch(pc->path->name, node->files, node->nfile,
1078 if(_pn_prepend_to_path(pc->path, node->dir, -1, 0) == NULL)
1084 ((*match)[0]==PCA_F_ENIGMA && pc->check_fn(pc->data, pc->path->name))){
1086 return pc->path->name;
1219 PathNode *node; /* A node in the list of directories in the path */
1286 * Look up the specified file name in each of the directories of the path,
1287 * in the same order that they were listed in the path, and stop as soon
1306 * pc->path.
1352 _pn_clear_path(pc->path);
1353 if(_pn_append_to_path(pc->path, node->dir, -1, 0) == NULL ||
1354 _pn_append_to_path(pc->path, match+1, -1, 0) == NULL) {
1363 (match[0]==PCA_F_ENIGMA && pc->check_fn(pc->data, pc->path->name))) {
1366 * Copy the completion suffix into the work pathname pc->path->name,
1375 if(cpl_add_completion(cpl, line, word_start, word_end, pc->path->name,
1413 cpl_add_completion(cpl, line, word_start, word_end, pc->path->name,
1417 * The prefix in pc->path->name will have been overwritten by
1430 * Using the work buffer pc->path, make a suitably escaped copy of a
1454 _pn_clear_path(pc->path);
1470 * Arrange for the output path buffer to have sufficient room for the
1473 if(_pn_resize_path(pc->path, suffix_len + nbsl) == NULL) {
1483 strlcpy(pc->path->name, suffix, pc->path->dim);
1490 char *dst = pc->path->name;
1511 * return int 0 - Doesn't start with a path name.
1512 * 1 - Does start with a path name.
1547 * If needed make a new copy of the prefix being matched, in pc->path->name,
1568 _pn_clear_path(pc->path);
1569 if(_pn_append_to_path(pc->path, prefix, prefix_len, 1) == NULL) {
1574 return pc->path->name;
1618 * Expand any ~user expression found at the start of a path, leaving
1619 * either an empty string in pc->path if there is no ~user expression,
1624 * path const char * The path to expand.
1625 * pathlen int The max number of characters to look at in path[].
1630 * path[] will be assigned to *endp.
1636 static int pca_expand_tilde(PathCache *pc, const char *path, int pathlen,
1639 const char *pptr = path; /* A pointer into path[] */
1644 _pn_clear_path(pc->path);
1667 if(_pn_append_to_path(pc->path, homedir, -1, 0) == NULL) {
1682 (pptr-path) + FS_DIR_SEP_LEN < pathlen &&
1702 PathNode *node; /* A node in the list of directories in the path */
1705 * Traverse the absolute directories of the path, clearing the