mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-02 01:08:48 +00:00
Add sys$ttyname_r and ttyname_r() + ttyname().
And print a greeting when sh starts up so we know which TTY we're on.
This commit is contained in:
parent
7a85384e47
commit
00c21d1590
Notes:
sideshowbarker
2024-07-19 18:36:21 +09:00
Author: https://github.com/awesomekling
Commit: 00c21d1590
12 changed files with 78 additions and 3 deletions
|
@ -3,6 +3,7 @@
|
|||
#include "CharacterDevice.h"
|
||||
#include "sys-errno.h"
|
||||
#include "UnixTypes.h"
|
||||
#include "TTY.h"
|
||||
#include <AK/BufferStream.h>
|
||||
|
||||
FileHandle::FileHandle(RetainPtr<VirtualFileSystem::Node>&& vnode)
|
||||
|
@ -109,6 +110,7 @@ Unix::ssize_t FileHandle::write(const byte* data, Unix::size_t size)
|
|||
}
|
||||
// FIXME: Implement non-device writes.
|
||||
ASSERT_NOT_REACHED();
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool FileHandle::hasDataAvailableForRead()
|
||||
|
@ -160,3 +162,17 @@ ssize_t FileHandle::get_dir_entries(byte* buffer, Unix::size_t size)
|
|||
memcpy(buffer, tempBuffer.pointer(), stream.offset());
|
||||
return stream.offset();
|
||||
}
|
||||
|
||||
bool FileHandle::isTTY() const
|
||||
{
|
||||
if (auto* device = m_vnode->characterDevice())
|
||||
return device->isTTY();
|
||||
return false;
|
||||
}
|
||||
|
||||
const TTY* FileHandle::tty() const
|
||||
{
|
||||
if (auto* device = m_vnode->characterDevice())
|
||||
return static_cast<const TTY*>(device);
|
||||
return nullptr;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue