changed the comments to fit

This commit is contained in:
4zv4l 2021-11-03 15:37:40 +01:00
parent cda6cfcae4
commit c02b53bc8a

View file

@ -666,12 +666,12 @@ void get_info()
#else #else
FILE *cpuinfo = popen("sysctl -a | egrep -i 'hw.model'", "r"); FILE *cpuinfo = popen("sysctl -a | egrep -i 'hw.model'", "r");
#endif #endif
FILE *host_model_info = fopen("/etc/hostname","r"); FILE *host_model_info = fopen("/etc/hostname","r"); // try open /etc/hostname first
if (!host_model_info) if (!host_model_info)
host_model_info = fopen("/sys/devices/virtual/dmi/id/board_name", "r"); // first try open the file host_model_info = fopen("/sys/devices/virtual/dmi/id/board_name", "r"); // if couldn't then try another
if (!host_model_info) // if failed if (!host_model_info) // if failed
host_model_info = fopen("/sys/devices/virtual/dmi/id/product_name", "r"); // try open another file host_model_info = fopen("/sys/devices/virtual/dmi/id/product_name", "r"); // etc.
if(host_model_info) { if(host_model_info) { // if succeeded to open one of the file
fgets(line, 256, host_model_info); fgets(line, 256, host_model_info);
line[strlen(line)-1] = '\0'; line[strlen(line)-1] = '\0';
sprintf(host_model,"%s",line); sprintf(host_model,"%s",line);