cshell

Simple shell implementation on C for Linux
git clone https://git.nfu.su/cshell.git
Log | Files | Refs

commit de18b7de9ea82a466e3ecff296020eec5e36116d
parent 1695143f594d7f21391c5842278b37eb73717c69
Author: Oleg Levkin <uventik999@gmail.com>
Date:   Sun, 21 Jun 2026 01:04:35 +0300

[DEL]: deleted useless trash

Diffstat:
Dcompile.sh | 1-
Mmain.c | 36+++++++++++++-----------------------
2 files changed, 13 insertions(+), 24 deletions(-)

diff --git a/compile.sh b/compile.sh @@ -1 +0,0 @@ -gcc main.c -o CShell diff --git a/main.c b/main.c @@ -8,46 +8,36 @@ typedef struct { size_t s_get_buff; } getLineStruct; -getLineStruct *in_get(void); +void in_get(getLineStruct *gls); void show_greet(void); int main(void) { // First Inits _Bool is_exit = 0; - getLineStruct *in_buff; + getLineStruct in_buff = {.get_buff = NULL, .s_get_buff = 0}; + char *tokens[128]; // INFO: Main Cycle (Entry Point of Exec) while (!is_exit) { show_greet(); - in_buff = in_get(); - } -} - -getLineStruct *in_get(void) { - getLineStruct *in_buff = malloc(sizeof(getLineStruct)); + in_get(&in_buff); - getline(&in_buff->get_buff, &in_buff->s_get_buff, stdin); + free(in_buff.get_buff); + } - return in_buff; + return 0; } -char **tokenize_line(getLineStruct *gls) { // TODO: - char c = 'a'; - char **arr; - int a = 0; - int b = 0; - - // while (c != '\n' && c != '\0') { - // if (c == ' ') { - // a++; - // } - // } +void tokenizer(getLineStruct *gls, char **tok) { + int i = 0; - for (;;) { + for (int a = 0;; a++) { } +} - return arr; // Ret: addr of array of tokens +void in_get(getLineStruct *gls) { + getline(&gls->get_buff, &gls->s_get_buff, stdin); } void show_greet(void) { printf("> "); }