diff --git a/include/builtins.h b/include/builtins.h new file mode 100644 index 0000000..97fcc15 --- /dev/null +++ b/include/builtins.h @@ -0,0 +1,30 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* builtins.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: sede-san exit_status); + } + else if (!ft_strisnum(cmd.argv[1])) + { + ft_eputstr("exit: "); + ft_eputendl(cmd.argv[1]); + ft_eputendl(": numeric argument required"); + return (2); + } + else if (cmd.argc > 2) + { + ft_eputendl("exit: too many arguments"); + return (2); + } + else + { + // msh.exit = 1; + // cast to u_int8_t causes to return a value between 0 and 255 + return ((u_int8_t)ft_atol(cmd.argv[1])); + } +} diff --git a/src/builtins/pwd/pwd.c b/src/builtins/pwd/pwd.c new file mode 100644 index 0000000..da97530 --- /dev/null +++ b/src/builtins/pwd/pwd.c @@ -0,0 +1,26 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* pwd.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: sede-san