Implement TERMINAL_DIMENSIONS op for the terminal device, CE add terminfo command
All checks were successful
Build documentation / build-and-deploy (push) Successful in 1m59s

This commit is contained in:
2026-03-05 16:42:02 +01:00
parent 25b289ccfb
commit a346a5667c
9 changed files with 42 additions and 3 deletions

View File

@@ -15,6 +15,7 @@
#include <str_status.h>
#include <string.h>
#include <system.h>
#include <terminal.h>
static bool run = true;
@@ -51,6 +52,12 @@ static void mkfile (struct context* context, char** file_paths, size_t files_cou
}
}
static void terminfo (struct context* context) {
size_t cols = 0, rows = 0;
terminal_dimensions (&cols, &rows);
cprintf (context, "%zu x %zu\n", cols, rows);
}
static void mkdir (struct context* context, char** dir_paths, size_t dirs_count) {
char volume[VOLUME_MAX];
const char* path;
@@ -248,6 +255,7 @@ static void help (struct context* context) {
cprintf (context, "mkdir <directory path>\n");
cprintf (context, "rm <path>\n");
cprintf (context, "edit <path>\n");
cprintf (context, "terminfo\n");
cprintf (context, "quit\n");
}
@@ -286,6 +294,8 @@ static void execute_cmd (struct ast_cmd* cmd, struct context* context) {
rm (context, cmd->args, cmd->arg_count);
} else if (strcmp (cmd->name, "edit") == 0) {
edit (context, cmd->args[0]);
} else if (strcmp (cmd->name, "terminfo") == 0) {
terminfo (context);
} else {
char volume[VOLUME_MAX];
const char* path;