diff options
| author | Anser <rostgans@tutamail.com> | 2026-08-11 00:18:57 +0200 |
|---|---|---|
| committer | Anser <rostgans@tutamail.com> | 2026-08-11 00:18:57 +0200 |
| commit | eb6f986361713d6ce47c6d4572bb24d9f6207ddf (patch) | |
| tree | 3fca62d5cad785acce36a46a660219840c959932 /src/modules/cpu/cpu.c | |
| parent | 9ad584b5762433f7c99d7cc7b65ad21ebe4ff932 (diff) | |
TOBESQUISHED: safe in reconstruction of the codes layout and rework of information handeling also ascii art printing
Diffstat (limited to 'src/modules/cpu/cpu.c')
| -rw-r--r-- | src/modules/cpu/cpu.c | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/src/modules/cpu/cpu.c b/src/modules/cpu/cpu.c deleted file mode 100644 index a6dac93..0000000 --- a/src/modules/cpu/cpu.c +++ /dev/null @@ -1,48 +0,0 @@ -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include "cpu.h" -#include "../utils/utils.h" - -int cpu(void) { - FILE* file = fopen("/proc/cpuinfo", "r"); - - //check file existence - if (!file) { - perror("/proc/cpuinfo not found"); - return 1; - } - - char line[256]; - char *model_name = NULL; - - //read per line - while (fgets(line, sizeof(line), file)) { - char* p = strstr(line, "model name"); - - if (p != NULL) { - model_name = strchr(p, ':') + 1; //skip : - break; - } - } - - if (model_name != NULL) { - char *string = string_format(model_name); - - if (string == NULL) { - printf("CPU: Error string not found.\n"); - free(string); - model_name = NULL; - } else { - printf("CPU: %s\n", string); - free(string); - model_name = NULL; - } - - } else { - printf("CPU: Error model_name not found.\n"); - } - - fclose(file); - return 0; -} |
