Commit d7b6dcf3 authored by Geoff Simmons's avatar Geoff Simmons

varnishevent: fix reading from a varnishlog binary dump

parent 67d9dfbc
......@@ -535,13 +535,15 @@ main(int argc, char *argv[])
int c, errnum, finite = 0, a_flag = 0, g_flag = 0, D_flag = 0,
format_flag = 0;
const char *P_arg = NULL, *w_arg = NULL;
char scratch[BUFSIZ], cformat[BUFSIZ];
char scratch[BUFSIZ];
struct vpf_fh *pfh = NULL;
vd = VSM_New();
VSL_Setup(vd);
cformat[0] = '\0';
CONF_Init();
read_default_config();
while ((c = getopt(argc, argv, VSL_ARGS "aDP:Vw:fF:gG:")) != -1) {
switch (c) {
case 'a':
......@@ -552,7 +554,7 @@ main(int argc, char *argv[])
fprintf(stderr, "-f and -F can not be combined\n");
exit(1);
}
strcpy(cformat, ALT_CFORMAT);
strcpy(config.cformat, ALT_CFORMAT);
format_flag = 1;
break;
case 'F':
......@@ -561,7 +563,7 @@ main(int argc, char *argv[])
exit(1);
}
format_flag = 1;
strcpy(cformat, optarg);
strcpy(config.cformat, optarg);
break;
case 'D':
D_flag = 1;
......@@ -581,11 +583,6 @@ main(int argc, char *argv[])
case 'G':
strcpy(cli_config_filename, optarg);
break;
case 'r':
if (VSL_Arg(vd, c, optarg) > 0)
usage();
finite = 1;
break;
case 'b':
case 'i':
case 'I':
......@@ -596,15 +593,16 @@ main(int argc, char *argv[])
case 'm':
m_flag = 1; /* Fall through */
default:
if (c == 'r') {
finite = 1;
strcpy(config.varnish_bindump, optarg);
}
if (VSL_Arg(vd, c, optarg) > 0)
break;
usage();
}
}
CONF_Init();
read_default_config();
if (! EMPTY(cli_config_filename)) {
printf("Reading config from %s\n", cli_config_filename);
if (CONF_ReadFile(cli_config_filename) != 0) {
......@@ -614,9 +612,6 @@ main(int argc, char *argv[])
}
}
if (! EMPTY(cformat))
strcpy(config.cformat, cformat);
if (VSL_Open(vd, 1))
exit(1);
......@@ -681,11 +676,15 @@ main(int argc, char *argv[])
exit(EXIT_FAILURE);
}
strcpy(scratch, VSM_Name(vd));
if (EMPTY(scratch))
LOG_Log0(LOG_INFO, "Reading default varnish instance");
else
LOG_Log(LOG_INFO, "Reading varnish instance %s", scratch);
if (!EMPTY(config.varnish_bindump))
LOG_Log(LOG_INFO, "Reading from file: %s", config.varnish_bindump);
else {
strcpy(scratch, VSM_Name(vd));
if (EMPTY(scratch))
LOG_Log0(LOG_INFO, "Reading default varnish instance");
else
LOG_Log(LOG_INFO, "Reading varnish instance %s", scratch);
}
strcpy(scratch, FMT_Get_i_Arg());
if (EMPTY(scratch)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment