added a backup path to hash algorithm
This commit is contained in:
parent
634d498b03
commit
27da345e70
8 changed files with 13 additions and 10 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/03/21 16:32:26 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/21 16:40:17 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/21 16:42:19 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/11/28 14:29:17 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/20 14:40:05 by wescande ### ########.fr */
|
||||
/* Updated: 2017/03/21 17:40:31 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/03 13:37:49 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/21 15:11:09 by gwojda ### ########.fr */
|
||||
/* Updated: 2017/03/21 17:40:28 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/11/29 16:04:18 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/21 16:40:13 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/21 17:40:35 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/02/06 22:12:31 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/21 16:35:42 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/21 17:40:36 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,19 +6,22 @@
|
|||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/02/18 11:20:11 by gwojda #+# #+# */
|
||||
/* Updated: 2017/03/19 16:40:25 by wescande ### ########.fr */
|
||||
/* Updated: 2017/03/21 17:40:13 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "minishell.h"
|
||||
|
||||
#define BACKUP_PATH "/bin:/usr/bin"
|
||||
|
||||
char *ft_add_hash(char *cmd)
|
||||
{
|
||||
int id;
|
||||
t_hash hash;
|
||||
char *path;
|
||||
|
||||
if (!(hash.path = ft_findexec(ft_getenv(
|
||||
data_singleton()->env, "PATH"), cmd)))
|
||||
path = ft_getenv(data_singleton()->env, "PATH");
|
||||
if (!(hash.path = ft_findexec(path ? path : BACKUP_PATH, cmd)))
|
||||
return (NULL);
|
||||
hash.key = ft_strdup(cmd);
|
||||
id = ft_hash_str(cmd);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/02/18 11:06:19 by gwojda #+# #+# */
|
||||
/* Updated: 2017/03/19 16:38:12 by wescande ### ########.fr */
|
||||
/* Updated: 2017/03/21 17:40:19 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/02/18 11:08:40 by gwojda #+# #+# */
|
||||
/* Updated: 2017/03/19 16:39:18 by wescande ### ########.fr */
|
||||
/* Updated: 2017/03/21 17:40:20 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue