1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:57:45 +00:00

Add TIOCGWINSZ ioctl so userland can determine terminal geometry.

(Don't) use this to implement short-form output in ls.
I'm too tired to make a nice column formatting algorithm.
I just wanted something concise when I type "ls".
This commit is contained in:
Andreas Kling 2018-11-29 03:45:23 +01:00
parent f5a83c4d8a
commit ac7a60225e
11 changed files with 208 additions and 63 deletions

View file

@ -39,6 +39,9 @@ public:
virtual String ttyName() const = 0;
unsigned short rows() const { return m_rows; }
unsigned short columns() const { return m_columns; }
void set_pgid(pid_t pgid) { m_pgid = pgid; }
pid_t pgid() const { return m_pgid; }
@ -50,6 +53,7 @@ public:
protected:
virtual void onTTYWrite(const byte*, size_t) = 0;
void set_size(unsigned short columns, unsigned short rows);
TTY(unsigned major, unsigned minor);
void emit(byte);
@ -63,5 +67,7 @@ private:
DoubleBuffer m_buffer;
pid_t m_pgid { 0 };
Unix::termios m_termios;
unsigned short m_rows { 0 };
unsigned short m_columns { 0 };
};