#include #include #include #include #include #include #include #include #include "utils.h" #include #ifndef LOGGER_DELAY #define LOGGER_DELAY 0 #endif // Global: char *__client; char __logdir[255]; char __regpower[100]; int __loginterval; 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 mkdirp(__logdir); if(__loginterval 0 usleep(LOGGER_DELAY*1000); #endif printf("Tick\n"); fflush(stdout); } fclose(logptr); } fclose(regptr); return 0; }