Commit graph

284 commits

Author SHA1 Message Date
aa12f7c971
matchers: add matcher for <blank> character class 2025-02-20 15:00:11 +01:00
ac10c3b4de
libft: add functions to get the first character matching or not matching a predicate 2025-02-20 14:59:26 +01:00
8defbf4d13
wordsplit: handle single word with spaces before or after 2025-02-20 14:55:29 +01:00
fc985ea046
fix(tests): also run tests if test program did not change 2025-02-20 14:55:29 +01:00
25369f02ab
fix(Makefile): ASAN malloc stacktraces were being truncated 2025-02-20 14:55:29 +01:00
40c97b6813
tests Makefile: add rules to run C tests iwth specific sanitizer 2025-02-20 14:55:29 +01:00
a083800506
word splitting: a single word is not split
Sorry this commit is a bit big, lots of groudwork is being established here
2025-02-20 14:55:29 +01:00
871571e258
tests: more clear output log 2025-02-20 14:47:31 +01:00
c5eaa0e126
tests: fix typo in UBSAN invocation 2025-02-20 14:47:31 +01:00
7f71bd1694
tests: add testutils 2025-02-20 14:44:56 +01:00
715e6e122f
libft: add ft_strcmp function 2025-02-20 14:44:56 +01:00
6b64e0dfd7
tests: tests can now use libft 2025-02-20 14:44:05 +01:00
abea59eba4
get_command refactor: put into own file 2025-02-20 14:40:57 +01:00
486dec7bb7
get_command: if input is not a tty, use get next line
This simplifies tests
2025-02-20 14:40:57 +01:00
dff68d5a8b
env refactor: split imports over multiple files
This allows for potentially faster recompilation, by not triggering
recompilation for all env files if env_manip changes
2025-02-19 16:43:37 +01:00
e445f668b3
env_manip: sort funcs per structure that is being manipulated
This is instead of the operation that is being performed.

I find it more logical this way, but if you prefer we can keep it as-is.

I also put the identifier_isvalid func into parser/matchers
2025-02-19 14:47:10 +01:00
Jérôme Guélen
e985fcc562 env_set_entry: use ft_errno to indicate error conditions 2025-02-19 14:34:09 +01:00
Jérôme Guélen
df8aec148f env_manip: add function to check if a str is a valid variable identifier 2025-02-19 14:34:09 +01:00
Jérôme Guélen
532f9dc526 libft: add free2 function
This frees two pointers, and returns NULL
2025-02-19 14:34:09 +01:00
Jérôme Guélen
622a9caa53 refactor: move env_get_size to env_get.c 2025-02-19 14:34:09 +01:00
Jérôme Guélen
30d32a1d53 ft_errno: integrate ft_errno library 2025-02-19 14:34:09 +01:00
Jérôme Guélen
660d785237 ENV: A small set of functions for internal env 2025-02-19 14:34:09 +01:00
18a2835a7c
tests: add testutils 2025-02-19 14:34:09 +01:00
Jérôme Guélen
5b00059526 refactor: rename env_get_set.c to env_get.c 2025-02-19 14:34:09 +01:00
ab6a4d6368
envp_get_val: add tests + make it more consistent with envp_get_key
In particular, this is what is now changed:
 - if line is null or empty, return null
 - if line contains no =, return an empty string

This way, if non-null is returned, that means that line was valid. If null is
returned, there is either an error with line, or malloc failed.
2025-02-19 14:34:09 +01:00
af90bec318
envp_get_key: fix buffer overflow if line contains no '=' 2025-02-19 14:34:09 +01:00
9ac8588518
envp_get_key: add tests 2025-02-19 14:34:09 +01:00
aad17031a8
libft: add ft_strcmp function 2025-02-19 14:34:09 +01:00
897f6c6a6b
fix(Makefile): ASAN malloc stacktraces were being truncated 2025-02-19 14:34:09 +01:00
a6ce45ca87
tests Makefile: add rules to run C tests iwth specific sanitizer 2025-02-19 14:34:08 +01:00
c7a86eecfd
tests: tests can now use libft 2025-02-19 14:34:08 +01:00
da447a2491
env_manip: make it compile 2025-02-19 14:34:08 +01:00
Jérôme Guélen
f0a181315b WIP: env: getting key and value from an envp entry 2025-02-19 14:34:08 +01:00
Jérôme Guélen
eaa1afda5f WIP: internal environment manipulation
Added a function to join two strings putting a separator in between. (Predicted useful for PATH manipulation and general translation of internal structure back to char ** form)
2025-02-19 14:34:08 +01:00
46401ef417
libft: do not override default CC
instead use the one provided by the system, which allows easier integration of
tools such as distcc and ccache

jguelen: you probably don't have to worry about anything here
2025-02-19 14:34:08 +01:00
9cc5c6bfb7
dev: ignore .cache and compile_commands.json
These files are used by clangd to know where code is located.

To generate them, use
bear -- make re
and restart your lsp

jguelen: you probably don't have to deal with this
2025-02-19 13:56:09 +01:00
9bab2b26d8
notes: add Bash Hackers Wiki resource 2025-02-13 15:42:02 +01:00
0ec5f5a66a
notes: add IEEE spec resource 2025-02-13 15:42:02 +01:00
2aa49363eb
notes: reading input in non-interactive mode needs to be done char by char 2025-02-13 15:42:02 +01:00
67ffe772b0
Makefile: add rule to run only C tests 2025-02-13 15:42:02 +01:00
394a923fdc
Merge branch 'notes' 2025-02-12 17:44:16 +01:00
8d728b04e1
notes: document behaviour we need to implement so that we can use prysk 2025-02-12 17:29:34 +01:00
80e0484005
Merge branch 'libft' 2025-02-12 17:25:48 +01:00
c027eda58c
notes: add some usefull resources 2025-02-12 17:18:19 +01:00
2d03d208e8
fix(Makefile): norm should check the libft 2025-02-12 17:01:43 +01:00
35ffa6f3a0
fix(libft): in case of tests, build with -fsanitize as well 2025-02-12 15:21:40 +01:00
9e9bd1043b
fix(libft): compilation failed due to different compiler version 2025-02-12 15:18:17 +01:00
Jérôme Guélen
ddb2306630 libs: added libft 2025-02-12 15:12:42 +01:00
6e1552a35d
fix: ';' is not a metacharacter
Co-authored-by: jguelen <jguelen@student.42lehavre.fr>
2025-02-11 19:04:05 +01:00
e877b8dbd5
fix(tests): correctly handle dependencies in test makefile 2025-02-11 18:47:46 +01:00