diff --git a/42sh/includes/minishell.h b/42sh/includes/minishell.h index c8766637..b3ead229 100644 --- a/42sh/includes/minishell.h +++ b/42sh/includes/minishell.h @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/10 13:07:44 by jhalford #+# #+# */ -/* Updated: 2017/03/21 02:11:31 by wescande ### ########.fr */ +/* Updated: 2017/03/21 14:03:00 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -33,6 +33,9 @@ # include "hash.h" /* # define malloc(x) NULL */ +# define SH_MSG(s, ...) "{red}%s: " s "{eoc}\n", g_argv[0], ##__VA_ARGS__ +# define SH_ERR(s, ...) ft_dprintf(STDERR, SH_MSG(s, ##__VA_ARGS__)) + #ifndef DEBUG # define DEBUG_MODE 0 #else diff --git a/42sh/libft/includes/error.h b/42sh/libft/includes/error.h index 50f0976f..572c8300 100644 --- a/42sh/libft/includes/error.h +++ b/42sh/libft/includes/error.h @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/14 15:34:21 by jhalford #+# #+# */ -/* Updated: 2017/03/20 15:48:46 by jhalford ### ########.fr */ +/* Updated: 2017/03/21 14:02:59 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -20,7 +20,7 @@ # define DG_ARGS getpid(), getpid(), ft_path_notdir(__FILE__), __LINE__ # define DG(s, ...) ft_dprintf(STDBUG,DG_MSG s "{eoc}\n",DG_ARGS,##__VA_ARGS__) -# define ERR_PROTO(s, ...) "{red}%s: " s "{eoc}\n", PROGNAME, ##__VA_ARGS__ +# define ERR_MSG(s, ...) "{red}%s: " s "{eoc}\n", PROGNAME, ##__VA_ARGS__ # define ERR_SET(n, ...) error_set(n, ##__VA_ARGS__) # define ERRMSG_MAX_SIZE 150 diff --git a/42sh/src/builtin/builtin_exit.c b/42sh/src/builtin/builtin_exit.c index 573c0004..f00f69b1 100644 --- a/42sh/src/builtin/builtin_exit.c +++ b/42sh/src/builtin/builtin_exit.c @@ -6,13 +6,13 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/28 14:28:41 by jhalford #+# #+# */ -/* Updated: 2017/03/21 13:50:00 by jhalford ### ########.fr */ +/* Updated: 2017/03/21 14:01:32 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ #include "minishell.h" -#define EXITERR_0 SHELL_NAME ": numeric argument required\n" +#define EXITERR_0 "exit: numeric argument required" int builtin_exit(const char *path, char *const av[], char *const envp[]) { @@ -33,7 +33,7 @@ int builtin_exit(const char *path, char *const av[], char *const envp[]) return (0); } if (av && av[1] && !ft_stris(av[1], ft_isdigit)) - error_msg(EXITERR_0); + SH_ERR(EXITERR_0); status = (av && av[1]) ? ft_atoi(av[1]) : ft_atoi(ft_getenv(data_singleton()->env, "?")); if (SH_IS_INTERACTIVE(data_singleton()->opts))