1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:34:59 +00:00

LibC: Add ctermid

We simply return "/dev/tty", since it always refers to the controlling
terminal of the calling process.
This commit is contained in:
SeekingBlues 2022-06-18 00:30:52 +08:00 committed by Andreas Kling
parent 5b1e2cc65c
commit f34e69a52b
2 changed files with 11 additions and 0 deletions

View file

@ -1299,6 +1299,15 @@ FILE* tmpfile()
return fdopen(fd, "rw");
}
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/ctermid.html
char* ctermid(char* s)
{
static char tty_path[L_ctermid] = "/dev/tty";
if (s)
return strcpy(s, tty_path);
return tty_path;
}
size_t __fpending(FILE* stream)
{
ScopedFileLock lock(stream);