diff options
Diffstat (limited to 'hostname.c')
-rw-r--r-- | hostname.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/hostname.c b/hostname.c new file mode 100644 index 0000000..532fc16 --- /dev/null +++ b/hostname.c @@ -0,0 +1,13 @@ +#include "hostname.h" + +int main(void) { + struct utsname *name; + name = malloc(sizeof(struct utsname)); + if (uname(name) == -1) { + perror("uname"); + exit(EXIT_FAILURE); + } + fprintf(stdout, "%s\n", name->nodename); + exit(EXIT_SUCCESS); +} + |