#include #include #include #include #include #include #include "utils.h" #ifndef LOGGERS_DELAY #define LOGGERS_DELAY 0 #endif // Global: char *__client; char __logdir[STATIC_LEN]; char __regpower[STATIC_LEN]; int __loginterval; unsigned char __stop=0; void sighandler(int signo){ if (signo == SIGINT){ printf("Stopping...\n"); __stop=1; } } int main (int argc, char *argv []) { if(argc != 4){ printf("Usage: %s ",argv[0]); exit(1); } //----- Init global variables __client=argv[2]; __loginterval=atoi(argv[3]); // __logdir: strcat(__logdir,argv[1]); strcat(__logdir,"/"); strcat(__logdir,__client); // __regpower: strcat(__regpower,INA260_SYSFS); strcat(__regpower,"/"); strcat(__regpower,__client); strcat(__regpower,"/"); strcat(__regpower,INA260_POWER_REGISTER); //----- Sanity checks signal(SIGINT,sighandler); mkdirp(__logdir); if(__loginterval 0 usleep(LOGGERS_DELAY*1000); #endif printf("Tick\n"); fflush(stdout); } fclose(logptr); } fclose(regptr); return 0; }