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
All checks were successful
Build documentation / build-and-deploy (push) Successful in 1m59s
This commit is contained in:
@@ -5,7 +5,7 @@ $(eval $(call add_lib,libprocess))
|
||||
$(eval $(call add_lib,libaux))
|
||||
$(eval $(call add_lib,libarena))
|
||||
$(eval $(call add_lib,libioutil))
|
||||
$(eval $(call add_include,libterminal))
|
||||
$(eval $(call add_lib,libterminal))
|
||||
$(eval $(call add_include,libkb))
|
||||
|
||||
cflags += -DPRINTF_INCLUDE_CONFIG_H=1
|
||||
|
||||
10
ce/interp.c
10
ce/interp.c
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user