9a32220945
redir_parsing: fix memory leak when parsing a redirection with an operator as specifier
...
if the specifier was not WORD_TOKEN, the operator was not being freed
2025-04-16 14:13:01 +02:00
84a246f6f6
parsing: fix redir accepting operators as specifiers
...
before:
$ >>>>>
minishell: syntax error near unexpected token `newline'
after:
$ >>>>>
minishell: syntax error near unexpected token `>>'
>> is now correctly detected as an operator, and not a word
2025-04-16 13:59:14 +02:00
9593851149
parsing: show errors for unexpected newline
...
$ <
minishell: syntax error near unexpected token `newline'
$ >
minishell: syntax error near unexpected token `newline'
$ <<
minishell: syntax error near unexpected token `newline'
$ >>
minishell: syntax error near unexpected token `newline'
2025-04-16 13:16:34 +02:00
e1a1a43041
parsing: refactor cmds_parse into own file
2025-04-16 13:13:55 +02:00
73d691c0b4
parsing: refactor group_or_simple_parse into group_cmd_parse.c
2025-04-16 13:08:50 +02:00
a5103fa733
clean: remove unused paren files
2025-04-16 13:05:34 +02:00
dd30b44b93
parsing: refactor minishell_opt_cmds_parse into own file
2025-04-16 13:03:49 +02:00
ee5811ad63
ignore zms_tester
2025-04-16 12:48:23 +02:00
942217a45a
tests: update tests to reflect new parser
2025-04-15 15:47:18 +02:00
81ba53237c
parsing: do not reset last_return_value at start of parsing
...
we need to preserve it, to be able to show the return value from the last command
2025-04-15 15:45:29 +02:00
1a949bdcab
minishell: reinstante interactive mode
2025-04-15 15:27:20 +02:00
0579d1f2fc
env: correctly handle write errors such as /dev/full
...
The exit status of 125 for env in case of failure is documented in env(1).
2025-04-15 15:19:27 +02:00
ffaf2582a3
pwd: correctly handle write errors
2025-04-15 15:19:27 +02:00
cfc95994de
echo: correctly handle write errors such as /dev/full
2025-04-15 15:19:27 +02:00
871180f6d8
connec_pipe_cmd_execute: setup pipes between commands
2025-04-15 15:19:27 +02:00
81febcfcdd
debug: show command about to be executed in debug mode
2025-04-15 15:19:27 +02:00
204ed35ff4
fix(connec_cmd_execute): do not execute more than one command per process
2025-04-15 15:17:52 +02:00
596b21fc2f
debug, destroy all new types (also some code for testing it)
2025-04-15 15:17:51 +02:00
82da182773
fix: potential buffer overflow caused by missing terminating null byte in t_buffer
...
This only occurs in specific circumstances where the number of bytes to be added
to a t_buffer via the ft_buffer_push_buf function is exactly equal to the number
of free bytes in the current underlying buffer. This does not occur if the
number of bytes to add to the buffer is smaller than that, since we allocate new
space using ft_calloc.
In these circumstances, since no terminating null byte is added, other code may
read past the end of the buffer, causing a buffer overflow.
2025-04-15 15:17:51 +02:00
3ec90f7770
token_type: assign token_type to worddesc during wordsplit
...
Also added some tests for that part.
2025-04-15 15:17:51 +02:00
4d6a64bf6a
debug: worddesc show more information
...
This seems appropriate since worddescs are getting more and more complex:
markers, flags, tokentypes, ...
2025-04-15 15:17:51 +02:00
6576c47b56
exec: command to toggle execution
...
Execution starts out being enabled. But it can be toggled on and off by using
the .exec command.
2025-04-15 15:17:51 +02:00
ac411d36cc
debug: special command can turn debug mode on and off
...
Using the .debug command, debug mode can be toggled. It starts turned off.
When it is on, each command, before being executed, is debug-printed using the
tree-printing facilities.
2025-04-15 15:16:51 +02:00
18014cda98
token_type: add field with no logic for populating it
2025-04-15 15:15:30 +02:00
5716c4b3dc
parsing: pass correct arguments to prevent use-after-free
2025-04-15 15:15:30 +02:00
ba9751e089
do postprocessing for each simple_cmd before execution
2025-04-15 15:13:17 +02:00
386d2bcb3a
exec: correct error and return value when cmd is a directory
...
minishell: /: Is a directory
$? = 126
2025-04-15 15:11:50 +02:00
d08c9a6727
tests: check simple noops
2025-04-15 15:11:50 +02:00
bb1390aac5
simple_cmd_execute: handle redirections
...
I am very uncertain on if this is actually correct, but I am unable to test it
very much atm
2025-04-15 15:11:50 +02:00
6f75f2d181
connec_cmd_execute: naive recursive pipe implementation (does not handle redirection)
2025-04-15 15:11:26 +02:00
df73b3d0c7
connec_cmd_execute: handle && and ||
2025-04-15 15:11:26 +02:00
8feacccb15
group_cmd_execute: fork and passthrough to cmd_execute
2025-04-15 15:11:26 +02:00
425722801b
refactor(do_waitpid): put into own file for easier acces from other modules
2025-04-15 15:11:26 +02:00
f9f8a804a3
cmd_execute: execute simple commands
2025-04-15 15:11:11 +02:00
7af032539a
cmd_execute: initial scafholding
2025-04-15 15:11:11 +02:00
881c7f264c
signal: if a command is terminated by SIGQUIT, display that it core dumped
2025-04-15 15:11:11 +02:00
ceee5f99d4
signal: SIGQUIT prints ^\ to the terminal, and does not redisplay the prompt
2025-04-15 15:10:40 +02:00
10e8738336
signal: handle redisplaying the prompt correctly
2025-04-15 15:10:40 +02:00
3a309062d8
refactor(signal): remove unneded function
...
excve already resets signal handling to the default
2025-04-15 15:09:39 +02:00
cb8f64367d
minishell: exit with last command exit status
2025-04-15 15:09:39 +02:00
67b2347df9
signal: keep waiting for process to exit on SIGQUIT
...
the SA_RESTART flag causes syscalls such as waitpid to be resumed after a signal
is handled, which is what we want.
2025-04-15 15:08:06 +02:00
f0145d26f4
signal: do not exit shell on SIGINT, ignore SIGQUIT
2025-04-15 15:08:06 +02:00
be183b99ee
minishell: do wildcard expansion
2025-04-15 15:06:46 +02:00
f06f6e26e2
fix(expand_star): memory leak
...
You have to call closedir().
I also removed the errno checking to make some space, I don't think it is needed
when looking at the errors returned by these functions.
2025-04-15 15:05:52 +02:00
32e3976774
field splitting: implement field splitting
2025-04-15 15:05:52 +02:00
0cfa2677c5
fix(echo): echo - was treated as echo -n
...
Small logic error on my part
2025-04-15 15:03:13 +02:00
d40560bb37
unset: implement unset
2025-04-15 15:03:13 +02:00
1ef8b7a0ae
env: implement builtin env
2025-04-15 15:03:13 +02:00
0de583cf45
echo: implement builtin echo
2025-04-15 15:03:13 +02:00
715c2aced8
exit: handle invalid and large arguments
2025-04-15 15:03:13 +02:00