Minor changes

This commit is contained in:
Loic Guegan 2023-07-15 12:14:22 +02:00
parent 5056c06360
commit 3da360332b
3 changed files with 34 additions and 0 deletions

0
jean Normal file
View file

View file

@ -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);

View file

@ -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)))