Minor changes

This commit is contained in:
Loic Guegan 2023-07-14 22:27:53 +02:00
parent af1b88d8fc
commit 1770c5f79e
4 changed files with 23 additions and 7 deletions

6
.gitignore vendored
View file

@ -1,3 +1,7 @@
# Binary
/client
/publisher
/publisher
/logger
# Logs
/logs

View file

@ -22,8 +22,8 @@ logger:
clean:
$(MAKE) clean -C src/publisher/
$(MAKE) clean -C src/client/
$(MAKE) clean -C src/logger/
$(MAKE) clean -C src/publisher/ OUT=$(PWD)
$(MAKE) clean -C src/client/ OUT=$(PWD)
$(MAKE) clean -C src/logger/ OUT=$(PWD)
.PHONY: clean publisher client logger

BIN
logger

Binary file not shown.

View file

@ -11,7 +11,7 @@
#include <sys/stat.h>
#include "../utils.h"
void start(char *power_path);
void start(char *power_path, char *busid, char *chipaddr);
int main (int argc, char *argv [])
{
@ -26,15 +26,27 @@ int main (int argc, char *argv [])
char *base=basename(argv[1]);
sscanf(base,"%[^-]-%[^-]",busid,chipaddr);
start("/home/loic/out.txt");
start("/home/loic/out.txt", busid,chipaddr);
return 0;
}
void start(char *power_path){
void start(char *power_path, char *busid, char *chipaddr){
if (access(power_path, F_OK) != 0){
printf("Could not read %s\n",power_path);
exit(2);
}
char outdir[255];
mkdir(STRINGIFY(LOGGER_DIR),0755);
sprintf(outdir,"%s/%s-%s/",STRINGIFY(LOGGER_DIR), busid,chipaddr);
mkdir(outdir,0755);
char outfile[255];
sprintf(outfile,"%s/%s",outdir,"flk");
printf("aa %s\n",outfile);
FILE *f;
f=fopen(outfile, "w");
fclose(f);
}