This commit is contained in:
Jonathan Santis 2024-09-11 11:14:30 +02:00
parent 1d7cad30c7
commit 632efc640d
3 changed files with 24 additions and 25 deletions

1
config
View File

@ -2,4 +2,3 @@
/systemd/blalbla/2
/systemd/blalbla/3
/systemd/blalbla/4
/systemd/blalbla/5

View File

@ -11,12 +11,6 @@ int loadConfig(char *file, char **str_entry,int size)
FILE *f_config;
char temp_str[64];
for(i=0;str_entry[i];i++)
{
printf("\nentry: %s",str_entry[i]);
}
printf("\nopening config file\n");
f_config = fopen("config","r");
if(f_config != NULL)
@ -27,9 +21,8 @@ int loadConfig(char *file, char **str_entry,int size)
printf("str:%s\n",str_entry[i]);
if(fgets(temp_str,64,f_config)!=NULL)
{
printf("fgets:%s",temp_str);
str_entry[i]=strdup(temp_str);
printf("str_entry:%s",str_entry[i]);
printf("module path:%s",str_entry[i]);
}
else
{

41
main.c
View File

@ -6,6 +6,8 @@
#include<stdbool.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 *);
@ -69,29 +71,34 @@ int main(int argc,char *argv[])
{
systemdCall(connection,"ListUnits",NULL);
}
else
else if(strcmp(argv[1],"config")==0)
{
fprintf(stderr,"Unknown command");
}
}
else
if(argc>2)
{
fprintf(stderr,"requires a command\n--\n# getSendStatus [objectpath]\n# listUnits\n#set token with GOTIFY_TOKEN=\"sjdfoiasfd\"\n--\n");
}
char *str_entry[64];
Service service1;
char *str_entry[64]={'\0'};
int i=0;
str_entry[0]="asdhfasfd";
str_entry[1]="asdhfasfd";
str_entry[3]="asdhfasfd";
for(i=0;i<64;i++)
loadConfig(argv[2],str_entry,64);
for(i=0;str_entry[i];i++)
{
str_entry[i]="empty";
printf("test string:%s\n",str_entry[i]);
printf("entry in config:%s\n",str_entry[i]);
}
}
else
{
fprintf(stderr,"config requires a config file as argument");
}
}
else
{
fprintf(stderr,"Unknown command\n%s",HELP_TEXT);
}
}
else
{
fprintf(stderr,HELP_TEXT);
}
loadConfig("config",str_entry,10);
return 0;
}
/*interactive