commit ebe83ef8615f537a76f53f113ac9210abffc0462
parent 133bb33a6f7609a10addaa1cc0cc5f37fdf19c01
Author: dwzg <dennis@wtzg.de>
Date: Wed, 22 Apr 2020 21:38:09 +0200
Add product version to host
Diffstat:
1 file changed, 15 insertions(+), 0 deletions(-)
diff --git a/paleofetch.c b/paleofetch.c
@@ -143,11 +143,26 @@ char *get_host() {
fread(host, 1, BUF_SIZE, product_name);
fclose(product_name);
+ FILE *product_version = fopen("/sys/devices/virtual/dmi/id/product_version", "r");
+
+ if(product_version == NULL) {
+ status = -1;
+ halt_and_catch_fire("unable to open product version file");
+ }
+
+ char version[BUF_SIZE];
+
+ fread(version, 1, BUF_SIZE, product_version);
+ fclose(product_version);
+
// trim trailing newline
char *s = host;
while(*(++s) != '\n') ;
*s = '\0';
+ strcat(host, " ");
+ strcat(host, version);
+
return host;
}