summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2023-07-15 13:54:03 +0200
committerLoic Guegan <manzerbredes@mailbox.org>2023-07-15 13:54:03 +0200
commitb80973cbd05664dc10a15ae3306726daa335997c (patch)
tree1f9910e07e987a30b41d36b445da434bb1cb7e7a /src
parenta37251135ec3c91b5fb7312d30533111f94263e1 (diff)
Minor changes
Diffstat (limited to 'src')
-rw-r--r--src/logger.c2
-rw-r--r--src/publisher.c10
2 files changed, 6 insertions, 6 deletions
diff --git a/src/logger.c b/src/logger.c
index 3ba934e..8798db4 100644
--- a/src/logger.c
+++ b/src/logger.c
@@ -60,7 +60,7 @@ int main (int argc, char *argv [])
int power;
time_t interval;
- for(int i=0;i<1;i++){
+ while(1){
interval=INTERVAL(__loginterval);
*logfilepath='\0';
sprintf(logfilepath,"%s/%ld",__logdir,interval);
diff --git a/src/publisher.c b/src/publisher.c
index 0068a56..bc1af69 100644
--- a/src/publisher.c
+++ b/src/publisher.c
@@ -40,11 +40,11 @@ int main (int argc, char *argv [])
}
//----- Start publisher
- DIR *dr = opendir(__logdir);
struct dirent *de; // Pointer for directory entry
- for(int i=0;i<=0;i++){
+ while(1){
int interval=INTERVAL(__loginterval);
int interval_next=INTERVAL_NEXT(__loginterval);
+ DIR *dr = opendir(__logdir);
while ((de = readdir(dr)) != NULL){
if(strcmp(de->d_name,".") && strcmp(de->d_name,"..")){
char *client=de->d_name;
@@ -61,12 +61,12 @@ int main (int argc, char *argv [])
// Send current one
if(FILE_EXISTS(logfile)){
publish(logfile,client,interval);
+ remove(logfile);
}
}
}
+ closedir(dr);
}
- closedir(dr);
-
zmq_close (publisher);
zmq_ctx_destroy (context);
@@ -89,5 +89,5 @@ int main (int argc, char *argv [])
}
void publish(char *filepath, char* client, int interval){
-
+ printf("Publish!\n");
} \ No newline at end of file