summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÁkos Kőrösi <korakos99@gmail.com>2026-05-21 10:19:29 +0200
committerÁkos Kőrösi <korakos99@gmail.com>2026-05-21 10:19:29 +0200
commit2bc953a840f19af33f41f3fedb1c8a36bb0254b6 (patch)
treeec902d498e5c98901ebea2b75a85257220af427b
parentf5eeeb1f1a0ce300c88abfc70962d26469f8a782 (diff)
fix bug
-rw-r--r--Makefile3
-rw-r--r--redes/exec.c3
-rw-r--r--redes/lexparse.c4
-rw-r--r--redes/preproc.c14
4 files changed, 21 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 6952c64..b0c058a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,6 @@
build:
@gcc -g src/main.c src/exec.c src/expand.c src/preproc.c src/utils.c -o bin/yeesh -lreadline
+
+redesbuild:
+ @gcc -g redes/main.c redes/exec.c redes/preproc.c redes/lexparse.c src/utils.c -o bin/reyeesh -lreadline
diff --git a/redes/exec.c b/redes/exec.c
index 756eee6..bac3e52 100644
--- a/redes/exec.c
+++ b/redes/exec.c
@@ -9,6 +9,9 @@
void execute_cmd(ExecutableCommand cmd, int* pgid) {
+ for (int j = 0; cmd.args[j] != NULL; j++) {
+ printf("\tArg %d: %s\n", j, cmd.args[j]);
+ }
pid_t pid = fork();
if (pid == 0) {
diff --git a/redes/lexparse.c b/redes/lexparse.c
index 9791ec9..e064229 100644
--- a/redes/lexparse.c
+++ b/redes/lexparse.c
@@ -24,11 +24,13 @@ MaybeToken consolidate_buffer(LexingBuffer* buf) {
buf->lit_germ = make_String(256);
}
if (buf->word_germ.count > 0) {
+ Word word_germ = buf->word_germ;
+ buf->word_germ = make_Word(256);
return (MaybeToken){
.some = true,
.value = (Token){
.kind = TOK_WORD,
- .as.word = buf->word_germ
+ .as.word = word_germ
}
};
}
diff --git a/redes/preproc.c b/redes/preproc.c
index 33a00e4..8528c5a 100644
--- a/redes/preproc.c
+++ b/redes/preproc.c
@@ -3,6 +3,7 @@
#include "syntax.h"
void split_str_on_space(char* str, StrVec* result) {
+ printf("Splitting %s\n", str);
String buf = make_String(256);
for (int pos = 0; str[pos] != '\0'; pos++) {
if (str[pos] == ' ') {
@@ -14,13 +15,16 @@ void split_str_on_space(char* str, StrVec* result) {
}
if (buf.count > 0) {
- push_to_StrVec(result, inner(&buf));
+ char* buf_str = inner(&buf);
+ printf("Fahh %s\n", buf_str);
+ push_to_StrVec(result, buf_str);
}
}
StrVec process_word(Word word) {
StrVec result = make_StrVec(256);
for (int i = 0; i < word.count; i++) {
+ printf("Chunk %d\n", i);
Chunk chunk = *get_from_Word(&word, i);
switch (chunk.qmode) {
case SINGLE_Q:
@@ -56,7 +60,8 @@ Pipeline* process_token_sequence(TokenVec tokens, PipelineVec* pl_pool) {
);
tok_pos++
) {
- StrVec exp_word;
+ printf("Boo\n");
+ StrVec exp_word = make_StrVec(256);
switch (curr_tok.kind) {
case TOK_WORD:
exp_word = process_word(curr_tok.as.word);
@@ -81,6 +86,11 @@ Pipeline* process_token_sequence(TokenVec tokens, PipelineVec* pl_pool) {
default:
exit(69);
}
+ printf("Argcount: %d\n", pl_cmd.args.count);
+ for (int k = 0; k < pl_cmd.args.count; k++) {
+ Arg arg = *get_from_ArgVec(&pl_cmd.args, k);
+ printf("\t%s\n", arg.as.lit_str);
+ }
push_to_Pipeline(&pl, pl_cmd);
}
return push_to_PipelineVec(pl_pool, pl);