aboutsummaryrefslogtreecommitdiff
path: root/hostname.c
blob: 532fc16c698de4208f397404dda1ba846f256b6c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
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);
}