This commit is contained in:
Jonathan Wyss 2024-09-11 17:45:08 +02:00
parent 43c206b4e7
commit 1b991bfbf4
2 changed files with 17 additions and 4 deletions

View File

@ -22,7 +22,6 @@ int loadConfig(char *file, char **str_entry,int size)
if(fgets(temp_str,256,f_config)!=NULL)
{
temp_str[strcspn(temp_str,"\n")]=0;
str_entry[i]=strdup(temp_str);
printf("module path:%s",str_entry[i]);
}
@ -39,3 +38,13 @@ int loadConfig(char *file, char **str_entry,int size)
}
return 0;
}
/*int parseConfig(File *file, char *str_entry)
{
char sub_str[256];
if(strcmp(str_entry,"[Host]")==0)//section
{
fgets(sub_str,256,file);
//do sub parsing
}
}*/

10
main.c
View File

@ -4,11 +4,12 @@
#include<string.h>
#include<dbus/dbus.h>
#include<stdbool.h>
#include<time.h>
#include"config.h"
#define HELP_TEXT "requires a command\n--\ngetSendStatus [objectpath]\nlistUnits\nconfig [configfile]\nset token with GOTIFY_TOKEN=\"sjdfoiasfd\"\n--\n"
int gotify_message(char *,char *,char *);
int systemdCall(DBusConnection *,char *, char *);
int checkIsActive(DBusConnection *connection, char *service_name);
@ -32,11 +33,14 @@ typedef struct service
int main(int argc,char *argv[])
{
//int i;
//Service serviceSys;
DBusConnection *connection=NULL;
DBusError error;
clock_t time;
time = clock();
printf("time:%f\n",(float)time / CLOCKS_PER_SEC);
dbus_error_init(&error);
connection = dbus_bus_get(DBUS_BUS_SYSTEM,&error);//DBUS_BUS_SYSTEM DBUS_BUS_SESSION
if(dbus_error_is_set(&error))