| 1 | #include <stdio.h> |
| 2 | #include <sys/utsname.h> |
| 3 | #include <stdlib.h> |
| 4 | |
| 5 | static const char asciiArt[] = |
| 6 | " \n" |
| 7 | " ██████ \n" |
| 8 | " ██████████ \n" |
| 9 | " ███ ███ \n" |
| 10 | " ███ \n" |
| 11 | " ████████ \n" |
| 12 | " █████████ \n" |
| 13 | " ███ \n" |
| 14 | " ███ ███ \n" |
| 15 | " ██████████ \n" |
| 16 | " ██████ \n" |
| 17 | " "; |
| 18 | |
| 19 | void printAscii(void) { |
| 20 | printf("%s\n\n", asciiArt); |
| 21 | } |
| 22 | |
| 23 | int printStats(void) { |
| 24 | |
| 25 | char *wm = getenv("XDG_SESSION_DESKTOP"); |
| 26 | if (!wm) { |
| 27 | wm = getenv("DESKTOP_SESSION"); |
| 28 | } |
| 29 | struct utsname info; |
| 30 | |
| 31 | if (uname(&info) != 0) { |
| 32 | perror("uname"); |
| 33 | return 1; |
| 34 | } |
| 35 | printf("OS: %s\n", info.sysname); |
| 36 | printf("Kernel: %s\n", info.release); |
| 37 | printf("Host: %s\n", info.nodename); |
| 38 | printf("WM: %s\n", wm ? wm : "Unknown"); |
| 39 | |
| 40 | return 0; |
| 41 | } |
| 42 | |
| 43 | int main(void) { |
| 44 | printAscii(); |
| 45 | printStats(); |
| 46 | return 0; |
| 47 | } |