[bugfix & refactor] comment 2 important functions out of the main file, added helper functions to handle the future data

This commit is contained in:
Abdellah El Morabit 2025-10-12 23:21:26 +02:00
parent 6945d36f6f
commit 0ffd6627ed
2 changed files with 20 additions and 21 deletions

View File

@ -1,4 +1,7 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.12) CMAKE_MINIMUM_REQUIRED(VERSION 3.24)
SET(CMAKE_C_STANDARD 23)
SET(CMAKE_C_STANDARD_REQUIRED TRUE)
PROJECT(synf-core) PROJECT(synf-core)

View File

@ -5,8 +5,13 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
/* void *gather_cpu_information();
cJSON convert_to_json() { void *gather_ram_information();
void *gather_disk_information();
void *gather_device_information();
/*
cJSON convert_to_json() {
cJSON *root = cJSON_CreateObject(); cJSON *root = cJSON_CreateObject();
cJSON_AddStringToObject(root, "cpu", info.cpu->name); cJSON_AddStringToObject(root, "cpu", info.cpu->name);
@ -16,7 +21,6 @@
return *root; return *root;
} }
* */
void handler(char *url) { void handler(char *url) {
CURL *curl; CURL *curl;
@ -29,7 +33,6 @@ void handler(char *url) {
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST"); curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_URL, url); curl_easy_setopt(curl, CURLOPT_URL, url);
// TO DO // TO DO
// parse the object to a json and pass that as an argument to post it // parse the object to a json and pass that as an argument to post it
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, NULL); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, NULL);
@ -44,26 +47,22 @@ void handler(char *url) {
curl_global_cleanup(); curl_global_cleanup();
} }
void setup_mt() {
pthread_t cpu_t,ram_t; // disk_t , device_t;
pthread_create(&cpu_t, NULL, cpu_i, NULL); */
pthread_create(&ram_t, NULL, ram_i, NULL);
// pthread_create(&disk_t, NULL, disk_i, NULL);
// pthread_create(&device_t, NULL, device_i, NULL);
pthread_join(cpu_t, NULL);
pthread_join(ram_t, NULL);
// pthread_join(disk_t, NULL);
// pthread_join(device_t, NULL);
}
#ifdef __APPLE__ #ifdef __APPLE__
int main(int argc, char** argv) { int main(int argc, char** argv) {
setup_mt(); #if __STDC_VERSION__
handler("api.nsrddyn.com"); printf("C standard version: %ld\n", __STDC_VERSION__);
#else
printf("C standard not defined\n");
#endif
// handler("api.nsrddyn.com");
return 0; return 0;
} }
@ -72,11 +71,8 @@ int main(int argc, char** argv) {
#ifdef __gnu_linux #ifdef __gnu_linux
int main(int argc, char** argv) { int main(int argc, char** argv) {
setup_mt();
return 0; return 0;
} }