r3104 - trunk/varnish-cache/bin/varnishlog
phk at projects.linpro.no
phk at projects.linpro.no
Tue Aug 19 09:50:50 CEST 2008
Author: phk
Date: 2008-08-19 09:50:50 +0200 (Tue, 19 Aug 2008)
New Revision: 3104
Modified:
trunk/varnish-cache/bin/varnishlog/varnishlog.1
trunk/varnish-cache/bin/varnishlog/varnishlog.c
Log:
Add -u for unbuffered output.
Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.1
===================================================================
--- trunk/varnish-cache/bin/varnishlog/varnishlog.1 2008-08-19 07:46:40 UTC (rev 3103)
+++ trunk/varnish-cache/bin/varnishlog/varnishlog.1 2008-08-19 07:50:50 UTC (rev 3104)
@@ -50,6 +50,7 @@
.Op Fl P Ar file
.Op Fl r Ar file
.Op Fl s Ar num
+.Op Fl u
.Op Fl V
.Op Fl w Ar file
.Op Fl X Ar regex
@@ -136,6 +137,8 @@
Skip the first
.Ar num
log records.
+.It Fl u
+Unbuffered output.
.It Fl V
Display the version number and exit.
.It Fl w Ar file
Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c
===================================================================
--- trunk/varnish-cache/bin/varnishlog/varnishlog.c 2008-08-19 07:46:40 UTC (rev 3103)
+++ trunk/varnish-cache/bin/varnishlog/varnishlog.c 2008-08-19 07:50:50 UTC (rev 3104)
@@ -317,7 +317,7 @@
main(int argc, char **argv)
{
int c;
- int a_flag = 0, D_flag = 0, o_flag = 0;
+ int a_flag = 0, D_flag = 0, o_flag = 0, u_flag = 0;
const char *n_arg = NULL;
const char *P_arg = NULL;
const char *w_arg = NULL;
@@ -326,7 +326,7 @@
vd = VSL_New();
- while ((c = getopt(argc, argv, VSL_ARGS "aDon:P:Vw:")) != -1) {
+ while ((c = getopt(argc, argv, VSL_ARGS "aDon:P:uVw:")) != -1) {
switch (c) {
case 'a':
a_flag = 1;
@@ -351,6 +351,9 @@
case 'P':
P_arg = optarg;
break;
+ case 'u':
+ u_flag = 1;
+ break;
case 'V':
varnish_version("varnishlog");
exit(0);
@@ -391,6 +394,9 @@
if (o_flag)
do_order(vd, argc - optind, argv + optind);
+ if (u_flag)
+ setbuf(stdout, NULL);
+
while (VSL_Dispatch(vd, VSL_H_Print, stdout) >= 0) {
if (fflush(stdout) != 0) {
perror("stdout");
More information about the varnish-commit
mailing list