r1352 - in branches/1.0: . bin/varnishd
des at projects.linpro.no
des at projects.linpro.no
Thu Apr 19 16:51:17 CEST 2007
Author: des
Date: 2007-04-19 16:51:17 +0200 (Thu, 19 Apr 2007)
New Revision: 1352
Modified:
branches/1.0/
branches/1.0/bin/varnishd/mgt.h
branches/1.0/bin/varnishd/mgt_vcc.c
branches/1.0/bin/varnishd/varnishd.c
Log:
r37085 at cat (orig r1309): phk | 2007-04-09 22:50:12 +0200
Add a -C argument, which compiles the VCL (either default with -b
or user specified with -f) and outputs the C source on the stdout.
Property changes on: branches/1.0
___________________________________________________________________
Name: svk:merge
- d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1308
+ d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1309
Modified: branches/1.0/bin/varnishd/mgt.h
===================================================================
--- branches/1.0/bin/varnishd/mgt.h 2007-04-19 14:51:16 UTC (rev 1351)
+++ branches/1.0/bin/varnishd/mgt.h 2007-04-19 14:51:17 UTC (rev 1352)
@@ -57,7 +57,7 @@
/* mgt_vcc.c */
void mgt_vcc_init(void);
-int mgt_vcc_default(const char *bflag, const char *fflag);
+int mgt_vcc_default(const char *bflag, const char *fflag, int Cflag);
int mgt_push_vcls_and_start(unsigned *status, char **p);
#include "stevedore.h"
Modified: branches/1.0/bin/varnishd/mgt_vcc.c
===================================================================
--- branches/1.0/bin/varnishd/mgt_vcc.c 2007-04-19 14:51:16 UTC (rev 1351)
+++ branches/1.0/bin/varnishd/mgt_vcc.c 2007-04-19 14:51:17 UTC (rev 1352)
@@ -280,9 +280,9 @@
/*--------------------------------------------------------------------*/
int
-mgt_vcc_default(const char *b_arg, const char *f_arg)
+mgt_vcc_default(const char *b_arg, const char *f_arg, int C_flag)
{
- char *addr, *port;
+ char *addr, *port, *csrc;
char *buf, *vf;
struct vsb *sb;
struct vclprog *vp;
@@ -312,8 +312,17 @@
free(addr);
free(port);
AN(buf);
+ if (C_flag) {
+ csrc = VCC_Compile(sb, buf, NULL);
+ fputs(csrc, stdout);
+ exit (0);
+ }
vf = mgt_VccCompile(sb, buf, NULL);
free(buf);
+ } else if (C_flag) {
+ csrc = VCC_CompileFile(sb, f_arg);
+ fputs(csrc, stdout);
+ exit (0);
} else {
vf = mgt_VccCompileFile(sb, f_arg);
}
Modified: branches/1.0/bin/varnishd/varnishd.c
===================================================================
--- branches/1.0/bin/varnishd/varnishd.c 2007-04-19 14:51:16 UTC (rev 1351)
+++ branches/1.0/bin/varnishd/varnishd.c 2007-04-19 14:51:17 UTC (rev 1352)
@@ -398,6 +398,7 @@
const char *h_flag = "classic";
const char *s_arg = "file";
const char *T_arg = NULL;
+ unsigned C_flag;
char *p;
struct params param;
struct cli cli[1];
@@ -432,7 +433,7 @@
MCF_ParamInit(cli);
cli_check(cli);
- while ((o = getopt(argc, argv, "a:b:df:h:p:s:T:t:Vw:")) != -1)
+ while ((o = getopt(argc, argv, "a:b:Cdf:h:p:s:T:t:Vw:")) != -1)
switch (o) {
case 'a':
MCF_ParamSet(cli, "listen_address", optarg);
@@ -441,6 +442,9 @@
case 'b':
b_arg = optarg;
break;
+ case 'C':
+ C_flag = 1;
+ break;
case 'd':
d_flag++;
break;
@@ -495,7 +499,7 @@
usage();
}
- if (mgt_vcc_default(b_arg, f_arg))
+ if (mgt_vcc_default(b_arg, f_arg, C_flag))
exit (2);
setup_storage(s_arg);
More information about the varnish-commit
mailing list