ladybird/Userland/Utilities/tty.cpp

22 lines
383 B
C++
Raw Normal View History

/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/Format.h>
2022-03-29 20:14:51 +00:00
#include <LibMain/Main.h>
#include <stdio.h>
#include <unistd.h>
2022-03-29 20:14:51 +00:00
ErrorOr<int> serenity_main(Main::Arguments)
{
char* tty = ttyname(0);
if (!tty) {
perror("Error");
return 1;
}
outln("{}", tty);
return 0;
}