Commit 69ebbccd authored by komask's avatar komask
Browse files

nearly nothing

parent 2a5e3a34
......@@ -25,10 +25,10 @@ enum e_retcode
FD_ERROR,
_EXEC_ERROR_,
AMBIG_REDIR,
HOME_NOT_SET,
NO_SUCH_FILE,
INVALID_EXP_ID,
INVALID_UNS_ID,
HOME_NOT_SET,
CD_ARG_ERR,
EXIT_ARG_ERR,
_PARSING_ERROR_,
......
......@@ -18,12 +18,20 @@ CTRL-D apres avoir ecrit un debut de cmd
=================> info non accessibles dans le process parent, mettre un flag dans xe pour passer l'info à la commande suivante
continue commands after HOME_NOT_SET and CD_ARG_ERR
"echo | echo pouet"
ou "ls | echo pouet"
masaki:
a la fin avec rgrep:
erreurs de write et de ft_put* a terminer
gestion d'erreurs des fonctions autorisees une a une
alientest: exit pipe
......
......@@ -62,6 +62,8 @@ int print_export(char **env, char **exported)
equalsign_pos = ft_index(variables[i], '=');
if (equalsign_pos != NOT_FOUND && ret == WRITE_SUCCESS)
ret = print_export_one_var(variables[i], equalsign_pos);
else if (ret == WRITE_SUCCESS)
ret = ft_putstr_fd(variables[i], STDOUT_FILENO);
if (ret == SUCCESS || ret == WRITE_SUCCESS)
ret = ft_putchar_fd('\n', STDOUT_FILENO);
if (ret != SUCCESS)
......@@ -215,7 +217,7 @@ static int ft_export_checks(char **args, t_xe *xe)
else
{
xe->stat_loc = 1;
return (INVALID_EXP_ID);
ft_error(INVALID_EXP_ID, xe);
}
args++;
}
......
......@@ -40,7 +40,7 @@ int ft_unset(char **args, t_xe *xe)
else
{
xe->stat_loc = 1;
return (INVALID_UNS_ID);
ft_error(INVALID_UNS_ID, xe);
}
args++;
}
......
......@@ -22,10 +22,10 @@ int exec_error(int err_code, t_xe *xe)
{
const char *err_msg[] = {
"Ambiguous redirection",
"HOME not set",
"No such file or directory",
"No such file or directory", // more specific msg
"export: Variable identifier (name) invalid",
"unset: Variable identifier (name) invalid",
"HOME not set",
"cd: too many arguments",
//"pwd : erreur de détermination du répertoire actuel : getcwd : ne peut accéder aux répertoires parents : Aucun fichier ou dossier de ce type",// -> moved to err_output
"exit: too many arguments"};
......@@ -54,7 +54,7 @@ static int err_output(int err_code)
"cd: cannot set variable PWD",
"pwd: cannot get current directory path",
"Error reading a directory in PATH",
"fd"};
"fd"}; // fd?
ft_putstr_fd("error: ", STDERR_FILENO);
ft_putstr_fd(err_msg[err_code - _ERRNO_MSG_ -1], STDERR_FILENO);
......@@ -69,7 +69,7 @@ int clean_and_exit(int err_code, t_xe *xe)
if (err_code == ARG_ERR)
{
if (ft_putstr_fd("Minishell takes no argument", STDERR_FILENO) != WRITE_SUCCESS)
if (ft_putstr_fd("Minishell takes no argument", STDERR_FILENO) != WRITE_SUCCESS) // takes no argument?
ft_error(WRITE_ERR, xe); // possible?
}
if (err_code < FT_EXIT)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment