Mailing List Archive

r1549 - trunk/varnish-cache/bin/varnishd
Author: phk
Date: 2007-06-25 08:46:34 +0200 (Mon, 25 Jun 2007)
New Revision: 1549

Modified:
trunk/varnish-cache/bin/varnishd/mgt_vcc.c
Log:
Also tun the compiled VCL through cc(1) and try to load it into mgt process
when -C is specified, this makes it easier to do completeness test on the
VRT interface.


Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2007-06-25 06:14:40 UTC (rev 1548)
+++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2007-06-25 06:46:34 UTC (rev 1549)
@@ -237,26 +237,34 @@
/*--------------------------------------------------------------------*/

static char *
-mgt_VccCompile(struct vsb *sb, const char *b, const char *e)
+mgt_VccCompile(struct vsb *sb, const char *b, const char *e, int C_flag)
{
char *csrc, *vf = NULL;

csrc = VCC_Compile(sb, b, e);
if (csrc != NULL) {
+ if (C_flag)
+ fputs(csrc, stdout);
vf = mgt_CallCc(csrc, sb);
+ if (C_flag && vf != NULL)
+ AZ(unlink(vf));
free(csrc);
}
return (vf);
}

static char *
-mgt_VccCompileFile(struct vsb *sb, const char *fn)
+mgt_VccCompileFile(struct vsb *sb, const char *fn, int C_flag)
{
char *csrc, *vf = NULL;

csrc = VCC_CompileFile(sb, fn);
if (csrc != NULL) {
+ if (C_flag)
+ fputs(csrc, stdout);
vf = mgt_CallCc(csrc, sb);
+ if (C_flag && vf != NULL)
+ AZ(unlink(vf));
free(csrc);
}
return (vf);
@@ -308,7 +316,7 @@
int
mgt_vcc_default(const char *b_arg, const char *f_arg, int C_flag)
{
- char *addr, *port, *csrc;
+ char *addr, *port;
char *buf, *vf;
struct vsb *sb;
struct vclprog *vp;
@@ -338,20 +346,10 @@
free(addr);
free(port);
AN(buf);
- if (C_flag) {
- csrc = VCC_Compile(sb, buf, NULL);
- if (csrc != NULL)
- fputs(csrc, stdout);
- }
- vf = mgt_VccCompile(sb, buf, NULL);
+ vf = mgt_VccCompile(sb, buf, NULL, C_flag);
free(buf);
- } else if (C_flag) {
- csrc = VCC_CompileFile(sb, f_arg);
- if (csrc != NULL)
- fputs(csrc, stdout);
- vf = NULL;
} else {
- vf = mgt_VccCompileFile(sb, f_arg);
+ vf = mgt_VccCompileFile(sb, f_arg, C_flag);
}
vsb_finish(sb);
if (vsb_len(sb) > 0) {
@@ -432,7 +430,7 @@

sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND);
XXXAN(sb);
- vf = mgt_VccCompile(sb, av[3], NULL);
+ vf = mgt_VccCompile(sb, av[3], NULL, 0);
vsb_finish(sb);
if (vsb_len(sb) > 0) {
cli_out(cli, "%s", vsb_data(sb));
@@ -463,7 +461,7 @@

sb = vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND);
XXXAN(sb);
- vf = mgt_VccCompileFile(sb, av[3]);
+ vf = mgt_VccCompileFile(sb, av[3], 0);
vsb_finish(sb);
if (vsb_len(sb) > 0) {
cli_out(cli, "%s", vsb_data(sb));
r1549 - trunk/varnish-cache/bin/varnishd [ In reply to ]
In message <20070625064635.0A2C11EC294 at projects.linpro.no>, phk at projects.linpro
.no writes:
>Author: phk
>Date: 2007-06-25 08:46:34 +0200 (Mon, 25 Jun 2007)
>New Revision: 1549
>
>Modified:
> trunk/varnish-cache/bin/varnishd/mgt_vcc.c
>Log:
>Also tun the compiled VCL through cc(1) and try to load it into mgt process

s/tun/run/ obviously

--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.