Commit 32774436 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Give varnishadm the ability to find -T and possibly -S arguments if given

a -n argument.




git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@4809 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 433eb798
......@@ -11,5 +11,6 @@ varnishadm_SOURCES = \
varnishadm_LDADD = \
$(top_builddir)/lib/libvarnish/libvarnish.la \
$(top_builddir)/lib/libvarnishapi/libvarnishapi.la \
$(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \
${PTHREAD_LIBS} ${NET_LIBS}
......@@ -44,6 +44,7 @@ SVNID("$Id$")
#include "cli.h"
#include "cli_common.h"
#include "libvarnish.h"
#include "varnishapi.h"
#include "vss.h"
static double timeout = 5;
......@@ -214,10 +215,16 @@ main(int argc, char * const *argv)
{
const char *T_arg = NULL;
const char *S_arg = NULL;
const char *n_arg = NULL;
struct VSL_data *vsd;
char *p;
int opt, sock;
while ((opt = getopt(argc, argv, "S:T:t:")) != -1) {
while ((opt = getopt(argc, argv, "n:S:T:t:")) != -1) {
switch (opt) {
case 'n':
n_arg = optarg;
break;
case 'S':
S_arg = optarg;
break;
......@@ -235,6 +242,25 @@ main(int argc, char * const *argv)
argc -= optind;
argv += optind;
if (n_arg != NULL) {
vsd = VSL_New();
assert(VSL_Arg(vsd, 'n', n_arg));
if (!VSL_Open(vsd)) {
if (T_arg == NULL) {
p = VSL_Find_Alloc(vsd, "Arg", "-T", NULL);
if (p != NULL) {
T_arg = strdup(p);
}
}
if (S_arg == NULL) {
p = VSL_Find_Alloc(vsd, "Arg", "-S", NULL);
if (p != NULL) {
S_arg = strdup(p);
}
}
}
}
if (T_arg == NULL)
usage();
......
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