diff --git a/src/shell.c b/src/shell.c index 67f6357..b06723d 100644 --- a/src/shell.c +++ b/src/shell.c @@ -56,24 +56,24 @@ void write_prompt(int is_a_tty) } static -int change_shell_command(char **buffer, exec_ctx_t *exec_ctx, size_t buffer_sz) +bool change_shell_command(char **buffer, exec_ctx_t *exec_ctx, size_t buffer_sz) { size_t buffer_len = 0; char *tmp_buff = NULL; if (getline(buffer, &buffer_sz, stdin) == -1) - return 1; + return false; tmp_buff = (*buffer); buffer_len = update_command(&tmp_buff, &buffer_sz, exec_ctx); if (buffer_len < 1 || !u_str_is_alnum(tmp_buff)) { check_basic_error(tmp_buff); free(tmp_buff); - return 0; + return true; } U_DEBUG("Buffer [%lu] [%s]\n", buffer_len, buffer); visitor(tmp_buff, exec_ctx); free(tmp_buff); - return 0; + return false; } static @@ -84,7 +84,7 @@ int shell_loop(int is_a_tty, exec_ctx_t *exec_ctx) while (true) { write_prompt(is_a_tty); - if (change_shell_command(&buffer, exec_ctx, buffer_sz) == 1) + if (change_shell_command(&buffer, exec_ctx, buffer_sz) == falsel) return exec_ctx->history->last_exit_code; } free(exec_ctx->history_command);