command line parameter for passing uuid

master
Gerard Wagener 2019-02-08 16:14:25 +01:00
parent a1dc701138
commit e3b3916fb9
1 changed files with 7 additions and 1 deletions

View File

@ -43,6 +43,7 @@
#define NBINS 1024 //Number of bins #define NBINS 1024 //Number of bins
#define NBINITEMS 255 //Number of items per bin #define NBINITEMS 255 //Number of items per bin
#define SZBIN 4 #define SZBIN 4
#define SZUUID 40
#define NBINSCALE 2 // Scaling factor of the entire datastructure #define NBINSCALE 2 // Scaling factor of the entire datastructure
#define HDBG(...) if (HASHDEBUG) fprintf(stderr, __VA_ARGS__) #define HDBG(...) if (HASHDEBUG) fprintf(stderr, __VA_ARGS__)
@ -78,6 +79,7 @@ typedef struct pibs_s {
int errno_copy; int errno_copy;
int errno_pibs; int errno_pibs;
char *filename; char *filename;
char *uuid;
int should_dump_table; int should_dump_table;
int show_backscatter; int show_backscatter;
int show_stats; int show_stats;
@ -335,6 +337,7 @@ pibs_t* init(void)
pibs->data_size = sizeof(pibs_header_t) + NBINSCALE * NBINS * SZBIN * NBINITEMS * sizeof(item_t); pibs->data_size = sizeof(pibs_header_t) + NBINSCALE * NBINS * SZBIN * NBINITEMS * sizeof(item_t);
pibs->data = calloc(pibs->data_size,1); pibs->data = calloc(pibs->data_size,1);
pibs->filename = calloc(FILENAME_MAX,1); pibs->filename = calloc(FILENAME_MAX,1);
pibs->uuid = calloc(SZUUID,1);
printf("#Internal look up structure size in bytes: %ld\n", pibs->data_size); printf("#Internal look up structure size in bytes: %ld\n", pibs->data_size);
// Build header // Build header
pibs->data[0]='P'; pibs->data[0]='P';
@ -408,7 +411,7 @@ int main(int argc, char* argv[])
fprintf(stderr, "[INFO] pid = %d\n",(int)getpid()); fprintf(stderr, "[INFO] pid = %d\n",(int)getpid());
while ((opt = getopt(argc, argv, "r:dbsni:a")) != -1) { while ((opt = getopt(argc, argv, "r:dbsni:au:")) != -1) {
switch (opt) { switch (opt) {
case 'r': case 'r':
strncpy(pibs->filename, optarg, FILENAME_MAX); strncpy(pibs->filename, optarg, FILENAME_MAX);
@ -431,6 +434,9 @@ int main(int argc, char* argv[])
case 'a': case 'a':
pibs->should_attach = 1; pibs->should_attach = 1;
break; break;
case 'u':
strncpy(pibs->uuid, optarg, SZUUID);
break;
default: /* '?' */ default: /* '?' */