Inital Commit
This commit is contained in:
commit
cc95ff1c3a
22 changed files with 1166 additions and 0 deletions
58
utils/os_info.c
Normal file
58
utils/os_info.c
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
#ifdef _WIN32 || _WIN64
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifdef linux
|
||||
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <malloc.h>
|
||||
#include <string.h>
|
||||
#include "os_info.h"
|
||||
#include "logger.h"
|
||||
|
||||
char* getOS(){
|
||||
char *os;
|
||||
os = malloc(sizeof (char) * 20);
|
||||
|
||||
#ifdef _WIN32 || _WIN64
|
||||
strcpy(os, "Windows");
|
||||
#endif
|
||||
#ifdef linux
|
||||
strcpy(os, "Linux");
|
||||
#endif
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
char* getArch(){
|
||||
char *arch;
|
||||
arch = malloc(sizeof(char) * 20);
|
||||
|
||||
#ifdef __amd64
|
||||
strcpy(arch, "64-Bit");
|
||||
#else
|
||||
strcpy(arch, "32-Bit");
|
||||
#endif
|
||||
|
||||
return arch;
|
||||
}
|
||||
|
||||
void print_Specs(){
|
||||
printf("OS: %s\n", getOS());
|
||||
printf("Architecture: %s\n", getArch());
|
||||
free(NULL);
|
||||
}
|
||||
|
||||
void log_Specs(){
|
||||
char buffer[1024];
|
||||
logger("[INFO] System Information:");
|
||||
snprintf(buffer, sizeof(buffer), "[INFO] OS: %s", getOS());
|
||||
logger(buffer);
|
||||
snprintf(buffer, sizeof(buffer), "[INFO] Architecture: %s", getArch());
|
||||
logger(buffer);
|
||||
free(NULL);
|
||||
}
|
||||
Reference in a new issue