Commit 8f15d608 authored by Geoff Simmons's avatar Geoff Simmons

add the -N CLI option (config param varnish.file)

parent 1bb84661
......@@ -117,6 +117,7 @@ CONF_Add(const char *lval, const char *rval)
confString("pid.file", pid_file);
confString("varnish.name", varnish_name);
confString("varnish.file", vsmfile);
confString("log.file", log_file);
confString("varnish.bindump", varnish_bindump);
confString("mq.module", mq_module);
......@@ -206,6 +207,7 @@ CONF_Init(void)
strcpy(config.pid_file, "/var/run/trackrdrd.pid");
config.varnish_name[0] = '\0';
config.vsmfile[0] = '\0';
config.log_file[0] = '\0';
config.varnish_bindump[0] = '\0';
config.syslog_facility = LOG_LOCAL0;
......@@ -255,6 +257,7 @@ CONF_Dump(int level)
{
confdump(level, "pid.file = %s", config.pid_file);
confdump(level, "varnish.name = %s", config.varnish_name);
confdump(level, "varnish.file = %s", config.vsmfile);
confdump(level, "log.file = %s",
strcmp(config.log_file,"-") == 0 ? "stdout" : config.log_file);
confdump(level, "varnish.bindump = %s", config.varnish_bindump);
......
......@@ -21,7 +21,7 @@ CMD="../trackrdrd -D -f varnish.binlog -l - -d -c test.conf"
# the user running it
CKSUM=$( $CMD | sed -e 's/\(initializing\) \(.*\)/\1/' | sed -e 's/\(Running as\) \([a-zA-Z0-9]*\)$/\1/' | grep -v 'Not running as root' | cksum)
if [ "$CKSUM" != '1219831915 249619' ]; then
if [ "$CKSUM" != '1821498238 249681' ]; then
echo "ERROR: Regression test incorrect log cksum: $CKSUM"
exit 1
fi
......
......@@ -222,7 +222,7 @@ main(int argc, char * const *argv)
{
int c, d_flag = 0, D_flag = 0, err;
const char *P_arg = NULL, *l_arg = NULL, *n_arg = NULL, *f_arg = NULL,
*y_arg = NULL, *c_arg = NULL, *u_arg = NULL;
*y_arg = NULL, *c_arg = NULL, *u_arg = NULL, *N_arg = NULL;
pid_t child_pid;
CONF_Init();
......@@ -234,7 +234,7 @@ main(int argc, char * const *argv)
}
cli_config_filename[0] = '\0';
while ((c = getopt(argc, argv, "u:P:Vn:hl:df:y:c:D")) != -1) {
while ((c = getopt(argc, argv, "u:P:Vn:hl:df:y:c:DN:")) != -1) {
switch (c) {
case 'P':
P_arg = optarg;
......@@ -245,6 +245,9 @@ main(int argc, char * const *argv)
case 'n':
n_arg = optarg;
break;
case 'N':
N_arg = optarg;
break;
case 'l':
l_arg = optarg;
break;
......@@ -282,8 +285,10 @@ main(int argc, char * const *argv)
if (CONF_ReadFile(c_arg, CONF_Add) != 0)
exit(EXIT_FAILURE);
}
if (f_arg && n_arg)
if (n_arg && N_arg)
usage(EXIT_FAILURE);
if (f_arg && (n_arg || N_arg))
usage(EXIT_FAILURE);
if (l_arg && y_arg)
usage(EXIT_FAILURE);
......@@ -310,10 +315,11 @@ main(int argc, char * const *argv)
bprintf(config.varnish_name, "%s", n_arg);
if (l_arg)
bprintf(config.log_file, "%s", l_arg);
if (f_arg) {
if (f_arg)
bprintf(config.varnish_bindump, "%s", f_arg);
}
if (N_arg)
bprintf(config.vsmfile, "%s", N_arg);
if (LOG_Open(PACKAGE_NAME) != 0) {
exit(EXIT_FAILURE);
}
......
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