Minishell
sansho88 / minishell Goto Github PK
View Code? Open in Web Editor NEWMinishell project of 42 Lyon
Minishell project of 42 Lyon
Minishell
Set a proper error message when a command doesn't exist
all in title
Tqt tqt
in bash :
declare -x OLDPWD
declare -x PWD="/Users/rgeral/Desktop/Projets42 /Minishell2"
declare -x SHLVL="1"
should be parsed as : ls > test
test : ls | ls | ls | ls | ls | ls | ls | ls | ls | ls |ls | ls | ls | ls | ls |ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | v ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls |ls | ls | ls | ls | ls |ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | v ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls | ls
Segfault when pressing up arrow.
We can use a normal path and an absolute path (like /tmp)
In [t_argmode *split_arg_redirect(char *cmdline, int *argc)] function, in parse_redirecs.c file.
When there's a redirection detected in the command line, t_argmode.arg = null (check "ft_fill_argmode_array" ? )
To fix:
Attended:
bash-3.2$ cat
^C
bash-3.2$ echo $?
130
Actually:
[Conchito ✗]echo $?
/Users/tgriffit/.brew/bin:/Users/tgriffit/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/munki:/opt/X11/bin?
When detected, our "echo" built-ins have to be used, and the -nnnnnnnnnnnnn option should works as a simple -n.
I swapped the Env from "custom_env" to data.env in the main, now env is working : (old ones in "//"
` int main(int argc, char *argv[], char *env[])
{
char *commandline;
t_argmode *args;
t_args data;
int nb_args;
//char **custom_env;
commandline = ft_strdup("empty");
get_signals();
//custom_env = init_env(env);
data.env = init_env(env);
while (commandline && ft_strncmp(commandline, "exit", 5))
{
free(commandline);
sign_chars_manager(false);
commandline = readline(CONCHITO);
sign_chars_manager(true);
if (!commandline)
exit(0);
add_history(commandline);
//dprintf(2, "[%s]command line = %s\n", __func__, commandline);
rl_redisplay();
if (*commandline && is_cmdline_ok(&commandline, data.env))
{
nb_args = (int)get_nb_seps(commandline) + 1; //forcement au moins 1 arg
args = create_targmode_array(commandline);
//debug_t_argmode(args, nb_args);
if (are_args_ok(args, nb_args))
exec_home(args, nb_args, &data);
}
}
exit(0);
}`
I let you swap it if you are ok with it on the main.
We need an env that doesn't reset at each command !
I need the parsing to give me a stable env that does't back to the "vanilla" env each time we put a command.
In the heredoc :
"cat << eof"
Check on debug printf.
I have no "cat" on the arguments that the parsing supposed to send to exec. <3
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.