Commit graph

94 commits

Author SHA1 Message Date
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
32e3976774
field splitting: implement field splitting 2025-04-15 15:05:52 +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
f1c132337b
exit: work for simple arguments
This does not address non-integer arguments, or extremly high/low arguments.
2025-04-15 15:03:13 +02:00
5b7367925f
simple_cmd refactor: put subprocess functions in own file
This clears some space for new functions later
2025-04-15 14:41:44 +02:00
9e79a0829a
fix: do not read ahead in STDIN
The Open Group Base Specifications Issue 8 IEEE Std 1003.1-2024 sh — shell, the
standard command language interpreter says:

> When the shell is using standard input and it invokes a command that also uses
> standard input, the shell shall ensure that the standard input file pointer
> points directly after the command it has read when the command begins
> execution. It shall not read ahead in such a manner that any characters
> intended to be read by the invoked command are consumed by the shell (whether
> interpreted by the shell or not) or that characters that are not read by the
> invoked command are not seen by the shell.

We used the default BUFFER_SIZE for get_next_line of 1024, which caused us to
read ahead farther than was allowed by the Open Group Base Specification.

Setting BUFFER_SIZE=1 ensures that we don't read too far ahead, since
get_next_line will always immediatly stop once a newline is found.

This is for me the simplest way to solve this issue.
2025-04-15 14:41:44 +02:00
4de1d0024a parsing: refactor out the last two functions needed to pass the norm 2025-04-15 14:41:43 +02:00
5e84e9a111 parsing: remove (at least some) dead code 2025-04-15 14:41:43 +02:00
218be08049 parsing: refactor group_cmd_parse into own file 2025-04-15 14:41:43 +02:00
b7871be426 parsing: refactor minishell_optional_pipeline_parse into own file 2025-04-15 14:41:43 +02:00
811ce3ef8e parsing: refactor minishell_simple_cmd_parse into own file 2025-04-15 14:41:43 +02:00
e033909819 makefile: generate depfiles for the correct object files
The depfiles were completely ineffective.

Now this is fixed.

The -MT argument sets the path for the dependenency root. By default it is set
only to a filename, and thus does not include the full path of the file.
2025-04-15 14:41:43 +02:00
9a58198303 parsing: refactor minishell_redirect_parse to own file 2025-04-15 14:41:43 +02:00
d4197fec38 parsing: create specialised function to create a t_cmd 2025-04-15 14:41:43 +02:00
283458b24f parsing: put redirect specific functions into own file 2025-04-15 14:41:43 +02:00
d40b6c3586
debug, destroy all new types (also some code for testing it) 2025-04-15 14:41:43 +02:00
1866da6ea6
fix: make it compile 2025-04-11 16:57:31 +02:00
Jérôme Guélen
10a3c9c411
parse-cmd: Various fixes and a rotation of the parsing tree 2025-04-08 12:14:38 +02:00
0a80b9fbe3
simple_cmd executing refactor: put builtin related utilities into own file 2025-04-01 16:38:41 +02:00
299e016a27
export: handle simple cases 2025-04-01 14:39:02 +02:00
bac3512898
minishell: do variable substitution in postprocessing 2025-04-01 13:50:14 +02:00
e93e6efb93
builtins: cd: implement cd to absolute paths 2025-03-31 16:34:48 +02:00
5ce4a2b85f
builtin: implement pwd 2025-03-31 14:54:40 +02:00
1c4733b1cc
here_doc: print error if failed to create temp file 2025-03-28 19:10:43 +01:00
a4c482e8f9
here_doc: perform variable expansion 2025-03-28 16:45:28 +01:00
Jérôme Guélen
5ff990ef50 Parsing-refactor: Determining structures. 2025-03-28 15:03:15 +01:00
befe219436
simple_cmd executing: works with arguments and env
Does not handle redirections at all, no special facilities are in place to allow
nofork or builtin execution.
2025-03-28 14:50:37 +01:00
f07a80c762
postprocessing: do quote removal 2025-03-28 14:50:37 +01:00
0fbfee7d78
cmdgroup parsing: parse cmdlist surrounded by parentheses 2025-03-28 14:50:37 +01:00
185a069044
cmdgroup parsing refactor: use builder pattern
This will make it easier to add the next logic stuff to it
2025-03-28 14:50:37 +01:00
448458b37f
redirection parsing: parse redirections for cmdgroup 2025-03-28 14:50:37 +01:00
36c1b72eff
tests: implement a better integration test framework than shellspec
(for our usecase at least)
2025-03-28 14:50:37 +01:00
1f03cbbedb
tree debug: implement rest of tree debug
This is a big commit, sorry!
2025-03-28 14:50:37 +01:00
5379ad34f2
cmdlist debug: implement debug func (STUB)
I need to actually parse some cmdlists for this to have any meaning further
2025-03-28 14:50:37 +01:00
40c5164eef
tree debug: create library for easy indent/dedent 2025-03-28 14:50:37 +01:00
131ba36d93
cmdlist refactor: use cmdlist instead of command_list as a shorthand
I hope this doesn't break too much code ^^
2025-03-28 14:50:37 +01:00
56fe943efc
cmdlist: use new architecture (STUB)
I fixed the tests, and the basic functionallity of detecting pipelines works,
but detecting nested cmdgroups is not yet implemented
2025-03-28 14:50:37 +01:00
d069abcd43
Makefile: add rules to build main executable with sanitizers 2025-03-28 14:50:37 +01:00
bc5be67bf6
cmdgroup parsing: parse empty wordlist 2025-03-28 14:50:37 +01:00
0d4edd4809
fix compile issues with duplicate function defs 2025-03-21 13:50:46 +01:00
46c288c858
wordlist: add a function to debug-print a wordlist 2025-03-21 10:44:37 +01:00
Jérôme Guélen
0f8b18b32f
Expansion: Fixed inclusions and Norm checked
Now on to remake tests properly.
2025-03-21 10:14:37 +01:00
Jérôme Guélen
bed41f4a6f
Expansion: A fix attempt
No time left to check before going home
2025-03-21 10:14:34 +01:00
Jérôme Guélen
fc12d8e057
Expansion: fix: algo was wrong for wildcard
Hopefully, this is a proper fix. This commit serves mainly to save
advancement.
2025-03-21 10:12:56 +01:00
63df02aec5
fix: does not compile 2025-03-21 10:09:32 +01:00
Jérôme Guélen
e348040ea4
Subst: A norm NON-compliant and incomplete version
The code does not update flags yet and is to be refactored to conform to the
norm.
Tests required but needing a new version of the wordsplitting code.
2025-03-21 10:07:32 +01:00
7c6d061c6c
here_doc: handle input with correct end marker 2025-03-11 14:58:13 +01:00