aboutsummaryrefslogtreecommitdiff
path: root/src/os.c
blob: fd5b7ae3824e234e8993bf52d72cf030a8300690 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "../include/cfetch.h"

#include <sys/utsname.h>

void get_os(system_info_t *info) {
#ifdef __linux__
    struct utsname u;

    if (uname(&u) == 0) {
	size_t length = printf("OS: %s %s %s %s\n", u.sysname, u.release, u.version, u.machine);
	printf("line length: %ld\n", length);
    } else {
	perror("Error while accessing uname");
	return;
    }
#endif
    return;
}