mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:47:34 +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
12 changed files with 78 additions and 3 deletions
|
@ -4,6 +4,7 @@
|
|||
#include <LibC/errno.h>
|
||||
#include <LibC/string.h>
|
||||
#include <LibC/stdlib.h>
|
||||
#include <LibC/utsname.h>
|
||||
#include <AK/FileSystemPath.h>
|
||||
|
||||
struct GlobalState {
|
||||
|
@ -148,6 +149,17 @@ static int runcmd(char* cmd)
|
|||
return retval;
|
||||
}
|
||||
|
||||
static void greeting()
|
||||
{
|
||||
utsname uts;
|
||||
int rc = uname(&uts);
|
||||
if (rc < 0) {
|
||||
perror("uname");
|
||||
return;
|
||||
}
|
||||
printf("\n%s/%s on %s\n\n", uts.sysname, uts.machine, ttyname(0));
|
||||
}
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
g = new GlobalState;
|
||||
|
@ -155,6 +167,8 @@ int main(int, char**)
|
|||
if (rc < 0)
|
||||
perror("gethostname");
|
||||
|
||||
greeting();
|
||||
|
||||
char linebuf[128];
|
||||
int linedx = 0;
|
||||
linebuf[0] = '\0';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue