Flanterm LF as new line, reformat LICENSE.txt
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m40s

This commit is contained in:
2026-03-02 19:49:52 +01:00
parent a566917ee9
commit 27afd57427
3 changed files with 41 additions and 48 deletions

View File

@@ -1,11 +1,11 @@
Copyright 2026 Kamil Kowalczyk 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: 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. 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. 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. 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. 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.

52
ce/ce.c
View File

@@ -330,7 +330,7 @@ static void tokenize (struct list_node_link** tokens, const char* text) {
continue; continue;
} }
mprintf ("ERROR unknown character '%c'\r\n", *p); mprintf ("ERROR unknown character '%c'\n", *p);
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]; const char* file_path = file_paths[i];
if (!path_parse (file_path, volume, &path)) { 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; continue;
} }
if ((ret = volume_open (volume)) < 0) { 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; 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]; const char* file_path = file_paths[i];
if (!path_parse (file_path, volume, &path)) { 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; continue;
} }
if ((ret = volume_open (volume)) < 0) { 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; continue;
} }
@@ -415,7 +415,7 @@ static void cat (struct context* context, char** file_paths, size_t files_count)
memset (buffer, 0, desc.size + 1); memset (buffer, 0, desc.size + 1);
read_file (path, 0, (uint8_t*)buffer, desc.size); read_file (path, 0, (uint8_t*)buffer, desc.size);
cprintf (context, "%s\r\n", buffer); cprintf (context, "%s\n", buffer);
close: close:
if (buffer != NULL) if (buffer != NULL)
@@ -432,26 +432,26 @@ static void ls (struct context* context, const char* path_string) {
struct dir_entry entry; struct dir_entry entry;
if (!path_parse (path_string, volume, &path)) { 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; return;
} }
if ((ret = volume_open (volume)) < 0) { 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; return;
} }
describe (path, &desc); describe (path, &desc);
if (desc.type != FS_DIR) { 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 (); volume_close ();
return; return;
} }
size_t entries = desc.size; size_t entries = desc.size;
cprintf (context, "total entries: %zu\r\n", entries); cprintf (context, "total entries: %zu\n", entries);
cprintf (context, "\r\n"); cprintf (context, "\n");
for (size_t entry_num = 0; entry_num < entries; entry_num++) { for (size_t entry_num = 0; entry_num < entries; entry_num++) {
memset (&desc, 0, sizeof (desc)); 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); read_dir_entry (path, &entry, entry_num);
describe (entry.path, &desc); 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); desc.size);
} }
@@ -469,17 +469,17 @@ static void ls (struct context* context, const char* path_string) {
static void quit1 (struct context* context) { static void quit1 (struct context* context) {
run = false; run = false;
cprintf (context, "Goodbye!\r\n"); cprintf (context, "Goodbye!\n");
} }
static void help (struct context* context) { static void help (struct context* context) {
cprintf (context, "Available commands:\r\n"); cprintf (context, "Available commands:\n");
cprintf (context, "echo <word1> <word2> <word3> ...\r\n"); cprintf (context, "echo <word1> <word2> <word3> ...\n");
cprintf (context, "help\r\n"); cprintf (context, "help\n");
cprintf (context, "cat <file path>\r\n"); cprintf (context, "cat <file path>\n");
cprintf (context, "ls <directory path>\r\n"); cprintf (context, "ls <directory path>\n");
cprintf (context, "mkfile <file path>\r\n"); cprintf (context, "mkfile <file path>\n");
cprintf (context, "quit\r\n"); cprintf (context, "quit\n");
} }
static void cmd_cancel_proc (void) { 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) { } else if (strcmp (cmd->name, "mkfile") == 0) {
mkfile (context, cmd->args, cmd->arg_count); mkfile (context, cmd->args, cmd->arg_count);
} else { } else {
/* cprintf (context, "ERROR unknown command '%s'\r\n", cmd->name); */ /* cprintf (context, "ERROR unknown command '%s'\n", cmd->name); */
char volume[VOLUME_MAX]; char volume[VOLUME_MAX];
const char* path; const char* path;
if (!(path_parse (cmd->name, volume, &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; return;
} }
int pid = exec (volume, path); int pid = exec (volume, path);
if (pid < 0) { 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; return;
} }
@@ -542,12 +542,12 @@ static void execute_redir (struct ast_redir* redir, struct context* context) {
int ret; int ret;
if (!(path_parse (redir->file_path, volume, &path))) { 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; return;
} }
if ((ret = volume_open (volume)) < 0) { 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; return;
} }
@@ -613,7 +613,7 @@ void app_main (void) {
} }
} }
mprintf ("\r\n"); mprintf ("\n");
exec_line (line_buffer); exec_line (line_buffer);
line_cursor = 0; line_cursor = 0;

View File

@@ -630,15 +630,11 @@ static void control_sequence_parse (struct flanterm_context* ctx, uint8_t c) {
ctx->get_cursor_pos (ctx, &x, &y); ctx->get_cursor_pos (ctx, &x, &y);
if (y == ctx->scroll_bottom_margin - 1) { if (y == ctx->scroll_bottom_margin - 1) {
ctx->scroll (ctx); ctx->scroll (ctx);
ctx->set_cursor_pos (ctx, x, y); ctx->set_cursor_pos (ctx, 0, y);
} else { } else {
ctx->set_cursor_pos (ctx, x, y + 1); ctx->set_cursor_pos (ctx, 0, y + 1);
} }
break; break;
case '\r':
ctx->get_cursor_pos (ctx, &x, &y);
ctx->set_cursor_pos (ctx, 0, y);
break;
case 14: case 14:
ctx->current_charset = 1; ctx->current_charset = 1;
break; break;
@@ -2422,9 +2418,9 @@ unicode_error:
case '\n': case '\n':
if (y == ctx->scroll_bottom_margin - 1) { if (y == ctx->scroll_bottom_margin - 1) {
ctx->scroll (ctx); ctx->scroll (ctx);
ctx->set_cursor_pos (ctx, x, y); ctx->set_cursor_pos (ctx, 0, y);
} else { } else {
ctx->set_cursor_pos (ctx, x, y + 1); ctx->set_cursor_pos (ctx, 0, y + 1);
} }
return; return;
case '\b': case '\b':
@@ -2432,9 +2428,6 @@ unicode_error:
ctx->set_cursor_pos (ctx, x - 1, y); ctx->set_cursor_pos (ctx, x - 1, y);
} }
return; return;
case '\r':
ctx->set_cursor_pos (ctx, 0, y);
return;
case '\a': case '\a':
// The bell is handled by the kernel // The bell is handled by the kernel
if (ctx->callback != NULL) { if (ctx->callback != NULL) {