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