Merge pull request #13 from kugiyasan/main

Rewrote bash commands to shell commands, solved #12
This commit is contained in:
TheDarkBug 2021-03-07 11:01:33 +01:00 committed by GitHub
commit ee22b5d581
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -110,7 +110,7 @@ void get_info() { // get all necessary info
memmove(&shell[0], &shell[5], 16);
// os version
FILE *fos_rel = popen("cut -d '=' -f2 <<< $(cat /etc/os-release | grep ID=) 2> /dev/null", "r");
FILE *fos_rel = popen("cat /etc/os-release | grep ID= | cut -d '=' -f2 2> /dev/null", "r");
fscanf(fos_rel,"%[^\n]", version_name);
fclose(fos_rel);
@ -118,7 +118,7 @@ void get_info() { // get all necessary info
if (sysinfo(&sys) == -1) printf("There was some kind of error while getting system info\n");
// cpu and ram
FILE *fcpu = popen("sed 's/ //g' <<< $(cut -d ':' -f2 <<< $(lscpu | grep 'Model name:')) 2> /dev/null", "r");
FILE *fcpu = popen("lscpu | grep 'Model name:' | cut -d ':' -f2 | sed 's/ //g' 2> /dev/null", "r");
fscanf(fcpu, "%[^\n]", cpu_model);
fclose(fcpu);
ram_max = sys.totalram * sys.mem_unit / 1048576;