diff --git a/install.sh b/install.sh index 08a22ae..e749622 100755 --- a/install.sh +++ b/install.sh @@ -1,6 +1,7 @@ #!/bin/bash -echo "This shell file will check dependencies, install if necessary, and build ORORA." +sudo echo "This shell file will check dependencies, install if necessary, and build ORORA." + command_exists() { command -v "$1" >/dev/null 2>&1 @@ -80,11 +81,10 @@ if [ $? -ne 0 ]; then exit 1 fi -echo "orora has been installed successfully." +echo "orora has been installed successfully!" echo "You can now run 'orora' from any directory." # Optional: Set up man page or help documentation # sudo cp orora.1 /usr/local/share/man/man1/ # sudo mandb -echo "Installation process completed." diff --git a/src/loader/main.c b/src/loader/main.c index eef174f..b5529d9 100644 --- a/src/loader/main.c +++ b/src/loader/main.c @@ -77,12 +77,13 @@ bool init_orora(); void handle_sigint(int sig) { fprintf(stderr, "\n"); - fprintf(stderr, DIALOGUE); +// fprintf(stderr, DIALOGUE); } void handle_sigterm(int sig) { fprintf(stderr, "\n"); + exit(0); } bool INTERACTIVE_MODE = 0; @@ -141,8 +142,8 @@ int main(int argc, char** argv) { change_interactive_mode(1); - signal(SIGINT, handle_sigint); - signal(SIGTERM, handle_sigterm); +// signal(SIGINT, handle_sigint); +// signal(SIGTERM, handle_sigterm); fflush(stdout); int port = START_PORT; diff --git a/src/server/client.c b/src/server/client.c index cf9fcc9..934f6c8 100644 --- a/src/server/client.c +++ b/src/server/client.c @@ -111,7 +111,6 @@ void run_client(int port) } else if (n == 0) { - printf("Server disconnected\n"); return; } else if (errno != EAGAIN && errno != EWOULDBLOCK) @@ -141,7 +140,6 @@ void run_client(int port) } else if (n == 0) { - printf("Server disconnected\n"); free(response); return; } diff --git a/src/server/daemon.c b/src/server/daemon.c index bc62b9e..07f61fe 100644 --- a/src/server/daemon.c +++ b/src/server/daemon.c @@ -52,8 +52,8 @@ int is_end_interactive_line(Lexer* root) void run_daemon() { - signal(SIGTERM, handle_signal); - signal(SIGINT, handle_signal); +// signal(SIGTERM, handle_signal); +// signal(SIGINT, handle_signal); char buffer[BUFFER_SIZE]; @@ -79,7 +79,7 @@ void run_daemon() if (is_first_line) { input = malloc(num_read + 1); - if (input == NULL) + if (input == (void*) 0) { syslog(LOG_ERR, "Memory allocation failed"); break; @@ -92,7 +92,7 @@ void run_daemon() else { char *temp = realloc(input, len_input + num_read + 1); - if (temp == NULL) + if (temp == (void*) 0) { syslog(LOG_ERR, "Memory reallocation failed"); free(input); @@ -112,6 +112,20 @@ void run_daemon() *len_p = (off_t) len_input; Lexer* root = init_lexer(input, len_p); + + Lexer* lexer_null_checker = malloc(sizeof(Lexer)); + memcpy(lexer_null_checker, root, sizeof(Lexer)); + if (lexer_get_token(lexer_null_checker) == (void*) 0) + { + free(lexer_null_checker); + orora_write("", ORORA_STATUS_SUCCESS); + continue; + } + free(lexer_null_checker); + +// #include "develop/develop_mode.h" +// printf("root_size: %d\n", root->size); +// print_tokens(root); int right_space = is_end_interactive_line(root); if (right_space == 0) { @@ -137,7 +151,13 @@ void run_daemon() { if (new_value->type != AST_VALUE_NULL || !(ast->type == AST_FUNCTION || ast->type == AST_CODE - || (ast->type == AST_VALUE && ast->value.value_v->stack->type == AST_VALUE_CODE))) + || ast->type == AST_FOR + || ast->type == AST_WHILE + || ast->type == AST_CASES + || (ast->type == AST_VALUE && (ast->value.value_v->stack->type == AST_VALUE_CODE) + ) + ) + ) visitor_print_function_value(new_value); orora_write("\n", ORORA_STATUS_SUCCESS); }