diff --git a/LICENSE.txt b/LICENSE.txt index a5771de..6cb808e 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,11 +1,11 @@ -Copyright 2026 Kamil Kowalczyk - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +Copyright 2026 Kamil Kowalczyk + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/ce/ce.c b/ce/ce.c index 1a4a670..99c8cd3 100644 --- a/ce/ce.c +++ b/ce/ce.c @@ -330,7 +330,7 @@ static void tokenize (struct list_node_link** tokens, const char* text) { continue; } - mprintf ("ERROR unknown character '%c'\r\n", *p); + mprintf ("ERROR unknown character '%c'\n", *p); p++; } } @@ -369,12 +369,12 @@ static void mkfile (struct context* context, char** file_paths, size_t files_cou const char* file_path = file_paths[i]; if (!path_parse (file_path, volume, &path)) { - cprintf (context, "ERROR bad path '%s'\r\n", file_path); + cprintf (context, "ERROR bad path '%s'\n", file_path); continue; } if ((ret = volume_open (volume)) < 0) { - cprintf (context, "ERROR could not open volume '%s': %s\r\n", volume, str_status[-ret]); + cprintf (context, "ERROR could not open volume '%s': %s\n", volume, str_status[-ret]); continue; } @@ -394,12 +394,12 @@ static void cat (struct context* context, char** file_paths, size_t files_count) const char* file_path = file_paths[i]; if (!path_parse (file_path, volume, &path)) { - cprintf (context, "ERROR bad path '%s'\r\n", file_path); + cprintf (context, "ERROR bad path '%s'\n", file_path); continue; } if ((ret = volume_open (volume)) < 0) { - cprintf (context, "ERROR could not open volume '%s': %s\r\n", volume, str_status[-ret]); + cprintf (context, "ERROR could not open volume '%s': %s\n", volume, str_status[-ret]); continue; } @@ -415,7 +415,7 @@ static void cat (struct context* context, char** file_paths, size_t files_count) memset (buffer, 0, desc.size + 1); read_file (path, 0, (uint8_t*)buffer, desc.size); - cprintf (context, "%s\r\n", buffer); + cprintf (context, "%s\n", buffer); close: if (buffer != NULL) @@ -432,26 +432,26 @@ static void ls (struct context* context, const char* path_string) { struct dir_entry entry; if (!path_parse (path_string, volume, &path)) { - cprintf (context, "ERROR bad path '%s'\r\n", path_string); + cprintf (context, "ERROR bad path '%s'\n", path_string); return; } if ((ret = volume_open (volume)) < 0) { - cprintf (context, "ERROR could not open volume '%s': %s\r\n", volume, str_status[-ret]); + cprintf (context, "ERROR could not open volume '%s': %s\n", volume, str_status[-ret]); return; } describe (path, &desc); if (desc.type != FS_DIR) { - cprintf (context, "ERROR '%s' is not a directory\r\n", path_string); + cprintf (context, "ERROR '%s' is not a directory\n", path_string); volume_close (); return; } size_t entries = desc.size; - cprintf (context, "total entries: %zu\r\n", entries); - cprintf (context, "\r\n"); + cprintf (context, "total entries: %zu\n", entries); + cprintf (context, "\n"); for (size_t entry_num = 0; entry_num < entries; entry_num++) { memset (&desc, 0, sizeof (desc)); @@ -460,7 +460,7 @@ static void ls (struct context* context, const char* path_string) { read_dir_entry (path, &entry, entry_num); describe (entry.path, &desc); - cprintf (context, "%c %-40s %-40zu\r\n", (desc.type == FS_DIR ? 'D' : 'F'), entry.path, + cprintf (context, "%c %-40s %-40zu\n", (desc.type == FS_DIR ? 'D' : 'F'), entry.path, desc.size); } @@ -469,17 +469,17 @@ static void ls (struct context* context, const char* path_string) { static void quit1 (struct context* context) { run = false; - cprintf (context, "Goodbye!\r\n"); + cprintf (context, "Goodbye!\n"); } static void help (struct context* context) { - cprintf (context, "Available commands:\r\n"); - cprintf (context, "echo ...\r\n"); - cprintf (context, "help\r\n"); - cprintf (context, "cat \r\n"); - cprintf (context, "ls \r\n"); - cprintf (context, "mkfile \r\n"); - cprintf (context, "quit\r\n"); + cprintf (context, "Available commands:\n"); + cprintf (context, "echo ...\n"); + cprintf (context, "help\n"); + cprintf (context, "cat \n"); + cprintf (context, "ls \n"); + cprintf (context, "mkfile \n"); + cprintf (context, "quit\n"); } static void cmd_cancel_proc (void) { @@ -512,19 +512,19 @@ static void execute_cmd (struct ast_cmd* cmd, struct context* context) { } else if (strcmp (cmd->name, "mkfile") == 0) { mkfile (context, cmd->args, cmd->arg_count); } else { - /* cprintf (context, "ERROR unknown command '%s'\r\n", cmd->name); */ + /* cprintf (context, "ERROR unknown command '%s'\n", cmd->name); */ char volume[VOLUME_MAX]; const char* path; if (!(path_parse (cmd->name, volume, &path))) { - cprintf (context, "ERROR bad path '%s'\r\n", cmd->name); + cprintf (context, "ERROR bad path '%s'\n", cmd->name); return; } int pid = exec (volume, path); if (pid < 0) { - cprintf (context, "ERROR could not run '%s': %s\r\n", cmd->name, str_status[-pid]); + cprintf (context, "ERROR could not run '%s': %s\n", cmd->name, str_status[-pid]); return; } @@ -542,12 +542,12 @@ static void execute_redir (struct ast_redir* redir, struct context* context) { int ret; if (!(path_parse (redir->file_path, volume, &path))) { - cprintf (context, "ERROR bad path '%s'\r\n", redir->file_path); + cprintf (context, "ERROR bad path '%s'\n", redir->file_path); return; } if ((ret = volume_open (volume)) < 0) { - cprintf (context, "ERROR could not open volume '%s': %s\r\n", volume, str_status[-ret]); + cprintf (context, "ERROR could not open volume '%s': %s\n", volume, str_status[-ret]); return; } @@ -613,7 +613,7 @@ void app_main (void) { } } - mprintf ("\r\n"); + mprintf ("\n"); exec_line (line_buffer); line_cursor = 0; diff --git a/kernel/Flanterm/src/flanterm.c b/kernel/Flanterm/src/flanterm.c index 3564909..39aef33 100644 --- a/kernel/Flanterm/src/flanterm.c +++ b/kernel/Flanterm/src/flanterm.c @@ -630,15 +630,11 @@ static void control_sequence_parse (struct flanterm_context* ctx, uint8_t c) { ctx->get_cursor_pos (ctx, &x, &y); if (y == ctx->scroll_bottom_margin - 1) { ctx->scroll (ctx); - ctx->set_cursor_pos (ctx, x, y); + ctx->set_cursor_pos (ctx, 0, y); } else { - ctx->set_cursor_pos (ctx, x, y + 1); + ctx->set_cursor_pos (ctx, 0, y + 1); } break; - case '\r': - ctx->get_cursor_pos (ctx, &x, &y); - ctx->set_cursor_pos (ctx, 0, y); - break; case 14: ctx->current_charset = 1; break; @@ -2422,9 +2418,9 @@ unicode_error: case '\n': if (y == ctx->scroll_bottom_margin - 1) { ctx->scroll (ctx); - ctx->set_cursor_pos (ctx, x, y); + ctx->set_cursor_pos (ctx, 0, y); } else { - ctx->set_cursor_pos (ctx, x, y + 1); + ctx->set_cursor_pos (ctx, 0, y + 1); } return; case '\b': @@ -2432,9 +2428,6 @@ unicode_error: ctx->set_cursor_pos (ctx, x - 1, y); } return; - case '\r': - ctx->set_cursor_pos (ctx, 0, y); - return; case '\a': // The bell is handled by the kernel if (ctx->callback != NULL) {