diff --git a/42sh/Makefile b/42sh/Makefile index 3b26beb7..b5e5ee8b 100644 --- a/42sh/Makefile +++ b/42sh/Makefile @@ -6,7 +6,7 @@ # By: wescande +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2016/08/29 21:32:58 by wescande #+# #+# # -# Updated: 2017/03/03 17:56:12 by jhalford ### ########.fr # +# Updated: 2017/03/03 18:03:59 by jhalford ### ########.fr # # # # **************************************************************************** # diff --git a/42sh/src/main/main.c b/42sh/src/main/main.c index 820abfb9..381d2927 100644 --- a/42sh/src/main/main.c +++ b/42sh/src/main/main.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/06 18:40:58 by jhalford #+# #+# */ -/* Updated: 2017/03/03 17:55:01 by jhalford ### ########.fr */ +/* Updated: 2017/03/03 18:03:53 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -108,7 +108,11 @@ int main(int ac, char **av) shell_init(ac, av); DG("{inv}{bol}{gre}start of shell{eoc} JOBC is %s", SH_HAS_JOBC(data_singleton()->opts)?"ON":"OFF"); - fd = get_input_fd(); + if ((fd = get_input_fd() < 0)) + { + ft_printf("{red}%s: No such file or directory\n{eoc}", SHELL_NAME); + return (1); + } while (handle_instruction(fd) == 0) { // lexer_clean; diff --git a/42sh/src/main/shell_get_avdata.c b/42sh/src/main/shell_get_avdata.c index 6194cbf3..16a34d13 100644 --- a/42sh/src/main/shell_get_avdata.c +++ b/42sh/src/main/shell_get_avdata.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/11 17:14:52 by jhalford #+# #+# */ -/* Updated: 2017/01/19 20:56:05 by ariard ### ########.fr */ +/* Updated: 2017/03/03 17:33:33 by wescande ### ########.fr */ /* */ /* ************************************************************************** */ @@ -21,7 +21,7 @@ char *shell_get_avdata() data = data_singleton(); av = data->argv; i = 1; - while (av[i][0] == '-') + while (av[i] && av[i][0] == '-') { if (ft_strcmp(av[i], "--") == 0) {