diff --git a/42sh/includes/builtin.h b/42sh/includes/builtin.h index 289c7b09..fd7e5477 100644 --- a/42sh/includes/builtin.h +++ b/42sh/includes/builtin.h @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/14 22:59:57 by jhalford #+# #+# */ -/* Updated: 2017/03/24 15:13:06 by wescande ### ########.fr */ +/* Updated: 2017/03/24 23:17:32 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -17,7 +17,6 @@ # include "libft.h" # include "builtin_read.h" -# define BT_EXPORT_LP (1 << 0) # define BT_ENV_LI (1 << 0) # define BT_ENV_LU (1 << 1) diff --git a/42sh/libft/Makefile b/42sh/libft/Makefile index 30571112..8ab633b5 100644 --- a/42sh/libft/Makefile +++ b/42sh/libft/Makefile @@ -197,6 +197,8 @@ sys/fd_replace.c\ sys/ft_getenv.c\ sys/ft_xattr_count.c\ sys/ft_xattr_print.c\ +sys/is_directory.c\ +sys/open_access.c\ time/ft_mytime_free.c\ time/ft_mytime_get.c\ time/ft_time_isrecent.c diff --git a/42sh/libft/includes/cliopts.h b/42sh/libft/includes/cliopts.h index a4eaff23..ad5687ab 100644 --- a/42sh/libft/includes/cliopts.h +++ b/42sh/libft/includes/cliopts.h @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/14 20:22:56 by jhalford #+# #+# */ -/* Updated: 2017/03/20 15:48:05 by jhalford ### ########.fr */ +/* Updated: 2017/03/24 23:20:58 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/libft/includes/error.h b/42sh/libft/includes/error.h index 896b5bcb..5ea206a9 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/24 15:11:06 by jhalford ### ########.fr */ +/* Updated: 2017/03/25 01:53:21 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -20,7 +20,8 @@ # 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_MSG(s, ...) "{red}%s: " s "{eoc}\n", PROGNAME, ##__VA_ARGS__ +# define ERR_PROTO(u, m) "{red}%s: %s{eoc}\n", u, m +# define ERR_MSG(u, m) ft_dprintf(2, ERR_PROTO(u, m)) # define ERR_SET(n, ...) error_set(n, ##__VA_ARGS__) # define ERRMSG_MAX_SIZE 150 @@ -32,6 +33,9 @@ enum e_errors E_CO_MULT, E_CO_MISS, E_CO_MISSL, + E_SYS_NOFILE, + E_SYS_ISDIR, + E_SYS_NOPERM, E_MAX, }; diff --git a/42sh/libft/includes/libft.h b/42sh/libft/includes/libft.h index c9baf04d..8e43ec5a 100644 --- a/42sh/libft/includes/libft.h +++ b/42sh/libft/includes/libft.h @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/07 13:49:04 by jhalford #+# #+# */ -/* Updated: 2017/03/24 20:08:29 by jhalford ### ########.fr */ +/* Updated: 2017/03/25 01:35:38 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -19,8 +19,12 @@ # include # include # include -# include -# include + +typedef struct s_stos t_stos; +typedef struct s_stof t_stof; +typedef struct s_itof t_itof; +typedef long long t_flag; +typedef long long t_type; # include "error.h" # include "color.h" @@ -37,10 +41,6 @@ # include "get_next_line.h" # include "sys.h" -typedef struct s_stos t_stos; -typedef struct s_stof t_stof; -typedef struct s_itof t_itof; - struct s_stos { char *key; diff --git a/42sh/libft/includes/sys.h b/42sh/libft/includes/sys.h index 972805ae..c7a046cb 100644 --- a/42sh/libft/includes/sys.h +++ b/42sh/libft/includes/sys.h @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/14 17:24:23 by jhalford #+# #+# */ -/* Updated: 2017/03/21 16:33:01 by jhalford ### ########.fr */ +/* Updated: 2017/03/25 01:42:01 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -24,10 +24,18 @@ # include # include +# include +# include +# include int ft_xattr_print(char *path); int ft_xattr_count(char *path); + char *ft_getenv(char **env, char *key); + +int open_access(char *file, t_flag a_flag, t_flag o_flag, t_flag o_perm); +int is_directory(const char *path); + int dup2_close(int fd1, int fd2); int fd_replace(int fd1, int fd2); diff --git a/42sh/libft/src/cliopts/cliopts_get.c b/42sh/libft/src/cliopts/cliopts_get.c index 0576d5df..12c317f1 100644 --- a/42sh/libft/src/cliopts/cliopts_get.c +++ b/42sh/libft/src/cliopts/cliopts_get.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/14 20:04:04 by jhalford #+# #+# */ -/* Updated: 2017/03/24 15:02:26 by jhalford ### ########.fr */ +/* Updated: 2017/03/25 00:03:30 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -96,11 +96,8 @@ int cliopts_get(char **av, t_cliopts opt_map[], void *data) av++; while (av && *av) { - if (ft_strcmp(*av, "--") == 0) - { - av++; + if (ft_strcmp(*av, "-") == 0 || (ft_strcmp(*av, "--") == 0 && av++)) break ; - } else if ((*av)[0] == '-' && (*av)[1] == '-') { if (cliopts_parse_long(&av, opt_map, data)) diff --git a/42sh/libft/src/error/error.c b/42sh/libft/src/error/error.c index 1f8b980d..6900c094 100644 --- a/42sh/libft/src/error/error.c +++ b/42sh/libft/src/error/error.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/14 16:47:00 by jhalford #+# #+# */ -/* Updated: 2017/03/24 16:22:55 by gwojda ### ########.fr */ +/* Updated: 2017/03/25 01:53:25 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,12 +14,15 @@ char g_error_msglist[E_MAX][ERRMSG_MAX_SIZE] = { - "no error", + "unknown error 0", "invalid option -%c", "invalid option --%s", "option '%c' awaits argument(s): please don't combine", "option '%c': missing argument", "option '%s': missing argument", + "%s: no such file or directory", + "%s: Is a directory", + "%s: Permission denied", }; int g_errnum = 0; @@ -39,7 +42,7 @@ int error_set(int n, ...) int ft_perror(char *utility) { - ft_dprintf(2, "{red}%s: %s{eoc}\n", utility ? utility : g_argv[0], - g_errmsg); + utility = utility ? utility : g_argv[0]; + ERR_MSG(utility, g_errmsg); return (g_errnum); } diff --git a/42sh/libft/src/sys/is_directory.c b/42sh/libft/src/sys/is_directory.c new file mode 100644 index 00000000..accd92a4 --- /dev/null +++ b/42sh/libft/src/sys/is_directory.c @@ -0,0 +1,21 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* is_directory.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2017/03/25 01:40:31 by jhalford #+# #+# */ +/* Updated: 2017/03/25 01:42:02 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +int is_directory(const char *path) +{ + struct stat path_stat; + + stat(path, &path_stat); + return (S_ISDIR(path_stat.st_mode)); +} diff --git a/42sh/libft/src/sys/open_access.c b/42sh/libft/src/sys/open_access.c new file mode 100644 index 00000000..90790a31 --- /dev/null +++ b/42sh/libft/src/sys/open_access.c @@ -0,0 +1,38 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* open_access.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2017/03/25 01:10:56 by jhalford #+# #+# */ +/* Updated: 2017/03/25 01:53:59 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft.h" + +int is_directory(const char *path) +{ + struct stat path_stat; + + stat(path, &path_stat); + return (S_ISDIR(path_stat.st_mode)); +} + +int open_access(char *file, t_flag a_flag, t_flag o_flag, t_flag o_perm) +{ + int fd; + + if (access(file, F_OK) != 0) + return (-ERR_SET(E_SYS_NOFILE, file)); + if (is_directory(file)) + return (-ERR_SET(E_SYS_ISDIR, file)); + if (access(file, a_flag) != 0) + return (-ERR_SET(E_SYS_NOPERM, file)); + if ((fd = open(file, o_flag, o_perm)) < 0) + { + exit(1); + } + return (fd); +} diff --git a/42sh/src/builtin/builtin_cd.c b/42sh/src/builtin/builtin_cd.c index 69228787..b0e75244 100644 --- a/42sh/src/builtin/builtin_cd.c +++ b/42sh/src/builtin/builtin_cd.c @@ -6,48 +6,44 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/03 11:57:53 by jhalford #+# #+# */ -/* Updated: 2017/03/24 23:12:30 by jhalford ### ########.fr */ +/* Updated: 2017/03/25 00:52:32 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ #include "minishell.h" -#define CD_OPT_L (1 << 0) -#define CD_OPT_P (1 << 1) -#define HAS_CDOPT_P(x) (x & CD_OPT_P) -#define HAS_CDOPT_L(x) (x & CD_OPT_L) -#define CDERR_1 "cd: no such file or directory: %s" -#define CDERR_2 "cd: HOME not set" -#define CDERR_3 "cd: too many arguments{eoc}" +#define BT_CD_L (1 << 0) +#define BT_CD_P (1 << 1) +#define CD_USAGE "usage: cd [-L|-P] [dir]" +#define CDERR_1 "cd: no such file or directory: %s" +#define CDERR_2 "cd: %s not set" +#define CDERR_3 "cd: too many arguments" static t_cliopts g_cdopts[] = { - {'P', NULL, CD_OPT_P, CD_OPT_L, NULL}, - {'L', NULL, CD_OPT_L, CD_OPT_P, NULL}, + {'P', NULL, BT_CD_P, BT_CD_L, NULL}, + {'L', NULL, BT_CD_L, BT_CD_P, NULL}, {0, NULL, 0, 0, NULL}, }; -static char *builtin_cd_special(char *const av[], char *const env[]) +static char *bt_cd_target(char *arg) { char *target; - if (!*av) + if (!arg) { - if (!(target = ft_getenv((char**)env, "HOME"))) - { - SH_ERR(CDERR_2); - return (NULL); - } + if (!(target = ft_getenv(data_singleton()->env, "HOME"))) + SH_ERR(CDERR_2, "HOME"); } - else if (*av && *(av + 1)) + else if (ft_strcmp(arg, "-") == 0) { - SH_ERR(CDERR_3); - return (NULL); + DG("doing -"); + if (!(target = ft_getenv(data_singleton()->env, "OLDPWD"))) + SH_ERR(CDERR_2, "OLDPWD"); + DG("found OLDPWD %s", target); } - else if (ft_strcmp(*av, "-") == 0) - target = ft_strdup(ft_getenv((char**)env, "OLDPWD")); else - target = *av; + target = arg; return (target); } @@ -56,7 +52,7 @@ void setwd(char *var) char *cwd; cwd = getcwd(NULL, 0); - builtin_setenv(NULL, (char*[4]){"setenv", var, cwd, NULL}, NULL); + builtin_setenv(NULL, (char*[]){"cd", var, cwd, NULL}, NULL); free(cwd); } @@ -66,24 +62,20 @@ int builtin_cd(const char *path, char *target; t_data_template data; - (void)envp; (void)path; - data.flag = CD_OPT_L; + (void)envp; + data.flag = BT_CD_L; if (cliopts_get((char**)av, g_cdopts, &data)) + return (ft_perror("cd") && SH_ERR(CD_USAGE)); + if (data.av_data[0] && data.av_data[1]) + return (SH_ERR(CDERR_3) && SH_ERR(CD_USAGE)); + if (!(target = bt_cd_target(*data.av_data))) return (1); - /* i = builtin_cd_opts(av, &opts); */ setwd("OLDPWD"); - if (!(target = builtin_cd_special(data.av_data, envp))) - return (1); if (chdir(target)) - { - SH_ERR(CDERR_1, target); - return (1); - } + return (SH_ERR(CDERR_1, target)); else if (target != *data.av_data) ft_printf("%s\n", target); setwd("PWD"); - if (!ft_strcmp(*data.av_data, "-")) - free(target); return (0); } diff --git a/42sh/src/builtin/builtin_export.c b/42sh/src/builtin/builtin_export.c index 5776023a..04021737 100644 --- a/42sh/src/builtin/builtin_export.c +++ b/42sh/src/builtin/builtin_export.c @@ -6,12 +6,15 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/15 11:39:37 by gwojda #+# #+# */ -/* Updated: 2017/03/24 23:32:04 by ariard ### ########.fr */ +/* Updated: 2017/03/25 00:57:26 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ #include "minishell.h" +#define BT_EXPORT_LP (1 << 0) +#define EXPORT_USAGE "usage: export [name[=value] ...] or export -p" + static t_cliopts g_export_opts[] = { {'p', NULL, BT_EXPORT_LP, 0, NULL}, @@ -44,7 +47,7 @@ int builtin_export( (void)path; data.flag = 0; if (cliopts_get((char**)av, g_export_opts, &data)) - return (ft_perror("export") ? 1 : 1); + return (ft_perror("export") && SH_ERR(EXPORT_USAGE)); if (data.flag & BT_EXPORT_LP) return (bt_export_print()); av = data.av_data; diff --git a/42sh/src/builtin/builtin_read.c b/42sh/src/builtin/builtin_read.c index c250a9b5..899b4f80 100644 --- a/42sh/src/builtin/builtin_read.c +++ b/42sh/src/builtin/builtin_read.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/20 15:01:45 by jhalford #+# #+# */ -/* Updated: 2017/03/24 16:23:51 by gwojda ### ########.fr */ +/* Updated: 2017/03/24 23:30:45 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/builtin/builtin_setenv.c b/42sh/src/builtin/builtin_setenv.c index b360b052..3f79f8e2 100644 --- a/42sh/src/builtin/builtin_setenv.c +++ b/42sh/src/builtin/builtin_setenv.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/28 14:25:17 by jhalford #+# #+# */ -/* Updated: 2017/03/24 23:12:59 by jhalford ### ########.fr */ +/* Updated: 2017/03/24 23:14:52 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/builtin/is_builtin.c b/42sh/src/builtin/is_builtin.c index dd931eba..a86f6cd6 100644 --- a/42sh/src/builtin/is_builtin.c +++ b/42sh/src/builtin/is_builtin.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/13 13:09:57 by jhalford #+# #+# */ -/* Updated: 2017/03/24 15:12:42 by wescande ### ########.fr */ +/* Updated: 2017/03/24 23:29:53 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/exec/redirect_dgreat.c b/42sh/src/exec/redirect_dgreat.c index b1164f94..3e448fd8 100644 --- a/42sh/src/exec/redirect_dgreat.c +++ b/42sh/src/exec/redirect_dgreat.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/06 22:07:37 by jhalford #+# #+# */ -/* Updated: 2017/03/20 18:15:39 by gwojda ### ########.fr */ +/* Updated: 2017/03/25 01:54:05 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -18,9 +18,9 @@ int redirect_dgreat(t_redir *redir) int fdnew; fdnew = redir->n; - if ((fdold = open(redir->word, + if ((fdold = open_access(redir->word, R_OK, O_WRONLY | O_CREAT | O_APPEND, 0644)) < 0) - exit(1); + return (ft_perror(NULL)); dup2(fdold, fdnew); return (0); } diff --git a/42sh/src/exec/redirect_dless.c b/42sh/src/exec/redirect_dless.c index 54aef89a..d8063a57 100644 --- a/42sh/src/exec/redirect_dless.c +++ b/42sh/src/exec/redirect_dless.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/20 12:36:10 by jhalford #+# #+# */ -/* Updated: 2017/03/20 12:36:15 by jhalford ### ########.fr */ +/* Updated: 2017/03/25 01:45:49 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/exec/redirect_great.c b/42sh/src/exec/redirect_great.c index 0e0249c6..20ae5822 100644 --- a/42sh/src/exec/redirect_great.c +++ b/42sh/src/exec/redirect_great.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/06 22:03:53 by jhalford #+# #+# */ -/* Updated: 2017/03/24 23:28:30 by ariard ### ########.fr */ +/* Updated: 2017/03/25 01:49:35 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -18,12 +18,9 @@ int redirect_great(t_redir *redir) int fdnew; fdnew = redir->n; - if ((fdold = open(redir->word, + if ((fdold = open_access(redir->word, R_OK, O_WRONLY | O_CREAT | O_TRUNC, 0644)) < 0) - { - SH_ERR("open(): %s", strerror(errno)); - exit(1); - } + return (ft_perror(NULL)); fd_replace(fdold, fdnew); return (0); } diff --git a/42sh/src/exec/redirect_greatand.c b/42sh/src/exec/redirect_greatand.c index d5e2e573..10c979ac 100644 --- a/42sh/src/exec/redirect_greatand.c +++ b/42sh/src/exec/redirect_greatand.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/06 22:12:31 by jhalford #+# #+# */ -/* Updated: 2017/03/21 17:41:36 by jhalford ### ########.fr */ +/* Updated: 2017/03/25 00:58:22 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/exec/redirect_less.c b/42sh/src/exec/redirect_less.c index 6c4e5c25..d38e079b 100644 --- a/42sh/src/exec/redirect_less.c +++ b/42sh/src/exec/redirect_less.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/06 22:09:53 by jhalford #+# #+# */ -/* Updated: 2017/03/20 12:36:55 by jhalford ### ########.fr */ +/* Updated: 2017/03/25 01:52:33 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -18,12 +18,9 @@ int redirect_less(t_redir *redir) int fdnew; fdnew = redir->n; - if ((fdold = open(redir->word, O_RDONLY)) < 0) - { - ft_dprintf(2, "{red}%s: %s: no such file or directory\n", - SHELL_NAME, redir->word); - return (1); - } + if ((fdold = open_access(redir->word, W_OK, + O_RDONLY, 0)) != 0) + return (ft_perror(NULL)); dup2(fdold, fdnew); return (0); } diff --git a/42sh/src/glob/dir_glob.c b/42sh/src/glob/dir_glob.c index d7736c1c..97673350 100644 --- a/42sh/src/glob/dir_glob.c +++ b/42sh/src/glob/dir_glob.c @@ -6,20 +6,12 @@ /* By: wescande +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/30 12:07:16 by wescande #+# #+# */ -/* Updated: 2017/03/22 21:59:49 by wescande ### ########.fr */ +/* Updated: 2017/03/25 01:39:50 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ #include "minishell.h" -int is_directory(const char *path) -{ - struct stat path_stat; - - stat(path, &path_stat); - return (S_ISDIR(path_stat.st_mode)); -} - static void dir_list_content(t_glob *gl, char **str, char *pat, int recursive) { diff --git a/42sh/src/job_control/builtin_jobs.c b/42sh/src/job_control/builtin_jobs.c index a23b8184..be9419c5 100644 --- a/42sh/src/job_control/builtin_jobs.c +++ b/42sh/src/job_control/builtin_jobs.c @@ -6,12 +6,14 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/15 17:43:01 by jhalford #+# #+# */ -/* Updated: 2017/03/24 18:48:46 by jhalford ### ########.fr */ +/* Updated: 2017/03/25 00:58:09 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ #include "minishell.h" +#define JOBS_USAGE "usage: jobs [-l] [id ...]" + t_cliopts g_jobs_opts[] = { {'l', NULL, JOBS_OPT_L, 0, NULL}, @@ -67,14 +69,11 @@ int builtin_jobs(const char *path, char *const av[], char *const envp[]) (void)path; (void)envp; if (!SH_HAS_JOBC(data_singleton()->opts)) - { - DG("no job control :("); return (SH_ERR("jobs: %s", SH_MSG_NOJOBC)); - } do_job_notification(); ft_bzero(&data, sizeof(t_data_template)); if (cliopts_get((char**)av, g_jobs_opts, &data)) - return (ft_perror("jobs")); + return (ft_perror("jobs") && SH_ERR(JOBS_USAGE)); if (!*data.av_data) bt_jobs_all(data.flag); else if (bt_jobs_spec(data.av_data, data.flag))