27 if (ft_strchr(cmd,
'/'))
41 char *path_with_slash;
44 path_with_slash = ft_strjoin(dir,
"/");
47 full_path = ft_strjoin(path_with_slash, cmd);
48 free(path_with_slash);
70 if (access(full_path, X_OK) == 0)
93 dirs = ft_split(path_var,
':');
96 while (dirs[i] && !result)
101 ft_free_strarray(dirs);
123 if (access(cmd, F_OK) == 0)
124 return (ft_strdup(cmd));
Environment variable management prototypes.
char * get_env_value(t_env *env_list, char *key)
Look up an environment variable's value by its key.
Executor prototypes for commands, pipes, redirections & heredocs.
char * find_cmd_path(char *cmd, t_env *env)
Resolve a command name into its full executable path.
static int is_direct_path(char *cmd)
Check if a command contains a slash (= direct path)
static char * search_in_path(char *cmd, char *path_var)
Search for a command in all PATH directories.
char * search_in_dir(char *dir, char *cmd)
Search an executable command in a directory.
static char * join_path(char *dir, char *cmd)
Join a directory and command name with a / in between.
Environment variable (doubly linked list)