summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2023-07-15 12:14:22 +0200
committerLoic Guegan <manzerbredes@mailbox.org>2023-07-15 12:14:22 +0200
commit3da360332b38ba50e2a03f4b9287bc916523e492 (patch)
tree7aff4d4a9cc3d1c2a9c5450cb2b3f22611f5dad2
parent5056c0636009ff72a976e366b1496d5a98d47f75 (diff)
Minor changes
-rw-r--r--jean0
-rw-r--r--src/publisher.c31
-rw-r--r--src/utils.h3
3 files changed, 34 insertions, 0 deletions
diff --git a/jean b/jean
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/jean
diff --git a/src/publisher.c b/src/publisher.c
index afbf45d..8764294 100644
--- a/src/publisher.c
+++ b/src/publisher.c
@@ -5,11 +5,42 @@
#include <zmq.h>
#include <assert.h>
#include <time.h>
+#include <dirent.h>
#include "utils.h"
+// Global:
+char *__logdir;
+int __loginterval;
+
int main (int argc, char *argv [])
{
+ if(argc != 3){
+ printf("Usage: %s <abslogdir> <loginterval>",argv[0]);
+ exit(1);
+ }
+
+ //----- Init global variables
+ __logdir=argv[1];
+ __loginterval=atoi(argv[2]);
+
+ DIR *dr = opendir(__logdir);
+ struct dirent *de; // Pointer for directory entry
+ for(int i=0;i<0;i++){
+ int interval=INTERVAL(__loginterval);
+ int interval_next=INTERVAL_NEXT(__loginterval);
+ while ((de = readdir(dr)) != NULL){
+ if(strcmp(de->d_name,".") && strcmp(de->d_name,"..")){
+ char *client=de->d_name;
+ printf("aa%s\n",client);
+ }
+ }
+ }
+ closedir(dr);
+
+
+
+ return 0;
// Prepare our context and publisher
void *context = zmq_ctx_new ();
void *publisher = zmq_socket (context, ZMQ_PUB);
diff --git a/src/utils.h b/src/utils.h
index 01e0c33..af74328 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -18,6 +18,9 @@
#define INTERVAL(duration)\
((TIMESTAMP()) - ((TIMESTAMP())%(duration)))
+#define INTERVAL_NEXT(duration)\
+ ((INTERVAL(duration))+(duration))
+
#define INTERVAL_LAST(duration)\
(INTERVAL(INTERVAL((TIMESTAMP()),(duration))-1,(duration)))