This repository has been archived on 2026-03-18. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
netbenixCMD/utils/os_info.c
2020-06-02 11:23:12 +02:00

58 lines
927 B
C

#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);
}