forked from Bananymous/banan-os
Kernel/LibC: Implement ioctl(TIOCGWINSZ)
This allows ncurses to get the window size!
This commit is contained in:
parent
af78a2d080
commit
a578527012
|
@ -127,16 +127,22 @@ namespace Kernel
|
|||
{
|
||||
switch (request)
|
||||
{
|
||||
case KD_LOADFONT:
|
||||
case KDLOADFONT:
|
||||
{
|
||||
auto absolute_path = TRY(Process::current().absolute_path_of(BAN::StringView(reinterpret_cast<const char*>(argument))));
|
||||
auto new_font = TRY(LibFont::Font::load(absolute_path));
|
||||
set_font(new_font);
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
return BAN::Error::from_errno(EINVAL);
|
||||
case TIOCGWINSZ:
|
||||
{
|
||||
auto* winsize = static_cast<struct winsize*>(argument);
|
||||
winsize->ws_col = width();
|
||||
winsize->ws_row = height();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return BAN::Error::from_errno(ENOTSUP);
|
||||
}
|
||||
|
||||
void TTY::on_key_event(LibInput::KeyEvent event)
|
||||
|
|
|
@ -101,7 +101,14 @@ struct str_list
|
|||
#define I_SWROPT 28
|
||||
#define I_UNLINK 29
|
||||
|
||||
#define KD_LOADFONT 30
|
||||
#define KDLOADFONT 30
|
||||
|
||||
struct winsize
|
||||
{
|
||||
unsigned short ws_row;
|
||||
unsigned short ws_col;
|
||||
};
|
||||
#define TIOCGWINSZ 50
|
||||
|
||||
#define FLUSHR 1
|
||||
#define FLUSHRW 2
|
||||
|
|
|
@ -20,7 +20,7 @@ int main(int argc, char** argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (ioctl(STDOUT_FILENO, KD_LOADFONT, argv[1]) == -1)
|
||||
if (ioctl(STDOUT_FILENO, KDLOADFONT, argv[1]) == -1)
|
||||
{
|
||||
perror("ioctl");
|
||||
return 1;
|
||||
|
|
Loading…
Reference in New Issue