This commit is contained in:
Jonathan Santis 2024-09-11 09:43:33 +02:00
parent 15d14d5099
commit 39b0ed19ae
3 changed files with 24 additions and 2 deletions

View File

@ -1 +1 @@
gcc main.c -lcurl -Wall -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -ldbus-1
gcc main.c config.c -lcurl -Wall -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -ldbus-1

4
compile_flags.txt Normal file
View File

@ -0,0 +1,4 @@
-lcurl
-I/usr/include/dbus-1.0
-I/usr/lib/dbus-1.0/include
-ldbus-1

20
main.c
View File

@ -4,6 +4,8 @@
#include<string.h>
#include<dbus/dbus.h>
#include<stdbool.h>
#include"config.h"
int gotify_message(char *,char *,char *);
int systemdCall(DBusConnection *,char *, char *);
@ -11,6 +13,7 @@ int checkIsActive(DBusConnection *connection, char *service_name);
int systemdUnitCall(DBusConnection *connection,char *target,char *method,char *param,char **result);
int GetSendStatus(DBusConnection *connection,char *objectpath);
int checkState(char *ServiceName,char *result);
/*
*sytemctl show gotify-server | grep PID
*sudo busctl tree org.freedesktop.systemd1 > get object paths
@ -26,7 +29,6 @@ typedef struct service
int main(int argc,char *argv[])
{
//int i;
//Service serviceSys;
DBusConnection *connection=NULL;
@ -76,6 +78,20 @@ int main(int argc,char *argv[])
{
fprintf(stderr,"requires a command\n--\n# getSendStatus [objectpath]\n# listUnits\n#set token with GOTIFY_TOKEN=\"sjdfoiasfd\"\n--\n");
}
char *str_entry[64];
int i=0;
str_entry[0]="asdhfasfd";
str_entry[1]="asdhfasfd";
str_entry[3]="asdhfasfd";
for(i=0;i<64;i++)
{
str_entry[i]="empty";
printf("test string:%s\n",str_entry[i]);
}
loadConfig("config",str_entry,10);
return 0;
}
/*interactive
@ -455,6 +471,8 @@ int systemdUnitCall(DBusConnection *connection,char *target,char *method,char *p
}
return 0;
}
/*
int checkIsActive(DBusConnection *connection, char *service_name)
{