chg: [pibs] read redis server and port parameters from cli

master
Gerard Wagener 2019-02-08 17:45:40 +01:00
parent ea10cc2601
commit e8c3631c96
1 changed files with 11 additions and 1 deletions

View File

@ -45,6 +45,7 @@
#define SZBIN 4
#define SZUUID 40
#define SZKEY 1024
#define SZSERVER 1024
#define NBINSCALE 2 // Scaling factor of the entire datastructure
#define HDBG(...) if (HASHDEBUG) fprintf(stderr, __VA_ARGS__)
@ -82,6 +83,8 @@ typedef struct pibs_s {
char *filename;
char *uuid;
char *key;
char *server;
uint16_t port;
int should_dump_table;
int show_backscatter;
int show_stats;
@ -341,6 +344,7 @@ pibs_t* init(void)
pibs->filename = calloc(FILENAME_MAX,1);
pibs->uuid = calloc(SZUUID,1);
pibs->key = calloc(SZKEY,1);
pibs->server = calloc(SZSERVER,1);
printf("#Internal look up structure size in bytes: %ld\n", pibs->data_size);
// Build header
pibs->data[0]='P';
@ -414,7 +418,7 @@ int main(int argc, char* argv[])
fprintf(stderr, "[INFO] pid = %d\n",(int)getpid());
while ((opt = getopt(argc, argv, "r:dbsni:au:")) != -1) {
while ((opt = getopt(argc, argv, "r:dbsni:au:z:p:")) != -1) {
switch (opt) {
case 'r':
strncpy(pibs->filename, optarg, FILENAME_MAX);
@ -440,6 +444,12 @@ int main(int argc, char* argv[])
case 'u':
strncpy(pibs->uuid, optarg, SZUUID);
break;
case 'z':
strncpy(pibs->server,optarg, SZSERVER);
break;
case 'p':
pibs->port=atoi(optarg);
break;
default: /* '?' */