Flanterm LF as new line, reformat LICENSE.txt
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m40s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m40s
This commit is contained in:
52
ce/ce.c
52
ce/ce.c
@@ -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;
|
||||||
|
|||||||
@@ -630,14 +630,10 @@ 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);
|
|
||||||
} else {
|
|
||||||
ctx->set_cursor_pos (ctx, x, y + 1);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case '\r':
|
|
||||||
ctx->get_cursor_pos (ctx, &x, &y);
|
|
||||||
ctx->set_cursor_pos (ctx, 0, y);
|
ctx->set_cursor_pos (ctx, 0, y);
|
||||||
|
} else {
|
||||||
|
ctx->set_cursor_pos (ctx, 0, y + 1);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 14:
|
case 14:
|
||||||
ctx->current_charset = 1;
|
ctx->current_charset = 1;
|
||||||
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user