Add sys$gethostname and /bin/hostname

This commit is contained in:
Andreas Kling 2018-10-26 09:54:29 +02:00
commit 53abfa7ea1
Notes: sideshowbarker 2024-07-19 18:38:37 +09:00
16 changed files with 77 additions and 40 deletions

17
Userland/hostname.cpp Normal file
View file

@ -0,0 +1,17 @@
#include <LibC/unistd.h>
#include <LibC/stdio.h>
#include <LibC/errno.h>
#include <LibC/string.h>
int main(int c, char** v)
{
char buffer[HOST_NAME_MAX];
int rc = gethostname(buffer, sizeof(buffer));
if (rc < 0) {
printf("gethostname() error: %s\n", strerror(errno));
return 1;
}
printf("%s\n", buffer);
return 0;
}